-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathckoi31.c
2228 lines (2075 loc) · 78.4 KB
/
ckoi31.c
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
/* C K O I 3 1 . C -- IBM 31x1 Emulation */
/*
Author: Jeffrey Altman <jaltman@secure-endpoints.com>,
Secure Endpoints Inc., New York City.
Copyright (C) 1985, 2004, Trustees of Columbia University in the City of New
York.
*/
#include "ckcdeb.h"
#ifndef NOTERM
#ifdef NT
#include <windows.h>
#else /* NT */
#include <os2.h>
#undef COMMENT
#endif /* NT */
#include "ckcker.h"
#include "ckcasc.h"
#include "ckcuni.h"
#include "ckuusr.h"
#include "ckocon.h"
#include "ckoi31.h"
extern bool keyclick ;
extern int cursorena[], keylock, duplex, duplex_sav, screenon ;
extern int printon, aprint, uprint, xprint, cprint, seslog ;
extern int insertmode, tnlm ;
extern int escstate, debses, decscnm, tt_cursor ;
extern int tt_type, tt_type_mode, tt_max, tt_answer, tt_status[VNUM], tt_szchng[] ;
extern int tt_cols[], tt_rows[], tt_wrap ;
extern int wherex[], wherey[], margintop, marginbot ;
extern int marginbell, marginbellcol ;
extern char answerback[], htab[] ;
extern struct tt_info_rec tt_info[] ;
extern vtattrib attrib ;
extern unsigned char attribute;
extern char termessage[] ;
extern int autoscroll, protect ;
extern struct _vtG G[4];
extern struct _vtG *GL, *SSGL; /* GL and single shift GL */
extern struct _vtG *GR; /* GR */
extern int tcsl;
int i31_monitor = FALSE ;
int i31_xprint = 0;
int i31_lta = CR;
int
i31inc(void)
{
extern int pmask, cmask;
extern int tt_utf8;
int ch;
loop:
ch = ttinc(0);
if ( ch < 0 )
return ch;
if ( seslog )
logchar(ch);
/* Handle the UTF8 conversion if we are in that mode */
if ( tt_utf8 ) {
USHORT * ucs2 = NULL;
int rc = utf8_to_ucs2( (CHAR)(ch & 0xFF), &ucs2 );
if ( rc > 0 )
goto loop;
else if ( rc < 0 )
ch = 0xfffd;
else
ch = *ucs2;
}
if ( !xprint ) {
#ifndef NOXFER
autodown(ch);
#endif /* NOXFER */
autoexitchk(ch);
}
ch = ch & pmask & cmask;
debugses(ch);
if (printon && (is_xprint() || is_uprint()))
prtchar(ch);
return ch;
}
/* i31rdctrl - is used to read Set Control command sequences */
/* returns a bit flag of which parameters were received */
#define IBM_PA1 1
#define IBM_PA2 2
#define IBM_PA3 4
#define IBM_PA4 8
#define IBM_OP 16
#define GOT_PA1(x) (x & IBM_PA1)
#define GOT_PA2(x) (x & IBM_PA2)
#define GOT_PA3(x) (x & IBM_PA3)
#define GOT_PA4(x) (x & IBM_PA4)
#define GOT_OP(x) (x & IBM_OP)
#define BIT1 0x01
#define BIT2 0x02
#define BIT3 0x04
#define BIT4 0x08
#define BIT5 0x10
#define BIT6 0x20
#define BIT7 0x40
#define BIT8 0x80
int
i31rdctrl( int m, int * pa1, int * pa2, int * pa3, int * pa4, int * op )
{
int n=0;
int *p=NULL;
if ( m >= 1 ) {
*pa1 = i31inc();
if ( (*pa1) < 0 )
return(n);
n += IBM_PA1;
if ( m >= 2 ) {
if ( (*pa1 & 0x60) == 0x20 ) {
*pa2 = i31inc();
if ( (*pa2) < 0 )
return(n);
n += IBM_PA2;
}
if ( m >= 3 ) {
if ( (*pa2 & 0x60) == 0x20 ) {
*pa3 = i31inc();
if ( (*pa3) < 0 )
return(n);
n += IBM_PA3;
}
if ( m >= 4 ) {
if ( (*pa3 & 0x60) == 0x20 ) {
*pa4 = i31inc();
if ( (*pa4) < 0 )
return(n);
n += IBM_PA4;
}
}
}
}
/* Now take care of op */
switch ( m ) {
case 1:
p = pa1;
break;
case 2:
p = pa2;
break;
case 3:
p = pa3;
break;
case 4:
p = pa4;
break;
}
if ( (*p & 0x60) == 0x20 ) {
*op = i31inc();
if ( (*op) < 0 )
return(n);
n += IBM_OP;
}
}
return(n);
}
void
i31ctrl( int ch )
{
int i,j;
if ( !cprint && xprint ) {
switch ( ch ) {
case DLE: {
int nextch = i31inc() ;
switch ( nextch ) {
case DC2: /* Begin Transparent Print */
if ( debses )
break;
i31_xprint++;
if ( i31_xprint > 0 ) {
xprint = TRUE;
if ( !printon )
printeron();
}
/* Now that we have increased our counter, pass it on */
prtchar(ch);
prtchar(nextch);
break;
case DC4: /* End Transparent Print */
if ( debses )
break;
if ( i31_xprint > 0 )
i31_xprint--;
if ( !i31_xprint ) {
xprint = FALSE ;
if ( !uprint && !xprint && !cprint && !aprint && printon )
printeroff();
}
if ( i31_xprint > 0 ) {
/* we are not done yet, pass it on */
prtchar(ch);
prtchar(nextch) ;
}
break;
default:
prtchar(ch);
prtchar(nextch) ;
break;
}
break;
}
default:
prtchar(ch);
break;
}
} else {
switch ( ch ) {
case SOH:
break;
case STX:
break;
case ETX:
break;
case EOT:
break;
case ENQ: {
break;
}
case ACK:
break;
case BEL: /* Sound bell */
if ( debses )
break;
bleep(BP_BEL);
break;
case BS:
/* cursor left (backspace) */
if ( debses )
break;
cursorleft(0) ;
break;
case HT:
/* Tabulate cursor */
if ( debses )
break;
i = wherex[VTERM];
if (i < VscrnGetWidth(VTERM))
{
do {
i++;
cursorright(0);
} while ((htab[i] != 'T') &&
(i <= VscrnGetWidth(VTERM)-1));
VscrnIsDirty(VTERM);
}
break;
case LF:
/* cursor down; scroll */
if ( debses )
break;
wrtch(LF);
break;
case VT:
break;
case FF:
break;
case CR:
/* cursor to start of line */
if ( debses )
break;
wrtch(CR);
break;
case SO:
/* 3161- Select primary character set */
if ( debses )
break;
GL = &G[0] ;
break;
case SI:
/* 3161 - Select secondary character set */
if ( debses )
break;
GL = &G[1] ;
break;
case DLE: {
int nextch = i31inc() ;
switch ( nextch ) {
case STX:
if ( debses || i31_monitor )
break;
i31_monitor = TRUE ;
setdebses(TRUE);
break;
case ETX:
if ( !i31_monitor )
break;
i31_monitor = FALSE ;
setdebses(FALSE);
break;
case EOT:
if ( debses )
break;
strcpy( termessage, "Disconnected by host" ) ;
ttclos(0);
break;
case DC2: /* Begin Transparent Print */
if ( debses )
break;
i31_xprint++;
if ( i31_xprint > 0 ) {
xprint = TRUE;
if ( !printon )
printeron();
}
break;
case DC4: /* End Transparent Print */
if ( debses )
break;
if ( i31_xprint > 0 )
i31_xprint--;
if ( !i31_xprint ) {
xprint = FALSE ;
if ( !uprint && !xprint && !cprint && !aprint && printon )
printeroff();
}
break;
default:
i31ascii(nextch) ;
break;
}
break;
}
case DC1:
break;
case DC2:
break;
case DC3:
break;
case DC4:
break;
case NAK:
break;
case SYN:
break;
case ETB:
break;
case CAN:
break;
case XEM:
break;
case SUB:
break;
case ESC:
/* initiate escape sequence */
escstate = ES_GOTESC ;
break;
case XFS:
break;
case XGS:
break;
case XRS:
break;
case US:
break;
}
} /* xprint */
}
void
i31ascii( int ch )
{
int i,j,k,n,x,y,z;
vtattrib attr ;
viocell blankvcell;
int ch2=0, ch3=0, pa=0, pa1=0, pa2=0, pa3=0, pa4=0, op=0;
char response[32]="";
if ( escstate == ES_GOTESC )/* Process character as part of an escstate sequence */
{
/* should never be able to get here if xprint is active */
if ( ch < SP ) {
escstate = ES_NORMAL ;
i31ctrl(ch) ;
}
else
{
escstate = ES_ESCSEQ ;
switch ( ch ) {
case '!': {
ch2 = i31inc() ;
switch ( ch2 ) {
case '6':
/* 3161 - Send terminal ID */
if ( debses )
break;
/* send ESC ! 6 pa ESC 6 LTA */
break;
case '7':
/* 3161 - Read Control 2 */
/* Machine Status of the 3151 */
if ( debses )
break;
break;
case '8':
/* 3161 - Send cursor line */
if ( debses )
break;
break;
case '9': {
/* 3161 - Set Control 2 */
/* Machine Status of the 3151 */
if ( debses )
break;
n = i31rdctrl( 2, &pa1, &pa2, &pa3, &pa4, &op );
if ( debses || n == 0 )
break;
if ( GOT_OP(n) ) {
if ( (op & BIT7|BIT6) == 0x60 )
switch ( (op & 0x1F) ) {
case 0x00: /* Replacement (default) */
break;
case 0x01: /* Logical OR */
break;
case 0x02: /* Logical AND */
break;
case 0x1F: /* Interpreted as the DEL character */
break;
}
}
/* The following lines must be merged in to the above */
/* switch to enable the replace|and|or functionality */
if ( GOT_PA1(n) ) {
/* Forcing Insert Line */
if ( pa1 & 0x10 )
; /* Enabled */
else
; /* Disabled (default) */
/* Enter Key */
if ( pa1 & 0x08 )
; /* Works as the Return key (default) */
else
; /* Works as the Send key */
/* CRT Saver */
if ( pa1 & 0x03 )
; /* 15 minutes */
else
; /* No saver (default) */
}
if ( GOT_PA2(n) ) {
/* Forcing Insert Character */
if ( pa2 & 0x10 )
; /* Enabled */
else
; /* Disabled (default) */
/* Set Field Attribute (pa2 & 0x08) */
/* should always be 1 */
/* Operator Initiated Transparent Mode */
if ( pa2 & 0x03 )
; /* Disabled */
else
; /* Enabled (default) */
/* New Line */
if ( pa2 & 0x02 )
; /* Return key generates CR (default) */
else
; /* Return key generates CR/LF */
}
break;
}
case 'L':
/* 3161 - Clear all */
if ( debses )
break;
clrscreen( VTERM, NUL );
lgotoxy(VTERM,1,1); /* and home the cursor */
break;
case 'M':
/* Reverse Index command */
if ( debses )
break;
break;
case 'q':
/* 3161 - Select active partition */
/* Affects the viewport which local operator */
/* commands affect. Cursor moves to active partition */
pa = i31inc();
if ( debses )
break;
switch ( pa ) {
case 'A': /* viewport 1 */
break;
case 'B': /* viewport 2 */
break;
case 'C': /* viewport 3 */
break;
}
break;
case 's':
/* 3161 - Reset keyboard and clear modified */
/* data tag */
if ( debses )
break;
break;
case 'S':
/* Reset Keyboard Lock and MDT Bit Command */
if ( debses )
break;
break;
case '=': {
/* 3161 - Program function key definition */
int fn=0,fnx=0,ff=0;
char fp[128]="";
fn = i31inc();
if ( fn & (BIT5|BIT4|BIT3|BIT2|BIT1) == 0x00 )
fnx = i31inc();
ff = i31inc();
i = 0;
fp[i] = i31inc();
do {
fp[++i] = i31inc();
} while ( fp[i-1] != ESC && fp[i] != '=' && i<65 );
fp[i-1] = NUL;
if ( debses )
break;
/* The function key to be assigned is equal to */
/* (fn & (BIT5|BIT4|BIT3|BIT2|BIT1)) || */
/* (32 + (fnx & (BIT5|BIT4|BIT3|BIT2|BIT1))) */
/* (ff & BIT1) specifies whether the string is */
/* for local display (1) or remote transmission (0) */
break;
}
default:
escstate = ES_NORMAL ;
i31ascii(ch);
}
break;
}
case SP: {
ch2 = i31inc() ;
switch ( ch2 ) {
case ':':
/* Begin Outbound Trace mode */
if ( debses )
break;
cprint = TRUE;
if ( !printon )
printeron();
break;
case ';':
/* End Outbound Trace mode */
if ( debses || !cprint )
break;
cprint = FALSE;
if ( !uprint && !xprint && !cprint && !aprint && printon )
printeroff();
break;
case '1':
/* 3161 - Clear all tab stops */
if ( debses )
break;
for (j = 1; j <=MAXTERMCOL; ++j)
htab[j] = '0';
break;
case '6':
/* 3161 - Send model */
if ( debses )
break;
/* send ESC SP 6 pa LTA */
break;
case '7':
/* 3161 - Read Control 1 (6-15) */
/* Machine and Operating Modes */
if ( debses )
break;
pa1 = 0x81; /* 3151 and Character */
sprintf(response,"%c 7%c%c",
ESC,pa1,i31_lta);
ttol(response,strlen(response));
break;
case '8':
/* 3161 - Send message */
if ( debses )
break;
break;
case '9':
/* 3161 - Set Control 1 (6-15) */
/* Machine and Operating Modes */
n = i31rdctrl( 2, &pa1, &pa2, &pa3, &pa4, &op );
if ( debses || n == 0 )
break;
if ( GOT_OP(n) ) {
if ( (op & BIT7|BIT6) == 0x60 )
switch ( (op & 0x1F) ) {
case 0x00: /* Replacement (default) */
break;
case 0x01: /* Logical OR */
break;
case 0x02: /* Logical AND */
break;
case 0x1F: /* Interpreted as the DEL character */
break;
}
}
/* The following lines must be merged in to the above */
/* switch to enable the replace|and|or functionality */
if ( GOT_PA1(n) ) {
/* Machine Mode */
switch ( (pa1 & 0x1C) ) {
case 0x00: /* IBM 3151 (default) */
break;
case 0x04: /* IBM 3101 */
break;
case 0x08: /* ADM-3A */
break;
case 0x0C: /* ADM-5 */
break;
case 0x10: /* ADDS VP A2 */
break;
case 0x14: /* HZ-1500 */
break;
case 0x18: /* TVI-910+ */
break;
case 0x1C: /* use pa2 */
if ( GOT_PA2(n) ) {
switch ( (pa2 & 0x0F) ) {
case 0x00: /* TVI-925E */
break;
case 0x01: /* TVI-920/912 */
break;
}
}
break;
}
/* Operating Mode */
switch ( (pa1 & 0x03) ) {
case 0x00: /* Echo */
break;
case 0x01: /* Character */
break;
case 0x02: /* Block (default) */
break;
case 0x03: /* Reserved */
break;
}
}
break;
case 'M':
/* Index command */
if ( debses )
break;
break;
case 'q':
/* 3161 - Select host partition */
/* Specifies partition that host data is written to */
pa = i31inc();
if ( debses )
break;
switch ( pa ) {
case 'A': /* viewport 1 */
break;
case 'B': /* viewport 2 */
break;
case 'C': /* viewport 3 */
break;
}
break;
case 'r': {
/* 3161 - Create Viewport */
char cmd[16]="";
ch3 = i31inc();
switch ( ch3 ) {
case '!': /* one viewport */
for ( i=0;i<5;i++ )
cmd[i] = i31inc();
cmd[i] = NUL;
break;
case '"': /* two viewports */
for ( i=0;i<10;i++ )
cmd[i] = i31inc();
cmd[i] = NUL;
break;
case '#': /* three viewports */
for ( i=0;i<15;i++ )
cmd[i] = i31inc();
cmd[i] = NUL;
break;
}
if ( debses )
break;
switch ( ch3 ) {
case '!': /* one viewport */
if ( !strcmp(cmd,"! 8\"P") ) {
; /* 24 lines, 80 cols */
}
else if ( !strcmp(cmd,"! 9\"P" ) ) {
; /* 25 lines, 80 cols */
}
else if ( !strcmp(cmd,"! 8$D" ) ) {
; /* 24 lines, 132 cols */
}
else if ( !strcmp(cmd,"! 9$D" ) ) {
; /* 25 lines, 132 cols */
}
break;
case '"': /* two viewports */
if ( cmd[3] == '"' && cmd[4] == '0' &&
cmd[8] == '"' && cmd[9] == 'P') {
/* 80 columns */
/* height of viewport 1 is (cmd[2]-'!'+1) */
/* height of viewport 2 is (cmd[7]-'!'+1) */
/* sum of heights must equal 24 or 25 */
}
else if ( cmd[3] == '$' && cmd[4] == '$' &&
cmd[8] == '$' && cmd[9] == 'D') {
/* 132 columns */
/* height of viewport 1 is (cmd[2]-'!'+1) */
/* height of viewport 2 is (cmd[7]-'!'+1) */
/* sum of heights must equal 24 or 25 */
}
break;
case '#': /* three viewports */
if ( cmd[3] == '"' && cmd[4] == '0' &&
cmd[8] == '"' && cmd[9] == '0' &&
cmd[13] == '"' && cmd[14] == 'P') {
/* 80 columns */
/* height of viewport 1 is (cmd[2]-'!'+1) */
/* height of viewport 2 is (cmd[7]-'!'+1) */
/* height of viewport 3 is (cmd[12]-'!'+1) */
/* sum of heights must equal 24 or 25 */
}
else if ( cmd[3] == '$' && cmd[4] == '$' &&
cmd[8] == '$' && cmd[9] == '$' &&
cmd[13] == '$' && cmd[14] == 'D') {
/* 132 columns */
/* height of viewport 1 is (cmd[2]-'!'+1) */
/* height of viewport 2 is (cmd[7]-'!'+1) */
/* height of viewport 3 is (cmd[12]-'!'+1) */
/* sum of heights must equal 24 or 25 */
}
break;
}
break;
}
case 'S':
/* 3161 - Reset to initial state */
if ( debses )
break;
doreset(1) ;
break;
case 't':
/* 3161 - Default all function keys */
if ( debses )
break;
udkreset() ;
break;
case 'W':
/* 3161 - Print screen */
if ( debses )
break;
break;
case 'Z':
/* 3161 - Reset buffer address mode to cursor addr mode */
if ( debses )
break;
break;
default:
escstate = ES_NORMAL ;
i31ascii(ch);
}
break;
}
case '"': {
ch2 = i31inc() ;
switch ( ch2 ) {
case ':':
/* Enable Write Null */
if ( debses )
break;
break;
case ';':
/* Disable Write Null */
if ( debses )
break;
break;
case '6':
/* Extended Read Model Command */
if ( debses )
break;
/* send ESC " 6 pa1 pa2 pa3 pa4 pa5 LTA */
break;
case '7':
/* 3161 - Read Control 3 */
/* Display functions of the 3151 */
if ( debses )
break;
break;
case '9':
/* 3161 - Set Control 3 */
/* Display functions of the 3151 */
n = i31rdctrl( 2, &pa1, &pa2, &pa3, &pa4, &op );
if ( debses || n == 0 )
break;
if ( GOT_OP(n) ) {
if ( (op & BIT7|BIT6) == 0x60 )
switch ( (op & 0x1F) ) {
case 0x00: /* Replacement (default) */
break;
case 0x01: /* Logical OR */
break;
case 0x02: /* Logical AND */
break;
case 0x1F: /* Interpreted as the DEL character */
break;
}
}
/* The following lines must be merged in to the above */
/* switch to enable the replace|and|or functionality */
if ( GOT_PA1(n) ) {
/* Scroll (temporary) */
switch ( pa1 & 0x18 ) {
case 0x00: /* No scroll */
break;
case 0x08: /* Jump scroll (default) */
break;
case 0x10: /* Smooth scroll */
break;
case 0x11: /* Reserved */
break;
}
/* Line Wrap */
if ( pa1 & 0x04 )
; /* On (default) */
else
; /* Off */
/* Auto LF */
if ( pa1 & 0x02 )
; /* On (default) */
else
; /* Off */
/* ASCII LF Character */
if ( pa1 & 0x01 )
; /* New line */
else
; /* Line feed (default) */
}
if ( GOT_PA2(n) ) {
/* Scroll (permanently) */
switch ( pa2 & 0x18 ) {
case 0x00: /* No scroll */
break;
case 0x08: /* Jump scroll (default) */
break;
case 0x10: /* Smooth scroll */
break;
case 0x11: /* Reserved */
break;
}
/* Insert Character */
if ( pa2 & 0x04 )
; /* Inserts a space character */
else
; /* Sets insert mode (default) */
/* Tab */
if ( pa2 & 0x02 )
; /* Column Tab */
else
; /* Field Tab (default) */
/* Return Key */
if ( pa1 & 0x01 )
; /* New Line */
else
; /* Field (default) */
}
break;
case 'A':
/* 3161 - Jump partition */
/* Selects next viewport as active partition */
if ( debses )
break;
break;
default:
escstate = ES_NORMAL ;
i31ascii(ch);
}
break;
}
case '#': {
ch2 = i31inc() ;
switch ( ch2 ) {
case ';':
/* Display Host Message stored in OIA buffer */
if ( debses )
break;
break;
case ':':
/* Display Machine Status */
if ( debses )
break;
break;
case '7':
/* 3161 - Read Control 4 */
/* Send parameters of the 3151 */
if ( debses )
break;
break;
case '8':
/* 3161 - Send all */
if ( debses )
break;
break;
case '9':
/* 3161 - Set Control 4 */
/* Send parameters of the 3151 */
n = i31rdctrl( 1, &pa1, &pa2, &pa3, &pa4, &op );
if ( debses || n == 0 )
break;
if ( GOT_OP(n) ) {
if ( (op & BIT7|BIT6) == 0x60 )
switch ( (op & 0x1F) ) {
case 0x00: /* Replacement (default) */
break;
case 0x01: /* Logical OR */
break;
case 0x02: /* Logical AND */
break;
case 0x1F: /* Interpreted as the DEL character */
break;
}
}
/* The following lines must be merged in to the above */
/* switch to enable the replace|and|or functionality */
if ( GOT_PA1(n) ) {
/* Send Line */
if ( pa1 & 0x08 )
; /* Send key works as Send Line key */
/* and Send Line key works as Send key */
else
; /* Send key works as Send key and */
/* Send Line key works as Send Line key */
/* (default) */
/* Send Null Suppress */
if ( pa1 & 0x04 )
; /* On (default) */
else
; /* Off */
/* Lock Keyboard and Keep MDT Bit */
if ( pa1 & 0x02 )
; /* On */
else
; /* Off (default) */
/* Send Data Format */
if ( pa1 & 0x01 )
; /* AID LTA */
else
; /* Text LTA (default) */
}
break;
default:
escstate = ES_NORMAL ;
i31ascii(ch);
}
break;