Re: NASM preprocessor
- From: "Rod Pemberton" <do_not_have@xxxxxxxxxxxxx>
- Date: Sun, 24 Aug 2008 02:10:31 -0400
"Chuck Crayne" <ccrayne@xxxxxxxxxx> wrote in message
news:20080822150202.07be82c3@xxxxxxxxxxxxxxxxxx
On Fri, 22 Aug 2008 23:34:36 +0200
Herbert Kleebauer <klee@xxxxxxxxx> wrote:
Sadly the NASM macro system isn't powerful
enough to really "make" it a logical syntax.
There has been some discussion among the NASM developers about adding a
more powerful macro system. What features would you like to see?
One of the things I like is that the basic syntax of NASM's preprocessor
"mirrors" C's preprocessor syntax. So, if you don't adopt m4, which I have
no comment on, please keep the C style syntax.
%+1 allows you to add a condition code to an instruction, but %ifidn and
%elifidn only allow comparison with a single value. So, if you'd like a
body of code to be compiled only for condition codes be, ae, a, b, but not
others:
%ifidn %1,be
set%+1 al
%elifidn %1,ae
set%+1 al
%elifidn %1,a
set%+1 al
%elifidn %1,b
set%+1 al
%else
; other
E.g., I'd like a "%ifidn" that allowed multiple values to be passed to the
same section:
%ifidn %1, be, ae, a, b
; if the condition code in %1 is be, ae, a, or b, then do
set%+1 al
%else
; other
I haven't spent much time trying to figure out a way to convert an
indentifier from one register, say %2 is "eax" to say "al", except by %ifidn
and %elifidn... This effects instructions like setcc, movzx, movsx.
Instead of using %ifidn and %elifidn, it'd be nice if there was a function
to return the low 8-bit register al from 32-bit register eax or 16-bit
register ax, etc. E.g., you may have a condition code in %1, and a 32-bit
register in %2, say eax from a register allocator, but you need %2 to be al:
set%+1 %2 ; problem if not 8-bit... How to generate 8-bit from 16-bit or
32-bit easily without %ifidn and %elifidn for each register?
Or, maybe there just needs to be an example of how to do things like
this...?
I recall that there was a severe lack of ways to do string processing (which
HK mentioned also...) on identifier parameters.
I've also noticed heavy use of "%ifidn %elifidn %elifidn %elifidn ...
%else" which implies need of a "%switch" or "%case" or set of values for
"%ifidn" as suggested above...
Previously, I posted some other things I thought were weak:
Things I'd recommend are:used to build instructions. E.g., to convert a condition code to numbers,
1) improve %substr to take a start and length
2) change %substr to work on identifier's, numbers, and strings
3) change %substr so it works in macro's or with concatenation %+
(i.e., don't assign to a variable)
4) add string functions:
a) C's strchr,strstr,strcpy (actually, I'd recommend strrchr...)
b) BASIC's left$,mid$,right$ and concatentation.
5) adding operators or unshrouding internal compiler logic for functions
logic to encode address modes, etc.
http://sourceforge.net/forum/message.php?msg_id=4335052
Rod Pemberton
.
- References:
- NASM 0.98.39 vs. NASM 2.03.01 disassembly
- From: Rod Pemberton
- Re: NASM 0.98.39 vs. NASM 2.03.01 disassembly
- From: Frank Kotler
- Re: NASM 0.98.39 vs. NASM 2.03.01 disassembly
- From: Rod Pemberton
- Re: NASM 0.98.39 vs. NASM 2.03.01 disassembly
- From: Frank Kotler
- Re: NASM 0.98.39 vs. NASM 2.03.01 disassembly
- From: Rod Pemberton
- Re: NASM 0.98.39 vs. NASM 2.03.01 disassembly
- From: Frank Kotler
- Re: NASM 0.98.39 vs. NASM 2.03.01 disassembly
- From: Rod Pemberton
- Re: NASM 0.98.39 vs. NASM 2.03.01 disassembly
- From: Frank Kotler
- Re: NASM 0.98.39 vs. NASM 2.03.01 disassembly
- From: Rod Pemberton
- Re: NASM 0.98.39 vs. NASM 2.03.01 disassembly
- From: Frank Kotler
- Re: NASM 0.98.39 vs. NASM 2.03.01 disassembly
- From: Rod Pemberton
- Re: NASM 0.98.39 vs. NASM 2.03.01 disassembly
- From: Frank Kotler
- Re: NASM 0.98.39 vs. NASM 2.03.01 disassembly
- From: Rod Pemberton
- Re: NASM 0.98.39 vs. NASM 2.03.01 disassembly
- From: Herbert Kleebauer
- Re: Windela
- From: Rod Pemberton
- Re: NASM 0.98.39 vs. NASM 2.03.01 disassembly
- From: Herbert Kleebauer
- Re: NASM 0.98.39 vs. NASM 2.03.01 disassembly
- From: Chuck Crayne
- NASM 0.98.39 vs. NASM 2.03.01 disassembly
- Prev by Date: Re: NASM 0.98.39 vs. NASM 2.03.01 disassembly
- Next by Date: Re: announce: crudcom2 (the crude decompiler) now available, with full GPL'd source code
- Previous by thread: Re: NASM 0.98.39 vs. NASM 2.03.01 disassembly
- Next by thread: Re: Intel illogical syntax...
- Index(es):
Relevant Pages
|