LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   TASM macro args can't be embedded in identifiers (https://www.linuxquestions.org/questions/programming-9/tasm-macro-args-cant-be-embedded-in-identifiers-629591/)

alekstorm 03-21-2008 12:18 AM

TASM macro args can't be embedded in identifiers
 
I'm using TASM 3.2 (Telemark Assembler, *not* Borland Turbo Assembler) to assemble code for the z80. I can't find the syntax to embed a macro argument in an identifier, like I can in MASM, where I just surround the argument name with ampersands.

This is what I want to do (TASM code with MASM-style embedding):
Code:

#define macro1(arg) prefix_&arg&: \ ld a, 0
macro1(foo)
  jp prefix_foo ; test that label was created correctly

prefix_&arg& should become prefix_foo, but TASM barfs. I've searched all over, but can't find this documented for TASM. Has anybody else had to do this before?

Thanks in advance,
Alek

paulsm4 03-22-2008 03:02 PM

Hi -

I don't know anything about Z80 assembler ("Welcome to the 80's" ;-)) or the Telemark assembler...
... but (as you certainly know), the Telemark manual is on-line here:
http://home.comcast.net/~tasm/tasmman.htm

You appear to be asking for *two* things:

a) Assembler macros (with arguments)
<= Telemark clearly supports this

b) ANSI C style "token pasting" (C uses "##", you're using "&")
<= It doesn't look like Telemark supports this

PS:
The manual gives this example:
Quote:

#DEFINE VAR1_LO (VAR1 & 255)

This statement would cause all occurrences of the string 'VAR1_LO' in the source to be substituted with '(VAR1 & 255)'.

This is *not* "token pasting" - it's simple argument substitution


All times are GMT -5. The time now is 10:37 PM.