Hex to decimal conversion and 2 byte converter.
Appears on
One individual’s cassette containing a number of programs.
Source Code
9000 REM ** ROCKETTER BBS ** 9005 REM ** 714-630-2488 ** 9010 REM 8/1/N 300/1200 BAUD 9015 REM % % % % % % %O%K% %T%O% %R%U%N% % % % % % 9020 REM PROGRAM IS DESIGNED TO AID IN CONVERTING NUMBERS FOR MACHINE CODE APPLICATIONS 9025 REM MAY BE ADDED TO ANY CURRENT PROGRAM AND RENUMBERED 9030 REM WITH THE DELPHIC TOOLKIT WITHOUT ANY CHANGE 9035 FAST 9040 CLS 9045 GOSUB 9650 9050 LET Y$="TIMEX 1000" 9055 PRINT AT 2,11;Y$ 9060 PRINT AT 3,7;"PROGRAMING UTILITES" 9065 PRINT AT 8,3;"1) HEX TO DEC." 9070 PRINT AT 10,3;"2) DEC TO HEX." 9075 PRINT AT 12,3;"3) 2 BYTE CONVERTER." 9080 PRINT AT 14,3;"4) SAVE PROGRAM." 9085 PRINT AT 16,3;"5) STOP." 9090 PRINT AT 20,6;"% %E%N%T%E%R% %Y%O%U%R% %C%H%O%I%C%E% " 9095 INPUT B 9100 IF B=2 THEN GOTO 9315 9105 IF B=3 THEN GOTO 9480 9110 IF B=4 THEN GOTO 9725 9115 IF B=5 THEN STOP 9120 REM **** HEX TO DEC ***** 9125 REM *********************** 9130 CLS 9135 LET A=8 9140 FAST 9145 GOSUB 9650 9150 SLOW 9155 PRINT AT 2,11;Y$ 9160 PRINT AT 3,3;"** HEX TO DEC CONVERTER **" 9165 PRINT AT 7,10;"""0"" ABORTS";AT 8,6;"""T"" FOR DEC TO HEX" 9170 FOR F=1 TO 2 9175 PRINT AT 20,1;"% %E%N%T%E%R% %H%E%X% %N%U%M%B%E%R% " 9180 FOR J=1 TO 20 9185 NEXT J 9190 PRINT AT 20,1;" ENTER HEX NUMBER " 9195 FOR J=1 TO 20 9200 NEXT J 9205 NEXT F 9210 LET T=0 9215 INPUT H$ 9220 LET D=1 9225 IF H$="0" THEN GOTO 9035 9230 IF H$="T" THEN GOTO 9325 9235 FOR P=LEN (H$)-1 TO 0 STEP -1 9240 LET C=CODE (H$(D TO D)) 9245 LET D=D+1 9250 IF C>=28 AND C<=37 THEN LET C=C-28 9255 IF C>=28 AND C<=37 THEN GOTO 9270 9260 IF C>=38 AND C<=43 THEN LET C=C-28 9265 GOTO 9270 9270 LET T=T+C*16**P 9275 NEXT P 9280 LET A=A+2 9285 IF A>18 THEN GOSUB 9455 9290 PRINT AT A,4;"HEX: ";H$;" = ";T;" DEC" 9295 GOTO 9170 9300 REM *********************** 9305 REM **** DEC TO HEX ***** 9310 REM *********************** 9315 CLS 9320 GOSUB 9650 9325 GOSUB 9455 9330 PRINT AT 3,3;"** DEC TO HEX CONVERTER **" 9335 PRINT AT 8,5;"123456 FOR HEX TO DEC" 9340 LET A=8 9345 LET A=A+2 9350 LET A$="0123456789ABCDEF" 9355 PRINT AT 20,1;"% %E%N%T%E%R% %D%E%C% %N%U%M%B%E%R% " 9360 FOR F=1 TO 20 9365 NEXT F 9370 PRINT AT 20,1;" ENTER DEC NUMBER " 9375 INPUT Q 9380 IF Q=0 THEN GOTO 9035 9385 IF Q=123456 THEN GOTO 9130 9390 IF Q>65535 OR Q<0 THEN PRINT "TRY AGAIN" 9395 IF Q>65535 OR Q<0 THEN GOTO 400 9400 LET D=INT (Q/4096) 9405 LET R=Q-4096*D 9410 LET E=INT (R/256) 9415 LET R=R-256*E 9420 LET H=INT (R/16) 9425 LET L=R-16*H 9430 IF A>18 THEN GOSUB 9455 9435 PRINT AT A,4;"DEC: ";Q;" = "; 9440 IF A>18 THEN GOSUB 9455 9445 PRINT A$(D+1 TO D+1);A$(E+1 TO E+1);A$(H+1 TO H+1);A$(L+1 TO L+1);" HEX" 9450 GOTO 9345 9455 FOR F=2 TO 10 STEP 2 9460 PRINT AT 8+F,4;" " 9465 NEXT F 9470 LET A=10 9475 RETURN 9480 REM *********************** 9485 REM ** 2 BYTE CONVERTER ** 9490 REM *********************** 9495 CLS 9500 FAST 9505 GOSUB 9650 9510 SLOW 9515 PRINT AT 2,10;Y$ 9520 PRINT AT 3,4;"** 2 BYTE CONVERTER **" 9525 FOR F=1 TO 2 9530 FOR J=0 TO 10 9535 NEXT J 9540 PRINT AT 20,1;"% %E%N%T%E%R% %N%U%M%B%E%R% ";AT 20,20;"""0"" ABORTS" 9545 FOR J=0 TO 10 9550 NEXT J 9555 PRINT AT 20,1;" ENTER NUMBER " 9560 NEXT F 9565 INPUT N 9570 GOSUB 9630 9575 IF N=0 THEN GOTO 9035 9580 IF N>65535 OR N<1 THEN GOTO 9700 9585 PRINT AT 8,12;N 9590 REM % %P%L%A%C%E%S% %N%U%M%B%E%R% %I%N%T%O% 9595 REM % %S%Y%S%T%E%M% %V%A%R%I%A%B%L%E% %"%S%E%E%D%" 9600 REM % %T%H%E%N% %H%A%S% %C%O%M%P%U%T%E%R% % % % % 9605 REM % %O%U%T%P%U%T% %C%O%N%T%E%N%T%S% % 9610 RAND N 9615 PRINT AT 10,8;"LEAST BYTE= ";PEEK 16434 9620 PRINT AT 12,8;"MOST BYTE= ";PEEK 16435 9625 GOTO 9525 9630 PRINT AT 8,12;" " 9635 PRINT AT 10,19;" " 9640 PRINT AT 12,19;" " 9645 RETURN 9650 FOR F=0 TO 43 9655 PLOT 0,F 9660 PLOT 63,F 9665 NEXT F 9670 FOR F=0 TO 63 9675 PLOT F,43 9680 PLOT F,32 9685 PLOT F,0 9690 NEXT F 9695 RETURN 9700 PRINT AT 20,1;"% %N%U%M%B%E%R% %T%O% %L%A%R%G%E% %O%R% %T%O% %S%M%A%L%L% % " 9705 FOR F=0 TO 100 9710 NEXT F 9715 PRINT AT 20,1;" " 9720 GOTO 9525 9725 SAVE "2 BYT%E" 9730 GOTO 9035