Date: Thu, 28 Aug 1997 17:34:10 +0300 (IDT) From: Eli Zaretskii To: Gal cc: djgpp AT delorie DOT com Subject: Re: TSR In-Reply-To: <3404FEAB.19EF@usa.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Wed, 27 Aug 1997, Gal wrote: > Under DJGPP, examining DJGPPTSR.ZIP, I found two things that were a bit > vague: 1) being used to real-mode, "interrupt" was missing; which saves > registers and etc. GCC doesn't support the "interrupt" keyword, so you need to do this manually in the handler code. > Alrighty, thinking a bit stray, I feel that DJGPP handles interrupt > procedures automatically, and that after my little codes have ran, it > will restore the registers, yeah? No, see above. > The second issue, TSR. I thought DX=(program size / 16)+1, isn't that > true? Hrm.. I can't figure out program size, even if I needed it, or > not. But being a assembler programmer also, I feel that it's a great > waaste to have the entire image loaded into memory, why not just load > the TSR data which I really need. Please explain what you are saying here. The image includes data and code. You can't have data without code, so where's the waste? It seems that you are thinking about this TSR thing as if it were a real-mode TSR. Please don't forget that this TSR runs in protected mode, where things are sometimes quite different. You might consider reading the DPMI spec where it explains how to install a protected-mode TSR in DPMI mode. > Does DJGPP set aside pmode memory for itself? There is no such thing as "DJGPP" when your program runs. There's only your program and the DPMI server (which might or might not be internal to the operating system on which you run). The memory above 1MB is used by your program, not by an entity called "DJGPP" which doesn't exist in this context. > One last inquery, ...correct me if I'm wrong, DJGPP and DPMI, changes > INT 21's in inline assembly or calls to INT 31. It's neither. INT is a priviledged instruction in protected mode, so it generates an exception and jumps into the DPMI server. What happens next is up to the DPMI server. It might switch to real mode and reissue the interrupt there, or it might emulate the interrupt, or it might fail it. Different DPMI servers do different things. In any case, the handling of the INT instruction is VERY heavy in protected mode, so I think any gains from doing this in inline code would be negligible as far as the speed is concerned (code size is another matter).