summaryrefslogtreecommitdiff
path: root/packages/arosunits/src/exec.pas
blob: 7b8c83b18b12a7d6bd43dc24ce0c447ef5777bff (plain)
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
{
    This file is part of the Free Pascal run time library.

    A file in Amiga system run time library.
    Copyright (c) 1998-2000 by Nils Sjoholm
    member of the Amiga RTL development team.

    See the file COPYING.FPC, included in this distribution,
    for details about the copyright.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 **********************************************************************}

{
    History:
    Added overlay functions for Pchar->Strings, functions
    and procedures. Now you can mix PChar and Strings e.g
    OpenLibrary('whatis.library',37). No need to cast to
    a PChar.
    12 Oct 1998.

    More missing functions added.
    Added BitMask,
    IsListEmpty and
    IsMsgPortEmpty.
    22 Aug 2000.

    Bug found in
    AllocSignal,
    OpenDevice,
    SetTaskPri,
    WaitIO
    and DoIO.
    The stubs for this functions push a long for result,
    the result was defined as a shortint. If you tried
    to use any of those functions you get a big crash.
    Just changed the result to a longint.
    06 Sep 2000.

    Fixed the above functions so that they return a
    shortint as they should. Made some changes to the
    stub.
    20 Sep 2000.

    Put together exec.pp and exec.inc.
    04 Feb 2003.

    Update for AmigaOS 3.9.
    Added some consts and a record.
    Functions added.
         PROCEDURE NewMinList
         FUNCTION AVL_AddNode
         FUNCTION AVL_RemNodeByAddress
         FUNCTION AVL_RemNodeByKey
         FUNCTION AVL_FindNode
         FUNCTION AVL_FindPrevNodeByAddress
         FUNCTION AVL_FindPrevNodeByKey
         FUNCTION AVL_FindNextNodeByAddress
         FUNCTION AVL_FindNextNodeByKey
         FUNCTION AVL_FindFirstNode
         FUNCTION AVL_FindLastNode

    05 Feb 2003.

    Changed integer > smallint.
    Retyped ULONG to longword
    09 Feb 2003.

    nils.sjoholm@mailbox.swipnet.se
}


UNIT EXEC;


INTERFACE

{
    History:

    Added BOOL = smallint, some libraries need that define
    (read triton, wizard)
    25 Oct 1998

    Added UWORD, WORDBITS, LONGBITS, PLONGBITS,
          UBYTE, PULONG, PAPTR, PLONG.
          For use with MUI.
    17 Jul 2000.

    nils.sjoholm@mailbox.swipnet.se
}

TYPE

       STRPTR   = PChar;
       ULONG    = Longword;
       LONG     = longint;
       APTR     = Pointer;
       BPTR     = Longint;
       BSTR     = Longint;
       BOOL     = smallint;
       UWORD    = Word;
       WORDBITS = Word;
       LONGBITS = longword;
       PLONGBITS = ^LONGBITS;
       UBYTE    = Byte;
       PULONG   = ^longword;
       PAPTR    = ^APTR;
       PLONG    = ^LONG;
       psmallint = ^smallint;

const
       {There is a problem with boolean
       vaules in taglists, just use this
       for now instead}
       ltrue  : longint = 1;
       lfalse : longint = 0;

TYPE

{ *  List Node Structure.  Each member in a list starts with a Node * }

  pNode = ^tNode;
  tNode =  Record
    ln_Succ,                { * Pointer to next (successor) * }
    ln_Pred  : pNode;       { * Pointer to previous (predecessor) * }
    ln_Name  : STRPTR;      { * ID string, null terminated * }
    ln_Type  : Byte;
    ln_Pri   : Shortint;        { * Priority, for sorting * }
  End;  { * Note: smallint aligned * }

(*  BinCompat Mode?  
  tNode =  Record
    ln_Succ,                { * Pointer to next (successor) * }
    ln_Pred  : pNode;       { * Pointer to previous (predecessor) * }
    ln_Type  : Byte;
    ln_Pri   : Shortint;        { * Priority, for sorting * }
    ln_Name  : STRPTR;      { * ID string, null terminated * }
  End;  { * Note: smallint aligned * }
*)

{ * minimal node -- no type checking possible * }

  pMinNode = ^tMinNode;
  tMinNode =  Record
    mln_Succ,
    mln_Pred  : pMinNode;
  End;



{ *
** Note: Newly initialized IORequests, and software interrupt structures
** used with Cause(), should have type NT_UNKNOWN.  The OS will assign a type
** when they are first used.
* }

{ *----- Node Types for LN_TYPE -----* }

Const

  NT_UNKNOWN      =  0;
  NT_TASK     =  1;  { * Exec task * }
  NT_INTERRUPT    =  2;
  NT_DEVICE   =  3;
  NT_MSGPORT      =  4;
  NT_MESSAGE      =  5;  { * Indicates message currently pending * }
  NT_FREEMSG      =  6;
  NT_REPLYMSG     =  7;  { * Message has been replied * }
  NT_RESOURCE     =  8;
  NT_LIBRARY      =  9;
  NT_MEMORY   = 10;
  NT_SOFTINT      = 11;  { * Internal flag used by SoftInits * }
  NT_FONT     = 12;
  NT_PROCESS      = 13;  { * AmigaDOS Process * }
  NT_SEMAPHORE    = 14;
  NT_SIGNALSEM    = 15;  { * signal semaphores * }
  NT_BOOTNODE     = 16;
  NT_KICKMEM      = 17;
  NT_GRAPHICS     = 18;
  NT_DEATHMESSAGE = 19;

  NT_USER     = 254;  { * User node types work down from here * }
  NT_EXTENDED     = 255;

{
    This file defines Exec system lists, which are used to link
    various things.  Exec provides several routines to handle list
    processing (defined at the bottom of this file), so you can
    use these routines to save yourself the trouble of writing a list
    package.
}


Type

{ normal, full featured list }

    pList = ^tList;
    tList =  record
    lh_Head     : pNode;
    lh_Tail     : pNode;
    lh_TailPred : pNode;
    lh_Type     : Byte;
    l_pad       : Byte;
    end;

{ minimum list -- no type checking possible }

    pMinList = ^tMinList;
    tMinList =  record
    mlh_Head        : pMinNode;
    mlh_Tail        : pMinNode;
    mlh_TailPred    : pMinNode;
    end;



{ ********************************************************************
*
*  Format of the alert error number:
*
*    +-+-------------+----------------+--------------------------------+
*    |D|  SubSysId   |  General Error |    SubSystem Specific Error    |
*    +-+-------------+----------------+--------------------------------+
*     1    7 bits          8 bits                  16 bits
*
*                    D:  DeadEnd alert
*             SubSysId:  indicates ROM subsystem number.
*        General Error:  roughly indicates what the error was
*       Specific Error:  indicates more detail
*********************************************************************}

const
{*********************************************************************
*
*  Hardware/CPU specific alerts:  They may show without the 8 at the
*  front of the number.  These are CPU/68000 specific.  See 68$0
*  programmer's manuals for more details.
*
*********************************************************************}
    ACPU_BusErr     = $80000002;      { Hardware bus fault/access error }
    ACPU_AddressErr = $80000003;      { Illegal address access (ie: odd) }
    ACPU_InstErr    = $80000004;      { Illegal instruction }
    ACPU_DivZero    = $80000005;      { Divide by zero }
    ACPU_CHK        = $80000006;      { Check instruction error }
    ACPU_TRAPV      = $80000007;      { TrapV instruction error }
    ACPU_PrivErr    = $80000008;      { Privilege violation error }
    ACPU_Trace      = $80000009;      { Trace error }
    ACPU_LineA      = $8000000A;      { Line 1010 Emulator error }
    ACPU_LineF      = $8000000B;      { Line 1111 Emulator error }
    ACPU_Format     = $8000000E;      { Stack frame format error }
    ACPU_Spurious   = $80000018;      { Spurious interrupt error }
    ACPU_AutoVec1   = $80000019;      { AutoVector Level 1 interrupt error }
    ACPU_AutoVec2   = $8000001A;      { AutoVector Level 2 interrupt error }
    ACPU_AutoVec3   = $8000001B;      { AutoVector Level 3 interrupt error }
    ACPU_AutoVec4   = $8000001C;      { AutoVector Level 4 interrupt error }
    ACPU_AutoVec5   = $8000001D;      { AutoVector Level 5 interrupt error }
    ACPU_AutoVec6   = $8000001E;      { AutoVector Level 6 interrupt error }
    ACPU_AutoVec7   = $8000001F;      { AutoVector Level 7 interrupt error }


{ ********************************************************************
*
*  General Alerts
*
*  For example: timer.device cannot open math.library would be $05038015
*
*       Alert(AN_TimerDev|AG_OpenLib|AO_MathLib);
*
********************************************************************}


CONST

{ ------ alert types }
  AT_DeadEnd    = $80000000;
  AT_Recovery   = $00000000;


{ ------ general purpose alert codes }
  AG_NoMemory   = $00010000;
  AG_MakeLib    = $00020000;
  AG_OpenLib    = $00030000;
  AG_OpenDev    = $00040000;
  AG_OpenRes    = $00050000;
  AG_IOError    = $00060000;
  AG_NoSignal   = $00070000;
  AG_BadParm    = $00080000;
  AG_CloseLib   = $00090000;    { usually too many closes }
  AG_CloseDev   = $000A0000;    { or a mismatched close }
  AG_ProcCreate = $000B0000;    { Process creation failed }


{ ------ alert objects: }
  AO_ExecLib      = $00008001;
  AO_GraphicsLib  = $00008002;
  AO_LayersLib    = $00008003;
  AO_Intuition    = $00008004;
  AO_MathLib      = $00008005;
  AO_DOSLib       = $00008007;
  AO_RAMLib       = $00008008;
  AO_IconLib      = $00008009;
  AO_ExpansionLib = $0000800A;
  AO_DiskfontLib  = $0000800B;
  AO_UtilityLib   = $0000800C;
  AO_KeyMapLib    = $0000800D;

  AO_AudioDev     = $00008010;
  AO_ConsoleDev   = $00008011;
  AO_GamePortDev  = $00008012;
  AO_KeyboardDev  = $00008013;
  AO_TrackDiskDev = $00008014;
  AO_TimerDev     = $00008015;

  AO_CIARsrc    = $00008020;
  AO_DiskRsrc   = $00008021;
  AO_MiscRsrc   = $00008022;

  AO_BootStrap  = $00008030;
  AO_Workbench  = $00008031;
  AO_DiskCopy   = $00008032;
  AO_GadTools   = $00008033;
  AO_Unknown    = $00008035;



{ ********************************************************************
*
*   Specific Alerts:
*
********************************************************************}

{ ------ exec.library }

  AN_ExecLib    = $01000000;
  AN_ExcptVect  = $01000001; {  68000 exception vector checksum (obs.) }
  AN_BaseChkSum = $01000002; {  Execbase checksum (obs.) }
  AN_LibChkSum  = $01000003; {  Library checksum failure }

  AN_MemCorrupt = $81000005; {  Corrupt memory list detected in FreeMem }
  AN_IntrMem    = $81000006; {  No memory for interrupt servers }
  AN_InitAPtr   = $01000007; {  InitStruct() of an APTR source (obs.) }
  AN_SemCorrupt = $01000008; {  A semaphore is in an illegal state
                                      at ReleaseSempahore() }
  AN_FreeTwice    = $01000009; {  Freeing memory already freed }
  AN_BogusExcpt   = $8100000A; {  illegal 68k exception taken (obs.) }
  AN_IOUsedTwice  = $0100000B; {  Attempt to reuse active IORequest }
  AN_MemoryInsane = $0100000C; {  Sanity check on memory list failed
                                      during AvailMem(MEMF_LARGEST) }
  AN_IOAfterClose = $0100000D; {  IO attempted on closed IORequest }
  AN_StackProbe   = $0100000E; {  Stack appears to extend out of range }
  AN_BadFreeAddr  = $0100000F; {  Memory header not located. [ Usually an
                                  invalid address passed to FreeMem() ] }
  AN_BadSemaphore = $01000010; { An attempt was made to use the old
                                      message semaphores. }

{ ------ graphics.library }

  AN_GraphicsLib  = $02000000;
  AN_GfxNoMem     = $82010000;  {  graphics out of memory }
  AN_GfxNoMemMspc = $82010001;  {  MonitorSpec alloc, no memory }
  AN_LongFrame    = $82010006;  {  long frame, no memory }
  AN_ShortFrame   = $82010007;  {  short frame, no memory }
  AN_TextTmpRas   = $02010009;  {  text, no memory for TmpRas }
  AN_BltBitMap    = $8201000A;  {  BltBitMap, no memory }
  AN_RegionMemory = $8201000B;  {  regions, memory not available }
  AN_MakeVPort    = $82010030;  {  MakeVPort, no memory }
  AN_GfxNewError  = $0200000C;
  AN_GfxFreeError = $0200000D;

  AN_GfxNoLCM     = $82011234;  {  emergency memory not available }

  AN_ObsoleteFont = $02000401;  {  unsupported font description used }

{ ------ layers.library }

  AN_LayersLib    = $03000000;
  AN_LayersNoMem  = $83010000;  {  layers out of memory }

{ ------ intuition.library }
  AN_Intuition    = $04000000;
  AN_GadgetType   = $84000001;  {  unknown gadget type }
  AN_BadGadget    = $04000001;  {  Recovery form of AN_GadgetType }
  AN_CreatePort   = $84010002;  {  create port, no memory }
  AN_ItemAlloc    = $04010003;  {  item plane alloc, no memory }
  AN_SubAlloc     = $04010004;  {  sub alloc, no memory }
  AN_PlaneAlloc   = $84010005;  {  plane alloc, no memory }
  AN_ItemBoxTop   = $84000006;  {  item box top < RelZero }
  AN_OpenScreen   = $84010007;  {  open screen, no memory }
  AN_OpenScrnRast = $84010008;  {  open screen, raster alloc, no memory }
  AN_SysScrnType  = $84000009;  {  open sys screen, unknown type }
  AN_AddSWGadget  = $8401000A;  {  add SW gadgets, no memory }
  AN_OpenWindow   = $8401000B;  {  open window, no memory }
  AN_BadState     = $8400000C;  {  Bad State Return entering Intuition }
  AN_BadMessage   = $8400000D;  {  Bad Message received by IDCMP }
  AN_WeirdEcho    = $8400000E;  {  Weird echo causing incomprehension }
  AN_NoConsole    = $8400000F;  {  couldn't open the Console Device }
  AN_NoISem       = $04000010;  { Intuition skipped obtaining a sem }
  AN_ISemOrder    = $04000011;  { Intuition obtained a sem in bad order }

{ ------ math.library }

  AN_MathLib      = $05000000;

{ ------ dos.library }

  AN_DOSLib       = $07000000;
  AN_StartMem     = $07010001; {  no memory at startup }
  AN_EndTask      = $07000002; {  EndTask didn't }
  AN_QPktFail     = $07000003; {  Qpkt failure }
  AN_AsyncPkt     = $07000004; {  Unexpected packet received }
  AN_FreeVec      = $07000005; {  Freevec failed }
  AN_DiskBlkSeq   = $07000006; {  Disk block sequence error }
  AN_BitMap       = $07000007; {  Bitmap corrupt }
  AN_KeyFree      = $07000008; {  Key already free }
  AN_BadChkSum    = $07000009; {  Invalid checksum }
  AN_DiskError    = $0700000A; {  Disk Error }
  AN_KeyRange     = $0700000B; {  Key out of range }
  AN_BadOverlay   = $0700000C; {  Bad overlay }
  AN_BadInitFunc  = $0700000D; {  Invalid init packet for cli/shell }
  AN_FileReclosed = $0700000E; {  A filehandle was closed more than once }

{ ------ ramlib.library }

  AN_RAMLib       = $08000000;
  AN_BadSegList   = $08000001;  {  no overlays in library seglists }

{ ------ icon.library }

  AN_IconLib      = $09000000;

{ ------ expansion.library }

  AN_ExpansionLib       = $0A000000;
  AN_BadExpansionFree   = $0A000001; {  freeed free region }

{ ------ diskfont.library }

  AN_DiskfontLib        = $0B000000;

{ ------ audio.device }

  AN_AudioDev   = $10000000;

{ ------ console.device }

  AN_ConsoleDev = $11000000;
  AN_NoWindow   = $11000001;    {  Console can't open initial window }

{ ------ gameport.device }

  AN_GamePortDev        = $12000000;

{ ------ keyboard.device }

  AN_KeyboardDev        = $13000000;

{ ------ trackdisk.device }

  AN_TrackDiskDev = $14000000;
  AN_TDCalibSeek  = $14000001;  {  calibrate: seek error }
  AN_TDDelay      = $14000002;  {  delay: error on timer wait }

{ ------ timer.device }

  AN_TimerDev     = $15000000;
  AN_TMBadReq     = $15000001; {  bad request }
  AN_TMBadSupply  = $15000002; {  power supply -- no 50/60Hz ticks }

{ ------ cia.resource }

  AN_CIARsrc      = $20000000;

{ ------ disk.resource }

  AN_DiskRsrc   = $21000000;
  AN_DRHasDisk  = $21000001;    {  get unit: already has disk }
  AN_DRIntNoAct = $21000002;    {  interrupt: no active unit }

{ ------ misc.resource }

  AN_MiscRsrc   = $22000000;

{ ------ bootstrap }

  AN_BootStrap  = $30000000;
  AN_BootError  = $30000001;    {  boot code returned an error }

{ ------ Workbench }

  AN_Workbench          = $31000000;
  AN_NoFonts            = $B1000001;
  AN_WBBadStartupMsg1   = $31000001;
  AN_WBBadStartupMsg2   = $31000002;
  AN_WBBadIOMsg         = $31000003;

  AN_WBReLayoutToolMenu          = $B1010009;

{ ------ DiskCopy }

  AN_DiskCopy   = $32000000;

{ ------ toolkit for Intuition }

  AN_GadTools   = $33000000;

{ ------ System utility library }

  AN_UtilityLib = $34000000;

{ ------ For use by any application that needs it }

  AN_Unknown    = $35000000;



CONST

  IOERR_OPENFAIL   = -1;    {  device/unit failed to open  }
  IOERR_ABORTED    = -2;    {  request terminated early [after AbortIO()]  }
  IOERR_NOCMD      = -3;    {  command not supported by device  }
  IOERR_BADLENGTH  = -4;    {  not a valid length (usually IO_LENGTH)  }
  IOERR_BADADDRESS = -5;    {  invalid address (misaligned or bad range)  }
  IOERR_UNITBUSY   = -6;    {  device opens ok, but requested unit is busy  }
  IOERR_SELFTEST   = -7;    {  hardware failed self-test  }



type
    pResident = ^tResident;
    tResident =  record
    rt_MatchWord  : Word;        { smallint to match on (ILLEGAL)  }
    rt_MatchTag   : pResident;    { pointer to the above        }
    rt_EndSkip    : Pointer;      { address to continue scan    }
    rt_Flags      : Byte;        { various tag flags           }
    rt_Version    : Byte;        { release version number      }
    rt_Type       : Byte;        { type of module (NT_mumble)  }
    rt_Pri        : Shortint;         { initialization priority     }
    rt_Name       : STRPTR;       { pointer to node name        }
    rt_IdString   : STRPTR;       { pointer to ident string     }
    rt_Init       : Pointer;      { pointer to init code        }
    end;

const


    RTC_MATCHWORD   = $4AFC;

    RTF_AUTOINIT    = $80;
    RTF_AFTERDOS    = $04;
    RTF_SINGLETASK  = $02;
    RTF_COLDSTART   = $01;


{ Compatibility: }

    RTM_WHEN        = $03;
    RTW_COLDSTART   = $01;
    RTW_NEVER       = $00;



TYPE

{ ****** MemChunk **************************************************** }

  pMemChunk = ^tMemChunk;
  tMemChunk =  Record
    mc_Next  : pMemChunk;       { * pointer to next chunk * }
    mc_Bytes : ULONG;           { * chunk byte size     * }
  End;


{ ****** MemHeader *************************************************** }

  pMemHeader = ^tMemHeader;
  tMemHeader =  Record
    mh_Node       : tNode;
    mh_Attributes : Word;       { * characteristics of this region * }
    mh_First      : pMemChunk;   { * first free region          * }
    mh_Lower,                    { * lower memory bound         * }
    mh_Upper      : Pointer;     { * upper memory bound+1       * }
    mh_Free       : Ulong;       { * total number of free bytes * }
  End;


{ ****** MemEntry **************************************************** }

  pMemEntry = ^tMemEntry;
  tMemEntry =  record
           me_Un : record
                case longint of
                   0 : ( meu_Reqs : ULONG );
                   1 : ( meu_Addr : APTR );
                end;
            me_Length : ULONG;
         end;

{ ****** MemList ***************************************************** }

{ * Note: sizeof(struct MemList) includes the size of the first MemEntry! * }

  pMemList = ^tMemList;
  tMemList =  Record
    ml_Node       : tNode;
    ml_NumEntries : Word;      { * number of entries in this struct * }
    ml_ME         : Array [0..0] of tMemEntry;    { * the first entry * }
  End;

{ *----- Memory Requirement Types ---------------------------* }
{ *----- See the AllocMem() documentation for details--------* }

Const

   MEMF_ANY      = %000000000000000000000000;   { * Any type of memory will do * }
   MEMF_PUBLIC   = %000000000000000000000001;
   MEMF_CHIP     = %000000000000000000000010;
   MEMF_FAST     = %000000000000000000000100;
   MEMF_LOCAL    = %000000000000000100000000;
   MEMF_24BITDMA = %000000000000001000000000;   { * DMAable memory within 24 bits of address * }
   MEMF_KICK     = %000000000000010000000000;   { Memory that can be used for KickTags }

   MEMF_CLEAR    = %000000010000000000000000;
   MEMF_LARGEST  = %000000100000000000000000;
   MEMF_REVERSE  = %000001000000000000000000;
   MEMF_TOTAL    = %000010000000000000000000;   { * AvailMem: return total size of memory * }
   MEMF_NO_EXPUNGE = $80000000;   {AllocMem: Do not cause expunge on failure }

   MEM_BLOCKSIZE = 8;
   MEM_BLOCKMASK = MEM_BLOCKSIZE-1;

Type
{***** MemHandlerData *********************************************}
{ Note:  This structure is *READ ONLY* and only EXEC can create it!}

 pMemHandlerData = ^tMemHandlerData;
 tMemHandlerData =  Record
        memh_RequestSize,       { Requested allocation size }
        memh_RequestFlags,      { Requested allocation flags }
        memh_Flags  : ULONG;    { Flags (see below) }
 end;

const
    MEMHF_RECYCLE  = 1; { 0==First time, 1==recycle }

{***** Low Memory handler return values **************************}
    MEM_DID_NOTHING = 0;     { Nothing we could do... }
    MEM_ALL_DONE    = -1;    { We did all we could do }
    MEM_TRY_AGAIN   = 1;     { We did some, try the allocation again }


type
    pInterrupt = ^tInterrupt;
    tInterrupt =  record
        is_Node : tNode;
        is_Data : Pointer;      { Server data segment }
        is_Code : Pointer;      { Server code entry }
    end;

    pIntVector = ^tIntVector;
    tIntVector =  record          { For EXEC use ONLY! }
        iv_Data : Pointer;
        iv_Code : Pointer;
        iv_Node : pNode;
    end;

    pSoftIntList = ^tSoftIntList;
    tSoftIntList =  record        { For EXEC use ONLY! }
        sh_List : tList;
        sh_Pad  : Word;
    end;

const
    SIH_PRIMASK = $F0;

{ this is a fake INT definition, used only for AddIntServer and the like }

    INTB_NMI    = 15;
    INTF_NMI    = $0080;

{
    Every Amiga Task has one of these Task structures associated with it.
    To find yours, use FindTask(Nil).  AmigaDOS processes tack a few more
    values on to the end of this structure, which is the difference between
    Tasks and Processes.
}

type

    pTask = ^tTask;
    tTask =  record
        tc_Node         : tNode;
        tc_Flags        : Byte;
        tc_State        : Byte;
        tc_IDNestCnt    : Shortint;         { intr disabled nesting         }
        tc_TDNestCnt    : Shortint;         { task disabled nesting         }
        tc_SigAlloc     : ULONG;        { sigs allocated                }
        tc_SigWait      : ULONG;        { sigs we are waiting for       }
        tc_SigRecvd     : ULONG;        { sigs we have received         }
        tc_SigExcept    : ULONG;        { sigs we will take excepts for }
        tc_TrapAlloc    : Word;        { traps allocated               }
        tc_TrapAble     : Word;        { traps enabled                 }
        tc_ExceptData   : Pointer;      { points to except data         }
        tc_ExceptCode   : Pointer;      { points to except code         }
        tc_TrapData     : Pointer;      { points to trap data           }
        tc_TrapCode     : Pointer;      { points to trap code           }
        tc_SPReg        : Pointer;      { stack pointer                 }
        tc_SPLower      : Pointer;      { stack lower bound             }
        tc_SPUpper      : Pointer;      { stack upper bound + 2         }
        tc_Switch       : Pointer;      { task losing CPU               }
        tc_Launch       : Pointer;      { task getting CPU              }
        tc_MemEntry     : tList;        { allocated memory              }
        tc_UserData     : Pointer;      { per task data                 }
    end;

{
 * Stack swap structure as passed to StackSwap()
 }
  pStackSwapStruct = ^tStackSwapStruct;
  tStackSwapStruct =  Record
        stk_Lower       : Pointer;      { Lowest byte of stack }
        stk_Upper       : ULONG;        { Upper end of stack (size + Lowest) }
        stk_Pointer     : Pointer;      { Stack pointer at switch point }
  end;



{----- Flag Bits ------------------------------------------}

const

    TB_PROCTIME         = 0;
    TB_ETASK            = 3;
    TB_STACKCHK         = 4;
    TB_EXCEPT           = 5;
    TB_SWITCH           = 6;
    TB_LAUNCH           = 7;

    TF_PROCTIME         = 1;
    TF_ETASK            = 8;
    TF_STACKCHK         = 16;
    TF_EXCEPT           = 32;
    TF_SWITCH           = 64;
    TF_LAUNCH           = 128;

{----- Task States ----------------------------------------}

    TS_INVALID          = 0;
    TS_ADDED            = 1;
    TS_RUN              = 2;
    TS_READY            = 3;
    TS_WAIT             = 4;
    TS_EXCEPT           = 5;
    TS_REMOVED          = 6;

{----- Predefined Signals -------------------------------------}

    SIGB_ABORT          = 0;
    SIGB_CHILD          = 1;
    SIGB_BLIT           = 4;
    SIGB_SINGLE         = 4;
    SIGB_INTUITION      = 5;
    SIGB_DOS            = 8;

    SIGF_ABORT          = 1;
    SIGF_CHILD          = 2;
    SIGF_BLIT           = 16;
    SIGF_SINGLE         = 16;
    SIGF_INTUITION      = 32;
    SIGF_DOS            = 256;



{
    This file defines ports and messages, which are used for inter-
    task communications using the routines defined toward the
    bottom of this file.
}

type

{****** MsgPort *****************************************************}

    pMsgPort = ^tMsgPort;
    tMsgPort = record
    mp_Node     : tNode;
    mp_Flags    : Byte;
    mp_SigBit   : Byte;     { signal bit number    }
    mp_SigTask  : Pointer;   { task to be signalled (TaskPtr) }
    mp_MsgList  : tList;     { message linked list  }
    end;

{****** Message *****************************************************}

    pMessage = ^tMessage;
    tMessage =  record
    mn_Node       : tNode;
    mn_ReplyPort  : pMsgPort;   { message reply port }
    mn_Length     : Word;      { message len in bytes }
    end;



{ mp_Flags: Port arrival actions (PutMsg) }

CONST

  PF_ACTION = 3;    { * Mask * }
  PA_SIGNAL = 0;    { * Signal task in mp_SigTask * }
  PA_SOFTINT    = 1;    { * Signal SoftInt in mp_SoftInt/mp_SigTask * }
  PA_IGNORE = 2;    { * Ignore arrival * }


        { Semaphore }
type
    pSemaphore = ^tSemaphore;
    tSemaphore =  record
        sm_MsgPort : tMsgPort;
        sm_Bids    : smallint;
    end;

{  This is the structure used to request a signal semaphore }

    pSemaphoreRequest = ^tSemaphoreRequest;
    tSemaphoreRequest =  record
        sr_Link    : tMinNode;
        sr_Waiter  : pTask;
    end;

{ The actual semaphore itself }

    pSignalSemaphore = ^tSignalSemaphore;
    tSignalSemaphore =  record
        ss_Link         : tNode;
        ss_NestCount    : smallint;
        ss_WaitQueue    : tMinList;
        ss_MultipleLink : tSemaphoreRequest;
        ss_Owner        : pTask;
        ss_QueueCount   : smallint;
    end;


{  ***** Semaphore procure message (for use in V39 Procure/Vacate *** }


 pSemaphoreMessage = ^tSemaphoreMessage;
 tSemaphoreMessage =  Record
   ssm_Message   : tMessage;
   ssm_Semaphore : pSignalSemaphore;
 end;

const
 SM_SHARED      = 1;
 SM_EXCLUSIVE   = 0;


CONST

{ ------ Special Constants --------------------------------------- }
  LIB_VECTSIZE  =  6;   {  Each library entry takes 6 bytes  }
  LIB_RESERVED  =  4;   {  Exec reserves the first 4 vectors  }
  LIB_BASE  = (-LIB_VECTSIZE);
  LIB_USERDEF   = (LIB_BASE-(LIB_RESERVED*LIB_VECTSIZE));
  LIB_NONSTD    = (LIB_USERDEF);

{ ------ Standard Functions -------------------------------------- }
  LIB_OPEN  =  -6;
  LIB_CLOSE = -12;
  LIB_EXPUNGE   = -18;
  LIB_EXTFUNC   = -24;  {  for future expansion  }

TYPE

{ ------ Library Base Structure ---------------------------------- }
{  Also used for Devices and some Resources  }

    pLibrary = ^tLibrary;
    tLibrary =  record
        lib_Node     : tNode;
        lib_Flags,
        lib_pad      : Byte;
        lib_NegSize,            {  number of bytes before library  }
        lib_PosSize,            {  number of bytes after library  }
        lib_Version,            {  major  }
        lib_Revision : Word;   {  minor  }
        lib_IdString : STRPTR;  {  ASCII identification  }
        lib_Sum      : ULONG;   {  the checksum itself  }
        lib_OpenCnt  : Word;   {  number of current opens  }
    end;                {  * Warning: size is not a longword multiple ! * }

CONST

{  lib_Flags bit definitions (all others are system reserved)  }

  LIBF_SUMMING = %00000001; {  we are currently checksumming  }
  LIBF_CHANGED = %00000010; {  we have just changed the lib  }
  LIBF_SUMUSED = %00000100; {  set if we should bother to sum  }
  LIBF_DELEXP  = %00001000; {  delayed expunge  }

{
    This file defines the constants and types required to use
    Amiga device IO routines, which are also defined here.
}


TYPE

{***** Device *****************************************************}
  pDevice = ^tDevice;
  tDevice =  record
    dd_Library : tLibrary;
  end;

{***** Unit *******************************************************}
  pUnit = ^tUnit;
  tUnit = record
      unit_MsgPort : tMsgPort;     { queue for unprocessed messages }
                    { instance of msgport is recommended }
      unit_flags,
      unit_pad     : Byte;
      unit_OpenCnt : Word;       { number of active opens }
  end;

Const
  UNITF_ACTIVE  = %00000001;
  UNITF_INTASK  = %00000010;

type

    pIORequest = ^tIORequest;
    tIORequest =  record
    io_Message  : tMessage;
    io_Device   : pDevice;      { device node pointer  }
    io_Unit     : pUnit;        { unit (driver private)}
    io_Command  : Word;        { device command }
    io_Flags    : Byte;
    io_Error    : Shortint;         { error or warning num }
    end;

    pIOStdReq = ^tIOStdReq;
    tIOStdReq =  record
    io_Message  : tMessage;
    io_Device   : pDevice;      { device node pointer  }
    io_Unit     : pUnit;        { unit (driver private)}
    io_Command  : Word;        { device command }
    io_Flags    : Byte;
    io_Error    : Shortint;         { error or warning num }
    io_Actual   : ULONG;        { actual number of bytes transferred }
    io_Length   : ULONG;        { requested number bytes transferred}
    io_Data     : Pointer;      { points to data area }
    io_Offset   : ULONG;        { offset for block structured devices }
    end;


{ library vector offsets for device reserved vectors }

const
    DEV_BEGINIO = -30;
    DEV_ABORTIO = -36;

{ io_Flags defined bits }

    IOB_QUICK   = 0;
    IOF_QUICK   = 1;

    CMD_INVALID = 0;
    CMD_RESET   = 1;
    CMD_READ    = 2;
    CMD_WRITE   = 3;
    CMD_UPDATE  = 4;
    CMD_CLEAR   = 5;
    CMD_STOP    = 6;
    CMD_START   = 7;
    CMD_FLUSH   = 8;

    CMD_NONSTD  = 9;




{  Definition of the Exec library base structure (pointed to by location 4).
** Most fields are not to be viewed or modified by user programs.  Use
** extreme caution.
 }

type

pExecBase = ^tExecBase;
tExecBase =  Record
        LibNode    : tLibrary;   {  Standard library node  }

{ ******* Static System Variables ******* }

        SoftVer      : Word;   {  kickstart release number (obs.)  }
        LowMemChkSum : smallint;    {  checksum of 68000 trap vectors  }
        ChkBase      : ULONG;   {  system base pointer complement  }
        ColdCapture,            {  coldstart soft capture vector  }
        CoolCapture,            {  coolstart soft capture vector  }
        WarmCapture,            {  warmstart soft capture vector  }
        SysStkUpper,            {  system stack base   (upper bound)  }
        SysStkLower  : Pointer; {  top of system stack (lower bound)  }
        MaxLocMem    : ULONG;   {  top of chip memory  }
        DebugEntry,             {  global debugger entry point  }
        DebugData,              {  global debugger data segment  }
        AlertData,              {  alert data segment  }
        MaxExtMem    : Pointer; {  top of extended mem, or null if none  }

        ChkSum       : Word;   {  for all of the above (minus 2)  }

{ ***** Interrupt Related ************************************** }

        IntVects     : Array[0..15] of tIntVector;

{ ***** Dynamic System Variables ************************************ }

        ThisTask     : pTask;   {  pointer to current task (readable)  }

        IdleCount,              {  idle counter  }
        DispCount    : ULONG;   {  dispatch counter  }
        Quantum,                {  time slice quantum  }
        Elapsed,                {  current quantum ticks  }
        SysFlags     : Word;   {  misc internal system flags  }
        IDNestCnt,              {  interrupt disable nesting count  }
        TDNestCnt    : Shortint;    {  task disable nesting count  }

        AttnFlags,              {  special attention flags (readable)  }
        AttnResched  : Word;   {  rescheduling attention  }
        ResModules,             {  resident module array pointer  }
        TaskTrapCode,
        TaskExceptCode,
        TaskExitCode : Pointer;
        TaskSigAlloc : ULONG;
        TaskTrapAlloc: Word;


{ ***** System Lists (private!) ******************************* }

        MemList,
        ResourceList,
        DeviceList,
        IntrList,
        LibList,
        PortList,
        TaskReady,
        TaskWait     : tList;

        SoftInts     : Array[0..4] of tSoftIntList;

{ ***** Other Globals ****************************************** }

        LastAlert    : Array[0..3] of LONG;

        {  these next two variables are provided to allow
        ** system developers to have a rough idea of the
        ** period of two externally controlled signals --
        ** the time between vertical blank interrupts and the
        ** external line rate (which is counted by CIA A's
        ** "time of day" clock).  In general these values
        ** will be 50 or 60, and may or may not track each
        ** other.  These values replace the obsolete AFB_PAL
        ** and AFB_50HZ flags.
         }

        VBlankFrequency,                {  (readable)  }
        PowerSupplyFrequency : Byte;   {  (readable)  }

        SemaphoreList    : tList;

        {  these next two are to be able to kickstart into user ram.
        ** KickMemPtr holds a singly linked list of MemLists which
        ** will be removed from the memory list via AllocAbs.  If
        ** all the AllocAbs's succeeded, then the KickTagPtr will
        ** be added to the rom tag list.
         }

        KickMemPtr,             {  ptr to queue of mem lists  }
        KickTagPtr,             {  ptr to rom tag queue  }
        KickCheckSum : Pointer; {  checksum for mem and tags  }

{ ***** V36 Exec additions start here ************************************* }

        ex_Pad0           : Word;
        ex_Reserved0      : ULONG;
        ex_RamLibPrivate  : Pointer;

        {  The next ULONG contains the system "E" clock frequency,
        ** expressed in Hertz.  The E clock is used as a timebase for
        ** the Amiga's 8520 I/O chips. (E is connected to "02").
        ** Typical values are 715909 for NTSC, or 709379 for PAL.
         }

        ex_EClockFrequency,         {  (readable)  }
        ex_CacheControl,            {  Private to CacheControl calls  }
        ex_TaskID         : ULONG;  {  Next available task ID  }

        ex_Reserved1      : Array[0..4] of ULONG;

        ex_MMULock        : Pointer;    {  private  }

        ex_Reserved2      : Array[0..2] of ULONG;
{***** V39 Exec additions start here *************************************}

        { The following list and data element are used
         * for V39 exec's low memory handler...
         }
        ex_MemHandlers    : tMinList; { The handler list }
        ex_MemHandler     : Pointer;          { Private! handler pointer }
end;


{ ***** Bit defines for AttnFlags (see above) ***************************** }

{   Processors and Co-processors:  }

CONST

  AFB_68010     = 0;    {  also set for 68020  }
  AFB_68020     = 1;    {  also set for 68030  }
  AFB_68030     = 2;    {  also set for 68040  }
  AFB_68040     = 3;
  AFB_68881     = 4;    {  also set for 68882  }
  AFB_68882     = 5;
  AFB_FPU40     = 6;    {  Set if 68040 FPU }
  AFB_68060     = 7;

  AFF_68010     = %00000001;
  AFF_68020     = %00000010;
  AFF_68030     = %00000100;
  AFF_68040     = %00001000;
  AFF_68881     = %00010000;
  AFF_68882     = %00100000;
  AFF_FPU40     = %01000000;
  AFF_68060     = (1 shl 7);

{    AFB_RESERVED8 = %000100000000;  }
{    AFB_RESERVED9 = %001000000000;  }


{ ***** Selected flag definitions for Cache manipulation calls ********* }

  CACRF_EnableI       = %0000000000000001;  { Enable instruction cache  }
  CACRF_FreezeI       = %0000000000000010;  { Freeze instruction cache  }
  CACRF_ClearI        = %0000000000001000;  { Clear instruction cache   }
  CACRF_IBE           = %0000000000010000;  { Instruction burst enable  }
  CACRF_EnableD       = %0000000100000000;  { 68030 Enable data cache   }
  CACRF_FreezeD       = %0000001000000000;  { 68030 Freeze data cache   }
  CACRF_ClearD        = %0000100000000000;  { 68030 Clear data cache    }
  CACRF_DBE           = %0001000000000000;  { 68030 Data burst enable   }
  CACRF_WriteAllocate = %0010000000000000;  { 68030 Write-Allocate mode
                                              (must always be set!)     }
  CACRF_EnableE       = 1073741824;  { Master enable for external caches }
                                     { External caches should track the }
                                     { state of the internal caches }
                                     { such that they do not cache anything }
                                     { that the internal cache turned off }
                                     { for. }

  CACRF_CopyBack      = $80000000;  { Master enable for copyback caches }

  DMA_Continue        = 2;      { Continuation flag for CachePreDMA }
  DMA_NoModify        = 4;      { Set if DMA does not update memory }
  DMA_ReadFromRAM     = 8;      { Set if DMA goes *FROM* RAM to device }


{ Don't even think about the contents of this structure. Just embed it
 * and reference it
 *}
  type
     PAVLNode = ^tAVLNode;
     tAVLNode = record
          reserved : array[0..3] of ULONG;
       end;
     ppAVLNode = ^pAVLNode;


       PAVLNODECOMP = ^AVLNODECOMP;
       AVLNODECOMP = APTR;

       PAVLKEYCOMP = ^AVLKEYCOMP;
       AVLKEYCOMP = APTR;



function AbortIO(ioRequest : pIORequest): LongInt;
PROCEDURE AddDevice(device : pDevice);
PROCEDURE AddHead(list : pList; node : pNode);
PROCEDURE AddIntServer(intNumber : LONGINT; interrupt_ : pInterrupt);
PROCEDURE AddLibrary(lib : pLibrary);
PROCEDURE AddMemHandler(memhand : pInterrupt);
PROCEDURE AddMemList(size : ULONG; attributes : ULONG; pri : LONGINT; base : POINTER; const name : pCHAR);
PROCEDURE AddPort(port : pMsgPort);
PROCEDURE AddResource(resource : POINTER);
PROCEDURE AddSemaphore(sigSem : pSignalSemaphore);
PROCEDURE AddTail(list : pList; node : pNode);
FUNCTION AddTask(task : pTask;const initPC : POINTER;const finalPC : POINTER) : POINTER;
PROCEDURE Alert(alertNum : ULONG);
FUNCTION AllocAbs(byteSize : ULONG; location : POINTER) : POINTER;
FUNCTION Allocate(freeList : pMemHeader; byteSize : ULONG) : POINTER;
FUNCTION AllocEntry(entry : pMemList) : pMemList;
FUNCTION AllocMem(byteSize : ULONG; requirements : ULONG) : POINTER;
FUNCTION AllocPooled(poolHeader : POINTER; memSize : ULONG) : POINTER;
FUNCTION AllocSignal(signalNum : LONGINT) : shortint;
FUNCTION AllocTrap(trapNum : LONGINT) : LONGINT;
FUNCTION AllocVec(byteSize : ULONG; requirements : ULONG) : POINTER;
FUNCTION AttemptSemaphore(sigSem : pSignalSemaphore) : BOOLEAN;
FUNCTION AttemptSemaphoreShared(sigSem : pSignalSemaphore) : ULONG;
FUNCTION AvailMem(requirements : ULONG) : ULONG;
PROCEDURE CacheClearE(address : POINTER; length : ULONG; caches : ULONG);
PROCEDURE CacheClearU;
FUNCTION CacheControl(cacheBits : ULONG; cacheMask : ULONG) : ULONG;
PROCEDURE CachePostDMA(const address : POINTER; VAR length : ULONG; flags : ULONG);
FUNCTION CachePreDMA(const address : POINTER; VAR length : ULONG; flags : ULONG) : POINTER;
PROCEDURE Cause(interrupt_ : pInterrupt);
FUNCTION CheckIO(ioRequest : pIORequest) : pIORequest;
PROCEDURE ChildFree(tid : POINTER);
PROCEDURE ChildOrphan(tid : POINTER);
PROCEDURE ChildStatus(tid : POINTER);
PROCEDURE ChildWait(tid : POINTER);
PROCEDURE CloseDevice(ioRequest : pIORequest);
PROCEDURE CloseLibrary(lib : pLibrary);
PROCEDURE ColdReboot;
PROCEDURE CopyMem(const source : POINTER; dest : POINTER; size : ULONG);
PROCEDURE CopyMemQuick(const source : POINTER; dest : POINTER; size : ULONG);
FUNCTION CreateIORequest(const port : pMsgPort; size : ULONG) : POINTER;
FUNCTION CreateMsgPort : pMsgPort;
FUNCTION CreatePool(requirements : ULONG; puddleSize : ULONG; threshSize : ULONG) : POINTER;
PROCEDURE Deallocate(freeList : pMemHeader; memoryBlock : POINTER; byteSize : ULONG);
PROCEDURE Debug(flags : ULONG);
PROCEDURE DeleteIORequest(iorequest : POINTER);
PROCEDURE DeleteMsgPort(port : pMsgPort);
PROCEDURE DeletePool(poolHeader : POINTER);
PROCEDURE Disable;
FUNCTION DoIO(ioRequest : pIORequest) : shortint;
PROCEDURE Enable;
PROCEDURE Enqueue(list : pList; node : pNode);
PROCEDURE ExecFreeMem(memoryBlock : POINTER; byteSize : ULONG);
PROCEDURE ExecInsert(list : pList; node : pNode; pred : pNode);
FUNCTION FindName(list : pList; const name : pCHAR) : pNode;
FUNCTION FindPort(const name : pCHAR) : pMsgPort;
FUNCTION FindResident(const name : pCHAR) : pResident;
FUNCTION FindSemaphore(const sigSem : pCHAR) : pSignalSemaphore;
FUNCTION FindTask(const name : pCHAR) : pTask;
PROCEDURE Forbid;
PROCEDURE FreeEntry(entry : pMemList);
PROCEDURE FreePooled(poolHeader : POINTER; memory : POINTER; memSize : ULONG);
PROCEDURE FreeSignal(signalNum : LONGINT);
PROCEDURE FreeTrap(trapNum : LONGINT);
PROCEDURE FreeVec(memoryBlock : POINTER);
FUNCTION GetCC : ULONG;
FUNCTION GetMsg(port : pMsgPort) : pMessage;
PROCEDURE InitCode(startClass : ULONG; version : ULONG);
FUNCTION InitResident(const resident_ : pResident; segList : ULONG) : POINTER;
PROCEDURE InitSemaphore(sigSem : pSignalSemaphore);
PROCEDURE InitStruct(const initTable : POINTER; memory : POINTER; size : ULONG);
PROCEDURE MakeFunctions(const target : POINTER;const functionArray : POINTER;const funcDispBase :pointer);
FUNCTION MakeLibrary(const  funcInit : POINTER;const  structInit : POINTER; libInit : tPROCEDURE;dataSize : ULONG; segList : ULONG) : pLibrary;
FUNCTION ObtainQuickVector(interruptCode : POINTER) : ULONG;
PROCEDURE ObtainSemaphore(sigSem : pSignalSemaphore);
PROCEDURE ObtainSemaphoreList(sigSem : pList);
PROCEDURE ObtainSemaphoreShared(sigSem : pSignalSemaphore);
FUNCTION OldOpenLibrary(const libName : pCHAR) : pLibrary;
FUNCTION OpenDevice(const devName : pCHAR; unite : ULONG; ioRequest : pIORequest; flags : ULONG) : shortint;
FUNCTION OpenLibrary(const libName : pCHAR; version : ULONG) : pLibrary;
FUNCTION OpenResource(const resName : pCHAR) : POINTER;
PROCEDURE Permit;
FUNCTION Procure(sigSem : pSignalSemaphore; bidMsg : pSemaphoreMessage) : BOOLEAN;
PROCEDURE PutMsg(port : pMsgPort; message : pMessage);
function RawDoFmt(const formatString : pCHAR;const dataStream : POINTER; putChProc : tPROCEDURE; putChData : POINTER): pointer;
PROCEDURE ReleaseSemaphore(sigSem : pSignalSemaphore);
PROCEDURE ReleaseSemaphoreList(sigSem : pList);
PROCEDURE RemDevice(device : pDevice);
FUNCTION RemHead(list : pList) : pNode;
PROCEDURE RemIntServer(intNumber : LONGINT; interrupt_ : pInterrupt);
PROCEDURE RemLibrary(lib : pLibrary);
PROCEDURE RemMemHandler(memhand : pInterrupt);
PROCEDURE Remove(node : pNode);
PROCEDURE RemPort(port : pMsgPort);
PROCEDURE RemResource(resource : POINTER);
PROCEDURE RemSemaphore(sigSem : pSignalSemaphore);
FUNCTION RemTail(list : pList) : pNode;
PROCEDURE RemTask(task : pTask);
PROCEDURE ReplyMsg(message : pMessage);
PROCEDURE SendIO(ioRequest : pIORequest);
FUNCTION SetExcept(newSignals : ULONG; signalSet : ULONG) : ULONG;
FUNCTION SetFunction(lib : pLibrary; funcOffset : LONGINT; newFunction : tPROCEDURE) : POINTER;
FUNCTION SetIntVector(intNumber : LONGINT;const interrupt_ : pInterrupt) : pInterrupt;
FUNCTION SetSignal(newSignals : ULONG; signalSet : ULONG) : ULONG;
FUNCTION SetSR(newSR : ULONG; mask : ULONG) : ULONG;
FUNCTION SetTaskPri(task : pTask; priority : LONGINT) : shortint;
PROCEDURE Signal(task : pTask; signalSet : ULONG);
PROCEDURE StackSwap(newStack : pStackSwapStruct);
PROCEDURE SumKickData;
PROCEDURE SumLibrary(lib : pLibrary);
FUNCTION SuperState : POINTER;
FUNCTION Supervisor(userFunction : tPROCEDURE) : ULONG;
FUNCTION TypeOfMem(const address : POINTER) : ULONG;
PROCEDURE UserState(sysStack : POINTER);
PROCEDURE Vacate(sigSem : pSignalSemaphore; bidMsg : pSemaphoreMessage);
FUNCTION Wait(signalSet : ULONG) : ULONG;
FUNCTION WaitIO(ioRequest : pIORequest) : shortint;
FUNCTION WaitPort(port : pMsgPort) : pMessage;
{
PROCEDURE NewMinList(minlist : pMinList);
FUNCTION AVL_AddNode(root : ppAVLNode; node : pAVLNode; func : POINTER) : pAVLNode;
FUNCTION AVL_RemNodeByAddress(root : ppAVLNode; node : pAVLNode) : pAVLNode;
FUNCTION AVL_RemNodeByKey(root : ppAVLNode; key : POINTER; func : POINTER) : pAVLNode;
FUNCTION AVL_FindNode(CONST root : pAVLNode; key : POINTER; func : POINTER) : pAVLNode;
FUNCTION AVL_FindPrevNodeByAddress(CONST node : pAVLNode) : pAVLNode;
FUNCTION AVL_FindPrevNodeByKey(CONST root : pAVLNode; key : POINTER; func : POINTER) : pAVLNode;
FUNCTION AVL_FindNextNodeByAddress(CONST node : pAVLNode) : pAVLNode;
FUNCTION AVL_FindNextNodeByKey(CONST root : pAVLNode; key : POINTER; func : POINTER) : pAVLNode;
FUNCTION AVL_FindFirstNode(CONST root : pAVLNode) : pAVLNode;
FUNCTION AVL_FindLastNode(CONST root : pAVLNode) : pAVLNode;
}
{PROCEDURE AddMemList(size : ULONG; attributes : ULONG; pri : LONGINT; base : POINTER; const name : String);
FUNCTION FindName(list : pList; const name : String) : pNode;
FUNCTION FindPort(const name : String) : pMsgPort;
FUNCTION FindResident(const name : String) : pResident;
FUNCTION FindSemaphore(const sigSem : String) : pSignalSemaphore;
FUNCTION FindTask(const name : String) : pTask;
FUNCTION OldOpenLibrary(const libName : String) : pLibrary;
FUNCTION OpenDevice(const devName : String; unite : ULONG; ioRequest : pIORequest;flags : ULONG) : shortint;
FUNCTION OpenLibrary(const libName : String; version : ULONG) : pLibrary;
FUNCTION OpenResource(const resName : String) : POINTER;
function RawDoFmt(const formatString : String;const dataStream : POINTER; putChProc :tPROCEDURE; putChData : POINTER): pointer;
}
function BitMask(no :shortint): longint;
function IsListEmpty( list : pList): boolean;
function IsMsgPortEmpty( mp : pMsgPort): boolean;

IMPLEMENTATION

uses pastoc;

function BitMask(no :shortint): longint;
begin
   BitMask := 1 shl no;
end;

function IsListEmpty( list : pList): boolean;
begin
     IsListEmpty := list^.lh_TailPred = pnode(list);
end;

function IsMsgPortEmpty(mp: pMsgPort): boolean;
begin
     with mp^ do
         IsMsgPortEmpty := mp_MsgList.lh_TailPred = pNode(@mp_MsgList);
end;

function AbortIO(ioRequest: pIORequest): LongInt;
type
  TLocalCall = function(ioRequest : pIORequest; Base: Pointer): LongInt; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 80));
  AbortIO := Call(ioRequest, AOS_ExecBase);
end;

procedure AddDevice(device: pDevice);
type
  TLocalCall = procedure(device: pDevice; Base: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 72));
  Call(device, AOS_ExecBase);
end;

procedure AddHead(list: pList; node: pNode);
type
  TLocalCall = procedure(list : pList; node : pNode; Base: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 40));
  Call(list, node, AOS_ExecBase);
end;

procedure AddIntServer(intNumber: LONGINT; interrupt_: pInterrupt);
type
  TLocalCall = procedure(intNumber : LONGINT; interrupt_ : pInterrupt; Base: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 28));
  Call(intNumber, interrupt_, AOS_ExecBase);
end;

procedure AddLibrary(lib: pLibrary);
type
  TLocalCall = procedure(lib: pLibrary; Base: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 66));
  Call(lib, AOS_ExecBase);
end;

procedure AddMemHandler(memhand: pInterrupt);
type
  TLocalCall = procedure(memhand: pInterrupt; Base: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 129));
  Call(memhand, AOS_ExecBase);
end;

procedure AddMemList(size : ULONG; attributes : ULONG; pri : LONGINT; base : POINTER; const name : pCHAR);
type
  TLocalCall = procedure(size : ULONG; attributes : ULONG; pri : LONGINT; base : POINTER; const name : pCHAR; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 103));
  Call(size, attributes, pri, base, name, AOS_ExecBase);
end;

PROCEDURE AddPort(port : pMsgPort);
type
  TLocalCall = procedure(port : pMsgPort; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 59));
  Call(port, AOS_ExecBase);
end;

PROCEDURE AddResource(resource : POINTER);
type
  TLocalCall = procedure(resource : POINTER; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 81));
  Call(resource, AOS_ExecBase);
end;

PROCEDURE AddSemaphore(sigSem : pSignalSemaphore);
type
  TLocalCall = procedure(sigSem : pSignalSemaphore; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 100));
  Call(sigSem, AOS_ExecBase);
end;

PROCEDURE AddTail(list : pList; node : pNode);
type
  TLocalCall = procedure(list : pList; node : pNode; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 41));
  Call(list, node, AOS_ExecBase);
end;

FUNCTION AddTask(task : pTask;const initPC : POINTER;const finalPC : POINTER) : POINTER;
type
  TLocalCall = function(task : pTask;const initPC : POINTER;const finalPC : POINTER; LibBase: Pointer): POINTER; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 47));
  AddTask := Call(task, initPC, finalPC, AOS_ExecBase);
end;

PROCEDURE Alert(alertNum : ULONG);
type
  TLocalCall = procedure(alertNum : ULONG; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 18));
  Call(alertNum, AOS_ExecBase);
end;

FUNCTION AllocAbs(byteSize : ULONG; location : POINTER) : POINTER;
type
  TLocalCall = FUNCTION(byteSize : ULONG; location : POINTER; LibBase: Pointer): POINTER; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 34));
  AllocAbs := Call(byteSize, location, AOS_ExecBase);
end;

FUNCTION Allocate(freeList : pMemHeader; byteSize : ULONG) : POINTER;
type
  TLocalCall = function(freeList : pMemHeader; byteSize : ULONG; LibBase: Pointer): POINTER; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 31));
  Allocate := Call(freeList, byteSize, AOS_ExecBase);
end;

FUNCTION AllocEntry(entry : pMemList) : pMemList;
type
  TLocalCall = function(entry : pMemList; LibBase: Pointer): pMemList; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 37));
  AllocEntry := Call(entry, AOS_ExecBase);
end;

FUNCTION AllocMem(byteSize : ULONG; requirements : ULONG) : POINTER;
type
  TLocalCall = function(byteSize : ULONG; requirements : ULONG; LibBase: Pointer): POINTER; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 33));
  AllocMem := Call(byteSize, requirements, AOS_ExecBase);
end;

FUNCTION AllocPooled(poolHeader : POINTER; memSize : ULONG) : POINTER;
type
  TLocalCall = function(poolHeader : POINTER; memSize : ULONG; LibBase: Pointer): POINTER; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 118));
  AllocPooled := Call(poolHeader, memSize, AOS_ExecBase);
end;

FUNCTION AllocSignal(signalNum : LONGINT) : shortint;
type
  TLocalCall = function(signalNum : LONGINT; LibBase: Pointer): shortint; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 55));
  AllocSignal := Call(signalNum, AOS_ExecBase);
end;

FUNCTION AllocTrap(trapNum : LONGINT) : LONGINT;
type
  TLocalCall = function(trapNum : LONGINT; LibBase: Pointer): LONGINT; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 57));
  AllocTrap := Call(trapNum, AOS_ExecBase);
end;

FUNCTION AllocVec(byteSize : ULONG; requirements : ULONG) : POINTER;
type
  TLocalCall = function(byteSize : ULONG; requirements : ULONG; LibBase: Pointer): POINTER; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 114));
  AllocVec := Call(byteSize, requirements, AOS_ExecBase);
end;

FUNCTION AttemptSemaphore(sigSem : pSignalSemaphore) : BOOLEAN;
type
  TLocalCall = function(sigSem : pSignalSemaphore; LibBase: Pointer): BOOLEAN; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 96));
  AttemptSemaphore := Call(sigSem, AOS_ExecBase);
end;

FUNCTION AttemptSemaphoreShared(sigSem : pSignalSemaphore) : ULONG;
type
  TLocalCall = function(sigSem : pSignalSemaphore; LibBase: Pointer): ULONG; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 120));
  AttemptSemaphoreShared := Call(sigSem, AOS_ExecBase);
end;

FUNCTION AvailMem(requirements : ULONG) : ULONG;
type
  TLocalCall = function(requirements : ULONG; LibBase: Pointer): ULONG; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 36));
  AvailMem := Call(requirements, AOS_ExecBase);
end;

PROCEDURE CacheClearE(address : POINTER; length : ULONG; caches : ULONG);
type
  TLocalCall = procedure(address : POINTER; length : ULONG; caches : ULONG; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 107));
  Call(address, length, caches, AOS_ExecBase);
end;

PROCEDURE CacheClearU;
type
  TLocalCall = procedure(LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 106));
  Call(AOS_ExecBase);
end;

FUNCTION CacheControl(cacheBits : ULONG; cacheMask : ULONG) : ULONG;
type
  TLocalCall = function(cacheBits : ULONG; cacheMask : ULONG; LibBase: Pointer): ULONG; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 108));
  CacheControl := Call(cacheBits, cacheMask, AOS_ExecBase);
end;

PROCEDURE CachePostDMA(const address : POINTER; VAR length : ULONG; flags : ULONG);
type
  TLocalCall = procedure(const address : POINTER; VAR length : ULONG; flags : ULONG; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 128));
  Call(address, length, flags, AOS_ExecBase);
end;

FUNCTION CachePreDMA(const address : POINTER; VAR length : ULONG; flags : ULONG) : POINTER;
type
  TLocalCall = function(const address : POINTER; VAR length : ULONG; flags : ULONG; LibBase: Pointer): POINTER; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 127));
  CachePreDMA := Call(address, length, flags, AOS_ExecBase);
end;

PROCEDURE Cause(interrupt_ : pInterrupt);
type
  TLocalCall = procedure(interrupt_ : pInterrupt; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 30));
  Call(interrupt_, AOS_ExecBase);
end;

FUNCTION CheckIO(ioRequest : pIORequest) : pIORequest;
type
  TLocalCall = function(ioRequest : pIORequest; LibBase: Pointer): pIORequest; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 78));
  CheckIO := Call(ioRequest, AOS_ExecBase);
end;

PROCEDURE ChildFree(tid : POINTER);
type
  TLocalCall = procedure(tid : POINTER; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 123));
  Call(tid, AOS_ExecBase);
end;

PROCEDURE ChildOrphan(tid : POINTER);
type
  TLocalCall = procedure(tid : POINTER; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 124));
  Call(tid, AOS_ExecBase);
end;

PROCEDURE ChildStatus(tid : POINTER);
type
  TLocalCall = procedure(tid : POINTER; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 125));
  Call(tid, AOS_ExecBase);
end;

PROCEDURE ChildWait(tid : POINTER);
type
  TLocalCall = procedure(tid : POINTER; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 126));
  Call(tid, AOS_ExecBase);
end;

PROCEDURE CloseDevice(ioRequest : pIORequest);
type
  TLocalCall = procedure(ioRequest : pIORequest; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 75));
  Call(ioRequest, AOS_ExecBase);
end;

PROCEDURE CloseLibrary(lib : pLibrary);
type
  TLocalCall = procedure(lib : pLibrary; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 69));
  Call(lib, AOS_ExecBase);
end;

PROCEDURE ColdReboot;
type
  TLocalCall = procedure(LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 121));
  Call(AOS_ExecBase);
end;

PROCEDURE CopyMem(const source : POINTER; dest : POINTER; size : ULONG);
type
  TLocalCall = procedure(const source : POINTER; dest : POINTER; size : ULONG; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 104));
  Call(source, dest, size, AOS_ExecBase);
end;

PROCEDURE CopyMemQuick(const source : POINTER; dest : POINTER; size : ULONG);
type
  TLocalCall = procedure(const source : POINTER; dest : POINTER; size : ULONG; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 105));
  Call(source, dest, size, AOS_ExecBase);
end;

FUNCTION CreateIORequest(const port : pMsgPort; size : ULONG) : POINTER;
type
  TLocalCall = function(const port : pMsgPort; size : ULONG; LibBase: Pointer): POINTER; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 109));
  CreateIORequest := Call(port, size, AOS_ExecBase);
end;

FUNCTION CreateMsgPort : pMsgPort;
type
  TLocalCall = function(LibBase: Pointer): pMsgPort; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 111));
  CreateMsgPort := Call(AOS_ExecBase);
end;

FUNCTION CreatePool(requirements : ULONG; puddleSize : ULONG; threshSize : ULONG) :
POINTER;
type
  TLocalCall = function(requirements : ULONG; puddleSize : ULONG; threshSize : ULONG; LibBase: Pointer): POINTER; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 116));
  CreatePool := Call(requirements, puddleSize, threshSize, AOS_ExecBase);
end;

PROCEDURE Deallocate(freeList : pMemHeader; memoryBlock : POINTER; byteSize : ULONG);
type
  TLocalCall = procedure(freeList : pMemHeader; memoryBlock : POINTER; byteSize : ULONG; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 32));
  Call(freeList, memoryBlock, byteSize, AOS_ExecBase);
end;

PROCEDURE Debug(flags : ULONG);
type
  TLocalCall = procedure(flags : ULONG; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 19));
  Call(flags, AOS_ExecBase);
end;

PROCEDURE DeleteIORequest(iorequest : POINTER);
type
  TLocalCall = procedure(iorequest : POINTER; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 110));
  Call(iorequest, AOS_ExecBase);
end;

PROCEDURE DeleteMsgPort(port : pMsgPort);
type
  TLocalCall = procedure(port : pMsgPort; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 112));
  Call(port, AOS_ExecBase);
end;

PROCEDURE DeletePool(poolHeader : POINTER);
type
  TLocalCall = procedure(poolHeader : POINTER; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 117));
  Call(poolHeader, AOS_ExecBase);
end;

PROCEDURE Disable;
type
  TLocalCall = procedure(LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 20));
  Call(AOS_ExecBase);
end;

FUNCTION DoIO(ioRequest : pIORequest) : shortint;
type
  TLocalCall = function(ioRequest : pIORequest; LibBase: Pointer): shortint; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 76));
  DoIO := Call(ioRequest, AOS_ExecBase);
end;

PROCEDURE Enable;
type
  TLocalCall = procedure(LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 21));
  Call(AOS_ExecBase);
end;

PROCEDURE Enqueue(list : pList; node : pNode);
type
  TLocalCall = procedure(list : pList; node : pNode; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 45));
  Call(list, node, AOS_ExecBase);
end;

PROCEDURE ExecFreeMem(memoryBlock : POINTER; byteSize : ULONG);
type
  TLocalCall = procedure(memoryBlock : POINTER; byteSize : ULONG; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 35));
  Call(memoryBlock, byteSize, AOS_ExecBase);
end;

PROCEDURE ExecInsert(list : pList; node : pNode; pred : pNode);
type
  TLocalCall = procedure(list : pList; node : pNode; pred : pNode; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 39));
  Call(list, node, pred, AOS_ExecBase);
end;

FUNCTION FindName(list : pList; const name : pCHAR) : pNode;
type
  TLocalCall = function(list : pList; const name : pCHAR; LibBase: Pointer): pNode; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 46));
  FindName := Call(list, name, AOS_ExecBase);
end;

FUNCTION FindPort(const name : pCHAR) : pMsgPort;
type
  TLocalCall = function(const name : pCHAR; LibBase: Pointer): pMsgPort; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 65));
  FindPort := Call(name, AOS_ExecBase);
end;

FUNCTION FindResident(const name : pCHAR) : pResident;
type
  TLocalCall = function(const name : pCHAR; LibBase: Pointer): pResident; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 16));
  FindResident := Call(name, AOS_ExecBase);
end;

FUNCTION FindSemaphore(const sigSem : pCHAR) : pSignalSemaphore;
type
  TLocalCall = function(const sigSem : pCHAR; LibBase: Pointer): pSignalSemaphore; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 99));
  FindSemaphore := Call(sigSem, AOS_ExecBase);
end;

FUNCTION FindTask(const name : pCHAR) : pTask;
type
  TLocalCall = function(const name : pCHAR; LibBase: Pointer): pTask; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 49));
  FindTask := Call(name, AOS_ExecBase);
end;

PROCEDURE Forbid;
type
  TLocalCall = procedure(LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 22));
  Call(AOS_ExecBase);
end;

PROCEDURE FreeEntry(entry : pMemList);
type
  TLocalCall = procedure(entry : pMemList; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 38));
  Call(entry, AOS_ExecBase);
end;

PROCEDURE FreePooled(poolHeader : POINTER; memory : POINTER; memSize : ULONG);
type
  TLocalCall = procedure(poolHeader : POINTER; memory : POINTER; memSize : ULONG; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 119));
  Call(poolHeader, memory, memSize, AOS_ExecBase);
end;

PROCEDURE FreeSignal(signalNum : LONGINT);
type
  TLocalCall = procedure(signalNum : LONGINT; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 56));
  Call(signalNum, AOS_ExecBase);
end;

PROCEDURE FreeTrap(trapNum : LONGINT);
type
  TLocalCall = procedure(trapNum : LONGINT; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 58));
  Call(trapNum, AOS_ExecBase);
end;

PROCEDURE FreeVec(memoryBlock : POINTER);
type
  TLocalCall = procedure(memoryBlock : POINTER; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 115));
  Call(memoryBlock, AOS_ExecBase);
end;

FUNCTION GetCC : ULONG;
type
  TLocalCall = function(LibBase: Pointer): ULONG; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 88));
  GetCC := Call(AOS_ExecBase);
end;

FUNCTION GetMsg(port : pMsgPort) : pMessage;
type
  TLocalCall = function(port : pMsgPort; LibBase: Pointer): pMessage; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 62));
  GetMsg := Call(port, AOS_ExecBase);
end;

PROCEDURE InitCode(startClass : ULONG; version : ULONG);
type
  TLocalCall = procedure(startClass : ULONG; version : ULONG; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 12));
  Call(startClass, version, AOS_ExecBase);
end;

FUNCTION InitResident(const resident_ : pResident; segList : ULONG) : POINTER;
type
  TLocalCall = function(const resident_ : pResident; segList : ULONG; LibBase: Pointer): POINTER; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 17));
  InitResident := Call(resident_, segList, AOS_ExecBase);
end;

PROCEDURE InitSemaphore(sigSem : pSignalSemaphore);
type
  TLocalCall = procedure(sigSem : pSignalSemaphore; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 93));
  Call(sigSem, AOS_ExecBase);
end;

PROCEDURE InitStruct(const initTable : POINTER; memory : POINTER; size : ULONG);
type
  TLocalCall = procedure(const initTable : POINTER; memory : POINTER; size : ULONG; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 13));
  Call(initTable, memory, size, AOS_ExecBase);
end;

PROCEDURE MakeFunctions(const target : POINTER;const functionArray : POINTER;const funcDispBase :pointer);
type
  TLocalCall = procedure(const target : POINTER;const functionArray : POINTER;const funcDispBase :pointer; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 15));
  Call(target, functionArray, funcDispBase, AOS_ExecBase);
end;

FUNCTION MakeLibrary(const funcInit : POINTER;const structInit : POINTER; libInit : tPROCEDURE; dataSize : ULONG; segList : ULONG) : pLibrary;
type
  TLocalCall = function(const funcInit : POINTER;const structInit : POINTER; libInit : tPROCEDURE; dataSize : ULONG; segList : ULONG; LibBase: Pointer): pLibrary; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 14));
  MakeLibrary := Call(funcInit, structInit, libInit, dataSize, segList, AOS_ExecBase);
end;

FUNCTION ObtainQuickVector(interruptCode : POINTER) : ULONG;
type
  TLocalCall = function(interruptCode : POINTER; LibBase: Pointer): ULONG; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 131));
  ObtainQuickVector := Call(interruptCode, AOS_ExecBase);
end;

PROCEDURE ObtainSemaphore(sigSem : pSignalSemaphore);
type
  TLocalCall = procedure(sigSem : pSignalSemaphore; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 94));
  Call(sigSem, AOS_ExecBase);
end;

PROCEDURE ObtainSemaphoreList(sigSem : pList);
type
  TLocalCall = procedure(sigSem : pList; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 97));
  Call(sigSem, AOS_ExecBase);
end;

PROCEDURE ObtainSemaphoreShared(sigSem : pSignalSemaphore);
type
  TLocalCall = procedure(sigSem : pSignalSemaphore; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 113));
  Call(sigSem, AOS_ExecBase);
end;

FUNCTION OldOpenLibrary(const libName : pCHAR) : pLibrary;
type
  TLocalCall = function(const libName : pCHAR; LibBase: Pointer): pLibrary; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 68));
  OldOpenLibrary := Call(libName, AOS_ExecBase);
end;

FUNCTION OpenDevice(const devName : pCHAR; unite : ULONG; ioRequest : pIORequest;
flags : ULONG) : shortint;
type
  TLocalCall = function(const devName : pCHAR; unite : ULONG; ioRequest : pIORequest; flags : ULONG; LibBase: Pointer): shortint; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 74));
  OpenDevice := Call(devName, unite, ioRequest, flags, AOS_ExecBase);
end;

FUNCTION OpenLibrary(const libName : pCHAR; version : ULONG) : pLibrary;
type
  TLocalCall = function(const libName : pCHAR; version : ULONG; LibBase: Pointer): pLibrary; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 92));
  OpenLibrary := Call(libName, version, AOS_ExecBase);
end;

FUNCTION OpenResource(const resName : pCHAR) : POINTER;
type
  TLocalCall = function(const resName : pCHAR; LibBase: Pointer): POINTER; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 83));
  OpenResource := Call(resName, AOS_ExecBase);
end;

PROCEDURE Permit;
type
  TLocalCall = PROCEDURE(LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 23));
  Call(AOS_ExecBase);
end;

FUNCTION Procure(sigSem : pSignalSemaphore; bidMsg : pSemaphoreMessage) : BOOLEAN;
type
  TLocalCall = function(sigSem : pSignalSemaphore; bidMsg : pSemaphoreMessage; LibBase: Pointer): BOOLEAN; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 90));
  Procure := Call(sigSem, bidMsg, AOS_ExecBase);
end;

PROCEDURE PutMsg(port : pMsgPort; message : pMessage);
type
  TLocalCall = PROCEDURE(port : pMsgPort; message : pMessage; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 61));
  Call(port, message, AOS_ExecBase);
end;

function RawDoFmt(const formatString : pCHAR;const dataStream : POINTER; putChProc : tPROCEDURE; putChData : POINTER): pointer;
type
  TLocalCall = function(const formatString : pCHAR;const dataStream : POINTER; putChProc : tPROCEDURE; putChData : POINTER; LibBase: Pointer): pointer; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 87));
  RawDoFmt := Call(formatString, dataStream, putChProc, putChData, AOS_ExecBase);
end;

PROCEDURE ReleaseSemaphore(sigSem : pSignalSemaphore);
type
  TLocalCall = procedure(sigSem : pSignalSemaphore; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 95));
  Call(sigSem, AOS_ExecBase);
end;

PROCEDURE ReleaseSemaphoreList(sigSem : pList);
type
  TLocalCall = procedure(sigSem : pList; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 98));
  Call(sigSem, AOS_ExecBase);
end;

PROCEDURE RemDevice(device : pDevice);
type
  TLocalCall = PROCEDURE(device : pDevice; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 73));
  Call(device, AOS_ExecBase);
end;

FUNCTION RemHead(list : pList) : pNode;
type
  TLocalCall = function(list : pList; LibBase: Pointer): pNode; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 43));
  RemHead := Call(list, AOS_ExecBase);
end;

PROCEDURE RemIntServer(intNumber : LONGINT; interrupt_ : pInterrupt);
type
  TLocalCall = procedure(intNumber : LONGINT; interrupt_ : pInterrupt; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 29));
  Call(intNumber, interrupt_, AOS_ExecBase);
end;

PROCEDURE RemLibrary(lib : pLibrary);
type
  TLocalCall = procedure(lib : pLibrary; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 67));
  Call(lib, AOS_ExecBase);
end;

PROCEDURE RemMemHandler(memhand : pInterrupt);
type
  TLocalCall = procedure(memhand : pInterrupt; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 130));
  Call(memhand, AOS_ExecBase);
end;

PROCEDURE Remove(node : pNode);
type
  TLocalCall = procedure(node : pNode; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 42));
  Call(node, AOS_ExecBase);
end;

PROCEDURE RemPort(port : pMsgPort);
type
  TLocalCall = procedure(port : pMsgPort; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 60));
  Call(port, AOS_ExecBase);
end;

PROCEDURE RemResource(resource : POINTER);
type
  TLocalCall = procedure(resource : POINTER; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 82));
  Call(resource, AOS_ExecBase);
end;

PROCEDURE RemSemaphore(sigSem : pSignalSemaphore);
type
  TLocalCall = procedure(sigSem : pSignalSemaphore; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 101));
  Call(sigSem, AOS_ExecBase);
end;

FUNCTION RemTail(list : pList) : pNode;
type
  TLocalCall = function(list : pList; LibBase: Pointer): pNode; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 44));
  RemTail := Call(list, AOS_ExecBase);
end;

PROCEDURE RemTask(task : pTask);
type
  TLocalCall = procedure(task : pTask; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 48));
  Call(task, AOS_ExecBase);
end;

PROCEDURE ReplyMsg(message : pMessage);
type
  TLocalCall = procedure(message : pMessage; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 63));
  Call(message, AOS_ExecBase);
end;

PROCEDURE SendIO(ioRequest : pIORequest);
type
  TLocalCall = procedure(ioRequest : pIORequest; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 77));
  Call(ioRequest, AOS_ExecBase);
end;

FUNCTION SetExcept(newSignals : ULONG; signalSet : ULONG) : ULONG;
type
  TLocalCall = function(newSignals : ULONG; signalSet : ULONG; LibBase: Pointer): ULONG; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 52));
  SetExcept := Call(newSignals, signalSet, AOS_ExecBase);
end;

FUNCTION SetFunction(lib : pLibrary; funcOffset : LONGINT; newFunction : tPROCEDURE) : POINTER;
type
  TLocalCall = function(lib : pLibrary; funcOffset : LONGINT; newFunction : tPROCEDURE; LibBase: Pointer): POINTER; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 70));
  SetFunction := Call(lib, funcOffset, newFunction, AOS_ExecBase);
end;

FUNCTION SetIntVector(intNumber : LONGINT;const interrupt_ : pInterrupt) : pInterrupt;
type
  TLocalCall = function(intNumber : LONGINT;const interrupt_ : pInterrupt; LibBase: Pointer): pInterrupt; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 27));
  SetIntVector := Call(intNumber, interrupt_, AOS_ExecBase);
end;

FUNCTION SetSignal(newSignals : ULONG; signalSet : ULONG) : ULONG;
type
  TLocalCall = function(newSignals : ULONG; signalSet : ULONG; LibBase: Pointer): ULONG; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 51));
  SetSignal := Call(newSignals, signalSet, AOS_ExecBase);
end;

FUNCTION SetSR(newSR : ULONG; mask : ULONG) : ULONG;
type
  TLocalCall = function(newSR : ULONG; mask : ULONG; LibBase: Pointer): ULONG; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 24));
  SetSR := Call(newSR, mask, AOS_ExecBase);
end;

FUNCTION SetTaskPri(task : pTask; priority : LONGINT) : shortint;
type
  TLocalCall = function(task : pTask; priority : LONGINT; LibBase: Pointer): shortint; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 50));
  SetTaskPri := Call(task, priority, AOS_ExecBase);
end;

PROCEDURE Signal(task : pTask; signalSet : ULONG);
type
  TLocalCall = procedure(task : pTask; signalSet : ULONG; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 54));
  Call(task, signalSet, AOS_ExecBase);
end;

PROCEDURE StackSwap(newStack : pStackSwapStruct);
type
  TLocalCall = procedure(newStack : pStackSwapStruct; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 122));
  Call(newStack, AOS_ExecBase);
end;

PROCEDURE SumKickData;
type
  TLocalCall = procedure(LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 102));
  Call(AOS_ExecBase);
end;

PROCEDURE SumLibrary(lib : pLibrary);
type
  TLocalCall = procedure(lib : pLibrary; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 71));
  Call(lib, AOS_ExecBase);
end;

FUNCTION SuperState : POINTER;
type
  TLocalCall = function(LibBase: Pointer): POINTER; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 25));
  SuperState := Call(AOS_ExecBase);
end;

FUNCTION Supervisor(userFunction : tPROCEDURE) : ULONG;
type
  TLocalCall = function(userFunction : tPROCEDURE; LibBase: Pointer): ULONG; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 5));
  Supervisor := Call(userFunction, AOS_ExecBase);
end;

FUNCTION TypeOfMem(const address : POINTER) : ULONG;
type
  TLocalCall = function(const address : POINTER; LibBase: Pointer): ULONG; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 89));
  TypeOfMem := Call(address, AOS_ExecBase);
end;

PROCEDURE UserState(sysStack : POINTER);
type
  TLocalCall = procedure(sysStack : POINTER; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 26));
  Call(sysStack, AOS_ExecBase);
end;

PROCEDURE Vacate(sigSem : pSignalSemaphore; bidMsg : pSemaphoreMessage);
type
  TLocalCall = procedure(sigSem : pSignalSemaphore; bidMsg : pSemaphoreMessage; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 91));
  Call(sigSem, bidMsg, AOS_ExecBase);
end;

FUNCTION Wait(signalSet : ULONG) : ULONG;
type
  TLocalCall = function(signalSet : ULONG; LibBase: Pointer): ULONG; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 53));
  Wait := Call(signalSet, AOS_ExecBase);
end;

FUNCTION WaitIO(ioRequest : pIORequest) : shortint;
type
  TLocalCall = function(ioRequest : pIORequest; LibBase: Pointer): shortint; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 79));
  WaitIO := Call(ioRequest, AOS_ExecBase);
end;

FUNCTION WaitPort(port : pMsgPort) : pMessage;
type
  TLocalCall = function(port : pMsgPort; LibBase: Pointer): pMessage; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, 64));
  WaitPort := Call(port, AOS_ExecBase);
end;
{
PROCEDURE NewMinList(minlist : pMinList);
type
  TLocalCall = procedure(; LibBase: Pointer); stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, X));
  Call(, AOS_ExecBase);
end;

FUNCTION AVL_AddNode(root : ppAVLNode; node : pAVLNode; func : POINTER) : pAVLNode;
type
  TLocalCall = function(; LibBase: Pointer): ; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, X));
  Result := Call(, AOS_ExecBase);
end;

FUNCTION AVL_RemNodeByAddress(root : ppAVLNode; node : pAVLNode) : pAVLNode;
type
  TLocalCall = function(; LibBase: Pointer): ; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, X));
  Result := Call(, AOS_ExecBase);
end;

FUNCTION AVL_RemNodeByKey(root : ppAVLNode; key : POINTER; func : POINTER) : pAVLNode;
type
  TLocalCall = function(; LibBase: Pointer): ; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, X));
  Result := Call(, AOS_ExecBase);
end;

FUNCTION AVL_FindNode(CONST root : pAVLNode; key : POINTER; func : POINTER) : pAVLNode;
type
  TLocalCall = function(; LibBase: Pointer): ; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, X));
  Result := Call(, AOS_ExecBase);
end;

FUNCTION AVL_FindPrevNodeByAddress(CONST node : pAVLNode) : pAVLNode;
type
  TLocalCall = function(; LibBase: Pointer): ; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, X));
  Result := Call(, AOS_ExecBase);
end;

FUNCTION AVL_FindPrevNodeByKey(CONST root : pAVLNode; key : POINTER; func : POINTER) : pAVLNode;
type
  TLocalCall = function(; LibBase: Pointer): ; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, X));
  Result := Call(, AOS_ExecBase);
end;

FUNCTION AVL_FindNextNodeByAddress(CONST node : pAVLNode) : pAVLNode;
type
  TLocalCall = function(; LibBase: Pointer): ; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, X));
  Result := Call(, AOS_ExecBase);
end;

FUNCTION AVL_FindNextNodeByKey(CONST root : pAVLNode; key : POINTER; func : POINTER) : pAVLNode;
type
  TLocalCall = function(; LibBase: Pointer): ; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, X));
  Result := Call(, AOS_ExecBase);
end;

FUNCTION AVL_FindFirstNode(CONST root : pAVLNode) : pAVLNode;
type
  TLocalCall = function(; LibBase: Pointer): ; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, X));
  Result := Call(, AOS_ExecBase);
end;

FUNCTION AVL_FindLastNode(CONST root : pAVLNode) : pAVLNode;
type
  TLocalCall = function(; LibBase: Pointer): ; stdcall;
var
  Call: TLocalCall;
begin
  Call := TLocalCall(GetLibAdress(AOS_ExecBase, X));
  Result := Call(, AOS_ExecBase);
end;
}

{PROCEDURE AddMemList(size : ULONG; attributes : ULONG; pri : LONGINT; base : POINTER; const name : String);
BEGIN
    AddMemList(size,attributes,pri,base,pas2c(name));
END;
FUNCTION FindName(list : pList; const name : String) : pNode;
BEGIN
    FindName := FindName(list,pas2c(name));
END;
FUNCTION FindPort(const name : String) : pMsgPort;
BEGIN
    FindPort := FindPort(pas2c(name));
END;
FUNCTION FindResident(const name : String) : pResident;
BEGIN
    FindResident := FindResident(pas2c(name));
END;
FUNCTION FindSemaphore(const sigSem : String) : pSignalSemaphore;
BEGIN
    FindSemaphore := FindSemaphore(pas2c(sigSem));
END;
FUNCTION FindTask(const name : String) : pTask;
BEGIN
    FindTask := FindTask(pas2c(name));
END;
FUNCTION OldOpenLibrary(const libName : String) : pLibrary;
BEGIN
    OldOpenLibrary := OldOpenLibrary(pas2c(libName));
END;
FUNCTION OpenDevice(const devName : String; unite : ULONG; ioRequest : pIORequest;
flags : ULONG) : shortint;
BEGIN
    OpenDevice := OpenDevice(pas2c(devName),unite,ioRequest,flags);
END;
FUNCTION OpenLibrary(const libName : String; version : ULONG) : pLibrary;
BEGIN
    OpenLibrary := OpenLibrary(pas2c(libName),version);
END;
FUNCTION OpenResource(const resName : String) : POINTER;
BEGIN
    OpenResource := OpenResource(pas2c(resName));
END;
function RawDoFmt(const formatString : String;const dataStream : POINTER; putChProc : tPROCEDURE; putChData : POINTER): pointer;
BEGIN
    RawDoFmt := RawDoFmt(pas2c(formatString),dataStream,putChProc,putChData);
END;}

END. (* UNIT EXEC *)