Finally, here is the complete map of the HP35 ROM 2 (256 instructions of 10 bits each).

ROM 2 contains the code for:
- Cordic routines for log (ln), ex and xy,
- prescaling routines,
- mutiplication and division,
- and result normalization.

J. LAPORTE
12 November 2006

Note : How to forge constants when there is no room in Rom.

Only 3 constants

- π/4 = tan-1 = arc tan(1) = 0.7853981635
- ln (2) = 0.693147190553
- and ln(10) = 2.302585093

The rest is forged (I used this term instead of calculated which makes no sense regarding a constant).
The “pattern” found in the ln(x) constants and in the angles in radians are singular: digits “6” and “9” are often used.

1) Inverse trigo

arc tan(0.1) = 0.099668652496
arc tan(0.01) = 0.0099996666866
arc tan(0.001) = 0.000999999666
arc tan(0.0001) = 0.000099999999666

2) ln and e^x

ln(1.00001) = 0.999995
ln(1.0001)   = 0.9995
ln(1.001)     = 0.999500330850
ln(1.01)       = 0.99503085093
ln(1.1)         = 0.09531017980553

The relevant code is at 02156

 02156: 0 -> c[w] 02157: c - 1 -> c[m] 02160: if s2 = 0 02161: then go to pqo28 02162: load constant 4 02163: c + 1 -> c[m] 02164: if no carry go to pqo24 02165: pqo27: load constant 6 02166: pqo28: if p # 1 02167: then go to pqo27 02170: shift right c[w] 02171: pqo24: shift right c[w]

The scheme is identical: register C is zapped and C=0
Then c – 1 -> c[m] makes C=09999999999000
Pointer p is positioned “load constant 4” makes C=09999499999000
And c + 1 -> c[m] finish the job C=09999500000000,
(this is the case of ln(1.00001).

Sometimes this scheme is completed with a few figures loaded from rom, eg. Ln(1.01) : C=00995033085093.

The case of const arc tan 0.001 and arc tan 0.0001 is simpler only digits “9” and “6”!

That was surely a space saving strategy, but when memory was not so sparse : this code remain (in the Woodstock machines for example).