It is currently Fri Dec 15, 2017 4:49 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Fri Dec 14, 2012 6:19 am 
Offline
User avatar

Joined: Fri Dec 14, 2012 5:58 am
Posts: 5
Location: Australia
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


Top
 Profile  
 
PostPosted: Fri Dec 14, 2012 6:26 am 
Offline
User avatar

Joined: Mon Jan 03, 2005 10:36 am
Posts: 2983
Location: Tampere, Finland
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:
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: kkfos.aspekt.fi


Top
 Profile  
 
PostPosted: Fri Dec 14, 2012 6:35 am 
Offline
User avatar

Joined: Fri Dec 14, 2012 5:58 am
Posts: 5
Location: Australia
Thanks for your reply.

Please bear with me as I'm not understanding the code quoted.

If you're referring to:

Code:
CE04  A9 33     LDA #$33                        A:FF X:80 Y:01 P:A5 SP:80 CYC: 44 SL:258


Then, isn't that just loading the accumulator with literal 0x33. The next instruction:

Code:
CE06  48        PHA                             A:33 X:80 Y:01 P:25 SP:80 CYC: 50 SL:258


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.


Top
 Profile  
 
PostPosted: Fri Dec 14, 2012 6:50 am 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10164
Location: Rio de Janeiro - Brazil
alexwy wrote:
please point me where I'm missing it.

The stack is always at $0100-$01FF, the SP is just the low byte.


Top
 Profile  
 
PostPosted: Fri Dec 14, 2012 6:52 am 
Offline
User avatar

Joined: Fri Dec 14, 2012 5:58 am
Posts: 5
Location: Australia
Thank you, I didn't know that. :D


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group