LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-21-2008, 12:18 AM   #1
alekstorm
LQ Newbie
 
Registered: Mar 2008
Posts: 1

Rep: Reputation: 0
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
 
Old 03-22-2008, 03:02 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
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

Last edited by paulsm4; 03-22-2008 at 03:07 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
processing command args in bash slzckboy Programming 16 10-18-2017 03:12 AM
LXer: Embedded Linux as Dependable for Developers as RTOSes, says Embedded Market For LXer Syndicated Linux News 0 01-23-2008 11:40 AM
Passing args in an IOCTL neerajb Linux - Software 0 04-20-2006 05:51 AM
#defining a macro inside a macro? saravkrish Programming 1 05-24-2005 09:48 PM
free()'n args zer0python Programming 2 10-27-2003 05:07 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration