SP4CEBAR 2023-01-24 20:03
It supports hexadecimal values of any size, well... as long as it fits in a float
SUB HEXDEC(HEX_$,DEC_)
DEC_=0
L=LEN(HEX_$)
FOR I=1 TO L
V$ = MID$(HEX_$,I,1)
V = ASC(V$)-48
IF V>9 THEN ADD V,-7
ADD DEC_,V*16^(L-I)
NEXT I
END SUB
SP4CEBAR 2023-01-25 09:47 (Edited)
In @nathanielbabiak's notes on NX It says that: "VAL("0X"+NUMERALS$) converts hex."
This means that you can simplify this subprogram to:
HEXDEC(HEX_$,DEC_)
DEC_=VAL("0X"+HEX_$)
END SUB