Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!wuarchive!rex!uflorida!kluge!serss0.fiu.edu From: acmfiu@serss0.fiu.edu (ACMFIU) Newsgroups: comp.sys.apple2 Subject: heartbeat interrupts Message-ID: <1995@kluge.fiu.edu> Date: 13 Jan 91 03:17:43 GMT Sender: news@kluge.fiu.edu Organization: Florida International University, Miami Lines: 74 I have the following inline asm function to handle HeartBeat interrupts. my main purpose for using it is to catch keypresses and pause control of the program in progess. Then, I just wait for another keypress. Also, if the user presses oa-period, then the program should immediately end, regardless of where it is. However, when i oa-period 3/4 times, the computer crashes. can anyone suggest a better (i.e. WORKING) solution to my problem. asm void check_key (void) { dcl 0 count: dcw 10 dcw 0xa55a phb phk plb php rep #0x30 lda #10 sta count sep #0x20 lda >0xe0c000 bpl end cmp #0xae bne wait lda >0xe0c025 and #0x80 beq wait rep #0x20 lda >0xe0c010 jsl raise_signal bra end wait: lda >0xe0c010 rdkey: lda >0xe0c000 bpl rdkey lda >0xe0c010 end: rep #0x20 plp plb dcb 0x6b } void raise_signal (void) { raise (SIGTERM); } void bye (int sig) { fclose (global_file); DelHeartBeat (check_key); exit (1); } int main (int argc, char **argv) { signal (SIGTERM, bye); SetHeartBeat (check_key); } ----------------------- albert chin ... acmfiu@fiu.edu