summaryrefslogtreecommitdiff
path: root/v4.0/src/INC/SHELLRD.INC
blob: 7d35d11ef999739907065d57ed45f7fbd9dd7a9d (plain) (blame)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		 SHELLRD.INC					      :
;									      :
; Description:		 Include file for SHELLRD.ASM			      :
;									      :
; Revised:		 04-21-88					      :
;									      :
;-----------------------------------------------------------------------------+
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		INIT_GTEXT					      :
;									      :
; Description:		Initialize the PCGRAPH parameter block with the PCB   :
;			contained in AX.				      :
;									      :
; Entry:		AX    = Panel ID to initialize into PCGRAPH parameter :
;				block.					      :
;									      :
; Exit: 		ES:DI = Address of initialized PCGRAPH parameter      :
;				block.					      :
;									      :
; Entry point:		INIT_GTEXT					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	None.						      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
INIT_GTEXT     PROC NEAR
;
	       CALL FAR PTR GET_PCB	     ;return panel address at ES:DI
;
	       PUSH ES:[DI]+PCB_FLAGSEG      ;flag string segment
	       PUSH ES:[DI]+PCB_FLAGOFF      ;flag string offset
	       PUSH ES:[DI]+PCB_EXPANDSEG    ;segment of text string
	       PUSH ES:[DI]+PCB_EXPANDOFF    ;offset of text string
	       PUSH ES:[DI]+PCB_WIDTH	     ;width of panel
	       PUSH ES:[DI]+PCB_LROW	     ;lower right corner
	       PUSH ES:[DI]+PCB_UCOL	     ;column location of panel
	       PUSH ES:[DI]+PCB_UROW	     ;row location of panel
	       PUSH ES:[DI]+PCB_CCBID	     ;Index number of log color
	       MOV  AL,ES:[DI]+PCB_OPT4
;
	       LEA  DI,GEN_DATA 	     ;point graphics window structure
					     ; to data area
	       MOV  [DI]+G_DRAWT_F,AL	     ;set flags
	       POP  AX			     ;get color index
	       POP  BX			     ;get upper row
	       MOV  [DI]+G_DRAWTROWO,BX      ;window row origin (top left)
	       POP  [DI]+G_DRAWTCOLO	     ;window column origin
	       POP  CX			     ;get lower row and calculate
	       SUB  CX,BX		     ; number of lines in text panel
	       INC  CX
	       MOV  [DI]+G_DRAWTLINES,CX
	       POP  [DI]+G_DRAWTLEN	     ;width of panel text
;
	       POP  WORD PTR [DI].G_DRAWTSTRING
					     ;panel text string address
	       POP  WORD PTR [DI+2].G_DRAWTSTRING
	       POP  WORD PTR [DI].G_DRAWTFLAGS
					     ;panel text flag string address
	       POP  WORD PTR [DI+2].G_DRAWTFLAGS
;
	       DEC  [DI]+G_DRAWTROWO	     ;window row origin (top left)
	       DEC  [DI]+G_DRAWTCOLO	     ;window column origin
;
	       MOV  BX,G_DRAWT_WA+G_DRAWT_WC+G_DRAWT_UA
	       CMP  [DI]+G_DRAWT_F,0	     ;check if source flags option used
	       JE   IGT10
;
	       CMP  WORD PTR [DI].G_DRAWTFLAGS,0
	       JNE  IGT10
;
	       OR   BX,G_DRAWT_UF	     ;set option to use source flags
					     ; option
;
IGT10:	       MOV  [DI]+G_DRAWTOPT,BX	     ;option word
	       MOV  [DI]+G_DRAWTSKIP,0	     ;num bytes in source to next line
;
	       PUSH ES			     ;save pointer to panel data
	       PUSH DI
	       CALL FAR PTR GET_COLOR	     ;get color attribute
	       MOV  AL,ES:[DI]+CCB_A1	     ;get normal panel color
	       POP  DI			     ;point back to panel data
	       POP  ES
	       MOV  [DI]+G_DRAWT_A,AL	     ;window attribute
	       MOV  [DI]+G_DRAWTOUT,AL	     ;outline color attribute
;
	       MOV  AX,DATA		     ;point to segment containing
	       MOV  ES,AX		     ; general data area
;
	       RET
INIT_GTEXT     ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		PROCESS_SCROLL					      :
;									      :
; Description:		Highlight mouse fields in the specified range as      :
;			the up and down arrows are used.  The range of mouse  :
;			fields to highlight are specified in AX and BX with   :
;			intervening fields in consecutive order.  The help    :
;			ID for each selection is calculated from the values   :
;			set to COM_HCBIDL and COM_HCBIDH.  It is important    :
;			that the help equates are in sequential order.	      :
;									      :
;			���������������������������������Ŀ		      :
;	     COM_HCBIDL �� 1. First element to highlight ���� AX	      :
;			�  2.	     :	     :		  �		      :
;			�  3.	     :	     :		  �		      :
;	     COM_HCBIDH �� 4. Last element to highlight  ���� BX	      :
;			�����������������������������������		      :
;									      :
;									      :
; Entry:		AX	   = First element to highlight 	      :
;			BX	   = Last element to highlight		      :
;									      :
;			COM_HCBIDL = First element help ID		      :
;			COM_HCBIDH = Last element help ID		      :
;			COM_HCBID  = Set to desired help ID for all selections:
;				     and set COM_HCBIDL and COM_HCBIDH to 0.  :
;									      :
;			COM_SCROPT = Set scroll option for multiple	      :
;				     selections.  COM_HCBID and COM_CURPUPF   :
;				     must be initialized before entry.	      :
;									      :
; Exit: 		COM_MOK   0= Mouse input			      :
;				  1= Keyboard input			      :
;			COM_KEY    = Keystroke (keyboard or mouse value)      :
;			COM_ROW    = Row of mouse pointer (text coordinates)  :
;			COM_COL    = Column of mouse pointer (text coord)     :
;			COM_POSITION = Line number of scroll bar element      :
;			COM_CURRF  = Current mouse field ID		      :
;			COM_DELTA  = Scroll bar delta from current top	      :
;				     element displayed in panel 	      :
;			COM_HCBID  = Current help equate		      :
;									      :
;									      :
; Notes:		None.						      :
;									      :
; Entry point:		PROCESS_SCROLL					      :
;									      :
; Internal references:	PCTRACK_CALL					      :
;			PCINPUT_CALL					      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
PROCESS_SCROLL PROC FAR
;
	       PUSH AX			     ;save registers
	       PUSH BX
	       PUSH CX
	       PUSH DX
	       PUSH DI
	       PUSH ES
	       PUSH SI
	       PUSH DS
;
; initialize first highlighted field
;
	       MOV  COM_HLPTEMP,0	     ;set to unique scroll help
;
	       CMP  COM_HCBIDL,0	     ;check if unique scroll item
	       JNE  SI04		     ; help option active
;
	       CMP  COM_HCBIDH,0
	       JNE  SI04
;
	       PUSH COM_HCBID		     ;set help ID
	       POP  COM_HLPTEMP
;
SI04:	       MOV  COM_FLDT,2		     ;scroll field type
;
	       MOV  CX,BX		     ;calulate number of entries
	       SUB  CX,AX		     ; in list
	       XOR  CH,CH		     ;clear to zero
	       ADD  CL,'1'                   ;adjust for string value
	       MOV  COM_CNT,CX		     ;save value
;
	       CMP  COM_SCROPT,1	     ;when using this option make
	       JNE  SI05		     ; sure starting help ID initializd
					     ; to COM_HCBID and the current
					     ; field to highlight COM_CURPUPF
;
	       MOV  DX,AX		     ;get first field
	       MOV  AX,COM_CURPUPF	     ;make new mouse field the current
	       MOV  COM_LASTF,AX	     ; field
	       JMP  SI07
;
SI05:	       MOV  CX,COM_HCBIDL	     ;initialize starting help ID
	       MOV  COM_HCBID,CX
;
	       MOV  COM_CURPUPF,AX	     ;make new mouse field the current
	       MOV  COM_LASTF,AX	     ; field
	       MOV  DX,AX		     ;get first field
;
SI07:	       MOV  CX,BX		     ;get last field
	       CALL FAR PTR LOC_MOUSEF	     ;get actual mouse field number
	       CALL FAR PTR MOUSE_OFF
	       CALL FAR PTR MOUSE_HIGH	     ;highlight mouse field
	       CALL FAR PTR MOUSE_ON
;
; Poll for keyboard or mouse input
;
SI10:	       CMP  COM_HLPTEMP,0	     ;check if single help ID selection
	       JE   SI11		     ; active
;
	       MOV  AX,COM_HLPTEMP	     ;set single help ID for all scroll
	       MOV  COM_HCBID,AX	     ; selections
;
SI11:	       MOV  AX,0		     ;turn monocasing off
	       CALL FAR PTR PROCESS_KEY      ;get keystroke

	       MOV  BX,COM_KEY		     ;get keystroke
;
; Exit if mouse action
;
SI12:	       CMP  COM_MOK,1		     ;check if keyboard input
	       JE   SI15
;
	       CMP  BX,ES:[DI]+KY_ENTER      ;check if Enter pressed
	       JNE  SI13
;
	       CMP  COM_SCROPT,1	     ;is this the multiple select opt?
	       JE   SI13		     ;yes, jump out of procedure
;
	       MOV  AX,COM_CURPUPF	     ;get current highlighted field
	       CALL FAR PTR GET_MOUSEF	     ;get mouse structure
;
	       MOV  AX,ES:[DI]+MS_KEYS	     ;keystroke assigned to field
	       MOV  COM_KEY,AX
	       MOV  COM_MOK,0		     ;set for keystroke input
;
SI13:	       JMP  SIEXIT		     ;mouse action exit
;
; Process down arrow key
;
SI15:	       CMP  BX,ES:[DI]+KY_DARROW     ;check if up arrow pressed
	       JNE  SI30
;
	       CMP  COM_CURPUPF,CX	     ;check if below last field
	       JAE  SI20
;
	       INC  COM_HCBID		     ;point to next help equate
	       INC  COM_CURPUPF 	     ;no, point to next field
	       JMP  SI45		     ;now change highlight
;
SI20:	       PUSH COM_HCBIDL		     ;initialize help to first field
	       POP  COM_HCBID
	       MOV  COM_CURPUPF,DX	     ;yes, point to first field
	       JMP  SI45		     ;now change highlight
;
; process up arrow key
;
SI30:	       CMP  BX,ES:[DI]+KY_UARROW     ;check if up arrow pressed
	       JNE  SI50
;
	       CMP  COM_CURPUPF,DX	     ;check if above first field
	       JBE  SI40
;
	       DEC  COM_HCBID		     ;point to next help equate
	       DEC  COM_CURPUPF 	     ;no, point to previous field
	       JMP  SI45
;
SI40:	       PUSH COM_HCBIDH		     ;initialize help to last field
	       POP  COM_HCBID
	       MOV  COM_CURPUPF,CX	     ;yes, point to last field
;
; Remove last field highlight and display new highlight
;
SI45:	       CALL FAR PTR MOUSE_OFF	     ;turn mouse pointer off
;
	       MOV  AX,COM_LASTF	     ;unhighlight last mouse field
	       CALL FAR PTR LOC_MOUSEF	     ;get actual field number
	       CALL FAR PTR MOUSE_UNHIGH
;
	       MOV  AX,COM_CURPUPF	     ;highlight current mouse field
	       CALL FAR PTR LOC_MOUSEF	     ;get actual field number
	       CALL FAR PTR MOUSE_HIGH
;
	       CALL FAR PTR MOUSE_ON	     ;turn mouse pointer on
;
	       MOV  AX,COM_CURPUPF	     ;set last field as current
	       MOV  COM_LASTF,AX
	       JMP  SI10		     ;poll for next keystroke
;
; Process Enter key
;
SI50:	       CMP  BX,ES:[DI]+KY_ENTER      ;check if Enter pressed
	       JNE  SI60
;
	       CMP  COM_SCROPT,1	     ;is this the multiple select opt?
	       JE   SIEXIT		     ;yes, jump out of procedure
;
	       MOV  AX,COM_CURPUPF	     ;get current highlighted field
	       CALL FAR PTR GET_MOUSEF	     ;get mouse structure
;
	       MOV  AX,ES:[DI]+MS_KEYS	     ;keystroke assigned to field
	       MOV  COM_KEY,AX
	       MOV  COM_MOK,0		     ;set for keystroke input
	       JMP  SIEXIT		     ;exit process_scroll
;
; if escape key, exit
;
SI60:	       CMP  BX,ES:[DI]+KY_CANCEL     ;check if Escape pressed
	       JNE  SI70
;
	       JMP  SIEXIT
;
; if not multiple select, exit on number
;
SI70:	       CMP  COM_SCROPT,1	     ;is this the multiple select opt?
	       JE   SI90		     ;yes, jump to check space bar
;
	       CMP  BX,'1'                   ;compare to a one
	       JB   SI80
;
	       CMP  BX,COM_CNT		     ;compare to number of entries
	       JBE  SIEXIT
;
SI80:	       JMP  SI100		     ;poll for next keystroke
;
; multiple select, exit on spacebar
;
SI90:	       CMP  BX,ES:[DI]+KY_SELECT     ;was this the space bar?
	       JE   SIEXIT		     ;yes, exit routine
;
SI100:	       CALL FAR PTR PCMBEEP_CALL     ;beep on unknown keystroke  P*3940
	       JMP  SI10		     ;poll for next keystroke
;
; Unhighlight field before exit
;
SIEXIT:        CALL FAR PTR MOUSE_OFF	     ;turn mouse pointer off
	       MOV  AX,COM_CURPUPF	     ;get last field
;
	       CALL FAR PTR LOC_MOUSEF
	       CALL FAR PTR MOUSE_UNHIGH     ;unhighlight field before exit
	       CALL FAR PTR MOUSE_ON	     ;turn mouse point on
;
	       MOV  COM_FLDT,0		     ;no field type
;
	       POP  DS			     ;restore registers
	       POP  SI
	       POP  ES
	       POP  DI
	       POP  DX
	       POP  CX
	       POP  BX
	       POP  AX
;
	       RET
PROCESS_SCROLL ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		PROCESS_INPUT					      :
;									      :
; Description:		Display input field contents relative to location of  :
;			associated panel and optionally process keystroke     :
;			before returning.				      :
;									      :
; Entry:		COM_ICBID  = Input field ID to process. 	      :
;			COM_HCBID  = Help ID assigned to input field.	      :
;			COM_INOPT 0= Display data entry 		      :
;				  1= Do not display data entry (Password)     :
;									      :
; Exit: 		ES:DI	   = Address of input field data	      :
;			CX	   = Length of data			      :
;			AX	   = Return key 			      :
;									      :
;			COM_MOK   0= Mouse input			      :
;				  1= Keyboard input			      :
;			COM_KEY    = Keystroke (keyboard or mouse value)      :
;			COM_ROW    = Row of mouse pointer (text coordinates)  :
;			COM_COL    = Column of mouse pointer (text coord)     :
;			COM_CURRF  = Current mouse field ID		      :
;			COM_DELTA  = Scroll bar delta from current top	      :
;				     element displayed in panel 	      :
;									      :
;									      :
; Entry point:		PROCESS_INPUT					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	GET_ICB      = Get specified input control block.     :
;									      :
;			PCINPUT_CALL = Call to external CAS routine.	      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
PROCESS_INPUT  PROC FAR
;
	       PUSH BX
	       PUSH DX
;
; initialize
;
	       MOV  COM_FLDT,1		     ;input field
;
	       MOV  IN_CURNOR,0607H	     ;non-mono cursor size
;
	       CMP  GV_VIDMODE,7	     ;check if mono mode
	       JNE  PH03
;
	       MOV  IN_CURNOR,0C0DH	     ;mono cursor size
;
; remove mouse pointer
;
PH03:	       CALL FAR PTR MOUSE_OFF	     ;turn mouse pointer off
;
; locate specified input control block
;
	       MOV  AX,COM_ICBID	     ;get PCINPUT field
	       MOV  IN_ICBID,AX
	       CALL FAR PTR GET_ICB	     ;ES:DI points to ICB
;
; initialize, display and exit field
;
	       AND  ES:[DI]+ICB_OPT1,NOT ICB_PSW
					     ;deactivate password option
	       CMP  COM_INOPT,0 	     ;check if password option is on
	       JE   PH04
;
	       OR   ES:[DI]+ICB_OPT1,ICB_PSW ;activate password option
;
PH04:	       AND  ES:[DI]+ICB_STATUS,NOT ICB_DONE
	       AND  ES:[DI]+ICB_STATUS,NOT ICB_SINS
;
	       MOV  ES:[DI]+ICB_CURCHAR,1
;
PH05:	       OR   ES:[DI]+ICB_OPT4,ICB_INIT
	       AND  ES:[DI]+ICB_OPT3,NOT ICB_KEY
	       CALL FAR PTR PCINPUT_CALL     ;initialize field
	       AND  ES:[DI]+ICB_OPT4,NOT ICB_INIT
	       OR   ES:[DI]+ICB_OPT3,ICB_KEY
					     ;remove initialization option
;
; Process field
;
PH06:	       XOR  AX,AX
	       OR   ES:[DI]+ICB_OPT3,ICB_KEY
	       AND  ES:[DI]+ICB_OPT4,NOT ICB_INIT
	       TEST ES:[DI]+ICB_OPT2,ICB_UPC ;check if monocasing option active
	       JE   PH07
;
	       MOV  AX,0000000000000001B     ;set monocasing option on
;
PH07:	       TEST IN_OPT,IN_UTRAN	     ;check if translation option actv
	       JE   PH10
;
	       MOV  AX,0000000000000010B     ;set translation option on
;
; display mouse pointer
;
PH10:	       CALL FAR PTR MOUSE_ON	     ;turn mouse pointer on
;
; Poll keyboard and mouse
;
	       CALL FAR PTR PROCESS_KEY
	       MOV  AX,COM_KEY		     ;get keystroke
;
	       CMP  COM_MOK, 0		     ;mouse field?
	       JNE  PH12		     ;no, continue
	       CMP  COM_RSTFLD, 0	     ;restrict mouse field?
	       JE   PH12		     ;no, continue
	       CMP  AH, 0		     ;extended char?
	       JE   PH12		     ;no, continue
	       CMP  AL,0		     ;unrestricted extended char?
	       JE   PH12		     ;yes, continue
	       CMP  AL, COM_RSTFLD	     ;mouse field in current set?
	       JNE  PH11		     ;no, return new field index
	       XOR  AL, AL		     ;clear ID byte
comment        |
	       cmp  ah, rtarrow 	     ;
	       jne  ph1005		     ;
	       mov  es,in_icbseg	     ;
	       mov  di,in_icboff	     ;
	       inc  es:[di]+icb_hrstart      ;
	       INC  ES:[DI]+ICB_CURCHAR      ;
	       AND  ES:[DI]+ICB_OPT3,NOT ICB_KEY
	       OR   ES:[DI]+ICB_OPT4,ICB_INIT
	       jmp  ph12		     ;
ph1005:        cmp  ah, lfarrow 	     ;
	       jne  ph12		     ;
	       mov  es,in_icbseg	     ;
	       mov  di,in_icboff	     ;
	       dec  es:[di]+icb_hrstart      ;
	       DEC  ES:[DI]+ICB_CURCHAR      ;
	       AND  ES:[DI]+ICB_OPT3,NOT ICB_KEY
	       OR   ES:[DI]+ICB_OPT4,ICB_INIT
	       |
	       JMP  PH12		     ;continue
PH11:	       XOR  AH, AH		     ;clear keystroke byte
;
PH12:	       MOV  COM_KEY, AX 	     ;update keystroke
	       CALL FAR PTR MOUSE_OFF	     ;
;
; Pass keystroke to input field for processing
;
PH50:	       MOV  ES,IN_ICBSEG	     ;point to current ICB
	       MOV  DI,IN_ICBOFF
	       MOV  ES:[DI]+ICB_KS,AX	     ;set keystroke to ICB
;
	       CALL FAR PTR PCINPUT_CALL     ;process input field
;
	       MOV  ES,IN_ICBSEG	     ;point to current ICB
	       MOV  DI,IN_ICBOFF
;
	       MOV  AX,ES:[DI]+ICB_KS	     ;return keystroke
;
	       TEST ES:[DI]+ICB_STATUS,ICB_DONE
	       jne  ph51
	       jmp  PH06		     ;check for exit condition
;
ph51:	       CALL FAR PTR MOUSE_ON	     ;turn mouse pointer on
	       CALL FAR PTR CURSOROFF	     ;turn hardware cursor off
	       MOV  COM_FLDT,0		     ;no field type
	       MOV  COM_INOPT,0 	     ;no password option
;
	       MOV  DX,ES:[DI]+ICB_OPT4      ;get option word 4
;
	       PUSH ES:[DI]+ICB_ENDBYTE      ;return length of data
	       PUSH ES:[DI]+ICB_FIELDOFF     ;return offset of data
	       PUSH ES:[DI]+ICB_FIELDSEG     ;return segment of data
;
	       POP  ES
	       POP  DI
	       POP  CX
;
	       TEST DX,ICB_TRUN 	     ;field is DOS pathname?
	       JZ   PH60		     ;no, continue
;
	       MOV  SI,DI		     ;save string offset
	       ADD  DI,CX		     ;get end of string offset
	       MOV  BYTE PTR ES:[DI],0	     ;null-terminate pathname
	       MOV  DI,SI		     ;restore string offset
;
	       CALL TRUNC_NAME		     ;truncate DOS names & extensions
	       PUSH ES							;MJK005
	       PUSH DI							;MJK005
	       MOV  ES,IN_ICBSEG	     ;point to current ICB	;MJK005
	       MOV  DI,IN_ICBOFF					;MJK005
	       MOV  ES:[DI]+ICB_ENDBYTE,CX   ;return length of data	;MJK005
	       POP  DI							;MJK005
	       POP  ES							;MJK005
;
PH60:	       POP  DX
	       POP  BX
;
	       RET
PROCESS_INPUT  ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		PROCESS_KEY					      :
;									      :
; Description:		Poll keyboard then mouse return only if action	      :
;			occurs. 					      :
;									      :
; Entry:		AX	 0000000000000001 = Monocasing		      :
;				 0000000000000010 = Translation table	      :
;									      :
;			COM_HLPOPT = set to 10 to deactivate help	      :
;			COM_HCBID  = Help ID assigned to input field.	      :
;									      :
; Exit: 		COM_MOK   0= Mouse input			      :
;				  1= Keyboard input			      :
;			COM_KEY    = Keystroke (keyboard or mouse value)      :
;			COM_ROW    = Row of mouse pointer (text coordinates)  :
;			COM_COL    = Column of mouse pointer (text coord)     :
;			COM_CURRF  = Current mouse field ID		      :
;			COM_DELTA  = Scroll bar delta from current top	      :
;				     element displayed in panel 	      :
;									      :
;			COM_FLDT  0= no field	   used to determine if       :
;				  1= input field   cursor should be displayed :
;				  2= scroll field			      :
;									      :
; Entry point:		PROCESS_KEY					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	PCTRACK_CALL = Call to external CAS routine.	      :
;			PCINPUT_CALL = Call to external CAS routine.	      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
PROCESS_KEY    PROC FAR
;
	       PUSH AX			     ;save registers
	       PUSH BX
	       PUSH CX
	       PUSH DX
;
	       MOV  INC_KS,0		     ;initialize to no keystroke
	       MOV  INC_OPT,0
;
	       TEST AX,0000000000000001B     ;check if monocasing
	       JE   PK05
;
	       OR   INC_OPT,INC_AMONO	     ;initialize to monocasing
	       CMP  IN_MONOSEG,0	     ;monocasing table gotten?	P5197
	       JNE  PK02		     ;yes, don't get again      P5197
	       CALL GET_MONO_DOS	     ;get DOS monocasing table	P5197
PK02:					     ;				P5197
	       MOV  BX,IN_MONOOFF	     ;get from PCINPUT control block
	       MOV  INC_MONOOFF,BX	     ;set in PCINCHA control block
	       MOV  BX,IN_MONOSEG	     ;get from PCINPUT control block
	       MOV  INC_MONOSEG,BX	     ;set in PCINCHA control block
;
PK05:	       TEST AX,0000000000000010B     ;check if translation table
	       JE   PK10
;
	       OR   INC_OPT,INC_UTRAN	     ;initialize for translation table
;
; Poll keyboard for input
;
PK10:	       MOV  KS_CHAR,0		     ;clear out 		P*4663
	       TEST COM_PROCFLAG,COM_KPLOCK  ;keyboard locked?		P*4457
	       JZ   PK17		     ;no, get keystroke 	P*4457
	       IN   AL,64H		     ;get keyboard lock bit	P*4457
	       TEST AL,10H		     ;is keyboard locked?	P*4457
	       JNZ  PK15		     ;OK, keyboard not locked	P*4457
	       JMP  PK40		     ;check time/date		P*4457
PK15:
	       CALL INIT_MOUSE		     ;initialize mouse		P*4457
	       CALL MOUSE_ON		     ;turn on mouse		P*4457
PK17:					     ;				P*4457


	       MOV  AH,1		     ;keystroke status		MJK013
	       TEST COM_PROCFLAG,COM_EXTKEYB ;extended keyboard?	P*4732
	       JZ   PK17_05		     ;no, get normal keystroke	P*4732
	       MOV  AH,11H		     ;get extended keystroke	P*4732
PK17_05:				     ;				P*4732
	       INT  16H 		     ;is there any keystrokes?	MJK013
	       JZ   PK17_10		     ;don't save keystroke      P*4663
	       MOV  KS_CHAR,AX		     ;save the keystroke	MJK013
PK17_10:				     ;				P*4663
;
	       CALL PCINCHA_CALL	     ;call CAS routine
;
	       CMP  INC_KS,0		     ;check if keystroke returned
	       JE   PK20		     ;yes, pass to input field
;
	       CMP  INC_KS, 0003H	     ;ctrl/c or ctrl/break?	P*4663
	       JNE  PK18		     ;no, continue		P*4663
	       MOV  AX, KS_CHAR 	     ;get status keystroke	P*4663
	       CMP  AL, 03H		     ;same ASCII character?	P*4663
	       JE   PK19		     ;yes, must be ctrl/c	P*4663
	       MOV  INC_KS, 0		     ;ignore ctrl/break 	P*4663
	       JMP  PK40		     ;continue			P*4663
PK18:					     ;				p*4663

	       CMP  INC_KS, 6800H	     ;keystroke is alt-f1?

	       JNE  PK19		     ;no, continue
	       MOV  INC_KS, 8500H	     ;translate to f11
;
PK19:	       CALL CHK_OVERRUN 	     ;check for overrun keystrokes
;
	       MOV  COM_MOK,1		     ;set to indicate keyboard
	       XOR  AX,AX		     ;clear to zero
	       MOV  COM_ROW,AX		     ; pointer row
	       MOV  COM_COL,AX		     ; pointer column
	       MOV  COM_DELTA,AX	     ; scroll bar delta
	       MOV  AX,INC_KS		     ;set keystroke from keyboard
	       MOV  COM_KEY,AX
;
	       MOV  AX,COM_CURRF	     ;sav field ID before help process
	       MOV  COM_HELPF,AX
;
	       JMP  PK30
;
; Poll mouse for action
;
PK20:	       TEST COM_STATE,COM_MOUS	     ;check if mouse configured
	       JNE  PK22		     ; do call if no
	       JMP  PK40		     ; skip call if yes
;
PK22:	       LEA  DI,GEN_DATA 	     ;check mouse for button press
	       MOV  [DI]+M_FUNC,M_GET
	       CALL FAR PTR PCTRACK_CALL
;
	       XOR  CH,CH		     ;clear to zero
	       XOR  DH,DH		     ;clear to zero
	       MOV  CL,[DI]+M_GETBUT	     ;get button pressed
	       MOV  DL,[DI]+M_GETFIELD	     ;get field of current pointer
;
	       CMP CL, 2		     ;process keystroke
	       JNE PK24X
;
	       TEST COM_STATE2,COM_ENHA
	       JZ PK24X
;
	       MOV COM_BUT2,1
	       MOV CL, 1
	       JMP PK24
;
PK24X:	       MOV COM_BUT2,0
	       CMP  CL,1		     ;mouse configuration
	       JE   PK24		     ; 0= no button pressed
;
	       CMP  CL,4		     ; 1= button 1 pressed
	       JE   PK24		     ; 2= button 2 pressed
					     ; 3= button 3 pressed
					     ; 4= double click button 1
	       JMP  PK40
;
PK24:	       OR   DL,DL		     ;check if pointer in active field
	       JNZ  PK26		     ; when button pressed, if not
	       JMP  PK40		     ; poll again
;
PK26:	       CMP  GE_MODEL,MODEL_AT	     ;check if AT
	       JNE  PK29
;
	       CMP  GE_SUBMODEL,SUBMD_AT     ;make sure AT
	       JE   PK28
;
	       CMP  GE_SUBMODEL,SUBMD_AS     ;make sure AT/skyrocket
	       JNE  PK29
;
PK28:	       CALL KEYLOCK		     ;check if keyboard on AT is
	       JNZ  PK29
;
	       JMP  PK40		     ; locked, poll again
;
PK29:	       MOV  COM_MOK,0		     ;set to indicate mouse
	       MOV  AX,COM_CURRF	     ;sav field ID before help process
	       MOV  COM_HELPF,AX
	       MOV  COM_CURRF,DX	     ;set current field number
	       MOV  AX,[DI]+M_GETROW	     ;get mouse pointer row where
	       MOV  COM_ROW,AX		     ; button was pressed
	       MOV  AX,[DI]+M_GETCOL	     ;get mouse pointer column where
	       MOV  COM_COL,AX		     ; button was pressed
	       MOV  AX,[DI]+M_GETFKEY	     ;get keystroke assigned to field
	       MOV  COM_KEY,AX
;
	       MOV  AX,[DI]+M_GETDELTA	     ;scroll delta (if in sb field)
	       MOV  COM_DELTA,AX
	       XOR  CX,CX
	       MOV  AX,[DI]+M_GETSPOS	     ;text row/col position in bar
	       MOV  COM_POSITION,AX
;
; Check for help option before exit
;
PK30:	       CMP  COM_HLPOPT,10	     ;check if help deactivated
	       JE   PKEXIT		     ;exit
;
	       MOV  AX,STR_TOTAL	     ;get keystroke structure
	       CALL FAR PTR GET_STRING	     ;structure at ES:DI
;
	       MOV  AX,COM_KEY		     ;get keystroke
	       CMP  AX,ES:[DI]+KY_CHELP
	       JNE  PKEXIT
;
	       CALL FAR PTR CURSOROFF	     ;turn hardware cursor off
	       PUSH COM_HELPF		     ;save field ID before help process
	       CALL MANAGE_HELP 	     ;process all types of help
	       POP  COM_CURRF		     ;reset original field ID before hl
;
	       CMP  COM_FLDT,1		     ;redisplay cursor if input field
	       JNE  PK40
;
	       CALL FAR PTR CURSORON	     ;turn hardware cursor on
;
; Check if date and time should be updated.
;
PK40:	       CALL DISP_DATETIME	     ;update date/time
	       JMP  PK10
;
; Exit
;
PKEXIT:        PUSH ES
	       PUSH DI
	       MOV  AX, 40H
	       MOV  ES, AX
	       MOV  BX, 17H
	       MOV  AL, ES:[BX]
	       XOR  AH, AH
	       MOV  COM_SHIFT, AX
	       POP  DI
	       POP  ES
;
	       POP  DX			     ;exit
	       POP  CX
	       POP  BX
	       POP  AX
;
	       RET
PROCESS_KEY    ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									P5197 :
;  GET_MONO_DOS 							      :
;	    Get segment and offset of the DOS monocasing table and return it  :
;									      :
;  Entry:  None 							      :
;									      :
;  Exit:   None 							      :
;									P5197 :
;-----------------------------------------------------------------------------+
GET_MONO_DOS   PROC NEAR
;
	       PUSH ES			     ;				P5197
	       PUSH DI			     ;				P5197
	       PUSH AX			     ;				P5197
;
	       MOV  AH,65H		     ;extended country info	P5197
	       MOV  AL,04H		     ;get uppercase table ptrs	P5197
	       MOV  BX,-1		     ;default code page 	P5197
	       MOV  DX,-1		     ;default country id	P5197
	       MOV  CX,05H		     ;# bytes returned		P5197
	       PUSH DS
	       POP  ES			     ;ES:DI ptrs to return buf	P5197
	       MOV  DI,OFFSET TEMP_WKA	     ;use as temp buffer	P5197
	       INT  21H
	       JC   GET_MONO_RET
;
	       INC  DI			     ;skip info id		P5197
;
	       MOV  AX,WORD PTR [DI]	     ;get DOS mono table offset P5197
	       MOV  IN_MONOOFF,AX	     ;save it			P5197
	       ADD  DI,2
	       MOV  AX,WORD PTR [DI]	     ;get DOS mono table seg	P5197
	       MOV  IN_MONOSEG,AX	     ;save it			P5197
;
GET_MONO_RET:
	       POP  AX			     ;				P5197
	       POP  DI			     ;restore registers 	P5197
	       POP  ES			     ;				P5197
;
	       RET			     ;				P5197
GET_MONO_DOS   ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		CHK_OVERRUN					      :
;									      :
; Description:		Check for multiple entries of cursor keys to	      :
;			eliminate overrun in typeamatic mode.		      :
;									      :
; Entry:		INC_KS	   = Key stroke 			      :
;									      :
; Exit: 		INC_KS	   = Returned keystroke 		      :
;									      :
; Entry point:		CHK_OVERRUN					      :
;									      :
; Notes:		Duplicate cursor keystrokes are removed.	      :
;									      :
; Internal references:	PCINCHA_CALL = Call to external CAS routine.	      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
CHK_OVERRUN    PROC NEAR
;
	       PUSH CX
	       PUSH DI
	       PUSH ES
;
	       MOV  CX,KS_TABLE_LEN	     ;len of cursor keystroke table
	       ROR  CX,1		     ;set number of entries
	       MOV  AX,DS		     ;get segment of table
	       MOV  ES,AX		     ;set segment of table
	       MOV  DI,OFFSET KS_TABLE	     ;offset of table
	       MOV  AX,INC_KS		     ;current keystroke
	       CLD
	       REPNZ SCASW		     ;scan table for keystroke match
	       JNZ  CHK_OVRET		     ;no match found
;
CHK_OV10:      MOV  AH,1		     ;keystroke status
	       TEST COM_PROCFLAG,COM_EXTKEYB ;extended keyboard?	P*4732
	       JZ   CHK_OV20		     ;no, get normal keystroke	P*4732
	       MOV  AH,11H		     ;get extended keystroke	P*4732
CHK_OV20:				     ;				P*4732
	       INT  16H 		     ;check for next keystroke
	       JZ   CHK_OVRET		     ;no, keystroke available
;
	       CMP  AX,KS_CHAR		     ;is it the same as before	MJK013
	       JNE  CHK_OVRET		     ;no, return
;
	       MOV  AH,0		     ;keystroke read
	       TEST COM_PROCFLAG,COM_EXTKEYB ;extended keyboard?	P*4732
	       JZ   CHK_OV30		     ;no, get normal keystroke	P*4732
	       MOV  AH,10H		     ;get extended keystroke	P*4732
CHK_OV30:				     ;				P*4732
	       INT  16H 		     ;remove it
	       JMP  CHK_OV10		     ;check next keystroke
;
CHK_OVRET:     POP  ES
	       POP  DI
	       POP  CX
;
	       RET
CHK_OVERRUN    ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		DISP_DATETIME					      :
;									      :
; Description:		display the date and time on the display.	      :
;									      :
; Entry:		COM_STATE2:					      :
;			COM_DATE   = O - no date displayed		      :
;				     1 - display date and time		      :
;									      :
; Exit: 		Display updated 				      :
;									      :
; Entry point:		DISP_DATETIME					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	UPDATE_DISPLAY					      :
;			MOUSE_OFF					      :
;			MOUSE_ON					      :
;									      :
; External references:	PCDATES_CALL = Call to external CAS routine.	      :
;			PCTIMES_CALL = Call to external CAS routine.	      :
;									      :
;-----------------------------------------------------------------------------+
;
DISP_DATETIME  PROC NEAR
;
	       PUSH AX			     ;save registers
	       PUSH BX
	       PUSH CX
	       PUSH DX
	       PUSH SI
	       PUSH DI
	       PUSH ES
;
	       TEST COM_STATE2,COM_DATE      ;is the date option active?
	       JNZ  DT_02		     ;yes, continue
	       JMP  DT_RET		     ;return
;
; Set up to get the date and time.
;
DT_02:	       MOV  DI,OFFSET TIME_WKA	     ;time workarea
	       MOV  BX,DS:[DI+4]	     ;save currect seconds
;
	       CALL PCDATES_CALL	     ;get date
;
	       CALL PCTIMES_CALL	     ;get time
;
	       TEST COM_PROCFLAG,COM_NODATE  ;should date not be displayed?
	       JNZ  DT_RET		     ;yes, return
;
	       TEST COM_PROCFLAG,COM_PSCEXEC ;has PSC ended execution?
	       JZ   DT_05		     ;no, continue
;
	       AND  COM_PROCFLAG,NOT COM_PSCEXEC ;reset PSC ended execution
	       JMP  DT_20		     ;display time/date

DT_05:	       MOV  AX,COM_BASESCR	     ;get base screen
	       CMP  AX,COM_BASE_WKA	     ;has it changed?
	       JE   DT_10		     ;no, see if time has changed
;
	       MOV  COM_BASE_WKA,AX	     ;save new base screen
	       JMP  DT_20		     ;continue
;
DT_10:	       CMP  BX,DS:[DI+4]	     ;has the time minutes changed?
	       JE   DT_RET		     ;no, don't update it
;
DT_20:	       MOV  SI,PAN_ATITLE	     ;get panel id for moveg
	       MOV  AX,1		     ;row to display
	       MOV  BX,3		     ;column to display
	       MOV  CX,LENGTH DATE_WKA	     ;len of date
	       MOV  DX,OFFSET DATE_WKA
	       PUSH DS
	       POP  ES
;
	       CALL FAR PTR MOUSE_OFF	     ;turn mouse off
;
	       PUSH AX			     ;
	       MOV  AX, PAN_ATITLE	     ;set panel id
	       CALL FAR PTR GET_ATTR	     ;get color attr
	       AND  AH, 0F0H		     ;mask off foreground
	       CMP  AH, 0F0H		     ;background is white?
	       POP  AX			     ;
	       JNE  DT_28		     ;no, continue
	       MOV  MG_SOURCE_F,G_DRAWTUBOTM ;underline 		P*4816
DT_28:

;		CMP  GV_VIDMODE,11H	      ;mode 11? 		 P*4816
;		JNE  DT_30		      ;no, don't underline       P*4816
;		MOV  MG_SOURCE_F,G_DRAWTUBOTM ;underline		 P*4816


DT_30:					     ;				P*4816
	       CALL UPDATE_DISPLAY	     ;display date
;
	       MOV  BX,69		     ;column to display
	       MOV  CX,LENGTH TIME_WKA	     ;len of time
	       MOV  DX,OFFSET TIME_WKA
;
	       PUSH AX			     ;
	       MOV  AX, PAN_ATITLE	     ;set panel id
	       CALL FAR PTR GET_ATTR	     ;get color attr
	       AND  AH, 0F0H		     ;mask off foreground
	       CMP  AH, 0F0H		     ;background is white?
	       POP  AX			     ;
	       JNE  DT_38		     ;no, continue
	       MOV  MG_SOURCE_F,G_DRAWTUBOTM ;underline 		P*4816
DT_38:


;	       CMP  GV_VIDMODE,11H	     ;mode 11?			P*4816
;	       JNE  DT_40		     ;no, don't underline       P*4816
;	       MOV  MG_SOURCE_F,G_DRAWTUBOTM ;underline 		P*4816
DT_40:					     ;				P*4816
	       CALL UPDATE_DISPLAY	     ;display time
;
	       CALL FAR PTR MOUSE_ON	     ;turn mouse on
;
DT_RET:        POP  ES			     ;restore registers
	       POP  DI
	       POP  SI
	       POP  DX
	       POP  CX
	       POP  BX
	       POP  AX
;
	       RET
DISP_DATETIME  ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		KEYLOCK 					      :
;									      :
; Description:		Determine if AT keyboard lock is on.		      :
;									      :
; Entry:		None.						      :
;									      :
; Exit: 		ZF = 1	: keyboard is locked			      :
;			ZF = 0	: keyboard is unlocked			      :
;									      :
; Entry point:		KEYLOCK 					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	None.						      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
KEYLOCK        PROC NEAR
;
	       PUSH BX
	       PUSH CX
;
	       CLI			     ;disable ints while checking kybd
	       MOV  AL,READ_KBD_INPT	     ;get kybd read input command
	       OUT  STATUS_PORT,AL	     ;issue the command
	       SUB  CX,CX		     ;cls controller count cmd issue
;
KEYLOCK10:     IN   AL,STATUS_PORT
	       TEST AL,INPT_BUF_FULL
	       LOOPNZ  KEYLOCK10	     ;wait for command to be accepted
	       JNZ  KEYLOCK50		     ;exit if command not accepted
;
	       SUB  CX,CX
	       MOV  BL,6
;
KEYLOCK20:     IN   AL,STATUS_PORT
	       TEST AL,OUTPT_BUF_FULL
	       JNZ  KEYLOCK30		     ;branch if OBF
;
	       LOOP KEYLOCK20		     ;loop until response or timeout
	       DEC  BL			     ;timeout loop attempted six times
	       JNZ  KEYLOCK20
;
	       INC  BL			     ;set ZF = 0 if no response
	       JMP  KEYLOCK50
;
KEYLOCK30:     IN   AL,INPUT_PORT	     ;read keyboard input port
	       TEST AL,KYBD_INH 	     ;test to see if kybd lock is on
;
KEYLOCK50:
;
KEYLOCK60:     STI			     ;enable ints
	       POP  CX			     ;restore regs
	       POP  BX
;
	       RET			     ;Exit
KEYLOCK        ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		COMMAND_LINE					      :
;									      :
; Description:		Command line dialog.				      :
;									      :
; Entry:		COM_OLDCBKOFF  = offset of original crtl+break	      :
;			COM_OLDCBKSEG  = segment of original crtl+break       :
;			COM_CMDBUF     = required to invoke COMMAND.COM       :
;			COM_CMDINPBUF  = command line input buffer	      :
;			COM_CMDINPLEN  = length of command line input buf     :
;			COM_CMDBUFLEN  = length including '/C'                :
;			COM_CMDDRIVE   = current drive and path to display    :
;			COM_CMDPATH	 for command line input prompt	      :
;			KY_COMDLINE    = command line	  Shift + F9	      :
;			KY_LASTCOMD    = last command	  up arrow	      :
;			KY_NEXTCOMD    = next command	  dn arrow	      :
; Exit: 								      :
;									      :
; Entry point:		COMMAND_LINE					      :
;									      :
; Notes:		Changed procedure to use a COMMAND.COM PSC execution. :
;									      :
; Internal references:	PCTRACK_CALL					      :
;									      :
; External references:	INT 21H  AH=40H   Write string to standard output.    :
;			INT 21H  AH=25H   Set interrupt vector address.       :
;			INT 21H  AH=35H   Get interrupt vector address.       :
;			INT 21H  AH=49H   Deallocate memory.		      :
;			INT 21H  AH=47H   Read current directory.	      :
;			INT 21H  AH=19H   Read current disk.		      :
;			INT 21H  AH=06H   Write char to standard output.      :
;			INT 21H  AH=4BH   EXEC command line.		      :
;									      :
;-----------------------------------------------------------------------------+
;
COMMAND_LINE   PROC FAR

	       TEST COM_STATE,COM_FLCL	     ;check if command line active
	       JNE  MC10
;
	       CALL FAR PTR OPT_INACTIVE     ;display error panel for inactive *PCR
	       JMP  MCEXIT		     ;exit
;
; save registers
;
MC10:	       CALL FAR PTR REMOVE_OLDPD     ;remove last pull down panel
	       MOV  COM_CURPD,0
;
	       PUSH AX
	       PUSH BX
	       PUSH CX
	       PUSH DX
	       PUSH BP
	       PUSH SI
	       PUSH DI
;
; disable mouse tracker
;
	       CALL FAR PTR MOUSE_OFF	     ;turn mouse pointer off
	       CALL FAR PTR DEL_MOUSEF	     ;delete all mouse fields
	       CALL FAR PTR MOUSE_DIS	     ;disable mouse support
;
; Set current directory path
;
	       CMP  COM_CDIALOG,COM_APPMENU  ;check if program menu dialog
	       JNE  MC20		     ; don't ask for dir from DOS Serv
;
	       JMP  MC30
;
MC20:	       CMP  COM_CDIALOG,COM_PAAB     ;check if program menu dialog
	       JE   MC30		     ; don't ask for dir from DOS Serv
;
	       CMP  COM_CDIALOG,COM_DCLR     ;check if program menu dialog
	       JE   MC30		     ; don't ask for dir from DOS Serv
;
	       XOR  AX,AX		     ;get current selected directory
	       MOV  AX,1		     ;get current selected dir	;P*4245
	       CALL RETURN_PATH 	     ; in DOS services
;
	       MOV  BX,OFFSET FULLSPEC	     ;file name
	       MOV  DL,DS:BYTE PTR[BX]	     ;drive id
	       CALL SET_DRIVE		     ;set to the drive
;
	       PUSH DI
	       MOV  AH,0EH		     ;change to selected drive
	       MOV  DX,DATA
	       MOV  DS,DX
	       LEA  DI,FULLSPEC
	       MOV  DL,[DI]
	       SUB  DL,'A'
	       INT  21H
	       POP  DI
;
	       MOV  AH,3BH		     ;change to selected directory
	       MOV  DX,DATA
	       MOV  DS,DX
	       LEA  DX,FULLSPEC
	       INT  21H
;
; Move in COMSPEC to PSC workarea for new COMMAND.COM PSC execution.
;
MC30:	       MOV  SI,OFFSET COM_PFILSPEC   ;COMSPEC location
;
	       mov  dl, byte ptr [si]	     ;get drive letter of comspec
	       call set_drive		     ;set logical drive
;
	       MOV  DI,OFFSET PEC_COM	     ;PSC workarea location
	       MOV  PEC_BYTE,0		     ;clear length
;
MC40:	       MOV  AL,DS:BYTE PTR [SI]      ;get character
	       CMP  AL,0		     ;end of string?
	       JE   MC50		     ;yes, add parm sep char
;
	       MOV  DS:BYTE PTR [DI],AL      ;put character in PSC workarea
	       INC  PEC_BYTE		     ;adjust length
	       INC  SI			     ;point to next COMSPEC char
	       INC  DI			     ;point to next PSC position
	       JMP  MC40		     ;get next character
;
MC50:	       MOV  DS:BYTE PTR [DI],PEC_SEP ;set parameter seperator char
	       INC  PEC_BYTE		     ;adjust length
	       PUSH DS
	       POP  ES			     ;set segment of PSC workarea
	       MOV  DI,OFFSET PEC_TITLE      ;set offset of PSC workarea

	       OR   COM_PROCFLAG,COM_CMDPSC  ;set COMMAND.COM PSC exec	P*3748
	       CALL FAR PTR PROCESS_PSC      ;set up to process PSC
;
	       POP  DI			     ;restore registers
	       POP  SI
	       POP  BP
	       POP  DX
	       POP  CX
	       POP  BX
	       POP  AX
;
MCEXIT:
;
	       RET
COMMAND_LINE   ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; SET_DRIVE								      :
;									      :
;	  On a single drive system, set the logical to the physical drive.    :
;									      :
; Entry:  DL - Drive letter						      :
;									      :
; Exit:   Logical drive set						      :
;									      :
; Notes:  None								      :
;									      :
;-----------------------------------------------------------------------------+
;
SET_DRIVE      PROC NEAR

	       PUSH BX			     ;				P*4831
	       PUSH DX			     ;				P*4831
	       PUSH AX			     ;				P*4831

	       AND  DL,0DFH		     ; convert it to		P*4831
	       SUB  DL,40H		     ;	 an binary number.	P*4831
	       MOV  BL,DL
	       MOV  AX,440FH		     ; I/O control		P*4831
	       INT  21H 		     ; set logical drive letter P*4831

	       POP  AX			     ;				P*4831
	       POP  DX			     ;				P*4831
	       POP  BX			     ;				P*4831
	       RET			     ; return to caller 	P*4831

SET_DRIVE      ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		PCCLRRD_CALL					      :
;									      :
; Description:		Call to PCCLRRD.				      :
;									      :
; Entry:		PCCLRRD parameter block initialized.		      :
;									      :
; Exit: 		PCCLRRD parameter block initialized.		      :
;									      :
; Entry point:		PCCLRRD_CALL					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	None.						      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
PCCLRRD_CALL   PROC NEAR		     ;*PCR (ENTIRE PROC)
;
	       PUSH DS			     ;Set segment
	       POP  ES
;
	       PUSH DS
	       PUSH DI			     ;Save registers
;
	       LEA  DI,CRD_OPT1 	     ;Set DI to proper parameter block
					     ; for call
IF CASRM
	       MOV  AH,00H		     ;Make call to CAS-RM
	       MOV  BX,CRD_RN		     ;Set cas routine number
	       INT  CASINT		     ;Call routine
ELSE
	       CALL CLRRD
ENDIF
;
; copy the color index vector into buffer below clrrd buffer
;
	       MOV  AX,16		     ;calc length of color read and
	       MOV  BX,MAX_COLRBUF	     ; write buffers
	       MUL  BX			     ;# paragraphs * 16 = # bytes
	       SUB  AX,500		     ;leave room for safe buffer
	       ADD  AX,CRD_BUFOFF	     ;add current crd buf offset
	       MOV  DI,AX
	       MOV  SI,CRD_CCBVECOFF	     ;get source address
	       MOV  CRD_CCBVECOFF,DI	     ;set destination offset
;
	       CMP  CRD_ERROR,0 	     ;was there an error
	       JNE  CR_EXIT		     ;yes, don't overwrite
	       CMP  CRD_DOSERROR,0	     ;was there an error
	       JNE  CR_EXIT		     ;yes, don't overwrite
;
	       MOV  ES,CRD_BUFSEG	     ;set destination segment
	       MOV  CX,CRD_CCBVECLEN	     ;get the length to move
	       PUSH DS
	       MOV  AX,CRD_CCBVECSEG	     ;set source segment
	       MOV  DS,AX
;
	       REP  MOVSB		     ;move the data
	       POP  DS
;
CR_EXIT:       POP  DI			     ;Restore registers
	       POP  DS
;
	       RET
PCCLRRD_CALL   ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		SET_DEFAULT					      :
;									      :
; Description:		Set default value in specified ICB control block.     :
;									      :
; Entry:		ES:DI	      = Address of default value.	      :
;			CX	      = Length of string.		      :
;			AX	      = ICB number of input field.	      :
;									      :
; Exit: 		None.						      :
;									      :
; Entry point:		None.						      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	None.						      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
SET_DEFAULT    PROC FAR
;
	       PUSH ES			     ;save default segment
	       PUSH DI			     ;save default offset
;
	       CALL FAR PTR GET_ICB	     ;get input control block
;
	       MOV  ES:[DI]+ICB_CURCHAR,1    ;reset starting cursor position
	       MOV  ES:[DI]+ICB_DEFLEN,CX    ;set length
	       POP  ES:[DI]+ICB_DEFOFF	     ;offset
	       POP  ES:[DI]+ICB_DEFSEG	     ;segment
;
	       RET
SET_DEFAULT    ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		GET_PCB 					      :
;									      :
; Description:		Return address of specified panel control block.      :
;									      :
; Entry:		AX	      = Number of PCB vector desired.	      :
;									      :
;			COM_PCBVECSEG = PCB vector segment.		      :
;			COM_PCBVECOFF = PCB vector offset.		      :
;			COM_PCBVECLEN = number of bytes in each vector	      :
;									      :
; Exit: 		ES:DI = Address of specified PCB		      :
;									      :
; Entry point:								      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	None.						      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
GET_PCB        PROC FAR
;
	       PUSH AX
	       PUSH BX
	       PUSH CX
	       PUSH DX
;
; read panel control block vector to obtain PCB address
;
	       MOV  BX,COM_PCBVECSEG	    ;get beginning PCB vector address
	       MOV  ES,BX
	       MOV  DI,COM_PCBVECOFF
;
	       DEC  AX			     ;make zero based
	       MOV  BX,COM_PCBVECLEN	     ;multiply PCB element length by
					     ; desired vector number in BX
	       MUL  BX			     ; to determine offset into PCB vec
	       ADD  DI,AX		     ;add offset inside table
	       MOV  BX,ES:[DI]		     ;get actual PCB segment
	       MOV  CX,ES:[DI]+2	     ;point past PCB seg to get PCB off
;
	       MOV  ES,BX		     ;set ES:DI to panel's actual
	       MOV  DI,CX		     ; PCB address
;
	       POP  DX
	       POP  CX
	       POP  BX
	       POP  AX
;
	       RET
GET_PCB        ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		GET_SCB 					      :
;									      :
; Description:		Return address of specified scroll control block.     :
;									      :
; Entry:		AX	      = Number of SCB vector desired.	      :
;									      :
;			COM_SCBVECSEG = SCB vector segment.		      :
;			COM_SCBVECOFF = SCB vector offset.		      :
;			COM_SCBVECLEN = number bytes in each vector	      :
;									      :
; Exit: 		ES:DI = Address of specified SCB		      :
;									      :
; Entry point:								      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	None.						      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
GET_SCB        PROC NEAR
;
	       PUSH AX
	       PUSH BX
	       PUSH CX
	       PUSH DX
;
; read panel control block vector to obtain SCB address
;
	       MOV  BX,COM_SCBVECSEG	    ;get beginning SCB vector address
	       MOV  ES,BX
	       MOV  DI,COM_SCBVECOFF
;
	       DEC  AX			     ;make zero based
	       MOV  BX,COM_SCBVECLEN	     ;multiply SCB element length by
					     ; desired vector number in BX
	       MUL  BX			     ; to determine offset into SCB vec
	       ADD  DI,AX		     ;add offset inside table
	       MOV  BX,ES:[DI]		     ;get actual SCB segment
	       MOV  CX,ES:[DI]+2	     ;point past SCB seg to get SCB off
;
	       MOV  ES,BX		     ;set ES:DI to panel's actual
	       MOV  DI,CX		     ; PCB address
;
	       POP  DX
	       POP  CX
	       POP  BX
	       POP  AX
;
	       RET
GET_SCB        ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		GET_ICB 					      :
;									      :
; Description:		Return address of specified input control block.      :
;									      :
; Entry:		AX	      = Number of ICB vector desired.	      :
;									      :
;			COM_ICBVECSEG = ICB vector segment.		      :
;			COM_ICBVECOFF = ICB vector offset.		      :
;			COM_ICBVECLEN = vector length.			      :
;									      :
; Exit: 		ES:DI = Address of specified ICB		      :
;									      :
; Entry point:								      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	None.						      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
GET_ICB        PROC FAR
;
	       PUSH AX
	       PUSH BX
	       PUSH CX
	       PUSH DX
;
; read input control block vector to obtain PCB address
;
	       MOV  BX,COM_ICBVECSEG	    ;get beginning ICB vector address
	       MOV  ES,BX
	       MOV  DI,COM_ICBVECOFF
;
	       DEC  AX			     ;make zero based
	       MOV  BX,COM_ICBVECLEN	     ;multiply ICB element length by
					     ; desired vector number in BX
	       MUL  BX			     ; to determine offset into ICB vec
	       ADD  DI,AX		     ;add offset inside table
	       MOV  BX,ES:[DI]		     ;get actual ICB segment
	       MOV  CX,ES:[DI]+2	     ;point past ICB seg to get ICB off
;
	       MOV  ES,BX		     ;set ES:DI to input's actual
	       MOV  DI,CX		     ; ICB address
;
	       TEST COM_STATE,COM_TEXT	     ;check if in text mode
	       JE   GIEXIT
;
	       AND  ES:[DI]+ICB_OPT1,NOT ICB_BOX
					     ;if in text mode deactivate box
					     ; option
;
GIEXIT:        POP  DX
	       POP  CX
	       POP  BX
	       POP  AX
;
	       RET
GET_ICB        ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		GET_ERROR					      :
;									      :
; Description:		Return address of error message.		      :
;									      :
; Entry:		AX	      = Number of vector desired.	      :
;									      :
;			COM_ERRVECSEG = Error message vector segment.	      :
;			COM_ERRVECOFF = Error message vector offset.	      :
;			COM_ERRVECLEN = Length of each vector in bytes.       :
;									      :
; Exit: 		ES:DI = Address of specified error message.	      :
;			AX    = length of error message.		      :
;									      :
; Entry point:		GET_ERROR					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	None.						      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
GET_ERROR      PROC FAR
;
	       PUSH BX
	       PUSH CX
	       PUSH DX
;
; read error message vector
;
	       MOV  BX,COM_ERRVECSEG	     ;get beginning vector address
	       MOV  ES,BX
	       MOV  DI,COM_ERRVECOFF
;
	       DEC  AX			     ;make zero based
	       MOV  BX,COM_ERRVECLEN	     ;multiply element length by
					     ; desired vector number in BX
	       MUL  BX			     ; to determine offset into vector
	       ADD  DI,AX		     ;add offset inside table
	       MOV  CX,ES:[DI]		     ;get error text offset
	       XOR  AX,AX		     ;clear to zero
	       MOV  AL,ES:[DI]+2	     ;get error text length
;
	       MOV  DI,CX		     ;set ES:DI to panel's actual
					     ; PCB address
;
	       POP  DX
	       POP  CX
	       POP  BX
;
	       RET
GET_ERROR      ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		GET_BUTTON					      :
;									      :
; Description:		Return address of graphics button.		      :
;									      :
; Entry:		AX	      = Number of vector desired.	      :
;									      :
;			COM_BCBVECSEG = vector segment. 		      :
;			COM_BCBVECOFF = vector offset.			      :
;			COM_BCBVECLEN = Length of each vector in bytes.       :
;									      :
; Exit: 		ES:DI = Address of specified string.		      :
;									      :
; Entry point:		GET_BUTTON					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	None.						      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
GET_BUTTON     PROC NEAR
;
	       PUSH BX
	       PUSH CX
	       PUSH DX
;
; read keystroke vector
;
	       MOV  BX,COM_BCBVECSEG	    ;get beginning vector address
	       MOV  ES,BX
	       MOV  DI,COM_BCBVECOFF
;
	       DEC  AX			     ;make zero based
	       MOV  BX,COM_BCBVECLEN	     ;multiply element length by
					     ; desired vector number in BX
	       MUL  BX			     ; to determine offset into vector
	       ADD  DI,AX		     ;add offset inside table
	       MOV  CX,ES:[DI]		     ;get text offset
	       MOV  DI,CX		     ;set ES:DI to actual data
;
	       POP  DX
	       POP  CX
	       POP  BX
;
	       RET
GET_BUTTON     ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		GET_STRING					      :
;									      :
; Description:		Return address of string.			      :
;									      :
; Entry:		AX	      = Number of ICB vector desired.	      :
;									      :
;			COM_STRVECSEG = String vector segment.		      :
;			COM_STRVECOFF = String vector offset.		      :
;			COM_STRVECLEN = Length of each vector in bytes.       :
;									      :
; Exit: 		ES:DI = Address of specified string.		      :
;			AX    = length of string.			      :
;									      :
; Entry point:		GET_STRING					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	None.						      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
GET_STRING     PROC FAR
;
	       PUSH DX
	       PUSH BX
	       PUSH CX
;
; read error message vector
;
	       MOV  BX,COM_STRVECSEG	    ;get beginning vector address
	       MOV  ES,BX
	       MOV  DI,COM_STRVECOFF
;
	       DEC  AX			     ;make zero based
	       MOV  BX,COM_STRVECLEN	     ;multiply element length by
					     ; desired vector number in BX
	       MUL  BX			     ; to determine offset into vector
	       ADD  DI,AX		     ;add offset inside table
	       MOV  CX,ES:[DI]		     ;get text offset
	       XOR  AX,AX		     ;clear to zero
	       MOV  AL,ES:[DI]+2	     ;get text length
;
	       MOV  DI,CX		     ;set ES:DI to actual data
;
	       POP  CX
	       POP  BX
	       POP  DX
;
	       RET
GET_STRING     ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		GET_ATTR					      :
;									      :
; Description:		Returns the normal and highlight color attributes     :
;			of a specified panel.				      :
;									      :
;									      :
; Entry:		AX	      = Panel ID number.		      :
;									      :
; Exit: 		AH	      = Panel's normal color attr             :
;			AL	      = Panel's highlight color attr          :
;									      :
; Entry point:		GET_ATTR					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	None.						      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
GET_ATTR       PROC FAR
;
	       PUSH ES			     ;save registers
	       PUSH DI
;
	       CALL FAR PTR GET_PCB	     ;load the panel's PCB in ES:DI
	       MOV  AX,ES:[DI]+PCB_CCBID     ;get panel's color index number
;
	       CALL FAR PTR GET_COLOR	     ;load the color index
	       MOV  AH,ES:[DI]+CCB_A1	     ;get the normal color attr
	       MOV  AL,ES:[DI]+CCB_A2	     ;get the highlighted color attr
;
	       POP  DI			     ;restore registers
	       POP  ES
;
	       RET
GET_ATTR       ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		GET_COLOR					      :
;									      :
; Description:		Returns ES:DI pointing to color index specified in    :
;			AX.  Use the CCB_PB to reference the desired color    :
;			attributes.					      :
;									      :
; Entry:		AX	      = Color index to return.		      :
;			CRD_CCBVECOFF = Offset of color index.		      :
;			CRD_CCBVECSEG = Segment of color index. 	      :
;									      :
; Exit: 		ES:DI	      = Address of color index		      :
;									      :
; Entry point:		GET_COLOR					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	None.						      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
GET_COLOR      PROC FAR
;
	       PUSH AX			     ;save registers
	       PUSH BX
	       PUSH DX
;
	       DEC  AX			     ; default index and make zero
					     ; based
	       PUSH CRD_CCBVECSEG	     ;get color index segment
	       POP  ES
;
	       PUSH CRD_CCBVECOFF	     ;get color index offset
	       POP  DI
;
	       MOV  BX,COM_CCBLEN	     ;multiply CCB element length by
	       MUL  BX			     ; desired vector add offset
	       ADD  DI,AX		     ; to color index offset
;
	       POP  DX			     ;restore registers
	       POP  BX
	       POP  AX
;
	       RET
GET_COLOR      ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		SET_SHLVMDOS					      :
;									      :
; Description:		Set shell video mode from current DOS video mode.     :
;									      :
; Entry:		COM_STATE    = Option word indicating invocation      :
;				       parameters passed through PSP.	      :
;									      :
; Exit: 		PCGVIDO      = Parmeter block initialized.	      :
;			COM_DVIDMODE = Original DOS video mode. 	      :
;			COM_SVIDMODE = Current Shell video mode.	      :
;									      :
; Entry point:		SET_SHLVMDOS					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	PCGVIDO_CALL					      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
SET_SHLVMDOS   PROC NEAR
;
	       LEA  DI,GEN_DATA 	     ;load offset of PCGRAPH PB
	       MOV  [DI]+G_INITVFLAG,0	     ;init to VGA hardware available
;
; Check if mode 10H requested
;
	       TEST COM_STATE,COM_M10H	     ;check if graphics mode 10H
	       JE   VMD20		     ; requested (EGA/VGA)
;
	       TEST GV_STAT1,GV_256K	     ;256K memory on EGA card
	       JNE  VMD10
;
	       MOV  COM_ERRID,ERR_256K	     ;set error for less than 256KB
	       JMP  VMDEXIT		     ; available on graphics adaphter
;
VMD10:	       MOV  AL,10H		     ;set for mode 10H
	       JMP  VMD60
;
; Check if mode 11H requested
;
VMD20:	       TEST COM_STATE,COM_M11H	     ;check if graphics mode 11H
	       JE   VMD40		     ; requested (VGA/MCGA)
;
	       TEST GV_STAT1,GV_EGAA	     ;check if VGA/EGA hardware avail
	       JNE  VMD30
;
	       CMP  GE_MODEL,MODEL_30	     ;check for MCGA support
	       JNE  VMD30
;
	       OR   IN_OPT,IN_MCGA	     ;MCGA active
	       MOV  [DI]+G_INITVFLAG,G_INITNOVGA
					     ;no VGA hardware available
;
VMD30:	       MOV  AL,11H		     ;set for mode 11H
	       JMP  VMD60
;
; check if mode 12H requested
;
VMD40:	       TEST COM_STATE,COM_M12H	     ;check if graphics mode 12H
	       JE   VMD70
;
	       TEST GV_STAT1,GV_256K	     ;256K memory on EGA card
	       JNE  VMD50
;
	       MOV  COM_ERRID,ERR_256K	     ;set error for less than 256KB
	       JMP  VMDEXIT		     ; available on graphics adaphter
;
VMD50:	       MOV  AL,12H		     ;set for mode 12H
;
; set graphics video mode
;
VMD60:	       CMP  AL,12H		     ;check for mode 12H
	       JE   VMD62
;
	       CMP  AL,11H		     ;check for mode 11H
	       JE   VMD62
;
	       JMP  VMD65		     ;must be mode 10H
;
VMD62:	       CMP  GE_MODEL,MODEL_30	     ;check if model 30
	       JE   VMD65
;
	       CMP  GE_MODEL,MODEL_25	     ;check if model 25
	       JE   VMD65
;
	       PUSH AX
	       MOV  AX, 1A00H		     ;BIOS check display
	       INT  10H
	       CMP  AL, 1AH		     ;VGA supported?
	       POP  AX
	       JE   VMD65		     ;yes, continue
;
	       MOV  AL,0		     ;set error in video mode
	       JMP  VMD80		     ;exit
;
VMD65:	       MOV  [DI]+G_INITVMODE,AL      ;set desired graphics video mode
	       MOV  [DI]+G_FUNC,G_INIT	     ;initialize graphics support
	       MOV  BX,DATA		     ;point to general PCGRAPH
	       MOV  ES,BX		     ; initialize parameter block
	       PUSH AX
	       CALL PCGRAPH_CALL	     ;initialize graphics
	       POP  AX
	       JMP  VMD80
;
; set text video mode
;
VMD70:	       MOV  AL,7		     ;initialize
	       CMP  AL,COM_DVIDMODE	     ;if monochrome text mode is active
	       JE   VMD80		     ; no need to set mode
;
	       MOV  AL,3
	       CMP  AL,COM_DVIDMODE	     ;if color text mode is active no
	       JE   VMD80		     ; need to set mode
;
	       XOR  AH,AH		     ;set to color text mode
	       PUSH AX			     ;save
	       INT  10H
	       POP  AX			     ;restore
;
; read all video information and check if mode set successful
;
VMD80:	       CALL PCGVIDO_CALL	     ;get new video information and
	       CMP  AL,GV_VIDMODE	     ; check if mode set successful
	       JE   VMD100		     ;yes
;
	       MOV  COM_ERRID,ERR_MODE	     ;requested video mode failed
	       JMP  VMDEXIT
;
VMD100:        MOV  COM_SVIDMODE,AL	     ;save current shell video mode
	       cmp  al, 7		     ;monochrome text mode active?
	       jne  vmd101		     ;no, continue
	       and  COM_STATE,not COM_FLCS   ;inactivate color change
vmd101:
	       CALL FAR PTR CURSOROFF	     ;deactive cursor
;
VMDEXIT:				     ;exit
;
	       RET
SET_SHLVMDOS   ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		SET_DOSVMSHL					      :
;									      :
; Description:		Set original DOS video mode from current shell mode   :
;			and disable mouse support			      :
;									      :
; Entry:		PCGVIDO      = Parmeter block initialized.	      :
;			COM_DVIDMODE = Original DOS video mode. 	      :
;			COM_SVIDMODE = Current Shell video mode.	      :
;			COM_STATE    = Invocation options.		      :
;									      :
; Exit: 		PCGVIDO      = Parmeter block initialized.	      :
;									      :
; Entry point:		SET_DOSVMSHL					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	PCGVIDO_CALL					      :
;			PCTRACK_CALL					      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
SET_DOSVMSHL   PROC NEAR
;
; Disable mouse support
;
	       CALL FAR PTR MOUSE_DIS	     ;disable mouse support
;
; Check if shell is in text mode
;
VMS10:	       CMP  COM_STATE,COM_TEXT
	       JNE  VMS20
;
; Terminate shell graphics mode and restore original DOS video mode
;
	       LEA  DI,GEN_DATA 	     ;load offset of PCGRAPH PB
	       MOV  [DI]+G_FUNC,G_TERM	     ;terminate graphics support
	       MOV  BX,DATA		     ;point to general PCGRAPH
	       MOV  ES,BX		     ;initialize parameter block
	       CALL PCGRAPH_CALL	     ;initialize graphics
	       JMP  VMSEXIT
;
; Shell is in text video mode, restore original DOS video mode
;
VMS20:	       MOV  AL,COM_DVIDMODE	     ;if shell mode and DOS mode are
	       XOR  AH,AH		     ;shell and DOS modes are different
	       INT  10H 		     ; reset original DOS mode
;
; Exit
;
VMSEXIT:       MOV  AL,0		     ;clear screen
	       MOV  CH,0
	       MOV  CL,0
	       MOV  DX,GV_NUMLINES	     ;set DH to bottom row
	       MOV  DL,80		     ;set DL to screen width in chars
	       MOV  BH,07H		     ;set white on black color
	       MOV  AH,6
	       INT  10H
;
	       CALL FAR PTR CURSORON
	       CALL PCGVIDO_CALL
;
	       RET
SET_DOSVMSHL   ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		SET_CMDVMSHL					      :
;									      :
; Description:		Set shell command line video mode from current shell  :
;			mode.						      :
;									      :
; Entry:		PCGVIDO      = Parmeter block initialized.	      :
;			COM_DVIDMODE = Original DOS video mode. 	      :
;			COM_STATE    = Invocation options.		      :
;									      :
; Exit: 		COM_CVIDMODE = Shell command line video mode.	      :
;			PCGVIDO      = Parmeter block initialized.	      :
;									      :
; Entry point:		SET_CMDVMSHL					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	PCGVIDO_CALL					      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
SET_CMDVMSHL   PROC FAR
;
; Check if shell text mode is active
;
	       CMP  COM_STATE,COM_TEXT
	       JE   CMDEXIT
;
; Terminate shell graphics mode and restore original DOS video mode
;
	       LEA  DI,GEN_DATA 	     ;load offset of PCGRAPH PB
	       MOV  [DI]+G_FUNC,G_TERM	     ;terminate graphics support
	       MOV  BX,DATA		     ;point to general PCGRAPH
	       MOV  ES,BX		     ;initialize parameter block
	       CALL PCGRAPH_CALL	     ;initialize graphics
;
; Set shell command line to text video mode
;
	       MOV  AL,7		     ;initialize to monochrome mode
	       CMP  COM_DVIDMODE,AL	     ;check if DOS video mode was
	       JE   CMD10		     ; monochrome
;
	       MOV  AL,3		     ;set color text mode
;
CMD10:	       XOR  AH,AH		     ;set command line video mode
	       INT  10H
;
; Exit
;
CMDEXIT:       CALL PCGVIDO_CALL
;
	       RET
SET_CMDVMSHL   ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		SET_SHLVMCMD					      :
;									      :
; Description:		Set shell video mode from shell command line video    :
;			mode.						      :
;									      :
; Entry:		COM_STATE    = Option word indicating invocation      :
;				       parameters passed through PSP.	      :
;									      :
; Exit: 		PCGVIDO      = Parmeter block initialized.	      :
;			COM_DVIDMODE = Original DOS video mode. 	      :
;			COM_SVIDMODE = Current Shell video mode.	      :
;									      :
; Entry point:		SET_SHLVMCMD					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	PCGVIDO_CALL					      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
SET_SHLVMCMD   PROC FAR
;
; Check if shell graphics modes 10H, 11H, and 12H were active
;
	       LEA  DI,GEN_DATA 	     ;load offset of PCGRAPH PB
	       MOV  [DI]+G_INITVFLAG,0
;
	       TEST COM_STATE,COM_M11H	     ;check if graphics mode 11H
	       JE   SMC20		     ; requested (VGA/MCGA)
;
	       TEST GV_STAT1,GV_EGAA	     ;check if VGA/EGA hardware avail
	       JNE  SMC10
;
	       CMP  GE_MODEL,MODEL_30	     ;check for MCGA support
	       JNE  SMC10
;
	       OR   IN_OPT,IN_MCGA	     ;MCGA active
	       MOV  [DI]+G_INITVFLAG,G_INITNOVGA
					     ;no VGA hardware available
;
SMC10:	       MOV  AL,11H		     ;set for mode 11H
	       JMP  SMC50
;
SMC20:	       CMP  COM_SVIDMODE,10H	     ;check if mode 10 active
	       JE   SMC50
;
	       CMP  COM_SVIDMODE,12H	     ;check if mode 12 active
	       JE   SMC50
;
	       MOV  AH,0FH		     ;get current video mode
	       INT  10H
;
	       CMP  AL,COM_SVIDMODE	     ;check if command line video mode
	       JNE  SMC30		     ; changed and reset if yes
;
	       JMP  SMCEXIT
;
; Switch to monochrome monitor
;
SMC30:	       CMP  COM_SVIDMODE,3H	     ;check if color mode should be set
	       JE   SMC40
;
	       PUSH DS
;
	       XOR  AX,AX		     ;clear to zero
	       MOV  ES,AX		     ;point to BIOS data area and
	       MOV  DL,ES:[410H]	     ; get mode byte
	       OR   DL,00110000B
	       MOV  ES:[410H],DL
	       XOR  AH,AH		     ;set color monochrome mode
	       MOV  AL,7H
	       INT  10H
;
	       POP  DS
;
	       JMP  SMCEXIT
;
; Switch to color monitor in text mode 80x25
;
SMC40:	       PUSH DS
;
	       XOR  AX,AX		     ;clear to zero
	       MOV  ES,AX		     ;point to BIOS data area and
	       MOV  DL,ES:[410H]	     ; get mode byte
	       AND  DL,11001111B
	       OR   DL,00100000B
	       MOV  ES:[410H],DL
	       XOR  AH,AH		     ;set color mode
	       MOV  AL,3H
	       INT  10H
;
	       POP  DS
;
	       JMP  SMCEXIT
;
; Initialize shell graphics mode from shell command line text mode
;
SMC50:	       MOV  AH,0FH		     ;get current video mode
	       INT  10H
;
	       CMP  AL,7H		     ;check if command line mode set
	       JNE  SMC60		     ; for monochrome, if yes reset to
					     ; graphics monitor
;
	       PUSH DS
;
	       XOR  AX,AX		     ;clear to zero
	       MOV  ES,AX		     ;point to BIOS data area and
	       MOV  DL,ES:[410H]	     ; get mode byte
	       AND  DL,11001111B
	       OR   DL,00100000B
	       MOV  ES:[410H],DL
	       XOR  AH,AH		     ;set color 80x25 mode before
	       MOV  AL,3H		     ; setting graphics mode
	       INT  10H
;
	       POP  DS
;
SMC60:	       LEA  DI,GEN_DATA 	     ;load offset of PCGRAPH PB
	       MOV  AL,COM_SVIDMODE	     ;set the shell graphics video mode
	       MOV  [DI]+G_INITVMODE,AL
	       MOV  [DI]+G_FUNC,G_INIT	     ;initialize graphics support
	       MOV  BX,DATA		     ;point to general PCGRAPH
	       MOV  ES,BX		     ;initialize parameter block
	       CALL PCGRAPH_CALL	     ;initialize graphics
;
; Exit
;
SMCEXIT:       CALL PCGVIDO_CALL
;
	       RET
SET_SHLVMCMD   ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		CURSOROFF					      :
;									      :
; Description:		Deactivates hardware cursor from display.	      :
;									      :
; Entry:		None						      :
;									      :
; Exit: 		None.						      :
;									      :
; Entry point:		CURSOROFF					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	None.						      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
CURSOROFF      PROC FAR
;
	       PUSH AX			     ;save registers
	       PUSH BX
	       PUSH CX
;
	       MOV  AH,3		     ;function to get cursor info
	       MOV  BH,0		     ;page zero
	       INT  10H
	       OR   CH,20H		     ;set bit 6
	       MOV  AH,1		     ;function to set cursor
	       INT  10H
;
	       POP  CX			     ;restore registers
	       POP  BX
	       POP  AX
;
	       RET
CURSOROFF      ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		CURSORON					      :
;									      :
; Description:		Displays the hardare cursor.			      :
;									      :
; Entry:		None.						      :
;									      :
; Exit: 		None.						      :
;									      :
; Entry point:		CURSORON					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	None.						      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
CURSORON       PROC FAR
;
	       PUSH AX			     ;save registers
	       PUSH BX
	       PUSH CX
	       PUSH DX			     ;>>SN
;
	       MOV  AH,3		     ;function to get cursor info
	       MOV  BH,0		     ;page zero
	       INT  10H
	       AND  CH,NOT 20H		     ;clear bit 6
	       MOV  AH,1		     ;function to set cursor
	       INT  10H
;
	       POP  DX			     ;>>SN
	       POP  CX			     ;restore registers
	       POP  BX
	       POP  AX
;
	       RET
CURSORON       ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		PCINPUT_CALL					      :
;									      :
; Description:		Call to PCINPUT.				      :
;									      :
; Entry:		PCINPUT parameter block initialized.		      :
;									      :
; Exit: 		PCINPUT parameter block initialized.		      :
;									      :
; Entry point:		PCINPUT_CALL					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	None.						      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
PCINPUT_CALL   PROC FAR
;
	       PUSH DS			     ;set segment
	       POP  ES
;
	       PUSH DS
	       PUSH DI			     ;save registers
;
	       TEST COM_STATE2,COM_DBCS      ;check if DBCS option active
	       JE   INPT10
;
	       OR  IN_OPT,IN_DDBCS+IN_ADBCS  ;activate DBCS
;
INPT10:        LEA  DI,IN_OPT		     ;set DI to proper parameter block
					     ; for call
IF CASRM
	       MOV  AH,00H		     ;make call to CAS-RM
	       MOV  BX,IN_RN		     ;set CAS routine number
	       INT  CASINT		     ;call routine
ELSE
	       CALL INPUT
ENDIF
	       POP  DI			     ;restore registers
	       POP  DS
;
	       RET
PCINPUT_CALL   ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		PCINCHA_CALL					      :
;									      :
; Description:		Call to PCINCHA.				      :
;									      :
; Entry:		PCINCHA parameter block initialized.		      :
;									      :
; Exit: 		PCINCHA parameter block initialized.		      :
;									      :
; Entry point:		PCINCHA_CALL					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	None.						      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
PCINCHA_CALL   PROC NEAR
;
	       PUSH DS			     ;set segment
	       POP  ES
;
	       PUSH DS
	       PUSH DI			     ;save registers
;
	       TEST COM_STATE2,COM_DBCS      ;check if DBCS option active
	       JE   INCH10
;
	       OR  INC_OPT,INC_DDBCS	     ;activate DBCS
;
INCH10:        LEA  DI,INC_OPT		     ;set DI to proper parameter block
					     ; for call
IF CASRM
	       MOV  AH,00H		     ;make call to CAS-RM
	       MOV  BX,INC_RN		     ;set CAS routine number
	       INT  CASINT		     ;call routine
ELSE
	       CALL INCHA
ENDIF
	       POP  DI			     ;restore registers
	       POP  DS
;
	       RET
PCINCHA_CALL   ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		PCDISPQ_CALL					      :
;									      :
; Description:		Call to PCDISPQ.				      :
;									      :
; Entry:		PCDISPQ parameter block initialized.		      :
;									      :
; Exit: 		PCDISPQ parameter block initialized.		      :
;									      :
; Entry point:		PCDISPQ_CALL					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	None.						      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
PCDISPQ_CALL   PROC NEAR
;
	       PUSH DS			     ;set segment
	       POP  ES
;
	       PUSH DS
	       PUSH DI			     ;save registers
;
	       LEA  DI,QM_OPT1		     ;set DI to proper parameter block
					     ; for call
IF CASRM
	       MOV  AH,00H		     ;make call to CAS-RM
	       MOV  BX,QM_RN		     ;set CAS routine number
	       INT  CASINT		     ;call routine
ELSE
	       CALL DISPQ
ENDIF
	       POP  DI			     ;restore registers
	       POP  DS
;
	       RET
PCDISPQ_CALL   ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		PCPANEL_CALL					      :
;									      :
; Description:		Initialize for call to PCPANEL including refresh of   :
;			input and scroll fields in the logical video buffer   :
;			before display. 				      :
;									      :
; Entry:		PCPANEL parameter block initialized.		      :
;									      :
;			AX  0= Logical video buffer mode write		      :
;			    1= Direct video mode write			      :
;									      :
; Exit: 		PCPANEL parameter block initialized.		      :
;									      :
; Entry point:		PCPANEL_CALL					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	None.						      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
PCPANEL_CALL   PROC NEAR
;
; initialize PCDISPQ info for PCPANEL call
;
	       CMP  AX,1		     ;check if direct video buffer
	       JE   PP10		     ; write option active
;
	       MOV  BX,QM_PANQUENUM
	       MOV  PM_PANQUENUM,BX	     ;number of panels in parent queue
;
	       MOV  BX,QM_CHDQUENUM
	       MOV  PM_CHDQUENUM,BX	     ;number panels in child queue
;
	       MOV  BX,QM_ACTIVEPAN
	       MOV  PM_ACTIVEPAN,BX	     ;active parent panel number
;
	       MOV  PM_OPT1,PM_DOA+PM_DOV+PM_DOQ+PM_CL
	       MOV  PM_PANPDQNUM,1	     ;beg/ending parent PDQ number
	       MOV  PM_PANBRKOFF,0	     ;panel off in lvb of break panel
;
; actual PCPANEL call
;
PP10:	       PUSH DS			     ;set segment
	       POP  ES
;
	       PUSH DS
	       PUSH DI			     ;save registers
;
	       LEA  DI,PM_OPT1		     ;set DI to proper parameter block
					     ; for call
IF CASRM
	       MOV  AH,00H		     ;make call to CAS-RM
	       MOV  BX,PM_RN		     ;set CAS routine number
	       INT  CASINT		     ;call routine
ELSE
	       CALL PANEL
ENDIF
	       POP  DI			     ;restore registers
	       POP  DS
;
; Exit
;
PPEXIT: 				     ;exit
;
	       RET
PCPANEL_CALL   ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		PCMBEEP_CALL					      :
;									      :
; Description:		Call to PCMBEEP.				      :
;									      :
; Entry:		PCMBEEP parameter block initialized.		      :
;									      :
; Exit: 		PCMBEEP parameter block initialized.		      :
;									      :
; Entry point:		PCMBEEP_CALL					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	None.						      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
PCMBEEP_CALL   PROC FAR
;
	       TEST COM_STATE2,COM_SOUD      ;check if sound is off
	       JE   BEXIT
;
	       PUSH CX			     ;save registers
	       PUSH DX
;
	       PUSH DS			     ;set segment
	       POP  ES
;
	       PUSH DS
	       PUSH DI			     ;save registers
;
	       LEA  DI,MB_FREQUENCY	     ;set DI to proper parameter block
					     ; for call
IF CASRM
	       MOV  AH,00H		     ;make call to CAS-RM
	       MOV  BX,MB_RN		     ;set CAS routine number
	       INT  CASINT		     ;call routine
ELSE
	       CALL MBEEP
ENDIF
	       POP  DI			     ;restore registers
	       POP  DS
;
	       POP  DX			     ;restore registers
	       POP  CX
;
BEXIT:
;
	       RET
PCMBEEP_CALL   ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		PCSLCTP_CALL					      :

;									      :
; Description:		Call to PCSLCTP.				      :
;									      :
; Entry:		ES:DI = beginning address of PCSLCTP parameter block. :
;									      :
; Exit: 		PCSLCTP parameter block initialized.		      :
;									      :
; Entry point:		PCSLCTP_CALL					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	None.						      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
PCSLCTP_CALL   PROC NEAR
;
; Initialize color index vector
;
	       MOV  AX,PM_CCBVECNUM	     ;set color index number
	       MOV  ES:[DI]+SCB_CCBVECNUM,AX
;
	       MOV  AX,CRD_CCBVECOFF	     ;set color index offset
	       MOV  ES:[DI]+SCB_CCBVECOFF,AX
;
	       MOV  AX,CRD_CCBVECSEG	     ;set color index segment
	       MOV  ES:[DI]+SCB_CCBVECSEG,AX
;
IF CASRM
	       MOV  AH,00H		     ;make call to CAS-RM
	       MOV  BX,SCB_RN		     ;set CAS routine number
	       INT  CASINT		     ;call slctopt
ELSE
	       CALL SLCTP
ENDIF
;
	       RET
PCSLCTP_CALL   ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		PCHLPRD_CALL					      :
;									      :
; Description:		Call to PCHLPRD.				      :
;									      :
; Entry:		PCHLPRD parameter block initialized.		      :
;									      :
; Exit: 		PCHLPRD parameter block initialized.		      :
;									      :
; Entry point:		PCHLPRD_CALL					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	None.						      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
PCHLPRD_CALL   PROC NEAR
;
	       PUSH DS			     ;set segment
	       POP  ES
;
	       PUSH DS
	       PUSH DI			     ;save registers
;
	       LEA  DI,HRD_OPT1 	      ;set DI to proper parameter block
					     ; for call
IF CASRM
	       MOV  AH,00H		     ;make call to CAS-RM
	       MOV  BX,HRD_RN		     ;set CAS routine number
	       INT  CASINT		     ;call routine
ELSE
	       CALL HLPRD
ENDIF
	       POP  DI			     ;restore registers
	       POP  DS
;
	       RET
PCHLPRD_CALL   ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		PCINSTR_CALL					      :
;									      :
; Description:		Call to PCINSTR.				      :
;									      :
; Entry:		PCINSTR parameter block initialized.		      :
;									      :
; Exit: 		PCINSTR parameter block initialized.		      :
;									      :
; Entry point:		PCINSTR_CALL					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	None.						      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
PCINSTR_CALL   PROC NEAR
;
	       PUSH DS			     ;set segment
	       POP  ES
;
	       PUSH DS
	       PUSH DI			     ;save registers
;
	       LEA  DI,INS_OPT		      ;set DI to proper parameter block
					     ; for call
IF CASRM
	       MOV  AH,00H		     ;make call to CAS-RM
	       MOV  BX,INS_RN		     ;set CAS routine number
	       INT  CASINT		     ;call routine
ELSE
	       CALL INSTRN
ENDIF
	       POP  DI			     ;restore registers
	       POP  DS
;
	       RET
PCINSTR_CALL   ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		PCGVIDO_CALL					      :
;									      :
; Description:		Call to PCGVIDO.				      :
;									      :
; Entry:		PCGVIDO parameter block initialized.		      :
;									      :
; Exit: 		PCGVIDO parameter block initialized.		      :
;									      :
; Entry point:		PCGVIDO_CALL					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	None.						      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
PCGVIDO_CALL   PROC NEAR
;
	       PUSH ES
;
	       PUSH DS			     ;set segment
	       POP  ES
;
	       PUSH DS
	       PUSH DI			     ;save registers
;
	       LEA  DI,GV_STAT1 	     ;set DI to proper parameter block
					     ; for call
;
IF CASRM
	       MOV  AH,00H		     ;make call to CAS-RM
	       MOV  BX,GV_RN		     ;set CAS routine number
	       INT  CASINT		     ;call routine
ELSE
	       CALL GVIDO
ENDIF
	       POP  DI			     ;restore registers
	       POP  DS
;
	       POP  ES
;
	       RET
PCGVIDO_CALL   ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		PCCLRWR_CALL					      :
;									      :
; Description:		Call to PCCLRWR.				      :
;									      :
; Entry:		PCCLRWR parameter block initialized.		      :
;									      :
; Exit: 		PCCLRWR parameter block initialized.		      :
;									      :
; Entry point:		PCCLRWR_CALL					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	None.						      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
PCCLRWR_CALL   PROC NEAR
;
	       PUSH DS			     ;set segment
	       POP  ES
;
	       PUSH DS
	       PUSH DI			     ;save registers
;
	       LEA  DI,CWR_OPT		     ;set DI to proper parameter block
					     ; for call
IF CASRM
	       MOV  AH,00H		     ;make call to CAS-RM
	       MOV  BX,CWR_RN		     ;set CAS routine number
	       INT  CASINT		     ;call routine
ELSE
	       CALL CLRWR
ENDIF
	       POP  DI			     ;restore registers
	       POP  DS
;
	       RET
PCCLRWR_CALL   ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		PCCRITE_CALL					      :
;									      :
; Description:		Call to PCCRITE.				      :
;									      :
; Entry:		PCCRITE parameter block initialized.		      :
;									      :
; Exit: 		PCCRITE parameter block initialized.		      :
;									      :
; Entry point:		PCCRITE_CALL					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	None.						      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
PCCRITE_CALL   PROC NEAR
;
	       PUSH DS			     ;set segment
	       POP  ES
;
	       PUSH DS
	       PUSH DI			     ;save registers
;
	       LEA  DI,CE_OPT		     ;set DI to proper parameter block
					     ; for call
;
IF CASRM
	       MOV  AH,00H		     ;make call to CAS-RM
	       MOV  BX,CE_RN		     ;set CAS routine number
	       INT  CASINT		     ;call routine
ELSE
	       CALL CRITE
ENDIF
	       POP  DI			     ;restore registers
	       POP  DS
;
	       RET
PCCRITE_CALL   ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		PCWWRAP_CALL					      :
;									      :
; Description:		Call to PCWWRAP.				      :
;									      :
; Entry:		PCWWRAP parameter block initialized.		      :
;									      :
; Exit: 		PCWWRAP parameter block initialized.		      :
;									      :
; Entry point:		PCWWRAP_CALL					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	None.						      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
PCWWRAP_CALL   PROC NEAR
;
	       PUSH DS			     ;set segment
	       POP  ES
;
	       PUSH DS
	       PUSH DI			     ;save registers
;
	       LEA  DI,WWP_OPT1 	     ;set DI to proper parameter block
					     ; for call
;
IF CASRM
	       MOV  AH,00H		     ;make call to CAS-RM
	       MOV  BX,WWP_RN		     ;set CAS routine number
	       INT  CASINT		     ;call routine
ELSE
	       CALL WWRAP
ENDIF
	       POP  DI			     ;restore registers
	       POP  DS
;
	       RET
PCWWRAP_CALL   ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		PCTRACK_CALL					      :
;									      :
; Description:		Call to PCTRACK.				      :
;									      :
; Entry:		PCTRACK parameter block initialized.		      :
;									      :
; Exit: 		PCTRACK parameter block initialized.		      :
;									      :
; Entry point:		PCTRACK_CALL					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	None.						      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
PCTRACK_CALL   PROC FAR
;
	       PUSH DS
	       PUSH DI			     ;save registers
;
	       PUSH DS			     ;point to PCTRACK parameter block
	       POP  ES
;
IF CASRM
	       MOV  AH,00H		     ;make call to CAS-RM
	       MOV  BX,MS_RN		     ;set CAS routine number
	       INT  CASINT		     ;call routine
ELSE
	       CALL TRACK
ENDIF
	       POP  DI			     ;restore registers
	       POP  DS
;
	       RET
PCTRACK_CALL   ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		PCGRAPH_CALL					      :
;									      :
; Description:		Call to PCGRAPH.				      :
;									      :
; Entry:		PCGRAPH parameter block initialized.		      :
;									      :
; Exit: 		PCGRAPH parameter block initialized.		      :
;									      :
; Entry point:		PCGRAPH_CALL					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	None.						      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
PCGRAPH_CALL   PROC NEAR
;
	       PUSH DS
	       PUSH DI			     ;save registers
;
IF CASRM
	       MOV  AH,00H		     ;make call to CAS-RM
	       MOV  BX,MS_RN		     ;set CAS routine number
	       INT  CASINT		     ;call routine
ELSE
	       CALL GRAPH
ENDIF
	       POP  DI			     ;restore registers
	       POP  DS
;
	       RET
PCGRAPH_CALL   ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		PCST2IN_CALL					      :
;									      :
; Description:		Call to PCST2IN.				      :
;									      :
; Entry:		PCST2IN parameter block initialized.		      :
;									      :
; Exit: 		PCST2IN parameter block initialized.		      :
;									      :
; Entry point:		PCST2IN_CALL					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	None.						      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
PCST2IN_CALL   PROC NEAR
;
	       PUSH DS			     ;set segment
	       POP  ES
;
	       PUSH DS
	       PUSH DI			     ;save registers
;
	       LEA  DI,ST2_OPT1 	     ;set DI to proper parameter block
					     ; for call
;
IF CASRM
	       MOV  AH,00H		     ;make call to CAS-RM
	       MOV  BX,S2I_RN		     ;set CAS routine number
	       INT  CASINT		     ;call routine
ELSE
	       CALL ST2IN
ENDIF
	       POP  DI			     ;restore registers
	       POP  DS
;
	       RET
PCST2IN_CALL   ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		PCMOVEC_CALL					      :
;									      :
; Description:		Call to PCMOVEC.				      :
;									      :
; Entry:		PCMOVEC parameter block initialized.		      :
;									      :
; Exit: 		PCMOVEC parameter block initialized.		      :
;									      :
; Entry point:		PCMOVEC_CALL					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	None.						      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
PCMOVEC_CALL   PROC NEAR
;
	       PUSH DS			     ;set segment
	       POP  ES
;
	       PUSH DS
	       PUSH DI			     ;save registers
;
	       LEA  DI,MO_OPT		     ;set DI to proper parameter block
					     ; for call
;
IF CASRM
	       MOV  AH,00H		     ;make call to CAS-RM
	       MOV  BX,MO_RN		     ;set CAS routine number
	       INT  CASINT		     ;call routine
ELSE
	       CALL MOVEC
ENDIF
	       POP  DI			     ;restore registers
	       POP  DS
;
	       RET
PCMOVEC_CALL   ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		SHELLDA_CALL					      :
;									      :
; Description:		Call to SHELLDA.				      :
;									      :
; Entry:		None						      :
;									      :
; Exit: 		None						      :
;									      :
; Entry point:		SHELLDA_CALL					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	None.						      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
SHELLDA_CALL   PROC NEAR
;
	       CALL SHELLDA
;
	       RET
SHELLDA_CALL   ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; PCROWCL_CALL								      :
;									      :
;	  Call to PCROWCL.						      :
;									      :
; Entry:  PB initialized.						      :
;									      :
; Exit:   None								      :
;									      :
; Notes:  None								      :
;									      :
;-----------------------------------------------------------------------------+
;
PCROWCL_CALL   PROC NEAR

	       PUSH ES
	       PUSH DS			     ;set segment
	       POP  ES

	       PUSH DS
	       PUSH DI			     ;save registers

	       LEA  DI,CR_SCRWIDTH	     ;set DI to proper parameter block
					     ; for call
IF CASRM
	       MOV  AH,00H		     ;make call to CAS-RM
	       MOV  BX,CR_RN		     ;set CAS routine number
	       INT  CASINT		     ;call routine
ELSE
	       CALL ROWCL
ENDIF
	       POP  DI			     ;restore registers
	       POP  DS
	       POP  ES
;
	       RET
PCROWCL_CALL   ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; PCMOVEG_CALL								      :
;									      :
;	  Call to PCMOVEG.						      :
;									      :
; Entry:  PB initialized.						      :
;									      :
; Exit:   None								      :
;									      :
; Notes:  None								      :
;									      :
;-----------------------------------------------------------------------------+
;
PCMOVEG_CALL   PROC NEAR

	       PUSH ES
	       PUSH DS			     ;set segment
	       POP  ES

	       PUSH DS
	       PUSH DI			     ;save registers

	       LEA  DI,MG_OPT		     ;set DI to proper parameter block
					     ; for call
IF CASRM
	       MOV  AH,00H		     ;make call to CAS-RM
	       MOV  BX,MG_RN		     ;set CAS routine number
	       INT  CASINT		     ;call routine
ELSE
	       CALL MOVEG
ENDIF
	       POP  DI			     ;restore registers
	       POP  DS
	       POP  ES
;
	       RET
PCMOVEG_CALL   ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; PCGEQUP_CALL								      :
;									      :
;	  Call to PCGEQUP.						      :
;									      :
; Entry:  PB initialized.						      :
;									      :
; Exit:   None								      :
;									      :
; Notes:  None								      :
;									      :
;-----------------------------------------------------------------------------+
;
PCGEQUP_CALL   PROC NEAR

	       PUSH ES
	       PUSH DS			     ;set segment
	       POP  ES

	       PUSH DS
	       PUSH DI			     ;save registers

	       LEA  DI,GE_OPT		     ;set DI to proper parameter block
					     ; for call
IF CASRM
	       MOV  AH,00H		     ;make call to CAS-RM
	       MOV  BX,MG_RN		     ;set CAS routine number
	       INT  CASINT		     ;call routine
ELSE
	       CALL GEQUP
ENDIF
	       POP  DI			     ;restore registers
	       POP  DS
	       POP  ES
;
	       RET
PCGEQUP_CALL   ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; PCDATES_CALL								      :
;									      :
;	  Call to PCDATES.						      :
;									      :
; Entry:  PB initialized.						      :
;									      :
; Exit:   None								      :
;									      :
; Notes:  None								      :
;									      :
;-----------------------------------------------------------------------------+
;
PCDATES_CALL   PROC NEAR

	       PUSH ES
	       PUSH DS			     ;set segment
	       POP  ES

	       PUSH DS
	       PUSH DI			     ;save registers

	       LEA  DI,DTS_OPT		     ;set DI to proper parameter block
					     ; for call
IF CASRM
	       MOV  AH,00H		     ;make call to CAS-RM
	       MOV  BX,DTS_RN		     ;set CAS routine number
	       INT  CASINT		     ;call routine
ELSE
	       CALL DATES
ENDIF
	       POP  DI			     ;restore registers
	       POP  DS
	       POP  ES
;
	       RET
PCDATES_CALL   ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; PCTIMES_CALL								      :
;									      :
;	  Call to PCTIMES.						      :
;									      :
; Entry:  PB initialized.						      :
;									      :
; Exit:   None								      :
;									      :
; Notes:  None								      :
;									      :
;-----------------------------------------------------------------------------+
;
PCTIMES_CALL   PROC NEAR

	       PUSH ES
	       PUSH DS			     ;set segment
	       POP  ES

	       PUSH DS
	       PUSH DI			     ;save registers

	       LEA  DI,TMS_OPT		     ;set DI to proper parameter block
					     ; for call
IF CASRM
	       MOV  AH,00H		     ;make call to CAS-RM
	       MOV  BX,TMS_RN		     ;set CAS routine number
	       INT  CASINT		     ;call routine
ELSE
	       CALL TIMES
ENDIF
	       POP  DI			     ;restore registers
	       POP  DS
	       POP  ES
;
	       RET
PCTIMES_CALL   ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		CHANGE_APPM					      :
;									      :
; Description:		Display Application menu screen.		      :
;									      :
; Entry:		None.						      :
;									      :
; Exit: 		COM_CDIALOG					      :
;									      :
; Entry point:		CHANGE_APPM					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	None.						      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
CHANGE_APPM    PROC FAR
;
	       TEST COM_STATE,COM_APPM	     ;check if app menu active
	       JNE  CAM10
;
	       CALL FAR PTR OPT_INACTIVE     ;display error panel for inactive *PCR
	       JMP  CAMEXIT
;
CAM10:	       MOV  COM_HLPOPT2,0	     ;set for normal shell help
	       MOV  COM_HCBIDAAB,HLP_AABPROGRAM
	       MOV  COM_HCBID,HLP_AABPROGRAM
;
	       MOV  AX,MFF_AABAOPT	     ;default to program menu AAB field
	       CALL FAR PTR LOC_MOUSEF
	       MOV  COM_CURAABF,AX
;
	       MOV  APP_SKIN,0		     ;set to reinitialize app menu fld
	       MOV  COM_CDIALOG,COM_PAAB     ;set for menu action bar dialog
	       MOV  COM_BASESCR,COM_APPSCR   ;initialize for display of DOS scr
;
CAMEXIT:
;
	       RET
CHANGE_APPM    ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		ALLOCATE_BUFB					      :
;									      :
; Description:		Allocate memory for directory and file buffers.       :
;									      :
; Entry:		COM_STATE2  = Invocation parameters.		      :
;			COM_DFSIZE  = Optional buffer override size in parags.:
;									      :
;			MAX_DIR1BUF = Size of directory buffer 1 in paragraph :
;			MAX_DIR2BUF = Size of directory buffer 2 in paragraph :
;			MAX_DOSWBUF = Size of view, copy, move working buffer :
;			MAX_EXECBUF = Size of app menu and/or command prompt  :
;				      free space to be made avail to dos in   :
;				      resident mode only.		      :
;									      :
;			Allocated by one DOS call with COM_DATA4SEG as	      :
;			starting segment.				      :
;									      :
;			COM_DATA4LEN  Optional DOS Services directory	      :
;			COM_DATA4OFF  list 1 buffer.			      :
;			COM_DATA4SEG					      :
;									      :
;			COM_DATA5LEN  Optional DOS Services directory	      :
;			COM_DATA5OFF  list 2 buffer.			      :
;			COM_DATA5SEG					      :
;									      :
;			COM_DATA6LEN  Optional DOS Services file list 1       :
;			COM_DATA6OFF  buffer				      :
;			COM_DATA6SEG					      :
;									      :
;			COM_DATA7LEN  Optional DOS Services file list 2       :
;			COM_DATA7OFF  buffer				      :
;			COM_DATA7SEG					      :
;									      :
;			COM_DATA8LEN  Optional DOS Services		      :
;			COM_DATA8OFF  buffer				      :
;			COM_DATA8SEG					      :
;									      :
; Entry point:		ALLOCATE_BUFB					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	None.						      :
;									      :
; External references:	INT 21H  48H Allocate memory			      :
;									      :
;-----------------------------------------------------------------------------+
;
ALLOCATE_BUFB  PROC FAR
;
	       TEST COM_STATE,COM_DOSS	     ;check if DOS Services configured
	       JNE  AMB05		     ;exit
;
	       JMP  AMBEXIT
;
; Determine avail memory, calc memory to allocate for shell functions
;
AMB05:	       MOV  AH,48H		     ;find out how many parags are aval
	       MOV  BX,0FFFFH		     ; in BX on return
	       INT  21H
;
; adjust for resident mode operation
;
	       TEST COM_STATE,COM_RESS	     ;check if resident mode is active
	       JE   AMB11		     ; if yes, check if prompt or menu
					     ; options are active, if yes,
					     ; reduce avail size by 64KB to
					     ; allow room for command line
					     ; or prog menu operation
;
AMB08:	       CMP  BX,MAX_EXECBUF	     ;64K remaining?
	       JB   AMB_ERR		     ;no, error
;
	       SUB  BX,MAX_EXECBUF	     ;save 64KB for execution of
					     ; command prompt or program menu
					     ; only if in resident mode
;
AMB11:	       MOV  CX,BX		     ;save avail paraghs for compare
;
	       TEST COM_STATE,COM_RESS	     ;check if resident mode is active
	       JNE  AMB12		     ; if yes, reserve room required
					     ; memory for view, copy,,,
					     ; if not, DOS funcs in shell will
					     ; automatically allocate memory
					     ; as needed
;
	       CMP  BX,MAX_DOSWBUF	     ;10K remaining?
	       JB   AMB_ERR		     ;no, error
;
	       SUB  BX,MAX_DOSWBUF	     ;reserve working memory for copy
					     ; and view functions (10KB)
;
; Check for minimum storage to run DOS Services
;
AMB12:	       MOV  TMP_DOSWBUF,MAX_DOSWBUF  ;max work buffer
	       MOV  TMP_DIRBUF,MAX_DIR1BUF   ;max directory buffer
;
	       CALL CHK_MINDOS		     ;check for minimum DOS
	       JNC  AMB30		     ;OK to allocate
;
	       TEST COM_STATE2,COM_BUFO      ;/B specified?
	       JZ   AMB14		     ;no, try for minimum system
;
	       CMP  COM_DFSIZE,SM_FILEBUF    ;User specified a small file buf?
	       JA   AMB_ERR		     ;no, /B just too large
;
AMB14:	       MOV  TMP_DOSWBUF,MIN_DOSWBUF  ;min work buffer
	       MOV  TMP_DIRBUF,MIN_DIR1BUF   ;min directory buffer
	       TEST COM_STATE,COM_RESS	     ;resident mode?
	       JNZ  AMB16		     ;yes, no need to adjust avail stg
;
	       ADD  BX,MAX_DOSWBUF	     ;change from 16K
	       SUB  BX,MIN_DOSWBUF	     ;	to 8K for View/Copy buffer
;
AMB16:	       CALL CHK_MINDOS		     ;check for absolutely minimum DOS
	       JNC  AMB30		     ;OK to allocate
;
AMB_ERR:       MOV  COM_ERRID,ERR_INSM	     ;insufficent memory available
	       JMP  AMBEXIT
;
; Allocate required shell memory
;
AMB30:	       XOR  AX,AX
	       MOV  AH,48H		     ;set allocate function number
	       INT  21H 		     ;allocate memory
	       JNC  AMB40		     ;check for error
;
	       MOV  COM_ERRID,ERR_INSM	     ;insufficent memory available
	       JMP  AMBEXIT
;
; Check if resident mode active and preallocate working DOS buffers
;
AMB40:	       MOV  CX,AX		     ;save beginning segment
;
	       TEST COM_STATE,COM_RESS	     ;check if resident mode is active
	       JE   AMB70		     ; if yes, pre-allocate required
					     ; memory for view, copy,,,
					     ; if not, DOS funcs in shell will
					     ; automatically allocate memory
					     ; as needed
;
	       TEST COM_STATE,COM_APPM	     ;check if app menu active
	       JNE  AMB60
;
	       MOV  COM_DATA8SEG,CX	     ;set segment of DOS work buffer
	       MOV  COM_DATA8OFF,0	     ;offset starts at zero
	       MOV  AX,TMP_DOSWBUF	     ;calculate length of buffer
	       MOV  BX,16		     ; in bytes
	       SUB  COM_DFSIZE,AX	     ;adjust remaining paragraphs
	       MUL  BX
	       MOV  COM_DATA8LEN,AX
	       ADD  CX,MAX_DOSWBUF	     ;adjust segment
	       JMP  AMB70
;
AMB60:	       MOV  AX,COM_DATA3SEG	     ;reuse app menu buffer
	       MOV  COM_DATA8SEG,AX	     ;set segment
	       MOV  AX,COM_DATA3OFF
	       MOV  COM_DATA8OFF,AX	     ;set offset
	       MOV  AX,COM_DATA3LEN	     ;set DOS working buffer size in
	       MOV  COM_DATA8LEN,AX	     ; bytes
;
; Use next available memory for dir buffer 1 and 2
;
AMB70:	       MOV  COM_DATA4SEG,CX	     ;set segment of directory list 1
	       MOV  COM_DATA4OFF,0	     ;offset starts at zero
	       MOV  AX,TMP_DIRBUF	     ;calculate length of buffer
	       ADD  CX,AX		     ;adjust new segment
	       SUB  COM_DFSIZE,AX	     ;adjust remaining paragraphs
	       MOV  BX,16
	       MUL  BX
	       MOV  COM_DATA4LEN,AX	     ;set length in paragraphs
;
	       TEST COM_STATE,COM_DRV2	     ;check if multiple drive display
	       JE   AMB80		     ; active
;
	       MOV  COM_DATA5SEG,CX	     ;set segment of directory list 2
	       MOV  COM_DATA5OFF,0	     ;offset starts at zero
	       MOV  AX,TMP_DIRBUF	     ;calculate length of buffer
	       ADD  CX,AX		     ;adjust new segment
	       SUB  COM_DFSIZE,AX	     ;adjust remaining paragraphs
	       MOV  BX,16
	       MUL  BX
	       MOV  COM_DATA5LEN,AX	     ;set length in paragraphs
;
; Use remaining memory for file buffers 1 and 2
;
AMB80:	       MOV  COM_DATA6SEG,CX	     ;set segment of file buf 1
	       MOV  COM_DATA6OFF,0	     ;offset starts at zero
;
	       MOV  AX,COM_DFSIZE	     ;get remaining buffer
;
	       TEST COM_STATE,COM_DRV2	     ;check if multiple drive display
	       JE   AMB90		     ; active
;
	       SHR  AX,1		     ;divide remaining buffer by 2
;
AMB90:	       MOV  COM_DATA6LEN,AX	     ;set file buffer 1 len in paraghs
	       ADD  CX,AX		     ;adjust new segment
	       SUB  COM_DFSIZE,AX	     ;adjust remaining buffer paraghs
;
	       TEST COM_STATE,COM_DRV2	     ;check if multiple drive display
	       JE   AMBEXIT		     ; active
;
	       MOV  COM_DATA7SEG,CX	     ;set segment of file buf 2
	       MOV  COM_DATA7OFF,0	     ;offset starts at zero
	       MOV  AX,COM_DFSIZE	     ;set # parags in file buf 2
	       MOV  COM_DATA7LEN,AX
;
AMBEXIT:				     ;exit
;
	       RET
ALLOCATE_BUFB  ENDP
;
PAGE
;
;-----------------------------------------------------------------------------+
;									      :
; Name: 		CHK_MINDOS					      :
;									      :
; Description:		Check for enough storage to run minimum DOS Services. :
;									      :
; Entry:		TMP_DOSWBUF - Size of DOS work buffer		      :
;			TMP_DIRBUF  - Size of DOS directory buffer	      :
;			COM_DFSIZE  - User specified file buffer size	      :
;			BX	    - Maximum memory available		      :
;									      :
; Exit: 		Carry flag set					      :
;									      :
; Entry point:		CHK_MINDOS					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	None						      :
;									      :
; External references:	None						      :
;									      :
;-----------------------------------------------------------------------------+
;
CHK_MINDOS     PROC NEAR
;
	       XOR  AX,AX		     ;clear out
	       TEST COM_STATE,COM_RESS	     ;resident mode?
	       JZ   CHS14		     ;no, storage already adjusted
;
	       TEST COM_STATE,COM_APPM	     ;appl configured?
	       JNZ  CHS14		     ;yes, reuse appl workarea
;
	       ADD  AX,TMP_DOSWBUF	     ;10K or 8K for View/Copy buffer
;
CHS14:	       ADD  AX,TMP_DIRBUF	     ;8K or 4K for first dir buffer
	       TEST COM_STATE,COM_DRV2	     ;multiple buffers configured?
	       JZ   CHS16		     ;no, no second buffer needed
;
	       ADD  AX,TMP_DIRBUF	     ;8K or 4K for second dir buffer
;
CHS16:	       TEST COM_STATE2,COM_BUFO      ;/B specified?
	       JZ   CHS18		     ;no, add in for min file buffer
;
	       ADD  AX,COM_DFSIZE	     ;update total storage needed
	       CMP  BX,AX		     ;is storage available?
	       JA   CHS17		     ;yes
;
	       SUB  AX,COM_DFSIZE	     ;back out and use all of storage
	       JMP  CHS18		     ;continue

;	       JB   CHS_ERR		     ;no, display error message
;
CHS17:	       MOV  BX,AX		     ;set to allocate storage
	       JMP  CHS20
;
CHS18:	       ADD  AX,MIN_FILEBUF	     ;minimun file buffer to alloc
	       CMP  BX,AX		     ;is storage available
	       JB   CHS_ERR		     ;no, display error message
;
CHS20:	       MOV  COM_DFSIZE,BX	     ;set to allocate all avail storage
	       JMP  CHS_OK
;
CHS_ERR:       STC			     ;error
	       JMP  CHS_RET
;
CHS_OK:        CLC			     ;OK

CHS_RET:				     ;exit
;
	       RET
CHK_MINDOS     ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		MANAGE_ERROR					      :
;									      :
; Description:		Manage error messages.				      :
;									      :
; Entry:		COM_ERRID = ID number of error message. 	      :
;									      :
; Exit: 		None.						      :
;									      :
; Entry point:		MANAGE_ERROR					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	GET_ERROR					      :
;									      :
; External references:	INT 21H  AH=09H Print string to standard output.      :
;									      :
;-----------------------------------------------------------------------------+
;
MANAGE_ERROR   PROC NEAR
;
; Process critcal error messages before initialization is complete
;
	       CALL SET_DOSVMSHL	     ;set DOS video mode from shell
					     ; video mode
;
	       MOV  AX,COM_ERRID	     ;calculate offset into error
	       CALL FAR PTR GET_ERROR
;
	       PUSH DS			     ;save data segment address
;
	       MOV  CX,AX		     ;set message length
	       MOV  DX,DI		     ;set message offset
	       MOV  AX,ES		     ;set message segment
	       MOV  DS,AX
;
	       XOR  AX,AX		     ;clear to zero
	       MOV  AH,40H		     ;set print string function number
	       MOV  BX,1		     ;standard output
	       INT  21H 		     ;print string
;
	       MOV  AH,06		     ;print <CR> to screen
	       MOV  DL,CR
	       INT  21H
;
	       MOV  AH,06		     ;print <LF> to screen
	       MOV  DL,LF
	       INT  21H
;
	       POP  DS			     ;restore data segment address
;
	       RET
MANAGE_ERROR   ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		EXAMINE_PSP					      :
;									      :
; Description:		Examine Program Segment Prefix string for current     :
;			SHELLRD.EXE invocation parameters.		      :
;									      :
; Entry:		PSP initialized.				      :
;									      :
; Exit: 		COM_STATE   = Option word indicating invocation       :
;				      parameters passed through PSP.	      :
;									      :
;			Label	  Bit  Description			      :
;			--------  ---  -----------------------------------    :
;			COM_APPM   0   0= Application menu not configured.    :
;				       1= Application menu configured.	      :
;			COM_DOSS   1   0= DOS Services not configured.	      :
;				       1= DOS Services configured.	      :
;			COM_REFD   2   0= Do not refresh directory buffer     :
;					  during command line or PEC execution:
;				       1= Refresh directory buffer during     :
;					  command line or PEC execution.      :
;			COM_RESS   3   0= Transient shell.		      :
;				       1= Resident shell.		      :
;			COM_AUTI   4   0= Automatic predefined menu	      :
;					  installation is not active.	      :
;				       1= Automatic predefined menu	      :
;					  installation is active.	      :
;			COM_DRV2   5   0= Multiple drive buffer not active.   :
;				       1= Multiple drive buffer active.       :
;			COM_FLCL   6   0= Command line access is not active.  :
;				       1= Command line access is active.      :
;			COM_FLMI   7   0= Maintain menu item access is not    :
;					  active.			      :
;				       1= Maintain menu item access is active.:
;			COM_FLCS   8   0= Maintain color selections access is :
;					  not active.			      :
;				       1= Maintain color selections access is :
;					  active.			      :
;			COM_FLED   9   0= Exit to DOS is not active.	      :
;				       1= Exit to DOS is active.	      :
;			COM_MOUS  10   0= Mouse is not active.		      :
;				       1= Mouse is active.		      :
;			COM_LFMS  11   0= Right hand mouse.		      :
;				       1= Left hand mouse.		      :
;			COM_M10H  12   0= No function assigned. 	      :
;				       1= Graphics EGA mode 10H requested     :
;			COM_M11H  13   0= No function assigned. 	      :
;				       1= Graphics VGA/MCGA mode 11H requested:
;			COM_M12H  14   0= No function assigned. 	      :
;				       1= Graphics VGA mode 12H requested     :
;			COM_TEXT  15   0= No function assigned. 	      :
;				       1= Text mode is requested.	      :
;									      :
;			COM_STATE2  = Option word indicating invocation       :
;				      parameters passed through PSP.	      :
;									      :
;			Label	  Bit  Description			      :
;			--------  ---  -----------------------------------    :
;			COM_SOUD   0   0= Sound not active.		      :
;				       1= Sound active. 		      :
;									      :
;			COM_NLS    1   0= Not active.			      :
;				       1= NLS help index display option active:
;									      :
;			COM_DFSAV  2   0= Not active.			      :
;				       1= Directory and file save active.     :
;									      :
;			COM_BUFO   3   0= Not active.			      :
;				       1= Dir/file buffer size override on.   :
;									      :
;			COM_DBCS   4   0= Not active.			      :
;				       1= DBCS active.			      :
;									      :
;			COM_DATE   5   0= Not active.			      :
;				       1= Date/time active.		      :
;									      :
;			COM_COM2   5   0= Not active.			  D491:
;				       1= COM2 active.			  D491:
;									      :
;			COM_DFSIZE  = Size of DOS directory and file buffer   :
;				      to allocate in paragraphs.  Used only   :
;				      if buffer override option is active     :
;				      in COM_STATE2.			      :
;									      :
;			COM_PSPOFF  = Offset of SHELL.EXE PSP		      :
;			COM_PSPSEG  = Segment of SHELL.EXE PSP		      :
;									      :
; Entry point:		EXAMINE_PSP					      :
;									      :
; Notes:		EXAMINE_PSP is beginning overlay point for mouse      :
;			driver. 					      :
;									      :
; Internal references:	MANAGE_ERROR					      :
;			PCINSTR_CALL					      :
;									      :
; External references:	INT 21H  19H Return current drive		      :
;			INT 21H  47H Return current path		      :
;									      :
;-----------------------------------------------------------------------------+
;
EXAMINE_PSP    PROC NEAR
;
; Intialize to search PSP for invocation options
;
	       MOV  INS_OPT,0		     ;set to find string
	       MOV  ES, COM_PSPSEG	     ;get PSP segment
	       MOV  DI, 80H		     ;get offset of PSP length byte
	       MOV  CL, ES:[DI] 	     ;get PSP length byte
	       CMP  CL, 0		     ;any command line options?
	       JA   EP03		     ;yes, continue
	       MOV  COM_ERRID,ERR_PSP	     ;invalid psp command line
	       JMP  EPEXIT		     ;exit
EP03:	       XOR  CH, CH		     ;clear high byte
	       MOV  SI, COM_PSPOFF	     ;set offset of PSP
	       ADD  SI, 81H		     ;get command line buffer
	       LEA  DI, EP_CMDLIN	     ;set offset of command line buffer
	       MOV  INS_SOFF, DI	     ;save offset of command buffer
	       MOV  INS_SSEG, DATA	     ;save segment of command buffer
	       MOV  ES, INS_SSEG	     ;set segment of command buffer
	       mov  dl, 0		     ;init comment flag
	       mov  ins_slen, 0 	     ;init length of command search str
	       mov  com_cmdact, 0	     ;init actual length of commands
	       mov  com_cmdnum, 0	     ;init length of commands found
;
EP034:	       PUSH DS			     ;save data seg
	       MOV  DS, COM_PSPSEG	     ;PSP segment is source seg
	       mov  al, ds:[si] 	     ;
	       POP  DS			     ;
;
	       cmp  al, ' '                  ;
	       jbe  ep039		     ;
;
	       cmp  al, '{'                  ;
	       jne  ep037		     ;
	       mov  dl, 1		     ;
	       jmp  ep039		     ;
;
EP037:	       cmp  al, '}'                  ;
	       jne  ep038		     ;
	       mov  dl, 0		     ;
	       jmp  ep039		     ;
;
EP038:	       cmp  dl, 1		     ;
	       je   ep039		     ;
;
	       cmp  al, 'a'                  ;
	       jb   ep0385		     ;
	       cmp  al, 'z'                  ;
	       ja   ep0385		     ;
	       sub  al, 32		     ;
;
ep0385:        mov  es:[di], al 	     ;
	       inc  ins_slen		     ;
	       inc  com_cmdact		     ;
	       inc  di			     ;
;
ep039:	       inc  si			     ;
	       loop ep034		     ;
;
	       MOV  EP_ENDOFF, DI	     ;set offset of last byte in buffer
;
; Check for profile filename /PRO:filename.PRO
;
EP1900:        XOR  AX,AX		     ;get current drive
	       MOV  AH,19H
	       INT  21H
	       ADD  AL,65		     ;convert from # to alpha char
	       MOV  COM_RFILSPEC,AL	     ;complete current drive and path
;
	       MOV  AH,47H		     ;read current path
	       MOV  DL,0
	       LEA  SI,COM_RFILSPEC+3	     ;point past C:\
	       INT  21H
	       JNC  EP1910		     ;check for error
;
	       MOV  COM_ERRID,ERR_BADD	     ;bad disk or drive door open
	       JMP  EPEXIT
;
EP1910:        MOV  AX,STR_PROFACT	     ;profile active
	       CALL CHECK_STRING	     ;search for string
	       CMP  INS_RSLT,0		     ;check if not found, error
	       JG   EP1920
;
	       JMP  EP05		     ;profile not active get next var
;
EP1920:        ADD  COM_CMDNUM,AX
;
	       PUSH INS_FOFF		     ;save invocation parameter offset
;
	       MOV  CX,INS_RSLT 	     ;save starting search point
	       ADD  CX,INS_FLEN 	     ;point past /PRO: to beginning of
					     ; profile file name
;
	       MOV  AX,STR_PROEXT	     ;profile extension
	       CALL FAR PTR GET_STRING
;
	       MOV  INS_FLEN,AX 	     ;length of find string
	       MOV  INS_FOFF,DI 	     ;offset of find string '.PRO'
	       MOV  INS_FSEG,ES 	     ;segment of string
	       CALL PCINSTR_CALL	     ;search for string
;
	       POP  INS_FOFF		     ;restore before exit
;
	       CMP  INS_RSLT,0
	       JG   EP1930
;
	       MOV  COM_ERRID,ERR_MOUS	     ;invalid profile file
	       JMP  EPEXIT
;
EP1930:        PUSH SI
	       PUSH DS
;
	       MOV  AX,INS_RSLT
	       SUB  AX,CX		     ;ending offset - starting offset
	       ADD  AX,INS_FLEN 	     ; + length of extension = # bytes
					     ; to move
	       ADD  COM_CMDNUM,AX	     ;
	       MOV  BX,INS_SOFF 	     ;calculate offset of source strg
	       ADD  BX,CX		     ; to move
	       DEC  BX
;
	       PUSH BX			     ;save source offset
	       PUSH INS_SSEG		     ;save source segment
;
	       MOV  CX,AX		     ; = number of bytes to move
	       LEA  DI,COM_RFILSPEC	     ;get dest offset
;
	       PUSH DS
	       PUSH ES
	       POP  DS
	       POP  ES
;
EP1940:        MOV  AL,ES:[DI]		     ;locate end of drive and path
	       CMP  AL,0		     ; in shell profile name buffer
	       JE   EP1980
;
	       INC  DI			     ;point to next character
	       JMP  EP1940
;
EP1980:        CMP  BYTE PTR ES:[DI-1],'\'   ;check if root and skip add of
	       JE   EP1990		     ; file separator
;
	       MOV  BYTE PTR ES:[DI],'\'     ;add path and filename separator
	       INC  DI			     ;point to where filename goes
;
EP1990:        POP  DS			     ;now move profile filename string
	       POP  SI			     ; to end of profile buffer path
;
	       REP  MOVSB		     ;copy profile filespec
;
	       POP  DS
	       POP  SI
;
; Open profile file
;
	       MOV  AH, 3DH		     ;DOS open handle
	       MOV  AL, 010B		     ;open for read/write
	       LEA  DX, COM_RFILSPEC	     ;set offset of profile filename
	       INT  21H 		     ;open profile file
	       JNC  EP_1992		     ;continue if no error
	       MOV  COM_ERRID,ERR_MOUS	     ;bad disk or drive door open
	       JMP  EPEXIT
;
; Read profile file to command buffer	     ;
;
ep_1992:       mov  dl, 0
	       mov  di, ep_endoff
	       MOV  BX, AX		     ;set file handle
;
ep_1993:       push dx
	       MOV  AH, 3FH		     ;DOS read handle
	       mov  cx, 1
	       lea  dx, gen_data
	       INT  21H 		     ;read profile into buffer
	       JNC  EP_1994		     ;continue if no error
	       pop  dx
	       MOV  COM_ERRID,ERR_MOUS	     ;bad disk or drive door open
	       JMP  EPEXIT

EP_1994:  ;    ADD  INS_SLEN, AX	     ;


epx034:
	       cmp  ax, 0		     ;
	       ja   epx035
;
	       pop  dx
	       jmp  ep1995
;
epx035:        pop  dx
;
	       mov  al, byte ptr gen_data    ;
;
	       cmp  al, ' '                  ;
	       jbe  epx039		     ;
;
	       cmp  al, '{'                  ;
	       jne  epx037		     ;
	       mov  dl, 1		     ;
	       jmp  epx039		     ;
;
epx037:        cmp  al, '}'                  ;
	       jne  epx038		     ;
	       mov  dl, 0		     ;
	       jmp  epx039		     ;
;
epx038:        cmp  dl, 1		     ;
	       je   epx039		     ;
;
	       cmp  al, 'a'                  ;
	       jb   epx0385		     ;
	       cmp  al, 'z'                  ;
	       ja   epx0385		     ;
	       sub  al, 32		     ;
;
epx0385:       mov  [di], al		     ;
	       inc  ins_slen		     ;
	       inc  com_cmdact		     ;
	       inc  di			     ;
;
epx039:        jmp  ep_1993		     ;
;
; Close profile handle
;
EP1995:        MOV  AH, 3EH		     ;
	       INT  21H 		     ;close handle
	       JNC  EP05		     ;continue if no error
	       MOV  COM_ERRID,ERR_MOUS	     ;bad disk or drive door open
	       JMP  EPEXIT
;
; Convert command string alpha to upper case
;
EP05:	       MOV  ES,INS_SSEG 	     ;get PSP command line segment
	       MOV  DI,INS_SOFF 	     ;point to PSP command line string
	       MOV  CX,INS_SLEN 	     ;get length of PSP
;
	       MOV  COM_STATE, 0	     ;
	       MOV  COM_STATE2,0	     ;initialize to zero
;
	       MOV  AX,STR_CDON 	     ;
	       CALL CHECK_STRING	     ;
	       CMP  INS_RSLT,0		     ;
	       JE   EP2510		     ;
	       ADD  COM_CMDNUM,AX	     ;
	       OR   COM_CONFIRM, COM_CONFDEL ;
ep2510:
	       MOV  AX,STR_CDOFF	     ;
	       CALL CHECK_STRING	     ;
	       CMP  INS_RSLT,0		     ;
	       JE   EP2511		     ;
	       ADD  COM_CMDNUM,AX	     ;
	       AND  COM_CONFIRM,NOT COM_CONFDEL
ep2511:
	       MOV  AX,STR_CRON 	     ;
	       CALL CHECK_STRING	     ;
	       CMP  INS_RSLT,0		     ;
	       JE   EP2520		     ;
	       ADD  COM_CMDNUM,AX	     ;
	       OR   COM_CONFIRM, COM_CONFREPL;
ep2520:
	       MOV  AX,STR_CROFF	     ;
	       CALL CHECK_STRING	     ;
	       CMP  INS_RSLT,0		     ;
	       JE   EP2521		     ;
	       ADD  COM_CMDNUM,AX	     ;
	       AND  COM_CONFIRM,NOT COM_CONFREPL
ep2521:
	       MOV  AX,STR_ASON 	     ;
	       CALL CHECK_STRING	     ;
	       CMP  INS_RSLT,0		     ;
	       JE   EP2530		     ;
	       ADD  COM_CMDNUM,AX	     ;
	       OR   COM_CONFIRM, COM_ALLOWSEL;
ep2530:
	       MOV  AX,STR_ASOFF	     ;
	       CALL CHECK_STRING	     ;
	       CMP  INS_RSLT,0		     ;
	       JE   EP2540		     ;
	       ADD  COM_CMDNUM,AX	     ;
	       AND  COM_CONFIRM,NOT COM_ALLOWSEL
ep2540:
	       MOV  AX,STR_SBNAME	     ;
	       CALL CHECK_STRING	     ;
	       CMP  INS_RSLT,0		     ;
	       JE   EP2550		     ;
	       ADD  COM_CMDNUM,AX	     ;
	       MOV  SORTSTAT, SST_NAME	     ;
	       JMP  EP2590
ep2550:
	       MOV  AX,STR_SBEXT	     ;
	       CALL CHECK_STRING	     ;
	       CMP  INS_RSLT,0		     ;
	       JE   EP2560		     ;
	       ADD  COM_CMDNUM,AX	     ;
	       MOV  SORTSTAT, SST_EXT	     ;
	       JMP  EP2590
ep2560:
	       MOV  AX,STR_SBSIZE	     ;
	       CALL CHECK_STRING	     ;
	       CMP  INS_RSLT,0		     ;
	       JE   EP2570		     ;
	       ADD  COM_CMDNUM,AX	     ;
	       MOV  SORTSTAT, SST_SIZE	     ;
	       JMP  EP2590
ep2570:
	       MOV  AX,STR_SBDATE	     ;
	       CALL CHECK_STRING	     ;
	       CMP  INS_RSLT,0		     ;
	       JE   EP2580		     ;
	       ADD  COM_CMDNUM,AX	     ;
	       MOV  SORTSTAT, SST_DATE	     ;
	       JMP  EP2590
ep2580:
	       MOV  AX,STR_SBDISK	     ;
	       CALL CHECK_STRING	     ;
	       CMP  INS_RSLT,0		     ;
	       JE   EP2590		     ;
	       ADD  COM_CMDNUM,AX	     ;
	       MOV  SORTSTAT, 0 	     ;
ep2590:
;
; Check for NLS translation option for help index display
;
	       MOV  AX,STR_NLS		     ;NLS configured
	       CALL CHECK_STRING	     ;search for string
	       CMP  INS_RSLT,0
	       JE   EP25
;
	       ADD  COM_CMDNUM,AX	     ;add length to found length
	       OR   COM_STATE2,COM_NLS	     ;app menu configured
;
; Check for application menu option
;
EP25:	       MOV  AX,STR_APPMENU	     ;app menu configured
	       CALL CHECK_STRING	     ;search for string
	       CMP  INS_RSLT,0
	       JE   EP30
;
	       ADD  COM_CMDNUM,AX
	       OR   COM_STATE,COM_APPM	     ;app menu configured
;
; Check for DOS Services option
;
EP30:	       MOV  AX,STR_DOSSERV	     ;DOS services configured
	       CALL CHECK_STRING	     ;search for string
	       CMP  INS_RSLT,0
	       JE   EP50
;
	       ADD  COM_CMDNUM,AX
	       OR   COM_STATE,COM_DOSS	     ;DOS services configured
;
; Check for transient mode operation
;
EP50:	       MOV  AX,STR_TRANS	     ;transient shell configured
	       CALL CHECK_STRING	     ;search for string
	       CMP  INS_RSLT,0
	       JNE  EP51
;
	       OR   COM_STATE,COM_RESS	     ;resident shell configured
	       JMP  EP60
;
EP51:	       ADD  COM_CMDNUM,AX
;
; Check for hi-res graphics mode operation = Mode 10
;
EP60:	       MOV  AX,STR_MODE10H	     ;graphics mode 10H
	       CALL CHECK_STRING	     ;search for string
	       CMP  INS_RSLT,0
	       JE   EP62
;
	       ADD  COM_CMDNUM,AX
	       OR   COM_STATE,COM_M10H	     ;activate graphics mode flag
	       JMP  EP74
;
; Check for hi-res graphics mode operation = Mode 11
;
EP62:	       MOV  AX,STR_MODE11H	     ;graphics mode 11H
	       CALL CHECK_STRING	     ;search for string
	       CMP  INS_RSLT,0
	       JE   EP64
;
	       ADD  COM_CMDNUM,AX
	       OR   COM_STATE,COM_M11H	     ;activate graphics mode flag
	       JMP  EP74
;
; Check for hi-res graphics mode operation = Mode 12
;
EP64:	       MOV  AX,STR_MODE12H	     ;graphics mode 12H
	       CALL CHECK_STRING	     ;search for string
	       CMP  INS_RSLT,0
	       JE   EP65
;
	       ADD  COM_CMDNUM,AX
	       OR   COM_STATE,COM_M12H	     ;activate graphics mode flag
	       JMP  EP74
;
; Check for text mode operation = Mode 7 or 3
;
EP65:	       MOV  AX,STR_TEXTS	     ;graphics mode 12H
	       CALL CHECK_STRING	     ;search for string
	       CMP  INS_RSLT,0
	       JE   EP66
;
	       ADD  COM_CMDNUM,AX
	       OR   COM_STATE,COM_TEXT	     ;activate text mode flag
	       JMP  EP74
;
; User did not set desired video mode, default to highest available
;
EP66:	       CMP  GE_MODEL,MODEL_30	     ;check if model 25 and 30
	       JNE  EP68
;
	       CMP  GE_SUBMODEL,SUBMD_30
	       JE   EP67
;
	       CMP  GE_SUBMODEL,SUBMD_25
	       JNE  EP68
;
EP67:	       OR   COM_STATE,COM_M11H	     ;default to mode 11H
	       JMP  EP74
;
; Check for VGA video
;
EP68:	       MOV  AX,1A00H		     ;BIOS check display
	       INT  10H 		     ;
	       CMP  AL,1AH		     ;VGA supported?
	       JNE  EP686		     ;no, continue
;
; VGA video, check for INFOWINDOW display
;
	       CMP  BL, 4		     ;infowindow display?
	       JNE  EP685		     ;no, continue
;
	       OR   COM_STATE, COM_M10H      ;mode for VGA with infowindow
	       JMP  EP74		     ;continue
;
; VGA video, non-INFOWINDOW, set highest available mode
;
EP685:	       MOV  AH, 1BH
	       MOV  BX, 0
	       PUSH DS
	       POP  ES
	       LEA  DI, GEN_DATA
	       INT  10H
	       PUSH ES:[DI]
	       PUSH ES:[DI+2]
	       POP  ES
	       POP  DI
;
	       TEST BYTE PTR ES:[DI+2], 00000100B
	       JZ   EP6851
	       OR   COM_STATE, COM_M12H
	       JMP  EP74
EP6851:        TEST BYTE PTR ES:[DI+2], 00000010B
	       JZ   EP6852
	       OR   COM_STATE, COM_M11H
	       JMP  EP74
EP6852:        TEST BYTE PTR ES:[DI+2], 00000001B
	       JZ   EP6853
	       OR   COM_STATE, COM_M10H
	       JMP  EP74
EP6853:        OR   COM_STATE, COM_TEXT
	       JMP  EP74
;
; Check for EGA video
;
EP686:	       MOV  AH,12H		     ;BIOS alternate select
	       MOV  BL,10H		     ;return EGA info
	       INT  10H 		     ;
	       CMP  BL,10H		     ;EGA video?
	       JNE  EP687		     ;yes, continue
;
; CGA or Monochrome video
;
	       OR   COM_STATE,COM_TEXT	     ;text mode operation
	       JMP  EP74		     ;continue
;
; EGA video, check for sufficient memory for mode 10
;
EP687:	       CMP  BL,3H		     ;256K available?
	       JAE  EP688		     ;yes, continue
;
	       OR   COM_STATE,COM_TEXT	     ;ega has no memory for mode 10
	       JMP  EP74		     ;continue
;
; EGA with 256K, check for cga or monochrome emulation
;
EP688:	       AND  CL,1111B		     ;save registers
	       CMP  CL,9
	       JE   EP689
;
; EGA emulating CGA or Monochrome
;
	       OR   COM_STATE,COM_TEXT
	       JMP  EP74
;
; EGA in EGA mode
;
EP689:	       OR   COM_STATE,COM_M10H
;
; Check for application main menu filename
;
EP74:	       TEST COM_STATE,COM_APPM	     ;if app menu not configured do not
	       JNE  EP75		     ; search for app main menu filespc
;
	       MOV  AX,STR_APMFILE	     ;app main menu filename
	       CALL CHECK_STRING	     ;search for string
	       CALL PCINSTR_CALL
	       CMP  INS_RSLT,0		     ;check if parameter found
	       JG   EP75
;
	       JMP  EP112		     ;check next parameter
;
EP75:	       XOR  AX,AX		     ;get current drive
	       MOV  AH,19H
	       INT  21H
	       ADD  AL,65		     ;convert from # to alpha char
	       MOV  APP_MFILSPEC,AL	     ;complete current drive and path
;
	       MOV  AH,47H		     ;read current path
	       MOV  DL,0
	       LEA  SI,APP_MFILSPEC+3	     ;point past C:\
	       INT  21H
	       JNC  EP78		     ;check for error
;
	       MOV  COM_ERRID,ERR_BADD	     ;bad disk or drive door open
	       JMP  EPEXIT
;
EP78:	       MOV  AX,STR_APMFILE	     ;app main menu filename
	       CALL CHECK_STRING	     ;search for string
	       CMP  INS_RSLT,0
	       JG   EP80
;
	       MOV  AX,STR_APPMFILE	     ;default app menu filename
	       CALL FAR PTR GET_STRING	     ;user did not supply new app menu
;
	       PUSH SI			     ;save data segment
	       PUSH DS
;
	       PUSH DI			     ;save filename offset
	       PUSH ES			     ;save filename segment
;
	       JMP  EP92		     ; SHELL.MEU file instead
;
EP80:	       PUSH INS_FOFF		     ;save invocation parameter offset
	       ADD  COM_CMDNUM,AX
;
	       MOV  CX,INS_RSLT 	     ;save starting search point
	       ADD  CX,INS_FLEN 	     ;point past /MEU: to beginning of
					     ; menu file name
	       MOV  AX,STR_AAPEXT	     ;main application menu extension
	       CALL FAR PTR GET_STRING
;
	       MOV  INS_FLEN,AX 	     ;length of string
	       MOV  INS_FOFF,DI 	     ;offset of string '.MEU'
	       MOV  INS_FSEG,ES 	     ;segment of string
	       CALL PCINSTR_CALL	     ;search for string
;
	       POP  INS_FOFF
;
	       CMP  INS_RSLT,0
	       JG   EP90
;
	       MOV  COM_ERRID,ERR_APIF	     ;invalid main app menu filename
	       JMP  EPEXIT
;
EP90:	       PUSH SI			     ;save data segment
	       PUSH DS
;
	       MOV  AX,INS_RSLT
	       SUB  AX,CX		     ;ending offset - starting offset
	       ADD  AX,INS_FLEN 	     ; + length of extension = # bytes
					     ; to move
	       ADD  COM_CMDNUM,AX
;
	       MOV  BX,INS_SOFF 	     ;calculate offset of source strg
	       ADD  BX,CX		     ; to move
	       DEC  BX
;
	       PUSH BX			     ;save source offset
	       PUSH INS_SSEG		     ;save source segment
;
EP92:	       MOV  CX,AX		     ; = number of bytes to move
	       LEA  DI,APP_MFILSPEC	     ;get dest offset
;
	       PUSH DS
	       PUSH ES
	       POP  DS
	       POP  ES
;
EP94:	       MOV  AL,ES:[DI]		     ;locate end of drive and path
	       CMP  AL,0		     ; in shell app menu file buffer
	       JE   EP98
;
	       INC  DI			     ;point to next character
	       JMP  EP94
;
EP98:	       CMP  BYTE PTR ES:[DI-1],'\'   ;check if root and skip add of
	       JE   EP99		     ; file separator
;
	       MOV  BYTE PTR ES:[DI],'\'     ;add path and filename separator
	       INC  DI			     ;point to where filename goes
;
EP99:	       POP  DS			     ;now move shell menu filename to
	       POP  SI			     ; end of app menu file path
;
	       REP  MOVSB		     ;copy application menu filespec
;
	       POP  DS
	       POP  SI
;
; Move copy of menu filename to first menu buffer
;
EP100:	       MOV  AX,STR_APMFILE	     ;app main menu filename
	       CALL CHECK_STRING	     ;search for string
	       CMP  INS_RSLT,0
	       JG   EP103
;
	       MOV  AX,STR_APPMFILE	     ;default app menu filename
	       CALL FAR PTR GET_STRING	     ;user did not supply new app menu
;
	       PUSH SI			     ;save data segment
	       PUSH DS
;
	       PUSH DI			     ;save filename offset
	       PUSH ES			     ;save filename segment
;
	       JMP  EP105		     ; SHELL.MEU file instead
;
EP103:	       PUSH INS_FOFF		     ;save invocation parameter offset
;
	       MOV  CX,INS_RSLT 	     ;save starting search point
	       ADD  CX,INS_FLEN 	     ;point past /MEU: to beginning of
					     ; menu file name
	       MOV  AX,STR_AAPEXT	     ;main application menu extension
	       CALL FAR PTR GET_STRING
;
	       MOV  INS_FLEN,AX 	     ;length of string
	       MOV  INS_FOFF,DI 	     ;offset of string '.MEU'
	       MOV  INS_FSEG,ES 	     ;segment of string
	       CALL PCINSTR_CALL	     ;search for string
;
	       POP  INS_FOFF
;
	       CMP  INS_RSLT,0
	       JG   EP104
;
	       MOV  COM_ERRID,ERR_APIF	     ;invalid main app menu filename
	       JMP  EPEXIT
;
EP104:	       PUSH SI			     ;save data segment
	       PUSH DS
;
	       MOV  AX,INS_RSLT
	       SUB  AX,CX		     ;ending offset - starting offset
	       ADD  AX,INS_FLEN 	     ; + length of extension = # bytes
					     ; to move
;
	       MOV  BX,INS_SOFF 	     ;calculate offset of source strg
	       ADD  BX,CX		     ; to move
	       DEC  BX
;
	       PUSH BX			     ;save source offset
	       PUSH INS_SSEG		     ;save source segment
;
EP105:	       MOV  CX,AX		     ; = number of bytes to move
	       LEA  DI,APP_MFILNAME	     ;get dest offset
;
	       PUSH DS
	       PUSH ES
	       POP  DS
	       POP  ES
;
EP108:	       POP  DS			     ;now move shell menu filename to
	       POP  SI			     ; end of app menu file path
;
	       REP  MOVSB		     ;copy application menu filespec
;
	       POP  DS
	       POP  SI
;
; Check for color filename
;
EP112:	       XOR  AX,AX		     ;get current drive
	       MOV  AH,19H
	       INT  21H
	       ADD  AL,65		     ;convert from # to alpha char
	       MOV  COM_CFILSPEC,AL	     ;complete current drive and path
;
	       MOV  AH,47H		     ;read current path
	       MOV  DL,0
	       LEA  SI,COM_CFILSPEC+3	     ;point past C:\
	       INT  21H
	       JNC  EP115		     ;check for error
;
	       MOV  COM_ERRID,ERR_BADD	     ;bad disk or drive door open
	       JMP  EPEXIT
;
EP115:	       MOV  AX,STR_CLFILE	     ;color filename
	       CALL CHECK_STRING	     ;search for string
	       CMP  INS_RSLT,0		     ;check if not found, error
	       JG   EP118
;
	       MOV  AX,STR_CLRFILE	     ;default color filename
	       CALL FAR PTR GET_STRING	     ;user did not supply new app menu
;
	       PUSH SI			     ;save data segment
	       PUSH DS
;
	       PUSH DI			     ;save offset of filename
	       PUSH ES			     ;save segment of filename
;
	       JMP  EP122		     ; SHELL.CLR file
;
EP118:	       PUSH INS_FOFF		     ;save invocation parameter offset
	       ADD  COM_CMDNUM,AX
;
	       MOV  CX,INS_RSLT 	     ;save starting search point
	       ADD  CX,INS_FLEN 	     ;point past /K: to beginning of
					     ; color file name
;
	       MOV  AX,STR_CLREXT	     ;color profile extension
	       CALL FAR PTR GET_STRING
;
	       MOV  INS_FLEN,AX 	     ;length of find string
	       MOV  INS_FOFF,DI 	     ;offset of find string '.CLR'
	       MOV  INS_FSEG,ES 	     ;segment of string
	       CALL PCINSTR_CALL	     ;search for string
;
	       POP  INS_FOFF		     ;restore before exit
;
	       CMP  INS_RSLT,0
	       JG   EP120
;
	       MOV  COM_ERRID,ERR_CLRF	     ;invalid user color profile
	       JMP  EPEXIT
;
EP120:	       PUSH SI
	       PUSH DS
;
	       MOV  AX,INS_RSLT
	       SUB  AX,CX		     ;ending offset - starting offset
	       ADD  AX,INS_FLEN 	     ; + length of extension = # bytes
					     ; to move
	       ADD  COM_CMDNUM,AX
	       MOV  BX,INS_SOFF 	     ;calculate offset of source strg
	       ADD  BX,CX		     ; to move
	       DEC  BX
;
	       PUSH BX			     ;save source offset
	       PUSH INS_SSEG		     ;save source segment
;
EP122:	       MOV  CX,AX		     ; = number of bytes to move
	       LEA  DI,COM_CFILSPEC	     ;get dest offset
;
	       PUSH DS
	       PUSH ES
	       POP  DS
	       POP  ES
;
EP124:	       MOV  AL,ES:[DI]		     ;locate end of drive and path
	       CMP  AL,0		     ; in shell color file buffer
	       JE   EP128
;
	       INC  DI			     ;point to next character
	       JMP  EP124
;
EP128:	       CMP  BYTE PTR ES:[DI-1],'\'   ;check if root and skip add of
	       JE   EP129		     ; file separator
;
	       MOV  BYTE PTR ES:[DI],'\'     ;add path and filename separator
	       INC  DI			     ;point to where filename goes
;
EP129:	       POP  DS			     ;now move color filename string
	       POP  SI			     ; to end of color buffer path
;
	       REP  MOVSB		     ;copy color index filespec
;
	       POP  DS
	       POP  SI
;
; Check for multiple DOS Service drive buffers
;
EP130:	       MOV  AX,STR_MULTIPE	     ;multiple drive display
	       CALL CHECK_STRING	     ;search for string
	       CMP  INS_RSLT,0
	       JE   EP140
;
	       ADD  COM_CMDNUM,AX
	       OR   COM_STATE,COM_DRV2
;
; Check for active maintain color option
;
EP140:	       MOV  AX,STR_CLRACT	     ;color active
	       CALL CHECK_STRING	     ;search for string
	       CMP  INS_RSLT,0		     ;
	       JE   EP150		     ;
;
	       ADD  COM_CMDNUM,AX
	       OR   COM_STATE,COM_FLCS	     ;maintain color is active
;
; Check for active maintain menu option
;
EP150:	       MOV  AX,STR_MENUACT	     ;menu maintainance active
	       CALL CHECK_STRING	     ;search for string
	       CMP  INS_RSLT,0
	       JE   EP160
;
	       ADD  COM_CMDNUM,AX
	       OR   COM_STATE,COM_FLMI	     ;maintain menu is active
;
; Check for active exit to DOS option
;
EP160:	       AND  FLAG_FSEXIT, NOT DIT_L1  ;turn exit to DOS dither off start
	       AND  FLAG_FDEXIT, NOT DIT_L1  ;turn exit file system dither off
;
	       MOV  AX,STR_EXITDOS	     ;exit to DOS active
	       CALL CHECK_STRING	     ;search for string
;
	       OR   FLAG_FSEXIT, DIT_L1      ;turn exit to DOS dither on start
;
	       TEST COM_STATE,COM_APPM	     ;app menu configured
	       JNZ  EP161		     ;
;
	       OR   FLAG_FDEXIT, DIT_L1      ;turn exit from file system dither
					     ; on
;
EP161:	       CMP  INS_RSLT,0
	       JE   EP170
;
	       ADD  COM_CMDNUM,AX
	       OR   COM_STATE,COM_FLED	     ;exit to DOS is active
;
	       AND  FLAG_FSEXIT, NOT DIT_L1  ;turn exit to DOS dither off start
	       AND  FLAG_FDEXIT, NOT DIT_L1  ;turn exit file system dither off
;
; Check for active command line option
;
EP170:	       MOV  AX,STR_CMDLINE	     ;command line active
	       CALL CHECK_STRING	     ;search for string
	       CMP  INS_RSLT,0
	       JE   EP180
;
	       ADD  COM_CMDNUM,AX
	       OR   COM_STATE,COM_FLCL	     ;command line is active
;
; Check for predefined menu installation option
;
EP180:	       MOV  AX,STR_PREDACT	     ;predefined menu active
	       CALL CHECK_STRING	     ;search for string
	       CMP  INS_RSLT,0
	       JE   EP190
;
	       ADD  COM_CMDNUM,AX
	       OR   COM_STATE,COM_AUTI	     ;predefined is active
;
; Check for mouse filename /MOS:filename.MOS
;
EP190:	       XOR  AX,AX		     ;get current drive
	       MOV  AH,19H
	       INT  21H
	       ADD  AL,65		     ;convert from # to alpha char
	       MOV  COM_VFILSPEC,AL	     ;complete current drive and path
;
	       MOV  AH,47H		     ;read current path
	       MOV  DL,0
	       LEA  SI,COM_VFILSPEC+3	     ;point past C:\
	       INT  21H
	       JNC  EP191		     ;check for error
;
	       MOV  COM_ERRID,ERR_BADD	     ;bad disk or drive door open
	       JMP  EPEXIT
;
EP191:	       MOV  AX,STR_MOUSACT	     ;mouse active
	       CALL CHECK_STRING	     ;search for string
	       CMP  INS_RSLT,0		     ;check if not found, error
	       JG   EP192
;
	       JMP  EP200		     ;mouse is not active get next var
;
EP192:	       OR   COM_STATE,COM_MOUS	     ;mouse is active
	       ADD  COM_CMDNUM,AX
;
	       PUSH INS_FOFF		     ;save invocation parameter offset
;
	       MOV  CX,INS_RSLT 	     ;save starting search point
	       ADD  CX,INS_FLEN 	     ;point past /MOS: to beginning of
					     ; mouse file name
;
	       MOV  AX,STR_MOSEXT	     ;mouse extension
	       CALL FAR PTR GET_STRING
;
	       MOV  INS_FLEN,AX 	     ;length of find string
	       MOV  INS_FOFF,DI 	     ;offset of find string '.MOS'
	       MOV  INS_FSEG,ES 	     ;segment of string
	       CALL PCINSTR_CALL	     ;search for string
;
	       POP  INS_FOFF		     ;restore before exit
;
	       CMP  INS_RSLT,0
	       JG   EP193
;
	       MOV  COM_ERRID,ERR_MOUS	     ;invalid mouse driver
	       JMP  EPEXIT
;
EP193:	       PUSH SI
	       PUSH DS
;
	       MOV  AX,INS_RSLT
	       SUB  AX,CX		     ;ending offset - starting offset
	       ADD  AX,INS_FLEN 	     ; + length of extension = # bytes
					     ; to move
	       ADD  COM_CMDNUM,AX
	       MOV  BX,INS_SOFF 	     ;calculate offset of source strg
	       ADD  BX,CX		     ; to move
	       DEC  BX
;
	       PUSH BX			     ;save source offset
	       PUSH INS_SSEG		     ;save source segment
;
	       MOV  CX,AX		     ; = number of bytes to move
	       LEA  DI,COM_VFILSPEC	     ;get dest offset
;
	       PUSH DS
	       PUSH ES
	       POP  DS
	       POP  ES
;
EP194:	       MOV  AL,ES:[DI]		     ;locate end of drive and path
	       CMP  AL,0		     ; in shell mouse file buffer
	       JE   EP198
;
	       INC  DI			     ;point to next character
	       JMP  EP194
;
EP198:	       CMP  BYTE PTR ES:[DI-1],'\'   ;check if root and skip add of
	       JE   EP199		     ; file separator
;
	       MOV  BYTE PTR ES:[DI],'\'     ;add path and filename separator
	       INC  DI			     ;point to where filename goes
;
EP199:	       POP  DS			     ;now move mouse filename string
	       POP  SI			     ; to end of mouse buffer path
;
	       REP  MOVSB		     ;copy mouse index filespec
;
	       POP  DS
	       POP  SI
;
; Check for left hand mouse option
;
EP200:	       MOV  AX,STR_LEFTACT	     ;left hand mouse
	       CALL CHECK_STRING	     ;search for string
	       CMP  INS_RSLT,0
	       JE   EP205
;
	       ADD  COM_CMDNUM,AX
	       OR   COM_STATE,COM_LFMS	     ;left hand mouse
;
; Check for sound active option
;
EP205:	       MOV  AX,STR_SOUDACT	     ;sound active
	       CALL CHECK_STRING	     ;search for string
	       CMP  INS_RSLT,0
	       JE   EP207
;
	       ADD  COM_CMDNUM,AX
	       OR   COM_STATE2,COM_SOUD      ;sound active
;
; Check for dir/file buffer save option
;
EP207:	       MOV  AX,STR_DFSAVE	     ;check if option active
	       CALL CHECK_STRING	     ;search for string
	       CMP  INS_RSLT,0
	       JE   EP210
;
	       ADD  COM_CMDNUM,AX
	       OR   COM_STATE2,COM_DFSAVE    ;dir/file buffer save option
					     ; active
;
; Save filespec of shell.hlp at COM_HFILSPEC
;
EP210:	       XOR  AX,AX		     ;get current drive
	       MOV  AH,19H
	       INT  21H
	       ADD  AL,65		     ;convert from # to alpha char
	       MOV  COM_HFILSPEC,AL	     ;complete current drive and path
;
	       MOV  AH,47H		     ;read current path
	       MOV  DL,0
	       LEA  SI,COM_HFILSPEC+3	     ;point past C:\
	       INT  21H
	       JNC  EP250
;
	       MOV  COM_ERRID,ERR_BADD	     ;bad disk or drive door open
	       JMP  EPEXIT
;
EP250:	       LEA  DI,COM_HFILSPEC	     ;get dest offset
;
	       MOV  AX,DS
	       MOV  ES,AX
;
EP260:	       MOV  AL,ES:[DI]		     ;locate end of drive and path
	       CMP  AL,0		     ; in shell help file buffer
	       JE   EP270
;
	       INC  DI			     ;point to next character
	       JMP  EP260
;
EP270:	       CMP  BYTE PTR ES:[DI-1],'\'   ;check if root and skip add of
	       JE   EP275		     ; file separator
;
	       MOV  BYTE PTR ES:[DI],'\'     ;add path and filename separator
	       INC  DI			     ;point to where filename goes
;
EP275:	       PUSH DS			     ;save register
;
	       PUSH DI
	       MOV  AX,STR_HLPFILE	     ;default help text filename
	       CALL FAR PTR GET_STRING
	       MOV  SI,DI		     ;get offset of SHELL.HLP
	       MOV  CX,AX		     ;get length
	       POP  DI
;
	       PUSH ES			     ;set source segment
	       POP  DS
;
	       REP  MOVSB
;
	       POP  DS			     ;restore
;
; Check for associate filename /ASC:filename.ASC
;
EP300:	       XOR  AX,AX		     ;get current drive
	       MOV  AH,19H
	       INT  21H
	       ADD  AL,65		     ;convert from # to alpha char
	       MOV  COM_AFILSPEC,AL	     ;complete current drive and path
;
	       MOV  AH,47H		     ;read current path
	       MOV  DL,0
	       LEA  SI,COM_AFILSPEC+3	     ;point past C:\
	       INT  21H
	       JNC  EP315		     ;check for error
;
	       MOV  COM_ERRID,ERR_BADD	     ;bad disk or drive door open
	       JMP  EPEXIT
;
EP315:	       MOV  AX,STR_ASOFILE	     ;associate filename /ASO
	       CALL CHECK_STRING	     ;search for string
	       CMP  INS_RSLT,0		     ;check if not found, error
	       JG   EP318
;
	       MOV  AX,STR_ASCEXT	     ;default associate filename
	       CALL FAR PTR GET_STRING	     ;user did not supply new app menu
;
	       PUSH SI			     ;save data segment
	       PUSH DS
;
	       PUSH DI			     ;save offset of filename
	       PUSH ES			     ;save segment of filename
;
	       JMP  EP322		     ; SHELL.ASO file
;
EP318:	       PUSH INS_FOFF		     ;save invocation parameter offset
	       ADD  COM_CMDNUM,AX
;
	       MOV  CX,INS_RSLT 	     ;save starting search point
	       ADD  CX,INS_FLEN 	     ;point past /ASO: to beginning of
					     ;	associate file name
;
	       MOV  AX,STR_ASOEXT	     ;assoicate profile extension
	       CALL FAR PTR GET_STRING
;
	       MOV  INS_FLEN,AX 	     ;length of find string
	       MOV  INS_FOFF,DI 	     ;offset of find string '.ASO'
	       MOV  INS_FSEG,ES 	     ;segment of string
	       CALL PCINSTR_CALL	     ;search for string
;
	       POP  INS_FOFF		     ;restore before exit
;
	       CMP  INS_RSLT,0
	       JG   EP320
;
	       MOV  COM_ERRID,ERR_ASRF	     ;invalid user associate profile
	       JMP  EPEXIT
;
EP320:	       PUSH SI
	       PUSH DS
;
	       MOV  AX,INS_RSLT
	       SUB  AX,CX		     ;ending offset - starting offset
	       ADD  AX,INS_FLEN 	     ; + length of extension = # bytes
					     ; to move
	       ADD  COM_CMDNUM,AX
	       MOV  BX,INS_SOFF 	     ;calculate offset of source strg
	       ADD  BX,CX		     ; to move
	       DEC  BX
;
	       PUSH BX			     ;save source offset
	       PUSH INS_SSEG		     ;save source segment
;
EP322:	       MOV  CX,AX		     ; = number of bytes to move
	       LEA  DI,COM_AFILSPEC	     ;get dest offset
;
	       PUSH DS
	       PUSH ES
	       POP  DS
	       POP  ES
;
EP324:	       MOV  AL,ES:[DI]		     ;locate end of drive and path
	       CMP  AL,0		     ; in shell associate file buffer
	       JE   EP328
;
	       INC  DI			     ;point to next character
	       JMP  EP324
;
EP328:	       CMP  BYTE PTR ES:[DI-1],'\'   ;check if root and skip add of
	       JE   EP329		     ; file separator
;
	       MOV  BYTE PTR ES:[DI],'\'     ;add path and filename separator
	       INC  DI			     ;point to where filename goes
;
EP329:	       POP  DS			     ;now move filename string
	       POP  SI			     ; to end of buffer path
;
	       REP  MOVSB		     ;copy associate filespec
;
	       POP  DS
	       POP  SI
;
; Check for buffer size override
;
EP350:	       MOV  AX,STR_BUFO 	     ;buffer size override active
	       CALL CHECK_STRING	     ;search for string
	       CMP  INS_RSLT,0
	       JE   EP390
;
	       ADD  COM_CMDNUM,AX
	       MOV  AX,INS_SSEG 	     ;segment of PSP
	       MOV  ES,AX
	       MOV  BX,INS_SOFF 	     ;offset of PSP
	       ADD  BX,INS_RSLT 	     ;start of /B: parm
	       ADD  BX,INS_FLEN 	     ;start of kilobyte value
	       DEC  BX			     ;adjust for zero offset
	       PUSH BX
;
EP360:	       CMP  ES:BYTE PTR[BX],'0'      ;ASCII digit GE 0
	       JB   EP370		     ;no, end of digits
;
	       CMP  ES:BYTE PTR[BX],'9'      ;ASCII digit LE 9
	       JA   EP370		     ;no, end of digits
;
	       INC  BX
	       JMP  EP360		     ;check next digit
;
EP370:	       POP  AX
	       CMP  AX,BX		     ;any digits?
	       JE   EP390		     ;no, ignore /B parm
;
	       MOV  ST2_OPT1,ST2_DEC16BI+ST2_SETSTRLEN
					     ;convert ASCII value
	       MOV  ST2_STRGSEG,ES	     ;segment of value
	       MOV  ST2_STRGOFF,AX	     ;offset of value
	       SUB  BX,AX		     ;calculate numbers of digits
	       MOV  ST2_STRGLEN,BX	     ;set length to convert
	       ADD  COM_CMDNUM,BX
;
	       CALL PCST2IN_CALL	     ;convert the value
;
	       TEST ST2_ERROR,ST2_OUTOFMEM   ;value too large
	       JNZ  EP375		     ;yes, set to fail during alloc
;
	       CMP  ST2_NUMH,0		     ;value too large
	       JNE  EP375		     ;yes, set to fail during alloc
;
	       CMP  ST2_NUML,960	     ;value to large
	       JB   EP380		     ;no, attempt to alloc it
;
EP375:	       MOV  COM_DFSIZE,0F000H	     ;set to fail during alloc
	       JMP  EP385

EP380:	       MOV  AX,ST2_NUML 	     ;get kilobyte value
	       MOV  BX,64		     ;convert to paragraphs
	       MUL  BX			     ;kilo -> para
	       MOV  COM_DFSIZE,AX	     ;set value to allocate

EP385:	       OR   COM_STATE2,COM_BUFO      ;buffer size override active
;
; Check if DBCS is active
;
EP390:	       MOV  AX,STR_DBCS 	     ;DBCS active
	       CALL CHECK_STRING	     ;search for string
	       CMP  INS_RSLT,0
	       JE   EP395
;
	       ADD  COM_CMDNUM,AX
	       OR   COM_STATE2,COM_DBCS      ;DBCS active
;
; Check for date/time active option
;
EP395:	       MOV  AX,STR_DATE 	     ;date active
	       CALL CHECK_STRING	     ;search for string
	       CMP  INS_RSLT,0
	       JE   EP397
;
	       ADD  COM_CMDNUM,AX
	       OR   COM_STATE2,COM_DATE      ;date/time active
;
; Check for COM2 active option
;
EP397:	       MOV  AX,STR_COM2 	     ;COM2 active
	       CALL CHECK_STRING	     ;search for string
	       CMP  INS_RSLT,0
	       JE   EP398
;
	       ADD  COM_CMDNUM,AX
	       OR   COM_STATE2,COM_COM2      ;COM2 active
;
; Check for enhancement activation
;
EP398:	       MOV  AX,STR_ENH		     ;COM2 active
	       CALL CHECK_STRING	     ;search for string
	       CMP  INS_RSLT,0		     ;
;>>SN	       JE   EP400
	       JE   EP399		     ;>>SN
;
	       ADD  COM_CMDNUM,AX
	       OR   COM_STATE2,COM_ENHA      ;COM2 active
;					     ;>>SN
; Check for Special Needs option	     ;>>SN
;					     ;>>SN
EP399:	       MOV  AX, STR_SN		     ;>>SN
	       CALL CHECK_STRING	     ;>>SN
	       CMP  INS_RSLT,0		     ;>>SN
	       JE   EP400		     ;>>SN
;					     ;>>SN
	       ADD  COM_CMDNUM, AX	     ;>>SN
	       OR   COM_STATE2,COM_SNA	     ;>>SN
;
; Check for invalid parameters
;
EP400:
	       MOV  AX, COM_CMDACT
	       CMP  AX, COM_CMDNUM
	       JE   EP405
;
	       MOV  COM_ERRID,ERR_BADCMD
	       JMP  EPEXIT
;
; Check for missing invocation parameter errors
;
EP405:	       TEST COM_STATE,COM_APPM
	       JNE  EP410
;
	       TEST COM_STATE,COM_DOSS
	       JNE  EP410
;
	       MOV  COM_ERRID,ERR_NODA	     ;dos/app both not active
	       JMP  EPEXIT
;
; Turn off color selection if mode 11 active
;
EP410:	       TEST COM_STATE,COM_M11H	     ;
	       JZ   EPEXIT		     ;
;
	       AND  COM_STATE, NOT COM_FLCS  ;
;
EPEXIT: 				     ;exit
;
	       RET
EXAMINE_PSP    ENDP
;
PAGE
;-----------------------------------------------------------------------------+
;									      :
; Name: 		CHECK_STRING					      :
;									      :
; Description:		Search for string identified by AX.		      :
;									      :
; Entry:		AX	    = String ID.			      :
;									      :
; Exit: 		INS_RSLT    = Offset into search string where match   :
;				      found.				      :
; Entry point:		CHECK_STRING					      :
;									      :
; Notes:		None.						      :
;									      :
; Internal references:	None.						      :
;									      :
; External references:	None.						      :
;									      :
;-----------------------------------------------------------------------------+
;
CHECK_STRING   PROC NEAR
;
	       CALL FAR PTR GET_STRING	     ;get address and length of string
;
	       MOV  INS_SPOFF,0 	     ;start at beginning of command lin
	       MOV  INS_FLEN,AX 	     ;set length of string to find
	       MOV  INS_FOFF,DI 	     ;set offset of string to find
	       MOV  INS_FSEG,ES 	     ;set segment of string to find
	       CALL PCINSTR_CALL
;
CHKSEXIT:				     ;exit
;
	       RET
CHECK_STRING   ENDP