Merge pull request #1821 from ZeroByteOrg/x16_waitvsync

CX16 waitvsync uses Kernal API to retreive jiffies
This commit is contained in:
Bob Andrews
2022-08-09 19:02:15 +02:00
committed by GitHub

View File

@@ -5,17 +5,20 @@
; /* Wait for the start of the next video field. */ ; /* Wait for the start of the next video field. */
; ;
; VERA's vertical sync causes IRQs which increment the jiffy timer. ; VERA's vertical sync causes IRQs which increment the jiffy timer.
;
; Updated by ZeroByteOrg to use Kernal API RDTIM to retreive the TIMER variable
; ;
.export _waitvsync .export _waitvsync
.importzp tmp1
.import RDTIM
.include "cx16.inc" .proc _waitvsync: near
jsr RDTIM
_waitvsync: sta tmp1
ldx RAM_BANK ; (TIMER is in RAM bank 0) keep_waiting:
stz RAM_BANK jsr RDTIM
lda TIMER + 2 cmp tmp1
: cmp TIMER + 2 beq keep_waiting
beq :- ; Wait for next jiffy rts
stx RAM_BANK .endproc
rts