From d358aad4d8bc0d4dad40f487dd2285449275efb0 Mon Sep 17 00:00:00 2001 From: Peter Ferrie Date: Sun, 26 Jul 2020 20:35:42 -0700 Subject: [PATCH] faster MB detection --- src/4cade.init.a | 5 +---- src/hw.mockingboard.a | 14 ++++++++------ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/4cade.init.a b/src/4cade.init.a index 12039648d..88476543a 100644 --- a/src/4cade.init.a +++ b/src/4cade.init.a @@ -190,11 +190,8 @@ +READ_ROM_WRITE_RAM2 jsr BuildVBLFunction - +READ_RAM2_WRITE_RAM2 + +DISABLE_ACCEL ; cycle counting in Mockingboard detection requires 1MHz - jsr DisableAccelerator ; cycle counting in Mockingboard detection requires 1MHz - - +READ_ROM_WRITE_RAM2 +LDADDR FoundMockingboardCallback jsr GetMockingboardStuff stx MockingboardStuff ; save mockingboard slot and type in LC RAM diff --git a/src/hw.mockingboard.a b/src/hw.mockingboard.a index 372314d6a..ac097a9c1 100644 --- a/src/hw.mockingboard.a +++ b/src/hw.mockingboard.a @@ -35,7 +35,7 @@ GetMockingboardStuff stx $81 ldy #$04 ; 6522 #1 $Cx04 jsr @timercheck - beq @foundI + bcc @foundI @nextSlot inx @@ -48,7 +48,7 @@ GetMockingboardStuff jsr @callback ldy #$84 ; 6522 #2 $Cx84 jsr @timercheck - beq @foundII + bcc @foundII ldy #$0c sty @mb_smc1 + 1 @@ -81,6 +81,7 @@ GetMockingboardStuff ; detect speech chip sei + +READ_RAM2_WRITE_RAM2 lda #<@mb_irq sta $3fe sta $fffe @@ -141,6 +142,7 @@ GetMockingboardStuff sta $fffe lda #>Ignore sta $ffff + +READ_ROM_NO_WRITE iny sty $80 @@ -160,10 +162,10 @@ GetMockingboardStuff sec lda ($80),y ; read 6522 timer low byte sbc ($80),y ; second time - cmp #5 ; looking for (-)8 cycles between reads - beq + - cmp #6 ; FastChip //e clock is different -+ rts + sec + sbc #5 ; looking for 5 cycles between reads + cmp #2 ; or 6 cycles with the FastChip //e + rts @mb_irq lda #2