collapse some duplicated code (nw)

This commit is contained in:
David Haywood 2013-05-03 02:03:46 +00:00
parent 40ef144283
commit 0d1bf12b61
5 changed files with 229 additions and 215 deletions

View File

@ -8,6 +8,10 @@
//#define debuglog printf
#define debuglog logerror
#define invalidlog printf
//#define invalidlog logerror
static ADDRESS_MAP_START( coldfire_regs_map, AS_0, 32, mcf5206e_peripheral_device )
@ -170,7 +174,7 @@ READ8_MEMBER( mcf5206e_peripheral_device::ICR13_r )
case 1:
case 2:
case 3:
debuglog("%s: invalid ICR13_r %d\n", this->machine().describe_context(), offset);
invalidlog("%s: invalid ICR13_r %d\n", this->machine().describe_context(), offset);
return 0;
}
@ -189,7 +193,7 @@ WRITE8_MEMBER( mcf5206e_peripheral_device::ICR13_w )
case 1:
case 2:
case 3:
debuglog("%s: invalid ICR13_w %d, %02x\n", this->machine().describe_context(), offset, data);
invalidlog("%s: invalid ICR13_w %d, %02x\n", this->machine().describe_context(), offset, data);
break;
}
}
@ -204,7 +208,7 @@ inline UINT16 mcf5206e_peripheral_device::CSAR_r(int which, int offset, UINT16 m
}
else
{
debuglog("%s: invalid CSAR%d_r with offset %d\n", this->machine().describe_context(), which, offset);
invalidlog("%s: invalid CSAR%d_r with offset %d\n", this->machine().describe_context(), which, offset);
return 0;
}
}
@ -218,7 +222,7 @@ inline void mcf5206e_peripheral_device::CSAR_w(int which, int offset, UINT16 dat
}
else
{
debuglog("%s: invalid CSAR%d_w with offset %d %04x\n", this->machine().describe_context(), which, offset, data);
invalidlog("%s: invalid CSAR%d_w with offset %d %04x\n", this->machine().describe_context(), which, offset, data);
}
}
@ -243,7 +247,7 @@ inline UINT16 mcf5206e_peripheral_device::CSCR_r(int which, int offset, UINT16 m
}
else
{
debuglog("%s: invalid CSCR%d_r with offset %d\n", this->machine().describe_context(), which, offset);
invalidlog("%s: invalid CSCR%d_r with offset %d\n", this->machine().describe_context(), which, offset);
return 0;
}
}
@ -257,7 +261,7 @@ inline void mcf5206e_peripheral_device::CSCR_w(int which, int offset, UINT16 dat
}
else
{
debuglog("%s: invalid CSCR%d_r with offset %d %04x\n", this->machine().describe_context(), which, offset, data);
invalidlog("%s: invalid CSCR%d_r with offset %d %04x\n", this->machine().describe_context(), which, offset, data);
}
}
@ -331,7 +335,7 @@ READ16_MEMBER( mcf5206e_peripheral_device::DMCR_r)
debuglog("%s: DMCR_r %04x\n", this->machine().describe_context(), mem_mask);
return m_DMCR;
case 0:
debuglog("%s: invalid DMCR_r %d %04x\n", this->machine().describe_context(), offset, mem_mask);
invalidlog("%s: invalid DMCR_r %d %04x\n", this->machine().describe_context(), offset, mem_mask);
return 0;
}
@ -347,7 +351,7 @@ WRITE16_MEMBER( mcf5206e_peripheral_device::DMCR_w)
debuglog("%s: DMCR_w %04x %04x\n", this->machine().describe_context(), data, mem_mask);
break;
case 0:
debuglog("%s: invalid DMCR_w %d, %04x %04x\n", this->machine().describe_context(), offset, data, mem_mask);
invalidlog("%s: invalid DMCR_w %d, %04x %04x\n", this->machine().describe_context(), offset, data, mem_mask);
break;
}
@ -362,7 +366,7 @@ READ16_MEMBER( mcf5206e_peripheral_device::PAR_r)
debuglog("%s: PAR_r %04x\n", this->machine().describe_context(), mem_mask);
return m_PAR;
case 0:
debuglog("%s: invalid PAR_r %d %04x\n", this->machine().describe_context(), offset, mem_mask);
invalidlog("%s: invalid PAR_r %d %04x\n", this->machine().describe_context(), offset, mem_mask);
return 0;
}
@ -378,7 +382,7 @@ WRITE16_MEMBER( mcf5206e_peripheral_device::PAR_w)
debuglog("%s: PAR_w %04x %04x\n", this->machine().describe_context(), data, mem_mask);
break;
case 0:
debuglog("%s: invalid PAR_w %d, %04x %04x\n", this->machine().describe_context(), offset, data, mem_mask);
invalidlog("%s: invalid PAR_w %d, %04x %04x\n", this->machine().describe_context(), offset, data, mem_mask);
break;
}
@ -393,7 +397,7 @@ READ8_MEMBER( mcf5206e_peripheral_device::PPDDR_r)
case 0:
case 2:
case 3:
debuglog("%s: invalid PPDDR_r %d\n", this->machine().describe_context(), offset);
invalidlog("%s: invalid PPDDR_r %d\n", this->machine().describe_context(), offset);
return 0;
case 1: // '$1C5'
debuglog("%s: PPDDR_r\n", this->machine().describe_context());
@ -410,7 +414,7 @@ WRITE8_MEMBER( mcf5206e_peripheral_device::PPDDR_w)
case 0:
case 2:
case 3:
debuglog("%s: invalid PPDDR_w %d %02x\n", this->machine().describe_context(), offset, data);
invalidlog("%s: invalid PPDDR_w %d %02x\n", this->machine().describe_context(), offset, data);
break;
case 1: // '$1C5'
m_PPDDR = data;
@ -426,7 +430,7 @@ READ8_MEMBER( mcf5206e_peripheral_device::PPDAT_r)
case 0:
case 2:
case 3:
debuglog("%s: invalid PPDAT_r %d\n", this->machine().describe_context(), offset);
invalidlog("%s: invalid PPDAT_r %d\n", this->machine().describe_context(), offset);
return 0;
case 1: // '$1C9'
debuglog("%s: PPDAT_r\n", this->machine().describe_context());
@ -443,7 +447,7 @@ WRITE8_MEMBER( mcf5206e_peripheral_device::PPDAT_w)
case 0:
case 2:
case 3:
debuglog("%s: invalid PPDAT_w %d, %02x\n", this->machine().describe_context(), offset, data);
invalidlog("%s: invalid PPDAT_w %d, %02x\n", this->machine().describe_context(), offset, data);
break;
case 1: // '$1C9'
m_PPDAT = data; // should use a callback.
@ -464,7 +468,7 @@ READ8_MEMBER( mcf5206e_peripheral_device::MBCR_r)
case 1:
case 2:
case 3:
debuglog("%s: invalid MBCR_r %d\n", this->machine().describe_context(), offset);
invalidlog("%s: invalid MBCR_r %d\n", this->machine().describe_context(), offset);
return 0;
}
@ -482,7 +486,7 @@ WRITE8_MEMBER( mcf5206e_peripheral_device::MBCR_w)
case 1:
case 2:
case 3:
debuglog("%s: invalid MBCR_w %d, %02x\n", this->machine().describe_context(), offset, data);
invalidlog("%s: invalid MBCR_w %d, %02x\n", this->machine().describe_context(), offset, data);
break;
}
@ -498,7 +502,7 @@ READ8_MEMBER( mcf5206e_peripheral_device::MFDR_r)
case 1:
case 2:
case 3:
debuglog("%s: invalid MFDR_r %d\n", this->machine().describe_context(), offset);
invalidlog("%s: invalid MFDR_r %d\n", this->machine().describe_context(), offset);
return 0;
}
@ -516,7 +520,7 @@ WRITE8_MEMBER( mcf5206e_peripheral_device::MFDR_w)
case 1:
case 2:
case 3:
debuglog("%s: invalid MFDR_w %d, %02x\n", this->machine().describe_context(), offset, data);
invalidlog("%s: invalid MFDR_w %d, %02x\n", this->machine().describe_context(), offset, data);
break;
}
@ -542,7 +546,7 @@ READ8_MEMBER( mcf5206e_peripheral_device::MBSR_r)
case 1:
case 2:
case 3:
debuglog("%s: invalid MBSR_r %d\n", this->machine().describe_context(), offset);
invalidlog("%s: invalid MBSR_r %d\n", this->machine().describe_context(), offset);
return 0;
}
@ -560,7 +564,7 @@ WRITE8_MEMBER( mcf5206e_peripheral_device::MBSR_w)
case 1:
case 2:
case 3:
debuglog("%s: invalid MBSR_w %d, %02x\n", this->machine().describe_context(), offset, data);
invalidlog("%s: invalid MBSR_w %d, %02x\n", this->machine().describe_context(), offset, data);
break;
}
@ -584,7 +588,7 @@ READ8_MEMBER( mcf5206e_peripheral_device::MBDR_r)
case 1:
case 2:
case 3:
debuglog("%s: invalid MBDR_r %d\n", this->machine().describe_context(), offset);
invalidlog("%s: invalid MBDR_r %d\n", this->machine().describe_context(), offset);
return 0;
}
@ -602,7 +606,7 @@ WRITE8_MEMBER( mcf5206e_peripheral_device::MBDR_w)
case 1:
case 2:
case 3:
debuglog("%s: invalid MBDR_w %d, %02x\n", this->machine().describe_context(), offset, data);
invalidlog("%s: invalid MBDR_w %d, %02x\n", this->machine().describe_context(), offset, data);
break;
}
@ -618,7 +622,7 @@ READ16_MEMBER( mcf5206e_peripheral_device::IMR_r)
debuglog("%s: IMR_r %04x\n", this->machine().describe_context(), mem_mask);
return m_IMR;
case 0:
debuglog("%s: invalid IMR_r %d %04x\n", this->machine().describe_context(), offset, mem_mask);
invalidlog("%s: invalid IMR_r %d %04x\n", this->machine().describe_context(), offset, mem_mask);
return 0;
}
@ -634,7 +638,7 @@ WRITE16_MEMBER( mcf5206e_peripheral_device::IMR_w)
debuglog("%s: IMR_w %04x %04x\n", this->machine().describe_context(), data, mem_mask);
break;
case 0:
debuglog("%s: invalid IMR_w %d, %04x %04x\n", this->machine().describe_context(), offset, data, mem_mask);
invalidlog("%s: invalid IMR_w %d, %04x %04x\n", this->machine().describe_context(), offset, data, mem_mask);
break;
}
@ -662,7 +666,7 @@ TIMER_CALLBACK_MEMBER(mcf5206e_peripheral_device::timer1_callback)
debuglog("timer1_callback\n");
timer1->adjust(attotime::from_msec(100)); // completely made up value just to fire our timers for now
timer1->adjust(attotime::from_msec(10)); // completely made up value just to fire our timers for now
}
@ -674,7 +678,7 @@ READ16_MEMBER( mcf5206e_peripheral_device::TMR1_r)
debuglog("%s: TMR1_r %04x\n", this->machine().describe_context(), mem_mask);
return m_TMR1;
case 1:
debuglog("%s: invalid TMR1_r %d %04x\n", this->machine().describe_context(), offset, mem_mask);
invalidlog("%s: invalid TMR1_r %d %04x\n", this->machine().describe_context(), offset, mem_mask);
return 0;
}
@ -689,8 +693,7 @@ WRITE16_MEMBER( mcf5206e_peripheral_device::TMR1_w)
COMBINE_DATA(&m_TMR1);
debuglog("%s: TMR1_w %04x %04x\n", this->machine().describe_context(), data, mem_mask);
debuglog(" (Prescale) PS : %02x (Capture Edge/Interrupt) CE : %01x (Output Mode) OM : %01x (Output Reference Interrupt En) ORI : %01x Free Run (FRR) : %01x Input Clock Source (ICLK) : %01x (Reset Timer) RST : %01x \n",
(m_TMR1 & 0xff00)>>8, (m_TMR1 & 0x00c0)>>6, (m_TMR1 & 0x0020)>>5, (m_TMR1 & 0x0010)>>4, (m_TMR1 & 0x0008)>>3, (m_TMR1 & 0x0006)>>1, (m_TMR1 & 0x0001)>>0);
debuglog(" (Prescale) PS : %02x (Capture Edge/Interrupt) CE : %01x (Output Mode) OM : %01x (Output Reference Interrupt En) ORI : %01x Free Run (FRR) : %01x Input Clock Source (ICLK) : %01x (Reset Timer) RST : %01x \n", (m_TMR1 & 0xff00)>>8, (m_TMR1 & 0x00c0)>>6, (m_TMR1 & 0x0020)>>5, (m_TMR1 & 0x0010)>>4, (m_TMR1 & 0x0008)>>3, (m_TMR1 & 0x0006)>>1, (m_TMR1 & 0x0001)>>0);
if (m_TMR1 & 0x0001)
{
@ -704,7 +707,7 @@ WRITE16_MEMBER( mcf5206e_peripheral_device::TMR1_w)
break;
case 1:
debuglog("%s: invalid TMR1_w %d, %04x %04x\n", this->machine().describe_context(), offset, data, mem_mask);
invalidlog("%s: invalid TMR1_w %d, %04x %04x\n", this->machine().describe_context(), offset, data, mem_mask);
break;
}
@ -718,7 +721,7 @@ READ16_MEMBER( mcf5206e_peripheral_device::TRR1_r)
debuglog("%s: TRR1_r %04x\n", this->machine().describe_context(), mem_mask);
return m_TRR1;
case 1:
debuglog("%s: invalid TRR1_r %d %04x\n", this->machine().describe_context(), offset, mem_mask);
invalidlog("%s: invalid TRR1_r %d %04x\n", this->machine().describe_context(), offset, mem_mask);
return 0;
}
@ -752,7 +755,7 @@ READ8_MEMBER( mcf5206e_peripheral_device::TER1_r)
case 0:
case 2:
case 3:
debuglog("%s: invalid TER1_r %d\n", this->machine().describe_context(), offset);
invalidlog("%s: invalid TER1_r %d\n", this->machine().describe_context(), offset);
return 0;
}
@ -770,7 +773,7 @@ WRITE8_MEMBER( mcf5206e_peripheral_device::TER1_w)
case 0:
case 2:
case 3:
debuglog("%s: invalid TER1_w %d, %02x\n", this->machine().describe_context(), offset, data);
invalidlog("%s: invalid TER1_w %d, %02x\n", this->machine().describe_context(), offset, data);
break;
}
@ -784,7 +787,7 @@ READ16_MEMBER( mcf5206e_peripheral_device::TCN1_r)
debuglog("%s: TCN1_r %04x\n", this->machine().describe_context(), mem_mask);
return 0x8ca0 -1;// m_TCN1; // this should be the counter, code has a hardcoded >= check against 8ca0.
case 1:
debuglog("%s: invalid TCN1_r %d %04x\n", this->machine().describe_context(), offset, mem_mask);
invalidlog("%s: invalid TCN1_r %d %04x\n", this->machine().describe_context(), offset, mem_mask);
return 0;
}
@ -800,7 +803,7 @@ WRITE16_MEMBER( mcf5206e_peripheral_device::TCN1_w)
debuglog("%s: TCN1_w %04x %04x\n", this->machine().describe_context(), data, mem_mask);
break;
case 1:
debuglog("%s: invalid TCN1_w %d, %04x %04x\n", this->machine().describe_context(), offset, data, mem_mask);
invalidlog("%s: invalid TCN1_w %d, %04x %04x\n", this->machine().describe_context(), offset, data, mem_mask);
break;
}

View File

@ -444,15 +444,15 @@ ADDRESS_MAP_END
void bfm_sc4_reset_serial_vfd(running_machine &machine)
{
sc4_state *state = machine.driver_data<sc4_state>();
bfm_sc45_state *state = machine.driver_data<bfm_sc45_state>();
state->m_vfd0->reset();
state->vfd_old_clock = false;
}
void bfm_sc4_write_serial_vfd(running_machine &machine, bool cs, bool clock, bool data)
void bfm_sc45_write_serial_vfd(running_machine &machine, bool cs, bool clock, bool data)
{
sc4_state *state = machine.driver_data<sc4_state>();
bfm_sc45_state *state = machine.driver_data<bfm_sc45_state>();
// if we're turned on
if ( cs )
@ -555,7 +555,7 @@ void bfm_sc4_68307_portb_w(address_space &space, bool dedicated, UINT16 data, UI
// serial output to the VFD at least..
logerror("%08x bfm_sc4_68307_portb_w %04x %04x\n", pc, data, line_mask);
bfm_sc4_write_serial_vfd(space.machine(), (data & 0x4000)?1:0, (data & 0x1000)?1:0, !(data & 0x2000)?1:0);
bfm_sc45_write_serial_vfd(space.machine(), (data & 0x4000)?1:0, (data & 0x1000)?1:0, !(data & 0x2000)?1:0);
bfm_sc4_reel3_w(space, 0, (data&0x0f00)>>8, 0xff);
}

View File

@ -10,70 +10,31 @@
#include "emu.h"
#include "includes/bfm_sc5.h"
#include "machine/mcf5206e.h"
#include "bfm_sc5.lh"
#include "video/awpvid.h"
void bfm_sc5_reset_serial_vfd(running_machine &machine)
WRITE16_MEMBER( bfm_sc5_state::sc5_duart_w )
{
bfm_sc5_state *state = machine.driver_data<bfm_sc5_state>();
// clearly a duart of some kind, write patterns are the same as SC4 games
// printf("%s: duart_w %1x %04x %04x\n", machine().describe_context(), offset, data, mem_mask);
state->m_vfd0->reset();
state->vfd_old_clock = false;
}
void bfm_sc5_write_serial_vfd(running_machine &machine, bool cs, bool clock, bool data)
{
bfm_sc5_state *state = machine.driver_data<bfm_sc5_state>();
// if we're turned on
if ( cs )
if (mem_mask &0xff00)
{
if ( !state->vfd_enabled )
{
bfm_sc5_reset_serial_vfd(machine);
state->vfd_old_clock = clock;
state->vfd_enabled = true;
}
else
{
// if the clock line changes
if ( clock != state->vfd_old_clock )
{
if ( !clock )
{
//Should move to the internal serial process when DM01 is device-ified
// m_vfd0->shift_data(!data);
state->vfd_ser_value <<= 1;
if (data) state->vfd_ser_value |= 1;
state->vfd_ser_count++;
if ( state->vfd_ser_count == 8 )
{
state->vfd_ser_count = 0;
// if (machine.device("matrix"))
// {
// BFM_dm01_writedata(machine,state->vfd_ser_value);
// }
// else
{
state->m_vfd0->write_char(state->vfd_ser_value);
}
}
}
state->vfd_old_clock = clock;
}
}
duart68681_w(m_duart,space,offset,(data>>8)&0x00ff);
}
else
{
state->vfd_enabled = false;
logerror("%s: duart_w %1x %04x %04x\n", machine().describe_context(), offset, data, mem_mask);
}
}
}
static ADDRESS_MAP_START( sc5_map, AS_PROGRAM, 32, bfm_sc5_state )
// ROM (max size?)
@ -81,114 +42,118 @@ static ADDRESS_MAP_START( sc5_map, AS_PROGRAM, 32, bfm_sc5_state )
// ?
AM_RANGE(0x01000000, 0x0100ffff) AM_RAM
#if 1
// dev1
AM_RANGE(0x01010000, 0x01010003) AM_NOP
AM_RANGE(0x01010010, 0x01010013) AM_NOP
AM_RANGE(0x01010020, 0x01010023) AM_NOP
AM_RANGE(0x01010030, 0x01010033) AM_NOP
AM_RANGE(0x01010040, 0x01010043) AM_NOP
AM_RANGE(0x01010050, 0x01010053) AM_NOP
AM_RANGE(0x01010060, 0x01010063) AM_NOP
AM_RANGE(0x01010070, 0x01010073) AM_NOP
AM_RANGE(0x01010080, 0x01010083) AM_NOP
AM_RANGE(0x01010090, 0x01010093) AM_NOP
AM_RANGE(0x010100a0, 0x010100a3) AM_NOP
AM_RANGE(0x010100b0, 0x010100b3) AM_NOP
AM_RANGE(0x010100c0, 0x010100c3) AM_NOP
AM_RANGE(0x010100d0, 0x010100d3) AM_NOP
AM_RANGE(0x010100e0, 0x010100e3) AM_NOP
AM_RANGE(0x010100f0, 0x010100f3) AM_NOP
AM_RANGE(0x01010100, 0x01010103) AM_NOP
AM_RANGE(0x01010110, 0x01010113) AM_NOP
AM_RANGE(0x01010120, 0x01010123) AM_NOP
AM_RANGE(0x01010130, 0x01010133) AM_NOP
AM_RANGE(0x01010140, 0x01010143) AM_NOP
AM_RANGE(0x01010150, 0x01010153) AM_NOP
AM_RANGE(0x01010160, 0x01010163) AM_NOP
AM_RANGE(0x01010170, 0x01010173) AM_NOP
AM_RANGE(0x01010180, 0x01010183) AM_NOP
AM_RANGE(0x01010190, 0x01010193) AM_NOP
AM_RANGE(0x010101a0, 0x010101a3) AM_NOP
AM_RANGE(0x010101b0, 0x010101b3) AM_NOP
AM_RANGE(0x010101c0, 0x010101c3) AM_NOP
AM_RANGE(0x010101d0, 0x010101d3) AM_NOP
AM_RANGE(0x010101e0, 0x010101e3) AM_NOP
AM_RANGE(0x010101f0, 0x010101f3) AM_NOP
AM_RANGE(0x01010200, 0x01010203) AM_NOP
AM_RANGE(0x01010210, 0x01010213) AM_NOP
AM_RANGE(0x01010220, 0x01010223) AM_NOP
AM_RANGE(0x01010230, 0x01010233) AM_NOP
AM_RANGE(0x01010000, 0x01010003) AM_WRITENOP
AM_RANGE(0x01010010, 0x01010013) AM_WRITENOP
AM_RANGE(0x01010020, 0x01010023) AM_WRITENOP
AM_RANGE(0x01010030, 0x01010033) AM_WRITENOP
AM_RANGE(0x01010040, 0x01010043) AM_WRITENOP
AM_RANGE(0x01010050, 0x01010053) AM_WRITENOP
AM_RANGE(0x01010060, 0x01010063) AM_WRITENOP
AM_RANGE(0x01010070, 0x01010073) AM_WRITENOP
AM_RANGE(0x01010080, 0x01010083) AM_WRITENOP
AM_RANGE(0x01010090, 0x01010093) AM_WRITENOP
AM_RANGE(0x010100a0, 0x010100a3) AM_WRITENOP
AM_RANGE(0x010100b0, 0x010100b3) AM_WRITENOP
AM_RANGE(0x010100c0, 0x010100c3) AM_WRITENOP
AM_RANGE(0x010100d0, 0x010100d3) AM_WRITENOP
AM_RANGE(0x010100e0, 0x010100e3) AM_WRITENOP
AM_RANGE(0x010100f0, 0x010100f3) AM_WRITENOP
AM_RANGE(0x01010100, 0x01010103) AM_WRITENOP
AM_RANGE(0x01010110, 0x01010113) AM_WRITENOP
AM_RANGE(0x01010120, 0x01010123) AM_WRITENOP
AM_RANGE(0x01010130, 0x01010133) AM_WRITENOP
AM_RANGE(0x01010140, 0x01010143) AM_WRITENOP
AM_RANGE(0x01010150, 0x01010153) AM_WRITENOP
AM_RANGE(0x01010160, 0x01010163) AM_WRITENOP
AM_RANGE(0x01010170, 0x01010173) AM_WRITENOP
AM_RANGE(0x01010180, 0x01010183) AM_WRITENOP
AM_RANGE(0x01010190, 0x01010193) AM_WRITENOP
AM_RANGE(0x010101a0, 0x010101a3) AM_WRITENOP
AM_RANGE(0x010101b0, 0x010101b3) AM_WRITENOP
AM_RANGE(0x010101c0, 0x010101c3) AM_WRITENOP
AM_RANGE(0x010101d0, 0x010101d3) AM_WRITENOP
AM_RANGE(0x010101e0, 0x010101e3) AM_WRITENOP
AM_RANGE(0x010101f0, 0x010101f3) AM_WRITENOP
AM_RANGE(0x01010200, 0x01010203) AM_WRITENOP
AM_RANGE(0x01010210, 0x01010213) AM_WRITENOP
AM_RANGE(0x01010220, 0x01010223) AM_WRITENOP
AM_RANGE(0x01010230, 0x01010233) AM_WRITENOP
AM_RANGE(0x01010280, 0x01010283) AM_NOP
AM_RANGE(0x01010280, 0x01010283) AM_WRITENOP
AM_RANGE(0x010102a0, 0x010102a3) AM_NOP
AM_RANGE(0x010102a0, 0x010102a3) AM_WRITENOP
AM_RANGE(0x010102c0, 0x010102c3) AM_NOP
AM_RANGE(0x010102c0, 0x010102c3) AM_WRITENOP
AM_RANGE(0x010102f0, 0x010102f3) AM_NOP
AM_RANGE(0x010102f0, 0x010102f3) AM_WRITENOP
AM_RANGE(0x01010300, 0x01010303) AM_NOP
AM_RANGE(0x01010300, 0x01010303) AM_WRITENOP
AM_RANGE(0x01010330, 0x01010333) AM_NOP
AM_RANGE(0x01010330, 0x01010333) AM_WRITENOP
AM_RANGE(0x01010360, 0x01010363) AM_NOP
AM_RANGE(0x01010360, 0x01010363) AM_WRITENOP
AM_RANGE(0x01010380, 0x01010383) AM_NOP
AM_RANGE(0x01010390, 0x01010393) AM_NOP
AM_RANGE(0x01010380, 0x01010383) AM_WRITENOP
AM_RANGE(0x01010390, 0x01010393) AM_WRITENOP
// dev2
AM_RANGE(0x01020000, 0x01020003) AM_NOP
AM_RANGE(0x01020010, 0x01020013) AM_NOP
AM_RANGE(0x01020020, 0x01020023) AM_NOP
AM_RANGE(0x01020030, 0x01020033) AM_NOP
AM_RANGE(0x01020040, 0x01020043) AM_NOP
AM_RANGE(0x01020050, 0x01020053) AM_NOP
AM_RANGE(0x01020060, 0x01020063) AM_NOP
AM_RANGE(0x01020070, 0x01020073) AM_NOP
AM_RANGE(0x01020080, 0x01020083) AM_NOP
AM_RANGE(0x01020090, 0x01020093) AM_NOP
AM_RANGE(0x010200a0, 0x010200a3) AM_NOP
AM_RANGE(0x010200b0, 0x010200b3) AM_NOP
AM_RANGE(0x010200c0, 0x010200c3) AM_NOP
AM_RANGE(0x010200d0, 0x010200d3) AM_NOP
AM_RANGE(0x010200e0, 0x010200e3) AM_NOP
AM_RANGE(0x010200f0, 0x010200f3) AM_NOP
AM_RANGE(0x01020100, 0x01020103) AM_NOP
AM_RANGE(0x01020110, 0x01020113) AM_NOP
AM_RANGE(0x01020120, 0x01020123) AM_NOP
AM_RANGE(0x01020130, 0x01020133) AM_NOP
AM_RANGE(0x01020140, 0x01020143) AM_NOP
AM_RANGE(0x01020150, 0x01020153) AM_NOP
AM_RANGE(0x01020160, 0x01020163) AM_NOP
AM_RANGE(0x01020170, 0x01020173) AM_NOP
AM_RANGE(0x01020180, 0x01020183) AM_NOP
AM_RANGE(0x01020190, 0x01020193) AM_NOP
AM_RANGE(0x010201a0, 0x010201a3) AM_NOP
AM_RANGE(0x010201b0, 0x010201b3) AM_NOP
AM_RANGE(0x010201c0, 0x010201c3) AM_NOP
AM_RANGE(0x010201d0, 0x010201d3) AM_NOP
AM_RANGE(0x010201e0, 0x010201e3) AM_NOP
AM_RANGE(0x010201f0, 0x010201f3) AM_NOP
AM_RANGE(0x01020200, 0x01020203) AM_NOP
AM_RANGE(0x01020210, 0x01020213) AM_NOP
AM_RANGE(0x01020220, 0x01020223) AM_NOP
AM_RANGE(0x01020230, 0x01020233) AM_NOP
AM_RANGE(0x01020000, 0x01020003) AM_WRITENOP
AM_RANGE(0x01020010, 0x01020013) AM_WRITENOP
AM_RANGE(0x01020020, 0x01020023) AM_WRITENOP
AM_RANGE(0x01020030, 0x01020033) AM_WRITENOP
AM_RANGE(0x01020040, 0x01020043) AM_WRITENOP
AM_RANGE(0x01020050, 0x01020053) AM_WRITENOP
AM_RANGE(0x01020060, 0x01020063) AM_WRITENOP
AM_RANGE(0x01020070, 0x01020073) AM_WRITENOP
AM_RANGE(0x01020080, 0x01020083) AM_WRITENOP
AM_RANGE(0x01020090, 0x01020093) AM_WRITENOP
AM_RANGE(0x010200a0, 0x010200a3) AM_WRITENOP
AM_RANGE(0x010200b0, 0x010200b3) AM_WRITENOP
AM_RANGE(0x010200c0, 0x010200c3) AM_WRITENOP
AM_RANGE(0x010200d0, 0x010200d3) AM_WRITENOP
AM_RANGE(0x010200e0, 0x010200e3) AM_WRITENOP
AM_RANGE(0x010200f0, 0x010200f3) AM_WRITENOP
AM_RANGE(0x01020100, 0x01020103) AM_WRITENOP
AM_RANGE(0x01020110, 0x01020113) AM_WRITENOP
AM_RANGE(0x01020120, 0x01020123) AM_WRITENOP
AM_RANGE(0x01020130, 0x01020133) AM_WRITENOP
AM_RANGE(0x01020140, 0x01020143) AM_WRITENOP
AM_RANGE(0x01020150, 0x01020153) AM_WRITENOP
AM_RANGE(0x01020160, 0x01020163) AM_WRITENOP
AM_RANGE(0x01020170, 0x01020173) AM_WRITENOP
AM_RANGE(0x01020180, 0x01020183) AM_WRITENOP
AM_RANGE(0x01020190, 0x01020193) AM_WRITENOP
AM_RANGE(0x010201a0, 0x010201a3) AM_WRITENOP
AM_RANGE(0x010201b0, 0x010201b3) AM_WRITENOP
AM_RANGE(0x010201c0, 0x010201c3) AM_WRITENOP
AM_RANGE(0x010201d0, 0x010201d3) AM_WRITENOP
AM_RANGE(0x010201e0, 0x010201e3) AM_WRITENOP
AM_RANGE(0x010201f0, 0x010201f3) AM_WRITENOP
AM_RANGE(0x01020200, 0x01020203) AM_WRITENOP
AM_RANGE(0x01020210, 0x01020213) AM_WRITENOP
AM_RANGE(0x01020220, 0x01020223) AM_WRITENOP
AM_RANGE(0x01020230, 0x01020233) AM_WRITENOP
AM_RANGE(0x01020280, 0x01020283) AM_NOP
AM_RANGE(0x010202a0, 0x010202a3) AM_NOP
AM_RANGE(0x010202b0, 0x010202b3) AM_NOP
AM_RANGE(0x010202c0, 0x010202c3) AM_NOP
AM_RANGE(0x01020280, 0x01020283) AM_WRITENOP
AM_RANGE(0x010202a0, 0x010202a3) AM_WRITENOP
AM_RANGE(0x010202b0, 0x010202b3) AM_WRITENOP
AM_RANGE(0x010202c0, 0x010202c3) AM_WRITENOP
#endif
AM_RANGE(0x010202F0, 0x010202F3) AM_READWRITE8(sc5_10202F0_r, sc5_10202F0_w, 0xffffffff)
AM_RANGE(0x01020330, 0x01020333) AM_NOP
#if 1
AM_RANGE(0x01020330, 0x01020333) AM_WRITENOP
AM_RANGE(0x01020350, 0x01020353) AM_NOP
AM_RANGE(0x01020360, 0x01020363) AM_NOP
AM_RANGE(0x01020370, 0x01020373) AM_NOP
AM_RANGE(0x01020350, 0x01020353) AM_WRITENOP
AM_RANGE(0x01020360, 0x01020363) AM_WRITENOP
AM_RANGE(0x01020370, 0x01020373) AM_WRITENOP
AM_RANGE(0x01020390, 0x01020393) AM_WRITENOP
#endif
AM_RANGE(0x02000000, 0x0200001f) AM_WRITE16(sc5_duart_w, 0xffffffff)
AM_RANGE(0x01020390, 0x01020393) AM_NOP
// ram
AM_RANGE(0x40000000, 0x4000ffff) AM_RAM
@ -208,7 +173,7 @@ READ8_MEMBER( bfm_sc5_state::sc5_10202F0_r )
case 0x2:
case 0x3:
printf("%s: sc5_10202F0_r %d\n", machine().describe_context(), offset);
return 0x00;
return 0xff;
}
return 0;
@ -219,7 +184,7 @@ WRITE8_MEMBER( bfm_sc5_state::sc5_10202F0_w )
switch (offset)
{
case 0x0:
bfm_sc5_write_serial_vfd(machine(), (data &0x4)?1:0, (data &0x1)?1:0, (data&0x2) ? 0:1);
bfm_sc45_write_serial_vfd(machine(), (data &0x4)?1:0, (data &0x1)?1:0, (data&0x2) ? 0:1);
if (data&0xf8) printf("%s: sc5_10202F0_w %d - %02x\n", machine().describe_context(), offset, data);
break;
case 0x1:
@ -243,6 +208,46 @@ static const ymz280b_interface ymz280b_config =
};
void bfm_sc5_duart_irq_handler(device_t *device, int state, UINT8 vector)
{
printf("bfm_sc5_duart_irq_handler\n");
};
void bfm_sc5_duart_tx(device_t *device, int channel, UINT8 data)
{
logerror("bfm_sc5_duart_tx\n");
};
UINT8 bfm_sc5_duart_input_r(device_t *device)
{
//bfm_sc5_state *state = device->machine().driver_data<bfm_sc5_state>();
printf("bfm_sc5_duart_input_r\n");
return 0xff;
}
void bfm_sc5_duart_output_w(device_t *device, UINT8 data)
{
logerror("bfm_sc5_duart_output_w\n");
}
static const duart68681_config bfm_sc5_duart68681_config =
{
bfm_sc5_duart_irq_handler,
bfm_sc5_duart_tx,
bfm_sc5_duart_input_r,
bfm_sc5_duart_output_w,
// TODO: What are the actual frequencies?
16000000/2/8, /* IP2/RxCB clock */
16000000/2/16, /* IP3/TxCA clock */
16000000/2/16, /* IP4/RxCA clock */
16000000/2/8, /* IP5/TxCB clock */
};
MACHINE_CONFIG_START( bfm_sc5, bfm_sc5_state )
MCFG_CPU_ADD("maincpu", MCF5206E, 40000000) /* MCF5206eFT */
MCFG_CPU_PROGRAM_MAP(sc5_map)
@ -251,6 +256,9 @@ MACHINE_CONFIG_START( bfm_sc5, bfm_sc5_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_DUART68681_ADD("duart68681", 16000000/4, bfm_sc5_duart68681_config) // ?? Mhz
MCFG_BFMBDA_ADD("vfd0",0)
MCFG_DEFAULT_LAYOUT(layout_bfm_sc5)

View File

@ -10,16 +10,43 @@
#include "machine/68681.h"
#include "machine/nvram.h"
class sc4_state : public driver_device
// common base class for things shared between sc4 and sc5
class bfm_sc45_state : public driver_device
{
public:
bfm_sc45_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_duart(*this, "duart68681"),
m_vfd0(*this, "vfd0"),
m_ymz(*this, "ymz")
{
}
public:
required_device<legacy_cpu_device> m_maincpu;
required_device<duart68681_device> m_duart;
optional_device<bfm_bda_t> m_vfd0;
required_device<ymz280b_device> m_ymz;
// serial vfd
int vfd_enabled;
bool vfd_old_clock;
UINT8 vfd_ser_value;
int vfd_ser_count;
};
void bfm_sc45_write_serial_vfd(running_machine &machine, bool cs, bool clock, bool data);
// sc4 specifics
class sc4_state : public bfm_sc45_state
{
public:
sc4_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
: bfm_sc45_state(mconfig, type, tag),
m_cpuregion(*this, "maincpu"),
m_duart(*this, "duart68681"),
m_ymz(*this, "ymz"),
m_maincpu(*this, "maincpu"),
m_vfd0(*this, "vfd0"),
m_nvram(*this, "nvram"),
m_io1(*this, "IN-0"),
m_io2(*this, "IN-1"),
@ -40,18 +67,8 @@ public:
required_memory_region m_cpuregion;
// devices
required_device<duart68681_device> m_duart;
required_device<ymz280b_device> m_ymz;
required_device<legacy_cpu_device> m_maincpu;
optional_device<bfm_bda_t> m_vfd0;
required_device<nvram_device> m_nvram;
// serial vfd
int vfd_enabled;
bool vfd_old_clock;
UINT8 vfd_ser_value;
int vfd_ser_count;
const stepper_interface **m_reel_setup;
int m_reel_changed;

View File

@ -1,35 +1,21 @@
#include "cpu/m68000/m68000.h"
#include "includes/bfm_sc45.h"
class bfm_sc5_state : public driver_device
class bfm_sc5_state : public bfm_sc45_state
{
public:
bfm_sc5_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_vfd0(*this, "vfd0")
: bfm_sc45_state(mconfig, type, tag)
{ }
protected:
public:
// devices
required_device<cpu_device> m_maincpu;
optional_device<bfm_bda_t> m_vfd0;
// serial vfd
int vfd_enabled;
bool vfd_old_clock;
UINT8 vfd_ser_value;
int vfd_ser_count;
DECLARE_DRIVER_INIT(sc5);
DECLARE_WRITE_LINE_MEMBER(bfm_sc5_ym_irqhandler);
DECLARE_READ8_MEMBER( sc5_10202F0_r );
DECLARE_WRITE8_MEMBER( sc5_10202F0_w );
DECLARE_WRITE16_MEMBER( sc5_duart_w );
};