Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [BITS 16]
- [ORG 0x7C00]
- bootload_main:
- mov si, HelloWorld
- call printk
- call loadSector
- cli
- hlt
- printk:
- lodsb
- or al, al
- jz .done
- mov ah, 0x0E
- int 0x10
- jmp printk
- .done
- ret
- loadSector:
- mov ah, 0x01
- int 0x13
- jnz loadSector ; loop if an error occured (or not ready, shouldn't happen under qemu)
- ; for the values below I've played around with 1's and 0's trying to
- ; guess to see if I can get it to work without some conversion function
- mov ah, 0x02 ; read sector
- mov al, 1
- mov ch, 1 ; track
- mov cl, 1 ; sector
- mov dh, 1 ; head
- mov dl, 0x80 ; read from first hd
- mov bx, 0x7E00
- cmp al, 0x00
- je .successful
- mov si, LoadSectorUnsuccessful
- call printk
- ret
- .successful
- mov si, LoadSectorSuccessful
- call printk
- ret
- HelloWorld db 'Hello, World!', 13, 10, 0
- LoadSectorSuccessful db 'Loaded Sector Successfully!', 13, 10, 0
- LoadSectorUnsuccessful db 'Unsuccessful Sector load :(', 13, 10, 0
- times 510-($-$$) db 0
- dw 0xAA55
- times 512 db 0
Advertisement
Add Comment
Please, Sign In to add comment