-
Notifications
You must be signed in to change notification settings - Fork 0
/
ckodg.c
1784 lines (1683 loc) · 61.2 KB
/
ckodg.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 D G . C -- Data General Emulation */
/*
Author: Jeffrey Altman <[email protected]>,
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 "ckuusr.h"
#include "ckcxla.h"
#include "ckuxla.h"
#include "ckcuni.h"
#include "ckocon.h"
#include "ckodg.h"
#ifdef NETCONN
#ifdef TCPSOCKET
#include "ckcnet.h"
extern int network, nettype, ttnproto, u_binary;
#endif /* TCPSOCKET */
#endif /* NETCONN */
extern bool keyclick ;
extern int cursorena[], keylock, duplex, duplex_sav, screenon ;
extern int printon, aprint, uprint, cprint, xprint, seslog ;
extern int insertmode, tnlm ;
extern int escstate, debses, decscnm, tt_cursor;
extern int tt_type, tt_type_mode, tt_type_vt52, 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, parity, cmask ;
extern int wy_monitor;
extern char answerback[], htab[] ;
extern struct tt_info_rec tt_info[] ;
extern vtattrib attrib ;
extern unsigned char attribute;
extern int autoscroll, protect ;
extern CHAR (*xls[MAXTCSETS+1][MAXFCSETS+1])(CHAR); /* Character set xlate */
extern CHAR (*xlr[MAXTCSETS+1][MAXFCSETS+1])(CHAR); /* functions. */
extern struct csinfo fcsinfo[]; /* File character set info */
extern int tcsr, tcsl; /* Terminal character sets, remote & local. */
extern struct _vtG G[4];
extern struct _vtG *GL, *SSGL ; /* GL and single shift GL */
extern struct _vtG *GR; /* GR */
extern struct _vtG *GNOW;
int dgunix = FALSE ; /* DG Unix mode */
int dgunix_usr = FALSE;
static unsigned char escchar=XRS;/* Remember which was used to enter GOTESC */
unsigned char
charset( enum charsetsize size, unsigned short achar, struct _vtG * pG );
extern int ttpush;
int
dginc(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);
}
if ( !xprint )
ch = ch & pmask & cmask;
debugses(ch);
if (printon && (is_xprint() || is_uprint()))
prtchar(ch);
return ch;
}
static char
int2unixhex( int n )
{
char c;
switch ( n ) {
case 0: c = '0'; break;
case 1: c = '1'; break;
case 2: c = '2'; break;
case 3: c = '3'; break;
case 4: c = '4'; break;
case 5: c = '5'; break;
case 6: c = '6'; break;
case 7: c = '7'; break;
case 8: c = '8'; break;
case 9: c = '9'; break;
case 10: c = 'A'; break;
case 11: c = 'B'; break;
case 12: c = 'C'; break;
case 13: c = 'D'; break;
case 14: c = 'E'; break;
case 15: c = 'F'; break;
default: c = '0';
}
return c;
}
static int
unixhex2int( char c )
{
int n=-1;
switch ( c ) {
case '0': n = 0; break;
case '1': n = 1; break;
case '2': n = 2; break;
case '3': n = 3; break;
case '4': n = 4; break;
case '5': n = 5; break;
case '6': n = 6; break;
case '7': n = 7; break;
case '8': n = 8; break;
case '9': n = 9; break;
case 'A': case 'a': n = 10; break;
case 'B': case 'b': n = 11; break;
case 'C': case 'c': n = 12; break;
case 'D': case 'd': n = 13; break;
case 'E': case 'e': n = 14; break;
case 'F': case 'f': n = 15; break;
}
return n;
}
int
dgcmd2int( char arg1, char arg2, char arg3 )
{
int n = 0;
if ( dgunix ) {
n += unixhex2int(arg1) * 256;
n += unixhex2int(arg2) * 16;
n += unixhex2int(arg3);
}
else {
n += (arg1 & 0x0F) * 256;
n += (arg2 & 0x0F) * 16;
n += (arg3 & 0x0F);
}
return n;
}
void
dgint2cmd( int n, char * arg1, char * arg2, char * arg3 )
{
if ( dgunix ) {
n %= 4096; /* max DG-Hex value */
*arg1 = int2unixhex(n/256);
n %= 256 ;
*arg2 = int2unixhex(n/16);
n %= 16 ;
*arg3 = int2unixhex(n);
}
else {
n %= 4096; /* max DG-Hex value */
*arg1 = '0' + n / 256;
n %= 256 ;
*arg2 = '0' + n / 16;
n %= 16 ;
*arg3 = '0' + n;
}
}
int
dgloc2int( char arg1, char arg2, char arg3 )
{
int n = 0 ;
if ( dgunix ) {
n += unixhex2int(arg1) * 256;
n += unixhex2int(arg2) * 16;
n += unixhex2int(arg3);
}
else {
n += (arg1 - '@')%32 * 1024;
n += (arg2 - '@')%32 * 32;
n += (arg3 - '@')%32 ;
}
return n;
}
void
dgint2loc( int n, char * arg1, char * arg2, char * arg3 )
{
if ( dgunix ) {
n %= 3072; /* max DG-Location value */
*arg1 = int2unixhex(n/256);
n %= 256 ;
*arg2 = int2unixhex(n/16);
n %= 16 ;
*arg3 = int2unixhex(n);
}
else {
n %= 3072; /* max DG-Location value */
*arg1 = '@' + n / 1024;
n %= 1024 ;
*arg2 = '@' + n / 32;
n %= 32 ;
*arg3 = '@' + n;
}
}
void
dgctrl( int ch )
{
int i,j;
if ( !xprint ) {
if (printon && is_uprint())
prtchar(ch);
switch ( ch ) {
case SOH:
/* Print all unprotected characters */
debug(F110,"Data General","SOH",0);
prtscreen( VTERM, wherey[VTERM], VscrnGetHeight(VTERM)-(tt_status[VTERM]?1:0));
sendchar(ACK);
break;
case STX:
/* Reverse off */
debug(F110,"Data General","STX",0);
if ( debses )
break;
attrib.reversed = FALSE ;
break;
case ETX:
debug(F110,"Data General","ETX",0);
/* Blink Enable */
break;
case EOT:
debug(F110,"Data General","EOT",0);
/* Blink Disable */
break;
case ENQ: {
/* Report cursor address */
debug(F110,"Data General","ENQ",0);
if ( debses || dgunix )
break;
sendchar(US);
sendchar(wherex[VTERM]-1);
sendchar(wherey[VTERM]-1);
break;
}
case ACK:
debug(F110,"Data General","ACK",0);
break;
case BEL:
debug(F110,"Data General","BEL",0);
if ( debses )
break;
bleep(BP_BEL);
break;
case BS:
debug(F110,"Data General","BS",0);
if ( !dgunix ) {
/* Home Cursor */
if ( debses )
break;
lgotoxy( VTERM, 1, 1 ) ;
} else {
/* Backspace */
if ( debses )
break;
if ( wherex[VTERM] > 1 )
cursorleft(0);
}
break;
case HT:
debug(F110,"Data General","HT",0);
if ( debses )
break;
i = wherex[VTERM];
if (i < VscrnGetWidth(VTERM))
{
do {
i++;
cursorright(0);
} while ( (dgunix ? (wherex[VTERM]%8) : ((htab[i] != 'T'))) &&
(i <= VscrnGetWidth(VTERM)-1));
VscrnIsDirty(VTERM);
}
break;
case LF:
/* Cursor to start on next line */
debug(F110,"Data General","LF",0);
if ( debses )
break;
if ( dgunix )
{
wrtch((CHAR)LF);
}
else if ( autoscroll ||
wherey[VTERM] < VscrnGetHeight(VTERM)-(tt_status[VTERM]?1:0) ) {
wrtch((CHAR)CR);
wrtch((CHAR)LF);
}
else { /* Home Cursor */
lgotoxy( VTERM, 1, 1 ) ;
}
break;
case VT: /* Erase Field */
debug(F110,"Data General","VT",0);
if ( debses || dgunix )
break;
clrtoeoln( VTERM, SP ) ;
break;
case FF:
debug(F110,"Data General","FF",0);
if ( debses || dgunix )
break;
clrscreen(VTERM,SP);
lgotoxy(VTERM,1,1); /* and home the cursor */
attrib.blinking = FALSE;
attrib.underlined = FALSE;
attrib.reversed = FALSE;
attrib.dim = FALSE;
break;
case CR:
debug(F110,"Data General","CR",0);
if ( debses )
break;
wrtch((char) CR);
break;
case SO:
debug(F110,"Data General","SO",0);
if ( debses )
break;
if ( dgunix )
GL = &G[1];
else
attrib.blinking = TRUE ;
break;
case SI:
debug(F110,"Data General","SI",0);
if ( debses )
break;
if ( dgunix )
GL = &G[0];
else
attrib.blinking = FALSE ;
break;
case DLE: {
/* Address cursor in current page */
int col, line ;
debug(F110,"Data General","DLE",0);
col = dginc();
#ifdef NETCONN
#ifdef TCPSOCKET
if ( network && IS_TELNET() && !TELOPT_U(TELOPT_BINARY) && col == CR ) {
/* Handle TELNET CR-NUL or CR-LF if necessary */
int dummy = ttinc(0);
debug(F111,"Data General","Addr cursor in page found CR",dummy);
if ( dummy != NUL )
ttpush = dummy;
}
#endif /* TCPSOCKET */
#endif /* NETCONN */
line = dginc();
#ifdef COMMENT
#ifdef NETCONN
#ifdef TCPSOCKET
if ( network && IS_TELNET() && !TELOPT_U(TELOPT_BINARY) && line == CR ) {
/* Handle TELNET CR-NUL or CR-LF if necessary */
int dummy = ttinc(0);
debug(F111,"Data General","Addr cursor in page found CR",dummy);
if ( dummy != NUL )
ttpush = dummy;
}
#endif /* TCPSOCKET */
#endif /* NETCONN */
#endif /* COMMENT */
if ( debses )
break;
if ( col == 127 )
col = wherex[VTERM] - 1;
if ( line == 127 )
line = wherey[VTERM] - 1;
lgotoxy(VTERM,col+1,line+1);
break;
}
case DC1: {
/* Print - current line to end of screen */
/* Send Ctrl-F ACK when print is complete */
debug(F110,"Data General","DC1",0);
if ( debses || dgunix )
break;
debug(F110,"Data General","Print current line to end of screen",0);
prtscreen( VTERM, wherey[VTERM], VscrnGetHeight(VTERM)-(tt_status[VTERM]?1:0));
sendchar(ACK);
break;
}
case DC2:
debug(F110,"Data General","DC2",0);
if ( debses )
break;
autoscroll = TRUE ;
break;
case DC3:
debug(F110,"Data General","DC3",0);
if ( debses || dgunix )
break;
autoscroll = FALSE ;
break;
case DC4:
debug(F110,"Data General","DC4",0);
if ( debses )
break;
attrib.underlined = TRUE ;
break;
case NAK:
debug(F110,"Data General","NAK",0);
if ( debses )
break;
attrib.underlined = FALSE ;
break;
case SYN:
debug(F110,"Data General","SYN",0);
if ( debses )
break;
attrib.reversed = TRUE ;
break;
case ETB:
debug(F110,"Data General","ETB",0);
if ( debses || dgunix )
break;
cursorup(0);
break;
case CAN:
debug(F110,"Data General","CAN",0);
if ( debses || dgunix )
break;
cursorright(0);
break;
case XEM:
debug(F110,"Data General","EM",0);
if ( debses || dgunix )
break;
cursorleft(0);
break;
case SUB:
debug(F110,"Data General","SUB",0);
if ( debses || dgunix )
break;
cursordown(0);
break;
case ESC:
/* We will treat RS and ESC to be equivalent for our purposes */
/* initiate escape sequence */
debug(F110,"Data General","ESC",0);
escstate = ES_GOTESC ;
escchar = ESC;
break;
case XFS:
debug(F110,"Data General","FS",0);
if ( debses )
break;
attrib.dim = TRUE ;
break;
case XGS:
debug(F110,"Data General","GS",0);
if ( debses )
break;
attrib.dim = FALSE ;
break;
case XRS:
/* This appears to be the beginning of escape character on the DG series */
/* We will treat RS and ESC to be equivalent for our purposes */
/* initiate escape sequence */
debug(F110,"Data General","RS",0);
escstate = ES_GOTESC ;
escchar = XRS;
break;
case US:
debug(F110,"Data General","US",0);
break;
}
}
else { /* xprint */
switch ( ch ) {
case ESC:
/* We will treat RS and ESC to be equivalent for our purposes */
/* initiate escape sequence */
escstate = ES_GOTESC ;
escchar = ESC;
break;
case XRS:
/* This appears to be the beginning of escape character on the DG series */
/* We will treat RS and ESC to be equivalent for our purposes */
/* initiate escape sequence */
escstate = ES_GOTESC ;
escchar = XRS;
break;
default:
if (printon && is_uprint())
prtchar(ch);
}
}
}
void
dgascii( int ch )
{
int i,j,k,n,x,y,z;
vtattrib attr ;
viocell blankvcell;
char arg1, arg2, arg3, arg4, arg5;
if ( escstate == ES_GOTESC )/* Process character as part of an escstate sequence */
{
if ( ch < SP ) {
escstate = ES_NORMAL ;
dgctrl(ch) ;
}
else
{
escstate = ES_ESCSEQ ;
if ( !xprint ) {
/* We don't print escape sequences */
switch ( ch ) {
case '"':
/* Unlock Keyboard */
debug(F110,"Data General","Unlock Keyboard",0);
if ( debses )
break;
keylock = FALSE ;
break;
case '#':
/* Lock Keyboard */
debug(F110,"Data General","Lock Keyboard",0);
if ( debses )
break;
keylock = TRUE ;
break;
case 'A':
/* DG411 - Set Foreground Color */
debug(F110,"Data General","Set Foreground Color",0);
arg1 = dginc();
if ( debses )
break;
break;
case 'C': {
/* Send Terminal ID */
/* RS o # <m> <x> <y> */
/* <m> = model: d217 '5'; d413/d463 '6' */
/* <x> = bits 01TC PRRR */
/* T - 0:self test passed; 1:errors */
/* C - 0:7bit; 1:8bit */
/* P - 0:no printer; 1:printer */
/* R - 3bit revision number */
/* <y> = bits 01GK LLLL */
/* G - 0:no graphics; 1:graphics */
/* K - 0:no keyboard; 1:keyboard */
/* L - keyboard mode (1001 - US) */
char response[7];
if ( debses )
break;
response[0] = XRS;
response[1] = 'o';
response[2] = '#';
switch ( tt_type_mode ) {
case TT_DG200:
response[3] = '!';
break;
case TT_DG210:
response[3] = '(';
break;
case TT_DG217:
response[3] = '5';
break;
#ifdef COMMENT
case TT_DG413:
case TT_DG463:
response[3] = '6';
break;
#endif /* COMMENT */
}
if ( cmask == 0177 )
response[4] = 0x48 | 0x03; /* 7-bit; printer */
else
response[4] = 0x58 | 0x03; /* 8-bit; printer */
response[5] = 0x59; /* keyboard; US */
response[6] = '\0';
debug(F110,"Data General Read Model ID",response,0);
sendchars(response,6);
break;
}
case 'D':
debug(F110,"Data General","Reverse On",0);
if ( debses )
break;
attrib.reversed = TRUE ;
break;
case 'E':
debug(F110,"Data General","Reverse Off",0);
if ( debses )
break;
attrib.reversed = FALSE ;
break;
case 'F': {
ch = dginc() ;
switch ( ch ) {
case '?': {
ch = dginc() ;
if ( debses )
break;
switch ( ch ) {
case ':': /* Print Screen */
debug(F110,"Data General","Print Screen",0);
prtscreen( VTERM, 1, VscrnGetHeight(VTERM)-(tt_status[VTERM]?1:0));
sendchar(ACK);
break;
case '0':
debug(F110,"Data General 4xx","Simulprint Off",0);
break;
case '1':
debug(F110,"Data General 4xx","Simulprint On",0);
break;
case '2':
debug(F110,"Data General","Xprint Off",0);
xprint = FALSE ;
if ( !uprint && !xprint && !aprint && printon )
printeroff();
sendchar(ACK);
break;
case '3':
debug(F110,"Data General","Xprint On",0);
xprint = TRUE;
printeron();
break;
case '5':
debug(F110,"Data General 4xx","Window Bit Dump",0);
break;
case '6':
debug(F110,"Data General 4xx","Form Bit Dump",0);
break;
case '7': /* VT220 AutoPrint off */
debug(F110,"Data General","Aprint Off",0);
setaprint(FALSE);
if ( !uprint && !xprint && !aprint && printon )
printeroff();
sendchar(ACK);
case '8': /* VT220 AutoPrint on */
debug(F110,"Data General","Aprint On",0);
setaprint(TRUE);
printeron();
break;
case '9': /* DG UNIX - Print Window */
if ( dgunix ) {
/* Print - current line to end of screen */
/* Send Ctrl-F ACK when print is complete */
debug(F110,"Data General",
"Print current line to end of screen",0);
prtscreen( VTERM, wherey[VTERM],
VscrnGetHeight(VTERM)-(tt_status[VTERM]?1:0));
sendchar(ACK);
}
break;
}
break;
}
case ';': {
/* Data Trap Mode */
int cmd = dginc();
debug(F111,"Data General","Data Trap Mode",cmd);
switch ( cmd ) {
case 'T':
if ( wy_monitor )
break;
setdebses(FALSE);
break;
case 'H':
case 'O':
case DEL:
if ( debses || wy_monitor )
break;
setdebses(TRUE);
wy_monitor = TRUE ;
break;
}
}
case '~': {
/* Switch Emulations */
int emulation = 0 ;
char response[5] = "";
arg1 = '0';
arg2 = dginc();
arg3 = dginc();
emulation = dgcmd2int( arg1, arg2, arg3 );
debug(F111,"Data General","Switch Emulation",emulation);
if ( debses )
break;
response[0] = XRS;
response[1] = 'o';
response[2] = '~';
switch ( emulation ) {
case 0x00: /* DG Native mode */
response[3] = '1';
break;
case 0x08: /* VT52 mode */
tt_type_vt52 = tt_type_mode;
tt_type_mode = TT_VT52;
response[3] = '1';
ipadl25();
break;
case 0x09: /* VT100 mode */
tt_type_mode = TT_VT102;
response[3] = '1';
ipadl25();
break;
case 0x0C: /* VT320 mode */
tt_type_mode = TT_VT320;
response[3] = '1';
ipadl25();
break;
case 0x10: /* Tektronix 4010 */
response[3] = '0';
ipadl25();
break;
}
response[4] = '\0';
debug(F110,"Data General Switch Emulation Mode",response,0);
sendchars( response, 4 );
break;
}
case '{': {
/* Set Model ID */
int model = 0 ;
int graphics = 0;
arg1 = '0';
arg2 = dginc();
arg3 = dginc();
model = dgcmd2int( arg1, arg2, arg3 );
arg2 = '0';
arg3 = dginc();
graphics = dgcmd2int( arg1, arg2, arg3 );
debug(F110,"Data General Set Model ID","not supported",0);
if ( debses )
break;
break;
}
case '7': {
/* Select Printer National Character Set */
int lang;
arg1 = '0';
arg2 = dginc();
arg3 = dginc();
lang = dgcmd2int( arg1, arg2, arg3 );
debug(F101,"Data General Select Printer National CS","",lang);
if ( debses )
break;
break;
}
case '8':
debug(F110,"Data General 4xx","Display Character Generator Contents",0);
if ( debses )
break;
break;
case '9':
debug(F110,"Data General 4xx","Fill Screen with Grid",0);
if ( debses )
break;
break;
case '<':
debug(F110,"Data General 4xx","DG411 - Perform Uart Loopback Test",0);
if ( debses )
break;
break;
case '>':
debug(F110,"Data General 4xx","Fill Screen with Character",0);
arg1 = dginc();
if ( debses )
break;
break;
case '@':
debug(F110,"Data General 4xx","Select ANSI mode",0);
break;
case 'A':
debug(F110,"Data General 4xx","Reset",0);
if ( debses )
break;
doreset(1);
break;
case 'B':
debug(F110,"Data General 4xx","Set Windows",0);
/* <row count><normal>...<row count><normal>
* how do we know when the sequence ends?
*/
arg1 = dginc();
break;
case 'C': {
/* Scroll Left - Pan Right */
viocell cell ;
debug(F110,"Data General 4xx","Scroll Left",0);
arg1 = dginc(); /* Column count */
if ( debses )
break;
cell.c = SP ;
cell.a = geterasecolor(VTERM) ;
if ( arg1 == 0 )
arg1 = 1 ;
else if ( arg1 > VscrnGetWidth(VTERM)-1 )
arg1 = VscrnGetWidth(VTERM)-1 ;
VscrnScrollLf( VTERM,
0,
0,
VscrnGetHeight(VTERM)
-(tt_status[VTERM]?2:1),
VscrnGetWidth(VTERM)-1,
arg1,
cell);
break;
}
case 'D': {
/* Scroll Right - Pan Left */
viocell cell ;
debug(F110,"Data General 4xx","Scroll Right",0);
arg1 = dginc(); /* Column count */
if ( debses )
break;
cell.c = SP ;
cell.a = geterasecolor(VTERM) ;
if ( arg1 == 0 )
arg1 = 1 ;
else if ( arg1 > VscrnGetWidth(VTERM)-1 )
arg1 = VscrnGetWidth(VTERM)-1 ;
VscrnScrollRt( VTERM,
0,
0,
VscrnGetHeight(VTERM)
-(tt_status[VTERM]?2:1),
VscrnGetWidth(VTERM)-1,
arg1,
cell);
break;
}
case 'E':
debug(F110,"Data General 4xx","Erase Screen",0);
if ( debses )
break;
clrscreen(VTERM, SP);
break;
case 'F':
/* D413 Clear Unprotected (cursor to EOS) */
debug(F110,"Data General 4xx","Erase Unprotected",0);
if ( debses )
break;
if ( protect )
selclreoscr_escape(VTERM, SP);
else
clreoscr_escape(VTERM, SP);
break;
case 'G':
debug(F110,"Data General 4xx","Screen Home",0);
break;
case 'H':
debug(F110,"Data General 4xx","Insert Line",0);
break;
case 'I':
debug(F110,"Data General 4xx","Delete Line",0);
break;
case 'J':
debug(F110,"Data General 4xx","Select Normal Spacing",0);
break;
case 'K':
debug(F110,"Data General 4xx","Select Compressed Spacing",0);
break;
case 'L':
debug(F110,"Data General 4xx","Protect On",0);
if ( debses )
break;
attrib.unerasable = TRUE;
break;
case 'M':
debug(F110,"Data General 4xx","Protect Off",0);
if ( debses )
break;
attrib.unerasable = FALSE;
break;
case 'N': {
/* D413 Change Attributes <nnn> <n> <n> */
int chars = 0 ;
int toset = 0 ;
int toreset = 0;
debug(F110,"Data General 4xx","Change Attributes",0);
arg1 = dginc();
arg2 = dginc();
arg3 = dginc();
chars = dgcmd2int( arg1, arg2, arg3 );
arg1 = '0';
arg2 = '0';
arg3 = dginc();
toset = dgcmd2int( arg1, arg2, arg3 );
arg3 = dginc();
toreset = dgcmd2int( arg1, arg2, arg3 );
if ( debses )
break;
break;
}
case 'O':
debug(F110,"Data General 4xx","Read Horizontal Scroll Offset",0);
break;
case 'P': {
/* Write Screen Address <nn> <nn> */
int col=0, row=0;
arg1 = '0';
arg2 = dginc();
arg3 = dginc();
col = dgcmd2int( arg1, arg2, arg3 );
arg2 = dginc();
arg3 = dginc();
row = dgcmd2int( arg1, arg2, arg3 );
debug(F110,"Data General","Write Screen Address",0);
if ( debses )
break;
if ( col == 255 )
col = wherex[VTERM] - 1 ;
if ( row == 255 )
row = wherey[VTERM] - 1 ;
lgotoxy( VTERM, col+1, row+1 );
break;
}
case 'Q': {
/* Set Cursor Type - DG411/461 */
arg1 = dginc();
debug(F111,"Data General","Set Cursor Type",arg1-'0');
if ( debses )
break;
switch ( arg1 ) {