mirror of
https://github.com/holub/mame
synced 2025-05-03 21:13:18 +03:00
taito_z: Use ADC0808 device
This commit is contained in:
parent
d3021ffec4
commit
e147b434d3
@ -922,7 +922,7 @@ when forming the background. They jerk a bit relative to
|
||||
each other... probably a cpu sync thing, perhaps also some
|
||||
fine-tuning required on the zoomed sprite dimension calcs.
|
||||
|
||||
Light gun interrupt timing arbitrary.
|
||||
ADC clock unknown.
|
||||
|
||||
|
||||
Double Axle
|
||||
@ -975,6 +975,7 @@ DIP switches are not verified
|
||||
|
||||
#include "cpu/m68000/m68000.h"
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "machine/adc0808.h"
|
||||
#include "machine/eepromser.h"
|
||||
#include "sound/2610intf.h"
|
||||
#include "sound/flt_vol.h"
|
||||
@ -1030,16 +1031,11 @@ void taitoz_state::device_timer(emu_timer &timer, device_timer_id id, int param,
|
||||
/* 68000 A */
|
||||
m_maincpu->set_input_line(6, HOLD_LINE);
|
||||
break;
|
||||
case TIMER_TAITOZ_CPUB_INTERRUPT5:
|
||||
/* 68000 B */
|
||||
m_subcpu->set_input_line(5, HOLD_LINE);
|
||||
break;
|
||||
default:
|
||||
assert_always(false, "Unknown id in taitoz_state::device_timer");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***** Routines for particular games *****/
|
||||
|
||||
INTERRUPT_GEN_MEMBER(taitoz_state::sci_interrupt)
|
||||
@ -1160,63 +1156,6 @@ READ8_MEMBER(taitoz_state::chasehq_input_bypass_r)
|
||||
}
|
||||
|
||||
|
||||
READ16_MEMBER(taitoz_state::bshark_stick_r)
|
||||
{
|
||||
switch (offset)
|
||||
{
|
||||
case 0x00:
|
||||
return ioport("STICKX")->read();
|
||||
|
||||
case 0x01:
|
||||
return ioport("X_ADJUST")->read();
|
||||
|
||||
case 0x02:
|
||||
return ioport("STICKY")->read();
|
||||
|
||||
case 0x03:
|
||||
return ioport("Y_ADJUST")->read();
|
||||
}
|
||||
|
||||
logerror("CPU #0 PC %06x: warning - read unmapped stick offset %06x\n", m_maincpu->pc(), offset);
|
||||
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
|
||||
READ16_MEMBER(taitoz_state::nightstr_stick_r)
|
||||
{
|
||||
switch (offset)
|
||||
{
|
||||
case 0x00:
|
||||
return ioport("STICKX")->read();
|
||||
|
||||
case 0x01:
|
||||
return ioport("STICKY")->read();
|
||||
|
||||
case 0x02:
|
||||
return ioport("X_ADJUST")->read();
|
||||
|
||||
case 0x03:
|
||||
return ioport("Y_ADJUST")->read();
|
||||
}
|
||||
|
||||
logerror("CPU #0 PC %06x: warning - read unmapped stick offset %06x\n", m_maincpu->pc(), offset);
|
||||
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(taitoz_state::bshark_stick_w)
|
||||
{
|
||||
/* Each write invites a new interrupt as soon as the
|
||||
hardware has got the next a/d conversion ready. We set a token
|
||||
delay of 10000 cycles; our "coords" are always ready
|
||||
but we don't want CPUA to have an int6 before int4 is over (?)
|
||||
*/
|
||||
|
||||
timer_set(m_maincpu->cycles_to_attotime(10000), TIMER_TAITOZ_INTERRUPT6);
|
||||
}
|
||||
|
||||
|
||||
READ16_MEMBER(taitoz_state::sci_steer_input_r)
|
||||
{
|
||||
uint16_t steer = 0xff80 + m_steer.read_safe(0x80);
|
||||
@ -1236,39 +1175,6 @@ READ16_MEMBER(taitoz_state::sci_steer_input_r)
|
||||
}
|
||||
|
||||
|
||||
READ16_MEMBER(taitoz_state::spacegun_lightgun_r)
|
||||
{
|
||||
switch (offset)
|
||||
{
|
||||
case 0x00:
|
||||
return ioport("STICKX1")->read();
|
||||
|
||||
case 0x01:
|
||||
return ioport("STICKY1")->read();
|
||||
|
||||
case 0x02:
|
||||
return ioport("STICKX2")->read();
|
||||
|
||||
case 0x03:
|
||||
return ioport("STICKY2")->read();
|
||||
}
|
||||
|
||||
return 0x00;
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(taitoz_state::spacegun_lightgun_w)
|
||||
{
|
||||
/* Each write invites a new lightgun interrupt as soon as the
|
||||
hardware has got the next coordinate ready. We set a token
|
||||
delay of 10000 cycles; our "lightgun" coords are always ready
|
||||
but we don't want CPUB to have an int5 before int4 is over (?).
|
||||
|
||||
Four lightgun interrupts happen before the collected coords
|
||||
are moved to shared ram where CPUA can use them. */
|
||||
|
||||
timer_set(m_subcpu->cycles_to_attotime(10000), TIMER_TAITOZ_CPUB_INTERRUPT5);
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(taitoz_state::spacegun_gun_output_w)
|
||||
{
|
||||
output().set_value("Player1_Gun_Recoil",(data & 0x01));
|
||||
@ -1538,7 +1444,7 @@ void taitoz_state::bshark_map(address_map &map)
|
||||
map(0x110000, 0x113fff).ram().share("share1");
|
||||
map(0x400000, 0x40000f).rw(m_tc0220ioc, FUNC(tc0220ioc_device::read), FUNC(tc0220ioc_device::write)).umask16(0x00ff);
|
||||
map(0x600000, 0x600001).w(this, FUNC(taitoz_state::cpua_ctrl_w));
|
||||
map(0x800000, 0x800007).rw(this, FUNC(taitoz_state::bshark_stick_r), FUNC(taitoz_state::bshark_stick_w));
|
||||
map(0x800000, 0x80000f).rw("adc", FUNC(adc0808_device::data_r), FUNC(adc0808_device::address_offset_start_w)).umask16(0x00ff);
|
||||
map(0xa00000, 0xa01fff).ram().w("palette", FUNC(palette_device::write16)).share("palette");
|
||||
map(0xc00000, 0xc00fff).ram().share("spriteram");
|
||||
map(0xd00000, 0xd0ffff).rw(m_tc0100scn, FUNC(tc0100scn_device::word_r), FUNC(tc0100scn_device::word_w)); /* tilemaps */
|
||||
@ -1552,7 +1458,7 @@ void taitoz_state::bsharkjjs_map(address_map &map)
|
||||
map(0x110000, 0x113fff).ram().share("share1");
|
||||
map(0x400000, 0x40000f).rw(m_tc0220ioc, FUNC(tc0220ioc_device::read), FUNC(tc0220ioc_device::write)).umask16(0x00ff);
|
||||
map(0x600000, 0x600001).w(this, FUNC(taitoz_state::cpua_ctrl_w));
|
||||
// map(0x800000, 0x800007).rw(this, FUNC(taitoz_state::bshark_stick_r), FUNC(taitoz_state::bshark_stick_w)); /* No analog stick, this is the Joystick version */
|
||||
// map(0x800000, 0x80000f) // No analog stick, this is the Joystick version
|
||||
map(0xa00000, 0xa01fff).ram().w("palette", FUNC(palette_device::write16)).share("palette");
|
||||
map(0xc00000, 0xc00fff).ram().share("spriteram");
|
||||
map(0xd00000, 0xd0ffff).rw(m_tc0100scn, FUNC(tc0100scn_device::word_r), FUNC(tc0100scn_device::word_w)); /* tilemaps */
|
||||
@ -1612,7 +1518,7 @@ void taitoz_state::nightstr_map(address_map &map)
|
||||
map(0xc20000, 0xc2000f).rw(m_tc0100scn, FUNC(tc0100scn_device::ctrl_word_r), FUNC(tc0100scn_device::ctrl_word_w));
|
||||
map(0xd00000, 0xd007ff).ram().share("spriteram");
|
||||
map(0xe00000, 0xe00011).w(this, FUNC(taitoz_state::nightstr_motor_w)); /* Motor outputs */
|
||||
map(0xe40000, 0xe40007).rw(this, FUNC(taitoz_state::nightstr_stick_r), FUNC(taitoz_state::bshark_stick_w));
|
||||
map(0xe40000, 0xe4000f).rw("adc", FUNC(adc0808_device::data_r), FUNC(adc0808_device::address_offset_start_w)).umask16(0x00ff);
|
||||
}
|
||||
|
||||
void taitoz_state::nightstr_cpub_map(address_map &map)
|
||||
@ -1672,7 +1578,7 @@ void taitoz_state::spacegun_cpub_map(address_map &map)
|
||||
map(0xc0000e, 0xc0000f).noprw();
|
||||
map(0xc20000, 0xc20007).w(this, FUNC(taitoz_state::taitoz_pancontrol)).umask16(0x00ff); /* pan */
|
||||
map(0xe00000, 0xe00001).w(this, FUNC(taitoz_state::spacegun_gun_output_w)); /* gun outputs */
|
||||
map(0xf00000, 0xf00007).rw(this, FUNC(taitoz_state::spacegun_lightgun_r), FUNC(taitoz_state::spacegun_lightgun_w));
|
||||
map(0xf00000, 0xf0000f).rw("adc", FUNC(adc0808_device::data_r), FUNC(adc0808_device::address_offset_start_w)).umask16(0x00ff);
|
||||
}
|
||||
|
||||
|
||||
@ -3222,6 +3128,13 @@ MACHINE_CONFIG_START(taitoz_state::bshark)
|
||||
|
||||
MCFG_QUANTUM_TIME(attotime::from_hz(6000))
|
||||
|
||||
MCFG_DEVICE_ADD("adc", ADC0809, 500000) // clock unknown
|
||||
MCFG_ADC0808_EOC_FF_CB(INPUTLINE("maincpu", 6))
|
||||
MCFG_ADC0808_IN0_CB(IOPORT("STICKX"))
|
||||
MCFG_ADC0808_IN1_CB(IOPORT("X_ADJUST"))
|
||||
MCFG_ADC0808_IN2_CB(IOPORT("STICKY"))
|
||||
MCFG_ADC0808_IN3_CB(IOPORT("Y_ADJUST"))
|
||||
|
||||
MCFG_DEVICE_ADD("tc0220ioc", TC0220IOC, 0)
|
||||
MCFG_TC0220IOC_READ_0_CB(IOPORT("DSWA"))
|
||||
MCFG_TC0220IOC_READ_1_CB(IOPORT("DSWB"))
|
||||
@ -3283,6 +3196,7 @@ MACHINE_CONFIG_START(taitoz_state::bsharkjjs)
|
||||
MCFG_CPU_MODIFY("maincpu")
|
||||
MCFG_CPU_PROGRAM_MAP(bsharkjjs_map)
|
||||
|
||||
MCFG_DEVICE_REMOVE("adc")
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
|
||||
@ -3382,6 +3296,13 @@ MACHINE_CONFIG_START(taitoz_state::nightstr)
|
||||
|
||||
MCFG_QUANTUM_TIME(attotime::from_hz(6000))
|
||||
|
||||
MCFG_DEVICE_ADD("adc", ADC0809, 500000) // clock unknown
|
||||
MCFG_ADC0808_EOC_FF_CB(INPUTLINE("maincpu", 6))
|
||||
MCFG_ADC0808_IN0_CB(IOPORT("STICKX"))
|
||||
MCFG_ADC0808_IN1_CB(IOPORT("STICKY"))
|
||||
MCFG_ADC0808_IN2_CB(IOPORT("X_ADJUST"))
|
||||
MCFG_ADC0808_IN3_CB(IOPORT("Y_ADJUST"))
|
||||
|
||||
MCFG_DEVICE_ADD("tc0220ioc", TC0220IOC, 0)
|
||||
MCFG_TC0220IOC_READ_0_CB(IOPORT("DSWA"))
|
||||
MCFG_TC0220IOC_READ_1_CB(IOPORT("DSWB"))
|
||||
@ -3541,6 +3462,13 @@ MACHINE_CONFIG_START(taitoz_state::spacegun)
|
||||
MCFG_EEPROM_SERIAL_93C46_ADD("eeprom")
|
||||
MCFG_EEPROM_SERIAL_DATA(spacegun_default_eeprom, 128)
|
||||
|
||||
MCFG_DEVICE_ADD("adc", ADC0809, 500000) // clock unknown
|
||||
MCFG_ADC0808_EOC_FF_CB(INPUTLINE("sub", 5))
|
||||
MCFG_ADC0808_IN0_CB(IOPORT("STICKX1"))
|
||||
MCFG_ADC0808_IN1_CB(IOPORT("STICKY1"))
|
||||
MCFG_ADC0808_IN2_CB(IOPORT("STICKX2"))
|
||||
MCFG_ADC0808_IN3_CB(IOPORT("STICKY2"))
|
||||
|
||||
MCFG_DEVICE_ADD("tc0510nio", TC0510NIO, 0)
|
||||
MCFG_TC0510NIO_READ_0_CB(IOPORT("DSWA"))
|
||||
MCFG_TC0510NIO_READ_1_CB(IOPORT("DSWB"))
|
||||
|
@ -19,12 +19,6 @@
|
||||
class taitoz_state : public driver_device
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
TIMER_TAITOZ_INTERRUPT6,
|
||||
TIMER_TAITOZ_CPUB_INTERRUPT5
|
||||
};
|
||||
|
||||
taitoz_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_spriteram(*this, "spriteram"),
|
||||
@ -43,6 +37,32 @@ public:
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_steer(*this, "STEER") { }
|
||||
|
||||
DECLARE_CUSTOM_INPUT_MEMBER(taitoz_pedal_r);
|
||||
|
||||
void sci(machine_config &config);
|
||||
void spacegun(machine_config &config);
|
||||
void chasehq(machine_config &config);
|
||||
void dblaxle(machine_config &config);
|
||||
void bshark(machine_config &config);
|
||||
void aquajack(machine_config &config);
|
||||
void nightstr(machine_config &config);
|
||||
void contcirc(machine_config &config);
|
||||
void racingb(machine_config &config);
|
||||
void bsharkjjs(machine_config &config);
|
||||
void enforce(machine_config &config);
|
||||
|
||||
DECLARE_DRIVER_INIT(taitoz);
|
||||
DECLARE_DRIVER_INIT(bshark);
|
||||
|
||||
protected:
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
TIMER_TAITOZ_INTERRUPT6,
|
||||
};
|
||||
|
||||
/* memory pointers */
|
||||
required_shared_ptr<uint16_t> m_spriteram;
|
||||
|
||||
@ -79,12 +99,7 @@ public:
|
||||
DECLARE_WRITE8_MEMBER(spacegun_eeprom_w);
|
||||
DECLARE_READ8_MEMBER(contcirc_input_bypass_r);
|
||||
DECLARE_READ8_MEMBER(chasehq_input_bypass_r);
|
||||
DECLARE_READ16_MEMBER(bshark_stick_r);
|
||||
DECLARE_READ16_MEMBER(nightstr_stick_r);
|
||||
DECLARE_WRITE16_MEMBER(bshark_stick_w);
|
||||
DECLARE_READ16_MEMBER(sci_steer_input_r);
|
||||
DECLARE_READ16_MEMBER(spacegun_lightgun_r);
|
||||
DECLARE_WRITE16_MEMBER(spacegun_lightgun_w);
|
||||
DECLARE_WRITE16_MEMBER(spacegun_gun_output_w);
|
||||
DECLARE_READ16_MEMBER(dblaxle_steer_input_r);
|
||||
DECLARE_READ16_MEMBER(chasehq_motor_r);
|
||||
@ -99,9 +114,6 @@ public:
|
||||
DECLARE_READ16_MEMBER(sci_spriteframe_r);
|
||||
DECLARE_WRITE16_MEMBER(sci_spriteframe_w);
|
||||
DECLARE_WRITE16_MEMBER(contcirc_out_w);
|
||||
DECLARE_CUSTOM_INPUT_MEMBER(taitoz_pedal_r);
|
||||
DECLARE_DRIVER_INIT(taitoz);
|
||||
DECLARE_DRIVER_INIT(bshark);
|
||||
DECLARE_MACHINE_START(taitoz);
|
||||
DECLARE_MACHINE_RESET(taitoz);
|
||||
DECLARE_VIDEO_START(taitoz);
|
||||
@ -123,17 +135,6 @@ public:
|
||||
void spacegun_draw_sprites_16x8(screen_device &screen, bitmap_ind16 &bitmap,const rectangle &cliprect,int y_offs);
|
||||
void parse_cpu_control();
|
||||
|
||||
void sci(machine_config &config);
|
||||
void spacegun(machine_config &config);
|
||||
void chasehq(machine_config &config);
|
||||
void dblaxle(machine_config &config);
|
||||
void bshark(machine_config &config);
|
||||
void aquajack(machine_config &config);
|
||||
void nightstr(machine_config &config);
|
||||
void contcirc(machine_config &config);
|
||||
void racingb(machine_config &config);
|
||||
void bsharkjjs(machine_config &config);
|
||||
void enforce(machine_config &config);
|
||||
void aquajack_cpub_map(address_map &map);
|
||||
void aquajack_map(address_map &map);
|
||||
void bshark_cpub_map(address_map &map);
|
||||
@ -156,6 +157,4 @@ public:
|
||||
void spacegun_cpub_map(address_map &map);
|
||||
void spacegun_map(address_map &map);
|
||||
void z80_sound_map(address_map &map);
|
||||
protected:
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user