Skip to content

Commit

Permalink
Trap if add would switch instruction set.
Browse files Browse the repository at this point in the history
  • Loading branch information
DirtyHairy committed Aug 10, 2024
1 parent e7de075 commit b45eb62
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/emucore/CortexM0.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -999,6 +999,9 @@ CortexM0::err_t CortexM0::execute(uInt16 inst, uInt8 op)
rc = ra + rb;
if(rd == 15)
{
if ((rc & 1) == 0)
return errIntrinsic(ERR_INVALID_OPERATING_MODE, read_register(15) - 4);

rc &= ~1; //write_register may f this as well
rc += 2; //The program counter is special
}
Expand Down

0 comments on commit b45eb62

Please sign in to comment.