The escape sequence to position the cursor works in all modes. In text mode it simply moves the cursor. In attribute graphics modes it moves the text cursor but leaves the graphics beam pointer alone. In pixel graphics modes it move the graphics beam pointer to the apprpriate text coordinates, so it will be on a character boundary.
The format of the escape sequence is:
esc = y x
This sets the cursor to row y-20h
and column
x-20h
. If either x or y is
20h
(thus setting the row or column zero) then that
coordinate will remain unchanged. This allows just the row or
column to be set.
This escape sequence allows the user to redefine one of the 256 characters. Although it is sent to a specific channel, it actually affects the global character font and will thus affect other channels. Characters already displayed on a page will only be affected for hardware text pages. In other modes only subsequently written characters will be affected. The syntax ot the escape sequence is:
esc K n r1 r2 r3 r4 r5 r6 r7 r8 r9 where : n is the character number (0..255) r1..r9 are the bytes for the nine rows of the character. r1 is the top row.
Note that in high resolution text mode, only the middle six bits of the character bytes will actually be displayed as the other two are masked out and used to control the colour selection.
Each video page has a palette of eight colours associated with it wich is initialised to a useful set of colours when the channel is opened. There is an escape sequence with wich the user can change all these colours. The format of this is:
esc C c1 c2 c3 c4 c5 c6 c7 c8
Each c[1-8]
is a byte specifying the corresponding
palette colours and there must always be eight of them.
There is another escape sequence which allows just one palette colour to be changed. The format of this is:
esc c n c
Where n is the palette colour number 0..7 and c is the new value for this palette colour.
When new palette colours are selected any line parameter blocks which correspond to this video page will be updated so the colours on the screen will change.
The user may specify a palette colour for both the ink and paper colour with separate escape sequences. For all video modes the ink colour defaults to one and the paper colour to zero.
For pixel graphics pages the allowed ink and paper colours depend on the colour mode, so it is 0 or 1 in two colour mode, 0..3 in four colour mode, 0..15 in sixteen colour mode and 0..255 in 256 colour mode. Pixels are always plotted in the current ink colour. The paper colour of the display is only changed when the page is cleared.
In four, sixteen or 256 colour text modes the ink and paper colours have no useful effect because the palette colours for each pixel are determined directly from the bits in the character font. In fact they do have some interaction with the displayed colours and it is best to leave them set to their default values. These modes are only useful if the characters have been redefined to provide some sort of block graphics.
In two colour hardware text mode the ink and paper colours are always (0, 1) or (2, 3). If the ink or paper is changed then the other one is changed to correspond.
In two colour software text mode four colour pairs are available, (0, 1), (2, 3), (4, 5), and (6, 7). Characters are always printed in the current colour pair.
For a graphics page the line style may be set with an appopriate escape sequence. The line style affects line drawing and ellipse drawing but not character plotting or filling. The values for the line style byte are:
1 - solid line (default) 2 .. 14 - various types of broken and dotted lines
An escape sequence specifies the line mode byte which has the following meanings:
The attribute flags byte is only supported for attribute graphics pages. It consists of eight separate flags, four for plotting graphics (points, lines, ellipses and filling) and four for plotting characters. The basic operation which is affected is that of plotting a pixel.
When plotting a pixel in attribute mode there are three items which can be affected. There is the bit in the pixel data byte which corresponds to this pixel, and there are the two colours (ink and paper) in the attribute byte which corresponds to this pixel data byte. The attribute flags byte contains a flag for each of these three items which controls whether or not it it affected when a pixel is plotted. If the ink attribute is to be affected then it will be set to the current ink colour. If the paper attribute is to be affected then it will be set to the current paper colour.
The pixel data is rather more complex. Assuming that the pixel data is to be affected then there is another bit in the attribute flags byte which controls what is done with the pixel data, in conjunction with the current line mode. For plotting characters, if this bit is set then the character will be complemented before being plotted. For plotting graphics, if the corresponding bit is set then a zero will be put into the pixel bit instead of the usual one. When plotting graphics (but not characters) the bit is not in fact put directly into the pixel byte but is combined with the current value of the bit according to the current line mode. This means for example that exclusiveor plotting will still work.
The top four bits of the attribute flags byte control character plotting and the bottom four control graphics plotting. For all bits the 'normal' state is zero which results in all attributes and pixel data being affected, and plotting to be in the normal sense. The assignment of bits is:
bit 7 -
affect paper attributes in character plotting
bit 6 -
affect ink attributes in character plotting
bit 5 -
affect pixel data in character plotting
bit 4 -
set to complement character before plotting
bit 3 -
affect paper attributes in graphics plotting
bit 2 -
affect ink attributes in graphics plotting
bit 1 -
affect pixel data in graphics plotting
bit 0 -
set to do graphics plotting in 0's instead of 1's
Note that when filling, bit 1 of the attribute byte is assumed to be clear regardless of its actual state this is necesarry because if the pixel data where not affected then the fill algorithm would never terminate.
The graphics fill command is a simple escape sequence which does a fill from the current beam position. It fills in the current ink colour up to any boundary which is not the same colour as the current beam position. It handles concave shapes and tests for reaching the edge of the video page. It may fail to fill the entire shape if it runs out of stack but this should only happen with extremely complex shapes since it does garbage collection on the stack when it gets full.
The ellipse drawing routine takes two 16bit parameters (low byte first) specifying the x and y radii. To draw a circle these should be the same value. The centre of the ellipse will be at the current beam position. The format of the escape sequence is:
esc E xx yy