home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1990 May / 1990-05.d64 / dec2hex (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  295b  |  7 lines

  1. 5 print"[147]":poke53280,14:poke53281,6:poke646,14
  2. 10 h$="0123456789abcdef":b=16:b1=2^b:rem b is number of bits
  3. 20 print"convert a decimal number into":print"its hexadecimal equivalent"
  4. 30 input"enter decimal value";n:ifabs(n)>b1-1then30
  5. 40 n$="":ifn<0thenn=b1+n
  6. 50 fori=1tob/4:t=n-(int(n/16)*16):n$=mid$(h$,t+1,1)+n$:n=n/16:nexti:printn$
  7.