Login
Back to forumSee the full topicGo to last reply

Posted By

siz
on 2014-11-08
10:51:57
 Re: Mixing raster interrupt with timer interrupt?

Here is an example of using TED raster interrupts together with timer interrupts:

ted = $ff00
ted_irqsource = ted + $09
ted_irqmask = ted + $0a

sei
lda #<17734
ldx #>17734
sta ted_timer1lo
stx ted_timer1hi
lda #%00001010
sta ted_irqmask
lda #<irq
ldx #>irq
sta $0314
stx $0315
cli
jmp *
irq lda ted_irqsource
sta ted_irqsource
pha
and #%00001000
beq nottimer
; do timer tasks
nottimer
pla
and #%00000010
beq notraster
; do raster tasks
notraster
pla
tay
pla
tax
pla
rti

This is not very useful in this state because the timer frequency is the exact value of the PAL display refresh so you should use some other value.
I use this code in my SID player where I use timer to play music and raster to increment the clock.
I had an example somewhere which used 2 timers but that's a bit difficult because TED second and third timers always start counting back from $ffff so you have to set new values in every interrupt and you have to time the initial setup of the timer well. (You have to count the elapsed cycles until you get to to write the registers)



Back to top


Copyright © Plus/4 World Team, 2001-2024