Skip to main content

'Setting Forth' with Forth on the RC2014

T

his adventure started a few weeks ago when Spencer included an item in his RC2014 newsletter about James Bowman's port of CamelForth for RC2014.

I was intrigued by the arithmetic using double-length numbers and as James gives a few bits of example code in his article, it looked like a good opportunity to have a little foray into Forth. (I love the Jupiter Ace. I wish more had been sold so that they're a little less pricey today.)

I found several versions for CP/M. (I like using Compact Flash storage and CP/M on my RC2014.) Like BASIC, generic Forth sometimes doesn't work on the version you have without modification. Some versions contain more words or stick to the standard more closely than others. I tried Forth80, DXForth and UniForth as well as CamelForth and the one I like best is DXForth (I'm not recommending it over the others, it just worked best for me as I worked through some examples. I'd encourage anyone to try all of these and make up their own mind.)

The last thing I needed in my life was a new language. I use an object-orientated version of C in my day job, and assembly language with retro-computers. You can't beat the speed and efficiency of assembly. I wouldn't have considered using a higher-level language* for 8-bit computing.  Yet there was something about Forth that really appealed. 

It produces a compiled executable, which is pretty efficient and runs at close to assembly speeds. You can even write blocks of assembly in your Forth. Developing is very neat and efficient and it's easy to do it directly on the RC2014. If you buy into the way that Forth works, it forces you to think and program in a different way. 

I could write pages about this. But this is where the dice program comes in. Once I'd learned how to store and read bitmap data in Forth (hint: 'unindexed array'), send data to my OLED screen and read the buttons on my digital i/o module, building those things into a program was very quick and simple. 

Useful 'getting started' links:

Ed has provided me with this Google drive link which contains latest versions of DXForth

Archived copy of Ed's DXForth page 

Learn X in Y minutes where X = Forth (a beautifully straightforward 'getting started' page)

Thinking Forth by Leo Brodie - download and find Appendix A for more inroads. The rest of the book is a great read.


* it's arguably not a higher-level language, see "But Is It a High-Level Language?" page 27 of Leo Brodies' book.

Comments

  1. I'm really surprised you didn't mention Tynemouth's 4th Minstrel - Jupiter Ace replica. I got a kit from thefuturewas8bit.com but haven't had time to put it together. It's RC2014 bus compatible! I first heard of FORTH when I had a PowerPC iBook, and I briefly toyed with the idea of learning for that reason. The boot firmware for PowerPC Macs was written in that language when PCs just had humble BIOS and UEFI wasn't yet invented. It has a long history in the embedded world, and is ideal for that purpose, although I never got around to actually learning any, hopefully I'll learn when my Minstrel4 gets put together!

    ReplyDelete
  2. I'm quite envious. My first Tynemouth kit was the Mini Pet and I was really impressed with the kit & documentation. I have always loved the look of the Ace, it's such a shame that original ones are silly money now. Since starting to learn about Forth I've been even more interested in that computer, and when I finally made the decision to grab a Minstrel Fourth kit from tfw8bit, they'd all gone. It's important with this 'new old stuff' to buy it when you see it, stuff tends to be produced in batches. I didn't know that fact about Macs. I've been a Mac person for a long time and have a number of powerPC macs and an iBook. One more reason to love them! Enjoy building and using your kit.

    ReplyDelete

Post a Comment

Popular posts from this blog

RC2024/10 - my entry

A while ago I made this MIDI module for RC2014: It works but a better design would have its own serial chip and port decoding.  As it is, it provides the MIDI interface and a clock signal for the second SIO2 serial port. This means that it requires a little setting up and will only work for RC2014s with an SIO2 (and port B not already used). I think people might reasonably expect it to be plug-and-play and self-contained, ie do all the serial itself. My challenge to myself is to:  learn how to connect a serial chip (probably 68B50 ACIA) to receive the incoming MIDI and to serialise outgoing MIDI design the module, including the port decoding write a library so that it can easily be used on any RC2014. Potential applications include a MIDI sequencer and using incoming MIDI to trigger notes on the AY or SID sound chips. Entering the Retro Challenge 2024 (aka RC2024/10)  has given me an incentive to get on with this! I'm happy to see several more entries in the RC2014 category, includ

How to convert images for TMS9918A graphics on the RC2014

For me, graphics capability is essential for an 8-bit computer. My graphics chip of choice for the RC2014 is the very capable TMS9918A. It has 15 colours, sprites, several modes and a max resolution of 256x192. It makes arcade-style games possible, such as Tut-Tut above.  I enjoy simply displaying images and have a bunch on my CF card (my 'hard drive') and have written image viewer and slideshow apps to display them. Some useful links: Convert9918 Tutorial of Convert9918's settings Multipaint J B Langston's TMS9918A video module my own TMSEMU video module my respository of TMS9918A software, games and .s2/.sc3 images Image conversion I did dabble in writing my own utility to convert .png images but then settled on the Multipaint app which can open a png in a MSX 'screen 2', allow you to tidy it up with paint tools and save as a .sc2 file. (An sc2 file is little more than a video-memory dump and so it's easy to blast that back into vram to display the image.

IM53 8080 birthday cake

 Each year I've been trying to get more creative with ideas for Spencer's birthday cake. The plan this year was to incorporate LEDs in place of candles. I eventually settled on an Altair / IMSAI / PDP -style computer since those are the type of computers that inspired his RC2014. The IMSAI 8080 has the most colourful switches as well as a name that I could twist. The thought that it could show randomly flashing lights (as if the computer were running) and that it could also play a game of 'kill the bit' was very appealing. A plan formed to use a capacitive touch pad on the cake itself. The first job is to bake the fruitcake. I often use a 7" square tin and one of those cut in half and rearranged makes a cake of suitable proportions.  Even after taking a slice off the faces to make them nice and square, there are still some rounded corners, so after putting on the marzipan, I used more marzipan as a filler to flatten the whole thing. Even though I wanted to end up w