A.D.A. Amiga Demoscene Archive

  Welcome guest! Please register a new account or log in

  

  

  

log in with SceneID

  

Demos Amiga Demoscene Archive Forum / Coding / CIA Chained timer a+b

 

Author Message
johnsa
Member
#1 - Posted: 9 May 2019 21:07
Reply Quote
Hey,

I've been pulling my hair out trying to get timer b to count timer a underflows - to extend it's duration..

Can anyone spot what I'm missing?

; Disable all ints
lea.l CUSTOM_BASE,a1
move.w #$7fff,INTENA(a1)
move.w #$7fff,INTREQ(a1)

; Install a handler to be used by CIA-B Timer B to count underflow
move.l #0,_vblankCount
move.l _vbr_addr(pc),a0
lea.l Int6Handler2(pc),a1
move.l a1,CIAB_VECTOR(a0)
lea.l CUSTOM_BASE,a1

; Activate vblank and CIA ints
move.w #$e020,INTENA(a1)

; TIME = 10ms
lea.l _CIAB,a0
move.b #%01111111,ciaicr(a0)
move.b #%10000010,ciaicr(a0) ; trigger interrupt
move.b #(TIME&$ff),ciatalo(a0)
move.b #(TIME>>8),ciatahi(a0)
move.b ciacra(a0),d0
move.b ciacrb(a0),d1
and.b #%11000000,d0 ;preserve unused/sp-mode
or.b #%00010001,d0 ;continuous
and.b #%10000000,d1
or.b #%01010001,d1
move.b d1,ciacrb(a0)
move.b d0,ciacra(a0)

; here I loop for N vblanks, then check the value of underflows counted by the int.. it's 0 no matter what i do!
johnsa
Member
#2 - Posted: 10 May 2019 10:27
Reply Quote
Figured out the issue.. being silly, timer b doesn't generate an INTERRUPT on every underflow of A, it simply counts down.. so if you want an int every underflow, timer b must be latched with 1!

 

  Please register a new account or log in to comment

  

  

  

 

A.D.A. Amiga Demoscene Archive, Version 3.0