pifty
/
tutes-dump
Archived
1
1
Fork 1
This repository has been archived on 2020-07-15. You can view files and clone it, but cannot push or open issues or pull requests.
tutes-dump/site-tutorials/basic_programs.html

225 lines
7.0 KiB
HTML

<!-- SDF Tutorial Template
======================================================================
Use of this code is entirely optional. It is provided as a sample of
coding style, and a quick way to start a new tutorial for users who
may be beginners with HTML. -->
<style type="text/css">
@import url('http://sdf.org/tutorials/tutorials.css');
</style>
<!-- The title of the tutorial should be the only level-1 header
(<h1>) in the document. -->
<h1>Basic Programs</h1>
<p>A collection of basic programs for running on new and old hardware. Feel free to add your own programs and platforms.</p>
<!-- For longer tutorials, a table of contents is nice. Shorter
tutorials (like this one) really don't need it, so this section can be
omitted. Replace the <ul> tags with <ol> tags for a numbered list. -->
<ul>
<li>
<a href="#TOPS-20">TOPS-20 Programs</a>
<!-- to get an indented section of the list, we simply embed a
list inside of a list item -->
<ul>
<li>
<a href="#B10-MULTI">MULTI</a>
</li>
</ul>
</li>
<li>
<a href="#CDC6500">CDC6500 Programs</a>
<!-- to get an indented section of the list, we simply embed a
list inside of a list item -->
<ul>
<li>
<a href="#6500-MULTI">MULTI</a>
</li>
<li>
<a href="#6500-JDC">Jeferson Disk Cipher</a>
</li>
</ul>
</li>
</ul>
<!-- This is the beginning of a section. It starts with a level-2
heading (<h2>) and has been given an 'id' attribute so that it may be
linked to. -->
<h2 id="TOPS-20">TOPS-20 Programs</h2>
<!-- Remember to always contain your paragraphs in <p> tags. For
strings of code, filenames, commands, etc., which appear inside of a
paragraph, wrap them in <code> tags to differentiate them from the
rest of the paragraph's text. -->
<p>The following programs run on TOPS-20 Basic (BASIC-10)</p>
<!-- For entire blocks of code, place the <code> inside of a <pre>
instead of a <p>. Text inside of a <pre> has its whitespace characters
(space, tab, carriage-return) interpreted literally, unlike text
inside of a <p>. -->
<h3 id="B10-MULTI">Multi</h3>
<p>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!</p>
<pre>
<code>
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
</code>
<p>Here is a example of the output from a run</p>
<samp>
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
</samp>
</pre>
<h2 id="CDC6500">CDC6500 Programs</h2>
<p>The following programs run on CDC6500 Basic</p>
<h3 id="6500-MULTI">Multi</h3>
<p>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!</p>
<pre>
<code>
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
</code>
<p>Here is a example of the output from a run</p>
<samp>
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.
</samp>
</pre>
<h3 id="6500-JDC">Jefferson Disk Cipher</h3>
<p>Some Simple Encryption by tfurrows</p>
<pre>
<code>
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
</code>
<p>Here is a example of the output from a run</p>
<samp>
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.
</samp>
Try running the program with FURCYBLXIKMBNMDDX.
</pre>
$Id: basic_programs.html,v 1.5 2017/01/07 01:00:12 epl692 Exp $