ATTR

BASin

ATTR ATTRibutes

Function

ATTR gives the attributes of a specified character position on the screen. These are the ink and paper colours, brightness and flash status of the character at the position.

How to use ATTR

ATTR is followed by two numeric values separated by a comma and enclosed in brackets, for example

150 IF ATTR(v,h)=115 THEN GO SUB 2000

The first value following ATTR (v above) may range from 0 to 23 and is the line number of a position on the screen. The second value (h above) may range from 0 to 31, and is the column number of the position. ATTR then returns a number from 0 to 255. This number is the sum of the attributes at the specified position, and is made up as follows:

Ink colour (0 to 7)

Paper colour (8 times 0 to 7)

Bright (64)

Flashing (128)

Example

If a character at position 11,16 is displayed in ink colour 3 (magenta), paper colour 6 (yellow), and is bright but not flashing, then the command

PRINT ATTR(11,16)

displays 115 (3 + 8×6 + 64 + 0).

ATTR in binary form

ATTR returns one byte in which bit 7 (most significant) is 1 for flashing or 0 for normal, bit 6 is 1 for bright or 0 for normal, bits 5 to 3 are the paper colour (in binary) and bits 2 to 0 are the ink colour.

Format

  • ATTR (num-expr, num-expr)