mTelnet Next Generation (mTelnetNG) 1.0
=======================================

A from-scratch rebuild of the classic mTelnet/32 Win32 console telnet
client, written in C.  Single 80 KB executable, no installer, no DLLs
beyond the ones that ship with every copy of Windows (kernel32, user32,
ws2_32, msvcrt).  Runs on Windows XP, Vista, 7, 8, 10 and 11 (32 or 64 bit),
in the classic/legacy console, the modern Windows 10/11 console, and
Windows Terminal.


INSTALLING
----------
Copy mtelng.exe into your mTelnet folder (next to mtel.cfg and mtel.fon)
and run it.  It reads and writes the same mtel.cfg and mtel.fon as the
original mt32.exe.

  - The first time NG saves the phonebook it keeps a copy of your original
    200-entry file as mtel.fon.bak.
  - The "phonebook" folder in this package holds a ready-made mtel.fon:
    your 3 original entries plus the 1077 telnet entries imported from your
    syncterm.lst.  Use it, or import yourself (see below).

Command line:
  mtelng                       start with the dialing directory
  mtelng host [port]           connect straight away (host:port also works)
  mtelng -e petscii40 host     choose the emulation
  mtelng -i syncterm.lst       import a SyncTERM phonebook at startup
  mtelng -i syncterm.lst -q    import without opening the program


KEYS  (ALT-Z shows them in the program, 2 pages: Space flips)
----
  ALT-D  Dialing directory          ALT-H  Hang up
  ALT-Q  Quick-dial a host          ALT-X  Exit
  ALT-E  Cycle emulation/encoding   ALT-C  Clear screen
  ALT-B  Scrollback buffer          ALT-S  Status bar on/off
  ALT-L  Capture log on/off         ALT-O  Options
  ALT-R / ALT-PgDn  Zmodem download (also starts automatically)
  ALT-U / ALT-PgUp  Zmodem upload   (also offered automatically)
  ALT-W  Send login name            ALT-P  Send password
  ALT-K  Send telnet BREAK          ALT-I  About
  ALT-A  PETSCII text: auto / ASCII / PETSCII
  ALT-Enter  Full screen on/off
  F1-F10 Macros (^M or | = Enter, ^X = control character)

Dialing directory:
  Enter dial, Ins/A add, E edit, Del delete, F find, N find next,
  I import syncterm.lst, S sort by name, V show used entries only,
  Q quick-dial, G or a number = go to entry, Esc back to the terminal.
  A magenta dot in front of a name marks a PETSCII entry.


NEW IN NG
---------
1. 2000-entry phonebook in the same mtel.fon format
   (fixed 197-byte records; the original holds 200).  The records are
   unchanged, so mt32.exe should still see the first 200 entries.

2. SyncTERM import (I in the directory, or -i on the command line).
   Reads syncterm.lst from the program folder or %APPDATA%\SyncTERM,
   skips entries already in the phonebook, maps SyncTERM's C64/C128
   screen modes to the PETSCII emulations, and asks whether to include
   SSH/RLogin entries (mTelnet is a telnet client, so those are skipped
   by default).

3. ANSI with automatic CP437 / UTF-8 detection.  The default "ANSI"
   emulation decodes each high byte as UTF-8 when it forms a valid UTF-8
   sequence and as CP437 otherwise, and locks to whichever the host is
   clearly sending (the status bar shows ANSI/437 or ANSI/UTF8).  Typed
   characters are sent back in the same encoding.  Forced "ANSI CP437"
   and "ANSI UTF-8" modes are available too.

4. PETSCII for Commodore BBSes, 40 or 80 columns.
   - Shown in a graphics window, like CGTerm: real 8x8 Commodore
     characters (16x16 pixels each in 40 columns, i.e. the C64's 320x200
     screen at 2x, or 8x16 in 80 columns) and CGTerm's bright C64
     palette.  The window opens when a PETSCII entry connects (or ALT-E
     selects PETSCII) with exactly the size and position of the console
     window, so it stays the same window as the ANSI emulations; it takes the keyboard, can be resized/maximised, and
     closes again (handing its position back to the console) when you
     switch back to ANSI.  Closing it asks to exit, like ALT-X.
     Options -> "Graphics window zoom" can force 1x-4x instead.
   - PETSCII always uses all 25 C64 lines; when the status bar is on it
     is shown below them, so the screen is 26 lines (ALT-S toggles it).
   - Character set: if CGTerm is installed (its upper.bmp/lower.bmp) or a
     VICE "chargen" ROM file is found, the authentic C64 font is used.
     NG looks in its own folder, Program Files\CGTerm, C:\CGTerm and
     VICE's C64 folder; set Options -> "C64 font" to the CGTerm folder
     (or a chargen file) if it lives elsewhere.  Otherwise a built-in
     look-alike font is used.
   - Options -> "PETSCII in graphics window" = No keeps the old
     text-console rendering (also with the brighter palette).
   - Full C64 colour set, reverse video, cursor controls, clear/home,
     insert/delete, upper-case/graphics and lower-case character sets
     (switching sets redraws the whole screen, as on a real C64).
   - 40 columns are drawn double width so the screen fills the window
     with the C64's square look; Options can switch to a centred
     40-column screen instead.
   - The PC keyboard maps to the C64 keys (cursor keys, Home/Clr,
     Del/Inst, F1-F8, shifted letters).
   - Set it per phonebook entry (Edit -> Emulation) or with ALT-E.
   - Raw-TCP C64 boards work: NG never sends telnet commands unless
     the host starts telnet negotiation first.
   - Many C64 boards (for example ScanNet BBS) greet callers in plain
     ASCII until they know the terminal type.  NG detects ASCII text
     (CR/LF line ends, lowercase ASCII letters, no PETSCII control codes)
     and shows it as normal text (status bar: PET-40/ASCII), sends your
     typing as ASCII, and switches back the moment the board sends
     PETSCII colour/clear codes.  ALT-A cycles auto / ASCII / PETSCII.

Also: scrollback buffer, capture log, Zmodem send/receive with automatic
start, iCE colours, blinking text, xterm 256 and 24-bit colour,
VT100 line drawing, NAWS window size and terminal-type reporting.


CONSOLE MODES
-------------
NG detects the console it runs in:
  - Modern console (Windows 10/11, Windows Terminal): drawn with 24-bit
    colour escape sequences, so ANSI uses the exact VGA DOS colours and
    PETSCII the exact C64 colours.  Under Windows Terminal the Unicode
    "Symbols for Legacy Computing" glyphs are used for PETSCII graphics.
  - Legacy console (Windows XP/7, or "Use legacy console" on 10/11):
    drawn with the classic 16-colour console API and the CP437 character
    set, so it also works with the raster "Terminal" font.  On Vista and
    later the palette of NG's private screen buffer is set to the exact
    VGA or C64 colours; on XP the nearest standard colour is used.
NG draws into its own screen buffer, so your console window's contents
and scrollback come back untouched when you exit.  Options -> Glyphs or
"Renderer=legacy|vt" in mtelng.cfg override the detection.


FILES
-----
  mtel.cfg     original mTelnet settings (same 23-line format, shared)
  mtel.fon     phonebook (same record format, now up to 2000 entries)
  mtelng.cfg   NG-only settings (key=value)
  mtelng.ext   NG-only per-entry settings (emulation), kept outside
               mtel.fon so the original program is never confused


NOTES
-----
- The status bar is on the top line, like mTelnet/32: "Alt-Z - Help!",
  emulation, online time, host, and the time of day as [h:mm Am/Pm].
- Error and notice messages close by themselves after a few seconds
  (about 3 s, longer for longer messages; no countdown is shown); any
  key closes them sooner.
- ALT-Enter switches between normal size and full screen, in every
  emulation.  Full screen is mTelnet NG's own borderless window covering
  the monitor: the 80x25 screen is enlarged to fill it, text is drawn
  with a real font and box/block characters are drawn to fit, so lines
  join up at any size.  ALT-Enter again returns to the console window
  (or to the normal PETSCII window).  The console host (classic console
  or Windows Terminal) would normally take ALT-Enter for itself, so
  mTelnet NG claims that key only while its own console window is the
  active window.
- ALT-Q asks "Host to call:" (host, host port or host:port).  The
  connecting box shows elapsed seconds and the result (resolving,
  connecting, or the error such as "Unable to resolve hostname").
  Yes/No questions and the ALT-I About screen still wait for you.
- Phonebook bytes 131-196 of each record are treated as login name and
  password (each a 32-character Pascal string), the fields the original
  "Hide passwords" option refers to.  Bytes NG does not change are
  written back untouched.
- SSH and RLogin are not supported (telnet only, like the original).
- Built with clang/LLVM for i686 Windows against msvcrt.dll; see
  source/build.sh.  source/test holds the Linux test harness used to
  check the emulation, phonebook, import and Zmodem code (Zmodem was
  tested against lrzsz in both directions).
