;Include-Datei zur Festplattenverwaltung
;DrvInfo Datenbereich
; 1 Byte Laufwerk
; 1 Byte Sektor
; 1 Byte Kopf
; 1 Word Zylinder
; 1 Word Kopf*Sektor-Produkt
;
;UseDrv "Öffnen" eines Laufwerkes, PE: DL=Laufwerk
; PA: [DrvInfo]: Laufwerksinformationen
; DXAX: Größe der Platte
; CY=1: Fehler, dann AL=Fehlercode
;
;A2CHS Wandlung Absolutsektor->Cyl/Hed/Sec, KEIN Überlaufcheck!
; (evtl. DIV/0-Error möglich!)
; PE: DXAX: Absoluter Sektor
; [DS:DrvInfo]: gefüllt mit Infos
; PA: DX=Zylinder, AH=Sektor, AL=Kopf
;
;CHS2B Wandlung des Outputs von A2CHS in die BIOS-Form.
; PE: DXAX: s. PA von A2CHS
; PA: DH,CX: s. RBIL (Ralf Brown Interrupt List)
;
;Abs13 Zugriff auf Int13 über absolute Sektoren
; PE: CH: Funktionsnummer
; CL: Anzahl Sektoren
; DXAX: Absoluter Sektor
; ES:BX: Sektorpuffer
include prolog.asm
macro _DRVINFO
struc tDrvInfo
Drv db ? ;Laufwerk
Secs db ? ;Sektoren
Heads db ? ;Köpfe
Cyls dw ? ;Zylinder
S_x_H dw ? ;Sektoren mal Köpfe
ends
DrvInfo tDrvInfo <> ;uninitialisiert
endm
macro _USEDRV
proc UseDrv
mov [DrvInfo.Drv],dl
INTR 13h,8
jc @@e
mov ah,dh ;Kopf
mov al,cl ;Zylinder
and cl,3fh
mov [DrvInfo.Secs],cl ;Sektoren
and dh,3fh
inc dh
mov [DrvInfo.Heads],dh ;Köpfe
xchg ax,dx
mov al,cl
mul ah
mov [DrvInfo.S_x_H],ax ;Produkt daraus
mov cl,2
rol dh,cl ;Kopf-Bits
rol dx,cl ;Sektor-Bits
mov dl,ch
and dh,0fh ;max.4095
inc dx
mov [DrvInfo.Cyls],dx
mul dx ;DXAX=Größe in Sektoren
@@e: ret
endp
endm
macro _A2CHS checkp ;"Check"-Parameter
proc A2CHS
div [DrvInfo.S_x_H]
ifnb <checkp>
cmp [DrvInfo.Cyls],ax
cmc
jc @@e
endif
xchg dx,ax
div [DrvInfo.Heads]
inc ah
@@e: ret
endp
endm
macro _CHS2B
proc CHS2B
ror dh,1
ror dh,1
mov cl,dh
and cl,0c0h
or cl,ah ;CL okay
ror dh,1
ror dh,1
and dh,0c0h
or dh,al ;DH okay
mov ch,dl ;CH okay
ret
endp
endm
macro _ABS13
_USEDRV
_A2CHS
_CHS2B
proc Abs13 ;VR: ax,cx,dx
push cx
call A2CHS
call CHS2B
mov dl,[DrvInfo.Drv]
pop ax
int 13h
ret
endp
endm
;Testprogramm
mov dl,81h
call UseDrv
mov bx,ofs Puffer
mov dx,2
mov ax,3456h
mov cx,201h
call Abs13
DOS 4c00h
_ABS13
_DRVINFO
Puffer db 512 dup (?)
endc
Detected encoding: OEM (CP437) | 1
|
|