It is currently Sat Aug 18, 2018 12:03 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Sat Apr 14, 2018 3:18 am 
Offline
User avatar

Joined: Fri Mar 16, 2018 1:52 pm
Posts: 31
Location: Finland
I want to buffer different kinds of data in RAM ready for the NMI to update. I want to use the same subroutine to buffer all data and use variables to tell the subroutine where to buffer the data and how many bytes. So I need to store the address of the data table to RAM in order to read from it, but what addressing mode gets the actual address in ROM rather than what is stored at that location?


Top
 Profile  
 
PostPosted: Sat Apr 14, 2018 7:18 am 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10714
Location: Rio de Janeiro - Brazil
I don't know if this is what you're looking for, but to get the address of some data instead of the data itself, you can use lda #<Label and lda #>Label to get the low and high bytes of the address, respectively. NESASM, as usual, does it differently, using LOW() and HIGH() instead of < and > I think.

This is not an addressing mode though, since these ultimately become simple immediate loads for the 6502, this is just a feature that assemblers have that makes our job easier.

To use that address later, you can get those 2 bytes and create a pointer in Zero Page, and access the data using lda (Pointer), y ([] instead of () in NESASM, obviously).


Top
 Profile  
 
PostPosted: Sun Apr 15, 2018 1:07 am 
Offline
User avatar

Joined: Fri Mar 16, 2018 1:52 pm
Posts: 31
Location: Finland
That's exactly what I was looking for, 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: No registered users 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