1 // license:BSD-3-Clause 2 // copyright-holders:Mirko Buffoni 3 #ifndef MAME_INCLUDES_TUTANKHM_H 4 #define MAME_INCLUDES_TUTANKHM_H 5 6 #pragma once 7 8 #include "audio/timeplt.h" 9 #include "emupal.h" 10 #include "machine/timer.h" 11 #include "screen.h" 12 13 static constexpr int GALAXIAN_XSCALE = 3; 14 static constexpr XTAL GALAXIAN_MASTER_CLOCK(18.432_MHz_XTAL); 15 static constexpr XTAL GALAXIAN_PIXEL_CLOCK(GALAXIAN_XSCALE*GALAXIAN_MASTER_CLOCK / 3); 16 static constexpr int GALAXIAN_HTOTAL = (384 * GALAXIAN_XSCALE); 17 static constexpr int GALAXIAN_HBEND = (0 * GALAXIAN_XSCALE); 18 //static constexpr int GALAXIAN_H0START = (6*GALAXIAN_XSCALE) 19 //static constexpr int GALAXIAN_HBSTART = (264*GALAXIAN_XSCALE) 20 static constexpr int GALAXIAN_H0START = (0 * GALAXIAN_XSCALE); 21 static constexpr int GALAXIAN_HBSTART = (256 * GALAXIAN_XSCALE); 22 23 static constexpr int GALAXIAN_VTOTAL = (264); 24 static constexpr int GALAXIAN_VBEND = (16); 25 static constexpr int GALAXIAN_VBSTART = (224 + 16); 26 27 class tutankhm_state : public driver_device 28 { 29 public: tutankhm_state(const machine_config & mconfig,device_type type,const char * tag)30 tutankhm_state(const machine_config &mconfig, device_type type, const char *tag) : 31 driver_device(mconfig, type, tag), 32 m_videoram(*this, "videoram"), 33 m_scroll(*this, "scroll"), 34 m_maincpu(*this, "maincpu"), 35 m_palette(*this, "palette"), 36 m_screen(*this, "screen"), 37 m_timeplt_audio(*this, "timeplt_audio"), 38 m_stars_config(*this, "STARS") 39 { 40 } 41 42 void tutankhm(machine_config &config); 43 44 protected: 45 DECLARE_WRITE_LINE_MEMBER(irq_enable_w); 46 void tutankhm_bankselect_w(uint8_t data); 47 DECLARE_WRITE_LINE_MEMBER(coin_counter_1_w); 48 DECLARE_WRITE_LINE_MEMBER(coin_counter_2_w); 49 void sound_on_w(uint8_t data); 50 DECLARE_WRITE_LINE_MEMBER(flip_screen_x_w); 51 DECLARE_WRITE_LINE_MEMBER(flip_screen_y_w); 52 virtual void machine_start() override; 53 virtual void machine_reset() override; 54 uint32_t screen_update_tutankhm_bootleg(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); 55 uint32_t screen_update_tutankhm_scramble(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); 56 uint32_t screen_update_tutankhm(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); 57 DECLARE_WRITE_LINE_MEMBER(vblank_irq); 58 void main_map(address_map &map); 59 virtual void video_start() override; 60 void galaxian_palette(palette_device &palette); 61 static rgb_t raw_to_rgb_func(u32 raw); 62 63 /* memory pointers */ 64 required_shared_ptr<uint8_t> m_videoram; 65 optional_shared_ptr<uint8_t> m_scroll; 66 67 /* video-related */ 68 tilemap_t *m_bg_tilemap; 69 uint8_t m_flipscreen_x; 70 uint8_t m_flipscreen_y; 71 72 /* misc */ 73 uint8_t m_irq_toggle; 74 uint8_t m_irq_enable; 75 76 /* devices */ 77 required_device<cpu_device> m_maincpu; 78 required_device<palette_device> m_palette; 79 required_device<screen_device> m_screen; 80 optional_device<timeplt_audio_device> m_timeplt_audio; 81 optional_ioport m_stars_config; 82 83 TIMER_DEVICE_CALLBACK_MEMBER(scramble_stars_blink_timer); 84 void galaxian_stars_enable_w(uint8_t data); 85 void stars_init(); 86 void stars_init_scramble(); 87 void stars_init_bootleg(); 88 void stars_draw_row(bitmap_rgb32 &bitmap, int maxx, int y, uint32_t star_offs); 89 void scramble_draw_stars(bitmap_rgb32 &bitmap, const rectangle &cliprect, int maxx); 90 void scramble_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect); 91 92 uint8_t m_star_mode; 93 rgb_t m_star_color[64]; 94 std::unique_ptr<uint8_t[]> m_stars; 95 uint8_t m_stars_enabled; 96 uint8_t m_stars_blink_state; 97 }; 98 99 #endif // MAME_INCLUDES_TUTANKHM_H 100