diff options
Diffstat (limited to 'src/mame/includes/pgm2.h')
-rw-r--r-- | src/mame/includes/pgm2.h | 162 |
1 files changed, 80 insertions, 82 deletions
diff --git a/src/mame/includes/pgm2.h b/src/mame/includes/pgm2.h index f935cda5b72..6064d5dee5f 100644 --- a/src/mame/includes/pgm2.h +++ b/src/mame/includes/pgm2.h @@ -19,10 +19,10 @@ struct kov3_module_key { - uint8_t key[8]; - uint8_t sum[8]; - uint32_t addr_xor; // 22bit - uint16_t data_xor; + u8 key[8]; + u8 sum[8]; + u32 addr_xor; // 22bit + u16 data_xor; }; class pgm2_state : public driver_device @@ -51,9 +51,29 @@ public: m_bg_palette(*this, "bg_palette"), m_tx_palette(*this, "tx_palette"), m_mcu_timer(*this, "mcu_timer"), - m_memcard(*this, "memcard_p%u", 1U) + m_memcard(*this, "memcard_p%u", 1U), + m_mainrom(*this, "mainrom") { } + void init_kov2nl(); + void init_orleg2(); + void init_ddpdojt(); + void init_kov3(); + void init_kov3_104(); + void init_kov3_102(); + void init_kov3_101(); + void init_kov3_100(); + void init_kof98umh(); + + void pgm2_ramrom(machine_config &config); + void pgm2_lores(machine_config &config); + void pgm2(machine_config &config); + void pgm2_hires(machine_config &config); + void pgm2_map(address_map &map); + void pgm2_module_rom_map(address_map &map); + void pgm2_ram_rom_map(address_map &map); + void pgm2_rom_map(address_map &map); +private: DECLARE_READ32_MEMBER(unk_startup_r); DECLARE_READ32_MEMBER(rtc_r); DECLARE_READ32_MEMBER(mcu_r); @@ -71,9 +91,9 @@ public: DECLARE_READ32_MEMBER(pio_pdsr_r); DECLARE_WRITE16_MEMBER(module_rom_w); DECLARE_READ16_MEMBER(module_rom_r); - DECLARE_READ_LINE_MEMBER(module_data_r); - DECLARE_WRITE_LINE_MEMBER(module_data_w); - DECLARE_WRITE_LINE_MEMBER(module_clk_w); + int module_data_r(); + void module_data_w(int state); + void module_clk_w(int state); DECLARE_READ32_MEMBER(orleg2_speedup_r); DECLARE_READ32_MEMBER(kov2nl_speedup_r); @@ -87,112 +107,90 @@ public: DECLARE_WRITE32_MEMBER(encryption_do_w); DECLARE_WRITE32_MEMBER(sprite_encryption_w); - void init_kov2nl(); - void init_orleg2(); - void init_ddpdojt(); - void init_kov3(); - void init_kov3_104(); - void init_kov3_102(); - void init_kov3_101(); - void init_kov3_100(); - void init_kof98umh(); - - uint32_t screen_update_pgm2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - DECLARE_WRITE_LINE_MEMBER(screen_vblank_pgm2); - DECLARE_WRITE_LINE_MEMBER(irq); - - INTERRUPT_GEN_MEMBER(igs_interrupt); - TIMER_DEVICE_CALLBACK_MEMBER(igs_interrupt2); - - void pgm2_ramrom(machine_config &config); - void pgm2_lores(machine_config &config); - void pgm2(machine_config &config); - void pgm2_hires(machine_config &config); - void pgm2_map(address_map &map); - void pgm2_module_rom_map(address_map &map); - void pgm2_ram_rom_map(address_map &map); - void pgm2_rom_map(address_map &map); -private: virtual void machine_start() override; virtual void machine_reset() override; virtual void video_start() override; + virtual void device_post_load() override; TILE_GET_INFO_MEMBER(get_fg_tile_info); TILE_GET_INFO_MEMBER(get_bg_tile_info); - void decrypt_kov3_module(uint32_t addrxor, uint16_t dataxor); + u32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + DECLARE_WRITE_LINE_MEMBER(screen_vblank); + DECLARE_WRITE_LINE_MEMBER(irq); + + TIMER_DEVICE_CALLBACK_MEMBER(mcu_interrupt); + + void decrypt_kov3_module(u32 addrxor, u16 dataxor); tilemap_t *m_fg_tilemap; tilemap_t *m_bg_tilemap; - std::unique_ptr<uint32_t[]> m_spritebufferram; // buffered spriteram - bitmap_ind16 m_sprite_bitmap; - void skip_sprite_chunk(int &palette_offset, uint32_t maskdata, int reverse); - void draw_sprite_pixel(const rectangle &cliprect, int palette_offset, int realx, int realy, int pal); - void draw_sprite_chunk(const rectangle &cliprect, int &palette_offset, int x, int realy, int sizex, int xdraw, int pal, uint32_t maskdata, uint32_t zoomx_bits, int repeats, int &realxdraw, int realdraw_inc, int palette_inc); - void draw_sprite_line(const rectangle &cliprect, int &mask_offset, int &palette_offset, int x, int realy, int flipx, int reverse, int sizex, int pal, int zoomybit, int zoomx_bits, int xrepeats); - void draw_sprites(screen_device &screen, const rectangle &cliprect, uint32_t* spriteram); - void copy_sprites_from_bitmap(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int pri); - - uint32_t m_sprites_mask_mask; - uint32_t m_sprites_colour_mask; + void skip_sprite_chunk(u32 &palette_offset, u32 maskdata, bool reverse); + void draw_sprite_pixel(const rectangle &cliprect, u32 palette_offset, s16 realx, s16 realy, u16 pal); + void draw_sprite_chunk(const rectangle &cliprect, u32 &palette_offset, s16 x, s16 realy, + u16 sizex, int xdraw, u16 pal, u32 maskdata, u32 zoomx_bits, u8 repeats, s16 &realxdraw, s8 realdraw_inc, s8 palette_inc); + void draw_sprite_line(const rectangle &cliprect, u32 &mask_offset, u32 &palette_offset, s16 x, s16 realy, + bool flipx, bool reverse, u16 sizex, u16 pal, u8 zoomybit, u32 zoomx_bits, u8 xrepeats); + void draw_sprites(const rectangle &cliprect); + void copy_sprites_from_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect, u16 pri); void common_encryption_init(); - uint8_t m_encryption_table[0x100]; - int m_has_decrypted; // so we only do it once. - int m_has_decrypted_kov3_module; - uint32_t m_spritekey; - uint32_t m_realspritekey; - int m_sprite_predecrypted; - - uint8_t m_shareram[0x100]; - uint16_t m_share_bank; - uint32_t m_mcu_regs[8]; - uint32_t m_mcu_result0; - uint32_t m_mcu_result1; - uint8_t m_mcu_last_cmd; - void mcu_command(address_space &space, bool is_command); - - std::vector<uint8_t> m_encrypted_copy; - - uint32_t pio_out_data; + u8 m_encryption_table[0x100]; + bool m_has_decrypted; // so we only do it once. + bool m_has_decrypted_kov3_module; + u32 m_spritekey; + u32 m_realspritekey; + bool m_sprite_predecrypted; + + u8 m_shareram[0x100]; + u16 m_share_bank; + u32 m_mcu_regs[8]; + u32 m_mcu_result0; + u32 m_mcu_result1; + u8 m_mcu_last_cmd; + void mcu_command(bool is_command); + + std::vector<u8> m_encrypted_copy; + + u32 m_pio_out_data; const kov3_module_key *module_key; bool module_sum_read; - uint32_t module_in_latch; - uint32_t module_out_latch; + u32 module_in_latch; + u32 module_out_latch; int module_prev_state; int module_clk_cnt; - uint8_t module_rcv_buf[10]; - uint8_t module_send_buf[9]; - - void postload(); + u8 module_rcv_buf[10]; + u8 module_send_buf[9]; // devices required_device<cpu_device> m_maincpu; required_device<screen_device> m_screen; - required_shared_ptr<uint32_t> m_lineram; - required_shared_ptr<uint32_t> m_sp_zoom; - required_shared_ptr<uint32_t> m_mainram; - optional_shared_ptr<uint32_t> m_romboard_ram; - required_shared_ptr<uint32_t> m_fg_videoram; - required_shared_ptr<uint32_t> m_bg_videoram; - required_shared_ptr<uint32_t> m_sp_videoram; - required_shared_ptr<uint32_t> m_bgscroll; - required_shared_ptr<uint32_t> m_fgscroll; - required_shared_ptr<uint32_t> m_vidmode; + required_shared_ptr<u32> m_lineram; + required_shared_ptr<u32> m_sp_zoom; + required_shared_ptr<u32> m_mainram; + optional_shared_ptr<u32> m_romboard_ram; + required_shared_ptr<u32> m_fg_videoram; + required_shared_ptr<u32> m_bg_videoram; + required_shared_ptr<u32> m_sp_videoram; + required_shared_ptr<u32> m_bgscroll; + required_shared_ptr<u32> m_fgscroll; + required_shared_ptr<u32> m_vidmode; required_device<gfxdecode_device> m_gfxdecode2; required_device<gfxdecode_device> m_gfxdecode3; required_device<arm_aic_device> m_arm_aic; - required_region_ptr<uint8_t> m_sprites_mask; - required_region_ptr<uint8_t> m_sprites_colour; + required_region_ptr<u8> m_sprites_mask; + required_region_ptr<u8> m_sprites_colour; required_device<palette_device> m_sp_palette; required_device<palette_device> m_bg_palette; required_device<palette_device> m_tx_palette; required_device<timer_device> m_mcu_timer; optional_device_array<pgm2_memcard_device, 4> m_memcard; + + required_memory_region m_mainrom; }; #endif |