summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/sidepckt.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/drivers/sidepckt.c')
-rw-r--r--src/mame/drivers/sidepckt.c87
1 files changed, 43 insertions, 44 deletions
diff --git a/src/mame/drivers/sidepckt.c b/src/mame/drivers/sidepckt.c
index 2a72d2ae342..3e477d515c6 100644
--- a/src/mame/drivers/sidepckt.c
+++ b/src/mame/drivers/sidepckt.c
@@ -131,96 +131,93 @@ Stephh's notes (based on the games M6809 code and some tests) :
#include "includes/sidepckt.h"
-static WRITE8_HANDLER( sound_cpu_command_w )
+WRITE8_MEMBER(sidepckt_state::sound_cpu_command_w)
{
soundlatch_w(space, offset, data);
- cputag_set_input_line(space->machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
+ cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
}
-static READ8_HANDLER( sidepckt_i8751_r )
+READ8_MEMBER(sidepckt_state::sidepckt_i8751_r)
{
- sidepckt_state *state = space->machine().driver_data<sidepckt_state>();
- return state->m_i8751_return;
+ return m_i8751_return;
}
-static WRITE8_HANDLER( sidepckt_i8751_w )
+WRITE8_MEMBER(sidepckt_state::sidepckt_i8751_w)
{
- sidepckt_state *state = space->machine().driver_data<sidepckt_state>();
static const int table_1[]={5,3,2};
static const int table_2[]={0x8e,0x42,0xad,0x58,0xec,0x85,0xdd,0x4c,0xad,0x9f,0x00,0x4c,0x7e,0x42,0xa2,0xff};
static const int table_3[]={0xbd,0x73,0x80,0xbd,0x73,0xa7,0xbd,0x73,0xe0,0x7e,0x72,0x56,0xff,0xff,0xff,0xff};
- cputag_set_input_line(space->machine(), "maincpu", M6809_FIRQ_LINE, HOLD_LINE); /* i8751 triggers FIRQ on main cpu */
+ cputag_set_input_line(machine(), "maincpu", M6809_FIRQ_LINE, HOLD_LINE); /* i8751 triggers FIRQ on main cpu */
/* This function takes multiple parameters */
- if (state->m_in_math==1) {
- state->m_in_math=2;
- state->m_i8751_return=state->m_math_param=data;
+ if (m_in_math==1) {
+ m_in_math=2;
+ m_i8751_return=m_math_param=data;
}
- else if (state->m_in_math==2) {
- state->m_in_math=0;
- state->m_i8751_return=state->m_math_param/data;
+ else if (m_in_math==2) {
+ m_in_math=0;
+ m_i8751_return=m_math_param/data;
}
else switch (data) {
case 1: /* ID Check */
- state->m_current_table=1; state->m_current_ptr=0; state->m_i8751_return=table_1[state->m_current_ptr++]; break;
+ m_current_table=1; m_current_ptr=0; m_i8751_return=table_1[m_current_ptr++]; break;
case 2: /* Protection data (executable code) */
- state->m_current_table=2; state->m_current_ptr=0; state->m_i8751_return=table_2[state->m_current_ptr++]; break;
+ m_current_table=2; m_current_ptr=0; m_i8751_return=table_2[m_current_ptr++]; break;
case 3: /* Protection data (executable code) */
- state->m_current_table=3; state->m_current_ptr=0; state->m_i8751_return=table_3[state->m_current_ptr++]; break;
+ m_current_table=3; m_current_ptr=0; m_i8751_return=table_3[m_current_ptr++]; break;
case 4: /* Divide function - multiple parameters */
- state->m_in_math=1;
- state->m_i8751_return=4;
+ m_in_math=1;
+ m_i8751_return=4;
break;
case 6: /* Read table data */
- if (state->m_current_table==1) state->m_i8751_return=table_1[state->m_current_ptr++];
- if (state->m_current_table==2) state->m_i8751_return=table_2[state->m_current_ptr++];
- if (state->m_current_table==3) state->m_i8751_return=table_3[state->m_current_ptr++];
+ if (m_current_table==1) m_i8751_return=table_1[m_current_ptr++];
+ if (m_current_table==2) m_i8751_return=table_2[m_current_ptr++];
+ if (m_current_table==3) m_i8751_return=table_3[m_current_ptr++];
break;
}
}
-static WRITE8_HANDLER( sidepctj_i8751_w )
+WRITE8_MEMBER(sidepckt_state::sidepctj_i8751_w)
{
- sidepckt_state *state = space->machine().driver_data<sidepckt_state>();
static const int table_1[]={5,3,0};
static const int table_2[]={0x8e,0x42,0xb2,0x58,0xec,0x85,0xdd,0x4c,0xad,0x9f,0x00,0x4c,0x7e,0x42,0xa7,0xff};
static const int table_3[]={0xbd,0x71,0xc8,0xbd,0x71,0xef,0xbd,0x72,0x28,0x7e,0x70,0x9e,0xff,0xff,0xff,0xff};
- cputag_set_input_line(space->machine(), "maincpu", M6809_FIRQ_LINE, HOLD_LINE); /* i8751 triggers FIRQ on main cpu */
+ cputag_set_input_line(machine(), "maincpu", M6809_FIRQ_LINE, HOLD_LINE); /* i8751 triggers FIRQ on main cpu */
/* This function takes multiple parameters */
- if (state->m_in_math==1) {
- state->m_in_math=2;
- state->m_i8751_return=state->m_math_param=data;
+ if (m_in_math==1) {
+ m_in_math=2;
+ m_i8751_return=m_math_param=data;
}
- else if (state->m_in_math==2) {
- state->m_in_math=0;
- state->m_i8751_return=state->m_math_param/data;
+ else if (m_in_math==2) {
+ m_in_math=0;
+ m_i8751_return=m_math_param/data;
}
else switch (data) {
case 1: /* ID Check */
- state->m_current_table=1; state->m_current_ptr=0; state->m_i8751_return=table_1[state->m_current_ptr++]; break;
+ m_current_table=1; m_current_ptr=0; m_i8751_return=table_1[m_current_ptr++]; break;
case 2: /* Protection data (executable code) */
- state->m_current_table=2; state->m_current_ptr=0; state->m_i8751_return=table_2[state->m_current_ptr++]; break;
+ m_current_table=2; m_current_ptr=0; m_i8751_return=table_2[m_current_ptr++]; break;
case 3: /* Protection data (executable code) */
- state->m_current_table=3; state->m_current_ptr=0; state->m_i8751_return=table_3[state->m_current_ptr++]; break;
+ m_current_table=3; m_current_ptr=0; m_i8751_return=table_3[m_current_ptr++]; break;
case 4: /* Divide function - multiple parameters */
- state->m_in_math=1;
- state->m_i8751_return=4;
+ m_in_math=1;
+ m_i8751_return=4;
break;
case 6: /* Read table data */
- if (state->m_current_table==1) state->m_i8751_return=table_1[state->m_current_ptr++];
- if (state->m_current_table==2) state->m_i8751_return=table_2[state->m_current_ptr++];
- if (state->m_current_table==3) state->m_i8751_return=table_3[state->m_current_ptr++];
+ if (m_current_table==1) m_i8751_return=table_1[m_current_ptr++];
+ if (m_current_table==2) m_i8751_return=table_2[m_current_ptr++];
+ if (m_current_table==3) m_i8751_return=table_3[m_current_ptr++];
break;
}
}
@@ -239,7 +236,7 @@ static ADDRESS_MAP_START( sidepckt_map, AS_PROGRAM, 8, sidepckt_state )
AM_RANGE(0x3001, 0x3001) AM_READ_PORT("P2")
AM_RANGE(0x3002, 0x3002) AM_READ_PORT("DSW1")
AM_RANGE(0x3003, 0x3003) AM_READ_PORT("DSW2")
- AM_RANGE(0x3004, 0x3004) AM_WRITE_LEGACY(sound_cpu_command_w)
+ AM_RANGE(0x3004, 0x3004) AM_WRITE(sound_cpu_command_w)
AM_RANGE(0x300c, 0x300c) AM_READNOP AM_WRITE_LEGACY(sidepckt_flipscreen_w)
// AM_RANGE(0x3014, 0x3014) //i8751 read
// AM_RANGE(0x3018, 0x3018) //i8751 write
@@ -507,14 +504,16 @@ ROM_END
static DRIVER_INIT( sidepckt )
{
- machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x3014, 0x3014, FUNC(sidepckt_i8751_r) );
- machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x3018, 0x3018, FUNC(sidepckt_i8751_w) );
+ sidepckt_state *state = machine.driver_data<sidepckt_state>();
+ machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x3014, 0x3014, read8_delegate(FUNC(sidepckt_state::sidepckt_i8751_r),state));
+ machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x3018, 0x3018, write8_delegate(FUNC(sidepckt_state::sidepckt_i8751_w),state));
}
static DRIVER_INIT( sidepctj )
{
- machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x3014, 0x3014, FUNC(sidepckt_i8751_r) );
- machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x3018, 0x3018, FUNC(sidepctj_i8751_w) );
+ sidepckt_state *state = machine.driver_data<sidepckt_state>();
+ machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x3014, 0x3014, read8_delegate(FUNC(sidepckt_state::sidepckt_i8751_r),state));
+ machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x3018, 0x3018, write8_delegate(FUNC(sidepckt_state::sidepctj_i8751_w),state));
}