BASIC DEVELOPMENT
This commit is contained in:
@@ -17,8 +17,6 @@ If a MikeOS BASIC program is run from the command line, and one or more paramete
|
|||||||
|
|
||||||
Here's a small example program demonstrating a FizzBuzz program.
|
Here's a small example program demonstrating a FizzBuzz program.
|
||||||
|
|
||||||
rem *** MikeOS BASIC example program ***
|
|
||||||
|
|
||||||
```
|
```
|
||||||
# A cool fizzbuzz program
|
# A cool fizzbuzz program
|
||||||
PRINT "FizzBuzz!"
|
PRINT "FizzBuzz!"
|
||||||
@@ -152,13 +150,13 @@ print "Hello world"
|
|||||||
move 0 0
|
move 0 0
|
||||||
curschar x
|
curschar x
|
||||||
|
|
||||||
rem *** The next command will print 'H' ***
|
# The next command will print 'H'
|
||||||
print chr x
|
print chr x
|
||||||
|
|
||||||
move 1 0
|
move 1 0
|
||||||
curschar x
|
curschar x
|
||||||
|
|
||||||
rem *** The next command will print 'e' ***
|
# The next command will print 'e'
|
||||||
print chr x
|
print chr x
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -174,7 +172,7 @@ curscol x
|
|||||||
|
|
||||||
Get the position of the cursor. Example:
|
Get the position of the cursor. Example:
|
||||||
```
|
```
|
||||||
rem *** First is column, then row ***
|
# First is column, then row
|
||||||
curspos a b
|
curspos a b
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -190,7 +188,7 @@ delete "myfile.txt"
|
|||||||
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:
|
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:
|
||||||
```
|
```
|
||||||
do
|
do
|
||||||
rem *** Code goes here ***
|
# Code goes here
|
||||||
loop until x = 10
|
loop until x = 10
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -429,7 +427,7 @@ In the first print command, the output is 109. In the second, the output is the
|
|||||||
|
|
||||||
Generate a random integer number between two values (inclusive) and store it in a variable. Example:
|
Generate a random integer number between two values (inclusive) and store it in a variable. Example:
|
||||||
```
|
```
|
||||||
rem *** Make X a random number between 50 and 2000 ***
|
Make X a random number between 50 and 2000
|
||||||
|
|
||||||
rand x 50 2000
|
rand x 50 2000
|
||||||
```
|
```
|
||||||
@@ -455,13 +453,6 @@ mydata:
|
|||||||
190 87 195 232 173 60 195 89 111 33 13 10 0
|
190 87 195 232 173 60 195 89 111 33 13 10 0
|
||||||
```
|
```
|
||||||
|
|
||||||
## REM
|
|
||||||
|
|
||||||
A remark -- ie a comment that the BASIC interpreter ignores. Example:
|
|
||||||
```
|
|
||||||
rem *** This routine calculates the cuteness of kittens ***
|
|
||||||
```
|
|
||||||
|
|
||||||
## RENAME
|
## RENAME
|
||||||
|
|
||||||
Renames one file to another. Literal strings and string variables are allowed. Afterwards, R contains 0 if the operation was a success, 1 if the file was not found, 2 if the write operation failed, or 3 if the target file already exists. Example:
|
Renames one file to another. Literal strings and string variables are allowed. Afterwards, R contains 0 if the operation was a success, 1 if the file was not found, 2 if the write operation failed, or 3 if the target file already exists. Example:
|
||||||
|
|||||||
Reference in New Issue
Block a user