Using Mnemonics

Mnemonics are inserted in a statement at the point where the stated operation is desired. The following example demonstrates the format and use of mnemonics:

>PRINT 'CS'

This would send the 'CS' mnemonic to the console device (the device on channel 0). Assuming the console was a terminal, the screen would be cleared to spaces. Some mnemonics may have arguments following, as in:

>PRINT 'WINDOW'(5,10,50,10),

The 'WINDOW' mnemonic creates a "new" display area at the column and row specified with a width and depth of the number of columns and rows specified.

You may place several mnemonics on a single output:

0100 PRINT @(12,10),"Position 12,10",'LF',"newline"

In this example the @(12,10) mnemonic positions the cursor at column 12, row 10 of the user's terminal (both of these values are relative to zero). The 'LF' mnemonic is used to perform a linefeed on the terminal after the text "Position 12,10" is printed. If the 'LF' mnemonic is inserted in the statement immediately following the PRINT command, the linefeed occurs prior to printing the text. The linefeed occurs when 'LF' is processed in the input string.

All mnemonics, except the @ position mnemonic, consist of two or more alphanumeric characters enclosed in single quote ( ' ) marks.

If you use an invalid mnemonic, or one not applicable to a particular device, PRO/5 issues !ERROR=29, (Undefined Mnemonic) when the statement executes. Mnemonics directed to a device that does not support mnemonics, or to a file, are output as a string in the following format:

2-character mnemonics

$1b$+<mnemonic text>

3-..31-character mnemonics

$1b$+<len of mnemonic>+<mnemonic text>

arguments for mnemonics

$ff$+<number of arguments>

for each argument

$ff$+<4-byte integer>

 

$fe$+<8-byte BUS value>

 

$len of text$+<text of string>

If the mnemonic takes 0 arguments, no $ff$+<number of arguments> is appended.

The mnemonic constants for terminals, printers, and plotters appear later in this section. They are listed according to their applicability to the device. Many of the mnemonics for terminals are complements of one another. In these cases, the mnemonics are listed together. For example, 'BE' and 'EE' are complementary mnemonics used to begin and end the echoing of typed characters on the terminal.

Channel Control Mnemonics

The channel control mnemonics set and reset I/O modes that pertain to the PRO/5 channel the device is OPENed on. These modes are in their default state following any new OPEN of the device.

Device Control Mnemonics

The device control mnemonics set and reset I/O modes that pertain to the device OPENed. Each channel OPENed to the same device will share in these modes. Upon the first OPEN of a device these flags are set to their default state.

Character Attribute Mnemonics

The character attribute mnemonics have an effect upon the text being printed on the device. The attributes may be reset on execution of a device function mnemonic. All OPENs of a device share the current attributes.

Device Function Mnemonics

These mnemonics perform operations on the device. Included in this set of mnemonics are those that perform carriage movement on printers and those that modify the display on terminals.

Mnemonics are among PRO/5's most powerful features and you are encouraged to experiment with their power and functionality.

PRO/5 mnemonics, their purpose, function, and proper usage, are discussed throughout the rest of this chapter.

NOTE: Understanding and proper use of mnemonics is critical to making full use of PRO/5's power.


BBj-Specific Information

In BBj 14 and higher, the MNEMONIC_INT_ROUNDING !OPTIONS setting can be set to TRUE to allow non-integer values in the @(x) and @(x,y) mnemonics. By default, passing a non-integer value to the @() mnemonics throws !ERROR=41. When this option is set to TRUE, the @() mnemonics will accept non-integer values, rounding to the nearest integer. In this mode, PRINT @(25.5) is interpreted as PRINT @(26), and PRINT @(10.4,11.5) is interpreted as PRINT @(10,12).