vbr: display drive geometry
This commit is contained in:
parent
a46114f6bd
commit
f70242dfa2
76
boot/vbr.asm
76
boot/vbr.asm
@ -58,7 +58,11 @@ _startup:
|
|||||||
mov ss, ax
|
mov ss, ax
|
||||||
xor sp, sp
|
xor sp, sp
|
||||||
|
|
||||||
mov [fdc.drv], dl ; backup driver number
|
call print_inline
|
||||||
|
db "VBR: Using", 0
|
||||||
|
|
||||||
|
mov [fdc.drv], dl ; backup drive number
|
||||||
|
.adjust_chs:
|
||||||
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 .noadjust ; skip if function does not exist
|
||||||
@ -75,11 +79,38 @@ _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
|
||||||
|
|
||||||
|
call print_inline
|
||||||
|
db " BIOS", 0
|
||||||
.noadjust:
|
.noadjust:
|
||||||
|
call print_inline
|
||||||
|
db " CHS ", 0
|
||||||
|
|
||||||
|
mov ax, [fdc.ts]
|
||||||
|
div word [fdc.nos]
|
||||||
|
div word [fdc.spt]
|
||||||
|
call print_number
|
||||||
|
|
||||||
|
call print_inline
|
||||||
|
db ",", 0
|
||||||
|
|
||||||
|
mov ax, [fdc.nos]
|
||||||
|
call print_number
|
||||||
|
|
||||||
|
call print_inline
|
||||||
|
db ",", 0
|
||||||
|
|
||||||
|
mov ax, [fdc.spt]
|
||||||
|
call print_number
|
||||||
|
|
||||||
|
call print_inline
|
||||||
|
db 0x0A, 0x0D, 0
|
||||||
|
|
||||||
mov ax, 0x0070
|
mov ax, 0x0070
|
||||||
mov es, ax
|
mov es, ax
|
||||||
xor bx, bx
|
xor bx, bx
|
||||||
call loadrootdir
|
call loadrootdir
|
||||||
|
|
||||||
call dump
|
call dump
|
||||||
.end:
|
.end:
|
||||||
hlt
|
hlt
|
||||||
@ -149,6 +180,39 @@ loadblk:
|
|||||||
add bx, 0x0200
|
add bx, 0x0200
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
print_number:
|
||||||
|
mov cx, 0x000A
|
||||||
|
xor dx, dx
|
||||||
|
div cx ; ax = dx:ax / 10, dx = dx:ax % 10
|
||||||
|
and ax, ax
|
||||||
|
jz .print
|
||||||
|
push dx
|
||||||
|
call print_number
|
||||||
|
pop dx
|
||||||
|
.print:
|
||||||
|
mov al, dl
|
||||||
|
add al, 0x30
|
||||||
|
mov ah, 0x0e
|
||||||
|
int 0x10
|
||||||
|
ret
|
||||||
|
|
||||||
|
print_inline:
|
||||||
|
pop si
|
||||||
|
push bx
|
||||||
|
.loop:
|
||||||
|
lodsb
|
||||||
|
cmp al, 0x00
|
||||||
|
je .end
|
||||||
|
mov bx, 0x0000
|
||||||
|
mov ah, 0x0e
|
||||||
|
int 0x10
|
||||||
|
cmp al, 0x0D
|
||||||
|
jmp .loop
|
||||||
|
.end:
|
||||||
|
pop bx
|
||||||
|
push si
|
||||||
|
ret
|
||||||
|
|
||||||
dump:
|
dump:
|
||||||
mov si, bx
|
mov si, bx
|
||||||
mov cx, 0x10
|
mov cx, 0x10
|
||||||
@ -179,5 +243,13 @@ dump:
|
|||||||
|
|
||||||
%include "print.asm"
|
%include "print.asm"
|
||||||
|
|
||||||
times (0x1FE - ($-$$)) nop
|
times (0x1F0 - ($-$$)) db 0
|
||||||
|
|
||||||
|
str_bootfile:
|
||||||
|
db "BOOT"
|
||||||
|
times (0x1F8 - ($-$$)) db " "
|
||||||
|
db "BIN"
|
||||||
|
|
||||||
|
times (0x1FE - ($-$$)) db 0
|
||||||
|
|
||||||
dw 0xAA55
|
dw 0xAA55
|
||||||
|
Loading…
Reference in New Issue
Block a user