Change loadf so that it aborts if the load fails and so that it doesn’t print error messages itself, only sends an error code to the program that called it.

This commit is contained in:
CrazyEttin 2021-06-24 20:30:49 +03:00
parent f826fef4fc
commit dd139699af
2 changed files with 6 additions and 17 deletions

View File

@ -53,13 +53,10 @@ pop ax
call .checkconv
jmp .extloop
;Set the carry flag and print an error message if the file name is invalid
;Set the carry flag if the file name is invalid
.error:
pop ax
stc
mov si, .errormsg
mov ah, 0x2
int 0x21
jmp .done
;Find and load the file
@ -81,6 +78,8 @@ mov al, 0x1
;Load
mov ah, 0x2
int 0x13
;Abort if the load failed
jc .done
;Store the disk values used for the rest of the call
mov ax, word [buffer + 0xb]
@ -146,11 +145,8 @@ add di, ax
pop cx
loop .search
;Set the carry flag and print an error message if the file is not found
;Set the carry flag if the file is not found
stc
mov si, .errormsg
mov ah, 0x2
int 0x21
jmp .clearstack
;Load the file entry
@ -261,7 +257,6 @@ iret
.sectorspertrack dw 0x0
.sides dw 0x0
.file times 0xb db 0x20
.errormsg db "File not found", 0x0
.cluster dw 0x0
.pointer dw 0x0

View File

@ -77,7 +77,7 @@ mov ah, 0x0
int 0x21
;Read
mov di, input
mov al, 0x4e
mov al, 0x4c
mov ah, 0x3
int 0x21
@ -105,12 +105,6 @@ jmp 0x2000
;Print a command error message and return to the shell
cmderror:
mov bh, 0x0
mov ah, 0x3
int 0x10
dec dh
mov ah, 0x2
int 0x10
mov si, cmderrormsg
mov ah, 0x2
int 0x21
@ -169,7 +163,7 @@ welcomemsg db 0xd, 0xa, "Welcome to EttinOS!", 0xd, 0xa, 0x0
prompt db "> ", 0x0
driverrormsg db "Unknown drive", 0x0
cmderrormsg db "Unknown command", 0x0
input times 0x4e db 0x0
input times 0x4c db 0x0
crlf db 0xd, 0xa, 0x0
;Set the drive letter