flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > [solved] Fasm EQU

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 815
Roman
format PE GUI 4.0
entry Start
include 'c:\fasm\include\Win32a.inc'

section '.bss' readable writeable
zbuf rd 9000000

In code:

szQU = 256*256*4+54+2
mov esi,zbuf+szQU ;its ok



szQU EQU 256*256*4+54+2
mov esi,zbuf+szQU ;its wrong
Post 23 Jun 2020, 11:04
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17669
Location: In your JS exploiting you and your system
revolution
Works for me:
Code:
~ cat test.asm 
zbuf:
szQU1 = 256*256*4+54+2
szQU2 EQU 256*256*4+54+2
mov esi,zbuf+szQU1 ;its ok
mov esi,zbuf+szQU2 ;its wrong
~ fasm test.asm
flat assembler  version 1.73.08  (4029392 kilobytes memory)
1 passes, 12 bytes.
~ hd test.bin
00000000  66 be 38 00 04 00 66 be  38 00 04 00              |f.8...f.8...|
0000000c
~    
Post 23 Jun 2020, 11:38
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 815
Roman
try this:
szQU EQU 256*256*4+54+2
mov esi,zbuf
mov esi,zbuf+szQU

mov esi,zbuf+szQU*2
mov esi,zbuf+szQU*3
mov esi,zbuf+szQU*4
mov esi,zbuf+szQU*5
Post 23 Jun 2020, 11:52
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17669
Location: In your JS exploiting you and your system
revolution
Works as intended. EQU is a textual replacement.

It assembles as this:
Code:
mov esi,zbuf
mov esi,zbuf+256*256*4+54+2

mov esi,zbuf+256*256*4+54+2*2
mov esi,zbuf+256*256*4+54+2*3
mov esi,zbuf+256*256*4+54+2*4
mov esi,zbuf+256*256*4+54+2*5    
You can use brackets:
Code:
szQU EQU (256*256*4+54+2)    
Post 23 Jun 2020, 12:03
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 815
Roman
Thanks.
You opened my eyes, about EQU.
Post 23 Jun 2020, 14:34
View user's profile Send private message 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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.