flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > how can I store values to another address space?

Author
Thread Post new topic Reply to topic
dead_body



Joined: 21 Sep 2005
Posts: 187
Location: Ukraine,Kharkov
dead_body 08 Apr 2006, 11:32
a simple example:
Code:
format PE GUI 4.0
include "C:\fasm\INCLUDE\WIN32AX.INC"

.data
my_data: 
   rb my_data_size

.code
EntryPoint:
...
b = 1
store byte b at my_data
...
.end EntryPoint    

and I want that data will be before code, and in code I will define data.
I calculate the size of defining data(my_data_size) and reserve it.
Then I must to store data there, but store works only in current address space.What I must to do?

P.S. I know how defines data in fasmlib, but I have section data before section code.
If I in some way I can say to compiler to assemble code section before data section it will be really good.
Post 08 Apr 2006, 11:32
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8359
Location: Kraków, Poland
Tomasz Grysztar 08 Apr 2006, 12:00
It's not possible.
Post 08 Apr 2006, 12:00
View user's profile Send private message Visit poster's website Reply with quote
dead_body



Joined: 21 Sep 2005
Posts: 187
Location: Ukraine,Kharkov
dead_body 08 Apr 2006, 12:38
so I can't define data to section '.data' from section 'code', if '.data' is before section '.code'?
Maybe it is time to add a new directive?
in masm there was macros to add data from code, but there it was possible, because there was linker and it overeating sections in one. I always use that macros, and I want that macros in fasm. Or maybe it can be done with standart techniques?
Post 08 Apr 2006, 12:38
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 10 Apr 2006, 19:56
extremely ugly unusable idea how to (probably) do it. Take it as joke.

Code:
Mydata db Mydata_value
...
virtual at 0
  Mydata db 123
  Mydata_value load byte from $-1
end virtual    


really, not usuable, just a way to forward-refence data value. not sure if it works
Post 10 Apr 2006, 19:56
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
daluca



Joined: 05 Nov 2005
Posts: 86
daluca 04 Aug 2006, 06:24
you can't reserve data of unknown size: my_data_size must be
a constant at assembly-time.
if you are going to calculate the size at run-time you can use the
VirtualAlloc windows function to reserve space and alocate data there
even code.
Post 04 Aug 2006, 06:24
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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.