5 ms·
MilliForth-6502: The smallest Forth real programming language for 6502
- cmrdporcupine 2y agoI bet they could get it even smaller for the 6809
- dwgumby 2y agoWas playing with a 6809 system not long ago and, yeah, FORTH maps really nicely to it. S reg = parameter stack, U reg = return stack, Y reg = interpreter pointer. Inner interpreter is a single two byte instruction (jmp ,y++). I'd always wanted to play with the 6809 and it really is a slick little 8 bit cpu.
- cmrdporcupine 2y agoit's easily the king of 8-bits, the best of the bunch the 6309 with its extensions... even more so
- danhite 2y agoI found a very nicely done text file documenting the 6309 extensions that I am attempting to link to here in case other readers are like me in admiring the 6809 architecture and are curious about what got tweaked ... https://www.6809.org.uk/dragon/6309.txt https://www.6809.org.uk/dragon/6309.txt
- microtherion 2y agoThat's how I did it in 1983 (but I think with the roles for S and U swapped). Note that what you're describing is directly threaded code; traditional FORTH uses indirect threaded code: http://www.complang.tuwien.ac.at/forth/threaded-code.html http://www.complang.tuwien.ac.at/forth/threaded-code.html
- dwgumby 2y agoYou're right, I forgot the indirection. Inner Interpreter instruction is actually: JMP [,y++]
- tdeck 2y agoThe excellent book Threaded Interpretive Languages recommends the Signetics 2650 and the RCA 1802 for writing FORTH like languages. I was surprised because the latter is slightly obscure and the former I had never even heard of.
- bxparks 2y agoI always get the impression that people spend more time writing Forth interpreters, rather than writing Forth programs to solve actual problems.
- anyfoo 2y agoIt’s a fun activity, and if you still solve “real problems” on a 6502, then it’s because you really want to anyway. That being said, Forth is great for “exploratory programming” of hardware. I rarely, but still sometimes bootstrap Forth for that reason.
- howerj 2y agoI know that's what I do! It's a fun exercise, and Forth is uniquely suited to writing Forth interpreters. Forth really only has a few areas where it excels and they are incredibly niche ones at that.
- kjs3 2y agoIt's a fantastic way to bring up new hardware at the bare metal layer and do nontrivial things. But unless you're Jeff Raskin or something, building out, say, a word processor or something of similar complexity is a bit more daunting.
- jancsika 2y agoHere's what I'm hearing: How would you design a Forth interpreter to encourage more people to solve actual problems with it? :)
- tdeck 2y agoThis might be a bit out of date since I haven't looked in a few years, but my sense is that the standard libraries and documentation are often lacking. A batteries included standard library for gForth that could conveniently do basic things like make an HTTP request, display a dialog, or play a sound, without having to awkwardly bind to C APIs, would be really nice.
- 2y ago
- vaxman 2y agooh hell yeah. makes me want to go grab a 6502 box from the gar-age. Do the rPi Pico 2W next!
- kjs3 2y agoNick checks out. Have you seen: https://wdc65xx.com/Single-Board-Computers https://wdc65xx.com/Single-Board-Computers
- vaxman 2y agoAt one point, I was living somewhere that had access to someone's C64 and I wrote a VT100 emulator in FORTH to access a remote VAX via 300bps modem into MeritNet. Then I wanted to do graphics on the VAX and remembered the GiGi (which ran BASIC with DEC Regus graphics if booted in standalone mode) and began creating my own escape-sequences to draw. This led to discovering the NAPLPS standard and then to building my own backend BBS using 900 (reverse bill) numbers for C64 dialup users. Years later I saw the PRODIGY service at a Sears store and smirked.
- bigpeopleareold 2y agoHeh - I was looking for examples of 6502 Forth. I did fine fig-forth, but this looks interesting too now. This always happens on hacker news - I have some interest, and I see it on the front page of Hacker News soon after.
- reaperducer 2y agoThere was a Forth IDE for the Commodore 64 by HES, if that's of any interest.
- anyfoo 2y agoThere were plenty, I have a small collection of them! Most of them, including HES’s “64 FORTH”, are heavily fig-forth based. The thing I really like about 64 FORTH is the SOURCE word, which shows you the source code (at least the portion of it that is forth) for each word, so when I mess with forth on the C64 I mostly use that one.
- mjevans 2y agoThis is what I miss about the Red Power mod for Minecraft. I wonder if GregTech would see the fun in adding some sort of CPU that wouldn't be the worst emulation stacked inside of hand written 'machine' op functions... Offhand, anyone know of any good (either long stable, or better, well maintained and likely to persist) CPU emulators for Java? Something that does 'web assembly' might fit the task if it's reasonable to transpile a fake binary format into real WASM. The first good search result I got was : https://github.com/dylibso/chicory https://github.com/dylibso/chicory : better than wasmer-java for this use case since it doesn't depend on native binaries. Relating this back to the topic. It would be interesting to have to, at least copy in someone else's if not, write your own Forth interpreter to help bootstrap computers.
- hasbot 2y agoI haven't seen or touched a 6502 based computer since 1986. Are people using those ancient computers or actually using new(er) ones? I see 6502 based kits are available as are some new SBCs.
- kev009 2y agoBoth. You can buy trainers with old chips like this, z80, CDP1802, 8080, 6509 etc. The main advantage of the new SBCs is simplicity vs anything more modern and easier to deal with than a retro computer. The advantage of a retro computer is it has some intrinsic value and probably a large body of contemporary software.
- kjs3 2y agoThey still manufacture 6502s (and some periph chips) and you can license the core IP for your FPGA/ASIC [1]. There are dev boards (I have a W65C02SXB and it's kinda nifty) [2]. You can buy them from Mouser. There's apparently still demand in the embedded space that justifies keeping them in production. [1] https://www.westerndesigncenter.com/ https://www.westerndesigncenter.com/ [2] https://wdc65xx.com/Single-Board-Computers https://wdc65xx.com/Single-Board-Computers
- homarp 2y agoolimex sells one too https://www.olimex.com/Products/Retro-Computers/Neo6502/open-source-hardware https://www.olimex.com/Products/Retro-Computers/Neo6502/open...
- wvenable 2y agoI build my own 6502 from Ben Eaters kit -- expanded it quite a bit now with more changes in progress.
- hasbot 2y agoWhy? Why not use a modern and more powerful chip like the ESP32?
- nurettin 2y agoThis is where it gets interesting. The comments are both hilarious and educational. https://github.com/agsb/milliForth-6502/blob/main/scrs/jonesforth.S https://github.com/agsb/milliForth-6502/blob/main/scrs/jones...
- K0balt 2y agoNot trying to be harsh, just a bit of snarky humour, but they should partner with the “6502 as a service” folks and offer obsolescence as a service. I did have some good times with my 6502, as well as a dalliance with Forth… but I don’t really miss it when I’m playing with my 10 cent 32 bit RiskV chips and marvelling at the beauty of their ISA. It brings to mind a Joe Cocker song.