fixup commit for branch 'unlabeled-2.6.1'

--HG--
branch : unlabeled-2.6.1
This commit is contained in:
cvs2hg
1984-10-23 15:04:25 +00:00
parent a4a5fc4bfa
commit 5ca4cd622f
454 changed files with 0 additions and 84787 deletions

View File

@@ -1,176 +0,0 @@
# $Header$
PREFLAGS=-I../../../h -I. -DNDEBUG
PFLAGS=
CFLAGS=$(PREFLAGS) $(PFLAGS) -O
LDFLAGS=-i $(PFLAGS)
LINTOPTS=-hbxac
LIBS=../../../lib/em_data.a
CDIR=../../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:
make tables.c
make 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
tables.c: table
../../../lib/cpp -P table | ../../../lib/cgg -htables.H > debug.out
-cmp -s tables.h tables.H || mv tables.H tables.h
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

View File

@@ -1,72 +0,0 @@
con_part(sz,w) register sz; word w; {
while (part_size % sz)
part_size++;
if (part_size == EM_WSIZE)
part_flush();
if (sz == 1) {
w &= 0xFF;
if (part_size)
w <<= 8;
part_word |= w;
} else {
assert(sz == 2);
part_word = w;
}
part_size += sz;
}
con_mult(sz) word sz; {
long l;
if (sz != 4)
fatal("bad icon/ucon size");
l = atol(str);
fprintf(codefile,".short\t%d\n",(int) l);
fprintf(codefile,".short\t%d\n",(int) (l >> 16));
}
con_float() {
fatal("no reals");
}
prolog(nlocals) full nlocals; {
fprintf(codefile,"\tjsr Pro\n");
if (nlocals == 0)
return;
else
fprintf(codefile,
"\tldx #[%d].h\n\tlda #[%d].l\n\tjsr Lcs\n",
nlocals, nlocals);
}
mes(type) word type; {
int argt ;
switch ( (int)type ) {
case ms_ext :
for (;;) {
switch ( argt=getarg(
ptyp(sp_cend)|ptyp(sp_pnam)|sym_ptyp) ) {
case sp_cend :
return ;
default:
strarg(argt) ;
fprintf(codefile,".define %s\n",argstr) ;
break ;
}
}
default :
while ( getarg(any_ptyp) != sp_cend ) ;
break ;
}
}
char *segname[] = {
".text", /* SEGTXT */
".data", /* SEGCON */
".data", /* SEGROM */
".bss" /* SEGBSS */
};

View File

@@ -1,26 +0,0 @@
/* $Header$ */
#define ex_ap(y) fprintf(codefile,".extern %s\n",y)
#define in_ap(y) /* nothing */
#define newilb(x) fprintf(codefile,"%s:\n",x)
#define newdlb(x) fprintf(codefile,"%s:\n",x)
#define dlbdlb(x,y) fprintf(codefile,"%s = %s\n",x,y)
#define newlbss(l,x) fprintf(codefile,"%s: .space\t%d\n",l,x);
#define cst_fmt "%d"
#define off_fmt "%d"
#define ilb_fmt "I%03x%x"
#define dlb_fmt "_%d"
#define hol_fmt "hol%d"
#define hol_off "%d+hol%d"
#define con_cst(x) fprintf(codefile,".word\t%d\n",x)
#define con_ilb(x) fprintf(codefile,".word\t%s\n",x)
#define con_dlb(x) fprintf(codefile,".word\t%s\n",x)
#define modhead ""
#define id_first '_'
#define BSS_INIT 0

File diff suppressed because it is too large Load Diff

View File

@@ -1,38 +0,0 @@
MAKEFILE=../../proto/libg/Makefile
MACHDEF="MACH=i86" "SUF=s"
STDIO="PREF=cc" "SUB=.1s" "SRC=lang/cem/libcc/stdio"
GEN="PREF=cc" "SUB=.2g" "SRC=lang/cem/libcc/gen"
MON="PREF=mon" "SRC=lang/cem/libcc/mon"
LIBDIR=../lib
install: cpstdio cpgen cpmon
cpstdio:
make -f $(MAKEFILE) $(STDIO) $(MACHDEF) tailcp
cpgen:
make -f $(MAKEFILE) $(GEN) $(MACHDEF) cp
cpmon:
make -f $(MAKEFILE) $(MON) $(MACHDEF) tailcp
cmp: cmpstdio cmpgen cmpmon
cmpstdio:
make -f $(MAKEFILE) $(STDIO) $(MACHDEF) tail
-cmp tail_cc.1s $(LIBDIR)/tail_cc.1s
cmpgen:
make -f $(MAKEFILE) $(GEN) $(MACHDEF) head
-cmp head_cc $(LIBDIR)/head_cc
make -f $(MAKEFILE) $(GEN) $(MACHDEF) tail
-cmp tail_cc.2g $(LIBDIR)/tail_cc.2g
cmpmon:
make -f $(MAKEFILE) $(MON) $(MACHDEF) tail
-cmp tail_mon $(LIBDIR)/tail_mon
clean:
-rm -f *.old *.[ce$(SUF)] tail* head*
opr:
make pr | opr
pr:
@pr Makefile

View File

@@ -1,223 +0,0 @@
#ifndef NORCSID
static char rcsid[] = "$Header$";
#endif
/*
* (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
*
*/
/*
* machine dependent back end routines for the Motorola 68000
*/
con_part(sz,w) register sz; word w; {
while (part_size % sz)
part_size++;
if (part_size == EM_WSIZE)
part_flush();
if (sz == 1) {
w &= 0xFF;
if (part_size == 0)
w <<= 8;
part_word |= w;
} else {
assert(sz == 2);
part_word = w;
}
part_size += sz;
}
con_mult(sz) word sz; {
if (sz != 4)
fatal("bad icon/ucon size");
fprintf(codefile,".long %s\n",str);
}
con_float() {
static int been_here;
if (argval != 4 && argval != 8)
fatal("bad fcon size");
fprintf(codefile,".long\t");
if (argval == 8)
fprintf(codefile,"F_DUM,");
fprintf(codefile,"F_DUM\n");
if ( !been_here++)
{
fprintf(stderr,"Warning : dummy float-constant(s)\n");
}
}
#ifdef REGVARS
regscore(off,size,typ,score,totyp)
long off;
{
if (score == 0) return -1;
switch(typ) {
case reg_float:
return -1;
case reg_pointer:
if (size != 4 || totyp != reg_pointer) return -1;
score *= 2;
break;
case reg_loop:
score += 5;
/* fall through .. */
case reg_any:
if (size != 2 || totyp == reg_pointer) return -1;
break;
}
if (off >= 0) {
/* parameters must be initialised with an instruction
* like "move.w 4(a6),d0", which costs 2 words.
*/
score -= 2;
}
score -= 1; /* take save/restore into account */
return score;
}
struct regsav_t {
char *rs_reg; /* e.g. "a3" or "d5" */
long rs_off; /* offset of variable */
int rs_size; /* 2 or 4 bytes */
} regsav[9];
int regnr;
i_regsave()
{
regnr = 0;
}
#define MOVEM_LIMIT 2
/* If #registers to be saved exceeds MOVEM_LIMIT, we
* use the movem instruction to save registers; else
* we simply use several move.l's.
*/
save()
{
register struct regsav_t *p;
if (regnr > MOVEM_LIMIT) {
fprintf(codefile,"movem.l ");
for (p = regsav; ;) {
fprintf(codefile,"%s",p->rs_reg);
if (++p == &regsav[regnr]) break;
putc('/',codefile);
}
fprintf(codefile,",-(sp)\n");
} else {
for (p = regsav; p < &regsav[regnr]; p++) {
fprintf(codefile,"move.l %s,-(sp)\n",p->rs_reg);
}
}
/* initialise register-parameters */
for (p = regsav; p < &regsav[regnr]; p++) {
if (p->rs_off >= 0) {
fprintf(codefile,"move.%c %ld(a6),%s\n",
(p->rs_size == 4 ? 'l' : 'w'),
p->rs_off,
p->rs_reg);
}
}
}
restr()
{
register struct regsav_t *p;
if (regnr > MOVEM_LIMIT) {
fprintf(codefile,"movem.l (sp)+,");
for (p = regsav; ;) {
fprintf(codefile,"%s",p->rs_reg);
if (++p == &regsav[regnr]) break;
putc('/',codefile);
}
putc('\n',codefile);
} else {
for (p = &regsav[regnr-1]; p >= regsav; p--) {
fprintf(codefile,"move.l (sp)+,%s\n",p->rs_reg);
}
}
fprintf(codefile,"unlk a6\n");
fprintf(codefile,"rts\n");
}
f_regsave()
{
save();
}
regsave(str,off,size)
char *str;
long off;
{
assert (regnr < 9);
regsav[regnr].rs_reg = str;
regsav[regnr].rs_off = off;
regsav[regnr++].rs_size = size;
fprintf(codefile, "!Local %ld into %s\n",off,str);
}
regreturn()
{
restr();
}
#endif
prolog(nlocals) full nlocals; {
fprintf(codefile,"tst.b -%D(sp)\nlink\ta6,#-%D\n",nlocals+40,nlocals);
}
mes(type) word type ; {
int argt ;
switch ( (int)type ) {
case ms_ext :
for (;;) {
switch ( argt=getarg(
ptyp(sp_cend)|ptyp(sp_pnam)|sym_ptyp) ) {
case sp_cend :
return ;
default:
strarg(argt) ;
fprintf(codefile,".define %s\n",argstr) ;
break ;
}
}
default :
while ( getarg(any_ptyp) != sp_cend ) ;
break ;
}
}
char *segname[] = {
".text", /* SEGTXT */
".data", /* SEGCON */
".data", /* SEGROM */
".bss" /* SEGBSS */
};

View File

@@ -1,28 +0,0 @@
#define ex_ap(y) fprintf(codefile,".extern %s\n",y)
#define in_ap(y) /* nothing */
#define newilb(x) fprintf(codefile,"%s:\n",x)
#define newdlb(x) fprintf(codefile,"%s:\n",x)
#define dlbdlb(x,y) fprintf(codefile,"%s = %s\n",x,y)
#define newlbss(l,x) fprintf(codefile,"%s:.space\t%D\n",l,x);
#define pop_fmt "(sp)+"
#define cst_fmt "%D"
#define off_fmt "%D"
#define ilb_fmt "I%03x%x"
#define dlb_fmt "_%d"
#define hol_fmt "hol%d"
#define loc_off "%d(a6)"
#define arg_off "8+%d(a6)"
#define hol_off "%d+hol%d"
#define con_cst(x) fprintf(codefile,".short\t%d\n",x)
#define con_ilb(x) fprintf(codefile,".long\t%s\n",x)
#define con_dlb(x) fprintf(codefile,".long\t%s\n",x)
#define modhead ""
#define id_first '_'
#define BSS_INIT 0

File diff suppressed because it is too large Load Diff

View File

@@ -1,19 +0,0 @@
CFLAGS=-O
cv: cv.o
cc -o cv -n cv.o
install: cv
cp cv ../../../bin
cmp: cv
-../compare cv
opr:
make pr | opr
pr:
@pr `pwd`/cv.c
clean:
-rm -f *.o *.old cv

View File

@@ -1,71 +0,0 @@
static char rcsid[] = "$Header$";
/*
* (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
*
* This product is part of the Amsterdam Compiler Kit.
*
* Permission to use, sell, duplicate or disclose this software must be
* obtained in writing. Requests for such permissions may be sent to
*
* Dr. Andrew S. Tanenbaum
* Wiskundig Seminarium
* Vrije Universiteit
* Postbox 7161
* 1007 MC Amsterdam
* The Netherlands
*
*/
#include <stdio.h>
#include <a.out.h>
/*
* NOTE: Beware that the a.out.h file included here should be the a.out.h
* file of the TARGET machine, not of the SOURCE machine.
*/
struct bhdr s_exec;
main(argc,argv) char **argv; {
unsigned short losh,hish;
long addr,maxaddr;
short count;
maxaddr=0;
if (argc != 3) {
fprintf(stderr,"Usage: %s VU-a.out Bleasdale-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(&hish,sizeof(short),1,stdin)==1) {
if (fread(&losh,sizeof(short),1,stdin)!=1)
exit(fprintf(stderr,"foo\n"));
addr=losh+(((long)hish)*65536L);
addr -= 0x20000; /* entry point is 0x20000 on Bleasdale */
if (fread(&count,sizeof(short),1,stdin)!=1)
exit(fprintf(stderr,"bar\n"));
fseek(stdout,addr+sizeof(s_exec),0);
while (count--) {
putchar(getchar());
addr++;
}
if (addr>maxaddr)
maxaddr = addr;
}
s_exec.fmagic = FMAGIC;
s_exec.dsize = maxaddr;
s_exec.entry = 0x20000;
fseek(stdout,0L,0);
fwrite(&s_exec,sizeof(s_exec),1,stdout);
chmod(argv[2],0755);
return 0;
}

View File

@@ -1,106 +0,0 @@
static char rcsid[] = "$Header$";
#define MAXBYTE 24
#include <stdio.h>
char hex[] = "0123456789ABCDEF";
FILE *fp, *fopen();
char **s;
int bytes, bytcnt, checksum;
long pc;
main (argc,argv)
int argc;
char *argv[];
{
if (argc != 2) fatal ("usage: %s filename\n",argv[0]);
if ((fp = fopen (*++argv,"r")) == NULL)
fatal ("can't open %s\n",*argv);
else {
s = argv;
convert ();
fclose (fp);
}
}
convert ()
{
int c;
do
{
pc = getword ();
pc = (pc << 16) | getword ();
bytes = getword ();
while (bytes != 0)
{
bytcnt = (bytes < MAXBYTE) ? bytes : MAXBYTE;
bytes -= bytcnt;
checksum = 0;
if (pc > 0xffffL) S2record (); else S1record ();
}
c = getc (fp);
ungetc (c, fp);
}
while (c != EOF);
printf ("S9030000FC\n");
}
S2record ()
{
printf ("S2");
bytcnt += 4;
outbyte (bytcnt);
outbyte (pc);
record ();
}
S1record ()
{
printf ("S1");
bytcnt += 3;
outbyte (bytcnt);
record ();
}
record ()
{
outbyte (pc << 8);
outbyte (pc << 16);
while (bytcnt != 0)
{
outbyte (getbyte ());
pc ++;
}
outbyte (~checksum);
putchar ('\n');
putchar (0);
putchar (0);
}
outbyte (b)
int b;
{
checksum = (checksum + b) & 0377;
putchar (hex[(b>>4) & 017]);
putchar (hex[b & 017]);
-- bytcnt;
}
getword ()
{
int c;
c = getbyte ();
return ((getbyte () << 8) | c );
}
getbyte ()
{
int c;
if ((c = getc (fp)) == EOF) fatal ("end of %s\n",*s);
return (c);
}
fatal (s,a)
{
printf (s,a);
exit (-1);
}

View File

@@ -1,34 +0,0 @@
P = mloop
em2tl: a.out
cv a.out em2tl
rm a.out
a.out: $P02tl.s $P12tl.s $P22tl.s $P32tl.s $P42tl.s $P52tl.s $P62tl.s $P72tl.s $P82tl.s $P92tl.s $Pa2tl.s $Pb2tl.s $Pc2tl.s $Pe2tl.s
m68k2 -s $P?2tl.s >symem2tl
$P02tl.s: $P0
prep $P0 $P02tl.s
$P12tl.s: $P1
prep $P1 $P12tl.s
$P22tl.s: $P2
prep $P2 $P22tl.s
$P32tl.s: $P3
prep $P3 $P32tl.s
$P42tl.s: $P4
prep $P4 $P42tl.s
$P52tl.s: $P5
prep $P5 $P52tl.s
$P62tl.s: $P6
prep $P6 $P62tl.s
$P72tl.s: $P7
prep $P7 $P72tl.s
$P82tl.s: $P8
prep $P8 $P82tl.s
$P92tl.s: $P9
prep $P9 $P92tl.s
$Pa2tl.s: $Pa
prep $Pa $Pa2tl.s
$Pb2tl.s: $Pb
prep $Pb $Pb2tl.s
$Pc2tl.s: $Pc
prep $Pc $Pc2tl.s
$Pe2tl.s: $Pe
prep $Pe $Pe2tl.s

View File

@@ -1,77 +0,0 @@
! (c) copyright 1980 by the Vrije Universiteit, Amsterdam, The Netherlands.
! Explicit permission is hereby granted to universities to use or duplicate
! this program for educational or research purposes. All other use or dup-
! lication by universities, and all use or duplication by other organiza-
! tions is expressly prohibited unless written permission has been obtained
! from the Vrije Universiteit. Requests for such permissions may be sent to
! Dr. Andrew S. Tanenbaum
! Wiskundig Seminarium
! Vrije Universiteit
! Postbox 7161
! 1007 MC Amsterdam
! The Netherlands
! Organizations wishing to modify part of this software for subsequent sale
! must explicitly apply for permission. The exact arrangements will be
! worked out on a case by case basis, but at a minimum will require the or-
! ganization to include the following notice in all software and documenta-
! tion based on our work:
! This product is based on the Pascal system developed by
! Andrew S. Tanenbaum, Johan W. Stevenson and Hans van Staveren
! of the Vrije Universiteit, Amsterdam, The Netherlands.
!
!=========================================================================
! This is an interpreter for EM programs with no virtual memory for the
! the PMDS-II . This interpreter is adapted from an interpreter which was
! made for the pdp11 by Evert Wattel and Hans van Staveren . The present
! version is made by Freek van Schagen
! Vrije Universiteit
! Amsterdam.
!-------------------------------------------------------------------------
! The program requires preprocessing by the C-preprocessor . There are
! several options :
! lword: 4byte word size in stead of 2 byte word size ;
! test: checking for undefined variables , nil pointers
! array indices , overflow , etc ;
! last: generation of a file with the last 16 lines executed ;
! count: generation of a file with a flow count ;
! flow: generation of a file with a flow bitmap ;
! prof: generation of a file with a runtime profile ;
! opfreq: generation of a file with a frequency count per opcode.
!--------------------------------------------------------------------------
! Memory layout:
! --------------------------------------------------------------------------
! | | | | | | | | | |
! | 1 | 2 | 3 | 4 | 5 | 6 | | 7 | 8 |
! | | | | | | | | | |
! --------------------------------------------------------------------------
! 1: Interpreter text+data+bss.
! 2: EM text.
! 3: EM procedure descriptors.
! 4: EM global data area.
! 5: tables for flow , count , profile.
! 6: EM heap area.
! 7: EM local data and stack.
! 8: Arguments to the interpreter .
!REGISTER USE
! pc programcounter
! a7=sp stackpointer d7 if lword: 1 , if not lword: 0
! a6 external base= eb d6 0
! a5 scratch d5 scratch
! a4 address of loop d4 scratch
! a3 EM programcounter d3 scratch
! a2 local base =lb d2 scratch
! a1 address of return area d1 scratch
! a0 scratch d0 opcode byte and scratch

View File

@@ -1,78 +0,0 @@
#ifdef lword
#define word 4
#define wrd #4
#define wmu #2
#define und #-0x80000000
#define ad add.l
#define an and.l
#define asle asl.l
#define asri asr.l
#define cl clr.l
#define comp cmp.l
#define exor eor.l
#define extend !
#define inor or.l
#define lsle lsl.l
#define lsri lsr.l
#define nega neg.l
#define mov move.l
#define nt not.l
#define rotl rol.l
#define rotr ror.l
#define subt sub.l
#define testen tst.l
#define l0 16
#define l1 20
#define l2 24
#define l3 28
#define l_1 -4
#define l_2 -8
#define l_3 -12
#define l_4 -16
#define l_5 -20
#define l_6 -24
#define l_7 -28
#define l_8 -32
#define checksize cmp.l #4,d0 ; beq 4f ; cmp.l #8,d0 ; bne 9f ; bsr no8bar ; \
9: bra e_oddz
#else
#define word 2
#define wrd #2
#define wmu #1
#define und #-0x8000
#define ad add.w
#define an and.w
#define asle asl.w
#define asri asr.w
#define cl clr.w
#define comp cmp.w
#define exor eor.w
#define extend ext.l
#define inor or.w
#define lsle lsl.w
#define lsri lsr.w
#define nega neg.w
#define mov move.w
#define nt not.w
#define rotl rol.w
#define rotr ror.w
#define subt sub.w
#define testen tst.w
#define l0 16
#define l1 18
#define l2 20
#define l3 22
#define l_1 -2
#define l_2 -4
#define l_3 -6
#define l_4 -8
#define l_5 -10
#define l_6 -12
#define l_7 -14
#define l_8 -16
#define checksize cmp.w #2,d0 ; beq 2f ; cmp.w #4,d0 ; beq 4f ; bra e_oddz
#endif
#define adroff move.b (a3)+,(a1) ; move.b (a3)+,1(a1)
#define claimstack tst.b -1024(sp)

View File

@@ -1,8 +0,0 @@
!definitions
!#define lword
!#define FLTRAP
#define opfreq 0
#define last 1
#define test 1
#define count 0
#define flow 0

View File

@@ -1,503 +0,0 @@
!---------------------------------------------------------------------------
! START OF THE PROGRAM
!---------------------------------------------------------------------------
lea retarea,a1 !a1 POINTS AT RETURN AREA
move.l nd,-(sp) !nd contains endbss
bsr _break
add.l wrd,sp
#if last
move.l #30,d0 !initialise lasttable
lea lasttable,a5
0: clr.l (a5)+
dbra d0,0b
move.l #-1,(a5)
move.l #linused-8,linused
#endif
move.l 4(sp),a2
move.l (a2),filb !interpreter name in filb
sub.l #1,(sp)
bgt 0f
.data
emfile: .asciz "e.out"
.align 2
.text
move.l 4(sp),a0 !4(sp) is argv
move.l #emfile,(a0) !pointer to e.out in argp1
add.l #1,(sp) !only 1 argument in this case
bra 1f
0: add.l #4,4(sp) !skip name of interpreter
1: add.l #4-word,sp
move.l sp,ml
move.l word(sp),a2
cl -(sp)
move.l (a2),-(sp)
lea eb,a6
bsr _open
testen (sp)+
bne nofile
mov (sp)+,savefd
move.l (a2),filb !load file name in filb
!information about file for error mess.
move.l #16,-(sp) ; pea header
mov savefd,-(sp) !skip first header
bsr _read ; testen (sp)+
bne badarg1
move.l #32,(sp)
pea header
mov savefd,-(sp)
bsr _read
testen (sp)+
bne badarg1
cmp.l #32,(sp)+
bne badarg1
lea header,a0
move.l #5,d0 !convert em integer to integer
0: add.l #4,a1
move.b (a0)+,-(a1) ; move.b (a0)+,-(a1)
move.b (a0)+,-(a1) ; move.b (a0)+,-(a1)
move.l (a1),-4(a0) ; dbra d0,0b
move.l nd,a0 ; move.l a0,pb !Bottom emtext
add.l ntext,a0 ; move.l a0,pd !proc. descr. base
move.l nproc,d1 ; asl.l #3,d1 !2 pointers
#if count + prof + flow
mulu #3,d1 !or 6 pointers
#endif
add.l d1,a0 ; move.l a0,eb !external base
add.l szdata,a0 ; move.l a0,tblmax
move.l a0,globmax ; move.l a0,hp
add.l #2000,a0 ; move.l a0,-(sp)
bsr _break !ask for core
testen (sp)+ ; bne toolarge
move.l eb,a6 ; move.l filb,4(a6)
move.l ntext,-(sp)
move.l pb,-(sp)
mov savefd,-(sp)
bsr _read
testen (sp)+ ; bne badarg
add.l #4,sp
#if float
! PM
#endif
lblbuf: sub.l #2048,sp
claimstack
move.l sp,a4 !transport ptr a4
move.l sp,a5
move.l #2048,-(sp) ; move.l a4,-(sp)
mov savefd,-(sp) ; bsr _read
testen (sp)+ ; bne badarg
move.l (sp)+,d0
cmp.l #2048,d0 ; bcs 0f
add.l #1024,a5 ; bra 1f !a5 =buffer middle
0: add.l d0,a5 !a5 = buffer end
1: move.l eb,a3 !At a3 filling has to start
clr.l d1 ; clr.l d2
move.l #datswi,a6
datloop: cmp.l a4,a5 ; bhi 9f !Go on filling data
bsr blshift !shift block down , read next block
9: sub.l #1,ndata ; blt finito
move.b (a4)+,d1 ; beq dat0 !type byte in d1
move.l a3,a2 ; move.b (a4)+,d2 !count byte in d2
asl.l #2,d1 ; move.l -4(a6,d1),a0
jmp (a0)
.data
datswi: .long dat1; .long dat2; .long dat3; .long dat4
.long dat5; .long dat6; .long dat6; .long dofloat
.text
dat0: add.l #4,a1
move.b (a4)+,-(a1) ; move.b (a4)+,-(a1)
move.b (a4)+,-(a1) ; move.b (a4)+,-(a1)
move.l (a1),d0 ; move.l a3,d4 !d0 =count
sub.l a2,d4 !reconstruct byte count of previous describtor
sub.l #1,d0 ; sub.l #1,d4
1: move.l d4,d3
2: move.b (a2)+,(a3)+ ; dbra d3,2b
dbra d0,1b ; bra datloop
dat1: mov und,(a3)+ ; sub.b #1,d2
bne dat1 ; bra datloop
dat2: move.b (a4)+,(a3)+ ; sub.b #1,d2
bne dat2 ; bra datloop
dat3: move.w wrd,d1 ; add.l d1,a3 !wrd = 2 or 4
3: move.b (a4)+,-(a3) ; sub.b #1,d1 ; bgt 3b
add.l wrd,a3 ; sub.b #1,d2
bne dat3 ; bra datloop
dat4: move.l eb,d4 ; bra 4f
dat5: move.l pb,d4
4: add.l #4,a3
move.b (a4)+,-(a3) ; move.b (a4)+,-(a3)
move.b (a4)+,-(a3) ; move.b (a4)+,-(a3)
add.l d4,(a3)+ ; sub.b #1,d2
bne 4b ; bra datloop
dat6: add.l d2,a3 ; move.l d2,d3
6: move.b (a4)+,-(a3) ; sub.b #1,d2
bne 6b ; add.l d3,a3
bra datloop
dofloat: add.l d2,a3
bsr atof ; bra datloop
!DUMMY ASCII TO FLOAT ROUTINE
atof: tst.b (a4)+ ; bne atof
rts
blshift: move.l a5,a0 ; move.l #1024,d0
sub.l d0,a0 ; move.l d0,-(sp)
sub.l d0,a4 !update pointer
asr.l #2,d0
0: move.l (a5)+,(a0)+ ; sub.w #1,d0
bgt 0b ; move.l a0,a5
move.l a5,-(sp) ; mov savefd,-(sp)
bsr _read
testen (sp)+ ; bne badarg
move.l (sp)+,d0
cmp.l #1024,d0 ; beq 1f
add.l d0,a5
1: rts
finito: cmp.l hp,a3 ; bne badarg !load file error
move.l eb,a6 !eb IN a6 NOW
lea 4(a6),a0 !filb CONTAINS eb+4
move.l a0,filb
!WE START TO READ THE PROCEDURE DESCRIPTORS
move.l nproc,d1 ; move.l pd,a3
asl.l #3,d1 !proc. descr. is 8 bytes
4: move.l a5,d2 ; sub.l a4,d2 !What is available?
add.l #7,d2 ; and.w #-0x8,d2 !multiple of 8!
sub.l d2,d1 !subtract what can
asr.l #3,d2 !be read. divide by 8
sub.l #1,d2
2: add.l #4,a3
move.b (a4)+,-(a3) ; move.b (a4)+,-(a3)
move.b (a4)+,-(a3) ; move.b (a4)+,-(a3)
add.l #8,a3
move.b (a4)+,-(a3) ; move.b (a4)+,-(a3)
move.b (a4)+,-(a3) ; move.b (a4)+,-(a3)
move.l pb,d0 ; add.l d0,(a3)+ !em address to machine address
#if count+prof+flow
clr.l (a3)+
clr.l (a3)+
clr.l (a3)+
clr.l (a3)+
#endif
dbra d2,2b ; tst.l d1
ble 3f ; bsr blshift !more or ready
bra 4b
3: cmp.l eb,a3 ; bne badarg
move.l savefd,-(sp) ; bsr _close
move.l ml,sp !refresh stack
#if count+prof+flow
! |=======================|
! Here we fill the fields in the procedure | current file name |
! descriptor with table information. The |-----------------------|
! procedure descriptor has six fields, | link to next proc |
! like described in this picture. We |-----------------------|
! construct a linked list of the procedure | first line number |
! descriptors, such that the defined |-----------------------|
! order of procedures is compatible | count pointer |
! with the text order. Thereafter we |-----------------------|
! scan the text for line information to | start address |
! fill the count pointer and startline |-----------------------|
! field. The link to the first procedure | bytes for locals |
! is in firstp , links are descriptor |=======================|
! start addresses. The last procedure
! links to the external base. All lines in the text get a count
! number, lines of a procedure get consecutive count numbers,
! the procedure count pointer gives the number of the first line.
! Count pointer zero is reserved for the case that no line number
! is yet defined.
! Register use: a6 is external base ("eb"), a1 points at return area, other
! registers are free
makelink: move.l pd,a0
move.l #0,a2
move.l a0,a3 !a3 will point at the first proc.
move.l a0,a4 !a4 will point at proc descr base
0: move.l a0,a5 !keep former descr pointer in a5
add.l #24,a0 !a0 points at next one
cmp.l a0,a6 !top of descriptor space
bls 4f !yes? ready!
1: move.l 4(a0),d0 !start address of current proc in d0
cmp.l 4(a5),d0 !compair start address with previous
bcc 2f !d0 large? follow link!
sub.l #24,a5 !d0 small? compair with previous
cmp.l a5,a4 !is a5 smaller than pd
bls 1b !no? try again
move.l a3,16(a0) !yes? then smallest text add up to now
move.l a0,a3 !remind a3 is to point at first proc
bra 0b !next descriptor
2: move.l 16(a5),d1 !follow the link to find place
beq 3f !if 0 then no link defined
move.l d1,a2
cmp.l 4(a2),d0 !compair start address
bcs 3f !start addr between those of a5 and a2
move.l a2,a5 !d0 above start address of a5
bra 2b !go on looking
3: move.l a0,16(a5) !a0 follows a5
move.l d1,16(a0) !a2 follows a0
bra 0b
4: move.l a3,firstp !firstp links to first procedure
! Register use: a3 points at first procedure , d0 opcode byte , a5 base of
! table , d1 keeps min line nr , d2 keeps max line nr , d3 current line nr ,
! maxcount in d4
procinf: move.l #1,maxcount !count pointer for first procedure
move.l #1,d4
move.l #0,d3
move.l #0,d0
0: move.l a3,-(sp) !stack current procedure
move.l #-1,d1 !minimal line number on 0xFFFFFFFF
move.l #0,d2 !maximal line number on 0
tst.l 16(a3) !bottom address next procedure
beq 6f !if 0 last procedure
move.l 16(a3),a4
move.l 4(a4),a4 !a4 points at top of current proc
bra 2f
6: move.l pd,a4
2: move.l 4(a3),a3 !start address of current procedure
8: move.b (a3)+,d0 !start scanning
cmp.b #-2,d0
beq 1f !case escape1
cmp.b #-1,d0
beq 6f !case escape2
cmp.b #-106,d0
bhi 7f !ordinary skip at 7
beq 2f !case lni at 2
cmp.b #-108,d0 !lin_l ?
bcs 7f !ordinary skip at 7
beq 3f !lin_l at 3
move.l #0,d3
move.b (a3)+,d3 !lin_s0 here
bra 4f !compare at 4
2: add.l #1,d3
bra 4f
3: adroff
move.l #0,d3
move.w (a1),d3
bra 4f
6: move.b (a3)+,d0
cmp.b #35,d0 !lin_q ?
bne 6f !skip for escape2 at 6f
move.b (a3)+,(a1)+
move.b (a3)+,(a1)+
move.b (a3)+,(a1)+
move.b (a3)+,(a1)
sub.l #3,a1
move.l (a1),d3
4: cmp.l d1,d3 !d3 less than minimum ?
bcc 5f
move.l d3,d1
5: cmp.l d3,d2 !d3 more than maximum ?
bcc 9f
move.l d3,d2
bra 9f
6: add.l #4,a3
bra 9f
1: move.b (a3)+,d0
move.l d0,a2 !escape1 opcodes treated here
add.l #256,a2 !second table
bra 1f
7: move.l d0,a2
1: move.b skipdisp(a2),d0 !look for argument size
add.l d0,a3
9: cmp.l a3,a4 !still more text
bhi 8b
move.l (sp)+,a3 !bottom back
sub.l d1,d2 !compute number of lines
bcs 9f !no line so no information
move.l d4,8(a3)
move.l d1,12(a3)
add.l #1,d2
add.l d2,d4 !this is the new maxcount
move.l d4,maxcount
9: tst.l 16(a3) !follow link to next procedure
beq 1f
move.l 16(a3),a3
bra 0b
1:
countlabel:
.data
skipdisp:
.byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0;
.byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0;
.byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0;
.byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0;
.byte 0; .byte 0; .byte 0; .byte 1; .byte 0; .byte 0; .byte 2; .byte 0;
.byte 0; .byte 1; .byte 1; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0;
.byte 0; .byte 0; .byte 1; .byte 2; .byte 1; .byte 1; .byte 1; .byte 1;
.byte 1; .byte 1; .byte 1; .byte 2; .byte 1; .byte 1; .byte 1; .byte 1;
.byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0;
.byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0;
.byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0;
.byte 0; .byte 0; .byte 0; .byte 0; .byte 1; .byte 0; .byte 0; .byte 0;
.byte 1; .byte 0; .byte 0; .byte 0; .byte 1; .byte 0; .byte 0; .byte 0;
.byte 1; .byte 1; .byte 0; .byte 1; .byte 0; .byte 2; .byte 0; .byte 2;
.byte 1; .byte 0; .byte 0; .byte 0; .byte 1; .byte 1; .byte 0; .byte 1;
.byte 2; .byte 1; .byte 1; .byte 1; .byte 1; .byte 1; .byte 1; .byte 1;
.byte 2; .byte 2; .byte 0; .byte 0; .byte 1; .byte 1; .byte 1; .byte 0;
.byte 0; .byte 2; .byte 1; .byte 0; .byte 1; .byte 0; .byte 0; .byte 1;
.byte 1; .byte 1; .byte 0; .byte 0; .byte 2; .byte 1; .byte 0; .byte 2;
.byte 0; .byte 1; .byte 1; .byte 2; .byte 1; .byte 1; .byte 1; .byte 1;
.byte 1; .byte 2; .byte 0; .byte 0; .byte 0; .byte 0; .byte 1; .byte 2;
.byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 1; .byte 2; .byte 2;
.byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0;
.byte 0; .byte 0; .byte 0; .byte 0; .byte 1; .byte 1; .byte 0; .byte 0;
.byte 0; .byte 1; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 1;
.byte 0; .byte 0; .byte 1; .byte 0; .byte 0; .byte 1; .byte 1; .byte 1;
.byte 1; .byte 0; .byte 2; .byte 1; .byte 1; .byte 1; .byte 2; .byte 0;
.byte 0; .byte 1; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 1;
.byte 2; .byte 2; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0;
.byte 0; .byte 1; .byte 0; .byte 0; .byte 0; .byte 0; .byte 2; .byte 1;
.byte 1; .byte 1; .byte 1; .byte 1; .byte 1; .byte 1; .byte 1; .byte 1;
.byte 2; .byte 1; .byte 0; .byte 0; .byte 1; .byte 2; .byte 7; .byte 5;
!escaped opcodes
.byte 2; .byte 0; .byte 2; .byte 0; .byte 2; .byte 0; .byte 2; .byte 0;
.byte 2; .byte 0; .byte 2; .byte 0; .byte 2; .byte 2; .byte 0; .byte 2;
.byte 2; .byte 2; .byte 2; .byte 2; .byte 0; .byte 2; .byte 2; .byte 0;
.byte 2; .byte 0; .byte 0; .byte 0; .byte 2; .byte 0; .byte 2; .byte 0;
.byte 2; .byte 0; .byte 2; .byte 0; .byte 2; .byte 0; .byte 2; .byte 0;
.byte 2; .byte 0; .byte 0; .byte 0; .byte 0; .byte 2; .byte 2; .byte 2;
.byte 2; .byte 2; .byte 0; .byte 2; .byte 0; .byte 2; .byte 0; .byte 2;
.byte 0; .byte 2; .byte 0; .byte 2; .byte 0; .byte 2; .byte 2; .byte 2;
.byte 0; .byte 2; .byte 0; .byte 2; .byte 0; .byte 2; .byte 2; .byte 2;
.byte 2; .byte 2; .byte 2; .byte 2; .byte 0; .byte 2; .byte 0; .byte 1;
.byte 2; .byte 2; .byte 2; .byte 2; .byte 0; .byte 2; .byte 0; .byte 2;
.byte 0; .byte 0; .byte 2; .byte 0; .byte 2; .byte 0; .byte 0; .byte 2;
.byte 0; .byte 2; .byte 2; .byte 0; .byte 2; .byte 0; .byte 2; .byte 0;
.byte 2; .byte 0; .byte 0; .byte 2; .byte 0; .byte 2; .byte 0; .byte 2;
.byte 0; .byte 2; .byte 0; .byte 2; .byte 0; .byte 2; .byte 2; .byte 2;
.byte 2; .byte 2; .byte 0; .byte 0; .byte 2; .byte 2; .byte 0; .byte 2;
.byte 0; .byte 2; .byte 0; .byte 2; .byte 0; .byte 2; .byte 0; .byte 2;
.byte 2; .byte 0; .byte 1; .byte 0; .byte 0; .byte 0; .byte 2; .byte 0;
.byte 2; .byte 0; .byte 2; .byte 2; .byte 2; .byte 2; .byte 2; .byte 2;
.byte 0; .byte 2; .byte 0; .byte 1; .byte 2; .byte 0; .byte 0; .byte 2;
.text
move.l globmax,d1
move.l d1,a3
#if prof
move.l d1,ltime
move.l d1,profile !PROFILE POINTER FOR CURRENT PROC
move.l maxcount,d0
add.l #1,d0
asl.l #2,d0 !4 BYTES FOR EACH LINE
add.l d0,d1
move.l d0,profsiz !profsiz CONTAINS NEEDED MEM SIZE
#endif
#if flow
move.l d1,lflow
move.l maxcount,d0
asr.l #3,d0 !divide by 8 ; byte is 8 bits ,you know
add.l #2,d0
bclr #0,d0 !make integer number of words (2 byte!)
add.l d0,d1
move.l d0,flowsiz
#endif
#if count
move.l d1,lcount
move.l maxcount,d0
add.l #1,d0
asl.l #2,d0
add.l d0,d1
move.l d0,countsiz
#endif
move.l d1,tblmax
add.l #1024,d1
cmp.l nd,d1
bcs 2f
move.l d1,-(sp)
bsr _break
testen (sp)+
bne toolarge
2: sub.l a3,d1
asr.l wmu,d1
3: cl (a3)+
dbra d1,3b
sub.l #1024,a3
move.l a3,hp
cfp: move.l ml,sp !LABEL FOR DEBUGGING
#endif
!----------------------------------------------------------------------------
! START CALLING SEQUENCE HERE
!-----------------------------------------------------------------------------
lea loop,a4
move.l pb,a3
move.l #0,a2
move.l wmu-1,d7
clr.l d6
lblsp: move.l entry,-(sp) !start procedure to call
bra cai_z
nofile: mov #0xD,d0 ; bra notrap1
badarg: move.l eb,a6
badarg1: mov #0xE,d0 ; bra notrap1
toolarge: mov #0xF,d0 ; bra notrap1
.data
retsize: .space 2
retarea: .space 32
.bss
argc: .space 4
argv: .space 4
envp: .space 4
savefd: .space 4
header:
ntext: .space 4
ndata: .space 4
nproc: .space 4
entry: .space 4
nline: .space 4
szdata: .space 4
firstp: .space 4
maxcount: .space 4
tblmax: .space 4
globmax: .space 4
ml: .space 4
eb: .space 4 !EXPLICITELY REQUIRED eb, filb, curproc IN
filb: .space 4 !THIS ORDER
curproc: .space 4
pb: .space 4
pd: .space 4
hp: .space 4
.define filb
.define curproc
.define pd
.define nproc
.define retarea
.define retsize
.define hp
.define globmax
.define tblmax
.define ml
.define argc
.text

View File

@@ -1,364 +0,0 @@
!-------------------------------------------------------------------------------
! Main loop of the interpreter starts here
!----------------------------------------------------------------------------
loop: move.l #0,d0
move.b (a3)+,d0 !opcode in d0
add.w d0,d0 !opcode to index in table
add.w d0,d0
#if prof
move.l profile,a0
lea timeinf,a5
move.l 0(a5,d0),d1 !get operation time
add.l d1,(a0)
#endif
#if opfreq
lea counttab,a5
add.l #1,0(a5,d0)
#endif
jmp dispat(pc,d0) !jump to branch to the operation
!---------------------------------------------------------------------------
! the BRANCH LIST follows
!--------------------------------------------------------------------------
dispat:
bra loc_0 ; bra loc_1 ; bra loc_2 ; bra loc_3
bra loc_4 ; bra loc_5 ; bra loc_6 ; bra loc_7
bra loc_8 ; bra loc_9 ; bra loc_10 ; bra loc_11
bra loc_12 ; bra loc_13 ; bra loc_14 ; bra loc_15
bra loc_16 ; bra loc_17 ; bra loc_18 ; bra loc_19
bra loc_20 ; bra loc_21 ; bra loc_22 ; bra loc_23
bra loc_24 ; bra loc_25 ; bra loc_26 ; bra loc_27
bra loc_28 ; bra loc_29 ; bra loc_30 ; bra loc_31
bra loc_32 ; bra loc_33 ; bra aar_1W ; bra adf_s0
bra adi_1W ; bra adi_2W ; bra adp_l ; bra adp_1
bra adp_2 ; bra adp_s0 ; bra adp_s_1 ; bra ads_1W
bra and_1W ; bra asp_1W ; bra asp_2W ; bra asp_3W
bra asp_4W ; bra asp_5W ; bra asp_w0 ; bra beq_l
bra beq_s0 ; bra bge_s0 ; bra bgt_s0 ; bra ble_s0
bra blm_s0 ; bra blt_s0 ; bra bne_s0 ; bra bra_l
bra bra_s_1 ; bra bra_s_2 ; bra bra_s0 ; bra bra_s1
bra cal_1 ; bra cal_2 ; bra cal_3 ; bra cal_4
bra cal_5 ; bra cal_6 ; bra cal_7 ; bra cal_8
bra cal_9 ; bra cal_10 ; bra cal_11 ; bra cal_12
bra cal_13 ; bra cal_14 ; bra cal_15 ; bra cal_16
bra cal_17 ; bra cal_18 ; bra cal_19 ; bra cal_20
bra cal_21 ; bra cal_22 ; bra cal_23 ; bra cal_24
bra cal_25 ; bra cal_26 ; bra cal_27 ; bra cal_28
bra cal_s0 ; bra cff_z ; bra cif_z ; bra cii_z
bra cmf_s0 ; bra cmi_1W ; bra cmi_2W ; bra cmp_z
bra cms_s0 ; bra csa_1W ; bra csb_1W ; bra dec_z
bra dee_w0 ; bra del_w_1 ; bra dup_1W ; bra dvf_s0
bra dvi_1W ; bra fil_l ; bra inc_z ; bra ine_lw
bra ine_w0 ; bra inl__1W ; bra inl__2W ; bra inl__3W
bra inl_w_1 ; bra inn_s0 ; bra ior_1W ; bra ior_s0
bra lae_l ; bra lae_w0 ; bra lae_w1 ; bra lae_w2
bra lae_w3 ; bra lae_w4 ; bra lae_w5 ; bra lae_w6
bra lal_p ; bra lal_n ; bra lal_0 ; bra lal__1
bra lal_w0 ; bra lal_w_1 ; bra lal_w_2 ; bra lar_1W
bra ldc_0 ; bra lde_lw ; bra lde_w0 ; bra ldl_0
bra ldl_w_1 ; bra lfr_1W ; bra lfr_2W ; bra lfr_s0
bra lil_w_1 ; bra lil_w0 ; bra lil_0 ; bra lil_1W
bra lin_l ; bra lin_s0 ; bra lni_z ; bra loc_l
bra loc__1 ; bra loc_s0 ; bra loc_s_1 ; bra loe_lw
bra loe_w0 ; bra loe_w1 ; bra loe_w2 ; bra loe_w3
bra loe_w4 ; bra lof_l ; bra lof_1W ; bra lof_2W
bra lof_3W ; bra lof_4W ; bra lof_s0 ; bra loi_l
bra loi_1 ; bra loi_1W ; bra loi_2W ; bra loi_3W
bra loi_4W ; bra loi_s0 ; bra lol_pw ; bra lol_nw
bra lol_0 ; bra lol_1W ; bra lol_2W ; bra lol_3W
bra lol__1W ; bra lol__2W ; bra lol__3W ; bra lol__4W
bra lol__5W ; bra lol__6W ; bra lol__7W ; bra lol__8W
bra lol_w0 ; bra lol_w_1 ; bra lxa_1 ; bra lxl_1
bra lxl_2 ; bra mlf_s0 ; bra mli_1W ; bra mli_2W
bra rck_1W ; bra ret_0 ; bra ret_1W ; bra ret_s0
bra rmi_1W ; bra sar_1W ; bra sbf_s0 ; bra sbi_1W
bra sbi_2W ; bra sdl_w_1 ; bra set_s0 ; bra sil_w_1
bra sil_w0 ; bra sli_1W ; bra ste_lw ; bra ste_w0
bra ste_w1 ; bra ste_w2 ; bra stf_l ; bra stf_1W
bra stf_2W ; bra stf_s0 ; bra sti_1 ; bra sti_1W
bra sti_2W ; bra sti_3W ; bra sti_4W ; bra sti_s0
bra stl_pw ; bra stl_nw ; bra stl_0 ; bra stl_1W
bra stl__1W ; bra stl__2W ; bra stl__3W ; bra stl__4W
bra stl__5W ; bra stl_w_1 ; bra teq_z ; bra tgt_z
bra tlt_z ; bra tne_z ; bra zeq_l ; bra zeq_s0
bra zeq_s1 ; bra zer_s0 ; bra zge_s0 ; bra zgt_s0
bra zle_s0 ; bra zlt_s0 ; bra zne_s0 ; bra zne_s_1
bra zre_lw ; bra zre_w0 ; bra zrl__1W ; bra zrl__2W
bra zrl_w_1 ; bra zrl_nw
.errnz .-dispat-1016
!-----------------------------------------------------------------------------
! Two byte opcodes come here for decoding of second byte
!----------------------------------------------------------------------------
escape1:
move.l #0,d0
bra 1f
bra escape2
1: move.b (a3)+,d0 !second byte ,extended opcode
add.w d0,d0 !make index of address
add.w d0,d0
cmp.w #640,d0 !check for range
bhi e_illins !jump to ill instruction procedure
#if prof
lea timeinf1,a5
move.l 0(a5,d0),d1
add.l d1,(a0)
#endif
#if opfreq
lea counttab+1024,a5
add.l #1,0(a5,d0)
#endif
jmp dispae1(pc,d0) !jump to the operation
!------------------------------------------------------------------------------
! now dispatch table for escaped opcodes
!------------------------------------------------------------------------------
dispae1: !dispatch escaped opcodes 1
bra aar_l ; bra aar_z ; bra adf_l ; bra adf_z
bra adi_l ; bra adi_z ; bra ads_l ; bra ads_z
bra adu_l ; bra adu_z ; bra and_l ; bra and_z
bra asp_lw ; bra ass_l ; bra ass_z ; bra bge_l
bra bgt_l ; bra ble_l ; bra blm_l ; bra bls_l
bra bls_z ; bra blt_l ; bra bne_l ; bra cai_z
bra cal_l ; bra cfi_z ; bra cfu_z ; bra ciu_z
bra cmf_l ; bra cmf_z ; bra cmi_l ; bra cmi_z
bra cms_l ; bra cms_z ; bra cmu_l ; bra cmu_z
bra com_l ; bra com_z ; bra csa_l ; bra csa_z
bra csb_l ; bra csb_z ; bra cuf_z ; bra cui_z
bra cuu_z ; bra dee_lw ; bra del_pw ; bra del_nw
bra dup_l ; bra dus_l ; bra dus_z ; bra dvf_l
bra dvf_z ; bra dvi_l ; bra dvi_z ; bra dvu_l
bra dvu_z ; bra fef_l ; bra fef_z ; bra fif_l
bra fif_z ; bra inl_pw ; bra inl_nw ; bra inn_l
bra inn_z ; bra ior_l ; bra ior_z ; bra lar_l
bra lar_z ; bra ldc_l ; bra ldf_l ; bra ldl_pw
bra ldl_nw ; bra lfr_l ; bra lil_pw ; bra lil_nw
bra lim_z ; bra los_l ; bra los_z ; bra lor_s0
bra lpi_l ; bra lxa_l ; bra lxl_l ; bra mlf_l
bra mlf_z ; bra mli_l ; bra mli_z ; bra mlu_l
bra mlu_z ; bra mon_z ; bra ngf_l ; bra ngf_z
bra ngi_l ; bra ngi_z ; bra nop_z ; bra rck_l
bra rck_z ; bra ret_l ; bra rmi_l ; bra rmi_z
bra rmu_l ; bra rmu_z ; bra rol_l ; bra rol_z
bra ror_l ; bra ror_z ; bra rtt_z ; bra sar_l
bra sar_z ; bra sbf_l ; bra sbf_z ; bra sbi_l
bra sbi_z ; bra sbs_l ; bra sbs_z ; bra sbu_l
bra sbu_z ; bra sde_l ; bra sdf_l ; bra sdl_pw
bra sdl_nw ; bra set_l ; bra set_z ; bra sig_z
bra sil_pw ; bra sil_nw ; bra sim_z ; bra sli_l
bra sli_z ; bra slu_l ; bra slu_z ; bra sri_l
bra sri_z ; bra sru_l ; bra sru_z ; bra sti_l
bra sts_l ; bra sts_z ; bra str_s0 ; bra tge_z
bra tle_z ; bra trp_z ; bra xor_l ; bra xor_z
bra zer_l ; bra zer_z ; bra zge_l ; bra zgt_l
bra zle_l ; bra zlt_l ; bra zne_l ; bra zrf_l
bra zrf_z ; bra zrl_pw ; bra dch_z ; bra exg_s0
bra exg_l ; bra exg_z ; bra lpb_z ; bra gto_l
.errnz .-dispae1-640
!----------------------------------------------------------------------------
escape2:
move.l #0,d0
move.b (a3)+,d0 !opcode
sub.l #4,sp
move.b (a3)+,(sp)
move.b (a3)+,1(sp)
move.b (a3)+,2(sp)
move.b (a3)+,3(sp)
add.w d0,d0
add.w d0,d0
cmp.w #220,d0
bhi e_illins
#if prof
lea timeinf2,a5
move.l 0(a5,d0),d1
add.l d1,(a0)
#endif
#if opfreq
lea counttab+1664,a5
add.l #1,0(a5,d0)
#endif
jmp dispae2(pc,d0)
!---------------------------------------------------------------------------
! BRANCH TABLE FOR SECOND ESCAPED OPCODES
!---------------------------------------------------------------------------
dispae2:
bra ldc_q ; bra lae_q ; bra lal_qp ; bra lal_qn
bra lde_qw ; bra ldf_q ; bra ldl_qpw ; bra ldl_qnw
bra lil_qpw ; bra lil_qnw ; bra loc_q ; bra loe_qw
bra lof_q ; bra lol_qpw ; bra lol_qnw ; bra lpi_q
bra adp_q ; bra asp_qw ; bra beq_q ; bra bge_q
bra bgt_q ; bra ble_q ; bra blm_q ; bra blt_q
bra bne_q ; bra bra_q ; bra cal_q ; bra dee_qw
bra del_qpw ; bra del_qnw ; bra fil_q ; bra gto_q
bra ine_qw ; bra inl_qpw ; bra inl_qnw ; bra lin_q
bra sde_q ; bra sdf_q ; bra sdl_qpw ; bra sdl_qnw
bra sil_qpw ; bra sil_qnw ; bra ste_qw ; bra stf_q
bra stl_qpw ; bra stl_qnw ; bra zeq_q ; bra zge_q
bra zgt_q ; bra zle_q ; bra zlt_q ; bra zne_q
bra zre_qw ; bra zrl_qpw ; bra zrl_qnw
.errnz .-dispae2-220
!------------------------------------------------------------------------------
! timeinf tables, first the unescaped opcodes
! these tables are parallel to the tables dispat , dispae1 and dispae2
! Each entry contains a reasonable estimate of
! the number of processor state cycles needed to
! execute that instruction. The exact amount cannot be
! supplied, since this can depend rather heavily on the
! size of the object in set, array case instructions etc.
! The table timeinf also contains, added to each entry,
! the number of processor state cycles needed to find the instruction.
! This number is currently 22.Also the number of processor state
! cycles to return from the instruction is included.
! The number is computed for
! the case that all check and runinf options are off.
!------------------------------------------------------------------------------
#if prof
.data
timeinf:
.long 33 ; .long 35 ; .long 35 ; .long 35
.long 35 ; .long 35 ; .long 35 ; .long 35
.long 35 ; .long 35 ; .long 35 ; .long 35
.long 35 ; .long 35 ; .long 35 ; .long 35
.long 35 ; .long 35 ; .long 35 ; .long 35
.long 35 ; .long 35 ; .long 35 ; .long 35
.long 35 ; .long 35 ; .long 35 ; .long 35
.long 35 ; .long 35 ; .long 35 ; .long 35
.long 35 ; .long 35 ; .long 127 ; .long 00
.long 36 ; .long 42 ; .long 56 ; .long 40
.long 40 ; .long 42 ; .long 42 ; .long 42
.long 36 ; .long 39 ; .long 39 ; .long 39
.long 39 ; .long 39 ; .long 41 ; .long 67
.long 48 ; .long 48 ; .long 48 ; .long 48
.long 97 ; .long 48 ; .long 48 ; .long 55
.long 45 ; .long 45 ; .long 36 ; .long 43
.long 211 ; .long 211 ; .long 211 ; .long 211
.long 211 ; .long 211 ; .long 211 ; .long 211
.long 211 ; .long 211 ; .long 211 ; .long 211
.long 211 ; .long 211 ; .long 211 ; .long 211
.long 211 ; .long 211 ; .long 211 ; .long 211
.long 211 ; .long 211 ; .long 211 ; .long 211
.long 211 ; .long 211 ; .long 211 ; .long 211
.long 213 ; .long 00 ; .long 00 ; .long 66
.long 00 ; .long 50 ; .long 54 ; .long 54
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
timeinf1:
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
timeinf2:
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00
#endif
.text

View File

@@ -1,344 +0,0 @@
!--------------------------------------------------------------------------
! Laod constant , load local , store local
!--------------------------------------------------------------------------
loc_0: mov d6,-(sp)
jmp (a4)
loc_1: loc_2: loc_3: loc_4: loc_5: loc_6: loc_7: loc_8:
loc_9: loc_10: loc_11: loc_12: loc_13: loc_14: loc_15: loc_16:
loc_17: loc_18: loc_19: loc_20: loc_21: loc_22: loc_23: loc_24:
loc_25: loc_26: loc_27: loc_28: loc_29: loc_30: loc_31: loc_32:
loc_33:
asr.w #2,d0 !make the multiplication undone
mov d0,-(sp)
jmp (a4)
loc__1:
mov #-1,-(sp)
jmp (a4)
loc_s0: clr.w d0
move.b (a3)+,d0
mov d0,-(sp)
jmp (a4)
loc_s_1: mov #-1,d0
move.b (a3)+,d0
mov d0,-(sp)
jmp (a4)
lpi_l:
adroff
move.w (a1),d0
move.l d0,-(sp)
jmp (a4)
lpi_q: jmp (a4)
loc_q: jmp (a4)
#ifndef lword
bra e_illins
#endif
loc_l: adroff
move.w (a1),d0
ext.l d0
mov d0,-(sp)
jmp (a4)
ldc_0: cl -(sp)
cl -(sp)
jmp (a4)
ldc_l:
adroff
move.w (a1),d0
ext.l d0 !ext works only on d register
4: move.l d0,-(sp) !adapt for l , then "move.2l" signextended
#ifdef lword
bmi 0f
clr.l -(sp)
bra 1f
0: move.l #-1,-(sp)
1:
#endif
jmp (a4)
ldc_q:
#ifdef lword
clr.l -(sp)
#endif
jmp (a4)
!-------------------------------------------------------------------------
! offsets should be adapted for wordsize 4 .Use identifiers
! l3 to l_8 for the offsets in lol_3W to lol__8 . Use the
! preprocessor for conditional definitions .
lol_0: mov l0(a2),-(sp) ; jmp (a4)
lol_1W: mov l1(a2),-(sp) ; jmp (a4)
lol_2W: mov l2(a2),-(sp) ; jmp (a4)
lol_3W: mov l3(a2),-(sp) ; jmp (a4)
lol__1W: mov l_1(a2),-(sp) ; jmp (a4)
lol__2W: mov l_2(a2),-(sp) ; jmp (a4)
lol__3W: mov l_3(a2),-(sp) ; jmp (a4)
lol__4W: mov l_4(a2),-(sp) ; jmp (a4)
lol__5W: mov l_5(a2),-(sp) ; jmp (a4)
lol__6W: mov l_6(a2),-(sp) ; jmp (a4)
lol__7W: mov l_7(a2),-(sp) ; jmp (a4)
lol__8W: mov l_8(a2),-(sp) ; jmp (a4)
lol_w0: clr.w d0
move.b (a3)+,d0
5: asl.l wmu,d0
mov 16(a2,d0),-(sp)
jmp (a4)
lol_w_1: move.l #-1,d0
move.b (a3)+,d0
2: asl.l wmu,d0
mov 0(a2,d0),-(sp)
jmp (a4)
lol_pw: adroff
move.w (a1),d0
bra 5b
lol_nw: adroff
move.w (a1),d0
ext.l d0
bra 2b
lol_qnw: move.l (sp)+,d0
bra 2b
lol_qpw: move.l (sp)+,d0
bra 5b
!--------------------------------------------------------------------------
ldl_0: mov l1(a2),-(sp) !offset code
mov l0(a2),-(sp) !offset code
jmp (a4)
ldl_w_1: move.l #-1,d0
move.b (a3)+,d0
2: asl.l wmu,d0
mov word(a2,d0),-(sp)
mov 0(a2,d0),-(sp)
jmp (a4)
ldl_pw: adroff
move.w (a1),d0
5: asl.l wmu,d0
mov l1(a2,d0),-(sp)
mov l0(a2,d0),-(sp)
jmp (a4)
ldl_nw: adroff
move.w (a1),d0
ext.l d0
bra 2b
ldl_qpw: move.l (sp)+,d0
bra 5b
ldl_qnw: move.l (sp)+,d0
bra 2b
!-------------------------------------------------------------------------
loe_lw: adroff
move.w (a1),d0
bra 1f
loe_qw: move.l (sp)+,d0
bra 1f
loe_w0: loe_w1: loe_w2: loe_w3: loe_w4:
sub.w #624,d0
asl.w #6,d0
move.b (a3)+,d0
1: ext.l d0
asl.l wmu,d0
mov 0(a6,d0),-(sp)
jmp (a4)
lde_lw: adroff
move.w (a1),d0
bra 1f
lde_qw: move.l (sp)+,d0
bra 1f
lde_w0: clr.w d0
move.b (a3)+,d0
1: asl.l wmu,d0
mov word(a6,d0),-(sp)
mov 0(a6,d0),-(sp)
jmp (a4)
!------------------------------------------------------------------------------
lil_0: move.l l0(a2),a0
mov (a0),-(sp)
jmp (a4)
lil_1W: move.l l1(a2),a0
mov (a0),-(sp)
jmp (a4)
lil_pw: adroff
move.w (a1),d0
bra 1f
lil_qpw: move.l (sp)+,d0
bra 1f
lil_w0: clr.w d0
move.b (a3)+,d0
1: asl.l wmu,d0
move.l l0(a2,d0),a0
mov (a0),-(sp)
jmp (a4)
lil_nw: adroff
move.w (a1),d0
ext.l d0
bra 1f
lil_qnw: move.l (sp)+,d0
bra 1f
lil_w_1: move.l #-1,d0
move.b (a3)+,d0
1: asl.l wmu,d0
move.l 0(a2,d0),a0
mov (a0),-(sp)
jmp (a4)
!---------------------------------------------------------------------------
lof_s0: move.l d6,d0
move.b (a3)+,d0
bra 1f
lof_l: adroff
move.w (a1),d0
ext.l d0
bra 1f
lof_q: move.l (sp)+,d0
bra 1f
lof_1W: move.l #1,d0
2: asl.w wmu,d0
1: move.l (sp)+,a0
mov 0(a0,d0),-(sp)
jmp (a4)
lof_2W: move.l #2,d0 ; bra 2b
lof_3W: move.l #3,d0 ; bra 2b
lof_4W: move.l #4,d0 ; bra 2b
ldf_l: adroff
move.w (a1),d0
ext.l d0
2: move.l (sp)+,a0
mov word(a0,d0),-(sp)
mov 0(a0,d0),-(sp)
jmp (a4)
ldf_q: move.l (sp)+,d0
bra 2b
!-------------------------------------------------------------------------
lal_p: adroff
move.w (a1),d0
bra 1f
lal_qp: move.l (sp)+,d0
bra 1f
lal_0: pea 16(a2)
jmp (a4)
lal_w0: clr.w d0
move.b (a3)+,d0
asl.l wmu,d0
1: add.l #16,d0
bra 3f
lal_n: adroff
move.w (a1),d0
ext.l d0
bra 3f
lal_qn: move.l (sp)+,d0
bra 3f
lal__1: move.l #-1,d0
3: pea 0(a2,d0)
jmp (a4)
lal_w_1: move.l #-1,d0
2: move.b (a3)+,d0
asl.l wmu,d0
bra 3b
lal_w_2: move.l #-512,d0
bra 2b
lae_l: adroff
move.w (a1),d0
bra 1f
lae_q: move.l (sp)+,d0
bra 1f
lae_w0: lae_w1: lae_w2: lae_w3: lae_w4:
lae_w5: lae_w6:
sub.w #484,d0
asl.w #6,d0
move.b (a3)+,d0
asl.w wmu,d0
1: pea 0(a6,d0)
jmp (a4)
!---------------------------------------------------------------------------
lxl_1: move.l 16(a2),-(sp)
jmp (a4)
lxl_l: adroff
move.w (a1),d0
beq 5f
bgt 1f
blt e_oddz
1: sub.l #1,d0
bra 2f
lxl_2: move.w #1,d0
2: move.l a2,a0
3: move.l 16(a0),a0
dbra d0,3b
move.l a0,-(sp)
jmp (a4)
5: move.l a2,-(sp)
jmp (a4)
lxa_1: move.l #0,d0
bra 3f
lxa_l: adroff
move.w (a1),d0
bgt 1f
blt e_oddz
pea 16(a2)
jmp (a4)
1: sub.l #1,d0
3: move.l a2,a0
2: move.l 16(a0),a0
dbra d0,2b
pea 16(a0)
jmp (a4)
!-----------------------------------------------------------------------
loi_l: adroff
clr.l d1
move.w (a1),d1
bra 8f
loi_s0: clr.l d1
move.b (a3)+,d1
8: cmp.w #1,d1
beq loi_1
cmp.w #2,d1
beq 2f
move.w d1,d0
move.w d7,d2
3: asr.w #1,d0 ; dbcs d2,3b
bcs e_oddz
bra 5f
loi_1W: loi_2W: loi_3W: loi_4W:
asr.w #2,d0
sub.w #168,d0
move.l d0,d1
asl.w wmu,d1
5: move.l (sp)+,a0
add.l d1,a0
sub.w #1,d0
1: mov -(a0),-(sp)
dbra d0,1b
jmp (a4)
2: move.l (sp)+,a0
move.w (a0),d0
mov d0,-(sp)
jmp (a4)
loi_1: move.l (sp)+,a0
move.w d6,d0
move.b (a0),d0
mov d0,-(sp)
jmp (a4)
los_z: mov (sp)+,d0
bra 0f
los_l: adroff
move.w (a1),d0
0: checksize
2: move.l #0,d1 ; move.w (sp)+,d1 ; bra 8b
4: move.l (sp)+,d1 ; bra 8b

View File

@@ -1,191 +0,0 @@
!---------------------------------------------------------------------
! STORE GROUP
!---------------------------------------------------------------------
stl_pw: adroff
move.w (a1),d0
3: asl.l wmu,d0
mov (sp)+,16(a2,d0)
jmp (a4)
stl_qpw: move.l (sp)+,d0
bra 3b
stl_nw: adroff
move.w (a1),d0
ext.l d0
bra 1f
stl_qnw: move.l (sp)+,d0
bra 1f
stl_w_1: move.l #-1,d0
move.b (a3)+,d0
1: asl.l wmu,d0
mov (sp)+,0(a2,d0)
jmp (a4)
stl_0: mov (sp)+,16(a2) ; jmp (a4)
stl_1W: mov (sp)+,l1(a2) ; jmp (a4)
stl__1W: mov (sp)+,l_1(a2) ; jmp (a4)
stl__2W: mov (sp)+,l_2(a2) ; jmp (a4)
stl__3W: mov (sp)+,l_3(a2) ; jmp (a4)
stl__4W: mov (sp)+,l_4(a2) ; jmp (a4)
stl__5W: mov (sp)+,l_5(a2) ; jmp (a4)
sdl_w_1: move.l #-1,d0
move.b (a3)+,d0
2: asl.l wmu,d0
mov (sp)+,0(a2,d0)
mov (sp)+,word(a2,d0)
jmp (a4)
sdl_nw: adroff
move.w (a1),d0
ext.l d0
bra 2b
sdl_qnw: move.l (sp)+,d0
bra 2b
sdl_qpw: move.l (sp)+,d0
bra 4f
sdl_pw: adroff
move.w (a1),d0
4: asl.l wmu,d0
mov (sp)+,l0(a2,d0)
mov (sp)+,l1(a2,d0)
jmp (a4)
!------------------------------------------------------------------------
sde_q: move.l (sp)+,d0
bra 1f
sde_l: adroff
move.w (a1),d0
1: mov (sp)+,0(a6,d0)
mov (sp)+,word(a6,d0)
jmp (a4)
ste_qw: move.l (sp)+,d0
bra 1f
ste_lw: adroff
move.w (a1),d0
bra 1f
ste_w2: move.w #512,d0 ; bra 0f
ste_w1: move.w #256,d0 ; bra 0f
ste_w0: clr.w d0
0: move.b (a3)+,d0
1: asl.l wmu,d0
mov (sp)+,0(a6,d0)
jmp (a4)
!-------------------------------------------------------------------------
stf_q: move.l (sp)+,a0
bra 6f
stf_l: adroff
move.l #0,a0
move.w (a1),a0
bra 6f
stf_2W: move.l wrd,a0 ; add.l a0,a0
bra 6f
stf_s0: clr.w d0
move.b (a3)+,d0
move.l d0,a0
bra 6f
stf_1W: move.l wrd,a0
6: add.l (sp)+,a0
mov (sp)+,(a0)
jmp (a4)
sdf_q: move.l (sp)+,a0
bra 7f
sdf_l: adroff
move.l d6,a0
move.w (a1),a0
7: add.l (sp)+,a0
mov (sp)+,(a0)+
mov (sp)+,(a0)
jmp (a4)
!-----------------------------------------------------------------------------
sil_w0: move.w d6,d0
move.b (a3)+,d0
asl.l wmu,d0
5: move.l 16(a2,d0),a0
mov (sp)+,(a0)
jmp (a4)
sil_w_1: move.l #-1,d0
move.b (a3)+,d0
asl.l wmu,d0
2: move.l 0(a2,d0),a0
mov (sp)+,(a0)
jmp (a4)
sil_pw: adroff
move.w (a1),d0
bra 5b
sil_qpw: move.l (sp)+,d0
bra 5b
sil_nw: adroff
move.w (a1),d0
ext.l d0
bra 2b
sil_qnw: move.l (sp)+,d0
bra 2b
!----------------------------------------------------------------------------
sti_1: move.l (sp)+,a0
move.b word-1(sp),(a0) !lsb,msb goed?
add.l wrd,sp
jmp (a4)
sti_l: adroff ; move.w (a1),d0 ; bra 0f
sti_s0: clr.w d0 ; move.b (a3)+,d0
0: asr.l #1,d0 ; bne 1f
bcs sti_1 ; bra e_oddz
1: bcs e_oddz
#ifdef lword
asr.l #1,d0 ; bne 2f
move.l (sp)+,a0; lea 2(sp),sp
move.w (sp)+,(a0); jmp (a4)
2: bcs e_oddz
#endif
sub.w #1,d0 ; bra 3f
sti_1W: sti_2W: sti_3W: sti_4W:
sub.w #876,d0 ; asr.w #2,d0
3: move.l (sp)+,a0
4: mov (sp)+,(a0)+
dbra d0,4b
jmp (a4)
sts_l: adroff ; move.w (a1),d0
6: checksize
4: move.l (sp)+,d0; bra 0b
2: move.w (sp)+,d0; bra 0b
sts_z: mov (sp)+,d0
bra 6b
!------------------------------------------------------------------------------
! POINTER ARITHMETIC
!------------------------------------------------------------------------------
adp_l: adroff ; move.w (a1),d0
ext.l d0
add.l d0,(sp); jmp (a4)
adp_q: move.l (sp)+,d0 ; add.l d0,(sp)
jmp (a4)
adp_1: add.l #1,(sp); jmp (a4)
adp_2: add.l #2,(sp); jmp (a4)
adp_s0: move.l d6,d0 ; move.b (a3)+,d0
add.l d0,(sp); jmp (a4)
adp_s_1: move.l #-1,d0 ; move.b (a3)+,d0
add.l d0,(sp) ; jmp (a4)
ads_l: adroff ; move.w (a1),d0
bra 0f
ads_z: mov (sp)+,d0
0: checksize
4: move.l (sp)+,d1 ; add.l d1,(sp) ; jmp (a4)
2: move.w (sp)+,d1 ; ext.l d1
add.l d1,(sp) ; jmp (a4)
ads_1W: mov (sp)+,d0
#ifndef lword
ext.l d0
#endif
add.l d0,(sp); jmp (a4)
sbs_l: adroff ; move.w (a1),d0
bra 0f
sbs_z: mov (sp)+,d0 !d0 contains objectsize
0: checksize
4: move.l (sp)+,d1 ; sub.l d1,(sp)
jmp (a4)
2: move.l (sp)+,d1 ; sub.l d1,(sp)
clr.w (sp)+ ; jmp (a4)

View File

@@ -1,236 +0,0 @@
!----------------------------------------------------------------------------
! CLEARS , INCREMENTS , DECREMENTS
!-----------------------------------------------------------------------------
inc_z: move.l sp,a0
4:
#if test
comp und,(a0)
bne 3f ; bsr e_iund
3:
#endif
ad #1,(a0) ; bvs 9f
jmp (a4)
#ifdef lword
inl__1W: move.l a2,a0 ; sub.l #4,a0 ; bra 4b
inl__2W: move.l a2,a0 ; sub.l #8,a0 ; bra 4b
inl__3W: move.l a2,a0 ; sub.l #12,a0 ; bra 4b
#else
inl__1W: move.l a2,a0 ; sub.l #2,a0 ; bra 4b
inl__2W: move.l a2,a0 ; sub.l #4,a0 ; bra 4b
inl__3W: move.l a2,a0 ; sub.l #6,a0 ; bra 4b
#endif
inl_w_1: move.l #-1,d0 ; move.b (a3)+,d0
2: asl.l wmu,d0
1: move.l a2,a0 ; add.l d0,a0 ; bra 4b
inl_pw: adroff ; move.w (a1),d0
6: asl.l wmu,d0 ; add.l #16,d0
bra 1b
inl_qpw: move.l (sp)+,d0 ; bra 6b
inl_nw: adroff ; move.w (a1),d0
ext.l d0 ; bra 2b
inl_qnw: move.l (sp)+,d0 ; bra 2b
ine_lw: adroff ; move.w (a1),d0 ; bra 5f
ine_qw: move.l (sp)+,d0 ; bra 5f
ine_w0: clr.w d0 ; move.b (a3)+,d0
5: asl.l wmu,d0 ; move.l d0,a0
add.l a6,a0 ; bra 4b
!---------------------------------------------------------------------------
dec_z: move.l sp,a0
4:
#if test
!let op , test gebruikt voor tst?
comp und,(a0) ;bne 3f
bsr e_iund
3:
#endif
subt #1,(a0) ; bvs 9f
jmp (a4)
del_w_1: move.l #-1,d0 ; move.b (a3)+,d0
1: asl.l wmu,d0
2: move.l a2,a0 ; add.l d0,a0 ; bra 4b
del_pw: adroff ; move.w (a1),d0
5: asl.l wmu,d0 ; add.l #16,d0 ; bra 2b
del_qpw: move.l (sp)+,d0 ; bra 5b
del_nw: adroff ; move.w (a1),d0
ext.l d0 ; bra 1f
del_qnw: move.l (sp)+,d0 ; bra 1f
dee_w0: clr.w d0 ; move.b (a3)+,d0
0: asl.l wmu,d0 ; move.l d0,a0
add.l a6,a0 ; bra 4b
dee_lw: adroff ; move.w (a1),d0 ; bra 0b
dee_qw: move.l (sp)+,d0 ; bra 0b
9: bsr e_iovfl !error routine for integer overflow
jmp (a4)
!----------------------------------------------------------------------------
zrl__1W: cl l_1(a2) ; jmp (a4)
zrl__2W: cl l_2(a2) ; jmp (a4)
zrl_w_1: move.l #-1,d0 ; move.b (a3)+,d0
1: asl.l wmu,d0 ; cl 0(a2,d0)
jmp (a4)
zrl_nw: adroff ; move.w (a1),d0
ext.l d0 ; bra 1b
zrl_qnw: move.l (sp)+,d0 ; bra 1b
zrl_pw: adroff ; move.w (a1),d0
2: asl.l wmu,d0 ; cl 16(a2,d0)
jmp (a4)
zrl_qpw: move.l (sp)+,d0 ; bra 2b
zre_lw: adroff ; move.w (a1),d0 ; bra 7f
zre_qw: move.l (sp)+,d0 ; bra 7f
zre_w0: clr.w d0 ; move.b (a3)+,d0
7: asl.l wmu,d0 ; cl 0(a6,d0)
jmp (a4)
zrf_l: adroff ; move.w (a1),d0 ; bra 8f
zrf_z: mov (sp)+,d0
8: move.l d7,d1
3: asr.w #1,d0 ; dbcs d1,3b
bcs e_oddz ; sub.w #1,d0
0: cl -(sp) ; dbra d0,0b
jmp (a4)
zer_s0: clr.w d0 ; move.b (a3)+,d0 ; bra 8b
zer_l: adroff ; move.w (a1),d0 ; bra 8b
zer_z: mov (sp),d0 ; bra 8b
! The test on illegal argument takes some time , specially in 4byte case.
!-----------------------------------------------------------------------
! LOGICAL GROUP
!-------------------------------------------------------------------------
and_1W: mov (sp)+,d1
an d1,(sp)
jmp (a4)
and_l: adroff ; move.w (a1),d0 ; bra 1f
and_z: mov (sp)+,d0
1: ble e_oddz ; move.l d0,a0
move.l d7,d2
2: asr.l #1,d0 ; dbcs d2,2b ; bcs e_oddz
add.l sp,a0 ; sub.l #1,d0
3: mov (sp)+,d1; an d1,(a0)+
dbra d0,3b ; jmp (a4)
!------------------------------------------------------------------------------
ior_1W: mov (sp)+,d1; inor d1,(sp)
jmp (a4)
ior_s0: clr.w d0 ; move.b (a3)+,d0; bra 4f
ior_l: adroff ; move.w (a1),d0 ; bra 4f
ior_z: mov (sp)+,d0
4: ble e_oddz ; move.l d0,a0
move.l d7,d2
5: asr.l #1,d0 ; dbcs d2,5b ; bcs e_oddz
add.l sp,a0 ; sub.l #1,d0
move.l d6,d1
3: mov (sp)+,d1
inor d1,(a0)+; dbra d0,3b
jmp (a4)
!----------------------------------------------------------------------------
xor_l: adroff ; move.w (a1),d0 ; bra 6f
xor_z: mov (sp)+,d0
6: ble e_oddz ; move.l d0,a0
move.l d7,d2
8: asr.l #1,d0 ; dbcs d2,8b ; bcs e_oddz
add.l sp,a0 ; sub.l #1,d0
7: mov (sp)+,d1
exor d1,(a0)+; dbra d0,7b
jmp (a4)
!----------------------------------------------------------------------------
com_l: adroff ; move.w (a1),d0 ; bra 0f
com_z: mov (sp)+,d0
0: ble e_oddz ; move.l d7,d2
1: asr.l #1,d0 ; dbcs d2,1b ; bcs e_oddz
move.l sp,a0 ; sub.l #1,d0
2: nt (a0)+ ; dbra d0,2b
jmp (a4)
!---------------------------------------------------------------------------
rol_l: adroff ; move.w (a1),d0 ; bra 3f
rol_z: mov (sp)+,d0
3: ble e_oddz ; move.l d7,d2
4: asr.l #1,d0 ; dbcs d2,4b
bcs e_oddz
sub.l #1,d0
mov (sp)+,d1
bmi 2f
0: move.l sp,a0 !d0 = #words-1 , d1 = shift count
5: mov (a0),d2 ; rotl d1,d2
mov d2,(a0)+; dbra d0,5b
jmp (a4)
2: nega d1 ; bra 0f
2: nega d1 ; bra 0b
ror_l: adroff ; move.w (a1),d0 ; bra 6f
ror_z: mov (sp)+,d0
6: ble e_oddz ; move.l d7,d2
7: asr.l #1,d0 ; dbcs d2,7b
bcs e_oddz ; sub.l #1,d0
mov (sp)+,d1
bmi 2b
0: move.l sp,a0
8: mov (a0),d2 ; rotr d1,d2
mov d2,(a0)+; dbra d0,8b
jmp (a4)
!-----------------------------------------------------------------------------
! SET GROUP
!------------------------------------------------------------------------------
set_s0: clr.w d0 ; move.b (a3)+,d0
0: ble e_oddz ; clr.l d1
mov (sp)+,d1; move.l d0,d2
move.l d7,d3
1: asr.l #1,d2 ; dbcs d3,1b
bcs e_oddz ; sub.l #1,d2
2: cl -(sp) ; dbra d2,2b
move.l sp,a0 ; move.l d1,d2
asr.l #3,d2 ; cmp.l d0,d2 !d2 byte number
bmi 3f ; bsr e_set
jmp (a4)
3:
#ifdef lword
bchg #1,d2 !0->3,1->2
#endif
bchg #0,d2 ; add.l d2,a0
bset d1,(a0) ; jmp (a4) !d1 mod 8 bit set
set_l: adroff ; move.w (a1),d0 ; bra 0b
set_z: mov (sp)+,d0; bra 0b
!----------------------------------------------------------------------------
inn_s0: clr.w d0 ; move.b (a3)+,d0
0: ble e_oddz
move.l d6,d1 ; mov (sp)+,d1
btst #0,d0 ; bne e_oddz
#ifdef lword
btst #1,d0 ; bne e_oddz
#endif
move.l sp,a0 ; add.l d0,sp
move.l d1,d2 ; asri #3,d2
comp d2,d0 ; bhi 3f
cl -(sp)
!#if test
! bsr e_set
!#endif
jmp (a4)
3:
#ifdef lword
bchg #1,d2
#else
ext.l d2
#endif
bchg #0,d2 ; add.l d2,a0
btst d1,(a0) ; beq 7f
mov #1,-(sp); jmp (a4)
7: cl -(sp) ; jmp (a4)
inn_l: adroff ; move.w (a1),d0 ; bra 0b
inn_z: mov (sp)+,d0; bra 0b

View File

@@ -1,186 +0,0 @@
!-----------------------------------------------------------------------------.
! ARRAY GROUP
!-------------------------------------------------------------------------------
!subroutine
calcarr: move.l (sp)+,d3 !save return address
move.l (sp)+,a0 !address of array describtor
mov (sp)+,d0 !index
subt (a0)+,d0 !relative address
blt 9f
comp (a0)+,d0 !check upper bound
bgt 9f
move.l #0,d1
mov (a0),d1
mulu d1,d0 !objectsize in d1
move.l (sp)+,a0
ad d0,a0 !a0 address of array element
move.l d3,-(sp)
rts
9: bsr e_array ;tst.l (sp)+ ; jmp (a4)
aar_1W: bsr calcarr ; move.l a0,-(sp)
jmp (a4)
aar_l: adroff ; cmp.w wrd,(a1)
0: bne e_illins ; bra aar_1W
aar_z: comp wrd,(sp)+ ; bra 0b
lar_1W: bsr calcarr ; add.l d1,a0
asr.w #1,d1 ; bcc 5f
clr.l d1 ; move.b -(a0),d1
mov d1,-(sp); jmp (a4)
5:
#ifdef lword
asr.w #1,d1 ; bcc 6f
move.w -(a0),d1; move.l d1,-(sp)
jmp (a4)
#endif
6: sub.l #1,d1
7: mov -(a0),-(sp); dbra d1,7b
jmp (a4)
lar_l: adroff ; cmp.w wrd,(a1)
8: bne e_illins; bra lar_1W
lar_z: comp wrd,(sp)+ ; bra 8b
sar_1W: bsr calcarr ; asr.w #1,d1
bcc 5f ; testen (sp)+
move.b -1(sp),(a0); jmp (a4)
5:
#ifdef lword
asr.w #1,d1 ; bcc 6f
tst.w (sp)+ ; move.w (sp)+,(a0)
jmp (a4)
#endif
6: sub.l #1,d1
7: mov (sp)+,(a0)+ ; dbra d1,7b
jmp (a4)
sar_z: comp wrd,(sp)+ ; bra 1f
sar_l: adroff ; cmp.w wrd,(a1)
1: bne e_illins ; bra sar_1W
!-------------------------------------------------------------------------
! CONVERT GROUP
!-------------------------------------------------------------------------w
cii_z: mov (sp)+,d0 ; mov (sp)+,d1 ; !d0 destination size
!d1 source size
#if test
cmp.w wrd,d1 ; bne 0f
comp und,(sp) ; bne 0f
bsr e_iund
#endif
0: cmp.w d0,d1 ; bne 1f ; jmp (a4)
1: bge 6f ; mov (sp)+,d2
cmp.w #1,d1 ; bne 3f !d1<d0
ext.w d2
#ifndef lword
cmp.w #2,d0 ; bne 3f
move.w d2,-(sp); jmp (a4)
#endif
3: ext.l d2 ; move.l d2,-(sp); jmp (a4)
6:
#ifdef lword
bsr e_conv ; add.l #4,sp
#else
move.w (sp)+,d2
#if test
bne 7f ; tst.w (sp) ; bge 9f
8: bsr e_conv ; jmp (a4)
7: comp #-1,d2 ; bne 8b
tst.w (sp) ; bge 8b
#endif
#endif
9: jmp (a4)
cui_z: mov (sp)+,d0 ; mov (sp)+,d1
sub.w d1,d0 ; bne 2f
#if test
testen (sp) ; bpl 1f
0: bsr e_conv
#endif
1: jmp (a4)
2:
#ifdef lword
sub.l d0,sp ; bsr e_conv
#else
bgt 3f ; cmp.w #-2,d0 ; beq 5f
bsr e_conv
#if test
tst.w (sp) ; bne 0b
tst.w 2(sp) ; bmi 0b
#endif
5: sub.l #-2,sp ; jmp (a4)
3: cmp.w #2,d0 ; beq 4f
bsr e_conv
4: clr.w -(sp)
#endif
jmp (a4)
ciu_z: mov (sp)+,d0 ; mov (sp)+,d1
#if test
cmp.w wrd,d1 ; bne 0f
comp und,(sp) ; bne 0f
bsr e_iund
#endif
0: sub.w d1,d0 ; bne 1f
jmp (a4)
#ifndef lword
1: bgt 4f ; cmp.w #-2,d0
beq 5f ; bsr e_conv
5:
#if test
move.w (sp),d1 ; beq 6f
not.w d1 ; beq 6f
bsr e_conv
#endif
6: add.l #2,sp ; jmp (a4)
#endif
4: 1: bclr #0,d0 ; beq 2f
#ifdef lword
clr.b 2(sp)
#else
clr.b (sp)
#endif
2: bclr #1,d0 ; beq 3f
#ifdef lword
clr.w (sp)
#else
clr.w -(sp)
#endif
3: jmp (a4)
cuu_z: mov (sp)+,d0 ; mov (sp)+,d1
sub.w d1,d0 ; bne 1f
jmp (a4)
1:
#ifdef lword
bsr e_conv ; sub.l d0,sp
#else
blt 3f
#if test
cmp.w #2,d0 ; beq 2f
bsr e_conv
#endif
2: clr.w -(sp) ; jmp (a4)
3:
#if test
cmp.w #-2,d0 ; beq 4f
bsr e_conv
#endif
4: tst.w (sp)+
#if test
beq 5f ; bsr e_conv
#endif
#endif
5: jmp (a4)
!--------------------------------------------------------------------------
cuf_z: cfu_z: cff_z: cfi_z: cif_z:
mov (sp)+,d0 ; subt (sp)+,d0
ext.l d0
sub.l d0,sp
#ifdef FLTRAP
bra flnim !floating point not implemented
#else
jmp (a4)
#endif

View File

@@ -1,362 +0,0 @@
!----------------------------------------------------------------------------
! SIGNED INTEGER ARITHMETIC
!------------------------------------------------------------------------------
adi_l: adroff ; move.w (a1),d0 ; bra 1f
adi_z: mov (sp)+,d0
1: sub.w wrd,d0 ; beq adi_1W
sub.w wrd,d0 ; beq adi_2W
bra e_oddz
adi_1W:
#if test
comp und,(sp) ; beq 6f
comp und,word(sp); bne 7f
6: bsr e_iund
#endif
7: mov (sp)+,d0 ; ad d0,(sp)
#if test
bvs 9f
#endif
jmp (a4)
adi_2W:
#ifdef lword
bsr no8bar ; add.l #8,sp
jmp (a4)
#else
move.l (sp)+,d0 ; add.l d0,(sp)
#endif
#if test
bvs 9f
#endif
jmp (a4)
!--------------------------------------------------------------------------
sbi_z: mov (sp)+,d0 ; bra 1f
sbi_l: adroff ; move.w (a1),d0
1: sub.w wrd,d0 ; beq sbi_1W
sub.w wrd,d0 ; beq sbi_2W
bra e_oddz
sbi_1W:
#if test
comp und,(sp) ; beq 6f
comp und,word(sp) ; bne 7f
6: bsr e_iund
#endif
7: mov (sp)+,d0 ; subt d0,(sp)
#if test
bvs 9f
#endif
jmp (a4)
sbi_2W:
#ifdef lword
add.l #8,sp ; bsr no8bar
jmp (a4)
#else
move.l (sp)+,d0 ; sub.l d0,(sp)
#endif
#if test
bvs 9f
#endif
jmp (a4)
9: bsr e_iovfl ; jmp (a4)
!----------------------------------------------------------------------------
mli_z: mov (sp)+,d0 ; bra 0f
mli_l: adroff ; move.w (a1),d0
0: sub.w wrd,d0 ; beq mli_1W
sub.w wrd,d0 ; beq mli_2W
bra e_oddz
mli_1W: mov (sp)+,d0
#if test
comp und,d0 ; beq 1f
comp und,(sp) ; bne 2f
1: bsr e_iund
#endif
2:
#ifdef lword
move.l (sp)+,d1 ; bra 4f
#else
muls (sp),d0 ; move.w d0,(sp)
#if test
bpl 3f ; not.l d0
3: swap d0 ; tst.w d0 ; bne 9b
#endif
jmp (a4)
#endif
mli_2W:
#ifdef lword
bsr no8bar ; add.l #4,sp
move.l (sp)+,d0 ; add.l #4,sp
move.l (sp)+,d1
#else
move.l (sp)+,d0 ; move.l (sp)+,d1
#endif
4: clr.w d5 ; tst.l d0 ; bpl 5f
neg.l d0 ; not.w d5
5: tst.l d1 ; bpl 6f
neg.l d1 ; not.w d5
6: bsr mlu4
#if test
tst.l d4 ; bne 7f
tst.l d0 ; bpl 8f
7: bsr e_iovfl
#endif
8: tst.w d5 ; beq 0f
neg.l d0
0: move.l d0,-(sp)
!next 4 lines only in case 8 byte arithmetic
!#ifdef lword
! bmi 1f ; clr.l -(sp) ; bra 2f
!1: move.l #-1,-(sp)
!#endif
2: jmp (a4)
!subroutine for unsigned 4byte multiplication . Expects multiplier in d0 and
! multiplicant in d1 . Returns 4 byte result in d0 . If d4=0 overflow did
! not occur on the multiplication , else it did .
.define mlu4
.text
mlu4: move.l d1,d3 ; move.l d0,d2
swap d2 ; swap d3
#if test
move.l d3,d4 ; mulu d2,d4
#endif
mulu d0,d3 ; swap d3
mulu d1,d2 ; swap d2
#if test
or.w d3,d4 ; or.w d2,d4
#endif
clr.w d3 ; clr.w d2
mulu d1,d0 ; add.l d3,d0
#if test
bvc 1f ; bset #0,d4
#endif
1: add.l d2,d0
#if test
bvc 2f ; bset #0,d4
#endif
2: rts
!---------------------------------------------------------------------------
dvi_z: mov (sp)+,d0 ; bra 0f
dvi_l: adroff ; move.w (a1),d0
0: sub.w wrd,d0 ; beq dvi_1W
sub.w wrd,d0 ; beq dvi_2W
bra e_oddz
dvi_1W:
#ifdef lword
bsr dvi4 ; move.l d1,-(sp)
#else
bsr dvi2 ; move.w d1,-(sp)
#endif
jmp (a4)
dvi_2W:
#ifdef lword
bsr no8bar ; tst.l (sp)+
move.l (sp)+,(sp) ; bsr dvi4
move.l d1,-(sp) ; clr.l -(sp)
#else
bsr dvi4 ; move.l d1,-(sp)
#endif
jmp (a4)
rmi_z: mov (sp)+,d0 ; bra 1f
rmi_l: adroff ; move.w (a1),d0
1: sub.l wrd,d0 ; beq rmi_1W
sub.l wrd,d0 ; beq rmi_2W
bra e_oddz
rmi_1W:
#ifdef lword
bsr dvi4 ; move.l d3,-(sp)
#else
bsr dvi2 ; swap d1
move.w d1,-(sp)
#endif
jmp (a4)
rmi_2W:
#ifdef lword
bsr no8bar ; tst.l (sp)+
move.l (sp)+,(sp) ; bsr dvi4
move.l d3,-(sp) ; clr.l -(sp)
#else
bsr dvi4 ; move.l d3,-(sp)
#endif
jmp (a4)
! 2byte division . In d1: quotient=low word ; remainder=high word
dvi2: move.l (sp)+,d2
move.w (sp)+,d0 !divisor
move.w (sp)+,d1 ; ext.l d1 !dividend
#if test
cmp.w und,d1 ; bne 1f
bsr e_iund
1: cmp.w und,d0 ; bne 2f
bsr e_iund
2: tst.w d0 ; bne 3f
bsr e_idivz ; move.l und,d1 ; bra 4f
3:
#endif
divs d0,d1
4: move.l d2,-(sp) ; rts
! long signed division . quotient in d1 , remainder in d3
dvi4: move.l (sp)+,d5
move.l (sp)+,d0 !divisor
move.l (sp)+,d1 !dividend
#ifdef lword
cmp.l und,d0 ; beq 0f
cmp.l und,d1 ; bne 1f
0: bsr e_iund
1:
#endif
clr.l d4 !sign in d4
tst.l d0 ; bpl 1f
neg.l d0 ; not.w d4
1: tst.l d1 ; bpl 2f
neg.l d1
not.w d4 ; swap d4
not.w d4 ; swap d4
2: bsr dvu4
tst.w d4 ; beq 3f
neg.l d1 !quotient
3: tst.l d4 ; bpl 4f
neg.l d3 !remainder
4: move.l d5,-(sp) ; rts
!Expects d0 divisor , d1 dividend. Gives d1 quotient ,d3 remainder
.define dvu4
.text
dvu4:
#if test
tst.l d0 ; bne 1f
bsr e_idivz
1:
#endif
clr.l d3 ; move.l #32,d2
3: lsl.l #1,d1 ; roxl.l #1,d3
cmp.l d0,d3 ; blt 4f
sub.l d0,d3 ; add.l #1,d1
4: sub.w #1,d2 ; bgt 3b
rts
!----------------------------------------------------------------------------
ngi_z: mov (sp)+,d0 ; bra 0f
ngi_l: adroff ; move.w (a1),d0
0: sub.l wrd,d0 ; bne 2f
#if test
comp und,(sp) ; bne 1f
bsr e_iund
1:
#endif
nega (sp) ; jmp (a4)
2: cmp.l wrd,d0 ; beq 3f
bra e_oddz
3:
#ifdef lword
bsr no8bar ; not.l (sp)
neg.l 4(sp)
#else
neg.l (sp)
#endif
#if test
bvc 4f ; bsr e_iovfl
4:
#endif
jmp (a4)
!--------------------------------------------------------------------------
sli_z: mov (sp)+,d0 ; bra 0f
sli_l: adroff ; move.w (a1),d0
0: sub.w wrd,d0 ; beq sli_1W
sub.w wrd,d0 ; beq sli2
bra e_oddz
sli_1W: mov (sp)+,d0 !d0 contains the shift count
bmi 5f
9: mov (sp)+,d1 !integer to shift
#if test
comp und,d0 ; bne 1f
bsr e_iund
1:
#endif
asle d0,d1 ! ASLE
#if test
bvc 2f ; bsr e_iovfl
2:
#endif
mov d1,-(sp) ; jmp (a4)
sli2:
#ifdef lword
bsr no8bar ; move.l (sp)+,d1
move.l (sp)+,d2 ; move.l (sp)+,d0
3: asl.l #1,d0 ; roxl.l #1,d2
sub.l #1,d1 ; bgt 3b
move.l d0,-(sp) ; move.l d2,-(sp)
#else
move.w (sp)+,d0
bmi 6f
8: move.l (sp),d1
asl.l d0,d1
#if test
bvc 4f ; bsr e_iovfl
4:
#endif
move.l d1,(sp)
#endif
jmp (a4)
5: nega d0 ; bra 8f
#ifndef lword
6: neg.w d0 ; bra 9f
#endif
!------------------------------------------------------------------------------
7: nega d0 ; bra 9b
#ifndef lword
6: neg.w d0 ; bra 8b
#endif
sri_z: mov (sp)+,d0 ; bra 0f
sri_l: adroff ; move.w (a1),d0
0: sub.w wrd,d0 ; bne sri2
mov (sp)+,d0
bmi 7b
8: mov (sp)+,d1
#if test
comp und,d0 ; bne 1f
bsr e_iund
1:
#endif
asri d0,d1
#if test
bvc 2f ; bsr e_iovfl
2:
#endif
mov d1,-(sp) ; jmp (a4)
sri2: sub.w wrd,d0 ; beq 3f
bra e_oddz
3:
#ifdef lword
bsr no8bar ; move.l (sp)+,d1
move.l (sp)+,d2 ; move.l (sp),d0
sub.l #1,d1
4: asr.l #1,d2 ; roxr.l #1,d0 ; dbra d1,4b
move.l d0,(sp) ; move.l d2,-(sp)
#else
move.w (sp)+,d0
bmi 6b
9: move.l (sp),d1
asr.l d0,d1
#if test
bvc 5f ; bsr e_iovfl
5:
#endif
move.l d1,(sp)
#endif
jmp (a4)

View File

@@ -1,120 +0,0 @@
!------------------------------------------------------------------------------
! UNSIGNED ARITHMETIC
!-----------------------------------------------------------------------------
adu_z: mov (sp)+,d0 ; bra 0f
adu_l: adroff ; move.w (a1),d0
0: checksize
2: move.w (sp)+,d1 ; add.w d1,(sp)
jmp (a4)
4: move.l (sp)+,d1; add.l d1,(sp)
jmp (a4)
sbu_z: mov (sp)+,d0 ; bra 0f
sbu_l: adroff ; move.w (a1),d0
0: checksize
2: move.w (sp)+,d1 ; sub.w d1,(sp)
jmp (a4)
4: move.w (sp)+,d1 ; sub.l d1,(sp)
jmp (a4)
!------------------------------------------------------------------------------
mlu_z: mov (sp)+,d0 ; bra 0f
mlu_l: adroff ; move.w (a1),d0
0: checksize
2: move.w (sp)+,d0 ; mulu (sp),d0
move.w d0,(sp) ; jmp (a4)
4: move.l (sp)+,d0 ; move.l (sp),d1
bsr mlu4 ; move.l d0,(sp)
jmp (a4)
!----------------------------------------------------------------------------
dvu_z: mov (sp)+,d0 ; bra 0f
dvu_l: adroff ; move.w (a1),d0
0: checksize
2: move.w (sp)+,d1 ; beq 3f
move.w (sp),d0 ; divu d1,d0
move.w d0,(sp) ; jmp (a4)
3: bsr e_idivz ; move.w #-1,(sp)
jmp (a4)
4: move.l (sp)+,d0 ; move.l (sp),d1
bsr dvu4 ; move.l d1,(sp)
jmp (a4)
!----------------------------------------------------------------------------
rmu_z: mov (sp)+,d0 ; bra 0f
rmu_l: adroff ; move.w (a1),d0
0: checksize
2: move.w (sp)+,d1 ; beq 3f
move.w (sp),d0 ; divu d1,d0
swap d0 ; move.w d0,(sp)
jmp (a4)
3: bsr e_idivz ; clr.w (sp)
jmp (a4)
4: move.l (sp)+,d0 ; move.l (sp),d1
bsr dvu4 ; move.l d3,(sp)
jmp (a4)
!------------------------------------------------------------------------.
slu_z: mov (sp)+,d0 ; bra 0f
slu_l: adroff ; move.w (a1),d0
0: checksize
2: move.w (sp)+,d0
bmi 7f
3: move.w (sp),d1
lsl.w d0,d1 ; move.w d1,(sp)
jmp (a4)
4: mov (sp)+,d0
bmi 9f
5: move.l (sp),d1
lsl.l d0,d1 ; move.l d1,(sp)
jmp (a4)
7: neg.w d0 ; bra 3f
9: nega d0 ; bra 5f
7: neg.w d0 ; bra 3b
9: nega d0 ; bra 5b
sru_z: mov (sp)+,d0 ; bra 0f
sru_l: adroff ; move.w (a1),d0
0: checksize
2: move.w (sp)+,d0
bmi 7b
3: move.w (sp),d1
lsr.w d0,d1 ; move.w d1,(sp)
jmp (a4)
4: mov (sp)+,d0
bmi 9b
5: move.l (sp),d1
lsr.l d0,d1 ; move.l d1,(sp)
jmp (a4)
!------------------------------------------------------------------------------
! DUMMY FLOATING POINT ROUTINES
!------------------------------------------------------------------------------
adf_l: sbf_l: mlf_l: dvf_l:
adroff ; move.w (a1),d0
1: add.l d0,sp
#ifdef FLTRAP
bra flnim
#else
jmp (a4)
#endif
adf_z: sbf_z: mlf_z: dvf_z:
mov (sp)+,d0 ; bra 1b
adf_s0: sbf_s0: mlf_s0: dvf_s0:
move.l #0,d0 ; move.b (a3)+,d0
bra 1b
fef_l: sub.l wrd,sp
fif_l: ngf_l: adroff
fef_z:
#ifdef FLTRAP
bra flnim
#else
jmp (a4)
#endif
ngf_z: fif_z: add.l wrd,sp ; bra fef_z

View File

@@ -1,234 +0,0 @@
!-------------------------------------------------------------------------
! TEST AND BRANCH GROUP
!-------------------------------------------------------------------------
tlt_z: testen (sp)+ ; blt true ; cl -(sp) ; jmp (a4)
tle_z: testen (sp)+ ; ble true ; cl -(sp) ; jmp (a4)
teq_z: testen (sp)+ ; beq true ; cl -(sp) ; jmp (a4)
tne_z: testen (sp)+ ; bne true ; cl -(sp) ; jmp (a4)
tge_z: testen (sp)+ ; bge true ; cl -(sp) ; jmp (a4)
tgt_z: testen (sp)+ ; bgt true ; cl -(sp) ; jmp (a4)
true: mov #1,-(sp) ; jmp (a4)
zlt_s0: testen (sp)+ ; blt bra_s0 ; bra nobr2
zlt_l: testen (sp)+ ; blt bra_l ; bra nobr3
zlt_q: move.l (sp)+,d0
testen (sp)+ ; blt 1f ; jmp (a4)
zle_s0: testen (sp)+ ; ble bra_s0 ; bra nobr2
zle_l: testen (sp)+ ; ble bra_l ; bra nobr3
zle_q: move.l (sp)+,d0
testen (sp)+ ; ble 1f ; jmp (a4)
zeq_s0: testen (sp)+ ; beq bra_s0 ; bra nobr2
zeq_s1: testen (sp)+ ; beq bra_s1 ; bra nobr2
zeq_l: testen (sp)+ ; beq bra_l ; bra nobr3
zeq_q: move.l (sp)+,d0
testen (sp)+ ; beq 1f ; jmp (a4)
zne_s0: testen (sp)+ ; bne bra_s0 ; bra nobr2
zne_s_1: testen (sp)+ ; bne bra_s_1 ; bra nobr2
zne_l: testen (sp)+ ; bne bra_l ; bra nobr3
zne_q: move.l (sp)+,d0
testen (sp)+ ; bne 1f ; jmp (a4)
zge_s0: testen (sp)+ ; bge bra_s0 ; bra nobr2
zge_l: testen (sp)+ ; bge bra_l ; bra nobr3
zge_q: move.l (sp)+,d0
testen (sp)+ ; bge 1f ; jmp (a4)
zgt_s0: testen (sp)+ ; bgt bra_s0 ; bra nobr2
zgt_l: testen (sp)+ ; bgt bra_l ; bra nobr3
zgt_q: move.l (sp)+,d0
testen (sp)+ ; bgt 1f ; jmp (a4)
blt_s0: comp (sp)+,(sp)+ ; blt bra_s0 ; bra nobr2
blt_l: comp (sp)+,(sp)+ ; blt bra_l ; bra nobr3
blt_q: move.l (sp)+,d0
comp (sp)+,(sp)+ ; blt 1f ; jmp (a4)
ble_s0: comp (sp)+,(sp)+ ; ble bra_s0 ; bra nobr2
ble_l: comp (sp)+,(sp)+ ; ble bra_l ; bra nobr3
ble_q: move.l (sp)+,d0
comp (sp)+,(sp)+ ; ble 1f ; jmp (a4)
beq_s0: comp (sp)+,(sp)+ ; beq bra_s0 ; bra nobr2
beq_l: comp (sp)+,(sp)+ ; beq bra_l ; bra nobr3
beq_q: move.l (sp)+,d0
comp (sp)+,(sp)+ ; beq 1f ; jmp (a4)
bne_s0: comp (sp)+,(sp)+ ; bne bra_s0 ; bra nobr2
bne_l: comp (sp)+,(sp)+ ; bne bra_l ; bra nobr3
bne_q: move.l (sp)+,d0
comp (sp)+,(sp)+ ; bne 1f ; jmp (a4)
bge_s0: comp (sp)+,(sp)+ ; bge bra_s0 ; bra nobr2
bge_l: comp (sp)+,(sp)+ ; bge bra_l ; bra nobr3
bge_q: move.l (sp)+,d0
comp (sp)+,(sp)+ ; bge 1f ; jmp (a4)
bgt_s0: comp (sp)+,(sp)+ ; bgt bra_s0 ; bra nobr2
bgt_l: comp (sp)+,(sp)+ ; bgt bra_l ; bra nobr3
bgt_q: move.l (sp)+,d0
comp (sp)+,(sp)+ ; bgt 1f ; jmp (a4)
bra_s0:
move.l d6,d0
0: move.b (a3)+,d0
1: add.l d0,a3 ; jmp (a4)
bra_l: move.b (a3)+,-(sp) ; move.b (a3)+,1(sp)
move.w (sp)+,d0 ; ext.l d0
bra 1b
bra_q:
move.l (sp)+,d0 ; bra 1b
bra_s1: move.w #0x100,d0 ; bra 0b
bra_s_1: move.l #-1,d0 ; bra 0b
bra_s_2: move.l #-0x200,d0 ; bra 0b
nobr2: add.l #1,a3 ; jmp (a4)
nobr3: add.l #2,a3 ; jmp (a4)
!---------------------------------------------------------------------------
! COMPARE GROUP
!-----------------------------------------------------------------------------
cmi_z: mov (sp)+,d0 ; bra 0f
cmi_l: adroff ; move.w (a1),d0
0: sub.w wrd,d0 ; beq cmi_1W
sub.w wrd,d0 ; beq cmi_2W
bra e_oddz
cmi_1W: comp (sp)+,(sp)+ ; bgt 1f ; beq 2f
3: mov #-1,-(sp) ; jmp (a4)
1: mov #1,-(sp) ; jmp (a4)
2: cl -(sp) ; jmp (a4)
cmi_2W:
#ifdef lword
bsr no8bar ; bra e_oddz
#endif
cmp.l (sp)+,(sp)+ ; blt 3b ; beq 2b
bra 1b
cmu_z: mov (sp)+,d0 ; bra 4f
cmu_l: adroff ; move.w (a1),d0
4: sub.w wrd,d0 ; bne 5f
comp (sp)+,(sp)+ ; bcs 3b
beq 2b ; bra 1b
5: sub.w wrd,d0 ; bne e_oddz
#ifdef lword
bsr no8bar ; bra e_oddz
#endif
cmp_z: cmp.l (sp)+,(sp)+ ; bcs 3b
beq 2b ; bra 1b
cms_l: adroff ; move.w (a1),d0
bra 0f
cms_z: mov (sp)+,d0 ; bra 0f
cms_s0: move.l d6,d0 ; move.b (a3)+,d0
0: move.l d0,d1 ; move.l sp,a0
asri wmu,d1 ; subt #1,d1
add.l d0,sp ; move.l sp,d2
1: comp (a0)+,(sp)+ ; bne 2f
dbra d1,1b
mov d6,-(sp) ; jmp (a4)
2: add.l d0,d2 ; move.l d2,sp
move.l #1,d1 ; mov d1,-(sp)
jmp (a4)
! DUMMY FLOAT ROUTINES. POINTER ADJUSTMENT AND WARNING
cmf_s0: move.l d6,d0 ; move.b (a3)+,d0
9: add.w d0,d0 ; add.l d0,sp
cl -(sp)
#ifdef FLTRAP
bra flnim
#else
jmp (a4)
#endif
cmf_l: adroff ; move.w (a1),d0 ; bra 9b
cmf_z: mov (sp)+,d0 ; bra 9b
!-------------------------------------------------------------------------
! CALL AND RETURN GROUP
!----------------------------------------------------------------------------
cai_z: move.l (sp)+,d0 ; bra 1f
cal_q: move.l (sp)+,d0 ; bra 1f
cal_l: adroff ; move.w (a1),d0 ; bra 1f
cal_s0: move.w d6,d0 ; move.b (a3)+,d0 ; bra 1f
cal_1: cal_2: cal_3: cal_4: cal_5: cal_6: cal_7: cal_8:
cal_9: cal_10: cal_11: cal_12: cal_13: cal_14: cal_15: cal_16:
cal_17: cal_18: cal_19: cal_20: cal_21: cal_22: cal_23: cal_24:
cal_25: cal_26: cal_27: cal_28:
asr.w #2,d0 ; sub.w #0x3F,d0
lblcal:
1: cmp.l nproc,d0 ; bhi e_badpc
asl.l #3,d0
#if flow + count + prof
move.l d0,d1 ; asl.l #1,d1
add.l d1,d0 !PROC DES. 24 BYTES
#endif
move.l (a6),-(sp)
move.l 4(a6),-(sp) ; move.l a3,-(sp)
link a2,#0 ; move.l d0,a0
add.l pd,a0 !a0 points at proc. des.
#if prof+count+flow
tst.l 20(a0) !A FILE NAME DEFINED IN THIS PROC
bne 4f !YES ? CONTINUE
move.l 8(sp),20(a0) !NO ? TAKE OLD FILE NAME
4: move.l curproc,8(sp) !SAVE OLD PROCEDURE DESCRIPTOR
move.l a0,curproc !CONTINUE WITH NEW ONE
move.l 8(a0),d0 !COUNT POINTER MINUS LINE NUMBER
sub.l 12(a0),d0 !OF FIRST LINE IN countfld
move.l d0,countfld
#endif
move.l (a0)+,d1 ; sub.l d1,sp
claimstack ; add.l d1,sp
tst.l d1 ; beq 3f
sub.l #1,d1 ; asr.l wmu,d1
2: mov und,-(sp) ; dbra d1,2b
3: move.l (a0),a3 ; jmp (a4)
ret_l: adroff ; move.w (a1),d0
bra 1f
ret_s0: move.l d6,d0 ; move.b (a3)+,d0
bra 1f
ret_1W: move.w d6,d0 ; bra 5f
1: blt e_oddz ; beq ret_0
comp #32,d0 ; ble 2f
bsr e_badlfr
2: sub.w #1,d0 ; asr.w wmu,d0
5: move.w d0,retsize !RETSIZE CONTAINS
3: mov (sp)+,(a1)+ ; dbra d0,3b ! #WORDS-1
lea retarea,a1 ; bra 4f
ret_0: move.w #-1,retsize
4: unlk a2 ; cmp.l a2,d6
beq hlt_z ; move.l (sp)+,a3
move.l (sp)+,a0 !FILE OR PROC DES BASE IN a0
#if count+flow+prof
move.l a0,curproc !SAVE PROC DES BASE CUR PROC
move.l 8(a0),d0 !d0 IS COUNT
sub.l 12(a0),d0 !d0 IS COUNT-FIRST LINE
move.l d0,countfld !RESTORE POINTER
add.l (sp),d0 !ADD LINE NUMBER
move.l d0,countptr
#if prof
beq 5f
asl.l #2,d0
add.l ltime,d0
move.l d0,profile !profile POINTS AT COUNT
5:
#endif
move.l 20(a0),a0 !POINTER TO FILE NAME IN a0
#endif
move.l a0,4(a6) !OLD FILE ADDRESS
move.l (sp)+,(a6) !OLD LINE NUMBER
jmp (a4)
lfr_1W: move.w d6,d0 ; move.l wrd,d1
0: cmp.w retsize,d0 ; beq 1f
bsr e_badlfr
1: add.l d1,a1
2: mov -(a1),-(sp) ; dbra d0,2b
5: jmp (a4)
lfr_l: move.b (a3)+,-(sp) ; move.b (a3)+,1(sp)
move.w (sp)+,d0 ; bra 3f
lfr_s0: move.l d6,d0 ; move.b (a3)+,d0
3: move.l d7,d2 ; move.l d0,d1
4: asr.w #1,d0 ; bcs e_illins
dbra d2,4b ; beq 5b
sub.w #1,d0 ; bra 0b
lfr_2W: move.l wrd,d1 ; add.l d1,d1
move.l #1,d0 ; bra 0b
e_badlfr: mov 0xD,-(sp) ; bra error

View File

@@ -1,296 +0,0 @@
!---------------------------------------------------------------------------
! MISCELLANEOUS
!----------------------------------------------------------------------------
ass_z: mov (sp)+,d0 ; bra 5f
ass_l: move.b (a3)+,-(sp) ; move.b (a3)+,1(sp)
move.w (sp)+,d0
5: checksize
bra e_oddz
4: move.l (sp)+,d0 ; bpl 3f
asr.l wmu,d0 ; bra 8f
2: move.w (sp)+,d0 ; bpl 3f
asr.w #1,d0 ; ext.l d0
bra 8f
asp_1W: asp_2W: asp_3W: asp_4W: asp_5W:
sub.w #176,d0
#ifndef lword
asr.l #1,d0
#endif
3: add.l d0,sp ; jmp (a4)
asp_w0: move.l d6,d0 ; move.b (a3)+,d0
5: asl.l wmu,d0 ; bra 3b
asp_lw: move.b (a3)+,-(sp) ; move.b (a3)+,1(sp)
move.w (sp)+,d0 ; ext.l d0
6: bmi 8f
asl.l wmu,d0 ; bra 3b
8: neg.l d0 ; sub.l #1,d0
1: mov und,-(sp) ; dbra d0,1b
jmp (a4)
asp_qw: move.l (sp)+,d0 ; bra 6b
!-----------------------------------------------------------------------------
bls_z: mov (sp)+,d0 ; bra 0f
bls_l: adroff ; move.w (a1),d0
0: checksize
2: move.w (sp)+,d0 ; bra 0f
4: move.l (sp)+,d0 ; bra 0f
blm_q: move.l (sp)+,d0 ; bra 0f
blm_l: adroff ; move.w (a1),d0
bra 0f
blm_s0: move.l d6,d0 ; move.b (a3)+,d0
0: move.l d0,d2 ; asr.w wmu,d2
beq 5f ; move.l a1,d1
sub.w #1,d2 ; move.l (sp)+,a0 !dest. address
move.l (sp)+,a1 ; cmp.l a0,a1
!a1 contains source address. beware of overlap of pieces
beq 3f ; bcs 2f
1: mov (a1)+,(a0)+ ; dbra d2,1b
3: move.l d1,a1
5: jmp (a4)
2: add.l d0,a1 ; add.l d0,a0
4: mov -(a1),-(a0) ; dbra d2,4b
bra 3b
!----------------------------------------------------------------------------
csa_z: mov (sp)+,d0 ; bra 0f
csa_l: adroff ; move.w (a1),d0
0: sub.l wrd,d0 ; bne e_illins
csa_1W: move.l (sp)+,a0 ; mov (sp)+,d0
ext.l d0
add.l #4,a0 ; subt (a0),d0
blt 6f
comp word(a0),d0 ; bhi 6f
asl.l #2,d0 ; add.l wrd,d0
move.l word(a0,d0),d1 ; bne 5f
6: sub.l #4,a0 ; move.l (a0),d1
beq e_case
5: move.l d1,a3 ; jmp (a4)
csb_z: mov (sp)+,d0 ; bra 0f
csb_l: adroff ; move.w (a1),d0
0: comp wrd,d0 ; bne e_illins
csb_1W: move.l (sp)+,a0 ; mov (sp)+,d0
mov 4(a0),d1 ; sub.l #1,d1
move.l a0,a3
!Use a3 as a general register
move.l wrd,d2 ; add.l #4,d2
1: add.l d2,a0 ; comp (a0),d0
dbeq d1,1b ; bne 2f
move.l word(a0),d1 ; beq e_case
move.l d1,a3 ; jmp (a4)
2: move.l (a3),d1 ; beq e_case
move.l d1,a3 ; jmp (a4)
!-----------------------------------------------------------------------------
dch_z: move.l (sp)+,a0 ; move.l (a0),-(sp)
move.l ml,a0 ; cmp.l (sp),a0
bls e_badptr ; jmp (a4)
lpb_z: add.l #16,(sp) ; jmp (a4)
!----------------------------------------------------------------------------
dup_1W: mov (sp),-(sp) ; jmp (a4)
dup_l: adroff ; move.w (a1),d0
bra 1f
dus_z: mov (sp)+,d0 ; bra 0f
dus_l: adroff ; move.w (a1),d0
0: checksize
2: move.w (sp)+,d0 ; bra 1f
4: move.l (sp)+,d0
1: ble e_oddz ; bclr #0,d0
move.l sp,a0 ; add.l d0,a0
asr.l wmu,d0 ; sub.l #1,d0
3: mov -(a0),-(sp) ; dbra d0,3b
jmp (a4)
!We do not test if d0 is indeed a word multiple . This can eventually be done
!in the usual way.
!-----------------------------------------------------------------------------
exg_z: mov (sp)+,d0 ; bra 0f
exg_l: adroff ; move.w (a1),d0
bra 0f
exg_s0: move.l d6,d0 ; move.b (a3)+,d0
0: move.l d7,d1 ; move.l d0,a0
1: asri #1,d0 ; dbcs d1,1b
bcs e_oddz ; sub.l #1,d0
add.l a0,sp ; add.l sp,a0
2: mov -(sp),d1 ; mov -(a0),(sp)
mov d1,(a0) ; dbra d0,2b
jmp (a4)
gto_q: move.l (sp)+,a0 ; bra 3f
gto_l: move.l d6,a0 ; move.b (a3)+,-(sp)
move.b (a3)+,1(sp) ; move.w (sp)+,a0
3: add.l a6,a0 ; move.l (a0)+,a3
move.l (a0)+,sp ; move.l (a0),a2
jmp (a4)
lim_z: move.w ignmask,-(sp) ; jmp (a4)
sim_z: move.w (sp)+,ignmask ; jmp (a4)
.bss
ignmask: .space 2
.define ignmask
.text
!---------------------------------------------------------------------------
lor_s0: move.l d6,d0 ; move.b (a3)+,d0
bne 1f ; move.l a2,-(sp)
jmp (a4)
1: sub.w #1,d0 ; bne 2f
move.l sp,-(sp) ; jmp (a4)
2: sub.w #1,d0 ; bne e_illins
move.l hp,-(sp) ; jmp (a4)
str_s0: move.l d6,d0 ; move.b (a3)+,d0
bne 1f ; move.l (sp)+,a2
jmp (a4)
1: sub.w #1,d0 ; bne 2f
move.l (sp)+,sp ; claimstack
jmp (a4)
2: sub.w #1,d0 ; bne e_illins
move.l (sp)+,d1 ; cmp.l nd,d1
bcc 3f !break
cmp.l tblmax,d1 ; bcs 4f
5: move.l d1,hp ; jmp (a4)
3: move.l d1,-(sp) ; add.l #1280,(sp)
bsr _break ; testen (sp)+
4: bne e_heap ; bra 5b
!----------------------------------------------------------------------------
rck_z: mov (sp)+,d0 ; bra 0f
rck_l: adroff ; move.w (a1),d0
0: sub.l wrd,d0 ; beq rck_1W
sub.l wrd,d0 ; bne e_oddz
move.l (sp)+,a0
mov (sp),d0 ; comp (a0),d0 ; blt 9f
add.l wrd,a0 ; bra 1f
rck_1W: move.l (sp)+,a0
mov (sp),d0 ; comp (a0),d0 ; blt 9f
1: comp word(a0),d0 ; bgt 9f
jmp (a4)
9: bra e_range
!Temp. solution until trp_z is implemented
!--------------------------------------------------------------------------
nop_z:
lblnop: lea nopln+16,a0 ; move.l (a6),d1
bsr itoa
lea nopln+33,a0 ; move.l sp,d1
bsr itoa
move.l #45,-(sp)
pea nopln ; mov #1,-(sp)
bsr _write
add.l wrd+4,sp
jmp (a4)
.data
nopln: .asciz "line number nop sp \n"
.align 2
.text
!unsigned to ascii for integers , a0 is address of first character
! d1 contains integer. Output is 11 characters of which the first is a space.
.define itoa
.text
itoa: move.l #9,d4 ; add.l #11,a0
move.l #10,d0
0: bsr dvu4 ; add.w #48,d3
move.b d3,-(a0) ; tst.l d1
dbeq d4,0b
1: move.b #32,-(a0) ; dbra d4,1b
rts
!------------------------------------------------------------------------------
fil_q: move.l (sp)+,a0 ; bra 3f
fil_l: adroff ; move.w (a1),d0
move.l d0,a0
3: add.l a6,a0 ; cmp.l 4(a6),a0
beq 0f
#if flow+count+prof
move.l curproc,a5
move.l 8(a5),d0
sub.l 12(a5),d0
move.l d0,countfld !START COUNTPTR FOR THIS PROC
move.l a0,20(a5) !FILE POINTER IN PROC DES
#endif
move.l a0,4(a6)
0: jmp (a4)
!-----------------------------------------------------------------------------
lni_z: add.l #1,(a6)
#if count+flow+prof
add.l #1,countptr
#if prof
add.l #4,profile
#endif
#endif
bra 8f
lin_l: adroff ; move.w (a1),d0 ; bra 1f
lin_q: move.l (sp)+,d0 ; bra 1f
lin_s0: move.l #0,d0 ; move.b (a3)+,d0
1: cmp.l (a6),d0 ; beq 9f
move.l d0,(a6)
#if count+flow+prof
move.l countfld,d1
add.l d0,d1
move.l d1,countptr
#if prof
asl.l #2,d1
add.l ltime,d1
move.l d1,profile
#endif
#endif
8:
#if last
bsr nexttab ; move.l 4(a6),(a5)+ !store new line
move.l (a6),(a5) !number in buffer lasttable
#endif
#if count
move.l countptr,d1 !LINE NUMBER IN d1
asl.l #2,d1 !MULTIPLY BY 4
move.l lcount,a0
add.l #1,0(a0,d1) !ADD 1 TO THE CORRESPONDING COUNT
#endif
#if flow
move.l countptr,d1 !LINE NUMBER IN d1
move.l #8,d0
bsr dvu4
!QUOTIENT IN d1 REST IN d3
move.l lflow,a0
bset d3,0(a0,d1)
!ATTENTION BIT 0 CORR TO LINE 0
#endif
!9: bra nop_z
9: jmp (a4)
!----------------------------------------------------------------------------
mon_z: mov (sp)+,d0 ; bmi e_badmon
cmp.l #64,d0 ; bge e_badmon
move.l a4,-(sp) ; asl.l #2,d0
add.l #syscal,d0 ; move.l d0,a0
move.l (a0),a0 ; jmp (a0)
.data
syscal:
.long e_badmon ; .long hlt_z ; .long _fork ; .long _read
.long _write ; .long _open ; .long _close ; .long _wait
.long _creat ; .long _link ; .long _unlink ; .long e_badmon
.long _chdir ; .long e_badmon ; .long _mknod ; .long _chmod
.long _chown ; .long _break ; .long _stat ; .long _lseek
.long _getpid ; .long _mount ; .long _umount ; .long _setuid
.long _getuid ; .long _stime ; .long _ptrace ; .long _alarm
.long _fstat ; .long _pause ; .long _utime ; .long e_badmon
.long e_badmon ; .long _access ; .long _nice ; .long _ftime
.long _sync ; .long _kill ; .long e_badmon ; .long e_badmon
.long e_badmon ; .long _dup ; .long _pipe ; .long _times
.long _profil ; .long e_badmon ; .long _setgid ; .long _getgid
.long _sigtrp ; .long e_badmon ; .long e_badmon ; .long _acct
.long e_badmon ; .long _lock ; .long _ioctl ; .long e_badmon
.long _mpxcall ; .long e_badmon ; .long e_badmon ; .long _exece
.long _umask ; .long _chroot ; .long e_badmon ; .long e_badmon
.text

View File

@@ -1,341 +0,0 @@
e_array: cl -(sp) ; bra error
e_range: mov #0x1,-(sp) ; bra error
e_set: mov #0x2,-(sp) ; bra error
e_iovfl: mov #0x3,-(sp) ; bra error
e_fovfl: mov #0x4,-(sp) ; bra error
e_funfl: mov #0x5,-(sp) ; bra error
e_idivz: mov #0x6,-(sp) ; bra error
e_fdivz: mov #0x7,-(sp) ; bra error
e_iund: mov #0x8,-(sp) ; bra error
e_fund: mov #0x9,-(sp) ; bra error
e_conv: mov #0xA,-(sp) ; bra error
e_stack: mov #0x10,-(sp) ; bra fatal
e_heap: mov #0x11,-(sp) ; bra fatal
e_illins: mov #0x12,-(sp) ; bra fatal
e_oddz: mov #0x13,-(sp) ; bra fatal
e_case: mov #0x11,-(sp) ; bra fatal
e_memflt: mov #0x15,-(sp) ; bra fatal
e_badptr: mov #0x16,-(sp) ; bra fatal
e_badpc: mov #0x17,-(sp) ; bra fatal
e_badlae: mov #0x18,-(sp) ; bra error
e_badmon: mov #0x19,-(sp) ; bra error
e_badlin: mov #0x1A,-(sp) ; bra error
e_badgto: mov #0x1B,-(sp) ; bra error
flnim: mov #0xB,-(sp) ; bra error
no8bar: mov #0xC,-(sp) ; bra error
.define e_memflt
!---------------------------------------------------------------------------
! ERRORS AND TRAPS
!----------------------------------------------------------------------------
fatal: clr.l -(sp) !dummy return address
pea hlt_z !RETURN FROM FATAL HALTS
mov 8(sp),-(sp)
error: movem.l d0/d1/d2/d3/d4/d5/d6/d7/a0/a1/a2/a3/a4/a5/a6,-(sp)
mov 60(sp),d0 !ERROR NUMBER IN d0
lea retsize,a5
move.l #16,d1
1: move.w -(a5),-(sp)
dbra d1,1b
cmp.w #0xB,d0
bge 0f !FATAL ERROR , START ERROR HANDLING
move.l #0x1,d1
asl.l d0,d1
move.w ignmask,d2
not.w d2
and.w d2,d1
bne 0f
move.l #16,d1
lea retsize,a5
1: move.w (sp)+,(a5)+
dbra d1,1b
movem.l (sp)+,d0/d1/d2/d3/d4/d5/d6/d7/a0/a1/a2/a3/a4/a5/a6
add.l wrd,sp !REMOVE ERROR NUMBER
rts
0: move.l uerrorp,a0
cmp.l #-1,a0
beq notrap
mov d0,-(sp)
move.l uerrorp,-(sp)
move.l #-1,uerrorp !USER MUST SET TRAP AGAIN
bra cai_z
!-----------------------------------------------------------------------------
rtt_z: move.l a2,sp
add.l #0x10,sp !REMOVE RETURN STATUS BLOCK
add.l wrd,sp !REMOVE ERROR NUMBER
move.l #16,d0
lea retsize,a5
1: move.w (sp)+,(a5)+
dbra d0,1b
movem.l (sp)+,d0/d1/d2/d3/d4/d5/d6/d7/a0/a1/a2/a3/a4/a5/a6
add.l wrd,sp
rts
trp_z: sub.l #4,sp
mov 4(sp),(sp) !COPY ERROR NUMBER
move.l a4,word(sp) !RETURN ADDRESS TO MAIN LOOP
bra error
sig_z: move.l (sp),d0
move.l uerrorp,(sp)
move.l d0,uerrorp
jmp (a4)
.data
uerrorp: .long 0x-1
.text
!-----------------------------------------------------------------------------
!FIRST INFORMATION ABOUT THE KIND OF THE ERROR
notrap: add.l #38,sp
movem.l (sp)+,d1/d2/d3/d4/d5/d6/d7/a0/a1/a2/a3/a4/a5/a6
notrap1: comp #28,d0 !ERROR NUMBER STILL IN d0
!still to make a routine that prints the number of a user set error
1: mulu #21,d0
lea emerr,a0
move.l #20,-(sp)
pea 0(a0,d0)
mov #2,-(sp) !STANDARD ERROR
bsr _write
add.l wrd+4,sp
!NEXT INFORMATION ABOUT THE LINE NUMBER
move.l (a6),d1
lea emess+14,a0
bsr itoa
move.l #30,-(sp)
pea emess
mov #2,-(sp)
bsr _write
add.l wrd+4,sp
!NOW INFORMATION ABOUT THE FILES
2: move.l 4(a6),a0
cmp.l #0,a0
beq 5f
move.l a0,a5
sub.l #4,sp
move.l a5,-(sp)
move.l #-1,d0
1: add.l #1,d0
tst.b (a5)+
bne 1b
move.l d0,4(sp)
mov #2,-(sp)
bsr _write
add.l wrd+4,sp
5: move.w #0x0A,-(sp)
move.l #2,-(sp)
pea 4(sp)
mov #2,-(sp)
bsr _write
add.l wrd+6,sp
comp #0xB,(sp)
beq 1f
move.l #-1,argc
clr.l -(sp) !dummy return address
bra hlt_z
1: add.l wrd,sp
jmp (a4)
!---------------------------------------------------------------------------
! EXIT HANDLING
!--------------------------------------------------------------------------
hlt_z: add.l #4,sp !remove return address
#if prof
.data
emprof: .asciz "em_profile\0"
.align 2
.bss
profile: .space 4
ltime: .space 4
profsiz: .space 4
.text
mov #0x1B6,-(sp)
pea emprof
bsr _creat
testen (sp)+
mov (sp)+,d0
move.l profsiz,-(sp)
move.l ltime,-(sp) !LTIME IS POINTER AT TABLE
mov d0,-(sp)
bsr _write
add.l wrd+4,sp
#endif
#if flow
mov #0x1B6,-(sp)
pea emflow
bsr _creat
testen (sp)+
mov (sp)+,d0
move.l flowsiz,-(sp)
move.l lflow,-(sp)
mov d0,-(sp)
bsr _write
add.l wrd+4,sp
.data
emflow: .asciz "em_flow\0"
.align 2
.bss
lflow: .space 4
flowsiz: .space 4
.text
#endif
#if count
mov #0x1B6,-(sp)
pea emcount
bsr _creat
testen (sp)+
mov (sp)+,d0
move.l countsiz,-(sp)
move.l lcount,-(sp)
mov d0,-(sp)
bsr _write
add.l wrd+4,sp
.data
emcount: .asciz "em_count\0"
.align 2
.bss
lcount: .space 4
countsiz: .space 4
#endif
#if opfreq
.data
emopf: .asciz "em_opfreq\0"
.align
.bss
counttab: .space 1884
.text
mov #0x1B6,-(sp)
pea emopf
bsr _creat
testen (sp)+
mov (sp)+,d0
move.l #1884,-(sp)
pea counttab
mov d0,-(sp)
bsr _write
add.l wrd+4,sp
#endif
#if count+flow+prof
.bss
countfld: .space 4 !COUNT NUMBER - NUMBER OF LINE 1 OF PROC
countptr: .space 4 !COUNT NUMBER OF CURRENT LINE
#endif
#if last
.text
mov #0x1B6,-(sp)
pea emlast
bsr _creat
testen (sp)+
mov (sp)+,d6 !d6 contains file descriptor
cmp.l #-1,linused-4 !test if buffer is fully used
beq 0f
bsr nexttab
bra 1f
0: lea lasttable,a5
1: tst.l (a5)
bne 2f !exists entry in table
move.l #22,-(sp) !here case no lines processed
pea mess1
mov d6,-(sp)
bsr _write
add.l wrd+4,sp
bra 9f
2: move.l #7,-(sp) !announce new file name
pea mess2
mov d6,-(sp)
bsr _write
add.l wrd+4,sp
move.l (a5),d7
move.l d7,a0 !keep file pointer in d7
clr.l (a5)+ !this will stop the printing
move.l #-1,d1 !d1 will contain length of file name
3: add.l #1,d1
tst.b (a0)+
bne 3b
move.l d1,-(sp)
move.l d7,-(sp)
mov d6,-(sp)
bsr _write
add.l wrd+4,sp
4: move.l (a5),d1 !next print line numbers
lea mess3,a0
bsr itoa
move.l #12,-(sp)
pea mess3
mov d6,-(sp)
bsr _write
add.l wrd+4,sp
bsr nexttab
tst.l (a5) !in case 0 no more lines
beq 9f
cmp.l (a5),d7
bne 2b !new file name
clr.l (a5)+ !skip file name
bra 4b !only new line
9:
.data
emlast: .asciz "em_last"
mess1: .asciz "no line processed yet\n"
mess2: .asciz "\nfile :"
mess3: .asciz " \n"
.align 2
.bss
lasttable: .space 128
linused: .space 4
#endif
.text
halt: bsr _exit
.data
emerr:
.asciz "ARRAY BOUND ERROR \n"
.asciz "RANGE BOUND ERROR \n"
.asciz "SET BOUND ERROR \n"
.asciz "INTEGER OVERFLOW \n"
.asciz "FLOATING OVERFLOW \n"
.asciz "FLOATING UNDERFLOW \n"
.asciz "INT. DIV. BY ZERO \n"
.asciz "DIVIDE BY 0.0 \n"
.asciz "UNDEFINED INTEGER \n"
.asciz "UNDEFINED FLOAT \n"
.asciz "CONVERSION ERROR \n"
.asciz "NO FLOATING POINT \n"
.asciz "NO 8 BYTE ARITH. \n"
.asciz "NO LOAD FILE \n"
.asciz "LOAD FILE ERROR \n"
.asciz "PROGRAM TOO LARGE \n"
.asciz "STACK OVERFLOW \n"
.asciz "HEAP OVERFLOW \n"
.asciz "ILLEGAL INSTRUCTION\n"
.asciz "ILLEGAL SIZE ARG. \n"
.asciz "CASE ERROR \n"
.asciz "ADDRESS NON EX. MEM\n"
.asciz "BAD POINTER USED \n"
.asciz "PR COUNT. OUT RANGE\n"
.asciz "BAD ARG. OF LAE \n"
.asciz "BAD MONITOR CALL \n"
.asciz "ARG OF LIN TOO HIGH\n"
.asciz "GTO DESCR. ERROR \n"
.asciz "BAD RETURN SIZE \n"
emess:
.asciz "ON SOURCE LINE OF\n"
.align 2
!-----------------------------------------------------------------------------
! SUBROUTINES FOR THE INTERPRETOR
!------------------------------------------------------------------------------
.text
#if last
nexttab: move.l linused,a5
add.l #8,a5
cmp.l #linused,a5 !top of buffer reached?
bne 1f !if so back to bottom
sub.l #128,a5
1: move.l a5,linused
rts
#endif

View File

@@ -1,58 +0,0 @@
_sigtrp: mov (sp)+,d1 !trapno in d1
mov (sp)+,d4 !signo in d4
extend d4
extend d1
comp #16,d4
bhi sig_bad
tst.l d4
beq sig_bad
move.l d4,a0
add.l a0,a0
add.l a0,a0
lea sig_trp-4(a0),a5
move.l (a5),d2 !previous trap number in d2
comp #256,d1 !-2 and -1 special
bcc 1f
move.l sig_adr-4(a0),d3 !Get the pointer to the trap-
bne 2f !procedure to give as argument to
sig_bad: mov 22,-(sp) !_signal. If pointer 0 trapping is
mov 22,-(sp) !not legal
jmp (a4)
1: comp #-3,d1 !-2:reset default , -3: ignore
bmi sig_bad
move.l d1,d3
ad #2,d3 !0:reset default for signal, -1: ignore
2: move.l d1,(a5) !set new trapno
move.l d3,-(sp) !set arguments to signal:
mov d4,-(sp) !pointer ,signo to be trapped
bsr _signal
cl -(sp) !set code for no error
.data
sig_adr: .long sig1 ; .long sig2 ; .long sig3 ; .long 0
.long 0 ; .long 0 ; .long 0 ; .long 0
.long 0 ; .long 0 ; .long sig11 ; .long sig12
.long sig13 ; .long sig14 ; .long sig15 ; .long sig16
sig_trp: .long -2 ; .long -2 ; .long -2 ; .long -2
.long -2 ; .long -2 ; .long -2 ; .long -2
.long -2 ; .long -2 ; .long 21 ; .long 25
.long -2 ; .long -2 ; .long -2 ; .long -2
.text
!the next procedures map the catched signal to em errors. The em error
!procedure will handle this.
sig1: sig2: sig3: sig8: sig13: sig14: sig15: sig16:
pea retutrap
mov d1,-(sp)
bra error
retutrap: rtr
sig12: pea sig12
mov #12,-(sp)
bsr _signal
bsr e_badmon
rtr
sig11: move.l 4(a1),d0
sub.l sp,d0
bcs e_memflt !in this case error handling possible
move.l ml,sp !refresh stack and stop .
bra notrap1

View File

@@ -1,503 +0,0 @@
!THIS FILE CONTAINS THE SYSTEM CALLS FOR PMDS-II AS SUBROUTINES FOR THE
!EM-INTERPRETER. a1 CONTAINS A POINTER TO THE RETURN AREA . EACH SUBROUTINE
!EXPECTS ITS DATA IN THE FORM EM PRODUCES AND GIVES ITS RESULTS AS EM
!REQUIRES
_exit: move.l (sp),(a1)
#ifndef lword
bsr st241
#endif
trap #0
.short 1
_fork: move.l (sp),(a1)
trap #0
.short 2
lea 4(sp),sp
bcs 2f
tst.l d0 !PID OF CHILD IN PARENT, 0 IN CHILD
bne 1f
trap #0
.short 20
mov d1,-(sp) !PID OF PARENT IN d1
mov #1,-(sp) !(PID OF CHILD IN D0),FLAG 1 IN CHILD
bra 0f
1: mov d0,-(sp) !PID OF CHILD IN d0
cl -(sp) !FLAG 0 IN PARENT
0: cl -(sp)
bra 3f
2: mov d0,-(sp)
mov d0,-(sp)
3: move.l (a1),a0
jmp (a0)
!_fork is special
_read: move.l (sp),(a1)
#ifndef lword
bsr st241
#endif
trap #0
.short 3
sys0: lea 16(sp),sp
bcc 1f
mov d0,-(sp)
mov d0,-(sp)
bra 2f
1: move.l d0,-(sp)
cl -(sp)
2: move.l (a1),a0
jmp (a0)
_write: move.l (sp),(a1)
#ifndef lword
bsr st241
#endif
trap #0
.short 4
bra sys0
_open: move.l (sp),(a1)
#ifndef lword
bsr st243
#endif
trap #0
.short 5
sys1: lea 12(sp),sp
sys5: bcc 1f
mov d0,-(sp)
mov d0,-(sp)
bra 2f
1: mov d0,-(sp)
cl -(sp)
2: move.l (a1),a0
jmp (a0)
_close: move.l (sp),(a1)
#ifndef lword
bsr st241
#endif
trap #0
.short 6
sys3: lea 8(sp),sp
sys4: bcc 1f
mov d0,-(sp)
mov d0,-(sp)
bra 2f
1: cl -(sp)
2: move.l (a1),a0
jmp (a0)
_wait: move.l (sp),(a1)
trap #0
.short 7
sys6: lea 4(sp),sp
bcc 1f
mov d0,-(sp)
mov d0,-(sp)
bra 2f
1: mov d1,-(sp) ! ??
mov d0,-(sp)
cl -(sp)
2: move.l (a1),a0
jmp (a0)
_creat: move.l (sp),(a1)
#ifndef lword
bsr st243
#endif
trap #0
.short 8
bra sys1
_link: move.l (sp),(a1)
trap #0
.short 9
lea 12(sp),sp
bra sys4
_unlink: move.l (sp),(a1)
trap #0
.short 10
bra sys3
_chdir: move.l (sp),(a1)
trap #0
.short 12
bra sys3
_mknod: move.l (sp),(a1)
#ifndef lword
bsr st244
#endif
trap #0
.short 14
lea 16(sp),sp
bra sys4
_chmod: move.l (sp),(a1)
#ifndef lword
bsr st243
#endif
trap #0
.short 15
lea 12(sp),sp
bra sys4
_chown: move.l (sp),(a1)
#ifndef lword
bsr st244
#endif
trap #0
.short 16
lea 16(sp),sp
bra sys4
_break: move.l (sp),(a1)
trap #0
.short 17
lea 8(sp),sp
bcc 1f
mov d0,-(sp)
mov d0,-(sp)
bra 2f
1: move.l -4(sp),nd
cl -(sp)
2: move.l (a1),a0
jmp (a0)
.data
nd: .long endbss
.text
_stat: move.l (sp),(a1)
trap #0
.short 18
lea 12(sp),sp
bra sys4
_lseek: move.l (sp),(a1)
#ifndef lword
bsr st245
#endif
trap #0
.short 19
lea 16(sp),sp
bcc 1f
mov d0,-(sp)
mov d0,-(sp)
bra 2f
1: move.l d1,-(sp)
mov d0,-(sp)
cl -(sp)
2: move.l (a1),a0
jmp (a0)
_getpid: move.l (sp),(a1)
trap #0
.short 20
add.l #4,sp
mov d0,-(sp)
move.l (a1),a0
jmp (a0)
_mount: move.l (sp),(a1)
#ifndef lword
bsr st246
#endif
trap #0
.short 21
lea 16(sp),sp
bra sys4
_umount: move.l (sp),(a1)
trap #0
.short 22
bra sys3
_setuid: move.l (sp),(a1)
#ifndef lword
bsr st241
#endif
trap #0
.short 23
bra sys3
_getuid: move.l (sp),(a1)
trap #0
.short 24
sys7: add.l #4,sp
mov d1,-(sp)
mov d0,-(sp)
move.l (a1),a0
jmp (a0)
_stime: move.l (sp),(a1)
trap #0
.short 25
bra sys3
_ptrace: move.l (sp),(a1)
#ifndef lword
bsr st247
#endif
trap #0
.short 26
lea 20(sp),sp
bra sys5
_alarm: move.l (sp),(a1)
#ifndef lword
sub.l #2,sp
clr.w 4(sp)
#endif
trap #0
.short 27
lea 8(sp),sp
mov d0,-(sp)
move.l (a1),a0
jmp (a0)
_fstat: move.l (sp),(a1)
#ifndef lword
bsr st241
#endif
trap #0
.short 28
lea 12(sp),sp
bra sys4
_pause: trap #0
.short 29
rts
_utime: move.l (sp),(a1)
trap #0
.short 30
lea 12(sp),sp
bra sys4
_access: move.l (sp),(a1)
#ifndef lword
bsr st248
#endif
trap #0
.short 33
lea 12(sp),sp
bra sys4
_nice:
#ifndef lword
bsr 241
#endif
trap #0
.short 34
move.l (sp)+,(sp)
rts
_ftime: move.l (sp),(a1)
trap #0
.short 35
bra sys3
_sync: trap #0
.short 36
rts
_kill: move.l (sp),(a1)
#ifndef lword
bsr st248
#endif
trap #0
.short 37
lea 12(sp),sp
bra sys4
_dup: move.l (sp),(a1)
#ifndef lword
bsr st248
#endif
trap #0
.short 38
bra sys1
_pipe: move.l (sp),(a1)
trap #0
.short 42
bra sys6
_times: trap #0
.short 43
move.l (sp),a0
add.l #8,sp
jmp (a0)
_profil: trap #0
.short 44
move.l (sp),a0
lea 20(sp),sp
jmp (a0)
_setgid: move.l (sp),(a1)
#ifndef lword
bsr st241
#endif
trap #0
.short 46
bra sys3
_getgid: move.l (sp),(a1)
trap #0
.short 47
bra sys7
_signal: move.l (sp)+,retaddr
mov (sp)+,d4
extend d4
move.l d4,-(sp)
move.l retaddr,-(sp)
trap #0
.short 48
mov d0,-(sp)
bne 1f
mov d0,-(sp)
1: move.l retaddr,a0
jmp (a0)
.data
retaddr: .long 0
.text
_acct: move.l (sp),(a1)
trap #0
.short 51
bra sys3
_lock: move.l (sp),(a1)
#ifndef lword
bsr st241
#endif
trap #0
.short 53
bra sys3
_ioctl: move.l (sp),(a1)
#ifndef lword
bsr st248
#endif
trap #0
.short 54
lea 16(sp),sp
bra sys4
_mpxcall: move.l (sp),(a1)
#ifndef lword
bsr st241
#endif
trap #0
.short 56
lea 12(sp),sp
bra sys4
_exece: move.l (sp),(a1)
trap #0
.short 59
lea 16(sp),sp
bra sys4
_umask: move.l (sp),(a1)
#ifndef lword
bsr st241
#endif
trap #0
.short 60
add.l #8,sp
mov d0,-(sp)
move.l (a1),a0
jmp (a0)
_chroot: move.l (sp),(a1)
trap #0
.short 61
bra sys3
!----------------------------------------------------------------------------
! STACK ADJUSTMENT FOR THE TWO BYTE INTERPRETER
!-----------------------------------------------------------------------------
#ifndef lword
st241: sub.l #2,sp
move.l 2(sp),(sp)
move.l 6(sp),4(sp)
move.w 10(sp),d0
ext.l d0
move.l d0,8(sp)
rts
st243: sub.l #2,sp
move.l 2(sp),(sp)
move.l 6(sp),4(sp)
move.l 10(sp),8(sp)
move.w 14(sp),d0
ext.l d0
move.l d0,12(sp)
rts
st244: move.l (sp),-(sp)
move.l 8(sp),4(sp)
move.l 12(sp),8(sp)
move.w 16(sp),d0
ext.l d0
move.l d0,12(sp)
move.w 18(sp),d0
ext.l d0
move.l d0,16(sp)
rts
st245: move.l (sp),-(sp)
move.l 8(sp),4(sp)
move.w 12(sp),d0
ext.l d0
move.l d0,8(sp)
move.l 14(sp),12(sp)
move.w 18(sp),d0
ext.l d0
move.l d0,16(sp)
rts
st246: sub.l #2,sp
move.l 2(sp),(sp)
move.l 6(sp),4(sp)
move.l 10(sp),8(sp)
move.l 14(sp),12(sp)
move.w 18(sp),d0
ext.l d0
move.l d0,16(sp)
rts
st247: sub.l #6,sp
move.l 6(sp),(sp)
move.l 10(sp),4(sp)
move.w 14(sp),d0
ext.l d0
move.l d0,8(sp)
move.w 16(sp),d0
ext.l d0
move.l d0,12(sp)
move.l 18(sp),16(sp)
move.w 22(sp),d0
ext.l d0
move.l d0,20(sp)
rts
st248: move.l (sp),-(sp)
move.l 8(sp),4(sp)
move.w 12(sp),d0
ext.l d0
move.l d0,8(sp)
move.w 14(sp),d0
ext.l d0
move.l d0,12(sp)
rts
#endif

View File

@@ -1,6 +0,0 @@
.text
end:
.bss
endbss:
.data
enddata:

View File

@@ -1,3 +0,0 @@
rm temp.c
cat header deffile $1 >> temp.c
cpp -P temp.c >$2

View File

@@ -1,176 +0,0 @@
# $Header$
PREFLAGS=-I../../../h -I. -DNDEBUG
PFLAGS=
CFLAGS=$(PREFLAGS) $(PFLAGS) -O
LDFLAGS=-i $(PFLAGS)
LINTOPTS=-hbxac
LIBS=../../../lib/em_data.a
CDIR=../../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:
make tables.c
make 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
tables.c: table
../../../lib/cpp -P table | ../../../lib/cgg -htables.H > debug.out
-cmp -s tables.h tables.H || mv tables.H tables.h
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

View File

@@ -1,243 +0,0 @@
#ifndef NORCSID
static char rcsid[] = "$Header$";
#endif
/*
* (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
*/
/*
* machine dependent back end routines for the PDP-11
*/
/* #define REGPATCH /* save all registers in markblock */
con_part(sz,w) register sz; word w; {
while (part_size % sz)
part_size++;
if (part_size == TEM_WSIZE)
part_flush();
if (sz == 1) {
w &= 0xFF;
if (part_size)
w <<= 8;
part_word |= w;
} else {
assert(sz == 2);
part_word = w;
}
part_size += sz;
}
con_mult(sz) word sz; {
long l;
if (sz != 4)
fatal("bad icon/ucon size");
#ifdef ACK_ASS
fprintf(codefile,".long %s\n",str);
#else
l = atol(str);
fprintf(codefile,"\t%o;%o\n",(int)(l>>16),(int)l);
#endif
}
/*
* The next function is difficult to do when not running on a PDP 11 or VAX
* The strategy followed is to assume the code generator is running on a PDP 11
* unless the ACK_ASS define is on.
* In the last case floating point constants are simply not handled
*/
con_float() {
#ifdef ACK_ASS
static int been_here;
if (argval != 4 && argval != 8)
fatal("bad fcon size");
fprintf(codefile,".long\t");
if (argval == 8)
fprintf(codefile,"F_DUM,");
fprintf(codefile,"F_DUM\n");
if ( !been_here++)
fprintf(stderr,"Warning : dummy float-constant(s)\n");
#else
double f;
register short *p,i;
if (argval != 4 && argval != 8)
fatal("bad fcon size");
f = atof(str);
p = (short *) &f;
i = *p++;
if (argval == 8) {
fprintf(codefile,"\t%o;%o;",i,*p++);
i = *p++;
}
fprintf(codefile,"\t%o;%o\n",i,*p++);
#endif
}
#ifdef REGVARS
char Rstring[10];
full lbytes;
struct regadm {
char *ra_str;
long ra_off;
} regadm[2];
int n_regvars;
regscore(off,size,typ,score,totyp) long off; {
if (size != 2)
return(-1);
score -= 1; /* allow for save/restore */
if (off>=0)
score -= 2;
if (typ==reg_pointer)
score *= 17;
else if (typ==reg_loop)
score = 10*score+50; /* Guestimate */
else
score *= 10;
return(score); /* estimated # of words of profit */
}
i_regsave() {
Rstring[0] = 0;
n_regvars=0;
}
f_regsave() {
register i;
if (n_regvars==0 || lbytes==0) {
#ifdef REGPATCH
fprintf(codefile,"mov r2,-(sp)\nmov r4,-(sp)\n");
#endif
fprintf(codefile,"mov r5,-(sp)\nmov sp,r5\n");
if (lbytes == 2)
fprintf(codefile,"tst -(sp)\n");
else if (lbytes!=0)
fprintf(codefile,"sub $0%o,sp\n",lbytes);
for (i=0;i<n_regvars;i++)
fprintf(codefile,"mov %s,-(sp)\n",regadm[i].ra_str);
} else {
if (lbytes>6) {
fprintf(codefile,"mov $0%o,r0\n",lbytes);
fprintf(codefile,"jsr r5,PR%s\n",Rstring);
} else {
fprintf(codefile,"jsr r5,PR%d%s\n",lbytes,Rstring);
}
}
for (i=0;i<n_regvars;i++)
if (regadm[i].ra_off>=0)
fprintf(codefile,"mov 0%lo(r5),%s\n",regadm[i].ra_off,
regadm[i].ra_str);
}
regsave(regstr,off,size) char *regstr; long off; {
fprintf(codefile,"%c Local %ld into %s\n",COMMENTCHAR,off,regstr);
/* commented away
#ifndef REGPATCH
fprintf(codefile,"mov %s,-(sp)\n",regstr);
#endif
strcat(Rstring,regstr);
if (off>=0)
fprintf(codefile,"mov 0%lo(r5),%s\n",off,regstr);
end of commented away */
strcat(Rstring,regstr);
regadm[n_regvars].ra_str = regstr;
regadm[n_regvars].ra_off = off;
n_regvars++;
}
regreturn() {
#ifdef REGPATCH
fprintf(codefile,"jmp eret\n");
#else
fprintf(codefile,"jmp RT%s\n",Rstring);
#endif
}
#endif
prolog(nlocals) full nlocals; {
#ifndef REGVARS
#ifdef REGPATCH
fprintf(codefile,"mov r2,-(sp)\nmov r4,-(sp)\n");
#endif
fprintf(codefile,"mov r5,-(sp)\nmov sp,r5\n");
if (nlocals == 0)
return;
if (nlocals == 2)
fprintf(codefile,"tst -(sp)\n");
else
fprintf(codefile,"sub $0%o,sp\n",nlocals);
#else
lbytes = nlocals;
#endif
}
dlbdlb(as,ls) string as,ls; {
if (strlen(as)+strlen(ls)+2<sizeof(labstr)) {
strcat(ls,":");
strcat(ls,as);
} else
fatal("too many consecutive labels");
}
mes(type) word type; {
int argt ;
switch ( (int)type ) {
case ms_ext :
for (;;) {
switch ( argt=getarg(
ptyp(sp_cend)|ptyp(sp_pnam)|sym_ptyp) ) {
case sp_cend :
return ;
default:
strarg(argt) ;
#ifdef ACK_ASS
fprintf(codefile,".define %s\n",argstr) ;
#else
fprintf(codefile,".globl %s\n",argstr) ;
#endif
break ;
}
}
default :
while ( getarg(any_ptyp) != sp_cend ) ;
break ;
}
}
char *segname[] = {
".text", /* SEGTXT */
".data", /* SEGCON */
".data", /* SEGROM */
".bss" /* SEGBSS */
};

View File

@@ -1,46 +0,0 @@
/* $Header$ */
/* The next define switches between codegeneration for an ACK assembler
* or for the standard UNIX V7 assembler.
* If on code is generated for the ACK assembler.
*/
/* #define ACK_ASS /* code for ACK assembler */
#ifdef ACK_ASS
#define COMMENTCHAR '!'
#define ex_ap(y) fprintf(codefile,".extern %s\n",y)
#else
#define COMMENTCHAR '/'
#define ex_ap(y) fprintf(codefile,".globl %s\n",y)
#endif
#define in_ap(y) /* nothing */
#define newplb(x) fprintf(codefile,"%s:\n",x)
#define newilb(x) fprintf(codefile,"%s:\n",x)
#define newdlb(x) fprintf(codefile,"%s:\n",x)
#ifdef ACK_ASS
#define newlbss(l,x) fprintf(codefile,"%s:.space 0%o\n",l,x);
#else
#define newlbss(l,x) fprintf(codefile,"%s:.=.+0%o\n",l,x);
#endif
#define cst_fmt "$0%o"
#define off_fmt "0%o"
#define ilb_fmt "I%03x%x"
#define dlb_fmt "_%d"
#define hol_fmt "hol%d"
#define hol_off "0%o+hol%d"
#ifdef ACK_ASS
#define con_cst(x) fprintf(codefile,".short 0%o\n",x)
#define con_ilb(x) fprintf(codefile,".short %s\n",x)
#define con_dlb(x) fprintf(codefile,".short %s\n",x)
#else
#define con_cst(x) fprintf(codefile,"0%o\n",x)
#define con_ilb(x) fprintf(codefile,"%s\n",x)
#define con_dlb(x) fprintf(codefile,"%s\n",x)
#endif
#define id_first '_'
#define BSS_INIT 0

View File

@@ -1,135 +0,0 @@
#ifndef NORCSID
static char rcsid[] = "$Header$";
#endif
#include <stdio.h>
/*
* (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);
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,74 +0,0 @@
tail_em.s.a
RT.s
adf.s
adi.s
and.s
cff.s
cfi.s
cif.s
cii.s
ciu.s
cmf.s
cmi.s
cmi4.s
cms.s
cmu.s
cmu4.s
csa.s
csb.s
dup.s
dvf.s
dvi.s
dvi4.s
dvu.s
dvu2.s
dvu4.s
eret.s
exg.s
fef.s
fif.s
gto.s
hlt.s
iaar.s
aar.s
ilar.s
inn.s
isar.s
lar.s
los2.s
mlf.s
mli.s
mli4.s
mlu.s
mlu4.s
mon.s
ngf.s
ngi.s
nop.s
prf.s
printf.s
rck.s
ret.s
rmi.s
rmi4.s
rmu.s
rmu2.s
rmu4.s
rol.s
ror.s
sar.s
sbf.s
sbi.s
set.s
setfl.s
sigtrp.s
sim.s
sli.s
sri.s
sru.s
sto2.s
strhp.s
unknown.s
trp.s
xor.s
save.s

View File

@@ -1,32 +0,0 @@
l=../lib
install: cp
cp: all
cp head_em $l/head_em
cp tail_em $l/tail_em
rm -f head_em tail_em
cmp: all
cmp head_em $l/head_em
cmp tail_em $l/tail_em
rm -f head_em tail_em
distr:
arch cr `head -1 LIST` `tail +2 LIST`
all: head_em tail_em
head_em: head_em.s
pdp -c head_em.s ; mv head_em.o head_em
tail_em:
march . tail_em
clean:
rm -f *.o
opr:
make pr | opr
pr:
@pr `pwd`/Makefile `pwd`/head_em.s
pr -l33 `tail +1 LIST|sort`

View File

@@ -1,32 +0,0 @@
/ $Header$
.globl PRr2,PR2r2,PR4r2,PR6r2
.globl PRr2r4,PR2r2r4,PR4r2r4,PR6r2r4
.globl RT,RTr2,RTr2r4
PR6r2: mov $6,r0;br PRr2
PR4r2: mov $4,r0;br PRr2
PR2r2: mov $2,r0
PRr2: mov r5,r1
mov sp,r5
sub r0,sp
mov r2,-(sp)
mov r1,pc
PR2r2r4:mov $2,r0;br PRr2r4
PR4r2r4:mov $4,r0;br PRr2r4
PR6r2r4:mov $6,r0
PRr2r4: mov r5,r1
mov sp,r5
sub r0,sp
mov r2,-(sp)
mov r4,-(sp)
mov r1,pc
RTr2r4:
mov (sp)+,r4
RTr2:
mov (sp)+,r2
RT:
mov r5,sp
mov (sp)+,r5
rts pc

View File

@@ -1,12 +0,0 @@
/ $Header$
.text
.globl aar~
/r0 : descriptor address
/r1 : element number
/base address is on stack
aar~:
sub (r0),r1
mul 04(r0),r1
add r1,02(sp)
rts pc

View File

@@ -1,14 +0,0 @@
/ $Header$
.text
.globl adf~
.globl setfloat~
/size in r0
adf~:
mov (sp)+,r1
jsr pc,setfloat~
movf (sp)+,r0
addf (sp)+,r0
movf r0,-(sp)
setd
jmp (r1)

View File

@@ -1,20 +0,0 @@
/ $Header$
.text
.globl adi~
.globl unknown~
/size in r0
adi~:
mov (sp)+,r1
cmp r0,$04
bgt 1f
cmp r0,$02
bgt 2f
add (sp)+,(sp)
jmp (r1)
2: add (sp)+,02(sp)
add (sp)+,02(sp)
adc (sp)
jmp (r1)
1:
jmp unknown~

View File

@@ -1,14 +0,0 @@
/ $Header$
.text
.globl and~
/ size in r0
and~:
mov (sp)+,r3
mov sp,r1
add r0,r1
asr r0
1: com (sp)
bic (sp)+,(r1)+
sob r0,1b
jmp (r3)

View File

@@ -1,29 +0,0 @@
/ $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

View File

@@ -1,15 +0,0 @@
/ $Header$
.text
.globl cff~
.globl setfloat~
cff~:
mov (sp)+,r1
mov (sp)+,r0
cmp (sp)+,r0
beq 1f
jsr pc,setfloat~
movof (sp)+,r0
movf r0,-(sp)
setd
1: jmp (r1)

View File

@@ -1,15 +0,0 @@
/ $Header$
.text
.globl cfi~
.globl setfloat~,setint~
cfi~:
mov (sp)+,r1
mov (sp)+,r0
jsr pc,setint~
mov (sp)+,r0
jsr pc,setfloat~
movf (sp)+,r0
movfi r0,-(sp)
setd;seti
jmp (r1)

View File

@@ -1,25 +0,0 @@
/ $Header$
.text
.globl cif~,cuf~
.globl setint~,setfloat~
cif~:
mov (sp)+,r1
mov (sp)+,r0
jsr pc,setfloat~
mov (sp)+,r0
1: jsr pc,setint~
movif (sp)+,r0
movf r0,-(sp)
setd;seti
jmp (r1)
cuf~:
mov (sp)+,r1
mov (sp)+,r0
jsr pc,setfloat~
mov (sp)+,r0
cmp r0,$02
bne 1b
clr -(sp)
mov $04,r0
br 1b

View File

@@ -1,22 +0,0 @@
/ $Header$
.text
.globl cii~
/convert int to int
/ 1 byte -> ? : sign extension
cii~:
mov (sp)+,r3
mov (sp)+,r0
sub (sp)+,r0
ble 1f
asr r0
bcc 2f
movb (sp),r1
mov r1,(sp)
2: tst r0
beq 3f
tst (sp)
4: sxt -(sp)
sob r0,4b
1: sub r0,sp / if out of sob loop r0==0
3: jmp (r3)

View File

@@ -1,13 +0,0 @@
/ $Header$
.text
.globl cuu~
cuu~:
mov (sp)+,r1
mov (sp)+,r0
sub (sp)+,r0
ble 1f
asr r0
2: clr -(sp)
sob r0,2b
1: sub r0,sp / if out of sob loop r0==0
jmp (r1)

View File

@@ -1,20 +0,0 @@
/ $Header$
.text
.globl cmf~
.globl setfloat~
cmf~:
jsr pc,setfloat~
mov (sp)+,r1
movf (sp)+,r0
movf (sp)+,r1
clr r0
cmpf r0,r1
setd
cfcc
beq 1f
blt 2f
dec r0
jmp (r1)
2: inc r0
1: jmp (r1)

View File

@@ -1,18 +0,0 @@
/ $Header$
.text
.globl cmi~
.globl cmi4~,unknown~
/ Size in r0
cmi~:
cmp r0,$02
bne 1f
mov (sp)+,r1
mov (sp)+,r0
sub (sp)+,r0
neg r0
jmp (r1)
1: cmp r0,$04
bne 2f
jmp cmi4~
2: jmp unknown~

View File

@@ -1,21 +0,0 @@
/ $Header$
.text
.globl cmi4~
cmi4~:
mov (sp)+,r1
clr r0
cmp (sp),4(sp)
bgt 1f
blt 2f
cmp 2(sp),6(sp)
bhi 1f
beq 3f
2:
inc r0
br 3f
1:
dec r0
3:
add $10,sp
jmp (r1)

View File

@@ -1,17 +0,0 @@
/ $Header$
.text
.globl cms~
.globl save~,retu~
cms~:
jsr pc,save~
mov r0,r2
add sp,r2
mov r2,r4
add r0,r4
asr r0
2: cmp (sp)+,(r2)+
bne 1f
sob r0,2b
1: mov r4,sp
jmp retu~

View File

@@ -1,23 +0,0 @@
/ $Header$
.text
.globl cmu~
.globl unknown~,cmu4~
cmu~:
cmp r0,$02
bne 3f
mov (sp)+,r1
clr r0
cmp (sp)+,(sp)+
beq 2f
bhi 1f
inc r0
br 2f
1:
dec r0
2:
jmp (r1)
3: cmp r0,$04
bne 2f
jmp cmu4~
2: jmp unknown~

View File

@@ -1,20 +0,0 @@
/ $Header$
.text
.globl cmu4~
cmu4~:
mov (sp)+,r1
clr r0
cmp (sp),4(sp)
bhi 1f
blo 2f
cmp 2(sp),6(sp)
bhi 1f
beq 3f
2:
inc r0
br 3f
1:
dec r0
3:
add $10,sp
jmp (r1)

View File

@@ -1,4 +0,0 @@
if pdp -c $1 1>&2
then echo `basename $1 $2`.o
else exit 1
fi

View File

@@ -1,22 +0,0 @@
/ $Header$
.text
.globl csa~
.globl fat~
ECASE = 20.
csa~:
sub 02(r0),r1
blt 1f
cmp 04(r0),r1
blo 1f
asl r1
add r1,r0
mov 06(r0),r1
beq 2f
jmp (r1)
1: mov (r0),r0
beq 2f
jmp (r0)
2: mov $ECASE,-(sp)
jmp fat~

View File

@@ -1,23 +0,0 @@
/ $Header$
.text
.globl csb~
.globl fat~
ECASE = 20.
csb~:
mov (r0)+,-(sp)
mov (r0)+,r3
beq 1f
3: cmp (r0)+,r1
beq 2f
tst (r0)+
sob r3,3b
1: mov (sp)+,r1
br 4f
2: tst (sp)+
mov (r0),r1
4: beq 5f
jmp (r1)
5: mov $ECASE,-(sp)
jmp fat~

View File

@@ -1,12 +0,0 @@
/ $Header$
.text
.globl dup~
dup~:
mov (sp)+,r3
mov sp,r1
add r0,r1
asr r0
1: mov -(r1),-(sp)
sob r0,1b
jmp (r3)

View File

@@ -1,14 +0,0 @@
/ $Header$
.text
.globl dvf~
.globl setfloat~
dvf~:
mov (sp)+,r1
jsr pc,setfloat~
movf (sp)+,r0
movf (sp)+,r1
divf r0,r1
movf r1,-(sp)
setd
jmp (r1)

View File

@@ -1,20 +0,0 @@
/ $Header$
.text
.globl dvi~
.globl unknown~,dvi4~
dvi~:
mov (sp)+,r3
cmp r0,$04
bgt 1f
beq 2f
mov 02(sp),r1
sxt r0
div (sp)+,r0
mov r0,(sp)
br 3f
2: jsr pc,dvi4~
mov r1,-(sp)
mov r0,-(sp)
3: jmp (r3)
1: jmp unknown~

View File

@@ -1,82 +0,0 @@
/ $Header$
.text
.globl dvi4~
.globl save~,retu~
dvi4~:
jsr pc,save~
mov 02(sp),r3
sxt r4
bpl 1f
neg r3
1: cmp r4,(sp)
bne hardldiv
mov 06(sp),r2
mov 04(sp),r1
bge 2f
neg r1
neg r2
sbc r1
com r4
2: mov r4,-(sp)
clr r0
div r3,r0
mov r0,-(sp)
mov r1,r0
mov r1,r4
mov r2,r1
div r3,r0
bvc 3f
mov r2,r1
mov r4,r0
sub r3,r0
div r3,r0
tst r1
sxt r1
add r1,r0
3: mov r0,r1
mov (sp)+,r0
br 4f
hardldiv:
clr -(sp)
mov 010(sp),r2
mov 06(sp),r1
bpl 5f
com (sp)
neg r1
neg r2
sbc r1
5: clr r0
mov 02(sp),r3
bge 6f
neg r3
neg 04(sp)
sbc r3
com (sp)
6: mov $16.,r4
9: clc
rol r2
rol r1
rol r0
cmp r3,r0
bhi 7f
bcs 8f
cmp 04(sp),r1
blos 8f
7: sob r4,9b
br 1f
8: sub 04(sp),r1
sbc r0
sub r3,r0
inc r2
sob r4,9b
1:
mov r2,r1
clr r0
4: tst (sp)+
beq 1f
neg r0
neg r1
sbc r0
1: add $010,sp
jmp retu~

View File

@@ -1,18 +0,0 @@
/ $Header$
.text
.globl dvu~
.globl unknown~,dvu4~,dvu2~
dvu~:
mov (sp)+,r3
cmp r0,$04
bgt 1f
beq 2f
jsr pc,dvu2~
mov r0,-(sp)
br 3f
2: jsr pc,dvu4~
mov r1,-(sp)
mov r0,-(sp)
3: jmp (r3)
1: jmp unknown~

View File

@@ -1,16 +0,0 @@
/ $Header$
.text
.globl dvu2~
dvu2~:
clr r0
mov 04(sp),r1
tst 02(sp)
blt 1f
div 02(sp),r0
2: mov (sp)+,r1
add $04,sp
jmp (r1)
1: cmp 02(sp),r1
bhi 2b
inc r0
br 2b

View File

@@ -1,62 +0,0 @@
/ $Header$
.text
.globl dvu4~
.globl save~,retu~
dvu4~:
jsr pc,save~
clr r0
tst (sp)
bne harddvu4
tst 02(sp)
blt harddvu4
mov 06(sp),r2
mov 04(sp),r1
mov 02(sp),r3
div r3,r0
mov r0,-(sp)
mov r1,r0
mov r1,r4
mov r2,r1
div r3,r0
bvc 1f
mov r2,r1
mov r4,r0
sub r3,r0
div r3,r0
tst r1
sxt r1
add r1,r0
1: mov r0,r1
mov (sp)+,r0
br 2f
harddvu4:
mov 06(sp),r2
mov 04(sp),r1
mov (sp),r3
mov $17.,r4
br 3f
6: rol r2
rol r1
rol r0
3: cmp r3,r0
bhi 4f
blo 5f
cmp 02(sp),r1
blos 5f
4: clc
sob r4,6b
br 7f
5: sub 02(sp),r1
sbc r0
sub r3,r0
sec
sob r4,6b
7: rol r2
bcc 8f
mov $01,r0
br 9f
8: clr r0
9: mov r2,r1
2: add $010,sp
jmp retu~

View File

@@ -1,9 +0,0 @@
/ $Header$
.globl eret
eret:
mov r5,sp
mov (sp)+,r5
mov (sp)+,r4
mov (sp)+,r2
rts pc

View File

@@ -1,19 +0,0 @@
/ $Header$
.text
.globl exg~
exg~: jsr pc,save~
mov sp,r4
sub r0,sp
mov sp,r3
mov r0,r1
1:
mov (r4)+,(r3)+
sob r0,1b
asr r1
mov sp,r4
1:
mov (r4)+,(r3)+
sob r1,1b
mov r4,sp
jmp retu~

View File

@@ -1,14 +0,0 @@
/ $Header$
.text
.globl fef~
.globl setfloat~
fef~:
mov (sp)+,r1
jsr pc,setfloat~
movf (sp),r0
movei r0,-(sp)
movie $0,r0
movf r0,02(sp)
setd
jmp (r1)

View File

@@ -1,14 +0,0 @@
/ $Header$
.text
.globl fif~
.globl setfloat~
fif~:
mov (sp)+,r1
jsr pc,setfloat~
movf (sp)+,r0
modf (sp)+,r0
movf r0,-(sp)
movf r1,-(sp)
setd
jmp (r1)

View File

@@ -1,19 +0,0 @@
/ $Header$
.text
.globl gto~
gto~:
mov (sp)+,r4
mov 4(r4),r5
mov 2(r4),sp
mov (r4),pc
/
/ mov (sp)+,r3
/1: cmp 4(r3),r5
/ jeq 2f
/ mov 2(r5),r4
/ mov 4(r5),r2
/ mov (r5),r5
/ br 1b
/2: mov 2(r3),sp
/ jmp *(r3)

View File

@@ -1,76 +0,0 @@
/ $Header$
.globl LINO_AD,FILN_AD
.globl ERANGE,ESET,EHEAP,EILLINS,ECASE
.globl hol0,trppc~,trpim~,reghp~
rti = 2
stst = 170300 ^ tst
.float = 1 / this should be parameterized somehow
.hardfp = 1 / only relevant if .float on
LINO_AD = 0.
FILN_AD = 4.
ERANGE = 1.
ESET = 2.
EFOVFL = 4.
EFUNFL = 5.
EFDIVZ = 7.
EFUND = 9.
ECONV = 10.
EHEAP = 17.
EILLINS = 18.
ECASE = 20.
.if .float
/ .globl fltused; fltused:
.if 1 - .hardfp
/ sys 48.;4.;fptrap / if not commented it will appear as undefined
.endif
sys 48.;8.;sig8
ldfps $7600
.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.
.data
hol0: 0;0 / line no
0;0 / file
trppc~: 0
trpim~: 0
reghp~: _end
.text
sig8:
.if .float
mov r0,-(sp)
stst r0
mov 1f(r0),-(sp)
jsr pc,trp~
sys 48.;8.;sig8
mov (sp)+,r0
rti
.data
1: EILLINS; EILLINS; EFDIVZ; ECONV; EFOVFL; EFUNFL; EFUND; EILLINS
.text
.endif

View File

@@ -1,11 +0,0 @@
/ $Header$
.text
.globl hlt~
exit = 1
hlt~:
mov (sp)+,r0
bne 1f
sys exit
1: 4

View File

@@ -1,19 +0,0 @@
/ $Header$
.text
.globl iaar~
.globl aar~,trp~
EILLINS = 18.
iaar~:
mov (sp)+,r0
cmp (sp)+,$02
bne 1f
mov 02(sp),r1
mov r0,02(sp)
mov (sp)+,r0
jmp aar~
1: mov $EILLINS,-(sp)
jsr pc,trp~
add $06,sp
jmp (r0)

View File

@@ -1,19 +0,0 @@
/ $Header$
.text
.globl ilar~
.globl lar~,trp~
EILLINS = 18.
ilar~:
mov (sp)+,r0
cmp (sp)+,$02
bne 1f
mov 02(sp),r1
mov r0,02(sp)
mov (sp)+,r0
jmp lar~
1: mov $EILLINS,-(sp)
jsr pc,trp~
add $06,sp
jmp (r0)

View File

@@ -1,22 +0,0 @@
/ $Header$
.text
.globl inn~
inn~:
mov r0,-(sp)
clr r0
div $010,r0
cmp r0,(sp)
bcc 1f
add sp,r0
bitb bits(r1),4(r0)
beq 1f
mov $01,r0
br 2f
1: clr r0
2: mov 02(sp),r1
add (sp)+,sp
tst (sp)+
jmp (r1)
.data
bits: .byte 1,2,4,10,20,40,100,200

View File

@@ -1,19 +0,0 @@
/ $Header$
.text
.globl isar~
.globl sar~,trp~
EILLINS = 18.
isar~:
mov (sp)+,r0
cmp (sp)+,$02
bne 1f
mov 02(sp),r1
mov r0,02(sp)
mov (sp)+,r0
jmp sar~
1: mov $EILLINS,-(sp)
jsr pc,trp~
add $06,sp
jmp (r0)

View File

@@ -1,20 +0,0 @@
/ $Header$
.text
.globl lar~
lar~:
mov (sp)+,r3
sub (r0),r1
mov 04(r0),r0
mul r0,r1
add (sp)+,r1
add r0,r1
asr r0
beq 1f
2: mov -(r1),-(sp)
sob r0,2b
jmp (r3)
1: clr r0
bisb -(r1),r0
mov r0,-(sp)
jmp (r3)

View File

@@ -1,16 +0,0 @@
/ $Header$
.text
.globl los2~
los2~:
mov (sp)+,r3
cmp r0,$01
bne 1f
clr -(sp)
bisb (r1),(sp)
jmp (r3)
1: add r0,r1
asr r0
2: mov -(r1),-(sp)
sob r0,2b
jmp (r3)

View File

@@ -1,13 +0,0 @@
/ $Header$
.text
.globl mlf~
.globl setfloat~
mlf~:
mov (sp)+,r1
jsr pc,setfloat~
movf (sp)+,r0
mulf (sp)+,r0
movf r0,-(sp)
setd
jmp (r1)

View File

@@ -1,20 +0,0 @@
/ $Header$
.text
.globl mli~
.globl unknown~,mli4~
mli~:
cmp r0,$04
bgt 1f
beq 2f
mov (sp)+,r0
mov (sp)+,r1
mul (sp)+,r1
mov r1,-(sp)
jmp (r0)
2: mov (sp)+,r3
jsr pc,mli4~
mov r1,-(sp)
mov r0,-(sp)
jmp (r3)
1: jmp unknown~

View File

@@ -1,20 +0,0 @@
/ $Header$
.text
.globl mli4~
.globl save~,retu~
mli4~:
jsr pc,save~
mov 02(sp),r2
sxt r1
sub (sp),r1
mov 06(sp),r0
sxt r3
sub 04(sp),r3
mul r0,r1
mul r2,r3
add r1,r3
mul r2,r0
sub r3,r0
add $010,sp
jmp retu~

View File

@@ -1,20 +0,0 @@
/ $Header$
.text
.globl mlu~
.globl unknown~,mlu4~
mlu~:
cmp r0,$04
bgt 1f
beq 2f
mov (sp)+,r0
mov (sp)+,r1
mul (sp)+,r1
mov r1,-(sp)
jmp (r0)
2: mov (sp)+,r3
jsr pc,mlu4~
mov r1,-(sp)
mov r0,-(sp)
jmp (r3)
1: jmp unknown~

View File

@@ -1,24 +0,0 @@
/ $Header$
.text
.globl mlu4~
.globl save~,retu~
mlu4~:
jsr pc,save~
clr r0
mov 02(sp),r1
mov 06(sp),r3
mul r3,r0
tst r3
bge 1f
ashc $15.,r0
1: mov 02(sp),r3
clr r2
mul 04(sp),r2
add r3,r0
mov 06(sp),r3
clr r2
mul (sp),r2
add r3,r0
add $010,sp
jmp retu~

View File

@@ -1,146 +0,0 @@
/ $Header$
.text
.globl mon~
.globl sigtrp~,save~,retu~,save1~
indir = 0
fork = 2
getpid = 20.
sigtrp = 48.
EBADMON = 25.
HBMASK = 0177400
REG01M = 030
REG1M = 020
ERRMASK = 040
/ Associated with every monitor call is a descriptor.
/ The low order three bits describe how values are returned,
/ the next two bits specify if arguments are expected in
/ r0 and/or r1, the next bit is not used, and the next
/ three bits specify the number of arguments disregarding
/ arguments in registers.
mon~:
cmp 02(sp),$sigtrp
bne 1f
jmp sigtrp~
1: jsr pc,save~
mov (sp)+,r4
mov r4,r2
asl r4
mov args(r4),r3
mov r3,r4
bit $ERRMASK,r4
bne err
cmp r2,$fork
bne 2f
jbr fork~
2: bic $HBMASK,r2
bis $sys,r2
mov r2,9f
bit $REG01M,r3
beq 1f
mov (sp)+,r0
bit $REG1M,r3
beq 1f
mov (sp)+,r1
1: ash $-6,r3
beq 2f
mov $[9f+2],r2
1: mov (sp)+,(r2)+
sob r3,1b
2: sys indir ; 9f
bcs 2f
clr r3
4: asr r4
bcc 1f
mov r0,-(sp)
1: asr r4
bcc 1f
mov r1,-(sp)
1: asr r4
bcc 1f
clr -(sp)
1: jmp retu~
2: mov r0,-(sp)
mov r0,-(sp)
jmp retu~
fork~:
sys fork
br 1f
bcs 2b
clr r1
br 4b
1: mov $1,r1
br 4b
err:
mov $EBADMON,-(sp)
jsr pc,trp~
tst (sp)+
jmp retu~
.data
.even
9: .=.+12.
args: ERRMASK / 0 : error
010 / 1 : exit(st); ---
07 / 2 : fork(); e10
0215 / 3 : read(addr,nb,fild); e-0
0215 / 4 : write(addr,nb,fild); e-0
0205 / 5 : open(str,flag); e-0
014 / 6 : close(fild); e--
07 / 7 : wait(); e10
0205 / 8 : creat(str,mode); e-0
0204 / 9 : link(str1,str2); e--
0104 /10 : unlink(str); e--
ERRMASK /11 : error
0104 /12 : chdir(str); e--
03 /13 : time(); -10
0304 /14 : mknod(str,mode,addr); e--
0204 /15 : chmod(str,mode); e--
0304 /16 : chown(str,owner,grp); e--
ERRMASK /17 : error
0204 /18 : stat(str,buf); e--
0217 /19 : lseek(high,low,fild); e10
01 /20 : getpid(); --0
0304 /21 : mount(str1,str2,fl); e--
0104 /22 : umount(str); e--
014 /23 : setuid(uid); e--
03 /24 : getuid(); -01
024 /25 : stime(high,low); e--
0315 /26 : ptrace(pid,addr,req,d); e-0
011 /27 : alarm(sec); --0
0114 /28 : fstat(buf,fild); e--
0 /29 : pause(); ---
0204 /30 : utime(str,timep); e--
ERRMASK /31 : error
ERRMASK /32 : error
0204 /33 : access(str,mode): e--
010 /34 : nice(incr); ---
0100 /35 : ftime(bufp); ---
0 /36 : sync(); ---
0114 /37 : kill(sig,pid); e--
ERRMASK /38 : error
ERRMASK /39 : error
ERRMASK /40 : error
025 /41 : dup(fild,newfild); e-0
07 /42 : pipe(); e10
0100 /43 : times(buf); ---
0400 /44 : profil(buff,siz,off,sc); ---
ERRMASK /45 : error
014 /46 : setgid(gid); e--
03 /47 : getgid(); -01
0 /48 : sigtrp(trap,sig); e-0; SPECIAL TREATMENT
ERRMASK /49 : error
ERRMASK /50 : error
0104 /51 : acct(file); e--
0304 /52 : phys(seg,siz,phaddr); e--
0104 /53 : lock(flag); e--
0304 /54 : ioctl(fild,req,argp); e--
ERRMASK /55 : error
0204 /56 : mpxcall(cmd,vec); e--
ERRMASK /57 : error
ERRMASK /58 : error
0304 /59 : exece(name,argv,envp); e--
0104 /60 : umask(complmode); e--
0104 /61 : chroot(str); e--

View File

@@ -1,10 +0,0 @@
/ $Header$
.text
.globl ngf~
.globl setfloat~
ngf~:
jsr pc,setfloat~
negf 2(sp)
setd
rts pc

View File

@@ -1,18 +0,0 @@
/ $Header$
.text
.globl ngi~
.globl unknown~
ngi~:
mov (sp)+,r1
cmp r0,$02
bgt 1f
neg (sp)
jmp (r1)
1: cmp r0,$04
bgt 2f
neg (sp)
neg 02(sp)
sbc (sp)
jmp (r1)
2: jmp unknown~

View File

@@ -1,13 +0,0 @@
/ $Header$
.text
.globl nop~
.globl hol0,prf~
nop~:
mov hol0,-(sp)
mov $fmt,-(sp)
jsr pc,prf~
add $04,sp
rts pc
.data
fmt: <test %d\n\0>

View File

@@ -1,34 +0,0 @@
/ $Header$
.text
.globl prf~
.globl save~,retu~,hol0,_printf
prf~:
jsr pc,save~
mov hol0,-(sp)
mov hol0+4,r0
beq 1f
mov r0,r2
mov $40.,r1
3: movb (r2)+,r3
beq 2f
cmpb r3,$0177
bge 1f
cmpb r3,$040
blt 1f
sob r1,3b
clrb (r2)
2: mov sp,r1
mov r1,-(sp)
mov r0,-(sp)
mov $fmt,-(sp)
jsr pc,_printf
add $010,sp
jsr pc,_printf
jmp retu~
1: mov $name,r0
br 2b
.data
fmt: <"%s", sp = %d, line %d: \0>
name: <_unknown file_\0>

View File

@@ -1,63 +0,0 @@
/ $Header$
.text
.globl _printf
write = 4
_printf:
mov r2,-(sp)
mov r3,-(sp)
mov r4,-(sp)
mov sp,r3
mov $buff,r4
add $010,r3
mov (r3)+,r2
prloop:
movb (r2)+,r0
beq ready
cmpb r0,$045
bne 1f
movb (r2)+,r0
cmpb r0,$0144
beq 2f
cmpb r0,$0163
beq 3f
1: movb r0,(r4)+
br prloop
2: mov (r3)+,r1
bge 4f
movb $055,(r4)+
neg r1
4: jsr pc,printn
br prloop
printn:
clr r0
div $010,r0
beq 5f
mov r1,-(sp)
mov r0,r1
jsr pc,printn
mov (sp)+,r1
5: add $060,r1
movb r1,(r4)+
rts pc
3: mov (r3)+,r1
7: movb (r1)+,r0
bne 6f
br prloop
6: movb r0,(r4)+
br 7b
ready:
movb r0,(r4)+
sub $buff,r4
mov $01,r0
mov $buff,9f
mov r4,9f+2
sys write
9: 0; 0
mov (sp)+,r4
mov (sp)+,r3
mov (sp)+,r2
rts pc
.data
buff: .=.+256.

View File

@@ -1,16 +0,0 @@
/ $Header$
.text
.globl rck~
.globl trp~
ERANGE = 1
rck~:
mov (sp)+,r1
cmp (sp),(r0)
blt 1f
cmp (sp),02(r0)
ble 2f
1: mov $ERANGE,-(sp)
jsr pc,trp~
2: jmp (r1)

View File

@@ -1,31 +0,0 @@
/ $Header$
.text
.globl ret~,lfr~,retar
.globl unknown~
/ Size in r0
ret~:
mov r0,r1
beq 1f
asr r1
add $retar,r0
cmp r0,$retend
bhi 9f
3: mov (sp)+,-(r0)
sob r1,3b
1: mov r5,sp
mov (sp)+,r5
rts pc
9: jmp unknown~
lfr~:
mov (sp)+,r3
asr r0
beq 4f
mov $retar,r1
5: mov (r1)+,-(sp)
sob r0,5b
4: jmp (r3)
.data
retar: .=.+16.
retend:

View File

@@ -1,20 +0,0 @@
/ $Header$
.text
.globl rmi~
.globl unknown~,rmi4~
rmi~:
mov (sp)+,r3
cmp r0,$04
bgt 1f
beq 2f
mov 02(sp),r1
sxt r0
div (sp)+,r0
mov r1,(sp)
br 3f
2: jsr pc,rmi4~
mov r1,-(sp)
mov r0,-(sp)
3: jmp (r3)
1: jmp unknown~

View File

@@ -1,76 +0,0 @@
/ $Header$
.text
.globl rmi4~
.globl save~,retu~
rmi4~:
jsr pc,save~
mov 02(sp),r3
sxt r4
bpl 1f
neg r3
1: cmp r4,(sp)
bne hardrmi4
mov 06(sp),r2
mov 04(sp),r1
mov r1,r4
bge 2f
neg r1
neg r2
sbc r1
2: mov r4,-(sp)
clr r0
div r3,r0
mov r1,r0
mov r1,r4
mov r2,r1
div r3,r0
bvc 3f
mov r2,r1
mov r4,r0
sub r3,r0
div r3,r0
tst r1
beq 3f
add r3,r1
3: tst (sp)+
bpl 4f
neg r1
4: sxt r0
br 9f
hardrmi4:
mov 06(sp),r2
mov 04(sp),r1
bpl 5f
neg r1
neg r2
sbc r1
5: clr r0
mov (sp),r3
bge 6f
neg r3
neg 02(sp)
sbc r3
6: mov $16.,r4
1: clc
rol r2
rol r1
rol r0
cmp r3,r0
bhi 7f
bcs 8f
cmp 02(sp),r1
blos 8f
7: sob r4,1b
br 2f
8: sub 02(sp),r1
sbc r0
sub r3,r0
sob r4,1b
2: tst 04(sp)
bge 9f
neg r0
neg r1
sbc r0
9: add $010,sp
jmp retu~

View File

@@ -1,20 +0,0 @@
/ $Header$
.text
.globl rmu~
.globl rmu2~,rmu4~,unknown~
rmu~:
mov (sp)+,r3
cmp r0,$04
bgt 1f
beq 2f
cmp r0,$02
bne 1f
jsr pc,rmu2~
mov r1,-(sp)
jmp (r3)
2: jsr pc,rmu4~
mov r1,-(sp)
mov r0,-(sp)
jmp (r3)
1: jmp unknown~

View File

@@ -1,17 +0,0 @@
/ $Header$
.text
.globl rmu2~
rmu2~:
mov 04(sp),r1
tst 02(sp)
blt 1f
clr r0
div 02(sp),r0
2: mov (sp)+,r0
add $04,sp
jmp (r0)
1: cmp 02(sp),r1
bhi 2b
sub 02(sp),r1
br 2b

View File

@@ -1,53 +0,0 @@
/ $Header$
.text
.globl rmu4~
.globl save~,retu~
rmu4~:
jsr pc,save~
clr r0
tst (sp)
bne hardrmu4
tst 02(sp)
blt hardrmu4
mov 06(sp),r2
mov 04(sp),r1
mov 02(sp),r3
div r3,r0
mov r1,r0
mov r1,r4
mov r2,r1
div r3,r0
bvc 1f
mov r2,r1
mov r4,r0
sub r3,r0
div r3,r0
tst r1
beq 1f
add r3,r1
1: clr r0
br 2f
hardrmu4:
mov 06(sp),r2
mov 04(sp),r1
mov (sp),r3
mov $17.,r4
br 3f
6: clc
rol r2
rol r1
rol r0
3: cmp r3,r0
bhi 4f
bcs 5f
cmp 02(sp),r1
blos 5f
4: sob r4,6b
br 2f
5: sub 02(sp),r1
sbc r0
sub r3,r0
sob r4,6b
2: add $010,sp
jmp retu~

View File

@@ -1,20 +0,0 @@
/ $Header$
.text
.globl rol~
.globl save~,retu~
rol~:
jsr pc,save~
mov (sp)+,r3
3: add r0,sp
mov r0,r1
asr r1
clc
1: rol -(sp)
sob r1,1b
bcc 2f
mov sp,r1
add r0,r1
bis $01,-(r1)
2: sob r3,3b
jmp retu~

View File

@@ -1,19 +0,0 @@
/ $Header$
.text
.globl ror~
.globl save~,retu~
ror~:
asr r0
jsr pc,save~
mov (sp)+,r3
3: mov sp,r1
mov r0,-(sp)
clc
1: ror (r1)+
sob r0,1b
bcc 2f
bis $0100000,02(sp)
2: mov (sp)+,r0
sob r3,3b
jmp retu~

View File

@@ -1,17 +0,0 @@
/ $Header$
.text
.globl sar~
sar~:
mov (sp)+,r3
sub (r0),r1
mov 04(r0),r0
mul r0,r1
add (sp)+,r1
asr r0
beq 1f
2: mov (sp)+,(r1)+
sob r0,2b
jmp (r3)
1: movb (sp)+,(r1)
jmp (r3)

View File

@@ -1,25 +0,0 @@
/ $Header$
.text
.globl save~,retu~,savearea
save~:
mov r5,savearea
mov $[savearea+2],r5
mov r4,(r5)+
mov r3,(r5)+
mov r2,(r5)+
mov (sp)+,r2
mov (sp)+,(r5)+
jmp (r2)
retu~:
mov -(r5),-(sp)
mov -(r5),r2
mov -(r5),r3
mov -(r5),r4
mov -(r5),r5
rts pc
.data
.even
savearea:
.=.+12.

View File

@@ -1,14 +0,0 @@
/ $Header$
.text
.globl sbf~
.globl setfloat~
sbf~:
mov (sp)+,r1
jsr pc,setfloat~
movf (sp)+,r0
subf (sp)+,r0
negf r0
movf r0,-(sp)
setd
jmp (r1)

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