home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / forth / 3622 < prev    next >
Encoding:
Text File  |  1992-12-14  |  2.6 KB  |  80 lines

  1. Newsgroups: comp.lang.forth
  2. Path: sparky!uunet!mcsun!inesc.inesc.pt!animal.inescn.pt!news
  3. From: paf@porto.inescn.pt (Paulo Alexandre Duarte Ferreira)
  4. Subject: Trouble with Fpc 3.55 memory allocation
  5. Message-ID: <1992Dec14.184524.12485@animal.inescn.pt>
  6. Keywords: FPC, Msdos
  7. Sender: news@animal.inescn.pt (USENET News System)
  8. Nntp-Posting-Host: test00.inescn.pt
  9. Reply-To: paf@porto.inescn.pt
  10. Organization: INESC-Porto, Portugal
  11. Date: Mon, 14 Dec 92 18:45:24 GMT
  12. Lines: 66
  13.  
  14.  
  15. In Fpc 3.35 i used the following code to grab 64 kbytes of memory,
  16. needed by an application ( 8051 assembler and disassembler ), but
  17. after correcting bugs :-( , and giving the application a decent 
  18. memory editor :-) the code to grab the memory has side-effects on
  19. Fpc 3.55 that don't exist on Fpc 3.35
  20.  
  21.  After executing this code on Fpc 3.55 OPEN only works with filenames, 
  22. ( no file selection tool ) and the editor doesn't work ( no memory ).
  23.  
  24. In Fpc 3.35 everything works fine.
  25.  
  26. Can somebody please correct my code ? 
  27. Should i release my code with the warning "Use only Fpc 3.35" ?
  28.  
  29. Thanks for any kind of answer. 
  30.  
  31. \ ----------------- start of code 
  32. decimal
  33.       
  34.    variable     8051-seg         \  pointer to the 8051 "fake memory"
  35.  
  36.        : get-memory            ( -- )
  37.  
  38.            defers initstuff
  39.            4096  alloc                     \ requests 64 kbytes of memory
  40.            0 = not
  41.            if
  42.                drop drop ." Not enough memory ! " cr
  43.                ."  Leaving Forth now !!! "       cr
  44.                ."  You cannot use the 8051 Disassembler " cr
  45.                bye
  46.            else
  47.                nip  8051-seg !
  48.            then  ;
  49.  
  50.  
  51.        ' get-memory is initstuff       \ insert get-memory in
  52.                                        \ the initialization chain
  53.  
  54.  
  55.        : rel-memory           ( -- )     \ release the memory
  56.            8051-seg @ dealloc
  57.            0 = not
  58.            if
  59.                 ." Memory release failed !"  cr
  60.                 ." You should reboot your PC !"
  61.            then  ;
  62.  
  63.    \ It is not necessary to reboot the PC, but is safer because your memory
  64.    \ is fragmented and/or corrupted and memory management does not
  65.    \ exist in MS-DOS machines ( in the real meaning of the word ).
  66.  
  67.  
  68.      : bye  rel-memory bye ;           ( -- )
  69.  
  70.          \  release the memory before we exit Forth
  71.  
  72. \ ------------- end of code 
  73.  
  74. --
  75. --------------------------------------------------------------------------
  76. Paulo Ferreira |  paf@porto.inescn.pt| INESC Porto Grupo CG&CAD
  77. --------------------------------------------------------------------------
  78. " ... a metafisica e' uma consequencia de estar mal disposto."
  79.                                                    Alvaro de Campos
  80.