flat assembler
Message board for the users of flat assembler.

Index > Main > reserve or declare

Author
Thread Post new topic Reply to topic
zxcv
Guest




zxcv
some time ago, someone said me that 'rb' reserves already nullified byte, and 'db' no. But now im wondering how it can be not nullified. Compiler adds 00 to output file.
Post 22 Dec 2007, 08:07
Reply with quote
MichaelH



Joined: 03 May 2005
Posts: 402
MichaelH
times 256 db 'a'

or -

db 512 dup "b"

or as a last resort after every other avenue has been tried and failed -

read the fasm documentation Wink
Post 22 Dec 2007, 10:32
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17287
Location: In your JS exploiting you and your system
revolution
rb and db are mostly the same. rb will reserve bytes with a value of 0. But the main difference is when fasm writes the file, the reserved spaces at the end of each section are not written to disk, thus saving disk space.
Code:
...
rb 1 shl 20 ;reserve 1meg space
.end start    
Above code won't put 1meg of zeros on the disk. Compare to:
Code:
...
rb 1 shl 20 ;reserve 1meg space
db 0
.end start    
The difference here is that fasm must put that last byte on to disk so it will also put the 1meg of zeros before it onto the disk file.
Post 22 Dec 2007, 10:41
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-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.