
Zkeme80 – A Forth-Based OS for the TI-84+ Calculator - pjmlp
https://github.com/siraben/zkeme80
======
hoytech
I also wrote a forth system for the Z80 TI calculator series when I was in
high school, about 20 years ago now (wow).

Very happy to see young people still fooling with this stuff, despite the
ubiquity of smart phones etc.

I just uploaded the code to github:
[https://github.com/hoytech/tiforth](https://github.com/hoytech/tiforth)

To anyone else interested in really understanding forth, Brad Rodriguez's
"Moving Forth" series is the best I've ever read (and I don't imagine much has
changed since), including a great explanation on "DOES>", widely regarded as
the most difficult part of the forth kernel. You can read it online here:

[https://www.bradrodriguez.com/papers/index.html](https://www.bradrodriguez.com/papers/index.html)

Also I have to confess I stole the division routine for my forth from Brad's
CamelForth:
[https://github.com/hoytech/tiforth/blob/master/forth.z80#L50...](https://github.com/hoytech/tiforth/blob/master/forth.z80#L501-L552)

Quickly looking it over I notice I used m4 as the macro-expander (haha I've
since grown out of that).

------
vanderZwan
Worth noting is that this is written by a 17-year old

[https://old.reddit.com/r/Forth/comments/a3ipn6/im_17_and_i_c...](https://old.reddit.com/r/Forth/comments/a3ipn6/im_17_and_i_created_a_forth_interpreter_and/)

~~~
benhoyt
Nice! Writing a Forth in 8086 assembly was how I got into programming as a
teenager too (my Dad had been into Forth as a hobby for a long time). It was a
great way to start -- a Forth compiler/system is relatively simple to build
yourself from the ground up.
[https://github.com/benhoyt/third](https://github.com/benhoyt/third)

------
tombert
I don't really know forth, but it seems like people who learn it _really_ like
it; can someone give me a high-level explanation to while it's easier to write
Forth instead of C for low-level programming?

~~~
int_19h
In addition to other comments, as I understand, bootstrapped Forth and similar
languages usually compile down to code that is not optimal speed-wise, but a
lot more compact that usual, because it's basically all CALL instructions
(i.e. every word definition defines a function, and every use of the word
inside the definition is a call to the corresponding function). This can be a
desirable trade-off when you're dealing with a platform that has, say, 8
kilobytes of RAM to work with for all your code.

~~~
vanderZwan
> _(i.e. every word definition defines a function, and every use of the word
> inside the definition is a call to the corresponding function)_

Yeah, which supposedly brings one of the big downsides of Forth, which is that
one easily ends up with a program that has been refactored _too aggressively_
into smaller words.

------
roywiggins
This is super cool- Forth seems like a perfect fit for the platform.

~~~
realo
Yeah... RPN et al... :)

~~~
gugagore
Though famously (I believe) it was HP calculators that were known for reverse-
Polish notation.

~~~
opencl
That's the joke, I imagine.

RPN is Forth-like in that they're both stack based. Their 28/48/49/50G line
shipped with RPL(Reverse Polish Lisp) which was heavily inspired by both Forth
and Lisp. Very weird language but I always enjoyed programming those
calculators.

The ancient HP41 and HP71 did have Forth interpreter ROMs available.

------
wincy
Can someone clear up how to refer to Forth? I’ve heard “a Forth”, “your
Forth”, and just “Forth”, and the title says “Forth-Based.

My best guess is it’s “a Forth” because you’re implementing a new language
yourself, in the style of, but distinct from, the original Forth programming
language. Is this correct?

~~~
vanderZwan
With Forth there are a handful of core words you really need to get things
going, some ubiquitous but not mandatory convenience ones, and then it's up to
what best fits the platform. There is no such thing as "the" Forth.

Isn't Lisp just the same?

The TI-84+ series is such a specific technological niche that it makes sense
to write a Forth customized for it platform, which the author of this OS did
earlier[0]. This repo is an OS though, so "Forth-based" means the OS is built
on a Forth platform but with enough extra features that it is more than just a
Forth language at this point.

Also, arguably, the part where it is compiled through Scheme might make the
purists say it's not a true Forth (which tend to be self-hosting).

[0]
[https://github.com/siraben/ti84-forth](https://github.com/siraben/ti84-forth)

~~~
shakna
> There is no such thing as "the" Forth.

> Isn't Lisp just the same?

Not really.

Most Common Lisp folks have hijacked the word "Lisp" to mean Common Lisp.

Then you have Lisp-1 and Lisp-2 definitions, so when you say "a Lisp" people
will wonder which you fall into, and it'll be one of the first asked
questions.

Depending on your audience, they may have a very fixed idea what "Lisp" means,
and it may be a very detailed concept.

Forths don't tend to suffer from those problems.

------
phkamp
Wouldn't it be easier to just get a HP calculator to begin with ?

~~~
jacquesm
You would not learn nearly as much from that. This is analogous to '17 year
old builds car' and then going 'wouldn't it be easier to just buy a Toyota?'.
Sure it would be easier, but this was never about ease.

