Kermit-MS 2.32/A for NEC PC-9801

Program for machine-dependent part:

                Hirofumi Fujii
                (National Laboratory for High Energy Physics, KEK)
                     and
                Akihiro Shirahashi (University of Tokyo)

                (The main program and many other machine-independent
                routines are programmed by Joe R. Doupnik)

Language:       Microsoft Macro Assembler (MASM) V4.0 or above

Version:        Kermit-MS 2.32/A (Machine dependent part: KEK v1.15)

Released:       Apr 25, 1989

Documentation:  Hirofumi Fujii
                (National Laborartory for High Energy Physics, KEK)


Machine-dependent capabilities at a glance:

   Terminal emulation:             VT102, Tektronix 4014
   Communication settings:         Speed, Parity, Flow Control, Echo
   Transmit BREAK:                 Yes (and Long BREAK)
   Local area networks:            Yes (only for Ungerman-Bass NETCI interface)
   MS-Windows compatibility:       No

   Kana-Kanji handling
     in connect mode:              Yes (DEC-code, JIS-7/8 and Shift-JIS code)
     in session logging:           Yes
     in file transfer mode:        No (can be sent only as a binary file)
   Japanese Front end processor
     compatibility:                Yes

   Terminal emulation:
     Rollback capability           Yes
     Modeline                      Yes
     Printer control               Yes
     Key redefinition              Yes
     Screen Dump                   Yes (adapting Kana-Kanji)

MS-DOS Kermit for NEC PC-9801 is one of the "Kermit-MS" family.
The basic usage is the same as "Kermit-MS" for IBM/PC.
Therefore, this document describes only the diffrences from the
IBM/PC.

1. Terminal emulation options

   Summary of the default values:
     Communication port          1 (COM1)
     Terminal emulation          VT102
     EscChar                     ^]
     Display                     Regular, 8-bit
     Keyinput                    BIOS
     Keyclick                    off
     Kanji-code                  DECcode (see note below)
     Foreground Color            White
     Background Color            Black
     Highlight Color             Yellow
     Modeline Color              White
   (Note on Kanji display)
     More precisely, the default character code is assigned as follows;
       GL character set = G0 character set = JIS Roman (almost ASCII)
                          G1 character set = DEC special graphics
                          G2 character set = JIS Katakana
       GR character set = G3 character set = JIS C6226 (2-byte Kanji).
     Therefore, a SO invokes DEC special graphics and sending the JIS
     X 0208 code with 8th bit on (DEC Kanji code) results the the Kanji
     displayed.
     These assignments can be changed by sending the
     'invoke' or 'designate' escape sequence from the host. In this
     case, DEC-Kanji may not be displayed.

The following options are diffrent from IBM/PC

SET BAUD baud-rate
           The useful baud rates supported range from 300 to 9600 for CPU
           clock 8MHz, and from 300 to 19200 for 10MHz clock.

SET PORT {number, COMn, Device [devicename], UB-NETCI}
           The available ports are 1, 2, 3, or their equivalents COM1, COM2,
           COM3.  However, current program only works on COM1.

           In the case of device, the communication port is controlled by
           MS-DOS device-driver. The default device name is AUX. The
           device-driver for AUX is RSDRV.SYS.  The CONFIG.SYS must
           include

                           DEVICE = RSDRV.SYS

           To set-up the AUX device, you must invoke the SPEED command
           before using this device.  For example,

           SPEED RS232C-0 1200 BITS-8 PARITY-NONE STOP-1 XON

           ( or SPEED R0 B8 PN S1 XON ).

           If Ungermann-Bass PC-NIU N98 board is installed, UB-NETCI port
           is also available.  Note that the port name and the usage is
           diffrent from IBM/PC.  See section 2 for more details.

SET TERMINAL {VT102, TEK4014, NONE}
           Kermit-MS for NEC PC-9801 emulates two types of terminals,
           DEC VT102 and Tektronix 4014.  Heath/Zenith-19 and VT52 are not
           supported.

The set-up related SET TERMINAL commands:

CHARACTER-SET {UK, US}
           Not implemented. See KANJI-CODE command for Japanese character sets.

COLOR
           See FOREGROUND.

COOKED-LOG {ON, OFF}
           If it is ON, logging is made just before putting the character
           on the screen.  All control characters are eliminated except for
           CR, LF, HT(TAB), VT . (i.e., Kanji code is converted to Shift-JIS).
           All ESC sequences are eliminated.

CURSOR-STYLE
           Not implemented.

FOREGROUND {WHITE, YELLOW, CYAN, GREEN, RED, BLUE, MAGENTA, BLACK}
           Specify color for normal attribute characters. This color is used
           in VT102 and TEK4014 emulation modes and not affected to the dumb
           terminal screen.

HIGHLIGHT {WHITE, YELLOW, CYAN, GREEN, RED, BLUE, MAGENTA, BLACK}
           The bold characters are displayed in diffrent color in VT102
           emulation mode. This command specifyes the color for bold
           characters.

KANJI-CODE {DEC-code, Shift-JIS, JIS-7, NONE}
           Set the Kanji-Kana code to be used in connect mode.  The Kanji-
           Kana characters from keyboard are translated to the specified code
           before sending to the communication port and characters received
           from communication port are translated from specified code to the
           NEC-PC9801 internal Kanji-Kana code before displaying or printing.

KEYINPUT {BIOS, CON}
           Specifies keyinput mode.  In BIOS mode, keyboard is read via
           NEC-PC9801 bios.  In this mode, almost all the keys have their
           own scan codes. However, Japanese front end processors except for
           ATOK6 are not compatible with this mode.
             To adapt many kind of Japanese front end processors, keyinput via
           standard MS-DOS console (CON) i/o is also available.  The function
           keys, arrow keys etc., are programmed to return the same scan-code
           as in DIRECT mode.
           See section 2 for keymap.

MODELINE-COLOR {WHITE, YELLOW, CYAN, GREEN, RED, BLUE, MAGENTA, BLACK}
           Specify color for mode line.

GRAPHICS
           Not necessary. The graphic VRAM of the NEC-PC9801 has 640x400
           pixels.

MARGIN-BELL
           Not implemented.


ROLL
           Not implemented.

SCREEN-BACKGROUND
           See BACKGROUND.

TAB
           Not implemented. Tabs are set at every 8th column and can be
           changed only by host commands.


2. Keyboard mapping

   Unfortunately, many of the Japanese front end processors are not compatible
with NEC keyboard bios. Therefore, this program has two modes for keyboard
inputs, direct mode (read via bios) and CON mode (read using standard MS-DOS
console i/o). The latter is compatible with all the Japanese front end
processors. Special keys are programmed to return the same code as
in direct mode. However, the keypad keys except for HOME-CLR and HELP are not
programable, so that keypad keys cannot be distinguished from normal alpah-
numeric keys in a standard way.

  The following table shows the diffrences of the scan codes between two modes.

                        BIOS mode                        CON mode
                ------ pressed with ------      ------ pressed with ------
                normal  SHIFT  CTRL   GRPH      normal  SHIFT  CTRL   GRPH

    STOP         \352   \384   \400   \352       \352   \384   \400   \352
    COPY         \353   \385   \401   \353       \353   \385   \401   \353

      f1         \354   \386   \402   ----       \354   \386   ----   ----
      f2         \355   \387   \403   ----       \355   \387   ----   ----
      f3         \356   \388   \404   ----       \356   \388   ----   ----
      f4         \357   \389   \405   ----       \357   \389   ----   ----
      f5         \358   \390   \406   ----       \358   \390   ----   ----
      f6         \359   \391   \407   ----       \359   \391   ----   ----
      f7         \360   \392   \408   ----       \360   \392   ----   ----
      f8         \361   \393   \409   ----       \361   \393   ----   ----
      f9         \362   \394   \410   ----       \362   \394   ----   ----
     f10         \363   \395   \411   ----       \363   \395   ----   ----

    ROLL UP      \310   \422   \438   \310       \310   \422   \438   \310
    ROLL DOWN    \311   \423   \439   \311       \311   \423   \439   \311

      INS        \312   \424   \440   \312       \312   \424   \440   \312
      DEL        \313   \425   \441   \313       \313   \425   \441   \313

    up    arrow  \314   \426   \442   \314       \314   \426   \442   \314
    left  arrow  \315   \427   \443   \315       \315   \427   \443   \315
    right arrow  \316   \428   \444   \316       \316   \428   \444   \316
    down  arrow  \317   \429   \445   \317       \317   \429   \445   \317

    HOME CLR     \318   \430   ----   ----       \318   \430   ----   ----
    HELP         \319   \319   \319   \319       \319   \319   \319   \319
    keypad -     \320   \320   \320   \320       \320   \320   \320    \45
    keypad /     \321   \321   \321   \321       \321   \321   \321
    keypad *     \325   \325   \325   \149       \325   \325   \325   ----
    keypad +     \329   \329   \329   \224       \329   \329   \329   ----
    keypad =     \333   \333   \333   \150       \333   \333   \333   ----
    keypad CR     \13    \13    \13    \13        \13    \13    \13    \13

    keypad ,     \335   \335   \335   \144       \335   \335   \335   ----
    keypad .     \336   \336   \336   \155       \336   \336   \336   ----

    keypad 0     \334   \334   \334   \154       \334   \334   \334   ----
    keypad 1     \330   \330   \330   \147       \330   \330   \330   ----
    keypad 2     \331   \331   \331   \143       \331   \331   \331   ----
    keypad 3     \332   \332   \332   \146       \332   \332   \332   ----
    keypad 4     \326   \326   \326   \225       \326   \326   \326   ----
    keypad 5     \327   \327   \327   \226       \327   \327   \327   ----
    keypad 6     \328   \328   \328   \227       \328   \328   \328   ----
    keypad 7     \322   \322   \322   \152       \322   \322   \322   ----
    keypad 8     \323   \323   \323   \145       \323   \323   \323   ----
    keypad 9     \324   \324   \324   \153       \324   \324   \324   ----

The default key assignments are

    PC-9801 Key     Scan code  Verb/code   VT100 equivalent
   -------------    ---------  ---------   ----------------
     ESC               \256       \27        ESC
     BS                \270      \127        DEL
     TAB               \271        \9        TAB
     DEL               \313        \8        BS

     ROLL UP           \310     \Kupscn
     ROLL DOWN         \311     \Kdnscn
     CTRL + ROLL UP    \438     \Kupone
     CTRL + ROLL DOWN  \439     \Kdnone

     STOP              \352     \Kexit
     SHIFT + STOP      \384     \Kbreak      BREAK

     COPY              \353     \Kprtscn
     SHIFT + COPY      \385     \Ktrnprs

     up    arrow       \314     \Kuparr      up    arrow
     left  arrow       \315     \Klfarr      left  arrow
     right arrow       \316     \Krtarr      right arrow
     down  arrow       \317     \Kdnarr      down  arrow

     HOME CLR          \318     \Kpf1        PF1
     HELP              \319     \Kpf2        PF2
     keypad -          \320     \Kpf3        PF3
     keypad /          \321     \Kpf4        PF4

     keypad *          \325     \Kkpminus    keypad -
     keypad +          \329     \Kkpcoma     keypad ,
     keypad =          \333     \Kkpenter    keypad ENTER
     keypad ,          \335     \Kkp0        keypad 0
     keypad .          \336     \Kkpdot      keypad .

     keypad 0          \334     \Kkp0        keypad 0
     keypad 1          \330     \Kkp1        keypad 1
     keypad 2          \331     \Kkp2        keypad 2
     keypad 3          \332     \Kkp3        keypad 3
     keypad 4          \326     \Kkp4        keypad 4
     keypad 5          \327     \Kkp5        keypad 5
     keypad 6          \328     \Kkp6        keypad 6
     keypad 7          \322     \Kkp7        keypad 7
     keypad 8          \323     \Kkp8        keypad 8
     keypad 9          \324     \Kkp9        keypad 9

3. Network interface

  In this program, only supported network interface is Ungermann-Bass
PC-NIU N98.  This interface board is programable, and Ungermann-Bass supplies
two kinds of network protocol software, XNS (Net/One) and TCP/IP. User must
load the appropriate program before using this interface.

3.1 XNS (Net/One)

   The loading procedure to use this protocol is

   A> NET START urdr <local computer name>

   Then start Kermit,
   A> KERMIT

   Kermit-MS> SET PORT UB-NETCI
   Kermit-MS> connect

   Then you get the prompt

   You may now enter Net/One commands
   >>

 3.2 TCP/IP

   Before using this protocol, you must load the protocol program by typing

   A> etws

   The Kermit-MS works under the 'tn' program which is supplied by Ungermann-
   Bass.  The procedure is

   A> tn -e Kermit

   Kermit-MS> SET PORT UB-NETCI
   Kermit-MS> connect

   Then you get the prompt

   TELNET>

   Because that the 'telnet' is the terminal emulation porgram, there are a few
   problems for file transfer.  As a default, 'telnet' has escape sequences to
   hold or disconnect session without logout procedure.  This means that the
   'telnet' always checks incoming characters and causes sending file to be
   extreamly slow. (On the other hand, receiving file is fast because of no
   checking for receiving characters.)  It is possible to set the 'telnet' in
   transparent mode,

   TELNET> set binary on                  .

   After setting this mode, the speed of the send-file is almost the same as
   that of the receive-file.
   However, this is very dangerous.  After that, you cannot control the session
   from the PC side.

   For these reasons, it is strongly recomended to use the FTP program for
   file transfer.


4. Kana-Kanji display

   Kana-Kanji is the Japanese character set. The characters are mapped to
2-byte codes.  Officially, these codes and the procedure to interchange
the codes are defined in the following Japanese Industrial Standards (JIS);

   JIS X 0208:
     Code of the Japanese Graphic Character Set
     for Information Intercahnge

   JIS X 0202:
     Code Extension Techniques for Use with the Code
     for Information Interchange .


Unfortunatly, these standards are NOT widly used.  Many computers use their
original procedures to handle X 0208 character set not only for internal code
but also for comunications.  MS-DOS machine uses so called 'Shift-JIS' code
(the name is not appropriate because Shift-JIS is not JIS).  Therefore, this
program has Kanji-code parameter as terminal set-up parameters.

4-1.JIS and DEC Kanji

  This VT102 is programmed as a JIS Kanji terminal. This terminal has the
following graphic sets:
    o JIS roman graphics
    o JIS katakana graphics
    o JIS X 0208 2-byte Kanji graphics
    o DEC special graphic
In general, to display the code in some graphic set, you must "designate"
the graphic set as one of G0, G1, G2 or G3.  Then you must "invoke" one of
the G0 through G3 into GL or GR.  To display the GR character set,
you must send the code with 8th bit on.
  As a default setting, the character sets are assigned as follows;

       GL <- G0 <- JIS roman (X 0201)
             G1 <- DEC special graphics
             G2 <- JIS katakana (X 0201)
       GR <- G3 <- JIS kanji (X 0208)     .

A SO code (0/14) invokes G1 character set to GL. Therefore, after receiving
SO code, terminal displayes DEC special graphics for D0 characters (2/0 -
7/E) in this case. The 2-byte Kanji-code can be displayed by sending the
JIS X 0208 code with 8th bit on (i.e., DEC Kanji code) because it is assigned
to GR character set.

4-2. Invocation and designation of the graphic set

  The following escape sequences and C0 characters can be used to invoke
or to designate the graphic set:

  To designate the single byte graphic set:
    ESC 02/08 F or ESC 02/12 F  designates the graphic set to G0
    ESC 02/09 F or ESC 02/13 F  designates the graphic set to G1
    ESC 02/10 F or ESC 02/14 F  designates the graphic set to G2
    ESC 02/11 F or ESC 02/15 F  designates the graphic set to G3

    where
      F is 04/10   for JIS roman
           03/00   for DEC special graphics
           04/09   for JIS katakana
      any other code in the range 03/00 to 07/14 designates the JIS roman
      graphics.

  To designate the multi-byte graphic set:
    ESC 02/04 02/12 F or ESC 02/04 F         designates to G0
    ESC 02/04 02/13 F or ESC 02/04 02/09 F   designates to G1
    ESC 02/04 02/14 F or ESC 02/04 02/10 F   designates to G2
    ESC 02/04 02/15 F or ESC 02/04 02/11 F   designates to G3

    where
      F is 04/02   for JIS kanji (X 0208)
    any other code in the range 03/00 to 07/14 designates the JIS X 0208

  To invoke the graphic set:
    SI (00/15)  invokes the G0 to GL
    SO (00/14)  invokes the G1 to GL
    ESC 07/14   invokes the G1 to GR
    ESC 06/14   invokes the G2 to GL
    ESC 07/13   invokes the G2 to GR
    ESC 06/15   invokes the G3 to GL
    ESC 07/12   invokes the G3 to GR

Therefore, the default setting is equivalent to the following escape sequences;

   ESC 02/08 04/10
   ESC 02/09 03/00
   ESC 02/10 04/09
   ESC 02/04 02/15 04/02
   SI
   ESC 07/12

4-3. Shift-JIS

  Shift-JIS is not an industrial standard, but widly used on many Japanese
MS-DOS machines.


5. Sending Kana-Kanji codes

  This program is designed to be able to send Kana-Kanji characters in the
following codes;

    - DEC code (almost equivalent to Extended Unix Code)
    - JIS code in 7-bit environment
    - Shift-JIS code.

To select the code system,

    Kermit-MS>set terminal kanji-code <code specification>
