560 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
ceriel
7e3e49082c Increased MAXPATLEN to 8000. 1984-11-30 11:14:18 +00:00
bal
0778ce4a9a Macros for B_DIST, B_USECNT and B_MARK removed, as these fields are
no longer used.
Declarations of nrinstrs and instrmap marked "extern" to satisfy ack compiler.
1984-11-30 10:52:05 +00:00
bal
7351e38ed5 Declaration of items[] made static to avoid name conflict with ra_items.c
Core allocation macros added.
1984-11-30 10:50:27 +00:00
bal
bac0efbedb Declaration of items[] made static to avoid name conflict with ra.c 1984-11-30 10:49:09 +00:00
bal
302608566a routines getcall(), get_text() and getcc() move from get.c to this file
routines putactuals(), putcall(), and putcc() move from put.c to this file
get.h, put.h, stdio.h, em_mnem.h and em_pseu.h included
1984-11-30 10:30:22 +00:00
bal
c814b9523d several data structures added (moved from types.h).
core allocation macros added.
1984-11-30 10:28:35 +00:00
bal
39891edd12 Declarations for iv and code_info added (moved from types.h).
core allocation macros added.
1984-11-30 10:27:05 +00:00
bal
90df1e5b9a core allocation macros added 1984-11-30 10:25:21 +00:00
bal
1e69d3458c declaration for sym,num and prc added (moved from types.h) 1984-11-30 10:24:21 +00:00
bal
6988358e29 ic.h included before ic_lookup.h 1984-11-30 10:23:34 +00:00
bal
49137da06b Lots of procedures removed (turned into macro in alloc.h or
moved to one specific phase).
1984-11-30 10:15:24 +00:00
bal
594a5bb49b Lots of data structures removed and made local to one specific phase. 1984-11-30 10:14:30 +00:00
bal
e5a282c621 Lots of procedure newxxx() and oldxxx() turned into macros.
Lots of such procedures removed and made local to one specific phase.
1984-11-30 10:12:37 +00:00
bal
4ab54c85a8 As getbblocks() was moved to cf.c, em_flag.h need no longer
be included.; also, the declaration for em_flag[] was removed.
1984-11-30 10:10:41 +00:00
em
7ac377c750 The routine salloc crashed on a 2/4 system.
Malloc was nor declared as "char *", but by default as int.
1984-11-30 00:16:29 +00:00
em
ad104f9164 I removed the unused integer deftype.
Its name collided with an array in symbols.c.
1984-11-29 17:27:00 +00:00
em
1b8f41d3b2 The definitions of lastline, currline and firstline are made
extern in graph.h. The space reserving declaration is made in
graph.c.
1984-11-29 17:26:44 +00:00
bal
b532117b2b -O flag removed 1984-11-29 16:25:08 +00:00
bal
bda5c8409c macros newlvbx and oldlvbx added. 1984-11-29 15:10:11 +00:00
em
f6da80afd8 The first line should contain the distribution library name. 1984-11-29 15:03:41 +00:00
bal
8a15a3f597 macros newlocal() and oldlocal() moved to alloc.h 1984-11-29 14:40:31 +00:00
em
ae1e81adb1 *** empty log message *** 1984-11-29 14:22:02 +00:00
bal
0c0c3b7892 -O flag removed from CFLAGS 1984-11-29 13:33:33 +00:00
bal
b0de601d5b -O removed from CFLAGS 1984-11-29 13:31:22 +00:00
bal
7767012a6e il_aux.h included (which now contains getcall(),putcall() etc.
routines that were peviously in get.c and put.c).
1984-11-29 11:08:15 +00:00
bal
bd06330739 stdio.h included (required by new interface to get.h). 1984-11-29 11:06:23 +00:00
bal
84ed8ee7ef routines getcall(), get_text() and getcc() move from get.c to this file
routines putactuals(), putcall(), and putcc() move from put.c to this file
get.h, put.h, stdio.h, em_mnem.h and em_pseu.h included
1984-11-29 11:03:19 +00:00
bal
f3e35f5432 routine getbblocks (plus its auxiliary routines) moved from get.c
to this file; core allocation macros newcfbx() and oldcfbx() added.
1984-11-29 10:51:16 +00:00
bal
edcb838b98 newnametable() move from alloc.c to this file,
get_ca_lines moved from get.c to this file,
em_pseu.h and em_mes.h included (needed by get_ca_lines).
1984-11-29 10:31:44 +00:00
bal
c17a52c09d stdio.h included (required by new get.h interface),
macros's newlocal() and oldlocal() added, replacing routines in
alloc.c with same name.
1984-11-29 10:25:21 +00:00
bal
0032ebfeda getbblocks(), getcall(), getcc() and get_text() removed,
get_ca_lines() removed,
curinp,lastbid,lastlabid exported
getbyte(),getshort(),getoff(),read_line and getlines() exported.
1984-11-29 10:18:53 +00:00
bal
582a0cc2aa getbblocks() removed (now local to CF phase),
getcall(),getcc() and get_text removed (now local to IL),
get_ca_lines() removed (now local to CA),
current input file "f" renamed "curinp" and exported,
getbyte (macro), getshort() and getoff() exported
read_line() and getlines() exported,
lastbid and lastlabid exported.
1984-11-29 10:15:23 +00:00
bal
dd5ceb7b97 putcall an putcc removed,
curoutp, outbyte,outshort and outoff exported.
1984-11-29 10:11:37 +00:00
bal
470826f0c9 putcall and putcc removed (make local to IL phase)
current output file renamed "curoutp" and exported
outbyte, outshort and outoff exported.
1984-11-29 10:09:15 +00:00
bal
1cb39eff7e cleaned up 1984-11-28 09:26:44 +00:00
em
90c1dc7c06 Installed basic compiler in ACK tree. 1984-11-27 23:59:28 +00:00
em
39c37e9571 1 - Added RCS identification.
2 - Changed the file name parseparams.c into parsepar.c, the original
    name was too long for RCS under BSD4.1
3 - Adapted to ACK standard Makefile format(cmp,install,...)
4 - Included more dependencies.
1984-11-27 23:53:31 +00:00
em
3ceada5482 Added basic.doc. 1984-11-27 23:51:07 +00:00
em
3cab14d65e Added RCS identification. 1984-11-27 23:48:38 +00:00
em
7efc02574d *** empty log message *** 1984-11-27 23:46:32 +00:00
em
9f872a7ea0 Removed conflict between rcs_id in basic.yacc and lex.c. 1984-11-27 23:41:46 +00:00
em
ea5498cd99 Now using ACK default tmp directory from em_path.h. 1984-11-27 23:21:41 +00:00
em
455cd930ec Added RCS identification. 1984-11-27 23:13:28 +00:00
em
335d55ff4a The version of basic copied from Martin Kerstens directory. 1984-11-27 22:23:55 +00:00
em
4301dfb7bf The version of basic copied from Martin Kerstens directory. 1984-11-27 22:11:59 +00:00
bal
502a7a86af Initial revision 1984-11-27 16:16:36 +00:00
bal
30ca0afe49 cleaned up 1984-11-27 15:52:23 +00:00
bal
ad383cbdc0 stack_change was renamed stack_chg 1984-11-27 15:43:14 +00:00
bal
165965eadc Initial revision 1984-11-27 15:40:13 +00:00
bal
a6d53a6bcd "ivars" was renamed "ivvars" to avoid name conflict with sr_expr.c 1984-11-27 15:30:34 +00:00
bal
df200afd46 cleaned up 1984-11-27 15:04:04 +00:00
bal
9c3a416acd cleaned up; dependecies added. 1984-11-27 14:53:00 +00:00
bal
9e38bfa060 cleaned up. 1984-11-27 14:25:02 +00:00
bal
2d6eff961f cleaned up. use CC. 1984-11-27 14:23:20 +00:00
bal
0981b8857b getoff() moved to front (was called before being defined)
declaration char *pseudo[] changed to char *pseudo[5] to suppress warining
1984-11-27 14:21:55 +00:00
bal
69bdddd9ba "cc" replaced by $(CC) 1984-11-27 12:59:18 +00:00
keie
4a36e98f5c Treatment of -R flag is altered.
1 - if recognized by mapflag and not by Ack internally no
    complaint is given.
2 - If recognized by both mapflag and internally:
       -R....-.... : effectuate only mapflag command
       otherwise   : effectuate both.
3 - If not recognized at all, give a warning message and
    pass the flag to the linker.
1984-11-26 17:14:17 +00:00
keie
3c2c03165b This manual page was not included in the first distribution.
This version is hacked from the VU-Pascal distribution.
1984-11-26 15:56:57 +00:00
bal
c4b4a08720 Initial revision 1984-11-26 15:15:07 +00:00
bal
6d481ce4d6 Initial revision 1984-11-26 15:04:22 +00:00
bal
6a9e49f683 Initial revision 1984-11-26 14:51:59 +00:00
bal
1833451151 Initial revision 1984-11-26 14:35:32 +00:00
bal
9f778655a6 Initial revision 1984-11-26 14:14:55 +00:00
bal
f01e1431b0 Initial revision 1984-11-26 14:07:17 +00:00
bal
415ae7e922 Initial revision 1984-11-26 13:58:05 +00:00
bal
7b798175ad Initial revision 1984-11-26 13:43:22 +00:00
sater
5481dd47a9 added documentation for the fmt_id and fmt_ilb macros 1984-11-26 11:09:11 +00:00
sater
0a00b80726 Added support for the fmt_id and fmt_ilb macros 1984-11-26 10:50:46 +00:00
sater
6a4dc794a2 In the RREMOVE section of this file, the field e_con of the
expression union was used in stead of e_reg.
Fixed. Checked all other occurrances, are correct.
1984-11-20 16:56:26 +00:00
sater
7c07f91e1c The constant 512 slipped in instead of BUFSIZ.
Changed.
1984-11-20 10:22:12 +00:00
keie
36c1f227ea Added a check for non-ascii characters in the description files. 1984-11-15 14:24:35 +00:00
ceriel
1fe1bc8c09 Forgotten to close a file. This is corrected. 1984-11-12 18:05:20 +00:00
keie
4e7f357a26 Added rcs identification. 1984-11-08 12:08:31 +00:00
keie
9f776924d6 Added a P for a specification of lal on line 51.
This missing letter caused lal -1 to be mapped on the opcode
for lal 0.
1984-11-08 11:11:31 +00:00
keie
cb84476be0 Added a check. Minis & shorties need an N or P argument. 1984-11-08 11:09:56 +00:00
bal
d07b17ca5c The routine con_float now generates a dummy floating point constant
and gives a warning, instead of generating a fatal error + abort.
1984-11-06 12:50:21 +00:00
bal
58c679c94c Patterns for floating point instruction and for LFR 8 and RET 8 added.
Each such instruction now results in a call to a library routine.
At present, all these routines generate an Illegal EM Instruction trap,
but anyone wishing to implement floating point for the 6502 can
do so without changing the back end table.
1984-11-06 12:47:26 +00:00
em
e2e78ccd0a The line with the user message for failure missed the call to echo. 1984-11-06 10:02:25 +00:00
bal
0d5a4693a7 make install also make a tail_mon now. 1984-11-05 15:58:11 +00:00
bal
95dd252a5b arguments for asld changed. several libraries added. 1984-11-05 15:29:48 +00:00
bal
87c5817216 program for be is {LIB}/cg instead of {LIB}/be 1984-11-05 15:13:20 +00:00
keie
b6cfa32faa *** empty log message *** 1984-11-05 15:11:19 +00:00
bal
b9ebdc1a07 em_head renamed head_em; em_tail renamed tail_em
installs tail_em rather than comparing it
1984-11-05 15:06:49 +00:00
em
73b651052e Added an example with segment prefixes. 1984-11-05 15:02:32 +00:00
em
6913efe107 Adapted to new tree shape for libraries and binaries. 1984-11-05 14:42:17 +00:00
em
3e7b7990f2 *** empty log message *** 1984-11-05 12:05:46 +00:00
em
9c66801439 *** empty log message *** 1984-11-05 11:55:15 +00:00
keie
2976b590af The flag -LIB was missing in the call to the shell-procedure
compmodule. Thus the generated libraries could not be effectively
used by our assembler/linker.
1984-11-05 11:37:23 +00:00
bal
a837112d99 Negation of negative operand with inc/dec added in certain cases.
Don't know effect for sure, author has left.
Added rcsid.
1984-11-02 11:09:46 +00:00
bal
13685d4bc0 Initial revision 1984-11-02 10:13:29 +00:00
sater
45887f2b72 Name of error file was wrong, it was the runtime error file instead
of the compile time error file.
1984-11-01 09:30:36 +00:00
ceriel
4d48191bcc The input routine used to skip space. This "feature" has been removed
because it is also used to read strings, in which space is significant.
1984-10-31 15:26:09 +00:00
keie
fedaa3267a Adapted to make use of ../../compare and ../../install. 1984-10-26 12:58:15 +00:00
keie
3d4feae541 Initial revision 1984-10-26 12:54:35 +00:00
keie
88b487cd7b Adapted to make use of ../../compare and ../../install. 1984-10-26 11:48:51 +00:00
keie
90a899316e Initial revision 1984-10-26 11:48:13 +00:00
keie
08632dc7bd *** empty log message *** 1984-10-26 11:47:56 +00:00
keie
ae27a86236 Adapted to make use of ../../compare and ../../install. 1984-10-26 11:04:10 +00:00
keie
fd0066f3a6 *** empty log message *** 1984-10-26 11:01:40 +00:00
keie
1092994a09 Initial revision 1984-10-26 11:00:08 +00:00
ceriel
da7230a8eb Running makedepend again gave a difference. 1984-10-26 10:31:22 +00:00
ceriel
1ca93d7aa1 removed the "depend" emtry, added a "distr" entry, which should be used
before a distribution is made.
Also added the -DNORCSID flag to the lint-options.
1984-10-26 10:25:55 +00:00
keie
9d8dd3f989 Adapted to use ../../install and ../../compare and hide knowledge
about final destination of libraries.
1984-10-26 10:25:32 +00:00
ceriel
c5345aaaba Added a "distr" entry, which will be propagated to the src directory. 1984-10-26 10:24:48 +00:00
keie
fd23647c1c Adapted to make use of ../../compare. 1984-10-26 10:21:18 +00:00
keie
4724e96474 Adapted to make use of ../../install and ../../compare. 1984-10-26 10:20:29 +00:00
keie
8df0cf17d6 Initial revision 1984-10-26 10:20:28 +00:00
keie
37730ff9ca *** empty log message *** 1984-10-26 10:19:56 +00:00
keie
a1e7cc26f4 *** empty log message *** 1984-10-26 10:12:57 +00:00
keie
137fa9ebce Adapted to use install in ../.. 1984-10-25 14:28:56 +00:00
keie
0cacc96ed8 Now using the compare script in ../.. 1984-10-25 14:28:19 +00:00
keie
4a20e17a9b Initial revision 1984-10-25 14:28:18 +00:00
keie
3bfc57ecd0 *** empty log message *** 1984-10-25 14:24:43 +00:00
keie
86d96452a3 Altered the installation procedure.
The libraries etc. are now installed in lib/m68k2 using install in ../..
1984-10-25 14:22:53 +00:00
keie
e88028dcb9 Altered to make use of ../../install and ../../compare. 1984-10-25 14:19:58 +00:00
keie
1e1fc36653 Initial revision 1984-10-25 14:19:57 +00:00
keie
cdebe97db8 *** empty log message *** 1984-10-25 14:15:27 +00:00
keie
08545984f4 Now making use of ../../install and ../../compare. 1984-10-25 14:10:00 +00:00
keie
b8e156100f Adapted to make use of compare in ../.. 1984-10-25 11:40:16 +00:00
keie
9109aaaada Adapted to make use of install and compare in ../.. 1984-10-25 11:39:39 +00:00
keie
b51fa518be *** empty log message *** 1984-10-25 11:39:38 +00:00
keie
c2b1975015 Adapted to make use of install and compare in ../.. 1984-10-25 11:27:08 +00:00
keie
ca89e47aa4 *** empty log message *** 1984-10-25 11:25:22 +00:00
keie
26ba8cc8fd Removed the definition of LIBDIR, it is superfluous. 1984-10-25 11:16:31 +00:00
keie
c94c590501 Adapted to make use of install and compare in ../.. 1984-10-25 11:16:30 +00:00
keie
38a943d27a Initial revision 1984-10-25 11:15:20 +00:00
keie
916b1b016e Moved the include directory from mach/ibm/include to lib/ibm/include. 1984-10-25 11:00:06 +00:00
keie
a72cc54578 Adapted to use compare in ../.. 1984-10-25 10:46:32 +00:00
keie
9b6418c324 Adapted to compare in ../.. 1984-10-25 10:45:22 +00:00
keie
e03e8c7607 Initial revision 1984-10-25 10:45:21 +00:00
keie
2cb8aae438 *** empty log message *** 1984-10-23 15:29:53 +00:00
keie
533d2bb940 Initial revision 1984-10-23 15:29:30 +00:00
keie
828b4d62c9 We have only one copy of the script for compare and install now
they are present in ../..
1984-10-23 15:14:17 +00:00
sater
7e31dee840 changed EM_WSIZE to TEM_WSIZE 1984-10-23 15:10:15 +00:00
1336 changed files with 77586 additions and 2369 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

@@ -3,7 +3,8 @@
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)
ack.$(SUF) cg.$(SUF) regadd.$(SUF) peep.$(SUF) toolkit.$(SUF) LLgen.$(SUF)\
basic.$(SUF) 6500.$(SUF) ncg.$(SUF)
NROFF=nroff
MS=-ms
@@ -15,12 +16,16 @@ ack.$(SUF): ack.doc
$(NROFF) $(MS) $? >$@
cg.$(SUF): cg.doc
$(NROFF) $(MS) $? >$@
ncg.$(SUF): ncg.doc
$(NROFF) $(MS) $? >$@
regadd.$(SUF): regadd.doc
$(NROFF) $(MS) $? >$@
install.$(SUF): install.doc
$(NROFF) $(MS) $? >$@
pcref.$(SUF): pcref.doc
$(NROFF) $? >$@
basic.$(SUF): basic.doc
$(NROFF) $(MS) $? >$@
peep.$(SUF): peep.doc
$(NROFF) $(MS) $? >$@
val.$(SUF): val.doc
@@ -29,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

849
doc/basic.doc Normal file
View File

@@ -0,0 +1,849 @@
.\" $Header$
.TL
.de Sy
.LP
.IP \fBsyntax\fR 10
..
.de PU
.IP \fBpurpose\fR 10
..
.de RM
.IP \fBremarks\fR 10
..
The ABC compiler
.AU
Martin L. Kersten
.AI
Department of Mathematics and Computer Science.
.br
Vrije Universiteit
.AB
This manual describes the
programming language BASIC and its compiler
included in the Amsterdam Compiler Kit.
.AE
.SH
INTRODUCTION.
.LP
The BASIC-EM compiler is an extensive implementation of the
programming language BASIC.
The language structure and semantics are modelled after the
BASIC interpreter/compiler of Microsoft (tr), a detailed comparison
is provided in appendix A.
.LP
The compiler generates code for a virtual machine, the EM machine
[[ACM, etc]]
Using EM as an intermediate machine results in a highly portable
compiler and BASIC code.
The drawback of EM is that it does not directly reflect one particular
hardware design, which means that many of
the low level operations available within
BASIC are ill-defined or even inapplicable.
To mention a few, the peek and poke instructions are likely
to be behave errorneous, while line printer and tapedeck
primitives are unknown.
.LP
This manual is divided into three chapters.
The first chapter discusses the general language syntax and semantics.
Chapter two describes the statements available in BASIC-EM.
Chapter 3 describes the predefined functions,
ordered alphabetically.
Appendix A discusses the differences with
Microsoft BASIC. Appendix B describes all reserved symbols.
Appendix C lists the error messages in use.
.SH
SYNTAX NOTATION
.LP
The conventions for syntax presentation are as follows:
.IP CAPS 10
Items are reserved words, must be input as shown
.IP <> 10
Items in lowercase letters enclosed in angular brackets
are to be supplied by the user.
.IP [] 10
Items are optional.
.IP \.\.\. 10
Items may be repeated any number of times
.IP {} 10
A choice between two or more alternatives. At least one of the entries
must be chosen.
.IP | 10
Vertical bars separate the choices within braces.
.LP
All punctuation must be included where shown.
.NH 1
GENERAL INFORMATION
.LP
The BASIC-EM compiler is designed for a UNIX based environment.
It accepts a text file with your BASIC program (suffix .b) and generates
an executable file, called a.out.
.NH 2
LINE FORMAT
.LP
A BASIC program consists of a series of lines, starting with a
positive line number in the range 0 to 65529.
A line may consists of more then one physical line on your terminal, but must
is limited to 1024 characters.
Multiple BASIC statements may be placed on a single line, provided
they are separated by a colon (:).
.NH 2
CONSTANTS
.LP
The BASIC compiler character set is comprised of alphabetic
characters, numeric characters, and special characters shown below.
.DS
= + - * / ^ ( ) % # $ \\ _
! [ ] , . ; : & ' ? > < \\ (blanc)
.DE
.LP
BASIC uses two different types of constants during processing:
numeric and string constants.
.br
A string constant is a sequence of characters taken from the ASCII
character set enclosed by double quotation marks.
.br
Numeric constants are positive or negative numbers, grouped into
five different classes.
.IP "a) integer constants" 25
Whole numbers in the range of -32768 and 32767. Integer constants do
not contain decimal points.
.IP "b) fixed point constants" 25
Positive or negative real numbers, i.e. numbers with a decimal point.
.IP "c) floating point constants" 25
Real numbers in scientific notation. A floating point constant
consists of an optional signed integer or fixed point number
followed by the letter E (or D) and an optional signed integer
(the exponent).
The allowable range of floating point constants is 10^-38 to 10^+38.
.IP "d) Hex constants" 25
Hexadecimal numbers, denoted by the prefix &H.
.IP "d) Octal constants" 25
Octal numbers, denoted by the prefix &O.
.NH 2
VARIABLES
.LP
Variables are names used to represent values in a BASIC program.
A variable is assigned a value by assigment specified in the program.
Before a variable is assigned its value is assumed to be zero.
.br
Variable names are composed of letters, digits or the decimal point,
starting with a letter. Up to 40 characters are significant.
A variable name be be followed by any of the following type
declaration characters:
.IP % 5
Defines an integer variable
.IP ! 5
Defines a single precision variable (see below)
.IP # 5
Defines a double precision variable
.IP $ 5
Defines a string variable.
.LP
NOTE: Two variables with the same name but different type is
considered illegal.
.LP
Beside single valued variables, values may be grouped
into tables or arrays.
Each element in an array is referenced by the array name and an index,
such a variable is called a subscripted variable.
An array has as many subscripts as there are dimensions in the array,
the maximum of which is 11.
.br
If a variable starts with FN it is assumed to be a call to a user defined
function.
.br
A variable name may not be a reserved word nor the name
of a predefined function.
A list of all reserved identifiers is included as Appendix ?.
.NH 2
EXPRESSIONS
.LP
BASIC-EM differs from Microsoft BASIC in supporting floats in one precision
only (due to EM).
All floating point constants have the same precision, i.e. 16 digits.
.LP
When necessary the compiler will convert a numeric value from
one type to another.
A value is always converted to the precision of the variable it is assigned
to.
When a floating point value is converted to an integer the fractional
portion is rounded.
In an expression all values are converted to the same degree of precision,
i.e. that of the most precise operand.
.br
Division by zero results in the message "Division by zero".
If overflow (or underflow) occurs, the "Overflow (underflow)" message is
displayed and execution is terminated (contrary to Microsoft).
.SH
Arithmetic
.LP
The arithmetic operators in order of precedence,a re:
.DS L
\^ Exponentiation
- Negation
*,/,\\,MOD Multiplication, Division, Remainder
+,- Addition, Substraction
.DE
The operator \\\\ denotes integer division, its operands are rounded to
integers before the operator is applied.
Modulus arithmetic is denoted by the operator MOD, which yields the
integer value that is the remainder of an integer division.
.br
The order in which operators are performed can be changec with parentheses.
.SH
Relational
.LP
The relational operators in order of precedence, are:
.DS
= Equality
<> Inequality
< Less than
> Greater than
<= Less than or equal to
>= Greater than or equal to
.DE
The relational operators are used to compare two values and returns
either "true" (-1) or "false" (0) (See IF statement).
The precedence of the relational operators is lower
then the arithmetic operators.
.SH
Logical
.LP
The logical operators performs tests on multiple relations, bit manipulations,
or Boolean operations.
The logical operators returns a bitwise result ("true" or "false").
In an expression, logical operators are performed after the relational and
arithmetic operators.
The logical operators work by converting their operands to signed
two-complement integers in the range -32768 to 32767.
.DS
NOT Bitwise negation
AND Bitwise and
OR Bitwise or
XOR Bitwise exclusive or
EQV Bitwise equivalence
IMP Bitwise implies
.DE
.SH
Functional
.LP
A function is used in an expression to call a system or user defined
function.
A list of predefined functions is presented in chapter 3.
.SH
String operations
.LP
Strings can be concatenated by using +. Strings can be compared with
the relational operators. String comparison is performed in lexicographic
order.
.NH 2
ERROR MESSAGES
.LP
The occurence of an error results in termination of the program
unless an ON....ERROR statement has been encountered.
.NH 1
B-EM STATEMENTS
.LP
This chapter describes the statements available within the BASIC-EM
compiler. Each description is formatted as follows:
.Sy
Shows the correct syntax for the statement. See introduction of
syntax notation above.
.PU
Describes the purpose and details of the instructions.
.RM
Describes special cases, deviation from Microsoft BASIC etc.
.LP
.NH 2
CALL
.Sy
CALL <variable name>[(<argument list>)]
.PU
The CALL statement provides the means to execute procedures
and functions written in another language included in the
Amsterdam Compiler Kit.
The argument list consist of (subscripted) variables.
The BASIC compiler pushes the address of the arguments on the stack in order
of encounter.
.RM
Not yet available
.NH 2
CLOSE
.Sy
CLOSE [[#]<file number>[,[#]<file number...>]]
.PU
To terminate I/O on a disk file.
<file number> is the number associated with the file
when it was OPENed (See OPEN). Ommission of parameters results in closing
all files.
.sp
The END statement and STOP statement always issue a CLOSE of
all files.
.NH 2
DATA
.Sy
DATA <list of constants>
.PU
DATA statements are used to construct a data bank of values that are
accessed by the program's READ statement.
DATA statements are non-executable,
the data items are assembled in a data file by the BASIC compiler.
This file can be replaced, provided the layout remains
the same (otherwise the RESTORE won't function properly).
.sp
The list of data items consists of numeric and string constants
as discussed in section 1.
Moreover, string constants starting with a letter and not
containing blancs, newlines, commas, colon need not be enclosed with
the string quotes.
.sp
DATA statements can be reread using the RESTORE statement.
.NH 2
DEF FN
.Sy
DEF FN<name> [(<parameterlist>)]=<expression>
.PU
To define and name a function that is written by the user.
<name> must be an identifier and should be preceded by FN,
which is considered integral part of the function name.
<expression> defines the expression to be evaluated upon function call.
.sp
The parameter list is comprised of a comma separated
list of variable names, used within the function definition,
that are to replaced by values upon function call.
The variable names defined in the parameterlist, called formal
parameters, do not affect the definition and use of variables
defined with the same name in the rest of the BASIC program.
.sp
A type declaration character may be suffixed to the function name to
designate the data type of the function result.
.NH 2
DEFINT/SNG/DBL/STR
.Sy
DEF<type> <range of letters>
.PU
Any undefined variable starting with the letter included in the range of
letters is declared of type <type> unless a type declaration character
is appended.
The range of letters is a comma separated list of characters and
character ranges (<letter>-<letter>).
.NH 2
DIM
.Sy
DIM <list of subscripted variable>
.PU
The DIM statement allocates storage for subscripted variables.
If an undefined subscripted variable is used
the maximum value of the array subscript(s) is assumed to be 10.
A subscript out of range is signalled by the program (when RCK works)
The minimum subscript value is 0, unless the OPTION BASE statement has been
encountered.
.sp
All variables in a subscripted variable are initially zero.
.sp
BUG. Multi-dimensional arrays MUST be defined.
.NH 2
END
.Sy
END
.PU
END terminates a BASIC program and returns to the UNIX shell.
An END statement at the end of the BASIC program is optional.
.NH 2
ERR and ERL
.PU
Whenever an error occurs the variable ERR contains the
error number and ERL the BASIC line where the error occurred.
The variables are usually used in error handling routines
provided by the user.
.NH 2
ERROR
.Sy
ERROR <integer expression>
.PU
To simulate the occurrence of a BASIC error.
To define your own error code use a value not already in
use by the BASIC runtime system.
The list of error messages currently in use
can be found in appendix B.
.NH 2
FIELD
.PU
To be implemented.
.NH 2
FOR...NEXT
.Sy
FOR <variable>= <low>TO<high>[STEP<size>]
.br
......
.br
NEXT [<variable>][,<variable>...]
.PU
The FOR statements allows a series of statements to be performed
repeatedly. <variable> is used as a counter. During the first
execution pass it is assigned the value <low>,
an arithmetic expression. After each pass the counter
is incremented with the step size <size>, an expression.
Ommission of the step size is intepreted as an increment of 1.
Execution of the program lines specified between the FOR and the NEXT
statement is terminated as soon as <low> is greater than <high>
.sp
The NEXT statement is labeled with the name(s) of the counter to be
incremented.
.sp
The body of the FOR statement is skipped when the initial value of the
loop times the sign of the step exceeds the value of the highest value
times the sign of the step.
.sp
The variables mentioned in the NEXT statement may be ommitted, in which case
the variable of increment the counter of the most recent FOR statement.
If a NEXT statement is encountered before its corresponding FOR statement,
the error message "NEXT without FOR" is generated.
.NH 2
GET
.Sy
GET [#]<file number>[, <record number>]
.PU
To be implemented.
.NH 2
GOSUB...RETURN
.Sy
GOSUB <line number
...
.br
RETURN
.PU
The GOSUB statement branches to the first statement of a subroutine.
The RETURN statement cause a branch back to the statement following the
most recent GOSUB statement.
A subroutine may contain more than one RETURN statement.
.sp
Subroutines may be called recursively.
Nesting of subroutine calls is limited, upon exceeding the maximum depth
the error message "XXXXX" is displayed.
.NH 2
GOTO
.Sy
GOTO <line number>
.PU
To branch unconditionally to a specified line in the program.
If <line number> does not exists, the compilation error message
"Line not defined" is displayed.
.RM
Microsoft BASIC continues at the first line
equal or greater then the line specified.
.NH 2
IF...THEN
.Sy
.br
IF <expression> THEN {<statements>|<line number>}
[ELSE {<statements>|<line number>}]
.br
.Sy
IF <expression> GOTO <line number>
[ELSE {<statements>|<line number>}]
.PU
The IF statement is used
to make a decision regarding the program flow based on the
result of the expressions.
If the expression is not zero, the THEN or GOTO clause is
executed. If the result of <expression> is zero, the THEN or
GOTO clause is ignored and the ELSE clause, if present is
executed.
.br
IF..THEN..ELSE statements may be nested.
Nesting is limited by the length of the line.
The ELSE clause matches with the closests unmatched THEN.
.sp
When using IF to test equality for a value that is the
result of a floating point expression, remember that the
internal representation of the value may not be exact.
Therefore, the test should be against a range to
handle the relative error.
.RM
Microsoft BASIC allows a comma before THEN.
.NH 2
INPUT
.Sy
INPUT [;][<"prompt string">;]<list of variables>
.PU
An INPUT statement can be used to obtain values from the user at the
terminal.
When an INPUT statement is encountered a question mark is printed
to indicate the program is awaiting data.
IF <"prompt string"> is included, the string is printed before the
the question mark. The question mark is suppressed when the prompt
string is followed by a comma, rather then a semicolon.
.sp
For each variable in the variable a list a value should be supplied.
Data items presented should be separated by a comma.
.sp
The type of the variable in the variable list must aggree with the
type of the data item entered. Responding with too few or too many
data items causes the message "?Redo". No assignment of input values
is made until an acceptable response is given.
.RM
The option to disgard the carriage return with the semicolon after the
input symbol is not yet implemented.
.NH 2
INPUT [#]
.Sy
INPUT #<file number>,<list of variables>
.PU
The purpose of the INPUT# statement is to read data items from a sequential
file and assign them to program variables.
<file number> is the number used to open the file for input.
The variables mentioned are (subscripted) variables.
The type of the data items read should aggree with the type of the variables.
A type mismatch results in the error message "XXXXX".
.sp
The data items on the sequential file are separated by commas and newlines.
In scanning the file, leading spaces, new lines, tabs, and
carriage returns are ignored. The first character encountered
is assumed to be the state of a new item.
String items need not be enclosed with double quotes, provided
it does not contain spaces, tabs, newlines and commas,
.RM
Microsoft BASIC won't assign values until the end of input statement.
This means that the user has to supply all the information.
.NH 2
LET
.Sy
[LET]<variable>=<expression>
.PU
To assign the value of an expression to a (subscribted) variable.
The type convertions as dictated in section 1.X apply.
.NH 2
LINE INPUT
.Sy
LINE INPUT [;][<"prompt string">;]<string variable>
.PU
An entire line of input is assigned to the string variable.
See INPUT for the meaning of the <"prompt string"> option.
.NH 2
LINE INPUT [#]
.Sy
LINE INPUT #<file number>,<string variable>
.PU
Read an entire line of text from a sequential file <file number>
and assign it to a string variable.
.NH 2
LSET and RSET
.PU
To be implemented
.NH 2
MID$
.Sy
MID$(<string expr1>,n[,m])=<string expr2>
.PU
To replace a portion of a string with another string value.
The characters of <string expr2> replaces characters in <string expr1>
starting at position n. If m is present, at most m characters are copied,
otherwise all characters are copied.
However, the string obtained never exceeds the length of string expr1.
.NH 2
ON ERROR GOTO
.Sy
ON ERROR GOTO <line number>
.PU
To enable error handling within the BASIC program.
An error may result from arithmetic errors, disk problems, interrupts, or
as a result of the ERROR statement.
After printing an error message the program is continued at the
statements associated with <line number>.
.sp
Error handling is disabled using ON ERROR GOTO 0.
Subsequent errors result in an error message and program termination.
.NH 2
ON...GOSUB and ON ...GOTO
.Sy
ON <expression> GOSUB <list of line numbers>
ON <expression> GOTO <list of line numbers>
.PU
To branch to one of several specified line numbers or subroutines, based
on the result of the <expression>. The list of line numbers are considered
the first, second, etc alternative. Branching to the first occurs when
the expression evaluates to one, to the second alternative on two, etc.
If the value of the expression in zero or greater than the number of alternatives, processing continues at the first statement following the ON..GOTO
(ON GOSUB) statement.
When the expression results in a negative number the
an "Illegal function call" error occurs.
.NH 2
OPEN
.NH 2
OPTION BASE
.Sy
OPTION BASE n
.PU
To declare the lower bound of subsequent array subscripts as either
0 or 1. The default lower bound is zero.
.NH 2
POKE
.Sy
POKE <expr1>,<expr2>
.PU
To poke around in memory. The use of this statement is not recommended,
because it requires full understanding of both
the implementation of the Amsterdam
Compiler Kit and the hardware characteristics.
.NH 2
PRINT [USING]
.NH 2
PUT
.PU
To be implemented
.NH 2
RANDOMIZE
.Sy
RANDOMIZE [<expression>]
.PU
To reset the random seed. When the expression is ommitted, the system
will ask for a value between -32768 and 32767.
The random number generator returns the same sequence of values provided
the same seed is used.
.NH 2
READ
.Sy
READ <list of variables>
.PU
To read values from the DATA statements and assign them to variables.
The type of the variables should match to the type of the items being read,
otherwise a "Syntax error" occurs.
.NH 2
REM
.Sy
REM <remark>
.PU
To include explantory information in a program.
The REM statements are not executed.
A single quote has the same effect as : REM, which
allows for the inclusion of comment at the end of the line.
.RM
Microsoft BASIC does not allow REM statements as part of
DATA lines.
.NH 2
RESTORE
.Sy
RESTORE [<line number>]
.PU
To allow DATA statements to be re-read from a specific line.
After a RESTORE statement is executed, the next READ accesses
the first item of the DATA statements.
If <line number> is specified, the next READ accesses the first
item in the specified line.
.sp
Note that data statements result in a sequential datafile generated
by the compiler, being read by the read statements.
This data file may be replaced using the operating system functions
with a modified version, provided the same layout of items
(same number of lines and items per line) is used.
.NH 2
STOP
.Sy
STOP
.PU
To terminate the execution of a program and return to the operating system
command interpreter. A STOP statement results in the message "Break in line
???"
.NH 2
SWAP
.Sy
SWAP <variable>,<variable>
.PU
To exchange the values of two variables.
.NH 2
TRON/TROFF
.Sy
TRON
.Sy
TROFF
.PU
As an aid in debugging the TRON statement results in a program
listing each line being interpreted. TROFF disables generation of
this code.
.NH 2
WHILE...WEND
.Sy
WHILE <expression>
.....
WEND
.PU
To execute a series of BASIC statements as long as a conditional expression
is true. WHILE...WEND loops may be nested.
.NH 2
WRITE
.Sy
WRITE [<list of expressions>]
.PU
To write data at the terminal in DATA statement layout conventions.
The expressions should be separated by commas.
.NH 2
WRITE #
.Sy
WRITE #<file number> ,<list of expressions>
.PU
To write a sequential data file, being opened with the "O" mode.
The values are being writting using the DATA statements layout conventions.
.NH
FUNCTIONS
.LP
.IP ABS(X) 12
Returns the absolute value of expression X
.IP ASC(X$) 12
Returns the numeric value of the first character of the string.
If X$ is not initialized an "Illegal function call" error
is returned.
.IP ATN(X) 12
Returns the arctangent of X in radians. Result is in the range
of -pi/2 to pi/2.
.IP CDBL(X) 12
Converts X to a double precision number.
.IP CHR$(X) 12
Converts the integer value X to its ASCII character.
X must be in the range of 0 to 127.
It is used for cursor addressing and generating bel signals.
.IP CINT(X) 12
Converts X to an integer by rounding the fractional portion.
If X is not in the range -32768 to 32767 an "Overflow"
error occurs.
.IP COS(X) 12
Returns the cosine of X in radians.
.IP CSNG(X) 12
Converts X to a double precision number.
.IP CVI(<2-bytes>) 12
Convert two byte string value to integer number.
.IP CVS(<4-bytes>) 12
Convert four byte string value to single precision number.
.IP CVD(<8-bytes>) 12
Convert eight byte string value to double precision number.
.IP EOF[(<file-number>)] 12
Returns -1 (true) if the end of a sequential file has been reached.
.IP EXP(X) 12
Returns e(base of natural logarithm) to the power of X.
X should be less then 10000.0.
.IP FIX(X) 12
Returns the truncated integer part of X. FIX(X) is
equivalent to SGN(X)*INT(ABS(X)).
The major difference between FIX and INT is that FIX does not
return the next lower number for negative X.
.IP HEX$(X) 12
Returns the string which represents the hexadecimal value of
the decimal argument. X is rounded to an integer using CINT
before HEX$ is evaluated.
.IP INT(X) 12
Returns the largest integer <= X.
.IP INPUT$(X[,[#]Y]) 12
Returns the string of X characters read from the terminal or
the designated file.
.IP LEX(X$) 12
Returns the number of characters in the string X$.
Non printable and blancs are counted too.
.IP LOC(<file\ number>) 12
For sequential files LOC returns
position of the read/write head, counted in number of bytes.
For random files the function returns the record number just
read or written from a GET or PUT statement.
If nothing was read or written 0 is returned.
.IP LOG(X) 12
Returns the natural logarithm of X. X must be greater than zero.
.IP MID$(X,I,[J]) 12
To be implemented.
.IP MKI$(X) 12
Converts an integer expression to a two-byte string.
.IP MKS$(X) 12
Converts a single precision expression to a four-byte string.
.IP MKD$(X) 12
Converts a double precision expression to a eight-byte string.
.IP OCT$(X) 12
Returns the string which represents the octal value of the decimal
argument. X is rounded to an integer using CINT before OCTS is evaluated.
.IP PEEK(I) 12
Returns the byte read from the indicated memory. (Of limited use
in the context of ACK)
.IP POS(I) 12
Returns the current cursor position. To be implemented.
.IP RIGHT$(X$,I)
Returns the right most I characters of string X$.
If I=0 then the empty string is returned.
.IP RND(X) 12
Returns a random number between 0 and 1. X is a dummy argument.
.IP SGN(X) 12
If X>0 , SGN(X) returns 1.
.br
if X=0, SGN(X) returns 0.
.br
if X<0, SGN(X) returns -1.
.IP SIN(X) 12
Returns the sine of X in radians.
.IP SPACE$(X) 12
Returns a string of spaces length X. The expression
X is rounded to an integer using CINT.
.IP STR$(X)
Returns the string representation value of X.
.IP STRING$(I,J) 12
Returns thes string of length Iwhose characters all
have ASCII code J. (or first character when J is a string)
.IP TAB(I) 12
Spaces to position I on the terminal. If the current
print position is already beyond space I,TAB
goes to that position on the next line.
Space 1 is leftmost position, and the rightmost position
is width minus 1. To be used within PRINT statements only.
.IP TAN(X) 12
Returns the tangent of X in radians. If TAN overflows
the "Overflow" message is displayed.
.IP VAL(X$) 12
Returns the numerical value of string X$.
The VAL function strips leading blanks and tabs from the
argument string.
.SH
APPENDIX A DIFFERENCES WITH MICROSOFT BASIC
.LP
The following list of Microsoft commands and statements are
not recognized by the compiler.
.DS
SPC
USR
VARPTR
AUTO
CHAIN
CLEAR
CLOAD
COMMON
CONT
CSAVE
DELETE
EDIT
ERASE
FRE
KILL
LIST
LLIST
LOAD
LPRINT
MERGE
NAME
NEW
NULL
RENUM
RESUME
RUN
SAVE
WAIT
WIDTH LPRINT
.DE
Some statements are in the current implementation not available,
but will be soon. These include:
.DS
CALL
DEFUSR
FIELD
GET
INKEY
INPUT$
INSTR$
LEFT$
LSET
RSET
PUT
.DE

View File

@@ -1040,6 +1040,17 @@ Argument to be formatted will be 'full'.
.IP off_fmt
Format to be used for integer part of label+constant,
argument will be 'full'.
.IP fmt_ilb(ip,il,s)
Must use the numbers
.I ip
and
.I il
which are a procedure number
and a label number respectively and copy a string to
.I s
that must be unique for that combination.
This procedure is optional, if it is not given ilb_fmt
must be defined as below.
.IP ilb_fmt
Format to be used for creation of unique instruction labels.
Arguments will be a unique procedure number (int) and the label
@@ -1070,6 +1081,14 @@ into the datastream.
.IP con_dlb(s)
Must generate output that will put the address of the data label
into the datastream.
.IP fmt_id(sf,st)
Must take the string in
.I sf
which is a nonnumeric global label, and transform it into a copy made to
.I st
which will not collide with reserved assembler words and system labels.
This procedure is optional, if it is not given the id_first macro is used
as defined below.
.IP id_first
Must be a character.
This is prepended to all nonnumeric global labels if their length

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

View File

@@ -50,7 +50,7 @@ lae 2 120
lae sw 7 121
lal P2 128
lal N2 129
lal m 1 130
lal mP 1 130
lal mN 1 131
lal swP 1 132
lal swN 2 133

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

29
h/bc_io.h Normal file
View File

@@ -0,0 +1,29 @@
#include <stdio.h>
/* $Header$ */
/* BASIC file io definitions */
extern FILE *_chanrd;
extern FILE *_chanwr;
extern int _chann;
/* BASIC file descriptor table */
/* Channel assignment:
-1 terminal IO
0 data file
1-15 user files
*/
/* FILE MODES:*/
#define IMODE 1
#define OMODE 2
#define RMODE 3
typedef struct {
char *fname;
FILE *fd;
int pos;
int mode;
int reclength;
}Filedesc;
extern Filedesc _fdtable[16];

17
h/bc_string.h Normal file
View File

@@ -0,0 +1,17 @@
#
/* $Header$ */
/* Strings are allocated in a fixed string descriptor table
** This mechanism is used to avoid string copying as much as possible
*/
typedef struct{
char *strval;
int strcount;
int strlength;
} String;
String *_newstr() ;
#define MAXSTRING 1024

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

34
lang/basic/lib/LIST Normal file
View File

@@ -0,0 +1,34 @@
tail_bc.a
abs.c
asc.c
asrt.c
atn.c
chr.c
conversion.c
hlt.c
mki.c
oct.c
peek.c
power.c
exp.c
log.c
print.c
io.c
random.c
read.c
return.c
sgn.c
sin.c
fif.e
sqt.c
fef.e
stop.c
string.c
salloc.c
swap.c
trace.c
write.c
file.c
error.c
trap.c
setline.e

10
lang/basic/lib/abs.c Normal file
View File

@@ -0,0 +1,10 @@
/* $Header$ */
long _abl(i) long i;
{
return( i>=0?i:-i);
}
double _abr(f) double f;
{
return( f>=0.0?f: -f);
}

11
lang/basic/lib/asc.c Normal file
View File

@@ -0,0 +1,11 @@
#include "bc_string.h"
/* $Header$ */
int _asc(str)
String *str;
{
if(str==0 || str->strval==0)
error(3);
return( *str->strval);
}

9
lang/basic/lib/asrt.c Normal file
View File

@@ -0,0 +1,9 @@
/* $Header$ */
asrt(b)
{
if(!b){
printf("ASSERTION ERROR\n");
abort();
}
}

93
lang/basic/lib/atn.c Normal file
View File

@@ -0,0 +1,93 @@
/*
* (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
*
* This product is part of the Amsterdam Compiler Kit.
*
* Permission to use, sell, duplicate or disclose this software must be
* obtained in writing. Requests for such permissions may be sent to
*
* Dr. Andrew S. Tanenbaum
* Wiskundig Seminarium
* Vrije Universiteit
* Postbox 7161
* 1007 MC Amsterdam
* The Netherlands
*
*/
/* $Header$ */
/* Author: J.W. Stevenson */
/*
floating-point arctangent
atan returns the value of the arctangent of its
argument in the range [-pi/2,pi/2].
there are no error returns.
coefficients are #5077 from Hart & Cheney. (19.56D)
*/
static double sq2p1 = 2.414213562373095048802e0;
static double sq2m1 = .414213562373095048802e0;
static double pio2 = 1.570796326794896619231e0;
static double pio4 = .785398163397448309615e0;
static double p4 = .161536412982230228262e2;
static double p3 = .26842548195503973794141e3;
static double p2 = .11530293515404850115428136e4;
static double p1 = .178040631643319697105464587e4;
static double p0 = .89678597403663861959987488e3;
static double q4 = .5895697050844462222791e2;
static double q3 = .536265374031215315104235e3;
static double q2 = .16667838148816337184521798e4;
static double q1 = .207933497444540981287275926e4;
static double q0 = .89678597403663861962481162e3;
/*
xatan evaluates a series valid in the
range [-0.414...,+0.414...].
*/
static double
xatan(arg)
double arg;
{
double argsq;
double value;
argsq = arg*arg;
value = ((((p4*argsq + p3)*argsq + p2)*argsq + p1)*argsq + p0);
value = value/(((((argsq + q4)*argsq + q3)*argsq + q2)*argsq + q1)*argsq + q0);
return(value*arg);
}
static double
satan(arg)
double arg;
{
if(arg < sq2m1)
return(xatan(arg));
else if(arg > sq2p1)
return(pio2 - xatan(1/arg));
else
return(pio4 + xatan((arg-1)/(arg+1)));
}
/*
atan makes its argument positive and
calls the inner routine satan.
*/
double
_atn(arg)
double arg;
{
if(arg>0)
return(satan(arg));
else
return(-satan(-arg));
}

17
lang/basic/lib/chr.c Normal file
View File

@@ -0,0 +1,17 @@
#include "bc_string.h"
/* $Header$ */
String *_chr(i)
int i;
{
String *s;
char buf[2];
if( i<0 || i>127)
error(3);
buf[0]=i;
buf[1]=0;
s= _newstr(buf);
return(s);
}

View File

@@ -0,0 +1,40 @@
/* $Header$ */
int _cint(f) double f;
{
int r;
if( f<-32768 || f>32767) error(4);
if(f<0)
r= f-0.5;
else r= f+0.5;
return(r);
}
double _trunc(f)
double f;
{
long d;
d=f;
f=d;
return( f );
}
double _fcint(f) double f;
{
long r;
if(f<0){
r= -f;
r= -r -1;
}else r= f;
f=r;
return(f);
}
int _fix(f)
double f;
{
int r;
if( f<-32768.0 || f>32767.0) error(4);
r= _sgn(f) * _fcint((f>0.0? f : -f));
return(r);
}

63
lang/basic/lib/error.c Normal file
View File

@@ -0,0 +1,63 @@
/* $Header$ */
/* error takes an error value in the range of 0-255 */
/* and generates a trap */
char *errortable[255]={
/* 0 */ "",
/* 1 */ "RETURN without GOSUB",
/* 2 */ "Out of data",
/* 3 */ "Illegal function call",
/* 4 */ "Overflow",
/* 5 */ "Out of memory",
/* 6 */ "Undefined line ",
/* 7 */ "Subscript out of range",
/* 8 */ "Redimensioned array",
/* 9 */ "Division by zero",
/* 10 */ "Illegal indirect",
/* 11 */ "Type mismatch",
/* 12 */ "Out of string space",
/* 13 */ "String too long",
/* 14 */ "String formula too complex",
/* 15 */ "Can't continue",
/* 16 */ "Undefined user function",
/* 17 */ "No resume",
/* 18 */ "Resume without error",
/* 19 */ "Unprintable error",
/* 20 */ "Missing operand",
/* 21 */ "Line buffer overflow",
/* 22 */ "FOR without NEXT",
/* 23 */ "WHILE without WEND",
/* 24 */ "WEND without WHILE",
/* 25 */ "Field overflow",
/* 26 */ "Internal error",
/* 27 */ "Bad file number",
/* 28 */ "File not found",
/* 29 */ "Bad file mode",
/* 30 */ "File already open",
/* 31 */ "Disk IO error",
/* 32 */ "File already exists",
/* 33 */ "Disk full",
/* 34 */ "Input past end",
/* 35 */ "Bad record number",
/* 36 */ "Bad file name",
/* 37 */ "Direct statement in file",
/* 38 */ "Too many files",
/* 39 */ "File not open",
/* 40 */ "Syntax error in data",
0
};
error(index)
int index;
{
extern int _errsym;
extern int _erlsym;
_setline();
if( index<0 || index >40 )
printf("LINE %d:ERROR %d: Unprintable error\n",_erlsym,index);
else printf("LINE %d:ERROR %d: %s\n",_erlsym,index,errortable[index]);
_errsym= index;
_trap();
}

122
lang/basic/lib/exp.c Normal file
View File

@@ -0,0 +1,122 @@
/*
* (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
*
* This product is part of the Amsterdam Compiler Kit.
*
* Permission to use, sell, duplicate or disclose this software must be
* obtained in writing. Requests for such permissions may be sent to
*
* Dr. Andrew S. Tanenbaum
* Wiskundig Seminarium
* Vrije Universiteit
* Postbox 7161
* 1007 MC Amsterdam
* The Netherlands
*
*/
/* $Header$ */
/* Author: J.W. Stevenson */
extern double _fif();
extern double _fef();
/*
exp returns the exponential function of its
floating-point argument.
The coefficients are #1069 from Hart and Cheney. (22.35D)
*/
#define HUGE 1.701411733192644270e38
static double p0 = .2080384346694663001443843411e7;
static double p1 = .3028697169744036299076048876e5;
static double p2 = .6061485330061080841615584556e2;
static double q0 = .6002720360238832528230907598e7;
static double q1 = .3277251518082914423057964422e6;
static double q2 = .1749287689093076403844945335e4;
static double log2e = 1.4426950408889634073599247;
static double sqrt2 = 1.4142135623730950488016887;
static double maxf = 10000.0;
static double
floor(d)
double d;
{
if (d<0) {
d = -d;
if (_fif(d, 1.0, &d) != 0)
d += 1;
d = -d;
} else
_fif(d, 1.0, &d);
return(d);
}
static double
ldexp(fr,exp)
double fr;
int exp;
{
int neg,i;
neg = 1;
if (fr < 0) {
fr = -fr;
neg = -1;
}
fr = _fef(fr, &i);
/*
while (fr < 0.5) {
fr *= 2;
exp--;
}
*/
exp += i;
if (exp > 127) {
error(3);
return(neg * HUGE);
}
if (exp < -127)
return(0);
while (exp > 14) {
fr *= (1<<14);
exp -= 14;
}
while (exp < -14) {
fr /= (1<<14);
exp += 14;
}
if (exp > 0)
fr *= (1<<exp);
if (exp < 0)
fr /= (1<<(-exp));
return(neg * fr);
}
double
_exp(arg)
double arg;
{
double fract;
double temp1, temp2, xsq;
int ent;
if(arg == 0)
return(1);
if(arg < -maxf)
return(0);
if(arg > maxf) {
error(3);
return(HUGE);
}
arg *= log2e;
ent = floor(arg);
fract = (arg-ent) - 0.5;
xsq = fract*fract;
temp1 = ((p2*xsq+p1)*xsq+p0)*fract;
temp2 = ((xsq+q2)*xsq+q1)*xsq + q0;
return(ldexp(sqrt2*(temp2+temp1)/(temp2-temp1), ent));
}

23
lang/basic/lib/fef.e Normal file
View File

@@ -0,0 +1,23 @@
#
mes 2,EM_WSIZE,EM_PSIZE
; $Header$
#define FARG 0
#define ERES EM_DSIZE
; _fef is called with two parameters:
; - address of exponent result (ERES)
; - floating point number to be split (FARG)
; and returns an EM_DSIZE-byte floating point number
exp $_fef
pro $_fef,0
lal FARG
loi EM_DSIZE
fef EM_DSIZE
lal ERES
loi EM_PSIZE
sti EM_WSIZE
ret EM_DSIZE
end ?

25
lang/basic/lib/fif.e Normal file
View File

@@ -0,0 +1,25 @@
#
mes 2,EM_WSIZE,EM_PSIZE
; $Header$
#define ARG1 0
#define ARG2 EM_DSIZE
#define IRES 2*EM_DSIZE
; _fif is called with three parameters:
; - address of integer part result (IRES)
; - float two (ARG2)
; - float one (ARG1)
; and returns an EM_DSIZE-byte floating point number
exp $_fif
pro $_fif,0
lal 0
loi 2*EM_DSIZE
fif EM_DSIZE
lal IRES
loi EM_PSIZE
sti EM_DSIZE
ret EM_DSIZE
end ?

135
lang/basic/lib/file.c Normal file
View File

@@ -0,0 +1,135 @@
#include "bc_string.h"
#include <stdio.h>
#include "bc_io.h"
/* $Header$ */
Filedesc _fdtable[16];
/* BASIC file descriptor table */
/* Channel assignment:
-1 terminal IO
0 data file
1-15 user files
*/
int _chann = -1;
FILE *_chanrd = stdin;
FILE *_chanwr = stdout;
_setchan(index)
int index;
{
#ifdef DEBUG
printf("setchannel %d\n",index);
#endif
fflush(_chanwr);
if( index == -1)
{
_chann= -1;
_chanrd= stdin;
_chanwr= stdout;
return;
}
if( index<0 || index>15)
error(27);
_chann=index;
_chanrd= _chanwr= _fdtable[index].fd;
}
_asschn()
{
#ifdef DEBUG
printf("_asschn %d\n",_chann);
#endif
if( _chann == -1) return;
#ifdef DEBUG
printf(" file %d\n", _fdtable[_chann].fd);
#endif
if( _chann<0 || _chann>15)
error(27);
if( _fdtable[_chann].fd== 0)
error(39);
if( feof( _fdtable[_chann].fd))
error(2);
}
_clochn(nr)
int nr;
{
if( nr<1 || nr >15 || _fdtable[nr].fd==0) error(3);
fclose(_fdtable[nr].fd);
_fdtable[nr].fd=0; _fdtable[nr].fname=0;
}
_opnchn(reclen,fname,mode)
String *mode,*fname;
int reclen;
{
/* channel has been set */
FILE *f;
int m;
#ifdef DEBUG
printf("open %d %s %s \n",reclen,mode->strval,fname->strval);
#endif
/* check for opened/closed file */
if(_fdtable[_chann].fd)
error(30);
switch(*mode->strval)
{
case 'O':
case 'o':
if( (f=fopen(fname->strval,"w")) == NULL)
error(28);
m= OMODE;
break;
case 'I':
case 'i':
if( (f=fopen(fname->strval,"r")) == NULL)
error(28);
m= IMODE;
break;
case 'r':
case 'R':
if( (f=fopen(fname->strval,"a")) == NULL)
error(28);
m= RMODE;
break;
default:
printf("file mode %s\n",mode->strval);
error(29);
}
_chanrd= _fdtable[_chann].fd= f;
_fdtable[_chann].fname= fname->strval;
_fdtable[_chann].reclength= reclen;
_fdtable[_chann].mode= m;
#ifdef DEBUG
printf("file descr %d\n",f);
#endif
}
_ioeof(channel)
int channel;
{
FILE *fd;
char c;
if( channel<0 || channel >15) error(3);
fd= _fdtable[channel].fd;
if( fd==0)
error(3);
c=fgetc(fd);
if( feof(_fdtable[channel].fd) ) return(-1);
ungetc(c,fd);
return(0);
}
_close()
{
/* close all open files */
int i;
for(i=1;i<16;i++)
if( _fdtable[i].fd)
_clochn(i);
}

7
lang/basic/lib/hlt.c Normal file
View File

@@ -0,0 +1,7 @@
/* $Header$ */
_hlt(nr)
int nr;
{
exit(nr);
}

97
lang/basic/lib/io.c Normal file
View File

@@ -0,0 +1,97 @@
#include "bc_io.h"
#include <sgtty.h>
/* $Header$ */
struct sgttyb _ttydef;
/* BASIC has some nasty io characteristics */
#define MAXWIDTH 255
int _width = 75, _pos=0, _zonewidth=15;
_out(str)
char *str;
{
int pos;
if( _chann== -1) pos= _pos;
else pos= _fdtable[_chann].pos;
while( *str)
{
if( pos>= _width){ _outnl(); pos=0;}
fputc(*str++, _chanwr);
pos++;
}
if( _chann== -1) _pos=pos;
else _fdtable[_chann].pos= pos;
}
_outnl()
{
fputc('\n',_chanwr);
if( _chann == -1)
_pos=0;
else
_fdtable[_chann].pos=0;
}
_zone()
{
/* go to next zone */
int pos;
if( _chann == -1)
pos= _pos;
else pos= _fdtable[_chann].pos;
do{
fputc(' ',_chanwr);
pos++;
if( pos==_width)
{
_outnl();
pos=0;
break;
}
} while( pos % _zonewidth != 0);
if( _chann== -1) _pos=pos;
else _fdtable[_chann].pos= pos;
}
_in(buf)
char *buf;
{
register int holder ;
char *c;
int pos;
if( _chann == -1)
{
pos= _pos;
gtty(0,_ttydef);
_ttydef.sg_flags &= ~ECHO;
stty(0,_ttydef);
}else pos= _fdtable[_chann].pos;
c= buf;
while( (holder = fgetc(_chanrd)) != EOF && holder != '\n'){
*c= holder ;
if( _chann == -1) putchar(holder);
c++; pos++;
}
*c= 0;
if( _chann== -1)
{
_pos=pos;
_ttydef.sg_flags |= ECHO;
stty(0,_ttydef);
} else _fdtable[_chann].pos= pos;
}
_tab(x)
int x;
{
if( x> _width) error(3);
if( x< _pos) _outnl();
_spc(x-_pos);
}
_spc(x)
int x;
{
while(x-->0) _out(" ");
}

75
lang/basic/lib/log.c Normal file
View File

@@ -0,0 +1,75 @@
/*
* (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
*
* This product is part of the Amsterdam Compiler Kit.
*
* Permission to use, sell, duplicate or disclose this software must be
* obtained in writing. Requests for such permissions may be sent to
*
* Dr. Andrew S. Tanenbaum
* Wiskundig Seminarium
* Vrije Universiteit
* Postbox 7161
* 1007 MC Amsterdam
* The Netherlands
*
*/
/* $Header$ */
/* Author: J.W. Stevenson */
extern double _fef();
/*
log returns the natural logarithm of its floating
point argument.
The coefficients are #2705 from Hart & Cheney. (19.38D)
It calls _fef.
*/
#define HUGE 1.701411733192644270e38
static double log2 = 0.693147180559945309e0;
static double sqrto2 = 0.707106781186547524e0;
static double p0 = -.240139179559210510e2;
static double p1 = 0.309572928215376501e2;
static double p2 = -.963769093368686593e1;
static double p3 = 0.421087371217979714e0;
static double q0 = -.120069589779605255e2;
static double q1 = 0.194809660700889731e2;
static double q2 = -.891110902798312337e1;
double
_log(arg)
double arg;
{
double x,z, zsq, temp;
int exp;
if(arg <= 0) {
error(3);
return(-HUGE);
}
x = _fef(arg,&exp);
/*
while(x < 0.5) {
x =* 2;
exp--;
}
*/
if(x<sqrto2) {
x *= 2;
exp--;
}
z = (x-1)/(x+1);
zsq = z*z;
temp = ((p3*zsq + p2)*zsq + p1)*zsq + p0;
temp = temp/(((zsq + q2)*zsq + q1)*zsq + q0);
temp = temp*z + exp*log2;
return(temp);
}

34
lang/basic/lib/mki.c Normal file
View File

@@ -0,0 +1,34 @@
#include "bc_string.h"
/* $Header$ */
String *_mki(i)
long i;
{
char *buffer =" ";
String *s;
s= _newstr(buffer);
* ( (long *)s->strval ) = i ;
return(s);
}
String *_mkd(d)
double d;
{
char *buffer =" ";
String *s;
s= _newstr(buffer);
* ( (double *)s->strval ) = d ;
return(s);
}
long _cvi(s)
String *s;
{
return *( (long *) s->strval) ;
}
double _cvd(s)
String *s;
{
return *( (double *) s->strval) ;
}

19
lang/basic/lib/oct.c Normal file
View File

@@ -0,0 +1,19 @@
#include "bc_string.h"
/* $Header$ */
String *_oct(i)
int i;
{
char buffer[30];
sprintf(buffer,"%o",i);
return( (String *)_newstr(buffer));
}
String *_hex(i)
int i;
{
char buffer[30];
sprintf(buffer,"%x",i);
return( (String *)_newstr(buffer));
}

26
lang/basic/lib/peek.c Normal file
View File

@@ -0,0 +1,26 @@
/* $Header$ */
int peek(addr)
int addr;
{
/* this can not work properly for machines in which the
POINTERSIZE differs from the integer size
*/
char *p;
int i;
p= (char *)addr;
i= *p;
#ifdef DEBUG
printf("peek %d = %d\n",addr,i);
#endif
return(i);
}
_poke(i,j)
int i,j;
{
char *p;
p= (char *) i;
*p=j;
}

32
lang/basic/lib/power.c Normal file
View File

@@ -0,0 +1,32 @@
/* $Header$ */
/*
computes a^b.
uses log and exp
*/
double _log(), _exp();
double
_power(base,pownr)
double pownr, base;
{
double temp;
long l;
if(pownr <= 0.0) {
if(pownr == 0.0) {
if(base <= 0.0)
error(3);
return(0.0);
}
l = base;
if(l != base)
error(3);
temp = _exp(base * _log(-pownr));
if(l & 1)
temp = -temp;
return(temp);
}
return(_exp(base * _log(pownr)));
}

73
lang/basic/lib/print.c Normal file
View File

@@ -0,0 +1,73 @@
#include "bc_string.h"
#include "bc_io.h"
/* $Header$ */
/* Here all routine to generate terminal oriented output is located */
_qstmark()
{
/* prompt for terminal input */
putchar('?');
}
_nl()
{
_asschn();
_outnl();
}
_prinum(i)
int i;
{
char buffer[40];
_asschn();
if(i>=0)
sprintf(buffer," %d ",i);
else sprintf(buffer,"-%d ",-i);
_out(buffer);
}
_str(f,buffer)
double f;
char *buffer;
{
char *c;
c= buffer;
if( f>=0){
if( f> 1.0e8)
sprintf(buffer," %e",f);
else sprintf(buffer," %f",f);
c++;
}else {
if(-f> 1.0e8)
sprintf(buffer,"-%e",-f);
else sprintf(buffer,"-%f",-f);
}
for( ; *c && *c!= ' ';c++) ;
c--;
while( c>buffer && *c== '0')
{
*c= 0;c--;
}
if( *c=='.') *c=0;
strcat(buffer," ");
}
_prfnum(f)
double f;
{
/* BASIC strings trailing zeroes */
char buffer[100];
char *c;
_asschn();
c= buffer;
_str(f,c);
_out(buffer);
}
_prstr(str)
String *str;
{
_asschn();
if( str==0) _out("<null>");
else _out(str->strval);
}

25
lang/basic/lib/random.c Normal file
View File

@@ -0,0 +1,25 @@
/* $Header$ */
_randomi()
{
int i;
double f;
_setchan(-1);
printf("Random number seed (-32768 to 32767) ? ");
_readint(&i);
f=i;
_setrand(f);
}
_setrand(f)
double f;
{
int i;
i=f;
srand(i);
}
double _rnd(d) double d;
{
double f; f= (int) rand();
return(f/32767.0);
}

174
lang/basic/lib/read.c Normal file
View File

@@ -0,0 +1,174 @@
#include "bc_string.h"
#include "bc_io.h"
#include <ctype.h>
/* $Header$ */
_readln()
{
register int c;
while( (c=fgetc(_chanrd)) != EOF && c!= '\n')
;
}
readskip()
{
register int c;
#ifdef DEBUG
printf("readskip\n");
#endif
while( (c=fgetc(_chanrd)) != EOF && c!= ',' && c!= '\n')
;
}
_readint(addr)
int *addr;
{
int i;
char buf[1024];
#ifdef DEBUG
printf("read int from %d\n",_chann);
#endif
_asschn();
if( fscanf(_chanrd,"%d",&i) != 1)
{
if( ferror(_chanrd)) error(29);
if( feof(_chanrd)) error(2);
if( _chann == -1)
{
_asschn(); /* may be closed by now */
fgets(buf,1024,_chanrd);
printf("?Redo ");
_readint(addr);
return;
}
error(40);
}else { readskip(); *addr=i;}
}
_readflt(addr)
double *addr;
{
double f;
char buf[1024];
#ifdef DEBUG
printf("read flt from %d\n",_chann);
#endif
_asschn();
if( fscanf(_chanrd,"%lf",&f) != 1)
{
if( ferror(_chanrd)) error(29);
if( feof(_chanrd)) error(2);
if( _chann == -1)
{
fgets(buf,1024,_chanrd);
printf("?Redo ");
_readflt(addr);
return;
}
error(40);
}else { readskip(); *addr=f;}
}
_readstr(s)
String **s;
{
char buffer[1024];
register int kar ;
char *c;
#ifdef DEBUG
printf("read str from %d\n",_chann);
#endif
_asschn();
c= buffer;
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 ( (kar= fgetc(_chanrd)) != EOF && kar!='"' ) *c++ = kar ;
ungetc(kar,_chanrd);
*c=0;
}else
if( isalpha(*c))
{
/* read normal string */
c++;
#ifdef DEBUG
printf("non-qouted string\n");
#endif
while( (kar= fgetc(_chanrd)) != ',' && kar!= EOF &&
!isspace(kar) && kar!='\n')
*c++= kar ;
ungetc(kar,_chanrd);
*c=0;
}else{
if( ferror(_chanrd)) error(29);
if( feof(_chanrd)) error(2);
if( _chann == -1)
{
fgets(buffer,1024,_chanrd);
printf("?Redo ");
_rdline(s);
return;
}
error(40);
}
#ifdef DEBUG
printf("string read: %s\n",buffer);
#endif
readskip();
/* save value read */
_decstr(*s);
*s= (String *) _newstr(buffer);
}
extern int _seektab[];
_restore(line)
int line;
{
int nr;
char buffer[1024];
#ifdef DEBUG
printf("seek to %d",line);
#endif
fseek(_chanrd,0l,0);
if( line)
{
/* search number of lines to skip */
for(nr=0; _seektab[nr] && _seektab[nr]< line; nr+=2)
#ifdef DEBUG
printf("test %d %d\n",_seektab[nr], _seektab[nr+1]);
#endif
;
nr /= 2;
#ifdef DEBUG
printf(" %d lines to skip\n",nr);
#endif
while(nr-- >0 ) fgets(buffer,1024,_chanrd);
}
}
_rdline(s)
String **s;
{
char buffer[1024];
if( fgets(buffer,1024,_chanrd) == 0)
{
if( _chann == -1)
{
printf("?Redo ");
_rdline(s);
return;
}
error(40);
}
_decstr(*s);
*s= (String *) _newstr(buffer);
}

29
lang/basic/lib/return.c Normal file
View File

@@ -0,0 +1,29 @@
/* $Header$ */
#define MAXNESTING 1000
int _gotable[MAXNESTING];
int topstk=0;
_gosub(x)
int x;
{
/* administer gosub */
#ifdef DEBUG
printf("store %d in %d\n",x,topstk);
#endif
if( topstk== MAXNESTING) error(26);
_gotable[topstk]= x;
topstk++;
}
_retstmt()
{
/* make sure that a return label index is on top
of the stack */
#ifdef DEBUG
printf("return to %d %d\n",_gotable[topstk-1],topstk-1);
#endif
if( topstk==0 || topstk==MAXNESTING)
error(1);
return( _gotable[--topstk]);
}

20
lang/basic/lib/salloc.c Normal file
View File

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

11
lang/basic/lib/setline.e Normal file
View File

@@ -0,0 +1,11 @@
#
mes 2,EM_WSIZE,EM_PSIZE
; $Header$
; Save the line where the error occurred
exp $_setline
pro $_setline,0
exa _erlsym
loe 0
ste _erlsym
ret 0
end

9
lang/basic/lib/sgn.c Normal file
View File

@@ -0,0 +1,9 @@
/* $Header$ */
_sgn(v)
double v;
{
if( v>0) return(1);
if( v<0) return(-1);
return(0);
}

102
lang/basic/lib/sin.c Normal file
View File

@@ -0,0 +1,102 @@
/*
* (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
*
* This product is part of the Amsterdam Compiler Kit.
*
* Permission to use, sell, duplicate or disclose this software must be
* obtained in writing. Requests for such permissions may be sent to
*
* Dr. Andrew S. Tanenbaum
* Wiskundig Seminarium
* Vrije Universiteit
* Postbox 7161
* 1007 MC Amsterdam
* The Netherlands
*
*/
/* $Header$ */
/* Author: J.W. Stevenson */
extern double _fif();
/*
C program for floating point sin/cos.
Calls _fif.
There are no error exits.
Coefficients are #3370 from Hart & Cheney (18.80D).
*/
static double twoopi = 0.63661977236758134308;
static double p0 = .1357884097877375669092680e8;
static double p1 = -.4942908100902844161158627e7;
static double p2 = .4401030535375266501944918e6;
static double p3 = -.1384727249982452873054457e5;
static double p4 = .1459688406665768722226959e3;
static double q0 = .8644558652922534429915149e7;
static double q1 = .4081792252343299749395779e6;
static double q2 = .9463096101538208180571257e4;
static double q3 = .1326534908786136358911494e3;
static double
sinus(arg, quad)
double arg;
int quad;
{
double e, f;
double ysq;
double x,y;
int k;
double temp1, temp2;
x = arg;
if(x<0) {
x = -x;
quad = quad + 2;
}
x = x*twoopi; /*underflow?*/
if(x>32764){
y = _fif(x, 10.0, &e);
e = e + quad;
_fif(0.25, e, &f);
quad = e - 4*f;
}else{
k = x;
y = x - k;
quad = (quad + k) & 03;
}
if (quad & 01)
y = 1-y;
if(quad > 1)
y = -y;
ysq = y*y;
temp1 = ((((p4*ysq+p3)*ysq+p2)*ysq+p1)*ysq+p0)*y;
temp2 = ((((ysq+q3)*ysq+q2)*ysq+q1)*ysq+q0);
return(temp1/temp2);
}
double
_cos(arg)
double arg;
{
if(arg<0)
arg = -arg;
return(sinus(arg, 1));
}
double
_sin(arg)
double arg;
{
return(sinus(arg, 0));
}
/* EXTENSION */
double
_tan(arg)
double arg;
{
return( _sin(arg)/_cos(arg));
}

76
lang/basic/lib/sqt.c Normal file
View File

@@ -0,0 +1,76 @@
/*
* (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
*
* This product is part of the Amsterdam Compiler Kit.
*
* Permission to use, sell, duplicate or disclose this software must be
* obtained in writing. Requests for such permissions may be sent to
*
* Dr. Andrew S. Tanenbaum
* Wiskundig Seminarium
* Vrije Universiteit
* Postbox 7161
* 1007 MC Amsterdam
* The Netherlands
*
*/
/* $Header$ */
/* Author: J.W. Stevenson */
extern double _fef();
/*
sqrt returns the square root of its floating
point argument. Newton's method.
calls _fef
*/
double
_sqt(arg)
double arg;
{
double x, temp;
int exp;
int i;
if(arg <= 0) {
if(arg < 0)
error(3);
return(0);
}
x = _fef(arg,&exp);
/*
while(x < 0.5) {
x =* 2;
exp--;
}
*/
/*
* NOTE
* this wont work on 1's comp
*/
if(exp & 1) {
x *= 2;
exp--;
}
temp = 0.5*(1 + x);
while(exp > 28) {
temp *= (1<<14);
exp -= 28;
}
while(exp < -28) {
temp /= (1<<14);
exp += 28;
}
if(exp >= 0)
temp *= 1 << (exp/2);
else
temp /= 1 << (-exp/2);
for(i=0; i<=4; i++)
temp = 0.5*(temp + arg/temp);
return(temp);
}

10
lang/basic/lib/stop.c Normal file
View File

@@ -0,0 +1,10 @@
/* $Header$ */
_stop()
{
extern int _erlsym;
_setline();
printf("Break in %d\n", _erlsym);
exit(0);
}

179
lang/basic/lib/string.c Normal file
View File

@@ -0,0 +1,179 @@
#include "bc_string.h"
/* $Header$ */
#define ok(X) if( X ==0) return;
#define okr(X) if( X ==0) return(0);
extern char *salloc() ;
_len(str)
String *str;
{
okr(str);
return(str->strlength);
}
String *_newstr(str)
char *str;
{
String *s;
okr(str);
s= (String *) salloc(sizeof(String));
s->strcount=1;
s->strlength= strlen(str);
s->strval= salloc(s->strlength+1);
strcpy(s->strval,str);
return(s);
}
_incstr(src)
String *src;
{
/* one more variable uses the string */
ok(src);
src->strcount++;
}
_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);
}
_strcpy(dst,src)
String *src,*dst;
{
ok(src);
ok(dst);
_decstr(dst);
*dst = *src;
_incstr(src);
}
_delstr(src)
String *src;
{
ok(src);
sfree(src->strval);
sfree((char *)src);
}
String *_concat(s1,s2)
String *s1,*s2;
{
String *s;
int length;
okr(s1); okr(s2);
s= (String *) salloc(sizeof(String));
length= _len(s1)+_len(s2)+1;
s->strval= salloc(length);
strcpy(s->strval,s2->strval);
strcat(s->strval,s1->strval);
return(s);
}
_strcomp(s1,s2)
String *s1,*s2;
{
okr(s1);okr(s2);
return(strcmp(s2->strval,s1->strval));
}
String *_left(size,s)
String *s;
int size;
{
String *ns;
int i;
okr(s);
if( size <0 || size >s->strlength) error(3);
ns= (String *) salloc(sizeof(String));
ns->strval= salloc(size+1);
ns->strcount=1;
for(i=0; i<size && s->strval[i];i++)
ns->strval[i]= s->strval[i];
ns->strval[i]=0;
ns->strlength= i;
return(ns);
}
String *_space(d)
int d;
{
String *s;
int i,len;
len= d;
s= (String *) salloc(sizeof(String));
s->strlength= len;
s->strcount=1;
s->strval= salloc(len+1);
for(i=0;i<len;i++)
s->strval[i]= ' ';
s->strval[i]=0;
return(s);
}
String *_strascii()
{
}
String *_string(d,f)
double d,f;
{
int i,j;
String *s;
i=d;j=f;
if( i<0 || i>MAXSTRING) error(3);
s= (String *) salloc(sizeof(String));
s->strlength= i;
s->strcount=1;
s->strval= salloc(i+1);
s->strval[i]=0;
for(; i>=0;i--)
s->strval[i]= j;
return(s);
}
_midstmt(s2,i1,i2,s)
int i1,i2;
String *s, *s2;
{
int l;
/* printf("mid called %d %d %s %s\n",i1,i2,s->strval, s2->strval);*/
if( i1== -1) i1= s2->strlength;
if( s->strlength<i2) error(3); /* source string too short */
l= s->strlength - i2+1;
if( i1>l ) i1=l;
strncpy(s->strval+i2-1,s2->strval,i1);
}
String *_mid(i1,i2,s)
int i1,i2;
String *s;
{
int l;
String *s2;
/* printf("mid fcn called %d %d %s\n",i1,i2,s->strval);*/
if( i1 == -1) i1= s->strlength;
s2= _newstr(s->strval);
s2->strval[0]=0;
if( s->strlength<i2) return(s2); /* source string too short */
l= s->strlength - i2+1;
if( i1>l ) i1=l;
strncpy(s2->strval,s->strval+i2-1,i1);
s2->strval[i1]=0;
return(s2);
}
String *_right(length,str)
String *str;
int length;
{
String *s;
int i;
i= _len(str)-length;
if(i<0) i=0;
s= _newstr(str->strval+i);
return(s);
}

30
lang/basic/lib/swap.c Normal file
View File

@@ -0,0 +1,30 @@
#include "bc_string.h"
/* $Header$ */
_intswap(i1,i2)
int *i1,*i2;
{
int i3;
i3= *i1;
*i1= *i2;
*i2=i3;
}
_fltswap(i1,i2)
double *i1,*i2;
{
double i3;
i3= *i1;
*i1= *i2;
*i2=i3;
}
_strswap(s1,s2)
String *s1,*s2;
{
String s;
s= *s1;
*s1= *s2;
*s2 = s;
}

7
lang/basic/lib/trace.c Normal file
View File

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

55
lang/basic/lib/trap.c Normal file
View File

@@ -0,0 +1,55 @@
#include <signal.h>
#include <setjmp.h>
/* $Header$ */
/* Trap handling */
int _trpline; /* BASIC return label */
jmp_buf trpbuf;
_trpset(nr)
int nr;
{
/*debug printf("trap set to %d\n",nr);*/
_trpline=nr;
}
_trpfatal(i)
int i;
{
extern int _errsym,_erlsym;
_errsym= i;
_setline();
if( _trpline == 0)
printf("LINE %d: FATAL ERROR: trap %d\n",_erlsym,i);
#ifdef DEBUG
printf("trap occurred %d return %d\n",i,_trpline);
#endif
_trap();
}
_ini_trp()
{
/* initialize trap routines */
int i, _trpfatal();
for(i=0;i<NSIG;i++)
signal(i,_trpfatal);
}
_settrap(nr)
int nr;
{
_trpline=nr;
}
_trap()
{
int line;
if( _trpline==0) exit(-1);
line=_trpline;
_trpline=0; /* should be reset by user */
_ini_trp();
longjmp(trpbuf,line);
}

35
lang/basic/lib/write.c Normal file
View File

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

View File

@@ -0,0 +1,51 @@
# $Header$
d=../../..
h=$d/h
l=$d/lib
INSTALL=$l/em_bem
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 \
eval.c func.c split.c
first : bem
cmp : bem
cmp bem $(INSTALL)
install: bem
cp bem $(INSTALL)
clean:
rm -f *.[osmk] *.old bem
opr:
make pr ^ opr
pr:
@pr $(SRC)
bem: $(FILES)
$(CC) -o bem $(FILES)
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

@@ -0,0 +1,468 @@
#ifndef NORSCID
static char rcs_lex[] = "$Header$" ;
#endif
/* This file contains the new lexical analizer */
typedef struct {
char *name;
int token, classvalue,length;
} Key;
Key keywords [] ={
"abs", FUNCTION, ABSSYM, 0,
"and", BOOLOP, ANDSYM, 0,
"asc", FUNCTION, ASCSYM, 0,
"as", ASSYM, 0, 0,
"atn", FUNCTION, ATNSYM, 0,
"auto", ILLEGAL, 0, 0,
"base", BASESYM, 0, 0,
"call", CALLSYM, 0, 0,
"cdbl", FUNCTION, CDBLSYM, 0,
"chain", ILLEGAL, 0, 0,
"chr", FUNCTION, CHRSYM, 0,
"cint", FUNCTION, CINTSYM, 0,
"clear", CLEARSYM, 0, 0,
"cload", ILLEGAL, 0, 0,
"close", ILLEGAL, 0, 0,
"common", ILLEGAL, 0, 0,
"cont", ILLEGAL, 0, 0,
"cos", FUNCTION, COSSYM, 0,
"csng", FUNCTION, CSNGSYM, 0,
"csave", ILLEGAL, 0, 0,
"cvi", FUNCTION, CVISYM, 0,
"cvs", FUNCTION, CVSSYM, 0,
"cvd", FUNCTION, CVDSYM, 0,
"data", DATASYM, 0, 0,
"defint", DEFINTSYM, 0, 0,
"defsng", DEFSNGSYM, 0, 0,
"defdbl", DEFDBLSYM, 0, 0,
"defstr", DEFSTRSYM, 0, 0,
"def", DEFSYM, 0, 0,
"delete", ILLEGAL, 0, 0,
"dim", DIMSYM, 0, 0,
"edit", ILLEGAL, 0, 0,
"else", ELSESYM, 0, 0,
"end", ENDSYM, 0, 0,
"eof", FUNCTION, EOFSYM, 0,
"erase", ILLEGAL, 0, 0,
"error", ERRORSYM, 0, 0,
"err", ERRSYM, 0, 0,
"erl", ERLSYM, 0, 0,
"else", ELSESYM, 0, 0,
"eqv", BOOLOP, EQVSYM, 0,
"exp", FUNCTION, EXPSYM, 0,
"field", FIELDSYM, 0, 0,
"fix", FUNCTION, FIXSYM, 0,
"for", FORSYM, 0, 0,
"fre", FUNCTION, FRESYM, 0,
"get", GETSYM, 0, 0,
"gosub", GOSUBSYM, 0, 0,
"goto", GOTOSYM, 0, 0,
"hex", FUNCTION, HEXSYM, 0,
"if", IFSYM, 0, 0,
"imp", BOOLOP, IMPSYM, 0,
"inkey", INKEYSYM, 0, 0,
"input", INPUTSYM, 0, 0,
"inp", FUNCTION, INPSYM, 0,
"instr", FUNCTION, INSTRSYM, 0,
"int", FUNCTION, INTSYM, 0,
"kill", ILLEGAL, 0, 0,
"left", FUNCTION, LEFTSYM, 0,
"len", FUNCTION, LENSYM, 0,
"let", LETSYM, 0, 0,
"line", LINESYM, 0, 0,
"list", LISTSYM, 0, 0,
"llist", ILLEGAL, 0, 0,
"load", LOADSYM, 0, 0,
"loc", FUNCTION, LOCSYM, 0,
"log", FUNCTION, LOGSYM, 0,
"lpos", FUNCTION, LPOSSYM, 0,
"lprint", ILLEGAL, 0, 0,
"lset", LSETSYM, 0, 0,
"merge", MERGESYM, 0, 0,
"mid", MIDSYM, 0, 0,
"mki", FUNCTION, MKISYM, 0,
"mks", FUNCTION, MKSSYM, 0,
"mkd", FUNCTION, MKDSYM, 0,
"mod", MODSYM, 0, 0,
"name", ILLEGAL, 0, 0,
"new", ILLEGAL, 0, 0,
"next", NEXTSYM, 0, 0,
"not", NOTSYM, 0, 0,
"null", ILLEGAL, 0, 0,
"on", ONSYM, 0, 0,
"oct", FUNCTION, OCTSYM, 0,
"open", OPENSYM, 0, 0,
"option", OPTIONSYM, 0, 0,
"or", BOOLOP, ORSYM, 0,
"out", FUNCTION, OUTSYM, 0,
"peek", PEEKSYM, 0, 0,
"poke", POKESYM, 0, 0,
"print", PRINTSYM, 0, 0,
"pos", FUNCTION, POSSYM, 0,
"put", PUTSYM, 0, 0,
"randomi", RANDOMIZESYM, 0, 0,
"read", READSYM, 0, 0,
"rem", REMSYM, 0, 0,
"renum", ILLEGAL, 0, 0,
"ren", ILLEGAL, 0, 0,
"restore", RESTORESYM, 0, 0,
"resume", ILLEGAL, 0, 0,
"return", RETURNSYM, 0, 0,
"right", FUNCTION, RIGHTSYM, 0,
"rnd", FUNCTION, RNDSYM, 0,
"run", ILLEGAL, 0, 0,
"save", ILLEGAL, 0, 0,
"step", STEPSYM, 0, 0,
"sgn", FUNCTION, SGNSYM, 0,
"sin", FUNCTION, SINSYM, 0,
"space", FUNCTION, SPACESYM, 0,
"spc", FUNCTION, SPCSYM, 0,
"sqr", FUNCTION, SQRSYM, 0,
"stop", STOPSYM, 0, 0,
"string", FUNCTION, STRINGSYM, 0,
"str", FUNCTION, STRSYM, 0,
"swap", SWAPSYM, 0, 0,
"tab", FUNCTION, TABSYM, 0,
"tan", FUNCTION, TANSYM, 0,
"then", THENSYM, 0, 0,
"to", TOSYM, 0, 0,
"tron", TRONOFFSYM, TRONSYM, 0,
"troff", TRONOFFSYM, TROFFSYM, 0,
"using", USINGSYM, 0, 0,
"usr", FUNCTION, USRSYM, 0,
"val", FUNCTION, VALSYM, 0,
"varptr", FUNCTION, VARPTRSYM, 0,
"wait", ILLEGAL, 0, 0,
"while", WHILESYM, 0, 0,
"wend", WENDSYM, 0, 0,
"width", ILLEGAL, 0, 0,
"write", WRITESYM, 0, 0,
"xor", BOOLOP, XORSYM, 0,
0, 0, 0, 0
};
/* Keyword index table */
int kex[27];
/* Initialize the keyword table */
fillkex()
{
Key *k;
int i;
for(k=keywords;k->name;k++)
k->length= strlen(k->name);
k=keywords;
for(i=0;k->name && i<='z'-'a';i++)
{
for(;k->name && *k->name<i+'a';k++);
if( *k->name!=i+'a') continue;
kex[*k->name-'a']=k-keywords;
for(;k->name && *k->name==i+'a';k++);
kex[*(k-1)->name-'a'+1]=k-keywords;
}
if(debug)
{
for(i=0;i<27;i++)
printf("%c:%d\n",'a'+i,kex[i]);
}
}
#include <ctype.h>
/* Get each line separately into the buffer */
/* Lines too long are terminated and flagged illegal */
#define MAXLINELENGTH 1024
char inputline[MAXLINELENGTH]; /* current source line */
char *cptr; /* next character to decode */
int yylineno=0; /* source line counter */
getline()
{
/* get next input line */
if( fgets(inputline,MAXLINELENGTH,yyin) == NULL)
return(FALSE);
yylineno ++;
if( index(inputline,'\n') == 0)
error("source line too long");
inputline[MAXLINELENGTH-1]=0;
if( listing)
fputs(inputline,stdout);
cptr= inputline;
return(TRUE);
}
yyerror(str)
char *str;
{
error("Syntax error");
}
typechar()
{
switch(*cptr)
{
case '$':
cptr++; return( STRINGTYPE);
case '%':
cptr++; return( INTTYPE);
case '!':
cptr++; return( FLOATTYPE);
case '#':
cptr++; return( DOUBLETYPE);
}
return(0);
}
/* symbols in Microsoft are significant for the first 40 characters */
#define SIGNIFICANT 40
char name[SIGNIFICANT+1];
lookup()
{
Key *k;
Symbol *Sym;
char *c;
int i, typech;
sval= name;
for(c=cptr; *c && isalnum(*c);c++)
if( isupper(*c) )
*c= tolower((*c));
for(k= keywords+kex[*cptr-'a']; *(k->name)== *cptr;k++)
if( strncmp(cptr,k->name,k->length)==0)
{
/* check functions first*/
if( isalnum( *(cptr+k->length) ) &&
k->token==FUNCTION) continue;
cptr += k->length;
yylval.integer= k->classvalue;
if(debug) printf("lookup:%d %d\n",
k->classvalue,k->token);
if( k->token == FUNCTION)
{
/* stripp type character */
typech=typechar();
}
/* illegals + rem */
if( k->token == REMSYM || k->token==ILLEGAL)
while( *cptr && *cptr!=':' && *cptr!='\n')
cptr++;
return( k->token);
}
/* Is it a function name ? */
c=cptr;
/* Identifier found, update the symbol table */
i=0;
while( isalnum(*c) || *c == '.')
if( i<SIGNIFICANT) name[i++]= *c++;
name[i]=0;
cptr=c;
Sym= srchsymbol(name);
yylval.Sptr = Sym;
typech= typechar();
if(Sym->symtype!=DEFAULTTYPE)
{
if(typech && typech!=Sym->symtype && wflag)
warning("type re-declared,ignored");
}
if( typech)
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);
return(IDENTIFIER);
}
/* Parsing unsigned numbers */
readconstant()
{
/* read HEX and OCTAL numbers */
char *c;
cptr++;
if( *cptr == 'H' || *cptr=='h')
{
/* HEX */
cptr++;
c=cptr;
while( isdigit(*cptr) ||
(*cptr>='a' && *cptr<='f' ) ||
(*cptr>='A' && *cptr<='F' ) )cptr++;
sscanf(c,"%x",&ival);
} else
if( *cptr == 'O' || *cptr == 'o')
{
/* OCTAL */
cptr++;
c=cptr;
while( isdigit(*cptr) ) cptr++;
sscanf(c,"%o",&ival);
} else
error("H or O expected");
return(INTVALUE);
}
number()
{
long i1;
double f,dec;
int minflag;
register char *c;
i1=0;
c=cptr;
while(isdigit(*c)){
i1= i1*10 + *c-'0';
c++;
}
cptr=c;
if( *c != '.'){
if( i1> MAXINT || i1<MININT) {
/*NOSTRICT*/ dval= i1;
return(FLTVALUE);
}
/*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)){
f= f + dec * (*c - '0');
dec /= 10.0;
c++;
}
/* handle exponential part */
if( *c =='e' || *c == 'E'){
c++;
minflag= (*c== '-')? -1: 1;
if( *c=='-' || *c=='+') c++;
while(isdigit(*c)){
f *= 10.0;
c++;
}
if(minflag== -1) f= 1.0/f;
}
dval= f;
cptr=c;
#ifdef YYDEBUG
if(yydebug) printf("number:FLTVALUE %f",f);
#endif
return(FLTVALUE);
}
scanstring()
{
int i,length;
char firstchar;
/* skip this string value, you might as well copy it to
the EM file as well, because it is not used internally
*/
/* generate label here */
yylval.integer= genrom();
length=0;
if( fputc('"',emfile) == EOF) fatal("scanstring");
sval= cptr;
firstchar = *cptr;
if( *cptr== '"') cptr++;
while( *cptr !='"')
{
switch(*cptr)
{
case 0:
case '\n':
#ifdef YYDEBUG
if(yydebug) printf("STRVALUE\n");
#endif
if( firstchar == '"')
error("non-terminated string");
return(STRVALUE);
default:
fputc(*cptr,emfile);
}
cptr++;
length++;
}
*cptr=0;
cptr++;
fprintf(emfile,"\\000\"\n");
i=yylval.integer;
yylval.integer= genrom();
fprintf(emfile,"l%d,9999,%d\n",i,length);
#ifdef YYDEBUG
if(yydebug) printf("STRVALUE found\n");
#endif
return(STRVALUE);
}
yylex()
{
char *c;
/* Here is the big switch */
c= cptr;
switch(*c){
case 'a': case 'b': case 'c': case 'd': case 'e':
case 'f': case 'g': case 'h': case 'i': case 'j':
case 'k': case 'l': case 'm': case 'n': case 'o':
case 'p': case 'q': case 'r': case 's': case 't':
case 'u': case 'v': case 'w': case 'x': case 'y':
case 'z': case 'A': case 'B': case 'C': case 'D':
case 'E': case 'F': case 'G': case 'H': case 'I':
case 'J': case 'K': case 'L': case 'M': case 'N':
case 'O': case 'P': case 'Q': case 'R': case 'S':
case 'T': case 'U': case 'V': case 'W': case 'X':
case 'Y': case 'Z': case '_':
return(lookup());
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
case '.':
return(number());
case '\'':
/* comment at end of line */
while( *cptr != '\n' && *cptr) cptr++;
case '\n':
cptr++;
return(EOLN);
case 0:
#ifdef YYDEBUG
if( yydebug) printf("end of buffer");
#endif
return(0);
case '"':
return(scanstring());
/* handle double operators */
case ' ':
case '\t':
cptr++;
return(yylex());
case '&':
return(readconstant());
case '?': return(PRINTSYM);
case '>':
if( *(c+1)=='='){
c++;c++;cptr=c; yylval.integer= GESYM;return(RELOP);
}
yylval.integer= '>';
cptr++;
return(RELOP);
case '<':
if( *(c+1)=='='){
c++; c++; cptr=c; yylval.integer=LESYM; return(RELOP);
} else
if( *(c+1)=='>'){
c++; c++; cptr=c; yylval.integer=NESYM; return(RELOP);
}
yylval.integer= '<';
cptr++;
return(RELOP);
}
return(*cptr++);
}

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