1 // license:BSD-3-Clause 2 // copyright-holders:David Haywood, Phil Stroffolino, Carlos A. Lozano 3 #ifndef MAME_INCLUDES_ARMEDF_H 4 #define MAME_INCLUDES_ARMEDF_H 5 6 #pragma once 7 8 #include "machine/nb1414m4.h" 9 #include "machine/gen_latch.h" 10 #include "video/bufsprite.h" 11 #include "screen.h" 12 #include "emupal.h" 13 #include "tilemap.h" 14 15 class armedf_state : public driver_device 16 { 17 public: armedf_state(const machine_config & mconfig,device_type type,const char * tag)18 armedf_state(const machine_config &mconfig, device_type type, const char *tag) 19 : driver_device(mconfig, type, tag) 20 , m_maincpu(*this, "maincpu") 21 , m_extra(*this, "extra") 22 , m_nb1414m4(*this, "nb1414m4") 23 , m_screen(*this, "screen") 24 , m_gfxdecode(*this, "gfxdecode") 25 , m_palette(*this, "palette") 26 , m_spriteram(*this, "spriteram") 27 , m_soundlatch(*this, "soundlatch") 28 , m_text_videoram(*this, "text_videoram", 0) 29 , m_spr_pal_clut(*this, "spr_pal_clut") 30 , m_fg_videoram(*this, "fg_videoram") 31 , m_bg_videoram(*this, "bg_videoram") 32 { } 33 34 void init_cclimbr2(); 35 void init_armedf(); 36 void init_legion(); 37 void init_terraf(); 38 void init_legionjb(); 39 void init_kozure(); 40 41 void terraf(machine_config &config); 42 void terrafb(machine_config &config); 43 void legion_common(machine_config &config); 44 void legion(machine_config &config); 45 void legionjb(machine_config &config); 46 void legionjb2(machine_config &config); 47 void cclimbr2(machine_config &config); 48 void terrafjb(machine_config &config); 49 void armedf(machine_config &config); 50 void kozure(machine_config &config); 51 52 protected: 53 virtual void machine_start() override; 54 virtual void machine_reset() override; 55 void video_config(machine_config &config, int hchar_start, int vstart, int vend); 56 void sound_config(machine_config &config); 57 58 // devices 59 required_device<cpu_device> m_maincpu; 60 optional_device<cpu_device> m_extra; 61 optional_device<nb1414m4_device> m_nb1414m4; 62 required_device<screen_device> m_screen; 63 required_device<gfxdecode_device> m_gfxdecode; 64 required_device<palette_device> m_palette; 65 required_device<buffered_spriteram16_device> m_spriteram; 66 required_device<generic_latch_8_device> m_soundlatch; 67 68 // memory pointers 69 required_shared_ptr<u8> m_text_videoram; 70 required_shared_ptr<u16> m_spr_pal_clut; 71 required_shared_ptr<u16> m_fg_videoram; 72 required_shared_ptr<u16> m_bg_videoram; 73 u16 m_legion_cmd[4]; // legionjb only! 74 75 // video-related 76 tilemap_t *m_bg_tilemap; 77 tilemap_t *m_fg_tilemap; 78 tilemap_t *m_tx_tilemap; 79 u16 m_scroll_msb; 80 u16 m_vreg; 81 u16 m_fg_scrollx; 82 u16 m_fg_scrolly; 83 u16 m_bg_scrollx; 84 u16 m_bg_scrolly; 85 int m_scroll_type; 86 int m_sprite_offy; 87 int m_old_mcu_mode; 88 int m_waiting_msb; 89 90 // read/write handlers 91 void terraf_io_w(offs_t offset, u16 data, u16 mem_mask); 92 void terrafjb_io_w(offs_t offset, u16 data, u16 mem_mask); 93 void armedf_io_w(offs_t offset, u16 data, u16 mem_mask); 94 void sound_command_w(u8 data); 95 u8 soundlatch_clear_r(); 96 void irq_lv1_ack_w(u16 data); 97 void irq_lv2_ack_w(u16 data); 98 99 // video handlers 100 void legionjb_fg_scroll_w(offs_t offset, u8 data); 101 void blitter_txram_w(offs_t offset, u8 data); 102 void terrafjb_fg_scrollx_w(u8 data); 103 void terrafjb_fg_scrolly_w(u8 data); 104 void terrafjb_fg_scroll_msb_w(u8 data); 105 u8 text_videoram_r(offs_t offset); 106 void text_videoram_w(offs_t offset, u8 data); 107 void fg_videoram_w(offs_t offset, u16 data, u16 mem_mask); 108 void bg_videoram_w(offs_t offset, u16 data, u16 mem_mask); 109 void terrafb_fg_scrolly_w(u8 data); 110 void terrafb_fg_scrollx_w(u8 data); 111 void terrafb_fg_scroll_msb_arm_w(u8 data); 112 void fg_scrollx_w(offs_t offset, u16 data, u16 mem_mask); 113 void fg_scrolly_w(offs_t offset, u16 data, u16 mem_mask); 114 void bg_scrollx_w(offs_t offset, u16 data, u16 mem_mask); 115 void bg_scrolly_w(offs_t offset, u16 data, u16 mem_mask); 116 117 TILEMAP_MAPPER_MEMBER(armedf_scan_type1); 118 TILEMAP_MAPPER_MEMBER(armedf_scan_type2); 119 TILEMAP_MAPPER_MEMBER(armedf_scan_type3); 120 121 TILE_GET_INFO_MEMBER(get_nb1414m4_tx_tile_info); 122 TILE_GET_INFO_MEMBER(get_armedf_tx_tile_info); 123 TILE_GET_INFO_MEMBER(get_fg_tile_info); 124 TILE_GET_INFO_MEMBER(get_bg_tile_info); 125 126 DECLARE_VIDEO_START(terraf); 127 DECLARE_VIDEO_START(armedf); 128 129 u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 130 131 void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &primap); 132 void armedf_drawgfx(bitmap_ind16 &dest_bmp, const rectangle &clip, gfx_element *gfx, 133 u32 code, u32 color, u32 clut, int flipx, int flipy, int offsx, int offsy, 134 bitmap_ind8 &primap, u32 pmask, int transparent_color); 135 void common_map(address_map &map); 136 void armedf_map(address_map &map); 137 void cclimbr2_map(address_map &map); 138 void cclimbr2_soundmap(address_map &map); 139 void kozure_map(address_map &map); 140 void legion_common_map(address_map &map); 141 void legion_map(address_map &map); 142 void legionjb_map(address_map &map); 143 void legionjb2_map(address_map &map); 144 void sound_3526_portmap(address_map &map); 145 void sound_map(address_map &map); 146 void sound_portmap(address_map &map); 147 void terraf_common_map(address_map &map); 148 void terraf_map(address_map &map); 149 void terrafb_map(address_map &map); 150 void terrafjb_map(address_map &map); 151 void terrafjb_extraz80_map(address_map &map); 152 void terrafjb_extraz80_portmap(address_map &map); 153 }; 154 155 class bigfghtr_state : public armedf_state 156 { 157 public: bigfghtr_state(const machine_config & mconfig,device_type type,const char * tag)158 bigfghtr_state(const machine_config &mconfig, device_type type, const char *tag) 159 : armedf_state(mconfig, type, tag) 160 , m_mcu(*this, "mcu") 161 , m_sharedram(*this, "sharedram") 162 { } 163 164 void bigfghtr(machine_config &config); 165 166 private: 167 required_device<cpu_device> m_mcu; 168 required_shared_ptr<u8> m_sharedram; 169 170 // mcu interfaces 171 u16 latch_r(); 172 void main_sharedram_w(offs_t offset, u8 data); 173 u8 main_sharedram_r(offs_t offset); 174 void mcu_spritelist_w(offs_t offset, u8 data); 175 176 void bigfghtr_map(address_map &map); 177 void bigfghtr_mcu_io_map(address_map &map); 178 void bigfghtr_mcu_map(address_map &map); 179 }; 180 181 #endif // MAME_INCLUDES_ARMEDF_H 182