vbr: reduce size for error reporting

This commit is contained in:
Nero 2019-03-31 12:44:50 +00:00
parent 8bb23d8a25
commit 6e209d9e55
1 changed files with 31 additions and 44 deletions

View File

@ -49,10 +49,12 @@ _startup:
mov es, ax
mov ss, ax
xor sp, sp
mov cx, 0x0100
; relocate
mov si, 0x7C00
mov di, 0x0500
rep movsw ; relocate
mov cx, 0x0100
rep movsw
; adjust CS
jmp 0x0000:main
main:
@ -60,7 +62,7 @@ main:
adjustchs:
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
inc dh
mov [fdc.nos], dh
@ -107,24 +109,43 @@ scandir:
jz found
add bx, 0x0020 ; 32 bytes per directory entry
loop .loop
call print_inline
db "File not found", 0x0A, 0x0D, 0
jmp hlt
call error
db "NOT FOUND", 0
found:
add bx, 26
mov ax, [bx]
call print16
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
jmp hlt
; Load a single FAT cluster into memory
; in ax cluster number
; bx buffer
;
loadsec:
ret
; Load a single block into memory
; Does not return on error
; in ax sector number
; bx buffer
; out al error code,
; carry set if error
loadblk:
push ax
push cx
@ -148,42 +169,8 @@ loadblk:
ret
.error:
xchg al, ah
call print_inline
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
call error
db "DISK ERROR", 0
%include "print.asm"