OpenCores
URL https://opencores.org/ocsvn/zipcpu/zipcpu/trunk

Subversion Repositories zipcpu

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /zipcpu/trunk/sw/zasm
    from Rev 8 to Rev 9
    Reverse comparison

Rev 8 → Rev 9

/zparser.cpp
84,8 → 84,8
bool ZPARSER::parse_op(const char *line, ZPARSER::ZIPA pc,
ZPARSER::ZIPI &ins, const unsigned lineno) const {
const char *sp = line;
char cpy[128], *cp = cpy, *point, *dollar, *plus, *comma,
*opc, *opb;
char cpy[128], *cp = cpy, *point, *dollar, *plus, *comma, *paren,
*opc, *opb, *opa;
ZPARSER::ZIPREG ra = ZPARSER::ZIP_Rnone, rb = ZPARSER::ZIP_Rnone;
ZIPCOND cnd = ZIPC_ALWAYS;
ZIPIMM imm = 0;
118,7 → 118,7
comma = strchr(cpy, ',');
plus = strchr(cpy, '+');
dollar= strchr(cpy, '$');
// paren = strchr(cpy, '(');
paren = strchr(cpy, '(');
if (point) *point++ = '\0';
if (comma) *comma++ = '\0';
if (plus) *plus++ = '\0';
155,7 → 155,15
while(isspace(*cp))
cp++;
opb = cp;
opa = comma;
 
if (paren) {
opb = paren+1;
if ((comma)&&(opb > comma))
opa = cp;
} else if (plus)
opb = plus;
if (dollar) {
// Figure out the base
{
195,21 → 203,19
imm = -imm;
}
}
opb = dollar;
if (plus)
opb = plus;
} else
imm = 0;
 
if (*opb) for(int i=31; i>=0; i--) {
// printf("Checking for match: \'%s\' to %s", opb, zop_regstr[i]);
// printf("%s Checking for match to opB: \'%s\' to %s", opc, opb, zop_regstr[i]);
if (NULL != strcasestr(opb, zop_regstr[i])) {
// printf(" --- Match\n");
rb = (ZIPREG)i;
break;
} // else printf(" -- nope\n");
} if (comma) for(int i=31; i>=0; i--) {
// printf("Checking for match: ,%s to %s", comma, zop_regstr[i]);
if (NULL != strcasestr(comma, zop_regstr[i])) {
} if (opa) for(int i=31; i>=0; i--) {
// printf("%s Checking for match to opA: ,%s to %s", opc, opa, zop_regstr[i]);
if (NULL != strcasestr(opa, zop_regstr[i])) {
ra = (ZIPREG)i;
// printf(" --- Match\n");
break;
280,9 → 286,10
ins = op_lod(cnd,imm,rb,ra);
else ins = op_lod(cnd,imm,ra);
} else if ((strcasecmp("STO",opc)==0)||(strcasecmp("STOR",opc)==0)) {
// printf("STO: Imm = %d, RA = %d, RB = %d\n", imm, ra, rb);
if (rb != ZIP_Rnone)
ins = op_sto(cnd,rb,imm,ra);
else ins = op_sto(cnd,rb,imm);
ins = op_sto(cnd,ra,imm,rb);
else ins = op_sto(cnd,ra,imm);
} else if (strcasecmp("SUB",opc)==0) {
if (rb != ZIP_Rnone)
ins = op_sub(cnd,imm,rb,ra);
357,27 → 364,27
ins = op_clrf(cnd, rb);
else valid = false;
} else if((strcasecmp("HALT",opc)==0)||(strcasecmp("WAIT",opc)==0)) {
if ((rb == ZIP_Rnone)&&(ra==ZIP_Rnone)&&(!comma)&&(!dollar))
if ((rb == ZIP_Rnone)&&(ra==ZIP_Rnone)&&(!opa)&&(!dollar))
ins = op_halt(cnd);
else valid = false;
} else if (strcasecmp("BUSY",opc)==0) {
if ((rb == ZIP_Rnone)&&(ra==ZIP_Rnone)&&(!comma)&&(!dollar))
if ((rb == ZIP_Rnone)&&(ra==ZIP_Rnone)&&(!opa)&&(!dollar))
ins = op_busy(cnd);
else valid = false;
} else if (strcasecmp("RTU",opc)==0) {
if ((rb == ZIP_Rnone)&&(ra==ZIP_Rnone)&&(imm==0)&&(!comma)&&(!dollar))
if ((rb == ZIP_Rnone)&&(ra==ZIP_Rnone)&&(imm==0)&&(!opa)&&(!dollar))
ins = op_rtu(cnd);
else { printf("ERRR,RTU, ra=%d,rb=%d,imm=%08x,comma=%s,dollar=%s\n",
(int)ra, (int)rb, imm, (comma)?"true":"false",
(int)ra, (int)rb, imm, (opa)?"true":"false",
(dollar)?"true":"false");
valid = false;
}
} else if (strcasecmp("JMP",opc)==0) {
if ((rb != ZIP_Rnone)&&(!comma))
if ((rb != ZIP_Rnone)&&(!opa))
ins = op_not(cnd, rb);
else valid = false;
} else if (strcasecmp("NOT",opc)==0) {
if ((rb != ZIP_Rnone)&&(ra==ZIP_Rnone)&&(!comma)&&(!dollar))
if ((rb != ZIP_Rnone)&&(ra==ZIP_Rnone)&&(!opa)&&(!dollar))
ins = op_not(cnd, rb);
else valid = false;
} else valid = false;

powered by: WebSVN 2.1.0

© copyright 1999-2022 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.