Category : Files from Magazines
Archive   : TSR.ZIP
Filename : STAYXIT.420

 
Output of file : STAYXIT.420 contained in archive : TSR.ZIP
{****************************************************************************}
{ S T A Y X I T . I N C }
{****************************************************************************}
{----------------------------------------------------------------------------}
{ Stay_Xit Check Terminate Keys }
{ }
{ Clean up the Program ,Free the Environment block, the program segment }
{ memory and return to Dos. Programs using this routine ,must be the }
{ last program in memory, else ,a hole will be left causing Dos }
{ to take off for Peoria. }
{----------------------------------------------------------------------------}
Procedure Stay_Xit;
{
This code reinstates those interrupts that will not be
restored by DOS. Interrupts 22,23,24 (hex) are restored
from the Current PSP during termination.
}
VAR
PSPvector22: vector absolute Cseg:$0A;
PSPvector23: vector absolute Cseg:$0E;
PSPvector24: vector absolute Cseg:$12;

DOSvector22: vector absolute 0:$88;
DOSvector23: vector absolute 0:$8C;
DOSvector24: vector absolute 0:$90;

Begin { Block }

Writeln ('Stay-Resident program Terminated') ;

Inline($FA); {Disable interrupts}

{ Restore Disk Interrupt Service Routine }

Regs.Ax := $2500 + BIOSI13;
Regs.Ds := BIOS_INT13.CS;
Regs.Dx := BIOS_INT13.IP;
Intr ($21,Regs);

{ Restore Keyboard Interrupt Service Routine }

Regs.Ax := $2500 + BIOSI16;
Regs.Ds := BIOS_INT16.CS;
Regs.Dx := BIOS_INT16.IP;
Intr ($21,Regs);

{ Restore Timer Interrupt Service Routine }

Regs.Ax := $2500 + BIOSI8;
Regs.Ds := BIOS_INT8.CS;
Regs.Dx := BIOS_INT8.IP;
Intr ($21,Regs);

{ Restore DOS 21 Interrupt Service Routine }

Regs.Ax := $2500 + DOSI21;
Regs.Ds := DOS_INT21.CS;
Regs.Dx := DOS_INT21.IP;
Intr ($21,Regs);

{ Restore DOS 28 Interrupt Service Routine }

Regs.Ax := $2500 + DOSI28;
Regs.Ds := DOS_INT28.CS;
Regs.Dx := DOS_INT28.IP;
Intr ($21,Regs);

{ Move Interrupt Vectors 22,23,24 to our PSP from where DOS will restore }

PSPvector22 := DOSvector22; { Terminate vector }
PSPvector23 := DOSvector23; { Cntrl-C vector }
PSPvector24 := DOSvector24; { Critical vector }

Inline($FB); {Re-enable interrupts}

Regs.Ax := $49 shl 8 + 0 ; { Free Allocated Block function}
Regs.Es := MemW[Cseg:$2C] ; { Free environment block }
MsDos( Regs ) ;

Regs.Ax := $49 shl 8 + 0 ; { Free Allocated Block function}
Regs.Es := Cseg ; { Free Program }
MsDos( Regs ) ;

End { StayXit };


  3 Responses to “Category : Files from Magazines
Archive   : TSR.ZIP
Filename : STAYXIT.420

  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/