forked from johnjones4/DinoDOS
-
Notifications
You must be signed in to change notification settings - Fork 1
/
dinoBASIC.html
223 lines (223 loc) · 7.99 KB
/
dinoBASIC.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
<html>
<head>
<title>dinoBASIC README</title>
</head>
<body>
<h1>dinoBASIC</h1>
<h2>John Jones and Russell Toris (c) 2010</h2>
<h3>Introduction</h3>
<p>dinoBASIC is a simple BASIC interpreter for the dinoDOS operating system. The syntax is a modified form of very early BASIC interpreters. The point of this program is to give dinoDOS users the ability to write programs while in the system and not have to compile them on another system. While limited, dinoBASIC allows for simple program creation to demonstrate the features of dinoDOS.</p>
<p>Program commands beginning with a line number are stored for later execution while commands without a starting line number are executed immediately. The stored program can be save to disk and later loaded back into the dinoBASIC interpreter.</p>
</p>Variables in the program can be either strings or integers. Both use the same naming convention. Additionally, variables are dynamically typed so a variable can be assigned an integer or string at any time.</p>
<p>Also, dinoBASIC takes advantage of dinoDOS's VGA libraries allowing users of dinoBASIC to create graphical programs. Users can also access the system's <i>amazing</i> VGA color palette.</p>
<h3>Command Groups</h3>
<p>There are several categories of commands available in dinoBASIC. They are catagorized here for convenience:</p>
<h4>Graphics</h4>
<ul>
<li><a href="#CIRCLE">CIRCLE</a> - Draw a circle</li>
<li><a href="#COLOR">COLOR</a> - Set the drawing color</li>
<li><a href="#GRAPHICS">GRAPHICS</a> - Set the display to VGA mode</li>
<li><a href="#LINE">LINE</a> - Draw a line</li>
<li><a href="#PLOT">PLOT</a> - Draw a single pixel</li>
<li><a href="#RECT">RECT</a> - Draw a rectangle</li>
<li><a href="#TEXT">TEXT</a> - Set the display to text mode</li>
</ul>
<h4>Input/Ouput</h4>
<ul>
<li><a href="#INPUTINT">INPUTINT</a> - Input an integer</li>
<li><a href="#INPUTSTR">INPUTSTR</a> - Input a string</li>
<li><a href="#PRINT">PRINT</a> - Print a value</li>
<li><a href="#PRINTLN">PRINTLN</a> - Print a value with a newline</li>
</ul>
<h4>Program Control</h4>
<ul>
<li><a href="#END">END</a> - End the program</li>
<li><a href="#ENDIF">ENDIF</a> - End an IF-THEN block</li>
<li><a href="#GOTO">GOTO</a> - Go to a given line number</li>
<li><a href="#IFTHEN">IFTHEN</a> - Run a block of commands if a given expression is true</li>
<li><a href="#LET">LET</a> - Assign a value to a variable</li>
<li><a href="#WHILE">WHILE</a> - Loop while a given expression is true</li>
</ul>
<h4>Utilites</h4>
<ul>
<li><a href="#CLEAR">CLEAR</a> - Clear the program and variables</li>
<li><a href="#HOME">HOME</a> - Clear the screen</li>
<li><a href="#LIST">LIST</a> - List the commands in the program</li>
<li><a href="#LOAD">LOAD</a> - Load a program from the disk</li>
<li><a href="#RUN">RUN</a> - Run the program</li>
<li><a href="#STORE">STORE</a> - Store the program to disk</li>
</ul>
<h3>Grammer</h3>
<p>The grammar for dinoBASIC is as follows:</p>
<table border=1>
<tr>
<td><b>Production</b></td>
<td><b>Composition</b></td>
<td><b>Description</b></td>
</tr>
<tr>
<td><line> <command></td>
<td></td>
<td>Any given command</td>
</tr>
<tr>
<td><command-block></td>
<td><line> <command> <command-block | lambda</td>
<td>A group of commands</td>
</tr>
<tr>
<td><line></td>
<td><integer> | lambda</td>
<td>An integer value representing where the command is to be stored in the prgram array</td>
</tr>
<tr>
<td rowspan=23><command></td>
<td><a name="CIRCLE" />CIRCLE <ordered pair> R <expression></td>
<td>Draw a circle at the ordered pair with a given radius</td>
</tr>
<tr>
<td><a name="CLEAR" />CLEAR</td>
<td>Erase all stored variables and the stored program</td>
</tr>
<tr>
<td><a name="COLOR" />COLOR <expression></td>
<td>Set the drawing color to a VGA color value </td>
</tr>
<tr>
<td><a name="END" />END</td>
<td>Stop execution</td>
</tr>
<tr>
<td><a name="ENDIF" />ENDIF</td>
<td>Signifies the end of an IF block</td>
</tr>
<tr>
<td><a name="GOTO" />GOTO <line></td>
<td>Jump to a given line</tr>
</tr>
<tr>
<td><a name="GRAPHICS" />GRAPHICS</td>
<td>Set the display to graphics mode (Disable text-based commands)</td>
</tr>
<tr>
<td><a name="HOME" />HOME</td>
<td>Clear the screen</td>
</tr>
<tr>
<td><a name="IFTHEN" />IF <boolean expression> THEN <command-block></td>
<td>Evaluates the boolean expression and executes the command or block if true</td>
</tr>
<tr>
<td><a name="INPUTINT" />INPUTINT <variable>
<td>Get input from the command line as an integer.</td>
</tr>
<tr>
<td><a name="INPUTSTR" />INPUTSTR <variable></td>
<td>Get input from the command line as a string.</td>
</tr>
<tr>
<td><a name="LET" />LET <assignment expression></td>
<td>Assign the value of an expression to a variable</td>
</tr>
<tr>
<td><a name="LINE" />LINE <ordered pair> TO <ordered pair></td>
<td>Draw a line from the first pair to the second pair</td>
</tr>
<tr>
<td><a name="LIST" />LIST</td>
<td>Print the stored program commands</td>
</tr>
<tr>
<td><a name="LOAD" />LOAD <filename></td>
<td>Load a text file as a program</td>
</tr>
<tr>
<td><a name="PLOT" />PLOT <ordered pair></td>
<td>Draw a point at the ordered pair</td>
</tr>
<tr>
<td><a name="PRINT" />PRINT <expression></td>
<td>Print out the value of the expression</td>
</tr>
<tr>
<td><a name="PRINTLN" />PRINTLN <expression></td>
<td>Print out the value of the expression and an newline character</td>
</tr>
<tr>
<td><a name="RECT" />RECT <ordered pair> W <expression> H <expression></td>
<td>Draw a rectangle at the ordered pair with a given height and width</td>
</tr>
<tr>
<td><a name="RUN" />RUN</td>
<td>Execute the stored program</td>
</tr>
<tr>
<td><a name="STORE" />STORE <filename></td>
<td>Write the contents of the stored program to disk</td>
</tr>
<tr>
<td><a name="TEXT" />TEXT</td>
<td>Set the display to text mode (Disable graphics-based commands)</td>
</tr>
<tr>
<td><a name="WHILE" />WHILE <boolean expression> <command-block></td>
<td>Loops until the boolean expression is false</td>
</tr>
<tr>
<td><assignment expression></td>
<td><variable> = <expression></td>
<td>Assign the result of the expression to the variable</td>
</tr>
<tr>
<td><expression></td>
<td><value> <mathop> <value> | <value></td>
<td>Evaluate an expression</td>
</tr>
<tr>
<td><value></td>
<td><variable> | <constant></td>
<td>Represents any data</td>
</tr>
<tr>
<td><variable></td>
<td></td>
<td>Any string of characters A to Z</td>
</tr>
<tr>
<td><constant></td>
<td><integer> | <string></td>
<td>Constant values such as '5' or '"String"'</td>
</tr>
<tr>
<td><integer></td>
<td></td>
<td>Any digit</td>
</tr>
<tr>
<td><string></td>
<td></td>
<td>Any character string enclosed by '"'</td>
</tr>
<tr>
<td><boolean expression></td>
<td><expression> <boolop> <expression></td>
<td>Evaluates to TRUE or FALSE</td>
</tr>
<tr>
<td><boolop></td>
<td>= | > | < | <= | >=</td>
<td>Common boolean operators</td>
</tr>
<tr>
<td><mathop></td>
<td>+ | - | * | /</td>
<td>Common arithmetic operators</td>
</tr>
<tr>
<td><ordered pair></td>
<td><expression>,<expression></td>
<td>A pair of expression representing x and y values</td>
</tr>
</table>
</body>
</html>