VDG Display System Functions
The Video Display Generator
&os9level; allows the VDG display to be used in
alphanumeric, semigraphic, and graphics modes. There are many
built-in functions to control the display, which are activated by
used of various ASCII control character. Thus, these functions are
available for use by software written in any language using standard
output statements (such as "PRINT" in BASIC). The &make;'s Basic09
language has a Graphics Interface Module that can automatically
generate these codes using Basic09 RUN statements.
The display system has two display modes: Alphanumeric
("Alpha") mode and Graphics mode. The Alphanumeric mode also
includes "semigraphic" box-graphics. The &make;'s display
system uses a separate - memory area for each display mode so
operations on the Alpha display do not affect the Graphics display,
and visa-versa. Either display can be selected under software
control.
8-bit characters sent to the display system are interpreted
according to their numerical value, as shown in the chart below.
Character Range (Hex)
Mode/Used For
00 - 0E
Alpha Mode - cursor and screen control
0F - 1B
Graphics Mode - drawing and screen control
1C - 20
Not used
20 - SF
Alpha Mode - upper case characters
60 - 7F
Alpha Mode - lower case characters
80 - FF
Alpha Mode - Semigraphic patterns
The graphics and alphanumeric functions are handled by the OS-9
device driver module called "CCIO".
Alpha Mode Display
This is the "standard" operational mode. It is used to display
alphanumeric characters and semigraphic box graphics, and simulates
the operation of a typical computer terminal with functions for
scrolling, cursor positioning, clear screen, line delete, etc.
Each 8-bit character is assumed to be an ASCII character and is
displayed if its high order bit (sign bit) is cleared. Lower case
letters are displayed in reverse video. If the high order bit of
the character is set it is assumed to be a "Semigraphic 6" graphics
box. See the &make; manual for an explanation of semigraphics
functions.
Alpha Mode Command Codes
Control Code
Name/Function
01
HOME - return cursor to upper left hand corner of screen
02
CURSOR XY - move cursor to character X of line Y. The
binary value minus 32 of the two characters following
the control character are used as the X and Y
coordinates. For example, to position the cursor at character 5 of line 10,
you must give X=37 and Y42
03
ERASE LINE - erases all characters on the cursor's line.
06
CURSOR RIGHT - move cursor right one character position
08
CURSOR LEFT - move cursor left one character position
09
CURSOR UP - move cursor up one line
10
CURSOR DOWN (linefeed) move cursor down one line
12
CLEAR SCREEN - erase entire screen and home cursor
13
RETURN - return cursor to leftmost character of line
14
DISPLAY ALPHA - switch screen from graphic mode to alpha
numeric mode
Graphics Mode Display
This mode is used to display high-resolution 2- or 4-color
graphics, and it includes commands to: set color; plot and erase
individual points; draw and erase lines; position the graphics
cursor; and draw circles.
The DISPLAY GRAPHICS command must be executed before any other
graphics mode command is used. It causes the graphics screen to be
displayed and sets a current display format and color. The Li.u.t
time the DISPLAY GRAPHICS command is given, a 6144 byte display
memory is allocated by OS-9, so there must be at least this much
continuous free memory available (the OS-9 "MFREE" command can be
used to check free memory). This memory is retained until the END
GRAPHICS command is given, even if the program that initiated
Graphics mode finishes, so it important that the END GRAPHICS
command be used to give up the display memory when Graphics mode is
no longer needed.
Graphics mode supports two basic formats: Two-Color which has
256 horizontal by 192 vertical points (G6R mode); and Four Color
which has 128 horizontal by 192 vertical points (G6C mode). Two
color sets are available in either mode. Regardless of the
resolution of the format selected, all Graphics mode commands use a
256 by 192 point coordinate system. The X and Y coordinates are
always positive numbers which assume that point 0,0 is the lower
lefthand corner of the screen.
An invisible Graphics Cursor is used by many command to reduce
the amount of output required to generate graphics. This cursor can
be explicitly set to any point using the SET GRAPHICS CURSOR
command. Also, all other commands that include X,Y coordinates
(such as SET POINT) move the graphics cursor to the specified
position.
Graphics Mode Selection Codes
Code
Format
00
256 x 192 two-color graphics
01
128 x 192 four-color graphics
Color Set and Current Foreground Color Selection Codes
Two Color Format
Four Color Format
Char
Background
Foreground
Background
Foreground
Color Set 1
00
Black
Black
Green
Green
01
Black
Green
Green
Yellow
02
Green
Blue
03
Green
Red
Color Set 2
04
Black
Black
Buff
Buff
05
Black
Buff
Buff
Cyan
06
Buff
Magenta
07
Buff
Orange
Color Set 3*
08
Black
Black
09
Black
Dark Green
10
Black
Med. Green
11
Black
Light Green
Color Set 4*
12
Black
Black
13
Black
Green
14
Black
Red
15
Black
Buff
* Color sets 3 and 4 not available on PAL video system (European)
models. These color sets work only with NTSC (U.S., Canada, Japan)
models.
Graphics Mode Control Commands
Control Code
Name/Function
15
DISPLAY GRAPHICS - switches screen to graphics mode.
This command must be given before any other
graphics commands are used. The first time this command
is given, a 6K byte display buffer is assigned. If 6K of
contiguous memory is not available an error is returned.
This command is followed by two characters which specify
the graphics mode and current color/color set, respectively.
16
PRESET SCREEN - presets entire screen to color code
passed in next character.
17
SET COLOR - selects foreground color (and color set)
passed in next character, but does not change graphics
mode.
18
QUIT GRAPHICS - disables graphics mode and returns the
6K byte graphics memory area to OS-9 for other use, and
switches to alpha mode.
19
ERASE GRAPHICS - erases all points to background color
and homes graphics cursor to the desired position.
20
HOME GRAPHICS CURSOR - moves graphics cursor to coordinates
0,0 (lower left hand corner).
21
SET GRAPHICS CURSOR - moves graphics cursor to given
coordinates X,Y. The binary value of the two characters that immediately
follow are used as the X and Y values, respectively.
22
DRAW LINE - draws a line of the current foreground
color from the current graphics cursor position to the
given X,Y coordinates. The binary value of the two
characters that immediately follow are used as the X
and Y values, respectively. The graphics cursor is
moved to the end point of the line.
23
ERASE LINE - same as DRAW LINE except the line is
"drawn" in the current background color, thus erasing
the line.
24
SET POINT - sets the pixel-at point X,Y to the current
foreground color. The binary value of the two
characters that immediately follow are used as the x
and Y values, respectively. The graphics cursor is
moved to the point Set.
25
ERASE POINT - same as DRAW POINT except the point is
"drawn" in the current background color, thus erasing
the point.
26
DRAW CIRCLE - draws a circle of the current foreground
color with its center at the current graphics cursor
position using a radius R which is obtained using the
binary value of the next character. The graphics
cursor position is not affected by this command.
Get Status Commands
The &make; I/O driver includes OS-9 Get Status
commands that return the display status and joystick values,
respectively. These are accessable via the Basic09 Graphics
Interface Module, or by the assembly language system calls listed
below:
GET DISPLAY STATUS:
Calling Format
lda #1 (path number)
ldb #SS.DStat (Getstat code $12)
os9 I$GSTT call OS-9
Passed
nothing
Returns
X = address of graphics display memory
Y = graphics cursor address x=MSB y =LSB
A = color code of pixel at cursor address
GET JOYSTICK VALUES:
Calling Format
lda #1 (path number)
ldb #SS.Joy (Getstat code $13)
os9 I$GSTT call OS-9
Passed
X = 0 for right joystick; 1 for left joystick
Returns
X = selected joystick x value (0-63)
Y = selected joystick y value (0-63)
A = $FF if fire button on; $00 if off
Display Control Codes Condensed Summary
1st Byte
2nd Byte
3rd Byte
Function
00
Null
01
Home Alpha Cursor
02
Column+32
Row+32
Position Alpha Cursor
03
Erase Line
06
Cursor Right
08
Cursor Left
09
Cursor Up
10
Cursor Down
12
Clear Screen
13
Carriage Return
14
Select Alpha Mode
15
Mode
Color Code
Select Graphics Mode
16
Color Code
Preset Screen
17
Color Code
Select Color
18
Quit Graphics Mode
19
Erase Screen
20
Home Graphics Cursor
21
X Coord
Y Coord
Move Graphics Cursor
22
X Coord
Y Coord
Draw Line to X/Y
23
X Coord
Y Coord
Erase Line to X/Y
24
X Coord
Y Coord
Set Point at X/Y
25
X Coord
Y Coord
Clear Point at X/Y
26
Radius
Draw Circle