1 // license:BSD-3-Clause
2 // copyright-holders:Nathan Woods
3 /***************************************************************************
4 
5     coco12.h
6 
7     TRS-80 Radio Shack Color Computer 1/2 Family
8 
9 ***************************************************************************/
10 
11 #pragma once
12 
13 #ifndef MAME_INCLUDES_COCO12_H
14 #define MAME_INCLUDES_COCO12_H
15 
16 
17 #include "includes/coco.h"
18 #include "machine/6883sam.h"
19 #include "video/mc6847.h"
20 
21 
22 
23 //**************************************************************************
24 //  MACROS / CONSTANTS
25 //**************************************************************************
26 
27 #define SAM_TAG         "sam"
28 #define VDG_TAG         "vdg"
29 
30 
31 
32 //**************************************************************************
33 //  TYPE DEFINITIONS
34 //**************************************************************************
35 
36 class coco12_state : public coco_state
37 {
38 public:
coco12_state(const machine_config & mconfig,device_type type,const char * tag)39 	coco12_state(const machine_config &mconfig, device_type type, const char *tag)
40 		: coco_state(mconfig, type, tag)
41 		, m_sam(*this, SAM_TAG)
42 		, m_vdg(*this, VDG_TAG)
43 	{
44 	}
45 
46 	uint8_t sam_read(offs_t offset);
47 
48 	DECLARE_WRITE_LINE_MEMBER( horizontal_sync );
49 	DECLARE_WRITE_LINE_MEMBER( field_sync );
50 
51 	void coco2bh(machine_config &config);
52 	void coco2h(machine_config &config);
53 	void cocoeh(machine_config &config);
54 	void cocoh(machine_config &config);
55 	void coco2b(machine_config &config);
56 	void cd6809(machine_config &config);
57 	void coco2(machine_config &config);
58 	void t4426(machine_config &config);
59 	void cp400(machine_config &config);
60 	void cocoe(machine_config &config);
61 	void coco(machine_config &config);
62 protected:
63 	virtual void device_start() override;
64 
65 	// PIA1
66 	virtual void pia1_pb_changed(uint8_t data) override;
67 
sam()68 	sam6883_device &sam() { return *m_sam; }
69 	required_device<sam6883_device> m_sam;
70 
71 	void coco_mem(address_map &map);
72 	void coco_ram(address_map &map);
73 	void coco_rom0(address_map &map);
74 	void coco_rom1(address_map &map);
75 	void coco_rom2(address_map &map);
76 	void coco_io0(address_map &map);
77 	void coco_io1(address_map &map);
78 	void coco_io2(address_map &map);
79 	void coco_ff60(address_map &map);
80 
81 private:
82 	void configure_sam(void);
83 
84 protected:
85 	required_device<mc6847_base_device> m_vdg;
86 };
87 
88 #endif // MAME_INCLUDES_COCO12_H
89