It is currently Sat Nov 18, 2017 10:04 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Mon Jun 12, 2017 5:43 pm 
Offline
User avatar

Joined: Sun Jun 11, 2017 5:39 pm
Posts: 39
I have a label that points to code

part1:
LDA $65

Let's pretend this instruction is at $BD65

Then, I have an array with High and Low adress.

High: BD CC
Low: 65 64

for example.

However, those address will need to be where code "part1" is for example.

Since position will change, I would need to do something like

High: part1. HighByte
Low: part1. LowByte

is it possible?


Top
 Profile  
 
PostPosted: Mon Jun 12, 2017 5:49 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5822
Location: Canada
Some popular assemblers use < and > as low and high byte operators:
Code:
low:
.byte <part1
.byte <part2
high:
.byte >part1
.byte >part2

I don't know what assembler you're using but if yours doesn't have those it probably has something equivalent.


Top
 Profile  
 
PostPosted: Mon Jun 12, 2017 8:59 pm 
Offline

Joined: Sun Mar 19, 2006 9:44 pm
Posts: 919
Location: Japan
If you know that there will be 128 elements or fewer in your array, it might save you typing time (whenever you add another address to the array) by doing this:
Code:
lda pointer      ; can be from 0..$7F
asl a
tax
lda labels,x
sta <zp_ptr
lda labels+1,x
sta <zp_ptr+1
.
.
.

labels: .word part1, part2, part3...

_________________
http://www.chrismcovell.com


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: Bing [Bot], Fiskbit 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