FNX6809 DisplayCodes

From Foenix F256 / Wildbits/K2 Wiki
Revision as of 14:53, 28 April 2026 by RichL (talk | contribs) (This is a substantial edit based on the latest vtio.asm file. AI was used to expand on the prior content.)
Jump to navigationJump to search

Wildbits VTIO Driver Control Sequences

This document describes the control character sequences supported by the vtio.asm video terminal I/O driver for the Wildbits platform.

Basic Control Characters (0x00 - 0x0D)

These single-byte commands perform basic cursor and screen operations.

Hex Code Command Description
0x01 Home Cursor Moves the cursor to the top-left corner (0,0).
0x02 Move Cursor (XY) Positions the cursor at (X, Y). Followed by two bytes: X + 32 and Y + 32. (See "Coordinate Offset" below).
0x03 Erase Line Clears the entire current line.
0x04 Erase to EOL Clears the line from the current cursor position to the end.
0x05 Cursor Control Sub-command for cursor state. Followed by a mode byte (see below).
0x06 Cursor Right Moves the cursor one position to the right.
0x07 Bell Sounds the system bell.
0x08 Cursor Left Moves the cursor left and erases the character previously at that position (Backspace).
0x09 Cursor Up Moves the cursor one line up.
0x0A Cursor Down Moves the cursor one line down.
0x0B Erase to EOS Clears the screen from the cursor position to the end.
0x0C Clear Screen Clears the entire screen and homes the cursor.
0x0D Carriage Return Moves the cursor to the beginning of the current line (column 0).

Coordinate Offset (+32)

The Move Cursor (XY) command (0x02) requires coordinates to be offset by 32 (0x20). This is a standard OS-9 convention used to shift coordinate values out of the range of ASCII control characters (0x00–0x1F), ensuring they are treated as data rather than unintended commands.

  • To move to Column 0: Send 0 + 32 = 32 (0x20).
  • To move to Column 10: Send 10 + 32 = 42 (0x2A).
  • Internal Math: The driver performs InternalCoord = Argument - 0x20.

Cursor Control (0x05) Sub-commands

Sequence Command Description
0x05 0x20 Cursor Off Hides the video cursor.
0x05 0x21 Cursor On Shows the video cursor.
0x05 0x22 <CHR> Cursor Char Changes the cursor character to the provided byte <CHR>.
0x05 0x23 <RATE> Cursor Rate Changes flash rate: 0=1s, 1=0.5s, 2=0.25s, 3=0.2s, 4=Disabled.

Escape Sequences (0x1B)

Extended commands typically used for windowing and palette management.

Sequence Command Description Arguments
0x1B 0x20 Set Window Configures screen mode and dimensions. STY, CPX, CPY, SZX, SZY, FG, BG, BD (See below)
0x1B 0x32 Fore Color Sets the current foreground color. <COLOR> (1 byte)
0x1B 0x33 Back Color Sets the current background color. <COLOR> (1 byte)
0x1B 0x34 Border Color Sets the current border color. <COLOR> (1 byte)
0x1B 0x60 Fore Palette Modifies a foreground palette entry. PRN, R, G, B, A (See below)
0x1B 0x61 Back Palette Modifies a background palette entry. PRN, R, G, B, A (See below)
0x1B 0x62 Font Set 0 Switches to font set 0. None
0x1B 0x63 Font Set 1 Switches to font set 1. None

Set Window (1B 20) Parameters

The command requires 8 parameter bytes following the header:

  • STY (Screen Type):
    • 1: 40x30 Text
    • 2: 80x30 Text
    • 3: 40x60 Text
    • 4: 80x60 Text
  • CPX (Starting X): The starting column (0–79). Note: Currently ignored for anchor point; windows always start at (0,0).
  • CPY (Starting Y): The starting row (0–59). Note: Currently ignored for anchor point.
  • SZX (Width): The width of the window in columns.
  • SZY (Height): The height of the window in rows.
  • FG (Foreground): Default foreground color index (0–15).
  • BG (Background): Default background color index (0–15).
  • BD (Border): Border color index (0–15).

Note: Executing this command clears the screen to the specified background color.

Palette Modification Parameters (1B 60 / 1B 61)

These commands require 5 parameter bytes following the header:

  • PRN (Palette Register Number): The index of the palette register to modify (0 to 15).
  • R, G, B: Red, Green, and Blue intensity values (0 to 255).
  • A (Alpha): Opacity/Alpha value (0 to 255).

Miscellaneous Sequences

Sequence Command Description
0x1C <CHR> Raw Write Writes the next byte <CHR> directly to the screen (bypasses control checks).
0x1F 0x20 Reverse On Enables reverse video (swaps FG and BG colors).
0x1F 0x21 Reverse Off Disables reverse video.

Note: Characters 0x0E-0x1A, 0x1D, and 0x1E are currently processed as No-Ops by the driver.


Example Interpretation

Sequence: 1b 61 01 ff 00 00 ff 05 22 f0 1b 20 02 00 00 50 18 00 01 00 1b 32 07

This string performs the following operations in order:

  1. 1b 61 01 ff 00 00 ff: Modifies Background Palette register 1 to be solid Red (RGBA: 255, 0, 0, 255).
  2. 05 22 f0: Changes the hardware cursor character to 0xF0.
  3. 1b 20 02 00 00 50 18 00 01 00: Sets an 80x24 window in 80x30 text mode starting at (0,0). It sets the default foreground to color 0, the background to color 1 (Red), and the border to color 0. This operation also clears the screen to Red.
  4. 1b 32 07: Sets the current foreground drawing color to index 7.

Result: The display switches to an 80-column mode with a red background, a custom block cursor, and text subsequently written will appear in color index 7.


Technical Note: Scrolling and Windowing Limitations

The current version of the vtio.asm driver has the following limitations regarding windowing:

  1. Anchor Point: While Set Window (1B 20) accepts CPX and CPY (starting coordinates), the driver's internal coordinate math and the SCROLL routine currently ignore these offsets. All windows are physically anchored at the top-left (0,0) of the screen.
  2. Global Scrolling: The scroll routine (SCROLL) always moves data starting from the very top of the physical screen buffer. Consequently, it is not possible to define a "static" area (like a Z-machine status line) that remains unaffected by scrolling text below it using the native driver logic alone.
  3. Unimplemented Codes: Documentation/comments in the source suggest codes 1F 30 (Insert Line) and 1F 31 (Delete Line) may have been planned, but they are not currently implemented in the dispatch table.

Escape Codes

  • 1B 20 DW Set
  • 1B 21 DW Select
  • 1B 24 DW End
  • 1B 30 DefColr
  • 1B 32 Foreground Color
  • 1B 33 Background Color
  • 1B 34 Border Color
  • 1B 60 Change Foreground Palette
  • 1B 61 Change Background Palette
  • 1B 62 Change to Font0
  • 1B 63 Change to Font1