diff --git a/assets/disk0/home/basic/amazing.bas b/assets/disk0/home/basic/amazing.bas
index a690d70..9d084f9 100644
--- a/assets/disk0/home/basic/amazing.bas
+++ b/assets/disk0/home/basic/amazing.bas
@@ -1,26 +1,14 @@
1 OPTIONBASE 1
10 PRINT SPC(28);"AMAZING PROGRAM"
20 PRINT SPC(15);"CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"
-30 PRINT
-31 PRINT
-32 PRINT
-33 PRINT
-100 PRINT "WHAT ARE YOUR WIDTH";
-101 INPUT H
-102 PRINT "WHAT ARE YOUR LENGTH";
-103 INPUT V
+30 PRINT:PRINT:PRINT
+100 PRINT "WHAT ARE YOUR WIDTH";:INPUT H
+102 PRINT "WHAT ARE YOUR LENGTH";:INPUT V
105 IF H<>1 AND V<>1 THEN GOTO 110
-106 PRINT "MEANINGLESS DIMENSIONS. TRY AGAIN."
-107 GOTO 100
-110 WS=DIM(H,V)
-111 VS=DIM(H,V)
-120 PRINT
-130 PRINT
-140 PRINT
-150 PRINT
-160 Q=0
-161 Z=0
-162 X=INT(RND(1)*H+1)
+106 PRINT "MEANINGLESS DIMENSIONS. TRY AGAIN.":GOTO 100
+110 WS=DIM(H,V):VS=DIM(H,V)
+120 PRINT:PRINT:PRINT:PRINT
+160 Q=0:Z=0:X=INT(RND(1)*H+1)
165 FOR I=1 TO H
170 IF I==X THEN GOTO 173
171 PRINT ".--";
@@ -28,20 +16,13 @@
173 PRINT ". ";
180 NEXT
190 PRINT "."
-195 C=1
-196 WS(X,1)=C
-197 C=C+1
-200 R=X
-201 S=1
-202 GOTO 260
+195 C=1:WS(X,1)=C:C=C+1
+200 R=X:S=1:GOTO 260
210 IF R<>H THEN GOTO 240
215 IF S<>V THEN GOTO 230
-220 R=1
-221 S=1
+220 R=1:S=1
222 GOTO 250
-230 R=1
-231 S=S+1
-232 GOTO 250
+230 R=1:S=S+1:GOTO 250
240 R=R+1
250 IF WS(R,S)==0 THEN GOTO 210
260 IF R-1==0 THEN GOTO 530
@@ -51,45 +32,30 @@
290 IF R==H THEN GOTO 330
300 IF WS(R+1,S)<>0 THEN GOTO 330
310 X=INT(RND(1)*3+1)
-320 REM ON X GOTO 790,820,860
-321 IF X==1 THEN GOTO 790
-322 IF X==2 THEN GOTO 820
-323 IF X==3 THEN GOTO 860
-330 IF S<>V THEN GOTO 340
+320 ON X GOTO 790,820,860
334 IF Z==1 THEN GOTO 370
-338 Q=1
-339 GOTO 350
+338 Q=1:GOTO 350
340 IF WS(R,S+1)<>0 THEN GOTO 370
350 X=INT(RND(1)*3+1)
-360 REM ON X GOTO 790,820,910
-361 IF X==1 THEN GOTO 790
-362 IF X==2 THEN GOTO 820
-363 IF X==3 THEN GOTO 910
+360 ON X GOTO 790,820,910
370 X=INT(RND(1)*2+1)
-380 REM ON X GOTO 790,820
+380 ON X GOTO 790,820
390 IF R==H THEN GOTO 470
400 IF WS(R+1,S)<>0 THEN GOTO 470
405 IF S<>V THEN GOTO 420
410 IF Z==1 THEN GOTO 450
-415 Q=1
-416 GOTO 430
+415 Q=1:GOTO 430
420 IF WS(R,S+1)<>0 THEN GOTO 450
430 X=INT(RND(1)*3+1)
-440 REM ON X GOTO 790,860,910
-441 IF X==1 THEN GOTO 790
-442 IF X==2 THEN GOTO 860
-443 IF X==3 THEN GOTO 910
+440 ON X GOTO 790,860,910
450 X=INT(RND(1)*2+1)
-460 REM ON X GOTO 790,860
+460 ON X GOTO 790,860
470 IF S<>V THEN GOTO 490
480 IF Z==1 THEN GOTO 520
-485 Q=1
-486 GOTO 500
+485 Q=1:GOTO 500
490 IF WS(R,S+1)<>0 THEN GOTO 520
500 X=INT(RND(1)*2+1)
-510 REM ON X GOTO 790,910
-511 IF X==1 THEN GOTO 790
-512 IF X==2 THEN GOTO 910
+510 ON X GOTO 790,910
520 GOTO 790
530 IF S-1==0 THEN GOTO 670
540 IF WS(R,S-1)<>0 THEN GOTO 670
@@ -97,98 +63,67 @@
547 IF WS(R+1,S)<>0 THEN GOTO 610
550 IF S<>V THEN GOTO 560
552 IF Z==1 THEN GOTO 590
-554 Q=1
-555 GOTO 570
+554 Q=1:GOTO 570
560 IF WS(R,S+1)<>0 THEN GOTO 590
570 X=INT(RND(1)*3+1)
-580 REM ON X GOTO 820,860,910
-581 IF X==0 THEN GOTO 820
-582 IF X==1 THEN GOTO 860
-583 IF X==2 THEN GOTO 910
+580 ON X GOTO 820,860,910
590 X=INT(RND(1)*2+1)
-600 REM ON X GOTO 820,860
-601 IF X==1 THEN GOTO 820
-602 IF X==2 THEN GOTO 860
+600 ON X GOTO 820,860
610 IF S<>V THEN GOTO 630
620 IF Z==1 THEN GOTO 660
-625 Q=1
-626 GOTO 640
+625 Q=1:GOTO 640
630 IF WS(R,S+1)<>0 THEN GOTO 660
640 X=INT(RND(1)*2+1)
-650 REM ON X GOTO 820,910
-651 IF X==0 THEN GOTO 820
-652 IF X==1 THEN GOTO 910
+650 ON X GOTO 820,910
660 GOTO 820
670 IF R==H THEN GOTO 740
680 IF WS(R+1,S)<>0 THEN GOTO 740
685 IF S<>V THEN GOTO 700
690 IF Z==1 THEN GOTO 730
-695 Q=1
-696 GOTO 830
+695 Q=1:GOTO 830
700 IF WS(R,S+1)<>0 THEN GOTO 730
710 X=INT(RND(1)*2+1)
-720 REM ON X GOTO 860,910
-721 IF X==0 THEN GOTO 860
-722 IF X==1 THEN GOTO 910
+720 ON X GOTO 860,910
730 GOTO 860
740 IF S<>V THEN GOTO 760
750 IF Z==1 THEN GOTO 780
-755 Q=1
-756 GOTO 770
+755 Q=1:GOTO 770
760 IF WS(R,S+1)<>0 THEN GOTO 780
770 GOTO 910
780 GOTO 1000
790 WS(R-1,S)=C
-800 C=C+1
-801 VS(R-1,S)=2
-802 R=R-1
+800 C=C+1:VS(R-1,S)=2:R=R-1
810 IF C==H*V+1 THEN GOTO 1010
-815 Q=0
-816 GOTO 260
+815 Q=0:GOTO 260
820 WS(R,S-1)=C
830 C=C+1
-840 VS(R,S-1)=1
-841 S=S-1
-842 IF C==H*V+1 THEN GOTO 1010
-850 Q=0
-851 GOTO 260
+840 VS(R,S-1)=1:S=S-1:IF C==H*V+1 THEN GOTO 1010
+850 Q=0:GOTO 260
860 WS(R+1,S)=C
-870 C=C+1
-871 IF VS(R,S)==0 THEN GOTO 880
-875 VS(R,S)=3
-876 GOTO 890
+870 C=C+1:IF VS(R,S)==0 THEN GOTO 880
+875 VS(R,S)=3:GOTO 890
880 VS(R,S)=2
890 R=R+1
900 IF C==H*V+1 THEN GOTO 1010
905 GOTO 530
910 IF Q==1 THEN GOTO 960
-920 WS(R,S+1)=C
-921 C=C+1
-922 IF VS(R,S)==0 THEN GOTO 940
-930 VS(R,S)=3
-931 GOTO 950
+920 WS(R,S+1)=C:C=C+1:IF VS(R,S)==0 THEN GOTO 940
+930 VS(R,S)=3:GOTO 950
940 VS(R,S)=1
-950 S=S+1
-951 IF C==H*V+1 THEN GOTO 1010
+950 S=S+1:IF C==H*V+1 THEN GOTO 1010
955 GOTO 260
960 Z=1
970 IF VS(R,S)==0 THEN GOTO 980
-975 VS(R,S)=3
-976 Q=0
-977 GOTO 1000
-980 VS(R,S)=1
-981 Q=0
-982 R=1
-983 S=1
-984 GOTO 250
+975 VS(R,S)=3:Q=0:GOTO 1000
+980 VS(R,S)=1:Q=0:R=1:S=1:GOTO 250
1000 GOTO 210
1010 FOR J=1 TO V
-1011 PRINT "I";
+1011 PRINT "|";
1012 FOR I=1 TO H
1013 IF VS(I,J)<2 THEN GOTO 1030
1020 PRINT " ";
1021 GOTO 1040
-1030 PRINT " I";
+1030 PRINT " |";
1040 NEXT
1041 PRINT
1043 FOR I=1 TO H
diff --git a/assets/disk0/home/basic/fn.bas b/assets/disk0/home/basic/fn.bas
new file mode 100644
index 0000000..68ea015
--- /dev/null
+++ b/assets/disk0/home/basic/fn.bas
@@ -0,0 +1,9 @@
+10 DEFUN POW2(N)=2^N
+20 DEFUN DCOS(N)=COS(PI*N/180)
+30 FOR X=0 TO 8
+40 PRINT X,POW2(X)
+50 NEXT
+60 PRINT "----------------"
+70 FOREACH A=0!45!90!135!180!NIL
+80 PRINT A,DCOS(A)
+90 NEXT
diff --git a/assets/disk0/home/basic/hamurabi.bas b/assets/disk0/home/basic/hamurabi.bas
index 3e7566f..890e537 100644
--- a/assets/disk0/home/basic/hamurabi.bas
+++ b/assets/disk0/home/basic/hamurabi.bas
@@ -1,28 +1,14 @@
10 PRINT SPC(32);"HAMURABI"
20 PRINT SPC(15);"CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"
-30 PRINT
-31 PRINT
-32 PRINT
+30 PRINT:PRINT:PRINT
80 PRINT "TRY YOUR HAND AT GOVERNING ANCIENT SUMERIA"
-90 PRINT "FOR A TEN-YEAR TERM OF OFFICE."
-91 PRINT
-95 D1=0
-96 P1=0
-100 Z=0
-101 P=95
-102 S=2800
-103 H=3000
-104 E=H-S
-110 Y=3
-111 A=H/Y
-112 I=5
-113 Q=1
+90 PRINT "FOR A TEN-YEAR TERM OF OFFICE.":PRINT
+95 D1=0:P1=0
+100 Z=0:P=95:S=2800:H=3000:E=H-S
+110 Y=3:A=H/Y:I=5:Q=1
210 D=0
-215 PRINT
-216 PRINT
-217 PRINT "HAMURABI: I BEG TO REPORT TO YOU,"
-218 Z=Z+1
-219 PRINT "IN YEAR ";Z;", ";D;" PEOPLE STARVED, ";I;" CAME TO THE CITY,"
+215 PRINT:PRINT:PRINT "HAMURABI: I BEG TO REPORT TO YOU,":Z=Z+1
+217 PRINT "IN YEAR ";Z;", ";D;" PEOPLE STARVED, ";I;" CAME TO THE CITY,"
220 P=P+I
227 IF Q>0 THEN GOTO 230
228 P=INT(P/2)
@@ -44,9 +30,7 @@
324 GOSUB 710
325 GOTO 320
330 IF Q==0 THEN GOTO 340
-331 A=A+Q
-332 S=S-Y*Q
-333 C=0
+331 A=A+Q:S=S-Y*Q:C=0
334 GOTO 400
340 PRINT "HOW MANY ACRES DO YOU WISH TO SELL";
341 INPUT Q
@@ -54,9 +38,7 @@
343 IF QC/2 THEN GOTO 530
523 REM *** RATS ARE RUNNING WILD!!
diff --git a/assets/disk0/home/basic/rallycomposition.bas b/assets/disk0/home/basic/rallycomposition.bas
new file mode 100644
index 0000000..23f1089
--- /dev/null
+++ b/assets/disk0/home/basic/rallycomposition.bas
@@ -0,0 +1,4 @@
+10 DEFUN SINC(X)=IF X==0 THEN 1 ELSE SIN(X)/X
+20 DEFUN THREEDIGITS(X)=ROUND(X*1000)/1000
+100 K=MAP(THREEDIGITS<~SINC,1 TO 10)
+110 PRINT K
diff --git a/assets/disk0/home/basic/sqrt.bas b/assets/disk0/home/basic/sqrt.bas
index 2fc2960..641b113 100644
--- a/assets/disk0/home/basic/sqrt.bas
+++ b/assets/disk0/home/basic/sqrt.bas
@@ -1,10 +1,6 @@
-1 REM Calculates a square root using newtonian method
-10 INPUT X
-11 IF TYPEOF(X)=="num" THEN GOTO 20
-12 PRINT "Please type in a number, please";
-13 GOTO 10
-20 Y = 0.5 * X
-30 Z = Y
-40 Y = Y-(((Y^2)-X)/(2*Y))
-50 IF Z <> Y THEN GOTO 30
+10 X=1337
+20 Y=0.5*X
+30 Z=Y
+40 Y=Y-((Y^2)-X)/(2*Y)
+50 IF NOT(Z==Y) THEN GOTO 30 : REM 'NOT(Z==Y)' can be rewritten to 'Z<>Y'
100 PRINT "Square root of ";X;" is approximately ";Y
diff --git a/assets/disk0/home/basic/tri.bas b/assets/disk0/home/basic/tri.bas
index d7c0e1c..f51854f 100644
--- a/assets/disk0/home/basic/tri.bas
+++ b/assets/disk0/home/basic/tri.bas
@@ -1,6 +1,10 @@
-10 FOR I = 1 TO 20
-20 PRINT SPC(20-I);
-30 FOR J = 1 TO I*2-1
-40 PRINT "*";
-50 NEXT:PRINT
-60 NEXT
+10 GOTO 1000
+100 REM subroutine to draw a segment. Size is stored to 'Q'
+110 PRINT SPC(20-Q);
+120 FOR Q1=1 TO Q*2-1
+130 PRINT "*";
+140 NEXT : PRINT
+150 RETURN
+1000 FOR Q=1 TO 20
+1010 GOSUB 100
+1020 NEXT
diff --git a/assets/disk0/home/basic/tri2.bas b/assets/disk0/home/basic/tri2.bas
new file mode 100644
index 0000000..bbede63
--- /dev/null
+++ b/assets/disk0/home/basic/tri2.bas
@@ -0,0 +1,12 @@
+10 GOTO 1000
+100 REM subroutine to draw a segment. Size is stored to 'Q'
+110 PRINT SPC(20-Q);
+120 Q1=1 : REM loop counter for this subroutine
+130 PRINT "*";
+140 Q1=Q1+1
+150 IF Q1<=Q*2-1 THEN GOTO 130
+160 PRINT : RETURN : REM this line will take us back from the jump
+1000 Q=1 : REM this is our loop counter
+1010 GOSUB 100
+1020 Q=Q+1
+1030 IF Q<=20 THEN GOTO 1010
diff --git a/assets/disk0/tbas/basic.js b/assets/disk0/tbas/basic.js
index 3052cd3..73559a0 100644
--- a/assets/disk0/tbas/basic.js
+++ b/assets/disk0/tbas/basic.js
@@ -1239,7 +1239,7 @@ if no arg text were given (e.g. "10 NEXT"), args will have zero length
if (jmpTarget === undefined)
return undefined;
- return bStatus.builtin[jmpFun](lnum, stmtnum, [jmpTarget]);
+ return bStatus.builtin[jmpFun].f(lnum, stmtnum, [jmpTarget]);
}},
"MIN" : {f:function(lnum, stmtnum, args) {
return twoArg(lnum, stmtnum, args, (lh,rh) => (lh > rh) ? rh : lh);
diff --git a/assets/disk0/tbas/doc/facmap.bas b/assets/disk0/tbas/doc/facmap.bas
deleted file mode 100644
index 854a003..0000000
--- a/assets/disk0/tbas/doc/facmap.bas
+++ /dev/null
@@ -1,3 +0,0 @@
-10 DEFUN FAC(N)=IF N==0 THEN 1 ELSE N*FAC(N-1)
-20 K=MAP FAC, 1 TO 10
-30 PRINT K
diff --git a/assets/disk0/tbas/doc/facrec.bas b/assets/disk0/tbas/doc/facrec.bas
deleted file mode 100644
index 5ca49fb..0000000
--- a/assets/disk0/tbas/doc/facrec.bas
+++ /dev/null
@@ -1,4 +0,0 @@
-10 DEFUN FAC(N)=IF N==0 THEN 1 ELSE N*FAC(N-1)
-20 FOR K=1 TO 6
-30 PRINT FAC(K)
-40 NEXT
diff --git a/assets/disk0/tbas/doc/fib.bas b/assets/disk0/tbas/doc/fib.bas
deleted file mode 100644
index 17e7b3b..0000000
--- a/assets/disk0/tbas/doc/fib.bas
+++ /dev/null
@@ -1,4 +0,0 @@
-10 DEFUN FIB(N)=IF N==0 THEN 0 ELSE IF N==1 THEN 1 ELSE FIB(N-1)+FIB(N-2)
-20 FOR K=1 TO 12
-30 PRINT FIB(K);" ";
-40 NEXT
diff --git a/assets/disk0/tbas/doc/langguide.tex b/assets/disk0/tbas/doc/langguide.tex
index 2539c6c..0a4ec58 100644
--- a/assets/disk0/tbas/doc/langguide.tex
+++ b/assets/disk0/tbas/doc/langguide.tex
@@ -19,36 +19,55 @@ Oh \emph{boy} we just did a computation! It printed out \code{4} which is a corr
Following program attempts to calculate a square root of the input value, showing how \code{GOTO} can be used in such manner.
\begin{lstlisting}
-10 X = 1337
-20 Y = 0.5 * X
-30 Z = Y
-40 Y = Y-(((Y^2)-X)/(2*Y))
+10 X=1337
+20 Y=0.5*X
+30 Z=Y
+40 Y=Y-((Y^2)-X)/(2*Y)
50 IF NOT(Z==Y) THEN GOTO 30 : REM 'NOT(Z==Y)' can be rewritten to 'Z<>Y'
100 PRINT "Square root of ";X;" is approximately ";Y
\end{lstlisting}
Here, \code{GOTO} in line 50 is used to perform a loop, which keeps looping until \code{Z} and \code{Y} becomes equal. This is a newtonian method of approximating a square root.
-\section[When GOTO Is Bad]{Severe Acute Spaghettification Syndrome}
+\section[Subroutine with GOSUB]{What If We Wanted to Go Back?}
+But \code{GOTO} only jumps, you can't jump \emph{back}. Well, not with that attitute; you \emph{can} go back with \code{GOSUB} and \code{RETURN} statement.
+This program will draw a triangle, where the actual drawing part is on line 100--160, and only get jumped into it when needed.
-\section[Subroutine with GOSUB]{GOSUB to the rescue!}
+\begin{lstlisting}
+10 GOTO 1000
+100 REM subroutine to draw a segment. Size is stored to 'Q'
+110 PRINT SPC(20-Q);
+120 Q1=1 : REM loop counter for this subroutine
+130 PRINT "*";
+140 Q1=Q1+1
+150 IF Q1<=Q*2-1 THEN GOTO 130
+160 PRINT : RETURN : REM this line will take us back from the jump
+1000 Q=1 : REM this is our loop counter
+1010 GOSUB 100
+1020 Q=Q+1
+1030 IF Q<=20 THEN GOTO 1010
+\end{lstlisting}
\section[FOR--NEXT Loop]{FOR ever loop NEXT}
-So you can make a loop using \code{GOTO}s here and there, but they \emph{totally suck}, too much spaphetti crashes your cerebral cortex faster than \emph{Crash Bandicoot 2}. Fortunately, there's better way to go about that: the FOR--NEXT loop!
+As we've just seen, you can make loops using \code{GOTO}s here and there, but they \emph{totally suck}, too much spaphetti crashes your cerebral cortex faster than \emph{Crash Bandicoot 2}. Fortunately, there's a better way to go about that: the FOR--NEXT loop!
\begin{lstlisting}
-10 FOR I = 1 TO 20
-20 PRINT SPC(20-I);
-30 FOR J = 1 TO I*2-1
-40 PRINT "*";
-50 NEXT:PRINT
-60 NEXT
+10 GOTO 1000
+100 REM subroutine to draw a segment. Size is stored to 'Q'
+110 PRINT SPC(20-Q);
+120 FOR Q1=1 TO Q*2-1
+130 PRINT "*";
+140 NEXT : PRINT
+150 RETURN
+1000 FOR Q=1 TO 20
+1010 GOSUB 100
+1020 NEXT
\end{lstlisting}
-When executed, this program print out triangles of stars. Still not convinced? Try to write a same program with \code{GOTO}s.
+When executed, this program print out \emph{exactly the same} triangle, but code is much more straightforward thanks to the \code{FOR} statement.
\section[Get User INPUT]{Isn't It Nice To Have a Computer That Will Question You?}
@@ -67,17 +86,22 @@ This short program will ask your name, and then it will greet you by the name yo
Consider the following code:
\begin{lstlisting}
-(code with many repeating phrases)
+10 DEFUN POW2(N)=2^N
+20 DEFUN DCOS(N)=COS(PI*N/180)
+30 FOR X=0 TO 8
+40 PRINT X,POW2(X)
+50 NEXT
+60 PRINT "----------------"
+70 FOREACH A=0!45!90!135!180!NIL
+80 PRINT A,DCOS(A)
+90 NEXT
\end{lstlisting}
-As you can clearly see, it has way too many repeating phrase: \code{i'm redundant!} Would it be nice to tidy it up, but much cooler and in \emph{one-liner}?
+Here, we have defined two functions to use in the program: \code{POW2} and \code{DCOS2}. Also observe that functions are defined using variable \code{N}s, but we use them with \code{X} in line 40 and with \code{A} in line 80: yes, functions can have their local name so you don't have to carefully choose which variable name to use in your subroutine.
-Lo and behold, the \code{DEFUN}! You can define a \emph{function} in a single line using it, and it even re-names the variable so you don't have to worry about unintended name collisions like when you were playing with \code{GOSUB}s!
-
-\begin{lstlisting}
-(same code but better)
-\end{lstlisting}
+Except a function can't have statements that spans 2- or more BASIC lines; but there are ways to get around that, including \code{DO} statement and \emph{functional currying}.
+This sample program also shows \code{FOREACH} statement, which is same as \code{FOR} but works with arrays.
\section[Recursion]{BRB: Bad Recursion BRB: Bad Recursion BRB: Bad Recursion BRB: Bad RecursionBRB: Bad Recursion BRBRangeError: Maximum call stack size exceeded}
@@ -129,7 +153,7 @@ Here, \code{K} will contain the values of $1!$, $2!$ \ldots\ $10!$. We're just p
\section[Currying]{Haskell Curry Wants to Know Your Location}
\label{currying101}
-So what the fsck is currying? Consider the following code:
+Two pages ago there was a mentioning about something called \emph{functional currying}. So what the fsck is currying? Consider the following code:
\begin{lstlisting}
10 DEFUN F(K,T)=ABS(T)==K
diff --git a/assets/disk0/tbas/doc/langref.tex b/assets/disk0/tbas/doc/langref.tex
index 4741dd2..2d628d6 100644
--- a/assets/disk0/tbas/doc/langref.tex
+++ b/assets/disk0/tbas/doc/langref.tex
@@ -251,6 +251,19 @@ Code & Operation & Result \\
\emph{Currying} is an operation that returns new function that has given value applied to the original function's first parameter. See \ref{currying101} for tutorials.
+\section{Constants}
+
+Some variables are pre-defined on the language itself and cannot be modified; such variables are called \emph{constants}.
+
+\begin{tabulary}{\textwidth}{rlL}
+Name & Type & Value \\
+\hline
+NIL & Array & Empty Array \\
+PI & Number & $3.141592653589793$ \\
+TAU & Number & $6.283185307179586$ \\
+EULER & Number & $2.718281828459045$
+\end{tabulary}
+
\section{Syntax In EBNF}
If you're \emph{that} into the language theory of computer science, texts above are just waste of bytes/inks/pixel-spaces/whatever; this little section should be more than enough!
diff --git a/assets/disk0/tbas/doc/sample_99.tex b/assets/disk0/tbas/doc/sample_99.tex
new file mode 100644
index 0000000..0c02b4d
--- /dev/null
+++ b/assets/disk0/tbas/doc/sample_99.tex
@@ -0,0 +1,17 @@
+This is a sample program that prints out the infamous \emph{99 Bottles of Beer}.
+
+\begin{lstlisting}
+10 FOR I = 99 TO 1 STEP -1
+20 MODE = 1
+30 GOSUB 12
+40 PRINT I;" bottle";BOTTLES;" of beer on the wall, ";i;" bottle";BOTTLES;" of beer."
+50 MODE = 2
+60 GOSUB 12
+70 PRINT "Take one down and pass it around, ";(I-1);" bottle";BOTTLES;" of beer on the wall."
+80 NEXT
+90 PRINT "No more bottles of beer on the wall, no more bottles of beer."
+100 PRINT "Go to the store and buy some more. 99 bottles of beer on the wall."
+110 END
+120 IF I == MODE THEN BOTTLES = "" ELSE BOTTLES = "s"
+130 RETURN
+\end{lstlisting}
diff --git a/assets/disk0/tbas/doc/sample_amazing.tex b/assets/disk0/tbas/doc/sample_amazing.tex
new file mode 100644
index 0000000..5e6eac4
--- /dev/null
+++ b/assets/disk0/tbas/doc/sample_amazing.tex
@@ -0,0 +1,142 @@
+This is a sample program that draw a randomised maze. The original program was on \emph{BASIC Computer Games: Microcomputer Edition} and was translated into \tbas.
+
+\begin{lstlisting}
+1 OPTIONBASE 1
+10 PRINT SPC(28);"AMAZING PROGRAM"
+20 PRINT SPC(15);"CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"
+30 PRINT:PRINT:PRINT
+100 PRINT "WHAT ARE YOUR WIDTH";:INPUT H
+102 PRINT "WHAT ARE YOUR LENGTH";:INPUT V
+105 IF H<>1 AND V<>1 THEN GOTO 110
+106 PRINT "MEANINGLESS DIMENSIONS. TRY AGAIN.":GOTO 100
+110 WS=DIM(H,V):VS=DIM(H,V)
+120 PRINT:PRINT:PRINT:PRINT
+160 Q=0:Z=0:X=INT(RND(1)*H+1)
+165 FOR I=1 TO H
+170 IF I==X THEN GOTO 173
+171 PRINT ".--";
+172 GOTO 175
+173 PRINT ". ";
+180 NEXT
+190 PRINT "."
+195 C=1:WS(X,1)=C:C=C+1
+200 R=X:S=1:GOTO 260
+210 IF R<>H THEN GOTO 240
+215 IF S<>V THEN GOTO 230
+220 R=1:S=1
+222 GOTO 250
+230 R=1:S=S+1:GOTO 250
+240 R=R+1
+250 IF WS(R,S)==0 THEN GOTO 210
+260 IF R-1==0 THEN GOTO 530
+265 IF WS(R-1,S)<>0 THEN GOTO 530
+270 IF S-1==0 THEN GOTO 390
+280 IF WS(R,S-1)<>0 THEN GOTO 390
+290 IF R==H THEN GOTO 330
+300 IF WS(R+1,S)<>0 THEN GOTO 330
+310 X=INT(RND(1)*3+1)
+320 ON X GOTO 790,820,860
+334 IF Z==1 THEN GOTO 370
+338 Q=1:GOTO 350
+340 IF WS(R,S+1)<>0 THEN GOTO 370
+350 X=INT(RND(1)*3+1)
+360 ON X GOTO 790,820,910
+370 X=INT(RND(1)*2+1)
+380 ON X GOTO 790,820
+390 IF R==H THEN GOTO 470
+400 IF WS(R+1,S)<>0 THEN GOTO 470
+405 IF S<>V THEN GOTO 420
+410 IF Z==1 THEN GOTO 450
+415 Q=1:GOTO 430
+420 IF WS(R,S+1)<>0 THEN GOTO 450
+430 X=INT(RND(1)*3+1)
+440 ON X GOTO 790,860,910
+450 X=INT(RND(1)*2+1)
+460 ON X GOTO 790,860
+470 IF S<>V THEN GOTO 490
+480 IF Z==1 THEN GOTO 520
+485 Q=1:GOTO 500
+490 IF WS(R,S+1)<>0 THEN GOTO 520
+500 X=INT(RND(1)*2+1)
+510 ON X GOTO 790,910
+520 GOTO 790
+530 IF S-1==0 THEN GOTO 670
+540 IF WS(R,S-1)<>0 THEN GOTO 670
+545 IF R==H THEN GOTO 610
+547 IF WS(R+1,S)<>0 THEN GOTO 610
+550 IF S<>V THEN GOTO 560
+552 IF Z==1 THEN GOTO 590
+554 Q=1:GOTO 570
+560 IF WS(R,S+1)<>0 THEN GOTO 590
+570 X=INT(RND(1)*3+1)
+580 ON X GOTO 820,860,910
+590 X=INT(RND(1)*2+1)
+600 ON X GOTO 820,860
+610 IF S<>V THEN GOTO 630
+620 IF Z==1 THEN GOTO 660
+625 Q=1:GOTO 640
+630 IF WS(R,S+1)<>0 THEN GOTO 660
+640 X=INT(RND(1)*2+1)
+650 ON X GOTO 820,910
+660 GOTO 820
+670 IF R==H THEN GOTO 740
+680 IF WS(R+1,S)<>0 THEN GOTO 740
+685 IF S<>V THEN GOTO 700
+690 IF Z==1 THEN GOTO 730
+695 Q=1:GOTO 830
+700 IF WS(R,S+1)<>0 THEN GOTO 730
+710 X=INT(RND(1)*2+1)
+720 ON X GOTO 860,910
+730 GOTO 860
+740 IF S<>V THEN GOTO 760
+750 IF Z==1 THEN GOTO 780
+755 Q=1:GOTO 770
+760 IF WS(R,S+1)<>0 THEN GOTO 780
+770 GOTO 910
+780 GOTO 1000
+790 WS(R-1,S)=C
+800 C=C+1:VS(R-1,S)=2:R=R-1
+810 IF C==H*V+1 THEN GOTO 1010
+815 Q=0:GOTO 260
+820 WS(R,S-1)=C
+830 C=C+1
+840 VS(R,S-1)=1:S=S-1:IF C==H*V+1 THEN GOTO 1010
+850 Q=0:GOTO 260
+860 WS(R+1,S)=C
+870 C=C+1:IF VS(R,S)==0 THEN GOTO 880
+875 VS(R,S)=3:GOTO 890
+880 VS(R,S)=2
+890 R=R+1
+900 IF C==H*V+1 THEN GOTO 1010
+905 GOTO 530
+910 IF Q==1 THEN GOTO 960
+920 WS(R,S+1)=C:C=C+1:IF VS(R,S)==0 THEN GOTO 940
+930 VS(R,S)=3:GOTO 950
+940 VS(R,S)=1
+950 S=S+1:IF C==H*V+1 THEN GOTO 1010
+955 GOTO 260
+960 Z=1
+970 IF VS(R,S)==0 THEN GOTO 980
+975 VS(R,S)=3:Q=0:GOTO 1000
+980 VS(R,S)=1:Q=0:R=1:S=1:GOTO 250
+1000 GOTO 210
+1010 FOR J=1 TO V
+1011 PRINT "|";
+1012 FOR I=1 TO H
+1013 IF VS(I,J)<2 THEN GOTO 1030
+1020 PRINT " ";
+1021 GOTO 1040
+1030 PRINT " |";
+1040 NEXT
+1041 PRINT
+1043 FOR I=1 TO H
+1045 IF VS(I,J)==0 THEN GOTO 1060
+1050 IF VS(I,J)==2 THEN GOTO 1060
+1051 PRINT ": ";
+1052 GOTO 1070
+1060 PRINT ":--";
+1070 NEXT
+1071 PRINT "."
+1072 NEXT
+1073 END
+\end{lstlisting}
diff --git a/assets/disk0/tbas/doc/sample_hamurabi.tex b/assets/disk0/tbas/doc/sample_hamurabi.tex
new file mode 100644
index 0000000..fe29375
--- /dev/null
+++ b/assets/disk0/tbas/doc/sample_hamurabi.tex
@@ -0,0 +1,142 @@
+This is a sample program that is the \emph{Hamurabi} game. The original program was on \emph{BASIC Computer Games: Microcomputer Edition} and was translated into \tbas. This game is considered as the great ancestor of the strategy, simulation and city-building games; in fact it's so great it has got its own Wikipedia article.
+
+\begin{lstlisting}
+10 PRINT SPC(32);"HAMURABI"
+20 PRINT SPC(15);"CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"
+30 PRINT:PRINT:PRINT
+80 PRINT "TRY YOUR HAND AT GOVERNING ANCIENT SUMERIA"
+90 PRINT "FOR A TEN-YEAR TERM OF OFFICE.":PRINT
+95 D1=0:P1=0
+100 Z=0:P=95:S=2800:H=3000:E=H-S
+110 Y=3:A=H/Y:I=5:Q=1
+210 D=0
+215 PRINT:PRINT:PRINT "HAMURABI: I BEG TO REPORT TO YOU,":Z=Z+1
+217 PRINT "IN YEAR ";Z;", ";D;" PEOPLE STARVED, ";I;" CAME TO THE CITY,"
+220 P=P+I
+227 IF Q>0 THEN GOTO 230
+228 P=INT(P/2)
+229 PRINT "A HORRIBLE PLAGUE STRUCK! HALF THE PEOPLE DIED."
+230 PRINT "POPULATION IS NOW ";P
+232 PRINT "THE CITY NOW OWNS ";A;" ACRES."
+235 PRINT "YOU HARVESTED ";Y;" BUSHELS PER ACRE."
+250 PRINT "THE RATS ATE ";E;" BUSHELS."
+260 PRINT "YOU NOW HAVE ";S;" BUSHELS IN STORE."
+261 PRINT
+270 IF Z==11 THEN GOTO 860
+310 C=INT(10*RND(1))
+311 Y=C+17
+312 PRINT "LAND IS TRADING AT ";Y;" BUSHELS PER ACRE."
+320 PRINT "HOW MANY ACRES DO YOU WISH TO BUY";
+321 INPUT Q
+322 IF Q<0 THEN GOTO 850
+323 IF Y*Q<=S THEN GOTO 330
+324 GOSUB 710
+325 GOTO 320
+330 IF Q==0 THEN GOTO 340
+331 A=A+Q:S=S-Y*Q:C=0
+334 GOTO 400
+340 PRINT "HOW MANY ACRES DO YOU WISH TO SELL";
+341 INPUT Q
+342 IF Q<0 THEN GOTO 850
+343 IF QC/2 THEN GOTO 530
+523 REM *** RATS ARE RUNNING WILD!!
+525 E=INT(S/C)
+530 S=S-E+H
+531 GOSUB 800
+532 REM *** LET'S HAVE SOME BABIES
+533 I=INT(C*(20*A+S)/P/100+1)
+539 REM *** HOW MANY PEOPLE HAD FULL TUMMIES?
+540 C=INT(Q/20)
+541 REM *** HORROS, A 15% CHANCE OF PLAGUE
+542 Q=INT(10*(2*RND(1)-0.3))
+550 IF P0.45*P THEN GOTO 560
+554 P1=((Z-1)*P1+D*100/P)/Z
+555 P=C
+556 D1=D1+D
+557 GOTO 215
+560 PRINT
+561 PRINT "YOU STARVED ";D;" PEOPLE IN ONE YEAR!!!"
+565 PRINT "DUE TO THIS EXTREME MISMANAGEMENT YOU HAVE NOT ONLY"
+566 PRINT "BEEN IMPEACHED AND THROWN OUT OF OFFICE BUT YOU HAVE"
+567 PRINT "ALSO BEEN DECLARED NATIONAL FINK!!!!"
+568 GOTO 990
+710 PRINT "HAMURABI: THINK AGAIN. YOU HAVE ONLY"
+711 PRINT S;" BUSHELS OF GRAIN. NOW THEN,"
+712 RETURN
+720 PRINT "HAMURABI: THINK AGAIN. YOU OWN ONLY ";A;" ACRES. NOW THEN,"
+730 RETURN
+800 C=INT(RND(1)*5)+1
+801 RETURN
+850 PRINT
+851 PRINT "HAMURABI: I CANNOT DO WHAT YOU WISH."
+855 PRINT "GET YOURSELF ANOTHER STEWARD!!!!!"
+857 GOTO 990
+860 PRINT "IN YOUR 10-YEAR TERM OF OFFICE, ";P1;" PERCENT OF THE"
+862 PRINT "POPULATION STARVED PER YEAR ON THE AVERAGE, I.E. A TOTAL OF"
+865 PRINT D1;"PEOPLE DIED!!"
+866 L=A/P
+870 PRINT "YOU STARTED WITH 10 ACRES PER PERSON AND ENDED WITH"
+875 PRINT L;"ACRES PER PERSON."
+876 PRINT
+880 IF P1>33 THEN GOTO 565
+885 IF L<7 THEN GOTO 565
+890 IF P1>10 THEN GOTO 940
+892 IF L<9 THEN GOTO 940
+895 IF P1>3 THEN GOTO 960
+896 IF L<10 THEN GOTO 960
+900 PRINT "A FANTASTIC PERFORMANCE!!! CHARLEMANGE, DISRAELI, AND"
+905 PRINT "JEFFERSON COMBINED COULD NOT HAVE DONE BETTER!"
+906 GOTO 990
+940 PRINT "YOUR HEAVY-HANDED PERFORMANCE SMACKS OF NERO AND IVAN IV."
+945 PRINT "THE PEOPLE (REMIANING) FIND YOU AN UNPLEASANT RULER, AND,"
+950 PRINT "FRANKLY, HATE YOUR GUTS!!"
+951 GOTO 990
+960 PRINT "YOUR PERFORMANCE COULD HAVE BEEN SOMEWHAT BETTER, BUT"
+965 PRINT "REALLY WASN'T TOO BAD AT ALL. ";INT(P*0.8*RND(1));" PEOPLE"
+970 PRINT "WOULD DEARLY LIKE TO SEE YOU ASSASSINATED BUT WE ALL HAVE OUR"
+975 PRINT "TRIVIAL PROBLEMS."
+990 PRINT
+991 FOR N=1 TO 10
+992 PRINT EMIT(7;)
+993 NEXT
+995 PRINT "SO LONG FOR NOW."
+996 PRINT
+999 END
+\end{lstlisting}
diff --git a/assets/disk0/tbas/doc/tbasman.tex b/assets/disk0/tbas/doc/tbasman.tex
index 3df8e5b..2b54e30 100644
--- a/assets/disk0/tbas/doc/tbasman.tex
+++ b/assets/disk0/tbas/doc/tbasman.tex
@@ -203,8 +203,18 @@
\chapter{Bibliography}
\input{bibliography}
+\part{More Goodies}
-\chapter*{Disclaimers}
+\chapter{99 Bottles of Beer}
+\input{sample_99}
+
+\chapter{Amazing}
+\input{sample_amazing}
+
+\chapter{Hamurabi}
+\input{sample_hamurabi}
+
+\chapter{Disclaimers}
\oreallypress{} is entirely fictional publishing entity; \oreallypress{} has no affiliation whatsoever with any of the real-world publishers.