I have been developing a NES-flavoured 6502 emulator.
For testing, I've been using the nestest.nes program and comparing it to sample output.
This has been working fine (I programatically check the state every instruction and compare it to the sample output) up until the 862th instruction, where the PC is at 0xCE1E. The problem is, when pulling the accumulator from memory address 0x180, I always get 0xFF (which I set most of the memory to at the beginning). The value I'm expecting is 0x33 as per the sample output (the previous value of A too).
At first, I thought it must have been because I hadn't implemented memory mirroring (because I found 0x80 to be set to 0x33). So I set up my memory writes to also write to the specified offsets. This unfortunately did not solve my problem.
So I'm wondering, in the instructions from 0xC000 - 0xCE1E, where is 0x180 set to 0x33? I have spent days trying to find this out.
Obviously, I'm quite new to emulation.
Can anyone help me out? Thanks
Where is 0x180 set to 33 on nestest.nes?
Moderator: Moderators
Re: Where is 0x180 set to 33 on nestest.nes?
alexwy wrote:So I'm wondering, in the instructions from 0xC000 - 0xCE1E, where is 0x180 set to 0x33? I have spent days trying to find this out.
Code: Select all
CE01 A2 80 LDX #$80 A:FF X:FB Y:01 P:A5 SP:FB CYC: 32 SL:258
CE03 9A TXS A:FF X:80 Y:01 P:A5 SP:FB CYC: 38 SL:258
CE04 A9 33 LDA #$33 A:FF X:80 Y:01 P:A5 SP:80 CYC: 44 SL:258
CE06 48 PHA A:33 X:80 Y:01 P:25 SP:80 CYC: 50 SL:258
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
Re: Where is 0x180 set to 33 on nestest.nes?
Thanks for your reply.
Please bear with me as I'm not understanding the code quoted.
If you're referring to:
Then, isn't that just loading the accumulator with literal 0x33. The next instruction:
Then pushes that accumulator value (0x33) onto the stack at location 0x80 right?
So, if it's placed the value at 0x80, it means I can't be read it at 0x180 (at least, to my understanding).
I'm sure I'm missing something. so please point me where I'm missing it.
Thanks again.
Please bear with me as I'm not understanding the code quoted.
If you're referring to:
Code: Select all
CE04 A9 33 LDA #$33 A:FF X:80 Y:01 P:A5 SP:80 CYC: 44 SL:258
Code: Select all
CE06 48 PHA A:33 X:80 Y:01 P:25 SP:80 CYC: 50 SL:258
So, if it's placed the value at 0x80, it means I can't be read it at 0x180 (at least, to my understanding).
I'm sure I'm missing something. so please point me where I'm missing it.
Thanks again.
Re: Where is 0x180 set to 33 on nestest.nes?
The stack is always at $0100-$01FF, the SP is just the low byte.alexwy wrote:please point me where I'm missing it.
Re: Where is 0x180 set to 33 on nestest.nes?
Thank you, I didn't know that. 
