vbr: bail out on disk read error
This commit is contained in:
parent
f70242dfa2
commit
cb3c977286
40
boot/vbr.asm
40
boot/vbr.asm
@ -58,14 +58,12 @@ _startup:
|
|||||||
mov ss, ax
|
mov ss, ax
|
||||||
xor sp, sp
|
xor sp, sp
|
||||||
|
|
||||||
call print_inline
|
|
||||||
db "VBR: Using", 0
|
|
||||||
|
|
||||||
mov [fdc.drv], dl ; backup drive number
|
mov [fdc.drv], dl ; backup drive number
|
||||||
.adjust_chs:
|
|
||||||
|
chs_bios:
|
||||||
mov ah, 0x08
|
mov ah, 0x08
|
||||||
int 0x13 ; required, QEMU detects 360kB as 1200kB with CHS 80 2 15
|
int 0x13 ; required, QEMU detects 360kB as 1200kB with CHS 80 2 15
|
||||||
jc .noadjust ; skip if function does not exist
|
jc chs_print ; skip if function does not exist
|
||||||
inc dh
|
inc dh
|
||||||
mov [fdc.nos], dh
|
mov [fdc.nos], dh
|
||||||
mov ax, cx
|
mov ax, cx
|
||||||
@ -79,12 +77,11 @@ _startup:
|
|||||||
mul word [fdc.nos] ; number of tracks = number of cylinders * heads
|
mul word [fdc.nos] ; number of tracks = number of cylinders * heads
|
||||||
mul word [fdc.spt] ; number of sectors = number of tracks * sectors per track
|
mul word [fdc.spt] ; number of sectors = number of tracks * sectors per track
|
||||||
mov [fdc.ts], ax
|
mov [fdc.ts], ax
|
||||||
|
jmp chs_print
|
||||||
|
|
||||||
|
chs_print:
|
||||||
call print_inline
|
call print_inline
|
||||||
db " BIOS", 0
|
db "CHS ", 0
|
||||||
.noadjust:
|
|
||||||
call print_inline
|
|
||||||
db " CHS ", 0
|
|
||||||
|
|
||||||
mov ax, [fdc.ts]
|
mov ax, [fdc.ts]
|
||||||
div word [fdc.nos]
|
div word [fdc.nos]
|
||||||
@ -112,6 +109,7 @@ _startup:
|
|||||||
call loadrootdir
|
call loadrootdir
|
||||||
|
|
||||||
call dump
|
call dump
|
||||||
|
|
||||||
.end:
|
.end:
|
||||||
hlt
|
hlt
|
||||||
jmp .end
|
jmp .end
|
||||||
@ -142,16 +140,6 @@ loadrootdir:
|
|||||||
pop bx
|
pop bx
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; Load a cluster from cluster offset
|
|
||||||
; in ax cluster number
|
|
||||||
; es:bx buffer
|
|
||||||
loadcl:
|
|
||||||
mov ax, [fdc.sf]
|
|
||||||
mul byte [fdc.fn]
|
|
||||||
add ax, [fdc.rsc]
|
|
||||||
call print16
|
|
||||||
ret
|
|
||||||
|
|
||||||
; Load a single block into memory
|
; Load a single block into memory
|
||||||
; in ax sector number
|
; in ax sector number
|
||||||
; es:bx buffer
|
; es:bx buffer
|
||||||
@ -173,12 +161,24 @@ loadblk:
|
|||||||
mov dl, [fdc.drv] ; driver number
|
mov dl, [fdc.drv] ; driver number
|
||||||
mov ax, 0x0201 ; ah=0x02 al=0x01
|
mov ax, 0x0201 ; ah=0x02 al=0x01
|
||||||
int 0x13
|
int 0x13
|
||||||
|
jc .error
|
||||||
pop dx
|
pop dx
|
||||||
pop cx
|
pop cx
|
||||||
pop ax
|
pop ax
|
||||||
inc ax
|
inc ax
|
||||||
add bx, 0x0200
|
add bx, 0x0200
|
||||||
ret
|
ret
|
||||||
|
.error:
|
||||||
|
xor al, al
|
||||||
|
xchg al, ah
|
||||||
|
call print_inline
|
||||||
|
db "disk error ", 0
|
||||||
|
call print_number
|
||||||
|
call print_inline
|
||||||
|
db 0x0A, 0x0D, 0
|
||||||
|
.hlt:
|
||||||
|
hlt
|
||||||
|
jmp .hlt
|
||||||
|
|
||||||
print_number:
|
print_number:
|
||||||
mov cx, 0x000A
|
mov cx, 0x000A
|
||||||
@ -198,6 +198,7 @@ print_number:
|
|||||||
|
|
||||||
print_inline:
|
print_inline:
|
||||||
pop si
|
pop si
|
||||||
|
push ax
|
||||||
push bx
|
push bx
|
||||||
.loop:
|
.loop:
|
||||||
lodsb
|
lodsb
|
||||||
@ -210,6 +211,7 @@ print_inline:
|
|||||||
jmp .loop
|
jmp .loop
|
||||||
.end:
|
.end:
|
||||||
pop bx
|
pop bx
|
||||||
|
pop ax
|
||||||
push si
|
push si
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user