cs00chs@unccvax.uncc.edu (charles spell) (02/15/91)
TurboC++ Professional gives an example program gives a short
TSR program in the Reference guide under the keep() function.
I try compiling:
tcc -mt -lt -k- -I../include keep.c
And get the error message:
Cannot generate .COM file: segment-relocatable items present.
Must TSR's be .COM files?
I comment out the setvect() statement and it links fine. In TC 2.0
it links fine. How do I get around this? Here is a one-page TSR that
is very similar (DO NOT EXECUTE IT!!!! IT CAN DESTROY YOUR DISK!!):
#include <dos.h>
#define DISK_VECT 0x13 /* This program was intended to flash the */
extern unsigned int _heaplen; /* upper right-hand corner during ANY disk*/
extern unsigned int _stklen; /* operation...DO NOT RUN THIS PROGRAM!!! */
void interrupt new_disk(void);
void interrupt (*old_disk)();
#error This statement added to warn all not to run this program!!!
void new_disk(void)
{
static unsigned int far *screen = MK_FP(0xB800, 0000);
screen[80] ^= 0x00ff; /* this line DESTROYS certain registers for int 13h */
(*old_disk)();
screen[80] ^= 0x00ff;
}
main(void)
{
old_disk = getvect(DISK_INT);
setvect(DISK_INT, &new_disk); /* comment this line and TC++ 1.0 produces */
_heaplen = 512; /* .COM ok. TC 2.0 works in both cases... */
_stklen = 0x1000;
keep(0, 0x1000);
}
How do I get the registers as they were on entry to new_disk() (they are
destroyed by the screen[80] ^= 0x00ff;) before calling old_disk?
uunet!mcnc!unccvax!cs00chs
uunet!decvax!pyrdc!clt2!jjr
--
.--------------------------. ... |On the border of your mind lies a place
|uunet!mcnc!unccvax!cs00chs| (") |where dreams and reality are one...I will
`--------------------------'-w-U-w-|take you there, for I am the subject...
\%\%\%\%\%\%\%\%\%\%\%\%\%\%\%\%\%\|the subject of your imagination. -Aldo Nova