Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

How to keep resident only a part of the program (Developers)

posted by Laaca Homepage, Czech republic, 14.08.2021, 07:31

I am thinking about very tiny resident utility which hooks the INT16 interrupt. I know that "high-level" languages like pascal or C have something like function Keep (which apparently calls INT21h/AH=31h). But this function keep a whole program in memory.
My problem is that the program must be quite big and complex (it performs some hardware detections and scanning). But after gathering all needed informations is possible to keep in memory only very small module.
All examples about KEEP function look similarly:

{ Keep.PAS }
 {$M $800,0,0 }   { 2K stack, no heap }
 { This program makes a click after each keypress.}
 uses Crt, Dos;
 var
   KbdIntVec : Procedure;

 {$F+}
 procedure Keyclick; interrupt;
 begin
   if Port[$60] < $80 then
     { Clicks after keypress }
     begin
     Sound(5000);
     Delay(1);
     Nosound;
     end;

   inline ($9C); { PUSHF -- Push flags }
   { Call old driver }
   KbdIntVec;
 end;
 {$F-}

 begin
   { Insert into interrupt chain }
   GetIntVec($9,@KbdIntVec);
   SetIntVec($9,Addr(Keyclick));
   Keep(0); { Teminate and keep resident }
 end.


This program works but it remains all int the memory. I would like to keep only the procedure KeyClick but nothing more.

Is possible solution to allocate a additional memory block via INT21h/AH=48h, copy the code of KeyClick into this block and the program end not with Keep but hith Halt?

---
DOS-u-akbar!

 

Complete thread:

Back to the forum
Board view  Mix view
22049 Postings in 2034 Threads, 396 registered users, 59 users online (0 registered, 59 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum