====== Basic Programs ====== A collection of basic programs for running on new and old hardware. Feel free to add your own programs and platforms. ===== TOPS-20 Programs ===== The following programs run on TOPS-20 Basic (BASIC-10) ==== Multi ==== This is a simple multiplication table, altering line 5's data statement lets you change the length of the table. Give it a try, and put some crazy numbers in to see how it goes! 00001 REM Multi by epl692 00002 REM Change line 5 to alter the length of the table, try 24, or even 240. 00005 DATA 12 00100 READ T 00110 A$ = "#### " 00120 FOR X=1 TO T 00130 FOR Y=1 TO 12 00140 PRINT USING A$,X*Y; 00150 IF Y=12 THEN 00160 ELSE 00170 00160 PRINT "" 00170 REM NOTHING HERE 00180 NEXT Y 00190 NEXT X 00200 END Here is a example of the output from a run MULTI.B20 Sunday, October 16, 2016 08:58:02 1 2 3 4 5 6 7 8 9 10 11 12 2 4 6 8 10 12 14 16 18 20 22 24 3 6 9 12 15 18 21 24 27 30 33 36 4 8 12 16 20 24 28 32 36 40 44 48 5 10 15 20 25 30 35 40 45 50 55 60 6 12 18 24 30 36 42 48 54 60 66 72 7 14 21 28 35 42 49 56 63 70 77 84 8 16 24 32 40 48 56 64 72 80 88 96 9 18 27 36 45 54 63 72 81 90 99 108 10 20 30 40 50 60 70 80 90 100 110 120 11 22 33 44 55 66 77 88 99 110 121 132 12 24 36 48 60 72 84 96 108 120 132 144 Compile time: 0.005 secs Run time: 0.026 secs Elapsed time: 0:00:00 ===== CDC6500 Programs ===== The following programs run on CDC6500 Basic ==== Multi ==== This is a simple multiplication table, altering line 5's data statement lets you change the length of the table. Give it a try, and put some crazy numbers in to see how it goes! 1 REM Multi by epl692 2 REM Change line 5 to alter the length of the table, try 24, or even 240. 5 DATA 12 100 READ T 110 A$ = "#### " 120 FOR X=1 TO T 130 FOR Y=1 TO 12 140 PRINT USING A$,X*Y; 150 IF Y=12 THEN 160 ELSE 170 160 PRINT "" 170 REM NOTHING HERE 180 NEXT Y 190 NEXT X 200 END Here is a example of the output from a run 17/01/06. 16.25.32. PROGRAM MULTI 1 2 3 4 5 6 7 8 9 10 11 12 2 4 6 8 10 12 14 16 18 20 22 24 3 6 9 12 15 18 21 24 27 30 33 36 4 8 12 16 20 24 28 32 36 40 44 48 5 10 15 20 25 30 35 40 45 50 55 60 6 12 18 24 30 36 42 48 54 60 66 72 7 14 21 28 35 42 49 56 63 70 77 84 8 16 24 32 40 48 56 64 72 80 88 96 9 18 27 36 45 54 63 72 81 90 99 108 10 20 30 40 50 60 70 80 90 100 110 120 11 22 33 44 55 66 77 88 99 110 121 132 12 24 36 48 60 72 84 96 108 120 132 144 SRU 0.366 UNTS. RUN COMPLETE. ==== Jefferson Disk Cipher ==== Some Simple Encryption by tfurrows 001 REM Jefferson Disk Cipher, tfurrows@sdf.org 100 REM Setup the disks 101 104 DIM A$(16) 105 A$(1)="PDN HCAUBKQXEOZVRMGYJSFTWIL" 106 A$(2)="ECSGFONUHMR YXDZPTLQAJBWVKI" 107 A$(3)="TYFPZJS UNBWLXQREACDIOHMVKG" 108 A$(4)="XHTNOZSFUJKREDQAC MGPBLYWIV" 109 A$(5)="CPOMQZA TRFBGIWDLVHESJUKNXY" 110 A$(6)="SXCOFRKJZVEG BAPWDNIHLQMUTY" 111 A$(7)="H CLKIOZFSUPGREDBNVTYMAJWQX" 112 A$(8)="NTAJULBWZYCPDSR HVMIFGKOXEQ" 113 A$(9)="MHWNPZVLXCYJRKUSOEFADI TBGQ" 114 A$(10)="UVEZHPSDNAYLJQTXWFBG CKIROM" 115 A$(11)="ICNTHWZE LRMSQFGDAKXYJBOVUP" 116 A$(12)="SEMB QTFLPIOZCUKYVRDWXJHGNA" 117 A$(13)="RFTJWUZV HIYQOSLCMEXGDKPNAB" 118 A$(14)="EM FNZPGUQROYVXCBAHTISWDLKJ" 119 A$(15)="QPSGZDLNCIOUJK EXRAYHWFMTVB" 120 A$(16)="GSFYRQBDI ALKXPVUTZJONEWCHM" 121 150 PRINT "Enter message to encode/decode" 151 INPUT M$ 152 200 REM Loop through message and set the jefferson disks 205 210 FOR I = 1 to LEN(M$) 215 C=C+1 220 IF C>16 THEN C=1 225 L = POS(A$(C),SUBSTR(M$,I,1),1) 230 IF L < LEN(A$(C)) THEN PRINT SUBSTR(A$(C),L+1,LEN(A$(C))-L); 235 IF L > 1 THEN PRINT SUBSTR(A$(C),1,L) ELSE PRINT SUBSTR(A$(C),1,1) 240 NEXT i Here is a example of the output from a run 17/01/06. 16.50.11. PROGRAM JDC ENTER MESSAGE TO ENCODE/DECODE ? THE CAKE IS A LIE WILPDN HCAUBKQXEOZVRMGYJSFT MR YXDZPTLQAJBWVKIECSGFONUH ACDIOHMVKGTYFPZJS UNBWLXQRE MGPBLYWIVXHTNOZSFUJKREDQAC POMQZA TRFBGIWDLVHESJUKNXYC PWDNIHLQMUTYSXCOFRKJZVEG BA IOZFSUPGREDBNVTYMAJWQXH CLK QNTAJULBWZYCPDSR HVMIFGKOXE TBGQMHWNPZVLXCYJRKUSOEFADI ROMUVEZHPSDNAYLJQTXWFBG CKI QFGDAKXYJBOVUPICNTHWZE LRMS QTFLPIOZCUKYVRDWXJHGNASEMB BRFTJWUZV HIYQOSLCMEXGDKPNA FNZPGUQROYVXCBAHTISWDLKJEM NCIOUJK EXRAYHWFMTVBQPSGZDL ALKXPVUTZJONEWCHMGSFYRQBDI OZVRMGYJSFTWILPDN HCAUBKQXE SRU 0.308 UNTS. RUN COMPLETE. Try running the program with FURCYBLXIKMBNMDDX. $Id: basic_programs.html,v 1.5 2017/01/07 01:00:12 epl692 Exp $ [[http://sdf.org/?tutorials/basic_programs|Basic Programs]] - traditional link (using [[wp>Revision_Control_System|RCS]])