by linuxlizard · 11y ago · 0 comments
Here's the problem I'm trying to solve (still in the tinkering stage). I have an embedded processor with small on-board SRAM but huge external address space and a NAND flash. Can't add external RAM. http://www.atmel.com/tools/ATSAM4S-XPRO.aspx
Would like to be able to run more code than can fit in the SRAM. With C, I was looking at the old style overlays. https://en.wikipedia.org/wiki/Overlay_%28programming%29
Also want to be able to support downloadable code modules.
Was looking into a Tcl dialect http://wiki.tcl.tk/1363 but I keep thinking Forth would be perfect.
The new ANS hotness is the "MARKER" word, you just say "MARKER OVERLAY" and then you can just invoke OVERLAY later and it clears things out for you. See Elizabeth Rather's comment here: http://computer-programming-forum.com/22-forth/c67f31fe1e09b...
This could possibly be optimised in a subroutine threaded Forth so code within each "page" wouldn't have to verify loaded segments.
Implementing a dictionary insertion/optimization routine that packs related routines together to minimise swapping would be an interesting problem, and would probably most easily not be done live but ahead-of-time instead.
In short: Yes, Forth can support the paging you desire if implemented that way.