Thursday, May 16, 2019

Node-M Terminal Emulator for C128

Node-M is a custom terminal emulator program I created so I could work on my university Computer Information Science assignments from home over 2400 baud modem with my Commodore 128, about 30 years ago 1988-1989.  This article documents the solution, the ADM31 comparable emulation, and provides C128 disk image and UNIX/Linux support files (link to ZIP file).  Source file is included using The Fast Assembler (also source listing).

My favorite features were color, secondary composite graphics screen, full screen editing support (for me that was vi), full ASCII character set (backslash, backquote, caret, curly braces, vertical bar, underscore, tilde), keyboard support, printer support, and interlaced 80-column x 50-line mode (sorry not shown, doesn't work well in VICE).  Notable missing features are flow control and file transfer.








Keyboard changes for ASCII
  • Commodore+Q is Left Brace {
  • Commodore+W is Right Brace }
  • Commodore+E is Tilde ~
  • Commodore+R is Backquote `
  • Commodore Minus is Vertical Bar |
  • British Pound is Backslash \
  • Up Arrow is Caret (Hat) ^
  • Left Arrow is Underscore _

ADM31 terminal emulation, with additions/variations
  • {Ctrl+?} 127 DEL
  • {Ctrl+G} 7 BELL
  • {Ctrl+H} 8 RIGHT
  • {Ctrl+I} 9 TAB
  • {Ctrl+J} 10 LINEFEED
  • {Ctrl+K} 11 UP
  • {Ctrl+L} 12 RIGHT
  • {Ctrl+M} 13 CARRIAGE RETURN
  • {Ctrl+W} 23 CLEAR TO END OF SCREEN
  • {Ctrl+X} 24 CLEAR TO END OF LINE
  • {Ctrl+^} 30 HOME
  • {Ctrl+Z} 26 CLEAR SCREEN / HOME
  • {Ctrl+[} 27 ESC
  • ESC t CLEAR TO END OF LINE (ESC T)
  • ESC y CLEAR TO END OF SCREEN (ESC Y)
  • ESC : CLEAR SCREEN / HOME (ESC *)
  • ESC ) HALF INTENSITY ON
  • ESC ( HALF INTENSITY OFF
  • ESC G 0 CLEAR ATTRIBUTES
  • ESC G 1 ALTERNATE CHARACTER SET ATTRIBUTE
  • ESC G 2 FLASH ATTRIBUTE
  • ESC G 3 UNDERLINE ATTRIBUTE
  • ESC G 4 REVERSE ATTRIBUTE
  • ESC H 2 4 INIT SCREEN 24 LINES
  • ESC H 5 0 INIT SCREEN 50 LINES
  • ESC ESC ESC {32 TO 47} FOREGROUND SCREEN COLOR 0-15
    {space}black !dkgray “blue #ltblue $green %ltgreen &dkcyan 'cyan (red )ltred *dkpurple +purple \dkyellow -yellow ^medgray _white
  • ESC ESC ESC {48 TO 63 or 96 TO 111} BACKGROUND CHARACTER COLOR 0-15
    0black 1dkgray 2blue 3ltblue 4green 5ltgreen 6dkcyan 7cyan 8red 9ltred ;dkpurple :purple <dkyellow =yellow >medgray ?white
    `-black a-dkgray b-blue c-ltblue d-green e-ltgreen f-dkcyan g-cyan h-red i-ltred j-dkpurple k-purple l-dkyellow m-yellow n-medgray o-white
  • ESC = {32 TO 55/81} {32 TO 111} MOVE CURSOR TO ROW (0-23 or 0-49), COLUMN (0-79)
  • ESC E INSERT LINE
  • ESC Q INSERT CHARACTER
  • ESC R DELETE LINE
  • ESC W DELETE CHARACTER
  • ESC L {64 TO 79} {64 TO 79} {64 TO 79} {64 TO 79} PIXEL POSITION XH XL YH YL (X=0 TO 319, Y=0 TO 199), SAVE OLD X,Y
  • ESC M {EVEN/ODD} PIXEL COLOR (0=BACKGROUND, 1=FOREGROUND)
  • ESC P PLOT AT PIXEL POSITION
  • ESC D DRAW LINE BETWEEN OLD AND CURRENT PIXEL POSITION
  • ESC C CLEAR GRAPHIC SCREEN
  • ESC < SLOW, ENABLE GRAPHIC SCREEN
  • ESC > FAST, DISABLE GRAPHIC SCREEN
  • ESC F FILL AT PIXEL POSITION
  • ESC B CLEAR GRAPHIC BLOCK (RECTANGLE DEFINED BY OLD AND CURRENT PIXEL POSITION)
Note: running the C128 in emulation I couldn't quite get the terminal to talk over TCP/IP serial emulation directly to my Linux telnet service, so I ran a shell script in between to do a conversion (from some hints on stack overflow):

#!/bin/sh
mkfifo temp
while true; do nc -l 127.0.0.1 23 < temp | dd bs=1 | nc -t 192.168.56.101 23 | dd bs=1 > temp ; done


No comments:

Post a Comment