Code: Select all
#define via_portb $0300
#define via_t1cl $0304
#define via_t1ch $0305
#define via_t1ll $0306
#define via_t1lh $0307
#define via_t2ll $0308
#define via_t2ch $0309
#define via_sr $030A
#define via_acr $030b
#define via_pcr $030c
#define via_ifr $030D
#define via_ier $030E
#define via_porta $030f
Code: Select all
loop1 ;Capture times
lda via_t1cl
sta temp_cl
lda via_t1ch
sta temp_ch
lda via_t1ll
sta temp_ll
lda via_t1lh
sta temp_lh
;
lda temp_ch
cmp old_ch
bcc loop1
;IRQ Occurred
sta old_ch
;Calculate cycles used by irq
lda temp_ll
sbc temp_cl
sta cycles_lo
lda temp_lh
sbc temp_ch
sta cycles_hi
rts