flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Whats the differnce between reserve data and normal data?

Author
Thread Post new topic Reply to topic
shism2



Joined: 14 Sep 2005
Posts: 248
shism2 05 Mar 2006, 22:06
Whats the difference between reserve data and normal data?

Ex :

rd 1 = reserve data

Ex :

dw ? normal data
Post 05 Mar 2006, 22:06
View user's profile Send private message Reply with quote
UCM



Joined: 25 Feb 2005
Posts: 285
Location: Canada
UCM 05 Mar 2006, 22:16
nothing, in your case.
DW stands for Define Word, RW stands for Reserve Words, but when you put a ? it indicated uninitialized data and is therefore identical.
both *can* have their contents initialized to zero, if there is initialized data after (such as dd 0 or any instruction).
Post 05 Mar 2006, 22:16
View user's profile Send private message Reply with quote
okasvi



Joined: 18 Aug 2005
Posts: 382
Location: Finland
okasvi 05 Mar 2006, 22:22
Quote:
The data reservation directive should be followed by only one numerical
expression, and this value defines how many cells of the specified size should
be reserved. All data definition directives also accept the ? value, which
means that this cell should not be initialized to any value and the effect
is the same as by using the data reservation directive.
The uninitialized
data may not be included in the output file
, so its values should be always
considered unknown


from fasm.pdf

_________________
When We Ride On Our Enemies
support reverse smileys |:


Last edited by okasvi on 06 Mar 2006, 12:56; edited 1 time in total
Post 05 Mar 2006, 22:22
View user's profile Send private message MSN Messenger Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 06 Mar 2006, 09:39
...but there will be a difference if you put:
Code:
rb 1048576
    

or
Code:
times 1048576 db ?
    

at the end of the file. In the first case your resulting file will be small, but with the latter code you can easily add 1MB to your resulting binary.
Post 06 Mar 2006, 09:39
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 06 Mar 2006, 12:08
The "rb 1048576" and "times 1048576 db ?", and "db 1048576 dup ?" have all exactly the same result. The only difference is that assembler processes the "rb" faster.
Post 06 Mar 2006, 12:08
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 06 Mar 2006, 15:52
isn't "times XXX db <something>" optimized exception?
Post 06 Mar 2006, 15:52
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 06 Mar 2006, 17:40
Maybe I got it wrong then but should they be different as DB defines each byte, but RB can reserve only that byte without explicitly doing any memory-store operations on it. RB only points to the memory, while DB *ALSO* defines each byte in that region. Correct me if I'm wrong!
Post 06 Mar 2006, 17:40
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 06 Mar 2006, 17:48
Madis: but defining byte with value "?" is same as reserving it
Post 06 Mar 2006, 17:48
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 06 Mar 2006, 19:41
"RB 1" == "DB ?"
They do exactly the same - reserve one byte as uninitialized data.
Post 06 Mar 2006, 19:41
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 06 Mar 2006, 20:01
Tomasz: isn't "times XXX db <something>" optimized exception?
Post 06 Mar 2006, 20:01
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 06 Mar 2006, 20:19
No, why did you think so?
Post 06 Mar 2006, 20:19
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 06 Mar 2006, 20:29
some times it was only way to define long initialized arrays, so it kind-of needed that. And i have some (probably false) flashbacks about you mentioning something like this optimization.
Post 06 Mar 2006, 20:29
View user's profile Send private message Visit poster's website AIM Address MSN Messenger 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.