First OS, some explanations of the assembly line

I am writing my first OS boot sector in an assembly using NASM. It works for me, it just displays "Hello OS World!". in red letters. Simple enough. I converted boot.asm to boot.bin and this is to boot.img. I use a VMWare player, I installed boot.img as a floppy disk and booted from there, and it works great. However, there are a few lines of this assembly code whose purpose I do not 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 ; 

Lines ending with a colon are those that I don’t understand. I did a lot of searches and was able to figure out other things. I am competent enough in writing a meeting. So, for example, I know that mov ax,01301h moves 01301h to the AX register. But I do not understand why, or how 01301h is significant. I would suggest that they are somewhat similar to string formatting options, but this is just an assumption. Any help would be greatly appreciated.

+4
source share
1 answer

Check out this page about INT 10H for more information. These numbers are parameters that control the behavior of this interrupt. In your case:

 ax = 0x1301 -> ah = 0x13 al = 0x01 bx = 0x000c -> bh = 0x00 bl = 0x0c cx = 16 dl = 0x00 

AH=0x13 means "recording string" with various other control parameters:

 AL = write mode -> 1 BL = color -> 0x0c = light red BH = page number -> 0 CX = string length -> = 16 DH = row -> 0 DL = column -> 0 ES:BP = offset of string -> pointer to BootMessage string 
+9
source

All Articles