home *** CD-ROM | disk | FTP | other *** search
- (* ****************************************************** *)
- (* ABS_DISK.PAS *)
- (* Absolute Disk Read/Write Routinen *)
- (* (c) 1993 Andres Cvitkovich & DMV *)
- (* ****************************************************** *)
- UNIT Abs_Disk;
-
- INTERFACE
-
- FUNCTION AbsoluteDiskRead(Drive : BYTE; Buffer : Pointer;
- Sector : LongInt;
- Sectors : Word) : WORD;
- FUNCTION AbsoluteDiskWrite(Drive : BYTE; Buffer : Pointer;
- Sector : LongInt;
- Sectors : WORD) : WORD;
-
- IMPLEMENTATION
-
- TYPE
- DOS4_Packet = RECORD
- Sector : LongInt;
- Sectors : WORD;
- Address : Pointer
- END;
- PtrRec = RECORD
- Off, Sgm : WORD;
- END;
- LongRec = RECORD
- Lo, Hi : WORD;
- END;
-
- VAR
- DOS4Buffer : DOS4_Packet;
-
- CONST
- DosVer : WORD = $0000;
-
-
- FUNCTION AbsoluteDiskRead(Drive : BYTE; Buffer : Pointer;
- Sector : LongInt;
- Sectors : WORD) : WORD;
- ASSEMBLER;
- ASM
- PUSH DS
- MOV AX, DosVer
- OR AX, AX
- JNZ @yet_tested
- MOV AH, 30h
- INT 21h
- XCHG AL, AH
- MOV DosVer, AX
- @yet_tested:
- CMP AH, 4
- JB @Dos3
- MOV AX, LongRec(Sector).Lo
- MOV LongRec(DOS4Buffer.Sector).Lo, AX
- MOV AX, LongRec(Sector).Hi
- MOV LongRec(DOS4Buffer.Sector).Hi, AX
- MOV AX, Sectors
- MOV DOS4Buffer.Sectors, AX
- MOV AX, PtrRec(Buffer).Off
- MOV PtrRec(DOS4Buffer.Address).Off, AX
- MOV AX, PtrRec(Buffer).Sgm
- MOV PtrRec(DOS4Buffer.Address).Sgm, AX
- MOV CX, 0FFFFh
- MOV BX, Offset DOS4Buffer
- MOV AX, Seg DOS4Buffer
- MOV DS, AX
- JMP @call_it
- @Dos3:
- MOV CX, Sectors
- MOV DX, Word(Sector)
- MOV BX, PtrRec(Buffer).Off
- MOV AX, PtrRec(Buffer).Sgm
- MOV DS, AX
- @call_it:
- XOR AH, AH
- MOV AL, Drive
- PUSH BP
- PUSH CS
- POP ES
- MOV BP,((offset @@buggy)-01Eh)
- INT 25h
- POP DX
- JC @@1
- XOR AX, AX
- @@1:
- POP BP
- POP DS
- JMP @@2
- @@buggy: { Fehler in DOS 3.1 bis 3.3 ausgleichen }
- DW 0
- @@2:
- END;
-
- FUNCTION AbsoluteDiskWrite(Drive : BYTE; Buffer : Pointer;
- Sector : LongInt;
- Sectors : WORD) : WORD;
- ASSEMBLER;
- ASM
- PUSH DS
- MOV AX, DosVer
- OR AX, AX
- JNZ @yet_tested
- MOV AH, 30h
- INT 21h
- XCHG AL, AH
- MOV DosVer, AX
- @yet_tested:
- CMP AH, 4
- JB @Dos3
- MOV AX, LongRec(Sector).Lo
- MOV LongRec(DOS4Buffer.Sector).Lo, AX
- MOV AX, LongRec(Sector).Hi
- MOV LongRec(DOS4Buffer.Sector).Hi, AX
- MOV AX, Sectors
- MOV DOS4Buffer.Sectors, AX
- MOV AX, PtrRec(Buffer).Off
- MOV PtrRec(DOS4Buffer.Address).Off, AX
- MOV AX, PtrRec(Buffer).Sgm
- MOV PtrRec(DOS4Buffer.Address).Sgm, AX
- MOV CX, 0FFFFh
- MOV BX, Offset DOS4Buffer
- MOV AX, Seg DOS4Buffer
- MOV DS, AX
- JMP @call_it
- @Dos3:
- MOV CX, Sectors
- MOV DX, Word(Sector)
- MOV BX, PtrRec(Buffer).Off
- MOV AX, PtrRec(Buffer).Sgm
- MOV DS, AX
- @call_it:
- XOR AH, AH
- MOV AL, Drive
- PUSH BP
- PUSH CS
- POP ES
- MOV BP,((Offset @@buggy)-01Eh)
- INT 26h
- POP DX
- JC @@1
- XOR AX, AX
- @@1:
- POP BP
- POP DS
- JMP @@2
- @@buggy:
- DW 0
- @@2:
- END;
-
- END.
- (* ****************************************************** *)
- (* Ende von ABS_DISK.PAS *)
-
-