10 W = 1:I1 = 7:B1 = 10:B2 = 10:B3 = B1: FOR I = 1 TO 35:Z3$ = Z3$ +" ": NEXT :Z2$ = CHR$(8):MQ = .05: GOSUB 830: GOTO 110
30 POKE -16368,0
40 G = PEEK(49152): IF G <128 THEN 40
50 IF G = 155 THEN 340
60 G = G -128: POKE -16368,0: RETURN
70 YO = ABS(YY):YE = INT(YO):YU = YO -YE: IF YU = <MQ OR W -YU = <MQ THEN YY = YE +(YU >MQ)
80 RETURN
90 IF T <10 THEN T$ = STR$(T): RETURN
100 T$ = CHR$(T +55): RETURN
110 Q$ = "Print Option": GOSUB 460: PRINT "This program will convert an integer or decimal number in one base into the samenumber represented in another base.": PRINT : ONERR GOTO 840
120 PRINT "The limit as to base size will be 36.": PRINT : PRINT "This is because the 26 letters of the alphabet will be used to represent any integer greater than 9.": PRINT : PRINT "Thus, A=10, B=11, C=12, ..., and Z=35."
130 PRINT : PRINT "For example, the number 465879 (Base 10) would be expressed as 9ZH3 (Base 36) because 465879=9x(36x36x36) + 35x(36x36) + 17x(36) + 3, and Z=35 and H=17.": GOSUB 460: PRINT "Decimal results will not be rounded off."
140 VTAB 18: GOSUB 460: PRINT " Use the following word processing aids when entering data:": PRINT "-<Ctrl>P: Push text from under the cursor to the right ->.": PRINT "-<Ctrl>Y: Erase everything under and to the right of the cursor."
150 PRINT "-Delete Key: Pull text to the left and delete at the same time.": GOSUB 460: GOSUB 440
160 PRINT "In what base B1 do you wish to enter your number?": PRINT :Z = B1:B$ = "B1":B1 = 10: GOSUB 540:B1 = Z: GOSUB 570: IF B1 < >B3 THEN NR$ = ""
170 GOSUB 500: VTAB 10: PRINT "In what base B2 will you want to express the above number?" SPC( 12): PRINT : PRINT
316 B1 = B3:B2 = B4:B3 = (RI$ = ML$):AN$ = OA$:A$ = " ":N$ = NN$:ID = DI:L = LO: IF NOT B3 THEN A$ = " approximately "
317 PRINT S$N$" in base "B1: PRINT : PRINT "is"A$"equal to": PRINT : PRINT AN$" in base "B2: GOSUB 460: IF L >0 THEN PRINT "(The above result is not 'rounded off')"
320 PRINT : PRINT : IF ID >0 THEN VTAB 12: POKE 1403,W -1: PRINT "This program would attain no additional accuracy by continuing the calculation": PRINT "beyond the "ID" places shown above."
330 GOSUB 440
340 GOSUB 830:M$(1) = "Repeat 'BASES'":M$(2) = "Return to the disk menu*": VTAB 21: POKE 1403,12: PRINT "*You can insert any 'MATH WORKHORSE' disk at this point."
350 NN = 2:KK = 7:HH = 28:Q$ = "Final Menu": GOSUB 370: IF VV = 8 THEN PRINT : PRINT "<CTRL-0x04>RUNWORKHORSE"
370 VTAB 1: POKE 1403,0: PRINT "BASES";: POKE 1403,65: PRINT "Esc=Final Menu": GOSUB 460: POKE 1403,41 - LEN(Q$)/2 -1: PRINT Q$: GOSUB 460: PRINT "Highlight your option with arrow keys or a number from 1 to "NN"...then hit Return"
380 VV = KK:FF = KK -W: FOR G = W TO NN: VTAB FF +G: POKE 1403,HH -3: PRINT G"."M$(G): NEXT
390 VTAB VV: POKE 1403,HH -1: INVERSE : PRINT M$(VV -FF);: NORMAL : GOSUB 30: IF G >48 AND G <49 +NN THEN VTAB VV: POKE 1403,HH -1: PRINT M$(VV -FF);:VV = G +FF -48: GOTO 390
400 IF G = 13 THEN HOME : RETURN
410 VTAB VV: POKE 1403,HH -1: PRINT M$(VV -FF);: IF G = 21 OR G = 10 THEN VV = VV +W: IF VV = KK +NN THEN VV = KK
420 IF G = 8 OR G = 11 THEN VV = VV -W: IF VV = FF THEN VV = FF +NN
430 GOTO 390
440 IF PR = 0 THEN VTAB 24: POKE 1403,19: INVERSE : PRINT "Hit Return to continue <Esc = final menu>";: NORMAL : GOSUB 30: HOME
450 RETURN
460 POKE 1403,W -1: FOR I = 1 TO 78: PRINT "=";: NEXT : PRINT "=": RETURN
470 TEXT : HOME :M$(1) = "Display on the screen":M$(2) = "Print on the printer":NN = 2:KK = I1:HH = 30: GOSUB 370: IF VV = 7 THEN RETURN
510 VTAB 7: POKE 1403,3: CALL -868: PRINT " "S$;N$:N = VAL(N$): FOR I = 1 TO LEN(N$): IF MID$ (N$,I,W) = "." THEN IR$ = MID$ (N$,W,I -W):DE$ = MID$ (N$,I +W, LEN(N$) -I): GOTO 530
520 NEXT :IR$ = N$:DE$ = ""
530 VTAB 5: POKE 1403,W -1: CALL -868: RETURN
540 POKE 1403,13: CALL -868: PRINT B$" = "Z;:W2$ = STR$(Z):Z3 = 18:LL = 2: GOSUB 600:Z = VAL(W1$): CALL -958: IF Z < > INT(Z) OR Z <2 OR Z >36 THEN PRINT "This must be an integer from 2 to 36.<CTRL-0x07><CTRL-0x07>";: CALL -998:Z = 10: GOTO 540
740 IF Z3 = LL OR W2$ = MID$ (Z3$,1,LL -Z3) THEN 610
750 W2$ = " " + MID$ (W2$,1,LL -Z3 -1): PRINT W2$;: FOR Z2 = 1 TO LL -Z3: PRINT Z2$;: NEXT : GOTO 610
760 IF Z3 = 0 THEN 610
770 W1$ = MID$ (W1$,1,Z3 -1):W2$ = W2$ +" ": PRINT Z2$;W2$;: FOR Z2 = 1 TO LL -Z3 +1: PRINT Z2$;: NEXT : GOTO 610
780 :
790 Z2 = LEN(W1$): IF W1$ = MID$ (Z3$,1,Z2) THEN W1$ = "0": RETURN
800 IF MID$ (W1$,1,1) = " " THEN W1$ = MID$ (W1$,2): GOTO 800
810 Z2 = LEN(W1$): IF MID$ (W1$,Z2) = " " OR MID$ (W1$,Z2) = "." THEN W1$ = MID$ (W1$,1,Z2 -1): GOTO 810
811 Z2 = LEN(W1$): FOR QX = 1 TO Z2: IF MID$ (W1$,QX,1) < >"." THEN NEXT : RETURN
812 QQ = QX:QX = Z2: NEXT : FOR QX = QQ +1 TO Z2: IF MID$ (W1$,QX,1) < >"." THEN NEXT : RETURN
813 W1$ = LEFT$(W1$,QX -1) +"0" + RIGHT$(W1$,Z2 -QX): NEXT
820 RETURN
830 PRINT "<CTRL-0x04>PR#0":PR = 0: PRINT "<CTRL-0x04>PR#3": TEXT : HOME : PRINT : VTAB 1: RETURN
840 GOSUB 830: VTAB 7: POKE 1403,33: PRINT "Error Code " PEEK(222): PRINT : PRINT "The size of some number may be beyond the range of the computer. The calculationcould not be continued.<CTRL-0x07><CTRL-0x07>": GOTO 330