mikechambers84 / STM8-Emulator

An STM8 microcontroller emulator and hardware design simulator.
GNU General Public License v3.0
23 stars 2 forks source link

Doesn't implement some ADDW instruction variants #10

Closed basilhussain closed 2 years ago

basilhussain commented 2 years ago

I found when trying to run some existing STM8 code of mine, that the emulator was failing with illegal opcode errors or giving incorrect results. After a lot of debugging, managed to track the problem down to being caused by the CPU emulation missing implementations for certain ADDW instruction variants!

The variants that are missing are ADDW Y, (addr8, SP) and ADDW Y, #imm16. The former gets mishandled as an ADC A, (X) instruction; the latter as ADC A, #imm8.

I am currently working on a fix for this.