From 9763b2928a9a294a1bb2b4cb0af1e7626b64ef22 Mon Sep 17 00:00:00 2001 From: Dirk Best Date: Sun, 5 Mar 2017 18:06:18 +0100 Subject: [PATCH] ay8910: Add a write handler for the case of bc1=a0 and bc2=a1 --- src/devices/sound/ay8910.cpp | 18 ++++++++++++++++++ src/devices/sound/ay8910.h | 7 +++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/devices/sound/ay8910.cpp b/src/devices/sound/ay8910.cpp index a3979b70bf6..4da686b0cb4 100644 --- a/src/devices/sound/ay8910.cpp +++ b/src/devices/sound/ay8910.cpp @@ -1119,6 +1119,24 @@ WRITE8_MEMBER( ay8910_device::data_w ) #endif } +WRITE8_MEMBER( ay8910_device::write ) +{ + switch (offset & 3) + { + case 0: // latch address + address_w(space, 0, data); + break; + case 1: // inactive + break; + case 2: // write to psg + data_w(space, 0, data); + break; + case 3: // latch address + address_w(space, 0, data); + break; + } +} + WRITE8_MEMBER( ay8910_device::reset_w ) { ay8910_reset_ym(); diff --git a/src/devices/sound/ay8910.h b/src/devices/sound/ay8910.h index a46bef62ffc..bc970338385 100644 --- a/src/devices/sound/ay8910.h +++ b/src/devices/sound/ay8910.h @@ -1,4 +1,4 @@ -// license:BSD-3-Clause + // license:BSD-3-Clause // copyright-holders:Couriersud #pragma once @@ -126,6 +126,9 @@ public: /* use this when BC1 == !A0; here, BC1=0 selects 'latch address' and BC1=1 selects 'data' */ DECLARE_WRITE8_MEMBER( address_data_w ); + // bc1=a0, bc2=a1 + virtual DECLARE_WRITE8_MEMBER(write); + void set_volume(int channel,int volume); void ay_set_clock(int clock); @@ -227,7 +230,7 @@ public: /* AY8914 handlers needed due to different register map */ DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); + virtual DECLARE_WRITE8_MEMBER( write ) override; }; extern const device_type AY8914;