Skip to content

Instantly share code, notes, and snippets.

@NCommander
Created September 11, 2021 08:12
Show Gist options
  • Save NCommander/a0739292ad62d92bf2c7586b448b27a5 to your computer and use it in GitHub Desktop.
Save NCommander/a0739292ad62d92bf2c7586b448b27a5 to your computer and use it in GitHub Desktop.
Reading BIOS disk geometry on VENIX/86 ...
| Attempt to get disk geometry
| Paramter is which disk drive to read
.globl _bhgeo
_bhgeo:
push bp
mov bp, sp
mov dl, *4(bp)
| RBL recommends ES/DI be set to zeros
mov ax, #0
mov es, ax
mov di, ax
xor ax, ax
mov ah, #0x08
int 0x13
mov ax, #-1
jb getgeo_ret
| We load 0x0 at word size to zero out the memory
| space, then write in what we need, since the
| sizes are unusual
| Return the number of heads
mov bx, *8(bp)
seg ds
mov (bx), #0
seg ds
movb (bx), dh
| Cylinders and sectors are in CX, so make a copy
| then do sectors first
push cx
mov bx, *10(bp)
seg ds
mov (bx), #0
and cx, #0x3f
seg ds
movb (bx), cl
| Now we do cylinders. We pop to ax so we
| can use shr ax, cl instead of shr 6 times
pop ax
and al, #0xc0
mov cl, #6
shr al, cl
xchg ah, al
mov bx, *6(bp)
seg ds
mov (bx), ax
mov ax, #0
getgeo_ret:
pop bp
ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment