home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / forth / 3988 < prev    next >
Encoding:
Text File  |  1993-01-25  |  3.5 KB  |  82 lines

  1. Newsgroups: comp.lang.forth
  2. Path: sparky!uunet!math.fu-berlin.de!informatik.tu-muenchen.de!pazsan
  3. From: pazsan@Informatik.TU-Muenchen.DE (Bernd Paysan)
  4. Subject: Re: Data types
  5. References:  <4273.UUL1.3#5129@willett.pgh.pa.us>
  6. Originator: pazsan@hphalle4f.informatik.tu-muenchen.de
  7. Sender: news@Informatik.TU-Muenchen.DE (USENET Newssystem)
  8. Organization: Technische Universitaet Muenchen, Germany
  9. Date: Mon, 25 Jan 1993 10:30:43 GMT
  10. Message-ID: <1993Jan25.103043.10843@Informatik.TU-Muenchen.DE>
  11. Lines: 69
  12.  
  13.  
  14. In article <4273.UUL1.3#5129@willett.pgh.pa.us>, ForthNet@willett.pgh.pa.us (ForthNet articles from GEnie) writes:
  15. [...]
  16. |>  Re Re ``Changes in dpANS-3'' (Bernd Paysan):
  17. |> 
  18. |>   ...
  19. |>  |> bp> 8. VALUE changed to take an initial argument from the stack
  20. |>  |> bp>    (like CONSTANT)
  21. |>   ...
  22. |>  |>                           the previous dpANS proposal was better
  23. |>  |>  with respect to ROMmability (IMHO).  I suppose now we'll have to
  24. |>  |>  put in code ( a chain? ) to initialize all VALUE's when the
  25. |>  |>  system boots from ROM.
  26. |> 
  27. |>  bp> Hm, I don't see were the problem is.
  28. |> 
  29. |>  Well, take "3 VALUE foo". When target compiling, the "3" is
  30. |>  stored in ROM. When the system ``boots'' from ROM, code will be
  31. |>  needed to copy the value 3 in the RAM location occupied by foo at
  32. |>  run-time. There will be no user code that does this explicitly,
  33. |>  as the standard suggests that VALUE is somewhat like CONSTANT in
  34. |>  this respect (this is what I fear, I hope to be wrong).
  35.  
  36. Your fear is right. VALUEs are patchable constants.
  37.  
  38. |>  bp> Every object in Unix, TOS or MS-DOS has (at least) three parts:
  39. |>  bp> The TEXT (initialized, but unchanged at runtime) which could
  40. |>  bp> stay in ROM, the DATA (initialized, but possibly modified at
  41. |>  bp> runtime), which is copied to RAM at boot time and the BLOCK
  42. |>  bp> STORAGE, (uninitialized or initialized to zero and modified
  43. |>  bp> while running) which is only allocated and erased at boot time.
  44. |> 
  45. |>  Somehow, I do not think it is a solution to simply burn all RAM
  46. |>  into ROM ( CREATE bar 128000 ALLOT ), although it has the kind of
  47. |>  elegant simplicity Forth is famous for. I hope I'm
  48. |>  misinterpreting your comment :-)
  49.  
  50. Simple ALLOTed stuff is uninitialized, so it will be BLOCK STORAGE. You
  51. don't have to copy uninitialized values into ROM, you only have to set up
  52. pointers and data space.
  53.  
  54. |>  bp> I prefer VARIABLES and CREATE structures to be initialized at
  55. |>  bp> target compile time.
  56. |> 
  57. |>  I do not know how a commercial target compiler will handle
  58. |>  "VARIABLE foo  3 foo !", but personally I would not expect (nor
  59. |>  demand) it to (have) work(ed) when the system is booted and runs.
  60.  
  61. Works well with bigFORTH. But the only romable version of bigFORTH,
  62. Ewald Rieger's port to his 68K VME board, copies everything (code and
  63. data) to RAM at boot time. He can, because he has 512 K RAM :-).
  64.  
  65. |>  In fact, it will not be very difficult to handle initialization
  66. |>  of VALUE's -- doing the same with CREATE structures poses real
  67. |>  problems. ( CREATE ape  33 , 0 ,  8 ape 2 CELLS + ! ).
  68.  
  69. As the target compiler builds an host-executable ape, that gives it's
  70. target address, this will work. The TC has to figure out, wether the
  71. DATA is initialized (as in your example), or not.
  72.  
  73. It seems you have to switch between DATA SEGMENT and BSS, like in any
  74. assembler. Words like INITIALIZED or UNINITIALIZED like RAM and ROM come
  75. in mind, but they are a bit too long to be useful. Perhaps IRAM for
  76. initialized RAM.
  77.  
  78. [.sig]
  79. -- 
  80. Bernd Paysan
  81. "Late answers are wrong answers!"
  82.