Ok, that's what I suspected. And yes, I guess the "assemble once" solution is the best I can get then, thanks f0dder.
Posted on 2003-01-16 05:49:54 by dELTA
but why do you want to create such a big array?:confused:
Posted on 2003-01-16 05:56:13 by clippy
including data directly in the executable can sometimes be preferable to
resources, especially when you deal with data types that aren't handled
natively by windows.

(directly as opposed to external files or resource items)
Posted on 2003-01-16 06:15:24 by f0dder
dELTA,

The toy in MASM32 gives you data in this format,


; drv:\dir\name.ext 2026 bytes

db 91,38,80,114,111,106,101,99,116,93,13,10,67,111,109,112
db 105,108,101,32,38,82,101,115,111,117,114,99,101,32,70,105
db 108,101,44,100,58,92,77,65,83,77,51,50,92,66,73,78
db 92,66,114,101,115,46,98,97,116,32,34,123,98,125,34,13
db 10,38,65,115,115,101,109,98,108,101,32,65,83,77,32,102
db 105,108,101,44,100,58,92,77,65,83,77,51,50,92,66,73
db 78,92,65,115,115,109,98,108,46,98,97,116,32,34,123,98
db 125,34,13,10,45,13,10,38,76,105,110,107,32,79,66,74
db 32,70,105,108,101,44,100,58,92,77,65,83,77,51,50,92
db 66,73,78,92,76,110,107,46,98,97,116,32,34,123,98,125
db 34,13,10,65,115,115,101,109,98,108,101,32,38,38,32,76
db 105,110,107,44,100,58,92,77,65,83,77,51,50,92,66,73
db 78,92,66,117,105,108,100,46,98,97,116,32,34,123,98,125
db 34,13,10,38,66,117,105,108,100,32,65,108,108,44,100,58

etc ....

All you do is put a label at the beginning so you can get the start address and read the data as you require up to the length of the data.

You will need to jump over the data to a tail end label so you don't execute the data but thats no big deal to do.

Regards,

hutch@movsd.com
Posted on 2003-01-16 06:23:05 by hutch--
Why waste space for a JMP instruction when you can just place the START label after the data? And, since it's data, it ought to go into the .data section, and you won't even have this problem at all.
Posted on 2003-01-16 06:44:24 by f0dder
Due to the specifics of the minimal exe loader, I want all code and initialized data to be in a single segment, having full control of their positions so that they're not split up into different exe-sections when compiled/linked and such. Placing it in the code segment before the start label should work just fine though.
Posted on 2003-01-16 10:26:04 by dELTA
delta, go fasm for such a task. it's pretty flexible.
Posted on 2003-01-16 13:27:09 by f0dder
Yep, switching FASM or NASM seems to be the only alternative if I want to get around that first long compilation time in this case. Thanks for the info everyone anyway.
Posted on 2003-01-16 14:36:35 by dELTA
another thing i was able to do with fasm: have everything in one section
(also import data), *AND* have import data at start of the image instead
of at the end. couldn't figure out how to do that with masm.
Posted on 2003-01-16 14:40:16 by f0dder
Cool. :)
Posted on 2003-01-16 16:13:42 by dELTA
At least in fasm you can use:

big_array rb 500000

instead of:

big_array db 500000 dup (?)

This does not slow this down because the data will not be initialized when the exe initializes.

I'm sure masm or others allow something like this. Also, by using the rb method the array will not increase the exe size.
Posted on 2003-04-24 21:13:16 by msmith
nasm allows it too, resb/resw/resd . Masm doesn't, and is a bit stupid that way - I'd say that if you need arrays large enough that masm buildtime slows down, you ought to dynamically allocate the memory.
Posted on 2003-04-25 02:26:03 by f0dder