forked from mig-hub/mikeOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhandbook-appdev-basic.html
1540 lines (989 loc) · 28.5 KB
/
handbook-appdev-basic.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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The MikeOS BASIC App Developer Handbook</title>
<style type="text/css">
body {
font-family: sans-serif;
}
h1 {
margin-top:5px;
color: #DF6020;
}
h2 {
color: #DF6020;
}
h3 {
margin-top:5px;
color: #DF6020;
}
hr {
border: 0;
color: #DF6020;
background-color: #DF6020;
height: 3px;
}
pre {
background-color: #F0F0F0;
border: 5px solid #F0F0F0;
}
a {
text-decoration: none;
color: #0000F0;
}
a:visited {
text-decoration: none;
color: #0000F0;
}
a:hover {
text-decoration: underline;
}
li {
margin-left: -1ex;
}
</style>
</head>
<body>
<table border="0" cellpadding="10">
<tr>
<!-- NAVIGATION PANEL -->
<td style="border:1px solid black; width:160px;" valign="top">
<h3>Navigate</h3>
<p><strong>Overview</strong></p>
<ul>
<li><a href="#features">Features</a></li>
<li><a href="#example">Example</a></li>
<li><a href="#assignment">Assignment</a></li>
<li><a href="#memory">Memory</a></li>
<li><a href="#keywords">Keywords</a></li>
<li><a href="#theeditor">The editor</a></li>
</ul>
<p><strong>Instructions</strong></p>
<ul>
<li><a href="#alert">ALERT</a></li>
<li><a href="#askfile">ASKFILE</a></li>
<li><a href="#break">BREAK</a></li>
<li><a href="#call">CALL</a></li>
<li><a href="#case">CASE</a></li>
<li><a href="#cls">CLS</a></li>
<li><a href="#cursor">CURSOR</a></li>
<li><a href="#curschar">CURSCHAR</a></li>
<li><a href="#curscol">CURSCOL</a></li>
<li><a href="#curspos">CURSPOS</a></li>
<li><a href="#delete">DELETE</a></li>
<li><a href="#do">DO</a></li>
<li><a href="#else">ELSE</a></li>
<li><a href="#end">END</a></li>
<li><a href="#files">FILES</a></li>
<li><a href="#for">FOR</a></li>
<li><a href="#getkey">GETKEY</a></li>
<li><a href="#gosub">GOSUB</a></li>
<li><a href="#goto">GOTO</a></li>
<li><a href="#if">IF</a></li>
<li><a href="#include">INCLUDE</a></li>
<li><a href="#ink">INK</a></li>
<li><a href="#input">INPUT</a></li>
<li><a href="#len">LEN</a></li>
<li><a href="#listbox">LISTBOX</a></li>
<li><a href="#load">LOAD</a></li>
<li><a href="#move">MOVE</a></li>
<li><a href="#next">NEXT</a></li>
<li><a href="#number">NUMBER</a></li>
<li><a href="#page">PAGE</a></li>
<li><a href="#pause">PAUSE</a></li>
<li><a href="#peek">PEEK</a></li>
<li><a href="#poke">POKE</a></li>
<li><a href="#port">PORT</a></li>
<li><a href="#print">PRINT</a></li>
<li><a href="#rand">RAND</a></li>
<li><a href="#read">READ</a></li>
<li><a href="#rem">REM</a></li>
<li><a href="#rename">RENAME</a></li>
<li><a href="#return">RETURN</a></li>
<li><a href="#save">SAVE</a></li>
<li><a href="#serial">SERIAL</a></li>
<li><a href="#size">SIZE</a></li>
<li><a href="#sound">SOUND</a></li>
<li><a href="#string">STRING</a></li>
<li><a href="#waitkey">WAITKEY</a></li>
</ul>
<p><strong>Samples</strong></p>
<ul>
<li><a href="#hexdumper">Hex dumper</a></li>
<li><a href="#miketron">MikeTron</a></li>
<li><a href="#fileuppercaser">File uppercaser</a></li>
</ul>
<p><strong>Extra</strong></p>
<ul>
<li><a href="#help">Help</a></li>
<li><a href="#license">License</a></li>
</ul>
</td>
<!-- MAIN CONTENT PANEL -->
<td valign="top">
<h1>The MikeOS BASIC App Developer Handbook</h1>
<h3>For version 4.5, 21 December 2014 - (C) MikeOS Developers</h3>
<p>This documentation file explains how to write software for MikeOS using the BASIC interpreter
built into the operating system. If you have any questions, see <a href="http://mikeos.berlios.de">the MikeOS website</a>
for contact details and mailing list information.</p>
<p>Click the links on the left to navigate around this guide.</p>
<br />
<hr noshade="noshade" />
<h2>Overview</h2>
<a name="features"></a>
<h3>Features</h3>
<p>The MikeOS BASIC interpreter runs a simple dialect of the BASIC programming language. There
are commands for taking input, handling the screen, performing nested loops, loading/saving files,
and so forth. You will find a full list of the included instructions later in this document. Here
are the essentials you need to know.</p>
<ul>
<li><strong>Numeric variables</strong> -- These are <strong>A</strong> to <strong>Z</strong>, each storing
one positive integer word (ie 0 to 65535). The <strong>R</strong> and <strong>S</strong> variables have
special roles with <strong>LOAD</strong> and <strong>SAVE</strong> commands, as explained in the instruction
list below.</li>
<li><strong>String variables</strong> -- These are <strong>$1</strong> to <strong>$8</strong>, each 128 bytes
long.</li>
<li><strong>Arrays</strong> -- You can use string variables as arrays via the <strong>PEEK</strong> and <strong>POKE</strong> commands.
For instance, <strong>X = & $1</strong> places the memory location of the $1 string variable into X. You can then put data into it with eg <strong>POKE 77 X</strong> (put 77 into the memory location pointed to by X).</li>
<li><strong>Labels</strong> -- Such as <strong>box_loop:</strong> etc. Used by <strong>GOTO</strong> and <strong>GOSUB</strong>, they must have a trailing colon and be at the start of a line.</li>
<li><strong>Ending</strong> -- Programs must finish with an <strong>END</strong> statement.</li>
</ul>
<p><strong>GOSUB</strong> calls can be nested up to ten times. <strong>FOR</strong> loops can be nested using different variables (eg you
can have a <strong>FOR X = 1 TO 10 ... NEXT X</strong> loop surrounding a <strong>FOR Y = 30 TO 50</strong> loop). You can enter code in uppercase or lowercase -- the interpreter doesn't mind either way. However, labels are case-sensitive.</p>
<p>If a MikeOS BASIC program is run from the command line, and one or more parameters was provided with the command,
they are copied into the $1 string when the program starts.</p>
<br />
<a name="example"></a>
<h3>Example</h3>
<p>Here's a small example program demonstrating various common features:</p>
<pre>rem *** MikeOS BASIC example program ***
alert "Welcome to the example!"
cls
print "Let's skip the next 'print' line..."
goto jump
print "This line will never be printed :-("
jump:
print "Righto, now enter a number:"
input x
if x > 10 then print "X is bigger than 10! Wow!"
if x < 10 then print "X is quite small actually."
if x = 10 then gosub equalsroutine
a = 7
b = a / 2
print "Variable A is seven here. Divided by two you get:"
print b
print "And the remainder of that is:"
b = a % 2
print b
print "A quick loop here..."
for c = 1 to 10
print c
next c
print "Righto, that's the end! Bye!"
end
equalsroutine:
print "Awesome, a perfect 10! Give me your name so I can high-five you!"
input $1
print "Top work, " ;
print $1
return
</pre>
<p>This example should be mostly self-explanatory. You can see that the subroutine is indented with spaces,
but that's not necessary if you don't want it. You can follow <strong>IF ... THEN</strong> with any other
instruction. Regarding this part:</p>
<pre>
print "Top work, " ;
print $1
</pre>
<p>The space and semi-colon character (;) after the quoted string tells the interpreter not to print a newline
after the string. So here, we print the user's name on the same line. You can do this with numerical variables
as well, eg <strong>PRINT X ;</strong> etc.</p>
<p>See the Samples section at the end for more demonstration programs.</p>
<br />
<a name="assignment"></a>
<h3>Assignment</h3>
<p>The following are valid ways to assign numeric variables in MikeOS BASIC:</p>
<pre>
a = 10
a = b
a = b + 10
a = b + c
a = b - 10
a = b - c
a = b * 10
a = b * c
a = b / 10
a = b / c
a = b % 10
a = b % c
</pre>
<p>So you can use combinations of numbers and variables. Note that you can perform multiple
operations in the same line:</p>
<pre>a = b + c * 2 / 3</pre>
<p>But note that there is no operator precedence; the calculation is simply worked out one step
at a time from left to right. For string variables:</p>
<pre>
$1 = "Hello"
$2 = $1
</pre>
<p>You can get the location of a string variable to use as an array:</p>
<pre>
x = & $3
</pre>
<p>You can get variables from the user with <strong>INPUT</strong> like this:</p>
<pre>
input x
input $1
</pre>
<br />
<a name="memory"></a>
<h3>Memory</h3>
<p>MikeOS and its programs exist in a single 64K memory segment. The first
32K is occupied by the kernel and disk cache. Your BASIC program may be loaded at the start of the second 32K,
ie 32768, if it is run directly from the program menu or CLI. However, if it is run from a standalone program
such as the EDIT.BIN editor, its starting point will be elsewhere. Use <strong>PROGSTART</strong> and
<strong>RAMSTART</strong> to find out what memory you can use:</p>
<pre>
x = PROGSTART
</pre>
<p>This assigns to the X variable the location at which the BASIC program was loaded. In other words, this is where
the execution of the BASIC program by the interpreter starts. We also have:</p>
<pre>
x = RAMSTART
</pre>
<p>This is one byte on from the end of the BASIC code. Therefore this is empty memory which you can use, up until the 65536 mark.
You can LOAD and SAVE files in here, PEEK and POKE around, and do what you want without it impacting the operating system or BASIC program.</p>
<p>To retrieve the location in RAM where the MikeOS BASIC variables are stored, use this:</p>
<pre>
x = VARIABLES
</pre>
<br />
<a name="keywords"></a>
<h3>Keywords</h3>
<p>You can do this to get the MikeOS API version number:</p>
<pre>
x = VERSION
</pre>
<p>Or you can retrieve the lower word of the system clock like this:</p>
<pre>
x = TIMER
</pre>
<p>To get the current ink colour, use:</p>
<pre>
x = INK
</pre>
<br />
<a name="theeditor"></a>
<h3>The editor</h3>
<p>You can run your .BAS programs by selecting them from the program menu or typing them into the
command line interface -- eg entering <strong>example</strong> will run <strong>EXAMPLE.BAS</strong>.
Use the MikeOS file manager, <strong>FILEMAN.BIN</strong>, to make backup copies of your work and
delete old files.</p>
<p>MikeOS includes a text editor, <strong>EDIT.BIN</strong> Which you can use to edit your BASIC programs.
It lets you run your code straight from inside the editor by pressing the <strong>F8</strong> key. Note
that if your program has an infinite loop or major bug, it may hang execution -- so it's worth hitting
<strong>F2</strong> before running your code to save it to the disk. Hit <strong>F5</strong> to delete whole
lines quickly, and <strong>Esc</strong> to exit (you'll see a reminder of these keybindings in the bottom
bar of the editor).</p>
<p>The MikeOS text editor only handles Unix-style text files, and curently does not support horizontal scrolling
of lines, so keep them less than 80 characters! You can use the Delete and Backspace keys to erase characters,
but note that only Delete can be used to remove newlines.</p>
<br />
<hr noshade="noshade" />
<h2>Instructions</h2>
<a name="instructions"></a>
<a name="alert"></a>
<h3>ALERT</h3>
<p>Show a dialog box on the screen with a string, and an OK button triggered by the Enter key. Example:</p>
<pre>
alert "File saved correctly."
$1 = "Welcome to my program"
alert $1
</pre>
<br />
<a name="askfile"></a>
<h3>ASKFILE</h3>
<p>Show a dialog box on the screen with a string with a list of files on the disk, and store the selected file in the specified variable. Example:</p>
<pre>
askfile $1
</pre>
<br />
<a name="break"></a>
<h3>BREAK</h3>
<p>Halts execution of the BASIC program and prints the line number in the BASIC file. Useful for debugging.</p>
<br />
<a name="call"></a>
<h3>CALL</h3>
<p>Moves machine code execution to the specified point in RAM (using the x86 <strong>call</strong> instruction). The code
must be terminated with a <strong>ret</strong> (C3 hex, 195 decimal) instruction. In this example, we simply
add a <strong>ret</strong> instruction into RAM location 40000 and call it, which returns control straight back to the BASIC
interpreter:</p>
<pre>
poke 195 40000
call 40000
</pre>
<br />
<a name="case"></a>
<h3>CASE</h3>
<p>Changes the contents of a string to all upper-case or lower-case.</p>
<pre>
case lower $1
case upper $2
</pre>
<br />
<a name="cls"></a>
<h3>CLS</h3>
<p>Clears the screen and returns the cursor to the top-left corner of the screen. Example:</p>
<pre>
cls
</pre>
<br />
<a name="cursor"></a>
<h3>CURSOR</h3>
<p>Determines whether to show the text cursor or not. Example:</p>
<pre>
cursor off
print "The cursor is off for five seconds!"
pause 50
cursor on
print "And now it's back on."
</pre>
<br />
<a name="curschar"></a>
<h3>CURSCHAR</h3>
<p>Stores the character underneath the cursor location into the specified variable. Example:</p>
<pre>
move 0 0
print "Hello world"
move 0 0
curschar x
rem *** The next command will print 'H' ***
print chr x
move 1 0
curschar x
rem *** The next command will print 'e' ***
print chr x
</pre>
<br />
<a name="curschar"></a>
<h3>CURSCOL</h3>
<p>Get the colour of the character under the cursor. Example:</p>
<pre>
move 20 15
curscol x
</pre>
<br />
<a name="curspos"></a>
<h3>CURSPOS</h3>
<p>Get the position of the cursor. Example:</p>
<pre>
rem *** First is column, then row ***
curspos a b
</pre>
<br />
<a name="delete"></a>
<h3>DELETE</h3>
<p>Removes a file from the disk. Returns 0 in the R variable if the operation was a success, 1 if the delete
operation couldn't be completed, or 2 if the file doesn't exist. Example:</p>
<pre>
delete "myfile.txt"
</pre>
<br />
<a name="do"></a>
<h3>DO</h3>
<p>Perform a loop until a condition is met (UNTIL or WHILE). You can also set up an infinite loop with LOOP ENDLESS at the end. Example:</p>
<pre>
do
rem *** Code goes here ***
loop until x = 10
</pre>
<br />
<a name="else"></a>
<h3>ELSE</h3>
<p>Executes code if the previous IF condition didn't match. Example:</p>
<pre>
x = 1
if x = 1 then print "Hello"
else print "Goodbye"
</pre>
<br />
<a name="end"></a>
<h3>END</h3>
<p>Terminates execution of the BASIC program and hands control back to the operating system.</p>
<br />
<a name="files"></a>
<h3>FILES</h3>
<p>Prints a list of files that are on the disk on the screen.</p>
<br />
<a name="for"></a>
<h3>FOR</h3>
<p>Begins a loop, counting upwards using a variable. The loop must be finished with a NEXT instruction
and the relevant variable. Example:</p>
<pre>
for x = 1 to 10
print "In a loop! X is " ;
print x
next x
</pre>
<br />
<a name="getkey"></a>
<h3>GETKEY</h3>
<p>Checks the keyboard buffer for a key, and if one has been pressed, places it into the
specified variable.</p>
<pre>
loop:
print "Infinite loop until m or Esc is pressed..." ;
getkey x
if x = 'm' then goto done
goto loop
done:
print "Finished loop!"
</pre>
<br />
<a name="gosub"></a>
<h3>GOSUB</h3>
<p>Takes a label. It executes a subroutine, which must be finished with a RETURN instruction. You can
nest GOSUB routines up to 10 times. Example:</p>
<pre>
print "About to go into a subroutine..."
gosub mylabel
print "Subroutine done!"
end
mylabel:
print "Inside a GOSUB here!"
return
</pre>
<br />
<a name="goto"></a>
<h3>GOTO</h3>
<p>Takes a label, and jumps to that label in the code. Example:</p>
<pre>
print "Going to miss the next 'PRINT' line of code..."
goto skippy
print "This'll never be printed."
skippy:
print "And now we're back home"
</pre>
<br />
<a name="if"></a>
<h3>IF</h3>
<p>Executes a command depending on a condition (or multiple conditions with AND). After stating the condition (eg whether one number
is bigger than another, or whether two strings match) you must use THEN and follow with another
instruction. Examples:</p>
<pre>
if x = 10 then print "X is 10! Woohoo"
</pre>
<pre>
if x = y then print "X is the same as Y"
</pre>
<pre>
if x = 'm' then print "X contains the letter m"
</pre>
<pre>
if x < y then print "Now X is less than Y"
</pre>
<pre>
if x > y then goto xbiggerthany
</pre>
<pre>
if $1 = "quit" then end
</pre>
<pre>
if $1 = $2 then gosub stringsmatch
</pre>
<br />
<a name="include"></a>
<h3>INCLUDE</h3>
<p>Appends another BASIC file onto the end of the current one, so that you can call routines in it. RAMSTART
is updated accordingly. Example:</p>
<pre>
include "mbpp.bas"
</pre>
<br />
<a name="ink"></a>
<h3>INK</h3>
<p>Changes the colour of printed text, using a number or variable. Example:</p>
<pre>
ink 2
print "This text is green"
</pre>
<br />
<a name="input"></a>
<h3>INPUT</h3>
<p>Gets input from the user and stores the result into a numeric or string variable. Examples:</p>
<pre>
input x
input $1
</pre>
<br />
<a name="len"></a>
<h3>LEN</h3>
<p>Stores the length of a string variable in a numeric variable. Example:</p>
<pre>
$1 = "Hello world"
len $1 x
</pre>
<br />
<a name="listbox"></a>
<h3>LISTBOX</h3>
<p>Displays an dialog box containing a list of options, specified by a comma-separated list in the first string. The second
and third strings provide help text, and the chosen option (from 1) is stored in the specified variable (or zero if the Esc
key is pressed). Example:</p>
<pre>
cls
$1 = "Hex dumper,MikeTron"
$2 = "Choose a program to run,"
$3 = "Or press Esc to exit"
listbox $1 $2 $3 a
if a = 1 then goto runhex
if a = 2 then goto runmiketron
rem *** The following will be executed if Esc was pressed ***
end
</pre>
<br />
<a name="load"></a>
<h3>LOAD</h3>
<p>Loads the specified file into RAM at the specified point. The first argument is the filename,
and the second the location into which it should be loaded. If the file cannot be found or loaded,
the R variable contains 1 after the instruction; otherwise it contains 0 and the S variable
contains the file size. Examples:</p>
<pre>
load "example.txt" 40000
if r = 1 then goto fail
print "File size is:"
print s
end
fail:
print "File couldn't be loaded"
end
</pre>
<pre>
$1 = "example.txt"
x = 40000
load $1 x
if r = 1 then goto fail
print "File size is:"
print s
end
fail:
print "File couldn't be loaded"
end
</pre>
<br />
<a name="move"></a>
<h3>MOVE</h3>
<p>Moves the cursor position on the screen. Examples:</p>
<pre>
move 20 15
</pre>
<pre>
x = 20
y = 15
move x y
</pre>
<br />
<a name="next"></a>
<h3>NEXT</h3>
<p>Continues the FOR loop specified previously, and must be followed by a variable. See FOR above. Example:</p>
<pre>
next x
</pre>
<br />
<a name="number"></a>
<h3>NUMBER</h3>
<p>Converts strings to numbers and vice versa. Examples:</p>
<pre>
number $1 a
</pre>
<pre>
number a $1
</pre>
<br />
<a name="pause"></a>
<h3>PAUSE</h3>
<p>Delays execution of the program by the specified 10ths of a second. This ultimately results in a BIOS
call and may be slower or faster in some PC emulators. Try it on real hardware to be sure. Example:</p>
<pre>
print "Now let's wait for three seconds..."
pause 30
print "Hey, and one more, this time with a variable..."
x = 10
pause x
</pre>
<br />
<a name="page"></a>
<h3>PAGE</h3>
<p>Switch between working and active (display) pages. Example:</p>
<pre>
page 1 0
</pre>
<br />
<a name="peek"></a>
<h3>PEEK</h3>
<p>Retrieve the byte stored in the specifed location in RAM. Examples:</p>
<pre>
peek a 40000
print "The number stored in memory location 40000 is..."
print a
</pre>
<pre>
x = 32768
peek a x
</pre>
<p><strong>Note:</strong> you can use PEEKINT to work with words instead of bytes (up to 65536).</p>
<br />
<a name="poke"></a>
<h3>POKE</h3>
<p>Insert the byte (0 to 255) value into the specified location in RAM. Example:</p>
<pre>
print "Putting the number 126 into location 40000 in memory..."
poke 126 40000
print "Now doing the same, but using variables..."
x = 126
y = 40000
poke x y
</pre>
<p><strong>Note:</strong> you can use POKEINT to work with words instead of bytes (up to 65536).</p>
<br />
<a name="port"></a>
<h3>PORT</h3>
<p>Sends and receives bytes from the specified port. Examples:</p>