summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/machine/mcr68.cpp
blob: ae00aa8ab902659c59f3cd707538832b1cf081ea (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
77
78
79
80
81
82
83
84
85
// license:BSD-3-Clause
// copyright-holders:Aaron Giles, Bryan McPhail
/***************************************************************************

    Midway MCR-68k system

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

#include "emu.h"
#include "audio/midway.h"
#include "includes/mcr68.h"

#define VERBOSE 0



/*************************************
 *
 *  Generic MCR/68k machine initialization
 *
 *************************************/

MACHINE_START_MEMBER(mcr68_state,mcr68)
{
}


MACHINE_RESET_MEMBER(mcr68_state,mcr68)
{
	/* for the most part all MCR/68k games are the same */
	m_v493_callback = timer_expired_delegate(FUNC(mcr68_state::mcr68_493_callback),this);
}



/*************************************
 *
 *  Scanline callback
 *
 *************************************/

TIMER_DEVICE_CALLBACK_MEMBER( mcr68_state::scanline_cb )
{
	// VSYNC
	if (param == 0)
	{
		if (VERBOSE)
			logerror("--- VBLANK ---\n");

		m_ptm->set_c1(0);
		m_ptm->set_c1(1);

		/* also set a timer to generate the 493 signal at a specific time before the next VBLANK */
		/* the timing of this is crucial for Blasted and Tri-Sports, which check the timing of */
		/* VBLANK and 493 using counter 2 */
		machine().scheduler().timer_set(attotime::from_hz(30) - m_timing_factor, m_v493_callback);
	}

	// HSYNC
	m_ptm->set_c3(0);
	m_ptm->set_c3(1);
}



/*************************************
 *
 *  MCR/68k interrupt central
 *
 *************************************/

TIMER_CALLBACK_MEMBER(mcr68_state::mcr68_493_off_callback)
{
	m_maincpu->set_input_line(1, CLEAR_LINE);
}


TIMER_CALLBACK_MEMBER(mcr68_state::mcr68_493_callback)
{
	m_maincpu->set_input_line(1, ASSERT_LINE);
	machine().scheduler().timer_set(m_screen->scan_period(), timer_expired_delegate(FUNC(mcr68_state::mcr68_493_off_callback),this));

	if (VERBOSE)
		logerror("--- (INT1) ---\n");
}