It is currently Sat Feb 17, 2018 1:00 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: A fun little question
PostPosted: Thu Feb 15, 2018 9:39 am 
Offline

Joined: Tue Jul 01, 2014 4:02 pm
Posts: 270
So, something that would help speed up workflow immensely - is there any way to make some sort of declaration of script to include or file to incbin in a variable way?

I fully get that ASM is NOT a high level language. But I'm curious. It has functions like .include. Could the target of that .include be variable, somehow? Let's say I had moveScript1 and moveScript2. Is there any way to define which to include in a variable way? In know that a constant expects a numerical value, but something like that...(I know this isn't directly possible, but conceptually)

Code:

MOVE_SCRIPT = "scripts\MoveScript1.asm"  ;; sets a target

.include MOVE_SCRIPT  ;; this now does the same as
                                    ;; .include "scripts\MoveScript1.asm"



Again, I know this won't work and isn't directly possible the way it is written. Is there any way to achieve this basic idea? I realized how much simpler being able to expose choices like this from the tool would be for the end user of what we're working on! As it is, we have the tool write out actual ASM for these sorts of includes in line, but this would be a really cool shortcut!

Thoughts?


Top
 Profile  
 
PostPosted: Thu Feb 15, 2018 9:43 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19625
Location: NE Indiana, USA (NTSC)
Are you referring to 6502 assemblers in general or ca65 in particular? If ca65 in particular, look up .define macros in "ca65 Users Guide" and see if they help. If you want a tested example, I can provide one in several hours once I am at a PC with ca65 installed.


Top
 Profile  
 
PostPosted: Thu Feb 15, 2018 9:46 am 
Offline

Joined: Tue Jul 01, 2014 4:02 pm
Posts: 270
Hey dude - I was talking about in 6502 assemblers (using ASM6 at the moment). I don't know if it's directly possible there, but...definitely figured it was worth asking. It's something most people wouldn't have much use for, but it occurred it would be super beneficial for what we're trying to do. Curious if anyone has done anything like it. :-)


Top
 Profile  
 
PostPosted: Thu Feb 15, 2018 10:22 am 
Offline
User avatar

Joined: Thu Mar 31, 2016 11:15 am
Posts: 273
.define works in ca65 for this like tepples thought. In general ca65 is a lot more suited for this sort of thing.

I dunno about asm6. You could try
Code:
MACRO MOVESCRIPT
.include "scripts\MoveScript1.asm"
ENDM

and then use the macro instead of .include

Alternatively you could tack a preprocessor on but that's getting pretty silly.


Top
 Profile  
 
PostPosted: Thu Feb 15, 2018 10:23 am 
Offline
User avatar

Joined: Sun Sep 19, 2004 10:52 pm
Posts: 370
Location: UT
No need for a macro, use EQU in asm6.


Top
 Profile  
 
PostPosted: Thu Feb 15, 2018 10:31 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19625
Location: NE Indiana, USA (NTSC)
I've used preprocessors for a couple things, such as shuffling variable declarations for buffer overflow testing and converting NESASM source code to ca65 when packing multiple ROMs into one 32K bank for Action 53.


Top
 Profile  
 
PostPosted: Thu Feb 15, 2018 10:50 am 
Offline

Joined: Tue Jul 01, 2014 4:02 pm
Posts: 270
Loopy - neat! Not back at computer yet to test, but would i set that up as:

Code:

MYSCRIPT EQU "script.asm"



And then later, including MYSCRIPT would have the same result as .include "script.asm" ? Never used equ before so checking on syntax. Thanks!


Top
 Profile  
 
PostPosted: Thu Feb 15, 2018 11:03 am 
Offline
User avatar

Joined: Sun Sep 19, 2004 10:52 pm
Posts: 370
Location: UT
Yep, that's right.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 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