xmas24: test iic/ii+/gs support

This commit is contained in:
Vince Weaver 2024-12-21 17:34:50 -05:00
parent 1e8b163fd9
commit 7d5ccc8e0c
4 changed files with 77 additions and 18 deletions

View File

@ -42,7 +42,7 @@ qload.o: zp.inc hardware.inc music.inc qload.s \
wait.s wait_a_bit.s \
lc_detect.s gr_fast_clear.s \
text_print.s start.s \
hgr_table.s gs_interrupt.s \
hgr_table.s gs_interrupt.s vblank.s \
zx02_optim.s wait_keypress.s hardware_detect.s \
pt3_lib_detect_model.s pt3_lib_mockingboard_detect.s \
pt3_lib_mockingboard_setup.s interrupt_handler.s \

View File

@ -8,11 +8,14 @@ CLR80COL = $C000 ; PAGE1/PAGE1 normal
SET80COL = $C001 ; PAGE1/PAGE2 switches PAGE1 in Aux instead
EIGHTYCOLOFF = $C00C
EIGHTYCOLON = $C00D
RDVBLBAR = $C019 ; iic
TBCOLOR = $C022 ; IIgs text fg/bg colors
NEWVIDEO = $C029 ; IIgs graphics modes
SPEAKER = $C030
CLOCKCTL = $C034 ; bits 0-3 are IIgs border color
CYAREG = $C036 ; iigs motor detect and clock speed
RDVBLMSK = $C041 ; iic read vbl interrupt
SET_GR = $C050
SET_TEXT = $C051
FULLGR = $C052
@ -22,10 +25,18 @@ PAGE2 = $C055
LORES = $C056 ; Enable LORES graphics
HIRES = $C057 ; Enable HIRES graphics
AN3 = $C05E ; Annunciator 3
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
PADDLE_BUTTON0 = $C061
PADDL0 = $C064
PTRIG = $C070
PTRIG = $C070 ; analog input reset / reset VBL interrupt (iic)
IOUDISON = $C07E ; (write) disable IOU
IOUDISOFF = $C07F ; (write) enable IOU
; APPLESOFT BASIC ROUTINES

View File

@ -188,7 +188,7 @@ no_mockingboard_string:
; 0123456789012345678901234567890123456789
title_string:
.byte 0,4, "XMAS 2024",0
.byte 0,4, "XMAS 2024 (V1.1)",0
.byte 0,6, "BY THE GUINEA PIG GANG",0
.byte 0,8, "CODE: VINCE 'DEATER' WEAVER",0
.byte 0,9, "ART: GUINEAGIRL2424",0

View File

@ -14,10 +14,19 @@ VBLANK = $C019 ;
; TODO: patch this to a RTS on non-IIe systems
wait_vblank:
; Assume Apple IIe
; lda APPLEII_MODEL
; cmp #'e'
; bne no_vblank
lda APPLEII_MODEL
cmp #'e'
beq wait_vblank_iie
cmp #'g'
beq wait_vblank_iigs
; cmp #'c'
; beq wait_vblank_iic
bne no_vblank
; 4cade does this, the opposite of the way were doing it originally
@ -33,16 +42,55 @@ wait_vblank_done_iie:
lda VBLANK
bmi wait_vblank_done_iie ; repeat until positive (start vblank)
; in vblank
no_vblank:
.if 0
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
no_vblank:
.endif
rts
wait_vblank_iigs:
lda VBLANK
bpl wait_vblank_iigs ; repeat until negative
; not in vblank
wait_vblank_done_iigs:
lda VBLANK
bmi wait_vblank_done_iigs ; repeat until positive (start vblank)
; in vblank
rts
; NOTE: we don't support this as we have to handle interrupts
; for music and we'd have to hack up the irq handler
; to differentiate VBLANK from others
; 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
wviim:
bit RDVBLBAR
bpl wviim
asl
bcs wviip ; VBL interrupts were already enabled
bit DISVBL
wviip:
sta IOUDISON ; IIc Tech Ref Man: The firmware normally leaves IOUDIS on.
; cli ; re-enable interrupts
rts
no_vblank:
; pause a bit?
lda #50
jsr wait
rts