VDU Changes between Arthur OS and RISC OS 2.00

Bug fixes (numbers in brackets indicate the bug number in Bugs.1-20)


(502) Flushing the printer buffer no longer zeroes the printer handle. (512) The MOS now range-checks the key number before looking it up in the
      translation table in a keyboard handler.
(516) Line fills to the right no longer corrupt the external graphics
      cursor.
(518, 520) *SCREENLOAD now generates errors correctly (521) *SCREENLOAD now sets the supremacy bit correctly. (522) *SCREENLOAD no longer leaves the cursor on if it needs to change mode. (524) SpriteOp 'Return nth name' now checks for overflowing the name buffer (531) SWI OS_Plot now checks the FX3 status, the VDU queue status and the
      spool handle correctly.
(538) SpriteOp ReadPixelColour now works correctly in 256 colour modes. (539) Latch B is now initialised to 0 on reset. (572) Circular segments are now plotted correctly. (593) The VDU variables WindowWidth and WindowHeight now return correct values
      in all cases.
(594) The horizontal interlace register (HIR) is now programmed correctly in
      hi-res-mono modes.

Hardware bug fix

The OS no longer writes to the ACIA control register if the value it is programming in it is the same as the current value. This cures problems with GTE/CMD chips which corrupt receive characters if the control register is written to at certain times.

International keyboards

Some international keyboards have an extra key to the right of the left-hand shift key. This now has an INKEY(-ve) number associated with it. INKEY(-95) returns -1 if this key is down, 0 otherwise. Linked with this is an internal key number of 94 returned by OSBYTEs &79 and &7A (scan keyboard).

New calls to set ECF origin

VDU 23,17,6,x;y;0,0,0 or SWI OS_SetECFOrigin (&56) with R0=x, R1=y

Under Arthur OS (and on earlier BBC machines) the ECF pattern was always aligned so that the bottom left of the pattern coincided with the bottom left of the screen. These calls makes the bottom left of the pattern coincide with the point (x,y). The origin is restored to bottom left on a mode change.

New call - VDU 23,17,7,flags,x;y;0,0 - Set character size

where flags consists of bit 0 = 1 => set size of VDU 4 chars (not implemented)
                        bit 1 = 1 => set size of VDU 5 chars
                        bit 2 = 1 => set spacing of VDU 5 chars
and x, y are the size of, or spacing between characters in pixels. VDU 5 sizes of 8x8 and 8x16 are optimised for speed; other sizes call the SprExtend module to plot scaled chars (much slower). Setting different VDU 5 spacing does not affect speed. The default size and spacing of VDU 5 chars is 8x8; the default size of VDU 4 chars is 8x8 except in mode 23, when it is 8x16; the default spacing of VDU 4 chars is the same as the sizes, except in gap modes when it is 8x10. The sizes and spacings are reset on a mode change.

The sizes and spacing can be read by calling SWI OS_ReadVduVariables with the following indices:-

GCharSizeX (162) - x size of VDU 5 chars (in pixels), default 8 GCharSizeY (163) - y size of VDU 5 chars (in pixels), default 8 GCharSpaceX (164) - x spacing of VDU 5 chars (in pixels), default 8 GCharSpaceY (165) - y spacing of VDU 5 chars (in pixels), default 8 TCharSizeX (167) - x size of VDU 4 chars (in pixels) TCharSizeY (168) - y size of VDU 4 chars (in pixels) TCharSpaceX (167) - x spacing of VDU 4 chars (in pixels) TCharSpaceY (168) - y spacing of VDU 4 chars (in pixels)

New calls to read ECF patterns, dot-dash pattern

OSWORD 10 (normally for reading character definitions) has been extended. By putting codes corresponding to non-printable characters in byte 0 of the control block, other information can be read as follows:-
Value in block     Information returned in bytes 1 to 8
        2               Ecf pattern 1 (in native mode)
        3               Ecf pattern 2 (------""------)
        4               Ecf pattern 3 (------""------)
        5               Ecf pattern 4 (------""------)
        6               Dot-dash pattern

Address of HLine exported

Vdu variable HLineAddr (index 166) returns the address of a fast horizontal line-drawing routine. The routine is called as follows:- in: R0,R2 = left and right x-coordinates of ends of line (in any order)
R1 = y-coordinate of line
R3 = 0 => plot with no action (ie do nothing)
R3 = 1 => plot using foreground colour and action
R3 = 2 => invert current screen colour
R3 = 3 => plot using background colour and action
R3 >= 4 => R3 -> colour block
R14 = return address (routine exits with equivalent of MOV PC,R14)
        MUST be entered in SVC mode

out: All registers preserved (except for PSR)

All coordinates are in terms of pixels from the bottom left of the screen. The line is clipped to the graphics window, and is plotted using the colour and action specified by R3.

If R3>=4 then R3 points to a colour block, which starts on an address which is a multiple of 64, and has the following format:-

Offset          Value
0               OR  mask for top ECF line
4               EOR mask -------""-------
8               OR  mask for next ECF line
12              EOR mask -------""--------
.               .
.               .
56              OR  mask for bottom ECF line
60              EOR mask --------""---------

NB the bottom ECF line here would be used on the bottom line of the screen (ie it must be pre-adjusted to take the ECF origin into account.)

The caller should previously have called SWI OS_RemoveCursors to remove the software cursor (and should call SWI OS_RestoreCursors to put it back afterwards).

Address of current GCOL colour blocks exported

Vdu variable GcolOraEorAddr (index 171) returns the address of colour blocks for the current GCOLs. If the value returned is n, then

n+&00..n+&3F is a colour block for the foreground colour + action n+&40..n+&7F is a colour block for the background colour + action n+&80..n+&BF is a colour block for the background colour with store action

(for the definition of a colour block, see above). These colour blocks are updated whenever a GCOL or TINT is issued or the ECF origin is changed. They are intended for use by external programs which want to access screen memory directly but which want to have access to the current colour/action settings.

New configuration option - MouseStep n (in range -128 to 127, excluding 0)

Under Arthur OS the mouse step multipliers (x and y) are set to 1 on a reset. In RISC OS 2.00 they are set to the value configured.

Modes 11, 14, 16, 17, 23 now allow graphics

Under Arthur OS the above modes do not allow graphics operations (they are ignored). These modes now do allow graphics, though the user should note the following:-

a) The size of the screen in coordinates is no longer always 1280 by 1024. The size of the screen should be determined by reading VDU variables XWindLimit, YWindLimit, XEigFactor, YEigFactor. Consequently the variable YShftFactor is no longer able to express the full situation, and should not be used.

b) In modes 16 and 17, circles (and arcs, sectors and segments) do not look circular. This is because the aspect ratio of the pixels is not in a 2:1, 1:1 or 1:2 ratio, which are the only ratios the OS can cope with at present.

c) In mode 23, VDU 5 text is single height (by default), not double height like VDU 4 text. (This may change if considered sufficiently undesirable). XEigFactor and YEigFactor are both 1 (not 0 as on 1.20, so default mouse rectangle will be different)

d) Modes 3, 6 and 7 still do not allow graphics, for compatibility with programs written for earlier BBC machines.

e) Modes 11, 14 and 17 are not a multiple of eight pixels high. In these modes the bottom line of the screen corresponds to the bottom line of ECF patterns (by default), but the top line will not correspond to the top line of ECF patterns (by default).

Hi-Res-Mono

Mode 22 has been removed, and Mode 23 is now 1152 x 896 (1 bit per pixel), at a frame rate of 64.4 Hz.

VIDC parameters changed

Some of the VIDC parameters for modes 18,19 and 20 have been altered to correct the problem with the pointer at the right hand edge of the screen. No problems should now be encountered, providing the mouse rectangle is not larger than the display area of the screen (problems still occur with the pointer in the right hand border area - this is a VIDC problem and cannot be avoided).

Callback vector

When RDCH/INKEY(+ve) is idling, waiting for a key to be pressed, then it will call the callback vector (introduced in RISC OS 2.00) if an appropriate callback has been requested.

New module - IIC - See document IIC/1 for details


Vdu output to sprites

A mechanism is available for switching VDU output to act directly on a sprite. The mechanism provides facilities for preserving VDU context while switching. For more details, see the document "VDU output to sprites/1"

Mode extensions

A mechanism is available to allow modules to provide extra screen modes and extra monitor types. For more details, see the document "Mode extensions/1"

Other changes

Block copy/move is faster when the address difference between source and destination is a whole number of words (eg when copying vertically).

Flood fill is a lot faster (up to 10 times as fast for large areas).

ScreenLoad and ScreenSave are a lot faster if the window is full screen width.

VDU 5 text is about 20% faster.