modernized Kaneko Pandora device. [Osso]

This commit is contained in:
Fabio Priuli 2013-06-02 17:22:02 +00:00
parent f81ebe547b
commit 6919d66a5e
15 changed files with 194 additions and 245 deletions

View File

@ -221,7 +221,6 @@ Code at 505: waits for bit 1 to go low, writes command, waits for bit
#include "cpu/z80/z80.h"
#include "sound/2203intf.h"
#include "sound/okim6295.h"
#include "video/kan_pand.h"
#include "includes/airbustr.h"
/* Read/Write Handlers */
@ -275,7 +274,7 @@ WRITE8_MEMBER(airbustr_state::slave_bankswitch_w)
flip_screen_set(data & 0x10);
// used at the end of levels, after defeating the boss, to leave trails
pandora_set_clear_bitmap(m_pandora, data & 0x20);
m_pandora->set_clear_bitmap(data & 0x20);
}
WRITE8_MEMBER(airbustr_state::sound_bankswitch_w)
@ -340,7 +339,7 @@ WRITE8_MEMBER(airbustr_state::airbustr_coin_counter_w)
static ADDRESS_MAP_START( master_map, AS_PROGRAM, 8, airbustr_state )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
AM_RANGE(0xc000, 0xcfff) AM_DEVREADWRITE_LEGACY("pandora", pandora_spriteram_r, pandora_spriteram_w)
AM_RANGE(0xc000, 0xcfff) AM_DEVREADWRITE("pandora", kaneko_pandora_device, spriteram_r, spriteram_w)
AM_RANGE(0xd000, 0xdfff) AM_RAM
AM_RANGE(0xe000, 0xefff) AM_RAM AM_SHARE("devram") // shared with protection device
AM_RANGE(0xf000, 0xffff) AM_RAM AM_SHARE("share1")
@ -575,8 +574,6 @@ void airbustr_state::machine_start()
membank("bank3")->configure_entries(0, 3, &AUDIO[0x00000], 0x4000);
membank("bank3")->configure_entries(3, 5, &AUDIO[0x10000], 0x4000);
m_pandora = machine().device("pandora");
save_item(NAME(m_soundlatch_status));
save_item(NAME(m_soundlatch2_status));
save_item(NAME(m_bg_scrollx));

View File

@ -141,7 +141,6 @@ Notes:
#include "cpu/mcs51/mcs51.h"
#include "sound/2203intf.h"
#include "sound/okim6295.h"
#include "video/kan_pand.h"
#include "includes/djboy.h"
@ -243,7 +242,7 @@ WRITE8_MEMBER(djboy_state::cpu2_bankswitch_w)
static ADDRESS_MAP_START( cpu0_am, AS_PROGRAM, 8, djboy_state )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0xafff) AM_ROMBANK("bank4")
AM_RANGE(0xb000, 0xbfff) AM_DEVREADWRITE_LEGACY("pandora", pandora_spriteram_r, pandora_spriteram_w)
AM_RANGE(0xb000, 0xbfff) AM_DEVREADWRITE("pandora", kaneko_pandora_device, spriteram_r, spriteram_w)
AM_RANGE(0xc000, 0xdfff) AM_ROMBANK("bank1")
AM_RANGE(0xe000, 0xefff) AM_RAM AM_SHARE("share1")
AM_RANGE(0xf000, 0xf7ff) AM_RAM
@ -524,8 +523,6 @@ void djboy_state::machine_start()
membank("bank3")->configure_entries(3, 5, &CPU2[0x10000], 0x4000);
membank("bank4")->configure_entry(0, &MAIN[0x10000]); /* unsure if/how this area is banked */
m_pandora = machine().device("pandora");
save_item(NAME(m_videoreg));
save_item(NAME(m_scrollx));
save_item(NAME(m_scrolly));

View File

@ -129,8 +129,7 @@ void galpanic_state::screen_eof_galpanic(screen_device &screen, bool state)
// rising edge
if (state)
{
device_t *pandora = machine().device("pandora");
pandora_eof(pandora);
m_pandora->eof();
}
}
@ -165,8 +164,6 @@ TIMER_DEVICE_CALLBACK_MEMBER(galpanic_state::galhustl_scanline)
WRITE16_MEMBER(galpanic_state::galpanic_6295_bankswitch_w)
{
device_t *pandora = machine().device("pandora");
if (ACCESSING_BITS_8_15)
{
UINT8 *rom = memregion("oki")->base();
@ -174,7 +171,7 @@ WRITE16_MEMBER(galpanic_state::galpanic_6295_bankswitch_w)
memcpy(&rom[0x30000],&rom[0x40000 + ((data >> 8) & 0x0f) * 0x10000],0x10000);
// used before title screen
pandora_set_clear_bitmap(pandora, (data & 0x8000)>>15);
m_pandora->set_clear_bitmap((data & 0x8000)>>15);
}
}
@ -217,7 +214,7 @@ static ADDRESS_MAP_START( galpanic_map, AS_PROGRAM, 16, galpanic_state )
AM_RANGE(0x500000, 0x51ffff) AM_RAM AM_SHARE("fgvideoram")
AM_RANGE(0x520000, 0x53ffff) AM_RAM_WRITE(galpanic_bgvideoram_w) AM_SHARE("bgvideoram") /* + work RAM */
AM_RANGE(0x600000, 0x6007ff) AM_RAM_WRITE(galpanic_paletteram_w) AM_SHARE("paletteram") /* 1024 colors, but only 512 seem to be used */
AM_RANGE(0x700000, 0x701fff) AM_DEVREADWRITE_LEGACY("pandora", pandora_spriteram_LSB_r, pandora_spriteram_LSB_w)
AM_RANGE(0x700000, 0x701fff) AM_DEVREADWRITE("pandora", kaneko_pandora_device, spriteram_LSB_r, spriteram_LSB_w)
AM_RANGE(0x702000, 0x704fff) AM_RAM
AM_RANGE(0x800000, 0x800001) AM_READ_PORT("DSW1")
AM_RANGE(0x800002, 0x800003) AM_READ_PORT("DSW2")

View File

@ -81,7 +81,9 @@ public:
m_mastercpu(*this, "master"),
m_slavecpu(*this, "slave"),
m_mermaid(*this, "mermaid"),
m_soundcpu(*this, "soundcpu") { }
m_soundcpu(*this, "soundcpu"),
m_pandora(*this, "pandora")
{ }
/* Video */
required_shared_ptr<UINT8> m_videoram;
@ -103,7 +105,8 @@ public:
required_device<cpu_device> m_mastercpu;
required_device<cpu_device> m_slavecpu;
required_device<cpu_device> m_mermaid;
device_t *m_pandora;
required_device<cpu_device> m_soundcpu;
required_device<kaneko_pandora_device> m_pandora;
DECLARE_WRITE8_MEMBER(trigger_nmi_on_slave_cpu);
DECLARE_WRITE8_MEMBER(master_bankswitch_w);
DECLARE_WRITE8_MEMBER(mermaid_data_w);
@ -132,7 +135,6 @@ public:
UINT32 screen_update_hvyunit(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void screen_eof_hvyunit(screen_device &screen, bool state);
TIMER_DEVICE_CALLBACK_MEMBER(hvyunit_scanline);
required_device<cpu_device> m_soundcpu;
};
@ -144,8 +146,6 @@ public:
void hvyunit_state::machine_start()
{
m_pandora = machine().device("pandora");
// TODO: Save state
}
@ -186,7 +186,7 @@ UINT32 hvyunit_state::screen_update_hvyunit(screen_device &screen, bitmap_ind16
m_bg_tilemap->set_scrolly(0, ((m_port0_data & 0x80) << 1) + m_scrolly + SY_POS); // TODO
bitmap.fill(get_black_pen(machine()), cliprect);
m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
pandora_update(m_pandora, bitmap, cliprect);
m_pandora->update(bitmap, cliprect);
return 0;
}
@ -196,7 +196,7 @@ void hvyunit_state::screen_eof_hvyunit(screen_device &screen, bool state)
// rising edge
if (state)
{
pandora_eof(m_pandora);
m_pandora->eof();
}
}
@ -401,7 +401,7 @@ WRITE8_MEMBER(hvyunit_state::mermaid_p3_w)
static ADDRESS_MAP_START( master_memory, AS_PROGRAM, 8, hvyunit_state )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
AM_RANGE(0xc000, 0xcfff) AM_DEVREADWRITE_LEGACY("pandora", pandora_spriteram_r, pandora_spriteram_w)
AM_RANGE(0xc000, 0xcfff) AM_DEVREADWRITE("pandora", kaneko_pandora_device, spriteram_r, spriteram_w)
AM_RANGE(0xd000, 0xdfff) AM_RAM
AM_RANGE(0xe000, 0xffff) AM_RAM AM_SHARE("share1")
ADDRESS_MAP_END

View File

@ -86,10 +86,15 @@ class sandscrp_state : public driver_device
public:
sandscrp_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_view2_0(*this, "view2_0"),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu") { }
m_audiocpu(*this, "audiocpu"),
m_pandora(*this, "pandora"),
m_view2_0(*this, "view2_0")
{ }
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_device<kaneko_pandora_device> m_pandora;
optional_device<kaneko_view2_tilemap_device> m_view2_0;
UINT8 m_sprite_irq;
@ -114,15 +119,12 @@ public:
INTERRUPT_GEN_MEMBER(sandscrp_interrupt);
void update_irq_state();
DECLARE_WRITE_LINE_MEMBER(irqhandler);
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
};
UINT32 sandscrp_state::screen_update_sandscrp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
device_t *pandora = machine().device("pandora");
bitmap.fill(0, cliprect);
int i;
@ -137,7 +139,7 @@ UINT32 sandscrp_state::screen_update_sandscrp(screen_device &screen, bitmap_ind1
}
// copy sprite bitmap to screen
pandora_update(pandora, bitmap, cliprect);
m_pandora->update(bitmap, cliprect);
return 0;
}
@ -176,10 +178,9 @@ void sandscrp_state::screen_eof_sandscrp(screen_device &screen, bool state)
// rising edge
if (state)
{
device_t *pandora = machine().device("pandora");
m_sprite_irq = 1;
update_irq_state();
pandora_eof(pandora);
m_pandora->eof();
}
}
@ -264,7 +265,7 @@ static ADDRESS_MAP_START( sandscrp, AS_PROGRAM, 16, sandscrp_state )
AM_RANGE(0x200000, 0x20001f) AM_DEVREADWRITE("calc1_mcu", kaneko_hit_device, kaneko_hit_r,kaneko_hit_w)
AM_RANGE(0x300000, 0x30001f) AM_DEVREADWRITE("view2_0", kaneko_view2_tilemap_device, kaneko_tmap_regs_r, kaneko_tmap_regs_w)
AM_RANGE(0x400000, 0x403fff) AM_DEVREADWRITE("view2_0", kaneko_view2_tilemap_device, kaneko_tmap_vram_r, kaneko_tmap_vram_w )
AM_RANGE(0x500000, 0x501fff) AM_DEVREADWRITE_LEGACY("pandora", pandora_spriteram_LSB_r, pandora_spriteram_LSB_w ) // sprites
AM_RANGE(0x500000, 0x501fff) AM_DEVREADWRITE("pandora", kaneko_pandora_device, spriteram_LSB_r, spriteram_LSB_w ) // sprites
AM_RANGE(0x600000, 0x600fff) AM_RAM_WRITE(paletteram_xGGGGGRRRRRBBBBB_word_w) AM_SHARE("paletteram") // Palette
AM_RANGE(0xa00000, 0xa00001) AM_WRITE(sandscrp_coin_counter_w) // Coin Counters (Lockout unused)
AM_RANGE(0xb00000, 0xb00001) AM_READ_PORT("P1")

View File

@ -70,7 +70,6 @@ out of the sprite list at that point.. (verify on real hw)
#include "sound/2151intf.h"
#include "sound/3812intf.h"
#include "sound/okim6295.h"
#include "video/kan_pand.h" // for the original pandora
#include "video/kan_panb.h" // for bootlegs / non-original hw
#include "cpu/mcs51/mcs51.h" // for semicom mcu
@ -84,11 +83,9 @@ WRITE16_MEMBER(snowbros_state::snowbros_flipscreen_w)
UINT32 snowbros_state::screen_update_snowbros(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
device_t *pandora = machine().device("pandora");
/* This clears & redraws the entire screen each pass */
bitmap.fill(0xf0, cliprect);
pandora_update(pandora, bitmap, cliprect);
m_pandora->update(bitmap, cliprect);
return 0;
}
@ -98,8 +95,7 @@ void snowbros_state::screen_eof_snowbros(screen_device &screen, bool state)
// rising edge
if (state)
{
device_t *pandora = machine().device("pandora");
pandora_eof(pandora);
m_pandora->eof();
}
}
@ -202,7 +198,7 @@ static ADDRESS_MAP_START( snowbros_map, AS_PROGRAM, 16, snowbros_state )
AM_RANGE(0x500002, 0x500003) AM_READ_PORT("DSW2")
AM_RANGE(0x500004, 0x500005) AM_READ_PORT("SYSTEM")
AM_RANGE(0x600000, 0x6001ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
AM_RANGE(0x700000, 0x701fff) AM_DEVREADWRITE_LEGACY("pandora", pandora_spriteram_LSB_r, pandora_spriteram_LSB_w)
AM_RANGE(0x700000, 0x701fff) AM_DEVREADWRITE("pandora", kaneko_pandora_device, spriteram_LSB_r, spriteram_LSB_w)
AM_RANGE(0x800000, 0x800001) AM_WRITE(snowbros_irq4_ack_w) /* IRQ 4 acknowledge */
AM_RANGE(0x900000, 0x900001) AM_WRITE(snowbros_irq3_ack_w) /* IRQ 3 acknowledge */
AM_RANGE(0xa00000, 0xa00001) AM_WRITE(snowbros_irq2_ack_w) /* IRQ 2 acknowledge */
@ -382,7 +378,7 @@ static ADDRESS_MAP_START( hyperpac_map, AS_PROGRAM, 16, snowbros_state )
AM_RANGE(0x500004, 0x500005) AM_READ_PORT("SYSTEM")
AM_RANGE(0x600000, 0x6001ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
AM_RANGE(0x700000, 0x701fff) AM_DEVREADWRITE_LEGACY("pandora", pandora_spriteram_LSB_r,pandora_spriteram_LSB_w)
AM_RANGE(0x700000, 0x701fff) AM_DEVREADWRITE("pandora", kaneko_pandora_device, spriteram_LSB_r, spriteram_LSB_w)
AM_RANGE(0x800000, 0x800001) AM_WRITE(snowbros_irq4_ack_w) /* IRQ 4 acknowledge */
AM_RANGE(0x900000, 0x900001) AM_WRITE(snowbros_irq3_ack_w) /* IRQ 3 acknowledge */
AM_RANGE(0xa00000, 0xa00001) AM_WRITE(snowbros_irq2_ack_w) /* IRQ 2 acknowledge */
@ -537,7 +533,7 @@ static ADDRESS_MAP_START( finalttr_map, AS_PROGRAM, 16, snowbros_state )
AM_RANGE(0x500004, 0x500005) AM_READ_PORT("SYSTEM")
AM_RANGE(0x600000, 0x6001ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
AM_RANGE(0x700000, 0x701fff) AM_DEVREADWRITE_LEGACY("pandora", pandora_spriteram_LSB_r, pandora_spriteram_LSB_w)
AM_RANGE(0x700000, 0x701fff) AM_DEVREADWRITE("pandora", kaneko_pandora_device, spriteram_LSB_r, spriteram_LSB_w)
AM_RANGE(0x800000, 0x800001) AM_WRITE(snowbros_irq4_ack_w) /* IRQ 4 acknowledge */
AM_RANGE(0x900000, 0x900001) AM_WRITE(snowbros_irq3_ack_w) /* IRQ 3 acknowledge */
AM_RANGE(0xa00000, 0xa00001) AM_WRITE(snowbros_irq2_ack_w) /* IRQ 2 acknowledge */
@ -2788,7 +2784,7 @@ DRIVER_INIT_MEMBER(snowbros_state,cookbib3)
DRIVER_INIT_MEMBER(snowbros_state,pzlbreak)
{
pandora_set_bg_pen(machine().device("pandora"), 0xc0);
m_pandora->set_bg_pen(0xc0);
}
GAME( 1990, snowbros, 0, snowbros, snowbros, driver_device, 0, ROT0, "Toaplan", "Snow Bros. - Nick & Tom (set 1)", 0 )

View File

@ -4,6 +4,8 @@
*************************************************************************/
#include "video/kan_pand.h"
class airbustr_state : public driver_device
{
public:
@ -17,7 +19,9 @@ public:
m_paletteram(*this, "paletteram"),
m_master(*this, "master"),
m_slave(*this, "slave"),
m_audiocpu(*this, "audiocpu"){ }
m_audiocpu(*this, "audiocpu"),
m_pandora(*this, "pandora")
{ }
/* memory pointers */
required_shared_ptr<UINT8> m_devram;
@ -45,7 +49,7 @@ public:
required_device<cpu_device> m_master;
required_device<cpu_device> m_slave;
required_device<cpu_device> m_audiocpu;
device_t *m_pandora;
required_device<kaneko_pandora_device> m_pandora;
DECLARE_READ8_MEMBER(devram_r);
DECLARE_WRITE8_MEMBER(master_nmi_trigger_w);
DECLARE_WRITE8_MEMBER(master_bankswitch_w);

View File

@ -4,6 +4,8 @@
*************************************************************************/
#include "video/kan_pand.h"
#define PROT_OUTPUT_BUFFER_SIZE 8
class djboy_state : public driver_device
@ -16,7 +18,9 @@ public:
m_maincpu(*this, "maincpu"),
m_cpu1(*this, "cpu1"),
m_cpu2(*this, "cpu2"),
m_beast(*this, "beast") { }
m_beast(*this, "beast"),
m_pandora(*this, "pandora")
{ }
/* memory pointers */
required_shared_ptr<UINT8> m_videoram;
@ -46,8 +50,8 @@ public:
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_cpu1;
required_device<cpu_device> m_cpu2;
device_t *m_pandora;
required_device<cpu_device> m_beast;
required_device<kaneko_pandora_device> m_pandora;
DECLARE_WRITE8_MEMBER(beast_data_w);
DECLARE_READ8_MEMBER(beast_data_r);
DECLARE_READ8_MEMBER(beast_status_r);

View File

@ -8,6 +8,7 @@
#define __KANEKO16_H__
#include "machine/nvram.h"
#include "video/kan_pand.h"
#include "video/kaneko_tmap.h"
#include "video/kaneko_spr.h"
#include "machine/kaneko_calc3.h"
@ -22,23 +23,31 @@ public:
kaneko16_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_oki(*this, "oki"),
m_oki1(*this, "oki1"),
m_oki2(*this, "oki2"),
m_eeprom(*this, "eeprom"),
m_spriteram(*this, "spriteram"),
m_mainram(*this, "mainram"),
m_view2_0(*this, "view2_0"),
m_view2_1(*this, "view2_1"),
m_kaneko_spr(*this, "kan_spr"),
m_audiocpu(*this, "audiocpu"),
m_oki(*this, "oki"),
m_oki1(*this, "oki1"),
m_oki2(*this, "oki2"),
m_eeprom(*this, "eeprom") { }
m_pandora(*this, "pandora")
{ }
required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_audiocpu;
optional_device<okim6295_device> m_oki;
optional_device<okim6295_device> m_oki1;
optional_device<okim6295_device> m_oki2;
optional_device<eeprom_device> m_eeprom;
optional_shared_ptr<UINT16> m_spriteram;
optional_shared_ptr<UINT16> m_mainram;
optional_device<kaneko_view2_tilemap_device> m_view2_0;
optional_device<kaneko_view2_tilemap_device> m_view2_1;
optional_device<kaneko16_sprite_device> m_kaneko_spr;
optional_device<kaneko_pandora_device> m_pandora;
UINT16 m_disp_enable;
@ -75,11 +84,6 @@ public:
void kaneko16_common_oki_bank_w( const char *bankname, const char* tag, int bank, size_t fixedsize, size_t bankedsize );
void kaneko16_unscramble_tiles(const char *region);
void kaneko16_expand_sample_banks(const char *region);
optional_device<cpu_device> m_audiocpu;
optional_device<okim6295_device> m_oki;
optional_device<okim6295_device> m_oki1;
optional_device<okim6295_device> m_oki2;
optional_device<eeprom_device> m_eeprom;
};
class kaneko16_gtmr_state : public kaneko16_state

View File

@ -1,25 +1,31 @@
#include "emu.h"
#include "sound/okim6295.h"
#include "video/kan_pand.h" // for the original pandora
class snowbros_state : public driver_device
{
public:
snowbros_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_hyperpac_ram(*this, "hyperpac_ram"),
m_bootleg_spriteram16(*this, "spriteram16b"),
m_maincpu(*this,"maincpu"),
m_soundcpu(*this, "soundcpu"),
m_oki(*this, "oki"){ }
m_oki(*this, "oki"),
m_pandora(*this, "pandora"),
m_hyperpac_ram(*this, "hyperpac_ram"),
m_bootleg_spriteram16(*this, "spriteram16b")
{ }
required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_soundcpu;
optional_device<okim6295_device> m_oki;
optional_device<kaneko_pandora_device> m_pandora;
optional_shared_ptr<UINT16> m_hyperpac_ram;
optional_shared_ptr<UINT16> m_bootleg_spriteram16;
int m_sb3_music_is_playing;
int m_sb3_music;
UINT8 m_semicom_prot_offset;
UINT8 *m_spriteram;
optional_shared_ptr<UINT16> m_bootleg_spriteram16;
required_device<cpu_device> m_maincpu;
DECLARE_WRITE16_MEMBER(snowbros_flipscreen_w);
DECLARE_WRITE16_MEMBER(snowbros_irq4_ack_w);
DECLARE_WRITE16_MEMBER(snowbros_irq3_ack_w);
@ -57,6 +63,4 @@ public:
void sb3_play_music(int data);
void sb3_play_sound (okim6295_device *oki, int data);
DECLARE_WRITE_LINE_MEMBER(irqhandler);
optional_device<cpu_device> m_soundcpu;
optional_device<okim6295_device> m_oki;
};

View File

@ -130,7 +130,7 @@ UINT32 airbustr_state::screen_update_airbustr(screen_device &screen, bitmap_ind1
m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
// copy the sprite bitmap to the screen
pandora_update(m_pandora, bitmap, cliprect);
m_pandora->update(bitmap, cliprect);
return 0;
}
@ -141,6 +141,6 @@ void airbustr_state::screen_eof_airbustr(screen_device &screen, bool state)
if (state)
{
// update the sprite bitmap
pandora_eof(m_pandora);
m_pandora->eof();
}
}

View File

@ -68,7 +68,7 @@ UINT32 djboy_state::screen_update_djboy(screen_device &screen, bitmap_ind16 &bit
m_background->set_scrolly(0, scroll);
m_background->draw(bitmap, cliprect, 0, 0);
pandora_update(m_pandora, bitmap, cliprect);
m_pandora->update(bitmap, cliprect);
return 0;
}
@ -78,6 +78,6 @@ void djboy_state::screen_eof_djboy(screen_device &screen, bool state)
// rising edge
if (state)
{
pandora_eof(m_pandora);
m_pandora->eof();
}
}

View File

@ -98,14 +98,12 @@ void galpanic_state::draw_fgbitmap(bitmap_ind16 &bitmap, const rectangle &clipre
UINT32 galpanic_state::screen_update_galpanic(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
device_t *pandora = machine().device("pandora");
/* copy the temporary bitmap to the screen */
copybitmap(bitmap,m_bitmap,0,0,0,0,cliprect);
draw_fgbitmap(bitmap, cliprect);
pandora_update(pandora, bitmap, cliprect);
m_pandora->update(bitmap, cliprect);
return 0;
}

View File

@ -50,69 +50,95 @@
#include "emu.h"
#include "video/kan_pand.h"
struct kaneko_pandora_state
const device_type KANEKO_PANDORA = &device_creator<kaneko_pandora_device>;
kaneko_pandora_device::kaneko_pandora_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, KANEKO_PANDORA, "Kaneko Pandora - PX79C480FP-3", tag, owner, clock)
{
screen_device *screen;
UINT8 * spriteram;
bitmap_ind16 *sprites_bitmap; /* bitmap to render sprites to, Pandora seems to be frame'buffered' */
int clear_bitmap;
UINT8 region;
int xoffset, yoffset;
int bg_pen; // might work some other way..
};
/*****************************************************************************
INLINE FUNCTIONS
*****************************************************************************/
INLINE kaneko_pandora_state *get_safe_token( device_t *device )
{
assert(device != NULL);
assert(device->type() == KANEKO_PANDORA);
return (kaneko_pandora_state *)downcast<kaneko_pandora_device *>(device)->token();
}
INLINE const kaneko_pandora_interface *get_interface( device_t *device )
//-------------------------------------------------
// device_config_complete - perform any
// operations now that the configuration is
// complete
//-------------------------------------------------
void kaneko_pandora_device::device_config_complete()
{
assert(device != NULL);
assert((device->type() == KANEKO_PANDORA));
return (const kaneko_pandora_interface *) device->static_config();
// inherit a copy of the static data
const kaneko_pandora_interface *intf = reinterpret_cast<const kaneko_pandora_interface *>(static_config());
if (intf != NULL)
*static_cast<kaneko_pandora_interface *>(this) = *intf;
// or initialize to defaults if none provided
else
{
m_screen_tag = "";
m_gfx_region = 0;
m_xoffset = 0;
m_yoffset = 0;
}
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void kaneko_pandora_device::device_start()
{
m_screen = machine().device<screen_device>(m_screen_tag);
m_bg_pen = 0;
m_spriteram = auto_alloc_array(machine(), UINT8, 0x1000);
m_sprites_bitmap = auto_bitmap_ind16_alloc(machine(), m_screen->width(), m_screen->height());
save_item(NAME(m_clear_bitmap));
save_item(NAME(m_bg_pen));
save_pointer(NAME(m_spriteram), 0x1000);
save_item(NAME(*m_sprites_bitmap));
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void kaneko_pandora_device::device_reset()
{
memset(m_spriteram, 0x00, 0x1000);
m_clear_bitmap = 1;
}
/*****************************************************************************
IMPLEMENTATION
*****************************************************************************/
void pandora_set_bg_pen( device_t *device, int pen )
void kaneko_pandora_device::set_bg_pen( int pen )
{
kaneko_pandora_state *pandora = get_safe_token(device);
pandora->bg_pen = pen;
m_bg_pen = pen;
}
void pandora_set_clear_bitmap( device_t *device, int clear )
void kaneko_pandora_device::set_clear_bitmap( int clear )
{
kaneko_pandora_state *pandora = get_safe_token(device);
pandora->clear_bitmap = clear;
m_clear_bitmap = clear;
}
void pandora_update( device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect )
void kaneko_pandora_device::update( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
kaneko_pandora_state *pandora = get_safe_token(device);
if (!pandora->sprites_bitmap)
if (!m_sprites_bitmap)
{
printf("ERROR: pandora_update with no pandora_sprites_bitmap\n");
return;
}
copybitmap_trans(bitmap, *pandora->sprites_bitmap, 0, 0, 0, 0, cliprect, 0);
copybitmap_trans(bitmap, *m_sprites_bitmap, 0, 0, 0, 0, cliprect, 0);
}
static void pandora_draw( device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect )
void kaneko_pandora_device::draw( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
kaneko_pandora_state *pandora = get_safe_token(device);
int sx = 0, sy = 0, x = 0, y = 0, offs;
@ -137,13 +163,13 @@ static void pandora_draw( device_t *device, bitmap_ind16 &bitmap, const rectangl
for (offs = 0; offs < 0x1000; offs += 8)
{
int dx = pandora->spriteram[offs + 4];
int dy = pandora->spriteram[offs + 5];
int tilecolour = pandora->spriteram[offs + 3];
int attr = pandora->spriteram[offs + 7];
int dx = m_spriteram[offs + 4];
int dy = m_spriteram[offs + 5];
int tilecolour = m_spriteram[offs + 3];
int attr = m_spriteram[offs + 7];
int flipx = attr & 0x80;
int flipy = (attr & 0x40) << 1;
int tile = ((attr & 0x3f) << 8) + (pandora->spriteram[offs + 6] & 0xff);
int tile = ((attr & 0x3f) << 8) + (m_spriteram[offs + 6] & 0xff);
if (tilecolour & 1)
dx |= 0x100;
@ -161,7 +187,7 @@ static void pandora_draw( device_t *device, bitmap_ind16 &bitmap, const rectangl
y = dy;
}
if (device->machine().driver_data()->flip_screen())
if (machine().driver_data()->flip_screen())
{
sx = 240 - x;
sy = 240 - y;
@ -175,8 +201,8 @@ static void pandora_draw( device_t *device, bitmap_ind16 &bitmap, const rectangl
}
/* global offset */
sx += pandora->xoffset;
sy += pandora->yoffset;
sx += m_xoffset;
sy += m_yoffset;
sx &= 0x1ff;
sy &= 0x1ff;
@ -186,7 +212,7 @@ static void pandora_draw( device_t *device, bitmap_ind16 &bitmap, const rectangl
if (sy & 0x100)
sy -= 0x200;
drawgfx_transpen(bitmap,cliprect,device->machine().gfx[pandora->region],
drawgfx_transpen(bitmap,cliprect,machine().gfx[m_gfx_region],
tile,
(tilecolour & 0xf0) >> 4,
flipx, flipy,
@ -194,168 +220,89 @@ static void pandora_draw( device_t *device, bitmap_ind16 &bitmap, const rectangl
}
}
void pandora_eof( device_t *device )
void kaneko_pandora_device::eof( )
{
kaneko_pandora_state *pandora = get_safe_token(device);
assert(pandora->spriteram != NULL);
assert(m_spriteram != NULL);
// the games can disable the clearing of the sprite bitmap, to leave sprite trails
if (pandora->clear_bitmap)
pandora->sprites_bitmap->fill(pandora->bg_pen, pandora->screen->visible_area());
if (m_clear_bitmap)
m_sprites_bitmap->fill(m_bg_pen, m_screen->visible_area());
pandora_draw(device, *pandora->sprites_bitmap, pandora->screen->visible_area());
kaneko_pandora_device::draw(*m_sprites_bitmap, m_screen->visible_area());
}
/*****************************************************************************
DEVICE HANDLERS
*****************************************************************************/
WRITE8_DEVICE_HANDLER ( pandora_spriteram_w )
WRITE8_MEMBER ( kaneko_pandora_device::spriteram_w )
{
kaneko_pandora_state *pandora = get_safe_token(device);
// it's either hooked up oddly on this, or on the 16-bit games
// either way, we swap the address lines so that the spriteram is in the same format
offset = BITSWAP16(offset, 15,14,13,12, 11, 7,6,5,4,3,2,1,0, 10,9,8 );
if (!pandora->spriteram)
if (!m_spriteram)
{
printf("ERROR: pandora->spriteram_w with no pandora_spriteram\n");
printf("ERROR: spriteram_w with no m__spriteram\n");
return;
}
if (offset >= 0x1000)
{
logerror("pandora->spriteram_w write past spriteram, offset %04x %02x\n", offset, data);
logerror("spriteram_w write past spriteram, offset %04x %02x\n", offset, data);
return;
}
pandora->spriteram[offset] = data;
m_spriteram[offset] = data;
}
READ8_DEVICE_HANDLER( pandora_spriteram_r )
READ8_MEMBER( kaneko_pandora_device::spriteram_r )
{
kaneko_pandora_state *pandora = get_safe_token(device);
// it's either hooked up oddly on this, or ont the 16-bit games
// either way, we swap the address lines so that the spriteram is in the same format
offset = BITSWAP16(offset, 15,14,13,12, 11, 7,6,5,4,3,2,1,0, 10,9,8 );
if (!pandora->spriteram)
if (!m_spriteram)
{
printf("ERROR: pandora->spriteram_r with no pandora_spriteram\n");
printf("ERROR: spriteram_r with no m_spriteram\n");
return 0x00;
}
if (offset >= 0x1000)
{
logerror("pandora->spriteram_r read past spriteram, offset %04x\n", offset);
logerror("spriteram_r read past spriteram, offset %04x\n", offset);
return 0x00;
}
return pandora->spriteram[offset];
return m_spriteram[offset];
}
/* I don't know if this MSB/LSB mirroring is correct, or if there is twice as much ram, with half of it unused */
WRITE16_DEVICE_HANDLER( pandora_spriteram_LSB_w )
WRITE16_MEMBER( kaneko_pandora_device::spriteram_LSB_w )
{
kaneko_pandora_state *pandora = get_safe_token(device);
if (!pandora->spriteram)
if (!m_spriteram)
{
printf("ERROR: pandora->spriteram_LSB_w with no pandora_spriteram\n");
printf("ERROR: m_spriteram_LSB_w with no m_spriteram\n");
return;
}
if (ACCESSING_BITS_8_15)
{
pandora->spriteram[offset] = (data >> 8) & 0xff;
m_spriteram[offset] = (data >> 8) & 0xff;
}
if (ACCESSING_BITS_0_7)
{
pandora->spriteram[offset] = data & 0xff;
m_spriteram[offset] = data & 0xff;
}
}
READ16_DEVICE_HANDLER( pandora_spriteram_LSB_r )
READ16_MEMBER( kaneko_pandora_device::spriteram_LSB_r )
{
kaneko_pandora_state *pandora = get_safe_token(device);
if (!pandora->spriteram)
if (!m_spriteram)
{
printf("ERROR: pandora_spriteram_LSB_r with no pandora_spriteram\n");
printf("ERROR: spriteram_LSB_r with no m_spriteram\n");
return 0x0000;
}
return pandora->spriteram[offset] | (pandora->spriteram[offset] << 8);
}
/*****************************************************************************
DEVICE INTERFACE
*****************************************************************************/
static DEVICE_START( kaneko_pandora )
{
kaneko_pandora_state *pandora = get_safe_token(device);
const kaneko_pandora_interface *intf = get_interface(device);
pandora->screen = device->machine().device<screen_device>(intf->screen);
pandora->region = intf->gfx_region;
pandora->xoffset = intf->x;
pandora->yoffset = intf->y;
pandora->bg_pen = 0;
pandora->spriteram = auto_alloc_array(device->machine(), UINT8, 0x1000);
pandora->sprites_bitmap = auto_bitmap_ind16_alloc(device->machine(), pandora->screen->width(), pandora->screen->height());
device->save_item(NAME(pandora->clear_bitmap));
device->save_pointer(NAME(pandora->spriteram), 0x1000);
device->save_item(NAME(*pandora->sprites_bitmap));
}
static DEVICE_RESET( kaneko_pandora )
{
kaneko_pandora_state *pandora = get_safe_token(device);
memset(pandora->spriteram, 0x00, 0x1000);
pandora->clear_bitmap = 1;
}
const device_type KANEKO_PANDORA = &device_creator<kaneko_pandora_device>;
kaneko_pandora_device::kaneko_pandora_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, KANEKO_PANDORA, "Kaneko Pandora - PX79C480FP-3", tag, owner, clock)
{
m_token = global_alloc_clear(kaneko_pandora_state);
}
//-------------------------------------------------
// device_config_complete - perform any
// operations now that the configuration is
// complete
//-------------------------------------------------
void kaneko_pandora_device::device_config_complete()
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void kaneko_pandora_device::device_start()
{
DEVICE_START_NAME( kaneko_pandora )(this);
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void kaneko_pandora_device::device_reset()
{
DEVICE_RESET_NAME( kaneko_pandora )(this);
}
return m_spriteram[offset] | (m_spriteram[offset] << 8);
}

View File

@ -17,28 +17,43 @@
struct kaneko_pandora_interface
{
const char *screen;
UINT8 gfx_region;
int x;
int y;
const char *m_screen_tag;
UINT8 m_gfx_region;
int m_xoffset;
int m_yoffset;
};
class kaneko_pandora_device : public device_t
class kaneko_pandora_device : public device_t,
public kaneko_pandora_interface
{
public:
kaneko_pandora_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~kaneko_pandora_device() { global_free(m_token); }
~kaneko_pandora_device() {}
// access to legacy token
void *token() const { assert(m_token != NULL); return m_token; }
DECLARE_WRITE8_MEMBER ( spriteram_w );
DECLARE_READ8_MEMBER( spriteram_r );
DECLARE_WRITE16_MEMBER( spriteram_LSB_w );
DECLARE_READ16_MEMBER( spriteram_LSB_r );
void update( bitmap_ind16 &bitmap, const rectangle &cliprect );
void set_clear_bitmap( int clear );
void eof();
void set_bg_pen( int pen );
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
void draw( bitmap_ind16 &bitmap, const rectangle &cliprect );
private:
// internal state
void *m_token;
screen_device *m_screen;
UINT8 * m_spriteram;
bitmap_ind16 *m_sprites_bitmap; /* bitmap to render sprites to, Pandora seems to be frame'buffered' */
int m_clear_bitmap;
int m_bg_pen; // might work some other way..
};
extern const device_type KANEKO_PANDORA;
@ -53,19 +68,4 @@ extern const device_type KANEKO_PANDORA;
MCFG_DEVICE_CONFIG(_interface)
/***************************************************************************
DEVICE I/O FUNCTIONS
***************************************************************************/
void pandora_update(device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect);
void pandora_eof(device_t *device);
void pandora_set_clear_bitmap(device_t *device, int clear);
void pandora_set_bg_pen( device_t *device, int pen );
DECLARE_WRITE8_DEVICE_HANDLER ( pandora_spriteram_w );
DECLARE_READ8_DEVICE_HANDLER( pandora_spriteram_r );
DECLARE_WRITE16_DEVICE_HANDLER( pandora_spriteram_LSB_w );
DECLARE_READ16_DEVICE_HANDLER( pandora_spriteram_LSB_r );
#endif /* __KAN_PAND_H__ */