1 // license:BSD-3-Clause
2 // copyright-holders:Robbbert
3 #ifndef MAME_INCLUDES_AUSSIEBYTE_H
4 #define MAME_INCLUDES_AUSSIEBYTE_H
5 
6 #pragma once
7 
8 /***********************************************************
9 
10     Includes
11 
12 ************************************************************/
13 #include "bus/centronics/ctronics.h"
14 #include "bus/rs232/rs232.h"
15 
16 #include "cpu/z80/z80.h"
17 #include "machine/z80daisy.h"
18 
19 #include "imagedev/floppy.h"
20 #include "machine/msm5832.h"
21 #include "machine/wd_fdc.h"
22 #include "machine/z80ctc.h"
23 #include "machine/z80sio.h"
24 #include "machine/z80dma.h"
25 #include "machine/z80pio.h"
26 
27 #include "sound/spkrdev.h"
28 #include "sound/votrax.h"
29 
30 #include "video/mc6845.h"
31 
32 #include "imagedev/snapquik.h"
33 
34 #include "emupal.h"
35 
36 
37 
38 /***********************************************************
39 
40     Class
41 
42 ************************************************************/
43 class aussiebyte_state : public driver_device
44 {
45 public:
aussiebyte_state(const machine_config & mconfig,device_type type,const char * tag)46 	aussiebyte_state(const machine_config &mconfig, device_type type, const char *tag)
47 		: driver_device(mconfig, type, tag)
48 		, m_palette(*this, "palette")
49 		, m_maincpu(*this, "maincpu")
50 		, m_p_chargen(*this, "chargen")
51 		, m_ctc(*this, "ctc")
52 		, m_dma(*this, "dma")
53 		, m_pio1(*this, "pio1")
54 		, m_pio2(*this, "pio2")
55 		, m_centronics(*this, "centronics")
56 		, m_rs232(*this, "rs232")
57 		, m_fdc(*this, "fdc")
58 		, m_floppy0(*this, "fdc:0")
59 		, m_floppy1(*this, "fdc:1")
60 		, m_crtc(*this, "crtc")
61 		, m_speaker(*this, "speaker")
62 		, m_votrax(*this, "votrax")
63 		, m_rtc(*this, "rtc")
64 	{ }
65 
66 	void aussiebyte(machine_config &config);
67 
68 	DECLARE_QUICKLOAD_LOAD_MEMBER(quickload_cb);
69 
70 private:
71 	u8 memory_read_byte(offs_t offset);
72 	void memory_write_byte(offs_t offset, u8 data);
73 	u8 io_read_byte(offs_t offset);
74 	void io_write_byte(offs_t offset, u8 data);
75 	void port15_w(u8 data);
76 	void port16_w(u8 data);
77 	void port17_w(u8 data);
78 	void port18_w(u8 data);
79 	u8 port19_r();
80 	void port1a_w(u8 data);
81 	void port1b_w(u8 data);
82 	void port1c_w(u8 data);
83 	void port20_w(u8 data);
84 	u8 port28_r();
85 	u8 port33_r();
86 	void port34_w(u8 data);
87 	void port35_w(u8 data);
88 	u8 port36_r();
89 	u8 port37_r();
90 	u8 rtc_r(offs_t offset);
91 	void rtc_w(offs_t offset, u8 data);
92 	DECLARE_WRITE_LINE_MEMBER(fdc_intrq_w);
93 	DECLARE_WRITE_LINE_MEMBER(fdc_drq_w);
94 	DECLARE_WRITE_LINE_MEMBER(busreq_w);
95 	DECLARE_WRITE_LINE_MEMBER(sio1_rdya_w);
96 	DECLARE_WRITE_LINE_MEMBER(sio1_rdyb_w);
97 	DECLARE_WRITE_LINE_MEMBER(sio2_rdya_w);
98 	DECLARE_WRITE_LINE_MEMBER(sio2_rdyb_w);
99 	void address_w(u8 data);
100 	void register_w(u8 data);
101 	MC6845_UPDATE_ROW(crtc_update_row);
102 	MC6845_ON_UPDATE_ADDR_CHANGED(crtc_update_addr);
103 
104 	virtual void machine_start() override;
105 	virtual void machine_reset() override;
106 	void io_map(address_map &map);
107 	void mem_map(address_map &map);
108 
109 	u8 crt8002(u8 ac_ra, u8 ac_chr, u8 ac_attr, u16 ac_cnt, bool ac_curs);
110 	bool m_port15; // rom switched in (0), out (1)
111 	u8 m_port17;
112 	u8 m_port17_rdy;
113 	u8 m_port19;
114 	u8 m_port1a; // bank to switch to when write to port 15 happens
115 	u8 m_port28;
116 	u8 m_port34;
117 	u8 m_port35; // byte to be written to vram or aram
118 	u8 m_video_index;
119 	u16 m_cnt;
120 	u16 m_alpha_address;
121 	u16 m_graph_address;
122 	bool m_centronics_busy;
123 	std::unique_ptr<u8[]> m_vram; // video ram, 64k dynamic
124 	std::unique_ptr<u8[]> m_aram; // attribute ram, 2k static
125 	std::unique_ptr<u8[]> m_ram;  // main ram, 256k dynamic
126 	required_device<palette_device> m_palette;
127 	required_device<z80_device> m_maincpu;
128 	required_region_ptr<u8> m_p_chargen;
129 	required_device<z80ctc_device> m_ctc;
130 	required_device<z80dma_device> m_dma;
131 	required_device<z80pio_device> m_pio1;
132 	required_device<z80pio_device> m_pio2;
133 	required_device<centronics_device> m_centronics;
134 	required_device<rs232_port_device> m_rs232;
135 	required_device<wd2797_device> m_fdc;
136 	required_device<floppy_connector> m_floppy0;
137 	optional_device<floppy_connector> m_floppy1;
138 	required_device<mc6845_device> m_crtc;
139 	required_device<speaker_sound_device> m_speaker;
140 	required_device<votrax_sc01_device> m_votrax;
141 	required_device<msm5832_device> m_rtc;
142 };
143 
144 #endif // MAME_INCLUDES_AUSSIEBYTE_H
145