Throw DOS api away, re-layout memory to fit CP/M model

This commit is contained in:
Nero 2019-09-29 08:52:00 +00:00
parent 2935d7ee6c
commit 56f9df5773
5 changed files with 57 additions and 210 deletions

View file

@ -1,53 +0,0 @@
; drive table
%define drivetab_type 0x00 ; BYTE 0=unassigned, 1=BIOS/CHS, 2=BIOS/LBA
%define drivetab_num 0x01 ; BYTE DL number
; CHS data for type=1
; Might be reused for driver address
%define drivetab_heads 0x02 ; WORD CHS heads
%define drivetab_spt 0x04 ; WORD CHS sectors per track
%define drivetab_sectors 0x06 ; DWORD total number of sectors
%define drivetab_offset 0x0A ; DWORD partition offset
%define drivetab_size 0x0E
drive_table:
dw 0
.count:
dw 4
; DI is incremented for the space taken
; IN ES:DI
drive_setup:
xor cx, cx
mov [drive_table], di
mov al, drivetab_size
mov ah, BYTE [drive_table.count]
mul ah
xchg cx, ax
; this increments DI and also fills table with zeros
rep stosb
ret
; Load a drive table entry
; IN DL drive number
; OUT DS:SI ptr to table item
drive_load:
; bail out if number too high
cmp dl, [cs:drive_table.count]
jnc .err
push cs
pop ds
mov si, [drive_table]
push ax
mov al, drivetab_size
mul dl
add si, ax
pop ax
ret
.err:
stc
ret