2 ; Ullrich von Bassewitz, 28.09.1998
4 ; IRQ routine for the 510.
7 .export irq, nmi, k_irq, k_nmi
8 .import k_scnkey, k_udtim, k_rs232
10 .import __IRQFUNC_TABLE__, __IRQFUNC_COUNT__
13 .include "zeropage.inc"
18 ; -------------------------------------------------------------------------
19 ; This is the mapping of the active irq register of the 6525 (tpi1):
23 ; | | | ^ SRQ IEEE 488
25 ; | ^ cia1 IRQB ext. Port
30 ; -------------------------------------------------------------------------
41 lda $104,x ; Get the flags from the stack
42 and #$10 ; Test break flag
49 ; -------------------------------------------------------------------------
59 ; -------------------------------------------------------------------------
60 ; Kernal irq entry point. The IRQvec points here (usually).
63 lda IndReg ; Ind. Segment retten
69 lda (tpi1),y ; Interrupt Register 6525
72 ; -------------------------------------------------------------------------
75 cmp #%00000001 ; ticker irq?
78 ; Call user IRQ handlers if we have any
80 ldy #<(__IRQFUNC_COUNT__*2)
82 lda #<__IRQFUNC_TABLE__
83 ldx #>__IRQFUNC_TABLE__
84 jsr condes ; Call the functions
86 ; Call replacement kernal IRQ routines
88 @L1: jsr k_scnkey ; Poll the keyboard
89 jsr k_udtim ; Bump the time
91 ; -------------------------------------------------------------------------
94 irq1: cmp #%00010000 ; interrupt from uart?
96 jsr k_rs232 ; Read character from uart
98 ; -------------------------------------------------------------------------
101 irqend: ldy #tpiActIntReg
102 sta (tpi1),y ; Clear interrupt