flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > Little problem with Variable.inc

Author
Thread Post new topic Reply to topic
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 17 Feb 2005, 09:36
The idea for variable.inc file is great in order to help those porting FASM.
There is only one problem, that initialized and initialized variables are defined in one file.
This prevents direct using of the file for ports that use some other placing of data. Particularly, Fresh uses "uglobal" and "iglobal" macroses for defining uninitialized and initialized data variables. So I can't simply use variables.inc this way:
Code:
uglobal
  include "variable.inc"
endg
    


The same will happen if for example someone want to use separate sections for initialized and uninitialized variables.

Possible solutions:
1. separate uninitialized and initialized variables in two different include files, thus allowing using it like this:
Code:
section '.data' data readable writeable
include 'ivariable.inc'

section '.udata' data readable writeable
include 'uvariable.inc'
    


2. As far as there is only one initialized variable (locals_counter) - it is possible to make it uninitialized and leave the initialization to the interface.

Regards
Post 17 Feb 2005, 09:36
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Alan Illeman



Joined: 12 Mar 2005
Posts: 4
Location: Toronto. Canada.
Alan Illeman 16 Mar 2005, 23:39
Why don't you change all the '?' in variable.inc to '0' thereby
initialising all the variables to zero?

I always initialise my variables.

Cheers,
Alan
Post 16 Mar 2005, 23:39
View user's profile Send private message Reply with quote
MCD



Joined: 21 Aug 2004
Posts: 602
Location: Germany
MCD 17 Mar 2005, 09:31
Alan Illeman wrote:
Why don't you change all the '?' in variable.inc to '0' thereby
initialising all the variables to zero?

I always initialise my variables.

Cheers,
Alan

He could do this, but this would require additional executable size.

Another solution I would suggest is to simply separate the "variables.inc" in an "iglobal" and an "uglobal" block (both in the same file) which will actually be placed into the executable in the main Fasm.asm or Fresh.asm file.

_________________
MCD - the inevitable return of the Mad Computer Doggy

-||__/
.|+-~
.|| ||
Post 17 Mar 2005, 09:31
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 17 Mar 2005, 10:26
Alan Illeman, actually Windows zeroes undefined variables. Sometimes, it is not very usefull to initialize the variables, because its value is not known at the design time, but have to be computed in run time.

Actually in the latest FASM 1.60, mentioned problem is solved, so... Smile

Regards.
Post 17 Mar 2005, 10:26
View user's profile Send private message Visit poster's website ICQ Number 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.