Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
i wrote a simple bootsector in NASM . It should just print a message to the screen and then enter a infinite loop. But it doesn?t print anything. Could you please check my code and tell me what i am doing wrong?
Thank you very much !
ORG 0x7c00
mov ax,0x1301 ; function to write a string on screen
; al = 01 => update cursor
mov bx,0x0007 ; page 0, white on black
mov cx,message_length
mov dx,0 ; row 0 , col 0
mov es,dx ;
mov bp,message ; es:bp is pointing at the string to output
int 0x10 ; finally invoke the interrupt to output the message
forever: jmp forever
message: db "Hello , i am a bootsector"
message_length equ $-message
times 510-($$-$) db 0xFF ; fill space with 0xFF , so that we fit exactly 512 bytes
dw 0xAA55 ; this is the magic signature for the boot-sector
???
ORG 0x7c00
mov ax, cs ; you should initialize the data segment for you variables
mov ds, ax
.....
;times 510-($$-$) db 0xFF ???this line
times 510-($-$$) db 0xFF ; should be this (look at the $$)
.....