Category : Pascal Source Code
Archive   : PAS_0693.ZIP
Filename : SFECACHE.PAS

 
Output of file : SFECACHE.PAS contained in archive : PAS_0693.ZIP
{Ä Fido Pascal Conference ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ PASCAL Ä
Msg : 280 of 360
From : Max Maischein 2:249/6.17 29 May 93 21:24
To : Steven Tallent 1:3811/210.0
Subj : Hard/Cold Reboot //// Flushing the write behind cache
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
> Would PASCAL source to reproduce this program be off-topic, do you
> think,

Since this theme gets overhand, I repost my unit which flushes Smartdrive if
included in your program.

The code is based on other code courtesy of Norbert Igl, and sorry for the
german remarks 🙂

-max}

Unit SfeCache;
{
²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²
²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²
²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²
²²²ùÄÄ ÄÄù²²²²
²²²³ ³°°²²
²²² Max Maischein 2:249/6.17 °°²²
²²² °°²²
²²² Diese Unit implementiert einen 'tomatischen Flush Aufruf an °°²²
²²² eventuell residente Caches wie zum Bleistift SmartDrive oder °°²²
²²² Norton Cache. Sie ( dir Unit ) basiert auf Code von Norbert Igl, °°²²
²²² ich habe die n”tigen aufrufe zum Cache flushing eingebaut.Das °°²²
²²² Ganze Zeugs ist ungetestet, sollte aber funktionieren, da es °°²²
²²² nicht viel gibt, was schiefgehen kann. Wenn ihr euch aber auf °°²²
²²² WriteCaches beim Programmieren voll verlasst, dann Gnade euch °°²²
²²² Gott ! °°²²
²²² Al says : "Save early, save often !" °°²²
²²² °°²²
²²² Die Function FlushCache wird von der Unit auch exportiert, und °°²²
²²² kann auch vom Programm aus aufgerufen werden. Sie ist als Pointer °°²²
²²² auf eine Procedure implementiert, und dieser zeigt auf die °°²²
²²² aktuelle ( anwendbare ) Flush Procedure fr das vorliegende °°²²
²²² Cache. °°²²
²²² °°²²
²²² This piece of code is donated to the public domain, but I request °°²²
²²² that, if you use this code, you mention me in the DOCs somewhere. °°²²
²²² °°²²
²²² -max °°²²
²²²³ ³°°²²
²²²ùÄÄ ÄÄù°°²²
²²²²²°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°²²
²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²
²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²
²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²
}
Interface
Implementation
Uses DOS
;

Const AktCache : Byte = 0;

Type FlushProc = Procedure;

Var FlushCache : FlushProc;

Function SmartDrv_exe : Boolean;
Var Found : Boolean;
Begin
Found := False;
Asm
push bp
stc
mov ax, 4A10h
xor bx, bx
int 2Fh
pop bp
jc @NoSmartDrive
cmp ax, 0BABEh
jne @NoSmartDrive
mov Found, True
@NoSmartDrive:
End;
SmartDrv_exe := Found;
End;

Function CompaqPro : Boolean;
Var OK : Boolean;
Begin
CompaqPro := False;
OK := False;
Asm
mov ax, 0F400h
int 16h
cmp ah, 0E2h
jne @NoCache
or al, al
je @NoCache
cmp al, 2
ja @NoCache
mov OK, 1
@NoCache:
End;
CompaqPro := OK;
End;

Function PC6 : Boolean; { PCTools v6, v5 }
Var OK : Boolean;
Begin
PC6 := False;
OK := False;
Asm
mov ax, 0FFA5h
mov cx, 01111h
int 16h
or ch, ch
jne @NoCache
mov OK, 1
@NoCache:
End;
PC6 := OK;
End;

Function PC5 : Boolean;
Var OK : Boolean;
Begin
PC5 := False;
OK := False;
Asm
mov ax, 02BFFh
mov cx, 'CX';
int 21h
or al, al
jne @NoCache
mov ok, 1
@NoCache:
End;
PC5 := OK;
End;

Function HyperDsk : Boolean; { 4.20+ ... }
Var OK : Boolean;
Begin
Hyperdsk := False;
OK := False;
Asm
mov ax, 0DF00h
mov bx, 'DH'
int 02Fh
cmp al, 0FFh
jne @NoCache
cmp cx, 05948h
jne @NoCache
mov OK, 1
@NoCache:
End;
HyperDSK := OK;
End;

Function QCache : Boolean;
Var OK : Boolean;
Begin
QCache := False;
OK := False;
Asm
mov ah, 027h
xor bx, bx
int 013h
or bx, bx
je @NoCache
mov OK, 1
@NoCache:
End;
QCache := OK;
End;

Procedure FlushSD_sys; Far;
Var F : File;
B : Byte;
Begin
Assign( F, 'SMARTAAR' );
Reset( F );
B := 0;
Asm
push ds
mov ax, 04403h
mov bx, FileRec( F ).Handle
mov cx, 1
int 21h
pop ds
End;
End;

Procedure FlushSD_exe; Far;
Begin
Asm
mov ax, 04A10h
mov bx, 1
int 2Fh
End;
End;

Procedure FlushPC6; Far;
Begin
Asm
mov ax, 0F5A5h
mov cx, -1
int 16h
End;
End;

Procedure FlushPC5; Far;
Begin
Asm
mov ah, 0A1h
mov si, 04358h
int 13h
End;
End;

Procedure FlushNoCache; Far;
Begin
End;

Begin
Writeln( 'þ DISK-CACHE-FUSH v1.00 Norbert Igl & Max Maischein ''3/93');
If SmartDrv_exe
then FlushCache := FlushSD_exe
else
If PC6
then FlushCache := FlushPC6
else
If PC5
then FlushCache := FlushPC5
else FlushCache := FlushNoCache;

FlushCache;
End.

  3 Responses to “Category : Pascal Source Code
Archive   : PAS_0693.ZIP
Filename : SFECACHE.PAS

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/