mirror of
https://github.com/holub/mame
synced 2025-10-06 09:00:04 +03:00
added sm510 K and S ports
This commit is contained in:
parent
39733ffb55
commit
886495009b
@ -36,7 +36,8 @@ void sm510_base_device::device_start()
|
|||||||
m_datamask = (1 << m_datawidth) - 1;
|
m_datamask = (1 << m_datawidth) - 1;
|
||||||
|
|
||||||
// resolve callbacks
|
// resolve callbacks
|
||||||
//..
|
m_read_k.resolve_safe(0);
|
||||||
|
m_write_s.resolve_safe();
|
||||||
|
|
||||||
// zerofill
|
// zerofill
|
||||||
memset(m_stack, 0, sizeof(m_stack));
|
memset(m_stack, 0, sizeof(m_stack));
|
||||||
@ -50,6 +51,7 @@ void sm510_base_device::device_start()
|
|||||||
m_bm = 0;
|
m_bm = 0;
|
||||||
m_c = 0;
|
m_c = 0;
|
||||||
m_skip = false;
|
m_skip = false;
|
||||||
|
m_w = 0;
|
||||||
|
|
||||||
// register for savestates
|
// register for savestates
|
||||||
save_item(NAME(m_stack));
|
save_item(NAME(m_stack));
|
||||||
@ -63,6 +65,7 @@ void sm510_base_device::device_start()
|
|||||||
save_item(NAME(m_bm));
|
save_item(NAME(m_bm));
|
||||||
save_item(NAME(m_c));
|
save_item(NAME(m_c));
|
||||||
save_item(NAME(m_skip));
|
save_item(NAME(m_skip));
|
||||||
|
save_item(NAME(m_w));
|
||||||
|
|
||||||
// register state for debugger
|
// register state for debugger
|
||||||
state_add(SM510_PC, "PC", m_pc).formatstr("%04X");
|
state_add(SM510_PC, "PC", m_pc).formatstr("%04X");
|
||||||
|
@ -14,6 +14,16 @@
|
|||||||
|
|
||||||
// I/O ports setup
|
// I/O ports setup
|
||||||
|
|
||||||
|
// 4-bit K input port
|
||||||
|
#define MCFG_SM510_READ_K_CB(_devcb) \
|
||||||
|
sm510_base_device::set_read_k_callback(*device, DEVCB_##_devcb);
|
||||||
|
|
||||||
|
// 8-bit S strobe output port
|
||||||
|
#define MCFG_SM510_WRITE_S_CB(_devcb) \
|
||||||
|
sm510_base_device::set_write_s_callback(*device, DEVCB_##_devcb);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// pinout reference
|
// pinout reference
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -31,10 +41,13 @@ public:
|
|||||||
, m_prgwidth(prgwidth)
|
, m_prgwidth(prgwidth)
|
||||||
, m_datawidth(datawidth)
|
, m_datawidth(datawidth)
|
||||||
, m_stack_levels(stack_levels)
|
, m_stack_levels(stack_levels)
|
||||||
|
, m_read_k(*this)
|
||||||
|
, m_write_s(*this)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
// static configuration helpers
|
// static configuration helpers
|
||||||
//..
|
template<class _Object> static devcb_base &set_read_k_callback(device_t &device, _Object object) { return downcast<sm510_base_device &>(device).m_read_k.set_callback(object); }
|
||||||
|
template<class _Object> static devcb_base &set_write_s_callback(device_t &device, _Object object) { return downcast<sm510_base_device &>(device).m_write_s.set_callback(object); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// device-level overrides
|
// device-level overrides
|
||||||
@ -56,7 +69,7 @@ protected:
|
|||||||
|
|
||||||
// device_disasm_interface overrides
|
// device_disasm_interface overrides
|
||||||
virtual UINT32 disasm_min_opcode_bytes() const { return 1; }
|
virtual UINT32 disasm_min_opcode_bytes() const { return 1; }
|
||||||
virtual UINT32 disasm_max_opcode_bytes() const { return 2; }
|
virtual UINT32 disasm_max_opcode_bytes() const { return 0x40; } // actually 2, but debugger doesn't like non-linear pc
|
||||||
|
|
||||||
address_space_config m_program_config;
|
address_space_config m_program_config;
|
||||||
address_space_config m_data_config;
|
address_space_config m_data_config;
|
||||||
@ -82,9 +95,11 @@ protected:
|
|||||||
UINT8 m_bm;
|
UINT8 m_bm;
|
||||||
UINT8 m_c;
|
UINT8 m_c;
|
||||||
bool m_skip;
|
bool m_skip;
|
||||||
|
UINT8 m_w;
|
||||||
|
|
||||||
// i/o handlers
|
// i/o handlers
|
||||||
//..
|
devcb_read16 m_read_k;
|
||||||
|
devcb_write8 m_write_s;
|
||||||
|
|
||||||
// misc internal helpers
|
// misc internal helpers
|
||||||
void increment_pc();
|
void increment_pc();
|
||||||
|
@ -115,7 +115,7 @@ CPU_DISASSEMBLE(sm510)
|
|||||||
if (bits >= 8)
|
if (bits >= 8)
|
||||||
{
|
{
|
||||||
// note: disasm view shows correct parameter, but raw view does not
|
// note: disasm view shows correct parameter, but raw view does not
|
||||||
// note2: oprom array negative index access is intentional
|
// note2: oprom array negative index doesn't work either :(
|
||||||
param = oprom[s_next_pc[pc & 0x3f]];
|
param = oprom[s_next_pc[pc & 0x3f]];
|
||||||
len++;
|
len++;
|
||||||
}
|
}
|
||||||
@ -141,6 +141,10 @@ CPU_DISASSEMBLE(sm510)
|
|||||||
UINT16 address = (param << 4 & 0xc00) | (mask << 6 & 0x3c0) | (param & 0x03f);
|
UINT16 address = (param << 4 & 0xc00) | (mask << 6 & 0x3c0) | (param & 0x03f);
|
||||||
dst += sprintf(dst, "$%03X", address);
|
dst += sprintf(dst, "$%03X", address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// show param offset
|
||||||
|
if (bits >= 8)
|
||||||
|
dst += sprintf(dst, " [$%03X]", pc + s_next_pc[pc & 0x3f]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return len | s_flags[instr] | DASMFLAG_SUPPORTED;
|
return len | s_flags[instr] | DASMFLAG_SUPPORTED;
|
||||||
|
@ -195,13 +195,15 @@ void sm510_base_device::op_lax()
|
|||||||
void sm510_base_device::op_wr()
|
void sm510_base_device::op_wr()
|
||||||
{
|
{
|
||||||
// WR: shift 0 into W
|
// WR: shift 0 into W
|
||||||
op_illegal();
|
m_w = m_w << 1 | 0;
|
||||||
|
m_write_s(0, m_w, 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sm510_base_device::op_ws()
|
void sm510_base_device::op_ws()
|
||||||
{
|
{
|
||||||
// WR: shift 1 into W
|
// WR: shift 1 into W
|
||||||
op_illegal();
|
m_w = m_w << 1 | 1;
|
||||||
|
m_write_s(0, m_w, 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -210,7 +212,7 @@ void sm510_base_device::op_ws()
|
|||||||
void sm510_base_device::op_kta()
|
void sm510_base_device::op_kta()
|
||||||
{
|
{
|
||||||
// KTA: input K to ACC
|
// KTA: input K to ACC
|
||||||
op_illegal();
|
m_acc = m_read_k(0, 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sm510_base_device::op_atbp()
|
void sm510_base_device::op_atbp()
|
||||||
|
@ -71,7 +71,14 @@ void hh_sm510_state::machine_reset()
|
|||||||
|
|
||||||
UINT8 hh_sm510_state::read_inputs(int columns)
|
UINT8 hh_sm510_state::read_inputs(int columns)
|
||||||
{
|
{
|
||||||
return 0;
|
UINT8 ret = 0;
|
||||||
|
|
||||||
|
// read selected input rows
|
||||||
|
for (int i = 0; i < columns; i++)
|
||||||
|
if (m_inp_mux >> i & 1)
|
||||||
|
ret |= m_inp_matrix[i]->read();
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -95,22 +102,56 @@ public:
|
|||||||
ktopgun_state(const machine_config &mconfig, device_type type, const char *tag)
|
ktopgun_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||||
: hh_sm510_state(mconfig, type, tag)
|
: hh_sm510_state(mconfig, type, tag)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
DECLARE_WRITE8_MEMBER(input_w);
|
||||||
|
DECLARE_READ8_MEMBER(input_r);
|
||||||
};
|
};
|
||||||
|
|
||||||
// handlers
|
// handlers
|
||||||
|
|
||||||
//..
|
|
||||||
|
WRITE8_MEMBER(ktopgun_state::input_w)
|
||||||
|
{
|
||||||
|
// S1-S3: input mux
|
||||||
|
m_inp_mux = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
READ8_MEMBER(ktopgun_state::input_r)
|
||||||
|
{
|
||||||
|
//printf("%02X ",m_inp_mux);
|
||||||
|
return read_inputs(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// config
|
// config
|
||||||
|
|
||||||
static INPUT_PORTS_START( ktopgun )
|
static INPUT_PORTS_START( ktopgun )
|
||||||
|
PORT_START("IN.0")
|
||||||
|
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 )
|
||||||
|
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 )
|
||||||
|
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 )
|
||||||
|
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 )
|
||||||
|
|
||||||
|
PORT_START("IN.1")
|
||||||
|
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT )
|
||||||
|
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP )
|
||||||
|
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN )
|
||||||
|
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT )
|
||||||
|
|
||||||
|
PORT_START("IN.2")
|
||||||
|
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON5 )
|
||||||
|
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON6 )
|
||||||
|
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON7 )
|
||||||
|
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON8 )
|
||||||
INPUT_PORTS_END
|
INPUT_PORTS_END
|
||||||
|
|
||||||
static MACHINE_CONFIG_START( ktopgun, ktopgun_state )
|
static MACHINE_CONFIG_START( ktopgun, ktopgun_state )
|
||||||
|
|
||||||
/* basic machine hardware */
|
/* basic machine hardware */
|
||||||
MCFG_CPU_ADD("maincpu", SM510, 10000)
|
MCFG_CPU_ADD("maincpu", SM510, XTAL_32_768kHz)
|
||||||
|
MCFG_SM510_READ_K_CB(READ8(ktopgun_state, input_r))
|
||||||
|
MCFG_SM510_WRITE_S_CB(WRITE8(ktopgun_state, input_w))
|
||||||
|
|
||||||
/* no video! */
|
/* no video! */
|
||||||
|
|
||||||
@ -144,4 +185,4 @@ ROM_END
|
|||||||
|
|
||||||
|
|
||||||
/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */
|
/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */
|
||||||
CONS( 1990, ktopgun, 0, 0, ktopgun, ktopgun, driver_device, 0, "Konami", "Top Gun (Konami)", GAME_SUPPORTS_SAVE | GAME_NOT_WORKING )
|
CONS( 1989, ktopgun, 0, 0, ktopgun, ktopgun, driver_device, 0, "Konami", "Top Gun (Konami)", GAME_SUPPORTS_SAVE | GAME_NOT_WORKING )
|
||||||
|
Loading…
Reference in New Issue
Block a user