Epson HX-20
Datasheet legend
Ab/c:
Fractions calculation
AC: Alternating current BaseN: Number base calculations Card: Magnetic card storage Cmem: Continuous memory Cond: Conditional execution Const: Scientific constants Cplx: Complex number arithmetic DC: Direct current Eqlib: Equation library Exp: Exponential/logarithmic functions Fin: Financial functions Grph: Graphing capability Hyp: Hyperbolic functions Ind: Indirect addressing Intg: Numerical integration Jump: Unconditional jump (GOTO) Lbl: Program labels LCD: Liquid Crystal Display LED: Light-Emitting Diode Li-ion: Lithium-ion rechargeable battery Lreg: Linear regression (2-variable statistics) mA: Milliamperes of current Mtrx: Matrix support NiCd: Nickel-Cadmium rechargeable battery NiMH: Nickel-metal-hydrite rechargeable battery Prnt: Printer RTC: Real-time clock Sdev: Standard deviation (1-variable statistics) Solv: Equation solver Subr: Subroutine call capability Symb: Symbolic computing Tape: Magnetic tape storage Trig: Trigonometric functions Units: Unit conversions VAC: Volts AC VDC: Volts DC |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Epson HX-20
I received this EPSON HX-20 handheld computerrecently. It looked to be in nearly new condition, but closer inspection reveals that it has been used; there is some wear and telltale dirt. Nevertheless, it is a machine that appears to have been well cared for. Unfortunately, when I started to play with it in earnest, I discovered that its tape drive is non-functional; as a matter of fact, I was unable to even insert a standard microcassette.
Closer inspection revealed the problem: the mechanism that withdraws the read/write head and transport wheel was quite stuck. It was not a trivial exercise, but I was able to take the tape drive apart, free up the mechanism, and put the drive back together. It is now working like new: much to my surprise, it was in fact able to use reliably an old microcassette that I long ago retired from an answering machine because it was too worn.
With that problem out of the way, I was at last able to begin my exploration of the HX-20. It is an interesting, although somewhat bulky computer. The keyboard is fairly pleasant and the screen, while small, was probably large enough for useful work.
I have two ROMs for the HX-20: BASIC and FORTH. FORTH? Yes, FORTH, that curious language that users of HP calculators would find so familiar. Unfortunately, the FORTH for the HX-20 is a toy version: it doesn't even have floating point support! You can't implement recursive algorithms. Integer support is limited to 16-bit values; there's no string support; and peripherals don't appear to be supported either. (I could be wrong about this*: I was exploring the HX-20 without the benefit of documentation.)
Even without recursion, it is easy to use FORTH to compute the factorial:
: FACT DUP BEGIN DUP 1 > WHILE 1 - SWAP OVER * SWAP REPEAT DROP ;
These lines define the FACT function. To use this function to compute the factorial of 5, for instance, and display the result, you'd enter:
5 FACT .
The BASIC is a standard Microsoft BASIC implementation that, sadly, even lacks double-precision support for scientific functions**. Because of this, my programming example for the HX-20 is a Gamma function implementation that comes with a custom algorithm for the logarithm and sine functions using the following standard series expansions:
\begin{align}\ln(1+x)&=x-\frac{x^2}{2}+\frac{x^3}{3}-...~~~~(|x|\le 1),\\
\sin(x)&=x-\frac{x^3}{3!}+\frac{x^5}{5!}-...~~~~(0\le|x|\lt 2\pi).\end{align}
The program itself begins on line 100, while these two helper subroutines start on lines 10000 and 11000, respectively:
100 INPUT Y# 110 S%=1 120 IF Y#>0 THEN 150 130 S%=-1 140 Y#=-Y# 150 X#=2.50662827563479526904# 160 X#=X#+225.525584619175212544#/Y# 170 X#=X#-268.295973841304927459#/(Y#+1) 180 X#=X#+80.9030806934622512966#/(Y#+2) 190 X#=X#-5.00757863970517583837#/(Y#+3) 200 X#=X#+0.0114684895434781459556#/(Y#+4) 210 GOSUB 10000 220 G#=Z# 230 X#=Y#+4.65# 240 G#=G#-X# 250 GOSUB 10000 260 G#=G#+(Y#-.5#)*Z# 270 IF S%>0 THEN 330 280 X#=3.141592653589793*Y# 290 GOSUB 11000 300 X#=-3.141592653589793/Y#/Z# 310 GOSUB 10000 320 G#=Z#-G# 330 PRINT G#: PRINT EXP(G#) 999 END 10000 Z#=0 10010 IF X#>.5 THEN 10050 10020 X#=X#*2.718281828459045# 10030 Z#=Z#-1 10040 GOTO 10010 10050 IF X#<1.5 THEN 10090 10060 X#=X#/2.718281828459045# 10070 Z#=Z#+1 10080 GOTO 10050 10090 X#=X#-1 10100 XX#=X# 10110 N%=1 10120 ZZ#=Z#+XX# 10130 IF ZZ#=Z# THEN RETURN 10140 XX#=XX#*X#*N% 10150 N%=N%+1 10160 XX#=-XX#/N% 10170 Z#=ZZ# 10180 GOTO 10120 11000 N%=X#/6.283185307179586# 11010 X#=X#-N%*6.283185307179586# 11020 Z#=X# 11030 XX#=X#*X# 11040 XZ#=X# 11050 N%=2 11060 XZ#=-XZ#*XX#/N%/(N%+1) 11070 N%=N%+2 11080 ZZ#=Z#+XZ# 11090 IF ZZ#=Z# THEN RETURN 11100 Z#=ZZ# 11110 GOTO 11060
*I was, in fact, wrong about this; Geoff Barnard tells me that the FORTH implementation does, in fact, support microcassette operations and can be extended to support other hardware using user-written assembly-language subroutines.
**I've since been informed by Geoff Barnard that it's my naive attempts to determine precision by typing, say, PRINT SIN(45) that failed; had I used a double precision intermediate variable, as in A# = SIN(45), followed by PRINT A#, I'd have seen a double precision result. In other words, my implementation of trigonometric and exponential functions in the above program were unnecessary. However, Marcus von Cube informs me that this is not the case, the trigonometric functions are truly single precision so perhaps my implementation was needed after all.