It is currently Mon Oct 20, 2014 5:49 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Wed Aug 04, 2010 10:44 pm 
Offline
Site Admin
User avatar
 Profile

Joined: Wed Dec 19, 2007 10:46 pm
Posts: 779
Newbie question #31020.

So, I can use this FOR syntax to do two-pass assembly:

Code:
FOR pass=0 TO 2 STEP 2
P%=&1900
[OPT pass
LDA &0
JMP later
LDA &1B
RTS
BRK
.later
LDY #0
RTS
]
NEXT

and pick up labels which are later in the routine.

Now, suppose I want to assemble a second, different routine at a different location in memory.

Code:
FOR pass=0 TO 2 STEP 2
P%=&2400
[OPT pass
LDA &0
JMP laterroutine2
LDA &1B
RTS
BRK
.laterroutine2
LDY #0
RTS
]
NEXT

Is there anyway of compiling the two together so that you can use labels in the first routine which are actually pointing to the second routine? e.g. in the above examples, so you could use the label .laterroutine2 in the first routine which is stored at &1900.

Or if that's not possible I assume the only option in this case would be to resort to manually recording .laterroutine2's memory location and storing that in a variable in routine 1?

Not urgent, but I'm curious as to the answer ...

Sam.


Top
 
PostPosted: Thu Aug 05, 2010 8:18 am 
Offline
User avatar
 Profile

Joined: Mon Jan 07, 2008 6:46 pm
Posts: 380
Location: Málaga, Spain
Code:
FOR pass=0 TO 2 STEP 2
P%=firstaddr
[OPT pass
....
]
P%=secondaddr
[OPT pass
....
]
NEXT

Simple as that! :)


Top
 
PostPosted: Thu Aug 05, 2010 9:19 am 
Offline
Site Admin
User avatar
 Profile

Joined: Wed Dec 19, 2007 10:46 pm
Posts: 779
ahh ... two sets of square brackets. That's the bit I was missing. Obvious when I look at it, now. :)

Thanks again, Rich!

Sam.


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 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:  
cron