My question is about representing the carry-bit and arithmetic shift right in my ARM thumb simulation function. do I have to create a boolian variable if the op code is the binary bit-value of ADC then i add the boolian variable as 1 and if not then it's SBC? also, how to represent the logic of ASR in my code?
instructions of format 4 by opcode
case 2: // format 4
op = (instr >> 6) & 0xF;
rd = instr & 7;
rs = (instr >> 3) & 7;
if (op == 0)
{
cout << " AND " << rd << "," << rs << endl;
Regs[rd] = Regs[rd] & Regs[rs];
}
else if (op == 1)
{
cout << " EOR " << rd << "," << rs << endl;
Regs[rd] = Regs[rd] ^ Regs[rs];
}
else if (op == 2)
{
cout << " LSL " << rd << "," << rs << endl;
Regs[rd] = Regs[rd] << Regs[rs];
}
else if (op == 3)
{
cout << " LSR " << rd << "," << rs << endl;
Regs[rd] = Regs[rd] >> Regs[rs];
}
**else if (op == 4)
{
cout << " ASR " << rd << "," << rs << endl;
Regs[rd] = Regs[rd] >> Regs[rs];
}**
**else if (op == 5)
{
cout << " ADC " << rd << "," << rs << endl;
Regs[rd] = Regs[rd] & Regs[rs];
}
else if (op == 6)
{
cout << " SBC " << rd << "," << rs << endl;
Regs[rd] = Regs[rd] - Regs[rs];
}**
break;