I am writing a console app using the flat memory model. It is a Forth compiler, and I would like it to have access to at least 4 MB of memory.
Being a newbie, it is not clear what memory I have access to without needing to ask the system for more. So, how much of the computer's memory does that have access to out of the box, without needing to call something like HeapAlloc?
If I do something like this, then the resulting EXE is huge, so I am trying to stay away from that approach:
BYTE theMemory FourMB DUP (?)
Currently my app uses HeapAlloc, which works, but switching from unallocated to allocated memory requires an address converison, which I would prefer not to have to do.
What if I do this?
.stack 480000h ; 4 1/2 MB
That should make 4 1/2 MB available from the start without needing to allocate any, shouldn't it? And since the stack starts at the top and grows towards the bottom, then in theory, I should be able to use the almost 4 1/2 MB of memory from the bottom up to where the stack pointer is, right? And if i set EBP = (ESP - 4MB), then I suppose one could think of it as a HUGE local variable.
I realize this idea is probably unconventional ... but you as you guys are quickly learning, I am one of those people who likes to test the limits. So ... will it work?