In past I talked with some guys if it was possible and some said it was, while others that it wasn't. So now I hope any of you can give me the real answer on it.

Basicly I want a macro so you can write more source code lines in one line which will then expand to multiply lines again.

A example of this could be:

jmp skipthis; db 50 dup (0); skipthis:;

This would then be expanded to:

jmp skipthis
db 50 dup (0)

The main problem about it is that macros uses commas as seperator between inputs while instructions also use commas between operands.

Thanks in advance.
Posted on 2002-08-09 11:31:44 by CyberHeg
You could write a pre-parser for this, a macro (ask bitRAKE ;) ) or use SPASM (yuck)
Posted on 2002-08-09 12:19:24 by bazik
multins MACRO jmplbl:REQ, dbnum:REQ

jmp jmplbl
db dbnum(0)


multins a, 20
multins b, 50
Posted on 2002-08-09 12:34:46 by stryker

macro m cmdlist:rest
for cmd,<cmdlist>


m jmp skipthis, db 50 dup (0), skipthis:
m <add eax,eax>,mul edx,<sub eax,edx>
Posted on 2002-08-09 12:40:37 by Nexo
LOL stryker!

I think your football-head should read the original post again.

He wants something like

mov eax, 1: xor eax, eax: jmp yadda

So he dont need to write one instruction per line. (spaghetti code)
Posted on 2002-08-09 12:40:47 by bazik
Yes I agree that a preparser could be a valid solution for this. If I find no better way I think I'll do that since it doens't take that long to do.

As for the macro that stryker posted this wasn't what I had in mind. I was thinking about a macro for any kind of instructions not just jumps. Sorry for the confusion if I wasn't clear enough.

// CyberHeg
Posted on 2002-08-09 12:41:23 by CyberHeg

I don't see any advantage of it. Its much harder to debug a program if all instructions is in one line. Assembly is spaghetti code in the first place. Try Nexo's solution.
Posted on 2002-08-09 12:43:47 by stryker
Nexo is probably using another assembler.

Use this one for MASM
m macro cmdlist:VARARG

for cmd, <cmdlist>


m jmp skipthis, db 50 dup (0), skipthis:
m <<add eax,eax>, mul edx, <sub eax,edx>>
Posted on 2002-08-09 12:50:41 by stryker
Why VARARG better REST? With REST no necessity <> in second example.
Posted on 2002-08-09 12:56:32 by Nexo

The reason for using this even though it makes debugging harder is that it's part of some obfuscation code that I am writing so I just want to put together the "groups" of code that I have. This would save me some lines of code in the asm files which would make the code more clear to read in my case.

// CyberHeg
Posted on 2002-08-09 12:57:38 by CyberHeg
I think there isn't a REST directive in MASM. Is there?
Posted on 2002-08-09 12:58:51 by stryker
stryker. Yes, really, it is there not.

*edited bold tags*
Posted on 2002-08-09 13:28:28 by Nexo
Are you using MASM 7 from .NET? I'm using the version that is included on the MASM32 package. Maybe that's the reason why REST isn't working...
Posted on 2002-08-09 13:45:07 by stryker
I not using MASM. I reading MASM docs :)

name MACRO [[parameter [[:REQ | :=default | :VARARG]]]]...
ENDM [[value]]
Marks a macro block called name and establishes
parameter placeholders for arguments passed when the macro
is called. A macro function returns value to the calling statement.

But it is old (1994).
Posted on 2002-08-09 14:27:17 by Nexo
It's possible that GoAsm might provide an answer for you because it does not expect every instruction to be on a separate line (with some exceptions). Data declarations are expected to be on separate lines though.
Posted on 2002-08-23 11:46:51 by jorgon
Thanks for the tip Jeremy Gordon. I am actually impressed by your assembler and will look into it. The only real problem which will probably stop me from using it along with many other assemblers is that in future I want my code to work on linux too which will mostlikely force me to change from Masm which I use now to Nasm.

// CyberHeg
Posted on 2002-08-24 01:31:53 by CyberHeg

Thanks for your comments. In GoAsm's help file (appendix) you will see a technique used by V. Krishnakumar to convert the PE/COFF output of the assembler to an ELF32 object file, which can be used to make a Linux executable. I don't know whether anything more needs to be added to the assembler to make it Linux compatible since I don't use Linux, but I would be willing to consider add-ons if the on-line assembler community would be interested.
Posted on 2002-08-24 02:22:30 by jorgon