mist_hgr: make work on IIc as well

This commit is contained in:
Vince Weaver 2021-09-23 01:19:55 -04:00
parent 72ea4da48e
commit fac3ceddd8
4 changed files with 101 additions and 43 deletions

View File

@ -8,12 +8,26 @@ mist_link_book:
and #SOUND_MOCKINGBOARD
beq skip_turn_off_music
sei ; disable interrupts
; disable interrupts
jsr mockingboard_disable_interrupt
jsr clear_ay_both
skip_turn_off_music:
; load link noise if IIc
; we have to load it late due to IIc needing ROM copy in AUX
; until done playing music
; this makes an awkward pause but seems best compromise
lda APPLEII_MODEL
cmp #'C'
bne link_noise_already_loaded
jsr load_linking_noise
link_noise_already_loaded:
; clear screen
; clear to black

View File

@ -113,27 +113,6 @@ yes_language_card:
lda SOUND_STATUS
ora #SOUND_IN_LC
sta SOUND_STATUS
; load sounds into LC
; read ram, write ram, use $d000 bank1
bit $C08B
bit $C08B
lda #<linking_noise_compressed
sta getsrc_smc+1
lda #>linking_noise_compressed
sta getsrc_smc+2
lda #$D0 ; decompress to $D000
jsr decompress_lzsa2_fast
blah:
; read rom, nowrite, use $d000 bank1
bit $C08A
no_language_card:
;===================================
@ -227,6 +206,13 @@ mockingboard_notfound:
done_setup_sound:
lda APPLEII_MODEL
cmp #'C'
beq link_noise_not_yet
jsr load_linking_noise
link_noise_not_yet:
;==========================
; wait a bit at text title
@ -709,6 +695,19 @@ skip_intro:
; lda #1
; jsr draw_and_wait
;================================
; shut off speech if still going
;================================
lda SOUND_STATUS
and #SOUND_SSI263
beq no_not_speeking
jsr ssi263_speech_shutdown
no_not_speeking:
done_intro:
; restore to full screen (no text)
@ -973,7 +972,12 @@ get_mist_book:
jsr mockingboard_init
jsr reset_ay_both
jsr mockingboard_setup_interrupt
; jsr mockingboard_setup_interrupt
; to make it work on IIc?
jsr done_iic_hack
jsr pt3_init_song
@ -1110,3 +1114,36 @@ animate_xloop:
done_animate_book:
rts
load_linking_noise:
; load sound effect into language card
; do this late as IIc mockingboard support messes with language card
; update sound status
lda SOUND_STATUS
and #SOUND_IN_LC
beq skip_load_linking_noise
; load sounds into LC
; read ram, write ram, use $d000 bank1
bit $C08B
bit $C08B
lda #<linking_noise_compressed
sta getsrc_smc+1
lda #>linking_noise_compressed
sta getsrc_smc+2
lda #$D0 ; decompress to $D000
jsr decompress_lzsa2_fast
; read rom, nowrite, use $d000 bank1
bit $C08A
skip_load_linking_noise:
rts

View File

@ -182,8 +182,6 @@ mockingboard_setup_interrupt:
sei ; disable interrupts
copy_rom_loop:
lda $c089 ; read ROM, write RAM1
lda $c089
@ -214,11 +212,12 @@ write_rom_loop:
lda #>interrupt_handler
sta $ffff
lda #$EA ; nop out the "lda $45" in the irq handler
; nop out the "lda $45" in the irq handler
lda #$EA
sta interrupt_smc
sta interrupt_smc+1
.endif
done_iic_hack:

View File

@ -70,8 +70,6 @@ ssi263_speech_init:
ldx #SSI263_I
jsr ssi263_write_chip
cli ; enable interrupts
rts
@ -84,6 +82,8 @@ ssi263_speech_init:
ssi263_speech_shutdown:
sei
jsr ssi263_disable
rts
@ -195,6 +195,27 @@ no_oflo:
speech_end:
jsr ssi263_disable
end_interrupt:
pla
tay ; restore Y
pla
tax ; restore X
pla ; restore A
ssi_interrupt_smc:
lda $45 ; restore A (II+/IIe)
plp ; restore flags
rti ; return from interrupt
ssi263_disable:
; If at the end, turn everything off
; Toggle CTL while DR set to disable A/!R
@ -222,21 +243,8 @@ speech_end:
ldx #VIA6522_IER2
jsr ssi263_write_chip
end_interrupt:
rts
pla
tay ; restore Y
pla
tax ; restore X
pla ; restore A
ssi_interrupt_smc:
lda $45 ; restore A (II+/IIe)
plp ; restore flags
rti ; return from interrupt
speech_busy: .byte $00
speech_playing: .byte $00