home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.forth
- Path: sparky!uunet!mcsun!inesc.inesc.pt!animal.inescn.pt!news
- From: paf@porto.inescn.pt (Paulo Alexandre Duarte Ferreira)
- Subject: Trouble with Fpc 3.55 memory allocation
- Message-ID: <1992Dec14.184524.12485@animal.inescn.pt>
- Keywords: FPC, Msdos
- Sender: news@animal.inescn.pt (USENET News System)
- Nntp-Posting-Host: test00.inescn.pt
- Reply-To: paf@porto.inescn.pt
- Organization: INESC-Porto, Portugal
- Date: Mon, 14 Dec 92 18:45:24 GMT
- Lines: 66
-
-
- 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
- 8051-seg @ dealloc
- 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
-
- --
- --------------------------------------------------------------------------
- Paulo Ferreira | paf@porto.inescn.pt| INESC Porto Grupo CG&CAD
- --------------------------------------------------------------------------
- " ... a metafisica e' uma consequencia de estar mal disposto."
- Alvaro de Campos
-