🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.msdos.programmer
Article #1410

Re: Get program out of memory (C++ Dos)

#1410
From: The ChaoTix
Date: Mon, 12 Feb 2001 20:29
118 lines
5220 bytes
Oh please. The last I will use is DJGPP.

Never mind, folks. I got my answer. I even got myself a multitask
program done using TSR's. Check http://go.to/WinTix for more information and
download.

ChaoTix


Jeffrey Turner <cdesign@thecia.net> schreef in berichtnieuws
3A874089.4803781C@thecia.net...
> The ChaoTix wrote:
>
> > Hi all,
> >
> > like i asked before, i need to know how to get a program out of the
memory.
> > I
> > have a little explample of that kind of program. This program will
"bind"
> > his own
> > function to the timer interrupt (18 times per second). My question to
you
> > all, is
> > who can make this program so, that you can enable it like "Start.exe -E"
or
> > disable it
> > "Start.exe -D". Here's the program that is just from C++ help. This
programs
> > runs btw under
> > full dos mode, and has nothing to do with windows. Be sure that you run
this
> > program in
> > dos, and not in C++, because c++ locks his interrupts.
> >
> > Example:
> > ============================================================
> >
> >   #include <dos.h>      /* The clock tick interrupt */
> >   #define INTR 0x1C  /* Screen attribute (blue on grey) */
> >   #define ATTR 0x7900
> >
> >   #ifdef __cplusplus
> >       #define __CPPARGS ...
> >   #else
> >       #define __CPPARGS
> >   #endif
> >
> >   extern unsigned _heaplen = 1024;
> >   extern unsigned _stklen  = 512;
> >
> >   void interrupt ( *oldhandler)(__CPPARGS);
> >   typedef unsigned int (far *s_arrayptr);
> >
> >   void interrupt handler(__CPPARGS)
> >   { s_arrayptr screen[80];
> >      static int count;
> >      screen[0] = (s_arrayptr) MK_FP(0xB800,0);
> >
> >   /* increase the counter and keep it within 0 to 9 */
> >      count++;
> >      count %= 10;
> >
> >   /* put the number on the screen */
> >      screen[0][79] = count + '0' + ATTR;
> >
> >   /* call the old interrupt handler */
> >      oldhandler();
> >   }
> >
> >   int main(void)
> >   {
> >   /* get the address of the current clock tick interrupt */
> >   oldhandler = getvect(INTR);
> >
> > /* install the new interrupt handler */
> >   setvect(INTR, handler);
> >
> >   /* _psp is the starting address of the
> >      program in memory.  The top of the stack
> >      is the end of the program.  Using _SS and
> >      _SP together we can get the end of the
> >      stack.  You may want to allow a bit of
> >      saftey space to insure that enough room
> >      is being allocated ie:
> >      (_SS + ((_SP + safety space)/16) - _psp)
> >   */
> >   keep(0, (_SS + (_SP/16) - _psp));
> >   return 0;
> > }
> >
> > =========================================================
> >
> > Everybody thats has tried, thanks a lot. Anyone who has the
> > answer, pleaaaassseeeeee please please please please send me, and
> > of cource, Thanks a MORE lot!! =)
> >
> > ChaoTix
>
> What compiler are you using?  I suspect it's some version of MSVC?  What
exactly
> do you mean by getting the program out of memory?  A TSR being removed?
This
> MAY be impossible if it is not the last TSR loaded.  I'd need a lot more
info
> before being able to help you.  Have you tried using D.J. Delorie's port
of GNU
> tools - including the by far superior gcc - to DOS?  That may make the
project
> earlier, read the FAQ to learn how to deal with x86 segmented addresses
and
> pointers using djgpp (ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp).  Use
> version 2.
>
> --Jeff Turner
>
>
>
Technical Details
Message-ID: <MIXh6.49062$v%6.795818@nlnews00.chello.com>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!news.gv.tsc.tdk.com!news.iac.net!news-out.cwix.com!newsfeed.cwix.com!newsfeed.direct.ca!look.ca!news-out.usenetserver.com!news-out.usenetserver.com!amsnews01.chello.com!nlnews00.chello.com.POSTED!not-for-mail
References: <y7Dd6.277393$8r2.5304182@nlnews00.chello.com> <3A874089.4803781C@thecia.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10f6aa,88e59f72df81b779
X-Google-Attributes: gid10f6aa,public
X-Google-Thread: 102bfa,88e59f72df81b779
X-Google-Attributes: gid102bfa,public
X-Google-Thread: fe885,88e59f72df81b779
X-Google-Attributes: gidfe885,public
X-Google-Thread: fcea4,88e59f72df81b779
X-Google-Attributes: gidfcea4,public
X-Google-Thread: 1145b7,88e59f72df81b779
X-Google-Attributes: gid1145b7,public
X-Google-Thread: fa7a6,88e59f72df81b779
X-Google-Attributes: gidfa7a6,public
X-Google-ArrivalTime: 2001-02-12 12:35:34 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!news.gv.tsc.tdk.com!news.iac.net!news-out.cwix.com!newsfeed.cwix.com!newsfeed.direct.ca!look.ca!news-out.usenetserver.com!news-out.usenetserver.com!amsnews01.chello.com!nlnews00.chello.com.POSTED!not-for-mail
From: "The ChaoTix" <The_ChaoTix@chello.nl>
Newsgroups: alt.msdos.programmer,be.comp.programming,comp.games.development.programming.misc,comp.os.msdos.programmer,comp.programming.contests,no.it.programmering.c++
References: <y7Dd6.277393$8r2.5304182@nlnews00.chello.com> <3A874089.4803781C@thecia.net>
Subject: Re: Get program out of memory (C++ Dos)
Lines: 120
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
Message-ID: <MIXh6.49062$v%6.795818@nlnews00.chello.com>
Date: Mon, 12 Feb 2001 20:29:32 GMT
NNTP-Posting-Host: 212.187.118.76
X-Complaints-To: abuse@chello.nl
X-Trace: nlnews00.chello.com 982009772 212.187.118.76 (Mon, 12 Feb 2001 19:29:32 GMT)
NNTP-Posting-Date: Mon, 12 Feb 2001 19:29:32 GMT
Organization: chello broadband