Added .globl, fix in Xfit call
This commit is contained in:
26
mach/.distr
Normal file
26
mach/.distr
Normal file
@@ -0,0 +1,26 @@
|
||||
6500
|
||||
6800
|
||||
6805
|
||||
6809
|
||||
i80
|
||||
compare
|
||||
i86
|
||||
install
|
||||
int22
|
||||
int24
|
||||
int44
|
||||
m68k2
|
||||
m68k4
|
||||
m68020
|
||||
mantra
|
||||
ns
|
||||
pdp
|
||||
pmds
|
||||
pmds4
|
||||
proto
|
||||
s2650
|
||||
sun3
|
||||
sun2
|
||||
vax4
|
||||
z80
|
||||
z8000
|
||||
9
mach/6500/.distr
Normal file
9
mach/6500/.distr
Normal file
@@ -0,0 +1,9 @@
|
||||
Action
|
||||
as
|
||||
cg
|
||||
dl
|
||||
libcc
|
||||
libem
|
||||
libpc
|
||||
libbc
|
||||
liboc
|
||||
@@ -19,3 +19,6 @@ end
|
||||
name "MSC6500 Basic library"
|
||||
dir libbc
|
||||
end
|
||||
name "MSC6500 Occam library"
|
||||
dir liboc
|
||||
end
|
||||
|
||||
8
mach/6500/as/.distr
Normal file
8
mach/6500/as/.distr
Normal file
@@ -0,0 +1,8 @@
|
||||
Makefile
|
||||
READ_ME
|
||||
mach0.c
|
||||
mach1.c
|
||||
mach2.c
|
||||
mach3.c
|
||||
mach4.c
|
||||
mach5.c
|
||||
67
mach/6500/as/Makefile
Normal file
67
mach/6500/as/Makefile
Normal 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
|
||||
15
mach/6500/as/READ_ME
Normal file
15
mach/6500/as/READ_ME
Normal file
@@ -0,0 +1,15 @@
|
||||
De .h en .l extensions van expressies zijn hard nodig.
|
||||
Ze zorgen er echter ook voor dat er geen relocatable code geproduceerd
|
||||
kan worden. Beschouw het volgende voorbeeld:
|
||||
|
||||
(file 1)
|
||||
.sect .text ! 1
|
||||
lda #[endbss].l ! 2
|
||||
ldx #[endbss].h ! 3
|
||||
|
||||
(file 2)
|
||||
.sect .bss ! 4
|
||||
endbss: ! 5
|
||||
|
||||
Wat voor relocation struct moet er nu voor de instructie in regel 3
|
||||
worden geproduceerd?
|
||||
12
mach/6500/as/mach0.c
Normal file
12
mach/6500/as/mach0.c
Normal file
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* (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$"
|
||||
|
||||
/*
|
||||
* Mostek 6500 options.
|
||||
*/
|
||||
#define THREE_PASS /* Distinguish short and long branches. */
|
||||
#define LISTING /* Enable listing facilities. */
|
||||
#define ASLD
|
||||
11
mach/6500/as/mach1.c
Normal file
11
mach/6500/as/mach1.c
Normal file
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
* (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$"
|
||||
|
||||
/*
|
||||
* Mostek 6500 dependent C declarations.
|
||||
*/
|
||||
|
||||
#define fits_zeropage(x) (lowb(x) == (int)(x))
|
||||
32
mach/6500/as/mach2.c
Normal file
32
mach/6500/as/mach2.c
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* (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$"
|
||||
|
||||
/*
|
||||
* Mostek 6500 tokens.
|
||||
*/
|
||||
|
||||
%token <y_word> A
|
||||
%token <y_word> X
|
||||
%token <y_word> Y
|
||||
%token <y_word> EXTENSION
|
||||
%token <y_word> ADDOP
|
||||
%token <y_word> ROLOP
|
||||
%token <y_word> BRAOP
|
||||
%token <y_word> BITOP
|
||||
%token <y_word> NOPOP
|
||||
%token <y_word> CPXOP
|
||||
%token <y_word> INCOP
|
||||
%token <y_word> JMPOP
|
||||
%token <y_word> JSROP
|
||||
%token <y_word> LDXOP
|
||||
%token <y_word> LDYOP
|
||||
%token <y_word> STXOP
|
||||
%token <y_word> STYOP
|
||||
%token <y_word> PSEU
|
||||
|
||||
%type <y_word> addop
|
||||
|
||||
%nonassoc EXTENSION
|
||||
73
mach/6500/as/mach3.c
Normal file
73
mach/6500/as/mach3.c
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* (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$"
|
||||
|
||||
/*
|
||||
* Mostek 6500 keywords
|
||||
*/
|
||||
|
||||
0, EXTENSION, 0, ".l",
|
||||
0, EXTENSION, 8, ".h",
|
||||
0, A, 0, "a",
|
||||
0, X, 0, "x",
|
||||
0, Y, 0, "y",
|
||||
0, ADDOP, 0x60, "adc",
|
||||
0, ADDOP, 0x20, "and",
|
||||
0, ADDOP, 0xC0, "cmp",
|
||||
0, ADDOP, 0x40, "eor",
|
||||
0, ADDOP, 0xA0, "lda",
|
||||
0, ADDOP, 0x00, "ora",
|
||||
0, ADDOP, 0xE0, "sbc",
|
||||
0, ADDOP, 0x80, "sta",
|
||||
0, ROLOP, 0x00, "asl",
|
||||
0, ROLOP, 0x40, "lsr",
|
||||
0, ROLOP, 0x20, "rol",
|
||||
0, ROLOP, 0x60, "ror",
|
||||
0, BRAOP, 0x90, "bcc",
|
||||
0, BRAOP, 0xB0, "bcs",
|
||||
0, BRAOP, 0xF0, "beq",
|
||||
0, BRAOP, 0x30, "bmi",
|
||||
0, BRAOP, 0xD0, "bne",
|
||||
0, BRAOP, 0x10, "bpl",
|
||||
0, BRAOP, 0x50, "bvc",
|
||||
0, BRAOP, 0x70, "bvs",
|
||||
0, BITOP, 0x24, "bit",
|
||||
0, NOPOP, 0x00, "brk",
|
||||
0, NOPOP, 0x18, "clc",
|
||||
0, NOPOP, 0xD8, "cld",
|
||||
0, NOPOP, 0x58, "cli",
|
||||
0, NOPOP, 0xB8, "clv",
|
||||
0, NOPOP, 0xCA, "dex",
|
||||
0, NOPOP, 0x88, "dey",
|
||||
0, NOPOP, 0xE8, "inx",
|
||||
0, NOPOP, 0xC8, "iny",
|
||||
0, NOPOP, 0xEA, "nop",
|
||||
0, NOPOP, 0x48, "pha",
|
||||
0, NOPOP, 0x08, "php",
|
||||
0, NOPOP, 0x68, "pla",
|
||||
0, NOPOP, 0x28, "plp",
|
||||
0, NOPOP, 0x40, "rti",
|
||||
0, NOPOP, 0x60, "rts",
|
||||
0, NOPOP, 0x38, "sec",
|
||||
0, NOPOP, 0xF8, "sed",
|
||||
0, NOPOP, 0x78, "sei",
|
||||
0, NOPOP, 0xAA, "tax",
|
||||
0, NOPOP, 0xA8, "tay",
|
||||
0, NOPOP, 0x98, "tya",
|
||||
0, NOPOP, 0xBA, "tsx",
|
||||
0, NOPOP, 0x8A, "txa",
|
||||
0, NOPOP, 0x9A, "txs",
|
||||
0, CPXOP, 0xE0, "cpx",
|
||||
0, CPXOP, 0xC0, "cpy",
|
||||
0, INCOP, 0xC0, "dec",
|
||||
0, INCOP, 0xE0, "inc",
|
||||
0, JMPOP, 0x4C, "jmp",
|
||||
0, JSROP, 0x20, "jsr",
|
||||
0, LDXOP, 0xA0, "ldx",
|
||||
0, LDYOP, 0xA0, "ldy",
|
||||
0, STXOP, 0x80, "stx",
|
||||
0, STYOP, 0x80, "sty",
|
||||
0, PSEU, 0x1860, "add",
|
||||
0, PSEU, 0x38E0, "sub",
|
||||
146
mach/6500/as/mach4.c
Normal file
146
mach/6500/as/mach4.c
Normal file
@@ -0,0 +1,146 @@
|
||||
#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".
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Mostek 6500 parsing tables.
|
||||
*/
|
||||
|
||||
expr
|
||||
: expr EXTENSION
|
||||
{ $$.val = ($1.val >> $2) & 0xFF;
|
||||
$$.typ = combine($1.typ, S_ABS, '&');
|
||||
}
|
||||
;
|
||||
operation
|
||||
: NOPOP
|
||||
{ emit1($1); }
|
||||
| BITOP expr
|
||||
{ code($2,$1,$1+8); }
|
||||
| JMPOP expr
|
||||
{ emit1($1);
|
||||
#ifdef RELOCATION
|
||||
newrelo($2.typ, RELO2);
|
||||
#endif
|
||||
emit2($2.val);
|
||||
}
|
||||
| JMPOP '(' expr ')'
|
||||
{ emit1($1+0x20);
|
||||
#ifdef RELOCATION
|
||||
newrelo($3.typ, RELO2);
|
||||
#endif
|
||||
emit2($3.val);
|
||||
}
|
||||
| JSROP expr
|
||||
{ emit1($1);
|
||||
#ifdef RELOCATION
|
||||
newrelo($2.typ, RELO2);
|
||||
#endif
|
||||
emit2($2.val);
|
||||
}
|
||||
| LDXOP '#' expr
|
||||
{ emit1(0xA2);
|
||||
#ifdef RELOCATION
|
||||
newrelo($3.typ, RELO1);
|
||||
#endif
|
||||
emit1($3);
|
||||
}
|
||||
| LDXOP expr
|
||||
{ code($2,0xA6,0xAE); }
|
||||
| LDXOP expr ',' Y
|
||||
{ code($2,0xB6,0xBE); }
|
||||
| LDYOP '#' expr
|
||||
{ emit1(0xA0);
|
||||
#ifdef RELOCATION
|
||||
newrelo($3.typ, RELO1);
|
||||
#endif
|
||||
emit1($3);
|
||||
}
|
||||
| LDYOP expr
|
||||
{ code($2,0xA4,0xAC); }
|
||||
| LDYOP expr ',' X
|
||||
{ code($2,0xB4,0xBC); }
|
||||
| STXOP expr
|
||||
{ code($2,$1+0x06,$1+0x0E); }
|
||||
| STXOP expr ',' Y
|
||||
{ emit1($1+0x16);
|
||||
#ifdef RELOCATION
|
||||
newrelo($2.typ, RELO1);
|
||||
#endif
|
||||
emit1(lowb($2.val));
|
||||
}
|
||||
| STYOP expr
|
||||
{ code($2,$1+0x04,$1+0x0C); }
|
||||
| STYOP expr ',' X
|
||||
{ emit1($1+0x14);
|
||||
#ifdef RELOCATION
|
||||
newrelo($2.typ, RELO1);
|
||||
#endif
|
||||
emit1(lowb($2.val));
|
||||
}
|
||||
| addop '#' expr
|
||||
{ if ($1==0x80) serror("no store immediate");
|
||||
emit1($1+0x09);
|
||||
#ifdef RELOCATION
|
||||
newrelo($3.typ, RELO1);
|
||||
#endif
|
||||
emit1($3);
|
||||
}
|
||||
| addop expr
|
||||
{ code($2,$1+0x05,$1+0x0D); }
|
||||
| addop expr ',' X
|
||||
{ code($2,$1+0x15,$1+0x1D); }
|
||||
| addop expr ',' Y
|
||||
{ emit1($1+0x19);
|
||||
#ifdef RELOCATION
|
||||
newrelo($2.typ, RELO2);
|
||||
#endif
|
||||
emit2($2.val);
|
||||
}
|
||||
| addop '(' expr ',' X ')'
|
||||
{ emit1($1+0x01);
|
||||
#ifdef RELOCATION
|
||||
newrelo($3.typ, RELO1);
|
||||
#endif
|
||||
emit1(lowb($3.val));
|
||||
}
|
||||
| addop '(' expr ')' ',' Y
|
||||
{ emit1($1+0x11);
|
||||
#ifdef RELOCATION
|
||||
newrelo($3.typ, RELO1);
|
||||
#endif
|
||||
emit1(lowb($3.val));
|
||||
}
|
||||
| ROLOP /* Default is A. */
|
||||
{ emit1($1+0x0A); }
|
||||
| ROLOP A
|
||||
{ emit1($1+0x0A); }
|
||||
| ROLOP expr
|
||||
{ code($2,$1+0x06,$1+0x0E); }
|
||||
| ROLOP expr ',' X
|
||||
{ code($2,$1+0x16,$1+0x1E); }
|
||||
| BRAOP expr
|
||||
{ branch($1,$2); }
|
||||
| CPXOP '#' expr
|
||||
{ emit1($1+0x00);
|
||||
#ifdef RELOCATION
|
||||
newrelo($3.typ, RELO1);
|
||||
#endif
|
||||
emit1($3);
|
||||
}
|
||||
| CPXOP expr
|
||||
{ code($2,$1+0x04,$1+0x0C); }
|
||||
| INCOP expr
|
||||
{ code($2,$1+0x06,$1+0x0E); }
|
||||
| INCOP expr ',' X
|
||||
{ code($2,$1+0x16,$1+0x1E); }
|
||||
;
|
||||
addop
|
||||
: ADDOP
|
||||
| PSEU
|
||||
{ emit1($1>>8); $$ = $1 & 0xFF; }
|
||||
;
|
||||
45
mach/6500/as/mach5.c
Normal file
45
mach/6500/as/mach5.c
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
*/
|
||||
#define RCSID5 "$Header$"
|
||||
|
||||
/*
|
||||
* Mostek 6500 special routines.
|
||||
*/
|
||||
|
||||
branch(opc, exp)
|
||||
register int opc;
|
||||
expr_t exp;
|
||||
{
|
||||
register int dist;
|
||||
|
||||
dist = exp.val - (DOTVAL + 2);
|
||||
if (pass == PASS_2 && dist > 0 && !(exp.typ & S_DOT))
|
||||
dist -= DOTGAIN;
|
||||
if (small(fitb(dist) && (exp.typ & ~S_DOT) == DOTTYP, 3)) {
|
||||
emit1(opc); emit1(dist);
|
||||
} else {
|
||||
emit1(opc^0x20); emit1(0x03); /* Skip over ... */
|
||||
emit1(0x4C); /* ... far jump. */
|
||||
#ifdef RELOCATION
|
||||
newrelo(exp.typ, RELO2);
|
||||
#endif
|
||||
emit2(exp.val);
|
||||
}
|
||||
}
|
||||
|
||||
code(exp, opc1, opc2)
|
||||
expr_t exp;
|
||||
register int opc1, opc2;
|
||||
{
|
||||
if (small((exp.typ & S_TYP) == S_ABS && fits_zeropage(exp.val), 1)) {
|
||||
emit1(opc1); emit1(exp.val);
|
||||
} else {
|
||||
emit1(opc2);
|
||||
#ifdef RELOCATION
|
||||
newrelo(exp.typ, RELO2);
|
||||
#endif
|
||||
emit2(exp.val);
|
||||
}
|
||||
}
|
||||
4
mach/6500/cg/.distr
Normal file
4
mach/6500/cg/.distr
Normal file
@@ -0,0 +1,4 @@
|
||||
Makefile
|
||||
mach.c
|
||||
mach.h
|
||||
table
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/* $Header$ */
|
||||
/*
|
||||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
*/
|
||||
con_part(sz,w) register sz; word w; {
|
||||
|
||||
while (part_size % sz)
|
||||
@@ -17,13 +22,11 @@ con_part(sz,w) register sz; word w; {
|
||||
}
|
||||
|
||||
con_mult(sz) word sz; {
|
||||
long l;
|
||||
long atol();
|
||||
|
||||
if (sz != 4)
|
||||
fatal("bad icon/ucon size");
|
||||
l = atol(str);
|
||||
fprintf(codefile,".short\t%d\n",(int) l);
|
||||
fprintf(codefile,".short\t%d\n",(int) (l >> 16));
|
||||
fprintf(codefile,".data4 %ld\n", atol(str));
|
||||
}
|
||||
|
||||
|
||||
@@ -76,8 +79,8 @@ mes(type) word type; {
|
||||
}
|
||||
|
||||
char *segname[] = {
|
||||
".text", /* SEGTXT */
|
||||
".data", /* SEGCON */
|
||||
".data", /* SEGROM */
|
||||
".bss" /* SEGBSS */
|
||||
".sect .text", /* SEGTXT */
|
||||
".sect .data", /* SEGCON */
|
||||
".sect .rom", /* SEGROM */
|
||||
".sect .bss" /* SEGBSS */
|
||||
};
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
/*
|
||||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
*/
|
||||
/* $Header$ */
|
||||
|
||||
#define ex_ap(y) fprintf(codefile,".extern %s\n",y)
|
||||
@@ -10,17 +14,18 @@
|
||||
|
||||
#define cst_fmt "%d"
|
||||
#define off_fmt "%d"
|
||||
#define ilb_fmt "I%03x%x"
|
||||
#define ilb_fmt "I%x_%x"
|
||||
#define dlb_fmt "_%d"
|
||||
#define hol_fmt "hol%d"
|
||||
|
||||
#define hol_off "%d+hol%d"
|
||||
#define hol_off "%ld+hol%d"
|
||||
|
||||
#define con_cst(x) fprintf(codefile,".word\t%d\n",x)
|
||||
#define con_ilb(x) fprintf(codefile,".word\t%s\n",x)
|
||||
#define con_dlb(x) fprintf(codefile,".word\t%s\n",x)
|
||||
#define con_cst(x) fprintf(codefile,".data2\t%ld\n",x)
|
||||
#define con_ilb(x) fprintf(codefile,".data2\t%s\n",x)
|
||||
#define con_dlb(x) fprintf(codefile,".data2\t%s\n",x)
|
||||
|
||||
#define modhead ""
|
||||
#define modhead ".sect .zero; .sect .text; .sect .rom; .sect .data; .sect .bss\n"
|
||||
|
||||
#define fmt_id(ft, fs) sprintf(fs,"_%s",ft)
|
||||
|
||||
#define id_first '_'
|
||||
#define BSS_INIT 0
|
||||
|
||||
@@ -1558,7 +1558,10 @@ cii | R16 |
|
||||
| | |
|
||||
cui | | | | cii |
|
||||
ciu | | | | cii |
|
||||
cuu | | | | asp 4 |
|
||||
cuu | | | | cii |
|
||||
loc loc cui $1==$2 | | | | |
|
||||
loc loc ciu $1==$2 | | | | |
|
||||
loc loc cuu $1==2 && $2==4 | | | | loc 0 |
|
||||
|
||||
|
||||
/* GROUP 9 - LOGICAL */
|
||||
|
||||
2
mach/6500/dl/.distr
Normal file
2
mach/6500/dl/.distr
Normal file
@@ -0,0 +1,2 @@
|
||||
Makefile
|
||||
dl.c
|
||||
@@ -1,7 +1,8 @@
|
||||
CFLAGS=-O
|
||||
EMHOME=../../..
|
||||
CFLAGS=-O -I$(EMHOME)/h
|
||||
|
||||
dl: dl.o
|
||||
cc -o dl -n dl.o
|
||||
cc -o dl -n dl.o $(EMHOME)/modules/lib/libobject.a
|
||||
|
||||
install: dl
|
||||
../../install dl
|
||||
|
||||
@@ -1,25 +1,13 @@
|
||||
/* $Header$ */
|
||||
/*
|
||||
* (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
*
|
||||
* This product is part of the Amsterdam Compiler Kit.
|
||||
*
|
||||
* Permission to use, sell, duplicate or disclose this software must be
|
||||
* obtained in writing. Requests for such permissions may be sent to
|
||||
*
|
||||
* Dr. Andrew S. Tanenbaum
|
||||
* Wiskundig Seminarium
|
||||
* Vrije Universiteit
|
||||
* Postbox 7161
|
||||
* 1007 MC Amsterdam
|
||||
* The Netherlands
|
||||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sgtty.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
struct sgttyb tty;
|
||||
#include <out.h>
|
||||
|
||||
#define DATTYPE 0
|
||||
#define EOFTYPE 1
|
||||
@@ -38,38 +26,63 @@ char *progname;
|
||||
|
||||
char hex[] = "0123456789ABCDEF";
|
||||
|
||||
struct outhead ohead;
|
||||
struct outsect sect[MAXSECT];
|
||||
|
||||
main(argc,argv) char **argv; {
|
||||
register nd,pc,sg,osg,first;
|
||||
int i,nd,pc,first;
|
||||
register char *s;
|
||||
|
||||
|
||||
progname = argv[0];
|
||||
if (argc > 3)
|
||||
fatal("usage: %s [object [tty]]\n",argv[0]);
|
||||
s = "a.out";
|
||||
if (argc >= 2)
|
||||
s = argv[1];
|
||||
if (freopen(s,"r",stdin) == NULL)
|
||||
fatal("can't open %s",s);
|
||||
if (! rd_open(s)) {
|
||||
fprintf(stderr,"%s: can't open %s\n",progname,s);
|
||||
exit(-1);
|
||||
}
|
||||
rd_ohead(&ohead);
|
||||
if (ohead.oh_flags & HF_LINK) {
|
||||
fprintf(stderr,"%s: %s contains unresolved references\n",progname,s);
|
||||
exit(-1);
|
||||
}
|
||||
rd_sect(sect, ohead.oh_nsect);
|
||||
ttyfd = 1;
|
||||
first = 1; osg = 0;
|
||||
for (;;) {
|
||||
pc = get2c(stdin);
|
||||
if (feof(stdin))
|
||||
break;
|
||||
sg = get2c(stdin);
|
||||
nd = get2c(stdin);
|
||||
if (first) {
|
||||
first = 0;
|
||||
first = 1;
|
||||
for (i = 0; i < ohead.oh_nsect; i++) {
|
||||
rd_outsect(i);
|
||||
pc = sect[i].os_base;
|
||||
while (sect[i].os_size) {
|
||||
unsigned int sz = 8096, fl;
|
||||
extern char *calloc();
|
||||
register char *buf;
|
||||
char *pbuf;
|
||||
|
||||
if (sz > sect[i].os_size) sz = sect[i].os_size;
|
||||
sect[i].os_size -= sz;
|
||||
pbuf = buf = calloc(sz, 1);
|
||||
if (fl = sect[i].os_flen) {
|
||||
if (fl > sz) fl = sz;
|
||||
sect[i].os_flen -= fl;
|
||||
|
||||
rd_emit(buf, (long) fl);
|
||||
}
|
||||
while (sz >= MAXBYTE) {
|
||||
data(MAXBYTE, (int) pc, buf);
|
||||
sz -= MAXBYTE;
|
||||
buf += MAXBYTE;
|
||||
pc += MAXBYTE;
|
||||
first = 0;
|
||||
}
|
||||
if (sz > 0) {
|
||||
data(sz, (int) pc, buf);
|
||||
first = 0;
|
||||
}
|
||||
free(pbuf);
|
||||
}
|
||||
assert(sg == osg);
|
||||
while (nd > MAXBYTE) {
|
||||
data(MAXBYTE,pc);
|
||||
nd -= MAXBYTE;
|
||||
pc += MAXBYTE;
|
||||
}
|
||||
if (nd > 0)
|
||||
data(nd,pc);
|
||||
assert(feof(stdin) == 0);
|
||||
}
|
||||
if (first == 0)
|
||||
eof();
|
||||
@@ -78,11 +91,13 @@ main(argc,argv) char **argv; {
|
||||
reply();
|
||||
}
|
||||
|
||||
data(nd,pc) {
|
||||
data(nd,pc, buf)
|
||||
register char *buf;
|
||||
{
|
||||
|
||||
newline(nd,pc,DATTYPE);
|
||||
do
|
||||
byte(getc(stdin));
|
||||
byte(*buf++);
|
||||
while (--nd);
|
||||
endline();
|
||||
}
|
||||
@@ -132,14 +147,16 @@ b &= 0377;
|
||||
put(hex[b & 017]);
|
||||
}
|
||||
|
||||
put(c) {
|
||||
put(c)
|
||||
char c;
|
||||
{
|
||||
|
||||
write(ttyfd,&c,1);
|
||||
}
|
||||
|
||||
reply() {
|
||||
register i;
|
||||
int c;
|
||||
char c;
|
||||
|
||||
if (echo == 0)
|
||||
return;
|
||||
@@ -148,13 +165,6 @@ reply() {
|
||||
write(1,&c,1);
|
||||
}
|
||||
|
||||
get2c(f) FILE *f; {
|
||||
register c;
|
||||
|
||||
c = getc(f);
|
||||
return((getc(f) << 8) | c);
|
||||
}
|
||||
|
||||
fatal(s,a) {
|
||||
|
||||
fprintf(stderr,"%s: ",progname);
|
||||
@@ -162,3 +172,5 @@ fatal(s,a) {
|
||||
fprintf(stderr,"\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
rd_fatal() { fatal("read error"); }
|
||||
|
||||
2
mach/6500/libbc/.distr
Normal file
2
mach/6500/libbc/.distr
Normal file
@@ -0,0 +1,2 @@
|
||||
Makefile
|
||||
compmodule
|
||||
@@ -1,5 +1,6 @@
|
||||
SUF=s
|
||||
MAKEFILE=../../proto/libg/Makefile
|
||||
MACHDEF="MACH=6500" "SUF=s"
|
||||
MACHDEF="MACH=6500" "SUF=$(SUF)"
|
||||
BCDEF="PREF=bc" "SUB=" "SRC=lang/basic/lib"
|
||||
|
||||
install:
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
${MACH?} -I../../../h ${MACHFL?} $1 1>&2
|
||||
echo `basename $1 $2`.s
|
||||
if ${MACH?} -I../../../h ${MACHFL?} $1 1>&2
|
||||
then echo `basename $1 $2`.s
|
||||
else exit 1
|
||||
fi
|
||||
|
||||
2
mach/6500/libcc/.distr
Normal file
2
mach/6500/libcc/.distr
Normal file
@@ -0,0 +1,2 @@
|
||||
Makefile
|
||||
compmodule
|
||||
@@ -1,5 +1,6 @@
|
||||
SUF=s
|
||||
MAKEFILE=../../proto/libg/Makefile
|
||||
MACHDEF="MACH=6500" "SUF=s"
|
||||
MACHDEF="MACH=6500" "SUF=$(SUF)"
|
||||
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"
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
${MACH?} -I../../../h ${MACHFL?} $1 1>&2
|
||||
echo `basename $1 $2`.s
|
||||
if ${MACH?} -I../../../h ${MACHFL?} $1 1>&2
|
||||
then echo `basename $1 $2`.s
|
||||
else exit 1
|
||||
fi
|
||||
|
||||
5
mach/6500/libem/.distr
Normal file
5
mach/6500/libem/.distr
Normal file
@@ -0,0 +1,5 @@
|
||||
LIST
|
||||
Makefile
|
||||
end.s
|
||||
head_em.s
|
||||
libem_s.a
|
||||
@@ -1,4 +1,4 @@
|
||||
tail_em.s.a
|
||||
libem_s.a
|
||||
adi.s
|
||||
adi4.s
|
||||
and.s
|
||||
|
||||
@@ -1,23 +1,21 @@
|
||||
install: tail_em.s.a tail_em.ve.s.a
|
||||
all:
|
||||
|
||||
install:
|
||||
../../install head_em.s head_em
|
||||
../../install tail_em.s.a tail_em
|
||||
../../install tail_em.ve.s.a tail_em.vend
|
||||
../../install libem_s.a tail_em
|
||||
../../install end.s end_em
|
||||
|
||||
cmp: tail_em.s.a tail_em.ve.s.a
|
||||
cmp:
|
||||
-../../compare head_em.s head_em
|
||||
-../../compare tail_em.s.a tail_em
|
||||
-../../compare tail_em.ve.s.a tail_em.vend
|
||||
|
||||
distr: tail_em.ve.s.a
|
||||
|
||||
tail_em.s.a:
|
||||
arch cr `cat LIST`
|
||||
|
||||
tail_em.ve.s.a:
|
||||
arch cr tail_em.ve.s.a end.s
|
||||
-../../compare libem_s.a tail_em
|
||||
-../../compare end.s end_em
|
||||
|
||||
opr:
|
||||
make pr | opr
|
||||
|
||||
pr:
|
||||
@pr `pwd`/Makefile `pwd`/head_em.s
|
||||
@pr -l33 `tail +1 LIST|sort` `pwd`/end.s
|
||||
@pr `pwd`/head_em.s
|
||||
@arch pv libem_s.a | pr -h `pwd`/libem_s.a
|
||||
@pr `pwd`/end.s
|
||||
|
||||
clean:
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Aar
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine gets the address of the array element
|
||||
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Addsub
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine is used by the fourbyte addition and subtraction
|
||||
! routines.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Adi2
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine adds two twobyte integers.
|
||||
! The first operand is on the top of the stack, the second operand
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Adi4
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine adds two fourbyte integers, which are on the stack.
|
||||
! The addresses are initiated by the subroutine Addsub.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define And
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine performs the logical and on two groups of
|
||||
! atmost 254 bytes. The number of bytes is in register Y.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Asp
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine adds an offset to the stackpointer,
|
||||
! e.g. after the return from a procedurecall.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Blm, Blmnp
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine copies bytes from one place in memory to
|
||||
! another. The source address is in registerpair AX and is stored
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Cii
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine converts integers to integers.
|
||||
! Convertions of integers with the same source size as destination
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Cmi
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine compares on two integers.
|
||||
! If T is pushed first and than S, the routine will return:
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Cmi4
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine compares on fourbyte integers.
|
||||
! If T is pushed first and than S, the routine will return:
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Cms
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine compares two groups of bytes, bit for bit.
|
||||
! The groups can consist of 2 or 4 bytes. This number is in
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Cmu2
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine compares two unsigned twobyte integers.
|
||||
! If T is the first pushed and than S, the routine will return:
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Cmu4
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine compares two unsigned fourbyte integers.
|
||||
! If T is first pushed and than S the routine will return:
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Com
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine performs a one complement on
|
||||
! a group of atmost 254 bytes (number in register Y).
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Csa
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine performs the case jump by indexing.
|
||||
! The zeropage locations ADDR, ADDR+1 contain the address of
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Csb
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine performs the case jump by searching the table.
|
||||
! The zeropage locations ADDR, ADDR+1 contain the address of the
|
||||
|
||||
@@ -2,12 +2,17 @@
|
||||
.define ECONV,ESTACK
|
||||
.define EHEAP,EODDZ,ECASE
|
||||
.define EBADMON,EBADLIN,EBADGTO
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This file contains the global data used by the trap routine.
|
||||
|
||||
|
||||
! DATA
|
||||
.data
|
||||
.sect .data
|
||||
EARRAY:
|
||||
.asciz "Array bound error\n\r"
|
||||
ERANGE:
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Div4
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine performs a signed divide on two fourbyte integers.
|
||||
! For more detail see dvi.s
|
||||
|
||||
@@ -23,6 +23,11 @@
|
||||
.define Cfu
|
||||
.define Lfr8
|
||||
.define Ret8
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! Dummy floating point package for 6500
|
||||
! every EM floating point instruction results in an
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Dup
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine duplicate's the top n (in register Y) bytes.
|
||||
! N is atmost 256.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Duv4
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine performs an unsigned division on two fourbyte
|
||||
! unsigned integers.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Dvi2, Div, Duv
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! The subroutine Dvi2 performs a signed division.
|
||||
! Its operands are on the stack.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Dvi4
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine performs a fourbyte signed division.
|
||||
! For more details see dvi.s
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Dvu2
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine performs a twobyte unsigned division
|
||||
! For more details see dvi.s.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Dvu4
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine performs an unsigned division on fourbyte
|
||||
! integers. For more details see dvi.s
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
.define endtext, enddata, endbss, end
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
.text
|
||||
.sect .text
|
||||
endtext:
|
||||
.align 2
|
||||
.data
|
||||
.sect .data
|
||||
.align 2
|
||||
enddata:
|
||||
.bss
|
||||
.sect .bss
|
||||
.align 2
|
||||
endbss:
|
||||
end:
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Exg
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine exchanges two groups of bytes on the top of the
|
||||
! stack. The groups may consist of atmost 255 bytes.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Exg2
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine exchanges two words on top of the stack.
|
||||
! The top word of the stack is really in the AX registerpair.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Gto
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine performs the non_local goto.
|
||||
! The address of the descriptor is stored in zeropage locations
|
||||
|
||||
@@ -9,6 +9,12 @@
|
||||
.define RETSIZE, TRAPVAL, STACK, BRANCH
|
||||
.define start, Push, Pop, STACKTh, STACKTl
|
||||
.define F_DUM
|
||||
.sect .zero
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! DEFINITIONS
|
||||
|
||||
@@ -51,7 +57,7 @@ STACKTl = 0D0h
|
||||
|
||||
! Some zeropage declarations
|
||||
|
||||
.zero
|
||||
.sect .zero
|
||||
|
||||
RES: .space 76 ! special for the operating system
|
||||
|
||||
@@ -97,8 +103,8 @@ STACK: .space 1 ! contains the hardware stackpointer on
|
||||
|
||||
RESERVED: .space 112 ! used by the operating system
|
||||
|
||||
.sect .text
|
||||
.base 0E02h ! where to start in the BBC micro
|
||||
.text
|
||||
! GENERAL PURPOSE ROUTINES
|
||||
|
||||
start:
|
||||
@@ -220,8 +226,8 @@ Pop:
|
||||
rts
|
||||
|
||||
|
||||
.data
|
||||
.sect .data
|
||||
PROGNAME: ! for initialising the programname pointer
|
||||
.asciz "program"
|
||||
.bss
|
||||
.sect .bss
|
||||
beginbss:
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Indir
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine performs an indirect procedurecall.
|
||||
! This must be done this way since the jump instruction
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Inn
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine checks if a certain bit is set in a set
|
||||
! of n bytes on top of the stack.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Ior
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine performs the logical inclusive or on two
|
||||
! groups of bytes. The groups may consist of atmost 254 bytes.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Lar
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine performs the LAR instruction.
|
||||
! For details see rapport IR-81.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Lcs
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine creates space for locals on procedure entry
|
||||
! by lowering the stackpointer.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Ldi, Ldo
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! The subroutine Ldi pushes a four byte object onto the stack.
|
||||
! The address is in registerpair AX.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Locaddr
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This routine gets the address of a local which offset is to big.
|
||||
! The offset is in registerpair AX.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Loi, Lext
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
! This subroutine performs an indirect load on a word of two bytes.
|
||||
! Lext is used when the address is already in zeropage.
|
||||
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Loi1
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This routine loads a one byte object in registerpair AX.
|
||||
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Loil
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine pushes an object of size greater than four bytes
|
||||
! onto the stack.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Lol
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine loads a local in registerpair AX which
|
||||
! offset from the localbase is to big.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Los
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine perfoms the LOS instruction.
|
||||
! For detail see rapport IR-81.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Lxa1
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine loads the address of AB zero static levels back.
|
||||
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Lxa2
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine load the address of AB n (255 >= n > 0) static levels
|
||||
! back.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Lxl
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine loads LB n (255 => n > 0) static levels back.
|
||||
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Mli2, Mlinp, Mul
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! The subroutine Mli2 multiplies two signed integers. The integers
|
||||
! are popped from the stack.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Mli4
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine multiplies two signed fourbyte integers
|
||||
! For more detail see mli.s
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Mlu2
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine multiplies two unsigned fourbyte intergers.
|
||||
! For more details see mli.s
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Mlu4
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine multiplies two fourbyte unsigned integers.
|
||||
! For more details see mli.s
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Mon
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine performs some monitor calls.
|
||||
! The exit call just resets the hardware_stackpointer so
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Mul4
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine multiplies two fourbyte signed integers.
|
||||
! For more details see mli.s
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Ngi2
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine negates the integer in registerpair AX.
|
||||
! The negation is a one's complement plus one.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Ngi4
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine takes a fourbyte interger and negates it.
|
||||
! For more details see ngi2.s
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Mprint
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine prints a zero terminated ascii string.
|
||||
! The registerpair AX contains the start of the string.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Printhex
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine print the contents of register A to the screen
|
||||
! in hexadecimal form.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Printstack
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This a special subroutine which prints some things to the
|
||||
! monitorscreen for debugging.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Pro
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This routine is called at the entry of a procedure.
|
||||
! It saves the localbase of the invoking procedure, and sets the
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Mread
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine reads characters from the standard input.
|
||||
! It ignores the filedes.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Ret
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine stores the returnvalue in the return area.
|
||||
! This area is in zeropage.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Rmi2
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine returns the remainder of a twobyte signed division.
|
||||
! The sign of the result is as specified in the emtest.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Rmi4
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine returns the remainder of a fourbyte division.
|
||||
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Rmu2
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine returns the remainder of an twobyte unsigned
|
||||
! integer division.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Rmu4
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine returns the remainder of a fourbyte unsigned
|
||||
! division.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Rol
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine rotates left an integer n times
|
||||
! N is in register X.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Rol4
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine rotates left a fourbyte integer n times.
|
||||
! N is in register X.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Ror
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine rotates right a integer twobyte word.
|
||||
! The number of rotates is in X.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Ror4
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine rotates right a fourbyte word.
|
||||
! The number of rotates is in X.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Rtt
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine performs the return from trap.
|
||||
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Sar
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine performs the SAR instruction.
|
||||
! For details see rapport IR-81.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Sbi2
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine subtracts two twobyte signed integers
|
||||
! and returnes the result in registerpair AX.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
.define Sbi4
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
! This subroutine subtracts two fourbyte signed integers.
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user