
Trouble with Fpc 3.55 memory allocation
In Fpc 3.35 i used the following code to grab 64 kbytes of memory,
needed by an application ( 8051 assembler and disassembler ), but
after correcting bugs :-( , and giving the application a decent
memory editor :-) the code to grab the memory has side-effects on
Fpc 3.55 that don't exist on Fpc 3.35
After executing this code on Fpc 3.55 OPEN only works with filenames,
( no file selection tool ) and the editor doesn't work ( no memory ).
In Fpc 3.35 everything works fine.
Can somebody please correct my code ?
Should i release my code with the warning "Use only Fpc 3.35" ?
Thanks for any kind of answer.
\ ----------------- start of code
decimal
variable 8051-seg \ pointer to the 8051 "fake memory"
: get-memory ( -- )
defers initstuff
4096 alloc \ requests 64 kbytes of memory
0 = not
if
drop drop ." Not enough memory ! " cr
." Leaving Forth now !!! " cr
." You cannot use the 8051 Disassembler " cr
bye
else
nip 8051-seg !
then ;
' get-memory is initstuff \ insert get-memory in
\ the initialization chain
: rel-memory ( -- ) \ release the memory
0 = not
if
." Memory release failed !" cr
." You should reboot your PC !"
then ;
\ It is not necessary to reboot the PC, but is safer because your memory
\ is fragmented and/or corrupted and memory management does not
\ exist in MS-DOS machines ( in the real meaning of the word ).
: bye rel-memory bye ; ( -- )
\ release the memory before we exit Forth
\ ------------- end of code
--
--------------------------------------------------------------------------
--------------------------------------------------------------------------
" ... a metafisica e' uma consequencia de estar mal disposto."
Alvaro de Campos