HEX-DEC converter for 33E/33C Message #1 Posted by Glenn Hayhurst on 3 May 2006, 10:02 a.m.
Here is a program that I wrote several years ago and just found recently. I posted it to the museum curator, but it has not been posted in the programs section yet.
Best Wishes all,
Glenn
-------------
Program for the HP 33E and HP-33C
HEX to DECIMAL
DECIMAL to HEX
by: Glenn Hayhurst - Longmont CO
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.
Program 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.
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
Edited: 3 May 2006, 10:12 a.m. after one or more responses were posted
|