Merge branch ucsim-034-pre3 to main trunk; new version 0.4
[fw/sdcc] / sim / ucsim / avr.src / avr.cc
index 74ac188ac16236c4b4773cd87f5693c17b77cf60..2fda8beecc3b15ed605c30be6396237c6d3883e4 100644 (file)
@@ -226,8 +226,8 @@ cl_avr::disass(t_addr addr, char *sep)
                int k= code&0xfff;
                if (code&0x800)
                  k|= -4096;
-               sprintf(temp, "0x%06lx",
-                       (k+1+(signed int)addr) % rom->size);
+               sprintf(temp, "0x%06"_A_"x",
+                       t_addr((k+1+(signed int)addr) % rom->size));
                break;
              }
            default:
@@ -288,8 +288,7 @@ cl_avr::print_regs(class cl_console *con)
                 (sreg&BIT_N)?'1':'0',
                 (sreg&BIT_Z)?'1':'0',
                 (sreg&BIT_C)?'1':'0');
-  con->dd_printf("SP  = 0x%06x\n",
-                ram->get(SPH)*256+ram->get(SPL));
+  con->dd_printf("SP  = 0x%06x\n", ram->get(SPH)*256+ram->get(SPL));
 
   x= ram->get(XH)*256 + ram->get(XL);
   data= ram->get(x);
@@ -561,12 +560,12 @@ cl_avr::push_data(t_mem data)
   spl= ram->read(SPL);
   sph= ram->read(SPH);
   sp= 0xffff & (256*sph + spl);
-  ram->write(sp, &data);
+  data= ram->write(sp, data);
   sp= 0xffff & (sp-1);
   spl= sp & 0xff;
   sph= (sp>>8) & 0xff;
-  ram->write(SPL, &spl);
-  ram->write(SPH, &sph);
+  ram->write(SPL, spl);
+  ram->write(SPH, sph);
   return(resGO);
 }
 
@@ -581,14 +580,14 @@ cl_avr::push_addr(t_addr addr)
   sp= 0xffff & (256*sph + spl);
   al= addr & 0xff;
   ah= (addr>>8) & 0xff;
-  ram->write(sp, &ah);
+  ram->write(sp, ah);
   sp= 0xffff & (sp-1);
-  ram->write(sp, &al);
+  ram->write(sp, al);
   sp= 0xffff & (sp-1);
   spl= sp & 0xff;
   sph= (sp>>8) & 0xff;
-  ram->write(SPL, &spl);
-  ram->write(SPH, &sph);
+  ram->write(SPL, spl);
+  ram->write(SPH, sph);
   return(resGO);
 }
 
@@ -605,8 +604,8 @@ cl_avr::pop_data(t_mem *data)
   *data= ram->read(sp);
   spl= sp & 0xff;
   sph= (sp>>8) & 0xff;
-  ram->write(SPL, &spl);
-  ram->write(SPH, &sph);
+  ram->write(SPL, spl);
+  ram->write(SPH, sph);
 
   return(resGO);
 }
@@ -627,8 +626,8 @@ cl_avr::pop_addr(t_addr *addr)
   *addr= ah*256 + al;
   spl= sp & 0xff;
   sph= (sp>>8) & 0xff;
-  ram->write(SPL, &spl);
-  ram->write(SPH, &sph);
+  ram->write(SPL, spl);
+  ram->write(SPH, sph);
   
   return(resGO);
 }