diff options
Diffstat (limited to 'src/mame/drivers/ojankohs.c')
-rw-r--r-- | src/mame/drivers/ojankohs.c | 72 |
1 files changed, 31 insertions, 41 deletions
diff --git a/src/mame/drivers/ojankohs.c b/src/mame/drivers/ojankohs.c index c8f64dcaea4..813978fc5a1 100644 --- a/src/mame/drivers/ojankohs.c +++ b/src/mame/drivers/ojankohs.c @@ -88,15 +88,15 @@ static WRITE8_HANDLER( ojankoy_rombank_w ) ojankohs_adpcm_reset = ((data & 0x20) >> 5); if (!ojankohs_adpcm_reset) ojankohs_vclk_left = 0; - msm5205_reset_w(0, !ojankohs_adpcm_reset); + msm5205_reset_w(devtag_get_device(space->machine, SOUND, "msm"), !ojankohs_adpcm_reset); } -static WRITE8_HANDLER( ojankohs_adpcm_reset_w ) +static WRITE8_DEVICE_HANDLER( ojankohs_adpcm_reset_w ) { ojankohs_adpcm_reset = (data & 0x01); ojankohs_vclk_left = 0; - msm5205_reset_w(0, !ojankohs_adpcm_reset); + msm5205_reset_w(device, !ojankohs_adpcm_reset); } static WRITE8_HANDLER( ojankohs_msm5205_w ) @@ -113,7 +113,7 @@ static void ojankohs_adpcm_int(const device_config *device) /* clock the data through */ if (ojankohs_vclk_left) { - msm5205_data_w(0, (ojankohs_adpcm_data >> 4)); + msm5205_data_w(device, (ojankohs_adpcm_data >> 4)); ojankohs_adpcm_data <<= 4; ojankohs_vclk_left--; } @@ -131,7 +131,7 @@ static WRITE8_HANDLER( ojankoc_ctrl_w ) memory_set_bankptr(space->machine, 1, &BANKROM[bank_address]); ojankohs_adpcm_reset = ((data & 0x10) >> 4); - msm5205_reset_w(0, (!(data & 0x10) >> 4)); + msm5205_reset_w(devtag_get_device(space->machine, SOUND, "msm"), (!(data & 0x10) >> 4)); ojankoc_flipscreen(space, data); } @@ -184,32 +184,22 @@ static READ8_HANDLER( ojankoc_keymatrix_r ) return (ret & 0x3f) | (input_port_read(space->machine, offset ? "IN1" : "IN0") & 0xc0); } -static READ8_HANDLER( ojankohs_ay8910_0_r ) +static READ8_DEVICE_HANDLER( ojankohs_ay8910_0_r ) { // DIPSW 1 - return (((input_port_read(space->machine, "DSW1") & 0x01) << 7) | ((input_port_read(space->machine, "DSW1") & 0x02) << 5) | - ((input_port_read(space->machine, "DSW1") & 0x04) << 3) | ((input_port_read(space->machine, "DSW1") & 0x08) << 1) | - ((input_port_read(space->machine, "DSW1") & 0x10) >> 1) | ((input_port_read(space->machine, "DSW1") & 0x20) >> 3) | - ((input_port_read(space->machine, "DSW1") & 0x40) >> 5) | ((input_port_read(space->machine, "DSW1") & 0x80) >> 7)); + return (((input_port_read(device->machine, "DSW1") & 0x01) << 7) | ((input_port_read(device->machine, "DSW1") & 0x02) << 5) | + ((input_port_read(device->machine, "DSW1") & 0x04) << 3) | ((input_port_read(device->machine, "DSW1") & 0x08) << 1) | + ((input_port_read(device->machine, "DSW1") & 0x10) >> 1) | ((input_port_read(device->machine, "DSW1") & 0x20) >> 3) | + ((input_port_read(device->machine, "DSW1") & 0x40) >> 5) | ((input_port_read(device->machine, "DSW1") & 0x80) >> 7)); } -static READ8_HANDLER( ojankohs_ay8910_1_r ) +static READ8_DEVICE_HANDLER( ojankohs_ay8910_1_r ) { // DIPSW 1 - return (((input_port_read(space->machine, "DSW2") & 0x01) << 7) | ((input_port_read(space->machine, "DSW2") & 0x02) << 5) | - ((input_port_read(space->machine, "DSW2") & 0x04) << 3) | ((input_port_read(space->machine, "DSW2") & 0x08) << 1) | - ((input_port_read(space->machine, "DSW2") & 0x10) >> 1) | ((input_port_read(space->machine, "DSW2") & 0x20) >> 3) | - ((input_port_read(space->machine, "DSW2") & 0x40) >> 5) | ((input_port_read(space->machine, "DSW2") & 0x80) >> 7)); -} - -static READ8_HANDLER( ojankoy_ay8910_0_r ) -{ - return input_port_read(space->machine, "DSW1"); // DIPSW 1 -} - -static READ8_HANDLER( ojankoy_ay8910_1_r ) -{ - return input_port_read(space->machine, "DSW2"); // DIPSW 2 + return (((input_port_read(device->machine, "DSW2") & 0x01) << 7) | ((input_port_read(device->machine, "DSW2") & 0x02) << 5) | + ((input_port_read(device->machine, "DSW2") & 0x04) << 3) | ((input_port_read(device->machine, "DSW2") & 0x08) << 1) | + ((input_port_read(device->machine, "DSW2") & 0x10) >> 1) | ((input_port_read(device->machine, "DSW2") & 0x20) >> 3) | + ((input_port_read(device->machine, "DSW2") & 0x40) >> 5) | ((input_port_read(device->machine, "DSW2") & 0x80) >> 7)); } static READ8_HANDLER( ccasino_dipsw3_r ) @@ -285,11 +275,11 @@ static ADDRESS_MAP_START( ojankohs_io_map, ADDRESS_SPACE_IO, 8 ) AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0") AM_WRITE(ojankohs_portselect_w) AM_RANGE(0x01, 0x01) AM_READWRITE(ojankohs_keymatrix_r, ojankohs_rombank_w) AM_RANGE(0x02, 0x02) AM_READ_PORT("IN1") AM_WRITE(ojankohs_gfxreg_w) - AM_RANGE(0x03, 0x03) AM_WRITE(ojankohs_adpcm_reset_w) + AM_RANGE(0x03, 0x03) AM_DEVWRITE(SOUND, "msm", ojankohs_adpcm_reset_w) AM_RANGE(0x04, 0x04) AM_WRITE(ojankohs_flipscreen_w) AM_RANGE(0x05, 0x05) AM_WRITE(ojankohs_msm5205_w) - AM_RANGE(0x06, 0x06) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w) - AM_RANGE(0x07, 0x07) AM_WRITE(ay8910_control_port_0_w) + AM_RANGE(0x06, 0x06) AM_DEVREAD(SOUND, "ay", ay8910_r) + AM_RANGE(0x06, 0x07) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w) AM_RANGE(0x10, 0x10) AM_WRITE(SMH_NOP) // unknown AM_RANGE(0x11, 0x11) AM_WRITE(SMH_NOP) // unknown ADDRESS_MAP_END @@ -301,8 +291,8 @@ static ADDRESS_MAP_START( ojankoy_io_map, ADDRESS_SPACE_IO, 8 ) AM_RANGE(0x02, 0x02) AM_READ_PORT("IN1") AM_WRITE(ojankoy_coinctr_w) AM_RANGE(0x04, 0x04) AM_WRITE(ojankohs_flipscreen_w) AM_RANGE(0x05, 0x05) AM_WRITE(ojankohs_msm5205_w) - AM_RANGE(0x06, 0x06) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w) - AM_RANGE(0x07, 0x07) AM_WRITE(ay8910_control_port_0_w) + AM_RANGE(0x06, 0x06) AM_DEVREAD(SOUND, "ay", ay8910_r) + AM_RANGE(0x06, 0x07) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w) ADDRESS_MAP_END static ADDRESS_MAP_START( ccasino_io_map, ADDRESS_SPACE_IO, 8 ) @@ -310,11 +300,11 @@ static ADDRESS_MAP_START( ccasino_io_map, ADDRESS_SPACE_IO, 8 ) AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0") AM_WRITE(ojankohs_portselect_w) AM_RANGE(0x01, 0x01) AM_READWRITE(ojankohs_keymatrix_r, ojankohs_rombank_w) AM_RANGE(0x02, 0x02) AM_READ_PORT("IN1") AM_WRITE(ccasino_coinctr_w) - AM_RANGE(0x03, 0x03) AM_READWRITE(ccasino_dipsw3_r, ojankohs_adpcm_reset_w) + AM_RANGE(0x03, 0x03) AM_READ(ccasino_dipsw3_r) AM_DEVWRITE(SOUND, "msm", ojankohs_adpcm_reset_w) AM_RANGE(0x04, 0x04) AM_READWRITE(ccasino_dipsw4_r, ojankohs_flipscreen_w) AM_RANGE(0x05, 0x05) AM_WRITE(ojankohs_msm5205_w) - AM_RANGE(0x06, 0x06) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w) - AM_RANGE(0x07, 0x07) AM_WRITE(ay8910_control_port_0_w) + AM_RANGE(0x06, 0x06) AM_DEVREAD(SOUND, "ay", ay8910_r) + AM_RANGE(0x06, 0x07) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w) AM_RANGE(0x08, 0x0f) AM_WRITE(ccasino_palette_w) // 16bit address access AM_RANGE(0x10, 0x10) AM_WRITE(SMH_NOP) AM_RANGE(0x11, 0x11) AM_WRITE(SMH_NOP) @@ -327,8 +317,8 @@ static ADDRESS_MAP_START( ojankoc_io_map, ADDRESS_SPACE_IO, 8 ) AM_RANGE(0xfb, 0xfb) AM_WRITE(ojankoc_ctrl_w) AM_RANGE(0xfc, 0xfd) AM_READ(ojankoc_keymatrix_r) AM_RANGE(0xfd, 0xfd) AM_WRITE(ojankohs_portselect_w) - AM_RANGE(0xfe, 0xfe) AM_WRITE(ay8910_write_port_0_w) - AM_RANGE(0xff, 0xff) AM_READWRITE(ay8910_read_port_0_r, ay8910_control_port_0_w) + AM_RANGE(0xfe, 0xff) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w) + AM_RANGE(0xff, 0xff) AM_DEVREAD(SOUND, "ay", ay8910_r) ADDRESS_MAP_END @@ -822,24 +812,24 @@ static const ay8910_interface ojankohs_ay8910_interface = { AY8910_LEGACY_OUTPUT, AY8910_DEFAULT_LOADS, - ojankohs_ay8910_0_r, /* read port #0 */ - ojankohs_ay8910_1_r /* read port #1 */ + DEVCB_HANDLER(ojankohs_ay8910_0_r), /* read port #0 */ + DEVCB_HANDLER(ojankohs_ay8910_1_r) /* read port #1 */ }; static const ay8910_interface ojankoy_ay8910_interface = { AY8910_LEGACY_OUTPUT, AY8910_DEFAULT_LOADS, - ojankoy_ay8910_0_r, /* read port #0 */ - ojankoy_ay8910_1_r, /* read port #1 */ + DEVCB_INPUT_PORT("DSW1"), /* read port #0 */ + DEVCB_INPUT_PORT("DSW2"), /* read port #1 */ }; static const ay8910_interface ojankoc_ay8910_interface = { AY8910_LEGACY_OUTPUT, AY8910_DEFAULT_LOADS, - input_port_0_r, /* read port #0 */ - input_port_1_r /* read port #1 */ + DEVCB_INPUT_PORT("DSW1"), /* read port #0 */ + DEVCB_INPUT_PORT("DSW2"), /* read port #1 */ }; static const msm5205_interface msm5205_config = |