summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/machine/gaplus.cpp
blob: 377ea6f623342cecffe7cdbfbce258d6870f0caf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// license:BSD-3-Clause
// copyright-holders:Manuel Abadia, Ernesto Corvi, Nicola Salmoria
/***************************************************************************

  gaplus.c

  Functions to emulate general aspects of the machine (RAM, ROM, interrupts,
  I/O ports)

***************************************************************************/

#include "emu.h"
#include "sound/samples.h"
#include "includes/gaplus.h"


/************************************************************************************
*                                                                                   *
*           Gaplus custom I/O chips (preliminary)                                   *
*                                                                                   *
************************************************************************************/

WRITE8_MEMBER(gaplus_state::customio_3_w)
{
	if ((offset == 0x09) && (data >= 0x0f))
		m_samples->start(0,0);

	m_customio_3[offset] = data;
}


READ8_MEMBER(gaplus_state::customio_3_r)
{
	int mode = m_customio_3[8];

	switch (offset)
	{
		case 0:
			return ioport("IN2")->read();       /* cabinet & test mode */
		case 1:
			return (mode == 2) ? m_customio_3[offset] : 0x0f;
		case 2:
			return (mode == 2) ? 0x0f : 0x0e;
		case 3:
			return (mode == 2) ? m_customio_3[offset] : 0x01;
		default:
			return m_customio_3[offset];
	}
}