ECB Text Mode VGA and PS/2 Keyboard Card

Sometime in the first quarter of 2006 i tried to recover my old Prof80 CP/M Z80 System. It was equiped with a GRIP video card with fbas output and some sort of serial or parallel keyboard input. (See prof80.de)

I found a monitor capable of displaying the grip output but it was to horrible to work with the system, low refresh rate and a horrible monitor, terribble keyboard. So i thought about connecting a state of the art LCD monitor, but how ?.

After doing some search, i found out that it is not so difficult to generate a VGA signal with FPGA's, so i ordered a board equiped with a xilinx XC2S200, the XSA-200 Board from XESS. I selected this board because it is small enough to fit onto an euro card (100 time 160 mm) and can be plugged into a simple socket using a raster of 2,54 mm.

The board has fast SRAM but i was never able to get it working.

So i build a small board equiped with fast static ram (cache ram from old 486 boards, located under the FPGA board) as video ram, the ecb connector, a serial interface and a buzzer. (Buzzer and the serial interface are not yet implemented in the code).

Board Picture


This was the second time t tried to implement some functionallity in VHDL (see GIDE for ECB), and at least for me, it was not easy. I had a lot of trouble with timings, the ecb interface and so on. For the PS/2 struff, i used a feely available interface written by Daniel Quintero.

The card is currently working fine but there are some things missing:

    the keyboard leds are not working (Caps Lock, Num Lock)
    Caps Lock for german umlauts are not implemented yet
    Tabs are not yet supported

Btw, for keyboards other than german, the key table may need to be updated.

The card emulates the following codes from the host :

Code Hex Function Supported
^H 0x08 Cursor left, no function @0,0, will go to prev line Yes
^I 0x09 TAB No
^K 0x0B Cursor Up, does nothing if @ first line Yes
^V 0x16 Cursor down with scroll Yes
^J 0x0A same as ^V Yes
^M 0x0D place cursor to row 0 Yes
^O 0x0F place cursor to row 0 and goto next line (with scroll) Yes
0x1Eh 0x1E Cursor home Yes
^Z 0x1A Clear Screen Yes
^L 0x0C Clear Screen (for CP/M) Yes
^G 0x07 Bell (Ignore) Yes
ESC + 0x2B Clear Screen (Foreground only) Yes
ESC ; 0x3B Clear Screen (Foreground only) Yes
ESC * 0x2A Clear Screen to nulls Yes
ESC : 0x3A Clear Screen (Clear unprotected page to nulls) Yes
ESC . X 0x2E Set Cursor attribute, "0":no cursor, "1":Blink, 2:non Blink block,
3:Blinking line, 4: steady line, 5:Blink Block, 6:fast Blink Block,
7:fast Blink line
Yes
ESC ` X 0x60 same as ESC .
ESC = YX 0x3D Set cursor position, X and Y with 20h offset, 20h is position zero Yes
ESC E 0x45 Insert line at cursor pos, cursor will be on col 1 of inserted line Yes
ESC R 0x52 Delete line at cursor pos, cursor at first pos of line Yes
ESC T 0x54 Delete from cursor pos (including) to end of line Yes
ESC t 0x74 same as ESC T Yes
ESC Y 0x59 Delete from cursor pos (including) to end of screen Yes
ESC y 0x79 same as ESC Y Yes
ESC ) 0x29 Start Background (Dim) Yes
ESC ( 0x28 Start Foreground (normal) Yes
ESC 8 0x56 Smooth scroll enable No
ESC 9 0x38 Smooth scroll disable No
ESC W 0x39 Delete char Yes
ESC Q 0x51 Insert Char Yes




ESC ?
Read cursor address, Returns: line col CR No
ESC w
Read cursor address, Returns: page line col CR No
ESC /
Read cursor address, Returns: page line col CR  or wnd  line col CR (if screen split) No
ESC 0
Clear all tab stops No
ESC 1
Set tab stop No
ESC 2
Clear tab stop No
ESC i
Tabulate cursor No
^I
Tabulate cursor No
ESC I
Backtab No
ESC G attr Assign character display attribute, starting with "0", Bit 0:Normal/Invisible, Bit1:Blink,Bit2:Reverse, Bit3:Underline Yes


x30 (0) Normal Yes


x31 (1) Invisible Yes


x32 (2) Blink Yes


x34 (4) Reverse Yes


x38 (8) Underline Yes
ESC C x
Set Foreground Color, 3 Bit beginning with '0' Yes
ESC c x
Set Background Color, 3 Bit beginning with '0' Yes


The keyboard codes are based on wordstar codes, at least wordstar and turbo pascal works fine.

The ebc-interface uses port 80h-83h with the following functions:
    80h:   Read Status Port, Bit 7 -> Character Available, Bit 6 = Ready for Output, Bit 2-0 only for Debug Stuff
    81h:   Read KBD Input, Write Terminal Output
    82h:   only used for Debugging Stuff
    83h:   only used for Debugging Stuff

The code and design is free, licensed under GNU, please feel free to comment the design, especially ragrading the vhdl code. I think it is to complex but this is my first complex vhdl stuff. I learned electronics beginning 1980 and have not done anything related for about 20 years, so this was my first (or second if you count giede) try to do something with vhdl.



Download


Xilinx ISE 9.1 VHDL Source
Eagle (4.16) Files


last change Nov 30, 2007 Armin. Impressum