It is currently Thu Dec 13, 2018 10:14 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Mon Oct 08, 2018 4:56 pm 
Offline

Joined: Mon Oct 08, 2018 4:47 pm
Posts: 2
Hello,

I'm developing a NES emulator, and I've been using nestest.nes to do so. I've hit a roadblock with one of the instructions. I'll post what I think are the relevant instructions from the Nintendulator nestest.nes log and will expose my problem after that:

Code:
// After this runs, $0200 will contain #$5A
CFC7  STA $0200 = 00                  A:5A X:55 Y:69 P:25 SP:FB
...
// After this runs, $5A will contain #$AA
D009  STA ($80,X) @ 80 = 0200 = 5A    A:AA X:00 Y:69 P:26 SP:FB
...
// After this runs, A will contain #$AA
D01C  LDA $0200 = AA                  A:AD X:00 Y:69 P:A4 SP:FB

My problem is that I don't see how the last opcode changes A to #$AA. According to that log, the location $200 contains #$5A instead, and there are no other instructions that I can see between $CFC7 and $D01C that modify $0200. #$AA is contained in $5A from what I see, not on $0200.

What am I missing?

Thanks in advance.


Top
 Profile  
 
PostPosted: Mon Oct 08, 2018 5:15 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 7821
Location: Seattle
arcnor wrote:
D009 STA ($80,X) @ 80 = 0200 = 5A A:AA X:00 Y:69 P:26 SP:FB
That means that:
$80+X is $80
The pointer in memory at $80 and $81 is $0200
The value at $0200 is $5A before the instruction runs
A is still stored to $0200 after.


Top
 Profile  
 
PostPosted: Mon Oct 08, 2018 10:28 pm 
Offline

Joined: Mon Oct 08, 2018 4:47 pm
Posts: 2
Ah, so I had one more indirect than needed, that makes sense now :)

Thanks!


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

All times are UTC - 7 hours


Who is online

Users browsing this forum: JRoatch and 3 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