Article View: comp.sys.atari.st
Article #34982Need help with Xbtimer
From: Scott Morrison
Date: Thu, 10 Nov 1988 19:43
Date: Thu, 10 Nov 1988 19:43
40 lines
1726 bytes
1726 bytes
I am having trouble getting a timer interrupt routine to work. Can anybody
tell me why the following piece of code doesn't work (it's written in
Mark Williams C):
#include <bios.h>
#include <xbios.h>
int tick=0; /* clock counter */
clock_vector()
{
tick++;
}
main()
{
int control, data;
/* have the user enter values for control and data */
printf("Enter timer A control register value: "); scanf("%d",&control);
printf("Enter timer A data register value: "); scanf("%d",&data);
/* Next install the interrupt handler for timer A */
Xbtimer(0, control, data, clock_vector);
/* Enable Timer A interrupts */
Jenabint(MFP_TIMA);
/* loop until a key is pressed printing the timer tick value */
while(!Cconis())
printf("tick = %d\n",tick);
Cconin();
Jdisint(MFP_TIMA);
}
I have read the section of the Abacus Atari Internals book about what
values should go into the timer control register, but when I set control
to a value which I think should correctly start the timer, my program
bombs with from 2 to 4 bombs, and the system always hangs.
Can anyone tell me what magic values should be passed to Xbtimer, or if
that is not the problem, what am I doing wrong?
-- Scott Morrison
morrison@berkeley.edu
Technical Details
Message-ID:
<26751@ucbvax.BERKELEY.EDU>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!attcan!uunet!ncrlnk!ncr-sd!hp-sdd!hplabs!ucbvax!renoir.Berkeley.EDU!morrisonShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!attcan!uunet!ncrlnk!ncr-sd!hp-sdd!hplabs!ucbvax!renoir.Berkeley.EDU!morrison From: morrison@renoir.Berkeley.EDU (Scott Morrison) Newsgroups: comp.sys.atari.st Subject: Need help with Xbtimer Message-ID: <26751@ucbvax.BERKELEY.EDU> Date: 10 Nov 88 19:43:42 GMT Sender: usenet@ucbvax.BERKELEY.EDU Reply-To: morrison@renoir.Berkeley.EDU (Scott Morrison) Organization: University of California, Berkeley Lines: 40