426 Commits

Author SHA1 Message Date
cvs2hg
8d7ceb6d6c fixup commit for tag 'distr2' 1987-08-26 13:58:31 +00:00
em
d10d14acac Initial revision 1985-04-15 00:05:45 +00:00
em
ca5599714b Initial revision 1985-04-14 23:26:24 +00:00
keie
f337b8df6d Removed RANLIB . 1985-04-14 14:27:04 +00:00
keie
7cd58cabab Added m68k4, pmds4
Removed one superfluous line.
1985-04-14 13:59:14 +00:00
em
8b4f21bd95 Added libraries needed after installation of cg. 1985-04-14 13:57:31 +00:00
em
ab820d3083 8080->i80. 1985-04-14 13:54:33 +00:00
em
fb23d440f0 Removed a superfluous line. 1985-04-14 13:46:54 +00:00
em
f70b857d1b Added pmds4. 1985-04-14 13:22:26 +00:00
em
bd07643039 To prevent a (incorrrect) error message from distr/mktree. 1985-04-12 20:32:06 +00:00
keie
686e5af1bb *** empty log message *** 1985-04-12 20:07:13 +00:00
keie
34ccddfc2d The library name was incorrect. 1985-04-12 17:21:52 +00:00
keie
b6f73fdc29 Initial revision 1985-04-12 17:08:56 +00:00
keie
c19324dfea *** empty log message *** 1985-04-12 17:06:38 +00:00
keie
772b64fabd *** empty log message *** 1985-04-12 16:56:43 +00:00
keie
ef92740400 Deletion of a few coercions caused a translation failure
for setjmp.e.
The coercions have been grabbed from an old version by FvH.
1985-04-12 16:43:40 +00:00
keie
ee9c5be180 Initial revision 1985-04-12 16:40:22 +00:00
bal
ca9a6feeb0 floating point stuff added 1985-04-12 15:47:30 +00:00
keie
022cb596be *** empty log message *** 1985-04-12 15:06:05 +00:00
keie
9eb53c3d47 *** empty log message *** 1985-04-12 14:59:45 +00:00
keie
dfcfa9883b Initial revision 1985-04-12 14:55:00 +00:00
em
fb6d291d38 *** empty log message *** 1985-04-12 14:33:09 +00:00
em
e4e29ae837 Added flp.s, contains subroutines for all EM fp instructions.
They trap.
1985-04-12 14:29:07 +00:00
em
94534b7c15 1- Floating point routines now call routines instead of calling trp. 1985-04-12 14:25:59 +00:00
em
491040b2c7 *** empty log message *** 1985-04-12 14:01:20 +00:00
keie
b4adc21f19 Putting some dots on some i's. 1985-04-12 11:32:41 +00:00
keie
bae4084355 *** empty log message *** 1985-04-12 11:25:21 +00:00
keie
d394fe5dda Just newer. 1985-04-12 11:20:15 +00:00
keie
dcfe4e8a97 *** empty log message *** 1985-04-09 13:48:55 +00:00
keie
be9e253a2f Added 1)libsys 2)end_em.
Changed handling of -i flag.
1985-04-02 11:21:33 +00:00
keie
620216fb26 Error code 0 was returned when the installation failed! 1985-04-02 10:55:02 +00:00
keie
70d71f4355 Copy of ../libbc/compmodule. 1985-04-02 10:50:53 +00:00
keie
6b87f1082e Removed -DCPM. 1985-04-02 10:46:43 +00:00
em
fd44c34a61 *** empty log message *** 1985-04-01 17:02:55 +00:00
keie
6c247029bd *** empty log message *** 1985-04-01 14:44:26 +00:00
keie
6bbdb92784 Adapted after installation of backend. 1985-04-01 14:02:58 +00:00
keie
22182c0d7f *** empty log message *** 1985-04-01 14:00:00 +00:00
keie
87f66789de Some minor cleaning up. 1985-04-01 13:20:42 +00:00
em
1879c8e724 *** empty log message *** 1985-03-29 21:44:50 +00:00
em
693830b09a *** empty log message *** 1985-03-29 21:10:43 +00:00
keie
e3fa99632e Corrected parameter name usage from i to d. 1985-03-26 17:03:30 +00:00
keie
b3d11b1fa5 Removed pascal library. 1985-03-26 16:27:23 +00:00
keie
2b6187a009 *** empty log message *** 1985-03-26 16:23:21 +00:00
keie
a8fc6009f7 The dl programs is replaced by a more general cv. 1985-03-26 16:20:11 +00:00
keie
92141b52ce Installed backend and libraries. 1985-03-26 16:18:24 +00:00
keie
b63f304db1 Or's are not allowed on a-registers, add's are. 1985-03-26 16:09:07 +00:00
keie
ec3e755168 Adapted to Unisoft signal handling. 1985-03-26 16:08:09 +00:00
keie
a41ff68078 *** empty log message *** 1985-03-26 15:04:46 +00:00
keie
244e172413 Added head_em. 1985-03-26 15:04:02 +00:00
keie
da936740a6 Added head_em to libsys. 1985-03-26 15:00:09 +00:00
keie
35fae90a9d Fetch head_em from pmds4.
Short size is 2 not 4!
1985-03-26 14:58:54 +00:00
keie
c5a739c68f Moved head_em to libsys. 1985-03-26 14:53:00 +00:00
keie
dc92fe358e *** empty log message *** 1985-03-26 14:48:32 +00:00
keie
59996174b6 Added some more system calls.
Moved errno to a separate file.
1985-03-21 14:13:55 +00:00
keie
84f9364d4c errno is moved to a sfile of its own. 1985-03-21 14:05:03 +00:00
keie
a635fb0203 *** empty log message *** 1985-03-21 14:04:45 +00:00
em
e3e1c5ac20 *** empty log message *** 1985-03-18 17:27:42 +00:00
em
e3e9add8b1 Initial revision 1985-03-18 17:24:31 +00:00
em
ffd0d165a7 *** empty log message *** 1985-03-18 15:52:00 +00:00
em
c1d5a0c721 Changed 8080 into i80. 1985-03-18 14:44:15 +00:00
em
3e743d78f3 *** empty log message *** 1985-03-18 14:39:26 +00:00
em
90c847ca59 *** empty log message *** 1985-03-18 14:32:46 +00:00
em
1b162c577e *** empty log message *** 1985-03-18 13:46:31 +00:00
em
a5f4b01d82 Initial revision 1985-03-18 13:15:00 +00:00
em
c5508c7c0b *** empty log message *** 1985-03-18 13:12:07 +00:00
garde
80e349860b Added RCS id. 1985-03-18 12:55:07 +00:00
em
157b243956 *** empty log message *** 1985-03-18 12:46:51 +00:00
em
eabf214312 *** empty log message *** 1985-03-18 11:11:44 +00:00
garde
d52117c8dd Some less important changes 1985-03-18 10:00:30 +00:00
keie
d457c50945 The universal assembler has a bug that precludes use of .align
in text segments, except as the very last command.
1985-03-15 11:03:41 +00:00
keie
b294ab5042 The universal assembler has a bug that precludes use of .align
in text segments, except as the very last command.
1985-03-15 10:50:35 +00:00
em
9d0812746b The assembler proved to contain yet another bug.
.align in text segments will not work for values that are
not a divisor of the gcd of the instruction sizes.
1985-03-14 17:33:28 +00:00
em
9f203c9a17 Expressions are now always calculated in long.
Some backends needed that.
1985-03-12 10:41:29 +00:00
em
0c92039ba4 Expression are always evaluated in longs.
Some 2-4 backends needed long expressions.
1985-03-12 10:39:24 +00:00
em
cf6d084155 Use of the Pascal library will not occur.
/.
1985-03-12 10:24:51 +00:00
keie
7e6a6f6de2 Now also testing for availability of /tmp and /usr/tmp. 1985-03-11 13:10:52 +00:00
bal
954d3a0326 Argument is 4 bytes (pointer), not 2 bytes. 1985-03-05 12:33:29 +00:00
keie
6f6356e0b4 Initial revision 1985-03-05 00:17:40 +00:00
keie
9e26d0e0c0 *** empty log message *** 1985-03-05 00:15:40 +00:00
keie
bf3ba84e92 Adapted to 4-4. 1985-03-04 17:26:31 +00:00
keie
7a790e48fb Bleasdale only. 1985-03-04 16:47:56 +00:00
keie
32bc0f2982 Initial revision 1985-03-04 16:44:32 +00:00
keie
fb4a3fd479 *** empty log message *** 1985-03-04 16:35:40 +00:00
keie
ccdb8693ee Now using 4-byte integers and clearing D1 for double size
instruction pointers.
1985-03-04 16:12:10 +00:00
keie
a8c5699241 Now returns correct values. 1985-03-04 16:11:56 +00:00
keie
e0c4e4b686 Added execv and execle. 1985-03-04 16:11:41 +00:00
keie
8a40c25069 Now using .reghp. 1985-03-04 16:11:26 +00:00
keie
0fd729951a Removed superfluous instruction. 1985-03-04 16:10:47 +00:00
keie
7a30dc4868 *** empty log message *** 1985-03-04 16:08:41 +00:00
keie
4b1965afbc *** empty log message *** 1985-03-04 15:55:28 +00:00
keie
b2b281f525 To force the first part of a circular ring of modules in from
tail_em.
/.
1985-03-04 15:37:38 +00:00
keie
d2a6847715 The previous version still assumed two-byte integers. 1985-03-04 15:33:28 +00:00
keie
2690f07cbd Incorrect alignment caused odd _end, which caused
failures of malloc().
1985-03-04 15:30:44 +00:00
keie
aa82964563 Now also prints stack height. 1985-03-04 15:29:36 +00:00
keie
c636aba734 Alignment now also works when the alignment ended on odd boundaries. 1985-03-04 15:28:02 +00:00
keie
ce92663b0a Initial revision 1985-03-04 15:27:09 +00:00
keie
a89ba7074f Always returned non-zero value. 1985-03-04 15:25:33 +00:00
keie
a71e706aa4 *** empty log message *** 1985-03-04 15:14:01 +00:00
garde
736a2d1022 Many things improved and extended 1985-03-04 13:42:38 +00:00
keie
17e13e9e71 Adapted to single cv for all machines. 1985-03-01 22:11:46 +00:00
keie
9d7b94ba34 Adapted to a single cv for all machines. 1985-03-01 22:10:44 +00:00
keie
218f7ed718 Corrected a horrible typing mistake. 1985-03-01 20:08:45 +00:00
keie
cb0b2e08cf 1 - At RREMOVE also check the stack set aside for coercions.
2 - When coercions unexpectedly need stack of part of the
stakpattern, discontinue this option.
1985-03-01 16:25:21 +00:00
keie
c2a990768d The top of the stack, which is set aside for certain
coercions is now saved with special routines.
This allows RREMOVE to check for registers.
1985-03-01 16:20:13 +00:00
keie
36537eccc0 Also clear D1 (for static link). 1985-03-01 16:00:23 +00:00
keie
6cdcb391fb Added RCS ID. 1985-03-01 10:34:00 +00:00
keie
9d9c9ae97b *** empty log message *** 1985-03-01 10:30:23 +00:00
bal
c478b62711 bug fixed in kill_much():
for ( .. ; i != (Lindex) i; ..  ) should be
for ( .. ; i != (Lindex) 0; ..  ).
1985-02-28 10:35:57 +00:00
keie
e7f7f33f60 cg tried to stack register parameters of moves, when
these registers were killed.
1985-02-26 16:31:38 +00:00
keie
c1f3dbba33 1 - Removed PMDS from selection list.
2 - Joined two line, that should have been one.
1985-02-26 11:56:57 +00:00
bal
d5098fe70f Bug fixed: co_lfirst received wrong value for multiply-optimization. 1985-02-25 14:03:09 +00:00
bal
469d075e77 Calls of which the actual and formal parameters do not match
are no longer substituted inline.
1985-02-20 15:01:02 +00:00
keie
2a4b3fd616 Removed nascom/z80a from the distribution. 1985-02-19 13:59:17 +00:00
keie
408dacc2aa The stacking pattern for ldc C and 4 with highw(c)==0 was incorrect.
The effect was that rand() from libcc/gen always returned
a 0.
1985-02-19 13:41:30 +00:00
bal
7397122695 p_use->u_ext field deleted from showptable() 1985-02-19 11:16:11 +00:00
bal
abcbc93b5d Dependencies for .m files added. 1985-02-19 11:13:13 +00:00
keie
de6ce0fe74 Added a default in the ANY case for system type. 1985-02-19 10:31:20 +00:00
keie
b449b94b48 Removed nascom from linked list. 1985-02-18 23:06:13 +00:00
keie
7d85a4c0b3 Added link to 6805. 1985-02-18 23:01:05 +00:00
bal
66ab97d2b0 bug fixed: lifetime of an item was too short; it should also cover
any live/dead message prior to its initial live-message.
1985-02-18 15:14:22 +00:00
keie
241a7de970 The PDP 11 needs -i, Vax'en ignore it. 1985-02-18 12:45:31 +00:00
keie
41d580c9cf Added some comment. 1985-02-18 01:06:58 +00:00
keie
ec46d547c4 Made use of apc and acc where assuming results
can be run on own system explicit.
1985-02-18 01:03:51 +00:00
keie
daa47964a5 Changed "name of system" into "type of system". 1985-02-18 00:12:12 +00:00
keie
ee63833f41 Basic also needs libc.a. 1985-02-17 22:47:40 +00:00
keie
445d52de66 Moved retar from ret.s to trp.s.
trp.s needed it and is behind ret.s in the library.
When ret.s is loaded, it calls (via unknown) trp.s so
inclusion in trp.s should work.
1985-02-17 22:31:10 +00:00
keie
b82c00e153 Added a line for
loc loc cuu $1==$1, because write.e contained the line
loc 2
loc 2
ciu
and the cg failed to translate.
1985-02-17 22:03:44 +00:00
keie
972692cb1c Further refinement. 1985-02-17 22:01:03 +00:00
em
bbfb511322 Added .align 2. Prevents end of bss to be odd.
Especially important for malloc, it distinguishes between
odd and even word pointers.
1985-02-17 01:12:36 +00:00
cvs2hg
3f3bddef8f fixup commit for tag 'dist2' 1985-02-17 00:57:20 +00:00
keie
9f45dd0650 Added .align 2.
Especially important for malloc.
1985-02-17 00:57:19 +00:00
keie
43a2b60360 *** empty log message *** 1985-02-16 22:09:05 +00:00
keie
14875e6ca5 *** empty log message *** 1985-02-16 16:48:18 +00:00
em
d32de5df93 Now chooses between Vax and Pdp conversion. 1985-02-16 15:58:34 +00:00
keie
eeb944f6e3 The assembler is used for both 2/4 and 4/4. 1985-02-16 15:49:03 +00:00
em
ca28f34c8e *** empty log message *** 1985-02-15 23:13:04 +00:00
em
625c309fa6 1985-02-15 23:12:16 +00:00
em
9f3928cd3a Adapted to -DNOFLOAT. 1985-02-15 23:11:30 +00:00
em
a65f05f29f Adapted to NOFLOAT. 1985-02-15 23:10:04 +00:00
em
6a6a84a274 *** empty log message *** 1985-02-15 23:00:46 +00:00
em
4f80e81ee7 *** empty log message *** 1985-02-15 22:53:13 +00:00
em
eb2b9d0bac Removed one error. 1985-02-15 14:37:35 +00:00
em
792d315beb Program was adapted with NOFLOAT flag. 1985-02-15 14:23:34 +00:00
em
04e454d3c6 Added RCS id.
Adapted to use the NOFLOAT cpp flag.
1985-02-15 14:20:04 +00:00
bal
a1c2dadb2a Compare group (cmp,cmi,cmu,cms,cmf) added as cheap operators. 1985-02-15 13:18:57 +00:00
em
b6381fad79 The cho worked incorrectly, thereby causing the whole test to fail. 1985-02-13 00:41:16 +00:00
em
c9eb48d373 Removed the use of float from the test.
Using int's in sqrt gives the same result.
1985-02-12 23:27:23 +00:00
em
67d635ccd4 1985-02-12 23:07:22 +00:00
em
f37307bc06 A slightly different message. 1985-02-12 23:07:05 +00:00
keie
2a4335787e Adfded RCS id. 1985-02-12 14:37:52 +00:00
keie
1b5278f3d4 As left by Hans v. Staveren. 1985-02-12 14:32:20 +00:00
keie
815b0e0f0f *** empty log message *** 1985-02-12 14:20:30 +00:00
keie
70c000b03e Now using the same em.c as in m68k2/int.
The interpreters are moved from pdp/pdp_int (or some such)
to lib/int22.
1985-02-12 13:11:27 +00:00
keie
f59262745e Initial revision 1985-02-12 12:54:44 +00:00
keie
cc4f8a793a Initial revision 1985-02-12 12:28:49 +00:00
keie
52fee02e94 Adapted to run on 4/4 machines. 1985-02-11 14:33:04 +00:00
keie
fee336890b Placed a few dot on e few i's. 1985-02-11 14:32:02 +00:00
keie
0b6744bb91 The default for any machine is without, double length
integer arithmetic and without floating point.
1985-02-11 11:17:35 +00:00
bal
e704ddc158 restructured. 1985-02-11 10:52:49 +00:00
bal
f7699474b8 The binaries of the phases of ego are now put in a single directory. 1985-02-11 10:07:47 +00:00
bal
6909adbf9c Macros newcflpx and oldcflpx added. 1985-02-11 09:52:11 +00:00
bal
156775643e Include files and declaration of em_flag added. 1985-02-11 09:51:02 +00:00
bal
d41c902b12 Memory allocation/deallocation for extends changed. 1985-02-11 09:48:32 +00:00
keie
43f003e959 Removed a few typos. 1985-02-08 16:54:34 +00:00
keie
ba1e51e914 Deleted a line with a statement unknown to this compiler. 1985-02-08 15:41:19 +00:00
keie
66875f1bde Looks more reasonanle now. 1985-02-08 13:21:23 +00:00
keie
8a7ee2ea50 Now calling trace with the current line number as parameter. 1985-02-08 13:18:26 +00:00
keie
e9850f2691 Improved. 1985-02-08 13:12:51 +00:00
keie
0122bc2dd7 *** empty log message *** 1985-02-07 22:59:50 +00:00
keie
c0085c2dd4 A list without double entries, for the moment supposing
that trp,etc always gets loaded, so will be there when .dvu needs it.
1985-02-07 22:51:12 +00:00
keie
00d75279e7 d2 contains the remainder of dvu i.s.o. d3. 1985-02-07 22:26:11 +00:00
keie
c0d87aaa16 *** empty log message *** 1985-02-07 22:06:32 +00:00
keie
3c7fcfe81a Initial revision 1985-02-07 17:43:43 +00:00
keie
4ff7e05f7e Initial revision 1985-02-07 17:18:06 +00:00
keie
3df42a584c *** empty log message *** 1985-02-07 15:58:40 +00:00
keie
9c93cbdfaa *** empty log message *** 1985-02-07 15:33:13 +00:00
em
1b36afae36 Added a line about the presence of out.std 1985-02-06 21:31:51 +00:00
em
0ff3a17f5e Initial revision 1985-02-06 21:25:27 +00:00
keie
d7abe0e8b6 Initial revision 1985-02-06 21:06:03 +00:00
garde
20986fd6ea monitor calls open, close and ioctl removed. 1985-02-06 16:56:41 +00:00
garde
293dfd2c64 Initial revision 1985-02-06 16:50:52 +00:00
em
e1b8023da1 *** empty log message *** 1985-02-05 14:52:52 +00:00
em
52d0f32e32 Copied from vax2, takes its info on which files
to use in which order from LIST.
1985-02-05 14:52:02 +00:00
em
c8e426ffb8 This one is made with lorder|tsort. 1985-02-05 14:51:17 +00:00
em
b70b6ba980 The first one, Duk's order. 1985-02-05 14:50:24 +00:00
em
c90c70bb84 Now fetching sedf from this directory instead of
from the cg source directory.
1985-02-05 11:44:40 +00:00
keie
a50f8ebe1c Placed the include files in {EM_HOME}/h/bc_..... 1985-02-04 22:18:16 +00:00
keie
da898f1325 *** empty log message *** 1985-02-04 14:31:17 +00:00
keie
1e38fa0573 *** empty log message *** 1985-02-04 14:26:13 +00:00
keie
5a6676cc53 Prevent the existence of pem2[24].p to frustate the ln and thus
the whole exercise.
1985-02-04 02:53:18 +00:00
keie
987ed39adb Added an entry "distr" to make tables1.c and tables1.h. 1985-02-03 23:50:51 +00:00
keie
3d4a5efe99 The creation of the library is now done by the process of creating
the distribution directory.
1985-02-03 23:23:50 +00:00
keie
46f5004866 Tail_em.s.a is now extracted from the RCS directory by the
distribution making process in em/distr2.
1985-02-03 23:21:24 +00:00
keie
df168727a6 The effect of the .distr entry is now done by the
mktree process from /usr/em/distr2.
1985-02-03 23:18:06 +00:00
em
2cc4735151 Added libmon to libraries to be translated. 1985-02-02 18:06:37 +00:00
em
dd7e9436a2 *** empty log message *** 1985-02-01 22:12:31 +00:00
garde
8e154eb826 Many, many improvements made, ususually small ones.
For example: many em-patterns have got alternative code-rules.
1985-02-01 12:51:56 +00:00
keie
ca219d89e9 Now using ../../proto/libg/Makefile. 1985-02-01 12:38:08 +00:00
keie
26999bb517 To avoid conflict while compiling with acc itself the word
size of the target machine is now defined as TEM_WSIZE.
1985-02-01 12:32:46 +00:00
keie
103659cd7b Added an entry to create a doc.pr suitable for printing
on a straightforward line printer.
1985-01-31 22:38:00 +00:00
keie
626ae9760f Added a reference to MES 11 in 11.1.4.4 at the non-local goto. 1985-01-31 15:15:20 +00:00
keie
dcd8451347 1- Zero is deleted as a possible argument to LOI and STI.
Allowing that was an oversight.
2- Message number 10 is reserved for global optimizer output.
3- Message number 11 must be used by GTO destinations.
1985-01-31 15:10:16 +00:00
keie
882906b3c3 Added a few sentences about the capability of ack to
preprocess Pascal programs and one restriction that imposes
on programs using it.
1985-01-31 14:50:15 +00:00
keie
f586956618 Zero is deleted as a possible argument to LOI and STI.
Allowing that was an oversight.
1985-01-31 14:03:56 +00:00
keie
6459b0bf5f Zero is deleted as a possible argument to LOI and STI.
Allowing that was an oversight.
1985-01-31 13:58:09 +00:00
keie
1f56b2aa4c 1 - Changed incorrect execution line for callc/modc
2 - Added several sources to 'pr' entry, for printing.
1985-01-31 10:53:59 +00:00
bal
d1c0d1db13 Bugs fixed for the following patterns:
lol loc 255 and 2  (byte order was wrong)
loc x beq , 0 < x < 128  (was 0 < x < 256)
loc x bne (idem).
These bugs were introduced in version 2.2.
1985-01-30 16:34:14 +00:00
bal
b99ce86e16 register save costs changed: they are now linearly dependent on
the number of registers to be saved (for time).
1985-01-30 15:43:02 +00:00
bal
bec394f7bd Entry for LOI changed from CLASS1 to CLASS12. 1985-01-30 14:49:03 +00:00
bal
db19d06f61 CLASS12 added for the LOI instruction. A "LOI n", n < wordsize,
loads wordsize bytes, not n bytes.
1985-01-30 14:47:49 +00:00
ceriel
e936aea1e1 Added -DCPM to the flags. 1985-01-30 12:37:10 +00:00
bal
31eab814f2 Debugging procedure print_allocs now writes to stderr. 1985-01-30 10:52:33 +00:00
bal
7f9dd27dc8 bug fixed: assemble_allocs() did generate whole_procedure allocations.
These allocations were initialized with a very low profit. Consequently
account_regsave rejected these allocations.
Solution: repl_allocs() updates the al_profits field of the
whole_procedure allocation.
1985-01-30 10:47:47 +00:00
bal
387191a2c7 bug fixed: oldmap(lmap,llength) was sometimes called when no new map
had to be allocated for the current (data-) unit.
1985-01-28 11:38:06 +00:00
em
cf3d3ad287 Also remove all *.e and *.d files when cleaning up. 1985-01-25 16:19:13 +00:00
keie
1bc30e42eb Strings in rom are initialized with usage count 9999.
decstr does not touch these at all.
1985-01-25 14:40:51 +00:00
keie
e271d9bbb8 Strings in rom are initialized with usage count 9999 i.s.o. 1.
String with that usage count are not touched any way at all.
1985-01-25 14:34:50 +00:00
bal
a49f2d23f7 Number of address registers decreased from 5 to 4. 1985-01-25 13:24:12 +00:00
keie
3c5d3c55af Added an entry called distr.
This make the formatted install.pr to be put on the distribution tape.
1985-01-25 11:28:55 +00:00
keie
6d344b6702 The program name is used to set the name
of the file were the contents of data statements are written.
The filename is extracted from the path and the suffix (if present)
is replaced by .d.
1985-01-25 11:04:18 +00:00
keie
8fa5a7b668 The parametrs passed to the call to opnchn when initializing are now
correct string descriptors.
Programs with data statements used to crash with TRAP TYPE 11.
1985-01-25 09:57:04 +00:00
keie
d12fef6c05 The non-flag arguments are now passed by position.
The order is :  (bem) input output program-name.
1985-01-25 09:55:28 +00:00
em
ed1ee8a3b4 Removed test18 because it is in essence a busy loop. 1985-01-24 22:34:31 +00:00
em
3bb153d6bb Added executable files to list of those to cleanup. 1985-01-24 21:27:32 +00:00
em
df08133a04 Added entry "clean" for cleanup. 1985-01-24 21:25:57 +00:00
keie
06087a6bc3 *** empty log message *** 1985-01-24 17:39:54 +00:00
keie
fd4d46036a Added ranlib commends. 1985-01-24 16:16:32 +00:00
keie
1e3ec09984 Some minor changes. 1985-01-24 15:34:23 +00:00
em
58c5d2d8ac Changed the line numbered 19 into a line numbered 190.
This seemed the correct thing to do.
1985-01-24 11:34:12 +00:00
em
410800127c *** empty log message *** 1985-01-24 11:27:36 +00:00
bal
1732114593 bug fixed: the "incr" parameter of sbrk() is a 2-byte integer,
not a 4-byte integer.
1985-01-23 16:31:51 +00:00
bal
66eabbcddf parameter of fscanf changed from "%d" to "%hd" to read a short. 1985-01-23 16:28:58 +00:00
bal
468401cb81 core allocation macros added. 1985-01-23 16:27:47 +00:00
bal
cac6ffd8c2 ovfl_harmful and arrbound_harmful turned into ints 1985-01-23 16:25:29 +00:00
bal
d32d4e6ba0 Interface of tmplocal() changed: second parameter is a long now 1985-01-23 16:23:15 +00:00
bal
5cad6f6aa7 interface with tmplocal() changed: second parameter is a long now. 1985-01-23 16:18:33 +00:00
bal
e46c49e291 bug fixed in get_instrs(): instr should be an int rather than a Celem_t. 1985-01-23 16:16:49 +00:00
bal
5a95c31414 bug fixed in last_mnem(): test on nil-pointer.
bug fixed in try_tail(): add line "if(l1==0||l2==0) return FALSE".
1985-01-23 16:13:57 +00:00
bal
f487f26e00 bug fixed in last_line() : assert(l!=0) should be assert(lines!=0). 1985-01-23 16:12:21 +00:00
bal
e95492dfb0 bug fixed in routine get_ca_lines(): test on nil-pointer. 1985-01-23 16:10:43 +00:00
bal
fefe15a844 init_regcnt renamed initregcnt to avoid name conflict.
bug fixed in routine fits_in(): test on nil-pointer.
routine choose_location(): interface with tmplocal() changed, second
parameter now is a long, so a cast is added.
1985-01-23 16:07:09 +00:00
bal
3d2c33e277 rules for itemtab.h and makeitems added. 1985-01-23 15:50:17 +00:00
bal
2ea3be322d clean_items renamed cleanitems to avoid name conflict.
clean_timeset renamed cleantimeset to avoid name conflict.
bugs fixed: calls to fscanf() with a pointer-to-short as argument
should provide a "%hd" instead of "%d".
1985-01-23 15:45:58 +00:00
garde
a849b751a9 src1 and src2 extended.
Errors in 'pat loc cmi teq' and 'pat loc cmi tne' recovered.
Second stack-pattern for 'pat zlt' and 'pat zge' added.
Patterns for 'lil loc adi sil', 'lil inc sil', 'lil dec sil'
and 'sil lil' added.
1985-01-22 19:55:11 +00:00
em
ea337060ec User defined trap handling routine is called with calls instruction.
A message is printed if there is no routine at all.
1985-01-22 15:20:19 +00:00
em
33c81637db Added `movl r3,ap' to restore the argument pointer before returning
vi jmp (r0).
1985-01-22 13:10:35 +00:00
em
8bdec01d71 Now using opder recommanded by 'lorder'. 1985-01-22 02:17:13 +00:00
keie
7556180ab3 Printf does not return a truth value for failure.
These -incorrect- tests were replaced by calls to ferror.
1985-01-21 23:58:07 +00:00
keie
09000449a4 Added declaration of _newstr. 1985-01-21 23:57:44 +00:00
keie
68644410fb Added correct declaration of salloc, thereby preventing incorrect conversions.
Removed now unnecessary casts from salloc to (char *).
Added a cast to (char *) for the argument of sfree in the second call.
1985-01-21 23:56:10 +00:00
keie
c2e988c3d5 1 - Changed argument from int to unsigned.
2 - The test for a failed malloc is changed from comparison to -1
    to comparison to 0.
1985-01-21 23:54:46 +00:00
keie
d4a597912f Tests for EOF returned by stdio routines need the full int width. 1985-01-21 23:53:41 +00:00
keie
682e5d9b8a Removed casts made superfluous by adding newstr to string.h 1985-01-21 23:53:01 +00:00
keie
f7027ba7e4 Test for EOF returned by stdio routines have to use the full int width. 1985-01-21 23:52:19 +00:00
keie
52a627589a Removed cast made superfluous by added newstr to string.h 1985-01-21 23:51:33 +00:00
keie
5fc9fdf795 Added test for outcome of request for more core.
If no more core is available a fatal error message is produced.
1985-01-21 23:48:06 +00:00
em
08c8edf314 Changed #define's of newlbss of cst_fmt. 1985-01-21 16:40:02 +00:00
em
603f82a578 Bug fix: redefined a Local local causing an INTERNAL ERROR from as. 1985-01-21 15:49:22 +00:00
keie
8f81c858f8 Due to an 8 character identifier length limitation the identifier
"strcompare" is changed into "strcomp".
1985-01-21 14:52:34 +00:00
keie
6a21488f0c Due to an 8 character identifiers limitation calls in EM
the identifier "randomize" was changed into "randomi".
1985-01-21 14:51:29 +00:00
keie
374ac8b21c Due to an 8 character identifiers limitation on EM calls to
"setchannel" were changed into "setchan" and the identifier
"seektable" is replaced by "seektab".
1985-01-21 14:50:12 +00:00
keie
770f321ea8 Changed calls to "setrandom" into calls to "setrand" and
calls to "randomize" inro calls to "randomi" to avoid
problems with routines compiled by C.
1985-01-21 14:48:16 +00:00
keie
decda89fba Added a few /*NOSTRICT*/ comments to indicate awareness of lint complaints. 1985-01-21 14:30:55 +00:00
keie
ff46181ae0 1 - Changed the defintion of a local 's' into 'Sym' to avoid naming conflict.
2 - Added .integer, .Sptr and .cptr at appropiate places to uses of yylval.
3 - Removed unnecessary casts.
4 - Added a few /*NOSTRICT*/ comments to indicate awareness of lint
    complaints.
1985-01-21 14:26:29 +00:00
keie
dbb0d46ac2 1 - Added comment to indicate awareness of lint complaints.
2 - Added/Removed some casts used with core allocation/deallocation.
1985-01-21 14:23:49 +00:00
keie
d53ef52028 Changed the argument of salloc from an int into an unsigned.
Just to shut up lint.
1985-01-21 14:22:07 +00:00
keie
a91ff9e04b Added a declaration of gosublabel. 1985-01-21 14:21:52 +00:00
keie
56a8cd53b6 Added a few comments to indicate awareness of lint complaints. 1985-01-21 14:20:11 +00:00
keie
0c2aee4835 1 - Removed definition of POINTERSIZE.
2 - Defined void as int, some compilers don't know void.
3 - Added declarations of the routines proclabel, salloc, strcpy, strcat, malloc.
1985-01-21 14:18:47 +00:00
garde
cd78a1a27a case 8 and case 6 deleted in switch of function 'prolog' 1985-01-21 14:17:11 +00:00
keie
309bbef3ea Now using a union for YYSTYPE and typed (non-)terminals.
Changed values $n(intvalue) to ival in definition of filelist.
Changed one asp,$n(midparms) into several asp,...SIZE in the definition
that uses MIDSYM.
1985-01-21 14:15:06 +00:00
keie
71cbd2c92f 1 added lint entry.
2 changed calls to cc into $(CC)
1985-01-21 14:14:22 +00:00
em
cb49888304 To have a file preprocessed, it must start with a # in column o1.
The RCSid is replaced to accomplish this.
1985-01-21 12:56:09 +00:00
em
9479f61318 Now using correct RCS identification 1985-01-21 12:47:04 +00:00
em
8d02182e12 Renaming due to 8 character C compiler limit. 1985-01-21 12:37:26 +00:00
em
aef211ad4e Used a correct definition of malloc. 1985-01-21 12:35:53 +00:00
em
a33d0e8e14 Replaced RCSid so that file starts with # in column 0 so it gets preprocessed. 1985-01-21 12:28:59 +00:00
em
4f40987ff0 Corrected type; forgot closing ". 1985-01-21 12:14:59 +00:00
em
ccfa0db0de Removed #define IDFIRST because fmt_id() replaces it. 1985-01-21 12:09:44 +00:00
em
6ac5841c7f Initial revision 1985-01-18 16:06:21 +00:00
em
f9c86fc6f6 Routines are now called with calls instead of jsb. We use ap as argument
pointer register. EM_BSIZE is required to be a constant.
1985-01-18 15:39:07 +00:00
em
a4ca3054f0 Changed label generators and added fmt_id(). 1985-01-18 15:36:51 +00:00
em
10ce06ff2b Routines are called with calls instead of jsb. EM_BSIZE is required to
be a constant.
1985-01-18 15:33:44 +00:00
duk
8d87404836 Initial revision 1985-01-18 14:30:03 +00:00
bal
2d8dcaa2df Initial revision 1985-01-18 09:59:09 +00:00
garde
d8d2068664 Initial revision 1985-01-17 14:31:34 +00:00
duk
e1ef16649c Initial revision 1985-01-17 14:20:52 +00:00
em
6512a304a0 Checking in Martin's changes. 1985-01-17 14:10:27 +00:00
keie
e75b8772ca Added some documentation for the interface between C and Pascal.
This was necessary because the format of Pascal and C procedure
pointers differ from now on.
1985-01-17 13:22:49 +00:00
keie
d19105ef78 Added the test program for the C<=>Pascal interface. 1985-01-17 12:43:51 +00:00
keie
f9b105e07a *** empty log message *** 1985-01-17 12:43:04 +00:00
bal
218ce4596e The EM runtime routines are reentrant now, so the remark about
reentrancy is removed from this file.
1985-01-17 10:39:33 +00:00
bal
8f7a447719 Bug fixed: a0 is changed by call to _brk, so it should be saved & restored. 1985-01-17 10:33:23 +00:00
keie
14a9b13fd3 Added RCS id. 1985-01-11 17:03:53 +00:00
keie
d72ad93216 Allows optional second argument.
This is the name of the destination file. The destination directory
is determined by compare.
1985-01-11 16:46:02 +00:00
keie
081413cfda 1 - Allows 2 arguments, 1 - name of source in current directory.
2 - name of destination file(!path), default arg 1.
2 - Make the necessary dirctory.
3 - runs ranlib if "ar t ... | grep SYMDEF succeeds.
1985-01-11 16:43:56 +00:00
keie
f0d34942e3 Added RCS id. 1985-01-11 16:28:30 +00:00
keie
959138af97 The previous fix produced an array in which the values were one off.
This has been fixed.
1985-01-11 13:42:51 +00:00
keie
c61ea7ee53 *** empty log message *** 1985-01-11 13:20:36 +00:00
keie
22e4268cc7 The recursive call of setp1 initialized elements 0...ASIZE.
This is out of bounds and now altered into 0..ASIZE-1.
1985-01-11 13:17:26 +00:00
keie
e2c5191f0c *** empty log message *** 1985-01-11 13:13:56 +00:00
sater
7f0def8861 RREMOVE section updated. 1985-01-11 09:44:34 +00:00
sater
dac2f97109 extra define added to aid in generation of DO_RREMOVE 1985-01-11 09:42:17 +00:00
sater
3a528a7324 code was added to generate DO_RREMOVE 1985-01-11 09:41:47 +00:00
sater
3534869cb5 code was added to cause generation of DO_RREMOVE in some cases 1985-01-11 09:41:13 +00:00
sater
e9b6045b5a diffs were applied to make default register property at stacking rule
-1 instead of 0.
1985-01-11 09:40:40 +00:00
sater
a1a8fd99a0 Optional register property in stacking rules must be -1 when absent.
Fixed this.
1985-01-10 16:30:09 +00:00
duk
d7fb9edfe2 Maybe some minor changes. 1985-01-10 13:35:39 +00:00
duk
58126396af Added call to trap signals. 1985-01-10 13:24:36 +00:00
duk
55017702e2 Header and section table now allocated statically. 1985-01-10 13:22:04 +00:00
duk
7d312abd59 Inline expansion of index_adjust() and compute_origins().
Section table now allocated statically.
1985-01-10 13:19:47 +00:00
duk
ba826bad5c Added routine to check signals. 1985-01-10 13:17:22 +00:00
sater
4ba6e7a39c *** empty log message *** 1985-01-08 15:34:54 +00:00
sater
f838dd1047 Initial revision 1985-01-08 15:28:26 +00:00
keie
6aaff51b39 *** empty log message *** 1985-01-08 13:52:58 +00:00
duk
f532b58045 Added provisions for copying everything after the string area into the
resulting object file. Because this is most likely symbolic debugging
information, these are parametrized by #ifdef SYMDBUG.
1985-01-08 11:54:57 +00:00
keie
576688fc10 *** empty log message *** 1985-01-08 11:48:43 +00:00
sater
72b83cca59 *** empty log message *** 1985-01-08 09:59:28 +00:00
keie
5edf93d2de *** empty log message *** 1985-01-07 15:54:38 +00:00
keie
dd0951f114 *** empty log message *** 1985-01-07 15:43:50 +00:00
keie
5779a88371 *** empty log message *** 1985-01-07 14:39:27 +00:00
keie
22c95138aa *** empty log message *** 1985-01-07 14:26:46 +00:00
keie
d0268a4ec1 *** empty log message *** 1985-01-07 14:15:47 +00:00
keie
112211eb3b *** empty log message *** 1985-01-07 13:57:25 +00:00
keie
d0444e3a04 15-5-83 EGK
The coercion from rm1 to register contained
                allocate(%[1],GENREG).
                The %[1] here is incorrect and has been removed.
16-5-83         EGK
                The word before the movb was cleared by a xor.
                Now we clear the upper byte after the movb.
                This allows the %[1] to be added to the allocate.
1985-01-07 13:51:36 +00:00
keie
9beb72e69b *** empty log message *** 1985-01-07 13:49:31 +00:00
keie
5fedca22ad *** empty log message *** 1985-01-07 13:37:12 +00:00
keie
b4ad7c46da *** empty log message *** 1985-01-07 13:08:48 +00:00
sater
c2229e5c60 Initial revision 1985-01-04 14:05:25 +00:00
sater
11b3f3aa8a added entries for cg,ncg and cgg 1985-01-04 14:04:10 +00:00
sater
79411cb4b3 added entry for ncg.doc 1985-01-04 13:57:11 +00:00
sater
dd8505531b Initial revision 1985-01-04 13:55:07 +00:00
keie
26f38cada3 *** empty log message *** 1985-01-01 22:33:43 +00:00
keie
c235c1a93d *** empty log message *** 1985-01-01 22:27:02 +00:00
keie
d16efbab98 *** empty log message *** 1985-01-01 22:19:09 +00:00
keie
57115f49cc Take precautions against an already existing march. 1985-01-01 21:32:02 +00:00
keie
5e8a571801 *** empty log message *** 1985-01-01 19:56:08 +00:00
keie
006c4b7a49 *** empty log message *** 1985-01-01 19:42:53 +00:00
keie
5662050ad3 Initial revision 1985-01-01 19:30:24 +00:00
keie
6a08d40d15 1 - Added void.
2 - Data and function pointers have the same size.
1985-01-01 19:24:34 +00:00
keie
fe6eed6c76 Added RCS identification. 1985-01-01 18:35:40 +00:00
keie
0ebd337637 *** empty log message *** 1985-01-01 18:34:12 +00:00
bal
ffb167e8b2 lay-out enhanced; flags (CFLAGS etc.) inherited from central Makefile;
entry for compiling this phase with ack -O created.
1984-12-21 14:41:47 +00:00
keie
6860747f3e Adapted to new tree structure. 1984-12-21 14:23:10 +00:00
sater
18dbfc024e Routine was wrong, leaving things on the stack in the one bit case,
the inclusion of slu in this routine was bogus.
It is never called anyway, so slu is taken out.
1984-12-20 15:17:05 +00:00
keie
e129db8343 1 - Added RCS id.
2 - Used two argument [feature] of install.
1984-12-20 14:26:14 +00:00
keie
b2b1167d7a See the logfile of mach/m68k2/libem/Makefile. 1984-12-20 14:21:35 +00:00
keie
6c9e4c84f0 The definition if the symbols, end, endbss etc, is moved
from a library to a file. This to avoid 2 libraries in this
directory.
1984-12-20 14:13:48 +00:00
keie
6b38714690 Added line for m68k interpreters manual. 1984-12-18 17:26:42 +00:00
keie
80d385c291 *** empty log message *** 1984-12-18 17:22:29 +00:00
keie
37d01caabd 1 - signal did not clear the stack properly.
2 - lseek did not return correct.
1984-12-18 17:12:12 +00:00
keie
7b39ce2cfa Traps now work as documented. 1984-12-18 17:11:35 +00:00
keie
53a88ccd69 1 - Human readable profile and count.
2 - Length of last table is now 64.
1984-12-18 17:09:36 +00:00
keie
2d4614ca5a Profile, count, flow in non-local goto corrected. 1984-12-18 17:08:54 +00:00
keie
246f45c867 1 - Improved line number updating when returning from library routines.
2 - Line 234, 0xD must be #0x1C, crashed at error handling for
    incorrect return size.
1984-12-18 17:07:23 +00:00
keie
b544d3b401 Replaced clr by the faster mov #0, (for d registers). 1984-12-18 17:06:36 +00:00
keie
5f41dcd958 1 - Indexed addressing mode gave unwanted sign extends.
They are replaced by additions.
2 - Added pointer checks.
3 - Completed parametrization of addresses of locals.

1984-12-18 17:04:24 +00:00
keie
9ea83d0838 Finishing profile tables. 1984-12-18 16:59:51 +00:00
keie
45e2eea414 1 - length of last table
2 - human readable profile and count output.
1984-12-18 16:58:30 +00:00
keie
8b60227186 Added pointer checks. 1984-12-18 16:58:11 +00:00
keie
f0a6c2fbcf Altered 1980 in 1984. 1984-12-18 16:57:56 +00:00
keie
8636bd025e Added machines to be sent with the second distribution to the LNTABLES. 1984-12-18 15:28:19 +00:00
keie
4d8c88e7b1 The first version, copied from 6800. 1984-12-18 15:13:56 +00:00
keie
b4faacec8c The first version, copied from 6809. 1984-12-18 15:13:55 +00:00
keie
eb15231cf4 Don't rely on cpp to be in the $PATH, call it from em/lib. 1984-12-18 13:12:30 +00:00
keie
cf947cedd3 Added Ack distribution Makefile names. 1984-12-18 13:12:03 +00:00
keie
e3bf7b5dc7 Removed the need for as in lib/m68k4.
The as in lib/m68k2 is now used directly.
1984-12-17 17:20:57 +00:00
keie
a5e9c4f8d1 *** empty log message *** 1984-12-17 15:52:04 +00:00
keie
8c874d4632 Run $RANLIB if the shell variable is set. 1984-12-17 15:50:02 +00:00
sater
d267037189 *** empty log message *** 1984-12-17 15:13:39 +00:00
sater
ea8e311e5a Changed descr to use recently developed 8080/cg. 1984-12-17 14:36:16 +00:00
keie
3ab2889451 Added 6500 documentation. 1984-12-17 11:38:36 +00:00
keie
c693044013 *** empty log message *** 1984-12-17 11:35:39 +00:00
keie
3b3d3f16b4 Adapted to new library. 1984-12-17 11:21:11 +00:00
keie
4f071008c8 *** empty log message *** 1984-12-17 11:11:37 +00:00
keie
d77b2081c0 Now using LIST. 1984-12-17 11:06:48 +00:00
keie
b097fe72a7 *** empty log message *** 1984-12-17 11:03:13 +00:00
keie
66d68121c8 Added F_DUM(Author of change-- Henry Bal). 1984-12-17 10:45:27 +00:00
keie
5060a9fcd6 *** empty log message *** 1984-12-17 10:44:08 +00:00
bal
523457f6ee Initial revision 1984-12-14 15:57:39 +00:00
bal
6babe9fccd Initial revision 1984-12-14 15:52:15 +00:00
bal
ad815f1061 Initial revision 1984-12-14 15:41:14 +00:00
keie
aa0f76a6cd Removed entries for pmds. 1984-12-14 13:45:42 +00:00
keie
c39e619032 Added Basic library and Revision number. 1984-12-10 15:14:00 +00:00
keie
4a2c2d89a0 Added revision number. 1984-12-10 14:57:51 +00:00
keie
468cdfd3eb 1 - Added Basic library.
2 - Added revision number.
1984-12-10 14:41:49 +00:00
keie
83f3de1555 Initial revision 1984-12-10 14:41:30 +00:00
keie
ef7ea116cd Added Basic library. 1984-12-10 14:29:51 +00:00
keie
f4ab1bb6e6 Initial revision 1984-12-10 14:28:41 +00:00
bal
98989fd9ca Initial revision 1984-12-10 13:36:12 +00:00
keie
9932e38ab2 Removed the definition of the NEEDS variable. 1984-12-10 12:49:56 +00:00
keie
0b9b183085 *** empty log message *** 1984-12-08 00:50:27 +00:00
keie
4cc2986757 This makefile was copied from ../../m68k2/dl.
The now irrelevant entries are removed.
1984-12-08 00:45:55 +00:00
keie
9f850cbb2d Comparing shouldn't stop when one compare fails. 1984-12-08 00:40:04 +00:00
keie
24204bca9f Added entries for pr and opr. 1984-12-08 00:28:16 +00:00
keie
1e651a534a Adapted to new install + compare, added anties for cmp, clean, opr and pr. 1984-12-08 00:17:39 +00:00
keie
1b210a8104 *** empty log message *** 1984-12-07 17:32:33 +00:00
keie
a0f184e3d1 Improved "make pr". 1984-12-07 17:14:43 +00:00
keie
9b6c26ad14 An efficiency change only. 1984-12-07 16:52:09 +00:00
keie
89a757d6f9 Added cmp entry. 1984-12-07 16:45:26 +00:00
keie
518e817345 This one works, the previous one didn't. 1984-12-07 16:42:59 +00:00
keie
f9fa5df654 install now allows a source and destination name. 1984-12-07 16:38:13 +00:00
keie
9e4b9fddab Now use prototype makefile from ../../proto. 1984-12-07 15:22:22 +00:00
ceriel
7f12f20be6 Removed a reference to a non existing Makefile ( in the lib directory). 1984-12-07 15:21:25 +00:00
bal
9019141137 Bug fixed in optimizing two adjacent basic blocks. 1984-12-07 14:19:53 +00:00
keie
af75a28622 Changed access path of em h directory. 1984-12-07 14:01:33 +00:00
keie
c744b44b48 Changed access path of en h directory. 1984-12-07 14:01:11 +00:00
keie
80d4c7ca2f Initial revision 1984-12-07 13:41:58 +00:00
keie
c2d3d6ce4a Initial revision 1984-12-07 10:42:27 +00:00
keie
47f5e79d96 The path lib/ack is changed into lib/descr.
The name ack, used as a file name was a bit overloaded.
1984-12-06 11:08:40 +00:00
ceriel
2c7c97051b Changed so that the installation process will continue if LLgen
is not present yet.
Also added Makefile to the "make pr" entry.
1984-12-06 10:39:28 +00:00
keie
0d5c765070 Repaired a few minor bugs. 1984-12-04 21:57:22 +00:00
keie
01d4011dd6 I hope this version is correct. 1984-12-04 21:48:14 +00:00
keie
7f3328678f Initial revision 1984-12-04 21:38:13 +00:00
sater
d9fe7e9cf0 Initial revision 1984-12-04 15:33:28 +00:00
bal
4e461a9860 Initial revision 1984-12-04 15:04:44 +00:00
bal
3cdaf9f4ba WORDLENGTH now defined in automatically generated file wordlen.h
Generate this file from makewlen.c
1984-12-04 15:04:01 +00:00
bal
0d0e2d2d22 WORDLENGTH now defined in automatically generated file worlen.h 1984-12-04 15:03:22 +00:00
bal
8d659c015f Bug fixed: fill_item() should initialize item->it_desirable to TRUE. 1984-12-04 14:41:20 +00:00
keie
695a914eb3 Added tail_m and tail_ln. 1984-12-04 13:31:03 +00:00
bal
9b72991e27 regsave_cost() return void instead of short. 1984-12-04 13:04:27 +00:00
bal
8db2c12881 regsave_cost() returns void instead of short. 1984-12-04 13:03:49 +00:00
keie
7e8d898bcb Initial revision 1984-12-03 23:20:13 +00:00
keie
550e4d3cee Adapted to use the files in the library directory dedicated to the pmds. 1984-12-03 22:55:26 +00:00
keie
271b83ecb3 Initial revision 1984-12-03 22:02:45 +00:00
bal
ee3ef338db Comment closer ("*/") added to description of getlines(). 1984-12-03 12:12:37 +00:00
1449 changed files with 70854 additions and 27468 deletions

135
Action Normal file
View 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
View File

@@ -0,0 +1 @@
exec sh TakeAction distr distr/Action

View File

@@ -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
View 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
View File

@@ -0,0 +1,2 @@
Before starting installation you should read
the file doc/install.pr

109
TakeAction Executable file
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View File

@@ -0,0 +1 @@
echo $1/$2

42
distr/f.attf Normal file
View 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
View 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
View File

@@ -0,0 +1,2 @@
echo "<$1/$2>"
ls -bCdx `cat .distr`

10
distr/listdirs Executable file
View 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
View 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

1
distr/mkd Executable file
View File

@@ -0,0 +1 @@
mkdir $DESTDIR/$1/$2

23
distr/mkf Executable file
View 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

1
distr/mks Executable file
View File

@@ -0,0 +1 @@
cp .distr $DESTDIR/$1

15
distr/mktree Normal file
View 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
View 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

2
distr/ts Executable file
View File

@@ -0,0 +1,2 @@
DD=`pwd`/ts
echo OK

2163
doc/6500.doc Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -4,7 +4,7 @@ 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) LLgen.$(SUF)\
basic.$(SUF)
basic.$(SUF) 6500.$(SUF) ncg.$(SUF)
NROFF=nroff
MS=-ms
@@ -16,6 +16,8 @@ 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
@@ -32,9 +34,13 @@ 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

View File

@@ -51,11 +51,8 @@ ordered alphabetically.
Appendix A discusses the differences with
Microsoft BASIC. Appendix B describes all reserved symbols.
Appendix C lists the error messages in use.
.sp
Additional information about EM and the Amsterdam Compiler Kit
can be obtained from .... and found in ......
.SH
SyNTAX NOTATION
SYNTAX NOTATION
.LP
The conventions for syntax presentation are as follows:
.IP CAPS 10
@@ -80,8 +77,6 @@ GENERAL INFORMATION
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.
.LP
Should we call the preprocessor first?
.NH 2
LINE FORMAT
.LP
@@ -145,7 +140,7 @@ Defines a double precision variable
Defines a string variable.
.LP
NOTE: Two variables with the same name but different type is
considered illegal (DONE?).
considered illegal.
.LP
Beside single valued variables, values may be grouped
into tables or arrays.
@@ -542,7 +537,7 @@ MID$
MID$(<string expr1>,n[,m])=<string expr2>
.PU
To replace a portion of a string with another string value.
The characters of <string expr> replaces characters in <string expr1>
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.

View File

@@ -133,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.
@@ -140,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
@@ -152,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.
@@ -187,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,
@@ -200,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.
@@ -227,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

View File

@@ -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

View File

@@ -388,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.
@@ -561,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

View File

@@ -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 ;

View File

@@ -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;

View File

@@ -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
View 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.

File diff suppressed because it is too large Load Diff

2948
doc/ncg.doc Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -413,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.
@@ -1304,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

68
doc/z80.doc Normal file
View 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
View 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
View 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
View File

@@ -0,0 +1 @@
0

10
emtest/ok Executable file
View 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
View 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
View 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
View File

3605
emtest/tests Normal file

File diff suppressed because it is too large Load Diff

26
etc/Makefile Normal file
View 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
View 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

71
etc/new_table Executable file
View 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
View 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
View 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
View 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
View 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
View 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
View 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

View File

@@ -4,4 +4,4 @@
/* 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/ack"
#define ACK_PATH "lib/descr"

146
first/first Executable file
View 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

View File

@@ -4,4 +4,4 @@
# define VERSION 3 /* 16 bits number */
/* The default machine used by ack, acc, apc */
# define ACKM "vax2"
# define ACKM "pdp"

View File

@@ -12,4 +12,6 @@ typedef struct{
int strlength;
} String;
String *_newstr() ;
#define MAXSTRING 1024

154
h/cgg_cg.h Normal file
View 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); \
}

View 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

View File

@@ -3,32 +3,32 @@ abs.c
asc.c
asrt.c
atn.c
conversion.c
error.c
file.c
hlt.c
print.c
read.c
return.c
salloc.c
string.c
trap.c
write.c
chr.c
conversion.c
hlt.c
mki.c
oct.c
peek.c
power.c
io.c
exp.c
log.c
sin.c
sqt.c
sgn.c
print.c
io.c
random.c
mki.c
peek.c
trace.c
swap.c
fef.e
read.c
return.c
sgn.c
sin.c
fif.e
oct.c
setline.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

View File

@@ -1,4 +1,4 @@
/* $Header $ */
/* $Header$ */
long _abl(i) long i;
{

View File

@@ -1,6 +1,6 @@
#include "string.h"
#include "bc_string.h"
/* $Header $ */
/* $Header$ */
int _asc(str)
String *str;

View File

@@ -1,4 +1,4 @@
/* $Header $ */
/* $Header$ */
asrt(b)
{

View File

@@ -15,7 +15,7 @@
*
*/
/* $Header $ */
/* $Header$ */
/* Author: J.W. Stevenson */

View File

@@ -1,6 +1,6 @@
#include "string.h"
#include "bc_string.h"
/* $Header $ */
/* $Header$ */
String *_chr(i)
int i;
@@ -12,6 +12,6 @@ int i;
error(3);
buf[0]=i;
buf[1]=0;
s= (String *) _newstr(buf);
s= _newstr(buf);
return(s);
}

View File

@@ -1,4 +1,4 @@
/* $Header $ */
/* $Header$ */
int _cint(f) double f;
{

View File

@@ -1,4 +1,4 @@
/* $Header $ */
/* $Header$ */
/* error takes an error value in the range of 0-255 */
/* and generates a trap */

View File

@@ -15,7 +15,7 @@
*
*/
/* $Header $ */
/* $Header$ */
/* Author: J.W. Stevenson */

View File

@@ -1,8 +1,8 @@
#include "string.h"
#include "bc_string.h"
#include <stdio.h>
#include "io.h"
#include "bc_io.h"
/* $Header $ */
/* $Header$ */
Filedesc _fdtable[16];
/* BASIC file descriptor table */
@@ -18,7 +18,7 @@ int _chann = -1;
FILE *_chanrd = stdin;
FILE *_chanwr = stdout;
_setchannel(index)
_setchan(index)
int index;
{
#ifdef DEBUG

View File

@@ -1,4 +1,4 @@
/* $Header $ */
/* $Header$ */
_hlt(nr)
int nr;

View File

@@ -1,7 +1,7 @@
#include "io.h"
#include "bc_io.h"
#include <sgtty.h>
/* $Header $ */
/* $Header$ */
struct sgttyb _ttydef;
@@ -59,6 +59,7 @@ _zone()
_in(buf)
char *buf;
{
register int holder ;
char *c;
int pos;
if( _chann == -1)
@@ -69,8 +70,9 @@ char *buf;
stty(0,_ttydef);
}else pos= _fdtable[_chann].pos;
c= buf;
while( (*c = fgetc(_chanrd)) != EOF && *c != '\n'){
if( _chann == -1) putchar(*c);
while( (holder = fgetc(_chanrd)) != EOF && holder != '\n'){
*c= holder ;
if( _chann == -1) putchar(holder);
c++; pos++;
}
*c= 0;

View File

@@ -15,7 +15,7 @@
*
*/
/* $Header $ */
/* $Header$ */
/* Author: J.W. Stevenson */

View File

@@ -1,15 +1,15 @@
#include "string.h"
#include "bc_string.h"
/* $Header $ */
/* $Header$ */
String *_mki(i)
int i;
long i;
{
char *buffer =" ";
char *buffer =" ";
String *s;
s= (String *) _newstr(buffer);
strncpy(s->strval,&i,2);
s= _newstr(buffer);
* ( (long *)s->strval ) = i ;
return(s);
}
String *_mkd(d)
@@ -18,20 +18,17 @@ double d;
char *buffer =" ";
String *s;
s= (String *) _newstr(buffer);
strncpy(s->strval,&d,8);
s= _newstr(buffer);
* ( (double *)s->strval ) = d ;
return(s);
}
_cvi(s)
long _cvi(s)
String *s;
{
int i;
strncpy(&i,s->strval,2);
return(i);
return *( (long *) s->strval) ;
}
double _cvd(s)
String *s;
{
double d;
strncpy(&d,s->strval,8);
return *( (double *) s->strval) ;
}

View File

@@ -1,6 +1,6 @@
#include "string.h"
#include "bc_string.h"
/* $Header $ */
/* $Header$ */
String *_oct(i)
int i;

View File

@@ -1,4 +1,4 @@
/* $Header $ */
/* $Header$ */
int peek(addr)
int addr;

View File

@@ -1,4 +1,4 @@
/* $Header $ */
/* $Header$ */
/*
computes a^b.

View File

@@ -1,7 +1,7 @@
#include "string.h"
#include "io.h"
#include "bc_string.h"
#include "bc_io.h"
/* $Header $ */
/* $Header$ */
/* Here all routine to generate terminal oriented output is located */

View File

@@ -1,17 +1,17 @@
/* $Header $ */
/* $Header$ */
_randomize()
_randomi()
{
int i;
double f;
_setchannel(-1);
_setchan(-1);
printf("Random number seed (-32768 to 32767) ? ");
_readint(&i);
f=i;
_setrandom(f);
_setrand(f);
}
_setrandom(f)
_setrand(f)
double f;
{
int i;

View File

@@ -1,19 +1,19 @@
#include "string.h"
#include "io.h"
#include "bc_string.h"
#include "bc_io.h"
#include <ctype.h>
/* $Header $ */
/* $Header$ */
_readln()
{
char c;
register int c;
while( (c=fgetc(_chanrd)) != EOF && c!= '\n')
;
}
readskip()
{
char c;
register int c;
#ifdef DEBUG
printf("readskip\n");
#endif
@@ -73,6 +73,7 @@ _readstr(s)
String **s;
{
char buffer[1024];
register int kar ;
char *c;
#ifdef DEBUG
@@ -80,17 +81,18 @@ String **s;
#endif
_asschn();
c= buffer;
*c= fgetc(_chanrd);
while(isspace(*c) && *c!= EOF)
*c= fgetc(_chanrd);
if( *c== '"')
kar= fgetc(_chanrd);
while(isspace(kar) && kar!= EOF)
kar= fgetc(_chanrd);
*c=kar ;
if( kar== '"')
{
/* read quoted string */
#ifdef DEBUG
printf("qouted string\n");
#endif
while( (*c= fgetc(_chanrd)) != '"' && *c!= EOF ) c++;
ungetc(*c,_chanrd);
while ( (kar= fgetc(_chanrd)) != EOF && kar!='"' ) *c++ = kar ;
ungetc(kar,_chanrd);
*c=0;
}else
if( isalpha(*c))
@@ -100,10 +102,10 @@ String **s;
#ifdef DEBUG
printf("non-qouted string\n");
#endif
while( (*c= fgetc(_chanrd)) != ',' && *c!= EOF &&
!isspace(*c) && *c!='\n')
c++;
ungetc(*c,_chanrd);
while( (kar= fgetc(_chanrd)) != ',' && kar!= EOF &&
!isspace(kar) && kar!='\n')
*c++= kar ;
ungetc(kar,_chanrd);
*c=0;
}else{
if( ferror(_chanrd)) error(29);
@@ -126,7 +128,7 @@ String **s;
*s= (String *) _newstr(buffer);
}
extern int _seektable[];
extern int _seektab[];
_restore(line)
int line;
@@ -141,9 +143,9 @@ int line;
if( line)
{
/* search number of lines to skip */
for(nr=0; _seektable[nr] && _seektable[nr]< line; nr+=2)
for(nr=0; _seektab[nr] && _seektab[nr]< line; nr+=2)
#ifdef DEBUG
printf("test %d %d\n",_seektable[nr], _seektable[nr+1]);
printf("test %d %d\n",_seektab[nr], _seektab[nr+1]);
#endif
;
nr /= 2;

View File

@@ -1,4 +1,4 @@
/* $Header $ */
/* $Header$ */
#define MAXNESTING 1000

View File

@@ -1,11 +1,13 @@
/* $Header $ */
/* $Header$ */
extern char *malloc() ;
char * salloc(length)
int length;
unsigned length;
{
char *c, *s;
c= (char *) malloc(length);
if( c== (char *) -1) error(5);
c= malloc(length);
if( !c ) error(5);
for(s=c;s<c+length;s++) *s = 0;
return(c);
}
@@ -13,6 +15,6 @@ int length;
sfree(c)
char *c;
{
if( c== 0) return;
if( !c ) return;
free(c);
}

View File

@@ -1,4 +1,4 @@
/* $Header $ */
/* $Header$ */
_sgn(v)
double v;

View File

@@ -15,7 +15,7 @@
*
*/
/* $Header $ */
/* $Header$ */
/* Author: J.W. Stevenson */

View File

@@ -15,7 +15,7 @@
*
*/
/* $Header $ */
/* $Header$ */
/* Author: J.W. Stevenson */

View File

@@ -1,4 +1,4 @@
/* $Header $ */
/* $Header$ */
_stop()
{

View File

@@ -1,10 +1,12 @@
#include "string.h"
#include "bc_string.h"
/* $Header $ */
/* $Header$ */
#define ok(X) if( X ==0) return;
#define okr(X) if( X ==0) return(0);
extern char *salloc() ;
_len(str)
String *str;
{
@@ -19,7 +21,7 @@ char *str;
s= (String *) salloc(sizeof(String));
s->strcount=1;
s->strlength= strlen(str);
s->strval= (char *) salloc(s->strlength+1);
s->strval= salloc(s->strlength+1);
strcpy(s->strval,str);
return(s);
}
@@ -34,6 +36,8 @@ _decstr(str)
String *str;
{
ok(str);
/* Strings in ROM are initialized with this count */
if ( str->strcount==9999 ) return ;
str->strcount--;
if(str->strcount<=0) _delstr(str);
}
@@ -51,7 +55,7 @@ String *src;
{
ok(src);
sfree(src->strval);
sfree(src);
sfree((char *)src);
}
String *_concat(s1,s2)
String *s1,*s2;
@@ -61,12 +65,12 @@ String *s1,*s2;
okr(s1); okr(s2);
s= (String *) salloc(sizeof(String));
length= _len(s1)+_len(s2)+1;
s->strval= (char *) salloc(length);
s->strval= salloc(length);
strcpy(s->strval,s2->strval);
strcat(s->strval,s1->strval);
return(s);
}
_strcompare(s1,s2)
_strcomp(s1,s2)
String *s1,*s2;
{
okr(s1);okr(s2);
@@ -83,7 +87,7 @@ int size;
okr(s);
if( size <0 || size >s->strlength) error(3);
ns= (String *) salloc(sizeof(String));
ns->strval= (char *) salloc(size+1);
ns->strval= salloc(size+1);
ns->strcount=1;
for(i=0; i<size && s->strval[i];i++)
ns->strval[i]= s->strval[i];
@@ -102,7 +106,7 @@ int d;
s= (String *) salloc(sizeof(String));
s->strlength= len;
s->strcount=1;
s->strval= (char *) salloc(len+1);
s->strval= salloc(len+1);
for(i=0;i<len;i++)
s->strval[i]= ' ';
s->strval[i]=0;
@@ -123,7 +127,7 @@ double d,f;
s= (String *) salloc(sizeof(String));
s->strlength= i;
s->strcount=1;
s->strval= (char *) salloc(i+1);
s->strval= salloc(i+1);
s->strval[i]=0;
for(; i>=0;i--)
s->strval[i]= j;

View File

@@ -1,6 +1,6 @@
#include "string.h"
#include "bc_string.h"
/* $Header $ */
/* $Header$ */
_intswap(i1,i2)
int *i1,*i2;

View File

@@ -1,7 +1,7 @@
/* $Header $ */
/* $Header$ */
_trace()
{
_trace(i)
int i;
{
printf("[%d]",i);
}

View File

@@ -1,7 +1,7 @@
#include <signal.h>
#include <setjmp.h>
/* $Header $ */
/* $Header$ */
/* Trap handling */
int _trpline; /* BASIC return label */

View File

@@ -1,7 +1,7 @@
#include "string.h"
#include "io.h"
#include "bc_string.h"
#include "bc_io.h"
/* $Header $ */
/* $Header$ */
/* assume that the channel has been set */
@@ -19,14 +19,17 @@ int i;
if(i>0)
if( fputc(' ',_chanwr)==EOF) error(29);
fprintf(_chanwr,"%d",i);
if( ferror(_chanwr) ) error(29);
}
_wrflt(f)
double f;
{
if( fprintf(_chanwr,"%f",f)== EOF) error(29);
fprintf(_chanwr,"%f",f);
if( ferror(_chanwr) ) error(29);
}
_wrstr(s)
String *s;
{
if( fprintf(_chanwr,"\"%s\"",s->strval)== EOF) error(29);
fprintf(_chanwr,"\"%s\"",s->strval);
if( ferror(_chanwr) ) error(29);
}

View File

@@ -5,12 +5,16 @@ h=$d/h
l=$d/lib
INSTALL=$l/em_bem
CFLAGS = -c -I$h
CFLAGS = -I$h
FILES= bem.o y.tab.o symbols.o initialize.o compile.o \
parsepar.o yywrap.o gencode.o util.o graph.o \
eval.o func.o split.o
CFILES= bem.c y.tab.c symbols.c initialize.c compile.c \
parsepar.c yywrap.c gencode.c util.c graph.c \
eval.c func.c split.c
SRC= bem.h symbols.h graph.h y.tab.h \
bem.c basic.yacc symbols.c initialize.c compile.c \
parsepar.c yywrap.c gencode.c util.c graph.c \
@@ -33,12 +37,15 @@ pr:
@pr $(SRC)
bem: $(FILES)
cc -o bem $(FILES)
$(CC) -o bem $(FILES)
y.tab.o : y.tab.c lex.c
cc $(CFLAGS) y.tab.c
y.tab.o : y.tab.c basic.lex
$(CC) $(CFLAGS) -c y.tab.c
y.tab.h y.tab.c : basic.yacc
yacc -d basic.yacc
$(FILES) : bem.h symbols.h graph.h y.tab.h
lint: $(CFILES)
lint -phac -I$h $(CFILES)

View File

@@ -101,7 +101,7 @@ Key keywords [] ={
"print", PRINTSYM, 0, 0,
"pos", FUNCTION, POSSYM, 0,
"put", PUTSYM, 0, 0,
"randomize", RANDOMIZESYM, 0, 0,
"randomi", RANDOMIZESYM, 0, 0,
"read", READSYM, 0, 0,
"rem", REMSYM, 0, 0,
"renum", ILLEGAL, 0, 0,
@@ -224,7 +224,7 @@ char name[SIGNIFICANT+1];
lookup()
{
Key *k;
Symbol *s;
Symbol *Sym;
char *c;
int i, typech;
@@ -239,7 +239,7 @@ lookup()
if( isalnum( *(cptr+k->length) ) &&
k->token==FUNCTION) continue;
cptr += k->length;
yylval= k->classvalue;
yylval.integer= k->classvalue;
if(debug) printf("lookup:%d %d\n",
k->classvalue,k->token);
if( k->token == FUNCTION)
@@ -261,17 +261,17 @@ lookup()
if( i<SIGNIFICANT) name[i++]= *c++;
name[i]=0;
cptr=c;
s= (Symbol *) srchsymbol(name);
yylval = (YYSTYPE) s;
Sym= srchsymbol(name);
yylval.Sptr = Sym;
typech= typechar();
if(s->symtype!=DEFAULTTYPE)
if(Sym->symtype!=DEFAULTTYPE)
{
if(typech && typech!=s->symtype && wflag)
if(typech && typech!=Sym->symtype && wflag)
warning("type re-declared,ignored");
}
if( typech)
s->symtype=typech;
if(debug) printf("lookup:%d Identifier\n",s);
Sym->symtype=typech;
if(debug) printf("lookup:%d Identifier\n",Sym);
if( (name[0]=='f' || name[0]=='F') &&
(name[1]=='n' || name[1]=='N') )
return(FUNCTID);
@@ -322,16 +322,17 @@ number()
cptr=c;
if( *c != '.'){
if( i1> MAXINT || i1<MININT) {
dval= i1;
/*NOSTRICT*/ dval= i1;
return(FLTVALUE);
}
ival= i1;
/*NOSTRICT*/ ival= i1;
#ifdef YYDEBUG
if(yydebug) printf("number:INTVALUE %d",i1);
#endif
return(INTVALUE);
}
/* handle floats */
/*NOSTRICT*/
f= i1; dec=0.1;
c++;
while( isdigit(*c)){
@@ -365,7 +366,7 @@ scanstring()
the EM file as well, because it is not used internally
*/
/* generate label here */
yylval= genrom();
yylval.integer= genrom();
length=0;
if( fputc('"',emfile) == EOF) fatal("scanstring");
sval= cptr;
@@ -392,9 +393,9 @@ scanstring()
*cptr=0;
cptr++;
fprintf(emfile,"\\000\"\n");
i=yylval;
yylval= genrom();
fprintf(emfile,"l%d,1,%d\n",i,length);
i=yylval.integer;
yylval.integer= genrom();
fprintf(emfile,"l%d,9999,%d\n",i,length);
#ifdef YYDEBUG
if(yydebug) printf("STRVALUE found\n");
#endif
@@ -447,20 +448,19 @@ yylex()
case '?': return(PRINTSYM);
case '>':
if( *(c+1)=='='){
c++;c++;cptr=c; yylval= GESYM;return(RELOP);
c++;c++;cptr=c; yylval.integer= GESYM;return(RELOP);
}
yylval= '>';
yylval.integer= '>';
cptr++;
return(RELOP);
break;
case '<':
if( *(c+1)=='='){
c++; c++; cptr=c; yylval=LESYM; return(RELOP);
c++; c++; cptr=c; yylval.integer=LESYM; return(RELOP);
} else
if( *(c+1)=='>'){
c++; c++; cptr=c; yylval=NESYM; return(RELOP);
c++; c++; cptr=c; yylval.integer=NESYM; return(RELOP);
}
yylval= '<';
yylval.integer= '<';
cptr++;
return(RELOP);
}

View File

@@ -18,13 +18,13 @@
%token ELSESYM
%token FIELDSYM
%token FORSYM
%token FUNCTION
%token FUNCTID
%token <integer> FUNCTION
%token <Sptr> FUNCTID
%token INKEYSYM
%token GETSYM
%token GOSUBSYM
%token GOTOSYM
%token IFSYM
%token <integer> IFSYM
%token INPUTSYM
%token LETSYM
%token LINESYM
@@ -48,7 +48,7 @@
%token SWAPSYM
%token THENSYM
%token TOSYM
%token TRONOFFSYM
%token <integer> TRONOFFSYM
%token USINGSYM
%token USRSYM
%token WHILESYM
@@ -59,16 +59,22 @@
%token INTVALUE
%token FLTVALUE
%token DBLVALUE
%token STRVALUE
%token <integer> STRVALUE
%token UNARYSYM
%token IDENTIFIER
%token <Sptr> IDENTIFIER
%token ANDSYM
%token ORSYM
%token VARPTR
%left BOOLOP
%type <Sptr> arraydcl identifier indexed
%type <cptr> getput
%type <integer> exprlist expression negation compare sum term factor
%type <integer> parmlist variable printlist inputtail funcname funccall
%left <integer> BOOLOP
%left NOTSYM
%left RELOP '=' '<' '>' LESYM GESYM NESYM
%left '=' '<' '>' LESYM GESYM NESYM
%left <integer> RELOP
%left '+' '-'
%left '*' '/' '\\' MODSYM
%left '^'
@@ -78,11 +84,16 @@
#define YYDEBUG
#include "bem.h"
int ival; /* parser temporary values */
typedef union {
int integer ;
Symbol *Sptr ;
char *cptr ;
} YYSTYPE ;
int ival;
double dval;
char *sval;
int e1,e2;
int chann; /* input/output channel */
char *formatstring; /* formatstring used for printing */
Symbol *s; /* Symbol dummy */
@@ -147,11 +158,11 @@ illegalstmt: ILLEGAL {illegalcmd();}
callstmt: CALLSYM IDENTIFIER parmlist ')'
{
emcode("cal",proclabel(((Symbol *) $2)->symname));
emcode("cal",proclabel($2->symname));
while($3 -- >0) emcode("asp",EMPTRSIZE);
}
| CALLSYM IDENTIFIER
{ emcode("cal",proclabel(((Symbol *) $2)->symname));}
{ emcode("cal",proclabel($2->symname));}
parmlist: '(' variable { $$=1;}
| parmlist ',' variable { $$= $1+1;}
@@ -162,10 +173,10 @@ clearstmt: CLEARSYM {warning("statement ignored");}
closestmt: CLOSESYM filelist
| CLOSESYM {emcode("cal","$_close");}
filelist: cross intvalue { emcode("loc",$2);
filelist: cross intvalue { emcode("loc",itoa(ival));
emcode("cal","$_clochn");
emcode("asp",EMINTSIZE);}
| filelist ',' cross intvalue { emcode("loc",$4);
| filelist ',' cross intvalue { emcode("loc",itoa(ival));
emcode("cal","$_clochn");
emcode("asp",EMINTSIZE);}
@@ -203,11 +214,11 @@ dimstmt: DIMSYM arraydcl ')' {dclarray($2);}
| dimstmt ',' arraydcl ')' {dclarray($3);}
;
arraydcl : IDENTIFIER '(' INTVALUE {$$=$1; s= (Symbol *) $1;
arraydcl : IDENTIFIER '(' INTVALUE {$$=$1; s= $1;
s->dimlimit[s->dimensions]=ival;
s->dimensions++;
}
| arraydcl ',' INTVALUE {$$=$1; s=(Symbol *) $1;
| arraydcl ',' INTVALUE {$$=$1; s= $1;
if(s->dimensions<MAXDIMENSIONS)
{
s->dimlimit[s->dimensions]=ival;
@@ -233,7 +244,7 @@ step : STEPSYM expression {forstep($2);}
;
nextstmt: NEXTSYM IDENTIFIER {nextstmt($2);}
| NEXTSYM { nextstmt(0);}
| NEXTSYM { nextstmt((Symbol *)0);}
| nextstmt ',' IDENTIFIER { nextstmt($3);}
getstmt: getput {emcode("loc",itoa(0));
@@ -245,8 +256,8 @@ getstmt: getput {emcode("loc",itoa(0));
emcode("cal",$1);
emcode("asp",EMINTSIZE);
}
getput: GETSYM cross intvalue { setchannel(ival); $$= (YYSTYPE)"$_getrec";}
| PUTSYM cross intvalue { setchannel(ival); $$= (YYSTYPE)"$_putsym";}
getput: GETSYM cross intvalue { setchannel(ival); $$= "$_getrec";}
| PUTSYM cross intvalue { setchannel(ival); $$= "$_putsym";}
gosubstmt: GOSUBSYM INTVALUE {gosubstmt(ival);}
@@ -328,7 +339,7 @@ mode : expression ',' {conversion($1,STRINGTYPE);}
| ',' { emcode("lae","_iomode");}
;
optionstmt: OPTIONSYM BASESYM intvalue { optionbase($3);}
optionstmt: OPTIONSYM BASESYM intvalue { optionbase(ival);}
printstmt: PRINTSYM {setchannel(-1);emcode("cal","$_nl");}
| PRINTSYM file format printlist
@@ -351,10 +362,10 @@ printlist: expression { printstmt($1); $$=1;}
pokestmt: POKESYM expression ',' expression {pokestmt($2,$4);}
;
randomizestmt: RANDOMIZESYM
{ emcode("cal","$_randomize");}
{ emcode("cal","$_randomi");}
| RANDOMIZESYM expression
{ conversion($2,INTTYPE);
emcode("cal","$_setrandom");
emcode("cal","$_setrand");
emcode("asp",EMINTSIZE);}
readstmt: READSYM {setchannel(0);} variable { readelm($3);}
@@ -417,8 +428,8 @@ factor : INTVALUE {$$=loadint(ival);}
| '(' expression ')' {$$=$2;}
| '-' factor { $$=negate($2);}
| FLTVALUE {$$=loaddbl(dval);}
| STRVALUE {$$=loadstr($1);}
| variable {$$=loadvar($1);}
| STRVALUE {$$= STRINGTYPE; loadstr($1);}
| variable {$$=$1; loadvar($1);}
| INKEYSYM '$' { emcode("cal","$_inkey");
emcode("lfr",EMPTRSIZE);
$$= STRINGTYPE;
@@ -426,11 +437,14 @@ factor : INTVALUE {$$=loadint(ival);}
| VARPTR '(' '#' intvalue ')' { warning("Not supported"); $$=INTTYPE;}
| FUNCTION {$$= callfcn($1,0);}
| FUNCTION '(' cross exprlist')' {$$=callfcn($1,$4);}
| funcname { $$=fcnend($1);}
| funcname funccall ')' { $$=fcnend($1,$2);}
| funcname { $$=fcnend(0);}
| funcname funccall ')' { $$=fcnend($2);}
| MIDSYM '$' midparms
{ emcode("cal","$_mid");
emcode("asp",itoa($3));
emcode("asp",EMINTSIZE);
emcode("asp",EMINTSIZE);
emcode("asp",EMPTRSIZE);
/* emcode("asp",itoa($3)); */
emcode("lfr",EMPTRSIZE);
$$= STRINGTYPE;
}
@@ -460,4 +474,4 @@ exprlist: expression { typetable[0]= $1; $$=1;}
#ifndef NORCSID
static char rcs_id[] = "$Header$" ;
#endif
#include "lex.c"
#include "basic.lex"

View File

@@ -13,7 +13,6 @@
# define RCS_BEM "$Header$"
#endif
#define POINTERSIZE 4
#define MAXINT 32768
#define MININT -32767
#define EMINTSIZE "EM_WSIZE"
@@ -26,6 +25,8 @@
#define CHANNEL 0
#define THRESHOLD 40 /* for splitting blocks */
#define void int /* Some C compilers don't know void */
extern char *program; /* name of source program */
extern char *inpfile; /* input tko compiler */
extern char *outfile; /* output from compiler */
@@ -60,4 +61,12 @@ extern Linerecord *currline;
extern char *itoa();
extern char *datalabel();
extern char *instrlabel();
extern char *proclabel();
extern char *typesize();
extern char *typestring();
extern char *salloc();
extern char *sprintf();
extern char *strcpy();
extern char *strcat();
extern char *malloc();

View File

@@ -6,13 +6,15 @@ static char rcs_id[] = "$Header$" ;
/* compile the next program in the list */
/* Here we should open the input file. (for the future) */
FILE *yyin;
compileprogram()
compileprogram(dummyprog)
char *dummyprog;
{
while( getline())
yyparse();
fclose(yyin);
(void) yyparse();
(void) fclose(yyin);
}

View File

@@ -157,7 +157,7 @@ int ltype,rtype,operator;
else
if( result==STRINGTYPE)
{
emcode("cal","$_strcompare");
emcode("cal","$_strcomp");
emcode("asp",EMPTRSIZE);
emcode("asp",EMPTRSIZE);
emcode("lfr",EMINTSIZE);
@@ -321,7 +321,6 @@ int type;
{
/* load a simple variable its address is on the stack*/
emcode("loi",typestring(type));
return(type);
}
loadint(value)
int value;
@@ -343,7 +342,6 @@ loadstr(value)
int value;
{
emcode("lae",datalabel(value));
return(STRINGTYPE);
}
loadaddr(s)
Symbol *s;

View File

@@ -52,7 +52,11 @@ int nr;
fprintf(tmpfile,"%d\n",currline->emlabel);
fprintf(tmpfile," lin %d\n",nr);
emlinecount += 2;
if( tronoff || traceflag) emcode("cal","$_trace");
if( tronoff || traceflag) {
emcode("loc",itoa(nr));
emcode("cal","$_trace");
emcode("asp","EM_WSIZE");
}
}
emcode(operation,params)
@@ -67,9 +71,9 @@ List *datalist=0;
datastmt()
{
List *l,*l1;
l= (List *) salloc(sizeof(List));
/*NOSTRICT*/ l= (List *) salloc(sizeof(List));
l->linenr= currline->linenr;
l->emlabel= (long) ftell(datfile);
/*NOSTRICT?*/ l->emlabel= (long) ftell(datfile);
if( datalist==0)
{
datalist=l;
@@ -89,8 +93,8 @@ datatable()
int line=0;
/* called at end to generate the data seek table */
fprintf(emfile," exa _seektable\n");
fprintf(emfile,"_seektable\n");
fprintf(emfile," exa _seektab\n");
fprintf(emfile,"_seektab\n");
l= datalist;
while(l)
{
@@ -192,7 +196,7 @@ int lab;
/* save this information too */
emcode("loc",itoa(0));
emcode("cal","$_setchannel");
emcode("cal","$_setchan");
emcode("asp",EMINTSIZE);
emcode("loc",itoa(lab));
emcode("cal","$_restore");
@@ -266,7 +270,7 @@ setchannel(val)
int val;
{ /* obtain file descroption */
emcode("loc",itoa(val));
emcode("cal","$_setchannel");
emcode("cal","$_setchan");
emcode("asp",EMINTSIZE);
}
/* The if-then-else statements */
@@ -541,12 +545,20 @@ prolog2()
if( dataused)
{
fprintf(emfile," loc 0\n");
fprintf(emfile," cal $_setchannel\n");
fprintf(emfile," cal $_setchan\n");
fprintf(emfile," asp EM_WSIZE\n");
fprintf(emfile,"datfname\n rom \"%s\"\n", datfname);
fprintf(emfile," lae datfname\n");
fprintf(emfile,"datfname\n rom \"%s\\0\"\n", datfname);
fprintf(emfile,"dattyp\n rom \"i\\0\"\n");
fprintf(emfile,"datfdes\n rom datfname,1,%d\n",
strlen(datfname));
fprintf(emfile,"dattdes\n rom dattyp,1,1\n");
fprintf(emfile," lae dattdes\n");
fprintf(emfile," lae datfdes\n");
fprintf(emfile," loc 0\n");
fprintf(emfile," cal $_opnchn\n");
fprintf(emfile," asp EM_PSIZE\n");
fprintf(emfile," asp EM_PSIZE\n");
fprintf(emfile," asp EM_WSIZE\n");
}
datatable();
}

View File

@@ -11,6 +11,13 @@ Linerecord *firstline,
*currline,
*lastline;
List *newlist()
{
List *l;
/*NOSTRICT*/ l= (List *) salloc(sizeof(List));
return(l);
}
/* Line management is handled here */
Linerecord *srchline(nr)
@@ -68,7 +75,7 @@ int nr;
}
/* make new EM block structure */
l= (Linerecord *) salloc(sizeof(*l));
/*NOSTRICT*/ l= (Linerecord *) salloc(sizeof(*l));
l->emlabel= frwrd? frwrd->emlabel: genlabel();
l->linenr= nr;
/* save offset into tmpfile too */
@@ -94,7 +101,7 @@ int nr;
if(debug) printf("goto label %d\n",nr);
/* update currline */
ll= (List *) salloc( sizeof(*ll));
ll= newlist();
ll-> linenr=nr;
ll-> nextlist= currline->gotos;
currline->gotos= ll;
@@ -108,7 +115,7 @@ int nr;
{
/* declare forward label */
if(debug) printf("declare forward %d\n",nr);
ll= (List *) salloc( sizeof(*ll));
ll= newlist();
ll->emlabel= genlabel();
ll-> linenr=nr;
ll->nextlist= forwardlabel;
@@ -132,9 +139,8 @@ int gosubcnt=1;
List *gosublabel()
{
List *l;
int n;
l= (List *) salloc(sizeof(List));
l= newlist();
l->nextlist=0;
l->emlabel=genlabel();
if( gotail){
@@ -192,7 +198,7 @@ int nr;
{
List *l;
l= (List *) salloc(sizeof(List));
l= newlist();
l->emlabel= gotolabel(nr);
l->nextlist=0;
if( jumphead==0) jumphead= jumptail= l;
@@ -247,7 +253,7 @@ int type;
}
jumphead= jumptail=0; jumpcnt=0;
l= (List *) salloc(sizeof(List));
l= newlist();
l->nextlist=0;
l->emlabel=firstlabel;
if( gotail){
@@ -277,12 +283,12 @@ simpleprogram()
/* a small EM programs has been found */
prologcode();
prolog2();
fclose(tmpfile);
(void) fclose(tmpfile);
tmpfile= fopen(tmpfname,"r");
if( tmpfile==NULL)
fatal("tmp file disappeared");
while( (length=fread(buf,1,512,tmpfile)) != 0)
fwrite(buf,1,length,emfile);
(void) fwrite(buf,1,length,emfile);
epilogcode();
unlink(tmpfname);
(void) unlink(tmpfname);
}

Some files were not shown because too many files have changed in this diff Show More