home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nibble Magazine
/
nib26b.dsk
/
HEX.DEC.DRIVER.bas
< prev
next >
Wrap
BASIC Source File
|
2023-02-26
|
909b
|
24 lines
10 REM **********************
20 REM * HEX.DEC.DRIVER *
30 REM * BY SCOTT ZIMMERMAN *
40 REM * COPYRIGHT (C) 1985 *
50 REM * BY MICROSPARC, INC *
60 REM * CONCORD, MA 01742 *
70 REM **********************
80 REM
100 IF PEEK(768) < >166 THEN PRINT CHR$(4);"BLOAD HEX.DEC"
120 PRINT : PRINT "D(EC, H(EX, Q(UIT? ";: GET A$: PRINT A$
140 IF A$ = "D" THEN 200
160 IF A$ = "H" THEN 300
180 IF A$ < >"Q" THEN 120
190 END
200 PRINT : INPUT "DEC=";N: IF N <0 OR N >65535 THEN 400
220 HB = INT(N/256):LB = N -HB *256
240 POKE 6,LB: POKE 7,HB
260 CALL 768: GOTO 120
300 PRINT : INPUT "HEX=$";H$:L = LEN(H$): IF L >4 THEN 400
320 N = 0: FOR K = L TO 1 STEP -1
340 N$ = MID$ (H$,K,1): IF N$ > = "0" AND N$ < = "9" THEN H = VAL(N$): GOTO 380
360 H = ASC(N$) -55: IF H <10 OR H >15 THEN 400
380 N = N +H *(16 ^(L -K)): NEXT K: GOTO 220
400 PRINT CHR$(7): GOTO 120