1 // license:BSD-3-Clause 2 // copyright-holders:Tomasz Slanina,Pierpaolo Prazzoli 3 4 #include "cpu/mcs51/mcs51.h" 5 #include "machine/timer.h" 6 #include "sound/qs1000.h" 7 #include "emupal.h" 8 #include "screen.h" 9 10 class eolith_state : public driver_device 11 { 12 public: eolith_state(const machine_config & mconfig,device_type type,const char * tag)13 eolith_state(const machine_config &mconfig, device_type type, const char *tag) 14 : driver_device(mconfig, type, tag) 15 , m_maincpu(*this, "maincpu") 16 , m_screen(*this, "screen") 17 , m_palette(*this, "palette") 18 , m_qs1000(*this, "qs1000") 19 , m_eepromoutport(*this, "EEPROMOUT") 20 , m_soundcpu(*this, "soundcpu") 21 , m_in0(*this, "IN0") 22 , m_penxport(*this, "PEN_X_P%u", 1) 23 , m_penyport(*this, "PEN_Y_P%u", 1) 24 , m_led(*this, "led0") 25 , m_sndbank(*this, "sound_bank") 26 { 27 } 28 29 void ironfort(machine_config &config); 30 void eolith50(machine_config &config); 31 void eolith45(machine_config &config); 32 void hidctch3(machine_config &config); 33 34 void init_eolith(); 35 void init_landbrk(); 36 void init_hidctch2(); 37 void init_hidnc2k(); 38 void init_landbrka(); 39 void init_landbrkb(); 40 41 DECLARE_READ_LINE_MEMBER(speedup_vblank_r); 42 DECLARE_READ_LINE_MEMBER(stealsee_speedup_vblank_r); 43 44 void speedup_read(); 45 void init_speedup(); 46 47 protected: 48 49 required_device<cpu_device> m_maincpu; 50 required_device<screen_device> m_screen; 51 required_device<palette_device> m_palette; 52 optional_device<qs1000_device> m_qs1000; 53 optional_ioport m_eepromoutport; 54 TIMER_DEVICE_CALLBACK_MEMBER(eolith_speedup); 55 56 private: 57 58 uint32_t eolith_custom_r(); 59 void systemcontrol_w(uint32_t data); 60 template<int Player> uint32_t hidctch3_pen_r(); 61 void eolith_vram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 62 uint16_t eolith_vram_r(offs_t offset); 63 void sound_p1_w(uint8_t data); 64 uint8_t qs1000_p1_r(); 65 void qs1000_p1_w(uint8_t data); 66 void soundcpu_to_qs1000(uint8_t data); 67 68 DECLARE_MACHINE_RESET(eolith); 69 DECLARE_VIDEO_START(eolith); 70 71 72 uint32_t screen_update_eolith(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 73 74 void eolith_map(address_map &map); 75 void hidctch3_map(address_map &map); 76 void sound_io_map(address_map &map); 77 void sound_prg_map(address_map &map); 78 79 virtual void machine_start() override; 80 // shared with eolith16.cpp, vegaeo.cpp 81 82 void patch_mcu_protection(uint32_t address); 83 84 optional_device<i8032_device> m_soundcpu; 85 86 optional_ioport m_in0; // klondkp doesn't have it 87 optional_ioport_array<2> m_penxport; 88 optional_ioport_array<2> m_penyport; 89 output_finder<> m_led; 90 91 optional_memory_bank m_sndbank; 92 93 int m_coin_counter_bit; 94 std::unique_ptr<uint16_t[]> m_vram; 95 int m_buffer; 96 97 // speedups - see machine/eolithsp.c 98 int m_speedup_address; 99 int m_speedup_address2; 100 int m_speedup_resume_scanline; 101 int m_speedup_vblank; 102 int m_speedup_scanline; 103 }; 104