The M3SE's VGA controller produces 800x600 @ 60Hz SVGA output, and can operate in 64- or 80-column mode. In 64-column mode, the screen is organized as a 768x576 display area surrounded by a narrow border. In 80-column, 25 line mode, there is no border since all screen pixels are used for displaying characters.
Note that using the M3SE with a wide-screen (16:9 or 16:10 aspect ratio) VGA monitor may cause the video to be stretched horizontally, appearing differently than it would on an original Model I CRT monitor. However, most such monitors have a mode for displaying a 4:3 image in its original format.
After powerup, the display shows a M3SE splash screen along with the FPGA firmware date. To enable
the VGA for use, load the driver:
SET *DO VGA
This clears the screen, switches the display to 80-column mode, and routes all output for the display device (*DO) to the VGA driver. Once you have loaded the driver, be careful not to enter the SYSTEM(SYSGEN) command, which would write the driver setup to disk.
The M3SE VGA display is intended for text applications. It does not mirror the TRS-80 CRT monitor contents like the MISE. All text to be displayed must be sent through the driver. Programs such as graphical games that write directly to screen memory will not work with the VGA display.
Some LDOS commands (and almost certainly other software) assume a 64-column format, and do not issue a carriage return or linefeed after printing a line. Such commands include DIR and FREE. The output from these commands will appear garbled in 80-column VGA mode.
To disable the driver, enter the command RESET *DO. The driver will remain resident in high memory and can be re-enabled by re-entering SET *DO VGA.
You can control the display mode, cursor character, and colors using the SETVGA utility:
See the table below for the color names, which may be abbreviated to three or more letters. Any color specification that is omitted is not changed.
COLUMNS may be abbreviated as COL. CURSOR may be abbreviated as CUR. The VGA cursor does not blink. FOREGROUND may be abbreviated as FORE or FG. BACKGROUND may be abbreviated as BACK or BG. BORDER may be abbreviated as BORD or BD.
The colors can also be changed by accessing two I/O ports:
Port 0x71 (R/W): Bit 7 - Use border color Bits 6:4 - Background color Bits 2:0 - Foreground color Port 0x72 (R/W): Bits 2:0 - Border colorSetting a border color in port 0x72 does not immediately change the screen's border color. Setting bit 7 in port 0x71 causes the border color to take effect. This allows all three colors to be changed simultaneously. Writing port 0x71 with bit 7 cleared sets the border color the same as the background color. This eliminates the need to write to port 0x72 if you want the border and background colors to be the same.
The following table shows the values to use for each color:
The VGA module contains a control register with some additional functions:
Port 0x70 (R/W): Bit 7 - 80-column mode Bit 6 - (read only) Cursor position is outside 64-column area Bit 5 - VGA test mode Bit 4 - (read only) Vertical blanking status Bit 1 - Interrupt status/clear Bit 0 - Interrupt enable
Setting bit 5 in port 0x70 causes the VGA controller to enter a test mode in which foreground and background colors on the display are set to a specific test pattern.
A vertical blanking interrupt and status bit allow applications to restrict their screen updates to times when the display isn't being drawn. The actual VGA vertical blanking duration is 739.2 microseconds. In 64-column mode however, the interrupt and status bit are asserted sooner--when the bottom border region is reached--providing an additional 316.8 microseconds at both the bottom and the top of the screen during which CPU writes to the screen will not be seen.
Before enabling the vertical blanking interrupt by setting bit 0, you must set up an interrupt service routine. The service routine must clear bit 1 in port 0x70 to reset the interrupt.
Instead of using the interrupt, bit 4 of the register can be polled to determine when vertical blanking is in effect.
The M3SE VGA controller contains hardware assist logic for repetitive tasks like scrolling and erasing regions of the screen. The following registers are used to activate these functions.
Port 0x73 (R/W): Bits 4:0 - Cursor row Port 0x74 (R/W): Bits 6:0 - Cursor column Port 0x75 (R/W): Bits 7:0 - Character at cursor position Port 0x76 (R/W): Bits 7:0 - Character under cursor (storage only) Port 0x77 (R/W): Bits 4:0 - Function from row Port 0x78 (R/W): Bits 4:0 - Function to row Port 0x79 (R/W): Bit 7 - Wait for vertical sync Bits 2:0 - Function Port 0x7A (RO): Bits 4:0 - Maximum row number (15 or 24) Port 0x7B (RO): Bits 6:0 - Maximum column number (63 or 79) Port 0x7C (RO): Bits 7:0 - 64-column CRT address LSB Port 0x7D (RO): Bits 7:0 - 64-column CRT address MSB
Characters are written to and read from the display using register 0x75 after setting the cursor row and column in registers 0x73 and 0x74.
A function is initiated by writing its code to register 0x79. If bit 7 is set, the controller waits for a vertical sync before starting the function. None of the registers can be written while a function is in progress. When the function completes, register 0x79 returns to zero. The available functions are as follows:
|Scroll lines from "from row" to "to row" and fill new lines with spaces
|Erase from cursor position to end of screen
|Erase from cursor position to beginning of screen
|Erase from cursor position to end of line
|Erase from cursor position to beginning of line
|Erase entire screen memory
For display scrolling (function 0x01) the row registers 0x77 and 0x78 should be set up to point to the tops of the regions to be scrolled. So a simple one line upward scroll of the entire screen is from row 1 to row 0. A simple downward scroll is from row 0 to row 1. The row numbers may be set as high as one greater than the maximum row number (from register 0x7A) to allow scrolling lines downward off the screen, or scrolling upward from beyond the bottom of the screen.
Registers 0x7A through 0x7D provide some read-only values to simplify writing drivers and other software for the VGA display. Registers 0x7C and 0x7D are used to help detect when software changes the LDOS cursor position between calls to the driver. They return zero when the VGA cursor is positioned outside the 64-character display region.
Back to the main page