1 // license:BSD-3-Clause 2 // copyright-holders:JJ Stacino 3 ///////////////////////////////////////////////////////////////////// 4 ////// HECTOR HEADER FILE ///////////////////////////////////////// 5 ///////////////////////////////////////////////////////////////////// 6 7 #ifndef MAME_INCLUDES_HEC2HRP_H 8 #define MAME_INCLUDES_HEC2HRP_H 9 10 #pragma once 11 12 #include "imagedev/floppy.h" 13 #include "imagedev/cassette.h" 14 #include "imagedev/printer.h" 15 #include "machine/upd765.h" 16 #include "machine/wd_fdc.h" 17 #include "machine/ram.h" 18 #include "sound/discrete.h" /* for 1 Bit sound*/ 19 #include "sound/sn76477.h" /* for sn sound*/ 20 #include "emupal.h" 21 22 /* Enum status for high memory bank (c000 - ffff)*/ 23 enum 24 { 25 HECTOR_BANK_PROG = 0, /* first BANK is program ram*/ 26 HECTOR_BANK_VIDEO /* second BANK is Video ram */ 27 }; 28 /* Status for rom memory bank (0000 - 3fff) in MX machine*/ 29 enum 30 { 31 HECTORMX_BANK_PAGE0 = 0, /* first BANK is base rom*/ 32 HECTORMX_BANK_PAGE1, /* second BANK is basic rom */ 33 HECTORMX_BANK_PAGE2 /* 3 BANK is monitrix / assemblex rom */ 34 }; 35 /* Status for rom memory bank (0000 - 3fff) in Mini Disc machine*/ 36 enum 37 { 38 HECTOR_BANK_BASE = 0, /* first BANK is normal rom*/ 39 HECTOR_BANK_DISC /* second BANK is extra rom for mini disc use*/ 40 }; 41 /* Enum status for low memory bank (00000 - 0fff) for DISC II*/ 42 enum 43 { 44 DISCII_BANK_RAM = 0, /* first BANK is program ram*/ 45 DISCII_BANK_ROM /* second BANK is ROM */ 46 }; 47 48 class hec2hrp_state : public driver_device 49 { 50 public: hec2hrp_state(const machine_config & mconfig,device_type type,const char * tag)51 hec2hrp_state(const machine_config &mconfig, device_type type, const char *tag) 52 : driver_device(mconfig, type, tag) 53 , m_maincpu(*this, "maincpu") 54 , m_cassette(*this, "cassette") 55 , m_printer(*this, "printer") 56 , m_palette(*this, "palette") 57 , m_vram(*this,"videoram") 58 , m_bank(*this, "bank%u", 0U) 59 , m_rom(*this, "maincpu") 60 , m_ram(*this, RAM_TAG) 61 , m_hector_vram(*this,"hector_videoram") 62 , m_disc2cpu(*this, "disc2cpu") 63 , m_discrete(*this, "discrete") 64 , m_sn(*this, "sn76477") 65 , m_keyboard(*this, "KEY.%u", 0) 66 , m_minidisc_fdc(*this, "wd179x") 67 , m_floppy0(*this, "wd179x:0") 68 , m_upd_fdc(*this, "upd765") 69 , m_upd_connector(*this, "upd765:%u", 0U) 70 {} 71 72 void hec2mx80(machine_config &config); 73 void hec2hrp(machine_config &config); 74 void hec2hrx(machine_config &config); 75 void hec2mx40(machine_config &config); 76 void hec2mdhrx(machine_config &config); 77 void hec2hr(machine_config &config); 78 void hector_audio(machine_config &config); 79 80 void init_mx40(); 81 void init_mdhrx(); 82 void init_victor(); 83 void init_hrx(); 84 void init_interact(); 85 void hector1(machine_config &config); 86 void interact(machine_config &config); 87 void interact_common(machine_config &config); 88 89 private: 90 void hector_hr(bitmap_ind16 &bitmap, uint8_t *page, int ymax, int yram); 91 void hector_reset(bool hr, bool with_d2); 92 void video_start() override; 93 void keyboard_w(uint8_t data); 94 uint8_t keyboard_r(offs_t offset); 95 void sn_2000_w(offs_t offset, uint8_t data); 96 void sn_2800_w(offs_t offset, uint8_t data); 97 uint8_t cassette_r(); 98 void sn_3000_w(uint8_t data); 99 void color_a_w(uint8_t data); 100 void color_b_w(uint8_t data); 101 bool m_has_disc2; 102 bool m_has_minidisc; 103 bool m_is_hr; 104 bool m_is_extended; 105 void init_palette(palette_device &); 106 void hector_init(); 107 void minidisc_control_w(uint8_t data); 108 void switch_bank_w(offs_t offset, uint8_t data); 109 uint8_t io_8255_r(offs_t offset); 110 void io_8255_w(offs_t offset, uint8_t data); 111 void mx40_io_port_w(offs_t offset, uint8_t data); 112 void mx80_io_port_w(offs_t offset, uint8_t data); 113 114 // disc2 handling 115 uint8_t disc2_io00_port_r(); 116 void disc2_io00_port_w(uint8_t data); 117 uint8_t disc2_io20_port_r(); 118 void disc2_io20_port_w(uint8_t data); 119 uint8_t disc2_io30_port_r(); 120 void disc2_io30_port_w(uint8_t data); 121 uint8_t disc2_io40_port_r(); 122 void disc2_io40_port_w(uint8_t data); 123 uint8_t disc2_io50_port_r(); 124 void disc2_io50_port_w(uint8_t data); 125 126 DECLARE_FLOPPY_FORMATS(minidisc_formats); 127 128 bool m_hector_flag_hr; 129 bool m_hector_flag_80c; 130 uint8_t m_hector_color[4]; 131 uint8_t m_hector_disc2_data_r_ready; 132 uint8_t m_hector_disc2_data_w_ready; 133 uint8_t m_hector_disc2_data_read; 134 uint8_t m_hector_disc2_data_write; 135 bool m_hector_disc2_rnmi; 136 uint8_t m_state3000; 137 bool m_write_cassette; 138 emu_timer *m_cassette_timer; 139 uint8_t m_ck_signal; 140 bool m_flag_clk; 141 double m_pin_value[29][2]; 142 u8 m_au[17]; 143 u8 m_val_mixer; 144 u8 m_oldstate3000; 145 u8 m_oldstate1000; 146 uint8_t m_pot0; 147 uint8_t m_pot1; 148 uint8_t m_actions; 149 uint8_t m_hector_port_a; 150 uint8_t m_hector_port_b; 151 uint8_t m_hector_port_c_h; 152 uint8_t m_hector_port_c_l; 153 uint8_t m_hector_port_cmd; 154 bool m_cassette_bit; 155 bool m_cassette_bit_mem; 156 uint8_t m_data_k7; 157 int m_counter_write; 158 bool m_irq_current_state; 159 bool m_nmi_current_state; 160 uint8_t m_hector_videoram_hrx[0x4000]; 161 162 DECLARE_MACHINE_RESET(interact); 163 DECLARE_MACHINE_START(hec2hrp); 164 DECLARE_MACHINE_RESET(hec2hrp); 165 DECLARE_MACHINE_START(hec2hrx); 166 DECLARE_MACHINE_RESET(hec2hrx); 167 DECLARE_MACHINE_START(hec2mdhrx); 168 DECLARE_MACHINE_RESET(hec2mdhrx); 169 uint32_t screen_update_hec2hrp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 170 TIMER_CALLBACK_MEMBER(cassette_clock); 171 172 DECLARE_WRITE_LINE_MEMBER( disc2_fdc_interrupt ); 173 DECLARE_WRITE_LINE_MEMBER( disc2_fdc_dma_irq ); 174 175 void update_state(int Adresse, int Value ); 176 void init_sn76477(); 177 void update_sound(uint8_t data); 178 void hector_80c(bitmap_ind16 &bitmap, uint8_t *page, int ymax, int yram); 179 void hector_disc2_reset(); 180 uint32_t screen_update_interact(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 181 void interact_mem(address_map &map); 182 183 void hec2hrp_io(address_map &map); 184 void hec2hrp_mem(address_map &map); 185 void hec2hrx_io(address_map &map); 186 void hec2hrx_mem(address_map &map); 187 void hec2mdhrx_io(address_map &map); 188 void hec2mx40_io(address_map &map); 189 void hec2mx80_io(address_map &map); 190 void hecdisc2_io(address_map &map); 191 void hecdisc2_mem(address_map &map); 192 193 required_device<cpu_device> m_maincpu; 194 required_device<cassette_image_device> m_cassette; 195 optional_device<printer_image_device> m_printer; 196 required_device<palette_device> m_palette; 197 optional_shared_ptr<uint8_t> m_vram; 198 optional_memory_bank_array<4> m_bank; 199 required_region_ptr<u8> m_rom; 200 optional_device<ram_device> m_ram; 201 optional_shared_ptr<uint8_t> m_hector_vram; 202 optional_device<cpu_device> m_disc2cpu; 203 required_device<discrete_device> m_discrete; 204 required_device<sn76477_device> m_sn; 205 required_ioport_array<9> m_keyboard; 206 optional_device<fd1793_device> m_minidisc_fdc; 207 optional_device<floppy_connector> m_floppy0; 208 optional_device<upd765a_device> m_upd_fdc; 209 optional_device_array<floppy_connector, 2> m_upd_connector; 210 }; 211 212 #endif // MAME_INCLUDES_HEC2HRP_H 213