Implemented a new DECO CPU-16 opcode, used by Express Raider for V-BLANK bit and a bunch of liberate.c games for TILT bit.

Converted Express Raider to use the DECO CPU-16 core instead of the plain M6502. [Angelo Salese]
This commit is contained in:
Angelo Salese 2009-06-15 20:53:42 +00:00
parent 120c82b89f
commit 5c25f1ce66
3 changed files with 47 additions and 50 deletions

View File

@ -272,9 +272,9 @@ OP(0b) { int tmp; cpustate->icount -= 1; RD_IMM;
}
OP(2b) { RD_DUM; ILL; } /* 2 ILL */
OP(4b) { int tmp; cpustate->icount -= 1; RD_IMM;
logerror("%04x: OP4B %02x\n",PCW,tmp);
// cpustate->a=memory_read_byte_8le(cpustate->io,0);
//logerror("%04x: OP4B %02x\n",PCW,tmp);
/* TODO: Maybe it's just read I/O 0 and do a logic AND with bit 1? */
cpustate->a=memory_read_byte_8le(cpustate->io,1);
//tilt??

View File

@ -6,7 +6,7 @@ Ernesto Corvi
ernesto@imagina.com
Memory Map:
Main CPU: ( 6502 )
Main CPU: ( DECO CPU-16 )
0000-05ff RAM
0600-07ff Sprites
0800-0bff Videoram
@ -17,9 +17,9 @@ Main CPU: ( 6502 )
1803-1803 DSW 1
2100-2100 Sound latch write
2800-2801 Protection
3800-3800 VBblank ( bootleg 1 only )
3800-3800 VBlank ( bootleg 1 only )
4000-ffff SMH_ROM
ffc0-ffc0 VBblank ( bootleg 2 only )
ffc0-ffc0 VBlank ( bootleg 2 only )
Sound Cpu: ( 6809 )
0000-1fff RAM
@ -30,15 +30,12 @@ Sound Cpu: ( 6809 )
NOTES:
The main 6502 cpu is a custom one. The differences with a regular 6502 is as follows:
- Extra opcode ( $4b00 ), wich i think reads an external port. VBlank irq is on bit 1 ( 0x02 ).
- Extra opcode ( $4b00 ), which i think reads an external port. VBlank irq is on bit 1 ( 0x02 ).
- Reset, IRQ and NMI vectors are moved.
Also, there was some protection circuitry which is now emulated.
The way i dealt with the custom opcode was to change it to return memory
position $ff (wich i verified is not used by the game). And i hacked in
a read handler wich returns the vblank on bit 1. It's an ugly hack, but
works fine.
(Note (15/jun/09): CPU is actually a DECO CPU-16, used mostly by the liberate.c games -AS)
The bootleg version patched the rom to get rid of the extra opcode ( bootlegs
used a regular 6502 ), the vectors hardcoded in place, and also had the
@ -257,7 +254,6 @@ static READ8_HANDLER( vblank_r )
}
static ADDRESS_MAP_START( master_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x00ff, 0x00ff) AM_READ(vblank_r) /* HACK!!!! see init_exprraid below */
AM_RANGE(0x0000, 0x05ff) AM_RAM AM_BASE(&main_ram)
AM_RANGE(0x0600, 0x07ff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
AM_RANGE(0x0800, 0x0bff) AM_RAM_WRITE(exprraid_videoram_w) AM_BASE(&videoram)
@ -280,6 +276,10 @@ static ADDRESS_MAP_START( master_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x4000, 0xffff) AM_ROM
ADDRESS_MAP_END
static ADDRESS_MAP_START( master_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x01, 0x01) AM_READ_PORT("IN0")
ADDRESS_MAP_END
static ADDRESS_MAP_START( slave_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_RAM
AM_RANGE(0x2000, 0x2001) AM_DEVREADWRITE("ym1", ym2203_r, ym2203_w)
@ -462,8 +462,9 @@ static INTERRUPT_GEN( exprraid_interrupt )
static MACHINE_DRIVER_START( exprraid )
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", M6502, 4000000) /* 4 MHz ??? */
MDRV_CPU_ADD("maincpu", DECO16, 4000000) /* 4 MHz ??? */
MDRV_CPU_PROGRAM_MAP(master_map)
MDRV_CPU_IO_MAP(master_io_map)
MDRV_CPU_VBLANK_INT("screen", exprraid_interrupt)
MDRV_CPU_ADD("slave", M6809, 2000000) /* 2 MHz ??? */
@ -496,6 +497,13 @@ static MACHINE_DRIVER_START( exprraid )
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.60)
MACHINE_DRIVER_END
static MACHINE_DRIVER_START( exprboot )
MDRV_IMPORT_FROM(exprraid)
MDRV_CPU_REPLACE("maincpu", M6502, 4000000) /* 4 MHz ??? */
MDRV_CPU_PROGRAM_MAP(master_map)
MDRV_CPU_IO_MAP(0)
MACHINE_DRIVER_END
/***************************************************************************
@ -713,48 +721,25 @@ static void exprraid_gfx_expand(running_machine *machine)
}
}
static void patch_rom1(running_machine *machine)
{
UINT8 *rom = memory_region(machine, "maincpu");
int i;
/* HACK!: Implement custom opcode as regular with a mapped io read */
for ( i = 0; i < 0x10000; i++ )
{
/* make sure is what we want to patch */
if ( rom[i] == 0x4b && rom[i+1] == 0x00 && rom[i+2] == 0x29 && rom[i+3] == 0x02 )
{
/* replace custom opcode with: LDA $FF */
rom[i] = 0xa5;
i++;
rom[i] = 0xff;
}
}
}
static DRIVER_INIT( wexpress )
{
patch_rom1(machine);
UINT8 *rom = memory_region(machine, "maincpu");
/* HACK: this set uses M6502 irq vectors but DECO CPU-16 opcodes??? */
rom[0xfff7] = rom[0xfffa];
rom[0xfff6] = rom[0xfffb];
rom[0xfff1] = rom[0xfffc];
rom[0xfff0] = rom[0xfffd];
rom[0xfff3] = rom[0xfffe];
rom[0xfff2] = rom[0xffff];
exprraid_gfx_expand(machine);
}
static DRIVER_INIT( exprraid )
{
UINT8 *rom = memory_region(machine, "maincpu");
/* decode vectors */
rom[0xfffa] = rom[0xfff7];
rom[0xfffb] = rom[0xfff6];
rom[0xfffc] = rom[0xfff1];
rom[0xfffd] = rom[0xfff0];
rom[0xfffe] = rom[0xfff3];
rom[0xffff] = rom[0xfff2];
patch_rom1(machine);
exprraid_gfx_expand(machine);
}
@ -774,5 +759,5 @@ static DRIVER_INIT( wexpresc )
GAME( 1986, exprraid, 0, exprraid, exprraid, exprraid, ROT0, "Data East USA", "Express Raider (US set 1)", 0 )
GAME( 1986, exprrada, exprraid, exprraid, exprraid, exprraid, ROT0, "Data East USA", "Express Raider (US set 2)", 0 )
GAME( 1986, wexpress, exprraid, exprraid, exprraid, wexpress, ROT0, "Data East Corporation", "Western Express (World?)", 0 )
GAME( 1986, wexpresb, exprraid, exprraid, exprraid, wexpresb, ROT0, "bootleg", "Western Express (bootleg set 1)", 0 )
GAME( 1986, wexpresc, exprraid, exprraid, exprraid, wexpresc, ROT0, "bootleg", "Western Express (bootleg set 2)", 0 )
GAME( 1986, wexpresb, exprraid, exprboot, exprraid, wexpresb, ROT0, "bootleg", "Western Express (bootleg set 1)", 0 )
GAME( 1986, wexpresc, exprraid, exprboot, exprraid, wexpresc, ROT0, "bootleg", "Western Express (bootleg set 2)", 0 )

View File

@ -262,10 +262,12 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( deco16_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0") AM_WRITE(deco16_bank_w)
AM_RANGE(0x01, 0x01) AM_READ_PORT("TILT")
ADDRESS_MAP_END
static ADDRESS_MAP_START( prosoccr_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0") AM_WRITE(prosoccr_io_bank_w)
//AM_RANGE(0x01, 0x01) AM_READ_PORT("TILT")
ADDRESS_MAP_END
static ADDRESS_MAP_START( liberatb_map, ADDRESS_SPACE_PROGRAM, 8 )
@ -403,6 +405,10 @@ static INPUT_PORTS_START( generic_input )
PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_START("TILT")
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_TILT )
PORT_BIT( 0xfd, IP_ACTIVE_HIGH, IPT_UNKNOWN )
INPUT_PORTS_END
/*************************************
@ -460,6 +466,9 @@ static INPUT_PORTS_START( kamikcab )
PORT_DIPNAME( 0x80, 0x80, "Invincibility (Cheat)" )
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_MODIFY("TILT")
PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED )
INPUT_PORTS_END
static INPUT_PORTS_START( yellowcb )
@ -518,6 +527,9 @@ static INPUT_PORTS_START( liberatb )
PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_MODIFY("TILT")
PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED )
INPUT_PORTS_END
static INPUT_PORTS_START( prosoccr )