From 0c12457e69bc90582b16e9d7ef44f0d1426c2ca9 Mon Sep 17 00:00:00 2001 From: Peter Ferrie Date: Mon, 25 Apr 2022 15:09:50 -0700 Subject: [PATCH] distinguish between SC-01 and SSI-263 --- src/constants.a | 8 +++++--- src/hw.mockingboard.a | 27 ++++++++++++++------------- src/macros.a | 18 +++++++++--------- src/prelaunch/ape.escape.a | 8 +++----- src/prelaunch/battle.cruiser.a | 4 ++-- src/prelaunch/berzap.mb.a | 27 +++++++++++++-------------- src/prelaunch/kamungas.mb.a | 22 ++++++++++------------ src/prelaunch/lady.tut.a | 3 ++- src/prelaunch/resq.raiders.mb.a | 4 ++-- src/prelaunch/spy.strikes.bak.a | 14 +++++++------- src/prelaunch/thunder.bombs.a | 21 ++++++++++----------- src/prelaunch/zoo.master.a | 5 ++--- 12 files changed, 79 insertions(+), 82 deletions(-) diff --git a/src/constants.a b/src/constants.a index fc3d41557..dd1783bdd 100644 --- a/src/constants.a +++ b/src/constants.a @@ -169,9 +169,11 @@ iLoadFileDirect = $FFEF ; note: you really want LC RAM 2 banked in before ca WaitForVBL = $FFF2 UnwaitForVBL = $FFF5 -MockingboardStuff = $FFF8 ; bit 7 = 1 if speech chip present (Mockingboard "C") - ; bit 6 = 1 if Mockingboard "B" (stereo) found (else Mockingboard "A") - ; bit 4-5 unused +MockingboardStuff = $FFF8 ; bit 7 = 1 if SC-01 speech chip present (Speech I) + ; bit 6 = 1 if SSI-263 speech chip present (Mockingboard "B"-"D") + ; bit 5 = 1 if two AY-3-8910s present (Sound II / Mockingboard "A"-"D") + ; bit 5 = 0 if only AY-3-8910 present (Sound I) + ; bit 4 unused ; bits 0-3: slot number MachineStatus = $FFF9 diff --git a/src/hw.mockingboard.a b/src/hw.mockingboard.a index 05c36b7e9..578771571 100644 --- a/src/hw.mockingboard.a +++ b/src/hw.mockingboard.a @@ -18,9 +18,10 @@ ; (zp$81 will contain the slot in form $Cx) ; /!\ ALL ACCELERATORS MUST BE OFF OR SET TO 1 MHZ ; out: if card was found, X = #$?n where n is the slot number of the card, otherwise #$00 -; and bit 6 = 0 if Mockingboard Sound I found -; or bit 6 = 1 if Mockingboard Sound II or "A" found -; and bit 7 = 1 if Mockingboard Sound/Speech I or "C" found +; and bit 5 = 0 if Mockingboard Sound I found +; or bit 5 = 1 if Mockingboard Sound II or "A"-"D" found +; and bit 6 = 1 if SSI-263 speech chip found +; or bit 7 = 1 if SC-01 speech chip found ; flags clobbered ; zp $80-$82 clobbered ; A/Y clobbered @@ -127,11 +128,13 @@ GetMockingboardStuff @wait_irq lda $80 - bne @got_irq + bne + iny bne @wait_irq inx bne @wait_irq + clc ++ ror $82 ; detect speech - SC-01 ;based on S/S I demo dsk @@ -159,24 +162,22 @@ GetMockingboardStuff bne - inx bne - - clc ; not found - bcc @got_irq + beq @got_irq @mb_smc21 + sta $c40d ; ifr, clear flag lda #$00 ; turn off cb2 pulse mode to disable false writes to sc01 @mb_smc22 sta $c40c ; pcr - sec ; found, we have an S/S I + sec ; found, we have an SC-01 ror $82 - ldy #$ff - bcc @ssI + bne @ssI @got_irq sei + clc ; not found ror $82 -@onlyI ldy #$ff @mb_smc6 sty $c403 ; 6522#1 ddra @@ -190,16 +191,16 @@ GetMockingboardStuff sta ($80),y ; 6522#1 orb lda #4 sta ($80),y ; 6522#1 orb - dey + @ssI + ldy #$ff @mb_smc8 sty $c483 ; 6522#2 ddra lda #7 @mb_smc9 sta $c482 ; 6522#2 ddrb - iny - tya + lda #0 ldy #$80 sta ($80),y ; 6522#2 orb lda #4 diff --git a/src/macros.a b/src/macros.a index 048f2f7b8..1ce3972af 100755 --- a/src/macros.a +++ b/src/macros.a @@ -209,7 +209,7 @@ ; various language card configurations !macro READ_RAM1_NO_WRITE { - bit $C088 + sta $C088 } !macro READ_RAM1_WRITE_RAM1 { @@ -218,7 +218,7 @@ } !macro READ_RAM2_NO_WRITE { - bit $C080 + sta $C080 } !macro READ_RAM2_WRITE_RAM2 { @@ -237,7 +237,7 @@ } !macro READ_ROM_NO_WRITE { - bit $C082 + sta $C082 } !macro READ_AUX { @@ -314,18 +314,16 @@ +READ_ROM_NO_WRITE } -!macro GET_MOCKINGBOARD_SPEECH { ;carry set if present +!macro GET_MOCKINGBOARD_SPEECH { ;sign set if SC-01, overflow set if SSI-263 +READ_RAM2_NO_WRITE - lda MockingboardStuff - asl + bit MockingboardStuff +READ_ROM_NO_WRITE } -!macro GET_MOCKINGBOARD_SPEECH_AND_MACHINE_STATUS { ;carry set if present +!macro GET_MOCKINGBOARD_SPEECH_AND_MACHINE_STATUS { ;sign set if SC-01, overflow set if SSI-263 +READ_RAM2_NO_WRITE - lda MockingboardStuff - asl lda MachineStatus + bit MockingboardStuff +READ_ROM_NO_WRITE } @@ -333,6 +331,7 @@ +READ_RAM2_NO_WRITE lda MockingboardStuff cmp #1 + and #7 ora #$C0 +READ_ROM_NO_WRITE } @@ -341,6 +340,7 @@ +READ_RAM2_NO_WRITE lda MockingboardStuff cmp #1 + and #7 ora #$C0 tax lda MachineStatus diff --git a/src/prelaunch/ape.escape.a b/src/prelaunch/ape.escape.a index caf7cf867..4227ab83e 100644 --- a/src/prelaunch/ape.escape.a +++ b/src/prelaunch/ape.escape.a @@ -1,5 +1,5 @@ ;license:MIT -;(c) 2021 by qkumba +;(c) 2021-2022 by qkumba !cpu 6502 !to "build/PRELAUNCH.INDEXED/APE.ESCAPE",plain @@ -26,11 +26,9 @@ jsr $94E4 ; decompress game lda MockingboardStuff - cmp #1 - ora #$C0 - bcc no_speech - ldx MockingboardStuff bpl no_speech + and #7 + ora #$C0 ldy #0 - ldx $1300,Y ;find #$C4s diff --git a/src/prelaunch/battle.cruiser.a b/src/prelaunch/battle.cruiser.a index 1ecefbf01..ef7041b58 100644 --- a/src/prelaunch/battle.cruiser.a +++ b/src/prelaunch/battle.cruiser.a @@ -1,5 +1,5 @@ ;license:MIT -;(c) 2020 by qkumba +;(c) 2020, 2022 by qkumba !cpu 6502 !to "build/PRELAUNCH.INDEXED/BATTLE.CRUISER",plain @@ -13,7 +13,7 @@ jsr $2000 ; decompress +GET_MOCKINGBOARD_SPEECH_AND_MACHINE_STATUS - bcs + + bmi + ldy #0 sty $868 sty $9486 diff --git a/src/prelaunch/berzap.mb.a b/src/prelaunch/berzap.mb.a index 37956a883..b8d658b22 100644 --- a/src/prelaunch/berzap.mb.a +++ b/src/prelaunch/berzap.mb.a @@ -1,5 +1,5 @@ ;license:MIT -;(c) 2020 by qkumba +;(c) 2020, 2022 by qkumba !cpu 6502 !to "build/PRELAUNCH/BERZAP.MB",plain @@ -93,21 +93,20 @@ setopt lda $65AB cmp #3 bne ++ - +READ_RAM2_NO_WRITE - lda MockingboardStuff - ldx #3 ; MB/A + ldy #0 sty $382 ; joystick - asl - bpl + - ldx #1 ; Sound2 -+ bcc + - txa - eor #2 - adc #0 - tax ; Sound/Speech or MB/C - lsr - tay ; Speech1 or Speech2 + ldx #2 + iny ; Sound/Speech I + + +READ_RAM2_NO_WRITE + bit MockingboardStuff + bmi + ; SC-01 + ldx #0 + dey ; Sound II + bvc + ; no speech + ldx #4 + ldy #2 ; Mockingboard "C" + stx $380 sty $381 lda #$0D diff --git a/src/prelaunch/kamungas.mb.a b/src/prelaunch/kamungas.mb.a index b654dbe27..99e970b70 100644 --- a/src/prelaunch/kamungas.mb.a +++ b/src/prelaunch/kamungas.mb.a @@ -1,5 +1,5 @@ ;license:MIT -;(c) 2021 by qkumba +;(c) 2021-2022 by qkumba !cpu 6502 !to "build/PRELAUNCH/KAMUNGAS.MB",plain @@ -30,22 +30,20 @@ + lda MockingboardStuff +READ_ROM_NO_WRITE - cmp #1 - bcc ++ + beq ++ tax + and #7 ora #$C0 sta mbslot+1 txa + ldy #$0e ; sound/speech asl - and #$80 - ora #2 ; sound i - bpl + - eor #$88 ; sound ii -+ - bcc + - ora #4 ; +speech -+ - sta mbtype+1 + bcs + + ldy #$0a ; sound ii + asl + bmi + + ldy #2 ; sound i ++ sty mbtype+1 lda #$4C sta $BD00 lda #