HP 42S

Revision as of 08:34, 25 March 2022 by Phoenix (talk | contribs)

The HP42s, code named "Davinci", is a high-end RPN calculator in the HP Pioneer line. Introduced on the 31th of Oct. 1988, It was originally meant as a HP 41C replacement and thus had FOCAL compatibility, capable of running most HP 41C programs with little modification. However it was redefined to be a HP-15C successor late in its development cycle, consequently resulting in its lack of extensions and limited I/O capabilities, and was discontinued early (as compared to HP 17B and other Pionners) in favour of HP 48SX on 1st March 1996.

HP 42s
TypeScientific calculator
Introduced1988
Discontinued1995
PredecessorHP 41C,HP 15C
SuccessorHP 48SX
Calculator
Display typeDot-Matrix LCD
Programming
Other

Overview

There are three major revisions of HP 42s: A, B and C respectively. Revision A and B have a plastic pane in front of the LCD whereas revision C has a recessed LCD display. Revision C is the most commonly seen variant today.

HP 42s used a silicon-on-sapphire Saturn architecture chip code-named "Lewis" with 64KB of integral ROM and a RAM controller capable of addressing up to 32KB of memory, driving a 131x16 dot matrix display. Driven by a bus frequency of 32.768KHz, they are internally stepped up to 1MHz. 8KB of SRAM is soldered on board and roughly 7000 Bytes are available to the user as program steps or registers.

Internally, the HP 42s is extremely similar to both the HP 17B & BII, and HP 27S, with the exception of the lack of an extended ROM chip which on the 17 series contained international language & error message and on the HP 27S contained additional instructions. On the HP 42s, this position remains unsoldered. However, the instruction to jump to this memory location is still retained.

One notable feature that it shares with HP 17B and HP 27S is its capability to print to a thermal printer using infrared. The corresponding thermal printer is the HP 82240. It is the only calculator in the Pioneer line capable of utilizing the graphics printing capability of the 82240, while other calculators in the line are limited to printing characters.

The HP-42s runs on SysRPL with many low level assembly language tweaks, and thus it supports many advanced features like the HP 28C series. For example, it treats complex values as an object taking up one stack level (instead of consuming two stacks on the HP 41C or having a separate imaginary stack as on the HP 15C). Matrix entry and computation has been much improved with the user scrolling through using menu cursors, automatically expanding making manual DIM obsolete, and treating complex matrices as simple extension of real matrix (without resorting to "partitioned form" and "complex-form" as on the HP 15C). It also supports plotting to LCD with each pixel being individually addressable, and thus capable of drawing or plotting under program command. However unlike the HP 28C, it supports only 4 stack levels and does not have built-in plotting utilities, requiring the user to program their own.

Internally, values are represented using BCD and implemented with 15 decimal digits (12 displayed) for the mantissa. Math functions are always calculated in decimal and converted for display when using other bases.

Like other Pioneers, HP 42s ships with a debugger and self-test routine.

Known Bugs

There are only two known bugs on the HP 42s.

The first HP-42s bug relates to the COMB (combination) and PERM (permutation) instructions. Nominally these two instructions calculates C(y,x) = y!/(x!*(y-x)!) and P(y,x) = y!/(y-x)!. Since factorial is strictly positive, an input of x<y correctly raises "Invalid Data" error. However this error flag is not correctly cleared, for example when using x<>y and executing the respective command again, and will require an arbitrary arithmetic operation to correctly clear (for example 0 +). This bug has been reported in all revisions except some mid-serial-range revision A machines, and is believed to be a software-hardware interfacing issue, specifically, the hardware XM flag used for this error is not cleared explicitly in software but seems to rely on a hardware operation to reset. A simple workaround is to always to prepend the command with x<y? x<>y (check if x<y and swap if true).

The second HP-42s bug is far more interesting: All register values are stored in a matrix called "REGS" on HP-42s. If one were to delete this matrix and then execute a statistic input (i.e. CLV "REGS" then Sigma+), forcing an "Invalid Type" error, RCL and STO in this state will, instead of recalling and storing to registers, directly read from and write to memory. The memory location RCL will read from is calculated as (RegisterNbr + 184) x 16 converted to hexadecimal, and the location STO will write to is (RegisterNbr x 2 + 184) x 16 to hex. Sometimes the offset is also reported as +183 which is due to how resgister on HP-42s is numbered from 00 to 99 and up to the value in SIZE. In that case R00 would count as the first register.

Hardware Mods

Some users have reported success replacing the RAM chip of their HP 42s with up to 32KB of RAM and modifying the LC circuit to force the chip to run at twice and even quadruple the clock speed, approaching the performance of later Clarke and Yorke architectures. Stable operations at high frequency would require using higher-voltage silver oxide batteries.

However it must be noted due to the construction of Pioneers calculators, opening a HP 42s involves drilling heat-stakes and thus will irreversibly reduce its structural integrity.

Tricks

*note: the top row of keys are customarily labeled A-F from left to right.

HP 42s has two resets: Master reset which puts the calculator back to "factory condition", clearing all memory with On+A+F and Machine reset with On+C which interrupts any program and sets the calculator into a set state ready to receive user input again, but does not cause any memory loss.

As with the HP 27S and HP 17B, the self test is triggered with On+D.

On the first screen of the self test routine hitting backspace (<-) will put the calculator in debugger. In this state the Up/Down keys, Divide/Multiply keys, Add/Substraction keys can be used to increment or decrement the current memory address by 1000,100 and 1 nybble(s) respectively. Number keys, and A-F keys will key in (replace) the current memory address with the hexadecimal value 0-9 and A-F and move by 1 nybble forward. Backspace key will refresh the debugger and . (decimal point) key executes from this memory location. the COS key will move the memory address by 10 nybbles and print the memory at that location to IR, which can be then received by a HP-48 using INPRT to dump the ROM.

Memory Layout

In the process of having its ROM dumped and emulators developed (and many exploration prior) the memory layout of the HP-42s became generally well know:

Memory Layout of HP-42s (both side inclusive)
Address Start (hex) Address End (hex) Content Note
ROM 64KB ROM internal to the Lewis chip 00000 1FFFF ROM Executing from 00000 is the only way to exit the debugger without using a reset (and thus pressing the ON key).

Executing from 023F1 (default entry point for debugger) displays the software revision and a one byte warm-start log. (often erroneously reported along with revision, e.g. A7, C5.....)

Display (URAM) 40000 4020B Display Column 0, 66, 1, 67 ........ 64, 130, 65 with 4 nybbles per column for 16 pixels per column, 131 columns in total.
40210 4024C Annunciators Each word contains five nybbles that is either 00000 (off) or FFFFF (on).

40210-40215 is a word that lights up all announciator.

from 40218 to 4024D each word controls multirow, shift, printing, busy, battery low, G and RAD (together forming GRAD) annunciators respectively.

Other Hardware

Registers

40300 4030F I/O registers Analogous to HP-28C, function unclear as there is no external I/O for HP-42s. Hardware CRC at 40304.
403F8 403FF Clock 8 nibbles, counts down at 8192 ticks per second
RAM

(DRAM)

50000-5FFFF

by default 8K repeated 4 times, however a single 32KB 28-pin 300mil SOIC SRAM chip could be soldered and correctly recognized.

50082 50083 Last key One-byte code, see below
50084 50085 Keyboard pointers Head and tail respectively.
50086 500A5 Keyboard buffer Circular 16 bytes buffer, using one-byte code, order from left to right & top to bottom, same as GETKEY, ENTER counts as one key.

Shifted keys are represented by adding 37 to its keycode.

500B8 500DF Pointers Three five nybbles pointers to top of stack, to program END, to REGS variables and then rest of variables list respectively.

Fast Mode

On all revisions of HP-42s there is a one nybble speed variable at memory location 40300 that is set everytime the EXIT(On) key is pressed to 7h. Changing this nybble using the debugger will alter the speed at which HP-42s until EXIT(On) key is pressed for any reason. Setting this nybble to Fh will effectively double the speed at which HP-42s perform calculations and is of major utility when using SOLVER or doing numerical integration. A program is also available to help set this mode automatically on revision A machines when a certain program is XEQ-ed.

An abridged and annotated version of the fast mode procedure is produced below, with reference to the original guide:

  1. Memory modification using debugger (applicable to all revisions):
    1. EXIT + LOG (D) then <- (Backspace) to enter debugger.
    2. Navigate to memory address 40300 using Up/Down, Divide/Multiply, Substract/Add keys, note the leftmost value should be "7"
    3. Write one nybble using keyboard (0h-9h) and top row keys (Ah-Fh) to set desired speed, linearlly scaling with 7h as normal speed. ON key cannot be pressed starting from this step.
    4. Navigate to memory address 00000 (see step 1.2). then press "." (decimal point) to execute from that location. "Machine Reset" should appear.
    5. Verify machine speed has been modified using BEEP command.
  2. Use Bug 2 (see Known Bugs) to automate setting of this mode (applicable to A revision):
    1. modify speed variable using method outlined in Step 1.
    2. Shift+Backspace (CLEAR) then choose "REGS", deleting the variable matrix.
    3. Press Sigma+ (A key), "Invalid Type" error should appear.
    4. key in 16248, then RCL IND STX (keystrokes: RCL, "." (decimal point), A, "." (decimal point), B). This will recall the nybble at address (16248+184) x 16 = 40300h which we just modified.
    5. STO "FAST", store the value we just retrieved for future use in variable "FAST".
    6. Create a program as listed below, optionally named "FAST":
      {59-Byte program} # automatically generated
      LBL "FAST"
      SIGN              # operation to put stack X into last X register
      SF 25             # sets the Error Ignore flag 
      CLX
      RCL "REGS"        # recall the "REGS" matrix, backing it up in stack X
      SIZE 00
      SF 25
      SIGMA+
      8124              # indirect pointer for indirect STO to write to, (8124x2+184)x16=40300h
      X<> "FAST"        # swaps stack X and "FAST", this is the nybble data we edited earlier
      STO IND "FAST"    # indirectly store to patch memory 40300h
      X<> "FAST         # store the nybble data back into "FAST"
      Rv                # rolldown, put backed up "REGS" into X level
      SF25              
      STO "REGS"        # restores the "REGS" matrix as before execution
      Rv
      LASTX             # recalls the last X register
      .END.             # automatically generated
      
      Note that the above program does not preserve register T due to successive roll downs.
    7. Execute above program. "Machine Reset" should appear. Verify machine speed has been successfully modified using "BEEP" command.