I'm having some trouble getting controller input to work with the Nestest rom. My controls appear to be working in other games. One of the problems I'm having here is related to the controller strobe. Most games write a 1, then a 0 as expected. But Nestest writes a 9, then an 8. Here is the output of my emulator at what I believe is this point:
1188904 - C5D0: STA 8D absolute 2006 0 A:0 X:0 Y:FE P:37 SP:F8 - stack: top ||<- 0,0,24,37,8f,c2,83,c0,
1188909 - C5D3: LDX A2 immediate C5D4 0 A:0 X:0 Y:FE P:37 SP:F8 - stack: top ||<- 0,0,24,37,8f,c2,83,c0,
1188912 - C5D5: STX 8E absolute 4016 0 A:0 X:9 Y:FE P:35 SP:F8 - stack: top ||<- 0,0,24,37,8f,c2,83,c0,
1188917 - C5D8: DEX CA implied - - A:0 X:9 Y:FE P:35 SP:F8 - stack: top ||<- 0,0,24,37,8f,c2,83,c0,
1188920 - C5D9: STX 8E absolute 4016 0 A:0 X:8 Y:FE P:35 SP:F8 - stack: top ||<- 0,0,24,37,8f,c2,83,c0,
1188925 - C5DC: LDA AD absolute 4016 0 A:0 X:8 Y:FE P:35 SP:F8 - stack: top ||<- 0,0,24,37,8f,c2,83,c0,
Note the red lines are the writes to 4016. I've checked with fcuex and it also writes a 9 then an 8.
How should the emulator handle this 9/8 strobe? As far as i've read on nesdev, bit 0 should be the only bit to strobe.
Thank you.
1188904 - C5D0: STA 8D absolute 2006 0 A:0 X:0 Y:FE P:37 SP:F8 - stack: top ||<- 0,0,24,37,8f,c2,83,c0,
1188909 - C5D3: LDX A2 immediate C5D4 0 A:0 X:0 Y:FE P:37 SP:F8 - stack: top ||<- 0,0,24,37,8f,c2,83,c0,
1188912 - C5D5: STX 8E absolute 4016 0 A:0 X:9 Y:FE P:35 SP:F8 - stack: top ||<- 0,0,24,37,8f,c2,83,c0,
1188917 - C5D8: DEX CA implied - - A:0 X:9 Y:FE P:35 SP:F8 - stack: top ||<- 0,0,24,37,8f,c2,83,c0,
1188920 - C5D9: STX 8E absolute 4016 0 A:0 X:8 Y:FE P:35 SP:F8 - stack: top ||<- 0,0,24,37,8f,c2,83,c0,
1188925 - C5DC: LDA AD absolute 4016 0 A:0 X:8 Y:FE P:35 SP:F8 - stack: top ||<- 0,0,24,37,8f,c2,83,c0,
Note the red lines are the writes to 4016. I've checked with fcuex and it also writes a 9 then an 8.
How should the emulator handle this 9/8 strobe? As far as i've read on nesdev, bit 0 should be the only bit to strobe.
Thank you.