1 // license:BSD-3-Clause
2 // copyright-holders:Miodrag Milanovic
3 /*****************************************************************************
4  *
5  * includes/orion.h
6  *
7  ****************************************************************************/
8 
9 #ifndef MAME_INCLUDES_ORION_H
10 #define MAME_INCLUDES_ORION_H
11 
12 #pragma once
13 
14 #include "includes/radio86.h"
15 
16 #include "cpu/i8085/i8085.h"
17 #include "cpu/z80/z80.h"
18 
19 #include "imagedev/floppy.h"
20 
21 #include "machine/i8255.h"
22 #include "machine/mc146818.h"
23 #include "machine/ram.h"
24 #include "machine/wd_fdc.h"
25 
26 #include "sound/ay8910.h"
27 #include "sound/spkrdev.h"
28 
29 #include "emupal.h"
30 #include "screen.h"
31 
32 class orion_state : public radio86_state
33 {
34 public:
orion_state(const machine_config & mconfig,device_type type,const char * tag)35 	orion_state(const machine_config &mconfig, device_type type, const char *tag)
36 		: radio86_state(mconfig, type, tag)
37 		, m_fdc(*this, "fd1793")
38 		, m_ram(*this, RAM_TAG)
39 		, m_fd0(*this, "fd0")
40 		, m_fd1(*this, "fd1")
41 		, m_fd2(*this, "fd2")
42 		, m_fd3(*this, "fd3")
43 		, m_rtc(*this, "rtc")
44 		, m_speaker(*this, "speaker")
45 		, m_ay8912(*this, "ay8912")
46 		, m_bank2(*this, "bank2")
47 		, m_bank3(*this, "bank3")
48 		, m_bank4(*this, "bank4")
49 		, m_bank5(*this, "bank5")
50 		, m_bank6(*this, "bank6")
51 		, m_bank7(*this, "bank7")
52 		, m_bank8(*this, "bank8")
53 		, m_screen(*this, "screen")
54 	{ }
55 
56 	void orion128ms(machine_config &config);
57 	void orion128(machine_config &config);
58 
59 protected:
60 	uint8_t orion128_system_r(offs_t offset);
61 	void orion128_system_w(offs_t offset, uint8_t data);
62 	uint8_t orion128_romdisk_r(offs_t offset);
63 	void orion128_romdisk_w(offs_t offset, uint8_t data);
64 	void orion128_video_mode_w(uint8_t data);
65 	void orion128_video_page_w(uint8_t data);
66 	void orion128_memory_page_w(uint8_t data);
67 	void orion_disk_control_w(uint8_t data);
68 	uint8_t orion128_floppy_r(offs_t offset);
69 	void orion128_floppy_w(offs_t offset, uint8_t data);
70 	uint8_t orionz80_floppy_rtc_r(offs_t offset);
71 	void orionz80_floppy_rtc_w(offs_t offset, uint8_t data);
72 	void orionz80_sound_w(uint8_t data);
73 	void orionz80_sound_fe_w(uint8_t data);
74 	void orionz80_memory_page_w(uint8_t data);
75 	void orionz80_dispatcher_w(uint8_t data);
76 	uint8_t orionz80_io_r(offs_t offset);
77 	void orionz80_io_w(offs_t offset, uint8_t data);
78 	void orionpro_memory_page_w(uint8_t data);
79 	uint8_t orionpro_io_r(offs_t offset);
80 	void orionpro_io_w(offs_t offset, uint8_t data);
81 	DECLARE_MACHINE_START(orion128);
82 	void orion128_palette(palette_device &palette) const;
83 	uint32_t screen_update_orion128(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
84 	INTERRUPT_GEN_MEMBER(orionz80_interrupt);
85 	uint8_t orion_romdisk_porta_r();
86 	void orion_romdisk_portb_w(uint8_t data);
87 	void orion_romdisk_portc_w(uint8_t data);
88 	DECLARE_FLOPPY_FORMATS( orion_floppy_formats );
89 	void machine_start() override;
90 
91 	uint8_t m_orion128_video_mode;
92 	uint8_t m_orion128_video_page;
93 	uint8_t m_orion128_video_width;
94 	uint8_t m_video_mode_mask;
95 	uint8_t m_orionpro_pseudo_color;
96 	uint8_t m_romdisk_lsb;
97 	uint8_t m_romdisk_msb;
98 	uint8_t m_orion128_memory_page;
99 	uint8_t m_orionz80_memory_page;
100 	uint8_t m_orionz80_dispatcher;
101 	uint8_t m_speaker_data;
102 	uint8_t m_orionpro_ram0_segment;
103 	uint8_t m_orionpro_ram1_segment;
104 	uint8_t m_orionpro_ram2_segment;
105 	uint8_t m_orionpro_page;
106 	uint8_t m_orionpro_128_page;
107 	uint8_t m_orionpro_rom2_segment;
108 	uint8_t m_orionpro_dispatcher;
109 
110 	required_device<fd1793_device> m_fdc;
111 
112 	required_device<ram_device> m_ram;
113 	required_device<floppy_connector> m_fd0;
114 	required_device<floppy_connector> m_fd1;
115 	required_device<floppy_connector> m_fd2;
116 	required_device<floppy_connector> m_fd3;
117 	optional_device<mc146818_device> m_rtc;
118 	optional_device<speaker_sound_device> m_speaker;
119 	optional_device<ay8910_device> m_ay8912;
120 	required_memory_bank m_bank2;
121 	optional_memory_bank m_bank3;
122 	optional_memory_bank m_bank4;
123 	optional_memory_bank m_bank5;
124 	optional_memory_bank m_bank6;
125 	optional_memory_bank m_bank7;
126 	optional_memory_bank m_bank8;
127 	required_device<screen_device> m_screen;
128 
129 	void orionz80_switch_bank();
130 	void orion_set_video_mode(int width);
131 	void orionpro_bank_switch();
132 
133 private:
134 	void machine_reset() override;
135 	void io_map(address_map &map);
136 	void mem_map(address_map &map);
137 };
138 
139 class orion_z80_state : public orion_state
140 {
141 public:
orion_z80_state(const machine_config & mconfig,device_type type,const char * tag)142 	orion_z80_state(const machine_config &mconfig, device_type type, const char *tag)
143 		: orion_state(mconfig, type, tag)
144 	{ }
145 
146 	void orionz80(machine_config &config);
147 	void orionz80ms(machine_config &config);
148 
149 private:
150 	void machine_reset() override;
151 	void io_map(address_map &map);
152 	void mem_map(address_map &map);
153 };
154 
155 class orion_pro_state : public orion_state
156 {
157 public:
orion_pro_state(const machine_config & mconfig,device_type type,const char * tag)158 	orion_pro_state(const machine_config &mconfig, device_type type, const char *tag)
159 		: orion_state(mconfig, type, tag)
160 	{ }
161 
162 	void orionpro(machine_config &config);
163 
164 private:
165 	void machine_reset() override;
166 	void io_map(address_map &map);
167 	void mem_map(address_map &map);
168 };
169 
170 #endif // MAME_INCLUDES_ORION_H
171