Jonesforth: Implementing Forth in Assembly
github.com
github.com
[1] https://www.bradrodriguez.com/papers/
[2] http://www.ioccc.org/1992/buzzard.2.design
[3] https://archive.org/details/R.G.LoeligerThreadedInterpretive...
What are you asking me for??? I don’t know!!!
I recently tried porting Jonesforth to UEFI[2], so I could run it directly on my hardware without needing an operating system. I was actually surprised by how easy it turned out to be.
Okay, admittedly I ended up rushing a bit towards the end, and the final result is very bare-bones - it can do "Hello, World!", Fibonacci numbers, and then that's pretty much it. Still, it was a lot of fun, and I would totally recommend a project like this, especially if you don't usually work with "low-level" development.
I also ended up writing a blog post[3] to help people get started writing assembly for UEFI. The best resource is probably the OS Dev wiki, though. It has a ton of great resources.
[1]: https://github.com/nornagon/jonesforth
[2]: https://github.com/c2d7fa/jonasforth
[1] "threaded" has nothing to do with multithreaded: https://en.wikipedia.org/wiki/Threaded_code
https://stackoverflow.com/questions/5127833/meaningful-cost-...
"But in general, on modern processors, there is minimal cost for an unconditional jump. It's basically pretty much free apart from a very small amount of instruction cache overhead. It will probably get executed in parallel with neighbouring instructions so might not even cost you a clock cycle. "
Interesting statement. It led me to this paper:
Branch Prediction and the Performance of Interpreters - Don’t Trust Folklore (2015)
https://hal.inria.fr/hal-01100647/document (pdf)
"..Many studies go back to when branch predictors were not very aggressive. Folklore has retained that a highly mispredicted indirect jump is one of the main reasons for the inefficiency of switch-based interpreters."
"The accuracy of branch prediction on interpreters has been dramatically improved over the three last Intel processor generations. This..has reached a level where it cannot be considered as an obstacle for performance anymore."
Personally, I stopped worrying and used the most convenient implementation for my use case (portable interpreter written in C). Your set of primitives and how you code your Forth programs usually have a much larger improvement potential.
Is this statement for indirect threaded Forths only? What about direct threaded, token threaded and sub-routine threaded Forths?
If I may hijack this conversation: I'll be trying T3X [0] next, and know about the usual suspects B, BCPL and MCPL. They seem fun but not as malleable as Forth. Can HN recommend other (don't care if obscure) typeless programming languages?
On a side note - anyone know if greenarrays is still delivering hw? Those multicore forth chips really seemed nice (and crazy).
I ended up with iForth which is well priced, targets 64bit and has a simple license. Here's a feature list http://users.bart.nl/users/mhx/i4faq.html
SwiftForth and VFX are awesome as well but 32bit only and can't justify paying that much at this point.
I guess the situation is simalar for other closed compilers (Intel c, high perf Java compiler/VMs etc).
The only small caveat is that it's basically $500 for a PCB with two chips on it. (And a prototyping area, SRAM, an Ethernet PHY, SD, and USB...)
I'll probably continue to remain curious for some time, heh.
jonesforth.S:1154:10: fatal error: 'asm/unistd.h' file not found".
Here is the solution: https://stackoverflow.com/a/53686051/198927In case this is not legally possible, I grant any entity the right to use this work for any purpose, without any conditions, unless such conditions are required by law."
I wonder if that is good enough. I'm temped to use that for my extremely permissive stuff.
I still like the JonesForth version of a public domain release.
> CC0 helps solve this problem by giving creators a way to waive all their copyright and related rights in their works to the fullest extent allowed by law
https://creativecommons.org/share-your-work/public-domain/cc...
https://github.com/nornagon/jonesforth/blob/master/jonesfort...