* sim/ucsim/s51.src/uc89c51r.cc,
authorMaartenBrock <MaartenBrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 20 May 2008 15:49:59 +0000 (15:49 +0000)
committerMaartenBrock <MaartenBrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 20 May 2008 15:49:59 +0000 (15:49 +0000)
* sim/ucsim/s51.src/uc89c51rcl.h: fixed bug 1385430

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@5165 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
sim/ucsim/s51.src/uc89c51r.cc
sim/ucsim/s51.src/uc89c51rcl.h

index 13a87a3b7bcffcbe224e0760e9ed740e0eac3767..d5a294c4c1eedb9dd37bdfaf8c77f3b4763b1ffa 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,7 +7,7 @@
        * device/lib/_fseq.c,
        * device/lib/_fsneq.c: handle -0.0
        * sim/ucsim/s51.src/uc89c51r.cc,
-       * sim/ucsim/s51.src/uc89c51rcl.h: bugfix auxr should be auxr1
+       * sim/ucsim/s51.src/uc89c51rcl.h: fixed bug 1385430
        * sim/ucsim/sim.src/hwcl.h: */* confuses VC
        * src/mcs51/gen.c (genSend): fixed bug with --xstack
        * support/regression/ports/mcs51-xstack-auto/spec.mk: print floats
index b1b72e8dbf202c63ccd6bcc35e910236db976f16..0d00ac9d048a0215c13c217a4c622c24fcc02c2c 100644 (file)
@@ -28,6 +28,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "ddconfig.h"
 
 #include <stdio.h>
+#include <ctype.h>
 
 // local
 #include "uc89c51rcl.h"
@@ -98,7 +99,9 @@ cl_uc89c51r::it_priority(uchar ie_mask)
 void
 cl_uc89c51r::pre_inst(void)
 {
-  if (sfr->get(AUXR1) & bmDPS)
+  //printf("pre dptr0:%02X%02X dptr1:%02X%02X\n", dph0, dpl0, dph1, dpl1);
+  dps = (sfr->get(AUXR1) & bmDPS);
+  if (dps)
     {
       sfr->set(DPL, dpl1);
       sfr->set(DPH, dph1);
@@ -114,7 +117,7 @@ cl_uc89c51r::pre_inst(void)
 void
 cl_uc89c51r::post_inst(void)
 {
-  if (sfr->get(AUXR1) & bmDPS)
+  if (dps)
     {
       dpl1= sfr->get(DPL);
       dph1= sfr->get(DPH);
@@ -124,10 +127,62 @@ cl_uc89c51r::post_inst(void)
       dpl0= sfr->get(DPL);
       dph0= sfr->get(DPH);
     }
+  dps = (sfr->get(AUXR1) & bmDPS);
+  if (dps)
+    {
+      sfr->set(DPL, dpl1);
+      sfr->set(DPH, dph1);
+    }
+  else
+    {
+      sfr->set(DPL, dpl0);
+      sfr->set(DPH, dph0);
+    }
+  //printf("post dptr0:%02X%02X dptr1:%02X%02X\n", dph0, dpl0, dph1, dpl1);
   cl_uc51r::post_inst();
 }
 
 
+void
+cl_uc89c51r::print_regs(class cl_console_base *con)
+{
+  t_addr start;
+  uchar data, acc, dps;
+
+  start= psw->get() & 0x18;
+  //dump_memory(iram, &start, start+7, 8, /*sim->cmd_out()*/con, sim);
+  iram->dump(start, start+7, 8, con);
+  start= psw->get() & 0x18;
+  data= iram->get(iram->get(start));
+  con->dd_printf("%06x %02x %c",
+              iram->get(start), data, isprint(data)?data:'.');
+
+  acc= sfr->get(ACC);
+  con->dd_printf("  ACC= 0x%02x %3d %c  B= 0x%02x", acc, acc,
+              isprint(acc)?(acc):'.', sfr->get(B)); 
+  //eram2xram();
+  dps = sfr->get(AUXR1) & bmDPS;
+  data= xram->get(dph0*256+dpl0);
+  con->dd_printf("  %cDPTR0= 0x%02x%02x @DPTR0= 0x%02x %3d %c",
+              dps?' ':'*', dph0, dpl0,
+              data, data, isprint(data)?data:'.');
+  data= xram->get(dph1*256+dpl1);
+  con->dd_printf("  %cDPTR1= 0x%02x%02x @DPTR1= 0x%02x %3d %c\n",
+              dps?'*':' ', dph1, dpl1,
+              data, data, isprint(data)?data:'.');
+
+  data= iram->get(iram->get(start+1));
+  con->dd_printf("%06x %02x %c", iram->get(start+1), data,
+              isprint(data)?data:'.');
+  data= psw->get();
+  con->dd_printf("  PSW= 0x%02x CY=%c AC=%c OV=%c P=%c\n", data,
+              (data&bmCY)?'1':'0', (data&bmAC)?'1':'0',
+              (data&bmOV)?'1':'0', (data&bmP)?'1':'0');
+
+  print_disass(PC, con);
+}
+
+
 /*
  */
 
index 164cb9f272db00bfe57e868ecddeb053f00700a3..0661860a11bed5d9b0dda8f93d665cf90fdd7749 100644 (file)
@@ -39,6 +39,7 @@ public:
   //int t0_overflows;
   uchar dpl0, dph0;
   uchar dpl1, dph1;
+  uchar dps;
 
 public:
   cl_uc89c51r(int Itype, int Itech, class cl_sim *asim);
@@ -49,6 +50,7 @@ public:
   virtual void  pre_inst(void);
   virtual void  post_inst(void);
   virtual int   it_priority(uchar ie_mask);
+  virtual void  print_regs(class cl_console_base *con);
 
   //virtual void  do_extra_hw(int cycles);
   //virtual int   t0_overflow(void);