ams-hackers / gbforth

👾 A Forth-based Game Boy development kit
https://gbforth.org
MIT License
128 stars 24 forks source link

Support ROM/RAM selection at compile-time #283

Closed tkers closed 6 years ago

tkers commented 6 years ago

As described in https://www.taygeta.com/forth/dpanse.htm#E.5, we should add the words RAM and ROM to select the memory that words should be referencing.

Compile-time:

Word Memory
, ROM
c, ROM
here ROM/RAM
unused ROM/RAM
allot ROM/RAM
align ROM/RAM
aligned ROM/RAM
create ROM/RAM
variable ROM/RAM

Run-time:

Word Memory
, RAM
c, RAM
here RAM
unused RAM
allot RAM
align RAM
aligned RAM
create unavailable
variable unavailable
davazp commented 6 years ago

Why , and c, shouldn't be available for RAM as well? An early limitation that we can improve later or something intrinsic?

tkers commented 6 years ago

The most basic support would mean that RAM is uninitialised. So just like ! and c!, emitting data would only be supported for ROM (the other words only reference/allocate space).

I created #284 to discuss the possibility of initialising RAM.

tkers commented 6 years ago

Implemented in f270e7e7637e351378cddcd36012703c1038b3c5

And updated to make VARIABLE possible in both locations: c9c53130bb76280fe70b245a033fbeacf13b31a7