summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/includes/bzone.h
blob: b305818ef3af7f75408a7b14b7385b3b20649795 (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
// license:BSD-3-Clause
// copyright-holders:Brad Oliver, Nicola Salmoria
/*************************************************************************

    Atari Battle Zone hardware

*************************************************************************/
#ifndef MAME_INCLUDES_BZONE_H
#define MAME_INCLUDES_BZONE_H

#pragma once

#include "audio/redbaron.h"
#include "machine/mathbox.h"
#include "sound/discrete.h"

#define BZONE_MASTER_CLOCK (XTAL(12'096'000))
#define BZONE_CLOCK_3KHZ   (BZONE_MASTER_CLOCK / 4096)

class bzone_state : public driver_device
{
public:
	bzone_state(const machine_config &mconfig, device_type type, const char *tag) :
		driver_device(mconfig, type, tag),
		m_maincpu(*this, "maincpu"),
		m_mathbox(*this, "mathbox"),
		m_discrete(*this, "discrete"),
		m_startled(*this, "startled")
	{ }

	DECLARE_CUSTOM_INPUT_MEMBER(clock_r);
	void init_bradley();
	void bzone(machine_config &config);

protected:
	DECLARE_WRITE8_MEMBER(bzone_coin_counter_w);
	DECLARE_READ8_MEMBER(analog_data_r);
	DECLARE_WRITE8_MEMBER(analog_select_w);
	virtual void machine_start() override;
	INTERRUPT_GEN_MEMBER(bzone_interrupt);
	DECLARE_WRITE8_MEMBER(bzone_sounds_w);

	void bzone_base(machine_config &config);
	void bzone_audio(machine_config &config);
	void bzone_map(address_map &map);

private:
	required_device<cpu_device> m_maincpu;
	required_device<mathbox_device> m_mathbox;
	optional_device<discrete_device> m_discrete;
	output_finder<> m_startled;

	uint8_t m_analog_data;
};


class redbaron_state : public bzone_state
{
public:
	redbaron_state(const machine_config &mconfig, device_type type, const char *tag) :
		bzone_state(mconfig, type, tag),
		m_redbaronsound(*this, "custom"),
		m_fake_ports(*this, "FAKE%u", 1U)
	{ }

	void redbaron(machine_config &config);

protected:
	DECLARE_READ8_MEMBER(redbaron_joy_r);
	DECLARE_WRITE8_MEMBER(redbaron_joysound_w);

	virtual void machine_start() override;

	void redbaron_map(address_map &map);

private:
	required_device<redbaron_sound_device> m_redbaronsound;
	required_ioport_array<2> m_fake_ports;
	uint8_t m_rb_input_select;
};

#endif // MAME_INCLUDES_BZONE_H
='#n578'>578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744