summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/audio/starwars.cpp
blob: 2ade0c31c1868901bd6d64c1f6d2bad272696d8f (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// license:BSD-3-Clause
// copyright-holders:Frank Palazzolo
/***************************************************************************

    Atari Star Wars hardware

    This file is Copyright Steve Baines.
    Modified by Frank Palazzolo for sound support

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

#include "emu.h"
#include "includes/starwars.h"


/*************************************
 *
 *  RIOT interfaces
 *
 *************************************/

uint8_t starwars_state::r6532_porta_r()
{
	/* Configured as follows:           */
	/* d7 (in)  Main Ready Flag         */
	/* d6 (in)  Sound Ready Flag        */
	/* d5 (out) Mute Speech             */
	/* d4 (in)  Not Sound Self Test     */
	/* d3 (out) Hold Main CPU in Reset? */
	/*          + enable delay circuit? */
	/* d2 (in)  TMS5220 Not Ready       */
	/* d1 (out) TMS5220 Not Read        */
	/* d0 (out) TMS5220 Not Write       */
	/* Note: bit 4 is always set to avoid sound self test */
	uint8_t olddata = m_riot->porta_in_get();

	return (olddata & 0xc0) | 0x10 | (m_tms->readyq_r() << 2);
}


void starwars_state::r6532_porta_w(uint8_t data)
{
	/* handle 5220 read */
	m_tms->rsq_w((data & 2)>>1);
	/* handle 5220 write */
	m_tms->wsq_w((data & 1)>>0);
}


/*************************************
 *
 *  Sound CPU to/from main CPU
 *
 *************************************/

WRITE_LINE_MEMBER(starwars_state::boost_interleave_hack)
{
	if (state)
		machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(100));
}


uint8_t starwars_state::starwars_main_ready_flag_r()
{
	return m_riot->porta_in_get() & 0xc0;    /* only upper two flag bits mapped */
}


void starwars_state::starwars_soundrst_w(uint8_t data)
{
	m_soundlatch->acknowledge_w();
	m_mainlatch->acknowledge_w();

	/* reset sound CPU here  */
	m_audiocpu->pulse_input_line(INPUT_LINE_RESET, attotime::zero);
}