vbr: reduce size for error reporting

This commit is contained in:
Nero 2019-03-31 12:44:50 +00:00
parent 8bb23d8a25
commit 6e209d9e55

View File

@ -49,10 +49,12 @@ _startup:
mov es, ax mov es, ax
mov ss, ax mov ss, ax
xor sp, sp xor sp, sp
mov cx, 0x0100 ; relocate
mov si, 0x7C00 mov si, 0x7C00
mov di, 0x0500 mov di, 0x0500
rep movsw ; relocate mov cx, 0x0100
rep movsw
; adjust CS
jmp 0x0000:main jmp 0x0000:main
main: main:
@ -60,7 +62,7 @@ main:
adjustchs: adjustchs:
mov ah, 0x08 mov ah, 0x08
int 0x13 ; required, QEMU detects 360kB as 1200kB with CHS 80 2 15 int 0x13
jc loaddir ; skip if function does not exist jc loaddir ; skip if function does not exist
inc dh inc dh
mov [fdc.nos], dh mov [fdc.nos], dh
@ -107,24 +109,43 @@ scandir:
jz found jz found
add bx, 0x0020 ; 32 bytes per directory entry add bx, 0x0020 ; 32 bytes per directory entry
loop .loop loop .loop
call print_inline call error
db "File not found", 0x0A, 0x0D, 0 db "NOT FOUND", 0
jmp hlt
found: found:
add bx, 26 add bx, 26
mov ax, [bx] mov ax, [bx]
call print16 call print16
jmp hlt jmp hlt
error:
call print16
pop si
mov bx, 0x0000
mov al, 0x20
.loop:
mov ah, 0x0e
int 0x10
lodsb
cmp al, 0x00
jne .loop
; fall through into htl
hlt: hlt:
hlt hlt
jmp hlt jmp hlt
; Load a single FAT cluster into memory
; in ax cluster number
; bx buffer
;
loadsec:
ret
; Load a single block into memory ; Load a single block into memory
; Does not return on error
; in ax sector number ; in ax sector number
; bx buffer ; bx buffer
; out al error code,
; carry set if error
loadblk: loadblk:
push ax push ax
push cx push cx
@ -148,42 +169,8 @@ loadblk:
ret ret
.error: .error:
xchg al, ah xchg al, ah
call print_inline call error
db "disk error ", 0 db "DISK ERROR", 0
call print8
call print_inline
db 0x0A, 0x0D, 0
jmp hlt
; in si
dump:
mov si, bx
mov cx, 0x10
.nextline:
mov ax, si
call print16
push si
call print_inline
db 0x3A, 0x20, 0
pop si
push cx
mov cx, 0x0020
.bytes:
lodsb
call print8
loop .bytes
pop cx
push si
call print_inline
db 0x0A, 0x0D, 0
pop si
loop .nextline
ret
%include "print.asm" %include "print.asm"