]> git.dujemihanovic.xyz Git - nameless-os.git/blob - boot.s
50730d0c39dd9566f3eef2e0b87582758af13444
[nameless-os.git] / boot.s
1 bits 16 ; boot sectors run in real mode
2 org 7c00h ; boot sector is always loaded at 0x7c00
3
4 mov al, 1 ; update cursor after write
5 mov bh, 0 ; write to page 0
6 mov bl, 00000111b ; attribute: high nibble is foreground (light gray),
7 ; low nibble is background (black)
8 ; NOTE: in the binary, these will be inverted, so low nibble here will become high nibble in binary and vice versa!
9 mov cx, msg1end - msg1 ; size of message
10 mov dl, 0 ; column to write to
11 mov dh, 0 ; row to write to
12 push cs ; push code segment to stack
13 pop es ; pop pushed code segment to extra segment, this serves as the base to the string
14 mov bp, msg1 ; offset where the string is
15 mov ah, 13h ; write string subservice
16 int 10h ; call BIOS interrupt 0x10
17 jmp msg1end ; jmp to endless loop
18 msg1 db "Gotta start somewhere"
19 msg1end: jmp msg1end
20
21 times 510-($-$$) db 0 ; fill with 0 until 0x1fc is reached
22 dw 0xaa55 ; BIOS MBR signature