mirror of
https://github.com/holub/mame
synced 2025-04-24 17:30:55 +03:00
Xavix - i2cmem hookup (#4156)
* properly mark data/direction registers for IO (nw) * use direction register (nw) * (nw) * xavix - i2cmem hookup (nw)
This commit is contained in:
parent
89e260781c
commit
2f99f81a0c
@ -384,10 +384,10 @@ void xavix_state::xavix_lowbus_map(address_map &map)
|
||||
map(0x7986, 0x7987).ram().w(FUNC(xavix_state::rom_dmalen_w)).share("rom_dma_len");
|
||||
|
||||
// IO Ports
|
||||
map(0x7a00, 0x7a00).rw(FUNC(xavix_state::io_0_r),FUNC(xavix_state::io_0_w));
|
||||
map(0x7a01, 0x7a01).rw(FUNC(xavix_state::io_1_r),FUNC(xavix_state::io_1_w));
|
||||
map(0x7a02, 0x7a02).rw(FUNC(xavix_state::io_2_r),FUNC(xavix_state::io_2_w));
|
||||
map(0x7a03, 0x7a03).rw(FUNC(xavix_state::io_3_r),FUNC(xavix_state::io_3_w));
|
||||
map(0x7a00, 0x7a00).rw(FUNC(xavix_state::io0_data_r),FUNC(xavix_state::io0_data_w));
|
||||
map(0x7a01, 0x7a01).rw(FUNC(xavix_state::io1_data_r),FUNC(xavix_state::io1_data_w));
|
||||
map(0x7a02, 0x7a02).rw(FUNC(xavix_state::io0_direction_r),FUNC(xavix_state::io0_direction_w));
|
||||
map(0x7a03, 0x7a03).rw(FUNC(xavix_state::io1_direction_r),FUNC(xavix_state::io1_direction_w));
|
||||
|
||||
// Interrupt control registers
|
||||
map(0x7a80, 0x7a80).w(FUNC(xavix_state::xavix_7a80_w)); // still IO? ADC related?
|
||||
@ -730,6 +730,11 @@ MACHINE_CONFIG_START(xavix_state::xavix)
|
||||
// sound is PCM
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
MACHINE_CONFIG_START(xavix_state::xavix_i2c)
|
||||
xavix(config);
|
||||
|
||||
I2CMEM(config, "i2cmem", 0).set_page_size(16).set_data_size(0x200);
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
MACHINE_CONFIG_START(xavix_state::xavixp)
|
||||
xavix(config);
|
||||
@ -751,6 +756,11 @@ MACHINE_CONFIG_START(xavix_state::xavix2000)
|
||||
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
MACHINE_CONFIG_START(xavix_state::xavix2000_i2c)
|
||||
xavix2000(config);
|
||||
|
||||
I2CMEM(config, "i2cmem", 0).set_page_size(16).set_data_size(0x200);
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
void xavix_state::init_xavix()
|
||||
{
|
||||
@ -906,13 +916,13 @@ ROM_END
|
||||
|
||||
/* Standalone TV Games */
|
||||
|
||||
CONS( 2006, taitons1, 0, 0, xavix, namcons2, xavix_state, init_xavix, "Bandai / SSD Company LTD / Taito", "Let's! TV Play Classic - Taito Nostalgia 1", MACHINE_IS_SKELETON )
|
||||
CONS( 2006, taitons1, 0, 0, xavix_i2c, namcons2, xavix_state, init_xavix, "Bandai / SSD Company LTD / Taito", "Let's! TV Play Classic - Taito Nostalgia 1", MACHINE_IS_SKELETON )
|
||||
|
||||
CONS( 2006, taitons2, 0, 0, xavix, namcons2, xavix_state, init_xavix, "Bandai / SSD Company LTD / Taito", "Let's! TV Play Classic - Taito Nostalgia 2", MACHINE_IS_SKELETON )
|
||||
CONS( 2006, taitons2, 0, 0, xavix_i2c, namcons2, xavix_state, init_xavix, "Bandai / SSD Company LTD / Taito", "Let's! TV Play Classic - Taito Nostalgia 2", MACHINE_IS_SKELETON )
|
||||
|
||||
CONS( 2006, namcons1, 0, 0, xavix, namcons2, xavix_state, init_xavix, "Bandai / SSD Company LTD / Namco", "Let's! TV Play Classic - Namco Nostalgia 1", MACHINE_IS_SKELETON )
|
||||
CONS( 2006, namcons1, 0, 0, xavix_i2c, namcons2, xavix_state, init_xavix, "Bandai / SSD Company LTD / Namco", "Let's! TV Play Classic - Namco Nostalgia 1", MACHINE_IS_SKELETON )
|
||||
|
||||
CONS( 2006, namcons2, 0, 0, xavix, namcons2, xavix_state, init_xavix, "Bandai / SSD Company LTD / Namco", "Let's! TV Play Classic - Namco Nostalgia 2", MACHINE_IS_SKELETON )
|
||||
CONS( 2006, namcons2, 0, 0, xavix_i2c, namcons2, xavix_state, init_xavix, "Bandai / SSD Company LTD / Namco", "Let's! TV Play Classic - Namco Nostalgia 2", MACHINE_IS_SKELETON )
|
||||
|
||||
CONS( 2000, rad_ping, 0, 0, xavix, xavix, xavix_state, init_xavix, "Radica / SSD Company LTD / Simmer Technology", "Play TV Ping Pong", MACHINE_IS_SKELETON ) // "Simmer Technology" is also known as "Hummer Technology Co., Ltd"
|
||||
|
||||
@ -940,7 +950,7 @@ CONS( 200?, rad_fb, 0, 0, xavix, xavix, xavix_state, init_xavix
|
||||
|
||||
CONS( 200?, rad_rh, 0, 0, xavix, xavix, xavix_state, init_xavix, "Radioa / Fisher-Price / SSD Company LTD", "Play TV Rescue Heroes", MACHINE_IS_SKELETON)
|
||||
|
||||
CONS( 200?, epo_efdx, 0, 0, xavix, xavix, xavix_state, init_xavix, "Epoch / SSD Company LTD", "Excite Fishing DX (Japan)", MACHINE_IS_SKELETON)
|
||||
CONS( 200?, epo_efdx, 0, 0, xavix_i2c, xavix, xavix_state, init_xavix, "Epoch / SSD Company LTD", "Excite Fishing DX (Japan)", MACHINE_IS_SKELETON)
|
||||
|
||||
CONS( 200?, has_wamg, 0, 0, xavix, xavix, xavix_state, init_xavix, "Hasbro / Milton Bradley / SSD Company LTD", "TV Wild Adventure Mini Golf", MACHINE_IS_SKELETON)
|
||||
|
||||
@ -985,9 +995,9 @@ ROM_START( drgqst )
|
||||
ROM_END
|
||||
|
||||
|
||||
CONS( 2004, xavtenni, 0, 0, xavix2000, xavix, xavix_state, init_xavix, "SSD Company LTD", "XaviX Tennis (XaviXPORT)", MACHINE_IS_SKELETON )
|
||||
CONS( 2004, xavtenni, 0, 0, xavix2000_i2c, xavix, xavix_state, init_xavix, "SSD Company LTD", "XaviX Tennis (XaviXPORT)", MACHINE_IS_SKELETON )
|
||||
|
||||
CONS( 2005, ttv_sw, 0, 0, xavix2000, xavix, xavix_state, init_xavix, "Tiger / SSD Company LTD", "Star Wars Saga Edition - Lightsaber Battle Game", MACHINE_IS_SKELETON )
|
||||
CONS( 2005, ttv_lotr, 0, 0, xavix2000, xavix, xavix_state, init_xavix, "Tiger / SSD Company LTD", "Lord Of The Rings - Warrior of Middle-Earth", MACHINE_IS_SKELETON )
|
||||
CONS( 2005, ttv_mx, 0, 0, xavix2000, xavix, xavix_state, init_xavix, "Tiger / SSD Company LTD", "MX Dirt Rebel", MACHINE_IS_SKELETON )
|
||||
CONS( 2003, drgqst, 0, 0, xavix2000, xavix, xavix_state, init_xavix, "Square Enix / SSD Company LTD", "Kenshin Dragon Quest: Yomigaerishi Densetsu no Ken", MACHINE_IS_SKELETON )
|
||||
CONS( 2005, ttv_sw, 0, 0, xavix2000_i2c, xavix, xavix_state, init_xavix, "Tiger / SSD Company LTD", "Star Wars Saga Edition - Lightsaber Battle Game", MACHINE_IS_SKELETON )
|
||||
CONS( 2005, ttv_lotr, 0, 0, xavix2000_i2c, xavix, xavix_state, init_xavix, "Tiger / SSD Company LTD", "Lord Of The Rings - Warrior of Middle-Earth", MACHINE_IS_SKELETON )
|
||||
CONS( 2005, ttv_mx, 0, 0, xavix2000_i2c, xavix, xavix_state, init_xavix, "Tiger / SSD Company LTD", "MX Dirt Rebel", MACHINE_IS_SKELETON )
|
||||
CONS( 2003, drgqst, 0, 0, xavix2000_i2c, xavix, xavix_state, init_xavix, "Square Enix / SSD Company LTD", "Kenshin Dragon Quest: Yomigaerishi Densetsu no Ken", MACHINE_IS_SKELETON )
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "screen.h"
|
||||
#include "speaker.h"
|
||||
#include "machine/bankdev.h"
|
||||
#include "machine/i2cmem.h"
|
||||
|
||||
|
||||
class xavix_state : public driver_device
|
||||
@ -34,13 +35,17 @@ public:
|
||||
m_in1(*this, "IN1"),
|
||||
m_region(*this, "REGION"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_lowbus(*this, "lowbus")
|
||||
m_lowbus(*this, "lowbus"),
|
||||
m_i2cmem(*this, "i2cmem")
|
||||
{ }
|
||||
|
||||
void xavix(machine_config &config);
|
||||
void xavixp(machine_config &config);
|
||||
void xavix2000(machine_config &config);
|
||||
|
||||
void xavix_i2c(machine_config &config);
|
||||
void xavix2000_i2c(machine_config &config);
|
||||
|
||||
void init_xavix();
|
||||
|
||||
private:
|
||||
@ -90,15 +95,15 @@ private:
|
||||
DECLARE_WRITE8_MEMBER(spritefragment_dma_trg_w);
|
||||
DECLARE_READ8_MEMBER(spritefragment_dma_status_r);
|
||||
|
||||
DECLARE_READ8_MEMBER(io_0_r);
|
||||
DECLARE_READ8_MEMBER(io_1_r);
|
||||
DECLARE_READ8_MEMBER(io_2_r);
|
||||
DECLARE_READ8_MEMBER(io_3_r);
|
||||
DECLARE_READ8_MEMBER(io0_data_r);
|
||||
DECLARE_READ8_MEMBER(io1_data_r);
|
||||
DECLARE_READ8_MEMBER(io0_direction_r);
|
||||
DECLARE_READ8_MEMBER(io1_direction_r);
|
||||
|
||||
DECLARE_WRITE8_MEMBER(io_0_w);
|
||||
DECLARE_WRITE8_MEMBER(io_1_w);
|
||||
DECLARE_WRITE8_MEMBER(io_2_w);
|
||||
DECLARE_WRITE8_MEMBER(io_3_w);
|
||||
DECLARE_WRITE8_MEMBER(io0_data_w);
|
||||
DECLARE_WRITE8_MEMBER(io1_data_w);
|
||||
DECLARE_WRITE8_MEMBER(io0_direction_w);
|
||||
DECLARE_WRITE8_MEMBER(io1_direction_w);
|
||||
|
||||
DECLARE_WRITE8_MEMBER(vector_enable_w);
|
||||
DECLARE_WRITE8_MEMBER(nmi_vector_lo_w);
|
||||
@ -207,6 +212,11 @@ private:
|
||||
uint8_t m_6ff0;
|
||||
uint8_t m_6ff8;
|
||||
|
||||
uint8_t m_io0_data;
|
||||
uint8_t m_io1_data;
|
||||
uint8_t m_io0_direction;
|
||||
uint8_t m_io1_direction;
|
||||
|
||||
uint8_t m_soundregs[0x10];
|
||||
|
||||
uint8_t m_timer_baseval;
|
||||
@ -257,6 +267,7 @@ private:
|
||||
int get_current_address_byte();
|
||||
|
||||
required_device<address_map_bank_device> m_lowbus;
|
||||
optional_device<i2cmem_device> m_i2cmem;
|
||||
};
|
||||
|
||||
#endif // MAME_INCLUDES_XAVIX_H
|
||||
|
@ -135,7 +135,7 @@ WRITE8_MEMBER(xavix_state::adc_7b00_w)
|
||||
READ8_MEMBER(xavix_state::adc_7b80_r)
|
||||
{
|
||||
logerror("%s: adc_7b80_r\n", machine().describe_context());
|
||||
return 0xff;
|
||||
return 0x00;//0xff;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(xavix_state::adc_7b80_w)
|
||||
@ -150,7 +150,8 @@ WRITE8_MEMBER(xavix_state::adc_7b81_w)
|
||||
|
||||
READ8_MEMBER(xavix_state::adc_7b81_r)
|
||||
{
|
||||
return machine().rand();
|
||||
return 0x00;
|
||||
// return machine().rand();
|
||||
}
|
||||
|
||||
|
||||
@ -204,55 +205,80 @@ WRITE8_MEMBER(xavix_state::dispctrl_posirq_y_w)
|
||||
logerror("%s: dispctrl_posirq_y_w %02x\n", machine().describe_context(), data);
|
||||
}
|
||||
|
||||
READ8_MEMBER(xavix_state::io_0_r)
|
||||
READ8_MEMBER(xavix_state::io0_data_r)
|
||||
{
|
||||
return m_in0->read();
|
||||
uint8_t ret = m_in0->read() & ~m_io0_direction;
|
||||
ret |= m_io0_data & m_io0_direction;
|
||||
return ret;
|
||||
}
|
||||
|
||||
READ8_MEMBER(xavix_state::io_1_r)
|
||||
READ8_MEMBER(xavix_state::io1_data_r)
|
||||
{
|
||||
/*
|
||||
int pc = m_maincpu->state_int(M6502_PC);
|
||||
uint8_t ret = m_in1->read();
|
||||
|
||||
if (pc == 0x3acc) return 0x08;
|
||||
if (pc == 0x3ae0) return 0x08;
|
||||
if (pc == 0xfcb0) return 0xff;
|
||||
if (m_i2cmem)
|
||||
{
|
||||
if (!(m_io1_direction & 0x08))
|
||||
{
|
||||
ret &= ~0x08;
|
||||
ret |= (m_i2cmem->read_sda() & 1) << 3;
|
||||
}
|
||||
}
|
||||
|
||||
logerror("%04x: in1 read\n", pc);
|
||||
*/
|
||||
return m_in1->read();
|
||||
ret &= ~m_io1_direction;
|
||||
|
||||
ret |= m_io1_data & m_io1_direction;
|
||||
return ret;
|
||||
}
|
||||
|
||||
// has_wamg crashes on boot if these return high, either it's a button causing the game to eventually crash, or an invalid input (inputs are ACTIVE HIGH so returning 0x00 is safer
|
||||
READ8_MEMBER(xavix_state::io_2_r)
|
||||
READ8_MEMBER(xavix_state::io0_direction_r)
|
||||
{
|
||||
return 0x00;
|
||||
return m_io0_direction;
|
||||
}
|
||||
|
||||
READ8_MEMBER(xavix_state::io_3_r)
|
||||
READ8_MEMBER(xavix_state::io1_direction_r)
|
||||
{
|
||||
return 0x00;
|
||||
return m_io1_direction;
|
||||
}
|
||||
|
||||
|
||||
WRITE8_MEMBER(xavix_state::io_0_w)
|
||||
WRITE8_MEMBER(xavix_state::io0_data_w)
|
||||
{
|
||||
logerror("%s: io_0_w %02x\n", machine().describe_context(), data);
|
||||
m_io0_data = data;
|
||||
logerror("%s: io0_data_w %02x\n", machine().describe_context(), data);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(xavix_state::io_1_w)
|
||||
WRITE8_MEMBER(xavix_state::io1_data_w)
|
||||
{
|
||||
logerror("%s: io_1_w %02x\n", machine().describe_context(), data);
|
||||
m_io1_data = data;
|
||||
logerror("%s: io1_data_w %02x\n", machine().describe_context(), data);
|
||||
|
||||
if (m_i2cmem)
|
||||
{
|
||||
if (m_io1_direction & 0x08)
|
||||
{
|
||||
m_i2cmem->write_sda((data & 0x08) >> 3);
|
||||
}
|
||||
|
||||
if (m_io1_direction & 0x10)
|
||||
{
|
||||
m_i2cmem->write_scl((data & 0x10) >> 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(xavix_state::io_2_w)
|
||||
WRITE8_MEMBER(xavix_state::io0_direction_w)
|
||||
{
|
||||
logerror("%s: io_2_w %02x\n", machine().describe_context(), data);
|
||||
m_io0_direction = data;
|
||||
logerror("%s: io0_direction_w %02x\n", machine().describe_context(), data);
|
||||
io0_data_w(space,0,m_io0_data);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(xavix_state::io_3_w)
|
||||
WRITE8_MEMBER(xavix_state::io1_direction_w)
|
||||
{
|
||||
logerror("%s: io_3_w %02x\n", machine().describe_context(), data);
|
||||
m_io1_direction = data;
|
||||
logerror("%s: io1_direction_w %02x\n", machine().describe_context(), data);
|
||||
io1_data_w(space,0,m_io1_data); // requires this for i2cmem to work, is it correct tho?
|
||||
}
|
||||
|
||||
READ8_MEMBER(xavix_state::arena_start_r)
|
||||
@ -460,6 +486,13 @@ void xavix_state::machine_reset()
|
||||
std::fill_n(&m_fragment_sprite[0], 0x800, 0x00); // taito nostalgia 1 never initializes the ram at 0x6400 but there's no condition on using it at present?
|
||||
|
||||
m_lowbus->set_bank(0);
|
||||
|
||||
m_io0_data = 0x00;
|
||||
m_io1_data = 0x00;
|
||||
|
||||
m_io0_direction = 0x00;
|
||||
m_io1_direction = 0x00;
|
||||
|
||||
}
|
||||
|
||||
typedef device_delegate<uint8_t (int which, int half)> xavix_interrupt_vector_delegate;
|
||||
|
Loading…
Reference in New Issue
Block a user