Omikron BASIC for Apple Power Mac

6-3. MacOS Error Messages Contents | 7-2. Memory Organization in Omikron Basic

 

Chapter 7-1

The Built-in VT 52 Emulator

Omikron Basic offers two options when outputting text to the screen. One option is to use the commands PRINT and WRITE. The other possibility consists in the use of the TEXT command or of the corresponding MacOS functions.
The first variation offers special options to control the screen with the aid of so-called escape sequences, while the second variation has the special advantage of being able to place the text as precise as one pixel.

When PRINT and WRITE commands are used Omikron Basic emulates a terminal of the type VT52, which makes a whole range of control functions available. These control functions are initiated by a specific additional character, the escape code. Escape, or shortened to ESC, has the ASCII code 27. Another letter follows the ESC code, which determines the function as well as additional parameters if required. The following summary contains a list of all control codes and their meaning. Some of these also function with the LPRINT command. Of course, it is impossible to delete a page with LPRINT CHR$(27)+"E" if this page has already been printed out.

ESC A (Cursor Up)
This enables cursor movement upwards by one line. If the cursor is already located in the uppermost line, nothing happens.

ESC B (Cursor Down)
This ESC sequence moves the cursor down by one line. If the cursor is already located in the bottommost line, nothing happens.

ESC C (Cursor Right)
This sequence moves the cursor one column to the right.

ESC D (Cursor Left)
This sequence moves the cursor one position to the left. This function is identically to the control code 'Backspace' (BS = ASCII code 8). If the cursor is already located in the first column, nothing happens.

ESC E (Clear Home)
This control sequence clears the entire screen and positions the cursor into the upper left screen corner (Home Position).

ESC H (Cursor Home)
This sequence moves the cursor into the upper left screen corner; however, without deleting screen content.

ESC I (Cursor Up)
This sequence moves the cursor up by a line. Unlike ESC A however, a blank line is inserted if the cursor was already in the uppermost line; the rest of the screen scrolls down one line accordingly. The column position of the cursor remains unchanged. 

ESC J (Clear Remaining Screen)
This function is used to clear the remaining screen starting at and including the current cursor position. The cursor stays at the same position.

ESC K (Delete Rest of Line)
This ESC sequence deletes the rest of the line in which the cursor is located. Deletion takes place starting at and including the current cursor position. The cursor position itself is not changed.


ESC L (Insert Line)
This makes it possible to insert a blank line at the current cursor position. The rest of the screen is pushed down; this operation causes the loss of the bottommost line. The cursor is at the beginning of the new line after the insertion has taken place.


ESC M (Delete Line)
This function deletes the line in which the cursor is located and moves the rest of the screen toward the top. Consequently, the lowest line on the screen becomes clear. After the completion of the delete operation, the cursor is located in the first column of the added line.


ESC Y (Positioning Cursor)
This is one of the most important functions. It allows for positioning the cursor on the screen any way desired. For this purpose, the function still needs the cursor line and columns as parameters, which are expected in this sequence with an offset of 32. For example, if the user wants to place the cursor in line 5, column 20, the following command has to be issued:
PRINT CHR$(27)+"Y"+CHR$(32+5)+CHR$(32+ 20);
Lines and columns are counted starting at zero. For a 25 * 80 screen, the lines are numbered from 0 to 24 and the columns from 0 to 79.

Note: The function @(Y,X) also returns such a control string.


ESC b (Select Font Color)
This function is used to select the font color for further outputs. A monochrome monitor offers only two choices: 0 = white and 1 = black. For colored representations, a choice of 16 colors exists. Only the lowest four bits are evaluated for the parameter (MOD 16). Therefore, it is possible to designate color one with digit '1' and/or the letter 'A' or 'a'.


ESC c (Select Background Color)
This function is used to select the background color in analog mode. Of course, if the same color is selected for the document and the background, subsequent text output is no longer visible.

ESC d (Clear Screen up to Cursor Position)
This sequence clears the screen starting at and including the current cursor position. The position of the cursor remains unchanged.

ESC e (Cursor On)
This escape sequence makes the cursor become visible, e.g., the cursor can be activated if input from the user is expected.

ESC f (Cursor Off)
The cursor is deactivated again.


ESC j (Save Cursor Position)
This sequence is used to save the current cursor position.


ESC k (Restore Cursor to Saved Position)
This is the counterpart to the above function. The cursor is returned to the position previously stored with ESC j. If no cursor position was saved, the cursor is brought to the Home Position.


ESC l (Delete Line)
The content of the line currently containing the cursor is deleted. All remaining lines are unaffected. After the deletion, the cursor is located in the first column of the deleted line.


ESC o (Delete Beginning of Line)
Deletes the beginning of the cursor line up to and including the cursor position. The position of the cursor remains unchanged.


ESC p (Reverse on)
This sequence switches to inverted output. The effect is that all following output has the font and background colors reversed. A monochrome monitor delivers a white font on a black background.


ESC q (Reverse off)
This sequence is used for switching back to the default settings.

ESC v (Automatic Overflow On)
After executing this sequence, a new line is begun automatically if an attempt is made to produce output exceeding past the end of the line.

ESC w (Automatic Overflow off)
Used to deactivate the above sequence. If an attempt is made to write past the end of the line, all subsequent characters are written to the last column of this line.

Additional Control Characters Not Initiated By ESC:

CHR$(7) (BEL, Audio Output)
Outputs a system beep. The nature of this beep is dependent on the control field setting of the Mac.

CHR$(8) (BS, Backspace)
The cursor moves one position to the left and deletes the character below the cursor.

CHR$(9) (TAB, Tabulator)
The cursor jumps to the nearest tab.

CHR$(10) (LF, Line Feed)
A line feed is triggered.

CHR$(12) (FF, Form Feed)
Effects closure of the current printer page. Most printers, however, do not yet show any activity at this point. Output does not occur until the entire document is closed using 'CHR$(26)'.

CHR$(13) (CR, Carriage Return)
The cursor is moved to the left margin of the line.

CHR$(26) (DE, Document End)
Causes closure of the current printer page and output of the entire document.

6-3. MacOS Error Messages Contents | 7-2. Memory Organization in Omikron Basic

Tech-Support | Order | Start | Home: http://www.berkhan.com


© 1997-2001 Berkhan-Software