I am writing my first OS boot sector in assembly using NASM. I have it working, it just displays “Hello OS world!” in red letters. Simple enough. I have converted my boot.asm into boot.bin, and that into boot.img. I am using VMWare player, i mounted the boot.img as a floppy drive and booted from there and it works great.However there are a few lines of this assembly code who’s purpose I don’t understand.
org 07c00h
mov ax, cs
mov ds, ax
mov es, ax
call DispStr
jmp $
DispStr:
mov ax, BootMessage
mov bp, ax
mov cx, 16
mov ax, 01301h ;
mov bx, 000ch ;
mov dl, 0 ;
int 10h ;
ret
BootMessage: db "Hello, OS world!"
times 510-($-$$) db 0
dw 0xaa55 ;
The lines ending with the semi-colon are the ones that i don’t understand. I have done a lot of googling and have been able to figure out the other stuff.
I am fairly competent in writing assembly. So for example I know mov ax,01301h moves the 01301h into the AX register. But i don’t understand why, or how 01301h is significant. I would guess they are somewhat like parameters for formatting the string, but that is just a guess. Any and all help would be greatly appreciated.
Check out this page about INT 10H for more information. Those numbers are parameters controlling the behaviour of that interrupt. In your case:
The
AH=0x13means ‘write string’, with various other controlling parameters: