diff --git a/DistrAction b/DistrAction
new file mode 100755
index 00000000..90295286
--- /dev/null
+++ b/DistrAction
@@ -0,0 +1,3 @@
+p=/proj/em/Work
+sh TakeAction 'make distr' $p/distr/Action
+sh TakeAction 'make distr' $p/distr/Action1
diff --git a/Makefile b/Makefile
new file mode 100644
index 00000000..bf4572b2
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,35 @@
+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 ) \
+ )
diff --git a/lib/descr/fe.src b/lib/descr/fe.src
new file mode 100644
index 00000000..c77669d5
--- /dev/null
+++ b/lib/descr/fe.src
@@ -0,0 +1,225 @@
+# (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
+# $Header$
+#
+# Don't generate line updating code by default (i.e.: -L flag provided to cem).
+# To put it on again: use -NL
+var LFLAG=-L
+var C_INCLUDES=-I{EM}/include/_tail_cc
+var ANSI_C_INCLUDES=-I{EM}/include/tail_ac
+
+callname ack
+name cpp
+ # no from, this is a preprocessor
+ to .i
+ program {EM}/lib/cpp{ANSI_C?}
+ mapflag -I* CPP_F={CPP_F?} -I*
+ mapflag -U* CPP_F={CPP_F?} -U*
+ mapflag -D* CPP_F={CPP_F?} -D*
+ mapflag -P CPP_F={CPP_F?} -P
+ mapflag -C CPP_F={CPP_F?} -C
+ mapflag -wo CPP_F={CPP_F?} -o
+ mapflag -ansi ANSI_C=.ansi
+ args {CPP_F?} ({SUFFIX?}:.ocm=-I{EM}/include/occam) \
+ ({ANSI_C?}:.ansi={SYSINCLUDES?} {ANSI_C_INCLUDES} {INCLUDES?}) \
+ ({ANSI_C?.c}:{SUFFIX}={SYSINCLUDES?} {C_INCLUDES} {INCLUDES?}) \
+ -D{NAME} \
+ ({ANSI_C?.xx}:.xx=-DEM_WSIZE={w} -DEM_PSIZE={p} \
+ -DEM_SSIZE={s} -DEM_LSIZE={l} -DEM_FSIZE={f} -DEM_DSIZE={d}) \
+ -D_EM_WSIZE={w} -D_EM_PSIZE={p} \
+ -D_EM_SSIZE={s} -D_EM_LSIZE={l} -D_EM_FSIZE={f} -D_EM_DSIZE={d} \
+ <
+ stdout
+ prep is
+end
+name cem
+ from .c
+ to .k
+ program {EM}/lib/em_cemcom{ANSI_C?}
+ mapflag -ansi ANSI=ansi
+# mapflag -I* CPP_F={CPP_F?} -I*
+# mapflag -U* CPP_F={CPP_F?} -U*
+# mapflag -D* CPP_F={CPP_F?} -D*
+ mapflag -M* CEM_F={CEM_F?} -M*
+ mapflag -L CEM_F={CEM_F?} -L
+ mapflag -A CEM_F={CEM_F?} -A
+ mapflag -NL LFLAG=
+ mapflag -KR CEM_F={CEM_F?} -R
+ mapflag -w CEM_F={CEM_F?} -w
+ mapflag -wa CEM_F={CEM_F?} -a
+ mapflag -wo CEM_F={CEM_F?} -o
+ mapflag -ws CEM_F={CEM_F?} -s
+ mapflag -g CEM_F={CEM_F?} -g
+ mapflag -p CEM_F={CEM_F?} -p
+ mapflag -V* CEM_F={CEM_F?} -V*
+ rts .c
+ need .c
+ args \
+ {CPP_F?} \
+ {SYSINCLUDES?} \
+ ({ANSI_C?}:.ansi={ANSI_C_INCLUDES}) \
+ ({ANSI_C?.c}:.c={C_INCLUDES}) \
+ {INCLUDES?} \
+ -D{NAME} \
+ -D_EM_WSIZE={w} -D_EM_PSIZE={p} \
+ -D_EM_SSIZE={s} -D_EM_LSIZE={l} -D_EM_FSIZE={f} -D_EM_DSIZE={d} \
+ -Vw{w}.{w}i{w}.{w}p{p}.{w}f{f}.{w}s{s}.{s}l{l}.{w}d{d}.{w} \
+ {CC_ALIGN?} \
+ {CEM_F?} {LFLAG?} < >
+ callname acc
+ callname cc
+end
+name pc
+ from .p
+ to .k
+ program {EM}/lib/em_pc
+ mapflag -L PC_F={PC_F?} -L
+# mapflag -s PC_F={PC_F?} -s
+ mapflag -_ PC_F={PC_F?} -U
+ mapflag -w PC_F={PC_F?} -w
+ mapflag -V* PC_F={PC_F?} -V*
+ mapflag -M* PC_F={PC_F?} -M*
+# mapflag -i* PC_F={PC_F?} -i*
+ mapflag -A PC_F={PC_F?} -A
+# mapflag -R PC_F={PC_F?} -R
+ mapflag --* PC_F={PC_F?} -*
+#range checks can only be disabled through comments
+ args \
+ -Vw{w}.{w}i{w}.{w}l{l}.{w}p{p}.{w}f{d}.{w}S{w}.{w} \
+ {PC_F?} < > {SOURCE}
+ prep cond
+ rts .p
+ need .p
+ callname apc
+ callname pc
+end
+name m2
+ from .mod.def
+ to .k
+ program {EM}/lib/em_m2
+ mapflag -I* M2_INCL={M2_INCL?} -I*
+ mapflag -L M2_F={M2_F?} -L
+ mapflag -g M2_F={M2_F?} -g
+ mapflag -w* M2_F={M2_F?} -w*
+ mapflag -W* M2_F={M2_F?} -W*
+ mapflag -_ M2_F={M2_F?} -U
+ mapflag -M* M2_F={M2_F?} -M*
+ mapflag -x M2_F={M2_F?} -x
+ mapflag -Xs M2_F={M2_F?} -s
+ mapflag -V* M2_F={M2_F?} -V*
+ mapflag --* M2_F={M2_F?} -*
+ args \
+ {M2_INCL?} -I{EM}/lib/m2 {M2SYSLIB?} \
+ -Vw{w}.{w}i{w}.{w}p{p}.{w}l{l}.{w}f{f}.{w}d{d}.{w} \
+ {M2_ALIGN?} {M2_F?} < >
+ prep cond
+ rts .mod
+ need .mod
+ callname m2
+end
+name ocm
+ from .ocm
+ to .k
+ program {EM}/lib/em_occam
+ mapflag -L OCM_F={OCM_F?} -L
+ mapflag -V* OCM_F={OCM_F?} -V*
+ args -Vw{w}p{p}l{l} {OCM_F?}
+ stdin
+ stdout
+ rts .ocm
+ need .ocm
+ prep cond
+ callname ocm
+end
+name abc
+ from .b
+ to .k
+ program {EM}/lib/em_bem
+ mapflag -h ABC_F={ABC_F?} -h
+ mapflag -w ABC_F={ABC_F?} -w
+ mapflag -L ABC_F={ABC_F?} -L
+ mapflag -E ABC_F={ABC_F?} -E
+# mapflag -d ABC_F={ABC_F?} -d
+ args -Vw{w}p{p}f{d} {ABC_F?} < > {SOURCE}
+ prep cond
+ rts .b
+ need .b
+ callname abc
+end
+var A68INIT={EM}/lib/em_a68s_init
+name a68s
+ from .8.a68
+ to .k
+ program {EM}/lib/em_a68s{w}{p}
+ mapflag -PA* A68INIT=*
+ args < > {SOURCE}.lst {A68INIT}{w}{p} /dev/null
+ prep cond
+ rts .8
+ need .8
+ callname a68s
+end
+name encode
+ from .e
+ to .k
+ program {EM}/lib/em_encode
+ args <
+ prep cond
+ stdout
+end
+name opt
+ from .k
+ to .m
+ program {EM}/lib/em_opt
+ mapflag -LIB OPT_F={OPT_F?} -L
+ args {OPT_F?} <
+ stdout
+ optimizer
+end
+name ego
+ from .m.ma
+ to .gk
+ program {EM}/lib/em_ego
+ mapflag -EGO-* EGO_F={EGO_F?} -*
+# The following lines are obsolete, but here for backwards compatibility.
+# They should be removed some day.
+ mapflag -IL* EGO_F={EGO_F?} -IL*
+ mapflag -CS* EGO_F={EGO_F?} -CS*
+ mapflag -SR* EGO_F={EGO_F?} -SR*
+ mapflag -UD* EGO_F={EGO_F?} -UD*
+ mapflag -LV* EGO_F={EGO_F?} -LV*
+ mapflag -SA* EGO_F={EGO_F?} -RA*
+ mapflag -SP* EGO_F={EGO_F?} -SP*
+ mapflag -BO* EGO_F={EGO_F?} -BO*
+ mapflag -CJ* EGO_F={EGO_F?} -CJ*
+ mapflag -EV EGO_F={EGO_F?} -V
+# End of obsolete lines
+ mapflag -Q* EGO_F={EGO_F?} -Q*
+ mapflag -T* EGO_F={EGO_F?} -T*
+ mapflag -S* EGO_F={EGO_F?} -S*
+ mapflag -s* EGO_F={EGO_F?} -s*
+ mapflag -a EGO_F={EGO_F?} -a
+ mapflag -O* EGO_F={EGO_F?} -O*
+ args \
+ {EGO_F?} -P {EM}/lib/ego \
+ -M{EM}/lib/ego/{M}descr <
+ optimizer 2
+ stdout
+ combiner
+end
+name opt2
+ # output of the global optimizer is processed by a stripped version
+ # of the em peephole optimizer
+ from .gk
+ to .g
+ program {EM}/lib/em_opt2
+# mapflag -LIB OPT_F={OPT_F?} -L
+ args {OPT_F?} <
+ optimizer
+ stdout
+end
+name decode
+ from .k.m.g.gk
+ to .e
+ program {EM}/lib/em_decode
+ args <
+ stdout
+end
diff --git a/lib/descr/ibm.nosid b/lib/descr/ibm.nosid
new file mode 100644
index 00000000..d334f57b
--- /dev/null
+++ b/lib/descr/ibm.nosid
@@ -0,0 +1,40 @@
+# $Revision$
+var w=2
+var p=2
+var s=2
+var l=4
+var f=4
+var d=8
+var NAME=i8086
+var M=i86
+var LIB=lib/i86/tail_
+var LIBIBM=lib/ibm/tail_
+var RT=lib/i86/head_
+var RTIBM=lib/ibm/head_
+var CPP_F=-Dunix
+var INCLUDES=-I{EM}/include -I{EM}/lib/ibm/include
+name be
+ from .m.g
+ to .s
+ program {EM}/lib/{M}/cg
+ args <
+ stdout
+ need .e
+end
+name asld
+ from .s.a
+ to .out
+ outfile a.out
+ program {EM}/lib/{M}/as
+ mapflag -l* LNAME={EM}/{LIB}*
+ mapflag -i IFILE={EM}/{RT}i
+ args {IFILE?} (.e:{HEAD}={EM}/{RTIBM}em) \
+ ({RTS}:.b.c={EM}/{RT}cc) ({RTS}:.p={EM}/{RT}pc) -o > < \
+ (.p:{TAIL}={EM}/{LIB}pc) \
+ (.b:{TAIL}={EM}/{LIB}bc) \
+ (.b.c:{TAIL}={EM}/{LIB}cc.1s {EM}/{LIB}cc.2g) \
+ (.e:{TAIL}={EM}/{LIBIBM}em) \
+ (.b.c.p:{TAIL}={EM}/{LIBIBM}mon) \
+ (.e:{TAIL}={EM}/{LIBIBM}em.vend)
+ linker
+end
diff --git a/lib/descr/int b/lib/descr/int
new file mode 100644
index 00000000..a4043e7b
--- /dev/null
+++ b/lib/descr/int
@@ -0,0 +1,35 @@
+# $Revision$
+var w=2
+var p=2
+var s=2
+var l=4
+var f=4
+var d=8
+var M=int
+var NAME=int22
+var LIB=lib/int22/tail_
+var RT=lib/int22/head_
+var SIZE_FLAG=-sm
+var CPP_F=-Dunix=unix
+var INCLUDES=-I{EM}/include/_tail_cc -I{EM}/include/_tail_mon
+name asld
+ from .k.m.a.g
+ to .out
+ outfile e.out
+ program {EM}/lib/em_ass
+ mapflag -l* LNAME={EM}/{LIB}*
+ mapflag -+* ASS_F={ASS_F?} -+*
+ mapflag --* ASS_F={ASS_F?} --*
+ mapflag -s* SIZE_FLAG=-s*
+ args {SIZE_FLAG} \
+ ({RTS}:.ocm.b.c={EM}/{RT}cc) \
+ ({RTS}:.mod={EM}/{RT}m2) \
+ ({RTS}:.p={EM}/{RT}pc) -o > < \
+ (.p:{TAIL}={EM}/{LIB}pc) \
+ (.b:{TAIL}={EM}/{LIB}bc) \
+ (.ocm:{TAIL}={EM}/{LIB}ocm) \
+ (.mod:{TAIL}={EM}/{LIB}m2) \
+ (.ocm.b.c:{TAIL}={EM}/{LIB}cc.1s {EM}/{LIB}cc.2g) \
+ (.mod.ocm.b.c.p:{TAIL}={EM}/{LIB}mon)
+ linker
+end
diff --git a/lib/descr/m68k2.macs b/lib/descr/m68k2.macs
new file mode 100644
index 00000000..203e7e31
--- /dev/null
+++ b/lib/descr/m68k2.macs
@@ -0,0 +1,39 @@
+# $Revision$
+var w=2
+var p=4
+var s=2
+var l=4
+var f=4
+var d=8
+var NAME=m68k2
+var M=m68k2
+var LIBDIR=/lib/{M}
+var LIB=lib/{M}/tail_
+var RT=lib/{M}/head_
+var INCLUDES=-I{EM}/include -I/usr/include
+name be
+ from .m.g
+ to .s
+ program {EM}/lib/{M}/cg
+ args <
+ stdout
+ need .e
+end
+name asld
+ from .s.a
+ to .out
+ outfile a.out
+ program {EM}/lib/{M}/as
+ mapflag -l* LNAME={EM}/{LIB}*
+ args (.e:{HEAD}={EM}/{RT}em) \
+({RTS}:.b.c={EM}/{RT}cc) ({RTS}:.p={EM}/{RT}pc) -o > < \
+(.p.c.b:{TAIL}={EM}/{LIBDIR}/sys1.s) (.p:{TAIL}={EM}/{LIBDIR}/sys2.s) \
+(.c:{TAIL}={EM}/{LIBDIR}/write.s) \
+(.p:{TAIL}={EM}/{LIB}pc) \
+(.b:{TAIL}={EM}/{LIB}bc) \
+(.b.c:{TAIL}={EM}/{LIB}cc.1s {EM}/{LIB}cc.2g) \
+(.b.c:{TAIL}={EM}/{LIB}mon {EM}/{LIB}fake) \
+(.e:{TAIL}={EM}/{LIB}em.rt {EM}/{LIB}em.vend)
+ prep cond
+ linker
+end
diff --git a/lib/descr/nascom b/lib/descr/nascom
new file mode 100644
index 00000000..db67d200
--- /dev/null
+++ b/lib/descr/nascom
@@ -0,0 +1,30 @@
+# $Revision$
+var w=1
+var p=2
+var s=1
+var l=2
+var f=4
+var d=8
+var NAME=nascom
+var M=z80a
+var LIB=lib/{M}/tail_
+var RT=lib/{M}/head_
+var INCLUDES=-I{EM}/include -I/usr/include
+name be
+ from .m.g
+ to .s
+ program {EM}/lib/{M}/be
+ args <
+ stdout
+ need .e
+end
+name asld
+ from .s.a
+ to .out
+ outfile a.out
+ program {EM}/lib/z80/as
+ mapflag -l* LNAME={EM}/{LIB}*
+ args (.e:{HEAD}={EM}/{RT}em) ({RTS}:.b.c={EM}/{RT}cc) -o > \
+(.e:{TAIL}={EM}/{LIB}em.1 {EM}/{LIB}em.2)
+ linker
+end
diff --git a/lib/descr/net86 b/lib/descr/net86
new file mode 100644
index 00000000..27097aed
--- /dev/null
+++ b/lib/descr/net86
@@ -0,0 +1,32 @@
+var w=2
+var p=2
+var s=2
+var l=4
+var f=4
+var d=8
+var NAME=i8086
+var M=i86
+var LIB=mach/i86/lib/tail_
+var RT=mach/i86/lib/head_
+var INCLUDES=-I{EM}/include -I/usr/include
+name be
+ from .m
+ to .s
+ program {EM}/lib/{M}_cg
+ args <
+ prop >
+ need .e
+end
+name asld
+ from .s.a
+ to a.out
+ program {EM}/lib/{M}_as
+ mapflag -l* LNAME={EM}/{LIB}*
+ mapflag -i IFILE={EM}/{RT}i
+ args {IFILE?} (.e:{HEAD}={EM}/{RT}em) \
+({RTS}:.c={EM}/{RT}cc) ({RTS}:.p={EM}/{RT}pc) -o > < \
+(.p:{TAIL}={EM}/{LIB}pc) (.c:{TAIL}={EM}/{LIB}cc.1s {EM}/{LIB}cc.2g) \
+(.c.p.e:{TAIL}={EM}/{LIB}netio) (.c.p.e:{TAIL}={EM}/{LIB}alo) \
+(.c.p:{TAIL}={EM}/{LIB}mon) (.e:{TAIL}={EM}/{LIB}em)
+ prop C
+end
diff --git a/lib/descr/sat86 b/lib/descr/sat86
new file mode 100644
index 00000000..ecfa18d8
--- /dev/null
+++ b/lib/descr/sat86
@@ -0,0 +1,34 @@
+var w=2
+var p=2
+var s=2
+var l=4
+var f=4
+var d=8
+var NAME=i8086
+var M=i86
+var LIB=mach/i86/lib/tail_
+var ALIB=mach/i86/lib/sat_tail_
+var RT=mach/i86/lib/head_
+var ART=mach/i86/lib/sat_head_
+var CCP_F=-Dunix
+var INCLUDES=-I{EM}/include -I/usr/include
+name be
+ from .m
+ to .s
+ program {EM}/lib/{M}_cg
+ args <
+ prop >
+ need .e
+end
+name asld
+ from .s.a
+ to a.out
+ program {EM}/lib/{M}_as
+ mapflag -l* LNAME={EM}/{LIB}*
+ args (.e:{HEAD}={EM}/{ART}em) \
+({RTS}:.c={EM}/{RT}cc) ({RTS}:.p={EM}/{RT}pc) -o > < \
+(.p:{TAIL}={EM}/{LIB}pc) (.c:{TAIL}={EM}/{LIB}cc.1s {EM}/{LIB}cc.2g) \
+(.c.p:{TAIL}={EM}/{ALIB}mon) (.c.p.e:{TAIL}={EM}/{LIB}alo) \
+(.e:{TAIL}={EM}/{LIB}em)
+ prop C
+end
diff --git a/lib/minix/include/minix/error.h b/lib/minix/include/minix/error.h
new file mode 100644
index 00000000..302207f2
--- /dev/null
+++ b/lib/minix/include/minix/error.h
@@ -0,0 +1,59 @@
+/* Error codes. They are negative since a few system calls, such as READ, can
+ * either return a positive number indicating success, or an error code.
+ */
+
+#define NERROR 34
+#define OK 0
+#define ERROR -1
+#define EPERM -1
+#define ENOENT -2
+#define ESRCH -3
+#define EINTR -4
+#define EIO -5
+#define ENXIO -6
+#define E2BIG -7
+#define ENOEXEC -8
+#define EBADF -9
+#define ECHILD -10
+#define EAGAIN -11
+#define ENOMEM -12
+#define EACCES -13
+#define EFAULT -14
+#define ENOTBLK -15
+#define EBUSY -16
+#define EEXIST -17
+#define EXDEV -18
+#define ENODEV -19
+#define ENOTDIR -20
+#define EISDIR -21
+#define EINVAL -22
+#define ENFILE -23
+#define EMFILE -24
+#define ENOTTY -25
+#define ETXTBSY -26
+#define EFBIG -27
+#define ENOSPC -28
+#define ESPIPE -29
+#define EROFS -30
+#define EMLINK -31
+#define EPIPE -32
+#define EDOM -33
+#define ERANGE -34
+
+#define E_LOCKED -101
+#define E_BAD_CALL -102
+#define E_LONG_STRING -103
+#define EOF -104 /* End Of File - used by drivers */
+
+/* The following error codes are generated by the kernel itself. */
+#define E_BAD_DEST -1 /* destination address illegal */
+#define E_BAD_SRC -2 /* source address illegal */
+#define E_TRY_AGAIN -3 /* can't send-- tables full */
+#define E_OVERRUN -4 /* interrupt for task that is not waiting */
+#define E_BAD_BUF -5 /* message buf outside caller's addr space */
+#define E_TASK -6 /* can't send to task */
+#define E_NO_MESSAGE -7 /* RECEIVE failed: no message present */
+#define E_NO_PERM -8 /* ordinary users can't send to tasks */
+#define E_BAD_FCN -9 /* only valid fcns are SEND, RECEIVE, BOTH */
+#define E_BAD_ADDR -10 /* bad address given to utility routine */
+#define E_BAD_PROC -11 /* bad proc number given to utility */
diff --git a/lib/minix/include/minix/sgtty.h b/lib/minix/include/minix/sgtty.h
new file mode 100644
index 00000000..302207f2
--- /dev/null
+++ b/lib/minix/include/minix/sgtty.h
@@ -0,0 +1,59 @@
+/* Error codes. They are negative since a few system calls, such as READ, can
+ * either return a positive number indicating success, or an error code.
+ */
+
+#define NERROR 34
+#define OK 0
+#define ERROR -1
+#define EPERM -1
+#define ENOENT -2
+#define ESRCH -3
+#define EINTR -4
+#define EIO -5
+#define ENXIO -6
+#define E2BIG -7
+#define ENOEXEC -8
+#define EBADF -9
+#define ECHILD -10
+#define EAGAIN -11
+#define ENOMEM -12
+#define EACCES -13
+#define EFAULT -14
+#define ENOTBLK -15
+#define EBUSY -16
+#define EEXIST -17
+#define EXDEV -18
+#define ENODEV -19
+#define ENOTDIR -20
+#define EISDIR -21
+#define EINVAL -22
+#define ENFILE -23
+#define EMFILE -24
+#define ENOTTY -25
+#define ETXTBSY -26
+#define EFBIG -27
+#define ENOSPC -28
+#define ESPIPE -29
+#define EROFS -30
+#define EMLINK -31
+#define EPIPE -32
+#define EDOM -33
+#define ERANGE -34
+
+#define E_LOCKED -101
+#define E_BAD_CALL -102
+#define E_LONG_STRING -103
+#define EOF -104 /* End Of File - used by drivers */
+
+/* The following error codes are generated by the kernel itself. */
+#define E_BAD_DEST -1 /* destination address illegal */
+#define E_BAD_SRC -2 /* source address illegal */
+#define E_TRY_AGAIN -3 /* can't send-- tables full */
+#define E_OVERRUN -4 /* interrupt for task that is not waiting */
+#define E_BAD_BUF -5 /* message buf outside caller's addr space */
+#define E_TASK -6 /* can't send to task */
+#define E_NO_MESSAGE -7 /* RECEIVE failed: no message present */
+#define E_NO_PERM -8 /* ordinary users can't send to tasks */
+#define E_BAD_FCN -9 /* only valid fcns are SEND, RECEIVE, BOTH */
+#define E_BAD_ADDR -10 /* bad address given to utility routine */
+#define E_BAD_PROC -11 /* bad proc number given to utility */
diff --git a/lib/minix/include/minix/stat.h b/lib/minix/include/minix/stat.h
new file mode 100644
index 00000000..4c8b018f
--- /dev/null
+++ b/lib/minix/include/minix/stat.h
@@ -0,0 +1,26 @@
+struct stat {
+ short int st_dev;
+ unsigned short st_ino;
+ unsigned short st_mode;
+ short int st_nlink;
+ short int st_uid;
+ short int st_gid;
+ short int st_rdev;
+ long st_size;
+ long st_atime;
+ long st_mtime;
+ long st_ctime;
+};
+
+/* Some common definitions. */
+#define S_IFMT 0170000 /* type of file */
+#define S_IFDIR 0040000 /* directory */
+#define S_IFCHR 0020000 /* character special */
+#define S_IFBLK 0060000 /* block special */
+#define S_IFREG 0100000 /* regular */
+#define S_ISUID 04000 /* set user id on execution */
+#define S_ISGID 02000 /* set group id on execution */
+#define S_ISVTX 01000 /* save swapped text even after use */
+#define S_IREAD 00400 /* read permission, owner */
+#define S_IWRITE 00200 /* write permission, owner */
+#define S_IEXEC 00100 /* execute/search permission, owner */
diff --git a/lib/minix/include/sys/dir.h b/lib/minix/include/sys/dir.h
new file mode 100644
index 00000000..91bb04ac
--- /dev/null
+++ b/lib/minix/include/sys/dir.h
@@ -0,0 +1,17 @@
+/* The
header gives the layout of a directory. */
+
+#ifndef _DIR_H
+#define _DIR_H
+
+#define DIRBLKSIZ 512 /* size of directory block */
+
+#ifndef DIRSIZ
+#define DIRSIZ 14
+#endif
+
+struct direct {
+ ino_t d_ino;
+ char d_name[DIRSIZ];
+};
+
+#endif /* _DIR_H */
diff --git a/lib/minixST/include/minix/callnr.h b/lib/minixST/include/minix/callnr.h
new file mode 100644
index 00000000..9ecc2d95
--- /dev/null
+++ b/lib/minixST/include/minix/callnr.h
@@ -0,0 +1,58 @@
+#define NCALLS 70 /* number of system calls allowed */
+
+#define EXIT 1
+#define FORK 2
+#define READ 3
+#define WRITE 4
+#define OPEN 5
+#define CLOSE 6
+#define WAIT 7
+#define CREAT 8
+#define LINK 9
+#define UNLINK 10
+#define CHDIR 12
+#define TIME 13
+#define MKNOD 14
+#define CHMOD 15
+#define CHOWN 16
+#define BRK 17
+#define STAT 18
+#define LSEEK 19
+#define GETPID 20
+#define MOUNT 21
+#define UMOUNT 22
+#define SETUID 23
+#define GETUID 24
+#define STIME 25
+#define PTRACE 26
+#define ALARM 27
+#define FSTAT 28
+#define PAUSE 29
+#define UTIME 30
+#define ACCESS 33
+#define SYNC 36
+#define KILL 37
+#define RENAME 38
+#define MKDIR 39
+#define RMDIR 40
+#define DUP 41
+#define PIPE 42
+#define TIMES 43
+#define SETGID 46
+#define GETGID 47
+#define SIGNAL 48
+#define IOCTL 54
+#define FCNTL 55
+#define EXEC 59
+#define UMASK 60
+#define CHROOT 61
+
+/* The following are not system calls, but are processed like them. */
+#define KSIG 64 /* kernel detected a signal */
+#define UNPAUSE 65 /* to MM or FS: check for EINTR */
+#define BRK2 66 /* to MM: used to say how big FS & INIT are */
+#define REVIVE 67 /* to FS: revive a sleeping process */
+#define TASK_REPLY 68 /* to FS: reply code from tty task */
+
+/* The following IS a system call for amoeba transactions */
+#define AM_SYSCALL 69
diff --git a/lib/minixST/include/minix/com.h b/lib/minixST/include/minix/com.h
new file mode 100644
index 00000000..2096f8ba
--- /dev/null
+++ b/lib/minixST/include/minix/com.h
@@ -0,0 +1,166 @@
+/* System calls. */
+#define SEND 1 /* function code for sending messages */
+#define RECEIVE 2 /* function code for receiving messages */
+#define BOTH 3 /* function code for SEND + RECEIVE */
+#define ANY (NR_PROCS+100) /* receive(ANY, buf) accepts from any source */
+
+/* Task numbers, function codes and reply codes. */
+
+#define TTY -NR_TASKS /* terminal I/O class */
+# define TTY_READ 3 /* fcn code for reading from tty */
+# define TTY_WRITE 4 /* fcn code for writing to tty */
+# define TTY_IOCTL 5 /* fcn code for ioctl */
+# define TTY_SETPGRP 6 /* fcn code for setpgrp */
+# define TTY_OPEN 7 /* fcn code for opening tty */
+# define TTY_CLOSE 8 /* fcn code for closing tty */
+# define SUSPEND -998 /* used in interrupts when tty has no data */
+
+#ifdef AM_KERNEL
+#define AMOEBA
+#endif
+
+#ifdef AMOEBA
+
+/* There are AM_NTASK copies of the amoeba kernel task.
+ * If you change AM_NTASKS be sure to adjust kernel/table.c and fs/table.c
+ */
+#define AM_NTASKS 4 /* number of kernel tasks of this class */
+
+#define AMINT_CLASS (TTY+1) /* Amoeba event handler */
+#define AMOEBA_CLASS (AMINT_CLASS+AM_NTASKS) /* transaction handlers */
+# define ETHER_ARRIV 1 /* fcn code for packet arrival */
+# define AM_TRANS 2 /* amoeba transaction */
+# define AM_GETREQ 3 /* amoeba getrequest */
+# define AM_PUTREP 4 /* amoeba putrep */
+# define AM_REVIVE 6 /* used by kernel task to revive luser task */
+# define AM_TIMEOUT 8 /* used to talk to clock task */
+# define AM_PUTSIG 9 /* when the luser hits the DEL ! */
+# define AM_TASK_DIED 10 /* sent if task died during a transaction */
+
+#else /* if AMOEBA not defined */
+
+#define AMOEBA_CLASS TTY
+
+#endif /* AMOEBA */
+
+/*
+ * New class definitions should go here and should be defined relative
+ * to AMOEBA_CLASS (ie. as AMOEBA_CLASS+n, for the nth task added).
+ */
+
+#define IDLE (AMOEBA_CLASS+1) /* task to run when there's nothing to run */
+
+#define PRINTER -7 /* printer I/O class */
+/* The printer uses the same commands as TTY. */
+
+#define WINCHESTER -6 /* winchester (hard) disk class */
+#define FLOPPY -5 /* floppy disk class */
+# define DISK_READ 3 /* fcn code to DISK (must equal TTY_READ) */
+# define DISK_WRITE 4 /* fcn code to DISK (must equal TTY_WRITE) */
+# define DISK_IOCTL 5 /* fcn code for setting up RAM disk */
+# define SCATTERED_IO 6 /* fcn code for multiple reads/writes */
+# define OPTIONAL_IO 16 /* modifier to DISK_* codes within vector */
+
+#define MEM -4 /* /dev/ram, /dev/(k)mem and /dev/null class */
+# define RAM_DEV 0 /* minor device for /dev/ram */
+# define MEM_DEV 1 /* minor device for /dev/mem */
+# define KMEM_DEV 2 /* minor device for /dev/kmem */
+# define NULL_DEV 3 /* minor device for /dev/null */
+#if (CHIP == INTEL)
+# define PORT_DEV 4 /* minor device for /dev/port */
+#endif
+
+#define CLOCK -3 /* clock class */
+# define SET_ALARM 1 /* fcn code to CLOCK, set up alarm */
+# define GET_TIME 3 /* fcn code to CLOCK, get real time */
+# define SET_TIME 4 /* fcn code to CLOCK, set real time */
+# define REAL_TIME 1 /* reply from CLOCK: here is real time */
+
+#define SYSTASK -2 /* internal functions */
+# define SYS_XIT 1 /* fcn code for sys_xit(parent, proc) */
+# define SYS_GETSP 2 /* fcn code for sys_sp(proc, &new_sp) */
+# define SYS_SIG 3 /* fcn code for sys_sig(proc, sig) */
+# define SYS_FORK 4 /* fcn code for sys_fork(parent, child) */
+# define SYS_NEWMAP 5 /* fcn code for sys_newmap(procno, map_ptr) */
+# define SYS_COPY 6 /* fcn code for sys_copy(ptr) */
+# define SYS_EXEC 7 /* fcn code for sys_exec(procno, new_sp) */
+# define SYS_TIMES 8 /* fcn code for sys_times(procno, bufptr) */
+# define SYS_ABORT 9 /* fcn code for sys_abort() */
+# define SYS_FRESH 10 /* fcn code for sys_fresh() (Atari only) */
+# define SYS_KILL 11 /* fcn code for sys_kill(proc, sig) */
+# define SYS_GBOOT 12 /* fcn code for sys_gboot(procno, bootptr) */
+# define SYS_UMAP 13 /* fcn code for sys_umap(procno, etc) */
+# define SYS_MEM 14 /* fcn code for sys_mem() */
+# define SYS_TRACE 15 /* fcn code for sys_trace(req,pid,addr,data) */
+
+#define HARDWARE -1 /* used as source on interrupt generated msgs*/
+
+/* Names of message fields for messages to CLOCK task. */
+#define DELTA_TICKS m6_l1 /* alarm interval in clock ticks */
+#define FUNC_TO_CALL m6_f1 /* pointer to function to call */
+#define NEW_TIME m6_l1 /* value to set clock to (SET_TIME) */
+#define CLOCK_PROC_NR m6_i1 /* which proc (or task) wants the alarm? */
+#define SECONDS_LEFT m6_l1 /* how many seconds were remaining */
+
+/* Names of message fields used for messages to block and character tasks. */
+#define DEVICE m2_i1 /* major-minor device */
+#define PROC_NR m2_i2 /* which (proc) wants I/O? */
+#define COUNT m2_i3 /* how many bytes to transfer */
+#define POSITION m2_l1 /* file offset */
+#define ADDRESS m2_p1 /* core buffer address */
+
+/* Names of message fields for messages to TTY task. */
+#define TTY_LINE m2_i1 /* message parameter: terminal line */
+#define TTY_REQUEST m2_i3 /* message parameter: ioctl request code */
+#define TTY_SPEK m2_l1 /* message parameter: ioctl speed, erasing */
+#define TTY_FLAGS m2_l2 /* message parameter: ioctl tty mode */
+#define TTY_PGRP m2_i3 /* message parameter: process group */
+
+/* Names of messages fields used in reply messages from tasks. */
+#define REP_PROC_NR m2_i1 /* # of proc on whose behalf I/O was done */
+#define REP_STATUS m2_i2 /* bytes transferred or error number */
+
+/* Names of fields for copy message to SYSTASK. */
+#define SRC_SPACE m5_c1 /* T or D space (stack is also D) */
+#define SRC_PROC_NR m5_i1 /* process to copy from */
+#define SRC_BUFFER m5_l1 /* virtual address where data come from */
+#define DST_SPACE m5_c2 /* T or D space (stack is also D) */
+#define DST_PROC_NR m5_i2 /* process to copy to */
+#define DST_BUFFER m5_l2 /* virtual address where data go to */
+#define COPY_BYTES m5_l3 /* number of bytes to copy */
+
+/* Field names for accounting, SYSTASK and miscellaneous. */
+#define USER_TIME m4_l1 /* user time consumed by process */
+#define SYSTEM_TIME m4_l2 /* system time consumed by process */
+#define CHILD_UTIME m4_l3 /* user time consumed by process' children */
+#define CHILD_STIME m4_l4 /* sys time consumed by process' children */
+
+#define PROC1 m1_i1 /* indicates a process */
+#define PROC2 m1_i2 /* indicates a process */
+#define PID m1_i3 /* process id passed from MM to kernel */
+#define STACK_PTR m1_p1 /* used for stack ptr in sys_exec, sys_getsp */
+#define PR m6_i1 /* process number for sys_sig */
+#define SIGNUM m6_i2 /* signal number for sys_sig */
+#define FUNC m6_f1 /* function pointer for sys_sig */
+#define MEM_PTR m1_p1 /* tells where memory map is for sys_newmap */
+#define CANCEL 0 /* general request to force a task to cancel */
+#define SIG_MAP m1_i2 /* used by kernel for passing signal bit map */
+
+#ifdef AMOEBA
+
+/* Names of message fields for amoeba tasks */
+#define AM_OP m2_i1 /* one of the above operators */
+#define AM_PROC_NR m2_i2 /* process # of proc doing operation */
+#define AM_COUNT m2_i3 /* size of buffer for operation */
+#define AM_ADDRESS m2_p1 /* address of buffer for operation */
+
+/* For communication between MM and AMOEBA_CLASS kernel tasks */
+#define AM_STATUS m2_i3 /* same use as REP_STATUS but for amoeba */
+#define AM_FREE_IT m2_l1 /* 1=not a getreq, 0=is a getreq */
+
+/* Special for passing a physical address from the ethernet driver */
+#define AM_PADDR m2_l1 /* to the transaction layer */
+
+#endif /* AMOEBA */
+
+#define HARD_INT 2 /* fcn code for all hardware interrupts */
diff --git a/lib/minixST/include/minix/const.h b/lib/minixST/include/minix/const.h
new file mode 100644
index 00000000..77fc6fe4
--- /dev/null
+++ b/lib/minixST/include/minix/const.h
@@ -0,0 +1,88 @@
+/* Copyright (C) 1990 by Prentice-Hall, Inc. Permission is hereby granted
+ * to redistribute the binary and source programs of this system for
+ * educational or research purposes. For other use, written permission from
+ * Prentice-Hall is required.
+ */
+
+#define EXTERN extern /* used in *.h files */
+#define PRIVATE static /* PRIVATE x limits the scope of x */
+#define PUBLIC /* PUBLIC is the opposite of PRIVATE */
+#define FORWARD static /* some compilers require this to be 'static'*/
+
+#define TRUE 1 /* used for turning integers into Booleans */
+#define FALSE 0 /* used for turning integers into Booleans */
+
+#define HZ 60 /* clock freq (software settable on IBM-PC) */
+#define BLOCK_SIZE 1024 /* # bytes in a disk block */
+#define SUPER_USER (uid_t) 0 /* uid_t of superuser */
+
+#define MAJOR 8 /* major device = (dev>>MAJOR) & 0377 */
+#define MINOR 0 /* minor device = (dev>>MINOR) & 0377 */
+
+#ifdef AM_KERNEL
+#define NR_TASKS 14 /* must be 5 more than without amoeba */
+#else
+#define NR_TASKS 9 /* number of tasks in the transfer vector */
+#endif
+
+#define NR_PROCS 32 /* number of slots in proc table */
+#define NR_SEGS 3 /* # segments per process */
+#define T 0 /* proc[i].mem_map[T] is for text */
+#define D 1 /* proc[i].mem_map[D] is for data */
+#define S 2 /* proc[i].mem_map[S] is for stack */
+
+#define MAX_P_LONG 2147483647 /* maximum positive long, i.e. 2**31 - 1 */
+
+/* Memory is allocated in clicks. */
+#if (CHIP == INTEL) || (CHIP == M68000)
+#define CLICK_SIZE 256 /* unit in which memory is allocated */
+#define CLICK_SHIFT 8 /* log2 of CLICK_SIZE */
+#endif
+
+#define click_to_round_k(n) \
+ ((unsigned) ((((unsigned long) (n) << CLICK_SHIFT) + 512) / 1024))
+#if CLICK_SIZE < 1024
+#define k_to_click(n) ((n) * (1024 / CLICK_SIZE))
+#else
+#define k_to_click(n) ((n) / (CLICK_SIZE / 1024))
+#endif
+
+/* Process numbers of some important processes */
+#define MM_PROC_NR 0 /* process number of memory manager */
+#define FS_PROC_NR 1 /* process number of file system */
+#define INIT_PROC_NR 2 /* init -- the process that goes multiuser */
+#define LOW_USER 2 /* first user not part of operating system */
+
+/* Miscellaneous */
+#define BYTE 0377 /* mask for 8 bits */
+#define TO_USER 0 /* flag telling to copy from fs to user */
+#define FROM_USER 1 /* flag telling to copy from user to fs */
+#define READING 0 /* copy data to user */
+#define WRITING 1 /* copy data from user */
+
+#if (MACHINE != ATARI)
+#define ABS -999 /* this process means absolute memory */
+#endif
+
+#define WORD_SIZE 2 /* number of bytes per word */
+
+#define NIL_PTR (char *) 0 /* generally useful expression */
+
+#define NO_NUM 0x8000 /* used as numerical argument to panic() */
+#define SIG_PUSH_BYTES (4*sizeof(int)) /* how many bytes pushed by signal */
+
+/* Flag bits for i_mode in the inode. */
+#define I_TYPE 0170000 /* this field gives inode type */
+#define I_REGULAR 0100000 /* regular file, not dir or special */
+#define I_BLOCK_SPECIAL 0060000 /* block special file */
+#define I_DIRECTORY 0040000 /* file is a directory */
+#define I_CHAR_SPECIAL 0020000 /* character special file */
+#define I_NAMED_PIPE 0010000 /* named pipe (FIFO) */
+#define I_SET_UID_BIT 0004000 /* set effective uid_t on exec */
+#define I_SET_GID_BIT 0002000 /* set effective gid_t on exec */
+#define ALL_MODES 0006777 /* all bits for user, group and others */
+#define RWX_MODES 0000777 /* mode bits for RWX only */
+#define R_BIT 0000004 /* Rwx protection bit */
+#define W_BIT 0000002 /* rWx protection bit */
+#define X_BIT 0000001 /* rwX protection bit */
+#define I_NOT_ALLOC 0000000 /* this inode is free */
diff --git a/lib/minixST/include/minix/error.h b/lib/minixST/include/minix/error.h
new file mode 100644
index 00000000..302207f2
--- /dev/null
+++ b/lib/minixST/include/minix/error.h
@@ -0,0 +1,59 @@
+/* Error codes. They are negative since a few system calls, such as READ, can
+ * either return a positive number indicating success, or an error code.
+ */
+
+#define NERROR 34
+#define OK 0
+#define ERROR -1
+#define EPERM -1
+#define ENOENT -2
+#define ESRCH -3
+#define EINTR -4
+#define EIO -5
+#define ENXIO -6
+#define E2BIG -7
+#define ENOEXEC -8
+#define EBADF -9
+#define ECHILD -10
+#define EAGAIN -11
+#define ENOMEM -12
+#define EACCES -13
+#define EFAULT -14
+#define ENOTBLK -15
+#define EBUSY -16
+#define EEXIST -17
+#define EXDEV -18
+#define ENODEV -19
+#define ENOTDIR -20
+#define EISDIR -21
+#define EINVAL -22
+#define ENFILE -23
+#define EMFILE -24
+#define ENOTTY -25
+#define ETXTBSY -26
+#define EFBIG -27
+#define ENOSPC -28
+#define ESPIPE -29
+#define EROFS -30
+#define EMLINK -31
+#define EPIPE -32
+#define EDOM -33
+#define ERANGE -34
+
+#define E_LOCKED -101
+#define E_BAD_CALL -102
+#define E_LONG_STRING -103
+#define EOF -104 /* End Of File - used by drivers */
+
+/* The following error codes are generated by the kernel itself. */
+#define E_BAD_DEST -1 /* destination address illegal */
+#define E_BAD_SRC -2 /* source address illegal */
+#define E_TRY_AGAIN -3 /* can't send-- tables full */
+#define E_OVERRUN -4 /* interrupt for task that is not waiting */
+#define E_BAD_BUF -5 /* message buf outside caller's addr space */
+#define E_TASK -6 /* can't send to task */
+#define E_NO_MESSAGE -7 /* RECEIVE failed: no message present */
+#define E_NO_PERM -8 /* ordinary users can't send to tasks */
+#define E_BAD_FCN -9 /* only valid fcns are SEND, RECEIVE, BOTH */
+#define E_BAD_ADDR -10 /* bad address given to utility routine */
+#define E_BAD_PROC -11 /* bad proc number given to utility */
diff --git a/lib/minixST/include/minix/stat.h b/lib/minixST/include/minix/stat.h
new file mode 100644
index 00000000..4c8b018f
--- /dev/null
+++ b/lib/minixST/include/minix/stat.h
@@ -0,0 +1,26 @@
+struct stat {
+ short int st_dev;
+ unsigned short st_ino;
+ unsigned short st_mode;
+ short int st_nlink;
+ short int st_uid;
+ short int st_gid;
+ short int st_rdev;
+ long st_size;
+ long st_atime;
+ long st_mtime;
+ long st_ctime;
+};
+
+/* Some common definitions. */
+#define S_IFMT 0170000 /* type of file */
+#define S_IFDIR 0040000 /* directory */
+#define S_IFCHR 0020000 /* character special */
+#define S_IFBLK 0060000 /* block special */
+#define S_IFREG 0100000 /* regular */
+#define S_ISUID 04000 /* set user id on execution */
+#define S_ISGID 02000 /* set group id on execution */
+#define S_ISVTX 01000 /* save swapped text even after use */
+#define S_IREAD 00400 /* read permission, owner */
+#define S_IWRITE 00200 /* write permission, owner */
+#define S_IEXEC 00100 /* execute/search permission, owner */
diff --git a/lib/minixST/include/minix/type.h b/lib/minixST/include/minix/type.h
new file mode 100644
index 00000000..0669ceca
--- /dev/null
+++ b/lib/minixST/include/minix/type.h
@@ -0,0 +1,134 @@
+#ifndef _TYPE_H
+#define _TYPE_H
+/* Macros */
+#define MAX(a,b) ((a) > (b) ? (a) : (b))
+#define MIN(a,b) ((a) < (b) ? (a) : (b))
+
+/* Type definitions */
+typedef unsigned short unshort; /* must be 16-bit unsigned */
+typedef unshort block_nr; /* block number */
+typedef unshort zone_nr; /* zone number */
+
+#define MAX_BLOCK_NR ((block_nr) 0177777) /* largest block number */
+#define HIGHEST_ZONE ((zone_nr) 0177777) /* largest zone number */
+#define MAX_INODE_NR ((ino_t 0177777) /* largest inode number */
+#define MAX_FILE_POS 017777777777L /* largest legal file offset */
+
+#define NO_BLOCK ((block_nr) 0) /* absence of a block number */
+#define NO_ENTRY ((ino_t) 0) /* absence of a dir entry */
+#define NO_ZONE ((zone_nr) 0) /* absence of a zone number */
+#define NO_DEV ((dev_t) ~0) /* absence of a device numb */
+
+typedef unshort bit_nr; /* if ino_t & zone_nr both unshort,
+ then also unshort, else long */
+typedef long zone_type; /* zone size */
+
+#if (CHIP == INTEL)
+typedef unsigned vir_bytes; /* virtual addresses and lengths in bytes */
+#endif
+
+#if (CHIP == M68000)
+typedef long vir_bytes; /* virtual addresses and lengths in bytes */
+#endif
+
+typedef unsigned vir_clicks; /* virtual addresses and lengths in clicks */
+typedef long phys_bytes; /* physical addresses and lengths in bytes */
+typedef unsigned phys_clicks; /* physical addresses and lengths in clicks */
+typedef int signed_clicks; /* same length as phys_clicks, but signed */
+
+/* Types relating to messages. */
+#define M1 1
+#define M3 3
+#define M4 4
+#define M3_STRING 14
+
+typedef struct {int m1i1, m1i2, m1i3; char *m1p1, *m1p2, *m1p3;} mess_1;
+typedef struct {int m2i1, m2i2, m2i3; long m2l1, m2l2; char *m2p1;} mess_2;
+typedef struct {int m3i1, m3i2; char *m3p1; char m3ca1[M3_STRING];} mess_3;
+typedef struct {long m4l1, m4l2, m4l3, m4l4;} mess_4;
+typedef struct {char m5c1, m5c2; int m5i1, m5i2; long m5l1, m5l2, m5l3;} mess_5;
+#if _ANSI
+typedef struct {int m6i1, m6i2, m6i3; long m6l1; void (*m6f1)(int);} mess_6;
+#else
+typedef struct {int m6i1, m6i2, m6i3; long m6l1; void (*m6f1)();} mess_6;
+#endif
+
+typedef struct {
+ int m_source; /* who sent the message */
+ int m_type; /* what kind of message is it */
+ union {
+ mess_1 m_m1;
+ mess_2 m_m2;
+ mess_3 m_m3;
+ mess_4 m_m4;
+ mess_5 m_m5;
+ mess_6 m_m6;
+ } m_u;
+} message;
+
+#define MESS_SIZE (sizeof(message))
+#define NIL_MESS (message *) 0
+
+/* The following defines provide names for useful members. */
+#define m1_i1 m_u.m_m1.m1i1
+#define m1_i2 m_u.m_m1.m1i2
+#define m1_i3 m_u.m_m1.m1i3
+#define m1_p1 m_u.m_m1.m1p1
+#define m1_p2 m_u.m_m1.m1p2
+#define m1_p3 m_u.m_m1.m1p3
+
+#define m2_i1 m_u.m_m2.m2i1
+#define m2_i2 m_u.m_m2.m2i2
+#define m2_i3 m_u.m_m2.m2i3
+#define m2_l1 m_u.m_m2.m2l1
+#define m2_l2 m_u.m_m2.m2l2
+#define m2_p1 m_u.m_m2.m2p1
+
+#define m3_i1 m_u.m_m3.m3i1
+#define m3_i2 m_u.m_m3.m3i2
+#define m3_p1 m_u.m_m3.m3p1
+#define m3_ca1 m_u.m_m3.m3ca1
+
+
+#define m4_l1 m_u.m_m4.m4l1
+#define m4_l2 m_u.m_m4.m4l2
+#define m4_l3 m_u.m_m4.m4l3
+#define m4_l4 m_u.m_m4.m4l4
+
+#define m5_c1 m_u.m_m5.m5c1
+#define m5_c2 m_u.m_m5.m5c2
+#define m5_i1 m_u.m_m5.m5i1
+#define m5_i2 m_u.m_m5.m5i2
+#define m5_l1 m_u.m_m5.m5l1
+#define m5_l2 m_u.m_m5.m5l2
+#define m5_l3 m_u.m_m5.m5l3
+
+#define m6_i1 m_u.m_m6.m6i1
+#define m6_i2 m_u.m_m6.m6i2
+#define m6_i3 m_u.m_m6.m6i3
+#define m6_l1 m_u.m_m6.m6l1
+#define m6_f1 m_u.m_m6.m6f1
+
+struct mem_map {
+ vir_clicks mem_vir; /* virtual address */
+ phys_clicks mem_phys; /* physical address */
+ vir_clicks mem_len; /* length */
+};
+
+struct copy_info { /* used by sys_copy(src, dst, bytes) */
+ int cp_src_proc;
+ int cp_src_space;
+ vir_bytes cp_src_vir;
+ int cp_dst_proc;
+ int cp_dst_space;
+ vir_bytes cp_dst_vir;
+ vir_bytes cp_bytes;
+};
+
+struct iorequest_s {
+ long io_position; /* position in device file (really off_t) */
+ char *io_buf; /* buffer in user space */
+ unsigned short io_nbytes; /* size of request */
+ unsigned short io_request; /* read, write (optionally) */
+};
+#endif /* _TYPE_H */
diff --git a/lib/vax4/descr.src b/lib/vax4/descr.src
new file mode 100644
index 00000000..57673217
--- /dev/null
+++ b/lib/vax4/descr.src
@@ -0,0 +1,74 @@
+# $Revision$
+var w=4
+var p=4
+var s=2
+var l=4
+var f=4
+var d=8
+var NAME=vax4
+var M=vax4
+var LIB=lib/{M}/tail_
+var RT=lib/{M}/head_
+var CPP_F=-Dunix -Dvax
+var CC_ALIGN=-Vw4.1
+# 413 align is the default, rom in text
+var ALIGN=-a0:4 -a1:4 -a2:0x400 -a3:4
+var C_LIB={EM}/{LIB}cc.1s {EM}/{LIB}cc.2g
+var OLD_C_LIB={C_LIB}
+name be
+ from .m.g
+ to .s
+ program {EM}/lib/{M}/cg
+ args <
+ stdout
+ need .e
+end
+name asopt
+ from .s
+ to .so
+ program {EM}/lib/{M}/top
+ args
+ optimizer
+ stdin
+ stdout
+end
+name as
+ from .s.so
+ to .o
+ program {EM}/lib/{M}/as
+ args - -o > <
+ prep cond
+end
+name led
+ from .o.a
+ to .out
+ program {EM}/lib/em_led
+ mapflag -l* LNAME={EM}/{LIB}*
+ mapflag -N ALIGN=-a0:4 -a1:4 -a2:4 -a3:4
+ mapflag -r ALIGN=-a0:4 -a1:0x400 -a2:4 -a3:4
+ mapflag -ansi C_LIB={EM}/{LIB}ac
+ args {ALIGN} (.e:{HEAD}= {EM}/{RT}em) \
+ ({RTS}:.ocm.b={EM}/{RT}cc) \
+ ({RTS}{ANSI?}:.c={EM}/{RT}cc) \
+ ({RTS}{ANSI?}:.cansi={EM}/{RT}ac) \
+ ({RTS}:.mod={EM}/{RT}m2) \
+ ({RTS}:.p.8={EM}/{RT}pc) \
+ -o > < \
+ (.8:{TAIL}={EM}/{LIB}a68s) \
+ (.p.8:{TAIL}={EM}/{LIB}pc) \
+ (.b:{TAIL}={EM}/{LIB}bc) \
+ (.ocm:{TAIL}={EM}/{LIB}ocm) \
+ (.mod:{TAIL}={EM}/{LIB}m2) \
+ (.ocm.b:{TAIL}={OLD_C_LIB}) \
+ (.c:{TAIL}={C_LIB}) \
+ (.e:{TAIL}={EM}/{LIB}em {EM}/{LIB}mon {EM}/lib/{M}/end_em)
+ linker
+end
+name cv
+ from .out
+ to .cv
+ program {EM}/lib/{M}/cv
+ mapflag -n CV_ARG=-n
+ args {CV_ARG?} < >
+ outfile a.out
+end
diff --git a/lib/vax4/sedf b/lib/vax4/sedf
new file mode 100644
index 00000000..b26db01c
--- /dev/null
+++ b/lib/vax4/sedf
@@ -0,0 +1,104 @@
+# $Header$
+/movab/ {
+s/movab 1(\(.*\)),\1$/incl \1/
+s/movab -1(\(.*\)),\1$/decl \1/
+s/movab \([0-9]*\)(\(.*\)),\2$/addl2 $\1,\2/
+s/movab -\([0-9]*\)(\(.*\)),\2$/subl2 $\1,\2/
+s/movab 0(\(.*\)) \[\(.*\)\],\1$/addl2 \2,\1/
+s/movab 0(\(.*\)) \[\(.*\)\],\2$/addl2 \1,\2/
+}
+/$0/ {
+s/movz[bw]\([wl]\) $0,/clr\1 /
+s/mov\([bwl]\) $0,/clr\1 /
+s/cvt[bw]\([wl]\) $0,/clr\1 /
+}
+/add/ {
+s/\(add[fdlw]\)3 \(.*\),\(.*\),\3$/\12 \2,\3/
+s/\(add[fdlw]\)3 \(.*\),\(.*\),\2$/\12 \3,\2/
+s/add\([wl]\)2 \$-\([0-9]*\),/sub\12 $\2,/
+s/add\([wl]\)3 \$-\([0-9]*\),/sub\13 $\2,/
+s/add\([wl]\)3 \(.*\),\$-\([0-9]*\),/sub\13 $\3,\2,/
+}
+/mul/ {
+s/\(mul[fdlw]\)3 \(.*\),\(.*\),\3$/\12 \2,\3/
+s/\(mul[fdlw]\)3 \(.*\),\(.*\),\2$/\12 \3,\2/
+}
+/sub/ {
+s/\(sub[fdlw]\)3 \(.*\),\(.*\),\3$/\12 \2,\3/
+s/sub\([wl]\)2 \$-\([0-9]*\),/add\12 $\2,/
+s/sub\([wl]\)3 \$-\([0-9]*\),/add\13 $\2,/
+}
+/div/s/\(div[fdlw]\)3 \(.*\),\(.*\),\3$/\12 \2,\3/
+/bi/s/\(bi[cs][lw]\)3 \(.*\),\(.*\),\3$/\12 \2,\3/
+/bis/s/\(bis[lw]\)3 \(.*\),\(.*\),\2$/\12 \3,\2/
+/xor/ {
+s/\(xor[lw]\)3 \(.*\),\(.*\),\3$/\12 \2,\3/
+s/\(xor[lw]\)3 \(.*\),\(.*\),\2$/\12 \3,\2/
+}
+/$1/ {
+s/add\([wl]\)2 \$1,/inc\1 /
+s/sub\([wl]\)2 \$1,/dec\1 /
+}
+/$-1/ {
+s/add\([wl]\)2 \$-1,/dec\1 /
+s/sub\([wl]\)2 \$-1,/inc\1 /
+}
+/cmp[bwl].*$0/ {
+N
+s/cmp\([bwl]\) \(.*\),$0$/tst\1 \2/
+s/cmp\([bwl]\) $0,\(.*\)\njneq/tst\1 \2\
+jneq/
+s/cmp\([bwl]\) $0,\(.*\)\njeql/tst\1 \2\
+jeql/
+s/cmp\([bwl]\) $0,\(.*\)\njgtr/tst\1 \2\
+jlss/
+s/cmp\([bwl]\) $0,\(.*\)\njlss/tst\1 \2\
+jgtr/
+s/cmp\([bwl]\) $0,\(.*\)\njgeq/tst\1 \2\
+jleq/
+s/cmp\([bwl]\) $0,\(.*\)\njleq/tst\1 \2\
+jgeq/
+P
+D
+}
+/(sp)+/ {
+N
+s/movl (sp)+,\(.*\)\npushl \1$/movl (sp),\1/
+s/tst[wl] (sp)+\nmovl fp,sp$/movl fp,sp/
+s/tst\([wl]\) (sp)+\nmov\1 \(.*\),-(sp)/mov\1 \2,(sp)/
+s/tst\([wl]\) (sp)+\nclr\1 -(sp)/clr\1 (sp)/
+s/tst\([wl]\) (sp)+\nmovzb\1 \(.*\),-(sp)/movzb\1 \2,(sp)/
+s/tst\([wl]\) (sp)+\ncvtb\1 \(.*\),-(sp)/cvtb\1 \2,(sp)/
+s/tst\([wl]\) (sp)+\ntst\1 \(.*\)$/mov\1 \2,(sp)+/
+s/tstl (sp)+\npushl \(.*\)$/movl \1,(sp)/
+s/tstl (sp)+\npusha\([bwlq]\) \(.*\)$/mova\1 \2,(sp)/
+P
+D
+}
+/^addl2 .*,sp/ {
+N
+s/addl2 .*,sp\nmovl fp,sp$/movl fp,sp/
+s/^addl2 $6,sp\nmovw \(.*\),-(sp)/tstl (sp)+\
+movw \1,(sp)/
+s/^addl2 $6,sp\nclrw -(sp)/tstl (sp)+\
+clrw (sp)/
+s/^addl2 $8,sp\nmovq \(.*\),-(sp)/movq \1,(sp)/
+P
+D
+}
+/clrw -(sp)/ {
+N
+s/clrw -(sp)\nmovw \($[0-9]*\),-(sp)/pushl \1/
+s/clrw -(sp)\nmnegw $\([0-9]*\),-(sp)/movzwl $-\1,-(sp)/
+s/clrw -(sp)\nmovw \(.*\),-(sp)/movzwl \1,-(sp)/
+s/clrw -(sp)\ncvtbw \(\$[0-9]*\),-(sp)/pushl \1/
+s/clrw -(sp)\ncvtbw \(\$.*\),-(sp)/movzwl \1,-(sp)/
+P
+D
+}
+/mov/ {
+N
+s/mov\([wl]\) \(.*\),\(.*\)\ntst\1 \3$/mov\1 \2,\3/
+P
+D
+}
diff --git a/mach/6500/as/Makefile b/mach/6500/as/Makefile
new file mode 100644
index 00000000..7455a482
--- /dev/null
+++ b/mach/6500/as/Makefile
@@ -0,0 +1,67 @@
+# $Header$
+EMHOME = ../../..
+h = $(EMHOME)/h
+LIBOBJ = $(EMHOME)/modules/lib/libobject.a
+CDIR = $(EMHOME)/mach/proto/as
+CPP = $(EMHOME)/lib/cpp
+DEF =
+
+FFLAG =
+INCL = -I. -I$h $(DEF)
+CFLAGS = $(FFLAG) -O $(INCL)
+YFLAGS = -d
+LDFLAGS = $(FFLAG)
+
+CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
+ $(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
+COBJ = comm3.o comm4.o comm5.o \
+ comm6.o comm7.o comm8.o
+MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
+COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
+
+all: as
+
+install:all
+ ../../install as
+
+cmp:
+ -../../compare as
+
+clean:
+ rm -f *.o as as.[cy] y.tab.h
+
+pr: $(MACH)
+ @pr -n $(MACH)
+
+opr:
+ make pr | opr
+as: $(COBJ) as.o
+ $(CC) $(LDFLAGS) $(COBJ) as.o $(LIBOBJ) -o as
+
+as.y: $(CDIR)/comm2.y
+ $(CPP) -P -I. -I$h $(DEF) $(CDIR)/comm2.y >as.y
+ -@if test -f Expect ; then cat Expect ; else echo "expect 1 shift/reduce conflict"; fi
+
+lint: $(CSRC) as.c
+ lint $(INCL) $(CSRC) as.c
+
+y.tab.h: as.c
+$(COBJ): y.tab.h
+$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
+$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
+as.y: mach2.c
+comm3.o: mach3.c
+as.y: mach4.c
+comm8.o: mach5.c
+comm3.o: $(CDIR)/comm3.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm3.c
+comm4.o: $(CDIR)/comm4.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm4.c
+comm5.o: $(CDIR)/comm5.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm5.c
+comm6.o: $(CDIR)/comm6.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm6.c
+comm7.o: $(CDIR)/comm7.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm7.c
+comm8.o: $(CDIR)/comm8.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm8.c
diff --git a/mach/6500/cg/Makefile b/mach/6500/cg/Makefile
new file mode 100644
index 00000000..22f5f603
--- /dev/null
+++ b/mach/6500/cg/Makefile
@@ -0,0 +1,184 @@
+# $Header$
+
+EMHOME=../../..
+PREFLAGS=-I$(EMHOME)/h -I. -I$(EMHOME)/mach -I$(EMHOME)/modules/h -DNDEBUG
+PFLAGS=
+CFLAGS=$(PREFLAGS) $(PFLAGS) -O
+LDFLAGS=$(PFLAGS)
+LINTOPTS=-hbxac
+LIBS=$(EMHOME)/lib/em_data.a $(EMHOME)/modules/lib/libflt.a
+CDIR=$(EMHOME)/mach/proto/cg
+CFILES=$(CDIR)/codegen.c $(CDIR)/compute.c $(CDIR)/equiv.c $(CDIR)/fillem.c \
+ $(CDIR)/gencode.c $(CDIR)/glosym.c $(CDIR)/main.c $(CDIR)/move.c \
+ $(CDIR)/nextem.c $(CDIR)/reg.c $(CDIR)/regvar.c $(CDIR)/salloc.c \
+ $(CDIR)/state.c $(CDIR)/subr.c $(CDIR)/var.c
+OFILES=codegen.o compute.o equiv.o fillem.o gencode.o glosym.o main.o\
+ move.o nextem.o reg.o regvar.o salloc.o state.o subr.o var.o
+
+all: tables.c
+ make "EMHOME="$(EMHOME) cg
+
+cg: tables.o $(OFILES)
+ $(CC) $(LDFLAGS) $(OFILES) tables.o $(LIBS) -o cg
+
+tables.o: tables.c
+ $(CC) -c $(PREFLAGS) -I$(CDIR) tables.c
+
+codegen.o: $(CDIR)/codegen.c
+ $(CC) -c $(CFLAGS) $(CDIR)/codegen.c
+compute.o: $(CDIR)/compute.c
+ $(CC) -c $(CFLAGS) $(CDIR)/compute.c
+equiv.o: $(CDIR)/equiv.c
+ $(CC) -c $(CFLAGS) $(CDIR)/equiv.c
+fillem.o: $(CDIR)/fillem.c
+ $(CC) -c $(CFLAGS) $(CDIR)/fillem.c
+gencode.o: $(CDIR)/gencode.c
+ $(CC) -c $(CFLAGS) $(CDIR)/gencode.c
+glosym.o: $(CDIR)/glosym.c
+ $(CC) -c $(CFLAGS) $(CDIR)/glosym.c
+main.o: $(CDIR)/main.c
+ $(CC) -c $(CFLAGS) $(CDIR)/main.c
+move.o: $(CDIR)/move.c
+ $(CC) -c $(CFLAGS) $(CDIR)/move.c
+nextem.o: $(CDIR)/nextem.c
+ $(CC) -c $(CFLAGS) $(CDIR)/nextem.c
+reg.o: $(CDIR)/reg.c
+ $(CC) -c $(CFLAGS) $(CDIR)/reg.c
+regvar.o: $(CDIR)/regvar.c
+ $(CC) -c $(CFLAGS) $(CDIR)/regvar.c
+salloc.o: $(CDIR)/salloc.c
+ $(CC) -c $(CFLAGS) $(CDIR)/salloc.c
+state.o: $(CDIR)/state.c
+ $(CC) -c $(CFLAGS) $(CDIR)/state.c
+subr.o: $(CDIR)/subr.c
+ $(CC) -c $(CFLAGS) $(CDIR)/subr.c
+var.o: $(CDIR)/var.c
+ $(CC) -c $(CFLAGS) $(CDIR)/var.c
+
+install: all
+ ../../install cg
+
+cmp: all
+ -../../compare cg
+
+distr: tables.c
+ rm -f tables1.[ch]
+ cp tables.c tables1.c
+ cp tables.h tables1.h
+ chmod -w tables1.[ch]
+
+
+tables.c: table
+ -mv tables.h tables.h.save
+ $(EMHOME)/lib/cpp -P table | $(EMHOME)/lib/cgg > debug.out
+ -if cmp -s tables.h.save tables.h; then mv tables.h.save tables.h; else exit 0; fi
+ -if cmp -s /dev/null tables.h; then mv tables.h.save tables.h; else exit 0; fi
+
+lint: $(CFILES)
+ lint $(LINTOPTS) $(PREFLAGS) $(CFILES)
+clean:
+ rm -f *.o tables.c tables.h debug.out cg tables.h.save
+
+codegen.o: $(CDIR)/assert.h
+codegen.o: $(CDIR)/data.h
+codegen.o: $(CDIR)/equiv.h
+codegen.o: $(CDIR)/extern.h
+codegen.o: $(CDIR)/param.h
+codegen.o: $(CDIR)/result.h
+codegen.o: $(CDIR)/state.h
+codegen.o: tables.h
+codegen.o: $(CDIR)/types.h
+compute.o: $(CDIR)/assert.h
+compute.o: $(CDIR)/data.h
+compute.o: $(CDIR)/extern.h
+compute.o: $(CDIR)/glosym.h
+compute.o: $(CDIR)/param.h
+compute.o: $(CDIR)/result.h
+compute.o: tables.h
+compute.o: $(CDIR)/types.h
+equiv.o: $(CDIR)/assert.h
+equiv.o: $(CDIR)/data.h
+equiv.o: $(CDIR)/equiv.h
+equiv.o: $(CDIR)/extern.h
+equiv.o: $(CDIR)/param.h
+equiv.o: $(CDIR)/result.h
+equiv.o: tables.h
+equiv.o: $(CDIR)/types.h
+fillem.o: $(CDIR)/assert.h
+fillem.o: $(CDIR)/data.h
+fillem.o: $(CDIR)/extern.h
+fillem.o: mach.c
+fillem.o: mach.h
+fillem.o: $(CDIR)/param.h
+fillem.o: $(CDIR)/regvar.h
+fillem.o: $(CDIR)/result.h
+fillem.o: tables.h
+fillem.o: $(CDIR)/types.h
+gencode.o: $(CDIR)/assert.h
+gencode.o: $(CDIR)/data.h
+gencode.o: $(CDIR)/extern.h
+gencode.o: $(CDIR)/param.h
+gencode.o: $(CDIR)/result.h
+gencode.o: tables.h
+gencode.o: $(CDIR)/types.h
+glosym.o: $(CDIR)/glosym.h
+glosym.o: $(CDIR)/param.h
+glosym.o: tables.h
+glosym.o: $(CDIR)/types.h
+main.o: $(CDIR)/param.h
+move.o: $(CDIR)/assert.h
+move.o: $(CDIR)/data.h
+move.o: $(CDIR)/extern.h
+move.o: $(CDIR)/param.h
+move.o: $(CDIR)/result.h
+move.o: tables.h
+move.o: $(CDIR)/types.h
+nextem.o: $(CDIR)/assert.h
+nextem.o: $(CDIR)/data.h
+nextem.o: $(CDIR)/extern.h
+nextem.o: $(CDIR)/param.h
+nextem.o: $(CDIR)/result.h
+nextem.o: tables.h
+nextem.o: $(CDIR)/types.h
+reg.o: $(CDIR)/assert.h
+reg.o: $(CDIR)/data.h
+reg.o: $(CDIR)/extern.h
+reg.o: $(CDIR)/param.h
+reg.o: $(CDIR)/result.h
+reg.o: tables.h
+reg.o: $(CDIR)/types.h
+regvar.o: $(CDIR)/assert.h
+regvar.o: $(CDIR)/data.h
+regvar.o: $(CDIR)/extern.h
+regvar.o: $(CDIR)/param.h
+regvar.o: $(CDIR)/regvar.h
+regvar.o: $(CDIR)/result.h
+regvar.o: tables.h
+regvar.o: $(CDIR)/types.h
+salloc.o: $(CDIR)/assert.h
+salloc.o: $(CDIR)/data.h
+salloc.o: $(CDIR)/extern.h
+salloc.o: $(CDIR)/param.h
+salloc.o: $(CDIR)/result.h
+salloc.o: tables.h
+salloc.o: $(CDIR)/types.h
+state.o: $(CDIR)/assert.h
+state.o: $(CDIR)/data.h
+state.o: $(CDIR)/extern.h
+state.o: $(CDIR)/param.h
+state.o: $(CDIR)/result.h
+state.o: $(CDIR)/state.h
+state.o: tables.h
+state.o: $(CDIR)/types.h
+subr.o: $(CDIR)/assert.h
+subr.o: $(CDIR)/data.h
+subr.o: $(CDIR)/extern.h
+subr.o: $(CDIR)/param.h
+subr.o: $(CDIR)/result.h
+subr.o: tables.h
+subr.o: $(CDIR)/types.h
+var.o: $(CDIR)/data.h
+var.o: $(CDIR)/param.h
+var.o: $(CDIR)/result.h
+var.o: tables.h
+var.o: $(CDIR)/types.h
diff --git a/mach/6500/dl/Makefile b/mach/6500/dl/Makefile
new file mode 100644
index 00000000..d1b1ba84
--- /dev/null
+++ b/mach/6500/dl/Makefile
@@ -0,0 +1,20 @@
+EMHOME=../../..
+CFLAGS=-O -I$(EMHOME)/h
+
+dl: dl.o
+ $(CC) -o dl dl.o $(EMHOME)/modules/lib/libobject.a
+
+install: dl
+ ../../install dl
+
+cmp: dl
+ -../../compare dl
+
+opr:
+ make pr | opr
+
+pr:
+ @pr `pwd`/dl.c
+
+clean:
+ -rm -f *.o *.old dl
diff --git a/mach/6500/libem/Makefile b/mach/6500/libem/Makefile
new file mode 100644
index 00000000..42daff56
--- /dev/null
+++ b/mach/6500/libem/Makefile
@@ -0,0 +1,21 @@
+all:
+
+install:
+ ../../install head_em.s head_em
+ ../../install libem_s.a tail_em
+ ../../install end.s end_em
+
+cmp:
+ -../../compare head_em.s head_em
+ -../../compare libem_s.a tail_em
+ -../../compare end.s end_em
+
+opr:
+ make pr | opr
+
+pr:
+ @pr `pwd`/head_em.s
+ @arch pv libem_s.a | pr -h `pwd`/libem_s.a
+ @pr `pwd`/end.s
+
+clean:
diff --git a/mach/6500/libem/end.s b/mach/6500/libem/end.s
new file mode 100644
index 00000000..1bb218eb
--- /dev/null
+++ b/mach/6500/libem/end.s
@@ -0,0 +1,17 @@
+.define endtext, enddata, endbss, end
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+
+.sect .text
+endtext:
+.align 2
+.sect .data
+.align 2
+enddata:
+.sect .bss
+.align 2
+endbss:
+end:
diff --git a/mach/6500/libem/head_em.s b/mach/6500/libem/head_em.s
new file mode 100644
index 00000000..5e4a1c26
--- /dev/null
+++ b/mach/6500/libem/head_em.s
@@ -0,0 +1,233 @@
+.define WRCH, RDCH, Earray, Erange, Eset
+.define Eiovfl, Eidivz, Eiund, Econv
+.define Estack, Eheap, Eillins, Eoddz
+.define Ecase , Ebadmon, OSBYTE, MON
+.define Ebadlin, Ebadgto, BASE, NBYTES
+.define hol0, IGNMASK, ADDR, PROGNAME
+.define LB, LBl, SP, HP, ERRPROC, UNSIGN
+.define Ytmp, EXG, ARTH, RETURN, SIGN
+.define RETSIZE, TRAPVAL, STACK, BRANCH
+.define start, Push, Pop, STACKTh, STACKTl
+.define F_DUM
+.sect .zero
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+
+! DEFINITIONS
+
+ ! The next three definitions are special for the
+ ! BBC microcomputer
+
+WRCH = 0x0FFEE ! This subroutine writes the character in
+ ! register A to the screen
+RDCH = 0x0FFE0 ! This subroutine returns a character in
+ ! register A from the current input stream
+OSBYTE = 0x0FFF4 ! This subroutine performs miscelaneous
+ ! operating system calls
+
+F_DUM = 0 ! Dummy floating point constant
+
+ ! Here are the error numbers
+
+Earray = 0
+Erange = 1
+Eset = 2
+Eiovfl = 3
+Eidivz = 6
+Eiund = 8
+Econv = 10
+Estack = 16
+Eheap = 17
+Eillins = 18
+Eoddz = 19
+Ecase = 20
+Ebadmon = 25
+Ebadlin = 26
+Ebadgto = 27
+MON = 0x78D0
+
+BASE = 240 ! This is the offset from the localbase
+ ! for the second localbase
+
+STACKTh = 0x78 ! This is the top of the stack
+STACKTl = 0x0D0
+
+ ! Some zeropage declarations
+
+.sect .zero
+
+RES: .space 76 ! special for the operating system
+
+hol0: .space 16 ! the hol0 block
+
+IGNMASK: .space 2 ! can hold the ingnore mask
+
+ADDR: .space 4 ! used for indirect addressing
+
+LB: .space 2 ! the localbase
+
+LBl: .space 2 ! the second localbase (localbase-BASE)
+
+SP: .space 3 ! the stackpointer (real_stack)
+
+HP: .space 2 ! the heap pointer
+
+BRANCH: .space 2 ! used for branch instructions
+
+ERRPROC: .space 2 ! can hold the address of the error handler
+
+Ytmp: .space 1 ! used for intermediate storage in Y
+
+EXG: .space 2 ! used by the exchange subroutine Exg
+
+ARTH: .space 16 ! used for arithmetic
+
+NBYTES: .space 2 ! containes the number of bytes for a block move
+
+
+RETURN: .space 4 ! the return area
+
+RETSIZE: .space 1 ! the size of the object returned
+
+SIGN: .space 1 ! the sign of the calculation
+
+UNSIGN : .space 1 ! is it signed or unsigned arithmetic
+
+TRAPVAL: .space 1 ! intermediate storage of the error number
+
+STACK: .space 1 ! contains the hardware stackpointer on
+ ! entering _m_a_i_n for a neat return
+
+RESERVED: .space 112 ! used by the operating system
+
+.sect .text
+.base 0x0E02 ! where to start in the BBC micro
+! GENERAL PURPOSE ROUTINES
+
+start:
+ tsx
+ stx STACK ! save stackpointer for exit and error
+
+ ! The following three operating system calls are only
+ ! for the BBC microcomputer
+
+ lda #2
+ ldx #0
+ ldy #0
+ jsr OSBYTE ! return control to the keyboard
+ lda #15
+ ldx #0
+ ldy #0
+ jsr OSBYTE ! clear all internal buffers
+ lda #3
+ ldx #5
+ ldy #0
+ jsr OSBYTE ! output to screen and RS423
+
+ lda #STACKTl
+ sta LB ! set localbase (lowbyte)
+ sta SP+2
+ lda #0
+ sta SP ! set stackpointer (lowbyte)
+ sta ERRPROC ! set start address for error handler (lowbyte)
+ sta ERRPROC+1 ! set start address for error handler (highbyte)
+ sta hol0 ! set the line number (lowbyte)
+ sta hol0+1 ! set the line number (highbyte)
+ lda #STACKTh
+ sta SP+1 ! set the stacpointer (highbyte)
+ sta LB+1 ! set the localbase (highbyte)
+ lda #[endbss].l
+ sta HP ! set the heap pointer (lowbyte)
+ lda #[endbss].h
+ sta HP+1 ! set the heap pointer (highbyte)
+ lda #[PROGNAME].l
+ sta hol0+4 ! set fake programname pointer (lowbyte)
+ lda #[PROGNAME].h
+ sta hol0+5 ! set fake programname pointer (highbyte)
+ lda #[beginbss].l
+ sta ADDR ! start address of bss block (lowbyte)
+ lda #[beginbss].h
+ sta ADDR+1 ! start address of bss block (highbyte)
+ ldy #0
+ lda #0
+ 4: ldx #[endbss].h ! clear bss block
+ cpx ADDR+1
+ bcc 1f ! end of bss block reached
+ bne 2f
+ ldx #[endbss].l
+ cpx ADDR
+ bcc 1f ! end of bss block reached
+ 2: sta (ADDR),y
+ inc ADDR
+ bne 3f
+ inc ADDR+1
+ 3: jmp 4b
+ 1: lda #0
+ tax
+ jsr Push ! push fake envelope pointer
+ lda #[PROGNAME].h
+ ldx #[PROGNAME].l
+ jsr Push ! push argv[0]
+ lda #0
+ ldx #1
+ jsr Push ! push argc
+ jsr __m_a_i_n ! start the real program
+
+ lda #0x0FF
+ jsr WRCH ! send end of program to R423
+ lda #3
+ ldx #0
+ jsr OSBYTE ! send output to screen only
+ lda #2
+ ldx #1
+ jsr OSBYTE ! input only from R423
+ rts
+
+
+! The subroutine Push pushes the registerpair AX onto the stack.
+
+Push:
+ sty Ytmp ! save Y
+ ldy SP+2
+ bne 1f ! lowbyte of stackpointer <> 0
+ dec SP+1 ! decrement highbyte of stackpointer
+ 1: dey
+ dey ! decrement lowbyte of stackpointer
+ sty SP+2 ! save lowbyte of stackpointer
+ pha ! save A
+ txa
+ sta (SP),y ! push X onto the stack
+ iny
+ pla ! get A
+ sta (SP),y ! push A onto the stack
+ ldy Ytmp ! restore Y
+ rts
+
+
+! The subroutine Pop pops the registerpair AX from the stack.
+
+Pop:
+ sty Ytmp ! save Y
+ ldy SP+2
+ lda (SP),y ! pop X from the stack
+ tax
+ iny
+ lda (SP),y ! pop A from the stack
+ iny
+ bne 1f ! lowbyte of stackpointer <> 0
+ inc SP+1 ! increment highbyte of stackpointer
+ 1: sty SP+2 ! store lowbyte of stackpointer
+ pha ! save A
+ pla ! get A
+ ldy Ytmp ! restore Y
+ rts
+
+
+.sect .data
+PROGNAME: ! for initialising the programname pointer
+.asciz "program"
+.sect .bss
+beginbss:
diff --git a/mach/6500/libem/mon.s b/mach/6500/libem/mon.s
new file mode 100644
index 00000000..1d094c51
--- /dev/null
+++ b/mach/6500/libem/mon.s
@@ -0,0 +1,40 @@
+.define Mon
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+
+! This subroutine performs some monitor calls.
+! The exit call just resets the hardware_stackpointer so
+! this routine will return to the operating system.
+! The close call just returns a zero.
+! The ioctl call just pops its arguments and returns a zero.
+! The write routine is a real one.
+
+
+Mon:
+ cpx #1
+ bne 1f ! exit
+ ldx STACK ! load stackpointer
+ dex
+ dex ! adjust stackpointer
+ txs ! set stackpointer
+ rts
+ 1: cpx #4
+ bne 1f
+ jmp Mwrite
+ 1: cpx #6 ! facked
+ bne 1f ! close
+ lda #0
+ tax ! return zero
+ rts
+ 1: cpx #54
+ jsr Pop ! pop first argument (fildes)
+ jsr Pop ! pop second argument (request)
+ jsr Pop ! pop third argument (argp)
+ lda #0
+ tax ! return zero
+ rts
+
+
diff --git a/mach/6500/libem/print.s b/mach/6500/libem/print.s
new file mode 100644
index 00000000..eea8e73d
--- /dev/null
+++ b/mach/6500/libem/print.s
@@ -0,0 +1,27 @@
+.define Mprint
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+
+! This subroutine prints a zero terminated ascii string.
+! The registerpair AX contains the start of the string.
+! The subroutine WRCH is a special routine on the BBC microcomputer
+! which prints the character in A to the screen.
+! The subroutine WRCH is a special one provided by the BBC
+! microcomputer.
+
+
+Mprint:
+ stx ADDR ! start address of string (lowbyte)
+ sta ADDR+1 ! start address of string (highbyte)
+ ldy #0
+ 1: lda (ADDR),y ! get ascii character
+ beq 2f
+ jsr WRCH ! put it on the screen
+ iny
+ bne 1b
+ 2: rts
+
+
diff --git a/mach/6500/libem/printhex.s b/mach/6500/libem/printhex.s
new file mode 100644
index 00000000..e1d3e4b3
--- /dev/null
+++ b/mach/6500/libem/printhex.s
@@ -0,0 +1,32 @@
+.define Printhex
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+
+! This subroutine print the contents of register A to the screen
+! in hexadecimal form.
+! The subroutine WRCH is a special one provided by the BBC
+! microcomputer.
+
+
+Printhex:
+ pha ! save A
+ lsr a
+ lsr a
+ lsr a
+ lsr a ! get four high bits
+ jsr 1f
+ pla ! restore A
+ and #0x0F ! get four low bits
+ jsr 1f
+ rts
+ 1: sed ! print in hex
+ clc
+ adc #0x90
+ adc #0x40
+ cld
+ jmp WRCH
+
+
diff --git a/mach/6500/libem/printstack.s b/mach/6500/libem/printstack.s
new file mode 100644
index 00000000..27f1512a
--- /dev/null
+++ b/mach/6500/libem/printstack.s
@@ -0,0 +1,49 @@
+.define Printstack
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+
+! This a special subroutine which prints some things to the
+! monitorscreen for debugging.
+
+
+Printstack:
+ ldy #0
+ 2: lda (hol0+4),y
+ beq 1f
+ jsr WRCH ! print filename
+ iny
+ jmp 2b
+ 1: lda #32
+ jsr WRCH ! print a space
+ lda hol0+1
+ jsr Printhex ! print line number (highbyte)
+ lda hol0
+ jsr Printhex ! print line number (lowbyte)
+ lda #32
+ jsr WRCH ! print a space
+ lda SP+1
+ jsr Printhex ! print stackpointer (highbyte)
+ lda SP+2
+ jsr Printhex ! print stackpointer (lowbyte)
+ lda #32
+ jsr WRCH ! print a space
+ lda LB+1
+ jsr Printhex ! print real localbase (highbyte)
+ lda LB
+ jsr Printhex ! print real localbase (lowbyte)
+ lda #32
+ jsr WRCH ! print a space
+ lda LBl+1
+ jsr Printhex ! print second lowerbase (highbyte)
+ lda LBl
+ jsr Printhex ! print second lowerbase (lowbyte)
+ lda #10
+ jsr WRCH ! print a newline
+ lda #13
+ jsr WRCH ! print a carriagereturn
+ rts
+
+
diff --git a/mach/6500/libem/read.s b/mach/6500/libem/read.s
new file mode 100644
index 00000000..12d2c58b
--- /dev/null
+++ b/mach/6500/libem/read.s
@@ -0,0 +1,37 @@
+.define Mread
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+
+! This subroutine reads characters from the standard input.
+! It ignores the filedes.
+! It reads atmost 255 characters. So the runtime system must
+! provide a way of dealing with this.
+! The subroutine RDCH is a special one provided by the BBC
+! microcomputer.
+
+
+Mread:
+ jsr Pop ! ignore filedescriptor
+ jsr Pop ! bufptr
+ stx ADDR ! address of character buffer (lowbyte)
+ sta ADDR+1 ! address of character buffer (highbyte)
+ jsr Pop ! number of characters
+ ldy #0 ! <= 255
+ inx
+ 1: jsr RDCH ! read a character from the current inputstream
+ bcs 8f
+ sta (ADDR),y
+ iny
+ dex
+ bne 1b
+ 8: tya
+ tax
+ lda #0
+ jsr Push ! number of characters red.
+ tax ! report a succesfull read.
+ rts
+
+
diff --git a/mach/6500/libem/write.s b/mach/6500/libem/write.s
new file mode 100644
index 00000000..7b87cf44
--- /dev/null
+++ b/mach/6500/libem/write.s
@@ -0,0 +1,39 @@
+.define Mwrite
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+
+! This subroutine performs the monitor call write.
+! Writing is always done to standardoutput.
+! A zero is returned on exit.
+! The subroutine WRCH is a special routine of the BBC
+! microcomputer.
+
+
+Mwrite:
+ jsr Pop ! get fildes
+ jsr Pop ! get address of characterbuffer
+ stx ADDR ! bufferaddress (lowbyte)
+ sta ADDR+1 ! bufferaddress (highbyte)
+ jsr Pop ! number of characters to be writen.
+ ldy #0
+ 1: lda (ADDR),y
+ cmp #10
+ bne 2f
+ pha
+ lda #13
+ jsr WRCH
+ pla
+ 2: jsr WRCH
+ iny
+ dex
+ bne 1b
+ tya
+ tax
+ lda #0
+ jsr Push
+ tax
+ rts
+
diff --git a/mach/6800/as/Makefile b/mach/6800/as/Makefile
new file mode 100644
index 00000000..7455a482
--- /dev/null
+++ b/mach/6800/as/Makefile
@@ -0,0 +1,67 @@
+# $Header$
+EMHOME = ../../..
+h = $(EMHOME)/h
+LIBOBJ = $(EMHOME)/modules/lib/libobject.a
+CDIR = $(EMHOME)/mach/proto/as
+CPP = $(EMHOME)/lib/cpp
+DEF =
+
+FFLAG =
+INCL = -I. -I$h $(DEF)
+CFLAGS = $(FFLAG) -O $(INCL)
+YFLAGS = -d
+LDFLAGS = $(FFLAG)
+
+CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
+ $(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
+COBJ = comm3.o comm4.o comm5.o \
+ comm6.o comm7.o comm8.o
+MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
+COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
+
+all: as
+
+install:all
+ ../../install as
+
+cmp:
+ -../../compare as
+
+clean:
+ rm -f *.o as as.[cy] y.tab.h
+
+pr: $(MACH)
+ @pr -n $(MACH)
+
+opr:
+ make pr | opr
+as: $(COBJ) as.o
+ $(CC) $(LDFLAGS) $(COBJ) as.o $(LIBOBJ) -o as
+
+as.y: $(CDIR)/comm2.y
+ $(CPP) -P -I. -I$h $(DEF) $(CDIR)/comm2.y >as.y
+ -@if test -f Expect ; then cat Expect ; else echo "expect 1 shift/reduce conflict"; fi
+
+lint: $(CSRC) as.c
+ lint $(INCL) $(CSRC) as.c
+
+y.tab.h: as.c
+$(COBJ): y.tab.h
+$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
+$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
+as.y: mach2.c
+comm3.o: mach3.c
+as.y: mach4.c
+comm8.o: mach5.c
+comm3.o: $(CDIR)/comm3.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm3.c
+comm4.o: $(CDIR)/comm4.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm4.c
+comm5.o: $(CDIR)/comm5.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm5.c
+comm6.o: $(CDIR)/comm6.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm6.c
+comm7.o: $(CDIR)/comm7.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm7.c
+comm8.o: $(CDIR)/comm8.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm8.c
diff --git a/mach/6805/as/Makefile b/mach/6805/as/Makefile
new file mode 100644
index 00000000..7455a482
--- /dev/null
+++ b/mach/6805/as/Makefile
@@ -0,0 +1,67 @@
+# $Header$
+EMHOME = ../../..
+h = $(EMHOME)/h
+LIBOBJ = $(EMHOME)/modules/lib/libobject.a
+CDIR = $(EMHOME)/mach/proto/as
+CPP = $(EMHOME)/lib/cpp
+DEF =
+
+FFLAG =
+INCL = -I. -I$h $(DEF)
+CFLAGS = $(FFLAG) -O $(INCL)
+YFLAGS = -d
+LDFLAGS = $(FFLAG)
+
+CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
+ $(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
+COBJ = comm3.o comm4.o comm5.o \
+ comm6.o comm7.o comm8.o
+MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
+COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
+
+all: as
+
+install:all
+ ../../install as
+
+cmp:
+ -../../compare as
+
+clean:
+ rm -f *.o as as.[cy] y.tab.h
+
+pr: $(MACH)
+ @pr -n $(MACH)
+
+opr:
+ make pr | opr
+as: $(COBJ) as.o
+ $(CC) $(LDFLAGS) $(COBJ) as.o $(LIBOBJ) -o as
+
+as.y: $(CDIR)/comm2.y
+ $(CPP) -P -I. -I$h $(DEF) $(CDIR)/comm2.y >as.y
+ -@if test -f Expect ; then cat Expect ; else echo "expect 1 shift/reduce conflict"; fi
+
+lint: $(CSRC) as.c
+ lint $(INCL) $(CSRC) as.c
+
+y.tab.h: as.c
+$(COBJ): y.tab.h
+$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
+$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
+as.y: mach2.c
+comm3.o: mach3.c
+as.y: mach4.c
+comm8.o: mach5.c
+comm3.o: $(CDIR)/comm3.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm3.c
+comm4.o: $(CDIR)/comm4.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm4.c
+comm5.o: $(CDIR)/comm5.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm5.c
+comm6.o: $(CDIR)/comm6.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm6.c
+comm7.o: $(CDIR)/comm7.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm7.c
+comm8.o: $(CDIR)/comm8.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm8.c
diff --git a/mach/6809/as/Makefile b/mach/6809/as/Makefile
new file mode 100644
index 00000000..7455a482
--- /dev/null
+++ b/mach/6809/as/Makefile
@@ -0,0 +1,67 @@
+# $Header$
+EMHOME = ../../..
+h = $(EMHOME)/h
+LIBOBJ = $(EMHOME)/modules/lib/libobject.a
+CDIR = $(EMHOME)/mach/proto/as
+CPP = $(EMHOME)/lib/cpp
+DEF =
+
+FFLAG =
+INCL = -I. -I$h $(DEF)
+CFLAGS = $(FFLAG) -O $(INCL)
+YFLAGS = -d
+LDFLAGS = $(FFLAG)
+
+CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
+ $(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
+COBJ = comm3.o comm4.o comm5.o \
+ comm6.o comm7.o comm8.o
+MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
+COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
+
+all: as
+
+install:all
+ ../../install as
+
+cmp:
+ -../../compare as
+
+clean:
+ rm -f *.o as as.[cy] y.tab.h
+
+pr: $(MACH)
+ @pr -n $(MACH)
+
+opr:
+ make pr | opr
+as: $(COBJ) as.o
+ $(CC) $(LDFLAGS) $(COBJ) as.o $(LIBOBJ) -o as
+
+as.y: $(CDIR)/comm2.y
+ $(CPP) -P -I. -I$h $(DEF) $(CDIR)/comm2.y >as.y
+ -@if test -f Expect ; then cat Expect ; else echo "expect 1 shift/reduce conflict"; fi
+
+lint: $(CSRC) as.c
+ lint $(INCL) $(CSRC) as.c
+
+y.tab.h: as.c
+$(COBJ): y.tab.h
+$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
+$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
+as.y: mach2.c
+comm3.o: mach3.c
+as.y: mach4.c
+comm8.o: mach5.c
+comm3.o: $(CDIR)/comm3.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm3.c
+comm4.o: $(CDIR)/comm4.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm4.c
+comm5.o: $(CDIR)/comm5.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm5.c
+comm6.o: $(CDIR)/comm6.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm6.c
+comm7.o: $(CDIR)/comm7.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm7.c
+comm8.o: $(CDIR)/comm8.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm8.c
diff --git a/mach/arm/as/Makefile b/mach/arm/as/Makefile
new file mode 100644
index 00000000..7455a482
--- /dev/null
+++ b/mach/arm/as/Makefile
@@ -0,0 +1,67 @@
+# $Header$
+EMHOME = ../../..
+h = $(EMHOME)/h
+LIBOBJ = $(EMHOME)/modules/lib/libobject.a
+CDIR = $(EMHOME)/mach/proto/as
+CPP = $(EMHOME)/lib/cpp
+DEF =
+
+FFLAG =
+INCL = -I. -I$h $(DEF)
+CFLAGS = $(FFLAG) -O $(INCL)
+YFLAGS = -d
+LDFLAGS = $(FFLAG)
+
+CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
+ $(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
+COBJ = comm3.o comm4.o comm5.o \
+ comm6.o comm7.o comm8.o
+MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
+COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
+
+all: as
+
+install:all
+ ../../install as
+
+cmp:
+ -../../compare as
+
+clean:
+ rm -f *.o as as.[cy] y.tab.h
+
+pr: $(MACH)
+ @pr -n $(MACH)
+
+opr:
+ make pr | opr
+as: $(COBJ) as.o
+ $(CC) $(LDFLAGS) $(COBJ) as.o $(LIBOBJ) -o as
+
+as.y: $(CDIR)/comm2.y
+ $(CPP) -P -I. -I$h $(DEF) $(CDIR)/comm2.y >as.y
+ -@if test -f Expect ; then cat Expect ; else echo "expect 1 shift/reduce conflict"; fi
+
+lint: $(CSRC) as.c
+ lint $(INCL) $(CSRC) as.c
+
+y.tab.h: as.c
+$(COBJ): y.tab.h
+$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
+$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
+as.y: mach2.c
+comm3.o: mach3.c
+as.y: mach4.c
+comm8.o: mach5.c
+comm3.o: $(CDIR)/comm3.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm3.c
+comm4.o: $(CDIR)/comm4.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm4.c
+comm5.o: $(CDIR)/comm5.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm5.c
+comm6.o: $(CDIR)/comm6.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm6.c
+comm7.o: $(CDIR)/comm7.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm7.c
+comm8.o: $(CDIR)/comm8.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm8.c
diff --git a/mach/arm/cv/Makefile b/mach/arm/cv/Makefile
new file mode 100644
index 00000000..40fd8362
--- /dev/null
+++ b/mach/arm/cv/Makefile
@@ -0,0 +1,22 @@
+EMHOME=../../..
+OBJLIB=$(EMHOME)/modules/lib/libobject.a
+
+head: cv
+
+cv: cv.c
+ $(CC) $(CFLAGS) $(LDFLAGS) -I$(EMHOME)/h -o cv cv.c $(OBJLIB)
+
+install: head
+ ../../install cv
+
+cmp: head
+ ../../compare cv
+
+clean:
+ rm -f *.o
+
+pr:
+ @pr `pwd`/Makefile `pwd`/cv.c
+
+opr:
+ make pr | opr
diff --git a/mach/arm/libem/Makefile b/mach/arm/libem/Makefile
new file mode 100644
index 00000000..b2c179d9
--- /dev/null
+++ b/mach/arm/libem/Makefile
@@ -0,0 +1,21 @@
+all:
+
+install:
+ ../../install head_em.s head_em
+ ../../install libem_s.a tail_em
+ ../../install end.s end_em
+
+cmp:
+ -../../compare head_em.s head_em
+ -../../compare libem_s.a tail_em
+ -../../compare end.s end_em
+
+clean:
+
+opr :
+ make pr | opr
+
+pr:
+ @pr `pwd`/head_em.s
+ @arch pv libem_s.a | pr -h `pwd`/libem_s.a
+ @pr `pwd`/end.s
diff --git a/mach/arm/libem/end.s b/mach/arm/libem/end.s
new file mode 100644
index 00000000..e31db94e
--- /dev/null
+++ b/mach/arm/libem/end.s
@@ -0,0 +1,16 @@
+.define _endtext,_enddata,_endbss
+.sect .text
+ .align 4
+.sect .rom
+ .align 4
+.sect .data
+ .align 4
+.sect .bss
+ .align 4
+
+ .sect .text
+_endtext:
+ .sect .data
+_enddata:
+ .sect .bss
+_endbss:
diff --git a/mach/arm/libem/head_em.s b/mach/arm/libem/head_em.s
new file mode 100644
index 00000000..26040b60
--- /dev/null
+++ b/mach/arm/libem/head_em.s
@@ -0,0 +1,178 @@
+! head_em.s
+.define begdat,begbss,hol0,argv,envp,_RegHp,_incptflag
+.define _Lineno,_Filna,_IgnoreMask,_TrpReg
+
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+
+.sect .text
+.base 0x8000
+ ADR R0,begbss
+ ADR R1,_endbss
+ MOV R2,#0
+ ADR R3,_incptflag
+ STR R2,[R3]
+1:
+ STR R2,[R0],#4
+ CMP R0,R1
+ BLT 1B
+! the next 2 lines are OS specific:
+ SWI 16 ! OS_Getenv
+ SUB R12, R1, #8 ! Get end of ram
+! R0 points to command string
+! (argv,argc) code for C
+! or Pascal file names
+ MOV R9,R0 ! save pt in R0
+ MOV R8,#0 ! string length
+len:
+ LDR.B R7,[R9],#1
+ CMP R7,#0
+ ADD.NE R8,R8,#1
+ BNE len
+ MOV R7,R8 ! save len in R7
+! round up to multiple of 4
+ ADD R8,R8,#4
+ MVN R6, #3 !FFFFFFFC
+ AND R8,R8,R6
+! make room on stack
+ SUB R12,R12,R8 ! word aligned
+! now determine argc
+! OS intercepts blank lines, so
+! there must be at least one arg
+ MOV R9,R0
+ MOV R6,#0 ! holds argc
+ MOV R5,#0 ! char count
+loop1:
+ CMP R5,R7
+ BGT next1
+ LDR.B R4,[R9],#1
+ ADD R5,R5,#1
+ CMP R4,#32
+ BEQ loop1 !skip spaces
+ ADD R6,R6,#1 ! new arg
+nospace1:
+ CMP R5,R7
+ BGT next1
+ LDR.B R4,[R9],#1
+ ADD R5,R5,#1
+ CMP R4,#32
+ BNE nospace1
+ CMP R5,R7
+ BCC loop1
+! BEQ loop1
+next1:
+! store argc
+ ADR R5,argc
+ STR R6,[R5]
+! copy the string
+! onto the stack
+ MOV R9,R0 !source
+ MOV R2,R12 !dest
+ MOV R3,R7 !#chars
+loop2:
+ LDR.B R4,[R9],#1
+ STR.B R4,[R2],#1
+ SUB.S R3,R3,#1
+ BNE loop2
+ MOV R4, #0 ! zero terminator
+ STR.B R4,[R2]
+! create space on the stack for
+! the pointers to individual args
+ MOV R11, R12 ! string pt
+ MOV R8,R6,LSL #2
+ SUB R12,R12,R8
+! save pointer to argv[0]
+ ADR R1,argv
+ STR R12,[R1]
+! determine argv[0] .. argv[argc-1]
+! and store on stack
+! R11 = start of string
+! R7 = string lenth
+! R12 = stack pointer
+! R6 = argc
+ MOV R9, #0 !char count
+ MOV R8, #0 !arg count
+ MOV R5,R11
+loop3:
+ CMP R9,R7
+ BGT next2
+ LDR.B R4,[R5],#1
+ ADD R9,R9,#1
+ CMP R4,#32
+ BEQ loop3
+ CMP R9,R7
+ BGT next2
+ SUB R4,R5,#1 !compensate for incr
+ STR R4,[R12,R8,LSL #2]
+ ADD R8,R8,#1
+nospace2:
+ CMP R9,R7
+ BGT next2
+ LDR.B R4,[R5],#1
+ ADD R9,R9,#1
+ CMP R4,#32
+ BNE nospace2
+ CMP R9,R7
+ BCC loop3
+! BEQ loop3
+! finally, replace spaces by 0
+next2:
+ MOV R5,R11 !string ptr
+ MOV R6,R7 !string length
+ MOV R3,#0
+loop4:
+ CMP R6,#0
+ BEQ next3
+ LDR.B R4,[R5]
+ CMP R4,#32
+ STR.EQ.B R3,[R5]
+ ADD R5,R5,#1
+ SUB R6,R6,#1
+ BAL loop4
+next3:
+ ADR R11, envp
+ STMFD R12<,{R11}
+ ADR R11,argv
+ LDR R11,[R11]
+ STMFD R12<,{R11}
+ ADR R11, argc
+ LDR R11,[R11]
+ STMFD R12<,{R11}
+ BAL.L __m_a_i_n
+ MOV R11,#0
+ STMFD R12<,{R11}
+ MOV R11,#1
+ STMFD R12<,{R11}
+ BAL.L _EmMon
+
+.sect .bss
+begbss:
+.sect .data
+begdat:
+hol0:
+ .data4 0
+ .data4 0
+argv:
+ .data4 0
+envp:
+ .data4 0
+argc:
+.data4 0
+2:
+ .asciz 'PROGRAM'
+ .align
+_RegHp:
+ .data4 _endbss
+_Lineno:
+ .data4 0
+_Filna:
+ .data4 0
+_IgnoreMask:
+ .data4 0
+_TrpReg:
+ .data4 0
+_incptflag:
+.data4 0
+
diff --git a/mach/arm/libfp/Makefile b/mach/arm/libfp/Makefile
new file mode 100644
index 00000000..eceeb76a
--- /dev/null
+++ b/mach/arm/libfp/Makefile
@@ -0,0 +1,22 @@
+EMHOME=../../..
+SUF=so
+MAKEFILE=$(EMHOME)/mach/proto/fp/Makefile
+MACHDEF="MACH=arm" "CFLAGS=-DUSE_DIVIDE" "SUF=$(SUF)" "ASAR=arch"
+
+all:
+ make -f $(MAKEFILE) $(MACHDEF) all
+
+install:
+ make -f $(MAKEFILE) $(MACHDEF) install
+
+cmp: all
+ -../../compare FP_$(MACH).a tail_fp
+
+clean:
+ make -f $(MAKEFILE) $(MACHDEF) clean
+
+opr:
+ make pr | opr
+
+pr:
+ @pr Makefile
diff --git a/mach/arm/libmon/Makefile b/mach/arm/libmon/Makefile
new file mode 100644
index 00000000..1df00138
--- /dev/null
+++ b/mach/arm/libmon/Makefile
@@ -0,0 +1,15 @@
+all:
+
+install:
+ ../../install libros_s.a tail_ros
+
+cmp:
+ -../../compare libros_s.a tail_ros
+
+clean:
+
+opr :
+ make pr | opr
+
+pr:
+ @arch pv libros_s.a | pr -h `pwd`/libros_s.a
diff --git a/mach/arm/ncg/Makefile b/mach/arm/ncg/Makefile
new file mode 100644
index 00000000..f5e2bda6
--- /dev/null
+++ b/mach/arm/ncg/Makefile
@@ -0,0 +1,197 @@
+# $Header$
+
+EMHOME=../../..
+#preprocessor flags for table
+TABLEFLAGS=
+#cgg options
+CGGFLAGS=
+
+PREFLAGS=-I$(EMHOME)/h -I. -I$(EMHOME)/mach -I$(EMHOME)/modules/h -DNDEBUG
+PFLAGS=
+CFLAGS=$(PREFLAGS) $(PFLAGS) -O
+LDFLAGS=$(PFLAGS)
+LINTOPTS=-bx
+LIBS=$(EMHOME)/lib/em_data.a $(EMHOME)/modules/lib/libflt.a
+CDIR=$(EMHOME)/mach/proto/ncg
+CGG=$(EMHOME)/lib/ncgg
+CPP=$(EMHOME)/lib/cpp
+CFILES=$(CDIR)/codegen.c $(CDIR)/compute.c $(CDIR)/equiv.c $(CDIR)/fillem.c \
+ $(CDIR)/gencode.c $(CDIR)/glosym.c $(CDIR)/label.c $(CDIR)/main.c \
+ $(CDIR)/move.c $(CDIR)/nextem.c $(CDIR)/reg.c $(CDIR)/regvar.c \
+ $(CDIR)/salloc.c $(CDIR)/state.c $(CDIR)/subr.c $(CDIR)/var.c
+OFILES=codegen.o compute.o equiv.o fillem.o gencode.o glosym.o label.o \
+ main.o move.o nextem.o reg.o regvar.o salloc.o state.o subr.o var.o
+
+all: tables.c
+ make "EMHOME="$(EMHOME) cg
+
+cg: tables.o $(OFILES)
+ $(CC) $(LDFLAGS) $(OFILES) tables.o $(LIBS) -o cg
+
+tables.o: tables.c
+ $(CC) -c $(PREFLAGS) -I$(CDIR) tables.c
+
+codegen.o: $(CDIR)/codegen.c
+ $(CC) -c $(CFLAGS) $(CDIR)/codegen.c
+compute.o: $(CDIR)/compute.c
+ $(CC) -c $(CFLAGS) $(CDIR)/compute.c
+equiv.o: $(CDIR)/equiv.c
+ $(CC) -c $(CFLAGS) $(CDIR)/equiv.c
+fillem.o: $(CDIR)/fillem.c
+ $(CC) -c $(CFLAGS) $(CDIR)/fillem.c
+gencode.o: $(CDIR)/gencode.c
+ $(CC) -c $(CFLAGS) $(CDIR)/gencode.c
+glosym.o: $(CDIR)/glosym.c
+ $(CC) -c $(CFLAGS) $(CDIR)/glosym.c
+label.o: $(CDIR)/label.c
+ $(CC) -c $(CFLAGS) $(CDIR)/label.c
+main.o: $(CDIR)/main.c
+ $(CC) -c $(CFLAGS) $(CDIR)/main.c
+move.o: $(CDIR)/move.c
+ $(CC) -c $(CFLAGS) $(CDIR)/move.c
+nextem.o: $(CDIR)/nextem.c
+ $(CC) -c $(CFLAGS) $(CDIR)/nextem.c
+reg.o: $(CDIR)/reg.c
+ $(CC) -c $(CFLAGS) $(CDIR)/reg.c
+regvar.o: $(CDIR)/regvar.c
+ $(CC) -c $(CFLAGS) $(CDIR)/regvar.c
+salloc.o: $(CDIR)/salloc.c
+ $(CC) -c $(CFLAGS) $(CDIR)/salloc.c
+state.o: $(CDIR)/state.c
+ $(CC) -c $(CFLAGS) $(CDIR)/state.c
+subr.o: $(CDIR)/subr.c
+ $(CC) -c $(CFLAGS) $(CDIR)/subr.c
+var.o: $(CDIR)/var.c
+ $(CC) -c $(CFLAGS) $(CDIR)/var.c
+
+install: all
+ $(EMHOME)/mach/install cg
+
+cmp: all
+ -$(EMHOME)/mach/compare cg
+
+
+tables.c: table $(CGG)
+ $(CPP) $(TABLEFLAGS) table | $(CGG) $(CGGFLAGS)
+ -cmp tables.h tables.H || cp tables.H tables.h
+
+lint: $(CFILES) tables.c
+ lint $(LINTOPTS) $(PREFLAGS) -I$(CDIR) $(CFILES) tables.c
+clean:
+ rm -f *.o tables.c tables.h debug.out cg tables.H
+
+distr: tables.c
+ rm -f tables1.c tables1.h
+ cp tables.c tables1.c
+ cp tables.h tables1.h
+ chmod -w tables1.[ch]
+
+codegen.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+codegen.o: $(CDIR)/data.h
+codegen.o: $(CDIR)/equiv.h
+codegen.o: $(CDIR)/extern.h
+codegen.o: $(CDIR)/param.h
+codegen.o: $(CDIR)/result.h
+codegen.o: $(CDIR)/state.h
+codegen.o: tables.h
+codegen.o: $(CDIR)/types.h
+compute.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+compute.o: $(CDIR)/data.h
+compute.o: $(CDIR)/extern.h
+compute.o: $(CDIR)/glosym.h
+compute.o: $(CDIR)/label.h
+compute.o: $(CDIR)/param.h
+compute.o: $(CDIR)/result.h
+compute.o: tables.h
+compute.o: $(CDIR)/types.h
+equiv.o: $(CDIR)/assert.h
+equiv.o: $(CDIR)/data.h $(EMHOME)/h/cgg_cg.h
+equiv.o: $(CDIR)/equiv.h
+equiv.o: $(CDIR)/extern.h
+equiv.o: $(CDIR)/param.h
+equiv.o: $(CDIR)/result.h
+equiv.o: tables.h
+equiv.o: $(CDIR)/types.h
+fillem.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+fillem.o: $(CDIR)/data.h
+fillem.o: $(CDIR)/extern.h
+fillem.o: mach.c
+fillem.o: mach.h
+fillem.o: $(CDIR)/param.h
+fillem.o: $(CDIR)/regvar.h
+fillem.o: $(CDIR)/result.h
+fillem.o: tables.h
+fillem.o: $(CDIR)/types.h
+gencode.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+gencode.o: $(CDIR)/data.h
+gencode.o: $(CDIR)/extern.h
+gencode.o: $(CDIR)/param.h
+gencode.o: $(CDIR)/result.h
+gencode.o: tables.h
+gencode.o: $(CDIR)/types.h
+glosym.o: $(CDIR)/glosym.h
+glosym.o: $(CDIR)/param.h
+glosym.o: tables.h
+glosym.o: $(CDIR)/types.h
+label.o: $(CDIR)/label.h
+label.o: $(CDIR)/param.h
+label.o: tables.h
+label.o: $(CDIR)/types.h
+main.o: $(CDIR)/param.h
+main.o: tables.h
+move.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+move.o: $(CDIR)/data.h
+move.o: $(CDIR)/extern.h
+move.o: $(CDIR)/param.h
+move.o: $(CDIR)/result.h
+move.o: tables.h
+move.o: $(CDIR)/types.h
+nextem.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+nextem.o: $(CDIR)/data.h
+nextem.o: $(CDIR)/extern.h
+nextem.o: $(CDIR)/param.h
+nextem.o: $(CDIR)/result.h
+nextem.o: tables.h
+nextem.o: $(CDIR)/types.h
+reg.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+reg.o: $(CDIR)/data.h
+reg.o: $(CDIR)/extern.h
+reg.o: $(CDIR)/param.h
+reg.o: $(CDIR)/result.h
+reg.o: tables.h
+reg.o: $(CDIR)/types.h
+regvar.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+regvar.o: $(CDIR)/data.h
+regvar.o: $(CDIR)/extern.h
+regvar.o: $(CDIR)/param.h
+regvar.o: $(CDIR)/regvar.h
+regvar.o: $(CDIR)/result.h
+regvar.o: tables.h
+regvar.o: $(CDIR)/types.h
+salloc.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+salloc.o: $(CDIR)/data.h
+salloc.o: $(CDIR)/extern.h
+salloc.o: $(CDIR)/param.h
+salloc.o: $(CDIR)/result.h
+salloc.o: tables.h
+salloc.o: $(CDIR)/types.h
+state.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+state.o: $(CDIR)/data.h
+state.o: $(CDIR)/extern.h
+state.o: $(CDIR)/param.h
+state.o: $(CDIR)/result.h
+state.o: $(CDIR)/state.h
+state.o: tables.h
+state.o: $(CDIR)/types.h
+subr.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+subr.o: $(CDIR)/data.h
+subr.o: $(CDIR)/extern.h
+subr.o: $(CDIR)/param.h
+subr.o: $(CDIR)/result.h
+subr.o: tables.h
+subr.o: $(CDIR)/types.h
+var.o: $(CDIR)/data.h $(EMHOME)/h/cgg_cg.h
+var.o: $(CDIR)/param.h
+var.o: $(CDIR)/result.h
+var.o: tables.h
+var.o: $(CDIR)/types.h
diff --git a/mach/arm/top/Makefile b/mach/arm/top/Makefile
new file mode 100644
index 00000000..57908427
--- /dev/null
+++ b/mach/arm/top/Makefile
@@ -0,0 +1,42 @@
+EMHOME=../../..
+LIBS=$(EMHOME)/modules/lib/libstring.a
+PREFLAGS=-I.
+PFLAGS=
+CFLAGS=$(PREFLAGS) $(PFLAGS) -O -DNDEBUG
+LDFLAGS=$(PFLAGS)
+LINTOPTS=-bx
+CDIR=$(EMHOME)/mach/proto/top
+CFILES=$(CDIR)/top.c $(CDIR)/queue.c
+OFILES=top.o queue.o
+
+all: gen.c
+ make top
+
+top: $(OFILES)
+ $(CC) $(LDFLAGS) $(OFILES) $(LIBS) -o top
+
+top.o: $(CDIR)/top.c gen.c
+ $(CC) -c $(CFLAGS) $(CDIR)/top.c
+
+queue.o: $(CDIR)/queue.c
+ $(CC) -c $(CFLAGS) $(CDIR)/queue.c
+
+install: all
+ $(EMHOME)/mach/install top
+
+cmp: all
+ -$(EMHOME)/mach/compare top
+
+gen.c: table
+ $(EMHOME)/lib/topgen table
+
+lint: $(CFILES)
+ lint $(LINTOPTS) $(PREFLAGS) $(CFILES)
+
+clean:
+ rm -f *.o gen.c gen.h top
+
+top.o: gen.h
+top.o: $(CDIR)/top.h
+top.o: $(CDIR)/queue.h
+queue.o: $(CDIR)/queue.h
diff --git a/mach/compare b/mach/compare
new file mode 100755
index 00000000..fc54003f
--- /dev/null
+++ b/mach/compare
@@ -0,0 +1,7 @@
+case $# in
+1) DEST="$1" ;;
+2) DEST="$2" ;;
+*) echo $0 [source] destination ;;
+esac
+MACH=`(cd .. ; basename \`pwd\`)`
+cmp "$1" ../../../lib/${MACH}/$DEST
diff --git a/mach/i386/as/Makefile b/mach/i386/as/Makefile
new file mode 100644
index 00000000..7455a482
--- /dev/null
+++ b/mach/i386/as/Makefile
@@ -0,0 +1,67 @@
+# $Header$
+EMHOME = ../../..
+h = $(EMHOME)/h
+LIBOBJ = $(EMHOME)/modules/lib/libobject.a
+CDIR = $(EMHOME)/mach/proto/as
+CPP = $(EMHOME)/lib/cpp
+DEF =
+
+FFLAG =
+INCL = -I. -I$h $(DEF)
+CFLAGS = $(FFLAG) -O $(INCL)
+YFLAGS = -d
+LDFLAGS = $(FFLAG)
+
+CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
+ $(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
+COBJ = comm3.o comm4.o comm5.o \
+ comm6.o comm7.o comm8.o
+MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
+COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
+
+all: as
+
+install:all
+ ../../install as
+
+cmp:
+ -../../compare as
+
+clean:
+ rm -f *.o as as.[cy] y.tab.h
+
+pr: $(MACH)
+ @pr -n $(MACH)
+
+opr:
+ make pr | opr
+as: $(COBJ) as.o
+ $(CC) $(LDFLAGS) $(COBJ) as.o $(LIBOBJ) -o as
+
+as.y: $(CDIR)/comm2.y
+ $(CPP) -P -I. -I$h $(DEF) $(CDIR)/comm2.y >as.y
+ -@if test -f Expect ; then cat Expect ; else echo "expect 1 shift/reduce conflict"; fi
+
+lint: $(CSRC) as.c
+ lint $(INCL) $(CSRC) as.c
+
+y.tab.h: as.c
+$(COBJ): y.tab.h
+$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
+$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
+as.y: mach2.c
+comm3.o: mach3.c
+as.y: mach4.c
+comm8.o: mach5.c
+comm3.o: $(CDIR)/comm3.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm3.c
+comm4.o: $(CDIR)/comm4.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm4.c
+comm5.o: $(CDIR)/comm5.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm5.c
+comm6.o: $(CDIR)/comm6.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm6.c
+comm7.o: $(CDIR)/comm7.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm7.c
+comm8.o: $(CDIR)/comm8.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm8.c
diff --git a/mach/i386/ce/Makefile b/mach/i386/ce/Makefile
new file mode 100644
index 00000000..b08bc0fd
--- /dev/null
+++ b/mach/i386/ce/Makefile
@@ -0,0 +1,26 @@
+EMHOME = ../../..
+CEG = $(EMHOME)/lib/ceg/util
+OBJ = obj
+
+all:
+ make -f $(CEG)/make_asobj "OBJ="$(OBJ)
+
+install:
+ make -f $(CEG)/make_asobj "OBJ="$(OBJ) install
+
+cmp:
+ -make -f $(CEG)/make_asobj "OBJ="$(OBJ) cmp
+
+pr:
+ @pr Makefile EM_table mach.h mach.c as_table as.h as.c
+
+opr:
+ make pr | opr
+
+# total cleanup
+clean:
+ make -f $(CEG)/make_asobj "OBJ="$(OBJ) clean
+
+# only remove ce, ceg, and back directories
+dclean:
+ make -f $(CEG)/make_asobj "OBJ="$(OBJ) dclean
diff --git a/mach/i386/cv/Makefile b/mach/i386/cv/Makefile
new file mode 100644
index 00000000..845481fc
--- /dev/null
+++ b/mach/i386/cv/Makefile
@@ -0,0 +1,25 @@
+EMHOME = ../../..
+LIBOBJ = $(EMHOME)/modules/lib/libobject.a
+INCLUDE = $(EMHOME)/h
+CFLAGS = -I. -I$(INCLUDE) -O
+TARGETS = cv
+
+all: $(TARGETS)
+
+install: all
+ ../../install cv
+
+cmp: all
+ -../../compare cv
+
+cv: cv.o
+ $(CC) $(LDFLAGS) -o cv cv.o $(LIBOBJ)
+
+clean:
+ rm -f $(TARGETS) *.o nohup.out Out
+
+pr:
+ @pr Makefile cv.c
+
+opr:
+ make pr | opr
diff --git a/mach/i386/libem/Makefile b/mach/i386/libem/Makefile
new file mode 100644
index 00000000..b6a883d7
--- /dev/null
+++ b/mach/i386/libem/Makefile
@@ -0,0 +1,30 @@
+# $Header$
+MACH=i386
+
+all: libem_o.a end.o
+
+install: all
+ ../../install libem_o.a tail_em
+ ../../install end.o end_em
+
+cmp: all
+ -../../compare libem_o.a tail_em
+ -../../compare end.o end_em
+
+
+end.o: end.s
+ $(MACH) -I../../../h -O -c end.s
+
+libem_o.a: libem_s.a
+ ASAR=aal ; export ASAR ;\
+ march . libem_o.a
+
+clean:
+ rm -f *.o libem_o.a
+
+opr :
+ make pr | opr
+
+pr:
+ @arch pv libem_s.a | pr -h `pwd`/libem_s.a
+ @pr `pwd`/end.s
diff --git a/mach/i386/libem/compmodule b/mach/i386/libem/compmodule
new file mode 100755
index 00000000..575cf59d
--- /dev/null
+++ b/mach/i386/libem/compmodule
@@ -0,0 +1,4 @@
+if i386 -c $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi
diff --git a/mach/i386/libem/end.s b/mach/i386/libem/end.s
new file mode 100644
index 00000000..b986b7a6
--- /dev/null
+++ b/mach/i386/libem/end.s
@@ -0,0 +1,17 @@
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define endtext,enddata,endbss
+.define _end,_etext,_edata
+
+ ! $Header$
+ .sect .text
+endtext:
+_etext:
+ .align 4
+ .sect .data
+enddata:
+_edata:
+ .align 4
+.sect .endsect
+_end:
+endbss:
+ .align 4
diff --git a/mach/i386/libem/fakfp.s b/mach/i386/libem/fakfp.s
new file mode 100644
index 00000000..0baadb91
--- /dev/null
+++ b/mach/i386/libem/fakfp.s
@@ -0,0 +1,38 @@
+.define .adf4, .adf8, .sbf4, .sbf8, .mlf4, .mlf8, .dvf4, .dvf8
+.define .ngf4, .ngf8, .fif4, .fif8, .fef4, .fef8
+.define .cif4, .cif8, .cuf4, .cuf8, .cfi, .cfu, .cff4, .cff8
+.define .cmf4, .cmf8
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+
+! $Header$
+
+ .sect .text
+.adf4:
+.adf8:
+.sbf4:
+.sbf8:
+.mlf4:
+.mlf8:
+.dvf4:
+.dvf8:
+.ngf4:
+.ngf8:
+.fif4:
+.fif8:
+.fef4:
+.fef8:
+.cif4:
+.cif8:
+.cuf4:
+.cuf8:
+.cfi:
+.cfu:
+.cff4:
+.cff8:
+.cmf4:
+.cmf8:
+ mov eax,18 ! illegal instruction EILLINS
+ jmp .trp
diff --git a/mach/i386/libem/return.s b/mach/i386/libem/return.s
new file mode 100644
index 00000000..f12a8813
--- /dev/null
+++ b/mach/i386/libem/return.s
@@ -0,0 +1,17 @@
+.define .sdret, .dsret, .sret, .dret, .cret
+.sect .text
+
+.dsret:
+ pop edi
+.sret:
+ pop esi
+.cret:
+ mov esp,ebp
+ pop ebp
+ ret
+
+.sdret:
+ pop esi
+.dret:
+ pop edi
+ jmp .cret
diff --git a/mach/i386/libem/stop.s b/mach/i386/libem/stop.s
new file mode 100644
index 00000000..200d6422
--- /dev/null
+++ b/mach/i386/libem/stop.s
@@ -0,0 +1,5 @@
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
+.define .stop
+.stop:
+ jmp __exit
diff --git a/mach/i386/libfp/Makefile b/mach/i386/libfp/Makefile
new file mode 100644
index 00000000..1f7e12bc
--- /dev/null
+++ b/mach/i386/libfp/Makefile
@@ -0,0 +1,22 @@
+EMHOME=../../..
+SUF=o
+MAKEFILE=$(EMHOME)/mach/proto/fp/Makefile
+MACHDEF="MACH=i386" "CFLAGS=-DUSE_DIVIDE" "SUF=$(SUF)" "ASAR=aal"
+
+all:
+ make -f $(MAKEFILE) $(MACHDEF) all
+
+install:
+ make -f $(MAKEFILE) $(MACHDEF) install
+
+cmp: all
+ -../../compare FP_$(MACH).a tail_fp
+
+clean:
+ make -f $(MAKEFILE) $(MACHDEF) clean
+
+opr:
+ make pr | opr
+
+pr:
+ @pr Makefile
diff --git a/mach/i386/libsys/Makefile b/mach/i386/libsys/Makefile
new file mode 100644
index 00000000..d00169f2
--- /dev/null
+++ b/mach/i386/libsys/Makefile
@@ -0,0 +1,28 @@
+# $Header$
+MACH=i386
+all: libmon_o.a head_em.o
+
+install: all
+ ../../install libmon_o.a tail_mon
+ ../../install head_em.o head_em
+
+cmp: all
+ -../../compare libmon_o.a tail_mon
+ -../../compare head_em.o head_em
+
+libmon_o.a: libmon_s.a
+ ASAR=aal ; export ASAR ;\
+ march . libmon_o.a
+
+head_em.o: head_em.s
+ $(MACH) -O -c head_em.s
+
+clean:
+ rm -f *.o libmon_o.a
+
+opr :
+ make pr | opr
+
+pr:
+ @pr `pwd`/head_em.s
+ @arch pv libmon_s.a | pr -h `pwd`/libmon_s.a
diff --git a/mach/i386/libsys/_pipe.s b/mach/i386/libsys/_pipe.s
new file mode 100644
index 00000000..a5110329
--- /dev/null
+++ b/mach/i386/libsys/_pipe.s
@@ -0,0 +1,12 @@
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define __pipe
+.sect .text
+__pipe:
+ mov ax,42
+ callf 0x7:0x0
+ jae 1f
+ jmp cerror
+1:
+ shl dx,0x10
+ or eax,edx
+ ret
diff --git a/mach/i386/libsys/_profil.s b/mach/i386/libsys/_profil.s
new file mode 100644
index 00000000..53ce0879
--- /dev/null
+++ b/mach/i386/libsys/_profil.s
@@ -0,0 +1,6 @@
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define __profil
+.sect .text
+__profil:
+ mov ax,44
+ jmp syscal
diff --git a/mach/i386/libsys/_stime.s b/mach/i386/libsys/_stime.s
new file mode 100644
index 00000000..5b8aa68e
--- /dev/null
+++ b/mach/i386/libsys/_stime.s
@@ -0,0 +1,6 @@
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define __stime
+.sect .text
+__stime:
+ mov ax,25
+ jmp sysx
diff --git a/mach/i386/libsys/_time.s b/mach/i386/libsys/_time.s
new file mode 100644
index 00000000..9e71c45b
--- /dev/null
+++ b/mach/i386/libsys/_time.s
@@ -0,0 +1,6 @@
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define __time
+.sect .text
+__time:
+ mov ax,13
+ jmp syscal
diff --git a/mach/i386/libsys/_wait.s b/mach/i386/libsys/_wait.s
new file mode 100644
index 00000000..045f50e6
--- /dev/null
+++ b/mach/i386/libsys/_wait.s
@@ -0,0 +1,12 @@
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define __wait
+.sect .text
+__wait:
+ mov ax,7
+ callf 0x7:0x0
+ jb 1f
+ shl dx,0x10
+ or eax,edx
+ ret
+1:
+ jmp cerror
diff --git a/mach/i386/libsys/compmodule b/mach/i386/libsys/compmodule
new file mode 100755
index 00000000..db47c610
--- /dev/null
+++ b/mach/i386/libsys/compmodule
@@ -0,0 +1,4 @@
+if i386 -c -L $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi
diff --git a/mach/i386/ncg/Makefile b/mach/i386/ncg/Makefile
new file mode 100644
index 00000000..f5e2bda6
--- /dev/null
+++ b/mach/i386/ncg/Makefile
@@ -0,0 +1,197 @@
+# $Header$
+
+EMHOME=../../..
+#preprocessor flags for table
+TABLEFLAGS=
+#cgg options
+CGGFLAGS=
+
+PREFLAGS=-I$(EMHOME)/h -I. -I$(EMHOME)/mach -I$(EMHOME)/modules/h -DNDEBUG
+PFLAGS=
+CFLAGS=$(PREFLAGS) $(PFLAGS) -O
+LDFLAGS=$(PFLAGS)
+LINTOPTS=-bx
+LIBS=$(EMHOME)/lib/em_data.a $(EMHOME)/modules/lib/libflt.a
+CDIR=$(EMHOME)/mach/proto/ncg
+CGG=$(EMHOME)/lib/ncgg
+CPP=$(EMHOME)/lib/cpp
+CFILES=$(CDIR)/codegen.c $(CDIR)/compute.c $(CDIR)/equiv.c $(CDIR)/fillem.c \
+ $(CDIR)/gencode.c $(CDIR)/glosym.c $(CDIR)/label.c $(CDIR)/main.c \
+ $(CDIR)/move.c $(CDIR)/nextem.c $(CDIR)/reg.c $(CDIR)/regvar.c \
+ $(CDIR)/salloc.c $(CDIR)/state.c $(CDIR)/subr.c $(CDIR)/var.c
+OFILES=codegen.o compute.o equiv.o fillem.o gencode.o glosym.o label.o \
+ main.o move.o nextem.o reg.o regvar.o salloc.o state.o subr.o var.o
+
+all: tables.c
+ make "EMHOME="$(EMHOME) cg
+
+cg: tables.o $(OFILES)
+ $(CC) $(LDFLAGS) $(OFILES) tables.o $(LIBS) -o cg
+
+tables.o: tables.c
+ $(CC) -c $(PREFLAGS) -I$(CDIR) tables.c
+
+codegen.o: $(CDIR)/codegen.c
+ $(CC) -c $(CFLAGS) $(CDIR)/codegen.c
+compute.o: $(CDIR)/compute.c
+ $(CC) -c $(CFLAGS) $(CDIR)/compute.c
+equiv.o: $(CDIR)/equiv.c
+ $(CC) -c $(CFLAGS) $(CDIR)/equiv.c
+fillem.o: $(CDIR)/fillem.c
+ $(CC) -c $(CFLAGS) $(CDIR)/fillem.c
+gencode.o: $(CDIR)/gencode.c
+ $(CC) -c $(CFLAGS) $(CDIR)/gencode.c
+glosym.o: $(CDIR)/glosym.c
+ $(CC) -c $(CFLAGS) $(CDIR)/glosym.c
+label.o: $(CDIR)/label.c
+ $(CC) -c $(CFLAGS) $(CDIR)/label.c
+main.o: $(CDIR)/main.c
+ $(CC) -c $(CFLAGS) $(CDIR)/main.c
+move.o: $(CDIR)/move.c
+ $(CC) -c $(CFLAGS) $(CDIR)/move.c
+nextem.o: $(CDIR)/nextem.c
+ $(CC) -c $(CFLAGS) $(CDIR)/nextem.c
+reg.o: $(CDIR)/reg.c
+ $(CC) -c $(CFLAGS) $(CDIR)/reg.c
+regvar.o: $(CDIR)/regvar.c
+ $(CC) -c $(CFLAGS) $(CDIR)/regvar.c
+salloc.o: $(CDIR)/salloc.c
+ $(CC) -c $(CFLAGS) $(CDIR)/salloc.c
+state.o: $(CDIR)/state.c
+ $(CC) -c $(CFLAGS) $(CDIR)/state.c
+subr.o: $(CDIR)/subr.c
+ $(CC) -c $(CFLAGS) $(CDIR)/subr.c
+var.o: $(CDIR)/var.c
+ $(CC) -c $(CFLAGS) $(CDIR)/var.c
+
+install: all
+ $(EMHOME)/mach/install cg
+
+cmp: all
+ -$(EMHOME)/mach/compare cg
+
+
+tables.c: table $(CGG)
+ $(CPP) $(TABLEFLAGS) table | $(CGG) $(CGGFLAGS)
+ -cmp tables.h tables.H || cp tables.H tables.h
+
+lint: $(CFILES) tables.c
+ lint $(LINTOPTS) $(PREFLAGS) -I$(CDIR) $(CFILES) tables.c
+clean:
+ rm -f *.o tables.c tables.h debug.out cg tables.H
+
+distr: tables.c
+ rm -f tables1.c tables1.h
+ cp tables.c tables1.c
+ cp tables.h tables1.h
+ chmod -w tables1.[ch]
+
+codegen.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+codegen.o: $(CDIR)/data.h
+codegen.o: $(CDIR)/equiv.h
+codegen.o: $(CDIR)/extern.h
+codegen.o: $(CDIR)/param.h
+codegen.o: $(CDIR)/result.h
+codegen.o: $(CDIR)/state.h
+codegen.o: tables.h
+codegen.o: $(CDIR)/types.h
+compute.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+compute.o: $(CDIR)/data.h
+compute.o: $(CDIR)/extern.h
+compute.o: $(CDIR)/glosym.h
+compute.o: $(CDIR)/label.h
+compute.o: $(CDIR)/param.h
+compute.o: $(CDIR)/result.h
+compute.o: tables.h
+compute.o: $(CDIR)/types.h
+equiv.o: $(CDIR)/assert.h
+equiv.o: $(CDIR)/data.h $(EMHOME)/h/cgg_cg.h
+equiv.o: $(CDIR)/equiv.h
+equiv.o: $(CDIR)/extern.h
+equiv.o: $(CDIR)/param.h
+equiv.o: $(CDIR)/result.h
+equiv.o: tables.h
+equiv.o: $(CDIR)/types.h
+fillem.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+fillem.o: $(CDIR)/data.h
+fillem.o: $(CDIR)/extern.h
+fillem.o: mach.c
+fillem.o: mach.h
+fillem.o: $(CDIR)/param.h
+fillem.o: $(CDIR)/regvar.h
+fillem.o: $(CDIR)/result.h
+fillem.o: tables.h
+fillem.o: $(CDIR)/types.h
+gencode.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+gencode.o: $(CDIR)/data.h
+gencode.o: $(CDIR)/extern.h
+gencode.o: $(CDIR)/param.h
+gencode.o: $(CDIR)/result.h
+gencode.o: tables.h
+gencode.o: $(CDIR)/types.h
+glosym.o: $(CDIR)/glosym.h
+glosym.o: $(CDIR)/param.h
+glosym.o: tables.h
+glosym.o: $(CDIR)/types.h
+label.o: $(CDIR)/label.h
+label.o: $(CDIR)/param.h
+label.o: tables.h
+label.o: $(CDIR)/types.h
+main.o: $(CDIR)/param.h
+main.o: tables.h
+move.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+move.o: $(CDIR)/data.h
+move.o: $(CDIR)/extern.h
+move.o: $(CDIR)/param.h
+move.o: $(CDIR)/result.h
+move.o: tables.h
+move.o: $(CDIR)/types.h
+nextem.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+nextem.o: $(CDIR)/data.h
+nextem.o: $(CDIR)/extern.h
+nextem.o: $(CDIR)/param.h
+nextem.o: $(CDIR)/result.h
+nextem.o: tables.h
+nextem.o: $(CDIR)/types.h
+reg.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+reg.o: $(CDIR)/data.h
+reg.o: $(CDIR)/extern.h
+reg.o: $(CDIR)/param.h
+reg.o: $(CDIR)/result.h
+reg.o: tables.h
+reg.o: $(CDIR)/types.h
+regvar.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+regvar.o: $(CDIR)/data.h
+regvar.o: $(CDIR)/extern.h
+regvar.o: $(CDIR)/param.h
+regvar.o: $(CDIR)/regvar.h
+regvar.o: $(CDIR)/result.h
+regvar.o: tables.h
+regvar.o: $(CDIR)/types.h
+salloc.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+salloc.o: $(CDIR)/data.h
+salloc.o: $(CDIR)/extern.h
+salloc.o: $(CDIR)/param.h
+salloc.o: $(CDIR)/result.h
+salloc.o: tables.h
+salloc.o: $(CDIR)/types.h
+state.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+state.o: $(CDIR)/data.h
+state.o: $(CDIR)/extern.h
+state.o: $(CDIR)/param.h
+state.o: $(CDIR)/result.h
+state.o: $(CDIR)/state.h
+state.o: tables.h
+state.o: $(CDIR)/types.h
+subr.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+subr.o: $(CDIR)/data.h
+subr.o: $(CDIR)/extern.h
+subr.o: $(CDIR)/param.h
+subr.o: $(CDIR)/result.h
+subr.o: tables.h
+subr.o: $(CDIR)/types.h
+var.o: $(CDIR)/data.h $(EMHOME)/h/cgg_cg.h
+var.o: $(CDIR)/param.h
+var.o: $(CDIR)/result.h
+var.o: tables.h
+var.o: $(CDIR)/types.h
diff --git a/mach/i80/as/Makefile b/mach/i80/as/Makefile
new file mode 100644
index 00000000..7455a482
--- /dev/null
+++ b/mach/i80/as/Makefile
@@ -0,0 +1,67 @@
+# $Header$
+EMHOME = ../../..
+h = $(EMHOME)/h
+LIBOBJ = $(EMHOME)/modules/lib/libobject.a
+CDIR = $(EMHOME)/mach/proto/as
+CPP = $(EMHOME)/lib/cpp
+DEF =
+
+FFLAG =
+INCL = -I. -I$h $(DEF)
+CFLAGS = $(FFLAG) -O $(INCL)
+YFLAGS = -d
+LDFLAGS = $(FFLAG)
+
+CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
+ $(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
+COBJ = comm3.o comm4.o comm5.o \
+ comm6.o comm7.o comm8.o
+MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
+COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
+
+all: as
+
+install:all
+ ../../install as
+
+cmp:
+ -../../compare as
+
+clean:
+ rm -f *.o as as.[cy] y.tab.h
+
+pr: $(MACH)
+ @pr -n $(MACH)
+
+opr:
+ make pr | opr
+as: $(COBJ) as.o
+ $(CC) $(LDFLAGS) $(COBJ) as.o $(LIBOBJ) -o as
+
+as.y: $(CDIR)/comm2.y
+ $(CPP) -P -I. -I$h $(DEF) $(CDIR)/comm2.y >as.y
+ -@if test -f Expect ; then cat Expect ; else echo "expect 1 shift/reduce conflict"; fi
+
+lint: $(CSRC) as.c
+ lint $(INCL) $(CSRC) as.c
+
+y.tab.h: as.c
+$(COBJ): y.tab.h
+$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
+$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
+as.y: mach2.c
+comm3.o: mach3.c
+as.y: mach4.c
+comm8.o: mach5.c
+comm3.o: $(CDIR)/comm3.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm3.c
+comm4.o: $(CDIR)/comm4.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm4.c
+comm5.o: $(CDIR)/comm5.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm5.c
+comm6.o: $(CDIR)/comm6.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm6.c
+comm7.o: $(CDIR)/comm7.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm7.c
+comm8.o: $(CDIR)/comm8.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm8.c
diff --git a/mach/i80/dl/Makefile b/mach/i80/dl/Makefile
new file mode 100644
index 00000000..e684c21e
--- /dev/null
+++ b/mach/i80/dl/Makefile
@@ -0,0 +1,25 @@
+EMHOME=../../..
+OBJLIB=$(EMHOME)/modules/lib/libobject.a
+
+head: mccpm nascom
+
+mccpm: mccpm.c
+ $(CC) -I$(EMHOME)/h -o mccpm mccpm.c $(OBJLIB)
+
+nascom: nascom.c
+ $(CC) -I$(EMHOME)/h -o nascom nascom.c $(OBJLIB)
+
+install: head
+ @echo Nothing is installed
+
+cmp: head
+ @echo Nothing is compared
+
+clean:
+ rm -f *.o
+
+pr:
+ @pr `pwd`/Makefile `pwd`/mccpm.c `pwd`/nascom.c
+
+opr:
+ make pr | opr
diff --git a/mach/i80/libem/Makefile b/mach/i80/libem/Makefile
new file mode 100644
index 00000000..e4ec304d
--- /dev/null
+++ b/mach/i80/libem/Makefile
@@ -0,0 +1,29 @@
+# $Header$
+MACH=i80
+all: libem_o.a end.o
+
+install: all
+ ../../install end.o end_em
+ ../../install libem_o.a tail_em
+
+
+cmp: all
+ -../../compare end.o end_em
+ -../../compare libem_o.a tail_em
+
+libem_o.a: libem_s.a
+ ASAR=aal ; export ASAR ;\
+ march . libem_o.a
+
+end.o: end.s
+ $(MACH) -I../../../h -c end.s
+
+clean:
+ rm -f *.o libem_o.a
+
+opr :
+ make pr | opr
+
+pr:
+ @pr `pwd`/end.s
+ @arch pv libem_s.a | pr -h `pwd`/libem_s.a
diff --git a/mach/i80/libem/compmodule b/mach/i80/libem/compmodule
new file mode 100755
index 00000000..2e87032c
--- /dev/null
+++ b/mach/i80/libem/compmodule
@@ -0,0 +1,4 @@
+if i80 -c $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi
diff --git a/mach/i80/libem/end.s b/mach/i80/libem/end.s
new file mode 100644
index 00000000..6b9ce418
--- /dev/null
+++ b/mach/i80/libem/end.s
@@ -0,0 +1,17 @@
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define endtext,enddata,endbss
+.define _end,_etext,_edata
+
+ ! $Header$
+ .sect .text
+endtext:
+_etext:
+ .align 2
+ .sect .data
+enddata:
+_edata:
+ .align 2
+.sect .endsect
+_end:
+endbss:
+ .align 2
diff --git a/mach/i80/libmon/Makefile b/mach/i80/libmon/Makefile
new file mode 100644
index 00000000..c334b9ba
--- /dev/null
+++ b/mach/i80/libmon/Makefile
@@ -0,0 +1,29 @@
+# $Header$
+MACH=i80
+all: libsys_o.a head_em.o
+
+install: all
+ ../../install head_em.o head_em
+ ../../install libsys_o.a tail_sys
+
+
+cmp: all
+ -../../compare head_em.o head_em
+ -../../compare libsys_o.a tail_sys
+
+libsys_o.a: libsys_s.a
+ ASAR=aal ; export ASAR ;\
+ march . libsys_o.a
+
+head_em.o: head_em.s
+ $(MACH) -I../../../h -c head_em.s
+
+clean:
+ rm -f *.o libsys_o.a
+
+opr :
+ make pr | opr
+
+pr:
+ @pr `pwd`/head_em.s
+ @arch pv libsys_s.a | pr -h `pwd`/libsys_s.a
diff --git a/mach/i80/libmon/compmodule b/mach/i80/libmon/compmodule
new file mode 100755
index 00000000..de15217c
--- /dev/null
+++ b/mach/i80/libmon/compmodule
@@ -0,0 +1,4 @@
+if i80 -c -L $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi
diff --git a/mach/i80/libmon/head.s b/mach/i80/libmon/head.s
new file mode 100644
index 00000000..f5bd2351
--- /dev/null
+++ b/mach/i80/libmon/head.s
@@ -0,0 +1,49 @@
+.define hol0, argv, envp, begbss
+.define .ignmask,.reghp,.trapproc,.fra
+.define .retadr,.retadr1,.areg,.bcreg,.tmp1
+.define block1, block2, block3
+.define .stop
+
+ .base 0x1000
+.text
+ lxi h,0x1000 ! stack will grow from 0x1000 downwards
+ sphl
+ lxi h,begbss ! clear bss
+ lxi d,endbss-begbss
+ mvi c,0
+
+2: mov m,c
+ inx h
+ dcx d
+ mov a,e
+ ora d
+ jnz 2b
+
+ lxi h,envp ! call main
+ push h
+ lxi h,argv
+ push h
+ lxi h,0
+ push h
+ call _m_a_i_n
+.stop: jmp 0xfb52
+
+.bss
+begbss:
+.trapproc: .space 2
+.ignmask: .space 2
+.data
+hol0: .space 8
+.reghp: .word endbss
+argv: .word 0
+envp: .word 0
+.retadr: .space 2 ! used to save return address
+.retadr1: .space 2 ! reserve
+.bcreg: .space 2 ! used to save localbase
+.areg: .space 1
+.tmp1: .space 2
+.fra: .space 8 ! 8 bytes function return area
+block1: .space 4 ! used by 32 bits divide and
+block2: .space 4 ! multiply routines
+block3: .space 4
+
diff --git a/mach/i80/libmon/tail.s b/mach/i80/libmon/tail.s
new file mode 100644
index 00000000..bd667480
--- /dev/null
+++ b/mach/i80/libmon/tail.s
@@ -0,0 +1,7 @@
+.define endtext, enddata, endbss
+.text
+endtext: .align 2
+.data
+enddata: .align 2
+.bss
+endbss: .align 2
diff --git a/mach/i80/ncg/Makefile b/mach/i80/ncg/Makefile
new file mode 100644
index 00000000..f5e2bda6
--- /dev/null
+++ b/mach/i80/ncg/Makefile
@@ -0,0 +1,197 @@
+# $Header$
+
+EMHOME=../../..
+#preprocessor flags for table
+TABLEFLAGS=
+#cgg options
+CGGFLAGS=
+
+PREFLAGS=-I$(EMHOME)/h -I. -I$(EMHOME)/mach -I$(EMHOME)/modules/h -DNDEBUG
+PFLAGS=
+CFLAGS=$(PREFLAGS) $(PFLAGS) -O
+LDFLAGS=$(PFLAGS)
+LINTOPTS=-bx
+LIBS=$(EMHOME)/lib/em_data.a $(EMHOME)/modules/lib/libflt.a
+CDIR=$(EMHOME)/mach/proto/ncg
+CGG=$(EMHOME)/lib/ncgg
+CPP=$(EMHOME)/lib/cpp
+CFILES=$(CDIR)/codegen.c $(CDIR)/compute.c $(CDIR)/equiv.c $(CDIR)/fillem.c \
+ $(CDIR)/gencode.c $(CDIR)/glosym.c $(CDIR)/label.c $(CDIR)/main.c \
+ $(CDIR)/move.c $(CDIR)/nextem.c $(CDIR)/reg.c $(CDIR)/regvar.c \
+ $(CDIR)/salloc.c $(CDIR)/state.c $(CDIR)/subr.c $(CDIR)/var.c
+OFILES=codegen.o compute.o equiv.o fillem.o gencode.o glosym.o label.o \
+ main.o move.o nextem.o reg.o regvar.o salloc.o state.o subr.o var.o
+
+all: tables.c
+ make "EMHOME="$(EMHOME) cg
+
+cg: tables.o $(OFILES)
+ $(CC) $(LDFLAGS) $(OFILES) tables.o $(LIBS) -o cg
+
+tables.o: tables.c
+ $(CC) -c $(PREFLAGS) -I$(CDIR) tables.c
+
+codegen.o: $(CDIR)/codegen.c
+ $(CC) -c $(CFLAGS) $(CDIR)/codegen.c
+compute.o: $(CDIR)/compute.c
+ $(CC) -c $(CFLAGS) $(CDIR)/compute.c
+equiv.o: $(CDIR)/equiv.c
+ $(CC) -c $(CFLAGS) $(CDIR)/equiv.c
+fillem.o: $(CDIR)/fillem.c
+ $(CC) -c $(CFLAGS) $(CDIR)/fillem.c
+gencode.o: $(CDIR)/gencode.c
+ $(CC) -c $(CFLAGS) $(CDIR)/gencode.c
+glosym.o: $(CDIR)/glosym.c
+ $(CC) -c $(CFLAGS) $(CDIR)/glosym.c
+label.o: $(CDIR)/label.c
+ $(CC) -c $(CFLAGS) $(CDIR)/label.c
+main.o: $(CDIR)/main.c
+ $(CC) -c $(CFLAGS) $(CDIR)/main.c
+move.o: $(CDIR)/move.c
+ $(CC) -c $(CFLAGS) $(CDIR)/move.c
+nextem.o: $(CDIR)/nextem.c
+ $(CC) -c $(CFLAGS) $(CDIR)/nextem.c
+reg.o: $(CDIR)/reg.c
+ $(CC) -c $(CFLAGS) $(CDIR)/reg.c
+regvar.o: $(CDIR)/regvar.c
+ $(CC) -c $(CFLAGS) $(CDIR)/regvar.c
+salloc.o: $(CDIR)/salloc.c
+ $(CC) -c $(CFLAGS) $(CDIR)/salloc.c
+state.o: $(CDIR)/state.c
+ $(CC) -c $(CFLAGS) $(CDIR)/state.c
+subr.o: $(CDIR)/subr.c
+ $(CC) -c $(CFLAGS) $(CDIR)/subr.c
+var.o: $(CDIR)/var.c
+ $(CC) -c $(CFLAGS) $(CDIR)/var.c
+
+install: all
+ $(EMHOME)/mach/install cg
+
+cmp: all
+ -$(EMHOME)/mach/compare cg
+
+
+tables.c: table $(CGG)
+ $(CPP) $(TABLEFLAGS) table | $(CGG) $(CGGFLAGS)
+ -cmp tables.h tables.H || cp tables.H tables.h
+
+lint: $(CFILES) tables.c
+ lint $(LINTOPTS) $(PREFLAGS) -I$(CDIR) $(CFILES) tables.c
+clean:
+ rm -f *.o tables.c tables.h debug.out cg tables.H
+
+distr: tables.c
+ rm -f tables1.c tables1.h
+ cp tables.c tables1.c
+ cp tables.h tables1.h
+ chmod -w tables1.[ch]
+
+codegen.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+codegen.o: $(CDIR)/data.h
+codegen.o: $(CDIR)/equiv.h
+codegen.o: $(CDIR)/extern.h
+codegen.o: $(CDIR)/param.h
+codegen.o: $(CDIR)/result.h
+codegen.o: $(CDIR)/state.h
+codegen.o: tables.h
+codegen.o: $(CDIR)/types.h
+compute.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+compute.o: $(CDIR)/data.h
+compute.o: $(CDIR)/extern.h
+compute.o: $(CDIR)/glosym.h
+compute.o: $(CDIR)/label.h
+compute.o: $(CDIR)/param.h
+compute.o: $(CDIR)/result.h
+compute.o: tables.h
+compute.o: $(CDIR)/types.h
+equiv.o: $(CDIR)/assert.h
+equiv.o: $(CDIR)/data.h $(EMHOME)/h/cgg_cg.h
+equiv.o: $(CDIR)/equiv.h
+equiv.o: $(CDIR)/extern.h
+equiv.o: $(CDIR)/param.h
+equiv.o: $(CDIR)/result.h
+equiv.o: tables.h
+equiv.o: $(CDIR)/types.h
+fillem.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+fillem.o: $(CDIR)/data.h
+fillem.o: $(CDIR)/extern.h
+fillem.o: mach.c
+fillem.o: mach.h
+fillem.o: $(CDIR)/param.h
+fillem.o: $(CDIR)/regvar.h
+fillem.o: $(CDIR)/result.h
+fillem.o: tables.h
+fillem.o: $(CDIR)/types.h
+gencode.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+gencode.o: $(CDIR)/data.h
+gencode.o: $(CDIR)/extern.h
+gencode.o: $(CDIR)/param.h
+gencode.o: $(CDIR)/result.h
+gencode.o: tables.h
+gencode.o: $(CDIR)/types.h
+glosym.o: $(CDIR)/glosym.h
+glosym.o: $(CDIR)/param.h
+glosym.o: tables.h
+glosym.o: $(CDIR)/types.h
+label.o: $(CDIR)/label.h
+label.o: $(CDIR)/param.h
+label.o: tables.h
+label.o: $(CDIR)/types.h
+main.o: $(CDIR)/param.h
+main.o: tables.h
+move.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+move.o: $(CDIR)/data.h
+move.o: $(CDIR)/extern.h
+move.o: $(CDIR)/param.h
+move.o: $(CDIR)/result.h
+move.o: tables.h
+move.o: $(CDIR)/types.h
+nextem.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+nextem.o: $(CDIR)/data.h
+nextem.o: $(CDIR)/extern.h
+nextem.o: $(CDIR)/param.h
+nextem.o: $(CDIR)/result.h
+nextem.o: tables.h
+nextem.o: $(CDIR)/types.h
+reg.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+reg.o: $(CDIR)/data.h
+reg.o: $(CDIR)/extern.h
+reg.o: $(CDIR)/param.h
+reg.o: $(CDIR)/result.h
+reg.o: tables.h
+reg.o: $(CDIR)/types.h
+regvar.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+regvar.o: $(CDIR)/data.h
+regvar.o: $(CDIR)/extern.h
+regvar.o: $(CDIR)/param.h
+regvar.o: $(CDIR)/regvar.h
+regvar.o: $(CDIR)/result.h
+regvar.o: tables.h
+regvar.o: $(CDIR)/types.h
+salloc.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+salloc.o: $(CDIR)/data.h
+salloc.o: $(CDIR)/extern.h
+salloc.o: $(CDIR)/param.h
+salloc.o: $(CDIR)/result.h
+salloc.o: tables.h
+salloc.o: $(CDIR)/types.h
+state.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+state.o: $(CDIR)/data.h
+state.o: $(CDIR)/extern.h
+state.o: $(CDIR)/param.h
+state.o: $(CDIR)/result.h
+state.o: $(CDIR)/state.h
+state.o: tables.h
+state.o: $(CDIR)/types.h
+subr.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+subr.o: $(CDIR)/data.h
+subr.o: $(CDIR)/extern.h
+subr.o: $(CDIR)/param.h
+subr.o: $(CDIR)/result.h
+subr.o: tables.h
+subr.o: $(CDIR)/types.h
+var.o: $(CDIR)/data.h $(EMHOME)/h/cgg_cg.h
+var.o: $(CDIR)/param.h
+var.o: $(CDIR)/result.h
+var.o: tables.h
+var.o: $(CDIR)/types.h
diff --git a/mach/i86/as/Makefile b/mach/i86/as/Makefile
new file mode 100644
index 00000000..7455a482
--- /dev/null
+++ b/mach/i86/as/Makefile
@@ -0,0 +1,67 @@
+# $Header$
+EMHOME = ../../..
+h = $(EMHOME)/h
+LIBOBJ = $(EMHOME)/modules/lib/libobject.a
+CDIR = $(EMHOME)/mach/proto/as
+CPP = $(EMHOME)/lib/cpp
+DEF =
+
+FFLAG =
+INCL = -I. -I$h $(DEF)
+CFLAGS = $(FFLAG) -O $(INCL)
+YFLAGS = -d
+LDFLAGS = $(FFLAG)
+
+CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
+ $(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
+COBJ = comm3.o comm4.o comm5.o \
+ comm6.o comm7.o comm8.o
+MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
+COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
+
+all: as
+
+install:all
+ ../../install as
+
+cmp:
+ -../../compare as
+
+clean:
+ rm -f *.o as as.[cy] y.tab.h
+
+pr: $(MACH)
+ @pr -n $(MACH)
+
+opr:
+ make pr | opr
+as: $(COBJ) as.o
+ $(CC) $(LDFLAGS) $(COBJ) as.o $(LIBOBJ) -o as
+
+as.y: $(CDIR)/comm2.y
+ $(CPP) -P -I. -I$h $(DEF) $(CDIR)/comm2.y >as.y
+ -@if test -f Expect ; then cat Expect ; else echo "expect 1 shift/reduce conflict"; fi
+
+lint: $(CSRC) as.c
+ lint $(INCL) $(CSRC) as.c
+
+y.tab.h: as.c
+$(COBJ): y.tab.h
+$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
+$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
+as.y: mach2.c
+comm3.o: mach3.c
+as.y: mach4.c
+comm8.o: mach5.c
+comm3.o: $(CDIR)/comm3.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm3.c
+comm4.o: $(CDIR)/comm4.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm4.c
+comm5.o: $(CDIR)/comm5.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm5.c
+comm6.o: $(CDIR)/comm6.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm6.c
+comm7.o: $(CDIR)/comm7.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm7.c
+comm8.o: $(CDIR)/comm8.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm8.c
diff --git a/mach/i86/as/READ_ME b/mach/i86/as/READ_ME
new file mode 100644
index 00000000..b620073b
--- /dev/null
+++ b/mach/i86/as/READ_ME
@@ -0,0 +1,9 @@
+The mach?.c files in this directory were made for an earlier version of
+the universal assembler and are too dependent on its innards.
+I have no idea in what way they should be changed.
+
+ Duk Bekema
+
+I adapted them to the new framework. It appears to work now.
+
+ Ceriel Jacobs
diff --git a/mach/i86/ce/Makefile b/mach/i86/ce/Makefile
new file mode 100644
index 00000000..b08bc0fd
--- /dev/null
+++ b/mach/i86/ce/Makefile
@@ -0,0 +1,26 @@
+EMHOME = ../../..
+CEG = $(EMHOME)/lib/ceg/util
+OBJ = obj
+
+all:
+ make -f $(CEG)/make_asobj "OBJ="$(OBJ)
+
+install:
+ make -f $(CEG)/make_asobj "OBJ="$(OBJ) install
+
+cmp:
+ -make -f $(CEG)/make_asobj "OBJ="$(OBJ) cmp
+
+pr:
+ @pr Makefile EM_table mach.h mach.c as_table as.h as.c
+
+opr:
+ make pr | opr
+
+# total cleanup
+clean:
+ make -f $(CEG)/make_asobj "OBJ="$(OBJ) clean
+
+# only remove ce, ceg, and back directories
+dclean:
+ make -f $(CEG)/make_asobj "OBJ="$(OBJ) dclean
diff --git a/mach/i86/cv/Makefile b/mach/i86/cv/Makefile
new file mode 100644
index 00000000..5cfa97a6
--- /dev/null
+++ b/mach/i86/cv/Makefile
@@ -0,0 +1,25 @@
+EMHOME = ../../..
+LIBOBJ = $(EMHOME)/modules/lib/libobject.a
+INCLUDE = $(EMHOME)/h
+CFLAGS = -I. -I$(INCLUDE) -O
+TARGETS = cv
+
+all: $(TARGETS)
+
+install: all
+ ../../install cv
+
+cmp: all
+ ../../compare cv
+
+cv: cv.o
+ $(CC) $(LDFLAGS) -o cv cv.o $(LIBOBJ)
+
+clean:
+ rm -f $(TARGETS) *.o nohup.out Out
+
+pr:
+ @pr Makefile cv.c
+
+opr:
+ make pr | opr
diff --git a/mach/i86/libem/Makefile b/mach/i86/libem/Makefile
new file mode 100644
index 00000000..1924bb79
--- /dev/null
+++ b/mach/i86/libem/Makefile
@@ -0,0 +1,30 @@
+# $Header$
+MACH=i86
+
+all: libem_o.a end.o
+
+install: all
+ ../../install libem_o.a tail_em
+ ../../install end.o end_em
+
+cmp: all
+ -../../compare libem_o.a tail_em
+ -../../compare end.o end_em
+
+
+end.o: end.s
+ $(MACH) -I../../../h -O -c end.s
+
+libem_o.a: libem_s.a
+ ASAR=aal ; export ASAR ;\
+ march . libem_o.a
+
+clean:
+ rm -f *.o libem_o.a
+
+opr :
+ make pr | opr
+
+pr:
+ @arch pv libem_s.a | pr -h `pwd`/libem_s.a
+ @pr `pwd`/end.s
diff --git a/mach/i86/libem/compmodule b/mach/i86/libem/compmodule
new file mode 100755
index 00000000..8ec2f672
--- /dev/null
+++ b/mach/i86/libem/compmodule
@@ -0,0 +1,4 @@
+if i86 -c $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi
diff --git a/mach/i86/libem/end.s b/mach/i86/libem/end.s
new file mode 100644
index 00000000..6b9ce418
--- /dev/null
+++ b/mach/i86/libem/end.s
@@ -0,0 +1,17 @@
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define endtext,enddata,endbss
+.define _end,_etext,_edata
+
+ ! $Header$
+ .sect .text
+endtext:
+_etext:
+ .align 2
+ .sect .data
+enddata:
+_edata:
+ .align 2
+.sect .endsect
+_end:
+endbss:
+ .align 2
diff --git a/mach/i86/libem/fakfp.s b/mach/i86/libem/fakfp.s
new file mode 100644
index 00000000..bffaea36
--- /dev/null
+++ b/mach/i86/libem/fakfp.s
@@ -0,0 +1,38 @@
+.define .adf4, .adf8, .sbf4, .sbf8, .mlf4, .mlf8, .dvf4, .dvf8
+.define .ngf4, .ngf8, .fif4, .fif8, .fef4, .fef8
+.define .cif4, .cif8, .cuf4, .cuf8, .cfi, .cfu, .cff4, .cff8
+.define .cmf4, .cmf8
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+
+! $Header$
+
+ .sect .text
+.adf4:
+.adf8:
+.sbf4:
+.sbf8:
+.mlf4:
+.mlf8:
+.dvf4:
+.dvf8:
+.ngf4:
+.ngf8:
+.fif4:
+.fif8:
+.fef4:
+.fef8:
+.cif4:
+.cif8:
+.cuf4:
+.cuf8:
+.cfi:
+.cfu:
+.cff4:
+.cff8:
+.cmf4:
+.cmf8:
+ mov ax,18 ! illegal instruction EILLINS
+ jmp .trp
diff --git a/mach/i86/libem/printf.s b/mach/i86/libem/printf.s
new file mode 100644
index 00000000..83f13320
--- /dev/null
+++ b/mach/i86/libem/printf.s
@@ -0,0 +1,40 @@
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
+.define printf
+.extern printc, printd, prints
+
+printf:
+ pop bx ! return address
+ xchg ax,di
+ mov si,sp
+1:
+ movb al,(di)
+ inc di
+ testb al,al
+ jz 6f
+ cmpb al,'%'
+ je 3f
+2:
+ call printc
+ jmp 1b
+3:
+ movb al,(di)
+ inc di
+ cmpb al,'c'
+ jne 4f
+ lods
+ jmp 2b
+4:
+ cmpb al,'d'
+ jne 5f
+ lods
+ call printd
+ jmp 1b
+5:
+ cmpb al,'s'
+ jne 2b
+ lods
+ call prints
+ jmp 1b
+6:
+ jmp bx
diff --git a/mach/i86/libem/stop.s b/mach/i86/libem/stop.s
new file mode 100644
index 00000000..fbf0e691
--- /dev/null
+++ b/mach/i86/libem/stop.s
@@ -0,0 +1,5 @@
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
+.define .stop
+.stop:
+ int 3
diff --git a/mach/i86/libem/tail.s b/mach/i86/libem/tail.s
new file mode 100644
index 00000000..059b2376
--- /dev/null
+++ b/mach/i86/libem/tail.s
@@ -0,0 +1,16 @@
+.define endtext,enddata,endbss
+.define _end,_etext,_edata
+
+ ! $Header$
+ .text
+endtext:
+_etext:
+ .align 2
+ .data
+enddata:
+_edata:
+ .align 2
+ .bss
+_end:
+endbss:
+ .align 2
diff --git a/mach/i86/libfp/Makefile b/mach/i86/libfp/Makefile
new file mode 100644
index 00000000..67c3ad2d
--- /dev/null
+++ b/mach/i86/libfp/Makefile
@@ -0,0 +1,22 @@
+EMHOME=../../..
+SUF=o
+MAKEFILE=$(EMHOME)/mach/proto/fp/Makefile
+MACHDEF="MACH=i86" "SUF=$(SUF)" "ASAR=aal"
+
+all:
+ make -f $(MAKEFILE) $(MACHDEF) all
+
+install:
+ make -f $(MAKEFILE) $(MACHDEF) install
+
+cmp: all
+ -../../compare FP_$(MACH).a tail_fp
+
+clean:
+ make -f $(MAKEFILE) $(MACHDEF) clean
+
+opr:
+ make pr | opr
+
+pr:
+ @pr Makefile
diff --git a/mach/i86/libsys/Makefile b/mach/i86/libsys/Makefile
new file mode 100644
index 00000000..c03a0394
--- /dev/null
+++ b/mach/i86/libsys/Makefile
@@ -0,0 +1,27 @@
+# $Header$
+MACH=i86
+all: libmon_o.a head_em.o
+
+install: all
+ ../../install libmon_o.a tail_mon
+ ../../install head_em.o head_em
+
+cmp: all
+ -../../compare libmon_o.a tail_mon
+ -../../compare head_em.o head_em
+
+libmon_o.a: libmon_s.a
+ ASAR=aal ; export ASAR ;\
+ march . libmon_o.a
+
+head_em.o: head_em.s
+ $(MACH) -O -c head_em.s
+clean:
+ rm -f *.o libmon_o.a
+
+opr :
+ make pr | opr
+
+pr:
+ @pr `pwd`/head_em.s
+ @arch pv libmon_s.a | pr -h `pwd`/libmon_s.a
diff --git a/mach/i86/libsys/compmodule b/mach/i86/libsys/compmodule
new file mode 100755
index 00000000..70233902
--- /dev/null
+++ b/mach/i86/libsys/compmodule
@@ -0,0 +1,4 @@
+if i86 -c -L $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi
diff --git a/mach/i86/ncg/Makefile b/mach/i86/ncg/Makefile
new file mode 100644
index 00000000..f5e2bda6
--- /dev/null
+++ b/mach/i86/ncg/Makefile
@@ -0,0 +1,197 @@
+# $Header$
+
+EMHOME=../../..
+#preprocessor flags for table
+TABLEFLAGS=
+#cgg options
+CGGFLAGS=
+
+PREFLAGS=-I$(EMHOME)/h -I. -I$(EMHOME)/mach -I$(EMHOME)/modules/h -DNDEBUG
+PFLAGS=
+CFLAGS=$(PREFLAGS) $(PFLAGS) -O
+LDFLAGS=$(PFLAGS)
+LINTOPTS=-bx
+LIBS=$(EMHOME)/lib/em_data.a $(EMHOME)/modules/lib/libflt.a
+CDIR=$(EMHOME)/mach/proto/ncg
+CGG=$(EMHOME)/lib/ncgg
+CPP=$(EMHOME)/lib/cpp
+CFILES=$(CDIR)/codegen.c $(CDIR)/compute.c $(CDIR)/equiv.c $(CDIR)/fillem.c \
+ $(CDIR)/gencode.c $(CDIR)/glosym.c $(CDIR)/label.c $(CDIR)/main.c \
+ $(CDIR)/move.c $(CDIR)/nextem.c $(CDIR)/reg.c $(CDIR)/regvar.c \
+ $(CDIR)/salloc.c $(CDIR)/state.c $(CDIR)/subr.c $(CDIR)/var.c
+OFILES=codegen.o compute.o equiv.o fillem.o gencode.o glosym.o label.o \
+ main.o move.o nextem.o reg.o regvar.o salloc.o state.o subr.o var.o
+
+all: tables.c
+ make "EMHOME="$(EMHOME) cg
+
+cg: tables.o $(OFILES)
+ $(CC) $(LDFLAGS) $(OFILES) tables.o $(LIBS) -o cg
+
+tables.o: tables.c
+ $(CC) -c $(PREFLAGS) -I$(CDIR) tables.c
+
+codegen.o: $(CDIR)/codegen.c
+ $(CC) -c $(CFLAGS) $(CDIR)/codegen.c
+compute.o: $(CDIR)/compute.c
+ $(CC) -c $(CFLAGS) $(CDIR)/compute.c
+equiv.o: $(CDIR)/equiv.c
+ $(CC) -c $(CFLAGS) $(CDIR)/equiv.c
+fillem.o: $(CDIR)/fillem.c
+ $(CC) -c $(CFLAGS) $(CDIR)/fillem.c
+gencode.o: $(CDIR)/gencode.c
+ $(CC) -c $(CFLAGS) $(CDIR)/gencode.c
+glosym.o: $(CDIR)/glosym.c
+ $(CC) -c $(CFLAGS) $(CDIR)/glosym.c
+label.o: $(CDIR)/label.c
+ $(CC) -c $(CFLAGS) $(CDIR)/label.c
+main.o: $(CDIR)/main.c
+ $(CC) -c $(CFLAGS) $(CDIR)/main.c
+move.o: $(CDIR)/move.c
+ $(CC) -c $(CFLAGS) $(CDIR)/move.c
+nextem.o: $(CDIR)/nextem.c
+ $(CC) -c $(CFLAGS) $(CDIR)/nextem.c
+reg.o: $(CDIR)/reg.c
+ $(CC) -c $(CFLAGS) $(CDIR)/reg.c
+regvar.o: $(CDIR)/regvar.c
+ $(CC) -c $(CFLAGS) $(CDIR)/regvar.c
+salloc.o: $(CDIR)/salloc.c
+ $(CC) -c $(CFLAGS) $(CDIR)/salloc.c
+state.o: $(CDIR)/state.c
+ $(CC) -c $(CFLAGS) $(CDIR)/state.c
+subr.o: $(CDIR)/subr.c
+ $(CC) -c $(CFLAGS) $(CDIR)/subr.c
+var.o: $(CDIR)/var.c
+ $(CC) -c $(CFLAGS) $(CDIR)/var.c
+
+install: all
+ $(EMHOME)/mach/install cg
+
+cmp: all
+ -$(EMHOME)/mach/compare cg
+
+
+tables.c: table $(CGG)
+ $(CPP) $(TABLEFLAGS) table | $(CGG) $(CGGFLAGS)
+ -cmp tables.h tables.H || cp tables.H tables.h
+
+lint: $(CFILES) tables.c
+ lint $(LINTOPTS) $(PREFLAGS) -I$(CDIR) $(CFILES) tables.c
+clean:
+ rm -f *.o tables.c tables.h debug.out cg tables.H
+
+distr: tables.c
+ rm -f tables1.c tables1.h
+ cp tables.c tables1.c
+ cp tables.h tables1.h
+ chmod -w tables1.[ch]
+
+codegen.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+codegen.o: $(CDIR)/data.h
+codegen.o: $(CDIR)/equiv.h
+codegen.o: $(CDIR)/extern.h
+codegen.o: $(CDIR)/param.h
+codegen.o: $(CDIR)/result.h
+codegen.o: $(CDIR)/state.h
+codegen.o: tables.h
+codegen.o: $(CDIR)/types.h
+compute.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+compute.o: $(CDIR)/data.h
+compute.o: $(CDIR)/extern.h
+compute.o: $(CDIR)/glosym.h
+compute.o: $(CDIR)/label.h
+compute.o: $(CDIR)/param.h
+compute.o: $(CDIR)/result.h
+compute.o: tables.h
+compute.o: $(CDIR)/types.h
+equiv.o: $(CDIR)/assert.h
+equiv.o: $(CDIR)/data.h $(EMHOME)/h/cgg_cg.h
+equiv.o: $(CDIR)/equiv.h
+equiv.o: $(CDIR)/extern.h
+equiv.o: $(CDIR)/param.h
+equiv.o: $(CDIR)/result.h
+equiv.o: tables.h
+equiv.o: $(CDIR)/types.h
+fillem.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+fillem.o: $(CDIR)/data.h
+fillem.o: $(CDIR)/extern.h
+fillem.o: mach.c
+fillem.o: mach.h
+fillem.o: $(CDIR)/param.h
+fillem.o: $(CDIR)/regvar.h
+fillem.o: $(CDIR)/result.h
+fillem.o: tables.h
+fillem.o: $(CDIR)/types.h
+gencode.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+gencode.o: $(CDIR)/data.h
+gencode.o: $(CDIR)/extern.h
+gencode.o: $(CDIR)/param.h
+gencode.o: $(CDIR)/result.h
+gencode.o: tables.h
+gencode.o: $(CDIR)/types.h
+glosym.o: $(CDIR)/glosym.h
+glosym.o: $(CDIR)/param.h
+glosym.o: tables.h
+glosym.o: $(CDIR)/types.h
+label.o: $(CDIR)/label.h
+label.o: $(CDIR)/param.h
+label.o: tables.h
+label.o: $(CDIR)/types.h
+main.o: $(CDIR)/param.h
+main.o: tables.h
+move.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+move.o: $(CDIR)/data.h
+move.o: $(CDIR)/extern.h
+move.o: $(CDIR)/param.h
+move.o: $(CDIR)/result.h
+move.o: tables.h
+move.o: $(CDIR)/types.h
+nextem.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+nextem.o: $(CDIR)/data.h
+nextem.o: $(CDIR)/extern.h
+nextem.o: $(CDIR)/param.h
+nextem.o: $(CDIR)/result.h
+nextem.o: tables.h
+nextem.o: $(CDIR)/types.h
+reg.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+reg.o: $(CDIR)/data.h
+reg.o: $(CDIR)/extern.h
+reg.o: $(CDIR)/param.h
+reg.o: $(CDIR)/result.h
+reg.o: tables.h
+reg.o: $(CDIR)/types.h
+regvar.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+regvar.o: $(CDIR)/data.h
+regvar.o: $(CDIR)/extern.h
+regvar.o: $(CDIR)/param.h
+regvar.o: $(CDIR)/regvar.h
+regvar.o: $(CDIR)/result.h
+regvar.o: tables.h
+regvar.o: $(CDIR)/types.h
+salloc.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+salloc.o: $(CDIR)/data.h
+salloc.o: $(CDIR)/extern.h
+salloc.o: $(CDIR)/param.h
+salloc.o: $(CDIR)/result.h
+salloc.o: tables.h
+salloc.o: $(CDIR)/types.h
+state.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+state.o: $(CDIR)/data.h
+state.o: $(CDIR)/extern.h
+state.o: $(CDIR)/param.h
+state.o: $(CDIR)/result.h
+state.o: $(CDIR)/state.h
+state.o: tables.h
+state.o: $(CDIR)/types.h
+subr.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+subr.o: $(CDIR)/data.h
+subr.o: $(CDIR)/extern.h
+subr.o: $(CDIR)/param.h
+subr.o: $(CDIR)/result.h
+subr.o: tables.h
+subr.o: $(CDIR)/types.h
+var.o: $(CDIR)/data.h $(EMHOME)/h/cgg_cg.h
+var.o: $(CDIR)/param.h
+var.o: $(CDIR)/result.h
+var.o: tables.h
+var.o: $(CDIR)/types.h
diff --git a/mach/install b/mach/install
new file mode 100755
index 00000000..8d87ed14
--- /dev/null
+++ b/mach/install
@@ -0,0 +1,21 @@
+case $# in
+1) DEST="$1" ;;
+2) DEST="$2" ;;
+*) echo $0 [source] destination ;;
+esac
+MACH=`(cd .. ; basename \`pwd\`)`
+mkdir ../../../lib/$MACH >/dev/null 2>&1
+if cp "$1" ../../../lib/${MACH}/$DEST >/dev/null 2>&1 ||
+ { rm -f ../../../lib/${MACH}/$DEST >/dev/null 2>&1 &&
+ cp "$1" ../../../lib/${MACH}/$DEST >/dev/null 2>&1
+ }
+then
+ if (ar t ../../../lib/${MACH}/$DEST | grep __.SYMDEF ) >/dev/null 2>&1
+ then
+ ranlib ../../../lib/${MACH}/$DEST
+ fi
+ exit 0
+else
+ echo Sorry, can not create "lib/${MACH}/$DEST".
+ exit 1
+fi
diff --git a/mach/m68020/as/Makefile b/mach/m68020/as/Makefile
new file mode 100644
index 00000000..7455a482
--- /dev/null
+++ b/mach/m68020/as/Makefile
@@ -0,0 +1,67 @@
+# $Header$
+EMHOME = ../../..
+h = $(EMHOME)/h
+LIBOBJ = $(EMHOME)/modules/lib/libobject.a
+CDIR = $(EMHOME)/mach/proto/as
+CPP = $(EMHOME)/lib/cpp
+DEF =
+
+FFLAG =
+INCL = -I. -I$h $(DEF)
+CFLAGS = $(FFLAG) -O $(INCL)
+YFLAGS = -d
+LDFLAGS = $(FFLAG)
+
+CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
+ $(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
+COBJ = comm3.o comm4.o comm5.o \
+ comm6.o comm7.o comm8.o
+MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
+COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
+
+all: as
+
+install:all
+ ../../install as
+
+cmp:
+ -../../compare as
+
+clean:
+ rm -f *.o as as.[cy] y.tab.h
+
+pr: $(MACH)
+ @pr -n $(MACH)
+
+opr:
+ make pr | opr
+as: $(COBJ) as.o
+ $(CC) $(LDFLAGS) $(COBJ) as.o $(LIBOBJ) -o as
+
+as.y: $(CDIR)/comm2.y
+ $(CPP) -P -I. -I$h $(DEF) $(CDIR)/comm2.y >as.y
+ -@if test -f Expect ; then cat Expect ; else echo "expect 1 shift/reduce conflict"; fi
+
+lint: $(CSRC) as.c
+ lint $(INCL) $(CSRC) as.c
+
+y.tab.h: as.c
+$(COBJ): y.tab.h
+$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
+$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
+as.y: mach2.c
+comm3.o: mach3.c
+as.y: mach4.c
+comm8.o: mach5.c
+comm3.o: $(CDIR)/comm3.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm3.c
+comm4.o: $(CDIR)/comm4.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm4.c
+comm5.o: $(CDIR)/comm5.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm5.c
+comm6.o: $(CDIR)/comm6.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm6.c
+comm7.o: $(CDIR)/comm7.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm7.c
+comm8.o: $(CDIR)/comm8.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm8.c
diff --git a/mach/m68020/ce/Makefile b/mach/m68020/ce/Makefile
new file mode 100644
index 00000000..b08bc0fd
--- /dev/null
+++ b/mach/m68020/ce/Makefile
@@ -0,0 +1,26 @@
+EMHOME = ../../..
+CEG = $(EMHOME)/lib/ceg/util
+OBJ = obj
+
+all:
+ make -f $(CEG)/make_asobj "OBJ="$(OBJ)
+
+install:
+ make -f $(CEG)/make_asobj "OBJ="$(OBJ) install
+
+cmp:
+ -make -f $(CEG)/make_asobj "OBJ="$(OBJ) cmp
+
+pr:
+ @pr Makefile EM_table mach.h mach.c as_table as.h as.c
+
+opr:
+ make pr | opr
+
+# total cleanup
+clean:
+ make -f $(CEG)/make_asobj "OBJ="$(OBJ) clean
+
+# only remove ce, ceg, and back directories
+dclean:
+ make -f $(CEG)/make_asobj "OBJ="$(OBJ) dclean
diff --git a/mach/m68020/cv/Makefile b/mach/m68020/cv/Makefile
new file mode 100644
index 00000000..292eacbb
--- /dev/null
+++ b/mach/m68020/cv/Makefile
@@ -0,0 +1,22 @@
+CFLAGS=-O -I../../../h
+LDFLAGS =
+
+cv: cv.o
+ $(CC) -o cv $(LDFLAGS) cv.o
+
+install: ins_cv
+ins_cv: cv
+ ../../install cv
+
+cmp: cmp_cv
+cmp_cv: cv
+ -../../compare cv
+
+opr:
+ make pr | opr
+
+pr:
+ @pr `pwd`/cv.c
+
+clean:
+ -rm -f *.o *.old cv
diff --git a/mach/m68020/libem/Makefile b/mach/m68020/libem/Makefile
new file mode 100644
index 00000000..1233a1f0
--- /dev/null
+++ b/mach/m68020/libem/Makefile
@@ -0,0 +1,38 @@
+# $Header$
+MACH=m68020
+ASAR=aal
+all: libem_o.a end.a
+
+install: all
+ ../../install libem_o.a tail_em
+ ../../install end.a end_em
+
+cmp: all
+ -../../compare libem_o.a tail_em
+ -../../compare end.a end_em
+
+end.a: em_end.s etext.s edata.s end.s
+ $(MACH) -I../../../h -c em_end.s
+ $(MACH) -I../../../h -c edata.s
+ $(MACH) -I../../../h -c etext.s
+ $(MACH) -I../../../h -c end.s
+ $(ASAR) cr end.a em_end.o etext.o edata.o end.o
+
+libem_o.a: libem_s.a
+ ASAR=$(ASAR) ; export ASAR ;\
+ march . libem_o.a
+
+clean:
+ rm -f *.o libem_o.a end.a
+
+opr :
+ make pr | opr
+
+pr:
+ @arch pv libem_s.a | pr -h `pwd`/libem_s.a
+ @pr `pwd`/em_end.s `pwd`/edata.s `pwd`/etext.s `pwd`/end.s
+
+trpstr.s: trpstr.c strscript
+ sh strscript
+
+distr: trpstr.s
diff --git a/mach/m68020/libem/compmodule b/mach/m68020/libem/compmodule
new file mode 100755
index 00000000..a61e867b
--- /dev/null
+++ b/mach/m68020/libem/compmodule
@@ -0,0 +1,4 @@
+if m68020 -c $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi
diff --git a/mach/m68020/libem/edata.s b/mach/m68020/libem/edata.s
new file mode 100644
index 00000000..f53adc10
--- /dev/null
+++ b/mach/m68020/libem/edata.s
@@ -0,0 +1,9 @@
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.define _edata
+.sect .data
+ .align 4
+ .sect .data
+_edata:
diff --git a/mach/m68020/libem/em_end.s b/mach/m68020/libem/em_end.s
new file mode 100644
index 00000000..a062368d
--- /dev/null
+++ b/mach/m68020/libem/em_end.s
@@ -0,0 +1,22 @@
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.define endtext,enddata,endbss,__end
+.sect .text
+ .align 4
+.sect .rom
+ .align 4
+.sect .data
+ .align 4
+.sect .bss
+ .align 4
+.sect .end ! only for declaration of _end, __end and endbss.
+
+ .sect .text
+endtext:
+ .sect .data
+enddata:
+ .sect .end
+__end:
+endbss:
diff --git a/mach/m68020/libem/end.s b/mach/m68020/libem/end.s
new file mode 100644
index 00000000..93a1e6e0
--- /dev/null
+++ b/mach/m68020/libem/end.s
@@ -0,0 +1,7 @@
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.define _end
+.sect .end ! only for declaration of _end, __end and endbss.
+_end:
diff --git a/mach/m68020/libem/etext.s b/mach/m68020/libem/etext.s
new file mode 100644
index 00000000..8c7453cb
--- /dev/null
+++ b/mach/m68020/libem/etext.s
@@ -0,0 +1,9 @@
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.define _etext
+.sect .text
+ .align 4
+ .sect .text
+_etext:
diff --git a/mach/m68020/libem/fakfp.s b/mach/m68020/libem/fakfp.s
new file mode 100644
index 00000000..f6e6d240
--- /dev/null
+++ b/mach/m68020/libem/fakfp.s
@@ -0,0 +1,39 @@
+.define .adf4, .adf8, .sbf4, .sbf8, .mlf4, .mlf8, .dvf4, .dvf8
+.define .ngf4, .ngf8, .fif4, .fif8, .fef4, .fef8
+.define .cif4, .cif8, .cuf4, .cuf8, .cfi, .cfu, .cff4, .cff8
+.define .cmf4, .cmf8
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+
+! $Header$
+
+ .sect .text
+.adf4:
+.adf8:
+.sbf4:
+.sbf8:
+.mlf4:
+.mlf8:
+.dvf4:
+.dvf8:
+.ngf4:
+.ngf8:
+.fif4:
+.fif8:
+.fef4:
+.fef8:
+.cif4:
+.cif8:
+.cuf4:
+.cuf8:
+.cfi:
+.cfu:
+.cff4:
+.cff8:
+.cmf4:
+.cmf8:
+ move.l #18,-(sp)
+ jsr (.trp)
+ rts
diff --git a/mach/m68020/libem/printf.s b/mach/m68020/libem/printf.s
new file mode 100644
index 00000000..0ec7553c
--- /dev/null
+++ b/mach/m68020/libem/printf.s
@@ -0,0 +1,83 @@
+.define _printf, _putchar, _getal, _char
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .bss
+_getal:
+ .space 12
+_char:
+ .space 1
+ .align 4
+.sect .data
+hexs:
+ .ascii "0123456789abcdef"
+ .align 4
+.sect .text
+_printf:
+ movem.l d0/d1/d2/a0/a1/a2/a3/a4/a5/a6, -(sp)
+ lea (44, sp), a6 ! a6 <- address of arguments
+ move.l (a6)+, a5 ! a5 <- address of format
+next: move.b (a5)+, d0
+ beq out
+ cmp.b #'%', d0
+ beq procnt
+put: move.l d0, -(sp)
+ jsr (_putchar) ! long argument on stack
+ tst.l (sp)+
+ bra next
+
+procnt: move.b (a5)+, d0
+ cmp.b #'d', d0 ! NOTE: %d means unsigned.
+ beq digit
+ cmp.b #'x', d0
+ beq hex
+ cmp.b #'s', d0
+ beq string
+ cmp.b #'%', d0 ! second % has to be printed.
+ beq put
+ tst.b -(a5) ! normal char should be printed
+ bra next
+
+string: move.l (a6)+, a2 ! a2 <- address of string
+sloop: move.b (a2)+, d0
+ beq next
+ move.l d0, -(sp)
+ jsr (_putchar) ! long argument on stack
+ tst.l (sp)+
+ bra sloop
+
+digit: move.l (a6)+, d1 ! d1 <- integer
+ move.l #_getal+12, a2 ! a2 <- ptr to last part of buf
+ clr.b -(a2) ! stringterminator
+1: divul.l #10, d2:d1 ! d1 <- qotient; d2 <- remainder
+ add.l #'0', d2
+ move.b d2, -(a2)
+ tst.l d1 ! if quotient = 0 then ready
+ bne 1b
+ bra sloop ! print digitstring.
+
+hex: move.l (a6)+, d1 ! d1 <- integer
+ move.l #_getal+12, a2 ! a2 <- ptr to last part of buf
+ clr.b -(a2) ! stringterminator
+ move.l #7, d2 ! loop control
+1: move.l d1, d0
+ and.l #15, d0
+ move.b (hexs,d0.w), -(a2) ! hex digit
+ asr.l #4, d1
+ dbf d2, 1b
+ bra sloop
+
+out:
+ movem.l (sp)+, d0/d1/d2/a0/a1/a2/a3/a4/a5/a6
+ rts
+
+
+_putchar:
+ move.l #1, -(sp)
+ pea (11,sp)
+ move.l #1, -(sp)
+ jsr (_write)
+ lea (12, sp), sp
+ rts
+.align 2
diff --git a/mach/m68020/libem/strscript b/mach/m68020/libem/strscript
new file mode 100644
index 00000000..ee4cc1b4
--- /dev/null
+++ b/mach/m68020/libem/strscript
@@ -0,0 +1,3 @@
+m68020 -c.s -L -LIB -I../../../h trpstr.c
+sed s/_trpstr/.trpstr/g < trpstr.s > trpstr.ss
+mv trpstr.ss trpstr.s
diff --git a/mach/m68020/libfp/Makefile b/mach/m68020/libfp/Makefile
new file mode 100644
index 00000000..22e6c795
--- /dev/null
+++ b/mach/m68020/libfp/Makefile
@@ -0,0 +1,22 @@
+EMHOME=../../..
+SUF=o
+MAKEFILE=$(EMHOME)/mach/proto/fp/Makefile
+MACHDEF="MACH=m68020" "CFLAGS=-DUSE_DIVIDE" "SUF=$(SUF)" "ASAR=aal"
+
+all:
+ make -f $(MAKEFILE) $(MACHDEF) all
+
+install:
+ make -f $(MAKEFILE) $(MACHDEF) install
+
+cmp: all
+ -../../compare FP_$(MACH).a tail_fp
+
+clean:
+ make -f $(MAKEFILE) $(MACHDEF) clean
+
+opr:
+ make pr | opr
+
+pr:
+ @pr Makefile
diff --git a/mach/m68020/libsys/Makefile b/mach/m68020/libsys/Makefile
new file mode 100644
index 00000000..5861ef1d
--- /dev/null
+++ b/mach/m68020/libsys/Makefile
@@ -0,0 +1,29 @@
+# $Header$
+MACH=m68020
+all: libmon_o.a head_em.o
+
+install: all
+ ../../install head_em.o head_em
+ ../../install libmon_o.a tail_mon
+
+
+cmp: all
+ -../../compare head_em.o head_em
+ -../../compare libmon_o.a tail_mon
+
+libmon_o.a: libmon_s.a
+ ASAR=aal ; export ASAR ;\
+ march . libmon_o.a
+
+head_em.o: head_em.s
+ $(MACH) -I../../../h -c head_em.s
+
+clean:
+ rm -f *.o libmon_o.a
+
+opr :
+ make pr | opr
+
+pr:
+ @pr `pwd`/head_em.s
+ @arch pv libmon_s.a | pr -h `pwd`/libmon_s.a
diff --git a/mach/m68020/libsys/compmodule b/mach/m68020/libsys/compmodule
new file mode 100755
index 00000000..58dc66c6
--- /dev/null
+++ b/mach/m68020/libsys/compmodule
@@ -0,0 +1,4 @@
+if m68020 -c -L $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi
diff --git a/mach/m68020/ncg/Makefile b/mach/m68020/ncg/Makefile
new file mode 100644
index 00000000..f5e2bda6
--- /dev/null
+++ b/mach/m68020/ncg/Makefile
@@ -0,0 +1,197 @@
+# $Header$
+
+EMHOME=../../..
+#preprocessor flags for table
+TABLEFLAGS=
+#cgg options
+CGGFLAGS=
+
+PREFLAGS=-I$(EMHOME)/h -I. -I$(EMHOME)/mach -I$(EMHOME)/modules/h -DNDEBUG
+PFLAGS=
+CFLAGS=$(PREFLAGS) $(PFLAGS) -O
+LDFLAGS=$(PFLAGS)
+LINTOPTS=-bx
+LIBS=$(EMHOME)/lib/em_data.a $(EMHOME)/modules/lib/libflt.a
+CDIR=$(EMHOME)/mach/proto/ncg
+CGG=$(EMHOME)/lib/ncgg
+CPP=$(EMHOME)/lib/cpp
+CFILES=$(CDIR)/codegen.c $(CDIR)/compute.c $(CDIR)/equiv.c $(CDIR)/fillem.c \
+ $(CDIR)/gencode.c $(CDIR)/glosym.c $(CDIR)/label.c $(CDIR)/main.c \
+ $(CDIR)/move.c $(CDIR)/nextem.c $(CDIR)/reg.c $(CDIR)/regvar.c \
+ $(CDIR)/salloc.c $(CDIR)/state.c $(CDIR)/subr.c $(CDIR)/var.c
+OFILES=codegen.o compute.o equiv.o fillem.o gencode.o glosym.o label.o \
+ main.o move.o nextem.o reg.o regvar.o salloc.o state.o subr.o var.o
+
+all: tables.c
+ make "EMHOME="$(EMHOME) cg
+
+cg: tables.o $(OFILES)
+ $(CC) $(LDFLAGS) $(OFILES) tables.o $(LIBS) -o cg
+
+tables.o: tables.c
+ $(CC) -c $(PREFLAGS) -I$(CDIR) tables.c
+
+codegen.o: $(CDIR)/codegen.c
+ $(CC) -c $(CFLAGS) $(CDIR)/codegen.c
+compute.o: $(CDIR)/compute.c
+ $(CC) -c $(CFLAGS) $(CDIR)/compute.c
+equiv.o: $(CDIR)/equiv.c
+ $(CC) -c $(CFLAGS) $(CDIR)/equiv.c
+fillem.o: $(CDIR)/fillem.c
+ $(CC) -c $(CFLAGS) $(CDIR)/fillem.c
+gencode.o: $(CDIR)/gencode.c
+ $(CC) -c $(CFLAGS) $(CDIR)/gencode.c
+glosym.o: $(CDIR)/glosym.c
+ $(CC) -c $(CFLAGS) $(CDIR)/glosym.c
+label.o: $(CDIR)/label.c
+ $(CC) -c $(CFLAGS) $(CDIR)/label.c
+main.o: $(CDIR)/main.c
+ $(CC) -c $(CFLAGS) $(CDIR)/main.c
+move.o: $(CDIR)/move.c
+ $(CC) -c $(CFLAGS) $(CDIR)/move.c
+nextem.o: $(CDIR)/nextem.c
+ $(CC) -c $(CFLAGS) $(CDIR)/nextem.c
+reg.o: $(CDIR)/reg.c
+ $(CC) -c $(CFLAGS) $(CDIR)/reg.c
+regvar.o: $(CDIR)/regvar.c
+ $(CC) -c $(CFLAGS) $(CDIR)/regvar.c
+salloc.o: $(CDIR)/salloc.c
+ $(CC) -c $(CFLAGS) $(CDIR)/salloc.c
+state.o: $(CDIR)/state.c
+ $(CC) -c $(CFLAGS) $(CDIR)/state.c
+subr.o: $(CDIR)/subr.c
+ $(CC) -c $(CFLAGS) $(CDIR)/subr.c
+var.o: $(CDIR)/var.c
+ $(CC) -c $(CFLAGS) $(CDIR)/var.c
+
+install: all
+ $(EMHOME)/mach/install cg
+
+cmp: all
+ -$(EMHOME)/mach/compare cg
+
+
+tables.c: table $(CGG)
+ $(CPP) $(TABLEFLAGS) table | $(CGG) $(CGGFLAGS)
+ -cmp tables.h tables.H || cp tables.H tables.h
+
+lint: $(CFILES) tables.c
+ lint $(LINTOPTS) $(PREFLAGS) -I$(CDIR) $(CFILES) tables.c
+clean:
+ rm -f *.o tables.c tables.h debug.out cg tables.H
+
+distr: tables.c
+ rm -f tables1.c tables1.h
+ cp tables.c tables1.c
+ cp tables.h tables1.h
+ chmod -w tables1.[ch]
+
+codegen.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+codegen.o: $(CDIR)/data.h
+codegen.o: $(CDIR)/equiv.h
+codegen.o: $(CDIR)/extern.h
+codegen.o: $(CDIR)/param.h
+codegen.o: $(CDIR)/result.h
+codegen.o: $(CDIR)/state.h
+codegen.o: tables.h
+codegen.o: $(CDIR)/types.h
+compute.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+compute.o: $(CDIR)/data.h
+compute.o: $(CDIR)/extern.h
+compute.o: $(CDIR)/glosym.h
+compute.o: $(CDIR)/label.h
+compute.o: $(CDIR)/param.h
+compute.o: $(CDIR)/result.h
+compute.o: tables.h
+compute.o: $(CDIR)/types.h
+equiv.o: $(CDIR)/assert.h
+equiv.o: $(CDIR)/data.h $(EMHOME)/h/cgg_cg.h
+equiv.o: $(CDIR)/equiv.h
+equiv.o: $(CDIR)/extern.h
+equiv.o: $(CDIR)/param.h
+equiv.o: $(CDIR)/result.h
+equiv.o: tables.h
+equiv.o: $(CDIR)/types.h
+fillem.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+fillem.o: $(CDIR)/data.h
+fillem.o: $(CDIR)/extern.h
+fillem.o: mach.c
+fillem.o: mach.h
+fillem.o: $(CDIR)/param.h
+fillem.o: $(CDIR)/regvar.h
+fillem.o: $(CDIR)/result.h
+fillem.o: tables.h
+fillem.o: $(CDIR)/types.h
+gencode.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+gencode.o: $(CDIR)/data.h
+gencode.o: $(CDIR)/extern.h
+gencode.o: $(CDIR)/param.h
+gencode.o: $(CDIR)/result.h
+gencode.o: tables.h
+gencode.o: $(CDIR)/types.h
+glosym.o: $(CDIR)/glosym.h
+glosym.o: $(CDIR)/param.h
+glosym.o: tables.h
+glosym.o: $(CDIR)/types.h
+label.o: $(CDIR)/label.h
+label.o: $(CDIR)/param.h
+label.o: tables.h
+label.o: $(CDIR)/types.h
+main.o: $(CDIR)/param.h
+main.o: tables.h
+move.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+move.o: $(CDIR)/data.h
+move.o: $(CDIR)/extern.h
+move.o: $(CDIR)/param.h
+move.o: $(CDIR)/result.h
+move.o: tables.h
+move.o: $(CDIR)/types.h
+nextem.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+nextem.o: $(CDIR)/data.h
+nextem.o: $(CDIR)/extern.h
+nextem.o: $(CDIR)/param.h
+nextem.o: $(CDIR)/result.h
+nextem.o: tables.h
+nextem.o: $(CDIR)/types.h
+reg.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+reg.o: $(CDIR)/data.h
+reg.o: $(CDIR)/extern.h
+reg.o: $(CDIR)/param.h
+reg.o: $(CDIR)/result.h
+reg.o: tables.h
+reg.o: $(CDIR)/types.h
+regvar.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+regvar.o: $(CDIR)/data.h
+regvar.o: $(CDIR)/extern.h
+regvar.o: $(CDIR)/param.h
+regvar.o: $(CDIR)/regvar.h
+regvar.o: $(CDIR)/result.h
+regvar.o: tables.h
+regvar.o: $(CDIR)/types.h
+salloc.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+salloc.o: $(CDIR)/data.h
+salloc.o: $(CDIR)/extern.h
+salloc.o: $(CDIR)/param.h
+salloc.o: $(CDIR)/result.h
+salloc.o: tables.h
+salloc.o: $(CDIR)/types.h
+state.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+state.o: $(CDIR)/data.h
+state.o: $(CDIR)/extern.h
+state.o: $(CDIR)/param.h
+state.o: $(CDIR)/result.h
+state.o: $(CDIR)/state.h
+state.o: tables.h
+state.o: $(CDIR)/types.h
+subr.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+subr.o: $(CDIR)/data.h
+subr.o: $(CDIR)/extern.h
+subr.o: $(CDIR)/param.h
+subr.o: $(CDIR)/result.h
+subr.o: tables.h
+subr.o: $(CDIR)/types.h
+var.o: $(CDIR)/data.h $(EMHOME)/h/cgg_cg.h
+var.o: $(CDIR)/param.h
+var.o: $(CDIR)/result.h
+var.o: tables.h
+var.o: $(CDIR)/types.h
diff --git a/mach/m68020/top/Makefile b/mach/m68020/top/Makefile
new file mode 100644
index 00000000..57908427
--- /dev/null
+++ b/mach/m68020/top/Makefile
@@ -0,0 +1,42 @@
+EMHOME=../../..
+LIBS=$(EMHOME)/modules/lib/libstring.a
+PREFLAGS=-I.
+PFLAGS=
+CFLAGS=$(PREFLAGS) $(PFLAGS) -O -DNDEBUG
+LDFLAGS=$(PFLAGS)
+LINTOPTS=-bx
+CDIR=$(EMHOME)/mach/proto/top
+CFILES=$(CDIR)/top.c $(CDIR)/queue.c
+OFILES=top.o queue.o
+
+all: gen.c
+ make top
+
+top: $(OFILES)
+ $(CC) $(LDFLAGS) $(OFILES) $(LIBS) -o top
+
+top.o: $(CDIR)/top.c gen.c
+ $(CC) -c $(CFLAGS) $(CDIR)/top.c
+
+queue.o: $(CDIR)/queue.c
+ $(CC) -c $(CFLAGS) $(CDIR)/queue.c
+
+install: all
+ $(EMHOME)/mach/install top
+
+cmp: all
+ -$(EMHOME)/mach/compare top
+
+gen.c: table
+ $(EMHOME)/lib/topgen table
+
+lint: $(CFILES)
+ lint $(LINTOPTS) $(PREFLAGS) $(CFILES)
+
+clean:
+ rm -f *.o gen.c gen.h top
+
+top.o: gen.h
+top.o: $(CDIR)/top.h
+top.o: $(CDIR)/queue.h
+queue.o: $(CDIR)/queue.h
diff --git a/mach/m68k2/as/Makefile b/mach/m68k2/as/Makefile
new file mode 100644
index 00000000..7455a482
--- /dev/null
+++ b/mach/m68k2/as/Makefile
@@ -0,0 +1,67 @@
+# $Header$
+EMHOME = ../../..
+h = $(EMHOME)/h
+LIBOBJ = $(EMHOME)/modules/lib/libobject.a
+CDIR = $(EMHOME)/mach/proto/as
+CPP = $(EMHOME)/lib/cpp
+DEF =
+
+FFLAG =
+INCL = -I. -I$h $(DEF)
+CFLAGS = $(FFLAG) -O $(INCL)
+YFLAGS = -d
+LDFLAGS = $(FFLAG)
+
+CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
+ $(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
+COBJ = comm3.o comm4.o comm5.o \
+ comm6.o comm7.o comm8.o
+MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
+COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
+
+all: as
+
+install:all
+ ../../install as
+
+cmp:
+ -../../compare as
+
+clean:
+ rm -f *.o as as.[cy] y.tab.h
+
+pr: $(MACH)
+ @pr -n $(MACH)
+
+opr:
+ make pr | opr
+as: $(COBJ) as.o
+ $(CC) $(LDFLAGS) $(COBJ) as.o $(LIBOBJ) -o as
+
+as.y: $(CDIR)/comm2.y
+ $(CPP) -P -I. -I$h $(DEF) $(CDIR)/comm2.y >as.y
+ -@if test -f Expect ; then cat Expect ; else echo "expect 1 shift/reduce conflict"; fi
+
+lint: $(CSRC) as.c
+ lint $(INCL) $(CSRC) as.c
+
+y.tab.h: as.c
+$(COBJ): y.tab.h
+$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
+$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
+as.y: mach2.c
+comm3.o: mach3.c
+as.y: mach4.c
+comm8.o: mach5.c
+comm3.o: $(CDIR)/comm3.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm3.c
+comm4.o: $(CDIR)/comm4.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm4.c
+comm5.o: $(CDIR)/comm5.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm5.c
+comm6.o: $(CDIR)/comm6.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm6.c
+comm7.o: $(CDIR)/comm7.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm7.c
+comm8.o: $(CDIR)/comm8.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm8.c
diff --git a/mach/m68k2/cg/fppsim.h b/mach/m68k2/cg/fppsim.h
new file mode 100644
index 00000000..a7d621e2
--- /dev/null
+++ b/mach/m68k2/cg/fppsim.h
@@ -0,0 +1,6 @@
+/* $Header$ */
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+/* #define NOFLOAT /* define when not using fpp simulator */
diff --git a/mach/m68k2/cv/Makefile b/mach/m68k2/cv/Makefile
new file mode 100644
index 00000000..d0a00288
--- /dev/null
+++ b/mach/m68k2/cv/Makefile
@@ -0,0 +1,22 @@
+CFLAGS=-I../../../h -O
+LDFLAGS =
+
+cv: cv.o
+ $(CC) -o cv $(LDFLAGS) cv.o
+
+install: ins_cv
+ins_cv: cv
+ ../../install cv
+
+cmp: cmp_cv
+cmp_cv: cv
+ -../../compare cv
+
+opr:
+ make pr | opr
+
+pr:
+ @pr `pwd`/cv.c
+
+clean:
+ -rm -f *.o *.old cv
diff --git a/mach/m68k2/dl/Makefile b/mach/m68k2/dl/Makefile
new file mode 100644
index 00000000..e5217610
--- /dev/null
+++ b/mach/m68k2/dl/Makefile
@@ -0,0 +1,22 @@
+EMHOME=../../..
+OBJLIB=$(EMHOME)/modules/lib/libobject.a
+
+head: dl
+
+dl: dl.c
+ $(CC) -I$(EMHOME)/h -o dl dl.c $(OBJLIB)
+
+install: head
+ @echo Nothing is installed
+
+cmp: head
+ @echo Nothing is compared
+
+clean:
+ rm -f *.o
+
+pr:
+ @pr `pwd`/Makefile `pwd`/dl.c
+
+opr:
+ make pr | opr
diff --git a/mach/m68k2/libem/Makefile b/mach/m68k2/libem/Makefile
new file mode 100644
index 00000000..b8a2346a
--- /dev/null
+++ b/mach/m68k2/libem/Makefile
@@ -0,0 +1,33 @@
+# $Header$
+MACH=m68k2
+ASAR=aal
+all: libem_o.a end.a
+
+install: all
+ ../../install libem_o.a tail_em
+ ../../install end.a end_em
+
+cmp: all
+ -../../compare libem_o.a tail_em
+ -../../compare end.a end_em
+
+end.a: em_end.s etext.s edata.s end.s
+ $(MACH) -I../../../h -c em_end.s
+ $(MACH) -I../../../h -c edata.s
+ $(MACH) -I../../../h -c etext.s
+ $(MACH) -I../../../h -c end.s
+ $(ASAR) cr end.a em_end.o etext.o edata.o end.o
+
+libem_o.a: libem_s.a
+ ASAR=$(ASAR) ; export ASAR ;\
+ march . libem_o.a
+
+clean:
+ rm -f *.o libem_o.a end.a
+
+opr :
+ make pr | opr
+
+pr:
+ @arch pv libem_s.a | pr -h `pwd`/libem_s.a
+ @pr `pwd`/em_end.s `pwd`/edata.s `pwd`/etext.s `pwd`/end.s
diff --git a/mach/m68k2/libem/compmodule b/mach/m68k2/libem/compmodule
new file mode 100755
index 00000000..02105f21
--- /dev/null
+++ b/mach/m68k2/libem/compmodule
@@ -0,0 +1,4 @@
+if m68k2 -c $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi
diff --git a/mach/m68k2/libem/cvf.s b/mach/m68k2/libem/cvf.s
new file mode 100644
index 00000000..dc2c5d2e
--- /dev/null
+++ b/mach/m68k2/libem/cvf.s
@@ -0,0 +1,19 @@
+.define .cfi,.cif,.cfu,.cuf,.cff
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+
+ .sect .text
+
+ ! this is a dummy float conversion routine
+.cfi:
+.cif:
+.cfu:
+.cuf:
+.cff:
+ move.l (sp)+,a0 ! return address
+ move (sp)+,d0 ! destination size
+ sub (sp)+,d0 ! diff. in sizes
+ sub d0,sp
+ jmp (a0)
diff --git a/mach/m68k2/libem/edata.s b/mach/m68k2/libem/edata.s
new file mode 100644
index 00000000..f53adc10
--- /dev/null
+++ b/mach/m68k2/libem/edata.s
@@ -0,0 +1,9 @@
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.define _edata
+.sect .data
+ .align 4
+ .sect .data
+_edata:
diff --git a/mach/m68k2/libem/em_end.s b/mach/m68k2/libem/em_end.s
new file mode 100644
index 00000000..a062368d
--- /dev/null
+++ b/mach/m68k2/libem/em_end.s
@@ -0,0 +1,22 @@
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.define endtext,enddata,endbss,__end
+.sect .text
+ .align 4
+.sect .rom
+ .align 4
+.sect .data
+ .align 4
+.sect .bss
+ .align 4
+.sect .end ! only for declaration of _end, __end and endbss.
+
+ .sect .text
+endtext:
+ .sect .data
+enddata:
+ .sect .end
+__end:
+endbss:
diff --git a/mach/m68k2/libem/end.s b/mach/m68k2/libem/end.s
new file mode 100644
index 00000000..93a1e6e0
--- /dev/null
+++ b/mach/m68k2/libem/end.s
@@ -0,0 +1,7 @@
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.define _end
+.sect .end ! only for declaration of _end, __end and endbss.
+_end:
diff --git a/mach/m68k2/libem/etext.s b/mach/m68k2/libem/etext.s
new file mode 100644
index 00000000..8c7453cb
--- /dev/null
+++ b/mach/m68k2/libem/etext.s
@@ -0,0 +1,9 @@
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.define _etext
+.sect .text
+ .align 4
+ .sect .text
+_etext:
diff --git a/mach/m68k2/libem/ffp.s b/mach/m68k2/libem/ffp.s
new file mode 100644
index 00000000..ab99094c
--- /dev/null
+++ b/mach/m68k2/libem/ffp.s
@@ -0,0 +1,39 @@
+.define .adf4, .adf8, .sbf4, .sbf8, .mlf4, .mlf8, .dvf4, .dvf8
+.define .ngf4, .ngf8, .fif4, .fif8, .fef4, .fef8
+.define .cif4, .cif8, .cuf4, .cuf8, .cfi, .cfu, .cff4, .cff8
+.define .cmf4, .cmf8
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+
+! $Header$
+
+ .sect .text
+.adf4:
+.adf8:
+.sbf4:
+.sbf8:
+.mlf4:
+.mlf8:
+.dvf4:
+.dvf8:
+.ngf4:
+.ngf8:
+.fif4:
+.fif8:
+.fef4:
+.fef8:
+.cif4:
+.cif8:
+.cuf4:
+.cuf8:
+.cfi:
+.cfu:
+.cff4:
+.cff8:
+.cmf4:
+.cmf8:
+ move.w #18,-(sp)
+ jsr .trp
+ rts
diff --git a/mach/m68k2/libem/printf.s b/mach/m68k2/libem/printf.s
new file mode 100644
index 00000000..044484df
--- /dev/null
+++ b/mach/m68k2/libem/printf.s
@@ -0,0 +1,189 @@
+.define _printn
+.define _printf
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_putchar:
+ move.w #1,-(sp)
+ pea 7(sp)
+ move.w #1,-(sp)
+ jsr _write
+ add.l #8,sp
+ rts
+_printf:
+ link a6,#-12
+.sect .data
+_12:
+ .data2 28786
+ .data2 26990
+ .data2 29798
+ .data2 11875
+ .data2 0
+.sect .text
+ pea 8+4(a6)
+ move.l (sp)+,-6(a6)
+I004:
+ move.l 8+0(a6),-(sp)
+ move.l (sp),-(sp)
+ move.l (sp)+,a0
+ add #1,a0
+ move.l a0,-(sp)
+ move.l (sp)+,8+0(a6)
+ move.l (sp)+,a0
+ clr d0
+ move.b (a0),d0
+ move.w d0,-(sp)
+ move.w (sp),-(sp)
+ move.w (sp)+,-2(a6)
+ move.w #37,-(sp)
+ move.w (sp)+,d0
+ cmp (sp)+,d0
+ beq I005
+ move.w -2(a6),-(sp)
+ tst (sp)+
+ beq I002
+ move.w -2(a6),-(sp)
+ jsr _putchar
+ add #2,sp
+ jmp I004
+I005:
+ move.l 8+0(a6),-(sp)
+ move.l (sp),-(sp)
+ move.l (sp)+,a0
+ add #1,a0
+ move.l a0,-(sp)
+ move.l (sp)+,8+0(a6)
+ move.l (sp)+,a0
+ clr d0
+ move.b (a0),d0
+ move.w d0,-(sp)
+ move.w (sp)+,-2(a6)
+ move.w -2(a6),-(sp)
+ move.w #100,-(sp)
+ move.w (sp)+,d0
+ cmp (sp)+,d0
+ beq I008
+ move.w -2(a6),-(sp)
+ move.w #117,-(sp)
+ move.w (sp)+,d0
+ cmp (sp)+,d0
+ bne I007
+I008:
+ move.l -6(a6),-(sp)
+ move.l (sp)+,a0
+ add #2,a0
+ move.l a0,-(sp)
+ move.l (sp),-(sp)
+ move.l (sp)+,-6(a6)
+ move.l (sp)+,a0
+ move.w -2(a0),-(sp)
+ move.w (sp)+,-8(a6)
+ move.w -2(a6),-(sp)
+ move.w #100,-(sp)
+ move.w (sp)+,d0
+ cmp (sp)+,d0
+ bne I009
+ move.w -8(a6),-(sp)
+ tst (sp)+
+ bge I009
+ move.w #0,-(sp)
+ move.w -8(a6),-(sp)
+ move.w (sp)+,d0
+ move.w (sp)+,d1
+ sub d0,d1
+ move.w d1,-(sp)
+ move.w (sp)+,-8(a6)
+ move.w #45,-(sp)
+ jsr _putchar
+ add #2,sp
+I009:
+ move.w -8(a6),-(sp)
+ jsr _printn
+ add #2,sp
+ jmp I004
+I007:
+ move.w -2(a6),-(sp)
+ move.w #115,-(sp)
+ move.w (sp)+,d0
+ cmp (sp)+,d0
+ bne I004
+ move.l -6(a6),-(sp)
+ move.l (sp)+,a0
+ add #4,a0
+ move.l a0,-(sp)
+ move.l (sp),-(sp)
+ move.l (sp)+,-6(a6)
+ move.l (sp)+,a0
+ move.l -4(a0),-(sp)
+ move.l (sp)+,-12(a6)
+I00c:
+ move.l -12(a6),-(sp)
+ move.l (sp),-(sp)
+ move.l (sp)+,a0
+ add #1,a0
+ move.l a0,-(sp)
+ move.l (sp)+,-12(a6)
+ move.l (sp)+,a0
+ clr d0
+ move.b (a0),d0
+ move.w d0,-(sp)
+ move.w (sp),-(sp)
+ move.w (sp)+,-2(a6)
+ tst (sp)+
+ beq I004
+ move.w -2(a6),-(sp)
+ jsr _putchar
+ add #2,sp
+ jmp I00c
+I002:
+ unlk a6
+ rts
+_printn:
+ link a6,#-2
+.sect .data
+_15:
+ .data2 12337
+ .data2 12851
+ .data2 13365
+ .data2 13879
+ .data2 14393
+ .data2 0
+.sect .text
+ move.w 8+0(a6),-(sp)
+ move.w #10,-(sp)
+ move.w (sp)+,d0
+ clr.l d1
+ move.w (sp)+,d1
+ divu d0,d1
+ move.w d1,-(sp)
+ move.w (sp),-(sp)
+ move.w (sp)+,-2(a6)
+ tst (sp)+
+ beq I013
+ move.w -2(a6),-(sp)
+ jsr _printn
+ add #2,sp
+I013:
+ pea _15
+ move.w 8+0(a6),-(sp)
+ move.w #10,-(sp)
+ move.w (sp)+,d0
+ clr.l d1
+ move.w (sp)+,d1
+ divu d0,d1
+ swap d1
+ move.w d1,-(sp)
+ move.w (sp)+,d0
+ ext.l d0
+ add.l (sp)+,d0
+ move.l d0,-(sp)
+ move.l (sp)+,a0
+ clr d0
+ move.b (a0),d0
+ move.w d0,-(sp)
+ jsr _putchar
+ add #2,sp
+ unlk a6
+ rts
diff --git a/mach/m68k2/libfp/Makefile b/mach/m68k2/libfp/Makefile
new file mode 100644
index 00000000..37ab1e98
--- /dev/null
+++ b/mach/m68k2/libfp/Makefile
@@ -0,0 +1,22 @@
+EMHOME=../../..
+SUF=o
+MAKEFILE=$(EMHOME)/mach/proto/fp/Makefile
+MACHDEF="MACH=m68k2" "SUF=$(SUF)" "ASAR=aal"
+
+all:
+ make -f $(MAKEFILE) $(MACHDEF) all
+
+install:
+ make -f $(MAKEFILE) $(MACHDEF) install
+
+cmp: all
+ -../../compare FP_$(MACH).a tail_fp
+
+clean:
+ make -f $(MAKEFILE) $(MACHDEF) clean
+
+opr:
+ make pr | opr
+
+pr:
+ @pr Makefile
diff --git a/mach/m68k2/libsys/Makefile b/mach/m68k2/libsys/Makefile
new file mode 100644
index 00000000..1caeccd0
--- /dev/null
+++ b/mach/m68k2/libsys/Makefile
@@ -0,0 +1,28 @@
+# $Header$
+MACH=m68k2
+all: libmon_o.a head_em.o
+
+install: all
+ ../../install head_em.o head_em
+ ../../install libmon_o.a tail_mon
+
+cmp: all
+ -../../compare head_em.o head_em
+ -../../compare libmon_o.a tail_mon
+
+libmon_o.a: libmon_s.a
+ ASAR=aal ; export ASAR ;\
+ march . libmon_o.a
+
+head_em.o: head_em.s
+ $(MACH) -c -I../../../h head_em.s
+
+clean:
+ rm -f *.o libmon_o.a
+
+opr :
+ make pr | opr
+
+pr:
+ @pr `pwd`/head_em.s
+ @arch pv libmon_s.a | pr -h `pwd`/libmon_s.a
diff --git a/mach/m68k2/libsys/compmodule b/mach/m68k2/libsys/compmodule
new file mode 100755
index 00000000..bfdaef6d
--- /dev/null
+++ b/mach/m68k2/libsys/compmodule
@@ -0,0 +1,4 @@
+if m68k2 -c -L $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi
diff --git a/mach/m68k2/ncg/Makefile b/mach/m68k2/ncg/Makefile
new file mode 100644
index 00000000..f5e2bda6
--- /dev/null
+++ b/mach/m68k2/ncg/Makefile
@@ -0,0 +1,197 @@
+# $Header$
+
+EMHOME=../../..
+#preprocessor flags for table
+TABLEFLAGS=
+#cgg options
+CGGFLAGS=
+
+PREFLAGS=-I$(EMHOME)/h -I. -I$(EMHOME)/mach -I$(EMHOME)/modules/h -DNDEBUG
+PFLAGS=
+CFLAGS=$(PREFLAGS) $(PFLAGS) -O
+LDFLAGS=$(PFLAGS)
+LINTOPTS=-bx
+LIBS=$(EMHOME)/lib/em_data.a $(EMHOME)/modules/lib/libflt.a
+CDIR=$(EMHOME)/mach/proto/ncg
+CGG=$(EMHOME)/lib/ncgg
+CPP=$(EMHOME)/lib/cpp
+CFILES=$(CDIR)/codegen.c $(CDIR)/compute.c $(CDIR)/equiv.c $(CDIR)/fillem.c \
+ $(CDIR)/gencode.c $(CDIR)/glosym.c $(CDIR)/label.c $(CDIR)/main.c \
+ $(CDIR)/move.c $(CDIR)/nextem.c $(CDIR)/reg.c $(CDIR)/regvar.c \
+ $(CDIR)/salloc.c $(CDIR)/state.c $(CDIR)/subr.c $(CDIR)/var.c
+OFILES=codegen.o compute.o equiv.o fillem.o gencode.o glosym.o label.o \
+ main.o move.o nextem.o reg.o regvar.o salloc.o state.o subr.o var.o
+
+all: tables.c
+ make "EMHOME="$(EMHOME) cg
+
+cg: tables.o $(OFILES)
+ $(CC) $(LDFLAGS) $(OFILES) tables.o $(LIBS) -o cg
+
+tables.o: tables.c
+ $(CC) -c $(PREFLAGS) -I$(CDIR) tables.c
+
+codegen.o: $(CDIR)/codegen.c
+ $(CC) -c $(CFLAGS) $(CDIR)/codegen.c
+compute.o: $(CDIR)/compute.c
+ $(CC) -c $(CFLAGS) $(CDIR)/compute.c
+equiv.o: $(CDIR)/equiv.c
+ $(CC) -c $(CFLAGS) $(CDIR)/equiv.c
+fillem.o: $(CDIR)/fillem.c
+ $(CC) -c $(CFLAGS) $(CDIR)/fillem.c
+gencode.o: $(CDIR)/gencode.c
+ $(CC) -c $(CFLAGS) $(CDIR)/gencode.c
+glosym.o: $(CDIR)/glosym.c
+ $(CC) -c $(CFLAGS) $(CDIR)/glosym.c
+label.o: $(CDIR)/label.c
+ $(CC) -c $(CFLAGS) $(CDIR)/label.c
+main.o: $(CDIR)/main.c
+ $(CC) -c $(CFLAGS) $(CDIR)/main.c
+move.o: $(CDIR)/move.c
+ $(CC) -c $(CFLAGS) $(CDIR)/move.c
+nextem.o: $(CDIR)/nextem.c
+ $(CC) -c $(CFLAGS) $(CDIR)/nextem.c
+reg.o: $(CDIR)/reg.c
+ $(CC) -c $(CFLAGS) $(CDIR)/reg.c
+regvar.o: $(CDIR)/regvar.c
+ $(CC) -c $(CFLAGS) $(CDIR)/regvar.c
+salloc.o: $(CDIR)/salloc.c
+ $(CC) -c $(CFLAGS) $(CDIR)/salloc.c
+state.o: $(CDIR)/state.c
+ $(CC) -c $(CFLAGS) $(CDIR)/state.c
+subr.o: $(CDIR)/subr.c
+ $(CC) -c $(CFLAGS) $(CDIR)/subr.c
+var.o: $(CDIR)/var.c
+ $(CC) -c $(CFLAGS) $(CDIR)/var.c
+
+install: all
+ $(EMHOME)/mach/install cg
+
+cmp: all
+ -$(EMHOME)/mach/compare cg
+
+
+tables.c: table $(CGG)
+ $(CPP) $(TABLEFLAGS) table | $(CGG) $(CGGFLAGS)
+ -cmp tables.h tables.H || cp tables.H tables.h
+
+lint: $(CFILES) tables.c
+ lint $(LINTOPTS) $(PREFLAGS) -I$(CDIR) $(CFILES) tables.c
+clean:
+ rm -f *.o tables.c tables.h debug.out cg tables.H
+
+distr: tables.c
+ rm -f tables1.c tables1.h
+ cp tables.c tables1.c
+ cp tables.h tables1.h
+ chmod -w tables1.[ch]
+
+codegen.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+codegen.o: $(CDIR)/data.h
+codegen.o: $(CDIR)/equiv.h
+codegen.o: $(CDIR)/extern.h
+codegen.o: $(CDIR)/param.h
+codegen.o: $(CDIR)/result.h
+codegen.o: $(CDIR)/state.h
+codegen.o: tables.h
+codegen.o: $(CDIR)/types.h
+compute.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+compute.o: $(CDIR)/data.h
+compute.o: $(CDIR)/extern.h
+compute.o: $(CDIR)/glosym.h
+compute.o: $(CDIR)/label.h
+compute.o: $(CDIR)/param.h
+compute.o: $(CDIR)/result.h
+compute.o: tables.h
+compute.o: $(CDIR)/types.h
+equiv.o: $(CDIR)/assert.h
+equiv.o: $(CDIR)/data.h $(EMHOME)/h/cgg_cg.h
+equiv.o: $(CDIR)/equiv.h
+equiv.o: $(CDIR)/extern.h
+equiv.o: $(CDIR)/param.h
+equiv.o: $(CDIR)/result.h
+equiv.o: tables.h
+equiv.o: $(CDIR)/types.h
+fillem.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+fillem.o: $(CDIR)/data.h
+fillem.o: $(CDIR)/extern.h
+fillem.o: mach.c
+fillem.o: mach.h
+fillem.o: $(CDIR)/param.h
+fillem.o: $(CDIR)/regvar.h
+fillem.o: $(CDIR)/result.h
+fillem.o: tables.h
+fillem.o: $(CDIR)/types.h
+gencode.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+gencode.o: $(CDIR)/data.h
+gencode.o: $(CDIR)/extern.h
+gencode.o: $(CDIR)/param.h
+gencode.o: $(CDIR)/result.h
+gencode.o: tables.h
+gencode.o: $(CDIR)/types.h
+glosym.o: $(CDIR)/glosym.h
+glosym.o: $(CDIR)/param.h
+glosym.o: tables.h
+glosym.o: $(CDIR)/types.h
+label.o: $(CDIR)/label.h
+label.o: $(CDIR)/param.h
+label.o: tables.h
+label.o: $(CDIR)/types.h
+main.o: $(CDIR)/param.h
+main.o: tables.h
+move.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+move.o: $(CDIR)/data.h
+move.o: $(CDIR)/extern.h
+move.o: $(CDIR)/param.h
+move.o: $(CDIR)/result.h
+move.o: tables.h
+move.o: $(CDIR)/types.h
+nextem.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+nextem.o: $(CDIR)/data.h
+nextem.o: $(CDIR)/extern.h
+nextem.o: $(CDIR)/param.h
+nextem.o: $(CDIR)/result.h
+nextem.o: tables.h
+nextem.o: $(CDIR)/types.h
+reg.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+reg.o: $(CDIR)/data.h
+reg.o: $(CDIR)/extern.h
+reg.o: $(CDIR)/param.h
+reg.o: $(CDIR)/result.h
+reg.o: tables.h
+reg.o: $(CDIR)/types.h
+regvar.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+regvar.o: $(CDIR)/data.h
+regvar.o: $(CDIR)/extern.h
+regvar.o: $(CDIR)/param.h
+regvar.o: $(CDIR)/regvar.h
+regvar.o: $(CDIR)/result.h
+regvar.o: tables.h
+regvar.o: $(CDIR)/types.h
+salloc.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+salloc.o: $(CDIR)/data.h
+salloc.o: $(CDIR)/extern.h
+salloc.o: $(CDIR)/param.h
+salloc.o: $(CDIR)/result.h
+salloc.o: tables.h
+salloc.o: $(CDIR)/types.h
+state.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+state.o: $(CDIR)/data.h
+state.o: $(CDIR)/extern.h
+state.o: $(CDIR)/param.h
+state.o: $(CDIR)/result.h
+state.o: $(CDIR)/state.h
+state.o: tables.h
+state.o: $(CDIR)/types.h
+subr.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+subr.o: $(CDIR)/data.h
+subr.o: $(CDIR)/extern.h
+subr.o: $(CDIR)/param.h
+subr.o: $(CDIR)/result.h
+subr.o: tables.h
+subr.o: $(CDIR)/types.h
+var.o: $(CDIR)/data.h $(EMHOME)/h/cgg_cg.h
+var.o: $(CDIR)/param.h
+var.o: $(CDIR)/result.h
+var.o: tables.h
+var.o: $(CDIR)/types.h
diff --git a/mach/m68k2/ncg/table_link b/mach/m68k2/ncg/table_link
new file mode 100644
index 00000000..226ca8c2
--- /dev/null
+++ b/mach/m68k2/ncg/table_link
@@ -0,0 +1 @@
+TABLE = mach/m68020/ncg/table
diff --git a/mach/m68k2/top/Makefile b/mach/m68k2/top/Makefile
new file mode 100644
index 00000000..57908427
--- /dev/null
+++ b/mach/m68k2/top/Makefile
@@ -0,0 +1,42 @@
+EMHOME=../../..
+LIBS=$(EMHOME)/modules/lib/libstring.a
+PREFLAGS=-I.
+PFLAGS=
+CFLAGS=$(PREFLAGS) $(PFLAGS) -O -DNDEBUG
+LDFLAGS=$(PFLAGS)
+LINTOPTS=-bx
+CDIR=$(EMHOME)/mach/proto/top
+CFILES=$(CDIR)/top.c $(CDIR)/queue.c
+OFILES=top.o queue.o
+
+all: gen.c
+ make top
+
+top: $(OFILES)
+ $(CC) $(LDFLAGS) $(OFILES) $(LIBS) -o top
+
+top.o: $(CDIR)/top.c gen.c
+ $(CC) -c $(CFLAGS) $(CDIR)/top.c
+
+queue.o: $(CDIR)/queue.c
+ $(CC) -c $(CFLAGS) $(CDIR)/queue.c
+
+install: all
+ $(EMHOME)/mach/install top
+
+cmp: all
+ -$(EMHOME)/mach/compare top
+
+gen.c: table
+ $(EMHOME)/lib/topgen table
+
+lint: $(CFILES)
+ lint $(LINTOPTS) $(PREFLAGS) $(CFILES)
+
+clean:
+ rm -f *.o gen.c gen.h top
+
+top.o: gen.h
+top.o: $(CDIR)/top.h
+top.o: $(CDIR)/queue.h
+queue.o: $(CDIR)/queue.h
diff --git a/mach/m68k4/libem/Makefile b/mach/m68k4/libem/Makefile
new file mode 100644
index 00000000..5457c453
--- /dev/null
+++ b/mach/m68k4/libem/Makefile
@@ -0,0 +1,33 @@
+# $Header$
+MACH=m68k4
+ASAR=aal
+all: libem_o.a end.a
+
+install: all
+ ../../install libem_o.a tail_em
+ ../../install end.a end_em
+
+cmp: all
+ -../../compare libem_o.a tail_em
+ -../../compare end.a end_em
+
+end.a: em_end.s etext.s edata.s end.s
+ $(MACH) -I../../../h -c em_end.s
+ $(MACH) -I../../../h -c edata.s
+ $(MACH) -I../../../h -c etext.s
+ $(MACH) -I../../../h -c end.s
+ $(ASAR) cr end.a em_end.o etext.o edata.o end.o
+
+libem_o.a: libem_s.a
+ ASAR=$(ASAR) ; export ASAR ;\
+ march . libem_o.a
+
+clean:
+ rm -f *.o libem_o.a end.a
+
+opr :
+ make pr | opr
+
+pr:
+ @arch pv libem_s.a | pr -h `pwd`/libem_s.a
+ @pr `pwd`/em_end.s `pwd`/edata.s `pwd`/etext.s `pwd`/end.s
diff --git a/mach/m68k4/libem/aciaio.s b/mach/m68k4/libem/aciaio.s
new file mode 100644
index 00000000..09577e1f
--- /dev/null
+++ b/mach/m68k4/libem/aciaio.s
@@ -0,0 +1,36 @@
+.define .outch1,.outch2,.inch1,.inch2
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+
+ ! a0,d0 used
+ ! character in d1
+
+ .sect .text
+.inch1:
+ move.l #acia1,a0
+ bra .inch
+.inch2:
+ move.l #acia2,a0
+.inch:
+ move.b (a0),d1
+ asr #1,d1
+ bcc .inch
+ move.b 2(a0),d1
+ and #0x7f,d1
+ rts
+
+.outch1:
+ move.l #acia1,a0
+ bra .outch
+.outch2:
+ move.l #acia2,a0
+.outch:
+ move.b (a0),d0
+ asr #2,d0
+ bcc .outch
+ move.b d1,2(a0)
+ rts
+
+.align 2
diff --git a/mach/m68k4/libem/ara.s b/mach/m68k4/libem/ara.s
new file mode 100644
index 00000000..e4e9ab19
--- /dev/null
+++ b/mach/m68k4/libem/ara.s
@@ -0,0 +1,101 @@
+.define .sar
+.define .lar
+.define .aar
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+
+ !register usage:
+ ! a0 : descriptor address
+ ! d0 : index
+ ! a1 : base address
+ .sect .text
+.aar:
+ move.l 4(sp),a0 ! descriptor address
+ move.l 8(sp),d0 ! index
+ sub.l (a0),d0 ! index - lower bound : relative index
+ move.l 8(a0),-(sp) ! # bytes / element
+ move.l d0,-(sp)
+ jsr .mlu
+ move.l 12(sp),a1 ! base address
+ add.l d1,a1 ! address of element
+ move.l (sp)+,a0 ! return address
+ add.l #8,sp ! pop arguments
+ move.l a1,(sp) ! returned on stack
+ jmp (a0)
+
+.lar:
+ ! register usage: like .aar
+
+ move.l 4(sp),a0
+ move.l 8(sp),d0
+ move.l 12(sp),a1
+ sub.l (a0),d0
+ move.l d0,-(sp)
+ move.l 8(a0),-(sp)
+ jsr .mlu
+ move.l 12(sp),a1
+ move.l 4(sp),a0
+ add.l d1,a1 ! address of element
+ move.l 8(a0),d0
+ add.l d0,a1 ! a1++ because of predecrement
+ move.l (sp)+,a0 ! return address
+ add.l #12,sp ! pop parameters
+ clr.l d1 !?nodig?
+ asr #1,d0
+ bne 3f
+ move.b -(a1),d1 ! 1 byte element
+ move.l d1,-(sp)
+ bra 5f
+3:
+ asr #1,d0
+ bne 4f
+ move.w -(a1),d1 ! 2 byte element
+ move.l d1,-(sp)
+ bra 5f
+4:
+ sub.l #1,d0
+1:
+ move.l -(a1),-(sp) ! 4n byte element (n = 1,2,...)
+ dbf d0,1b
+5:
+ jmp (a0)
+
+.sar:
+ !register usage: same as lar
+
+ move.l 4(sp),a0
+ move.l 8(sp),d0
+ move.l 12(sp),a1
+ sub.l (a0),d0
+ move.l d0,-(sp)
+ move.l 8(a0),-(sp)
+ jsr .mlu
+ move.l 12(sp),a1
+ move.l 4(sp),a0
+ add.l d1,a1
+ move.l 8(a0),d0 ! # bytes / element
+ move.l (sp)+,a0 ! return address
+ add.l #12,sp ! pop parameters
+ clr.l d1 !?nodig?
+ asr #1,d0
+ bne 3f
+ move.l (sp)+,d1
+ move.b d1,(a1) ! 1 byte element
+ bra 4f
+3:
+ asr #1,d0
+ bne 5f
+ move.l (sp)+,d1
+ move.w d1,(a1) ! 2 byte element
+ bra 4f
+5:
+ sub.l #1,d0
+1:
+ move.l (sp)+,(a1)+ ! 4n byte element (n = 1,2,...)
+ dbf d0,1b
+4:
+ jmp (a0)
+
+.align 2
diff --git a/mach/m68k4/libem/ari.s b/mach/m68k4/libem/ari.s
new file mode 100644
index 00000000..cefb0f66
--- /dev/null
+++ b/mach/m68k4/libem/ari.s
@@ -0,0 +1,36 @@
+.define .sari
+.define .lari
+.define .aari
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+
+ .sect .text
+.aari:
+ move.l (sp)+,d0 ! return address
+ cmp.l #4, (sp)+ ! size of descriptor elements
+ bne 9f
+ move.l d0,-(sp)
+ jmp .aar
+
+
+.lari:
+ move.l (sp)+,d0 ! return address
+ cmp.l #4, (sp)+ ! size of descriptor elements
+ bne 9f
+ move.l d0,-(sp)
+ jmp .lar
+9:
+ move.w #EILLINS,-(sp)
+ jmp .fat
+
+
+.sari:
+ move.l (sp)+,d0 ! return address
+ cmp.l #4, (sp)+ ! size of descriptor elements
+ bne 9b
+ move.l d0,-(sp)
+ jmp .sar
+
+.align 2
diff --git a/mach/m68k4/libem/compmodule b/mach/m68k4/libem/compmodule
new file mode 100755
index 00000000..80f42aab
--- /dev/null
+++ b/mach/m68k4/libem/compmodule
@@ -0,0 +1,4 @@
+if m68k4 -c $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi
diff --git a/mach/m68k4/libem/cvf.s b/mach/m68k4/libem/cvf.s
new file mode 100644
index 00000000..74dcc928
--- /dev/null
+++ b/mach/m68k4/libem/cvf.s
@@ -0,0 +1,21 @@
+.define .cfi,.cif,.cfu,.cuf,.cff
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+
+ .sect .text
+
+ ! this is a dummy float conversion routine
+.cfi:
+.cif:
+.cfu:
+.cuf:
+.cff:
+ move.l (sp)+,a0 ! return address
+ move (sp)+,d0 ! destination size
+ sub (sp)+,d0 ! diff. in sizes
+ sub d0,sp
+ jmp (a0)
+
+.align 2
diff --git a/mach/m68k4/libem/edata.s b/mach/m68k4/libem/edata.s
new file mode 100644
index 00000000..f53adc10
--- /dev/null
+++ b/mach/m68k4/libem/edata.s
@@ -0,0 +1,9 @@
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.define _edata
+.sect .data
+ .align 4
+ .sect .data
+_edata:
diff --git a/mach/m68k4/libem/em_end.s b/mach/m68k4/libem/em_end.s
new file mode 100644
index 00000000..a062368d
--- /dev/null
+++ b/mach/m68k4/libem/em_end.s
@@ -0,0 +1,22 @@
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.define endtext,enddata,endbss,__end
+.sect .text
+ .align 4
+.sect .rom
+ .align 4
+.sect .data
+ .align 4
+.sect .bss
+ .align 4
+.sect .end ! only for declaration of _end, __end and endbss.
+
+ .sect .text
+endtext:
+ .sect .data
+enddata:
+ .sect .end
+__end:
+endbss:
diff --git a/mach/m68k4/libem/end.s b/mach/m68k4/libem/end.s
new file mode 100644
index 00000000..93a1e6e0
--- /dev/null
+++ b/mach/m68k4/libem/end.s
@@ -0,0 +1,7 @@
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.define _end
+.sect .end ! only for declaration of _end, __end and endbss.
+_end:
diff --git a/mach/m68k4/libem/etext.s b/mach/m68k4/libem/etext.s
new file mode 100644
index 00000000..8c7453cb
--- /dev/null
+++ b/mach/m68k4/libem/etext.s
@@ -0,0 +1,9 @@
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.define _etext
+.sect .text
+ .align 4
+ .sect .text
+_etext:
diff --git a/mach/m68k4/libem/fakfp.s b/mach/m68k4/libem/fakfp.s
new file mode 100644
index 00000000..1c039b65
--- /dev/null
+++ b/mach/m68k4/libem/fakfp.s
@@ -0,0 +1,39 @@
+.define .adf4, .adf8, .sbf4, .sbf8, .mlf4, .mlf8, .dvf4, .dvf8
+.define .ngf4, .ngf8, .fif4, .fif8, .fef4, .fef8
+.define .cif4, .cif8, .cuf4, .cuf8, .cfi, .cfu, .cff4, .cff8
+.define .cmf4, .cmf8
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+
+! $Header$
+
+ .sect .text
+.adf4:
+.adf8:
+.sbf4:
+.sbf8:
+.mlf4:
+.mlf8:
+.dvf4:
+.dvf8:
+.ngf4:
+.ngf8:
+.fif4:
+.fif8:
+.fef4:
+.fef8:
+.cif4:
+.cif8:
+.cuf4:
+.cuf8:
+.cfi:
+.cfu:
+.cff4:
+.cff8:
+.cmf4:
+.cmf8:
+ move.l #18,-(sp)
+ jsr .trp
+ rts
diff --git a/mach/m68k4/libem/printf.s b/mach/m68k4/libem/printf.s
new file mode 100644
index 00000000..b0fcbe9d
--- /dev/null
+++ b/mach/m68k4/libem/printf.s
@@ -0,0 +1,88 @@
+.define _printf
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .bss
+_getal:
+ .space 12
+_char:
+ .space 1
+ .align 4
+.sect .data
+hexs:
+ .ascii "0123456789abcdef"
+ .align 4
+.sect .text
+_printf:
+ movem.l d0/d1/d2/a0/a1/a2/a3/a4/a5/a6, -(sp)
+ lea 44(sp), a6 ! a6 <- address of arguments
+ move.l (a6)+, a5 ! a5 <- address of format
+next: move.b (a5)+, d0
+ beq out
+ cmp.b #'%', d0
+ beq procnt
+put: move.l d0, -(sp)
+ jsr _putchar ! long argument on stack
+ tst.l (sp)+
+ bra next
+
+procnt: move.b (a5)+, d0
+ cmp.b #'d', d0 ! NOTE: %d means unsigned.
+ beq digit
+ cmp.b #'x', d0
+ beq hex
+ cmp.b #'s', d0
+ beq string
+ cmp.b #'%', d0 ! second % has to be printed.
+ beq put
+ tst.b -(a5) ! normal char should be printed
+ bra next
+
+string: move.l (a6)+, a2 ! a2 <- address of string
+sloop: move.b (a2)+, d0
+ beq next
+ move.l d0, -(sp)
+ jsr _putchar ! long argument on stack
+ tst.l (sp)+
+ bra sloop
+
+digit: move.l (a6)+, d1 ! d1 <- integer
+ move.l #_getal+12, a2 ! a2 <- ptr to last part of buf
+ clr.b -(a2) ! stringterminator
+1:
+ move.l d1,-(sp)
+ move.l #10,-(sp)
+ jsr .dvu ! d1 <- qotient; d0 <- remainder
+ add.l #'0', d0
+ move.b d0, -(a2)
+ tst.l d1 ! if quotient = 0 then ready
+ bne 1b
+ bra sloop ! print digitstring.
+
+hex: move.l (a6)+, d1 ! d1 <- integer
+ move.l #_getal+12, a2 ! a2 <- ptr to last part of buf
+ clr.b -(a2) ! stringterminator
+ move.l #7, d2 ! loop control
+1: move.l d1, d0
+ and.l #15, d0
+ move.l #hexs,a0
+ add.l d0,a0
+ move.b (a0), -(a2) ! hex digit
+ asr.l #4, d1
+ dbf d2, 1b
+ bra sloop
+
+out:
+ movem.l (sp)+, d0/d1/d2/a0/a1/a2/a3/a4/a5/a6
+ rts
+
+
+_putchar:
+ move.l #1, -(sp)
+ pea 11(sp)
+ move.l #1, -(sp)
+ jsr _write
+ lea 12(sp), sp
+ rts
+.align 2
diff --git a/mach/m68k4/libem/sav.s b/mach/m68k4/libem/sav.s
new file mode 100644
index 00000000..5f29178c
--- /dev/null
+++ b/mach/m68k4/libem/sav.s
@@ -0,0 +1,13 @@
+.define .savd0
+.define .savret
+.define .savreg
+
+.data
+.savd0:
+ .long 0
+.savret:
+ .long 0
+.savreg:
+ .space 128
+.text
+.align 2
diff --git a/mach/m68k4/libem/sys1.s b/mach/m68k4/libem/sys1.s
new file mode 100644
index 00000000..49a3d759
--- /dev/null
+++ b/mach/m68k4/libem/sys1.s
@@ -0,0 +1,62 @@
+.extern _errno
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .data
+_errno:
+.extern _lseek
+.short 0
+.sect .text
+_lseek:
+link a6,#-0
+.sect .data
+_13:
+.short 29561
+.short 29489
+.short 11875
+.short 0
+.sect .text
+move.l #_13,.filn
+move.w #8,.lino
+move.w #0,-(sp)
+move.w #0,-(sp)
+move.l (sp)+,d0
+unlk a6
+rts
+.extern _close
+_close:
+link a6,#-0
+move.l #_13,.filn
+move.w #12,.lino
+move.w #0,-(sp)
+move.w (sp)+,d0
+unlk a6
+rts
+.extern _ioctl
+_ioctl:
+link a6,#-0
+move.l #_13,.filn
+move.w #18,.lino
+move.w #0,-(sp)
+move.w (sp)+,d0
+unlk a6
+rts
+.extern _read
+_read:
+link a6,#-0
+move.l #_13,.filn
+move.w #24,.lino
+move.w #-1,-(sp)
+move.w (sp)+,d0
+unlk a6
+rts
+.extern _open
+_open:
+link a6,#-0
+move.l #_13,.filn
+move.w #30,.lino
+move.w #-1,-(sp)
+move.w (sp)+,d0
+unlk a6
+rts
diff --git a/mach/m68k4/libem/sys2.s b/mach/m68k4/libem/sys2.s
new file mode 100644
index 00000000..661f2fb5
--- /dev/null
+++ b/mach/m68k4/libem/sys2.s
@@ -0,0 +1,11 @@
+.extern _exit
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+! Fake system call for 68000 running MACSBUG
+
+.sect .text
+
+_exit:
+ jmp 0x0200f6
diff --git a/mach/m68k4/libfp/Makefile b/mach/m68k4/libfp/Makefile
new file mode 100644
index 00000000..370c22bc
--- /dev/null
+++ b/mach/m68k4/libfp/Makefile
@@ -0,0 +1,22 @@
+EMHOME=../../..
+SUF=o
+MAKEFILE=$(EMHOME)/mach/proto/fp/Makefile
+MACHDEF="MACH=m68k4" "SUF=$(SUF)" "ASAR=aal"
+
+all:
+ make -f $(MAKEFILE) $(MACHDEF) all
+
+install:
+ make -f $(MAKEFILE) $(MACHDEF) install
+
+cmp: all
+ -../../compare FP_$(MACH).a tail_fp
+
+clean:
+ make -f $(MAKEFILE) $(MACHDEF) clean
+
+opr:
+ make pr | opr
+
+pr:
+ @pr Makefile
diff --git a/mach/m68k4/libsys/Makefile b/mach/m68k4/libsys/Makefile
new file mode 100644
index 00000000..142afee5
--- /dev/null
+++ b/mach/m68k4/libsys/Makefile
@@ -0,0 +1,29 @@
+# $Header$
+MACH=m68k4
+all: libmon_o.a head_em.o
+
+install: all
+ ../../install head_em.o head_em
+ ../../install libmon_o.a tail_mon
+
+
+cmp: all
+ -../../compare head_em.o head_em
+ -../../compare libmon_o.a tail_mon
+
+libmon_o.a: libmon_s.a
+ ASAR=aal ; export ASAR ;\
+ march . libmon_o.a
+
+head_em.o: head_em.s
+ $(MACH) -I../../../h -c head_em.s
+
+clean:
+ rm -f *.o libmon_o.a
+
+opr :
+ make pr | opr
+
+pr:
+ @pr `pwd`/head_em.s
+ @arch pv libmon_s.a | pr -h `pwd`/libmon_s.a
diff --git a/mach/m68k4/libsys/compmodule b/mach/m68k4/libsys/compmodule
new file mode 100755
index 00000000..d80f03d4
--- /dev/null
+++ b/mach/m68k4/libsys/compmodule
@@ -0,0 +1,4 @@
+if m68k4 -L -c $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi
diff --git a/mach/m68k4/ncg/Makefile b/mach/m68k4/ncg/Makefile
new file mode 100644
index 00000000..f5e2bda6
--- /dev/null
+++ b/mach/m68k4/ncg/Makefile
@@ -0,0 +1,197 @@
+# $Header$
+
+EMHOME=../../..
+#preprocessor flags for table
+TABLEFLAGS=
+#cgg options
+CGGFLAGS=
+
+PREFLAGS=-I$(EMHOME)/h -I. -I$(EMHOME)/mach -I$(EMHOME)/modules/h -DNDEBUG
+PFLAGS=
+CFLAGS=$(PREFLAGS) $(PFLAGS) -O
+LDFLAGS=$(PFLAGS)
+LINTOPTS=-bx
+LIBS=$(EMHOME)/lib/em_data.a $(EMHOME)/modules/lib/libflt.a
+CDIR=$(EMHOME)/mach/proto/ncg
+CGG=$(EMHOME)/lib/ncgg
+CPP=$(EMHOME)/lib/cpp
+CFILES=$(CDIR)/codegen.c $(CDIR)/compute.c $(CDIR)/equiv.c $(CDIR)/fillem.c \
+ $(CDIR)/gencode.c $(CDIR)/glosym.c $(CDIR)/label.c $(CDIR)/main.c \
+ $(CDIR)/move.c $(CDIR)/nextem.c $(CDIR)/reg.c $(CDIR)/regvar.c \
+ $(CDIR)/salloc.c $(CDIR)/state.c $(CDIR)/subr.c $(CDIR)/var.c
+OFILES=codegen.o compute.o equiv.o fillem.o gencode.o glosym.o label.o \
+ main.o move.o nextem.o reg.o regvar.o salloc.o state.o subr.o var.o
+
+all: tables.c
+ make "EMHOME="$(EMHOME) cg
+
+cg: tables.o $(OFILES)
+ $(CC) $(LDFLAGS) $(OFILES) tables.o $(LIBS) -o cg
+
+tables.o: tables.c
+ $(CC) -c $(PREFLAGS) -I$(CDIR) tables.c
+
+codegen.o: $(CDIR)/codegen.c
+ $(CC) -c $(CFLAGS) $(CDIR)/codegen.c
+compute.o: $(CDIR)/compute.c
+ $(CC) -c $(CFLAGS) $(CDIR)/compute.c
+equiv.o: $(CDIR)/equiv.c
+ $(CC) -c $(CFLAGS) $(CDIR)/equiv.c
+fillem.o: $(CDIR)/fillem.c
+ $(CC) -c $(CFLAGS) $(CDIR)/fillem.c
+gencode.o: $(CDIR)/gencode.c
+ $(CC) -c $(CFLAGS) $(CDIR)/gencode.c
+glosym.o: $(CDIR)/glosym.c
+ $(CC) -c $(CFLAGS) $(CDIR)/glosym.c
+label.o: $(CDIR)/label.c
+ $(CC) -c $(CFLAGS) $(CDIR)/label.c
+main.o: $(CDIR)/main.c
+ $(CC) -c $(CFLAGS) $(CDIR)/main.c
+move.o: $(CDIR)/move.c
+ $(CC) -c $(CFLAGS) $(CDIR)/move.c
+nextem.o: $(CDIR)/nextem.c
+ $(CC) -c $(CFLAGS) $(CDIR)/nextem.c
+reg.o: $(CDIR)/reg.c
+ $(CC) -c $(CFLAGS) $(CDIR)/reg.c
+regvar.o: $(CDIR)/regvar.c
+ $(CC) -c $(CFLAGS) $(CDIR)/regvar.c
+salloc.o: $(CDIR)/salloc.c
+ $(CC) -c $(CFLAGS) $(CDIR)/salloc.c
+state.o: $(CDIR)/state.c
+ $(CC) -c $(CFLAGS) $(CDIR)/state.c
+subr.o: $(CDIR)/subr.c
+ $(CC) -c $(CFLAGS) $(CDIR)/subr.c
+var.o: $(CDIR)/var.c
+ $(CC) -c $(CFLAGS) $(CDIR)/var.c
+
+install: all
+ $(EMHOME)/mach/install cg
+
+cmp: all
+ -$(EMHOME)/mach/compare cg
+
+
+tables.c: table $(CGG)
+ $(CPP) $(TABLEFLAGS) table | $(CGG) $(CGGFLAGS)
+ -cmp tables.h tables.H || cp tables.H tables.h
+
+lint: $(CFILES) tables.c
+ lint $(LINTOPTS) $(PREFLAGS) -I$(CDIR) $(CFILES) tables.c
+clean:
+ rm -f *.o tables.c tables.h debug.out cg tables.H
+
+distr: tables.c
+ rm -f tables1.c tables1.h
+ cp tables.c tables1.c
+ cp tables.h tables1.h
+ chmod -w tables1.[ch]
+
+codegen.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+codegen.o: $(CDIR)/data.h
+codegen.o: $(CDIR)/equiv.h
+codegen.o: $(CDIR)/extern.h
+codegen.o: $(CDIR)/param.h
+codegen.o: $(CDIR)/result.h
+codegen.o: $(CDIR)/state.h
+codegen.o: tables.h
+codegen.o: $(CDIR)/types.h
+compute.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+compute.o: $(CDIR)/data.h
+compute.o: $(CDIR)/extern.h
+compute.o: $(CDIR)/glosym.h
+compute.o: $(CDIR)/label.h
+compute.o: $(CDIR)/param.h
+compute.o: $(CDIR)/result.h
+compute.o: tables.h
+compute.o: $(CDIR)/types.h
+equiv.o: $(CDIR)/assert.h
+equiv.o: $(CDIR)/data.h $(EMHOME)/h/cgg_cg.h
+equiv.o: $(CDIR)/equiv.h
+equiv.o: $(CDIR)/extern.h
+equiv.o: $(CDIR)/param.h
+equiv.o: $(CDIR)/result.h
+equiv.o: tables.h
+equiv.o: $(CDIR)/types.h
+fillem.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+fillem.o: $(CDIR)/data.h
+fillem.o: $(CDIR)/extern.h
+fillem.o: mach.c
+fillem.o: mach.h
+fillem.o: $(CDIR)/param.h
+fillem.o: $(CDIR)/regvar.h
+fillem.o: $(CDIR)/result.h
+fillem.o: tables.h
+fillem.o: $(CDIR)/types.h
+gencode.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+gencode.o: $(CDIR)/data.h
+gencode.o: $(CDIR)/extern.h
+gencode.o: $(CDIR)/param.h
+gencode.o: $(CDIR)/result.h
+gencode.o: tables.h
+gencode.o: $(CDIR)/types.h
+glosym.o: $(CDIR)/glosym.h
+glosym.o: $(CDIR)/param.h
+glosym.o: tables.h
+glosym.o: $(CDIR)/types.h
+label.o: $(CDIR)/label.h
+label.o: $(CDIR)/param.h
+label.o: tables.h
+label.o: $(CDIR)/types.h
+main.o: $(CDIR)/param.h
+main.o: tables.h
+move.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+move.o: $(CDIR)/data.h
+move.o: $(CDIR)/extern.h
+move.o: $(CDIR)/param.h
+move.o: $(CDIR)/result.h
+move.o: tables.h
+move.o: $(CDIR)/types.h
+nextem.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+nextem.o: $(CDIR)/data.h
+nextem.o: $(CDIR)/extern.h
+nextem.o: $(CDIR)/param.h
+nextem.o: $(CDIR)/result.h
+nextem.o: tables.h
+nextem.o: $(CDIR)/types.h
+reg.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+reg.o: $(CDIR)/data.h
+reg.o: $(CDIR)/extern.h
+reg.o: $(CDIR)/param.h
+reg.o: $(CDIR)/result.h
+reg.o: tables.h
+reg.o: $(CDIR)/types.h
+regvar.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+regvar.o: $(CDIR)/data.h
+regvar.o: $(CDIR)/extern.h
+regvar.o: $(CDIR)/param.h
+regvar.o: $(CDIR)/regvar.h
+regvar.o: $(CDIR)/result.h
+regvar.o: tables.h
+regvar.o: $(CDIR)/types.h
+salloc.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+salloc.o: $(CDIR)/data.h
+salloc.o: $(CDIR)/extern.h
+salloc.o: $(CDIR)/param.h
+salloc.o: $(CDIR)/result.h
+salloc.o: tables.h
+salloc.o: $(CDIR)/types.h
+state.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+state.o: $(CDIR)/data.h
+state.o: $(CDIR)/extern.h
+state.o: $(CDIR)/param.h
+state.o: $(CDIR)/result.h
+state.o: $(CDIR)/state.h
+state.o: tables.h
+state.o: $(CDIR)/types.h
+subr.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+subr.o: $(CDIR)/data.h
+subr.o: $(CDIR)/extern.h
+subr.o: $(CDIR)/param.h
+subr.o: $(CDIR)/result.h
+subr.o: tables.h
+subr.o: $(CDIR)/types.h
+var.o: $(CDIR)/data.h $(EMHOME)/h/cgg_cg.h
+var.o: $(CDIR)/param.h
+var.o: $(CDIR)/result.h
+var.o: tables.h
+var.o: $(CDIR)/types.h
diff --git a/mach/mantra/cv/Makefile b/mach/mantra/cv/Makefile
new file mode 100644
index 00000000..5b237fcf
--- /dev/null
+++ b/mach/mantra/cv/Makefile
@@ -0,0 +1,30 @@
+EMHOME = ../../..
+LIBOBJ = $(EMHOME)/modules/lib/libobject.a
+INCLUDE = $(EMHOME)/h
+CFLAGS = -I. -I$(INCLUDE) -O
+TARGETS = cv Xcv
+
+all: $(TARGETS)
+
+install: all
+ ../../install cv
+ ../../install Xcv
+
+cmp: all
+ ../../compare cv
+ ../../compare Xcv
+
+cv: cv.o
+ $(CC) $(LDFLAGS) -o cv cv.o $(LIBOBJ)
+
+Xcv: Xcv.o
+ $(CC) $(LDFLAGS) -o Xcv Xcv.o $(LIBOBJ)
+
+clean:
+ rm -f $(TARGETS) *.o nohup.out Out
+
+pr:
+ @pr Makefile cv.c Xcv.c
+
+opr:
+ make pr | opr
diff --git a/mach/mantra/int/Makefile b/mach/mantra/int/Makefile
new file mode 100644
index 00000000..71ef3cc1
--- /dev/null
+++ b/mach/mantra/int/Makefile
@@ -0,0 +1,81 @@
+EMHOME=../../..
+INTS=em2_t--- em2_---- em2_t-cp em2_t-c- em2_t--p \
+em4_t--- em4_---- em4_t-cp em4_t-c- em4_t--p
+P = mloop
+FILES=deffile $P0 $P1 $P2 $P3 $P4 $P5 $P6 $P7 $P8 $P9 $Pa $Pb $Pc
+CPP=$(EMHOME)/lib/cpp
+b=$(EMHOME)/lib/em
+CFLAGS=-I$(EMHOME)/h -O
+FLTRAP=
+
+all: $(INTS) em
+
+em: em.c
+ $(CC) $(CFLAGS) -o em em.c
+
+tmp.s: $(FILES)
+ cat $(FILES) > tmp.s
+
+em2_t---: tmp.s compile con_float.o
+ ./compile -o em2_t--- -P $(FLTRAP) -Dopfreq=0 -Dlast=1 -Dcount=0 -Dtest=1 -Dflow=0 -Dprof=0 tmp.s con_float.o
+
+em2_----: tmp.s compile con_float.o
+ ./compile -o em2_---- -P $(FLTRAP) -Dopfreq=0 -Dlast=0 -Dcount=0 -Dtest=0 -Dflow=0 -Dprof=0 tmp.s con_float.o
+
+em2_t-cp: tmp.s compile con_float.o
+ ./compile -o em2_t-cp -P $(FLTRAP) -Dopfreq=0 -Dlast=1 -Dcount=1 -Dtest=1 -Dflow=0 -Dprof=1 tmp.s con_float.o
+
+em2_t-c-: tmp.s compile con_float.o
+ ./compile -o em2_t-c- -P $(FLTRAP) -Dopfreq=0 -Dlast=1 -Dcount=1 -Dtest=1 -Dflow=0 -Dprof=0 tmp.s con_float.o
+
+em2_t--p: tmp.s compile con_float.o
+ ./compile -o em2_t--p -P $(FLTRAP) -Dopfreq=0 -Dlast=1 -Dcount=0 -Dtest=1 -Dflow=0 -Dprof=1 tmp.s con_float.o
+
+em4_t---: tmp.s compile con_float.o
+ ./compile -o em4_t--- -P $(FLTRAP) -Dlword -Dopfreq=0 -Dlast=1 -Dcount=0 -Dtest=1 -Dflow=0 -Dprof=0 tmp.s con_float.o
+
+em4_----: tmp.s compile con_float.o
+ ./compile -o em4_---- -P $(FLTRAP) -Dlword -Dopfreq=0 -Dlast=0 -Dcount=0 -Dtest=0 -Dflow=0 -Dprof=0 tmp.s con_float.o
+
+em4_t-cp: tmp.s compile con_float.o
+ ./compile -o em4_t-cp -P $(FLTRAP) -Dlword -Dopfreq=0 -Dlast=1 -Dcount=1 -Dtest=1 -Dflow=0 -Dprof=1 tmp.s con_float.o
+
+em4_t-c-:tmp.s compile con_float.o
+ ./compile -o em4_t-c- -P $(FLTRAP) -Dlword -Dopfreq=0 -Dlast=1 -Dcount=1 -Dtest=1 -Dflow=0 -Dprof=0 tmp.s con_float.o
+
+em4_t--p: tmp.s compile con_float.o
+ ./compile -o em4_t--p -P $(FLTRAP) -Dlword -Dopfreq=0 -Dlast=1 -Dcount=0 -Dtest=1 -Dflow=0 -Dprof=1 tmp.s con_float.o
+
+con_float.o: con_float.c
+ case `ack_sys` in m68k2|pmds) \
+ acc -I$(EMHOME)/mach -mm68k4 -c -L -O con_float.c;; \
+ *) acc -c -I$(EMHOME)/mach -L -O con_float.c;; \
+ esac
+
+compile: Makefile
+ case `ack_sys` in sun*) MACH=`ack_sys`; AS=-Ras=../../../lib/m68k2/as;; pmds*) MACH=pmds4;; \
+ m68_sysV_0) MACH=mantra;; \
+ *) MACH=m68k4;; \
+ esac ; echo $$MACH $$AS -r.c -.m -fp '$$*' > compile; chmod +x compile
+install: all
+ -mkdir $b24 $b44
+ ls em2_???? | sed 's:em2_\(.*\):cp & $b24/em_\1:' | sh
+ ls em4_???? | sed 's:em4_\(.*\):cp & $b44/em_\1:' | sh
+ cp em ../../../bin/em
+ cp em.1 ../../../man/em.1
+
+cmp: all
+ ls em2_???? | sed 's:em2_\(.*\):cmp & $b24/em_\1:' | sh
+ ls em4_???? | sed 's:em4_\(.*\):cmp & $b44/em_\1:' | sh
+ -cmp em ../../../bin/em
+ -cmp em.1 ../../../man/em.1
+
+clean:
+ -rm -f *.o *.old a.out em tmp.s $(INTS) compile
+
+opr:
+ make pr | opr
+
+pr:
+ @pr `pwd`/makefile
+ @pr `pwd`/deffile `pwd`/$P?
diff --git a/mach/mantra/int/header b/mach/mantra/int/header
new file mode 100644
index 00000000..ff0fa03e
--- /dev/null
+++ b/mach/mantra/int/header
@@ -0,0 +1,8 @@
+!definitions
+!#define lword
+!#define FLTRAP
+#define opfreq 0
+#define last 1
+#define test 1
+#define count 0
+#define flow 0
diff --git a/mach/mantra/int/mloope b/mach/mantra/int/mloope
new file mode 100644
index 00000000..9507ea16
--- /dev/null
+++ b/mach/mantra/int/mloope
@@ -0,0 +1,11 @@
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+ .sect .text
+end:
+ .sect .bss
+endbss:
+ .sect .data
+enddata:
diff --git a/mach/mantra/int/prep b/mach/mantra/int/prep
new file mode 100755
index 00000000..4f4c4199
--- /dev/null
+++ b/mach/mantra/int/prep
@@ -0,0 +1,3 @@
+rm -f temp.c
+cat header deffile $1 >> temp.c
+../../../lib/cpp -P temp.c >$2
diff --git a/mach/mantra/libsys/Makefile b/mach/mantra/libsys/Makefile
new file mode 100644
index 00000000..142afee5
--- /dev/null
+++ b/mach/mantra/libsys/Makefile
@@ -0,0 +1,29 @@
+# $Header$
+MACH=m68k4
+all: libmon_o.a head_em.o
+
+install: all
+ ../../install head_em.o head_em
+ ../../install libmon_o.a tail_mon
+
+
+cmp: all
+ -../../compare head_em.o head_em
+ -../../compare libmon_o.a tail_mon
+
+libmon_o.a: libmon_s.a
+ ASAR=aal ; export ASAR ;\
+ march . libmon_o.a
+
+head_em.o: head_em.s
+ $(MACH) -I../../../h -c head_em.s
+
+clean:
+ rm -f *.o libmon_o.a
+
+opr :
+ make pr | opr
+
+pr:
+ @pr `pwd`/head_em.s
+ @arch pv libmon_s.a | pr -h `pwd`/libmon_s.a
diff --git a/mach/mantra/libsys/compmodule b/mach/mantra/libsys/compmodule
new file mode 100755
index 00000000..48038e37
--- /dev/null
+++ b/mach/mantra/libsys/compmodule
@@ -0,0 +1,4 @@
+if mantra -c -L $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi
diff --git a/mach/minix/libsys/Makefile b/mach/minix/libsys/Makefile
new file mode 100644
index 00000000..9a200749
--- /dev/null
+++ b/mach/minix/libsys/Makefile
@@ -0,0 +1,40 @@
+# $Header$
+MACH=minix
+
+all: libsys_o.a end.o head_em.o
+
+install: all
+ ../../install libsys_o.a tail_mon
+ ../../install head_em.o head_em
+ ../../install end.o end_em
+
+cmp: all
+ -../../compare libsys_o.a tail_mon
+ -../../compare head_em.o head_em
+ -../../compare end.o end_em
+
+
+end.o: end.s
+ $(MACH) -I../../../h -O -c end.s
+
+head_em.o: head_em.s
+ $(MACH) -I../../../h -O -c head_em.s
+
+libsys.a: libsys_s.a
+ ASAR=aal ; export ASAR ;\
+ march . libsys.a
+
+libsys_o.a: libsys.a ../../../lib/i86/tail_em
+ mkdir X; cd X; aal x ../../../../lib/i86/tail_em; aal x ../libsys.a; aal rv ../libsys_o.a *.o ; cd ..
+ rm -rf X
+
+clean:
+ rm -f *.o libsys_o.a libsys.a
+
+opr :
+ make pr | opr
+
+pr:
+ @pr `pwd`/head_em.s
+ @arch pv libsys.a | pr -h `pwd`/libsys.a
+ @pr `pwd`/end.s
diff --git a/mach/minix/libsys/access.c b/mach/minix/libsys/access.c
new file mode 100644
index 00000000..23a22dd3
--- /dev/null
+++ b/mach/minix/libsys/access.c
@@ -0,0 +1,9 @@
+#include "lib.h"
+
+PUBLIC int access(name, mode)
+char *name;
+int mode;
+{
+ return callm3(FS, ACCESS, mode, name);
+
+}
diff --git a/mach/minix/libsys/alarm.c b/mach/minix/libsys/alarm.c
new file mode 100644
index 00000000..9be91a8d
--- /dev/null
+++ b/mach/minix/libsys/alarm.c
@@ -0,0 +1,7 @@
+#include "lib.h"
+
+PUBLIC int alarm(sec)
+unsigned sec;
+{
+ return callm1(MM, ALARM, (int) sec, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+}
diff --git a/mach/minix/libsys/brk.c b/mach/minix/libsys/brk.c
new file mode 100644
index 00000000..f6a03772
--- /dev/null
+++ b/mach/minix/libsys/brk.c
@@ -0,0 +1,34 @@
+#include "lib.h"
+
+extern char *brksize;
+
+PUBLIC char *brk(addr)
+char *addr;
+{
+ int k;
+
+ k = callm1(MM, BRK, 0, 0, 0, addr, NIL_PTR, NIL_PTR);
+ if (k == OK) {
+ brksize = M.m2_p1;
+ return(NIL_PTR);
+ } else {
+ return( (char*) -1 );
+ }
+}
+
+
+PUBLIC char *sbrk(incr)
+int incr;
+{
+ char *newsize, *oldsize;
+
+ oldsize = brksize;
+ newsize = brksize + incr;
+ if (incr > 0 && newsize < oldsize || incr < 0 && newsize > oldsize)
+ return( (char *) -1);
+ if (brk(newsize) == 0)
+ return(oldsize);
+ else
+ return( (char *) -1 );
+}
+
diff --git a/mach/minix/libsys/chdir.c b/mach/minix/libsys/chdir.c
new file mode 100644
index 00000000..357a979c
--- /dev/null
+++ b/mach/minix/libsys/chdir.c
@@ -0,0 +1,8 @@
+#include "lib.h"
+
+PUBLIC int chdir(name)
+char *name;
+{
+ return callm3(FS, CHDIR, 0, name);
+
+}
diff --git a/mach/minix/libsys/chmod.c b/mach/minix/libsys/chmod.c
new file mode 100644
index 00000000..7ae3edad
--- /dev/null
+++ b/mach/minix/libsys/chmod.c
@@ -0,0 +1,9 @@
+#include "lib.h"
+
+PUBLIC int chmod(name, mode)
+char* name;
+int mode;
+{
+ return callm3(FS, CHMOD, mode, name);
+
+}
diff --git a/mach/minix/libsys/chown.c b/mach/minix/libsys/chown.c
new file mode 100644
index 00000000..0846102c
--- /dev/null
+++ b/mach/minix/libsys/chown.c
@@ -0,0 +1,8 @@
+#include "lib.h"
+
+PUBLIC int chown(name, owner, grp)
+char *name;
+int owner, grp;
+{
+ return callm1(FS, CHOWN, len(name), owner, grp, name, NIL_PTR, NIL_PTR);
+}
diff --git a/mach/minix/libsys/chroot.c b/mach/minix/libsys/chroot.c
new file mode 100644
index 00000000..520abaf1
--- /dev/null
+++ b/mach/minix/libsys/chroot.c
@@ -0,0 +1,8 @@
+#include "lib.h"
+
+PUBLIC int chroot(name)
+char* name;
+{
+ return callm3(FS, CHROOT, 0, name);
+
+}
diff --git a/mach/minix/libsys/close.c b/mach/minix/libsys/close.c
new file mode 100644
index 00000000..72698b0b
--- /dev/null
+++ b/mach/minix/libsys/close.c
@@ -0,0 +1,8 @@
+#include "lib.h"
+
+PUBLIC int close(fd)
+int fd;
+{
+ return callm1(FS, CLOSE, fd, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+
+}
diff --git a/mach/minix/libsys/compmodule b/mach/minix/libsys/compmodule
new file mode 100755
index 00000000..b622ec57
--- /dev/null
+++ b/mach/minix/libsys/compmodule
@@ -0,0 +1,4 @@
+if minix -c -L -LIB $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi
diff --git a/mach/minix/libsys/creat.c b/mach/minix/libsys/creat.c
new file mode 100644
index 00000000..f9c13607
--- /dev/null
+++ b/mach/minix/libsys/creat.c
@@ -0,0 +1,8 @@
+#include "lib.h"
+
+PUBLIC int creat(name, mode)
+char* name;
+int mode;
+{
+ return callm3(FS, CREAT, mode, name);
+}
diff --git a/mach/minix/libsys/dup.c b/mach/minix/libsys/dup.c
new file mode 100644
index 00000000..f8683ea9
--- /dev/null
+++ b/mach/minix/libsys/dup.c
@@ -0,0 +1,7 @@
+#include "lib.h"
+
+PUBLIC int dup(fd)
+int fd;
+{
+ return callm1(FS, DUP, fd, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+}
diff --git a/mach/minix/libsys/dup2.c b/mach/minix/libsys/dup2.c
new file mode 100644
index 00000000..67e7c3da
--- /dev/null
+++ b/mach/minix/libsys/dup2.c
@@ -0,0 +1,7 @@
+#include "lib.h"
+
+PUBLIC int dup2(fd, fd2)
+int fd, fd2;
+{
+ return callm1(FS, DUP, fd+0100, fd2, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+}
diff --git a/mach/minix/libsys/end.s b/mach/minix/libsys/end.s
new file mode 100644
index 00000000..6b9ce418
--- /dev/null
+++ b/mach/minix/libsys/end.s
@@ -0,0 +1,17 @@
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define endtext,enddata,endbss
+.define _end,_etext,_edata
+
+ ! $Header$
+ .sect .text
+endtext:
+_etext:
+ .align 2
+ .sect .data
+enddata:
+_edata:
+ .align 2
+.sect .endsect
+_end:
+endbss:
+ .align 2
diff --git a/mach/minix/libsys/exec.c b/mach/minix/libsys/exec.c
new file mode 100644
index 00000000..cb2be552
--- /dev/null
+++ b/mach/minix/libsys/exec.c
@@ -0,0 +1,103 @@
+#include "lib.h"
+
+extern char **environ; /* environment pointer */
+
+#define PTRSIZE sizeof(char *)
+
+PUBLIC int execl(name, arg0)
+char *name;
+char *arg0;
+{
+ return execve(name, &arg0, environ);
+}
+
+PUBLIC int execle(name, argv)
+char *name, *argv;
+{
+ char **p;
+ p = (char **) &argv;
+ while (*p++) /* null statement */ ;
+ return execve(name, &argv, *p);
+}
+
+PUBLIC int execv(name, argv)
+char *name, *argv[];
+{
+ return execve(name, argv, environ);
+}
+
+
+PUBLIC int execve(name, argv, envp)
+char *name; /* pointer to name of file to be executed */
+char *argv[]; /* pointer to argument array */
+char *envp[]; /* pointer to environment */
+{
+ char stack[MAX_ISTACK_BYTES];
+ char **argorg, **envorg, *hp, **ap, *p;
+ int i, nargs, nenvps, stackbytes, offset;
+ extern errno;
+
+ /* Count the argument pointers and environment pointers. */
+ nargs = 0;
+ nenvps = 0;
+ argorg = argv;
+ envorg = envp;
+ while (*argorg++ != NIL_PTR) nargs++;
+ while (*envorg++ != NIL_PTR) nenvps++;
+
+ /* Prepare to set up the initial stack. */
+ hp = &stack[(nargs + nenvps + 3) * PTRSIZE];
+ if (hp + nargs + nenvps >= &stack[MAX_ISTACK_BYTES]) {
+ errno = E2BIG;
+ return(-1);
+ }
+ ap = (char **) stack;
+ *ap++ = (char *) nargs;
+
+ /* Prepare the argument pointers and strings. */
+ for (i = 0; i < nargs; i++) {
+ offset = hp - stack;
+ *ap++ = (char *) offset;
+ p = *argv++;
+ while (*p) {
+ *hp++ = *p++;
+ if (hp >= &stack[MAX_ISTACK_BYTES]) {
+ errno = E2BIG;
+ return(-1);
+ }
+ }
+ *hp++ = (char) 0;
+ }
+ *ap++ = NIL_PTR;
+
+ /* Prepare the environment pointers and strings. */
+ for (i = 0; i < nenvps; i++) {
+ offset = hp - stack;
+ *ap++ = (char *) offset;
+ p = *envp++;
+ while (*p) {
+ *hp++ = *p++;
+ if (hp >= &stack[MAX_ISTACK_BYTES]) {
+ errno = E2BIG;
+ return(-1);
+ }
+ }
+ *hp++ = (char) 0;
+ }
+ *ap++ = NIL_PTR;
+ stackbytes = ( ( (int)(hp - stack) + PTRSIZE - 1)/PTRSIZE) * PTRSIZE;
+ return callm1(MM_PROC_NR, EXEC, len(name), stackbytes, 0,name, stack,NIL_PTR);
+}
+
+
+PUBLIC execn(name)
+char *name; /* pointer to file to be exec'd */
+{
+/* Special version used when there are no args and no environment. This call
+ * is principally used by INIT, to avoid having to allocate MAX_ISTACK_BYTES.
+ */
+
+ static char stack[3 * PTRSIZE];
+
+ return callm1(MM_PROC_NR, EXEC, len(name), sizeof(stack), 0, name, stack, NIL_PTR);
+}
diff --git a/mach/minix/libsys/fork.c b/mach/minix/libsys/fork.c
new file mode 100644
index 00000000..7d5c0fc5
--- /dev/null
+++ b/mach/minix/libsys/fork.c
@@ -0,0 +1,6 @@
+#include "lib.h"
+
+PUBLIC int fork()
+{
+ return callm1(MM, FORK, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+}
diff --git a/mach/minix/libsys/fstat.c b/mach/minix/libsys/fstat.c
new file mode 100644
index 00000000..8fb6d665
--- /dev/null
+++ b/mach/minix/libsys/fstat.c
@@ -0,0 +1,10 @@
+#include "lib.h"
+
+PUBLIC int fstat(fd, buffer)
+int fd;
+char *buffer;
+{
+ int n;
+ n = callm1(FS, FSTAT, fd, 0, 0, buffer, NIL_PTR, NIL_PTR);
+ return(n);
+}
diff --git a/mach/minix/libsys/getegid.c b/mach/minix/libsys/getegid.c
new file mode 100644
index 00000000..e4166916
--- /dev/null
+++ b/mach/minix/libsys/getegid.c
@@ -0,0 +1,9 @@
+#include "lib.h"
+
+PUBLIC gid getegid()
+{
+ int k;
+ k = callm1(MM, GETGID, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+ if (k < 0) return ( (gid) k);
+ return( (gid) M.m2_i1);
+}
diff --git a/mach/minix/libsys/geteuid.c b/mach/minix/libsys/geteuid.c
new file mode 100644
index 00000000..172f3dfd
--- /dev/null
+++ b/mach/minix/libsys/geteuid.c
@@ -0,0 +1,9 @@
+#include "lib.h"
+
+PUBLIC uid geteuid()
+{
+ int k;
+ k = callm1(MM, GETUID, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+ if (k < 0) return ( (uid) k);
+ return ((uid) M.m2_i1);
+}
diff --git a/mach/minix/libsys/getgid.c b/mach/minix/libsys/getgid.c
new file mode 100644
index 00000000..78fc92ac
--- /dev/null
+++ b/mach/minix/libsys/getgid.c
@@ -0,0 +1,8 @@
+#include "lib.h"
+
+PUBLIC gid getgid()
+{
+ int k;
+ k = callm1(MM, GETGID, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+ return( (gid) k);
+}
diff --git a/mach/minix/libsys/getpid.c b/mach/minix/libsys/getpid.c
new file mode 100644
index 00000000..43ab9dda
--- /dev/null
+++ b/mach/minix/libsys/getpid.c
@@ -0,0 +1,6 @@
+#include "lib.h"
+
+PUBLIC int getpid()
+{
+ return callm1(MM, GETPID, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+}
diff --git a/mach/minix/libsys/getuid.c b/mach/minix/libsys/getuid.c
new file mode 100644
index 00000000..44801a36
--- /dev/null
+++ b/mach/minix/libsys/getuid.c
@@ -0,0 +1,8 @@
+#include "lib.h"
+
+PUBLIC uid getuid()
+{
+ int k;
+ k = callm1(MM, GETUID, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+ return( (uid) k);
+}
diff --git a/mach/minix/libsys/gtty.c b/mach/minix/libsys/gtty.c
new file mode 100644
index 00000000..8916d9b4
--- /dev/null
+++ b/mach/minix/libsys/gtty.c
@@ -0,0 +1,9 @@
+#include
+
+gtty(fd, argp)
+int fd;
+char *argp;
+{
+ return ioctl(fd, TIOCGETP, argp);
+}
+
diff --git a/mach/minix/libsys/ioctl.c b/mach/minix/libsys/ioctl.c
new file mode 100644
index 00000000..fbd0658f
--- /dev/null
+++ b/mach/minix/libsys/ioctl.c
@@ -0,0 +1,68 @@
+#include "lib.h"
+#include
+#include
+
+PUBLIC int ioctl(fd, request, u)
+int fd;
+int request;
+union {
+ struct sgttyb *argp;
+ struct tchars *argt;
+} u;
+
+{
+ int n, ispeed, ospeed;
+ long erase, kill, intr, quit, xon, xoff, eof, brk, speed;
+
+ M.TTY_REQUEST = request;
+ M.TTY_LINE = fd;
+
+ switch(request) {
+ case TIOCSETP:
+ erase = u.argp->sg_erase & BYTE;
+ kill = u.argp->sg_kill & BYTE;
+ M.TTY_SPEK = (erase << 8) | kill;
+ M.TTY_FLAGS = u.argp->sg_flags;
+ M.TTY_SPEED = (u.argp->sg_ospeed << 8) | u.argp->sg_ispeed;
+ n = callx(FS, IOCTL);
+ return(n);
+
+ case TIOCSETC:
+ intr = u.argt->t_intrc & BYTE;
+ quit = u.argt->t_quitc & BYTE;
+ xon = u.argt->t_startc & BYTE;
+ xoff = u.argt->t_stopc & BYTE;
+ eof = u.argt->t_eofc & BYTE;
+ brk = u.argt->t_brkc & BYTE; /* not used at the moment */
+ M.TTY_SPEK = (intr<<24) | (quit<<16) | (xon<<8) | (xoff<<0);
+ M.TTY_FLAGS = (eof<<8) | (brk<<0);
+ n = callx(FS, IOCTL);
+ return(n);
+
+ case TIOCGETP:
+ n = callx(FS, IOCTL);
+ u.argp->sg_erase = (M.TTY_SPEK >> 8) & BYTE;
+ u.argp->sg_kill = (M.TTY_SPEK >> 0) & BYTE;
+ u.argp->sg_flags = M.TTY_FLAGS & 0xFFFF;
+ speed = (M.TTY_FLAGS >> 16) & 0xFFFFL;
+ u.argp->sg_ispeed = speed & BYTE;
+ u.argp->sg_ospeed = (speed >> 8) & BYTE;
+ return(n);
+
+ case TIOCGETC:
+ n = callx(FS, IOCTL);
+ u.argt->t_intrc = (M.TTY_SPEK >> 24) & BYTE;
+ u.argt->t_quitc = (M.TTY_SPEK >> 16) & BYTE;
+ u.argt->t_startc = (M.TTY_SPEK >> 8) & BYTE;
+ u.argt->t_stopc = (M.TTY_SPEK >> 0) & BYTE;
+ u.argt->t_eofc = (M.TTY_FLAGS >> 8) & BYTE;
+ u.argt->t_brkc = (M.TTY_FLAGS >> 8) & BYTE;
+ return(n);
+
+ default:
+ n = -1;
+ errno = -(EINVAL);
+ return(n);
+ }
+}
+
diff --git a/mach/minix/libsys/kill.c b/mach/minix/libsys/kill.c
new file mode 100644
index 00000000..db106541
--- /dev/null
+++ b/mach/minix/libsys/kill.c
@@ -0,0 +1,8 @@
+#include "lib.h"
+
+PUBLIC int kill(proc, sig)
+int proc; /* which process is to be sent the signal */
+int sig; /* signal number */
+{
+ return callm1(MM, KILL, proc, sig, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+}
diff --git a/mach/minix/libsys/lib.h b/mach/minix/libsys/lib.h
new file mode 100644
index 00000000..32c25c78
--- /dev/null
+++ b/mach/minix/libsys/lib.h
@@ -0,0 +1,13 @@
+#include
+#include
+#include
+#include
+
+extern message M;
+
+#define MM 0
+#define FS 1
+
+extern int callm1(), callm3(), callx(), len();
+extern int errno;
+extern int begsig(); /* interrupts all vector here */
diff --git a/mach/minix/libsys/link.c b/mach/minix/libsys/link.c
new file mode 100644
index 00000000..9daee380
--- /dev/null
+++ b/mach/minix/libsys/link.c
@@ -0,0 +1,7 @@
+#include "lib.h"
+
+PUBLIC int link(name, name2)
+char *name, *name2;
+{
+ return callm1(FS, LINK, len(name), len(name2), 0, name, name2, NIL_PTR);
+}
diff --git a/mach/minix/libsys/lseek.c b/mach/minix/libsys/lseek.c
new file mode 100644
index 00000000..ffcf165d
--- /dev/null
+++ b/mach/minix/libsys/lseek.c
@@ -0,0 +1,15 @@
+#include "lib.h"
+
+PUBLIC long lseek(fd, offset, whence)
+int fd;
+long offset;
+int whence;
+{
+ int k;
+ M.m2_i1 = fd;
+ M.m2_l1 = offset;
+ M.m2_i2 = whence;
+ k = callx(FS, LSEEK);
+ if (k != OK) return( (long) k); /* send itself failed */
+ return(M.m2_l1);
+}
diff --git a/mach/minix/libsys/mknod.c b/mach/minix/libsys/mknod.c
new file mode 100644
index 00000000..7dbfeca1
--- /dev/null
+++ b/mach/minix/libsys/mknod.c
@@ -0,0 +1,8 @@
+#include "lib.h"
+
+PUBLIC int mknod(name, mode, addr)
+char *name;
+int mode, addr;
+{
+ return callm1(FS, MKNOD, len(name), mode, addr, name, NIL_PTR, NIL_PTR);
+}
diff --git a/mach/minix/libsys/mktemp.c b/mach/minix/libsys/mktemp.c
new file mode 100644
index 00000000..e29e5c93
--- /dev/null
+++ b/mach/minix/libsys/mktemp.c
@@ -0,0 +1,20 @@
+/* mktemp - make a name for a temporary file */
+
+char *mktemp(template)
+char *template;
+{
+ int pid, k;
+ char *p;
+
+ pid = getpid(); /* get process id as semi-unique number */
+ p = template;
+ while (*p++) ; /* find end of string */
+ p--; /* backup to last character */
+
+ /* Replace XXXXXX at end of template with pid. */
+ while (*--p == 'X') {
+ *p = '0' + (pid % 10);
+ pid = pid/10;
+ }
+ return(template);
+}
diff --git a/mach/minix/libsys/mount.c b/mach/minix/libsys/mount.c
new file mode 100644
index 00000000..258276b4
--- /dev/null
+++ b/mach/minix/libsys/mount.c
@@ -0,0 +1,8 @@
+#include "lib.h"
+
+PUBLIC int mount(special, name, rwflag)
+char *name, *special;
+int rwflag;
+{
+ return callm1(FS, MOUNT, len(special), len(name), rwflag, special, name, NIL_PTR);
+}
diff --git a/mach/minix/libsys/open.c b/mach/minix/libsys/open.c
new file mode 100644
index 00000000..228173d7
--- /dev/null
+++ b/mach/minix/libsys/open.c
@@ -0,0 +1,8 @@
+#include "lib.h"
+
+PUBLIC int open(name, mode)
+char* name;
+int mode;
+{
+ return callm3(FS, OPEN, mode, name);
+}
diff --git a/mach/minix/libsys/pause.c b/mach/minix/libsys/pause.c
new file mode 100644
index 00000000..2a0d1f69
--- /dev/null
+++ b/mach/minix/libsys/pause.c
@@ -0,0 +1,6 @@
+#include "lib.h"
+
+PUBLIC int pause()
+{
+ return callm1(MM, PAUSE, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+}
diff --git a/mach/minix/libsys/pipe.c b/mach/minix/libsys/pipe.c
new file mode 100644
index 00000000..05058808
--- /dev/null
+++ b/mach/minix/libsys/pipe.c
@@ -0,0 +1,14 @@
+#include "lib.h"
+
+PUBLIC int pipe(fild)
+int fild[2];
+{
+ int k;
+ k = callm1(FS, PIPE, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+ if (k >= 0) {
+ fild[0] = M.m1_i1;
+ fild[1] = M.m1_i2;
+ return(0);
+ } else
+ return(k);
+}
diff --git a/mach/minix/libsys/read.c b/mach/minix/libsys/read.c
new file mode 100644
index 00000000..1619a4da
--- /dev/null
+++ b/mach/minix/libsys/read.c
@@ -0,0 +1,11 @@
+#include "lib.h"
+
+PUBLIC int read(fd, buffer, nbytes)
+int fd;
+char *buffer;
+int nbytes;
+{
+ int n;
+ n = callm1(FS, READ, fd, nbytes, 0, buffer, NIL_PTR, NIL_PTR);
+ return(n);
+}
diff --git a/mach/minix/libsys/setgid.c b/mach/minix/libsys/setgid.c
new file mode 100644
index 00000000..823e8788
--- /dev/null
+++ b/mach/minix/libsys/setgid.c
@@ -0,0 +1,7 @@
+#include "lib.h"
+
+PUBLIC int setgid(grp)
+int grp;
+{
+ return callm1(MM, SETGID, grp, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+}
diff --git a/mach/minix/libsys/setuid.c b/mach/minix/libsys/setuid.c
new file mode 100644
index 00000000..c53e0e3c
--- /dev/null
+++ b/mach/minix/libsys/setuid.c
@@ -0,0 +1,7 @@
+#include "lib.h"
+
+PUBLIC int setuid(usr)
+int usr;
+{
+ return callm1(MM, SETUID, usr, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+}
diff --git a/mach/minix/libsys/signal.c b/mach/minix/libsys/signal.c
new file mode 100644
index 00000000..4c5167cb
--- /dev/null
+++ b/mach/minix/libsys/signal.c
@@ -0,0 +1,28 @@
+#include "lib.h"
+#include
+
+int (*vectab[NSIG])(); /* array of functions to catch signals */
+
+/* The definition of signal really should be
+ * PUBLIC int (*signal(signr, func))()
+ * but some compilers refuse to accept this, even though it is correct.
+ * The only thing to do if you are stuck with such a defective compiler is
+ * change it to
+ * PUBLIC int *signal(signr, func)
+ * and change ../h/signal.h accordingly.
+ */
+
+PUBLIC int (*signal(signr, func))()
+int signr; /* which signal is being set */
+int (*func)(); /* pointer to function that catches signal */
+{
+ int r,(*old)();
+
+ old = vectab[signr - 1];
+ vectab[signr - 1] = func;
+ M.m6_i1 = signr;
+ M.m6_f1 = ( (func == SIG_IGN || func == SIG_DFL) ? func : begsig);
+ r = callx(MM, SIGNAL);
+ if (r == 1) old = SIG_IGN;
+ return( (r < 0 ? (int (*)()) r : old) );
+}
diff --git a/mach/minix/libsys/stat.c b/mach/minix/libsys/stat.c
new file mode 100644
index 00000000..ae7b446f
--- /dev/null
+++ b/mach/minix/libsys/stat.c
@@ -0,0 +1,10 @@
+#include "lib.h"
+
+PUBLIC int stat(name, buffer)
+char *name;
+char *buffer;
+{
+ int n;
+ n = callm1(FS, STAT, len(name), 0, 0, name, buffer, NIL_PTR);
+ return(n);
+}
diff --git a/mach/minix/libsys/stderr.c b/mach/minix/libsys/stderr.c
new file mode 100644
index 00000000..7910f77e
--- /dev/null
+++ b/mach/minix/libsys/stderr.c
@@ -0,0 +1,8 @@
+std_err(s)
+char *s;
+{
+ char *p = s;
+
+ while(*p != 0) p++;
+ write(2, s, (int)(p - s));
+}
diff --git a/mach/minix/libsys/stime.c b/mach/minix/libsys/stime.c
new file mode 100644
index 00000000..548ac37c
--- /dev/null
+++ b/mach/minix/libsys/stime.c
@@ -0,0 +1,8 @@
+#include "lib.h"
+
+PUBLIC int stime(top)
+long *top;
+{
+ M.m2_l1 = *top;
+ return callx(FS, STIME);
+}
diff --git a/mach/minix/libsys/stty.c b/mach/minix/libsys/stty.c
new file mode 100644
index 00000000..7dfe3db3
--- /dev/null
+++ b/mach/minix/libsys/stty.c
@@ -0,0 +1,9 @@
+#include
+
+stty(fd, argp)
+int fd;
+char *argp;
+{
+ return ioctl(fd, TIOCSETP, argp);
+}
+
diff --git a/mach/minix/libsys/sync.c b/mach/minix/libsys/sync.c
new file mode 100644
index 00000000..4592d28c
--- /dev/null
+++ b/mach/minix/libsys/sync.c
@@ -0,0 +1,6 @@
+#include "lib.h"
+
+PUBLIC int sync()
+{
+ return callm1(FS, SYNC, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+}
diff --git a/mach/minix/libsys/time.c b/mach/minix/libsys/time.c
new file mode 100644
index 00000000..e34e1f24
--- /dev/null
+++ b/mach/minix/libsys/time.c
@@ -0,0 +1,13 @@
+#include "lib.h"
+
+PUBLIC long time(tp)
+long *tp;
+{
+ int k;
+ long l;
+ k = callm1(FS, TIME, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+ if (M.m_type < 0 || k != OK) {errno = -M.m_type; return(-1L);}
+ l = M.m2_l1;
+ if (tp != (long *) 0) *tp = l;
+ return(l);
+}
diff --git a/mach/minix/libsys/times.c b/mach/minix/libsys/times.c
new file mode 100644
index 00000000..77515d69
--- /dev/null
+++ b/mach/minix/libsys/times.c
@@ -0,0 +1,15 @@
+#include "lib.h"
+#include
+#include
+
+PUBLIC int times(buf)
+struct tms *buf;
+{
+ int k;
+ k = callm1(FS, TIMES, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+ buf->tms_utime = M.m4_l1;
+ buf->tms_stime = M.m4_l2;
+ buf->tms_cutime = M.m4_l3;
+ buf->tms_cstime = M.m4_l4;
+ return(k);
+}
diff --git a/mach/minix/libsys/trp.s b/mach/minix/libsys/trp.s
new file mode 100644
index 00000000..1aac8b77
--- /dev/null
+++ b/mach/minix/libsys/trp.s
@@ -0,0 +1,114 @@
+.sect .text ; .sect .rom; .sect .data; .sect .bss
+.define .trpdivz
+.define .trpilin
+.define .trpcase
+.define .trprang
+.define .trpset
+.define .trpnofp
+.define .trpheap
+.define .trp
+.define .stop
+
+.sect .text
+.extern .trpdivz
+.extern .trpilin
+.extern .trpcase
+.extern .trprang
+.extern .trpset
+.extern .trpnofp
+.extern .trpheap
+.extern .trp
+
+.trpdivz:
+mov ax,6
+mov dx,.Mdivz
+jmp .Trp
+.trpilin:
+mov ax,18
+mov dx,.Milin
+jmp .Trp
+.trpcase:
+mov ax,20
+mov dx,.Mcase
+jmp .Trp
+.trprang:
+mov ax,1
+mov dx,.Mrang
+jmp .Trp
+.trpset:
+mov ax,2
+mov dx,.Mset
+jmp .Trp
+.trpnofp:
+mov ax,18
+mov dx,.Mnofp
+jmp .Trp
+.trpheap:
+mov ax,17
+mov dx,.Mheap
+jmp .Trp
+
+.Trp:
+xor bx,bx
+.extern .trppc
+xchg bx,(.trppc)
+test bx,bx
+jz 2f
+push ax
+call (bx)
+pop ax
+ret
+2:
+mov bx,22
+push bx
+push dx
+mov ax,2
+push ax
+call _write
+.stop:
+call _exit
+
+.trp:
+mov dx,ax
+cmp dx,21
+jae 1f
+sal dx,1
+mov bx,.Mtable
+add bx,dx
+mov bx,(bx)
+test bx,bx
+jz 1f
+mov dx,bx
+jmp 2f
+1:
+mov bx,.Mtrp+14
+mov cx,6
+mov dx,ax
+1:
+and dx,7
+add dx,'0'
+movb (bx),dl
+dec bx
+sar dx,1
+sar dx,1
+sar dx,1
+loop 1b
+mov dx,.Mtrp
+2:
+jmp .Trp
+
+.sect .rom
+.Mtable:
+ .data2 0, .Mrang, .Mset, 0, 0, 0, .Mdivz, 0
+ .data2 0, 0, 0, 0, 0, 0, 0, 0
+ .data2 0, .Mheap, .Milin, .Milin, .Mcase
+
+.Mdivz: .asciz "Error: Division by 0 \n"
+.Milin: .asciz "Illegal EM instruct'n\n"
+.Mcase: .asciz "Err in EM case instr \n"
+.Mrang: .asciz "Variable out of range\n"
+.Mset: .asciz "Err in EM set instr \n"
+.Mnofp: .asciz "Floating pt not impl.\n"
+.Mheap: .asciz "Heap overflow \n"
+
+.Mtrp: .asciz "EM trap 0000000 octal\n"
diff --git a/mach/minix/libsys/umask.c b/mach/minix/libsys/umask.c
new file mode 100644
index 00000000..caeb0754
--- /dev/null
+++ b/mach/minix/libsys/umask.c
@@ -0,0 +1,7 @@
+#include "lib.h"
+
+PUBLIC int umask(complmode)
+int complmode;
+{
+ return callm1(FS, UMASK, complmode, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+}
diff --git a/mach/minix/libsys/umount.c b/mach/minix/libsys/umount.c
new file mode 100644
index 00000000..d1fab6da
--- /dev/null
+++ b/mach/minix/libsys/umount.c
@@ -0,0 +1,7 @@
+#include "lib.h"
+
+PUBLIC int umount(name)
+char* name;
+{
+ return callm3(FS, UMOUNT, 0, name);
+}
diff --git a/mach/minix/libsys/unlink.c b/mach/minix/libsys/unlink.c
new file mode 100644
index 00000000..9c321ff2
--- /dev/null
+++ b/mach/minix/libsys/unlink.c
@@ -0,0 +1,7 @@
+#include "lib.h"
+
+PUBLIC int unlink(name)
+char *name;
+{
+ return callm3(FS, UNLINK, 0, name);
+}
diff --git a/mach/minix/libsys/utime.c b/mach/minix/libsys/utime.c
new file mode 100644
index 00000000..0c9b4ef4
--- /dev/null
+++ b/mach/minix/libsys/utime.c
@@ -0,0 +1,12 @@
+#include "lib.h"
+
+PUBLIC int utime(name, timp)
+char *name;
+long timp[2];
+{
+ M.m2_i1 = len(name);
+ M.m2_l1 = timp[0];
+ M.m2_l2 = timp[1];
+ M.m2_p1 = name;
+ return callx(FS, UTIME);
+}
diff --git a/mach/minix/libsys/wait.c b/mach/minix/libsys/wait.c
new file mode 100644
index 00000000..2d8728fd
--- /dev/null
+++ b/mach/minix/libsys/wait.c
@@ -0,0 +1,10 @@
+#include "lib.h"
+
+PUBLIC int wait(status)
+int *status;
+{
+ int k;
+ k = callm1(MM, WAIT, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+ if (k >= 0 && status != 0) *status = M.m2_i1;
+ return(k);
+}
diff --git a/mach/minix/libsys/write.c b/mach/minix/libsys/write.c
new file mode 100644
index 00000000..e08826b0
--- /dev/null
+++ b/mach/minix/libsys/write.c
@@ -0,0 +1,8 @@
+#include "lib.h"
+
+PUBLIC int write(fd, buffer, nbytes)
+char *buffer;
+int nbytes;
+{
+ return callm1(FS, WRITE, fd, nbytes, 0, buffer, NIL_PTR, NIL_PTR);
+}
diff --git a/mach/minixST/cv/Makefile b/mach/minixST/cv/Makefile
new file mode 100644
index 00000000..5cfa97a6
--- /dev/null
+++ b/mach/minixST/cv/Makefile
@@ -0,0 +1,25 @@
+EMHOME = ../../..
+LIBOBJ = $(EMHOME)/modules/lib/libobject.a
+INCLUDE = $(EMHOME)/h
+CFLAGS = -I. -I$(INCLUDE) -O
+TARGETS = cv
+
+all: $(TARGETS)
+
+install: all
+ ../../install cv
+
+cmp: all
+ ../../compare cv
+
+cv: cv.o
+ $(CC) $(LDFLAGS) -o cv cv.o $(LIBOBJ)
+
+clean:
+ rm -f $(TARGETS) *.o nohup.out Out
+
+pr:
+ @pr Makefile cv.c
+
+opr:
+ make pr | opr
diff --git a/mach/minixST/libsys/Makefile b/mach/minixST/libsys/Makefile
new file mode 100644
index 00000000..bf42930d
--- /dev/null
+++ b/mach/minixST/libsys/Makefile
@@ -0,0 +1,40 @@
+# $Header$
+MACH=minixST
+
+all: libsys_o.a end.o head_em.o
+
+install: all
+ ../../install libsys_o.a tail_mon
+ ../../install head_em.o head_em
+ ../../install end.o end_em
+
+cmp: all
+ -../../compare libsys_o.a tail_mon
+ -../../compare head_em.o head_em
+ -../../compare end.o end_em
+
+
+end.o: end.s
+ $(MACH) -I../../../h -O -c end.s
+
+head_em.o: head_em.s
+ $(MACH) -I../../../h -O -c head_em.s
+
+libsys.a: libsys_s.a
+ ASAR=aal ; export ASAR ;\
+ march . libsys.a
+
+libsys_o.a: libsys.a ../../../lib/m68k2/tail_em
+ mkdir X; cd X; aal x ../libsys.a; aal x ../../../../lib/m68k2/tail_em; aal rv ../libsys_o.a *.o
+ rm -rf X
+
+clean:
+ rm -f *.o libsys_o.a libsys.a
+
+opr :
+ make pr | opr
+
+pr:
+ @pr `pwd`/head_em.s
+ @arch pv libsys.a | pr -h `pwd`/libsys.a
+ @pr `pwd`/end.s
diff --git a/mach/minixST/libsys/_mktemp.c b/mach/minixST/libsys/_mktemp.c
new file mode 100644
index 00000000..e655f9ce
--- /dev/null
+++ b/mach/minixST/libsys/_mktemp.c
@@ -0,0 +1,31 @@
+#include
+/* mktemp - make a name for a temporary file */
+#include
+#define mktemp _mktemp
+#define getpid _getpid
+#define access _access
+#include
+
+PUBLIC char *mktemp(char *template)
+{
+ register int pid, k;
+ register char *p;
+
+ pid = getpid(); /* get process id as semi-unique number */
+ p = template;
+ while (*p) p++; /* find end of string */
+
+ /* Replace XXXXXX at end of template with pid. */
+ while (*--p == 'X') {
+ *p = '0' + (pid % 10);
+ pid /= 10;
+ }
+ p++;
+ for (k = 'a'; k <= 'z'; k++) {
+ *p = k;
+ if (access(template, 0) < 0) {
+ return template;
+ }
+ }
+ return("/");
+}
diff --git a/mach/minixST/libsys/access.c b/mach/minixST/libsys/access.c
new file mode 100644
index 00000000..23a22dd3
--- /dev/null
+++ b/mach/minixST/libsys/access.c
@@ -0,0 +1,9 @@
+#include "lib.h"
+
+PUBLIC int access(name, mode)
+char *name;
+int mode;
+{
+ return callm3(FS, ACCESS, mode, name);
+
+}
diff --git a/mach/minixST/libsys/alarm.c b/mach/minixST/libsys/alarm.c
new file mode 100644
index 00000000..9be91a8d
--- /dev/null
+++ b/mach/minixST/libsys/alarm.c
@@ -0,0 +1,7 @@
+#include "lib.h"
+
+PUBLIC int alarm(sec)
+unsigned sec;
+{
+ return callm1(MM, ALARM, (int) sec, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+}
diff --git a/mach/minixST/libsys/brk.c b/mach/minixST/libsys/brk.c
new file mode 100644
index 00000000..f6a03772
--- /dev/null
+++ b/mach/minixST/libsys/brk.c
@@ -0,0 +1,34 @@
+#include "lib.h"
+
+extern char *brksize;
+
+PUBLIC char *brk(addr)
+char *addr;
+{
+ int k;
+
+ k = callm1(MM, BRK, 0, 0, 0, addr, NIL_PTR, NIL_PTR);
+ if (k == OK) {
+ brksize = M.m2_p1;
+ return(NIL_PTR);
+ } else {
+ return( (char*) -1 );
+ }
+}
+
+
+PUBLIC char *sbrk(incr)
+int incr;
+{
+ char *newsize, *oldsize;
+
+ oldsize = brksize;
+ newsize = brksize + incr;
+ if (incr > 0 && newsize < oldsize || incr < 0 && newsize > oldsize)
+ return( (char *) -1);
+ if (brk(newsize) == 0)
+ return(oldsize);
+ else
+ return( (char *) -1 );
+}
+
diff --git a/mach/minixST/libsys/chdir.c b/mach/minixST/libsys/chdir.c
new file mode 100644
index 00000000..357a979c
--- /dev/null
+++ b/mach/minixST/libsys/chdir.c
@@ -0,0 +1,8 @@
+#include "lib.h"
+
+PUBLIC int chdir(name)
+char *name;
+{
+ return callm3(FS, CHDIR, 0, name);
+
+}
diff --git a/mach/minixST/libsys/chmod.c b/mach/minixST/libsys/chmod.c
new file mode 100644
index 00000000..7ae3edad
--- /dev/null
+++ b/mach/minixST/libsys/chmod.c
@@ -0,0 +1,9 @@
+#include "lib.h"
+
+PUBLIC int chmod(name, mode)
+char* name;
+int mode;
+{
+ return callm3(FS, CHMOD, mode, name);
+
+}
diff --git a/mach/minixST/libsys/chown.c b/mach/minixST/libsys/chown.c
new file mode 100644
index 00000000..0846102c
--- /dev/null
+++ b/mach/minixST/libsys/chown.c
@@ -0,0 +1,8 @@
+#include "lib.h"
+
+PUBLIC int chown(name, owner, grp)
+char *name;
+int owner, grp;
+{
+ return callm1(FS, CHOWN, len(name), owner, grp, name, NIL_PTR, NIL_PTR);
+}
diff --git a/mach/minixST/libsys/chroot.c b/mach/minixST/libsys/chroot.c
new file mode 100644
index 00000000..520abaf1
--- /dev/null
+++ b/mach/minixST/libsys/chroot.c
@@ -0,0 +1,8 @@
+#include "lib.h"
+
+PUBLIC int chroot(name)
+char* name;
+{
+ return callm3(FS, CHROOT, 0, name);
+
+}
diff --git a/mach/minixST/libsys/close.c b/mach/minixST/libsys/close.c
new file mode 100644
index 00000000..72698b0b
--- /dev/null
+++ b/mach/minixST/libsys/close.c
@@ -0,0 +1,8 @@
+#include "lib.h"
+
+PUBLIC int close(fd)
+int fd;
+{
+ return callm1(FS, CLOSE, fd, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+
+}
diff --git a/mach/minixST/libsys/compmodule b/mach/minixST/libsys/compmodule
new file mode 100755
index 00000000..c0273039
--- /dev/null
+++ b/mach/minixST/libsys/compmodule
@@ -0,0 +1,4 @@
+if minixST -c -L -LIB $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi
diff --git a/mach/minixST/libsys/creat.c b/mach/minixST/libsys/creat.c
new file mode 100644
index 00000000..f9c13607
--- /dev/null
+++ b/mach/minixST/libsys/creat.c
@@ -0,0 +1,8 @@
+#include "lib.h"
+
+PUBLIC int creat(name, mode)
+char* name;
+int mode;
+{
+ return callm3(FS, CREAT, mode, name);
+}
diff --git a/mach/minixST/libsys/dup.c b/mach/minixST/libsys/dup.c
new file mode 100644
index 00000000..f8683ea9
--- /dev/null
+++ b/mach/minixST/libsys/dup.c
@@ -0,0 +1,7 @@
+#include "lib.h"
+
+PUBLIC int dup(fd)
+int fd;
+{
+ return callm1(FS, DUP, fd, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+}
diff --git a/mach/minixST/libsys/dup2.c b/mach/minixST/libsys/dup2.c
new file mode 100644
index 00000000..67e7c3da
--- /dev/null
+++ b/mach/minixST/libsys/dup2.c
@@ -0,0 +1,7 @@
+#include "lib.h"
+
+PUBLIC int dup2(fd, fd2)
+int fd, fd2;
+{
+ return callm1(FS, DUP, fd+0100, fd2, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+}
diff --git a/mach/minixST/libsys/end.s b/mach/minixST/libsys/end.s
new file mode 100644
index 00000000..f7462124
--- /dev/null
+++ b/mach/minixST/libsys/end.s
@@ -0,0 +1,16 @@
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define endtext,enddata,endbss
+.define _end,_etext,_edata
+
+ .sect .text
+endtext:
+_etext:
+ .align 2
+ .sect .data
+enddata:
+_edata:
+ .align 2
+.sect .endsect
+_end:
+endbss:
+ .align 2
diff --git a/mach/minixST/libsys/exec.c b/mach/minixST/libsys/exec.c
new file mode 100644
index 00000000..cb2be552
--- /dev/null
+++ b/mach/minixST/libsys/exec.c
@@ -0,0 +1,103 @@
+#include "lib.h"
+
+extern char **environ; /* environment pointer */
+
+#define PTRSIZE sizeof(char *)
+
+PUBLIC int execl(name, arg0)
+char *name;
+char *arg0;
+{
+ return execve(name, &arg0, environ);
+}
+
+PUBLIC int execle(name, argv)
+char *name, *argv;
+{
+ char **p;
+ p = (char **) &argv;
+ while (*p++) /* null statement */ ;
+ return execve(name, &argv, *p);
+}
+
+PUBLIC int execv(name, argv)
+char *name, *argv[];
+{
+ return execve(name, argv, environ);
+}
+
+
+PUBLIC int execve(name, argv, envp)
+char *name; /* pointer to name of file to be executed */
+char *argv[]; /* pointer to argument array */
+char *envp[]; /* pointer to environment */
+{
+ char stack[MAX_ISTACK_BYTES];
+ char **argorg, **envorg, *hp, **ap, *p;
+ int i, nargs, nenvps, stackbytes, offset;
+ extern errno;
+
+ /* Count the argument pointers and environment pointers. */
+ nargs = 0;
+ nenvps = 0;
+ argorg = argv;
+ envorg = envp;
+ while (*argorg++ != NIL_PTR) nargs++;
+ while (*envorg++ != NIL_PTR) nenvps++;
+
+ /* Prepare to set up the initial stack. */
+ hp = &stack[(nargs + nenvps + 3) * PTRSIZE];
+ if (hp + nargs + nenvps >= &stack[MAX_ISTACK_BYTES]) {
+ errno = E2BIG;
+ return(-1);
+ }
+ ap = (char **) stack;
+ *ap++ = (char *) nargs;
+
+ /* Prepare the argument pointers and strings. */
+ for (i = 0; i < nargs; i++) {
+ offset = hp - stack;
+ *ap++ = (char *) offset;
+ p = *argv++;
+ while (*p) {
+ *hp++ = *p++;
+ if (hp >= &stack[MAX_ISTACK_BYTES]) {
+ errno = E2BIG;
+ return(-1);
+ }
+ }
+ *hp++ = (char) 0;
+ }
+ *ap++ = NIL_PTR;
+
+ /* Prepare the environment pointers and strings. */
+ for (i = 0; i < nenvps; i++) {
+ offset = hp - stack;
+ *ap++ = (char *) offset;
+ p = *envp++;
+ while (*p) {
+ *hp++ = *p++;
+ if (hp >= &stack[MAX_ISTACK_BYTES]) {
+ errno = E2BIG;
+ return(-1);
+ }
+ }
+ *hp++ = (char) 0;
+ }
+ *ap++ = NIL_PTR;
+ stackbytes = ( ( (int)(hp - stack) + PTRSIZE - 1)/PTRSIZE) * PTRSIZE;
+ return callm1(MM_PROC_NR, EXEC, len(name), stackbytes, 0,name, stack,NIL_PTR);
+}
+
+
+PUBLIC execn(name)
+char *name; /* pointer to file to be exec'd */
+{
+/* Special version used when there are no args and no environment. This call
+ * is principally used by INIT, to avoid having to allocate MAX_ISTACK_BYTES.
+ */
+
+ static char stack[3 * PTRSIZE];
+
+ return callm1(MM_PROC_NR, EXEC, len(name), sizeof(stack), 0, name, stack, NIL_PTR);
+}
diff --git a/mach/minixST/libsys/fork.c b/mach/minixST/libsys/fork.c
new file mode 100644
index 00000000..7d5c0fc5
--- /dev/null
+++ b/mach/minixST/libsys/fork.c
@@ -0,0 +1,6 @@
+#include "lib.h"
+
+PUBLIC int fork()
+{
+ return callm1(MM, FORK, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+}
diff --git a/mach/minixST/libsys/fstat.c b/mach/minixST/libsys/fstat.c
new file mode 100644
index 00000000..8fb6d665
--- /dev/null
+++ b/mach/minixST/libsys/fstat.c
@@ -0,0 +1,10 @@
+#include "lib.h"
+
+PUBLIC int fstat(fd, buffer)
+int fd;
+char *buffer;
+{
+ int n;
+ n = callm1(FS, FSTAT, fd, 0, 0, buffer, NIL_PTR, NIL_PTR);
+ return(n);
+}
diff --git a/mach/minixST/libsys/getegid.c b/mach/minixST/libsys/getegid.c
new file mode 100644
index 00000000..e4166916
--- /dev/null
+++ b/mach/minixST/libsys/getegid.c
@@ -0,0 +1,9 @@
+#include "lib.h"
+
+PUBLIC gid getegid()
+{
+ int k;
+ k = callm1(MM, GETGID, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+ if (k < 0) return ( (gid) k);
+ return( (gid) M.m2_i1);
+}
diff --git a/mach/minixST/libsys/geteuid.c b/mach/minixST/libsys/geteuid.c
new file mode 100644
index 00000000..172f3dfd
--- /dev/null
+++ b/mach/minixST/libsys/geteuid.c
@@ -0,0 +1,9 @@
+#include "lib.h"
+
+PUBLIC uid geteuid()
+{
+ int k;
+ k = callm1(MM, GETUID, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+ if (k < 0) return ( (uid) k);
+ return ((uid) M.m2_i1);
+}
diff --git a/mach/minixST/libsys/getgid.c b/mach/minixST/libsys/getgid.c
new file mode 100644
index 00000000..78fc92ac
--- /dev/null
+++ b/mach/minixST/libsys/getgid.c
@@ -0,0 +1,8 @@
+#include "lib.h"
+
+PUBLIC gid getgid()
+{
+ int k;
+ k = callm1(MM, GETGID, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+ return( (gid) k);
+}
diff --git a/mach/minixST/libsys/getpid.c b/mach/minixST/libsys/getpid.c
new file mode 100644
index 00000000..43ab9dda
--- /dev/null
+++ b/mach/minixST/libsys/getpid.c
@@ -0,0 +1,6 @@
+#include "lib.h"
+
+PUBLIC int getpid()
+{
+ return callm1(MM, GETPID, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+}
diff --git a/mach/minixST/libsys/getuid.c b/mach/minixST/libsys/getuid.c
new file mode 100644
index 00000000..44801a36
--- /dev/null
+++ b/mach/minixST/libsys/getuid.c
@@ -0,0 +1,8 @@
+#include "lib.h"
+
+PUBLIC uid getuid()
+{
+ int k;
+ k = callm1(MM, GETUID, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+ return( (uid) k);
+}
diff --git a/mach/minixST/libsys/gtty.c b/mach/minixST/libsys/gtty.c
new file mode 100644
index 00000000..8916d9b4
--- /dev/null
+++ b/mach/minixST/libsys/gtty.c
@@ -0,0 +1,9 @@
+#include
+
+gtty(fd, argp)
+int fd;
+char *argp;
+{
+ return ioctl(fd, TIOCGETP, argp);
+}
+
diff --git a/mach/minixST/libsys/ioctl.c b/mach/minixST/libsys/ioctl.c
new file mode 100644
index 00000000..fbd0658f
--- /dev/null
+++ b/mach/minixST/libsys/ioctl.c
@@ -0,0 +1,68 @@
+#include "lib.h"
+#include
+#include
+
+PUBLIC int ioctl(fd, request, u)
+int fd;
+int request;
+union {
+ struct sgttyb *argp;
+ struct tchars *argt;
+} u;
+
+{
+ int n, ispeed, ospeed;
+ long erase, kill, intr, quit, xon, xoff, eof, brk, speed;
+
+ M.TTY_REQUEST = request;
+ M.TTY_LINE = fd;
+
+ switch(request) {
+ case TIOCSETP:
+ erase = u.argp->sg_erase & BYTE;
+ kill = u.argp->sg_kill & BYTE;
+ M.TTY_SPEK = (erase << 8) | kill;
+ M.TTY_FLAGS = u.argp->sg_flags;
+ M.TTY_SPEED = (u.argp->sg_ospeed << 8) | u.argp->sg_ispeed;
+ n = callx(FS, IOCTL);
+ return(n);
+
+ case TIOCSETC:
+ intr = u.argt->t_intrc & BYTE;
+ quit = u.argt->t_quitc & BYTE;
+ xon = u.argt->t_startc & BYTE;
+ xoff = u.argt->t_stopc & BYTE;
+ eof = u.argt->t_eofc & BYTE;
+ brk = u.argt->t_brkc & BYTE; /* not used at the moment */
+ M.TTY_SPEK = (intr<<24) | (quit<<16) | (xon<<8) | (xoff<<0);
+ M.TTY_FLAGS = (eof<<8) | (brk<<0);
+ n = callx(FS, IOCTL);
+ return(n);
+
+ case TIOCGETP:
+ n = callx(FS, IOCTL);
+ u.argp->sg_erase = (M.TTY_SPEK >> 8) & BYTE;
+ u.argp->sg_kill = (M.TTY_SPEK >> 0) & BYTE;
+ u.argp->sg_flags = M.TTY_FLAGS & 0xFFFF;
+ speed = (M.TTY_FLAGS >> 16) & 0xFFFFL;
+ u.argp->sg_ispeed = speed & BYTE;
+ u.argp->sg_ospeed = (speed >> 8) & BYTE;
+ return(n);
+
+ case TIOCGETC:
+ n = callx(FS, IOCTL);
+ u.argt->t_intrc = (M.TTY_SPEK >> 24) & BYTE;
+ u.argt->t_quitc = (M.TTY_SPEK >> 16) & BYTE;
+ u.argt->t_startc = (M.TTY_SPEK >> 8) & BYTE;
+ u.argt->t_stopc = (M.TTY_SPEK >> 0) & BYTE;
+ u.argt->t_eofc = (M.TTY_FLAGS >> 8) & BYTE;
+ u.argt->t_brkc = (M.TTY_FLAGS >> 8) & BYTE;
+ return(n);
+
+ default:
+ n = -1;
+ errno = -(EINVAL);
+ return(n);
+ }
+}
+
diff --git a/mach/minixST/libsys/kill.c b/mach/minixST/libsys/kill.c
new file mode 100644
index 00000000..db106541
--- /dev/null
+++ b/mach/minixST/libsys/kill.c
@@ -0,0 +1,8 @@
+#include "lib.h"
+
+PUBLIC int kill(proc, sig)
+int proc; /* which process is to be sent the signal */
+int sig; /* signal number */
+{
+ return callm1(MM, KILL, proc, sig, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+}
diff --git a/mach/minixST/libsys/lib.h b/mach/minixST/libsys/lib.h
new file mode 100644
index 00000000..32c25c78
--- /dev/null
+++ b/mach/minixST/libsys/lib.h
@@ -0,0 +1,13 @@
+#include
+#include
+#include
+#include
+
+extern message M;
+
+#define MM 0
+#define FS 1
+
+extern int callm1(), callm3(), callx(), len();
+extern int errno;
+extern int begsig(); /* interrupts all vector here */
diff --git a/mach/minixST/libsys/link.c b/mach/minixST/libsys/link.c
new file mode 100644
index 00000000..9daee380
--- /dev/null
+++ b/mach/minixST/libsys/link.c
@@ -0,0 +1,7 @@
+#include "lib.h"
+
+PUBLIC int link(name, name2)
+char *name, *name2;
+{
+ return callm1(FS, LINK, len(name), len(name2), 0, name, name2, NIL_PTR);
+}
diff --git a/mach/minixST/libsys/lseek.c b/mach/minixST/libsys/lseek.c
new file mode 100644
index 00000000..ffcf165d
--- /dev/null
+++ b/mach/minixST/libsys/lseek.c
@@ -0,0 +1,15 @@
+#include "lib.h"
+
+PUBLIC long lseek(fd, offset, whence)
+int fd;
+long offset;
+int whence;
+{
+ int k;
+ M.m2_i1 = fd;
+ M.m2_l1 = offset;
+ M.m2_i2 = whence;
+ k = callx(FS, LSEEK);
+ if (k != OK) return( (long) k); /* send itself failed */
+ return(M.m2_l1);
+}
diff --git a/mach/minixST/libsys/mknod.c b/mach/minixST/libsys/mknod.c
new file mode 100644
index 00000000..7dbfeca1
--- /dev/null
+++ b/mach/minixST/libsys/mknod.c
@@ -0,0 +1,8 @@
+#include "lib.h"
+
+PUBLIC int mknod(name, mode, addr)
+char *name;
+int mode, addr;
+{
+ return callm1(FS, MKNOD, len(name), mode, addr, name, NIL_PTR, NIL_PTR);
+}
diff --git a/mach/minixST/libsys/mktemp.c b/mach/minixST/libsys/mktemp.c
new file mode 100644
index 00000000..e29e5c93
--- /dev/null
+++ b/mach/minixST/libsys/mktemp.c
@@ -0,0 +1,20 @@
+/* mktemp - make a name for a temporary file */
+
+char *mktemp(template)
+char *template;
+{
+ int pid, k;
+ char *p;
+
+ pid = getpid(); /* get process id as semi-unique number */
+ p = template;
+ while (*p++) ; /* find end of string */
+ p--; /* backup to last character */
+
+ /* Replace XXXXXX at end of template with pid. */
+ while (*--p == 'X') {
+ *p = '0' + (pid % 10);
+ pid = pid/10;
+ }
+ return(template);
+}
diff --git a/mach/minixST/libsys/mktemp.s b/mach/minixST/libsys/mktemp.s
new file mode 100644
index 00000000..cc5b48b1
--- /dev/null
+++ b/mach/minixST/libsys/mktemp.s
@@ -0,0 +1,5 @@
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
+.define _mktemp
+_mktemp:
+ jmp __mktemp
diff --git a/mach/minixST/libsys/mount.c b/mach/minixST/libsys/mount.c
new file mode 100644
index 00000000..258276b4
--- /dev/null
+++ b/mach/minixST/libsys/mount.c
@@ -0,0 +1,8 @@
+#include "lib.h"
+
+PUBLIC int mount(special, name, rwflag)
+char *name, *special;
+int rwflag;
+{
+ return callm1(FS, MOUNT, len(special), len(name), rwflag, special, name, NIL_PTR);
+}
diff --git a/mach/minixST/libsys/open.c b/mach/minixST/libsys/open.c
new file mode 100644
index 00000000..228173d7
--- /dev/null
+++ b/mach/minixST/libsys/open.c
@@ -0,0 +1,8 @@
+#include "lib.h"
+
+PUBLIC int open(name, mode)
+char* name;
+int mode;
+{
+ return callm3(FS, OPEN, mode, name);
+}
diff --git a/mach/minixST/libsys/pause.c b/mach/minixST/libsys/pause.c
new file mode 100644
index 00000000..2a0d1f69
--- /dev/null
+++ b/mach/minixST/libsys/pause.c
@@ -0,0 +1,6 @@
+#include "lib.h"
+
+PUBLIC int pause()
+{
+ return callm1(MM, PAUSE, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+}
diff --git a/mach/minixST/libsys/pipe.c b/mach/minixST/libsys/pipe.c
new file mode 100644
index 00000000..05058808
--- /dev/null
+++ b/mach/minixST/libsys/pipe.c
@@ -0,0 +1,14 @@
+#include "lib.h"
+
+PUBLIC int pipe(fild)
+int fild[2];
+{
+ int k;
+ k = callm1(FS, PIPE, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+ if (k >= 0) {
+ fild[0] = M.m1_i1;
+ fild[1] = M.m1_i2;
+ return(0);
+ } else
+ return(k);
+}
diff --git a/mach/minixST/libsys/read.c b/mach/minixST/libsys/read.c
new file mode 100644
index 00000000..1619a4da
--- /dev/null
+++ b/mach/minixST/libsys/read.c
@@ -0,0 +1,11 @@
+#include "lib.h"
+
+PUBLIC int read(fd, buffer, nbytes)
+int fd;
+char *buffer;
+int nbytes;
+{
+ int n;
+ n = callm1(FS, READ, fd, nbytes, 0, buffer, NIL_PTR, NIL_PTR);
+ return(n);
+}
diff --git a/mach/minixST/libsys/setgid.c b/mach/minixST/libsys/setgid.c
new file mode 100644
index 00000000..823e8788
--- /dev/null
+++ b/mach/minixST/libsys/setgid.c
@@ -0,0 +1,7 @@
+#include "lib.h"
+
+PUBLIC int setgid(grp)
+int grp;
+{
+ return callm1(MM, SETGID, grp, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+}
diff --git a/mach/minixST/libsys/setuid.c b/mach/minixST/libsys/setuid.c
new file mode 100644
index 00000000..c53e0e3c
--- /dev/null
+++ b/mach/minixST/libsys/setuid.c
@@ -0,0 +1,7 @@
+#include "lib.h"
+
+PUBLIC int setuid(usr)
+int usr;
+{
+ return callm1(MM, SETUID, usr, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+}
diff --git a/mach/minixST/libsys/signal.c b/mach/minixST/libsys/signal.c
new file mode 100644
index 00000000..4c5167cb
--- /dev/null
+++ b/mach/minixST/libsys/signal.c
@@ -0,0 +1,28 @@
+#include "lib.h"
+#include
+
+int (*vectab[NSIG])(); /* array of functions to catch signals */
+
+/* The definition of signal really should be
+ * PUBLIC int (*signal(signr, func))()
+ * but some compilers refuse to accept this, even though it is correct.
+ * The only thing to do if you are stuck with such a defective compiler is
+ * change it to
+ * PUBLIC int *signal(signr, func)
+ * and change ../h/signal.h accordingly.
+ */
+
+PUBLIC int (*signal(signr, func))()
+int signr; /* which signal is being set */
+int (*func)(); /* pointer to function that catches signal */
+{
+ int r,(*old)();
+
+ old = vectab[signr - 1];
+ vectab[signr - 1] = func;
+ M.m6_i1 = signr;
+ M.m6_f1 = ( (func == SIG_IGN || func == SIG_DFL) ? func : begsig);
+ r = callx(MM, SIGNAL);
+ if (r == 1) old = SIG_IGN;
+ return( (r < 0 ? (int (*)()) r : old) );
+}
diff --git a/mach/minixST/libsys/stat.c b/mach/minixST/libsys/stat.c
new file mode 100644
index 00000000..ae7b446f
--- /dev/null
+++ b/mach/minixST/libsys/stat.c
@@ -0,0 +1,10 @@
+#include "lib.h"
+
+PUBLIC int stat(name, buffer)
+char *name;
+char *buffer;
+{
+ int n;
+ n = callm1(FS, STAT, len(name), 0, 0, name, buffer, NIL_PTR);
+ return(n);
+}
diff --git a/mach/minixST/libsys/stderr.c b/mach/minixST/libsys/stderr.c
new file mode 100644
index 00000000..7910f77e
--- /dev/null
+++ b/mach/minixST/libsys/stderr.c
@@ -0,0 +1,8 @@
+std_err(s)
+char *s;
+{
+ char *p = s;
+
+ while(*p != 0) p++;
+ write(2, s, (int)(p - s));
+}
diff --git a/mach/minixST/libsys/stime.c b/mach/minixST/libsys/stime.c
new file mode 100644
index 00000000..548ac37c
--- /dev/null
+++ b/mach/minixST/libsys/stime.c
@@ -0,0 +1,8 @@
+#include "lib.h"
+
+PUBLIC int stime(top)
+long *top;
+{
+ M.m2_l1 = *top;
+ return callx(FS, STIME);
+}
diff --git a/mach/minixST/libsys/stty.c b/mach/minixST/libsys/stty.c
new file mode 100644
index 00000000..7dfe3db3
--- /dev/null
+++ b/mach/minixST/libsys/stty.c
@@ -0,0 +1,9 @@
+#include
+
+stty(fd, argp)
+int fd;
+char *argp;
+{
+ return ioctl(fd, TIOCSETP, argp);
+}
+
diff --git a/mach/minixST/libsys/sync.c b/mach/minixST/libsys/sync.c
new file mode 100644
index 00000000..4592d28c
--- /dev/null
+++ b/mach/minixST/libsys/sync.c
@@ -0,0 +1,6 @@
+#include "lib.h"
+
+PUBLIC int sync()
+{
+ return callm1(FS, SYNC, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+}
diff --git a/mach/minixST/libsys/time.c b/mach/minixST/libsys/time.c
new file mode 100644
index 00000000..e34e1f24
--- /dev/null
+++ b/mach/minixST/libsys/time.c
@@ -0,0 +1,13 @@
+#include "lib.h"
+
+PUBLIC long time(tp)
+long *tp;
+{
+ int k;
+ long l;
+ k = callm1(FS, TIME, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+ if (M.m_type < 0 || k != OK) {errno = -M.m_type; return(-1L);}
+ l = M.m2_l1;
+ if (tp != (long *) 0) *tp = l;
+ return(l);
+}
diff --git a/mach/minixST/libsys/times.c b/mach/minixST/libsys/times.c
new file mode 100644
index 00000000..77515d69
--- /dev/null
+++ b/mach/minixST/libsys/times.c
@@ -0,0 +1,15 @@
+#include "lib.h"
+#include
+#include
+
+PUBLIC int times(buf)
+struct tms *buf;
+{
+ int k;
+ k = callm1(FS, TIMES, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+ buf->tms_utime = M.m4_l1;
+ buf->tms_stime = M.m4_l2;
+ buf->tms_cutime = M.m4_l3;
+ buf->tms_cstime = M.m4_l4;
+ return(k);
+}
diff --git a/mach/minixST/libsys/umask.c b/mach/minixST/libsys/umask.c
new file mode 100644
index 00000000..caeb0754
--- /dev/null
+++ b/mach/minixST/libsys/umask.c
@@ -0,0 +1,7 @@
+#include "lib.h"
+
+PUBLIC int umask(complmode)
+int complmode;
+{
+ return callm1(FS, UMASK, complmode, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+}
diff --git a/mach/minixST/libsys/umount.c b/mach/minixST/libsys/umount.c
new file mode 100644
index 00000000..d1fab6da
--- /dev/null
+++ b/mach/minixST/libsys/umount.c
@@ -0,0 +1,7 @@
+#include "lib.h"
+
+PUBLIC int umount(name)
+char* name;
+{
+ return callm3(FS, UMOUNT, 0, name);
+}
diff --git a/mach/minixST/libsys/unlink.c b/mach/minixST/libsys/unlink.c
new file mode 100644
index 00000000..9c321ff2
--- /dev/null
+++ b/mach/minixST/libsys/unlink.c
@@ -0,0 +1,7 @@
+#include "lib.h"
+
+PUBLIC int unlink(name)
+char *name;
+{
+ return callm3(FS, UNLINK, 0, name);
+}
diff --git a/mach/minixST/libsys/utime.c b/mach/minixST/libsys/utime.c
new file mode 100644
index 00000000..0c9b4ef4
--- /dev/null
+++ b/mach/minixST/libsys/utime.c
@@ -0,0 +1,12 @@
+#include "lib.h"
+
+PUBLIC int utime(name, timp)
+char *name;
+long timp[2];
+{
+ M.m2_i1 = len(name);
+ M.m2_l1 = timp[0];
+ M.m2_l2 = timp[1];
+ M.m2_p1 = name;
+ return callx(FS, UTIME);
+}
diff --git a/mach/minixST/libsys/wait.c b/mach/minixST/libsys/wait.c
new file mode 100644
index 00000000..2d8728fd
--- /dev/null
+++ b/mach/minixST/libsys/wait.c
@@ -0,0 +1,10 @@
+#include "lib.h"
+
+PUBLIC int wait(status)
+int *status;
+{
+ int k;
+ k = callm1(MM, WAIT, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR);
+ if (k >= 0 && status != 0) *status = M.m2_i1;
+ return(k);
+}
diff --git a/mach/minixST/libsys/write.c b/mach/minixST/libsys/write.c
new file mode 100644
index 00000000..e08826b0
--- /dev/null
+++ b/mach/minixST/libsys/write.c
@@ -0,0 +1,8 @@
+#include "lib.h"
+
+PUBLIC int write(fd, buffer, nbytes)
+char *buffer;
+int nbytes;
+{
+ return callm1(FS, WRITE, fd, nbytes, 0, buffer, NIL_PTR, NIL_PTR);
+}
diff --git a/mach/moon3/ncg/Makefile b/mach/moon3/ncg/Makefile
new file mode 100644
index 00000000..f5e2bda6
--- /dev/null
+++ b/mach/moon3/ncg/Makefile
@@ -0,0 +1,197 @@
+# $Header$
+
+EMHOME=../../..
+#preprocessor flags for table
+TABLEFLAGS=
+#cgg options
+CGGFLAGS=
+
+PREFLAGS=-I$(EMHOME)/h -I. -I$(EMHOME)/mach -I$(EMHOME)/modules/h -DNDEBUG
+PFLAGS=
+CFLAGS=$(PREFLAGS) $(PFLAGS) -O
+LDFLAGS=$(PFLAGS)
+LINTOPTS=-bx
+LIBS=$(EMHOME)/lib/em_data.a $(EMHOME)/modules/lib/libflt.a
+CDIR=$(EMHOME)/mach/proto/ncg
+CGG=$(EMHOME)/lib/ncgg
+CPP=$(EMHOME)/lib/cpp
+CFILES=$(CDIR)/codegen.c $(CDIR)/compute.c $(CDIR)/equiv.c $(CDIR)/fillem.c \
+ $(CDIR)/gencode.c $(CDIR)/glosym.c $(CDIR)/label.c $(CDIR)/main.c \
+ $(CDIR)/move.c $(CDIR)/nextem.c $(CDIR)/reg.c $(CDIR)/regvar.c \
+ $(CDIR)/salloc.c $(CDIR)/state.c $(CDIR)/subr.c $(CDIR)/var.c
+OFILES=codegen.o compute.o equiv.o fillem.o gencode.o glosym.o label.o \
+ main.o move.o nextem.o reg.o regvar.o salloc.o state.o subr.o var.o
+
+all: tables.c
+ make "EMHOME="$(EMHOME) cg
+
+cg: tables.o $(OFILES)
+ $(CC) $(LDFLAGS) $(OFILES) tables.o $(LIBS) -o cg
+
+tables.o: tables.c
+ $(CC) -c $(PREFLAGS) -I$(CDIR) tables.c
+
+codegen.o: $(CDIR)/codegen.c
+ $(CC) -c $(CFLAGS) $(CDIR)/codegen.c
+compute.o: $(CDIR)/compute.c
+ $(CC) -c $(CFLAGS) $(CDIR)/compute.c
+equiv.o: $(CDIR)/equiv.c
+ $(CC) -c $(CFLAGS) $(CDIR)/equiv.c
+fillem.o: $(CDIR)/fillem.c
+ $(CC) -c $(CFLAGS) $(CDIR)/fillem.c
+gencode.o: $(CDIR)/gencode.c
+ $(CC) -c $(CFLAGS) $(CDIR)/gencode.c
+glosym.o: $(CDIR)/glosym.c
+ $(CC) -c $(CFLAGS) $(CDIR)/glosym.c
+label.o: $(CDIR)/label.c
+ $(CC) -c $(CFLAGS) $(CDIR)/label.c
+main.o: $(CDIR)/main.c
+ $(CC) -c $(CFLAGS) $(CDIR)/main.c
+move.o: $(CDIR)/move.c
+ $(CC) -c $(CFLAGS) $(CDIR)/move.c
+nextem.o: $(CDIR)/nextem.c
+ $(CC) -c $(CFLAGS) $(CDIR)/nextem.c
+reg.o: $(CDIR)/reg.c
+ $(CC) -c $(CFLAGS) $(CDIR)/reg.c
+regvar.o: $(CDIR)/regvar.c
+ $(CC) -c $(CFLAGS) $(CDIR)/regvar.c
+salloc.o: $(CDIR)/salloc.c
+ $(CC) -c $(CFLAGS) $(CDIR)/salloc.c
+state.o: $(CDIR)/state.c
+ $(CC) -c $(CFLAGS) $(CDIR)/state.c
+subr.o: $(CDIR)/subr.c
+ $(CC) -c $(CFLAGS) $(CDIR)/subr.c
+var.o: $(CDIR)/var.c
+ $(CC) -c $(CFLAGS) $(CDIR)/var.c
+
+install: all
+ $(EMHOME)/mach/install cg
+
+cmp: all
+ -$(EMHOME)/mach/compare cg
+
+
+tables.c: table $(CGG)
+ $(CPP) $(TABLEFLAGS) table | $(CGG) $(CGGFLAGS)
+ -cmp tables.h tables.H || cp tables.H tables.h
+
+lint: $(CFILES) tables.c
+ lint $(LINTOPTS) $(PREFLAGS) -I$(CDIR) $(CFILES) tables.c
+clean:
+ rm -f *.o tables.c tables.h debug.out cg tables.H
+
+distr: tables.c
+ rm -f tables1.c tables1.h
+ cp tables.c tables1.c
+ cp tables.h tables1.h
+ chmod -w tables1.[ch]
+
+codegen.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+codegen.o: $(CDIR)/data.h
+codegen.o: $(CDIR)/equiv.h
+codegen.o: $(CDIR)/extern.h
+codegen.o: $(CDIR)/param.h
+codegen.o: $(CDIR)/result.h
+codegen.o: $(CDIR)/state.h
+codegen.o: tables.h
+codegen.o: $(CDIR)/types.h
+compute.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+compute.o: $(CDIR)/data.h
+compute.o: $(CDIR)/extern.h
+compute.o: $(CDIR)/glosym.h
+compute.o: $(CDIR)/label.h
+compute.o: $(CDIR)/param.h
+compute.o: $(CDIR)/result.h
+compute.o: tables.h
+compute.o: $(CDIR)/types.h
+equiv.o: $(CDIR)/assert.h
+equiv.o: $(CDIR)/data.h $(EMHOME)/h/cgg_cg.h
+equiv.o: $(CDIR)/equiv.h
+equiv.o: $(CDIR)/extern.h
+equiv.o: $(CDIR)/param.h
+equiv.o: $(CDIR)/result.h
+equiv.o: tables.h
+equiv.o: $(CDIR)/types.h
+fillem.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+fillem.o: $(CDIR)/data.h
+fillem.o: $(CDIR)/extern.h
+fillem.o: mach.c
+fillem.o: mach.h
+fillem.o: $(CDIR)/param.h
+fillem.o: $(CDIR)/regvar.h
+fillem.o: $(CDIR)/result.h
+fillem.o: tables.h
+fillem.o: $(CDIR)/types.h
+gencode.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+gencode.o: $(CDIR)/data.h
+gencode.o: $(CDIR)/extern.h
+gencode.o: $(CDIR)/param.h
+gencode.o: $(CDIR)/result.h
+gencode.o: tables.h
+gencode.o: $(CDIR)/types.h
+glosym.o: $(CDIR)/glosym.h
+glosym.o: $(CDIR)/param.h
+glosym.o: tables.h
+glosym.o: $(CDIR)/types.h
+label.o: $(CDIR)/label.h
+label.o: $(CDIR)/param.h
+label.o: tables.h
+label.o: $(CDIR)/types.h
+main.o: $(CDIR)/param.h
+main.o: tables.h
+move.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+move.o: $(CDIR)/data.h
+move.o: $(CDIR)/extern.h
+move.o: $(CDIR)/param.h
+move.o: $(CDIR)/result.h
+move.o: tables.h
+move.o: $(CDIR)/types.h
+nextem.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+nextem.o: $(CDIR)/data.h
+nextem.o: $(CDIR)/extern.h
+nextem.o: $(CDIR)/param.h
+nextem.o: $(CDIR)/result.h
+nextem.o: tables.h
+nextem.o: $(CDIR)/types.h
+reg.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+reg.o: $(CDIR)/data.h
+reg.o: $(CDIR)/extern.h
+reg.o: $(CDIR)/param.h
+reg.o: $(CDIR)/result.h
+reg.o: tables.h
+reg.o: $(CDIR)/types.h
+regvar.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+regvar.o: $(CDIR)/data.h
+regvar.o: $(CDIR)/extern.h
+regvar.o: $(CDIR)/param.h
+regvar.o: $(CDIR)/regvar.h
+regvar.o: $(CDIR)/result.h
+regvar.o: tables.h
+regvar.o: $(CDIR)/types.h
+salloc.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+salloc.o: $(CDIR)/data.h
+salloc.o: $(CDIR)/extern.h
+salloc.o: $(CDIR)/param.h
+salloc.o: $(CDIR)/result.h
+salloc.o: tables.h
+salloc.o: $(CDIR)/types.h
+state.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+state.o: $(CDIR)/data.h
+state.o: $(CDIR)/extern.h
+state.o: $(CDIR)/param.h
+state.o: $(CDIR)/result.h
+state.o: $(CDIR)/state.h
+state.o: tables.h
+state.o: $(CDIR)/types.h
+subr.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+subr.o: $(CDIR)/data.h
+subr.o: $(CDIR)/extern.h
+subr.o: $(CDIR)/param.h
+subr.o: $(CDIR)/result.h
+subr.o: tables.h
+subr.o: $(CDIR)/types.h
+var.o: $(CDIR)/data.h $(EMHOME)/h/cgg_cg.h
+var.o: $(CDIR)/param.h
+var.o: $(CDIR)/result.h
+var.o: tables.h
+var.o: $(CDIR)/types.h
diff --git a/mach/ns/as/Makefile b/mach/ns/as/Makefile
new file mode 100644
index 00000000..7455a482
--- /dev/null
+++ b/mach/ns/as/Makefile
@@ -0,0 +1,67 @@
+# $Header$
+EMHOME = ../../..
+h = $(EMHOME)/h
+LIBOBJ = $(EMHOME)/modules/lib/libobject.a
+CDIR = $(EMHOME)/mach/proto/as
+CPP = $(EMHOME)/lib/cpp
+DEF =
+
+FFLAG =
+INCL = -I. -I$h $(DEF)
+CFLAGS = $(FFLAG) -O $(INCL)
+YFLAGS = -d
+LDFLAGS = $(FFLAG)
+
+CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
+ $(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
+COBJ = comm3.o comm4.o comm5.o \
+ comm6.o comm7.o comm8.o
+MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
+COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
+
+all: as
+
+install:all
+ ../../install as
+
+cmp:
+ -../../compare as
+
+clean:
+ rm -f *.o as as.[cy] y.tab.h
+
+pr: $(MACH)
+ @pr -n $(MACH)
+
+opr:
+ make pr | opr
+as: $(COBJ) as.o
+ $(CC) $(LDFLAGS) $(COBJ) as.o $(LIBOBJ) -o as
+
+as.y: $(CDIR)/comm2.y
+ $(CPP) -P -I. -I$h $(DEF) $(CDIR)/comm2.y >as.y
+ -@if test -f Expect ; then cat Expect ; else echo "expect 1 shift/reduce conflict"; fi
+
+lint: $(CSRC) as.c
+ lint $(INCL) $(CSRC) as.c
+
+y.tab.h: as.c
+$(COBJ): y.tab.h
+$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
+$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
+as.y: mach2.c
+comm3.o: mach3.c
+as.y: mach4.c
+comm8.o: mach5.c
+comm3.o: $(CDIR)/comm3.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm3.c
+comm4.o: $(CDIR)/comm4.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm4.c
+comm5.o: $(CDIR)/comm5.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm5.c
+comm6.o: $(CDIR)/comm6.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm6.c
+comm7.o: $(CDIR)/comm7.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm7.c
+comm8.o: $(CDIR)/comm8.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm8.c
diff --git a/mach/ns/libem/Makefile b/mach/ns/libem/Makefile
new file mode 100644
index 00000000..9f7b50d8
--- /dev/null
+++ b/mach/ns/libem/Makefile
@@ -0,0 +1,29 @@
+# $Header$
+MACH=ns
+
+all: libem_o.a end.o
+
+install: all
+ ../../install libem_o.a tail_em
+ ../../install end.o end_em
+
+cmp: all
+ -../../compare libem_o.a tail_em
+ -../../compare end.o end_em
+
+end.o: end.s
+ $(MACH) -I../../../h -c end.s
+
+libem_o.a: libem_s.a
+ ASAR=aal ; export ASAR ;\
+ march . libem_o.a
+
+clean:
+ rm -f *.o libem_o.a nohup.out Out
+
+opr :
+ make pr | opr
+
+pr:
+ @arch pv libem_s.a | pr -h `pwd`/libem_s.a
+ @pr `pwd`/end.s
diff --git a/mach/ns/libem/compmodule b/mach/ns/libem/compmodule
new file mode 100755
index 00000000..adf99cce
--- /dev/null
+++ b/mach/ns/libem/compmodule
@@ -0,0 +1,4 @@
+if ns -c $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi
diff --git a/mach/ns/libem/end.s b/mach/ns/libem/end.s
new file mode 100644
index 00000000..37e1cef2
--- /dev/null
+++ b/mach/ns/libem/end.s
@@ -0,0 +1,16 @@
+.define endtext,enddata,endbss,_etext,_edata,_end
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .end ! only for declaration of _end and endbss.
+
+ .sect .text
+endtext:
+_etext:
+ .sect .data
+enddata:
+_edata:
+ .sect .end
+_end:
+endbss:
diff --git a/mach/ns/libem/mon.s b/mach/ns/libem/mon.s
new file mode 100644
index 00000000..31773656
--- /dev/null
+++ b/mach/ns/libem/mon.s
@@ -0,0 +1,58 @@
+.define .mon
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+
+ .sect .text
+
+.mon:
+ cmpd 1,4(sp)
+ beq 1f
+ cmpd 3,4(sp)
+ beq 3f
+ cmpd 4,4(sp)
+ beq 4f
+ cmpd 54,4(sp)
+ beq 5f
+
+ movd .add1, tos
+ jsr @.prstr
+ movd 4(sp), tos
+ jsr @.print
+ movd .add2, tos
+ jsr @.prstr
+ ret 4
+
+1: jump @.stop
+
+3: save [r0,r1,r2,r3]
+ movd 3,r0
+ movd 28(sp),r1
+ movd 32(sp),r2
+ movd 0,r3
+ svc
+ movd r2, 32(sp)
+ movd 0,28(sp)
+ restore [r0,r1,r2,r3]
+ ret 8
+
+4: save [r0,r1,r2,r3]
+ movd 4,r0
+ movd 28(sp),r1
+ movd 32(sp),r2
+ movd 0,r3
+ svc
+ movd r2, 32(sp)
+ movd 0,28(sp)
+ restore [r0,r1,r2,r3]
+ ret 8
+
+5: movd 0, 16(sp)
+ ret 12
+
+.sect .data
+.add1: .asciz "monitor call "
+.add2: .asciz " not implemented\n"
+.align
diff --git a/mach/ns/libsys/Makefile b/mach/ns/libsys/Makefile
new file mode 100644
index 00000000..955ce97d
--- /dev/null
+++ b/mach/ns/libsys/Makefile
@@ -0,0 +1,28 @@
+# $Header$
+MACH=ns
+all: libmon_o.a head_em.o
+
+install: all
+ ../../install head_em.o head_em
+ ../../install libmon_o.a tail_mon
+
+cmp: all
+ -../../compare head_em.o head_em
+ -../../compare libmon_o.a tail_mon
+
+libmon_o.a: libmon_s.a
+ ASAR=aal ; export ASAR ;\
+ march . libmon_o.a
+
+head_em.o: head_em.s
+ $(MACH) -I../../../h -c head_em.s
+
+clean:
+ rm -f *.o libmon_o.a nohup.out Out
+
+opr :
+ make pr | opr
+
+pr:
+ @pr `pwd`/head_em.s
+ @ar pv libmon_s.a | pr -h `pwd`/libmon_s.a
diff --git a/mach/ns/libsys/compmodule b/mach/ns/libsys/compmodule
new file mode 100755
index 00000000..e32bc096
--- /dev/null
+++ b/mach/ns/libsys/compmodule
@@ -0,0 +1,4 @@
+if ns -c -L $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi
diff --git a/mach/ns/ncg/Makefile b/mach/ns/ncg/Makefile
new file mode 100644
index 00000000..f5e2bda6
--- /dev/null
+++ b/mach/ns/ncg/Makefile
@@ -0,0 +1,197 @@
+# $Header$
+
+EMHOME=../../..
+#preprocessor flags for table
+TABLEFLAGS=
+#cgg options
+CGGFLAGS=
+
+PREFLAGS=-I$(EMHOME)/h -I. -I$(EMHOME)/mach -I$(EMHOME)/modules/h -DNDEBUG
+PFLAGS=
+CFLAGS=$(PREFLAGS) $(PFLAGS) -O
+LDFLAGS=$(PFLAGS)
+LINTOPTS=-bx
+LIBS=$(EMHOME)/lib/em_data.a $(EMHOME)/modules/lib/libflt.a
+CDIR=$(EMHOME)/mach/proto/ncg
+CGG=$(EMHOME)/lib/ncgg
+CPP=$(EMHOME)/lib/cpp
+CFILES=$(CDIR)/codegen.c $(CDIR)/compute.c $(CDIR)/equiv.c $(CDIR)/fillem.c \
+ $(CDIR)/gencode.c $(CDIR)/glosym.c $(CDIR)/label.c $(CDIR)/main.c \
+ $(CDIR)/move.c $(CDIR)/nextem.c $(CDIR)/reg.c $(CDIR)/regvar.c \
+ $(CDIR)/salloc.c $(CDIR)/state.c $(CDIR)/subr.c $(CDIR)/var.c
+OFILES=codegen.o compute.o equiv.o fillem.o gencode.o glosym.o label.o \
+ main.o move.o nextem.o reg.o regvar.o salloc.o state.o subr.o var.o
+
+all: tables.c
+ make "EMHOME="$(EMHOME) cg
+
+cg: tables.o $(OFILES)
+ $(CC) $(LDFLAGS) $(OFILES) tables.o $(LIBS) -o cg
+
+tables.o: tables.c
+ $(CC) -c $(PREFLAGS) -I$(CDIR) tables.c
+
+codegen.o: $(CDIR)/codegen.c
+ $(CC) -c $(CFLAGS) $(CDIR)/codegen.c
+compute.o: $(CDIR)/compute.c
+ $(CC) -c $(CFLAGS) $(CDIR)/compute.c
+equiv.o: $(CDIR)/equiv.c
+ $(CC) -c $(CFLAGS) $(CDIR)/equiv.c
+fillem.o: $(CDIR)/fillem.c
+ $(CC) -c $(CFLAGS) $(CDIR)/fillem.c
+gencode.o: $(CDIR)/gencode.c
+ $(CC) -c $(CFLAGS) $(CDIR)/gencode.c
+glosym.o: $(CDIR)/glosym.c
+ $(CC) -c $(CFLAGS) $(CDIR)/glosym.c
+label.o: $(CDIR)/label.c
+ $(CC) -c $(CFLAGS) $(CDIR)/label.c
+main.o: $(CDIR)/main.c
+ $(CC) -c $(CFLAGS) $(CDIR)/main.c
+move.o: $(CDIR)/move.c
+ $(CC) -c $(CFLAGS) $(CDIR)/move.c
+nextem.o: $(CDIR)/nextem.c
+ $(CC) -c $(CFLAGS) $(CDIR)/nextem.c
+reg.o: $(CDIR)/reg.c
+ $(CC) -c $(CFLAGS) $(CDIR)/reg.c
+regvar.o: $(CDIR)/regvar.c
+ $(CC) -c $(CFLAGS) $(CDIR)/regvar.c
+salloc.o: $(CDIR)/salloc.c
+ $(CC) -c $(CFLAGS) $(CDIR)/salloc.c
+state.o: $(CDIR)/state.c
+ $(CC) -c $(CFLAGS) $(CDIR)/state.c
+subr.o: $(CDIR)/subr.c
+ $(CC) -c $(CFLAGS) $(CDIR)/subr.c
+var.o: $(CDIR)/var.c
+ $(CC) -c $(CFLAGS) $(CDIR)/var.c
+
+install: all
+ $(EMHOME)/mach/install cg
+
+cmp: all
+ -$(EMHOME)/mach/compare cg
+
+
+tables.c: table $(CGG)
+ $(CPP) $(TABLEFLAGS) table | $(CGG) $(CGGFLAGS)
+ -cmp tables.h tables.H || cp tables.H tables.h
+
+lint: $(CFILES) tables.c
+ lint $(LINTOPTS) $(PREFLAGS) -I$(CDIR) $(CFILES) tables.c
+clean:
+ rm -f *.o tables.c tables.h debug.out cg tables.H
+
+distr: tables.c
+ rm -f tables1.c tables1.h
+ cp tables.c tables1.c
+ cp tables.h tables1.h
+ chmod -w tables1.[ch]
+
+codegen.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+codegen.o: $(CDIR)/data.h
+codegen.o: $(CDIR)/equiv.h
+codegen.o: $(CDIR)/extern.h
+codegen.o: $(CDIR)/param.h
+codegen.o: $(CDIR)/result.h
+codegen.o: $(CDIR)/state.h
+codegen.o: tables.h
+codegen.o: $(CDIR)/types.h
+compute.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+compute.o: $(CDIR)/data.h
+compute.o: $(CDIR)/extern.h
+compute.o: $(CDIR)/glosym.h
+compute.o: $(CDIR)/label.h
+compute.o: $(CDIR)/param.h
+compute.o: $(CDIR)/result.h
+compute.o: tables.h
+compute.o: $(CDIR)/types.h
+equiv.o: $(CDIR)/assert.h
+equiv.o: $(CDIR)/data.h $(EMHOME)/h/cgg_cg.h
+equiv.o: $(CDIR)/equiv.h
+equiv.o: $(CDIR)/extern.h
+equiv.o: $(CDIR)/param.h
+equiv.o: $(CDIR)/result.h
+equiv.o: tables.h
+equiv.o: $(CDIR)/types.h
+fillem.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+fillem.o: $(CDIR)/data.h
+fillem.o: $(CDIR)/extern.h
+fillem.o: mach.c
+fillem.o: mach.h
+fillem.o: $(CDIR)/param.h
+fillem.o: $(CDIR)/regvar.h
+fillem.o: $(CDIR)/result.h
+fillem.o: tables.h
+fillem.o: $(CDIR)/types.h
+gencode.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+gencode.o: $(CDIR)/data.h
+gencode.o: $(CDIR)/extern.h
+gencode.o: $(CDIR)/param.h
+gencode.o: $(CDIR)/result.h
+gencode.o: tables.h
+gencode.o: $(CDIR)/types.h
+glosym.o: $(CDIR)/glosym.h
+glosym.o: $(CDIR)/param.h
+glosym.o: tables.h
+glosym.o: $(CDIR)/types.h
+label.o: $(CDIR)/label.h
+label.o: $(CDIR)/param.h
+label.o: tables.h
+label.o: $(CDIR)/types.h
+main.o: $(CDIR)/param.h
+main.o: tables.h
+move.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+move.o: $(CDIR)/data.h
+move.o: $(CDIR)/extern.h
+move.o: $(CDIR)/param.h
+move.o: $(CDIR)/result.h
+move.o: tables.h
+move.o: $(CDIR)/types.h
+nextem.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+nextem.o: $(CDIR)/data.h
+nextem.o: $(CDIR)/extern.h
+nextem.o: $(CDIR)/param.h
+nextem.o: $(CDIR)/result.h
+nextem.o: tables.h
+nextem.o: $(CDIR)/types.h
+reg.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+reg.o: $(CDIR)/data.h
+reg.o: $(CDIR)/extern.h
+reg.o: $(CDIR)/param.h
+reg.o: $(CDIR)/result.h
+reg.o: tables.h
+reg.o: $(CDIR)/types.h
+regvar.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+regvar.o: $(CDIR)/data.h
+regvar.o: $(CDIR)/extern.h
+regvar.o: $(CDIR)/param.h
+regvar.o: $(CDIR)/regvar.h
+regvar.o: $(CDIR)/result.h
+regvar.o: tables.h
+regvar.o: $(CDIR)/types.h
+salloc.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+salloc.o: $(CDIR)/data.h
+salloc.o: $(CDIR)/extern.h
+salloc.o: $(CDIR)/param.h
+salloc.o: $(CDIR)/result.h
+salloc.o: tables.h
+salloc.o: $(CDIR)/types.h
+state.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+state.o: $(CDIR)/data.h
+state.o: $(CDIR)/extern.h
+state.o: $(CDIR)/param.h
+state.o: $(CDIR)/result.h
+state.o: $(CDIR)/state.h
+state.o: tables.h
+state.o: $(CDIR)/types.h
+subr.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+subr.o: $(CDIR)/data.h
+subr.o: $(CDIR)/extern.h
+subr.o: $(CDIR)/param.h
+subr.o: $(CDIR)/result.h
+subr.o: tables.h
+subr.o: $(CDIR)/types.h
+var.o: $(CDIR)/data.h $(EMHOME)/h/cgg_cg.h
+var.o: $(CDIR)/param.h
+var.o: $(CDIR)/result.h
+var.o: tables.h
+var.o: $(CDIR)/types.h
diff --git a/mach/pdp/as/Makefile b/mach/pdp/as/Makefile
new file mode 100644
index 00000000..7455a482
--- /dev/null
+++ b/mach/pdp/as/Makefile
@@ -0,0 +1,67 @@
+# $Header$
+EMHOME = ../../..
+h = $(EMHOME)/h
+LIBOBJ = $(EMHOME)/modules/lib/libobject.a
+CDIR = $(EMHOME)/mach/proto/as
+CPP = $(EMHOME)/lib/cpp
+DEF =
+
+FFLAG =
+INCL = -I. -I$h $(DEF)
+CFLAGS = $(FFLAG) -O $(INCL)
+YFLAGS = -d
+LDFLAGS = $(FFLAG)
+
+CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
+ $(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
+COBJ = comm3.o comm4.o comm5.o \
+ comm6.o comm7.o comm8.o
+MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
+COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
+
+all: as
+
+install:all
+ ../../install as
+
+cmp:
+ -../../compare as
+
+clean:
+ rm -f *.o as as.[cy] y.tab.h
+
+pr: $(MACH)
+ @pr -n $(MACH)
+
+opr:
+ make pr | opr
+as: $(COBJ) as.o
+ $(CC) $(LDFLAGS) $(COBJ) as.o $(LIBOBJ) -o as
+
+as.y: $(CDIR)/comm2.y
+ $(CPP) -P -I. -I$h $(DEF) $(CDIR)/comm2.y >as.y
+ -@if test -f Expect ; then cat Expect ; else echo "expect 1 shift/reduce conflict"; fi
+
+lint: $(CSRC) as.c
+ lint $(INCL) $(CSRC) as.c
+
+y.tab.h: as.c
+$(COBJ): y.tab.h
+$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
+$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
+as.y: mach2.c
+comm3.o: mach3.c
+as.y: mach4.c
+comm8.o: mach5.c
+comm3.o: $(CDIR)/comm3.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm3.c
+comm4.o: $(CDIR)/comm4.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm4.c
+comm5.o: $(CDIR)/comm5.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm5.c
+comm6.o: $(CDIR)/comm6.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm6.c
+comm7.o: $(CDIR)/comm7.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm7.c
+comm8.o: $(CDIR)/comm8.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm8.c
diff --git a/mach/pdp/cg/Makefile b/mach/pdp/cg/Makefile
new file mode 100644
index 00000000..22f5f603
--- /dev/null
+++ b/mach/pdp/cg/Makefile
@@ -0,0 +1,184 @@
+# $Header$
+
+EMHOME=../../..
+PREFLAGS=-I$(EMHOME)/h -I. -I$(EMHOME)/mach -I$(EMHOME)/modules/h -DNDEBUG
+PFLAGS=
+CFLAGS=$(PREFLAGS) $(PFLAGS) -O
+LDFLAGS=$(PFLAGS)
+LINTOPTS=-hbxac
+LIBS=$(EMHOME)/lib/em_data.a $(EMHOME)/modules/lib/libflt.a
+CDIR=$(EMHOME)/mach/proto/cg
+CFILES=$(CDIR)/codegen.c $(CDIR)/compute.c $(CDIR)/equiv.c $(CDIR)/fillem.c \
+ $(CDIR)/gencode.c $(CDIR)/glosym.c $(CDIR)/main.c $(CDIR)/move.c \
+ $(CDIR)/nextem.c $(CDIR)/reg.c $(CDIR)/regvar.c $(CDIR)/salloc.c \
+ $(CDIR)/state.c $(CDIR)/subr.c $(CDIR)/var.c
+OFILES=codegen.o compute.o equiv.o fillem.o gencode.o glosym.o main.o\
+ move.o nextem.o reg.o regvar.o salloc.o state.o subr.o var.o
+
+all: tables.c
+ make "EMHOME="$(EMHOME) cg
+
+cg: tables.o $(OFILES)
+ $(CC) $(LDFLAGS) $(OFILES) tables.o $(LIBS) -o cg
+
+tables.o: tables.c
+ $(CC) -c $(PREFLAGS) -I$(CDIR) tables.c
+
+codegen.o: $(CDIR)/codegen.c
+ $(CC) -c $(CFLAGS) $(CDIR)/codegen.c
+compute.o: $(CDIR)/compute.c
+ $(CC) -c $(CFLAGS) $(CDIR)/compute.c
+equiv.o: $(CDIR)/equiv.c
+ $(CC) -c $(CFLAGS) $(CDIR)/equiv.c
+fillem.o: $(CDIR)/fillem.c
+ $(CC) -c $(CFLAGS) $(CDIR)/fillem.c
+gencode.o: $(CDIR)/gencode.c
+ $(CC) -c $(CFLAGS) $(CDIR)/gencode.c
+glosym.o: $(CDIR)/glosym.c
+ $(CC) -c $(CFLAGS) $(CDIR)/glosym.c
+main.o: $(CDIR)/main.c
+ $(CC) -c $(CFLAGS) $(CDIR)/main.c
+move.o: $(CDIR)/move.c
+ $(CC) -c $(CFLAGS) $(CDIR)/move.c
+nextem.o: $(CDIR)/nextem.c
+ $(CC) -c $(CFLAGS) $(CDIR)/nextem.c
+reg.o: $(CDIR)/reg.c
+ $(CC) -c $(CFLAGS) $(CDIR)/reg.c
+regvar.o: $(CDIR)/regvar.c
+ $(CC) -c $(CFLAGS) $(CDIR)/regvar.c
+salloc.o: $(CDIR)/salloc.c
+ $(CC) -c $(CFLAGS) $(CDIR)/salloc.c
+state.o: $(CDIR)/state.c
+ $(CC) -c $(CFLAGS) $(CDIR)/state.c
+subr.o: $(CDIR)/subr.c
+ $(CC) -c $(CFLAGS) $(CDIR)/subr.c
+var.o: $(CDIR)/var.c
+ $(CC) -c $(CFLAGS) $(CDIR)/var.c
+
+install: all
+ ../../install cg
+
+cmp: all
+ -../../compare cg
+
+distr: tables.c
+ rm -f tables1.[ch]
+ cp tables.c tables1.c
+ cp tables.h tables1.h
+ chmod -w tables1.[ch]
+
+
+tables.c: table
+ -mv tables.h tables.h.save
+ $(EMHOME)/lib/cpp -P table | $(EMHOME)/lib/cgg > debug.out
+ -if cmp -s tables.h.save tables.h; then mv tables.h.save tables.h; else exit 0; fi
+ -if cmp -s /dev/null tables.h; then mv tables.h.save tables.h; else exit 0; fi
+
+lint: $(CFILES)
+ lint $(LINTOPTS) $(PREFLAGS) $(CFILES)
+clean:
+ rm -f *.o tables.c tables.h debug.out cg tables.h.save
+
+codegen.o: $(CDIR)/assert.h
+codegen.o: $(CDIR)/data.h
+codegen.o: $(CDIR)/equiv.h
+codegen.o: $(CDIR)/extern.h
+codegen.o: $(CDIR)/param.h
+codegen.o: $(CDIR)/result.h
+codegen.o: $(CDIR)/state.h
+codegen.o: tables.h
+codegen.o: $(CDIR)/types.h
+compute.o: $(CDIR)/assert.h
+compute.o: $(CDIR)/data.h
+compute.o: $(CDIR)/extern.h
+compute.o: $(CDIR)/glosym.h
+compute.o: $(CDIR)/param.h
+compute.o: $(CDIR)/result.h
+compute.o: tables.h
+compute.o: $(CDIR)/types.h
+equiv.o: $(CDIR)/assert.h
+equiv.o: $(CDIR)/data.h
+equiv.o: $(CDIR)/equiv.h
+equiv.o: $(CDIR)/extern.h
+equiv.o: $(CDIR)/param.h
+equiv.o: $(CDIR)/result.h
+equiv.o: tables.h
+equiv.o: $(CDIR)/types.h
+fillem.o: $(CDIR)/assert.h
+fillem.o: $(CDIR)/data.h
+fillem.o: $(CDIR)/extern.h
+fillem.o: mach.c
+fillem.o: mach.h
+fillem.o: $(CDIR)/param.h
+fillem.o: $(CDIR)/regvar.h
+fillem.o: $(CDIR)/result.h
+fillem.o: tables.h
+fillem.o: $(CDIR)/types.h
+gencode.o: $(CDIR)/assert.h
+gencode.o: $(CDIR)/data.h
+gencode.o: $(CDIR)/extern.h
+gencode.o: $(CDIR)/param.h
+gencode.o: $(CDIR)/result.h
+gencode.o: tables.h
+gencode.o: $(CDIR)/types.h
+glosym.o: $(CDIR)/glosym.h
+glosym.o: $(CDIR)/param.h
+glosym.o: tables.h
+glosym.o: $(CDIR)/types.h
+main.o: $(CDIR)/param.h
+move.o: $(CDIR)/assert.h
+move.o: $(CDIR)/data.h
+move.o: $(CDIR)/extern.h
+move.o: $(CDIR)/param.h
+move.o: $(CDIR)/result.h
+move.o: tables.h
+move.o: $(CDIR)/types.h
+nextem.o: $(CDIR)/assert.h
+nextem.o: $(CDIR)/data.h
+nextem.o: $(CDIR)/extern.h
+nextem.o: $(CDIR)/param.h
+nextem.o: $(CDIR)/result.h
+nextem.o: tables.h
+nextem.o: $(CDIR)/types.h
+reg.o: $(CDIR)/assert.h
+reg.o: $(CDIR)/data.h
+reg.o: $(CDIR)/extern.h
+reg.o: $(CDIR)/param.h
+reg.o: $(CDIR)/result.h
+reg.o: tables.h
+reg.o: $(CDIR)/types.h
+regvar.o: $(CDIR)/assert.h
+regvar.o: $(CDIR)/data.h
+regvar.o: $(CDIR)/extern.h
+regvar.o: $(CDIR)/param.h
+regvar.o: $(CDIR)/regvar.h
+regvar.o: $(CDIR)/result.h
+regvar.o: tables.h
+regvar.o: $(CDIR)/types.h
+salloc.o: $(CDIR)/assert.h
+salloc.o: $(CDIR)/data.h
+salloc.o: $(CDIR)/extern.h
+salloc.o: $(CDIR)/param.h
+salloc.o: $(CDIR)/result.h
+salloc.o: tables.h
+salloc.o: $(CDIR)/types.h
+state.o: $(CDIR)/assert.h
+state.o: $(CDIR)/data.h
+state.o: $(CDIR)/extern.h
+state.o: $(CDIR)/param.h
+state.o: $(CDIR)/result.h
+state.o: $(CDIR)/state.h
+state.o: tables.h
+state.o: $(CDIR)/types.h
+subr.o: $(CDIR)/assert.h
+subr.o: $(CDIR)/data.h
+subr.o: $(CDIR)/extern.h
+subr.o: $(CDIR)/param.h
+subr.o: $(CDIR)/result.h
+subr.o: tables.h
+subr.o: $(CDIR)/types.h
+var.o: $(CDIR)/data.h
+var.o: $(CDIR)/param.h
+var.o: $(CDIR)/result.h
+var.o: tables.h
+var.o: $(CDIR)/types.h
diff --git a/mach/pdp/cg/peep.c b/mach/pdp/cg/peep.c
new file mode 100644
index 00000000..32d0d040
--- /dev/null
+++ b/mach/pdp/cg/peep.c
@@ -0,0 +1,135 @@
+#ifndef NORCSID
+static char rcsid[] = "$Header$";
+#endif
+
+#include
+
+/*
+ * (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
+ *
+ * Author: Hans van Staveren
+ */
+
+char buf[512];
+char *index();
+
+main() {
+ register n,sa;
+ register char *p;
+
+ sa=0;
+ for (;;) {
+ getline(buf);
+ if (n=stackadjust()) {
+ sa += n;
+ continue;
+ }
+ if (nullinstruction())
+ continue;
+ if (sa) {
+ if (buf[0]=='t' && buf[1]=='s' && buf[2]=='t' && buf[3]==' ') {
+ sa -= 2;
+ buf[0]='m';
+ buf[1]='o';
+ buf[2]='v';
+ strcat(buf,",(sp)+");
+ } else if (buf[0]=='m' && buf[1]=='o' && buf[2]=='v' &&
+ buf[3]==' ' && (p=index(&buf[5],','))!=0 &&
+ p[1]=='-' && p[2]=='(' && p[3]=='s') {
+ sa -= 2;
+ p[1]=' ';
+ }
+ }
+ switch(sa) {
+ case 0:break;
+ case 2:puts("tst (sp)+");sa=0;break;
+ case 4:puts("cmp (sp)+,(sp)+");sa=0;break;
+ case 6:puts("add $06,sp");sa=0;break;
+ }
+ puts(buf);
+ }
+}
+
+getline(buf) register char *buf; {
+ register c;
+
+ while ((c=getchar())==' ' || c=='\t')
+ ;
+ if (c==EOF)
+ exit(0);
+ do *buf++=c;
+ while ((c=getchar())!='\n');
+ *buf=0;
+}
+
+stackadjust() {
+
+ if (buf[0]=='t' &&
+ buf[1]=='s' &&
+ buf[2]=='t' &&
+ buf[3]==' ' &&
+ buf[4]=='(' &&
+ buf[5]=='s' &&
+ buf[6]=='p' &&
+ buf[7]==')' &&
+ buf[8]=='+') return(2);
+ if (buf[0]=='c' &&
+ buf[1]=='m' &&
+ buf[2]=='p' &&
+ buf[3]==' ' &&
+ buf[4]=='(' &&
+ buf[5]=='s' &&
+ buf[6]=='p' &&
+ buf[7]==')' &&
+ buf[8]=='+' &&
+ buf[9]==',' &&
+ buf[10]=='(' &&
+ buf[11]=='s' &&
+ buf[12]=='p' &&
+ buf[13]==')' &&
+ buf[14]=='+') return(4);
+ if (buf[0]=='a' &&
+ buf[1]=='d' &&
+ buf[2]=='d' &&
+ buf[3]==' ' &&
+ buf[4]=='$' &&
+ buf[5]=='0' &&
+ buf[6]=='6' &&
+ buf[7]==',' &&
+ buf[8]=='s' &&
+ buf[9]=='p' &&
+ buf[10]==0) return(6);
+ return(0);
+}
+
+nullinstruction() {
+ register char *p;
+
+ if (buf[4]=='$' && buf[5]=='0' && buf[6]=='0' && buf[7]==',') {
+ p=index(buf,'-');
+ if (p!=0 && p[1]=='(')
+ return(0);
+ p=index(buf,'+');
+ if (p!=0 && p[-1]==')')
+ return(0);
+ if (buf[0]=='b' && buf[1]=='i' && (buf[2]=='s' || buf[2]=='c'))
+ return(1);
+ if (buf[0]=='a' && buf[1]=='d' && buf[2]=='d')
+ return(1);
+ if (buf[0]=='s' && buf[1]=='u' && buf[2]=='b')
+ return(1);
+ }
+ return(0);
+}
diff --git a/mach/pdp/cv/Makefile b/mach/pdp/cv/Makefile
new file mode 100644
index 00000000..5cfa97a6
--- /dev/null
+++ b/mach/pdp/cv/Makefile
@@ -0,0 +1,25 @@
+EMHOME = ../../..
+LIBOBJ = $(EMHOME)/modules/lib/libobject.a
+INCLUDE = $(EMHOME)/h
+CFLAGS = -I. -I$(INCLUDE) -O
+TARGETS = cv
+
+all: $(TARGETS)
+
+install: all
+ ../../install cv
+
+cmp: all
+ ../../compare cv
+
+cv: cv.o
+ $(CC) $(LDFLAGS) -o cv cv.o $(LIBOBJ)
+
+clean:
+ rm -f $(TARGETS) *.o nohup.out Out
+
+pr:
+ @pr Makefile cv.c
+
+opr:
+ make pr | opr
diff --git a/mach/pdp/int/Makefile b/mach/pdp/int/Makefile
new file mode 100644
index 00000000..d689fb26
--- /dev/null
+++ b/mach/pdp/int/Makefile
@@ -0,0 +1,51 @@
+INTS=em_t--- em_---- em_tf-- em_t-c- em_t--p
+b=../../../lib/em22
+
+all: $(INTS) eminform em
+
+em: em.c
+ $(CC) -o em -I../../../h em.c
+
+eminform: eminform.s
+ as eminform.s;ld -i -o eminform a.out -lc
+
+em_t---: t+ f- c- p- em_int.s
+ as t+ f- c- p- em_int.s;ld -i -o em_t--- a.out -lc
+
+em_----: t- f- c- p- em_int.s
+ as t- f- c- p- em_int.s;ld -i -o em_---- a.out -lc
+
+em_tf--: t+ f+ c- p- em_int.s
+ as t+ f+ c- p- em_int.s;ld -i -o em_tf-- a.out -lc
+
+em_t-c-: t+ f- c+ p- em_int.s
+ as t+ f- c+ p- em_int.s;ld -i -o em_t-c- a.out -lc
+
+em_t--p: t+ f- c- p+ em_int.s
+ as t+ f- c- p+ em_int.s;ld -i -o em_t--p a.out -lc
+
+install: all
+ -mkdir $b
+ cp em_???? $b
+ cp em eminform ../../../bin
+ cp em.1 eminform.1 ../../../man
+
+cmp: all
+ -cmp em_t--- $b/em_t---
+ -cmp em_---- $b/em_----
+ -cmp em_tf-- $b/em_tf--
+ -cmp em_t-c- $b/em_t-c-
+ -cmp em_t--p $b/em_t--p
+ -cmp em ../../../bin/em
+ -cmp eminform ../../../bin/eminform
+ -cmp em.1 ../../../man/em.1
+ -cmp eminform.1 ../../../man/eminform.1
+
+clean:
+ -rm -f *.o *.old a.out em eminform $(INTS)
+
+opr:
+ make pr | opr
+
+pr:
+ @pr em.c em_int.s eminform.s
diff --git a/mach/pdp/libem/Makefile b/mach/pdp/libem/Makefile
new file mode 100644
index 00000000..d4a42a35
--- /dev/null
+++ b/mach/pdp/libem/Makefile
@@ -0,0 +1,33 @@
+all: head_em.o libem_o.a end.o
+
+install: cp
+
+cp: all
+ ../../install head_em.o head_em
+ ../../install libem_o.a tail_em
+ ../../install end.o end_em
+
+cmp: all
+ -../../compare head_em.o head_em
+ -../../compare libem_o.a tail_em
+ -../../compare end.o end_em
+
+
+head_em.o: head_em.s
+ pdp -c head_em.s
+
+end.o: end.s
+ pdp -c end.s
+
+libem_o.a: libem_s.a
+ ASAR=aal ; export ASAR ; march . libem_o.a
+
+clean:
+ rm -f *.o libem_o.a
+
+opr:
+ make pr | opr
+
+pr:
+ @pr `pwd`/Makefile `pwd`/head_em.s
+ @arch pv libem_s.a | pr -h `pwd`/libem_s.a
diff --git a/mach/pdp/libem/blm.s b/mach/pdp/libem/blm.s
new file mode 100644
index 00000000..ea55f5f1
--- /dev/null
+++ b/mach/pdp/libem/blm.s
@@ -0,0 +1,29 @@
+/ $Header$
+.globl blm~
+.globl save~,retu~
+
+/ Size in r0
+blm~:
+ jsr pc,save~
+ mov (sp)+,r2
+ mov (sp)+,r3
+ mov r0,r1
+ asr r0
+ beq 2f
+/ Now avoid wrong copy.
+/ The pieces may overlap !
+ cmp r3,r2
+ beq 2f
+ blt 3f
+1:
+ mov (r3)+,(r2)+
+ sob r0,1b
+2:
+ jmp retu~
+3:
+ add r1,r3
+ add r1,r2
+4:
+ mov -(r3),-(r2)
+ sob r0,4b
+ br 2b
diff --git a/mach/pdp/libem/compmodule b/mach/pdp/libem/compmodule
new file mode 100755
index 00000000..e6e7c76e
--- /dev/null
+++ b/mach/pdp/libem/compmodule
@@ -0,0 +1,4 @@
+if pdp -c $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi
diff --git a/mach/pdp/libem/end.s b/mach/pdp/libem/end.s
new file mode 100644
index 00000000..37e1cef2
--- /dev/null
+++ b/mach/pdp/libem/end.s
@@ -0,0 +1,16 @@
+.define endtext,enddata,endbss,_etext,_edata,_end
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .end ! only for declaration of _end and endbss.
+
+ .sect .text
+endtext:
+_etext:
+ .sect .data
+enddata:
+_edata:
+ .sect .end
+_end:
+endbss:
diff --git a/mach/pdp/libem/head_em.s b/mach/pdp/libem/head_em.s
new file mode 100644
index 00000000..00900d17
--- /dev/null
+++ b/mach/pdp/libem/head_em.s
@@ -0,0 +1,75 @@
+#
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define LINO_AD,FILN_AD
+.define ERANGE,ESET,EHEAP,EILLINS,ECASE
+.define hol0,trppc~,trpim~,reghp~,.limhp
+! $Header$
+
+#define float 1
+#define hardfp 1
+
+LINO_AD = 0
+FILN_AD = 4
+
+ERANGE = 1
+ESET = 2
+EFOVFL = 4
+EFUNFL = 5
+EFDIVZ = 7
+EFUND = 011
+ECONV = 012
+EHEAP = 021
+EILLINS = 022
+ECASE = 024
+
+#ifdef float
+#ifndef hardfp
+! sys 060;.data2 4,fptrap / if not commented it will appear as undefined
+#endif
+ sys 060;.data2 010,sig8
+ ldfps $07600
+#endif
+ mov 2(sp),r0
+ clr -2(r0)
+ mov sp,r0
+ sub $4,sp
+ mov 4(sp),(sp)
+ tst (r0)+
+ mov r0,2(sp)
+1:
+ tst (r0)+
+ bne 1b
+ cmp r0,*2(sp)
+ blo 1f
+ tst -(r0)
+1:
+ mov r0,4(sp)
+ jsr pc,__m_a_i_n
+! next two lines for as long as tail needs printf
+! mov r0,-(sp)
+! jsr pc,*$_exit
+ sys 1
+
+ .sect .data
+hol0: .data2 0,0 ! line no
+ .data2 0,0 ! file
+trppc~: .data2 0
+trpim~: .data2 0
+reghp~: .data2 _end
+.limhp: .data2 _end
+
+ .sect .text
+sig8:
+#ifdef float
+ mov r0,-(sp)
+ stst r0
+ mov 1f(r0),-(sp)
+ jsr pc,trp~
+ sys 060;.data2 010,sig8
+ mov (sp)+,r0
+ rti
+
+ .sect .data
+1: .data2 EILLINS, EILLINS, EFDIVZ, ECONV, EFOVFL, EFUNFL, EFUND, EILLINS
+ .sect .text
+#endif
diff --git a/mach/pdp/libem/hlt.s b/mach/pdp/libem/hlt.s
new file mode 100644
index 00000000..0fae864f
--- /dev/null
+++ b/mach/pdp/libem/hlt.s
@@ -0,0 +1,12 @@
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.sect .text
+.define hlt~
+! $Header$
+
+exit = 1
+
+hlt~:
+ mov (sp)+,r0
+ bne 1f
+ sys exit
+1: .data2 4
diff --git a/mach/pdp/libem/sigtrp.s b/mach/pdp/libem/sigtrp.s
new file mode 100644
index 00000000..214826a7
--- /dev/null
+++ b/mach/pdp/libem/sigtrp.s
@@ -0,0 +1,93 @@
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.sect .text
+.define sigtrp~
+.define trp~,save~,retu~
+! $Header$
+
+indir = 0
+signal = 060
+
+sig1: mov sig.trp+0,-(sp)
+ br 1f
+sig2: mov sig.trp+2,-(sp)
+ br 1f
+sig3: mov sig.trp+4,-(sp)
+ br 1f
+sig4: mov sig.trp+6,-(sp)
+ br 1f
+sig5: mov sig.trp+010,-(sp)
+ br 1f
+sig6: mov sig.trp+012,-(sp)
+ br 1f
+sig7: mov sig.trp+014,-(sp)
+ br 1f
+sig10: mov sig.trp+022,-(sp)
+ br 1f
+sig11: mov sig.trp+024,-(sp)
+ br 1f
+sig12: mov sig.trp+026,-(sp)
+ br 1f
+sig13: mov sig.trp+030,-(sp)
+ br 1f
+sig14: mov sig.trp+032,-(sp)
+ br 1f
+sig15: mov sig.trp+034,-(sp)
+ br 1f
+sig16: mov sig.trp+036,-(sp)
+ br 1f
+1:
+ jsr pc,trp~
+ rti
+
+sigtrp~:
+ jsr pc,save~
+ tst (sp)+
+ mov (sp)+,r1
+ mov (sp)+,r0
+ ble sig.bad
+ cmp r0,$020
+ bhi sig.bad
+ mov r0,call+02
+ asl r0
+ mov sig.trp-2(r0),r3
+ cmp r1,$0400
+ bhis 1f
+ mov sig.adr-2(r0),r2
+ bne 2f
+sig.bad:
+ mov $-1,r0
+sigbad:
+ mov r0,-(sp)
+ mov r0,-(sp)
+ jmp retu~
+1: cmp r1,$-3
+ blo sig.bad
+ mov r1,r2
+ inc r2
+ inc r2
+2: mov r1,sig.trp-2(r0)
+ mov r2,call+04
+ sys indir ; .data2 call
+ bcs sigbad
+ asr r0
+ bcc 1f
+ mov $-3,-(sp)
+ clr -(sp)
+ jmp retu~
+1: mov r3,-(sp)
+ clr -(sp)
+ jmp retu~
+
+.sect .data
+call: sys signal
+ .data2 0, 0
+sig.trp:
+ .data2 -2, -2, -2, -2
+ .data2 -2, -2, -2, -2
+ .data2 -2, -2, -2, -2
+ .data2 -2, -2, -2, -2
+sig.adr:
+ .data2 sig1, sig2, sig3, sig
+ .data2 sig5, sig6, sig7, 0
+ .data2 0, sig10, sig11, sig12
+ .data2 sig13, sig14, sig15, sig16
diff --git a/mach/pdp/libpc/makefile b/mach/pdp/libpc/makefile
new file mode 100644
index 00000000..ddc6a8e6
--- /dev/null
+++ b/mach/pdp/libpc/makefile
@@ -0,0 +1,21 @@
+MAKEFILE=../../proto/libg/Makefile
+MACHDEF="MACH=pdp -Rbe-p2" "SUF=s" "ASAR=ar"
+PCDEF="PREF=pc" "SUB=" "SRC=lang/pc/libpc"
+LIBDIR=../lib
+
+install:
+ make -f $(MAKEFILE) $(PCDEF) $(MACHDEF) cp
+
+cmp:
+ make -f $(MAKEFILE) $(PCDEF) $(MACHDEF) all
+ cmp head_pc $(LIBDIR)/head_pc
+ cmp tail_pc $(LIBDIR)/tail_pc
+
+clean:
+ -rm -f *.old *.[ce$(SUF)] tail* head*
+
+opr:
+ make pr | opr
+
+pr:
+ @pr Makefile
diff --git a/mach/pdp/libsys/Makefile b/mach/pdp/libsys/Makefile
new file mode 100644
index 00000000..7e194f03
--- /dev/null
+++ b/mach/pdp/libsys/Makefile
@@ -0,0 +1,24 @@
+# $Header$
+all: libmon_o.a
+
+install: cp
+
+cp: all
+ ../../install libmon_o.a tail_mon
+
+cmp: all
+ -../../compare libmon_o.a tail_mon
+
+libmon_o.a: libmon_s.a
+ ASAR=aal ; export ASAR ;\
+ march . libmon_o.a
+
+clean:
+ rm -f *.o libmon_o.a
+
+opr:
+ make pr | opr
+
+pr:
+ @pr `pwd`/Makefile
+ @arch pv libmon_s.a | pr -h `pwd`/libmon_s.a
diff --git a/mach/pdp/libsys/compmodule b/mach/pdp/libsys/compmodule
new file mode 100755
index 00000000..da10f2f6
--- /dev/null
+++ b/mach/pdp/libsys/compmodule
@@ -0,0 +1,4 @@
+if pdp -L -O -c -I../../../h -I. $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi
diff --git a/mach/pdp/ncg/Makefile b/mach/pdp/ncg/Makefile
new file mode 100644
index 00000000..f5e2bda6
--- /dev/null
+++ b/mach/pdp/ncg/Makefile
@@ -0,0 +1,197 @@
+# $Header$
+
+EMHOME=../../..
+#preprocessor flags for table
+TABLEFLAGS=
+#cgg options
+CGGFLAGS=
+
+PREFLAGS=-I$(EMHOME)/h -I. -I$(EMHOME)/mach -I$(EMHOME)/modules/h -DNDEBUG
+PFLAGS=
+CFLAGS=$(PREFLAGS) $(PFLAGS) -O
+LDFLAGS=$(PFLAGS)
+LINTOPTS=-bx
+LIBS=$(EMHOME)/lib/em_data.a $(EMHOME)/modules/lib/libflt.a
+CDIR=$(EMHOME)/mach/proto/ncg
+CGG=$(EMHOME)/lib/ncgg
+CPP=$(EMHOME)/lib/cpp
+CFILES=$(CDIR)/codegen.c $(CDIR)/compute.c $(CDIR)/equiv.c $(CDIR)/fillem.c \
+ $(CDIR)/gencode.c $(CDIR)/glosym.c $(CDIR)/label.c $(CDIR)/main.c \
+ $(CDIR)/move.c $(CDIR)/nextem.c $(CDIR)/reg.c $(CDIR)/regvar.c \
+ $(CDIR)/salloc.c $(CDIR)/state.c $(CDIR)/subr.c $(CDIR)/var.c
+OFILES=codegen.o compute.o equiv.o fillem.o gencode.o glosym.o label.o \
+ main.o move.o nextem.o reg.o regvar.o salloc.o state.o subr.o var.o
+
+all: tables.c
+ make "EMHOME="$(EMHOME) cg
+
+cg: tables.o $(OFILES)
+ $(CC) $(LDFLAGS) $(OFILES) tables.o $(LIBS) -o cg
+
+tables.o: tables.c
+ $(CC) -c $(PREFLAGS) -I$(CDIR) tables.c
+
+codegen.o: $(CDIR)/codegen.c
+ $(CC) -c $(CFLAGS) $(CDIR)/codegen.c
+compute.o: $(CDIR)/compute.c
+ $(CC) -c $(CFLAGS) $(CDIR)/compute.c
+equiv.o: $(CDIR)/equiv.c
+ $(CC) -c $(CFLAGS) $(CDIR)/equiv.c
+fillem.o: $(CDIR)/fillem.c
+ $(CC) -c $(CFLAGS) $(CDIR)/fillem.c
+gencode.o: $(CDIR)/gencode.c
+ $(CC) -c $(CFLAGS) $(CDIR)/gencode.c
+glosym.o: $(CDIR)/glosym.c
+ $(CC) -c $(CFLAGS) $(CDIR)/glosym.c
+label.o: $(CDIR)/label.c
+ $(CC) -c $(CFLAGS) $(CDIR)/label.c
+main.o: $(CDIR)/main.c
+ $(CC) -c $(CFLAGS) $(CDIR)/main.c
+move.o: $(CDIR)/move.c
+ $(CC) -c $(CFLAGS) $(CDIR)/move.c
+nextem.o: $(CDIR)/nextem.c
+ $(CC) -c $(CFLAGS) $(CDIR)/nextem.c
+reg.o: $(CDIR)/reg.c
+ $(CC) -c $(CFLAGS) $(CDIR)/reg.c
+regvar.o: $(CDIR)/regvar.c
+ $(CC) -c $(CFLAGS) $(CDIR)/regvar.c
+salloc.o: $(CDIR)/salloc.c
+ $(CC) -c $(CFLAGS) $(CDIR)/salloc.c
+state.o: $(CDIR)/state.c
+ $(CC) -c $(CFLAGS) $(CDIR)/state.c
+subr.o: $(CDIR)/subr.c
+ $(CC) -c $(CFLAGS) $(CDIR)/subr.c
+var.o: $(CDIR)/var.c
+ $(CC) -c $(CFLAGS) $(CDIR)/var.c
+
+install: all
+ $(EMHOME)/mach/install cg
+
+cmp: all
+ -$(EMHOME)/mach/compare cg
+
+
+tables.c: table $(CGG)
+ $(CPP) $(TABLEFLAGS) table | $(CGG) $(CGGFLAGS)
+ -cmp tables.h tables.H || cp tables.H tables.h
+
+lint: $(CFILES) tables.c
+ lint $(LINTOPTS) $(PREFLAGS) -I$(CDIR) $(CFILES) tables.c
+clean:
+ rm -f *.o tables.c tables.h debug.out cg tables.H
+
+distr: tables.c
+ rm -f tables1.c tables1.h
+ cp tables.c tables1.c
+ cp tables.h tables1.h
+ chmod -w tables1.[ch]
+
+codegen.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+codegen.o: $(CDIR)/data.h
+codegen.o: $(CDIR)/equiv.h
+codegen.o: $(CDIR)/extern.h
+codegen.o: $(CDIR)/param.h
+codegen.o: $(CDIR)/result.h
+codegen.o: $(CDIR)/state.h
+codegen.o: tables.h
+codegen.o: $(CDIR)/types.h
+compute.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+compute.o: $(CDIR)/data.h
+compute.o: $(CDIR)/extern.h
+compute.o: $(CDIR)/glosym.h
+compute.o: $(CDIR)/label.h
+compute.o: $(CDIR)/param.h
+compute.o: $(CDIR)/result.h
+compute.o: tables.h
+compute.o: $(CDIR)/types.h
+equiv.o: $(CDIR)/assert.h
+equiv.o: $(CDIR)/data.h $(EMHOME)/h/cgg_cg.h
+equiv.o: $(CDIR)/equiv.h
+equiv.o: $(CDIR)/extern.h
+equiv.o: $(CDIR)/param.h
+equiv.o: $(CDIR)/result.h
+equiv.o: tables.h
+equiv.o: $(CDIR)/types.h
+fillem.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+fillem.o: $(CDIR)/data.h
+fillem.o: $(CDIR)/extern.h
+fillem.o: mach.c
+fillem.o: mach.h
+fillem.o: $(CDIR)/param.h
+fillem.o: $(CDIR)/regvar.h
+fillem.o: $(CDIR)/result.h
+fillem.o: tables.h
+fillem.o: $(CDIR)/types.h
+gencode.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+gencode.o: $(CDIR)/data.h
+gencode.o: $(CDIR)/extern.h
+gencode.o: $(CDIR)/param.h
+gencode.o: $(CDIR)/result.h
+gencode.o: tables.h
+gencode.o: $(CDIR)/types.h
+glosym.o: $(CDIR)/glosym.h
+glosym.o: $(CDIR)/param.h
+glosym.o: tables.h
+glosym.o: $(CDIR)/types.h
+label.o: $(CDIR)/label.h
+label.o: $(CDIR)/param.h
+label.o: tables.h
+label.o: $(CDIR)/types.h
+main.o: $(CDIR)/param.h
+main.o: tables.h
+move.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+move.o: $(CDIR)/data.h
+move.o: $(CDIR)/extern.h
+move.o: $(CDIR)/param.h
+move.o: $(CDIR)/result.h
+move.o: tables.h
+move.o: $(CDIR)/types.h
+nextem.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+nextem.o: $(CDIR)/data.h
+nextem.o: $(CDIR)/extern.h
+nextem.o: $(CDIR)/param.h
+nextem.o: $(CDIR)/result.h
+nextem.o: tables.h
+nextem.o: $(CDIR)/types.h
+reg.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+reg.o: $(CDIR)/data.h
+reg.o: $(CDIR)/extern.h
+reg.o: $(CDIR)/param.h
+reg.o: $(CDIR)/result.h
+reg.o: tables.h
+reg.o: $(CDIR)/types.h
+regvar.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+regvar.o: $(CDIR)/data.h
+regvar.o: $(CDIR)/extern.h
+regvar.o: $(CDIR)/param.h
+regvar.o: $(CDIR)/regvar.h
+regvar.o: $(CDIR)/result.h
+regvar.o: tables.h
+regvar.o: $(CDIR)/types.h
+salloc.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+salloc.o: $(CDIR)/data.h
+salloc.o: $(CDIR)/extern.h
+salloc.o: $(CDIR)/param.h
+salloc.o: $(CDIR)/result.h
+salloc.o: tables.h
+salloc.o: $(CDIR)/types.h
+state.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+state.o: $(CDIR)/data.h
+state.o: $(CDIR)/extern.h
+state.o: $(CDIR)/param.h
+state.o: $(CDIR)/result.h
+state.o: $(CDIR)/state.h
+state.o: tables.h
+state.o: $(CDIR)/types.h
+subr.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+subr.o: $(CDIR)/data.h
+subr.o: $(CDIR)/extern.h
+subr.o: $(CDIR)/param.h
+subr.o: $(CDIR)/result.h
+subr.o: tables.h
+subr.o: $(CDIR)/types.h
+var.o: $(CDIR)/data.h $(EMHOME)/h/cgg_cg.h
+var.o: $(CDIR)/param.h
+var.o: $(CDIR)/result.h
+var.o: tables.h
+var.o: $(CDIR)/types.h
diff --git a/mach/pdp/top/Makefile b/mach/pdp/top/Makefile
new file mode 100644
index 00000000..57908427
--- /dev/null
+++ b/mach/pdp/top/Makefile
@@ -0,0 +1,42 @@
+EMHOME=../../..
+LIBS=$(EMHOME)/modules/lib/libstring.a
+PREFLAGS=-I.
+PFLAGS=
+CFLAGS=$(PREFLAGS) $(PFLAGS) -O -DNDEBUG
+LDFLAGS=$(PFLAGS)
+LINTOPTS=-bx
+CDIR=$(EMHOME)/mach/proto/top
+CFILES=$(CDIR)/top.c $(CDIR)/queue.c
+OFILES=top.o queue.o
+
+all: gen.c
+ make top
+
+top: $(OFILES)
+ $(CC) $(LDFLAGS) $(OFILES) $(LIBS) -o top
+
+top.o: $(CDIR)/top.c gen.c
+ $(CC) -c $(CFLAGS) $(CDIR)/top.c
+
+queue.o: $(CDIR)/queue.c
+ $(CC) -c $(CFLAGS) $(CDIR)/queue.c
+
+install: all
+ $(EMHOME)/mach/install top
+
+cmp: all
+ -$(EMHOME)/mach/compare top
+
+gen.c: table
+ $(EMHOME)/lib/topgen table
+
+lint: $(CFILES)
+ lint $(LINTOPTS) $(PREFLAGS) $(CFILES)
+
+clean:
+ rm -f *.o gen.c gen.h top
+
+top.o: gen.h
+top.o: $(CDIR)/top.h
+top.o: $(CDIR)/queue.h
+queue.o: $(CDIR)/queue.h
diff --git a/mach/pmds/cv/Makefile b/mach/pmds/cv/Makefile
new file mode 100644
index 00000000..b5bf144f
--- /dev/null
+++ b/mach/pmds/cv/Makefile
@@ -0,0 +1,22 @@
+EMHOME=../../..
+
+LDFLAGS =
+CFLAGS=-O -I$(EMHOME)/h
+
+cv: cv.o
+ $(CC) -o cv $(LDFLAGS) cv.o $(EMHOME)/modules/lib/libobject.a
+
+install: cv
+ ../../install cv
+
+cmp: cv
+ -../../compare cv
+
+opr:
+ make pr | opr
+
+pr:
+ @pr `pwd`/cv.c
+
+clean:
+ -rm -f *.o *.old cv
diff --git a/mach/pmds/cv/pdp_cv.c b/mach/pmds/cv/pdp_cv.c
new file mode 100644
index 00000000..b11f6574
--- /dev/null
+++ b/mach/pmds/cv/pdp_cv.c
@@ -0,0 +1,41 @@
+/* The format of the a.out files produced by the assemblers
+ is machine dependent.
+ This program acts as a gateway between two machines and it's effect
+ is independent of the machine it executes on.
+ The a.out file is assumed to be made on a pdp-11
+ while the target machine is a Philip Microcomputer Development system
+
+*/
+
+#include
+
+main(argc,argv) char **argv ; {
+ char i_addr[4];
+ short count;
+ char i_count[2];
+
+ if (argc != 3) {
+ fprintf(stderr,"Usage: %s pdp-a.out VU-pmds-a.out\n",argv[0]);
+ exit(-1);
+ }
+ if (freopen(argv[1],"r",stdin)==NULL) {
+ perror(argv[1]);
+ exit(-1);
+ }
+ if (freopen(argv[2],"w",stdout)==NULL) {
+ perror(argv[2]);
+ exit(-1);
+ }
+ while (fread(&i_addr,sizeof i_addr,1,stdin)==1) {
+ putchar(i_addr[1]) ; putchar(i_addr[0]) ;
+ putchar(i_addr[3]) ; putchar(i_addr[2]) ;
+ if (fread(&i_count,sizeof i_count,1,stdin)!=1)
+ exit(fprintf(stderr,"foo\n"));
+ putchar(i_count[1]) ; putchar(i_count[0]) ;
+ count= ((i_count[1]&0377)<<8) | (i_count[0]&0377) ;
+ while (count--) {
+ putchar(getchar());
+ }
+ }
+ return 0;
+}
diff --git a/mach/pmds/cv/vax_cv.c b/mach/pmds/cv/vax_cv.c
new file mode 100644
index 00000000..6e210f17
--- /dev/null
+++ b/mach/pmds/cv/vax_cv.c
@@ -0,0 +1,41 @@
+/* The format of the a.out files produced by the assemblers
+ is machine dependent.
+ This program acts as a gateway between two machines and it's effect
+ is independent of the machine it executes on.
+ The a.out file is assumed to be made on a vax-11
+ while the target machine is a Philips Microcomputer Development system
+
+*/
+
+#include
+
+main(argc,argv) char **argv ; {
+ char i_addr[4];
+ short count;
+ char i_count[2];
+
+ if (argc != 3) {
+ fprintf(stderr,"Usage: %s vax-a.out VU-pmds-a.out\n",argv[0]);
+ exit(-1);
+ }
+ if (freopen(argv[1],"r",stdin)==NULL) {
+ perror(argv[1]);
+ exit(-1);
+ }
+ if (freopen(argv[2],"w",stdout)==NULL) {
+ perror(argv[2]);
+ exit(-1);
+ }
+ while (fread(&i_addr,sizeof i_addr,1,stdin)==1) {
+ putchar(i_addr[3]) ; putchar(i_addr[2]) ;
+ putchar(i_addr[1]) ; putchar(i_addr[0]) ;
+ if (fread(&i_count,sizeof i_count,1,stdin)!=1)
+ exit(fprintf(stderr,"foo\n"));
+ putchar(i_count[1]) ; putchar(i_count[0]) ;
+ count= ((i_count[1]&0377)<<8) | (i_count[0]&0377) ;
+ while (count--) {
+ putchar(getchar());
+ }
+ }
+ return 0;
+}
diff --git a/mach/pmds/libsys/Makefile b/mach/pmds/libsys/Makefile
new file mode 100644
index 00000000..1ae02d21
--- /dev/null
+++ b/mach/pmds/libsys/Makefile
@@ -0,0 +1,29 @@
+# $Header$
+MACH=pmds
+all: libmon_o.a head_em.o
+
+install: all
+ ../../install head_em.o head_em
+ ../../install libmon_o.a tail_mon
+
+
+cmp: all
+ -../../compare head_em.o head_em
+ -../../compare libmon_o.a tail_mon
+
+libmon_o.a: libmon_s.a
+ ASAR=aal ; export ASAR ;\
+ march . libmon_o.a
+
+head_em.o: head_em.s
+ $(MACH) -I../../../h -c head_em.s
+
+clean:
+ rm -f *.o libmon_o.a
+
+opr :
+ make pr | opr
+
+pr:
+ @pr `pwd`/head_em.s
+ @arch pv libmon_s.a | pr -h `pwd`/libmon_s.a
diff --git a/mach/pmds/libsys/compmodule b/mach/pmds/libsys/compmodule
new file mode 100755
index 00000000..02a02173
--- /dev/null
+++ b/mach/pmds/libsys/compmodule
@@ -0,0 +1,4 @@
+if pmds -L -c $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi
diff --git a/mach/pmds4/libsys/Makefile b/mach/pmds4/libsys/Makefile
new file mode 100644
index 00000000..c796c26e
--- /dev/null
+++ b/mach/pmds4/libsys/Makefile
@@ -0,0 +1,29 @@
+# $Header$
+MACH=pmds4
+all: libmon_o.a head_em.o
+
+install: all
+ ../../install head_em.o head_em
+ ../../install libmon_o.a tail_mon
+
+
+cmp: all
+ -../../compare head_em.o head_em
+ -../../compare libmon_o.a tail_mon
+
+libmon_o.a: libmon_s.a
+ ASAR=aal ; export ASAR ;\
+ march . libmon_o.a
+
+head_em.o: head_em.s
+ $(MACH) -I../../../h -c head_em.s
+
+clean:
+ rm -f *.o libmon_o.a
+
+opr :
+ make pr | opr
+
+pr:
+ @pr `pwd`/head_em.s
+ @arch pv libmon_s.a | pr -h `pwd`/libmon_s.a
diff --git a/mach/pmds4/libsys/compmodule b/mach/pmds4/libsys/compmodule
new file mode 100755
index 00000000..8d98a6d8
--- /dev/null
+++ b/mach/pmds4/libsys/compmodule
@@ -0,0 +1,4 @@
+if pmds4 -L -c $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi
diff --git a/mach/proto/as/Makefile b/mach/proto/as/Makefile
new file mode 100644
index 00000000..7455a482
--- /dev/null
+++ b/mach/proto/as/Makefile
@@ -0,0 +1,67 @@
+# $Header$
+EMHOME = ../../..
+h = $(EMHOME)/h
+LIBOBJ = $(EMHOME)/modules/lib/libobject.a
+CDIR = $(EMHOME)/mach/proto/as
+CPP = $(EMHOME)/lib/cpp
+DEF =
+
+FFLAG =
+INCL = -I. -I$h $(DEF)
+CFLAGS = $(FFLAG) -O $(INCL)
+YFLAGS = -d
+LDFLAGS = $(FFLAG)
+
+CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
+ $(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
+COBJ = comm3.o comm4.o comm5.o \
+ comm6.o comm7.o comm8.o
+MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
+COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
+
+all: as
+
+install:all
+ ../../install as
+
+cmp:
+ -../../compare as
+
+clean:
+ rm -f *.o as as.[cy] y.tab.h
+
+pr: $(MACH)
+ @pr -n $(MACH)
+
+opr:
+ make pr | opr
+as: $(COBJ) as.o
+ $(CC) $(LDFLAGS) $(COBJ) as.o $(LIBOBJ) -o as
+
+as.y: $(CDIR)/comm2.y
+ $(CPP) -P -I. -I$h $(DEF) $(CDIR)/comm2.y >as.y
+ -@if test -f Expect ; then cat Expect ; else echo "expect 1 shift/reduce conflict"; fi
+
+lint: $(CSRC) as.c
+ lint $(INCL) $(CSRC) as.c
+
+y.tab.h: as.c
+$(COBJ): y.tab.h
+$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
+$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
+as.y: mach2.c
+comm3.o: mach3.c
+as.y: mach4.c
+comm8.o: mach5.c
+comm3.o: $(CDIR)/comm3.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm3.c
+comm4.o: $(CDIR)/comm4.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm4.c
+comm5.o: $(CDIR)/comm5.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm5.c
+comm6.o: $(CDIR)/comm6.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm6.c
+comm7.o: $(CDIR)/comm7.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm7.c
+comm8.o: $(CDIR)/comm8.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm8.c
diff --git a/mach/proto/cg/Makefile b/mach/proto/cg/Makefile
new file mode 100644
index 00000000..22f5f603
--- /dev/null
+++ b/mach/proto/cg/Makefile
@@ -0,0 +1,184 @@
+# $Header$
+
+EMHOME=../../..
+PREFLAGS=-I$(EMHOME)/h -I. -I$(EMHOME)/mach -I$(EMHOME)/modules/h -DNDEBUG
+PFLAGS=
+CFLAGS=$(PREFLAGS) $(PFLAGS) -O
+LDFLAGS=$(PFLAGS)
+LINTOPTS=-hbxac
+LIBS=$(EMHOME)/lib/em_data.a $(EMHOME)/modules/lib/libflt.a
+CDIR=$(EMHOME)/mach/proto/cg
+CFILES=$(CDIR)/codegen.c $(CDIR)/compute.c $(CDIR)/equiv.c $(CDIR)/fillem.c \
+ $(CDIR)/gencode.c $(CDIR)/glosym.c $(CDIR)/main.c $(CDIR)/move.c \
+ $(CDIR)/nextem.c $(CDIR)/reg.c $(CDIR)/regvar.c $(CDIR)/salloc.c \
+ $(CDIR)/state.c $(CDIR)/subr.c $(CDIR)/var.c
+OFILES=codegen.o compute.o equiv.o fillem.o gencode.o glosym.o main.o\
+ move.o nextem.o reg.o regvar.o salloc.o state.o subr.o var.o
+
+all: tables.c
+ make "EMHOME="$(EMHOME) cg
+
+cg: tables.o $(OFILES)
+ $(CC) $(LDFLAGS) $(OFILES) tables.o $(LIBS) -o cg
+
+tables.o: tables.c
+ $(CC) -c $(PREFLAGS) -I$(CDIR) tables.c
+
+codegen.o: $(CDIR)/codegen.c
+ $(CC) -c $(CFLAGS) $(CDIR)/codegen.c
+compute.o: $(CDIR)/compute.c
+ $(CC) -c $(CFLAGS) $(CDIR)/compute.c
+equiv.o: $(CDIR)/equiv.c
+ $(CC) -c $(CFLAGS) $(CDIR)/equiv.c
+fillem.o: $(CDIR)/fillem.c
+ $(CC) -c $(CFLAGS) $(CDIR)/fillem.c
+gencode.o: $(CDIR)/gencode.c
+ $(CC) -c $(CFLAGS) $(CDIR)/gencode.c
+glosym.o: $(CDIR)/glosym.c
+ $(CC) -c $(CFLAGS) $(CDIR)/glosym.c
+main.o: $(CDIR)/main.c
+ $(CC) -c $(CFLAGS) $(CDIR)/main.c
+move.o: $(CDIR)/move.c
+ $(CC) -c $(CFLAGS) $(CDIR)/move.c
+nextem.o: $(CDIR)/nextem.c
+ $(CC) -c $(CFLAGS) $(CDIR)/nextem.c
+reg.o: $(CDIR)/reg.c
+ $(CC) -c $(CFLAGS) $(CDIR)/reg.c
+regvar.o: $(CDIR)/regvar.c
+ $(CC) -c $(CFLAGS) $(CDIR)/regvar.c
+salloc.o: $(CDIR)/salloc.c
+ $(CC) -c $(CFLAGS) $(CDIR)/salloc.c
+state.o: $(CDIR)/state.c
+ $(CC) -c $(CFLAGS) $(CDIR)/state.c
+subr.o: $(CDIR)/subr.c
+ $(CC) -c $(CFLAGS) $(CDIR)/subr.c
+var.o: $(CDIR)/var.c
+ $(CC) -c $(CFLAGS) $(CDIR)/var.c
+
+install: all
+ ../../install cg
+
+cmp: all
+ -../../compare cg
+
+distr: tables.c
+ rm -f tables1.[ch]
+ cp tables.c tables1.c
+ cp tables.h tables1.h
+ chmod -w tables1.[ch]
+
+
+tables.c: table
+ -mv tables.h tables.h.save
+ $(EMHOME)/lib/cpp -P table | $(EMHOME)/lib/cgg > debug.out
+ -if cmp -s tables.h.save tables.h; then mv tables.h.save tables.h; else exit 0; fi
+ -if cmp -s /dev/null tables.h; then mv tables.h.save tables.h; else exit 0; fi
+
+lint: $(CFILES)
+ lint $(LINTOPTS) $(PREFLAGS) $(CFILES)
+clean:
+ rm -f *.o tables.c tables.h debug.out cg tables.h.save
+
+codegen.o: $(CDIR)/assert.h
+codegen.o: $(CDIR)/data.h
+codegen.o: $(CDIR)/equiv.h
+codegen.o: $(CDIR)/extern.h
+codegen.o: $(CDIR)/param.h
+codegen.o: $(CDIR)/result.h
+codegen.o: $(CDIR)/state.h
+codegen.o: tables.h
+codegen.o: $(CDIR)/types.h
+compute.o: $(CDIR)/assert.h
+compute.o: $(CDIR)/data.h
+compute.o: $(CDIR)/extern.h
+compute.o: $(CDIR)/glosym.h
+compute.o: $(CDIR)/param.h
+compute.o: $(CDIR)/result.h
+compute.o: tables.h
+compute.o: $(CDIR)/types.h
+equiv.o: $(CDIR)/assert.h
+equiv.o: $(CDIR)/data.h
+equiv.o: $(CDIR)/equiv.h
+equiv.o: $(CDIR)/extern.h
+equiv.o: $(CDIR)/param.h
+equiv.o: $(CDIR)/result.h
+equiv.o: tables.h
+equiv.o: $(CDIR)/types.h
+fillem.o: $(CDIR)/assert.h
+fillem.o: $(CDIR)/data.h
+fillem.o: $(CDIR)/extern.h
+fillem.o: mach.c
+fillem.o: mach.h
+fillem.o: $(CDIR)/param.h
+fillem.o: $(CDIR)/regvar.h
+fillem.o: $(CDIR)/result.h
+fillem.o: tables.h
+fillem.o: $(CDIR)/types.h
+gencode.o: $(CDIR)/assert.h
+gencode.o: $(CDIR)/data.h
+gencode.o: $(CDIR)/extern.h
+gencode.o: $(CDIR)/param.h
+gencode.o: $(CDIR)/result.h
+gencode.o: tables.h
+gencode.o: $(CDIR)/types.h
+glosym.o: $(CDIR)/glosym.h
+glosym.o: $(CDIR)/param.h
+glosym.o: tables.h
+glosym.o: $(CDIR)/types.h
+main.o: $(CDIR)/param.h
+move.o: $(CDIR)/assert.h
+move.o: $(CDIR)/data.h
+move.o: $(CDIR)/extern.h
+move.o: $(CDIR)/param.h
+move.o: $(CDIR)/result.h
+move.o: tables.h
+move.o: $(CDIR)/types.h
+nextem.o: $(CDIR)/assert.h
+nextem.o: $(CDIR)/data.h
+nextem.o: $(CDIR)/extern.h
+nextem.o: $(CDIR)/param.h
+nextem.o: $(CDIR)/result.h
+nextem.o: tables.h
+nextem.o: $(CDIR)/types.h
+reg.o: $(CDIR)/assert.h
+reg.o: $(CDIR)/data.h
+reg.o: $(CDIR)/extern.h
+reg.o: $(CDIR)/param.h
+reg.o: $(CDIR)/result.h
+reg.o: tables.h
+reg.o: $(CDIR)/types.h
+regvar.o: $(CDIR)/assert.h
+regvar.o: $(CDIR)/data.h
+regvar.o: $(CDIR)/extern.h
+regvar.o: $(CDIR)/param.h
+regvar.o: $(CDIR)/regvar.h
+regvar.o: $(CDIR)/result.h
+regvar.o: tables.h
+regvar.o: $(CDIR)/types.h
+salloc.o: $(CDIR)/assert.h
+salloc.o: $(CDIR)/data.h
+salloc.o: $(CDIR)/extern.h
+salloc.o: $(CDIR)/param.h
+salloc.o: $(CDIR)/result.h
+salloc.o: tables.h
+salloc.o: $(CDIR)/types.h
+state.o: $(CDIR)/assert.h
+state.o: $(CDIR)/data.h
+state.o: $(CDIR)/extern.h
+state.o: $(CDIR)/param.h
+state.o: $(CDIR)/result.h
+state.o: $(CDIR)/state.h
+state.o: tables.h
+state.o: $(CDIR)/types.h
+subr.o: $(CDIR)/assert.h
+subr.o: $(CDIR)/data.h
+subr.o: $(CDIR)/extern.h
+subr.o: $(CDIR)/param.h
+subr.o: $(CDIR)/result.h
+subr.o: tables.h
+subr.o: $(CDIR)/types.h
+var.o: $(CDIR)/data.h
+var.o: $(CDIR)/param.h
+var.o: $(CDIR)/result.h
+var.o: tables.h
+var.o: $(CDIR)/types.h
diff --git a/mach/proto/fp/Makefile b/mach/proto/fp/Makefile
new file mode 100644
index 00000000..eddf2062
--- /dev/null
+++ b/mach/proto/fp/Makefile
@@ -0,0 +1,282 @@
+EMHOME=../../..
+SUF=s
+MACH=m68k4
+ASAR=arch
+CFLAGS=
+# must use -r option of make so that default rules
+# are not loaded
+#
+# $Header$
+#
+EMFLAGS= -L -LIB -I. -O $(CFLAGS)
+# AS=ack -m$(MACH) -c.$(SUF)
+# CC=ack -m$(MACH) -c.s
+# CCFLAGS=$(EMFLAGS)
+CDIR=$(EMHOME)/mach/proto/fp
+
+LIST = cff4.$(SUF) cff8.$(SUF)\
+ cfu.$(SUF)\
+ cmf4.$(SUF) cmf8.$(SUF)\
+ cuf4.$(SUF) cuf8.$(SUF)\
+ dvf4.$(SUF) dvf8.$(SUF)\
+ fef4.$(SUF) fef8.$(SUF)\
+ fif4.$(SUF) fif8.$(SUF)\
+ cfi.$(SUF)\
+ cif4.$(SUF) cif8.$(SUF)\
+ mlf4.$(SUF) mlf8.$(SUF)\
+ ngf4.$(SUF) ngf8.$(SUF)\
+ sbf4.$(SUF) sbf8.$(SUF)\
+ adf4.$(SUF) adf8.$(SUF)\
+ zrf4.$(SUF) zrf8.$(SUF)\
+ extend.$(SUF) compact.$(SUF)\
+ add_ext.$(SUF) div_ext.$(SUF) mul_ext.$(SUF) nrm_ext.$(SUF)\
+ sft_ext.$(SUF) sub_ext.$(SUF) zrf_ext.$(SUF)\
+ adder.$(SUF) shifter.$(SUF) fptrp.$(SUF)
+SLIST = cff4.s cff8.s\
+ cfu.s\
+ cmf4.s cmf8.s\
+ cuf4.s cuf8.s\
+ dvf4.s dvf8.s\
+ fef4.s fef8.s\
+ fif4.s fif8.s\
+ cfi.s\
+ cif4.s cif8.s\
+ mlf4.s mlf8.s\
+ ngf4.s ngf8.s\
+ sbf4.s sbf8.s\
+ adf4.s adf8.s\
+ zrf4.s zrf8.s\
+ extend.s compact.s\
+ add_ext.s div_ext.s mul_ext.s nrm_ext.s\
+ sft_ext.s sub_ext.s zrf_ext.s\
+ adder.s shifter.s fptrp.s
+
+SRC = FP_bias.h FP_shift.h FP_trap.h FP_types.h adder.h get_put.h\
+ cff4.c cff8.c\
+ cfu.c\
+ cmf4.c cmf8.c\
+ cuf4.c cuf8.c\
+ dvf4.c dvf8.c\
+ fef4.c fef8.c\
+ fif4.c fif8.c\
+ cfi.c\
+ cif4.c cif8.c\
+ mlf4.c mlf8.c\
+ ngf4.c ngf8.c\
+ sbf4.c sbf8.c\
+ adf4.c adf8.c\
+ zrf4.c zrf8.c\
+ extend.c compact.c\
+ add_ext.c div_ext.c mul_ext.c nrm_ext.c\
+ sft_ext.c sub_ext.c zrf_ext.c\
+ adder.c shifter.c fptrp.e
+
+all: FP_$(MACH).a
+
+install: tail_fp
+
+tail_fp: FP_$(MACH).a
+ ../../install FP_$(MACH).a tail_fp
+
+clean:
+ rm -f $(LIST) FP_$(MACH).a
+ rm -f $(SLIST)
+
+opr:
+ make pr | opr
+
+pr:
+ @pr Makefile FP.script $(SRC)
+
+FP_$(MACH).a: $(LIST)
+ $(ASAR) rv $@ $?
+
+fptrp.$(SUF): $(CDIR)/fptrp.e
+ ack -m$(MACH) $(EMFLAGS) -c $(CDIR)/fptrp.e
+
+extend.$(SUF) compact.$(SUF): byte_order.h $(CDIR)/get_put.h
+
+cff4.$(SUF): $(CDIR)/cff4.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/cff4.c
+ ed - cff4.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) cff4.s
+
+cff8.$(SUF): $(CDIR)/cff8.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/cff8.c
+ ed - cff8.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) cff8.s
+
+cfu.$(SUF): $(CDIR)/cfu.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/cfu.c
+ ed - cfu.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) cfu.s
+
+cmf4.$(SUF): $(CDIR)/cmf4.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/cmf4.c
+ ed - cmf4.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) cmf4.s
+
+cmf8.$(SUF): $(CDIR)/cmf8.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/cmf8.c
+ ed - cmf8.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) cmf8.s
+
+cuf4.$(SUF): $(CDIR)/cuf4.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/cuf4.c
+ ed - cuf4.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) cuf4.s
+
+cuf8.$(SUF): $(CDIR)/cuf8.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/cuf8.c
+ ed - cuf8.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) cuf8.s
+
+dvf4.$(SUF): $(CDIR)/dvf4.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/dvf4.c
+ ed - dvf4.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) dvf4.s
+
+dvf8.$(SUF): $(CDIR)/dvf8.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/dvf8.c
+ ed - dvf8.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) dvf8.s
+
+fef4.$(SUF): $(CDIR)/fef4.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/fef4.c
+ ed - fef4.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) fef4.s
+
+fef8.$(SUF): $(CDIR)/fef8.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/fef8.c
+ ed - fef8.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) fef8.s
+
+fif4.$(SUF): $(CDIR)/fif4.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/fif4.c
+ ed - fif4.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) fif4.s
+
+fif8.$(SUF): $(CDIR)/fif8.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/fif8.c
+ ed - fif8.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) fif8.s
+
+cfi.$(SUF): $(CDIR)/cfi.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/cfi.c
+ ed - cfi.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) cfi.s
+
+cif4.$(SUF): $(CDIR)/cif4.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/cif4.c
+ ed - cif4.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) cif4.s
+
+cif8.$(SUF): $(CDIR)/cif8.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/cif8.c
+ ed - cif8.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) cif8.s
+
+mlf4.$(SUF): $(CDIR)/mlf4.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/mlf4.c
+ ed - mlf4.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) mlf4.s
+
+mlf8.$(SUF): $(CDIR)/mlf8.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/mlf8.c
+ ed - mlf8.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) mlf8.s
+
+ngf4.$(SUF): $(CDIR)/ngf4.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/ngf4.c
+ ed - ngf4.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) ngf4.s
+
+ngf8.$(SUF): $(CDIR)/ngf8.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/ngf8.c
+ ed - ngf8.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) ngf8.s
+
+sbf4.$(SUF): $(CDIR)/sbf4.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/sbf4.c
+ ed - sbf4.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) sbf4.s
+
+sbf8.$(SUF): $(CDIR)/sbf8.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/sbf8.c
+ ed - sbf8.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) sbf8.s
+
+adf4.$(SUF): $(CDIR)/adf4.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/adf4.c
+ ed - adf4.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) adf4.s
+
+adf8.$(SUF): $(CDIR)/adf8.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/adf8.c
+ ed - adf8.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) adf8.s
+
+zrf4.$(SUF): $(CDIR)/zrf4.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/zrf4.c
+ ed - zrf4.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) zrf4.s
+
+zrf8.$(SUF): $(CDIR)/zrf8.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/zrf8.c
+ ed - zrf8.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) zrf8.s
+
+extend.$(SUF): $(CDIR)/extend.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/extend.c
+ ed - extend.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) extend.s
+
+compact.$(SUF): $(CDIR)/compact.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/compact.c
+ ed - compact.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) compact.s
+
+add_ext.$(SUF): $(CDIR)/add_ext.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/add_ext.c
+ ed - add_ext.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) add_ext.s
+
+div_ext.$(SUF): $(CDIR)/div_ext.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/div_ext.c
+ ed - div_ext.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) div_ext.s
+
+mul_ext.$(SUF): $(CDIR)/mul_ext.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/mul_ext.c
+ ed - mul_ext.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) mul_ext.s
+
+nrm_ext.$(SUF): $(CDIR)/nrm_ext.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/nrm_ext.c
+ ed - nrm_ext.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) nrm_ext.s
+
+sft_ext.$(SUF): $(CDIR)/sft_ext.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/sft_ext.c
+ ed - sft_ext.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) sft_ext.s
+
+sub_ext.$(SUF): $(CDIR)/sub_ext.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/sub_ext.c
+ ed - sub_ext.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) sub_ext.s
+
+zrf_ext.$(SUF): $(CDIR)/zrf_ext.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/zrf_ext.c
+ ed - zrf_ext.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) zrf_ext.s
+
+adder.$(SUF): $(CDIR)/adder.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/adder.c
+ ed - adder.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) adder.s
+
+shifter.$(SUF): $(CDIR)/shifter.c
+ ack -c.s -m$(MACH) $(EMFLAGS) $(CDIR)/shifter.c
+ ed - shifter.s <$(CDIR)/FP.script
+ ack -c -m$(MACH) $(EMFLAGS) shifter.s
diff --git a/mach/proto/fp/adder.h b/mach/proto/fp/adder.h
new file mode 100644
index 00000000..63823af2
--- /dev/null
+++ b/mach/proto/fp/adder.h
@@ -0,0 +1,15 @@
+/*
+ (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ See the copyright notice in the ACK home directory, in the file "Copyright".
+*/
+
+/* $Header$ */
+
+/*
+ * include file for 32 & 64 bit addition
+ */
+
+typedef struct {
+ unsigned long h_32; /* higher 32 bits of 64 */
+ unsigned long l_32; /* lower 32 bits of 64 */
+} B64;
diff --git a/mach/proto/fp/prt_dbl.c b/mach/proto/fp/prt_dbl.c
new file mode 100644
index 00000000..4453e412
--- /dev/null
+++ b/mach/proto/fp/prt_dbl.c
@@ -0,0 +1,32 @@
+/*
+ (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ See the copyright notice in the ACK home directory, in the file "Copyright".
+*/
+
+/* $Header$ */
+
+# include "FP_types.h"
+
+prt_dbl(dbl,size)
+DOUBLE *dbl;
+int size;
+{
+#ifdef PRT_DBL
+ unsigned long *l;
+
+ fprintf(stderr,"PRT_DBL SIZE = %d ",size);
+ fprintf(stderr,"_s.p1.fract = 0x%08X ",dbl->_s.p1.fract);
+ if (size == 8)
+ fprintf(stderr,"_s.p2 = 0x%08X",dbl->_s.p2);
+ l = (unsigned long *) dbl;
+#ifdef PRT_LONG
+ fprintf(stderr,"\nl[0] = 0x%08X ",*l++);
+ if (size == 8)
+ fprintf(stderr,"l[1] = 0x%08X",*l);
+#endif PRT_LONG
+ putc('\r',stderr);
+ putc('\n',stderr);
+ fflush(stderr);
+#endif
+}
+
diff --git a/mach/proto/fp/prt_ext.c b/mach/proto/fp/prt_ext.c
new file mode 100644
index 00000000..243c7270
--- /dev/null
+++ b/mach/proto/fp/prt_ext.c
@@ -0,0 +1,30 @@
+/*
+ (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ See the copyright notice in the ACK home directory, in the file "Copyright".
+*/
+
+/* $Header$ */
+
+/********************************************************/
+/*
+ PRINT EXTENDED FORMAT AND MESSAGE
+ DEBUG ROUTINE
+*/
+/********************************************************/
+
+#include "FP_types.h"
+
+prt_ext(m,e)
+char *m;
+EXTEND *e;
+{
+#ifdef PRT_EXT
+ fprintf(stderr,"%s ",m);
+ fprintf(stderr,"%c",(e->sign) ? '-' : '+');
+ fprintf(stderr,"m1:0x%08X m2:0x%08X ^ %03d 0x%x\n",
+ e->m1,e->m2,e->exp,e->exp);
+ fprintf(stderr,"hit any key\n\r");
+ fflush(stderr);
+ getchar();
+#endif
+}
diff --git a/mach/proto/fp/x b/mach/proto/fp/x
new file mode 100644
index 00000000..e69de29b
diff --git a/mach/proto/libg/Makefile b/mach/proto/libg/Makefile
new file mode 100644
index 00000000..d476d9bb
--- /dev/null
+++ b/mach/proto/libg/Makefile
@@ -0,0 +1,41 @@
+# $Header$
+
+MACH=MACHINE
+MACHFL=-c.$(SUF) -O -L
+SUB =
+PREF=pc
+ASAR=arch
+SRC=lang/pc/libpc
+HOME = ../../..
+HEADSRC=$(HOME)/$(SRC)/head_$(PREF).e
+
+all: head tail
+
+head: head_$(PREF)
+
+tail: tail_$(PREF)$(SUB)
+
+headcp: head
+ ../../install head_$(PREF)
+ rm -f head_$(PREF)
+
+tailcp: tail
+ ../../install tail_$(PREF)$(SUB)
+ rm -f tail_$(PREF)$(SUB)
+
+cp: headcp tailcp
+
+head_$(PREF): $(HEADSRC)
+ cp $(HEADSRC) head_$(PREF).e
+ $(MACH) $(MACHFL) -I$(HOME)/h head_$(PREF).e
+ mv head_$(PREF).$(SUF) head_$(PREF)
+ -rm -f head_$(PREF).[ekm$(SUF)]
+
+tail_$(PREF)$(SUB):
+ @echo translation test
+ @$(MACH) $(MACHFL) $(HOME)/mach/proto/libg/barrier.c
+ @-rm -f barrier.[oeskm] barrier.so
+ @echo OK
+ -rm -f tail_$(PREF)$(SUB)
+ MACH="$(MACH)" MACHFL="$(MACHFL) -LIB" ASAR=$(ASAR) SRC=$(SRC) \
+ march $(HOME)/$(SRC) tail_$(PREF)$(SUB)
diff --git a/mach/proto/ncg/Makefile b/mach/proto/ncg/Makefile
new file mode 100644
index 00000000..f5e2bda6
--- /dev/null
+++ b/mach/proto/ncg/Makefile
@@ -0,0 +1,197 @@
+# $Header$
+
+EMHOME=../../..
+#preprocessor flags for table
+TABLEFLAGS=
+#cgg options
+CGGFLAGS=
+
+PREFLAGS=-I$(EMHOME)/h -I. -I$(EMHOME)/mach -I$(EMHOME)/modules/h -DNDEBUG
+PFLAGS=
+CFLAGS=$(PREFLAGS) $(PFLAGS) -O
+LDFLAGS=$(PFLAGS)
+LINTOPTS=-bx
+LIBS=$(EMHOME)/lib/em_data.a $(EMHOME)/modules/lib/libflt.a
+CDIR=$(EMHOME)/mach/proto/ncg
+CGG=$(EMHOME)/lib/ncgg
+CPP=$(EMHOME)/lib/cpp
+CFILES=$(CDIR)/codegen.c $(CDIR)/compute.c $(CDIR)/equiv.c $(CDIR)/fillem.c \
+ $(CDIR)/gencode.c $(CDIR)/glosym.c $(CDIR)/label.c $(CDIR)/main.c \
+ $(CDIR)/move.c $(CDIR)/nextem.c $(CDIR)/reg.c $(CDIR)/regvar.c \
+ $(CDIR)/salloc.c $(CDIR)/state.c $(CDIR)/subr.c $(CDIR)/var.c
+OFILES=codegen.o compute.o equiv.o fillem.o gencode.o glosym.o label.o \
+ main.o move.o nextem.o reg.o regvar.o salloc.o state.o subr.o var.o
+
+all: tables.c
+ make "EMHOME="$(EMHOME) cg
+
+cg: tables.o $(OFILES)
+ $(CC) $(LDFLAGS) $(OFILES) tables.o $(LIBS) -o cg
+
+tables.o: tables.c
+ $(CC) -c $(PREFLAGS) -I$(CDIR) tables.c
+
+codegen.o: $(CDIR)/codegen.c
+ $(CC) -c $(CFLAGS) $(CDIR)/codegen.c
+compute.o: $(CDIR)/compute.c
+ $(CC) -c $(CFLAGS) $(CDIR)/compute.c
+equiv.o: $(CDIR)/equiv.c
+ $(CC) -c $(CFLAGS) $(CDIR)/equiv.c
+fillem.o: $(CDIR)/fillem.c
+ $(CC) -c $(CFLAGS) $(CDIR)/fillem.c
+gencode.o: $(CDIR)/gencode.c
+ $(CC) -c $(CFLAGS) $(CDIR)/gencode.c
+glosym.o: $(CDIR)/glosym.c
+ $(CC) -c $(CFLAGS) $(CDIR)/glosym.c
+label.o: $(CDIR)/label.c
+ $(CC) -c $(CFLAGS) $(CDIR)/label.c
+main.o: $(CDIR)/main.c
+ $(CC) -c $(CFLAGS) $(CDIR)/main.c
+move.o: $(CDIR)/move.c
+ $(CC) -c $(CFLAGS) $(CDIR)/move.c
+nextem.o: $(CDIR)/nextem.c
+ $(CC) -c $(CFLAGS) $(CDIR)/nextem.c
+reg.o: $(CDIR)/reg.c
+ $(CC) -c $(CFLAGS) $(CDIR)/reg.c
+regvar.o: $(CDIR)/regvar.c
+ $(CC) -c $(CFLAGS) $(CDIR)/regvar.c
+salloc.o: $(CDIR)/salloc.c
+ $(CC) -c $(CFLAGS) $(CDIR)/salloc.c
+state.o: $(CDIR)/state.c
+ $(CC) -c $(CFLAGS) $(CDIR)/state.c
+subr.o: $(CDIR)/subr.c
+ $(CC) -c $(CFLAGS) $(CDIR)/subr.c
+var.o: $(CDIR)/var.c
+ $(CC) -c $(CFLAGS) $(CDIR)/var.c
+
+install: all
+ $(EMHOME)/mach/install cg
+
+cmp: all
+ -$(EMHOME)/mach/compare cg
+
+
+tables.c: table $(CGG)
+ $(CPP) $(TABLEFLAGS) table | $(CGG) $(CGGFLAGS)
+ -cmp tables.h tables.H || cp tables.H tables.h
+
+lint: $(CFILES) tables.c
+ lint $(LINTOPTS) $(PREFLAGS) -I$(CDIR) $(CFILES) tables.c
+clean:
+ rm -f *.o tables.c tables.h debug.out cg tables.H
+
+distr: tables.c
+ rm -f tables1.c tables1.h
+ cp tables.c tables1.c
+ cp tables.h tables1.h
+ chmod -w tables1.[ch]
+
+codegen.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+codegen.o: $(CDIR)/data.h
+codegen.o: $(CDIR)/equiv.h
+codegen.o: $(CDIR)/extern.h
+codegen.o: $(CDIR)/param.h
+codegen.o: $(CDIR)/result.h
+codegen.o: $(CDIR)/state.h
+codegen.o: tables.h
+codegen.o: $(CDIR)/types.h
+compute.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+compute.o: $(CDIR)/data.h
+compute.o: $(CDIR)/extern.h
+compute.o: $(CDIR)/glosym.h
+compute.o: $(CDIR)/label.h
+compute.o: $(CDIR)/param.h
+compute.o: $(CDIR)/result.h
+compute.o: tables.h
+compute.o: $(CDIR)/types.h
+equiv.o: $(CDIR)/assert.h
+equiv.o: $(CDIR)/data.h $(EMHOME)/h/cgg_cg.h
+equiv.o: $(CDIR)/equiv.h
+equiv.o: $(CDIR)/extern.h
+equiv.o: $(CDIR)/param.h
+equiv.o: $(CDIR)/result.h
+equiv.o: tables.h
+equiv.o: $(CDIR)/types.h
+fillem.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+fillem.o: $(CDIR)/data.h
+fillem.o: $(CDIR)/extern.h
+fillem.o: mach.c
+fillem.o: mach.h
+fillem.o: $(CDIR)/param.h
+fillem.o: $(CDIR)/regvar.h
+fillem.o: $(CDIR)/result.h
+fillem.o: tables.h
+fillem.o: $(CDIR)/types.h
+gencode.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+gencode.o: $(CDIR)/data.h
+gencode.o: $(CDIR)/extern.h
+gencode.o: $(CDIR)/param.h
+gencode.o: $(CDIR)/result.h
+gencode.o: tables.h
+gencode.o: $(CDIR)/types.h
+glosym.o: $(CDIR)/glosym.h
+glosym.o: $(CDIR)/param.h
+glosym.o: tables.h
+glosym.o: $(CDIR)/types.h
+label.o: $(CDIR)/label.h
+label.o: $(CDIR)/param.h
+label.o: tables.h
+label.o: $(CDIR)/types.h
+main.o: $(CDIR)/param.h
+main.o: tables.h
+move.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+move.o: $(CDIR)/data.h
+move.o: $(CDIR)/extern.h
+move.o: $(CDIR)/param.h
+move.o: $(CDIR)/result.h
+move.o: tables.h
+move.o: $(CDIR)/types.h
+nextem.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+nextem.o: $(CDIR)/data.h
+nextem.o: $(CDIR)/extern.h
+nextem.o: $(CDIR)/param.h
+nextem.o: $(CDIR)/result.h
+nextem.o: tables.h
+nextem.o: $(CDIR)/types.h
+reg.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+reg.o: $(CDIR)/data.h
+reg.o: $(CDIR)/extern.h
+reg.o: $(CDIR)/param.h
+reg.o: $(CDIR)/result.h
+reg.o: tables.h
+reg.o: $(CDIR)/types.h
+regvar.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+regvar.o: $(CDIR)/data.h
+regvar.o: $(CDIR)/extern.h
+regvar.o: $(CDIR)/param.h
+regvar.o: $(CDIR)/regvar.h
+regvar.o: $(CDIR)/result.h
+regvar.o: tables.h
+regvar.o: $(CDIR)/types.h
+salloc.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+salloc.o: $(CDIR)/data.h
+salloc.o: $(CDIR)/extern.h
+salloc.o: $(CDIR)/param.h
+salloc.o: $(CDIR)/result.h
+salloc.o: tables.h
+salloc.o: $(CDIR)/types.h
+state.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+state.o: $(CDIR)/data.h
+state.o: $(CDIR)/extern.h
+state.o: $(CDIR)/param.h
+state.o: $(CDIR)/result.h
+state.o: $(CDIR)/state.h
+state.o: tables.h
+state.o: $(CDIR)/types.h
+subr.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
+subr.o: $(CDIR)/data.h
+subr.o: $(CDIR)/extern.h
+subr.o: $(CDIR)/param.h
+subr.o: $(CDIR)/result.h
+subr.o: tables.h
+subr.o: $(CDIR)/types.h
+var.o: $(CDIR)/data.h $(EMHOME)/h/cgg_cg.h
+var.o: $(CDIR)/param.h
+var.o: $(CDIR)/result.h
+var.o: tables.h
+var.o: $(CDIR)/types.h
diff --git a/mach/proto/top/Makefile b/mach/proto/top/Makefile
new file mode 100644
index 00000000..57908427
--- /dev/null
+++ b/mach/proto/top/Makefile
@@ -0,0 +1,42 @@
+EMHOME=../../..
+LIBS=$(EMHOME)/modules/lib/libstring.a
+PREFLAGS=-I.
+PFLAGS=
+CFLAGS=$(PREFLAGS) $(PFLAGS) -O -DNDEBUG
+LDFLAGS=$(PFLAGS)
+LINTOPTS=-bx
+CDIR=$(EMHOME)/mach/proto/top
+CFILES=$(CDIR)/top.c $(CDIR)/queue.c
+OFILES=top.o queue.o
+
+all: gen.c
+ make top
+
+top: $(OFILES)
+ $(CC) $(LDFLAGS) $(OFILES) $(LIBS) -o top
+
+top.o: $(CDIR)/top.c gen.c
+ $(CC) -c $(CFLAGS) $(CDIR)/top.c
+
+queue.o: $(CDIR)/queue.c
+ $(CC) -c $(CFLAGS) $(CDIR)/queue.c
+
+install: all
+ $(EMHOME)/mach/install top
+
+cmp: all
+ -$(EMHOME)/mach/compare top
+
+gen.c: table
+ $(EMHOME)/lib/topgen table
+
+lint: $(CFILES)
+ lint $(LINTOPTS) $(PREFLAGS) $(CFILES)
+
+clean:
+ rm -f *.o gen.c gen.h top
+
+top.o: gen.h
+top.o: $(CDIR)/top.h
+top.o: $(CDIR)/queue.h
+queue.o: $(CDIR)/queue.h
diff --git a/mach/s2650/as/Makefile b/mach/s2650/as/Makefile
new file mode 100644
index 00000000..7455a482
--- /dev/null
+++ b/mach/s2650/as/Makefile
@@ -0,0 +1,67 @@
+# $Header$
+EMHOME = ../../..
+h = $(EMHOME)/h
+LIBOBJ = $(EMHOME)/modules/lib/libobject.a
+CDIR = $(EMHOME)/mach/proto/as
+CPP = $(EMHOME)/lib/cpp
+DEF =
+
+FFLAG =
+INCL = -I. -I$h $(DEF)
+CFLAGS = $(FFLAG) -O $(INCL)
+YFLAGS = -d
+LDFLAGS = $(FFLAG)
+
+CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
+ $(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
+COBJ = comm3.o comm4.o comm5.o \
+ comm6.o comm7.o comm8.o
+MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
+COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
+
+all: as
+
+install:all
+ ../../install as
+
+cmp:
+ -../../compare as
+
+clean:
+ rm -f *.o as as.[cy] y.tab.h
+
+pr: $(MACH)
+ @pr -n $(MACH)
+
+opr:
+ make pr | opr
+as: $(COBJ) as.o
+ $(CC) $(LDFLAGS) $(COBJ) as.o $(LIBOBJ) -o as
+
+as.y: $(CDIR)/comm2.y
+ $(CPP) -P -I. -I$h $(DEF) $(CDIR)/comm2.y >as.y
+ -@if test -f Expect ; then cat Expect ; else echo "expect 1 shift/reduce conflict"; fi
+
+lint: $(CSRC) as.c
+ lint $(INCL) $(CSRC) as.c
+
+y.tab.h: as.c
+$(COBJ): y.tab.h
+$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
+$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
+as.y: mach2.c
+comm3.o: mach3.c
+as.y: mach4.c
+comm8.o: mach5.c
+comm3.o: $(CDIR)/comm3.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm3.c
+comm4.o: $(CDIR)/comm4.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm4.c
+comm5.o: $(CDIR)/comm5.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm5.c
+comm6.o: $(CDIR)/comm6.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm6.c
+comm7.o: $(CDIR)/comm7.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm7.c
+comm8.o: $(CDIR)/comm8.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm8.c
diff --git a/mach/sparc/ce/ce.src/C_exp.c b/mach/sparc/ce/ce.src/C_exp.c
new file mode 100644
index 00000000..e9c23889
--- /dev/null
+++ b/mach/sparc/ce/ce.src/C_exp.c
@@ -0,0 +1,13 @@
+#define CODE_EXPANDER
+#include
+#include "back.h"
+
+C_exp( s)
+char *s;
+{
+ s = extnd_name( s);
+ set_global_visible(s);
+#ifdef __solaris__
+ fprint(codefile, "\t.type\t%s,#function\n", s);
+#endif
+}
diff --git a/mach/sparc/libsys/fif.s b/mach/sparc/libsys/fif.s
new file mode 100644
index 00000000..cdc6791e
--- /dev/null
+++ b/mach/sparc/libsys/fif.s
@@ -0,0 +1,67 @@
+.global fif8, Fd0, Fd1, Fd80000000, Fs80000000, Fs0
+
+.align 8
+Fd0:
+.double 0r0
+Fd1:
+.double 0r1
+FxE15:
+.word 0x43300000, 0x0 ! magic const: (a.b + x) - x == a.0
+Fd80000000:
+.align 8
+.double 0r4294967296
+Fs80000000:
+.single 0r2147483648
+Fs0:
+.single 0r0
+
+fif8:
+ ld [%l0], %f0
+ ld [%l0+4], %f1
+ ld [%l0+8], %f2
+ ld [%l0+12], %f3
+ fmuld %f0, %f2, %f0
+ fmovs %f0, %f6
+ fmovs %f1, %f7
+ set Fd0, %o0
+ ldd [%o0], %f8
+ fcmpd %f0, %f8
+ nop
+ fbuge,a 1f
+ mov %g0, %o1
+ set 1, %o1
+ fnegs %f0, %f0
+1:
+ set FxE15, %o0
+ ldd [%o0], %f10
+ fcmpd %f0, %f10
+ nop
+ fbuge 2f
+ nop
+ faddd %f0, %f10, %f4
+ fsubd %f4, %f10, %f4
+ fsubd %f0, %f4, %f2
+ set Fd1, %o0
+ ldd [%o0], %f12
+4: fcmpd %f2, %f12
+ nop
+ fbge,a 4b
+ fsubd %f2, %f12, %f2
+5: fcmpd %f2, %f8
+ nop
+ fbl,a 5b
+ faddd %f2, %f12, %f2
+ fsubd %f0, %f2, %f0
+2:
+ tst %o1
+ bz 3f
+ nop
+ fnegs %f0, %f0
+3:
+ fsubd %f6, %f0, %f2
+ st %f0, [%l0]
+ st %f1, [%l0+4]
+ st %f2, [%l0+8]
+ st %f3, [%l0+12]
+ retl
+ nop
diff --git a/mach/sparc/libsys/msync.s b/mach/sparc/libsys/msync.s
new file mode 100644
index 00000000..397f934f
--- /dev/null
+++ b/mach/sparc/libsys/msync.s
@@ -0,0 +1,3 @@
+#include "SYS.h"
+
+SYS_call_3(msync)
diff --git a/mach/sun2/cv/Makefile b/mach/sun2/cv/Makefile
new file mode 100644
index 00000000..dbb54a7c
--- /dev/null
+++ b/mach/sun2/cv/Makefile
@@ -0,0 +1,25 @@
+EMHOME = ../../..
+LIBOBJ = $(EMHOME)/modules/lib/libobject.a
+INCLUDE = $(EMHOME)/h
+CFLAGS = -I. -I$(INCLUDE) -O -DMACH=1
+TARGETS = cv
+
+all: $(TARGETS)
+
+install: all
+ ../../install cv
+
+cmp: all
+ ../../compare cv
+
+cv: cv.o
+ $(CC) $(LDFLAGS) -o cv cv.o $(LIBOBJ)
+
+clean:
+ rm -f $(TARGETS) *.o nohup.out Out
+
+pr:
+ @pr Makefile cv.c
+
+opr:
+ make pr | opr
diff --git a/mach/sun2/libsys/Makefile b/mach/sun2/libsys/Makefile
new file mode 100644
index 00000000..9132faab
--- /dev/null
+++ b/mach/sun2/libsys/Makefile
@@ -0,0 +1,29 @@
+# $Header$
+MACH=sun2
+all: libmon_o.a head_em.o
+
+install: all
+ ../../install head_em.o head_em
+ ../../install libmon_o.a tail_mon
+
+
+cmp: all
+ -../../compare head_em.o head_em
+ -../../compare libmon_o.a tail_mon
+
+libmon_o.a: libmon_s.a
+ ASAR=aal ; export ASAR ;\
+ march . libmon_o.a
+
+head_em.o: head_em.s
+ $(MACH) -I../../../h -c head_em.s
+
+clean:
+ rm -f *.o libmon_o.a
+
+opr :
+ make pr | opr
+
+pr:
+ @pr `pwd`/head_em.s
+ @arch pv libmon_s.a | pr -h `pwd`/libmon_s.a
diff --git a/mach/sun2/libsys/compmodule b/mach/sun2/libsys/compmodule
new file mode 100755
index 00000000..0e6fe927
--- /dev/null
+++ b/mach/sun2/libsys/compmodule
@@ -0,0 +1,4 @@
+if sun2 -c -L $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi
diff --git a/mach/sun3/ce/Makefile b/mach/sun3/ce/Makefile
new file mode 100644
index 00000000..9d1559ed
--- /dev/null
+++ b/mach/sun3/ce/Makefile
@@ -0,0 +1,38 @@
+EMHOME=../../..
+BACK=$(EMHOME)/lib/ceg/ce_back
+CEG = $(EMHOME)/lib/ceg/util
+AR = ar
+
+all: back.a
+ make -f $(CEG)/make_own
+
+install: back.a
+ make -f $(CEG)/make_own install
+
+cmp: back.a
+ -make -f $(CEG)/make_own cmp
+
+pr:
+ @pr Makefile EM_table mach.h mach.c as_table as.h as.c \
+ Make.back do_close.c do_open.c end_back.c misc.c output.c relocation.c
+
+opr:
+ make pr | opr
+
+# total cleanup
+clean:
+ make -f $(CEG)/make_own clean
+ rm -rf back back.a
+
+# only remove ce, ceg, and back directories
+dclean:
+ make -f $(CEG)/make_own dclean
+ rm -rf back
+
+back.a: do_close.c do_open.c end_back.c misc.c output.c relocation.c
+ -mkdir back
+ cp $(BACK)/obj_back/*h back
+ cp Make.back back/Makefile
+ cd back; make ; cd ..
+ $(AR) r back.a back/*o;
+ -sh -c 'ranlib back.a'
diff --git a/mach/sun3/cv/Makefile b/mach/sun3/cv/Makefile
new file mode 100644
index 00000000..7dc412a9
--- /dev/null
+++ b/mach/sun3/cv/Makefile
@@ -0,0 +1,28 @@
+EMHOME = ../../..
+LIBOBJ = $(EMHOME)/modules/lib/libobject.a
+INCLUDE = $(EMHOME)/h
+CFLAGS = -I. -I$(INCLUDE) -O -DMACH=2
+TARGETS = cv
+
+all: $(TARGETS)
+
+install: all
+ ../../install cv
+
+cmp: all
+ ../../compare cv
+
+cv: cv.o
+ $(CC) $(LDFLAGS) -o cv cv.o $(LIBOBJ)
+
+Xcv: Xcv.o
+ $(CC) $(LDFLAGS) -o Xcv Xcv.o $(LIBOBJ)
+
+clean:
+ rm -f $(TARGETS) *.o nohup.out Out
+
+pr:
+ @pr Makefile cv.c
+
+opr:
+ make pr | opr
diff --git a/mach/sun3/libce/Makefile b/mach/sun3/libce/Makefile
new file mode 100644
index 00000000..fa471e2f
--- /dev/null
+++ b/mach/sun3/libce/Makefile
@@ -0,0 +1,42 @@
+# $Header$
+
+EMHOME=../../..
+
+EMOBJ = aar.o cii.o cmi.o cms.o cmu.o csa.o csb.o cuu.o dia.o exg.o fat.o \
+ inn.o lar.o los.o mon.o nop.o sar.o set.o shp.o sts.o trp.o trpstr.o
+
+FOBJ = adf4.o adf8.o cff.o cfi.o cfu.o cif.o cmf4.o cmf8.o cuf.o dvf4.o \
+ dvf8.o fef4.o fef8.o fif4.o fif8.o mlf4.o mlf8.o sbf4.o sbf8.o vars.o
+
+OBJ = $(EMOBJ) $(FOBJ)
+
+all: libext.a head_em.sun.o
+
+.s.o:
+ sun3 -c $*.s
+
+libext.a: $(OBJ)
+ for i in $(OBJ) ; do ../../../lib/sun3/cv -u $$i $$i.X ; mv $$i.X $$i ; done
+ ar rv libext.a $(OBJ)
+ ranlib libext.a
+
+head_em.sun.o: head_em.o
+ ../../../lib/sun3/cv -u head_em.o head_em.sun.o
+
+install: all
+ ../../install libext.a tail_ext
+ ../../install head_em.sun.o head_ext
+
+cmp: all
+ -../../compare libext.a tail_ext
+ -../../compare head_em.sun.o head_ext
+
+clean:
+ rm -f *.[oa]
+
+pr:
+
+opr:
+
+$(EMOBJ): $(EMHOME)/lib/m68020/tail_em
+ aal x $(EMHOME)/lib/m68020/tail_em $(EMOBJ)
diff --git a/mach/sun3/libsys/Makefile b/mach/sun3/libsys/Makefile
new file mode 100644
index 00000000..5861ef1d
--- /dev/null
+++ b/mach/sun3/libsys/Makefile
@@ -0,0 +1,29 @@
+# $Header$
+MACH=m68020
+all: libmon_o.a head_em.o
+
+install: all
+ ../../install head_em.o head_em
+ ../../install libmon_o.a tail_mon
+
+
+cmp: all
+ -../../compare head_em.o head_em
+ -../../compare libmon_o.a tail_mon
+
+libmon_o.a: libmon_s.a
+ ASAR=aal ; export ASAR ;\
+ march . libmon_o.a
+
+head_em.o: head_em.s
+ $(MACH) -I../../../h -c head_em.s
+
+clean:
+ rm -f *.o libmon_o.a
+
+opr :
+ make pr | opr
+
+pr:
+ @pr `pwd`/head_em.s
+ @arch pv libmon_s.a | pr -h `pwd`/libmon_s.a
diff --git a/mach/sun3/libsys/Xstat.c b/mach/sun3/libsys/Xstat.c
new file mode 100644
index 00000000..b4c68899
--- /dev/null
+++ b/mach/sun3/libsys/Xstat.c
@@ -0,0 +1,58 @@
+#include
+#include
+
+static Xcvt();
+
+int
+stat(path, buf)
+ char *path;
+ struct stat *buf;
+{
+ char Xbuf[100];
+ int retval;
+
+ retval = _stat(path, Xbuf);
+ Xcvt(Xbuf, (char *)buf);
+ return retval;
+}
+
+int
+lstat(path, buf)
+ char *path;
+ struct stat *buf;
+{
+ char Xbuf[100];
+ int retval;
+
+ retval = _lstat(path, Xbuf);
+ Xcvt(Xbuf, (char *)buf);
+ return retval;
+}
+
+int
+fstat(fd, buf)
+ int fd;
+ struct stat *buf;
+{
+ char Xbuf[100];
+ int retval;
+
+ retval = __fstat(fd, Xbuf);
+ Xcvt(Xbuf, (char *)buf);
+ return retval;
+}
+
+static
+Xcvt(buf, statbuf)
+ char *buf, *statbuf;
+{
+ register char *s, *t;
+ register int i;
+
+ s = buf; t = statbuf;
+ *t++ = *s++; *t++ = *s++;
+ *t++ = 0; *t++ = 0;
+ for (i = 14; i; i--) *t++ = *s++;
+ *t++ = 0; *t++ = 0;
+ for (i = 44; i; i--) *t++ = *s++;
+}
diff --git a/mach/sun3/libsys/_Xstat.c b/mach/sun3/libsys/_Xstat.c
new file mode 100644
index 00000000..ac8ad0e8
--- /dev/null
+++ b/mach/sun3/libsys/_Xstat.c
@@ -0,0 +1,32 @@
+#include
+#include
+
+static Xcvt();
+
+int
+_fstat(fd, buf)
+ int fd;
+ struct stat *buf;
+{
+ char Xbuf[100];
+ int retval;
+
+ retval = __fstat(fd, Xbuf);
+ Xcvt(Xbuf, (char *)buf);
+ return retval;
+}
+
+static
+Xcvt(buf, statbuf)
+ char *buf, *statbuf;
+{
+ register char *s, *t;
+ register int i;
+
+ s = buf; t = statbuf;
+ *t++ = *s++; *t++ = *s++;
+ *t++ = 0; *t++ = 0;
+ for (i = 14; i; i--) *t++ = *s++;
+ *t++ = 0; *t++ = 0;
+ for (i = 44; i; i--) *t++ = *s++;
+}
diff --git a/mach/sun3/libsys/compmodule b/mach/sun3/libsys/compmodule
new file mode 100755
index 00000000..253624cc
--- /dev/null
+++ b/mach/sun3/libsys/compmodule
@@ -0,0 +1,4 @@
+if sun3 -c -L $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi
diff --git a/mach/vax4/as/Makefile b/mach/vax4/as/Makefile
new file mode 100644
index 00000000..7455a482
--- /dev/null
+++ b/mach/vax4/as/Makefile
@@ -0,0 +1,67 @@
+# $Header$
+EMHOME = ../../..
+h = $(EMHOME)/h
+LIBOBJ = $(EMHOME)/modules/lib/libobject.a
+CDIR = $(EMHOME)/mach/proto/as
+CPP = $(EMHOME)/lib/cpp
+DEF =
+
+FFLAG =
+INCL = -I. -I$h $(DEF)
+CFLAGS = $(FFLAG) -O $(INCL)
+YFLAGS = -d
+LDFLAGS = $(FFLAG)
+
+CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
+ $(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
+COBJ = comm3.o comm4.o comm5.o \
+ comm6.o comm7.o comm8.o
+MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
+COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
+
+all: as
+
+install:all
+ ../../install as
+
+cmp:
+ -../../compare as
+
+clean:
+ rm -f *.o as as.[cy] y.tab.h
+
+pr: $(MACH)
+ @pr -n $(MACH)
+
+opr:
+ make pr | opr
+as: $(COBJ) as.o
+ $(CC) $(LDFLAGS) $(COBJ) as.o $(LIBOBJ) -o as
+
+as.y: $(CDIR)/comm2.y
+ $(CPP) -P -I. -I$h $(DEF) $(CDIR)/comm2.y >as.y
+ -@if test -f Expect ; then cat Expect ; else echo "expect 1 shift/reduce conflict"; fi
+
+lint: $(CSRC) as.c
+ lint $(INCL) $(CSRC) as.c
+
+y.tab.h: as.c
+$(COBJ): y.tab.h
+$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
+$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
+as.y: mach2.c
+comm3.o: mach3.c
+as.y: mach4.c
+comm8.o: mach5.c
+comm3.o: $(CDIR)/comm3.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm3.c
+comm4.o: $(CDIR)/comm4.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm4.c
+comm5.o: $(CDIR)/comm5.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm5.c
+comm6.o: $(CDIR)/comm6.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm6.c
+comm7.o: $(CDIR)/comm7.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm7.c
+comm8.o: $(CDIR)/comm8.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm8.c
diff --git a/mach/vax4/ce/Makefile b/mach/vax4/ce/Makefile
new file mode 100644
index 00000000..badc8d8a
--- /dev/null
+++ b/mach/vax4/ce/Makefile
@@ -0,0 +1,38 @@
+EMHOME=../../..
+BACK=$(EMHOME)/lib/ceg/ce_back
+CEG = $(EMHOME)/lib/ceg/util
+AR = ar
+
+all: back.a
+ make -f $(CEG)/make_own
+
+install: back.a
+ make -f $(CEG)/make_own install
+
+cmp: back.a
+ -make -f $(CEG)/make_own cmp
+
+pr:
+ @pr Makefile EM_table mach.h mach.c as_table as.h as.c \
+ Make.back do_close.c do_open.c end_back.c misc.c output.c relocation.c
+
+opr:
+ make pr | opr
+
+# total cleanup
+clean:
+ make -f $(CEG)/make_own clean
+ rm -rf back back.a
+
+# only remove ce, ceg, and back directories
+dclean:
+ make -f $(CEG)/make_own dclean
+ rm -rf back
+
+back.a: do_close.c do_open.c end_back.c output.c relocation.c
+ -mkdir back
+ cp $(BACK)/obj_back/*h back
+ cp Make.back back/Makefile
+ cd back; make ; cd ..
+ $(AR) r back.a back/*o;
+ -sh -c 'ranlib back.a'
diff --git a/mach/vax4/cg/Makefile b/mach/vax4/cg/Makefile
new file mode 100644
index 00000000..22f5f603
--- /dev/null
+++ b/mach/vax4/cg/Makefile
@@ -0,0 +1,184 @@
+# $Header$
+
+EMHOME=../../..
+PREFLAGS=-I$(EMHOME)/h -I. -I$(EMHOME)/mach -I$(EMHOME)/modules/h -DNDEBUG
+PFLAGS=
+CFLAGS=$(PREFLAGS) $(PFLAGS) -O
+LDFLAGS=$(PFLAGS)
+LINTOPTS=-hbxac
+LIBS=$(EMHOME)/lib/em_data.a $(EMHOME)/modules/lib/libflt.a
+CDIR=$(EMHOME)/mach/proto/cg
+CFILES=$(CDIR)/codegen.c $(CDIR)/compute.c $(CDIR)/equiv.c $(CDIR)/fillem.c \
+ $(CDIR)/gencode.c $(CDIR)/glosym.c $(CDIR)/main.c $(CDIR)/move.c \
+ $(CDIR)/nextem.c $(CDIR)/reg.c $(CDIR)/regvar.c $(CDIR)/salloc.c \
+ $(CDIR)/state.c $(CDIR)/subr.c $(CDIR)/var.c
+OFILES=codegen.o compute.o equiv.o fillem.o gencode.o glosym.o main.o\
+ move.o nextem.o reg.o regvar.o salloc.o state.o subr.o var.o
+
+all: tables.c
+ make "EMHOME="$(EMHOME) cg
+
+cg: tables.o $(OFILES)
+ $(CC) $(LDFLAGS) $(OFILES) tables.o $(LIBS) -o cg
+
+tables.o: tables.c
+ $(CC) -c $(PREFLAGS) -I$(CDIR) tables.c
+
+codegen.o: $(CDIR)/codegen.c
+ $(CC) -c $(CFLAGS) $(CDIR)/codegen.c
+compute.o: $(CDIR)/compute.c
+ $(CC) -c $(CFLAGS) $(CDIR)/compute.c
+equiv.o: $(CDIR)/equiv.c
+ $(CC) -c $(CFLAGS) $(CDIR)/equiv.c
+fillem.o: $(CDIR)/fillem.c
+ $(CC) -c $(CFLAGS) $(CDIR)/fillem.c
+gencode.o: $(CDIR)/gencode.c
+ $(CC) -c $(CFLAGS) $(CDIR)/gencode.c
+glosym.o: $(CDIR)/glosym.c
+ $(CC) -c $(CFLAGS) $(CDIR)/glosym.c
+main.o: $(CDIR)/main.c
+ $(CC) -c $(CFLAGS) $(CDIR)/main.c
+move.o: $(CDIR)/move.c
+ $(CC) -c $(CFLAGS) $(CDIR)/move.c
+nextem.o: $(CDIR)/nextem.c
+ $(CC) -c $(CFLAGS) $(CDIR)/nextem.c
+reg.o: $(CDIR)/reg.c
+ $(CC) -c $(CFLAGS) $(CDIR)/reg.c
+regvar.o: $(CDIR)/regvar.c
+ $(CC) -c $(CFLAGS) $(CDIR)/regvar.c
+salloc.o: $(CDIR)/salloc.c
+ $(CC) -c $(CFLAGS) $(CDIR)/salloc.c
+state.o: $(CDIR)/state.c
+ $(CC) -c $(CFLAGS) $(CDIR)/state.c
+subr.o: $(CDIR)/subr.c
+ $(CC) -c $(CFLAGS) $(CDIR)/subr.c
+var.o: $(CDIR)/var.c
+ $(CC) -c $(CFLAGS) $(CDIR)/var.c
+
+install: all
+ ../../install cg
+
+cmp: all
+ -../../compare cg
+
+distr: tables.c
+ rm -f tables1.[ch]
+ cp tables.c tables1.c
+ cp tables.h tables1.h
+ chmod -w tables1.[ch]
+
+
+tables.c: table
+ -mv tables.h tables.h.save
+ $(EMHOME)/lib/cpp -P table | $(EMHOME)/lib/cgg > debug.out
+ -if cmp -s tables.h.save tables.h; then mv tables.h.save tables.h; else exit 0; fi
+ -if cmp -s /dev/null tables.h; then mv tables.h.save tables.h; else exit 0; fi
+
+lint: $(CFILES)
+ lint $(LINTOPTS) $(PREFLAGS) $(CFILES)
+clean:
+ rm -f *.o tables.c tables.h debug.out cg tables.h.save
+
+codegen.o: $(CDIR)/assert.h
+codegen.o: $(CDIR)/data.h
+codegen.o: $(CDIR)/equiv.h
+codegen.o: $(CDIR)/extern.h
+codegen.o: $(CDIR)/param.h
+codegen.o: $(CDIR)/result.h
+codegen.o: $(CDIR)/state.h
+codegen.o: tables.h
+codegen.o: $(CDIR)/types.h
+compute.o: $(CDIR)/assert.h
+compute.o: $(CDIR)/data.h
+compute.o: $(CDIR)/extern.h
+compute.o: $(CDIR)/glosym.h
+compute.o: $(CDIR)/param.h
+compute.o: $(CDIR)/result.h
+compute.o: tables.h
+compute.o: $(CDIR)/types.h
+equiv.o: $(CDIR)/assert.h
+equiv.o: $(CDIR)/data.h
+equiv.o: $(CDIR)/equiv.h
+equiv.o: $(CDIR)/extern.h
+equiv.o: $(CDIR)/param.h
+equiv.o: $(CDIR)/result.h
+equiv.o: tables.h
+equiv.o: $(CDIR)/types.h
+fillem.o: $(CDIR)/assert.h
+fillem.o: $(CDIR)/data.h
+fillem.o: $(CDIR)/extern.h
+fillem.o: mach.c
+fillem.o: mach.h
+fillem.o: $(CDIR)/param.h
+fillem.o: $(CDIR)/regvar.h
+fillem.o: $(CDIR)/result.h
+fillem.o: tables.h
+fillem.o: $(CDIR)/types.h
+gencode.o: $(CDIR)/assert.h
+gencode.o: $(CDIR)/data.h
+gencode.o: $(CDIR)/extern.h
+gencode.o: $(CDIR)/param.h
+gencode.o: $(CDIR)/result.h
+gencode.o: tables.h
+gencode.o: $(CDIR)/types.h
+glosym.o: $(CDIR)/glosym.h
+glosym.o: $(CDIR)/param.h
+glosym.o: tables.h
+glosym.o: $(CDIR)/types.h
+main.o: $(CDIR)/param.h
+move.o: $(CDIR)/assert.h
+move.o: $(CDIR)/data.h
+move.o: $(CDIR)/extern.h
+move.o: $(CDIR)/param.h
+move.o: $(CDIR)/result.h
+move.o: tables.h
+move.o: $(CDIR)/types.h
+nextem.o: $(CDIR)/assert.h
+nextem.o: $(CDIR)/data.h
+nextem.o: $(CDIR)/extern.h
+nextem.o: $(CDIR)/param.h
+nextem.o: $(CDIR)/result.h
+nextem.o: tables.h
+nextem.o: $(CDIR)/types.h
+reg.o: $(CDIR)/assert.h
+reg.o: $(CDIR)/data.h
+reg.o: $(CDIR)/extern.h
+reg.o: $(CDIR)/param.h
+reg.o: $(CDIR)/result.h
+reg.o: tables.h
+reg.o: $(CDIR)/types.h
+regvar.o: $(CDIR)/assert.h
+regvar.o: $(CDIR)/data.h
+regvar.o: $(CDIR)/extern.h
+regvar.o: $(CDIR)/param.h
+regvar.o: $(CDIR)/regvar.h
+regvar.o: $(CDIR)/result.h
+regvar.o: tables.h
+regvar.o: $(CDIR)/types.h
+salloc.o: $(CDIR)/assert.h
+salloc.o: $(CDIR)/data.h
+salloc.o: $(CDIR)/extern.h
+salloc.o: $(CDIR)/param.h
+salloc.o: $(CDIR)/result.h
+salloc.o: tables.h
+salloc.o: $(CDIR)/types.h
+state.o: $(CDIR)/assert.h
+state.o: $(CDIR)/data.h
+state.o: $(CDIR)/extern.h
+state.o: $(CDIR)/param.h
+state.o: $(CDIR)/result.h
+state.o: $(CDIR)/state.h
+state.o: tables.h
+state.o: $(CDIR)/types.h
+subr.o: $(CDIR)/assert.h
+subr.o: $(CDIR)/data.h
+subr.o: $(CDIR)/extern.h
+subr.o: $(CDIR)/param.h
+subr.o: $(CDIR)/result.h
+subr.o: tables.h
+subr.o: $(CDIR)/types.h
+var.o: $(CDIR)/data.h
+var.o: $(CDIR)/param.h
+var.o: $(CDIR)/result.h
+var.o: tables.h
+var.o: $(CDIR)/types.h
diff --git a/mach/vax4/cv/Makefile b/mach/vax4/cv/Makefile
new file mode 100644
index 00000000..5cfa97a6
--- /dev/null
+++ b/mach/vax4/cv/Makefile
@@ -0,0 +1,25 @@
+EMHOME = ../../..
+LIBOBJ = $(EMHOME)/modules/lib/libobject.a
+INCLUDE = $(EMHOME)/h
+CFLAGS = -I. -I$(INCLUDE) -O
+TARGETS = cv
+
+all: $(TARGETS)
+
+install: all
+ ../../install cv
+
+cmp: all
+ ../../compare cv
+
+cv: cv.o
+ $(CC) $(LDFLAGS) -o cv cv.o $(LIBOBJ)
+
+clean:
+ rm -f $(TARGETS) *.o nohup.out Out
+
+pr:
+ @pr Makefile cv.c
+
+opr:
+ make pr | opr
diff --git a/mach/vax4/libbsd4_1a/Makefile b/mach/vax4/libbsd4_1a/Makefile
new file mode 100644
index 00000000..b38eda1a
--- /dev/null
+++ b/mach/vax4/libbsd4_1a/Makefile
@@ -0,0 +1,30 @@
+# $Header$
+all: head_em.o libmon_o.a
+
+install: cp
+
+cp: all
+ ../../install head_em.o head_em
+ ../../install libmon_o.a tail_mon
+
+cmp: all
+ -../../compare head_em.o head_em
+ -../../compare libmon_o.a tail_mon
+
+
+head_em.o: head_em.s
+ vax4 -I../../../h -c head_em.s
+
+libmon_o.a: libmon_s.a
+ ASAR=aal ; export ASAR ;\
+ march . libmon_o.a
+
+clean:
+ rm -f *.o libmon_o.a
+
+opr:
+ make pr | opr
+
+pr:
+ @pr `pwd`/Makefile `pwd`/head_em.s
+ @arch pv libmon_s.a | pr -h `pwd`/libmon_s.a
diff --git a/mach/vax4/libbsd4_1a/compmodule b/mach/vax4/libbsd4_1a/compmodule
new file mode 100755
index 00000000..67777e8a
--- /dev/null
+++ b/mach/vax4/libbsd4_1a/compmodule
@@ -0,0 +1,4 @@
+if vax4 -O -c -I../../../h -I. $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi
diff --git a/mach/vax4/libbsd4_2/Makefile b/mach/vax4/libbsd4_2/Makefile
new file mode 100644
index 00000000..ff816bd1
--- /dev/null
+++ b/mach/vax4/libbsd4_2/Makefile
@@ -0,0 +1,27 @@
+# $Header$
+install: cp
+
+cp: all
+ ../../install head_em.o head_em
+ ../../install tail_mon
+
+cmp: all
+ -../../compare head_em.o head_em
+ -../../compare tail_mon
+
+all: head_em tail_mon
+
+head_em: head_em.s
+ vax4 -I../../../h -c head_em.s
+
+tail_mon: libmon_s.a
+ ASAR=aal ; export ASAR ;\
+ march . tail_mon
+
+clean:
+ rm -f *.o tail_mon
+opr:
+ make pr | opr
+pr:
+ @pr `pwd`/Makefile `pwd`/head_em.s
+ @pr -l33 `tail +1 LIST|sort`
diff --git a/mach/vax4/libbsd4_2/compmodule b/mach/vax4/libbsd4_2/compmodule
new file mode 100755
index 00000000..3b054dea
--- /dev/null
+++ b/mach/vax4/libbsd4_2/compmodule
@@ -0,0 +1,4 @@
+if vax4 -O -c -L -I../../../h -I. $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi
diff --git a/mach/vax4/libem/Makefile b/mach/vax4/libem/Makefile
new file mode 100644
index 00000000..7588a8ea
--- /dev/null
+++ b/mach/vax4/libem/Makefile
@@ -0,0 +1,33 @@
+# $Header$
+MACH=vax4
+ASAR=aal
+all: libem_o.a end.a
+
+install: all
+ ../../install libem_o.a tail_em
+ ../../install end.a end_em
+
+cmp: all
+ -../../compare libem_o.a tail_em
+ -../../compare end.a end_em
+
+end.a: em_end.s etext.s edata.s end.s
+ $(MACH) -I../../../h -c em_end.s
+ $(MACH) -I../../../h -c edata.s
+ $(MACH) -I../../../h -c etext.s
+ $(MACH) -I../../../h -c end.s
+ $(ASAR) cr end.a em_end.o etext.o edata.o end.o
+
+libem_o.a: libem_s.a
+ ASAR=$(ASAR) ; export ASAR ;\
+ march . libem_o.a
+
+clean:
+ rm -f *.o libem_o.a end.a
+
+opr :
+ make pr | opr
+
+pr:
+ @arch pv libem_s.a | pr -h `pwd`/libem_s.a
+ @pr `pwd`/em_end.s `pwd`/edata.s `pwd`/etext.s `pwd`/end.s
diff --git a/mach/vax4/libem/compmodule b/mach/vax4/libem/compmodule
new file mode 100755
index 00000000..67777e8a
--- /dev/null
+++ b/mach/vax4/libem/compmodule
@@ -0,0 +1,4 @@
+if vax4 -O -c -I../../../h -I. $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi
diff --git a/mach/vax4/libem/edata.s b/mach/vax4/libem/edata.s
new file mode 100644
index 00000000..f53adc10
--- /dev/null
+++ b/mach/vax4/libem/edata.s
@@ -0,0 +1,9 @@
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.define _edata
+.sect .data
+ .align 4
+ .sect .data
+_edata:
diff --git a/mach/vax4/libem/em_end.s b/mach/vax4/libem/em_end.s
new file mode 100644
index 00000000..a062368d
--- /dev/null
+++ b/mach/vax4/libem/em_end.s
@@ -0,0 +1,22 @@
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.define endtext,enddata,endbss,__end
+.sect .text
+ .align 4
+.sect .rom
+ .align 4
+.sect .data
+ .align 4
+.sect .bss
+ .align 4
+.sect .end ! only for declaration of _end, __end and endbss.
+
+ .sect .text
+endtext:
+ .sect .data
+enddata:
+ .sect .end
+__end:
+endbss:
diff --git a/mach/vax4/libem/end.s b/mach/vax4/libem/end.s
new file mode 100644
index 00000000..93a1e6e0
--- /dev/null
+++ b/mach/vax4/libem/end.s
@@ -0,0 +1,7 @@
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.define _end
+.sect .end ! only for declaration of _end, __end and endbss.
+_end:
diff --git a/mach/vax4/libem/etext.s b/mach/vax4/libem/etext.s
new file mode 100644
index 00000000..8c7453cb
--- /dev/null
+++ b/mach/vax4/libem/etext.s
@@ -0,0 +1,9 @@
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.define _etext
+.sect .text
+ .align 4
+ .sect .text
+_etext:
diff --git a/mach/vax4/libem/head_em.s b/mach/vax4/libem/head_em.s
new file mode 100644
index 00000000..2124e04b
--- /dev/null
+++ b/mach/vax4/libem/head_em.s
@@ -0,0 +1,93 @@
+#include "system.h"
+#include "em_abs.h"
+#ifdef BSD42
+#include "/usr/include/syscall.h"
+#endif BSD42
+
+ # $Header$
+
+.globl hol0
+.globl .reghp
+.globl .trppc
+.globl .trpim
+
+ # run time startoff
+ .word 0
+ bispsw $0100 # set FU(0100)
+ movl 4(sp),r0
+ clrl -4(r0)
+ movl sp,r0
+ movl (r0)+,r1
+ movl r0,r2
+a1:
+ tstl (r0)+
+ bneq a1
+ cmpl r0,(r2)
+ blssu a2
+ tstl -(r0)
+a2:
+ pushl r0
+ pushl r2
+ pushl r1
+ movl $m1,ap
+ chmk (ap)+ # catch floating point exception
+ calls $3,_m_a_i_n
+ movl $m2,ap
+ movl r0,6(ap)
+ chmk (ap)+
+ halt
+
+ .align 1
+sig8:
+ .word 0x0000
+ pushl 8(ap)
+ movl (sp)+,ap
+ pushl tab [ap]
+ jsb .trp
+ movl $m1,ap
+ chmk (ap)+
+ ret
+
+ .data
+#ifdef BSD42
+m1:
+ .word SYS_sigvec
+ .long 3
+ .long 8
+ .long m1a
+ .long 0
+m1a:
+ .long sig8
+ .long 0
+ .long 0
+#else BSD42
+m1:
+ .word 48
+ .long 2
+ .long 8
+ .long sig8
+#endif BSD42
+m2:
+ .word 1
+ .long 1
+ .long 0
+.reghp:
+ .long _end
+hol0:
+ .space 8
+.trppc:
+ .space 4
+.trpim:
+ .long 0
+tab:
+ .long 0
+ .long EIOVFL
+ .long EIDIVZ
+ .long EFOVFL
+ .long EFDIVZ
+ .long EFUNFL
+ .long EILLINS
+ .long EARRAY
+ .long EFOVFL
+ .long EFDIVZ
+ .long EFUNFL
diff --git a/mach/vax4/libem/system.h b/mach/vax4/libem/system.h
new file mode 100644
index 00000000..56ac7fac
--- /dev/null
+++ b/mach/vax4/libem/system.h
@@ -0,0 +1,4 @@
+/* $Header$ */
+/*#define BSD42 */
+/*#define BSD41c */
+#define BSD41a
diff --git a/mach/vax4/libem/vars.s b/mach/vax4/libem/vars.s
new file mode 100644
index 00000000..cafb1743
--- /dev/null
+++ b/mach/vax4/libem/vars.s
@@ -0,0 +1,15 @@
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .data
+.define hol0
+.define .reghp
+.define .trppc
+.define .trpim
+
+hol0:
+ .space 8
+.trppc:
+ .space 4
+.trpim:
+ .data4 0
+.reghp:
+ .data4 __end
diff --git a/mach/vax4/libsysV_2/Makefile b/mach/vax4/libsysV_2/Makefile
new file mode 100644
index 00000000..b38eda1a
--- /dev/null
+++ b/mach/vax4/libsysV_2/Makefile
@@ -0,0 +1,30 @@
+# $Header$
+all: head_em.o libmon_o.a
+
+install: cp
+
+cp: all
+ ../../install head_em.o head_em
+ ../../install libmon_o.a tail_mon
+
+cmp: all
+ -../../compare head_em.o head_em
+ -../../compare libmon_o.a tail_mon
+
+
+head_em.o: head_em.s
+ vax4 -I../../../h -c head_em.s
+
+libmon_o.a: libmon_s.a
+ ASAR=aal ; export ASAR ;\
+ march . libmon_o.a
+
+clean:
+ rm -f *.o libmon_o.a
+
+opr:
+ make pr | opr
+
+pr:
+ @pr `pwd`/Makefile `pwd`/head_em.s
+ @arch pv libmon_s.a | pr -h `pwd`/libmon_s.a
diff --git a/mach/vax4/libsysV_2/compmodule b/mach/vax4/libsysV_2/compmodule
new file mode 100755
index 00000000..3b054dea
--- /dev/null
+++ b/mach/vax4/libsysV_2/compmodule
@@ -0,0 +1,4 @@
+if vax4 -O -c -L -I../../../h -I. $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi
diff --git a/mach/vax4/top/Makefile b/mach/vax4/top/Makefile
new file mode 100644
index 00000000..57908427
--- /dev/null
+++ b/mach/vax4/top/Makefile
@@ -0,0 +1,42 @@
+EMHOME=../../..
+LIBS=$(EMHOME)/modules/lib/libstring.a
+PREFLAGS=-I.
+PFLAGS=
+CFLAGS=$(PREFLAGS) $(PFLAGS) -O -DNDEBUG
+LDFLAGS=$(PFLAGS)
+LINTOPTS=-bx
+CDIR=$(EMHOME)/mach/proto/top
+CFILES=$(CDIR)/top.c $(CDIR)/queue.c
+OFILES=top.o queue.o
+
+all: gen.c
+ make top
+
+top: $(OFILES)
+ $(CC) $(LDFLAGS) $(OFILES) $(LIBS) -o top
+
+top.o: $(CDIR)/top.c gen.c
+ $(CC) -c $(CFLAGS) $(CDIR)/top.c
+
+queue.o: $(CDIR)/queue.c
+ $(CC) -c $(CFLAGS) $(CDIR)/queue.c
+
+install: all
+ $(EMHOME)/mach/install top
+
+cmp: all
+ -$(EMHOME)/mach/compare top
+
+gen.c: table
+ $(EMHOME)/lib/topgen table
+
+lint: $(CFILES)
+ lint $(LINTOPTS) $(PREFLAGS) $(CFILES)
+
+clean:
+ rm -f *.o gen.c gen.h top
+
+top.o: gen.h
+top.o: $(CDIR)/top.h
+top.o: $(CDIR)/queue.h
+queue.o: $(CDIR)/queue.h
diff --git a/mach/xenix3/cv/Makefile b/mach/xenix3/cv/Makefile
new file mode 100644
index 00000000..2d6afc8c
--- /dev/null
+++ b/mach/xenix3/cv/Makefile
@@ -0,0 +1,30 @@
+EMHOME = ../../..
+LIBOBJ = $(EMHOME)/modules/lib/libobject.a
+INCLUDE = $(EMHOME)/h
+CFLAGS = -I. -I$(INCLUDE) -O
+TARGETS = cv chstack
+
+all: $(TARGETS)
+
+install: all
+ ../../install cv
+ ../../install chstack
+
+cmp: all
+ -../../compare cv
+ -../../compare chstack
+
+cv: cv.o
+ $(CC) $(LDFLAGS) -o cv cv.o $(LIBOBJ)
+
+chstack: chstack.o
+ $(CC) $(LDFLAGS) -o chstack chstack.o
+
+clean:
+ rm -f $(TARGETS) *.o nohup.out Out
+
+pr:
+ @pr Makefile cv.c chstack.c
+
+opr:
+ make pr | opr
diff --git a/mach/xenix3/libsys/Makefile b/mach/xenix3/libsys/Makefile
new file mode 100644
index 00000000..8585991a
--- /dev/null
+++ b/mach/xenix3/libsys/Makefile
@@ -0,0 +1,27 @@
+# $Header$
+MACH=xenix3
+all: libmon_o.a head_em.o
+
+install: all
+ ../../install libmon_o.a tail_mon
+ ../../install head_em.o head_em
+
+cmp: all
+ -../../compare libmon_o.a tail_mon
+ -../../compare head_em.o head_em
+
+libmon_o.a: libmon_s.a
+ ASAR=aal ; export ASAR ;\
+ march . libmon_o.a
+
+head_em.o: head_em.s
+ $(MACH) -O -c head_em.s
+clean:
+ rm -f *.o libmon_o.a
+
+opr :
+ make pr | opr
+
+pr:
+ @pr `pwd`/head_em.s
+ @arch pv libmon_s.a | pr -h `pwd`/libmon_s.a
diff --git a/mach/xenix3/libsys/_pipe.s b/mach/xenix3/libsys/_pipe.s
new file mode 100644
index 00000000..e01d6c13
--- /dev/null
+++ b/mach/xenix3/libsys/_pipe.s
@@ -0,0 +1,13 @@
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define __pipe
+.sect .text
+__pipe:
+ mov ax,42
+ call syscal
+ mov dx,bx
+ jae 1f
+ mov (_errno),ax
+ mov ax,-1
+ cwd
+1:
+ ret
diff --git a/mach/xenix3/libsys/_wait.s b/mach/xenix3/libsys/_wait.s
new file mode 100644
index 00000000..274857b8
--- /dev/null
+++ b/mach/xenix3/libsys/_wait.s
@@ -0,0 +1,13 @@
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define __wait
+.sect .text
+__wait:
+ mov ax,7
+ call syscal
+ mov dx,bx
+ jae 1f
+ mov (_errno),ax
+ mov ax,-1
+ cwd
+1:
+ ret
diff --git a/mach/xenix3/libsys/compmodule b/mach/xenix3/libsys/compmodule
new file mode 100755
index 00000000..d963eafb
--- /dev/null
+++ b/mach/xenix3/libsys/compmodule
@@ -0,0 +1,4 @@
+if xenix3 -c -L $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi
diff --git a/mach/z80/as/Makefile b/mach/z80/as/Makefile
new file mode 100644
index 00000000..7455a482
--- /dev/null
+++ b/mach/z80/as/Makefile
@@ -0,0 +1,67 @@
+# $Header$
+EMHOME = ../../..
+h = $(EMHOME)/h
+LIBOBJ = $(EMHOME)/modules/lib/libobject.a
+CDIR = $(EMHOME)/mach/proto/as
+CPP = $(EMHOME)/lib/cpp
+DEF =
+
+FFLAG =
+INCL = -I. -I$h $(DEF)
+CFLAGS = $(FFLAG) -O $(INCL)
+YFLAGS = -d
+LDFLAGS = $(FFLAG)
+
+CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
+ $(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
+COBJ = comm3.o comm4.o comm5.o \
+ comm6.o comm7.o comm8.o
+MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
+COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
+
+all: as
+
+install:all
+ ../../install as
+
+cmp:
+ -../../compare as
+
+clean:
+ rm -f *.o as as.[cy] y.tab.h
+
+pr: $(MACH)
+ @pr -n $(MACH)
+
+opr:
+ make pr | opr
+as: $(COBJ) as.o
+ $(CC) $(LDFLAGS) $(COBJ) as.o $(LIBOBJ) -o as
+
+as.y: $(CDIR)/comm2.y
+ $(CPP) -P -I. -I$h $(DEF) $(CDIR)/comm2.y >as.y
+ -@if test -f Expect ; then cat Expect ; else echo "expect 1 shift/reduce conflict"; fi
+
+lint: $(CSRC) as.c
+ lint $(INCL) $(CSRC) as.c
+
+y.tab.h: as.c
+$(COBJ): y.tab.h
+$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
+$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
+as.y: mach2.c
+comm3.o: mach3.c
+as.y: mach4.c
+comm8.o: mach5.c
+comm3.o: $(CDIR)/comm3.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm3.c
+comm4.o: $(CDIR)/comm4.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm4.c
+comm5.o: $(CDIR)/comm5.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm5.c
+comm6.o: $(CDIR)/comm6.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm6.c
+comm7.o: $(CDIR)/comm7.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm7.c
+comm8.o: $(CDIR)/comm8.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm8.c
diff --git a/mach/z80/cg/Makefile b/mach/z80/cg/Makefile
new file mode 100644
index 00000000..22f5f603
--- /dev/null
+++ b/mach/z80/cg/Makefile
@@ -0,0 +1,184 @@
+# $Header$
+
+EMHOME=../../..
+PREFLAGS=-I$(EMHOME)/h -I. -I$(EMHOME)/mach -I$(EMHOME)/modules/h -DNDEBUG
+PFLAGS=
+CFLAGS=$(PREFLAGS) $(PFLAGS) -O
+LDFLAGS=$(PFLAGS)
+LINTOPTS=-hbxac
+LIBS=$(EMHOME)/lib/em_data.a $(EMHOME)/modules/lib/libflt.a
+CDIR=$(EMHOME)/mach/proto/cg
+CFILES=$(CDIR)/codegen.c $(CDIR)/compute.c $(CDIR)/equiv.c $(CDIR)/fillem.c \
+ $(CDIR)/gencode.c $(CDIR)/glosym.c $(CDIR)/main.c $(CDIR)/move.c \
+ $(CDIR)/nextem.c $(CDIR)/reg.c $(CDIR)/regvar.c $(CDIR)/salloc.c \
+ $(CDIR)/state.c $(CDIR)/subr.c $(CDIR)/var.c
+OFILES=codegen.o compute.o equiv.o fillem.o gencode.o glosym.o main.o\
+ move.o nextem.o reg.o regvar.o salloc.o state.o subr.o var.o
+
+all: tables.c
+ make "EMHOME="$(EMHOME) cg
+
+cg: tables.o $(OFILES)
+ $(CC) $(LDFLAGS) $(OFILES) tables.o $(LIBS) -o cg
+
+tables.o: tables.c
+ $(CC) -c $(PREFLAGS) -I$(CDIR) tables.c
+
+codegen.o: $(CDIR)/codegen.c
+ $(CC) -c $(CFLAGS) $(CDIR)/codegen.c
+compute.o: $(CDIR)/compute.c
+ $(CC) -c $(CFLAGS) $(CDIR)/compute.c
+equiv.o: $(CDIR)/equiv.c
+ $(CC) -c $(CFLAGS) $(CDIR)/equiv.c
+fillem.o: $(CDIR)/fillem.c
+ $(CC) -c $(CFLAGS) $(CDIR)/fillem.c
+gencode.o: $(CDIR)/gencode.c
+ $(CC) -c $(CFLAGS) $(CDIR)/gencode.c
+glosym.o: $(CDIR)/glosym.c
+ $(CC) -c $(CFLAGS) $(CDIR)/glosym.c
+main.o: $(CDIR)/main.c
+ $(CC) -c $(CFLAGS) $(CDIR)/main.c
+move.o: $(CDIR)/move.c
+ $(CC) -c $(CFLAGS) $(CDIR)/move.c
+nextem.o: $(CDIR)/nextem.c
+ $(CC) -c $(CFLAGS) $(CDIR)/nextem.c
+reg.o: $(CDIR)/reg.c
+ $(CC) -c $(CFLAGS) $(CDIR)/reg.c
+regvar.o: $(CDIR)/regvar.c
+ $(CC) -c $(CFLAGS) $(CDIR)/regvar.c
+salloc.o: $(CDIR)/salloc.c
+ $(CC) -c $(CFLAGS) $(CDIR)/salloc.c
+state.o: $(CDIR)/state.c
+ $(CC) -c $(CFLAGS) $(CDIR)/state.c
+subr.o: $(CDIR)/subr.c
+ $(CC) -c $(CFLAGS) $(CDIR)/subr.c
+var.o: $(CDIR)/var.c
+ $(CC) -c $(CFLAGS) $(CDIR)/var.c
+
+install: all
+ ../../install cg
+
+cmp: all
+ -../../compare cg
+
+distr: tables.c
+ rm -f tables1.[ch]
+ cp tables.c tables1.c
+ cp tables.h tables1.h
+ chmod -w tables1.[ch]
+
+
+tables.c: table
+ -mv tables.h tables.h.save
+ $(EMHOME)/lib/cpp -P table | $(EMHOME)/lib/cgg > debug.out
+ -if cmp -s tables.h.save tables.h; then mv tables.h.save tables.h; else exit 0; fi
+ -if cmp -s /dev/null tables.h; then mv tables.h.save tables.h; else exit 0; fi
+
+lint: $(CFILES)
+ lint $(LINTOPTS) $(PREFLAGS) $(CFILES)
+clean:
+ rm -f *.o tables.c tables.h debug.out cg tables.h.save
+
+codegen.o: $(CDIR)/assert.h
+codegen.o: $(CDIR)/data.h
+codegen.o: $(CDIR)/equiv.h
+codegen.o: $(CDIR)/extern.h
+codegen.o: $(CDIR)/param.h
+codegen.o: $(CDIR)/result.h
+codegen.o: $(CDIR)/state.h
+codegen.o: tables.h
+codegen.o: $(CDIR)/types.h
+compute.o: $(CDIR)/assert.h
+compute.o: $(CDIR)/data.h
+compute.o: $(CDIR)/extern.h
+compute.o: $(CDIR)/glosym.h
+compute.o: $(CDIR)/param.h
+compute.o: $(CDIR)/result.h
+compute.o: tables.h
+compute.o: $(CDIR)/types.h
+equiv.o: $(CDIR)/assert.h
+equiv.o: $(CDIR)/data.h
+equiv.o: $(CDIR)/equiv.h
+equiv.o: $(CDIR)/extern.h
+equiv.o: $(CDIR)/param.h
+equiv.o: $(CDIR)/result.h
+equiv.o: tables.h
+equiv.o: $(CDIR)/types.h
+fillem.o: $(CDIR)/assert.h
+fillem.o: $(CDIR)/data.h
+fillem.o: $(CDIR)/extern.h
+fillem.o: mach.c
+fillem.o: mach.h
+fillem.o: $(CDIR)/param.h
+fillem.o: $(CDIR)/regvar.h
+fillem.o: $(CDIR)/result.h
+fillem.o: tables.h
+fillem.o: $(CDIR)/types.h
+gencode.o: $(CDIR)/assert.h
+gencode.o: $(CDIR)/data.h
+gencode.o: $(CDIR)/extern.h
+gencode.o: $(CDIR)/param.h
+gencode.o: $(CDIR)/result.h
+gencode.o: tables.h
+gencode.o: $(CDIR)/types.h
+glosym.o: $(CDIR)/glosym.h
+glosym.o: $(CDIR)/param.h
+glosym.o: tables.h
+glosym.o: $(CDIR)/types.h
+main.o: $(CDIR)/param.h
+move.o: $(CDIR)/assert.h
+move.o: $(CDIR)/data.h
+move.o: $(CDIR)/extern.h
+move.o: $(CDIR)/param.h
+move.o: $(CDIR)/result.h
+move.o: tables.h
+move.o: $(CDIR)/types.h
+nextem.o: $(CDIR)/assert.h
+nextem.o: $(CDIR)/data.h
+nextem.o: $(CDIR)/extern.h
+nextem.o: $(CDIR)/param.h
+nextem.o: $(CDIR)/result.h
+nextem.o: tables.h
+nextem.o: $(CDIR)/types.h
+reg.o: $(CDIR)/assert.h
+reg.o: $(CDIR)/data.h
+reg.o: $(CDIR)/extern.h
+reg.o: $(CDIR)/param.h
+reg.o: $(CDIR)/result.h
+reg.o: tables.h
+reg.o: $(CDIR)/types.h
+regvar.o: $(CDIR)/assert.h
+regvar.o: $(CDIR)/data.h
+regvar.o: $(CDIR)/extern.h
+regvar.o: $(CDIR)/param.h
+regvar.o: $(CDIR)/regvar.h
+regvar.o: $(CDIR)/result.h
+regvar.o: tables.h
+regvar.o: $(CDIR)/types.h
+salloc.o: $(CDIR)/assert.h
+salloc.o: $(CDIR)/data.h
+salloc.o: $(CDIR)/extern.h
+salloc.o: $(CDIR)/param.h
+salloc.o: $(CDIR)/result.h
+salloc.o: tables.h
+salloc.o: $(CDIR)/types.h
+state.o: $(CDIR)/assert.h
+state.o: $(CDIR)/data.h
+state.o: $(CDIR)/extern.h
+state.o: $(CDIR)/param.h
+state.o: $(CDIR)/result.h
+state.o: $(CDIR)/state.h
+state.o: tables.h
+state.o: $(CDIR)/types.h
+subr.o: $(CDIR)/assert.h
+subr.o: $(CDIR)/data.h
+subr.o: $(CDIR)/extern.h
+subr.o: $(CDIR)/param.h
+subr.o: $(CDIR)/result.h
+subr.o: tables.h
+subr.o: $(CDIR)/types.h
+var.o: $(CDIR)/data.h
+var.o: $(CDIR)/param.h
+var.o: $(CDIR)/result.h
+var.o: tables.h
+var.o: $(CDIR)/types.h
diff --git a/mach/z80/int/Makefile b/mach/z80/int/Makefile
new file mode 100644
index 00000000..179c4658
--- /dev/null
+++ b/mach/z80/int/Makefile
@@ -0,0 +1,44 @@
+EMHOME=../../..
+SRC = em.s atof.s fpp.s mli4.s dvu4.s dvi4.s eb.s
+OBJ = em.o atof.o fpp.o mli4.o dvu4.o dvi4.o eb.o
+DLSRC = dl.c dlbin.c
+LIBOBJ = $(EMHOME)/modules/lib/libobject.a
+LDFLAGS =
+
+CFLAGS = -O -I$(EMHOME)/h
+
+.s.o:
+ z80 -c -I$(EMHOME)/h $*.s
+
+all: int.hex dl dlbin cv
+
+install: all
+ @echo "nothing is installed"
+
+cmp: all
+ @echo "nothing is compared"
+
+clean:
+ rm -f *.o a.out dl dlbin *.hex cv
+
+pr:
+ @pr Makefile $(SRC) $(DLSRC) cv.c
+
+opr:
+ make pr | opr
+
+a.out: $(OBJ)
+ $(EMHOME)/lib/em_led -b0:0x100 -a0:2 -a1:2 -a2:2 -a3:2 $(OBJ)
+
+int.hex: a.out dlbin
+ ./dlbin a.out > int.hex
+ ./dosort int.hex
+
+dl: dl.o
+ $(CC) $(LDFLAGS) -o dl dl.o
+
+dlbin: dlbin.o
+ $(CC) $(LDFLAGS) -o dlbin dlbin.o $(LIBOBJ)
+
+cv: cv.o
+ $(CC) $(LDFLAGS) -o cv cv.o
diff --git a/mach/z80/int/dlbin.c b/mach/z80/int/dlbin.c
new file mode 100644
index 00000000..bdf6fc7e
--- /dev/null
+++ b/mach/z80/int/dlbin.c
@@ -0,0 +1,167 @@
+/*
+ * Download Z80 load module into the RC702
+ *
+ * Adapted (untested) to new ack.out format by
+ * Ceriel Jacobs, Vrije Universiteit, Amsterdam
+ */
+#include
+#include
+#include
+
+int disp = 0;
+
+char hex[] = "0123456789ABCDEF";
+
+#define DATTYPE 0
+#define EOFTYPE 1
+#define SEGTYPE 2
+#define PCTYPE 3
+
+#define MAXBYTE 32
+
+char *progname;
+
+struct outhead ohead;
+struct outsect sect[MAXSECT];
+
+long pc;
+
+main(argc,argv) char **argv; {
+ register unsigned nd;
+ register char *s;
+ int first = 1;
+ int i;
+
+ progname = argv[0];
+ while (argc > 1 && argv[1][0] == '-') {
+ switch (argv[1][1]) {
+ case 'd':
+ /* displacement at load time */
+ disp = atoi(&argv[1][2]);
+ break;
+ }
+ argc--;
+ argv++;
+ }
+ s = "a.out";
+ if (argc == 2)
+ s = argv[1];
+ else if (argc != 1) {
+ fprintf(stderr,"usage: %s [flags] [object file]\n",progname);
+ exit(-1);
+ }
+ if (! rd_open(s)) {
+ fprintf(stderr,"%s: can't open %s\n",progname,s);
+ exit(-1);
+ }
+ rd_ohead(&ohead);
+ if (ohead.oh_flags & HF_LINK) {
+ fprintf(stderr,"%s: %s contains unresolved references\n",progname,s);
+ exit(-1);
+ }
+ rd_sect(sect, ohead.oh_nsect);
+ for (i = 0; i < ohead.oh_nsect; i++) {
+ rd_outsect(i);
+ pc = sect[i].os_base;
+ if (first) {
+ first = 0;
+ putchar('L');
+ putchar('S');
+ }
+ segment(i);
+ while (sect[i].os_size) {
+ unsigned int sz = 8096, fl;
+ extern char *calloc();
+ register char *buf;
+ char *pbuf;
+
+ if (sz > sect[i].os_size) sz = sect[i].os_size;
+ sect[i].os_size -= sz;
+ pbuf = buf = calloc(sz, 1);
+ if (fl = sect[i].os_flen) {
+ if (fl > sz) fl = sz;
+ sect[i].os_flen -= fl;
+
+ rd_emit(buf, (long) fl);
+ }
+ while (sz >= MAXBYTE) {
+ data(MAXBYTE, (int) pc, buf);
+ sz -= MAXBYTE;
+ buf += MAXBYTE;
+ pc += MAXBYTE;
+ }
+ if (sz > 0) {
+ data(sz, (int) pc, buf);
+ }
+ free(pbuf);
+ }
+ }
+ if (first == 0) eof();
+ exit(0);
+}
+
+segment(sg) {
+
+ newline(2,0,SEGTYPE);
+ word(sg);
+ endline();
+}
+
+data(nd,pc,buf)
+ register char *buf;
+ int pc;
+{
+ register i;
+
+ newline(nd, pc+disp, DATTYPE);
+ for (i = 0; i < nd; i++) {
+ byte(*buf++);
+ }
+ endline();
+}
+
+int check, bytecount;
+
+newline(n,pc,typ) {
+
+ check = 0;
+ bytecount = n+5;
+ putchar('\n'); /* added instruction */
+ putchar(':');
+ byte(n);
+ word(pc);
+ byte(typ);
+}
+
+endline() {
+
+ byte(-check);
+ assert(bytecount == 0);
+}
+
+word(w) {
+
+ byte(w>>8);
+ byte(w);
+}
+
+byte(b) {
+
+ check += b;
+ bytecount--;
+ putchar(hex[(b>>4) & 017]);
+ putchar(hex[b & 017]);
+}
+
+rd_fatal()
+{
+ fprintf(stderr, "%s: Read error\n", progname);
+ exit(-1);
+}
+
+eof() {
+
+ newline(0,0,EOFTYPE);
+ byte(0xFF);
+ putchar('\n');
+}
diff --git a/mach/z80/int/int22 b/mach/z80/int/int22
new file mode 100644
index 00000000..62e8802e
--- /dev/null
+++ b/mach/z80/int/int22
@@ -0,0 +1,31 @@
+# $Revision$
+var w=2
+var p=2
+var s=2
+var l=4
+var f=4
+var d=4
+var M=int
+var NAME=int22
+var LIB=lib/int22/tail_
+var RT=lib/int22/head_
+var SIZE_FLAG=-sm
+var CPP_F=-DCPM=CPM
+var INCLUDES=-I{EM}/include/_tail_cc -I{EM}/include/_tail_mon
+name asld
+ from .k.m.a.g
+ to .out
+ outfile e.out
+ program {EM}/lib/em_ass
+ mapflag -l* LNAME={EM}/{LIB}*
+ mapflag -+* ASS_F={ASS_F?} -+*
+ mapflag --* ASS_F={ASS_F?} --*
+ mapflag -s* SIZE_FLAG=-s*
+ args {SIZE_FLAG} \
+ ({RTS}:.b.c={EM}/{RT}cc) ({RTS}:.p={EM}/{RT}pc) -o > < \
+ (.p:{TAIL}={EM}/{LIB}pc) \
+ (.b:{TAIL}={EM}/{LIB}bc) \
+ (.b.c:{TAIL}={EM}/{LIB}cc.1s {EM}/{LIB}cc.2g) \
+ (.b.c.p:{TAIL}={EM}/{LIB}mon)
+ linker
+end
diff --git a/mach/z80/libem/Makefile b/mach/z80/libem/Makefile
new file mode 100644
index 00000000..3529a29a
--- /dev/null
+++ b/mach/z80/libem/Makefile
@@ -0,0 +1,29 @@
+# $Header$
+MACH=z80
+all: libem_o.a end.o
+
+install: all
+ ../../install end.o end_em
+ ../../install libem_o.a tail_em
+
+
+cmp: all
+ -../../compare end.o end_em
+ -../../compare libem_o.a tail_em
+
+libem_o.a: libem_s.a
+ ASAR=aal ; export ASAR ;\
+ march . libem_o.a
+
+end.o: end.s
+ $(MACH) -I../../../h -c end.s
+
+clean:
+ rm -f *.o libem_o.a
+
+opr :
+ make pr | opr
+
+pr:
+ @pr `pwd`/end.s
+ @arch pv libem_s.a | pr -h `pwd`/libem_s.a
diff --git a/mach/z80/libem/compmodule b/mach/z80/libem/compmodule
new file mode 100755
index 00000000..ec9d18f3
--- /dev/null
+++ b/mach/z80/libem/compmodule
@@ -0,0 +1,4 @@
+if z80 -c $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi
diff --git a/mach/z80/libem/end.s b/mach/z80/libem/end.s
new file mode 100644
index 00000000..6b9ce418
--- /dev/null
+++ b/mach/z80/libem/end.s
@@ -0,0 +1,17 @@
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define endtext,enddata,endbss
+.define _end,_etext,_edata
+
+ ! $Header$
+ .sect .text
+endtext:
+_etext:
+ .align 2
+ .sect .data
+enddata:
+_edata:
+ .align 2
+.sect .endsect
+_end:
+endbss:
+ .align 2
diff --git a/mach/z80/libem/pstrng.s b/mach/z80/libem/pstrng.s
new file mode 100644
index 00000000..d9ebc558
--- /dev/null
+++ b/mach/z80/libem/pstrng.s
@@ -0,0 +1,21 @@
+.define pstrng
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+
+
+! print a string of characters to the console
+! entry: DE points to string
+! string terminator is 0x00
+! exit: DE points to string terminator
+pstrng: push af
+1: ld a,(de)
+ or a
+ jr z,2f
+ call putchar
+ inc de
+ jr 1b
+2: pop af
+ ret
diff --git a/mach/z80/libem/tail.s b/mach/z80/libem/tail.s
new file mode 100644
index 00000000..aead4997
--- /dev/null
+++ b/mach/z80/libem/tail.s
@@ -0,0 +1,15 @@
+.define endtext,enddata,endbss
+.define _end,_etext,_edata
+
+ .text
+endtext:
+_etext:
+ .align 2
+ .data
+enddata:
+_edata:
+ .align 2
+ .bss
+_end:
+endbss:
+ .align 2
diff --git a/mach/z80/libmon/Makefile b/mach/z80/libmon/Makefile
new file mode 100644
index 00000000..f7baeca8
--- /dev/null
+++ b/mach/z80/libmon/Makefile
@@ -0,0 +1,50 @@
+TAIL=libhermac_o.a
+# Other possibilities are: tail.nascom and tail.cpm
+MACH=z80
+
+all: head_em.o libhermac_o.a libnascom_o.a libcpm_o.a
+
+install: head_em.o $(TAIL)
+ ../../install head_em.o head_em
+ ../../install $(TAIL) tail_sys
+
+cmp: head_em.o $(TAIL)
+ -../../compare head_em.o head_em
+ -../../compare $(TAIL) tail_sys
+
+head_em.o: head_em.s
+ $(MACH) -I../../../h -c head_em.s
+
+libcpm_o.a: libcpm_s.a
+ ASAR=aal ; export ASAR; march . libcpm_o.a
+
+libnascom_o.a: libnascom_s.a
+ ASAR=aal ; export ASAR; march . libnascom_o.a
+
+libhermac_o.a: libhermac_s.a
+ ASAR=aal ; export ASAR; march . libhermac_o.a
+
+libcpm_s.a:
+ @echo Warning: untested, this is an example
+ arch cr libcpm_s.a mon.cpm.s
+ echo libcpm_s.a > LIST
+ arch t libcpm_s.a >> LIST
+
+libnascom_s.a:
+ arch cr libnascom_s.a mon.s char.nas.s
+ echo libnascom_s.a > LIST
+ arch t libnascom_s.a >> LIST
+
+libhermac_s.a:
+ arch cr libhermac_s.a mon.s char.her.s
+ echo libhermac_s.a > LIST
+ arch t libhermac_s.a >> LIST
+
+clean:
+ rm -f *.o *_o.a out nohup.out Out
+
+opr:
+ make pr | opr
+pr:
+ @pr `pwd`/Makefile `pwd`/head_em.s
+ @pr `pwd`/mon.s `pwd`/mon.cpm.s `pwd`/char.nas.s `pwd`/char.her.s
diff --git a/mach/z80/libmon/compmodule b/mach/z80/libmon/compmodule
new file mode 100755
index 00000000..97ebc569
--- /dev/null
+++ b/mach/z80/libmon/compmodule
@@ -0,0 +1,4 @@
+if z80 -c -L $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi
diff --git a/mach/z80/libmon/putchr.nas.s b/mach/z80/libmon/putchr.nas.s
new file mode 100644
index 00000000..e66a6891
--- /dev/null
+++ b/mach/z80/libmon/putchr.nas.s
@@ -0,0 +1,33 @@
+.define putchr
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+! output routine in monitor
+CRT = 0x013B
+! output a charcter
+! entry: ascii character in a
+putchr:
+ push hl
+ push bc
+ ld hl,tab
+ ld b,5
+1: cp (hl)
+ jr z,fetch
+ inc hl
+ inc hl
+ djnz 1b
+2: call CRT
+ pop bc
+ pop hl
+ ret
+fetch: inc hl
+ ld a,(hl)
+ jr 2b
+! conversion table for nascom characters
+tab: .data1 0x0D,0x00
+ .data1 0x1B,0x1E
+ .data1 0x08,0x1D
+ .data1 0x0A,0x1F
+ .data1 0x7F,0x00
diff --git a/mach/z80/libmon/putchr.s b/mach/z80/libmon/putchr.s
new file mode 100644
index 00000000..898db469
--- /dev/null
+++ b/mach/z80/libmon/putchr.s
@@ -0,0 +1,26 @@
+.define putchr
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+
+putchr:
+ push hl
+ push de
+ push bc
+ cp 0x0A
+ jr nz,1f
+ ld a,0x1F
+1:
+ ld c,a
+2:
+ in a,0xF1
+ and 4
+ jr z,2b
+ ld a,c
+ out 0xF0,a
+ pop bc
+ pop de
+ pop hl
+ ret
diff --git a/mach/z80/libmon/subr.s b/mach/z80/libmon/subr.s
new file mode 100644
index 00000000..d82ca4f9
--- /dev/null
+++ b/mach/z80/libmon/subr.s
@@ -0,0 +1,202 @@
+.define _read,_write,_ioctl,_getpid,_open,_close,_exit,_errno
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_read:
+ ld (savebc),bc
+ push af
+ pop bc
+ ld (saveaf),bc ! save all registers in savereg
+ ld (savede),de
+ ld (savehl),hl
+ ld (saveix),ix
+ ex (sp),hl ! return address in hl
+ pop bc ! skip return address
+ pop bc ! get fd
+ ld a,b ! check fd = 0
+ or c
+ jr nz,errrd
+ pop de ! get buffer
+ pop bc ! get count
+ ld ix,0 ! reset counter
+ push bc
+ push de
+ push ix
+ push hl ! return address
+ ex de,hl ! buffer to hl
+1: ld a,b
+ or c
+ jr z,done ! done if count = 0
+ call getchr
+ ld (hl),a
+ inc hl ! increment pointer
+ inc ix ! increment char counter
+ dec bc ! decrement count
+ cp 0xA
+ jr nz,1b ! done if char = CR
+done:
+ ld bc,(saveaf)
+ push bc
+ pop af
+ ld bc,(savebc)
+ ld de,(savede)
+ ld hl,(savehl)
+ ld ix,(saveix)
+ ret
+errrd:
+ push bc
+ push hl ! return address
+ ld bc,(saveaf)
+ push bc
+ pop af
+ ld bc,(savebc)
+ ld de,(savede)
+ ld hl,(savehl)
+ ld ix,(saveix)
+ ld ix,-1
+ ret
+
+_write:
+ ld (savebc),bc
+ push af
+ pop bc
+ ld (saveaf),bc ! save all registers in savereg
+ ld (savede),de
+ ld (savehl),hl
+ ld (saveix),ix
+ ex (sp),hl ! return address in hl
+ pop de ! skip return address
+ pop de ! get fd
+ ld a,e ! check for fd = 1
+ cp 1
+ jr nz,errwr
+ ld a,d
+ or a
+ jr nz,errwr
+ pop de ! buffer in de
+ pop bc ! count in bc
+ push bc
+ push de
+ push de
+ push hl
+ ex de,hl ! buffer in hl
+ ld e,c
+ ld d,b ! count also in de
+1: ld a,b
+ or c
+ jr z,exit
+ ld a,(hl)
+ call putchr
+ inc hl
+ dec bc
+ jr 1b
+errwr:
+ push de
+ push hl
+ ld bc,(saveaf)
+ push bc
+ pop af
+ ld bc,(savebc)
+ ld de,(savede)
+ ld hl,(savehl)
+ ld ix,(saveix)
+ ld ix,-1 ! error in fd
+ ret
+exit:
+ push de ! count on stack
+ ld bc,(saveaf)
+ push bc
+ pop af
+ ld bc,(savebc)
+ ld de,(savede)
+ ld hl,(savehl)
+ ld ix,(saveix)
+ pop ix ! return count to caller
+ ret
+
+_ioctl:
+ ret
+_getpid:
+ ret
+
+! open return a file descriptor (0,1,2)
+! depending on 'mode'
+! mode 2 doesn't work!!
+_open:
+ ld (savebc),bc
+ push af
+ pop bc
+ ld (saveaf),bc ! save all registers in savereg
+ ld (savede),de
+ ld (savehl),hl
+ ld (saveix),ix
+ pop bc ! return address
+ pop de ! name pointer
+ pop ix ! mode (0 for read,
+ ! 1 for write)
+ push ix
+ push de
+ push bc
+ ld bc,(saveaf)
+ push bc
+ pop af
+ ld bc,(savebc)
+ ld de,(savede)
+ ld hl,(savehl)
+ ld ix,(saveix)
+ ret ! return fd = 0 for read
+ ! fd = 1 for write
+
+_close:
+ ld ix,0 ! return succes
+ ret
+_exit:
+jp 0x38
+.sect .data
+_errno:
+ .data2 0
+! output routine in monitor
+CRT = 0x013B
+! output a charcter
+! entry: ascii character in a
+.sect .text
+!putchr:
+! push hl
+! push bc
+! ld hl,tab
+! ld b,5
+!1: cp (hl)
+! jr z,fetch
+! inc hl
+! inc hl
+! djnz 1b
+!2: call CRT
+! pop bc
+! pop hl
+! ret
+!fetch: inc hl
+! ld a,(hl)
+! jr 2b
+!! conversion table for nascom characters
+!tab: .data1 0x0D,0x00
+! .data1 0x1B,0x1E
+! .data1 0x08,0x1D
+! .data1 0x0A,0x1F
+! .data1 0x7F,0x00
+
+KBD = 0x69
+! get character from keyboard
+getchr:
+ call KBD
+ jr nc,getchr
+ cp 0x1F
+ jr z,CR
+ cp 0x1D
+ jr z,BS
+ ret
+CR: ld a,0xA
+ ret
+BS: ld a,0x8
+ ret
diff --git a/mach/z80/libsys/Makefile b/mach/z80/libsys/Makefile
new file mode 100644
index 00000000..f7baeca8
--- /dev/null
+++ b/mach/z80/libsys/Makefile
@@ -0,0 +1,50 @@
+TAIL=libhermac_o.a
+# Other possibilities are: tail.nascom and tail.cpm
+MACH=z80
+
+all: head_em.o libhermac_o.a libnascom_o.a libcpm_o.a
+
+install: head_em.o $(TAIL)
+ ../../install head_em.o head_em
+ ../../install $(TAIL) tail_sys
+
+cmp: head_em.o $(TAIL)
+ -../../compare head_em.o head_em
+ -../../compare $(TAIL) tail_sys
+
+head_em.o: head_em.s
+ $(MACH) -I../../../h -c head_em.s
+
+libcpm_o.a: libcpm_s.a
+ ASAR=aal ; export ASAR; march . libcpm_o.a
+
+libnascom_o.a: libnascom_s.a
+ ASAR=aal ; export ASAR; march . libnascom_o.a
+
+libhermac_o.a: libhermac_s.a
+ ASAR=aal ; export ASAR; march . libhermac_o.a
+
+libcpm_s.a:
+ @echo Warning: untested, this is an example
+ arch cr libcpm_s.a mon.cpm.s
+ echo libcpm_s.a > LIST
+ arch t libcpm_s.a >> LIST
+
+libnascom_s.a:
+ arch cr libnascom_s.a mon.s char.nas.s
+ echo libnascom_s.a > LIST
+ arch t libnascom_s.a >> LIST
+
+libhermac_s.a:
+ arch cr libhermac_s.a mon.s char.her.s
+ echo libhermac_s.a > LIST
+ arch t libhermac_s.a >> LIST
+
+clean:
+ rm -f *.o *_o.a out nohup.out Out
+
+opr:
+ make pr | opr
+pr:
+ @pr `pwd`/Makefile `pwd`/head_em.s
+ @pr `pwd`/mon.s `pwd`/mon.cpm.s `pwd`/char.nas.s `pwd`/char.her.s
diff --git a/mach/z80/libsys/compmodule b/mach/z80/libsys/compmodule
new file mode 100755
index 00000000..97ebc569
--- /dev/null
+++ b/mach/z80/libsys/compmodule
@@ -0,0 +1,4 @@
+if z80 -c -L $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi
diff --git a/mach/z80/libsys/putchr.nas.s b/mach/z80/libsys/putchr.nas.s
new file mode 100644
index 00000000..e66a6891
--- /dev/null
+++ b/mach/z80/libsys/putchr.nas.s
@@ -0,0 +1,33 @@
+.define putchr
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+! output routine in monitor
+CRT = 0x013B
+! output a charcter
+! entry: ascii character in a
+putchr:
+ push hl
+ push bc
+ ld hl,tab
+ ld b,5
+1: cp (hl)
+ jr z,fetch
+ inc hl
+ inc hl
+ djnz 1b
+2: call CRT
+ pop bc
+ pop hl
+ ret
+fetch: inc hl
+ ld a,(hl)
+ jr 2b
+! conversion table for nascom characters
+tab: .data1 0x0D,0x00
+ .data1 0x1B,0x1E
+ .data1 0x08,0x1D
+ .data1 0x0A,0x1F
+ .data1 0x7F,0x00
diff --git a/mach/z80/libsys/putchr.s b/mach/z80/libsys/putchr.s
new file mode 100644
index 00000000..898db469
--- /dev/null
+++ b/mach/z80/libsys/putchr.s
@@ -0,0 +1,26 @@
+.define putchr
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+
+putchr:
+ push hl
+ push de
+ push bc
+ cp 0x0A
+ jr nz,1f
+ ld a,0x1F
+1:
+ ld c,a
+2:
+ in a,0xF1
+ and 4
+ jr z,2b
+ ld a,c
+ out 0xF0,a
+ pop bc
+ pop de
+ pop hl
+ ret
diff --git a/mach/z80/libsys/subr.s b/mach/z80/libsys/subr.s
new file mode 100644
index 00000000..d82ca4f9
--- /dev/null
+++ b/mach/z80/libsys/subr.s
@@ -0,0 +1,202 @@
+.define _read,_write,_ioctl,_getpid,_open,_close,_exit,_errno
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_read:
+ ld (savebc),bc
+ push af
+ pop bc
+ ld (saveaf),bc ! save all registers in savereg
+ ld (savede),de
+ ld (savehl),hl
+ ld (saveix),ix
+ ex (sp),hl ! return address in hl
+ pop bc ! skip return address
+ pop bc ! get fd
+ ld a,b ! check fd = 0
+ or c
+ jr nz,errrd
+ pop de ! get buffer
+ pop bc ! get count
+ ld ix,0 ! reset counter
+ push bc
+ push de
+ push ix
+ push hl ! return address
+ ex de,hl ! buffer to hl
+1: ld a,b
+ or c
+ jr z,done ! done if count = 0
+ call getchr
+ ld (hl),a
+ inc hl ! increment pointer
+ inc ix ! increment char counter
+ dec bc ! decrement count
+ cp 0xA
+ jr nz,1b ! done if char = CR
+done:
+ ld bc,(saveaf)
+ push bc
+ pop af
+ ld bc,(savebc)
+ ld de,(savede)
+ ld hl,(savehl)
+ ld ix,(saveix)
+ ret
+errrd:
+ push bc
+ push hl ! return address
+ ld bc,(saveaf)
+ push bc
+ pop af
+ ld bc,(savebc)
+ ld de,(savede)
+ ld hl,(savehl)
+ ld ix,(saveix)
+ ld ix,-1
+ ret
+
+_write:
+ ld (savebc),bc
+ push af
+ pop bc
+ ld (saveaf),bc ! save all registers in savereg
+ ld (savede),de
+ ld (savehl),hl
+ ld (saveix),ix
+ ex (sp),hl ! return address in hl
+ pop de ! skip return address
+ pop de ! get fd
+ ld a,e ! check for fd = 1
+ cp 1
+ jr nz,errwr
+ ld a,d
+ or a
+ jr nz,errwr
+ pop de ! buffer in de
+ pop bc ! count in bc
+ push bc
+ push de
+ push de
+ push hl
+ ex de,hl ! buffer in hl
+ ld e,c
+ ld d,b ! count also in de
+1: ld a,b
+ or c
+ jr z,exit
+ ld a,(hl)
+ call putchr
+ inc hl
+ dec bc
+ jr 1b
+errwr:
+ push de
+ push hl
+ ld bc,(saveaf)
+ push bc
+ pop af
+ ld bc,(savebc)
+ ld de,(savede)
+ ld hl,(savehl)
+ ld ix,(saveix)
+ ld ix,-1 ! error in fd
+ ret
+exit:
+ push de ! count on stack
+ ld bc,(saveaf)
+ push bc
+ pop af
+ ld bc,(savebc)
+ ld de,(savede)
+ ld hl,(savehl)
+ ld ix,(saveix)
+ pop ix ! return count to caller
+ ret
+
+_ioctl:
+ ret
+_getpid:
+ ret
+
+! open return a file descriptor (0,1,2)
+! depending on 'mode'
+! mode 2 doesn't work!!
+_open:
+ ld (savebc),bc
+ push af
+ pop bc
+ ld (saveaf),bc ! save all registers in savereg
+ ld (savede),de
+ ld (savehl),hl
+ ld (saveix),ix
+ pop bc ! return address
+ pop de ! name pointer
+ pop ix ! mode (0 for read,
+ ! 1 for write)
+ push ix
+ push de
+ push bc
+ ld bc,(saveaf)
+ push bc
+ pop af
+ ld bc,(savebc)
+ ld de,(savede)
+ ld hl,(savehl)
+ ld ix,(saveix)
+ ret ! return fd = 0 for read
+ ! fd = 1 for write
+
+_close:
+ ld ix,0 ! return succes
+ ret
+_exit:
+jp 0x38
+.sect .data
+_errno:
+ .data2 0
+! output routine in monitor
+CRT = 0x013B
+! output a charcter
+! entry: ascii character in a
+.sect .text
+!putchr:
+! push hl
+! push bc
+! ld hl,tab
+! ld b,5
+!1: cp (hl)
+! jr z,fetch
+! inc hl
+! inc hl
+! djnz 1b
+!2: call CRT
+! pop bc
+! pop hl
+! ret
+!fetch: inc hl
+! ld a,(hl)
+! jr 2b
+!! conversion table for nascom characters
+!tab: .data1 0x0D,0x00
+! .data1 0x1B,0x1E
+! .data1 0x08,0x1D
+! .data1 0x0A,0x1F
+! .data1 0x7F,0x00
+
+KBD = 0x69
+! get character from keyboard
+getchr:
+ call KBD
+ jr nc,getchr
+ cp 0x1F
+ jr z,CR
+ cp 0x1D
+ jr z,BS
+ ret
+CR: ld a,0xA
+ ret
+BS: ld a,0x8
+ ret
diff --git a/mach/z8000/as/Makefile b/mach/z8000/as/Makefile
new file mode 100644
index 00000000..7455a482
--- /dev/null
+++ b/mach/z8000/as/Makefile
@@ -0,0 +1,67 @@
+# $Header$
+EMHOME = ../../..
+h = $(EMHOME)/h
+LIBOBJ = $(EMHOME)/modules/lib/libobject.a
+CDIR = $(EMHOME)/mach/proto/as
+CPP = $(EMHOME)/lib/cpp
+DEF =
+
+FFLAG =
+INCL = -I. -I$h $(DEF)
+CFLAGS = $(FFLAG) -O $(INCL)
+YFLAGS = -d
+LDFLAGS = $(FFLAG)
+
+CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
+ $(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
+COBJ = comm3.o comm4.o comm5.o \
+ comm6.o comm7.o comm8.o
+MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
+COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
+
+all: as
+
+install:all
+ ../../install as
+
+cmp:
+ -../../compare as
+
+clean:
+ rm -f *.o as as.[cy] y.tab.h
+
+pr: $(MACH)
+ @pr -n $(MACH)
+
+opr:
+ make pr | opr
+as: $(COBJ) as.o
+ $(CC) $(LDFLAGS) $(COBJ) as.o $(LIBOBJ) -o as
+
+as.y: $(CDIR)/comm2.y
+ $(CPP) -P -I. -I$h $(DEF) $(CDIR)/comm2.y >as.y
+ -@if test -f Expect ; then cat Expect ; else echo "expect 1 shift/reduce conflict"; fi
+
+lint: $(CSRC) as.c
+ lint $(INCL) $(CSRC) as.c
+
+y.tab.h: as.c
+$(COBJ): y.tab.h
+$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
+$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
+as.y: mach2.c
+comm3.o: mach3.c
+as.y: mach4.c
+comm8.o: mach5.c
+comm3.o: $(CDIR)/comm3.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm3.c
+comm4.o: $(CDIR)/comm4.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm4.c
+comm5.o: $(CDIR)/comm5.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm5.c
+comm6.o: $(CDIR)/comm6.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm6.c
+comm7.o: $(CDIR)/comm7.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm7.c
+comm8.o: $(CDIR)/comm8.c
+ $(CC) -c $(CFLAGS) $(CDIR)/comm8.c
diff --git a/mach/z8000/cg/Makefile b/mach/z8000/cg/Makefile
new file mode 100644
index 00000000..22f5f603
--- /dev/null
+++ b/mach/z8000/cg/Makefile
@@ -0,0 +1,184 @@
+# $Header$
+
+EMHOME=../../..
+PREFLAGS=-I$(EMHOME)/h -I. -I$(EMHOME)/mach -I$(EMHOME)/modules/h -DNDEBUG
+PFLAGS=
+CFLAGS=$(PREFLAGS) $(PFLAGS) -O
+LDFLAGS=$(PFLAGS)
+LINTOPTS=-hbxac
+LIBS=$(EMHOME)/lib/em_data.a $(EMHOME)/modules/lib/libflt.a
+CDIR=$(EMHOME)/mach/proto/cg
+CFILES=$(CDIR)/codegen.c $(CDIR)/compute.c $(CDIR)/equiv.c $(CDIR)/fillem.c \
+ $(CDIR)/gencode.c $(CDIR)/glosym.c $(CDIR)/main.c $(CDIR)/move.c \
+ $(CDIR)/nextem.c $(CDIR)/reg.c $(CDIR)/regvar.c $(CDIR)/salloc.c \
+ $(CDIR)/state.c $(CDIR)/subr.c $(CDIR)/var.c
+OFILES=codegen.o compute.o equiv.o fillem.o gencode.o glosym.o main.o\
+ move.o nextem.o reg.o regvar.o salloc.o state.o subr.o var.o
+
+all: tables.c
+ make "EMHOME="$(EMHOME) cg
+
+cg: tables.o $(OFILES)
+ $(CC) $(LDFLAGS) $(OFILES) tables.o $(LIBS) -o cg
+
+tables.o: tables.c
+ $(CC) -c $(PREFLAGS) -I$(CDIR) tables.c
+
+codegen.o: $(CDIR)/codegen.c
+ $(CC) -c $(CFLAGS) $(CDIR)/codegen.c
+compute.o: $(CDIR)/compute.c
+ $(CC) -c $(CFLAGS) $(CDIR)/compute.c
+equiv.o: $(CDIR)/equiv.c
+ $(CC) -c $(CFLAGS) $(CDIR)/equiv.c
+fillem.o: $(CDIR)/fillem.c
+ $(CC) -c $(CFLAGS) $(CDIR)/fillem.c
+gencode.o: $(CDIR)/gencode.c
+ $(CC) -c $(CFLAGS) $(CDIR)/gencode.c
+glosym.o: $(CDIR)/glosym.c
+ $(CC) -c $(CFLAGS) $(CDIR)/glosym.c
+main.o: $(CDIR)/main.c
+ $(CC) -c $(CFLAGS) $(CDIR)/main.c
+move.o: $(CDIR)/move.c
+ $(CC) -c $(CFLAGS) $(CDIR)/move.c
+nextem.o: $(CDIR)/nextem.c
+ $(CC) -c $(CFLAGS) $(CDIR)/nextem.c
+reg.o: $(CDIR)/reg.c
+ $(CC) -c $(CFLAGS) $(CDIR)/reg.c
+regvar.o: $(CDIR)/regvar.c
+ $(CC) -c $(CFLAGS) $(CDIR)/regvar.c
+salloc.o: $(CDIR)/salloc.c
+ $(CC) -c $(CFLAGS) $(CDIR)/salloc.c
+state.o: $(CDIR)/state.c
+ $(CC) -c $(CFLAGS) $(CDIR)/state.c
+subr.o: $(CDIR)/subr.c
+ $(CC) -c $(CFLAGS) $(CDIR)/subr.c
+var.o: $(CDIR)/var.c
+ $(CC) -c $(CFLAGS) $(CDIR)/var.c
+
+install: all
+ ../../install cg
+
+cmp: all
+ -../../compare cg
+
+distr: tables.c
+ rm -f tables1.[ch]
+ cp tables.c tables1.c
+ cp tables.h tables1.h
+ chmod -w tables1.[ch]
+
+
+tables.c: table
+ -mv tables.h tables.h.save
+ $(EMHOME)/lib/cpp -P table | $(EMHOME)/lib/cgg > debug.out
+ -if cmp -s tables.h.save tables.h; then mv tables.h.save tables.h; else exit 0; fi
+ -if cmp -s /dev/null tables.h; then mv tables.h.save tables.h; else exit 0; fi
+
+lint: $(CFILES)
+ lint $(LINTOPTS) $(PREFLAGS) $(CFILES)
+clean:
+ rm -f *.o tables.c tables.h debug.out cg tables.h.save
+
+codegen.o: $(CDIR)/assert.h
+codegen.o: $(CDIR)/data.h
+codegen.o: $(CDIR)/equiv.h
+codegen.o: $(CDIR)/extern.h
+codegen.o: $(CDIR)/param.h
+codegen.o: $(CDIR)/result.h
+codegen.o: $(CDIR)/state.h
+codegen.o: tables.h
+codegen.o: $(CDIR)/types.h
+compute.o: $(CDIR)/assert.h
+compute.o: $(CDIR)/data.h
+compute.o: $(CDIR)/extern.h
+compute.o: $(CDIR)/glosym.h
+compute.o: $(CDIR)/param.h
+compute.o: $(CDIR)/result.h
+compute.o: tables.h
+compute.o: $(CDIR)/types.h
+equiv.o: $(CDIR)/assert.h
+equiv.o: $(CDIR)/data.h
+equiv.o: $(CDIR)/equiv.h
+equiv.o: $(CDIR)/extern.h
+equiv.o: $(CDIR)/param.h
+equiv.o: $(CDIR)/result.h
+equiv.o: tables.h
+equiv.o: $(CDIR)/types.h
+fillem.o: $(CDIR)/assert.h
+fillem.o: $(CDIR)/data.h
+fillem.o: $(CDIR)/extern.h
+fillem.o: mach.c
+fillem.o: mach.h
+fillem.o: $(CDIR)/param.h
+fillem.o: $(CDIR)/regvar.h
+fillem.o: $(CDIR)/result.h
+fillem.o: tables.h
+fillem.o: $(CDIR)/types.h
+gencode.o: $(CDIR)/assert.h
+gencode.o: $(CDIR)/data.h
+gencode.o: $(CDIR)/extern.h
+gencode.o: $(CDIR)/param.h
+gencode.o: $(CDIR)/result.h
+gencode.o: tables.h
+gencode.o: $(CDIR)/types.h
+glosym.o: $(CDIR)/glosym.h
+glosym.o: $(CDIR)/param.h
+glosym.o: tables.h
+glosym.o: $(CDIR)/types.h
+main.o: $(CDIR)/param.h
+move.o: $(CDIR)/assert.h
+move.o: $(CDIR)/data.h
+move.o: $(CDIR)/extern.h
+move.o: $(CDIR)/param.h
+move.o: $(CDIR)/result.h
+move.o: tables.h
+move.o: $(CDIR)/types.h
+nextem.o: $(CDIR)/assert.h
+nextem.o: $(CDIR)/data.h
+nextem.o: $(CDIR)/extern.h
+nextem.o: $(CDIR)/param.h
+nextem.o: $(CDIR)/result.h
+nextem.o: tables.h
+nextem.o: $(CDIR)/types.h
+reg.o: $(CDIR)/assert.h
+reg.o: $(CDIR)/data.h
+reg.o: $(CDIR)/extern.h
+reg.o: $(CDIR)/param.h
+reg.o: $(CDIR)/result.h
+reg.o: tables.h
+reg.o: $(CDIR)/types.h
+regvar.o: $(CDIR)/assert.h
+regvar.o: $(CDIR)/data.h
+regvar.o: $(CDIR)/extern.h
+regvar.o: $(CDIR)/param.h
+regvar.o: $(CDIR)/regvar.h
+regvar.o: $(CDIR)/result.h
+regvar.o: tables.h
+regvar.o: $(CDIR)/types.h
+salloc.o: $(CDIR)/assert.h
+salloc.o: $(CDIR)/data.h
+salloc.o: $(CDIR)/extern.h
+salloc.o: $(CDIR)/param.h
+salloc.o: $(CDIR)/result.h
+salloc.o: tables.h
+salloc.o: $(CDIR)/types.h
+state.o: $(CDIR)/assert.h
+state.o: $(CDIR)/data.h
+state.o: $(CDIR)/extern.h
+state.o: $(CDIR)/param.h
+state.o: $(CDIR)/result.h
+state.o: $(CDIR)/state.h
+state.o: tables.h
+state.o: $(CDIR)/types.h
+subr.o: $(CDIR)/assert.h
+subr.o: $(CDIR)/data.h
+subr.o: $(CDIR)/extern.h
+subr.o: $(CDIR)/param.h
+subr.o: $(CDIR)/result.h
+subr.o: tables.h
+subr.o: $(CDIR)/types.h
+var.o: $(CDIR)/data.h
+var.o: $(CDIR)/param.h
+var.o: $(CDIR)/result.h
+var.o: tables.h
+var.o: $(CDIR)/types.h
diff --git a/mach/z8000/libem/Makefile b/mach/z8000/libem/Makefile
new file mode 100644
index 00000000..b2c179d9
--- /dev/null
+++ b/mach/z8000/libem/Makefile
@@ -0,0 +1,21 @@
+all:
+
+install:
+ ../../install head_em.s head_em
+ ../../install libem_s.a tail_em
+ ../../install end.s end_em
+
+cmp:
+ -../../compare head_em.s head_em
+ -../../compare libem_s.a tail_em
+ -../../compare end.s end_em
+
+clean:
+
+opr :
+ make pr | opr
+
+pr:
+ @pr `pwd`/head_em.s
+ @arch pv libem_s.a | pr -h `pwd`/libem_s.a
+ @pr `pwd`/end.s
diff --git a/mach/z8000/libem/end.s b/mach/z8000/libem/end.s
new file mode 100644
index 00000000..37e1cef2
--- /dev/null
+++ b/mach/z8000/libem/end.s
@@ -0,0 +1,16 @@
+.define endtext,enddata,endbss,_etext,_edata,_end
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .end ! only for declaration of _end and endbss.
+
+ .sect .text
+endtext:
+_etext:
+ .sect .data
+enddata:
+_edata:
+ .sect .end
+_end:
+endbss:
diff --git a/mach/z8000/libem/head_em.s b/mach/z8000/libem/head_em.s
new file mode 100644
index 00000000..5be73c5f
--- /dev/null
+++ b/mach/z8000/libem/head_em.s
@@ -0,0 +1,62 @@
+.define EXIT, F_DUM
+.define ERANGE, ESET, EHEAP, EILLINS, EODDZ, ECASE, EBADMON
+.define hol0, trppc, trpim, reghp, argv, envp
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+
+EXIT = 0
+F_DUM = 0
+
+ERANGE = 1
+ESET = 2
+EHEAP = 17
+EILLINS = 18
+EODDZ = 19
+ECASE = 20
+EBADMON = 25
+
+.sect .text
+ !clear .sect .bss
+ ldk R2, $0
+ ld R3, $endbss
+ ld R0, R3
+ sub R0, $begbss
+ jr EQ, 1f
+ sra R0
+ push *RR2, $0
+ dec R0
+ jr EQ, 1f
+ ldl RR4, RR2
+ dec R5, $2
+ lddr *RR4, *RR2, R0
+1:
+ ldb RL0, $10 ! echo newline
+ sc $4
+ ldl RR14, $0
+ push *RR14, envp
+ push *RR14, argv
+ push *RR14, $1
+ calr __m_a_i_n
+ ldl RR14, $0xC00017FC
+ sc $0
+
+.sect .bss
+begbss:
+.sect .data
+hol0:
+ .data2 0,0 ! line no
+ .data2 0,0 ! file
+trppc:
+ .data2 0
+trpim:
+ .data2 0
+argv:
+envp:
+ .data2 1f
+ .data2 0
+1: .asciz "program"
+reghp:
+ .data2 endbss
diff --git a/mach/z8000/libem/mon.s b/mach/z8000/libem/mon.s
new file mode 100644
index 00000000..407a9c57
--- /dev/null
+++ b/mach/z8000/libem/mon.s
@@ -0,0 +1,88 @@
+.define mon
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+
+mon:
+ popl saveret, *RR14
+ pop R0, *RR14 ! iocode
+ cp R0, $1 ! exit
+ jr NE, read
+ inc R15, $2
+ sc $EXIT
+read: cp R0, $3 ! read
+ jr NE, write
+ pop R0, *RR14 ! dummy; all input from stdin
+ pop R1, *RR14 ! ptr to buffer
+ pop R2, *RR14 ! nr of bytes to be read
+ ld R3, R1
+ cp R2, $0
+ jr EQ, 6f
+1: sc $2 ! read character into RL0
+ cpb RL0, $004 ! \^D
+ jr EQ, 6f
+ cpb RL0, $015 ! \cr
+ jr NE, 2f
+ ldb RL0, $012
+2: sc $4 ! echo
+ cpb RL0, $010 ! \^H
+ jr NE, 3f
+ cp R1, R3
+ jr EQ, 5f
+ dec R1
+ jr 5f
+3: cpb RL0, $0100 ! \@
+ jr NE, 4f
+ ld R1, R3
+ ldb RL0, $012
+ sc $4
+ jr 5f
+4: ldb 0(R1), RL0
+ inc R1
+ cpb RL0, $012 ! \nl
+ jr EQ, 6f
+5: djnz R2, 1b
+6: sub R1, R3 ! nr of bytes read
+ push *RR14, R1
+ push *RR14, $0
+ jr retu
+write: cp R0, $4 ! write
+ jr NE, open
+ pop R0, *RR14 ! dummy; all output to stdout
+ pop R1, *RR14 ! ptr to buffer
+ pop R2, *RR14 ! nr of bytes to be written
+ ld R3, R2
+ cp R2, $0
+ jr EQ, 8f
+9: ld R0, $5000 ! counter to delay printing a little
+7: djnz R0, 7b
+ ldb RL0, 0(R1)
+ sc $4
+ inc R1
+ djnz R2, 9b
+8: sub R3, R2 ! nr of bytes written
+ push *RR14, R3
+ push *RR14, $0
+ jr retu
+open: cp R0, $5 ! open
+ jr close
+ jr NE, close
+ ld *RR14, $0
+ ld 2(R15), $0
+ jr retu
+close: cp R0, $6 ! close
+ jr NE, ioctl
+ ld *RR14, $0
+ jr retu
+ioctl: cp R0, $54 ! ioctl
+ jr NE, err
+ inc R15, $4
+ ld *RR14, $0
+retu: ldl RR2, saveret
+ jp *RR2
+err: push *RR14, saveret
+ push *RR14, $EBADMON
+ calr trp
+ ret
diff --git a/util/ego/lv/lv.c b/util/ego/lv/lv.c
index d60b3c31..9fe50bef 100644
--- a/util/ego/lv/lv.c
+++ b/util/ego/lv/lv.c
@@ -6,6 +6,7 @@
/* L I V E V A R I A B L E S A N A L Y S I S */
+#include
#include
#include
#include
@@ -40,6 +41,7 @@ short nrvars;
STATIC int Slv;
STATIC bool mesgflag = FALSE; /* Suppress generation of live/dead info */
+STATIC app_block();
STATIC clean_up()
{