1 // license:BSD-3-Clause
2 // copyright-holders:Curt Coder
3 
4 #ifndef MAME_INCLUDES_C80_H
5 #define MAME_INCLUDES_C80_H
6 
7 #include "cpu/z80/z80.h"
8 #include "machine/z80daisy.h"
9 #include "machine/z80pio.h"
10 #include "imagedev/cassette.h"
11 #include "machine/ram.h"
12 
13 #define SCREEN_TAG      "screen"
14 #define Z80_TAG         "d2"
15 #define Z80PIO1_TAG     "d11"
16 #define Z80PIO2_TAG     "d12"
17 
18 class c80_state : public driver_device
19 {
20 public:
c80_state(const machine_config & mconfig,device_type type,const char * tag)21 	c80_state(const machine_config &mconfig, device_type type, const char *tag)
22 		: driver_device(mconfig, type, tag)
23 		, m_maincpu(*this, Z80_TAG)
24 		, m_pio1(*this, Z80PIO1_TAG)
25 		, m_cassette(*this, "cassette")
26 		, m_row0(*this, "ROW0")
27 		, m_row1(*this, "ROW1")
28 		, m_row2(*this, "ROW2")
29 		, m_digits(*this, "digit%u", 0U)
30 	{ }
31 
32 	required_device<z80_device> m_maincpu;
33 	required_device<z80pio_device> m_pio1;
34 	required_device<cassette_image_device> m_cassette;
35 	required_ioport m_row0;
36 	required_ioport m_row1;
37 	required_ioport m_row2;
38 	output_finder<9> m_digits;
39 
40 	virtual void machine_start() override;
41 
42 	uint8_t pio1_pa_r();
43 	void pio1_pa_w(uint8_t data);
44 	void pio1_pb_w(uint8_t data);
45 	DECLARE_WRITE_LINE_MEMBER( pio1_brdy_w );
46 	DECLARE_INPUT_CHANGED_MEMBER( trigger_reset );
47 	DECLARE_INPUT_CHANGED_MEMBER( trigger_nmi );
48 
49 	/* keyboard state */
50 	int m_keylatch;
51 
52 	/* display state */
53 	int m_digit;
54 	int m_pio1_a5;
55 	int m_pio1_brdy;
56 	void c80(machine_config &config);
57 	void c80_io(address_map &map);
58 	void c80_mem(address_map &map);
59 };
60 
61 #endif
62