new NOT WORKING

---
XaviX Bass Fishing (XaviXPORT) [Sean Riddle, Peter Wilhelmsen]

and refactor a bit
This commit is contained in:
DavidHaywood 2019-01-23 20:28:55 +00:00
parent 749a131993
commit c52b2b78a9
9 changed files with 256 additions and 139 deletions

View File

@ -3501,6 +3501,8 @@ files {
MAME_DIR .. "src/mame/machine/xavix_mtrk_wheel.h",
MAME_DIR .. "src/mame/machine/xavix_madfb_ball.cpp",
MAME_DIR .. "src/mame/machine/xavix_madfb_ball.h",
MAME_DIR .. "src/mame/machine/xavix2002_io.cpp",
MAME_DIR .. "src/mame/machine/xavix2002_io.h",
}
createMESSProjects(_target, _subtarget, "ultimachine")

View File

@ -7,8 +7,8 @@
The dies for these are marked
SSD 2000 NEC 85605-621
and possibly
SSD 2002 NEC 85054-611 (although this might use even more opcodes and need it's own file)
SSD 2002 NEC 85054-611
6502 with custom opcodes
integrated gfx / sound
@ -17,77 +17,12 @@
see xavix.cpp for basic notes
the machines using the '2000' series chips seem to have more extra
opcodes, so presumably these were only available in those models.
of note, push x / push y and pull x / pull y
the 2000 chip has more opcodes than the 97/98 chips in xavix.cpp, and
is a similar die structure to the 2002 chip, but doesn't seem to have any
additional capabilities.
Dirt Rebel MX, which is confirmed as 2000 type however seems to require
some of the documented but 'undocumented' opcodes on the 6502 to have additonal
meaning for one specific function on startup
this just seems to be some very buggy checksum code where the games don't even care about the result...
(actually it looks like some games might be using it as a PRNG seed?)
a is 80 when entering here?
01BC37: A0 3F ldy #$3f
01BC39: B2 clr a // clear acculuator
01BC3A: 1B spa0 a // store 'accumulator' into byte 0 of PA 'address' register
01BC3B: 9B spa2 a // store 'accumulator' into byte 2 of PA 'address' register
-- loop point 2
01BC3C: 98 tya // y -> a (3f on first run of loop)
01BC3D: 5B spa1 a // store 'accumulator' into byte 1 of PA 'address' register (003f00 on first loop?)
-- loop point 1
01BC3E: A3 ldal0 a // read byte 0 of 32-bit 'long' register into accumulator
01BC3F: 73 adcpa // adc ($Address PA)
01BC40: 83 stal0 a // store accumulator back in byte 0 of 32-bit 'long' register (even byte checksum?)
01BC41: FB incpa // increase 'address' register PA
01BC42: A7 ldal1 a // read byte 1 of 32-bit 'long' register into accumulator
01BC43: 73 adcpa // adc ($Address PA)
01BC44: 87 stal1 a // store accumulator back in byte 0 of 32-bit 'long' register (odd byte checksum?)
01BC45: FB incpa // increase 'address' register PA
01BC46: D0 F6 bne $1bc3e // (branch based on PA increase, so PA must set flags?, probably overflows after 0xffff if upper byte is 'bank'? or at 0xff if this really is a mirror of the function below
01BC48: 88 dey // decrease y, which contained 3f at the start
01BC49: 10 F1 bpl $1bc3c // branch back to loop point 2 to reload counter
// contains the odd byte checksum once we drop out the loop
01BC4B: 8D FB 00 sta $00fb // store it in zero page memory
01BC4E: A3 ldal0 a // get the even byte checksum from byte 0 of 32-bit 'long' register
01BC4F: 8D FA 00 sta $00fa // store it in zero page memory
01BC52: 07 oral1 a // why do we want to do this? (routine below does it too)
01BC53: D0 03 bne $1bc58
01BC55: CE FA 00 dec $00fa
01BC58: 80 retf
this is presumably meant to be similar to the function found in Namco
Nostalgia 2
// A is 80 on entry
09FFD8: A9 3F lda #$3f
09FFDA: 85 01 sta $01 // set upper bit of pointer at 0x0000 to 3f (it completely fails to initialize the ram at 00, we currently init it to ff, but should probably be 0?)
09FFDC: A0 00 ldy #$00 // clear inner loop counter
-- loop point 1 and 2
09FFDE: AD FA 00 lda $00fa // read current even byte checksum value from zero page ram fa (game also completely fails to initialize this)
09FFE1: 71 00 adc ($00), y // so 3f00 + y first outer loop, 3e00 + y second outer loop with y increasing in inner loop (add byte read to even checksum byte?)
09FFE3: 8D FA 00 sta $00fa // store even checksum at 0xfa in zero page ram
09FFE6: C8 iny // increase counter y
09FFE7: AD FB 00 lda $00fb // read current odd byte checksum value from zero page ram fb (likewise never initialized!)
09FFEA: 71 00 adc ($00), y // 3f00 + y (add byte read to odd checksum byte)
09FFEC: 8D FB 00 sta $00fb // store odd checksum byte at 0xfb in zero page ram
09FFEF: C8 iny // increase y
09FFF0: D0 EC bne $9ffde // branch back if y hasn't overflowed (so work on 0x100 bytes, looping back 0x7f times)
09FFF2: C6 01 dec $01 // decrease accumulator (started at 3f) (inner loop counter already 0 because it overflowed)
09FFF4: 10 E8 bpl $9ffde // branch back
// checksums are already in place after loop so no need to copy them like in above
09FFF6: 0D FA 00 ora $00fa // same weird 'or' call
--
09FFF9: D0 03 bne $9fffe
09FFFB: CE FA 00 dec $00fa
09FFFE: 80 retf
the 2002 chip seems to be the one that was officially dubbed 'SuperXaviX'
and has additional video capabilities on top of the extended opcodes.
***************************************************************************/
@ -96,10 +31,13 @@
#include "xavix2000.h"
#include "xavix2000d.h"
DEFINE_DEVICE_TYPE(XAVIX2000, xavix2000_device, "xavix2000", "XaviX (SSD 2000 / 2002)")
DEFINE_DEVICE_TYPE(XAVIX2000, xavix2000_device, "xavix2000", "XaviX (SSD 2000)")
DEFINE_DEVICE_TYPE(XAVIX2002, xavix2002_device, "xavix2002", "XaviX (SSD 2002) (SuperXaviX)")
xavix2000_device::xavix2000_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
xavix_device(mconfig, XAVIX2000, tag, owner, clock)
xavix2000_device::xavix2000_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
xavix_device(mconfig, type, tag, owner, clock)
{
program_config.m_addr_width = 24;
program_config.m_logaddr_width = 24;
@ -107,6 +45,17 @@ xavix2000_device::xavix2000_device(const machine_config &mconfig, const char *ta
sprogram_config.m_logaddr_width = 24;
}
xavix2000_device::xavix2000_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
xavix2000_device(mconfig, XAVIX2000, tag, owner, clock)
{
}
xavix2002_device::xavix2002_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
xavix2000_device(mconfig, XAVIX2002, tag, owner, clock)
{
}
void xavix2000_device::device_start()
{
xavix_device::device_start();

View File

@ -15,6 +15,7 @@
class xavix2000_device : public xavix_device {
public:
xavix2000_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
xavix2000_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
virtual void do_exec_full() override;
@ -160,6 +161,13 @@ enum {
SXAVIX_PB
};
class xavix2002_device : public xavix2000_device {
public:
xavix2002_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
};
DECLARE_DEVICE_TYPE(XAVIX2000, xavix2000_device)
DECLARE_DEVICE_TYPE(XAVIX2002, xavix2002_device)
#endif // MAME_CPU_M6502_XAVIX2000_H

View File

@ -404,9 +404,9 @@ void xavix_state::superxavix_lowbus_map(address_map &map)
map(0x790b, 0x790b).w(FUNC(xavix_state::extended_extbus_reg1_w));
map(0x790d, 0x790d).w(FUNC(xavix_state::extended_extbus_reg2_w));
map(0x7a10, 0x7a12).ram().rw(FUNC(xavix_state::pio_dir_r), FUNC(xavix_state::pio_dir_w));
map(0x7a20, 0x7a22).ram().rw(FUNC(xavix_state::pio_out_r), FUNC(xavix_state::pio_out_w));
map(0x7a30, 0x7a32).ram().r(FUNC(xavix_state::pio_in_r));
map(0x7a10, 0x7a12).rw("xavix2002io", FUNC(xavix2002_io_device::pio_dir_r), FUNC(xavix2002_io_device::pio_dir_w));
map(0x7a20, 0x7a22).rw("xavix2002io", FUNC(xavix2002_io_device::pio_out_r), FUNC(xavix2002_io_device::pio_out_w));
map(0x7a30, 0x7a32).r("xavix2002io", FUNC(xavix2002_io_device::pio_in_r));
map(0x6fb0, 0x6fc7).ram().share("bmp_base");
@ -1078,7 +1078,7 @@ void xavix_state::xavix2000(machine_config &config)
XAVIX2000(config.replace(), m_maincpu, MAIN_CLOCK);
m_maincpu->set_addrmap(AS_PROGRAM, &xavix_state::xavix_map);
m_maincpu->set_addrmap(5, &xavix_state::superxavix_lowbus_map);
m_maincpu->set_addrmap(5, &xavix_state::xavix_lowbus_map);
m_maincpu->set_addrmap(6, &xavix_state::xavix_extbus_map);
m_maincpu->disable_cache();
m_maincpu->set_vblank_int("screen", FUNC(xavix_state::interrupt));
@ -1087,9 +1087,26 @@ void xavix_state::xavix2000(machine_config &config)
m_palette->set_entries(512);
}
void xavix_i2c_jmat_state::xavix_i2c_jmat(machine_config &config)
void xavix_state::xavix2002(machine_config &config)
{
xavix2000(config);
xavix(config);
XAVIX2002(config.replace(), m_maincpu, MAIN_CLOCK);
m_maincpu->set_addrmap(AS_PROGRAM, &xavix_state::xavix_map);
m_maincpu->set_addrmap(5, &xavix_state::superxavix_lowbus_map); // has extra video, io etc.
m_maincpu->set_addrmap(6, &xavix_state::xavix_extbus_map);
m_maincpu->disable_cache();
m_maincpu->set_vblank_int("screen", FUNC(xavix_state::interrupt));
m_maincpu->set_vector_callback(FUNC(xavix_state::get_vectors));
m_palette->set_entries(512);
XAVIX2002IO(config, "xavix2002io", 0);
}
void xavix_i2c_jmat_state::xavix2002_i2c_jmat(machine_config &config)
{
xavix2002(config);
I2CMEM(config, "i2cmem", 0)/*.set_page_size(16)*/.set_data_size(0x200); // ?
}
@ -1201,6 +1218,14 @@ void xavix_cart_state::xavix_cart_ddrfammt(machine_config &config)
//SOFTWARE_LIST(config, "cart_list_japan_sp").set_original("ekara_japan_sp"); // not for this system, but unlike other carts, actually tells you this if inserted rather than crashing the system
}
void xavix_i2c_state::xavix2002_i2c_24c04(machine_config &config)
{
xavix2002(config);
I2CMEM(config, "i2cmem", 0).set_page_size(16).set_data_size(0x200); // 24C04
}
void xavix_state::init_xavix()
{
m_rgnlen = memregion("bios")->bytes();
@ -1568,13 +1593,17 @@ ROM_START( xavbaseb )
ROM_LOAD( "xpbaseball.bin", 0x000000, 0x800000, CRC(e9ed692d) SHA1(537e390e972156dc7da66ee127ae4c8052038ee5) )
ROM_END
ROM_START( xavbassf )
ROM_REGION( 0x800000, "bios", ROMREGION_ERASE00 )
ROM_LOAD( "xpbassfishing.bin", 0x000000, 0x800000, CRC(09ab2f29) SHA1(616254176315d0947002e9ae5a6371a3ffa2e8eb) )
ROM_END
ROM_START( xavjmat )
ROM_REGION( 0x1000000, "bios", ROMREGION_ERASE00 )
ROM_LOAD( "xpjmat.bin", 0x000000, 0x1000000, CRC(71a51eef) SHA1(41fd2c3013d1c86756046ec9174e94400f8fa06d) )
ROM_END
// Domyos DiS (XaviX 2002 based titles)
ROM_START( domfitex )
ROM_REGION( 0x1000000, "bios", ROMREGION_ERASE00 )
ROM_LOAD( "xpfitnessexercise.bin", 0x000000, 0x1000000, CRC(f1089229) SHA1(803df8ba0a05cb004a4238c6c71ea1ffa4428990) )
@ -1586,13 +1615,15 @@ ROM_START( domfitch )
ROM_END
// TODO: does it have an SEEPROM? why does it hang? full title?
CONS( 2005, tmy_thom, 0, 0, xavix2000_i2c_24c04, xavix, xavix_i2c_state, init_xavix, "Tomy / SSD Company LTD", "Thomas and Friends (Tomy)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND )
CONS( 2005, tmy_thom, 0, 0, xavix2002_i2c_24c04, xavix, xavix_i2c_state, init_xavix, "Tomy / SSD Company LTD", "Thomas and Friends (Tomy)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND )
CONS( 2004, xavtenni, 0, 0, xavix2000_i2c_24c04, xavix, xavix_i2c_state, init_xavix, "SSD Company LTD", "XaviX Tennis (XaviXPORT)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND )
CONS( 2004, xavbaseb, 0, 0, xavix2000_i2c_24c04, xavix, xavix_i2c_state, init_xavix, "SSD Company LTD", "XaviX Baseball (XaviXPORT)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND )
CONS( 2004, xavtenni, 0, 0, xavix2002_i2c_24c04, xavix, xavix_i2c_state, init_xavix, "SSD Company LTD", "XaviX Tennis (XaviXPORT)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND )
CONS( 2004, xavbaseb, 0, 0, xavix2002_i2c_24c04, xavix, xavix_i2c_state, init_xavix, "SSD Company LTD", "XaviX Baseball (XaviXPORT)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND )
// Bass Fishing PCB is just like Tennis except with an RF daughterboard.
CONS( 2004, xavbassf, 0, 0, xavix2002_i2c_24c04, xavix, xavix_i2c_state, init_xavix, "SSD Company LTD", "XaviX Bass Fishing (XaviXPORT)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND )
// TODO: check SEEPROM type and hookup, banking!
CONS( 2005, xavjmat, 0, 0, xavix_i2c_jmat, xavix, xavix_i2c_jmat_state, init_xavix, "SSD Company LTD", "Jackie Chan J-Mat Fitness (XaviXPORT)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND )
CONS( 2005, xavjmat, 0, 0, xavix2002_i2c_jmat, xavix, xavix_i2c_jmat_state, init_xavix, "SSD Company LTD", "Jackie Chan J-Mat Fitness (XaviXPORT)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND )
// https://arnaudmeyer.wordpress.com/domyos-interactive-system/
// Domyos Fitness Adventure
@ -1607,12 +1638,12 @@ CONS( 2005, xavjmat, 0, 0, xavix_i2c_jmat, xavix, xavix_i2c_jmat_state, init_xa
// Domyos Bike Concept (not listed on site above)
// Has SEEPROM and an RTC. Exercise has some leftover PC buffer stuff. (TODO, check SEEPROM type, RTC type, banking) (both Exercises and Challenge are identical PCBs)
CONS( 2008, domfitex, 0, 0, xavix_i2c_jmat, xavixp, xavix_i2c_jmat_state, init_xavix, "Decathlon / SSD Company LTD", "Domyos Fitness Exercises (Domyos Interactive System)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND )
CONS( 2008, domfitch, 0, 0, xavix_i2c_jmat, xavixp, xavix_i2c_jmat_state, init_xavix, "Decathlon / SSD Company LTD", "Domyos Fitness Challenge (Domyos Interactive System)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND )
CONS( 2008, domfitex, 0, 0, xavix2002_i2c_jmat, xavixp, xavix_i2c_jmat_state, init_xavix, "Decathlon / SSD Company LTD", "Domyos Fitness Exercises (Domyos Interactive System)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND )
CONS( 2008, domfitch, 0, 0, xavix2002_i2c_jmat, xavixp, xavix_i2c_jmat_state, init_xavix, "Decathlon / SSD Company LTD", "Domyos Fitness Challenge (Domyos Interactive System)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND )
// Domyos DiS (unknown hardware, or bad dumps)
// This DOES NOT look like a 6502 based Xavix / Super Xavix! maybe XaviX 2, the cartridges contain the entire system (CPU,Video,Sound,ROM) so that is possible.
// Seems to have 32-bit looking stuff, possible vectors at start? possible ARM THUMB mode code
// Seems to have 32-bit looking stuff, possible vectors at start?
ROM_START( domfitad )
ROM_REGION( 0x1000000, "bios", ROMREGION_ERASE00 )
@ -1620,7 +1651,7 @@ ROM_START( domfitad )
ROM_END
// Has SEEPROM and an RTC. Adventure has the string DOMYSSDCOLTD a couple of times.
CONS( 2008, domfitad, 0, 0, xavix_i2c_jmat, xavixp, xavix_i2c_jmat_state, init_xavix, "Decathlon / SSD Company LTD", "Domyos Fitness Adventure (Domyos Interactive System)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND )
CONS( 2008, domfitad, 0, 0, xavix2002_i2c_jmat, xavixp, xavix_i2c_jmat_state, init_xavix, "Decathlon / SSD Company LTD", "Domyos Fitness Adventure (Domyos Interactive System)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND )

View File

@ -18,7 +18,7 @@
#include "machine/xavix_mtrk_wheel.h"
#include "machine/xavix_madfb_ball.h"
#include "machine/xavix2002_io.h"
class xavix_sound_device : public device_t, public device_sound_interface
{
@ -99,7 +99,8 @@ public:
m_palette(*this, "palette"),
m_region(*this, "REGION"),
m_gfxdecode(*this, "gfxdecode"),
m_sound(*this, "xavix_sound")
m_sound(*this, "xavix_sound"),
m_xavix2002io(*this, "xavix2002io")
{ }
void xavix(machine_config &config);
@ -108,6 +109,8 @@ public:
void xavix_nv(machine_config &config);
void xavix2000_nv(machine_config &config);
void xavix2002(machine_config &config);
void init_xavix();
DECLARE_WRITE_LINE_MEMBER(ioevent_trg01);
@ -563,19 +566,13 @@ private:
int get_current_address_byte();
required_device<xavix_sound_device> m_sound;
optional_device<xavix2002_io_device> m_xavix2002io;
DECLARE_READ8_MEMBER(sound_regram_read_cb);
protected:
// additional SuperXaviX / XaviX2002 stuff
uint8_t m_sx_pio_dir[3];
uint8_t m_sx_pio_out[3];
DECLARE_WRITE8_MEMBER(pio_dir_w);
DECLARE_READ8_MEMBER(pio_dir_r);
virtual DECLARE_WRITE8_MEMBER(pio_out_w);
virtual DECLARE_READ8_MEMBER(pio_out_r);
virtual DECLARE_READ8_MEMBER(pio_in_r);
uint8_t m_sx_extended_extbus[3];
@ -602,6 +599,8 @@ public:
void xavix2000_i2c_24c04(machine_config &config);
void xavix2000_i2c_24c02(machine_config &config);
void xavix2002_i2c_24c04(machine_config &config);
void init_epo_efdx()
{
init_xavix();
@ -627,7 +626,7 @@ public:
m_i2cmem(*this, "i2cmem")
{ }
void xavix_i2c_jmat(machine_config &config);
void xavix2002_i2c_jmat(machine_config &config);
private:

View File

@ -1078,8 +1078,6 @@ void xavix_state::machine_start()
save_item(NAME(m_spritereg));
save_item(NAME(m_barrel_params));
save_item(NAME(m_sx_pio_dir));
save_item(NAME(m_sx_pio_out));
save_item(NAME(m_sx_extended_extbus));
}
@ -1160,11 +1158,6 @@ void xavix_state::machine_reset()
m_barrel_params[1] = 0x00;
// SuperXaviX
for (int i = 0; i < 3; i++)
{
m_sx_pio_dir[i] = 0x00;
m_sx_pio_out[i] = 0x00;
}
for (int i = 0; i < 3; i++)
{
@ -1199,36 +1192,6 @@ int16_t xavix_state::get_vectors(int which, int half)
// additional SuperXaviX / XaviX2002 stuff
WRITE8_MEMBER(xavix_state::pio_dir_w)
{
LOG("%s: pio_dir_w (port %d) %02x\n", machine().describe_context(), offset, data);
m_sx_pio_dir[offset] = data;
}
READ8_MEMBER(xavix_state::pio_dir_r)
{
LOG("%s: pio_dir_r (port %d)\n", machine().describe_context(), offset);
return m_sx_pio_dir[offset];
}
WRITE8_MEMBER(xavix_state::pio_out_w)
{
LOG("%s: pio_out_w (port %d) %02x\n", machine().describe_context(), offset, data);
m_sx_pio_out[offset] = data;
}
READ8_MEMBER(xavix_state::pio_out_r)
{
LOG("%s: pio_out_r (port %d)\n", machine().describe_context(), offset);
return m_sx_pio_out[offset];
}
READ8_MEMBER(xavix_state::pio_in_r)
{
LOG("%s: pio_in_r (port %d)\n", machine().describe_context(), offset);
return 0x00;
}
WRITE8_MEMBER(xavix_state::extended_extbus_reg0_w)
{
LOG("%s: extended_extbus_reg0_w %02x\n", machine().describe_context(), data);

View File

@ -0,0 +1,115 @@
// license:BSD-3-Clause
// copyright-holders:David Haywood
// has separate input / output addresses but still uses direction registers, or I've misunderstood this entirely.
#include "emu.h"
#include "xavix2002_io.h"
#define VERBOSE 0
#include "logmacro.h"
DEFINE_DEVICE_TYPE(XAVIX2002IO, xavix2002_io_device, "xavix2002io", "XaviX 2002 IO")
xavix2002_io_device::xavix2002_io_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, XAVIX2002IO, tag, owner, clock)
, m_space_read0_cb(*this)
, m_space_read1_cb(*this)
, m_space_read2_cb(*this)
, m_out0_cb(*this)
, m_out1_cb(*this)
, m_out2_cb(*this)
{
}
void xavix2002_io_device::device_start()
{
m_space_read0_cb.resolve_safe(0xff);
m_space_read1_cb.resolve_safe(0xff);
m_space_read2_cb.resolve_safe(0xff);
m_out0_cb.resolve_safe();
m_out1_cb.resolve_safe();
m_out2_cb.resolve_safe();
save_item(NAME(m_sx_pio_dir));
save_item(NAME(m_sx_pio_out));
}
void xavix2002_io_device::device_reset()
{
for (int i = 0; i < 3; i++)
{
m_sx_pio_dir[i] = 0;
m_sx_pio_out[i] = 0;
}
}
WRITE8_MEMBER(xavix2002_io_device::pio_dir_w)
{
LOG("%s: superxavix pio_dir_w (port %d) %02x\n", machine().describe_context(), offset, data);
if (offset < 3)
{
m_sx_pio_dir[offset] = data;
// update port?
}
}
READ8_MEMBER(xavix2002_io_device::pio_dir_r)
{
LOG("%s: superxavix pio_dir_r (port %d)\n", machine().describe_context(), offset);
uint8_t ret = 0x00;
if (offset < 3)
{
ret = m_sx_pio_dir[offset];
}
return ret;
}
WRITE8_MEMBER(xavix2002_io_device::pio_out_w)
{
LOG("%s: superxavix pio_out_w (port %d) %02x\n", machine().describe_context(), offset, data);
if (offset < 3)
{
m_sx_pio_out[offset] = data;
// look at direction register and output
}
}
READ8_MEMBER(xavix2002_io_device::pio_out_r)
{
LOG("%s: superxavix pio_out_r (port %d)\n", machine().describe_context(), offset);
uint8_t ret = 0x00;
if (offset<3)
ret = m_sx_pio_out[offset];
return ret;
}
READ8_MEMBER(xavix2002_io_device::pio_in_r)
{
LOG("%s: superxavix pio_in_r (port %d)\n", machine().describe_context(), offset);
uint8_t ret = 0x00;
switch (offset)
{
case 0: ret = m_space_read0_cb();
case 1: ret = m_space_read1_cb();
case 2: ret = m_space_read2_cb();
default: ret = 0x00;
}
// mask with direction register before returning
return ret;
}

View File

@ -0,0 +1,49 @@
// license:BSD-3-Clause
// copyright-holders:David Haywood
#ifndef MAME_MACHINE_XAVIX2002_IO_H
#define MAME_MACHINE_XAVIX2002_IO_H
class xavix2002_io_device : public device_t
{
public:
xavix2002_io_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
auto read_0_callback() { return m_space_read0_cb.bind(); }
auto read_1_callback() { return m_space_read1_cb.bind(); }
auto read_2_callback() { return m_space_read2_cb.bind(); }
auto write_0_callback() { return m_out0_cb.bind(); }
auto write_1_callback() { return m_out1_cb.bind(); }
auto write_2_callback() { return m_out2_cb.bind(); }
DECLARE_WRITE8_MEMBER(pio_dir_w);
DECLARE_READ8_MEMBER(pio_dir_r);
DECLARE_WRITE8_MEMBER(pio_out_w);
DECLARE_READ8_MEMBER(pio_out_r);
DECLARE_READ8_MEMBER(pio_in_r);
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
private:
devcb_read8 m_space_read0_cb;
devcb_read8 m_space_read1_cb;
devcb_read8 m_space_read2_cb;
devcb_write8 m_out0_cb;
devcb_write8 m_out1_cb;
devcb_write8 m_out2_cb;
uint8_t m_sx_pio_dir[3];
uint8_t m_sx_pio_out[3];
};
DECLARE_DEVICE_TYPE(XAVIX2002IO, xavix2002_io_device)
#endif // MAME_MACHINE_XAVIX2002_IO_H

View File

@ -39773,6 +39773,7 @@ ttv_mx //
drgqst //
xavtenni //
xavbaseb //
xavbassf //
xavjmat //
tmy_thom //
domfitex //