Classic Computer Magazine Archive COMPUTE! ISSUE 53 / OCTOBER 1984 / PAGE 10

Atari Hex-To-Decimal Conversion

The hex to decimal conversion program in "Readers' Feedback" in the July 1984 COMPUTE! by Frank Sgabellone is quite powerful. However, the modifications necessary to make it run on an Atari might not be too obvious. The following translation will work on Ataris. The value of C in line 20 can be changed, to vary the number of leading zeros.

H. Earl Hill

GN 10 DIM A$ (16), C$(1)
JN 20 A$ = "0123456789ABCDEF" :? "INPUT
	DEC/HEX (0-65535)" : INPUT A : B =
    1 = C = 3 : D = 16 ^C : ? A;" = $" ; : A = A + 1
JP 30  IF A - D > 1  THEN A = A - D : B = B + 1: GOTO
	30
CA 35  J = 1
JO 40 C$ = A$ ( B, B + J - 1 ) : ? C$ ; : B = 1 : C = C - 1
     : D = 16 ^ C : IF C > - 1 THEN 30
DG 50 ? " { 5 SPACES } " : ? : GOTO 20