summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/fantland.c
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2012-04-04 15:08:19 +0000
committer Miodrag Milanovic <mmicko@gmail.com>2012-04-04 15:08:19 +0000
commit7dabd8b524510582d7f6ee96f430395d2f60cb78 (patch)
tree9641ea5111636c5963ac77e7130ace2773ddd1a3 /src/mame/drivers/fantland.c
parent62d9c8ba4fd4be6fc3225e8a3850526db7d78357 (diff)
MAME going modern part 5 (no whatsnew)
Tomorrow and next days just bug fixing from my side, no big changes
Diffstat (limited to 'src/mame/drivers/fantland.c')
-rw-r--r--src/mame/drivers/fantland.c139
1 files changed, 65 insertions, 74 deletions
diff --git a/src/mame/drivers/fantland.c b/src/mame/drivers/fantland.c
index 04eb9866cd5..dddb2600333 100644
--- a/src/mame/drivers/fantland.c
+++ b/src/mame/drivers/fantland.c
@@ -59,29 +59,27 @@ Year + Game Main CPU Sound CPU Sound Video
***************************************************************************/
-static WRITE8_HANDLER( fantland_nmi_enable_w )
+WRITE8_MEMBER(fantland_state::fantland_nmi_enable_w)
{
- fantland_state *state = space->machine().driver_data<fantland_state>();
- state->m_nmi_enable = data;
+ m_nmi_enable = data;
- if ((state->m_nmi_enable != 0) && (state->m_nmi_enable != 8))
- logerror("CPU #0 PC = %04X: nmi_enable = %02x\n", cpu_get_pc(&space->device()), data);
+ if ((m_nmi_enable != 0) && (m_nmi_enable != 8))
+ logerror("CPU #0 PC = %04X: nmi_enable = %02x\n", cpu_get_pc(&space.device()), data);
}
-static WRITE16_HANDLER( fantland_nmi_enable_16_w )
+WRITE16_MEMBER(fantland_state::fantland_nmi_enable_16_w)
{
if (ACCESSING_BITS_0_7)
fantland_nmi_enable_w(space, offset * 2, data);
}
-static WRITE8_HANDLER( fantland_soundlatch_w )
+WRITE8_MEMBER(fantland_state::fantland_soundlatch_w)
{
- fantland_state *state = space->machine().driver_data<fantland_state>();
soundlatch_w(space, 0, data);
- device_set_input_line(state->m_audio_cpu, INPUT_LINE_NMI, PULSE_LINE);
+ device_set_input_line(m_audio_cpu, INPUT_LINE_NMI, PULSE_LINE);
}
-static WRITE16_HANDLER( fantland_soundlatch_16_w )
+WRITE16_MEMBER(fantland_state::fantland_soundlatch_16_w)
{
if (ACCESSING_BITS_0_7)
fantland_soundlatch_w(space, offset * 2, data);
@@ -91,34 +89,30 @@ static WRITE16_HANDLER( fantland_soundlatch_16_w )
Fantasy Land
***************************************************************************/
-static READ16_HANDLER( spriteram_16_r )
+READ16_MEMBER(fantland_state::spriteram_16_r)
{
- fantland_state *state = space->machine().driver_data<fantland_state>();
- UINT8 *spriteram = state->m_spriteram;
+ UINT8 *spriteram = m_spriteram;
return spriteram[2 * offset + 0] | (spriteram[2 * offset + 1] << 8);
}
-static READ16_HANDLER( spriteram2_16_r )
+READ16_MEMBER(fantland_state::spriteram2_16_r)
{
- fantland_state *state = space->machine().driver_data<fantland_state>();
- UINT8 *spriteram_2 = state->m_spriteram2;
+ UINT8 *spriteram_2 = m_spriteram2;
return spriteram_2[2 * offset + 0] | (spriteram_2[2 * offset + 1] << 8);
}
-static WRITE16_HANDLER( spriteram_16_w )
+WRITE16_MEMBER(fantland_state::spriteram_16_w)
{
- fantland_state *state = space->machine().driver_data<fantland_state>();
- UINT8 *spriteram = state->m_spriteram;
+ UINT8 *spriteram = m_spriteram;
if (ACCESSING_BITS_0_7)
spriteram[2 * offset + 0] = data;
if (ACCESSING_BITS_8_15)
spriteram[2 * offset + 1] = data >> 8;
}
-static WRITE16_HANDLER( spriteram2_16_w )
+WRITE16_MEMBER(fantland_state::spriteram2_16_w)
{
- fantland_state *state = space->machine().driver_data<fantland_state>();
- UINT8 *spriteram_2 = state->m_spriteram2;
+ UINT8 *spriteram_2 = m_spriteram2;
if (ACCESSING_BITS_0_7)
spriteram_2[2 * offset + 0] = data;
if (ACCESSING_BITS_8_15)
@@ -131,11 +125,11 @@ static ADDRESS_MAP_START( fantland_map, AS_PROGRAM, 16, fantland_state )
AM_RANGE( 0xa2000, 0xa21ff ) AM_RAM_WRITE_LEGACY(paletteram16_xRRRRRGGGGGBBBBB_word_w ) AM_BASE_GENERIC( paletteram )
- AM_RANGE( 0xa3000, 0xa3001 ) AM_READ_PORT("a3000") AM_WRITE_LEGACY(fantland_nmi_enable_16_w )
- AM_RANGE( 0xa3002, 0xa3003 ) AM_READ_PORT("a3002") AM_WRITE_LEGACY(fantland_soundlatch_16_w )
+ AM_RANGE( 0xa3000, 0xa3001 ) AM_READ_PORT("a3000") AM_WRITE(fantland_nmi_enable_16_w )
+ AM_RANGE( 0xa3002, 0xa3003 ) AM_READ_PORT("a3002") AM_WRITE(fantland_soundlatch_16_w )
- AM_RANGE( 0xa4000, 0xa67ff ) AM_READWRITE_LEGACY(spriteram_16_r, spriteram_16_w ) AM_BASE(m_spriteram)
- AM_RANGE( 0xc0000, 0xcffff ) AM_READWRITE_LEGACY(spriteram2_16_r, spriteram2_16_w ) AM_BASE(m_spriteram2)
+ AM_RANGE( 0xa4000, 0xa67ff ) AM_READWRITE(spriteram_16_r, spriteram_16_w ) AM_BASE(m_spriteram)
+ AM_RANGE( 0xc0000, 0xcffff ) AM_READWRITE(spriteram2_16_r, spriteram2_16_w ) AM_BASE(m_spriteram2)
AM_RANGE( 0xe0000, 0xfffff ) AM_ROM
ADDRESS_MAP_END
@@ -151,9 +145,9 @@ static ADDRESS_MAP_START( galaxygn_map, AS_PROGRAM, 8, fantland_state )
AM_RANGE( 0x52000, 0x521ff ) AM_RAM_WRITE_LEGACY(paletteram_xRRRRRGGGGGBBBBB_le_w ) AM_BASE_GENERIC( paletteram )
- AM_RANGE( 0x53000, 0x53000 ) AM_READ_PORT("P1") AM_WRITE_LEGACY(fantland_nmi_enable_w )
+ AM_RANGE( 0x53000, 0x53000 ) AM_READ_PORT("P1") AM_WRITE(fantland_nmi_enable_w )
AM_RANGE( 0x53001, 0x53001 ) AM_READ_PORT("P2")
- AM_RANGE( 0x53002, 0x53002 ) AM_READ_PORT("DSW1") AM_WRITE_LEGACY(fantland_soundlatch_w )
+ AM_RANGE( 0x53002, 0x53002 ) AM_READ_PORT("DSW1") AM_WRITE(fantland_soundlatch_w )
AM_RANGE( 0x53003, 0x53003 ) AM_READ_PORT("P2")
AM_RANGE( 0x54000, 0x567ff ) AM_RAM AM_BASE(m_spriteram)
@@ -168,75 +162,73 @@ ADDRESS_MAP_END
Born To Fight
***************************************************************************/
-static WRITE8_HANDLER( borntofi_nmi_enable_w )
+WRITE8_MEMBER(fantland_state::borntofi_nmi_enable_w)
{
- fantland_state *state = space->machine().driver_data<fantland_state>();
- state->m_nmi_enable = data;
+ m_nmi_enable = data;
// data & 0x31 changes when lightgun fires
- if ((state->m_nmi_enable != 0) && (state->m_nmi_enable != 8))
- logerror("CPU #0 PC = %04X: nmi_enable = %02x\n", cpu_get_pc(&space->device()), data);
+ if ((m_nmi_enable != 0) && (m_nmi_enable != 8))
+ logerror("CPU #0 PC = %04X: nmi_enable = %02x\n", cpu_get_pc(&space.device()), data);
// popmessage("%02X", data);
}
// Trackball doesn't work correctly
-static READ8_HANDLER( borntofi_inputs_r )
+READ8_MEMBER(fantland_state::borntofi_inputs_r)
{
- fantland_state *state = space->machine().driver_data<fantland_state>();
int x, y, f;
- switch (input_port_read(space->machine(), "Controls") & 0x03)
+ switch (input_port_read(machine(), "Controls") & 0x03)
{
case 3:
- case 1: return input_port_read(space->machine(), offset ? "P2_GUN" : "P1_GUN"); // Lightgun buttons
- case 2: return input_port_read(space->machine(), offset ? "P2_JOY" : "P1_JOY"); // Joystick
+ case 1: return input_port_read(machine(), offset ? "P2_GUN" : "P1_GUN"); // Lightgun buttons
+ case 2: return input_port_read(machine(), offset ? "P2_JOY" : "P1_JOY"); // Joystick
}
// Trackball
- x = input_port_read(space->machine(), offset ? "P2 Trackball X" : "P1 Trackball X");
- y = input_port_read(space->machine(), offset ? "P2 Trackball Y" : "P1 Trackball Y");
- f = space->machine().primary_screen->frame_number();
+ x = input_port_read(machine(), offset ? "P2 Trackball X" : "P1 Trackball X");
+ y = input_port_read(machine(), offset ? "P2 Trackball Y" : "P1 Trackball Y");
+ f = machine().primary_screen->frame_number();
- state->m_input_ret[offset] = (state->m_input_ret[offset] & 0x14) | (input_port_read(space->machine(), offset ? "P2_TRACK" : "P1_TRACK") & 0xc3);
+ m_input_ret[offset] = (m_input_ret[offset] & 0x14) | (input_port_read(machine(), offset ? "P2_TRACK" : "P1_TRACK") & 0xc3);
x = (x & 0x7f) - (x & 0x80);
y = (y & 0x7f) - (y & 0x80);
- if (state->m_old_x[offset] > 0)
+ if (m_old_x[offset] > 0)
{
- state->m_input_ret[offset] = (state->m_input_ret[offset] ^ 0x04) | ((state->m_input_ret[offset] & 0x04) << 1);
- state->m_old_x[offset]--;
+ m_input_ret[offset] = (m_input_ret[offset] ^ 0x04) | ((m_input_ret[offset] & 0x04) << 1);
+ m_old_x[offset]--;
}
- else if (state->m_old_x[offset] < 0)
+ else if (m_old_x[offset] < 0)
{
- state->m_input_ret[offset] = (state->m_input_ret[offset] ^ 0x04) | (((~state->m_input_ret[offset]) & 0x04) << 1);
- state->m_old_x[offset]++;
+ m_input_ret[offset] = (m_input_ret[offset] ^ 0x04) | (((~m_input_ret[offset]) & 0x04) << 1);
+ m_old_x[offset]++;
}
- if (state->m_old_y[offset] > 0)
+ if (m_old_y[offset] > 0)
{
- state->m_input_ret[offset] = (state->m_input_ret[offset] ^ 0x10) | ((state->m_input_ret[offset] & 0x10) << 1);
- state->m_old_y[offset]--;
+ m_input_ret[offset] = (m_input_ret[offset] ^ 0x10) | ((m_input_ret[offset] & 0x10) << 1);
+ m_old_y[offset]--;
}
- else if (state->m_old_y[offset] < 0)
+ else if (m_old_y[offset] < 0)
{
- state->m_input_ret[offset] = (state->m_input_ret[offset] ^ 0x10) | (((~state->m_input_ret[offset]) & 0x10) << 1);
- state->m_old_y[offset]++;
+ m_input_ret[offset] = (m_input_ret[offset] ^ 0x10) | (((~m_input_ret[offset]) & 0x10) << 1);
+ m_old_y[offset]++;
}
-// if (offset == 0) popmessage("x %02d y %02d", state->m_old_x[offset], state->m_old_y[offset]);
+// if (offset == 0) popmessage("x %02d y %02d", m_old_x[offset], m_old_y[offset]);
- if ((f - state->m_old_f[offset]) > 0)
+ if ((f - m_old_f[offset]) > 0)
{
- state->m_old_x[offset] = x;
- state->m_old_y[offset] = y;
- state->m_old_f[offset] = f;
+ m_old_x[offset] = x;
+ m_old_y[offset] = y;
+ m_old_f[offset] = f;
}
- return state->m_input_ret[offset];
+ return m_input_ret[offset];
}
static ADDRESS_MAP_START( borntofi_map, AS_PROGRAM, 8, fantland_state )
@@ -244,8 +236,8 @@ static ADDRESS_MAP_START( borntofi_map, AS_PROGRAM, 8, fantland_state )
AM_RANGE( 0x10000, 0x2ffff ) AM_ROM
AM_RANGE( 0x52000, 0x521ff ) AM_RAM_WRITE_LEGACY(paletteram_xRRRRRGGGGGBBBBB_le_w ) AM_BASE_GENERIC( paletteram )
- AM_RANGE( 0x53000, 0x53001 ) AM_READWRITE_LEGACY(borntofi_inputs_r, borntofi_nmi_enable_w )
- AM_RANGE( 0x53002, 0x53002 ) AM_READ_PORT( "DSW" ) AM_WRITE_LEGACY(fantland_soundlatch_w )
+ AM_RANGE( 0x53000, 0x53001 ) AM_READWRITE(borntofi_inputs_r, borntofi_nmi_enable_w )
+ AM_RANGE( 0x53002, 0x53002 ) AM_READ_PORT( "DSW" ) AM_WRITE(fantland_soundlatch_w )
AM_RANGE( 0x53003, 0x53003 ) AM_READ_PORT( "Controls" )
AM_RANGE( 0x54000, 0x567ff ) AM_RAM AM_BASE(m_spriteram)
@@ -274,9 +266,9 @@ static ADDRESS_MAP_START( wheelrun_map, AS_PROGRAM, 8, fantland_state )
AM_RANGE(0x52000, 0x521ff) AM_RAM_WRITE_LEGACY(paletteram_xRRRRRGGGGGBBBBB_le_w ) AM_BASE_GENERIC( paletteram )
- AM_RANGE(0x53000, 0x53000) AM_READ_PORT( "53000" ) AM_WRITE_LEGACY(borntofi_nmi_enable_w )
+ AM_RANGE(0x53000, 0x53000) AM_READ_PORT( "53000" ) AM_WRITE(borntofi_nmi_enable_w )
AM_RANGE(0x53001, 0x53001) AM_READ_PORT( "53001" )
- AM_RANGE(0x53002, 0x53002) AM_READ_PORT( "53002" ) AM_WRITE_LEGACY(fantland_soundlatch_w )
+ AM_RANGE(0x53002, 0x53002) AM_READ_PORT( "53002" ) AM_WRITE(fantland_soundlatch_w )
AM_RANGE(0x53003, 0x53003) AM_READ_PORT( "53003" ) AM_WRITENOP
AM_RANGE(0x54000, 0x567ff) AM_RAM AM_BASE(m_spriteram)
@@ -331,9 +323,8 @@ static void borntofi_adpcm_stop( device_t *device, int voice )
state->m_adpcm_playing[voice] = 0;
}
-static WRITE8_HANDLER( borntofi_msm5205_w )
+WRITE8_MEMBER(fantland_state::borntofi_msm5205_w)
{
- fantland_state *state = space->machine().driver_data<fantland_state>();
int voice = offset / 8;
int reg = offset % 8;
device_t *msm;
@@ -341,10 +332,10 @@ static WRITE8_HANDLER( borntofi_msm5205_w )
switch (voice)
{
default:
- case 0: msm = state->m_msm1; break;
- case 1: msm = state->m_msm2; break;
- case 2: msm = state->m_msm3; break;
- case 3: msm = state->m_msm4; break;
+ case 0: msm = m_msm1; break;
+ case 1: msm = m_msm2; break;
+ case 2: msm = m_msm3; break;
+ case 3: msm = m_msm4; break;
}
if (reg == 0)
@@ -354,7 +345,7 @@ static WRITE8_HANDLER( borntofi_msm5205_w )
{
case 0x00: borntofi_adpcm_stop(msm, voice); break;
case 0x03: borntofi_adpcm_start(msm, voice); break;
- default: logerror("CPU #0 PC = %04X: adpcm reg %d <- %02x\n", cpu_get_pc(&space->device()), reg, data);
+ default: logerror("CPU #0 PC = %04X: adpcm reg %d <- %02x\n", cpu_get_pc(&space.device()), reg, data);
}
}
else
@@ -362,8 +353,8 @@ static WRITE8_HANDLER( borntofi_msm5205_w )
int shift = (reg - 1) * 4;
int mask = ~(0xf << shift);
- state->m_adpcm_addr[0][voice] = (state->m_adpcm_addr[0][voice] & mask) | (((data & 0xf0) >> 4) << shift);
- state->m_adpcm_addr[1][voice] = (state->m_adpcm_addr[1][voice] & mask) | (((data & 0x0f) >> 0) << shift);
+ m_adpcm_addr[0][voice] = (m_adpcm_addr[0][voice] & mask) | (((data & 0xf0) >> 4) << shift);
+ m_adpcm_addr[1][voice] = (m_adpcm_addr[1][voice] & mask) | (((data & 0x0f) >> 0) << shift);
}
}
@@ -410,7 +401,7 @@ static void borntofi_adpcm_int_3(device_t *device) { borntofi_adpcm_int(device,
static ADDRESS_MAP_START( borntofi_sound_map, AS_PROGRAM, 8, fantland_state )
AM_RANGE( 0x00000, 0x003ff ) AM_RAM
AM_RANGE( 0x04000, 0x04000 ) AM_READ_LEGACY(soundlatch_r)
- AM_RANGE( 0x04000, 0x0401f ) AM_WRITE_LEGACY(borntofi_msm5205_w)
+ AM_RANGE( 0x04000, 0x0401f ) AM_WRITE(borntofi_msm5205_w)
AM_RANGE( 0x08000, 0x0ffff ) AM_ROM
AM_RANGE( 0xf8000, 0xfffff ) AM_ROM
ADDRESS_MAP_END