From 31b8c14a717b35cacac6122c7c0c5f5781a763c2 Mon Sep 17 00:00:00 2001 From: Couriersud Date: Sun, 13 Jan 2008 13:34:34 +0000 Subject: [PATCH] i8039.c: * hooked up EA line for M58715 mario.c: * fixed portA startup value * documented hardware changes to use a I8039 on a mario board --- src/emu/cpu/i8039/i8039.c | 25 ++++++++++++++++++++++--- src/mame/audio/mario.c | 36 +++++++++++++++++++++++------------- 2 files changed, 45 insertions(+), 16 deletions(-) diff --git a/src/emu/cpu/i8039/i8039.c b/src/emu/cpu/i8039/i8039.c index b92b727af3f..d8ac07b08b2 100644 --- a/src/emu/cpu/i8039/i8039.c +++ b/src/emu/cpu/i8039/i8039.c @@ -63,8 +63,8 @@ static int Ext_IRQ(void); static int Timer_IRQ(void); #define M_RDMEM(A) I8039_RDMEM(A) -#define M_RDOP(A) I8039_RDOP(A) -#define M_RDOP_ARG(A) I8039_RDOP_ARG(A) +//#define M_RDOP(A) I8039_RDOP(A) +//#define M_RDOP_ARG(A) I8039_RDOP_ARG(A) #define M_IN(A) I8039_In(A) #define M_OUT(A,V) I8039_Out(A,V) @@ -94,6 +94,7 @@ typedef struct UINT8 EA; /* latched EA input */ UINT8 cpu_feature; /* process feature */ UINT8 ram_mask; /* internal ram size - 1 */ + UINT16 int_rom_size; /* internal rom size */ UINT8 pending_irq, irq_executing, masterClock, regPtr; UINT8 t_flag, timer, timerON, countON, xirq_en, tirq_en; UINT16 A11; @@ -142,6 +143,22 @@ INLINE UINT8 ea_r(void) return R.EA; } +INLINE UINT8 M_RDOP(int A) +{ + if (R.cpu_feature & FEATURE_M58715) + if ((Adriver_data; +#if USE_8039 + UINT8 *SND = memory_region(REGION_CPU2); + SND[1] = 0x01; +#endif + state_save_register_global(state->last); state_save_register_global(state->portT); - soundlatch_clear_w(0,0); - soundlatch2_clear_w(0,0); - soundlatch3_clear_w(0,0); - soundlatch4_clear_w(0,0); - I8035_P1_W(0xf0); /* Port is in high impedance state after reset */ - I8035_P2_W(0xff); /* Port is in high impedance state after reset */ - /* - * The code below will play the correct start up sound according - * to mametesters. - * However, it is not backed by hardware at all. The LS393 latch - */ - //soundlatch_w(0,2); } static SOUND_RESET( mario ) { mario_state *state = machine->driver_data; + soundlatch_clear_w(0,0); + soundlatch2_clear_w(0,0); + soundlatch3_clear_w(0,0); + soundlatch4_clear_w(0,0); + I8035_P1_W(0x00); /* Input port */ + I8035_P2_W(0xff); /* Port is in high impedance state after reset */ + state->last = 0; } @@ -280,8 +282,12 @@ static READ8_HANDLER( mario_sh_t1_r ) static READ8_HANDLER( mario_sh_ea_r ) { +#if USE_8039 + return 1; +#else int p2 = (I8035_P2_R() >> 5) & 1; return p2 ^ 1; +#endif } static READ8_HANDLER( mario_sh_tune_r ) @@ -400,7 +406,7 @@ static ADDRESS_MAP_START( mario_sound_io_map, ADDRESS_SPACE_IO, 8 ) AM_RANGE(I8039_p2, I8039_p2) AM_READWRITE(mario_sh_p2_r, mario_sh_p2_w) AM_RANGE(I8039_t0, I8039_t0) AM_READ(mario_sh_t0_r) AM_RANGE(I8039_t1, I8039_t1) AM_READ(mario_sh_t1_r) - AM_RANGE(I8039_ea, I8039_ea) AM_READ(mario_sh_ea_r) + AM_RANGE(I8039_ea, I8039_ea) AM_READ(mario_sh_ea_r) /* only for documentation purposes right now */ ADDRESS_MAP_END static ADDRESS_MAP_START( masao_sound_map, ADDRESS_SPACE_PROGRAM, 8 ) @@ -430,7 +436,11 @@ static const struct AY8910interface ay8910_interface = MACHINE_DRIVER_START( mario_audio ) +#if USE_8039 + MDRV_CPU_ADD(I8039, I8035_CLOCK) /* audio CPU */ /* 730 kHz */ +#else MDRV_CPU_ADD(M58715, I8035_CLOCK) /* audio CPU */ /* 730 kHz */ +#endif MDRV_CPU_PROGRAM_MAP(mario_sound_map, 0) MDRV_CPU_IO_MAP(mario_sound_io_map, 0)