X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: "Rod Pemberton" Newsgroups: comp.os.msdos.djgpp References: <43E12016 DOT 2070308 AT mainstreetsoftworks DOT com> <7t88b3-d2q DOT ln1 AT news DOT infowest DOT com> <43E1863D DOT 8080308 AT mainstreetsoftworks DOT com> <43E216B4 DOT 70509 AT mainstreetsoftworks DOT com> <43E243F8 DOT 7060401 AT mainstreetsoftworks DOT com> <1o8ab3-2i71 DOT ln1 AT news DOT infowest DOT com> <43E2C6DA DOT 4080700 AT mainstreetsoftworks DOT com> <4mcbb3-q1f1 DOT ln1 AT news DOT infowest DOT com> <43E3884C DOT 8050308 AT mainstreetsoftworks DOT com> Subject: Re: TSR issues (with code) Lines: 339 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-IWN-Posted-By: [68.60.59.250] Sat Feb 4 03:02:40 2006 Message-ID: <0naeb3-s442.ln1@news.infowest.com> X-Complaints-To: abuse AT eli DOT net X-Trace: 52616e646f6d49564b835516cab6b1f728cd0aaad111e06a2859ca5fe614c2a3fdb4d17c804a296421caf04f2ab9f82170ebc33cd18900c8cba20211efcef77aa16fdcb2896aeb57ee6c834218679391d610aa01f4b5927abbe878f1445c3c72b530b814c3ca00069a9c9537f2d821afab488be512f9e4854af0256693d7ad2b8dd4fd381c7c89be3aec074545667f09 X-Abuse-Info: Please be sure to forward ALL headers so that we may process your complaint properly. NNTP-Posting-Date: Sat, 04 Feb 2006 10:19:58 UTC Date: Sat, 04 Feb 2006 14:17:34 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "Brad House" wrote in message news:43E3884C DOT 8050308 AT mainstreetsoftworks DOT com... > Ok, doing realmode reflection doesn't look like it's too bad then... > And you suggest using _go32 function instead of __dpmi functions, > so to chain the interrupt vector, how would that work, it seems as > though there is no _chain_ routine, would I simply call the old > dos realmode int's pm_offset assuming the _go32_dpmi wrappers > made such a routine for me? This is how I think it _should_ > look: I've got it working. I'll inline all three after my signature. 1) DIR/S lockup is due to write() calling a dos interrupt 2) for INDOS it's, r.x.es. You used ds. 3) my preference, I changed r.x.es*16+r.x.bx to (r.x.es<<4)|r.x.bx 4) replaced write with custom routine owrite() Rod Pemberont ---- #ifndef __TSR_H__ #define __TSR_H__ typedef void (*mycallback)(void); int create_tsr(mycallback hook); int remove_tsr(); void owrite(char *); //#define DEBUG #endif ---- #include #include #include #include #include #include #include "tsr.h" static int cnt=0,x=0,y=0; void owrite (char *p) { char line[80]; char *screen = (char *)0xB8000; int i; screen-=__djgpp_base_address; memset(line,0,sizeof(line)); sprintf(line,"%s",p); for (i=0;i #include #include #include #include #include #include #include #include #include #include #include #include "tsr.h" #define asm_cli disable #define asm_sti enable #define TIMER_INTERRUPT 0x1c #define IDLEDOS_INTERRUPT 0x28 /* DOS idle interrupt */ /* FLAG to lock all memory */ int _crt0_startup_flags = _CRT0_FLAG_LOCK_MEMORY|_CRT0_FLAG_UNIX_SBRK; volatile int indos_offset; /* saved INDOS flag address */ volatile int critical_offset; /* saved critical error flag */ volatile int in_int28=0; /* check to see if we're in an int28 call */ volatile int in_callback=0; /* check to see if it's trying to reenter */ mycallback int_callback=NULL; /* Place to store old interrupt vectors */ _go32_dpmi_seginfo old_int8_vector; _go32_dpmi_seginfo old_int28_vector; _go32_dpmi_registers r; /* Calls int 21 ax 0x3100 to tell app to terminate and stay resident */ void keep(unsigned char status, unsigned size) { #ifdef DEBUG owrite("keep "); #endif /* Keep size default is current PSP block size */ if(_farpeekw(_dos_ds,_go32_info_block.linear_address_of_original_psp-15) !=(_go32_info_block.linear_address_of_original_psp/16)) /* Not a real PSP? attempt to continue */ r.x.dx=(_go32_info_block.size_of_transfer_buffer+256)/16; else r.x.dx=_farpeekw(_dos_ds,_go32_info_block.linear_address_of_original_psp-13) ; /* Default is to keep PSP and transfer buffer, but the user may want to */ /* not use and release transfer buffer to decrease DOS footprint. */ if(size>=16&&size