image of READY prompt

Wang2200.org

Listing of file='NUMBERS' on disk='vmedia/tbo_81.wvd.zip'

# Sector 174, program filename = 'NUMBERS'
0010 REM NUMBER CONVERSIONS
   : PRINT HEX(03);"NUMBER CONVERSIONS"
0020 REM %.Purpose
0030 REM .This program converts numbers from one system base to another.
0040 REM %.Function Entries
0050 REM %0. '1 Of a decimal
0060 REM %0 .'2 From a decimal
0070 REM %0. '3 Decimal frm Hex
0080 REM %0.'35 Decimal to base
0090 REM %.Variable meanings
0100 REM %0  A$ Notation grid,       C$ One byte w/a
0110 REM %0  B  Use varies,          B$ Use varies
0120 REM %0  N  Loop control
0130 REM %0  V  Decimal val w/a,     V1 Dec.value keyed
0140 REM %.Housekeeping and CRT menu
0150 REM %0  B  Base number,         B$ Base notation
0160 DIM A$64,C$1
0170 DATA 2,"Binary",8,"Octal",10,"Decimal",16,"Hexadecimal",0
0180 A$="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!@"
0190 PRINT "KEY '1 to find equivalents of given decimals"
0200 PRINT "KEY '2 to find equivalents beginning at a given decimal"
0210 PRINT "KEY '3 to find decimal equivalent of hex value"
0220 STOP "KEY APPROPRIATE SPECIAL FUNCTION"
0230 RETURN
0240 REM %^.'35 CONVERT DECIMAL TO ANY BASE
0250 DEFFN'35(V1)
0260 RESTORE
   : PRINT "BASE  --";TAB(20);"VALUE";
0270 V=V1
   : READ B
   : PRINT
   : IF B=0 THEN 230
   : PRINT B;TAB(5);
0280 READ B$
   : PRINT B$;TAB(18);
0290 C=1
   : N=0
0300 N=N+1
   : C=C*B
   : IF C<=V THEN 300
0310 C=C/B
0320 T=INT(V/C)
0330 PRINT STR(A$,1+T,1);
0340 V=V-(C*T)
   : N=N-1
   : IF N>0THEN 310
0350 GOTO 270
0360 REM % ENTRY S.F. '1 Of a decimal
0370 DEFFN'1
   : INPUT "DECIMAL VALUE",V1
   : GOSUB '35(V1)
   : GOTO 370
0380 REM % ENTRY S.F. '2 From a decimal
0390 DEFFN'2
   : INPUT "Starting decimal value",V1
0400 GOSUB '35(V1)
   : V1=V1+1
   : KEYIN C$,420,420
0410 PRINT "Decimal value = ";V1;" conversion follows"
   : GOTO 400
0420 KEYIN C$,410,410
   : GOTO 420
0430 RETURN CLEAR
   : PRINT "NON-HEX VALUE ENTERED TRY AGAIN"
0440 REM % ENTRY S.F. '3 Decimal from Hex
0445 REM %0  A  Ptr in hex value,    V$ Keyed hex value
0450 REM %0  B  Temp w/a,            B$ One byte temp w/a
0455 REM %0  B$ Hex digit,           C$ Hex digit w/a
0460 DEFFN'3
   : INPUT "HEX VALUE",V$
0470 FOR A=1 TO LEN(V$)
   : B=POS(STR(A$,1,16)=STR(V$,A,1))
   : IF B=0THEN 430
0480  BIN(STR(V$,A,1))=B-1
   : NEXT A
   : B=1
   : V=0
0490 FOR A=LEN(V$) TO 1STEP -1
   : B$=STR(V$,A,1)
   : ROTATE(B$,1)
0500 FOR N=1 TO 4
   : C$=B$
   : ROTATE(C$,7)
   : B$=C$
   : AND (C$,01)
0510  IF C$=HEX(00)THEN 520
   : V=V+B
0520 B=B*2
   : NEXT N
0530 NEXT A
   : PRINT "DECIMAL VALUE =";V
0540 GOTO 460
0550 REM %0  B  Use varies,          B$ Use varies