[net.micro.atari] ST help!

bammi@cwruecmp.UUCP (Jwahar R. Bammi) (01/07/86)

Has anyone had any luck with the xbios Xbtimer() trap. Every time I
try to use it I get 2 Mushrooms. I have tried my code in supervisor
mode and get the same result. Here is a short test program I wrote
to see what was going on. I use a control register value of 7 which
should give me a prescale value of 200, and data register value of 0
that should give me a count of 256 for timer 'a' on the 68901.
Theoretically i should get an interrupt frequency of 48 Hz.
( 2.4576 Mhz / 256 / 200 ).

#include <osbind.h>
#define VOID int

long counter;

/* Interrupt handler */
VOID my_handler()
{
	counter++;
}

/* Start_timer */
VOID start_timer()
{
	VOID my_handler();

	/* Start the timer */
	counter = 0L;
	Xbtimer(0, 7, 0, my_handler);
}

/* Stop the timer */
VOID stop_timer()
{
	VOID my_handler();
	
	/* Stop the timer by clearing the timer a control register */
	Xbtimer(0, 0, 0, my_handler);

}


/* Stack pointer save area */
long ssp_save;

main()
{
	
	/* Save the super stack, get into super mode using USR stack */
	ssp_save = Super(0L);

	start_timer();
	while(counter == 0L)
		/* twiddle thumb */;

	/* Got interrupt */
	stop_timer();
	
	/* get out of supervisor mode */
	Super(ssp_save);

	Cconws("I made it!!\r\n");
	/* I never get the message */
}

	Any help will be much appreciated.


-- 
					Jwahar R. Bammi
			       Usenet:  .....!decvax!cwruecmp!bammi
			        CSnet:  bammi@case
				 Arpa:  bammi%case@csnet-relay
			   CompuServe:  71515,155