Skip to content
Permalink
Browse files
SPC Player: Fix occasional memory transfer errors, relax IO code exec…
… timing
  • Loading branch information
mrehkopf committed Sep 27, 2016
1 parent fe1e85c commit 533599075be96d335908077de196603fb931bb7a
Showing with 8 additions and 8 deletions.
  1. +3 −2 snes/spc700.a65
  2. +5 −6 snes/spcplay.a65
@@ -105,14 +105,15 @@ spc_transfer: ; .org $0002
.byt $e4,$f7 ; mov a,$f7 ; tell S-CPU we're ready for more
.byt $cb,$f7 ; mov $f7,Y
.byt $d6,$c0,$02 ; mov3: mov !$02c0+y,a
.byt $00 ; nop ; give some time for S-CPU HDMA / WRAM refresh
.byt $dc ; dec y
.byt $10,-25 ; bpl quad
.byt $10,-26 ; bpl quad
; Increment MSBs of addresses
.byt $ab,$0a ; inc mov0+2
.byt $ab,$0f ; inc mov1+2
.byt $ab,$14 ; inc mov2+2
.byt $ab,$1b ; inc mov3+2
.byt $1d ; dec x
.byt $d0,-38 ; bne page
.byt $d0,-39 ; bne page
; Rerun loader
.byt $5f,$c0,$ff ; jmp $ffc0
@@ -239,7 +239,6 @@ spc700_load:
jsr upload_high_ram ; Upload 63.5K of SPC700 ram
jsr upload_low_ram ; Upload rest of ram
jsr restore_final ; Restore SPC700 state & start execution

lda #$81 ; VBlank NMI + Auto Joypad Read
sta $4200 ; enable V-BLANK NMI
cli
@@ -341,7 +340,7 @@ upload_high_ram:
lda @spc_transfer,x
jsr spc_upload_byte
inx
cpy #43 ; size of transfer routine
cpy #44 ; size of transfer routine
bne -

ldx #$023f ; prepare transfer address
@@ -660,10 +659,10 @@ exec_instr:
; isn't needed, as this avoids such tight timing
; requirements.

; phd ; 4
; pld ; 5
; phd ; 4
; pld ; 5
phd ; 4
pld ; 5
phd ; 4
pld ; 5

; Patch loop to skip first two bytes
lda #$fe ; 16

0 comments on commit 5335990

Please sign in to comment.