-
Notifications
You must be signed in to change notification settings - Fork 1
/
ibmspecificx.asm
8431 lines (8067 loc) · 260 KB
/
ibmspecificx.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
NAME msxibm
; File MSXIBM.ASM
; Kermit system dependent module for IBM-PC
include symboldefs.h
; Copyright (C) 1982, 1999, Trustees of Columbia University in the
; City of New York. The MS-DOS Kermit software may not be, in whole
; or in part, licensed or sold for profit as a software product itself,
; nor may it be included in or distributed with commercial products
; or otherwise distributed by commercial concerns to their clients
; or customers without written permission of the Office of Kermit
; Development and Distribution, Columbia University. This copyright
; notice must not be removed, altered, or obscured.
;
; Edit history
; 12 Jan 1995 version 3.14
; Last edit
; 12 Jan 1995
public serini, serrst, clrbuf, outchr, coms, cardet
public dodel, ctlu, cmblnk, locate, prtchr, baudst, clearl
public getbaud, beep, shomodem, getmodem, mdmhand, shownet
public count, xofsnt, puthlp, putmod, clrmod, poscur, holdscr
public sendbr, sendbl, machnam, setktab, setkhlp, lclini, showkey
public ihosts, ihostr, dtrlow, serhng, comptab, pcwait, portval
public bdtab, dupflg, peekcom, tstport, fossil_port, fossilflag
public savexoff, savexlen, parmsk, flowon, flowoff, flowcnt
public isps55 ; [HF] 940130 Japanese IBM PS/55 mode
public ps55mod ; [HF]940206 PS/55 mode line status (0:system)
public prtblk, sndblk
ifndef no_network
public setnbios, ubhold, ubclose
endif ; no_network
ifndef no_tcp
public tcpstart, tcp_status, sesdisp, seslist, sescur, winupdate
public tcpbtpkind, sestime
endif ; no_tcp
off equ 0
bufon equ 1 ; buffer level xon/xoff on-state control flag
usron equ 2 ; user level xon/xoff on-state control flag
mntrgh equ bufsiz*3/4 ; High point = 3/4 of buffer full
mntrgl equ bufsiz/4 ; Low point = 1/4 buffer full
nbuflen equ 512 ; bytes in each network buffer (two of them)
; DEC-LAT requires 259 (256 + 3 extra)
BRKBIT EQU 040H ; Send-break bit.
TIMERCMD EQU 43h ; 8253/4 Timer chip command port
TIMER2DATA EQU 42h ; 8253/4 Timer 2 data port
PPI_PORT EQU 61h ; 8255 prog peripheral chip control port
VIDEO EQU 10H ; Bios Video display software interrupt
RS232 EQU 14H ; Bios RS232 serial port s/ware interrupt
; constants used by serial port handler
MDMINP EQU 1 ; Input ready bit
MDMOVER EQU 2 ; Receiver overrun
; 1200/75 baud split speed constants
cnt75b equ 47721/3 ; One bit of 75 baud at 1.193 Mhz clock
precomp equ cnt75b/8 ; Precomp 12%, allows 3ms latency w 12% jitter
ifndef no_tcp
_TEXT segment
extrn ktcpopen:far, ktcpclose:far, ktcpswap:far, ktcpcom:far
_TEXT ends
endif ; no_tcp
data segment
extrn flags:byte, trans:byte, ttyact:byte, comand:byte
extrn lclsusp:word, lclrest:word, lclexit:word, rxtable:byte
extrn rdbuf:byte, taklev:byte, scbattr:byte
extrn low_rgt:word, diskio:byte, crt_cols:byte
extrn dosnum:word, portirq:byte, portfifo:byte, dosctty:byte
extrn tv_mode:byte, repflg:byte, decbuf:byte
extrn takadr:word, taklev:byte, vtinited:byte, kbdflg:byte
extrn yflags:byte, apctrap:byte, protlist:byte
extrn vtcpage:word, kstatus:word
extrn domath_ptr:word, domath_cnt:word, domath_msg:word
ifndef no_network
ifndef no_tcp
extrn tcpnewline:byte
extrn tcpaddress:byte, tcpsubnet:byte, tcpdomain:byte
extrn tcpgateway:byte, tcpprimens:byte, tcpsecondns:byte
extrn tcphost:byte, tcpbcast:byte, tcpbtpserver:byte
extrn tcpport:word, tcppdint:word, tcpttbuf:byte
extrn tcpdebug:byte, tcpmode:byte, tcpmss:word
endif ; no_tcp
endif ; no_network
ifndef no_terminal
extrn tekflg:byte, ftogmod:dword
endif ; no_terminal
; Modem information
mdminfo struc
mddat dw 03f8h ; data register, base address (03f8h)
mdiir dw 03fah ; interrupt identification register (03fah)
mdstat dw 03fdh ; line status register (03fdh)
mdcom dw 03fbh ; line control register (03fbh)
mden db not (1 shl 4) ; mask to enable interrupt
mddis db (1 shl 4) ; mask to disable interrupt
mdmeoi db 60h+4 ; specific EOI
mdintv dw 8+4 ; saved interrupt vector (0ch is IRQ 4)
mdmintc dw 20h ; interrupt controller control (20h or 0a0h)
mdfifo db 0 ; non-zero if UART is in FIFO mode
mdminfo ends
modem mdminfo <>
setktab db 0 ; superceded by msuibm code, return 0 here
setkhlp db '$' ; and add empty help string
holdscr db 0 ; Hold-Screen, non-zero to stop reading
savsci dd 0 ; old serial port interrupt vector
sav232 dd 0 ; Original Bios Int 14H address, in Code seg
savirq db 0 ; Original Interrupt mask for IRQ
savier db 0 ; original UART Int enable bits (03f9)
savstat db 0 ; orginal UART control reg (03fch)
savlcr db 0 ; Original Line Control Reg (3fbh) contents
dupflg db 0 ; full (0) or half (1) duplex on port
quechar db 0 ; queued char for outchr (XOFF typically)
intkind db 0 ; cause of serial port interrupt
isps2 db 0 ; non-zero if real IBM PS/2
isps55 db 0 ; [HF] 940130 non-zero if Japanese PS/55 mode
ps55mod db 0, 0 ; [HF] 940202 PS/55 mode line at startup/curr.
reset_clock db 0 ; toggle to reset time of day clock in serini
erms40 db cr,lf,'?Warning: Unrecognized Speed',cr,lf,'$'
badbd db cr,lf,'Unimplemented speed$'
badprt db cr,lf,'?Warning: unknown address for port. Assuming \x0$'
biosmsg db cr,lf,'?Warning: unknown hardware for port.'
db ' Using the Bios as BIOS$'
badirq db cr,lf,'?Warning: unable to verify IRQ. Assuming $'
msmsg1 db cr,lf,' Modem is not ready: DSR is off$'
msmsg2 db cr,lf,' Modem is ready: DSR is on$'
msmsg3 db cr,lf,' no Carrier Detect: CD is off$'
msmsg4 db cr,lf,' Carrier Detect: CD is on$'
msmsg5 db cr,lf,' no Clear To Send: CTS is off$'
msmsg6 db cr,lf,' Clear To Send: CTS is on$'
msmsg7 db cr,lf,' Modem is not used by the Network$'
msmsg8 db cr,lf,' COM1 address: Port \x$'
msmsg9 db ', IRQ $'
msmsg10 db ', 16550A UART FIFO$'
msmsg11 db cr,lf,' Fossil port: $'
msmsg12 db ', disable-on-close: off$'
msmsg13 db ', disable-on-close: on$'
msmsg14 db ', 1 stop bit$'
msmsg20 db ' (Set Carrier is on)$'
msmsg21 db ' (Set Carrier is off)$'
hngmsg db cr,lf,' The phone or network connection should have hung up'
db cr,lf,'$'
machnam db 'IBM-PC$'
crlf db cr,lf,'$'
delstr db BS,BS,' ',BS,BS,'$' ; Delete string
clrlin db BS,BS,' ',cr,'$' ; Clear line (just the cr part)
portin db -1 ; Has comm port been initialized, -1=not used
nettype dw 0 ; kind of local area net (vendor bit field)
xofsnt db 0 ; Say if we sent an XOFF
xofrcv db 0 ; Say if we received an XOFF
pcwcnt dw 800 ; number of loops for 1 millisec in pcwait
temp dw 0
temp2 dw 0
tempsci dw 0 ; temp storage for serint
tempdum dw 0 ; temp storage for serdum
timeract db 0 ; timer in use by a routine, flag
clomsg db ' A communications session may be active;'
db ' exit anyway [Yes/No]? ',0
clotab db 2 ; close net on exit table
mkeyw 'yes',0
mkeyw 'no',1
ifdef no_network
comptab db 25 - 12
else
ifdef no_tcp
comptab db 25 - 1 ; communications port options
else
comptab db 25 ; communications port options
endif ; no_tcp
endif ; no_network
mkeyw 'Bios1','0'+1 ; '0' is to flag value as forced Bios
mkeyw 'Bios2','0'+2
mkeyw 'Bios3','0'+3
mkeyw 'Bios4','0'+4
mkeyw 'COM1',1 ; these go straight to the hardware
mkeyw 'COM2',2
mkeyw 'COM3',3
mkeyw 'COM4',4
mkeyw '1',1 ; straight to the hardware
mkeyw '2',2
mkeyw '3',3
mkeyw '4',4
ifndef no_network
mkeyw '3Com(BAPI)','C' ; 3Com BAPI interface
mkeyw 'BWTCP','b' ; [JRS] Beame & Whiteside TCP
mkeyw 'DECnet','D' ; DECnet-DOS LAT and CTERM
mkeyw 'EBIOS','E' ; IBM/YALE EBIOS Int 14h interceptor
mkeyw 'NetBios','N' ; Netbios
mkeyw 'Novell(NASI)','W' ; Novell NetWare NASI/NACS
mkeyw 'OpenNET','O' ; Intel OpenNET support (FGR)
mkeyw 'SuperLAT','M' ; Meridian SuperLAT
ifndef no_tcp
mkeyw 'TCP/IP','t' ; Telnet, internal
endif ; no_tcp
mkeyw 'TELAPI','T' ; Novell TELAPI
mkeyw 'TES','I' ; TES, Interconnections Inc
mkeyw 'UB-Net1','U' ; Ungermann Bass Net One
endif ; no_network
mkeyw 'Fossil','F' ; Fossil
mkeyw ' ',0 ; port is not present, for Status
; port structure:
; baud rate index, local echo, parity flag, if flow control active (both ways),
; if need handshake after pkts, default handshake char, flow control char pair
; half/full duplex, port ready, send, receive, close procedures
; UART hardware
port1 prtinfo <-1,0,defpar,3,0,defhand,1,floxon,0,0,uartsnd,uartrcv,serrst>
port2 prtinfo <-1,0,defpar,3,0,defhand,1,floxon,0,0,uartsnd,uartrcv,serrst>
port3 prtinfo <-1,0,defpar,3,0,defhand,1,floxon,0,0,uartsnd,uartrcv,serrst>
port4 prtinfo <-1,0,defpar,3,0,defhand,1,floxon,0,0,uartsnd,uartrcv,serrst>
; IBM PC Bios and EBIOS
portb1 prtinfo <-1,0,defpar,3,0,defhand,1,floxon,0,0,biossnd,biosrcv,serrst>
portb2 prtinfo <-1,0,defpar,3,0,defhand,1,floxon,0,0,biossnd,biosrcv,serrst>
portb3 prtinfo <-1,0,defpar,3,0,defhand,1,floxon,0,0,biossnd,biosrcv,serrst>
portb4 prtinfo <-1,0,defpar,3,0,defhand,1,floxon,0,0,biossnd,biosrcv,serrst>
portval dw port1 ; Default is to use port 1
bdtab db 21 ; Baud rate table
mkeyw '45.5',0
mkeyw '50',1
mkeyw '75',2
mkeyw '110',3
mkeyw '134.5',4
mkeyw '150',5
mkeyw '300',6
mkeyw '600',7
mkeyw '1200',8
mkeyw '1800',9
mkeyw '2000',10
mkeyw '2400',11
mkeyw '4800',12
mkeyw '9600',13
mkeyw '14400',14
mkeyw '19200',15
mkeyw '28800',16
mkeyw '38400',17
mkeyw '57600',18
mkeyw '115200',19
mkeyw '75/1200',20 ; split speed, use this index for Bsplit
Bsplit equ 20 ; 75/1200 baud, split-speed [pslms]
; this table is indexed by the baud rate definitions given in bdtab.
; Unsupported baud rates should contain 0FFh.
bddat label word
dw 9E4H ; 45.5 baud
dw 900H ; 50 baud
dw 600H ; 75 baud
dw 417H ; 110 baud
dw 359H ; 134.5 baud
dw 300H ; 150 baud
dw 180H ; 300 baud
dw 0C0H ; 600 baud
dw 60H ; 1200 baud
dw 40H ; 1800 baud
dw 3AH ; 2000 baud
dw 30H ; 2400 baud
dw 18H ; 4800 baud
dw 0CH ; 9600 baud
dw 08h ; 14400 baud
dw 06H ; 19200 baud
dw 04h ; 28800 baud
dw 03H ; 38400 baud
dw 02h ; 57600 baud
dw 01h ; 115200 baud
dw 5fh ; Split 75/1200, 1200+1.1 percent error
baudlen equ ($-bddat)/2 ; number of entries above
; this table is indexed by the baud rate definitions given in
; pcdefs. Unsupported baud rates should contain FF.
; Bits are for Bios speed, no parity, 8 data bits.
clbddat label word
dw 0FFH ; 45.5 baud -- Not supported
dw 0FFH ; 50 baud
dw 0FFH ; 75 baud
dw 03H ; 110 baud
dw 0FFH ; 134.5 baud
dw 23H ; 150 baud
dw 43H ; 300 baud
dw 63H ; 600 baud
dw 83H ; 1200 baud
dw 0ffH ; 1800 baud
dw 0FFH ; 2000 baud
dw 0a3H ; 2400 baud
dw 0c3H ; 4800 baud
dw 0e3H ; 9600 baud
dw 0FFH ; 14400 baud
dw 0FFH ; 19200 baud
dw 0FFH ; 28800 baud
dw 0FFH ; 38400 baud
dw 0FFH ; 57600 baud
dw 0FFH ; 115200 baud
dw 0FFh ; Split 75/1200
defcom dw 03f8h,02f8h,03e8h,02e8h ; default COMn port addresses
;;;;;;;;;;;;;; start of per session save area
even
savexoff label word
source db bufsiz+2 DUP(?) ; Buffer for data from port (+ 2 guard bytes)
srcpnt dw source ; Pointer in buffer
count dw 0 ; Number of chars in int buffer
cardet db 0 ; UART Carrier Detect (and network analogue)
parmsk db 0ffh ; parity mask, 0ffh for no parity, 07fh with
flowoff db 0 ; flow-off char, Xoff or null (if no flow)
flowon db 0 ; flow-on char, Xon or null
flowcnt db 0 ; holds flowc (!= 0 using any flow control)
xmtcnt dw 0 ; occupancy in current output buffer
;;;xmtbufx db nbuflen+3 dup (0) ; external version of xmtbuf (dbl buffers)
xmtbufx db buffsz dup (0) ; external version of xmtbuf (dbl buffers)
db 0,0 ; required runon for CR NUL and IAC IAC
ifndef no_network
ifndef no_tcp
; TCP/IP Telnet internal
port_tn prtinfo <-1,0,defpar,3,0,defhand,1,floxon,0,0,ubsend,ubrecv,tcpclose>
else
port_tn prtinfo <-1,0,defpar,3,0,defhand,1,floxon,0,0,ubsend,ubrecv,ubclose>
endif ; no_tcp
endif ; no_network
savexlen dw ($-savexoff)
;;;;;;;;;;;;;;; end of per session save
tcp_status dw 0 ; status from msntnd.c
; SUCCESS 0
; NO_DRIVER 1
; NO_LOCAL_IP 2
; NO_SESSION 3
; NO_HOST 4
; BAD_SUBNET_MASK 5
; SESSIONS_EXCEEDED 6
; HOST_UNKNOWN 7
; HOST_UNREACHABLE 8
; CONNECTION_REJECTED 9
tcpbtpkind db 0 ; BOOT kind from msntni.asm
; BOOT_FIXED 0
; BOOT_BOOTP 1
; BOOT_RARP 2
; BOOT_DHCP 3
xmtbuf db nbuflen dup (0) ; network buffer for transmitter
rcvbuf db nbuflen+3 dup (0) ; network buffer for receiver
; variables for serial interrupt handler
mst dw 03fdh ; Modem status address
mdat dw 03f8h ; Modem data address
miir dw 03fah ; modem interrupt ident register
mdeoi db 20h ; End-of-Interrupt value
mdmhand db 0 ; Modem status register, current
mdintc dw 20h ; interrupt control address
fossil_port dw 0 ; Fossil, port number 0..98
fossilflag db 0 ; Fossil, shut port when done if non-zero
fossil_portst equ 3 ; Fossil, port status
fossil_init equ 4 ; Fossil, init port in dx
fossil_done equ 5 ; Fossil, release port in dx
fossil_dtr equ 6 ; Fossil, DTR control
fossil_blkrd equ 18h ; Fossil, block read
fossil_blkwr equ 19h ; Fossil, block write
fossil_flow equ 0fh ; Fossil, set flow control method
ifndef no_network
; Information structures for IBM Netbios compatible Local Area Networks
; network constants
netint equ 5ch ; Netbios interrupt
nadd equ 30h ; Add name
ncall equ 10h ; CALL, open a virtual circuit session
ncancel equ 35h ; Cancel command in scb buffer
ndelete equ 31h ; Delete Name
nhangup equ 12h ; Hangup virtual circuit session
nlisten equ 11h ; Listen for session caller
naustat equ 33h ; Network Adapter Unit, get status of
nreceive equ 15h ; Receive on virtual circuit
nreset equ 32h ; Reset NAU and tables
nsend equ 14h ; Send on virtual circuit
nsestat equ 34h ; Session, get status of
netbrk equ 70h ; STARLAN Int 5bh send Break
nowait equ 80h ; no-wait, command modifier
npending equ 0ffh ; Pending request
exnbios equ 0400h ; Int 2ah exec netbios call, error retry
; nettype word bits
netbios equ 0001h ; NetBios
netone equ 0002h ; Ungermann-Bass Net/One
decnet equ 0004h ; DECnet CTERM
declat equ 0008h ; DECnet LAT
bapi equ 0010h ; 3Com BAPI
ebios equ 0020h ; EBIOS, IBM and YALE
telapi equ 0040h ; TELAPI, Novell
tes equ 0080h ; TES, Interconnections Inc and Novell
tcpnet equ 0100h ; TCP/IP (internal)
acsi equ 0200h ; EBIOS, ACSI direct to NetBios pathway
bwtcp equ 0400h ; [JRS] Beame & Whiteside TCP
;xncall equ 74h ; [ohl] Net/One extended call function
netci equ 6Bh ; [ohl] Net/One command interface interrupt,
; [ohl] used for the following functions:
nciwrit equ 0000h ; [ohl] Net/One write function
nciread equ 0100h ; [ohl] Net/One read function
ncistat equ 0700h ; [ohl] Net/One status function
ncicont equ 0600h ; [ohl] Net/One control function
ncibrk equ 02h ; [ohl] Net/One code for a break
ncidis equ 04h ; [ohl] Net/One code for disconnect
ncihld equ 06h ; [ohl] code for placing a connection on hold
bapiint equ 14h ; 3Com BAPI, interrupt (Bios replacment)
bapicon equ 0a0h ; 3Com BAPI, connect to port
bapidisc equ 0a1h ; 3Com BAPI, disconnect
bapiwrit equ 0a4h ; 3Com BAPI, write block
bapiread equ 0a5h ; 3Com BAPI, read block
bapibrk equ 0a6h ; 3Com BAPI, send short break
bapistat equ 0a7h ; 3Com BAPI, read status (# chars to be read)
bapihere equ 0afh ; 3Com BAPI, presence check
bapieecm equ 0b0h ; 3Com BAPI, enable/disable ECM char
bapiecm equ 0b1h ; 3Com BAPI, trap Enter Command Mode char
bapiping equ 0b2h ; KERMIT BAPI extension, Telnet, Ping host
bapito_3270 equ 0b3h ; KERMIT BAPI extension, byte to 3270
bapinaws equ 0b4h ; KERMIT BAPI extension, send NAWS update
;
telopen equ 0e0h ; TELAPI xtelopen a connection
telclose equ 0e1h ; xtelclose a connection
telread equ 0e2h ; xtelread char(s)
telwrite equ 0e3h ; xtelwrite chars
telioctl equ 0e4h ; xtelioctl, ioctl the port
telreset equ 0e5h ; xtelreset, reset the whole TELAPI package
telunload equ 0e6h ; xtelunload, unload TELAPI TSR
tellist equ 0e7h ; xtellist, list current sessions and status
telattach equ 0e8h ; xtelattach, session to COM port # 0..3
telportosn equ 0e9h ; xtelportosn, return session id for port
telunreac equ -51 ; network is unreachable
telinuse equ -56 ; socket already in use
teltmo equ -60 ; timeout on connection attempt
telrefuse equ -61 ; connection refused
teldwnhost equ -64 ; host is down
telunkhost equ -67 ; unknown host
telfull equ -301 ; all sessions are in use
; TELAPI messages and misc data
telmsg1 db cr,lf,'?Badly constructed Internet address: $'
telmsg2 db cr,lf,'?No connection. Status = -$'
telmsg51 db cr,lf,'?Network is unreachable$'
telmsg56 db cr,lf,'?Socket already in use$'
telmsg60 db cr,lf,'?Timeout on connection attempt$'
telmsg61 db cr,lf,'?Connection refused$'
telmsg64 db cr,lf,'?Host is down$'
telmsg67 db cr,lf,'?Unknown host$'
telmsg301 db cr,lf,'?All sessions are in use$'
telhostid db 2 dup (0) ; TELAPI Telnet internal host session ident
IAC equ 255 ; B&W TCP/IP Telnet Options codes
DONT equ 254
DO equ 253
WONT equ 252
WILL equ 251
SB equ 250
SE equ 240
TELOPT_ECHO equ 1
TELOPT_SGA equ 3
TELOPT_STATUS equ 5
TELOPT_TTYPE equ 24
TELOPT_NAWS equ 31
NTELOPTS equ 24
sgaflg db 0 ; B&W TCP/IP, supress go ahead flag
option1 db 0 ; B&W TCP/IP, Telnet Options byte1
option2 db 0 ; B&W TCP/IP, Telnet Options byte1
optstate db 0 ; B&W TCP/IP, Telnet Options state variable
bwtcpnam db 'TCP-IP10',0 ; [JRS] name of Beame & Whiteside TCP driver
bwhandle dw 0 ; [JRS] handle for Beame & Whiteside TCP driver
;
testalk equ 4 ; TES invoke interactive cmd interpreter
tesbwrite equ 6 ; TES block write
tesbread equ 7 ; TES block read
tesinstal equ 0a0h ; TES installation/status report
teslist equ 0a1h ; TES get list of sessions, with status
tesgets equ 0a2h ; TES get list of server names
tesnews equ 0a3h ; TES start a new session
tesholds equ 0a4h ; TES hold currently active connection
tesresume equ 0a5h ; TES resume a session (1..9)
tesdrop equ 0a6h ; TES drop a session
tesnexts equ 0a7h ; TES skip to next active session
tesexec equ 0a8h ; TES send string to cmd interpreter
tesport dw 0 ; TES low byte = intercepted port
tesquiet db 'ACTION NONE',0 ; TES Stop command prompting
tesses db 0 ; TES session number (1..9 is legal)
tesname db 50 dup (0) ; TES host name asciiz
teshelp db cr,lf,'?Host name or "*" to see available hosts'
db ' or press ENTER to resume a connection$'
tesnlist db cr,lf,' Active TES hosts:$'
tesnhost db cr,lf,'?No existing connection.'
db ' Please select a host with SET PORT TES host$'
latkind db 0 ; non-zero if using TES or Meridian LAT
DEC_LAT equ 0 ; for latkind
MTC_LAT equ 2 ; for latkind
TES_LAT equ 1 ; for latkind
;; pcnet values: 0 no network available at all
;; 1 network board reports itself as present
;; 2 and session is in progress
;; extrn byte pcnet is defined in msster.
; NetBios (StarGROUP and Opennet)
port_nb prtinfo <-1,0,defpar,3,0,defhand,1,floxon,0,0,send,receive,nbclose>
; Ungermann Bass, 3ComBAPI, TELAPI
port_ub prtinfo <-1,0,defpar,3,0,defhand,1,floxon,0,0,ubsend,ubrecv,ubclose>
; DECnet LAT and CTERM and TES-LAT
port_dec prtinfo <-1,0,defpar,3,0,defhand,1,floxon,0,0,decsnd,decrcv,decclose>
; TES
port_tes prtinfo <-1,0,defpar,3,0,defhand,1,floxon,0,0,tessnd,tesrcv,tesclose>
endif ; no_network
scbst struc ; Session (Network) Control Block [PCnet comp]
scb_cmd db 0 ; command code for Netbios Int 5ch
scb_err db 0 ; error return or request is pending
scb_vcid db 0 ; virtual circuit ident number
scb_num db 0 ; local name-number
scb_baddr dw 0 ; buffer address, offset
dw data ; and segment
scb_length dw 0 ; length of buffer data
scb_rname db '* ' ; remote name, 16 chars space
scb_lname db ' ' ; local name filled
db 0 ; Receive timeout (0.5 sec units), want 0
db 0 ; Send timeout (0.5 sec units), want 0
scb_post dw 0 ; interrupt driven post address, offset
dw code ; and segment
db 0 ; LAN_num (adapter #), set to zero for STARLAN
scb_done db 0 ; command complete status
; the 14 bytes below are normally 'reserved'
; STARLAN uses 5 for long/special call names
; together with STARLAN specific Int 5bh
scb_vrname dw 0,0 ; Variable length call name ptr offset,segment
scb_vrlen db 0 ; length of vrname
db 9 dup (0) ; reserved
scbst ends ; 64 bytes overall
ifndef no_network
rcv scbst <,,,,rcvbuf,,length rcvbuf,,,,,rpost>; declare scb for rcvr
else
rcv scbst <,,,,rcvbuf,,length rcvbuf,,,,,> ; declare scb for rcvr
endif ; no_network
ifndef no_network
xmt scbst <,,,,xmtbuf,,length xmtbuf,,,,,spost>; for xmtr
lsn scbst <,,,,xmtbuf,,length xmtbuf,,,,,lpost>; for server listen
can scbst <> ; for cancels
; DECnet material
decint equ 69h ; CTERM interrupt
dpresent equ 100h ; CTERM Installation check
dsend equ 101h ; CTERM send byte
dread equ 102h ; CTERM read byte
dcstat equ 103h ; CTERM status
ddstat equ 104h ; CTERM Decnet status
dopen equ 105h ; CTERM open session
dclose equ 106h ; CTERM close session
dgetscb equ 10ah ; CTERM get SCB size
latint equ 6ah ; LAT interrupt
latsend equ 1 ; LAT send byte
latread equ 2 ; LAT read byte
latstat equ 3 ; LAT status
latsendb equ 4 ; LAT send block (v4)
latreadb equ 5 ; LAT read block (v4)
latinfo equ 6 ; LAT get miscellaneous information
latsrv equ 0d500h ; LAT get next service name
latopen equ 0d0ffh ; LAT open
latclose equ 0d000h ; LAT close
latbreak equ 0d100h ; LAT send a BREAK
latscbget equ 0d800h ; LAT get SCB interior to LAT
latscbfree equ 0d801h ; LAT free SCB interior to LAT
latcpyems equ 0d900h ; LAT copy to/from SCB in EMS or not
decneth dw 0 ; CTERM session handle
decseg dw 0 ; segment of CTERM SCB memory block
lathand dw 0 ; LAT session handle, high byte = 0ffh
latseg dw 0 ; LAT SCB seg in our memory
latversion db 4 ; LAT major version number
latscbptr dd 0,0,0 ; LAT, pointer to SCB
lcbst struc ; LAT control block structure V4
service db 17 dup (0) ; 0 service (number is offset)
db 10 dup (0) ; 17 node, for future use
lat_pwd dd 0 ; 27 password buffer ptr
pwd_len db 0 ; 31 length of the buffer
db 22 dup (0) ; 32 reserved
stopped dd 0 ; 54 session stopped post routine addr
overflow dd 0 ; 58 service table overflow post addr
xnotify dd 0 ; 62 transmit post routine addr
rnotify dd 0 ; 66 receive post routine addr
sstatus dw 0 ; 70 session status
db 270 dup (0) ; 72 reserved
slotqty db 2 ; 342 number receive data slots
slotused db 0 ; 343 number occupied slots
slotnr db 0 ; 344 index of next rcv slot to use
slotcur db 0 ; 345 index of current rcv slot
slotptr dw 0 ; 346 ptr to first received char
slottbl dw 0 ; 348 ptrs to bufs for slot 1
dw 0 ; 350 and for slot 2
slotbf1 db 259 dup (0) ; 352 first receive buffer
slotbf2 db 259 dup (0) ; 611 second receive buffer
lcbst ends ; total of 870 bytes
latservice db 17 dup (0) ; LAT host name
latpwd db 16 dup (0),0 ; LAT password, terminator
decmsg1 db cr,lf,'Cannot create DECnet session.$'
decmsg3 db ' DECnet Error $'
decmsg4 db cr,lf,' CTERM ready$'
decmsg5 db cr,lf,' LAT ready$'
decmsg6 db cr,lf,' Unable to allocate LAT SCB, trying CTERM$'
; end of DECnet and TES-LAT
pcnet db 0 ; Network is functioning
nambuf db 65 dup (0) ; network long name storage (STARLAN)
newnambuf db 0 ; non-zero if new entry into namebuf above
internet db 4 dup (0) ; TELAPI Internet address, binary
telses dw 0 ; TELAPI session number
telport dw 23 ; TELAPI Telnet port (defaults to 23)
sposted db 0 ; send interlock, 0 if no send posted
rposted db 0 ; rcv interlock, 0 if no receive posted
lposted db 0 ; listen outstanding (if non-zero)
netdbfr db 0 ; non-zero if net board is double buffered
lnamestat db 0 ; status of local name 0 = default,
; 1 = specified by user, 2 = locked in
deflname db 'mskermit.K ' ; default local name, 16 bytes
ivt1str db 'iVT1',0 ; FGR - OpenNet VT handshake string
inettyp db 0 ; FGR - network type 'N' or 'O'
nsbrk dw 0 ; net can send Break
starlan db 0 ; non-zero if StarLAN net
chkmsg1 db cr,lf,'?Cannot construct a local Kermit name, error = $'
setnbad db cr,lf,'?Local Kermit NetBIOS name is already fixed.$'
chkmsg2 db cr,lf,lf,' Name $'
chkmsg3 db ' is already in use. Please enter another of',cr,lf
setnbhlp db ' 1 - 14 letters or numbers (or nothing to quit): $'
netmsg1 db cr,lf,' Checking if our node name is unique ...$'
netmsg2 db cr,lf,' The network is active, our name is $'
netmsg3 db cr,lf,' NetBios local name: $'
netmsg4 db ' Remote host: $'
netmsg5 db cr,lf,' DECnet host: $'
netmsg6 db cr,lf,' TELAPI Internet host: $'
netmsg6a db ' port: $'
netmsg7 db cr,lf,' TES host name: $'
netmsg9 db cr,lf,' SuperLAT name: $'
netmsg8 db cr,lf,' EBIOS server port name: $'
nonetmsg db cr,lf,'?The network is not available$'
noname db cr,lf,'?No name exists for the remote host.$'
dnetsrv db cr,lf,' Available LAT service names:',cr,lf,'$'
ngodset db cr,lf,' Connecting to network node: $'
nbadset db bell,cr,lf,'?Cannot reach network node: $'
recmsg db cr,lf,'?Network receive failed, status = $'
sndmsg db cr,lf,'?Network send failed, status = $'
naskpmt db cr,lf,' A network session is active.',cr,lf
db ' Enter RESUME to resume it or NEW to start a new session:',0
nettab db 2
mkeyw 'New',0
mkeyw 'Resume',1
acnop equ 80h ; ACSI nop
; second byte: null (ignored)
acenable equ 81h ; ACSI raise modem leads
; second byte: DTR=01h, RTS=02h
acdisable equ 82h ; ACSI drop all modem leads
; second byte: null (ignored)
acbreak equ 83h ; ACSI send a BREAK
; second byte: null (ignored)
acsetmode equ 84h ; ACSI set port Mode (speed etc)
; second byte: speed=3bits, parity=2bits, stopbits=1bit, databits=2bits
acmodem equ 85h ; ACSI return modem leads state
; second byte: DCD=80h, RI=40h, DSR=20h, CTS=10h
acreqmodem equ 86h ; ACSI request modem leads state
; second byte: DCD=80h, RI=40h, DSR=20h, CTS=10h
acdelay equ 87h ; ACSI pause transmission
; second byte: delay in hundreths of second
acpace equ 88h ; ACSI set flow control or pacing
; second byte: direction send=10h, recv=20h; if pacing send=1, recv=2
acsetxon equ 89h ; ACSI set XON pacing character
; second byte: char to represent resume transmission
acsetxoff equ 8ah ; ACSI set XOFF pacing character
; second byte: char to represent cease transmission
; ACSI general read character status: BREAK detected=10h, framing error=08h,
; parity error=04h, overrun=02h
ebbufset equ 0ffh ; EBIOS set buf mode (1=send, 2=rcv)
ebbufcnt equ 0fdh ; EBIOS get buf count (1=send, 2=rcv)
ebpace equ 0feh ; EBIOS set pacing mode (80h=send)
ebrcv equ 0fch ; EBIOS receive, no wait
ebsend equ 1 ; EBIOS send a char
ebmodem equ 0fbh ; EBIOS set modem leads
ebbreak equ 0fah ; EBIOS send a BREAK
ebcontrol equ 0f9h ; EBIOS regain control
ebredir equ 0f6h ; EBIOS do port redirection
ebquery equ 0f5h ; EBIOS get redirection info
ebpresent equ 0f4h ; EBIOS presence check
ebport dw 0 ; EBIOS equivalent serial port 0..3
ebcoms db 0,0 ; adapter (port), path (80h=network)
db 16 dup (0) ; Call name (host)
db 16 dup (0) ; Listen name (null)
db 16 dup (0) ; local name (null = use lan adapter)
db 0 ; unique name (1 = group name)
ebmsg2 db cr,lf,'?No server port name is known,'
db ' reenter the command with a name.$'
ebmsg3 db cr,lf,'?Unable to contact that port. Error code=$'
ebiostab db 4 ; EBIOS table of local port names
mkeyw '1',1
mkeyw '2',2
mkeyw '3',3
mkeyw '4',4
ifndef no_tcp
tcpadrst db cr,lf,' tcp/ip address: $' ; TCP/IP status msgs
tcpsubst db cr,lf,' tcp/ip subnetmask: $'
tcpdomst db cr,lf,' tcp/ip domain: $'
tcpgatest db cr,lf,' tcp/ip gateway: $'
tcppnsst db cr,lf,' tcp/ip primary-nameserver: $'
tcpsnsst db cr,lf,' tcp/ip secondary-nameserver: $'
tcpbcstst db cr,lf,' tcp/ip broadcast: $'
tcphostst db cr,lf,' tcp/ip host: $'
tcpportst db cr,lf,' tcp/ip port: $'
tcpdebst db cr,lf,' tcp/ip debug-Options: $'
tcpbinst db cr,lf,' telnet mode: $'
tcppdintst db ', Packet-Driver-interrupt: \x$'
tcppdnul db ' (search for it)$'
tcpodi db ' using ODI interface$'
tcpttyst db cr,lf,' telnet term-type: $'
tcpttynul db '(report real terminal type)',0 ; ASCIIZ
tcpnlst db cr,lf,' telnet newline-mode: $'
tcpnlmsg0 db 'off (CR->CR NUL)$'
tcpnlmsg1 db 'on (CR->CR LF)$'
tcpnlmsg2 db 'raw (CR->CR)$'
tcpdeboff db 'off$'
tcpdebstat db 'status$'
tcpdebtim db 'timing$'
tcpdebon db 'on$'
tcpmodemsg0 db 'NVT-ASCII$'
tcpmodemsg1 db 'Binary$'
tcpbtpbost db ' from BOOTP host: $'
tcpbtpdhst db ' from DHCP host: $'
tcpbtprast db ' from RARP host: $'
tcpmssst db cr,lf,' tcp/ip mss: $'
endif ; no_tcp
badport db cr,lf,'?Port 25 is forbidden, sorry. Using 23 for Telnet.$'
maxsessions equ 6 ; max sessions, also in msntnd.c
seslist db maxsessions dup (-1) ; list of Telnet session idents, -1=dead
seshostlen equ 61 ; length of host name, asciiz
sesname db maxsessions*seshostlen dup (0) ; host names, asciiz.
sesport dw maxsessions dup (23) ; Telnet ports
sestime db maxsessions * 4 dup (0) ; start time dd, hh, mm, ss
sescur dw -1 ; Current session (0..5)
sesheader db cr,lf,' status session port hostname$'
sesinact db cr,lf,' inactive $'
sesactive db cr,lf,' active $'
curmsg db cr,lf,' current > $'
curinact db cr,lf,' inactive > $'
sesnone db cr,lf,' Error, all sessions are in use$'
sesnohost db cr,lf,' Oops, no host name is available$'
seshelp db cr,lf,lf,' choices R return to active session'
db cr,lf,' 1..6 pick a new or existing session'
db cr,lf,' N start a new session (default)'
db cr,lf,' Q quit this command'
db cr,lf
db cr,lf,'Choice> $'
endif ; no_network
data ends
data1 segment
ifndef no_network
nethlp db cr,lf,' node name of remote system,'
db cr,lf,' or press ENTER to use current name,'
db cr,lf,' or press ENTER for server mode (NetBios only).$'
dnethlp db cr,lf,' node name of remote system,'
db cr,lf,' or press ENTER to use current name,'
db cr,lf,' or * to see a list of LAT service names.$'
nethlp2 db cr,lf,' Optional LAT password, if using a LAT connection$'
ebhlp db 'Name of server port$'
setnbhlp2 db ' 1 - 14 letters or numbers (or nothing to quit): $'
telhlp db 'Internet address nnn.nnn.nnn.nnn$'
telhlp2 db 'Optional TCP port (default is 23)$'
ifndef no_tcp
tcphlp db cr,lf,' Host Internet name machine.domain or'
db ' Internet address nnn.nnn.nnn.nnn'
db cr,lf,' or * to become a Telnet server.'
db cr,lf,' Optional TCP port number and NEW or RESUME'
db ' may follow the host name.$'
tcpporthlp db cr,lf,' TCP port on host, 23 is Telnet, or'
tcpnewhlp db cr,lf,' NEW session or RESUME current session$'
endif ; no_tcp
endif ; no_network
fossilhlp db cr,lf,' Fossil port, 1..99. No Fossil checking is done!$'
hnghlp db cr,lf,' The modem control lines DTR and RTS for the current'
db ' port are forced low (off)'
db cr,lf,' to hangup the phone. Normally, Kermit leaves them'
db ' high (on) when it exits.',cr,lf
db ' For networks, the active session is terminated.',cr,lf,'$'
data1 ends
code1 segment
assume cs:code1
extrn iseof:far, tolowr:far, strcat:far
extern atsclr:near, setpos:near, setatch:near
extrn strcpy:far, strlen:far, prtasz:far, prtscr:far
extrn valout:far, domath:far, decout:far
ifndef no_tcp
ifndef no_terminal
extern termswapin:far, termswapdel:far, termswapout:far
endif ; no_terminal
endif ; no_tcp
fatsclr proc far
call atsclr
ret
fatsclr endp
fsetatch proc far
call setatch
ret
fsetatch endp
fsetpos proc far
call setpos
ret
fsetpos endp
code1 ends
code segment
extrn comnd:near, prompt:near, dopar:near, lclyini:near
extrn crun:near
ifndef no_terminal
extrn kbsusp:near, kbrest:near ; in msuibm.asm
endif ; no_terminal
assume cs:code, ds:data, es:nothing
foutchr proc far
call outchr
ret
foutchr endp
fdopar proc far
call dopar
ret
fdopar endp
; local initialization
lclini proc near
call pcwtst ; calibrate software timer
call pcwtst
mov flags.comflg,1 ; assume COM1 for communications port
call model ; get model of IBM machine
mov lclsusp,offset suspend ; call this when suspending to DOS
mov lclrest,offset restore ; call this when returning from DOS
mov lclexit,offset finexit ; call this when exiting Kermit
call getcodep ; get Code Page ident
call lclyini ; let other modules initialize too...
ret
lclini endp
; Call these routines when suspending Kermit to go to DOS
suspend proc near
ifndef no_terminal
call kbsusp ; DEC LK250 keyboard, set back to DOS mode
endif ; no_terminal
cmp flags.comflg,'t'; doing TCP?
je suspen1 ; e = yes, don't touch port
cmp portin,0 ; port initialized yet?
jle suspen1 ; l = no, e = yes but inactive
call ihosts ; suspend the host
mov ax,20 ; wait 20 millisec for port to finish
call pcwait
call serrst
suspen1:ret
suspend endp
; Call these routines when returning to Kermit from DOS
restore proc near
call getcodep ; reset Code Page ident
ifndef no_terminal
call kbrest ; DEC LK250 keyboard, set back to DEC mode
endif ; no_terminal
cmp flags.comflg,'t'; doing TCP?
je restor1 ; e = yes, don't touch port
cmp portin,0 ; port initialized yet?
jl restor1 ; l = no
call serini ; reinit serial port
call ihostr ; resume the host
restor1:ret
restore endp
; Call these routines when doing final exit of Kermit
finexit proc near
cmp flags.carrier,0 ; be concerned about CD?
je finex4 ; e = no
call testcd ; update cardet byte
test cardet,80h ; is carrier detect still active?
jnz finex3 ; nz = yes
finex4: cmp nettype,0 ; any network connections open?
je finex2 ; e = no, but go through the motions anyway
finex3: cmp flags.exitwarn,0 ; warn about active session?
je finex2 ; e = no, just kill the sessions
mov dx,offset clomsg ; say connection going, ask for permission
call prompt
mov dx,offset clotab ; table of choices
xor bx,bx ; help
mov ah,cmkey ; get keyword
call comnd
jc finex5 ; c = failure
push bx
mov ah,cmeol
call comnd
pop bx
jnc finex1 ; nc = got good response
finex5: ret ; return carry set to say don't close
finex1: or bx,bx ; ok to close
jz finex2 ; e = yes
stc ; carry set to say don't close
ret
finex2: call serrst ; reset serial port
ifndef no_network
call netclose ; close network connections
endif ; no_network
ifndef no_terminal
call kbsusp ; DEC LK250 keyboard, set back to DOS mode
endif ; no_terminal
clc ; return with permission to exit
ret
finexit endp
; The IBM PC's.
model proc near
mov isps2,0 ; PS/2 present indicator
push es
push ax ; get IBM model code
mov al,byte ptr es:[0fffeh] ; get model id byte
mov ah,0ch ; AT and PS/2 configuration call
xor al,al
int 15h ; IBM Bios
jc model4 ; c = no information
cmp word ptr es:[bx+2],040fch ; PS/2 model 50?
je model3 ; e = yes
cmp word ptr es:[bx+2],050fch ; PS/2 model 60?
je model3 ; e = yes
cmp byte ptr es:[bx+2],0f8h ; PS/2 model 80?
jne model4 ; ne = no
model3: mov isps2,1 ; say real PS/2 for IRQ setting
model4:
;;; [HF] 940130 The following section checks Japanese PS/55 mode
;;; [HF] 940130 moved from dvtest in MSYIBM.ASM
mov isps55,0 ; [HF] 940130 assume not PS/55
push ds
mov ax,ds ; preset es:si to start of data seg
mov es,ax ; as saftey factor after test
xor si,si
mov ax,6300h ; get Double Byte Char Set Lead Table
int dos ; returns ptr in ds:si
mov bx,ds ; cannot trust al as return status
mov es,bx
pop ds
mov ax,ds ; current DS
cmp ax,bx ; same seg?
je modelx ; e = yes, test failed
cmp word ptr es:[si],0 ; see if both bytes are also zeros
je modelx ; z = test failed
mov isps55,1 ; [HF] say Japanese PS/55 is active
mov ax,1402h ; [HF]940206 check the modeline status
int 16h ; [HF]940206 Keyboard Bios
mov ps55mod,al ; [HF]940206 save it in current status
mov byte ptr ps55mod+1,al ; [HF]940206 and in startup status
modelx: pop ax
pop es
ret
model endp
; Get the currently active Code Page ident into flags.chrset. User defined
; table overrides DOS report.
getcodep proc near
cmp flags.chrset,1 ; user-defined table in use?
je getcod1 ; e = yes
cmp flags.chrset,866 ; forced CP866 in use?
je getcod1 ; e = yes
mov flags.chrset,437 ; find default global char set
cmp dosnum,0300h+30 ; DOS version 3.30 or higher?
jb getcod1 ; b = no, no Code Pages
mov ax,6601h ; get global Code Page
int dos ; bx=active Code Page, dx=boot CP
jc getcod1
mov flags.chrset,bx ; setup default SET FILE CHAR SET
mov vtcpage,bx ; set terminal Code Page too
getcod1:ret
getcodep endp
; show the definition of a key. The terminal argument block (which contains
; the address and length of the definition tables) is passed in ax.
; Returns a string to print in AX, length of same in CX.
; Returns normally. Obsolete, name here for external reference only.
showkey proc near
ret ; return
showkey endp