1 // license:BSD-3-Clause 2 // copyright-holders:Paul Leaman 3 /*************************************************************************** 4 5 1943 6 7 ***************************************************************************/ 8 #ifndef MAME_INCLUDES_1943_H 9 #define MAME_INCLUDES_1943_H 10 11 #pragma once 12 13 #include "cpu/mcs51/mcs51.h" 14 #include "emupal.h" 15 #include "screen.h" 16 #include "tilemap.h" 17 18 class _1943_state : public driver_device 19 { 20 public: _1943_state(const machine_config & mconfig,device_type type,const char * tag)21 _1943_state(const machine_config &mconfig, device_type type, const char *tag) : 22 driver_device(mconfig, type, tag), 23 m_maincpu(*this, "maincpu"), 24 m_mcu(*this, "mcu"), 25 m_videoram(*this, "videoram"), 26 m_colorram(*this, "colorram"), 27 m_scrollx(*this, "scrollx"), 28 m_scrolly(*this, "scrolly"), 29 m_bgscrollx(*this, "bgscrollx"), 30 m_spriteram(*this, "spriteram"), 31 m_gfxdecode(*this, "gfxdecode"), 32 m_palette(*this, "palette"), 33 m_screen(*this, "screen"), 34 m_tilerom(*this, "tilerom"), 35 m_proms(*this, "proms"), 36 m_mainbank(*this, "mainbank") 37 { } 38 39 void _1943(machine_config &config); 40 void _1943b(machine_config &config); 41 42 void init_1943(); 43 44 private: 45 /* devices / memory pointers */ 46 required_device<cpu_device> m_maincpu; 47 optional_device<i8751_device> m_mcu; 48 required_shared_ptr<u8> m_videoram; 49 required_shared_ptr<u8> m_colorram; 50 required_shared_ptr<u8> m_scrollx; 51 required_shared_ptr<u8> m_scrolly; 52 required_shared_ptr<u8> m_bgscrollx; 53 required_shared_ptr<u8> m_spriteram; 54 required_device<gfxdecode_device> m_gfxdecode; 55 required_device<palette_device> m_palette; 56 required_device<screen_device> m_screen; 57 required_region_ptr<u8> m_tilerom; 58 required_region_ptr<u8> m_proms; 59 required_memory_bank m_mainbank; 60 61 /* video-related */ 62 tilemap_t *m_fg_tilemap; 63 tilemap_t *m_bg_tilemap; 64 tilemap_t *m_bg2_tilemap; 65 int m_char_on; 66 int m_obj_on; 67 int m_bg1_on; 68 int m_bg2_on; 69 70 /* protection */ 71 u8 m_cpu_to_mcu; // ls374 at 5k 72 u8 m_mcu_to_cpu; // ls374 at 6k 73 u8 m_audiocpu_to_mcu; // ls374 at 5l 74 u8 m_mcu_to_audiocpu; // ls374 at 6l 75 u8 m_mcu_p0; 76 u8 m_mcu_p2; 77 u8 m_mcu_p3; 78 79 INTERRUPT_GEN_MEMBER(mcu_irq); 80 void mcu_p3_w(u8 data); 81 82 void videoram_w(offs_t offset, u8 data); 83 void colorram_w(offs_t offset, u8 data); 84 void c804_w(u8 data); 85 void d806_w(u8 data); 86 87 TILE_GET_INFO_MEMBER(get_bg2_tile_info); 88 TILE_GET_INFO_MEMBER(get_bg_tile_info); 89 TILE_GET_INFO_MEMBER(get_fg_tile_info); 90 virtual void machine_start() override; 91 virtual void machine_reset() override; 92 virtual void video_start() override; 93 void _1943_palette(palette_device &palette) const; 94 u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 95 void _1943_drawgfx(bitmap_ind16 &dest_bmp,const rectangle &clip,gfx_element *gfx, 96 u32 code,u32 color,bool flipx,bool flipy,int offsx,int offsy, 97 u8 transparent_color); 98 void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); 99 100 void c1943_map(address_map &map); 101 void c1943b_map(address_map &map); 102 void sound_map(address_map &map); 103 }; 104 105 #endif // MAME_INCLUDES_1943_H 106