## What’s the Jupiter ACE?

The Jupiter ACE was an early 1980s home computer that had similarities to the Sinclair ZX-81, especially in the bottom input entry

in the keyboard layout (By the way, symbol shift can be shift to right-shift in EightyOne emulator or is otherwise the right CTRL key… also note that the double quote, `/`, `*`, and others are reached by the symbol shift + a letter key.)

and the extremely limited 1KB of base RAM.

## What’s Forth?

Forth is a stack-based programming language that relies on a data stack and reverse Polish notation, much like the HP calculators are known for. A basic example would be `6 2 *` which would perform the operation `6 * 2` and push the value `12` back onto the data stack. If you wanted to actually retrieve/pop the result off the stack, you would issue a `6 2 * .` sequence, in which the `.` would pop the last value and return/print it.

## Special considerations for the Jupiter ACE’s Forth

The data stack on the Jupiter ACE assumes 16-bit values, and the default data type assumed is a signed integer, so you have values from `-32768` to `32767` that are allowed per single stack slot:

Floating point numbers are possible, but they require two stack slots, so you have on operate on two consecutive stack locations at the same time to work with floating point numbers. Another challenge with the Jupiter ACE’s Forth implementation is that you’re missing some advanced math functions and you have to write your own. The following is an annotated version (the comments are in parentheses) of the `SIN` routine found on page 93 from the first edition Jupiter ACE manual found here:

```: SIN
(x - sine of x)
2DUP 2DUP 2DUP F* FNEGATE ([x,x,-x*x])
2ROT 2ROT ([-x*x,x,x])
27 2 ([-x*x,x,x, 27 2])

DO (initial value of 2, limit 27)
([-x*x,x,x])
6 PICK 6 PICK ([-x*x,x,x,-x*x])
F* I I 1+ * ([-x*x,x,-x^3,6])
UFLOAT F/ ([-x*x,x,-x^3/6.])
2DUP 2ROT F+ 2SWAP ([-x*x,-x^3/6.+x,-x^3/6.])

(3 down the stack of floats is the multiplier of the
numerator terms for the Newton method, 2 down the
stack is the total sum, top of the stack is the last
term, and the counter (I) tracks the denominator
multipliers (I and I+1))

2 (add 2 to the stack for the loop increment)
+LOOP
2DROP 2SWAP 2DROP ([x-x^3/6. ... etc])
;
```

`2DUP`, `2ROT`, and `2SWAP` are methods that are defined on previous pages to basically work with floats on the stack in the same way as 16-bit integers. The algorithm is Newton’s method to estimate a sine, through 14 terms of the method. If you map out the stack locations by hand, you can follow how the method is making creative use of the top 3 – 4 (6 – 8) stack positions to keep the progress, the multiplicand of the numerator of the terms, and the current term. However, due to floating point representation, this information is harder to trace through in the emulator because you will see 16-bit values in the data stack.

## Trying for yourself

I’ve tried out the SpudACE emulator (strictly Jupiter ACE) and the EightyOne emulator (Sinclair, Timex, and others also emulated) which can be found on this Jupiter ACE Emulators for Windows page. I’ve found the EightyOne emulator a bit more stable and usable. You’ll want to make sure to mute your sound when saving to tape, because sound *may* output when saving to your virtual tape. Watch a demonstration here and see the source code for the demo in this folder.