home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / mskermit / mszp98.asm < prev    next >
Assembly Source File  |  2020-01-01  |  19KB  |  871 lines

  1. ;+ This is MSZP98.ASM
  2. ;
  3. ;  Utility and SetUp Package for NEC PC-9801
  4. ;  Author: Hirofumi Fujii (KEK On-line group)
  5. ;  Last Edited: 17-Apr-1990
  6. ;  17-Apr-1991  deleted prn_out
  7. ;  05-Apr-1991  added pcwtst
  8. ;  30-Sep-1990    added text_scrn
  9. ;  27-Sep-1990    VTS comes here !
  10. ;  13-Aug-1990    added sense_sftkey
  11. ;  24-Jul-1990    for MS-Kermit v3.02
  12.  
  13.     include    mssdef.h
  14.     include    msxp98.h
  15.  
  16.     public    vts
  17.     public    s2jis, jis2s, is_kanji1
  18.     public    set_keydef, reset_keydef
  19.     public    set_cursor
  20.     public    sense_sftkey
  21.     public    text_scrn
  22.     public    pc98_bell
  23.     public    pcwait, pcwtst
  24.  
  25. data     segment    public 'data'
  26.  
  27. ;-------------------------------------------------------------------
  28. ; Data for set-up routine
  29. ;-------------------------------------------------------------------
  30.     extrn    flags:byte
  31.     extrn    comand:byte        ; in MSSCMD.ASM
  32.     extrn    denyflg:word
  33.     extrn    cpu_clock:byte, vtgrph_flg:byte, vttest_flg:byte
  34.     extrn    curkey_mode:byte, keypad_mode:byte
  35.     extrn    display_mode:byte
  36.     extrn    keyin_dos:byte
  37.     extrn    kanji_rcode:byte, kanji_scode:byte
  38.     extrn    vt100_cursr:byte
  39.     extrn    vt100_flags:byte, vt100_pflag:byte
  40.     extrn    vt100_lflag:byte, vt100_gflag:byte
  41.     extrn    def_color:byte, scn_color:byte
  42.  
  43. pcwcnt        dw    480        ; wait count
  44. pcwtst_vect    dw    0, 0, 0, 0
  45. pcwtst_done    dw    0
  46.  
  47. param_dst    dw    ?
  48. temp        dw    ?
  49.  
  50. vthlp    db    ' one of the following:',cr,lf
  51.     db    '  Terminal types of: None, VT102, or '
  52.     db    'Tek4014',cr,lf
  53.     db    '  Clock (5MHz,8MHz,10MHz)            ',cr,lf
  54.     db    '  Keyclick (on/off)                  '
  55.     db    '  Keyinput (BIOS/CON/DOS)            ',cr,lf
  56.     db    '  Keypad-mode (application/normal)   '
  57.     db    '  Cursorkey-mode (application/normal)',cr,lf
  58.     db    '  Foreground (white,yellow...)       '
  59.     db    '  Background (black,blue...)         ',cr,lf
  60.     db    '  Highlight (yellow,magenta...)      '
  61.     db    '  Modeline-color (white,green...)    ',cr,lf
  62.     db    '  Kanji-code (DEC-code,Shift-JIS,JIS-'
  63.     db    '7, or none)',cr,lf
  64.     db    '  Insert-mode (on/off)               '
  65.     db    '  Origin-mode (on/off)               ',cr,lf
  66.     db    '  Newline-mode (on/off)              '
  67.     db    '  Wrap (on/off)                      ',cr,lf
  68.     db    '  Cooked-log (on/off)                ',cr
  69.     db    '$'
  70.  
  71. ; VT setup command table
  72. ; The higher byte indicates the group of the command.
  73. ;   100H   -- terminal type
  74. ;   300H   -- color group
  75. ;   400H   -- Kanji group
  76. ;   500H   -- Keymode application/normal
  77. ;   600H   -- Playback file
  78. ;   700H   -- clear
  79. ;  2000H   -- vt100_flags on/off
  80. ;  2100H   -- vt100_pflag on/off
  81. ;  2200H   -- vtgrph_flg on/off
  82. ;  2300H   -- vt100_lflag on/off
  83. ;  2400H   -- vttest_flg on/off
  84. ;
  85. ; <<< DO NOT forget to update the number of items at 'vttbl' when you add
  86. ;     new item to the following list >>>
  87. vttbl    db    36
  88.     mkeyw    'Background',301H
  89.     mkeyw    'Clear-screen',700H
  90.     mkeyw    'Clock',503H
  91.     mkeyw    'Color',300H
  92.     mkeyw    'Cooked-log',LOGCOOK_BIT+2300H
  93.     mkeyw    'Cursorkey-mode',502H
  94.     mkeyw    'Display-mode',504H
  95.     mkeyw    'Exit-graphic',EXITG_BIT+2200H
  96.     mkeyw    'Foreground',300H
  97.     mkeyw    'GWait',GCLRWAIT_BIT+2200H
  98.     mkeyw    'Highlight',302H
  99.     mkeyw    'Insert-mode',INSERT_BIT+2000H
  100.     mkeyw    'Kanji-Code',400H
  101.     mkeyw    'Keyclick',KEYCLICK_BIT+2000H
  102.     mkeyw    'Keyinput',500H
  103.     mkeyw    'Keypad-mode',501H
  104.     mkeyw    'Modeline-color',303H
  105.     mkeyw    'Mouse',MOUSE_BIT+2200H
  106.     mkeyw    'Newline-mode',NEWLINE_BIT+2000H
  107.     mkeyw    'None',ttgenrc+100H    ; note 100H flag for decoding here
  108.     mkeyw    'Origin-mode',ORIGIN_BIT+2000H
  109.     mkeyw    'Playback',600H
  110.     mkeyw    'PrintEXT',PRINTEXT_BIT+2100H
  111.     mkeyw    'PrintFF',PRINTFF_BIT+2100H
  112.     mkeyw    'Tek4014',tttek+100H
  113.     mkeyw    'test1',2401H
  114.     mkeyw    'test2',2402H
  115.     mkeyw    'test3',2404H
  116.     mkeyw    'test4',2408H
  117.     mkeyw    'test5',2410H
  118.     mkeyw    'test6',2420H
  119.     mkeyw    'test7',2440H
  120.     mkeyw    'test8',2480H
  121.     mkeyw    'VT102',ttvt100+100H
  122.     mkeyw    'VT52',ttvt52+100H
  123.     mkeyw    'Wrap',AUTOWRAP_BIT+2000H
  124. ; <<< DO NOT forget to update the number of items at 'vttbl' when you add
  125. ;     new item to the above list >>>
  126.  
  127. ontab    db    2
  128.     mkeyw    'off',0
  129.     mkeyw    'on',1
  130.  
  131. colortab    db    8
  132.     mkeyw    'black',0
  133.     mkeyw    'blue',1
  134.     mkeyw    'cyan',5
  135.     mkeyw    'green',4
  136.     mkeyw    'magenta',3
  137.     mkeyw    'red',2
  138.     mkeyw    'white',7
  139.     mkeyw    'yellow',6
  140.  
  141. disatab        db    2        ; Tek disable/enable table
  142.         mkeyw   'disable',1
  143.         mkeyw   'enable',0
  144.  
  145. kanjitab    db    4
  146.     mkeyw    'DEC-code',KNJCODE_DEC
  147.     mkeyw    'JIS-7',KNJCODE_JIS7
  148.     mkeyw    'None',KNJCODE_NONE
  149.     mkeyw    'Shift-JIS',KNJCODE_SJIS
  150.  
  151. keyintab    db    4
  152.     mkeyw    'BIOS',0
  153.     mkeyw    'CON',1
  154.     mkeyw    'direct',0
  155.     mkeyw    'DOS',2
  156.  
  157. keypadtab    db    2
  158.     mkeyw    'Application',1
  159.     mkeyw    'normal',0
  160.  
  161. clocktab    db    3
  162.     mkeyw    '10MHz',CPU_5M_CLOCK
  163.     mkeyw    '5MHz',CPU_5M_CLOCK
  164.     mkeyw    '8MHz',CPU_8M_CLOCK
  165.  
  166. displaytab    db    2
  167.     mkeyw    'Analogue',1
  168.     mkeyw    'Digital',0
  169. ;
  170. ;---------------------------------------------------------------------------
  171. ; Function key definition tables
  172.  
  173. ker_keydef    db    0FEh,'f 01 ',0FFh,062h, 8 dup (0)    ; f 1
  174.         db    0FEh,'f 02 ',0FFh,063h, 8 dup (0)    ; f 2
  175.         db    0FEh,'f 03 ',0FFh,064h, 8 dup (0)    ; f 3
  176.         db    0FEh,'f 04 ',0FFh,065h, 8 dup (0)    ; f 4
  177.         db    0FEh,'f 05 ',0FFh,066h, 8 dup (0)    ; f 5
  178.         db    0FEh,'f 06 ',0FFh,067h, 8 dup (0)    ; f 6
  179.         db    0FEh,'f 07 ',0FFh,068h, 8 dup (0)    ; f 7
  180.         db    0FEh,'f 08 ',0FFh,069h, 8 dup (0)    ; f 8
  181.         db    0FEh,'f 09 ',0FFh,06Ah, 8 dup (0)    ; f 9
  182.         db    0FEh,'f 10 ',0FFh,06Bh, 8 dup (0)    ; f10
  183.         db    0FEh,'F 01 ',0FFh,082h, 8 dup (0)    ; shift f 1
  184.         db    0FEh,'F 02 ',0FFh,083h, 8 dup (0)    ; shift f 2
  185.         db    0FEh,'F 03 ',0FFh,084h, 8 dup (0)    ; shift f 3
  186.         db    0FEh,'F 04 ',0FFh,085h, 8 dup (0)    ; shift f 4
  187.         db    0FEh,'F 05 ',0FFh,086h, 8 dup (0)    ; shift f 5
  188.         db    0FEh,'F 06 ',0FFh,087h, 8 dup (0)    ; shift f 6
  189.         db    0FEh,'F 07 ',0FFh,088h, 8 dup (0)    ; shift f 7
  190.         db    0FEh,'F 08 ',0FFh,089h, 8 dup (0)    ; shift f 8
  191.         db    0FEh,'F 09 ',0FFh,08Ah, 8 dup (0)    ; shift f 9
  192.         db    0FEh,'F 10 ',0FFh,08Bh, 8 dup (0)    ; shift f10
  193.         db    0FFh,036h, 4 dup (0)    ; ROLL UP
  194.         db    0FFh,037h, 4 dup (0)    ; ROLL DOWN
  195.         db    0FFh,038h, 4 dup (0)    ; INS
  196.         db    0FFh,039h, 4 dup (0)    ; DEL
  197.         db    0FFh,03Ah, 4 dup (0)    ; up arrow
  198.         db    0FFh,03Bh, 4 dup (0)    ; left arrow
  199.         db    0FFh,03Ch, 4 dup (0)    ; right arrow
  200.         db    0FFh,03Dh, 4 dup (0)    ; down arrow
  201.         db    0FFh,03Eh, 4 dup (0)    ; HOME CLR
  202.         db    0FFh,03Fh, 4 dup (0)    ; HELP
  203.         db    0FFh,0AEh, 4 dup (0)    ; shift HOME CLR
  204. KEYDEF_SIZE = $ - ker_keydef + 2
  205.  
  206. DOS_keydef    db    KEYDEF_SIZE dup (?)
  207.  
  208. ;
  209. data    ends
  210.  
  211. code    segment    public 'code'
  212.     assume    cs:code,ds:data,es:nothing
  213.  
  214.     extrn    comnd:near        ; in MSSCMD
  215.     extrn    set_cur_color:near    ; in MSXP98
  216.     extrn    vt100_color:near    ; in MSYP98
  217.     extrn    tek4014_color:near    ; in MSGP98
  218.  
  219. ;-------------------
  220. is_kanji1    proc    near
  221. ;
  222. ; Check if al is Kanji 1st byte (stc) or not (clc)
  223. ;
  224.     cmp    al,81h
  225.     jb    is_kanji1_no
  226.     cmp    al,0FCh
  227.     ja    is_kanji1_no
  228.     cmp    al,9fh
  229.     jbe    is_kanji1_yes
  230.     cmp    al,0E0h
  231.     jae    is_kanji1_yes
  232. is_kanji1_no:
  233.     clc
  234.     ret
  235. is_kanji1_yes:
  236.     stc
  237.     ret
  238. is_kanji1    endp
  239.  
  240. ;-------------------
  241. jis2s    proc    near
  242. ;
  243. ; Convert JIS Kanji code in AX to shift-JIS Kanji code
  244. ;    ah    2nd byte
  245. ;    al    1st byte
  246. ;
  247.     test    al,1
  248.     jz    jis2s1
  249.     add    ah,1Fh
  250.     jmp    jis2s2
  251. jis2s1:
  252.     add    ah,7Dh
  253. jis2s2:
  254.     cmp    ah,7Fh
  255.     jb    jis2s3
  256.     add    ah,1
  257. jis2s3:
  258.     sub    al,21h
  259.     shr    al,1
  260.     add    al,81h
  261.     cmp    al,9Fh
  262.     jbe    jis2s4
  263.     add    al,40h
  264. jis2s4:
  265.     ret
  266. jis2s    endp
  267.  
  268. ;-------------------
  269. s2jis    proc    near
  270. ;
  271. ; Convert Shift JIS Kanji code in AX to JIS Kanji code
  272. ;    ah    2nd byte
  273. ;    al    1st byte
  274. ;
  275.     cmp    al,9Fh
  276.     ja    s2jis1
  277.     sub    al,71h
  278.     jmp    s2jis2
  279. s2jis1:
  280.     sub    al,0B1h
  281. s2jis2:
  282.     shl    al,1
  283.     inc    al
  284.     cmp    ah,7Fh
  285.     jbe    s2jis3
  286.     dec    ah
  287. s2jis3:
  288.     cmp    ah,9Eh
  289.     jb    s2jis4
  290.     sub    ah,7Dh
  291.     inc    al
  292.     jmp    s2jis5
  293. s2jis4:
  294.     sub    ah,1Fh
  295. s2jis5:
  296.     ret
  297. s2jis    endp
  298.  
  299. set_keydef    proc    near
  300. ; Save MS-DOS key definition table and set new key definition table.
  301. ; This is done by calling NEC-PC98 extended bios.
  302.  
  303.     push    ax
  304.     push    cx
  305.     push    dx
  306.  
  307.     mov    dx,offset DOS_keydef
  308.     mov    ax,0
  309.     mov    cl,0Ch
  310.     int    0DCh
  311.     mov    dx,offset ker_keydef
  312.     mov    ax,0
  313.     mov    cl,0Dh
  314.     int    0DCh
  315.  
  316.     pop    dx
  317.     pop    cx
  318.     pop    ax
  319.     ret
  320. set_keydef    endp
  321.  
  322. reset_keydef    proc    near
  323. ; Restore MS-DOS key definition table
  324.  
  325.     push    ax
  326.     push    cx
  327.     push    dx
  328.  
  329.     mov    dx,offset DOS_keydef
  330.     mov    ax,0
  331.     mov    cl,0Dh
  332.     int    0DCh
  333.  
  334.     pop    dx
  335.     pop    cx
  336.     pop    ax
  337.     ret
  338. reset_keydef    endp
  339.  
  340. ;---------------------------
  341. text_scrn    proc    near
  342. ;
  343. ; Text screen on/off control
  344. ;
  345. ; Input        AL: 0      off
  346. ;                   others on
  347. ;
  348.     push    ax
  349.     push    bx
  350.     mov    bl,0Ch        ; assume off
  351.     cmp    al,0        ; want off ?
  352.     je    text_scrn_1    ; e=yes
  353.     mov    bl,0Dh        ; on
  354. text_scrn_1:
  355.     in    al,60h        ; Read Text GDC status
  356.     test    al,04h        ; GDC buffer empty ?
  357.     jz    text_scrn_1    ; z=no
  358.     mov    al,bl
  359.     out    62h,al        ; send command
  360.     pop    bx
  361.     pop    ax
  362.     ret
  363. text_scrn    endp
  364. ;
  365. ;---------------------------
  366. set_cursor    proc    near
  367. ;
  368. ; set cursor
  369. ; Input        AX: cursor attributes
  370. ;            bit0    0:visible,   1:invisible
  371. ;                   bit1    0:blink,     1:noblink
  372. ;                   bit2    0:block,     1:underline
  373. ;
  374.     push    ax
  375.     push    bx
  376.     mov    bx,ax
  377.     cli
  378. set_cursor1:
  379.     in    al,60h        ; Read Text GDS status
  380.     test    al,04h        ; GDC buffer empty ?
  381.     jz    set_cursor1    ; z = no
  382.     mov    al,4Bh        ; CSFORM command
  383.     out    62h,al        ; send command
  384.     mov    al,8Fh        ; CS=1, L/R=15
  385.     test    bx,1        ; cursor off ?
  386.     jz    set_cursor2    ; z = no
  387.     mov    al,0Fh        ; CS=0, L/R=15
  388. set_cursor2:
  389.     out    60h,al        ; send P1 parameter
  390.     mov    al,00h        ; BD=0, CST=0
  391.     test    bx,2        ; blink ?
  392.     jz    set_cursor3    ; z = yes. blink cursor
  393.     mov    al,20h        ; BD=1, CST=0
  394. set_cursor3:
  395.     test    bx,4        ; underline ?
  396.     jz    set_cursor4    ; z = no.
  397.     add    al,0Eh        ; CST=14
  398. set_cursor4:
  399.     out    60h,al        ; send P2 parameter
  400.     mov    al,07Bh        ; CFI=15, BL=12
  401.     out    60h,al        ; send P3 parameter
  402.     sti
  403.     pop    bx
  404.     pop    ax
  405.     ret
  406. set_cursor    endp
  407.  
  408. ;-----------------------------------------------------------------------
  409. ; Bell routine
  410. ;
  411. pc98_bell    proc    near
  412.     push    ax
  413.     push    cx
  414. ;
  415.     mov    al,06h        ; bell on
  416.     out    37h,al
  417.     mov    cx,0D000h    ; counter
  418. pc98_bell_loop:
  419.     loop    pc98_bell_loop
  420.     mov    al,07h        ; bell off
  421.     out    37h,al
  422. ;
  423.     pop    cx
  424.     pop    ax
  425.     ret
  426. pc98_bell    endp
  427. ;-----------------------------------------------------------------------
  428. ; set the pcwcnt used in pcwait.
  429. ;
  430. pcwtst_int    proc    near
  431.     mov    pcwtst_done,1
  432.     iret
  433. pcwtst_int    endp
  434.  
  435. pcwtst    proc    near
  436.     push    ax
  437.     push    bx
  438.     push    cx
  439.     push    si
  440.     push    di
  441.     push    es
  442. ;
  443.     xor    ax,ax
  444.     mov    es,ax        ; ES = 0
  445.     cli            ; disable interrupt
  446.     mov    si,28        ; save vector number 7 & 8
  447.     mov    di,offset pcwtst_vect
  448.     mov    ax,es:[si]
  449.     mov    [di],ax
  450.     mov    ax,es:[si+2]
  451.     mov    [di+2],ax
  452.     mov    ax,es:[si+4]
  453.     mov    [di+4],ax
  454.     mov    ax,es:[si+6]
  455.     mov    [di+6],ax
  456. ;
  457.     mov    pcwcnt,0
  458.     mov    pcwtst_done,0
  459.     sti            ; enable interrupt
  460.     mov    cx,10        ; 100msec mesurements
  461.     mov    ax,cs
  462.     mov    es,ax
  463.     mov    bx,offset pcwtst_int
  464.     mov    ah,02h        ; interval timer function number
  465.     int    1Ch        ; BIOS call
  466. ;
  467. pcwtst0:
  468.     cmp    pcwtst_done,0
  469.     jne    pcwtst2
  470.     mov    cx,100
  471. pcwtst1:
  472.     sub    cx,1
  473.     jnz    pcwtst1
  474.     inc    pcwcnt
  475.     jmp    pcwtst0
  476. ;
  477. pcwtst2:
  478.     inc    pcwcnt        ; add 1
  479.     cli
  480.     xor    ax,ax
  481.     mov    es,ax        ; ES = 0
  482.     mov    si,28        ; restore vector 7 & 8
  483.     mov    di,offset pcwtst_vect
  484.     mov    ax,[di]
  485.     mov    es:[si],ax
  486.     mov    ax,[di+2]
  487.     mov    es:[si+2],ax
  488.     mov    ax,[di+4]
  489.     mov    es:[si+4],ax
  490.     mov    ax,[di+6]
  491.     mov    es:[si+6],ax
  492.     sti
  493.     pop    es
  494.     pop    di
  495.     pop    si
  496.     pop    cx
  497.     pop    bx
  498.     pop    ax
  499.     ret
  500. pcwtst    endp
  501. ;-----------------------------------------------------------------------
  502. ;; Wait for the # of milliseconds in ax, for non-IBM compatibles.
  503. ; inner loop counter (pcwcnt, adjusted by proc pcwtst).
  504. pcwait  proc    near
  505.         push    cx
  506. pcwai0: mov     cx,pcwcnt       ; inner loop counter for 1 ms
  507. pcwai1: sub     cx,1            ; inner loop takes 20 clock cycles
  508.         jnz     pcwai1
  509.         dec     ax              ; outer loop counter
  510.         jnz     pcwai0          ; wait another millisecond
  511.         pop     cx
  512.         ret
  513. pcwait  endp
  514.  
  515. ;-----------------------------------------------------------------------
  516. ; Sense shfit-key status
  517. ;
  518. ; output
  519. ;             +----+----+----+----+----+----+----+----+
  520. ;   AL        | -- | -- | -- |CTRL|GRPH|KANA|CAPS|SHFT|
  521. ;             +----+----+----+----+----+----+----+----+
  522. sense_sftkey    proc    near
  523.     mov    ah,02h
  524.     int    18h
  525.     ret
  526. sense_sftkey    endp
  527.  
  528. ;----------------------------------
  529. ; VT Setup routine (global routine)
  530. ;----------------------------------
  531. VTS     PROC    NEAR
  532.     mov    ah,cmkey        ; Parse another keyword.
  533.     mov    bx,offset vthlp        ; Use this help
  534.     mov    dx,offset vttbl        ; Use this table
  535.     call    comnd
  536.     jnc    vsetup_n0
  537.     ret
  538. vsetup_n0:
  539.     cmp    bh,1h            ; marker for terminal type?
  540.     jne    vsetup_n1        ; ne = no
  541.     jmp    vsetup_1
  542. vsetup_n1:
  543.     cmp    bh,20h            ; set term vt100_flags on/off?
  544.     jne    vsetup_n20        ; ne = no
  545.     jmp    vsetup_20
  546. vsetup_n20:
  547.     cmp    bh,21h            ; set term vt100_pflag on/off?
  548.     jne    vsetup_n21        ; ne = no
  549.     jmp    vsetup_20
  550. vsetup_n21:
  551.     cmp    bh,22h            ; set term vtgrph_flg on/off
  552.     jne    vsetup_n22
  553.     jmp    vsetup_20
  554. vsetup_n22:
  555.     cmp    bh,23h            ; set term vt100_lflag on/off
  556.     jne    vsetup_n23
  557.     jmp    vsetup_20
  558. vsetup_n23:
  559.     cmp    bh,24h            ; set term vttest_flg on/off
  560.     jne    vsetup_n24
  561.     jmp    vsetup_20
  562. vsetup_n24:
  563. vsetup_n2:
  564.     cmp    bh,3h            ; marker for color
  565.     jne    vsetup_n3        ; ne = no
  566.     jmp    vsetup_3
  567. vsetup_n3:
  568.     cmp    bh,4h            ; marker for kanji
  569.     jne    vsetup_n4        ; ne = no
  570.     jmp    vsetup_4
  571. vsetup_n4:
  572.     cmp    bh,5            ; marker for keyboard
  573.     jne    vsetup_n5
  574.     jmp    vsetup_5
  575. vsetup_n5:
  576.     cmp    bh,6            ; marker for playback file
  577.     jne    vsetup_n6
  578.     jmp    vsetup_6
  579. vsetup_n6:
  580.     cmp    bh,7
  581.     jne    vsetup_n7
  582.     jmp    vsetup_7
  583. vsetup_n7:
  584.     jmp    vsetup_ex
  585. ;
  586. vsetup_1:
  587. ;
  588. ; The followings are copied from MSYIBM.ASM
  589. ;
  590. vsetu0: mov     byte ptr temp,bl        ; set terminal type
  591.         mov     byte ptr temp+1,-1      ; assume no enable/disable Tek
  592.         cmp     bl,tttek                ; set term tek?
  593.         jne     vsetu0a                 ; ne = no
  594.         mov     dx,offset disatab       ; disable/enable keyword table
  595.         xor     bx,bx                   ; help is the table
  596.         mov     comand.cmcr,1           ; allow bare CR's
  597.         mov     ah,cmkey                ; get enable/disable keyword
  598.         call    comnd
  599.         mov     comand.cmcr,0           ; no more bare CR's
  600.         jc      vsetu0e                 ; c = no such keyword
  601.         mov     byte ptr temp+1,bl      ; save enable/disable keyword value
  602.         mov     bl,flags.vtflg          ; get current terminal type
  603.         mov     byte ptr temp,bl        ; and force it here
  604.  
  605. vsetu0a:mov     ah,cmeol
  606.         call    comnd                   ; get a confirm
  607.         jc      vsetu0d                 ; c = failure
  608. vsetu0e:mov     bx,temp
  609.         mov     flags.vtflg,bl          ; Set the terminal emulation type
  610. ;@@    mov     tekflg,0                ; clear Tek sub mode
  611.         cmp     bl,tttek                ; adjusting Tek?
  612.         je      vsetu0b                 ; e = yes
  613.         cmp     bh,-1                   ; just enable/disable tek?
  614.         je      vsetu0c                 ; e = no
  615. vsetu0b:and     denyflg,not tekxflg     ; enable Tek
  616.         cmp     bh,1                    ; ought we disable?
  617.         jne     vsetu0c                 ; ne = no
  618.         or      denyflg,tekxflg         ; disable Tek
  619. vsetu0c:clc                             ; success
  620. vsetu0d:ret
  621.  
  622. vsetup_20:
  623.     and    bh,1Fh
  624.     mov    param_dst,bx
  625.     mov    ah,cmkey
  626.     mov    bx,0
  627.     mov    dx,offset ontab
  628.     call    comnd
  629.     jnc    vsetup_2_0_1
  630.     ret                ; bad keyword
  631. vsetup_2_0_1:
  632.     push    bx
  633.     mov    ah,cmeol        ; get a confirm
  634.     call    comnd
  635.     jnc    vsetup_2_0_2
  636.     jmp    vsetup_ex2        ; did not get a confirm
  637. vsetup_2_0_2:
  638.     mov    ax,param_dst
  639.     pop    bx
  640.     cmp    bl,0
  641.     jne    vsetup_2_on
  642.     not    al
  643. ;
  644. ;   OFF mode
  645. ;
  646.     cmp    ah,0
  647.     jne    vsetup_2_off1
  648.     and    vt100_flags,al
  649.     jmp    vsetup_2_2
  650. vsetup_2_off1:
  651.     cmp    ah,1
  652.     jne    vsetup_2_off2
  653.     and    vt100_pflag,al
  654.     jmp    vsetup_2_2
  655. vsetup_2_off2:
  656.     cmp    ah,2
  657.     jne    vsetup_2_off3
  658.     and    vtgrph_flg,al
  659.     jmp    vsetup_2_2
  660. vsetup_2_off3:
  661.     cmp    ah,3
  662.     jne    vsetup_2_off4
  663.     and    vt100_lflag,al
  664.     jmp    vsetup_2_2
  665. vsetup_2_off4:
  666.     cmp    ah,4
  667.     jne    vsetup_2_off5
  668.     and    vttest_flg,al
  669. vsetup_2_off5:
  670.     jmp    vsetup_2_2
  671. ;
  672. ;  ON mode
  673. ;
  674. vsetup_2_on:
  675.     cmp    ah,0
  676.     jne    vsetup_2_on1
  677.     or    vt100_flags,al
  678.     jmp    vsetup_2_2
  679. vsetup_2_on1:
  680.     cmp    ah,1
  681.     jne    vsetup_2_on2
  682.     or    vt100_pflag,al
  683.     jmp    vsetup_2_2
  684. vsetup_2_on2:
  685.     cmp    ah,2
  686.     jne    vsetup_2_on3
  687.     or    vtgrph_flg,al
  688.     jmp    vsetup_2_2
  689. vsetup_2_on3:
  690.     cmp    ah,3
  691.     jne    vsetup_2_on4
  692.     or    vt100_lflag,al
  693.     jmp    vsetup_2_2
  694. vsetup_2_on4:
  695.     cmp    ah,4
  696.     jne    vsetup_2_on5
  697.     or    vttest_flg,al
  698.     jmp    vsetup_2_2
  699. vsetup_2_on5:
  700. vsetup_2_2:
  701. ;;    jmp    rskp
  702.     clc
  703.     ret
  704.  
  705. vsetup_3:
  706.     mov    dx,offset def_color
  707.     xor    bh,bh
  708.     add    dx,bx
  709.     mov    param_dst,dx
  710.  
  711.     mov    ah,cmkey
  712.     mov    bx,0
  713.     mov    dx,offset colortab
  714.     call    comnd
  715.     jnc    vsetup_3_1
  716.     ret                ; bad keyword
  717. vsetup_3_1:
  718.     push    bx
  719.     mov    ah,cmeol        ; get a confirm
  720.     call    comnd
  721.     jnc    vsetup_3_2
  722.     jmp    vsetup_ex2        ; did not get a confirm
  723. vsetup_3_2:
  724.     pop    dx            ; get old bx value to dx
  725.     mov    bx,param_dst
  726.     mov    byte ptr [bx],dl
  727.     push    si
  728.     mov    si,offset def_color
  729.     cmp    bx,si            ; if foreground color, set modecol also
  730.     jne    vsetup_3_7
  731.     mov    byte ptr [bx+3],dl
  732. vsetup_3_7:
  733.     call    set_cur_color
  734.     call    vt100_color
  735.     call    tek4014_color
  736.     pop    si
  737. ;;    jmp    rskp
  738.     ret
  739.  
  740. vsetup_4:
  741.     mov    ah,cmkey
  742.     mov    bx,0
  743.     mov    dx,offset kanjitab
  744.     call    comnd
  745.     jnc    vsetup_4_1
  746.     ret                ; bad keyword
  747. vsetup_4_1:
  748.     push    bx
  749.     mov    ah,cmeol        ; get a confirm
  750.     call    comnd
  751.     jnc    vsetup_4_2
  752.     jmp    vsetup_ex2        ; did not get a confirm
  753. vsetup_4_2:
  754.     pop    bx            ; get old bx value to dx
  755.     mov    kanji_scode,bl
  756.     mov    kanji_rcode,bl
  757. ;;    jmp    rskp
  758.     ret
  759.  
  760. vsetup_5:
  761.     xor    bh,bh
  762.     cmp    bx,0
  763.     jne    vsetup_5n0
  764.     mov    dx,offset keyin_dos
  765.     mov    param_dst,dx
  766.     mov    dx,offset keyintab
  767.     jmp    vsetup_5do
  768. vsetup_5n0:
  769.     cmp    bx,1
  770.     jne    vsetup_5n1
  771.     mov    dx,offset keypad_mode
  772.     mov    param_dst,dx
  773.     mov    dx,offset keypadtab
  774.     jmp    vsetup_5do
  775. vsetup_5n1:
  776.     cmp    bx,2
  777.     jne    vsetup_5n2
  778.     mov    dx,offset curkey_mode
  779.     mov    param_dst,dx
  780.     mov    dx,offset keypadtab
  781.     jmp    vsetup_5do
  782. vsetup_5n2:
  783.     cmp    bx,3
  784.     jne    vsetup_5n3
  785.     mov    dx,offset cpu_clock
  786.     mov    param_dst,dx
  787.     mov    dx,offset clocktab
  788.     jmp    vsetup_5do
  789. vsetup_5n3:
  790.     cmp    bx,4
  791.     jne    vsetup_5n4
  792.     mov    dx,offset display_mode
  793.     mov    param_dst,dx
  794.     mov    dx,offset displaytab
  795.     jmp    vsetup_5do
  796. vsetup_5n4:
  797. ;;    jmp    rskp
  798.     ret
  799. vsetup_5do:
  800.     mov    ah,cmkey
  801.     mov    bx,0
  802.     call    comnd
  803.     jnc    vsetup_5do_1
  804.     ret
  805. vsetup_5do_1:
  806.     push    bx
  807.     mov    ah,cmeol
  808.     call    comnd
  809.     jnc    vsetup_5do_2
  810.     jmp    vsetup_ex2
  811. vsetup_5do_2:
  812.     pop    dx
  813.     mov    bx,param_dst
  814.     mov    byte ptr [bx],dl
  815. ;;    jmp    rskp
  816.     ret
  817.  
  818. vsetup_6:
  819.  
  820. ; Set playback filename. Taken from 'setdmp' in MSSSET.ASM
  821. ; Puts filename in global string playback_fnam.
  822. ; Discared due to device independent module has playback command now.
  823. ;        mov     dx,offset rdbuf         ; work area
  824. ;        mov     rdbuf,0                 ; clear it
  825. ;        mov     bx,offset playback_hlp  ; help message
  826. ;        mov     ah,cmword               ; allow paths
  827. ;        call    comnd
  828. ;        jnc    vsetup_6_1
  829. ;        ret
  830. ;vsetup_6_1:
  831. ;        mov     ah,cmeol
  832. ;        call    comnd
  833. ;        jnc    vsetup_6_2
  834. ;        ret
  835. ;vsetup_6_2:
  836. ;        mov     dx,offset rdbuf         ; assume we will use this text
  837. ;        call    strlen                  ; filename given?
  838. ;        mov     si,dx                   ; for strcpy
  839. ;        cmp     cx,0                    ; length of user's filename
  840. ;        jg      vsetup_6_3              ; g = filename is given
  841. ;        mov     si,offset playback_defnam     ; no name, use default instead
  842. ;vsetup_6_3:
  843. ;        mov     di,offset playback_fnam       ; copy to globally available loc
  844. ;        call    strcpy
  845. ;        or    vt100_flags,LOOPTEST_BIT
  846. ;;        jmp     rskp
  847.     ret
  848.  
  849. vsetup_7:
  850. ;    push    bx
  851. ;    mov    ah,cmeol
  852. ;    call    comnd
  853. ;    jnc    vsetup_7_1
  854. ;    jmp    vsetup_ex2
  855. vsetup_7_1:
  856. ;    call    vtreset
  857.     ret
  858.  
  859. vsetup_ex:
  860. ;;    jmp    rskp
  861.     ret
  862. vsetup_ex2:
  863.     pop    bx
  864.     ret
  865.  
  866. VTS     ENDP
  867.  
  868.  
  869. code    ends
  870.     end
  871.