1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-23 04:30:10 +00:00
cc65/libsrc/apple2/waitvsync.s
Colin Leroy-Mira 166a4b25f7 Apple2: implement sleep using MONWAIT
Also publish detect_iigs(), set_iigs_speed() and get_iigs_speed(). Refactor to only store one ostype variable.
2024-01-18 16:17:10 +01:00

47 lines
1.1 KiB
ArmAsm

;
; Oliver Schmidt, 2020-06-14
;
; void waitvsync (void);
;
.ifdef __APPLE2ENH__
.export _waitvsync
.import ostype
.include "apple2.inc"
_waitvsync:
bit ostype
bmi iigs ; $8x
bvs iic ; $4x
: bit RDVBLBAR
bpl :- ; Blanking
: bit RDVBLBAR
bmi :- ; Drawing
rts
; Apple IIgs TechNote #40, VBL Signal
iigs: bit RDVBLBAR
bmi iigs ; Blanking
: bit RDVBLBAR
bpl :- ; Drawing
rts
; Apple IIc TechNote #9, Detecting VBL
iic: sei
sta IOUDISOFF
lda RDVBLMSK
bit ENVBL
bit PTRIG ; Reset VBL interrupt flag
: bit RDVBLBAR
bpl :-
asl
bcs :+ ; VBL interrupts were already enabled
bit DISVBL
: sta IOUDISON ; IIc Tech Ref Man: The firmware normally leaves IOUDIS on.
cli
rts
.endif ; __APPLE2ENH__