flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > Checking for literals in macro arguments |
Author |
|
sid123 10 Oct 2015, 12:46
Hello,
I've a little problem trying to figure this out. Basically, I'm using fasm to generate some custom byte code, so here's my problem: I'm planning to have one, let's say, "move" instruction which takes in two arguments. Going by the name, it assigns the latter argument to the former, which can either be a register or a constant. The former is guaranteed be a register. So, I need to do something like this: Code: macro move dest, src { if src eq literal(r0) ;check if source is equal to "literal" r0 ; generate code on basis of that. ... } Is there any possible way I can achieve this? Regards, sid123 _________________ "Those who can make you believe in absurdities can make you commit atrocities" -- Voltaire https://github.com/Benderx2/R3X XD |
|||
10 Oct 2015, 12:46 |
|
Tomasz Grysztar 10 Oct 2015, 12:58
The "if src eq r0" construction should in fact be enough for this purpose, unless there is more to your problem than it appears to be.
But if you aim is to generate custom byte code, I also recommend to try out fasm g, which was designed as a next generation fasm engine with exactly this purpose in mind. In the official package you will find example implementations of various instructions sets in form of macros (including 8051, 8086, AVR, and JVM bytecode). |
|||
10 Oct 2015, 12:58 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.