flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Mutable code. Problem with size.

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1709
Roman 11 Jun 2024, 08:27
Fasmw 1.73
Code:
Virtual at 0
Code1:: inc dword [.data]
.data dd 0,1,2,3


Code2:: add dword [.data],2
.data dd 0,1,2,3

Code3:: sub dword [.data],4
.data dd 0,1,2,3
end virtual  

;in code
muk = Code1.data-Code1 ;fasm get error ! Invalid use of symbol.
        repeat  muk
                 load dc byte from Code1:%-1
                 db dc
                 end repeat 
    
Post 11 Jun 2024, 08:27
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20176
Location: In your JS exploiting you and your system
revolution 11 Jun 2024, 09:39
Code1 and Code2 and Code3 are all the same value.

You need to define offsets separately.
Code:
Virtual at 0
Code::  ; <--- only one label needed for load/store

;define a base label for the offsets
my_stuff:
.code1: inc dword [.data1]
.data1 dd 0,1,2,3

.code2: add dword [.data2],2
.data2 dd 0,1,2,3
end virtual
;...
muk = my_stuff.data1 - my_stuff.code1    
Post 11 Jun 2024, 09:39
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.