Yesterday I got a PowerPak, and I'm testing my games today...
Sadly, I'm getting errant button presses from DMC music corruption.
This is the code I've been working with...(and is the sample code on my blog, btw...)
Code: Select all
_Get_Input:
lda _joypad1
sta _joypad1old
lda _joypad2
sta _joypad2old
ldx #$01 ;strobe controller 1
stx $4016
dex
stx $4016
ldy #$08
GetInput2: ;get first read, store them as a test
lda $4016
and #$03
cmp #$01
rol _joypad1test
lda $4017
and #$03
cmp #$01
rol _joypad2test
dey
bne GetInput2
ldx #$01 ;restrobe strobe controller 1
stx $4016
dex
stx $4016
ldy #$08
GetInput3: ;read again, store them as joypads
lda $4016
and #$03
cmp #$01
rol _joypad1
lda $4017
and #$03
cmp #$01
rol _joypad2
dey
bne GetInput3
CompareInput:
lda _joypad1
cmp _joypad1test
bne :+
lda _joypad2
cmp _joypad2test
bne :+
rts ;if same, done
: lda _joypad1
sta _joypad1test
lda _joypad2
sta _joypad2test
ldy #$08
jmp GetInput3 ;if different, reread
But, from blargg's sample code, (circuitously directed to from the wiki), he's reading the joypads 4 times, and I'm only reading 3 x. Could this be the source of the error?