Simulator bug fixes.

Fix handling of V flag, and ensure that high byte is discarded for byte
operations.
This commit is contained in:
Bruce G. Burns 2013-01-14 16:47:59 +13:00 committed by Daniel Beer
parent 611574cc86
commit db94eab4b2
1 changed files with 2 additions and 2 deletions

View File

@ -172,7 +172,7 @@ static int store_operand(struct sim_device *dev,
uint16_t addr, uint16_t data)
{
if (amode == MSP430_AMODE_REGISTER) {
dev->regs[reg] = data;
dev->regs[reg] = is_byte ? data & 0xFF : data;
return 0;
}
@ -266,7 +266,7 @@ static int step_double(struct sim_device *dev, uint16_t ins)
if (res_data & (msb << 1))
dev->regs[MSP430_REG_SR] |= MSP430_SR_C;
if (!((src_data ^ dst_data) & msb) &&
(src_data ^ dst_data) & msb)
(src_data ^ res_data) & msb)
dev->regs[MSP430_REG_SR] |= MSP430_SR_V;
break;