1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-20 05:29:39 +00:00
cc65/libsrc/cx16/waitvsync.s

25 lines
586 B
ArmAsm

;
; 2021-04-01, Greg King
;
; void waitvsync (void);
; /* 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
.proc _waitvsync: near
RDTIM = $FFDE ; Kernal API for reading the jiffy timer
jsr RDTIM
sta lastjiffy
keep_waiting:
jsr RDTIM
cmp #$FF ; self-mod the value returned by RDTIM to save memory
lastjiffy=(*-1)
beq keep_waiting
rts
.endproc