1 // license:BSD-3-Clause 2 // copyright-holders:Bryan McPhail 3 /************************************************************************* 4 5 Irem M92 hardware 6 7 *************************************************************************/ 8 #ifndef MAME_INCLUDES_M92_H 9 #define MAME_INCLUDES_M92_H 10 11 #pragma once 12 13 #include "cpu/nec/v25.h" 14 #include "machine/pic8259.h" 15 #include "machine/timer.h" 16 #include "sound/okim6295.h" 17 #include "video/bufsprite.h" 18 #include "emupal.h" 19 #include "screen.h" 20 #include "tilemap.h" 21 22 struct M92_pf_layer_info 23 { 24 tilemap_t * tmap; 25 tilemap_t * wide_tmap; 26 uint16_t vram_base; 27 uint16_t control[4]; 28 }; 29 30 class m92_state : public driver_device 31 { 32 public: 33 enum 34 { 35 TIMER_SPRITEBUFFER 36 }; 37 m92_state(const machine_config & mconfig,device_type type,const char * tag)38 m92_state(const machine_config &mconfig, device_type type, const char *tag) : 39 driver_device(mconfig, type, tag), 40 m_spriteram(*this, "spriteram"), 41 m_vram_data(*this, "vram_data"), 42 m_spritecontrol(*this, "spritecontrol"), 43 m_maincpu(*this, "maincpu"), 44 m_soundcpu(*this, "soundcpu"), 45 m_oki(*this, "oki"), 46 m_gfxdecode(*this, "gfxdecode"), 47 m_screen(*this, "screen"), 48 m_palette(*this, "palette"), 49 m_upd71059c(*this, "upd71059c"), 50 m_eeprom(*this, "eeprom", 16), 51 m_mainbank(*this, "mainbank") 52 { } 53 54 void m92(machine_config &config); 55 void m92_banked(machine_config &config); 56 void inthunt(machine_config &config); 57 void lethalth(machine_config &config); 58 void ppan(machine_config &config); 59 void hook(machine_config &config); 60 void psoldier(machine_config &config); 61 void rtypeleo(machine_config &config); 62 void gunforc2(machine_config &config); 63 void nbbatman2bl(machine_config &config); 64 void bmaster(machine_config &config); 65 void nbbatman(machine_config &config); 66 void uccops(machine_config &config); 67 void dsoccr94j(machine_config &config); 68 void gunforce(machine_config &config); 69 void majtitl2(machine_config &config); 70 void majtitl2a(machine_config &config); 71 void mysticri(machine_config &config); 72 73 void init_bank(); 74 75 DECLARE_READ_LINE_MEMBER(sprite_busy_r); 76 77 private: 78 required_device<buffered_spriteram16_device> m_spriteram; 79 required_shared_ptr<uint16_t> m_vram_data; 80 required_shared_ptr<uint16_t> m_spritecontrol; 81 required_device<cpu_device> m_maincpu; 82 optional_device<v35_device> m_soundcpu; 83 optional_device<okim6295_device> m_oki; 84 required_device<gfxdecode_device> m_gfxdecode; 85 required_device<screen_device> m_screen; 86 required_device<palette_device> m_palette; 87 required_device<pic8259_device> m_upd71059c; 88 89 optional_shared_ptr<uint8_t> m_eeprom; 90 optional_memory_bank m_mainbank; 91 92 emu_timer *m_spritebuffer_timer; 93 uint32_t m_raster_irq_position; 94 uint16_t m_videocontrol; 95 uint8_t m_sprite_buffer_busy; 96 M92_pf_layer_info m_pf_layer[3]; 97 uint16_t m_pf_master_control[4]; 98 int32_t m_sprite_list; 99 uint8_t m_palette_bank; 100 std::vector<uint16_t> m_paletteram; 101 102 uint16_t eeprom_r(offs_t offset); 103 void eeprom_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 104 void coincounter_w(uint8_t data); 105 void bankswitch_w(uint8_t data); 106 void sound_reset_w(uint16_t data); 107 void spritecontrol_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 108 void videocontrol_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 109 uint16_t paletteram_r(offs_t offset); 110 void paletteram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 111 void vram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 112 template<int Layer> void pf_control_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 113 void master_control_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 114 void oki_bank_w(uint16_t data); 115 TILE_GET_INFO_MEMBER(get_pf_tile_info); 116 DECLARE_MACHINE_RESET(m92); 117 DECLARE_VIDEO_START(m92); 118 DECLARE_VIDEO_START(ppan); 119 uint32_t screen_update_m92(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 120 uint32_t screen_update_ppan(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 121 TIMER_DEVICE_CALLBACK_MEMBER(scanline_interrupt); 122 void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 123 void ppan_draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 124 void m92_update_scroll_positions(); 125 void m92_draw_tiles(screen_device &screen, bitmap_ind16 &bitmap,const rectangle &cliprect); 126 127 void lethalth_map(address_map &map); 128 void m92_map(address_map &map); 129 void m92_banked_map(address_map &map); 130 void m92_banked_portmap(address_map &map); 131 void m92_base_map(address_map &map); 132 void m92_portmap(address_map &map); 133 void majtitl2_map(address_map &map); 134 void ppan_portmap(address_map &map); 135 void sound_map(address_map &map); 136 137 virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; 138 }; 139 140 #endif // MAME_INCLUDES_M92_H 141