* src/mcs51/gen.c (pushSide, genSignedRightShift, genDjnz, geniPush):
[fw/sdcc] / sim / ucsim / s51.src / mov.cc
index a8ae690b003eb55abbeb075b92a0a1ed01085f47..512da92b093e0c93c6a6c9c2c561a5c07ada829e 100644 (file)
@@ -418,10 +418,23 @@ int
 t_uc51::inst_mov_a_addr(uchar code)
 {
   class cl_cell *cell;
-
-  cell= get_direct(fetch());
-  acc->write(cell->read());
-  return(resGO);
+  int address = fetch();
+
+  /* If this is ACC, it is an invalid instruction */
+  if (address == ACC)
+    {
+      sim->app->get_commander()->
+        debug ("Invalid Instruction : E5 E0  MOV A,ACC  at  %06x\n", PC);
+
+      return(resHALT);
+    }
+  else
+    {
+      cell= get_direct(address);
+      acc->write(cell->read());
+      return(resGO);
+    }
+  
 }