I'm currently working on vSync, and experience some strange behaviour.
First of all, here's my V_INT code :
Code: Select all
V_INT:
mov #0,R0
mov.w R0,@($16,GBR) ; Clear VINT
rte
add #1,R13 ; Executes ADD before branching
Code: Select all
main:
bsr waitForVBLK ; wait for V_INT to happen
nop
add #1,R12
bsr waitForDISP ; wait for V_INT to finish, and display to begin
nop
bra main
nop
Code: Select all
waitForVBLK:
mov.l REG_VDP,R1
mov.w VALUE_8000h,R2
whileDISP:
mov.w @($A,R1),R0 ; while (FB_CTRL_REG & 8000h == 0) ;
and R2,R0
cmp/eq #0,R0
bt whileDISP
rts
nop ; Executes NOP before branching
Code: Select all
waitForDISP:
mov.l REG_VDP,R1
mov.w VALUE_8000h,R2
whileVBLK:
mov.w @($A,R1),R0 ; while (FB_CTRL_REG & 8000h == 8000h) ;
and R2,R0
cmp/eq R2,R0
bt whileVBLK
rts
nop ; Executes NOP before branching
I've benchmarked R13 (the V_INT code) and I know it is true. But R12 is more than twice bigger !!! Does anyone know where this gap come from ?