flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > ? conditional preprocess |
Author |
|
Nikolay Petrov 17 Mar 2006, 18:05
Hi,
Is it possible to 'catch' 'eqtype 0.0' in conditional preprocess and how? thanks |
|||
17 Mar 2006, 18:05 |
|
Tomasz Grysztar 17 Mar 2006, 18:06
No, it's not possible. "0.0" is for preprocessor just the "word", like "some.label".
|
|||
17 Mar 2006, 18:06 |
|
Nikolay Petrov 17 Mar 2006, 20:20
Interesting...
with 'eqtype 0.0' i 'catch' float numbers and actuality me need this one. |
|||
17 Mar 2006, 20:20 |
|
Tomasz Grysztar 17 Mar 2006, 20:42
What is your purpose? Maybe you can move the "weight" of the processing into the assembler module?
|
|||
17 Mar 2006, 20:42 |
|
Tomasz Grysztar 17 Mar 2006, 23:04
For this purpose you don't really need to determine exactly whether it's float, I think, as any FLD of this kind
Code: fld 5.56
fld xyz can be treated the same way. It can look like this: Code: macro fld value { PROCESSED equ 0 match first rest,value \{ fld value PROCESSED equ 1\} match =0, PROCESSED \{ local ..float floats_list equ floats_list,..float,value fld qword [..float] \} } macro floats dummy,[label,value] { label dq value } macro floats_data { match list,floats_list \{ floats list \} } xx = 4.1 fld 2.0 fld dword [0] fld xx floats_data Note that this way it works also with the constant name. As for moving the "weight" of processing into assembler module, I did mean something like (this time "floats_data" has to be put before the instructions, just the opposite of the above): Code: macro floats_data { floats_data: times floats_count dq 0.0 floats_current = 0 } macro fld value { if value eqtype 1.0 if floats_count > floats_current ; we need to check this because in intermediate passes the floats data area may not have been properly allocated yet virtual at 0 dq value load float_value qword from 0 end virtual store qword float_value at floats_data+(floats_current)*8 end if fld qword [floats_data+(floats_current)*8] floats_current = floats_current+1 else fld value end if } macro .end { floats_count = floats_current } floats_data start: fld 3.14 fld dword [0] .end Note that preprocessor is used here only for macro "containers", everything inside is the assembler's scripting language. |
|||
17 Mar 2006, 23:04 |
|
Nikolay Petrov 18 Mar 2006, 11:59
I begun on similar of the second way, and i had a promblem. Now I see why. I will continue onto first way.
thanks again |
|||
18 Mar 2006, 11:59 |
|
Nikolay Petrov 19 Mar 2006, 18:02
I will continue the topic with my next 'problem'. It's a my pushd macro object. I haven't an idea how detect in conditional preprocess float constant, except method as win32ax.inc(using prefix like 'double'). is it an ideas to detect it, without use the prefix?
Second question is - what symbols or group from symbols - 'match' can't detected, except ';' ? thanks _________________ regards |
|||
19 Mar 2006, 18:02 |
|
Tomasz Grysztar 19 Mar 2006, 18:23
"double" is not a prefix for float, it is a prefix for 64-bit value. The floats can be 32-bit, 64-bit or 80-bit, for example when using OpenGL calls you, some of them require 32-bit floats, while other 64-bit. But when you've got, say, a 64-bit float, there's no really difference between it and 64-bit integer - they are both just a 64-bit value. So "double" will work with the 1.0 value, and it will also work with the 1234h or 'ABCDEDFG' (well, that's by the way what I see as the beauty of assembly language; every kind of data is just a sequence of bits and assembler doesn't hide it from you).
As for the symbol characters, they are listed in section 1.2.1 of manual. Any other character can either be a part of name symbol, or is a whitespace or comment. And there is also a backslash, which is treated specially depending whether it is on end of line, or not. When it is not at end of line, it takes whatever symbol follows it and composes with it into new one symbol. |
|||
19 Mar 2006, 18:23 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.