DialTerm 1.1 - a Telix-style modem communications program for Windows
=====================================================================

DialTerm is a new 32-bit Windows console program, written from scratch in C.
It looks and works like the classic DOS program Telix: the same blue boxes,
the same yellow-on-red status line, the same Alt-key commands, dialing
directory, redial queue and file-transfer protocols. It talks to a real
modem (internal, USB or serial) with standard Hayes AT commands, on any COM
port Windows assigns (COM1 to COM4 can be picked with one key in Alt-P).

It does not use any Telix code.

Files
-----
  DIALTERM.EXE   the program (32-bit Windows console, no DLLs or install
                 needed, runs on Windows 7 to Windows 11, 32- or 64-bit)
  README.TXT     this file
  src\           complete C source code
  res\           icon, manifest and version resource
  build.sh       build script for MinGW-w64 on Linux or MSYS2
  build.bat      build script for MinGW-w64 gcc on Windows

DialTerm creates these files in the folder that holds DIALTERM.EXE:
  DIALTERM.CFG   settings (plain text, key=value)
  DIALTERM.DIR   dialing directory (plain text)
  DIALTERM.CAP   default capture file
  DIALTERM.USE   usage log (when it is turned on)
  DOWNLOAD\      default folder for received files
  UPLOAD\        default folder the Upload Files window opens in

Put DialTerm in a folder you can write to, such as C:\DialTerm, rather
than under C:\Program Files.

Getting started
---------------
1. Copy DIALTERM.EXE to a folder, such as C:\DialTerm.
2. Optional: copy your old TELIX.CNF to the same folder. The first time
   DialTerm starts, it imports the port, speed, modem strings, colours and
   paths from it. Speeds stored as 11520 are read as 115200.
   Copy your TELIX.FON there too: on that first start DialTerm also
   imports your Telix dialing directory, keeping the entry numbers.
3. Run DIALTERM.EXE from Windows Terminal, a Command Prompt or Explorer.
4. Press Alt-P and pick your port (keys 1-8 for COM1-COM8) and speed.
   Device Manager > Ports (COM & LPT) shows which COM port your modem
   uses.
5. Press Alt-O, then M (Modem and dialing), to check the init string. The
   default is  ATZ^M~~~AT&C1&D2^M
   Alt-G sends the init string again.
6. Type AT and press Enter. The modem should answer OK.
7. Press Alt-D for the dialing directory. Use E to edit an entry, then D to
   dial it.

Modem strings use the Telix codes:  ^M = carriage return,  ^x = Ctrl-x,
~ = half-second pause.

The Modem and dialing screen (Alt-O, M) has the same layout as Telix:
init string, three dialing prefixes, dialing suffix, connect string, four
"no connect" strings (BUSY, NO CARRIER and so on, which trigger a redial),
hang-up, auto-answer and dial-cancel strings, dial time, redial pause,
auto baud detect and drop-DTR-to-hang-up. Auto baud detect changes the port
speed to the CONNECT speed; leave it off for modern modems, which keep a
fixed port speed.

Command line
------------
  DIALTERM [/Pn] [/Bspeed] [/Dn] [/N] [/Ffile]
    /P2        use COM2
    /B57600    use 57600 bps
    /D5        dial directory entry 5 at start-up
    /N         do not send the modem init string
    /FX.CFG    use another settings file
    /?         show help

Keys (Alt-Z shows the same list on screen)
------------------------------------------
  Alt-A  run editor
  Alt-B  scroll-back buffer      Alt-O  configure DialTerm
  Alt-C  clear screen            Alt-P  comm parameters / port
  Alt-D  dialing directory       Alt-Q  queue numbers to redial
  Alt-E  local echo on/off       Alt-R  receive files (= PgDn)
  Alt-F  DOS functions menu      Alt-S  send files (= PgUp)
  Alt-G  send modem init string  Alt-T  terminal emulation
  Alt-H  hang up                 Alt-U  usage log on/off
  Alt-I  save screen image       Alt-V  run a command
  Alt-J  command shell           Alt-W  wait for call (auto answer)
  Alt-K  keyboard macros F1-F10  Alt-X  exit
  Alt-L  capture file on/off     Alt-Y  chat mode
  Alt-M  misc. functions         Alt-Z  help
  Alt-8  status line on/off      Alt-=  DOORWAY mode
  Ctrl-End  send BREAK           Ctrl-@  printer echo on/off
  Shift-Tab add-LF on/off        F1-F10 send macros

Dialing directory (Alt-D)
-------------------------
  D  dial the marked entries, or the highlighted one if none are marked
  L  switch the list view          T  (or Space) mark or unmark an entry
  F  find text                     M  manual dial
  R  redial the last list          A  add an entry at the end
  E  edit an entry                 C  clear an entry
  U  unmark all                    X  (or Esc) exit
  O  other: insert or delete an entry, load or create another directory
     file, write the directory to a text file, import a Telix .FON file
  Typing a number jumps to that entry. Alt-Q, from the terminal screen,
  queues numbers to redial.

Importing a Telix dialing directory: press O (Other), then M (iMport a
Telix .FON file), and give the file name (a name alone means the DialTerm
folder; a full path works too). Choose "Add to the end of this directory"
to keep your current entries, or "Replace this directory" to make it an
exact copy of the Telix one with the same entry numbers. DialTerm brings
over each entry's name, number, speed, parity, data and stop bits,
terminal, protocol, local echo, add LF, strip high bit, backspace
settings, dialing prefix, password, total calls and last call date.
Linked SALT scripts are not imported (DialTerm has no script language), and
entries set to Kermit, SEAlink, CompuServe B+, Modem7 or Telink get the
default protocol. Telix's plain ANSI terminal becomes ANSI-BBS.

While a number is dialing, the Redial box shows the attempt number and a
countdown. Press Space to cycle to the next number, T to change the dial
time, D to delete the number from the list, or Esc to stop. When a number
is BUSY or does not answer, DialTerm waits for the redial pause and tries
again.

Each entry stores its own speed, line format, terminal, protocol, echo,
add-LF, strip-high-bit, destructive backspace, BS/DEL key, dialing prefix,
password, last call date and total calls.

Terminal emulations
-------------------
  ANSI-BBS  (default; colour, cursor position report, ANSI music skipped)
  VT102     (scroll region, line-drawing set, application cursor keys)
  VT52, AVATAR/0 and TTY
The scroll-back buffer (Alt-B) keeps the last 2000 lines by default.

File transfers
--------------
PgUp (Alt-S) sends files and PgDn (Alt-R) receives them:
  A  ASCII               X  Xmodem (CRC / checksum)
  1  1k-Xmodem           G  1k-Xmodem-g
  Y  Ymodem (batch)      E  Ymodem-g
  Z  Zmodem (CRC-16 / CRC-32, crash recovery)
Zmodem downloads start automatically when the remote side starts sending
(this can be turned off in Alt-O, Protocol options). Downloads are saved to
the download folder (Alt-O, Filenames and paths). When a file with the same
name already exists, the new file is saved as NAME.EX0, NAME.EX1 and so on.

The Upload Files window works like the Telix one: type a file name or a
wildcard such as *.ZIP in the Path box, or Tab to the file list and press
Space to tag files, then press F10 to send. F3 tags all files and F4 untags
all files.

XON/XOFF flow control is suspended during binary transfers. Use RTS/CTS
hardware flow control (Alt-P) for high-speed modems.

Troubleshooting
---------------
- "Unable to open COMn": another program (or a second DialTerm) has the
  port open, or the modem uses a different COM number. Check Device
  Manager > Ports (COM & LPT).
- No OK from the modem: check the speed in Alt-P, and use RTS/CTS flow
  control (Alt-O, Terminal options) for USB and high-speed modems.
- To record a trace of serial traffic and transfer events, set an
  environment variable before starting DialTerm, for example:
      set DIALTERM_DEBUG=C:\DialTerm\debug.log
      DIALTERM

Not included
------------
These Telix features are not in this version: the SALT script language
and compiler, and the Kermit, CompuServe B+, SEAlink and Telink protocols.
External protocols can still be run with Alt-V.

Building from source
--------------------
On Windows, install MinGW-w64 gcc (for example MSYS2's mingw32 i686
toolchain or w64devkit), then run build.bat.
On Linux:  CC=i686-w64-mingw32-gcc WINDRES=i686-w64-mingw32-windres ./build.sh
The program uses only the Win32 API (kernel32, user32, winmm) and the C
runtime. The included DIALTERM.EXE was built with LLVM clang for
MinGW-w64 (i686), static, with no extra DLLs.

Testing
-------
This build was tested under Wine 9.0 on Linux with emulated Hayes modems on
COM1-COM4 and real lrzsz (sz/rz) transfers. The tests covered port
switching, the init string, the dialing directory, dialing, BUSY and
automatic redial, CONNECT and NO CARRIER handling, hang-up, ANSI screens,
and Zmodem, Xmodem, 1k-Xmodem, Ymodem and Ymodem-g transfers in both
directions. It has not been tested with a physical modem on a real
Windows 11 PC. Please report any problems.
