fixup commit for tag 'dist2'

This commit is contained in:
cvs2hg
1985-02-17 00:57:20 +00:00
parent 9f45dd0650
commit 3f3bddef8f
1707 changed files with 0 additions and 178572 deletions

View File

@@ -1,24 +0,0 @@
name "Intel 8086 assembler"
dir as
end
name "Intel 8086 backend"
dir cg
end
name "Intel 8086 download program(s)"
dir dl
end
name "Intel 8086 C libraries"
dir libcc
end
name "Intel 8086 EM library"
dir libem
end
name "Intel 8086 Pascal library"
dir libpc
end
name "Intel 8086 Stand-alone io library"
dir saio
end
name "Intel 8086 Basic library"
dir libbc
end

View File

@@ -1,116 +0,0 @@
/*
* (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
*
*/
#ifndef NORCSID
static char rcs_m[]= "$Header$" ;
static char rcs_mh[]= ID_MH ;
#endif
/*
* machine dependent back end routines for the Intel 8086
*/
con_part(sz,w) register sz; word w; {
while (part_size % sz)
part_size++;
if (part_size == TEM_WSIZE)
part_flush();
if (sz == 1) {
w &= 0xFF;
if (part_size)
w <<= 8;
part_word |= w;
} else {
assert(sz == 2);
part_word = w;
}
part_size += sz;
}
con_mult(sz) word sz; {
long l;
if (sz != 4)
fatal("bad icon/ucon size");
l = atol(str);
fprintf(codefile,"\t.word %d,%d\n",
(int)l&0xFFFF,(int)(l>>16)&0xFFFF);
}
con_float() {
register i;
i= argval ;
if (i!= 4 && i!= 8)
fatal("bad fcon size");
while ( i ) {
fprintf(codefile," .word 0,0\n") ;
i -=4 ;
}
}
/*
string holstr(n) word n; {
sprintf(str,hol_off,n,holno);
return(mystrcpy(str));
}
*/
prolog(nlocals) full nlocals; {
fprintf(codefile,"\tpush\tbp\n\tmov\tbp,sp\n");
switch (nlocals) {
case 4: printf("\tpush\tax\n");
case 2: printf("\tpush\tax\n");
case 0: break;
default:
printf("\tsub\tsp,%d\n",nlocals); break;
}
}
mes(type) word type ; {
int argt ;
switch ( (int)type ) {
case ms_ext :
for (;;) {
switch ( argt=getarg(
ptyp(sp_cend)|ptyp(sp_pnam)|sym_ptyp) ) {
case sp_cend :
return ;
default:
strarg(argt) ;
printf(".define %s\n",argstr) ;
break ;
}
}
default :
while ( getarg(any_ptyp) != sp_cend ) ;
break ;
}
}
char *segname[] = {
".text", /* SEGTXT */
".data", /* SEGCON */
".data", /* SEGROM */
".bss" /* SEGBSS */
};

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -1,20 +0,0 @@
MAKEFILE=../../proto/libg/Makefile
MACHDEF="MACH=i86" "SUF=s"
BCDEF="PREF=bc" "SUB=" "SRC=lang/basic/lib"
install:
make -f $(MAKEFILE) $(BCDEF) $(MACHDEF) tailcp
cmp:
make -f $(MAKEFILE) $(BCDEF) $(MACHDEF) tail
-../../compare head_bc
-../../compare tail_bc
clean:
-rm -f *.old *.[ce$(SUF)] tail* head*
opr:
make pr | opr
pr:
@pr Makefile

View File

@@ -1,2 +0,0 @@
${MACH?ack} -I../../../h ${MACHFL?} $1 1>&2
echo `basename $1 $2`.s

View File

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

View File

@@ -1,2 +0,0 @@
${MACH?ack} -I../../../h ${MACHFL?} $1 1>&2
echo `basename $1 $2`.s

View File

@@ -1,53 +0,0 @@
tail_em.a
adi.s
and.s
cii.s
cms.s
cmu4.s
com.s
csa2.s
csb2.s
cuu.s
dup.s
dvi.s
dvi4.s
dvu.s
dvu4.s
exg.s
fakfp.s
gto.s
iaar.s
ilar.s
inn.s
ior.s
isar.s
lar2.s
loi.s
mli.s
mli4.s
mon.s
ngi.s
nop.s
rck.s
rmi.s
rmi4.s
rmu.s
rmu4.s
rol.s
ror.s
sar2.s
sbi.s
set.s
sli.s
sri.s
sti.s
strhp.s
xor.s
error.s
unknown.s
fat.s
trp.s
stop.s
printf.s
print.s
tail.s

View File

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

View File

@@ -1,25 +0,0 @@
.define .adi
! $Header$
! #bytes in cx , top of stack in ax
.adi:
pop bx ! return address
cmp cx,2
jne 1f
pop cx
add ax,cx
jmp bx
1:
cmp cx,4
jne 9f
pop dx
pop cx
add ax,cx
pop cx
adc dx,cx
push dx
jmp bx
9:
mov ax,EODDZ
push ax
jmp .trp

View File

@@ -1,15 +0,0 @@
.define .and
! $Header$
! #bytes in cx
.and:
pop bx ! return address
mov di,sp
add di,cx
sar cx,1
1:
pop ax
and ax,(di)
stos
loop 1b
jmp bx

View File

@@ -1,37 +0,0 @@
.define .cii
.cii:
! $Header$
pop di ! return address
! pop cx, dest. size
! pop bx, src. size
! ax is first word of source
cmp bx,cx
je 8f
cmp bx,2
je 1f
cmp bx,4
jne 7f
cmp cx,2
jne 9f
pop dx
8:
jmp di
7: cmp bx,1
jne 9f
cmp cx,2
jne 9f
cbw
jmp 8b
1:
cmp cx,4
jne 9f
cwd
push dx
jmp di
9:
push ax ! push low source
mov ax,EILLINS
push ax
jmp .fat
jmp bx

View File

@@ -1,18 +0,0 @@
.define .cms
! $Header$
! #bytes in cx
.cms:
pop bx ! return address
mov dx,sp
mov si,dx
add dx,cx
mov di,dx
add dx,cx
sar cx,1
repe cmps
je 1f
inc cx
1:
mov sp,dx
jmp bx

View File

@@ -1,25 +0,0 @@
.define .cmu4
.cmu4:
! $Header$
pop bx ! return address
xor ax,ax
pop cx
pop dx
pop si
pop di
cmp di,dx
ja 1f
jb 2f
cmp si,cx
ja 1f
je 3f
2:
dec ax
3:
jmp bx
1:
inc ax
jmp bx
ret

View File

@@ -1,14 +0,0 @@
.define .com
! $Header$
! #bytes in cx
.com:
pop bx ! return address
mov di,sp
sar cx,1
1:
not (di)
inc di
inc di
loop 1b
jmp bx

View File

@@ -1,23 +0,0 @@
.define .csa2
.csa2:
! $Header$
! si, descriptor address
! bx, index
mov dx,(si) ! default
sub bx,2(si)
cmp bx,4(si)
ja 1f
sal bx,1
mov bx,6(bx)(si)
test bx,bx
jnz 2f
1:
mov bx,dx
test bx,bx
jnz 2f
mov ax,ECASE
push ax
jmp .fat
2:
jmp bx

View File

@@ -1,26 +0,0 @@
.define .csb2
.csb2:
! $Header$
!si, descriptor address
!dx, index
lods
xchg ax,bx ! default
lods
xchg ax,cx ! number of cases
1:
dec cx
jl 2f
lods
cmp ax,dx
lods
jne 1b
xchg ax,bx
2:
test bx,bx
jnz 3f
mov ax,ECASE
push ax
jmp .fat
3:
jmp bx

View File

@@ -1,35 +0,0 @@
.define .ciu
.define .cui
.define .cuu
.ciu:
.cui:
.cuu:
! $Header$
pop di ! return address
! pop cx, dest. size
! pop bx, source size
! ax is low word of source
cmp bx,cx
je 8f
cmp bx,2
je 1f
cmp bx,4
jne 9f
cmp cx,2
jne 9f
pop dx
8:
jmp di
1:
cmp cx,4
jne 9f
xor dx,dx
push dx
jmp di
9:
push ax ! to help debugging ?
mov ax,EILLINS
push ax
jmp .fat
jmp bx

View File

@@ -1,12 +0,0 @@
.define .dup
! $Header$
! #bytes in cx
.dup:
pop bx ! return address
mov si,sp
sub sp,cx
mov di,sp
sar cx,1
rep movs
jmp bx

View File

@@ -1,35 +0,0 @@
.define .dvi
! $Header$
! #bytes in ax
.dvi:
pop bx ! return address
cmp ax,2
jne 1f
pop ax
cwd
pop cx
idiv cx
push ax
jmp bx
1:
cmp ax,4
jne 9f
pop ax
pop dx
pop si
pop di
push bx
push di
push si
push dx
push ax
call .dvi4
pop bx
push cx
push ax
jmp bx
9:
mov ax,EODDZ
push ax
jmp .trp

View File

@@ -1,85 +0,0 @@
.define .dvi4
yl=2
yh=4
xl=6
xh=8
.dvi4:
! $Header$
mov si,sp ! copy of sp
mov bx,yl(si)
mov ax,yh(si)
cwd
mov di,dx
cmp dx,ax
jne 7f
and dx,dx
jge 1f
neg bx
je 7f
1:
xor dx,dx
mov cx,xl(si)
mov ax,xh(si)
and ax,ax
jge 2f
neg ax
neg cx
sbb ax,dx
not di
2:
div bx
xchg ax,cx
div bx ! cx = high abs(result), ax=low abs(result)
9:
and di,di
jge 1f
neg cx
neg ax
sbb cx,0
1:
! cx is high order result
! ax is low order result
ret 8
7:
push dx ! sign of y
mov di,ax
xor bx,bx
and di,di
jge 1f
neg di
neg yl(si)
sbb di,bx
1:
mov ax,xl(si)
mov dx,xh(si)
and dx,dx
jge 1f
neg dx
neg ax
sbb dx,bx
not -2(si)
1:
mov cx,16
1:
shl ax,1
rcl dx,1
rcl bx,1
cmp di,bx
ja 3f
jb 2f
cmp yl(si),dx
jbe 2f
3:
loop 1b
jmp 1f
2:
sub dx,yl(si)
sbb bx,di
inc ax
loop 1b
1:
pop di ! di=sign of result,ax= result
jmp 9b

View File

@@ -1,35 +0,0 @@
.define .dvu
! $Header$
! #bytes in ax
.dvu:
pop bx ! return address
cmp ax,2
jne 1f
pop ax
xor dx,dx
pop cx
div cx
push ax
jmp bx
1:
cmp ax,4
jne 9f
pop ax
pop dx
pop si
pop di
push bx
push di
push si
push dx
push ax
call .dvu4
pop bx
push cx
push ax
jmp bx
9:
mov ax,EODDZ
push ax
jmp .trp

View File

@@ -1,49 +0,0 @@
.define .dvu4
yl=2
yh=4
xl=6
xh=8
.dvu4:
! $Header$
mov si,sp ! copy of sp
mov bx,yl(si)
mov ax,yh(si)
or ax,ax
jne 7f
xor dx,dx
mov cx,xl(si)
mov ax,xh(si)
div bx
xchg ax,cx
div bx
9:
! cx is high order result
! ax is low order result
ret 8
7:
mov di,ax
xor bx,bx
mov ax,xl(si)
mov dx,xh(si)
mov cx,16
1:
shl ax,1
rcl dx,1
rcl bx,1
cmp di,bx
ja 3f
jb 2f
cmp yl(si),dx
jbe 2f
3:
loop 1b
jmp 9b
2:
sub dx,yl(si)
sbb bx,di
inc ax
loop 1b
jmp 9b

View File

@@ -1,30 +0,0 @@
.define .error
! $Header$
! ax is trap number
! all registers must be saved
! because return is possible
! May only be called with error no's <16
.error:
push bp
push si
push di
push dx
push cx
push bx
push ax
mov cx,ax
mov bx,1
sal bx,cl
test bx,(.ignmask)
jne 2f
call .trp
2:
pop ax
pop bx
pop cx
pop dx
pop di
pop si
pop bp
ret

View File

@@ -1,20 +0,0 @@
.define .exg
! $Header$
! #bytes in cx
.exg:
pop bx ! return address
mov dx,cx
mov si,sp
sub sp,cx
mov di,sp
rep movs
mov si,sp
mov di,sp
add di,dx
add di,dx
mov cx,dx
sar cx,1
rep movs
mov sp,si
jmp bx

View File

@@ -1,42 +0,0 @@
.define .mlf,.dvf,.ngf,.adf,.sbf,.cmf,.zrf,.fif,.fef
.define .mlf8,.dvf8,.ngf8,.adf8,.sbf8,.cmf8,.zrf8,.fif8,.fef8
.define .mlf4,.dvf4,.ngf4,.adf4,.sbf4,.cmf4,.zrf4,.fif4,.fef4
.define .cif,.cfi,.cuf,.cfu,.cff
.mlf:
.dvf:
.ngf:
.adf:
.sbf:
.cmf:
.zrf:
.fif:
.fef:
.mlf4:
.dvf4:
.ngf4:
.adf4:
.sbf4:
.cmf4:
.zrf4:
.fif4:
.fef4:
.mlf8:
.dvf8:
.ngf8:
.adf8:
.sbf8:
.cmf8:
.zrf8:
.fif8:
.fef8:
.cif:
.cfi:
.cuf:
.cfu:
.cff:
! $Header$
pop bx ! return address
mov ax,EILLINS
push ax
jmp .fat

View File

@@ -1,7 +0,0 @@
.define .fat
.fat:
! $Header$
call .trp
call .stop
! no return

View File

@@ -1,7 +0,0 @@
.define .gto
.gto:
! $Header$
mov bp,4(bx)
mov sp,2(bx)
jmp (bx)

View File

@@ -1,15 +0,0 @@
.define .iaar
.iaar:
! $Header$
pop bx
pop dx
cmp dx,2
jne .unknown
pop si ! descriptor address
pop ax ! index
pop di ! array base
sub ax,(si)
mul 4(si)
add di,ax
jmp bx

View File

@@ -1,13 +0,0 @@
.define .ilar
.ilar:
! $Header$
pop bx
pop dx
cmp dx,2
jne .unknown
pop di ! descriptor address
pop ax ! index
pop si ! array base
push bx
jmp .lar2

View File

@@ -1,29 +0,0 @@
.define .inn
! $Header$
! #bytes in cx
! bit # in ax
.inn:
pop bx ! return address
xor dx,dx
xor si,si
mov di,8
div di
mov di,sp
add di,ax
cmp ax,cx
xchg ax,dx
xchg ax,si ! ax:=si,si:=dx,does not change carry
jae 1f
movb dl,bits(si)
testb (di),dl
jz 1f
inc ax
1:
add sp,cx
! ax is result
jmp bx
.data
bits:
.byte 1,2,4,8,16,32,64,128

View File

@@ -1,15 +0,0 @@
.define .ior
! $Header$
! #bytes in cx
.ior:
pop bx ! return address
mov di,sp
add di,cx
sar cx,1
1:
pop ax
or ax,(di)
stos
loop 1b
jmp bx

View File

@@ -1,13 +0,0 @@
.define .isar
.isar:
! $Header$
pop bx
pop dx
cmp dx,2
jne .unknown
pop si ! descriptor address
pop ax ! index
pop di ! array base
push bx
jmp .sar2

View File

@@ -1,23 +0,0 @@
.define .lar2
.lar2:
! $Header$
pop bx ! return address
! di, descriptor address
! ax, index
! si, base address
sub ax,(di)
mov cx,4(di)
imul cx
add si,ax
sar cx,1
jnb 1f
xorb ah,ah
lodsb
push ax
jmp bx
1:
sub sp,4(di)
mov di,sp
rep movs
jmp bx

View File

@@ -1,19 +0,0 @@
.define .loi
! $Header$
! #bytes in cx
! source address in si
.loi:
pop bx
mov dx,cx
sar cx,1
jnb 1f
xorb ah,ah
lodsb
push ax
jmp bx
1:
sub sp,dx
mov di,sp
rep movs
jmp bx

View File

@@ -1,27 +0,0 @@
.define .mli
! $Header$
! #bytes in ax
.mli:
pop bx ! return address
cmp ax,2
jne 1f
pop ax
pop cx
mul cx
push ax
jmp bx
1:
mov dx,bx
cmp ax,4
jne 9f
pop si
pop di
pop bx
pop ax
push dx
jmp .mli4
9:
mov ax,EODDZ
push ax
jmp .trp

View File

@@ -1,17 +0,0 @@
.define .mli4
! $Header$
! x * y with
! x.low = si x.high = di
! y.low = bx y.high = ax
.mli4:
mul si ! xl*yh
mov cx,ax
mov ax,di
mul bx ! xh*yl
add cx,ax ! xh*yl+xl*yh
mov ax,si
mul bx ! xl*yl
add dx,cx
ret

View File

@@ -1,5 +0,0 @@
.define .mon
.mon:
! $Header$
call .stop

View File

@@ -1,27 +0,0 @@
.define .ngi
! $Header$
! #bytes in ax
.ngi:
pop bx ! return address
cmp ax,2
jne 1f
pop cx
neg cx
push cx
jmp bx
1:
cmp ax,4
jne 9f
pop dx
pop ax
neg ax
neg dx
sbb ax,0
push dx
push ax
jmp bx
9:
mov ax,EODDZ
push ax
jmp .trp

View File

@@ -1,22 +0,0 @@
.define .nop
SIO_S = 0xDA
SIO_D = 0xD8
RXRDY = 0x02
.nop:
! $Header$
mov ax,(hol0)
call printd
! movb al,' '
! call printc
! mov ax,sp
! call printd
!1:
! inb SIO_S
! andb al,RXRDY
! jz 1b
! inb SIO_D
! call printc
movb al,'\n'
jmp printc

View File

@@ -1,47 +0,0 @@
.define printc,printd,prints
SIO_D = 0xD8
SIO_S = 0xDA
TXRDY = 0x01
! $Header$
! argument in ax
! uses bx
prints:
xchg ax,bx
1:
movb al,(bx)
inc bx
testb al,al
jz 2f
call printc
jmp 1b
2:
ret
! argument in ax
! uses cx and dx
printd:
xor dx,dx
mov cx,10
div cx
test ax,ax
jz 1f
push dx
call printd
pop dx
1:
xchg ax,dx
addb al,'0'
.errnz printc - .
! argument in ax
printc:
push ax
1:
inb SIO_S
andb al,TXRDY
jz 1b
pop ax
outb SIO_D
ret

View File

@@ -1,38 +0,0 @@
.define printf
printf:
! $Header$
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

View File

@@ -1,17 +0,0 @@
.define .rck
! $Header$
! descriptor address in si
! value in ax, must be left there
.rck:
cmp ax,(si)
jl 2f
cmp ax,2(si)
jg 2f
ret
2:
push ax
mov ax,ERANGE
call .error
pop ax
ret

View File

@@ -1,35 +0,0 @@
.define .rmi
! $Header$
! #bytes in ax
.rmi:
pop bx ! return address
cmp ax,2
jne 1f
pop ax
cwd
pop cx
idiv cx
push dx
jmp bx
1:
cmp ax,4
jne 9f
pop ax
pop dx
pop si
pop di
push bx
push di
push si
push dx
push ax
call .rmi4
pop ax
push bx
push dx
jmp ax
9:
mov ax,EODDZ
push ax
jmp .trp

View File

@@ -1,83 +0,0 @@
.define .rmi4
yl=2
yh=4
xl=6
xh=8
.rmi4:
! $Header$
mov si,sp ! copy of sp
mov bx,yl(si)
mov ax,yh(si)
cwd
cmp dx,ax
jne 7f
and dx,dx
jge 1f
neg bx
je 7f
1:
xor dx,dx
mov cx,xl(si)
mov ax,xh(si)
and ax,ax
jge 2f
neg ax
neg cx
sbb ax,dx
2:
div bx
xchg ax,cx
div bx ! dx= result(low), 0=result(high)
xor bx,bx
9:
cmp xh(si),0
jge 1f
neg bx
neg dx
sbb bx,0
1:
! bx is high order result
! dx is low order result
ret 8
7:
mov di,ax
xor bx,bx
and di,di
jge 1f
neg di
neg yl(si)
sbb di,bx
1:
mov ax,xl(si)
mov dx,xh(si)
and dx,dx
jge 1f
neg dx
neg ax
sbb dx,bx
1:
mov cx,16
1:
shl ax,1
rcl dx,1
rcl bx,1
cmp di,bx
ja 3f
jb 2f
cmp yl(si),dx
jbe 2f
3:
loop 1b
! dx=result(low), bx=result(high)
jmp 9b
2:
sub dx,yl(si)
sbb bx,di
inc ax
loop 1b
1:
! dx=result(low), bx=result(high)
jmp 9b

View File

@@ -1,35 +0,0 @@
.define .rmu
! $Header$
! #bytes in ax
.rmu:
pop bx ! return address
cmp ax,2
jne 1f
pop ax
xor dx,dx
pop cx
idiv cx
push dx
jmp bx
1:
cmp ax,4
jne 9f
pop ax
pop dx
pop si
pop di
push bx
push di
push si
push dx
push ax
call .rmu4
pop ax
push bx
push dx
jmp ax
9:
mov ax,EODDZ
push ax
jmp .trp

View File

@@ -1,55 +0,0 @@
.define .rmu4
yl=2
yh=4
xl=6
xh=8
.rmu4:
! $Header$
mov si,sp ! copy of sp
mov bx,yl(si)
mov ax,yh(si)
or ax,ax
jne 7f
1:
xor dx,dx
mov cx,xl(si)
mov ax,xh(si)
2:
div bx
xchg ax,cx
div bx
xor bx,bx
9:
! bx is high order result
! dx is low order result
ret 8
7:
mov di,ax
xor bx,bx
mov ax,xl(si)
mov dx,xh(si)
mov cx,16
1:
shl ax,1
rcl dx,1
rcl bx,1
cmp di,bx
ja 3f
jb 2f
cmp yl(si),dx
jbe 2f
3:
loop 1b
! dx=result(low), bx=result(high)
jmp 9b
2:
sub dx,yl(si)
sbb bx,di
inc ax
loop 1b
1:
! dx=result(low), bx=result(high)
jmp 9b

View File

@@ -1,33 +0,0 @@
.define .rol
! $Header$
! #bytes in ax
.rol:
pop dx ! return address
cmp ax,2
jne 1f
pop ax
pop cx
rol ax,cl
push ax
jmp dx
1:
cmp ax,4
jne 9f
pop cx
jcxz 2f
pop ax
pop bx
3:
sal ax,1
rcl bx,1
adc ax,0
loop 3b
push bx
push ax
2:
jmp dx
9:
mov ax,EODDZ
push ax
jmp .trp

View File

@@ -1,34 +0,0 @@
.define .ror
! $Header$
! #bytes in ax
.ror:
pop dx ! return address
cmp ax,2
jne 1f
pop ax
pop cx
ror ax,cl
push ax
jmp dx
1:
cmp ax,4
jne 9f
pop cx
jcxz 2f
neg cx
add cx,32
pop ax
pop bx
3:
sar bx,1
rcr ax,1
loop 3b
push bx
push ax
2:
jmp dx
9:
mov ax,EODDZ
push ax
jmp .trp

View File

@@ -1,22 +0,0 @@
.define .sar2
.sar2:
! $Header$
pop bx ! return address
! si, descriptor address
! ax, index
! di, base address
sub ax,(si)
mov cx,4(si)
imul cx
add di,ax
sar cx,1
jnb 1f
pop ax
stosb
jmp bx
1:
mov si,sp
rep movs
mov sp,si
jmp bx

View File

@@ -1,27 +0,0 @@
.define .sbi
! $Header$
! #bytes in cx , top of stack in ax
.sbi:
pop bx ! return subress
cmp cx,2
jne 1f
pop cx
sub ax,cx
neg ax
jmp bx
1:
cmp cx,4
jne 9f
pop dx
pop cx
sub cx,ax
mov ax,cx
pop cx
sbc cx,dx
push cx
jmp bx
9:
mov ax,EODDZ
push ax
jmp .trp

View File

@@ -1,35 +0,0 @@
.define .set
! $Header$
! #bytes in cx
! bit # in ax
.set:
pop bx ! return address
xor dx,dx
!ifdef create set
mov di,sp
sub di,cx
1:
push dx
cmp sp,di
ja 1b
!endif
mov di,8
div di
cmp ax,cx
jae 2f
mov di,sp
add di,ax
mov si,dx
movb dl,bits(si)
orb (di),dl
jmp bx
2:
push bx
mov ax,ESET
push ax
jmp .trp
.data
bits:
.byte 1,2,4,8,16,32,64,128

View File

@@ -1,32 +0,0 @@
.define .sli
! $Header$
! #bytes in ax
.sli:
pop dx ! return address
cmp ax,2
jne 1f
pop ax
pop cx
sal ax,cl
push ax
jmp dx
1:
cmp ax,4
jne 9f
pop cx
jcxz 2f
pop ax
pop bx
3:
sal ax,1
rcl bx,1
loop 3b
push bx
push ax
2:
jmp dx
9:
mov ax,EODDZ
push ax
jmp .trp

View File

@@ -1,32 +0,0 @@
.define .sri
! $Header$
! #bytes in ax
.sri:
pop dx ! return address
cmp ax,2
jne 1f
pop ax
pop cx
sar ax,cl
push ax
jmp dx
1:
cmp ax,4
jne 9f
pop cx
jcxz 2f
pop ax
pop bx
3:
sar bx,1
rcr ax,1
loop 3b
push bx
push ax
2:
jmp dx
9:
mov ax,EODDZ
push ax
jmp .trp

View File

@@ -1,17 +0,0 @@
.define .sti
! $Header$
! #bytes in cx
! destination address in di
.sti:
pop bx ! return address
sar cx,1
jnb 1f
pop ax
stosb
jmp bx
1:
mov si,sp
rep movs
mov sp,si
jmp bx

View File

@@ -1,4 +0,0 @@
.define .stop
.stop:
! $Header$
int 3

View File

@@ -1,19 +0,0 @@
.define .strhp
.strhp:
! $Header$
pop bx
pop ax
mov (.reghp),ax
cmp ax,(.limhp)
jb 1f
add ax,02000
and ax,~0777
mov (.limhp),ax
cmp ax,sp
jae 2f
1:
jmp bx
2:
mov ax,EHEAP
jmp .fat

View File

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

View File

@@ -1,15 +0,0 @@
.define .trp
! $Header$
! ax is trap number
.trp:
xor bx,bx
xchg bx,(.trppc)
test bx,bx
jz 2f
push ax
call bx
pop ax
ret
2:
call .stop

View File

@@ -1,7 +0,0 @@
.define .unknown
.unknown:
! $Header$
mov ax,EILLINS
push ax
jmp .fat

View File

@@ -1,15 +0,0 @@
.define .xor
! $Header$
! #bytes in cx
.xor:
pop bx ! return address
mov di,sp
add di,cx
sar cx,1
1:
pop ax
xor ax,(di)
stos
loop 1b
jmp bx

View File

@@ -1,20 +0,0 @@
MAKEFILE=../../proto/libg/Makefile
MACHDEF="MACH=i86" "SUF=s"
PCDEF="PREF=pc" "SUB=" "SRC=lang/pc/libpc"
install:
make -f $(MAKEFILE) $(PCDEF) $(MACHDEF) cp
cmp:
make -f $(MAKEFILE) $(PCDEF) $(MACHDEF) all
-../../compare head_pc
-../../compare tail_pc
clean:
-rm -f *.old *.[ce$(SUF)] tail* head*
opr:
make pr | opr
pr:
@pr Makefile

View File

@@ -1,2 +0,0 @@
${MACH?ack} -I../../../h ${MACHFL?} $1 1>&2
echo `basename $1 $2`.s

View File

@@ -1,75 +0,0 @@
.define begtext,begdata,begbss
.define hol0,.reghp,.limhp,.trppc,.ignmask
.define ERANGE,ESET,EHEAP,ECASE,EILLINS
ERANGE = 1
ESET = 2
EIDIVZ = 6
EHEAP = 17
EILLINS = 18
EODDZ = 19
ECASE = 20
base = 0x01C0
topmem = 0xFFF0
.org topmem-16
.extern __n_line
maxmem:
__n_line:
.space 16
.errnz __n_line-0xFFE0
.base base
.text
begtext:
cld
xor ax,ax
mov ss,ax
mov ds,ax
mov es,ax
mov (2),cs
mov (0),.diverr
mov sp,maxmem
mov di,begbss
mov cx,[[endbss-begbss]/2]&0x7FFF
! xor ax,ax ! ax still is 0
rep stos
mov ax,envp
push ax
mov ax,argv
push ax
mov ax,1
push ax
call _m_a_i_n
call .stop
.diverr:
push ax
mov ax,EIDIVZ
call .error
pop ax
iret
.data
begdata:
hol0:
.word 0,0
.word 0,0
argv:
.word 3f
envp:
.word 0
3:
.asciz "PROGRAM"
.reghp:
.word endbss
.limhp:
.word endbss
.ignmask:
.word 0
.trppc:
.word 0
.bss
begbss:

View File

@@ -1,178 +0,0 @@
# $Header$
PREFLAGS=-I../../../h -I.
PFLAGS=
CFLAGS=$(PREFLAGS) $(PFLAGS)
LDFLAGS=-i $(PFLAGS)
LINTOPTS=-hbxac
LIBS=../../../lib/em_data.a
CDIR=../../proto/ncg
CGG=../../../lib/ncgg
CFILES=$(CDIR)/codegen.c $(CDIR)/compute.c $(CDIR)/equiv.c $(CDIR)/fillem.c \
$(CDIR)/gencode.c $(CDIR)/glosym.c $(CDIR)/main.c $(CDIR)/move.c \
$(CDIR)/nextem.c $(CDIR)/reg.c $(CDIR)/regvar.c $(CDIR)/salloc.c \
$(CDIR)/state.c $(CDIR)/subr.c $(CDIR)/var.c
OFILES=codegen.o compute.o equiv.o fillem.o gencode.o glosym.o main.o\
move.o nextem.o reg.o regvar.o salloc.o state.o subr.o var.o
all:
make tables.c
make cg
cg: tables.o $(OFILES)
cc $(LDFLAGS) $(OFILES) tables.o $(LIBS) -o cg
tables.o: tables.c
cc -c $(PREFLAGS) -I$(CDIR) tables.c
codegen.o: $(CDIR)/codegen.c
cc -c $(CFLAGS) $(CDIR)/codegen.c
compute.o: $(CDIR)/compute.c
cc -c $(CFLAGS) $(CDIR)/compute.c
equiv.o: $(CDIR)/equiv.c
cc -c $(CFLAGS) $(CDIR)/equiv.c
fillem.o: $(CDIR)/fillem.c
cc -c $(CFLAGS) $(CDIR)/fillem.c
gencode.o: $(CDIR)/gencode.c
cc -c $(CFLAGS) $(CDIR)/gencode.c
glosym.o: $(CDIR)/glosym.c
cc -c $(CFLAGS) $(CDIR)/glosym.c
main.o: $(CDIR)/main.c
cc -c $(CFLAGS) $(CDIR)/main.c
move.o: $(CDIR)/move.c
cc -c $(CFLAGS) $(CDIR)/move.c
nextem.o: $(CDIR)/nextem.c
cc -c $(CFLAGS) $(CDIR)/nextem.c
reg.o: $(CDIR)/reg.c
cc -c $(CFLAGS) $(CDIR)/reg.c
regvar.o: $(CDIR)/regvar.c
cc -c $(CFLAGS) $(CDIR)/regvar.c
salloc.o: $(CDIR)/salloc.c
cc -c $(CFLAGS) $(CDIR)/salloc.c
state.o: $(CDIR)/state.c
cc -c $(CFLAGS) $(CDIR)/state.c
subr.o: $(CDIR)/subr.c
cc -c $(CFLAGS) $(CDIR)/subr.c
var.o: $(CDIR)/var.c
cc -c $(CFLAGS) $(CDIR)/var.c
install: all
../../install cg
cmp: all
-../../compare cg
tables.c: table $(CGG)
$(CGG) table
-cmp tables.h tables.H || cp tables.H tables.h
lint: $(CFILES)
lint $(LINTOPTS) $(PREFLAGS) $(CFILES)
clean:
rm -f *.o tables.c tables.h debug.out cg tables.H
codegen.o: $(CDIR)/assert.h ../../../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 ../../../h/cgg_cg.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 ../../../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 ../../../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 ../../../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
main.o: $(CDIR)/param.h
main.o: tables.h
move.o: $(CDIR)/assert.h ../../../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 ../../../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 ../../../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 ../../../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 ../../../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 ../../../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 ../../../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 ../../../h/cgg_cg.h
var.o: $(CDIR)/param.h
var.o: $(CDIR)/result.h
var.o: tables.h
var.o: $(CDIR)/types.h