1 // license:BSD-3-Clause 2 // copyright-holders:Nicola Salmoria 3 #ifndef MAME_INCLUDES_F1GP_H 4 #define MAME_INCLUDES_F1GP_H 5 6 #pragma once 7 8 #include "machine/6850acia.h" 9 #include "machine/gen_latch.h" 10 #include "video/vsystem_spr.h" 11 #include "video/vsystem_spr2.h" 12 #include "video/k053936.h" 13 #include "emupal.h" 14 #include "tilemap.h" 15 16 class f1gp_state : public driver_device 17 { 18 public: f1gp_state(const machine_config & mconfig,device_type type,const char * tag)19 f1gp_state(const machine_config &mconfig, device_type type, const char *tag) : 20 driver_device(mconfig, type, tag), 21 m_sharedram(*this, "sharedram"), 22 m_sprvram(*this, "spr%uvram", 1U), 23 m_sprcgram(*this, "spr%ucgram", 1U), 24 m_fgvideoram(*this, "fgvideoram"), 25 m_rozvideoram(*this, "rozvideoram"), 26 m_spriteram(*this, "spriteram"), 27 m_fgregs(*this, "fgregs"), 28 m_rozregs(*this, "rozregs"), 29 m_z80bank(*this, "z80bank"), 30 m_maincpu(*this, "maincpu"), 31 m_gfxdecode(*this, "gfxdecode"), 32 m_audiocpu(*this, "audiocpu"), 33 m_k053936(*this, "k053936"), 34 m_palette(*this, "palette"), 35 m_soundlatch(*this, "soundlatch"), 36 m_acia(*this, "acia"), 37 m_rozgfxram(*this, "rozgfxram"), 38 m_spr_old(*this, "vsystem_spr_old%u", 1U) 39 { } 40 41 void f1gpb(machine_config &config); 42 void f1gp(machine_config &config); 43 44 protected: 45 /* memory pointers */ 46 required_shared_ptr<uint16_t> m_sharedram; 47 optional_shared_ptr_array<uint16_t, 2> m_sprvram; 48 optional_shared_ptr_array<uint16_t, 2> m_sprcgram; 49 required_shared_ptr<uint16_t> m_fgvideoram; 50 required_shared_ptr<uint16_t> m_rozvideoram; 51 optional_shared_ptr<uint16_t> m_spriteram; 52 optional_shared_ptr<uint16_t> m_fgregs; 53 optional_shared_ptr<uint16_t> m_rozregs; 54 55 optional_memory_bank m_z80bank; 56 57 /* video-related */ 58 tilemap_t *m_fg_tilemap; 59 tilemap_t *m_roz_tilemap; 60 int m_flipscreen; 61 int m_gfxctrl; 62 int m_scroll[2]; 63 template<int Chip> uint32_t tile_callback( uint32_t code ); 64 65 /* devices */ 66 required_device<cpu_device> m_maincpu; 67 required_device<gfxdecode_device> m_gfxdecode; 68 optional_device<cpu_device> m_audiocpu; 69 optional_device<k053936_device> m_k053936; 70 required_device<palette_device> m_palette; 71 optional_device<generic_latch_8_device> m_soundlatch; // not f1gpb 72 required_device<acia6850_device> m_acia; 73 74 void sh_bankswitch_w(uint8_t data); 75 uint8_t command_pending_r(); 76 void rozvideoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 77 void fgvideoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 78 void fgscroll_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 79 void gfxctrl_w(uint8_t data); 80 TILE_GET_INFO_MEMBER(get_fg_tile_info); 81 82 virtual void machine_start() override; 83 virtual void machine_reset() override; 84 85 void f1gp_cpu2_map(address_map &map); 86 void sound_io_map(address_map &map); 87 void sound_map(address_map &map); 88 89 private: 90 /* memory pointers */ 91 optional_shared_ptr<uint16_t> m_rozgfxram; 92 93 /* devices */ 94 optional_device_array<vsystem_spr2_device, 2> m_spr_old; // f1gp 95 96 void f1gpb_misc_w(uint16_t data); 97 void rozgfxram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 98 TILE_GET_INFO_MEMBER(get_roz_tile_info); 99 100 virtual void video_start() override; 101 102 uint32_t screen_update_f1gp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 103 uint32_t screen_update_f1gpb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 104 void f1gpb_draw_sprites( screen_device &screen, bitmap_ind16 &bitmap,const rectangle &cliprect ); 105 void f1gp_cpu1_map(address_map &map); 106 void f1gpb_cpu1_map(address_map &map); 107 void f1gpb_cpu2_map(address_map &map); 108 }; 109 110 class f1gp2_state : public f1gp_state 111 { 112 public: f1gp2_state(const machine_config & mconfig,device_type type,const char * tag)113 f1gp2_state(const machine_config &mconfig, device_type type, const char *tag) : 114 f1gp_state(mconfig, type, tag), 115 m_spr(*this, "vsystem_spr") 116 { } 117 118 void f1gp2(machine_config &config); 119 120 private: 121 /* video-related */ 122 int m_roz_bank; 123 124 /* devices */ 125 optional_device<vsystem_spr_device> m_spr; // f1gp2 126 127 void rozbank_w(uint8_t data); 128 129 TILE_GET_INFO_MEMBER(get_roz_tile_info); 130 131 virtual void machine_reset() override; 132 virtual void video_start() override; 133 134 uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 135 void f1gp2_cpu1_map(address_map &map); 136 }; 137 138 #endif // MAME_INCLUDES_F1GP_H 139