EXOS 2.1 Video Driver Specification

4. Character Output

The screen driver supports both the single character write and the block write EXOS function calls. A block write is exactly equivalent to writing all the characters individually, except that it is rather faster as it avoids the overhead of going through EXOS for every character.


4.1 Printing Characters

All character codes above 31 will be treated as printing characters and will be put at the appropriate place on the video page. All modes have some sort of cursor which moves when a character is printed but the details vary between different modes.

The bitmaps for the characters are stored in a fixed character font which initialised to an ASCII character set. Each character is eight bits wide and nine bytes deep, including the space between characters and between lines. The user can re­define any of these characters with an escape sequence as specified below.

Character codes in the range 32 to 127 will be displayed as the correct character number from the font. Characters in the range 128 to 255 will be displayed as characters 0 to 127 from the font. Thus writing character 160 (128 + 32) to a video page will have exactly the same effect as writing character 32. However writing the character 159 (128 + 31) will display character number 31 from the font on the page but writing character 31 will do nothing because it will be interpreted as a control code (this particular control code is ignored).

4.1.1 Text Mode Character Printing

Text pages (modes 0 and 2) maintain a single text cursor which is in text co­ordinates. The printing character is displayed at this position and the cursor moved to the next character slot. At the end of a line the cursor automatically moves to the start of the next line, with automatic scrolling if it is at the bottom of the screen (this automatic scrolling can be disabled).

4.1.2 Pixel Graphics Mode Character Printing

Pixel graphics pages maintain a beam pointer in graphics co­ordinates. The printing character is displayed at this beam position and the beam moved to the next character position, moving to the start of the next line if at the end of a line. Characters can be displayed at any pixel position, not just on character boundaries. There is no scrolling. If the beam is too near the bottom of the page to fit the whole character on then it will not display anything.

Characters are displayed in the current ink colour regardless of whether the beam is on or off. The character is displayed by reading bits out of the font and if the bit is set the pixel is plotted in the current ink colour using the current line mode. If the bit is clear then the corresponding pixel will be left unchanged. A character will therefore overlay rather than replace anything which is already on the page.

The characters will be the correct shape in any colour mode but the aspect ratio will vary with the different modes. To improve legibility the character height is doubled for sixteen and 256 colour mode.

4.1.3 Attribute Graphics Mode Character Printing

An attribute graphics page maintains a text cursor in text co­ordinates and a separate graphics beam position in graphics co­ordinates. Characters are printed at the text cursor position and so will always be in exact character positions. At the end of a line the text cursor will go on to the start of the next line and at the end of the page it will go back to the top left of the page - there is no scrolling.

How the character is displayed depends on the current value of the attribute flags byte for this page. This is a byte which can be set by an escape sequence and is described in more detail later on. It basically controls what sections of the attribute and pixel data will be affected by writing characters or plotting graphics.


4.2 Control Codes and Escape Sequences

Characters in the range 0 to 31 are control characters and are not printed. Some of these are interpreted by video pages, depending on the mode. Any which are not understood are simply ignored. A special control code is ESCAPE (ASCII 1Bh) which is used to start an escape sequence for carrying out various functions.

Below is a list of the control codes and escape sequences interpreted by the various modes. The more complex of these are explained in the next section.

4.2.1 Codes Interpreted By Any Video Page

    ^Z (1Ah)   Clear entire page and home cursor/beam

    ^J (0Ah)   Line-feed. Move cursor down to next line (scrolls
               if at bottom of screen in text mode and scrolling
               is enabled).

    ^M (0Dh)   Carriage return. Returns cursor to start of
               current line.

    ^^ (1Eh)   Cursor/beam home. (ASCII RS)

    esc K      Define character.

    esc C      Set all palette colours.
    esc c      Set one palette colour.

    esc I n    Set ink colour to n.
    esc i n    Set paper colour to n.

    esc = y x  Set cursor position at (x,y).

4.2.2 Codes Interpreted By Text Pages Only

    ^Y (19h)   Clear to end of line. Does not move cursor.

    ^H (08h)   Cursor left.  (ASCII  BS)
    ^I (09h)   Cursor right. (ASCII TAB)
    ^K (0Bh)   Cursor up.    (ASCII  VT)
    ^V (16h)   Cursor down.  (ASCII SYN)

    esc ?      Read cursor position. Also supported in
               attribute mode

    esc . n    Set cursor character to character code n.

    esc M n    Set cursor colour to palette colour n.

    esc O      Set cursor display on.
    esc o      Set cursor display off.

    esc S      Set automatic scrolling on.
    esc s      Set automatic scrolling off.

    esc U m n  Scroll  up  lines m-20h to n-20h  (m<=n).
    esc u m n  Scroll down lines m-20h to n-20h  (m<=n).

4.2.3 Code Interpreted By Graphics Pages Only

    esc A xx yy  Position beam at co-ordinates (xx,yy) where
                 xx and yy are each 16 bit hex numbers
                 specified low byte first.

    esc R xx yy  Relative beam movement by amount (xx,yy).

    esc @        Read beam position

    esc S        Set beam on.
    esc s        Set beam off.

    esc . n      Set beam to line style n
    esc M n      Set beam to line mode n

    esc a n      Set attribute flags byte to n. Only allowed
                 in attribute mode.

    esc F        Graphics fill
    esc E        Plot ellipse

Next Chapter: Details of Escape Sequences.



David Bouman. (dsbouma@cs.vu.nl)