Compare commits
704 Commits
unlabeled-
...
distr2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d7ceb6d6c | ||
|
|
d10d14acac | ||
|
|
ca5599714b | ||
|
|
f337b8df6d | ||
|
|
7cd58cabab | ||
|
|
8b4f21bd95 | ||
|
|
ab820d3083 | ||
|
|
fb23d440f0 | ||
|
|
f70b857d1b | ||
|
|
bd07643039 | ||
|
|
686e5af1bb | ||
|
|
34ccddfc2d | ||
|
|
b6f73fdc29 | ||
|
|
c19324dfea | ||
|
|
772b64fabd | ||
|
|
ef92740400 | ||
|
|
ee9c5be180 | ||
|
|
ca9a6feeb0 | ||
|
|
022cb596be | ||
|
|
9eb53c3d47 | ||
|
|
dfcfa9883b | ||
|
|
fb6d291d38 | ||
|
|
e4e29ae837 | ||
|
|
94534b7c15 | ||
|
|
491040b2c7 | ||
|
|
b4adc21f19 | ||
|
|
bae4084355 | ||
|
|
d394fe5dda | ||
|
|
dcfe4e8a97 | ||
|
|
be9e253a2f | ||
|
|
620216fb26 | ||
|
|
70d71f4355 | ||
|
|
6b87f1082e | ||
|
|
fd44c34a61 | ||
|
|
6c247029bd | ||
|
|
6bbdb92784 | ||
|
|
22182c0d7f | ||
|
|
87f66789de | ||
|
|
1879c8e724 | ||
|
|
693830b09a | ||
|
|
e3fa99632e | ||
|
|
b3d11b1fa5 | ||
|
|
2b6187a009 | ||
|
|
a8fc6009f7 | ||
|
|
92141b52ce | ||
|
|
b63f304db1 | ||
|
|
ec3e755168 | ||
|
|
a41ff68078 | ||
|
|
244e172413 | ||
|
|
da936740a6 | ||
|
|
35fae90a9d | ||
|
|
c5a739c68f | ||
|
|
dc92fe358e | ||
|
|
59996174b6 | ||
|
|
84f9364d4c | ||
|
|
a635fb0203 | ||
|
|
e3e1c5ac20 | ||
|
|
e3e9add8b1 | ||
|
|
ffd0d165a7 | ||
|
|
c1d5a0c721 | ||
|
|
3e743d78f3 | ||
|
|
90c847ca59 | ||
|
|
1b162c577e | ||
|
|
a5f4b01d82 | ||
|
|
c5508c7c0b | ||
|
|
80e349860b | ||
|
|
157b243956 | ||
|
|
eabf214312 | ||
|
|
d52117c8dd | ||
|
|
d457c50945 | ||
|
|
b294ab5042 | ||
|
|
9d0812746b | ||
|
|
9f203c9a17 | ||
|
|
0c92039ba4 | ||
|
|
cf6d084155 | ||
|
|
7e6a6f6de2 | ||
|
|
954d3a0326 | ||
|
|
6f6356e0b4 | ||
|
|
9e26d0e0c0 | ||
|
|
bf3ba84e92 | ||
|
|
7a790e48fb | ||
|
|
32bc0f2982 | ||
|
|
fb4a3fd479 | ||
|
|
ccdb8693ee | ||
|
|
a8c5699241 | ||
|
|
e0c4e4b686 | ||
|
|
8a40c25069 | ||
|
|
0fd729951a | ||
|
|
7a30dc4868 | ||
|
|
4b1965afbc | ||
|
|
b2b281f525 | ||
|
|
d2a6847715 | ||
|
|
2690f07cbd | ||
|
|
aa82964563 | ||
|
|
c636aba734 | ||
|
|
ce92663b0a | ||
|
|
a89ba7074f | ||
|
|
a71e706aa4 | ||
|
|
736a2d1022 | ||
|
|
17e13e9e71 | ||
|
|
9d7b94ba34 | ||
|
|
218f7ed718 | ||
|
|
cb0b2e08cf | ||
|
|
c2a990768d | ||
|
|
36537eccc0 | ||
|
|
6cdcb391fb | ||
|
|
9d9c9ae97b | ||
|
|
c478b62711 | ||
|
|
e7f7f33f60 | ||
|
|
c1f3dbba33 | ||
|
|
d5098fe70f | ||
|
|
469d075e77 | ||
|
|
2a4b3fd616 | ||
|
|
408dacc2aa | ||
|
|
7397122695 | ||
|
|
abcbc93b5d | ||
|
|
de6ce0fe74 | ||
|
|
b449b94b48 | ||
|
|
7d85a4c0b3 | ||
|
|
66ab97d2b0 | ||
|
|
241a7de970 | ||
|
|
41d580c9cf | ||
|
|
ec46d547c4 | ||
|
|
daa47964a5 | ||
|
|
ee63833f41 | ||
|
|
445d52de66 | ||
|
|
b82c00e153 | ||
|
|
972692cb1c | ||
|
|
bbfb511322 | ||
|
|
3f3bddef8f | ||
|
|
9f45dd0650 | ||
|
|
43a2b60360 | ||
|
|
14875e6ca5 | ||
|
|
d32de5df93 | ||
|
|
eeb944f6e3 | ||
|
|
ca28f34c8e | ||
|
|
625c309fa6 | ||
|
|
9f3928cd3a | ||
|
|
a65f05f29f | ||
|
|
6a6a84a274 | ||
|
|
4f80e81ee7 | ||
|
|
eb2b9d0bac | ||
|
|
792d315beb | ||
|
|
04e454d3c6 | ||
|
|
a1c2dadb2a | ||
|
|
b6381fad79 | ||
|
|
c9eb48d373 | ||
|
|
67d635ccd4 | ||
|
|
f37307bc06 | ||
|
|
2a4335787e | ||
|
|
1b5278f3d4 | ||
|
|
815b0e0f0f | ||
|
|
70c000b03e | ||
|
|
f59262745e | ||
|
|
cc4f8a793a | ||
|
|
52fee02e94 | ||
|
|
fee336890b | ||
|
|
0b6744bb91 | ||
|
|
e704ddc158 | ||
|
|
f7699474b8 | ||
|
|
6909adbf9c | ||
|
|
156775643e | ||
|
|
d41c902b12 | ||
|
|
43f003e959 | ||
|
|
ba1e51e914 | ||
|
|
66875f1bde | ||
|
|
8a7ee2ea50 | ||
|
|
e9850f2691 | ||
|
|
0122bc2dd7 | ||
|
|
c0085c2dd4 | ||
|
|
00d75279e7 | ||
|
|
c0d87aaa16 | ||
|
|
3c7fcfe81a | ||
|
|
4ff7e05f7e | ||
|
|
3df42a584c | ||
|
|
9c93cbdfaa | ||
|
|
1b36afae36 | ||
|
|
0ff3a17f5e | ||
|
|
d7abe0e8b6 | ||
|
|
20986fd6ea | ||
|
|
293dfd2c64 | ||
|
|
e1b8023da1 | ||
|
|
52d0f32e32 | ||
|
|
c8e426ffb8 | ||
|
|
b70b6ba980 | ||
|
|
c90c70bb84 | ||
|
|
a50f8ebe1c | ||
|
|
da898f1325 | ||
|
|
1e38fa0573 | ||
|
|
5a6676cc53 | ||
|
|
987ed39adb | ||
|
|
3d4a5efe99 | ||
|
|
46f5004866 | ||
|
|
df168727a6 | ||
|
|
2cc4735151 | ||
|
|
dd7e9436a2 | ||
|
|
8e154eb826 | ||
|
|
ca219d89e9 | ||
|
|
26999bb517 | ||
|
|
103659cd7b | ||
|
|
626ae9760f | ||
|
|
dcd8451347 | ||
|
|
882906b3c3 | ||
|
|
f586956618 | ||
|
|
6459b0bf5f | ||
|
|
1f56b2aa4c | ||
|
|
d1c0d1db13 | ||
|
|
b99ce86e16 | ||
|
|
bec394f7bd | ||
|
|
db19d06f61 | ||
|
|
e936aea1e1 | ||
|
|
31eab814f2 | ||
|
|
7f9dd27dc8 | ||
|
|
387191a2c7 | ||
|
|
cf3d3ad287 | ||
|
|
1bc30e42eb | ||
|
|
e271d9bbb8 | ||
|
|
a49f2d23f7 | ||
|
|
3c5d3c55af | ||
|
|
6d344b6702 | ||
|
|
8fa5a7b668 | ||
|
|
d12fef6c05 | ||
|
|
ed1ee8a3b4 | ||
|
|
3bb153d6bb | ||
|
|
df08133a04 | ||
|
|
06087a6bc3 | ||
|
|
fd4d46036a | ||
|
|
1e3ec09984 | ||
|
|
58c5d2d8ac | ||
|
|
410800127c | ||
|
|
1732114593 | ||
|
|
66eabbcddf | ||
|
|
468401cb81 | ||
|
|
cac6ffd8c2 | ||
|
|
d32d4e6ba0 | ||
|
|
5cad6f6aa7 | ||
|
|
e46c49e291 | ||
|
|
5a95c31414 | ||
|
|
f487f26e00 | ||
|
|
e95492dfb0 | ||
|
|
fefe15a844 | ||
|
|
3d2c33e277 | ||
|
|
2ea3be322d | ||
|
|
a849b751a9 | ||
|
|
ea337060ec | ||
|
|
33c81637db | ||
|
|
8bdec01d71 | ||
|
|
7556180ab3 | ||
|
|
09000449a4 | ||
|
|
68644410fb | ||
|
|
c2e988c3d5 | ||
|
|
d4a597912f | ||
|
|
682e5d9b8a | ||
|
|
f7027ba7e4 | ||
|
|
52a627589a | ||
|
|
5fc9fdf795 | ||
|
|
08c8edf314 | ||
|
|
603f82a578 | ||
|
|
8f81c858f8 | ||
|
|
6a21488f0c | ||
|
|
374ac8b21c | ||
|
|
770f321ea8 | ||
|
|
decda89fba | ||
|
|
ff46181ae0 | ||
|
|
dbb0d46ac2 | ||
|
|
d53ef52028 | ||
|
|
a91ff9e04b | ||
|
|
56a8cd53b6 | ||
|
|
0c2aee4835 | ||
|
|
cd78a1a27a | ||
|
|
309bbef3ea | ||
|
|
71cbd2c92f | ||
|
|
cb49888304 | ||
|
|
9479f61318 | ||
|
|
8d02182e12 | ||
|
|
aef211ad4e | ||
|
|
a33d0e8e14 | ||
|
|
4f40987ff0 | ||
|
|
ccfa0db0de | ||
|
|
6ac5841c7f | ||
|
|
f9c86fc6f6 | ||
|
|
a4ca3054f0 | ||
|
|
10ce06ff2b | ||
|
|
8d87404836 | ||
|
|
2d8dcaa2df | ||
|
|
d8d2068664 | ||
|
|
e1ef16649c | ||
|
|
6512a304a0 | ||
|
|
e75b8772ca | ||
|
|
d19105ef78 | ||
|
|
f9b105e07a | ||
|
|
218ce4596e | ||
|
|
8f7a447719 | ||
|
|
14a9b13fd3 | ||
|
|
d72ad93216 | ||
|
|
081413cfda | ||
|
|
f0d34942e3 | ||
|
|
959138af97 | ||
|
|
c61ea7ee53 | ||
|
|
22e4268cc7 | ||
|
|
e2c5191f0c | ||
|
|
7f0def8861 | ||
|
|
dac2f97109 | ||
|
|
3a528a7324 | ||
|
|
3534869cb5 | ||
|
|
e9b6045b5a | ||
|
|
a1a8fd99a0 | ||
|
|
d7fb9edfe2 | ||
|
|
58126396af | ||
|
|
55017702e2 | ||
|
|
7d312abd59 | ||
|
|
ba826bad5c | ||
|
|
4ba6e7a39c | ||
|
|
f838dd1047 | ||
|
|
6aaff51b39 | ||
|
|
f532b58045 | ||
|
|
576688fc10 | ||
|
|
72b83cca59 | ||
|
|
5edf93d2de | ||
|
|
dd0951f114 | ||
|
|
5779a88371 | ||
|
|
22c95138aa | ||
|
|
d0268a4ec1 | ||
|
|
112211eb3b | ||
|
|
d0444e3a04 | ||
|
|
9beb72e69b | ||
|
|
5fedca22ad | ||
|
|
b4ad7c46da | ||
|
|
c2229e5c60 | ||
|
|
11b3f3aa8a | ||
|
|
79411cb4b3 | ||
|
|
dd8505531b | ||
|
|
26f38cada3 | ||
|
|
c235c1a93d | ||
|
|
d16efbab98 | ||
|
|
57115f49cc | ||
|
|
5e8a571801 | ||
|
|
006c4b7a49 | ||
|
|
5662050ad3 | ||
|
|
6a08d40d15 | ||
|
|
fe6eed6c76 | ||
|
|
0ebd337637 | ||
|
|
ffb167e8b2 | ||
|
|
6860747f3e | ||
|
|
18dbfc024e | ||
|
|
e129db8343 | ||
|
|
b2b1167d7a | ||
|
|
6c9e4c84f0 | ||
|
|
6b38714690 | ||
|
|
80d385c291 | ||
|
|
37d01caabd | ||
|
|
7b39ce2cfa | ||
|
|
53a88ccd69 | ||
|
|
2d4614ca5a | ||
|
|
246f45c867 | ||
|
|
b544d3b401 | ||
|
|
5f41dcd958 | ||
|
|
9ea83d0838 | ||
|
|
45e2eea414 | ||
|
|
8b60227186 | ||
|
|
f0a6c2fbcf | ||
|
|
8636bd025e | ||
|
|
4d8c88e7b1 | ||
|
|
b4faacec8c | ||
|
|
eb15231cf4 | ||
|
|
cf947cedd3 | ||
|
|
e3bf7b5dc7 | ||
|
|
a5e9c4f8d1 | ||
|
|
8c874d4632 | ||
|
|
d267037189 | ||
|
|
ea8e311e5a | ||
|
|
3ab2889451 | ||
|
|
c693044013 | ||
|
|
3b3d3f16b4 | ||
|
|
4f071008c8 | ||
|
|
d77b2081c0 | ||
|
|
b097fe72a7 | ||
|
|
66d68121c8 | ||
|
|
5060a9fcd6 | ||
|
|
523457f6ee | ||
|
|
6babe9fccd | ||
|
|
ad815f1061 | ||
|
|
aa0f76a6cd | ||
|
|
c39e619032 | ||
|
|
4a2c2d89a0 | ||
|
|
468cdfd3eb | ||
|
|
83f3de1555 | ||
|
|
ef7ea116cd | ||
|
|
f4ab1bb6e6 | ||
|
|
98989fd9ca | ||
|
|
9932e38ab2 | ||
|
|
0b9b183085 | ||
|
|
4cc2986757 | ||
|
|
9f850cbb2d | ||
|
|
24204bca9f | ||
|
|
1e651a534a | ||
|
|
1b210a8104 | ||
|
|
a0f184e3d1 | ||
|
|
9b6c26ad14 | ||
|
|
89a757d6f9 | ||
|
|
518e817345 | ||
|
|
f9fa5df654 | ||
|
|
9e4b9fddab | ||
|
|
7f12f20be6 | ||
|
|
9019141137 | ||
|
|
af75a28622 | ||
|
|
c744b44b48 | ||
|
|
80d4c7ca2f | ||
|
|
c2d3d6ce4a | ||
|
|
47f5e79d96 | ||
|
|
2c7c97051b | ||
|
|
0d5c765070 | ||
|
|
01d4011dd6 | ||
|
|
7f3328678f | ||
|
|
d9fe7e9cf0 | ||
|
|
4e461a9860 | ||
|
|
3cdaf9f4ba | ||
|
|
0d0e2d2d22 | ||
|
|
8d659c015f | ||
|
|
695a914eb3 | ||
|
|
9b72991e27 | ||
|
|
8db2c12881 | ||
|
|
7e8d898bcb | ||
|
|
550e4d3cee | ||
|
|
271b83ecb3 | ||
|
|
ee3ef338db | ||
|
|
7e3e49082c | ||
|
|
0778ce4a9a | ||
|
|
7351e38ed5 | ||
|
|
bac0efbedb | ||
|
|
302608566a | ||
|
|
c814b9523d | ||
|
|
39891edd12 | ||
|
|
90df1e5b9a | ||
|
|
1e69d3458c | ||
|
|
6988358e29 | ||
|
|
49137da06b | ||
|
|
594a5bb49b | ||
|
|
e5a282c621 | ||
|
|
4ab54c85a8 | ||
|
|
7ac377c750 | ||
|
|
ad104f9164 | ||
|
|
1b8f41d3b2 | ||
|
|
b532117b2b | ||
|
|
bda5c8409c | ||
|
|
f6da80afd8 | ||
|
|
8a15a3f597 | ||
|
|
ae1e81adb1 | ||
|
|
0c0c3b7892 | ||
|
|
b0de601d5b | ||
|
|
7767012a6e | ||
|
|
bd06330739 | ||
|
|
84ed8ee7ef | ||
|
|
f3e35f5432 | ||
|
|
edcb838b98 | ||
|
|
c17a52c09d | ||
|
|
0032ebfeda | ||
|
|
582a0cc2aa | ||
|
|
dd5ceb7b97 | ||
|
|
470826f0c9 | ||
|
|
1cb39eff7e | ||
|
|
90c1dc7c06 | ||
|
|
39c37e9571 | ||
|
|
3ceada5482 | ||
|
|
3cab14d65e | ||
|
|
7efc02574d | ||
|
|
9f872a7ea0 | ||
|
|
ea5498cd99 | ||
|
|
455cd930ec | ||
|
|
335d55ff4a | ||
|
|
4301dfb7bf | ||
|
|
502a7a86af | ||
|
|
30ca0afe49 | ||
|
|
ad383cbdc0 | ||
|
|
165965eadc | ||
|
|
a6d53a6bcd | ||
|
|
df200afd46 | ||
|
|
9c3a416acd | ||
|
|
9e38bfa060 | ||
|
|
2d6eff961f | ||
|
|
0981b8857b | ||
|
|
69bdddd9ba | ||
|
|
4a36e98f5c | ||
|
|
3c2c03165b | ||
|
|
c4b4a08720 | ||
|
|
6d481ce4d6 | ||
|
|
6a9e49f683 | ||
|
|
1833451151 | ||
|
|
9f778655a6 | ||
|
|
f01e1431b0 | ||
|
|
415ae7e922 | ||
|
|
7b798175ad | ||
|
|
5481dd47a9 | ||
|
|
0a00b80726 | ||
|
|
6a4dc794a2 | ||
|
|
7c07f91e1c | ||
|
|
36c1f227ea | ||
|
|
1fe1bc8c09 | ||
|
|
4e7f357a26 | ||
|
|
9f776924d6 | ||
|
|
cb84476be0 | ||
|
|
d07b17ca5c | ||
|
|
58c679c94c | ||
|
|
e2e78ccd0a | ||
|
|
0d5a4693a7 | ||
|
|
95dd252a5b | ||
|
|
87c5817216 | ||
|
|
b6cfa32faa | ||
|
|
b9ebdc1a07 | ||
|
|
73b651052e | ||
|
|
6913efe107 | ||
|
|
3e7b7990f2 | ||
|
|
9c66801439 | ||
|
|
2976b590af | ||
|
|
a837112d99 | ||
|
|
13685d4bc0 | ||
|
|
45887f2b72 | ||
|
|
4d48191bcc | ||
|
|
fedaa3267a | ||
|
|
3d4feae541 | ||
|
|
88b487cd7b | ||
|
|
90a899316e | ||
|
|
08632dc7bd | ||
|
|
ae27a86236 | ||
|
|
fd0066f3a6 | ||
|
|
1092994a09 | ||
|
|
da7230a8eb | ||
|
|
1ca93d7aa1 | ||
|
|
9d8dd3f989 | ||
|
|
c5345aaaba | ||
|
|
fd23647c1c | ||
|
|
4724e96474 | ||
|
|
8df0cf17d6 | ||
|
|
37730ff9ca | ||
|
|
a1e7cc26f4 | ||
|
|
137fa9ebce | ||
|
|
0cacc96ed8 | ||
|
|
4a20e17a9b | ||
|
|
3bfc57ecd0 | ||
|
|
86d96452a3 | ||
|
|
e88028dcb9 | ||
|
|
1e1fc36653 | ||
|
|
cdebe97db8 | ||
|
|
08545984f4 | ||
|
|
b8e156100f | ||
|
|
9109aaaada | ||
|
|
b51fa518be | ||
|
|
c2b1975015 | ||
|
|
ca89e47aa4 | ||
|
|
26ba8cc8fd | ||
|
|
c94c590501 | ||
|
|
38a943d27a | ||
|
|
916b1b016e | ||
|
|
a72cc54578 | ||
|
|
9b6418c324 | ||
|
|
e03e8c7607 | ||
|
|
2cb8aae438 | ||
|
|
533d2bb940 | ||
|
|
828b4d62c9 | ||
|
|
7e31dee840 | ||
|
|
a4a5fc4bfa | ||
|
|
62f42d18f7 | ||
|
|
be9b72e273 | ||
|
|
79ea4bdea3 | ||
|
|
ab0db1c5fb | ||
|
|
5d5a09a5d0 | ||
|
|
9eb72b6ee8 | ||
|
|
f1a2fdaa43 | ||
|
|
bdc67c3332 | ||
|
|
a33d4cdbba | ||
|
|
94e069fde1 | ||
|
|
c89acc55c7 | ||
|
|
d068cf64b3 | ||
|
|
774ce1ecc3 | ||
|
|
dd1bcb3f60 | ||
|
|
317ab99ecf | ||
|
|
474d9d6e0f | ||
|
|
a9a0339ec1 | ||
|
|
27dcc7efc6 | ||
|
|
58b1dd5b6d | ||
|
|
82d5bad777 | ||
|
|
a7c0f30307 | ||
|
|
de22c41214 | ||
|
|
a21f936651 | ||
|
|
6cbb37051b | ||
|
|
550d1fa79e | ||
|
|
46dc90f366 | ||
|
|
8958cb6faf | ||
|
|
b5fa0675b6 | ||
|
|
8e680a6467 | ||
|
|
c4434ccbce | ||
|
|
1b251d6ab0 | ||
|
|
5376af0d04 | ||
|
|
00bd62d942 | ||
|
|
0abe5e195e | ||
|
|
4c0687f68b | ||
|
|
42be23b631 | ||
|
|
13d6e6815e | ||
|
|
92aecb175c | ||
|
|
a3f62d0255 | ||
|
|
080555fffd | ||
|
|
083dccb299 | ||
|
|
1bea1c6883 | ||
|
|
6da6316680 | ||
|
|
523134a5dc | ||
|
|
abb1fce8ff | ||
|
|
6010f7b584 | ||
|
|
a88bca3670 | ||
|
|
95510f8b4c | ||
|
|
2c4b17e464 | ||
|
|
c97e1a7bc2 | ||
|
|
c93761cadc | ||
|
|
aa4bae59e0 | ||
|
|
527726167a | ||
|
|
68a6231d11 | ||
|
|
ebed9d4804 | ||
|
|
5895758914 | ||
|
|
3c300d3e1c | ||
|
|
8443ef3f8d | ||
|
|
1188f0e810 | ||
|
|
1dba1f5328 | ||
|
|
20100c69c7 | ||
|
|
c504e2e22a | ||
|
|
31f96c6850 | ||
|
|
6eda6ac320 | ||
|
|
384bb7f6c4 | ||
|
|
4c265a7cc6 | ||
|
|
2bf16c5b2f | ||
|
|
0d48be448f | ||
|
|
f6b59970f6 | ||
|
|
1d463f136a | ||
|
|
773f0aa626 | ||
|
|
621f9f4ea9 | ||
|
|
198da9e822 | ||
|
|
5db647e661 | ||
|
|
3744019c53 | ||
|
|
5689e6ab64 | ||
|
|
4759d84bdd | ||
|
|
c2f189c855 | ||
|
|
822b1c557c | ||
|
|
744bc6845d | ||
|
|
ce098c78cb | ||
|
|
d1b3479a55 | ||
|
|
e682a47599 | ||
|
|
eebcf1b22c | ||
|
|
b31c9f4a4a | ||
|
|
e41876f32a | ||
|
|
eff0f36a5d | ||
|
|
6f8e6faa1f | ||
|
|
59fa458a20 | ||
|
|
ff9d23e4ec | ||
|
|
93672962a1 | ||
|
|
afc577b6c7 | ||
|
|
fe922d190d | ||
|
|
6e519cf02b | ||
|
|
f2e52892ac | ||
|
|
233b4aeee4 | ||
|
|
d90f26a8c5 | ||
|
|
0b07016f0b | ||
|
|
5894adfd67 | ||
|
|
14a3683f85 | ||
|
|
eebc753306 | ||
|
|
978dd0191a | ||
|
|
5b20e4fed2 | ||
|
|
c2f383773d | ||
|
|
ebc7a50d8f | ||
|
|
98c1d6868f | ||
|
|
c99e75a01b | ||
|
|
bb4210de79 | ||
|
|
b410ca7f8c | ||
|
|
25a8908e26 | ||
|
|
597d25decd | ||
|
|
eb823929a1 | ||
|
|
ef248ee65e | ||
|
|
e20ab23a4b | ||
|
|
5fb767966b | ||
|
|
3b991bd1ce | ||
|
|
15e9fd8cd5 | ||
|
|
73d8f05fb5 | ||
|
|
3ca5d2fcb6 | ||
|
|
8483d153f2 | ||
|
|
b95f4c8bfd | ||
|
|
801226a45c | ||
|
|
f16fdf4e7f | ||
|
|
d082a2b0a2 | ||
|
|
d5aa088876 | ||
|
|
8defe7ce53 | ||
|
|
69584eb0ca | ||
|
|
1eade4ac9d | ||
|
|
da4092cbdf | ||
|
|
c1fd560106 | ||
|
|
17caf7129e | ||
|
|
a520ccdbbc | ||
|
|
eeeff10a51 | ||
|
|
c75693c35a | ||
|
|
e1aef765a0 | ||
|
|
2943d957bb | ||
|
|
ec992b001c | ||
|
|
8304ce5eae | ||
|
|
8af636a3c1 | ||
|
|
3169067979 | ||
|
|
a241500a91 | ||
|
|
0473678491 | ||
|
|
fc59a0d703 |
135
Action
Normal file
135
Action
Normal file
@@ -0,0 +1,135 @@
|
||||
name "System definition"
|
||||
dir first
|
||||
action did_first
|
||||
failure "You have to run the shell script first in the directory first"
|
||||
fatal
|
||||
end
|
||||
name "EM definition"
|
||||
dir etc
|
||||
end
|
||||
name "C preprocessor"
|
||||
dir util/cpp
|
||||
end
|
||||
name "EM definition library"
|
||||
dir util/data
|
||||
end
|
||||
name "Encode/Decode"
|
||||
dir util/misc
|
||||
end
|
||||
name "Shell files in bin"
|
||||
dir util/shf
|
||||
end
|
||||
name "EM assembler"
|
||||
dir util/ass
|
||||
end
|
||||
name "EM Peephole optimizer"
|
||||
dir util/opt
|
||||
end
|
||||
name "ACK archiver"
|
||||
dir util/arch
|
||||
end
|
||||
name "Program 'ack'"
|
||||
dir util/ack
|
||||
end
|
||||
name "Bootstrap for backend tables"
|
||||
dir util/cgg
|
||||
end
|
||||
name "LL(1) Parser generator"
|
||||
dir util/LLgen
|
||||
end
|
||||
name "Bootstrap for newest form of backend tables"
|
||||
dir util/ncgg
|
||||
end
|
||||
name "C frontend"
|
||||
dir lang/cem/comp
|
||||
end
|
||||
name "Basic frontend"
|
||||
dir lang/basic/src
|
||||
end
|
||||
name "Intel 8086 support"
|
||||
dir mach/i86
|
||||
indir
|
||||
end
|
||||
name "MSC6500 support"
|
||||
dir mach/6500
|
||||
indir
|
||||
end
|
||||
name "Motorola 6800 support"
|
||||
dir mach/6800
|
||||
indir
|
||||
end
|
||||
name "Motorola 6805 support"
|
||||
dir mach/6805
|
||||
indir
|
||||
end
|
||||
name "Motorola 6809 support"
|
||||
dir mach/6809
|
||||
indir
|
||||
end
|
||||
name "Intel 8080 support"
|
||||
dir mach/i80
|
||||
indir
|
||||
end
|
||||
name "2-2 Interpreter support"
|
||||
dir mach/int22
|
||||
indir
|
||||
end
|
||||
name "2-4 Interpreter support"
|
||||
dir mach/int24
|
||||
indir
|
||||
end
|
||||
name "4-4 Interpreter support"
|
||||
dir mach/int44
|
||||
indir
|
||||
end
|
||||
name "IBM PC/IX support"
|
||||
dir mach/ix
|
||||
indir
|
||||
end
|
||||
name "Motorola 68000 2-4 support"
|
||||
dir mach/m68k2
|
||||
indir
|
||||
end
|
||||
name "Motorola 68000 4-4 support"
|
||||
dir mach/m68k4
|
||||
indir
|
||||
end
|
||||
name "NS16032 support"
|
||||
dir mach/ns
|
||||
indir
|
||||
end
|
||||
name "PDP 11 support"
|
||||
dir mach/pdp
|
||||
indir
|
||||
end
|
||||
name "PMDS support"
|
||||
dir mach/pmds
|
||||
indir
|
||||
end
|
||||
name "PMDS 4/4 support"
|
||||
dir mach/pmds4
|
||||
indir
|
||||
end
|
||||
name "Signetics 2650 support"
|
||||
dir mach/s2650
|
||||
indir
|
||||
end
|
||||
name "Vax 2-4 support"
|
||||
dir mach/vax2
|
||||
indir
|
||||
end
|
||||
name "Vax 4-4 support"
|
||||
dir mach/vax4
|
||||
indir
|
||||
end
|
||||
name "Z80 support"
|
||||
dir mach/z80
|
||||
indir
|
||||
end
|
||||
name "Zilog Z8000 support"
|
||||
dir mach/z8000
|
||||
indir
|
||||
end
|
||||
name "Pascal frontend"
|
||||
dir lang/pc/pem
|
||||
end
|
||||
1
DistrAction
Executable file
1
DistrAction
Executable file
@@ -0,0 +1 @@
|
||||
exec sh TakeAction distr distr/Action
|
||||
35
Makefile
35
Makefile
@@ -1,35 +0,0 @@
|
||||
cmp: # compile everything and compare
|
||||
(cd etc ; make cmp )
|
||||
(cd util ; make cmp )
|
||||
(cd lang ; make cmp )
|
||||
(cd mach ; make cmp )
|
||||
|
||||
install: # compile everything to machine code
|
||||
(cd etc ; make install )
|
||||
(cd util ; make install )
|
||||
(cd lang/cem ; make install )
|
||||
(cd mach ; make install )
|
||||
(cd lang/pc ; make install )
|
||||
|
||||
clean: # remove all non-sources, except boot-files
|
||||
(cd doc ; make clean )
|
||||
(cd man ; make clean )
|
||||
(cd h ; make clean )
|
||||
(cd etc ; make clean )
|
||||
(cd util ; make clean )
|
||||
(cd lang ; make clean )
|
||||
(cd mach ; make clean )
|
||||
|
||||
opr: # print all sources
|
||||
make pr | opr
|
||||
|
||||
pr: # print all sources
|
||||
@( pr Makefile ; \
|
||||
(cd doc ; make pr ) ; \
|
||||
(cd man ; make pr ) ; \
|
||||
(cd h ; make pr ) ; \
|
||||
(cd etc ; make pr ) ; \
|
||||
(cd lang ; make pr ) ; \
|
||||
(cd util ; make pr ) ; \
|
||||
(cd mach ; make pr ) \
|
||||
)
|
||||
17
NEW
Normal file
17
NEW
Normal file
@@ -0,0 +1,17 @@
|
||||
What's new:
|
||||
A lot of things have changed since that previous distribution.
|
||||
It is not wise to mix files created by the previous version of the Kit
|
||||
with files belonging to this version, although that might sometimes work.
|
||||
The major additions are:
|
||||
- Basic frontend
|
||||
- New codegenerator
|
||||
- LL(1) parser generator
|
||||
- Vax backend with 4-byte wordsize
|
||||
- Motorola 68000 backend with 4-byte wordsize
|
||||
- Motorola 68000 interpreter for 2- and 4-byte wordsize
|
||||
- Z8000 assembler and backend.
|
||||
- 6805 assembler
|
||||
- NatSem 16032 assembler
|
||||
- Intel 8080 backend
|
||||
- Zilog Z80 backend
|
||||
- Signetics 2650 assembler
|
||||
2
README
Normal file
2
README
Normal file
@@ -0,0 +1,2 @@
|
||||
Before starting installation you should read
|
||||
the file doc/install.pr
|
||||
109
TakeAction
Executable file
109
TakeAction
Executable file
@@ -0,0 +1,109 @@
|
||||
case $# in
|
||||
0) PAR=install ; CMD=Action ;;
|
||||
1) PAR="$1" ; CMD=Action ;;
|
||||
2) PAR="$1" ; CMD="$2" ;;
|
||||
*) echo Syntax: "$0" [param [file]] ; exit 1 ;;
|
||||
esac
|
||||
if test -r "$CMD"
|
||||
then :
|
||||
else
|
||||
case "$CMD" in
|
||||
Action) echo No Action file present ;;
|
||||
*) echo No Action file "($CMD)" present ;;
|
||||
esac
|
||||
fi
|
||||
THISFILE=`pwd`/$0
|
||||
SYS=
|
||||
RETC=0
|
||||
{ while read LINE
|
||||
do
|
||||
eval set $LINE
|
||||
case x"$1" in
|
||||
x#*) ;;
|
||||
xname) SYS="$2"
|
||||
ACTION='make $PAR'
|
||||
DIR=.
|
||||
FM=no
|
||||
FAIL='Failed for $SYS, see $DIR/Out'
|
||||
SUCC='$SYS -- done'
|
||||
ATYPE=
|
||||
FATAL=no
|
||||
DOIT=yes
|
||||
;;
|
||||
xfatal) FATAL=yes ;;
|
||||
xaction|xindir) case x$ATYPE in
|
||||
x) ACTION=$2 ; ATYPE=$1
|
||||
case $ATYPE$FM in
|
||||
indirno) FAIL='Failed for $SYS' ;;
|
||||
esac
|
||||
;;
|
||||
*) echo Already specified an $ATYPE for this name
|
||||
RETC=65 ;;
|
||||
esac ;;
|
||||
xfailure) FM=yes
|
||||
FAIL="$2" ;;
|
||||
xsuccess) SUCC="$2" ;;
|
||||
xdir) DIR="$2" ;;
|
||||
xsystem) case `ack_sys` in
|
||||
$2) ;;
|
||||
*) echo "Sorry, $SYS can only be made on $2 systems"
|
||||
DOIT=no
|
||||
;;
|
||||
esac ;;
|
||||
xend) case $DOIT in
|
||||
no) continue ;;
|
||||
esac
|
||||
case x$SYS in
|
||||
x) echo Missing name line; RETC=65 ;;
|
||||
*) if test -d $DIR
|
||||
then (
|
||||
cd $DIR
|
||||
X=
|
||||
case $ATYPE in
|
||||
indir)
|
||||
if sh $THISFILE $PAR $ACTION
|
||||
then eval echo $SUCC
|
||||
else RETC=2 ; eval echo $FAIL
|
||||
fi ;;
|
||||
*)
|
||||
if eval "$ACTION >Out 2>&1 </dev/null"
|
||||
then eval echo $SUCC
|
||||
else RETC=1 ; X=: ; eval echo $FAIL
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
(echo ------- `pwd`
|
||||
cat Out
|
||||
$X rm -f Out
|
||||
) 2>/dev/null 1>&- 1>&3
|
||||
exit $RETC
|
||||
)
|
||||
case $? in
|
||||
0) ;;
|
||||
*) case $RETC in
|
||||
0) RETC=$? ;;
|
||||
esac ;;
|
||||
esac
|
||||
else
|
||||
echo Directory $DIR for $SYS is inaccessible
|
||||
RETC=66
|
||||
fi ;;
|
||||
esac
|
||||
case $FATAL$RETC in
|
||||
yes0) ;;
|
||||
yes*) echo Fatal error, installation stopped.
|
||||
exit $RETC ;;
|
||||
esac
|
||||
SYS=
|
||||
;;
|
||||
*) echo Unknown keyword "$1"
|
||||
RETC=67 ;;
|
||||
esac
|
||||
done
|
||||
exit $RETC
|
||||
} <$CMD
|
||||
RETX=$?
|
||||
case $RETX in
|
||||
0) exit $RETC ;;
|
||||
*) exit $RETX ;;
|
||||
esac
|
||||
1
bin/em.pascal
Executable file
1
bin/em.pascal
Executable file
@@ -0,0 +1 @@
|
||||
exec /usr/em/doc/em.doc/int/em /usr/em/doc/em.doc/int/tables ${1-e.out} core
|
||||
15
distr/Action
Normal file
15
distr/Action
Normal file
@@ -0,0 +1,15 @@
|
||||
name "Installation manual"
|
||||
dir doc
|
||||
end
|
||||
name "EM documentation"
|
||||
dir doc/em.doc
|
||||
end
|
||||
name "Pascal bootstrap files"
|
||||
dir lang/pc/pem
|
||||
end
|
||||
name "LLgen bootstrap files"
|
||||
dir util/LLgen
|
||||
end
|
||||
name "MSC6500 vend_library"
|
||||
dir mach/6500/libem
|
||||
end
|
||||
6
distr/Action1
Normal file
6
distr/Action1
Normal file
@@ -0,0 +1,6 @@
|
||||
name "vax2/cg bootstrap files"
|
||||
dir mach/vax2/cg
|
||||
end
|
||||
name "vax4/cg bootstrap files"
|
||||
dir mach/vax4/cg
|
||||
end
|
||||
42
distr/Exceptions
Normal file
42
distr/Exceptions
Normal file
@@ -0,0 +1,42 @@
|
||||
-- ./bin/em.pascal no RCS file
|
||||
-- ./doc/em.doc/doc.pr no RCS file
|
||||
-- ./doc/install.pr no RCS file
|
||||
-- ./h/em_mnem.h no RCS file
|
||||
-- ./h/em_pseu.h no RCS file
|
||||
-- ./h/em_spec.h no RCS file
|
||||
-- ./lang/basic/src/y.tab.c no RCS file
|
||||
-- ./lang/basic/src/y.tab.h no RCS file
|
||||
-- ./lang/pc/pem/pem22.m no RCS file
|
||||
-- ./lang/pc/pem/pem24.m no RCS file
|
||||
-- ./lib/LLgen/incl no RCS file
|
||||
-- ./lib/LLgen/rec no RCS file
|
||||
-- ./lib/ix/head_em no RCS file
|
||||
-- ./lib/ix/head_i no RCS file
|
||||
-- ./lib/ix/tail_em no RCS file
|
||||
-- ./lib/ix/tail_em.vend no RCS file
|
||||
-- ./lib/ix/tail_mon no RCS file
|
||||
-- ./mach/6500/libem/tail_em.ve.s.a no RCS file
|
||||
-- ./mach/vax2/cg/tables1.c no RCS file
|
||||
-- ./mach/vax2/cg/tables1.h no RCS file
|
||||
-- ./mach/vax4/cg/tables1.c no RCS file
|
||||
-- ./mach/vax4/cg/tables1.h no RCS file
|
||||
-- ./mach/z80/int/libpc/pc_tail.c.a no RCS file
|
||||
-- ./mkun/pubmac no distr2 yet
|
||||
-- ./mkun/tmac.q no distr2 yet
|
||||
-- ./mkun/tmac.q1 no distr2 yet
|
||||
-- ./mkun/tmac.q2 no distr2 yet
|
||||
-- ./mkun/tmac.q3 no distr2 yet
|
||||
-- ./mkun/tmac.q4 no distr2 yet
|
||||
-- ./mkun/tmac.q5 no distr2 yet
|
||||
-- ./mkun/tmac.q6 no distr2 yet
|
||||
-- ./mkun/tmac.q7 no distr2 yet
|
||||
-- ./mkun/tmac.q8 no distr2 yet
|
||||
-- ./util/LLgen/src/parser no RCS file
|
||||
-- ./util/LLgen/src/LLgen.c no RCS file
|
||||
-- ./util/LLgen/src/Lpars.c no RCS file
|
||||
-- ./util/LLgen/src/Lpars.h no RCS file
|
||||
-- ./util/LLgen/src/tokens.c no RCS file
|
||||
-- ./util/data/em_flag.c no RCS file
|
||||
-- ./util/data/em_mnem.c no RCS file
|
||||
-- ./util/data/em_pseu.c no RCS file
|
||||
-- ./util/data/em_ptyp.c no RCS file
|
||||
74
distr/How_To
Normal file
74
distr/How_To
Normal file
@@ -0,0 +1,74 @@
|
||||
How to make a fresh distribution:
|
||||
For a distribution you need ".distr" files and RCS files.
|
||||
The EM home directory contains a file called ".distr". It contains
|
||||
the names of all the files and directories you want to have in the distribution.
|
||||
The directories should contain .distr files, the other files should
|
||||
be placed under RCS.
|
||||
The current RCS revision name is "distr2".
|
||||
The are files that derive from other files and yet should be placed
|
||||
in the distribution.
|
||||
These files should not be placed under RCS.
|
||||
The file "Exceptions" in this directory contains the current list of
|
||||
these files.
|
||||
|
||||
When all this is correct, use the shell script mktree the extract
|
||||
the distribution from the EM tree.
|
||||
cd /usr/em ; sh distr/mktree destination_tree >distr/f.attf 2>&1
|
||||
Make sure that the destination tree exists and is empty!
|
||||
Failing to do that will almost certainly result in a welter of
|
||||
error messages.
|
||||
The file f.attf contains mktree error messages and should be compared
|
||||
to Exceptions.
|
||||
The actions of mktree are quite complicated. It starts in the current
|
||||
directory reading the ".distr" file, after copying that file to the
|
||||
destination tree.
|
||||
For each file mentioned there it performes certain actions:
|
||||
1- Directory Change to that directory and call yourself recursively.
|
||||
2- File
|
||||
a- Try to do "co -rdistr2 destination_tree/path/destination_file"
|
||||
on succes "chmod +w destination_file"
|
||||
else
|
||||
b- Try to do "co destination_tree/destination_file"
|
||||
on succes "chmod +w destination_file" and
|
||||
give message that says "Missing distr2 entry" (or some such).
|
||||
else
|
||||
c- I Does a file LIST exist in this directory AND
|
||||
is the first line of LIST equal to the name of the
|
||||
destination file? If so, try to extract all the files
|
||||
named in the rest of the LIST file and call the program
|
||||
arch to create a library "arch cr `cat LIST`".
|
||||
In this manner libraries can be distributed whose members
|
||||
have their own RCS file!
|
||||
else
|
||||
II try to do "cp file destination_tree/path/destination_file"
|
||||
on succes give message that says "Missing RCS entry"
|
||||
(or some such).
|
||||
else
|
||||
d-
|
||||
give message that says "Missing entry" (or some such).
|
||||
|
||||
Now you have the tree but not everything is kosher yet.
|
||||
Some files derive from other files in the tree, those derivations should
|
||||
be done with the use of an already installed distribution.
|
||||
The files Action and Action1 in this directory contain the actions
|
||||
we now take. (Confession: most of the time we use /usr/em)
|
||||
One warning, to re-nroff the IR-81 report it takes more then just nroff
|
||||
because most nroff's can't stand that report and stop half-way.
|
||||
The ntroff program does the trick, but only on the 11's.
|
||||
tbl sources | ntroff -Tlp | ntlp
|
||||
|
||||
After running these re-derivation programs the distrubtion tree starts
|
||||
to look like the tree you need.
|
||||
There are too many files there though, especially the files created by
|
||||
the derivation process.
|
||||
That is why we now give the command:
|
||||
dtar cdf distr2 .
|
||||
The file distr2 is the one you should put on tape!
|
||||
But,.... before doing that: Try it out!
|
||||
Repeat the process described in the installation manual.
|
||||
Only if that succeeds you are sure that you included the files needed,
|
||||
and gave all other files the correct "distr2" RCS id.
|
||||
After you sent the tape away, forbid ANYBODY to touch the distr2 id
|
||||
in your RCS files.
|
||||
Good Luck,
|
||||
Ed Keizer, 85/4/15.
|
||||
25
distr/dwalk
Executable file
25
distr/dwalk
Executable file
@@ -0,0 +1,25 @@
|
||||
: ${CDIR=.}
|
||||
if test ! -r .distr
|
||||
then
|
||||
echo ++ no .distr in $CDIR
|
||||
exit 0
|
||||
fi
|
||||
${DS-:} $CDIR
|
||||
for i in `cat .distr`
|
||||
do
|
||||
if test -d $i
|
||||
then
|
||||
( if cd $i
|
||||
then
|
||||
${DD-:} $CDIR $i
|
||||
CDIR=$CDIR/$i
|
||||
export CDIR
|
||||
exec /usr/em/distr/dwalk
|
||||
else
|
||||
echo ++ Could not access $CDIR/$i
|
||||
fi
|
||||
)
|
||||
else
|
||||
${DF-:} $CDIR $i
|
||||
fi
|
||||
done
|
||||
1
distr/echod
Executable file
1
distr/echod
Executable file
@@ -0,0 +1 @@
|
||||
echo $1/$2
|
||||
42
distr/f.attf
Normal file
42
distr/f.attf
Normal file
@@ -0,0 +1,42 @@
|
||||
-- ./bin/em.pascal no RCS file
|
||||
-- ./doc/em.doc/doc.pr no RCS file
|
||||
-- ./doc/install.pr no RCS file
|
||||
-- ./h/em_mnem.h no RCS file
|
||||
-- ./h/em_pseu.h no RCS file
|
||||
-- ./h/em_spec.h no RCS file
|
||||
-- ./lang/basic/src/y.tab.c no RCS file
|
||||
-- ./lang/basic/src/y.tab.h no RCS file
|
||||
-- ./lang/pc/pem/pem22.m no RCS file
|
||||
-- ./lang/pc/pem/pem24.m no RCS file
|
||||
-- ./lib/LLgen/incl no RCS file
|
||||
-- ./lib/LLgen/rec no RCS file
|
||||
-- ./lib/ix/head_em no RCS file
|
||||
-- ./lib/ix/head_i no RCS file
|
||||
-- ./lib/ix/tail_em no RCS file
|
||||
-- ./lib/ix/tail_em.vend no RCS file
|
||||
-- ./lib/ix/tail_mon no RCS file
|
||||
-- ./mach/6500/libem/tail_em.ve.s.a no RCS file
|
||||
-- ./mach/vax2/cg/tables1.c no RCS file
|
||||
-- ./mach/vax2/cg/tables1.h no RCS file
|
||||
-- ./mach/vax4/cg/tables1.c no RCS file
|
||||
-- ./mach/vax4/cg/tables1.h no RCS file
|
||||
-- ./mach/z80/int/libpc/pc_tail.c.a no RCS file
|
||||
-- ./mkun/pubmac no distr2 yet
|
||||
-- ./mkun/tmac.q no distr2 yet
|
||||
-- ./mkun/tmac.q1 no distr2 yet
|
||||
-- ./mkun/tmac.q2 no distr2 yet
|
||||
-- ./mkun/tmac.q3 no distr2 yet
|
||||
-- ./mkun/tmac.q4 no distr2 yet
|
||||
-- ./mkun/tmac.q5 no distr2 yet
|
||||
-- ./mkun/tmac.q6 no distr2 yet
|
||||
-- ./mkun/tmac.q7 no distr2 yet
|
||||
-- ./mkun/tmac.q8 no distr2 yet
|
||||
-- ./util/LLgen/src/parser no RCS file
|
||||
-- ./util/LLgen/src/LLgen.c no RCS file
|
||||
-- ./util/LLgen/src/Lpars.c no RCS file
|
||||
-- ./util/LLgen/src/Lpars.h no RCS file
|
||||
-- ./util/LLgen/src/tokens.c no RCS file
|
||||
-- ./util/data/em_flag.c no RCS file
|
||||
-- ./util/data/em_mnem.c no RCS file
|
||||
-- ./util/data/em_pseu.c no RCS file
|
||||
-- ./util/data/em_ptyp.c no RCS file
|
||||
10
distr/listall
Executable file
10
distr/listall
Executable file
@@ -0,0 +1,10 @@
|
||||
case $# in
|
||||
0) DIR=. ;;
|
||||
1) DIR=$1 ;;
|
||||
*) echo $0 [directory] ; exit 1 ;;
|
||||
esac
|
||||
DD=`pwd`/listall.d
|
||||
DW=`pwd`/dwalk
|
||||
export DD
|
||||
cd $DIR
|
||||
$DW
|
||||
2
distr/listall.d
Executable file
2
distr/listall.d
Executable file
@@ -0,0 +1,2 @@
|
||||
echo "<$1/$2>"
|
||||
ls -bCdx `cat .distr`
|
||||
10
distr/listdirs
Executable file
10
distr/listdirs
Executable file
@@ -0,0 +1,10 @@
|
||||
case $# in
|
||||
0) DIR=. ;;
|
||||
1) DIR=$1 ;;
|
||||
*) echo $0 [directory] ; exit 1 ;;
|
||||
esac
|
||||
DD=`pwd`/echod
|
||||
DW=`pwd`/dwalk
|
||||
export DD
|
||||
cd $DIR
|
||||
$DW
|
||||
9
distr/mka
Executable file
9
distr/mka
Executable file
@@ -0,0 +1,9 @@
|
||||
set -e
|
||||
for i in `tail +2 $DESTDIR/$1/LIST`
|
||||
do
|
||||
${DF-false} $1 $i
|
||||
done
|
||||
cd $DESTDIR/$1
|
||||
arch cr `cat LIST`
|
||||
: I do not remove the files constituating the library, because
|
||||
: they might be present in .distr
|
||||
23
distr/mkf
Executable file
23
distr/mkf
Executable file
@@ -0,0 +1,23 @@
|
||||
if co -q -rdistr2 $DESTDIR/$1/$2 >/dev/null 2>&1
|
||||
then
|
||||
chmod +w $DESTDIR/$1/$2
|
||||
elif co -q $DESTDIR/$1/$2 >/dev/null 2>&1
|
||||
then
|
||||
chmod +w $DESTDIR/$1/$2
|
||||
echo -- $1/$2 no distr2 yet
|
||||
elif grep LIST .distr >/dev/null 2>&1 &&
|
||||
(test "$2" = "`head -1 $DESTDIR/$1/LIST`") >/dev/null 2>&1 &&
|
||||
${DA-false} "$1" "$2"
|
||||
then
|
||||
: Fetched library contents one by one and put them together
|
||||
elif cp $2 $DESTDIR/$1/$2 >/dev/null 2>&1
|
||||
then
|
||||
echo -- $1/$2 no RCS file
|
||||
else
|
||||
echo ++ $1/$2 not present
|
||||
fi
|
||||
case $2 in
|
||||
LIST) if (test -r $DESTDIR/$1/`head -1 $DESTDIR/$1/LIST`) >/dev/null 2>&1
|
||||
then echo ++ LIST files must be in .distr before their libraries!!!
|
||||
fi ;;
|
||||
esac
|
||||
15
distr/mktree
Normal file
15
distr/mktree
Normal file
@@ -0,0 +1,15 @@
|
||||
case $# in
|
||||
1) ;;
|
||||
*) echo $0 directory ; exit 1 ;;
|
||||
esac
|
||||
DDIR=/usr/em/distr
|
||||
case $1 in
|
||||
/*) DESTDIR=$1 ;;
|
||||
*) DESTDIR=`pwd`/$1 ;;
|
||||
esac
|
||||
DS=$DDIR/mks
|
||||
DD=$DDIR/mkd
|
||||
DF=$DDIR/mkf
|
||||
DA=$DDIR/mka
|
||||
export DESTDIR DS DD DF DA
|
||||
$DDIR/dwalk
|
||||
26
distr/todistr
Normal file
26
distr/todistr
Normal file
@@ -0,0 +1,26 @@
|
||||
REV=
|
||||
FILE=
|
||||
while :
|
||||
do
|
||||
case $# in
|
||||
0) break ;;
|
||||
esac
|
||||
ARG="$1"
|
||||
shift
|
||||
case "$ARG" in
|
||||
-r*) REV=`echo "$ARG"| sed s/-r//` ;;
|
||||
-*) FLAGS="$FLAGS $ARG" ;;
|
||||
*) case x$FILE in
|
||||
x) FILE="$ARG" ;;
|
||||
*) echo todistr can only be done on one file at the time
|
||||
exit 1 ;;
|
||||
esac
|
||||
esac
|
||||
done
|
||||
case x$REV in
|
||||
x) REV=`rlog -h "$FILE"|sed -n -e '/head/s/^head:[ ]*//p'` ;;
|
||||
esac
|
||||
case x$REV in
|
||||
x) exit 2 ;;
|
||||
esac
|
||||
rcs -ndistr2:$REV $FLAGS $FILE
|
||||
2163
doc/6500.doc
Normal file
2163
doc/6500.doc
Normal file
File diff suppressed because it is too large
Load Diff
15
doc/Makefile
15
doc/Makefile
@@ -1,7 +1,10 @@
|
||||
# $Header$
|
||||
|
||||
SUF=pr
|
||||
PRINT=cat
|
||||
RESFILES=cref.$(SUF) pcref.$(SUF) val.$(SUF) v7bugs.$(SUF) install.$(SUF)\
|
||||
ack.$(SUF) cg.$(SUF) regadd.$(SUF) peep.$(SUF) toolkit.$(SUF)
|
||||
ack.$(SUF) cg.$(SUF) regadd.$(SUF) peep.$(SUF) toolkit.$(SUF) LLgen.$(SUF)\
|
||||
basic.$(SUF) 6500.$(SUF) ncg.$(SUF)
|
||||
NROFF=nroff
|
||||
MS=-ms
|
||||
|
||||
@@ -13,21 +16,31 @@ ack.$(SUF): ack.doc
|
||||
$(NROFF) $(MS) $? >$@
|
||||
cg.$(SUF): cg.doc
|
||||
$(NROFF) $(MS) $? >$@
|
||||
ncg.$(SUF): ncg.doc
|
||||
$(NROFF) $(MS) $? >$@
|
||||
regadd.$(SUF): regadd.doc
|
||||
$(NROFF) $(MS) $? >$@
|
||||
install.$(SUF): install.doc
|
||||
$(NROFF) $(MS) $? >$@
|
||||
pcref.$(SUF): pcref.doc
|
||||
$(NROFF) $? >$@
|
||||
basic.$(SUF): basic.doc
|
||||
$(NROFF) $(MS) $? >$@
|
||||
peep.$(SUF): peep.doc
|
||||
$(NROFF) $(MS) $? >$@
|
||||
val.$(SUF): val.doc
|
||||
$(NROFF) $? >$@
|
||||
toolkit.$(SUF): toolkit.doc
|
||||
$(NROFF) $(MS) $? >$@
|
||||
LLgen.$(SUF): LLgen.doc
|
||||
eqn $? | $(NROFF) $(MS) >$@
|
||||
6500.$(SUF): 6500.doc
|
||||
$(NROFF) $(MS) $? >$@
|
||||
|
||||
install cmp:
|
||||
|
||||
distr: install.doc
|
||||
nroff -Tlp install.doc >install.pr
|
||||
pr:
|
||||
@make "SUF="$SUF "NROFF="$NROFF "PRINT="$PRINT $(RESFILES) \
|
||||
>make.pr.out 2>&1
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
.\" $Header$
|
||||
.nr LL 7.5i
|
||||
.tr ~
|
||||
.nr PD 1v
|
||||
|
||||
849
doc/basic.doc
Normal file
849
doc/basic.doc
Normal file
@@ -0,0 +1,849 @@
|
||||
.\" $Header$
|
||||
.TL
|
||||
.de Sy
|
||||
.LP
|
||||
.IP \fBsyntax\fR 10
|
||||
..
|
||||
.de PU
|
||||
.IP \fBpurpose\fR 10
|
||||
..
|
||||
.de RM
|
||||
.IP \fBremarks\fR 10
|
||||
..
|
||||
The ABC compiler
|
||||
.AU
|
||||
Martin L. Kersten
|
||||
.AI
|
||||
Department of Mathematics and Computer Science.
|
||||
.br
|
||||
Vrije Universiteit
|
||||
.AB
|
||||
This manual describes the
|
||||
programming language BASIC and its compiler
|
||||
included in the Amsterdam Compiler Kit.
|
||||
.AE
|
||||
.SH
|
||||
INTRODUCTION.
|
||||
.LP
|
||||
The BASIC-EM compiler is an extensive implementation of the
|
||||
programming language BASIC.
|
||||
The language structure and semantics are modelled after the
|
||||
BASIC interpreter/compiler of Microsoft (tr), a detailed comparison
|
||||
is provided in appendix A.
|
||||
.LP
|
||||
The compiler generates code for a virtual machine, the EM machine
|
||||
[[ACM, etc]]
|
||||
Using EM as an intermediate machine results in a highly portable
|
||||
compiler and BASIC code.
|
||||
The drawback of EM is that it does not directly reflect one particular
|
||||
hardware design, which means that many of
|
||||
the low level operations available within
|
||||
BASIC are ill-defined or even inapplicable.
|
||||
To mention a few, the peek and poke instructions are likely
|
||||
to be behave errorneous, while line printer and tapedeck
|
||||
primitives are unknown.
|
||||
.LP
|
||||
This manual is divided into three chapters.
|
||||
The first chapter discusses the general language syntax and semantics.
|
||||
Chapter two describes the statements available in BASIC-EM.
|
||||
Chapter 3 describes the predefined functions,
|
||||
ordered alphabetically.
|
||||
Appendix A discusses the differences with
|
||||
Microsoft BASIC. Appendix B describes all reserved symbols.
|
||||
Appendix C lists the error messages in use.
|
||||
.SH
|
||||
SYNTAX NOTATION
|
||||
.LP
|
||||
The conventions for syntax presentation are as follows:
|
||||
.IP CAPS 10
|
||||
Items are reserved words, must be input as shown
|
||||
.IP <> 10
|
||||
Items in lowercase letters enclosed in angular brackets
|
||||
are to be supplied by the user.
|
||||
.IP [] 10
|
||||
Items are optional.
|
||||
.IP \.\.\. 10
|
||||
Items may be repeated any number of times
|
||||
.IP {} 10
|
||||
A choice between two or more alternatives. At least one of the entries
|
||||
must be chosen.
|
||||
.IP | 10
|
||||
Vertical bars separate the choices within braces.
|
||||
.LP
|
||||
All punctuation must be included where shown.
|
||||
.NH 1
|
||||
GENERAL INFORMATION
|
||||
.LP
|
||||
The BASIC-EM compiler is designed for a UNIX based environment.
|
||||
It accepts a text file with your BASIC program (suffix .b) and generates
|
||||
an executable file, called a.out.
|
||||
.NH 2
|
||||
LINE FORMAT
|
||||
.LP
|
||||
A BASIC program consists of a series of lines, starting with a
|
||||
positive line number in the range 0 to 65529.
|
||||
A line may consists of more then one physical line on your terminal, but must
|
||||
is limited to 1024 characters.
|
||||
Multiple BASIC statements may be placed on a single line, provided
|
||||
they are separated by a colon (:).
|
||||
.NH 2
|
||||
CONSTANTS
|
||||
.LP
|
||||
The BASIC compiler character set is comprised of alphabetic
|
||||
characters, numeric characters, and special characters shown below.
|
||||
.DS
|
||||
= + - * / ^ ( ) % # $ \\ _
|
||||
! [ ] , . ; : & ' ? > < \\ (blanc)
|
||||
.DE
|
||||
.LP
|
||||
BASIC uses two different types of constants during processing:
|
||||
numeric and string constants.
|
||||
.br
|
||||
A string constant is a sequence of characters taken from the ASCII
|
||||
character set enclosed by double quotation marks.
|
||||
.br
|
||||
Numeric constants are positive or negative numbers, grouped into
|
||||
five different classes.
|
||||
.IP "a) integer constants" 25
|
||||
Whole numbers in the range of -32768 and 32767. Integer constants do
|
||||
not contain decimal points.
|
||||
.IP "b) fixed point constants" 25
|
||||
Positive or negative real numbers, i.e. numbers with a decimal point.
|
||||
.IP "c) floating point constants" 25
|
||||
Real numbers in scientific notation. A floating point constant
|
||||
consists of an optional signed integer or fixed point number
|
||||
followed by the letter E (or D) and an optional signed integer
|
||||
(the exponent).
|
||||
The allowable range of floating point constants is 10^-38 to 10^+38.
|
||||
.IP "d) Hex constants" 25
|
||||
Hexadecimal numbers, denoted by the prefix &H.
|
||||
.IP "d) Octal constants" 25
|
||||
Octal numbers, denoted by the prefix &O.
|
||||
.NH 2
|
||||
VARIABLES
|
||||
.LP
|
||||
Variables are names used to represent values in a BASIC program.
|
||||
A variable is assigned a value by assigment specified in the program.
|
||||
Before a variable is assigned its value is assumed to be zero.
|
||||
.br
|
||||
Variable names are composed of letters, digits or the decimal point,
|
||||
starting with a letter. Up to 40 characters are significant.
|
||||
A variable name be be followed by any of the following type
|
||||
declaration characters:
|
||||
.IP % 5
|
||||
Defines an integer variable
|
||||
.IP ! 5
|
||||
Defines a single precision variable (see below)
|
||||
.IP # 5
|
||||
Defines a double precision variable
|
||||
.IP $ 5
|
||||
Defines a string variable.
|
||||
.LP
|
||||
NOTE: Two variables with the same name but different type is
|
||||
considered illegal.
|
||||
.LP
|
||||
Beside single valued variables, values may be grouped
|
||||
into tables or arrays.
|
||||
Each element in an array is referenced by the array name and an index,
|
||||
such a variable is called a subscripted variable.
|
||||
An array has as many subscripts as there are dimensions in the array,
|
||||
the maximum of which is 11.
|
||||
.br
|
||||
If a variable starts with FN it is assumed to be a call to a user defined
|
||||
function.
|
||||
.br
|
||||
A variable name may not be a reserved word nor the name
|
||||
of a predefined function.
|
||||
A list of all reserved identifiers is included as Appendix ?.
|
||||
.NH 2
|
||||
EXPRESSIONS
|
||||
.LP
|
||||
BASIC-EM differs from Microsoft BASIC in supporting floats in one precision
|
||||
only (due to EM).
|
||||
All floating point constants have the same precision, i.e. 16 digits.
|
||||
.LP
|
||||
When necessary the compiler will convert a numeric value from
|
||||
one type to another.
|
||||
A value is always converted to the precision of the variable it is assigned
|
||||
to.
|
||||
When a floating point value is converted to an integer the fractional
|
||||
portion is rounded.
|
||||
In an expression all values are converted to the same degree of precision,
|
||||
i.e. that of the most precise operand.
|
||||
.br
|
||||
Division by zero results in the message "Division by zero".
|
||||
If overflow (or underflow) occurs, the "Overflow (underflow)" message is
|
||||
displayed and execution is terminated (contrary to Microsoft).
|
||||
.SH
|
||||
Arithmetic
|
||||
.LP
|
||||
The arithmetic operators in order of precedence,a re:
|
||||
.DS L
|
||||
\^ Exponentiation
|
||||
- Negation
|
||||
*,/,\\,MOD Multiplication, Division, Remainder
|
||||
+,- Addition, Substraction
|
||||
.DE
|
||||
The operator \\\\ denotes integer division, its operands are rounded to
|
||||
integers before the operator is applied.
|
||||
Modulus arithmetic is denoted by the operator MOD, which yields the
|
||||
integer value that is the remainder of an integer division.
|
||||
.br
|
||||
The order in which operators are performed can be changec with parentheses.
|
||||
.SH
|
||||
Relational
|
||||
.LP
|
||||
The relational operators in order of precedence, are:
|
||||
.DS
|
||||
= Equality
|
||||
<> Inequality
|
||||
< Less than
|
||||
> Greater than
|
||||
<= Less than or equal to
|
||||
>= Greater than or equal to
|
||||
.DE
|
||||
The relational operators are used to compare two values and returns
|
||||
either "true" (-1) or "false" (0) (See IF statement).
|
||||
The precedence of the relational operators is lower
|
||||
then the arithmetic operators.
|
||||
.SH
|
||||
Logical
|
||||
.LP
|
||||
The logical operators performs tests on multiple relations, bit manipulations,
|
||||
or Boolean operations.
|
||||
The logical operators returns a bitwise result ("true" or "false").
|
||||
In an expression, logical operators are performed after the relational and
|
||||
arithmetic operators.
|
||||
The logical operators work by converting their operands to signed
|
||||
two-complement integers in the range -32768 to 32767.
|
||||
.DS
|
||||
NOT Bitwise negation
|
||||
AND Bitwise and
|
||||
OR Bitwise or
|
||||
XOR Bitwise exclusive or
|
||||
EQV Bitwise equivalence
|
||||
IMP Bitwise implies
|
||||
.DE
|
||||
.SH
|
||||
Functional
|
||||
.LP
|
||||
A function is used in an expression to call a system or user defined
|
||||
function.
|
||||
A list of predefined functions is presented in chapter 3.
|
||||
.SH
|
||||
String operations
|
||||
.LP
|
||||
Strings can be concatenated by using +. Strings can be compared with
|
||||
the relational operators. String comparison is performed in lexicographic
|
||||
order.
|
||||
.NH 2
|
||||
ERROR MESSAGES
|
||||
.LP
|
||||
The occurence of an error results in termination of the program
|
||||
unless an ON....ERROR statement has been encountered.
|
||||
.NH 1
|
||||
B-EM STATEMENTS
|
||||
.LP
|
||||
This chapter describes the statements available within the BASIC-EM
|
||||
compiler. Each description is formatted as follows:
|
||||
.Sy
|
||||
Shows the correct syntax for the statement. See introduction of
|
||||
syntax notation above.
|
||||
.PU
|
||||
Describes the purpose and details of the instructions.
|
||||
.RM
|
||||
Describes special cases, deviation from Microsoft BASIC etc.
|
||||
.LP
|
||||
.NH 2
|
||||
CALL
|
||||
.Sy
|
||||
CALL <variable name>[(<argument list>)]
|
||||
.PU
|
||||
The CALL statement provides the means to execute procedures
|
||||
and functions written in another language included in the
|
||||
Amsterdam Compiler Kit.
|
||||
The argument list consist of (subscripted) variables.
|
||||
The BASIC compiler pushes the address of the arguments on the stack in order
|
||||
of encounter.
|
||||
.RM
|
||||
Not yet available
|
||||
.NH 2
|
||||
CLOSE
|
||||
.Sy
|
||||
CLOSE [[#]<file number>[,[#]<file number...>]]
|
||||
.PU
|
||||
To terminate I/O on a disk file.
|
||||
<file number> is the number associated with the file
|
||||
when it was OPENed (See OPEN). Ommission of parameters results in closing
|
||||
all files.
|
||||
.sp
|
||||
The END statement and STOP statement always issue a CLOSE of
|
||||
all files.
|
||||
.NH 2
|
||||
DATA
|
||||
.Sy
|
||||
DATA <list of constants>
|
||||
.PU
|
||||
DATA statements are used to construct a data bank of values that are
|
||||
accessed by the program's READ statement.
|
||||
DATA statements are non-executable,
|
||||
the data items are assembled in a data file by the BASIC compiler.
|
||||
This file can be replaced, provided the layout remains
|
||||
the same (otherwise the RESTORE won't function properly).
|
||||
.sp
|
||||
The list of data items consists of numeric and string constants
|
||||
as discussed in section 1.
|
||||
Moreover, string constants starting with a letter and not
|
||||
containing blancs, newlines, commas, colon need not be enclosed with
|
||||
the string quotes.
|
||||
.sp
|
||||
DATA statements can be reread using the RESTORE statement.
|
||||
.NH 2
|
||||
DEF FN
|
||||
.Sy
|
||||
DEF FN<name> [(<parameterlist>)]=<expression>
|
||||
.PU
|
||||
To define and name a function that is written by the user.
|
||||
<name> must be an identifier and should be preceded by FN,
|
||||
which is considered integral part of the function name.
|
||||
<expression> defines the expression to be evaluated upon function call.
|
||||
.sp
|
||||
The parameter list is comprised of a comma separated
|
||||
list of variable names, used within the function definition,
|
||||
that are to replaced by values upon function call.
|
||||
The variable names defined in the parameterlist, called formal
|
||||
parameters, do not affect the definition and use of variables
|
||||
defined with the same name in the rest of the BASIC program.
|
||||
.sp
|
||||
A type declaration character may be suffixed to the function name to
|
||||
designate the data type of the function result.
|
||||
.NH 2
|
||||
DEFINT/SNG/DBL/STR
|
||||
.Sy
|
||||
DEF<type> <range of letters>
|
||||
.PU
|
||||
Any undefined variable starting with the letter included in the range of
|
||||
letters is declared of type <type> unless a type declaration character
|
||||
is appended.
|
||||
The range of letters is a comma separated list of characters and
|
||||
character ranges (<letter>-<letter>).
|
||||
.NH 2
|
||||
DIM
|
||||
.Sy
|
||||
DIM <list of subscripted variable>
|
||||
.PU
|
||||
The DIM statement allocates storage for subscripted variables.
|
||||
If an undefined subscripted variable is used
|
||||
the maximum value of the array subscript(s) is assumed to be 10.
|
||||
A subscript out of range is signalled by the program (when RCK works)
|
||||
The minimum subscript value is 0, unless the OPTION BASE statement has been
|
||||
encountered.
|
||||
.sp
|
||||
All variables in a subscripted variable are initially zero.
|
||||
.sp
|
||||
BUG. Multi-dimensional arrays MUST be defined.
|
||||
.NH 2
|
||||
END
|
||||
.Sy
|
||||
END
|
||||
.PU
|
||||
END terminates a BASIC program and returns to the UNIX shell.
|
||||
An END statement at the end of the BASIC program is optional.
|
||||
.NH 2
|
||||
ERR and ERL
|
||||
.PU
|
||||
Whenever an error occurs the variable ERR contains the
|
||||
error number and ERL the BASIC line where the error occurred.
|
||||
The variables are usually used in error handling routines
|
||||
provided by the user.
|
||||
.NH 2
|
||||
ERROR
|
||||
.Sy
|
||||
ERROR <integer expression>
|
||||
.PU
|
||||
To simulate the occurrence of a BASIC error.
|
||||
To define your own error code use a value not already in
|
||||
use by the BASIC runtime system.
|
||||
The list of error messages currently in use
|
||||
can be found in appendix B.
|
||||
.NH 2
|
||||
FIELD
|
||||
.PU
|
||||
To be implemented.
|
||||
.NH 2
|
||||
FOR...NEXT
|
||||
.Sy
|
||||
FOR <variable>= <low>TO<high>[STEP<size>]
|
||||
.br
|
||||
......
|
||||
.br
|
||||
NEXT [<variable>][,<variable>...]
|
||||
.PU
|
||||
The FOR statements allows a series of statements to be performed
|
||||
repeatedly. <variable> is used as a counter. During the first
|
||||
execution pass it is assigned the value <low>,
|
||||
an arithmetic expression. After each pass the counter
|
||||
is incremented with the step size <size>, an expression.
|
||||
Ommission of the step size is intepreted as an increment of 1.
|
||||
Execution of the program lines specified between the FOR and the NEXT
|
||||
statement is terminated as soon as <low> is greater than <high>
|
||||
.sp
|
||||
The NEXT statement is labeled with the name(s) of the counter to be
|
||||
incremented.
|
||||
.sp
|
||||
The body of the FOR statement is skipped when the initial value of the
|
||||
loop times the sign of the step exceeds the value of the highest value
|
||||
times the sign of the step.
|
||||
.sp
|
||||
The variables mentioned in the NEXT statement may be ommitted, in which case
|
||||
the variable of increment the counter of the most recent FOR statement.
|
||||
If a NEXT statement is encountered before its corresponding FOR statement,
|
||||
the error message "NEXT without FOR" is generated.
|
||||
.NH 2
|
||||
GET
|
||||
.Sy
|
||||
GET [#]<file number>[, <record number>]
|
||||
.PU
|
||||
To be implemented.
|
||||
.NH 2
|
||||
GOSUB...RETURN
|
||||
.Sy
|
||||
GOSUB <line number
|
||||
...
|
||||
.br
|
||||
RETURN
|
||||
.PU
|
||||
The GOSUB statement branches to the first statement of a subroutine.
|
||||
The RETURN statement cause a branch back to the statement following the
|
||||
most recent GOSUB statement.
|
||||
A subroutine may contain more than one RETURN statement.
|
||||
.sp
|
||||
Subroutines may be called recursively.
|
||||
Nesting of subroutine calls is limited, upon exceeding the maximum depth
|
||||
the error message "XXXXX" is displayed.
|
||||
.NH 2
|
||||
GOTO
|
||||
.Sy
|
||||
GOTO <line number>
|
||||
.PU
|
||||
To branch unconditionally to a specified line in the program.
|
||||
If <line number> does not exists, the compilation error message
|
||||
"Line not defined" is displayed.
|
||||
.RM
|
||||
Microsoft BASIC continues at the first line
|
||||
equal or greater then the line specified.
|
||||
.NH 2
|
||||
IF...THEN
|
||||
.Sy
|
||||
.br
|
||||
IF <expression> THEN {<statements>|<line number>}
|
||||
[ELSE {<statements>|<line number>}]
|
||||
.br
|
||||
.Sy
|
||||
IF <expression> GOTO <line number>
|
||||
[ELSE {<statements>|<line number>}]
|
||||
.PU
|
||||
The IF statement is used
|
||||
to make a decision regarding the program flow based on the
|
||||
result of the expressions.
|
||||
If the expression is not zero, the THEN or GOTO clause is
|
||||
executed. If the result of <expression> is zero, the THEN or
|
||||
GOTO clause is ignored and the ELSE clause, if present is
|
||||
executed.
|
||||
.br
|
||||
IF..THEN..ELSE statements may be nested.
|
||||
Nesting is limited by the length of the line.
|
||||
The ELSE clause matches with the closests unmatched THEN.
|
||||
.sp
|
||||
When using IF to test equality for a value that is the
|
||||
result of a floating point expression, remember that the
|
||||
internal representation of the value may not be exact.
|
||||
Therefore, the test should be against a range to
|
||||
handle the relative error.
|
||||
.RM
|
||||
Microsoft BASIC allows a comma before THEN.
|
||||
.NH 2
|
||||
INPUT
|
||||
.Sy
|
||||
INPUT [;][<"prompt string">;]<list of variables>
|
||||
.PU
|
||||
An INPUT statement can be used to obtain values from the user at the
|
||||
terminal.
|
||||
When an INPUT statement is encountered a question mark is printed
|
||||
to indicate the program is awaiting data.
|
||||
IF <"prompt string"> is included, the string is printed before the
|
||||
the question mark. The question mark is suppressed when the prompt
|
||||
string is followed by a comma, rather then a semicolon.
|
||||
.sp
|
||||
For each variable in the variable a list a value should be supplied.
|
||||
Data items presented should be separated by a comma.
|
||||
.sp
|
||||
The type of the variable in the variable list must aggree with the
|
||||
type of the data item entered. Responding with too few or too many
|
||||
data items causes the message "?Redo". No assignment of input values
|
||||
is made until an acceptable response is given.
|
||||
.RM
|
||||
The option to disgard the carriage return with the semicolon after the
|
||||
input symbol is not yet implemented.
|
||||
.NH 2
|
||||
INPUT [#]
|
||||
.Sy
|
||||
INPUT #<file number>,<list of variables>
|
||||
.PU
|
||||
The purpose of the INPUT# statement is to read data items from a sequential
|
||||
file and assign them to program variables.
|
||||
<file number> is the number used to open the file for input.
|
||||
The variables mentioned are (subscripted) variables.
|
||||
The type of the data items read should aggree with the type of the variables.
|
||||
A type mismatch results in the error message "XXXXX".
|
||||
.sp
|
||||
The data items on the sequential file are separated by commas and newlines.
|
||||
In scanning the file, leading spaces, new lines, tabs, and
|
||||
carriage returns are ignored. The first character encountered
|
||||
is assumed to be the state of a new item.
|
||||
String items need not be enclosed with double quotes, provided
|
||||
it does not contain spaces, tabs, newlines and commas,
|
||||
.RM
|
||||
Microsoft BASIC won't assign values until the end of input statement.
|
||||
This means that the user has to supply all the information.
|
||||
.NH 2
|
||||
LET
|
||||
.Sy
|
||||
[LET]<variable>=<expression>
|
||||
.PU
|
||||
To assign the value of an expression to a (subscribted) variable.
|
||||
The type convertions as dictated in section 1.X apply.
|
||||
.NH 2
|
||||
LINE INPUT
|
||||
.Sy
|
||||
LINE INPUT [;][<"prompt string">;]<string variable>
|
||||
.PU
|
||||
An entire line of input is assigned to the string variable.
|
||||
See INPUT for the meaning of the <"prompt string"> option.
|
||||
.NH 2
|
||||
LINE INPUT [#]
|
||||
.Sy
|
||||
LINE INPUT #<file number>,<string variable>
|
||||
.PU
|
||||
Read an entire line of text from a sequential file <file number>
|
||||
and assign it to a string variable.
|
||||
.NH 2
|
||||
LSET and RSET
|
||||
.PU
|
||||
To be implemented
|
||||
.NH 2
|
||||
MID$
|
||||
.Sy
|
||||
MID$(<string expr1>,n[,m])=<string expr2>
|
||||
.PU
|
||||
To replace a portion of a string with another string value.
|
||||
The characters of <string expr2> replaces characters in <string expr1>
|
||||
starting at position n. If m is present, at most m characters are copied,
|
||||
otherwise all characters are copied.
|
||||
However, the string obtained never exceeds the length of string expr1.
|
||||
.NH 2
|
||||
ON ERROR GOTO
|
||||
.Sy
|
||||
ON ERROR GOTO <line number>
|
||||
.PU
|
||||
To enable error handling within the BASIC program.
|
||||
An error may result from arithmetic errors, disk problems, interrupts, or
|
||||
as a result of the ERROR statement.
|
||||
After printing an error message the program is continued at the
|
||||
statements associated with <line number>.
|
||||
.sp
|
||||
Error handling is disabled using ON ERROR GOTO 0.
|
||||
Subsequent errors result in an error message and program termination.
|
||||
.NH 2
|
||||
ON...GOSUB and ON ...GOTO
|
||||
.Sy
|
||||
ON <expression> GOSUB <list of line numbers>
|
||||
ON <expression> GOTO <list of line numbers>
|
||||
.PU
|
||||
To branch to one of several specified line numbers or subroutines, based
|
||||
on the result of the <expression>. The list of line numbers are considered
|
||||
the first, second, etc alternative. Branching to the first occurs when
|
||||
the expression evaluates to one, to the second alternative on two, etc.
|
||||
If the value of the expression in zero or greater than the number of alternatives, processing continues at the first statement following the ON..GOTO
|
||||
(ON GOSUB) statement.
|
||||
When the expression results in a negative number the
|
||||
an "Illegal function call" error occurs.
|
||||
.NH 2
|
||||
OPEN
|
||||
.NH 2
|
||||
OPTION BASE
|
||||
.Sy
|
||||
OPTION BASE n
|
||||
.PU
|
||||
To declare the lower bound of subsequent array subscripts as either
|
||||
0 or 1. The default lower bound is zero.
|
||||
.NH 2
|
||||
POKE
|
||||
.Sy
|
||||
POKE <expr1>,<expr2>
|
||||
.PU
|
||||
To poke around in memory. The use of this statement is not recommended,
|
||||
because it requires full understanding of both
|
||||
the implementation of the Amsterdam
|
||||
Compiler Kit and the hardware characteristics.
|
||||
.NH 2
|
||||
PRINT [USING]
|
||||
.NH 2
|
||||
PUT
|
||||
.PU
|
||||
To be implemented
|
||||
.NH 2
|
||||
RANDOMIZE
|
||||
.Sy
|
||||
RANDOMIZE [<expression>]
|
||||
.PU
|
||||
To reset the random seed. When the expression is ommitted, the system
|
||||
will ask for a value between -32768 and 32767.
|
||||
The random number generator returns the same sequence of values provided
|
||||
the same seed is used.
|
||||
.NH 2
|
||||
READ
|
||||
.Sy
|
||||
READ <list of variables>
|
||||
.PU
|
||||
To read values from the DATA statements and assign them to variables.
|
||||
The type of the variables should match to the type of the items being read,
|
||||
otherwise a "Syntax error" occurs.
|
||||
.NH 2
|
||||
REM
|
||||
.Sy
|
||||
REM <remark>
|
||||
.PU
|
||||
To include explantory information in a program.
|
||||
The REM statements are not executed.
|
||||
A single quote has the same effect as : REM, which
|
||||
allows for the inclusion of comment at the end of the line.
|
||||
.RM
|
||||
Microsoft BASIC does not allow REM statements as part of
|
||||
DATA lines.
|
||||
.NH 2
|
||||
RESTORE
|
||||
.Sy
|
||||
RESTORE [<line number>]
|
||||
.PU
|
||||
To allow DATA statements to be re-read from a specific line.
|
||||
After a RESTORE statement is executed, the next READ accesses
|
||||
the first item of the DATA statements.
|
||||
If <line number> is specified, the next READ accesses the first
|
||||
item in the specified line.
|
||||
.sp
|
||||
Note that data statements result in a sequential datafile generated
|
||||
by the compiler, being read by the read statements.
|
||||
This data file may be replaced using the operating system functions
|
||||
with a modified version, provided the same layout of items
|
||||
(same number of lines and items per line) is used.
|
||||
.NH 2
|
||||
STOP
|
||||
.Sy
|
||||
STOP
|
||||
.PU
|
||||
To terminate the execution of a program and return to the operating system
|
||||
command interpreter. A STOP statement results in the message "Break in line
|
||||
???"
|
||||
.NH 2
|
||||
SWAP
|
||||
.Sy
|
||||
SWAP <variable>,<variable>
|
||||
.PU
|
||||
To exchange the values of two variables.
|
||||
.NH 2
|
||||
TRON/TROFF
|
||||
.Sy
|
||||
TRON
|
||||
.Sy
|
||||
TROFF
|
||||
.PU
|
||||
As an aid in debugging the TRON statement results in a program
|
||||
listing each line being interpreted. TROFF disables generation of
|
||||
this code.
|
||||
.NH 2
|
||||
WHILE...WEND
|
||||
.Sy
|
||||
WHILE <expression>
|
||||
.....
|
||||
WEND
|
||||
.PU
|
||||
To execute a series of BASIC statements as long as a conditional expression
|
||||
is true. WHILE...WEND loops may be nested.
|
||||
.NH 2
|
||||
WRITE
|
||||
.Sy
|
||||
WRITE [<list of expressions>]
|
||||
.PU
|
||||
To write data at the terminal in DATA statement layout conventions.
|
||||
The expressions should be separated by commas.
|
||||
.NH 2
|
||||
WRITE #
|
||||
.Sy
|
||||
WRITE #<file number> ,<list of expressions>
|
||||
.PU
|
||||
To write a sequential data file, being opened with the "O" mode.
|
||||
The values are being writting using the DATA statements layout conventions.
|
||||
.NH
|
||||
FUNCTIONS
|
||||
.LP
|
||||
.IP ABS(X) 12
|
||||
Returns the absolute value of expression X
|
||||
.IP ASC(X$) 12
|
||||
Returns the numeric value of the first character of the string.
|
||||
If X$ is not initialized an "Illegal function call" error
|
||||
is returned.
|
||||
.IP ATN(X) 12
|
||||
Returns the arctangent of X in radians. Result is in the range
|
||||
of -pi/2 to pi/2.
|
||||
.IP CDBL(X) 12
|
||||
Converts X to a double precision number.
|
||||
.IP CHR$(X) 12
|
||||
Converts the integer value X to its ASCII character.
|
||||
X must be in the range of 0 to 127.
|
||||
It is used for cursor addressing and generating bel signals.
|
||||
.IP CINT(X) 12
|
||||
Converts X to an integer by rounding the fractional portion.
|
||||
If X is not in the range -32768 to 32767 an "Overflow"
|
||||
error occurs.
|
||||
.IP COS(X) 12
|
||||
Returns the cosine of X in radians.
|
||||
.IP CSNG(X) 12
|
||||
Converts X to a double precision number.
|
||||
.IP CVI(<2-bytes>) 12
|
||||
Convert two byte string value to integer number.
|
||||
.IP CVS(<4-bytes>) 12
|
||||
Convert four byte string value to single precision number.
|
||||
.IP CVD(<8-bytes>) 12
|
||||
Convert eight byte string value to double precision number.
|
||||
.IP EOF[(<file-number>)] 12
|
||||
Returns -1 (true) if the end of a sequential file has been reached.
|
||||
.IP EXP(X) 12
|
||||
Returns e(base of natural logarithm) to the power of X.
|
||||
X should be less then 10000.0.
|
||||
.IP FIX(X) 12
|
||||
Returns the truncated integer part of X. FIX(X) is
|
||||
equivalent to SGN(X)*INT(ABS(X)).
|
||||
The major difference between FIX and INT is that FIX does not
|
||||
return the next lower number for negative X.
|
||||
.IP HEX$(X) 12
|
||||
Returns the string which represents the hexadecimal value of
|
||||
the decimal argument. X is rounded to an integer using CINT
|
||||
before HEX$ is evaluated.
|
||||
.IP INT(X) 12
|
||||
Returns the largest integer <= X.
|
||||
.IP INPUT$(X[,[#]Y]) 12
|
||||
Returns the string of X characters read from the terminal or
|
||||
the designated file.
|
||||
.IP LEX(X$) 12
|
||||
Returns the number of characters in the string X$.
|
||||
Non printable and blancs are counted too.
|
||||
.IP LOC(<file\ number>) 12
|
||||
For sequential files LOC returns
|
||||
position of the read/write head, counted in number of bytes.
|
||||
For random files the function returns the record number just
|
||||
read or written from a GET or PUT statement.
|
||||
If nothing was read or written 0 is returned.
|
||||
.IP LOG(X) 12
|
||||
Returns the natural logarithm of X. X must be greater than zero.
|
||||
.IP MID$(X,I,[J]) 12
|
||||
To be implemented.
|
||||
.IP MKI$(X) 12
|
||||
Converts an integer expression to a two-byte string.
|
||||
.IP MKS$(X) 12
|
||||
Converts a single precision expression to a four-byte string.
|
||||
.IP MKD$(X) 12
|
||||
Converts a double precision expression to a eight-byte string.
|
||||
.IP OCT$(X) 12
|
||||
Returns the string which represents the octal value of the decimal
|
||||
argument. X is rounded to an integer using CINT before OCTS is evaluated.
|
||||
.IP PEEK(I) 12
|
||||
Returns the byte read from the indicated memory. (Of limited use
|
||||
in the context of ACK)
|
||||
.IP POS(I) 12
|
||||
Returns the current cursor position. To be implemented.
|
||||
.IP RIGHT$(X$,I)
|
||||
Returns the right most I characters of string X$.
|
||||
If I=0 then the empty string is returned.
|
||||
.IP RND(X) 12
|
||||
Returns a random number between 0 and 1. X is a dummy argument.
|
||||
.IP SGN(X) 12
|
||||
If X>0 , SGN(X) returns 1.
|
||||
.br
|
||||
if X=0, SGN(X) returns 0.
|
||||
.br
|
||||
if X<0, SGN(X) returns -1.
|
||||
.IP SIN(X) 12
|
||||
Returns the sine of X in radians.
|
||||
.IP SPACE$(X) 12
|
||||
Returns a string of spaces length X. The expression
|
||||
X is rounded to an integer using CINT.
|
||||
.IP STR$(X)
|
||||
Returns the string representation value of X.
|
||||
.IP STRING$(I,J) 12
|
||||
Returns thes string of length Iwhose characters all
|
||||
have ASCII code J. (or first character when J is a string)
|
||||
.IP TAB(I) 12
|
||||
Spaces to position I on the terminal. If the current
|
||||
print position is already beyond space I,TAB
|
||||
goes to that position on the next line.
|
||||
Space 1 is leftmost position, and the rightmost position
|
||||
is width minus 1. To be used within PRINT statements only.
|
||||
.IP TAN(X) 12
|
||||
Returns the tangent of X in radians. If TAN overflows
|
||||
the "Overflow" message is displayed.
|
||||
.IP VAL(X$) 12
|
||||
Returns the numerical value of string X$.
|
||||
The VAL function strips leading blanks and tabs from the
|
||||
argument string.
|
||||
.SH
|
||||
APPENDIX A DIFFERENCES WITH MICROSOFT BASIC
|
||||
.LP
|
||||
The following list of Microsoft commands and statements are
|
||||
not recognized by the compiler.
|
||||
.DS
|
||||
SPC
|
||||
USR
|
||||
VARPTR
|
||||
AUTO
|
||||
CHAIN
|
||||
CLEAR
|
||||
CLOAD
|
||||
COMMON
|
||||
CONT
|
||||
CSAVE
|
||||
DELETE
|
||||
EDIT
|
||||
ERASE
|
||||
FRE
|
||||
KILL
|
||||
LIST
|
||||
LLIST
|
||||
LOAD
|
||||
LPRINT
|
||||
MERGE
|
||||
NAME
|
||||
NEW
|
||||
NULL
|
||||
RENUM
|
||||
RESUME
|
||||
RUN
|
||||
SAVE
|
||||
WAIT
|
||||
WIDTH LPRINT
|
||||
.DE
|
||||
Some statements are in the current implementation not available,
|
||||
but will be soon. These include:
|
||||
.DS
|
||||
CALL
|
||||
DEFUSR
|
||||
FIELD
|
||||
GET
|
||||
INKEY
|
||||
INPUT$
|
||||
INSTR$
|
||||
LEFT$
|
||||
LSET
|
||||
RSET
|
||||
PUT
|
||||
.DE
|
||||
20
doc/cg.doc
20
doc/cg.doc
@@ -1,3 +1,4 @@
|
||||
.\" $Header$
|
||||
.RP
|
||||
.TL
|
||||
The table driven code generator from
|
||||
@@ -1039,6 +1040,17 @@ Argument to be formatted will be 'full'.
|
||||
.IP off_fmt
|
||||
Format to be used for integer part of label+constant,
|
||||
argument will be 'full'.
|
||||
.IP fmt_ilb(ip,il,s)
|
||||
Must use the numbers
|
||||
.I ip
|
||||
and
|
||||
.I il
|
||||
which are a procedure number
|
||||
and a label number respectively and copy a string to
|
||||
.I s
|
||||
that must be unique for that combination.
|
||||
This procedure is optional, if it is not given ilb_fmt
|
||||
must be defined as below.
|
||||
.IP ilb_fmt
|
||||
Format to be used for creation of unique instruction labels.
|
||||
Arguments will be a unique procedure number (int) and the label
|
||||
@@ -1069,6 +1081,14 @@ into the datastream.
|
||||
.IP con_dlb(s)
|
||||
Must generate output that will put the address of the data label
|
||||
into the datastream.
|
||||
.IP fmt_id(sf,st)
|
||||
Must take the string in
|
||||
.I sf
|
||||
which is a nonnumeric global label, and transform it into a copy made to
|
||||
.I st
|
||||
which will not collide with reserved assembler words and system labels.
|
||||
This procedure is optional, if it is not given the id_first macro is used
|
||||
as defined below.
|
||||
.IP id_first
|
||||
Must be a character.
|
||||
This is prepended to all nonnumeric global labels if their length
|
||||
|
||||
63
doc/cref.doc
63
doc/cref.doc
@@ -1,3 +1,4 @@
|
||||
.\" $Header$
|
||||
.ll 72
|
||||
.nr ID 4
|
||||
.de hd
|
||||
@@ -132,6 +133,8 @@ properties of the Ack-C frontend.
|
||||
.IT "2.2 Identifiers"
|
||||
External identifiers are unique up to 7 characters and allow
|
||||
both upper and lower case.
|
||||
.IT "2.3 Keywords"
|
||||
The word \fBvoid\fP is also reserved as a keyword.
|
||||
.IT "2.4.3 Character constants"
|
||||
The ASCII-mapping is used when a character is converted to an
|
||||
integer.
|
||||
@@ -139,11 +142,12 @@ integer.
|
||||
To prevent loss of precision the compiler does not perform
|
||||
floating point constant folding.
|
||||
.IT "2.6 Hardware characteristics"
|
||||
The size of objects of the several arithmetic types and the two
|
||||
pointer types depend on the EM-implementation used.
|
||||
The size of objects of the several arithmetic types and
|
||||
pointers depend on the EM-implementation used.
|
||||
The ranges of the arithmetic types depend on the size used,
|
||||
the C-frontend assumes two's complement representation for the
|
||||
integral types. All sizes are multiples of bytes.
|
||||
integral types.
|
||||
All sizes are multiples of bytes.
|
||||
The calling program \fIack\fP[4] passes information about the
|
||||
size of the types to the compiler proper.
|
||||
.br
|
||||
@@ -151,32 +155,27 @@ However, a few general remarks must be made:
|
||||
.sp 1
|
||||
.IS
|
||||
.PT (a)
|
||||
Two different pointer types exist: pointers to data and
|
||||
pointers to functions.
|
||||
The latter type is twice as large as the former.
|
||||
Pointers to functions use the same format as Pascal procedure
|
||||
parameters, thereby allowing C to use Pascal procedure
|
||||
parameters and vice-versa.
|
||||
The extra information passed indicates the scope level of the
|
||||
procedure.
|
||||
.PT (b)
|
||||
The size of pointers to data is a multiple of
|
||||
The size of pointers is a multiple of
|
||||
(or equal to) the size of an \fIint\fP.
|
||||
.PT (c)
|
||||
.PT (b)
|
||||
The following relations exist for the sizes of the types
|
||||
mentioned:
|
||||
.br
|
||||
.ti +5
|
||||
\fIchar<=short<=int<=long\fP
|
||||
.PT (d)
|
||||
.PT (c)
|
||||
Objects of type \fIchar\fP use one 8-bit byte of storage,
|
||||
although several bytes are allocated sometimes.
|
||||
.PT (e)
|
||||
.PT (d)
|
||||
All sizes are in multiples of bytes.
|
||||
.PT (f)
|
||||
.PT (e)
|
||||
Most EM implementations use 4 bytes for floats and 8 bytes
|
||||
for doubles, but exceptions to this rule occur.
|
||||
.IE
|
||||
.IT "4 What's in a name"
|
||||
The type \fIvoid\fP is added.
|
||||
Objects of type void do not exist.
|
||||
Functions declared as returning void, do not return a value at all.
|
||||
.IT "6.1 Characters and integers"
|
||||
Objects of type \fIchar\fP are unsigned and do not cause
|
||||
sign-extension when converted to \fIint\fP.
|
||||
@@ -186,8 +185,16 @@ Floating point numbers are truncated towards zero when
|
||||
converted to the integral types.
|
||||
.IT "6.4 Pointers and integers"
|
||||
When a \fIlong\fP is added to or subtracted from a pointer and
|
||||
longs are larger then data pointers the \fIlong\fP is converted to an
|
||||
longs are larger then pointers the \fIlong\fP is converted to an
|
||||
\fIint\fP before the operation is performed.
|
||||
.IT "7.2 Unary operators"
|
||||
It is allowed to cast any expression to the type \fIvoid\fP.
|
||||
.IT "8.2 Type specifiers"
|
||||
One type is added to the type-specifiers:
|
||||
.br
|
||||
.IS
|
||||
void
|
||||
.IE
|
||||
.IT "8.5 Structure and union declarations"
|
||||
The only type allowed for fields is \fIint\fP.
|
||||
Fields with exactly the size of \fIint\fP are signed,
|
||||
@@ -199,8 +206,15 @@ Initialization of structures containing bit fields is not
|
||||
allowed.
|
||||
There is one restriction when using an 'address expression' to initialize
|
||||
an integral variable.
|
||||
The integral variable must have the size of a data pointer.
|
||||
The integral variable must have the same size as a pointer.
|
||||
Conversions altering the size of the address expression are not allowed.
|
||||
.IT "9.10 Return statement"
|
||||
Return statements of the form:
|
||||
.IS
|
||||
return ;
|
||||
.IE
|
||||
are the only form of return statement allowed in a function of type
|
||||
function returning void.
|
||||
.IT "10.1 External function definitions"
|
||||
The total amount for storage used for parameters
|
||||
in any function must be less then 4096 bytes.
|
||||
@@ -226,15 +240,8 @@ int and back will not always result in the same pointer.
|
||||
The process mentioned above works with integrals
|
||||
of the same size or larger as pointers in all EM implementations
|
||||
having such integrals.
|
||||
Note that pointers to functions have
|
||||
twice the size of pointers to data.
|
||||
When converting data pointers to an integral type or vice-versa,
|
||||
the pointers is seen as an unsigned with the same size a data-pointer.
|
||||
When converting function pointers to anything else the static link part
|
||||
of the pointer is discarded,
|
||||
the resulting value is treated as if it were a data pointer.
|
||||
When converting a data pointer or object of integral type to a function pointer
|
||||
a static link with the value 0 is added to complete the function pointer.
|
||||
When converting pointers to an integral type or vice-versa,
|
||||
the pointers is seen as an unsigned int.
|
||||
.br
|
||||
EM guarantees that any object can be placed at a word boundary,
|
||||
this allows the C-programs to use \fIint\fP pointers
|
||||
|
||||
@@ -7,6 +7,9 @@ IOP=../../util/ass/ip_spec.t
|
||||
doc.pr: $(FILES) itables em.i
|
||||
tbl $(FILES) | $(NROFF) >doc.pr
|
||||
|
||||
distr: $(FILES) itables em.i
|
||||
tbl $(FILES) | nroff -Tlp >doc.pr
|
||||
|
||||
opr: doc.pr
|
||||
make pr | opr
|
||||
|
||||
|
||||
@@ -133,9 +133,9 @@ can be followed by a letter I, U or F.
|
||||
This indicator
|
||||
specifies the type of the initializer: Integer, Unsigned or Float.
|
||||
If no indicator is present I is assumed.
|
||||
The size of the object is the wordsize unless
|
||||
The size of the initializer is the wordsize unless
|
||||
the indicator is followed by an integer specifying the
|
||||
object's size.
|
||||
initializer's size.
|
||||
This integer is governed by the same restrictions as for
|
||||
transfer of objects to/from memory.
|
||||
As in instruction arguments, initializers include expressions of the form:
|
||||
@@ -145,8 +145,9 @@ The 'IUF' indicators cannot be used in the offsets.
|
||||
.P
|
||||
Data labels are referred to by their name.
|
||||
.P
|
||||
|
||||
Strings are surrounded by double quotes (").
|
||||
Semecolon's in string do not indicate the start of comment.
|
||||
Semicolon's in string do not indicate the start of comment.
|
||||
In the ASCII representation the escape character \e (backslash)
|
||||
alters the meaning of subsequent character(s).
|
||||
This feature allows inclusion of zeroes, graphic characters and
|
||||
@@ -175,7 +176,6 @@ the backslash is ignored.
|
||||
Example: CON "hello\e012\e0".
|
||||
Each string element initializes a single byte.
|
||||
The ASCII character set is used to map characters onto values.
|
||||
Strings are padded with zeroes up to a multiple of the wordsize.
|
||||
.P
|
||||
Instruction labels are referred to as *1, *2, etc. in both branch
|
||||
instructions and as initializers.
|
||||
@@ -209,6 +209,10 @@ l l l.
|
||||
.S4 Storage declaration
|
||||
Initialized global data is allocated by the pseudoinstruction CON,
|
||||
which needs at least one argument.
|
||||
Each argument is used to allocate and initialize a number of
|
||||
consequtive bytes in data memory.
|
||||
The number of bytes to be allocated and the alignment depend on the type
|
||||
of the argument.
|
||||
For each argument, an integral number of words,
|
||||
determined by the argument type, is allocated and initialized.
|
||||
.P
|
||||
@@ -245,8 +249,10 @@ It is not allowed to have more than one HOL block per procedure.
|
||||
.P
|
||||
The alignment restrictions are enforced by the
|
||||
pseudoinstructions.
|
||||
All objects are aligned on a multiple of their size or the wordsize
|
||||
All initializers are aligned on a multiple of their size or the wordsize
|
||||
whichever is smaller.
|
||||
Strings form an exception, they are to be seen as a sequence of initializers
|
||||
each for one byte, i.e. strings are not padded with zero bytes.
|
||||
Switching to another type of fragment or placing a label forces
|
||||
word-alignment.
|
||||
There are three types of fragments in global data space: CON, ROM and
|
||||
@@ -382,6 +388,17 @@ May not be preceded by any other pseudo, except MES's.
|
||||
.PT "MES 9,<cst>"
|
||||
Guarantees that no more than <cst> bytes of parameters are
|
||||
accessed, either directly or indirectly.
|
||||
.PT "MES 10,<cst>[,<par>]*
|
||||
This message number is reserved for the global optimizer.
|
||||
It inserts these messages in its output as hints to backends.
|
||||
<cst> indicates the type of hint.
|
||||
.PT "MES 11"
|
||||
Procedures containing this message are possible destinations of
|
||||
non-local goto's with the GTO instruction.
|
||||
Some backends keep locals in registers,
|
||||
the locals in this procedure should not be kept in registers and
|
||||
all registers containing locals of other procedures should be
|
||||
saved upon entry to this procedure.
|
||||
.PE 1
|
||||
.VS 1 1
|
||||
Each backend is free to skip irrelevant MES pseudos.
|
||||
@@ -555,7 +572,7 @@ l l 15 l l.
|
||||
\&\*n:cst:>= 0:counter
|
||||
\&\*s:cst:>0 , word multiple:object size
|
||||
\&\*z:cst:>= 0 , zero or word multiple:object size
|
||||
\&\*o:cst:>= 0 , word multiple or fraction:object size
|
||||
\&\*o:cst:> 0 , word multiple or fraction:object size
|
||||
\&\*w:cst:> 0 , word multiple:object size *
|
||||
\&\*p:pro::pro identifier
|
||||
\&\*b:ilb:>= 0:label number
|
||||
|
||||
@@ -114,8 +114,7 @@ then fetch the new PC from the list of instruction pointers by indexing with
|
||||
index-lower.
|
||||
The table does not contain the value of the upper bound,
|
||||
but the value of upper-lower as an unsigned integer.
|
||||
If the index is out of bounds or if the fetched pointer is 0,
|
||||
then fetch the default instruction pointer.
|
||||
The default instruction pointer is used when the index is out of bounds.
|
||||
If the resulting PC is 0, then trap.
|
||||
.P
|
||||
CSB selects the new PC by searching.
|
||||
|
||||
@@ -240,7 +240,7 @@ begin if (a<0) or (a>maxoffs)
|
||||
end;
|
||||
|
||||
function argo(a:double):size;
|
||||
begin if (a<0) or (a>maxoffs)
|
||||
begin if (a<=0) or (a>maxoffs)
|
||||
then trap(EODDZ)
|
||||
else if (a mod wsize<>0) and (wsize mod a<>0) then trap(EODDZ);
|
||||
argo:=a ;
|
||||
@@ -1504,10 +1504,9 @@ begin
|
||||
end;
|
||||
CSA: begin k:=argw(k); if k<>wsize then trap(EILLINS);
|
||||
a:=popa;
|
||||
st:= popsw - signwd(memw(a+asize)); b:=0;
|
||||
st:= popsw - signwd(memw(a+asize));
|
||||
if (st>=0) and (st<=memw(a+wsize+asize)) then
|
||||
b:=mema(a+2*wsize+asize+asize*st);
|
||||
if b=0 then b:=mema(a);
|
||||
b:=mema(a+2*wsize+asize+asize*st) else b:=mema(a);
|
||||
if b=0 then trap(ECASE) else newpc(b)
|
||||
end;
|
||||
CSB: begin k:=argw(k); if k<>wsize then trap(EILLINS); a:=popa;
|
||||
|
||||
@@ -281,7 +281,7 @@ begin if (a<0) or (a>maxoffs)
|
||||
end;
|
||||
|
||||
function argo(a:double):size;
|
||||
begin if (a<0) or (a>maxoffs)
|
||||
begin if (a<=0) or (a>maxoffs)
|
||||
then trap(EODDZ)
|
||||
else if (a mod wsize<>0) and (wsize mod a<>0) then trap(EODDZ);
|
||||
argo:=a ;
|
||||
@@ -683,7 +683,7 @@ begin
|
||||
a:=argp(uerrorproc);
|
||||
uerrorproc:=0; { reset signal }
|
||||
call(a); { call the routine }
|
||||
intrap:=false; { Don't catch recursive traps anymore }
|
||||
intrap:=false; { Do not catch recursive traps anymore }
|
||||
goto 8888; { reenter main loop }
|
||||
end;
|
||||
|
||||
@@ -1149,7 +1149,7 @@ end;
|
||||
jmp (r2) /done
|
||||
|
||||
The important thing to notice is where and how the operand fetch occurred:
|
||||
lol2, lol4, and lol6, (the mini's) have implicit operands
|
||||
lol2, lol4, and lol6, (the minis) have implicit operands
|
||||
lolb knew it had to fetch one byte, and did so without any table lookup
|
||||
lolw knew it had to fetch a word, and did so, high order byte first }
|
||||
{
|
||||
@@ -1604,10 +1604,9 @@ begin
|
||||
end;
|
||||
CSA: begin k:=argw(k); if k<>wsize then trap(EILLINS);
|
||||
a:=popa;
|
||||
st:= popsw - signwd(memw(a+asize)); b:=0;
|
||||
st:= popsw - signwd(memw(a+asize));
|
||||
if (st>=0) and (st<=memw(a+wsize+asize)) then
|
||||
b:=mema(a+2*wsize+asize+asize*st);
|
||||
if b=0 then b:=mema(a);
|
||||
b:=mema(a+2*wsize+asize+asize*st) else b:=mema(a);
|
||||
if b=0 then trap(ECASE) else newpc(b)
|
||||
end;
|
||||
CSB: begin k:=argw(k); if k<>wsize then trap(EILLINS); a:=popa;
|
||||
|
||||
@@ -45,6 +45,7 @@ the trapping instruction (see next chapter).
|
||||
the GTO instruction, which is used for non-local goto's.
|
||||
It can remove several frames from the stack and transfer
|
||||
control to an active procedure.
|
||||
(see also MES~11 in paragraph 11.1.4.4)
|
||||
.PE
|
||||
.IE
|
||||
.P
|
||||
|
||||
830
doc/i80.doc
Normal file
830
doc/i80.doc
Normal file
@@ -0,0 +1,830 @@
|
||||
." $Header$
|
||||
.RP
|
||||
.TL
|
||||
Back end table for the Intel 8080 micro-processor
|
||||
.AU
|
||||
Gerard Buskermolen
|
||||
.AB
|
||||
A back end is a part of the Amsterdam Compiler Kit (ACK).
|
||||
It translates EM, a family of intermediate languages, into the
|
||||
assembly language of some target machine, here the Intel 8080 and Intel 8085 microprocessors.
|
||||
.AE
|
||||
.NH1
|
||||
INTRODUCTION
|
||||
.PP
|
||||
To simplify the task of producing portable (cross) compilers and
|
||||
interpreters, the Vrije Universiteit designed an integrated collection
|
||||
of programs, the Amsterdam Compiler Kit (ACK).
|
||||
It is based on the old UNCOL-idea ([4]) which attempts to solve the problem
|
||||
of making a compiler for each of
|
||||
.B N
|
||||
languages on
|
||||
.B M
|
||||
different machines without having to write
|
||||
.B N\ *\ M
|
||||
programs.
|
||||
.sp 1
|
||||
The UNCOL approach is to write
|
||||
.B N
|
||||
"front ends", each of which translates one source language into
|
||||
a common intermediate language, UNCOL (UNiversal Computer Oriented
|
||||
Language), and
|
||||
.B M
|
||||
"back ends", each of which translates programs in UNCOL into a
|
||||
specific machine language.
|
||||
Under these conditions, only
|
||||
.B N\ +\ M
|
||||
programs should be written to provide all
|
||||
.B N
|
||||
languages on all
|
||||
.B M
|
||||
machines, instead of
|
||||
.B N\ *\ M
|
||||
programs.
|
||||
.sp 1
|
||||
The intermediate language for the Amsterdam Compiler Kit is the machine
|
||||
language for a simple stack machine called EM (Encoding Machine).
|
||||
So a back end for the Intel 8080 micro translates EM code into
|
||||
8080 assembly language.
|
||||
.sp 1
|
||||
The back end is a single program that is driven by a machine dependent
|
||||
driving table.
|
||||
This driving table, or back end table,
|
||||
defines the mapping from EM code to the machine's assembly language.
|
||||
.NH 1
|
||||
THE 8080 MICRO PROCESSOR
|
||||
.PP
|
||||
This back end table can be used without modification for the Intel 8085
|
||||
processor.
|
||||
Except for two additional instructions, the 8085 instruction set
|
||||
is identical and fully compatible with the 8080 instruction set.
|
||||
So everywhere in this document '8080' can be read as '8080 and 8085'.
|
||||
.NH 2
|
||||
Registers
|
||||
.PP
|
||||
The 8080 processor has an 8 bit accumulator,
|
||||
six general purpose 8-bit registers,
|
||||
a 16 bit programcounter and a 16 bit stackpointer.
|
||||
Assembler programs can refer the accumulator by A and
|
||||
the general purpose registers by B, C, D, E, H and L. (*)
|
||||
.FS
|
||||
* In this document 8080 registers and mnemonics are referenced by capitals, for the sake of clarity.
|
||||
Nevertheless the assembler expects small letters.
|
||||
.FE
|
||||
Several instructions address registers in groups of two, thus creating
|
||||
16 bit registers:
|
||||
.DS
|
||||
Registers referenced: Symbolic reference:
|
||||
B and C B
|
||||
D and E D
|
||||
H and L H
|
||||
.DE
|
||||
The first named register, contains the high order byte
|
||||
(H and L stand for High and Low).
|
||||
.br
|
||||
The instruction determines how the processor interprets the reference.
|
||||
For example, ADD B is an 8 bit operation, adding the contents of
|
||||
register B to accumulator A. By contrast PUSH B is a 16 bit operation
|
||||
pushing B and C onto the stack.
|
||||
.sp 1
|
||||
There are no index registers.
|
||||
.sp 1
|
||||
.NH 2
|
||||
Flip-flops
|
||||
.PP
|
||||
The 8080 microprocessor provides five flip-flops used as condition flags
|
||||
(S, Z, P, C, AC) and one interrupt enable flip-flop IE.
|
||||
.br
|
||||
The sign bit S is set (cleared) by certain instructions when the most significant
|
||||
bit of the result of an operation equals one (zero).
|
||||
.br
|
||||
The zero bit Z is set (cleared) by certain operations when the
|
||||
8-bit result of an operation equals (does not equal) zero.
|
||||
.br
|
||||
The parity bit P is set (cleared) if the 8-bit result of an
|
||||
operation includes an even (odd) number of ones.
|
||||
.br
|
||||
C is the normal carry bit.
|
||||
.br
|
||||
AC is an auxiliary carry that indicates whether there has been a carry
|
||||
out of bit 3 of the accumulator.
|
||||
This auxiliary carry is used only by the DAA instruction, which
|
||||
adjusts the 8-bit value in the accumulator to form two 4-bit
|
||||
binary coded decimal digits.
|
||||
Needless to say this instruction is not used in the back-end.
|
||||
.sp 1
|
||||
The interrupt enable flip-flop IE is set and cleared under
|
||||
program control using the instructions EI (Enable Interrupt) and
|
||||
DI (Disable Interrupt).
|
||||
It is automatically cleared when the CPU is reset and when
|
||||
an interrupt occurs, disabling further interrupts until IE = 1 again.
|
||||
.NH 2
|
||||
Addressing modes
|
||||
.NH 3
|
||||
Implied addressing
|
||||
.PP
|
||||
The addressing mode of some instructions is implied by the instruction itself.
|
||||
For example, the RAL (rotate accumulator left) instruction deals only with
|
||||
the accumulator, and PCHL loads the programcounter with the contents
|
||||
of register-pair HL.
|
||||
.NH 3
|
||||
Register addressing
|
||||
.PP
|
||||
|
||||
With each intruction using register addressing,
|
||||
only one register is specified (except for the MOV instruction),
|
||||
although in many of them the accumulator is implied as
|
||||
second operand.
|
||||
Examples are CMP E, which compares register E with the accumulator,
|
||||
and DCR B, which decrements register B.
|
||||
.br
|
||||
A few instructions deal with 16 bit register-pairs:
|
||||
examples are DCX B, which decrements register-pair BC and the
|
||||
PUSH and POP instructions.
|
||||
.NH 3
|
||||
Register indirect addressing
|
||||
.PP
|
||||
Each instruction that may refer to an 8 bit register, may
|
||||
refer also to a memory location. In this case the letter M
|
||||
(for Memory) has to be used instead of a register.
|
||||
It indicates the memory location pointed to by H and L,
|
||||
so ADD M adds the contents of the memory location specified
|
||||
by H and L to the contents of the accumulator.
|
||||
.br
|
||||
The register-pairs BC and DE can also be used for indirect addressing,
|
||||
but only to load or store the accumulator.
|
||||
For example, STAX B stores the contents of the accumulator
|
||||
into the memory location addressed by register-pair BC.
|
||||
.NH 3
|
||||
Immediate addressing
|
||||
.PP
|
||||
The immediate value can be an 8 bit value, as in ADI 10 which
|
||||
adds 10 to the accumulator, or a 16 bit value, as in
|
||||
LXI H,1000, which loads 1000 in the register-pair HL.
|
||||
.NH 3
|
||||
Direct addressing
|
||||
.PP
|
||||
Jump instructions include a 16 bit address as part of the instruction.
|
||||
.br
|
||||
The instruction SHLD 1234 stores the contents of register
|
||||
pair HL on memory locations 1234 and 1235.
|
||||
The high order byte is stored at the highest address.
|
||||
.NH 1
|
||||
THE 8080 BACK END TABLE
|
||||
.PP
|
||||
The back end table is designed as described in [5].
|
||||
So for an overall design of a back end table I refer to this document.
|
||||
.br
|
||||
This section deals with problems encountered in writing the
|
||||
8080 back-end table.
|
||||
Some remarks are made about particular parts
|
||||
of the table that might not seem clear at first sight.
|
||||
.NH 2
|
||||
Constant definitions
|
||||
.PP
|
||||
Word size (EM_WSIZE) and pointer size (EM_PSIZE) are both
|
||||
defined as two bytes.
|
||||
The hole between AB and LB (EM_BSIZE) is four bytes: only the
|
||||
return address and the localbase are saved.
|
||||
.NH 2
|
||||
Registers and their properties
|
||||
.PP
|
||||
All properties have the default size of two bytes, because one-byte
|
||||
registers also cover two bytes when put on the real stack.
|
||||
.sp 1
|
||||
The next considerations led to the choise of register-pair BC
|
||||
as localbase.
|
||||
Though saving the localbase in memory would leave one more register-pair
|
||||
available as scratch register, it would slow down instructions
|
||||
as 'lol' and 'stl' too much.
|
||||
So a register-pair should be sacrificed as localbase.
|
||||
Because a back-end without a free register-pair HL is completely
|
||||
broken-winged, the only reasonable choises are BC and DE.
|
||||
Though the choise between them might seem arbitrary at first sight,
|
||||
there is a difference between register-pairs BC and DE:
|
||||
the instruction XCHG exchanges the contents of register-pairs DE and
|
||||
HL.
|
||||
When DE and HL are both heavily used on the fake-stack, this instruction
|
||||
is very usefull.
|
||||
Since it won't be usefull too often to exchange HL with the localbase
|
||||
and since an instruction exchanging BC and HL does not exist, BC is
|
||||
chosen as localbase.
|
||||
.sp 1
|
||||
Many of the register properties are never mentioned in the
|
||||
PATTERNS part of the table.
|
||||
They are only needed to define the INSTRUCTIONS correctly.
|
||||
.sp 1
|
||||
The properties really used in the PATTERNS part are:
|
||||
.IP areg: 24
|
||||
the accumulator only
|
||||
.IP reg:
|
||||
any of the registers A, D, E, H or L. Of course the registers B and C which are
|
||||
used as localbase don't possess this property.
|
||||
When there is a single register on the fake-stack, its value
|
||||
is always considered non-negative.
|
||||
.IP dereg:
|
||||
register-pair DE only
|
||||
.IP hlreg:
|
||||
register-pair HL only
|
||||
.IP hl_or_de:
|
||||
register-pairs HL and DE both have this property
|
||||
.IP localbase:
|
||||
used only once (i.e. in the EM-instruction 'str 0')
|
||||
.PP
|
||||
.sp 1
|
||||
The stackpointer SP and the processor status word PSW have to be
|
||||
defined explicitely because they are needed in some instructions
|
||||
(i.e. SP in LXI, DCX and INX and PSW in PUSH and POP).
|
||||
.br
|
||||
It doesn't matter that the processor status word is not just register A
|
||||
but includes the condition flags.
|
||||
.NH 2
|
||||
Tokens
|
||||
.PP
|
||||
The tokens 'm' and 'const1' are used in the INSTRUCTIONS- and MOVES parts only.
|
||||
They will never be on the fake-stack.
|
||||
.sp 1
|
||||
The token 'label' reflects addresses known at assembly time.
|
||||
It is used to take full profit of the instructions LHLD
|
||||
(Load HL Direct) and SHLD (Store HL Direct).
|
||||
.sp 1
|
||||
Compared with many other back-end tables, there are only a small number of
|
||||
different tokens (four).
|
||||
Reasons are the limited addressing modes of the 8080 microprocessor,
|
||||
no index registers etc.
|
||||
.br
|
||||
For example to translate the EM-instruction
|
||||
.DS
|
||||
lol 10
|
||||
.DE
|
||||
the next 8080 instructions are generated:
|
||||
.DS L
|
||||
LXI H,10 /* load registers pair HL with value 10 */
|
||||
DAD B /* add localbase (BC) to HL */
|
||||
MOV E,M /* load E with byte pointed to by HL */
|
||||
INX H /* increment HL */
|
||||
MOV D,M /* load D with next byte */
|
||||
.DE
|
||||
Of course, instead of emitting code immmediately, it could be postponed
|
||||
by placing something like a {LOCAL,10} on the fake-stack, but some day the above
|
||||
mentioned code will have to be generated, so a LOCAL-token is
|
||||
hardly usefull.
|
||||
.br
|
||||
See also the comment on the load instructions.
|
||||
.NH 2
|
||||
Sets
|
||||
.PP
|
||||
Only 'src1or2' is used in the PATTERNS.
|
||||
.NH 2
|
||||
Instructions
|
||||
.PP
|
||||
Each instruction indicates whether or not the condition flags
|
||||
are affected, but this information will never have any influence
|
||||
because there are no tests in the PATTERNS part of the table.
|
||||
.sp 1
|
||||
For each instruction a cost vector indicates the number of bytes
|
||||
the instruction occupies and the number of time periods it takes
|
||||
to execute the instruction.
|
||||
The length of a time period depends on the clock frequency
|
||||
and may range from 480 nanoseconds to 2 microseconds on a
|
||||
8080 system and from 320 nanoseconds to 2 microseconds
|
||||
on a 8085 system.
|
||||
.sp 1
|
||||
In the TOKENS-part the cost of token 'm' is defined as (0,3).
|
||||
In fact it usually takes 3 extra time periods when this register indirect mode
|
||||
is used instead of register mode, but since the costs are not completely
|
||||
orthogonal this results in small deficiencies for the DCR, INR and MOV
|
||||
instructions.
|
||||
Although it is not particularly usefull these deficiencies are
|
||||
corrected in the INSTRUCTIONS part, by treating the register indirect
|
||||
mode seperately.
|
||||
.sp 1
|
||||
The costs of the conditional call and return instructions really
|
||||
depend on whether or not the call resp. return is actually made.
|
||||
Unimportant.
|
||||
.sp 1
|
||||
Instructions not used in this table have been commented out.
|
||||
Of course many of them are used in the library routines.
|
||||
.NH 2
|
||||
Moves
|
||||
.PP
|
||||
This section is supposed to be straight-forward.
|
||||
.NH 2
|
||||
Tests
|
||||
.PP
|
||||
The TESTS section is only included to refrain
|
||||
.B cgg
|
||||
from complaining.
|
||||
.NH 2
|
||||
Stackingrules
|
||||
.PP
|
||||
When, for example, the token {const2,10} has to be stacked while
|
||||
no free register-pair is available, the next code is generated:
|
||||
.DS
|
||||
PUSH H
|
||||
LXI H,10
|
||||
XTHL
|
||||
.DE
|
||||
The last instruction exchanges the contents of HL with the value
|
||||
on top of the stack, giving HL its original value again.
|
||||
.NH 2
|
||||
Coercions
|
||||
.PP
|
||||
The coercion to unstack register A, is somewhat tricky,
|
||||
but unfortunately just popping PSW leaves the high-order byte in
|
||||
the accumulator.
|
||||
.sp 1
|
||||
The cheapest way to coerce HL to DE (or DE to HL) is by using
|
||||
the XCHG instruction, but it is not possible to explain
|
||||
.B cgg
|
||||
this instruction in fact exchanges the contents of these
|
||||
register-pairs.
|
||||
Before the coercion is carried out other appearances of DE and HL
|
||||
on the fake-stack will be moved to the real stack, because in
|
||||
the INSTRUCTION-part is told that XCHG destroyes the contents
|
||||
of both DE and HL.
|
||||
.br
|
||||
The coercion transposing one register-pair to another one by
|
||||
emitting two MOV-instructions, will be used only if
|
||||
one of the register-pairs is the localbase.
|
||||
.NH 2
|
||||
Patterns
|
||||
.PP
|
||||
As a general habit I have allocated (uses ...) all registers
|
||||
that should be free to generate the code, although it is not
|
||||
always necessary.
|
||||
For example in the code rule
|
||||
.DS
|
||||
pat loe
|
||||
uses hlreg
|
||||
gen lhld {label,$1} yields hl
|
||||
.DE
|
||||
the 'uses'-clause could have been omitted because
|
||||
.B cgg
|
||||
knows that LHLD destroyes register-pair HL.
|
||||
.sp 1
|
||||
Since there is only one register with property 'hlreg',
|
||||
there is no difference between 'uses hlreg' (allocate a
|
||||
register with property 'hlreg') and 'kills hlreg' (remove
|
||||
all registers with property 'hlreg' from the fake-stack).
|
||||
The same applies for the property 'dereg'.
|
||||
.br
|
||||
As a consequence 'kills' is rarely used in this back-end table.
|
||||
.NH 3
|
||||
Group 1: Load instructions
|
||||
.PP
|
||||
When a local variable must be squared, there will probably be EM-code like:
|
||||
.DS
|
||||
lol 10
|
||||
lol 10
|
||||
mli 2
|
||||
.DE
|
||||
When the code for the first 'lol 10' has been executed, DE contains the
|
||||
wanted value.
|
||||
To refrain
|
||||
.B cgg
|
||||
from emitting the code for 'lol 10' again, an extra
|
||||
pattern is included in the table for cases like this.
|
||||
.br
|
||||
The same applies for two consecutive 'loe'-s or 'lil'-s.
|
||||
.sp 1
|
||||
A bit tricky is 'lof'.
|
||||
It expects either DE or HL on the fake-stack, moves {const2,$1}
|
||||
into the other one, and eventually adds them.
|
||||
The 'kills' part is necessary here because if DE was on the fake-stack,
|
||||
.B cgg
|
||||
doesn't see that the contents of DE is destroyed by the code
|
||||
(in fact 'kills dereg' would have been sufficient: because of the
|
||||
DAD instruction
|
||||
.B cgg
|
||||
knows that HL is destroyed).
|
||||
.sp 1
|
||||
By lookahead,
|
||||
.B cgg
|
||||
can make a clever choise between the first and
|
||||
second code rule of 'loi 4'.
|
||||
The same applies for several other instructions.
|
||||
.NH 3
|
||||
Group 2: Store instructions
|
||||
.PP
|
||||
A similar idea as with the two consecutive identical load instructions
|
||||
in Group 1, applies for a store instruction followed by a corresponding load instruction.
|
||||
.NH 3
|
||||
Groups 3 and 4: Signed and unsigned integer arithmetic
|
||||
.PP
|
||||
Since the 8080 instruction set doesn't provide multiply and
|
||||
divide instructions, special routines are made to accomplish these tasks.
|
||||
.sp 1
|
||||
Instead of providing four slighty differing routines for 16 bit signed or
|
||||
unsigned division, yielding the quotient or the remainder,
|
||||
the routines are merged.
|
||||
This saves space and assembly time
|
||||
when several variants are used in a particular program,
|
||||
at the cost of a little speed.
|
||||
.br
|
||||
When the routine is called, bit 7 of register A indicates whether
|
||||
the operands should be considered as signed or as unsigned integers,
|
||||
and bit 0 of register A indicates whether the quotient or the
|
||||
remainder has to be delivered.
|
||||
.br
|
||||
The same applies for 32 bit division.
|
||||
.sp 1
|
||||
The routine doing the 16 bit unsigned multiplication could
|
||||
have been used for 16 bit signed multiplication too.
|
||||
Nevertheless a special 16 bit signed multiplication routine is
|
||||
provided, because this one will usually be much faster.
|
||||
.NH 3
|
||||
Group 5: Floating point arithmetic
|
||||
.PP
|
||||
Floating points are not implemented.
|
||||
.br
|
||||
Whenever an EM-instruction involving floating points is offered
|
||||
to the code-generator, it generates the code 'call eunimpl',
|
||||
which traps with trap number 63.
|
||||
Some of the Pascal and C library routines output floating point
|
||||
EM-instructions, so code has to be generated for them.
|
||||
Of course this doesn't imply the code will ever be executed.
|
||||
.NH 3
|
||||
Group 12: Compare instructions
|
||||
.PP
|
||||
The code for 'cmu 2', with its 4 labels, is terrible.
|
||||
But it is the best I could find.
|
||||
.NH 3
|
||||
Group 9: Logical instructions
|
||||
.PP
|
||||
I have tried to merge both variants of the instructions 'and 2', 'ior 2' and 'xor 2',
|
||||
as in
|
||||
.DS
|
||||
pat and $1==2
|
||||
with hl_or_de hl_or_de
|
||||
uses reusing %1, reusing %2, hl_or_de, areg
|
||||
gen mov a,%1.2
|
||||
ana %2.2
|
||||
mov %a.2,a
|
||||
mov a,%1.1
|
||||
ana %2.1
|
||||
mov %a.1,a yields %a
|
||||
.DE
|
||||
but the current version of
|
||||
.B cgg
|
||||
doesn't approve this.
|
||||
.br
|
||||
In any case
|
||||
.B cgg
|
||||
chooses either DE or HL to store the result, using lookahead.
|
||||
.NH 3
|
||||
Group 14: Procedure call instructions
|
||||
.PP
|
||||
There is an 8 bytes function return area, called '.fra'.
|
||||
If only 2 bytes have to be returned, register-pair DE is used.
|
||||
.NH 1
|
||||
LIBRARY ROUTINES
|
||||
.PP
|
||||
Most of the library routines start with saving the return address
|
||||
and the localbase, so that the parameters are on the top of the stack
|
||||
and the registers B and C are available as scratch registers.
|
||||
Since register-pair HL is needed to accomplish these tasks,
|
||||
and also to restore everything just before the routine returns,
|
||||
it is not possible to transfer data between the routines and the
|
||||
surrounding world through register H or L.
|
||||
Only registers A, D and E can be used for this.
|
||||
.sp
|
||||
When a routine returns 2 bytes, they are usually returned in
|
||||
registers-pair DE.
|
||||
When it returns more than 2 bytes they are pushed onto the stack.
|
||||
.br
|
||||
|
||||
It would have been possible to let the 32 bit arithmetic routines
|
||||
return 2 bytes in DE and the remaining 2 bytes on the stack
|
||||
(this often would have saved some space and execution time),
|
||||
but I don't consider that as well-structured programming.
|
||||
.NH 1
|
||||
TRAPS
|
||||
.PP
|
||||
Whenever a trap, for example trying to divide by zero,
|
||||
occurs in a program that originally was written in C or Pascal,
|
||||
a special trap handler is called.
|
||||
.br
|
||||
This trap handler wants to write an appropriate error message on the
|
||||
monitor.
|
||||
It tries to read the message from a file (e.g. etc/pc_rt_errors in the
|
||||
EM home directory for Pascal programs), but since the 8080 back-end
|
||||
doesn't know about files, we are in trouble.
|
||||
This problem is solved, as far as possible, by including the 'open'-monitor call in the mon-routine.
|
||||
It returns with file descriptor -1.
|
||||
The trap handler reacts by generating another trap, with the original
|
||||
trap number.
|
||||
But this time, instead of calling the C- or Pascal trap handler again,
|
||||
the next message is printed on the monitor:
|
||||
.DS L
|
||||
trap number <TN>
|
||||
line <LN> of file <FN>
|
||||
|
||||
where <TN> is the trap number (decimal)
|
||||
<LN> is the line number (decimal)
|
||||
<FN> is the filename of the original program
|
||||
.DE
|
||||
.sp 1
|
||||
Trap numbers are subdivided as follows:
|
||||
.IP 1-27: 20
|
||||
EM-machine error, as described in [3]
|
||||
.IP 63:
|
||||
an unimplemented EM-instruction is used
|
||||
.IP 64-127:
|
||||
generated by compilers, runtime systems, etc.
|
||||
.IP 128-252:
|
||||
generated by user programs
|
||||
.NH 1
|
||||
IMPLEMENTATION
|
||||
.PP
|
||||
It will not be possible to run the entire Amsterdam Compiler Kit on a
|
||||
8080-based computer system.
|
||||
One has to write a program on another
|
||||
system, a system where the compiler kit runs on.
|
||||
This program may be a mixture of high-level languages, such as
|
||||
C or Pascal, EM and 8080 assembly code.
|
||||
The program should be compiled using the compiler kit, producing 8080 machine code.
|
||||
This code should come available to the 8080 machine
|
||||
for example by downloading or
|
||||
by storing it in ROM (Read Only Memory).
|
||||
.sp 1
|
||||
Depending on the characteristics of the particular 8080 based system, some
|
||||
adaptions have to be made:
|
||||
.IP 1) 10
|
||||
In 'head_em': the base address, which is the address where the first
|
||||
8080 instruction will be stored, and the initial value of the
|
||||
stackpointer are set to 0x1000 and 0x8000 respectivally.
|
||||
.br
|
||||
Other systems require other values.
|
||||
.IP 2)
|
||||
In 'head_em': before calling "_m_a_i_n", the environment
|
||||
pointer, argument vector and argument count will have to be pushed
|
||||
onto the stack.
|
||||
Since this back-end is tested on a system without any knowledge
|
||||
of these things, dummies are pushed now.
|
||||
.IP 3)
|
||||
In 'tail_em': proper routines "putchar" and "getchar" should
|
||||
be provided.
|
||||
They should write resp. read a character on/from the monitor.
|
||||
Maybe some conversions will have to be made.
|
||||
.IP 4)
|
||||
In 'head_em': an application program returns control to the monitor by
|
||||
jumping to address 0xFB52.
|
||||
If this is not the right way on your system, change it.
|
||||
.IP 5)
|
||||
In 'tail_em': the current version of the 8080 back-end has very limited I/O
|
||||
capabilities, because it was tested on a system that
|
||||
had no knowlegde of files.
|
||||
So the implementation of the EM-instruction 'mon' is very simple;
|
||||
it can only do the following things:
|
||||
.RS
|
||||
.IP Monitor\ call\ 1: 40
|
||||
Exit
|
||||
.IP Monitor\ call\ 3:
|
||||
read, always reads from the monitor.
|
||||
.br
|
||||
echos the read character.
|
||||
.br
|
||||
ignores file descriptor.
|
||||
.IP Monitor\ call\ 4:
|
||||
write, always writes on the monitor.
|
||||
.br
|
||||
ignores file descriptor.
|
||||
.IP Monitor\ call\ 5:
|
||||
open file, returns file descriptor -1.
|
||||
.br
|
||||
(compare chapter about TRAPS)
|
||||
.IP Monitor\ call\ 6:
|
||||
close file, returns error code = 0.
|
||||
.IP Monitor\ call\ 54:
|
||||
io-control, returns error code = 0.
|
||||
.RE
|
||||
.sp
|
||||
If the system should do file-handling the routine ".mon"
|
||||
should be extended thoroughly.
|
||||
.NH 1
|
||||
INTEL 8080 VERSUS ZILOG Z80 AND INTEL 8086
|
||||
.NH 2
|
||||
Introduction
|
||||
.PP
|
||||
At about the same time I develloped the back end
|
||||
for the Intel 8080 and Intel 8085,
|
||||
Frans van Haarlem did the same job for the Zilog z80 microprocessor.
|
||||
Since the z80 processor is an extension of the 8080,
|
||||
any machine code offered to a 8080 processor can be offered
|
||||
to a z80 too.
|
||||
The assembly languages are quite different however.
|
||||
.br
|
||||
During the devellopments of the back ends we have used
|
||||
two micro-computers, both equiped with a z80 microprocessor.
|
||||
Of course the output of the 8080 back end is assembled by an
|
||||
8080 assembler. This should assure I have never used any of
|
||||
the features that are potentially available in the z80 processor,
|
||||
but are not part of a true 8080 processor.
|
||||
.sp 1
|
||||
As a final job, I have
|
||||
investigated the differences between the 8080 and z80 processors
|
||||
and their influence on the back ends.
|
||||
I have tried to measure this influence by examining the length of
|
||||
the generated code.
|
||||
I have also involved the 8086 micro-processor in this measurements.
|
||||
.NH 2
|
||||
Differences between the 8080 and z80 processors
|
||||
.PP
|
||||
Except for some features that are less important concerning back ends,
|
||||
there are two points where the z80 improves the 8080:
|
||||
.IP First, 18
|
||||
the z80 has two additional index registers, IX and IY.
|
||||
They are used as in
|
||||
.DS
|
||||
LD B,(IX+10)
|
||||
.DE
|
||||
The offset, here 10, should fit in one byte.
|
||||
.IP Second,
|
||||
the z80 has several additional instructions.
|
||||
The most important ones are:
|
||||
.RS
|
||||
.IP 1) 8
|
||||
The 8080 can only load or store register-pair HL direct
|
||||
(using LHLD or SHLD).
|
||||
The z80 can handle BC, DE and SP too.
|
||||
.IP 2)
|
||||
Instructions are included to ease block movements.
|
||||
.IP 3)
|
||||
There is a 16 bit subtract instruction.
|
||||
.IP 4)
|
||||
While the 8080 can only rotate the accumulator, the z80
|
||||
can rotate and shift each 8 bit register.
|
||||
.IP 5)
|
||||
Special routines are included to jump to near locations, saving 1 byte.
|
||||
.RE
|
||||
.NH 2
|
||||
Consequences for the 8080 and z80 back end
|
||||
.PP
|
||||
The most striking difference between the 8080 and z80 back ends
|
||||
is the choise of the localbase.
|
||||
The writer of the z80 back end chose index register IY as localbase,
|
||||
because this results in the cheapest coding of EM-instructions
|
||||
like 'lol' and 'stl'.
|
||||
.br
|
||||
The z80 instructions that load local 10, for example
|
||||
.DS
|
||||
LD E,(IY+10)
|
||||
LD D,(IY+11)
|
||||
.DE
|
||||
occupy 6 bytes and take 38 time periods to execute.
|
||||
The five corresponding 8080 instructions loading a local
|
||||
occupy 7 bytes and take 41 time periods.
|
||||
Although the profit of the z80 might be not world-shocking,
|
||||
it should be noted that as a side effect it may save some
|
||||
pushing and popping since register pair HL is not used.
|
||||
.sp 1
|
||||
The choise of IY as localbase has its drawbacks too.
|
||||
The root of the problem is that it is not possible to add
|
||||
IY to HL.
|
||||
For the EM-instruction
|
||||
.DS
|
||||
lal 20
|
||||
.DE
|
||||
the z80 back end generates code like
|
||||
.DS
|
||||
LD BC,20
|
||||
PUSH IY
|
||||
POP HL
|
||||
ADD HL,BC
|
||||
.DE
|
||||
leaving the wanted address in HL.
|
||||
.br
|
||||
This annoying push and pop instructions are also needed in some
|
||||
other instructions, for instance in 'lol' when the offset
|
||||
doesn't fit in one byte.
|
||||
.sp 1
|
||||
Beside the choise of the localbase, I think there is no
|
||||
fundamental difference between the 8080 and z80 back ends,
|
||||
except of course that the z80 back end has register pair BC
|
||||
and, less important, index register IX available as scratch registers.
|
||||
.sp 1
|
||||
Most of the PATTERNS in the 8080 and z80 tables are more or less
|
||||
a direct translation of each other.
|
||||
.NH 2
|
||||
What did I do?
|
||||
.PP
|
||||
To get an idea of the quality of the code generated by
|
||||
the 8080, z80 and 8086 back ends I have gathered
|
||||
some C programs and some Pascal programs.
|
||||
Then I produced 8080, z80 and 8086 code for them.
|
||||
Investigating the assembler listing I found the
|
||||
lengths of the different parts of the generated code.
|
||||
.br
|
||||
I have checked two areas:
|
||||
.IP 1) 8
|
||||
the entire text part
|
||||
.IP 2)
|
||||
the text part without any library routine, so only the plain user program
|
||||
.LP
|
||||
I have to admit that neither one of them is really honest.
|
||||
When the entire text part is checked, the result is disturbed
|
||||
because not always the same library routines are loaded.
|
||||
And when only the user program itself is considered, the result is
|
||||
disturbed too.
|
||||
For example the 8086 has a multiply instruction,
|
||||
so the EM-instruction 'mli 2' is translated in the main program,
|
||||
but the 8080 and z80 call a library routine that is not counted.
|
||||
Also the 8080 uses library routines at some places where the
|
||||
z80 does not.
|
||||
.sp 1
|
||||
But nevertheless I think the measurements will give an idea
|
||||
about the code produced by the three back ends.
|
||||
.NH 2
|
||||
The results
|
||||
.PP
|
||||
The table below should be read as follows.
|
||||
For all programs I have computed the ratio of the code-lengths
|
||||
of the 8080, z80 and 8086.
|
||||
The averages of all Pascal/C programs are listed in the table,
|
||||
standarized to '100' for the 8080.
|
||||
So the listed '107' indicates that the lengths
|
||||
of the text parts of the z80 programs that originally were Pascal programs,
|
||||
averaged 7 percent larger than in the corresponding 8080 programs.
|
||||
.DS C
|
||||
--------------------------------------------------
|
||||
| | 8080 | z80 | 8086 |
|
||||
--------------------------------------------------
|
||||
| C, text part | 100 | 103 | 65 |
|
||||
| Pascal, text part | 100 | 107 | 55 |
|
||||
| C, user program | 100 | 110 | 71 |
|
||||
| Pascal, user program | 100 | 118 | 67 |
|
||||
--------------------------------------------------
|
||||
.DE
|
||||
.TE
|
||||
The most striking thing in this table is that the z80 back end appears
|
||||
to produce larger code than the 8080 back end.
|
||||
The reason is that the current z80 back end table is
|
||||
not very elaborate yet.
|
||||
For instance it doesn't look for any EM-pattern longer than one.
|
||||
So the table shows that the preparations in the 8080 back end table
|
||||
to produce faster code (like recognizing special EM-patterns
|
||||
and permitting one byte registers on the fake-stack)
|
||||
was not just for fun, but really improved the generated code
|
||||
significantly.
|
||||
.sp 1
|
||||
The table shows that the 8080 table is relativelly better
|
||||
when only the plain user program is considered instead of the entire text part.
|
||||
This is not very surprising since the 8080 back end sometimes
|
||||
uses library routines where the z80 and especially the 8086 don't.
|
||||
.sp 1
|
||||
The difference between the 8080 and z80 on the one hand and the 8086
|
||||
on the other is very big.
|
||||
But of course it was not equal game:
|
||||
the 8086 is a 16 bit processor that is much more advanced than the
|
||||
8080 or z80 and the 8086 back end is known to produce
|
||||
very good code.
|
||||
.bp
|
||||
.B REFERENCES
|
||||
.sp 2
|
||||
.IP [1] 10
|
||||
8080/8085 Assembly Language Programming Manual,
|
||||
.br
|
||||
Intel Corporation (1977,1978)
|
||||
.IP [2]
|
||||
Andrew S. Tanenbaum, Hans van Staveren, E.G. Keizer and Johan W. Stevenson,
|
||||
.br
|
||||
A practical tool kit for making portable compilers,
|
||||
.br
|
||||
Informatica report 74, Vrije Universiteit, Amsterdam, 1983.
|
||||
.sp
|
||||
An overview on the Amsterdam Compiler Kit.
|
||||
.IP [3]
|
||||
Tanenbaum, A.S., Stevenson, J.W., Keizer, E.G., and van Staveren, H.
|
||||
.br
|
||||
Desciption of an experimental machine architecture for use with block
|
||||
structured languages,
|
||||
.br
|
||||
Informatica report 81, Vrije Universiteit, Amsterdam, 1983.
|
||||
.sp
|
||||
The defining document for EM.
|
||||
.IP [4]
|
||||
Steel, T.B., Jr.
|
||||
.br
|
||||
UNCOL: The myth and the Fact. in Ann. Rev. Auto. Prog.
|
||||
.br
|
||||
Goodman, R. (ed.), vol. 2, (1960), p325-344.
|
||||
.sp
|
||||
An introduction to the UNCOL idea by its originator.
|
||||
.IP [5]
|
||||
van Staveren, Hans
|
||||
.br
|
||||
The table driven code generator from the Amsterdam Compiler Kit
|
||||
(Second Revised Edition),
|
||||
.br
|
||||
Vrije Universiteit, Amsterdam.
|
||||
.sp
|
||||
The defining document for writing a back end table.
|
||||
.IP [6]
|
||||
Voors, Jan
|
||||
.br
|
||||
A back end for the Zilog z8000 micro,
|
||||
.br
|
||||
Vrije Universiteit, Amsterdam.
|
||||
.sp
|
||||
A document like this one, but for the z8000.
|
||||
1060
doc/install.doc
1060
doc/install.doc
File diff suppressed because it is too large
Load Diff
2948
doc/ncg.doc
Normal file
2948
doc/ncg.doc
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,4 @@
|
||||
.\" $Header$
|
||||
.ds OF \\fBtest~off:~\\fR
|
||||
.ds ON \\fBtest~on:~~\\fR
|
||||
.ds AL \\fBtest~all:~\\fR
|
||||
@@ -412,6 +413,36 @@ for parameters. Some EM implementations check this:
|
||||
\*(ONnot checked.
|
||||
.I2
|
||||
not checked.
|
||||
.IE
|
||||
.PP
|
||||
For those who wish the use the interface between C and Pascal we
|
||||
give an incomplete list of corresponding formal parameters in C and Pascal.
|
||||
.sp 1
|
||||
.ta 8 37
|
||||
.nf
|
||||
Pascal C
|
||||
a:integer int a
|
||||
a:char int a
|
||||
a:boolean int a
|
||||
a:real double a
|
||||
a:^type type *a
|
||||
var a:type type *a
|
||||
procedure a(pars) struct {
|
||||
void (*a)() ;
|
||||
char *static_link ;
|
||||
}
|
||||
function a(pars):type struct {
|
||||
type (*a)() ;
|
||||
char *static_link ;
|
||||
}
|
||||
.fi
|
||||
The Pascal runtime system uses the following algorithm when calling
|
||||
function/procedures passed as parameters.
|
||||
.nf
|
||||
.ta 8 16
|
||||
if ( static_link ) (*a)(static_link,pars) ;
|
||||
else (*a)(pars) ;
|
||||
.fi
|
||||
.IT 6.7.2.1
|
||||
The order of evaluation of the operands of a dyadic operator
|
||||
shall be implementation-dependent.
|
||||
@@ -1303,6 +1334,19 @@ Alternate symbol representation.
|
||||
.sp
|
||||
The comment delimiters '(*' and '*)' are recognized and treated like '{' and '}'.
|
||||
The other alternate representations of symbols are not recognized.
|
||||
.sp
|
||||
.ti -3
|
||||
9.~\
|
||||
Pre-processing.
|
||||
.sp
|
||||
If the very first character of a file containing a Pascal
|
||||
program is the sharp ('#', ASCII 23(hex)) the file is preprocessed
|
||||
in the same way as C programs.
|
||||
Lines beginning with a '#' are taken as preprocessor command lines
|
||||
and not fed to the Pascal compiler proper.
|
||||
C style comments, /*......*/, are removed by the C preprocessor,
|
||||
thus C comments inside Pascal programs are also removed when they
|
||||
are fed through the preprocessor.
|
||||
.CH "Deviations from the standard"
|
||||
Ack-Pascal deviates from the (March 1980) standard proposal in the following ways:
|
||||
.IS
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
.\" $Header$
|
||||
.TL
|
||||
Internal documentation on the peephole optimizer
|
||||
.br
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
.\" $Header$
|
||||
.TL
|
||||
Addition of register variables to an existing table.
|
||||
.NH 1
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
.\" $Header$
|
||||
.RP
|
||||
.ND
|
||||
.nr LL 78m
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
.\" $Header$
|
||||
.wh 0 hd
|
||||
.wh 60 fo
|
||||
.de hd
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
.\" $Header$
|
||||
.ll 72
|
||||
.wh 0 hd
|
||||
.wh 60 fo
|
||||
|
||||
68
doc/z80.doc
Normal file
68
doc/z80.doc
Normal file
@@ -0,0 +1,68 @@
|
||||
THE Z80 BACK END TABLE
|
||||
|
||||
INTRODUCTION
|
||||
|
||||
This table was written to make it run, not to make it clever!
|
||||
The effect is, that the table written for the intel 8080,
|
||||
which was made very clever runs faster and requiers less space!!
|
||||
So, for anyone to run programs on a z80 machine:
|
||||
You could try to make the table as clever as the one for the i80,
|
||||
or you could run the i80 table, for that can run on every z80 too.
|
||||
|
||||
IMPLEMENTATION
|
||||
|
||||
It will not be possible to run the entire Amsterdam Compiler Kit on a
|
||||
Z80-based computer system.
|
||||
One has to write a program on another
|
||||
system, a system where the compiler kit runs on.
|
||||
This program may be a mixture of high-level languages, such as
|
||||
C or Pascal, EM and z80 assembly code.
|
||||
The program should be compiled using the compiler kit,
|
||||
producing z80 machine code.
|
||||
This code should come available to the z80 machine
|
||||
for example by downloading or
|
||||
by storing it in ROM (Read Only Memory).
|
||||
Depending on the characteristics of the particular z80 based system, some
|
||||
adaptions have to be made:
|
||||
1) In 'head_em': the base address, which is the address where the first
|
||||
z80 instruction will be stored, and the initial value of the
|
||||
stackpointer are set to 0x1000 and 0x7ffe respectivally.
|
||||
The latter because it could run on a 32K machine as well.
|
||||
Other systems require other values.
|
||||
2) In 'head_em': before calling "_m_a_i_n", the environment
|
||||
pointer, argument vector and argument count will have to be pushed
|
||||
onto the stack.
|
||||
Since this back-end is tested on a system without any knowledge
|
||||
of these things, dummies are pushed now.
|
||||
3) In 'tail_em': proper routines "putchar" and "getchar" should
|
||||
be provided.
|
||||
They should write resp. read a character on/from the monitor.
|
||||
Maybe some conversions will have to be made.
|
||||
The ones for the Nascom and Hermac z80 micro's are to be found
|
||||
in the EM-library.
|
||||
4) In 'head_em': an application program returns control to the monitor by
|
||||
jumping to address 0x20.
|
||||
If this is not the right way on your system, change it.
|
||||
For an CPM-machine for example this should be 0x5, to provide a warm boot.
|
||||
5) In 'tail_em': the current version of the z80 back-end has very limited I/O
|
||||
capabilities, because it was tested on a system that
|
||||
had no knowlegde of files.
|
||||
So the implementation of the EM-instruction 'mon' is very simple;
|
||||
it can only do the following things:
|
||||
Monitor call 1:
|
||||
Exit
|
||||
Monitor call 3:
|
||||
read, always reads from the monitor.
|
||||
echos the read character.
|
||||
ignores file descriptor.
|
||||
Monitor call 4:
|
||||
write, always writes on the monitor.
|
||||
ignores file descriptor.
|
||||
Monitor call 5:
|
||||
open file, returns file descriptor -1.
|
||||
Monitor call 6:
|
||||
close file, returns error code = 0.
|
||||
Monitor call 54:
|
||||
io-control, returns error code = 0.
|
||||
If the system should do file-handling the routine ".mon"
|
||||
should be extended thoroughly.
|
||||
19
emtest/Makefile
Normal file
19
emtest/Makefile
Normal file
@@ -0,0 +1,19 @@
|
||||
tested: last
|
||||
set -x ;\
|
||||
for i in `awk '{for(i=\$$1;i<=127;i++)print i}' last ` ;\
|
||||
do \
|
||||
echo $$i; \
|
||||
echo $$i >last; \
|
||||
select $$i tests > test.e; \
|
||||
ack test.e; \
|
||||
a.out \
|
||||
: ok; \
|
||||
done
|
||||
rm -f test.e a.out
|
||||
>tested
|
||||
|
||||
last: tests test.h select
|
||||
echo 0 >last
|
||||
|
||||
select: select.c
|
||||
cc -O -n -o select select.c
|
||||
136
emtest/READ_ME
Normal file
136
emtest/READ_ME
Normal file
@@ -0,0 +1,136 @@
|
||||
This directory contains test programs for EM implementations.
|
||||
The test programs are all part of the file "tests".
|
||||
Each individual test program looks like:
|
||||
|
||||
TEST 004: test ...
|
||||
... ; data declarations etc.
|
||||
MAIN nlocal
|
||||
... ; part of the body of MAIN
|
||||
PROC
|
||||
... ; subroutines used by this test
|
||||
|
||||
The PROC part is optional, so the smallest test program looks like:
|
||||
|
||||
TEST 000: null test
|
||||
MAIN 0
|
||||
|
||||
The keywords used by "select", like TEST, MAIN, PROC, HOL, OK and ERRLAB,
|
||||
all consist of upper case letters and start in column one.
|
||||
A convention for test numbers is to use 3 digit numbers, possibly left
|
||||
padded with zero's.
|
||||
|
||||
A program, called "select", is provided to combine a range of tests
|
||||
into a single test program.
|
||||
"Select" expects a range as argument, like 0-127, or -127, or 0-.
|
||||
Tests that have a TEST number in that range are included.
|
||||
"Select" also expects the file from which the tests should
|
||||
be selected as an argument.
|
||||
If no argument is given, or only a range argument, select expects
|
||||
the tests to slect from on standard input.
|
||||
|
||||
To prevent name clashes, some rules must be obeyed:
|
||||
- data label names, procedure names and instruction label numbers
|
||||
must be unique over all tests. A good habit is to use the
|
||||
three digit test number as suffix.
|
||||
- only keyword of "select" may start with uppercase letters in column
|
||||
one, to allow for expansion in the future.
|
||||
- because only a single 'hol' pseudo is allowed, "select" must
|
||||
generate the 'hol' pseudo. An individual test may request
|
||||
some 'hol' space by a special HOL line, starting in column one
|
||||
and followed by a single number, the number of bytes needed.
|
||||
This number must consists of digits only, no constant symbols,
|
||||
because "select" must compute the maximum, so before the
|
||||
preprocessor has replaced the constant symbols by their values.
|
||||
- a similar problem is caused by the number of bytes of local
|
||||
storage for 'main'. An individual test may specify the number
|
||||
of bytes it needs as parameter to the MAIN line.
|
||||
Again, the number must consist of digits only.
|
||||
|
||||
Test programs print a sequence of integers greater than 1.
|
||||
This sequence is terminated by the number 1 as soon as an error is detected.
|
||||
If all tests are performed correctedly the number 0 is printed.
|
||||
|
||||
To allow test programs to print integers without the full machinery of
|
||||
conversion and i/o routines, the EM instruction 'nop' is used.
|
||||
Each time this instruction is executed, the current line number as
|
||||
maintained by the 'lin' instruction must be printed, followed by a
|
||||
newline, at least during debugging.
|
||||
|
||||
The following abbrevation may be used in test programs:
|
||||
|
||||
OK -> lin n
|
||||
nop
|
||||
|
||||
Numbers are automatically assigned in order of static appearance.
|
||||
As soon as an error is detected you must branch to label 1, by instructions
|
||||
like 'bra *1' and 'zne *1'.
|
||||
Label 1 is automatically provided in the main routine.
|
||||
If you jump to label 1 in a subroutine, then that subroutine must
|
||||
end with ERRLAB, like in:
|
||||
|
||||
PROC
|
||||
pro $test,0
|
||||
...
|
||||
bra *1
|
||||
...
|
||||
ret 0
|
||||
ERRLAB
|
||||
end
|
||||
|
||||
An option to "select" is to generate 'fil' instructions whenever a
|
||||
new test starts.
|
||||
This is useful if 'nop' prints the 'fil' string as well as the 'lin' number.
|
||||
This 'f' option is on by default, off if a '-f' flag is given.
|
||||
|
||||
The EM file generated by "select" includes "test.h".
|
||||
"test.h" may contain definitions of the following symbols:
|
||||
W2S: the size of double precision integers, if implemented.
|
||||
FS: the size of single precision floats, if implemented.
|
||||
F2S: the size of double precision floats, if implemented.
|
||||
The value of these symbols, if defined, must be the size of the object involved.
|
||||
|
||||
Two other symbols are used:
|
||||
EM_PSIZE: pointer size
|
||||
EM_WSIZE: word size
|
||||
The machine dependent translation program, like 8086 and vax2, give
|
||||
definitions of these symbols while calling the EM encode program.
|
||||
Because these size names occur quite often, they may be abbreviated:
|
||||
WS -> EM_WSIZE
|
||||
PS -> EM_PSIZE
|
||||
|
||||
Before running the tests in the file "tests", it is wise to test
|
||||
the necessary basic functions with some simple tests like
|
||||
|
||||
TEST 000: null
|
||||
MAIN 0
|
||||
and
|
||||
TEST 001: ok
|
||||
MAIN 0
|
||||
OK
|
||||
and
|
||||
TEST 998: error
|
||||
MAIN 0
|
||||
bra *1
|
||||
and
|
||||
TEST 999: test lni
|
||||
MAIN 0
|
||||
lin 1
|
||||
lni
|
||||
loe 0
|
||||
loc 2
|
||||
bne *1
|
||||
OK
|
||||
The first two of these are part of "tests" as well. The last two are
|
||||
not included in "tests" intensionally, because they would fail.
|
||||
The last tests fails because it references the ABS block which is
|
||||
inaccessable after an 'hol' pseudo.
|
||||
Proceed as follows for each of these basic tests:
|
||||
- make a file called 'basic' containing the test
|
||||
- run select:
|
||||
select basic >basic.e
|
||||
- compile by
|
||||
machine basic.e
|
||||
- and load and run
|
||||
|
||||
where machine should be replaced by the name of program
|
||||
used to compile EM programs for the current machine.
|
||||
1
emtest/last
Normal file
1
emtest/last
Normal file
@@ -0,0 +1 @@
|
||||
0
|
||||
10
emtest/ok
Executable file
10
emtest/ok
Executable file
@@ -0,0 +1,10 @@
|
||||
trap "" 1 2
|
||||
|
||||
while read x
|
||||
do
|
||||
case $x in
|
||||
0) exit 0;;
|
||||
bad) exit 1;;
|
||||
esac
|
||||
done
|
||||
exit 1
|
||||
249
emtest/select.c
Normal file
249
emtest/select.c
Normal file
@@ -0,0 +1,249 @@
|
||||
/*
|
||||
* (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
*
|
||||
* This product is part of the Amsterdam Compiler Kit.
|
||||
*
|
||||
* Permission to use, sell, duplicate or disclose this software must be
|
||||
* obtained in writing. Requests for such permissions may be sent to
|
||||
*
|
||||
* Dr. Andrew S. Tanenbaum
|
||||
* Wiskundig Seminarium
|
||||
* Vrije Universiteit
|
||||
* Postbox 7161
|
||||
* 1007 MC Amsterdam
|
||||
* The Netherlands
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <signal.h>
|
||||
|
||||
#define LINSIZ 100
|
||||
|
||||
int sigs[] = {
|
||||
SIGHUP,
|
||||
SIGINT,
|
||||
SIGQUIT,
|
||||
SIGTERM,
|
||||
0
|
||||
};
|
||||
|
||||
char *prog;
|
||||
char line[LINSIZ];
|
||||
int nlocals = 0;
|
||||
int nhol = 0;
|
||||
int nerrors = 0;
|
||||
int oknum = 2;
|
||||
int fflag = 1;
|
||||
int low = 0;
|
||||
int high = 999;
|
||||
|
||||
FILE *file1;
|
||||
FILE *file2;
|
||||
FILE *file3;
|
||||
char name1[] = "/usr/tmp/f1XXXXXX";
|
||||
char name2[] = "/usr/tmp/f2XXXXXX";
|
||||
char name3[] = "/usr/tmp/f3XXXXXX";
|
||||
|
||||
stop() {
|
||||
unlink(name1);
|
||||
unlink(name2);
|
||||
unlink(name3);
|
||||
exit(nerrors);
|
||||
}
|
||||
|
||||
main(argc,argv) char **argv; {
|
||||
register *p;
|
||||
register char *s;
|
||||
|
||||
prog = *argv++; --argc;
|
||||
mktemp(name1);
|
||||
mktemp(name2);
|
||||
mktemp(name3);
|
||||
for (p = sigs; *p; p++)
|
||||
if (signal(*p, stop) == SIG_IGN)
|
||||
signal(*p, SIG_IGN);
|
||||
while (argc > 0 && argv[0][0] == '-') {
|
||||
switch (argv[0][1]) {
|
||||
case 'f':
|
||||
fflag ^= 1;
|
||||
break;
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
high = atoi(&argv[0][1]);
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
break;
|
||||
}
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
if (argc > 0 && argv[0][0] >= '0' && argv[0][0] <= '9') {
|
||||
s = argv[0];
|
||||
do
|
||||
low = low*10 + *s++ - '0';
|
||||
while (*s >= '0' && *s <= '9');
|
||||
if (*s == 0)
|
||||
high = low;
|
||||
else if (*s++ == '-') {
|
||||
high = atoi(s);
|
||||
if (high == 0)
|
||||
high = 999;
|
||||
} else
|
||||
fatal("bad range %s", argv[0]);
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
if (argc > 1)
|
||||
usage();
|
||||
if (argc == 1 && freopen(argv[0], "r", stdin) == NULL)
|
||||
fatal("cannot open %s", argv[0]);
|
||||
if ((file1 = fopen(name1, "w")) == NULL)
|
||||
fatal("cannot create %s", name1);
|
||||
if ((file2 = fopen(name2, "w")) == NULL)
|
||||
fatal("cannot create %s", name2);
|
||||
if ((file3 = fopen(name3, "w")) == NULL)
|
||||
fatal("cannot create %s", name3);
|
||||
if (getline())
|
||||
while (select())
|
||||
;
|
||||
fclose(file1);
|
||||
fclose(file2);
|
||||
fclose(file3);
|
||||
combine();
|
||||
stop();
|
||||
}
|
||||
|
||||
select() {
|
||||
register FILE *f;
|
||||
int i;
|
||||
|
||||
if (sscanf(line, "TEST %d", &i) != 1)
|
||||
fatal("bad test identification(%s)", line);
|
||||
if (i < low || i > high) {
|
||||
while (getline())
|
||||
if (line[0] == 'T')
|
||||
return(1);
|
||||
return(0);
|
||||
}
|
||||
fprintf(file2, "; %s\n", line);
|
||||
if (fflag) {
|
||||
fprintf(file1, ".%03d\n", i);
|
||||
fprintf(file1, " con \"tst%03d\"\n", i);
|
||||
fprintf(file2, " fil .%03d\n", i);
|
||||
}
|
||||
f = file1;
|
||||
while (getline()) {
|
||||
switch (line[0]) {
|
||||
case 'T':
|
||||
return(1);
|
||||
case 'M':
|
||||
if (sscanf(line, "MAIN%d", &i) != 1 || i%4 != 0)
|
||||
break;
|
||||
if (i > nlocals)
|
||||
nlocals = i;
|
||||
f = file2;
|
||||
continue;
|
||||
case 'P':
|
||||
if (strcmp(line, "PROC") != 0)
|
||||
break;
|
||||
f = file3;
|
||||
continue;
|
||||
case 'H':
|
||||
if (f != file1 ||
|
||||
sscanf(line, "HOL%d", &i) != 1 ||
|
||||
i%4 != 0)
|
||||
break;
|
||||
if (i > nhol)
|
||||
nhol = i;
|
||||
continue;
|
||||
case 'O':
|
||||
if (strcmp(line, "OK") != 0)
|
||||
break;
|
||||
fprintf(f, " lin %d\n nop\n", oknum++);
|
||||
continue;
|
||||
case 'E':
|
||||
if (f != file3 || strcmp(line, "ERRLAB") != 0)
|
||||
break;
|
||||
fprintf(f, "1\n lin 1\n nop\n loc 1\n loc 1\n mon\n");
|
||||
continue;
|
||||
default:
|
||||
putline(f);
|
||||
continue;
|
||||
}
|
||||
fatal("bad line (%s)", line);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
combine() {
|
||||
|
||||
printf("#define WS EM_WSIZE\n");
|
||||
printf("#define PS EM_PSIZE\n");
|
||||
printf("#include \"test.h\"\n");
|
||||
printf(" mes 2,WS,PS\n");
|
||||
printf(" mes 1\n");
|
||||
printf(" mes 4,300\n");
|
||||
if (nhol)
|
||||
printf(" hol %d,0,0\n", nhol);
|
||||
copy(name1);
|
||||
printf(" exp $m_a_i_n\n");
|
||||
printf(" pro $m_a_i_n,%d\n", nlocals);
|
||||
printf(" loc 123\n");
|
||||
printf(" loc -98\n");
|
||||
copy(name2);
|
||||
printf(" loc -98\n");
|
||||
printf(" bne *1\n");
|
||||
printf(" loc 123\n");
|
||||
printf(" bne *1\n");
|
||||
printf(" lin 0\n");
|
||||
printf(" nop\n");
|
||||
printf(" loc 0\n");
|
||||
printf(" ret WS\n");
|
||||
printf("1\n");
|
||||
printf(" lin 1\n");
|
||||
printf(" nop\n");
|
||||
printf(" loc 1\n");
|
||||
printf(" ret WS\n");
|
||||
printf(" end\n");
|
||||
copy(name3);
|
||||
}
|
||||
|
||||
copy(s) char *s; {
|
||||
if (freopen(s, "r", stdin) == NULL)
|
||||
fatal("cannot reopen %s", s);
|
||||
while (getline())
|
||||
putline(stdout);
|
||||
}
|
||||
|
||||
getline() {
|
||||
register len;
|
||||
|
||||
if (fgets(line, LINSIZ, stdin) == NULL)
|
||||
return(0);
|
||||
len = strlen(line);
|
||||
if (line[len-1] != '\n')
|
||||
fatal("line too long(%s)", line);
|
||||
line[len-1] = 0;
|
||||
return(1);
|
||||
}
|
||||
|
||||
putline(f) FILE *f; {
|
||||
fprintf(f, "%s\n", line);
|
||||
}
|
||||
|
||||
fatal(s, a1, a2, a3, a4) char *s; {
|
||||
fprintf(stderr, "%s: ", prog);
|
||||
fprintf(stderr, s, a1, a2, a3, a4);
|
||||
fprintf(stderr, " (fatal)\n");
|
||||
nerrors++;
|
||||
stop();
|
||||
}
|
||||
|
||||
usage() {
|
||||
fprintf(stderr, "usage: %s -f [[low]-[high]] [testcollection]\n", prog);
|
||||
nerrors++;
|
||||
stop();
|
||||
}
|
||||
28
emtest/test.e
Normal file
28
emtest/test.e
Normal file
@@ -0,0 +1,28 @@
|
||||
#define WS EM_WSIZE
|
||||
#define PS EM_PSIZE
|
||||
#include "test.h"
|
||||
mes 2,WS,PS
|
||||
mes 1
|
||||
mes 4,300
|
||||
.000
|
||||
con "tst000"
|
||||
exp $m_a_i_n
|
||||
pro $m_a_i_n,0
|
||||
loc 123
|
||||
loc -98
|
||||
; TEST 000: empty
|
||||
fil .000
|
||||
loc -98
|
||||
bne *1
|
||||
loc 123
|
||||
bne *1
|
||||
lin 0
|
||||
nop
|
||||
loc 0
|
||||
ret WS
|
||||
1
|
||||
lin 1
|
||||
nop
|
||||
loc 1
|
||||
ret WS
|
||||
end
|
||||
0
emtest/test.h
Normal file
0
emtest/test.h
Normal file
3605
emtest/tests
Normal file
3605
emtest/tests
Normal file
File diff suppressed because it is too large
Load Diff
26
etc/Makefile
Normal file
26
etc/Makefile
Normal file
@@ -0,0 +1,26 @@
|
||||
d=..
|
||||
h=$d/h
|
||||
c=$d/util/data
|
||||
|
||||
FILES= \
|
||||
$h/em_spec.h \
|
||||
$h/em_pseu.h \
|
||||
$h/em_mnem.h \
|
||||
$c/em_flag.c \
|
||||
$c/em_pseu.c \
|
||||
$c/em_mnem.c
|
||||
|
||||
$(FILES): em_table
|
||||
new_table $h $c
|
||||
|
||||
install: $(FILES)
|
||||
|
||||
opr:
|
||||
make pr ^ opr
|
||||
pr:
|
||||
@pr Makefile em_table new_table pop_push traps
|
||||
|
||||
clean:
|
||||
-rm -f *.old
|
||||
|
||||
cmp : # do nothing
|
||||
175
etc/em_table
Normal file
175
etc/em_table
Normal file
@@ -0,0 +1,175 @@
|
||||
magic 173
|
||||
fmnem 1
|
||||
nmnem 149
|
||||
fpseu 150
|
||||
npseu 30
|
||||
filb0 180
|
||||
nilb0 60
|
||||
fcst0 0
|
||||
zcst0 120
|
||||
ncst0 240
|
||||
fspec 240
|
||||
nspec 16
|
||||
ilb1 240
|
||||
ilb2 241
|
||||
dlb1 242
|
||||
dlb2 243
|
||||
dnam 244
|
||||
cst2 245
|
||||
cst4 246
|
||||
cst8 247
|
||||
doff 248
|
||||
pnam 249
|
||||
scon 250
|
||||
icon 251
|
||||
ucon 252
|
||||
fcon 253
|
||||
cend 255
|
||||
|
||||
bss 0
|
||||
con 1
|
||||
end 2
|
||||
exa 3
|
||||
exc 4
|
||||
exp 5
|
||||
hol 6
|
||||
ina 7
|
||||
inp 8
|
||||
mes 9
|
||||
pro 10
|
||||
rom 11
|
||||
|
||||
aar w- -p-a-p+p
|
||||
adf w- -a-a+a
|
||||
adi w- -a-a+a
|
||||
adp f- -p+p
|
||||
ads w- -a-p+p
|
||||
adu w- -a-a+a
|
||||
and w- -a-a+a
|
||||
asp f- -a
|
||||
ass w- -a-x
|
||||
beq bc -w-w
|
||||
bge bc -w-w
|
||||
bgt bc -w-w
|
||||
ble bc -w-w
|
||||
blm z- -p-p
|
||||
bls w- -a-p-p
|
||||
blt bc -w-w
|
||||
bne bc -w-w
|
||||
bra bt 0
|
||||
cai -p -p
|
||||
cal pp 0
|
||||
cff -- -w-w-y+x
|
||||
cfi -- -w-w-y+x
|
||||
cfu -- -w-w-y+x
|
||||
cif -- -w-w-y+x
|
||||
cii -- -w-w-y+x
|
||||
ciu -- -w-w-y+x
|
||||
cmf w- -a-a+w
|
||||
cmi w- -a-a+w
|
||||
cmp -- -p-p+w
|
||||
cms w- -a-a+w
|
||||
cmu w- -a-a+w
|
||||
com w- -a-a+a
|
||||
csa wt -p-a
|
||||
csb wt -p-a
|
||||
cuf -- -w-w-y+x
|
||||
cui -- -w-w-y+x
|
||||
cuu -- -w-w-y+x
|
||||
dch -- -p+p
|
||||
dec -- -w+w
|
||||
dee g- 0
|
||||
del l- 0
|
||||
dup s- -a+a+a
|
||||
dus w- -a-x+x+x
|
||||
dvf w- -a-a+a
|
||||
dvi w- -a-a+a
|
||||
dvu w- -a-a+a
|
||||
exg w- -a-a+a+a
|
||||
fef w- -a+a+w
|
||||
fif w- -a-a+a+a
|
||||
fil g- 0
|
||||
gto gt -p-?
|
||||
inc -- -w+w
|
||||
ine g- 0
|
||||
inl l- 0
|
||||
inn w- -w-a+w
|
||||
ior w- -a-a+a
|
||||
lae g- +p
|
||||
lal l- +p
|
||||
lar w- -p-a-p+?
|
||||
ldc d- +d
|
||||
lde g- +d
|
||||
ldf f- -p+d
|
||||
ldl l- +d
|
||||
lfr s- +a
|
||||
lil l- +w
|
||||
lim -- +w
|
||||
lin n- 0
|
||||
lni -- 0
|
||||
loc c- +w
|
||||
loe g- +w
|
||||
lof f- -p+w
|
||||
loi o- -p+a
|
||||
lol l- +w
|
||||
lor r- +p
|
||||
los w- -a-p+x
|
||||
lpb -- -p+p
|
||||
lpi p- +p
|
||||
lxa n- +p
|
||||
lxl n- +p
|
||||
mlf w- -a-a+a
|
||||
mli w- -a-a+a
|
||||
mlu w- -a-a+a
|
||||
mon -- -?+?
|
||||
ngf w- -a+a
|
||||
ngi w- -a+a
|
||||
nop -- 0
|
||||
rck w- -p-a+a
|
||||
ret zt -a-?
|
||||
rmi w- -a-a+a
|
||||
rmu w- -a-a+a
|
||||
rol w- -w-a+a
|
||||
ror w- -w-a+a
|
||||
rtt -t -?
|
||||
sar w- -p-a-p-?
|
||||
sbf w- -a-a+a
|
||||
sbi w- -a-a+a
|
||||
sbs w- -p-p+a
|
||||
sbu w- -a-a+a
|
||||
sde g- -d
|
||||
sdf f- -p-d
|
||||
sdl l- -d
|
||||
set w- -w+a
|
||||
sig -- -p-p+p+p
|
||||
sil l- -w
|
||||
sim -- -w
|
||||
sli w- -w-a+a
|
||||
slu w- -w-a+a
|
||||
sri w- -w-a+a
|
||||
sru w- -w-a+a
|
||||
ste g- -w
|
||||
stf f- -p-w
|
||||
sti o- -p-a
|
||||
stl l- -w
|
||||
str r- -p
|
||||
sts w- -a-p-x
|
||||
teq -- -w+w
|
||||
tge -- -w+w
|
||||
tgt -- -w+w
|
||||
tle -- -w+w
|
||||
tlt -- -w+w
|
||||
tne -- -w+w
|
||||
trp -p -w+?
|
||||
xor w- -a-a+a
|
||||
zeq bc -w
|
||||
zer w- +a
|
||||
zge bc -w
|
||||
zgt bc -w
|
||||
zle bc -w
|
||||
zlt bc -w
|
||||
zne bc -w
|
||||
zre g- 0
|
||||
zrf w- +a
|
||||
zrl l- 0
|
||||
|
||||
@@ -50,7 +50,7 @@ lae 2 120
|
||||
lae sw 7 121
|
||||
lal P2 128
|
||||
lal N2 129
|
||||
lal m 1 130
|
||||
lal mP 1 130
|
||||
lal mN 1 131
|
||||
lal swP 1 132
|
||||
lal swN 2 133
|
||||
|
||||
71
etc/new_table
Executable file
71
etc/new_table
Executable file
@@ -0,0 +1,71 @@
|
||||
h=${1-.}
|
||||
d=${2-.}
|
||||
|
||||
set `grep fpseu em_table`
|
||||
p=$2
|
||||
set `grep fmnem em_table`
|
||||
m=$2
|
||||
|
||||
ed - em_table <<'A' > X
|
||||
1,/^$/g/ /s// /gp
|
||||
A
|
||||
|
||||
ed - em_table <<'A' | awk '{print $1,$2+'$p'}' > Y
|
||||
1,/^$/d
|
||||
1,/^$/g/ /s// /gp
|
||||
A
|
||||
|
||||
ed - em_table <<'A' | awk '{print $0,'$m'+i++}' > Z
|
||||
1,/^$/d
|
||||
1,/^$/d
|
||||
1,/^$/g/ /s// /gp
|
||||
A
|
||||
|
||||
i=`wc -l <Y`
|
||||
echo 'lpseu' `expr $i + $p - 1` >>X
|
||||
i=`wc -l <Z`
|
||||
echo 'lmnem' `expr $i + $m - 1` >>X
|
||||
|
||||
ed - X <<'A' > $h/em_spec.h
|
||||
g/^/s//#define sp_/p
|
||||
A
|
||||
|
||||
ed - Y <<'A' > $h/em_pseu.h
|
||||
g/\(.*\) \(.*\)/s//#define ps_\1 \2/p
|
||||
A
|
||||
|
||||
ed - Z <<'A' > $h/em_mnem.h
|
||||
g/ .* /s// /
|
||||
g/\(.*\) \(.*\)/s//#define op_\1 \2/p
|
||||
A
|
||||
|
||||
(
|
||||
echo 'char em_pseu[][4] = {'
|
||||
ed - Y <<'A'
|
||||
g/\(...\).*/s// "\1",/p
|
||||
A
|
||||
echo '};'
|
||||
) > $d/em_pseu.c
|
||||
|
||||
(
|
||||
echo 'char em_mnem[][4] = {'
|
||||
ed - Z <<'A'
|
||||
g/\(...\).*/s// "\1",/p
|
||||
A
|
||||
echo '};'
|
||||
) > $d/em_mnem.c
|
||||
|
||||
(
|
||||
echo '#include <em_flag.h>
|
||||
char em_flag[] = {'
|
||||
ed - Z <<'A' | tr a-z A-Z
|
||||
g/^... /s///
|
||||
g/ .*/s///
|
||||
g/\(.\)\(.\)/s//PAR_\1 | FLO_\2/
|
||||
g/-/s//NO/g
|
||||
g/.*/s// &,/p
|
||||
A
|
||||
echo '};'
|
||||
) > $d/em_flag.c
|
||||
|
||||
rm X Y Z
|
||||
289
etc/pc_errors
Normal file
289
etc/pc_errors
Normal file
@@ -0,0 +1,289 @@
|
||||
non-standard feature used
|
||||
identifier '%s' declared twice
|
||||
end of file encountered
|
||||
bad line directive
|
||||
unsigned real: digit of fraction expected
|
||||
unsigned real: digit of exponent expected
|
||||
unsigned real: too many digits (>72)
|
||||
unsigned integer: too many digits (>72)
|
||||
unsigned integer: overflow (>32767)
|
||||
string constant: must not exceed one line
|
||||
string constant: at least one character expected
|
||||
string constant: double quotes not allowed (see c option)
|
||||
string constant: too long (>72 chars)
|
||||
bad character
|
||||
identifier '%s' not declared
|
||||
location counter overflow: arrays too big
|
||||
location counter overflow: arrays too big
|
||||
arraysize too big
|
||||
variable '%s' never used
|
||||
variable '%s' never assigned
|
||||
the files contained in '%s' are not closed automatically
|
||||
constant expected
|
||||
constant: only integers and reals may be signed
|
||||
constant: out of bounds
|
||||
simple type expected
|
||||
enumerated type: element identifier expected
|
||||
enumerated type: ',' or ')' expected
|
||||
enumerated type: ',' expected
|
||||
enumerated type: ')' expected
|
||||
subrange type: type must be scalar, but not real
|
||||
subrange type: '..' expected
|
||||
subrange type: type of lower and upper bound incompatible
|
||||
subrange type: lower bound exceeds upper bound
|
||||
array type: '[' expected
|
||||
conformant array: low bound identifier expected
|
||||
conformant array: '..' expected
|
||||
conformant array: high bound identifier expected
|
||||
conformant array: ':' expected
|
||||
conformant array: index type identifier expected
|
||||
array type: index type not bounded
|
||||
array type: index separator or ']' expected
|
||||
array type: index separator expected
|
||||
array type: ']' expected
|
||||
array type: 'of' expected
|
||||
record variant part: tag type identifier expected
|
||||
record variant part: tag type identifier expected
|
||||
record variant part: type must be bounded
|
||||
record variant part: 'of' expected
|
||||
record variant: type of case label and tag incompatible
|
||||
record variant: multiple defined case label
|
||||
record variant: ',' or ':' expected
|
||||
record variant: ',' expected
|
||||
record variant: ':' expected
|
||||
record variant: '(' expected
|
||||
record variant: ')' expected
|
||||
record variant part: ';' or end of variant list expected
|
||||
record variant part: ';' expected
|
||||
record variant part: end of variant list expected
|
||||
record variant part: there must be a variant for each tag value
|
||||
field list: record section expected
|
||||
record section: field identifier expected
|
||||
record section: ',' or ':' expected
|
||||
record section: ',' expected
|
||||
record section: ':' expected
|
||||
field list: ';' or end of record section list expected
|
||||
field list: ';' expected
|
||||
field list: end of record section list expected
|
||||
type expected
|
||||
type: simple and pointer type may not be packed
|
||||
pointer type: type identifier expected
|
||||
pointer type: type identifier expected
|
||||
record type: 'end' expected
|
||||
set type: 'of' expected
|
||||
set type: too many elements in set
|
||||
set type: bad subrange of integer
|
||||
set of integer: the i option dictates the number of bits (default 16)
|
||||
set type: base type not bounded
|
||||
file type: 'of' expected
|
||||
file type: files within files not allowed
|
||||
var parameter: type identifier or conformant array expected
|
||||
var parameter: type identifier expected
|
||||
label declaration: unsigned integer expected
|
||||
label declaration: label '%i' multiple declared
|
||||
label declaration: ',' or ';' expected
|
||||
label declaration: ',' expected
|
||||
label declaration: ';' expected
|
||||
const declaration: constant identifier expected
|
||||
const declaration: '=' expected
|
||||
const declaration: ';' expected
|
||||
const declaration: constant identifier or 'type', 'var', 'procedure', 'function' or 'begin' expected
|
||||
type declaration: type identifier expected
|
||||
type declaration: '=' expected
|
||||
type declaration: ';' expected
|
||||
type declaration: type identifier or 'var', 'procedure', 'function' or 'begin' expected
|
||||
var declaration: var identifier expected
|
||||
var declaration: ',' or ':' expected
|
||||
var declaration: ',' expected
|
||||
var declaration: ':' expected
|
||||
var declaration: ';' expected
|
||||
var declaration: var identifier or 'procedure', 'function' or 'begin' expected
|
||||
parameter list: 'var','procedure','function' or identifier expected
|
||||
parameter list: parameter identifier expected
|
||||
parameter list: ',' or ':' expected
|
||||
parameter list: ',' expected
|
||||
parameter list: ':' expected
|
||||
parameter list: type identifier expected
|
||||
parameter list: ';' or ')' expected
|
||||
parameter list: ';' expected
|
||||
proc/func declaration: proc/func identifier expected
|
||||
proc/func declaration: previous declaration of '%s' was not forward
|
||||
proc/func declaration: parameter list expected
|
||||
parameterlist: ')' expected
|
||||
func declaration: ':' expected
|
||||
func declaration: result type identifier expected
|
||||
func declaration: result type must be scalar, subrange or pointer
|
||||
proc/func declaration: ';' expected
|
||||
proc/func declaration: block or directive expected
|
||||
proc/func declaration: '%s' unknown directive
|
||||
proc/func declaration: '%s' again forward declared
|
||||
proc/func declaration: ';' expected
|
||||
indexed variable: '[' only allowed following array variables
|
||||
indexed variable: index type not compatible with declaration
|
||||
indexed variable: ',' or ']' expected
|
||||
indexed variable: ',' expected
|
||||
assignment: standard function not allowed as destination
|
||||
assignment: cannot store the function result
|
||||
assignment: formal parameter function not allowed as destination
|
||||
assignment: function identifier may not be de-referenced
|
||||
variable: '[', '.', '^' or end of variable expected
|
||||
indexed variable: ']' expected
|
||||
field designator: field identifier expected
|
||||
field designator: '.' only allowed following record variables
|
||||
field designator: no field '%s' in this record
|
||||
referenced variable: '^' not allowed following zero-terminated strings
|
||||
referenced variable: '^' only allowed following pointer or file variables
|
||||
variable: var or field identifier expected
|
||||
call: too many actual parameters supplied
|
||||
call: proc/func identifier expected
|
||||
call: standard proc/func may not be used as parameter
|
||||
call: parameter lists of actual and formal proc/func incompatible
|
||||
call: type of actual and formal value parameter not compatible
|
||||
call: array parameter not conformable
|
||||
call: type of actual and formal variable parameter not similar
|
||||
call: packed elements not allowed as variable parameter
|
||||
call: ',' or ')' expected
|
||||
call: too few actual parameters supplied
|
||||
read(ln): type must be integer, char or real
|
||||
write(ln): type must be integer, char, real, string or boolean
|
||||
write(ln): ':', ',' or ')' expected
|
||||
write(ln): field width must be integer
|
||||
write(ln): ':', ',' or ')' expected
|
||||
write(ln): precision must be integer
|
||||
write(ln): precision may only be specified for reals
|
||||
read/write: too few actual parameters supplied
|
||||
read/write: standard input/output not mentioned in program heading
|
||||
read/write: ',' or ')' expected
|
||||
read/write: type of parameter not the same as that of the file elements
|
||||
read/write: parameter list expected
|
||||
readln/writeln: standard input/output not mentioned in program heading
|
||||
readln/writeln: only allowed on text files
|
||||
new/dispose: C-type strings not allowed here
|
||||
new/dispose: ',' or ')' expected
|
||||
new/dispose: too many actual parameters supplied
|
||||
new/dispose: type of tagfield value is incompatible with declaration
|
||||
call: '(' or end of call expected
|
||||
standard proc/func: parameter list expected
|
||||
standard input/output not mentioned in program heading
|
||||
file variable expected
|
||||
pointer variable expected
|
||||
pack: ',' expected
|
||||
pack: ',' expected
|
||||
unpack: ',' expected
|
||||
unpack: ',' expected
|
||||
standard proc/func: parameter type incompatible with specification
|
||||
eoln/page: text file variable expected
|
||||
pack/unpack: array types are incompatible
|
||||
pack/unpack: only for arrays
|
||||
abs: integer or real expected
|
||||
sqr: integer or real expected
|
||||
ord: type must be scalar or subrange, but not real
|
||||
pred/succ: type must be scalar or subrange, but not real
|
||||
trunc/round: real argument required
|
||||
call: ')' expected
|
||||
expression: left and right operand are incompatible
|
||||
set: incompatible elements
|
||||
set: base type must be bounded or of type integer
|
||||
set: base type upper bound exceeds maximum set element number
|
||||
set: element out of range
|
||||
set: ']' or element list expected
|
||||
set: '..', ',' or ']' expected
|
||||
set: ',' or ']' expected
|
||||
set: ',' expected
|
||||
factor expected
|
||||
factor: ')' expected
|
||||
factor: type of factor must be boolean
|
||||
set: ']' expected
|
||||
term: multiplying operator or end of term expected
|
||||
term: '*' only defined for integers, reals and sets
|
||||
term: '/' only defined for integers and reals
|
||||
term: 'div' only defined for integers
|
||||
term: 'mod' only defined for integers
|
||||
term: 'and' only defined for booleans
|
||||
simple expression: only integers and reals may be signed
|
||||
simple expression: adding operator or end of simple expression expected
|
||||
simple expression: '+' only defined for integers, reals and sets
|
||||
simple expression: '-' only defined for integers, reals and sets
|
||||
simple expression: 'or' only defined for booleans
|
||||
expression: relational operator or end of expression expected
|
||||
expression: set expected
|
||||
expression: left operand of 'in' not compatible with base type of right operand
|
||||
expression: only '=' and '<>' allowed on pointers
|
||||
expression: '<' and '>' not allowed on sets
|
||||
expression: comparison of arrays only allowed for strings
|
||||
expression: comparison of records not allowed
|
||||
expression: comparison of files not allowed
|
||||
assignment: ':=' expected
|
||||
assignment: left and right hand side incompatible
|
||||
goto statement: unsigned integer expected
|
||||
goto statement: label '%i' not declared
|
||||
if statement: type of expression must be boolean
|
||||
if statement: 'then' expected
|
||||
if statement: 'else' or end of if statement expected
|
||||
case statement: type must be scalar or subrange, but not real
|
||||
case statement: 'of' expected
|
||||
case statement: incompatible case label
|
||||
case statement: multiple defined case label
|
||||
case statement: ',' or ':' expected
|
||||
case statement: ',' expected
|
||||
case statement: ':' expected
|
||||
case statement: ';' or 'end' expected
|
||||
case statement: ';' expected
|
||||
case statement: 'end' expected
|
||||
repeat statement: ';' or 'until' expected
|
||||
repeat statement: ';' expected
|
||||
repeat statement: 'until' expected
|
||||
repeat statement: type of expression must be boolean
|
||||
while statement: type of expression must be boolean
|
||||
while statement: 'do' expected
|
||||
for statement: type of bound and control variable incompatible
|
||||
for statement: control variable expected
|
||||
for statement: control variable must be local
|
||||
for statement: type must be scalar or subrange, but not real
|
||||
for statement: ':=' expected
|
||||
for statement: 'to' or 'downto' expected
|
||||
for statement: upper bound not assignment compatible
|
||||
for statement: 'do' expected
|
||||
with statement: record variable expected
|
||||
with statement: ',' or 'do' expected
|
||||
with statement: ',' expected
|
||||
with statement: 'do' expected
|
||||
assertion: type of expression must be boolean
|
||||
statement expected
|
||||
label '%i' not declared
|
||||
label '%i' multiple defined
|
||||
statement: ':' expected
|
||||
unlabeled statement expected
|
||||
compound statement: ';' or 'end' expected
|
||||
compound statement: ';' expected
|
||||
compound statement: 'end' expected
|
||||
case statement: 'end' expected
|
||||
body: ';' or 'end' expected
|
||||
body: ';' expected
|
||||
body: label '%i' declared, but never defined
|
||||
program parameter '%s' not declared
|
||||
function '%s' never assigned
|
||||
block: declaration or body expected
|
||||
block: 'const', 'type', 'var', 'procedure', 'function' or 'begin' expected
|
||||
block: 'type', 'var', 'procedure', 'function' or 'begin' expected
|
||||
block: 'var', 'procedure', 'function' or 'begin' expected
|
||||
block: 'procedure', 'function' or 'begin' expected
|
||||
block: unsatisfied forward proc/func declaration(s)
|
||||
block: 'begin' expected
|
||||
block: 'end' expected
|
||||
program heading: 'program' expected
|
||||
program heading: program identifier expected
|
||||
program heading: file identifier list expected
|
||||
program heading: file identifier expected
|
||||
program heading: ',' or ')' expected
|
||||
program heading: ',' expected
|
||||
program heading: maximum number of file arguments exceeded (12)
|
||||
program heading: ')' expected
|
||||
program heading: ';' expected
|
||||
program: '.' expected
|
||||
'program' expected
|
||||
module: 'const', 'type', 'var', 'procedure' or 'function' expected
|
||||
module: 'type', 'var', 'procedure' or 'function' expected
|
||||
module: 'var', 'procedure' or 'function' expected
|
||||
module: 'procedure' or 'function' expected
|
||||
garbage at end of program
|
||||
107
etc/pc_rt_errors
Normal file
107
etc/pc_rt_errors
Normal file
@@ -0,0 +1,107 @@
|
||||
array bound error
|
||||
range bound error
|
||||
set bound error
|
||||
integer overflow
|
||||
real overflow
|
||||
real underflow
|
||||
divide by 0
|
||||
divide by 0.0
|
||||
undefined integer
|
||||
real undefined
|
||||
conversion error
|
||||
error 11
|
||||
error 12
|
||||
error 13
|
||||
error 14
|
||||
error 15
|
||||
stack overflow
|
||||
heap error
|
||||
illegal instruction
|
||||
odd or zero byte count
|
||||
case error
|
||||
memory fault
|
||||
bad pointer
|
||||
bad program counter
|
||||
bad external address
|
||||
bad monitor call
|
||||
bad line number
|
||||
error 27
|
||||
error 28
|
||||
error 29
|
||||
error 30
|
||||
error 31
|
||||
error 32
|
||||
error 33
|
||||
error 34
|
||||
error 35
|
||||
error 36
|
||||
error 37
|
||||
error 38
|
||||
error 39
|
||||
error 40
|
||||
error 41
|
||||
error 42
|
||||
error 43
|
||||
error 44
|
||||
error 45
|
||||
error 46
|
||||
error 47
|
||||
error 48
|
||||
error 49
|
||||
error 50
|
||||
error 51
|
||||
error 52
|
||||
error 53
|
||||
error 54
|
||||
error 55
|
||||
error 56
|
||||
error 57
|
||||
error 58
|
||||
error 59
|
||||
error 60
|
||||
error 61
|
||||
error 62
|
||||
error 63
|
||||
more args expected
|
||||
error in exp
|
||||
error in ln
|
||||
error in sqrt
|
||||
assertion failed
|
||||
array bound error in pack
|
||||
array bound error in unpack
|
||||
only positive j in 'i mod j'
|
||||
file not yet open
|
||||
dispose error
|
||||
error 74
|
||||
error 75
|
||||
error 76
|
||||
error 77
|
||||
error 78
|
||||
error 79
|
||||
error 80
|
||||
error 81
|
||||
error 82
|
||||
error 83
|
||||
error 84
|
||||
error 85
|
||||
error 86
|
||||
error 87
|
||||
error 88
|
||||
error 89
|
||||
error 90
|
||||
error 91
|
||||
error 92
|
||||
error 93
|
||||
error 94
|
||||
error 95
|
||||
not writable
|
||||
not readable
|
||||
end of file
|
||||
truncated
|
||||
reset error
|
||||
rewrite error
|
||||
close error
|
||||
read error
|
||||
write error
|
||||
digit expected
|
||||
non-ASCII char read
|
||||
15
etc/pop_push
Normal file
15
etc/pop_push
Normal file
@@ -0,0 +1,15 @@
|
||||
description of third column of em_table:
|
||||
|
||||
-: pop item indicated by next character
|
||||
+: push item indicated by next character
|
||||
0: no effect on the stack
|
||||
|
||||
characters describing items:
|
||||
|
||||
w: target machine word (1, 2 or 4)
|
||||
d: double target machine word (2, 4 or 8)
|
||||
p: target machine address
|
||||
a: item with size specified in argument
|
||||
x: item with size specified by top item of stack
|
||||
y: item with size specified by second item on stack
|
||||
?: one or more items of unknown size
|
||||
28
etc/traps
Normal file
28
etc/traps
Normal file
@@ -0,0 +1,28 @@
|
||||
~ Array bound error
|
||||
~ Range bound error
|
||||
~ Set bound error
|
||||
~ Integer overflow
|
||||
~ Floating overflow
|
||||
~ Floating underflow
|
||||
~ Divide by 0
|
||||
~ Divide by 0.0
|
||||
~ Integer undefined
|
||||
~ Floating undefined
|
||||
~ Conversion error
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
* Stack overflow
|
||||
* Heap overflow
|
||||
* Illegal instruction
|
||||
* Illegal odd or zero argument
|
||||
* Case error
|
||||
* Addressing non existent memory
|
||||
* Bad pointer used
|
||||
* Program counter out of range
|
||||
* Bad argument of LAE
|
||||
* Bad monitor call
|
||||
* Argument of LIN too high
|
||||
* Bad GTO descriptor
|
||||
32
first/ckpath
Normal file
32
first/ckpath
Normal file
@@ -0,0 +1,32 @@
|
||||
rm -f ../bin/x_tpath x_tpath
|
||||
echo "echo $$" >../bin/x_tpath
|
||||
rm -f x_tpath
|
||||
chmod +x ../bin/x_tpath
|
||||
case x`(x_tpath) 2>/dev/null`
|
||||
in
|
||||
x$$)
|
||||
STAT=0 ;;
|
||||
x)
|
||||
(cd ../bin ; echo Sorry, `pwd` is not in your shell PATH" ($PATH)")
|
||||
STAT=1 ;;
|
||||
*)
|
||||
echo "Sorry, there is something wrong with your PATH ($PATH)" ;;
|
||||
esac
|
||||
echo "echo l_$$" >x_tpath
|
||||
chmod +x x_tpath
|
||||
case x`(x_tpath) 2>/dev/null`
|
||||
in
|
||||
xl_$$)
|
||||
;;
|
||||
x)
|
||||
(cd ../bin ; echo Sorry, . is not in your shell PATH" ($PATH)")
|
||||
STAT=2 ;;
|
||||
x$$)
|
||||
echo Sorry, . is not in your PATH" ($PATH)" or after the ACK bin directory
|
||||
STAT=3 ;;
|
||||
*)
|
||||
echo "Sorry, there is something wrong with your PATH ($PATH)"
|
||||
STAT=4 ;;
|
||||
esac
|
||||
rm -f ../bin/x_tpath x_tpath
|
||||
exit $STAT
|
||||
7
first/did_first
Executable file
7
first/did_first
Executable file
@@ -0,0 +1,7 @@
|
||||
if (ack_sys ) >/dev/null 2>&1
|
||||
then
|
||||
exit 0
|
||||
else
|
||||
echo "You need to run 'first' first"
|
||||
exit 1
|
||||
fi
|
||||
7
first/em_path.h.src
Normal file
7
first/em_path.h.src
Normal file
@@ -0,0 +1,7 @@
|
||||
/* Intended as a common directory for ALL temporary files */
|
||||
#define TMP_DIR "/usr/tmp"
|
||||
|
||||
/* Access to the ACK tree and parts thereof */
|
||||
#define EM_DIR "/usr/em" /* The root directory for EM stuff */
|
||||
#define RTERR_PATH "etc/pc_rt_errors"
|
||||
#define ACK_PATH "lib/descr"
|
||||
146
first/first
Executable file
146
first/first
Executable file
@@ -0,0 +1,146 @@
|
||||
: check $PATH first
|
||||
if sh ckpath
|
||||
then :
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
: check write-ability of /tmp and /usr/tmp
|
||||
if ( >/usr/tmp/aaax.$$ )
|
||||
then
|
||||
rm /usr/tmp/aaax.$$
|
||||
else
|
||||
echo /usr/tmp must exist and be writable.
|
||||
exit 2
|
||||
fi
|
||||
if ( >/tmp/aaax.$$ )
|
||||
then
|
||||
rm /tmp/aaax.$$
|
||||
else
|
||||
echo /tmp must exist and be writable.
|
||||
exit 2
|
||||
fi
|
||||
: set ACK HOME Directory in ../h/em_path.h
|
||||
rm -f em_path.h
|
||||
sed -e "/^#define[ ]*EM_DIR/s@\".*\"@\"`cd .. ; pwd`\"@" <../h/em_path.h >em_path.h
|
||||
if cmp ../h/em_path.h em_path.h >/dev/null 2>&1
|
||||
then
|
||||
: Don't touch ../h/em_path.h, it's already correct
|
||||
else
|
||||
rm -f ../h/em_path.h
|
||||
if mv em_path.h ../h >/dev/null 2>&1
|
||||
then : success
|
||||
else
|
||||
echo "Sorry, can't replace ../h/em_path.h"
|
||||
exit 7
|
||||
fi
|
||||
fi
|
||||
: remove non-system as and ld from descr files
|
||||
if (ack_sys) >/dev/null 2>&1
|
||||
then
|
||||
: echo Your system is: `ack_sys`.
|
||||
else
|
||||
echo -n "Give me the type of your system, the current choice is:
|
||||
pdp_v7 PDP11 with sep I/D and version 7
|
||||
vax_bsd4_1a VAX11 with BSD4.1a
|
||||
vax_bsd4_1c VAX11 with BSD4.1c
|
||||
vax_bsd4_2 VAX11 with BSD4.2
|
||||
pc_ix IBM PC with PC/IX
|
||||
m68_unisoft Motorola 68000 with Unisoft UNIX
|
||||
ANY Neither of the above
|
||||
|
||||
system type: "
|
||||
if read SYSNAME
|
||||
then
|
||||
echo echo "$SYSNAME" >../bin/ack_sys
|
||||
chmod +x ../bin/ack_sys
|
||||
case `ack_sys` in
|
||||
pdp_v7|vax_bsd4_1[ac]|vax_bsd4_2|pc_ix|m68_unisoft) ;;
|
||||
*) echo None of the software especially intended for the named systems will work ;;
|
||||
esac
|
||||
else
|
||||
echo Sorry, got EOF when reading system name.
|
||||
exit 8
|
||||
fi
|
||||
fi
|
||||
echo -n "Your system is `ack_sys`, are you satisfied with that? (y/n) "
|
||||
if read YESNO
|
||||
then
|
||||
case $YESNO in
|
||||
j*|y*) ;;
|
||||
n*) echo Ok, I will give you another chance....
|
||||
rm -f ../bin/ack_sys
|
||||
exec sh $0
|
||||
;;
|
||||
*) echo "I do not understand your answer ($YESNO). Bye"
|
||||
exit 9
|
||||
;;
|
||||
esac
|
||||
else
|
||||
echo Sorry, got EOF when reading your answer.
|
||||
exit 9
|
||||
fi
|
||||
: "Take action according to the system used"
|
||||
: 'Prevent the use of the system assembler on for certain systems'
|
||||
case `ack_sys` in
|
||||
vax_bsd*) RMD=pdp ;;
|
||||
pdp_*) RMD="vax2 vax4" ;;
|
||||
*) RMD="pdp vax2 vax4" ;;
|
||||
esac
|
||||
for i in $RMD
|
||||
do
|
||||
( cd ../lib/$i
|
||||
if grep '^name as$' descr >/dev/null 2>&1
|
||||
then
|
||||
cp descr descr.orig
|
||||
ed - descr <<'ABC'
|
||||
/^name as$/;/^end$/d
|
||||
/^name ld$/;/^end$/d
|
||||
w
|
||||
q
|
||||
ABC
|
||||
fi
|
||||
)
|
||||
done
|
||||
: 'Set the default machine in ../h/local.h'
|
||||
case `ack_sys` in
|
||||
pdp_v7) ACM=pdp ;;
|
||||
vax_bsd4_1[ac]) ACM=vax2 ;;
|
||||
vax_bsd4_2) ACM=vax2 ;;
|
||||
pc_ix) ACM=ix ;;
|
||||
m68_unisoft) ACM=m68k2 ;;
|
||||
*) ACM=m68k2 ;;
|
||||
esac
|
||||
rm -f local.h
|
||||
sed /ACKM/s/'".*"'/'"'$ACM'"'/ <../h/local.h >local.h
|
||||
if cmp -s ../h/local.h local.h
|
||||
then :
|
||||
else
|
||||
cp local.h ../h
|
||||
rm -f local.h
|
||||
fi
|
||||
echo "Your default machine to compile for is $ACM"
|
||||
case `ack_sys` in
|
||||
vax_bsd4_*)
|
||||
echo 'Installing the include directory in lib/vax2'
|
||||
( cd ../lib/vax2 ; sh fetch_inc )
|
||||
echo Done
|
||||
case `ack_sys` in
|
||||
vax_bsd4_1a) VERS=BSD41a ;;
|
||||
vax_bsd4_1c) VERS=BSD41c ;;
|
||||
vax_bsd4_2) VERS=BSD42 ;;
|
||||
*) echo "Unknown VAX BSD version, look at mach/vax[24]/libem"
|
||||
break ;;
|
||||
esac
|
||||
for i in vax2 vax4
|
||||
do (
|
||||
cd ../mach/$i/libem
|
||||
ed - system.h <<ABC
|
||||
g/^#/s/.*/\/* & *\//
|
||||
/$VERS/s/^.*#/#/
|
||||
/$VERS/s/*\/.*$//
|
||||
w
|
||||
q
|
||||
ABC
|
||||
) done
|
||||
echo 'mach/vax[24]/libem/system.h reflects your BSD version.'
|
||||
esac
|
||||
7
first/local.h.src
Normal file
7
first/local.h.src
Normal file
@@ -0,0 +1,7 @@
|
||||
/* collection of options, selected by including or excluding 'defines' */
|
||||
|
||||
/* Version number of the EM object code */
|
||||
# define VERSION 3 /* 16 bits number */
|
||||
|
||||
/* The default machine used by ack, acc, apc */
|
||||
# define ACKM "pdp"
|
||||
10
h/Makefile
Normal file
10
h/Makefile
Normal file
@@ -0,0 +1,10 @@
|
||||
install cmp:
|
||||
|
||||
opr:
|
||||
make pr | opr
|
||||
|
||||
pr:
|
||||
@pr Makefile *.h
|
||||
|
||||
clean:
|
||||
-rm -f *.old
|
||||
12
h/arch.h
Normal file
12
h/arch.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#define ARMAG 0177545
|
||||
struct ar_hdr {
|
||||
char ar_name[14];
|
||||
long ar_date;
|
||||
char ar_uid;
|
||||
char ar_gid;
|
||||
int ar_mode;
|
||||
long ar_size;
|
||||
};
|
||||
|
||||
#define AR_TOTAL 26
|
||||
#define AR_SIZE 22
|
||||
1
h/as_spec.h
Normal file
1
h/as_spec.h
Normal file
@@ -0,0 +1 @@
|
||||
#define as_magic (sp_magic|(14<<8))
|
||||
29
h/bc_io.h
Normal file
29
h/bc_io.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#include <stdio.h>
|
||||
|
||||
/* $Header$ */
|
||||
|
||||
/* BASIC file io definitions */
|
||||
|
||||
extern FILE *_chanrd;
|
||||
extern FILE *_chanwr;
|
||||
extern int _chann;
|
||||
/* BASIC file descriptor table */
|
||||
/* Channel assignment:
|
||||
-1 terminal IO
|
||||
0 data file
|
||||
1-15 user files
|
||||
*/
|
||||
|
||||
/* FILE MODES:*/
|
||||
#define IMODE 1
|
||||
#define OMODE 2
|
||||
#define RMODE 3
|
||||
|
||||
typedef struct {
|
||||
char *fname;
|
||||
FILE *fd;
|
||||
int pos;
|
||||
int mode;
|
||||
int reclength;
|
||||
}Filedesc;
|
||||
extern Filedesc _fdtable[16];
|
||||
17
h/bc_string.h
Normal file
17
h/bc_string.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#
|
||||
|
||||
/* $Header$ */
|
||||
|
||||
/* Strings are allocated in a fixed string descriptor table
|
||||
** This mechanism is used to avoid string copying as much as possible
|
||||
*/
|
||||
|
||||
typedef struct{
|
||||
char *strval;
|
||||
int strcount;
|
||||
int strlength;
|
||||
} String;
|
||||
|
||||
String *_newstr() ;
|
||||
|
||||
#define MAXSTRING 1024
|
||||
156
h/cg_pattern.h
Normal file
156
h/cg_pattern.h
Normal file
@@ -0,0 +1,156 @@
|
||||
/* offsets of interesting fields in EM-pattern */
|
||||
|
||||
#define PO_HASH 0
|
||||
#define PO_NEXT 1
|
||||
#define PO_MATCH 3
|
||||
|
||||
#define ILLHASH 0177777
|
||||
|
||||
/* Escapes in printstrings */
|
||||
|
||||
#define PR_TOK '\001'
|
||||
#define PR_TOKFLD '\002'
|
||||
#define PR_EMINT '\003'
|
||||
#define PR_EMSTR '\004'
|
||||
#define PR_ALLREG '\005'
|
||||
#define PR_SUBREG '\006'
|
||||
/*
|
||||
* In case this list gets longer remember to keep out printable nonprintables
|
||||
* like \t \n \r and the like.
|
||||
*/
|
||||
|
||||
/* Commands for codegenerator, in low order 5 bits of byte */
|
||||
|
||||
#define DO_NEXTEM 0
|
||||
#define DO_MATCH 1
|
||||
#define DO_XMATCH 2
|
||||
#define DO_XXMATCH 3
|
||||
#define DO_REMOVE 4
|
||||
#define DO_DEALLOCATE 5
|
||||
#define DO_REALLOCATE 6
|
||||
#define DO_ALLOCATE 7
|
||||
#define DO_LOUTPUT 8
|
||||
#define DO_ROUTPUT 9
|
||||
#define DO_MOVE 10
|
||||
#define DO_ERASE 11
|
||||
#define DO_TOKREPLACE 12
|
||||
#define DO_EMREPLACE 13
|
||||
#define DO_COST 14
|
||||
#define DO_RETURN 15
|
||||
#define DO_COERC 16
|
||||
#define DO_PRETURN 17
|
||||
#define DO_RREMOVE 18
|
||||
|
||||
typedef struct instance {
|
||||
int in_which;
|
||||
# define IN_COPY 1
|
||||
# define IN_RIDENT 2
|
||||
# define IN_ALLOC 3
|
||||
# define IN_DESCR 4
|
||||
# define IN_REGVAR 5
|
||||
int in_info[TOKENSIZE+1];
|
||||
} inst_t,*inst_p;
|
||||
|
||||
typedef struct {
|
||||
int c_size; /* index in enode-table */
|
||||
int c_time; /* dito */
|
||||
} cost_t,*cost_p;
|
||||
|
||||
typedef struct {
|
||||
int m_set1; /* number of tokenexpr in move: from */
|
||||
int m_expr1; /* optional expression */
|
||||
int m_set2; /* number of tokenexpr in move: to */
|
||||
int m_expr2; /* optional expression */
|
||||
int m_cindex; /* code index to really do it */
|
||||
cost_t m_cost; /* associated cost */
|
||||
} move_t, *move_p;
|
||||
|
||||
typedef struct {
|
||||
int set_size;
|
||||
short set_val[SETSIZE];
|
||||
} set_t,*set_p;
|
||||
|
||||
struct exprnode {
|
||||
short ex_operator;
|
||||
short ex_lnode;
|
||||
short ex_rnode;
|
||||
};
|
||||
typedef struct exprnode node_t;
|
||||
typedef struct exprnode *node_p;
|
||||
|
||||
typedef struct { /* to stack coercions */
|
||||
int c1_texpno; /* token expression number */
|
||||
int c1_expr; /* boolean expression */
|
||||
int c1_prop; /* property of register needed */
|
||||
int c1_codep; /* code index */
|
||||
cost_t c1_cost; /* cost involved */
|
||||
} c1_t,*c1_p;
|
||||
|
||||
#ifdef MAXSPLIT
|
||||
typedef struct { /* splitting coercions */
|
||||
int c2_texpno; /* token expression number */
|
||||
int c2_nsplit; /* split factor */
|
||||
int c2_repl[MAXSPLIT]; /* replacement instances */
|
||||
int c2_codep; /* code index */
|
||||
} c2_t,*c2_p;
|
||||
#endif MAXSPLIT
|
||||
|
||||
typedef struct { /* one to one coercions */
|
||||
int c3_texpno; /* token expression number */
|
||||
int c3_prop; /* property of register needed */
|
||||
int c3_repl; /* replacement instance */
|
||||
int c3_codep; /* code index */
|
||||
} c3_t,*c3_p;
|
||||
|
||||
/*
|
||||
* contents of .ex_operator
|
||||
*/
|
||||
|
||||
#define EX_TOKFIELD 0
|
||||
#define EX_ARG 1
|
||||
#define EX_CON 2
|
||||
#define EX_ALLREG 3
|
||||
#define EX_SAMESIGN 4
|
||||
#define EX_SFIT 5
|
||||
#define EX_UFIT 6
|
||||
#define EX_ROM 7
|
||||
#define EX_NCPEQ 8
|
||||
#define EX_SCPEQ 9
|
||||
#define EX_RCPEQ 10
|
||||
#define EX_NCPNE 11
|
||||
#define EX_SCPNE 12
|
||||
#define EX_RCPNE 13
|
||||
#define EX_NCPGT 14
|
||||
#define EX_NCPGE 15
|
||||
#define EX_NCPLT 16
|
||||
#define EX_NCPLE 17
|
||||
#define EX_OR2 18
|
||||
#define EX_AND2 19
|
||||
#define EX_PLUS 20
|
||||
#define EX_CAT 21
|
||||
#define EX_MINUS 22
|
||||
#define EX_TIMES 23
|
||||
#define EX_DIVIDE 24
|
||||
#define EX_MOD 25
|
||||
#define EX_LSHIFT 26
|
||||
#define EX_RSHIFT 27
|
||||
#define EX_NOT 28
|
||||
#define EX_COMP 29
|
||||
#define EX_COST 30
|
||||
#define EX_STRING 31
|
||||
#define EX_DEFINED 32
|
||||
#define EX_SUBREG 33
|
||||
#define EX_TOSTRING 34
|
||||
#define EX_UMINUS 35
|
||||
#define EX_REG 36
|
||||
#define EX_LOWW 37
|
||||
#define EX_HIGHW 38
|
||||
#define EX_INREG 39
|
||||
#define EX_REGVAR 40
|
||||
|
||||
|
||||
|
||||
#define getint(a,b) \
|
||||
if ((a=((*(b)++)&BMASK)) >= 128) {\
|
||||
a = ((a-128)<<BSHIFT) | (*(b)++&BMASK); \
|
||||
}
|
||||
154
h/cgg_cg.h
Normal file
154
h/cgg_cg.h
Normal file
@@ -0,0 +1,154 @@
|
||||
/* $Header$ */
|
||||
|
||||
/* offsets of interesting fields in EM-pattern */
|
||||
|
||||
#define PO_HASH 0
|
||||
#define PO_NEXT 1
|
||||
#define PO_MATCH 3
|
||||
|
||||
#define ILLHASH 0177777
|
||||
|
||||
|
||||
/* Commands for codegenerator, in low order 5 bits of byte */
|
||||
|
||||
#define DO_NEXTEM 0
|
||||
#define DO_MATCH 1
|
||||
#define DO_XMATCH 2
|
||||
#define DO_XXMATCH 3
|
||||
#define DO_REMOVE 4
|
||||
#define DO_DEALLOCATE 5
|
||||
#define DO_REALLOCATE 6
|
||||
#define DO_ALLOCATE 7
|
||||
#define DO_MOVE 10
|
||||
#define DO_ERASE 11
|
||||
#define DO_TOKREPLACE 12
|
||||
#define DO_EMREPLACE 13
|
||||
#define DO_COST 14
|
||||
#define DO_RETURN 15
|
||||
#define DO_COERC 16
|
||||
#define DO_PRETURN 17
|
||||
#define DO_RREMOVE 18
|
||||
#define DO_INSTR 19
|
||||
#define DO_TEST 20
|
||||
#define DO_DLINE 21
|
||||
#define DO_SETCC 22
|
||||
|
||||
#ifndef MAXATT
|
||||
#define MAXATT TOKENSIZE
|
||||
#endif
|
||||
|
||||
typedef struct instance {
|
||||
short in_which;
|
||||
# define IN_COPY 1
|
||||
# define IN_MEMB 2
|
||||
# define IN_RIDENT 3
|
||||
# define IN_ALLOC 4
|
||||
# define IN_DESCR 5
|
||||
# define IN_S_DESCR 6
|
||||
# define IN_D_DESCR 7
|
||||
short in_info[MAXATT+1];
|
||||
} inst_t,*inst_p;
|
||||
|
||||
typedef struct set {
|
||||
short set_size;
|
||||
short set_val[SETSIZE];
|
||||
} set_t,*set_p;
|
||||
|
||||
typedef struct {
|
||||
short m_set1; /* number of tokenexpr in move: from */
|
||||
short m_expr1; /* optional expression */
|
||||
short m_set2; /* number of tokenexpr in move: to */
|
||||
short m_expr2; /* optional expression */
|
||||
short m_cindex; /* code index to really do it */
|
||||
} move_t, *move_p;
|
||||
|
||||
typedef struct {
|
||||
short t_set; /* number of tokenexpr in test */
|
||||
short t_expr; /* optional expression */
|
||||
short t_cindex; /* code index to really do it */
|
||||
} test_t, *test_p;
|
||||
|
||||
struct exprnode {
|
||||
short ex_operator;
|
||||
short ex_lnode;
|
||||
short ex_rnode;
|
||||
};
|
||||
typedef struct exprnode node_t;
|
||||
typedef struct exprnode *node_p;
|
||||
|
||||
/*
|
||||
* contents of .ex_operator
|
||||
*/
|
||||
|
||||
#define EX_TOKFIELD 0
|
||||
#define EX_ARG 1
|
||||
#define EX_CON 2
|
||||
#define EX_ALLREG 3
|
||||
#define EX_SAMESIGN 4
|
||||
#define EX_SFIT 5
|
||||
#define EX_UFIT 6
|
||||
#define EX_ROM 7
|
||||
#define EX_NCPEQ 8
|
||||
#define EX_SCPEQ 9
|
||||
#define EX_RCPEQ 10
|
||||
#define EX_NCPNE 11
|
||||
#define EX_SCPNE 12
|
||||
#define EX_RCPNE 13
|
||||
#define EX_NCPGT 14
|
||||
#define EX_NCPGE 15
|
||||
#define EX_NCPLT 16
|
||||
#define EX_NCPLE 17
|
||||
#define EX_OR2 18
|
||||
#define EX_AND2 19
|
||||
#define EX_PLUS 20
|
||||
#define EX_CAT 21
|
||||
#define EX_MINUS 22
|
||||
#define EX_TIMES 23
|
||||
#define EX_DIVIDE 24
|
||||
#define EX_MOD 25
|
||||
#define EX_LSHIFT 26
|
||||
#define EX_RSHIFT 27
|
||||
#define EX_NOT 28
|
||||
#define EX_COMP 29
|
||||
#define EX_STRING 31
|
||||
#define EX_DEFINED 32
|
||||
#define EX_SUBREG 33
|
||||
#define EX_TOSTRING 34
|
||||
#define EX_UMINUS 35
|
||||
#define EX_REG 36
|
||||
#define EX_LOWW 37
|
||||
#define EX_HIGHW 38
|
||||
#define EX_INREG 39
|
||||
#define EX_REGVAR 40
|
||||
|
||||
|
||||
typedef struct { /* to stack coercions */
|
||||
short c1_texpno; /* token expression number */
|
||||
short c1_expr; /* boolean expression */
|
||||
short c1_prop; /* property of register needed */
|
||||
short c1_codep; /* code index */
|
||||
} c1_t,*c1_p;
|
||||
|
||||
#ifdef MAXSPLIT
|
||||
typedef struct { /* splitting coercions */
|
||||
short c2_texpno; /* token expression number */
|
||||
short c2_expr; /* optional boolean expression */
|
||||
short c2_nsplit; /* split factor */
|
||||
short c2_repl[MAXSPLIT];/* replacement instances */
|
||||
short c2_codep; /* code index */
|
||||
} c2_t,*c2_p;
|
||||
#endif MAXSPLIT
|
||||
|
||||
typedef struct { /* one to one coercions */
|
||||
short c3_texpno; /* token expression number */
|
||||
short c3_expr; /* boolean expression */
|
||||
short c3_prop; /* property of register needed */
|
||||
short c3_repl; /* replacement instance */
|
||||
short c3_codep; /* code index */
|
||||
} c3_t,*c3_p;
|
||||
|
||||
|
||||
#define getint(a,b) \
|
||||
if ((a=((*(b)++)&BMASK)) >= 128) {\
|
||||
a = ((a-128)<<BSHIFT) | (*(b)++&BMASK); \
|
||||
}
|
||||
30
h/em_abs.h
Normal file
30
h/em_abs.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#define LINO_AD 0
|
||||
#define FILN_AD 4
|
||||
|
||||
#define LINO (*(int *)(_hol0()+LINO_AD))
|
||||
#define FILN (*(char **)(_hol0()+FILN_AD))
|
||||
|
||||
#define EARRAY 0
|
||||
#define ERANGE 1
|
||||
#define ESET 2
|
||||
#define EIOVFL 3
|
||||
#define EFOVFL 4
|
||||
#define EFUNFL 5
|
||||
#define EIDIVZ 6
|
||||
#define EFDIVZ 7
|
||||
#define EIUND 8
|
||||
#define EFUND 9
|
||||
#define ECONV 10
|
||||
|
||||
#define ESTACK 16
|
||||
#define EHEAP 17
|
||||
#define EILLINS 18
|
||||
#define EODDZ 19
|
||||
#define ECASE 20
|
||||
#define EMEMFLT 21
|
||||
#define EBADPTR 22
|
||||
#define EBADPC 23
|
||||
#define EBADLAE 24
|
||||
#define EBADMON 25
|
||||
#define EBADLIN 26
|
||||
#define EBADGTO 27
|
||||
12
h/em_ego.h
Normal file
12
h/em_ego.h
Normal file
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* The various different hints as given after a mes ms_ego
|
||||
*
|
||||
* Yet to be stabilized
|
||||
*/
|
||||
|
||||
#define ego_live 0 /* ,offset,size,regno */
|
||||
#define ego_dead 1 /* ,offset,size,regno */
|
||||
#define ego_assoc 2 /* ,offset,size,regno */
|
||||
#define ego_unass 3 /* ,offset,size,regno */
|
||||
#define ego_init 4 /* ,offset,size,regno */
|
||||
#define ego_update 5 /* ,offset,size,regno */
|
||||
25
h/em_flag.h
Normal file
25
h/em_flag.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/* flags */
|
||||
#define EM_PAR 0017 /* parameter type */
|
||||
#define EM_FLO 0060 /* flow information */
|
||||
|
||||
/* types */
|
||||
#define PAR_NO 0000 /* no parameter */
|
||||
#define PAR_C 0001 /* constant */
|
||||
#define PAR_D 0002 /* double word constant */
|
||||
#define PAR_N 0003 /* numeric (>=0) */
|
||||
#define PAR_F 0004 /* address offset */
|
||||
#define PAR_L 0005 /* addressing locals/parameters */
|
||||
#define PAR_G 0006 /* addressing globals */
|
||||
#define PAR_W 0007 /* size: word multiple, fits word, possibly indirect */
|
||||
#define PAR_S 0010 /* size: word multiple */
|
||||
#define PAR_Z 0011 /* size: zero or word multiple */
|
||||
#define PAR_O 0012 /* size: word multiple or word fraction */
|
||||
#define PAR_P 0013 /* procedure name */
|
||||
#define PAR_B 0014 /* branch: instruction label */
|
||||
#define PAR_R 0015 /* register number (0,1,2) */
|
||||
|
||||
/* flow */
|
||||
#define FLO_NO 0000 /* straight on */
|
||||
#define FLO_C 0020 /* conditional branch */
|
||||
#define FLO_P 0040 /* procedure: call and return */
|
||||
#define FLO_T 0060 /* terminate: no return */
|
||||
21
h/em_mes.h
Normal file
21
h/em_mes.h
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* mnemonics for the message numbers in EM
|
||||
*/
|
||||
|
||||
#define ms_err 0 /* Compilation error occurred, ignore rest of module */
|
||||
#define ms_opt 1 /* Disable optimization please */
|
||||
#define ms_emx 2 /* Wordsize and pointersize assumed */
|
||||
#define ms_reg 3 /* Hint for possible register usage from frontend */
|
||||
#define ms_src 4 /* Number of source lines in this module */
|
||||
#define ms_flt 5 /* Floating point used */
|
||||
#define ms_com 6 /* Comment to be retained in compact code */
|
||||
#define ms_ret 7 /* Reserved */
|
||||
#define ms_ext 8 /* List of exported symbols from this library module */
|
||||
#define ms_par 9 /* Number of bytes of parameters accessed */
|
||||
#define ms_ego 10 /* Hint from EM Global Optimizer */
|
||||
#define ms_gto 11 /* Dangerous procedure, uses nonlocal goto */
|
||||
|
||||
/*
|
||||
* for details about ms_reg, see em_reg.h
|
||||
* for details about ms_ego, see em_ego.h
|
||||
*/
|
||||
8
h/em_ptyp.h
Normal file
8
h/em_ptyp.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#define ptyp(x) (1<<(x-sp_fspec))
|
||||
|
||||
#define cst_ptyp 0000140
|
||||
#define sym_ptyp 0000034
|
||||
#define arg_ptyp 0000574
|
||||
#define con_ptyp 0036000
|
||||
#define val_ptyp 0037777
|
||||
#define any_ptyp 0137777
|
||||
10
h/em_reg.h
Normal file
10
h/em_reg.h
Normal file
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* mes ms_reg,offset,size,type,priority
|
||||
*
|
||||
* Here are the defines for type
|
||||
*/
|
||||
|
||||
#define reg_any 0 /* Unspecified type */
|
||||
#define reg_loop 1 /* loop control variable */
|
||||
#define reg_pointer 2 /* pointer variable */
|
||||
#define reg_float 3 /* floating point variable */
|
||||
22
h/pc_err.h
Normal file
22
h/pc_err.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#define EARGC 64
|
||||
#define EEXP 65
|
||||
#define ELOG 66
|
||||
#define ESQT 67
|
||||
#define EASS 68
|
||||
#define EPACK 69
|
||||
#define EUNPACK 70
|
||||
#define EMOD 71
|
||||
#define EBADF 72
|
||||
#define EFREE 73
|
||||
|
||||
#define EWRITEF 96
|
||||
#define EREADF 97
|
||||
#define EEOF 98
|
||||
#define EFTRUNC 99
|
||||
#define ERESET 100
|
||||
#define EREWR 101
|
||||
#define ECLOSE 102
|
||||
#define EREAD 103
|
||||
#define EWRITE 104
|
||||
#define EDIGIT 105
|
||||
#define EASCII 106
|
||||
19
h/pc_file.h
Normal file
19
h/pc_file.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#define WRBIT 0100000
|
||||
#define TXTBIT 040000
|
||||
#define EOFBIT 020000
|
||||
#define ELNBIT 010000
|
||||
#define WINDOW 04000
|
||||
#define MAGIC 0252
|
||||
|
||||
struct file {
|
||||
char *ptr;
|
||||
unsigned flags;
|
||||
char *fname;
|
||||
int ufd;
|
||||
int size;
|
||||
int count;
|
||||
int buflen;
|
||||
char bufadr[512];
|
||||
};
|
||||
|
||||
#define EXTFL(z) ((struct file *)(_hbase + _extfl[z]))
|
||||
21
h/pc_size.h
Normal file
21
h/pc_size.h
Normal file
@@ -0,0 +1,21 @@
|
||||
/* fundamental */
|
||||
#define sz_byte 1
|
||||
#define sz_bool 1
|
||||
#define sz_char 1
|
||||
|
||||
/* fixed for the time being */
|
||||
#define sz_word 2
|
||||
#define sz_int 2
|
||||
#define sz_long 4
|
||||
|
||||
/* variable (see pc.c) */
|
||||
#define sz_addr sizes[0]
|
||||
#define sz_real sizes[1]
|
||||
#define sz_head sizes[2]
|
||||
#define sz_buff sizes[3]
|
||||
#define sz_mset sizes[4]
|
||||
#define sz_iset sizes[5]
|
||||
|
||||
#define sz_last 5
|
||||
|
||||
#define sz_proc 2*sz_addr
|
||||
1
include/_tail_cc/setjmp.h
Normal file
1
include/_tail_cc/setjmp.h
Normal file
@@ -0,0 +1 @@
|
||||
typedef char jmp_buf[256];
|
||||
42
include/_tail_mon/errno.h
Normal file
42
include/_tail_mon/errno.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Error codes
|
||||
*/
|
||||
|
||||
#define EPERM 1
|
||||
#define ENOENT 2
|
||||
#define ESRCH 3
|
||||
#define EINTR 4
|
||||
#define EIO 5
|
||||
#define ENXIO 6
|
||||
#define E2BIG 7
|
||||
#define ENOEXEC 8
|
||||
#define EBADF 9
|
||||
#define ECHILD 10
|
||||
#define EAGAIN 11
|
||||
#define ENOMEM 12
|
||||
#define EACCES 13
|
||||
#define EFAULT 14
|
||||
#define ENOTBLK 15
|
||||
#define EBUSY 16
|
||||
#define EEXIST 17
|
||||
#define EXDEV 18
|
||||
#define ENODEV 19
|
||||
#define ENOTDIR 20
|
||||
#define EISDIR 21
|
||||
#define EINVAL 22
|
||||
#define ENFILE 23
|
||||
#define EMFILE 24
|
||||
#define ENOTTY 25
|
||||
#define ETXTBSY 26
|
||||
#define EFBIG 27
|
||||
#define ENOSPC 28
|
||||
#define ESPIPE 29
|
||||
#define EROFS 30
|
||||
#define EMLINK 31
|
||||
#define EPIPE 32
|
||||
|
||||
/* math software */
|
||||
#define EDOM 33
|
||||
#define ERANGE 34
|
||||
|
||||
#define EQUOT 35
|
||||
21
include/_tail_mon/signal.h
Normal file
21
include/_tail_mon/signal.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#define NSIG 17
|
||||
|
||||
#define SIGHUP 1 /* hangup */
|
||||
#define SIGINT 2 /* interrupt */
|
||||
#define SIGQUIT 3 /* quit */
|
||||
#define SIGILL 4 /* illegal instruction (not reset when caught) */
|
||||
#define SIGTRAP 5 /* trace trap (not reset when caught) */
|
||||
#define SIGIOT 6 /* IOT instruction */
|
||||
#define SIGEMT 7 /* EMT instruction */
|
||||
#define SIGFPE 8 /* floating point exception */
|
||||
#define SIGKILL 9 /* kill (cannot be caught or ignored) */
|
||||
#define SIGBUS 10 /* bus error */
|
||||
#define SIGSEGV 11 /* segmentation violation */
|
||||
#define SIGSYS 12 /* bad argument to system call */
|
||||
#define SIGPIPE 13 /* write on a pipe with no one to read it */
|
||||
#define SIGALRM 14 /* alarm clock */
|
||||
#define SIGTERM 15 /* software termination signal from kill */
|
||||
|
||||
int (*signal())();
|
||||
#define SIG_DFL (int (*)())0
|
||||
#define SIG_IGN (int (*)())1
|
||||
34
lang/basic/lib/LIST
Normal file
34
lang/basic/lib/LIST
Normal file
@@ -0,0 +1,34 @@
|
||||
tail_bc.a
|
||||
abs.c
|
||||
asc.c
|
||||
asrt.c
|
||||
atn.c
|
||||
chr.c
|
||||
conversion.c
|
||||
hlt.c
|
||||
mki.c
|
||||
oct.c
|
||||
peek.c
|
||||
power.c
|
||||
exp.c
|
||||
log.c
|
||||
print.c
|
||||
io.c
|
||||
random.c
|
||||
read.c
|
||||
return.c
|
||||
sgn.c
|
||||
sin.c
|
||||
fif.e
|
||||
sqt.c
|
||||
fef.e
|
||||
stop.c
|
||||
string.c
|
||||
salloc.c
|
||||
swap.c
|
||||
trace.c
|
||||
write.c
|
||||
file.c
|
||||
error.c
|
||||
trap.c
|
||||
setline.e
|
||||
10
lang/basic/lib/abs.c
Normal file
10
lang/basic/lib/abs.c
Normal file
@@ -0,0 +1,10 @@
|
||||
/* $Header$ */
|
||||
|
||||
long _abl(i) long i;
|
||||
{
|
||||
return( i>=0?i:-i);
|
||||
}
|
||||
double _abr(f) double f;
|
||||
{
|
||||
return( f>=0.0?f: -f);
|
||||
}
|
||||
11
lang/basic/lib/asc.c
Normal file
11
lang/basic/lib/asc.c
Normal file
@@ -0,0 +1,11 @@
|
||||
#include "bc_string.h"
|
||||
|
||||
/* $Header$ */
|
||||
|
||||
int _asc(str)
|
||||
String *str;
|
||||
{
|
||||
if(str==0 || str->strval==0)
|
||||
error(3);
|
||||
return( *str->strval);
|
||||
}
|
||||
9
lang/basic/lib/asrt.c
Normal file
9
lang/basic/lib/asrt.c
Normal file
@@ -0,0 +1,9 @@
|
||||
/* $Header$ */
|
||||
|
||||
asrt(b)
|
||||
{
|
||||
if(!b){
|
||||
printf("ASSERTION ERROR\n");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
93
lang/basic/lib/atn.c
Normal file
93
lang/basic/lib/atn.c
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
*
|
||||
* This product is part of the Amsterdam Compiler Kit.
|
||||
*
|
||||
* Permission to use, sell, duplicate or disclose this software must be
|
||||
* obtained in writing. Requests for such permissions may be sent to
|
||||
*
|
||||
* Dr. Andrew S. Tanenbaum
|
||||
* Wiskundig Seminarium
|
||||
* Vrije Universiteit
|
||||
* Postbox 7161
|
||||
* 1007 MC Amsterdam
|
||||
* The Netherlands
|
||||
*
|
||||
*/
|
||||
|
||||
/* $Header$ */
|
||||
|
||||
/* Author: J.W. Stevenson */
|
||||
|
||||
/*
|
||||
floating-point arctangent
|
||||
|
||||
atan returns the value of the arctangent of its
|
||||
argument in the range [-pi/2,pi/2].
|
||||
|
||||
there are no error returns.
|
||||
|
||||
coefficients are #5077 from Hart & Cheney. (19.56D)
|
||||
*/
|
||||
|
||||
|
||||
static double sq2p1 = 2.414213562373095048802e0;
|
||||
static double sq2m1 = .414213562373095048802e0;
|
||||
static double pio2 = 1.570796326794896619231e0;
|
||||
static double pio4 = .785398163397448309615e0;
|
||||
static double p4 = .161536412982230228262e2;
|
||||
static double p3 = .26842548195503973794141e3;
|
||||
static double p2 = .11530293515404850115428136e4;
|
||||
static double p1 = .178040631643319697105464587e4;
|
||||
static double p0 = .89678597403663861959987488e3;
|
||||
static double q4 = .5895697050844462222791e2;
|
||||
static double q3 = .536265374031215315104235e3;
|
||||
static double q2 = .16667838148816337184521798e4;
|
||||
static double q1 = .207933497444540981287275926e4;
|
||||
static double q0 = .89678597403663861962481162e3;
|
||||
|
||||
/*
|
||||
xatan evaluates a series valid in the
|
||||
range [-0.414...,+0.414...].
|
||||
*/
|
||||
|
||||
static double
|
||||
xatan(arg)
|
||||
double arg;
|
||||
{
|
||||
double argsq;
|
||||
double value;
|
||||
|
||||
argsq = arg*arg;
|
||||
value = ((((p4*argsq + p3)*argsq + p2)*argsq + p1)*argsq + p0);
|
||||
value = value/(((((argsq + q4)*argsq + q3)*argsq + q2)*argsq + q1)*argsq + q0);
|
||||
return(value*arg);
|
||||
}
|
||||
|
||||
static double
|
||||
satan(arg)
|
||||
double arg;
|
||||
{
|
||||
if(arg < sq2m1)
|
||||
return(xatan(arg));
|
||||
else if(arg > sq2p1)
|
||||
return(pio2 - xatan(1/arg));
|
||||
else
|
||||
return(pio4 + xatan((arg-1)/(arg+1)));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
atan makes its argument positive and
|
||||
calls the inner routine satan.
|
||||
*/
|
||||
|
||||
double
|
||||
_atn(arg)
|
||||
double arg;
|
||||
{
|
||||
if(arg>0)
|
||||
return(satan(arg));
|
||||
else
|
||||
return(-satan(-arg));
|
||||
}
|
||||
17
lang/basic/lib/chr.c
Normal file
17
lang/basic/lib/chr.c
Normal file
@@ -0,0 +1,17 @@
|
||||
#include "bc_string.h"
|
||||
|
||||
/* $Header$ */
|
||||
|
||||
String *_chr(i)
|
||||
int i;
|
||||
{
|
||||
String *s;
|
||||
char buf[2];
|
||||
|
||||
if( i<0 || i>127)
|
||||
error(3);
|
||||
buf[0]=i;
|
||||
buf[1]=0;
|
||||
s= _newstr(buf);
|
||||
return(s);
|
||||
}
|
||||
40
lang/basic/lib/conversion.c
Normal file
40
lang/basic/lib/conversion.c
Normal file
@@ -0,0 +1,40 @@
|
||||
/* $Header$ */
|
||||
|
||||
int _cint(f) double f;
|
||||
{
|
||||
int r;
|
||||
if( f<-32768 || f>32767) error(4);
|
||||
if(f<0)
|
||||
r= f-0.5;
|
||||
else r= f+0.5;
|
||||
return(r);
|
||||
}
|
||||
|
||||
double _trunc(f)
|
||||
double f;
|
||||
{
|
||||
long d;
|
||||
d=f;
|
||||
f=d;
|
||||
return( f );
|
||||
}
|
||||
|
||||
double _fcint(f) double f;
|
||||
{
|
||||
long r;
|
||||
if(f<0){
|
||||
r= -f;
|
||||
r= -r -1;
|
||||
}else r= f;
|
||||
f=r;
|
||||
return(f);
|
||||
}
|
||||
int _fix(f)
|
||||
double f;
|
||||
{
|
||||
int r;
|
||||
|
||||
if( f<-32768.0 || f>32767.0) error(4);
|
||||
r= _sgn(f) * _fcint((f>0.0? f : -f));
|
||||
return(r);
|
||||
}
|
||||
63
lang/basic/lib/error.c
Normal file
63
lang/basic/lib/error.c
Normal file
@@ -0,0 +1,63 @@
|
||||
/* $Header$ */
|
||||
|
||||
/* error takes an error value in the range of 0-255 */
|
||||
/* and generates a trap */
|
||||
|
||||
char *errortable[255]={
|
||||
/* 0 */ "",
|
||||
/* 1 */ "RETURN without GOSUB",
|
||||
/* 2 */ "Out of data",
|
||||
/* 3 */ "Illegal function call",
|
||||
/* 4 */ "Overflow",
|
||||
/* 5 */ "Out of memory",
|
||||
/* 6 */ "Undefined line ",
|
||||
/* 7 */ "Subscript out of range",
|
||||
/* 8 */ "Redimensioned array",
|
||||
/* 9 */ "Division by zero",
|
||||
/* 10 */ "Illegal indirect",
|
||||
/* 11 */ "Type mismatch",
|
||||
/* 12 */ "Out of string space",
|
||||
/* 13 */ "String too long",
|
||||
/* 14 */ "String formula too complex",
|
||||
/* 15 */ "Can't continue",
|
||||
/* 16 */ "Undefined user function",
|
||||
/* 17 */ "No resume",
|
||||
/* 18 */ "Resume without error",
|
||||
/* 19 */ "Unprintable error",
|
||||
/* 20 */ "Missing operand",
|
||||
/* 21 */ "Line buffer overflow",
|
||||
/* 22 */ "FOR without NEXT",
|
||||
/* 23 */ "WHILE without WEND",
|
||||
/* 24 */ "WEND without WHILE",
|
||||
/* 25 */ "Field overflow",
|
||||
/* 26 */ "Internal error",
|
||||
/* 27 */ "Bad file number",
|
||||
/* 28 */ "File not found",
|
||||
/* 29 */ "Bad file mode",
|
||||
/* 30 */ "File already open",
|
||||
/* 31 */ "Disk IO error",
|
||||
/* 32 */ "File already exists",
|
||||
/* 33 */ "Disk full",
|
||||
/* 34 */ "Input past end",
|
||||
/* 35 */ "Bad record number",
|
||||
/* 36 */ "Bad file name",
|
||||
/* 37 */ "Direct statement in file",
|
||||
/* 38 */ "Too many files",
|
||||
/* 39 */ "File not open",
|
||||
/* 40 */ "Syntax error in data",
|
||||
0
|
||||
};
|
||||
|
||||
error(index)
|
||||
int index;
|
||||
{
|
||||
extern int _errsym;
|
||||
extern int _erlsym;
|
||||
|
||||
_setline();
|
||||
if( index<0 || index >40 )
|
||||
printf("LINE %d:ERROR %d: Unprintable error\n",_erlsym,index);
|
||||
else printf("LINE %d:ERROR %d: %s\n",_erlsym,index,errortable[index]);
|
||||
_errsym= index;
|
||||
_trap();
|
||||
}
|
||||
122
lang/basic/lib/exp.c
Normal file
122
lang/basic/lib/exp.c
Normal file
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
*
|
||||
* This product is part of the Amsterdam Compiler Kit.
|
||||
*
|
||||
* Permission to use, sell, duplicate or disclose this software must be
|
||||
* obtained in writing. Requests for such permissions may be sent to
|
||||
*
|
||||
* Dr. Andrew S. Tanenbaum
|
||||
* Wiskundig Seminarium
|
||||
* Vrije Universiteit
|
||||
* Postbox 7161
|
||||
* 1007 MC Amsterdam
|
||||
* The Netherlands
|
||||
*
|
||||
*/
|
||||
|
||||
/* $Header$ */
|
||||
|
||||
/* Author: J.W. Stevenson */
|
||||
|
||||
extern double _fif();
|
||||
extern double _fef();
|
||||
|
||||
/*
|
||||
exp returns the exponential function of its
|
||||
floating-point argument.
|
||||
|
||||
The coefficients are #1069 from Hart and Cheney. (22.35D)
|
||||
*/
|
||||
|
||||
#define HUGE 1.701411733192644270e38
|
||||
|
||||
static double p0 = .2080384346694663001443843411e7;
|
||||
static double p1 = .3028697169744036299076048876e5;
|
||||
static double p2 = .6061485330061080841615584556e2;
|
||||
static double q0 = .6002720360238832528230907598e7;
|
||||
static double q1 = .3277251518082914423057964422e6;
|
||||
static double q2 = .1749287689093076403844945335e4;
|
||||
static double log2e = 1.4426950408889634073599247;
|
||||
static double sqrt2 = 1.4142135623730950488016887;
|
||||
static double maxf = 10000.0;
|
||||
|
||||
static double
|
||||
floor(d)
|
||||
double d;
|
||||
{
|
||||
if (d<0) {
|
||||
d = -d;
|
||||
if (_fif(d, 1.0, &d) != 0)
|
||||
d += 1;
|
||||
d = -d;
|
||||
} else
|
||||
_fif(d, 1.0, &d);
|
||||
return(d);
|
||||
}
|
||||
|
||||
static double
|
||||
ldexp(fr,exp)
|
||||
double fr;
|
||||
int exp;
|
||||
{
|
||||
int neg,i;
|
||||
|
||||
neg = 1;
|
||||
if (fr < 0) {
|
||||
fr = -fr;
|
||||
neg = -1;
|
||||
}
|
||||
fr = _fef(fr, &i);
|
||||
/*
|
||||
while (fr < 0.5) {
|
||||
fr *= 2;
|
||||
exp--;
|
||||
}
|
||||
*/
|
||||
exp += i;
|
||||
if (exp > 127) {
|
||||
error(3);
|
||||
return(neg * HUGE);
|
||||
}
|
||||
if (exp < -127)
|
||||
return(0);
|
||||
while (exp > 14) {
|
||||
fr *= (1<<14);
|
||||
exp -= 14;
|
||||
}
|
||||
while (exp < -14) {
|
||||
fr /= (1<<14);
|
||||
exp += 14;
|
||||
}
|
||||
if (exp > 0)
|
||||
fr *= (1<<exp);
|
||||
if (exp < 0)
|
||||
fr /= (1<<(-exp));
|
||||
return(neg * fr);
|
||||
}
|
||||
|
||||
double
|
||||
_exp(arg)
|
||||
double arg;
|
||||
{
|
||||
double fract;
|
||||
double temp1, temp2, xsq;
|
||||
int ent;
|
||||
|
||||
if(arg == 0)
|
||||
return(1);
|
||||
if(arg < -maxf)
|
||||
return(0);
|
||||
if(arg > maxf) {
|
||||
error(3);
|
||||
return(HUGE);
|
||||
}
|
||||
arg *= log2e;
|
||||
ent = floor(arg);
|
||||
fract = (arg-ent) - 0.5;
|
||||
xsq = fract*fract;
|
||||
temp1 = ((p2*xsq+p1)*xsq+p0)*fract;
|
||||
temp2 = ((xsq+q2)*xsq+q1)*xsq + q0;
|
||||
return(ldexp(sqrt2*(temp2+temp1)/(temp2-temp1), ent));
|
||||
}
|
||||
23
lang/basic/lib/fef.e
Normal file
23
lang/basic/lib/fef.e
Normal file
@@ -0,0 +1,23 @@
|
||||
#
|
||||
mes 2,EM_WSIZE,EM_PSIZE
|
||||
|
||||
; $Header$
|
||||
|
||||
#define FARG 0
|
||||
#define ERES EM_DSIZE
|
||||
|
||||
; _fef is called with two parameters:
|
||||
; - address of exponent result (ERES)
|
||||
; - floating point number to be split (FARG)
|
||||
; and returns an EM_DSIZE-byte floating point number
|
||||
|
||||
exp $_fef
|
||||
pro $_fef,0
|
||||
lal FARG
|
||||
loi EM_DSIZE
|
||||
fef EM_DSIZE
|
||||
lal ERES
|
||||
loi EM_PSIZE
|
||||
sti EM_WSIZE
|
||||
ret EM_DSIZE
|
||||
end ?
|
||||
25
lang/basic/lib/fif.e
Normal file
25
lang/basic/lib/fif.e
Normal file
@@ -0,0 +1,25 @@
|
||||
#
|
||||
mes 2,EM_WSIZE,EM_PSIZE
|
||||
|
||||
; $Header$
|
||||
|
||||
#define ARG1 0
|
||||
#define ARG2 EM_DSIZE
|
||||
#define IRES 2*EM_DSIZE
|
||||
|
||||
; _fif is called with three parameters:
|
||||
; - address of integer part result (IRES)
|
||||
; - float two (ARG2)
|
||||
; - float one (ARG1)
|
||||
; and returns an EM_DSIZE-byte floating point number
|
||||
|
||||
exp $_fif
|
||||
pro $_fif,0
|
||||
lal 0
|
||||
loi 2*EM_DSIZE
|
||||
fif EM_DSIZE
|
||||
lal IRES
|
||||
loi EM_PSIZE
|
||||
sti EM_DSIZE
|
||||
ret EM_DSIZE
|
||||
end ?
|
||||
135
lang/basic/lib/file.c
Normal file
135
lang/basic/lib/file.c
Normal file
@@ -0,0 +1,135 @@
|
||||
#include "bc_string.h"
|
||||
#include <stdio.h>
|
||||
#include "bc_io.h"
|
||||
|
||||
/* $Header$ */
|
||||
|
||||
Filedesc _fdtable[16];
|
||||
/* BASIC file descriptor table */
|
||||
/* Channel assignment:
|
||||
-1 terminal IO
|
||||
0 data file
|
||||
1-15 user files
|
||||
*/
|
||||
|
||||
|
||||
|
||||
int _chann = -1;
|
||||
FILE *_chanrd = stdin;
|
||||
FILE *_chanwr = stdout;
|
||||
|
||||
_setchan(index)
|
||||
int index;
|
||||
{
|
||||
#ifdef DEBUG
|
||||
printf("setchannel %d\n",index);
|
||||
#endif
|
||||
fflush(_chanwr);
|
||||
if( index == -1)
|
||||
{
|
||||
_chann= -1;
|
||||
_chanrd= stdin;
|
||||
_chanwr= stdout;
|
||||
return;
|
||||
}
|
||||
if( index<0 || index>15)
|
||||
error(27);
|
||||
_chann=index;
|
||||
_chanrd= _chanwr= _fdtable[index].fd;
|
||||
}
|
||||
|
||||
_asschn()
|
||||
{
|
||||
#ifdef DEBUG
|
||||
printf("_asschn %d\n",_chann);
|
||||
#endif
|
||||
if( _chann == -1) return;
|
||||
#ifdef DEBUG
|
||||
printf(" file %d\n", _fdtable[_chann].fd);
|
||||
#endif
|
||||
if( _chann<0 || _chann>15)
|
||||
error(27);
|
||||
if( _fdtable[_chann].fd== 0)
|
||||
error(39);
|
||||
if( feof( _fdtable[_chann].fd))
|
||||
error(2);
|
||||
}
|
||||
|
||||
_clochn(nr)
|
||||
int nr;
|
||||
{
|
||||
if( nr<1 || nr >15 || _fdtable[nr].fd==0) error(3);
|
||||
fclose(_fdtable[nr].fd);
|
||||
_fdtable[nr].fd=0; _fdtable[nr].fname=0;
|
||||
}
|
||||
|
||||
_opnchn(reclen,fname,mode)
|
||||
String *mode,*fname;
|
||||
int reclen;
|
||||
{
|
||||
/* channel has been set */
|
||||
FILE *f;
|
||||
int m;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("open %d %s %s \n",reclen,mode->strval,fname->strval);
|
||||
#endif
|
||||
/* check for opened/closed file */
|
||||
if(_fdtable[_chann].fd)
|
||||
error(30);
|
||||
switch(*mode->strval)
|
||||
{
|
||||
case 'O':
|
||||
case 'o':
|
||||
if( (f=fopen(fname->strval,"w")) == NULL)
|
||||
error(28);
|
||||
m= OMODE;
|
||||
break;
|
||||
case 'I':
|
||||
case 'i':
|
||||
if( (f=fopen(fname->strval,"r")) == NULL)
|
||||
error(28);
|
||||
m= IMODE;
|
||||
break;
|
||||
case 'r':
|
||||
case 'R':
|
||||
if( (f=fopen(fname->strval,"a")) == NULL)
|
||||
error(28);
|
||||
m= RMODE;
|
||||
break;
|
||||
default:
|
||||
printf("file mode %s\n",mode->strval);
|
||||
error(29);
|
||||
}
|
||||
_chanrd= _fdtable[_chann].fd= f;
|
||||
_fdtable[_chann].fname= fname->strval;
|
||||
_fdtable[_chann].reclength= reclen;
|
||||
_fdtable[_chann].mode= m;
|
||||
#ifdef DEBUG
|
||||
printf("file descr %d\n",f);
|
||||
#endif
|
||||
}
|
||||
|
||||
_ioeof(channel)
|
||||
int channel;
|
||||
{
|
||||
FILE *fd;
|
||||
char c;
|
||||
if( channel<0 || channel >15) error(3);
|
||||
fd= _fdtable[channel].fd;
|
||||
if( fd==0)
|
||||
error(3);
|
||||
c=fgetc(fd);
|
||||
if( feof(_fdtable[channel].fd) ) return(-1);
|
||||
ungetc(c,fd);
|
||||
return(0);
|
||||
}
|
||||
|
||||
_close()
|
||||
{
|
||||
/* close all open files */
|
||||
int i;
|
||||
for(i=1;i<16;i++)
|
||||
if( _fdtable[i].fd)
|
||||
_clochn(i);
|
||||
}
|
||||
7
lang/basic/lib/hlt.c
Normal file
7
lang/basic/lib/hlt.c
Normal file
@@ -0,0 +1,7 @@
|
||||
/* $Header$ */
|
||||
|
||||
_hlt(nr)
|
||||
int nr;
|
||||
{
|
||||
exit(nr);
|
||||
}
|
||||
97
lang/basic/lib/io.c
Normal file
97
lang/basic/lib/io.c
Normal file
@@ -0,0 +1,97 @@
|
||||
#include "bc_io.h"
|
||||
#include <sgtty.h>
|
||||
|
||||
/* $Header$ */
|
||||
|
||||
struct sgttyb _ttydef;
|
||||
|
||||
/* BASIC has some nasty io characteristics */
|
||||
|
||||
#define MAXWIDTH 255
|
||||
|
||||
int _width = 75, _pos=0, _zonewidth=15;
|
||||
|
||||
_out(str)
|
||||
char *str;
|
||||
{
|
||||
int pos;
|
||||
|
||||
if( _chann== -1) pos= _pos;
|
||||
else pos= _fdtable[_chann].pos;
|
||||
while( *str)
|
||||
{
|
||||
if( pos>= _width){ _outnl(); pos=0;}
|
||||
fputc(*str++, _chanwr);
|
||||
pos++;
|
||||
}
|
||||
if( _chann== -1) _pos=pos;
|
||||
else _fdtable[_chann].pos= pos;
|
||||
}
|
||||
|
||||
_outnl()
|
||||
{
|
||||
fputc('\n',_chanwr);
|
||||
if( _chann == -1)
|
||||
_pos=0;
|
||||
else
|
||||
_fdtable[_chann].pos=0;
|
||||
}
|
||||
_zone()
|
||||
{
|
||||
/* go to next zone */
|
||||
int pos;
|
||||
if( _chann == -1)
|
||||
pos= _pos;
|
||||
else pos= _fdtable[_chann].pos;
|
||||
do{
|
||||
fputc(' ',_chanwr);
|
||||
pos++;
|
||||
if( pos==_width)
|
||||
{
|
||||
_outnl();
|
||||
pos=0;
|
||||
break;
|
||||
}
|
||||
} while( pos % _zonewidth != 0);
|
||||
if( _chann== -1) _pos=pos;
|
||||
else _fdtable[_chann].pos= pos;
|
||||
}
|
||||
_in(buf)
|
||||
char *buf;
|
||||
{
|
||||
register int holder ;
|
||||
char *c;
|
||||
int pos;
|
||||
if( _chann == -1)
|
||||
{
|
||||
pos= _pos;
|
||||
gtty(0,_ttydef);
|
||||
_ttydef.sg_flags &= ~ECHO;
|
||||
stty(0,_ttydef);
|
||||
}else pos= _fdtable[_chann].pos;
|
||||
c= buf;
|
||||
while( (holder = fgetc(_chanrd)) != EOF && holder != '\n'){
|
||||
*c= holder ;
|
||||
if( _chann == -1) putchar(holder);
|
||||
c++; pos++;
|
||||
}
|
||||
*c= 0;
|
||||
if( _chann== -1)
|
||||
{
|
||||
_pos=pos;
|
||||
_ttydef.sg_flags |= ECHO;
|
||||
stty(0,_ttydef);
|
||||
} else _fdtable[_chann].pos= pos;
|
||||
}
|
||||
_tab(x)
|
||||
int x;
|
||||
{
|
||||
if( x> _width) error(3);
|
||||
if( x< _pos) _outnl();
|
||||
_spc(x-_pos);
|
||||
}
|
||||
_spc(x)
|
||||
int x;
|
||||
{
|
||||
while(x-->0) _out(" ");
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user