
 TextFX - VGA textmode terminal extender, by Mike Fricker
 Specification revision 1

 Based on the ANSI/2 specification by Hooptie

 Programmer's notes:
    each sequence begins with an <esc> character (27h)
    all values are of 1 byte each (not ascii)
    all command characters are case-sensitive
    all screen position values are 1-based (x:1, y:1 is the top-left pos)
    ^Z (eof) characters must be ignored; wait for a real eof
    initial default text attribute = 07h
    high intensity backgrounds always enabled, no blinking in tfx
    user palette default to all-black initially
    setting new screen window resets coords to x:1, y:1

 code syntax:  <esc><command>[parameters...]

 a      - move cursor up 1 row
 Ax     - move cursor up x rows
 b      - move cursor down 1 row
 Bx     - move cursor down x rows
 Cx     - move cursor right x columns
 c      - move cursor right 1 column
 Dx     - move cursor left x columns
 d      - move cursor left 1 column
 E      - environment request, returns: "<esc>ENV<string>" (ends w/ a null)
 Fp..   - set new text font, p is a 4096 byte packet of font data
 Gclx.. - set font for range of chars, c = 1st char; l = #chars; x = font data
 h      - home cursor (move to 1, 1)
 Hxy    - move cursor to screen position x, y
 i      - restore last saved color attribute
 I      - save current color attribute
 j      - clear text window with default text attribute (07h)
 J      - clear text window with current attribute
 k      - clear from cursor to end of line with default text attribute (07h)
 K      - clear from cursor to end of line with current attribute
 lx     - set default color attribute to x (00h-FFh)
 Mx     - set current color attribute to x (00h-FFh)
 px     - change to color palette x (ascii x is the palette buffer, see below)
 Prgb.. - set color palette,  64 r/g/b (0-63) trios (192 bytes exactly)
 Qx     - save current palette in user-palette buffer x (1-3)
 rcx    - write character c x-number of times in current attribute
 Rcrgb  - set palette register c (0-255) to specified r/g/b (0-63) values
 s      - restore last saved cursor position
 S      - save cursor position
 t      - scroll window down once, top row cleared w/ current attribute
 Tx     - scroll window down x lines, top row cleared w/ current attribute
 u      - scroll window up once, bottom row cleared w/ current attribute
 Ux     - scroll window up x lines, bottom row cleared w/ current attribute
 V      - textFX version request, returns: "<esc>TFXv" (v = textFX ver# byte)
 Wabxy  - defines window; a,b = upper left; x,y = lower right, homes cursor
 Xfts   - morph palette from f to t (see below) in s (byte) number of steps
 zwfp   - partial reset; w(window), f(font) and p(palette) = 0 or 1 (yes/no)
 Z      - reset console (resets attr, screen, palette, font and window cords)

 predefined color palettes (ascii):
    A  all-white palette
    B  all-black palette
    C  current palette
    D  default textmode palette
    E  greyscale palette
    1  user-palette #1
    2  user-palette #2
    3  user-palette #3

