Forth System-On-Chip Takes Us Back To The 80s

For anyone who has dealt with the programming language Forth, odds are good that you picked it up back in the 80s. Since the language is still in use for many applications, though, you might not have this sort of nostalgic feeling for the language that some might have. For that, though, you might want to try out [Richard]’s implementation which simulates the microcomputers of the 80s using this unique language.

The system has an FPGA-based CPU written in Verilog. It runs on a Nexys-3 board and features PS/2 Keyboard input, a VGA output with a VHDL VT100 terminal emulation module, access to the Flash and onboard SRAM, and a UART. With all of that put together it’s virtually a Forth-based time machine. It’s also extremely well documented even if you’re just curious how it works and aren’t planning on building your own.

The project also includes a CPU simulator written in C which can model the entire computer if you don’t have the hardware for building the actual computer. [Richard] also released everything that you’d need to roll out your own Forth computer on the GitHub page. There are other ways of heading way back to the 1980s, though, like using the quirky Parralax Propeller.

66 thoughts on “Forth System-On-Chip Takes Us Back To The 80s

  1. Forth is pretty neat! Well worth a play with if you have not tried it yet.
    It brings back some memories…
    I have a couple of tubes of the RTX2000 Forth Engine chips left over from a real time imaging system we made in 1994.
    This chip had the horsepower to sort a number of pieces of fruit per second for the local cannery I was involved with.
    Not bad for a 20Mhz processor! The board had a hardware video grabber, a histogramer chip for the sorting, dual ported VRAM for video out and talked to another board with a Mitsubishi “6502”, again running Forth, that took care of the belt kickers that tossed the fruit off into the correct lines.
    We did quite a few industrial product that ran the Forth language.
    The first boards were on a 6511AQ chip. Then the Mitsubishi chip that I have forgotten the type number of, and finally the RTX2000.
    One day I must figure out what to do with those RTX2000 chips. They did cost quite a lot originally.

        1. Thanx. :-) Its just that the phrase [Mitsubishi “6502”] seemed so wrong when”Motorola 6502″ is so right, but not in this context. :-) You know this stuff better than I do. Thanks for sharing. :-) Where would we be without wikipedia.

          1. The 6502 was originally from MOS Technology, not Motorola. The 6800 was from Motorola. There were various second sources for the 6502 and later the 65c02 and 65816 which were designed by Bill Mensch, owner of Western Design Center (WDC). Mot was never a second source though, since it was a competitor.

      1. M37450S4FP was the chip we used; apparently it was used in about half the VCRs in the universe circa 1990.
        It had some nice instruction set extensions and was CMOS so substantially lower powered than the NMOS Rockwell 6511AQ.

      1. I like “Thinking FORTH”, but my copy is signed by Chuck so I might be biased ;-)
        (I’d recommend anyone interested in learning read both. Want understanding? Definitely the latter)

        1. Same author, but different purpose. Starting Forth is for beginners, whereas Thinking Forth is more about programming philosophy, and much of it could be applied to other languages as well, although it shows how well it works in Forth.

  2. I used to play with Forth a long time ago, in the early 80’s. I also played around with an interesting variant called STOIC which had some interesting improvements and additions such as better support for underlying OS operations. This looks like it might be fun to play with and bring back some good memories.

    1. @svofski — “Not z80 rubbish”.

      Why would you say such a thing? The z80 fully supported the entire 8080 instruction set. It also had more registers and more instructions.
      The z80 peripheral chips, with their Type 2 interrupt mode, also made it possible to build a full system with much fewer support chips.

      I suppose that if you really wanted to be a purist Luddite, you could always elect not to use the extensions. But why would you want to????

      1. @jackcrenshaw if a development tool targets z80 you can’t usually choose not to use the extensions. Development tools for 8080 are very scarce. Most CP/M compilers only generate z80 code. That’s why DX-Forth was such a pleasant surprise for me: modern and 8080.

        Yes, I’m a purist Luddite :)

  3. I wrote a platform level designer in forth on the Atari ST in the late 80’s. I used the FORTH compiler’s built in assembler for the sprite routines. Reverse polish 68000 assembly language is not for the faint of heart:

    d0 #7 l. move

      1. It depends on which way your brain works. Over the years, I have gradually come to the conclusion that it’s partly inborn. I myself do think in RPN, and I do not want any more algebraic languages, only RPN. Forth was a breeze for me to pick up and run with; but I absolutely cannot latch onto C. I also understand the Korean language is RPN, so Koreans tend to find Forth more natural.

        1. I don’t know anyone who can get the answer to 7 times 5 if you say “What is seven times….”. They have to mentally stack the 7, see they are going to multiply, and wait for the next argument. EVERYONE does that internally.

          1. It’s partly from how you were taught, and also because of our language, not necessarily what’s natural. In English we say for example “put on your shoes.” OTOH, in Korean, it’s more like “shoes, install,” that is, first we present the things you’re going to operate on, then tell what to do with them. This is my normal way of thinking when it comes to technical programming. Do that, and you get a result. Now you do something else to it, preceding the action with any further parameters that might be needed.

            In the calculator wars, TI’s argument for for their algebraic notation and their push in the education market was that it lets you enter the equation exactly the way you see it on paper. Where the education establishment goes wrong however is that in calculations in real-life engineering, we usually don’t have an equation in front of us.

  4. Every Sun SPARC Station computer back in the day had a Forth engine for what we would now call the BIOS. You could drop to a command line at startup time (none of that menu rubbish, and certainly no graphics) and type Forth commands to control the NVRAM and boot the computer. Or just to play around.

    1. Most non-x86 Unix workstations in the late 90s used the Open Firmware pre-boot environment (the equivalent of the PC BIOS), including “new world” Power Macs. Open Firmware had a built-in command language based on Forth.
      All the SparcStations I’ve used had a graphic frame buffer (no “true” text mode). So did Macs, SGI and HP PA-RISC workstations.

  5. I don’t know what’s quirky about the Propeller — it works very well for me and my clients. For those that choose, it can also be programmed in Forth. Tachyon seems to be the favored version, and its creator, Peter Jakacki, uses the Propeller with Forth in client apps. In this video Peter demonstrates using Forth in a network of small, Propeller-based controllers: https://youtu.be/xtlyE5YDZnY

  6. > For anyone who has dealt with the programming language Forth, odds are good that you picked it up back in the 80s.

    I’m not sure that’s actually true, statistically speaking – I think that it might actually be even odds that you instead encountered it in the 2010s while playing Minecraft. There was an *extremely* popular mod around 2012 or so, Redpower 2, which introduced massive expansions to redstone – including a computer, powered by an emulated 6502 processor, which came bundled with a custom FORTH-based operating system. Not a huge percentage of users actually *used* it – these were, after all, mostly children – but I’ll wager that most of them at least *tried* to use it and probably got as far as looking up a FORTH tutorial, or copy-pasting in some code from a forum for a door-lock password prompt.

    Hm. Now I actually want to try and estimate this.

    This page (http://www.angelfire.com/in/zydenbos/WhatisForth.html) estimates that ca. 1988, there were perhaps 50,000 serious Forth programmers and another 25-50,000 hobbyists and casual users, and the number of people who’ve at least encountered and tried to use it is probably significantly higher, so that’s maybe something in the 100K range, almost certainly less than 1M, who encountered it in the 80s. On the other hand, life expectancy and the passage of time will have reduced the number of people today who encountered it then; we’re probably mostly talking about people in their 20s-40s at the time here, and 30 years on from 1988 we’d definitely expect significant losses in the upper end of that range.

    Minecraft ca. 2013 had 12 million PC sales, and maybe 1% (certainly less than 10%) of those played with mods; and if you were a modded player around then you very likely used RP2. So that’s also on the rough order of 100K exposed, depending on how accurate my assumptions are about modded players. A randomly-chosen RP2 computer tutorial on YouTube (https://youtu.be/udv1VRdB7GI) is showing >100K views; and while many of those are undoubtedly from people watching it multiple times, it’s also probable that not all users of this feature watched this particular video, so I’m probably roughly in the right range. Other videos show similar statistics; this (https://www.youtube.com/watch?v=_v_Jma1xX5s) fairly heavy tutorial on the specific nitty-gritty aspects of Redpower Forth has fewer views, but still shows ~100K as well.

    So … given that someone has dealt with the programming language FORTH, the odds that they actually picked it up within the decade are *surprisingly high.*

  7. We used to call Forth the first write-only language. But there’s no question that, if you have a small, low-powered microprocessor, Forth is the _ONLY_ way to go. The kernel can be amazingly small. And portable. And if you loved the HP reverse-Polish calculators (also the only “rational” way to go, RPN just feels right.

    Ca. 1979 or so, we at Honeywell wrote a Forth system for H’well’s 16-bit flight processor. It worked great. We used it to control calibration tests for our nav systems.

    About the same time, a prof at Univ. South Fla. (USF) got a DoD contract to build a rather large & complicated real-time system in Forth. He had maybe 10-15 people working on it. AFAIK, it was successful.

    The biggest problem in those days were the PRICES being charged by Forth, Inc.

      1. Hmm. It’s entirely possible to write unreadable code in an language. But in most languages you’d have to make an effort to do that. Not with Forth. :)

        The thing with Forth is: if you know how to write readable assembly code, you also know how to write readable Forth code. But most people have never written one line of assembly code.

        1. I like to think of Forth as interactive assembly++. It’s a heck of a lot easier to get up and running than in assembly, and the path from assembly to higher- or user-level languages is relatively easy to blaze, but you have to do it yourself. Having everything interactive, even at the lowest level, is a great help.

          IMO, Forth would be the perfect language for small microcontroller projects, if it weren’t for the lack of libraries. The coverage of Arduino or mbed or most of the vendor code libraries is simply lacking in Forth. I don’t mind digging out the datasheets and hammering through for a few hours to get an SPI eeprom up and running, but I understand those who do. (OTOH, it’s a one-time cost.)

          I’m really sold on Mecrisp-Stellaris and the STM32 parts at the moment, but I also use STM8EF (https://github.com/TG9541/stm8ef), developed right here on Hackaday.io for the smallest of projects. Why? Just b/c it’s fun.

          1. Thanks Elliot for all your contributions. Your fantastic Mecrisp-Bluepill article was one of the two reasons that pushed me to experiment with forth again (after near a 20 year pause) . Mecrisp is a fantastic Forth implementation, much more agile and fast than any other commercial product since it is 100% written in machine code. STM boards at 32 bit, are almost a dream for pennies. They will beat any 16bit board in price-performance, and who needs to think twice 16 bit or a 32bit processor ? What else can we ask when all that power is free thanks Mecrisp ?

    1. Yes, that’s the issue. I have it in front of me. I was not interested in computers yet until several years later (I was only interested in analog electronics), and I didn’t hear about Forth until perhaps 1985, through a friend who had an HP-71 hand-held computer and the Forth/Assembler module. I got into Forth in 1989 on the same computer. It was a rather poor implementation of Forth; but since it was Forth, I was able to improve and extend it a lot, even without learning the Saturn processor’s unusual architecture and assembly language.

  8. Swapforth :)

    Can fit a forth system (ttl rs232 access) in a single $10 chip these days. (ice40xx1k+ will fit the j1a). I have overclocked one up to 69MHz, usually clocks in at 40 to 48 MHz though. Plenty fast when ‘forth’ is native for it….

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.