4cade/src/hw.vbl.a

37 lines
1.1 KiB
Plaintext
Raw Normal View History

;license:MIT
;(c) 2020 by qkumba
;
; Functions to enable and disable VBL polling on various
; Apple II models
iWaitForVBL
sei ; IIc is special
sta $C07F ; enable access to VBL register
sta $C05B ; enable VBL polling
sta $C07E ; disable access to VBL register
WaitForVBL_iie ; IIe/IIgs have a relatively sane VBL
; but it's reversed between the two
; so we default to IIe, and patch in
; the reverse case if it's a IIGS.
2020-03-18 02:46:01 +00:00
patch_VBL_iic1
- lda $C019 ; $c019 bit 7 is sticky, reset it (SMC->#$70 for IIc)
2020-06-18 16:47:13 +00:00
patch_VBL_iigs1
2020-03-18 02:46:01 +00:00
patch_VBL_iic2
2020-06-18 16:47:13 +00:00
bpl -
- bit $C019
patch_VBL_iic3
patch_VBL_iigs2
bmi -
WaitForVBL_nop ; II/II+ have no easy VBL
rts
iUnwaitForVBL
2020-06-18 16:47:13 +00:00
lda $C070 ; $c019 bit 7 is sticky, reset it
- bit $C019
bpl -
sta $C07F ; enable access to VBL register
sta $C05A ; disable VBL polling
sta $C07E ; disable access to VBL register
cli
rts