DHHD

Display

(HP-41CX, Hewlett Packard 1983 and DM41X, SwissMicros 2020)
 

Overview
Programs DHHD, D-H and H-D convert decimal to hexadecimal numbers and vice versa. The DHHD program combines both ways conversions and programs the “D” and “H” keys in User Mode for direct access to the respective conversions.
Many conversion programs have been created by several users aiming to build with the least number of bytes for the programs. The ones in this document require HP-41CX functions AROT, XTOA and ATOX.
 

Conversions
The decimal versus hexadecimal values are shown below for the base range:

Decimal:     0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15
Hexadecimal: 0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F

The conversion from hexadecimal to decimal is simply straightforward. The base 16 is to be used as follows for the hexadecimal number 35DA816:

    8:  8x160 =      8
    A: 10x161 =    160
    D: 13x162 =   3328
    5:  5x163 =  20480
    3:  3x164 = 196608 +
                22058410

Converting this number 220584 to a hexadecimal requires a division by 16 as follows:

220584/16 = 13786.5000 ⇒ remainder 16*0.5000 =  8 ⇒ 816
 13786/16 =   861.6250 ⇒ remainder 16*0.6250 = 10 ⇒ A16
   861/16 =    53.8125 ⇒ remainder 16*0.8125 = 13 ⇒ D16
    53/16 =     3.3125 ⇒ remainder 16*0.3125 =  5 ⇒ 516
     3/16 =     0.1875 ⇒ remainder 16*0.1875 =  3 ⇒ 316
                                                 35DAB16

 

Example 1: D-H

 

Example 2: H-D

 

Example 3: DHHD

 

Program Listing
The listing of programs D-H, H-D and DHHD is given below:

 

Registers, Labels and Flags

 

Downloads
PDF format of program DHHD.
RAW/TXT format of program DHHD (in zip file).
 

This program is copyright and is supplied without representation or warranty of any kind. The author assumes 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

© 2006-2020 by Auke Hoekstra

 
Don`t copy text!