1
0
mirror of https://github.com/cc65/cc65.git synced 2024-11-19 06:31:31 +00:00

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
commit bdcc5ba549
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,17 +5,20 @@
; /* Wait for the start of the next video field. */
;
; 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
.importzp tmp1
.import RDTIM
.include "cx16.inc"
_waitvsync:
ldx RAM_BANK ; (TIMER is in RAM bank 0)
stz RAM_BANK
lda TIMER + 2
: cmp TIMER + 2
beq :- ; Wait for next jiffy
stx RAM_BANK
rts
.proc _waitvsync: near
jsr RDTIM
sta tmp1
keep_waiting:
jsr RDTIM
cmp tmp1
beq keep_waiting
rts
.endproc