From 9567c05d43d21ecc4fcb526109773f7174a6c4cd Mon Sep 17 00:00:00 2001 From: Michel Pollet Date: Mon, 5 Jul 2010 11:08:08 +0100 Subject: [PATCH] core: Fix MULS register MULS uses 16+ registers. Signed-off-by: Michel Pollet --- simavr/sim/sim_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/simavr/sim/sim_core.c b/simavr/sim/sim_core.c index 3901ede..3550771 100644 --- a/simavr/sim/sim_core.c +++ b/simavr/sim/sim_core.c @@ -517,8 +517,8 @@ uint16_t avr_run_one(avr_t * avr) _avr_set_r(avr, d+1, avr->data[r+1]); } break; case 0x0200: { // MULS – Multiply Signed 0000 0010 dddd rrrr - int8_t r = opcode & 0xf; - int8_t d = (opcode >> 4) & 0xf; + int8_t r = 16 + (opcode & 0xf); + int8_t d = 16 + ((opcode >> 4) & 0xf); int16_t res = ((int8_t)avr->data[r]) * ((int8_t)avr->data[d]); STATE("muls %s[%d], %s[%02x] = %d\n", avr_regname(d), ((int8_t)avr->data[d]), avr_regname(r), ((int8_t)avr->data[r]), res); _avr_set_r(avr, 0, res); -- 2.39.5