|
The Memotech MTX Series |
|
Memotech Compact Flash System - Version 2
CFX - II Video Modes
one ?)
Video Modes and their
usage
Bill has documented the video modes available in CFX-II in an
Open Office document and a
PDF - I have
transcribed the content on this page.
CFX-II
Video Modes
Bill
Brendling 15 April 2020
Introduction
The VGA output from the CFX-II board is produced by a
Parallax Propeller microcontroller chip. This supports a number
of different operating modes:
- 80 x 24 text modes with 160 x 96 graphics, largely
similar to the Memotech 80 column card:
- 16 colour mode compatible with the Memotech card
using colour output.
- Monochrome (green) mode compatible with the Memotech
card using monochrome output.
- Enhanced 64 colour mode.
- 320 x 240 graphics mode with 40 x 24 text:
- 2 out of 64 colours per character cell.
- MTX VDP emulation mode:
- Text mode: 40 x 24 characters.
- Graphics mode I: 256 x 192 graphics, 2 out of 16
colours per 16 character cells.
- Graphics mode II: 256 x 192 graphics, 2 out of 16
colours per character cell.
- Multi-colour mode: 80 x 48 independent colour tiles.
The VDP emulation modes shadow the hardware interface of the
VDP, reproducing what is displayed on the composite video
output. The 80 column modes are software compatible with the
original Memotech card, but with a different hardware interface.
CP/M Display
In CP/M mode character sequences for display are sent to the
Propeller video generator. Processing of control and escape
sequences is performed by the Propeller firmware on the CFX-II
card rather than by a CP/M driver such as that for the original
Memotech 80 column card.
Mode Selection
The CFX-II starts in 80 column, 16 colour mode compatible
with the original Memotech 80 column driver. The following
character sequences (escape codes) are used to switch between
modes:
Character Sequence
|
Mode Selected
|
0x1B, 0x9B
|
VDP emulation
|
0x1B, 0x9C
|
Compatible: 24 row x 80 column text, 16 colours, 160 x
96 graphics
|
0x1B, 0x9D
|
Monochrome: 24 row x 80 column text, monochrome green,
160 x 96 graphics
|
0x1B, 0x9E
|
Enhanced: 24 row x 80 column text, 64 colours, 160 x 96
graphics
|
0x1B, 0x9F
|
Graphics: 24 row x 40 column text, 64 colours, 320 x 240
graphics
|
These escape sequences do nothing on the original MTX, and
have been chosen as unlikely to be generated accidentally. Note
that the second character has to be exactly as given, none of
the other characters with the same 5 lsb work (unlike most
escape codes on the MTX).
Entering VDP emulation mode takes a few seconds and video
generation is interrupted during the transition. Once the
emulation has started the emulated VDP is still not configured
with the MTX font, and shows a blank (red) screen. It then needs
to be configured by writes to ports 0x01 and 0x02, as per the
VDP. Once in VDP mode, this mode can only be exited by resetting
the Propeller by a command to port 0x61 (see later), again
causing an interruption to video generation.
Printable Characters (0x20 –
0xFF)
Typically a printable character will be displayed upon the
screen, using the current printing attributes, and the cursor
advanced one space. This may be affected by the write mask (Esc
“W”). If this is set, the character may be updated, without
changing the existing on-screen attributes, or the attributes
may be updated without changing the displayed character.
If the cursor goes beyond the bottom of the screen, either
the display will scroll (scroll mode) or the cursor will return
to the top of the screen (page mode). There is nothing in the
driver to pause and wait for a key press at the end of a page.
This functionality must be at a higher level.
The CFX-II video has 256 character glyphs, illustrated in the
figure below and an additional 256 plotting glyphs (the same as
the Memotech 80 column card). Assuming that a character is
output, the glyph displayed depends upon the font selected, and
whether or not the graphics mode bit is set in the attribute
byte.
If the graphics mode bit is clear, then the following table
gives the glyph displayed:
Character Code
|
Standard Font
|
Alternate Font
|
Special Graphics Font
|
0x20 - 0x3F
|
Standard numerals
(glyphs 0x20-0x3F)
|
Alternate numerals
(glyphs 0xA0-0xBF)
|
Standard numerals
(glyphs 0x20-0x3F)
|
0x40 - 0x5F
|
Standard upper case
(glyphs 0x40-0x5F)
|
Alternate upper case
(glyphs 0xC0-0xDF)
|
Special graphics (lower)
(glyphs (0x00-0x1F)
|
0x60 - 0x7F
|
Standard lower case
(glyphs 0x60-0x7F)
|
Alternate lower case
(glyphs 0xE0-0xFF)
|
Special graphics (upper)
(glyphs 0x80-0x9F)
|
0x80 - 0x9F
|
Special graphics (upper)
(glyphs 0x80-0x9F)
|
Special graphics (upper)
(glyphs 0x80-0x9F)
|
Special graphics (lower)
(glyphs 0x00-0x1F)
|
0xA0 - 0xBF
|
Alternate numerals
(glyphs 0xA0-0xBF)
|
Alternate numerals
(glyphs 0xA0-0xBF)
|
Standard numerals
(glyphs 0x20-0x3F)
|
0xC0 - 0xDF
|
Alternate upper case
(glyphs 0xC0-0xDF)
|
Alternate upper case
(glyphs 0xC0-0xDF)
|
Special graphics (lower)
(glyphs 0x00-0x1F)
|
0xE0 - 0xFF
|
Alternate lower case
(glyphs 0xE0-0xFF)
|
Alternate lower case
(glyphs 0xE0-0xFF)
|
Special graphics (upper)
(glyphs 0x80-0x9F)
|
It should be noted that character code 0x7F is printable.
It does not delete the character under the cursor. If the
graphics mode attribute is set, then the corresponding plotting
glyph is displayed. Each of the plotting glyphs consists of a
4x2 array of plot points as below, with the point filled if the
corresponding bit is set, or clear if the bit is not set.
Bit 0 (lsb)
|
Bit 1
|
Bit 2
|
Bit 3
|
Bit 4
|
Bit 5
|
Bit 6
|
Bit 7 (msb)
|
Control Codes (0x00 – 0x1F)
Control codes may be followed by one or
more data bytes update the display in various ways, as detailed
in the following table. Any screen updates are affected by the
settings of the write mask, as for the printable characters.
Some of the details depend upon the currently selected mode
(C=Compatible, M=Monochrome, E=Enhanced, G=Graphics).
Mode
|
Control Code
|
Data Bytes
|
Action
|
CMEG
|
^@ (0x00)
|
|
Does nothing
|
CME
|
^A (0x01)
|
m, n
|
Plot a point at x = m – 32, y = n – 32
If x < 0, x > 159, y < 0 or y > 95 do nothing.
|
G
|
^A (0x01)
|
xl, xh, y
|
Plots a point at x = 256 * xh + xl, y
If x < 0, x > 319, y < 0 or y > 239 do nothing.
|
CME
|
^B (0x02)
|
m1, n1,
m2, n2
|
Draws a line from x1 = m1 -32, y1 = n1 – 32
to x2 = m2 – 32, y2 = n2 - 32
|
G
|
^B (0x02)
|
x1l, x1h, y1,
x2l, x2h, y2
|
Draws a line from x1 = 256 * x1h + x1l, y1
to x2 = 256 * x2h + x2l, y2
|
CMEG
|
^C (0x03)
|
m, n
|
Sets cursor position: row = m – 32, column = n - 32
|
C
|
^D (0x04)
|
m
|
Set background colour (printing and non-printing):
Bit 0 = Red, Bit 1 = Green, Bit 2 = Blue
|
M
|
^D (0x04)
|
m
|
Set the following attributes (printing and
non-printing):
Bit 1 = Inverse video
Bit 2 = Shaded background
|
EG
|
^D (0x04)
|
m
|
Set background colour (printing and non-printing):
Bits 0 & 1 = Red, Bits 2 & 3 = Green, Bits 4 & 5 = Blue
|
CMEG
|
^E (0x05)
|
|
Erase to end of line. Fill from cursor position to end
of line with space character and non-printing attribute.
|
C
|
^F (0x06)
|
m
|
Set colours and attributes (printing and non-printing):
Foreground: Bit 0 = Red, Bit 1 = Green, Bit 2 = Blue
Background: Bit 3 = Red, Bit 4 = Green, Bit 5 = Blue
Attributes: Bit 6 = Blink, Bit 7 = Plotting
|
M
|
^F (0x06)
|
m
|
Set attributes (printing and non-printing):
Bit 0 = Underline, Bit 2 = Bright, Bit 4 = Inverse
video,
Bit 5 = Shaded background, Bit 6 = Blink,
Bit 7 = Plotting
|
EG
|
^F (0x06)
|
m
|
Set foreground colour (printing and non-printing):
Bits 0 & 1 = Red, Bits 2 & 3 = Green, Bits 4 & 5 = Blue
|
CMEG
|
^G (0x07)
|
|
Does nothing
|
CMEG
|
^H (0x08)
|
|
Moves the cursor back one space. If at the beginning of
a line, moves back to the end of the previous line. If
at top of screen, does nothing. Does not erase the
character.
|
CMEG
|
^I (0x09)
|
|
Tab. Moves the cursor forward to the next multiple of 8
columns. If in the last 7 columns of a line moves to the
start of the next line.
If in last 7 characters of screen, either scrolls
a line, or moves to top of screen, depending upon scroll
/ page mode.
|
CMEG
|
^J (0x0A)
|
|
Cursor down. Moves the cursor down one line. If on last
line of screen, either scrolls a line, or moves to top
of screen, depending upon scroll / page mode.
|
CMEG
|
^K (0x0B)
|
|
Move cursor up one line. If already at top of screen, do
nothing.
|
CMEG
|
^L (0x0C)
|
|
Clear screen. Fill entire video RAM with space character
and non-printing attribute (depending upon write mask).
Sets top of screen to top of video RAM.
|
CMEG
|
^M (0x0D)
|
|
Carriage return. Sets cursor position to beginning of
line.
|
CMEG
|
^N (0x0E)
|
|
Blink on. Sets the blink bit (bit 6) in the printing
attributes byte only.
|
CMEG
|
^O (0x0F)
|
|
Blink off.
Clears the blink bit (bit 6) in the printing attributes
byte only.
|
CEG
|
^P (0x10)
|
|
Set print foreground colour to black.
|
M
|
^P (0x10)
|
|
Print attributes: Underline and bright off.
|
CEG
|
^Q (0x11)
|
|
Set print foreground colour to red.
|
M
|
^Q (0x11)
|
|
Print attributes: Underline on, bright off.
|
CEG
|
^R (0x12)
|
|
Set print foreground colour to green.
|
M
|
^R (0x12)
|
|
Print attributes: Underline and bright off
|
CEG
|
^S (0x13)
|
|
Set print foreground colour to yellow.
|
M
|
^S (0x13)
|
|
Print attributes: Underline on, bright off.
|
CEG
|
^T (0x14)
|
|
Set print foreground colour to blue.
|
M
|
^T (0x14)
|
|
Print attributes: Bright on, underline off.
|
CEG
|
^U (0x15)
|
|
Set print foreground colour to magenta.
|
M
|
^U (0x15)
|
|
Print attributes: Bright and underline on.
|
CEG
|
^V (0x16)
|
|
Set print foreground colour to cyan.
|
M
|
^V (0x16)
|
|
Print attributes: Bright on, underline off.
|
CEG
|
^W (0x17)
|
|
Set print foreground colour to white.
|
M
|
^W (0x17)
|
|
Print attributes: Bright and underline on.
|
CMEG
|
^X (0x18)
|
|
Initialise display:
Turns on scroll mode.
Sets both printing and non-printing colours to green
foreground on black background.
Turns on the cursor.
Enables both character and attribute writes.
Performs a carriage return and line feed.
Selects the standard font.
|
CMEG
|
^Y (0x19)
|
|
Cursor forward. If in the last column of a line moves to
the start of the next line.
If in last character of screen, either scrolls a
line, or moves to top of screen, depending upon scroll /
page mode.
|
CMEG
|
^Z (0x1A)
|
|
Home cursor. Moves cursor position to first character of
top row.
|
CMEG
|
^[ (0x1B)
|
|
Start of an escape sequence. See next section.
|
CMEG
|
^\ (0x1C)
|
|
Sets scroll mode. If cursor flows off the bottom of the
screen, then all text is moved up one line, bottom line
is cleared (using space character and non-printing
attribute, depending upon write mask), and cursor is
positioned on the new bottom line.
|
CMEG
|
^] (0x1D)
|
|
Sets page mode. If cursor flows off bottom of screen it
re-appears at the top of the screen. None of the screen
is cleared. There is no code in the driver to wait for a
key press.
|
CMEG
|
^^ (0x1E)
|
|
Turn on display of the cursor position.
|
CMEG
|
^_ (0x1F)
|
|
Turn off display of the cursor position.
|
Escape Sequences
Escape sequences are similar to control codes. They consist
of the ESC character (0x1B), followed by the command character
and then possibly one or more data bytes.
In the Memotech implementation, if the character following
the ESC is in the range 0x00 – 0x1F then the sequence is
terminated and does nothing. Otherwise the 5 lsb of the command
character are used to select the command to be executed.
Therefore the sequence (ESC, 0x01) does nothing while each of
the sequences (ESC, “!”), (ESC, “a”), (ESC, 0x81), (ESC, 0xA1),
(ESC, 0xC1) and (ESC, 0xE1) all do the same as (ESC, “A”). In
the table below, the standard upper case command character is
listed, but the descriptions are applicable to all the other
equivalents.
Mode
|
Command Character
|
Data Bytes
|
Action
|
CMEG
|
@ (0x40)
|
|
Does nothing.
|
CMEG
|
A (0x41)
|
|
Selects alternate font (see section on printable
characters)
|
C
|
B (0x42)
|
m
|
Clears or sets print and non-print colour and attribute
bits according to m = “0” (0x30) to m = “8” (0x38):
“0”: Clear. Black foreground and background.
“1”: Set red foreground bit.
“2”: Set green foreground bit.
“3”: Set blue foreground bit.
“4”: Set red background bit.
“5”: Set green background bit.
“6”: Set blue background bit.
“7”: Set blink bit.
“8”: Set plot glyphs bit.
|
M
|
B (0x42)
|
m
|
Clears or sets print and non-print attribute bits
according to m = “0” (0x30) to m = “8” (0x38):
“0”: Clear. Green on black text.
“1”: Set underline bit.
“2”: No effect.
“3”: Set bright bit.
“4”: No effect.
“5”: Set inverse video bit.
“6”: Set shaded background bit.
“7”: Set blink bit.
“8”: Set plot glyphs bit.
|
EG
|
B (0x42)
|
m
|
Clears or sets print and non-print attribute bits
according to m = “0” (0x30) to m = “8” (0x38):
“0”: Clear. All attributes off.
“1”: Set underline bit.
“2”: No effect.
“3”: No effect.
“4”: No effect.
“5”: Set inverse video bit.
“6”: Set XOR drawing bit.
“7”: Set blink bit.
“8”: Set plot glyphs bit.
|
CMEG
|
C (0x43)
|
|
Sets scroll mode.
|
CMEG
|
D (0x44)
|
|
Sets page mode.
|
CMEG
|
E (0x45)
|
|
Turn on display of the cursor position.
|
CMEG
|
F (0x46)
|
|
Turn off display of the cursor position.
|
CMEG
|
G (0x47)
|
|
Selects special graphics font (see section on printable
characters).
|
CMEG
|
H (0x48)
|
|
Deletes character under cursor.
|
CMEG
|
I (0x49)
|
|
Moves all the text on the line containing the cursor and
below down one line. The bottom line is lost. The line
containing the cursor is cleared (using space character
and non-printing attribute). The cursor retains its
previous position (on the now blank line).
|
CMEG
|
J (0x4A)
|
|
Moves all text in lines below the cursor up one line.
The new bottom line is cleared (using space character
and non-printing attribute). The cursor retains its
previous position.
|
CMEG
|
K (0x4B)
|
|
Duplicate the line containing the cursor on the next
line down, pushing all lines below it down one line. The
bottom line is lost. The cursor retains its previous
position.
|
CMEG
|
L (0x4C)
|
|
Does nothing.
|
CMEG
|
M (0x4D)
|
n, m, p0, p1, p2, p3...
|
Redefine a character glyph. Each glyph is defined by
five blocks of four rows of eight pixels. Therefore each
block requires four bytes to redefine.
n = Character glyph to redefine.
m = Contains three bit fields:
Bit 0: 0 = Text glyph, 1 = Graphics glyph.
Bits 1-3: First block to redefine (0-4).
Bits 4-6: Number of consecutive blocks to redefine.
Bit 7: Unused.
p1… = Bytes defining the pixels to set in successive
rows of the glyph.
|
CMEG
|
N (0x4E)
|
m
|
Sets colour and attributes as per “<Esc>B” except only
affects non-print output.
|
CMEG
|
O (0x4F)
|
m
|
Selects virtual screen 0 – 7 given by bottom 3 bits of
m.
Note: These virtual screens are not the same as those
from Basic.
|
CMEG
|
P (0x50)
|
m
|
Sets colour and attributes as per “<Esc>B” except only
affects print output.
|
CMEG
|
Q (0x51)
|
n, d1...
|
Input a number of 8-bit glyph codes without them being
interpreted as control and escape sequences.
n = Number of following byte glyph codes.
d1 … = Bytes to display.
|
CMEG
|
R (0x52)
|
n, d1...
|
Input a number of characters in the video generator
internal format (documented in the following section).
n = Number of characters to input in raw internal
format.
d1… - Bytes forming each character. Four bytes per
character for CME modes, ten bytes per character for G
mode.
|
CMEG
|
S (0x53)
|
|
Selects standard font (see section on printable
characters)
|
C
|
T (0x54)
|
m
|
Sets the printing colour and attributes according to the
bits of m:
Bit 0: Red foreground.
Bit 1: Green foreground.
Bit 2: Blue foreground.
Bit 3: Red background.
Bit 4: Green background.
Bit 5: Blue background.
Bit 6: Blink.
Bit 7: Plotting glyphs.
|
M
|
T (0x54)
|
m
|
Sets the printing attributes according to the bits of m:
Bit 0: Underline.
Bit 1: No effect.
Bit 2: Bright text.
Bit 3: No effect.
Bit 4: Inverse video.
Bit 5: Shaded background.
Bit 6: Blink.
Bit 7: Plotting glyphs.
|
EG
|
T (0x54)
|
m
|
Sets the printing attributes according to the bits of m:
Bit 0: Underline.
Bit 1: No effect.
Bit 2: No effect.
Bit 3: No effect.
Bit 4: Inverse video.
Bit 5: XOR printing.
Bit 6: Blink (Enhanced mode only).
Bit 7: Plotting glyphs.
|
CMEG
|
U (0x55)
|
m
|
As per “<Esc>T” but sets the non-print colours and
attributes.
|
CMEG
|
V (0x56)
|
m
|
As per “<Esc>T” but sets both the print and non-print
colours and attributes.
|
CMEG
|
W (0x57)
|
m
|
Sets the write mask:
If m = “0” (0x30) enable both character and attribute
writes.
If m = “1” (0x31) disable attribute writes.
If m = “2” (0x32) disable character writes.
Any other value of m has no effect.
|
CMEG
|
X (0x58)
|
m
|
Simulate the effect of the control code given by m &
0x1F.
|
CMEG
|
Y (0x59)
|
n, x, y, w, h
|
Define a virtual screen:
n = Virtual screen number (0 to 7).
x = Leftmost column position (0 to 79).
y = Top row position (0 to 23).
w = Width (0 to 80 – x).
h = Height (0 to 24 – y).
Note this is not the same as the Basic CRVS.
|
CMEG
|
Z (0x5A)
|
|
Restarts the CFX-II video generator.
|
CMEG
|
[ (0x5B)
|
|
Does nothing.
|
CMEG
|
\ (0x5C)
|
|
Does nothing.
|
CMEG
|
] (0x5D)
|
|
Does nothing.
|
CMEG
|
^ (0x5E)
|
n, x1, y1,
x2, y2
|
Copies n characters from position x1, y1 to position
x2,y2 without moving the cursor.
|
CMEG
|
_ (0x5F)
|
n, x, y
|
Blanks n characters at position x, y without moving the
cursor.
|
|