sim: bug fix: @SP+ always increments by 2.

The same rules for PC apply to the stack pointer. Even when byte-mode
instructions are executed, the stack pointer is incremented by a whole
word when using the indirect increment addressing mode.
This commit is contained in:
Daniel Beer 2013-12-26 16:34:09 +13:00
parent 55671036a6
commit ad4e27c1a2
1 changed files with 2 additions and 1 deletions

View File

@ -134,7 +134,8 @@ static int fetch_operand(struct sim_device *dev,
return 0;
}
addr = dev->regs[reg];
dev->regs[reg] += (is_byte && reg != MSP430_REG_PC) ? 1 : 2;
dev->regs[reg] += (is_byte && reg != MSP430_REG_PC &&
reg != MSP430_REG_SP) ? 1 : 2;
break;
}