faster MB detection

This commit is contained in:
Peter Ferrie 2020-07-26 20:35:42 -07:00
parent 6149eac1e8
commit d358aad4d8
2 changed files with 9 additions and 10 deletions

View File

@ -190,11 +190,8 @@
+READ_ROM_WRITE_RAM2 +READ_ROM_WRITE_RAM2
jsr BuildVBLFunction 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 +LDADDR FoundMockingboardCallback
jsr GetMockingboardStuff jsr GetMockingboardStuff
stx MockingboardStuff ; save mockingboard slot and type in LC RAM stx MockingboardStuff ; save mockingboard slot and type in LC RAM

View File

@ -35,7 +35,7 @@ GetMockingboardStuff
stx $81 stx $81
ldy #$04 ; 6522 #1 $Cx04 ldy #$04 ; 6522 #1 $Cx04
jsr @timercheck jsr @timercheck
beq @foundI bcc @foundI
@nextSlot @nextSlot
inx inx
@ -48,7 +48,7 @@ GetMockingboardStuff
jsr @callback jsr @callback
ldy #$84 ; 6522 #2 $Cx84 ldy #$84 ; 6522 #2 $Cx84
jsr @timercheck jsr @timercheck
beq @foundII bcc @foundII
ldy #$0c ldy #$0c
sty @mb_smc1 + 1 sty @mb_smc1 + 1
@ -81,6 +81,7 @@ GetMockingboardStuff
; detect speech chip ; detect speech chip
sei sei
+READ_RAM2_WRITE_RAM2
lda #<@mb_irq lda #<@mb_irq
sta $3fe sta $3fe
sta $fffe sta $fffe
@ -141,6 +142,7 @@ GetMockingboardStuff
sta $fffe sta $fffe
lda #>Ignore lda #>Ignore
sta $ffff sta $ffff
+READ_ROM_NO_WRITE
iny iny
sty $80 sty $80
@ -160,10 +162,10 @@ GetMockingboardStuff
sec sec
lda ($80),y ; read 6522 timer low byte lda ($80),y ; read 6522 timer low byte
sbc ($80),y ; second time sbc ($80),y ; second time
cmp #5 ; looking for (-)8 cycles between reads sec
beq + sbc #5 ; looking for 5 cycles between reads
cmp #6 ; FastChip //e clock is different cmp #2 ; or 6 cycles with the FastChip //e
+ rts rts
@mb_irq @mb_irq
lda #2 lda #2