1 // license:BSD-3-Clause 2 // copyright-holders:Ernesto Corvi,Brad Oliver 3 #ifndef MAME_INCLUDES_PLAYCH10_H 4 #define MAME_INCLUDES_PLAYCH10_H 5 6 #pragma once 7 8 #include "cpu/m6502/n2a03.h" 9 #include "machine/rp5h01.h" 10 #include "video/ppu2c0x.h" 11 #include "emupal.h" 12 #include "tilemap.h" 13 14 class playch10_state : public driver_device 15 { 16 public: playch10_state(const machine_config & mconfig,device_type type,const char * tag)17 playch10_state(const machine_config &mconfig, device_type type, const char *tag) 18 : driver_device(mconfig, type, tag) 19 , m_maincpu(*this, "maincpu") 20 , m_cartcpu(*this, "cart") 21 , m_ppu(*this, "ppu") 22 , m_rp5h01(*this, "rp5h01") 23 , m_ram_8w(*this, "ram_8w") 24 , m_videoram(*this, "videoram") 25 , m_work_ram(*this, "work_ram") 26 , m_gfxdecode(*this, "gfxdecode") 27 , m_vrom_region(*this, "gfx2") 28 , m_timedigits(*this, "digit_%u", 0U) 29 { 30 } 31 32 void playch10(machine_config &config); 33 void playchnv(machine_config &config); 34 void playch10_hboard(machine_config &config); 35 36 void init_playch10(); 37 void init_pc_gun(); 38 void init_pcaboard(); 39 void init_pcbboard(); 40 void init_pccboard(); 41 void init_pcdboard(); 42 void init_pcdboard_2(); 43 void init_pceboard(); 44 void init_pcfboard(); 45 void init_pcfboard_2(); 46 void init_virus(); 47 void init_ttoon(); 48 void init_pcgboard(); 49 void init_pcgboard_type2(); 50 void init_pchboard(); 51 void init_pciboard(); 52 void init_pckboard(); 53 void init_pc_hrz(); 54 55 DECLARE_READ_LINE_MEMBER(int_detect_r); 56 57 private: 58 DECLARE_WRITE_LINE_MEMBER(up8w_w); 59 uint8_t ram_8w_r(offs_t offset); 60 void ram_8w_w(offs_t offset, uint8_t data); 61 void sprite_dma_w(address_space &space, uint8_t data); 62 void time_w(offs_t offset, uint8_t data); 63 DECLARE_WRITE_LINE_MEMBER(sdcs_w); 64 DECLARE_WRITE_LINE_MEMBER(cntrl_mask_w); 65 DECLARE_WRITE_LINE_MEMBER(disp_mask_w); 66 DECLARE_WRITE_LINE_MEMBER(sound_mask_w); 67 DECLARE_WRITE_LINE_MEMBER(nmi_enable_w); 68 DECLARE_WRITE_LINE_MEMBER(dog_di_w); 69 DECLARE_WRITE_LINE_MEMBER(ppu_reset_w); 70 uint8_t pc10_detectclr_r(); 71 void cart_sel_w(uint8_t data); 72 uint8_t pc10_prot_r(); 73 void pc10_prot_w(uint8_t data); 74 void pc10_in0_w(uint8_t data); 75 uint8_t pc10_in0_r(); 76 uint8_t pc10_in1_r(); 77 void pc10_nt_w(offs_t offset, uint8_t data); 78 uint8_t pc10_nt_r(offs_t offset); 79 void pc10_chr_w(offs_t offset, uint8_t data); 80 uint8_t pc10_chr_r(offs_t offset); 81 void mmc1_rom_switch_w(offs_t offset, uint8_t data); 82 void aboard_vrom_switch_w(uint8_t data); 83 void bboard_rom_switch_w(uint8_t data); 84 void cboard_vrom_switch_w(uint8_t data); 85 void eboard_rom_switch_w(offs_t offset, uint8_t data); 86 void gboard_rom_switch_w(offs_t offset, uint8_t data); 87 void iboard_rom_switch_w(uint8_t data); 88 void hboard_rom_switch_w(offs_t offset, uint8_t data); 89 void playch10_videoram_w(offs_t offset, uint8_t data); 90 91 TILE_GET_INFO_MEMBER(get_bg_tile_info); 92 93 void bios_io_map(address_map &map); 94 void bios_map(address_map &map); 95 void cart_map(address_map &map); 96 97 virtual void machine_start() override; 98 virtual void machine_reset() override; 99 virtual void video_start() override; 100 101 struct chr_bank 102 { 103 int writable; // 1 for RAM, 0 for ROM 104 uint8_t* chr; // direct access to the memory 105 }; 106 107 void playch10_palette(palette_device &palette) const; 108 DECLARE_MACHINE_START(playch10_hboard); 109 DECLARE_VIDEO_START(playch10_hboard); 110 DECLARE_WRITE_LINE_MEMBER(vblank_irq); 111 112 void pc10_set_videorom_bank( int first, int count, int bank, int size ); 113 void set_videoram_bank( int first, int count, int bank, int size ); 114 void gboard_scanline_cb( int scanline, int vblank, int blanked ); 115 DECLARE_WRITE_LINE_MEMBER(int_detect_w); 116 void mapper9_latch(offs_t offset); 117 void pc10_set_mirroring(int mirroring); 118 119 uint32_t screen_update_playch10_top(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); 120 uint32_t screen_update_playch10_bottom(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); 121 uint32_t screen_update_playch10_single(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); 122 123 required_device<cpu_device> m_maincpu; 124 required_device<n2a03_device> m_cartcpu; 125 required_device<ppu2c0x_device> m_ppu; 126 optional_device<rp5h01_device> m_rp5h01; 127 128 required_shared_ptr<uint8_t> m_ram_8w; 129 required_shared_ptr<uint8_t> m_videoram; 130 required_shared_ptr<uint8_t> m_work_ram; 131 required_device<gfxdecode_device> m_gfxdecode; 132 133 optional_memory_region m_vrom_region; 134 135 output_finder<4> m_timedigits; 136 137 int m_up_8w; 138 int m_pc10_nmi_enable; 139 int m_pc10_dog_di; 140 int m_pc10_sdcs; 141 int m_pc10_dispmask; 142 int m_pc10_int_detect; 143 int m_pc10_game_mode; 144 int m_pc10_dispmask_old; 145 int m_pc10_gun_controller; 146 int m_cart_sel; 147 int m_cntrl_mask; 148 int m_input_latch[2]; 149 int m_mirroring; 150 int m_MMC2_bank[4]; 151 int m_MMC2_bank_latch[2]; 152 uint8_t* m_vrom; 153 std::unique_ptr<uint8_t[]> m_vram; 154 uint8_t* m_nametable[4]; 155 std::unique_ptr<uint8_t[]> m_nt_ram; 156 chr_bank m_chr_page[8]; 157 int m_mmc1_shiftreg; 158 int m_mmc1_shiftcount; 159 int m_mmc1_rom_mask; 160 int m_gboard_scanline_counter; 161 int m_gboard_scanline_latch; 162 int m_gboard_banks[2]; 163 int m_gboard_4screen; 164 int m_gboard_last_bank; 165 int m_gboard_command; 166 int m_IRQ_count; 167 uint8_t m_IRQ_count_latch; 168 int m_IRQ_enable; 169 int m_pc10_bios; 170 tilemap_t *m_bg_tilemap; 171 }; 172 173 #endif // MAME_INCLUDES_PLAYCH10_H 174