X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=sim%2Fucsim%2Fs51.src%2Fuc89c51r.cc;h=0d00ac9d048a0215c13c217a4c622c24fcc02c2c;hb=f7003552f3b3cbe77914bedaac032e3356e0c0b2;hp=b1b72e8dbf202c63ccd6bcc35e910236db976f16;hpb=a8a7fc8a514bc79114c6d76d6a6aeb885387478c;p=fw%2Fsdcc diff --git a/sim/ucsim/s51.src/uc89c51r.cc b/sim/ucsim/s51.src/uc89c51r.cc index b1b72e8d..0d00ac9d 100644 --- a/sim/ucsim/s51.src/uc89c51r.cc +++ b/sim/ucsim/s51.src/uc89c51r.cc @@ -28,6 +28,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "ddconfig.h" #include +#include // 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); +} + + /* */