summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Angelo Salese <angelosa@users.noreply.github.com>2010-12-22 01:20:13 +0000
committer Angelo Salese <angelosa@users.noreply.github.com>2010-12-22 01:20:13 +0000
commit5d07abb9ec580c7be6d6f147d4c61e0eca1310c0 (patch)
treed415a89d91ebbb921710926ca02d3c617784ea07 /src
parent3b2d3984a2979a9de80b31b4dc580bf127697f5a (diff)
Added a preliminary DMA to the Legionnaire driver, fixes some color issues in Legionnaire and Denjin Makai [Angelo Salese]
Diffstat (limited to 'src')
-rw-r--r--src/mame/drivers/legionna.c35
-rw-r--r--src/mame/machine/seicop.c44
2 files changed, 58 insertions, 21 deletions
diff --git a/src/mame/drivers/legionna.c b/src/mame/drivers/legionna.c
index c728a65396c..72597af3cfb 100644
--- a/src/mame/drivers/legionna.c
+++ b/src/mame/drivers/legionna.c
@@ -17,18 +17,16 @@ different tiles available for use in the foreground layer.
TODO
----
-Unemulated protection messes up both games.
+Check work RAM boundaries, they are likely to be too generous right now
Legionnaire
-----------
-Foreground tiles screwy (screen after character selection screen).
+Foreground tiles screwy (screen after character selection screen). Presumably non-protection related
Need 16 px off top of vis area?
-The 0x104000 area appears to be extra paletteram?
-
Denjin Makai
------------
@@ -91,10 +89,9 @@ static ADDRESS_MAP_START( legionna_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x101800, 0x101fff) AM_RAM_WRITE(legionna_foreground_w) AM_BASE(&legionna_fore_data)
AM_RANGE(0x102000, 0x1027ff) AM_RAM_WRITE(legionna_midground_w) AM_BASE(&legionna_mid_data)
AM_RANGE(0x102800, 0x1037ff) AM_RAM_WRITE(legionna_text_w) AM_BASE(&legionna_textram)
- AM_RANGE(0x104000, 0x104fff) AM_RAM /* The 4000-4fff area contains PALETTE words and may be extra paletteram? */
+ AM_RANGE(0x104000, 0x104fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram) /* palette xRRRRxGGGGxBBBBx ? */
AM_RANGE(0x105000, 0x105fff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
- AM_RANGE(0x106000, 0x106fff) AM_RAM /* is this used outside inits ?? */
- AM_RANGE(0x107000, 0x107fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram) /* palette xRRRRxGGGGxBBBBx ? */
+ AM_RANGE(0x106000, 0x107fff) AM_RAM
AM_RANGE(0x108000, 0x11ffff) AM_RAM /* main ram */
ADDRESS_MAP_END
@@ -146,11 +143,11 @@ static ADDRESS_MAP_START( denjinmk_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x101800, 0x101fff) AM_RAM_WRITE(legionna_foreground_w) AM_BASE(&legionna_fore_data)
AM_RANGE(0x102000, 0x1027ff) AM_RAM_WRITE(legionna_midground_w) AM_BASE(&legionna_mid_data)
AM_RANGE(0x102800, 0x103fff) AM_RAM_WRITE(legionna_text_w) AM_BASE(&legionna_textram)
- AM_RANGE(0x104000, 0x104fff) AM_RAM
+ AM_RANGE(0x104000, 0x104fff) AM_RAM_WRITE(denjin_paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram)
AM_RANGE(0x105000, 0x105fff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
AM_RANGE(0x106000, 0x107fff) AM_RAM
AM_RANGE(0x108000, 0x11dfff) AM_RAM
- AM_RANGE(0x11e000, 0x11efff) AM_RAM_WRITE(denjin_paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram)
+ AM_RANGE(0x11e000, 0x11efff) AM_RAM
AM_RANGE(0x11f000, 0x11ffff) AM_RAM
ADDRESS_MAP_END
@@ -179,13 +176,13 @@ static ADDRESS_MAP_START( cupsoc_mem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x101800, 0x101fff) AM_RAM_WRITE(legionna_midground_w) AM_BASE(&legionna_mid_data)
AM_RANGE(0x102000, 0x102fff) AM_RAM_WRITE(legionna_text_w) AM_BASE(&legionna_textram)
AM_RANGE(0x103000, 0x103fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram)
- AM_RANGE(0x104000, 0x104fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) /*<according to the debug mode,there is a DMA that copies from here to the paletteram>*/
+ AM_RANGE(0x104000, 0x104fff) AM_RAM
AM_RANGE(0x105000, 0x106fff) AM_RAM
AM_RANGE(0x107000, 0x1077ff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
AM_RANGE(0x107800, 0x107fff) AM_RAM /*Ani Dsp(?) Ram*/
AM_RANGE(0x108000, 0x10ffff) AM_RAM
AM_RANGE(0x110000, 0x119fff) AM_RAM
- AM_RANGE(0x11a000, 0x11dfff) AM_RAM//AM_READWRITE(copdxbl_1_r,copdxbl_1_w) AM_BASE(&work_ram)/*shared with the COP MCU too!*/
+ AM_RANGE(0x11a000, 0x11dfff) AM_RAM
AM_RANGE(0x11e000, 0x11ffff) AM_RAM /*Stack Ram*/
ADDRESS_MAP_END
@@ -2053,7 +2050,7 @@ ROM_START( cupsocsb )
ROM_REGION( 0x080000, "gfx6", ROMREGION_INVERT ) /* LBK tiles */
ROM_COPY( "gfx5", 0x00000, 0x00000, 0x080000 )
-
+
ROM_REGION( 0x100000, "adpcm", ROMREGION_ERASEFF ) /* ADPCM samples */
ROM_LOAD( "sc_02.bin", 0x000000, 0x020000, CRC(a70d4f03) SHA1(c2482e624c8a828a94206a36d10c1021ad8ca1d0) )
ROM_LOAD( "sc_03.bin", 0x080000, 0x080000, CRC(6e254d12) SHA1(857779dbd276b688201a8ea3afd5817e38acad2e) )
@@ -2070,16 +2067,16 @@ ROM_START( cupsocsb )
ROM_COPY( "adpcm", 0x00000, 0x1c0000, 0x20000 ) //bank 7
ROM_COPY( "adpcm", 0xe0000, 0x1e0000, 0x20000 )
-
+
/* what are these, they're not gfx... */
ROM_REGION( 0x500000, "unknown0", 0 )
ROM_LOAD16_BYTE( "sc_13.bin", 0x00000, 0x010000, CRC(229bddd8) SHA1(0924bf29db9c5a970546f154e7752697fdce6a58) )
ROM_LOAD16_BYTE( "sc_12.bin", 0x00001, 0x010000, CRC(dabfa826) SHA1(0db587c846755491b169ef7751ba8e7cdc2607e6) )
-
+
/* what are these, they're not gfx... */
ROM_REGION( 0x500000, "unknown1", 0 )
ROM_LOAD16_BYTE( "sc_15.bin", 0x00000, 0x080000, CRC(8fd87e65) SHA1(acc9fd0289fa9ab60bec16d3e642039380e5180a) )
- ROM_LOAD16_BYTE( "sc_14.bin", 0x00001, 0x080000, CRC(566086c2) SHA1(b7d09ce978f99ecc0d1975b31330ed49317701d5) )
+ ROM_LOAD16_BYTE( "sc_14.bin", 0x00001, 0x080000, CRC(566086c2) SHA1(b7d09ce978f99ecc0d1975b31330ed49317701d5) )
ROM_END
/* slight changes in the program roms compared to above set, all remaining roms were the same */
@@ -2118,7 +2115,7 @@ ROM_START( cupsocsb2 )
ROM_REGION( 0x080000, "gfx6", ROMREGION_INVERT ) /* LBK tiles */
ROM_COPY( "gfx5", 0x00000, 0x00000, 0x080000 )
-
+
ROM_REGION( 0x100000, "adpcm", ROMREGION_ERASEFF ) /* ADPCM samples */
ROM_LOAD( "sc_02.bin", 0x000000, 0x020000, CRC(a70d4f03) SHA1(c2482e624c8a828a94206a36d10c1021ad8ca1d0) )
ROM_LOAD( "sc_03.bin", 0x080000, 0x080000, CRC(6e254d12) SHA1(857779dbd276b688201a8ea3afd5817e38acad2e) )
@@ -2135,16 +2132,16 @@ ROM_START( cupsocsb2 )
ROM_COPY( "adpcm", 0x00000, 0x1c0000, 0x20000 ) //bank 7
ROM_COPY( "adpcm", 0xe0000, 0x1e0000, 0x20000 )
-
+
/* what are these, they're not gfx... */
ROM_REGION( 0x500000, "unknown0", 0 )
ROM_LOAD16_BYTE( "sc_13.bin", 0x00000, 0x010000, CRC(229bddd8) SHA1(0924bf29db9c5a970546f154e7752697fdce6a58) )
ROM_LOAD16_BYTE( "sc_12.bin", 0x00001, 0x010000, CRC(dabfa826) SHA1(0db587c846755491b169ef7751ba8e7cdc2607e6) )
-
+
/* what are these, they're not gfx... */
ROM_REGION( 0x500000, "unknown1", 0 )
ROM_LOAD16_BYTE( "sc_15.bin", 0x00000, 0x080000, CRC(8fd87e65) SHA1(acc9fd0289fa9ab60bec16d3e642039380e5180a) )
- ROM_LOAD16_BYTE( "sc_14.bin", 0x00001, 0x080000, CRC(566086c2) SHA1(b7d09ce978f99ecc0d1975b31330ed49317701d5) )
+ ROM_LOAD16_BYTE( "sc_14.bin", 0x00001, 0x080000, CRC(566086c2) SHA1(b7d09ce978f99ecc0d1975b31330ed49317701d5) )
ROM_END
#define CUPSOC_DEBUG_MODE 1
diff --git a/src/mame/machine/seicop.c b/src/mame/machine/seicop.c
index a97b6b0fc75..dcc5ab1bf3c 100644
--- a/src/mame/machine/seicop.c
+++ b/src/mame/machine/seicop.c
@@ -2431,6 +2431,7 @@ static READ16_HANDLER( generic_cop_r )
static WRITE16_HANDLER( generic_cop_w )
{
static UINT32 temp32;
+ static UINT32 dma_src,dma_dst,dma_size,dma_trigger,dma_src_param;
switch (offset)
{
@@ -2464,10 +2465,15 @@ static WRITE16_HANDLER( generic_cop_w )
case (0x03a/2): { cop_43a = data; break; }
case (0x03c/2): { cop_43c = data; break; }
- /* Layer Clearing */
+ /* DMA / layer clearing */
+ case (0x076/2):
+ dma_src_param = data * 0x400;
+ break;
+
case (0x078/2): /* clear address */
{
cop_clearfill_address[cop_clearfill_lasttrigger] = data; // << 6 to get actual address
+ dma_src = data << 6;
seibu_cop_log("%06x: COPX set layer clear address to %04x (actual %08x)\n", cpu_get_pc(space->cpu), data, data<<6);
break;
}
@@ -2476,7 +2482,7 @@ static WRITE16_HANDLER( generic_cop_w )
{
cop_clearfill_length[cop_clearfill_lasttrigger] = data;
seibu_cop_log("%06x: COPX set layer clear length to %04x (actual %08x)\n", cpu_get_pc(space->cpu), data, data<<5);
-
+ dma_size = data << 5;
break;
}
@@ -2484,6 +2490,7 @@ static WRITE16_HANDLER( generic_cop_w )
{
cop_clearfill_value[cop_clearfill_lasttrigger] = data;
seibu_cop_log("%06x: COPX set layer clear value to %04x (actual %08x)\n", cpu_get_pc(space->cpu), data, data<<6);
+ dma_dst = data << 6;
break;
}
@@ -2498,6 +2505,8 @@ static WRITE16_HANDLER( generic_cop_w )
cop_clearfill_lasttrigger = 0;
}
+ dma_trigger = data;
+
break;
}
@@ -2564,8 +2573,38 @@ static WRITE16_HANDLER( generic_cop_w )
{
seibu_cop_log("%06x: COPX execute current layer clear??? %04x\n", cpu_get_pc(space->cpu), data);
+ if (dma_trigger & 0x80)
+ {
+ static UINT32 src,dst,size,i;
+
+ /* TODO: understand all the differences between triggers!
+ 0x80 is used by Legionnaire (plain DMA)
+ 0x81 is used by SD Gundam and Godzilla (unknown purpose)
+ 0x86 is used by Seibu Cup Soccer (doesn't yet work)
+ 0x87 is used by Denjin Makai (DMA with inverted word endianess)
+ */
+
+ if(dma_trigger != 0x87)
+ printf("SRC: %08x %08x DST:%08x SIZE:%08x TRIGGER: %08x\n",dma_src,dma_src_param,dma_dst,dma_size,dma_trigger);
+
+ if(dma_trigger == 0x81)
+ return;
+
+ src = dma_src + dma_src_param;
+ dst = dma_dst;
+ size = (dma_size - dma_dst + 0x20)/2;
+
+ for(i = 0;i < size;i++)
+ {
+ space->write_word(dst, space->read_word(src));
+ src+=2;
+ dst+=2;
+ }
+ }
+
// I think the value it writes here must match the other value for anything to happen.. maybe */
//if (data!=cop_clearfill_value[cop_clearfill_lasttrigger]) break;
+
if ((cop_clearfill_lasttrigger==0x14) || (cop_clearfill_lasttrigger==0x15)) return;
/* do the fill */
@@ -2581,6 +2620,7 @@ static WRITE16_HANDLER( generic_cop_w )
space->write_word(i, 0x0000);
}
}
+
break;
}
}