X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=src%2Fcpu8051.c;h=a44cd7fe6131f7d23a985dd26f4663b8adecee65;hb=68a328d198d28dc2dd6ab65bda0cfcef3d12e49a;hp=22ecf1ef0d9ef0cd23ef9c843eabe7fa08190f38;hpb=311abd4cfc360ef689606153b4644e02633f2079;p=emu8051.git diff --git a/src/cpu8051.c b/src/cpu8051.c index 22ecf1e..a44cd7f 100644 --- a/src/cpu8051.c +++ b/src/cpu8051.c @@ -95,6 +95,8 @@ ToggleBreakpoint(unsigned int address) void cpu8051_init(void) { + memory_init(); + cpu8051.pc = 0; cpu8051.clock = 0; cpu8051.active_priority = -1; @@ -105,24 +107,18 @@ cpu8051_init(void) void cpu8051_Reset(void) { - int i; - cpu8051.pc = 0; cpu8051.clock = 0; cpu8051.active_priority = -1; - /* Reset registers */ - - for (i = 0; i < 256; i++) { - /* Clear IRAM nad SFR */ - memory_write8(INT_MEM_ID, i, 0); - } + /* Clear IRAM and SFR. */ + memory_clear(INT_MEM_ID); - memory_write8(INT_MEM_ID, _P0_, 0xFF); - memory_write8(INT_MEM_ID, _P1_, 0xFF); - memory_write8(INT_MEM_ID, _P2_, 0xFF); - memory_write8(INT_MEM_ID, _P3_, 0xFF); - memory_write8(INT_MEM_ID, _SP_, 0x07); + memory_sfr_write8(_P0_, 0xFF); + memory_sfr_write8(_P1_, 0xFF); + memory_sfr_write8(_P2_, 0xFF); + memory_sfr_write8(_P3_, 0xFF); + memory_sfr_write8(_SP_, 0x07); } static void