home *** CD-ROM | disk | FTP | other *** search
- {$A-}
- {$M 1024,0,16384}
- uses
- DOS, CRT;
-
- const
- ReadNum = 256;
-
- type
- TResult =
- Array [1..ReadNum] of
- record
- Num :Word;
-
- Drive, Head :Byte;
- Sector, Track:Byte;
- Count :Byte;
-
- Size :Word;
- Buffer :Pointer;
-
- DPT :Array [0..10] of Byte;
- end;
-
- var
- Drive, Head :Byte;
- Sector, Track :Byte;
- Count :Byte;
- Buffer :Pointer;
-
- Id :String[8];
- RMax,
- RNum, RPos :Word;
- Result :TResult;
-
- DPTAddr :Pointer;
-
- procedure BeforeRead;
- interrupt;
- begin
- Sound(3000); Delay(10); NoSound;
-
- Inc(RNum); Inc(RPos);
- if RPos>ReadNum then RPos:=1;
-
- Result[RPos].Num:=RNum;
- Result[RPos].Drive:=Drive;
- Result[RPos].Head:=Head; Result[RPos].Sector:=Sector;
- Result[RPos].Track:=Track; Result[RPos].Count:=Count;
-
- GetIntVec($1E, DPTAddr); Move(DPTAddr^, Result[RPos].DPT, 11);
-
- Result[RPos].Size:=Count shl (7+Result[RPos].DPT[3]);
- end;
-
- procedure AfterRead;
- interrupt;
- begin
- if MaxAvail>=Result[RPos].Size then
- begin
- GetMem(Result[RPos].Buffer, Result[RPos].Size);
- Move(Buffer^, Result[RPos].Buffer^, Result[RPos].Size);
- end
- else Result[RPos].Buffer:=nil;
- end;
-
- procedure CLast13;
- assembler;
- asm
- dd 0
- dw 0, 0, 0
- end;
-
- procedure Int13;
- assembler;
- asm
- cmp ah,2
- jne @@1
- cmp dl,1
- ja @@1
-
- push ds
- push ax
- mov ax,seg @DATA
- mov ds,ax
- pop ax
-
- mov word ptr Drive,dx
- mov word ptr Sector,cx
- mov Count,al
- mov word ptr Buffer,bx
- mov word ptr Buffer+2,es
-
- pushf
- push cs
- call BeforeRead
-
- pushf
- call dword ptr CLast13
-
- pushf
- push cs
- call AfterRead
-
- pop ds
- mov word ptr CLast13+4,ax
- mov word ptr CLast13+6,bx
- mov word ptr CLast13+8,cx
- pop ax
- pop bx
- pop cx
- push bx
- push ax
- mov ax,word ptr CLast13+4
- mov bx,word ptr CLast13+6
- mov cx,word ptr CLast13+8
- retf
-
- @@1:
- jmp dword ptr CLast13
- end;
-
- var
- Last13 :Pointer;
- CId :^String;
-
- begin
- WriteLn('Floppy Drive Reads Saver Copyright (c) 1994 by Sasha Peslyak');
-
- Id:='SAVEREAD';
-
- GetIntVec($64, Pointer(CId));
- if CId^=Id then
- begin
- WriteLn('Already installed.'); Halt;
- end;
-
- RMax:=ReadNum; RPos:=0; RNum:=0;
-
- GetIntVec($13, Last13);
- asm
- mov ax,word ptr Last13
- mov word ptr CLast13,ax
- mov ax,word ptr Last13+2
- mov word ptr CLast13+2,ax
- end;
-
- SetIntVec($13, @Int13);
-
- SetIntVec($64, @Id);
-
- SwapVectors;
- Keep(0);
- end.
-