[HN Gopher] MilliForth-6502: The smallest Forth real programming...
___________________________________________________________________
MilliForth-6502: The smallest Forth real programming language for
6502
Author : rbanffy
Score : 94 points
Date : 2025-03-28 11:04 UTC (11 hours ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| cmrdporcupine wrote:
| I bet they could get it even smaller for the 6809
| dwgumby wrote:
| Was 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 wrote:
| it's easily the king of 8-bits, the best of the bunch
|
| the 6309 with its extensions... even more so
| danhite wrote:
| I 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
| microtherion wrote:
| That'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
| bxparks wrote:
| I always get the impression that people spend more time writing
| Forth interpreters, rather than writing Forth programs to solve
| actual problems.
| anyfoo wrote:
| It'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 wrote:
| I 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 wrote:
| It'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 wrote:
| Here's what I'm hearing:
|
| How would you design a Forth interpreter to encourage more
| people to solve actual problems with it? :)
| pjmlp wrote:
| We did write Forth to solve actual problems, but that was back
| in the 1980's, when computers used to have a Forth based BIOS,
| or solving engineering problems on a HP-48 (yes I know RPL
| isn't exactly Forth).
| vaxman wrote:
| oh hell yeah. makes me want to go grab a 6502 box from the gar-
| age. Do the rPi Pico 2W next!
| kjs3 wrote:
| Nick checks out.
|
| Have you seen: https://wdc65xx.com/Single-Board-Computers
| bigpeopleareold wrote:
| Heh - 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 wrote:
| There was a Forth IDE for the Commodore 64 by HES, if that's of
| any interest.
| anyfoo wrote:
| There 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 wrote:
| This 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 : 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 wrote:
| I 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 wrote:
| Both.
|
| 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 wrote:
| They 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/ [2]
| https://wdc65xx.com/Single-Board-Computers
| homarp wrote:
| olimex sells one too https://www.olimex.com/Products/Retro-
| Computers/Neo6502/open...
| wvenable wrote:
| I build my own 6502 from Ben Eaters kit -- expanded it quite a
| bit now with more changes in progress.
| hasbot wrote:
| Why? Why not use a modern and more powerful chip like the
| ESP32?
| anyfoo wrote:
| Is that a serious question? Because you can slap a 6502 on
| a breadboard, make your own busses with wires, and
| understand every single aspect of it, hardware and
| software.
|
| Ben Eater also had a video series about designing and
| making his own CPU from logic chips. He switched to 6502
| likely because progressing up the stack, it started to
| become too big.
| classichasclass wrote:
| Because you like and are more familiar with the 6502?
| That's why I would/do.
___________________________________________________________________
(page generated 2025-03-28 23:01 UTC)