VDU variables

Introduction and Overview

The Mode (sub-128) and VDU variables (post-128) read by SWI OS_ReadModeVariable and SWI OS_ReadVduVariables have been expanded to cover more of the features provided by the operating system.

Technical Details

Mode flags (variable 0)

The mode flags have been extended to allow the specification of data formats within the display. These are primarily for use when reading the data types within sprite redirection, but may be extended in the future to cover display formats as well.

During sprite redirection and mode selection the Kernel will detect whether a grey scale palette has been used. This will be marked within the mode flags but may also be used during mode selection. In a similar manner to the selection of full palette modes (PRM 5a-135) the greyscale bit may be set to select a mode with the palette programmed to uniformly distributed grey levels. Colour 0 will be set to black, and the highest numbered colour within the mode will be set to white. This differs from the default palettes used in the Wimp 4 grey (white to black) and 16 grey modes (white to black for first 8 and then grey levels to fill the gaps in a manner similar to the original 16 colours).

The full mode flags are :

Bit(s)Meaning
0Non-graphics mode (PRM 1-710)
1Teletext mode (PRM 1-710)
2Gap mode (PRM 1-710)
3BBC style gap mode (PRM 1-710)
4Hi-resolution mono mode (PRM 1-710)
5Double height text characters (PRM 1-710)
6Hardware scroll never used (PRM 1-710)
7Fully specified palette (PRM 5a-114)
8Interlaced mode (NC OS documentation)
9Greyscale palette (described above)
10-11Reserved
12-15Data format (see the SpriteExtend CMYK documentation):
ValueMeaning
0RGB data, regular RISC OS format
1CMYK data
2-15Reserved

Of these, the gap modes and double height text may not be supported by all graphics hardware.

Total screen memory size (variable 150)

This variable returns the total size of the memory provided by the current display driver, where this value is known. In the past it has been used to calculate the number of banks available. Because of limitations within graphics hardware, this may not be possible. The SWI OS_ScreenMode 7 call should be used to perform this operation. This variable may take the value 0 where the size available for the screen is not known.

VIDC Clock Speed (variable 172)

This variable is no longer supported.

Current display number (variable 192)

The current display device number is readable using the SWI OS_ReadVduVariables call, as well as through the SWI OS_ScreenMode B operation.

Poly-HLine function (variable 193)

This variable provides the address of a routine which may be used to plot a number of horizontal line segments to the display in a similar manner to that of HLineAddr (variable 166, PRM 1-705). It is described under PolyHLine.

Entry Points

PolyHLine
Plot a number of horizontal line segments (VDU variable 193)
R0=Pointer to buffer containing:
OffsetContents
0Number of lines in buffer
4Left x coordinate of first line
8Y coordinate of first line
12Right x coordinate of first line
16Left x coordinate of second line
20Y coordinate of second line
24Right x coordinate of second line
28... and so on for each further line
R3=Colour action:
ValueMeaning
0Plot with no action
1Plot using foreground colour and action
2Invert current screen colour
3Plot using background colour and action
>3Pointer to OR-EOR colour block
R14=Return address
R0 - R14preserved
Interrupts are undefined
Fast interrupts are undefined
Processor is in SVC mode
Not defined

The routine must be entered in SVC mode. All registers are preserved.

All coordinates are in terms of pixels from the bottom left of the screen. Each line will be clipped against the current graphics window. The caller should have called SWI OS_RemoveCursors before this call, and should call SWI OS_RestoreCursors after it.