Trouble with Fpc 3.55 memory allocation 
Author Message
 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



Sat, 03 Jun 1995 02:45:24 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Potential FPC 3.55 VIRUS, PLEASE READ if you have FPC 3.55

2. F-PC 3.55

3. How to change default screen colors in F-PC 3.55

4. F-PC 3.55

5. Memory allocation (was: Re: Herman wants dynamic allocation)

6. Accessing extended memory from FPC

7. Fast memory allocation & garbage collection

8. TeX, Pascal/VS, dynamic memory allocation, and so forth

9. Memory allocation on DOS 6.22 / TAWK 4.0

10. Help Needed with Memory pre allocation

11. Memory allocation in DOS gawk

12. Memory allocations in Smalltalk

 

 
Powered by phpBB® Forum Software