Advertisement
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 si, text_string ; Put string position into SI
- call print_string ; Call our string-printing routine
- mov si, name_string
- call print_name
- jmp $ ; Infinite loop so that the text is displayed and
- text_string db 'This is my cool new OS! Woohoo!',0
- name_string db 'Chiggins',0
- ;---------------------------------------------------------------------------------------
- exit:
- ret
- ;---------------------------------------------------------------------------------------
- print_string: ; Routine: output string in SI to screen
- mov ah, 0Eh ; int 10h 'print char' function - puts in upper half of AX (AH)
- .repeat:
- lodsb ; Get character from string (from SI)
- cmp al, 0 ; Places character in lower half of AX (AL)
- je .done ; If char is zero, end of string
- int 10h ; Otherwise, print it (gets char from AL)
- jmp .repeat
- .done:
- call exit
- ;---------------------------------------------------------------------------------------
- print_name:
- mv ah, 0Eh
- .repeat:
- lodsb
- cmp al,0
- je .done
- int 10h
- jmp .repeat
- .done
- call exit
- ;---------------------------------------------------------------------------------------
- times 510-($-$$) db 0 ; Pad remainder of boot sector with 0x
- dw 0xAA55 ; The standard PC boot signature
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement