From e79466e522d3cf1e64c23c635a382946d81eeef7 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Fri, 3 May 2013 02:47:36 +0000 Subject: [PATCH] further code collapse (nw) --- src/emu/machine/mcf5206e.c | 2 +- src/mame/drivers/bfm_sc4h.c | 4 +- src/mame/drivers/bfm_sc5.c | 119 ++++++++++++++++------------------- src/mame/includes/bfm_sc45.h | 6 +- src/mame/includes/bfm_sc5.h | 6 ++ 5 files changed, 67 insertions(+), 70 deletions(-) diff --git a/src/emu/machine/mcf5206e.c b/src/emu/machine/mcf5206e.c index 8f8dc8032c2..44d581ff185 100644 --- a/src/emu/machine/mcf5206e.c +++ b/src/emu/machine/mcf5206e.c @@ -785,7 +785,7 @@ READ16_MEMBER( mcf5206e_peripheral_device::TCN1_r) { case 0: 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. + return machine().rand(); // 0x8ca0 -1;// m_TCN1; // this should be the counter, code has a hardcoded >= check against 8ca0. case 1: invalidlog("%s: invalid TCN1_r %d %04x\n", this->machine().describe_context(), offset, mem_mask); return 0; diff --git a/src/mame/drivers/bfm_sc4h.c b/src/mame/drivers/bfm_sc4h.c index a2b7e43b29f..534f3d346eb 100644 --- a/src/mame/drivers/bfm_sc4h.c +++ b/src/mame/drivers/bfm_sc4h.c @@ -234,7 +234,7 @@ READ16_MEMBER(sc4_state::sc4_mem_r) static DECLARE_WRITE8_HANDLER( bfm_sc4_reel4_w ); -WRITE8_MEMBER(sc4_state::mux_output_w) +WRITE8_MEMBER(bfm_sc45_state::mux_output_w) { int i; int off = offset<<3; @@ -246,7 +246,7 @@ WRITE8_MEMBER(sc4_state::mux_output_w) output_set_indexed_value("matrix", off+i, ((data & (1 << i)) != 0)); } -WRITE8_MEMBER(sc4_state::mux_output2_w) +WRITE8_MEMBER(bfm_sc45_state::mux_output2_w) { int i; int off = offset<<3; diff --git a/src/mame/drivers/bfm_sc5.c b/src/mame/drivers/bfm_sc5.c index bb6a321c784..e9eb758f8b0 100644 --- a/src/mame/drivers/bfm_sc5.c +++ b/src/mame/drivers/bfm_sc5.c @@ -36,6 +36,47 @@ WRITE16_MEMBER( bfm_sc5_state::sc5_duart_w ) } +READ8_MEMBER( bfm_sc5_state::sc5_mux1_r ) +{ + switch (offset) + { + case 0x20: + return machine().rand(); + } + + printf("%s: sc5_mux1_r %1x\n", machine().describe_context(), offset); + + return 0x00; +} + + +WRITE8_MEMBER( bfm_sc5_state::sc5_mux1_w ) +{ + if ((offset&0xf)==0) + { + mux_output_w(space, (offset & 0x01f0)>>4, data); + } + else + { + printf("%s: sc5_mux1_w %1x %04x\n", machine().describe_context(), offset, data); + } +} + + + +WRITE8_MEMBER( bfm_sc5_state::sc5_mux2_w ) +{ + if ((offset&0xf)==0) + { + mux_output2_w(space, (offset & 0x01f0)>>4, data); + } + else + { + printf("%s: sc5_mux2_w %1x %04x\n", machine().describe_context(), offset, data); + } +} + + static ADDRESS_MAP_START( sc5_map, AS_PROGRAM, 32, bfm_sc5_state ) // ROM (max size?) AM_RANGE(0x00000000, 0x002fffff) AM_ROM @@ -44,38 +85,11 @@ static ADDRESS_MAP_START( sc5_map, AS_PROGRAM, 32, bfm_sc5_state ) #if 1 // dev1 - 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(0x01010000, 0x010101ff) AM_READWRITE8(sc5_mux1_r, sc5_mux1_w,0xffffffff) // guess +#endif + +#if 0 + AM_RANGE(0x01010200, 0x01010203) AM_WRITENOP AM_RANGE(0x01010210, 0x01010213) AM_WRITENOP AM_RANGE(0x01010220, 0x01010223) AM_WRITENOP @@ -97,40 +111,15 @@ static ADDRESS_MAP_START( sc5_map, AS_PROGRAM, 32, bfm_sc5_state ) AM_RANGE(0x01010380, 0x01010383) AM_WRITENOP AM_RANGE(0x01010390, 0x01010393) AM_WRITENOP +#endif +#if 1 // dev2 - 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(0x01020000, 0x010201ff) AM_WRITE8(sc5_mux2_w,0xffffffff) // guess +#endif + +#if 0 + AM_RANGE(0x01020200, 0x01020203) AM_WRITENOP AM_RANGE(0x01020210, 0x01020213) AM_WRITENOP AM_RANGE(0x01020220, 0x01020223) AM_WRITENOP @@ -173,7 +162,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 0xff; + return machine().rand(); } return 0; diff --git a/src/mame/includes/bfm_sc45.h b/src/mame/includes/bfm_sc45.h index 536fe0a6480..70974db0097 100644 --- a/src/mame/includes/bfm_sc45.h +++ b/src/mame/includes/bfm_sc45.h @@ -36,6 +36,10 @@ public: UINT8 vfd_ser_value; int vfd_ser_count; + + DECLARE_WRITE8_MEMBER(mux_output_w); + DECLARE_WRITE8_MEMBER(mux_output2_w); + }; void bfm_sc45_write_serial_vfd(running_machine &machine, bool cs, bool clock, bool data); @@ -89,8 +93,6 @@ public: UINT8 read_input_matrix(running_machine &machine, int row); - DECLARE_WRITE8_MEMBER(mux_output_w); - DECLARE_WRITE8_MEMBER(mux_output2_w); DECLARE_READ16_MEMBER(sc4_mem_r); DECLARE_WRITE16_MEMBER(sc4_mem_w); diff --git a/src/mame/includes/bfm_sc5.h b/src/mame/includes/bfm_sc5.h index b43ffd7b369..6a2eccf5e57 100644 --- a/src/mame/includes/bfm_sc5.h +++ b/src/mame/includes/bfm_sc5.h @@ -17,5 +17,11 @@ public: DECLARE_READ8_MEMBER( sc5_10202F0_r ); DECLARE_WRITE8_MEMBER( sc5_10202F0_w ); DECLARE_WRITE16_MEMBER( sc5_duart_w ); + + DECLARE_READ8_MEMBER( sc5_mux1_r ); + DECLARE_WRITE8_MEMBER( sc5_mux1_w ); + DECLARE_WRITE8_MEMBER( sc5_mux2_w ); + + };