From 81c2b777ee0c9e2a335af027e6e88765e41ae20b Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Wed, 10 May 2023 00:49:47 -0400 Subject: [PATCH] double: more vblank --- vaporlock/doubledouble/hardware.inc | 32 +++++++++++++-------- vaporlock/doubledouble/vblank.s | 43 +++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 12 deletions(-) create mode 100644 vaporlock/doubledouble/vblank.s diff --git a/vaporlock/doubledouble/hardware.inc b/vaporlock/doubledouble/hardware.inc index c02f1afb..6dbc2928 100644 --- a/vaporlock/doubledouble/hardware.inc +++ b/vaporlock/doubledouble/hardware.inc @@ -1,16 +1,20 @@ ; soft-switches ; yes, I know these aren't necessary the "official" names -KEYBOARD = $C000 ; Read -EIGHTYSTOREOFF = $C000 ; Write (turns off 80store) -EIGHTYSTOREON = $C001 ; Write (page2 writes to AUX memory) -CLR80COL = $C00C -SET80COL = $C00D -SETMOUSETEXT = $C00F ; (write) enable mouse text +KEYBOARD = $C000 ; Read keypress+128 +EIGHTYSTOREOFF = $C000 ; (write) turns off 80store +EIGHTYSTOREON = $C001 ; (write) page2 writes to AUX memory +CLR80COL = $C00C +SET80COL = $C00D +SETMOUSETEXT = $C00F ; (write) enable mouse text -TBCOLOR = $C022 ; IIgs text foreground / background colors -CLOCKCTL = $C034 ; bits 0-3 are IIgs border color -NEWVIDEO = $C029 ; IIgs graphics modes +VBLANK = $C019 ; *not* RDVBL (VBL signal low) (iie, opposite iigs) +RDVBLBAR = $C019 ; iic + +TBCOLOR = $C022 ; IIgs text foreground / background colors +CLOCKCTL = $C034 ; bits 0-3 are IIgs border color +NEWVIDEO = $C029 ; IIgs graphics modes +RDVBLMSK = $C041 ; iic read vbl interrupt SET_GR = $C050 SET_TEXT= $C051 @@ -20,9 +24,13 @@ PAGE1 = $C054 PAGE2 = $C055 LORES = $C056 HIRES = $C057 -CLRAN3 = $C05E ; in 80-col mode, enable double graphics -SETAN3 = $C05F ; in 80-col mode, disable double graphics -VBLANK = $C019 ; *not* RDVBL (VBL signal low) +DISVBL = $C05B ; (write) (iic) (ioudison) disable VBL interrupt +ENVBL = $C05B ; (write) (iic) (ioudison) enable VBL interrupt +CLRAN3 = $C05E ; (write) in 80-col mode, enable double graphics +SETAN3 = $C05F ; (write) in 80-col mode, disable double graphics +PTRIG = $C070 ; analog input reset / reset VBL interrupt (iic) +IOUDISON = $C07E ; (write) disable IOU +IOUDISOFF = $C07F ; (write) enable IOU ; ROM routines SETCOL = $F864 ; COLOR=A*17 diff --git a/vaporlock/doubledouble/vblank.s b/vaporlock/doubledouble/vblank.s new file mode 100644 index 00000000..32fb9eec --- /dev/null +++ b/vaporlock/doubledouble/vblank.s @@ -0,0 +1,43 @@ +; alternate implementation by Oliver Schmidt +; from https://github.com/cc65/cc65/blob/master/libsrc/apple2/waitvsync.s + +wait_vblank_iic: +; sei ; disables interrupts + 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 ; re-enable interrupts + + rts + + + + ;=========================== + ; wait for vblank on IIgs + ; opposte of IIe? +wait_vblank_iigs: + lda VBLANK + bpl wait_vblank_iigs ; wait for negative (in vblank) +wait_vblank_done_iigs: + lda VBLANK ; wait for positive (vlank done) + bmi wait_vblank_done_iigs + rts + + ;=========================== + ; wait for vblank on IIe +wait_vblank_iie: + lda VBLANK + bmi wait_vblank_iie ; wait for positive (in vblank) +wait_vblank_done_iie: + lda VBLANK ; wait for negative (vlank done) + bpl wait_vblank_done_iie + rts + +