vPLASMA: companion app emulating the cockpit plasma display
The cockpit's second serial device joins vRIO: the 128x32 dot-matrix plasma on COM2 (9600 8N1) that the game draws mission text and status graphics on. VPlasma.App opens the device end of a COM port, decodes the display's command stream, and renders the matrix in plasma orange. The command set is recovered from two Tesla 4.10 artifacts: the game's driver (L4PLASMA.CPP — ESC P packed-bitmap row writes, ESC G 0 cursor hide at boot) and the factory test tool PLASMA.EXE, whose data segment pairs each command literal with its printf description (BS/HT/LF/VT/CR motion, ESC @ clear, ESC L home, ESC G cursor, ESC K fonts, ESC H attributes: intensity/underline/reverse/flash). Text renders through the classic public-domain 5x7 set standing in for the lost ROM glyphs; fonts 0-3 give 21x4 cells, fonts 4-7 the doubled 10x2. A Self test cycles banner/charset/graphics pages through the same parser the wire feeds, and the wire log shows every decoded command. Verified end-to-end over the second com0com pair (host writing COM2, vPLASMA listening on COM12). The verify skill gains the cross-process combo-box lesson: string-carrying CB_* messages hang across processes, so select ports by locally computed index via CB_SETCURSEL. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
namespace VPlasma.Core.Protocol;
|
||||
|
||||
/// <summary>
|
||||
/// The cockpit plasma display's serial command set, as recovered from the
|
||||
/// Tesla 4.10 sources and tools:
|
||||
///
|
||||
/// <para>The display is a 128×32 dot-matrix plasma panel on COM2 at
|
||||
/// <b>9600 8N1</b>, no flow control. The game side
|
||||
/// (<c>CODE\RP\MUNGA_L4\L4PLASMA.CPP</c>) renders everything into a local
|
||||
/// 1bpp buffer and streams changed rows with the <c>ESC P</c> graphics
|
||||
/// command, sending <c>ESC G 0</c> once at startup to hide the cursor. The
|
||||
/// factory test tool (<c>VWETEST\VGLTEST\PLASMA.EXE</c>) additionally
|
||||
/// exercises a text mode: printable ASCII renders at a cursor, with escape
|
||||
/// commands for clear/home, cursor visibility, font select, and text
|
||||
/// attributes (intensity/underline/reverse/flash), plus BS/HT/LF/VT/CR
|
||||
/// cursor motion.</para>
|
||||
///
|
||||
/// <para>Every multi-byte command begins with ESC (0x1B) followed by one
|
||||
/// command letter:</para>
|
||||
///
|
||||
/// <code>
|
||||
/// ESC @ clear screen, reset text state
|
||||
/// ESC L home the cursor (0,0)
|
||||
/// ESC G n cursor mode: 00/FF hidden, 01 steady, 03 flashing
|
||||
/// ESC K n select font n (FF = default font 0)
|
||||
/// ESC H n text attributes: index 0..16 into the
|
||||
/// intensity/underline/reverse/flash combos the
|
||||
/// test tool enumerates; FF = defaults
|
||||
/// ESC P s y x w h data… graphics write: screen s (single-screen, ignored),
|
||||
/// top row y (0..31), left byte column x (0..15),
|
||||
/// w bytes per row, h rows, then w*h data bytes,
|
||||
/// MSB = leftmost pixel. The game always sends
|
||||
/// whole rows: x=0, w=16, h=1.
|
||||
/// </code>
|
||||
///
|
||||
/// <para>Where the two sources disagree on <c>ESC G</c> (the game hides the
|
||||
/// cursor with 00, the test tool with FF) both operands are treated as
|
||||
/// hidden.</para>
|
||||
/// </summary>
|
||||
public static class PlasmaProtocol
|
||||
{
|
||||
/// <summary>Wire bit rate — the game opens PCS_9600, PCS_N81.</summary>
|
||||
public const int BaudRate = 9600;
|
||||
|
||||
public const byte Esc = 0x1B;
|
||||
|
||||
// Single-byte cursor-motion controls (PLASMA.EXE's /b /c /l /t /v options).
|
||||
public const byte BackSpace = 0x08;
|
||||
public const byte HorizontalTab = 0x09;
|
||||
public const byte LineFeed = 0x0A;
|
||||
public const byte VerticalTab = 0x0B;
|
||||
public const byte CarriageReturn = 0x0D;
|
||||
|
||||
// ESC command letters.
|
||||
public const byte CmdClearScreen = (byte)'@';
|
||||
public const byte CmdCursorMode = (byte)'G';
|
||||
public const byte CmdAttributes = (byte)'H';
|
||||
public const byte CmdFontSelect = (byte)'K';
|
||||
public const byte CmdHomeCursor = (byte)'L';
|
||||
public const byte CmdGraphicsWrite = (byte)'P';
|
||||
|
||||
/// <summary>Operand meaning "restore the default" for ESC K / ESC H.</summary>
|
||||
public const byte OperandDefault = 0xFF;
|
||||
}
|
||||
Reference in New Issue
Block a user