Updated kernel to allow for inter-segment calls to functions. Use Unix Line Endings for the print function

This commit is contained in:
Xnoe 2021-08-30 09:11:31 +01:00
parent a33c25d744
commit 514f07e009
Signed by: xnoe
GPG Key ID: 45AC398F44F0DAFE

View File

@ -179,6 +179,13 @@ print_loop:
lodsb lodsb
cmp al, 0 cmp al, 0
je print_exit je print_exit
; Use Unix Line endings (\n)
cmp al, 10
jne _print_skip
int 10h
mov al, 13
int 10h
_print_skip:
int 10h int 10h
jmp print_loop jmp print_loop
print_exit: print_exit:
@ -243,10 +250,11 @@ file_exists:
mov bp, sp mov bp, sp
mov cx, 256 ; Hardcode the amount of entries for now mov cx, 256 ; Hardcode the amount of entries for now
mov ax, ds
mov ax, 2000h
mov es, ax mov es, ax
mov ax, 0 xor ax, ax
file_exists_loop: file_exists_loop:
pop si ; Get value in to si pop si ; Get value in to si
push si ; Keep track of original value push si ; Keep track of original value
@ -277,6 +285,10 @@ load_file:
push bp push bp
mov bp, sp mov bp, sp
push ds
mov ax, 2000h
mov ds, ax
mov ax, word [bp + 4] mov ax, word [bp + 4]
mov es, ax mov es, ax
@ -308,6 +320,7 @@ load_file_loop:
jmp load_file_loop jmp load_file_loop
load_file_loaded: load_file_loaded:
pop ds
pop bp pop bp
ret 6 ret 6
@ -368,11 +381,27 @@ ihdlr:
jne _ihdlr_2 jne _ihdlr_2
push si push si
call print call print
jmp _ihdlr_fin
_ihdlr_2: _ihdlr_2:
cmp ah, 02h cmp ah, 02h
jne _ihdlr_3 jne _ihdlr_3
push si push si
push di push di
call readline call readline
jmp _ihdlr_fin
_ihdlr_3: _ihdlr_3:
cmp ah, 03h
jne _ihdlr_4
push si
push di
push bx
call load_file
jmp _ihdlr_fin
_ihdlr_4:
cmp ah, 04h
jne _ihdlr_5
call file_exists
jmp _ihdlr_fin
_ihdlr_5:
_ihdlr_fin:
iret iret