home *** CD-ROM | disk | FTP | other *** search
- {****************************************************************************}
- { S T A Y X I T . I N C }
- { }
- { Separate this file into "StayXIT.320" to provide a "Go-non-Resident" }
- { routine or the Stay-Resident Demo. }
- { }
- {****************************************************************************}
- Procedure Stay_Xit;
- {-----------------------------------------------------------------------------}
- { 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 go GooGoo . }
- {-----------------------------------------------------------------------------}
-
- Begin { Block }
- Rmwin;
- Writeln ('Stay-Resident program Terminating') ;
-
- SaveRegs.Ax := $25 shl 8 + Kybrd_Int;
- SaveRegs.Ds := DOS_IntCS;
- SaveRegs.Dx := DOS_IntIP; { Reset the Keyboard interrupt addr }
- MsDos(SaveRegs); { to its original value }
-
- Saveregs.Ax := $49 shl 8 + 0 ; { Free Allocated Block function}
- Saveregs.Es := MemW[Cseg:$2C] ; { Free environment block }
- MsDos( Saveregs ) ;
-
- Saveregs.Ax := $49 shl 8 + 0 ; { Free Allocated Block function}
- Saveregs.Es := Cseg ; { Free Program }
- MsDos( Saveregs ) ;
-
- Intr($20,Regs) ; { Return to Dos }
-
- End { StayXit };