lemm: more work on iic vblank

This commit is contained in:
Vince Weaver 2022-04-14 16:12:21 -04:00
parent 3b8aa7fad8
commit b6fcd7efa8
2 changed files with 41 additions and 16 deletions

View File

@ -8,11 +8,14 @@ CLR80COL = $C000 ; PAGE0/PAGE1 normal
SET80COL = $C001 ; PAGE0/PAGE1 switches PAGE0 in Aux instead
EIGHTYCOLOFF = $C00C
EIGHTYCOLON = $C00D
VBLANK = $C019 ; IIe *not* RDVBL (VBL signal low)
VBLANK = $C019 ; IIe *not* RDVBL (VBL low), IIgs opposite
RSTVBL = $C019 ; reset VBLANK interrupt (iic)
RDVBLBAR = $C019
TBCOLOR = $C022 ; IIgs text foreground / background colors
NEWVIDEO = $C029 ; IIgs graphics modes
SPEAKER = $C030
CLOCKCTL = $C034 ; bits 0-3 are IIgs border color
RDVBLMSK = $C041 ; read VBL interrupt (bit 7)
SET_GR = $C050
SET_TEXT = $C051
FULLGR = $C052
@ -21,17 +24,17 @@ PAGE0 = $C054
PAGE1 = $C055
LORES = $C056 ; Enable LORES graphics
HIRES = $C057 ; Enable HIRES graphics
CLRAN1 = $C05A ; clear annunciator 1 (if IOUDIS off)
DISVBL = $C05A ; disable VBLANK (iic) (if IOUDIS on)
SETAN1 = $C05B ; set annunciator 1 (if IOUDIS off)
ENVBL = $C05B ; enable VBLANK (iic) (if IOUDIS on)
AN3 = $C05E ; Annunciator 3
PADDLE_BUTTON0 = $C061
PADDL0 = $C064
PTRIG = $C070
PTRIG = $C070 ; Analog input reset
VBLINT = $C070 ; Analog input reset + reset vblank (iic)
IOUDISON = $C07E ; iic
IOUDISOFF = $C07F ; iic
;; BASIC ROUTINES

View File

@ -364,26 +364,48 @@ level_end_messages_h:
.align $100
.if 1
;==============
; this code from https://comp.sys.apple2.narkive.com/dHkvl39d/vblank-apple-iic
; as well as IIc technote #9
split_screen_iic:
bit $c041
bit $c041 ; RDVBLMSK Read VBL interrupt (bit 7)
bmi rdvbl
sta $c07f ; turn off IOUdis
sta $c07f ; IOUDISOFF turn off IOUdis
sta $c05b ; ENVBL enable vblank
sta $c07e ; ??
sta $c07e ; IOUDISON turn on IOUdis
rdvbl:
bit $c019
bit $c019 ; RSTVBL reset vblank (iic)
bmi rdvbl
lda $c070 ; clear vblank
lda $c070 ; reset VBLINT vblank interrupt flag
rdvbl2:
bit $c019
bit $c019 ; RSTVBL reset vblank (iic)
bpl rdvbl2
lda $c070 ; clears vblank
lda $c070 ; reset VBLINT vblank interrupt flag
jmp start_vblank
.else
; alternate implementation by Oliver Schmidt
; from https://github.com/cc65/cc65/blob/master/libsrc/apple2/waitvsync.s
split_screen_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
jmp start_vblank
.endif
; split screen?
split_screen_iigs: