added code to generate code for ACK assembler.
Works if ACK_ASS is defined.
This commit is contained in:
parent
9eb72b6ee8
commit
5d5a09a5d0
|
@ -49,11 +49,34 @@ con_mult(sz) word sz; {
|
||||||
|
|
||||||
if (sz != 4)
|
if (sz != 4)
|
||||||
fatal("bad icon/ucon size");
|
fatal("bad icon/ucon size");
|
||||||
|
#ifdef ACK_ASS
|
||||||
|
fprintf(codefile,".long %s\n",str);
|
||||||
|
#else
|
||||||
l = atol(str);
|
l = atol(str);
|
||||||
fprintf(codefile,"\t%o;%o\n",(int)(l>>16),(int)l);
|
fprintf(codefile,"\t%o;%o\n",(int)(l>>16),(int)l);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The next function is difficult to do when not running on a PDP 11 or VAX
|
||||||
|
* The strategy followed is to assume the code generator is running on a PDP 11
|
||||||
|
* unless the ACK_ASS define is on.
|
||||||
|
* In the last case floating point constants are simply not handled
|
||||||
|
*/
|
||||||
|
|
||||||
con_float() {
|
con_float() {
|
||||||
|
#ifdef ACK_ASS
|
||||||
|
static int been_here;
|
||||||
|
|
||||||
|
if (argval != 4 && argval != 8)
|
||||||
|
fatal("bad fcon size");
|
||||||
|
fprintf(codefile,".long\t");
|
||||||
|
if (argval == 8)
|
||||||
|
fprintf(codefile,"F_DUM,");
|
||||||
|
fprintf(codefile,"F_DUM\n");
|
||||||
|
if ( !been_here++)
|
||||||
|
fprintf(stderr,"Warning : dummy float-constant(s)\n");
|
||||||
|
#else
|
||||||
double f;
|
double f;
|
||||||
register short *p,i;
|
register short *p,i;
|
||||||
|
|
||||||
|
@ -67,6 +90,7 @@ con_float() {
|
||||||
i = *p++;
|
i = *p++;
|
||||||
}
|
}
|
||||||
fprintf(codefile,"\t%o;%o\n",i,*p++);
|
fprintf(codefile,"\t%o;%o\n",i,*p++);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef REGVARS
|
#ifdef REGVARS
|
||||||
|
@ -131,7 +155,7 @@ f_regsave() {
|
||||||
|
|
||||||
regsave(regstr,off,size) char *regstr; long off; {
|
regsave(regstr,off,size) char *regstr; long off; {
|
||||||
|
|
||||||
fprintf(codefile,"/ Local %ld into %s\n",off,regstr);
|
fprintf(codefile,"%c Local %ld into %s\n",COMMENTCHAR,off,regstr);
|
||||||
/* commented away
|
/* commented away
|
||||||
#ifndef REGPATCH
|
#ifndef REGPATCH
|
||||||
fprintf(codefile,"mov %s,-(sp)\n",regstr);
|
fprintf(codefile,"mov %s,-(sp)\n",regstr);
|
||||||
|
@ -197,7 +221,11 @@ mes(type) word type; {
|
||||||
return ;
|
return ;
|
||||||
default:
|
default:
|
||||||
strarg(argt) ;
|
strarg(argt) ;
|
||||||
|
#ifdef ACK_ASS
|
||||||
|
fprintf(codefile,".define %s\n",argstr) ;
|
||||||
|
#else
|
||||||
fprintf(codefile,".globl %s\n",argstr) ;
|
fprintf(codefile,".globl %s\n",argstr) ;
|
||||||
|
#endif
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,28 @@
|
||||||
/* $Header$ */
|
/* $Header$ */
|
||||||
|
|
||||||
|
/* The next define switches between codegeneration for an ACK assembler
|
||||||
|
* or for the standard UNIX V7 assembler.
|
||||||
|
* If on code is generated for the ACK assembler.
|
||||||
|
*/
|
||||||
|
/* #define ACK_ASS /* code for ACK assembler */
|
||||||
|
|
||||||
|
#ifdef ACK_ASS
|
||||||
|
#define COMMENTCHAR '!'
|
||||||
|
#define ex_ap(y) fprintf(codefile,".extern %s\n",y)
|
||||||
|
#else
|
||||||
|
#define COMMENTCHAR '/'
|
||||||
#define ex_ap(y) fprintf(codefile,".globl %s\n",y)
|
#define ex_ap(y) fprintf(codefile,".globl %s\n",y)
|
||||||
|
#endif
|
||||||
#define in_ap(y) /* nothing */
|
#define in_ap(y) /* nothing */
|
||||||
|
|
||||||
#define newplb(x) fprintf(codefile,"%s:\n",x)
|
#define newplb(x) fprintf(codefile,"%s:\n",x)
|
||||||
#define newilb(x) fprintf(codefile,"%s:\n",x)
|
#define newilb(x) fprintf(codefile,"%s:\n",x)
|
||||||
#define newdlb(x) fprintf(codefile,"%s:\n",x)
|
#define newdlb(x) fprintf(codefile,"%s:\n",x)
|
||||||
|
#ifdef ACK_ASS
|
||||||
|
#define newlbss(l,x) fprintf(codefile,"%s:.space 0%o\n",l,x);
|
||||||
|
#else
|
||||||
#define newlbss(l,x) fprintf(codefile,"%s:.=.+0%o\n",l,x);
|
#define newlbss(l,x) fprintf(codefile,"%s:.=.+0%o\n",l,x);
|
||||||
|
#endif
|
||||||
|
|
||||||
#define cst_fmt "$0%o"
|
#define cst_fmt "$0%o"
|
||||||
#define off_fmt "0%o"
|
#define off_fmt "0%o"
|
||||||
|
@ -16,9 +32,15 @@
|
||||||
|
|
||||||
#define hol_off "0%o+hol%d"
|
#define hol_off "0%o+hol%d"
|
||||||
|
|
||||||
|
#ifdef ACK_ASS
|
||||||
|
#define con_cst(x) fprintf(codefile,".short 0%o\n",x)
|
||||||
|
#define con_ilb(x) fprintf(codefile,".short %s\n",x)
|
||||||
|
#define con_dlb(x) fprintf(codefile,".short %s\n",x)
|
||||||
|
#else
|
||||||
#define con_cst(x) fprintf(codefile,"0%o\n",x)
|
#define con_cst(x) fprintf(codefile,"0%o\n",x)
|
||||||
#define con_ilb(x) fprintf(codefile,"%s\n",x)
|
#define con_ilb(x) fprintf(codefile,"%s\n",x)
|
||||||
#define con_dlb(x) fprintf(codefile,"%s\n",x)
|
#define con_dlb(x) fprintf(codefile,"%s\n",x)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define id_first '_'
|
#define id_first '_'
|
||||||
#define BSS_INIT 0
|
#define BSS_INIT 0
|
||||||
|
|
Loading…
Reference in a new issue