static asmLineNode * hc08_asmLineNodeFromLineNode (lineNode *ln) { asmLineNode *aln = newAsmLineNode(); char *op, op1[256], op2[256]; int opsize; const char *p; char inst[8]; p = ln->line; while (*p && isspace(*p)) p++; for (op = inst, opsize=1; *p; p++) { if (isspace(*p) || *p == ';' || *p == ':' || *p == '=') break; else if (opsize < sizeof(inst)) *op++ = tolower(*p), opsize++; } *op = '\0'; if (*p == ';' || *p == ':' || *p == '=') return aln; while (*p && isspace(*p)) p++; if (*p == '=') return aln; for (op = op1, opsize=1; *p && *p != ','; p++) { if (!isspace(*p) && opsize < sizeof(op1)) *op++ = tolower(*p), opsize++; } *op = '\0'; if (*p == ',') p++; for (op = op2, opsize=1; *p && *p != ','; p++) { if (!isspace(*p) && opsize < sizeof(op2)) *op++ = tolower(*p), opsize++; } *op = '\0'; aln->size = hc08_instructionSize(inst, op1, op2); return aln; }
static asmLineNode * asmLineNodeFromLineNode (lineNode *ln) { asmLineNode *aln = newAsmLineNode(); char *op, op1[256], op2[256]; int opsize; const char *p; char inst[8]; mcs51opcodedata *opdat; p = ln->line; while (*p && isspace(*p)) p++; for (op = inst, opsize=1; *p; p++) { if (isspace(*p) || *p == ';' || *p == ':' || *p == '=') break; else if (opsize < sizeof(inst)) *op++ = tolower(*p), opsize++; } *op = '\0'; if (*p == ';' || *p == ':' || *p == '=') return aln; while (*p && isspace(*p)) p++; if (*p == '=') return aln; for (op = op1, opsize=1; *p && *p != ','; p++) { if (!isspace(*p) && opsize < sizeof(op1)) *op++ = tolower(*p), opsize++; } *op = '\0'; if (*p == ',') p++; for (op = op2, opsize=1; *p && *p != ','; p++) { if (!isspace(*p) && opsize < sizeof(op2)) *op++ = tolower(*p), opsize++; } *op = '\0'; aln->size = instructionSize(inst, op1, op2); aln->regsRead = newBitVect (END_IDX); aln->regsWritten = newBitVect (END_IDX); opdat = bsearch (inst, mcs51opcodeDataTable, sizeof(mcs51opcodeDataTable)/sizeof(mcs51opcodedata), sizeof(mcs51opcodedata), mcs51opcodeCompare); if (opdat) { updateOpRW (aln, op1, opdat->op1type); updateOpRW (aln, op2, opdat->op2type); if (strchr(opdat->pswtype,'r')) aln->regsRead = bitVectSetBit (aln->regsRead, CND_IDX); if (strchr(opdat->pswtype,'w')) aln->regsWritten = bitVectSetBit (aln->regsWritten, CND_IDX); } return aln; }