*The Museum of HP Calculators*

#
HEX-DEC / DEC-HEX for the HP-33E

This program is by Glenn Hayhurst and is used here by permission.

This program is supplied without representation or warranty of any kind.
Glenn Hayhurst and The Museum of HP Calculators therefore assume no responsibility
and shall have no liability, consequential or otherwise, of any kind arising
from the use of this program material or any part thereof.

##
Overview

This is a program that I wrote around 1978 that I used to convert
DECIMAL numbers to HEX numbers when I worked for a company that made
mainframe tape drives. One of my manufacturing jobs was to use a
wirewrap gun to code the serial number into the backplane of the tape
drives in HEX. I had to convert the decimal serial number that was
stamped on the frame to a HEX value and then install the wires in the
correct places bit by bit. after I wrote the first part of the program
I had enough program steps left to write the reverse conversion from
HEX to DECIMAL. It all fit within the 49 step limit of the HP-33E.
This program will convert DECIMAL numbers
in the range of 0-65535 to their HEX
equivalents.

It will also convert HEX numbers in the
range of 0-FFFF to their DECIMAL equivalents.

##
Listing

Key Display
_______________
ENTER 01-31
RCL 5 02-24 5
/ 03-71
g INT 04-32
STO 1 05-23 1
RCL 5 06-24 5
* 07-61
- 08-41
ENTER 09-31
ENTER 10-31
RCL 6 11-24 6
/ 12-71
g INT 13-15 32
STO 2 14-23 2
RCL 6 15-24 6
* 16-61
- 17-41
ENTER 18-31
ENTER 19-31
RCL 7 20-24 7
/ 21-71
g INT 22-15 32
STO 3 23-23 3
RCL 7 24-24 7
* 25-61
- 26-41
g INT 27-15 32
STO 0 28-23 0
RCL 1 29-24 1
f PAUSE 30-14 74
RCL 2 31-24 2
f PAUSE 32-14 74
RCL 3 33-24 3
f PAUSE 34-14 74
RCL 0 35-24 0
GTO 00 36-13 00
RCL 1 37-24 1 <-Entry point for H>D conversion
RCL 5 38-24 5
* 39-61
STO + 0 40-23 51 0
RCL 2 41-24 2
RCL 6 42-24 6
* 43-61
STO + 0 44-23 51 0
RCL 3 45-24 3
RCL 7 46-24 7
* 47-61
STO + 0 48-23 51 0
RCL 0 49-24 0

Enter the program, then store these three
values that are used in the calculations.
4096 STO 5
256 STO 6
16 STO 7

Before running the program for the first
time, hit g RTN. This sets the program
to step 00.

Example:
To convert from DECIMAL to HEX:
43961 ENTER (stores value in Y register)
R/S (run program)

The display will pause with four numbers.
These numbers appear in the order of the
hex value. (See number converstion table below)
10 11 11 9 (Display shows)
A B B 9 (Hex Value)

Example:
To convert from HEX to DECIMAL:
Store the hex values in the following
registers.
I.E. ( HEX ) A B B 9
(DEC equiv) 10 11 11 9
10 STO 1
11 STO 2
11 STO 3
9 STO 0
Then: GSB 37 (entry point for H>D conversion)

The program will run converting the values stored
in registers 1, 2, 3, 0 to a decimal value that is
left in the X register (display).
Answer: 43961

Number conversion table:
HEX DECIMAL
--- -------
0 0
1 1
2 2
... ...
9 9
A 10
B 11
C 12
D 13
E 14
F 15

Registers used:
R0 HEX digit
R1 HEX digit
R2 HEX digit
R3 HEX digit
R4 unused
R5 4096 fixed value for program
R6 256 fixed value for program
R7 16 fixed value for program

Go back to the software library

Go
back to the main exhibit hall