How to keep resident only a part of the program (Developers)
> > 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?
>
> That will likely not work --- DOS will free up all memory blocks
> allocated by your program, including those from int 0x21, ah = 0x48.
You can make it work by hacking the MCB to be owned by someone other than your process. Tom mentions a way to do that but I think it is cleaner to just access the MCB directly instead of setting the current PSP to another, possibly invalid value.
In my tsr example I first relocate the process (to avoid memory fragmentation) then allocate a new block for the resident portion using service 48h, then I hack the MCB's owner and name fields to make the resident block survive the final process termination (using service 4Ch). I described this in some detail in https://retrocomputing.stackexchange.com/questions/20001/how-much-of-the-program-segment-prefix-area-can-be-reused-by-programs-with-impun/20006#20006
By the way, if you do use service 31h you should close all file handles manually, unless you intend to use them while resident.
---
l
Complete thread:
- How to keep resident only a part of the program - Laaca, 14.08.2021, 07:31 (Developers)
- How to keep resident only a part of the program - tkchia, 14.08.2021, 08:49
- How to keep resident only a part of the program - Laaca, 14.08.2021, 10:32
- How to keep resident only a part of the program - tom, 14.08.2021, 11:40
- How to keep resident only a part of the program - RayeR, 14.08.2021, 15:49
- How to keep resident only a part of the program - Laaca, 14.08.2021, 20:18
- How to keep resident only a part of the program - RayeR, 16.08.2021, 03:22
- How to keep resident only a part of the program - Laaca, 14.08.2021, 20:18
- How to keep resident only a part of the program - RayeR, 14.08.2021, 15:49
- How to keep resident only a part of the program - tom, 14.08.2021, 11:40
- How to keep resident only a part of the program - tom, 14.08.2021, 11:28
- How to keep resident only a part of the program - ecm, 15.08.2021, 13:47
- How to keep resident only a part of the program - bretjohn, 27.08.2021, 21:22
- How to keep resident only a part of the program - Laaca, 14.08.2021, 10:32
- How to keep resident only a part of the program - marcov, 14.08.2021, 13:18
- How to keep resident only a part of the program - CandyMan, 27.08.2021, 17:46
- How to keep resident only a part of the program - bretjohn, 27.08.2021, 21:47
- How to keep resident only a part of the program - Laaca, 08.03.2022, 12:24
- How to keep resident only a part of the program - tom, 08.03.2022, 12:51
- How to keep resident only a part of the program - tkchia, 08.03.2022, 14:20
- How to keep resident only a part of the program - bretjohn, 08.03.2022, 19:19
- How to keep resident only a part of the program - tkchia, 08.03.2022, 14:20
- How to keep resident only a part of the program - rr, 08.03.2022, 17:32
- How to keep resident only a part of the program - tom, 08.03.2022, 12:51
- How to keep resident only a part of the program - tkchia, 14.08.2021, 08:49