home *** CD-ROM | disk | FTP | other *** search
- {****************************************************************************}
- { 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.
- }
- Begin { Block }
-
- Rmwin; {Remove the Last Window}
- Writeln ('Stay-Resident program Terminating') ;
-
- 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);
-
- 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 ) ;
- Intr($20,Regs) ; { Return to Dos }
-
- End { StayXit };