Added driver_data struct and save states to the following drivers: lkage.c, lockon.c & lsasquad.c
Added save states to liberate.c
This commit is contained in:
parent
43da9ac917
commit
5fde24c0de
@ -35,25 +35,33 @@ static READ8_HANDLER( deco16_bank_r )
|
||||
return ROM[offset];
|
||||
|
||||
/* Else the handler falls through to read the usual address */
|
||||
if (offset<0x400) return state->colorram[offset];
|
||||
if (offset<0x800) return state->videoram[offset-0x400];
|
||||
if (offset<0x1000) return space->machine->generic.spriteram.u8[offset-0x800];
|
||||
if (offset<0x2200) { logerror("%04x: Unmapped bank read %04x\n",cpu_get_pc(space->cpu),offset); return 0; }
|
||||
if (offset<0x2800) return state->scratchram[offset-0x2200];
|
||||
if (offset < 0x400)
|
||||
return state->colorram[offset];
|
||||
if (offset < 0x800)
|
||||
return state->videoram[offset - 0x400];
|
||||
if (offset < 0x1000)
|
||||
return state->spriteram[offset - 0x800];
|
||||
if (offset < 0x2200)
|
||||
{
|
||||
logerror("%04x: Unmapped bank read %04x\n", cpu_get_pc(space->cpu), offset);
|
||||
return 0;
|
||||
}
|
||||
if (offset < 0x2800)
|
||||
return state->scratchram[offset - 0x2200];
|
||||
|
||||
logerror("%04x: Unmapped bank read %04x\n",cpu_get_pc(space->cpu),offset);
|
||||
logerror("%04x: Unmapped bank read %04x\n", cpu_get_pc(space->cpu), offset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static READ8_HANDLER( deco16_io_r )
|
||||
{
|
||||
if (offset==0) return input_port_read(space->machine, "IN1"); /* Player 1 controls */
|
||||
if (offset==1) return input_port_read(space->machine, "IN2"); /* Player 2 controls */
|
||||
if (offset==2) return input_port_read(space->machine, "IN3"); /* Vblank, coins */
|
||||
if (offset==3) return input_port_read(space->machine, "DSW1"); /* Dip 1 */
|
||||
if (offset==4) return input_port_read(space->machine, "DSW2"); /* Dip 2 */
|
||||
if (offset == 0) return input_port_read(space->machine, "IN1"); /* Player 1 controls */
|
||||
if (offset == 1) return input_port_read(space->machine, "IN2"); /* Player 2 controls */
|
||||
if (offset == 2) return input_port_read(space->machine, "IN3"); /* Vblank, coins */
|
||||
if (offset == 3) return input_port_read(space->machine, "DSW1"); /* Dip 1 */
|
||||
if (offset == 4) return input_port_read(space->machine, "DSW2"); /* Dip 2 */
|
||||
|
||||
logerror("%04x: Read input %d\n",cpu_get_pc(space->cpu),offset);
|
||||
logerror("%04x: Read input %d\n", cpu_get_pc(space->cpu), offset);
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
@ -63,9 +71,9 @@ static WRITE8_HANDLER( deco16_bank_w )
|
||||
state->bank = data;
|
||||
|
||||
if (state->bank)
|
||||
memory_install_read8_handler(cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x8000, 0x800f, 0, 0, deco16_io_r);
|
||||
memory_install_read8_handler(cpu_get_address_space(state->maincpu, ADDRESS_SPACE_PROGRAM), 0x8000, 0x800f, 0, 0, deco16_io_r);
|
||||
else
|
||||
memory_install_read_bank(cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x8000, 0x800f, 0, 0, "bank1");
|
||||
memory_install_read_bank(cpu_get_address_space(state->maincpu, ADDRESS_SPACE_PROGRAM), 0x8000, 0x800f, 0, 0, "bank1");
|
||||
}
|
||||
|
||||
static READ8_HANDLER( prosoccr_bank_r )
|
||||
@ -78,14 +86,23 @@ static READ8_HANDLER( prosoccr_bank_r )
|
||||
return ROM[offset];
|
||||
|
||||
/* Else the handler falls through to read the usual address */
|
||||
if (offset<0x400) return state->colorram[offset];
|
||||
if (offset<0x800) return state->videoram[offset-0x400];
|
||||
if (offset<0xc00) return state->colorram[offset-0x800];
|
||||
if (offset<0x1000) return space->machine->generic.spriteram.u8[offset-0xc00];
|
||||
if (offset<0x2200) { logerror("%04x: Unmapped bank read %04x\n",cpu_get_pc(space->cpu),offset); return 0; }
|
||||
if (offset<0x2800) return state->scratchram[offset-0x2200];
|
||||
if (offset < 0x400)
|
||||
return state->colorram[offset];
|
||||
if (offset < 0x800)
|
||||
return state->videoram[offset - 0x400];
|
||||
if (offset < 0xc00)
|
||||
return state->colorram[offset - 0x800];
|
||||
if (offset < 0x1000)
|
||||
return state->spriteram[offset - 0xc00];
|
||||
if (offset < 0x2200)
|
||||
{
|
||||
logerror("%04x: Unmapped bank read %04x\n", cpu_get_pc(space->cpu), offset);
|
||||
return 0;
|
||||
}
|
||||
if (offset < 0x2800)
|
||||
return state->scratchram[offset - 0x2200];
|
||||
|
||||
logerror("%04x: Unmapped bank read %04x\n",cpu_get_pc(space->cpu),offset);
|
||||
logerror("%04x: Unmapped bank read %04x\n", cpu_get_pc(space->cpu), offset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -96,19 +113,19 @@ static READ8_HANDLER( prosoccr_charram_r )
|
||||
|
||||
if (state->gfx_rom_readback)
|
||||
{
|
||||
switch(offset & 0x1800)
|
||||
switch (offset & 0x1800)
|
||||
{
|
||||
case 0x0000:
|
||||
return SRC_GFX[(offset & 0x7ff)+(0x0000)+0x0000];
|
||||
return SRC_GFX[(offset & 0x7ff) + (0x0000) + 0x0000];
|
||||
case 0x0800:
|
||||
return SRC_GFX[(offset & 0x7ff)+(0x0000)+0x2000];
|
||||
return SRC_GFX[(offset & 0x7ff) + (0x0000) + 0x2000];
|
||||
case 0x1000:
|
||||
return SRC_GFX[(offset & 0x7ff)+(0x0000)+0x4000];
|
||||
return SRC_GFX[(offset & 0x7ff) + (0x0000) + 0x4000];
|
||||
}
|
||||
}
|
||||
|
||||
/* note: gfx_rom_readback == 1 never happens. */
|
||||
return state->charram[offset+state->gfx_rom_readback*0x1800];
|
||||
return state->charram[offset + state->gfx_rom_readback * 0x1800];
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( prosoccr_charram_w )
|
||||
@ -118,43 +135,44 @@ static WRITE8_HANDLER( prosoccr_charram_w )
|
||||
|
||||
if (state->bank)
|
||||
{
|
||||
prosoccr_io_w(space,offset & 0xf,data);
|
||||
prosoccr_io_w(space, offset & 0x0f, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* note: gfx_rom_readback == 1 never happens. */
|
||||
state->charram[offset+state->gfx_rom_readback*0x1800] = data;
|
||||
state->charram[offset + state->gfx_rom_readback * 0x1800] = data;
|
||||
|
||||
switch(offset & 0x1800)
|
||||
switch (offset & 0x1800)
|
||||
{
|
||||
case 0x0000:
|
||||
FG_GFX[(offset & 0x7ff)+(0x0000)+0x0000] = data;
|
||||
//FG_GFX[(offset & 0x7ff)+(0x1800)+0x0000] = data;
|
||||
FG_GFX[(offset & 0x7ff) + (0x0000) + 0x0000] = data;
|
||||
//FG_GFX[(offset & 0x7ff) + (0x1800) + 0x0000] = data;
|
||||
break;
|
||||
case 0x0800:
|
||||
FG_GFX[(offset & 0x7ff)+(0x0000)+0x2000] = data;
|
||||
//FG_GFX[(offset & 0x7ff)+(0x1800)+0x2000] = data;
|
||||
FG_GFX[(offset & 0x7ff) + (0x0000) + 0x2000] = data;
|
||||
//FG_GFX[(offset & 0x7ff) + (0x1800) + 0x2000] = data;
|
||||
break;
|
||||
case 0x1000:
|
||||
FG_GFX[(offset & 0x7ff)+(0x0000)+0x4000] = data;
|
||||
//FG_GFX[(offset & 0x7ff)+(0x1800)+0x4000] = data;
|
||||
FG_GFX[(offset & 0x7ff) + (0x0000) + 0x4000] = data;
|
||||
//FG_GFX[(offset & 0x7ff) + (0x1800) + 0x4000] = data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
offset&=0x7ff;
|
||||
offset &= 0x7ff;
|
||||
|
||||
/* dirty char */
|
||||
gfx_element_mark_dirty(space->machine->gfx[0], offset >> 3);
|
||||
// gfx_element_mark_dirty(space->machine->gfx[0], (offset|0x1800) >> 3);
|
||||
// gfx_element_mark_dirty(space->machine->gfx[0], (offset | 0x1800) >> 3);
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( prosoccr_char_bank_w )
|
||||
{
|
||||
liberate_state *state = (liberate_state *)space->machine->driver_data;
|
||||
state->gfx_rom_readback = data & 1; //enable GFX rom read-back
|
||||
if(data & 0xfe)
|
||||
printf("%02x\n",data);
|
||||
|
||||
if (data & 0xfe)
|
||||
printf("%02x\n", data);
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( prosoccr_io_bank_w )
|
||||
@ -163,9 +181,9 @@ static WRITE8_HANDLER( prosoccr_io_bank_w )
|
||||
state->bank = data & 1;
|
||||
|
||||
if (state->bank)
|
||||
memory_install_read8_handler(cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x8000, 0x800f, 0, 0, deco16_io_r);
|
||||
memory_install_read8_handler(cpu_get_address_space(state->maincpu, ADDRESS_SPACE_PROGRAM), 0x8000, 0x800f, 0, 0, deco16_io_r);
|
||||
else
|
||||
memory_install_read8_handler(cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x8000, 0x800f, 0, 0, prosoccr_charram_r);
|
||||
memory_install_read8_handler(cpu_get_address_space(state->maincpu, ADDRESS_SPACE_PROGRAM), 0x8000, 0x800f, 0, 0, prosoccr_charram_r);
|
||||
|
||||
}
|
||||
|
||||
@ -173,17 +191,17 @@ static READ8_HANDLER( prosport_charram_r )
|
||||
{
|
||||
UINT8 *FG_GFX = memory_region(space->machine, "progolf_fg_gfx");
|
||||
|
||||
switch(offset & 0x1800)
|
||||
switch (offset & 0x1800)
|
||||
{
|
||||
case 0x0000:
|
||||
return FG_GFX[(offset & 0x7ff)+(0x0800)+0x0000];
|
||||
//FG_GFX[(offset & 0x7ff)+(0x1800)+0x0000] = data;
|
||||
return FG_GFX[(offset & 0x7ff) + (0x0800) + 0x0000];
|
||||
//FG_GFX[(offset & 0x7ff) + (0x1800) + 0x0000] = data;
|
||||
case 0x0800:
|
||||
return FG_GFX[(offset & 0x7ff)+(0x0800)+0x2000];
|
||||
//FG_GFX[(offset & 0x7ff)+(0x1800)+0x2000] = data;
|
||||
return FG_GFX[(offset & 0x7ff) + (0x0800) + 0x2000];
|
||||
//FG_GFX[(offset & 0x7ff) + (0x1800) + 0x2000] = data;
|
||||
case 0x1000:
|
||||
return FG_GFX[(offset & 0x7ff)+(0x0800)+0x4000];
|
||||
//FG_GFX[(offset & 0x7ff)+(0x1800)+0x4000] = data;
|
||||
return FG_GFX[(offset & 0x7ff) + (0x0800) + 0x4000];
|
||||
//FG_GFX[(offset & 0x7ff) + (0x1800) + 0x4000] = data;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -193,27 +211,27 @@ static WRITE8_HANDLER( prosport_charram_w )
|
||||
{
|
||||
UINT8 *FG_GFX = memory_region(space->machine, "progolf_fg_gfx");
|
||||
|
||||
switch(offset & 0x1800)
|
||||
switch (offset & 0x1800)
|
||||
{
|
||||
case 0x0000:
|
||||
FG_GFX[(offset & 0x7ff)+(0x0800)+0x0000] = data;
|
||||
//FG_GFX[(offset & 0x7ff)+(0x1800)+0x0000] = data;
|
||||
FG_GFX[(offset & 0x7ff) + (0x0800) + 0x0000] = data;
|
||||
//FG_GFX[(offset & 0x7ff) + (0x1800) + 0x0000] = data;
|
||||
break;
|
||||
case 0x0800:
|
||||
FG_GFX[(offset & 0x7ff)+(0x0800)+0x2000] = data;
|
||||
//FG_GFX[(offset & 0x7ff)+(0x1800)+0x2000] = data;
|
||||
FG_GFX[(offset & 0x7ff) + (0x0800) + 0x2000] = data;
|
||||
//FG_GFX[(offset & 0x7ff) + (0x1800) + 0x2000] = data;
|
||||
break;
|
||||
case 0x1000:
|
||||
FG_GFX[(offset & 0x7ff)+(0x0800)+0x4000] = data;
|
||||
//FG_GFX[(offset & 0x7ff)+(0x1800)+0x4000] = data;
|
||||
FG_GFX[(offset & 0x7ff) + (0x0800) + 0x4000] = data;
|
||||
//FG_GFX[(offset & 0x7ff) + (0x1800) + 0x4000] = data;
|
||||
break;
|
||||
}
|
||||
|
||||
offset&=0x7ff;
|
||||
offset &= 0x7ff;
|
||||
|
||||
/* dirty char */
|
||||
gfx_element_mark_dirty(space->machine->gfx[3], (offset+0x800) >> 3);
|
||||
gfx_element_mark_dirty(space->machine->gfx[3+4], (offset+0x800) >> 5);
|
||||
gfx_element_mark_dirty(space->machine->gfx[3], (offset + 0x800) >> 3);
|
||||
gfx_element_mark_dirty(space->machine->gfx[3 + 4], (offset + 0x800) >> 5);
|
||||
}
|
||||
|
||||
|
||||
@ -224,14 +242,14 @@ static WRITE8_HANDLER( prosport_charram_w )
|
||||
*************************************/
|
||||
|
||||
static ADDRESS_MAP_START( prosport_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0200, 0x021f) AM_RAM_WRITE(prosport_paletteram_w) AM_BASE_GENERIC(paletteram)
|
||||
AM_RANGE(0x0200, 0x021f) AM_RAM_WRITE(prosport_paletteram_w) AM_BASE_MEMBER(liberate_state, paletteram)
|
||||
AM_RANGE(0x0000, 0x03ff) AM_MIRROR(0x2000) AM_RAM
|
||||
AM_RANGE(0x0400, 0x07ff) AM_RAM_WRITE(prosport_bg_vram_w) AM_BASE_MEMBER(liberate_state,bg_vram)
|
||||
AM_RANGE(0x0400, 0x07ff) AM_RAM_WRITE(prosport_bg_vram_w) AM_BASE_MEMBER(liberate_state, bg_vram)
|
||||
AM_RANGE(0x0800, 0x1fff) AM_READWRITE(prosport_charram_r,prosport_charram_w) //0x1e00-0x1fff isn't charram!
|
||||
AM_RANGE(0x2400, 0x2fff) AM_RAM
|
||||
AM_RANGE(0x3000, 0x33ff) AM_RAM_WRITE(liberate_colorram_w) AM_BASE_MEMBER(liberate_state,colorram)
|
||||
AM_RANGE(0x3400, 0x37ff) AM_RAM_WRITE(liberate_videoram_w) AM_BASE_MEMBER(liberate_state,videoram)
|
||||
AM_RANGE(0x3800, 0x3fff) AM_RAM AM_BASE_GENERIC(spriteram)
|
||||
AM_RANGE(0x3000, 0x33ff) AM_RAM_WRITE(liberate_colorram_w) AM_BASE_MEMBER(liberate_state, colorram)
|
||||
AM_RANGE(0x3400, 0x37ff) AM_RAM_WRITE(liberate_videoram_w) AM_BASE_MEMBER(liberate_state, videoram)
|
||||
AM_RANGE(0x3800, 0x3fff) AM_RAM AM_BASE_MEMBER(liberate_state, spriteram)
|
||||
AM_RANGE(0x8000, 0x800f) AM_WRITE(prosport_io_w)
|
||||
AM_RANGE(0x8000, 0x800f) AM_ROMBANK("bank1")
|
||||
AM_RANGE(0x4000, 0xffff) AM_ROM
|
||||
@ -241,10 +259,10 @@ static ADDRESS_MAP_START( liberate_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x0fff) AM_RAM
|
||||
AM_RANGE(0x1000, 0x3fff) AM_ROM /* Mirror of main rom */
|
||||
AM_RANGE(0x4000, 0x7fff) AM_READ(deco16_bank_r)
|
||||
AM_RANGE(0x4000, 0x43ff) AM_WRITE(liberate_colorram_w) AM_BASE_MEMBER(liberate_state,colorram)
|
||||
AM_RANGE(0x4400, 0x47ff) AM_WRITE(liberate_videoram_w) AM_BASE_MEMBER(liberate_state,videoram)
|
||||
AM_RANGE(0x4800, 0x4fff) AM_WRITEONLY AM_BASE_GENERIC(spriteram)
|
||||
AM_RANGE(0x6200, 0x67ff) AM_RAM AM_BASE_MEMBER(liberate_state,scratchram)
|
||||
AM_RANGE(0x4000, 0x43ff) AM_WRITE(liberate_colorram_w) AM_BASE_MEMBER(liberate_state, colorram)
|
||||
AM_RANGE(0x4400, 0x47ff) AM_WRITE(liberate_videoram_w) AM_BASE_MEMBER(liberate_state, videoram)
|
||||
AM_RANGE(0x4800, 0x4fff) AM_WRITEONLY AM_BASE_MEMBER(liberate_state, spriteram)
|
||||
AM_RANGE(0x6200, 0x67ff) AM_RAM AM_BASE_MEMBER(liberate_state, scratchram)
|
||||
AM_RANGE(0x8000, 0x800f) AM_WRITE(deco16_io_w)
|
||||
AM_RANGE(0x8000, 0x800f) AM_ROMBANK("bank1")
|
||||
AM_RANGE(0x8000, 0xffff) AM_ROM
|
||||
@ -254,11 +272,11 @@ static ADDRESS_MAP_START( prosoccr_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x0fff) AM_RAM
|
||||
AM_RANGE(0x1000, 0x3fff) AM_ROM /* Mirror of main rom */
|
||||
AM_RANGE(0x4000, 0x7fff) AM_READ(prosoccr_bank_r)
|
||||
AM_RANGE(0x4000, 0x43ff) AM_MIRROR(0x800) AM_WRITE(liberate_colorram_w) AM_BASE_MEMBER(liberate_state,colorram)
|
||||
AM_RANGE(0x4400, 0x47ff) AM_WRITE(liberate_videoram_w) AM_BASE_MEMBER(liberate_state,videoram)
|
||||
AM_RANGE(0x4c00, 0x4fff) AM_WRITEONLY AM_BASE_GENERIC(spriteram)
|
||||
AM_RANGE(0x6200, 0x67ff) AM_RAM AM_BASE_MEMBER(liberate_state,scratchram)
|
||||
AM_RANGE(0x8000, 0x97ff) AM_READWRITE(prosoccr_charram_r,prosoccr_charram_w)
|
||||
AM_RANGE(0x4000, 0x43ff) AM_MIRROR(0x800) AM_WRITE(liberate_colorram_w) AM_BASE_MEMBER(liberate_state, colorram)
|
||||
AM_RANGE(0x4400, 0x47ff) AM_WRITE(liberate_videoram_w) AM_BASE_MEMBER(liberate_state, videoram)
|
||||
AM_RANGE(0x4c00, 0x4fff) AM_WRITEONLY AM_BASE_MEMBER(liberate_state, spriteram)
|
||||
AM_RANGE(0x6200, 0x67ff) AM_RAM AM_BASE_MEMBER(liberate_state, scratchram)
|
||||
AM_RANGE(0x8000, 0x97ff) AM_READWRITE(prosoccr_charram_r, prosoccr_charram_w)
|
||||
AM_RANGE(0x9800, 0x9800) AM_WRITE(prosoccr_char_bank_w)
|
||||
AM_RANGE(0xa000, 0xffff) AM_ROM
|
||||
ADDRESS_MAP_END
|
||||
@ -278,10 +296,10 @@ static ADDRESS_MAP_START( liberatb_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x0fff) AM_RAM
|
||||
AM_RANGE(0x1000, 0x3fff) AM_ROM /* Mirror of main rom */
|
||||
AM_RANGE(0x4000, 0x7fff) AM_READ(deco16_bank_r)
|
||||
AM_RANGE(0x4000, 0x43ff) AM_WRITE(liberate_colorram_w) AM_BASE_MEMBER(liberate_state,colorram)
|
||||
AM_RANGE(0x4400, 0x47ff) AM_WRITE(liberate_videoram_w) AM_BASE_MEMBER(liberate_state,videoram)
|
||||
AM_RANGE(0x4800, 0x4fff) AM_WRITEONLY AM_BASE_GENERIC(spriteram)
|
||||
AM_RANGE(0x6200, 0x67ff) AM_WRITEONLY AM_BASE_MEMBER(liberate_state,scratchram)
|
||||
AM_RANGE(0x4000, 0x43ff) AM_WRITE(liberate_colorram_w) AM_BASE_MEMBER(liberate_state, colorram)
|
||||
AM_RANGE(0x4400, 0x47ff) AM_WRITE(liberate_videoram_w) AM_BASE_MEMBER(liberate_state, videoram)
|
||||
AM_RANGE(0x4800, 0x4fff) AM_WRITEONLY AM_BASE_MEMBER(liberate_state, spriteram)
|
||||
AM_RANGE(0x6200, 0x67ff) AM_WRITEONLY AM_BASE_MEMBER(liberate_state, scratchram)
|
||||
AM_RANGE(0xf000, 0xf00f) AM_WRITE(deco16_io_w)
|
||||
AM_RANGE(0xf000, 0xf000) AM_READ_PORT("IN1")
|
||||
AM_RANGE(0xf001, 0xf001) AM_READ_PORT("IN2")
|
||||
@ -761,7 +779,7 @@ static INTERRUPT_GEN( deco16_interrupt )
|
||||
else
|
||||
{
|
||||
if (!(p & 0x43))
|
||||
state->latch=0;
|
||||
state->latch = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -779,6 +797,35 @@ static INTERRUPT_GEN( prosport_interrupt )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static MACHINE_START( liberate )
|
||||
{
|
||||
liberate_state *state = (liberate_state *)machine->driver_data;
|
||||
|
||||
state->maincpu = devtag_get_device(machine, "maincpu");
|
||||
state->audiocpu = devtag_get_device(machine, "audiocpu");
|
||||
|
||||
state_save_register_global(machine, state->background_disable);
|
||||
state_save_register_global(machine, state->background_color);
|
||||
state_save_register_global(machine, state->gfx_rom_readback);
|
||||
state_save_register_global(machine, state->latch);
|
||||
state_save_register_global(machine, state->bank);
|
||||
|
||||
state_save_register_global_array(machine, state->io_ram);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( liberate )
|
||||
{
|
||||
liberate_state *state = (liberate_state *)machine->driver_data;
|
||||
|
||||
memset(state->io_ram, 0, ARRAY_LENGTH(state->io_ram));
|
||||
|
||||
state->background_disable = 0;
|
||||
state->background_color = 0;
|
||||
state->gfx_rom_readback = 0;
|
||||
state->latch = 0;
|
||||
state->bank = 0;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( liberate )
|
||||
|
||||
MDRV_DRIVER_DATA(liberate_state)
|
||||
@ -795,6 +842,9 @@ static MACHINE_DRIVER_START( liberate )
|
||||
|
||||
MDRV_QUANTUM_TIME(HZ(12000))
|
||||
|
||||
MDRV_MACHINE_START(liberate)
|
||||
MDRV_MACHINE_RESET(liberate)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
MDRV_SCREEN_REFRESH_RATE(60)
|
||||
@ -879,6 +929,9 @@ static MACHINE_DRIVER_START( prosport )
|
||||
|
||||
// MDRV_QUANTUM_TIME(HZ(12000))
|
||||
|
||||
MDRV_MACHINE_START(liberate)
|
||||
MDRV_MACHINE_RESET(liberate)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
MDRV_SCREEN_REFRESH_RATE(60)
|
||||
@ -1319,8 +1372,8 @@ static void sound_cpu_decrypt(running_machine *machine)
|
||||
int i;
|
||||
|
||||
/* Bit swapping on sound cpu - Opcodes only */
|
||||
for (i=0xc000; i<0x10000; i++)
|
||||
decrypted[i-0xc000]=((rom[i] & 0x20) << 1) | ((rom[i] & 0x40) >> 1) | (rom[i] & 0x9f);
|
||||
for (i = 0xc000; i < 0x10000; i++)
|
||||
decrypted[i - 0xc000] = ((rom[i] & 0x20) << 1) | ((rom[i] & 0x40) >> 1) | (rom[i] & 0x9f);
|
||||
|
||||
memory_set_decrypted_region(space, 0xc000, 0xffff, decrypted);
|
||||
}
|
||||
@ -1331,8 +1384,8 @@ static DRIVER_INIT( prosport )
|
||||
int i;
|
||||
|
||||
/* Main cpu has the nibbles swapped */
|
||||
for (i=0; i<0x10000; i++)
|
||||
RAM[i]=((RAM[i] & 0x0f) << 4) | ((RAM[i] & 0xf0) >> 4);
|
||||
for (i = 0; i < 0x10000; i++)
|
||||
RAM[i] = ((RAM[i] & 0x0f) << 4) | ((RAM[i] & 0xf0) >> 4);
|
||||
|
||||
sound_cpu_decrypt(machine);
|
||||
}
|
||||
@ -1354,7 +1407,7 @@ static DRIVER_INIT( liberate )
|
||||
memory_set_decrypted_region(space, 0x0000, 0xffff, decrypted);
|
||||
|
||||
/* Swap bits for opcodes only, not data */
|
||||
for (A = 0;A < 0x10000;A++) {
|
||||
for (A = 0; A < 0x10000; A++) {
|
||||
decrypted[A] = (ROM[A] & 0xd7) | ((ROM[A] & 0x08) << 2) | ((ROM[A] & 0x20) >> 2);
|
||||
decrypted[A] = (decrypted[A] & 0xbb) | ((decrypted[A] & 0x04) << 4) | ((decrypted[A] & 0x40) >> 4);
|
||||
decrypted[A] = (decrypted[A] & 0x7d) | ((decrypted[A] & 0x02) << 6) | ((decrypted[A] & 0x80) >> 6);
|
||||
@ -1371,14 +1424,14 @@ static DRIVER_INIT( liberate )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
GAME( 1983, prosoccr, 0, prosoccr, prosoccr, prosport, ROT270, "Data East Corporation", "Pro Soccer", 0 )
|
||||
GAME( 1983, prosport, 0, prosport, prosport, prosport, ROT270, "Data East Corporation", "Pro. Sports", GAME_NO_COCKTAIL | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
|
||||
GAME( 1983, prosporta, prosport, prosport, prosport, prosport, ROT270, "Data East Corporation", "Pro. Sports (alternate)", GAME_NO_COCKTAIL | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
|
||||
GAME( 1983, boomrang, 0, boomrang, boomrang, prosport, ROT270, "Data East Corporation", "Boomer Rang'r / Genesis (set 1)", 0 )
|
||||
GAME( 1983, boomranga, boomrang, boomrang, boomrang, prosport, ROT270, "Data East Corporation", "Boomer Rang'r / Genesis (set 2)", 0 )
|
||||
GAME( 1984, kamikcab, 0, boomrang, kamikcab, prosport, ROT270, "Data East Corporation", "Kamikaze Cabbie", 0 )
|
||||
GAME( 1984, yellowcbj, kamikcab, boomrang, yellowcb, yellowcb, ROT270, "Data East Corporation", "Yellow Cab (Japan)", 0 )
|
||||
GAME( 1984, yellowcbb, kamikcab, boomrang, yellowcb, yellowcb, ROT270, "bootleg", "Yellow Cab (bootleg)", 0 )
|
||||
GAME( 1984, liberate, 0, liberate, liberate, liberate, ROT270, "Data East Corporation", "Liberation", 0 )
|
||||
GAME( 1984, dualaslt, liberate, liberate, dualaslt, liberate, ROT270, "Data East USA", "Dual Assault", 0 )
|
||||
GAME( 1984, liberateb, liberate, liberatb, liberatb, prosport, ROT270, "bootleg", "Liberation (bootleg)", 0 )
|
||||
GAME( 1983, prosoccr, 0, prosoccr, prosoccr, prosport, ROT270, "Data East Corporation", "Pro Soccer", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1983, prosport, 0, prosport, prosport, prosport, ROT270, "Data East Corporation", "Pro. Sports", GAME_NO_COCKTAIL | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1983, prosporta, prosport, prosport, prosport, prosport, ROT270, "Data East Corporation", "Pro. Sports (alternate)", GAME_NO_COCKTAIL | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1983, boomrang, 0, boomrang, boomrang, prosport, ROT270, "Data East Corporation", "Boomer Rang'r / Genesis (set 1)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1983, boomranga, boomrang, boomrang, boomrang, prosport, ROT270, "Data East Corporation", "Boomer Rang'r / Genesis (set 2)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1984, kamikcab, 0, boomrang, kamikcab, prosport, ROT270, "Data East Corporation", "Kamikaze Cabbie", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1984, yellowcbj, kamikcab, boomrang, yellowcb, yellowcb, ROT270, "Data East Corporation", "Yellow Cab (Japan)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1984, yellowcbb, kamikcab, boomrang, yellowcb, yellowcb, ROT270, "bootleg", "Yellow Cab (bootleg)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1984, liberate, 0, liberate, liberate, liberate, ROT270, "Data East Corporation", "Liberation", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1984, dualaslt, liberate, liberate, dualaslt, liberate, ROT270, "Data East USA", "Dual Assault", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1984, liberateb, liberate, liberatb, liberatb, prosport, ROT270, "bootleg", "Liberation (bootleg)", GAME_SUPPORTS_SAVE )
|
||||
|
@ -85,32 +85,37 @@ TODO:
|
||||
#include "includes/lkage.h"
|
||||
|
||||
|
||||
static int sound_nmi_enable,pending_nmi;
|
||||
|
||||
static TIMER_CALLBACK( nmi_callback )
|
||||
{
|
||||
if (sound_nmi_enable) cputag_set_input_line(machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
|
||||
else pending_nmi = 1;
|
||||
lkage_state *state = (lkage_state *)machine->driver_data;
|
||||
if (state->sound_nmi_enable)
|
||||
cpu_set_input_line(state->audiocpu, INPUT_LINE_NMI, PULSE_LINE);
|
||||
else
|
||||
state->pending_nmi = 1;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( lkage_sound_command_w )
|
||||
{
|
||||
soundlatch_w(space,offset,data);
|
||||
timer_call_after_resynch(space->machine, NULL, data,nmi_callback);
|
||||
soundlatch_w(space, offset, data);
|
||||
timer_call_after_resynch(space->machine, NULL, data, nmi_callback);
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( lkage_sh_nmi_disable_w )
|
||||
{
|
||||
sound_nmi_enable = 0;
|
||||
lkage_state *state = (lkage_state *)space->machine->driver_data;
|
||||
state->sound_nmi_enable = 0;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( lkage_sh_nmi_enable_w )
|
||||
{
|
||||
sound_nmi_enable = 1;
|
||||
if (pending_nmi)
|
||||
{ /* probably wrong but commands may go lost otherwise */
|
||||
cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
|
||||
pending_nmi = 0;
|
||||
lkage_state *state = (lkage_state *)space->machine->driver_data;
|
||||
|
||||
state->sound_nmi_enable = 1;
|
||||
if (state->pending_nmi)
|
||||
{
|
||||
/* probably wrong but commands may go lost otherwise */
|
||||
cpu_set_input_line(state->audiocpu, INPUT_LINE_NMI, PULSE_LINE);
|
||||
state->pending_nmi = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,7 +123,7 @@ static ADDRESS_MAP_START( lkage_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0xdfff) AM_ROM
|
||||
AM_RANGE(0xe000, 0xe7ff) AM_RAM /* work ram */
|
||||
AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_le_w) AM_BASE_GENERIC(paletteram)
|
||||
AM_RANGE(0xf000, 0xf003) AM_RAM AM_BASE(&lkage_vreg) /* video registers */
|
||||
AM_RANGE(0xf000, 0xf003) AM_RAM AM_BASE_MEMBER(lkage_state, vreg) /* video registers */
|
||||
AM_RANGE(0xf060, 0xf060) AM_WRITE(lkage_sound_command_w)
|
||||
AM_RANGE(0xf061, 0xf061) AM_WRITENOP
|
||||
AM_RANGE(0xf062, 0xf062) AM_READWRITE(lkage_mcu_r,lkage_mcu_w)
|
||||
@ -131,10 +136,10 @@ static ADDRESS_MAP_START( lkage_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0xf086, 0xf086) AM_READ_PORT("P2")
|
||||
AM_RANGE(0xf087, 0xf087) AM_READ(lkage_mcu_status_r)
|
||||
AM_RANGE(0xf0a0, 0xf0a3) AM_RAM /* unknown */
|
||||
AM_RANGE(0xf0c0, 0xf0c5) AM_RAM AM_BASE(&lkage_scroll)
|
||||
AM_RANGE(0xf0c0, 0xf0c5) AM_RAM AM_BASE_MEMBER(lkage_state, scroll)
|
||||
AM_RANGE(0xf0e1, 0xf0e1) AM_WRITENOP /* pulsed */
|
||||
AM_RANGE(0xf100, 0xf15f) AM_RAM AM_BASE_GENERIC(spriteram)
|
||||
AM_RANGE(0xf400, 0xffff) AM_RAM_WRITE(lkage_videoram_w) AM_BASE_GENERIC(videoram) /* videoram */
|
||||
AM_RANGE(0xf100, 0xf15f) AM_RAM AM_BASE_MEMBER(lkage_state, spriteram)
|
||||
AM_RANGE(0xf400, 0xffff) AM_RAM_WRITE(lkage_videoram_w) AM_BASE_MEMBER(lkage_state, videoram)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static READ8_HANDLER( port_fetch_r )
|
||||
@ -148,12 +153,12 @@ ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( lkage_m68705_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
ADDRESS_MAP_GLOBAL_MASK(0x7ff)
|
||||
AM_RANGE(0x0000, 0x0000) AM_READWRITE(lkage_68705_portA_r,lkage_68705_portA_w)
|
||||
AM_RANGE(0x0001, 0x0001) AM_READWRITE(lkage_68705_portB_r,lkage_68705_portB_w)
|
||||
AM_RANGE(0x0002, 0x0002) AM_READWRITE(lkage_68705_portC_r,lkage_68705_portC_w)
|
||||
AM_RANGE(0x0004, 0x0004) AM_WRITE(lkage_68705_ddrA_w)
|
||||
AM_RANGE(0x0005, 0x0005) AM_WRITE(lkage_68705_ddrB_w)
|
||||
AM_RANGE(0x0006, 0x0006) AM_WRITE(lkage_68705_ddrC_w)
|
||||
AM_RANGE(0x0000, 0x0000) AM_READWRITE(lkage_68705_port_a_r,lkage_68705_port_a_w)
|
||||
AM_RANGE(0x0001, 0x0001) AM_READWRITE(lkage_68705_port_b_r,lkage_68705_port_b_w)
|
||||
AM_RANGE(0x0002, 0x0002) AM_READWRITE(lkage_68705_port_c_r,lkage_68705_port_c_w)
|
||||
AM_RANGE(0x0004, 0x0004) AM_WRITE(lkage_68705_ddr_a_w)
|
||||
AM_RANGE(0x0005, 0x0005) AM_WRITE(lkage_68705_ddr_b_w)
|
||||
AM_RANGE(0x0006, 0x0006) AM_WRITE(lkage_68705_ddr_c_w)
|
||||
AM_RANGE(0x0010, 0x007f) AM_RAM
|
||||
AM_RANGE(0x0080, 0x07ff) AM_ROM
|
||||
ADDRESS_MAP_END
|
||||
@ -337,7 +342,8 @@ GFXDECODE_END
|
||||
|
||||
static void irqhandler(running_device *device, int irq)
|
||||
{
|
||||
cputag_set_input_line(device->machine, "audiocpu", 0, irq ? ASSERT_LINE : CLEAR_LINE);
|
||||
lkage_state *state = (lkage_state *)device->machine->driver_data;
|
||||
cpu_set_input_line(state->audiocpu, 0, irq ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
static const ym2203_interface ym2203_config =
|
||||
@ -350,7 +356,69 @@ static const ym2203_interface ym2203_config =
|
||||
irqhandler
|
||||
};
|
||||
|
||||
static MACHINE_START( lkage )
|
||||
{
|
||||
lkage_state *state = (lkage_state *)machine->driver_data;
|
||||
|
||||
state->maincpu = devtag_get_device(machine, "maincpu");
|
||||
state->audiocpu = devtag_get_device(machine, "audiocpu");
|
||||
state->mcu = devtag_get_device(machine, "mcu");
|
||||
|
||||
state_save_register_global(machine, state->bg_tile_bank);
|
||||
state_save_register_global(machine, state->fg_tile_bank);
|
||||
|
||||
state_save_register_global(machine, state->mcu_ready);
|
||||
state_save_register_global(machine, state->mcu_val);
|
||||
state_save_register_global(machine, state->sound_nmi_enable);
|
||||
state_save_register_global(machine, state->pending_nmi);
|
||||
|
||||
state_save_register_global(machine, state->port_a_in);
|
||||
state_save_register_global(machine, state->port_a_out);
|
||||
state_save_register_global(machine, state->ddr_a);
|
||||
state_save_register_global(machine, state->port_b_in);
|
||||
state_save_register_global(machine, state->port_b_out);
|
||||
state_save_register_global(machine, state->ddr_b);
|
||||
state_save_register_global(machine, state->port_c_in);
|
||||
state_save_register_global(machine, state->port_c_out);
|
||||
state_save_register_global(machine, state->ddr_c);
|
||||
state_save_register_global(machine, state->mcu_sent);
|
||||
state_save_register_global(machine, state->main_sent);
|
||||
state_save_register_global(machine, state->from_main);
|
||||
state_save_register_global(machine, state->from_mcu);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( lkage )
|
||||
{
|
||||
lkage_state *state = (lkage_state *)machine->driver_data;
|
||||
|
||||
state->bg_tile_bank = state->fg_tile_bank = 0;
|
||||
|
||||
state->mcu_ready = 3;
|
||||
state->mcu_val = 0;
|
||||
state->sound_nmi_enable = 0;
|
||||
state->pending_nmi = 0;
|
||||
|
||||
state->port_a_in = 0;
|
||||
state->port_a_out = 0;
|
||||
state->ddr_a = 0;
|
||||
state->port_b_in = 0;
|
||||
state->port_b_out = 0;
|
||||
state->ddr_b = 0;
|
||||
state->port_c_in = 0;
|
||||
state->port_c_out = 0;
|
||||
state->ddr_c = 0;
|
||||
state->mcu_sent = 0;
|
||||
state->main_sent = 0;
|
||||
state->from_main = 0;
|
||||
state->from_mcu = 0;
|
||||
}
|
||||
|
||||
|
||||
static MACHINE_DRIVER_START( lkage )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(lkage_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80,6000000)
|
||||
MDRV_CPU_PROGRAM_MAP(lkage_map)
|
||||
@ -364,6 +432,9 @@ static MACHINE_DRIVER_START( lkage )
|
||||
MDRV_CPU_ADD("mcu", M68705,4000000) /* ??? */
|
||||
MDRV_CPU_PROGRAM_MAP(lkage_m68705_map)
|
||||
|
||||
MDRV_MACHINE_START(lkage)
|
||||
MDRV_MACHINE_RESET(lkage)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
MDRV_SCREEN_REFRESH_RATE(60)
|
||||
@ -397,6 +468,10 @@ MACHINE_DRIVER_END
|
||||
|
||||
|
||||
static MACHINE_DRIVER_START( lkageb )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(lkage_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80,6000000)
|
||||
MDRV_CPU_PROGRAM_MAP(lkage_map)
|
||||
@ -407,6 +482,9 @@ static MACHINE_DRIVER_START( lkageb )
|
||||
MDRV_CPU_PROGRAM_MAP(lkage_sound_map)
|
||||
/* IRQs are triggered by the YM2203 */
|
||||
|
||||
MDRV_MACHINE_START(lkage)
|
||||
MDRV_MACHINE_RESET(lkage)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
MDRV_SCREEN_REFRESH_RATE(60)
|
||||
@ -592,40 +670,39 @@ ROM_START( lkageb3 )
|
||||
ROM_LOAD( "a54-10.2", 0x0000, 0x0200, CRC(17dfbd14) SHA1(f8f0b6dfedd4ba108dad43ccc7697ef4ab9cbf86) ) /* unknown */
|
||||
ROM_END
|
||||
|
||||
static UINT8 mcu_val;
|
||||
|
||||
/*Note: This probably uses another MCU dump,which is undumped.*/
|
||||
|
||||
static READ8_HANDLER( fake_mcu_r )
|
||||
{
|
||||
lkage_state *state = (lkage_state *)space->machine->driver_data;
|
||||
int result = 0;
|
||||
|
||||
switch(mcu_val)
|
||||
switch (state->mcu_val)
|
||||
{
|
||||
/*These are for the attract mode*/
|
||||
case 0x01:
|
||||
result = mcu_val-1;
|
||||
result = state->mcu_val - 1;
|
||||
break;
|
||||
|
||||
case 0x90:
|
||||
result = mcu_val+0x43;
|
||||
result = state->mcu_val + 0x43;
|
||||
break;
|
||||
|
||||
/*Gameplay Protection,checked in this order at a start of a play*/
|
||||
case 0xa6:
|
||||
result = mcu_val+0x27;
|
||||
result = state->mcu_val + 0x27;
|
||||
break;
|
||||
|
||||
case 0x34:
|
||||
result = mcu_val+0x7f;
|
||||
result = state->mcu_val + 0x7f;
|
||||
break;
|
||||
|
||||
case 0x48:
|
||||
result = mcu_val+0xb7;
|
||||
result = state->mcu_val + 0xb7;
|
||||
break;
|
||||
|
||||
default:
|
||||
result = mcu_val;
|
||||
result = state->mcu_val;
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
@ -633,13 +710,14 @@ static READ8_HANDLER( fake_mcu_r )
|
||||
|
||||
static WRITE8_HANDLER( fake_mcu_w )
|
||||
{
|
||||
mcu_val = data;
|
||||
lkage_state *state = (lkage_state *)space->machine->driver_data;
|
||||
state->mcu_val = data;
|
||||
}
|
||||
|
||||
static READ8_HANDLER( fake_status_r )
|
||||
{
|
||||
static int res = 3; /* cpu data/mcu ready status */
|
||||
return res;
|
||||
lkage_state *state = (lkage_state *)space->machine->driver_data;
|
||||
return state->mcu_ready;
|
||||
}
|
||||
|
||||
static DRIVER_INIT( lkageb )
|
||||
@ -649,9 +727,9 @@ static DRIVER_INIT( lkageb )
|
||||
memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xf062, 0xf062, 0, 0, fake_mcu_w );
|
||||
}
|
||||
|
||||
GAME( 1984, lkage, 0, lkage, lkage, 0, ROT0, "Taito Corporation", "The Legend of Kage", GAME_NO_COCKTAIL )
|
||||
GAME( 1984, lkageo, lkage, lkage, lkage, 0, ROT0, "Taito Corporation", "The Legend of Kage (older)", GAME_NO_COCKTAIL )
|
||||
GAME( 1984, lkageoo, lkage, lkage, lkage, 0, ROT0, "Taito Corporation", "The Legend of Kage (oldest)", GAME_NO_COCKTAIL )
|
||||
GAME( 1984, lkageb, lkage, lkageb, lkageb, lkageb, ROT0, "bootleg", "The Legend of Kage (bootleg set 1)", GAME_NO_COCKTAIL )
|
||||
GAME( 1984, lkageb2, lkage, lkageb, lkageb, lkageb, ROT0, "bootleg", "The Legend of Kage (bootleg set 2)", GAME_NO_COCKTAIL )
|
||||
GAME( 1984, lkageb3, lkage, lkageb, lkageb, lkageb, ROT0, "bootleg", "The Legend of Kage (bootleg set 3)", GAME_NO_COCKTAIL )
|
||||
GAME( 1984, lkage, 0, lkage, lkage, 0, ROT0, "Taito Corporation", "The Legend of Kage", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1984, lkageo, lkage, lkage, lkage, 0, ROT0, "Taito Corporation", "The Legend of Kage (older)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1984, lkageoo, lkage, lkage, lkage, 0, ROT0, "Taito Corporation", "The Legend of Kage (oldest)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1984, lkageb, lkage, lkageb, lkageb, lkageb, ROT0, "bootleg", "The Legend of Kage (bootleg set 1)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1984, lkageb2, lkage, lkageb, lkageb, lkageb, ROT0, "bootleg", "The Legend of Kage (bootleg set 2)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1984, lkageb3, lkage, lkageb, lkageb, lkageb, ROT0, "bootleg", "The Legend of Kage (bootleg set 3)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
|
||||
|
@ -16,8 +16,8 @@
|
||||
#include "sound/flt_vol.h"
|
||||
#include "includes/lockon.h"
|
||||
|
||||
#define V30_GND_ADDR ((lockon_ctrl_reg & 0x3) << 16)
|
||||
#define V30_OBJ_ADDR ((lockon_ctrl_reg & 0x18) << 13)
|
||||
#define V30_GND_ADDR ((state->ctrl_reg & 0x3) << 16)
|
||||
#define V30_OBJ_ADDR ((state->ctrl_reg & 0x18) << 13)
|
||||
|
||||
|
||||
/*************************************
|
||||
@ -30,16 +30,6 @@ static WRITE8_HANDLER( sound_vol );
|
||||
static READ8_HANDLER( adc_r );
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Globals
|
||||
*
|
||||
*************************************/
|
||||
|
||||
UINT32 lockon_main_inten;
|
||||
UINT8 lockon_ctrl_reg;
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Machine functions
|
||||
@ -63,23 +53,26 @@ UINT8 lockon_ctrl_reg;
|
||||
|
||||
static WRITE16_HANDLER( adrst_w )
|
||||
{
|
||||
lockon_ctrl_reg = data & 0xff;
|
||||
lockon_state *state = (lockon_state *)space->machine->driver_data;
|
||||
state->ctrl_reg = data & 0xff;
|
||||
|
||||
/* Bus mastering for shared access */
|
||||
cputag_set_input_line(space->machine, "ground", INPUT_LINE_HALT, data & 0x04 ? ASSERT_LINE : CLEAR_LINE);
|
||||
cputag_set_input_line(space->machine, "object", INPUT_LINE_HALT, data & 0x20 ? ASSERT_LINE : CLEAR_LINE);
|
||||
cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_HALT, data & 0x40 ? CLEAR_LINE : ASSERT_LINE);
|
||||
cpu_set_input_line(state->ground, INPUT_LINE_HALT, data & 0x04 ? ASSERT_LINE : CLEAR_LINE);
|
||||
cpu_set_input_line(state->object, INPUT_LINE_HALT, data & 0x20 ? ASSERT_LINE : CLEAR_LINE);
|
||||
cpu_set_input_line(state->audiocpu, INPUT_LINE_HALT, data & 0x40 ? CLEAR_LINE : ASSERT_LINE);
|
||||
}
|
||||
|
||||
static READ16_HANDLER( main_gnd_r )
|
||||
{
|
||||
const address_space *gndspace = cputag_get_address_space(space->machine, "ground", ADDRESS_SPACE_PROGRAM);
|
||||
lockon_state *state = (lockon_state *)space->machine->driver_data;
|
||||
const address_space *gndspace = cpu_get_address_space(state->ground, ADDRESS_SPACE_PROGRAM);
|
||||
return memory_read_word(gndspace, V30_GND_ADDR | offset * 2);
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER( main_gnd_w )
|
||||
{
|
||||
const address_space *gndspace = cputag_get_address_space(space->machine, "ground", ADDRESS_SPACE_PROGRAM);
|
||||
lockon_state *state = (lockon_state *)space->machine->driver_data;
|
||||
const address_space *gndspace = cpu_get_address_space(state->ground, ADDRESS_SPACE_PROGRAM);
|
||||
|
||||
if (ACCESSING_BITS_0_7)
|
||||
memory_write_byte(gndspace, V30_GND_ADDR | (offset * 2 + 0), data);
|
||||
@ -89,13 +82,15 @@ static WRITE16_HANDLER( main_gnd_w )
|
||||
|
||||
static READ16_HANDLER( main_obj_r )
|
||||
{
|
||||
const address_space *objspace = cputag_get_address_space(space->machine, "object", ADDRESS_SPACE_PROGRAM);
|
||||
lockon_state *state = (lockon_state *)space->machine->driver_data;
|
||||
const address_space *objspace = cpu_get_address_space(state->object, ADDRESS_SPACE_PROGRAM);
|
||||
return memory_read_word(objspace, V30_OBJ_ADDR | offset * 2);
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER( main_obj_w )
|
||||
{
|
||||
const address_space *objspace = cputag_get_address_space(space->machine, "object", ADDRESS_SPACE_PROGRAM);
|
||||
lockon_state *state = (lockon_state *)space->machine->driver_data;
|
||||
const address_space *objspace = cpu_get_address_space(state->object, ADDRESS_SPACE_PROGRAM);
|
||||
|
||||
if (ACCESSING_BITS_0_7)
|
||||
memory_write_byte(objspace, V30_OBJ_ADDR | (offset * 2 + 0), data);
|
||||
@ -105,10 +100,12 @@ static WRITE16_HANDLER( main_obj_w )
|
||||
|
||||
static WRITE16_HANDLER( tst_w )
|
||||
{
|
||||
lockon_state *state = (lockon_state *)space->machine->driver_data;
|
||||
|
||||
if (offset < 0x800)
|
||||
{
|
||||
const address_space *gndspace = cputag_get_address_space(space->machine, "ground", ADDRESS_SPACE_PROGRAM);
|
||||
const address_space *objspace = cputag_get_address_space(space->machine, "object", ADDRESS_SPACE_PROGRAM);
|
||||
const address_space *gndspace = cpu_get_address_space(state->ground, ADDRESS_SPACE_PROGRAM);
|
||||
const address_space *objspace = cpu_get_address_space(state->object, ADDRESS_SPACE_PROGRAM);
|
||||
|
||||
if (ACCESSING_BITS_0_7)
|
||||
memory_write_byte(gndspace, V30_GND_ADDR | (offset * 2 + 0), data);
|
||||
@ -124,25 +121,29 @@ static WRITE16_HANDLER( tst_w )
|
||||
|
||||
static READ16_HANDLER( main_z80_r )
|
||||
{
|
||||
const address_space *sndspace = cputag_get_address_space(space->machine, "audiocpu", ADDRESS_SPACE_PROGRAM);
|
||||
lockon_state *state = (lockon_state *)space->machine->driver_data;
|
||||
const address_space *sndspace = cpu_get_address_space(state->audiocpu, ADDRESS_SPACE_PROGRAM);
|
||||
return 0xff00 | memory_read_byte(sndspace, offset);
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER( main_z80_w )
|
||||
{
|
||||
const address_space *sndspace = cputag_get_address_space(space->machine, "audiocpu", ADDRESS_SPACE_PROGRAM);
|
||||
lockon_state *state = (lockon_state *)space->machine->driver_data;
|
||||
const address_space *sndspace = cpu_get_address_space(state->audiocpu, ADDRESS_SPACE_PROGRAM);
|
||||
memory_write_byte(sndspace, offset, data);
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER( inten_w )
|
||||
{
|
||||
lockon_main_inten = 1;
|
||||
lockon_state *state = (lockon_state *)space->machine->driver_data;
|
||||
state->main_inten = 1;
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER( emres_w )
|
||||
{
|
||||
lockon_state *state = (lockon_state *)space->machine->driver_data;
|
||||
watchdog_reset(space->machine);
|
||||
lockon_main_inten = 0;
|
||||
state->main_inten = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -157,8 +158,8 @@ static ADDRESS_MAP_START( main_v30, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x00000, 0x03fff) AM_RAM
|
||||
AM_RANGE(0x04000, 0x04003) AM_READWRITE(lockon_crtc_r, lockon_crtc_w)
|
||||
AM_RANGE(0x06000, 0x06001) AM_READ_PORT("DSW")
|
||||
AM_RANGE(0x08000, 0x081ff) AM_RAM AM_BASE(&lockon_hud_ram) AM_SIZE(&lockon_hudram_size)
|
||||
AM_RANGE(0x09000, 0x09fff) AM_RAM_WRITE(lockon_char_w) AM_BASE(&lockon_char_ram)
|
||||
AM_RANGE(0x08000, 0x081ff) AM_RAM AM_BASE_SIZE_MEMBER(lockon_state, hud_ram, hudram_size)
|
||||
AM_RANGE(0x09000, 0x09fff) AM_RAM_WRITE(lockon_char_w) AM_BASE_MEMBER(lockon_state, char_ram)
|
||||
AM_RANGE(0x0a000, 0x0a001) AM_WRITE(adrst_w)
|
||||
AM_RANGE(0x0b000, 0x0bfff) AM_WRITE(lockon_rotate_w)
|
||||
AM_RANGE(0x0c000, 0x0cfff) AM_WRITE(lockon_fb_clut_w)
|
||||
@ -177,8 +178,8 @@ ADDRESS_MAP_END
|
||||
static ADDRESS_MAP_START( ground_v30, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
ADDRESS_MAP_UNMAP_HIGH
|
||||
AM_RANGE(0x00000, 0x03fff) AM_RAM
|
||||
AM_RANGE(0x04000, 0x04fff) AM_RAM AM_BASE(&lockon_scene_ram)
|
||||
AM_RANGE(0x08000, 0x08fff) AM_RAM AM_BASE(&lockon_ground_ram) AM_SIZE(&lockon_groundram_size)
|
||||
AM_RANGE(0x04000, 0x04fff) AM_RAM AM_BASE_MEMBER(lockon_state, scene_ram)
|
||||
AM_RANGE(0x08000, 0x08fff) AM_RAM AM_BASE_SIZE_MEMBER(lockon_state, ground_ram, groundram_size)
|
||||
AM_RANGE(0x0C000, 0x0C001) AM_WRITE(lockon_scene_h_scr_w)
|
||||
AM_RANGE(0x0C002, 0x0C003) AM_WRITE(lockon_scene_v_scr_w)
|
||||
AM_RANGE(0x0C004, 0x0C005) AM_WRITE(lockon_ground_ctrl_w)
|
||||
@ -192,7 +193,7 @@ static ADDRESS_MAP_START( object_v30, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x00000, 0x03fff) AM_RAM
|
||||
AM_RANGE(0x04000, 0x04001) AM_READWRITE(lockon_obj_4000_r, lockon_obj_4000_w)
|
||||
AM_RANGE(0x08000, 0x08fff) AM_WRITE(lockon_tza112_w)
|
||||
AM_RANGE(0x0c000, 0x0c1ff) AM_RAM AM_BASE(&lockon_object_ram) AM_SIZE(&lockon_objectram_size)
|
||||
AM_RANGE(0x0c000, 0x0c1ff) AM_RAM AM_BASE_SIZE_MEMBER(lockon_state, object_ram, objectram_size)
|
||||
AM_RANGE(0x30000, 0x3ffff) AM_MIRROR(0xc0000) AM_ROM
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -391,6 +392,8 @@ static WRITE8_HANDLER( sound_vol )
|
||||
#define LO_RI 100000.0
|
||||
#define LO_RP 100000.0
|
||||
|
||||
lockon_state *state = (lockon_state *)space->machine->driver_data;
|
||||
|
||||
static const double gains[16] =
|
||||
{
|
||||
-( 1 / (1/LO_RP + 1/(LO_R3 + LO_R2 + LO_R1 + LO_R0)) ) / LO_RI,
|
||||
@ -414,18 +417,19 @@ static WRITE8_HANDLER( sound_vol )
|
||||
double lgain = gains[data & 0xf];
|
||||
double rgain = gains[data >> 4];
|
||||
|
||||
flt_volume_set_volume(devtag_get_device(space->machine, "f2203.1l"), lgain);
|
||||
flt_volume_set_volume(devtag_get_device(space->machine, "f2203.2l"), lgain);
|
||||
flt_volume_set_volume(devtag_get_device(space->machine, "f2203.3l"), lgain);
|
||||
flt_volume_set_volume(state->f2203_1l, lgain);
|
||||
flt_volume_set_volume(state->f2203_2l, lgain);
|
||||
flt_volume_set_volume(state->f2203_3l, lgain);
|
||||
|
||||
flt_volume_set_volume(devtag_get_device(space->machine, "f2203.1r"), rgain);
|
||||
flt_volume_set_volume(devtag_get_device(space->machine, "f2203.2r"), rgain);
|
||||
flt_volume_set_volume(devtag_get_device(space->machine, "f2203.3r"), rgain);
|
||||
flt_volume_set_volume(state->f2203_1r, rgain);
|
||||
flt_volume_set_volume(state->f2203_2r, rgain);
|
||||
flt_volume_set_volume(state->f2203_3r, rgain);
|
||||
}
|
||||
|
||||
static void ym2203_irq(running_device *device, int irq)
|
||||
{
|
||||
cputag_set_input_line(device->machine, "audiocpu", 0, irq ? ASSERT_LINE : CLEAR_LINE );
|
||||
lockon_state *state = (lockon_state *)device->machine->driver_data;
|
||||
cpu_set_input_line(state->audiocpu, 0, irq ? ASSERT_LINE : CLEAR_LINE );
|
||||
}
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( ym2203_out_b )
|
||||
@ -458,7 +462,66 @@ static const ym2203_interface ym2203_config =
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static MACHINE_START( lockon )
|
||||
{
|
||||
lockon_state *state = (lockon_state *)machine->driver_data;
|
||||
|
||||
state->maincpu = devtag_get_device(machine, "maincpu");
|
||||
state->audiocpu = devtag_get_device(machine, "audiocpu");
|
||||
state->ground = devtag_get_device(machine, "ground");
|
||||
state->object = devtag_get_device(machine, "object");
|
||||
state->f2203_1l = devtag_get_device(machine, "f2203.1l");
|
||||
state->f2203_2l = devtag_get_device(machine, "f2203.2l");
|
||||
state->f2203_3l = devtag_get_device(machine, "f2203.3l");
|
||||
state->f2203_1r = devtag_get_device(machine, "f2203.1r");
|
||||
state->f2203_2r = devtag_get_device(machine, "f2203.2r");
|
||||
state->f2203_3r = devtag_get_device(machine, "f2203.3r");
|
||||
|
||||
state_save_register_global(machine, state->ground_ctrl);
|
||||
state_save_register_global(machine, state->scroll_h);
|
||||
state_save_register_global(machine, state->scroll_v);
|
||||
state_save_register_global(machine, state->xsal);
|
||||
state_save_register_global(machine, state->x0ll);
|
||||
state_save_register_global(machine, state->dx0ll);
|
||||
state_save_register_global(machine, state->dxll);
|
||||
state_save_register_global(machine, state->ysal);
|
||||
state_save_register_global(machine, state->y0ll);
|
||||
state_save_register_global(machine, state->dy0ll);
|
||||
state_save_register_global(machine, state->dyll);
|
||||
state_save_register_global(machine, state->iden);
|
||||
state_save_register_global(machine, state->obj_pal_latch);
|
||||
state_save_register_global(machine, state->obj_pal_addr);
|
||||
state_save_register_global(machine, state->ctrl_reg);
|
||||
state_save_register_global(machine, state->main_inten);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( lockon )
|
||||
{
|
||||
lockon_state *state = (lockon_state *)machine->driver_data;
|
||||
|
||||
state->ground_ctrl = 0;
|
||||
state->scroll_h = 0;
|
||||
state->scroll_v = 0;
|
||||
state->xsal = 0;
|
||||
state->x0ll = 0;
|
||||
state->dx0ll = 0;
|
||||
state->dxll = 0;
|
||||
state->ysal = 0;
|
||||
state->y0ll = 0;
|
||||
state->dy0ll = 0;
|
||||
state->dyll = 0;
|
||||
state->iden = 0;
|
||||
state->obj_pal_latch = 0;
|
||||
state->obj_pal_addr = 0;
|
||||
state->ctrl_reg = 0;
|
||||
state->main_inten = 0;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( lockon )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(lockon_state)
|
||||
|
||||
MDRV_CPU_ADD("maincpu", V30, XTAL_16MHz / 2)
|
||||
MDRV_CPU_PROGRAM_MAP(main_v30)
|
||||
|
||||
@ -475,6 +538,9 @@ static MACHINE_DRIVER_START( lockon )
|
||||
MDRV_WATCHDOG_TIME_INIT(NSEC(PERIOD_OF_555_ASTABLE_NSEC(10000, 4700, 10000e-12) * 4096))
|
||||
MDRV_QUANTUM_TIME(HZ(600))
|
||||
|
||||
MDRV_MACHINE_START(lockon)
|
||||
MDRV_MACHINE_RESET(lockon)
|
||||
|
||||
MDRV_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK)
|
||||
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
@ -754,5 +820,5 @@ ROM_END
|
||||
*
|
||||
*************************************/
|
||||
|
||||
GAME( 1986, lockon, 0, lockon, lockon, 0, ROT0, "Tatsumi", "Lock-On (rev. E)", 0 )
|
||||
GAME( 1986, lockonc, lockon, lockon, lockone, 0, ROT0, "Tatsumi", "Lock-On (rev. C)", 0 )
|
||||
GAME( 1986, lockon, 0, lockon, lockon, 0, ROT0, "Tatsumi", "Lock-On (rev. E)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1986, lockonc, lockon, lockon, lockone, 0, ROT0, "Tatsumi", "Lock-On (rev. C)", GAME_SUPPORTS_SAVE )
|
||||
|
@ -155,10 +155,8 @@ Notes:
|
||||
|
||||
static WRITE8_HANDLER( lsasquad_bankswitch_w )
|
||||
{
|
||||
UINT8 *ROM = memory_region(space->machine, "maincpu");
|
||||
|
||||
/* bits 0-2 select ROM bank */
|
||||
memory_set_bankptr(space->machine, "bank1",&ROM[0x10000 + 0x2000 * (data & 7)]);
|
||||
memory_set_bank(space->machine, "bank1", data & 0x07);
|
||||
|
||||
/* bit 3 is zeroed on startup, maybe reset sound CPU */
|
||||
|
||||
@ -172,9 +170,9 @@ static ADDRESS_MAP_START( lsasquad_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x7fff) AM_ROM
|
||||
AM_RANGE(0x8000, 0x9fff) AM_ROMBANK("bank1")
|
||||
AM_RANGE(0xa000, 0xbfff) AM_RAM /* SRAM */
|
||||
AM_RANGE(0xc000, 0xdfff) AM_RAM AM_BASE_GENERIC(videoram) AM_SIZE_GENERIC(videoram) /* SCREEN RAM */
|
||||
AM_RANGE(0xe000, 0xe3ff) AM_RAM AM_BASE(&lsasquad_scrollram) /* SCROLL RAM */
|
||||
AM_RANGE(0xe400, 0xe5ff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) /* OBJECT RAM */
|
||||
AM_RANGE(0xc000, 0xdfff) AM_RAM AM_BASE_SIZE_MEMBER(lsasquad_state, videoram, videoram_size) /* SCREEN RAM */
|
||||
AM_RANGE(0xe000, 0xe3ff) AM_RAM AM_BASE_MEMBER(lsasquad_state, scrollram) /* SCROLL RAM */
|
||||
AM_RANGE(0xe400, 0xe5ff) AM_RAM AM_BASE_SIZE_MEMBER(lsasquad_state, spriteram, spriteram_size) /* OBJECT RAM */
|
||||
AM_RANGE(0xe800, 0xe800) AM_READ_PORT("DSWA")
|
||||
AM_RANGE(0xe801, 0xe801) AM_READ_PORT("DSWB")
|
||||
AM_RANGE(0xe802, 0xe802) AM_READ_PORT("DSWC")
|
||||
@ -194,7 +192,7 @@ static ADDRESS_MAP_START( lsasquad_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x8000, 0x87ff) AM_RAM
|
||||
AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE("ymsnd", ym2203_r,ym2203_w)
|
||||
AM_RANGE(0xc000, 0xc001) AM_DEVWRITE("aysnd", ay8910_address_data_w)
|
||||
AM_RANGE(0xd000, 0xd000) AM_READWRITE(lsasquad_sh_sound_command_r,lsasquad_sh_result_w)
|
||||
AM_RANGE(0xd000, 0xd000) AM_READWRITE(lsasquad_sh_sound_command_r, lsasquad_sh_result_w)
|
||||
AM_RANGE(0xd400, 0xd400) AM_WRITE(lsasquad_sh_nmi_disable_w)
|
||||
AM_RANGE(0xd800, 0xd800) AM_WRITE(lsasquad_sh_nmi_enable_w)
|
||||
AM_RANGE(0xd800, 0xd800) AM_READ(lsasquad_sound_status_r)
|
||||
@ -203,11 +201,11 @@ ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( lsasquad_m68705_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
ADDRESS_MAP_GLOBAL_MASK(0x7ff)
|
||||
AM_RANGE(0x0000, 0x0000) AM_READWRITE(lsasquad_68705_portA_r,lsasquad_68705_portA_w)
|
||||
AM_RANGE(0x0001, 0x0001) AM_READWRITE(lsasquad_68705_portB_r,lsasquad_68705_portB_w)
|
||||
AM_RANGE(0x0000, 0x0000) AM_READWRITE(lsasquad_68705_port_a_r,lsasquad_68705_port_a_w)
|
||||
AM_RANGE(0x0001, 0x0001) AM_READWRITE(lsasquad_68705_port_b_r,lsasquad_68705_port_b_w)
|
||||
AM_RANGE(0x0002, 0x0002) AM_READ(lsasquad_mcu_status_r)
|
||||
AM_RANGE(0x0004, 0x0004) AM_WRITE(lsasquad_68705_ddrA_w)
|
||||
AM_RANGE(0x0005, 0x0005) AM_WRITE(lsasquad_68705_ddrB_w)
|
||||
AM_RANGE(0x0004, 0x0004) AM_WRITE(lsasquad_68705_ddr_a_w)
|
||||
AM_RANGE(0x0005, 0x0005) AM_WRITE(lsasquad_68705_ddr_b_w)
|
||||
AM_RANGE(0x0010, 0x007f) AM_RAM
|
||||
AM_RANGE(0x0080, 0x07ff) AM_ROM
|
||||
ADDRESS_MAP_END
|
||||
@ -342,9 +340,9 @@ static ADDRESS_MAP_START( daikaiju_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x7fff) AM_ROM
|
||||
AM_RANGE(0x8000, 0x9fff) AM_ROMBANK("bank1")
|
||||
AM_RANGE(0xa000, 0xbfff) AM_RAM /* SRAM */
|
||||
AM_RANGE(0xc000, 0xdfff) AM_RAM AM_BASE_GENERIC(videoram) AM_SIZE_GENERIC(videoram) /* SCREEN RAM */
|
||||
AM_RANGE(0xe000, 0xe3ff) AM_RAM AM_BASE(&lsasquad_scrollram) /* SCROLL RAM */
|
||||
AM_RANGE(0xe400, 0xe7ff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) /* OBJECT RAM */
|
||||
AM_RANGE(0xc000, 0xdfff) AM_RAM AM_BASE_SIZE_MEMBER(lsasquad_state, videoram, videoram_size) /* SCREEN RAM */
|
||||
AM_RANGE(0xe000, 0xe3ff) AM_RAM AM_BASE_MEMBER(lsasquad_state, scrollram) /* SCROLL RAM */
|
||||
AM_RANGE(0xe400, 0xe7ff) AM_RAM AM_BASE_SIZE_MEMBER(lsasquad_state, spriteram, spriteram_size) /* OBJECT RAM */
|
||||
AM_RANGE(0xe800, 0xe800) AM_READ_PORT("DSWA")
|
||||
AM_RANGE(0xe801, 0xe801) AM_READ_PORT("DSWB")
|
||||
AM_RANGE(0xe803, 0xe803) AM_READ(daikaiju_mcu_status_r) /* COIN + 68705 status */
|
||||
@ -505,7 +503,8 @@ GFXDECODE_END
|
||||
|
||||
static void irqhandler(running_device *device, int irq)
|
||||
{
|
||||
cputag_set_input_line(device->machine, "audiocpu", 0, irq ? ASSERT_LINE : CLEAR_LINE);
|
||||
lsasquad_state *state = (lsasquad_state *)device->machine->driver_data;
|
||||
cpu_set_input_line(state->audiocpu, 0, irq ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( unk )
|
||||
@ -528,8 +527,81 @@ static const ym2203_interface ym2203_config =
|
||||
};
|
||||
|
||||
|
||||
static MACHINE_START( lsasquad )
|
||||
{
|
||||
lsasquad_state *state = (lsasquad_state *)machine->driver_data;
|
||||
UINT8 *ROM = memory_region(machine, "maincpu");
|
||||
|
||||
memory_configure_bank(machine, "bank1", 0, 8, &ROM[0x10000], 0x2000);
|
||||
|
||||
state->maincpu = devtag_get_device(machine, "maincpu");
|
||||
state->audiocpu = devtag_get_device(machine, "audiocpu");
|
||||
state->mcu = devtag_get_device(machine, "mcu");
|
||||
|
||||
state_save_register_global(machine, state->port_a_in);
|
||||
state_save_register_global(machine, state->port_a_out);
|
||||
state_save_register_global(machine, state->ddr_a);
|
||||
state_save_register_global(machine, state->port_b_in);
|
||||
state_save_register_global(machine, state->port_b_out);
|
||||
state_save_register_global(machine, state->ddr_b);
|
||||
state_save_register_global(machine, state->mcu_sent);
|
||||
state_save_register_global(machine, state->main_sent);
|
||||
state_save_register_global(machine, state->from_main);
|
||||
state_save_register_global(machine, state->from_mcu);
|
||||
|
||||
state_save_register_global(machine, state->sound_pending);
|
||||
state_save_register_global(machine, state->sound_nmi_enable);
|
||||
state_save_register_global(machine, state->pending_nmi);
|
||||
state_save_register_global(machine, state->sound_cmd);
|
||||
state_save_register_global(machine, state->sound_result);
|
||||
|
||||
state_save_register_global(machine, state->daikaiju_xor);
|
||||
state_save_register_global(machine, state->daikaiju_command);
|
||||
state_save_register_global(machine, state->daikaiju_length);
|
||||
state_save_register_global(machine, state->daikaiju_prev);
|
||||
state_save_register_global(machine, state->daikaiju_cnt);
|
||||
state_save_register_global(machine, state->daikaiju_cntr);
|
||||
|
||||
state_save_register_global_array(machine, state->daikaiju_buffer);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( lsasquad )
|
||||
{
|
||||
lsasquad_state *state = (lsasquad_state *)machine->driver_data;
|
||||
|
||||
state->sound_pending = 0;
|
||||
state->sound_nmi_enable = 0;
|
||||
state->pending_nmi = 0;
|
||||
state->sound_cmd = 0;
|
||||
state->sound_result = 0;
|
||||
|
||||
state->port_a_in = 0;
|
||||
state->port_a_out = 0;
|
||||
state->ddr_a = 0;
|
||||
state->port_b_in = 0;
|
||||
state->port_b_out = 0;
|
||||
state->ddr_b = 0;
|
||||
state->mcu_sent = 0;
|
||||
state->main_sent = 0;
|
||||
state->from_main = 0;
|
||||
state->from_mcu = 0;
|
||||
|
||||
/* daikaiju */
|
||||
state->daikaiju_xor = -1;
|
||||
state->daikaiju_command = 0;
|
||||
state->daikaiju_length = 0;
|
||||
state->daikaiju_prev = 0;
|
||||
state->daikaiju_cnt = 0;
|
||||
state->daikaiju_cntr = 0;
|
||||
|
||||
memset(state->daikaiju_buffer, 0, ARRAY_LENGTH(state->daikaiju_buffer));
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( lsasquad )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(lsasquad_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80, 6000000) /* 6 MHz? */
|
||||
MDRV_CPU_PROGRAM_MAP(lsasquad_map)
|
||||
@ -545,6 +617,9 @@ static MACHINE_DRIVER_START( lsasquad )
|
||||
/* synchronization of the CPUs */
|
||||
/* main<->sound synchronization depends on this */
|
||||
|
||||
MDRV_MACHINE_START(lsasquad)
|
||||
MDRV_MACHINE_RESET(lsasquad)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
MDRV_SCREEN_REFRESH_RATE(60)
|
||||
@ -575,6 +650,9 @@ MACHINE_DRIVER_END
|
||||
|
||||
static MACHINE_DRIVER_START( daikaiju )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(lsasquad_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80, 6000000)
|
||||
MDRV_CPU_PROGRAM_MAP(daikaiju_map)
|
||||
@ -588,7 +666,8 @@ static MACHINE_DRIVER_START( daikaiju )
|
||||
/* synchronization of the CPUs */
|
||||
/* main<->sound synchronization depends on this */
|
||||
|
||||
MDRV_MACHINE_RESET(daikaiju)
|
||||
MDRV_MACHINE_START(lsasquad)
|
||||
MDRV_MACHINE_RESET(lsasquad)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
@ -730,11 +809,19 @@ ROM_END
|
||||
|
||||
|
||||
/* coin inputs are inverted in storming */
|
||||
static DRIVER_INIT( lsasquad ) { lsasquad_invertcoin = 0x00; }
|
||||
static DRIVER_INIT( storming ) { lsasquad_invertcoin = 0x0c; }
|
||||
static DRIVER_INIT( lsasquad )
|
||||
{
|
||||
lsasquad_state *state = (lsasquad_state *)machine->driver_data;
|
||||
state->invertcoin = 0x00;
|
||||
}
|
||||
|
||||
static DRIVER_INIT( storming )
|
||||
{
|
||||
lsasquad_state *state = (lsasquad_state *)machine->driver_data;
|
||||
state->invertcoin = 0x0c;
|
||||
}
|
||||
|
||||
|
||||
GAME( 1986, lsasquad, 0, lsasquad, lsasquad, lsasquad, ROT270, "Taito", "Land Sea Air Squad / Riku Kai Kuu Saizensen", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1986, storming, lsasquad, lsasquad, lsasquad, storming, ROT270, "Taito", "Storming Party / Riku Kai Kuu Saizensen", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1986, daikaiju, 0, daikaiju, daikaiju, 0, ROT270, "Taito", "Daikaiju no Gyakushu", GAME_IMPERFECT_GRAPHICS | GAME_UNEMULATED_PROTECTION)
|
||||
|
||||
GAME( 1986, lsasquad, 0, lsasquad, lsasquad, lsasquad, ROT270, "Taito", "Land Sea Air Squad / Riku Kai Kuu Saizensen", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1986, storming, lsasquad, lsasquad, lsasquad, storming, ROT270, "Taito", "Storming Party / Riku Kai Kuu Saizensen", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1986, daikaiju, 0, daikaiju, daikaiju, 0, ROT270, "Taito", "Daikaiju no Gyakushu", GAME_IMPERFECT_GRAPHICS | GAME_UNEMULATED_PROTECTION | GAME_SUPPORTS_SAVE )
|
||||
|
@ -1,19 +1,27 @@
|
||||
typedef struct _liberate_state liberate_state;
|
||||
struct _liberate_state
|
||||
{
|
||||
UINT8 *videoram;
|
||||
UINT8 *colorram;
|
||||
UINT8 *paletteram;
|
||||
UINT8 *spriteram;
|
||||
UINT8 *scratchram;
|
||||
UINT8 *charram; /* prosoccr */
|
||||
UINT8 *bg_vram; /* prosport */
|
||||
|
||||
UINT8 io_ram[16];
|
||||
|
||||
int bank;
|
||||
int latch;
|
||||
UINT8 gfx_rom_readback;
|
||||
int background_color;
|
||||
int background_disable;
|
||||
tilemap_t *background_tilemap;
|
||||
|
||||
tilemap_t *back_tilemap;
|
||||
tilemap_t *fix_tilemap;
|
||||
UINT8 io_ram[16];
|
||||
UINT8 *videoram;
|
||||
UINT8 *colorram;
|
||||
UINT8 *scratchram;
|
||||
UINT8 *charram; /* prosoccr */
|
||||
UINT8 *bg_vram; /* prosport */
|
||||
|
||||
running_device *maincpu;
|
||||
running_device *audiocpu;
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,14 +1,48 @@
|
||||
|
||||
typedef struct _lkage_state lkage_state;
|
||||
struct _lkage_state
|
||||
{
|
||||
UINT8 * scroll;
|
||||
UINT8 * vreg;
|
||||
UINT8 * videoram;
|
||||
UINT8 * spriteram;
|
||||
// UINT8 * paletteram; // currently this uses generic palette handling
|
||||
|
||||
/* video-related */
|
||||
tilemap_t *bg_tilemap, *fg_tilemap, *tx_tilemap;
|
||||
UINT8 bg_tile_bank, fg_tile_bank;
|
||||
|
||||
/* misc */
|
||||
int sound_nmi_enable, pending_nmi;
|
||||
|
||||
/* mcu */
|
||||
UINT8 from_main, from_mcu;
|
||||
int mcu_sent, main_sent;
|
||||
UINT8 port_a_in, port_a_out, ddr_a;
|
||||
UINT8 port_b_in, port_b_out, ddr_b;
|
||||
UINT8 port_c_in, port_c_out, ddr_c;
|
||||
|
||||
/* lkageb fake mcu */
|
||||
UINT8 mcu_val;
|
||||
int mcu_ready; /* cpu data/mcu ready status */
|
||||
|
||||
/* devices */
|
||||
running_device *maincpu;
|
||||
running_device *audiocpu;
|
||||
running_device *mcu;
|
||||
};
|
||||
|
||||
/*----------- defined in machine/lkage.c -----------*/
|
||||
|
||||
READ8_HANDLER( lkage_68705_portA_r );
|
||||
WRITE8_HANDLER( lkage_68705_portA_w );
|
||||
READ8_HANDLER( lkage_68705_portB_r );
|
||||
WRITE8_HANDLER( lkage_68705_portB_w );
|
||||
READ8_HANDLER( lkage_68705_portC_r );
|
||||
WRITE8_HANDLER( lkage_68705_portC_w );
|
||||
WRITE8_HANDLER( lkage_68705_ddrA_w );
|
||||
WRITE8_HANDLER( lkage_68705_ddrB_w );
|
||||
WRITE8_HANDLER( lkage_68705_ddrC_w );
|
||||
READ8_HANDLER( lkage_68705_port_a_r );
|
||||
WRITE8_HANDLER( lkage_68705_port_a_w );
|
||||
READ8_HANDLER( lkage_68705_port_b_r );
|
||||
WRITE8_HANDLER( lkage_68705_port_b_w );
|
||||
READ8_HANDLER( lkage_68705_port_c_r );
|
||||
WRITE8_HANDLER( lkage_68705_port_c_w );
|
||||
WRITE8_HANDLER( lkage_68705_ddr_a_w );
|
||||
WRITE8_HANDLER( lkage_68705_ddr_b_w );
|
||||
WRITE8_HANDLER( lkage_68705_ddr_c_w );
|
||||
WRITE8_HANDLER( lkage_mcu_w );
|
||||
READ8_HANDLER( lkage_mcu_r );
|
||||
READ8_HANDLER( lkage_mcu_status_r );
|
||||
@ -16,7 +50,6 @@ READ8_HANDLER( lkage_mcu_status_r );
|
||||
|
||||
/*----------- defined in video/lkage.c -----------*/
|
||||
|
||||
extern UINT8 *lkage_scroll, *lkage_vreg;
|
||||
WRITE8_HANDLER( lkage_videoram_w );
|
||||
VIDEO_START( lkage );
|
||||
VIDEO_UPDATE( lkage );
|
||||
|
@ -5,20 +5,76 @@
|
||||
*************************************************************************/
|
||||
|
||||
/* Calculated from CRT controller writes */
|
||||
#define PIXEL_CLOCK (XTAL_21MHz / 3)
|
||||
#define FRAMEBUFFER_CLOCK XTAL_10MHz
|
||||
#define HBSTART 320
|
||||
#define HBEND 0
|
||||
#define HTOTAL 448
|
||||
#define VBSTART 240
|
||||
#define VBEND 0
|
||||
#define VTOTAL 280
|
||||
#define PIXEL_CLOCK (XTAL_21MHz / 3)
|
||||
#define FRAMEBUFFER_CLOCK XTAL_10MHz
|
||||
#define HBSTART 320
|
||||
#define HBEND 0
|
||||
#define HTOTAL 448
|
||||
#define VBSTART 240
|
||||
#define VBEND 0
|
||||
#define VTOTAL 280
|
||||
|
||||
|
||||
typedef struct _lockon_state lockon_state;
|
||||
struct _lockon_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT16 *char_ram;
|
||||
UINT16 *hud_ram;
|
||||
UINT16 *scene_ram;
|
||||
UINT16 *ground_ram;
|
||||
UINT16 *object_ram;
|
||||
|
||||
size_t hudram_size;
|
||||
size_t objectram_size;
|
||||
size_t groundram_size;
|
||||
|
||||
/* video-related */
|
||||
tilemap_t *tilemap;
|
||||
UINT8 ground_ctrl;
|
||||
UINT16 scroll_h;
|
||||
UINT16 scroll_v;
|
||||
bitmap_t *front_buffer;
|
||||
bitmap_t *back_buffer;
|
||||
emu_timer *bufend_timer;
|
||||
emu_timer *cursor_timer;
|
||||
|
||||
/* Rotation Control */
|
||||
UINT16 xsal;
|
||||
UINT16 x0ll;
|
||||
UINT16 dx0ll;
|
||||
UINT16 dxll;
|
||||
UINT16 ysal;
|
||||
UINT16 y0ll;
|
||||
UINT16 dy0ll;
|
||||
UINT16 dyll;
|
||||
|
||||
/* Object palette RAM control */
|
||||
UINT32 iden;
|
||||
UINT8 * obj_pal_ram;
|
||||
UINT32 obj_pal_latch;
|
||||
UINT32 obj_pal_addr;
|
||||
|
||||
/* misc */
|
||||
UINT8 ctrl_reg;
|
||||
UINT32 main_inten;
|
||||
|
||||
/* devices */
|
||||
running_device *maincpu;
|
||||
running_device *audiocpu;
|
||||
running_device *ground;
|
||||
running_device *object;
|
||||
running_device *f2203_1l;
|
||||
running_device *f2203_2l;
|
||||
running_device *f2203_3l;
|
||||
running_device *f2203_1r;
|
||||
running_device *f2203_2r;
|
||||
running_device *f2203_3r;
|
||||
};
|
||||
|
||||
/*----------- defined in drivers/lockon.c -----------*/
|
||||
extern UINT8 lockon_ctrl_reg;
|
||||
extern UINT32 lockon_main_inten;
|
||||
|
||||
/*----------- defined in video/lockon.c -----------*/
|
||||
|
||||
PALETTE_INIT( lockon );
|
||||
VIDEO_START( lockon );
|
||||
VIDEO_UPDATE( lockon );
|
||||
@ -35,13 +91,3 @@ WRITE16_HANDLER( lockon_char_w );
|
||||
WRITE16_HANDLER( lockon_tza112_w );
|
||||
READ16_HANDLER( lockon_obj_4000_r );
|
||||
WRITE16_HANDLER( lockon_obj_4000_w );
|
||||
|
||||
extern UINT16 *lockon_char_ram;
|
||||
extern UINT16 *lockon_scene_ram;
|
||||
extern UINT16 *lockon_object_ram;
|
||||
extern UINT16 *lockon_hud_ram;
|
||||
extern UINT16 *lockon_ground_ram;
|
||||
|
||||
extern size_t lockon_hudram_size;
|
||||
extern size_t lockon_objectram_size;
|
||||
extern size_t lockon_groundram_size;
|
||||
|
@ -1,17 +1,44 @@
|
||||
|
||||
typedef struct _lsasquad_state lsasquad_state;
|
||||
struct _lsasquad_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * scrollram;
|
||||
UINT8 * videoram;
|
||||
UINT8 * spriteram;
|
||||
size_t spriteram_size;
|
||||
size_t videoram_size;
|
||||
|
||||
/* misc */
|
||||
int invertcoin;
|
||||
int sound_pending;
|
||||
int sound_nmi_enable, pending_nmi, sound_cmd, sound_result;
|
||||
|
||||
/* daikaiju */
|
||||
int daikaiju_xor, daikaiju_command, daikaiju_length, daikaiju_prev, daikaiju_cnt, daikaiju_cntr;
|
||||
int daikaiju_buffer[256];
|
||||
|
||||
/* mcu */
|
||||
UINT8 from_main, from_mcu;
|
||||
int mcu_sent, main_sent;
|
||||
UINT8 port_a_in, port_a_out, ddr_a;
|
||||
UINT8 port_b_in, port_b_out, ddr_b;
|
||||
|
||||
/* devices */
|
||||
running_device *maincpu;
|
||||
running_device *audiocpu;
|
||||
running_device *mcu;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in machine/daikaiju.c -----------*/
|
||||
|
||||
READ8_HANDLER( daikaiju_mcu_r);
|
||||
WRITE8_HANDLER( daikaiju_mcu_w);
|
||||
READ8_HANDLER( daikaiju_mcu_status_r);
|
||||
|
||||
MACHINE_RESET(daikaiju);
|
||||
|
||||
|
||||
/*----------- defined in machine/lsasquad.c -----------*/
|
||||
|
||||
extern int lsasquad_invertcoin;
|
||||
extern int lsasquad_sound_pending;
|
||||
|
||||
WRITE8_HANDLER( lsasquad_sh_nmi_disable_w );
|
||||
WRITE8_HANDLER( lsasquad_sh_nmi_enable_w );
|
||||
WRITE8_HANDLER( lsasquad_sound_command_w );
|
||||
@ -20,12 +47,12 @@ WRITE8_HANDLER( lsasquad_sh_result_w );
|
||||
READ8_HANDLER( lsasquad_sound_result_r );
|
||||
READ8_HANDLER( lsasquad_sound_status_r );
|
||||
|
||||
READ8_HANDLER( lsasquad_68705_portA_r );
|
||||
WRITE8_HANDLER( lsasquad_68705_portA_w );
|
||||
WRITE8_HANDLER( lsasquad_68705_ddrA_w );
|
||||
READ8_HANDLER( lsasquad_68705_portB_r );
|
||||
WRITE8_HANDLER( lsasquad_68705_portB_w );
|
||||
WRITE8_HANDLER( lsasquad_68705_ddrB_w );
|
||||
READ8_HANDLER( lsasquad_68705_port_a_r );
|
||||
WRITE8_HANDLER( lsasquad_68705_port_a_w );
|
||||
WRITE8_HANDLER( lsasquad_68705_ddr_a_w );
|
||||
READ8_HANDLER( lsasquad_68705_port_b_r );
|
||||
WRITE8_HANDLER( lsasquad_68705_port_b_w );
|
||||
WRITE8_HANDLER( lsasquad_68705_ddr_b_w );
|
||||
WRITE8_HANDLER( lsasquad_mcu_w );
|
||||
READ8_HANDLER( lsasquad_mcu_r );
|
||||
READ8_HANDLER( lsasquad_mcu_status_r );
|
||||
@ -36,7 +63,5 @@ READ8_HANDLER( daikaiju_sh_sound_command_r );
|
||||
|
||||
/*----------- defined in video/lsasquad.c -----------*/
|
||||
|
||||
extern UINT8 *lsasquad_scrollram;
|
||||
|
||||
VIDEO_UPDATE( lsasquad );
|
||||
VIDEO_UPDATE( daikaiju );
|
||||
|
@ -110,58 +110,49 @@ displayed (game) or not (attract mode). Due to above bug message is always displ
|
||||
#define MCU_CONTROLS1 0x36
|
||||
#define MCU_MESSAGE 0x40
|
||||
#define MCU_CONTROLS2 0x44
|
||||
#define MCU_ID 0x60
|
||||
#define MCU_ID 0x60
|
||||
|
||||
#define MCU_ADDRESS1_LENGTH 2
|
||||
#define MCU_ADDRESS2_LENGTH 2
|
||||
#define MCU_CONTROLS1_LENGTH 2
|
||||
#define MCU_MESSAGE_LENGTH 3
|
||||
#define MCU_CONTROLS2_LENGTH 3
|
||||
#define MCU_ID_LENGTH 0
|
||||
#define MCU_ID_LENGTH 0
|
||||
|
||||
#define SET_COMMAND(n) daikaiju_command=data; \
|
||||
daikaiju_length=n;\
|
||||
daikaiju_cnt=0;\
|
||||
daikaiju_cntr=0;
|
||||
#define SET_COMMAND(n) state->daikaiju_command = data; \
|
||||
state->daikaiju_length = n;\
|
||||
state->daikaiju_cnt = 0;\
|
||||
state->daikaiju_cntr = 0;
|
||||
|
||||
|
||||
static int daikaiju_xor, daikaiju_command, daikaiju_length, daikaiju_prev, daikaiju_cnt, daikaiju_cntr;
|
||||
|
||||
static int daikaiju_buffer[256];
|
||||
|
||||
static const int xortable[]=
|
||||
{
|
||||
0xF5, 0xD5, 0x6A, 0x26, 0x00, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x16, 0x00, 0xCB, 0x23, 0x19,
|
||||
0x11, 0x00, 0xC0, 0x19, 0xD1, 0xF1, 0xC9, -1
|
||||
};
|
||||
|
||||
MACHINE_RESET(daikaiju)
|
||||
{
|
||||
daikaiju_xor=-1;
|
||||
daikaiju_command=0;
|
||||
daikaiju_length=0;
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( daikaiju_mcu_w )
|
||||
{
|
||||
if(daikaiju_xor <0)
|
||||
lsasquad_state *state = (lsasquad_state *)space->machine->driver_data;
|
||||
|
||||
if (state->daikaiju_xor < 0)
|
||||
{
|
||||
//reset
|
||||
daikaiju_xor=0;
|
||||
data^=0xc3;
|
||||
state->daikaiju_xor = 0;
|
||||
data ^= 0xc3;
|
||||
}
|
||||
else
|
||||
{
|
||||
data^=xortable[daikaiju_xor];
|
||||
data ^= xortable[state->daikaiju_xor];
|
||||
//check for end of table
|
||||
if(xortable[++daikaiju_xor]<0)
|
||||
if (xortable[++state->daikaiju_xor] < 0)
|
||||
{
|
||||
daikaiju_xor=0;
|
||||
state->daikaiju_xor = 0;
|
||||
}
|
||||
}
|
||||
daikaiju_prev=data;
|
||||
state->daikaiju_prev = data;
|
||||
|
||||
if(daikaiju_length == 0) //new command
|
||||
if (state->daikaiju_length == 0) //new command
|
||||
{
|
||||
switch(data)
|
||||
{
|
||||
@ -172,22 +163,24 @@ WRITE8_HANDLER( daikaiju_mcu_w )
|
||||
case MCU_CONTROLS1: SET_COMMAND(MCU_CONTROLS1_LENGTH); break;
|
||||
case MCU_MESSAGE: SET_COMMAND(MCU_MESSAGE_LENGTH); break;
|
||||
case MCU_CONTROLS2: SET_COMMAND(MCU_CONTROLS2_LENGTH); break;
|
||||
case MCU_ID: SET_COMMAND(MCU_ID_LENGTH); break;
|
||||
case MCU_ID: SET_COMMAND(MCU_ID_LENGTH); break;
|
||||
default:
|
||||
daikaiju_command=data;
|
||||
state->daikaiju_command = data;
|
||||
logerror("Unknown MCU command W %x %x \n",data,cpu_get_pc(space->cpu));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
--daikaiju_length;
|
||||
daikaiju_buffer[daikaiju_cnt++]=data;
|
||||
--state->daikaiju_length;
|
||||
state->daikaiju_buffer[state->daikaiju_cnt++] = data;
|
||||
}
|
||||
}
|
||||
|
||||
READ8_HANDLER( daikaiju_mcu_r )
|
||||
{
|
||||
switch(daikaiju_command)
|
||||
lsasquad_state *state = (lsasquad_state *)space->machine->driver_data;
|
||||
|
||||
switch (state->daikaiju_command)
|
||||
{
|
||||
case MCU_ID:
|
||||
return ID_DAIKAIJU;
|
||||
@ -195,9 +188,9 @@ READ8_HANDLER( daikaiju_mcu_r )
|
||||
case MCU_CONTROLS1:
|
||||
{
|
||||
int n;
|
||||
switch( (daikaiju_buffer[0]&0xf)^0xf)
|
||||
switch ((state->daikaiju_buffer[0] & 0xf) ^ 0xf)
|
||||
{
|
||||
case 0x00: n = (daikaiju_buffer[1]&(~8))&0xf; break;
|
||||
case 0x00: n = (state->daikaiju_buffer[1] & (~8)) & 0xf; break;
|
||||
case 0x08: n = 0 | 8; break;
|
||||
case 0x0a: n = 1 | 8; break;
|
||||
case 0x02: n = 2 | 8; break;
|
||||
@ -210,49 +203,49 @@ READ8_HANDLER( daikaiju_mcu_r )
|
||||
default: n = 0; break;
|
||||
}
|
||||
|
||||
if( !(daikaiju_buffer[0]&0x10) ) //button 1 pressed
|
||||
if (!(state->daikaiju_buffer[0] & 0x10)) //button 1 pressed
|
||||
{
|
||||
if(daikaiju_buffer[1]&0x10) //previous status
|
||||
if (state->daikaiju_buffer[1] & 0x10) //previous status
|
||||
{
|
||||
n|=0x40; // button 0->1
|
||||
n |= 0x40; // button 0->1
|
||||
}
|
||||
else
|
||||
{
|
||||
n|=0; //button 1->1
|
||||
n |= 0; //button 1->1
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(daikaiju_buffer[1]&0x10) //previous status
|
||||
if (state->daikaiju_buffer[1] & 0x10) //previous status
|
||||
{
|
||||
n|=0x40+0x10; // button 0->0
|
||||
n |= 0x40 + 0x10; // button 0->0
|
||||
}
|
||||
else
|
||||
{
|
||||
n|=0x10; //button 1->0
|
||||
n |= 0x10; //button 1->0
|
||||
}
|
||||
}
|
||||
|
||||
if( !(daikaiju_buffer[0]&0x20) ) //button 2 pressed
|
||||
if (!(state->daikaiju_buffer[0] & 0x20)) //button 2 pressed
|
||||
{
|
||||
if(daikaiju_buffer[1]&0x20) //previous status
|
||||
if (state->daikaiju_buffer[1] & 0x20) //previous status
|
||||
{
|
||||
n|=0x80; // button 0->1
|
||||
n |= 0x80; // button 0->1
|
||||
}
|
||||
else
|
||||
{
|
||||
n|=0; //button 1->1
|
||||
n |= 0; //button 1->1
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(daikaiju_buffer[1]&0x20) //previous status
|
||||
if (state->daikaiju_buffer[1] & 0x20) //previous status
|
||||
{
|
||||
n|=0x80+0x20; // button 0->0
|
||||
n |= 0x80 + 0x20; // button 0->0
|
||||
}
|
||||
else
|
||||
{
|
||||
n|=0x20; //button 1->0
|
||||
n |= 0x20; //button 1->0
|
||||
}
|
||||
}
|
||||
return n;
|
||||
@ -260,89 +253,91 @@ READ8_HANDLER( daikaiju_mcu_r )
|
||||
|
||||
case MCU_ADDRESS1:
|
||||
{
|
||||
int address=daikaiju_buffer[1]*2+64*daikaiju_buffer[0];
|
||||
int address = state->daikaiju_buffer[1] * 2 + 64 * state->daikaiju_buffer[0];
|
||||
|
||||
address&=0x0fff; // ?
|
||||
address+=0xd000;
|
||||
address &= 0x0fff; // ?
|
||||
address += 0xd000;
|
||||
|
||||
if(daikaiju_cntr==0)
|
||||
if (state->daikaiju_cntr == 0)
|
||||
{
|
||||
daikaiju_cntr++;
|
||||
return address&0xff;
|
||||
state->daikaiju_cntr++;
|
||||
return address & 0xff;
|
||||
}
|
||||
else
|
||||
{
|
||||
return address>>8;
|
||||
return address >> 8;
|
||||
}
|
||||
}
|
||||
|
||||
case MCU_ADDRESS2:
|
||||
{
|
||||
int address=daikaiju_buffer[1]*2+64*daikaiju_buffer[0];
|
||||
int address = state->daikaiju_buffer[1] * 2 + 64 * state->daikaiju_buffer[0];
|
||||
|
||||
address&=0x1fff; // ?
|
||||
address+=0xc000;
|
||||
address &= 0x1fff; // ?
|
||||
address += 0xc000;
|
||||
|
||||
if(daikaiju_cntr==0)
|
||||
if (state->daikaiju_cntr == 0)
|
||||
{
|
||||
daikaiju_cntr++;
|
||||
return address&0xff;
|
||||
state->daikaiju_cntr++;
|
||||
return address & 0xff;
|
||||
}
|
||||
else
|
||||
{
|
||||
return address>>8;
|
||||
return address >> 8;
|
||||
}
|
||||
}
|
||||
|
||||
case MCU_MESSAGE:
|
||||
return daikaiju_buffer[1];
|
||||
return state->daikaiju_buffer[1];
|
||||
|
||||
case MCU_CONTROLS2:
|
||||
{
|
||||
int n;
|
||||
int dest=(daikaiju_buffer[0]&0x7)<<1;
|
||||
int prev=(daikaiju_buffer[1]&0xf);
|
||||
int dest = (state->daikaiju_buffer[0] & 0x7) << 1;
|
||||
int prev = (state->daikaiju_buffer[1] & 0xf);
|
||||
|
||||
if(daikaiju_buffer[2]==2)
|
||||
if (state->daikaiju_buffer[2] == 2)
|
||||
{
|
||||
prev&=0xfe;
|
||||
prev &= 0xfe;
|
||||
}
|
||||
if(prev!=dest)
|
||||
{
|
||||
int diff=(dest-prev);
|
||||
|
||||
if((diff>8 )|| (diff<0 && diff >-8))
|
||||
if (prev != dest)
|
||||
{
|
||||
int diff = (dest - prev);
|
||||
|
||||
if ((diff > 8)|| (diff < 0 && diff > -8))
|
||||
{
|
||||
n=(prev-daikaiju_buffer[2])&0xf;
|
||||
n = (prev - state->daikaiju_buffer[2]) & 0xf;
|
||||
}
|
||||
else
|
||||
{
|
||||
n=(prev+daikaiju_buffer[2])&0xf;
|
||||
n = (prev + state->daikaiju_buffer[2]) & 0xf;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
n=prev;
|
||||
n = prev;
|
||||
}
|
||||
prev&=0xf;
|
||||
if(prev!=n)
|
||||
prev &= 0xf;
|
||||
|
||||
if (prev != n)
|
||||
{
|
||||
n|=0x10;
|
||||
n |= 0x10;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
}
|
||||
logerror("Unknown MCU R %x %x %x %x\n",cpu_get_pc(space->cpu), daikaiju_command, daikaiju_length, daikaiju_prev);
|
||||
logerror("Unknown MCU R %x %x %x %x\n", cpu_get_pc(space->cpu), state->daikaiju_command, state->daikaiju_length, state->daikaiju_prev);
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
READ8_HANDLER( daikaiju_mcu_status_r )
|
||||
{
|
||||
lsasquad_state *state = (lsasquad_state *)space->machine->driver_data;
|
||||
int res = input_port_read(space->machine, "MCU?");
|
||||
|
||||
res^=mame_rand(space->machine)&3;
|
||||
res |=((lsasquad_sound_pending & 0x02)^2)<<3; //inverted flag
|
||||
lsasquad_sound_pending &= ~0x02;
|
||||
res ^= mame_rand(space->machine) & 3;
|
||||
res |= ((state->sound_pending & 0x02) ^ 2) << 3; //inverted flag
|
||||
state->sound_pending &= ~0x02;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -11,10 +11,6 @@
|
||||
#include "includes/lkage.h"
|
||||
|
||||
|
||||
static UINT8 from_main,from_mcu;
|
||||
static int mcu_sent = 0,main_sent = 0;
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
Legend of Kage 68705 protection interface
|
||||
@ -24,23 +20,26 @@ static int mcu_sent = 0,main_sent = 0;
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
static UINT8 portA_in,portA_out,ddrA;
|
||||
|
||||
READ8_HANDLER( lkage_68705_portA_r )
|
||||
READ8_HANDLER( lkage_68705_port_a_r )
|
||||
{
|
||||
//logerror("%04x: 68705 port A read %02x\n",cpu_get_pc(space->cpu),portA_in);
|
||||
return (portA_out & ddrA) | (portA_in & ~ddrA);
|
||||
lkage_state *state = (lkage_state *)space->machine->driver_data;
|
||||
|
||||
//logerror("%04x: 68705 port A read %02x\n", cpu_get_pc(space->cpu), state->port_a_in);
|
||||
return (state->port_a_out & state->ddr_a) | (state->port_a_in & ~state->ddr_a);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( lkage_68705_portA_w )
|
||||
WRITE8_HANDLER( lkage_68705_port_a_w )
|
||||
{
|
||||
//logerror("%04x: 68705 port A write %02x\n",cpu_get_pc(space->cpu),data);
|
||||
portA_out = data;
|
||||
lkage_state *state = (lkage_state *)space->machine->driver_data;
|
||||
|
||||
//logerror("%04x: 68705 port A write %02x\n", cpu_get_pc(space->cpu), data);
|
||||
state->port_a_out = data;
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( lkage_68705_ddrA_w )
|
||||
WRITE8_HANDLER( lkage_68705_ddr_a_w )
|
||||
{
|
||||
ddrA = data;
|
||||
lkage_state *state = (lkage_state *)space->machine->driver_data;
|
||||
state->ddr_a = data;
|
||||
}
|
||||
|
||||
|
||||
@ -54,87 +53,106 @@ WRITE8_HANDLER( lkage_68705_ddrA_w )
|
||||
* 2 W when 0->1, copies port A to the latch for the main CPU
|
||||
*/
|
||||
|
||||
static UINT8 portB_in,portB_out,ddrB;
|
||||
|
||||
READ8_HANDLER( lkage_68705_portB_r )
|
||||
READ8_HANDLER( lkage_68705_port_b_r )
|
||||
{
|
||||
return (portB_out & ddrB) | (portB_in & ~ddrB);
|
||||
lkage_state *state = (lkage_state *)space->machine->driver_data;
|
||||
return (state->port_b_out & state->ddr_b) | (state->port_b_in & ~state->ddr_b);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( lkage_68705_portB_w )
|
||||
WRITE8_HANDLER( lkage_68705_port_b_w )
|
||||
{
|
||||
//logerror("%04x: 68705 port B write %02x\n",cpu_get_pc(space->cpu),data);
|
||||
lkage_state *state = (lkage_state *)space->machine->driver_data;
|
||||
|
||||
if ((ddrB & 0x02) && (~data & 0x02) && (portB_out & 0x02))
|
||||
//logerror("%04x: 68705 port B write %02x\n", cpu_get_pc(space->cpu), data);
|
||||
|
||||
if ((state->ddr_b & 0x02) && (~data & 0x02) && (state->port_b_out & 0x02))
|
||||
{
|
||||
portA_in = from_main;
|
||||
if (main_sent) cputag_set_input_line(space->machine, "mcu", 0, CLEAR_LINE);
|
||||
main_sent = 0;
|
||||
logerror("read command %02x from main cpu\n",portA_in);
|
||||
}
|
||||
if ((ddrB & 0x04) && (data & 0x04) && (~portB_out & 0x04))
|
||||
{
|
||||
logerror("send command %02x to main cpu\n",portA_out);
|
||||
from_mcu = portA_out;
|
||||
mcu_sent = 1;
|
||||
state->port_a_in = state->from_main;
|
||||
if (state->main_sent)
|
||||
cpu_set_input_line(state->mcu, 0, CLEAR_LINE);
|
||||
|
||||
state->main_sent = 0;
|
||||
logerror("read command %02x from main cpu\n", state->port_a_in);
|
||||
}
|
||||
|
||||
portB_out = data;
|
||||
if ((state->ddr_b & 0x04) && (data & 0x04) && (~state->port_b_out & 0x04))
|
||||
{
|
||||
logerror("send command %02x to main cpu\n", state->port_a_out);
|
||||
state->from_mcu = state->port_a_out;
|
||||
state->mcu_sent = 1;
|
||||
}
|
||||
|
||||
state->port_b_out = data;
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( lkage_68705_ddrB_w )
|
||||
WRITE8_HANDLER( lkage_68705_ddr_b_w )
|
||||
{
|
||||
ddrB = data;
|
||||
lkage_state *state = (lkage_state *)space->machine->driver_data;
|
||||
state->ddr_b = data;
|
||||
}
|
||||
|
||||
|
||||
static UINT8 portC_in,portC_out,ddrC;
|
||||
|
||||
READ8_HANDLER( lkage_68705_portC_r )
|
||||
READ8_HANDLER( lkage_68705_port_c_r )
|
||||
{
|
||||
portC_in = 0;
|
||||
if (main_sent) portC_in |= 0x01;
|
||||
if (!mcu_sent) portC_in |= 0x02;
|
||||
//logerror("%04x: 68705 port C read %02x\n",cpu_get_pc(space->cpu),portC_in);
|
||||
return (portC_out & ddrC) | (portC_in & ~ddrC);
|
||||
lkage_state *state = (lkage_state *)space->machine->driver_data;
|
||||
|
||||
state->port_c_in = 0;
|
||||
if (state->main_sent)
|
||||
state->port_c_in |= 0x01;
|
||||
if (!state->mcu_sent)
|
||||
state->port_c_in |= 0x02;
|
||||
|
||||
//logerror("%04x: 68705 port C read %02x\n", cpu_get_pc(space->cpu), state->port_c_in);
|
||||
return (state->port_c_out & state->ddr_c) | (state->port_c_in & ~state->ddr_c);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( lkage_68705_portC_w )
|
||||
WRITE8_HANDLER( lkage_68705_port_c_w )
|
||||
{
|
||||
logerror("%04x: 68705 port C write %02x\n",cpu_get_pc(space->cpu),data);
|
||||
portC_out = data;
|
||||
lkage_state *state = (lkage_state *)space->machine->driver_data;
|
||||
|
||||
logerror("%04x: 68705 port C write %02x\n", cpu_get_pc(space->cpu), data);
|
||||
state->port_c_out = data;
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( lkage_68705_ddrC_w )
|
||||
WRITE8_HANDLER( lkage_68705_ddr_c_w )
|
||||
{
|
||||
ddrC = data;
|
||||
lkage_state *state = (lkage_state *)space->machine->driver_data;
|
||||
state->ddr_c = data;
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( lkage_mcu_w )
|
||||
{
|
||||
logerror("%04x: mcu_w %02x\n",cpu_get_pc(space->cpu),data);
|
||||
from_main = data;
|
||||
main_sent = 1;
|
||||
cputag_set_input_line(space->machine, "mcu", 0, ASSERT_LINE);
|
||||
lkage_state *state = (lkage_state *)space->machine->driver_data;
|
||||
|
||||
logerror("%04x: mcu_w %02x\n", cpu_get_pc(space->cpu), data);
|
||||
state->from_main = data;
|
||||
state->main_sent = 1;
|
||||
cpu_set_input_line(state->mcu, 0, ASSERT_LINE);
|
||||
}
|
||||
|
||||
READ8_HANDLER( lkage_mcu_r )
|
||||
{
|
||||
logerror("%04x: mcu_r %02x\n",cpu_get_pc(space->cpu),from_mcu);
|
||||
mcu_sent = 0;
|
||||
return from_mcu;
|
||||
lkage_state *state = (lkage_state *)space->machine->driver_data;
|
||||
|
||||
logerror("%04x: mcu_r %02x\n", cpu_get_pc(space->cpu), state->from_mcu);
|
||||
state->mcu_sent = 0;
|
||||
return state->from_mcu;
|
||||
}
|
||||
|
||||
READ8_HANDLER( lkage_mcu_status_r )
|
||||
{
|
||||
lkage_state *state = (lkage_state *)space->machine->driver_data;
|
||||
int res = 0;
|
||||
|
||||
/* bit 0 = when 1, mcu is ready to receive data from main cpu */
|
||||
/* bit 1 = when 1, mcu has sent data to the main cpu */
|
||||
//logerror("%04x: mcu_status_r\n",cpu_get_pc(space->cpu));
|
||||
if (!main_sent) res |= 0x01;
|
||||
if (mcu_sent) res |= 0x02;
|
||||
//logerror("%04x: mcu_status_r\n", cpu_get_pc(space->cpu));
|
||||
if (!state->main_sent)
|
||||
res |= 0x01;
|
||||
if (state->mcu_sent)
|
||||
res |= 0x02;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@ -2,91 +2,100 @@
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "includes/lsasquad.h"
|
||||
|
||||
|
||||
/* coin inputs are inverted in storming */
|
||||
int lsasquad_invertcoin;
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
main <-> sound CPU communication
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
static int sound_nmi_enable,pending_nmi,sound_cmd,sound_result;
|
||||
int lsasquad_sound_pending;
|
||||
|
||||
static TIMER_CALLBACK( nmi_callback )
|
||||
{
|
||||
if (sound_nmi_enable) cputag_set_input_line(machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
|
||||
else pending_nmi = 1;
|
||||
lsasquad_state *state = (lsasquad_state *)machine->driver_data;
|
||||
|
||||
if (state->sound_nmi_enable)
|
||||
cpu_set_input_line(state->audiocpu, INPUT_LINE_NMI, PULSE_LINE);
|
||||
else
|
||||
state->pending_nmi = 1;
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( lsasquad_sh_nmi_disable_w )
|
||||
{
|
||||
sound_nmi_enable = 0;
|
||||
lsasquad_state *state = (lsasquad_state *)space->machine->driver_data;
|
||||
state->sound_nmi_enable = 0;
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( lsasquad_sh_nmi_enable_w )
|
||||
{
|
||||
sound_nmi_enable = 1;
|
||||
if (pending_nmi)
|
||||
lsasquad_state *state = (lsasquad_state *)space->machine->driver_data;
|
||||
|
||||
state->sound_nmi_enable = 1;
|
||||
if (state->pending_nmi)
|
||||
{
|
||||
cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
|
||||
pending_nmi = 0;
|
||||
cpu_set_input_line(state->audiocpu, INPUT_LINE_NMI, PULSE_LINE);
|
||||
state->pending_nmi = 0;
|
||||
}
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( lsasquad_sound_command_w )
|
||||
{
|
||||
lsasquad_sound_pending |= 0x01;
|
||||
sound_cmd = data;
|
||||
//logerror("%04x: sound cmd %02x\n",cpu_get_pc(space->cpu),data);
|
||||
timer_call_after_resynch(space->machine, NULL, data,nmi_callback);
|
||||
lsasquad_state *state = (lsasquad_state *)space->machine->driver_data;
|
||||
state->sound_pending |= 0x01;
|
||||
state->sound_cmd = data;
|
||||
|
||||
//logerror("%04x: sound cmd %02x\n", cpu_get_pc(space->cpu), data);
|
||||
timer_call_after_resynch(space->machine, NULL, data, nmi_callback);
|
||||
}
|
||||
|
||||
READ8_HANDLER( lsasquad_sh_sound_command_r )
|
||||
{
|
||||
lsasquad_sound_pending &= ~0x01;
|
||||
//logerror("%04x: read sound cmd %02x\n",cpu_get_pc(space->cpu),sound_cmd);
|
||||
return sound_cmd;
|
||||
lsasquad_state *state = (lsasquad_state *)space->machine->driver_data;
|
||||
state->sound_pending &= ~0x01;
|
||||
//logerror("%04x: read sound cmd %02x\n", cpu_get_pc(space->cpu), state->sound_cmd);
|
||||
return state->sound_cmd;
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( lsasquad_sh_result_w )
|
||||
{
|
||||
lsasquad_sound_pending |= 0x02;
|
||||
//logerror("%04x: sound res %02x\n",cpu_get_pc(space->cpu),data);
|
||||
sound_result = data;
|
||||
lsasquad_state *state = (lsasquad_state *)space->machine->driver_data;
|
||||
state->sound_pending |= 0x02;
|
||||
//logerror("%04x: sound res %02x\n", cpu_get_pc(space->cpu), data);
|
||||
state->sound_result = data;
|
||||
}
|
||||
|
||||
READ8_HANDLER( lsasquad_sound_result_r )
|
||||
{
|
||||
lsasquad_sound_pending &= ~0x02;
|
||||
//logerror("%04x: read sound res %02x\n",cpu_get_pc(space->cpu),sound_result);
|
||||
return sound_result;
|
||||
lsasquad_state *state = (lsasquad_state *)space->machine->driver_data;
|
||||
state->sound_pending &= ~0x02;
|
||||
//logerror("%04x: read sound res %02x\n", cpu_get_pc(space->cpu), state->sound_result);
|
||||
return state->sound_result;
|
||||
}
|
||||
|
||||
READ8_HANDLER( lsasquad_sound_status_r )
|
||||
{
|
||||
lsasquad_state *state = (lsasquad_state *)space->machine->driver_data;
|
||||
|
||||
/* bit 0: message pending for sound cpu */
|
||||
/* bit 1: message pending for main cpu */
|
||||
return lsasquad_sound_pending;
|
||||
return state->sound_pending;
|
||||
}
|
||||
|
||||
|
||||
READ8_HANDLER( daikaiju_sh_sound_command_r )
|
||||
{
|
||||
lsasquad_sound_pending &= ~0x01;
|
||||
lsasquad_sound_pending |= 0x02;
|
||||
//logerror("%04x: read sound cmd %02x\n",cpu_get_pc(space->cpu),sound_cmd);
|
||||
return sound_cmd;
|
||||
lsasquad_state *state = (lsasquad_state *)space->machine->driver_data;
|
||||
state->sound_pending &= ~0x01;
|
||||
state->sound_pending |= 0x02;
|
||||
//logerror("%04x: read sound cmd %02x\n", cpu_get_pc(space->cpu), state->sound_cmd);
|
||||
return state->sound_cmd;
|
||||
}
|
||||
|
||||
READ8_HANDLER( daikaiju_sound_status_r )
|
||||
{
|
||||
lsasquad_state *state = (lsasquad_state *)space->machine->driver_data;
|
||||
|
||||
/* bit 0: message pending for sound cpu */
|
||||
/* bit 1: message pending for main cpu */
|
||||
return lsasquad_sound_pending^3;
|
||||
return state->sound_pending ^ 3;
|
||||
}
|
||||
|
||||
|
||||
@ -98,26 +107,26 @@ READ8_HANDLER( daikaiju_sound_status_r )
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
static UINT8 from_main,from_mcu;
|
||||
static int mcu_sent = 0,main_sent = 0;
|
||||
|
||||
static UINT8 portA_in,portA_out,ddrA;
|
||||
|
||||
READ8_HANDLER( lsasquad_68705_portA_r )
|
||||
READ8_HANDLER( lsasquad_68705_port_a_r )
|
||||
{
|
||||
//logerror("%04x: 68705 port A read %02x\n",cpu_get_pc(space->cpu),portA_in);
|
||||
return (portA_out & ddrA) | (portA_in & ~ddrA);
|
||||
lsasquad_state *state = (lsasquad_state *)space->machine->driver_data;
|
||||
|
||||
//logerror("%04x: 68705 port A read %02x\n", cpu_get_pc(space->cpu), state->port_a_in);
|
||||
return (state->port_a_out & state->ddr_a) | (state->port_a_in & ~state->ddr_a);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( lsasquad_68705_portA_w )
|
||||
WRITE8_HANDLER( lsasquad_68705_port_a_w )
|
||||
{
|
||||
//logerror("%04x: 68705 port A write %02x\n",cpu_get_pc(space->cpu),data);
|
||||
portA_out = data;
|
||||
lsasquad_state *state = (lsasquad_state *)space->machine->driver_data;
|
||||
|
||||
//logerror("%04x: 68705 port A write %02x\n", cpu_get_pc(space->cpu), data);
|
||||
state->port_a_out = data;
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( lsasquad_68705_ddrA_w )
|
||||
WRITE8_HANDLER( lsasquad_68705_ddr_a_w )
|
||||
{
|
||||
ddrA = data;
|
||||
lsasquad_state *state = (lsasquad_state *)space->machine->driver_data;
|
||||
state->ddr_a = data;
|
||||
}
|
||||
|
||||
|
||||
@ -131,63 +140,74 @@ WRITE8_HANDLER( lsasquad_68705_ddrA_w )
|
||||
* 2 W when 0->1, copies port A to the latch for the main CPU
|
||||
*/
|
||||
|
||||
static UINT8 portB_in,portB_out,ddrB;
|
||||
|
||||
READ8_HANDLER( lsasquad_68705_portB_r )
|
||||
READ8_HANDLER( lsasquad_68705_port_b_r )
|
||||
{
|
||||
return (portB_out & ddrB) | (portB_in & ~ddrB);
|
||||
lsasquad_state *state = (lsasquad_state *)space->machine->driver_data;
|
||||
return (state->port_b_out & state->ddr_b) | (state->port_b_in & ~state->ddr_b);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( lsasquad_68705_portB_w )
|
||||
WRITE8_HANDLER( lsasquad_68705_port_b_w )
|
||||
{
|
||||
//logerror("%04x: 68705 port B write %02x\n",cpu_get_pc(space->cpu),data);
|
||||
lsasquad_state *state = (lsasquad_state *)space->machine->driver_data;
|
||||
|
||||
if ((ddrB & 0x02) && (~data & 0x02) && (portB_out & 0x02))
|
||||
//logerror("%04x: 68705 port B write %02x\n", cpu_get_pc(space->cpu), data);
|
||||
|
||||
if ((state->ddr_b & 0x02) && (~data & 0x02) && (state->port_b_out & 0x02))
|
||||
{
|
||||
portA_in = from_main;
|
||||
if (main_sent) cputag_set_input_line(space->machine, "mcu", 0, CLEAR_LINE);
|
||||
main_sent = 0;
|
||||
//logerror("read command %02x from main cpu\n",portA_in);
|
||||
}
|
||||
if ((ddrB & 0x04) && (data & 0x04) && (~portB_out & 0x04))
|
||||
{
|
||||
//logerror("send command %02x to main cpu\n",portA_out);
|
||||
from_mcu = portA_out;
|
||||
mcu_sent = 1;
|
||||
state->port_a_in = state->from_main;
|
||||
if (state->main_sent)
|
||||
cpu_set_input_line(state->mcu, 0, CLEAR_LINE);
|
||||
state->main_sent = 0;
|
||||
//logerror("read command %02x from main cpu\n", state->port_a_in);
|
||||
}
|
||||
|
||||
portB_out = data;
|
||||
if ((state->ddr_b & 0x04) && (data & 0x04) && (~state->port_b_out & 0x04))
|
||||
{
|
||||
//logerror("send command %02x to main cpu\n", state->port_a_out);
|
||||
state->from_mcu = state->port_a_out;
|
||||
state->mcu_sent = 1;
|
||||
}
|
||||
|
||||
state->port_b_out = data;
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( lsasquad_68705_ddrB_w )
|
||||
WRITE8_HANDLER( lsasquad_68705_ddr_b_w )
|
||||
{
|
||||
ddrB = data;
|
||||
lsasquad_state *state = (lsasquad_state *)space->machine->driver_data;
|
||||
state->ddr_b = data;
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( lsasquad_mcu_w )
|
||||
{
|
||||
//logerror("%04x: mcu_w %02x\n",cpu_get_pc(space->cpu),data);
|
||||
from_main = data;
|
||||
main_sent = 1;
|
||||
cputag_set_input_line(space->machine, "mcu", 0, ASSERT_LINE);
|
||||
lsasquad_state *state = (lsasquad_state *)space->machine->driver_data;
|
||||
|
||||
//logerror("%04x: mcu_w %02x\n", cpu_get_pc(space->cpu), data);
|
||||
state->from_main = data;
|
||||
state->main_sent = 1;
|
||||
cpu_set_input_line(state->mcu, 0, ASSERT_LINE);
|
||||
}
|
||||
|
||||
READ8_HANDLER( lsasquad_mcu_r )
|
||||
{
|
||||
//logerror("%04x: mcu_r %02x\n",cpu_get_pc(space->cpu),from_mcu);
|
||||
mcu_sent = 0;
|
||||
return from_mcu;
|
||||
lsasquad_state *state = (lsasquad_state *)space->machine->driver_data;
|
||||
|
||||
//logerror("%04x: mcu_r %02x\n", cpu_get_pc(space->cpu), state->from_mcu);
|
||||
state->mcu_sent = 0;
|
||||
return state->from_mcu;
|
||||
}
|
||||
|
||||
READ8_HANDLER( lsasquad_mcu_status_r )
|
||||
{
|
||||
lsasquad_state *state = (lsasquad_state *)space->machine->driver_data;
|
||||
int res = input_port_read(space->machine, "MCU?");
|
||||
|
||||
/* bit 0 = when 1, mcu is ready to receive data from main cpu */
|
||||
/* bit 1 = when 0, mcu has sent data to the main cpu */
|
||||
//logerror("%04x: mcu_status_r\n",cpu_get_pc(space->cpu));
|
||||
if (!main_sent) res |= 0x01;
|
||||
if (!mcu_sent) res |= 0x02;
|
||||
//logerror("%04x: mcu_status_r\n",cpu_get_pc(space->cpu));
|
||||
if (!state->main_sent)
|
||||
res |= 0x01;
|
||||
if (!state->mcu_sent)
|
||||
res |= 0x02;
|
||||
|
||||
return res ^ lsasquad_invertcoin;
|
||||
return res ^ state->invertcoin;
|
||||
}
|
||||
|
@ -60,7 +60,10 @@ static TILE_GET_INFO( get_back_tile_info )
|
||||
}
|
||||
|
||||
tile = RAM[tile_index];
|
||||
if (tile > 0x7f) bank = 3; else bank = 2;
|
||||
if (tile > 0x7f)
|
||||
bank = 3;
|
||||
else
|
||||
bank = 2;
|
||||
SET_TILE_INFO(bank, tile & 0x7f, state->background_color, 0);
|
||||
}
|
||||
|
||||
@ -104,7 +107,7 @@ WRITE8_HANDLER( deco16_io_w )
|
||||
liberate_state *state = (liberate_state *)space->machine->driver_data;
|
||||
state->io_ram[offset] = data;
|
||||
if (offset > 1 && offset < 6)
|
||||
tilemap_mark_all_tiles_dirty(state->background_tilemap);
|
||||
tilemap_mark_all_tiles_dirty(state->back_tilemap);
|
||||
|
||||
switch (offset)
|
||||
{
|
||||
@ -112,20 +115,20 @@ WRITE8_HANDLER( deco16_io_w )
|
||||
if (((data >> 4) & 3) != state->background_color)
|
||||
{
|
||||
state->background_color = (data >> 4) & 3;
|
||||
tilemap_mark_all_tiles_dirty(state->background_tilemap);
|
||||
tilemap_mark_all_tiles_dirty(state->back_tilemap);
|
||||
}
|
||||
state->background_disable = data & 0x4;
|
||||
flip_screen_set(space->machine, data & 0x1);
|
||||
flip_screen_set(space->machine, data & 0x01);
|
||||
break;
|
||||
case 7: /* Background palette resistors? */
|
||||
/* Todo */
|
||||
break;
|
||||
case 8: /* Irq ack */
|
||||
cputag_set_input_line(space->machine, "maincpu", DECO16_IRQ_LINE, CLEAR_LINE);
|
||||
cpu_set_input_line(state->maincpu, DECO16_IRQ_LINE, CLEAR_LINE);
|
||||
break;
|
||||
case 9: /* Sound */
|
||||
soundlatch_w(space, 0, data);
|
||||
cputag_set_input_line(space->machine, "audiocpu", M6502_IRQ_LINE, HOLD_LINE);
|
||||
cpu_set_input_line(state->audiocpu, M6502_IRQ_LINE, HOLD_LINE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -135,9 +138,9 @@ WRITE8_HANDLER( prosoccr_io_w )
|
||||
liberate_state *state = (liberate_state *)space->machine->driver_data;
|
||||
state->io_ram[offset] = data;
|
||||
if (offset > 1 && offset < 6)
|
||||
tilemap_mark_all_tiles_dirty(state->background_tilemap);
|
||||
tilemap_mark_all_tiles_dirty(state->back_tilemap);
|
||||
|
||||
// popmessage("%02x %02x",state->io_ram[6],state->io_ram[7]);
|
||||
// popmessage("%02x %02x",state->io_ram[6],state->io_ram[7]);
|
||||
|
||||
switch (offset)
|
||||
{
|
||||
@ -150,11 +153,11 @@ WRITE8_HANDLER( prosoccr_io_w )
|
||||
/* x--- ---- used on the attract mode */
|
||||
break;
|
||||
case 8: /* Irq ack */
|
||||
cputag_set_input_line(space->machine, "maincpu", DECO16_IRQ_LINE, CLEAR_LINE);
|
||||
cpu_set_input_line(state->maincpu, DECO16_IRQ_LINE, CLEAR_LINE);
|
||||
break;
|
||||
case 9: /* Sound */
|
||||
soundlatch_w(space, 0, data);
|
||||
cputag_set_input_line(space->machine, "audiocpu", M6502_IRQ_LINE, HOLD_LINE);
|
||||
cpu_set_input_line(state->audiocpu, M6502_IRQ_LINE, HOLD_LINE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -170,14 +173,14 @@ WRITE8_HANDLER( prosport_io_w )
|
||||
case 0:
|
||||
//background_disable = ~data & 0x80;
|
||||
flip_screen_set(space->machine, data & 0x80);
|
||||
tilemap_mark_all_tiles_dirty(state->background_tilemap);
|
||||
tilemap_mark_all_tiles_dirty(state->back_tilemap);
|
||||
break;
|
||||
case 2: /* Sound */
|
||||
soundlatch_w(space, 0, data);
|
||||
cputag_set_input_line(space->machine, "audiocpu", M6502_IRQ_LINE, HOLD_LINE);
|
||||
cpu_set_input_line(state->audiocpu, M6502_IRQ_LINE, HOLD_LINE);
|
||||
break;
|
||||
case 4: /* Irq ack */
|
||||
cputag_set_input_line(space->machine, "maincpu", DECO16_IRQ_LINE, CLEAR_LINE);
|
||||
cpu_set_input_line(state->maincpu, DECO16_IRQ_LINE, CLEAR_LINE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -200,7 +203,7 @@ WRITE8_HANDLER( prosport_bg_vram_w )
|
||||
{
|
||||
liberate_state *state = (liberate_state *)space->machine->driver_data;
|
||||
state->bg_vram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->background_tilemap, offset);
|
||||
tilemap_mark_tile_dirty(state->back_tilemap, offset);
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
@ -208,47 +211,48 @@ WRITE8_HANDLER( prosport_bg_vram_w )
|
||||
VIDEO_START( prosoccr )
|
||||
{
|
||||
liberate_state *state = (liberate_state *)machine->driver_data;
|
||||
state->background_tilemap = tilemap_create(machine, get_back_tile_info,back_scan,16,16,32,32);
|
||||
state->fix_tilemap = tilemap_create(machine, get_fix_tile_info,fix_scan,8,8,32,32);
|
||||
state->back_tilemap = tilemap_create(machine, get_back_tile_info, back_scan, 16, 16, 32, 32);
|
||||
state->fix_tilemap = tilemap_create(machine, get_fix_tile_info, fix_scan, 8, 8, 32, 32);
|
||||
|
||||
tilemap_set_transparent_pen(state->fix_tilemap,0);
|
||||
tilemap_set_transparent_pen(state->fix_tilemap, 0);
|
||||
|
||||
state->charram = auto_alloc_array(machine, UINT8, 0x1800*2);
|
||||
state->charram = auto_alloc_array(machine, UINT8, 0x1800 * 2);
|
||||
}
|
||||
|
||||
VIDEO_START( boomrang )
|
||||
{
|
||||
liberate_state *state = (liberate_state *)machine->driver_data;
|
||||
state->background_tilemap = tilemap_create(machine, get_back_tile_info,back_scan,16,16,32,32);
|
||||
state->fix_tilemap = tilemap_create(machine, get_fix_tile_info,fix_scan,8,8,32,32);
|
||||
state->back_tilemap = tilemap_create(machine, get_back_tile_info, back_scan, 16, 16, 32, 32);
|
||||
state->fix_tilemap = tilemap_create(machine, get_fix_tile_info, fix_scan, 8, 8, 32, 32);
|
||||
|
||||
tilemap_set_transmask(state->background_tilemap,0,0x0001,0x007e); /* Bottom 1 pen/Top 7 pens */
|
||||
tilemap_set_transparent_pen(state->fix_tilemap,0);
|
||||
tilemap_set_transmask(state->back_tilemap, 0, 0x0001, 0x007e); /* Bottom 1 pen/Top 7 pens */
|
||||
tilemap_set_transparent_pen(state->fix_tilemap, 0);
|
||||
}
|
||||
|
||||
VIDEO_START( liberate )
|
||||
{
|
||||
liberate_state *state = (liberate_state *)machine->driver_data;
|
||||
state->background_tilemap = tilemap_create(machine, get_back_tile_info,back_scan,16,16,32,32);
|
||||
state->fix_tilemap = tilemap_create(machine, get_fix_tile_info,fix_scan,8,8,32,32);
|
||||
state->back_tilemap = tilemap_create(machine, get_back_tile_info, back_scan, 16, 16, 32, 32);
|
||||
state->fix_tilemap = tilemap_create(machine, get_fix_tile_info, fix_scan, 8, 8, 32, 32);
|
||||
|
||||
tilemap_set_transparent_pen(state->fix_tilemap,0);
|
||||
tilemap_set_transparent_pen(state->fix_tilemap, 0);
|
||||
}
|
||||
|
||||
VIDEO_START( prosport )
|
||||
{
|
||||
liberate_state *state = (liberate_state *)machine->driver_data;
|
||||
state->background_tilemap = tilemap_create(machine, prosport_get_back_tile_info,back_scan,16,16,32,32);
|
||||
state->fix_tilemap = tilemap_create(machine, get_fix_tile_info,fix_scan,8,8,32,32);
|
||||
state->back_tilemap = tilemap_create(machine, prosport_get_back_tile_info, back_scan, 16, 16, 32, 32);
|
||||
state->fix_tilemap = tilemap_create(machine, get_fix_tile_info, fix_scan, 8, 8, 32, 32);
|
||||
|
||||
tilemap_set_transparent_pen(state->fix_tilemap,0);
|
||||
tilemap_set_transparent_pen(state->fix_tilemap, 0);
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
WRITE8_HANDLER( prosport_paletteram_w )
|
||||
{
|
||||
space->machine->generic.paletteram.u8[offset] = data;
|
||||
liberate_state *state = (liberate_state *)space->machine->driver_data;
|
||||
state->paletteram[offset] = data;
|
||||
|
||||
/* RGB output is inverted */
|
||||
palette_set_color_rgb(space->machine, offset, pal3bit(~data >> 0), pal3bit(~data >> 3), pal2bit(~data >> 6));
|
||||
@ -256,7 +260,7 @@ WRITE8_HANDLER( prosport_paletteram_w )
|
||||
|
||||
PALETTE_INIT( liberate )
|
||||
{
|
||||
int i,bit0,bit1,bit2,g,r,b;
|
||||
int i, bit0, bit1, bit2, g, r, b;
|
||||
|
||||
for (i = 0;i < 32;i++)
|
||||
{
|
||||
@ -286,15 +290,16 @@ PALETTE_INIT( liberate )
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
static void liberate_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
|
||||
static void liberate_draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
{
|
||||
UINT8 *spriteram = machine->generic.spriteram.u8;
|
||||
liberate_state *state = (liberate_state *)machine->driver_data;
|
||||
UINT8 *spriteram = state->spriteram;
|
||||
int offs;
|
||||
|
||||
/* Sprites */
|
||||
for (offs = 0x000;offs < 0x800;offs += 4)
|
||||
for (offs = 0x000; offs < 0x800; offs += 4)
|
||||
{
|
||||
int multi,fx,fy,sx,sy,sy2,code,color;
|
||||
int multi, fx, fy, sx, sy, sy2, code, color;
|
||||
|
||||
/*
|
||||
Byte 0: 0x01 - ?
|
||||
@ -309,34 +314,35 @@ static void liberate_draw_sprites(running_machine *machine, bitmap_t *bitmap, co
|
||||
Byte 3: 0xff - X position
|
||||
*/
|
||||
|
||||
code = spriteram[offs+1] + ((spriteram[offs+0] & 0x60) << 3);
|
||||
sx = 240 - spriteram[offs+3];
|
||||
sy = 240 - spriteram[offs+2];
|
||||
color = ((spriteram[offs+1] & 0x08) >> 3); // ?
|
||||
code = spriteram[offs + 1] + ((spriteram[offs + 0] & 0x60) << 3);
|
||||
sx = 240 - spriteram[offs + 3];
|
||||
sy = 240 - spriteram[offs + 2];
|
||||
color = ((spriteram[offs + 1] & 0x08) >> 3); // ?
|
||||
|
||||
fx = spriteram[offs+0] & 0x04;
|
||||
fy = spriteram[offs+0] & 0x02;
|
||||
multi = spriteram[offs+0] & 0x10;
|
||||
fx = spriteram[offs + 0] & 0x04;
|
||||
fy = spriteram[offs + 0] & 0x02;
|
||||
multi = spriteram[offs + 0] & 0x10;
|
||||
|
||||
if (multi && fy==0) sy-=16;
|
||||
if (multi && fy == 0)
|
||||
sy -= 16;
|
||||
|
||||
if (flip_screen_get(machine))
|
||||
{
|
||||
sy=240-sy;
|
||||
sx=240-sx;
|
||||
sy = 240 - sy;
|
||||
sx = 240 - sx;
|
||||
if (fy)
|
||||
sy2=sy+16;
|
||||
sy2 = sy + 16;
|
||||
else
|
||||
sy2=sy-16;
|
||||
if (fx) fx=0; else fx=1;
|
||||
if (fy) fy=0; else fy=1;
|
||||
sy2 = sy - 16;
|
||||
if (fx) fx = 0; else fx = 1;
|
||||
if (fy) fy = 0; else fy = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fy)
|
||||
sy2=sy-16;
|
||||
sy2 = sy - 16;
|
||||
else
|
||||
sy2=sy+16;
|
||||
sy2 = sy + 16;
|
||||
}
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect,machine->gfx[1],
|
||||
@ -353,53 +359,55 @@ static void liberate_draw_sprites(running_machine *machine, bitmap_t *bitmap, co
|
||||
}
|
||||
}
|
||||
|
||||
static void prosport_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
|
||||
static void prosport_draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
{
|
||||
liberate_state *state = (liberate_state *)machine->driver_data;
|
||||
int offs,multi,fx,fy,sx,sy,sy2,code,code2,color,gfx_region;
|
||||
UINT8 *spriteram = machine->generic.spriteram.u8;
|
||||
int offs, multi, fx, fy, sx, sy, sy2, code, code2, color, gfx_region;
|
||||
UINT8 *spriteram = state->spriteram;
|
||||
|
||||
for (offs = 0x000;offs < 0x800;offs += 4)
|
||||
for (offs = 0x000; offs < 0x800; offs += 4)
|
||||
{
|
||||
if ((spriteram[offs+0]&1)!=1) continue;
|
||||
if ((spriteram[offs + 0] & 1) != 1)
|
||||
continue;
|
||||
|
||||
code = spriteram[offs+1] + ((spriteram[offs+0]&0x3)<<8);
|
||||
code2=code+1;
|
||||
code = spriteram[offs + 1] + ((spriteram[offs + 0] & 0x3) << 8);
|
||||
code2 = code + 1;
|
||||
|
||||
if(state->io_ram[0]&0x40) //dynamic ram-based gfxs for Pro Golf
|
||||
gfx_region = 3+4;
|
||||
if(state->io_ram[0] & 0x40) //dynamic ram-based gfxs for Pro Golf
|
||||
gfx_region = 3 + 4;
|
||||
else
|
||||
gfx_region = ((state->io_ram[0]&0x30)>>4)+4;
|
||||
gfx_region = ((state->io_ram[0] & 0x30) >> 4) + 4;
|
||||
|
||||
|
||||
multi = spriteram[offs+0] & 0x10;
|
||||
multi = spriteram[offs + 0] & 0x10;
|
||||
|
||||
sy=spriteram[offs+2];
|
||||
if (multi) sy+=16;
|
||||
sx = (240 - spriteram[offs+3]);
|
||||
// sy = (240-spriteram[offs+2]);//-16;
|
||||
sy = 240-sy;
|
||||
sy = spriteram[offs + 2];
|
||||
if (multi)
|
||||
sy += 16;
|
||||
sx = (240 - spriteram[offs + 3]);
|
||||
// sy = (240 - spriteram[offs + 2]);//-16;
|
||||
sy = 240 - sy;
|
||||
|
||||
color = 1;//(state->io_ram[4] & 2)+1;//(spriteram[offs+0]&0x4)>>2;
|
||||
color = 1;//(state->io_ram[4] & 2) + 1;//(spriteram[offs + 0] & 0x4) >> 2;
|
||||
|
||||
fy = spriteram[offs+0] & 0x02;
|
||||
fx = spriteram[offs+0] & 0x04;
|
||||
multi = 0;// spriteram[offs+0] & 0x10;
|
||||
fy = spriteram[offs + 0] & 0x02;
|
||||
fx = spriteram[offs + 0] & 0x04;
|
||||
multi = 0;// spriteram[offs + 0] & 0x10;
|
||||
|
||||
// if (multi) sy-=16;
|
||||
if ((fy && multi) || (fx && multi)) { code2=code; code++; }
|
||||
// if (multi) sy -= 16;
|
||||
if ((fy && multi) || (fx && multi)) { code2 = code; code++; }
|
||||
|
||||
if (flip_screen_get(machine))
|
||||
{
|
||||
sy=240-sy;
|
||||
sx=240-sx;
|
||||
if (fx) fx=0; else fx=1;
|
||||
if (fy) fy=0; else fy=1;
|
||||
sy2=sy-16;
|
||||
sy = 240 - sy;
|
||||
sx = 240 - sx;
|
||||
if (fx) fx = 0; else fx = 1;
|
||||
if (fy) fy = 0; else fy = 1;
|
||||
sy2 = sy - 16;
|
||||
}
|
||||
else
|
||||
{
|
||||
sy2=sy+16;
|
||||
sy2 = sy + 16;
|
||||
}
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect,machine->gfx[gfx_region],
|
||||
@ -416,47 +424,51 @@ static void prosport_draw_sprites(running_machine *machine, bitmap_t *bitmap, co
|
||||
}
|
||||
}
|
||||
|
||||
static void boomrang_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int pri)
|
||||
static void boomrang_draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int pri )
|
||||
{
|
||||
UINT8 *spriteram = machine->generic.spriteram.u8;
|
||||
int offs,multi,fx,fy,sx,sy,sy2,code,code2,color;
|
||||
liberate_state *state = (liberate_state *)machine->driver_data;
|
||||
UINT8 *spriteram = state->spriteram;
|
||||
int offs, multi, fx, fy, sx, sy, sy2, code, code2, color;
|
||||
|
||||
for (offs = 0x000;offs < 0x800;offs += 4)
|
||||
for (offs = 0x000; offs < 0x800; offs += 4)
|
||||
{
|
||||
if ((spriteram[offs+0]&1)!=1) continue;
|
||||
if ((spriteram[offs+0]&0x8)!=pri) continue;
|
||||
if ((spriteram[offs + 0] & 1) != 1)
|
||||
continue;
|
||||
if ((spriteram[offs + 0] & 0x8) != pri)
|
||||
continue;
|
||||
|
||||
code = spriteram[offs+1] + ((spriteram[offs+0]&0xe0)<<3);
|
||||
code2=code+1;
|
||||
code = spriteram[offs + 1] + ((spriteram[offs + 0] & 0xe0) << 3);
|
||||
code2 = code + 1;
|
||||
|
||||
multi = spriteram[offs+0] & 0x10;
|
||||
multi = spriteram[offs + 0] & 0x10;
|
||||
|
||||
sy=spriteram[offs+2];
|
||||
if (multi) sy+=16;
|
||||
sx = (240 - spriteram[offs+3]);
|
||||
// sy = (240-spriteram[offs+2]);//-16;
|
||||
sy = 240-sy;
|
||||
sy=spriteram[offs + 2];
|
||||
if (multi)
|
||||
sy += 16;
|
||||
sx = (240 - spriteram[offs + 3]);
|
||||
// sy = (240-spriteram[offs + 2]);//-16;
|
||||
sy = 240 - sy;
|
||||
|
||||
color = (spriteram[offs+0]&0x4)>>2;
|
||||
color = (spriteram[offs + 0] & 0x4) >> 2;
|
||||
|
||||
fx = 0;
|
||||
fy = spriteram[offs+0] & 0x02;
|
||||
multi = spriteram[offs+0] & 0x10;
|
||||
fy = spriteram[offs + 0] & 0x02;
|
||||
multi = spriteram[offs + 0] & 0x10;
|
||||
|
||||
// if (multi) sy-=16;
|
||||
if (fy && multi) { code2=code; code++; }
|
||||
// if (multi) sy -= 16;
|
||||
if (fy && multi) { code2 = code; code++; }
|
||||
|
||||
if (flip_screen_get(machine))
|
||||
{
|
||||
sy=240-sy;
|
||||
sx=240-sx;
|
||||
if (fx) fx=0; else fx=1;
|
||||
if (fy) fy=0; else fy=1;
|
||||
sy2=sy-16;
|
||||
sy = 240 - sy;
|
||||
sx = 240 - sx;
|
||||
if (fx) fx = 0; else fx = 1;
|
||||
if (fy) fy = 0; else fy = 1;
|
||||
sy2 = sy - 16;
|
||||
}
|
||||
else
|
||||
{
|
||||
sy2=sy+16;
|
||||
sy2 = sy + 16;
|
||||
}
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect,machine->gfx[1],
|
||||
@ -473,20 +485,22 @@ static void boomrang_draw_sprites(running_machine *machine, bitmap_t *bitmap, co
|
||||
}
|
||||
}
|
||||
|
||||
static void prosoccr_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
|
||||
static void prosoccr_draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
{
|
||||
UINT8 *spriteram = machine->generic.spriteram.u8;
|
||||
int offs,code,fx,fy,sx,sy;
|
||||
liberate_state *state = (liberate_state *)machine->driver_data;
|
||||
UINT8 *spriteram = state->spriteram;
|
||||
int offs, code, fx, fy, sx, sy;
|
||||
|
||||
for (offs = 0x000;offs < 0x400;offs += 4)
|
||||
for (offs = 0x000; offs < 0x400; offs += 4)
|
||||
{
|
||||
if ((spriteram[offs+0]&1)!=1) continue;
|
||||
if ((spriteram[offs + 0] & 1) != 1)
|
||||
continue;
|
||||
|
||||
code = spriteram[offs+1];
|
||||
sy = 240 - spriteram[offs+2];
|
||||
sx = 240 - spriteram[offs+3];
|
||||
fx = spriteram[offs+0] & 4;
|
||||
fy = spriteram[offs+0] & 2;
|
||||
code = spriteram[offs + 1];
|
||||
sy = 240 - spriteram[offs + 2];
|
||||
sx = 240 - spriteram[offs + 3];
|
||||
fx = spriteram[offs + 0] & 4;
|
||||
fy = spriteram[offs + 0] & 2;
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect,machine->gfx[1],
|
||||
code,
|
||||
@ -501,16 +515,16 @@ static void prosoccr_draw_sprites(running_machine *machine, bitmap_t *bitmap, co
|
||||
VIDEO_UPDATE( prosoccr )
|
||||
{
|
||||
liberate_state *state = (liberate_state *)screen->machine->driver_data;
|
||||
tilemap_set_scrolly(state->background_tilemap,0, state->io_ram[1]);
|
||||
tilemap_set_scrollx(state->background_tilemap,0,-state->io_ram[0]);
|
||||
tilemap_set_scrolly(state->back_tilemap, 0, state->io_ram[1]);
|
||||
tilemap_set_scrollx(state->back_tilemap, 0, -state->io_ram[0]);
|
||||
|
||||
if (state->background_disable)
|
||||
bitmap_fill(bitmap,cliprect,32);
|
||||
bitmap_fill(bitmap, cliprect, 32);
|
||||
else
|
||||
tilemap_draw(bitmap,cliprect,state->background_tilemap,0,0);
|
||||
tilemap_draw(bitmap, cliprect, state->back_tilemap, 0, 0);
|
||||
|
||||
tilemap_draw(bitmap,cliprect,state->fix_tilemap,0,0);
|
||||
prosoccr_draw_sprites(screen->machine,bitmap,cliprect);
|
||||
tilemap_draw(bitmap, cliprect, state->fix_tilemap, 0, 0);
|
||||
prosoccr_draw_sprites(screen->machine, bitmap, cliprect);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -520,41 +534,41 @@ VIDEO_UPDATE( prosport )
|
||||
liberate_state *state = (liberate_state *)screen->machine->driver_data;
|
||||
UINT8 *videoram = state->videoram;
|
||||
UINT8 *colorram = state->colorram;
|
||||
int mx,my,tile,offs,gfx_region;
|
||||
int scrollx,scrolly;
|
||||
int mx, my, tile, offs, gfx_region;
|
||||
int scrollx, scrolly;
|
||||
|
||||
bitmap_fill(bitmap,cliprect,0);
|
||||
bitmap_fill(bitmap, cliprect, 0);
|
||||
|
||||
offs = 0;
|
||||
/* TODO: what's bits 0 and 2 for? Internal scrolling state? */
|
||||
scrolly = ((state->io_ram[0] & 0x8)<<5);
|
||||
scrollx = ((state->io_ram[0] & 0x2)<<7) | (state->io_ram[1]);
|
||||
scrolly = ((state->io_ram[0] & 0x8) << 5);
|
||||
scrollx = ((state->io_ram[0] & 0x2) << 7) | (state->io_ram[1]);
|
||||
|
||||
tilemap_set_scrolly(state->background_tilemap,0,scrolly);
|
||||
tilemap_set_scrollx(state->background_tilemap,0,-scrollx);
|
||||
tilemap_set_scrolly(state->back_tilemap, 0, scrolly);
|
||||
tilemap_set_scrollx(state->back_tilemap, 0, -scrollx);
|
||||
|
||||
tilemap_draw(bitmap,cliprect,state->background_tilemap,0,0);
|
||||
tilemap_draw(bitmap, cliprect, state->back_tilemap, 0, 0);
|
||||
|
||||
// popmessage("%d %02x %02x %02x %02x %02x %02x %02x %02x",scrollx,deco16_io_ram[0],deco16_io_ram[1],deco16_io_ram[2],deco16_io_ram[3]
|
||||
// ,deco16_io_ram[4],deco16_io_ram[5],deco16_io_ram[6],deco16_io_ram[7]);
|
||||
|
||||
for (offs = 0;offs < 0x400;offs++)
|
||||
for (offs = 0; offs < 0x400; offs++)
|
||||
{
|
||||
tile=videoram[offs]+((colorram[offs]&0x3)<<8);
|
||||
tile = videoram[offs] + ((colorram[offs] & 0x3) << 8);
|
||||
|
||||
if(state->io_ram[0]&0x40) //dynamic ram-based gfxs for Pro Golf
|
||||
if(state->io_ram[0] & 0x40) //dynamic ram-based gfxs for Pro Golf
|
||||
gfx_region = 3;
|
||||
else
|
||||
gfx_region = ((state->io_ram[0]&0x30)>>4);
|
||||
gfx_region = ((state->io_ram[0] & 0x30) >> 4);
|
||||
|
||||
my = (offs) % 32;
|
||||
mx = (offs) / 32;
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect,screen->machine->gfx[gfx_region],
|
||||
tile,1,0,0,248-8*mx,8*my,0);
|
||||
drawgfx_transpen(bitmap, cliprect,screen->machine->gfx[gfx_region],
|
||||
tile, 1, 0, 0, 248 - 8 * mx, 8 * my, 0);
|
||||
}
|
||||
|
||||
prosport_draw_sprites(screen->machine,bitmap,cliprect);
|
||||
prosport_draw_sprites(screen->machine, bitmap, cliprect);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -562,34 +576,35 @@ VIDEO_UPDATE( prosport )
|
||||
VIDEO_UPDATE( boomrang )
|
||||
{
|
||||
liberate_state *state = (liberate_state *)screen->machine->driver_data;
|
||||
tilemap_set_scrolly(state->background_tilemap,0, state->io_ram[1]);
|
||||
tilemap_set_scrollx(state->background_tilemap,0,-state->io_ram[0]);
|
||||
tilemap_set_scrolly(state->back_tilemap, 0, state->io_ram[1]);
|
||||
tilemap_set_scrollx(state->back_tilemap, 0, -state->io_ram[0]);
|
||||
|
||||
if (state->background_disable)
|
||||
bitmap_fill(bitmap,cliprect,32);
|
||||
bitmap_fill(bitmap, cliprect, 32);
|
||||
else
|
||||
tilemap_draw(bitmap,cliprect,state->background_tilemap,TILEMAP_DRAW_LAYER1,0);
|
||||
tilemap_draw(bitmap, cliprect, state->back_tilemap, TILEMAP_DRAW_LAYER1, 0);
|
||||
|
||||
boomrang_draw_sprites(screen->machine,bitmap,cliprect,8);
|
||||
if (!state->background_disable)
|
||||
tilemap_draw(bitmap,cliprect,state->background_tilemap,TILEMAP_DRAW_LAYER0,0);
|
||||
boomrang_draw_sprites(screen->machine,bitmap,cliprect,0);
|
||||
tilemap_draw(bitmap,cliprect,state->fix_tilemap,0,0);
|
||||
tilemap_draw(bitmap, cliprect, state->back_tilemap, TILEMAP_DRAW_LAYER0, 0);
|
||||
|
||||
boomrang_draw_sprites(screen->machine, bitmap, cliprect, 0);
|
||||
tilemap_draw(bitmap, cliprect, state->fix_tilemap, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
VIDEO_UPDATE( liberate )
|
||||
{
|
||||
liberate_state *state = (liberate_state *)screen->machine->driver_data;
|
||||
tilemap_set_scrolly(state->background_tilemap,0, state->io_ram[1]);
|
||||
tilemap_set_scrollx(state->background_tilemap,0,-state->io_ram[0]);
|
||||
tilemap_set_scrolly(state->back_tilemap, 0, state->io_ram[1]);
|
||||
tilemap_set_scrollx(state->back_tilemap, 0, -state->io_ram[0]);
|
||||
|
||||
if (state->background_disable)
|
||||
bitmap_fill(bitmap,cliprect,32);
|
||||
bitmap_fill(bitmap, cliprect, 32);
|
||||
else
|
||||
tilemap_draw(bitmap,cliprect,state->background_tilemap,0,0);
|
||||
tilemap_draw(bitmap, cliprect, state->back_tilemap, 0, 0);
|
||||
|
||||
liberate_draw_sprites(screen->machine,bitmap,cliprect);
|
||||
tilemap_draw(bitmap,cliprect,state->fix_tilemap,0,0);
|
||||
liberate_draw_sprites(screen->machine, bitmap, cliprect);
|
||||
tilemap_draw(bitmap, cliprect, state->fix_tilemap, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,11 +1,8 @@
|
||||
#include "emu.h"
|
||||
#include "includes/lkage.h"
|
||||
/***************************************************************************
|
||||
|
||||
video/lkage.c
|
||||
|
||||
static tilemap_t *bg_tilemap, *fg_tilemap, *tx_tilemap;
|
||||
static UINT8 bg_tile_bank, fg_tile_bank;
|
||||
UINT8 *lkage_scroll, *lkage_vreg;
|
||||
|
||||
/*
|
||||
lkage_scroll[0x00]: text layer horizontal scroll
|
||||
lkage_scroll[0x01]: text layer vertical scroll
|
||||
lkage_scroll[0x02]: foreground layer horizontal scroll
|
||||
@ -35,71 +32,84 @@ UINT8 *lkage_scroll, *lkage_vreg;
|
||||
04 1e f3 : attract#2 110
|
||||
04 1e f3 : attract#3 110
|
||||
00 4e f3 : attract#4 110
|
||||
*/
|
||||
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "includes/lkage.h"
|
||||
|
||||
|
||||
WRITE8_HANDLER( lkage_videoram_w )
|
||||
{
|
||||
space->machine->generic.videoram.u8[offset] = data;
|
||||
lkage_state *state = (lkage_state *)space->machine->driver_data;
|
||||
|
||||
switch( offset/0x400 )
|
||||
state->videoram[offset] = data;
|
||||
|
||||
switch (offset / 0x400)
|
||||
{
|
||||
case 0:
|
||||
tilemap_mark_tile_dirty(tx_tilemap,offset & 0x3ff);
|
||||
tilemap_mark_tile_dirty(state->tx_tilemap, offset & 0x3ff);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
tilemap_mark_tile_dirty(fg_tilemap,offset & 0x3ff);
|
||||
tilemap_mark_tile_dirty(state->fg_tilemap, offset & 0x3ff);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
tilemap_mark_tile_dirty(bg_tilemap,offset & 0x3ff);
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset & 0x3ff);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} /* lkage_videoram_w */
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( get_bg_tile_info )
|
||||
{
|
||||
int code = machine->generic.videoram.u8[tile_index + 0x800] + 256 * (bg_tile_bank?5:1);
|
||||
lkage_state *state = (lkage_state *)machine->driver_data;
|
||||
int code = state->videoram[tile_index + 0x800] + 256 * (state->bg_tile_bank ? 5 : 1);
|
||||
SET_TILE_INFO( 0/*gfx*/, code, 0/*color*/, 0/*flags*/ );
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( get_fg_tile_info )
|
||||
{
|
||||
int code = machine->generic.videoram.u8[tile_index + 0x400] + 256 * (fg_tile_bank?1:0);
|
||||
lkage_state *state = (lkage_state *)machine->driver_data;
|
||||
int code = state->videoram[tile_index + 0x400] + 256 * (state->fg_tile_bank ? 1 : 0);
|
||||
SET_TILE_INFO( 0/*gfx*/, code, 0/*color*/, 0/*flags*/);
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( get_tx_tile_info )
|
||||
{
|
||||
int code = machine->generic.videoram.u8[tile_index];
|
||||
lkage_state *state = (lkage_state *)machine->driver_data;
|
||||
int code = state->videoram[tile_index];
|
||||
SET_TILE_INFO( 0/*gfx*/, code, 0/*color*/, 0/*flags*/);
|
||||
}
|
||||
|
||||
VIDEO_START( lkage )
|
||||
{
|
||||
bg_tile_bank = fg_tile_bank = 0;
|
||||
lkage_state *state = (lkage_state *)machine->driver_data;
|
||||
|
||||
bg_tilemap = tilemap_create(machine, get_bg_tile_info,tilemap_scan_rows, 8,8,32,32);
|
||||
fg_tilemap = tilemap_create(machine, get_fg_tile_info,tilemap_scan_rows,8,8,32,32);
|
||||
tx_tilemap = tilemap_create(machine, get_tx_tile_info,tilemap_scan_rows,8,8,32,32);
|
||||
state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
state->fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
state->tx_tilemap = tilemap_create(machine, get_tx_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
|
||||
tilemap_set_transparent_pen(fg_tilemap,0);
|
||||
tilemap_set_transparent_pen(tx_tilemap,0);
|
||||
tilemap_set_transparent_pen(state->fg_tilemap, 0);
|
||||
tilemap_set_transparent_pen(state->tx_tilemap, 0);
|
||||
|
||||
tilemap_set_scrolldx(bg_tilemap,-5,-5+24);
|
||||
tilemap_set_scrolldx(fg_tilemap,-3,-3+24);
|
||||
tilemap_set_scrolldx(tx_tilemap,-1,-1+24);
|
||||
} /* VIDEO_START( lkage ) */
|
||||
tilemap_set_scrolldx(state->bg_tilemap, -5, -5 + 24);
|
||||
tilemap_set_scrolldx(state->fg_tilemap, -3, -3 + 24);
|
||||
tilemap_set_scrolldx(state->tx_tilemap, -1, -1 + 24);
|
||||
}
|
||||
|
||||
|
||||
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
{
|
||||
const UINT8 *source = machine->generic.spriteram.u8;
|
||||
const UINT8 *finish = source+0x60;
|
||||
while( source<finish )
|
||||
lkage_state *state = (lkage_state *)machine->driver_data;
|
||||
const UINT8 *source = state->spriteram;
|
||||
const UINT8 *finish = source + 0x60;
|
||||
|
||||
while (source < finish)
|
||||
{
|
||||
int attributes = source[2];
|
||||
/* 0x01: horizontal flip
|
||||
@ -110,22 +120,22 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
* 0x80: priority
|
||||
*/
|
||||
int priority_mask = 0;
|
||||
int color = (attributes>>4)&7;
|
||||
int flipx = attributes&0x01;
|
||||
int flipy = attributes&0x02;
|
||||
int height = (attributes&0x08) ? 2 : 1;
|
||||
int sx = source[0]-15;
|
||||
int sy = 256-16*height-source[1];
|
||||
int color = (attributes >> 4) & 7;
|
||||
int flipx = attributes & 0x01;
|
||||
int flipy = attributes & 0x02;
|
||||
int height = (attributes & 0x08) ? 2 : 1;
|
||||
int sx = source[0] - 15;
|
||||
int sy = 256 - 16 * height - source[1];
|
||||
int sprite_number = source[3] + ((attributes & 0x04) << 6);
|
||||
int y;
|
||||
|
||||
if( attributes&0x80 )
|
||||
if (attributes & 0x80)
|
||||
{
|
||||
priority_mask = (0xf0|0xcc );
|
||||
priority_mask = (0xf0 | 0xcc);
|
||||
}
|
||||
else
|
||||
{
|
||||
priority_mask = (0xf0);
|
||||
priority_mask = 0xf0;
|
||||
}
|
||||
|
||||
if (flip_screen_x_get(machine))
|
||||
@ -133,9 +143,9 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
sx = 239 - sx - 24;
|
||||
flipx = !flipx;
|
||||
}
|
||||
if( flip_screen_y_get(machine) )
|
||||
if (flip_screen_y_get(machine))
|
||||
{
|
||||
sy = 254 - 16*height - sy;
|
||||
sy = 254 - 16 * height - sy;
|
||||
flipy = !flipy;
|
||||
}
|
||||
if (height == 2 && !flipy)
|
||||
@ -143,7 +153,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
sprite_number ^= 1;
|
||||
}
|
||||
|
||||
for (y = 0;y < height;y++)
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
pdrawgfx_transpen(
|
||||
bitmap,
|
||||
@ -157,55 +167,56 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
machine->priority_bitmap,
|
||||
priority_mask,0 );
|
||||
}
|
||||
source+=4;
|
||||
source += 4;
|
||||
}
|
||||
} /* draw_sprites */
|
||||
}
|
||||
|
||||
VIDEO_UPDATE( lkage )
|
||||
{
|
||||
lkage_state *state = (lkage_state *)screen->machine->driver_data;
|
||||
int bank;
|
||||
|
||||
flip_screen_x_set(screen->machine, ~lkage_vreg[2] & 0x01);
|
||||
flip_screen_y_set(screen->machine, ~lkage_vreg[2] & 0x02);
|
||||
flip_screen_x_set(screen->machine, ~state->vreg[2] & 0x01);
|
||||
flip_screen_y_set(screen->machine, ~state->vreg[2] & 0x02);
|
||||
|
||||
bank = lkage_vreg[1]&0x08;
|
||||
if( bg_tile_bank != bank )
|
||||
bank = state->vreg[1] & 0x08;
|
||||
if (state->bg_tile_bank != bank)
|
||||
{
|
||||
bg_tile_bank = bank;
|
||||
tilemap_mark_all_tiles_dirty( bg_tilemap );
|
||||
state->bg_tile_bank = bank;
|
||||
tilemap_mark_all_tiles_dirty(state->bg_tilemap);
|
||||
}
|
||||
|
||||
bank = lkage_vreg[0]&0x04;
|
||||
if( fg_tile_bank != bank )
|
||||
bank = state->vreg[0]&0x04;
|
||||
if (state->fg_tile_bank != bank)
|
||||
{
|
||||
fg_tile_bank = bank;
|
||||
tilemap_mark_all_tiles_dirty( fg_tilemap );
|
||||
state->fg_tile_bank = bank;
|
||||
tilemap_mark_all_tiles_dirty(state->fg_tilemap);
|
||||
}
|
||||
|
||||
tilemap_set_palette_offset( bg_tilemap, 0x300 + (lkage_vreg[1]&0xf0) );
|
||||
tilemap_set_palette_offset( fg_tilemap, 0x200 + (lkage_vreg[1]&0xf0) );
|
||||
tilemap_set_palette_offset( tx_tilemap, 0x110 );
|
||||
tilemap_set_palette_offset(state->bg_tilemap, 0x300 + (state->vreg[1] & 0xf0));
|
||||
tilemap_set_palette_offset(state->fg_tilemap, 0x200 + (state->vreg[1] & 0xf0));
|
||||
tilemap_set_palette_offset(state->tx_tilemap, 0x110);
|
||||
|
||||
tilemap_set_scrollx(tx_tilemap,0,lkage_scroll[0]);
|
||||
tilemap_set_scrolly(tx_tilemap,0,lkage_scroll[1]);
|
||||
tilemap_set_scrollx(state->tx_tilemap, 0, state->scroll[0]);
|
||||
tilemap_set_scrolly(state->tx_tilemap, 0, state->scroll[1]);
|
||||
|
||||
tilemap_set_scrollx(fg_tilemap,0,lkage_scroll[2]);
|
||||
tilemap_set_scrolly(fg_tilemap,0,lkage_scroll[3]);
|
||||
tilemap_set_scrollx(state->fg_tilemap, 0, state->scroll[2]);
|
||||
tilemap_set_scrolly(state->fg_tilemap, 0, state->scroll[3]);
|
||||
|
||||
tilemap_set_scrollx(bg_tilemap,0,lkage_scroll[4]);
|
||||
tilemap_set_scrolly(bg_tilemap,0,lkage_scroll[5]);
|
||||
tilemap_set_scrollx(state->bg_tilemap, 0, state->scroll[4]);
|
||||
tilemap_set_scrolly(state->bg_tilemap, 0, state->scroll[5]);
|
||||
|
||||
bitmap_fill(screen->machine->priority_bitmap, cliprect, 0);
|
||||
if ((lkage_vreg[2] & 0xf0) == 0xf0)
|
||||
if ((state->vreg[2] & 0xf0) == 0xf0)
|
||||
{
|
||||
tilemap_draw( bitmap,cliprect,bg_tilemap,0,1 );
|
||||
tilemap_draw( bitmap,cliprect,fg_tilemap,0,(lkage_vreg[1]&2)?2:4 );
|
||||
tilemap_draw( bitmap,cliprect,tx_tilemap,0,4 );
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 1);
|
||||
tilemap_draw(bitmap, cliprect, state->fg_tilemap, 0, (state->vreg[1] & 2) ? 2 : 4);
|
||||
tilemap_draw(bitmap, cliprect, state->tx_tilemap, 0, 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
tilemap_draw( bitmap,cliprect,tx_tilemap,TILEMAP_DRAW_OPAQUE,0);
|
||||
tilemap_draw(bitmap, cliprect, state->tx_tilemap, TILEMAP_DRAW_OPAQUE, 0);
|
||||
}
|
||||
draw_sprites(screen->machine, bitmap,cliprect );
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
@ -15,56 +15,6 @@
|
||||
#define FRAMEBUFFER_MAX_Y (UINT32)((FRAMEBUFFER_CLOCK / (float)(FRAMEBUFFER_MAX_X-1)) / ((float)PIXEL_CLOCK/(HTOTAL*VTOTAL)))
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Globals
|
||||
*
|
||||
*************************************/
|
||||
|
||||
UINT16 *lockon_char_ram;
|
||||
UINT16 *lockon_hud_ram;
|
||||
UINT16 *lockon_scene_ram;
|
||||
UINT16 *lockon_ground_ram;
|
||||
UINT16 *lockon_object_ram;
|
||||
|
||||
size_t lockon_hudram_size;
|
||||
size_t lockon_objectram_size;
|
||||
size_t lockon_groundram_size;
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Statics
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static tilemap_t *lockon_tilemap;
|
||||
static UINT8 ground_ctrl;
|
||||
static UINT16 scroll_h;
|
||||
static UINT16 scroll_v;
|
||||
|
||||
static bitmap_t *front_buffer;
|
||||
static bitmap_t *back_buffer;
|
||||
static emu_timer *bufend_timer;
|
||||
static emu_timer *cursor_timer;
|
||||
|
||||
/* Rotation Control */
|
||||
static UINT16 xsal;
|
||||
static UINT16 x0ll;
|
||||
static UINT16 dx0ll;
|
||||
static UINT16 dxll;
|
||||
static UINT16 ysal;
|
||||
static UINT16 y0ll;
|
||||
static UINT16 dy0ll;
|
||||
static UINT16 dyll;
|
||||
|
||||
/* Object palette RAM control */
|
||||
static UINT32 iden;
|
||||
static UINT8 *obj_pal_ram;
|
||||
static UINT32 obj_pal_latch;
|
||||
static UINT32 obj_pal_addr;
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* HD46505S-2 CRT Controller
|
||||
@ -114,10 +64,12 @@ WRITE16_HANDLER( lockon_crtc_w )
|
||||
|
||||
static TIMER_CALLBACK( cursor_callback )
|
||||
{
|
||||
if (lockon_main_inten)
|
||||
cputag_set_input_line_and_vector(machine, "maincpu", 0, HOLD_LINE, 0xff);
|
||||
lockon_state *state = (lockon_state *)machine->driver_data;
|
||||
|
||||
timer_adjust_oneshot(cursor_timer, video_screen_get_time_until_pos(machine->primary_screen, CURSOR_YPOS, CURSOR_XPOS), 0);
|
||||
if (state->main_inten)
|
||||
cpu_set_input_line_and_vector(state->maincpu, 0, HOLD_LINE, 0xff);
|
||||
|
||||
timer_adjust_oneshot(state->cursor_timer, video_screen_get_time_until_pos(machine->primary_screen, CURSOR_YPOS, CURSOR_XPOS), 0);
|
||||
}
|
||||
|
||||
/*************************************
|
||||
@ -158,15 +110,15 @@ PALETTE_INIT( lockon )
|
||||
|
||||
if (p2 & 0x80)
|
||||
{
|
||||
r = compute_res_net( (p2 >> 2) & 0x1f, 0, &lockon_net_info );
|
||||
g = compute_res_net( ((p1 >> 5) & 0x7) | (p2 & 3) << 3, 1, &lockon_net_info );
|
||||
b = compute_res_net( (p1 & 0x1f), 2, &lockon_net_info );
|
||||
r = compute_res_net((p2 >> 2) & 0x1f, 0, &lockon_net_info);
|
||||
g = compute_res_net(((p1 >> 5) & 0x7) | (p2 & 3) << 3, 1, &lockon_net_info);
|
||||
b = compute_res_net((p1 & 0x1f), 2, &lockon_net_info);
|
||||
}
|
||||
else
|
||||
{
|
||||
r = compute_res_net( (p2 >> 2) & 0x1f, 0, &lockon_pd_net_info );
|
||||
g = compute_res_net( ((p1 >> 5) & 0x7) | (p2 & 3) << 3, 1, &lockon_pd_net_info );
|
||||
b = compute_res_net( (p1 & 0x1f), 2, &lockon_pd_net_info );
|
||||
r = compute_res_net((p2 >> 2) & 0x1f, 0, &lockon_pd_net_info);
|
||||
g = compute_res_net(((p1 >> 5) & 0x7) | (p2 & 3) << 3, 1, &lockon_pd_net_info);
|
||||
b = compute_res_net((p1 & 0x1f), 2, &lockon_pd_net_info);
|
||||
}
|
||||
|
||||
palette_set_color(machine, i, MAKE_RGB(r, g, b));
|
||||
@ -182,14 +134,16 @@ PALETTE_INIT( lockon )
|
||||
|
||||
WRITE16_HANDLER( lockon_char_w )
|
||||
{
|
||||
lockon_char_ram[offset] = data;
|
||||
tilemap_mark_tile_dirty(lockon_tilemap, offset);
|
||||
lockon_state *state = (lockon_state *)space->machine->driver_data;
|
||||
state->char_ram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->tilemap, offset);
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( get_lockon_tile_info )
|
||||
{
|
||||
UINT32 tileno = lockon_char_ram[tile_index] & 0x03ff;
|
||||
UINT32 col = (lockon_char_ram[tile_index] >> 10) & 0x3f;
|
||||
lockon_state *state = (lockon_state *)machine->driver_data;
|
||||
UINT32 tileno = state->char_ram[tile_index] & 0x03ff;
|
||||
UINT32 col = (state->char_ram[tile_index] >> 10) & 0x3f;
|
||||
|
||||
col = (col & 0x1f) + (col & 0x20 ? 64 : 0);
|
||||
SET_TILE_INFO(0, tileno, col, 0);
|
||||
@ -204,16 +158,19 @@ static TILE_GET_INFO( get_lockon_tile_info )
|
||||
|
||||
WRITE16_HANDLER( lockon_scene_h_scr_w )
|
||||
{
|
||||
scroll_h = data & 0x1ff;
|
||||
lockon_state *state = (lockon_state *)space->machine->driver_data;
|
||||
state->scroll_h = data & 0x1ff;
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( lockon_scene_v_scr_w )
|
||||
{
|
||||
scroll_v = data & 0x81ff;
|
||||
lockon_state *state = (lockon_state *)space->machine->driver_data;
|
||||
state->scroll_v = data & 0x81ff;
|
||||
}
|
||||
|
||||
static void scene_draw(running_machine *machine)
|
||||
static void scene_draw( running_machine *machine )
|
||||
{
|
||||
lockon_state *state = (lockon_state *)machine->driver_data;
|
||||
UINT32 y;
|
||||
|
||||
/* 3bpp characters */
|
||||
@ -224,29 +181,29 @@ static void scene_draw(running_machine *machine)
|
||||
|
||||
for (y = 0; y < FRAMEBUFFER_MAX_Y; ++y)
|
||||
{
|
||||
UINT32 x;
|
||||
UINT32 d0 = 0, d1 = 0, d2 = 0;
|
||||
UINT32 colour = 0;
|
||||
UINT32 y_offs;
|
||||
UINT32 x_offs;
|
||||
UINT32 y_gran;
|
||||
UINT16 *bmpaddr;
|
||||
UINT32 ram_mask = 0x7ff;
|
||||
UINT32 x;
|
||||
UINT32 d0 = 0, d1 = 0, d2 = 0;
|
||||
UINT32 colour = 0;
|
||||
UINT32 y_offs;
|
||||
UINT32 x_offs;
|
||||
UINT32 y_gran;
|
||||
UINT16 *bmpaddr;
|
||||
UINT32 ram_mask = 0x7ff;
|
||||
|
||||
y_offs = (y + scroll_v) & 0x1ff;
|
||||
y_offs = (y + state->scroll_v) & 0x1ff;
|
||||
|
||||
/* Clamp - stops tilemap wrapping when screen is rotated */
|
||||
if (BIT(scroll_v, 15) && y_offs & 0x100)
|
||||
if (BIT(state->scroll_v, 15) && y_offs & 0x100)
|
||||
ram_mask = 0x7;
|
||||
|
||||
x_offs = (scroll_h - 8) & 0x1ff;
|
||||
x_offs = (state->scroll_h - 8) & 0x1ff;
|
||||
y_gran = y_offs & 7;
|
||||
|
||||
if (x_offs & 7)
|
||||
{
|
||||
UINT32 tileidx;
|
||||
UINT16 addr = ((y_offs & ~7) << 3) + ((x_offs >> 3) & 0x3f);
|
||||
UINT16 ram_val = lockon_scene_ram[addr & ram_mask];
|
||||
UINT16 ram_val = state->scene_ram[addr & ram_mask];
|
||||
|
||||
colour = (clut[ram_val & 0x7fff] & 0x3f) << 3;
|
||||
tileidx = ((ram_val & 0x0fff) << 3) + y_gran;
|
||||
@ -256,7 +213,7 @@ static void scene_draw(running_machine *machine)
|
||||
d2 = *(gfx3 + tileidx);
|
||||
}
|
||||
|
||||
bmpaddr = BITMAP_ADDR16(back_buffer, y, 0);
|
||||
bmpaddr = BITMAP_ADDR16(state->back_buffer, y, 0);
|
||||
|
||||
for (x = 0; x < FRAMEBUFFER_MAX_X; ++x)
|
||||
{
|
||||
@ -267,7 +224,7 @@ static void scene_draw(running_machine *machine)
|
||||
{
|
||||
UINT32 tileidx;
|
||||
UINT16 addr = ((y_offs & ~7) << 3) + ((x_offs >> 3) & 0x3f);
|
||||
UINT16 ram_val = lockon_scene_ram[addr & ram_mask];
|
||||
UINT16 ram_val = state->scene_ram[addr & ram_mask];
|
||||
|
||||
colour = (clut[ram_val & 0x7fff] & 0x3f) << 3;
|
||||
tileidx = ((ram_val & 0x0fff) << 3) + y_gran;
|
||||
@ -324,13 +281,15 @@ static void scene_draw(running_machine *machine)
|
||||
|
||||
WRITE16_HANDLER( lockon_ground_ctrl_w )
|
||||
{
|
||||
ground_ctrl = data & 0xff;
|
||||
lockon_state *state = (lockon_state *)space->machine->driver_data;
|
||||
state->ground_ctrl = data & 0xff;
|
||||
}
|
||||
|
||||
static TIMER_CALLBACK( bufend_callback )
|
||||
{
|
||||
cputag_set_input_line_and_vector(machine, "ground", 0, HOLD_LINE, 0xff);
|
||||
cputag_set_input_line(machine, "object", NEC_INPUT_LINE_POLL, ASSERT_LINE);
|
||||
lockon_state *state = (lockon_state *)machine->driver_data;
|
||||
cpu_set_input_line_and_vector(state->ground, 0, HOLD_LINE, 0xff);
|
||||
cpu_set_input_line(state->object, NEC_INPUT_LINE_POLL, ASSERT_LINE);
|
||||
}
|
||||
|
||||
/* Get data for a each 8x8x3 ground tile */
|
||||
@ -347,47 +306,49 @@ static TIMER_CALLBACK( bufend_callback )
|
||||
rom_data3 = gfx_rom[gfx_addr + 0x20000]; \
|
||||
}
|
||||
|
||||
static void ground_draw(running_machine *machine)
|
||||
static void ground_draw( running_machine *machine )
|
||||
{
|
||||
lockon_state *state = (lockon_state *)machine->driver_data;
|
||||
|
||||
/* ROM pointers */
|
||||
const UINT8 *const gfx_rom = memory_region(machine, "gfx4");
|
||||
const UINT8 *const lut_rom = gfx_rom + 0x30000 + ((ground_ctrl >> 2) & 0x3 ? 0x10000 : 0);
|
||||
const UINT8 *const lut_rom = gfx_rom + 0x30000 + ((state->ground_ctrl >> 2) & 0x3 ? 0x10000 : 0);
|
||||
const UINT8 *const clut_rom = gfx_rom + 0x50000;
|
||||
|
||||
UINT32 lut_a15_14 = (ground_ctrl & 0x3) << 14;
|
||||
UINT32 clut_a14_12 = (ground_ctrl & 0x70) << 8;
|
||||
UINT32 gfx_a15 = (ground_ctrl & 0x40) << 9;
|
||||
UINT32 lut_a15_14 = (state->ground_ctrl & 0x3) << 14;
|
||||
UINT32 clut_a14_12 = (state->ground_ctrl & 0x70) << 8;
|
||||
UINT32 gfx_a15 = (state->ground_ctrl & 0x40) << 9;
|
||||
UINT32 offs = 3;
|
||||
UINT32 y;
|
||||
|
||||
/* TODO: Clean up and emulate CS of GFX ROMs? */
|
||||
for (y = 0; y < FRAMEBUFFER_MAX_Y; ++y)
|
||||
{
|
||||
UINT16 *bmpaddr = BITMAP_ADDR16(back_buffer, y, 0);
|
||||
UINT8 ls163;
|
||||
UINT32 clut_addr;
|
||||
UINT32 gfx_addr;
|
||||
UINT8 rom_data1 = 0;
|
||||
UINT8 rom_data2 = 0;
|
||||
UINT8 rom_data3 = 0;
|
||||
UINT32 pal = 0;
|
||||
UINT32 x;
|
||||
UINT16 *bmpaddr = BITMAP_ADDR16(state->back_buffer, y, 0);
|
||||
UINT8 ls163;
|
||||
UINT32 clut_addr;
|
||||
UINT32 gfx_addr;
|
||||
UINT8 rom_data1 = 0;
|
||||
UINT8 rom_data2 = 0;
|
||||
UINT8 rom_data3 = 0;
|
||||
UINT32 pal = 0;
|
||||
UINT32 x;
|
||||
|
||||
/* Draw this line? */
|
||||
if (!(lockon_ground_ram[offs] & 0x8000))
|
||||
if (!(state->ground_ram[offs] & 0x8000))
|
||||
{
|
||||
UINT32 gfx_a2_0 = lockon_ground_ram[offs] & 0x0007;
|
||||
UINT32 gfx_a6_5 = (lockon_ground_ram[offs] & 0x0018) << 2;
|
||||
UINT32 clut_a4_3 = (lockon_ground_ram[offs] & 0x0018) >> 1;
|
||||
UINT8 tz2213_x = lockon_ground_ram[offs + 1] & 0xff;
|
||||
UINT8 tz2213_dx = lockon_ground_ram[offs + 2] & 0xff;
|
||||
UINT32 gfx_a2_0 = state->ground_ram[offs] & 0x0007;
|
||||
UINT32 gfx_a6_5 = (state->ground_ram[offs] & 0x0018) << 2;
|
||||
UINT32 clut_a4_3 = (state->ground_ram[offs] & 0x0018) >> 1;
|
||||
UINT8 tz2213_x = state->ground_ram[offs + 1] & 0xff;
|
||||
UINT8 tz2213_dx = state->ground_ram[offs + 2] & 0xff;
|
||||
|
||||
UINT32 lut_address = lut_a15_14 + ((lockon_ground_ram[offs] & 0x7fe0) >> 1);
|
||||
UINT32 cy = lockon_ground_ram[offs + 2] & 0x0100;
|
||||
UINT32 color;
|
||||
UINT32 gpbal2_0_prev;
|
||||
UINT32 lut_address = lut_a15_14 + ((state->ground_ram[offs] & 0x7fe0) >> 1);
|
||||
UINT32 cy = state->ground_ram[offs + 2] & 0x0100;
|
||||
UINT32 color;
|
||||
UINT32 gpbal2_0_prev;
|
||||
|
||||
ls163 = lockon_ground_ram[offs + 1] >> 8;
|
||||
ls163 = state->ground_ram[offs + 1] >> 8;
|
||||
|
||||
gpbal2_0_prev = ((ls163 & 3) << 1) | BIT(tz2213_x, 7);
|
||||
|
||||
@ -425,9 +386,9 @@ static void ground_draw(running_machine *machine)
|
||||
offs += 3;
|
||||
|
||||
/* End of list marker */
|
||||
if (lockon_ground_ram[offs + 2] & 0x8000)
|
||||
if (state->ground_ram[offs + 2] & 0x8000)
|
||||
{
|
||||
timer_adjust_oneshot(bufend_timer, attotime_mul(ATTOTIME_IN_HZ(FRAMEBUFFER_CLOCK), FRAMEBUFFER_MAX_X * y), 0);
|
||||
timer_adjust_oneshot(state->bufend_timer, attotime_mul(ATTOTIME_IN_HZ(FRAMEBUFFER_CLOCK), FRAMEBUFFER_MAX_X * y), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -464,7 +425,7 @@ do { \
|
||||
if (px < FRAMEBUFFER_MAX_X) \
|
||||
if (COLOR != 0xf) \
|
||||
{ \
|
||||
UINT8 clr = obj_pal_ram[(pal << 4) + COLOR]; \
|
||||
UINT8 clr = state->obj_pal_ram[(pal << 4) + COLOR]; \
|
||||
UINT16 *pix = (line + px); \
|
||||
if (!(clr == 0xff && ((*pix & 0xe00) == 0xa00))) \
|
||||
*pix = 0x400 + clr; \
|
||||
@ -472,16 +433,17 @@ do { \
|
||||
px = (px + 1) & 0x7ff; \
|
||||
} while(0)
|
||||
|
||||
static void objects_draw(running_machine *machine)
|
||||
static void objects_draw( running_machine *machine )
|
||||
{
|
||||
UINT32 offs;
|
||||
lockon_state *state = (lockon_state *)machine->driver_data;
|
||||
|
||||
const UINT8 *const romlut = memory_region(machine, "user1");
|
||||
const UINT16 *const chklut = (UINT16*)memory_region(machine, "user2");
|
||||
const UINT8 *const gfxrom = memory_region(machine, "gfx5");
|
||||
const UINT8 *const sproms = memory_region(machine, "proms") + 0x800;
|
||||
|
||||
for (offs = 0; offs < lockon_objectram_size; offs += 4)
|
||||
for (offs = 0; offs < state->objectram_size; offs += 4)
|
||||
{
|
||||
UINT32 y;
|
||||
UINT32 xpos;
|
||||
@ -497,19 +459,19 @@ static void objects_draw(running_machine *machine)
|
||||
UINT32 opsta15_8;
|
||||
|
||||
/* Retrieve the object attributes */
|
||||
ypos = lockon_object_ram[offs] & 0x03ff;
|
||||
xpos = lockon_object_ram[offs + 3] & 0x07ff;
|
||||
ysize = (lockon_object_ram[offs] >> 10) & 0x3;
|
||||
xsize = (lockon_object_ram[offs] >> 12) & 0x3;
|
||||
yflip = BIT(lockon_object_ram[offs], 14);
|
||||
xflip = BIT(lockon_object_ram[offs], 15);
|
||||
scale = lockon_object_ram[offs + 1] & 0xff;
|
||||
pal = (lockon_object_ram[offs + 1] >> 8) & 0x7f;
|
||||
opsta = lockon_object_ram[offs + 2];
|
||||
ypos = state->object_ram[offs] & 0x03ff;
|
||||
xpos = state->object_ram[offs + 3] & 0x07ff;
|
||||
ysize = (state->object_ram[offs] >> 10) & 0x3;
|
||||
xsize = (state->object_ram[offs] >> 12) & 0x3;
|
||||
yflip = BIT(state->object_ram[offs], 14);
|
||||
xflip = BIT(state->object_ram[offs], 15);
|
||||
scale = state->object_ram[offs + 1] & 0xff;
|
||||
pal = (state->object_ram[offs + 1] >> 8) & 0x7f;
|
||||
opsta = state->object_ram[offs + 2];
|
||||
|
||||
if (iden)
|
||||
if (state->iden)
|
||||
{
|
||||
obj_pal_ram[(pal << 4) + obj_pal_addr] = obj_pal_latch;
|
||||
state->obj_pal_ram[(pal << 4) + state->obj_pal_addr] = state->obj_pal_latch;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -523,14 +485,14 @@ static void objects_draw(running_machine *machine)
|
||||
|
||||
for (y = 0; y < FRAMEBUFFER_MAX_Y; y++)
|
||||
{
|
||||
UINT32 cy = (y + ypos) & 0x3ff;
|
||||
UINT32 optab;
|
||||
UINT32 lutaddr;
|
||||
UINT32 tile;
|
||||
UINT32 cy = (y + ypos) & 0x3ff;
|
||||
UINT32 optab;
|
||||
UINT32 lutaddr;
|
||||
UINT32 tile;
|
||||
UINT8 cnt;
|
||||
UINT32 yidx;
|
||||
UINT16 *line = BITMAP_ADDR16(back_buffer, y, 0);
|
||||
UINT32 px = xpos;
|
||||
UINT32 yidx;
|
||||
UINT16 *line = BITMAP_ADDR16(state->back_buffer, y, 0);
|
||||
UINT32 px = xpos;
|
||||
|
||||
/* Outside the limits? */
|
||||
if (cy & 0x300)
|
||||
@ -560,13 +522,13 @@ static void objects_draw(running_machine *machine)
|
||||
/* Draw! */
|
||||
for (tile = 0; tile < (1 << xsize); ++tile)
|
||||
{
|
||||
UINT16 sc;
|
||||
UINT16 scl;
|
||||
UINT32 x;
|
||||
UINT32 tileaddr;
|
||||
UINT16 td0, td1, td2, td3;
|
||||
UINT32 j;
|
||||
UINT32 bank;
|
||||
UINT16 sc;
|
||||
UINT16 scl;
|
||||
UINT32 x;
|
||||
UINT32 tileaddr;
|
||||
UINT16 td0, td1, td2, td3;
|
||||
UINT32 j;
|
||||
UINT32 bank;
|
||||
|
||||
scl = scale & 0x7f;
|
||||
tileaddr = (chklut[opsta15_8 + cnt] & 0x7fff);
|
||||
@ -610,7 +572,7 @@ static void objects_draw(running_machine *machine)
|
||||
|
||||
DRAW_OBJ_PIXEL(col);
|
||||
|
||||
if ( BIT(sc, x) )
|
||||
if (BIT(sc, x))
|
||||
DRAW_OBJ_PIXEL(col);
|
||||
}
|
||||
}
|
||||
@ -621,7 +583,7 @@ static void objects_draw(running_machine *machine)
|
||||
UINT8 col;
|
||||
UINT8 pix = x;
|
||||
|
||||
if ( BIT(sc, x) )
|
||||
if (BIT(sc, x))
|
||||
{
|
||||
if (!xflip)
|
||||
pix ^= 0x7;
|
||||
@ -640,7 +602,7 @@ static void objects_draw(running_machine *machine)
|
||||
}
|
||||
|
||||
/* Check for the end of list marker */
|
||||
if (lockon_object_ram[offs + 1] & 0x8000)
|
||||
if (state->object_ram[offs + 1] & 0x8000)
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -648,23 +610,28 @@ static void objects_draw(running_machine *machine)
|
||||
/* The mechanism used by the object CPU to update the object ASICs palette RAM */
|
||||
WRITE16_HANDLER( lockon_tza112_w )
|
||||
{
|
||||
if (iden)
|
||||
lockon_state *state = (lockon_state *)space->machine->driver_data;
|
||||
|
||||
if (state->iden)
|
||||
{
|
||||
obj_pal_latch = data & 0xff;
|
||||
obj_pal_addr = offset & 0xf;
|
||||
state->obj_pal_latch = data & 0xff;
|
||||
state->obj_pal_addr = offset & 0xf;
|
||||
objects_draw(space->machine);
|
||||
}
|
||||
}
|
||||
|
||||
READ16_HANDLER( lockon_obj_4000_r )
|
||||
{
|
||||
cputag_set_input_line(space->machine, "object", NEC_INPUT_LINE_POLL, CLEAR_LINE);
|
||||
lockon_state *state = (lockon_state *)space->machine->driver_data;
|
||||
|
||||
cpu_set_input_line(state->object, NEC_INPUT_LINE_POLL, CLEAR_LINE);
|
||||
return 0xffff;
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( lockon_obj_4000_w )
|
||||
{
|
||||
iden = data & 1;
|
||||
lockon_state *state = (lockon_state *)space->machine->driver_data;
|
||||
state->iden = data & 1;
|
||||
}
|
||||
|
||||
|
||||
@ -701,17 +668,19 @@ WRITE16_HANDLER( lockon_fb_clut_w )
|
||||
/* Rotation control register */
|
||||
WRITE16_HANDLER( lockon_rotate_w )
|
||||
{
|
||||
lockon_state *state = (lockon_state *)space->machine->driver_data;
|
||||
|
||||
switch (offset & 7)
|
||||
{
|
||||
case 0: xsal = data & 0x1ff; break;
|
||||
case 1: x0ll = data & 0xff; break;
|
||||
case 2: dx0ll = data & 0x1ff; break;
|
||||
case 3: dxll = data & 0x1ff; break;
|
||||
case 0: state->xsal = data & 0x1ff; break;
|
||||
case 1: state->x0ll = data & 0xff; break;
|
||||
case 2: state->dx0ll = data & 0x1ff; break;
|
||||
case 3: state->dxll = data & 0x1ff; break;
|
||||
|
||||
case 4: ysal = data & 0x1ff; break;
|
||||
case 5: y0ll = data & 0xff; break;
|
||||
case 6: dy0ll = data & 0x1ff; break;
|
||||
case 7: dyll = data & 0x3ff; break;
|
||||
case 4: state->ysal = data & 0x1ff; break;
|
||||
case 5: state->y0ll = data & 0xff; break;
|
||||
case 6: state->dy0ll = data & 0x1ff; break;
|
||||
case 7: state->dyll = data & 0x3ff; break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -729,28 +698,29 @@ do { \
|
||||
if (carry) --CNT; \
|
||||
} while(0)
|
||||
|
||||
static void rotate_draw(bitmap_t *bitmap, const rectangle *cliprect)
|
||||
static void rotate_draw( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
{
|
||||
lockon_state *state = (lockon_state *)machine->driver_data;
|
||||
UINT32 y;
|
||||
|
||||
/* Counters */
|
||||
UINT32 cxy = xsal & 0xff;
|
||||
UINT32 cyy = ysal & 0x1ff;
|
||||
UINT32 cxy = state->xsal & 0xff;
|
||||
UINT32 cyy = state->ysal & 0x1ff;
|
||||
|
||||
/* Accumulator values and deltas */
|
||||
UINT8 axy = x0ll & 0xff;
|
||||
UINT8 daxy = dx0ll & 0xff;
|
||||
UINT8 ayy = y0ll & 0xff;
|
||||
UINT8 dayy = dy0ll & 0xff;
|
||||
UINT8 dayx = dyll & 0xff;
|
||||
UINT8 daxx = dxll & 0xff;
|
||||
UINT8 axy = state->x0ll & 0xff;
|
||||
UINT8 daxy = state->dx0ll & 0xff;
|
||||
UINT8 ayy = state->y0ll & 0xff;
|
||||
UINT8 dayy = state->dy0ll & 0xff;
|
||||
UINT8 dayx = state->dyll & 0xff;
|
||||
UINT8 daxx = state->dxll & 0xff;
|
||||
|
||||
UINT32 xy_up = BIT(xsal, 8);
|
||||
UINT32 yx_up = BIT(dyll, 9);
|
||||
UINT32 axx_en = !BIT(dxll, 8);
|
||||
UINT32 ayx_en = !BIT(dyll, 8);
|
||||
UINT32 axy_en = !BIT(dx0ll, 8);
|
||||
UINT32 ayy_en = !BIT(dy0ll, 8);
|
||||
UINT32 xy_up = BIT(state->xsal, 8);
|
||||
UINT32 yx_up = BIT(state->dyll, 9);
|
||||
UINT32 axx_en = !BIT(state->dxll, 8);
|
||||
UINT32 ayx_en = !BIT(state->dyll, 8);
|
||||
UINT32 axy_en = !BIT(state->dx0ll, 8);
|
||||
UINT32 ayy_en = !BIT(state->dy0ll, 8);
|
||||
|
||||
for (y = 0; y <= cliprect->max_y; ++y)
|
||||
{
|
||||
@ -769,7 +739,7 @@ static void rotate_draw(bitmap_t *bitmap, const rectangle *cliprect)
|
||||
cx &= 0x1ff;
|
||||
cy &= 0x1ff;
|
||||
|
||||
*dst++ = *BITMAP_ADDR16(front_buffer, cy, cx);
|
||||
*dst++ = *BITMAP_ADDR16(state->front_buffer, cy, cx);
|
||||
|
||||
if (axx_en)
|
||||
INCREMENT(axx, cx);
|
||||
@ -833,33 +803,34 @@ static void rotate_draw(bitmap_t *bitmap, const rectangle *cliprect)
|
||||
|
||||
*******************************************************************************************/
|
||||
|
||||
static void hud_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
|
||||
static void hud_draw( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
{
|
||||
lockon_state *state = (lockon_state *)machine->driver_data;
|
||||
UINT8 *tile_rom = memory_region(machine, "gfx3");
|
||||
UINT32 offs;
|
||||
UINT32 offs;
|
||||
|
||||
for (offs = 0x0; offs <= lockon_hudram_size; offs += 2)
|
||||
for (offs = 0x0; offs <= state->hudram_size; offs += 2)
|
||||
{
|
||||
UINT32 y;
|
||||
UINT32 y_pos;
|
||||
UINT32 x_pos;
|
||||
UINT32 y_size;
|
||||
UINT32 x_size;
|
||||
UINT32 layout;
|
||||
UINT16 colour;
|
||||
UINT32 code;
|
||||
UINT32 rom_a12_7;
|
||||
UINT32 y;
|
||||
UINT32 y_pos;
|
||||
UINT32 x_pos;
|
||||
UINT32 y_size;
|
||||
UINT32 x_size;
|
||||
UINT32 layout;
|
||||
UINT16 colour;
|
||||
UINT32 code;
|
||||
UINT32 rom_a12_7;
|
||||
|
||||
/* End of sprite list marker */
|
||||
if (lockon_hud_ram[offs + 1] & 0x8000)
|
||||
if (state->hud_ram[offs + 1] & 0x8000)
|
||||
break;
|
||||
|
||||
y_pos = lockon_hud_ram[offs] & 0x1ff;
|
||||
x_pos = lockon_hud_ram[offs + 1] & 0x1ff;
|
||||
x_size = (lockon_hud_ram[offs + 1] >> 12) & 7;
|
||||
code = (lockon_hud_ram[offs] >> 9) & 0x7f;
|
||||
colour = 0x200 + ((lockon_hud_ram[offs + 1] >> 9) & 7);
|
||||
layout = (code >> 5) & 3;
|
||||
y_pos = state->hud_ram[offs] & 0x1ff;
|
||||
x_pos = state->hud_ram[offs + 1] & 0x1ff;
|
||||
x_size = (state->hud_ram[offs + 1] >> 12) & 7;
|
||||
code = (state->hud_ram[offs] >> 9) & 0x7f;
|
||||
colour = 0x200 + ((state->hud_ram[offs + 1] >> 9) & 7);
|
||||
layout = (code >> 5) & 3;
|
||||
|
||||
rom_a12_7 = (code & 0xfe) << 6;
|
||||
|
||||
@ -888,8 +859,8 @@ static void hud_draw(running_machine *machine, bitmap_t *bitmap, const rectangle
|
||||
|
||||
for (xt = 0; xt <= x_size; ++xt)
|
||||
{
|
||||
UINT32 rom_a6_3;
|
||||
UINT32 px;
|
||||
UINT32 rom_a6_3;
|
||||
UINT32 px;
|
||||
UINT8 gfx_strip;
|
||||
|
||||
if (layout == 3)
|
||||
@ -934,38 +905,46 @@ static void hud_draw(running_machine *machine, bitmap_t *bitmap, const rectangle
|
||||
|
||||
VIDEO_START( lockon )
|
||||
{
|
||||
lockon_tilemap = tilemap_create(machine, get_lockon_tile_info, tilemap_scan_rows, 8, 8, 64, 32);
|
||||
tilemap_set_transparent_pen(lockon_tilemap, 0);
|
||||
lockon_state *state = (lockon_state *)machine->driver_data;
|
||||
|
||||
state->tilemap = tilemap_create(machine, get_lockon_tile_info, tilemap_scan_rows, 8, 8, 64, 32);
|
||||
tilemap_set_transparent_pen(state->tilemap, 0);
|
||||
|
||||
/* Allocate the two frame buffers for rotation */
|
||||
back_buffer = auto_bitmap_alloc(machine, 512, 512, BITMAP_FORMAT_INDEXED16);
|
||||
front_buffer = auto_bitmap_alloc(machine, 512, 512, BITMAP_FORMAT_INDEXED16);
|
||||
state->back_buffer = auto_bitmap_alloc(machine, 512, 512, BITMAP_FORMAT_INDEXED16);
|
||||
state->front_buffer = auto_bitmap_alloc(machine, 512, 512, BITMAP_FORMAT_INDEXED16);
|
||||
|
||||
/* 2kB of object ASIC palette RAM */
|
||||
obj_pal_ram = auto_alloc_array(machine, UINT8, 2048);
|
||||
state->obj_pal_ram = auto_alloc_array(machine, UINT8, 2048);
|
||||
|
||||
/* Timer for ground display list callback */
|
||||
bufend_timer = timer_alloc(machine, bufend_callback, NULL);
|
||||
state->bufend_timer = timer_alloc(machine, bufend_callback, NULL);
|
||||
|
||||
/* Timer for the CRTC cursor pulse */
|
||||
cursor_timer = timer_alloc(machine, cursor_callback, NULL);
|
||||
timer_adjust_oneshot(cursor_timer, video_screen_get_time_until_pos(machine->primary_screen, CURSOR_YPOS, CURSOR_XPOS), 0);
|
||||
state->cursor_timer = timer_alloc(machine, cursor_callback, NULL);
|
||||
timer_adjust_oneshot(state->cursor_timer, video_screen_get_time_until_pos(machine->primary_screen, CURSOR_YPOS, CURSOR_XPOS), 0);
|
||||
|
||||
state_save_register_global_bitmap(machine, state->back_buffer);
|
||||
state_save_register_global_bitmap(machine, state->front_buffer);
|
||||
state_save_register_global_pointer(machine, state->obj_pal_ram, 2048);
|
||||
}
|
||||
|
||||
VIDEO_UPDATE( lockon )
|
||||
{
|
||||
lockon_state *state = (lockon_state *)screen->machine->driver_data;
|
||||
|
||||
/* If screen output is disabled, fill with black */
|
||||
if ( !BIT(lockon_ctrl_reg, 7) )
|
||||
if (!BIT(state->ctrl_reg, 7))
|
||||
{
|
||||
bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Scan out the frame buffer in rotated order */
|
||||
rotate_draw(bitmap, cliprect);
|
||||
rotate_draw(screen->machine, bitmap, cliprect);
|
||||
|
||||
/* Draw the character tilemap */
|
||||
tilemap_draw(bitmap, cliprect, lockon_tilemap, 0, 0);
|
||||
tilemap_draw(bitmap, cliprect, state->tilemap, 0, 0);
|
||||
|
||||
/* Draw the HUD */
|
||||
hud_draw(screen->machine, bitmap, cliprect);
|
||||
@ -975,14 +954,15 @@ VIDEO_UPDATE( lockon )
|
||||
|
||||
VIDEO_EOF( lockon )
|
||||
{
|
||||
lockon_state *state = (lockon_state *)machine->driver_data;
|
||||
|
||||
/* Swap the frame buffers */
|
||||
bitmap_t *tmp = front_buffer;
|
||||
front_buffer = back_buffer;
|
||||
back_buffer = tmp;
|
||||
bitmap_t *tmp = state->front_buffer;
|
||||
state->front_buffer = state->back_buffer;
|
||||
state->back_buffer = tmp;
|
||||
|
||||
/* Draw the frame buffer layers */
|
||||
scene_draw(machine);
|
||||
ground_draw(machine);
|
||||
objects_draw(machine);
|
||||
|
||||
}
|
||||
|
@ -1,37 +1,36 @@
|
||||
#include "emu.h"
|
||||
#include "includes/lsasquad.h"
|
||||
|
||||
UINT8 *lsasquad_scrollram;
|
||||
|
||||
|
||||
|
||||
static void draw_layer(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8 *scrollram)
|
||||
static void draw_layer( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8 *scrollram )
|
||||
{
|
||||
int offs,scrollx,scrolly;
|
||||
|
||||
lsasquad_state *state = (lsasquad_state *)machine->driver_data;
|
||||
int offs, scrollx, scrolly;
|
||||
|
||||
scrollx = scrollram[3];
|
||||
scrolly = -scrollram[0];
|
||||
|
||||
for (offs = 0;offs < 0x080;offs += 4)
|
||||
for (offs = 0; offs < 0x080; offs += 4)
|
||||
{
|
||||
int base,y,sx,sy,code,color;
|
||||
int base, y, sx, sy, code, color;
|
||||
|
||||
base = 64 * scrollram[offs + 1];
|
||||
sx = 8 * (offs / 4) + scrollx;
|
||||
if (flip_screen_get(machine))
|
||||
sx = 248 - sx;
|
||||
|
||||
base = 64 * scrollram[offs+1];
|
||||
sx = 8*(offs/4) + scrollx;
|
||||
if (flip_screen_get(machine)) sx = 248 - sx;
|
||||
sx &= 0xff;
|
||||
|
||||
for (y = 0;y < 32;y++)
|
||||
for (y = 0; y < 32; y++)
|
||||
{
|
||||
int attr;
|
||||
|
||||
sy = 8*y + scrolly;
|
||||
if (flip_screen_get(machine)) sy = 248 - sy;
|
||||
sy = 8 * y + scrolly;
|
||||
if (flip_screen_get(machine))
|
||||
sy = 248 - sy;
|
||||
sy &= 0xff;
|
||||
|
||||
attr = machine->generic.videoram.u8[base + 2*y + 1];
|
||||
code = machine->generic.videoram.u8[base + 2*y] + ((attr & 0x0f) << 8);
|
||||
attr = state->videoram[base + 2 * y + 1];
|
||||
code = state->videoram[base + 2 * y] + ((attr & 0x0f) << 8);
|
||||
color = attr >> 4;
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect,machine->gfx[0],
|
||||
@ -49,76 +48,78 @@ static void draw_layer(running_machine *machine, bitmap_t *bitmap, const rectang
|
||||
}
|
||||
}
|
||||
|
||||
static int draw_layer_daikaiju(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int offs, int * previd, int type)
|
||||
static int draw_layer_daikaiju( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int offs, int * previd, int type )
|
||||
{
|
||||
int id,scrollx,scrolly,initoffs, globalscrollx;
|
||||
int stepx=0;
|
||||
initoffs=offs;
|
||||
lsasquad_state *state = (lsasquad_state *)machine->driver_data;
|
||||
int id, scrollx, scrolly, initoffs, globalscrollx;
|
||||
int stepx = 0;
|
||||
|
||||
globalscrollx=0;
|
||||
initoffs = offs;
|
||||
globalscrollx = 0;
|
||||
|
||||
id=lsasquad_scrollram[offs+2];
|
||||
id = state->scrollram[offs + 2];
|
||||
|
||||
for(;offs < 0x400; offs+=4)
|
||||
for( ; offs < 0x400; offs += 4)
|
||||
{
|
||||
int base,y,sx,sy,code,color;
|
||||
int base, y, sx, sy, code, color;
|
||||
|
||||
//id change
|
||||
if(id!=lsasquad_scrollram[offs+2])
|
||||
if (id != state->scrollram[offs + 2])
|
||||
{
|
||||
*previd = id;
|
||||
return offs;
|
||||
}
|
||||
else
|
||||
{
|
||||
id=lsasquad_scrollram[offs+2];
|
||||
id = state->scrollram[offs + 2];
|
||||
}
|
||||
|
||||
//skip empty (??) column, potential probs with 1st column in scrollram (scroll 0, tile 0, id 0)
|
||||
if( (lsasquad_scrollram[offs+0]|lsasquad_scrollram[offs+1]|lsasquad_scrollram[offs+2]|lsasquad_scrollram[offs+3])==0)
|
||||
if ((state->scrollram[offs + 0] | state->scrollram[offs + 1] | state->scrollram[offs + 2] | state->scrollram[offs + 3]) == 0)
|
||||
continue;
|
||||
|
||||
//local scroll x/y
|
||||
scrolly = -lsasquad_scrollram[offs+0];
|
||||
scrollx = lsasquad_scrollram[offs+3];
|
||||
scrolly = -state->scrollram[offs + 0];
|
||||
scrollx = state->scrollram[offs + 3];
|
||||
|
||||
//check for global x scroll used in bg layer in game (starts at offset 0 in scrollram
|
||||
// and game name/logo on title screen (starts in the middle of scrollram, but with different
|
||||
// (NOT unique )id than prev coulmn(s)
|
||||
|
||||
if( *previd!=1 )
|
||||
if (*previd != 1)
|
||||
{
|
||||
if(offs!=initoffs)
|
||||
if (offs != initoffs)
|
||||
{
|
||||
scrollx+=globalscrollx;
|
||||
scrollx += globalscrollx;
|
||||
}
|
||||
else
|
||||
{
|
||||
//global scroll init
|
||||
globalscrollx=scrollx;
|
||||
globalscrollx = scrollx;
|
||||
}
|
||||
}
|
||||
|
||||
base = 64 * lsasquad_scrollram[offs+1];
|
||||
sx = scrollx+stepx;
|
||||
base = 64 * state->scrollram[offs + 1];
|
||||
sx = scrollx + stepx;
|
||||
|
||||
if (flip_screen_get(machine)) sx = 248 - sx;
|
||||
if (flip_screen_get(machine))
|
||||
sx = 248 - sx;
|
||||
sx &= 0xff;
|
||||
|
||||
for (y = 0;y < 32;y++)
|
||||
for (y = 0; y < 32; y++)
|
||||
{
|
||||
int attr;
|
||||
|
||||
sy = 8*y + scrolly;
|
||||
if (flip_screen_get(machine)) sy = 248 - sy;
|
||||
sy = 8 * y + scrolly;
|
||||
if (flip_screen_get(machine))
|
||||
sy = 248 - sy;
|
||||
sy &= 0xff;
|
||||
|
||||
attr = machine->generic.videoram.u8[base + 2*y + 1];
|
||||
code = machine->generic.videoram.u8[base + 2*y] + ((attr & 0x0f) << 8);
|
||||
attr = state->videoram[base + 2 * y + 1];
|
||||
code = state->videoram[base + 2 * y] + ((attr & 0x0f) << 8);
|
||||
color = attr >> 4;
|
||||
|
||||
|
||||
if((type==0 && color!=0x0d) || (type !=0 && color==0x0d))
|
||||
if ((type == 0 && color != 0x0d) || (type != 0 && color == 0x0d))
|
||||
{
|
||||
drawgfx_transpen(bitmap,cliprect,machine->gfx[0],
|
||||
code,
|
||||
@ -137,38 +138,40 @@ static int draw_layer_daikaiju(running_machine *machine, bitmap_t *bitmap, const
|
||||
return offs;
|
||||
}
|
||||
|
||||
static void drawbg(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int type)
|
||||
static void drawbg( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int type )
|
||||
{
|
||||
int i=0;
|
||||
int id=-1;
|
||||
lsasquad_state *state = (lsasquad_state *)machine->driver_data;
|
||||
int i = 0;
|
||||
int id = -1;
|
||||
|
||||
while(i<0x400)
|
||||
while (i < 0x400)
|
||||
{
|
||||
if(!(lsasquad_scrollram[i+2]&1))
|
||||
if (!(state->scrollram[i + 2] & 1))
|
||||
{
|
||||
i=draw_layer_daikaiju(machine, bitmap, cliprect, i, &id,type);
|
||||
i = draw_layer_daikaiju(machine, bitmap, cliprect, i, &id, type);
|
||||
}
|
||||
else
|
||||
{
|
||||
id=lsasquad_scrollram[i+2];
|
||||
i+=4;
|
||||
id = state->scrollram[i + 2];
|
||||
i += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
|
||||
static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
{
|
||||
UINT8 *spriteram = machine->generic.spriteram.u8;
|
||||
lsasquad_state *state = (lsasquad_state *)machine->driver_data;
|
||||
UINT8 *spriteram = state->spriteram;
|
||||
int offs;
|
||||
|
||||
for (offs = machine->generic.spriteram_size-4;offs >= 0;offs -= 4)
|
||||
for (offs = state->spriteram_size - 4; offs >= 0; offs -= 4)
|
||||
{
|
||||
int sx,sy,attr,code,color,flipx,flipy;
|
||||
int sx, sy, attr, code, color, flipx, flipy;
|
||||
|
||||
sx = spriteram[offs+3];
|
||||
sx = spriteram[offs + 3];
|
||||
sy = 240 - spriteram[offs];
|
||||
attr = spriteram[offs+1];
|
||||
code = spriteram[offs+2] + ((attr & 0x30) << 4);
|
||||
attr = spriteram[offs + 1];
|
||||
code = spriteram[offs + 2] + ((attr & 0x30) << 4);
|
||||
color = attr & 0x0f;
|
||||
flipx = attr & 0x40;
|
||||
flipy = attr & 0x80;
|
||||
@ -197,21 +200,22 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
|
||||
VIDEO_UPDATE( lsasquad )
|
||||
{
|
||||
bitmap_fill(bitmap,cliprect,511);
|
||||
lsasquad_state *state = (lsasquad_state *)screen->machine->driver_data;
|
||||
bitmap_fill(bitmap, cliprect, 511);
|
||||
|
||||
draw_layer(screen->machine,bitmap,cliprect,lsasquad_scrollram + 0x000);
|
||||
draw_layer(screen->machine,bitmap,cliprect,lsasquad_scrollram + 0x080);
|
||||
draw_sprites(screen->machine,bitmap,cliprect);
|
||||
draw_layer(screen->machine,bitmap,cliprect,lsasquad_scrollram + 0x100);
|
||||
draw_layer(screen->machine, bitmap, cliprect, state->scrollram + 0x000);
|
||||
draw_layer(screen->machine, bitmap, cliprect, state->scrollram + 0x080);
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
draw_layer(screen->machine, bitmap, cliprect, state->scrollram + 0x100);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
VIDEO_UPDATE( daikaiju )
|
||||
{
|
||||
bitmap_fill(bitmap,cliprect,511);
|
||||
drawbg(screen->machine,bitmap,cliprect,0); // bottom
|
||||
draw_sprites(screen->machine,bitmap,cliprect);
|
||||
drawbg(screen->machine,bitmap,cliprect,1); // top = pallete $d ?
|
||||
bitmap_fill(bitmap, cliprect, 511);
|
||||
drawbg(screen->machine, bitmap, cliprect, 0); // bottom
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
drawbg(screen->machine, bitmap, cliprect, 1); // top = pallete $d ?
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user