All pastes #985110 Raw Edit

Anonymous

public text v1 · immutable
·published 2008-04-14 20:01 UTC
rendered paste body
; bootloader.s

[BITS 16]               ; Emit 16bit code
[ORG 0x7C00]            ; The BIOS loads the boatloader at offset 0x7C00

call clear_screen 
call print_string

cli                     ; Disable interrupts
hlt                     ; Halt the processor

print_string:
mov al, 1
xor bh, bh
mov bl, 07h
mov cx, hello_end - hello 
xor dx, dx
mov bp, hello
mov ah, 13h 
int 10h

ret

clear_screen:
xor al, al
mov bh, 07h

xor cx, cx

mov dh, 25
mov dl, 80

mov ah, 07h
int 10h

xor dx, dx

xor bh, bh
mov ah, 2
int 10h

ret

hello db "Hello World!"
hello_end:

times 510-($-$$) db 0   ; Fill the remaining 510 bytes with 0
dw 0xAA55               ; End with AA55 otherwise the BIOS won't recognise this as a bootsector