flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Repeating macro

Author
Thread Post new topic Reply to topic
FlierMate1



Joined: 31 May 2022
Posts: 118
FlierMate1 18 Jun 2022, 04:15
How to convert #counter from numerical value to text `counter, then how to concatenate with label?

Code:
format PE GUI 4.0

include "win32a.inc"

rept 256 counter
{
call [dummy#counter]
}
call [dummy257]

data import

 library kernel,'KERNEL32.DLL'

 import kernel,\
       dumm257,'dummy257'

 rept 256 counter
 {
        dummy#counter,'dummy'+`counter,\
 }

end data          


Last second line is wrong:

Code:
        dummy#counter,'dummy'+`counter,\    


Illegal instruction: dummy1,'dummy'+'1',

I want something like dummy1, 'dummy1',\

How?
Post 18 Jun 2022, 04:15
View user's profile Send private message Reply with quote
FlierMate1



Joined: 31 May 2022
Posts: 118
FlierMate1 18 Jun 2022, 04:34
Can I use repeat maco in Import Table section?

I don't understand the error message "IF USED".


Description:
Filesize: 130.4 KB
Viewed: 3884 Time(s)

Screenshot 2022-06-18 123238.png


Post 18 Jun 2022, 04:34
View user's profile Send private message Reply with quote
FlierMate1



Joined: 31 May 2022
Posts: 118
FlierMate1 18 Jun 2022, 05:13
Using FASM g

Quote:
C:\fasmg>fasmg h.asm
flat assembler version g.jmhx
h.asm [1]:
format PE GUI 4.0
Processed: format PE GUI 4.0
Error: invalid argument.


Not sure what error is this. FASM 1 did not complain, but other error:

Quote:
C:\FASMW>fasm h.asm
flat assembler version 1.73.30 (1048576 kilobytes memory)
h.asm [3]:
include '\include\win32a.inc'
error: file not found.

(I add "\include\" or not, also same result, I have even set the environment path)
----FIXED---- should just add "include\win32a.inc", remove the slash from first character

Quote:
C:\FASMW>fasm h.asm
flat assembler version 1.73.30 (1048576 kilobytes memory)
h.asm [15]:
import kernel,\
include\macro/import32.inc [31] import [5]:
if used label
processed: if used
error: invalid expression.


This is the error.

Only if I compile right in FASM text editor, it gives the third error (as shown in picture).
Post 18 Jun 2022, 05:13
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20356
Location: In your JS exploiting you and your system
revolution 18 Jun 2022, 06:08
You need to wrap the import macro the other way around.
Code:
rept 256 counter {
        common
                args equ
        forward
                args equ args,dummy#counter,'dummy'#`counter
        common
                match =,a,args \{
                        import kernel,a,dumm257,'dummy257'
                \}
}    
Post 18 Jun 2022, 06:08
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 669
Location: Ukraine
Overclick 18 Jun 2022, 06:16
Easiest trick is:
Code:
rept 257 counter
  {
  library kernel#counter,'KERNEL32.DLL'
  import kernel#counter,\
       dummy#counter,'dummy'+`counter
  }
    
Post 18 Jun 2022, 06:16
View user's profile Send private message Visit poster's website Reply with quote
FlierMate1



Joined: 31 May 2022
Posts: 118
FlierMate1 18 Jun 2022, 06:37
Overclick wrote:
Easiest trick is:
Code:
rept 257 counter
  {
  library kernel#counter,'KERNEL32.DLL'
  import kernel#counter,\
       dummy#counter,'dummy'+`counter
  }
    


Not working, it says "Symbol already defined: import.data:"

I am trying revolution's suggestion instead.
Post 18 Jun 2022, 06:37
View user's profile Send private message Reply with quote
FlierMate1



Joined: 31 May 2022
Posts: 118
FlierMate1 18 Jun 2022, 06:48
revolution wrote:
You need to wrap the import macro the other way around.
Code:
rept 256 counter {
        common
                args equ
        forward
                args equ args,dummy#counter,'dummy'#`counter
        common
                match =,a,args \{
                        import kernel,a,dumm257,'dummy257'
                \}
}    


It works great, but the EXE size grows bigger than 1KB. Thanks.
Post 18 Jun 2022, 06:48
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20356
Location: In your JS exploiting you and your system
revolution 18 Jun 2022, 14:53
FlierMate1 wrote:
It works great, but the EXE size grows bigger than 1KB. Thanks.
Try it with "rept 90999999 counter {" and see how much the exe file size grows!
Post 18 Jun 2022, 14:53
View user's profile Send private message Visit poster's website Reply with quote
FlierMate1



Joined: 31 May 2022
Posts: 118
FlierMate1 18 Jun 2022, 22:40
revolution wrote:
FlierMate1 wrote:
It works great, but the EXE size grows bigger than 1KB. Thanks.
Try it with "rept 90999999 counter {" and see how much the exe file size grows!


Far from it, I cannot compile for any value larger than approximately 1850, or else I get "Out of memory" error. With 1850 repetition, the size of EXE is 48KB. Shocked
Post 18 Jun 2022, 22:40
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20356
Location: In your JS exploiting you and your system
revolution 19 Jun 2022, 04:41
Use the -m switch.
Post 19 Jun 2022, 04:41
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:  


< 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 © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.