flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
IceStudent
Interesting. It seems as macro function in the masm.
|
|||
![]() |
|
revolution
Perhaps the syntax can look better like this:
Code: FORMULA Date(day,month,year) = ... |
|||
![]() |
|
vid
already discussed - search for "inline macros" or something like that. It's design problem of FASM.
(But i still believe it could be added... it there's a will) |
|||
![]() |
|
cod3b453
@ daluca: Some of the things you mentioned can be accomplished by rewriting the actual function your using e.g.
Code: macro mov op1,op2,v1,v2,v3 { if op2 eq RGBVal mov op1,((v3 shl 16) + (v2 shl 8) + v1) else mov op1,op2 end if } struc RGB r,g,b { . dd ((b shl 16) + (g shl 8) + r) } use32 mov eax,RGBVal,128,128,128 mov eax,[Colour] Colour RGB 128,128,128 ![]() ![]() |
|||
![]() |
|
chris
I guess this could be done by extending the 'fix' directive, so that the replacement could take arguments, like
Date(day,month,year) fix ((year -1980) shl 9)+(month shl 5)+day but since 'fix' is introduced to adjust some language syntax, this might have some side effects. |
|||
![]() |
|
Madis731
But it which project would this be used? I think that all you described is needed only for debugging, but in real life you only use these kinds of strctures when inititalizing something. Well, actually, everything that makes use of macros does some kind of initialization
![]() Code: mov eax,128 shl 16+128 shl 8+128 instead of: Code: mov eax,RGB(128,128,128) isn't much of a trouble and is clearer. with RGB() you don't know which value goes to which byte and weather red is actually in the place of red :S |
|||
![]() |
|
Tomasz Grysztar
Such feature was requested and considered a few times in fasm's history, but I never decided to go into such direction, as I had a "slightly different vision" of macro processor that I made into fasm. See also http://board.flatassembler.net/topic.php?t=4795
|
|||
![]() |
|
Reverend
My solution:
Code: macro overload1 instr { macro instr op1 \{ match =RGB red green blue, op1 \\{ instr (red shl 16) or (green shl 8) or blue \\} \} } macro overload2 instr { macro instr op1, op2 \{ match =RGB red green blue, op2 \\{ instr op1, (red shl 16) or (green shl 8) or blue \\} \} } irps instruction, push { overload1 instruction } irps instruction, mov xor sub add { overload2 instruction } mov eax, RGB 192 192 192 xor ecx, RGB 255 255 0 sub edx, RGB 160 170 23 push dword RGB 1 1 1 |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.