For initialised data we use db, dw, dq, dp,... Then rb, rw,... is to reserve space. What?s the difference then between initialised data and reserved data space?
And is it possible to reserve uninitialised data?
I have tryed:
fileName:   times 127 rb ?

and it gives a error:invalid argument
Posted on 2002-07-26 08:49:01 by slop
You have combined two different ways of declaring uninitialized data, the correct are:


fileName: times 127 db ?

or (recommended):


fileName rb 127

Uninitialized data declared at the end of section won't use the space of your program file, it will be only allocated in memory when loading the program.
Posted on 2002-07-26 11:05:00 by Tomasz Grysztar
Thank you,
I was sort of confusing what "rb" meant.
Now it?s completely clear.

"Uninitialized data declared at the end of section won't use the space of your program file, it will be only allocated in memory when loading the program."

If we decalre uninit. data at the beginning of sect it will use space then?
section '.data'

buffer rb 1024
gizmo dd 1234h
another_buffer rb 1024

section '.idata'....
Posted on 2002-07-26 11:30:09 by slop

If we decalre uninit. data at the beginning of sect it will use space then?

Yes, your '.data' section will be 1028 bytes long in file (but it will be aligned to 1536, because PE files for Win32 must have 512 bytes alignment), but it will become 2052 bytes in memory (will be aligned to 4096). First 1024 bytes in file will be filled with zeros.
Posted on 2002-07-26 12:15:04 by Tomasz Grysztar
Interesting, but weird, who aligns that then, the PE format itself, or Windows?

Btw, I?ve seen your beer example (yes, I also needed some space too ;) and it only takes 1K, and you achieve this by removing all sections, right?

(What?s your favourite beer, I?m inviting you to one next time we meet ;)
Posted on 2002-07-26 12:24:37 by slop
The beer example consists of one section, first 512 bytes contain the MZ stub and PE headers, second 512 bytes contain the single section.
Structure of PE format allows any alignment of file (you specify it in the header), but Win32 PE files must have it equal to 512 bytes, so fasm allows this alignment only (is the not-so-portable excutable format used somewhere else?).

Beer? I prefer Porter ;)
Posted on 2002-07-26 12:29:16 by Tomasz Grysztar
So, then, it would be possible to have one 512-bytes only PE?
(is the not-so-portable excutable format used somewhere else?).

I?m not too sure, haven?t tryed if Windows starts a prog with different PE-header.

Porter, nice one, it?s done ;)
Posted on 2002-07-26 12:36:02 by slop
Theoretically yes (by using the header data as a section data), but for example WinNT kernel doesn't want to run executables of size less than 1024 bytes.
Posted on 2002-07-26 12:39:26 by Tomasz Grysztar
Okay, you have guessed my intentions with the header data. But it?s not good if it won?t work in NT.

How about LE and NE, do you plan to implement them in the future?
Posted on 2002-07-26 12:41:56 by slop
Well, possibly you could create LE executables with fasm's COFF output and some external linker. The NE is the obsolete 16-bit and it would be hard to implement it with "flat" architecture of fasm.
Posted on 2002-07-26 12:45:43 by Tomasz Grysztar
Thanx again, this last question was just curiosity ;)
Posted on 2002-07-26 12:50:05 by slop
rb was really a good idea!
The syntax is short and explicit enough. :alright:.
Posted on 2002-07-26 15:10:05 by JCP