mirror of https://github.com/garritfra/ditto-os
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
792 B
44 lines
792 B
BITS 16 |
|
|
|
main |
|
|
|
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 |
|
add ax, 1000 |
|
mov ds, ax |
|
|
|
main_loop: |
|
call read_char |
|
jmp main_loop ; Jump here - infinite loop! |
|
|
|
|
|
text_string db 'Loading kernel', 0 |
|
|
|
|
|
read_char: |
|
mov ah, 0h |
|
int 16h |
|
mov ah, 0eh |
|
int 10h |
|
|
|
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
|
|
|