second: iigs support seems to be working

This commit is contained in:
Vince Weaver 2023-11-08 23:59:36 -05:00
parent 5f435b846c
commit 3943db72e8
9 changed files with 78 additions and 8 deletions

View File

@ -243,6 +243,7 @@ music.inc: generate_common MUSIC
./generate_common -a 0xd000 -s copy_aux_main music.lst >> music.inc
./generate_common -a 0xd000 -s mute_ay_both music.lst >> music.inc
./generate_common -a 0xd000 -s unmute_ay_both music.lst >> music.inc
./generate_common -a 0xd000 -s interrupt_handler music.lst >> music.inc
music2.inc: generate_common MUSIC2
./generate_common -a 0xd000 -s pt3_init_song music2.lst > music2.inc
@ -258,6 +259,7 @@ music2.inc: generate_common MUSIC2
./generate_common -a 0xd000 -s copy_aux_main music2.lst >> music2.inc
./generate_common -a 0xd000 -s mute_ay_both music2.lst >> music2.inc
./generate_common -a 0xd000 -s unmute_ay_both music2.lst >> music2.inc
./generate_common -a 0xd000 -s interrupt_handler music2.lst >> music2.inc
####

View File

@ -0,0 +1,9 @@
gs_interrupt_handler:
; swap back in language card
; read/write RAM, use $d000 bank1
bit $C083
bit $C083
jmp interrupt_handler

View File

@ -12,6 +12,7 @@ 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
SET_GR = $C050
SET_TEXT = $C051
FULLGR = $C052

View File

@ -1,7 +1,10 @@
;====================
; Hardware Detect
; called for disk1 and disk2
; simplified version for disk2
; simplified version that just detects model and mockingboard
; for the fake BIOS we do a bit more, but we do rely
; on this being run first
hardware_detect:
@ -13,10 +16,24 @@ hardware_detect:
jsr detect_appleii_model
lda APPLEII_MODEL
cmp 'g'
cmp #'g'
bne not_iigs
is_a_iigs:
; enable 1MHz mode
; see hw.accel.a in 4cade
setspeed:
lda CYAREG
and #$7f
sta CYAREG
; gr/text page2 handling broken on early IIgs models
; this enables the workaround
jsr ROM_TEXT2COPY ; set alternate display mode on IIgs
; set background color to black instead of blue
lda NEWVIDEO
and #%00011111 ; bit 7 = 0 -> IIgs Apple II-compat video modes
@ -30,6 +47,12 @@ is_a_iigs:
sta CLOCKCTL ; black border
sta CLOCKCTL ; set twice for VidHD
; gs always swaps in RAM
lda #<gs_interrupt_handler
sta $3FE
lda #>gs_interrupt_handler
sta $3FF
not_iigs:

View File

@ -36,6 +36,17 @@ bios_test:
bne not_iigs
is_a_iigs:
; we do this earlier in detect_hardware
.if 0
; enable 1MHz mode
; see hw.accel.a in 4cade
setspeed:
lda CYAREG
and #$7f
sta CYAREG
; set background color to black instead of blue
lda NEWVIDEO
and #%00011111 ; bit 7 = 0 -> IIgs Apple II-compat video modes
@ -48,6 +59,7 @@ is_a_iigs:
lda #$00
sta CLOCKCTL ; black border
sta CLOCKCTL ; set twice for VidHD
.endif
lda #'s'
sta model_patch_1+9
@ -198,14 +210,24 @@ done_detect_cpu:
;=====================
; Detect mockingboard
;=====================
; did this earlier too
.if 0
lda #0
sta SOUND_STATUS
PT3_ENABLE_APPLE_IIC = 1
jsr mockingboard_detect
bcc mockingboard_notfound
.endif
; patch if necessary
lda SOUND_STATUS
and #SOUND_MOCKINGBOARD
beq mockingboard_notfound
mockingboard_found:
lda MB_ADDR_H
@ -214,13 +236,12 @@ mockingboard_found:
sta mock_slot_patch+7
lda SOUND_STATUS
ora #SOUND_MOCKINGBOARD
sta SOUND_STATUS
; lda SOUND_STATUS
; ora #SOUND_MOCKINGBOARD
; sta SOUND_STATUS
mockingboard_notfound:
;===================
; Load graphics
;===================

View File

@ -212,6 +212,8 @@ mockingboard_setup_interrupt:
lda #>interrupt_handler
sta $ffff
; note elsewhere we put gs_interrupt_handler in $3FE/$3FF
; nop out the "lda $45" since we are bypassing the ROM irq handler
; that puts A in $45
lda #$EA

View File

@ -191,6 +191,7 @@ PT3_ENABLE_APPLE_IIC = 1
.include "pt3_lib_detect_model.s"
.include "pt3_lib_mockingboard_detect.s"
.include "gs_interrupt.s"
mod7_table = $1c00
div7_table = $1d00

View File

@ -15,7 +15,7 @@ second_start:
; initializations
;=====================
jsr hardware_detect ; FIXME: remove when hook up part00
jsr hardware_detect
jsr hgr_make_tables
@ -62,8 +62,13 @@ restart:
; patch mockingboard
lda SOUND_STATUS
beq skip_mbp1
jsr mockingboard_patch ; patch to work in slots other than 4?
skip_mbp1:
;=======================
; Set up 50Hz interrupt
;========================
@ -200,7 +205,11 @@ load_program_loop:
;========================
; patch mockingboard
lda SOUND_STATUS
beq skip_mbp2
jsr mockingboard_patch ; patch to work in slots other than 4?
skip_mbp2:
jsr mockingboard_init
;=======================
; Set up 50Hz interrupt
@ -542,6 +551,8 @@ forever:
.include "wait_keypress.s"
.include "zx02_optim.s"
.include "gs_interrupt.s"
;.include "title.s"
disk_change_string: