From cd0ace2832b2088e5a973a50ebbab6e57c56b91f Mon Sep 17 00:00:00 2001 From: notaz Date: Sat, 10 Aug 2013 19:46:27 +0300 Subject: [PATCH] fix incomplete init --- cpu/sh2/sh2.c | 7 ++++++- pico/32x/32x.c | 5 ++--- pico/32x/sh2soc.c | 6 ++++++ pico/pico_int.h | 1 + 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/cpu/sh2/sh2.c b/cpu/sh2/sh2.c index 7b83cf2..23b8fc0 100644 --- a/cpu/sh2/sh2.c +++ b/cpu/sh2/sh2.c @@ -17,10 +17,15 @@ int sh2_init(SH2 *sh2, int is_slave, SH2 *other_sh2) { int ret = 0; + unsigned int mult_m68k_to_sh2 = sh2->mult_m68k_to_sh2; + unsigned int mult_sh2_to_m68k = sh2->mult_sh2_to_m68k; - memset(sh2, 0, offsetof(SH2, mult_m68k_to_sh2)); + memset(sh2, 0, sizeof(*sh2)); sh2->is_slave = is_slave; sh2->other_sh2 = other_sh2; + sh2->mult_m68k_to_sh2 = mult_m68k_to_sh2; + sh2->mult_sh2_to_m68k = mult_sh2_to_m68k; + pdb_register_cpu(sh2, PDBCT_SH2, is_slave ? "ssh2" : "msh2"); #ifdef DRC_SH2 ret = sh2_drc_init(sh2); diff --git a/pico/32x/32x.c b/pico/32x/32x.c index d0110c1..dd4d0ed 100644 --- a/pico/32x/32x.c +++ b/pico/32x/32x.c @@ -85,9 +85,6 @@ void Pico32xStartup(void) if (!Pico.m.pal) Pico32x.vdp_regs[0] |= P32XV_nPAL; - PREG8(msh2.peri_regs, 4) = - PREG8(ssh2.peri_regs, 4) = 0x84; // SCI SSR - rendstatus_old = -1; emu_32x_startup(); @@ -100,6 +97,8 @@ void p32x_reset_sh2s(void) sh2_reset(&msh2); sh2_reset(&ssh2); + sh2_peripheral_reset(&msh2); + sh2_peripheral_reset(&ssh2); // if we don't have BIOS set, perform it's work here. // MSH2 diff --git a/pico/32x/sh2soc.c b/pico/32x/sh2soc.c index bdd07a0..8b97153 100644 --- a/pico/32x/sh2soc.c +++ b/pico/32x/sh2soc.c @@ -207,6 +207,12 @@ void p32x_timers_do(unsigned int m68k_slice) } } +void sh2_peripheral_reset(SH2 *sh2) +{ + memset(sh2->peri_regs, 0, sizeof(sh2->peri_regs)); // ? + PREG8(sh2->peri_regs, 4) = 0x84; // SCI SSR +} + // ------------------------------------------------------------------ // SH2 internal peripheral memhandlers // we keep them in little endian format diff --git a/pico/pico_int.h b/pico/pico_int.h index 9fcc6d4..34b2881 100644 --- a/pico/pico_int.h +++ b/pico/pico_int.h @@ -804,6 +804,7 @@ void p32x_dreq0_trigger(void); void p32x_dreq1_trigger(void); void p32x_timers_recalc(void); void p32x_timers_do(unsigned int m68k_slice); +void sh2_peripheral_reset(SH2 *sh2); unsigned int sh2_peripheral_read8(unsigned int a, SH2 *sh2); unsigned int sh2_peripheral_read16(unsigned int a, SH2 *sh2); unsigned int sh2_peripheral_read32(unsigned int a, SH2 *sh2); -- 2.39.2