Archival checkin (semi-working code).

This commit is contained in:
dtrg
2007-11-02 18:56:58 +00:00
715 changed files with 49646 additions and 110 deletions

67
mach/6500/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)
CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
$(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
COBJ = comm3.o comm4.o comm5.o \
comm6.o comm7.o comm8.o
MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
all: as
install:all
../../install as
cmp:
-../../compare as
clean:
rm -f *.o as as.[cy] y.tab.h
pr: $(MACH)
@pr -n $(MACH)
opr:
make pr | opr
as: $(COBJ) as.o
$(CC) $(LDFLAGS) $(COBJ) as.o $(LIBOBJ) -o as
as.y: $(CDIR)/comm2.y
$(CPP) -P -I. -I$h $(DEF) $(CDIR)/comm2.y >as.y
-@if test -f Expect ; then cat Expect ; else echo "expect 1 shift/reduce conflict"; fi
lint: $(CSRC) as.c
lint $(INCL) $(CSRC) as.c
y.tab.h: as.c
$(COBJ): y.tab.h
$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
as.y: mach2.c
comm3.o: mach3.c
as.y: mach4.c
comm8.o: mach5.c
comm3.o: $(CDIR)/comm3.c
$(CC) -c $(CFLAGS) $(CDIR)/comm3.c
comm4.o: $(CDIR)/comm4.c
$(CC) -c $(CFLAGS) $(CDIR)/comm4.c
comm5.o: $(CDIR)/comm5.c
$(CC) -c $(CFLAGS) $(CDIR)/comm5.c
comm6.o: $(CDIR)/comm6.c
$(CC) -c $(CFLAGS) $(CDIR)/comm6.c
comm7.o: $(CDIR)/comm7.c
$(CC) -c $(CFLAGS) $(CDIR)/comm7.c
comm8.o: $(CDIR)/comm8.c
$(CC) -c $(CFLAGS) $(CDIR)/comm8.c

184
mach/6500/cg/Makefile Normal file
View File

@@ -0,0 +1,184 @@
# $Header$
EMHOME=../../..
PREFLAGS=-I$(EMHOME)/h -I. -I$(EMHOME)/mach -I$(EMHOME)/modules/h -DNDEBUG
PFLAGS=
CFLAGS=$(PREFLAGS) $(PFLAGS) -O
LDFLAGS=$(PFLAGS)
LINTOPTS=-hbxac
LIBS=$(EMHOME)/lib/em_data.a $(EMHOME)/modules/lib/libflt.a
CDIR=$(EMHOME)/mach/proto/cg
CFILES=$(CDIR)/codegen.c $(CDIR)/compute.c $(CDIR)/equiv.c $(CDIR)/fillem.c \
$(CDIR)/gencode.c $(CDIR)/glosym.c $(CDIR)/main.c $(CDIR)/move.c \
$(CDIR)/nextem.c $(CDIR)/reg.c $(CDIR)/regvar.c $(CDIR)/salloc.c \
$(CDIR)/state.c $(CDIR)/subr.c $(CDIR)/var.c
OFILES=codegen.o compute.o equiv.o fillem.o gencode.o glosym.o main.o\
move.o nextem.o reg.o regvar.o salloc.o state.o subr.o var.o
all: tables.c
make "EMHOME="$(EMHOME) cg
cg: tables.o $(OFILES)
$(CC) $(LDFLAGS) $(OFILES) tables.o $(LIBS) -o cg
tables.o: tables.c
$(CC) -c $(PREFLAGS) -I$(CDIR) tables.c
codegen.o: $(CDIR)/codegen.c
$(CC) -c $(CFLAGS) $(CDIR)/codegen.c
compute.o: $(CDIR)/compute.c
$(CC) -c $(CFLAGS) $(CDIR)/compute.c
equiv.o: $(CDIR)/equiv.c
$(CC) -c $(CFLAGS) $(CDIR)/equiv.c
fillem.o: $(CDIR)/fillem.c
$(CC) -c $(CFLAGS) $(CDIR)/fillem.c
gencode.o: $(CDIR)/gencode.c
$(CC) -c $(CFLAGS) $(CDIR)/gencode.c
glosym.o: $(CDIR)/glosym.c
$(CC) -c $(CFLAGS) $(CDIR)/glosym.c
main.o: $(CDIR)/main.c
$(CC) -c $(CFLAGS) $(CDIR)/main.c
move.o: $(CDIR)/move.c
$(CC) -c $(CFLAGS) $(CDIR)/move.c
nextem.o: $(CDIR)/nextem.c
$(CC) -c $(CFLAGS) $(CDIR)/nextem.c
reg.o: $(CDIR)/reg.c
$(CC) -c $(CFLAGS) $(CDIR)/reg.c
regvar.o: $(CDIR)/regvar.c
$(CC) -c $(CFLAGS) $(CDIR)/regvar.c
salloc.o: $(CDIR)/salloc.c
$(CC) -c $(CFLAGS) $(CDIR)/salloc.c
state.o: $(CDIR)/state.c
$(CC) -c $(CFLAGS) $(CDIR)/state.c
subr.o: $(CDIR)/subr.c
$(CC) -c $(CFLAGS) $(CDIR)/subr.c
var.o: $(CDIR)/var.c
$(CC) -c $(CFLAGS) $(CDIR)/var.c
install: all
../../install cg
cmp: all
-../../compare cg
distr: tables.c
rm -f tables1.[ch]
cp tables.c tables1.c
cp tables.h tables1.h
chmod -w tables1.[ch]
tables.c: table
-mv tables.h tables.h.save
$(EMHOME)/lib/cpp -P table | $(EMHOME)/lib/cgg > debug.out
-if cmp -s tables.h.save tables.h; then mv tables.h.save tables.h; else exit 0; fi
-if cmp -s /dev/null tables.h; then mv tables.h.save tables.h; else exit 0; fi
lint: $(CFILES)
lint $(LINTOPTS) $(PREFLAGS) $(CFILES)
clean:
rm -f *.o tables.c tables.h debug.out cg tables.h.save
codegen.o: $(CDIR)/assert.h
codegen.o: $(CDIR)/data.h
codegen.o: $(CDIR)/equiv.h
codegen.o: $(CDIR)/extern.h
codegen.o: $(CDIR)/param.h
codegen.o: $(CDIR)/result.h
codegen.o: $(CDIR)/state.h
codegen.o: tables.h
codegen.o: $(CDIR)/types.h
compute.o: $(CDIR)/assert.h
compute.o: $(CDIR)/data.h
compute.o: $(CDIR)/extern.h
compute.o: $(CDIR)/glosym.h
compute.o: $(CDIR)/param.h
compute.o: $(CDIR)/result.h
compute.o: tables.h
compute.o: $(CDIR)/types.h
equiv.o: $(CDIR)/assert.h
equiv.o: $(CDIR)/data.h
equiv.o: $(CDIR)/equiv.h
equiv.o: $(CDIR)/extern.h
equiv.o: $(CDIR)/param.h
equiv.o: $(CDIR)/result.h
equiv.o: tables.h
equiv.o: $(CDIR)/types.h
fillem.o: $(CDIR)/assert.h
fillem.o: $(CDIR)/data.h
fillem.o: $(CDIR)/extern.h
fillem.o: mach.c
fillem.o: mach.h
fillem.o: $(CDIR)/param.h
fillem.o: $(CDIR)/regvar.h
fillem.o: $(CDIR)/result.h
fillem.o: tables.h
fillem.o: $(CDIR)/types.h
gencode.o: $(CDIR)/assert.h
gencode.o: $(CDIR)/data.h
gencode.o: $(CDIR)/extern.h
gencode.o: $(CDIR)/param.h
gencode.o: $(CDIR)/result.h
gencode.o: tables.h
gencode.o: $(CDIR)/types.h
glosym.o: $(CDIR)/glosym.h
glosym.o: $(CDIR)/param.h
glosym.o: tables.h
glosym.o: $(CDIR)/types.h
main.o: $(CDIR)/param.h
move.o: $(CDIR)/assert.h
move.o: $(CDIR)/data.h
move.o: $(CDIR)/extern.h
move.o: $(CDIR)/param.h
move.o: $(CDIR)/result.h
move.o: tables.h
move.o: $(CDIR)/types.h
nextem.o: $(CDIR)/assert.h
nextem.o: $(CDIR)/data.h
nextem.o: $(CDIR)/extern.h
nextem.o: $(CDIR)/param.h
nextem.o: $(CDIR)/result.h
nextem.o: tables.h
nextem.o: $(CDIR)/types.h
reg.o: $(CDIR)/assert.h
reg.o: $(CDIR)/data.h
reg.o: $(CDIR)/extern.h
reg.o: $(CDIR)/param.h
reg.o: $(CDIR)/result.h
reg.o: tables.h
reg.o: $(CDIR)/types.h
regvar.o: $(CDIR)/assert.h
regvar.o: $(CDIR)/data.h
regvar.o: $(CDIR)/extern.h
regvar.o: $(CDIR)/param.h
regvar.o: $(CDIR)/regvar.h
regvar.o: $(CDIR)/result.h
regvar.o: tables.h
regvar.o: $(CDIR)/types.h
salloc.o: $(CDIR)/assert.h
salloc.o: $(CDIR)/data.h
salloc.o: $(CDIR)/extern.h
salloc.o: $(CDIR)/param.h
salloc.o: $(CDIR)/result.h
salloc.o: tables.h
salloc.o: $(CDIR)/types.h
state.o: $(CDIR)/assert.h
state.o: $(CDIR)/data.h
state.o: $(CDIR)/extern.h
state.o: $(CDIR)/param.h
state.o: $(CDIR)/result.h
state.o: $(CDIR)/state.h
state.o: tables.h
state.o: $(CDIR)/types.h
subr.o: $(CDIR)/assert.h
subr.o: $(CDIR)/data.h
subr.o: $(CDIR)/extern.h
subr.o: $(CDIR)/param.h
subr.o: $(CDIR)/result.h
subr.o: tables.h
subr.o: $(CDIR)/types.h
var.o: $(CDIR)/data.h
var.o: $(CDIR)/param.h
var.o: $(CDIR)/result.h
var.o: tables.h
var.o: $(CDIR)/types.h

20
mach/6500/dl/Makefile Normal file
View File

@@ -0,0 +1,20 @@
EMHOME=../../..
CFLAGS=-O -I$(EMHOME)/h
dl: dl.o
$(CC) -o dl dl.o $(EMHOME)/modules/lib/libobject.a
install: dl
../../install dl
cmp: dl
-../../compare dl
opr:
make pr | opr
pr:
@pr `pwd`/dl.c
clean:
-rm -f *.o *.old dl

21
mach/6500/libem/Makefile Normal file
View File

@@ -0,0 +1,21 @@
all:
install:
../../install head_em.s head_em
../../install libem_s.a tail_em
../../install end.s end_em
cmp:
-../../compare head_em.s head_em
-../../compare libem_s.a tail_em
-../../compare end.s end_em
opr:
make pr | opr
pr:
@pr `pwd`/head_em.s
@arch pv libem_s.a | pr -h `pwd`/libem_s.a
@pr `pwd`/end.s
clean:

17
mach/6500/libem/end.s Normal file
View File

@@ -0,0 +1,17 @@
.define endtext, enddata, endbss, end
.sect .text
.sect .rom
.sect .data
.sect .bss
.sect .text
.sect .text
endtext:
.align 2
.sect .data
.align 2
enddata:
.sect .bss
.align 2
endbss:
end:

233
mach/6500/libem/head_em.s Normal file
View File

@@ -0,0 +1,233 @@
.define WRCH, RDCH, Earray, Erange, Eset
.define Eiovfl, Eidivz, Eiund, Econv
.define Estack, Eheap, Eillins, Eoddz
.define Ecase , Ebadmon, OSBYTE, MON
.define Ebadlin, Ebadgto, BASE, NBYTES
.define hol0, IGNMASK, ADDR, PROGNAME
.define LB, LBl, SP, HP, ERRPROC, UNSIGN
.define Ytmp, EXG, ARTH, RETURN, SIGN
.define RETSIZE, TRAPVAL, STACK, BRANCH
.define start, Push, Pop, STACKTh, STACKTl
.define F_DUM
.sect .zero
.sect .text
.sect .rom
.sect .data
.sect .bss
.sect .text
! DEFINITIONS
! The next three definitions are special for the
! BBC microcomputer
WRCH = 0x0FFEE ! This subroutine writes the character in
! register A to the screen
RDCH = 0x0FFE0 ! This subroutine returns a character in
! register A from the current input stream
OSBYTE = 0x0FFF4 ! This subroutine performs miscelaneous
! operating system calls
F_DUM = 0 ! Dummy floating point constant
! Here are the error numbers
Earray = 0
Erange = 1
Eset = 2
Eiovfl = 3
Eidivz = 6
Eiund = 8
Econv = 10
Estack = 16
Eheap = 17
Eillins = 18
Eoddz = 19
Ecase = 20
Ebadmon = 25
Ebadlin = 26
Ebadgto = 27
MON = 0x78D0
BASE = 240 ! This is the offset from the localbase
! for the second localbase
STACKTh = 0x78 ! This is the top of the stack
STACKTl = 0x0D0
! Some zeropage declarations
.sect .zero
RES: .space 76 ! special for the operating system
hol0: .space 16 ! the hol0 block
IGNMASK: .space 2 ! can hold the ingnore mask
ADDR: .space 4 ! used for indirect addressing
LB: .space 2 ! the localbase
LBl: .space 2 ! the second localbase (localbase-BASE)
SP: .space 3 ! the stackpointer (real_stack)
HP: .space 2 ! the heap pointer
BRANCH: .space 2 ! used for branch instructions
ERRPROC: .space 2 ! can hold the address of the error handler
Ytmp: .space 1 ! used for intermediate storage in Y
EXG: .space 2 ! used by the exchange subroutine Exg
ARTH: .space 16 ! used for arithmetic
NBYTES: .space 2 ! containes the number of bytes for a block move
RETURN: .space 4 ! the return area
RETSIZE: .space 1 ! the size of the object returned
SIGN: .space 1 ! the sign of the calculation
UNSIGN : .space 1 ! is it signed or unsigned arithmetic
TRAPVAL: .space 1 ! intermediate storage of the error number
STACK: .space 1 ! contains the hardware stackpointer on
! entering _m_a_i_n for a neat return
RESERVED: .space 112 ! used by the operating system
.sect .text
.base 0x0E02 ! where to start in the BBC micro
! GENERAL PURPOSE ROUTINES
start:
tsx
stx STACK ! save stackpointer for exit and error
! The following three operating system calls are only
! for the BBC microcomputer
lda #2
ldx #0
ldy #0
jsr OSBYTE ! return control to the keyboard
lda #15
ldx #0
ldy #0
jsr OSBYTE ! clear all internal buffers
lda #3
ldx #5
ldy #0
jsr OSBYTE ! output to screen and RS423
lda #STACKTl
sta LB ! set localbase (lowbyte)
sta SP+2
lda #0
sta SP ! set stackpointer (lowbyte)
sta ERRPROC ! set start address for error handler (lowbyte)
sta ERRPROC+1 ! set start address for error handler (highbyte)
sta hol0 ! set the line number (lowbyte)
sta hol0+1 ! set the line number (highbyte)
lda #STACKTh
sta SP+1 ! set the stacpointer (highbyte)
sta LB+1 ! set the localbase (highbyte)
lda #[endbss].l
sta HP ! set the heap pointer (lowbyte)
lda #[endbss].h
sta HP+1 ! set the heap pointer (highbyte)
lda #[PROGNAME].l
sta hol0+4 ! set fake programname pointer (lowbyte)
lda #[PROGNAME].h
sta hol0+5 ! set fake programname pointer (highbyte)
lda #[beginbss].l
sta ADDR ! start address of bss block (lowbyte)
lda #[beginbss].h
sta ADDR+1 ! start address of bss block (highbyte)
ldy #0
lda #0
4: ldx #[endbss].h ! clear bss block
cpx ADDR+1
bcc 1f ! end of bss block reached
bne 2f
ldx #[endbss].l
cpx ADDR
bcc 1f ! end of bss block reached
2: sta (ADDR),y
inc ADDR
bne 3f
inc ADDR+1
3: jmp 4b
1: lda #0
tax
jsr Push ! push fake envelope pointer
lda #[PROGNAME].h
ldx #[PROGNAME].l
jsr Push ! push argv[0]
lda #0
ldx #1
jsr Push ! push argc
jsr __m_a_i_n ! start the real program
lda #0x0FF
jsr WRCH ! send end of program to R423
lda #3
ldx #0
jsr OSBYTE ! send output to screen only
lda #2
ldx #1
jsr OSBYTE ! input only from R423
rts
! The subroutine Push pushes the registerpair AX onto the stack.
Push:
sty Ytmp ! save Y
ldy SP+2
bne 1f ! lowbyte of stackpointer <> 0
dec SP+1 ! decrement highbyte of stackpointer
1: dey
dey ! decrement lowbyte of stackpointer
sty SP+2 ! save lowbyte of stackpointer
pha ! save A
txa
sta (SP),y ! push X onto the stack
iny
pla ! get A
sta (SP),y ! push A onto the stack
ldy Ytmp ! restore Y
rts
! The subroutine Pop pops the registerpair AX from the stack.
Pop:
sty Ytmp ! save Y
ldy SP+2
lda (SP),y ! pop X from the stack
tax
iny
lda (SP),y ! pop A from the stack
iny
bne 1f ! lowbyte of stackpointer <> 0
inc SP+1 ! increment highbyte of stackpointer
1: sty SP+2 ! store lowbyte of stackpointer
pha ! save A
pla ! get A
ldy Ytmp ! restore Y
rts
.sect .data
PROGNAME: ! for initialising the programname pointer
.asciz "program"
.sect .bss
beginbss:

40
mach/6500/libem/mon.s Normal file
View File

@@ -0,0 +1,40 @@
.define Mon
.sect .text
.sect .rom
.sect .data
.sect .bss
.sect .text
! This subroutine performs some monitor calls.
! The exit call just resets the hardware_stackpointer so
! this routine will return to the operating system.
! The close call just returns a zero.
! The ioctl call just pops its arguments and returns a zero.
! The write routine is a real one.
Mon:
cpx #1
bne 1f ! exit
ldx STACK ! load stackpointer
dex
dex ! adjust stackpointer
txs ! set stackpointer
rts
1: cpx #4
bne 1f
jmp Mwrite
1: cpx #6 ! facked
bne 1f ! close
lda #0
tax ! return zero
rts
1: cpx #54
jsr Pop ! pop first argument (fildes)
jsr Pop ! pop second argument (request)
jsr Pop ! pop third argument (argp)
lda #0
tax ! return zero
rts

27
mach/6500/libem/print.s Normal file
View File

@@ -0,0 +1,27 @@
.define Mprint
.sect .text
.sect .rom
.sect .data
.sect .bss
.sect .text
! This subroutine prints a zero terminated ascii string.
! The registerpair AX contains the start of the string.
! The subroutine WRCH is a special routine on the BBC microcomputer
! which prints the character in A to the screen.
! The subroutine WRCH is a special one provided by the BBC
! microcomputer.
Mprint:
stx ADDR ! start address of string (lowbyte)
sta ADDR+1 ! start address of string (highbyte)
ldy #0
1: lda (ADDR),y ! get ascii character
beq 2f
jsr WRCH ! put it on the screen
iny
bne 1b
2: rts

View File

@@ -0,0 +1,32 @@
.define Printhex
.sect .text
.sect .rom
.sect .data
.sect .bss
.sect .text
! This subroutine print the contents of register A to the screen
! in hexadecimal form.
! The subroutine WRCH is a special one provided by the BBC
! microcomputer.
Printhex:
pha ! save A
lsr a
lsr a
lsr a
lsr a ! get four high bits
jsr 1f
pla ! restore A
and #0x0F ! get four low bits
jsr 1f
rts
1: sed ! print in hex
clc
adc #0x90
adc #0x40
cld
jmp WRCH

View File

@@ -0,0 +1,49 @@
.define Printstack
.sect .text
.sect .rom
.sect .data
.sect .bss
.sect .text
! This a special subroutine which prints some things to the
! monitorscreen for debugging.
Printstack:
ldy #0
2: lda (hol0+4),y
beq 1f
jsr WRCH ! print filename
iny
jmp 2b
1: lda #32
jsr WRCH ! print a space
lda hol0+1
jsr Printhex ! print line number (highbyte)
lda hol0
jsr Printhex ! print line number (lowbyte)
lda #32
jsr WRCH ! print a space
lda SP+1
jsr Printhex ! print stackpointer (highbyte)
lda SP+2
jsr Printhex ! print stackpointer (lowbyte)
lda #32
jsr WRCH ! print a space
lda LB+1
jsr Printhex ! print real localbase (highbyte)
lda LB
jsr Printhex ! print real localbase (lowbyte)
lda #32
jsr WRCH ! print a space
lda LBl+1
jsr Printhex ! print second lowerbase (highbyte)
lda LBl
jsr Printhex ! print second lowerbase (lowbyte)
lda #10
jsr WRCH ! print a newline
lda #13
jsr WRCH ! print a carriagereturn
rts

37
mach/6500/libem/read.s Normal file
View File

@@ -0,0 +1,37 @@
.define Mread
.sect .text
.sect .rom
.sect .data
.sect .bss
.sect .text
! This subroutine reads characters from the standard input.
! It ignores the filedes.
! It reads atmost 255 characters. So the runtime system must
! provide a way of dealing with this.
! The subroutine RDCH is a special one provided by the BBC
! microcomputer.
Mread:
jsr Pop ! ignore filedescriptor
jsr Pop ! bufptr
stx ADDR ! address of character buffer (lowbyte)
sta ADDR+1 ! address of character buffer (highbyte)
jsr Pop ! number of characters
ldy #0 ! <= 255
inx
1: jsr RDCH ! read a character from the current inputstream
bcs 8f
sta (ADDR),y
iny
dex
bne 1b
8: tya
tax
lda #0
jsr Push ! number of characters red.
tax ! report a succesfull read.
rts

39
mach/6500/libem/write.s Normal file
View File

@@ -0,0 +1,39 @@
.define Mwrite
.sect .text
.sect .rom
.sect .data
.sect .bss
.sect .text
! This subroutine performs the monitor call write.
! Writing is always done to standardoutput.
! A zero is returned on exit.
! The subroutine WRCH is a special routine of the BBC
! microcomputer.
Mwrite:
jsr Pop ! get fildes
jsr Pop ! get address of characterbuffer
stx ADDR ! bufferaddress (lowbyte)
sta ADDR+1 ! bufferaddress (highbyte)
jsr Pop ! number of characters to be writen.
ldy #0
1: lda (ADDR),y
cmp #10
bne 2f
pha
lda #13
jsr WRCH
pla
2: jsr WRCH
iny
dex
bne 1b
tya
tax
lda #0
jsr Push
tax
rts

67
mach/6800/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)
CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
$(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
COBJ = comm3.o comm4.o comm5.o \
comm6.o comm7.o comm8.o
MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
all: as
install:all
../../install as
cmp:
-../../compare as
clean:
rm -f *.o as as.[cy] y.tab.h
pr: $(MACH)
@pr -n $(MACH)
opr:
make pr | opr
as: $(COBJ) as.o
$(CC) $(LDFLAGS) $(COBJ) as.o $(LIBOBJ) -o as
as.y: $(CDIR)/comm2.y
$(CPP) -P -I. -I$h $(DEF) $(CDIR)/comm2.y >as.y
-@if test -f Expect ; then cat Expect ; else echo "expect 1 shift/reduce conflict"; fi
lint: $(CSRC) as.c
lint $(INCL) $(CSRC) as.c
y.tab.h: as.c
$(COBJ): y.tab.h
$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
as.y: mach2.c
comm3.o: mach3.c
as.y: mach4.c
comm8.o: mach5.c
comm3.o: $(CDIR)/comm3.c
$(CC) -c $(CFLAGS) $(CDIR)/comm3.c
comm4.o: $(CDIR)/comm4.c
$(CC) -c $(CFLAGS) $(CDIR)/comm4.c
comm5.o: $(CDIR)/comm5.c
$(CC) -c $(CFLAGS) $(CDIR)/comm5.c
comm6.o: $(CDIR)/comm6.c
$(CC) -c $(CFLAGS) $(CDIR)/comm6.c
comm7.o: $(CDIR)/comm7.c
$(CC) -c $(CFLAGS) $(CDIR)/comm7.c
comm8.o: $(CDIR)/comm8.c
$(CC) -c $(CFLAGS) $(CDIR)/comm8.c

67
mach/6805/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)
CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
$(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
COBJ = comm3.o comm4.o comm5.o \
comm6.o comm7.o comm8.o
MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
all: as
install:all
../../install as
cmp:
-../../compare as
clean:
rm -f *.o as as.[cy] y.tab.h
pr: $(MACH)
@pr -n $(MACH)
opr:
make pr | opr
as: $(COBJ) as.o
$(CC) $(LDFLAGS) $(COBJ) as.o $(LIBOBJ) -o as
as.y: $(CDIR)/comm2.y
$(CPP) -P -I. -I$h $(DEF) $(CDIR)/comm2.y >as.y
-@if test -f Expect ; then cat Expect ; else echo "expect 1 shift/reduce conflict"; fi
lint: $(CSRC) as.c
lint $(INCL) $(CSRC) as.c
y.tab.h: as.c
$(COBJ): y.tab.h
$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
as.y: mach2.c
comm3.o: mach3.c
as.y: mach4.c
comm8.o: mach5.c
comm3.o: $(CDIR)/comm3.c
$(CC) -c $(CFLAGS) $(CDIR)/comm3.c
comm4.o: $(CDIR)/comm4.c
$(CC) -c $(CFLAGS) $(CDIR)/comm4.c
comm5.o: $(CDIR)/comm5.c
$(CC) -c $(CFLAGS) $(CDIR)/comm5.c
comm6.o: $(CDIR)/comm6.c
$(CC) -c $(CFLAGS) $(CDIR)/comm6.c
comm7.o: $(CDIR)/comm7.c
$(CC) -c $(CFLAGS) $(CDIR)/comm7.c
comm8.o: $(CDIR)/comm8.c
$(CC) -c $(CFLAGS) $(CDIR)/comm8.c

67
mach/6809/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)
CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
$(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
COBJ = comm3.o comm4.o comm5.o \
comm6.o comm7.o comm8.o
MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
all: as
install:all
../../install as
cmp:
-../../compare as
clean:
rm -f *.o as as.[cy] y.tab.h
pr: $(MACH)
@pr -n $(MACH)
opr:
make pr | opr
as: $(COBJ) as.o
$(CC) $(LDFLAGS) $(COBJ) as.o $(LIBOBJ) -o as
as.y: $(CDIR)/comm2.y
$(CPP) -P -I. -I$h $(DEF) $(CDIR)/comm2.y >as.y
-@if test -f Expect ; then cat Expect ; else echo "expect 1 shift/reduce conflict"; fi
lint: $(CSRC) as.c
lint $(INCL) $(CSRC) as.c
y.tab.h: as.c
$(COBJ): y.tab.h
$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
as.y: mach2.c
comm3.o: mach3.c
as.y: mach4.c
comm8.o: mach5.c
comm3.o: $(CDIR)/comm3.c
$(CC) -c $(CFLAGS) $(CDIR)/comm3.c
comm4.o: $(CDIR)/comm4.c
$(CC) -c $(CFLAGS) $(CDIR)/comm4.c
comm5.o: $(CDIR)/comm5.c
$(CC) -c $(CFLAGS) $(CDIR)/comm5.c
comm6.o: $(CDIR)/comm6.c
$(CC) -c $(CFLAGS) $(CDIR)/comm6.c
comm7.o: $(CDIR)/comm7.c
$(CC) -c $(CFLAGS) $(CDIR)/comm7.c
comm8.o: $(CDIR)/comm8.c
$(CC) -c $(CFLAGS) $(CDIR)/comm8.c

67
mach/arm/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)
CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
$(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
COBJ = comm3.o comm4.o comm5.o \
comm6.o comm7.o comm8.o
MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
all: as
install:all
../../install as
cmp:
-../../compare as
clean:
rm -f *.o as as.[cy] y.tab.h
pr: $(MACH)
@pr -n $(MACH)
opr:
make pr | opr
as: $(COBJ) as.o
$(CC) $(LDFLAGS) $(COBJ) as.o $(LIBOBJ) -o as
as.y: $(CDIR)/comm2.y
$(CPP) -P -I. -I$h $(DEF) $(CDIR)/comm2.y >as.y
-@if test -f Expect ; then cat Expect ; else echo "expect 1 shift/reduce conflict"; fi
lint: $(CSRC) as.c
lint $(INCL) $(CSRC) as.c
y.tab.h: as.c
$(COBJ): y.tab.h
$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
as.y: mach2.c
comm3.o: mach3.c
as.y: mach4.c
comm8.o: mach5.c
comm3.o: $(CDIR)/comm3.c
$(CC) -c $(CFLAGS) $(CDIR)/comm3.c
comm4.o: $(CDIR)/comm4.c
$(CC) -c $(CFLAGS) $(CDIR)/comm4.c
comm5.o: $(CDIR)/comm5.c
$(CC) -c $(CFLAGS) $(CDIR)/comm5.c
comm6.o: $(CDIR)/comm6.c
$(CC) -c $(CFLAGS) $(CDIR)/comm6.c
comm7.o: $(CDIR)/comm7.c
$(CC) -c $(CFLAGS) $(CDIR)/comm7.c
comm8.o: $(CDIR)/comm8.c
$(CC) -c $(CFLAGS) $(CDIR)/comm8.c

22
mach/arm/cv/Makefile Normal file
View File

@@ -0,0 +1,22 @@
EMHOME=../../..
OBJLIB=$(EMHOME)/modules/lib/libobject.a
head: cv
cv: cv.c
$(CC) $(CFLAGS) $(LDFLAGS) -I$(EMHOME)/h -o cv cv.c $(OBJLIB)
install: head
../../install cv
cmp: head
../../compare cv
clean:
rm -f *.o
pr:
@pr `pwd`/Makefile `pwd`/cv.c
opr:
make pr | opr

21
mach/arm/libem/Makefile Normal file
View File

@@ -0,0 +1,21 @@
all:
install:
../../install head_em.s head_em
../../install libem_s.a tail_em
../../install end.s end_em
cmp:
-../../compare head_em.s head_em
-../../compare libem_s.a tail_em
-../../compare end.s end_em
clean:
opr :
make pr | opr
pr:
@pr `pwd`/head_em.s
@arch pv libem_s.a | pr -h `pwd`/libem_s.a
@pr `pwd`/end.s

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

@@ -0,0 +1,16 @@
.define _endtext,_enddata,_endbss
.sect .text
.align 4
.sect .rom
.align 4
.sect .data
.align 4
.sect .bss
.align 4
.sect .text
_endtext:
.sect .data
_enddata:
.sect .bss
_endbss:

178
mach/arm/libem/head_em.s Normal file
View File

@@ -0,0 +1,178 @@
! head_em.s
.define begdat,begbss,hol0,argv,envp,_RegHp,_incptflag
.define _Lineno,_Filna,_IgnoreMask,_TrpReg
.sect .text
.sect .rom
.sect .data
.sect .bss
.sect .text
.base 0x8000
ADR R0,begbss
ADR R1,_endbss
MOV R2,#0
ADR R3,_incptflag
STR R2,[R3]
1:
STR R2,[R0],#4
CMP R0,R1
BLT 1B
! the next 2 lines are OS specific:
SWI 16 ! OS_Getenv
SUB R12, R1, #8 ! Get end of ram
! R0 points to command string
! (argv,argc) code for C
! or Pascal file names
MOV R9,R0 ! save pt in R0
MOV R8,#0 ! string length
len:
LDR.B R7,[R9],#1
CMP R7,#0
ADD.NE R8,R8,#1
BNE len
MOV R7,R8 ! save len in R7
! round up to multiple of 4
ADD R8,R8,#4
MVN R6, #3 !FFFFFFFC
AND R8,R8,R6
! make room on stack
SUB R12,R12,R8 ! word aligned
! now determine argc
! OS intercepts blank lines, so
! there must be at least one arg
MOV R9,R0
MOV R6,#0 ! holds argc
MOV R5,#0 ! char count
loop1:
CMP R5,R7
BGT next1
LDR.B R4,[R9],#1
ADD R5,R5,#1
CMP R4,#32
BEQ loop1 !skip spaces
ADD R6,R6,#1 ! new arg
nospace1:
CMP R5,R7
BGT next1
LDR.B R4,[R9],#1
ADD R5,R5,#1
CMP R4,#32
BNE nospace1
CMP R5,R7
BCC loop1
! BEQ loop1
next1:
! store argc
ADR R5,argc
STR R6,[R5]
! copy the string
! onto the stack
MOV R9,R0 !source
MOV R2,R12 !dest
MOV R3,R7 !#chars
loop2:
LDR.B R4,[R9],#1
STR.B R4,[R2],#1
SUB.S R3,R3,#1
BNE loop2
MOV R4, #0 ! zero terminator
STR.B R4,[R2]
! create space on the stack for
! the pointers to individual args
MOV R11, R12 ! string pt
MOV R8,R6,LSL #2
SUB R12,R12,R8
! save pointer to argv[0]
ADR R1,argv
STR R12,[R1]
! determine argv[0] .. argv[argc-1]
! and store on stack
! R11 = start of string
! R7 = string lenth
! R12 = stack pointer
! R6 = argc
MOV R9, #0 !char count
MOV R8, #0 !arg count
MOV R5,R11
loop3:
CMP R9,R7
BGT next2
LDR.B R4,[R5],#1
ADD R9,R9,#1
CMP R4,#32
BEQ loop3
CMP R9,R7
BGT next2
SUB R4,R5,#1 !compensate for incr
STR R4,[R12,R8,LSL #2]
ADD R8,R8,#1
nospace2:
CMP R9,R7
BGT next2
LDR.B R4,[R5],#1
ADD R9,R9,#1
CMP R4,#32
BNE nospace2
CMP R9,R7
BCC loop3
! BEQ loop3
! finally, replace spaces by 0
next2:
MOV R5,R11 !string ptr
MOV R6,R7 !string length
MOV R3,#0
loop4:
CMP R6,#0
BEQ next3
LDR.B R4,[R5]
CMP R4,#32
STR.EQ.B R3,[R5]
ADD R5,R5,#1
SUB R6,R6,#1
BAL loop4
next3:
ADR R11, envp
STMFD R12<,{R11}
ADR R11,argv
LDR R11,[R11]
STMFD R12<,{R11}
ADR R11, argc
LDR R11,[R11]
STMFD R12<,{R11}
BAL.L __m_a_i_n
MOV R11,#0
STMFD R12<,{R11}
MOV R11,#1
STMFD R12<,{R11}
BAL.L _EmMon
.sect .bss
begbss:
.sect .data
begdat:
hol0:
.data4 0
.data4 0
argv:
.data4 0
envp:
.data4 0
argc:
.data4 0
2:
.asciz 'PROGRAM'
.align
_RegHp:
.data4 _endbss
_Lineno:
.data4 0
_Filna:
.data4 0
_IgnoreMask:
.data4 0
_TrpReg:
.data4 0
_incptflag:
.data4 0

22
mach/arm/libfp/Makefile Normal file
View File

@@ -0,0 +1,22 @@
EMHOME=../../..
SUF=so
MAKEFILE=$(EMHOME)/mach/proto/fp/Makefile
MACHDEF="MACH=arm" "CFLAGS=-DUSE_DIVIDE" "SUF=$(SUF)" "ASAR=arch"
all:
make -f $(MAKEFILE) $(MACHDEF) all
install:
make -f $(MAKEFILE) $(MACHDEF) install
cmp: all
-../../compare FP_$(MACH).a tail_fp
clean:
make -f $(MAKEFILE) $(MACHDEF) clean
opr:
make pr | opr
pr:
@pr Makefile

15
mach/arm/libmon/Makefile Normal file
View File

@@ -0,0 +1,15 @@
all:
install:
../../install libros_s.a tail_ros
cmp:
-../../compare libros_s.a tail_ros
clean:
opr :
make pr | opr
pr:
@arch pv libros_s.a | pr -h `pwd`/libros_s.a

197
mach/arm/ncg/Makefile Normal file
View File

@@ -0,0 +1,197 @@
# $Header$
EMHOME=../../..
#preprocessor flags for table
TABLEFLAGS=
#cgg options
CGGFLAGS=
PREFLAGS=-I$(EMHOME)/h -I. -I$(EMHOME)/mach -I$(EMHOME)/modules/h -DNDEBUG
PFLAGS=
CFLAGS=$(PREFLAGS) $(PFLAGS) -O
LDFLAGS=$(PFLAGS)
LINTOPTS=-bx
LIBS=$(EMHOME)/lib/em_data.a $(EMHOME)/modules/lib/libflt.a
CDIR=$(EMHOME)/mach/proto/ncg
CGG=$(EMHOME)/lib/ncgg
CPP=$(EMHOME)/lib/cpp
CFILES=$(CDIR)/codegen.c $(CDIR)/compute.c $(CDIR)/equiv.c $(CDIR)/fillem.c \
$(CDIR)/gencode.c $(CDIR)/glosym.c $(CDIR)/label.c $(CDIR)/main.c \
$(CDIR)/move.c $(CDIR)/nextem.c $(CDIR)/reg.c $(CDIR)/regvar.c \
$(CDIR)/salloc.c $(CDIR)/state.c $(CDIR)/subr.c $(CDIR)/var.c
OFILES=codegen.o compute.o equiv.o fillem.o gencode.o glosym.o label.o \
main.o move.o nextem.o reg.o regvar.o salloc.o state.o subr.o var.o
all: tables.c
make "EMHOME="$(EMHOME) cg
cg: tables.o $(OFILES)
$(CC) $(LDFLAGS) $(OFILES) tables.o $(LIBS) -o cg
tables.o: tables.c
$(CC) -c $(PREFLAGS) -I$(CDIR) tables.c
codegen.o: $(CDIR)/codegen.c
$(CC) -c $(CFLAGS) $(CDIR)/codegen.c
compute.o: $(CDIR)/compute.c
$(CC) -c $(CFLAGS) $(CDIR)/compute.c
equiv.o: $(CDIR)/equiv.c
$(CC) -c $(CFLAGS) $(CDIR)/equiv.c
fillem.o: $(CDIR)/fillem.c
$(CC) -c $(CFLAGS) $(CDIR)/fillem.c
gencode.o: $(CDIR)/gencode.c
$(CC) -c $(CFLAGS) $(CDIR)/gencode.c
glosym.o: $(CDIR)/glosym.c
$(CC) -c $(CFLAGS) $(CDIR)/glosym.c
label.o: $(CDIR)/label.c
$(CC) -c $(CFLAGS) $(CDIR)/label.c
main.o: $(CDIR)/main.c
$(CC) -c $(CFLAGS) $(CDIR)/main.c
move.o: $(CDIR)/move.c
$(CC) -c $(CFLAGS) $(CDIR)/move.c
nextem.o: $(CDIR)/nextem.c
$(CC) -c $(CFLAGS) $(CDIR)/nextem.c
reg.o: $(CDIR)/reg.c
$(CC) -c $(CFLAGS) $(CDIR)/reg.c
regvar.o: $(CDIR)/regvar.c
$(CC) -c $(CFLAGS) $(CDIR)/regvar.c
salloc.o: $(CDIR)/salloc.c
$(CC) -c $(CFLAGS) $(CDIR)/salloc.c
state.o: $(CDIR)/state.c
$(CC) -c $(CFLAGS) $(CDIR)/state.c
subr.o: $(CDIR)/subr.c
$(CC) -c $(CFLAGS) $(CDIR)/subr.c
var.o: $(CDIR)/var.c
$(CC) -c $(CFLAGS) $(CDIR)/var.c
install: all
$(EMHOME)/mach/install cg
cmp: all
-$(EMHOME)/mach/compare cg
tables.c: table $(CGG)
$(CPP) $(TABLEFLAGS) table | $(CGG) $(CGGFLAGS)
-cmp tables.h tables.H || cp tables.H tables.h
lint: $(CFILES) tables.c
lint $(LINTOPTS) $(PREFLAGS) -I$(CDIR) $(CFILES) tables.c
clean:
rm -f *.o tables.c tables.h debug.out cg tables.H
distr: tables.c
rm -f tables1.c tables1.h
cp tables.c tables1.c
cp tables.h tables1.h
chmod -w tables1.[ch]
codegen.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
codegen.o: $(CDIR)/data.h
codegen.o: $(CDIR)/equiv.h
codegen.o: $(CDIR)/extern.h
codegen.o: $(CDIR)/param.h
codegen.o: $(CDIR)/result.h
codegen.o: $(CDIR)/state.h
codegen.o: tables.h
codegen.o: $(CDIR)/types.h
compute.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
compute.o: $(CDIR)/data.h
compute.o: $(CDIR)/extern.h
compute.o: $(CDIR)/glosym.h
compute.o: $(CDIR)/label.h
compute.o: $(CDIR)/param.h
compute.o: $(CDIR)/result.h
compute.o: tables.h
compute.o: $(CDIR)/types.h
equiv.o: $(CDIR)/assert.h
equiv.o: $(CDIR)/data.h $(EMHOME)/h/cgg_cg.h
equiv.o: $(CDIR)/equiv.h
equiv.o: $(CDIR)/extern.h
equiv.o: $(CDIR)/param.h
equiv.o: $(CDIR)/result.h
equiv.o: tables.h
equiv.o: $(CDIR)/types.h
fillem.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
fillem.o: $(CDIR)/data.h
fillem.o: $(CDIR)/extern.h
fillem.o: mach.c
fillem.o: mach.h
fillem.o: $(CDIR)/param.h
fillem.o: $(CDIR)/regvar.h
fillem.o: $(CDIR)/result.h
fillem.o: tables.h
fillem.o: $(CDIR)/types.h
gencode.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
gencode.o: $(CDIR)/data.h
gencode.o: $(CDIR)/extern.h
gencode.o: $(CDIR)/param.h
gencode.o: $(CDIR)/result.h
gencode.o: tables.h
gencode.o: $(CDIR)/types.h
glosym.o: $(CDIR)/glosym.h
glosym.o: $(CDIR)/param.h
glosym.o: tables.h
glosym.o: $(CDIR)/types.h
label.o: $(CDIR)/label.h
label.o: $(CDIR)/param.h
label.o: tables.h
label.o: $(CDIR)/types.h
main.o: $(CDIR)/param.h
main.o: tables.h
move.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
move.o: $(CDIR)/data.h
move.o: $(CDIR)/extern.h
move.o: $(CDIR)/param.h
move.o: $(CDIR)/result.h
move.o: tables.h
move.o: $(CDIR)/types.h
nextem.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
nextem.o: $(CDIR)/data.h
nextem.o: $(CDIR)/extern.h
nextem.o: $(CDIR)/param.h
nextem.o: $(CDIR)/result.h
nextem.o: tables.h
nextem.o: $(CDIR)/types.h
reg.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
reg.o: $(CDIR)/data.h
reg.o: $(CDIR)/extern.h
reg.o: $(CDIR)/param.h
reg.o: $(CDIR)/result.h
reg.o: tables.h
reg.o: $(CDIR)/types.h
regvar.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
regvar.o: $(CDIR)/data.h
regvar.o: $(CDIR)/extern.h
regvar.o: $(CDIR)/param.h
regvar.o: $(CDIR)/regvar.h
regvar.o: $(CDIR)/result.h
regvar.o: tables.h
regvar.o: $(CDIR)/types.h
salloc.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
salloc.o: $(CDIR)/data.h
salloc.o: $(CDIR)/extern.h
salloc.o: $(CDIR)/param.h
salloc.o: $(CDIR)/result.h
salloc.o: tables.h
salloc.o: $(CDIR)/types.h
state.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
state.o: $(CDIR)/data.h
state.o: $(CDIR)/extern.h
state.o: $(CDIR)/param.h
state.o: $(CDIR)/result.h
state.o: $(CDIR)/state.h
state.o: tables.h
state.o: $(CDIR)/types.h
subr.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
subr.o: $(CDIR)/data.h
subr.o: $(CDIR)/extern.h
subr.o: $(CDIR)/param.h
subr.o: $(CDIR)/result.h
subr.o: tables.h
subr.o: $(CDIR)/types.h
var.o: $(CDIR)/data.h $(EMHOME)/h/cgg_cg.h
var.o: $(CDIR)/param.h
var.o: $(CDIR)/result.h
var.o: tables.h
var.o: $(CDIR)/types.h

42
mach/arm/top/Makefile Normal file
View File

@@ -0,0 +1,42 @@
EMHOME=../../..
LIBS=$(EMHOME)/modules/lib/libstring.a
PREFLAGS=-I.
PFLAGS=
CFLAGS=$(PREFLAGS) $(PFLAGS) -O -DNDEBUG
LDFLAGS=$(PFLAGS)
LINTOPTS=-bx
CDIR=$(EMHOME)/mach/proto/top
CFILES=$(CDIR)/top.c $(CDIR)/queue.c
OFILES=top.o queue.o
all: gen.c
make top
top: $(OFILES)
$(CC) $(LDFLAGS) $(OFILES) $(LIBS) -o top
top.o: $(CDIR)/top.c gen.c
$(CC) -c $(CFLAGS) $(CDIR)/top.c
queue.o: $(CDIR)/queue.c
$(CC) -c $(CFLAGS) $(CDIR)/queue.c
install: all
$(EMHOME)/mach/install top
cmp: all
-$(EMHOME)/mach/compare top
gen.c: table
$(EMHOME)/lib/topgen table
lint: $(CFILES)
lint $(LINTOPTS) $(PREFLAGS) $(CFILES)
clean:
rm -f *.o gen.c gen.h top
top.o: gen.h
top.o: $(CDIR)/top.h
top.o: $(CDIR)/queue.h
queue.o: $(CDIR)/queue.h

7
mach/compare Executable file
View File

@@ -0,0 +1,7 @@
case $# in
1) DEST="$1" ;;
2) DEST="$2" ;;
*) echo $0 [source] destination ;;
esac
MACH=`(cd .. ; basename \`pwd\`)`
cmp "$1" ../../../lib/${MACH}/$DEST

67
mach/i386/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)
CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
$(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
COBJ = comm3.o comm4.o comm5.o \
comm6.o comm7.o comm8.o
MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
all: as
install:all
../../install as
cmp:
-../../compare as
clean:
rm -f *.o as as.[cy] y.tab.h
pr: $(MACH)
@pr -n $(MACH)
opr:
make pr | opr
as: $(COBJ) as.o
$(CC) $(LDFLAGS) $(COBJ) as.o $(LIBOBJ) -o as
as.y: $(CDIR)/comm2.y
$(CPP) -P -I. -I$h $(DEF) $(CDIR)/comm2.y >as.y
-@if test -f Expect ; then cat Expect ; else echo "expect 1 shift/reduce conflict"; fi
lint: $(CSRC) as.c
lint $(INCL) $(CSRC) as.c
y.tab.h: as.c
$(COBJ): y.tab.h
$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
as.y: mach2.c
comm3.o: mach3.c
as.y: mach4.c
comm8.o: mach5.c
comm3.o: $(CDIR)/comm3.c
$(CC) -c $(CFLAGS) $(CDIR)/comm3.c
comm4.o: $(CDIR)/comm4.c
$(CC) -c $(CFLAGS) $(CDIR)/comm4.c
comm5.o: $(CDIR)/comm5.c
$(CC) -c $(CFLAGS) $(CDIR)/comm5.c
comm6.o: $(CDIR)/comm6.c
$(CC) -c $(CFLAGS) $(CDIR)/comm6.c
comm7.o: $(CDIR)/comm7.c
$(CC) -c $(CFLAGS) $(CDIR)/comm7.c
comm8.o: $(CDIR)/comm8.c
$(CC) -c $(CFLAGS) $(CDIR)/comm8.c

26
mach/i386/ce/Makefile Normal file
View File

@@ -0,0 +1,26 @@
EMHOME = ../../..
CEG = $(EMHOME)/lib/ceg/util
OBJ = obj
all:
make -f $(CEG)/make_asobj "OBJ="$(OBJ)
install:
make -f $(CEG)/make_asobj "OBJ="$(OBJ) install
cmp:
-make -f $(CEG)/make_asobj "OBJ="$(OBJ) cmp
pr:
@pr Makefile EM_table mach.h mach.c as_table as.h as.c
opr:
make pr | opr
# total cleanup
clean:
make -f $(CEG)/make_asobj "OBJ="$(OBJ) clean
# only remove ce, ceg, and back directories
dclean:
make -f $(CEG)/make_asobj "OBJ="$(OBJ) dclean

25
mach/i386/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

30
mach/i386/libem/Makefile Normal file
View File

@@ -0,0 +1,30 @@
# $Header$
MACH=i386
all: libem_o.a end.o
install: all
../../install libem_o.a tail_em
../../install end.o end_em
cmp: all
-../../compare libem_o.a tail_em
-../../compare end.o end_em
end.o: end.s
$(MACH) -I../../../h -O -c end.s
libem_o.a: libem_s.a
ASAR=aal ; export ASAR ;\
march . libem_o.a
clean:
rm -f *.o libem_o.a
opr :
make pr | opr
pr:
@arch pv libem_s.a | pr -h `pwd`/libem_s.a
@pr `pwd`/end.s

4
mach/i386/libem/compmodule Executable file
View File

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

17
mach/i386/libem/end.s Normal file
View File

@@ -0,0 +1,17 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define endtext,enddata,endbss
.define _end,_etext,_edata
! $Header$
.sect .text
endtext:
_etext:
.align 4
.sect .data
enddata:
_edata:
.align 4
.sect .endsect
_end:
endbss:
.align 4

38
mach/i386/libem/fakfp.s Normal file
View File

@@ -0,0 +1,38 @@
.define .adf4, .adf8, .sbf4, .sbf8, .mlf4, .mlf8, .dvf4, .dvf8
.define .ngf4, .ngf8, .fif4, .fif8, .fef4, .fef8
.define .cif4, .cif8, .cuf4, .cuf8, .cfi, .cfu, .cff4, .cff8
.define .cmf4, .cmf8
.sect .text
.sect .rom
.sect .data
.sect .bss
! $Header$
.sect .text
.adf4:
.adf8:
.sbf4:
.sbf8:
.mlf4:
.mlf8:
.dvf4:
.dvf8:
.ngf4:
.ngf8:
.fif4:
.fif8:
.fef4:
.fef8:
.cif4:
.cif8:
.cuf4:
.cuf8:
.cfi:
.cfu:
.cff4:
.cff8:
.cmf4:
.cmf8:
mov eax,18 ! illegal instruction EILLINS
jmp .trp

17
mach/i386/libem/return.s Normal file
View File

@@ -0,0 +1,17 @@
.define .sdret, .dsret, .sret, .dret, .cret
.sect .text
.dsret:
pop edi
.sret:
pop esi
.cret:
mov esp,ebp
pop ebp
ret
.sdret:
pop esi
.dret:
pop edi
jmp .cret

5
mach/i386/libem/stop.s Normal file
View File

@@ -0,0 +1,5 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.sect .text
.define .stop
.stop:
jmp __exit

22
mach/i386/libfp/Makefile Normal file
View File

@@ -0,0 +1,22 @@
EMHOME=../../..
SUF=o
MAKEFILE=$(EMHOME)/mach/proto/fp/Makefile
MACHDEF="MACH=i386" "CFLAGS=-DUSE_DIVIDE" "SUF=$(SUF)" "ASAR=aal"
all:
make -f $(MAKEFILE) $(MACHDEF) all
install:
make -f $(MAKEFILE) $(MACHDEF) install
cmp: all
-../../compare FP_$(MACH).a tail_fp
clean:
make -f $(MAKEFILE) $(MACHDEF) clean
opr:
make pr | opr
pr:
@pr Makefile

28
mach/i386/libsys/Makefile Normal file
View File

@@ -0,0 +1,28 @@
# $Header$
MACH=i386
all: libmon_o.a head_em.o
install: all
../../install libmon_o.a tail_mon
../../install head_em.o head_em
cmp: all
-../../compare libmon_o.a tail_mon
-../../compare head_em.o head_em
libmon_o.a: libmon_s.a
ASAR=aal ; export ASAR ;\
march . libmon_o.a
head_em.o: head_em.s
$(MACH) -O -c head_em.s
clean:
rm -f *.o libmon_o.a
opr :
make pr | opr
pr:
@pr `pwd`/head_em.s
@arch pv libmon_s.a | pr -h `pwd`/libmon_s.a

12
mach/i386/libsys/_pipe.s Normal file
View File

@@ -0,0 +1,12 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define __pipe
.sect .text
__pipe:
mov ax,42
callf 0x7:0x0
jae 1f
jmp cerror
1:
shl dx,0x10
or eax,edx
ret

View File

@@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define __profil
.sect .text
__profil:
mov ax,44
jmp syscal

View File

@@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define __stime
.sect .text
__stime:
mov ax,25
jmp sysx

6
mach/i386/libsys/_time.s Normal file
View File

@@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define __time
.sect .text
__time:
mov ax,13
jmp syscal

12
mach/i386/libsys/_wait.s Normal file
View File

@@ -0,0 +1,12 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define __wait
.sect .text
__wait:
mov ax,7
callf 0x7:0x0
jb 1f
shl dx,0x10
or eax,edx
ret
1:
jmp cerror

4
mach/i386/libsys/compmodule Executable file
View File

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

197
mach/i386/ncg/Makefile Normal file
View File

@@ -0,0 +1,197 @@
# $Header$
EMHOME=../../..
#preprocessor flags for table
TABLEFLAGS=
#cgg options
CGGFLAGS=
PREFLAGS=-I$(EMHOME)/h -I. -I$(EMHOME)/mach -I$(EMHOME)/modules/h -DNDEBUG
PFLAGS=
CFLAGS=$(PREFLAGS) $(PFLAGS) -O
LDFLAGS=$(PFLAGS)
LINTOPTS=-bx
LIBS=$(EMHOME)/lib/em_data.a $(EMHOME)/modules/lib/libflt.a
CDIR=$(EMHOME)/mach/proto/ncg
CGG=$(EMHOME)/lib/ncgg
CPP=$(EMHOME)/lib/cpp
CFILES=$(CDIR)/codegen.c $(CDIR)/compute.c $(CDIR)/equiv.c $(CDIR)/fillem.c \
$(CDIR)/gencode.c $(CDIR)/glosym.c $(CDIR)/label.c $(CDIR)/main.c \
$(CDIR)/move.c $(CDIR)/nextem.c $(CDIR)/reg.c $(CDIR)/regvar.c \
$(CDIR)/salloc.c $(CDIR)/state.c $(CDIR)/subr.c $(CDIR)/var.c
OFILES=codegen.o compute.o equiv.o fillem.o gencode.o glosym.o label.o \
main.o move.o nextem.o reg.o regvar.o salloc.o state.o subr.o var.o
all: tables.c
make "EMHOME="$(EMHOME) cg
cg: tables.o $(OFILES)
$(CC) $(LDFLAGS) $(OFILES) tables.o $(LIBS) -o cg
tables.o: tables.c
$(CC) -c $(PREFLAGS) -I$(CDIR) tables.c
codegen.o: $(CDIR)/codegen.c
$(CC) -c $(CFLAGS) $(CDIR)/codegen.c
compute.o: $(CDIR)/compute.c
$(CC) -c $(CFLAGS) $(CDIR)/compute.c
equiv.o: $(CDIR)/equiv.c
$(CC) -c $(CFLAGS) $(CDIR)/equiv.c
fillem.o: $(CDIR)/fillem.c
$(CC) -c $(CFLAGS) $(CDIR)/fillem.c
gencode.o: $(CDIR)/gencode.c
$(CC) -c $(CFLAGS) $(CDIR)/gencode.c
glosym.o: $(CDIR)/glosym.c
$(CC) -c $(CFLAGS) $(CDIR)/glosym.c
label.o: $(CDIR)/label.c
$(CC) -c $(CFLAGS) $(CDIR)/label.c
main.o: $(CDIR)/main.c
$(CC) -c $(CFLAGS) $(CDIR)/main.c
move.o: $(CDIR)/move.c
$(CC) -c $(CFLAGS) $(CDIR)/move.c
nextem.o: $(CDIR)/nextem.c
$(CC) -c $(CFLAGS) $(CDIR)/nextem.c
reg.o: $(CDIR)/reg.c
$(CC) -c $(CFLAGS) $(CDIR)/reg.c
regvar.o: $(CDIR)/regvar.c
$(CC) -c $(CFLAGS) $(CDIR)/regvar.c
salloc.o: $(CDIR)/salloc.c
$(CC) -c $(CFLAGS) $(CDIR)/salloc.c
state.o: $(CDIR)/state.c
$(CC) -c $(CFLAGS) $(CDIR)/state.c
subr.o: $(CDIR)/subr.c
$(CC) -c $(CFLAGS) $(CDIR)/subr.c
var.o: $(CDIR)/var.c
$(CC) -c $(CFLAGS) $(CDIR)/var.c
install: all
$(EMHOME)/mach/install cg
cmp: all
-$(EMHOME)/mach/compare cg
tables.c: table $(CGG)
$(CPP) $(TABLEFLAGS) table | $(CGG) $(CGGFLAGS)
-cmp tables.h tables.H || cp tables.H tables.h
lint: $(CFILES) tables.c
lint $(LINTOPTS) $(PREFLAGS) -I$(CDIR) $(CFILES) tables.c
clean:
rm -f *.o tables.c tables.h debug.out cg tables.H
distr: tables.c
rm -f tables1.c tables1.h
cp tables.c tables1.c
cp tables.h tables1.h
chmod -w tables1.[ch]
codegen.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
codegen.o: $(CDIR)/data.h
codegen.o: $(CDIR)/equiv.h
codegen.o: $(CDIR)/extern.h
codegen.o: $(CDIR)/param.h
codegen.o: $(CDIR)/result.h
codegen.o: $(CDIR)/state.h
codegen.o: tables.h
codegen.o: $(CDIR)/types.h
compute.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
compute.o: $(CDIR)/data.h
compute.o: $(CDIR)/extern.h
compute.o: $(CDIR)/glosym.h
compute.o: $(CDIR)/label.h
compute.o: $(CDIR)/param.h
compute.o: $(CDIR)/result.h
compute.o: tables.h
compute.o: $(CDIR)/types.h
equiv.o: $(CDIR)/assert.h
equiv.o: $(CDIR)/data.h $(EMHOME)/h/cgg_cg.h
equiv.o: $(CDIR)/equiv.h
equiv.o: $(CDIR)/extern.h
equiv.o: $(CDIR)/param.h
equiv.o: $(CDIR)/result.h
equiv.o: tables.h
equiv.o: $(CDIR)/types.h
fillem.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
fillem.o: $(CDIR)/data.h
fillem.o: $(CDIR)/extern.h
fillem.o: mach.c
fillem.o: mach.h
fillem.o: $(CDIR)/param.h
fillem.o: $(CDIR)/regvar.h
fillem.o: $(CDIR)/result.h
fillem.o: tables.h
fillem.o: $(CDIR)/types.h
gencode.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
gencode.o: $(CDIR)/data.h
gencode.o: $(CDIR)/extern.h
gencode.o: $(CDIR)/param.h
gencode.o: $(CDIR)/result.h
gencode.o: tables.h
gencode.o: $(CDIR)/types.h
glosym.o: $(CDIR)/glosym.h
glosym.o: $(CDIR)/param.h
glosym.o: tables.h
glosym.o: $(CDIR)/types.h
label.o: $(CDIR)/label.h
label.o: $(CDIR)/param.h
label.o: tables.h
label.o: $(CDIR)/types.h
main.o: $(CDIR)/param.h
main.o: tables.h
move.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
move.o: $(CDIR)/data.h
move.o: $(CDIR)/extern.h
move.o: $(CDIR)/param.h
move.o: $(CDIR)/result.h
move.o: tables.h
move.o: $(CDIR)/types.h
nextem.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
nextem.o: $(CDIR)/data.h
nextem.o: $(CDIR)/extern.h
nextem.o: $(CDIR)/param.h
nextem.o: $(CDIR)/result.h
nextem.o: tables.h
nextem.o: $(CDIR)/types.h
reg.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
reg.o: $(CDIR)/data.h
reg.o: $(CDIR)/extern.h
reg.o: $(CDIR)/param.h
reg.o: $(CDIR)/result.h
reg.o: tables.h
reg.o: $(CDIR)/types.h
regvar.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
regvar.o: $(CDIR)/data.h
regvar.o: $(CDIR)/extern.h
regvar.o: $(CDIR)/param.h
regvar.o: $(CDIR)/regvar.h
regvar.o: $(CDIR)/result.h
regvar.o: tables.h
regvar.o: $(CDIR)/types.h
salloc.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
salloc.o: $(CDIR)/data.h
salloc.o: $(CDIR)/extern.h
salloc.o: $(CDIR)/param.h
salloc.o: $(CDIR)/result.h
salloc.o: tables.h
salloc.o: $(CDIR)/types.h
state.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
state.o: $(CDIR)/data.h
state.o: $(CDIR)/extern.h
state.o: $(CDIR)/param.h
state.o: $(CDIR)/result.h
state.o: $(CDIR)/state.h
state.o: tables.h
state.o: $(CDIR)/types.h
subr.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
subr.o: $(CDIR)/data.h
subr.o: $(CDIR)/extern.h
subr.o: $(CDIR)/param.h
subr.o: $(CDIR)/result.h
subr.o: tables.h
subr.o: $(CDIR)/types.h
var.o: $(CDIR)/data.h $(EMHOME)/h/cgg_cg.h
var.o: $(CDIR)/param.h
var.o: $(CDIR)/result.h
var.o: tables.h
var.o: $(CDIR)/types.h

67
mach/i80/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)
CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
$(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
COBJ = comm3.o comm4.o comm5.o \
comm6.o comm7.o comm8.o
MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
all: as
install:all
../../install as
cmp:
-../../compare as
clean:
rm -f *.o as as.[cy] y.tab.h
pr: $(MACH)
@pr -n $(MACH)
opr:
make pr | opr
as: $(COBJ) as.o
$(CC) $(LDFLAGS) $(COBJ) as.o $(LIBOBJ) -o as
as.y: $(CDIR)/comm2.y
$(CPP) -P -I. -I$h $(DEF) $(CDIR)/comm2.y >as.y
-@if test -f Expect ; then cat Expect ; else echo "expect 1 shift/reduce conflict"; fi
lint: $(CSRC) as.c
lint $(INCL) $(CSRC) as.c
y.tab.h: as.c
$(COBJ): y.tab.h
$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
as.y: mach2.c
comm3.o: mach3.c
as.y: mach4.c
comm8.o: mach5.c
comm3.o: $(CDIR)/comm3.c
$(CC) -c $(CFLAGS) $(CDIR)/comm3.c
comm4.o: $(CDIR)/comm4.c
$(CC) -c $(CFLAGS) $(CDIR)/comm4.c
comm5.o: $(CDIR)/comm5.c
$(CC) -c $(CFLAGS) $(CDIR)/comm5.c
comm6.o: $(CDIR)/comm6.c
$(CC) -c $(CFLAGS) $(CDIR)/comm6.c
comm7.o: $(CDIR)/comm7.c
$(CC) -c $(CFLAGS) $(CDIR)/comm7.c
comm8.o: $(CDIR)/comm8.c
$(CC) -c $(CFLAGS) $(CDIR)/comm8.c

25
mach/i80/dl/Makefile Normal file
View File

@@ -0,0 +1,25 @@
EMHOME=../../..
OBJLIB=$(EMHOME)/modules/lib/libobject.a
head: mccpm nascom
mccpm: mccpm.c
$(CC) -I$(EMHOME)/h -o mccpm mccpm.c $(OBJLIB)
nascom: nascom.c
$(CC) -I$(EMHOME)/h -o nascom nascom.c $(OBJLIB)
install: head
@echo Nothing is installed
cmp: head
@echo Nothing is compared
clean:
rm -f *.o
pr:
@pr `pwd`/Makefile `pwd`/mccpm.c `pwd`/nascom.c
opr:
make pr | opr

29
mach/i80/libem/Makefile Normal file
View File

@@ -0,0 +1,29 @@
# $Header$
MACH=i80
all: libem_o.a end.o
install: all
../../install end.o end_em
../../install libem_o.a tail_em
cmp: all
-../../compare end.o end_em
-../../compare libem_o.a tail_em
libem_o.a: libem_s.a
ASAR=aal ; export ASAR ;\
march . libem_o.a
end.o: end.s
$(MACH) -I../../../h -c end.s
clean:
rm -f *.o libem_o.a
opr :
make pr | opr
pr:
@pr `pwd`/end.s
@arch pv libem_s.a | pr -h `pwd`/libem_s.a

4
mach/i80/libem/compmodule Executable file
View File

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

17
mach/i80/libem/end.s Normal file
View File

@@ -0,0 +1,17 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define endtext,enddata,endbss
.define _end,_etext,_edata
! $Header$
.sect .text
endtext:
_etext:
.align 2
.sect .data
enddata:
_edata:
.align 2
.sect .endsect
_end:
endbss:
.align 2

29
mach/i80/libmon/Makefile Normal file
View File

@@ -0,0 +1,29 @@
# $Header$
MACH=i80
all: libsys_o.a head_em.o
install: all
../../install head_em.o head_em
../../install libsys_o.a tail_sys
cmp: all
-../../compare head_em.o head_em
-../../compare libsys_o.a tail_sys
libsys_o.a: libsys_s.a
ASAR=aal ; export ASAR ;\
march . libsys_o.a
head_em.o: head_em.s
$(MACH) -I../../../h -c head_em.s
clean:
rm -f *.o libsys_o.a
opr :
make pr | opr
pr:
@pr `pwd`/head_em.s
@arch pv libsys_s.a | pr -h `pwd`/libsys_s.a

4
mach/i80/libmon/compmodule Executable file
View File

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

49
mach/i80/libmon/head.s Normal file
View File

@@ -0,0 +1,49 @@
.define hol0, argv, envp, begbss
.define .ignmask,.reghp,.trapproc,.fra
.define .retadr,.retadr1,.areg,.bcreg,.tmp1
.define block1, block2, block3
.define .stop
.base 0x1000
.text
lxi h,0x1000 ! stack will grow from 0x1000 downwards
sphl
lxi h,begbss ! clear bss
lxi d,endbss-begbss
mvi c,0
2: mov m,c
inx h
dcx d
mov a,e
ora d
jnz 2b
lxi h,envp ! call main
push h
lxi h,argv
push h
lxi h,0
push h
call _m_a_i_n
.stop: jmp 0xfb52
.bss
begbss:
.trapproc: .space 2
.ignmask: .space 2
.data
hol0: .space 8
.reghp: .word endbss
argv: .word 0
envp: .word 0
.retadr: .space 2 ! used to save return address
.retadr1: .space 2 ! reserve
.bcreg: .space 2 ! used to save localbase
.areg: .space 1
.tmp1: .space 2
.fra: .space 8 ! 8 bytes function return area
block1: .space 4 ! used by 32 bits divide and
block2: .space 4 ! multiply routines
block3: .space 4

7
mach/i80/libmon/tail.s Normal file
View File

@@ -0,0 +1,7 @@
.define endtext, enddata, endbss
.text
endtext: .align 2
.data
enddata: .align 2
.bss
endbss: .align 2

197
mach/i80/ncg/Makefile Normal file
View File

@@ -0,0 +1,197 @@
# $Header$
EMHOME=../../..
#preprocessor flags for table
TABLEFLAGS=
#cgg options
CGGFLAGS=
PREFLAGS=-I$(EMHOME)/h -I. -I$(EMHOME)/mach -I$(EMHOME)/modules/h -DNDEBUG
PFLAGS=
CFLAGS=$(PREFLAGS) $(PFLAGS) -O
LDFLAGS=$(PFLAGS)
LINTOPTS=-bx
LIBS=$(EMHOME)/lib/em_data.a $(EMHOME)/modules/lib/libflt.a
CDIR=$(EMHOME)/mach/proto/ncg
CGG=$(EMHOME)/lib/ncgg
CPP=$(EMHOME)/lib/cpp
CFILES=$(CDIR)/codegen.c $(CDIR)/compute.c $(CDIR)/equiv.c $(CDIR)/fillem.c \
$(CDIR)/gencode.c $(CDIR)/glosym.c $(CDIR)/label.c $(CDIR)/main.c \
$(CDIR)/move.c $(CDIR)/nextem.c $(CDIR)/reg.c $(CDIR)/regvar.c \
$(CDIR)/salloc.c $(CDIR)/state.c $(CDIR)/subr.c $(CDIR)/var.c
OFILES=codegen.o compute.o equiv.o fillem.o gencode.o glosym.o label.o \
main.o move.o nextem.o reg.o regvar.o salloc.o state.o subr.o var.o
all: tables.c
make "EMHOME="$(EMHOME) cg
cg: tables.o $(OFILES)
$(CC) $(LDFLAGS) $(OFILES) tables.o $(LIBS) -o cg
tables.o: tables.c
$(CC) -c $(PREFLAGS) -I$(CDIR) tables.c
codegen.o: $(CDIR)/codegen.c
$(CC) -c $(CFLAGS) $(CDIR)/codegen.c
compute.o: $(CDIR)/compute.c
$(CC) -c $(CFLAGS) $(CDIR)/compute.c
equiv.o: $(CDIR)/equiv.c
$(CC) -c $(CFLAGS) $(CDIR)/equiv.c
fillem.o: $(CDIR)/fillem.c
$(CC) -c $(CFLAGS) $(CDIR)/fillem.c
gencode.o: $(CDIR)/gencode.c
$(CC) -c $(CFLAGS) $(CDIR)/gencode.c
glosym.o: $(CDIR)/glosym.c
$(CC) -c $(CFLAGS) $(CDIR)/glosym.c
label.o: $(CDIR)/label.c
$(CC) -c $(CFLAGS) $(CDIR)/label.c
main.o: $(CDIR)/main.c
$(CC) -c $(CFLAGS) $(CDIR)/main.c
move.o: $(CDIR)/move.c
$(CC) -c $(CFLAGS) $(CDIR)/move.c
nextem.o: $(CDIR)/nextem.c
$(CC) -c $(CFLAGS) $(CDIR)/nextem.c
reg.o: $(CDIR)/reg.c
$(CC) -c $(CFLAGS) $(CDIR)/reg.c
regvar.o: $(CDIR)/regvar.c
$(CC) -c $(CFLAGS) $(CDIR)/regvar.c
salloc.o: $(CDIR)/salloc.c
$(CC) -c $(CFLAGS) $(CDIR)/salloc.c
state.o: $(CDIR)/state.c
$(CC) -c $(CFLAGS) $(CDIR)/state.c
subr.o: $(CDIR)/subr.c
$(CC) -c $(CFLAGS) $(CDIR)/subr.c
var.o: $(CDIR)/var.c
$(CC) -c $(CFLAGS) $(CDIR)/var.c
install: all
$(EMHOME)/mach/install cg
cmp: all
-$(EMHOME)/mach/compare cg
tables.c: table $(CGG)
$(CPP) $(TABLEFLAGS) table | $(CGG) $(CGGFLAGS)
-cmp tables.h tables.H || cp tables.H tables.h
lint: $(CFILES) tables.c
lint $(LINTOPTS) $(PREFLAGS) -I$(CDIR) $(CFILES) tables.c
clean:
rm -f *.o tables.c tables.h debug.out cg tables.H
distr: tables.c
rm -f tables1.c tables1.h
cp tables.c tables1.c
cp tables.h tables1.h
chmod -w tables1.[ch]
codegen.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
codegen.o: $(CDIR)/data.h
codegen.o: $(CDIR)/equiv.h
codegen.o: $(CDIR)/extern.h
codegen.o: $(CDIR)/param.h
codegen.o: $(CDIR)/result.h
codegen.o: $(CDIR)/state.h
codegen.o: tables.h
codegen.o: $(CDIR)/types.h
compute.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
compute.o: $(CDIR)/data.h
compute.o: $(CDIR)/extern.h
compute.o: $(CDIR)/glosym.h
compute.o: $(CDIR)/label.h
compute.o: $(CDIR)/param.h
compute.o: $(CDIR)/result.h
compute.o: tables.h
compute.o: $(CDIR)/types.h
equiv.o: $(CDIR)/assert.h
equiv.o: $(CDIR)/data.h $(EMHOME)/h/cgg_cg.h
equiv.o: $(CDIR)/equiv.h
equiv.o: $(CDIR)/extern.h
equiv.o: $(CDIR)/param.h
equiv.o: $(CDIR)/result.h
equiv.o: tables.h
equiv.o: $(CDIR)/types.h
fillem.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
fillem.o: $(CDIR)/data.h
fillem.o: $(CDIR)/extern.h
fillem.o: mach.c
fillem.o: mach.h
fillem.o: $(CDIR)/param.h
fillem.o: $(CDIR)/regvar.h
fillem.o: $(CDIR)/result.h
fillem.o: tables.h
fillem.o: $(CDIR)/types.h
gencode.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
gencode.o: $(CDIR)/data.h
gencode.o: $(CDIR)/extern.h
gencode.o: $(CDIR)/param.h
gencode.o: $(CDIR)/result.h
gencode.o: tables.h
gencode.o: $(CDIR)/types.h
glosym.o: $(CDIR)/glosym.h
glosym.o: $(CDIR)/param.h
glosym.o: tables.h
glosym.o: $(CDIR)/types.h
label.o: $(CDIR)/label.h
label.o: $(CDIR)/param.h
label.o: tables.h
label.o: $(CDIR)/types.h
main.o: $(CDIR)/param.h
main.o: tables.h
move.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
move.o: $(CDIR)/data.h
move.o: $(CDIR)/extern.h
move.o: $(CDIR)/param.h
move.o: $(CDIR)/result.h
move.o: tables.h
move.o: $(CDIR)/types.h
nextem.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
nextem.o: $(CDIR)/data.h
nextem.o: $(CDIR)/extern.h
nextem.o: $(CDIR)/param.h
nextem.o: $(CDIR)/result.h
nextem.o: tables.h
nextem.o: $(CDIR)/types.h
reg.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
reg.o: $(CDIR)/data.h
reg.o: $(CDIR)/extern.h
reg.o: $(CDIR)/param.h
reg.o: $(CDIR)/result.h
reg.o: tables.h
reg.o: $(CDIR)/types.h
regvar.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
regvar.o: $(CDIR)/data.h
regvar.o: $(CDIR)/extern.h
regvar.o: $(CDIR)/param.h
regvar.o: $(CDIR)/regvar.h
regvar.o: $(CDIR)/result.h
regvar.o: tables.h
regvar.o: $(CDIR)/types.h
salloc.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
salloc.o: $(CDIR)/data.h
salloc.o: $(CDIR)/extern.h
salloc.o: $(CDIR)/param.h
salloc.o: $(CDIR)/result.h
salloc.o: tables.h
salloc.o: $(CDIR)/types.h
state.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
state.o: $(CDIR)/data.h
state.o: $(CDIR)/extern.h
state.o: $(CDIR)/param.h
state.o: $(CDIR)/result.h
state.o: $(CDIR)/state.h
state.o: tables.h
state.o: $(CDIR)/types.h
subr.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
subr.o: $(CDIR)/data.h
subr.o: $(CDIR)/extern.h
subr.o: $(CDIR)/param.h
subr.o: $(CDIR)/result.h
subr.o: tables.h
subr.o: $(CDIR)/types.h
var.o: $(CDIR)/data.h $(EMHOME)/h/cgg_cg.h
var.o: $(CDIR)/param.h
var.o: $(CDIR)/result.h
var.o: tables.h
var.o: $(CDIR)/types.h

67
mach/i86/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)
CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
$(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
COBJ = comm3.o comm4.o comm5.o \
comm6.o comm7.o comm8.o
MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
all: as
install:all
../../install as
cmp:
-../../compare as
clean:
rm -f *.o as as.[cy] y.tab.h
pr: $(MACH)
@pr -n $(MACH)
opr:
make pr | opr
as: $(COBJ) as.o
$(CC) $(LDFLAGS) $(COBJ) as.o $(LIBOBJ) -o as
as.y: $(CDIR)/comm2.y
$(CPP) -P -I. -I$h $(DEF) $(CDIR)/comm2.y >as.y
-@if test -f Expect ; then cat Expect ; else echo "expect 1 shift/reduce conflict"; fi
lint: $(CSRC) as.c
lint $(INCL) $(CSRC) as.c
y.tab.h: as.c
$(COBJ): y.tab.h
$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
as.y: mach2.c
comm3.o: mach3.c
as.y: mach4.c
comm8.o: mach5.c
comm3.o: $(CDIR)/comm3.c
$(CC) -c $(CFLAGS) $(CDIR)/comm3.c
comm4.o: $(CDIR)/comm4.c
$(CC) -c $(CFLAGS) $(CDIR)/comm4.c
comm5.o: $(CDIR)/comm5.c
$(CC) -c $(CFLAGS) $(CDIR)/comm5.c
comm6.o: $(CDIR)/comm6.c
$(CC) -c $(CFLAGS) $(CDIR)/comm6.c
comm7.o: $(CDIR)/comm7.c
$(CC) -c $(CFLAGS) $(CDIR)/comm7.c
comm8.o: $(CDIR)/comm8.c
$(CC) -c $(CFLAGS) $(CDIR)/comm8.c

9
mach/i86/as/READ_ME Normal file
View File

@@ -0,0 +1,9 @@
The mach?.c files in this directory were made for an earlier version of
the universal assembler and are too dependent on its innards.
I have no idea in what way they should be changed.
Duk Bekema
I adapted them to the new framework. It appears to work now.
Ceriel Jacobs

26
mach/i86/ce/Makefile Normal file
View File

@@ -0,0 +1,26 @@
EMHOME = ../../..
CEG = $(EMHOME)/lib/ceg/util
OBJ = obj
all:
make -f $(CEG)/make_asobj "OBJ="$(OBJ)
install:
make -f $(CEG)/make_asobj "OBJ="$(OBJ) install
cmp:
-make -f $(CEG)/make_asobj "OBJ="$(OBJ) cmp
pr:
@pr Makefile EM_table mach.h mach.c as_table as.h as.c
opr:
make pr | opr
# total cleanup
clean:
make -f $(CEG)/make_asobj "OBJ="$(OBJ) clean
# only remove ce, ceg, and back directories
dclean:
make -f $(CEG)/make_asobj "OBJ="$(OBJ) dclean

25
mach/i86/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

30
mach/i86/libem/Makefile Normal file
View File

@@ -0,0 +1,30 @@
# $Header$
MACH=i86
all: libem_o.a end.o
install: all
../../install libem_o.a tail_em
../../install end.o end_em
cmp: all
-../../compare libem_o.a tail_em
-../../compare end.o end_em
end.o: end.s
$(MACH) -I../../../h -O -c end.s
libem_o.a: libem_s.a
ASAR=aal ; export ASAR ;\
march . libem_o.a
clean:
rm -f *.o libem_o.a
opr :
make pr | opr
pr:
@arch pv libem_s.a | pr -h `pwd`/libem_s.a
@pr `pwd`/end.s

4
mach/i86/libem/compmodule Executable file
View File

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

17
mach/i86/libem/end.s Normal file
View File

@@ -0,0 +1,17 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define endtext,enddata,endbss
.define _end,_etext,_edata
! $Header$
.sect .text
endtext:
_etext:
.align 2
.sect .data
enddata:
_edata:
.align 2
.sect .endsect
_end:
endbss:
.align 2

38
mach/i86/libem/fakfp.s Normal file
View File

@@ -0,0 +1,38 @@
.define .adf4, .adf8, .sbf4, .sbf8, .mlf4, .mlf8, .dvf4, .dvf8
.define .ngf4, .ngf8, .fif4, .fif8, .fef4, .fef8
.define .cif4, .cif8, .cuf4, .cuf8, .cfi, .cfu, .cff4, .cff8
.define .cmf4, .cmf8
.sect .text
.sect .rom
.sect .data
.sect .bss
! $Header$
.sect .text
.adf4:
.adf8:
.sbf4:
.sbf8:
.mlf4:
.mlf8:
.dvf4:
.dvf8:
.ngf4:
.ngf8:
.fif4:
.fif8:
.fef4:
.fef8:
.cif4:
.cif8:
.cuf4:
.cuf8:
.cfi:
.cfu:
.cff4:
.cff8:
.cmf4:
.cmf8:
mov ax,18 ! illegal instruction EILLINS
jmp .trp

40
mach/i86/libem/printf.s Normal file
View File

@@ -0,0 +1,40 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.sect .text
.define printf
.extern printc, printd, prints
printf:
pop bx ! return address
xchg ax,di
mov si,sp
1:
movb al,(di)
inc di
testb al,al
jz 6f
cmpb al,'%'
je 3f
2:
call printc
jmp 1b
3:
movb al,(di)
inc di
cmpb al,'c'
jne 4f
lods
jmp 2b
4:
cmpb al,'d'
jne 5f
lods
call printd
jmp 1b
5:
cmpb al,'s'
jne 2b
lods
call prints
jmp 1b
6:
jmp bx

5
mach/i86/libem/stop.s Normal file
View File

@@ -0,0 +1,5 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.sect .text
.define .stop
.stop:
int 3

16
mach/i86/libem/tail.s Normal file
View File

@@ -0,0 +1,16 @@
.define endtext,enddata,endbss
.define _end,_etext,_edata
! $Header$
.text
endtext:
_etext:
.align 2
.data
enddata:
_edata:
.align 2
.bss
_end:
endbss:
.align 2

22
mach/i86/libfp/Makefile Normal file
View File

@@ -0,0 +1,22 @@
EMHOME=../../..
SUF=o
MAKEFILE=$(EMHOME)/mach/proto/fp/Makefile
MACHDEF="MACH=i86" "SUF=$(SUF)" "ASAR=aal"
all:
make -f $(MAKEFILE) $(MACHDEF) all
install:
make -f $(MAKEFILE) $(MACHDEF) install
cmp: all
-../../compare FP_$(MACH).a tail_fp
clean:
make -f $(MAKEFILE) $(MACHDEF) clean
opr:
make pr | opr
pr:
@pr Makefile

27
mach/i86/libsys/Makefile Normal file
View File

@@ -0,0 +1,27 @@
# $Header$
MACH=i86
all: libmon_o.a head_em.o
install: all
../../install libmon_o.a tail_mon
../../install head_em.o head_em
cmp: all
-../../compare libmon_o.a tail_mon
-../../compare head_em.o head_em
libmon_o.a: libmon_s.a
ASAR=aal ; export ASAR ;\
march . libmon_o.a
head_em.o: head_em.s
$(MACH) -O -c head_em.s
clean:
rm -f *.o libmon_o.a
opr :
make pr | opr
pr:
@pr `pwd`/head_em.s
@arch pv libmon_s.a | pr -h `pwd`/libmon_s.a

4
mach/i86/libsys/compmodule Executable file
View File

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

197
mach/i86/ncg/Makefile Normal file
View File

@@ -0,0 +1,197 @@
# $Header$
EMHOME=../../..
#preprocessor flags for table
TABLEFLAGS=
#cgg options
CGGFLAGS=
PREFLAGS=-I$(EMHOME)/h -I. -I$(EMHOME)/mach -I$(EMHOME)/modules/h -DNDEBUG
PFLAGS=
CFLAGS=$(PREFLAGS) $(PFLAGS) -O
LDFLAGS=$(PFLAGS)
LINTOPTS=-bx
LIBS=$(EMHOME)/lib/em_data.a $(EMHOME)/modules/lib/libflt.a
CDIR=$(EMHOME)/mach/proto/ncg
CGG=$(EMHOME)/lib/ncgg
CPP=$(EMHOME)/lib/cpp
CFILES=$(CDIR)/codegen.c $(CDIR)/compute.c $(CDIR)/equiv.c $(CDIR)/fillem.c \
$(CDIR)/gencode.c $(CDIR)/glosym.c $(CDIR)/label.c $(CDIR)/main.c \
$(CDIR)/move.c $(CDIR)/nextem.c $(CDIR)/reg.c $(CDIR)/regvar.c \
$(CDIR)/salloc.c $(CDIR)/state.c $(CDIR)/subr.c $(CDIR)/var.c
OFILES=codegen.o compute.o equiv.o fillem.o gencode.o glosym.o label.o \
main.o move.o nextem.o reg.o regvar.o salloc.o state.o subr.o var.o
all: tables.c
make "EMHOME="$(EMHOME) cg
cg: tables.o $(OFILES)
$(CC) $(LDFLAGS) $(OFILES) tables.o $(LIBS) -o cg
tables.o: tables.c
$(CC) -c $(PREFLAGS) -I$(CDIR) tables.c
codegen.o: $(CDIR)/codegen.c
$(CC) -c $(CFLAGS) $(CDIR)/codegen.c
compute.o: $(CDIR)/compute.c
$(CC) -c $(CFLAGS) $(CDIR)/compute.c
equiv.o: $(CDIR)/equiv.c
$(CC) -c $(CFLAGS) $(CDIR)/equiv.c
fillem.o: $(CDIR)/fillem.c
$(CC) -c $(CFLAGS) $(CDIR)/fillem.c
gencode.o: $(CDIR)/gencode.c
$(CC) -c $(CFLAGS) $(CDIR)/gencode.c
glosym.o: $(CDIR)/glosym.c
$(CC) -c $(CFLAGS) $(CDIR)/glosym.c
label.o: $(CDIR)/label.c
$(CC) -c $(CFLAGS) $(CDIR)/label.c
main.o: $(CDIR)/main.c
$(CC) -c $(CFLAGS) $(CDIR)/main.c
move.o: $(CDIR)/move.c
$(CC) -c $(CFLAGS) $(CDIR)/move.c
nextem.o: $(CDIR)/nextem.c
$(CC) -c $(CFLAGS) $(CDIR)/nextem.c
reg.o: $(CDIR)/reg.c
$(CC) -c $(CFLAGS) $(CDIR)/reg.c
regvar.o: $(CDIR)/regvar.c
$(CC) -c $(CFLAGS) $(CDIR)/regvar.c
salloc.o: $(CDIR)/salloc.c
$(CC) -c $(CFLAGS) $(CDIR)/salloc.c
state.o: $(CDIR)/state.c
$(CC) -c $(CFLAGS) $(CDIR)/state.c
subr.o: $(CDIR)/subr.c
$(CC) -c $(CFLAGS) $(CDIR)/subr.c
var.o: $(CDIR)/var.c
$(CC) -c $(CFLAGS) $(CDIR)/var.c
install: all
$(EMHOME)/mach/install cg
cmp: all
-$(EMHOME)/mach/compare cg
tables.c: table $(CGG)
$(CPP) $(TABLEFLAGS) table | $(CGG) $(CGGFLAGS)
-cmp tables.h tables.H || cp tables.H tables.h
lint: $(CFILES) tables.c
lint $(LINTOPTS) $(PREFLAGS) -I$(CDIR) $(CFILES) tables.c
clean:
rm -f *.o tables.c tables.h debug.out cg tables.H
distr: tables.c
rm -f tables1.c tables1.h
cp tables.c tables1.c
cp tables.h tables1.h
chmod -w tables1.[ch]
codegen.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
codegen.o: $(CDIR)/data.h
codegen.o: $(CDIR)/equiv.h
codegen.o: $(CDIR)/extern.h
codegen.o: $(CDIR)/param.h
codegen.o: $(CDIR)/result.h
codegen.o: $(CDIR)/state.h
codegen.o: tables.h
codegen.o: $(CDIR)/types.h
compute.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
compute.o: $(CDIR)/data.h
compute.o: $(CDIR)/extern.h
compute.o: $(CDIR)/glosym.h
compute.o: $(CDIR)/label.h
compute.o: $(CDIR)/param.h
compute.o: $(CDIR)/result.h
compute.o: tables.h
compute.o: $(CDIR)/types.h
equiv.o: $(CDIR)/assert.h
equiv.o: $(CDIR)/data.h $(EMHOME)/h/cgg_cg.h
equiv.o: $(CDIR)/equiv.h
equiv.o: $(CDIR)/extern.h
equiv.o: $(CDIR)/param.h
equiv.o: $(CDIR)/result.h
equiv.o: tables.h
equiv.o: $(CDIR)/types.h
fillem.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
fillem.o: $(CDIR)/data.h
fillem.o: $(CDIR)/extern.h
fillem.o: mach.c
fillem.o: mach.h
fillem.o: $(CDIR)/param.h
fillem.o: $(CDIR)/regvar.h
fillem.o: $(CDIR)/result.h
fillem.o: tables.h
fillem.o: $(CDIR)/types.h
gencode.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
gencode.o: $(CDIR)/data.h
gencode.o: $(CDIR)/extern.h
gencode.o: $(CDIR)/param.h
gencode.o: $(CDIR)/result.h
gencode.o: tables.h
gencode.o: $(CDIR)/types.h
glosym.o: $(CDIR)/glosym.h
glosym.o: $(CDIR)/param.h
glosym.o: tables.h
glosym.o: $(CDIR)/types.h
label.o: $(CDIR)/label.h
label.o: $(CDIR)/param.h
label.o: tables.h
label.o: $(CDIR)/types.h
main.o: $(CDIR)/param.h
main.o: tables.h
move.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
move.o: $(CDIR)/data.h
move.o: $(CDIR)/extern.h
move.o: $(CDIR)/param.h
move.o: $(CDIR)/result.h
move.o: tables.h
move.o: $(CDIR)/types.h
nextem.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
nextem.o: $(CDIR)/data.h
nextem.o: $(CDIR)/extern.h
nextem.o: $(CDIR)/param.h
nextem.o: $(CDIR)/result.h
nextem.o: tables.h
nextem.o: $(CDIR)/types.h
reg.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
reg.o: $(CDIR)/data.h
reg.o: $(CDIR)/extern.h
reg.o: $(CDIR)/param.h
reg.o: $(CDIR)/result.h
reg.o: tables.h
reg.o: $(CDIR)/types.h
regvar.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
regvar.o: $(CDIR)/data.h
regvar.o: $(CDIR)/extern.h
regvar.o: $(CDIR)/param.h
regvar.o: $(CDIR)/regvar.h
regvar.o: $(CDIR)/result.h
regvar.o: tables.h
regvar.o: $(CDIR)/types.h
salloc.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
salloc.o: $(CDIR)/data.h
salloc.o: $(CDIR)/extern.h
salloc.o: $(CDIR)/param.h
salloc.o: $(CDIR)/result.h
salloc.o: tables.h
salloc.o: $(CDIR)/types.h
state.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
state.o: $(CDIR)/data.h
state.o: $(CDIR)/extern.h
state.o: $(CDIR)/param.h
state.o: $(CDIR)/result.h
state.o: $(CDIR)/state.h
state.o: tables.h
state.o: $(CDIR)/types.h
subr.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
subr.o: $(CDIR)/data.h
subr.o: $(CDIR)/extern.h
subr.o: $(CDIR)/param.h
subr.o: $(CDIR)/result.h
subr.o: tables.h
subr.o: $(CDIR)/types.h
var.o: $(CDIR)/data.h $(EMHOME)/h/cgg_cg.h
var.o: $(CDIR)/param.h
var.o: $(CDIR)/result.h
var.o: tables.h
var.o: $(CDIR)/types.h

21
mach/install Executable file
View File

@@ -0,0 +1,21 @@
case $# in
1) DEST="$1" ;;
2) DEST="$2" ;;
*) echo $0 [source] destination ;;
esac
MACH=`(cd .. ; basename \`pwd\`)`
mkdir ../../../lib/$MACH >/dev/null 2>&1
if cp "$1" ../../../lib/${MACH}/$DEST >/dev/null 2>&1 ||
{ rm -f ../../../lib/${MACH}/$DEST >/dev/null 2>&1 &&
cp "$1" ../../../lib/${MACH}/$DEST >/dev/null 2>&1
}
then
if (ar t ../../../lib/${MACH}/$DEST | grep __.SYMDEF ) >/dev/null 2>&1
then
ranlib ../../../lib/${MACH}/$DEST
fi
exit 0
else
echo Sorry, can not create "lib/${MACH}/$DEST".
exit 1
fi

67
mach/m68020/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)
CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
$(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
COBJ = comm3.o comm4.o comm5.o \
comm6.o comm7.o comm8.o
MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
all: as
install:all
../../install as
cmp:
-../../compare as
clean:
rm -f *.o as as.[cy] y.tab.h
pr: $(MACH)
@pr -n $(MACH)
opr:
make pr | opr
as: $(COBJ) as.o
$(CC) $(LDFLAGS) $(COBJ) as.o $(LIBOBJ) -o as
as.y: $(CDIR)/comm2.y
$(CPP) -P -I. -I$h $(DEF) $(CDIR)/comm2.y >as.y
-@if test -f Expect ; then cat Expect ; else echo "expect 1 shift/reduce conflict"; fi
lint: $(CSRC) as.c
lint $(INCL) $(CSRC) as.c
y.tab.h: as.c
$(COBJ): y.tab.h
$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
as.y: mach2.c
comm3.o: mach3.c
as.y: mach4.c
comm8.o: mach5.c
comm3.o: $(CDIR)/comm3.c
$(CC) -c $(CFLAGS) $(CDIR)/comm3.c
comm4.o: $(CDIR)/comm4.c
$(CC) -c $(CFLAGS) $(CDIR)/comm4.c
comm5.o: $(CDIR)/comm5.c
$(CC) -c $(CFLAGS) $(CDIR)/comm5.c
comm6.o: $(CDIR)/comm6.c
$(CC) -c $(CFLAGS) $(CDIR)/comm6.c
comm7.o: $(CDIR)/comm7.c
$(CC) -c $(CFLAGS) $(CDIR)/comm7.c
comm8.o: $(CDIR)/comm8.c
$(CC) -c $(CFLAGS) $(CDIR)/comm8.c

26
mach/m68020/ce/Makefile Normal file
View File

@@ -0,0 +1,26 @@
EMHOME = ../../..
CEG = $(EMHOME)/lib/ceg/util
OBJ = obj
all:
make -f $(CEG)/make_asobj "OBJ="$(OBJ)
install:
make -f $(CEG)/make_asobj "OBJ="$(OBJ) install
cmp:
-make -f $(CEG)/make_asobj "OBJ="$(OBJ) cmp
pr:
@pr Makefile EM_table mach.h mach.c as_table as.h as.c
opr:
make pr | opr
# total cleanup
clean:
make -f $(CEG)/make_asobj "OBJ="$(OBJ) clean
# only remove ce, ceg, and back directories
dclean:
make -f $(CEG)/make_asobj "OBJ="$(OBJ) dclean

22
mach/m68020/cv/Makefile Normal file
View File

@@ -0,0 +1,22 @@
CFLAGS=-O -I../../../h
LDFLAGS =
cv: cv.o
$(CC) -o cv $(LDFLAGS) cv.o
install: ins_cv
ins_cv: cv
../../install cv
cmp: cmp_cv
cmp_cv: cv
-../../compare cv
opr:
make pr | opr
pr:
@pr `pwd`/cv.c
clean:
-rm -f *.o *.old cv

View File

@@ -0,0 +1,38 @@
# $Header$
MACH=m68020
ASAR=aal
all: libem_o.a end.a
install: all
../../install libem_o.a tail_em
../../install end.a end_em
cmp: all
-../../compare libem_o.a tail_em
-../../compare end.a end_em
end.a: em_end.s etext.s edata.s end.s
$(MACH) -I../../../h -c em_end.s
$(MACH) -I../../../h -c edata.s
$(MACH) -I../../../h -c etext.s
$(MACH) -I../../../h -c end.s
$(ASAR) cr end.a em_end.o etext.o edata.o end.o
libem_o.a: libem_s.a
ASAR=$(ASAR) ; export ASAR ;\
march . libem_o.a
clean:
rm -f *.o libem_o.a end.a
opr :
make pr | opr
pr:
@arch pv libem_s.a | pr -h `pwd`/libem_s.a
@pr `pwd`/em_end.s `pwd`/edata.s `pwd`/etext.s `pwd`/end.s
trpstr.s: trpstr.c strscript
sh strscript
distr: trpstr.s

4
mach/m68020/libem/compmodule Executable file
View File

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

View File

@@ -0,0 +1,9 @@
.sect .text
.sect .rom
.sect .data
.sect .bss
.define _edata
.sect .data
.align 4
.sect .data
_edata:

View File

@@ -0,0 +1,22 @@
.sect .text
.sect .rom
.sect .data
.sect .bss
.define endtext,enddata,endbss,__end
.sect .text
.align 4
.sect .rom
.align 4
.sect .data
.align 4
.sect .bss
.align 4
.sect .end ! only for declaration of _end, __end and endbss.
.sect .text
endtext:
.sect .data
enddata:
.sect .end
__end:
endbss:

7
mach/m68020/libem/end.s Normal file
View File

@@ -0,0 +1,7 @@
.sect .text
.sect .rom
.sect .data
.sect .bss
.define _end
.sect .end ! only for declaration of _end, __end and endbss.
_end:

View File

@@ -0,0 +1,9 @@
.sect .text
.sect .rom
.sect .data
.sect .bss
.define _etext
.sect .text
.align 4
.sect .text
_etext:

39
mach/m68020/libem/fakfp.s Normal file
View File

@@ -0,0 +1,39 @@
.define .adf4, .adf8, .sbf4, .sbf8, .mlf4, .mlf8, .dvf4, .dvf8
.define .ngf4, .ngf8, .fif4, .fif8, .fef4, .fef8
.define .cif4, .cif8, .cuf4, .cuf8, .cfi, .cfu, .cff4, .cff8
.define .cmf4, .cmf8
.sect .text
.sect .rom
.sect .data
.sect .bss
! $Header$
.sect .text
.adf4:
.adf8:
.sbf4:
.sbf8:
.mlf4:
.mlf8:
.dvf4:
.dvf8:
.ngf4:
.ngf8:
.fif4:
.fif8:
.fef4:
.fef8:
.cif4:
.cif8:
.cuf4:
.cuf8:
.cfi:
.cfu:
.cff4:
.cff8:
.cmf4:
.cmf8:
move.l #18,-(sp)
jsr (.trp)
rts

View File

@@ -0,0 +1,83 @@
.define _printf, _putchar, _getal, _char
.sect .text
.sect .rom
.sect .data
.sect .bss
.sect .bss
_getal:
.space 12
_char:
.space 1
.align 4
.sect .data
hexs:
.ascii "0123456789abcdef"
.align 4
.sect .text
_printf:
movem.l d0/d1/d2/a0/a1/a2/a3/a4/a5/a6, -(sp)
lea (44, sp), a6 ! a6 <- address of arguments
move.l (a6)+, a5 ! a5 <- address of format
next: move.b (a5)+, d0
beq out
cmp.b #'%', d0
beq procnt
put: move.l d0, -(sp)
jsr (_putchar) ! long argument on stack
tst.l (sp)+
bra next
procnt: move.b (a5)+, d0
cmp.b #'d', d0 ! NOTE: %d means unsigned.
beq digit
cmp.b #'x', d0
beq hex
cmp.b #'s', d0
beq string
cmp.b #'%', d0 ! second % has to be printed.
beq put
tst.b -(a5) ! normal char should be printed
bra next
string: move.l (a6)+, a2 ! a2 <- address of string
sloop: move.b (a2)+, d0
beq next
move.l d0, -(sp)
jsr (_putchar) ! long argument on stack
tst.l (sp)+
bra sloop
digit: move.l (a6)+, d1 ! d1 <- integer
move.l #_getal+12, a2 ! a2 <- ptr to last part of buf
clr.b -(a2) ! stringterminator
1: divul.l #10, d2:d1 ! d1 <- qotient; d2 <- remainder
add.l #'0', d2
move.b d2, -(a2)
tst.l d1 ! if quotient = 0 then ready
bne 1b
bra sloop ! print digitstring.
hex: move.l (a6)+, d1 ! d1 <- integer
move.l #_getal+12, a2 ! a2 <- ptr to last part of buf
clr.b -(a2) ! stringterminator
move.l #7, d2 ! loop control
1: move.l d1, d0
and.l #15, d0
move.b (hexs,d0.w), -(a2) ! hex digit
asr.l #4, d1
dbf d2, 1b
bra sloop
out:
movem.l (sp)+, d0/d1/d2/a0/a1/a2/a3/a4/a5/a6
rts
_putchar:
move.l #1, -(sp)
pea (11,sp)
move.l #1, -(sp)
jsr (_write)
lea (12, sp), sp
rts
.align 2

View File

@@ -0,0 +1,3 @@
m68020 -c.s -L -LIB -I../../../h trpstr.c
sed s/_trpstr/.trpstr/g < trpstr.s > trpstr.ss
mv trpstr.ss trpstr.s

View File

@@ -0,0 +1,22 @@
EMHOME=../../..
SUF=o
MAKEFILE=$(EMHOME)/mach/proto/fp/Makefile
MACHDEF="MACH=m68020" "CFLAGS=-DUSE_DIVIDE" "SUF=$(SUF)" "ASAR=aal"
all:
make -f $(MAKEFILE) $(MACHDEF) all
install:
make -f $(MAKEFILE) $(MACHDEF) install
cmp: all
-../../compare FP_$(MACH).a tail_fp
clean:
make -f $(MAKEFILE) $(MACHDEF) clean
opr:
make pr | opr
pr:
@pr Makefile

View File

@@ -0,0 +1,29 @@
# $Header$
MACH=m68020
all: libmon_o.a head_em.o
install: all
../../install head_em.o head_em
../../install libmon_o.a tail_mon
cmp: all
-../../compare head_em.o head_em
-../../compare libmon_o.a tail_mon
libmon_o.a: libmon_s.a
ASAR=aal ; export ASAR ;\
march . libmon_o.a
head_em.o: head_em.s
$(MACH) -I../../../h -c head_em.s
clean:
rm -f *.o libmon_o.a
opr :
make pr | opr
pr:
@pr `pwd`/head_em.s
@arch pv libmon_s.a | pr -h `pwd`/libmon_s.a

4
mach/m68020/libsys/compmodule Executable file
View File

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

197
mach/m68020/ncg/Makefile Normal file
View File

@@ -0,0 +1,197 @@
# $Header$
EMHOME=../../..
#preprocessor flags for table
TABLEFLAGS=
#cgg options
CGGFLAGS=
PREFLAGS=-I$(EMHOME)/h -I. -I$(EMHOME)/mach -I$(EMHOME)/modules/h -DNDEBUG
PFLAGS=
CFLAGS=$(PREFLAGS) $(PFLAGS) -O
LDFLAGS=$(PFLAGS)
LINTOPTS=-bx
LIBS=$(EMHOME)/lib/em_data.a $(EMHOME)/modules/lib/libflt.a
CDIR=$(EMHOME)/mach/proto/ncg
CGG=$(EMHOME)/lib/ncgg
CPP=$(EMHOME)/lib/cpp
CFILES=$(CDIR)/codegen.c $(CDIR)/compute.c $(CDIR)/equiv.c $(CDIR)/fillem.c \
$(CDIR)/gencode.c $(CDIR)/glosym.c $(CDIR)/label.c $(CDIR)/main.c \
$(CDIR)/move.c $(CDIR)/nextem.c $(CDIR)/reg.c $(CDIR)/regvar.c \
$(CDIR)/salloc.c $(CDIR)/state.c $(CDIR)/subr.c $(CDIR)/var.c
OFILES=codegen.o compute.o equiv.o fillem.o gencode.o glosym.o label.o \
main.o move.o nextem.o reg.o regvar.o salloc.o state.o subr.o var.o
all: tables.c
make "EMHOME="$(EMHOME) cg
cg: tables.o $(OFILES)
$(CC) $(LDFLAGS) $(OFILES) tables.o $(LIBS) -o cg
tables.o: tables.c
$(CC) -c $(PREFLAGS) -I$(CDIR) tables.c
codegen.o: $(CDIR)/codegen.c
$(CC) -c $(CFLAGS) $(CDIR)/codegen.c
compute.o: $(CDIR)/compute.c
$(CC) -c $(CFLAGS) $(CDIR)/compute.c
equiv.o: $(CDIR)/equiv.c
$(CC) -c $(CFLAGS) $(CDIR)/equiv.c
fillem.o: $(CDIR)/fillem.c
$(CC) -c $(CFLAGS) $(CDIR)/fillem.c
gencode.o: $(CDIR)/gencode.c
$(CC) -c $(CFLAGS) $(CDIR)/gencode.c
glosym.o: $(CDIR)/glosym.c
$(CC) -c $(CFLAGS) $(CDIR)/glosym.c
label.o: $(CDIR)/label.c
$(CC) -c $(CFLAGS) $(CDIR)/label.c
main.o: $(CDIR)/main.c
$(CC) -c $(CFLAGS) $(CDIR)/main.c
move.o: $(CDIR)/move.c
$(CC) -c $(CFLAGS) $(CDIR)/move.c
nextem.o: $(CDIR)/nextem.c
$(CC) -c $(CFLAGS) $(CDIR)/nextem.c
reg.o: $(CDIR)/reg.c
$(CC) -c $(CFLAGS) $(CDIR)/reg.c
regvar.o: $(CDIR)/regvar.c
$(CC) -c $(CFLAGS) $(CDIR)/regvar.c
salloc.o: $(CDIR)/salloc.c
$(CC) -c $(CFLAGS) $(CDIR)/salloc.c
state.o: $(CDIR)/state.c
$(CC) -c $(CFLAGS) $(CDIR)/state.c
subr.o: $(CDIR)/subr.c
$(CC) -c $(CFLAGS) $(CDIR)/subr.c
var.o: $(CDIR)/var.c
$(CC) -c $(CFLAGS) $(CDIR)/var.c
install: all
$(EMHOME)/mach/install cg
cmp: all
-$(EMHOME)/mach/compare cg
tables.c: table $(CGG)
$(CPP) $(TABLEFLAGS) table | $(CGG) $(CGGFLAGS)
-cmp tables.h tables.H || cp tables.H tables.h
lint: $(CFILES) tables.c
lint $(LINTOPTS) $(PREFLAGS) -I$(CDIR) $(CFILES) tables.c
clean:
rm -f *.o tables.c tables.h debug.out cg tables.H
distr: tables.c
rm -f tables1.c tables1.h
cp tables.c tables1.c
cp tables.h tables1.h
chmod -w tables1.[ch]
codegen.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
codegen.o: $(CDIR)/data.h
codegen.o: $(CDIR)/equiv.h
codegen.o: $(CDIR)/extern.h
codegen.o: $(CDIR)/param.h
codegen.o: $(CDIR)/result.h
codegen.o: $(CDIR)/state.h
codegen.o: tables.h
codegen.o: $(CDIR)/types.h
compute.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
compute.o: $(CDIR)/data.h
compute.o: $(CDIR)/extern.h
compute.o: $(CDIR)/glosym.h
compute.o: $(CDIR)/label.h
compute.o: $(CDIR)/param.h
compute.o: $(CDIR)/result.h
compute.o: tables.h
compute.o: $(CDIR)/types.h
equiv.o: $(CDIR)/assert.h
equiv.o: $(CDIR)/data.h $(EMHOME)/h/cgg_cg.h
equiv.o: $(CDIR)/equiv.h
equiv.o: $(CDIR)/extern.h
equiv.o: $(CDIR)/param.h
equiv.o: $(CDIR)/result.h
equiv.o: tables.h
equiv.o: $(CDIR)/types.h
fillem.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
fillem.o: $(CDIR)/data.h
fillem.o: $(CDIR)/extern.h
fillem.o: mach.c
fillem.o: mach.h
fillem.o: $(CDIR)/param.h
fillem.o: $(CDIR)/regvar.h
fillem.o: $(CDIR)/result.h
fillem.o: tables.h
fillem.o: $(CDIR)/types.h
gencode.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
gencode.o: $(CDIR)/data.h
gencode.o: $(CDIR)/extern.h
gencode.o: $(CDIR)/param.h
gencode.o: $(CDIR)/result.h
gencode.o: tables.h
gencode.o: $(CDIR)/types.h
glosym.o: $(CDIR)/glosym.h
glosym.o: $(CDIR)/param.h
glosym.o: tables.h
glosym.o: $(CDIR)/types.h
label.o: $(CDIR)/label.h
label.o: $(CDIR)/param.h
label.o: tables.h
label.o: $(CDIR)/types.h
main.o: $(CDIR)/param.h
main.o: tables.h
move.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
move.o: $(CDIR)/data.h
move.o: $(CDIR)/extern.h
move.o: $(CDIR)/param.h
move.o: $(CDIR)/result.h
move.o: tables.h
move.o: $(CDIR)/types.h
nextem.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
nextem.o: $(CDIR)/data.h
nextem.o: $(CDIR)/extern.h
nextem.o: $(CDIR)/param.h
nextem.o: $(CDIR)/result.h
nextem.o: tables.h
nextem.o: $(CDIR)/types.h
reg.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
reg.o: $(CDIR)/data.h
reg.o: $(CDIR)/extern.h
reg.o: $(CDIR)/param.h
reg.o: $(CDIR)/result.h
reg.o: tables.h
reg.o: $(CDIR)/types.h
regvar.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
regvar.o: $(CDIR)/data.h
regvar.o: $(CDIR)/extern.h
regvar.o: $(CDIR)/param.h
regvar.o: $(CDIR)/regvar.h
regvar.o: $(CDIR)/result.h
regvar.o: tables.h
regvar.o: $(CDIR)/types.h
salloc.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
salloc.o: $(CDIR)/data.h
salloc.o: $(CDIR)/extern.h
salloc.o: $(CDIR)/param.h
salloc.o: $(CDIR)/result.h
salloc.o: tables.h
salloc.o: $(CDIR)/types.h
state.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
state.o: $(CDIR)/data.h
state.o: $(CDIR)/extern.h
state.o: $(CDIR)/param.h
state.o: $(CDIR)/result.h
state.o: $(CDIR)/state.h
state.o: tables.h
state.o: $(CDIR)/types.h
subr.o: $(CDIR)/assert.h $(EMHOME)/h/cgg_cg.h
subr.o: $(CDIR)/data.h
subr.o: $(CDIR)/extern.h
subr.o: $(CDIR)/param.h
subr.o: $(CDIR)/result.h
subr.o: tables.h
subr.o: $(CDIR)/types.h
var.o: $(CDIR)/data.h $(EMHOME)/h/cgg_cg.h
var.o: $(CDIR)/param.h
var.o: $(CDIR)/result.h
var.o: tables.h
var.o: $(CDIR)/types.h

42
mach/m68020/top/Makefile Normal file
View File

@@ -0,0 +1,42 @@
EMHOME=../../..
LIBS=$(EMHOME)/modules/lib/libstring.a
PREFLAGS=-I.
PFLAGS=
CFLAGS=$(PREFLAGS) $(PFLAGS) -O -DNDEBUG
LDFLAGS=$(PFLAGS)
LINTOPTS=-bx
CDIR=$(EMHOME)/mach/proto/top
CFILES=$(CDIR)/top.c $(CDIR)/queue.c
OFILES=top.o queue.o
all: gen.c
make top
top: $(OFILES)
$(CC) $(LDFLAGS) $(OFILES) $(LIBS) -o top
top.o: $(CDIR)/top.c gen.c
$(CC) -c $(CFLAGS) $(CDIR)/top.c
queue.o: $(CDIR)/queue.c
$(CC) -c $(CFLAGS) $(CDIR)/queue.c
install: all
$(EMHOME)/mach/install top
cmp: all
-$(EMHOME)/mach/compare top
gen.c: table
$(EMHOME)/lib/topgen table
lint: $(CFILES)
lint $(LINTOPTS) $(PREFLAGS) $(CFILES)
clean:
rm -f *.o gen.c gen.h top
top.o: gen.h
top.o: $(CDIR)/top.h
top.o: $(CDIR)/queue.h
queue.o: $(CDIR)/queue.h

67
mach/m68k2/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)
CSRC = $(CDIR)/comm3.c $(CDIR)/comm4.c $(CDIR)/comm5.c \
$(CDIR)/comm6.c $(CDIR)/comm7.c $(CDIR)/comm8.c
COBJ = comm3.o comm4.o comm5.o \
comm6.o comm7.o comm8.o
MACH = mach0.c mach1.c mach2.c mach3.c mach4.c mach5.c
COMM = $(CDIR)/comm0.h $(CDIR)/comm1.h $(CDIR)/comm2.y $(CSRC)
all: as
install:all
../../install as
cmp:
-../../compare as
clean:
rm -f *.o as as.[cy] y.tab.h
pr: $(MACH)
@pr -n $(MACH)
opr:
make pr | opr
as: $(COBJ) as.o
$(CC) $(LDFLAGS) $(COBJ) as.o $(LIBOBJ) -o as
as.y: $(CDIR)/comm2.y
$(CPP) -P -I. -I$h $(DEF) $(CDIR)/comm2.y >as.y
-@if test -f Expect ; then cat Expect ; else echo "expect 1 shift/reduce conflict"; fi
lint: $(CSRC) as.c
lint $(INCL) $(CSRC) as.c
y.tab.h: as.c
$(COBJ): y.tab.h
$(COBJ) as.y: $(CDIR)/comm0.h mach0.c
$(COBJ) as.y: $(CDIR)/comm1.h mach1.c
as.y: mach2.c
comm3.o: mach3.c
as.y: mach4.c
comm8.o: mach5.c
comm3.o: $(CDIR)/comm3.c
$(CC) -c $(CFLAGS) $(CDIR)/comm3.c
comm4.o: $(CDIR)/comm4.c
$(CC) -c $(CFLAGS) $(CDIR)/comm4.c
comm5.o: $(CDIR)/comm5.c
$(CC) -c $(CFLAGS) $(CDIR)/comm5.c
comm6.o: $(CDIR)/comm6.c
$(CC) -c $(CFLAGS) $(CDIR)/comm6.c
comm7.o: $(CDIR)/comm7.c
$(CC) -c $(CFLAGS) $(CDIR)/comm7.c
comm8.o: $(CDIR)/comm8.c
$(CC) -c $(CFLAGS) $(CDIR)/comm8.c

6
mach/m68k2/cg/fppsim.h Normal file
View File

@@ -0,0 +1,6 @@
/* $Header$ */
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* #define NOFLOAT /* define when not using fpp simulator */

22
mach/m68k2/cv/Makefile Normal file
View File

@@ -0,0 +1,22 @@
CFLAGS=-I../../../h -O
LDFLAGS =
cv: cv.o
$(CC) -o cv $(LDFLAGS) cv.o
install: ins_cv
ins_cv: cv
../../install cv
cmp: cmp_cv
cmp_cv: cv
-../../compare cv
opr:
make pr | opr
pr:
@pr `pwd`/cv.c
clean:
-rm -f *.o *.old cv

22
mach/m68k2/dl/Makefile Normal file
View File

@@ -0,0 +1,22 @@
EMHOME=../../..
OBJLIB=$(EMHOME)/modules/lib/libobject.a
head: dl
dl: dl.c
$(CC) -I$(EMHOME)/h -o dl dl.c $(OBJLIB)
install: head
@echo Nothing is installed
cmp: head
@echo Nothing is compared
clean:
rm -f *.o
pr:
@pr `pwd`/Makefile `pwd`/dl.c
opr:
make pr | opr

33
mach/m68k2/libem/Makefile Normal file
View File

@@ -0,0 +1,33 @@
# $Header$
MACH=m68k2
ASAR=aal
all: libem_o.a end.a
install: all
../../install libem_o.a tail_em
../../install end.a end_em
cmp: all
-../../compare libem_o.a tail_em
-../../compare end.a end_em
end.a: em_end.s etext.s edata.s end.s
$(MACH) -I../../../h -c em_end.s
$(MACH) -I../../../h -c edata.s
$(MACH) -I../../../h -c etext.s
$(MACH) -I../../../h -c end.s
$(ASAR) cr end.a em_end.o etext.o edata.o end.o
libem_o.a: libem_s.a
ASAR=$(ASAR) ; export ASAR ;\
march . libem_o.a
clean:
rm -f *.o libem_o.a end.a
opr :
make pr | opr
pr:
@arch pv libem_s.a | pr -h `pwd`/libem_s.a
@pr `pwd`/em_end.s `pwd`/edata.s `pwd`/etext.s `pwd`/end.s

4
mach/m68k2/libem/compmodule Executable file
View File

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

19
mach/m68k2/libem/cvf.s Normal file
View File

@@ -0,0 +1,19 @@
.define .cfi,.cif,.cfu,.cuf,.cff
.sect .text
.sect .rom
.sect .data
.sect .bss
.sect .text
! this is a dummy float conversion routine
.cfi:
.cif:
.cfu:
.cuf:
.cff:
move.l (sp)+,a0 ! return address
move (sp)+,d0 ! destination size
sub (sp)+,d0 ! diff. in sizes
sub d0,sp
jmp (a0)

9
mach/m68k2/libem/edata.s Normal file
View File

@@ -0,0 +1,9 @@
.sect .text
.sect .rom
.sect .data
.sect .bss
.define _edata
.sect .data
.align 4
.sect .data
_edata:

22
mach/m68k2/libem/em_end.s Normal file
View File

@@ -0,0 +1,22 @@
.sect .text
.sect .rom
.sect .data
.sect .bss
.define endtext,enddata,endbss,__end
.sect .text
.align 4
.sect .rom
.align 4
.sect .data
.align 4
.sect .bss
.align 4
.sect .end ! only for declaration of _end, __end and endbss.
.sect .text
endtext:
.sect .data
enddata:
.sect .end
__end:
endbss:

7
mach/m68k2/libem/end.s Normal file
View File

@@ -0,0 +1,7 @@
.sect .text
.sect .rom
.sect .data
.sect .bss
.define _end
.sect .end ! only for declaration of _end, __end and endbss.
_end:

9
mach/m68k2/libem/etext.s Normal file
View File

@@ -0,0 +1,9 @@
.sect .text
.sect .rom
.sect .data
.sect .bss
.define _etext
.sect .text
.align 4
.sect .text
_etext:

39
mach/m68k2/libem/ffp.s Normal file
View File

@@ -0,0 +1,39 @@
.define .adf4, .adf8, .sbf4, .sbf8, .mlf4, .mlf8, .dvf4, .dvf8
.define .ngf4, .ngf8, .fif4, .fif8, .fef4, .fef8
.define .cif4, .cif8, .cuf4, .cuf8, .cfi, .cfu, .cff4, .cff8
.define .cmf4, .cmf8
.sect .text
.sect .rom
.sect .data
.sect .bss
! $Header$
.sect .text
.adf4:
.adf8:
.sbf4:
.sbf8:
.mlf4:
.mlf8:
.dvf4:
.dvf8:
.ngf4:
.ngf8:
.fif4:
.fif8:
.fef4:
.fef8:
.cif4:
.cif8:
.cuf4:
.cuf8:
.cfi:
.cfu:
.cff4:
.cff8:
.cmf4:
.cmf8:
move.w #18,-(sp)
jsr .trp
rts

189
mach/m68k2/libem/printf.s Normal file
View File

@@ -0,0 +1,189 @@
.define _printn
.define _printf
.sect .text
.sect .rom
.sect .data
.sect .bss
.sect .text
_putchar:
move.w #1,-(sp)
pea 7(sp)
move.w #1,-(sp)
jsr _write
add.l #8,sp
rts
_printf:
link a6,#-12
.sect .data
_12:
.data2 28786
.data2 26990
.data2 29798
.data2 11875
.data2 0
.sect .text
pea 8+4(a6)
move.l (sp)+,-6(a6)
I004:
move.l 8+0(a6),-(sp)
move.l (sp),-(sp)
move.l (sp)+,a0
add #1,a0
move.l a0,-(sp)
move.l (sp)+,8+0(a6)
move.l (sp)+,a0
clr d0
move.b (a0),d0
move.w d0,-(sp)
move.w (sp),-(sp)
move.w (sp)+,-2(a6)
move.w #37,-(sp)
move.w (sp)+,d0
cmp (sp)+,d0
beq I005
move.w -2(a6),-(sp)
tst (sp)+
beq I002
move.w -2(a6),-(sp)
jsr _putchar
add #2,sp
jmp I004
I005:
move.l 8+0(a6),-(sp)
move.l (sp),-(sp)
move.l (sp)+,a0
add #1,a0
move.l a0,-(sp)
move.l (sp)+,8+0(a6)
move.l (sp)+,a0
clr d0
move.b (a0),d0
move.w d0,-(sp)
move.w (sp)+,-2(a6)
move.w -2(a6),-(sp)
move.w #100,-(sp)
move.w (sp)+,d0
cmp (sp)+,d0
beq I008
move.w -2(a6),-(sp)
move.w #117,-(sp)
move.w (sp)+,d0
cmp (sp)+,d0
bne I007
I008:
move.l -6(a6),-(sp)
move.l (sp)+,a0
add #2,a0
move.l a0,-(sp)
move.l (sp),-(sp)
move.l (sp)+,-6(a6)
move.l (sp)+,a0
move.w -2(a0),-(sp)
move.w (sp)+,-8(a6)
move.w -2(a6),-(sp)
move.w #100,-(sp)
move.w (sp)+,d0
cmp (sp)+,d0
bne I009
move.w -8(a6),-(sp)
tst (sp)+
bge I009
move.w #0,-(sp)
move.w -8(a6),-(sp)
move.w (sp)+,d0
move.w (sp)+,d1
sub d0,d1
move.w d1,-(sp)
move.w (sp)+,-8(a6)
move.w #45,-(sp)
jsr _putchar
add #2,sp
I009:
move.w -8(a6),-(sp)
jsr _printn
add #2,sp
jmp I004
I007:
move.w -2(a6),-(sp)
move.w #115,-(sp)
move.w (sp)+,d0
cmp (sp)+,d0
bne I004
move.l -6(a6),-(sp)
move.l (sp)+,a0
add #4,a0
move.l a0,-(sp)
move.l (sp),-(sp)
move.l (sp)+,-6(a6)
move.l (sp)+,a0
move.l -4(a0),-(sp)
move.l (sp)+,-12(a6)
I00c:
move.l -12(a6),-(sp)
move.l (sp),-(sp)
move.l (sp)+,a0
add #1,a0
move.l a0,-(sp)
move.l (sp)+,-12(a6)
move.l (sp)+,a0
clr d0
move.b (a0),d0
move.w d0,-(sp)
move.w (sp),-(sp)
move.w (sp)+,-2(a6)
tst (sp)+
beq I004
move.w -2(a6),-(sp)
jsr _putchar
add #2,sp
jmp I00c
I002:
unlk a6
rts
_printn:
link a6,#-2
.sect .data
_15:
.data2 12337
.data2 12851
.data2 13365
.data2 13879
.data2 14393
.data2 0
.sect .text
move.w 8+0(a6),-(sp)
move.w #10,-(sp)
move.w (sp)+,d0
clr.l d1
move.w (sp)+,d1
divu d0,d1
move.w d1,-(sp)
move.w (sp),-(sp)
move.w (sp)+,-2(a6)
tst (sp)+
beq I013
move.w -2(a6),-(sp)
jsr _printn
add #2,sp
I013:
pea _15
move.w 8+0(a6),-(sp)
move.w #10,-(sp)
move.w (sp)+,d0
clr.l d1
move.w (sp)+,d1
divu d0,d1
swap d1
move.w d1,-(sp)
move.w (sp)+,d0
ext.l d0
add.l (sp)+,d0
move.l d0,-(sp)
move.l (sp)+,a0
clr d0
move.b (a0),d0
move.w d0,-(sp)
jsr _putchar
add #2,sp
unlk a6
rts

22
mach/m68k2/libfp/Makefile Normal file
View File

@@ -0,0 +1,22 @@
EMHOME=../../..
SUF=o
MAKEFILE=$(EMHOME)/mach/proto/fp/Makefile
MACHDEF="MACH=m68k2" "SUF=$(SUF)" "ASAR=aal"
all:
make -f $(MAKEFILE) $(MACHDEF) all
install:
make -f $(MAKEFILE) $(MACHDEF) install
cmp: all
-../../compare FP_$(MACH).a tail_fp
clean:
make -f $(MAKEFILE) $(MACHDEF) clean
opr:
make pr | opr
pr:
@pr Makefile

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