flat assembler
Message board for the users of flat assembler.

flat assembler > Macroinstructions > fasmg as preprocessor

Goto page Previous  1, 2, 3
Author
Thread Post new topic Reply to topic
emil



Joined: 16 Dec 2003
Posts: 75
Location: egypt
ok , i got it.
Post 22 Feb 2017, 17:22
View user's profile Send private message Reply with quote
emil



Joined: 16 Dec 2003
Posts: 75
Location: egypt
Hi all ,

may any one explain the next macro , i have tried to got it but .....
Code:
macro x86.parse_operand_value ns,op local buffer,is_name,auto_extrn define buffer op: while 1 match sym tail, buffer define buffer tail load is_name:1 from Name_XLAT:`sym and 0FFh if is_name if defined auto_extrn.sym & (auto_extrn.sym | ~ defined sym) extrn sym auto_extrn.sym := 1 else if ~ defined sym auto_extrn.sym := 0 end if end if else break end match end while x86.parse_operand_value ns,op end macro


So
1- what this line means
Code:
define buffer op:

2- what is the "sym" here and where it declared
Code:
match sym tail, buffer load is_name:1 from Name_XLAT:`sym and 0FFh

3- also if each lined commented so that i can got it.

excuse my newbee.

thanks for any help.
Post 24 Feb 2017, 10:02
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15866
Location: 162173 Ryugu
1 > "buffer" is defined as "op" with a colon (:) appended.

2 > match will define "sym" as the first symbol from "buffer", and "tail" as the all of the remaining symbols from "buffer"

3 > Not sure what you question is here?
Post 24 Feb 2017, 10:15
View user's profile Send private message Visit poster's website Reply with quote
emil



Joined: 16 Dec 2003
Posts: 75
Location: egypt
thanks you

may you kindly explain each line in the macro !!
Post 24 Feb 2017, 10:43
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6865
Location: Kraków, Poland
As I mentioned earlier, this macro is especially tricky. I'd suggest you first take some time to get accustomed with the simpler ones, including the operation of MATCH. You can start with reading the section on MATCH in the manual and then the increasingly complex examples in my introduction to fasmg.
Post 24 Feb 2017, 17:01
View user's profile Send private message Visit poster's website Reply with quote
emil



Joined: 16 Dec 2003
Posts: 75
Location: egypt
any way i have deleted my last two posts ,

thank you all for your help.
Post 26 Feb 2017, 05:51
View user's profile Send private message Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 157
Location: Russian Federation, Sochi
Quote:
Code:
... preprocess macro invoke name,args& iterate arg,args indx %%-%+1 push arg end iterate call [name] end macro invoke MessageBoxA,0,_message,_caption,0
The output looks like:
Code:
push 0 push _caption push _message push 0 call [MessageBoxA]


Is there any way to catch this lines in macro to output:
Code:
invoke MessageBoxA,0,_message,_caption,0 ;iterate arg,0,_message,_caption,0 ;this ;indx 4-1+1 ;and this push 0 ;end iterate ;and this ;indx 4-2+1 ;and this push _caption ;end iterate ;and this ... ; ...


I mean how to catch them not in time of macro definition but in time params go throw macro?

I tryed to play
Code:
macro preprocess local Preprocessor macro gate list& iterate instr, list macro Preprocessor.instr?! args& ;db `instr `args esc instr args end macro end iterate end macro gate end,macro,iterate,indx,irp,irpv,repeat,rept,while,break,if,else,match,rmatch,rawmatch,include,postpone,namespace,display macro make_interceptor instr struc (label) ? decl& instr `label,' ',`decl,13,10 end struc end macro make_interceptor db;display namespace Preprocessor postpone end namespace end postpone end macro preprocess;launch CMD line '"%SystemRoot%\system32\notepad.exe" "%OUTPUT%"' macro ?! args& line `args,args args end macro macro invoke name,args& iterate arg,args indx %%-%+1 push arg end iterate call [name] end macro invoke MessageBoxA,0,_message,_caption,0


and output
Code:
line '', line '', line '', line 'macro invoke name,args&',macro invoke name,args& line '', line 'invoke MessageBoxA,0,_message,_caption,0',invoke MessageBoxA,0,_message,_caption,0 line 'iterate arg,args',iterate arg,0,_message,_caption,0 line 'indx %%-%+1',indx 4-1+1 line 'push arg',push 0 push 0 line 'end iterate',end iterate line 'indx %%-%+1',indx 4-2+1 line 'push arg',push _caption push _caption line 'end iterate',end iterate line 'indx %%-%+1',indx 4-3+1 line 'push arg',push _message push _message line 'end iterate',end iterate line 'indx %%-%+1',indx 4-4+1 line 'push arg',push 0 push 0 line 'end iterate',end iterate line 'call [name]',call [MessageBoxA] call [MessageBoxA] line 'end macro',end macro line 'end namespace',end namespace line 'end postpone',end postpone


insted of word "line" I wished ";" and instead of blank lines skip them
Post 26 Jun 2017, 14:32
View user's profile Send private message Send e-mail Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6865
Location: Kraków, Poland
ProMiNick wrote:
I mean how to catch them not in time of macro definition but in time params go throw macro?
You'd need to modify the way in which macros are defined. Possible, but not easy.
Post 29 Jun 2017, 14:51
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2, 3

< Last Thread | Next Thread >

Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 2004-2018, Tomasz Grysztar.

Powered by rwasa.