Omikron BASIC for Apple Power Mac

5-8. NOISE - POKE Contents | 5-10. SCREEN-TEXT HEIGHT


Chapter 5-9

The Command Set



Type: Function
Syntax: POS (<num.expression>)
Explanation: Returns the column in which the cursor is currently located. Column counting commences at 0. The parameter is of no significance, but has to be indicated regardless.
Example: PRINT "X"*10, POS(0)
See also: CSRLIN   LOCATE   @   PRINT

Type: Command
Syntax: POLYGON <field>
Explanation: Draws a polygon (any n-corner). The data of the corner points must be available in a two-dimension variable field of the short integer type.
Example: DIM Pts%(1,10)
READ Number_Points
FOR I=0 TO Number_Points
READ Pts%(0,I),Pts%(1,I)
 ' Pts%(0,I)= Ith Coordinates X Value 
 ' Pts%(1,I)= Ith Coordinates Y Value 
CLS: POLYGON Pts%(0, Number_Points)
'Please, consider: The variable field for POLYGON must be a short integer field, dimensioned to (1,X), 'X=Number of max. points. Anything else will not function.

DATA 6, 50,75, 150,125, 200,100
DATA 150,74, 50,125, 50,75
Result: A polygon is drawn
See also: PPOLYGON

Type: Command
Syntax: PPOLYGON <field>
Explanation: Draws a polygon in the same manner as for POLYGON, however, this polygon is filled with a pattern (adjustable with FILL STYLE and FILL COLOR).
See also: POLYGON

Type: Command
Syntax: PRBOX <num.expression>,<num.expression> {TO<num.expression>,<num.expression>|,<num.expression>,<num.expression>}
PRBOX <X>,<Y> {TO<X2>,<Y2>|,<width>,<heigth>}
Explanation: Draws a filled rectangle with rounded corners on the screen. Either two opposite corners are to be specified or one corner, width, and height of the rectangle.
The degree of curvature can be adjusted with the procedure 'Set_Roundings' from the Extension Library.
The fill color defined in FILL COLOR and the fill style as defined in FILL STYLE are applied.
The outline frame is always a continuous line one pixel wide regardless of the settings effected in LINE STYLE and LINE WIDTH. The color corresponds to the fill color. The outline can be activated or deactivated using OUTLINE ON|OFF. If a window is defined by means of CLIP, nothing will be drawn outside of this area.
See also: RBOX    BOX   PBOX   Set_Roundings 

Type: Command
Syntax: PRINT [[<expression>][,[[<expression>]<,|;>]...]
<Expression> can be substituted by the following:
{TAB(<num.expression>) | USING [<string expression>] | <num.expression> | <string expression>}
Explanation: The PRINT command is used to display results on the screen. It can also be redirected to other output devices via the CMD command. The display can be tabulated in a variety of different ways.
The cursor jumps to the nearest tab if a comma is placed at the end or if the expressions are separated by commas; in the case of a semicolon, the cursor remains at the last writing position. If neither comma nor semicolon appear at the end of the PRINT statement, a line feed is issued automatically.
The TAB command offers additional tabulation options. The cursor always jumps to the specified tabulator column. If this column is already exceeded by a previous display, the cursor position is not changed.
By inserting USING commands, the form of the subsequent displays can be affected.
Example: PRINT 1,2,3
PRINT 1,2,
PRINT TAB (10);1; TAB (20);2
Result: 1 2 3
1 2 3
1 2
See also: PRINT USING    PRINT #        WRITE    LPRINT

Type: Command
Syntax: PRINT # [[<num.expression>][,[[<expression>]<,|;>]...]
PRINT # [[<file number>][,[[<data>]<,|;>]...]
Explanation: PRINT # is used for output the same way as PRINT is. Output is directed to the file indicated by the file number.
If PRINT # is followed by several expressions, these are output as only one string. Commas between the elements are converted into tabulator characters. Thus, no additional separators are inserted, as it is the case for WRITE #. This fact means that a line written with PRINT # can only be read in with INPUT as a whole. If it is desired to keep the individual elements separated, each element has to have its own PRINT # command or CHR$(13) has to be insert between the elements (e.g., PRINT #1,"monkey";CHR$(13);"banana") or even better, use WRITE # from the start.
PRINT # may also be used to output data to the modem interface and/or printer interface. In this case, the channel must have been opened previously using OPEN "V" or OPEN "P."
Example: OPEN "O",1,FN Get_Fsspec$(0,0,"TEST.DAT") 
PRINT #1,"Men","Ape","Banana" 
OPEN "I",1,FN Get_Fsspec$(0,0,"TEST.DAT") 
INPUT #1,A$:'Reads all three strings, because the
PRINT A$:'commas have been saved as tabulators.  
Result: Men Ape Banana 
See also: PRINT    WRITE

Type: Command
Syntax: PRINT @(<num.expression>,<num.expression>); ...
PRINT @(<line>,<column>); ...
Explanation: Output and syntax are the same as in the case of PRINT. A start line and a start column are specified in addition, indicating the start of output. Line and column counts start at zero.
The @(<line>,<column>) function basically returns a string, which, issued via PRINT, places the cursor in the corresponding position. Thus, this function can appear wherever any other string might have occurred.
Example: FOR I=0 TO 20
PRINT @(I,2*I);"*"
Result: A diagonal consisting of asterisks is printed.
See also: PRINT

Type: Command
Syntax: PRINT USING <string expression>...
PRINT USING <format string>...
Explanation: PRINT USING is employed for the formatted number output. All tabulation options and the entire syntax as being applied in the case of PRINT are available for PRINT USING as well. In addition, the USING command - followed by a control string - can appear in any position. The format statements made in the control string then apply to every numerical output for as long until a new USING command appears or the PRINT command comes to an end.

The following formatting possibilities exist:

"#" represents a digit
"." decimal point at this position
"," decimal comma at this position
"," & "." decimal point where specified; separate each thousand with ","
"." & "," decimal comma where specified; separate each thousand with "."
",,," separate each thousand with ","; no fractional parts
"..." separate each thousand with "."; no fractional parts
"-" if negative, minus sign at this position
"+" operational sign (also +) always output in this position

Exceptions regarding +/-:
If the "+" or "-" is located directly before the first "#", "*", "." or ",", the operational sign is then output directly before the first valid position.

"*<character>" determines the fill character in the front. The character "_" (underscore character) may not be a fill character. Unused digit components (that is "#" characters, etc.) are usually output as blanks. For example, when using "*0", these digit components are output as zeros, i.e., an output with leading zeros is achieved.
"_<character>" outputs the character even if it concerns a character usually carrying significance for the format string.
For example, "_#" returns a "#"; this "#" is then not a placeholder parameter for a digit.
"^^^^" exponent is placed in this position (forces exponential notation)
All other characters are output as they appear.

Note: If the operational sign is not allocated a special position, it will claim 1 digit position for itself (even if the number is positive). Thus, the format mask "###" can only collect two-digit values since one position always remains allocated to the operational sign. If the value to be output does not match the format mask, the mask itself is output with an initial "%."

Important: PRINT USING does not round off, fractional parts are simply truncated.

Restrictions of PRINT USING:
The total number of defined digit placeholders may not exceed 30. The number of exponent positions may not be less than 4. The character "_" (underscore character) may not be a fill character. The entire length of the format string may not be greater than 253 characters. If an error message is issued in a line containing a PRINT USING or USING command, a defective format string (e.g., two operational signs) could be at fault.
Example: PRINT USING "####.##",1.5
PRINT USING "# # # # #",1000
PRINT USING "**,########.## $",Amount!
PRINT USING "*0### million ### thousand and ### $, ## Cent-",Amount#
PRINT USING "##.##### ^^^^"; EXP(10)
PRINT USING "###### $",FN Round!(Amount!,0)
DEF FN Round!(Amount!,Decimal_Places)
LOCAL Scale!=10^Decimal_Places
RETURN FIX(Amount!*Scale!+.5)/Scale!
Result: 1.50
1 0 0 0
*****13,450.99 $
00123 million 456 thousand and 789 $, 01 Cent
2.20264 E +4
13451 $

Type: Command
Syntax: [PROC] <procedure identifier>[(]<expression>[[,<expression>]][)]
Explanation: Calls a self-defined procedure (see DEF PROC). As can be gathered by the syntax definition, the specification of the word "PROC" is optional, i.e., it is possible to call the procedure simply by naming its name. However, if the procedure has an reserved name, that is, has the same name as a BASIC command (e.g., DEF PROC Or(A,B)), the word PROC must always be specified before the call; otherwise the editor cannot determine whether the term refers to the BASIC command 'OR' or the BASIC procedure 'Or'. The user should abstain from employing such procedure names to avoid confusion. Indication of the parentheses, which encompass the parameters, is optional as well. Thus, a procedure call is not really different from a standard command.
Example: Center "This is a test"
Input "End with [Return]";Dummy

DEF PROC Center(Text$)
PRINT TAB((W_CHAR-LEN(Text$))/2);Text$;
DEF PROC Home 'Return cursor to upper left corner
PRINT CHR$(27);"H";
Result: The text "This is a test" is displayed as centered, followed by the cursor's return to the upper left corner of the screen.
See also: DEF PROC    FN

Type: Command
Syntax: PUT <num.expression>,{<num.expression>[,<num.expression]|<string expression>,<num.expression>}
1: PUT <file number>,<record number>
2: PUT < file number >,<memory address>,<number>
3: PUT < file number >,<string expression>
Explanation: A data record is written to the file indicated by the file number according to syntax 1. The file must have been opened previously using OPEN "R". The written data consists of the buffer variables indicated in FIELD. Since the length of the buffer variables may not be changed, it is recommended to allocate with LSET or RSET.

According to syntax 2 and 3, the specified number of bytes and indicated string expression are written to the file indicated by the file number - starting at the RAM address. OPEN "U" should be used to open the file first.
PUT may also be used to output data to the modem interface and/or printer interface. In this case, the channel must have been opened previously using OPEN "V" or OPEN "P."
Example: Address$="Heinz Ramrom, 10 Datapath, Bitburg 12345"
OPEN "U",1,FN Get_Fsspec$(0,0,Addresses)
PUT 1, Address$
Result: The address is written to the file 'Addresses'.
See also: GET   OPEN    FIELD

Type: Command
Syntax: RAD
Explanation: Switches to calculation according to radian (0 to 2 pi) in the case of trigonometric functions. This is also the default setting.
See also: DEG

Type: Command
Syntax: RBOX <num.expression>,<num.expression> {TO<num.expression>,<num.expression>|,<num.expression>,<num.expression>}
RBOX <X>,<Y> {TO<X2>,<Y2>|,<width>,<heigth>}
Explanation: Draws an unfilled rectangle with rounded edges on the screen. Either two opposite corners are to be specified or one corner, width, and height of the rectangle. Line color, line style and line width can be adjusted using LINE COLOR, LINE STYLE, and LINE WIDTH.
If a window is defined by means of CLIP, nothing will be drawn outside of this area.
The degree of curvature can be adjusted with the procedure 'Set_Roundings' from the Extension Library.
See also: BOX    PBOX    PRBOX    Set_Roundings

Type: Command
Syntax: READ <variable>[[,<variable>]]
Explanation: An available allocation defined by DATA is passed to the variable. The available allocations are read progressively. However, the pointer pointing to the next allocation to be read can be reallocated with RESTORE.
The allocation of a string expression to a numerical variable or vice versa is not permitted. However, this error is recognized by Omikron Basic only if COMPILER "DEBUG ON" was activated.
Example: DATA "Dog",A$,"Mouse",A$
-Label1:DATA "Cat",23*Content
Result: Dog Dog
Cat 46
See also: DATA    RESTORE

Explanation: This word is reserved. Please, do not use!

Type: Command
Syntax: REM <any text>
Explanation: Texts preceded by REM are not considered by BASIC and serve the programmer only as comments, explanations, etc.
Unlike the single quotation mark, which can be located in any position in the program (except in parts enclosed by " "), REM must either be located at the beginning of a line or after a command separator. The rest of this line is then characterized as comment text. A command separator consists normally of a colon but ELSE, ENDIF, THEN, WHILE, and REPEAT may be used as command separators. Commands located in a line behind a REM are interpreted as comment text and are not executed.
See also: '(Comment)

Explanation: Has no application purpose in Omikron Basic Mac and is ignored by the compiler. Please, do not use.

Type: Command
Syntax: REPEAT
Explanation: Initiates the REPEAT ... UNTIL loop. Everything indicated between REPEAT and UNTIL is executed until the condition following UNTIL is true (<>0). Since the condition is checked only at the end of the first run, the loop must be executed at least once, even if the condition was never met. By indicating a never met condition (the 0), the REPEAT ... UNTIL loop can also be employed as an endless loop only to be exited with EXIT.
Example: REPEAT
INPUT "Enter a number:";Number
Result: 1 2 3 4 5

A repeated request to enter a number is made in the second loop. The program stores the sum of all entered numbers. If input equals 0, the loop is exited and the total sum displayed on the screen.
See also: UNTIL   EXIT    FOR    WHILE


Type: Function
Syntax: RESERVED(<num.expression>)
Explanation: RESERVED enables access to internal memory areas of Omikron Basic. RESERVED(0) in particular returns the return value of the last machine program to be called using CALL (the register R3).

Type: Command
Syntax: RESTORE [<label>]
Explanation: The pointer pointing to the next available allocation to be read with READ is reallocated. It points to the first available allocation defined by DATA, which appears behind the label.
RESTORE without label reallocates the pointer to the very first available allocation appearing in the program at all. In that case, the pointer is located at the start of the program.
Example: DATA "Cat","Mouse"
DATA "Dog","Mouse"
DATA "Eraser"
Result: Cat
Cat Mouse Dog
See also: DATA    READ 

Type: Command
Syntax: RESUME [{NEXT|<label>}]
Explanation: RESUME cancels an error routine defined with ON ERROR GOTO. A jump is effected to the beginning of the line in which the command triggering the error is located. In the case of RESUME NEXT, the causal command is skipped and the program resumed in the next line. If the program is supposed to be continued elsewhere, the specification of a jump label is possible as well.

Caution: RESUME with jump label does not leave any structures or subprograms; thus the jump label always has to be located in the same hierarchy level in which the error occurred.

Note: TRACE_ON is activated automatically if RESUME, RESUME NEXT, or RESUME LABEL occur in the program, i.e., program pointer and stack pointer are saved at the beginning of every line. As a result, your program grows longer and execution speed decreases a little.
Example: ON ERROR GOTO Error
FORM_ALERT (1,"[2]["+ ERR$ +"|in Line"+ STR$( ERL )+"] [Repeat|Continue|Cancel]",F_But)
PRINT "Fatal error forced program cancellation:"
PRINT ERR$ ;" in Line"; ERL
Result: First, an error is triggered (division by zero and/or logarithm with negative argument). A result of this error is the branching off to the error routine in which the user is now asked about further operations via an alert box.
See also: ON ERROR GOTO     ERR     ERL     ERR$ 

Type: Command
Syntax: RETURN [<expression>]
Explanation: RETURN exits a procedure or subprogram. RETURN with specification of an expression exits a multi-line function and returns the expression as a function value. Program execution is continued behind the location from which the call originated.
Procedures can (and should) be concluded with END_PROC; however, only one END_PROC may be used per procedure to ensure that start and end of a procedure are clearly defined.
The command END_FN is equally available for functions. However, this command only determines the end of the functional definition and does not return any values itself. Nevertheless, this command should always be used in order to clearly define the end of a function (especially in the case of several RETURN statements).
RETURN may not be used within a structure such as REPEAT ... UNTIL, FOR ... NEXT, WHILE ... WEND, or SELECT ... CASE. Instead, the structure has to always be exited first using EXIT. Only then is it possible to jump back with RETURN.
Example: PRINT FN Fib(10)
INPUT "End with [Return] ";Dummy
IF N>2
Result: 55
See also: PROC    FN    GOSUB    DEF FN    DEF PROC    END_PROC    END_FN    RESUME 


Type: Function
Syntax: RIGHT$(<string expression>,<num.expression>)
Explanation: Returns a partial string of the string expression with the length indicated by the numerical expression. The partial string ends with the last character of the string expression. If the numerical expression is greater than the length of the string expression, the entire string is returned.
Example: A$="Omikron.Basic"
Result: Basic
See also: LEFT$    MID$    INSTR 

Type: Command
Syntax: RMDIR <string expression>
RMDIR <file name>
Explanation: Removes a folder, provided neither files nor sub-folders are contained in this folder. <file name> is a FileSpecificationRecord as returned by FILESELECT or FN Get_Fsspec$. An error message is issued by the 'File Manager' if the folder is not empty.

Note: No colon may be located at the end of the name.
See also: MKDIR    KILL   FN Get_Fsspec$

Type: Function
Syntax: RND(<num.expression>)
Explanation: Returns a random number depending on the numerical expression:

0 : Repeat last random number
1 : Value of inclusively 0 to exclusively 1
otherwise: whole value between 0 and the numerical expression, whereby the greater of the two is not reached.

Note: The random number is determined via a function, which returns a similar distribution as a true random number because Apple computers do not possess a true randomizer. The result is therefore deterministic. Thus, the same series of random numbers will be generated if the initial conditions are identical. These numbers are thus also referred to as pseudo random numbers. Generally, however, it will be impossible to notice this particularity because identical initial conditions are almost impossible to realize in practical applications.
Example: PRINT RND(10)
Result: A random number between 0 and 9 is output.

Type: Command
Syntax: RSET <string variable>=<string expression>
Explanation: The string expression is inserted right justified into the string variable without its length being altered. If necessary, the string expression will be truncated in front.
Example: A$=SPACE$(20)
RSET a$="Omikron"
PRINT "*";A$;"*"
Result: * Omikron*
See also: LSET    FIELD    RIGHT$ 

Explanation: Has no application purpose in Omikron Basic Mac and is ignored by the compiler. Please, do not use.

Explanation: Has no application purpose in Omikron Basic Mac and is ignored by the compiler. Please, do not use.

5-8. NOISE - POKE Contents | 5-10. SCREEN-TEXT HEIGHT

Tech-Support | Order | Start | Home:

© 1997-2001 Berkhan-Software