Fix memset.

This commit is contained in:
Christian Speckner 2024-07-29 20:25:53 +02:00
parent 30775ce101
commit f1031230f9
1 changed files with 2 additions and 2 deletions

View File

@ -27,7 +27,7 @@ using namespace elfEnvironment;
namespace { namespace {
CortexM0::err_t memset(uInt32 target, uInt8 value, uInt32 size, CortexM0& cortex) CortexM0::err_t memset(uInt32 target, uInt8 value, uInt32 size, CortexM0& cortex)
{ {
const uInt16 value16 = value | (value << 16); const uInt16 value16 = value | (value << 8);
const uInt32 value32 = value16 | (value16 << 16); const uInt32 value32 = value16 | (value16 << 16);
CortexM0::err_t err; CortexM0::err_t err;
uInt32 ptr = target; uInt32 ptr = target;
@ -134,7 +134,7 @@ CortexM0::err_t VcsLib::fetch16(uInt32 address, uInt16& value, uInt8& op, Cortex
switch (address) { switch (address) {
case ADDR_MEMSET: case ADDR_MEMSET:
err = memset(cortex.getRegister(0), cortex.getRegister(1), cortex.getRegister(3), cortex); err = memset(cortex.getRegister(0), cortex.getRegister(1), cortex.getRegister(2), cortex);
if (err) return err; if (err) return err;
return returnFromStub(value, op); return returnFromStub(value, op);