🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: alt.msdos.programmer
2 messages
2 total messages Started by vincent Wed, 11 Nov 1992 10:43
my_tsr
#623
Author: vincent
Date: Wed, 11 Nov 1992 10:43
99 lines
2273 bytes
This is a repost I never got any replys, The Org. Q. was why this code
doesn't work?

---------------------  snip snip -------------------------- makefile

CFLAGS = /Fc /Zi /f /Od /Gs /AS /W4 /nologo

main.exe : main.obj
	cl /Zi /Fm main.obj

.c.obj:
	cl /c $(CFLAGS) $(@B).c

---------------------  snip snip --------------------------- main.c

#include	<stdlib.h>
#include	<dos.h>
#include	<bios.h>

#define	CODESEG			_based(_segname("_CODE"))
#define MK_FP(seg,ofs)		((void _far *) ((((long)seg)<<16) + (long)ofs))
#define PARAGRAPHS(x)		((FP_OFF(x) + 15) >> 4)

typedef			void	(interrupt _far *INTVECT) ();

struct {
	INTVECT	old_timer;

	unsigned char _far * CODESEG tsrstack;

	int	oldSP,
		oldSS,
		oldDS,
		ds_save,
		seg_stack,
		off_stack,
		retadd,
		tick_me;
} CODESEG data;

void ctimer (void)
{
	data. tick_me++;
}

void _interrupt _far new_timer (void)
{
	_asm {
		mov	cs:data. oldSS, ss
		mov	cs:data. oldSP, sp
		mov	cs:data. oldDS, ds
				 		 ; Load new stack
		mov	ss, cs:data. seg_stack
		mov	sp, cs:data. off_stack
		mov	ds, cs:data. ds_save

		mov	bp, sp

		call	ctimer

		mov	ss, cs:data. oldSS
		mov	sp, cs:data. oldSP
		mov	ds, cs:data. oldDS

		mov	bp, sp
	}
	_chain_intr (data. old_timer);
}

void main ()
{
	unsigned int memtop, dumy = 0;

	data. tick_me = 0;

	_dos_freemem (*(short _far *) MK_FP (_psp, 0x2c));

	data. tsrstack = malloc (1024);
	data. tsrstack += 1024;

	data. seg_stack = FP_SEG (data. tsrstack);
	data. off_stack = FP_OFF (data. tsrstack);

	_asm mov cs:data. ds_save, ds

	memtop = data. ds_save + PARAGRAPHS (data. tsrstack) - _psp;

	_dos_setblock (memtop, _psp, &dumy);

	data. old_timer = _dos_getvect (0x08);
	_dos_setvect (0x08, new_timer);

	_dos_keep (0, memtop);
}

---------------------------------------------------------------------

vincent@datmuc.dat.de
Re: my_tsr
#624
Author: God
Date: Wed, 11 Nov 1992 15:08
19 lines
1248 bytes
In article <1347@datmuc.UUCP>, vincent@datmuc.UUCP (vincent) writes...
> 
>This is a repost I never got any replys, The Org. Q. was why this code
>doesn't work?
[tons of code deleted]

  You didn't get any response, because most of us arn't willing to spen 
hours going through your code finding an error we don't even know exists. 
How about telling us what error you get, what happens, or doesn't happen, 
or what the hell is wrong, instead of postign uncommented code, which is 
useless.

   tsullivan@trentu.ca
   cstes@blaze.trentu.ca

A Disclaimer? Yeah, and people BELIEVE what I write, too...
---
 "Virtual Reality has NOTHING on Calvin."
       - Suzy, from Calvin and Hobbes
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads