1 // license:BSD-3-Clause 2 // copyright-holders:Aaron Giles 3 /*************************************************************************** 4 5 Victory system 6 7 ****************************************************************************/ 8 #ifndef MAME_INCLUDES_VICTORY_H 9 #define MAME_INCLUDES_VICTORY_H 10 11 #pragma once 12 13 #include "emupal.h" 14 #include "screen.h" 15 16 17 #define VICTORY_MAIN_CPU_CLOCK (XTAL(8'000'000) / 2) 18 19 #define VICTORY_PIXEL_CLOCK (XTAL(11'289'000) / 2) 20 #define VICTORY_HTOTAL (0x150) 21 #define VICTORY_HBEND (0x000) 22 #define VICTORY_HBSTART (0x100) 23 #define VICTORY_VTOTAL (0x118) 24 #define VICTORY_VBEND (0x000) 25 #define VICTORY_VBSTART (0x100) 26 27 28 class victory_state : public driver_device 29 { 30 public: victory_state(const machine_config & mconfig,device_type type,const char * tag)31 victory_state(const machine_config &mconfig, device_type type, const char *tag) : 32 driver_device(mconfig, type, tag), 33 m_maincpu(*this, "maincpu"), 34 m_screen(*this, "screen"), 35 m_palette(*this, "palette"), 36 m_videoram(*this, "videoram"), 37 m_charram(*this, "charram"), 38 m_lamps(*this, "lamp%u", 0U) 39 { } 40 41 void victory(machine_config &config); 42 43 private: 44 void lamp_control_w(uint8_t data); 45 void paletteram_w(offs_t offset, uint8_t data); 46 uint8_t video_control_r(offs_t offset); 47 void video_control_w(offs_t offset, uint8_t data); 48 49 uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 50 51 INTERRUPT_GEN_MEMBER(vblank_interrupt); 52 TIMER_CALLBACK_MEMBER(bgcoll_irq_callback); 53 54 void update_irq(); 55 void set_palette(); 56 int command2(); 57 int command3(); 58 int command4(); 59 int command5(); 60 int command6(); 61 int command7(); 62 void update_background(); 63 void update_foreground(); 64 machine_start()65 virtual void machine_start() override { m_lamps.resolve(); } 66 virtual void video_start() override; 67 void main_io_map(address_map &map); 68 void main_map(address_map &map); 69 70 /* microcode state */ 71 struct micro_t 72 { 73 uint16_t i; 74 uint16_t pc; 75 uint8_t r,g,b; 76 uint8_t xp,yp; 77 uint8_t cmd,cmdlo; 78 emu_timer * timer; 79 uint8_t timer_active; 80 attotime endtime; 81 82 void count_states(int states); 83 }; 84 85 required_device<cpu_device> m_maincpu; 86 required_device<screen_device> m_screen; 87 required_device<palette_device> m_palette; 88 89 required_shared_ptr<uint8_t> m_videoram; 90 required_shared_ptr<uint8_t> m_charram; 91 output_finder<4> m_lamps; 92 93 uint16_t m_paletteram[0x40]; 94 std::unique_ptr<uint8_t[]> m_bgbitmap; 95 std::unique_ptr<uint8_t[]> m_fgbitmap; 96 std::unique_ptr<uint8_t[]> m_rram; 97 std::unique_ptr<uint8_t[]> m_gram; 98 std::unique_ptr<uint8_t[]> m_bram; 99 uint8_t m_vblank_irq; 100 uint8_t m_fgcoll; 101 uint8_t m_fgcollx; 102 uint8_t m_fgcolly; 103 uint8_t m_bgcoll; 104 uint8_t m_bgcollx; 105 uint8_t m_bgcolly; 106 uint8_t m_scrollx; 107 uint8_t m_scrolly; 108 uint8_t m_video_control; 109 micro_t m_micro; 110 emu_timer *m_bgcoll_irq_timer; 111 }; 112 113 #endif // MAME_INCLUDES_VICTORY_H 114