Episode: 3477
Title: HPR3477: Picking a Forth
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr3477/hpr3477.mp3
Transcribed: 2025-10-25 00:08:30

---

This is Haka Public Radio Episode 3477 for Tuesday 30th of November 2021, today's show
is entitled, Bicking a Fort, It is hosted by Brian in Ohio and is about 22 minutes long
and carries a clean flag. The summary is available for the old and new.
Hello Haka Public Radio Brian in Ohio here. I'm out from under my rock and doing the third
installment on my series on using fourth on microcontrollers and in this episode I'll talk about
which fourth I've settled on and the previous episodes, HPR 343, I gave a brief history of
fourth in general and then in HPR 3433 I talked about why I use fourth right now and so in this
episode again I'll tell you in the end which fourth I've chosen and why but I want to give some
I want to give some other types of fourths that are out there just as an example and reasons
that are why they're good and why they're bad so without further ado. One thing I'll mention before
I get into this is that if you're going to do most of these fourths you're going to have to use
the microchip assembler for the at mega boards or at mega chips and that requires using
their close sourced assembler under wine and Linux. It's a little bit of a it takes a little
bit to get set up and it's not truly free software. There is at least one good assembler out there
that's written in free pasquale, GERDS assembler I think it's called but I haven't seen any fourths
that have been assembled using that assembler. So right now if you're going to do this you're going
to use wine and the old Atmel assembler that they did before Atmel was merged with microchip.
That being said there are a lot of resources for fourths out there for all kinds of different
microchips and for our boards but for Arduino there's a lot of resources and a lot of different
ways to put fourth on our Arduino boards. So the first one that I'll talk about is actually
doesn't use that assembler it's an Arduino sketch. It was written by Dr. Chen Hansen Ting who
is famous for creating a fourth called E-forth. He wanted to build, he wanted a fourth that
wouldn't require any assembly or anything like that. He wanted to be very easily put on to an
Arduino board so people could play with it. So he came up with this sketch so it's a fourth written
in C and it's pluses are what's a sketch. It's an Arduino sketch it runs it's put on the board via
the Arduino environment so it's easy to do. It can wet your appetite and then when you see the
power of fourth versus the Arduino environment hopefully it'll get you motivated to put on what I
would call a real fourth on the Arduino board. Its minuses are it has limited resources it runs
in RAM so there's very little RAM on at mega 328 only like 1.5K of RAM. You can't add words to
the dictionary so you lose all your work on any kind of reset. I tried using it and it is a
bit broken it doesn't seem to work and I'm not sure that's because of the version of Arduino
that I was using to put the sketch on the board but anyway I tried it it's okay but it's definitely
not something you're going to stick with. Now Dr. Ting definitely put out a fourth that's very
useful it's called E4th. He's created E4th for many many different kinds of microcontrollers
and for regular CPUs. If you start searching the web for E4th you'll find his name and some of
the real pluses with E4th is that there's great documentation for what he what he put together.
There is a book E4th for the Arduino I think it's called there'll be links in the show notes for
this stuff and it actually talks about fourth from a very low level perspective how it works
how it's put together and then it has example sketch notes as an example fourth programs that
you can run and it gives you the full assembly with copious comments so you could actually build
your own fourth from this and I think that's where a lot of other fourths have been springboard
from what he put together which was a fourth that's built on about 31 primitive assembly language
they call primitives that run the fourth virtual machine and then all the other words there's
about 160 words or so that flesh out the whole system. So the pluses of E4th is great documentation
there if you want to explore assembly language this might be a good a good place to go it's I
did a hpr episode 2506 on building your own list which really wasn't a too it was about list but
it was really about learning the the C programming language and this dr. Ting's book on E4th
is kind of the same way you could I think you could really learn assembly language at a really
kind of a very college level upper level kind of book it would be a good second book of assembly
once you've done some other easier kind of hello world kind of stuff this book would be one
that would would challenge you to really get into the nuts and bolts of what assembly language is
all about his E4th is a good springboard for building other fourths on different systems
and there are a lot of good examples in his in his book about E4th for Arduinos that's
excuse me useful on all all of the Arduino boards that are out there or all the fourths for
Arduino boards that are out there the minuses there's no at least I couldn't find any binaries
like things you could just put right on the board without having to build it so you have to build
E4th yourself which means setting up wine setting up the assembler and that's not a trivial task
it's not super hard but it's it definitely took me a little bit of time to get it up and running
and takes a lot of looking around and a lot of trial and error but I was able to build E4th
put it on an on an Arduino board and play with it it's then this leads you to the next minus
which is it's not being developed there's there's no help you're you're kind of on your own because
it's not it's an old fourth from a from a bygone era that's kind of just you would be out there
on your own a little bit it is a bit quirky it's kind of old style and some of the stuff
and and but again those things are not necessarily bad in themselves they're just they're just
make it a little bit more difficult so the next fourth I tried is am4th
am4th is it's a project that's very well maintained right now there are the some of the
pluses for am4th is there are binaries available so you could you have hex files that you can
directly upload to not just Arduino boards but all kinds of different microcontrollers
and so you don't have to do any compiling they're available as well as all the source code so
if you wanted to do all that or if you wanted to build your own custom fourth that's all there
and so that's a plus that the project is well maintained it has good documentation
and actually it has it also has some of that some of the documentation really goes into the kind
of the the fundamentals of how fourth operates and some of the particularly some of the things that
affect the architecture the Harvard architecture that the Arduino and a lot of the flash
microcontrollers use where they separate data and program memory and some of the difficulties
with that they're unfortunately that's a negative something to do the positives first
there are the plus for am4th is that if you decide not to use just our Arduino or at mega chip
you could use other chips because it's available for that and there are many advanced examples on
their website for am4th that give some real good examples of pretty pretty complex projects
in fourth and the clock project that's on their website is particularly excited to talk about
real-time clocks and setting things up and using different buses and just pretty good good
information so the am4th is a good place to go for a good current useful fourth right now
minuses for am4th building it is a bit magical the source file is scattered over a lot of small
assembly and fourth files that are scattered all over the directory of the zip file that you
download from their site that's all there but it's all over the place and they do give you
instructions on how to build it and and if you're okay with just doing it and not really thinking
beyond that it's but it's a little bit mystical on how it actually is put together if you really
wanted to understand how am4th is assembled you'd have to have a real good understanding of
make files and really kind of walk your way through all of these little all these files all over
the system all over this of directories tree to figure out what's being put in to make your fourth
that being said also one of the minuses that is that in the few times that I used it there were
a couple times that the dictionary which is the main all the words in your fourth system
they got corrupted in the process of just putting something together and then to do that to
recover from that you have to reflash the system it's kind of the worst case scenario for a fourth
where whatever happens it writes over itself and your system is destroyed and you got to start over
so that's that's happened to me a couple times when I used am4th there's a minus that you'll
really realize it's a minus until you start digging into it is am4th uses different memory calls
for different types of errors so in other words if you're addressing the e-prom of the of the
microcontroller you have to use a different set of of all the very similar but there are different
words to access e-prom memory or flash memory or the ram they're different words and and when at
first you don't think that's a big deal but then you'll you'll write some stuff and you'll
be addressed the wrong memory and you'll go oh my goodness and it's just it's a it's a definitely a
a minus and it wants you figured it out a little bit so that brings us down to the the last
fourth that I'll talk about which is the fourth that I did settle on using and one that I'll
describe later on when we when we get into some projects with fourth and that is flash forth
and so flash forth has been around for a while and I actually emailed the the maintainer
and developer of flash forth and he said I could read this this back so I'll because I asked
him how did flash forth camp come about and this is what his what he had to say his name is Michael
Nordman and he said here's some random thoughts he says I learned fourth on the Commodore 64
and starting fourth back in 1983 at the time I only had a cassette tape as mass storage so it was
not very practical I think fourth is at its best writing small programs interactively on micro
controllers and bringing up new hardware in 2004 I got the idea of using a pick 18 flash micro
controller for a fourth that would persist the programs you write into into it and the flash forth
was born then there was a request to support different pick boards and so he wrote that the at
mega version which is what the chip for the Arduino board at mega version was written to get
flash forth on the Arduino boards that has made flash forth more popular than having it only for
the pick versions many of the compiled of flash force are quite sensitive to their user mistakes
and require reflash of the fourth kernel to revive the broken fourth system something we just
talked about I wanted flash forth to implement a stable fourth that cannot be broken by the user
I do not want to keep reflashing the kernel just because it happens to type something stupid
into the interpreter I also wanted to get rid of a separate memory words for ramflash and e-prom
and so this allows other words like c-move dump variable and value to work with all the types
of memory that are available on these chips at each development spur there was interest interest
users that made he had to put more effort into flash forth without that flash forth would be much
smaller system these users were just mostly university teachers that use forth for teaching and
lab projects and small companies that use forth for some small products and then john cat soleus
came along and wanted to make a flash forth computer so now you can buy a small board with a
pick 24 and flash forth on it there are not too many products with flash forth on it or with
fourth on it at all so now flash forth five has been more or less stable for over five years
I mainly do some maintenance and add support for more chips and of course I use flash forth for
my own projects my favorite chips are the pick 18 chips with the inbuilt usb interfaces usb is used
as the operating of the operator serial interface microchip is dropping support for the assemblers
a rewrite of the at mega version was done recently to compile with the x8 instead of
avrasm 2 and also the pick 18 version should be able to compile with the x8 so it's the best
regards michael that last part is just like you said this the old micro the old atmill
avr asm2 assembler is not going to be supported anymore so microchip rewrote up the
a new assembly it's like an ide called xc8 and i think that will compile for all their chips
picks and and the old at mega chips and at tainees and all that stuff they're all it's a one-stop
shopping kind of thing there's linux versions for which is cool because before that everything
was done under windows and i've tried using it but i got to dig into it to really understand it
and i will say this though the the newest versions of the the binaries that are available on the
flashforth website for the at mega are pretty small i mean there's a lot of system space available
you can make a huge huge program if you really wanted to and so that was just a note from
michael nordman the developer i'll put a link to the website for for flashforth of course and all
the other things that i've found and i'll put a a link to a donate page for him too because he
he could use the little money i think now then if you're going to use his fourth to help the
develop to help him buy tools and things like that so i settled on flashforth the pluses that i
see are it's actively developed like we said or at least actively maintained there are binaries
available so again you don't have to build anything you don't have to assemble anything yourself
you can grab the binary for the few boards that are that are out there at mega at mega three
twenty eights at mega twenty five sixties and some end of the pick chips of course and and you
can just flash them on the chip without having to do any assembly so don't let that be a barrier
pantry again he just like he he said in his note the flashforth is robust i've been i haven't broken
it yet i've never had to reflash the kernel the the the the basic fourth system because of anything
that i did while programming this the chip so you know you can you basically you'll recover
from whatever and you can just empty out the dictionary some good words to just start a fresh
without having to reflash very well built and very well thought out and i like the flashforth
because it right from the start it includes some of the words that you don't really until you've
done some stuff with it that you realize oh it'd be nice if that word was included a a it
pos for a microsecond kind of thing ticks which are like you know system clock kind of stuff and
that are available and already built in and they're not stuff you have to add later on they're
already built into the system so he's there's some really good well thought out stuff there
it has a real small footprint that's a plus leaves more programming space
um and it and it does have a unified memory so you you don't really um in some ways you don't
have to think about it too much uh and it's really easy to swap between the memory spaces uh but
you don't have to use different vocabulary you use the same words when you're addressing memory
you just have to point to where you want to go which is which is a plus it once you get into it
you'll you realize oh this is a nice feature um not a lot of negatives i really like flashforth
but i will say the document documentation although good is sort of very pick oriented uh pick being
the old uh pick chips and so there's some stuff you have to sort of uh translate into if you're
going to use uh the at mega chips it's not hard but it's you know it would it'd be nice if
there was some more straightforward at mega uh documentation uh that being said too there are
there's at least one good website uh Arduino4th.com i think it is i the link will be in the show notes
and uh it seems to be somehow connected with uh flashforth i could be completely wrong but
uh a problem there for me personally is that's a lot of stuff's in french so it's hard for me to
figure out exactly well not a lot there's a but there's stuff and then that's that i wish i could
read but uh i'm sorry i can't i can't read uh french um that's my bad that's not a minus that's my
minus um and uh the other minus in some ways is that the the the flashforth is definitely tied to
the microchip development tools so to get beyond that or to make a custom flashforth and you
really have to set up all that uh all that um microchip development stuff onto your system
not impossible but definitely not not the easiest thing in the world uh on that note
about 20 minutes i think i think i'll stop there and on the next show i will definitely uh show
you how to install flashforth on a uh on on Arduino board and i will do the obligatory hello world
program and um and so that uh that finishes this episode thanks for listening uh i wanted to
leave you with a thought speed doesn't kill it's the rapid dissipation of speed that kills
thanks for listening bye bye
you've been listening to hecker public radio at heckerpublicradio.org today's show was contributed
by an hbr listener like yourself if you ever thought of recording a podcast then click on our
contributing to find out how easy it really is hosting for hbr is kindly provided by
an honesthost.com the internet archive and our sync.net unless otherwise stated today's show is
released under creative comments, attribution, share like 3.0 license
