FABGL terminal emulator and CP/M

Most SBC’s have a serial interface to work with the computer, using either a RS-232-C compatible interface with a DB-9 connector or more often the TTL interface with pin connector.
A VT100 ANSI termainal emulation is ideal for these machines, whether from a PC or standalone. Teraterm or Minicom are fine examples on Wondows and Linux, with the possibility to transfer data into the SBC’s.

To use the SBC standalone a video terminal is a good solution, cheap, with mostly a monitor with VGA and a PC keyboard, often PS/2.
Examples are the ASCII Video Terminal or the Raspberry PI (any, Zero is low cost) with PIGFX or ESP32 absed, the subject of this page: FABGL software and hardware.

FabGL is mainly a Graphics Library for ESP32. It implements several display drivers (for direct VGA output and for I2C and SPI LCD drivers). FabGL can also get input from a PS/2 Keyboard and a Mouse. ULP core handles PS/2 ports communications, leaving main CPU cores free to perform other tasks. FabGL also implements: an Audio Engine, a Graphical User Interface (GUI), a Game Engine and an ANSI/VT Terminal. .

VGA output requires a digital to analog converter (DAC): it can be done by three 270 Ohm resistors to have 8 colors, or by 6 resistors to have 64 colors. There are several fixed and variable width fonts embedded. Unlimited number of sprites are supported. However big sprites and a large amount of them reduces the frame rate and could generate flickering. When there is enough memory (on low resolutions like 320×200), it is possible to allocate two screen buffers, so to implement double buffering. In this case primitives are always drawn on the back buffer. Except for double buffering or when explicitly disabled, all drawings are performed on vertical retracing (using VGA driver), so no flickering is visible. If the queue of primitives to draw is not processed before the vertical retracing ends, then it is interrupted and continued at next retracing.

There is a graphical user interface (GUI) with overlapping windows and mouse handling and a lot of widgets (buttons, editboxes, checkboxes, comboboxes, listboxes, etc..).

Finally, there is a sound engine, with multiple channels mixed to a mono output. Each channel can generate sine waveforms, square, etc… or custom sampled data.
Audio output, like VGA output, is generated using DMA. CPU just mixes audio channels and prepares waveforms.

FabGL development board
FabGL development board from fabgl on Tindie

This is the reference board to develop and make new experiments with theE FabGL graphic library, which includes VGA output, Audio output, PS/2 Mouse and Keyboard input, Micro SD socket and Arduino style stackable headers.

  • three jumpers to select colors count (8 or 64).
  • 5V logic level converter to have 5V compatible serial port. This is configurable (and be disabled) using jumpers (see UART PATH) allowing TX on GPIO2 or GPIO12 and RX on GPIO34. TX must be disconnected when programming the board.
  • additional four pins header with RX (5V), TX (5V), GND and VCC (5V).
  • PS/2 port pullups connected to 3.3v instead of 5V to reduce ADC noise.
  • Includes PCB, ESP32-WROOM-32 and all required components and connectors already assembled.

Having the SD card connector makes extra things possible, like the Altair8800 and otrh CP/M emulator, see below.

FabGL Terminal

FabGL Terminal from fabgl on Tindie

This is a serial terminal based on FabGL library.

  • Supports following terminal types: ANSI, VTxxx, ADM 3A, ADM 31, Hazelttine 1500, Osborne, Kaypro ant VT52.
    German, Italian, UK and US keyboard layouts.
  • Configurable 5 Volts serial port.
  • Two PS/2 ports for Keyboard and Mouse.
  • One VGA output, up to 64 colors.
  • One audio out (line level, not amplified).
  • Powered from USB port can power a Z80 board, like the MBC2.
  • Bottom 8 PINs connector, with RX, TX, GND, 5V signals (also compatible with MBC2-Z80 board).
  • Upper 8 PINs connector 6 GPIOs (3.3V volts).
  • Preprogrammed with FabGL Serial Terminal, but reprogrammable with any compatible FabGL program. For example you can run VIC-20 emulator with this board.
  • Can be connected to a 3.3V device (like Raspberry pi) using IO2 pin as TX

While the library may look very sparsely documented, there is a large collection of youtube tutorials and examples available made by the author:

I use the serial terminal on my MBC-2 and MBC-V20, it is a “plug on” solution and functions fine with a real PS/2 keyboard.

FABGL serial with V20-MBC

FABGL serial with MBC-2

CP/M emulator

The ESP32 is a powerful system, and running a CP/M emulator is withingn its capabilities. The FABGL library offers two CP/M emulators, an Altair emulator and a CP/M 3

The CP/M examples are not that difficult to install.

For the AltairDOS version it is wise to study the emu menu. It has an option to Get or Send a disk to serial, you need the Python programs transdisk.py (and transfile for xmodem trasnfer) on the PC side for that.
Two disks are standard, two more are possible, stored on the SD or the ESP32 Flash SPIFFS. Use Format File system from the menu, and after rebooting, you have to create the CP/M filesystem, running “FORMAT” command. Then press “C” or “D” (uppercase). At “COMMAND” prompt write “FULL” and press enter. Now press “C” (still uppercase). You should see tracks formatting and verifying. Press “S” to exit.

The AltairDOS in this emulation is based upon the Burcon CP/M implementation, Here the original CP/M and Sysgen disks with documentation (for SIMH).
CP/M for the Altair 8800 and Altair Floppy Drives

CP/M 3 multitasking