DVX_GUI/unused/termdemo
2026-04-17 23:23:44 -05:00
..
Makefile License added to source files. 2026-04-17 23:23:44 -05:00
README.md Major project layout change. Source locations now more match where binaries end up. 2026-04-16 19:33:17 -05:00
termdemo.c License added to source files. 2026-04-17 23:23:44 -05:00

SecLink Terminal Demo

Standalone DOS terminal emulator combining the DVX windowed GUI with SecLink encrypted serial communication. Part of the DVX GUI project.

This is NOT a DXE app -- it is a freestanding program with its own main() that initializes the DVX GUI directly and manages its own event loop. Unlike the DXE apps (progman, notepad, clock, dvxdemo) which run inside the DVX Shell, this program demonstrates how to use the DVX widget system outside the shell framework.

Connects to a remote BBS through the SecLink proxy, providing a full ANSI terminal in a DVX-style window with encrypted transport.

NOTE: This program predates the DXE module refactoring and links against static libraries from lib/. It may need Makefile updates to build against the current source tree layout.

Architecture

termdemo (DOS, 86Box)
    |
    +--- DVX GUI           windowed desktop, ANSI terminal widget
    |
    +--- SecLink           encrypted serial link
    |      |
    |      +--- packet     HDLC framing, CRC-16, Go-Back-N ARQ
    |      +--- security   DH key exchange, XTEA-CTR cipher
    |      +--- rs232      ISR-driven UART I/O
    |
  COM port (86Box emulated modem)
    |
  TCP:2323
    |
  secproxy (Linux)
    |
  TCP:23
    |
  Remote BBS

All traffic between the terminal and the proxy is encrypted via XTEA-CTR on SecLink channel 0. The proxy decrypts and forwards plaintext to the BBS over telnet.

Usage

termdemo [com_port] [baud_rate]
Argument Default Description
com_port 1 COM port number (1-4)
baud_rate 115200 Serial baud rate

Examples:

termdemo                  # COM1 at 115200
termdemo 2                # COM2 at 115200
termdemo 1 57600          # COM1 at 57600
termdemo -h               # show usage

Startup Sequence

  1. Seed the RNG from hardware entropy (PIT-based on DOS).
  2. Open SecLink on the specified COM port (8N1, no handshake).
  3. Perform DH key exchange (blocks until the proxy completes its side).
  4. Initialize the DVX GUI (1024x768, 16bpp VESA).
  5. Create a resizable terminal window with menu bar and status bar.
  6. Register an idle callback so serial data is polled during GUI idle.
  7. Enter the main loop.

The handshake completes in text mode before the GUI starts, so the DOS console shows progress messages during connection setup.

Data Flow

BBS -> proxy -> serial -> secLinkPoll() -> onRecv() -> ring buffer
    -> commRead() -> wgtAnsiTermWrite() -> ANSI parser -> screen

Keyboard -> widgetAnsiTermOnKey() -> commWrite()
    -> secLinkSend() -> serial -> proxy -> BBS

A 4KB ring buffer bridges the SecLink receive callback (which fires asynchronously during secLinkPoll()) and the terminal widget's comm read interface (which is polled synchronously during the widget paint cycle).

Test Setup

  1. Start the SecLink proxy on the Linux host:

    secproxy 2323 bbs.example.com 23
    
  2. Configure 86Box with a COM port pointing at the proxy's listen port (TCP client mode, port 2323, no telnet negotiation).

  3. Run the terminal inside 86Box:

    termdemo
    

Dependencies

All libraries are built into lib/:

Library Purpose
libdvx.a DVX windowed GUI and widget system
libseclink.a Secure serial link wrapper
libpacket.a HDLC framing and reliability
libsecurity.a DH key exchange and XTEA cipher
librs232.a ISR-driven UART serial driver

Files

termdemo/
  termdemo.c       terminal emulator program
  Makefile         DJGPP cross-compilation build

Build

make            # builds bin/termdemo.exe (and dependency libs)
make clean      # removes objects and binary