* hooked up EA line for M58715
mario.c:
* fixed portA startup value
* documented hardware changes to use a I8039 on a mario board
This commit is contained in:
Couriersud 2008-01-13 13:34:34 +00:00
parent a6f41e8ebd
commit 31b8c14a71
2 changed files with 45 additions and 16 deletions

View File

@ -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 ((A<R.int_rom_size) && !ea_r())
return 0x00;
return I8039_RDOP(A);
}
INLINE UINT8 M_RDOP_ARG(int A)
{
if (R.cpu_feature & FEATURE_M58715)
if ((A<R.int_rom_size) && !ea_r())
return 0x00;
return I8039_RDOP_ARG(A);
}
INLINE void CLR (UINT8 flag) { R.PSW &= ~flag; }
INLINE void SET (UINT8 flag) { R.PSW |= flag; }
@ -596,6 +613,7 @@ static void i8039_init (int index, int clock, const void *config, int (*irqcallb
R.cpu_feature = 0;
R.ram_mask = 0x7F;
R.int_rom_size = 0x800;
/* not changed on reset*/
memset(R.RAM, 0x00, 128);
R.timer = 0;
@ -605,6 +623,7 @@ static void i8035_init (int index, int clock, const void *config, int (*irqcallb
{
i8039_init(index, clock, config, irqcallback);
R.ram_mask = 0x3F;
R.int_rom_size = 0x400;
}
static void m58715_init (int index, int clock, const void *config, int (*irqcallback)(int))
@ -635,7 +654,7 @@ static void i8039_reset (void)
if (R.cpu_feature & FEATURE_M58715)
{
R.timerON = 1; /* Mario Bros. doesn't work without this */
//R.timerON = 1; /* Mario Bros. doesn't work without this */
//R.PSW |= C_FLAG; //MB will play startup sound, but wrong # */
}
R.irq_extra_cycles = 0;

View File

@ -12,6 +12,8 @@
*
****************************************************************/
#define USE_8039 (0) /* set to 1 to try 8039 hack */
#define ACTIVELOW_PORT_BIT(P,A,D) ((P & (~(1 << A))) | ((D ^ 1) << A))
#define ACTIVEHIGH_PORT_BIT(P,A,D) ((P & (~(1 << A))) | (D << A))
@ -228,27 +230,27 @@ DISCRETE_SOUND_END
static SOUND_START( mario )
{
mario_state *state = machine->driver_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)