Added .globl, fix in Xfit call

This commit is contained in:
ceriel
1987-08-26 14:45:27 +00:00
3805 changed files with 199429 additions and 14298 deletions

12
mach/pdp/.distr Normal file
View File

@@ -0,0 +1,12 @@
Action
as
cg
top
cv
int
libcc
libem
libpc
libbc
libsys
liboc

View File

@@ -4,23 +4,31 @@ end
name "PDP 11 backend"
dir cg
end
name "PDP 11 target optimizer"
dir top
end
name "PDP 11 conversion program"
dir cv
end
name "PDP 11 interpreter"
system pdp*
dir int
end
name "PDP 11 C libraries"
system pdp*
dir libcc
end
name "PDP 11 EM library"
system pdp*
dir libem
end
name "PDP 11 systemcall library"
dir libsys
end
name "PDP 11 Pascal library"
system pdp*
dir libpc
end
name "PDP 11 Basic library"
system pdp*
dir libbc
end
name "PDP 11 Occam library"
dir liboc
end

7
mach/pdp/as/.distr Normal file
View File

@@ -0,0 +1,7 @@
Makefile
mach0.c
mach1.c
mach2.c
mach3.c
mach4.c
mach5.c

67
mach/pdp/as/Makefile Normal file
View File

@@ -0,0 +1,67 @@
# $Header$
EMHOME = ../../..
h = $(EMHOME)/h
LIBOBJ = $(EMHOME)/modules/lib/libobject.a
CDIR = $(EMHOME)/mach/proto/as
CPP = $(EMHOME)/lib/cpp
DEF =
FFLAG =
INCL = -I. -I$h $(DEF)
CFLAGS = $(FFLAG) -O $(INCL)
YFLAGS = -d
LDFLAGS = $(FFLAG) -i
CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
$(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
COBJ = comm3.o comm4.o comm5.o \
comm6.o comm7.o comm8.o
MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
all: as
install:all
../../install as
cmp:
-../../compare as
clean:
rm -f *.o as as.[cy] y.tab.h
pr: $(MACH)
@pr -n $(MACH)
opr:
make pr | opr
as: $(COBJ) as.o
$(CC) $(LDFLAGS) $(COBJ) as.o $(LIBOBJ) -o as
as.y: $(CDIR)/comm2.y
$(CPP) -P -I. -I$h $(DEF) $(CDIR)/comm2.y >as.y
@echo "expect 1 shift/reduce conflict"
lint: $(CSRC) as.c
lint $(INCL) $(CSRC) as.c
y.tab.h: as.c
$(COBJ): y.tab.h
$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
as.y: mach2.c
comm3.o: mach3.c
as.y: mach4.c
comm8.o: mach5.c
comm3.o: $(CDIR)/comm3.c
$(CC) -c $(CFLAGS) $(CDIR)/comm3.c
comm4.o: $(CDIR)/comm4.c
$(CC) -c $(CFLAGS) $(CDIR)/comm4.c
comm5.o: $(CDIR)/comm5.c
$(CC) -c $(CFLAGS) $(CDIR)/comm5.c
comm6.o: $(CDIR)/comm6.c
$(CC) -c $(CFLAGS) $(CDIR)/comm6.c
comm7.o: $(CDIR)/comm7.c
$(CC) -c $(CFLAGS) $(CDIR)/comm7.c
comm8.o: $(CDIR)/comm8.c
$(CC) -c $(CFLAGS) $(CDIR)/comm8.c

25
mach/pdp/as/mach0.c Normal file
View File

@@ -0,0 +1,25 @@
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
#define RCSID0 "$Header$"
/*
* PDP 11 machine dependent options
*/
#define THREE_PASS
#define WORDS_REVERSED
#define LISTING
#define RELOCATION
#undef ISALPHA
#define ISALPHA(c) (isalpha(c) || c == '_' || c == '.' || c == '~')
#undef ISALNUM
#define ISALNUM(c) (isalnum(c) || c == '_' || c == '.' || c == '~')
#undef ALIGNWORD
#define ALIGNWORD 2
#undef ALIGNSECT
#define ALIGNSECT 2
#undef BITMAX
#define BITMAX 4000

39
mach/pdp/as/mach1.c Normal file
View File

@@ -0,0 +1,39 @@
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
#define RCSID1 "$Header$"
#
/*
* PDP 11 Machine dependent C declarations
*/
/* Addressing modes */
#define RMODE 00
#define AIMODE 020
#define ADMODE 040
#define INDMODE 060
#define RDEFMODE 010
#define AIDEFMODE 030
#define ADDEFMODE 050
#define INDDEFMODE 070
#define OPLDF 0172400
#define OPSTF 0174000
#define OPSOB 077000
#define OPBRA 0400
#define low3(z) (((short) z) & 07)
#define low6(z) (((short) z) & 077)
#define low7(z) (((short) z) & 0177)
#define fit3(z) (low3(z) == (z))
#define fit6(z) (low6(z) == (z))
#define fit8(z) (lowb(z) == (z))
extern expr_t exp_1, exp_2;
extern int rel_1, rel_2;
extern int im1flag INIT(0);
extern int im2flag INIT(0);
extern valu_t adjust();

40
mach/pdp/as/mach2.c Normal file
View File

@@ -0,0 +1,40 @@
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
#define RCSID2 "$Header$"
/*
* PDP 11 machine dependent yacc declarations
*/
%token <y_word> REG
%token <y_word> FREG
%token <y_word> FRSP
%token <y_word> JMP
%token <y_word> OP_SO
%token <y_word> OP_DO
%token <y_word> OP_R_SO
%token <y_word> BR
%token <y_word> EJMP
%token <y_word> JSR
%token <y_word> RTS
%token <y_word> MARK
%token <y_word> SOB
%token <y_word> SPL
%token <y_word> TRAP
%token <y_word> OP_NO
%token <y_word> OP_SO_R
%token <y_word> MFP
%token <y_word> FOP_FSO_FR
%token <y_word> FOP_NO
%token <y_word> FOP_FSO
%token <y_word> FOP_SO
%token <y_word> MOVF
%token <y_word> FOP_SO_FR
%token <y_word> FOP_FR_SO
%token <y_word> FOP_FR_FSO
%token <y_word> CLEARCC
%token <y_word> SETCC
%type <y_word> opr1, opr2, op2, fopr2, fopr1, ari, ainc, adec
%type <y_word> fop2, clcc, secc, fregister

155
mach/pdp/as/mach3.c Normal file
View File

@@ -0,0 +1,155 @@
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
#define RCSID3 "$Header$"
/*,
* PDP 11 keywords,
*/
0, REG, 00, "r0",
0, REG, 01, "r1",
0, REG, 02, "r2",
0, REG, 03, "r3",
0, REG, 04, "r4",
0, REG, 05, "r5",
0, REG, 06, "r6",
0, REG, 06, "sp",
0, REG, 07, "r7",
0, REG, 07, "pc",
0, FREG, 00, "fr0",
0, FREG, 01, "fr1",
0, FREG, 02, "fr2",
0, FREG, 03, "fr3",
0, FRSP, 04, "fr4",
0, FRSP, 05, "fr5",
0, OP_SO, 05000, "clr",
0, OP_SO, 0105000, "clrb",
0, OP_SO, 05100, "com",
0, OP_SO, 0105100, "comb",
0, OP_SO, 005200, "inc",
0, OP_SO, 0105200, "incb",
0, OP_SO, 005300, "dec",
0, OP_SO, 0105300, "decb",
0, OP_SO, 005400, "neg",
0, OP_SO, 0105400, "negb",
0, OP_SO, 005700, "tst",
0, OP_SO, 0105700, "tstb",
0, OP_SO, 006200, "asr",
0, OP_SO, 0106200, "asrb",
0, OP_SO, 006300, "asl",
0, OP_SO, 0106300, "aslb",
0, OP_SO, 006000, "ror",
0, OP_SO, 0106000, "rorb",
0, OP_SO, 006100, "rol",
0, OP_SO, 0106100, "rolb",
0, OP_SO, 000300, "swab",
0, OP_SO, 005500, "adc",
0, OP_SO, 0105500, "adcb",
0, OP_SO, 005600, "sbc",
0, OP_SO, 0105600, "sbcb",
0, OP_SO, 006700, "sxt",
0, OP_DO, 010000, "mov",
0, OP_DO, 0110000, "movb",
0, OP_DO, 020000, "cmp",
0, OP_DO, 0120000, "cmpb",
0, OP_DO, 060000, "add",
0, OP_DO, 0160000, "sub",
0, OP_DO, 030000, "bit",
0, OP_DO, 0130000, "bitb",
0, OP_DO, 040000, "bic",
0, OP_DO, 0140000, "bicb",
0, OP_DO, 050000, "bis",
0, OP_DO, 0150000, "bisb",
0, OP_R_SO, 074000, "xor",
0, JMP, 0100, "jmp",
0, BR, 0400, "br",
0, BR, 01000, "bne",
0, BR, 01400, "beq",
0, BR, 0100000, "bpl",
0, BR, 0100400, "bmi",
0, BR, 0102000, "bvc",
0, BR, 0102400, "bvs",
0, BR, 0103000, "bcc",
0, BR, 0103400, "bcs",
0, BR, 002000, "bge",
0, BR, 002400, "blt",
0, BR, 003000, "bgt",
0, BR, 003400, "ble",
0, BR, 0101000, "bhi",
0, BR, 0101400, "blos",
0, BR, 0103000, "bhis",
0, BR, 0103400, "blo",
0, EJMP, 0400, "jbr",
0, EJMP, 01000, "jne",
0, EJMP, 01400, "jeq",
0, EJMP, 0100000, "jpl",
0, EJMP, 0100400, "jmi",
0, EJMP, 0102000, "jvc",
0, EJMP, 0102400, "jvs",
0, EJMP, 0103000, "jcc",
0, EJMP, 0103400, "jcs",
0, EJMP, 02000, "jge",
0, EJMP, 02400, "jlt",
0, EJMP, 03000, "jgt",
0, EJMP, 03400, "jle",
0, EJMP, 0101000, "jhi",
0, EJMP, 0101400, "jlos",
0, EJMP, 0103000, "jhis",
0, EJMP, 0103400, "jlo",
0, JSR, 004000, "jsr",
0, RTS, 000200, "rts",
0, MARK, 006400, "mark",
0, SOB, 077000, "sob",
0, SPL, 0230, "spl",
0, TRAP, 0104000, "emt",
0, TRAP, 0104400, "trap",
0, TRAP, 0104400, "sys",
0, OP_NO, 03, "bpt",
0, OP_NO, 04, "iot",
0, OP_NO, 02, "rti",
0, OP_NO, 06, "rtt",
0, OP_NO, 0, "halt",
0, OP_NO, 01, "wait",
0, OP_NO, 05, "reset",
0, OP_NO, 0170000, "cfcc",
0, OP_NO, 0170002, "seti",
0, OP_NO, 0170012, "setl",
0, OP_NO, 0170001, "setf",
0, OP_NO, 0170011, "setd",
0, CLEARCC, 0241, "clc",
0, CLEARCC, 0242, "clv",
0, CLEARCC, 0244, "clz",
0, CLEARCC, 0250, "cln",
0, SETCC, 0261, "sec",
0, SETCC, 0262, "sev",
0, SETCC, 0264, "sez",
0, SETCC, 0270, "sen",
0, OP_SO_R, 070000, "mul",
0, OP_SO_R, 071000, "div",
0, OP_SO_R, 072000, "ash",
0, OP_SO_R, 073000, "ashc",
0, MFP, 006500, "mfpi",
0, MFP, 0106500, "mfpd",
0, MFP, 006600, "mtpi",
0, MFP, 0106600, "mtpd",
0, FOP_FSO_FR, 0172000, "addf",
0, FOP_FSO_FR, 0173000, "subf",
0, FOP_FSO_FR, 0171000, "mulf",
0, FOP_FSO_FR, 0174400, "divf",
0, FOP_FSO_FR, 0173400, "cmpf",
0, FOP_FSO_FR, 0171400, "modf",
0, FOP_FSO, 0170400, "clrf",
0, FOP_FSO, 0170700, "negf",
0, FOP_FSO, 0170600, "absf",
0, FOP_FSO, 0170500, "tstf",
0, FOP_SO, 0170100, "ldfps",
0, FOP_SO, 0170200, "stfps",
0, FOP_SO, 0170300, "stst",
0, MOVF, 0, "movf",
0, FOP_SO_FR, 0177000, "movif",
0, FOP_SO_FR, 0176400, "movie",
0, FOP_FR_SO, 0175400, "movfi",
0, FOP_FR_SO, 0175000, "movei",
0, FOP_FSO_FR, 0177400, "movof",
0, FOP_FR_FSO, 0176000, "movfo",

154
mach/pdp/as/mach4.c Normal file
View File

@@ -0,0 +1,154 @@
#define RCSID4 "$Header$"
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*
*/
/*
* PDP 11 dependent yacc table
*/
operation
: OP_SO opr1
{ emit2( $1 | $2 ); op1($2); }
| OP_DO opr1 ',' opr2
{ emit2( $1 | ($2 << 6) | $4); op1($2); op2($4);}
| OP_R_SO REG ',' opr1
{ emit2( $1 | ($2 << 6) | $4); op1($4); }
| BR expr
{ branch( $1, $2); }
| EJMP expr
{ ejump( $1, $2); }
| JMP opr1
{ jump( $1, $2); }
| JSR REG ',' opr1
{ emit2( $1 | ($2 << 6) | $4); op1($4); }
| RTS REG
{ emit2($1 | $2); }
| MARK absexp
{ fit(fit6($2)); emit2($1 | $2); }
| SOB REG ',' expr
{ sob($2, $4); }
| SPL absexp
{ fit(fit3($2)); emit2( $1 | $2 ); }
| TRAP absexp
{ fit(fit8($2)); emit2( $1 | $2 ); }
| OP_NO
{emit2($1); }
| clcc
{ emit2($1); }
| secc
{ emit2($1); }
| OP_SO_R opr1 ',' REG
{ emit2( $1 | ($4 << 6) | $2); op1($2); }
| MFP opr1
{ emit2( $1 | $2); op1($2); }
| FOP_FSO_FR fopr1 ',' fregister
{emit2($1 | ($4 << 6) | $2); op1($2); }
| FOP_FSO fopr1
{ emit2( $1 | $2); op1($2); }
| FOP_SO opr1
{ emit2( $1 | $2); op1($2); }
| MOVF fop2 ',' fregister
{ emit2(OPLDF | ($4 << 6) | $2); op2($2);}
| MOVF fregister ',' fopr1
{ emit2(OPSTF | ($2 << 6) | $4); op1($4); }
| FOP_SO_FR opr1 ',' fregister
{ emit2($1 | ($4 << 6) | $2); op1($2); }
| FOP_FR_SO fregister ',' opr1
{ emit2($1 | ($2 << 6) | $4); op1($4); }
| FOP_FR_FSO fregister ',' fopr1
{ emit2($1 | ($2 << 6) | $4); op1($4); }
;
clcc
: CLEARCC
| clcc '|' CLEARCC
{ $$ = ( $1 | $3 ); }
;
secc
: SETCC
| secc '|' SETCC
{ $$ = ( $1 | $3 ); }
;
opr1
: opr2
{ $$ = $1;
exp_1 = exp_2;
RELOMOVE(rel_1, rel_2);
im1flag = im2flag;
im2flag=0;
}
;
opr2
: REG
| op2
;
op2
: ari
{ $$ = ( RDEFMODE | $1); }
| '*' REG
{ $$ = ( RDEFMODE | $2); }
| ainc
{ $$ = ( AIMODE | $1 ); }
| adec
{ $$ = ( ADMODE | $1 ); }
| expr ari
{ exp_2 = $1; $$ = ( INDMODE | $2); im2flag = 1;
RELOMOVE(rel_2, relonami);
}
| '*' expr ari
{ exp_2 = $2; $$ = ( INDDEFMODE | $3); im2flag = 1;
RELOMOVE(rel_2, relonami);
}
| '*' ainc
{ $$ = ( AIDEFMODE | $2 ); }
| '*' adec
{ $$ = ( ADDEFMODE | $2 ); }
| expr
{ exp_2 = $1; $$ = (INDMODE | 07); im2flag = 1;
RELOMOVE(rel_2, relonami);
}
| '$' expr
{ exp_2 =$2; $$ = ( AIMODE | 07); im2flag = 1;
RELOMOVE(rel_2, relonami);
}
| '*' '$' expr
{ exp_2 = $3; $$ = ( AIDEFMODE | 07 ); im2flag = 1;
RELOMOVE(rel_2, relonami);
}
| '*' expr
{ exp_2 = $2; $$ = ( INDDEFMODE | 07 ); im2flag = 1;
RELOMOVE(rel_2, relonami);
}
;
fopr1
: fopr2
{ $$ = $1; exp_1 = exp_2; im1flag = im2flag; im2flag=0;
RELOMOVE(rel_1, rel_2);
}
;
fopr2
: fregister
| fop2
;
fop2
: FRSP
| op2
;
ari
: '(' REG ')'
{ $$ = $2; }
;
ainc
: ari '+'
;
adec
: '-' ari
{ $$ = $2; }
;
fregister
: FREG
| REG
;

124
mach/pdp/as/mach5.c Normal file
View File

@@ -0,0 +1,124 @@
#define RCSID5 "$Header$"
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*
*/
op1(mode) {
int relpc = 0;
if (im1flag) {
if (mode == 067 || mode == 077) {
exp_1.val = adjust(exp_1);
relpc = RELPC;
}
#ifdef RELOCATION
RELOMOVE(relonami, rel_1);
if (rflag != 0 && PASS_RELO)
newrelo(exp_1.typ, RELO2|relpc);
#endif
emit2(exp_1.val);
im1flag = 0;
}
}
op2(mode) {
int relpc = 0;
if (im2flag) {
if (mode == 067 || mode == 077) {
relpc = RELPC;
exp_2.val = adjust(exp_2);
}
#ifdef RELOCATION
RELOMOVE(relonami, rel_2);
if (rflag != 0 && PASS_RELO)
newrelo(exp_2.typ, RELO2|relpc);
#endif
emit2(exp_2.val);
im2flag = 0;
}
}
branch(opc,exp) expr_t exp; {
register eval;
register sm;
eval = adjust(exp) >> 1;
sm = fitb(eval);
if ((exp.typ & ~S_DOT) != DOTTYP && pass >= PASS_2) sm = 0;
if (!sm && pass >= PASS_2) {
serror("label too far");
}
emit2(opc | lowb(eval));
}
ejump(opc, exp) expr_t exp; {
register sm,eval;
int gain;
# ifdef THREE_PASS
eval = adjust(exp) >> 1;
sm = fitb(eval);
if ((exp.typ & ~S_DOT) != DOTTYP) {
sm = 0;
}
gain = (opc == OPBRA ? 2 : 4);
if (small(sm,gain)) {
emit2( opc | lowb(eval));
}
else {
# endif
if (opc != OPBRA) {
emit2((opc^0400) | 02);
}
exp_1 = exp;
im1flag = 1;
emit2(0100|067);
op1(067);
# ifdef THREE_PASS
}
# endif
}
sob(reg, exp) expr_t exp; {
if ((exp.typ & ~S_DOT) != DOTTYP) {
serror("error in sob-label");
}
exp.val = ( - adjust(exp) ) >> 1;
fit(fit6(exp.val));
emit2( OPSOB | (reg << 6) | exp.val);
}
jump(opc,opr) {
register val;
# ifdef THREE_PASS
if (opr==067) {
register sm = 0;
val = adjust(exp_1) >> 1;
if ( fitb(val) && (exp_1.typ & ~S_DOT) == DOTTYP) {
sm = 1;
}
if (small(sm,2)) {
emit2(OPBRA | lowb(val));
im1flag = 0;
return(0);
}
}
# endif
emit2(opc | opr);
op1(opr);
}
valu_t adjust(exp) expr_t exp; {
valu_t val;
val = exp.val - DOTVAL - 2;
# ifdef THREE_PASS
if (pass == PASS_2 && val > 0) val -= DOTGAIN;
# endif
return(val);
}

4
mach/pdp/cg/.distr Normal file
View File

@@ -0,0 +1,4 @@
Makefile
mach.c
mach.h
table

View File

@@ -1,12 +1,13 @@
# $Header$
PREFLAGS=-I../../../h -I. -DNDEBUG
EMHOME=../../..
PREFLAGS=-I$(EMHOME)/h -I. -DNDEBUG
PFLAGS=
CFLAGS=$(PREFLAGS) $(PFLAGS) -O
LDFLAGS=-i $(PFLAGS)
LINTOPTS=-hbxac
LIBS=../../../lib/em_data.a
CDIR=../../proto/cg
LIBS=$(EMHOME)/lib/em_data.a
CDIR=$(EMHOME)/mach/proto/cg
CFILES=$(CDIR)/codegen.c $(CDIR)/compute.c $(CDIR)/equiv.c $(CDIR)/fillem.c \
$(CDIR)/gencode.c $(CDIR)/glosym.c $(CDIR)/main.c $(CDIR)/move.c \
$(CDIR)/nextem.c $(CDIR)/reg.c $(CDIR)/regvar.c $(CDIR)/salloc.c \
@@ -14,46 +15,45 @@ CFILES=$(CDIR)/codegen.c $(CDIR)/compute.c $(CDIR)/equiv.c $(CDIR)/fillem.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
all: tables.c
make "EMHOME="$(EMHOME) cg
cg: tables.o $(OFILES)
cc $(LDFLAGS) $(OFILES) tables.o $(LIBS) -o cg
$(CC) $(LDFLAGS) $(OFILES) tables.o $(LIBS) -o cg
tables.o: tables.c
cc -c $(PREFLAGS) -I$(CDIR) tables.c
$(CC) -c $(PREFLAGS) -I$(CDIR) tables.c
codegen.o: $(CDIR)/codegen.c
cc -c $(CFLAGS) $(CDIR)/codegen.c
$(CC) -c $(CFLAGS) $(CDIR)/codegen.c
compute.o: $(CDIR)/compute.c
cc -c $(CFLAGS) $(CDIR)/compute.c
$(CC) -c $(CFLAGS) $(CDIR)/compute.c
equiv.o: $(CDIR)/equiv.c
cc -c $(CFLAGS) $(CDIR)/equiv.c
$(CC) -c $(CFLAGS) $(CDIR)/equiv.c
fillem.o: $(CDIR)/fillem.c
cc -c $(CFLAGS) $(CDIR)/fillem.c
$(CC) -c $(CFLAGS) $(CDIR)/fillem.c
gencode.o: $(CDIR)/gencode.c
cc -c $(CFLAGS) $(CDIR)/gencode.c
$(CC) -c $(CFLAGS) $(CDIR)/gencode.c
glosym.o: $(CDIR)/glosym.c
cc -c $(CFLAGS) $(CDIR)/glosym.c
$(CC) -c $(CFLAGS) $(CDIR)/glosym.c
main.o: $(CDIR)/main.c
cc -c $(CFLAGS) $(CDIR)/main.c
$(CC) -c $(CFLAGS) $(CDIR)/main.c
move.o: $(CDIR)/move.c
cc -c $(CFLAGS) $(CDIR)/move.c
$(CC) -c $(CFLAGS) $(CDIR)/move.c
nextem.o: $(CDIR)/nextem.c
cc -c $(CFLAGS) $(CDIR)/nextem.c
$(CC) -c $(CFLAGS) $(CDIR)/nextem.c
reg.o: $(CDIR)/reg.c
cc -c $(CFLAGS) $(CDIR)/reg.c
$(CC) -c $(CFLAGS) $(CDIR)/reg.c
regvar.o: $(CDIR)/regvar.c
cc -c $(CFLAGS) $(CDIR)/regvar.c
$(CC) -c $(CFLAGS) $(CDIR)/regvar.c
salloc.o: $(CDIR)/salloc.c
cc -c $(CFLAGS) $(CDIR)/salloc.c
$(CC) -c $(CFLAGS) $(CDIR)/salloc.c
state.o: $(CDIR)/state.c
cc -c $(CFLAGS) $(CDIR)/state.c
$(CC) -c $(CFLAGS) $(CDIR)/state.c
subr.o: $(CDIR)/subr.c
cc -c $(CFLAGS) $(CDIR)/subr.c
$(CC) -c $(CFLAGS) $(CDIR)/subr.c
var.o: $(CDIR)/var.c
cc -c $(CFLAGS) $(CDIR)/var.c
$(CC) -c $(CFLAGS) $(CDIR)/var.c
install: all
../../install cg
@@ -61,8 +61,7 @@ install: all
cmp: all
-../../compare cg
distr:
make tables.c
distr: tables.c
rm -f tables1.[ch]
cp tables.c tables1.c
cp tables.h tables1.h
@@ -71,7 +70,7 @@ distr:
tables.c: table
-mv tables.h tables.h.save
/lib/cpp -P table | ../../../lib/cgg > debug.out
$(EMHOME)/lib/cpp -P table | $(EMHOME)/lib/cgg > debug.out
-if cmp -s tables.h.save tables.h; then mv tables.h.save tables.h; else exit 0; fi
-if cmp -s /dev/null tables.h; then mv tables.h.save tables.h; else exit 0; fi

View File

@@ -3,19 +3,8 @@ 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
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*
* Author: Hans van Staveren
*/
@@ -45,12 +34,12 @@ con_part(sz,w) register sz; word w; {
}
con_mult(sz) word sz; {
long l;
long l, atol();
if (sz != 4)
fatal("bad icon/ucon size");
#ifdef ACK_ASS
fprintf(codefile,".long %s\n",str);
fprintf(codefile,".data4 %s\n",str);
#else
l = atol(str);
fprintf(codefile,"\t%o;%o\n",(int)(l>>16),(int)l);
@@ -61,24 +50,55 @@ con_mult(sz) word sz; {
* 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;
double f, f1;
double atof(), frexp(), modf();
int i, j;
int sign = 0;
int fraction ;
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");
f = atof(str);
f = frexp(f, &i);
if (f < 0) {
f = -f;
sign = 1;
}
if (f == 0) {
if (argval == 8) fprintf(codefile, ".data2 0, 0\n");
fprintf(codefile, ".data2 0, 0\n");
return;
}
while (f < 0.5) {
f += f;
i --;
}
f = modf(2 * f, &f1); /* hidden bit */
i = (i + 128) & 0377;
fraction = (sign << 15) | (i << 7);
for (j = 6; j>= 0; j--) {
if (f >= 0.5) fraction |= (1 << j);
f = modf(2*f, &f1);
}
fprintf(codefile, ".data2 0%o", fraction);
for (i = argval / 2 - 1; i; i--) {
fraction = 0;
for (j = 15; j>= 0; j--) {
if (f >= 0.5) fraction |= (1 << j);
f = modf(2*f, &f1);
}
fprintf(codefile, ", 0%o", fraction);
}
putc('\n', codefile);
#else
double f;
register short *p,i;
double atof();
int i;
short *p;
if (argval != 4 && argval != 8)
fatal("bad fcon size");
@@ -236,8 +256,15 @@ mes(type) word type; {
}
char *segname[] = {
#ifdef ACK_ASS
".sect .text", /* SEGTXT */
".sect .data", /* SEGCON */
".sect .rom", /* SEGROM */
".sect .bss" /* SEGBSS */
#else
".text", /* SEGTXT */
".data", /* SEGCON */
".data", /* SEGROM */
".bss" /* SEGBSS */
#endif
};

View File

@@ -1,10 +1,14 @@
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* $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 */
#define ACK_ASS /* code for ACK assembler */
#ifdef ACK_ASS
#define COMMENTCHAR '!'
@@ -26,21 +30,27 @@
#define cst_fmt "$0%o"
#define off_fmt "0%o"
#define ilb_fmt "I%03x%x"
#define ilb_fmt "I%x_%x"
#define dlb_fmt "_%d"
#define hol_fmt "hol%d"
#define hol_off "0%o+hol%d"
#define hol_off "0%lo+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)
#define con_cst(x) fprintf(codefile,".data2 0%lo\n",x)
#define con_ilb(x) fprintf(codefile,".data2 %s\n",x)
#define con_dlb(x) fprintf(codefile,".data2 %s\n",x)
#else
#define con_cst(x) fprintf(codefile,"0%o\n",x)
#define con_cst(x) fprintf(codefile,"0%lo\n",x)
#define con_ilb(x) fprintf(codefile,"%s\n",x)
#define con_dlb(x) fprintf(codefile,"%s\n",x)
#endif
#ifdef ACK_ASS
#define modhead ".sect .text; .sect .rom; .sect .data; .sect .bss\n"
#define fmt_id(f,t) sprintf(t,"_%s",f)
#else
#define id_first '_'
#endif
#define BSS_INIT 0

135
mach/pdp/cg/peep.c Normal file
View File

@@ -0,0 +1,135 @@
#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);
}

View File

@@ -55,20 +55,19 @@ EM_WSIZE=2
EM_PSIZE=2
EM_BSIZE=SL
TIMEFACTOR= 1/300
FORMAT="0%o"
TIMEFACTOR= 1/30
REGISTERS:
r0 = ("r0", 2), REG.
r1 = ("r1", 2), REG, ODD_REG.
#ifdef REGVARS
r2 = ("r2", 2) regvar, REG.
r2 = ("r2", 2) regvar, RREG.
#else
/* r2 = ("r2", 2), REG. */
#endif
r3 = ("r3", 2), REG, ODD_REG.
#ifdef REGVARS
r4 = ("r4", 2) regvar, REG.
r4 = ("r4", 2) regvar, RREG.
#else
/* r4 = ("r4", 2), REG. */
#endif
@@ -96,31 +95,31 @@ TOKENS:
* Types on the EM-machine *
********************************/
CONST2 = {INT num;} 2 cost=(2,300) "$%[num]"
LOCAL2 = {INT ind,size;} 2 cost=(2,600) "%[ind](r5)"
LOCAL4 = {INT ind,size;} 4 cost=(2,1200) "%[ind](r5)"
CONST2 = {INT num;} 2 cost=(2,30) "$%[num]"
LOCAL2 = {INT ind,size;} 2 cost=(2,60) "%[ind](r5)"
LOCAL4 = {INT ind,size;} 4 cost=(2,120) "%[ind](r5)"
ADDR_LOCAL = {INT ind;} 2
ADDR_EXTERNAL = {STRING ind;} 2 cost=(2,300) "$%[ind]"
ADDR_EXTERNAL = {STRING ind;} 2 cost=(2,30) "$%[ind]"
/********************************************************
* Now mostly addressing modes of target machine *
********************************************************/
regdef2 = {REGISTER reg;} 2 cost=(0,300) "*%[reg]"
regind2 = {REGISTER reg; STRING ind;} 2 cost=(2,600) "%[ind](%[reg])"
reginddef2 = {REGISTER reg; STRING ind;} 2 cost=(2,1050) "*%[ind](%[reg])"
regdef2 = {REGISTER reg;} 2 cost=(0,30) "(%[reg])"
regind2 = {REGISTER reg; STRING ind;} 2 cost=(2,60) "%[ind](%[reg])"
reginddef2 = {REGISTER reg; STRING ind;} 2 cost=(2,105) "*%[ind](%[reg])"
regconst2 = {REGISTER reg; STRING ind;} 2
/********************************************************
* This means : add "reg" and "ind" to get address. *
* Not really addressable on the PDP 11 *
********************************************************/
relative2 = {STRING ind;} 2 cost=(2,600) "%[ind]"
reldef2 = {STRING ind;} 2 cost=(2,1050) "*%[ind]"
regdef1 = {REGISTER reg;} 2 cost=(0,300) "*%[reg]"
regind1 = {REGISTER reg; STRING ind;} 2 cost=(2,600) "%[ind](%[reg])"
reginddef1 = {REGISTER reg; STRING ind;} 2 cost=(2,1050) "*%[ind](%[reg])"
relative1 = {STRING ind;} 2 cost=(2,600) "%[ind]"
reldef1 = {STRING ind;} 2 cost=(2,1050) "*%[ind]"
relative2 = {STRING ind;} 2 cost=(2,60) "%[ind]"
reldef2 = {STRING ind;} 2 cost=(2,105) "*%[ind]"
regdef1 = {REGISTER reg;} 2 cost=(0,30) "(%[reg])"
regind1 = {REGISTER reg; STRING ind;} 2 cost=(2,60) "%[ind](%[reg])"
reginddef1 = {REGISTER reg; STRING ind;} 2 cost=(2,105) "*%[ind](%[reg])"
relative1 = {STRING ind;} 2 cost=(2,60) "%[ind]"
reldef1 = {STRING ind;} 2 cost=(2,105) "*%[ind]"
/************************************************************************
* fto* are floats converted to *, conversion is delayed to be combined *
@@ -134,12 +133,12 @@ ftolong = {REGISTER reg;} 4
* ...4 and ...8 are only addressable by the floating point processor. *
************************************************************************/
regind4 = {REGISTER reg; STRING ind; } 4 cost=(2,3630) "%[ind](%[reg])"
relative4 = {STRING ind; } 4 cost=(2,3630) "%[ind]"
regdef4 = {REGISTER reg;} 4 cost=(2,3240) "*%[reg]"
regdef8 = {REGISTER reg;} 8 cost=(2,5220) "*%[reg]"
relative8 = {STRING ind; } 8 cost=(2,5610) "%[ind]"
regind8 = {REGISTER reg; STRING ind;} 8 cost=(2,5610) "%[ind](%[reg])"
regind4 = {REGISTER reg; STRING ind; } 4 cost=(2,363) "%[ind](%[reg])"
relative4 = {STRING ind; } 4 cost=(2,363) "%[ind]"
regdef4 = {REGISTER reg;} 4 cost=(2,324) "(%[reg])"
regdef8 = {REGISTER reg;} 8 cost=(2,522) "(%[reg])"
relative8 = {STRING ind; } 8 cost=(2,561) "%[ind]"
regind8 = {REGISTER reg; STRING ind;} 8 cost=(2,561) "%[ind](%[reg])"
TOKENEXPRESSIONS:
SCR_REG = REG * SCRATCH
@@ -148,7 +147,7 @@ SCR_DBL_REG = DBL_REG * SCRATCH
SCR_ODD_REG = ODD_REG * SCRATCH
SCR_REG_PAIR = REG_PAIR * SCRATCH
all= ALL
source2 = REG + regdef2 + regind2 + reginddef2 + localbase +
source2 = RREG + REG + regdef2 + regind2 + reginddef2 + localbase +
relative2 + reldef2 + ADDR_EXTERNAL + CONST2 + LOCAL2
xsource2 = source2 + ftoint
source1 = regdef1 + regind1 + reginddef1 + relative1 +
@@ -168,8 +167,8 @@ variable2 = relative2 + reldef2
variable4 = relative4
variable8 = relative8
variable = variable2 + variable4 + variable8
dadres2 = relative2 + REG + regind2
regs = REG + REG_PAIR + FLT_REG + FLT_REG_PAIR +
dadres2 = relative2 + RREG + REG + regind2
regs = RREG + REG + REG_PAIR + FLT_REG + FLT_REG_PAIR +
DBL_REG + DBL_REG_PAIR
noconst2 = source2 - CONST2 - ADDR_EXTERNAL
allexeptcon = all - regs - CONST2 - ADDR_LOCAL - ADDR_EXTERNAL
@@ -178,8 +177,10 @@ posextern = variable + regdeferred + indexed + externals
diradr2 = regconst2 + ADDR_EXTERNAL
#ifdef REGVARS
register = RREG + REG
#define INDSTORE remove(allexeptcon-locals) remove(locals, inreg(%[ind])==0)
#else
register = REG
#define INDSTORE remove(allexeptcon)
#endif
@@ -203,7 +204,7 @@ loe | | | {relative2, $1} | |
lil inreg($1)==2| | | {regdef2, regvar($1)} | |
#endif
lil | | | {reginddef2, lb, tostring($1)} | |
lof | REG | | {regind2,%[1],tostring($1)} | |
lof | register | | {regind2,%[1],tostring($1)} | |
... | NC regconst2 |
| {regind2,%[1.reg],tostring($1)+"+"+%[1.ind]} | |
... | NC ADDR_EXTERNAL |
@@ -247,7 +248,7 @@ lxa $1 > 3 | | allocate(REG={LOCAL2, SL, 2}, REG={CONST2,$1-1})
setcc(%[a]) erase(%[a]) erase(%[b])
| {regconst2, %[a], SSL } | |
dch | | | | loi 2 |
loi $1==2 | REG | | {regdef2, %[1]} | |
loi $1==2 | register | | {regdef2, %[1]} | |
... | NC regconst2 | | {regind2, %[1.reg], %[1.ind]} | |
... | NC relative2 | | {reldef2, %[1.ind]} | |
... | NC regind2 | | {reginddef2, %[1.reg], %[1.ind]} | |
@@ -256,7 +257,7 @@ loi $1==2 | REG | | {regdef2, %[1]} | |
... | NC ADDR_EXTERNAL | | {relative2, %[1.ind]} | |
... | NC LOCAL2 |
|{reginddef2, lb, tostring(%[1.ind])}| |
loi $1==1 | REG | | {regdef1, %[1]} | |
loi $1==1 | register | | {regdef1, %[1]} | |
... | NC regconst2 | | {regind1, %[1.reg], %[1.ind]} | |
... | NC ADDR_EXTERNAL | | {relative1, %[1.ind]} | |
... | NC ADDR_LOCAL| |{regind1, lb, tostring(%[1.ind])} | |
@@ -264,11 +265,11 @@ loi $1==1 | REG | | {regdef1, %[1]} | |
... | NC regind2 | | {reginddef1, %[1.reg], %[1.ind]} | |
... | NC regdef2 | | {reginddef1, %[1.reg], "0"}| |
... | NC LOCAL2 | |{reginddef1, lb, tostring(%[1.ind])} | |
loi $1==4 | REG | | {regdef4, %[1]} | |
loi $1==4 | register | | {regdef4, %[1]} | |
... | NC regconst2 | | {regind4, %[1.reg], %[1.ind]} | |
... | NC ADDR_LOCAL | | {LOCAL4,%[1.ind],4} | |
... | NC ADDR_EXTERNAL | | {relative4, %[1.ind]} | |
loi $1==8 | REG | | {regdef8, %[1]} | |
loi $1==8 | register | | {regdef8, %[1]} | |
... | NC regconst2 | | {regind8, %[1.reg], %[1.ind]} | |
... | NC ADDR_LOCAL |
| {regind8, lb , tostring(%[1.ind])} | |
@@ -364,7 +365,7 @@ lae lol ads sti $3==2 && inreg($2)==2 | |
lae lol ads loi $3==2 && inreg($2)==2 | |
| {regconst2, regvar($2), $1} | loi $4 |
#endif
sti $1==2 | REG xsource2 |
sti $1==2 | register xsource2 |
INDSTORE
move(%[2],{regdef2,%[1]}) | | |
... | regconst2 xsource2 |
@@ -382,7 +383,7 @@ sti $1==2 | REG xsource2 |
... | regind2 xsource2 |
INDSTORE
move(%[2],{reginddef2,%[1.reg],%[1.ind]}) | | |
sti $1==1 | REG source1or2 |
sti $1==1 | register source1or2 |
INDSTORE
move(%[2],{regdef1,%[1]}) | | |
... | regconst2 source1or2 |
@@ -400,59 +401,59 @@ sti $1==1 | REG source1or2 |
... | regind2 source1or2 |
INDSTORE
move(%[2],{reginddef1,%[1.reg],%[1.ind]}) | | |
sti $1==4 | dadres2 FLT_REG |
sti $1==4 | NC dadres2 FLT_REG |
INDSTORE
"movfo %[2],*%[1]"
samecc | | |
... | dadres2 ftolong |
... | NC dadres2 ftolong |
INDSTORE
"setl\nmovfi %[2.reg],*%[1]\nseti"
samecc | | |
... | regconst2 FLT_REG |
... | NC regconst2 FLT_REG |
INDSTORE
"movfo %[2],%[1.ind](%[1.reg])"
samecc | | |
... | regconst2 ftolong |
... | NC regconst2 ftolong |
INDSTORE
"setl\nmovfi %[2.reg],%[1.ind](%[1.reg])\nseti"
samecc | | |
... | ADDR_LOCAL FLT_REG |
... | NC ADDR_LOCAL FLT_REG |
INDSTORE
"movfo %[2],%[1.ind](r5)"
samecc | | |
... | ADDR_LOCAL ftolong |
... | NC ADDR_LOCAL ftolong |
INDSTORE
"setl\nmovfi %[2.reg],%[1.ind](r5)\nseti"
samecc | | |
... | ADDR_EXTERNAL FLT_REG |
... | NC ADDR_EXTERNAL FLT_REG |
INDSTORE
"movfo %[2],%[1.ind]"
samecc | | |
... | ADDR_EXTERNAL ftolong |
... | NC ADDR_EXTERNAL ftolong |
INDSTORE
"setl\nmovfi %[2.reg],%[1.ind]\nseti"
samecc | | |
... | REG source2 source2 |
... | register source2 source2 |
INDSTORE
move(%[2],{regdef2,%[1]})
move(%[3],{regind2,%[1],"2"}) | | |
... | SCR_REG STACK |
"mov (sp)+,(%[1])+"
"mov (sp)+,(%[1])"
erase(%[1]) | | | (4,2040)
sti $1==8 | dadres2 DBL_REG |
erase(%[1]) | | | (4,204)
sti $1==8 | NC dadres2 DBL_REG |
INDSTORE
"movf %[2],*%[1]"
samecc | | |
... | regconst2 DBL_REG |
... | NC regconst2 DBL_REG |
INDSTORE
"movf %[2],%[1.ind](%[1.reg])"
samecc | | |
... | ADDR_LOCAL DBL_REG |
... | NC ADDR_LOCAL DBL_REG |
INDSTORE
"movf %[2],%[1.ind](r5)"
samecc | | |
... | ADDR_EXTERNAL DBL_REG |
... | NC ADDR_EXTERNAL DBL_REG |
INDSTORE
"movf %[2],%[1.ind]"
samecc | | |
@@ -484,13 +485,13 @@ sti $1==8 | dadres2 DBL_REG |
"mov (sp)+,(%[1])+"
"mov (sp)+,(%[1])+"
"mov (sp)+,(%[1])"
erase(%[1]) | | | (8,4080)
erase(%[1]) | | | (8,408)
sti | SCR_REG |
remove(all)
allocate(REG={CONST2,$1/2})
"1:\tmov (sp)+,(%[1])+"
"sob %[a],1b"
erase(%[1]) erase(%[a]) | | | (8,1500+$1*825)
erase(%[1]) erase(%[a]) | | | (8,150+$1*82)
lal sti $2>2 && $2<=8 | NC xsource2 | | %[1] | stl $1 lal $1+2 sti $2-2 |
... | | | {ADDR_LOCAL,$1} | sti $2 |
sts $1==2 | |
@@ -558,22 +559,23 @@ adi $1==2 | NC SCR_REG CONST2 | | {regconst2,%[1],tostring(%[2.num])} | |
... | NC SCR_REG ADDR_EXTERNAL | | {regconst2,%[1],%[2.ind]} | |
... | NC SCR_REG ADDR_LOCAL |
"add r5,%[1]" erase(%[1]) |
{regconst2,%[1],tostring(%[2.ind])} | | (2,450)
... | NC REG ADDR_LOCAL |
{regconst2,%[1],tostring(%[2.ind])} | | (2,45)
... | NC register ADDR_LOCAL |
allocate(REG)
"mov r5,%[a]"
"add %[1],%[a]"
erase(%[a]) | {regconst2,%[a],tostring(%[2.ind])} | | (4,900)
erase(%[a]) | {regconst2,%[a],tostring(%[2.ind])} | | (4,90)
... | NC SCR_REG regconst2 |
"add %[2.reg],%[1]" erase(%[1]) |
{regconst2,%[1],%[2.ind]} | | (2,450)
{regconst2,%[1],%[2.ind]} | | (2,45)
... | NC CONST2+ADDR_EXTERNAL+ADDR_LOCAL+regconst2 SCR_REG |
| %[1] %[2] | adi 2 |
... | NC source2-REG CONST2+ADDR_EXTERNAL+ADDR_LOCAL |
... | NC source2-register CONST2+ADDR_EXTERNAL+ADDR_LOCAL |
allocate(%[1],REG=%[1]) | %[2] %[a] | adi 2 |
... | NC source1 CONST2+ADDR_EXTERNAL+ADDR_LOCAL |
allocate(%[1],REG={CONST2, 0})
"bisb %[1],%[a]" | %[2] %[a] | adi 2 |
allocate(REG={CONST2, 0})
"bisb %[1],%[a]"
erase(%[a]) | %[2] %[a] | adi 2 |
... | NC regconst2 CONST2 | |
{regconst2,%[1.reg],
tostring(%[2.num])+"+"+%[1.ind]} | |
@@ -583,24 +585,24 @@ adi $1==2 | NC SCR_REG CONST2 | | {regconst2,%[1],tostring(%[2.num])} | |
... | NC regconst2 ADDR_LOCAL |
"add r5,%[1.reg]" erase(%[1.reg]) |
{regconst2,%[1.reg],
tostring(%[2.ind])+"+"+%[1.ind]} | | (2,450)
tostring(%[2.ind])+"+"+%[1.ind]} | | (2,45)
... | NC regconst2 regconst2 |
"add %[2.reg],%[1.reg]" erase(%[1.reg]) |
{regconst2,%[1.reg],%[2.ind]+"+"+%[1.ind]} | | (2,450)
{regconst2,%[1.reg],%[2.ind]+"+"+%[1.ind]} | | (2,45)
... | NC regconst2 noconst2 |
"add %[2],%[1.reg]" erase(%[1.reg]) | %[1] | | (2,450)+%[2]
"add %[2],%[1.reg]" erase(%[1.reg]) | %[1] | | (2,45)+%[2]
... | NC SCR_REG noconst2 |
"add %[2],%[1]"
setcc(%[1]) erase(%[1]) | %[1] | | (2,450)+%[2]
setcc(%[1]) erase(%[1]) | %[1] | | (2,45)+%[2]
... | NC source2 regconst2 |
"add %[1],%[2.reg]"
erase(%[2.reg]) | %[2] | | (2,450)+%[1]
erase(%[2.reg]) | %[2] | | (2,45)+%[1]
... | NC regconst2 source2 |
"add %[2],%[1.reg]"
erase(%[1.reg]) | %[1] | | (2,450)+%[2]
erase(%[1.reg]) | %[1] | | (2,45)+%[2]
... | source2 SCR_REG |
"add %[1],%[2]"
setcc(%[2]) erase(%[2]) | %[2] | | (2,450)+%[1]
setcc(%[2]) erase(%[2]) | %[2] | | (2,45)+%[1]
ldc adi $2==4 && highw(1)==0 | SCR_REG SCR_REG |
"add $$%(loww(1)%),%[2]"
@@ -616,25 +618,25 @@ adi $1==4 | SCR_REG SCR_REG source2 source2 |
"adc %[1]"
"add %[3],%[1]"
setcc(%[1]) erase(%[1]) erase(%[2])
| %[2] %[1] | | (6,1200)+%[4]+%[3]
| %[2] %[1] | | (6,120)+%[4]+%[3]
... | SCR_REG SCR_REG source2 STACK |
"add (sp)+,%[2]"
"adc %[1]"
"add %[3],%[1]"
setcc(%[1]) erase(%[1]) erase(%[2])
| %[2] %[1] | | (6,1900)+%[3]
| %[2] %[1] | | (6,190)+%[3]
... | SCR_REG SCR_REG STACK |
"add (sp)+,%[1]"
"add (sp)+,%[2]"
"adc %[1]"
setcc(%[1]) erase(%[1]) erase(%[2])
| %[2] %[1] | | (6,2800)
| %[2] %[1] | | (6,280)
... | source2 source2 SCR_REG SCR_REG |
"add %[2],%[4]"
"adc %[3]"
"add %[1],%[3]"
setcc(%[3]) erase(%[3]) erase(%[4])
| %[4] %[3] | | (6,1200)+%[1]+%[2]
| %[4] %[3] | | (6,120)+%[1]+%[2]
#ifdef UNTESTED
adi !defined($1)| source2 |
remove(all)
@@ -644,11 +646,11 @@ adi !defined($1)| source2 |
loc sbi $2==2 | | | | loc 0-$1 adi 2 |
sbi $1==2 | source2 SCR_REG |
"sub %[1],%[2]"
setcc(%[2]) erase(%[2]) | %[2] | | (2,450)+%[1]
... | NC SCR_REG source2-REG |
setcc(%[2]) erase(%[2]) | %[2] | | (2,45)+%[1]
... | NC SCR_REG source2-register |
"sub %[2],%[1]"
"neg %[1]"
setcc(%[1]) erase(%[1]) | %[1] | | (4,750)+%[2]
setcc(%[1]) erase(%[1]) | %[1] | | (4,75)+%[2]
ldc sbi $2==4 && highw(1)==0 | SCR_REG SCR_REG |
"sub $$%(loww(1)%),%[2]"
"sbc %[1]"
@@ -658,16 +660,16 @@ ldc sbi $2==4 | SCR_REG SCR_REG |
"sbc %[1]"
"sub $$%(highw(1)%),%[1]"
erase(%[1]) erase(%[2]) | %[2] %[1] | |
sbi $1==4 | source2-REG source2-REG SCR_REG SCR_REG |
sbi $1==4 | source2-register source2-register SCR_REG SCR_REG |
"sub %[2],%[4]"
"sbc %[3]"
"sub %[1],%[3]"
setcc(%[3]) erase(%[3]) erase(%[4])
| %[4] %[3] | | (6,1200)+%[1]+%[2]
| %[4] %[3] | | (6,120)+%[1]+%[2]
... | source2 source2 STACK |
"sub %[2],2(sp)"
"sbc (sp)"
"sub %[1],(sp)" | | | (10,2800)+%[1]+%[2]
"sub %[1],(sp)" | | | (10,280)+%[1]+%[2]
#ifdef UNTESTED
sbi !defined($1)| source2 |
remove(all)
@@ -676,10 +678,10 @@ sbi !defined($1)| source2 |
#endif
mli $1==2 | SCR_ODD_REG source2 |
"mul %[2],%[1]"
setcc(%[1]) erase(%[1]) | %[1] | |(2,3300)+%[2]
setcc(%[1]) erase(%[1]) | %[1] | |(2,330)+%[2]
... | source2 SCR_ODD_REG |
"mul %[1],%[2]"
setcc(%[2]) erase(%[2]) | %[2] | |(2,3300)+%[1]
setcc(%[2]) erase(%[2]) | %[2] | |(2,330)+%[1]
mli $1==4 | | remove(all)
"jsr pc,mli4~"
| r1 r0 | |
@@ -699,7 +701,7 @@ dvi $1==2 | source2 source2 |
"mov %[1],-(sp)"
"mov %[2],r1"
"sxt r0"
"div (sp)+,r0" | r0 | |(100,10000)
"div (sp)+,r0" | r0 | |(100,1000)
dvi $1==4 | | remove(all)
"jsr pc,dvi4~" | r1 r0 | |
#ifdef UNTESTED
@@ -718,7 +720,7 @@ rmi $1==2 | source2 source2 |
"mov %[1],-(sp)"
"mov %[2],r1"
"sxt r0"
"div (sp)+,r0" | r1 | |(100,10000)
"div (sp)+,r0" | r1 | |(100,1000)
rmi $1==4 | | remove(all)
"jsr pc,rmi4~" | r1 r0 | |
#ifdef UNTESTED
@@ -729,13 +731,13 @@ rmi !defined($1)| source2 |
#endif
ngi $1==2 | SCR_REG |
"neg %[1]"
setcc(%[1]) erase(%[1]) | %[1] | | (2,750)
setcc(%[1]) erase(%[1]) | %[1] | | (2,75)
ngi $1==4 | SCR_REG SCR_REG |
"neg %[1]"
"neg %[2]"
"sbc %[1]"
setcc(%[1]) erase(%[1]) erase(%[2])
| %[2] %[1] | | (6,1800)
| %[2] %[1] | | (6,180)
#ifdef UNTESTED
ngi !defined($1)| source2 |
remove(all)
@@ -834,13 +836,13 @@ rmu !defined($1)| source2 |
#endif
slu | | | | sli $1 |
loc slu | | | | loc $1 sli $2 |
sru $1==2 | SCR_REG xsource2 |
allocate(%[2],REG_PAIR)
move(%[2],%[a.2])
move({CONST2,0},%[a.1])
"neg %[1]"
"ashc %[1],%[a]"
erase(%[a]) | %[a.2] | |
sru $1==2 | source2 xsource2 |
allocate(%[1],%[2],REG=%[1],REG_PAIR)
move(%[2],%[b.2])
move({CONST2,0},%[b.1])
"neg %[a]"
"ashc %[a],%[b]"
erase(%[b]) | %[b.2] | |
loc sru $2==2 | xsource2 |
allocate(%[1],REG_PAIR)
move(%[1],%[a.2])
@@ -866,16 +868,16 @@ sru !defined($1)| source2 |
adf $1==4 | FLT_REG SCR_FLT_REG |
"addf %[1],%[2]"
samecc erase(%[2]) | %[2] | | (2,5000)+%[1]
samecc erase(%[2]) | %[2] | | (2,500)+%[1]
... | SCR_FLT_REG FLT_REG |
"addf %[2],%[1]"
samecc erase(%[1]) | %[1] | | (2,5000)+%[2]
samecc erase(%[1]) | %[1] | | (2,500)+%[2]
adf $1==8 | double8 SCR_DBL_REG |
"addf %[1],%[2]"
samecc erase(%[2]) | %[2] | | (2,6000)+%[1]
samecc erase(%[2]) | %[2] | | (2,600)+%[1]
... | SCR_DBL_REG double8 |
"addf %[2],%[1]"
samecc erase(%[1]) | %[1] | | (2,6000)+%[2]
samecc erase(%[1]) | %[1] | | (2,600)+%[2]
#ifdef UNTESTED
adf !defined($1)| source2 |
remove(ALL)
@@ -884,10 +886,10 @@ adf !defined($1)| source2 |
#endif
sbf $1==4 | FLT_REG SCR_FLT_REG |
"subf %[1],%[2]"
samecc erase(%[2]) | %[2] | | (2,5000)+%[1]
samecc erase(%[2]) | %[2] | | (2,500)+%[1]
sbf $1==8 | double8 SCR_DBL_REG |
"subf %[1],%[2]"
samecc erase(%[2]) | %[2] | | (2,6000)+%[1]
samecc erase(%[2]) | %[2] | | (2,600)+%[1]
#ifdef UNTESTED
sbf !defined($1)| source2 |
remove(ALL)
@@ -896,16 +898,16 @@ sbf !defined($1)| source2 |
#endif
mlf $1==4 | FLT_REG SCR_FLT_REG |
"mulf %[1],%[2]"
samecc erase(%[2]) | %[2] | | (2,7000)+%[1]
samecc erase(%[2]) | %[2] | | (2,700)+%[1]
... | SCR_FLT_REG FLT_REG |
"mulf %[2],%[1]"
samecc erase(%[1]) | %[1] | | (2,7000)+%[2]
samecc erase(%[1]) | %[1] | | (2,700)+%[2]
mlf $1==8 | double8 SCR_DBL_REG |
"mulf %[1],%[2]"
samecc erase(%[2]) | %[2] | | (2,10000)+%[1]
samecc erase(%[2]) | %[2] | | (2,1000)+%[1]
... | SCR_DBL_REG double8 |
"mulf %[2],%[1]"
samecc erase(%[1]) | %[1] | | (2,10000)+%[2]
samecc erase(%[1]) | %[1] | | (2,1000)+%[2]
#ifdef UNTESTED
mlf !defined($1)| source2 |
remove(ALL)
@@ -914,10 +916,10 @@ mlf !defined($1)| source2 |
#endif
dvf $1==4 | FLT_REG SCR_FLT_REG |
"divf %[1],%[2]"
samecc erase(%[2]) | %[2] | | (2,8000)+%[1]
samecc erase(%[2]) | %[2] | | (2,800)+%[1]
dvf $1==8 | double8 SCR_DBL_REG |
"divf %[1],%[2]"
samecc erase(%[2]) | %[2] | | (2,12000)+%[1]
samecc erase(%[2]) | %[2] | | (2,1200)+%[1]
#ifdef UNTESTED
dvf !defined($1)| source2 |
remove(ALL)
@@ -926,10 +928,10 @@ dvf !defined($1)| source2 |
#endif
ngf $1==4 | SCR_FLT_REG |
"negf %[1]"
samecc erase(%[1]) | %[1] | |(2,2700)
samecc erase(%[1]) | %[1] | |(2,270)
ngf $1==8 | SCR_DBL_REG |
"negf %[1]"
samecc erase(%[1]) | %[1] | |(2,2700)
samecc erase(%[1]) | %[1] | |(2,270)
#ifdef UNTESTED
ngf !defined($1)| source2 |
remove(ALL)
@@ -940,12 +942,12 @@ fif $1==4 | longf4 FLT_REG |
allocate(FLT_REG_PAIR)
move(%[1],%[a.1])
"modf %[2],%[a]"
samecc erase(%[a.1]) | %[a.1] %[a.2] | | (2,7500)+%[2]
samecc erase(%[a.1]) | %[a.1] %[a.2] | | (2,750)+%[2]
fif $1==8 | double8 double8 |
allocate(DBL_REG_PAIR)
move(%[1],%[a.1])
"modf %[2],%[a]"
samecc erase(%[a.1]) | %[a.1] %[a.2] | | (2,15000)+%[2]
samecc erase(%[a.1]) | %[a.1] %[a.2] | | (2,1500)+%[2]
#ifdef UNTESTED
fif !defined($1)| source2 |
remove(ALL)
@@ -957,13 +959,13 @@ fef $1==4 | FLT_REG |
"movei %[1],%[a]"
"movie $$0,%[1]"
samecc
erase(%[1]) |%[1] %[a] | | (4,5000)
erase(%[1]) |%[1] %[a] | | (4,500)
fef $1==8 | DBL_REG |
allocate(REG)
"movei %[1],%[a]"
"movie $$0,%[1]"
samecc
erase(%[1]) |%[1] %[a] | | (4,5000)
erase(%[1]) |%[1] %[a] | | (4,500)
#ifdef UNTESTED
fef !defined($1)| source2 |
remove(ALL)
@@ -1037,7 +1039,7 @@ del | | remove(indordef)
setcc({LOCAL2,$1,2}) | | |
dee | | remove(posextern)
"dec $1"
setcc({relative2,$1}) | | | (4,900)
setcc({relative2,$1}) | | | (4,90)
#ifdef REGVARS
lol loc sbi stl $1==$4 && $3==2 && inreg($1)==2 | |
@@ -1064,7 +1066,13 @@ lol adi stl $2==2 && $1==$3 && inreg($1)==2 | source2 |
lol lol adp stl loi $1==$2 && $2==$4 && inreg($1)==2 && $3==1 && $5==1 | |
allocate(REG={CONST2, 0})
remove(regvar($1))
"bisb (%(regvar($1)%))+,%[a]" | %[a] | |
"bisb (%(regvar($1)%))+,%[a]"
erase(%[a]) | %[a] | |
lol lol adp stl loi loc loc cii $1==$2 && $2==$4 && inreg($1)==2 && $3==1 && $5==1 && $6==1 && $7==2 | |
allocate(REG)
remove(regvar($1))
"movb (%(regvar($1)%))+,%[a]"
erase(%[a]) | %[a] | |
lol lol adp stl loi $1==$2 && $2==$4 && inreg($1)==2 && $3==2 && $5==2 | |
allocate(REG)
remove(regvar($1))
@@ -1335,19 +1343,19 @@ loc loe and ste $3==2 && $2==$4 | |
#ifdef REGVARS
zrl inreg($1)==2| | remove(regvar($1))
"clr %(regvar($1)%)"
erase(regvar($1)) | | | (4,900)
erase(regvar($1)) | | | (4,90)
#endif
zrl | | remove(indordef)
remove(locals, %[ind] <= $1 && %[ind]+%[size] > $1)
"clr $1(r5)"
setcc({LOCAL2,$1,2}) | | | (4,900)
setcc({LOCAL2,$1,2}) | | | (4,90)
zre | | remove(posextern)
"clr $1"
setcc({relative2,$1}) | | | (4,900)
setcc({relative2,$1}) | | | (4,90)
zrf $1==4 | | allocate(FLT_REG)
"clrf %[a]" | %[a] | | (2,2200)
"clrf %[a]" | %[a] | | (2,220)
zrf $1==8 | | allocate(DBL_REG)
"clrf %[a]" | %[a] | | (2,2400)
"clrf %[a]" | %[a] | | (2,240)
zrf !defined($1)| | | | zer |
zrf defined($1) | | | | zer $1 |
zer $1==2 | | | {CONST2, 0} | |
@@ -1360,7 +1368,7 @@ zer defined($1) | | remove(all)
move({CONST2,$1/2},r0)
"1:\tclr -(sp)"
"sob r0,1b"
erase(r0) | | |(8,1500+$1*375)
erase(r0) | | |(8,150+$1*37)
zer !defined($1)| SCR_REG |
remove(all)
"asr %[1]"
@@ -1492,16 +1500,16 @@ loc loc cff $1==8 && $2==4 | DBL_REG | | %[1.1] | |
and $1==2 | CONST2 SCR_REG |
"bic $$%(~%[1.num]%),%[2]"
setcc(%[2])
erase(%[2]) | %[2] | | (4,750)
erase(%[2]) | %[2] | | (4,75)
... | SCR_REG CONST2 |
"bic $$%(~%[2.num]%),%[1]"
setcc(%[1])
erase(%[1]) | %[1] | | (4,750)
erase(%[1]) | %[1] | | (4,75)
... | SCR_REG SCR_REG |
"com %[1]"
"bic %[1],%[2]"
setcc(%[2])
erase(%[1]) erase(%[2]) | %[2] | | (4,600)
erase(%[1]) erase(%[2]) | %[2] | | (4,60)
ldc and $2==4 && highw(1)==0 | source2 SCR_REG |
"bic $$%(~loww(1)%),%[2]"
erase(%[2]) | %[2] {CONST2, 0} | |
@@ -1524,11 +1532,11 @@ and !defined($1)| source2 |
ior $1==2 | SCR_REG source2 |
"bis %[2],%[1]"
setcc(%[1])
erase(%[1]) | %[1] | | (2,450)+%[2]
erase(%[1]) | %[1] | | (2,45)+%[2]
... | source2 SCR_REG |
"bis %[1],%[2]"
setcc(%[2])
erase(%[2]) | %[2] | | (2,450)+%[1]
erase(%[2]) | %[2] | | (2,45)+%[1]
ldc ior $2==4 && highw(1)==0 | source2 SCR_REG |
"bis $$%(loww(1)%),%[2]"
erase(%[2]) | %[2] %[1] | |
@@ -1558,7 +1566,7 @@ ior defined($1) | | remove(all)
"add sp,%[a]"
"1:\tbis (sp)+,(%[a])+"
"sob %[b],1b"
erase(%[a]) erase(%[b]) | | | (12,2100+$1*975)
erase(%[a]) erase(%[b]) | | | (12,210+$1*97)
ior !defined($1)| SCR_REG |
remove(all)
allocate(REG=%[1])
@@ -1567,14 +1575,14 @@ ior !defined($1)| SCR_REG |
"1:\tbis (sp)+,(%[a])+"
"sob %[1],1b"
erase(%[1]) erase(%[a]) | | |
xor $1==2 | REG SCR_REG |
xor $1==2 | register SCR_REG |
"xor %[1],%[2]"
setcc(%[2])
erase(%[2]) | %[2] | | (2,300)
... | SCR_REG REG |
erase(%[2]) | %[2] | | (2,30)
... | SCR_REG register |
"xor %[2],%[1]"
setcc(%[1])
erase(%[1]) | %[1] | | (2,300)
erase(%[1]) | %[1] | | (2,30)
xor defined($1) | | remove(all)
move({CONST2,$1},r0)
"jsr pc,xor~"
@@ -1587,13 +1595,13 @@ xor !defined($1)| source2 |
com $1==2 | SCR_REG |
"com %[1]"
setcc(%[1])
erase(%[1]) | %[1] | | (2,300)
erase(%[1]) | %[1] | | (2,30)
com defined($1) | | remove(all)
allocate(REG={CONST2,$1/2},REG)
"mov sp,%[b]"
"1:\tcom (%[b])+"
"sob %[a],1b"
erase(%[a]) | | | (10,1800+$1*825)
erase(%[a]) | | | (10,180+$1*82)
com !defined($1)| SCR_REG |
remove(all)
allocate(REG)
@@ -1607,7 +1615,7 @@ rol $1==2 | CONST2 SCR_ODD_REG |
setcc(%[2])
erase(%[2]) | %[2] | |
... | SCR_REG SCR_ODD_REG |
"sub $$16,%[1]"
"sub $$%(16%),%[1]"
"ashc %[1],%[2]"
setcc(%[2])
erase(%[1]) erase(%[2]) | %[2] | |
@@ -1644,7 +1652,7 @@ ror !defined($1)| source2 |
com and $1==2 && $2==2 | source2 SCR_REG |
"bic %[1],%[2]"
setcc(%[2])
erase(%[2]) | %[2] | | (2,450)+%[1]
erase(%[2]) | %[2] | | (2,45)+%[1]
com and $1==$2 | | remove(all)
allocate(REG={CONST2,$1},REG)
"mov sp,%[b]"
@@ -1652,7 +1660,7 @@ com and $1==$2 | | remove(all)
"asr %[a]"
"1:\tbic (sp)+,(%[b])+"
"sob %[a],1b"
erase(%[a]) | | | (12,2100+$1*975)
erase(%[a]) | | | (12,210+$1*97)
/********************************
* Group 10 : Set instructions *
@@ -1661,18 +1669,18 @@ com and $1==$2 | | remove(all)
inn $1==2 | SCR_REG SCR_REG |
"neg %[1]"
"ash %[1],%[2]"
"bic $$177776,%[2]"
"bic $$0177776,%[2]"
erase(%[1]) erase(%[2]) | %[2] | |
loc inn $2==2 && $1==0 | SCR_REG |
"bic $$177776,%[1]"
"bic $$0177776,%[1]"
erase(%[1]) | %[1] | |
loc inn $2==2 && $1==1 | SCR_REG |
"asr %[1]"
"bic $$177776,%[1]"
"bic $$0177776,%[1]"
erase(%[1]) | %[1] | |
loc inn $2==2 | SCR_REG |
"ash $$%(0-$1%),%[1]"
"bic $$177776,%[1]"
"bic $$0177776,%[1]"
erase(%[1]) | %[1] | |
loc inn zeq $2==2 | | | {CONST2, 1<<$1} | and 2 zeq $3 |
@@ -1697,7 +1705,7 @@ inn !defined($1)| source2 |
"jsr pc,inn~"
erase(r01) | r0 | |
#endif
set $1==2 | REG |
set $1==2 | register |
allocate(REG={CONST2,1})
"ash %[1],%[a]"
erase(%[a]) | %[a] | |
@@ -1749,12 +1757,12 @@ lae aar $2==2 && rom(1,3)==8 && rom(1,1)!=0 | SCR_REG |
erase(%[1]) |
{regconst2,%[1],tostring((0-8)*rom(1,1))} |
adi 2 |
lae aar $2==2 && rom(1,1)==0 | SCR_ODD_REG |
lae aar $2==2 && rom(1,1)==0 && defined(rom(1,3)) | SCR_ODD_REG |
"mul $$%(rom(1,3)%),%[1]"
erase(%[1]) |
%[1] |
adi 2 |
lae aar $2==2 && defined(rom(1,1)) | SCR_ODD_REG |
lae aar $2==2 && defined(rom(1,3)) | SCR_ODD_REG |
"mul $$%(rom(1,3)%),%[1]"
erase(%[1]) |
{regconst2,%[1],tostring((0-rom(1,3))*rom(1,1))} |
@@ -2480,7 +2488,7 @@ and zne $1==2 | source1 source1or2 |
cal | | remove(ALL)
"jsr pc,$1" | | |
cai | REG | remove(ALL)
cai | register | remove(ALL)
"jsr pc,(%[1])" | | |
lfr $1==2 | | | r0 | |
lfr $1==4 | | | r1 r0 | |
@@ -2624,7 +2632,7 @@ csb !defined($1)| source2 |
"mov (sp)+,r1"
"jmp csb~" | | |
#endif
dup $1==2 | REG | | %[1] %[1] | |
dup $1==2 | register | | %[1] %[1] | |
dup $1==4 | NC longf4 | | %[1] %[1] | |
... | source2 source2 | | %[2] %[1] %[2] %[1] | |
dup $1==8 | NC double8| | %[1] %[1] | |
@@ -2724,18 +2732,18 @@ lol lal sti $1==$2 && $3==1| | | | | /* throw away funny C-proc-prolog */
| regconst2 | allocate(%[1],REG=%[1.reg])
"add $$%[1.ind],%[a]"
setcc(%[a]) | %[a] | |(6,1050)
setcc(%[a]) | %[a] | |(6,105)
| ADDR_LOCAL | allocate(REG)
"mov r5,%[a]"
"add $$%[1.ind],%[a]"
setcc(%[a]) | %[a] | |(6,1050)
| REG | | {regconst2, %[1], "0"} | | (2,600)
setcc(%[a]) | %[a] | |(6,105)
| register | | {regconst2, %[1], "0"} | | (2,60)
| xsource2 | allocate(%[1], REG=%[1]) | %[a] | |
| xsource2 | allocate(%[1], REG=%[1]) | {regconst2, %[a], "0"} | |
| longf4 | allocate(FLT_REG)
move( %[1],%[a]) | %[a] | | (20,20000) + %[1]
move( %[1],%[a]) | %[a] | | (20,2000) + %[1]
| double8 | allocate(DBL_REG)
move(%[1],%[a]) | %[a] | | (20,30000) + %[1]
move(%[1],%[a]) | %[a] | | (20,3000) + %[1]
/********************************
* From source1 to source2 *
@@ -2743,7 +2751,7 @@ lol lal sti $1==$2 && $3==1| | | | | /* throw away funny C-proc-prolog */
| source1 | allocate(REG={CONST2,0})
"bisb %[1],%[a]"
erase(%[a]) setcc(%[a]) | %[a] | | (6,1050)+%[1]
erase(%[a]) setcc(%[a]) | %[a] | | (6,105)+%[1]
/********************************
* From long4 to source2 *
@@ -2771,80 +2779,80 @@ lol lal sti $1==$2 && $3==1| | | | | /* throw away funny C-proc-prolog */
| STACK | allocate(REG)
"mov (sp)+,%[a]"
setcc(%[a]) | %[a] | | (2,750)
setcc(%[a]) | %[a] | | (2,75)
| STACK | allocate(REG)
"mov (sp)+,%[a]"
setcc(%[a]) | {regconst2, %[a], "0"} | | (2,750)
setcc(%[a]) | {regconst2, %[a], "0"} | | (2,75)
| STACK | allocate(FLT_REG)
"movof (sp)+,%[a]"
samecc | %[a] | | (20,47400) /* /10 */
samecc | %[a] | | (20,4740) /* /10 */
| STACK | allocate(DBL_REG)
"movf (sp)+,%[a]"
samecc | %[a] | | (20,69200) /* /10 */
samecc | %[a] | | (20,6920) /* /10 */
| STACK | allocate(REG_PAIR)
"mov (sp)+,%[a.1]"
"mov (sp)+,%[a.2]"
setcc(%[a.2]) | %[a] | | (4,1500)
setcc(%[a.2]) | %[a] | | (4,150)
MOVES:
(CONST2 %[num] == 0, source2, "clr %[2]" setcc(%[2]),(2,300))
(source2, source2, "mov %[1],%[2]" setcc(%[2]),(2,300)+%[1]+%[2])
(FLT_REG, longf4-FLT_REG,"movfo %[1],%[2]" samecc, (2,880) + %[2])
(longf4-FLT_REG,FLT_REG, "movof %[1],%[2]" samecc, (2,1500) + %[2])
(FLT_REG, FLT_REG, "movf %[1],%[2]" samecc,(2,880))
(DBL_REG,double8, "movf %[1],%[2]" samecc,(2,880) + %[2])
(double8,DBL_REG, "movf %[1],%[2]" samecc,(2,1700) + %[1])
(CONST2 %[num] == 0,source1, "clrb %[2]" setcc(%[2]),(2,450)+%[2])
(source1or2,source1, "movb %[1],%[2]" setcc(%[2]),(2,300)+%[1]+%[2])
(CONST2 %[num] == 0, source2, "clr %[2]" setcc(%[2]),(2,30))
(source2, source2, "mov %[1],%[2]" setcc(%[2]),(2,30)+%[1]+%[2])
(FLT_REG, longf4-FLT_REG,"movfo %[1],%[2]" samecc, (2,88) + %[2])
(longf4-FLT_REG,FLT_REG, "movof %[1],%[2]" samecc, (2,150) + %[2])
(FLT_REG, FLT_REG, "movf %[1],%[2]" samecc,(2,88))
(DBL_REG,double8, "movf %[1],%[2]" samecc,(2,88) + %[2])
(double8,DBL_REG, "movf %[1],%[2]" samecc,(2,170) + %[1])
(CONST2 %[num] == 0,source1, "clrb %[2]" setcc(%[2]),(2,45)+%[2])
(source1or2,source1, "movb %[1],%[2]" setcc(%[2]),(2,30)+%[1]+%[2])
(ftoint,source2, "movfi %[1.reg],%[2]" samecc)
TESTS:
(source2, "tst %[1]" ,(2,300) + %[1])
(source1, "tstb %[1]",(2,400) + %[1])
(FLT_REG+DBL_REG, "tstf %[1]\ncfcc" ,(4,2600))
/* (DBL_REG, "tstf %[1]\ncfcc" ,(4,2600)) */
(source2, "tst %[1]" ,(2,30) + %[1])
(source1, "tstb %[1]",(2,40) + %[1])
(FLT_REG+DBL_REG, "tstf %[1]\ncfcc" ,(4,260))
/* (DBL_REG, "tstf %[1]\ncfcc" ,(4,260)) */
STACKS:
( CONST2 %[num]==0 ,, "clr -(sp)" )
( source2 ,, "mov %[1],-(sp)" setcc(%[1]), (2,900)+%[1])
( regconst2 ,, "mov %[1.reg],-(sp)\nadd $$%[1.ind],(sp)" , (6,2250))
( ADDR_LOCAL,, "mov r5,-(sp)" "add $$%[1.ind],(sp)", (6,2250))
( DBL_REG ,, "movf %[1],-(sp)" samecc , (2,6100))
( FLT_REG ,, "movfo %[1],-(sp)" samecc , (2,4120))
( REG_PAIR ,, "mov %[1.2],-(sp)" "mov %[1.1],-(sp)" , (4,1800))
( source2 ,, "mov %[1],-(sp)" setcc(%[1]), (2,90)+%[1])
( regconst2 ,, "mov %[1.reg],-(sp)\nadd $$%[1.ind],(sp)" , (6,225))
( ADDR_LOCAL,, "mov r5,-(sp)" "add $$%[1.ind],(sp)", (6,225))
( DBL_REG ,, "movf %[1],-(sp)" samecc , (2,610))
( FLT_REG ,, "movfo %[1],-(sp)" samecc , (2,412))
( REG_PAIR ,, "mov %[1.2],-(sp)" "mov %[1.1],-(sp)" , (4,180))
( regind4 ,, "mov 2+%[1.ind](%[1.reg]),-(sp)"
"mov %[1.ind](%[1.reg]),-(sp)" , (8,3000))
"mov %[1.ind](%[1.reg]),-(sp)" , (8,300))
( relative4 ,, "mov 2+%[1.ind],-(sp)"
"mov %[1.ind],-(sp)" , (8,3000))
"mov %[1.ind],-(sp)" , (8,300))
( regdef4 ,, "mov 2(%[1.reg]),-(sp)"
"mov (%[1.reg]),-(sp)" , (6,2700))
"mov (%[1.reg]),-(sp)" , (6,270))
( regind8 ,REG, move(%[1.reg],%[a])
"add $$%(8%)+%[1.ind],%[a]"
"mov -(%[a]),-(sp)"
"mov -(%[a]),-(sp)"
"mov -(%[a]),-(sp)"
"mov -(%[a]),-(sp)"
erase(%[a]) , (14,6000))
erase(%[a]) , (14,600))
( regind8 ,, "mov 6+%[1.ind](%[1.reg]),-(sp)"
"mov 4+%[1.ind](%[1.reg]),-(sp)"
"mov 2+%[1.ind](%[1.reg]),-(sp)"
"mov %[1.ind](%[1.reg]),-(sp)" , (16,6000))
"mov %[1.ind](%[1.reg]),-(sp)" , (16,600))
( relative8 ,REG,"mov $$%(8%)+%[1.ind],%[a]"
"mov -(%[a]),-(sp)"
"mov -(%[a]),-(sp)"
"mov -(%[a]),-(sp)"
"mov -(%[a]),-(sp)" , (12,5000))
"mov -(%[a]),-(sp)" , (12,500))
( relative8 ,, "mov 6+%[1.ind],-(sp)"
"mov 4+%[1.ind],-(sp)"
"mov 2+%[1.ind],-(sp)"
"mov %[1.ind],-(sp)" , (16,6000))
"mov %[1.ind],-(sp)" , (16,600))
( regdef8 ,, "mov 6(%[1.reg]),-(sp)"
"mov 4(%[1.reg]),-(sp)"
"mov 2(%[1.reg]),-(sp)"
"mov (%[1.reg]),-(sp)" , (14,5700))
"mov (%[1.reg]),-(sp)" , (14,570))
( LOCAL4 ,, "mov 2+%[1.ind](r5),-(sp)"
"mov %[1.ind](r5),-(sp)" , (8,3000))
"mov %[1.ind](r5),-(sp)" , (8,300))
( source1 ,, "clr -(sp)"
"movb %[1],(sp)" , (4,1800)+%[1])
"movb %[1],(sp)" , (4,180)+%[1])
( ftoint ,, "movfi %[1.reg],-(sp)" )
( ftolong ,, "setl\nmovfi %[1.reg],-(sp)\nseti" )

2
mach/pdp/cv/.distr Normal file
View File

@@ -0,0 +1,2 @@
Makefile
cv.c

25
mach/pdp/cv/Makefile Normal file
View File

@@ -0,0 +1,25 @@
EMHOME = ../../..
LIBOBJ = $(EMHOME)/modules/lib/libobject.a
INCLUDE = $(EMHOME)/h
CFLAGS = -I. -I$(INCLUDE) -O
TARGETS = cv
all: $(TARGETS)
install: all
../../install cv
cmp: all
../../compare cv
cv: cv.o
$(CC) $(LDFLAGS) -o cv cv.o $(LIBOBJ)
clean:
rm -f $(TARGETS) *.o nohup.out Out
pr:
@pr Makefile cv.c
opr:
make pr | opr

311
mach/pdp/cv/cv.c Normal file
View File

@@ -0,0 +1,311 @@
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*
*/
/*
* This program converts ack.out format to PDP 11 V7 a.out format.
* It uses ~em/modules/lib/libobject.a.
*/
#include <stdio.h>
struct exec {
short a_magic;
short a_text;
short a_data;
short a_bss;
short a_syms;
short a_entry;
short a_unused;
short a_flag;
};
struct nlist
{ char n_name[8];
short n_type;
short n_value;
};
#include <out.h>
#ifndef NORCSID
static char rcs_id[] = "$Header$" ;
#endif
#define ENTRY 0x0 /* entry point */
/*
* Header and section table of new format object file.
*/
struct outhead outhead;
struct outsect outsect[S_MAX];
struct exec exec;
char *output_file;
int outputfile_created;
FILE *output;
int rom_in_text;
char *program ;
char flag ;
/* Output file definitions and such */
#define TEXTSG 0
#define ROMSG 1
#define DATASG 2
#define BSSSG 3
#define LSECT BSSSG+1
#define NSECT LSECT+1
main(argc, argv)
int argc;
char *argv[];
{
register struct exec *e = &exec;
output = stdout;
program= argv[0] ;
if ( argc>1 && argv[1][0]=='-' ) {
flag=argv[1][1] ;
argc-- ; argv++ ;
}
switch (argc) {
case 1: rd_fdopen(0);
break;
case 3: if ((output = fopen(argv[2], "w")) == NULL) {
fatal("Can't write %s.\n", argv[2]);
}
output_file = argv[2];
outputfile_created = 1;
/* FALLTHROUGH */
case 2:
if (! rd_open(argv[1]))
fatal("Can't read %s.\n", argv[1]);
break;
default:fatal("Usage: %s <as object> <dl object>.\n", argv[0]);
}
rd_ohead(&outhead);
if (BADMAGIC(outhead))
fatal("Not an ack object file.\n");
if (outhead.oh_flags & HF_LINK)
fatal("Contains unresolved references.\n");
if (outhead.oh_nrelo > 0)
fprintf(stderr, "Warning: relocation information present.\n");
if ( outhead.oh_nsect!=LSECT && outhead.oh_nsect!=NSECT )
fatal("Input file must have %d sections, not %ld\n",
NSECT,outhead.oh_nsect) ;
rd_sect(outsect, outhead.oh_nsect);
if (outsect[TEXTSG].os_size & 1)
outsect[TEXTSG].os_size++;
if (outsect[ROMSG].os_size & 1)
outsect[ROMSG].os_size++;
if (outsect[DATASG].os_size & 1)
outsect[DATASG].os_size++;
if (outsect[BSSSG].os_size & 1)
outsect[BSSSG].os_size++;
/* A few checks */
if ( outsect[TEXTSG].os_base != ENTRY)
fatal("text must start at %d not at 0x%lx\n", ENTRY,
outsect[TEXTSG].os_base) ;
if ( outsect[BSSSG].os_flen != 0 )
fatal("bss space contains initialized data\n") ;
if ( outsect[BSSSG].os_base != outsect[DATASG].os_base+
outsect[DATASG].os_size )
fatal("bss segment must follow data segment\n") ;
e->a_magic = 0407;
e->a_text = outsect[TEXTSG].os_size;
e->a_data = outsect[ROMSG].os_size + outsect[DATASG].os_size;
e->a_bss = outsect[BSSSG].os_size;
e->a_entry = outsect[TEXTSG].os_base;
e->a_syms = outhead.oh_nname * sizeof (struct nlist);
e->a_flag = 1;
if ( outsect[ROMSG].os_base == 0x0 ) {
/* Separate I/D */
e->a_magic = 0411;
if ( outsect[DATASG].os_base != outsect[ROMSG].os_base+
outsect[ROMSG].os_size )
fatal("data segment must follow rom\n") ;
} else if ( outsect[ROMSG].os_lign == 0x2000 ) {
/* -n, rom in data */
e->a_magic = 0410;
if ( outsect[DATASG].os_base != outsect[ROMSG].os_base+
outsect[ROMSG].os_size )
fatal("data segment must follow rom\n") ;
} else if ( outsect[DATASG].os_lign == 0x2000 ) {
/* -n, rom in text */
rom_in_text = 1;
e->a_magic = 0410;
e->a_text += outsect[ROMSG].os_size;
e->a_data -= outsect[ROMSG].os_size;
if ( outsect[ROMSG].os_base != outsect[TEXTSG].os_base+
outsect[TEXTSG].os_size )
fatal("rom segment must follow text\n") ;
}
else {
if ( outsect[ROMSG].os_base != outsect[TEXTSG].os_base+
outsect[TEXTSG].os_size )
fatal("rom segment must follow text\n") ;
if ( outsect[DATASG].os_base != outsect[ROMSG].os_base+
outsect[ROMSG].os_size )
fatal("data segment must follow rom\n") ;
}
if ( outhead.oh_nsect==NSECT ) {
if ( outsect[LSECT].os_base != outsect[BSSSG].os_base+
outsect[BSSSG].os_size )
fatal("end segment must follow bss\n") ;
if ( outsect[LSECT].os_size != 0 )
fatal("end segment must be empty\n") ;
}
/* Action at last */
wr_int2(e->a_magic);
wr_int2(e->a_text);
wr_int2(e->a_data);
wr_int2(e->a_bss);
wr_int2(e->a_syms);
wr_int2(e->a_entry);
wr_int2(e->a_unused);
wr_int2(e->a_flag);
emits(&outsect[TEXTSG]) ;
emits(&outsect[ROMSG]) ;
emits(&outsect[DATASG]) ;
emit_symtab();
if ( outputfile_created ) chmod(argv[2],0755);
return 0;
}
wr_int2(n)
{
putc(n, output);
putc((n>>8), output);
}
/*
wr_long(l)
long l;
{
putc((int)(l >> 16), output);
putc((int)(l >> 24), output);
putc((int) l, output);
putc(((int)l >> 8), output);
}
*/
/*
* Transfer the emitted byted from one file to another.
*/
emits(section) struct outsect *section ; {
register long n ;
register int blk;
char buffer[BUFSIZ];
n= section->os_flen ;
rd_outsect(section - outsect);
while (n > 0) {
blk = n > BUFSIZ ? BUFSIZ : n;
rd_emit(buffer, (long) blk);
fwrite(buffer, sizeof(char), blk, output);
n -= blk;
}
if ((n = section->os_size - section->os_flen) > 0) {
for (blk = BUFSIZ - 1; blk >= 0; blk--) {
buffer[blk] = 0;
}
while (n > 0) {
blk = n > BUFSIZ ? BUFSIZ : n;
fwrite(buffer, sizeof(char), blk, output);
n -= blk;
}
}
}
emit_symtab()
{
struct outname ACK_name; /* symbol table entry in ACK format */
struct nlist PDP_name; /* symbol table entry in PDP V7 format */
register unsigned short i;
extern char *malloc();
char *chars;
long l;
long off = OFF_CHAR(outhead);
int j;
char *p;
chars = malloc((unsigned) (outhead.oh_nchar));
rd_string(chars,outhead.oh_nchar);
for (i = 0; i < outhead.oh_nname; i++) {
rd_name(&ACK_name, 1);
switch(ACK_name.on_type & S_TYP) {
case S_UND:
PDP_name.n_type = 0;
break;
case S_ABS:
PDP_name.n_type = 01;
break;
case S_MIN + TEXTSG:
PDP_name.n_type = 02;
break;
case S_MIN + ROMSG:
if (rom_in_text) {
PDP_name.n_type = 02;
break;
}
/* Fall through */
case S_MIN + DATASG:
PDP_name.n_type = 03;
break;
case S_MIN + BSSSG:
case S_MIN + LSECT:
PDP_name.n_type = 04;
break;
default:
fprintf(stderr,"warning: unknown s_type: %d\n",
ACK_name.on_type & S_TYP);
}
if (ACK_name.on_type & S_EXT) PDP_name.n_type |= 040;
PDP_name.n_value = ACK_name.on_valu;
if (ACK_name.on_foff == 0) {
p = "\0\0";
}
else {
l = ACK_name.on_foff - off;
if (l < 0 || l >= outhead.oh_nchar) {
fatal("bad on_off: %ld\n",l);
}
p = &chars[l];
}
for (j = 0; j < 8; j++) {
PDP_name.n_name[j] = *p++;
if (*p == '\0') break;
}
for (j++; j < 8; j++) {
PDP_name.n_name[j] = 0;
}
fwrite((char *) &PDP_name, sizeof(char), 8, output);
wr_int2(PDP_name.n_type);
wr_int2(PDP_name.n_value);
}
}
/* VARARGS1 */
fatal(s, a1, a2)
char *s;
{
fprintf(stderr,"%s: ",program) ;
fprintf(stderr, s, a1, a2);
if (outputfile_created)
unlink(output_file);
exit(1);
}
rd_fatal()
{
fatal("read error\n");
}

15
mach/pdp/int/.distr Normal file
View File

@@ -0,0 +1,15 @@
Makefile
README
em.1
eminform.1
em.c
em_int.s
eminform.s
c+
c-
f+
f-
p+
p-
t+
t-

View File

@@ -28,15 +28,18 @@ install: all
-mkdir $b
cp em_???? $b
cp em eminform ../../../bin
cp em.1 eminform.1 ../../../man
cmp: all
cmp em_t--- $b/em_t---
cmp em_---- $b/em_----
cmp em_tf-- $b/em_tf--
cmp em_t-c- $b/em_t-c-
cmp em_t--p $b/em_t--p
cmp em ../../../bin/em
cmp eminform ../../../bin/eminform
-cmp em_t--- $b/em_t---
-cmp em_---- $b/em_----
-cmp em_tf-- $b/em_tf--
-cmp em_t-c- $b/em_t-c-
-cmp em_t--p $b/em_t--p
-cmp em ../../../bin/em
-cmp eminform ../../../bin/eminform
-cmp em.1 ../../../man/em.1
-cmp eminform.1 ../../../man/eminform.1
clean:
-rm -f *.o *.old a.out em eminform $(INTS)

77
mach/pdp/int/em.1 Normal file
View File

@@ -0,0 +1,77 @@
.\" $Header$
.TH EM 1ACK
.ad
.SH NAME
em \- calling program for em interpreters
.SH SYNOPSIS
em [-t] [+fcp] [loadfile [args ... ...] ]
.SH DESCRIPTION
The loadfile ("e.out" if not specified) is opened to read the first 8 word header.
The format of this header is explained in e.out(5).
One of these 8 words is a flag word
specifying the interpreter options requested at compile time.
The usual setting of these options is +t -f -c -p.
One of these options may be overridden at run time
by the corresponding flag of em.
Based on these options the name of the appropriate interpreter
is constructed.
.PP
The flags control the following options that can be turned off
or on by prepending them with - or + respectively:
.IP t
run time tests for undefined variables, array bounds etc...
This option costs a small amount of memory and some time.
However, it is very useful for debugging.
.IP p
profiling of the entire program. The interpreter maintain tables containing
an estimate of the number of memory cycles used per source line.
This option is expensive in time as well as in memory space.
The result tables made at run time are dumped onto a file named
em_runinf. This file is converted to human readable format
by the program eminform(1) which writes the profiling information
on a file called em_profile.
.IP f
maintain a bit map of all source lines that have been executed.
This map is written also onto the file em_runinf and can be interpreted by eminform(1) which writes in this case the file em_flow.
This option is almost free in time and space.
.IP c
count line usage in tables that
contains for every source line the number of times it
was entered.
These tables are also written onto em_runinf.
Eminform(1) can be used to convert this information into the
file em_count.
Cheap in time, expensive in memory space.
.PP
These flags
give rise to 5 different interpreters which are in the
directory ~em/lib/int22/em_????
.PP
If the interpreter exits with a non-zero exit status, then the line numbers
of the 64 last executed source lines are dumped on the file
em_runinf
in the current directory. Eminform(1) writes this information
on the human readable file em_last.
.SH "FILES"
.IP ~em/lib/int22/em_???? 35
interpreters proper
.IP em_runinf
memory dump containing runtime information
.IP em_profile
profile data
.IP em_count
source line count data
.IP em_flow
source line flow data
.IP em_last
last lines executed
.PD
.SH "SEE ALSO"
eminform(1), ack(1),
.SH BUGS
Most error messages are self explanatory.
The interpreter stops in case of lack of space with an error
message SEGVIO stack overflow.
If runtime flags are turned on it is advisable to try again
with the default options.
Bugs should be reported to Evert Wattel.

View File

@@ -1,17 +1,6 @@
/*
* (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
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*
*/

View File

@@ -158,7 +158,8 @@
startoff:
mov sp,r0
mov sp,ml
mov 02(sp),filb / pointer to argv in filb for error message
mov sp,filb
add $2,filb / pointer to argv in filb for error message
dec (r0)
mov (r0)+,argc / pass to userprogram later
bgt 0f / go for argument
@@ -316,7 +317,7 @@ dat5: mov pb,r0 / and program base for procedures
br datloop / next data descriptor
dat1: mov $und,(r3)+ / reserve words with undefineds
sob r2,2b / jump back if more
sob r2,dat1 / jump back if more
br datloop / next data descriptor
0: mov r3,r1 / copy data pointer (odd register)

51
mach/pdp/int/eminform.1 Normal file
View File

@@ -0,0 +1,51 @@
.\" $Header$
.tr ~
.TH EMINFORM 1ACK
.ad
.SH NAME
eminform \- converts runtime information of interpreted em to
human readable form.
.SH SYNOPSIS
eminform
.SH DESCRIPTION
The EM interpreter, em(1), has several debugging features built in.
They can be activated by flag options to em(1).
The EM interpreter collects the information while it runs the program.
When the program is terminated, the interpreter dumps this information onto
a file called em_runinf.
Eminform converts this information in human readable form onto
a set of files with fixed names, the file em_runinf itself is unlinked.
.PP
.in +15
.ti -13
~~em_last~~~~A circular buffer is used to keep track of
the last collection of executed source lines.
.ti -13
~~em_flow~~~~A bit map for all source lines tells which lines
are executed.
.ti -13
~~em_count~~~Count the number of times each source line was entered.
.ti -13
~~em_profile~Estimate the number of memory cycles
spent on each source line.
.in -15
.LP
The most common use of eminform is to print the numbers of the last executed
source lines if an execution error occurred.
No arguments are needed in this case.
.LP
Eminform will create only those files for which there were
interpreter flags turned on. If no runtime error occurred and
no flag was turned on the file em_runinf is not created. In
this case eminform will give the error message "read header
failed".
.SH FILES
em_runinf, em_last, em_flow, em_count, em_profile
.SH "SEE ALSO"
ack(1), em(1).
.SH BUGS
If an entire procedure is not touched, the the file name in
which this procedure occured is unknown.
If no em_runinf is available the error message is "read header
failed" and a core dump is created.
Bugs should be reported to Evert Wattel

2
mach/pdp/libbc/.distr Normal file
View File

@@ -0,0 +1,2 @@
Makefile
compmodule

View File

@@ -1,9 +1,9 @@
SUF=o
MAKEFILE=../../proto/libg/Makefile
MACHDEF="MACH=pdp" "SUF=o" "ASAR=ar"
MACHDEF="MACH=pdp" "SUF=$(SUF)" "ASAR=aal"
BCDEF="PREF=bc" "SUB=" "SRC=lang/basic/lib"
install:
RANLIB=ranlib ; export RANLIB ;\
make -f $(MAKEFILE) $(BCDEF) $(MACHDEF) tailcp
cmp:

View File

@@ -1,2 +1,4 @@
${MACH?} -I../../../h ${MACHFL?} $1 1>&2
echo `basename $1 $2`.o
if ${MACH?} -I../../../h ${MACHFL?} $1 1>&2
then echo `basename $1 $2`.o
else exit 1
fi

2
mach/pdp/libcc/.distr Normal file
View File

@@ -0,0 +1,2 @@
Makefile
compmodule

View File

@@ -1,12 +1,13 @@
SUF=o
MAKEFILE=../../proto/libg/Makefile
MACHDEF="MACH=pdp" "SUF=o" "ASAR=ar"
MACHDEF="MACH=pdp" "SUF=$(SUF)" "ASAR=aal"
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"
LIBM="PREF=m" "SRC=lang/cem/libcc/libm"
LIBLN="PREF=ln" "SRC=lang/cem/libcc/libln"
install: cpstdio cpgen cplibm cplibln
install: cpstdio cpgen
cpstdio:
make -f $(MAKEFILE) $(STDIO) $(MACHDEF) tailcp
@@ -19,7 +20,7 @@ cplibm:
cplibln:
make -f $(MAKEFILE) $(LIBLN) $(MACHDEF) tailcp
cmp: cmpstdio cmpgen cmplibm cmplibln
cmp: cmpstdio cmpgen
cmpstdio:
make -f $(MAKEFILE) $(STDIO) $(MACHDEF) tail

View File

@@ -1,2 +1,4 @@
${MACH?} -I../../../h ${MACHFL?} $1 1>&2
echo `basename $1 $2`.o
if ${MACH?} -I../../../h ${MACHFL?} $1 1>&2
then echo `basename $1 $2`.o
else exit 1
fi

6
mach/pdp/libem/.distr Normal file
View File

@@ -0,0 +1,6 @@
LIST
Makefile
compmodule
head_em.s
libem_s.a
end.s

View File

@@ -1,4 +1,4 @@
tail_em.s.a
libem_s.a
RT.s
adf.s
adi.s

View File

@@ -1,28 +1,33 @@
all: head_em.o libem_o.a end.o
install: cp
cp: all
../../install head_em
../../install tail_em
rm -f head_em tail_em
../../install head_em.o head_em
../../install libem_o.a tail_em
../../install end.o end_em
cmp: all
-../../compare head_em
-../../compare tail_em
rm -f head_em tail_em
-../../compare head_em.o head_em
-../../compare libem_o.a tail_em
-../../compare end.o end_em
all: head_em tail_em
head_em: head_em.s
pdp -c head_em.s ; mv head_em.o head_em
head_em.o: head_em.s
pdp -c head_em.s
tail_em:
march . tail_em
end.o: end.s
pdp -c end.s
libem_o.a: libem_s.a
ASAR=aal ; export ASAR ; march . libem_o.a
clean:
rm -f *.o
rm -f *.o libem_o.a
opr:
make pr | opr
pr:
@pr `pwd`/Makefile `pwd`/head_em.s
pr -l33 `tail +1 LIST|sort`
@arch pv libem_s.a | pr -h `pwd`/libem_s.a

View File

@@ -1,7 +1,8 @@
/ $Header$
.globl PRr2,PR2r2,PR4r2,PR6r2
.globl PRr2r4,PR2r2r4,PR4r2r4,PR6r2r4
.globl RT,RTr2,RTr2r4
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define PRr2,PR2r2,PR4r2,PR6r2
.define PRr2r4,PR2r2r4,PR4r2r4,PR6r2r4
.define RT,RTr2,RTr2r4
! $Header$
PR6r2: mov $6,r0;br PRr2
PR4r2: mov $4,r0;br PRr2

View File

@@ -1,10 +1,11 @@
/ $Header$
.text
.globl aar~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define aar~
! $Header$
/r0 : descriptor address
/r1 : element number
/base address is on stack
!r0 : descriptor address
!r1 : element number
!base address is on stack
aar~:
sub (r0),r1
mul 04(r0),r1

View File

@@ -1,9 +1,10 @@
/ $Header$
.text
.globl adf~
.globl setfloat~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define adf~
.extern setfloat~
! $Header$
/size in r0
!size in r0
adf~:
mov (sp)+,r1
jsr pc,setfloat~

View File

@@ -1,9 +1,10 @@
/ $Header$
.text
.globl adi~
.globl unknown~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define adi~
.extern unknown~
! $Header$
/size in r0
!size in r0
adi~:
mov (sp)+,r1
cmp r0,$04

View File

@@ -1,8 +1,9 @@
/ $Header$
.text
.globl and~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define and~
! $Header$
/ size in r0
! size in r0
and~:
mov (sp)+,r3
mov sp,r1

View File

@@ -1,7 +1,8 @@
/ $Header$
.text
.globl cff~
.globl setfloat~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define cff~
.extern setfloat~
! $Header$
cff~:
mov (sp)+,r1

View File

@@ -1,7 +1,8 @@
/ $Header$
.text
.globl cfi~
.globl setfloat~,setint~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define cfi~
.extern setfloat~,setint~
! $Header$
cfi~:
mov (sp)+,r1

View File

@@ -1,7 +1,8 @@
/ $Header$
.text
.globl cif~,cuf~
.globl setint~,setfloat~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define cif~,cuf~
.extern setint~,setfloat~
! $Header$
cif~:
mov (sp)+,r1

View File

@@ -1,9 +1,10 @@
/ $Header$
.text
.globl cii~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define cii~
! $Header$
/convert int to int
/ 1 byte -> ? : sign extension
!convert int to int
! 1 byte -> ? : sign extension
cii~:
mov (sp)+,r3
mov (sp)+,r0
@@ -18,5 +19,5 @@ cii~:
tst (sp)
4: sxt -(sp)
sob r0,4b
1: sub r0,sp / if out of sob loop r0==0
1: sub r0,sp ! if out of sob loop r0==0
3: jmp (r3)

View File

@@ -1,6 +1,8 @@
/ $Header$
.text
.globl cuu~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define cuu~
! $Header$
cuu~:
mov (sp)+,r1
mov (sp)+,r0
@@ -9,5 +11,5 @@ cuu~:
asr r0
2: clr -(sp)
sob r0,2b
1: sub r0,sp / if out of sob loop r0==0
1: sub r0,sp ! if out of sob loop r0==0
jmp (r1)

View File

@@ -1,7 +1,8 @@
/ $Header$
.text
.globl cmf~
.globl setfloat~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define cmf~
.extern setfloat~
! $Header$
cmf~:
jsr pc,setfloat~

View File

@@ -1,9 +1,10 @@
/ $Header$
.text
.globl cmi~
.globl cmi4~,unknown~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define cmi~
.extern cmi4~,unknown~
! $Header$
/ Size in r0
! Size in r0
cmi~:
cmp r0,$02
bne 1f

View File

@@ -1,6 +1,7 @@
/ $Header$
.text
.globl cmi4~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define cmi4~
! $Header$
cmi4~:
mov (sp)+,r1
@@ -17,5 +18,5 @@ cmi4~:
1:
dec r0
3:
add $10,sp
add $010,sp
jmp (r1)

View File

@@ -1,7 +1,8 @@
/ $Header$
.text
.globl cms~
.globl save~,retu~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define cms~
.extern save~,retu~
! $Header$
cms~:
jsr pc,save~

View File

@@ -1,7 +1,8 @@
/ $Header$
.text
.globl cmu~
.globl unknown~,cmu4~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define cmu~
.extern unknown~,cmu4~
! $Header$
cmu~:
cmp r0,$02

View File

@@ -1,6 +1,7 @@
/ $Header$
.text
.globl cmu4~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define cmu4~
! $Header$
cmu4~:
mov (sp)+,r1
clr r0
@@ -16,5 +17,5 @@ cmu4~:
1:
dec r0
3:
add $10,sp
add $010,sp
jmp (r1)

View File

@@ -1,9 +1,10 @@
/ $Header$
.text
.globl csa~
.globl fat~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define csa~
.extern fat~
! $Header$
ECASE = 20.
ECASE = 024
csa~:
sub 02(r0),r1

View File

@@ -1,9 +1,10 @@
/ $Header$
.text
.globl csb~
.globl fat~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define csb~
.extern fat~
! $Header$
ECASE = 20.
ECASE = 024
csb~:
mov (r0)+,-(sp)

View File

@@ -1,6 +1,7 @@
/ $Header$
.text
.globl dup~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define dup~
! $Header$
dup~:
mov (sp)+,r3

View File

@@ -1,7 +1,8 @@
/ $Header$
.text
.globl dvf~
.globl setfloat~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define dvf~
.extern setfloat~
! $Header$
dvf~:
mov (sp)+,r1

View File

@@ -1,7 +1,8 @@
/ $Header$
.text
.globl dvi~
.globl unknown~,dvi4~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define dvi~
.extern unknown~,dvi4~
! $Header$
dvi~:
mov (sp)+,r3

View File

@@ -1,7 +1,8 @@
/ $Header$
.text
.globl dvi4~
.globl save~,retu~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define dvi4~
.extern save~,retu~
! $Header$
dvi4~:
jsr pc,save~

View File

@@ -1,7 +1,8 @@
/ $Header$
.text
.globl dvu~
.globl unknown~,dvu4~,dvu2~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define dvu~
.extern unknown~,dvu4~,dvu2~
! $Header$
dvu~:
mov (sp)+,r3

View File

@@ -1,6 +1,7 @@
/ $Header$
.text
.globl dvu2~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define dvu2~
! $Header$
dvu2~:
clr r0
mov 04(sp),r1

View File

@@ -1,7 +1,8 @@
/ $Header$
.text
.globl dvu4~
.globl save~,retu~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define dvu4~
.extern save~,retu~
! $Header$
dvu4~:
jsr pc,save~

16
mach/pdp/libem/end.s Normal file
View File

@@ -0,0 +1,16 @@
.define endtext,enddata,endbss,_etext,_edata,_end
.sect .text
.sect .rom
.sect .data
.sect .bss
.sect .end ! only for declaration of _end and endbss.
.sect .text
endtext:
_etext:
.sect .data
enddata:
_edata:
.sect .end
_end:
endbss:

View File

@@ -1,5 +1,6 @@
/ $Header$
.globl eret
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define eret
! $Header$
eret:
mov r5,sp

View File

@@ -1,6 +1,7 @@
/ $Header$
.text
.globl exg~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define exg~
! $Header$
exg~: jsr pc,save~
mov sp,r4
sub r0,sp

View File

@@ -1,7 +1,7 @@
/ $Header$
.text
.globl fef~
.globl setfloat~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define fef~
.extern setfloat~
! $Header$
fef~:
mov (sp)+,r1

View File

@@ -1,7 +1,7 @@
/ $Header$
.text
.globl fif~
.globl setfloat~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define fif~
.extern setfloat~
! $Header$
fif~:
mov (sp)+,r1

View File

@@ -1,19 +1,20 @@
/ $Header$
.text
.globl gto~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define gto~
! $Header$
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)
!
! 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,36 +1,34 @@
/ $Header$
.globl LINO_AD,FILN_AD
.globl ERANGE,ESET,EHEAP,EILLINS,ECASE
.globl hol0,trppc~,trpim~,reghp~
#
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define LINO_AD,FILN_AD
.define ERANGE,ESET,EHEAP,EILLINS,ECASE
.define hol0,trppc~,trpim~,reghp~
! $Header$
rti = 2
stst = 170300 ^ tst
#define float 1
#define hardfp 1
.float = 1 / this should be parameterized somehow
.hardfp = 1 / only relevant if .float on
LINO_AD = 0
FILN_AD = 4
LINO_AD = 0.
FILN_AD = 4.
ERANGE = 1
ESET = 2
EFOVFL = 4
EFUNFL = 5
EFDIVZ = 7
EFUND = 011
ECONV = 012
EHEAP = 021
EILLINS = 022
ECASE = 024
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
#ifdef float
#ifndef hardfp
! sys 060;.data2 4,fptrap / if not commented it will appear as undefined
#endif
sys 060;.data2 010,sig8
ldfps $07600
#endif
mov 2(sp),r0
clr -2(r0)
mov sp,r0
@@ -47,30 +45,30 @@ ECASE = 20.
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.
! 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
.sect .data
hol0: .data2 0,0 ! line no
.data2 0,0 ! file
trppc~: .data2 0
trpim~: .data2 0
reghp~: .data2 _end
.text
.sect .text
sig8:
.if .float
#ifdef float
mov r0,-(sp)
stst r0
mov 1f(r0),-(sp)
jsr pc,trp~
sys 48.;8.;sig8
sys 060;.data2 010,sig8
mov (sp)+,r0
rti
.data
1: EILLINS; EILLINS; EFDIVZ; ECONV; EFOVFL; EFUNFL; EFUND; EILLINS
.text
.endif
.sect .data
1: .data2 EILLINS, EILLINS, EFDIVZ, ECONV, EFOVFL, EFUNFL, EFUND, EILLINS
.sect .text
#endif

View File

@@ -1,6 +1,7 @@
/ $Header$
.text
.globl hlt~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define hlt~
! $Header$
exit = 1
@@ -8,4 +9,4 @@ hlt~:
mov (sp)+,r0
bne 1f
sys exit
1: 4
1: .data2 4

View File

@@ -1,9 +1,10 @@
/ $Header$
.text
.globl iaar~
.globl aar~,trp~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define iaar~
.extern aar~,trp~
! $Header$
EILLINS = 18.
EILLINS = 022
iaar~:
mov (sp)+,r0

View File

@@ -1,9 +1,10 @@
/ $Header$
.text
.globl ilar~
.globl lar~,trp~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define ilar~
.extern lar~,trp~
! $Header$
EILLINS = 18.
EILLINS = 022
ilar~:
mov (sp)+,r0

View File

@@ -1,6 +1,7 @@
/ $Header$
.text
.globl inn~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define inn~
! $Header$
inn~:
mov r0,-(sp)
@@ -18,5 +19,5 @@ inn~:
add (sp)+,sp
tst (sp)+
jmp (r1)
.data
bits: .byte 1,2,4,10,20,40,100,200
.sect .data
bits: .data1 1,2,4,010,020,040,0100,0200

View File

@@ -1,9 +1,10 @@
/ $Header$
.text
.globl isar~
.globl sar~,trp~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define isar~
.extern sar~,trp~
! $Header$
EILLINS = 18.
EILLINS = 022
isar~:
mov (sp)+,r0

View File

@@ -1,6 +1,7 @@
/ $Header$
.text
.globl lar~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define lar~
! $Header$
lar~:
mov (sp)+,r3

View File

@@ -1,6 +1,7 @@
/ $Header$
.text
.globl los2~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define los2~
! $Header$
los2~:
mov (sp)+,r3

View File

@@ -1,7 +1,8 @@
/ $Header$
.text
.globl mlf~
.globl setfloat~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define mlf~
.extern setfloat~
! $Header$
mlf~:
mov (sp)+,r1

View File

@@ -1,7 +1,8 @@
/ $Header$
.text
.globl mli~
.globl unknown~,mli4~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define mli~
.extern unknown~,mli4~
! $Header$
mli~:
cmp r0,$04

View File

@@ -1,7 +1,8 @@
/ $Header$
.text
.globl mli4~
.globl save~,retu~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define mli4~
.extern save~,retu~
! $Header$
mli4~:
jsr pc,save~

View File

@@ -1,7 +1,8 @@
/ $Header$
.text
.globl mlu~
.globl unknown~,mlu4~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define mlu~
.extern unknown~,mlu4~
! $Header$
mlu~:
cmp r0,$04

View File

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

View File

@@ -1,25 +1,26 @@
/ $Header$
.text
.globl mon~
.globl sigtrp~,save~,retu~,save1~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
! $Header$
.sect .text
.define mon~
.extern sigtrp~,save~,retu~,save1~
indir = 0
fork = 2
getpid = 20.
sigtrp = 48.
EBADMON = 25.
getpid = 024
sigtrp = 060
EBADMON = 031
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.
! 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
@@ -37,7 +38,7 @@ mon~:
bne 2f
jbr fork~
2: bic $HBMASK,r2
bis $sys,r2
bis $0104400,r2 ! sys = 0104400
mov r2,9f
bit $REG01M,r3
beq 1f
@@ -50,7 +51,7 @@ mon~:
mov $[9f+2],r2
1: mov (sp)+,(r2)+
sob r3,1b
2: sys indir ; 9f
2: sys indir ; .data2 9f
bcs 2f
clr r3
4: asr r4
@@ -79,68 +80,68 @@ err:
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--
.sect .data
.align 1
9: .space 12
args: .data2 ERRMASK ! 0 : error
.data2 010 ! 1 : exit(st); ---
.data2 07 ! 2 : fork(); e10
.data2 0215 ! 3 : read(addr,nb,fild); e-0
.data2 0215 ! 4 : write(addr,nb,fild); e-0
.data2 0205 ! 5 : open(str,flag); e-0
.data2 014 ! 6 : close(fild); e--
.data2 07 ! 7 : wait(); e10
.data2 0205 ! 8 : creat(str,mode); e-0
.data2 0204 ! 9 : link(str1,str2); e--
.data2 0104 !10 : unlink(str); e--
.data2 ERRMASK !11 : error
.data2 0104 !12 : chdir(str); e--
.data2 03 !13 : time(); -10
.data2 0304 !14 : mknod(str,mode,addr); e--
.data2 0204 !15 : chmod(str,mode); e--
.data2 0304 !16 : chown(str,owner,grp); e--
.data2 ERRMASK !17 : error
.data2 0204 !18 : stat(str,buf); e--
.data2 0217 !19 : lseek(high,low,fild); e10
.data2 01 !20 : getpid(); --0
.data2 0304 !21 : mount(str1,str2,fl); e--
.data2 0104 !22 : umount(str); e--
.data2 014 !23 : setuid(uid); e--
.data2 03 !24 : getuid(); -01
.data2 024 !25 : stime(high,low); e--
.data2 0315 !26 : ptrace(pid,addr,req,d); e-0
.data2 011 !27 : alarm(sec); --0
.data2 0114 !28 : fstat(buf,fild); e--
.data2 0 !29 : pause(); ---
.data2 0204 !30 : utime(str,timep); e--
.data2 ERRMASK !31 : error
.data2 ERRMASK !32 : error
.data2 0204 !33 : access(str,mode): e--
.data2 010 !34 : nice(incr); ---
.data2 0100 !35 : ftime(bufp); ---
.data2 0 !36 : sync(); ---
.data2 0114 !37 : kill(sig,pid); e--
.data2 ERRMASK !38 : error
.data2 ERRMASK !39 : error
.data2 ERRMASK !40 : error
.data2 025 !41 : dup(fild,newfild); e-0
.data2 07 !42 : pipe(); e10
.data2 0100 !43 : times(buf); ---
.data2 0400 !44 : profil(buff,siz,off,sc); ---
.data2 ERRMASK !45 : error
.data2 014 !46 : setgid(gid); e--
.data2 03 !47 : getgid(); -01
.data2 0 !48 : sigtrp(trap,sig); e-0; SPECIAL TREATMENT
.data2 ERRMASK !49 : error
.data2 ERRMASK !50 : error
.data2 0104 !51 : acct(file); e--
.data2 0304 !52 : phys(seg,siz,phaddr); e--
.data2 0104 !53 : lock(flag); e--
.data2 0304 !54 : ioctl(fild,req,argp); e--
.data2 ERRMASK !55 : error
.data2 0204 !56 : mpxcall(cmd,vec); e--
.data2 ERRMASK !57 : error
.data2 ERRMASK !58 : error
.data2 0304 !59 : exece(name,argv,envp); e--
.data2 0104 !60 : umask(complmode); e--
.data2 0104 !61 : chroot(str); e--

View File

@@ -1,7 +1,8 @@
/ $Header$
.text
.globl ngf~
.globl setfloat~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define ngf~
.extern setfloat~
! $Header$
ngf~:
jsr pc,setfloat~

View File

@@ -1,7 +1,8 @@
/ $Header$
.text
.globl ngi~
.globl unknown~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define ngi~
.extern unknown~
! $Header$
ngi~:
mov (sp)+,r1

View File

@@ -1,7 +1,8 @@
/ $Header$
.text
.globl nop~
.globl hol0,prf~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define nop~
.extern hol0,prf~
! $Header$
nop~:
mov hol0,-(sp)
@@ -9,5 +10,5 @@ nop~:
jsr pc,prf~
add $04,sp
rts pc
.data
fmt: <test %d\n\0>
.sect .data
fmt: .asciz "test %d\n"

View File

@@ -1,7 +1,8 @@
/ $Header$
.text
.globl prf~
.globl save~,retu~,hol0,_printf
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define prf~
.extern save~,retu~,hol0,_printf
! $Header$
prf~:
jsr pc,save~
@@ -9,7 +10,7 @@ prf~:
mov hol0+4,r0
beq 1f
mov r0,r2
mov $40.,r1
mov $050,r1
3: movb (r2)+,r3
beq 2f
cmpb r3,$0177
@@ -29,6 +30,6 @@ prf~:
1: mov $name,r0
br 2b
.data
fmt: <"%s", sp = %d, line %d: \0>
name: <_unknown file_\0>
.sect .data
fmt: .asciz "\"%s\", sp = %d, line %d: "
name: .asciz "_unknown file_"

View File

@@ -1,6 +1,7 @@
/ $Header$
.text
.globl _printf
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define _printf
! $Header$
write = 4
@@ -54,10 +55,10 @@ ready:
mov $buff,9f
mov r4,9f+2
sys write
9: 0; 0
9: .data2 0, 0
mov (sp)+,r4
mov (sp)+,r3
mov (sp)+,r2
rts pc
.data
buff: .=.+256.
.sect .bss
buff: .space 256

View File

@@ -1,7 +1,8 @@
/ $Header$
.text
.globl rck~
.globl trp~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define rck~
.extern trp~
! $Header$
ERANGE = 1

View File

@@ -1,9 +1,10 @@
/ $Header$
.text
.globl ret~,lfr~,retar
.globl unknown~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define ret~,lfr~
.extern unknown~, retar
! $Header$
/ Size in r0
! Size in r0
ret~:
mov r0,r1
beq 1f

View File

@@ -1,7 +1,8 @@
/ $Header$
.text
.globl rmi~
.globl unknown~,rmi4~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define rmi~
.extern unknown~,rmi4~
! $Header$
rmi~:
mov (sp)+,r3

View File

@@ -1,7 +1,8 @@
/ $Header$
.text
.globl rmi4~
.globl save~,retu~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define rmi4~
.extern save~,retu~
! $Header$
rmi4~:
jsr pc,save~

View File

@@ -1,7 +1,8 @@
/ $Header$
.text
.globl rmu~
.globl rmu2~,rmu4~,unknown~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define rmu~
.extern rmu2~,rmu4~,unknown~
! $Header$
rmu~:
mov (sp)+,r3

View File

@@ -1,6 +1,7 @@
/ $Header$
.text
.globl rmu2~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define rmu2~
! $Header$
rmu2~:
mov 04(sp),r1

View File

@@ -1,7 +1,8 @@
/ $Header$
.text
.globl rmu4~
.globl save~,retu~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define rmu4~
.extern save~,retu~
! $Header$
rmu4~:
jsr pc,save~

View File

@@ -1,7 +1,8 @@
/ $Header$
.text
.globl rol~
.globl save~,retu~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define rol~
.extern save~,retu~
! $Header$
rol~:
jsr pc,save~

View File

@@ -1,7 +1,8 @@
/ $Header$
.text
.globl ror~
.globl save~,retu~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define ror~
.extern save~,retu~
! $Header$
ror~:
asr r0

View File

@@ -1,6 +1,7 @@
/ $Header$
.text
.globl sar~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define sar~
! $Header$
sar~:
mov (sp)+,r3

View File

@@ -1,6 +1,7 @@
/ $Header$
.text
.globl save~,retu~,savearea
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define save~,retu~,savearea
! $Header$
save~:
mov r5,savearea
@@ -19,7 +20,6 @@ retu~:
mov -(r5),r5
rts pc
.data
.even
.sect .bss
savearea:
.=.+12.
.space 12

View File

@@ -1,7 +1,8 @@
/ $Header$
.text
.globl sbf~
.globl setfloat~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define sbf~
.extern setfloat~
! $Header$
sbf~:
mov (sp)+,r1

View File

@@ -1,7 +1,8 @@
/ $Header$
.text
.globl sbi~
.globl unknown~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define sbi~
.extern unknown~
! $Header$
sbi~:
mov (sp)+,r1

View File

@@ -1,7 +1,8 @@
/ $Header$
.text
.globl set~
.globl save~,retu~,trp~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define set~
.extern save~,retu~,trp~
! $Header$
ESET = 2
@@ -11,7 +12,7 @@ set~:
asr r0
1: clr -(sp)
sob r0,1b
div $8.,r0
div $010,r0
cmp r0,r2
blo 2f
mov $ESET,-(sp)
@@ -21,5 +22,5 @@ set~:
bisb bits(r1),(r0)
jmp retu~
.data
bits: .byte 1,2,4,10,20,40,100,200
.sect .data
bits: .data1 1,2,4,010,020,040,0100,0200

View File

@@ -1,7 +1,8 @@
/ $Header$
.text
.globl setfloat~,setint~
.globl unknown~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define setfloat~,setint~
.extern unknown~
! $Header$
setfloat~:
cmp r0,$8.

View File

@@ -1,40 +1,39 @@
/ $Header$
.text
.globl sigtrp~
.globl trp~,save~,retu~
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.sect .text
.define sigtrp~
.define trp~,save~,retu~
! $Header$
indir = 0
signal = 48.
signal = 060
rti = 2
sig1: mov sig.trp+0.,-(sp)
sig1: mov sig.trp+0,-(sp)
br 1f
sig2: mov sig.trp+2.,-(sp)
sig2: mov sig.trp+2,-(sp)
br 1f
sig3: mov sig.trp+4.,-(sp)
sig3: mov sig.trp+4,-(sp)
br 1f
sig4: mov sig.trp+6.,-(sp)
sig4: mov sig.trp+6,-(sp)
br 1f
sig5: mov sig.trp+8.,-(sp)
sig5: mov sig.trp+010,-(sp)
br 1f
sig6: mov sig.trp+10.,-(sp)
sig6: mov sig.trp+012,-(sp)
br 1f
sig7: mov sig.trp+12.,-(sp)
sig7: mov sig.trp+014,-(sp)
br 1f
sig10: mov sig.trp+18.,-(sp)
sig10: mov sig.trp+022,-(sp)
br 1f
sig11: mov sig.trp+20.,-(sp)
sig11: mov sig.trp+024,-(sp)
br 1f
sig12: mov sig.trp+22.,-(sp)
sig12: mov sig.trp+026,-(sp)
br 1f
sig13: mov sig.trp+24.,-(sp)
sig13: mov sig.trp+030,-(sp)
br 1f
sig14: mov sig.trp+026.,-(sp)
sig14: mov sig.trp+032,-(sp)
br 1f
sig15: mov sig.trp+028.,-(sp)
sig15: mov sig.trp+034,-(sp)
br 1f
sig16: mov sig.trp+030.,-(sp)
sig16: mov sig.trp+036,-(sp)
br 1f
1:
jsr pc,trp~
@@ -46,12 +45,12 @@ sigtrp~:
mov (sp)+,r1
mov (sp)+,r0
ble sig.bad
cmp r0,$16.
cmp r0,$020
bhi sig.bad
mov r0,call+02
asl r0
mov sig.trp-2(r0),r3
cmp r1,$256.
cmp r1,$0400
bhis 1f
mov sig.adr-2(r0),r2
bne 2f
@@ -68,7 +67,7 @@ sigbad:
inc r2
2: mov r1,sig.trp-2(r0)
mov r2,call+04
sys indir ; call
sys indir ; .data2 call
bcs sigbad
asr r0
bcc 1f
@@ -79,15 +78,16 @@ sigbad:
clr -(sp)
jmp retu~
.data
call: sys signal; 0; 0
.sect .data
call: sys signal
.data2 0, 0
sig.trp:
-2; -2; -2; -2
-2; -2; -2; -2
-2; -2; -2; -2
-2; -2; -2; -2
.data2 -2, -2, -2, -2
.data2 -2, -2, -2, -2
.data2 -2, -2, -2, -2
.data2 -2, -2, -2, -2
sig.adr:
sig1; sig2; sig3; sig4
sig5; sig6; sig7; 0
0; sig10; sig11; sig12
sig13; sig14; sig15; sig16
.data2 sig1, sig2, sig3, sig
.data2 sig5, sig6, sig7, 0
.data2 0, sig10, sig11, sig12
.data2 sig13, sig14, sig15, sig16

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