mist: fix up detection to be more like mist_hgr

This commit is contained in:
Vince Weaver 2021-09-22 17:22:15 -04:00
parent dbbb8bed46
commit 571dd34d27
11 changed files with 305 additions and 65 deletions

View File

@ -62,7 +62,7 @@ mist.dsk: QBOOT TEXT_TITLE QLOAD \
$(DOS33_RAW) mist.dsk 0 14 SAVE4 0 1
$(DOS33_RAW) mist.dsk 0 15 SAVE5 0 1
$(DOS33_RAW) mist.dsk 1 0 QLOAD 0 14
$(DOS33_RAW) mist.dsk 2 0 MIST_TITLE 0 83
$(DOS33_RAW) mist.dsk 2 0 MIST_TITLE 0 0
$(DOS33_RAW) mist.dsk 8 0 MIST 0 159
$(DOS33_RAW) mist.dsk 18 0 OCTAGON 0 128
$(DOS33_RAW) mist.dsk 26 0 DENTIST 0 31
@ -542,6 +542,8 @@ clean:
MECHE SELENA SHIP STONEY CHANNEL ARBOR NIBEL \
GENERATOR \
generate_common
distclean: clean
cd graphics_title && make clean
cd graphics_mist && make clean
cd graphics_octagon && make clean

BIN
games/mist/audio/cyan.pt3 Normal file

Binary file not shown.

View File

@ -12,18 +12,12 @@
.include "common_routines.inc"
mist_start:
;===================
; init screen
; detect model
;===================
jsr TEXT
jsr HOME
bit KEYRESET
bit SET_GR
bit PAGE0
bit HIRES
bit FULLGR
jsr detect_appleii_model
;===================
; machine workarounds
@ -59,29 +53,33 @@ mist_start:
sta CLOCKCTL ; set twice for VidHD
not_a_iigs:
;===================
; setup location
; print config
;===================
lda #<locations
sta LOCATIONS_L
lda #>locations
sta LOCATIONS_H
; print non-inverse
jsr set_normal
;===================
; Load hires graphics
;===================
reload_everything:
lda #<config_string
sta OUTL
lda #>config_string
sta OUTH
lda #<file
sta getsrc_smc+1 ; LZSA_SRC_LO
lda #>file
sta getsrc_smc+2 ; LZSA_SRC_HI
jsr move_and_print
lda #$20
; print detected model
jsr decompress_lzsa2_fast
lda APPLEII_MODEL
ora #$80
sta $7d0+8 ; 23,8
; if GS print the extra S
cmp #'G'|$80
bne not_gs
lda #'S'|$80
sta $7d0+9
not_gs:
;===================================
; detect if we have a language card
@ -94,6 +92,13 @@ reload_everything:
jsr detect_language_card
bcs no_language_card
yes_language_card:
; update status
lda #'6'|$80
sta $7d0+11 ; 23,11
lda #'4'|$80
sta $7d0+12 ; 23,12
; update sound status
lda SOUND_STATUS
ora #SOUND_IN_LC
@ -124,6 +129,9 @@ no_language_card:
;===================================
; Setup Mockingboard
;===================================
PT3_ENABLE_APPLEIIC = 1
lda #0
sta DONE_PLAYING
sta LOOP
@ -134,12 +142,45 @@ no_language_card:
bcc mockingboard_notfound
mockingboard_found:
; jsr mockingboard_patch ; patch to work in slots other than 4?
; print detected location
lda #'S'+$80 ; change NO to slot
sta $7d0+30
lda MB_ADDR_H ; $C4 = 4, want $B4 1100 -> 1011
and #$87
ora #$30
sta $7d0+31 ; 23,31
lda SOUND_STATUS
ora #SOUND_MOCKINGBOARD
sta SOUND_STATUS
;===========================
; detect SSI-263 too
;===========================
;detect_ssi:
; lda MB_ADDR_H
; and #$87 ; slot
; jsr detect_ssi263
;
; lda irq_count
; beq ssi_not_found
;
; lda #'Y'+$80
; sta $7d0+39 ; 23,39
;
; lda #SOUND_SSI263
; ora SOUND_STATUS
; sta SOUND_STATUS
ssi_not_found:
jsr mockingboard_patch ; patch to work in slots other than 4?
;=======================
; Set up 50Hz interrupt
;========================
@ -168,6 +209,54 @@ mockingboard_notfound:
done_setup_sound:
;==========================
; wait a bit at text title
;==========================
lda #40
jsr wait_a_bit
;===================
; init screen
;===================
jsr TEXT
jsr HOME
bit KEYRESET
bit SET_GR
bit PAGE0
bit HIRES
bit FULLGR
;===================
; setup location
;===================
lda #<locations
sta LOCATIONS_L
lda #>locations
sta LOCATIONS_H
;===================
; Load hires graphics
;===================
reload_everything:
lda #<file
sta getsrc_smc+1 ; LZSA_SRC_LO
lda #>file
sta getsrc_smc+2 ; LZSA_SRC_HI
lda #$20
jsr decompress_lzsa2_fast
;===================================
@ -497,11 +586,13 @@ really_exit:
; pt3 player
.include "pt3_lib_detect_model.s"
.include "pt3_lib_core.s"
.include "pt3_lib_init.s"
.include "pt3_lib_mockingboard_setup.s"
.include "interrupt_handler.s"
.include "pt3_lib_mockingboard_detect.s"
.include "pt3_lib_mockingboard_setup.s"
.include "wait_a_bit.s"
@ -607,5 +698,29 @@ theme_music:
; 0123456789012345678901234567890123456789
.byte " THE ENDING HAS NOT YET BEEN WRITTEN"
.endif
config_string:
; 0123456789012345678901234567890123456789
.byte 0,23,"APPLE II?, 48K, MOCKINGBOARD: NO, SSI: N",0
; MOCKINGBOARD: NONE
; set normal text
set_normal:
lda #$80
sta ps_smc1+1
lda #09 ; ora
sta ps_smc1
rts
; restore inverse text
set_inverse:
lda #$29
sta ps_smc1
lda #$3f
sta ps_smc1+1
rts

View File

@ -0,0 +1,63 @@
;===========================
; Check Apple II model
;===========================
; this is mostly for IIc support
; as it does interrupts differently
; ' ' ($20) = Apple II
; '+' ($2B) = Apple II+
; 'E' ($45) = Apple IIe
; 'C' ($43) = Apple IIc
; 'G' ($47) = Apple IIgs
detect_appleii_model:
lda #' '
ldx $FBB3
; II is $38
; J-plus is $C9
; II+ is $EA (so is III)
; IIe and newer is $06
cpx #$38
beq done_apple_detect
lda #'+'
cpx #$EA
beq done_apple_detect
; TODO: check for J-plus or III?
cpx #$06
bne done_apple_detect
apple_iie_or_newer:
ldx $FBC0 ; $EA on a IIe
; $E0 on a IIe enhanced
; $00 on a IIc/IIc+
; $FE1F = $60, IIgs
beq apple_iic
lda #'E'
cpx #$EA
beq done_apple_detect
cpx #$E0
beq done_apple_detect
; assume GS?
lda #'G'
bne done_apple_detect
apple_iic:
lda #'C'
done_apple_detect:
sta APPLEII_MODEL
rts

View File

@ -33,6 +33,26 @@
;------------------------------------------------------------------------------
mockingboard_detect:
; activate IIc mockingboard?
; this might only be necessary to allow detection
; I get the impression the Mockingboard 4c activates
; when you access any of the 6522 ports in Slot 4
.ifdef PT3_ENABLE_APPLE_IIC
lda APPLEII_MODEL
cmp #'C'
bne not_iic
lda #$ff
; don't bother patching these, IIc mockingboard always slot 4?
sta MOCK_6522_DDRA1
sta MOCK_6522_T1CL
.endif
not_iic:
lda #$00
sta MB_ADDR_L
ldx #$C7 ; start at slot #7

View File

@ -170,47 +170,56 @@ clear_ay_end:
;=============================
mockingboard_setup_interrupt:
;===========================
; Check for Apple IIc
;===========================
; it does interrupts differently
lda $FBB3 ; IIe and newer is $06
cmp #6
beq apple_iie_or_newer
jmp done_apple_detect
apple_iie_or_newer:
lda $FBC0 ; 0 on a IIc
bne done_apple_detect
apple_iic:
; activate IIc mockingboard?
; this might only be necessary to allow detection
; I get the impression the Mockingboard 4c activates
; when you access any of the 6522 ports in Slot 4
lda #$ff
; don't bother patching these, IIc mockingboard always slot 4?
sta MOCK_6522_DDRA1
sta MOCK_6522_T1CL
.ifdef PT3_ENABLE_APPLE_IIC
lda APPLEII_MODEL
cmp #'C'
bne done_iic_hack
; bypass the firmware interrupt handler
; should we do this on IIe too? probably faster
; first we have to copy the ROM to the language card
sei ; disable interrupts
lda $c08b ; disable ROM (enable language card)
lda $c08b
copy_rom_loop:
lda $c089 ; read ROM, write RAM1
lda $c089
ldy #0
read_rom_loop:
lda $D000,Y
sta $400,Y ; note this uses text page as
; temporary data store
iny
bne read_rom_loop
lda $c08B ; read/write RAM1
lda $c08B ;
write_rom_loop:
lda $400,Y
sta $D000,Y
iny
bne write_rom_loop
inc read_rom_loop+2
inc write_rom_loop+5
bne copy_rom_loop
lda #<interrupt_handler
sta $fffe
lda #>interrupt_handler
sta $ffff
lda #$EA ; nop out the "lda $45" in the irq hand
lda #$EA ; nop out the "lda $45" in the irq handler
sta interrupt_smc
sta interrupt_smc+1
.endif
done_apple_detect:
done_iic_hack:
;=========================
@ -228,10 +237,16 @@ done_apple_detect:
; Enable 50Hz clock on 6522
;============================
; 4fe7 / 1e6 = .020s, 50Hz
; 9c40 / 1e6 = .040s, 25Hz
; 411a / 1e6 = .016s, 60Hz
; Note, on Apple II the clock isn't 1MHz but is actually closer to
; roughly 1.023MHz, and every 65th clock is stretched (it's complicated)
; 4fe7 / 1.023e6 = .020s, 50Hz
; 9c40 / 1.023e6 = .040s, 25Hz
; 411a / 1.023e6 = .016s, 60Hz
; French Touch uses
; 4e20 / 1.000e6 = .020s, 50Hz, which assumes 1MHz clock freq
sei ; disable interrupts just in case
@ -249,12 +264,33 @@ setup_irq_smc4:
sta MOCK_6522_IER ; IER: 1100, enable timer one interrupt
lda #$E7
; lda #$20
setup_irq_smc5:
sta MOCK_6522_T1CL ; write into low-order latch
lda #$4f
; lda #$4E
setup_irq_smc6:
sta MOCK_6522_T1CH ; write into high-order latch,
; load both values into counter
; clear interrupt and start counting
rts
;=============================
; Disable Interrupt
;=============================
mockingboard_disable_interrupt:
sei ; disable interrupts just in case
lda #$40 ; Continuous interrupts, don't touch PB7
disable_irq_smc1:
sta MOCK_6522_ACR ; ACR register
lda #$7F ; clear all interrupt flags
disable_irq_smc2:
sta MOCK_6522_IER ; IER register (interrupt enable)
rts

View File

@ -213,7 +213,7 @@ sector_array:
.byte 0 ; FIRST_SECTOR
length_array:
.byte 83,159,157,145 ; MIST_TITLE,MIST,MECHE,SELENA
.byte 95,159,157,145 ; MIST_TITLE,MIST,MECHE,SELENA
.byte 128, 20,158,135 ; OCTAGON,VIEWER,STONEY,CHANNEL
.byte 61, 31,159,109 ; CABIN,DENTIST,ARBOR,NIBEL
.byte 20, 33, 27, 78 ; SHIP,GENERATOR,D'NI,SUB

View File

@ -60,6 +60,7 @@ done_print_string:
rts
.if 0
;================================
; move and print a list of lines

View File

@ -29,9 +29,8 @@ text_loop:
dex
bne text_loop
lda #40
jsr wait_a_bit
; lda #40
; jsr wait_a_bit
rts

View File

@ -2,6 +2,7 @@
;; LZSA addresses
NIBCOUNT = $00
APPLEII_MODEL = $01
;; Zero page monitor routines addresses

View File

@ -155,6 +155,9 @@ mockingboard_found:
; print detected location
lda #'S'+$80 ; change NO to Slot
sta $7d0+30
lda MB_ADDR_H ; $C4 = 4, want $B4 1100 -> 1011
and #$87
ora #$30
@ -1048,7 +1051,7 @@ narration6:
config_string:
; 0123456789012345678901234567890123456789
.byte 0,23,"APPLE II?, 48K, MOCKINGBOARD: S?, SSI: N",0
.byte 0,23,"APPLE II?, 48K, MOCKINGBOARD: NO, SSI: N",0
; MOCKINGBOARD: NONE