flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > .data? |
Author |
|
LocoDelAssembly 01 Jun 2006, 13:55
This just 1536 bytes:
Code: include 'win32axp.inc' .data ; PUT HERE INITIALIZED DATA IF YOU WANT buffer db 100000 dup (?) ; DON'T PUT ANY INITIALIZED DATA HERE BECAUSE IT WILL FORCE INITIALIZATION TO ZER0 OF THE UNINITIALIZED DATA ABOVE .code start: ret .end start Check the comment to see how to avoid big files Regards |
|||
01 Jun 2006, 13:55 |
|
farrier 01 Jun 2006, 14:27
Postal,
Without using "macros" Code: section '.bss' readable writeable ;put uninitialized data here section '.data' data readable writeable ;put initialized data here section '.code' code readable executable ;put code here You can also use macros contained in the Fresh projects GlobalMem.inc file which allow you to specify multiple initialized and uninitialized data sections in a single or multiple files. The macros combine the multiple sections into one each initialized and uninitialized section for assembly. Use as follows: Code: include '\Program Files\fasm\include\GlobalMem.inc' iglobal _ClassName db 'QBBU', 0 _AppName db 'QBBU', 0 _MenuName db 'MainMenu', 0 endg uglobal gIst dd ? gWnd dd ? endg ... section '.data' data readable writeable IncludeAllGlobals The attached file show the use of GlobalMem.inc, uncomment the line in the iglobal section to see the difference in file size. hth, farrier
_________________ Some Assembly Required It's a good day to code! U.S.Constitution; Bill of Rights; Amendment 1: ... the right of the people peaceably to assemble, ... The code is dark, and full of errors! |
|||||||||||
01 Jun 2006, 14:27 |
|
Postal 01 Jun 2006, 14:47
Thanks!
Clearly! |
|||
01 Jun 2006, 14:47 |
|
LocoDelAssembly 01 Jun 2006, 14:53
farrier, using a section named '.bss' doesn't prevent defining initialized data, it's enough to put uninitialized data at the end of any section, the waste of space is when you interleave initialized data and uninitialized data.
this: Code: .data db 0 buffer db 100000 dup (?) will define a data section of very few bytes but this one: Code: .data buffer db 100000 dup (?) db 0 I think that using only one section is better since it saves the memory (and disk space) required to hold an extra section. However if you want your initialized data read-only then you need to define that section readable and the section for uninitialized data readable writable. Regards PS: Of course both codes takes the same amount of RAM memory, the difference is on the disk space requiered. |
|||
01 Jun 2006, 14:53 |
|
WiESi 01 Jun 2006, 16:54
What about using rb? For instance:
Code: buffer rb 100000 |
|||
01 Jun 2006, 16:54 |
|
LocoDelAssembly 01 Jun 2006, 17:19
That's works too in the same manner that dup does. If you don't want that reserved bytes to be written to disk then you must be sure that there is no more initialized data below that declaration.
|
|||
01 Jun 2006, 17:19 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.