Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BITS 16
- start:
- mov ax, 07C0h ; Set up 4K stack space after this bootloader
- add ax, 288 ; (4096 + 512) / 16 bytes per paragraph
- mov ss, ax
- mov sp, 4096
- mov ax, 07C0h ; Set data segment to where we're loaded
- mov ds, ax
- mov ah, 00h
- mov al, 01h
- int 10h
- mov si, text_string ; Put string position into SI
- call print_string ; Call our string-printing routine
- .mainLoop:
- mov ah, 00h
- int 16h
- mov ah, 0Eh
- int 10h
- jmp .mainLoop
- text_string:
- db 020h, 0DBh, 0DBh, 0DBh, 020h, 020h, 020h, 0DBh, 0DBh, 0DBh, 020h, 00Ah, 00Dh
- db 0DBh, 020h, 020h, 020h, 0DBh, 020h, 0DBh, 020h, 020h, 020h, 0DBh, 00Ah, 00Dh
- db 0DBh, 020h, 020h, 020h, 0DBh, 020h, 0DBh, 020h, 020h, 020h, 020h, 00Ah, 00Dh
- db 0DBh, 020h, 020h, 020h, 0DBh, 020h, 020h, 0DBh, 0DBh, 0DBh, 020h, 00Ah, 00Dh
- db 0DBh, 020h, 020h, 020h, 0DBh, 020h, 020h, 020h, 020h, 020h, 0DBh, 00Ah, 00Dh
- db 0DBh, 020h, 020h, 020h, 0DBh, 020h, 0DBh, 020h, 020h, 020h, 0DBh, 00Ah, 00Dh
- db 020h, 0DBh, 0DBh, 0DBh, 020h, 020h, 020h, 0DBh, 0DBh, 0DBh, 020h, 00Ah, 00Dh
- db "Press ENTER to start. (Well, not yet.)", 00Ah, 00Dh, 0
- print_string: ; Routine: output string in SI to screen
- mov ah, 0Eh ; int 10h 'print char' function
- .repeat:
- lodsb ; Get character from string
- cmp al, 0
- je .done ; If char is zero, end of string
- int 10h ; Otherwise, print it
- jmp .repeat
- .done:
- ret
- times 510-($-$$) db 0 ; Pad remainder of boot sector with 0s
- dw 0xAA55 ; The standard PC boot signature
Advertisement
Add Comment
Please, Sign In to add comment