Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!caip!ucla-cs!zeus!stiber From: stiber@zeus.cs.ucla.edu (Michael D Stiber) Newsgroups: net.micro.pc Subject: An answer and a question Message-ID: <328@curly.ucla-cs.ARPA> Date: Fri, 1-Aug-86 15:54:37 EDT Article-I.D.: curly.328 Posted: Fri Aug 1 15:54:37 1986 Date-Received: Sat, 2-Aug-86 09:41:11 EDT Reply-To: stiber@zeus.UUCP (Michael D Stiber) Distribution: net Organization: UCLA Computer Science Department Lines: 36 I ran across an example of a C program that terminates & stays resident, which answers one of my previous questions and might be of interest to others. Here it is (very short - for MS & IBM compilers): #include main() { extern unsigned int _psp; /* Library variable Program Segment Prefix*/ unsigned int far *sizeptr; /* Pointer to top of memory pointer */ unsigned int sizeinpara; /* Size of program in paragraphs */ union REGS inregs; FP_SEG(sizeptr) = _psp; /* Point to top of memory pointer */ FP_OFF(sizeptr) = 2; /* at offset 2 of PSP */ sizeinpara = *sizeptr - _psp; /* memory top - base */ printf("\nSize = %d paragraphs, %d bytes\n",sizeinpara,sizeinpara*16); inregs.x.ax = 0x3100; inregs.x.dx = sizeinpara; intdos(&inregs,&inregs); } Note that you must use the /ZE option to enable the "far" keyword. Then use EXEMOD's /MAX option to cut the allocated storage down to a reasonable size (the last is optional). I'm still looking for some information about how to use a C function as an interrupt routine. If I don't get any responses, then I guess I'll have to figure it out for myself (and we all know how painful that can be). Also, thanks to Hants White for answering my SHELL question. Michael Stiber ARPANET: stiber@ucla-locus.arpa USENET: ...{ucbvax,ihpn4}!ucla-cs!stiber