emit: Redo instruction output
This commit is contained in:
parent
4f099e7eb1
commit
ca01cbdf7d
@ -475,6 +475,16 @@ typedef enum s_optmark {
|
|||||||
|
|
||||||
#define MAX_INSTR_LEN 30
|
#define MAX_INSTR_LEN 30
|
||||||
|
|
||||||
|
#define eotNUMBER 0
|
||||||
|
#define eotFUNCTION 1
|
||||||
|
typedef struct s_emit_outval {
|
||||||
|
int type;
|
||||||
|
union {
|
||||||
|
ucell ucell;
|
||||||
|
const char *string;
|
||||||
|
} value;
|
||||||
|
} emit_outval;
|
||||||
|
|
||||||
/* interface functions */
|
/* interface functions */
|
||||||
#if defined __cplusplus
|
#if defined __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -699,7 +709,7 @@ SC_FUNC void dec(value *lval);
|
|||||||
SC_FUNC void jmp_ne0(int number);
|
SC_FUNC void jmp_ne0(int number);
|
||||||
SC_FUNC void jmp_eq0(int number);
|
SC_FUNC void jmp_eq0(int number);
|
||||||
SC_FUNC void outval(cell val,int newline);
|
SC_FUNC void outval(cell val,int newline);
|
||||||
SC_FUNC void outinstr(const char *name,ucell args[],int numargs);
|
SC_FUNC void outinstr(const char *name, emit_outval params[],int numparams);
|
||||||
|
|
||||||
/* function prototypes in SC5.C */
|
/* function prototypes in SC5.C */
|
||||||
SC_FUNC int error(int number,...);
|
SC_FUNC int error(int number,...);
|
||||||
|
@ -5953,7 +5953,7 @@ static void SC_FASTCALL emit_invalid_token(int expected_token,int found_token)
|
|||||||
} /* if */
|
} /* if */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SC_FASTCALL emit_param_any(ucell *p)
|
static void SC_FASTCALL emit_param_any(emit_outval *p)
|
||||||
{
|
{
|
||||||
char *str;
|
char *str;
|
||||||
cell val,cidx;
|
cell val,cidx;
|
||||||
@ -5962,14 +5962,15 @@ static void SC_FASTCALL emit_param_any(ucell *p)
|
|||||||
int tok,neg,ident,index;
|
int tok,neg,ident,index;
|
||||||
|
|
||||||
neg=FALSE;
|
neg=FALSE;
|
||||||
|
p->type=eotNUMBER;
|
||||||
fetchtok:
|
fetchtok:
|
||||||
tok=lex(&val,&str);
|
tok=lex(&val,&str);
|
||||||
switch (tok) {
|
switch (tok) {
|
||||||
case tNUMBER:
|
case tNUMBER:
|
||||||
*p=(neg!=FALSE) ? -val : val;
|
p->value.ucell=(ucell)((neg!=FALSE) ? -val : val);
|
||||||
break;
|
break;
|
||||||
case tRATIONAL:
|
case tRATIONAL:
|
||||||
*p=(neg!=FALSE) ? (val|((cell)1 << (PAWN_CELL_SIZE-1))) : val;
|
p->value.ucell=(ucell)((neg!=FALSE) ? (val|((cell)1 << (PAWN_CELL_SIZE-1))) : val);
|
||||||
break;
|
break;
|
||||||
case tSYMBOL:
|
case tSYMBOL:
|
||||||
sym=findloc(str);
|
sym=findloc(str);
|
||||||
@ -5989,10 +5990,12 @@ fetchtok:
|
|||||||
if ((sym->usage & uNATIVE)!=0 && (sym->usage & uREAD)==0 && sym->addr>=0)
|
if ((sym->usage & uNATIVE)!=0 && (sym->usage & uREAD)==0 && sym->addr>=0)
|
||||||
sym->addr=ntv_funcid++;
|
sym->addr=ntv_funcid++;
|
||||||
markusage(sym,uREAD);
|
markusage(sym,uREAD);
|
||||||
|
p->type=eotFUNCTION;
|
||||||
|
p->value.string=str;
|
||||||
} else {
|
} else {
|
||||||
markusage(sym,uREAD | uWRITTEN);
|
markusage(sym,uREAD | uWRITTEN);
|
||||||
|
p->value.ucell=(ucell)((neg!=FALSE) ? -sym->addr : sym->addr);
|
||||||
} /* if */
|
} /* if */
|
||||||
*p=(neg!=FALSE) ? -sym->addr : sym->addr;
|
|
||||||
break;
|
break;
|
||||||
case '(':
|
case '(':
|
||||||
if ((emit_flags & efEXPR)==0)
|
if ((emit_flags & efEXPR)==0)
|
||||||
@ -6007,7 +6010,7 @@ fetchtok:
|
|||||||
if ((emit_flags & efEXPR)==0)
|
if ((emit_flags & efEXPR)==0)
|
||||||
stgset(FALSE);
|
stgset(FALSE);
|
||||||
needtoken(')');
|
needtoken(')');
|
||||||
*p=(neg!=FALSE) ? -val : val;
|
p->value.ucell=(ucell)((neg!=FALSE) ? -val : val);
|
||||||
break;
|
break;
|
||||||
case '-':
|
case '-':
|
||||||
if (neg==FALSE) {
|
if (neg==FALSE) {
|
||||||
@ -6026,17 +6029,18 @@ fetchtok:
|
|||||||
} /* switch */
|
} /* switch */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SC_FASTCALL emit_param_data(ucell *p)
|
static void SC_FASTCALL emit_param_data(emit_outval *p)
|
||||||
{
|
{
|
||||||
cell val;
|
cell val;
|
||||||
char *str;
|
char *str;
|
||||||
symbol *sym;
|
symbol *sym;
|
||||||
int tok;
|
int tok;
|
||||||
|
|
||||||
|
p->type=eotNUMBER;
|
||||||
tok=lex(&val,&str);
|
tok=lex(&val,&str);
|
||||||
switch (tok) {
|
switch (tok) {
|
||||||
case tNUMBER:
|
case tNUMBER:
|
||||||
*p=val;
|
p->value.ucell=(ucell)val;
|
||||||
break;
|
break;
|
||||||
case tSYMBOL:
|
case tSYMBOL:
|
||||||
sym=findloc(str);
|
sym=findloc(str);
|
||||||
@ -6061,7 +6065,7 @@ static void SC_FASTCALL emit_param_data(ucell *p)
|
|||||||
} /* if */
|
} /* if */
|
||||||
} /* if */
|
} /* if */
|
||||||
markusage(sym,uREAD | uWRITTEN);
|
markusage(sym,uREAD | uWRITTEN);
|
||||||
*p=sym->addr;
|
p->value.ucell=(ucell)sym->addr;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
invalid_token:
|
invalid_token:
|
||||||
@ -6069,17 +6073,18 @@ static void SC_FASTCALL emit_param_data(ucell *p)
|
|||||||
} /* switch */
|
} /* switch */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SC_FASTCALL emit_param_local(ucell *p)
|
static void SC_FASTCALL emit_param_local(emit_outval *p)
|
||||||
{
|
{
|
||||||
cell val;
|
cell val;
|
||||||
char *str;
|
char *str;
|
||||||
symbol *sym;
|
symbol *sym;
|
||||||
int tok;
|
int tok;
|
||||||
|
|
||||||
|
p->type=eotNUMBER;
|
||||||
tok=lex(&val,&str);
|
tok=lex(&val,&str);
|
||||||
switch (tok) {
|
switch (tok) {
|
||||||
case tNUMBER:
|
case tNUMBER:
|
||||||
*p=val;
|
p->value.ucell=(ucell)val;
|
||||||
break;
|
break;
|
||||||
case tSYMBOL:
|
case tSYMBOL:
|
||||||
sym=findloc(str);
|
sym=findloc(str);
|
||||||
@ -6100,7 +6105,7 @@ static void SC_FASTCALL emit_param_local(ucell *p)
|
|||||||
} /* if */
|
} /* if */
|
||||||
} /* if */
|
} /* if */
|
||||||
markusage(sym,uREAD | uWRITTEN);
|
markusage(sym,uREAD | uWRITTEN);
|
||||||
*p=sym->addr;
|
p->value.ucell=(ucell)sym->addr;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
invalid_token:
|
invalid_token:
|
||||||
@ -6108,7 +6113,7 @@ static void SC_FASTCALL emit_param_local(ucell *p)
|
|||||||
} /* switch */
|
} /* switch */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SC_FASTCALL emit_param_index(ucell *p,const cell *valid_values,int numvalues)
|
static void SC_FASTCALL emit_param_index(emit_outval *p,const cell *valid_values,int numvalues)
|
||||||
{
|
{
|
||||||
cell val;
|
cell val;
|
||||||
char *str;
|
char *str;
|
||||||
@ -6168,14 +6173,15 @@ fetchtok:
|
|||||||
return;
|
return;
|
||||||
} /* switch */
|
} /* switch */
|
||||||
|
|
||||||
*p=val;
|
p->type=eotNUMBER;
|
||||||
|
p->value.ucell=(ucell)val;
|
||||||
for (i=0; i<numvalues; i++)
|
for (i=0; i<numvalues; i++)
|
||||||
if (val==valid_values[i])
|
if (val==valid_values[i])
|
||||||
return;
|
return;
|
||||||
error(50); /* invalid range */
|
error(50); /* invalid range */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SC_FASTCALL emit_param_label(ucell *p)
|
static void SC_FASTCALL emit_param_label(emit_outval *p)
|
||||||
{
|
{
|
||||||
cell val;
|
cell val;
|
||||||
char *str;
|
char *str;
|
||||||
@ -6187,10 +6193,11 @@ static void SC_FASTCALL emit_param_label(ucell *p)
|
|||||||
emit_invalid_token(tSYMBOL,tok);
|
emit_invalid_token(tSYMBOL,tok);
|
||||||
sym=fetchlab(str);
|
sym=fetchlab(str);
|
||||||
sym->usage|=uREAD;
|
sym->usage|=uREAD;
|
||||||
*p=*(ucell *)&sym->addr;
|
p->type=eotNUMBER;
|
||||||
|
p->value.ucell=(ucell)sym->addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SC_FASTCALL emit_param_function(ucell *p,int isnative)
|
static void SC_FASTCALL emit_param_function(emit_outval *p,int isnative)
|
||||||
{
|
{
|
||||||
cell val;
|
cell val;
|
||||||
char *str;
|
char *str;
|
||||||
@ -6222,9 +6229,11 @@ static void SC_FASTCALL emit_param_function(ucell *p,int isnative)
|
|||||||
if (isnative!=FALSE) {
|
if (isnative!=FALSE) {
|
||||||
if ((sym->usage & uREAD)==0 && sym->addr>=0)
|
if ((sym->usage & uREAD)==0 && sym->addr>=0)
|
||||||
sym->addr=ntv_funcid++;
|
sym->addr=ntv_funcid++;
|
||||||
*p=sym->addr;
|
p->type=eotNUMBER;
|
||||||
|
p->value.ucell=(ucell)sym->addr;
|
||||||
} else {
|
} else {
|
||||||
*(char **)p=str;
|
p->type=eotFUNCTION;
|
||||||
|
p->value.string=str;
|
||||||
} /* if */
|
} /* if */
|
||||||
markusage(sym,uREAD);
|
markusage(sym,uREAD);
|
||||||
}
|
}
|
||||||
@ -6241,7 +6250,7 @@ static void SC_FASTCALL emit_parm0(char *name)
|
|||||||
|
|
||||||
static void SC_FASTCALL emit_parm1_any(char *name)
|
static void SC_FASTCALL emit_parm1_any(char *name)
|
||||||
{
|
{
|
||||||
ucell p[1];
|
emit_outval p[1];
|
||||||
|
|
||||||
emit_param_any(&p[0]);
|
emit_param_any(&p[0]);
|
||||||
outinstr(name,p,(sizeof p / sizeof p[0]));
|
outinstr(name,p,(sizeof p / sizeof p[0]));
|
||||||
@ -6249,7 +6258,7 @@ static void SC_FASTCALL emit_parm1_any(char *name)
|
|||||||
|
|
||||||
static void SC_FASTCALL emit_parm1_data(char *name)
|
static void SC_FASTCALL emit_parm1_data(char *name)
|
||||||
{
|
{
|
||||||
ucell p[1];
|
emit_outval p[1];
|
||||||
|
|
||||||
emit_param_data(&p[0]);
|
emit_param_data(&p[0]);
|
||||||
outinstr(name,p,(sizeof p / sizeof p[0]));
|
outinstr(name,p,(sizeof p / sizeof p[0]));
|
||||||
@ -6257,7 +6266,7 @@ static void SC_FASTCALL emit_parm1_data(char *name)
|
|||||||
|
|
||||||
static void SC_FASTCALL emit_parm1_local(char *name)
|
static void SC_FASTCALL emit_parm1_local(char *name)
|
||||||
{
|
{
|
||||||
ucell p[1];
|
emit_outval p[1];
|
||||||
|
|
||||||
emit_param_local(&p[0]);
|
emit_param_local(&p[0]);
|
||||||
outinstr(name,p,(sizeof p / sizeof p[0]));
|
outinstr(name,p,(sizeof p / sizeof p[0]));
|
||||||
@ -6265,7 +6274,7 @@ static void SC_FASTCALL emit_parm1_local(char *name)
|
|||||||
|
|
||||||
static void SC_FASTCALL emit_parm1_label(char *name)
|
static void SC_FASTCALL emit_parm1_label(char *name)
|
||||||
{
|
{
|
||||||
ucell p[1];
|
emit_outval p[1];
|
||||||
|
|
||||||
emit_param_label(&p[0]);
|
emit_param_label(&p[0]);
|
||||||
outinstr(name,p,(sizeof p / sizeof p[0]));
|
outinstr(name,p,(sizeof p / sizeof p[0]));
|
||||||
@ -6273,36 +6282,29 @@ static void SC_FASTCALL emit_parm1_label(char *name)
|
|||||||
|
|
||||||
static void SC_FASTCALL emit_do_casetbl(char *name)
|
static void SC_FASTCALL emit_do_casetbl(char *name)
|
||||||
{
|
{
|
||||||
ucell p[2];
|
emit_outval p[2];
|
||||||
|
|
||||||
(void)name;
|
(void)name;
|
||||||
emit_param_any(&p[0]);
|
emit_param_any(&p[0]);
|
||||||
emit_param_label(&p[1]);
|
emit_param_label(&p[1]);
|
||||||
stgwrite("\tcasetbl\n");
|
stgwrite("\tcasetbl\n");
|
||||||
stgwrite("\tcase ");
|
outinstr("case",p,(sizeof p / sizeof p[0]));
|
||||||
outval(p[0],FALSE);
|
|
||||||
stgwrite(" ");
|
|
||||||
outval(p[1],TRUE);
|
|
||||||
code_idx+=opcodes(1)+opargs(2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SC_FASTCALL emit_do_case(char *name)
|
static void SC_FASTCALL emit_do_case(char *name)
|
||||||
{
|
{
|
||||||
ucell p[2];
|
emit_outval p[2];
|
||||||
|
|
||||||
emit_param_any(&p[0]);
|
emit_param_any(&p[0]);
|
||||||
emit_param_label(&p[1]);
|
emit_param_label(&p[1]);
|
||||||
stgwrite("\tcase ");
|
outinstr("case",p,(sizeof p / sizeof p[0]));
|
||||||
outval(p[0],FALSE);
|
code_idx-=opcodes(1);
|
||||||
stgwrite(" ");
|
|
||||||
outval(p[1],TRUE);
|
|
||||||
code_idx+=opargs(2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SC_FASTCALL emit_do_lodb_strb(char *name)
|
static void SC_FASTCALL emit_do_lodb_strb(char *name)
|
||||||
{
|
{
|
||||||
static const cell valid_values[] = { 1,2,4 };
|
static const cell valid_values[] = { 1,2,4 };
|
||||||
ucell p[1];
|
emit_outval p[1];
|
||||||
|
|
||||||
emit_param_index(&p[0],valid_values,(sizeof valid_values / sizeof valid_values[0]));
|
emit_param_index(&p[0],valid_values,(sizeof valid_values / sizeof valid_values[0]));
|
||||||
outinstr(name,p,(sizeof p / sizeof p[0]));
|
outinstr(name,p,(sizeof p / sizeof p[0]));
|
||||||
@ -6311,7 +6313,7 @@ static void SC_FASTCALL emit_do_lodb_strb(char *name)
|
|||||||
static void SC_FASTCALL emit_do_lctrl(char *name)
|
static void SC_FASTCALL emit_do_lctrl(char *name)
|
||||||
{
|
{
|
||||||
static const cell valid_values[] = { 0,1,2,3,4,5,6,7,8,9 };
|
static const cell valid_values[] = { 0,1,2,3,4,5,6,7,8,9 };
|
||||||
ucell p[1];
|
emit_outval p[1];
|
||||||
|
|
||||||
emit_param_index(&p[0],valid_values,(sizeof valid_values / sizeof valid_values[0]));
|
emit_param_index(&p[0],valid_values,(sizeof valid_values / sizeof valid_values[0]));
|
||||||
outinstr(name,p,(sizeof p / sizeof p[0]));
|
outinstr(name,p,(sizeof p / sizeof p[0]));
|
||||||
@ -6320,7 +6322,7 @@ static void SC_FASTCALL emit_do_lctrl(char *name)
|
|||||||
static void SC_FASTCALL emit_do_sctrl(char *name)
|
static void SC_FASTCALL emit_do_sctrl(char *name)
|
||||||
{
|
{
|
||||||
static const cell valid_values[] = { 2,4,5,6,8,9 };
|
static const cell valid_values[] = { 2,4,5,6,8,9 };
|
||||||
ucell p[1];
|
emit_outval p[1];
|
||||||
|
|
||||||
emit_param_index(&p[0],valid_values,(sizeof valid_values / sizeof valid_values[0]));
|
emit_param_index(&p[0],valid_values,(sizeof valid_values / sizeof valid_values[0]));
|
||||||
outinstr(name,p,(sizeof p / sizeof p[0]));
|
outinstr(name,p,(sizeof p / sizeof p[0]));
|
||||||
@ -6328,22 +6330,15 @@ static void SC_FASTCALL emit_do_sctrl(char *name)
|
|||||||
|
|
||||||
static void SC_FASTCALL emit_do_call(char *name)
|
static void SC_FASTCALL emit_do_call(char *name)
|
||||||
{
|
{
|
||||||
char *funcname=NULL;
|
emit_outval p[1];
|
||||||
|
|
||||||
emit_param_function((ucell *)&funcname,FALSE);
|
emit_param_function(&p[0],FALSE);
|
||||||
stgwrite("\t");
|
outinstr(name,p,(sizeof p / sizeof p[0]));
|
||||||
stgwrite(name);
|
|
||||||
if (funcname!=NULL) {
|
|
||||||
stgwrite(" .");
|
|
||||||
stgwrite(funcname);
|
|
||||||
} /* if */
|
|
||||||
stgwrite("\n");
|
|
||||||
code_idx+=opcodes(1)+opargs(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SC_FASTCALL emit_do_sysreq_c(char *name)
|
static void SC_FASTCALL emit_do_sysreq_c(char *name)
|
||||||
{
|
{
|
||||||
ucell p[1];
|
emit_outval p[1];
|
||||||
|
|
||||||
emit_param_function(&p[0],TRUE);
|
emit_param_function(&p[0],TRUE);
|
||||||
|
|
||||||
@ -6362,7 +6357,7 @@ static void SC_FASTCALL emit_do_sysreq_c(char *name)
|
|||||||
|
|
||||||
static void SC_FASTCALL emit_do_sysreq_n(char *name)
|
static void SC_FASTCALL emit_do_sysreq_n(char *name)
|
||||||
{
|
{
|
||||||
ucell p[2];
|
emit_outval p[2];
|
||||||
|
|
||||||
emit_param_function(&p[0],TRUE);
|
emit_param_function(&p[0],TRUE);
|
||||||
emit_param_any(&p[1]);
|
emit_param_any(&p[1]);
|
||||||
@ -6378,14 +6373,14 @@ static void SC_FASTCALL emit_do_sysreq_n(char *name)
|
|||||||
} else {
|
} else {
|
||||||
outinstr("push.c",&p[1],1);
|
outinstr("push.c",&p[1],1);
|
||||||
outinstr("sysreq.c",&p[0],1);
|
outinstr("sysreq.c",&p[0],1);
|
||||||
p[1]+=sizeof(cell);
|
p[1].value.ucell+=sizeof(cell);
|
||||||
outinstr("stack",&p[1],1);
|
outinstr("stack",&p[1],1);
|
||||||
} /* if */
|
} /* if */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SC_FASTCALL emit_do_const(char *name)
|
static void SC_FASTCALL emit_do_const(char *name)
|
||||||
{
|
{
|
||||||
ucell p[2];
|
emit_outval p[2];
|
||||||
|
|
||||||
emit_param_data(&p[0]);
|
emit_param_data(&p[0]);
|
||||||
emit_param_any(&p[1]);
|
emit_param_any(&p[1]);
|
||||||
@ -6409,7 +6404,7 @@ static void SC_FASTCALL emit_do_const(char *name)
|
|||||||
|
|
||||||
static void SC_FASTCALL emit_do_const_s(char *name)
|
static void SC_FASTCALL emit_do_const_s(char *name)
|
||||||
{
|
{
|
||||||
ucell p[2];
|
emit_outval p[2];
|
||||||
|
|
||||||
emit_param_local(&p[0]);
|
emit_param_local(&p[0]);
|
||||||
emit_param_any(&p[1]);
|
emit_param_any(&p[1]);
|
||||||
@ -6433,7 +6428,7 @@ static void SC_FASTCALL emit_do_const_s(char *name)
|
|||||||
|
|
||||||
static void SC_FASTCALL emit_do_load_both(char *name)
|
static void SC_FASTCALL emit_do_load_both(char *name)
|
||||||
{
|
{
|
||||||
ucell p[2];
|
emit_outval p[2];
|
||||||
|
|
||||||
emit_param_data(&p[0]);
|
emit_param_data(&p[0]);
|
||||||
emit_param_data(&p[1]);
|
emit_param_data(&p[1]);
|
||||||
@ -6453,7 +6448,7 @@ static void SC_FASTCALL emit_do_load_both(char *name)
|
|||||||
|
|
||||||
static void SC_FASTCALL emit_do_load_s_both(char *name)
|
static void SC_FASTCALL emit_do_load_s_both(char *name)
|
||||||
{
|
{
|
||||||
ucell p[2];
|
emit_outval p[2];
|
||||||
|
|
||||||
emit_param_local(&p[0]);
|
emit_param_local(&p[0]);
|
||||||
emit_param_local(&p[1]);
|
emit_param_local(&p[1]);
|
||||||
@ -6473,7 +6468,7 @@ static void SC_FASTCALL emit_do_load_s_both(char *name)
|
|||||||
|
|
||||||
static void SC_FASTCALL emit_do_pushn_c(char *name)
|
static void SC_FASTCALL emit_do_pushn_c(char *name)
|
||||||
{
|
{
|
||||||
ucell p[5];
|
emit_outval p[5];
|
||||||
int i,numargs;
|
int i,numargs;
|
||||||
|
|
||||||
assert(name[0]=='p' && name[1]=='u' && name[2]=='s'
|
assert(name[0]=='p' && name[1]=='u' && name[2]=='s'
|
||||||
@ -6495,7 +6490,7 @@ static void SC_FASTCALL emit_do_pushn_c(char *name)
|
|||||||
|
|
||||||
static void SC_FASTCALL emit_do_pushn(char *name)
|
static void SC_FASTCALL emit_do_pushn(char *name)
|
||||||
{
|
{
|
||||||
ucell p[5];
|
emit_outval p[5];
|
||||||
int i,numargs;
|
int i,numargs;
|
||||||
|
|
||||||
assert(name[0]=='p' && name[1]=='u' && name[2]=='s'
|
assert(name[0]=='p' && name[1]=='u' && name[2]=='s'
|
||||||
@ -6517,7 +6512,7 @@ static void SC_FASTCALL emit_do_pushn(char *name)
|
|||||||
|
|
||||||
static void SC_FASTCALL emit_do_pushn_s_adr(char *name)
|
static void SC_FASTCALL emit_do_pushn_s_adr(char *name)
|
||||||
{
|
{
|
||||||
ucell p[5];
|
emit_outval p[5];
|
||||||
int i,numargs;
|
int i,numargs;
|
||||||
|
|
||||||
assert(name[0]=='p' && name[1]=='u' && name[2]=='s'
|
assert(name[0]=='p' && name[1]=='u' && name[2]=='s'
|
||||||
|
@ -1379,19 +1379,28 @@ SC_FUNC void outval(cell val,int newline)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* write an instruction with arguments */
|
/* write an instruction with arguments */
|
||||||
SC_FUNC void outinstr(const char *name,ucell args[],int numargs)
|
SC_FUNC void outinstr(const char *name, emit_outval params[],int numparams)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
stgwrite("\t");
|
stgwrite("\t");
|
||||||
stgwrite(name);
|
stgwrite(name);
|
||||||
|
|
||||||
for (i=0; i<numargs; i++) {
|
for (i=0; i<numparams; i++) {
|
||||||
stgwrite(" ");
|
stgwrite(" ");
|
||||||
stgwrite(itoh(args[i]));
|
switch (params[i].type)
|
||||||
|
{
|
||||||
|
case eotNUMBER:
|
||||||
|
stgwrite(itoh(params[i].value.ucell));
|
||||||
|
break;
|
||||||
|
case eotFUNCTION:
|
||||||
|
stgwrite(".");
|
||||||
|
stgwrite(params[i].value.string);
|
||||||
|
break;
|
||||||
|
}
|
||||||
} /* for */
|
} /* for */
|
||||||
|
|
||||||
stgwrite("\n");
|
stgwrite("\n");
|
||||||
|
|
||||||
code_idx+=opargs(numargs)+opcodes(1);
|
code_idx+=opcodes(1)+opargs(numparams);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user