undrfire: Use ADC0808 device for cbombers

The 'unknown hardware' for undrfire is mapped at the same place as the
ADC for combers, but it's not fitted on the PCB.
This commit is contained in:
Dirk Best 2018-04-02 11:59:08 +02:00
parent f51a4bf78b
commit 3fc25775f1
2 changed files with 17 additions and 74 deletions

View File

@ -193,6 +193,7 @@ Board contains only 29 ROMs and not much else.
#include "audio/taito_en.h" #include "audio/taito_en.h"
#include "cpu/m68000/m68000.h" #include "cpu/m68000/m68000.h"
#include "machine/adc0808.h"
#include "machine/eepromser.h" #include "machine/eepromser.h"
#include "machine/taitoio.h" #include "machine/taitoio.h"
#include "machine/watchdog.h" #include "machine/watchdog.h"
@ -202,23 +203,6 @@ Board contains only 29 ROMs and not much else.
#include "cbombers.lh" #include "cbombers.lh"
/***********************************************************
INTERRUPTS
***********************************************************/
void undrfire_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
switch (id)
{
case TIMER_INTERRUPT5:
m_maincpu->set_input_line(5, HOLD_LINE);
break;
default:
assert_always(false, "Unknown id in undrfire_state::device_timer");
}
}
/********************************************************** /**********************************************************
GAME INPUTS GAME INPUTS
**********************************************************/ **********************************************************/
@ -258,36 +242,6 @@ WRITE16_MEMBER(undrfire_state::shared_ram_w)
} }
} }
/* Some unknown hardware byte mapped at $600002-5 */
READ32_MEMBER(undrfire_state::unknown_hardware_r)
{
switch (offset) /* four single bytes are read in sequence at $156e */
{
case 0x00: /* $600002-3 */
{
return 0xffff; // no idea what they should be
}
case 0x01: /* $600004-5 */
{
return 0xffff0000; // no idea what they should be
}
}
return 0x0;
}
WRITE32_MEMBER(undrfire_state::unknown_int_req_w)
{
/* 10000 cycle delay is arbitrary */
timer_set(m_maincpu->cycles_to_attotime(10000), TIMER_INTERRUPT5);
}
READ32_MEMBER(undrfire_state::undrfire_lightgun_r) READ32_MEMBER(undrfire_state::undrfire_lightgun_r)
{ {
int x,y; int x,y;
@ -380,20 +334,6 @@ WRITE32_MEMBER(undrfire_state::cbombers_cpua_ctrl_w)
m_subcpu->set_input_line(INPUT_LINE_RESET, (data & 0x1000) ? CLEAR_LINE : ASSERT_LINE); m_subcpu->set_input_line(INPUT_LINE_RESET, (data & 0x1000) ? CLEAR_LINE : ASSERT_LINE);
} }
READ32_MEMBER(undrfire_state::cbombers_adc_r)
{
return (ioport("STEER")->read() << 24);
}
WRITE8_MEMBER(undrfire_state::cbombers_adc_w)
{
/* One interrupt per input port (4 per frame, though only 2 used).
1000 cycle delay is arbitrary */
/* TODO: hook it up to offset 0 only otherwise cbomber proto keeps sending irqs.
Could or could not be right. */
if(offset == 0)
timer_set(m_maincpu->cycles_to_attotime(1000), TIMER_INTERRUPT5);
}
/*********************************************************** /***********************************************************
MEMORY STRUCTURES MEMORY STRUCTURES
@ -408,7 +348,7 @@ void undrfire_state::undrfire_map(address_map &map)
// AM_RANGE(0x304400, 0x304403) AM_RAM // debugging - doesn't change ??? // AM_RANGE(0x304400, 0x304403) AM_RAM // debugging - doesn't change ???
map(0x400000, 0x400003).w(this, FUNC(undrfire_state::motor_control_w)); /* gun vibration */ map(0x400000, 0x400003).w(this, FUNC(undrfire_state::motor_control_w)); /* gun vibration */
map(0x500000, 0x500007).rw("tc0510nio", FUNC(tc0510nio_device::read), FUNC(tc0510nio_device::write)); map(0x500000, 0x500007).rw("tc0510nio", FUNC(tc0510nio_device::read), FUNC(tc0510nio_device::write));
map(0x600000, 0x600007).rw(this, FUNC(undrfire_state::unknown_hardware_r), FUNC(undrfire_state::unknown_int_req_w)); /* int request for unknown hardware */ map(0x600000, 0x600007).noprw(); // space for ADC0809, not fitted on pcb
map(0x700000, 0x7007ff).rw("taito_en:dpram", FUNC(mb8421_device::left_r), FUNC(mb8421_device::left_w)); map(0x700000, 0x7007ff).rw("taito_en:dpram", FUNC(mb8421_device::left_r), FUNC(mb8421_device::left_w));
map(0x800000, 0x80ffff).rw(m_tc0480scp, FUNC(tc0480scp_device::long_r), FUNC(tc0480scp_device::long_w)); /* tilemaps */ map(0x800000, 0x80ffff).rw(m_tc0480scp, FUNC(tc0480scp_device::long_r), FUNC(tc0480scp_device::long_w)); /* tilemaps */
map(0x830000, 0x83002f).rw(m_tc0480scp, FUNC(tc0480scp_device::ctrl_long_r), FUNC(tc0480scp_device::ctrl_long_w)); map(0x830000, 0x83002f).rw(m_tc0480scp, FUNC(tc0480scp_device::ctrl_long_r), FUNC(tc0480scp_device::ctrl_long_w));
@ -428,7 +368,7 @@ void undrfire_state::cbombers_cpua_map(address_map &map)
map(0x300000, 0x303fff).ram().share("spriteram"); map(0x300000, 0x303fff).ram().share("spriteram");
map(0x400000, 0x400003).w(this, FUNC(undrfire_state::cbombers_cpua_ctrl_w)); map(0x400000, 0x400003).w(this, FUNC(undrfire_state::cbombers_cpua_ctrl_w));
map(0x500000, 0x500007).rw("tc0510nio", FUNC(tc0510nio_device::read), FUNC(tc0510nio_device::write)); map(0x500000, 0x500007).rw("tc0510nio", FUNC(tc0510nio_device::read), FUNC(tc0510nio_device::write));
map(0x600000, 0x600007).r(this, FUNC(undrfire_state::cbombers_adc_r)).w(this, FUNC(undrfire_state::cbombers_adc_w)); map(0x600000, 0x600007).rw("adc", FUNC(adc0808_device::data_r), FUNC(adc0808_device::address_offset_start_w)).umask32(0xffffffff);
map(0x700000, 0x7007ff).rw("taito_en:dpram", FUNC(mb8421_device::left_r), FUNC(mb8421_device::left_w)); map(0x700000, 0x7007ff).rw("taito_en:dpram", FUNC(mb8421_device::left_r), FUNC(mb8421_device::left_w));
map(0x800000, 0x80ffff).rw(m_tc0480scp, FUNC(tc0480scp_device::long_r), FUNC(tc0480scp_device::long_w)); /* tilemaps */ map(0x800000, 0x80ffff).rw(m_tc0480scp, FUNC(tc0480scp_device::long_r), FUNC(tc0480scp_device::long_w)); /* tilemaps */
map(0x830000, 0x83002f).rw(m_tc0480scp, FUNC(tc0480scp_device::ctrl_long_r), FUNC(tc0480scp_device::ctrl_long_w)); map(0x830000, 0x83002f).rw(m_tc0480scp, FUNC(tc0480scp_device::ctrl_long_r), FUNC(tc0480scp_device::ctrl_long_w));
@ -692,6 +632,10 @@ MACHINE_CONFIG_START(undrfire_state::cbombers)
MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") MCFG_EEPROM_SERIAL_93C46_ADD("eeprom")
MCFG_DEVICE_ADD("adc", ADC0809, 500000) // unknown clock
MCFG_ADC0808_EOC_FF_CB(INPUTLINE("maincpu", 5))
MCFG_ADC0808_IN0_CB(IOPORT("STEER"))
MCFG_DEVICE_ADD("tc0510nio", TC0510NIO, 0) MCFG_DEVICE_ADD("tc0510nio", TC0510NIO, 0)
MCFG_TC0510NIO_READ_0_CB(IOPORT("INPUTS0")) MCFG_TC0510NIO_READ_0_CB(IOPORT("INPUTS0"))
MCFG_TC0510NIO_READ_1_CB(IOPORT("INPUTS1")) MCFG_TC0510NIO_READ_1_CB(IOPORT("INPUTS1"))

View File

@ -36,6 +36,16 @@ public:
m_gfxdecode(*this, "gfxdecode"), m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette") { } m_palette(*this, "palette") { }
void undrfire(machine_config &config);
void cbombers(machine_config &config);
DECLARE_DRIVER_INIT(undrfire);
DECLARE_DRIVER_INIT(cbombers);
protected:
virtual void video_start() override;
private:
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_subcpu; optional_device<cpu_device> m_subcpu;
required_device<tc0100scn_device> m_tc0100scn; required_device<tc0100scn_device> m_tc0100scn;
@ -55,29 +65,18 @@ public:
DECLARE_WRITE8_MEMBER(coin_word_w); DECLARE_WRITE8_MEMBER(coin_word_w);
DECLARE_READ16_MEMBER(shared_ram_r); DECLARE_READ16_MEMBER(shared_ram_r);
DECLARE_WRITE16_MEMBER(shared_ram_w); DECLARE_WRITE16_MEMBER(shared_ram_w);
DECLARE_READ32_MEMBER(unknown_hardware_r);
DECLARE_WRITE32_MEMBER(unknown_int_req_w);
DECLARE_READ32_MEMBER(undrfire_lightgun_r); DECLARE_READ32_MEMBER(undrfire_lightgun_r);
DECLARE_WRITE32_MEMBER(rotate_control_w); DECLARE_WRITE32_MEMBER(rotate_control_w);
DECLARE_WRITE32_MEMBER(motor_control_w); DECLARE_WRITE32_MEMBER(motor_control_w);
DECLARE_WRITE32_MEMBER(cbombers_cpua_ctrl_w); DECLARE_WRITE32_MEMBER(cbombers_cpua_ctrl_w);
DECLARE_READ32_MEMBER(cbombers_adc_r);
DECLARE_WRITE8_MEMBER(cbombers_adc_w);
DECLARE_READ_LINE_MEMBER(frame_counter_r); DECLARE_READ_LINE_MEMBER(frame_counter_r);
DECLARE_DRIVER_INIT(undrfire);
DECLARE_DRIVER_INIT(cbombers);
virtual void video_start() override;
uint32_t screen_update_undrfire(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update_undrfire(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_cbombers(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update_cbombers(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(undrfire_interrupt); INTERRUPT_GEN_MEMBER(undrfire_interrupt);
void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap,const rectangle &cliprect,const int *primasks,int x_offs,int y_offs); void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap,const rectangle &cliprect,const int *primasks,int x_offs,int y_offs);
void draw_sprites_cbombers(screen_device &screen, bitmap_ind16 &bitmap,const rectangle &cliprect,const int *primasks,int x_offs,int y_offs); void draw_sprites_cbombers(screen_device &screen, bitmap_ind16 &bitmap,const rectangle &cliprect,const int *primasks,int x_offs,int y_offs);
void undrfire(machine_config &config);
void cbombers(machine_config &config);
void cbombers_cpua_map(address_map &map); void cbombers_cpua_map(address_map &map);
void cbombers_cpub_map(address_map &map); void cbombers_cpub_map(address_map &map);
void undrfire_map(address_map &map); void undrfire_map(address_map &map);
protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
}; };