Added driver_data class and save states to the following drivers: backfire.c, boogwing.c, cbuster.c, cninja.c, dassault.c, dblewing.c, deco156.c, rohga.c, simpl156.c [Fabio Priuli]

and yes, this completes driver data class for all the deco16ic drivers ;)
This commit is contained in:
Fabio Priuli 2010-02-25 21:17:06 +00:00
parent ef97820c1b
commit 745d7c0f68
22 changed files with 1823 additions and 1214 deletions

5
.gitattributes vendored
View File

@ -2412,6 +2412,7 @@ src/mame/includes/blstroid.h svneol=native#text/plain
src/mame/includes/blueprnt.h svneol=native#text/plain
src/mame/includes/bogeyman.h svneol=native#text/plain
src/mame/includes/bombjack.h svneol=native#text/plain
src/mame/includes/boogwing.h svneol=native#text/plain
src/mame/includes/bottom9.h svneol=native#text/plain
src/mame/includes/brkthru.h svneol=native#text/plain
src/mame/includes/bsktball.h svneol=native#text/plain
@ -2428,6 +2429,7 @@ src/mame/includes/carjmbre.h svneol=native#text/plain
src/mame/includes/carpolo.h svneol=native#text/plain
src/mame/includes/cave.h svneol=native#text/plain
src/mame/includes/cbasebal.h svneol=native#text/plain
src/mame/includes/cbuster.h svneol=native#text/plain
src/mame/includes/ccastles.h svneol=native#text/plain
src/mame/includes/cchasm.h svneol=native#text/plain
src/mame/includes/cchip.h svneol=native#text/plain
@ -2465,6 +2467,7 @@ src/mame/includes/cubocd32.h svneol=native#text/plain
src/mame/includes/cvs.h svneol=native#text/plain
src/mame/includes/cyberbal.h svneol=native#text/plain
src/mame/includes/darius.h svneol=native#text/plain
src/mame/includes/dassault.h svneol=native#text/plain
src/mame/includes/dbz.h svneol=native#text/plain
src/mame/includes/dc.h svneol=native#text/plain
src/mame/includes/dcheese.h svneol=native#text/plain
@ -2733,6 +2736,7 @@ src/mame/includes/redalert.h svneol=native#text/plain
src/mame/includes/relief.h svneol=native#text/plain
src/mame/includes/retofinv.h svneol=native#text/plain
src/mame/includes/rockrage.h svneol=native#text/plain
src/mame/includes/rohga.h svneol=native#text/plain
src/mame/includes/rollerg.h svneol=native#text/plain
src/mame/includes/rungun.h svneol=native#text/plain
src/mame/includes/sbugger.h svneol=native#text/plain
@ -2754,6 +2758,7 @@ src/mame/includes/shuuz.h svneol=native#text/plain
src/mame/includes/sidearms.h svneol=native#text/plain
src/mame/includes/sidepckt.h svneol=native#text/plain
src/mame/includes/silkroad.h svneol=native#text/plain
src/mame/includes/simpl156.h svneol=native#text/plain
src/mame/includes/simpsons.h svneol=native#text/plain
src/mame/includes/skullxbo.h svneol=native#text/plain
src/mame/includes/skydiver.h svneol=native#text/plain

View File

@ -20,70 +20,95 @@
#include "video/deco16ic.h"
#include "rendlay.h"
static UINT16 *backfire_pf1_rowscroll,*backfire_pf2_rowscroll;
static UINT16 *backfire_pf3_rowscroll,*backfire_pf4_rowscroll;
class backfire_state
{
public:
static void *alloc(running_machine &machine) { return auto_alloc_clear(&machine, backfire_state(machine)); }
static UINT32 *backfire_spriteram32_1;
static UINT32 *backfire_spriteram32_2;
static UINT32 *backfire_mainram;
static bitmap_t *backfire_left;
static bitmap_t *backfire_right;
backfire_state(running_machine &machine) { }
/* memory pointers */
UINT16 * pf1_rowscroll;
UINT16 * pf2_rowscroll;
UINT16 * pf3_rowscroll;
UINT16 * pf4_rowscroll;
UINT32 * spriteram_1;
UINT32 * spriteram_2;
UINT32 * mainram;
UINT32 * left_priority;
UINT32 * right_priority;
/* video related */
bitmap_t *left;
bitmap_t *right;
/* devices */
running_device *maincpu;
running_device *deco16ic;
running_device *lscreen;
running_device *rscreen;
running_device *eeprom;
};
//UINT32 *backfire_180010, *backfire_188010;
static UINT32 *backfire_left_priority, *backfire_right_priority;
/* I'm using the functions in deco16ic.c ... same chips, why duplicate code? */
static VIDEO_START(backfire)
static VIDEO_START( backfire )
{
backfire_state *state = (backfire_state *)machine->driver_data;
/* allocate the ram as 16-bit (we do it here because the CPU is 32-bit) */
backfire_pf1_rowscroll = auto_alloc_array(machine, UINT16, 0x0800/2);
backfire_pf2_rowscroll = auto_alloc_array(machine, UINT16, 0x0800/2);
backfire_pf3_rowscroll = auto_alloc_array(machine, UINT16, 0x0800/2);
backfire_pf4_rowscroll = auto_alloc_array(machine, UINT16, 0x0800/2);
state->pf1_rowscroll = auto_alloc_array(machine, UINT16, 0x0800/2);
state->pf2_rowscroll = auto_alloc_array(machine, UINT16, 0x0800/2);
state->pf3_rowscroll = auto_alloc_array(machine, UINT16, 0x0800/2);
state->pf4_rowscroll = auto_alloc_array(machine, UINT16, 0x0800/2);
/* and register the allocated ram so that save states still work */
state_save_register_global_pointer(machine, backfire_pf1_rowscroll, 0x800/2);
state_save_register_global_pointer(machine, backfire_pf2_rowscroll, 0x800/2);
state_save_register_global_pointer(machine, backfire_pf3_rowscroll, 0x800/2);
state_save_register_global_pointer(machine, backfire_pf4_rowscroll, 0x800/2);
state_save_register_global_pointer(machine, state->pf1_rowscroll, 0x800/2);
state_save_register_global_pointer(machine, state->pf2_rowscroll, 0x800/2);
state_save_register_global_pointer(machine, state->pf3_rowscroll, 0x800/2);
state_save_register_global_pointer(machine, state->pf4_rowscroll, 0x800/2);
backfire_left = auto_bitmap_alloc(machine, 80*8, 32*8, BITMAP_FORMAT_INDEXED16);
backfire_right = auto_bitmap_alloc(machine, 80*8, 32*8, BITMAP_FORMAT_INDEXED16);
state->left = auto_bitmap_alloc(machine, 80*8, 32*8, BITMAP_FORMAT_INDEXED16);
state->right = auto_bitmap_alloc(machine, 80*8, 32*8, BITMAP_FORMAT_INDEXED16);
state_save_register_global_bitmap(machine, state->left);
state_save_register_global_bitmap(machine, state->right);
}
static void draw_sprites(running_machine *machine,bitmap_t *bitmap,const rectangle *cliprect, UINT32 *backfire_spriteram32, int region)
static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT32 *spriteram, int region )
{
int offs;
flip_screen_set_no_update(machine, 1);
for (offs = (0x1400/4)-4;offs >= 0;offs -= 4) // 0x1400 for charlien
for (offs = (0x1400 / 4) - 4; offs >= 0; offs -= 4) // 0x1400 for charlien
{
int x,y,sprite,colour,multi,fx,fy,inc,flash,mult, pri;
int x, y, sprite, colour, multi, fx, fy, inc, flash, mult, pri;
sprite = backfire_spriteram32[offs+1]&0xffff;
sprite = spriteram[offs + 1] & 0xffff;
y = backfire_spriteram32[offs]&0xffff;
flash=y&0x1000;
if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue;
y = spriteram[offs] & 0xffff;
flash = y & 0x1000;
if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1))
continue;
x = backfire_spriteram32[offs+2]&0xffff;
colour = (x >>9) & 0x1f;
x = spriteram[offs + 2] & 0xffff;
colour = (x >> 9) & 0x1f;
pri = (x&0xc000); // 2 bits or 1?
pri = (x & 0xc000); // 2 bits or 1?
switch (pri&0xc000) {
case 0x0000: pri=0; break; // numbers, people, cars when in the air, status display..
case 0x4000: pri=0xf0;break; // cars most of the time
case 0x8000: pri=0; break; // car wheels during jump?
case 0xc000: pri=0xf0;break; /* car wheels in race? */
switch (pri & 0xc000)
{
case 0x0000: pri = 0; break; // numbers, people, cars when in the air, status display..
case 0x4000: pri = 0xf0;break; // cars most of the time
case 0x8000: pri = 0; break; // car wheels during jump?
case 0xc000: pri = 0xf0;break; /* car wheels in race? */
}
// pri 0 = ontop of everything//
// pri = 0;
// pri = 0;
fx = y & 0x2000;
fy = y & 0x4000;
@ -94,9 +119,9 @@ static void draw_sprites(running_machine *machine,bitmap_t *bitmap,const rectang
if (x >= 320) x -= 512;
if (y >= 256) y -= 512;
y = 240 - y;
x = 304 - x;
x = 304 - x;
if (x>320) continue;
if (x > 320) continue;
sprite &= ~multi;
if (fy)
@ -109,13 +134,13 @@ static void draw_sprites(running_machine *machine,bitmap_t *bitmap,const rectang
if (flip_screen_x_get(machine))
{
y=240-y;
x=304-x;
if (fx) fx=0; else fx=1;
if (fy) fy=0; else fy=1;
mult=16;
y = 240 - y;
x = 304 - x;
if (fx) fx = 0; else fx = 1;
if (fy) fy = 0; else fy = 1;
mult = 16;
}
else mult=-16;
else mult = -16;
while (multi >= 0)
{
@ -135,63 +160,60 @@ static void draw_sprites(running_machine *machine,bitmap_t *bitmap,const rectang
static VIDEO_UPDATE( backfire )
{
running_device *left_screen = devtag_get_device(screen->machine, "lscreen");
running_device *right_screen = devtag_get_device(screen->machine, "rscreen");
running_device *deco16ic = devtag_get_device(screen->machine, "deco_custom");
backfire_state *state = (backfire_state *)screen->machine->driver_data;
/* screen 1 uses pf1 as the forground and pf3 as the background */
/* screen 2 uses pf2 as the foreground and pf4 as the background */
deco16ic_pf12_update(state->deco16ic, state->pf1_rowscroll, state->pf2_rowscroll);
deco16ic_pf34_update(state->deco16ic, state->pf3_rowscroll, state->pf4_rowscroll);
deco16ic_pf12_update(deco16ic, backfire_pf1_rowscroll, backfire_pf2_rowscroll);
deco16ic_pf34_update(deco16ic, backfire_pf3_rowscroll, backfire_pf4_rowscroll);
if (screen == left_screen)
if (screen == state->lscreen)
{
bitmap_fill(screen->machine->priority_bitmap, NULL, 0);
bitmap_fill(bitmap, cliprect, 0x100);
if (backfire_left_priority[0] == 0)
if (state->left_priority[0] == 0)
{
deco16ic_tilemap_3_draw(deco16ic, bitmap, cliprect, 0, 1);
deco16ic_tilemap_1_draw(deco16ic, bitmap, cliprect, 0, 2);
draw_sprites(screen->machine, bitmap, cliprect, backfire_spriteram32_1, 3);
deco16ic_tilemap_3_draw(state->deco16ic, bitmap, cliprect, 0, 1);
deco16ic_tilemap_1_draw(state->deco16ic, bitmap, cliprect, 0, 2);
draw_sprites(screen->machine, bitmap, cliprect, state->spriteram_1, 3);
}
else if (backfire_left_priority[0] == 2)
else if (state->left_priority[0] == 2)
{
deco16ic_tilemap_1_draw(deco16ic, bitmap, cliprect, 0, 2);
deco16ic_tilemap_3_draw(deco16ic, bitmap, cliprect, 0, 4);
draw_sprites(screen->machine, bitmap, cliprect, backfire_spriteram32_1, 3);
deco16ic_tilemap_1_draw(state->deco16ic, bitmap, cliprect, 0, 2);
deco16ic_tilemap_3_draw(state->deco16ic, bitmap, cliprect, 0, 4);
draw_sprites(screen->machine, bitmap, cliprect, state->spriteram_1, 3);
}
else
popmessage( "unknown left priority %08x", backfire_left_priority[0] );
popmessage( "unknown left priority %08x", state->left_priority[0]);
}
else if (screen == right_screen)
else if (screen == state->rscreen)
{
bitmap_fill(screen->machine->priority_bitmap,NULL,0);
bitmap_fill(bitmap,cliprect,0x500);
bitmap_fill(screen->machine->priority_bitmap, NULL, 0);
bitmap_fill(bitmap, cliprect, 0x500);
if (backfire_right_priority[0] == 0)
if (state->right_priority[0] == 0)
{
deco16ic_tilemap_4_draw(deco16ic, bitmap, cliprect, 0, 1);
deco16ic_tilemap_2_draw(deco16ic, bitmap, cliprect, 0, 2);
draw_sprites(screen->machine, bitmap, cliprect, backfire_spriteram32_2, 4);
deco16ic_tilemap_4_draw(state->deco16ic, bitmap, cliprect, 0, 1);
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, 0, 2);
draw_sprites(screen->machine, bitmap, cliprect, state->spriteram_2, 4);
}
else if (backfire_right_priority[0] == 2)
else if (state->right_priority[0] == 2)
{
deco16ic_tilemap_2_draw(deco16ic, bitmap, cliprect, 0, 2);
deco16ic_tilemap_4_draw(deco16ic, bitmap, cliprect, 0, 4);
draw_sprites(screen->machine, bitmap, cliprect, backfire_spriteram32_2, 4);
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, 0, 2);
deco16ic_tilemap_4_draw(state->deco16ic, bitmap, cliprect, 0, 4);
draw_sprites(screen->machine, bitmap, cliprect, state->spriteram_2, 4);
}
else
popmessage( "unknown right priority %08x", backfire_right_priority[0] );
popmessage( "unknown right priority %08x", state->right_priority[0]);
}
return 0;
}
static READ32_DEVICE_HANDLER(backfire_eeprom_r)
static READ32_DEVICE_HANDLER( backfire_eeprom_r )
{
/* some kind of screen indicator? checked by backfirea set before it will boot */
int backfire_screen = mame_rand(device->machine) & 1;
@ -200,17 +222,21 @@ static READ32_DEVICE_HANDLER(backfire_eeprom_r)
| ((input_port_read(device->machine, "IN3") & 0x40) << 16)) ^ (backfire_screen << 26) ;
}
static READ32_HANDLER(backfire_control2_r)
static READ32_HANDLER( backfire_control2_r )
{
backfire_state *state = (backfire_state *)space->machine->driver_data;
// logerror("%08x:Read eprom %08x (%08x)\n", cpu_get_pc(space->cpu), offset << 1, mem_mask);
return (eeprom_read_bit(devtag_get_device(space->machine, "eeprom")) << 24) | input_port_read(space->machine, "IN1") | (input_port_read(space->machine, "IN1") << 16);
return (eeprom_read_bit(state->eeprom) << 24) | input_port_read(space->machine, "IN1") | (input_port_read(space->machine, "IN1") << 16);
}
#ifdef UNUSED_FUNCTION
static READ32_HANDLER(backfire_control3_r)
{
backfire_state *state = (backfire_state *)space->machine->driver_data;
// logerror("%08x:Read eprom %08x (%08x)\n", cpu_get_pc(space->cpu), offset << 1, mem_mask);
return (eeprom_read_bit(devtag_get_device(space->machine, "eeprom")) << 24) | input_port_read(space->machine, "IN2") | (input_port_read(space->machine, "IN2") << 16);
return (eeprom_read_bit(state->eeprom) << 24) | input_port_read(space->machine, "IN2") | (input_port_read(space->machine, "IN2") << 16);
}
#endif
@ -218,10 +244,11 @@ static READ32_HANDLER(backfire_control3_r)
static WRITE32_DEVICE_HANDLER(backfire_eeprom_w)
{
logerror("%s:write eprom %08x (%08x) %08x\n",cpuexec_describe_context(device->machine),offset<<1,mem_mask,data);
if (ACCESSING_BITS_0_7) {
eeprom_set_clock_line(device, (data & 0x2) ? ASSERT_LINE : CLEAR_LINE);
eeprom_write_bit(device, data & 0x1);
eeprom_set_cs_line(device, (data & 0x4) ? CLEAR_LINE : ASSERT_LINE);
if (ACCESSING_BITS_0_7)
{
eeprom_set_clock_line(device, BIT(data, 1) ? ASSERT_LINE : CLEAR_LINE);
eeprom_write_bit(device, BIT(data, 0));
eeprom_set_cs_line(device, BIT(data, 2) ? CLEAR_LINE : ASSERT_LINE);
}
}
@ -234,14 +261,14 @@ static WRITE32_HANDLER(backfire_nonbuffered_palette_w)
/* map 32-bit writes to 16-bit */
static READ32_HANDLER( backfire_pf1_rowscroll_r ) { return backfire_pf1_rowscroll[offset]^0xffff0000; }
static READ32_HANDLER( backfire_pf2_rowscroll_r ) { return backfire_pf2_rowscroll[offset]^0xffff0000; }
static READ32_HANDLER( backfire_pf3_rowscroll_r ) { return backfire_pf3_rowscroll[offset]^0xffff0000; }
static READ32_HANDLER( backfire_pf4_rowscroll_r ) { return backfire_pf4_rowscroll[offset]^0xffff0000; }
static WRITE32_HANDLER( backfire_pf1_rowscroll_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; COMBINE_DATA(&backfire_pf1_rowscroll[offset]); }
static WRITE32_HANDLER( backfire_pf2_rowscroll_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; COMBINE_DATA(&backfire_pf2_rowscroll[offset]); }
static WRITE32_HANDLER( backfire_pf3_rowscroll_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; COMBINE_DATA(&backfire_pf3_rowscroll[offset]); }
static WRITE32_HANDLER( backfire_pf4_rowscroll_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; COMBINE_DATA(&backfire_pf4_rowscroll[offset]); }
static READ32_HANDLER( backfire_pf1_rowscroll_r ) { backfire_state *state = (backfire_state *)space->machine->driver_data; return state->pf1_rowscroll[offset] ^ 0xffff0000; }
static READ32_HANDLER( backfire_pf2_rowscroll_r ) { backfire_state *state = (backfire_state *)space->machine->driver_data; return state->pf2_rowscroll[offset] ^ 0xffff0000; }
static READ32_HANDLER( backfire_pf3_rowscroll_r ) { backfire_state *state = (backfire_state *)space->machine->driver_data; return state->pf3_rowscroll[offset] ^ 0xffff0000; }
static READ32_HANDLER( backfire_pf4_rowscroll_r ) { backfire_state *state = (backfire_state *)space->machine->driver_data; return state->pf4_rowscroll[offset] ^ 0xffff0000; }
static WRITE32_HANDLER( backfire_pf1_rowscroll_w ) { backfire_state *state = (backfire_state *)space->machine->driver_data; data &= 0x0000ffff; mem_mask &= 0x0000ffff; COMBINE_DATA(&state->pf1_rowscroll[offset]); }
static WRITE32_HANDLER( backfire_pf2_rowscroll_w ) { backfire_state *state = (backfire_state *)space->machine->driver_data; data &= 0x0000ffff; mem_mask &= 0x0000ffff; COMBINE_DATA(&state->pf2_rowscroll[offset]); }
static WRITE32_HANDLER( backfire_pf3_rowscroll_w ) { backfire_state *state = (backfire_state *)space->machine->driver_data; data &= 0x0000ffff; mem_mask &= 0x0000ffff; COMBINE_DATA(&state->pf3_rowscroll[offset]); }
static WRITE32_HANDLER( backfire_pf4_rowscroll_w ) { backfire_state *state = (backfire_state *)space->machine->driver_data; data &= 0x0000ffff; mem_mask &= 0x0000ffff; COMBINE_DATA(&state->pf4_rowscroll[offset]); }
#ifdef UNUSED_FUNCTION
@ -275,19 +302,19 @@ static ADDRESS_MAP_START( backfire_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x150000, 0x150fff) AM_READWRITE(backfire_pf3_rowscroll_r, backfire_pf3_rowscroll_w)
AM_RANGE(0x154000, 0x154fff) AM_READWRITE(backfire_pf4_rowscroll_r, backfire_pf4_rowscroll_w)
AM_RANGE(0x160000, 0x161fff) AM_WRITE(backfire_nonbuffered_palette_w) AM_BASE_GENERIC(paletteram)
AM_RANGE(0x170000, 0x177fff) AM_RAM AM_BASE(&backfire_mainram )// main ram
AM_RANGE(0x170000, 0x177fff) AM_RAM AM_BASE_MEMBER(backfire_state, mainram)// main ram
// AM_RANGE(0x180010, 0x180013) AM_RAM AM_BASE(&backfire_180010) // always 180010 ?
// AM_RANGE(0x188010, 0x188013) AM_RAM AM_BASE(&backfire_188010) // always 188010 ?
AM_RANGE(0x184000, 0x185fff) AM_RAM AM_BASE(&backfire_spriteram32_1)
AM_RANGE(0x18c000, 0x18dfff) AM_RAM AM_BASE(&backfire_spriteram32_2)
AM_RANGE(0x184000, 0x185fff) AM_RAM AM_BASE_MEMBER(backfire_state, spriteram_1)
AM_RANGE(0x18c000, 0x18dfff) AM_RAM AM_BASE_MEMBER(backfire_state, spriteram_2)
AM_RANGE(0x190000, 0x190003) AM_DEVREAD("eeprom", backfire_eeprom_r)
AM_RANGE(0x194000, 0x194003) AM_READ(backfire_control2_r)
AM_RANGE(0x1a4000, 0x1a4003) AM_DEVWRITE("eeprom", backfire_eeprom_w)
AM_RANGE(0x1a8000, 0x1a8003) AM_RAM AM_BASE(&backfire_left_priority)
AM_RANGE(0x1ac000, 0x1ac003) AM_RAM AM_BASE(&backfire_right_priority)
AM_RANGE(0x1a8000, 0x1a8003) AM_RAM AM_BASE_MEMBER(backfire_state, left_priority)
AM_RANGE(0x1ac000, 0x1ac003) AM_RAM AM_BASE_MEMBER(backfire_state, right_priority)
// AM_RANGE(0x1b0000, 0x1b0003) AM_WRITENOP // always 1b0000
/* when set to pentometer in test mode */
@ -440,8 +467,22 @@ static const deco16ic_interface backfire_deco16ic_intf =
backfire_bank_callback
};
static MACHINE_START( backfire )
{
backfire_state *state = (backfire_state *)machine->driver_data;
state->maincpu = devtag_get_device(machine, "maincpu");
state->deco16ic = devtag_get_device(machine, "deco_custom");
state->lscreen = devtag_get_device(machine, "lscreen");
state->rscreen = devtag_get_device(machine, "rscreen");
state->eeprom = devtag_get_device(machine, "eeprom");
}
static MACHINE_DRIVER_START( backfire )
/* driver data */
MDRV_DRIVER_DATA(backfire_state)
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", ARM, 28000000/4) /* Unconfirmed */
MDRV_CPU_PROGRAM_MAP(backfire_map)
@ -449,6 +490,8 @@ static MACHINE_DRIVER_START( backfire )
MDRV_EEPROM_93C46_ADD("eeprom")
MDRV_MACHINE_START(backfire)
/* video hardware */
MDRV_PALETTE_LENGTH(2048)
MDRV_GFXDECODE(backfire)
@ -611,7 +654,7 @@ static void descramble_sound( running_machine *machine )
UINT8 *buf1 = auto_alloc_array(machine, UINT8, length);
UINT32 x;
for (x=0;x<length;x++)
for (x = 0; x < length; x++)
{
UINT32 addr;
@ -625,19 +668,21 @@ static void descramble_sound( running_machine *machine )
buf1[addr] = rom[x];
}
memcpy(rom,buf1,length);
memcpy(rom, buf1, length);
auto_free (machine, buf1);
auto_free(machine, buf1);
}
static READ32_HANDLER( backfire_speedup_r )
{
// mame_printf_debug( "%08x\n",cpu_get_pc(space->cpu));
backfire_state *state = (backfire_state *)space->machine->driver_data;
if (cpu_get_pc(space->cpu)==0xce44) cpu_spinuntil_time(space->cpu, ATTOTIME_IN_USEC(400)); // backfire
if (cpu_get_pc(space->cpu)==0xcee4) cpu_spinuntil_time(space->cpu, ATTOTIME_IN_USEC(400)); // backfirea
//mame_printf_debug( "%08x\n",cpu_get_pc(space->cpu));
return backfire_mainram[0x18/4];
if (cpu_get_pc(space->cpu )== 0xce44) cpu_spinuntil_time(space->cpu, ATTOTIME_IN_USEC(400)); // backfire
if (cpu_get_pc(space->cpu) == 0xcee4) cpu_spinuntil_time(space->cpu, ATTOTIME_IN_USEC(400)); // backfirea
return state->mainram[0x18/4];
}
@ -651,5 +696,5 @@ static DRIVER_INIT( backfire )
memory_install_read32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0170018, 0x017001b, 0, 0, backfire_speedup_r );
}
GAME( 1995, backfire, 0, backfire, backfire, backfire, ROT0, "Data East Corporation", "Backfire! (set 1)", 0 )
GAME( 1995, backfirea,backfire, backfire, backfire, backfire, ROT0, "Data East Corporation", "Backfire! (set 2)", 0 ) // defaults to wheel controls, must change to joystick to play
GAME( 1995, backfire, 0, backfire, backfire, backfire, ROT0, "Data East Corporation", "Backfire! (set 1)", GAME_SUPPORTS_SAVE )
GAME( 1995, backfirea, backfire, backfire, backfire, backfire, ROT0, "Data East Corporation", "Backfire! (set 2)", GAME_SUPPORTS_SAVE ) // defaults to wheel controls, must change to joystick to play

View File

@ -81,18 +81,13 @@
#include "emu.h"
#include "cpu/m68000/m68000.h"
#include "cpu/h6280/h6280.h"
#include "includes/boogwing.h"
#include "includes/decocrpt.h"
#include "video/deco16ic.h"
#include "includes/decoprot.h"
#include "sound/2151intf.h"
#include "sound/okim6295.h"
#include "video/deco16ic.h"
extern UINT16 *boogwing_pf1_rowscroll,*boogwing_pf2_rowscroll;
extern UINT16 *boogwing_pf3_rowscroll,*boogwing_pf4_rowscroll;
VIDEO_UPDATE(boogwing);
/**********************************************************************************/
static ADDRESS_MAP_START( boogwing_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x0fffff) AM_ROM
@ -114,14 +109,14 @@ static ADDRESS_MAP_START( boogwing_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x260000, 0x26000f) AM_DEVWRITE("deco_custom", deco16ic_pf12_control_w)
AM_RANGE(0x264000, 0x265fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf1_data_r, deco16ic_pf1_data_w)
AM_RANGE(0x266000, 0x267fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf2_data_r, deco16ic_pf2_data_w)
AM_RANGE(0x268000, 0x268fff) AM_RAM AM_BASE(&boogwing_pf1_rowscroll)
AM_RANGE(0x26a000, 0x26afff) AM_RAM AM_BASE(&boogwing_pf2_rowscroll)
AM_RANGE(0x268000, 0x268fff) AM_RAM AM_BASE_MEMBER(boogwing_state, pf1_rowscroll)
AM_RANGE(0x26a000, 0x26afff) AM_RAM AM_BASE_MEMBER(boogwing_state, pf2_rowscroll)
AM_RANGE(0x270000, 0x27000f) AM_DEVWRITE("deco_custom", deco16ic_pf34_control_w)
AM_RANGE(0x274000, 0x275fff) AM_RAM_DEVWRITE("deco_custom", deco16ic_pf3_data_w)
AM_RANGE(0x276000, 0x277fff) AM_RAM_DEVWRITE("deco_custom", deco16ic_pf4_data_w)
AM_RANGE(0x278000, 0x278fff) AM_RAM AM_BASE(&boogwing_pf3_rowscroll)
AM_RANGE(0x27a000, 0x27afff) AM_RAM AM_BASE(&boogwing_pf4_rowscroll)
AM_RANGE(0x278000, 0x278fff) AM_RAM AM_BASE_MEMBER(boogwing_state, pf3_rowscroll)
AM_RANGE(0x27a000, 0x27afff) AM_RAM AM_BASE_MEMBER(boogwing_state, pf4_rowscroll)
AM_RANGE(0x280000, 0x28000f) AM_NOP // ?
AM_RANGE(0x282000, 0x282001) AM_NOP // Palette setup?
@ -281,13 +276,15 @@ GFXDECODE_END
static void sound_irq(running_device *device, int state)
{
cputag_set_input_line(device->machine, "audiocpu", 1, state); /* IRQ 2 */
boogwing_state *driver_state = (boogwing_state *)device->machine->driver_data;
cpu_set_input_line(driver_state->audiocpu, 1, state); /* IRQ 2 */
}
static WRITE8_DEVICE_HANDLER( sound_bankswitch_w )
{
okim6295_set_bank_base(devtag_get_device(device->machine, "oki2"), ((data & 2)>>1) * 0x40000);
okim6295_set_bank_base(devtag_get_device(device->machine, "oki1"), (data & 1) * 0x40000);
boogwing_state *state = (boogwing_state *)device->machine->driver_data;
okim6295_set_bank_base(state->oki2, ((data & 2) >> 1) * 0x40000);
okim6295_set_bank_base(state->oki1, (data & 1) * 0x40000);
}
static const ym2151_interface ym2151_config =
@ -297,12 +294,12 @@ static const ym2151_interface ym2151_config =
};
static int boogwing_bank_callback(const int bank)
static int boogwing_bank_callback( const int bank )
{
return ((bank >> 4) & 0x7) * 0x1000;
}
static int boogwing_bank_callback2(const int bank)
static int boogwing_bank_callback2( const int bank )
{
int offset = ((bank >> 4) & 0x7) * 0x1000;
if ((bank & 0xf) == 0xa)
@ -325,7 +322,22 @@ static const deco16ic_interface boogwing_deco16ic_intf =
};
static MACHINE_START( boogwing )
{
boogwing_state *state = (boogwing_state *)machine->driver_data;
state->maincpu = devtag_get_device(machine, "maincpu");
state->audiocpu = devtag_get_device(machine, "audiocpu");
state->deco16ic = devtag_get_device(machine, "deco_custom");
state->oki1 = devtag_get_device(machine, "oki1");
state->oki2 = devtag_get_device(machine, "oki2");
}
static MACHINE_DRIVER_START( boogwing )
/* driver data */
MDRV_DRIVER_DATA(boogwing_state)
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", M68000, 14000000) /* DE102 */
MDRV_CPU_PROGRAM_MAP(boogwing_map)
@ -334,6 +346,8 @@ static MACHINE_DRIVER_START( boogwing )
MDRV_CPU_ADD("audiocpu", H6280,32220000/4)
MDRV_CPU_PROGRAM_MAP(audio_map)
MDRV_MACHINE_START(boogwing)
/* video hardware */
MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM )
@ -550,8 +564,8 @@ ROM_END
static DRIVER_INIT( boogwing )
{
const UINT8* src=memory_region(machine, "gfx6");
UINT8* dst=memory_region(machine, "tiles2") + 0x200000;
const UINT8* src = memory_region(machine, "gfx6");
UINT8* dst = memory_region(machine, "tiles2") + 0x200000;
deco56_decrypt_gfx(machine, "tiles1");
deco56_decrypt_gfx(machine, "tiles2");
@ -561,7 +575,7 @@ static DRIVER_INIT( boogwing )
memcpy(dst, src, 0x100000);
}
GAME( 1992, boogwing, 0, boogwing, boogwing, boogwing, ROT0, "Data East Corporation", "Boogie Wings (Euro v1.5, 92.12.07)", 0 )
GAME( 1992, boogwinga,boogwing, boogwing, boogwing, boogwing, ROT0, "Data East Corporation", "Boogie Wings (Asia v1.5, 92.12.07)", 0 )
GAME( 1992, ragtime, boogwing, boogwing, boogwing, boogwing, ROT0, "Data East Corporation", "The Great Ragtime Show (Japan v1.5, 92.12.07)", 0 )
GAME( 1992, ragtimea, boogwing, boogwing, boogwing, boogwing, ROT0, "Data East Corporation", "The Great Ragtime Show (Japan v1.3, 92.11.26)", 0 )
GAME( 1992, boogwing, 0, boogwing, boogwing, boogwing, ROT0, "Data East Corporation", "Boogie Wings (Euro v1.5, 92.12.07)", GAME_SUPPORTS_SAVE )
GAME( 1992, boogwinga,boogwing, boogwing, boogwing, boogwing, ROT0, "Data East Corporation", "Boogie Wings (Asia v1.5, 92.12.07)", GAME_SUPPORTS_SAVE )
GAME( 1992, ragtime, boogwing, boogwing, boogwing, boogwing, ROT0, "Data East Corporation", "The Great Ragtime Show (Japan v1.5, 92.12.07)", GAME_SUPPORTS_SAVE )
GAME( 1992, ragtimea, boogwing, boogwing, boogwing, boogwing, ROT0, "Data East Corporation", "The Great Ragtime Show (Japan v1.3, 92.11.26)", GAME_SUPPORTS_SAVE )

View File

@ -19,27 +19,17 @@
#include "emu.h"
#include "cpu/m68000/m68000.h"
#include "cpu/h6280/h6280.h"
#include "includes/cbuster.h"
#include "sound/2203intf.h"
#include "sound/2151intf.h"
#include "sound/okim6295.h"
#include "video/deco16ic.h"
VIDEO_UPDATE( twocrude );
extern UINT16 *twocrude_pf1_rowscroll,*twocrude_pf2_rowscroll;
extern UINT16 *twocrude_pf3_rowscroll,*twocrude_pf4_rowscroll;
WRITE16_HANDLER( twocrude_palette_24bit_rg_w );
WRITE16_HANDLER( twocrude_palette_24bit_b_w );
static UINT16 *twocrude_ram;
extern void twocrude_pri_w(int pri);
static UINT16 prot;
/******************************************************************************/
static WRITE16_HANDLER( twocrude_control_w )
{
cbuster_state *state = (cbuster_state *)space->machine->driver_data;
switch (offset << 1)
{
case 0: /* DMA flag */
@ -51,7 +41,7 @@ static WRITE16_HANDLER( twocrude_control_w )
case 2: /* Sound CPU write */
soundlatch_w(space, 0, data & 0xff);
cputag_set_input_line(space->machine, "audiocpu", 0, HOLD_LINE);
cpu_set_input_line(state->audiocpu, 0, HOLD_LINE);
return;
case 4: /* Protection, maybe this is a PAL on the board?
@ -71,18 +61,18 @@ static WRITE16_HANDLER( twocrude_control_w )
protection?!
*/
if ((data & 0xffff) == 0x9a00) prot = 0;
if ((data & 0xffff) == 0xaa) prot = 0x74;
if ((data & 0xffff) == 0x0200) prot = 0x63 << 8;
if ((data & 0xffff) == 0x9a) prot = 0xe;
if ((data & 0xffff) == 0x55) prot = 0x1e;
if ((data & 0xffff) == 0x0e) {prot = 0x0e; twocrude_pri_w(0);} /* start */
if ((data & 0xffff) == 0x00) {prot = 0x0e; twocrude_pri_w(0);} /* level 0 */
if ((data & 0xffff) == 0xf1) {prot = 0x36; twocrude_pri_w(1);} /* level 1 */
if ((data & 0xffff) == 0x80) {prot = 0x2e; twocrude_pri_w(1);} /* level 2 */
if ((data & 0xffff) == 0x40) {prot = 0x1e; twocrude_pri_w(1);} /* level 3 */
if ((data & 0xffff) == 0xc0) {prot = 0x3e; twocrude_pri_w(0);} /* level 4 */
if ((data & 0xffff) == 0xff) {prot = 0x76; twocrude_pri_w(1);} /* level 5 */
if ((data & 0xffff) == 0x9a00) state->prot = 0;
if ((data & 0xffff) == 0xaa) state->prot = 0x74;
if ((data & 0xffff) == 0x0200) state->prot = 0x63 << 8;
if ((data & 0xffff) == 0x9a) state->prot = 0xe;
if ((data & 0xffff) == 0x55) state->prot = 0x1e;
if ((data & 0xffff) == 0x0e) {state->prot = 0x0e; state->pri = 0;} /* start */
if ((data & 0xffff) == 0x00) {state->prot = 0x0e; state->pri = 0;} /* level 0 */
if ((data & 0xffff) == 0xf1) {state->prot = 0x36; state->pri = 1;} /* level 1 */
if ((data & 0xffff) == 0x80) {state->prot = 0x2e; state->pri = 1;} /* level 2 */
if ((data & 0xffff) == 0x40) {state->prot = 0x1e; state->pri = 1;} /* level 3 */
if ((data & 0xffff) == 0xc0) {state->prot = 0x3e; state->pri = 0;} /* level 4 */
if ((data & 0xffff) == 0xff) {state->prot = 0x76; state->pri = 1;} /* level 5 */
break;
}
@ -91,6 +81,8 @@ static WRITE16_HANDLER( twocrude_control_w )
static READ16_HANDLER( twocrude_control_r )
{
cbuster_state *state = (cbuster_state *)space->machine->driver_data;
switch (offset << 1)
{
case 0: /* Player 1 & Player 2 joysticks & fire buttons */
@ -100,8 +92,8 @@ static READ16_HANDLER( twocrude_control_r )
return input_port_read(space->machine, "DSW");
case 4: /* Protection */
logerror("%04x : protection control read at 30c000 %d\n",cpu_get_pc(space->cpu),offset);
return prot;
logerror("%04x : protection control read at 30c000 %d\n", cpu_get_pc(space->cpu), offset);
return state->prot;
case 6: /* Credits, VBL in byte 7 */
return input_port_read(space->machine, "COINS");
@ -114,17 +106,17 @@ static READ16_HANDLER( twocrude_control_r )
static ADDRESS_MAP_START( twocrude_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x07ffff) AM_ROM
AM_RANGE(0x080000, 0x083fff) AM_RAM AM_BASE(&twocrude_ram)
AM_RANGE(0x080000, 0x083fff) AM_RAM AM_BASE_MEMBER(cbuster_state, ram)
AM_RANGE(0x0a0000, 0x0a1fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf1_data_r, deco16ic_pf1_data_w)
AM_RANGE(0x0a2000, 0x0a2fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf2_data_r, deco16ic_pf2_data_w)
AM_RANGE(0x0a4000, 0x0a47ff) AM_RAM AM_BASE(&twocrude_pf1_rowscroll)
AM_RANGE(0x0a6000, 0x0a67ff) AM_RAM AM_BASE(&twocrude_pf2_rowscroll)
AM_RANGE(0x0a4000, 0x0a47ff) AM_RAM AM_BASE_MEMBER(cbuster_state, pf1_rowscroll)
AM_RANGE(0x0a6000, 0x0a67ff) AM_RAM AM_BASE_MEMBER(cbuster_state, pf2_rowscroll)
AM_RANGE(0x0a8000, 0x0a8fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf3_data_r, deco16ic_pf3_data_w)
AM_RANGE(0x0aa000, 0x0aafff) AM_DEVREADWRITE("deco_custom", deco16ic_pf4_data_r, deco16ic_pf4_data_w)
AM_RANGE(0x0ac000, 0x0ac7ff) AM_RAM AM_BASE(&twocrude_pf3_rowscroll)
AM_RANGE(0x0ae000, 0x0ae7ff) AM_RAM AM_BASE(&twocrude_pf4_rowscroll)
AM_RANGE(0x0ac000, 0x0ac7ff) AM_RAM AM_BASE_MEMBER(cbuster_state, pf3_rowscroll)
AM_RANGE(0x0ae000, 0x0ae7ff) AM_RAM AM_BASE_MEMBER(cbuster_state, pf4_rowscroll)
AM_RANGE(0x0b0000, 0x0b07ff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
AM_RANGE(0x0b4000, 0x0b4001) AM_WRITENOP
@ -170,7 +162,7 @@ static INPUT_PORTS_START( twocrude )
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 )
PORT_START("COINS") /* Credits */
PORT_START("COINS")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
@ -274,7 +266,8 @@ GFXDECODE_END
static void sound_irq(running_device *device, int state)
{
cputag_set_input_line(device->machine, "audiocpu", 1, state); /* IRQ 2 */
cbuster_state *driver_state = (cbuster_state *)device->machine->driver_data;
cpu_set_input_line(driver_state->audiocpu, 1, state); /* IRQ 2 */
}
static const ym2151_interface ym2151_config =
@ -300,8 +293,31 @@ static const deco16ic_interface twocrude_deco16ic_intf =
twocrude_bank_callback
};
static MACHINE_START( cbuster )
{
cbuster_state *state = (cbuster_state *)machine->driver_data;
state->maincpu = devtag_get_device(machine, "maincpu");
state->audiocpu = devtag_get_device(machine, "audiocpu");
state->deco16ic = devtag_get_device(machine, "deco_custom");
state_save_register_global(machine, state->prot);
state_save_register_global(machine, state->pri);
}
static MACHINE_RESET( cbuster )
{
cbuster_state *state = (cbuster_state *)machine->driver_data;
state->prot = 0;
state->pri = 0;
}
static MACHINE_DRIVER_START( twocrude )
/* driver data */
MDRV_DRIVER_DATA(cbuster_state)
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", M68000, 12000000) /* Custom chip 59 */
MDRV_CPU_PROGRAM_MAP(twocrude_map)
@ -310,6 +326,9 @@ static MACHINE_DRIVER_START( twocrude )
MDRV_CPU_ADD("audiocpu", H6280,32220000/4) /* Custom chip 45, Audio section crystal is 32.220 MHz */
MDRV_CPU_PROGRAM_MAP(sound_map)
MDRV_MACHINE_START(cbuster)
MDRV_MACHINE_RESET(cbuster)
/* video hardware */
MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
@ -507,42 +526,46 @@ static DRIVER_INIT( twocrude )
{
UINT8 *RAM = memory_region(machine, "maincpu");
UINT8 *PTR;
int i,j;
int i, j;
/* Main cpu decrypt */
for (i=0x00000; i<0x80000; i+=2) {
int h = i+NATIVE_ENDIAN_VALUE_LE_BE(1,0), l = i+NATIVE_ENDIAN_VALUE_LE_BE(0,1);
for (i = 0x00000; i < 0x80000; i += 2)
{
int h = i + NATIVE_ENDIAN_VALUE_LE_BE(1,0), l = i + NATIVE_ENDIAN_VALUE_LE_BE(0,1);
RAM[h]=(RAM[h] & 0xcf) | ((RAM[h] & 0x10) << 1) | ((RAM[h] & 0x20) >> 1);
RAM[h]=(RAM[h] & 0x5f) | ((RAM[h] & 0x20) << 2) | ((RAM[h] & 0x80) >> 2);
RAM[h] = (RAM[h] & 0xcf) | ((RAM[h] & 0x10) << 1) | ((RAM[h] & 0x20) >> 1);
RAM[h] = (RAM[h] & 0x5f) | ((RAM[h] & 0x20) << 2) | ((RAM[h] & 0x80) >> 2);
RAM[l]=(RAM[l] & 0xbd) | ((RAM[l] & 0x2) << 5) | ((RAM[l] & 0x40) >> 5);
RAM[l]=(RAM[l] & 0xf5) | ((RAM[l] & 0x2) << 2) | ((RAM[l] & 0x8) >> 2);
RAM[l] = (RAM[l] & 0xbd) | ((RAM[l] & 0x2) << 5) | ((RAM[l] & 0x40) >> 5);
RAM[l] = (RAM[l] & 0xf5) | ((RAM[l] & 0x2) << 2) | ((RAM[l] & 0x8) >> 2);
}
/* Rearrange the 'extra' sprite bank to be in the same format as main sprites */
RAM = memory_region(machine, "gfx3") + 0x080000;
PTR = memory_region(machine, "gfx3") + 0x140000;
for (i=0; i<0x20000; i+=64) {
for (j=0; j<16; j+=1) { /* Copy 16 lines down */
RAM[i+ 0+j*2]=PTR[i/2+ 0+j]; /* Pixels 0-7 for each plane */
RAM[i+ 1+j*2]=PTR[i/2+0x10000+j];
RAM[i+0xa0000+j*2]=PTR[i/2+0x20000+j];
RAM[i+0xa0001+j*2]=PTR[i/2+0x30000+j];
for (i = 0; i < 0x20000; i += 64)
{
for (j = 0; j < 16; j += 1)
{ /* Copy 16 lines down */
RAM[i + 0 + j * 2] = PTR[i / 2 + 0 + j]; /* Pixels 0-7 for each plane */
RAM[i + 1 + j * 2] = PTR[i / 2 + 0x10000 + j];
RAM[i + 0xa0000 + j * 2] = PTR[i / 2 + 0x20000 + j];
RAM[i + 0xa0001 + j * 2] = PTR[i / 2 + 0x30000 + j];
}
for (j=0; j<16; j+=1) { /* Copy 16 lines down */
RAM[i+ 0x20+j*2]=PTR[i/2+ 0x10+j]; /* Pixels 8-15 for each plane */
RAM[i+ 0x21+j*2]=PTR[i/2+0x10010+j];
RAM[i+0xa0020+j*2]=PTR[i/2+0x20010+j];
RAM[i+0xa0021+j*2]=PTR[i/2+0x30010+j];
for (j = 0; j < 16; j += 1)
{ /* Copy 16 lines down */
RAM[i + 0x20 + j * 2] = PTR[i / 2 + 0x10 + j]; /* Pixels 8-15 for each plane */
RAM[i + 0x21 + j * 2] = PTR[i / 2 + 0x10010 + j];
RAM[i + 0xa0020 + j * 2] = PTR[i / 2 + 0x20010 + j];
RAM[i + 0xa0021 + j * 2] = PTR[i / 2 + 0x30010 + j];
}
}
}
/******************************************************************************/
GAME( 1990, cbuster, 0, twocrude, twocrude, twocrude, ROT0, "Data East Corporation", "Crude Buster (World FX version)", 0 )
GAME( 1990, cbusterw, cbuster, twocrude, twocrude, twocrude, ROT0, "Data East Corporation", "Crude Buster (World FU version)", 0 )
GAME( 1990, cbusterj, cbuster, twocrude, twocrude, twocrude, ROT0, "Data East Corporation", "Crude Buster (Japan)", 0 )
GAME( 1990, twocrude, cbuster, twocrude, twocrude, twocrude, ROT0, "Data East USA", "Two Crude (US)", 0 )
GAME( 1990, cbuster, 0, twocrude, twocrude, twocrude, ROT0, "Data East Corporation", "Crude Buster (World FX version)", GAME_SUPPORTS_SAVE )
GAME( 1990, cbusterw, cbuster, twocrude, twocrude, twocrude, ROT0, "Data East Corporation", "Crude Buster (World FU version)", GAME_SUPPORTS_SAVE )
GAME( 1990, cbusterj, cbuster, twocrude, twocrude, twocrude, ROT0, "Data East Corporation", "Crude Buster (Japan)", GAME_SUPPORTS_SAVE )
GAME( 1990, twocrude, cbuster, twocrude, twocrude, twocrude, ROT0, "Data East USA", "Two Crude (US)", GAME_SUPPORTS_SAVE )

View File

@ -52,80 +52,87 @@ Note about version levels using Mutant Fighter as the example:
#include "sound/okim6295.h"
#include "video/deco16ic.h"
static int cninja_scanline, cninja_irq_mask;
static running_device *raster_irq_timer;
static UINT16 *cninja_ram;
/**********************************************************************************/
static WRITE16_HANDLER( cninja_sound_w )
{
soundlatch_w(space,0,data&0xff);
cputag_set_input_line(space->machine, "audiocpu", 0, HOLD_LINE);
cninja_state *state = (cninja_state *)space->machine->driver_data;
soundlatch_w(space, 0, data & 0xff);
cpu_set_input_line(state->audiocpu, 0, HOLD_LINE);
}
static WRITE16_HANDLER( stoneage_sound_w )
{
soundlatch_w(space,0,data&0xff);
cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
cninja_state *state = (cninja_state *)space->machine->driver_data;
soundlatch_w(space, 0, data & 0xff);
cpu_set_input_line(state->audiocpu, INPUT_LINE_NMI, PULSE_LINE);
}
static TIMER_DEVICE_CALLBACK( interrupt_gen )
{
cputag_set_input_line(timer->machine, "maincpu", (cninja_irq_mask&0x10) ? 3 : 4, ASSERT_LINE);
timer_device_adjust_oneshot(raster_irq_timer, attotime_never, 0);
cninja_state *state = (cninja_state *)timer->machine->driver_data;
cpu_set_input_line(state->maincpu, (state->irq_mask & 0x10) ? 3 : 4, ASSERT_LINE);
timer_device_adjust_oneshot(state->raster_irq_timer, attotime_never, 0);
}
static READ16_HANDLER( cninja_irq_r )
{
switch (offset) {
cninja_state *state = (cninja_state *)space->machine->driver_data;
switch (offset)
{
case 1: /* Raster IRQ scanline position */
return cninja_scanline;
return state->scanline;
case 2: /* Raster IRQ ACK - value read is not used */
cputag_set_input_line(space->machine, "maincpu", 3, CLEAR_LINE);
cputag_set_input_line(space->machine, "maincpu", 4, CLEAR_LINE);
cpu_set_input_line(state->maincpu, 3, CLEAR_LINE);
cpu_set_input_line(state->maincpu, 4, CLEAR_LINE);
return 0;
}
logerror("%08x: Unmapped IRQ read %d\n",cpu_get_pc(space->cpu),offset);
logerror("%08x: Unmapped IRQ read %d\n", cpu_get_pc(space->cpu), offset);
return 0;
}
static WRITE16_HANDLER( cninja_irq_w )
{
switch (offset) {
cninja_state *state = (cninja_state *)space->machine->driver_data;
switch (offset)
{
case 0:
/* IRQ enable:
0xca: Raster IRQ turned off
0xc8: Raster IRQ turned on (68k IRQ level 4)
0xd8: Raster IRQ turned on (68k IRQ level 3)
*/
logerror("%08x: IRQ write %d %08x\n",cpu_get_pc(space->cpu),offset,data);
cninja_irq_mask=data&0xff;
logerror("%08x: IRQ write %d %08x\n", cpu_get_pc(space->cpu), offset, data);
state->irq_mask = data & 0xff;
return;
case 1: /* Raster IRQ scanline position, only valid for values between 1 & 239 (0 and 240-256 do NOT generate IRQ's) */
cninja_scanline=data&0xff;
if ((cninja_irq_mask&0x2)==0 && cninja_scanline>0 && cninja_scanline<240)
{
timer_device_adjust_oneshot(raster_irq_timer, video_screen_get_time_until_pos(space->machine->primary_screen, cninja_scanline, 0), cninja_scanline);
}
state->scanline = data & 0xff;
if (!BIT(state->irq_mask, 1) && state->scanline > 0 && state->scanline < 240)
timer_device_adjust_oneshot(state->raster_irq_timer, video_screen_get_time_until_pos(space->machine->primary_screen, state->scanline, 0), state->scanline);
else
timer_device_adjust_oneshot(raster_irq_timer,attotime_never,0);
timer_device_adjust_oneshot(state->raster_irq_timer, attotime_never, 0);
return;
case 2: /* VBL irq ack */
return;
}
logerror("%08x: Unmapped IRQ write %d %04x\n",cpu_get_pc(space->cpu),offset,data);
logerror("%08x: Unmapped IRQ write %d %04x\n", cpu_get_pc(space->cpu), offset, data);
}
static READ16_HANDLER( robocop2_prot_r )
{
switch (offset<<1) {
switch (offset << 1)
{
case 0x41a: /* Player 1 & 2 input ports */
return input_port_read(space->machine, "IN0");
case 0x320: /* Coins */
@ -133,27 +140,27 @@ static READ16_HANDLER( robocop2_prot_r )
case 0x4e6: /* Dip switches */
return input_port_read(space->machine, "DSW");
case 0x504: /* PC: 6b6. b4, 2c, 36 written before read */
logerror("Protection PC %06x: warning - read unmapped memory address %04x\n",cpu_get_pc(space->cpu),offset);
logerror("Protection PC %06x: warning - read unmapped memory address %04x\n", cpu_get_pc(space->cpu), offset);
return 0x84;
}
logerror("Protection PC %06x: warning - read unmapped memory address %04x\n",cpu_get_pc(space->cpu),offset);
logerror("Protection PC %06x: warning - read unmapped memory address %04x\n", cpu_get_pc(space->cpu), offset);
return 0;
}
/**********************************************************************************/
static WRITE16_HANDLER( deco16_pf12_control_w )
static WRITE16_HANDLER( cninja_pf12_control_w )
{
running_device *deco16ic = devtag_get_device(space->machine, "deco_custom");
deco16ic_pf12_control_w(deco16ic, offset, data, mem_mask);
cninja_state *state = (cninja_state *)space->machine->driver_data;
deco16ic_pf12_control_w(state->deco16ic, offset, data, mem_mask);
video_screen_update_partial(space->machine->primary_screen, video_screen_get_vpos(space->machine->primary_screen));
}
static WRITE16_HANDLER( deco16_pf34_control_w )
static WRITE16_HANDLER( cninja_pf34_control_w )
{
running_device *deco16ic = devtag_get_device(space->machine, "deco_custom");
deco16ic_pf34_control_w(deco16ic, offset, data, mem_mask);
cninja_state *state = (cninja_state *)space->machine->driver_data;
deco16ic_pf34_control_w(state->deco16ic, offset, data, mem_mask);
video_screen_update_partial(space->machine->primary_screen, video_screen_get_vpos(space->machine->primary_screen));
}
@ -161,23 +168,23 @@ static WRITE16_HANDLER( deco16_pf34_control_w )
static ADDRESS_MAP_START( cninja_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x0bffff) AM_ROM
AM_RANGE(0x140000, 0x14000f) AM_WRITE(deco16_pf12_control_w)
AM_RANGE(0x140000, 0x14000f) AM_WRITE(cninja_pf12_control_w)
AM_RANGE(0x144000, 0x144fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf1_data_r, deco16ic_pf1_data_w)
AM_RANGE(0x146000, 0x146fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf2_data_r, deco16ic_pf2_data_w)
AM_RANGE(0x14c000, 0x14c7ff) AM_WRITEONLY AM_BASE(&cninja_pf1_rowscroll)
AM_RANGE(0x14e000, 0x14e7ff) AM_RAM AM_BASE(&cninja_pf2_rowscroll)
AM_RANGE(0x14c000, 0x14c7ff) AM_WRITEONLY AM_BASE_MEMBER(cninja_state, pf1_rowscroll)
AM_RANGE(0x14e000, 0x14e7ff) AM_RAM AM_BASE_MEMBER(cninja_state, pf2_rowscroll)
AM_RANGE(0x150000, 0x15000f) AM_WRITE(deco16_pf34_control_w)
AM_RANGE(0x150000, 0x15000f) AM_WRITE(cninja_pf34_control_w)
AM_RANGE(0x154000, 0x154fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf3_data_r, deco16ic_pf3_data_w)
AM_RANGE(0x156000, 0x156fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf4_data_r, deco16ic_pf4_data_w)
AM_RANGE(0x15c000, 0x15c7ff) AM_RAM AM_BASE(&cninja_pf3_rowscroll)
AM_RANGE(0x15e000, 0x15e7ff) AM_RAM AM_BASE(&cninja_pf4_rowscroll)
AM_RANGE(0x15c000, 0x15c7ff) AM_RAM AM_BASE_MEMBER(cninja_state, pf3_rowscroll)
AM_RANGE(0x15e000, 0x15e7ff) AM_RAM AM_BASE_MEMBER(cninja_state, pf4_rowscroll)
AM_RANGE(0x184000, 0x187fff) AM_RAM AM_BASE(&cninja_ram)
AM_RANGE(0x184000, 0x187fff) AM_RAM AM_BASE_MEMBER(cninja_state, ram)
AM_RANGE(0x190000, 0x190007) AM_READWRITE(cninja_irq_r, cninja_irq_w)
AM_RANGE(0x19c000, 0x19dfff) AM_RAM_DEVWRITE("deco_custom", deco16ic_nonbuffered_palette_w) AM_BASE_GENERIC(paletteram)
AM_RANGE(0x1a4000, 0x1a47ff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) /* Sprites */
AM_RANGE(0x1a4000, 0x1a47ff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) /* Sprites */
AM_RANGE(0x1b4000, 0x1b4001) AM_WRITE(buffer_spriteram16_w) /* DMA flag */
AM_RANGE(0x1bc000, 0x1bc0ff) AM_WRITE(deco16_104_cninja_prot_w) AM_BASE(&deco16_prot_ram) /* Protection writes */
AM_RANGE(0x1bc000, 0x1bcfff) AM_READ(deco16_104_cninja_prot_r) AM_BASE(&deco16_prot_ram) /* Protection device */
@ -195,17 +202,17 @@ static ADDRESS_MAP_START( cninjabl_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x138000, 0x1387ff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) /* bootleg sprite-ram (sprites rewritten here in new format) */
AM_RANGE(0x140000, 0x14000f) AM_WRITE(deco16_pf12_control_w)
AM_RANGE(0x140000, 0x14000f) AM_WRITE(cninja_pf12_control_w)
AM_RANGE(0x144000, 0x144fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf1_data_r, deco16ic_pf1_data_w)
AM_RANGE(0x146000, 0x146fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf2_data_r, deco16ic_pf2_data_w)
AM_RANGE(0x14c000, 0x14c7ff) AM_WRITEONLY AM_BASE(&cninja_pf1_rowscroll)
AM_RANGE(0x14e000, 0x14e7ff) AM_RAM AM_BASE(&cninja_pf2_rowscroll)
AM_RANGE(0x14c000, 0x14c7ff) AM_WRITEONLY AM_BASE_MEMBER(cninja_state, pf1_rowscroll)
AM_RANGE(0x14e000, 0x14e7ff) AM_RAM AM_BASE_MEMBER(cninja_state, pf2_rowscroll)
AM_RANGE(0x150000, 0x15000f) AM_WRITE(deco16_pf34_control_w) // not used / incorrect on this
AM_RANGE(0x150000, 0x15000f) AM_WRITE(cninja_pf34_control_w) // not used / incorrect on this
AM_RANGE(0x154000, 0x154fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf3_data_r, deco16ic_pf3_data_w)
AM_RANGE(0x156000, 0x156fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf4_data_r, deco16ic_pf4_data_w)
AM_RANGE(0x15c000, 0x15c7ff) AM_RAM AM_BASE(&cninja_pf3_rowscroll)
AM_RANGE(0x15e000, 0x15e7ff) AM_RAM AM_BASE(&cninja_pf4_rowscroll)
AM_RANGE(0x15c000, 0x15c7ff) AM_RAM AM_BASE_MEMBER(cninja_state, pf3_rowscroll)
AM_RANGE(0x15e000, 0x15e7ff) AM_RAM AM_BASE_MEMBER(cninja_state, pf4_rowscroll)
AM_RANGE(0x17ff22, 0x17ff23) AM_READ_PORT("DSW")
AM_RANGE(0x17ff28, 0x17ff29) AM_READ_PORT("IN1")
@ -223,20 +230,20 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( edrandy_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x0fffff) AM_ROM
AM_RANGE(0x140000, 0x14000f) AM_WRITE(deco16_pf12_control_w)
AM_RANGE(0x140000, 0x14000f) AM_WRITE(cninja_pf12_control_w)
AM_RANGE(0x144000, 0x144fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf1_data_r, deco16ic_pf1_data_w)
AM_RANGE(0x146000, 0x146fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf2_data_r, deco16ic_pf2_data_w)
AM_RANGE(0x14c000, 0x14c7ff) AM_RAM AM_BASE(&cninja_pf1_rowscroll)
AM_RANGE(0x14e000, 0x14e7ff) AM_RAM AM_BASE(&cninja_pf2_rowscroll)
AM_RANGE(0x14c000, 0x14c7ff) AM_RAM AM_BASE_MEMBER(cninja_state, pf1_rowscroll)
AM_RANGE(0x14e000, 0x14e7ff) AM_RAM AM_BASE_MEMBER(cninja_state, pf2_rowscroll)
AM_RANGE(0x150000, 0x15000f) AM_WRITE(deco16_pf34_control_w)
AM_RANGE(0x150000, 0x15000f) AM_WRITE(cninja_pf34_control_w)
AM_RANGE(0x154000, 0x154fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf3_data_r, deco16ic_pf3_data_w)
AM_RANGE(0x156000, 0x156fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf4_data_r, deco16ic_pf4_data_w)
AM_RANGE(0x15c000, 0x15c7ff) AM_RAM AM_BASE(&cninja_pf3_rowscroll)
AM_RANGE(0x15e000, 0x15e7ff) AM_RAM AM_BASE(&cninja_pf4_rowscroll)
AM_RANGE(0x15c000, 0x15c7ff) AM_RAM AM_BASE_MEMBER(cninja_state, pf3_rowscroll)
AM_RANGE(0x15e000, 0x15e7ff) AM_RAM AM_BASE_MEMBER(cninja_state, pf4_rowscroll)
AM_RANGE(0x188000, 0x189fff) AM_RAM_DEVWRITE("deco_custom", deco16ic_nonbuffered_palette_w) AM_BASE_GENERIC(paletteram)
AM_RANGE(0x194000, 0x197fff) AM_RAM AM_BASE(&cninja_ram) /* Main ram */
AM_RANGE(0x194000, 0x197fff) AM_RAM AM_BASE_MEMBER(cninja_state, ram) /* Main ram */
AM_RANGE(0x198000, 0x1987ff) AM_READWRITE(deco16_60_prot_r, deco16_60_prot_w) AM_BASE(&deco16_prot_ram) /* Protection device */
AM_RANGE(0x199550, 0x199551) AM_WRITENOP /* Looks like a bug in game code, a protection write is referenced off a5 instead of a6 and ends up here */
AM_RANGE(0x199750, 0x199751) AM_WRITENOP /* Looks like a bug in game code, a protection write is referenced off a5 instead of a6 and ends up here */
@ -251,17 +258,17 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( robocop2_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x0fffff) AM_ROM
AM_RANGE(0x140000, 0x14000f) AM_WRITE(deco16_pf12_control_w)
AM_RANGE(0x140000, 0x14000f) AM_WRITE(cninja_pf12_control_w)
AM_RANGE(0x144000, 0x144fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf1_data_r, deco16ic_pf1_data_w)
AM_RANGE(0x146000, 0x146fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf2_data_r, deco16ic_pf2_data_w)
AM_RANGE(0x14c000, 0x14c7ff) AM_RAM AM_BASE(&cninja_pf1_rowscroll)
AM_RANGE(0x14e000, 0x14e7ff) AM_RAM AM_BASE(&cninja_pf2_rowscroll)
AM_RANGE(0x14c000, 0x14c7ff) AM_RAM AM_BASE_MEMBER(cninja_state, pf1_rowscroll)
AM_RANGE(0x14e000, 0x14e7ff) AM_RAM AM_BASE_MEMBER(cninja_state, pf2_rowscroll)
AM_RANGE(0x150000, 0x15000f) AM_WRITE(deco16_pf34_control_w)
AM_RANGE(0x150000, 0x15000f) AM_WRITE(cninja_pf34_control_w)
AM_RANGE(0x154000, 0x154fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf3_data_r, deco16ic_pf3_data_w)
AM_RANGE(0x156000, 0x156fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf4_data_r, deco16ic_pf4_data_w)
AM_RANGE(0x15c000, 0x15c7ff) AM_RAM AM_BASE(&cninja_pf3_rowscroll)
AM_RANGE(0x15e000, 0x15e7ff) AM_RAM AM_BASE(&cninja_pf4_rowscroll)
AM_RANGE(0x15c000, 0x15c7ff) AM_RAM AM_BASE_MEMBER(cninja_state, pf3_rowscroll)
AM_RANGE(0x15e000, 0x15e7ff) AM_RAM AM_BASE_MEMBER(cninja_state, pf4_rowscroll)
AM_RANGE(0x180000, 0x1807ff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
// AM_RANGE(0x18c000, 0x18c0ff) AM_WRITE(cninja_loopback_w) /* Protection writes */
@ -270,7 +277,7 @@ static ADDRESS_MAP_START( robocop2_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x198000, 0x198001) AM_WRITE(buffer_spriteram16_w) /* DMA flag */
AM_RANGE(0x1a8000, 0x1a9fff) AM_RAM_DEVWRITE("deco_custom", deco16ic_nonbuffered_palette_w) AM_BASE_GENERIC(paletteram)
AM_RANGE(0x1b0000, 0x1b0007) AM_READWRITE(cninja_irq_r, cninja_irq_w)
AM_RANGE(0x1b8000, 0x1bbfff) AM_RAM AM_BASE(&cninja_ram) /* Main ram */
AM_RANGE(0x1b8000, 0x1bbfff) AM_RAM AM_BASE_MEMBER(cninja_state, ram) /* Main ram */
AM_RANGE(0x1f0000, 0x1f0001) AM_DEVWRITE("deco_custom", deco16ic_priority_w)
AM_RANGE(0x1f8000, 0x1f8001) AM_READ_PORT("DSW3") /* Dipswitch #3 */
ADDRESS_MAP_END
@ -287,17 +294,17 @@ static ADDRESS_MAP_START( mutantf_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x1c0000, 0x1c0001) AM_WRITE(buffer_spriteram16_w) AM_DEVREAD("deco_custom", deco16ic_71_r)
AM_RANGE(0x1e0000, 0x1e0001) AM_WRITE(buffer_spriteram16_2_w)
AM_RANGE(0x300000, 0x30000f) AM_WRITE(deco16_pf12_control_w)
AM_RANGE(0x300000, 0x30000f) AM_WRITE(cninja_pf12_control_w)
AM_RANGE(0x304000, 0x305fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf1_data_r, deco16ic_pf1_data_w)
AM_RANGE(0x306000, 0x307fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf2_data_r, deco16ic_pf2_data_w)
AM_RANGE(0x308000, 0x3087ff) AM_RAM AM_BASE(&cninja_pf1_rowscroll)
AM_RANGE(0x30a000, 0x30a7ff) AM_RAM AM_BASE(&cninja_pf2_rowscroll)
AM_RANGE(0x308000, 0x3087ff) AM_RAM AM_BASE_MEMBER(cninja_state, pf1_rowscroll)
AM_RANGE(0x30a000, 0x30a7ff) AM_RAM AM_BASE_MEMBER(cninja_state, pf2_rowscroll)
AM_RANGE(0x310000, 0x31000f) AM_WRITE(deco16_pf34_control_w)
AM_RANGE(0x310000, 0x31000f) AM_WRITE(cninja_pf34_control_w)
AM_RANGE(0x314000, 0x315fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf3_data_r, deco16ic_pf3_data_w)
AM_RANGE(0x316000, 0x317fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf4_data_r, deco16ic_pf4_data_w)
AM_RANGE(0x318000, 0x3187ff) AM_RAM AM_BASE(&cninja_pf3_rowscroll)
AM_RANGE(0x31a000, 0x31a7ff) AM_RAM AM_BASE(&cninja_pf4_rowscroll)
AM_RANGE(0x318000, 0x3187ff) AM_RAM AM_BASE_MEMBER(cninja_state, pf3_rowscroll)
AM_RANGE(0x31a000, 0x31a7ff) AM_RAM AM_BASE_MEMBER(cninja_state, pf4_rowscroll)
AM_RANGE(0xad00ac, 0xad00ff) AM_READNOP /* Reads from here seem to be a game code bug */
ADDRESS_MAP_END
@ -712,27 +719,24 @@ GFXDECODE_END
/**********************************************************************************/
static MACHINE_RESET( cninja )
{
raster_irq_timer = devtag_get_device(machine, "raster_timer");
cninja_scanline=0;
cninja_irq_mask=0;
}
static void sound_irq(running_device *device, int state)
{
cputag_set_input_line(device->machine, "audiocpu", 1, state); /* IRQ 2 */
cninja_state *driver_state = (cninja_state *)device->machine->driver_data;
cpu_set_input_line(driver_state->audiocpu, 1, state); /* IRQ 2 */
}
static void sound_irq2(running_device *device, int state)
{
cputag_set_input_line(device->machine, "audiocpu", 0, state);
cninja_state *driver_state = (cninja_state *)device->machine->driver_data;
cpu_set_input_line(driver_state->audiocpu, 0, state);
}
static WRITE8_DEVICE_HANDLER( sound_bankswitch_w )
{
cninja_state *state = (cninja_state *)device->machine->driver_data;
/* the second OKIM6295 ROM is bank switched */
okim6295_set_bank_base(devtag_get_device(device->machine, "oki2"), (data & 1) * 0x40000);
okim6295_set_bank_base(state->oki2, (data & 1) * 0x40000);
}
static const ym2151_interface ym2151_config =
@ -822,8 +826,33 @@ static const deco16ic_interface mutantf_deco16ic_intf =
mutantf_1_bank_callback
};
static MACHINE_START( cninja )
{
cninja_state *state = (cninja_state *)machine->driver_data;
state->maincpu = devtag_get_device(machine, "maincpu");
state->audiocpu = devtag_get_device(machine, "audiocpu");
state->deco16ic = devtag_get_device(machine, "deco_custom");
state->raster_irq_timer = devtag_get_device(machine, "raster_timer");
state->oki2 = devtag_get_device(machine, "oki2");
state_save_register_global(machine, state->scanline);
state_save_register_global(machine, state->irq_mask);
}
static MACHINE_RESET( cninja )
{
cninja_state *state = (cninja_state *)machine->driver_data;
state->scanline = 0;
state->irq_mask = 0;
}
static MACHINE_DRIVER_START( cninja )
/* driver data */
MDRV_DRIVER_DATA(cninja_state)
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", M68000, 12000000)
MDRV_CPU_PROGRAM_MAP(cninja_map)
@ -832,6 +861,7 @@ static MACHINE_DRIVER_START( cninja )
MDRV_CPU_ADD("audiocpu", H6280,32220000/8) /* Accurate */
MDRV_CPU_PROGRAM_MAP(sound_map)
MDRV_MACHINE_START(cninja)
MDRV_MACHINE_RESET(cninja)
MDRV_TIMER_ADD("raster_timer", interrupt_gen)
@ -874,6 +904,9 @@ MACHINE_DRIVER_END
static MACHINE_DRIVER_START( stoneage )
/* driver data */
MDRV_DRIVER_DATA(cninja_state)
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", M68000, 12000000)
MDRV_CPU_PROGRAM_MAP(cninja_map)
@ -882,6 +915,7 @@ static MACHINE_DRIVER_START( stoneage )
MDRV_CPU_ADD("audiocpu", Z80, 3579545)
MDRV_CPU_PROGRAM_MAP(stoneage_s_map)
MDRV_MACHINE_START(cninja)
MDRV_MACHINE_RESET(cninja)
MDRV_TIMER_ADD("raster_timer", interrupt_gen)
@ -923,6 +957,9 @@ MACHINE_DRIVER_END
static MACHINE_DRIVER_START( cninjabl )
/* driver data */
MDRV_DRIVER_DATA(cninja_state)
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", M68000, 12000000)
MDRV_CPU_PROGRAM_MAP(cninjabl_map)
@ -931,6 +968,7 @@ static MACHINE_DRIVER_START( cninjabl )
MDRV_CPU_ADD("audiocpu", Z80, 3579545)
MDRV_CPU_PROGRAM_MAP(stoneage_s_map)
MDRV_MACHINE_START(cninja)
MDRV_MACHINE_RESET(cninja)
MDRV_TIMER_ADD("raster_timer", interrupt_gen)
@ -967,6 +1005,9 @@ MACHINE_DRIVER_END
static MACHINE_DRIVER_START( edrandy )
/* driver data */
MDRV_DRIVER_DATA(cninja_state)
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", M68000, 12000000)
MDRV_CPU_PROGRAM_MAP(edrandy_map)
@ -975,6 +1016,7 @@ static MACHINE_DRIVER_START( edrandy )
MDRV_CPU_ADD("audiocpu", H6280,32220000/8) /* Accurate */
MDRV_CPU_PROGRAM_MAP(sound_map)
MDRV_MACHINE_START(cninja)
MDRV_MACHINE_RESET(cninja)
MDRV_TIMER_ADD("raster_timer", interrupt_gen)
@ -1017,6 +1059,9 @@ MACHINE_DRIVER_END
static MACHINE_DRIVER_START( robocop2 )
/* driver data */
MDRV_DRIVER_DATA(cninja_state)
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", M68000, 14000000)
MDRV_CPU_PROGRAM_MAP(robocop2_map)
@ -1025,6 +1070,7 @@ static MACHINE_DRIVER_START( robocop2 )
MDRV_CPU_ADD("audiocpu", H6280,32220000/8) /* Accurate */
MDRV_CPU_PROGRAM_MAP(sound_map)
MDRV_MACHINE_START(cninja)
MDRV_MACHINE_RESET(cninja)
MDRV_TIMER_ADD("raster_timer", interrupt_gen)
@ -1070,6 +1116,9 @@ MACHINE_DRIVER_END
static MACHINE_DRIVER_START( mutantf )
/* driver data */
MDRV_DRIVER_DATA(cninja_state)
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", M68000, 14000000)
MDRV_CPU_PROGRAM_MAP(mutantf_map)
@ -1078,6 +1127,9 @@ static MACHINE_DRIVER_START( mutantf )
MDRV_CPU_ADD("audiocpu", H6280,32220000/8)
MDRV_CPU_PROGRAM_MAP(sound_map_mutantf)
MDRV_MACHINE_START(cninja)
MDRV_MACHINE_RESET(cninja)
/* video hardware */
MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM )
@ -1876,24 +1928,27 @@ ROM_END
/**********************************************************************************/
static void cninja_patch(running_machine *machine)
static void cninja_patch( running_machine *machine )
{
UINT16 *RAM = (UINT16 *)memory_region(machine, "maincpu");
int i;
for (i=0; i<0x80000/2; i++) {
int aword=RAM[i];
for (i = 0; i < 0x80000 / 2; i++)
{
int aword = RAM[i];
if (aword==0x66ff || aword==0x67ff) {
UINT16 doublecheck=RAM[i-4];
if (aword == 0x66ff || aword == 0x67ff)
{
UINT16 doublecheck = RAM[i - 4];
/* Cmpi + btst controlling opcodes */
if (doublecheck==0xc39 || doublecheck==0x839) {
RAM[i]=0x4E71;
RAM[i-1]=0x4E71;
RAM[i-2]=0x4E71;
RAM[i-3]=0x4E71;
RAM[i-4]=0x4E71;
if (doublecheck == 0xc39 || doublecheck == 0x839)
{
RAM[i] = 0x4e71;
RAM[i - 1] = 0x4e71;
RAM[i - 2] = 0x4e71;
RAM[i - 3] = 0x4e71;
RAM[i - 4] = 0x4e71;
}
}
}
@ -1918,9 +1973,9 @@ static DRIVER_INIT( mutantf )
UINT8 *dst = memory_region(machine, "gfx1");
/* The 16x16 graphic has some 8x8 chars in it - decode them in GFX1 */
memcpy(dst+0x50000,dst+0x10000,0x10000);
memcpy(dst+0x10000,src,0x40000);
memcpy(dst+0x60000,src+0x40000,0x40000);
memcpy(dst + 0x50000, dst + 0x10000, 0x10000);
memcpy(dst + 0x10000, src, 0x40000);
memcpy(dst + 0x60000, src + 0x40000, 0x40000);
deco56_decrypt_gfx(machine, "gfx1");
deco56_decrypt_gfx(machine, "gfx2");
@ -1928,20 +1983,20 @@ static DRIVER_INIT( mutantf )
/**********************************************************************************/
GAME( 1990, edrandy, 0, edrandy, edrandy, 0, ROT0, "Data East Corporation", "The Cliffhanger - Edward Randy (World ver 3)", 0 )
GAME( 1990, edrandy2, edrandy, edrandy, edrandc, 0, ROT0, "Data East Corporation", "The Cliffhanger - Edward Randy (World ver 2)", 0 )
GAME( 1990, edrandy1, edrandy, edrandy, edrandc, 0, ROT0, "Data East Corporation", "The Cliffhanger - Edward Randy (World ver 1)", 0 )
GAME( 1990, edrandyj, edrandy, edrandy, edrandc, 0, ROT0, "Data East Corporation", "The Cliffhanger - Edward Randy (Japan ver 3)", 0 )
GAME( 1991, cninja, 0, cninja, cninja, cninja, ROT0, "Data East Corporation", "Caveman Ninja (World ver 4)", 0 )
GAME( 1991, cninja1, cninja, cninja, cninja, cninja, ROT0, "Data East Corporation", "Caveman Ninja (World ver 1)", 0 )
GAME( 1991, cninjau, cninja, cninja, cninjau, cninja, ROT0, "Data East Corporation", "Caveman Ninja (US ver 4)", 0 )
GAME( 1991, joemac, cninja, cninja, cninja, cninja, ROT0, "Data East Corporation", "Tatakae Genshizin Joe & Mac (Japan ver 1)", 0 )
GAME( 1991, stoneage, cninja, stoneage, cninja, stoneage, ROT0, "bootleg", "Stoneage (bootleg of Caveman Ninja)", 0 )
GAME( 1991, cninjabl, cninja, cninjabl, cninja, 0, ROT0, "bootleg", "Caveman Ninja (bootleg)", GAME_NOT_WORKING )
GAME( 1991, robocop2, 0, robocop2, robocop2,0, ROT0, "Data East Corporation", "Robocop 2 (Euro/Asia v0.10)", 0 )
GAME( 1991, robocop2u,robocop2,robocop2, robocop2,0, ROT0, "Data East Corporation", "Robocop 2 (US v0.05)", 0 )
GAME( 1991, robocop2j,robocop2,robocop2, robocop2,0, ROT0, "Data East Corporation", "Robocop 2 (Japan v0.11)", 0 )
GAME( 1992, mutantf, 0, mutantf, mutantf, mutantf, ROT0, "Data East Corporation", "Mutant Fighter (World ver EM-5)", 0 )
GAME( 1992, mutantf4, mutantf, mutantf, mutantf, mutantf, ROT0, "Data East Corporation", "Mutant Fighter (World ver EM-4)", 0 )
GAME( 1992, mutantf3, mutantf, mutantf, mutantf, mutantf, ROT0, "Data East Corporation", "Mutant Fighter (World ver EM-3)", 0 )
GAME( 1992, deathbrd, mutantf, mutantf, mutantf, mutantf, ROT0, "Data East Corporation", "Death Brade (Japan ver JM-3)", 0 )
GAME( 1990, edrandy, 0, edrandy, edrandy, 0, ROT0, "Data East Corporation", "The Cliffhanger - Edward Randy (World ver 3)", GAME_SUPPORTS_SAVE )
GAME( 1990, edrandy2, edrandy, edrandy, edrandc, 0, ROT0, "Data East Corporation", "The Cliffhanger - Edward Randy (World ver 2)", GAME_SUPPORTS_SAVE )
GAME( 1990, edrandy1, edrandy, edrandy, edrandc, 0, ROT0, "Data East Corporation", "The Cliffhanger - Edward Randy (World ver 1)", GAME_SUPPORTS_SAVE )
GAME( 1990, edrandyj, edrandy, edrandy, edrandc, 0, ROT0, "Data East Corporation", "The Cliffhanger - Edward Randy (Japan ver 3)", GAME_SUPPORTS_SAVE )
GAME( 1991, cninja, 0, cninja, cninja, cninja, ROT0, "Data East Corporation", "Caveman Ninja (World ver 4)", GAME_SUPPORTS_SAVE )
GAME( 1991, cninja1, cninja, cninja, cninja, cninja, ROT0, "Data East Corporation", "Caveman Ninja (World ver 1)", GAME_SUPPORTS_SAVE )
GAME( 1991, cninjau, cninja, cninja, cninjau, cninja, ROT0, "Data East Corporation", "Caveman Ninja (US ver 4)", GAME_SUPPORTS_SAVE )
GAME( 1991, joemac, cninja, cninja, cninja, cninja, ROT0, "Data East Corporation", "Tatakae Genshizin Joe & Mac (Japan ver 1)", GAME_SUPPORTS_SAVE )
GAME( 1991, stoneage, cninja, stoneage, cninja, stoneage, ROT0, "bootleg", "Stoneage (bootleg of Caveman Ninja)", GAME_SUPPORTS_SAVE )
GAME( 1991, cninjabl, cninja, cninjabl, cninja, 0, ROT0, "bootleg", "Caveman Ninja (bootleg)", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )
GAME( 1991, robocop2, 0, robocop2, robocop2,0, ROT0, "Data East Corporation", "Robocop 2 (Euro/Asia v0.10)", GAME_SUPPORTS_SAVE )
GAME( 1991, robocop2u,robocop2,robocop2, robocop2,0, ROT0, "Data East Corporation", "Robocop 2 (US v0.05)", GAME_SUPPORTS_SAVE )
GAME( 1991, robocop2j,robocop2,robocop2, robocop2,0, ROT0, "Data East Corporation", "Robocop 2 (Japan v0.11)", GAME_SUPPORTS_SAVE )
GAME( 1992, mutantf, 0, mutantf, mutantf, mutantf, ROT0, "Data East Corporation", "Mutant Fighter (World ver EM-5)", GAME_SUPPORTS_SAVE )
GAME( 1992, mutantf4, mutantf, mutantf, mutantf, mutantf, ROT0, "Data East Corporation", "Mutant Fighter (World ver EM-4)", GAME_SUPPORTS_SAVE )
GAME( 1992, mutantf3, mutantf, mutantf, mutantf, mutantf, ROT0, "Data East Corporation", "Mutant Fighter (World ver EM-3)", GAME_SUPPORTS_SAVE )
GAME( 1992, deathbrd, mutantf, mutantf, mutantf, mutantf, ROT0, "Data East Corporation", "Death Brade (Japan ver JM-3)", GAME_SUPPORTS_SAVE )

View File

@ -124,16 +124,12 @@ Dip locations verified with US conversion kit manual.
#include "emu.h"
#include "cpu/m68000/m68000.h"
#include "cpu/h6280/h6280.h"
#include "includes/dassault.h"
#include "sound/2203intf.h"
#include "sound/2151intf.h"
#include "sound/okim6295.h"
#include "video/deco16ic.h"
extern UINT16 *dassault_pf2_rowscroll,*dassault_pf4_rowscroll;
VIDEO_UPDATE( dassault );
static UINT16 *dassault_ram,*shared_ram,*dassault_ram2;
/**********************************************************************************/
@ -174,39 +170,45 @@ static READ16_HANDLER( dassault_sub_control_r )
static WRITE16_HANDLER( dassault_sound_w )
{
dassault_state *state = (dassault_state *)space->machine->driver_data;
soundlatch_w(space, 0, data & 0xff);
cputag_set_input_line(space->machine, "audiocpu", 0, HOLD_LINE); /* IRQ1 */
cpu_set_input_line(state->audiocpu, 0, HOLD_LINE); /* IRQ1 */
}
/* The CPU-CPU irq controller is overlaid onto the end of the shared memory */
static READ16_HANDLER( dassault_irq_r )
{
switch (offset) {
case 0: cputag_set_input_line(space->machine, "maincpu", 5, CLEAR_LINE); break;
case 1: cputag_set_input_line(space->machine, "sub", 6, CLEAR_LINE); break;
dassault_state *state = (dassault_state *)space->machine->driver_data;
switch (offset)
{
case 0: cpu_set_input_line(state->maincpu, 5, CLEAR_LINE); break;
case 1: cpu_set_input_line(state->subcpu, 6, CLEAR_LINE); break;
}
return shared_ram[(0xffc/2)+offset]; /* The values probably don't matter */
return state->shared_ram[(0xffc / 2) + offset]; /* The values probably don't matter */
}
static WRITE16_HANDLER( dassault_irq_w )
{
dassault_state *state = (dassault_state *)space->machine->driver_data;
switch (offset)
{
case 0: cputag_set_input_line(space->machine, "maincpu", 5, ASSERT_LINE); break;
case 1: cputag_set_input_line(space->machine, "sub", 6, ASSERT_LINE); break;
case 0: cpu_set_input_line(state->maincpu, 5, ASSERT_LINE); break;
case 1: cpu_set_input_line(state->subcpu, 6, ASSERT_LINE); break;
}
COMBINE_DATA(&shared_ram[(0xffc / 2) + offset]); /* The values probably don't matter */
COMBINE_DATA(&state->shared_ram[(0xffc / 2) + offset]); /* The values probably don't matter */
}
static WRITE16_HANDLER( shared_ram_w )
{
COMBINE_DATA(&shared_ram[offset]);
dassault_state *state = (dassault_state *)space->machine->driver_data;
COMBINE_DATA(&state->shared_ram[offset]);
}
static READ16_HANDLER( shared_ram_r )
{
return shared_ram[offset];
dassault_state *state = (dassault_state *)space->machine->driver_data;
return state->shared_ram[offset];
}
/**********************************************************************************/
@ -226,18 +228,18 @@ static ADDRESS_MAP_START( dassault_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x200000, 0x201fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf1_data_r, deco16ic_pf1_data_w)
AM_RANGE(0x202000, 0x203fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf2_data_r, deco16ic_pf2_data_w)
AM_RANGE(0x212000, 0x212fff) AM_WRITEONLY AM_BASE(&dassault_pf2_rowscroll)
AM_RANGE(0x212000, 0x212fff) AM_WRITEONLY AM_BASE_MEMBER(dassault_state, pf2_rowscroll)
AM_RANGE(0x220000, 0x22000f) AM_DEVWRITE("deco_custom", deco16ic_pf12_control_w)
AM_RANGE(0x240000, 0x240fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf3_data_r, deco16ic_pf3_data_w)
AM_RANGE(0x242000, 0x242fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf4_data_r, deco16ic_pf4_data_w)
AM_RANGE(0x252000, 0x252fff) AM_WRITEONLY AM_BASE(&dassault_pf4_rowscroll)
AM_RANGE(0x252000, 0x252fff) AM_WRITEONLY AM_BASE_MEMBER(dassault_state, pf4_rowscroll)
AM_RANGE(0x260000, 0x26000f) AM_DEVWRITE("deco_custom", deco16ic_pf34_control_w)
AM_RANGE(0x3f8000, 0x3fbfff) AM_RAM AM_BASE(&dassault_ram) /* Main ram */
AM_RANGE(0x3f8000, 0x3fbfff) AM_RAM AM_BASE_MEMBER(dassault_state, ram) /* Main ram */
AM_RANGE(0x3fc000, 0x3fcfff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram2) /* Spriteram (2nd) */
AM_RANGE(0x3feffc, 0x3fefff) AM_READWRITE(dassault_irq_r, dassault_irq_w)
AM_RANGE(0x3fe000, 0x3fefff) AM_READWRITE(shared_ram_r, shared_ram_w) AM_BASE(&shared_ram) /* Shared ram */
AM_RANGE(0x3fe000, 0x3fefff) AM_READWRITE(shared_ram_r, shared_ram_w) AM_BASE_MEMBER(dassault_state, shared_ram) /* Shared ram */
ADDRESS_MAP_END
static ADDRESS_MAP_START( dassault_sub_map, ADDRESS_SPACE_PROGRAM, 16 )
@ -247,7 +249,7 @@ static ADDRESS_MAP_START( dassault_sub_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x100002, 0x100007) AM_WRITENOP /* ? */
AM_RANGE(0x100004, 0x100005) AM_READ(dassault_sub_control_r)
AM_RANGE(0x3f8000, 0x3fbfff) AM_RAM AM_BASE(&dassault_ram2) /* Sub cpu ram */
AM_RANGE(0x3f8000, 0x3fbfff) AM_RAM AM_BASE_MEMBER(dassault_state, ram2) /* Sub cpu ram */
AM_RANGE(0x3fc000, 0x3fcfff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) /* Sprite ram */
AM_RANGE(0x3feffc, 0x3fefff) AM_READWRITE(dassault_irq_r, dassault_irq_w)
AM_RANGE(0x3fe000, 0x3fefff) AM_READWRITE(shared_ram_r, shared_ram_w)
@ -511,13 +513,16 @@ GFXDECODE_END
static void sound_irq(running_device *device, int state)
{
cputag_set_input_line(device->machine, "audiocpu", 1, state);
dassault_state *driver_state = (dassault_state *)device->machine->driver_data;
cpu_set_input_line(driver_state->audiocpu, 1, state);
}
static WRITE8_DEVICE_HANDLER( sound_bankswitch_w )
{
dassault_state *state = (dassault_state *)device->machine->driver_data;
/* the second OKIM6295 ROM is bank switched */
okim6295_set_bank_base(devtag_get_device(device->machine, "oki2"), (data & 1) * 0x40000);
okim6295_set_bank_base(state->oki2, (data & 1) * 0x40000);
}
static const ym2151_interface ym2151_config =
@ -546,8 +551,22 @@ static const deco16ic_interface dassault_deco16ic_intf =
dassault_bank_callback
};
static MACHINE_START( dassault )
{
dassault_state *state = (dassault_state *)machine->driver_data;
state->maincpu = devtag_get_device(machine, "maincpu");
state->audiocpu = devtag_get_device(machine, "audiocpu");
state->subcpu = devtag_get_device(machine, "sub");
state->deco16ic = devtag_get_device(machine, "deco_custom");
state->oki2 = devtag_get_device(machine, "oki2");
}
static MACHINE_DRIVER_START( dassault )
/* driver data */
MDRV_DRIVER_DATA(dassault_state)
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", M68000, 14000000) /* Accurate */
MDRV_CPU_PROGRAM_MAP(dassault_map)
@ -562,6 +581,8 @@ static MACHINE_DRIVER_START( dassault )
MDRV_QUANTUM_TIME(HZ(8400)) /* 140 CPU slices per frame */
MDRV_MACHINE_START(dassault)
/* video hardware */
MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
@ -806,9 +827,10 @@ ROM_END
static READ16_HANDLER( dassault_main_skip )
{
int ret=dassault_ram[0];
dassault_state *state = (dassault_state *)space->machine->driver_data;
int ret = state->ram[0];
if (cpu_get_previouspc(space->cpu)==0x1170 && ret&0x8000)
if (cpu_get_previouspc(space->cpu) == 0x1170 && ret & 0x8000)
cpu_spinuntil_int(space->cpu);
return ret;
@ -816,9 +838,10 @@ static READ16_HANDLER( dassault_main_skip )
static READ16_HANDLER( thndzone_main_skip )
{
int ret=dassault_ram[0];
dassault_state *state = (dassault_state *)space->machine->driver_data;
int ret = state->ram[0];
if (cpu_get_pc(space->cpu)==0x114c && ret&0x8000)
if (cpu_get_pc(space->cpu) == 0x114c && ret & 0x8000)
cpu_spinuntil_int(space->cpu);
return ret;
@ -833,10 +856,10 @@ static DRIVER_INIT( dassault )
/* Playfield 4 also has access to the char graphics, make things easier
by just copying the chars to both banks (if I just used a different gfx
bank then the colours would be wrong). */
memcpy(tmp+0x000000,dst+0x80000,0x80000);
memcpy(dst+0x090000,tmp+0x00000,0x80000);
memcpy(dst+0x080000,src+0x00000,0x10000);
memcpy(dst+0x110000,src+0x10000,0x10000);
memcpy(tmp + 0x000000, dst + 0x80000, 0x80000);
memcpy(dst + 0x090000, tmp + 0x00000, 0x80000);
memcpy(dst + 0x080000, src + 0x00000, 0x10000);
memcpy(dst + 0x110000, src + 0x10000, 0x10000);
auto_free(machine, tmp);
@ -853,10 +876,10 @@ static DRIVER_INIT( thndzone )
/* Playfield 4 also has access to the char graphics, make things easier
by just copying the chars to both banks (if I just used a different gfx
bank then the colours would be wrong). */
memcpy(tmp+0x000000,dst+0x80000,0x80000);
memcpy(dst+0x090000,tmp+0x00000,0x80000);
memcpy(dst+0x080000,src+0x00000,0x10000);
memcpy(dst+0x110000,src+0x10000,0x10000);
memcpy(tmp + 0x000000, dst + 0x80000, 0x80000);
memcpy(dst + 0x090000, tmp + 0x00000, 0x80000);
memcpy(dst + 0x080000, src + 0x00000, 0x10000);
memcpy(dst + 0x110000, src + 0x10000, 0x10000);
auto_free(machine, tmp);
@ -866,6 +889,6 @@ static DRIVER_INIT( thndzone )
/**********************************************************************************/
GAME( 1991, thndzone, 0, dassault, thndzone, thndzone, ROT0, "Data East Corporation", "Thunder Zone (World)", 0 )
GAME( 1991, dassault, thndzone, dassault, dassault, dassault, ROT0, "Data East Corporation", "Desert Assault (US)", 0 )
GAME( 1991, dassault4,thndzone, dassault, dassault4,dassault, ROT0, "Data East Corporation", "Desert Assault (US 4 Players)", 0 )
GAME( 1991, thndzone, 0, dassault, thndzone, thndzone, ROT0, "Data East Corporation", "Thunder Zone (World)", GAME_SUPPORTS_SAVE )
GAME( 1991, dassault, thndzone, dassault, dassault, dassault, ROT0, "Data East Corporation", "Desert Assault (US)", GAME_SUPPORTS_SAVE )
GAME( 1991, dassault4,thndzone, dassault, dassault4,dassault, ROT0, "Data East Corporation", "Desert Assault (US 4 Players)", GAME_SUPPORTS_SAVE )

View File

@ -25,6 +25,52 @@ Protection TODO:
#include "sound/okim6295.h"
#include "video/deco16ic.h"
class dblewing_state
{
public:
static void *alloc(running_machine &machine) { return auto_alloc_clear(&machine, dblewing_state(machine)); }
dblewing_state(running_machine &machine) { }
/* memory pointers */
UINT16 * pf1_rowscroll;
UINT16 * pf2_rowscroll;
UINT16 * spriteram;
size_t spriteram_size;
/* protection */
UINT16 _008_data;
UINT16 _104_data;
UINT16 _406_data;
UINT16 _608_data;
UINT16 _70c_data;
UINT16 _78a_data;
UINT16 _088_data;
UINT16 _58c_data;
UINT16 _408_data;
UINT16 _40e_data;
UINT16 _080_data;
UINT16 _788_data;
UINT16 _38e_data;
UINT16 _580_data;
UINT16 _60a_data;
UINT16 _200_data;
UINT16 _28c_data;
UINT16 _18a_data;
UINT16 _280_data;
UINT16 _384_data;
UINT16 boss_move, boss_shoot_type, boss_3_data, boss_4_data, boss_5_data ,boss_5sx_data, boss_6_data;
/* misc */
UINT8 sound_irq;
/* devices */
running_device *maincpu;
running_device *audiocpu;
running_device *deco16ic;
};
/*
offs +0
@ -55,34 +101,35 @@ x = xpos
*/
static UINT16 *dblewing_pf1_rowscroll,*dblewing_pf2_rowscroll;
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 )
{
UINT16 *spriteram16 = machine->generic.spriteram.u16;
dblewing_state *state = (dblewing_state *)machine->driver_data;
UINT16 *spriteram = state->spriteram;
int offs;
for (offs = 0x400-4;offs >= 0;offs -= 4)
for (offs = 0x400 - 4; offs >= 0; offs -= 4)
{
int x,y,sprite,colour,multi,mult2,fx,fy,inc,flash,mult,xsize,pri;
int x, y, sprite, colour, multi, mult2, fx, fy, inc, flash, mult, xsize, pri;
sprite = spriteram16[offs+1];
sprite = spriteram[offs + 1];
y = spriteram16[offs];
flash=y&0x1000;
xsize = y&0x0800;
if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue;
y = spriteram[offs];
flash = y & 0x1000;
xsize = y & 0x0800;
if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1))
continue;
x = spriteram16[offs+2];
colour = (x >>9) & 0x1f;
x = spriteram[offs + 2];
colour = (x >> 9) & 0x1f;
pri = (x&0xc000); // 2 bits or 1?
pri = (x & 0xc000); // 2 bits or 1?
switch (pri&0xc000) {
case 0x0000: pri=0; break;
case 0x4000: pri=0xf0; break;
case 0x8000: pri=0xf0|0xcc; break;
case 0xc000: pri=0xf0|0xcc; break; /* or 0xf0|0xcc|0xaa ? */
switch (pri & 0xc000)
{
case 0x0000: pri = 0; break;
case 0x4000: pri = 0xf0; break;
case 0x8000: pri = 0xf0 | 0xcc; break;
case 0xc000: pri = 0xf0 | 0xcc; break; /* or 0xf0|0xcc|0xaa ? */
}
fx = y & 0x2000;
@ -96,7 +143,8 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
y = 240 - y;
x = 304 - x;
if (x>320) continue;
if (x > 320)
continue;
sprite &= ~multi;
if (fy)
@ -109,15 +157,16 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
if (flip_screen_get(machine))
{
y=240-y;
x=304-x;
if (fx) fx=0; else fx=1;
if (fy) fy=0; else fy=1;
mult=16;
y = 240 - y;
x = 304 - x;
if (fx) fx = 0; else fx = 1;
if (fy) fy = 0; else fy = 1;
mult = 16;
}
else mult=-16;
else
mult = -16;
mult2 = multi+1;
mult2 = multi + 1;
while (multi >= 0)
{
@ -144,17 +193,17 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
static VIDEO_UPDATE(dblewing)
{
running_device *deco16ic = devtag_get_device(screen->machine, "deco_custom");
UINT16 flip = deco16ic_pf12_control_r(deco16ic, 0, 0xffff);
dblewing_state *state = (dblewing_state *)screen->machine->driver_data;
UINT16 flip = deco16ic_pf12_control_r(state->deco16ic, 0, 0xffff);
flip_screen_set(screen->machine, BIT(flip, 7));
deco16ic_pf12_update(deco16ic, dblewing_pf1_rowscroll, dblewing_pf2_rowscroll);
deco16ic_pf12_update(state->deco16ic, state->pf1_rowscroll, state->pf2_rowscroll);
bitmap_fill(bitmap, cliprect, 0); /* not Confirmed */
bitmap_fill(screen->machine->priority_bitmap, NULL, 0);
deco16ic_tilemap_2_draw(deco16ic, bitmap, cliprect, 0, 2);
deco16ic_tilemap_1_draw(deco16ic, bitmap, cliprect, 0, 4);
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, 0, 2);
deco16ic_tilemap_1_draw(state->deco16ic, bitmap, cliprect, 0, 4);
draw_sprites(screen->machine, bitmap, cliprect);
return 0;
}
@ -169,55 +218,32 @@ static VIDEO_UPDATE(dblewing)
we need to log the PC of each read/write and check to
see if the code makes any of them move obvious
*/
static UINT16 dblwings_008_data;
static UINT16 dblwings_104_data;
static UINT16 dblwings_406_data;
static UINT16 dblwings_608_data;
static UINT16 dblwings_70c_data;
static UINT16 dblwings_78a_data;
static UINT16 dblwings_088_data;
static UINT16 dblwings_58c_data;
static UINT16 dblwings_408_data;
static UINT16 dblwings_40e_data;
static UINT16 dblwings_080_data;
static UINT16 dblwings_788_data;
static UINT16 dblwings_38e_data;
static UINT16 dblwings_580_data;
static UINT16 dblwings_60a_data;
static UINT16 dblwings_200_data;
static UINT16 dblwings_28c_data;
static UINT16 dblwings_18a_data;
static UINT16 dblwings_280_data;
static UINT16 dblwings_384_data;
static UINT16 boss_move,boss_shoot_type,boss_3_data,boss_4_data,boss_5_data,boss_5sx_data,boss_6_data;
static UINT8 dblewing_sound_irq;
static READ16_HANDLER ( dlbewing_prot_r )
static READ16_HANDLER ( dblewing_prot_r )
{
switch(offset*2)
dblewing_state *state = (dblewing_state *)space->machine->driver_data;
switch (offset * 2)
{
case 0x16a: return boss_move; // boss 1 movement
case 0x6d6: return boss_move; // boss 1 2nd pilot
case 0x748: return boss_move; // boss 1 3rd pilot
case 0x16a: return state->boss_move; // boss 1 movement
case 0x6d6: return state->boss_move; // boss 1 2nd pilot
case 0x748: return state->boss_move; // boss 1 3rd pilot
case 0x566: return 0x0009; // boss BGM,might be a variable one (read->write to the sound latch)
case 0x1ea: return boss_shoot_type; // boss 1 shoot type
case 0x596: return boss_3_data; // boss 3 appearing
case 0x692: return boss_4_data;
case 0x6b0: return boss_5_data;
case 0x51e: return boss_5sx_data;
case 0x784: return boss_6_data;
case 0x1ea: return state->boss_shoot_type; // boss 1 shoot type
case 0x596: return state->boss_3_data; // boss 3 appearing
case 0x692: return state->boss_4_data;
case 0x6b0: return state->boss_5_data;
case 0x51e: return state->boss_5sx_data;
case 0x784: return state->boss_6_data;
case 0x330: return 0; // controls bonuses such as shoot type,bombs etc.
case 0x1d4: return dblwings_70c_data; //controls restart points
case 0x1d4: return state->_70c_data; //controls restart points
case 0x0ac: return (input_port_read(space->machine, "DSW") & 0x40)<<4;//flip screen
case 0x4b0: return dblwings_608_data;//coinage
case 0x0ac: return (input_port_read(space->machine, "DSW") & 0x40) << 4;//flip screen
case 0x4b0: return state->_608_data;//coinage
case 0x068:
{
switch(input_port_read(space->machine, "DSW") & 0x0300) //I don't know how to relationate this...
switch (input_port_read(space->machine, "DSW") & 0x0300) //I don't know how to relationate this...
{
case 0x0000: return 0x000;//0
case 0x0100: return 0x060;//3
@ -225,153 +251,155 @@ static READ16_HANDLER ( dlbewing_prot_r )
case 0x0300: return 0x160;//b
}
}
case 0x094: return dblwings_104_data;// p1 inputs select screen OK
case 0x24c: return dblwings_008_data;//read DSW (mirror for coinage/territory)
case 0x094: return state->_104_data;// p1 inputs select screen OK
case 0x24c: return state->_008_data;//read DSW (mirror for coinage/territory)
case 0x298: return input_port_read(space->machine, "SYSTEM");//vblank
case 0x476: return input_port_read(space->machine, "SYSTEM");//mirror for coins
case 0x506: return input_port_read(space->machine, "DSW");
case 0x5d8: return dblwings_406_data;
case 0x5d8: return state->_406_data;
case 0x2b4: return input_port_read(space->machine, "P1_P2");
case 0x1a8: return (input_port_read(space->machine, "DSW") & 0x4000) >> 12;//allow continue
case 0x3ec: return dblwings_70c_data; //score entry
case 0x246: return dblwings_580_data; // these three controls "perfect bonus" I suppose...
case 0x52e: return dblwings_580_data;
case 0x532: return dblwings_580_data;
case 0x3ec: return state->_70c_data; //score entry
case 0x246: return state->_580_data; // these three controls "perfect bonus" I suppose...
case 0x52e: return state->_580_data;
case 0x532: return state->_580_data;
}
// printf("dblewing prot r %08x, %04x, %04x\n",cpu_get_pc(space->cpu), offset*2, mem_mask);
// printf("dblewing prot r %08x, %04x, %04x\n", cpu_get_pc(space->cpu), offset * 2, mem_mask);
if ((offset*2)==0x0f8) return 0; // dblwings_080_data;
if ((offset*2)==0x104) return 0;
if ((offset*2)==0x10e) return 0;
if ((offset*2)==0x206) return 0; // dblwings_70c_data;
if ((offset*2)==0x25c) return 0;
if ((offset*2)==0x284) return 0; // 3rd player 2nd boss
if ((offset*2)==0x432) return 0; // boss on water level?
if ((offset*2)==0x54a) return 0; // 3rd player 2nd boss
if ((offset*2)==0x786) return 0;
if ((offset*2) == 0x0f8) return 0; // state->_080_data;
if ((offset*2) == 0x104) return 0;
if ((offset*2) == 0x10e) return 0;
if ((offset*2) == 0x206) return 0; // state->_70c_data;
if ((offset*2) == 0x25c) return 0;
if ((offset*2) == 0x284) return 0; // 3rd player 2nd boss
if ((offset*2) == 0x432) return 0; // boss on water level?
if ((offset*2) == 0x54a) return 0; // 3rd player 2nd boss
if ((offset*2) == 0x786) return 0;
mame_printf_debug("dblewing prot r %08x, %04x, %04x\n",cpu_get_pc(space->cpu), offset*2, mem_mask);
mame_printf_debug("dblewing prot r %08x, %04x, %04x\n", cpu_get_pc(space->cpu), offset * 2, mem_mask);
return 0;//mame_rand(space->machine);
}
static WRITE16_HANDLER( dblewing_prot_w )
{
// if(offset*2 != 0x380)
// printf("dblewing prot w %08x, %04x, %04x %04x\n",cpu_get_pc(space->cpu), offset*2, mem_mask,data);
dblewing_state *state = (dblewing_state *)space->machine->driver_data;
switch(offset*2)
// if (offset * 2 != 0x380)
// printf("dblewing prot w %08x, %04x, %04x %04x\n", cpu_get_pc(space->cpu), offset * 2, mem_mask, data);
switch (offset * 2)
{
case 0x088:
dblwings_088_data = data;
if(dblwings_088_data == 0) { boss_4_data = 0; }
else if(dblwings_088_data & 0x8000) { boss_4_data = 0x50; }
else { boss_4_data = 0x40; }
state->_088_data = data;
if(state->_088_data == 0) { state->boss_4_data = 0; }
else if(state->_088_data & 0x8000) { state->boss_4_data = 0x50; }
else { state->boss_4_data = 0x40; }
return;
case 0x104:
dblwings_104_data = data;
state->_104_data = data;
return; // p1 inputs select screen OK
case 0x18a:
dblwings_18a_data = data;
switch(dblwings_18a_data)
state->_18a_data = data;
switch (state->_18a_data)
{
case 0x6b94: boss_5_data = 0x10; break; //initialize
case 0x7c68: boss_5_data = 0x60; break; //go up
case 0xfb1d: boss_5_data = 0x50; break;
case 0x977c: boss_5_data = 0x50; break;
case 0x8a49: boss_5_data = 0x60; break;
case 0x6b94: state->boss_5_data = 0x10; break; //initialize
case 0x7c68: state->boss_5_data = 0x60; break; //go up
case 0xfb1d: state->boss_5_data = 0x50; break;
case 0x977c: state->boss_5_data = 0x50; break;
case 0x8a49: state->boss_5_data = 0x60; break;
}
return;
case 0x200:
dblwings_200_data = data;
switch(dblwings_200_data)
state->_200_data = data;
switch (state->_200_data)
{
case 0x5a19: boss_move = 1; break;
case 0x3b28: boss_move = 2; break;
case 0x1d4d: boss_move = 1; break;
case 0x5a19: state->boss_move = 1; break;
case 0x3b28: state->boss_move = 2; break;
case 0x1d4d: state->boss_move = 1; break;
}
//popmessage("%04x",dblwings_200_data);
//popmessage("%04x",state->_200_data);
return;
case 0x280:
dblwings_280_data = data;
switch(dblwings_280_data)
state->_280_data = data;
switch (state->_280_data)
{
case 0x6b94: boss_5sx_data = 0x10; break;
case 0x7519: boss_5sx_data = 0x60; break;
case 0xfc68: boss_5sx_data = 0x50; break;
case 0x02dd: boss_5sx_data = 0x50; break;
case 0x613c: boss_5sx_data = 0x50; break;
case 0x6b94: state->boss_5sx_data = 0x10; break;
case 0x7519: state->boss_5sx_data = 0x60; break;
case 0xfc68: state->boss_5sx_data = 0x50; break;
case 0x02dd: state->boss_5sx_data = 0x50; break;
case 0x613c: state->boss_5sx_data = 0x50; break;
}
//printf("%04x\n",dblwings_280_data);
//printf("%04x\n",state->_280_data);
return;
case 0x380: // sound write
soundlatch_w(space, 0, data & 0xff);
dblewing_sound_irq |= 0x02;
cputag_set_input_line(space->machine, "audiocpu", 0, (dblewing_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE);
state->sound_irq |= 0x02;
cpu_set_input_line(state->audiocpu, 0, (state->sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE);
return;
case 0x384:
dblwings_384_data = data;
switch(dblwings_384_data)
state->_384_data = data;
switch(state->_384_data)
{
case 0xaa41: boss_6_data = 1; break;
case 0x5a97: boss_6_data = 2; break;
case 0xbac5: boss_6_data = 3; break;
case 0x0afb: boss_6_data = 4; break;
case 0x6a99: boss_6_data = 5; break;
case 0xda8f: boss_6_data = 6; break;
case 0xaa41: state->boss_6_data = 1; break;
case 0x5a97: state->boss_6_data = 2; break;
case 0xbac5: state->boss_6_data = 3; break;
case 0x0afb: state->boss_6_data = 4; break;
case 0x6a99: state->boss_6_data = 5; break;
case 0xda8f: state->boss_6_data = 6; break;
}
return;
case 0x38e:
dblwings_38e_data = data;
switch(dblwings_38e_data)
state->_38e_data = data;
switch(state->_38e_data)
{
case 0x6c13: boss_shoot_type = 3; break;
case 0xc311: boss_shoot_type = 0; break;
case 0x1593: boss_shoot_type = 1; break;
case 0xf9db: boss_shoot_type = 2; break;
case 0xf742: boss_shoot_type = 3; break;
case 0x6c13: state->boss_shoot_type = 3; break;
case 0xc311: state->boss_shoot_type = 0; break;
case 0x1593: state->boss_shoot_type = 1; break;
case 0xf9db: state->boss_shoot_type = 2; break;
case 0xf742: state->boss_shoot_type = 3; break;
case 0xeff5: boss_move = 1; break;
case 0xd2f1: boss_move = 2; break;
//default: printf("%04x\n",dblwings_38e_data); break;
//case 0xe65a: boss_shoot_type = 0; break;
case 0xeff5: state->boss_move = 1; break;
case 0xd2f1: state->boss_move = 2; break;
//default: printf("%04x\n",state->_38e_data); break;
//case 0xe65a: state->boss_shoot_type = 0; break;
}
return;
case 0x58c: // 3rd player 1st level
dblwings_58c_data = data;
if(dblwings_58c_data == 0) { boss_move = 5; }
else { boss_move = 2; }
state->_58c_data = data;
if(state->_58c_data == 0) { state->boss_move = 5; }
else { state->boss_move = 2; }
return;
case 0x60a:
dblwings_60a_data = data;
if(dblwings_60a_data & 0x8000) { boss_3_data = 2; }
else { boss_3_data = 9; }
state->_60a_data = data;
if(state->_60a_data & 0x8000) { state->boss_3_data = 2; }
else { state->boss_3_data = 9; }
return;
case 0x580:
dblwings_580_data = data;
state->_580_data = data;
return;
case 0x406:
dblwings_406_data = data;
state->_406_data = data;
return; // p2 inputs select screen OK
}
// printf("dblewing prot w %08x, %04x, %04x %04x\n",cpu_get_pc(space->cpu), offset*2, mem_mask,data);
// printf("dblewing prot w %08x, %04x, %04x %04x\n", cpu_get_pc(space->cpu), offset * 2, mem_mask, data);
if ((offset*2)==0x008) { dblwings_008_data = data; return; }
if ((offset*2)==0x080) { dblwings_080_data = data; return; } // p3 3rd boss?
if ((offset*2)==0x28c) { dblwings_28c_data = data; return; }
if ((offset*2)==0x408) { dblwings_408_data = data; return; } // 3rd player 1st level?
if ((offset*2)==0x40e) { dblwings_40e_data = data; return; } // 3rd player 2nd level?
if ((offset*2)==0x608) { dblwings_608_data = data; return; }
if ((offset*2)==0x70c) { dblwings_70c_data = data; return; }
if ((offset*2)==0x78a) { dblwings_78a_data = data; return; }
if ((offset*2)==0x788) { dblwings_788_data = data; return; }
if ((offset * 2) == 0x008) { state->_008_data = data; return; }
if ((offset * 2) == 0x080) { state->_080_data = data; return; } // p3 3rd boss?
if ((offset * 2) == 0x28c) { state->_28c_data = data; return; }
if ((offset * 2) == 0x408) { state->_408_data = data; return; } // 3rd player 1st level?
if ((offset * 2) == 0x40e) { state->_40e_data = data; return; } // 3rd player 2nd level?
if ((offset * 2) == 0x608) { state->_608_data = data; return; }
if ((offset * 2) == 0x70c) { state->_70c_data = data; return; }
if ((offset * 2) == 0x78a) { state->_78a_data = data; return; }
if ((offset * 2) == 0x788) { state->_788_data = data; return; }
}
static ADDRESS_MAP_START( dblewing_map, ADDRESS_SPACE_PROGRAM, 16 )
@ -379,8 +407,8 @@ static ADDRESS_MAP_START( dblewing_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x100000, 0x100fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf1_data_r, deco16ic_pf1_data_w)
AM_RANGE(0x102000, 0x102fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf2_data_r, deco16ic_pf2_data_w)
AM_RANGE(0x104000, 0x104fff) AM_RAM AM_BASE(&dblewing_pf1_rowscroll)
AM_RANGE(0x106000, 0x106fff) AM_RAM AM_BASE(&dblewing_pf2_rowscroll)
AM_RANGE(0x104000, 0x104fff) AM_RAM AM_BASE_MEMBER(dblewing_state, pf1_rowscroll)
AM_RANGE(0x106000, 0x106fff) AM_RAM AM_BASE_MEMBER(dblewing_state, pf2_rowscroll)
/* protection */
// AM_RANGE(0x280104, 0x280105) AM_WRITENOP // ??
@ -391,23 +419,25 @@ static ADDRESS_MAP_START( dblewing_map, ADDRESS_SPACE_PROGRAM, 16 )
// AM_RANGE(0x280330, 0x280331) AM_READNOP // sound?
// AM_RANGE(0x280380, 0x280381) AM_WRITENOP // sound
AM_RANGE(0x280000, 0x2807ff) AM_READWRITE(dlbewing_prot_r,dblewing_prot_w)
AM_RANGE(0x280000, 0x2807ff) AM_READWRITE(dblewing_prot_r, dblewing_prot_w)
AM_RANGE(0x284000, 0x284001) AM_RAM
AM_RANGE(0x288000, 0x288001) AM_RAM
AM_RANGE(0x28c000, 0x28c00f) AM_RAM_DEVWRITE("deco_custom", deco16ic_pf12_control_w)
AM_RANGE(0x300000, 0x3007ff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
AM_RANGE(0x300000, 0x3007ff) AM_RAM AM_BASE_SIZE_MEMBER(dblewing_state, spriteram, spriteram_size)
AM_RANGE(0x320000, 0x3207ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE_GENERIC(paletteram)
AM_RANGE(0xff0000, 0xff3fff) AM_MIRROR(0xc000) AM_RAM
ADDRESS_MAP_END
static READ8_HANDLER(irq_latch_r)
{
dblewing_state *state = (dblewing_state *)space->machine->driver_data;
/* bit 1 of dblewing_sound_irq specifies IRQ command writes */
dblewing_sound_irq &= ~0x02;
cputag_set_input_line(space->machine, "audiocpu", 0, (dblewing_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE);
return dblewing_sound_irq;
state->sound_irq &= ~0x02;
cpu_set_input_line(state->audiocpu, 0, (state->sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE);
return state->sound_irq;
}
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
@ -592,14 +622,16 @@ static INPUT_PORTS_START( dblewing )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
INPUT_PORTS_END
static void sound_irq(running_device *device, int state)
static void sound_irq( running_device *device, int state )
{
dblewing_state *driver_state = (dblewing_state *)device->machine->driver_data;
/* bit 0 of dblewing_sound_irq specifies IRQ from sound chip */
if (state)
dblewing_sound_irq |= 0x01;
driver_state->sound_irq |= 0x01;
else
dblewing_sound_irq &= ~0x01;
cputag_set_input_line(device->machine, "audiocpu", 0, (dblewing_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE);
driver_state->sound_irq &= ~0x01;
cpu_set_input_line(driver_state->audiocpu, 0, (driver_state->sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2151_interface ym2151_config =
@ -625,7 +657,85 @@ static const deco16ic_interface dblewing_deco16ic_intf =
NULL
};
static MACHINE_START( dblewing )
{
dblewing_state *state = (dblewing_state *)machine->driver_data;
state->maincpu = devtag_get_device(machine, "maincpu");
state->audiocpu = devtag_get_device(machine, "audiocpu");
state->deco16ic = devtag_get_device(machine, "deco_custom");
state_save_register_global(machine, state->_008_data);
state_save_register_global(machine, state->_104_data);
state_save_register_global(machine, state->_406_data);
state_save_register_global(machine, state->_608_data);
state_save_register_global(machine, state->_70c_data);
state_save_register_global(machine, state->_78a_data);
state_save_register_global(machine, state->_088_data);
state_save_register_global(machine, state->_58c_data);
state_save_register_global(machine, state->_408_data);
state_save_register_global(machine, state->_40e_data);
state_save_register_global(machine, state->_080_data);
state_save_register_global(machine, state->_788_data);
state_save_register_global(machine, state->_38e_data);
state_save_register_global(machine, state->_580_data);
state_save_register_global(machine, state->_60a_data);
state_save_register_global(machine, state->_200_data);
state_save_register_global(machine, state->_28c_data);
state_save_register_global(machine, state->_18a_data);
state_save_register_global(machine, state->_280_data);
state_save_register_global(machine, state->_384_data);
state_save_register_global(machine, state->boss_move);
state_save_register_global(machine, state->boss_shoot_type);
state_save_register_global(machine, state->boss_3_data);
state_save_register_global(machine, state->boss_4_data);
state_save_register_global(machine, state->boss_5_data);
state_save_register_global(machine, state->boss_5sx_data);
state_save_register_global(machine, state->boss_6_data);
state_save_register_global(machine, state->sound_irq);
}
static MACHINE_RESET( dblewing )
{
dblewing_state *state = (dblewing_state *)machine->driver_data;
state->_008_data = 0;
state->_104_data = 0;
state->_406_data = 0;
state->_608_data = 0;
state->_70c_data = 0;
state->_78a_data = 0;
state->_088_data = 0;
state->_58c_data = 0;
state->_408_data = 0;
state->_40e_data = 0;
state->_080_data = 0;
state->_788_data = 0;
state->_38e_data = 0;
state->_580_data = 0;
state->_60a_data = 0;
state->_200_data = 0;
state->_28c_data = 0;
state->_18a_data = 0;
state->_280_data = 0;
state->_384_data = 0;
state->boss_move = 0;
state->boss_shoot_type = 0;
state->boss_3_data = 0;
state->boss_4_data = 0;
state->boss_5_data = 0;
state->boss_5sx_data = 0;
state->boss_6_data = 0;
state->sound_irq = 0;
}
static MACHINE_DRIVER_START( dblewing )
/* driver data */
MDRV_DRIVER_DATA(dblewing_state)
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", M68000, 14000000) /* DE102 */
MDRV_CPU_PROGRAM_MAP(dblewing_map)
@ -637,6 +747,9 @@ static MACHINE_DRIVER_START( dblewing )
MDRV_QUANTUM_TIME(HZ(6000))
MDRV_MACHINE_START(dblewing)
MDRV_MACHINE_RESET(dblewing)
/* video hardware */
MDRV_SCREEN_ADD("screen", RASTER)
MDRV_SCREEN_REFRESH_RATE(58)
@ -742,4 +855,4 @@ static DRIVER_INIT( dblewing )
}
GAME( 1993, dblewing, 0, dblewing, dblewing, dblewing, ROT90,"Mitchell", "Double Wings", GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING )
GAME( 1993, dblewing, 0, dblewing, dblewing, dblewing, ROT90, "Mitchell", "Double Wings", GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )

View File

@ -22,19 +22,36 @@
#include "sound/ymz280b.h"
#include "video/deco16ic.h"
class deco156_state
{
public:
static void *alloc(running_machine &machine) { return auto_alloc_clear(&machine, deco156_state(machine)); }
deco156_state(running_machine &machine) { }
/* memory pointers */
UINT16 * pf1_rowscroll;
UINT16 * pf2_rowscroll;
/* devices */
running_device *maincpu;
running_device *deco16ic;
running_device *oki2;
};
static UINT16 *deco156_pf1_rowscroll,*deco156_pf2_rowscroll;
static VIDEO_START( wcvol95 )
{
deco156_state *state = (deco156_state *)machine->driver_data;
/* allocate the ram as 16-bit (we do it here because the CPU is 32-bit) */
deco156_pf1_rowscroll = auto_alloc_array(machine, UINT16, 0x800/2);
deco156_pf2_rowscroll = auto_alloc_array(machine, UINT16, 0x800/2);
state->pf1_rowscroll = auto_alloc_array(machine, UINT16, 0x800/2);
state->pf2_rowscroll = auto_alloc_array(machine, UINT16, 0x800/2);
machine->generic.paletteram.u16 = auto_alloc_array(machine, UINT16, 0x1000/2);
/* and register the allocated ram so that save states still work */
state_save_register_global_pointer(machine, deco156_pf1_rowscroll, 0x800/2);
state_save_register_global_pointer(machine, deco156_pf2_rowscroll, 0x800/2);
state_save_register_global_pointer(machine, state->pf1_rowscroll, 0x800/2);
state_save_register_global_pointer(machine, state->pf2_rowscroll, 0x800/2);
state_save_register_global_pointer(machine, machine->generic.paletteram.u16, 0x1000/2);
}
@ -42,31 +59,33 @@ static VIDEO_START( wcvol95 )
its the same sprite chip Data East used on many, many 16-bit era titles */
static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
{
UINT32 *spriteram32 = machine->generic.spriteram.u32;
UINT32 *spriteram = machine->generic.spriteram.u32;
int offs;
flip_screen_set_no_update(machine, 1);
for (offs = (0x1400/4)-4;offs >= 0;offs -= 4) // 0x1400 for charlien
for (offs = (0x1400 / 4) - 4; offs >= 0; offs -= 4) // 0x1400 for charlien
{
int x,y,sprite,colour,multi,fx,fy,inc,flash,mult, pri;
int x, y, sprite, colour, multi, fx, fy, inc, flash, mult, pri;
sprite = spriteram32[offs+1]&0xffff;
sprite = spriteram[offs + 1] & 0xffff;
y = spriteram32[offs]&0xffff;
flash=y&0x1000;
if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue;
y = spriteram[offs] & 0xffff;
flash = y & 0x1000;
if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1))
continue;
x = spriteram32[offs+2]&0xffff;
colour = (x >>9) & 0x1f;
x = spriteram[offs + 2] & 0xffff;
colour = (x >> 9) & 0x1f;
pri = (x&0xc000); // 2 bits or 1?
pri = (x & 0xc000); // 2 bits or 1?
switch (pri&0xc000) {
case 0x0000: pri=0; break;
case 0x4000: pri=0xf0; break;
case 0x8000: pri=0xf0|0xcc; break;
case 0xc000: pri=0xf0|0xcc; break; /* or 0xf0|0xcc|0xaa ? */
switch (pri & 0xc000)
{
case 0x0000: pri = 0; break;
case 0x4000: pri = 0xf0; break;
case 0x8000: pri = 0xf0 | 0xcc; break;
case 0xc000: pri = 0xf0 | 0xcc; break; /* or 0xf0|0xcc|0xaa ? */
}
fx = y & 0x2000;
@ -80,7 +99,8 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
y = 240 - y;
x = 304 - x;
if (x>320) continue;
if (x > 320)
continue;
sprite &= ~multi;
if (fy)
@ -93,13 +113,13 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
if (flip_screen_x_get(machine))
{
y=240-y;
x=304-x;
if (fx) fx=0; else fx=1;
if (fy) fy=0; else fy=1;
mult=16;
y = 240 - y;
x = 304 - x;
if (fx) fx = 0; else fx = 1;
if (fy) fy = 0; else fy = 1;
mult = 16;
}
else mult=-16;
else mult = -16;
while (multi >= 0)
{
@ -119,16 +139,16 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
static VIDEO_UPDATE( wcvol95 )
{
running_device *deco16ic = devtag_get_device(screen->machine, "deco_custom");
deco156_state *state = (deco156_state *)screen->machine->driver_data;
bitmap_fill(screen->machine->priority_bitmap, NULL, 0);
bitmap_fill(bitmap, NULL, 0);
deco16ic_pf12_update(deco16ic, deco156_pf1_rowscroll, deco156_pf2_rowscroll);
deco16ic_pf12_update(state->deco16ic, state->pf1_rowscroll, state->pf2_rowscroll);
deco16ic_tilemap_2_draw(deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
draw_sprites(screen->machine, bitmap, cliprect);
deco16ic_tilemap_1_draw(deco16ic, bitmap, cliprect, 0, 0);
deco16ic_tilemap_1_draw(state->deco16ic, bitmap, cliprect, 0, 0);
return 0;
}
@ -136,9 +156,10 @@ static VIDEO_UPDATE( wcvol95 )
static WRITE32_HANDLER(hvysmsh_eeprom_w)
{
deco156_state *state = (deco156_state *)space->machine->driver_data;
if (ACCESSING_BITS_0_7)
{
okim6295_set_bank_base(devtag_get_device(space->machine, "oki2"), 0x40000 * (data & 0x7) );
okim6295_set_bank_base(state->oki2, 0x40000 * (data & 0x7));
input_port_write(space->machine, "EEPROMOUT", data, 0xff);
}
}
@ -168,11 +189,10 @@ static WRITE32_HANDLER( deco156_nonbuffered_palette_w )
palette_set_color(space->machine,offset,MAKE_RGB(r,g,b));
}
/***************************************************************************/
static READ32_HANDLER( wcvol95_pf1_rowscroll_r ) { return deco156_pf1_rowscroll[offset]^0xffff0000; }
static READ32_HANDLER( wcvol95_pf2_rowscroll_r ) { return deco156_pf2_rowscroll[offset]^0xffff0000; }
static WRITE32_HANDLER( wcvol95_pf1_rowscroll_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; COMBINE_DATA(&deco156_pf1_rowscroll[offset]); }
static WRITE32_HANDLER( wcvol95_pf2_rowscroll_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; COMBINE_DATA(&deco156_pf2_rowscroll[offset]); }
static READ32_HANDLER( wcvol95_pf1_rowscroll_r ) { deco156_state *state = (deco156_state *)space->machine->driver_data; return state->pf1_rowscroll[offset] ^ 0xffff0000; }
static READ32_HANDLER( wcvol95_pf2_rowscroll_r ) { deco156_state *state = (deco156_state *)space->machine->driver_data; return state->pf2_rowscroll[offset] ^ 0xffff0000; }
static WRITE32_HANDLER( wcvol95_pf1_rowscroll_w ) { deco156_state *state = (deco156_state *)space->machine->driver_data; data &= 0x0000ffff; mem_mask &= 0x0000ffff; COMBINE_DATA(&state->pf1_rowscroll[offset]); }
static WRITE32_HANDLER( wcvol95_pf2_rowscroll_w ) { deco156_state *state = (deco156_state *)space->machine->driver_data; data &= 0x0000ffff; mem_mask &= 0x0000ffff; COMBINE_DATA(&state->pf2_rowscroll[offset]); }
static ADDRESS_MAP_START( hvysmsh_map, ADDRESS_SPACE_PROGRAM, 32 )
@ -380,8 +400,20 @@ static const deco16ic_interface deco156_deco16ic_intf =
NULL
};
static MACHINE_START( deco156 )
{
deco156_state *state = (deco156_state *)machine->driver_data;
state->maincpu = devtag_get_device(machine, "maincpu");
state->deco16ic = devtag_get_device(machine, "deco_custom");
state->oki2 = devtag_get_device(machine, "oki2");
}
static MACHINE_DRIVER_START( hvysmsh )
/* driver data */
MDRV_DRIVER_DATA(deco156_state)
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", ARM, 28000000) /* Unconfirmed */
MDRV_CPU_PROGRAM_MAP(hvysmsh_map)
@ -389,6 +421,8 @@ static MACHINE_DRIVER_START( hvysmsh )
MDRV_EEPROM_93C46_ADD("eeprom")
MDRV_MACHINE_START(deco156)
/* video hardware */
MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM )
@ -423,6 +457,9 @@ MACHINE_DRIVER_END
static MACHINE_DRIVER_START( wcvol95 )
/* driver data */
MDRV_DRIVER_DATA(deco156_state)
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", ARM, 28000000) /* Unconfirmed */
MDRV_CPU_PROGRAM_MAP(wcvol95_map)
@ -430,6 +467,8 @@ static MACHINE_DRIVER_START( wcvol95 )
MDRV_EEPROM_93C46_ADD("eeprom")
MDRV_MACHINE_START(deco156)
/* video hardware */
MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM )
@ -657,7 +696,7 @@ static void descramble_sound( running_machine *machine, const char *tag )
UINT8 *buf1 = auto_alloc_array(machine, UINT8, length);
UINT32 x;
for (x=0;x<length;x++)
for (x = 0; x < length; x++)
{
UINT32 addr;
@ -673,7 +712,7 @@ static void descramble_sound( running_machine *machine, const char *tag )
memcpy(rom,buf1,length);
auto_free (machine, buf1);
auto_free(machine, buf1);
}
static DRIVER_INIT( hvysmsh )
@ -693,7 +732,7 @@ static DRIVER_INIT( wcvol95 )
/**********************************************************************************/
GAME( 1993, hvysmsh, 0, hvysmsh, hvysmsh, hvysmsh, ROT0, "Data East Corporation", "Heavy Smash (Europe version -2)", 0)
GAME( 1993, hvysmsha, hvysmsh, hvysmsh, hvysmsh, hvysmsh, ROT0, "Data East Corporation", "Heavy Smash (Asia version -4)", 0)
GAME( 1993, hvysmshj, hvysmsh, hvysmsh, hvysmsh, hvysmsh, ROT0, "Data East Corporation", "Heavy Smash (Japan version -2)", 0)
GAME( 1995, wcvol95, 0, wcvol95, wcvol95, wcvol95, ROT0, "Data East Corporation", "World Cup Volley '95 (Japan v1.0)",0 )
GAME( 1993, hvysmsh, 0, hvysmsh, hvysmsh, hvysmsh, ROT0, "Data East Corporation", "Heavy Smash (Europe version -2)", GAME_SUPPORTS_SAVE )
GAME( 1993, hvysmsha, hvysmsh, hvysmsh, hvysmsh, hvysmsh, ROT0, "Data East Corporation", "Heavy Smash (Asia version -4)", GAME_SUPPORTS_SAVE )
GAME( 1993, hvysmshj, hvysmsh, hvysmsh, hvysmsh, hvysmsh, ROT0, "Data East Corporation", "Heavy Smash (Japan version -2)", GAME_SUPPORTS_SAVE )
GAME( 1995, wcvol95, 0, wcvol95, wcvol95, wcvol95, ROT0, "Data East Corporation", "World Cup Volley '95 (Japan v1.0)", GAME_SUPPORTS_SAVE )

View File

@ -109,23 +109,17 @@
#include "cpu/h6280/h6280.h"
#include "includes/decocrpt.h"
#include "includes/decoprot.h"
#include "includes/rohga.h"
#include "sound/2151intf.h"
#include "sound/okim6295.h"
#include "video/deco16ic.h"
VIDEO_START( rohga );
VIDEO_UPDATE( rohga );
VIDEO_UPDATE( schmeisr );
VIDEO_UPDATE( wizdfire );
VIDEO_UPDATE( nitrobal );
WRITE16_HANDLER( rohga_buffer_spriteram16_w );
extern UINT16 *rohga_pf1_rowscroll,*rohga_pf2_rowscroll;
extern UINT16 *rohga_pf3_rowscroll,*rohga_pf4_rowscroll;
static READ16_HANDLER( rohga_irq_ack_r )
{
cputag_set_input_line(space->machine, "maincpu", 6, CLEAR_LINE);
rohga_state *state = (rohga_state *)space->machine->driver_data;
cpu_set_input_line(state->maincpu, 6, CLEAR_LINE);
return 0;
}
@ -134,7 +128,8 @@ static WRITE16_HANDLER( wizdfire_irq_ack_w )
/* This might actually do more, nitrobal for example sets 0xca->0xffff->0x80 at startup then writes 7 all the time
except when a credit is inserted (writes 6 twice).
Wizard Fire / Dark Seal 2 just writes 1 all the time, so I just don't trust it much for now... -AS */
cputag_set_input_line(space->machine, "maincpu", 6, CLEAR_LINE);
rohga_state *state = (rohga_state *)space->machine->driver_data;
cpu_set_input_line(state->maincpu, 6, CLEAR_LINE);
}
/**********************************************************************************/
@ -161,10 +156,10 @@ static ADDRESS_MAP_START( rohga_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x3c4000, 0x3c4fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf3_data_r, deco16ic_pf3_data_w)
AM_RANGE(0x3c6000, 0x3c6fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf4_data_r, deco16ic_pf4_data_w)
AM_RANGE(0x3c8000, 0x3c8fff) AM_MIRROR(0x1000) AM_RAM AM_BASE(&rohga_pf1_rowscroll)
AM_RANGE(0x3ca000, 0x3cafff) AM_MIRROR(0x1000) AM_RAM AM_BASE(&rohga_pf2_rowscroll)
AM_RANGE(0x3cc000, 0x3ccfff) AM_MIRROR(0x1000) AM_RAM AM_BASE(&rohga_pf3_rowscroll)
AM_RANGE(0x3ce000, 0x3cefff) AM_MIRROR(0x1000) AM_RAM AM_BASE(&rohga_pf4_rowscroll)
AM_RANGE(0x3c8000, 0x3c8fff) AM_MIRROR(0x1000) AM_RAM AM_BASE_MEMBER(rohga_state, pf1_rowscroll)
AM_RANGE(0x3ca000, 0x3cafff) AM_MIRROR(0x1000) AM_RAM AM_BASE_MEMBER(rohga_state, pf2_rowscroll)
AM_RANGE(0x3cc000, 0x3ccfff) AM_MIRROR(0x1000) AM_RAM AM_BASE_MEMBER(rohga_state, pf3_rowscroll)
AM_RANGE(0x3ce000, 0x3cefff) AM_MIRROR(0x1000) AM_RAM AM_BASE_MEMBER(rohga_state, pf4_rowscroll)
AM_RANGE(0x3d0000, 0x3d07ff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
AM_RANGE(0x3e0000, 0x3e1fff) AM_RAM_DEVWRITE("deco_custom", deco16ic_buffered_palette_w) AM_BASE_GENERIC(paletteram)
@ -180,8 +175,8 @@ static ADDRESS_MAP_START( wizdfire_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x20a000, 0x20afff) AM_DEVREADWRITE("deco_custom", deco16ic_pf4_data_r, deco16ic_pf4_data_w)
AM_RANGE(0x20b000, 0x20b3ff) AM_WRITEONLY /* ? Always 0 written */
AM_RANGE(0x20c000, 0x20c7ff) AM_RAM AM_BASE(&rohga_pf3_rowscroll)
AM_RANGE(0x20e000, 0x20e7ff) AM_RAM AM_BASE(&rohga_pf4_rowscroll)
AM_RANGE(0x20c000, 0x20c7ff) AM_RAM AM_BASE_MEMBER(rohga_state, pf3_rowscroll)
AM_RANGE(0x20e000, 0x20e7ff) AM_RAM AM_BASE_MEMBER(rohga_state, pf4_rowscroll)
AM_RANGE(0x300000, 0x30000f) AM_DEVWRITE("deco_custom", deco16ic_pf12_control_w)
AM_RANGE(0x310000, 0x31000f) AM_DEVWRITE("deco_custom", deco16ic_pf34_control_w)
@ -210,10 +205,10 @@ static ADDRESS_MAP_START( nitrobal_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x208000, 0x2087ff) AM_MIRROR(0x800) AM_DEVREADWRITE("deco_custom", deco16ic_pf3_data_r, deco16ic_pf3_data_w)
AM_RANGE(0x20a000, 0x20a7ff) AM_MIRROR(0x800) AM_DEVREADWRITE("deco_custom", deco16ic_pf4_data_r, deco16ic_pf4_data_w)
AM_RANGE(0x204000, 0x2047ff) AM_RAM AM_BASE(&rohga_pf1_rowscroll)
AM_RANGE(0x206000, 0x2067ff) AM_RAM AM_BASE(&rohga_pf2_rowscroll)
AM_RANGE(0x20c000, 0x20c7ff) AM_RAM AM_BASE(&rohga_pf3_rowscroll)
AM_RANGE(0x20e000, 0x20e7ff) AM_RAM AM_BASE(&rohga_pf4_rowscroll)
AM_RANGE(0x204000, 0x2047ff) AM_RAM AM_BASE_MEMBER(rohga_state, pf1_rowscroll)
AM_RANGE(0x206000, 0x2067ff) AM_RAM AM_BASE_MEMBER(rohga_state, pf2_rowscroll)
AM_RANGE(0x20c000, 0x20c7ff) AM_RAM AM_BASE_MEMBER(rohga_state, pf3_rowscroll)
AM_RANGE(0x20e000, 0x20e7ff) AM_RAM AM_BASE_MEMBER(rohga_state, pf4_rowscroll)
AM_RANGE(0x300000, 0x30000f) AM_DEVWRITE("deco_custom", deco16ic_pf12_control_w)
AM_RANGE(0x310000, 0x31000f) AM_DEVWRITE("deco_custom", deco16ic_pf34_control_w)
@ -254,10 +249,10 @@ static ADDRESS_MAP_START( schmeisr_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x3c2000, 0x3c2fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf2_data_r, deco16ic_pf2_data_w)
AM_RANGE(0x3c4000, 0x3c4fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf3_data_r, deco16ic_pf3_data_w)
AM_RANGE(0x3c6000, 0x3c6fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf4_data_r, deco16ic_pf4_data_w)
AM_RANGE(0x3c8000, 0x3c8fff) AM_MIRROR(0x1000) AM_RAM AM_BASE(&rohga_pf1_rowscroll)
AM_RANGE(0x3ca000, 0x3cafff) AM_MIRROR(0x1000) AM_RAM AM_BASE(&rohga_pf2_rowscroll)
AM_RANGE(0x3cc000, 0x3ccfff) AM_MIRROR(0x1000) AM_RAM AM_BASE(&rohga_pf3_rowscroll)
AM_RANGE(0x3ce000, 0x3cefff) AM_MIRROR(0x1000) AM_RAM AM_BASE(&rohga_pf4_rowscroll)
AM_RANGE(0x3c8000, 0x3c8fff) AM_MIRROR(0x1000) AM_RAM AM_BASE_MEMBER(rohga_state, pf1_rowscroll)
AM_RANGE(0x3ca000, 0x3cafff) AM_MIRROR(0x1000) AM_RAM AM_BASE_MEMBER(rohga_state, pf2_rowscroll)
AM_RANGE(0x3cc000, 0x3ccfff) AM_MIRROR(0x1000) AM_RAM AM_BASE_MEMBER(rohga_state, pf3_rowscroll)
AM_RANGE(0x3ce000, 0x3cefff) AM_MIRROR(0x1000) AM_RAM AM_BASE_MEMBER(rohga_state, pf4_rowscroll)
AM_RANGE(0x3d0000, 0x3d07ff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
AM_RANGE(0x3e0000, 0x3e1fff) AM_MIRROR(0x2000) AM_RAM_DEVWRITE("deco_custom", deco16ic_buffered_palette_w) AM_BASE_GENERIC(paletteram)
@ -728,13 +723,15 @@ GFXDECODE_END
static void sound_irq(running_device *device, int state)
{
cputag_set_input_line(device->machine, "audiocpu", 1, state); /* IRQ 2 */
rohga_state *driver_state = (rohga_state *)device->machine->driver_data;
cpu_set_input_line(driver_state->audiocpu, 1, state); /* IRQ 2 */
}
static WRITE8_DEVICE_HANDLER( sound_bankswitch_w )
{
okim6295_set_bank_base(devtag_get_device(device->machine, "oki1"), ((data & 1)>>0) * 0x40000);
okim6295_set_bank_base(devtag_get_device(device->machine, "oki2"), ((data & 2)>>1) * 0x40000);
rohga_state *state = (rohga_state *)device->machine->driver_data;
okim6295_set_bank_base(state->oki1, BIT(data, 0) * 0x40000);
okim6295_set_bank_base(state->oki2, BIT(data, 1) * 0x40000);
}
static const ym2151_interface ym2151_config =
@ -776,8 +773,22 @@ static const deco16ic_interface nitrobal_deco16ic_intf =
rohga_bank_callback
};
static MACHINE_START( rohga )
{
rohga_state *state = (rohga_state *)machine->driver_data;
state->maincpu = devtag_get_device(machine, "maincpu");
state->audiocpu = devtag_get_device(machine, "audiocpu");
state->deco16ic = devtag_get_device(machine, "deco_custom");
state->oki1 = devtag_get_device(machine, "oki1");
state->oki2 = devtag_get_device(machine, "oki2");
}
static MACHINE_DRIVER_START( rohga )
/* driver data */
MDRV_DRIVER_DATA(rohga_state)
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", M68000, 14000000)
MDRV_CPU_PROGRAM_MAP(rohga_map)
@ -786,6 +797,8 @@ static MACHINE_DRIVER_START( rohga )
MDRV_CPU_ADD("audiocpu", H6280,32220000/4/3) /* verified on pcb (8.050Mhz is XIN on pin 10 of H6280 */
MDRV_CPU_PROGRAM_MAP(rohga_sound_map)
MDRV_MACHINE_START(rohga)
/* video hardware */
MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
@ -825,6 +838,9 @@ MACHINE_DRIVER_END
static MACHINE_DRIVER_START( wizdfire )
/* driver data */
MDRV_DRIVER_DATA(rohga_state)
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", M68000, 14000000)
MDRV_CPU_PROGRAM_MAP(wizdfire_map)
@ -833,6 +849,8 @@ static MACHINE_DRIVER_START( wizdfire )
MDRV_CPU_ADD("audiocpu", H6280,32220000/4/3) /* verified on pcb (8.050Mhz is XIN on pin 10 of H6280 */
MDRV_CPU_PROGRAM_MAP(rohga_sound_map)
MDRV_MACHINE_START(rohga)
/* video hardware */
MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM )
@ -871,6 +889,9 @@ MACHINE_DRIVER_END
static MACHINE_DRIVER_START( nitrobal )
/* driver data */
MDRV_DRIVER_DATA(rohga_state)
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", M68000, 14000000)
MDRV_CPU_PROGRAM_MAP(nitrobal_map)
@ -879,6 +900,8 @@ static MACHINE_DRIVER_START( nitrobal )
MDRV_CPU_ADD("audiocpu", H6280,32220000/4/3) /* verified on pcb (8.050Mhz is XIN on pin 10 of H6280 */
MDRV_CPU_PROGRAM_MAP(rohga_sound_map)
MDRV_MACHINE_START(rohga)
/* video hardware */
MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM )
@ -917,6 +940,9 @@ MACHINE_DRIVER_END
static MACHINE_DRIVER_START( schmeisr )
/* driver data */
MDRV_DRIVER_DATA(rohga_state)
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", M68000, 14000000)
MDRV_CPU_PROGRAM_MAP(schmeisr_map)
@ -925,6 +951,8 @@ static MACHINE_DRIVER_START( schmeisr )
MDRV_CPU_ADD("audiocpu", H6280,32220000/4/3) /* verified on pcb (8.050Mhz is XIN on pin 10 of H6280 */
MDRV_CPU_PROGRAM_MAP(rohga_sound_map)
MDRV_MACHINE_START(rohga)
/* video hardware */
MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
@ -1518,8 +1546,8 @@ static DRIVER_INIT( schmeisr )
const UINT8 *src = memory_region(machine, "gfx2");
UINT8 *dst = memory_region(machine, "gfx1");
memcpy(dst,src,0x20000);
memcpy(dst+0x20000,src+0x80000,0x20000);
memcpy(dst, src, 0x20000);
memcpy(dst + 0x20000, src + 0x80000, 0x20000);
deco74_decrypt_gfx(machine, "gfx1");
deco74_decrypt_gfx(machine, "gfx2");
@ -1527,15 +1555,15 @@ static DRIVER_INIT( schmeisr )
decoprot_reset(machine);
}
GAME( 1991, rohga, 0, rohga, rohga, rohga, ROT0, "Data East Corporation", "Rohga Armor Force (Asia/Europe v5.0)" , 0 )
GAME( 1991, rohga1, rohga, rohga, rohga, rohga, ROT0, "Data East Corporation", "Rohga Armor Force (Asia/Europe v3.0 Set 1)", 0 )
GAME( 1991, rohga2, rohga, rohga, rohga, rohga, ROT0, "Data East Corporation", "Rohga Armor Force (Asia/Europe v3.0 Set 2)", 0 )
GAME( 1991, rohgah, rohga, rohga, rohga, rohga, ROT0, "Data East Corporation", "Rohga Armor Force (Hong Kong v3.0)", 0 )
GAME( 1991, rohgau, rohga, rohga, rohga, rohga, ROT0, "Data East Corporation", "Rohga Armor Force (US v1.0)", 0 )
GAME( 1991, wolffang, rohga, rohga, rohga, rohga, ROT0, "Data East Corporation", "Wolf Fang -Kuhga 2001- (Japan)", 0 )
GAME( 1992, wizdfire, 0, wizdfire, wizdfire, wizdfire, ROT0, "Data East Corporation", "Wizard Fire (Over Sea v2.1)", 0 )
GAME( 1992, wizdfireu,wizdfire,wizdfire, wizdfire, wizdfire, ROT0, "Data East Corporation", "Wizard Fire (US v1.1)", 0 )
GAME( 1992, darkseal2,wizdfire,wizdfire, wizdfire, wizdfire, ROT0, "Data East Corporation", "Dark Seal 2 (Japan v2.1)", 0 )
GAME( 1992, nitrobal, 0, nitrobal, nitrobal, nitrobal, ROT270, "Data East Corporation", "Nitro Ball (US)", 0 )
GAME( 1992, gunball, nitrobal,nitrobal, nitrobal, nitrobal, ROT270, "Data East Corporation", "Gun Ball (Japan)", 0 )
GAME( 1993, schmeisr, 0, schmeisr, schmeisr, schmeisr, ROT0, "Hot B", "Schmeiser Robo (Japan)", 0 )
GAME( 1991, rohga, 0, rohga, rohga, rohga, ROT0, "Data East Corporation", "Rohga Armor Force (Asia/Europe v5.0)", GAME_SUPPORTS_SAVE )
GAME( 1991, rohga1, rohga, rohga, rohga, rohga, ROT0, "Data East Corporation", "Rohga Armor Force (Asia/Europe v3.0 Set 1)", GAME_SUPPORTS_SAVE )
GAME( 1991, rohga2, rohga, rohga, rohga, rohga, ROT0, "Data East Corporation", "Rohga Armor Force (Asia/Europe v3.0 Set 2)", GAME_SUPPORTS_SAVE )
GAME( 1991, rohgah, rohga, rohga, rohga, rohga, ROT0, "Data East Corporation", "Rohga Armor Force (Hong Kong v3.0)", GAME_SUPPORTS_SAVE )
GAME( 1991, rohgau, rohga, rohga, rohga, rohga, ROT0, "Data East Corporation", "Rohga Armor Force (US v1.0)", GAME_SUPPORTS_SAVE )
GAME( 1991, wolffang, rohga, rohga, rohga, rohga, ROT0, "Data East Corporation", "Wolf Fang -Kuhga 2001- (Japan)", GAME_SUPPORTS_SAVE )
GAME( 1992, wizdfire, 0, wizdfire, wizdfire, wizdfire, ROT0, "Data East Corporation", "Wizard Fire (Over Sea v2.1)", GAME_SUPPORTS_SAVE )
GAME( 1992, wizdfireu, wizdfire, wizdfire, wizdfire, wizdfire, ROT0, "Data East Corporation", "Wizard Fire (US v1.1)", GAME_SUPPORTS_SAVE )
GAME( 1992, darkseal2, wizdfire, wizdfire, wizdfire, wizdfire, ROT0, "Data East Corporation", "Dark Seal 2 (Japan v2.1)", GAME_SUPPORTS_SAVE )
GAME( 1992, nitrobal, 0, nitrobal, nitrobal, nitrobal, ROT270, "Data East Corporation", "Nitro Ball (US)", GAME_SUPPORTS_SAVE )
GAME( 1992, gunball, nitrobal, nitrobal, nitrobal, nitrobal, ROT270, "Data East Corporation", "Gun Ball (Japan)", GAME_SUPPORTS_SAVE )
GAME( 1993, schmeisr, 0, schmeisr, schmeisr, schmeisr, ROT0, "Hot B", "Schmeiser Robo (Japan)", GAME_SUPPORTS_SAVE )

View File

@ -91,19 +91,14 @@ Are the OKI M6295 clocks from Heavy Smash are correct at least for the Mitchell
#include "emu.h"
#include "includes/decocrpt.h"
#include "cpu/arm/arm.h"
#include "includes/simpl156.h"
#include "machine/eeprom.h"
#include "sound/okim6295.h"
#include "video/deco16ic.h"
static UINT32 *simpl156_systemram;
extern UINT16 *simpl156_pf1_rowscroll,*simpl156_pf2_rowscroll;
extern VIDEO_START( simpl156 );
extern VIDEO_UPDATE( simpl156 );
static INPUT_PORTS_START( simpl156 )
PORT_START("IN0") /* 16bit */
PORT_START("IN0")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
@ -112,7 +107,7 @@ static INPUT_PORTS_START( simpl156 )
PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_SPECIAL ) // eeprom?..
PORT_START("IN1") /* 16bit */
PORT_START("IN1")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
@ -134,12 +129,11 @@ INPUT_PORTS_END
static READ32_HANDLER( simpl156_inputs_read )
{
int eep = eeprom_read_bit(devtag_get_device(space->machine, "eeprom"));
UINT32 returndata;
simpl156_state *state = (simpl156_state *)space->machine->driver_data;
int eep = eeprom_read_bit(state->eeprom);
UINT32 returndata = input_port_read(space->machine, "IN0") ^ 0xffff0000;
returndata = input_port_read(space->machine, "IN0") ^ 0xffff0000;
returndata^= ( (eep<<8) );
returndata ^= ((eep << 8));
return returndata;
}
@ -153,13 +147,13 @@ static WRITE32_HANDLER( simpl156_palette_w )
UINT16 dat;
int color;
data &=0x0000ffff;
mem_mask &=0x0000ffff;
data &= 0x0000ffff;
mem_mask &= 0x0000ffff;
COMBINE_DATA(&space->machine->generic.paletteram.u16[offset]);
color = offset;
dat = space->machine->generic.paletteram.u16[offset]&0xffff;
dat = space->machine->generic.paletteram.u16[offset] & 0xffff;
palette_set_color_rgb(space->machine,color,pal5bit(dat >> 0),pal5bit(dat >> 5),pal5bit(dat >> 10));
}
@ -175,16 +169,16 @@ static READ32_HANDLER( simpl156_system_r )
static WRITE32_HANDLER( simpl156_eeprom_w )
{
running_device *device = devtag_get_device(space->machine, "eeprom");
simpl156_state *state = (simpl156_state *)space->machine->driver_data;
//int okibank;
//okibank = data & 0x07;
okim6295_set_bank_base(devtag_get_device(space->machine, "okimusic"), 0x40000 * (data & 0x7) );
okim6295_set_bank_base(state->okimusic, 0x40000 * (data & 0x7));
eeprom_set_clock_line(device, (data & 0x20) ? ASSERT_LINE : CLEAR_LINE);
eeprom_write_bit(device, data & 0x10);
eeprom_set_cs_line(device, (data & 0x40) ? CLEAR_LINE : ASSERT_LINE);
eeprom_set_clock_line(state->eeprom, BIT(data, 5) ? ASSERT_LINE : CLEAR_LINE);
eeprom_write_bit(state->eeprom, BIT(data, 4));
eeprom_set_cs_line(state->eeprom, BIT(data, 6) ? CLEAR_LINE : ASSERT_LINE);
}
@ -192,57 +186,61 @@ static WRITE32_HANDLER( simpl156_eeprom_w )
static READ32_HANDLER( simpl156_spriteram_r )
{
return space->machine->generic.spriteram.u32[offset]^0xffff0000;
return space->machine->generic.spriteram.u32[offset] ^ 0xffff0000;
}
static WRITE32_HANDLER( simpl156_spriteram_w )
{
data &=0x0000ffff;
mem_mask &=0x0000ffff;
data &= 0x0000ffff;
mem_mask &= 0x0000ffff;
COMBINE_DATA(&space->machine->generic.spriteram.u32[offset]);
}
static UINT32*simpl156_mainram;
static READ32_HANDLER( simpl156_mainram_r )
{
return simpl156_mainram[offset]^0xffff0000;
simpl156_state *state = (simpl156_state *)space->machine->driver_data;
return state->mainram[offset]^0xffff0000;
}
static WRITE32_HANDLER( simpl156_mainram_w )
{
data &=0x0000ffff;
mem_mask &=0x0000ffff;
simpl156_state *state = (simpl156_state *)space->machine->driver_data;
data &= 0x0000ffff;
mem_mask &= 0x0000ffff;
COMBINE_DATA(&simpl156_mainram[offset]);
COMBINE_DATA(&state->mainram[offset]);
}
static READ32_HANDLER( simpl156_pf1_rowscroll_r )
{
return simpl156_pf1_rowscroll[offset]^0xffff0000;
simpl156_state *state = (simpl156_state *)space->machine->driver_data;
return state->pf1_rowscroll[offset] ^ 0xffff0000;
}
static WRITE32_HANDLER( simpl156_pf1_rowscroll_w )
{
data &=0x0000ffff;
mem_mask &=0x0000ffff;
simpl156_state *state = (simpl156_state *)space->machine->driver_data;
data &= 0x0000ffff;
mem_mask &= 0x0000ffff;
COMBINE_DATA(&simpl156_pf1_rowscroll[offset]);
COMBINE_DATA(&state->pf1_rowscroll[offset]);
}
static READ32_HANDLER( simpl156_pf2_rowscroll_r )
{
return simpl156_pf2_rowscroll[offset]^0xffff0000;
simpl156_state *state = (simpl156_state *)space->machine->driver_data;
return state->pf2_rowscroll[offset] ^ 0xffff0000;
}
static WRITE32_HANDLER( simpl156_pf2_rowscroll_w )
{
data &=0x0000ffff;
mem_mask &=0x0000ffff;
simpl156_state *state = (simpl156_state *)space->machine->driver_data;
data &= 0x0000ffff;
mem_mask &= 0x0000ffff;
COMBINE_DATA(&simpl156_pf2_rowscroll[offset]);
COMBINE_DATA(&state->pf2_rowscroll[offset]);
}
/* Memory Map controled by PALs */
@ -250,10 +248,10 @@ static WRITE32_HANDLER( simpl156_pf2_rowscroll_w )
/* Joe and Mac Returns */
static ADDRESS_MAP_START( joemacr_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x000000, 0x07ffff) AM_ROM
AM_RANGE(0x100000, 0x107fff) AM_READWRITE(simpl156_mainram_r, simpl156_mainram_w) AM_BASE(&simpl156_mainram) // main ram
AM_RANGE(0x100000, 0x107fff) AM_READWRITE(simpl156_mainram_r, simpl156_mainram_w) AM_BASE_MEMBER(simpl156_state, mainram) // main ram
AM_RANGE(0x110000, 0x111fff) AM_READWRITE(simpl156_spriteram_r, simpl156_spriteram_w) AM_BASE_SIZE_GENERIC(spriteram)
AM_RANGE(0x120000, 0x120fff) AM_READWRITE(simpl156_palette_r,simpl156_palette_w)
AM_RANGE(0x130000, 0x130003) AM_READWRITE(simpl156_system_r,simpl156_eeprom_w)
AM_RANGE(0x120000, 0x120fff) AM_READWRITE(simpl156_palette_r, simpl156_palette_w)
AM_RANGE(0x130000, 0x130003) AM_READWRITE(simpl156_system_r, simpl156_eeprom_w)
AM_RANGE(0x140000, 0x14001f) AM_DEVREADWRITE("deco_custom", deco16ic_pf12_control_dword_r, deco16ic_pf12_control_dword_w)
AM_RANGE(0x150000, 0x151fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf1_data_dword_r, deco16ic_pf1_data_dword_w)
AM_RANGE(0x152000, 0x153fff) AM_DEVREADWRITE("deco_custom", deco16ic_pf1_data_dword_r, deco16ic_pf1_data_dword_w)
@ -264,7 +262,7 @@ static ADDRESS_MAP_START( joemacr_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x180000, 0x180003) AM_DEVREADWRITE8("okisfx", okim6295_r, okim6295_w, 0x000000ff)
AM_RANGE(0x1c0000, 0x1c0003) AM_DEVREADWRITE8("okimusic", okim6295_r, okim6295_w, 0x000000ff)
AM_RANGE(0x200000, 0x200003) AM_READ(simpl156_inputs_read)
AM_RANGE(0x201000, 0x201fff) AM_RAM AM_BASE(&simpl156_systemram) // work ram (32-bit)
AM_RANGE(0x201000, 0x201fff) AM_RAM AM_BASE_MEMBER(simpl156_state, systemram) // work ram (32-bit)
ADDRESS_MAP_END
@ -272,9 +270,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( chainrec_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x000000, 0x07ffff) AM_ROM // rom (32-bit)
AM_RANGE(0x200000, 0x200003) AM_READ(simpl156_inputs_read)
AM_RANGE(0x201000, 0x201fff) AM_RAM AM_BASE(&simpl156_systemram) // work ram (32-bit)
AM_RANGE(0x201000, 0x201fff) AM_RAM AM_BASE_MEMBER(simpl156_state, systemram) // work ram (32-bit)
AM_RANGE(0x3c0000, 0x3c0003) AM_DEVREADWRITE8("okimusic", okim6295_r, okim6295_w, 0x000000ff)
AM_RANGE(0x400000, 0x407fff) AM_READWRITE(simpl156_mainram_r, simpl156_mainram_w) AM_BASE(&simpl156_mainram) // main ram?
AM_RANGE(0x400000, 0x407fff) AM_READWRITE(simpl156_mainram_r, simpl156_mainram_w) AM_BASE_MEMBER(simpl156_state, mainram) // main ram?
AM_RANGE(0x410000, 0x411fff) AM_READWRITE(simpl156_spriteram_r, simpl156_spriteram_w) AM_BASE_SIZE_GENERIC(spriteram)
AM_RANGE(0x420000, 0x420fff) AM_READWRITE(simpl156_palette_r,simpl156_palette_w)
AM_RANGE(0x430000, 0x430003) AM_READWRITE(simpl156_system_r,simpl156_eeprom_w)
@ -293,9 +291,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( magdrop_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x000000, 0x07ffff) AM_ROM
AM_RANGE(0x200000, 0x200003) AM_READ(simpl156_inputs_read)
AM_RANGE(0x201000, 0x201fff) AM_RAM AM_BASE(&simpl156_systemram) // work ram (32-bit)
AM_RANGE(0x201000, 0x201fff) AM_RAM AM_BASE_MEMBER(simpl156_state, systemram) // work ram (32-bit)
AM_RANGE(0x340000, 0x340003) AM_DEVREADWRITE8("okimusic", okim6295_r, okim6295_w, 0x000000ff)
AM_RANGE(0x380000, 0x387fff) AM_READWRITE(simpl156_mainram_r, simpl156_mainram_w) AM_BASE(&simpl156_mainram) // main ram?
AM_RANGE(0x380000, 0x387fff) AM_READWRITE(simpl156_mainram_r, simpl156_mainram_w) AM_BASE_MEMBER(simpl156_state, mainram) // main ram?
AM_RANGE(0x390000, 0x391fff) AM_READWRITE(simpl156_spriteram_r, simpl156_spriteram_w) AM_BASE_SIZE_GENERIC(spriteram)
AM_RANGE(0x3a0000, 0x3a0fff) AM_READWRITE(simpl156_palette_r,simpl156_palette_w)
AM_RANGE(0x3b0000, 0x3b0003) AM_READWRITE(simpl156_system_r,simpl156_eeprom_w)
@ -314,9 +312,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( magdropp_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x000000, 0x07ffff) AM_ROM
AM_RANGE(0x200000, 0x200003) AM_READ(simpl156_inputs_read)
AM_RANGE(0x201000, 0x201fff) AM_RAM AM_BASE(&simpl156_systemram) // work ram (32-bit)
AM_RANGE(0x201000, 0x201fff) AM_RAM AM_BASE_MEMBER(simpl156_state, systemram) // work ram (32-bit)
AM_RANGE(0x4c0000, 0x4c0003) AM_DEVREADWRITE8("okimusic", okim6295_r, okim6295_w, 0x000000ff)
AM_RANGE(0x680000, 0x687fff) AM_READWRITE(simpl156_mainram_r, simpl156_mainram_w) AM_BASE(&simpl156_mainram) // main ram?
AM_RANGE(0x680000, 0x687fff) AM_READWRITE(simpl156_mainram_r, simpl156_mainram_w) AM_BASE_MEMBER(simpl156_state, mainram) // main ram?
AM_RANGE(0x690000, 0x691fff) AM_READWRITE(simpl156_spriteram_r, simpl156_spriteram_w) AM_BASE_SIZE_GENERIC(spriteram)
AM_RANGE(0x6a0000, 0x6a0fff) AM_READWRITE(simpl156_palette_r,simpl156_palette_w)
AM_RANGE(0x6b0000, 0x6b0003) AM_READWRITE(simpl156_system_r,simpl156_eeprom_w)
@ -336,7 +334,7 @@ static ADDRESS_MAP_START( mitchell156_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x000000, 0x07ffff) AM_ROM
AM_RANGE(0x100000, 0x100003) AM_DEVREADWRITE8("okisfx", okim6295_r, okim6295_w, 0x000000ff)
AM_RANGE(0x140000, 0x140003) AM_DEVREADWRITE8("okimusic", okim6295_r, okim6295_w, 0x000000ff)
AM_RANGE(0x180000, 0x187fff) AM_READWRITE(simpl156_mainram_r, simpl156_mainram_w) AM_BASE(&simpl156_mainram) // main ram
AM_RANGE(0x180000, 0x187fff) AM_READWRITE(simpl156_mainram_r, simpl156_mainram_w) AM_BASE_MEMBER(simpl156_state, mainram) // main ram
AM_RANGE(0x190000, 0x191fff) AM_READWRITE(simpl156_spriteram_r, simpl156_spriteram_w) AM_BASE_SIZE_GENERIC(spriteram)
AM_RANGE(0x1a0000, 0x1a0fff) AM_READWRITE(simpl156_palette_r,simpl156_palette_w)
AM_RANGE(0x1b0000, 0x1b0003) AM_READWRITE(simpl156_system_r,simpl156_eeprom_w)
@ -348,7 +346,7 @@ static ADDRESS_MAP_START( mitchell156_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x1e4000, 0x1e5fff) AM_READWRITE(simpl156_pf2_rowscroll_r, simpl156_pf2_rowscroll_w)
AM_RANGE(0x1f0000, 0x1f0003) AM_READONLY AM_WRITENOP // ?
AM_RANGE(0x200000, 0x200003) AM_READ(simpl156_inputs_read)
AM_RANGE(0x201000, 0x201fff) AM_RAM AM_BASE(&simpl156_systemram) // work ram (32-bit)
AM_RANGE(0x201000, 0x201fff) AM_RAM AM_BASE_MEMBER(simpl156_state, systemram) // work ram (32-bit)
ADDRESS_MAP_END
@ -417,15 +415,30 @@ static const deco16ic_interface simpl156_deco16ic_intf =
NULL
};
static MACHINE_DRIVER_START( chainrec )
/* basic machine hardware */
static MACHINE_START( simpl156 )
{
simpl156_state *state = (simpl156_state *)machine->driver_data;
state->maincpu = devtag_get_device(machine, "maincpu");
state->deco16ic = devtag_get_device(machine, "deco_custom");
state->eeprom = devtag_get_device(machine, "eeprom");
state->okimusic = devtag_get_device(machine, "okimusic");
}
static MACHINE_DRIVER_START( chainrec )
/* driver data */
MDRV_DRIVER_DATA(simpl156_state)
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", ARM, 28000000 /* /4 */) /*DE156*/ /* 7.000 MHz */ /* measured at 7.. seems to need 28? */
MDRV_CPU_PROGRAM_MAP(chainrec_map)
MDRV_CPU_VBLANK_INT("screen", simpl156_vbl_interrupt)
MDRV_EEPROM_93C46_ADD("eeprom") // 93C45
MDRV_MACHINE_START(simpl156)
/* video hardware */
MDRV_SCREEN_ADD("screen", RASTER)
MDRV_SCREEN_REFRESH_RATE(58)
@ -443,7 +456,6 @@ static MACHINE_DRIVER_START( chainrec )
MDRV_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
MDRV_SOUND_ADD("okisfx", OKIM6295, 32220000/32)
MDRV_SOUND_CONFIG(okim6295_interface_pin7high)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.6)
@ -489,37 +501,6 @@ static MACHINE_DRIVER_START( mitchell156 )
MACHINE_DRIVER_END
static DRIVER_INIT(simpl156)
{
UINT8 *rom = memory_region(machine, "okimusic");
int length = memory_region_length(machine, "okimusic");
UINT8 *buf1 = auto_alloc_array(machine, UINT8, length);
UINT32 x;
/* hmm low address line goes to banking chip instead? */
for (x=0;x<length;x++)
{
UINT32 addr;
addr = BITSWAP24 (x,23,22,21,0, 20,
19,18,17,16,
15,14,13,12,
11,10,9, 8,
7, 6, 5, 4,
3, 2, 1 );
buf1[addr] = rom[x];
}
memcpy(rom,buf1,length);
auto_free (machine, buf1);
deco56_decrypt_gfx(machine, "gfx1");
deco156_decrypt(machine);
}
/*
Joe and Mac Returns
@ -1050,15 +1031,48 @@ ROM_END
*/
static DRIVER_INIT( simpl156 )
{
UINT8 *rom = memory_region(machine, "okimusic");
int length = memory_region_length(machine, "okimusic");
UINT8 *buf1 = auto_alloc_array(machine, UINT8, length);
UINT32 x;
/* hmm low address line goes to banking chip instead? */
for (x = 0; x < length; x++)
{
UINT32 addr;
addr = BITSWAP24 (x,23,22,21,0, 20,
19,18,17,16,
15,14,13,12,
11,10,9, 8,
7, 6, 5, 4,
3, 2, 1 );
buf1[addr] = rom[x];
}
memcpy(rom, buf1, length);
auto_free(machine, buf1);
deco56_decrypt_gfx(machine, "gfx1");
deco156_decrypt(machine);
}
/* Everything seems more stable if we run the CPU speed x4 and use Idle skips.. maybe it has an internal multipler? */
static READ32_HANDLER( joemacr_speedup_r )
{
if (cpu_get_pc(space->cpu)==0x284) cpu_spinuntil_time(space->cpu, ATTOTIME_IN_USEC(400));
return simpl156_systemram[0x18/4];
simpl156_state *state = (simpl156_state *)space->machine->driver_data;
if (cpu_get_pc(space->cpu) == 0x284)
cpu_spinuntil_time(space->cpu, ATTOTIME_IN_USEC(400));
return state->systemram[0x18/4];
}
static DRIVER_INIT (joemacr)
static DRIVER_INIT( joemacr )
{
memory_install_read32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0201018, 0x020101b, 0, 0, joemacr_speedup_r );
DRIVER_INIT_CALL(simpl156);
@ -1066,11 +1080,13 @@ static DRIVER_INIT (joemacr)
static READ32_HANDLER( chainrec_speedup_r )
{
if (cpu_get_pc(space->cpu)==0x2d4) cpu_spinuntil_time(space->cpu, ATTOTIME_IN_USEC(400));
return simpl156_systemram[0x18/4];
simpl156_state *state = (simpl156_state *)space->machine->driver_data;
if (cpu_get_pc(space->cpu) == 0x2d4)
cpu_spinuntil_time(space->cpu, ATTOTIME_IN_USEC(400));
return state->systemram[0x18/4];
}
static DRIVER_INIT (chainrec)
static DRIVER_INIT( chainrec )
{
memory_install_read32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0201018, 0x020101b, 0, 0, chainrec_speedup_r );
DRIVER_INIT_CALL(simpl156);
@ -1078,11 +1094,13 @@ static DRIVER_INIT (chainrec)
static READ32_HANDLER( prtytime_speedup_r )
{
if (cpu_get_pc(space->cpu)==0x4f0) cpu_spinuntil_time(space->cpu, ATTOTIME_IN_USEC(400));
return simpl156_systemram[0xae0/4];
simpl156_state *state = (simpl156_state *)space->machine->driver_data;
if (cpu_get_pc(space->cpu) == 0x4f0)
cpu_spinuntil_time(space->cpu, ATTOTIME_IN_USEC(400));
return state->systemram[0xae0/4];
}
static DRIVER_INIT (prtytime)
static DRIVER_INIT( prtytime )
{
memory_install_read32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0201ae0, 0x0201ae3, 0, 0, prtytime_speedup_r );
DRIVER_INIT_CALL(simpl156);
@ -1091,11 +1109,13 @@ static DRIVER_INIT (prtytime)
static READ32_HANDLER( charlien_speedup_r )
{
if (cpu_get_pc(space->cpu)==0xc8c8) cpu_spinuntil_time(space->cpu, ATTOTIME_IN_USEC(400));
return simpl156_systemram[0x10/4];
simpl156_state *state = (simpl156_state *)space->machine->driver_data;
if (cpu_get_pc(space->cpu) == 0xc8c8)
cpu_spinuntil_time(space->cpu, ATTOTIME_IN_USEC(400));
return state->systemram[0x10/4];
}
static DRIVER_INIT (charlien)
static DRIVER_INIT( charlien )
{
memory_install_read32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0201010, 0x0201013, 0, 0, charlien_speedup_r );
DRIVER_INIT_CALL(simpl156);
@ -1103,11 +1123,13 @@ static DRIVER_INIT (charlien)
static READ32_HANDLER( osman_speedup_r )
{
if (cpu_get_pc(space->cpu)==0x5974) cpu_spinuntil_time(space->cpu, ATTOTIME_IN_USEC(400));
return simpl156_systemram[0x10/4];
simpl156_state *state = (simpl156_state *)space->machine->driver_data;
if (cpu_get_pc(space->cpu) == 0x5974)
cpu_spinuntil_time(space->cpu, ATTOTIME_IN_USEC(400));
return state->systemram[0x10/4];
}
static DRIVER_INIT (osman)
static DRIVER_INIT( osman )
{
memory_install_read32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0201010, 0x0201013, 0, 0, osman_speedup_r );
DRIVER_INIT_CALL(simpl156);
@ -1115,15 +1137,15 @@ static DRIVER_INIT (osman)
}
/* Data East games running on the DE-0409-1 or DE-0491-1 PCB */
GAME( 1994, joemacr, 0, joemacr, simpl156, joemacr, ROT0, "Data East", "Joe & Mac Returns (World, Version 1.1, 1994.05.27)", 0 ) /* bootleg board with genuine DECO parts */
GAME( 1994, joemacra, joemacr, joemacr, simpl156, joemacr, ROT0, "Data East", "Joe & Mac Returns (World, Version 1.0, 1994.05.19)", 0 )
GAME( 1995, chainrec, 0, chainrec, simpl156, chainrec, ROT0, "Data East", "Chain Reaction (World, Version 2.2, 1995.09.25)", 0 )
GAME( 1995, magdrop, chainrec, magdrop, simpl156, chainrec, ROT0, "Data East", "Magical Drop (Japan, Version 1.1, 1995.06.21)", 0 )
GAME( 1995, magdropp, chainrec, magdropp, simpl156, chainrec, ROT0, "Data East", "Magical Drop Plus 1 (Japan, Version 2.1, 1995.09.12)", 0 )
GAME( 1994, joemacr, 0, joemacr, simpl156, joemacr, ROT0, "Data East", "Joe & Mac Returns (World, Version 1.1, 1994.05.27)", GAME_SUPPORTS_SAVE ) /* bootleg board with genuine DECO parts */
GAME( 1994, joemacra, joemacr, joemacr, simpl156, joemacr, ROT0, "Data East", "Joe & Mac Returns (World, Version 1.0, 1994.05.19)", GAME_SUPPORTS_SAVE )
GAME( 1995, chainrec, 0, chainrec, simpl156, chainrec, ROT0, "Data East", "Chain Reaction (World, Version 2.2, 1995.09.25)", GAME_SUPPORTS_SAVE )
GAME( 1995, magdrop, chainrec, magdrop, simpl156, chainrec, ROT0, "Data East", "Magical Drop (Japan, Version 1.1, 1995.06.21)", GAME_SUPPORTS_SAVE )
GAME( 1995, magdropp, chainrec, magdropp, simpl156, chainrec, ROT0, "Data East", "Magical Drop Plus 1 (Japan, Version 2.1, 1995.09.12)", GAME_SUPPORTS_SAVE )
/* Mitchell games running on the DEC-22VO / MT5601-0 PCB */
GAME( 1995, charlien, 0, mitchell156, simpl156, charlien, ROT0, "Mitchell", "Charlie Ninja" , 0) /* language in service mode */
GAME( 1995, prtytime, 0, mitchell156, simpl156, prtytime, ROT90, "Mitchell", "Party Time: Gonta the Diver II / Ganbare! Gonta!! 2 (World Release)", 0) /* language in service mode */
GAME( 1995, gangonta, prtytime, mitchell156, simpl156, prtytime, ROT90, "Mitchell", "Ganbare! Gonta!! 2 / Party Time: Gonta the Diver II (Japan Release)", 0) /* language in service mode */
GAME( 1996, osman, 0, mitchell156, simpl156, osman, ROT0, "Mitchell", "Osman (World)", 0 )
GAME( 1996, candance, osman, mitchell156, simpl156, osman, ROT0, "Mitchell (Atlus License)", "Cannon Dancer (Japan)", 0 )
GAME( 1995, charlien, 0, mitchell156, simpl156, charlien, ROT0, "Mitchell", "Charlie Ninja" , GAME_SUPPORTS_SAVE ) /* language in service mode */
GAME( 1995, prtytime, 0, mitchell156, simpl156, prtytime, ROT90, "Mitchell", "Party Time: Gonta the Diver II / Ganbare! Gonta!! 2 (World Release)", GAME_SUPPORTS_SAVE ) /* language in service mode */
GAME( 1995, gangonta, prtytime, mitchell156, simpl156, prtytime, ROT90, "Mitchell", "Ganbare! Gonta!! 2 / Party Time: Gonta the Diver II (Japan Release)", GAME_SUPPORTS_SAVE ) /* language in service mode */
GAME( 1996, osman, 0, mitchell156, simpl156, osman, ROT0, "Mitchell", "Osman (World)", GAME_SUPPORTS_SAVE )
GAME( 1996, candance, osman, mitchell156, simpl156, osman, ROT0, "Mitchell (Atlus License)", "Cannon Dancer (Japan)", GAME_SUPPORTS_SAVE )

View File

@ -0,0 +1,32 @@
/*************************************************************************
Boogie Wings
*************************************************************************/
class boogwing_state
{
public:
static void *alloc(running_machine &machine) { return auto_alloc_clear(&machine, boogwing_state(machine)); }
boogwing_state(running_machine &machine) { }
/* memory pointers */
UINT16 * pf1_rowscroll;
UINT16 * pf2_rowscroll;
UINT16 * pf3_rowscroll;
UINT16 * pf4_rowscroll;
/* devices */
running_device *maincpu;
running_device *audiocpu;
running_device *deco16ic;
running_device *oki1;
running_device *oki2;
};
/*----------- defined in video/boogwing.c -----------*/
VIDEO_UPDATE( boogwing );

View File

@ -0,0 +1,38 @@
/*************************************************************************
Crude Buster
*************************************************************************/
class cbuster_state
{
public:
static void *alloc(running_machine &machine) { return auto_alloc_clear(&machine, cbuster_state(machine)); }
cbuster_state(running_machine &machine) { }
/* memory pointers */
UINT16 * pf1_rowscroll;
UINT16 * pf2_rowscroll;
UINT16 * pf3_rowscroll;
UINT16 * pf4_rowscroll;
UINT16 * ram;
/* misc */
UINT16 prot;
int pri;
/* devices */
running_device *maincpu;
running_device *audiocpu;
running_device *deco16ic;
};
/*----------- defined in video/cbuster.c -----------*/
WRITE16_HANDLER( twocrude_palette_24bit_rg_w );
WRITE16_HANDLER( twocrude_palette_24bit_b_w );
VIDEO_UPDATE( twocrude );

View File

@ -1,7 +1,35 @@
/*----------- defined in video/cninja.c -----------*/
/*************************************************************************
extern UINT16 *cninja_pf1_rowscroll,*cninja_pf2_rowscroll;
extern UINT16 *cninja_pf3_rowscroll,*cninja_pf4_rowscroll;
Caveman Ninja (and other DECO 16bit titles)
*************************************************************************/
class cninja_state
{
public:
static void *alloc(running_machine &machine) { return auto_alloc_clear(&machine, cninja_state(machine)); }
cninja_state(running_machine &machine) { }
/* memory pointers */
UINT16 * ram;
UINT16 * pf1_rowscroll;
UINT16 * pf2_rowscroll;
UINT16 * pf3_rowscroll;
UINT16 * pf4_rowscroll;
/* misc */
int scanline, irq_mask;
/* devices */
running_device *maincpu;
running_device *audiocpu;
running_device *deco16ic;
running_device *raster_irq_timer;
running_device *oki2;
};
/*----------- defined in video/cninja.c -----------*/
VIDEO_START( stoneage );
@ -10,5 +38,3 @@ VIDEO_UPDATE( cninjabl );
VIDEO_UPDATE( edrandy );
VIDEO_UPDATE( robocop2 );
VIDEO_UPDATE( mutantf );
VIDEO_EOF( cninja );

View File

@ -0,0 +1,33 @@
/*************************************************************************
Desert Assault
*************************************************************************/
class dassault_state
{
public:
static void *alloc(running_machine &machine) { return auto_alloc_clear(&machine, dassault_state(machine)); }
dassault_state(running_machine &machine) { }
/* memory pointers */
UINT16 * pf2_rowscroll;
UINT16 * pf4_rowscroll;
UINT16 * ram;
UINT16 * ram2;
UINT16 * shared_ram;
/* devices */
running_device *maincpu;
running_device *audiocpu;
running_device *subcpu;
running_device *deco16ic;
running_device *oki2;
};
/*----------- defined in video/dassault.c -----------*/
VIDEO_UPDATE( dassault );

40
src/mame/includes/rohga.h Normal file
View File

@ -0,0 +1,40 @@
/*************************************************************************
Data East 'Rohga' era hardware
*************************************************************************/
class rohga_state
{
public:
static void *alloc(running_machine &machine) { return auto_alloc_clear(&machine, rohga_state(machine)); }
rohga_state(running_machine &machine) { }
/* memory pointers */
UINT16 * pf1_rowscroll;
UINT16 * pf2_rowscroll;
UINT16 * pf3_rowscroll;
UINT16 * pf4_rowscroll;
UINT16 * spriteram;
/* devices */
running_device *maincpu;
running_device *audiocpu;
running_device *deco16ic;
running_device *oki1;
running_device *oki2;
};
/*----------- defined in video/rohga.c -----------*/
WRITE16_HANDLER( rohga_buffer_spriteram16_w );
VIDEO_START( rohga );
VIDEO_UPDATE( rohga );
VIDEO_UPDATE( schmeisr );
VIDEO_UPDATE( wizdfire );
VIDEO_UPDATE( nitrobal );

View File

@ -0,0 +1,32 @@
/*************************************************************************
Simple 156 based board
*************************************************************************/
class simpl156_state
{
public:
static void *alloc(running_machine &machine) { return auto_alloc_clear(&machine, simpl156_state(machine)); }
simpl156_state(running_machine &machine) { }
/* memory pointers */
UINT16 * pf1_rowscroll;
UINT16 * pf2_rowscroll;
UINT32 * mainram;
UINT32 * systemram;
/* devices */
running_device *maincpu;
running_device *deco16ic;
running_device *eeprom;
running_device *okimusic;
};
/*----------- defined in video/simpl156.c -----------*/
VIDEO_START( simpl156 );
VIDEO_UPDATE( simpl156 );

View File

@ -1,96 +1,96 @@
#include "emu.h"
#include "includes/boogwing.h"
#include "video/deco16ic.h"
UINT16 *boogwing_pf1_rowscroll,*boogwing_pf2_rowscroll;
UINT16 *boogwing_pf3_rowscroll,*boogwing_pf4_rowscroll;
static void draw_sprites( running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect, UINT16* spriteram_base, int gfx_region )
static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT16* spriteram_base, int gfx_region )
{
running_device *deco16ic = devtag_get_device(machine, "deco_custom");
boogwing_state *state = (boogwing_state *)machine->driver_data;
int offs;
int flipscreen=!flip_screen_get(machine);
UINT16 priority = deco16ic_priority_r(deco16ic, 0, 0xffff);
int flipscreen = !flip_screen_get(machine);
UINT16 priority = deco16ic_priority_r(state->deco16ic, 0, 0xffff);
for (offs = 0x400-4;offs >= 0;offs -= 4)
for (offs = 0x400 - 4; offs >= 0; offs -= 4)
{
int x,y,sprite,colour,multi,fx,fy,inc,flash,mult,pri=0,spri=0;
int x, y, sprite, colour, multi, fx, fy, inc, flash, mult, pri = 0, spri = 0;
int alpha = 0xff;
sprite = spriteram_base[offs+1];
if (!sprite) continue;
sprite = spriteram_base[offs + 1];
if (!sprite)
continue;
y = spriteram_base[offs];
flash=y&0x1000;
if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue;
flash = y & 0x1000;
if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1))
continue;
x = spriteram_base[offs+2];
colour = (x >>9) & 0x1f;
x = spriteram_base[offs + 2];
colour = (x >> 9) & 0x1f;
fx = y & 0x2000;
fy = y & 0x4000;
multi = (1 << ((y & 0x0600) >> 9)) - 1; /* 1x, 2x, 4x, 8x height */
// Todo: This should be verified from the prom
if (gfx_region==4)
if (gfx_region == 4)
{
// Sprite 2 priority vs sprite 1
if ((spriteram_base[offs+2]&0xc000)==0xc000)
spri=4;
else if ((spriteram_base[offs+2]&0xc000))
spri=16;
if ((spriteram_base[offs + 2] & 0xc000) == 0xc000)
spri = 4;
else if ((spriteram_base[offs + 2] & 0xc000))
spri = 16;
else
spri=64;
spri = 64;
// Transparency
if (spriteram_base[offs+2]&0x2000)
if (spriteram_base[offs + 2] & 0x2000)
alpha = 0x80;
if (priority==0x2)
if (priority == 0x2)
{
// Additional sprite alpha in this mode
if (spriteram_base[offs+2]&0x8000)
if (spriteram_base[offs + 2] & 0x8000)
alpha = 0x80;
// Sprite vs playfield
if ((spriteram_base[offs+2]&0xc000)==0xc000)
pri=4;
else if ((spriteram_base[offs+2]&0xc000)==0x8000)
pri=16;
if ((spriteram_base[offs + 2] & 0xc000) == 0xc000)
pri = 4;
else if ((spriteram_base[offs + 2] & 0xc000) == 0x8000)
pri = 16;
else
pri=64;
pri = 64;
}
else
{
if ((spriteram_base[offs+2]&0x8000)==0x8000)
pri=16;
if ((spriteram_base[offs + 2] & 0x8000) == 0x8000)
pri = 16;
else
pri=64;
pri = 64;
}
}
else
{
// Sprite 1 priority vs sprite 2
if (spriteram_base[offs+2]&0x8000) // todo - check only in pri mode 2??
spri=8;
if (spriteram_base[offs + 2] & 0x8000) // todo - check only in pri mode 2??
spri = 8;
else
spri=32;
spri = 32;
// Sprite vs playfield
if (priority==0x1)
if (priority == 0x1)
{
if ((spriteram_base[offs+2]&0xc000))
pri=16;
if ((spriteram_base[offs + 2] & 0xc000))
pri = 16;
else
pri=64;
pri = 64;
}
else
{
if ((spriteram_base[offs+2]&0xc000)==0xc000)
pri=4;
else if ((spriteram_base[offs+2]&0xc000)==0x8000)
pri=16;
if ((spriteram_base[offs + 2] & 0xc000) == 0xc000)
pri = 4;
else if ((spriteram_base[offs + 2] & 0xc000) == 0x8000)
pri = 16;
else
pri=64;
pri = 64;
}
}
@ -112,18 +112,19 @@ static void draw_sprites( running_machine *machine, bitmap_t *bitmap,const recta
if (flipscreen)
{
y=240-y;
x=304-x;
if (fx) fx=0; else fx=1;
if (fy) fy=0; else fy=1;
mult=16;
y = 240 - y;
x = 304 - x;
if (fx) fx = 0; else fx = 1;
if (fy) fy = 0; else fy = 1;
mult = 16;
}
else mult=-16;
else
mult = -16;
while (multi >= 0)
{
deco16ic_pdrawgfx(
deco16ic,
state->deco16ic,
bitmap, cliprect, machine->gfx[gfx_region],
sprite - multi * inc,
colour,
@ -138,16 +139,16 @@ static void draw_sprites( running_machine *machine, bitmap_t *bitmap,const recta
VIDEO_UPDATE( boogwing )
{
running_device *deco16ic = devtag_get_device(screen->machine, "deco_custom");
UINT16 flip = deco16ic_pf12_control_r(deco16ic, 0, 0xffff);
UINT16 priority = deco16ic_priority_r(deco16ic, 0, 0xffff);
boogwing_state *state = (boogwing_state *)screen->machine->driver_data;
UINT16 flip = deco16ic_pf12_control_r(state->deco16ic, 0, 0xffff);
UINT16 priority = deco16ic_priority_r(state->deco16ic, 0, 0xffff);
flip_screen_set(screen->machine, BIT(flip, 7));
deco16ic_pf12_update(deco16ic, boogwing_pf1_rowscroll, boogwing_pf2_rowscroll);
deco16ic_pf34_update(deco16ic, boogwing_pf3_rowscroll, boogwing_pf4_rowscroll);
deco16ic_pf12_update(state->deco16ic, state->pf1_rowscroll, state->pf2_rowscroll);
deco16ic_pf34_update(state->deco16ic, state->pf3_rowscroll, state->pf4_rowscroll);
/* Draw playfields */
deco16ic_clear_sprite_priority_bitmap(deco16ic);
deco16ic_clear_sprite_priority_bitmap(state->deco16ic);
bitmap_fill(bitmap, cliprect, screen->machine->pens[0x400]); /* pen not confirmed */
bitmap_fill(screen->machine->priority_bitmap, NULL, 0);
@ -155,34 +156,34 @@ VIDEO_UPDATE( boogwing )
// bit&0x4 combines playfields
if ((priority & 0x7) == 0x5)
{
deco16ic_tilemap_2_draw(deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
deco16ic_tilemap_34_combine_draw(deco16ic, bitmap, cliprect, 0, 32);
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
deco16ic_tilemap_34_combine_draw(state->deco16ic, bitmap, cliprect, 0, 32);
}
else if ((priority & 0x7) == 0x1 || (priority & 0x7) == 0x2)
{
deco16ic_tilemap_4_draw(deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
deco16ic_tilemap_2_draw(deco16ic, bitmap, cliprect, 0, 8);
deco16ic_tilemap_3_draw(deco16ic, bitmap, cliprect, 0, 32);
deco16ic_tilemap_4_draw(state->deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, 0, 8);
deco16ic_tilemap_3_draw(state->deco16ic, bitmap, cliprect, 0, 32);
}
else if ((priority & 0x7) == 0x3)
{
deco16ic_tilemap_4_draw(deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
deco16ic_tilemap_2_draw(deco16ic, bitmap, cliprect, 0, 8);
deco16ic_tilemap_4_draw(state->deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, 0, 8);
// This mode uses playfield 3 to shadow sprites & playfield 2 (instead of
// regular alpha-blending, the destination is inverted). Not yet implemented.
// deco16ic_tilemap_3_draw(deco16ic, bitmap, cliprect, TILEMAP_DRAW_ALPHA(0x80), 32);
// deco16ic_tilemap_3_draw(state->deco16ic, bitmap, cliprect, TILEMAP_DRAW_ALPHA(0x80), 32);
}
else
{
deco16ic_tilemap_4_draw(deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
deco16ic_tilemap_3_draw(deco16ic, bitmap, cliprect, 0, 8);
deco16ic_tilemap_2_draw(deco16ic, bitmap, cliprect, 0, 32);
deco16ic_tilemap_4_draw(state->deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
deco16ic_tilemap_3_draw(state->deco16ic, bitmap, cliprect, 0, 8);
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, 0, 32);
}
draw_sprites(screen->machine, bitmap, cliprect, screen->machine->generic.buffered_spriteram.u16, 3);
draw_sprites(screen->machine, bitmap, cliprect, screen->machine->generic.buffered_spriteram2.u16, 4);
deco16ic_tilemap_1_draw(deco16ic, bitmap, cliprect, 0, 0);
deco16ic_tilemap_1_draw(state->deco16ic, bitmap, cliprect, 0, 0);
return 0;
}

View File

@ -5,24 +5,20 @@
***************************************************************************/
#include "emu.h"
#include "includes/cbuster.h"
#include "video/deco16ic.h"
static int twocrude_pri;
UINT16 *twocrude_pf1_rowscroll,*twocrude_pf2_rowscroll;
UINT16 *twocrude_pf3_rowscroll,*twocrude_pf4_rowscroll;
/******************************************************************************/
static void update_24bitcol(running_machine *machine, int offset)
static void update_24bitcol( running_machine *machine, int offset )
{
UINT8 r,g,b; /* The highest palette value seems to be 0x8e */
UINT8 r, g, b; /* The highest palette value seems to be 0x8e */
r = (UINT8)((float)((machine->generic.paletteram.u16[offset] >> 0) & 0xff)*1.75);
g = (UINT8)((float)((machine->generic.paletteram.u16[offset] >> 8) & 0xff)*1.75);
b = (UINT8)((float)((machine->generic.paletteram2.u16[offset] >> 0) & 0xff)*1.75);
r = (UINT8)((float)((machine->generic.paletteram.u16[offset] >> 0) & 0xff) * 1.75);
g = (UINT8)((float)((machine->generic.paletteram.u16[offset] >> 8) & 0xff) * 1.75);
b = (UINT8)((float)((machine->generic.paletteram2.u16[offset] >> 0) & 0xff) * 1.75);
palette_set_color(machine,offset,MAKE_RGB(r,g,b));
palette_set_color(machine, offset, MAKE_RGB(r, g, b));
}
WRITE16_HANDLER( twocrude_palette_24bit_rg_w )
@ -37,38 +33,37 @@ WRITE16_HANDLER( twocrude_palette_24bit_b_w )
update_24bitcol(space->machine, offset);
}
/******************************************************************************/
void twocrude_pri_w(int pri)
{
twocrude_pri = pri;
}
/******************************************************************************/
static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int pri )
{
UINT16 *buffered_spriteram16 = machine->generic.buffered_spriteram.u16;
UINT16 *buffered_spriteram = machine->generic.buffered_spriteram.u16;
int offs;
for (offs = 0;offs < 0x400;offs += 4)
for (offs = 0; offs < 0x400; offs += 4)
{
int x,y,sprite,colour,multi,fx,fy,inc,flash,mult;
int x, y, sprite, colour, multi, fx, fy, inc, flash, mult;
sprite = buffered_spriteram16[offs+1] & 0x7fff;
if (!sprite) continue;
sprite = buffered_spriteram[offs + 1] & 0x7fff;
if (!sprite)
continue;
y = buffered_spriteram16[offs];
x = buffered_spriteram16[offs+2];
y = buffered_spriteram[offs];
x = buffered_spriteram[offs + 2];
if ((y&0x8000) && pri==1) continue;
if (!(y&0x8000) && pri==0) continue;
if ((y & 0x8000) && pri == 1)
continue;
if (!(y & 0x8000) && pri == 0)
continue;
colour = (x >> 9) &0xf;
if (x&0x2000) colour+=64;
colour = (x >> 9) & 0xf;
if (x & 0x2000)
colour += 64;
flash=y&0x1000;
if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue;
flash = y & 0x1000;
if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1))
continue;
fx = y & 0x2000;
fy = y & 0x4000;
@ -81,7 +76,8 @@ static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rect
x = 240 - x;
y = 240 - y;
if (x>256) continue; /* Speedup */
if (x > 256)
continue; /* Speedup */
sprite &= ~multi;
if (fy)
@ -92,14 +88,15 @@ static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rect
inc = 1;
}
if (flip_screen_get(machine)) {
y=240-y;
x=240-x;
if (fx) fx=0; else fx=1;
if (fy) fy=0; else fy=1;
mult=16;
if (flip_screen_get(machine))
{
y = 240 - y;
x = 240 - x;
if (fx) fx = 0; else fx = 1;
if (fy) fy = 0; else fy = 1;
mult = 16;
}
else mult=-16;
else mult = -16;
while (multi >= 0)
{
@ -118,30 +115,30 @@ static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rect
VIDEO_UPDATE( twocrude )
{
running_device *deco16ic = devtag_get_device(screen->machine, "deco_custom");
UINT16 flip = deco16ic_pf12_control_r(deco16ic, 0, 0xffff);
cbuster_state *state = (cbuster_state *)screen->machine->driver_data;
UINT16 flip = deco16ic_pf12_control_r(state->deco16ic, 0, 0xffff);
flip_screen_set(screen->machine, !BIT(flip, 7));
deco16ic_pf12_update(deco16ic, twocrude_pf1_rowscroll, twocrude_pf2_rowscroll);
deco16ic_pf34_update(deco16ic, twocrude_pf3_rowscroll, twocrude_pf4_rowscroll);
deco16ic_pf12_update(state->deco16ic, state->pf1_rowscroll, state->pf2_rowscroll);
deco16ic_pf34_update(state->deco16ic, state->pf3_rowscroll, state->pf4_rowscroll);
/* Draw playfields & sprites */
deco16ic_tilemap_4_draw(deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
deco16ic_tilemap_4_draw(state->deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
draw_sprites(screen->machine, bitmap, cliprect, 0);
if (twocrude_pri)
if (state->pri)
{
deco16ic_tilemap_2_draw(deco16ic, bitmap, cliprect, 0, 0);
deco16ic_tilemap_3_draw(deco16ic, bitmap, cliprect, 0, 0);
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, 0, 0);
deco16ic_tilemap_3_draw(state->deco16ic, bitmap, cliprect, 0, 0);
}
else
{
deco16ic_tilemap_3_draw(deco16ic, bitmap, cliprect, 0, 0);
deco16ic_tilemap_2_draw(deco16ic, bitmap, cliprect, 0, 0);
deco16ic_tilemap_3_draw(state->deco16ic, bitmap, cliprect, 0, 0);
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, 0, 0);
}
draw_sprites(screen->machine, bitmap, cliprect, 1);
deco16ic_tilemap_1_draw(deco16ic, bitmap, cliprect, 0, 0);
deco16ic_tilemap_1_draw(state->deco16ic, bitmap, cliprect, 0, 0);
return 0;
}

View File

@ -8,49 +8,50 @@
#include "video/deco16ic.h"
#include "includes/cninja.h"
UINT16 *cninja_pf1_rowscroll,*cninja_pf2_rowscroll;
UINT16 *cninja_pf3_rowscroll,*cninja_pf4_rowscroll;
/******************************************************************************/
VIDEO_START( stoneage )
{
running_device *deco16ic = devtag_get_device(machine, "deco_custom");
cninja_state *state = (cninja_state *)machine->driver_data;
/* The bootleg has broken scroll registers */
deco16ic_set_scrolldx(deco16ic, 3, 0, -10, -10); /* pf4 16x16 tilemap */
deco16ic_set_scrolldx(deco16ic, 1, 0, -10, -10); /* pf2 16x16 tilemap */
deco16ic_set_scrolldx(deco16ic, 0, 1, 2, 2); /* pf1 8x8 tilemap */
deco16ic_set_scrolldx(state->deco16ic, 3, 0, -10, -10); /* pf4 16x16 tilemap */
deco16ic_set_scrolldx(state->deco16ic, 1, 0, -10, -10); /* pf2 16x16 tilemap */
deco16ic_set_scrolldx(state->deco16ic, 0, 1, 2, 2); /* pf1 8x8 tilemap */
}
/******************************************************************************/
static void cninja_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
static void cninja_draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
{
UINT16 *buffered_spriteram16 = machine->generic.buffered_spriteram.u16;
UINT16 *buffered_spriteram = machine->generic.buffered_spriteram.u16;
int offs;
for (offs = 0x400-4;offs >=0 ;offs -= 4)
for (offs = 0x400 - 4; offs >=0 ; offs -= 4)
{
int x,y,sprite,colour,multi,fx,fy,inc,flash,mult,pri=0;
int x, y, sprite, colour, multi, fx, fy, inc, flash, mult, pri = 0;
sprite = buffered_spriteram16[offs+1];
if (!sprite) continue;
sprite = buffered_spriteram[offs + 1];
if (!sprite)
continue;
x = buffered_spriteram16[offs+2];
x = buffered_spriteram[offs + 2];
/* Sprite/playfield priority */
switch (x&0xc000) {
case 0x0000: pri=0; break;
case 0x4000: pri=0xf0; break;
case 0x8000: pri=0xf0|0xcc; break;
case 0xc000: pri=0xf0|0xcc; break; /* Perhaps 0xf0|0xcc|0xaa (Sprite under bottom layer) */
switch (x & 0xc000)
{
case 0x0000: pri = 0; break;
case 0x4000: pri = 0xf0; break;
case 0x8000: pri = 0xf0 | 0xcc; break;
case 0xc000: pri = 0xf0 | 0xcc; break; /* Perhaps 0xf0|0xcc|0xaa (Sprite under bottom layer) */
}
y = buffered_spriteram16[offs];
flash=y&0x1000;
if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue;
colour = (x >> 9) &0x1f;
y = buffered_spriteram[offs];
flash = y & 0x1000;
if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1))
continue;
colour = (x >> 9) & 0x1f;
fx = y & 0x2000;
fy = y & 0x4000;
@ -72,14 +73,16 @@ static void cninja_draw_sprites(running_machine *machine, bitmap_t *bitmap, cons
inc = 1;
}
if (flip_screen_get(machine)) {
y=240-y;
x=240-x;
if (fx) fx=0; else fx=1;
if (fy) fy=0; else fy=1;
mult=16;
if (flip_screen_get(machine))
{
y = 240 - y;
x = 240 - x;
if (fx) fx = 0; else fx = 1;
if (fy) fy = 0; else fy = 1;
mult = 16;
}
else mult=-16;
else
mult = -16;
while (multi >= 0)
{
@ -96,61 +99,59 @@ static void cninja_draw_sprites(running_machine *machine, bitmap_t *bitmap, cons
}
/* The bootleg sprites are in a different format! */
static void cninjabl_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
static void cninjabl_draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
{
UINT16 *buffered_spriteram16 = machine->generic.buffered_spriteram.u16;
UINT16 *buffered_spriteram = machine->generic.buffered_spriteram.u16;
int offs;
int endoffs;
// bootleg seems to use 0x180 as an end of list marker
// find it first, so we can use normal list processing
endoffs = 0x400-4;
for (offs = 0;offs <0x400-4 ;offs += 4)
endoffs = 0x400 - 4;
for (offs = 0; offs < 0x400 - 4 ; offs += 4)
{
int y;
int y = buffered_spriteram[offs + 1];
y = buffered_spriteram16[offs+1];
if (y==0x180)
if (y == 0x180)
{
endoffs = offs;
offs = 0x400-4;
offs = 0x400 - 4;
}
}
for (offs = endoffs;offs >=0 ;offs -= 4)
for (offs = endoffs; offs >=0 ; offs -= 4)
{
int x,y,sprite,colour,multi,fx,fy,inc,flash,mult,pri=0;
int x, y, sprite, colour, multi, fx, fy, inc, flash, mult, pri = 0;
sprite = buffered_spriteram16[offs+0]; // changed on bootleg!
y = buffered_spriteram16[offs+1]; // changed on bootleg!
sprite = buffered_spriteram[offs + 0]; // changed on bootleg!
y = buffered_spriteram[offs + 1]; // changed on bootleg!
if (!sprite) continue;
if (!sprite)
continue;
x = buffered_spriteram16[offs+2];
x = buffered_spriteram[offs + 2];
/* Sprite/playfield priority */
switch (x&0xc000) {
case 0x0000: pri=0; break;
case 0x4000: pri=0xf0; break;
case 0x8000: pri=0xf0|0xcc; break;
case 0xc000: pri=0xf0|0xcc; break; /* Perhaps 0xf0|0xcc|0xaa (Sprite under bottom layer) */
switch (x & 0xc000)
{
case 0x0000: pri = 0; break;
case 0x4000: pri = 0xf0; break;
case 0x8000: pri = 0xf0 | 0xcc; break;
case 0xc000: pri = 0xf0 | 0xcc; break; /* Perhaps 0xf0|0xcc|0xaa (Sprite under bottom layer) */
}
flash = y & 0x1000;
if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1))
continue;
flash=y&0x1000;
if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue;
colour = (x >> 9) &0x1f;
colour = (x >> 9) & 0x1f;
fx = y & 0x2000;
fy = y & 0x4000;
multi = (1 << ((y & 0x0600) >> 9)) - 1; /* 1x, 2x, 4x, 8x height */
y -= multi*16; // changed on bootleg!
y -= multi * 16; // changed on bootleg!
y += 4;
x = x & 0x01ff;
@ -169,14 +170,16 @@ static void cninjabl_draw_sprites(running_machine *machine, bitmap_t *bitmap, co
inc = 1;
}
if (flip_screen_get(machine)) {
y=240-y;
x=240-x;
if (fx) fx=0; else fx=1;
if (fy) fy=0; else fy=1;
mult=16;
if (flip_screen_get(machine))
{
y = 240 - y;
x = 240 - x;
if (fx) fx = 0; else fx = 1;
if (fy) fy = 0; else fy = 1;
mult = 16;
}
else mult=-16;
else
mult = -16;
while (multi >= 0)
{
@ -193,31 +196,34 @@ static void cninjabl_draw_sprites(running_machine *machine, bitmap_t *bitmap, co
}
static void robocop2_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
static void robocop2_draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
{
UINT16 *buffered_spriteram16 = machine->generic.buffered_spriteram.u16;
UINT16 *buffered_spriteram = machine->generic.buffered_spriteram.u16;
int offs;
for (offs = 0x400-4;offs >=0 ;offs -= 4)
for (offs = 0x400 - 4; offs >=0 ; offs -= 4)
{
int x,y,sprite,colour,multi,fx,fy,inc,flash,mult,pri=0;
sprite = buffered_spriteram16[offs+1];
if (!sprite) continue;
int x, y, sprite, colour, multi, fx, fy, inc, flash, mult, pri = 0;
sprite = buffered_spriteram[offs + 1];
if (!sprite)
continue;
x = buffered_spriteram16[offs+2];
x = buffered_spriteram[offs + 2];
/* Sprite/playfield priority */
switch (x&0xc000) {
case 0x0000: pri=0; break;
case 0x4000: pri=0xf0; break;
case 0x8000: pri=0xf0|0xcc; break;
case 0xc000: pri=0xf0|0xcc; break; /* Perhaps 0xf0|0xcc|0xaa (Sprite under bottom layer) */
switch (x & 0xc000)
{
case 0x0000: pri = 0; break;
case 0x4000: pri = 0xf0; break;
case 0x8000: pri = 0xf0 | 0xcc; break;
case 0xc000: pri = 0xf0 | 0xcc; break; /* Perhaps 0xf0|0xcc|0xaa (Sprite under bottom layer) */
}
y = buffered_spriteram16[offs];
flash=y&0x1000;
if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue;
colour = (x >> 9) &0x1f;
y = buffered_spriteram[offs];
flash = y & 0x1000;
if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1))
continue;
colour = (x >> 9) & 0x1f;
fx = y & 0x2000;
fy = y & 0x4000;
@ -239,14 +245,16 @@ static void robocop2_draw_sprites(running_machine *machine, bitmap_t *bitmap, co
inc = 1;
}
if (flip_screen_get(machine)) {
y=240-y;
x=304-x;
if (fx) fx=0; else fx=1;
if (fy) fy=0; else fy=1;
mult=16;
if (flip_screen_get(machine))
{
y = 240 - y;
x = 304 - x;
if (fx) fx = 0; else fx = 1;
if (fy) fy = 0; else fy = 1;
mult = 16;
}
else mult=-16;
else
mult = -16;
while (multi >= 0)
{
@ -262,9 +270,9 @@ static void robocop2_draw_sprites(running_machine *machine, bitmap_t *bitmap, co
}
}
static void mutantf_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, const UINT16 *spriteptr, int gfxbank)
static void mutantf_draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, const UINT16 *spriteptr, int gfxbank )
{
int offs,end,inc;
int offs, end, inc;
/*
Alternate format from most 16 bit games - same as Captain America
@ -287,74 +295,85 @@ static void mutantf_draw_sprites(running_machine *machine, bitmap_t *bitmap, con
/* This may look strange, but the alpha-blended sprite chip definitely draws end to
front, ie, reversed from normal pdrawgfx style. */
if (gfxbank==4) {
offs=0;
end=0x400;
inc=4;
} else {
offs=0x3fc;
end=-4;
inc=-4;
if (gfxbank == 4)
{
offs = 0;
end = 0x400;
inc = 4;
}
else
{
offs = 0x3fc;
end = -4;
inc = -4;
}
while (offs!=end)
while (offs != end)
{
int x,y,sprite,colour,fx,fy,w,h,sx,sy,x_mult,y_mult;
int alpha=0xff;
int x, y, sprite, colour, fx, fy, w, h, sx, sy, x_mult, y_mult;
int alpha = 0xff;
sprite = spriteptr[offs+3];
if (!sprite) {
offs+=inc;
sprite = spriteptr[offs + 3];
if (!sprite)
{
offs += inc;
continue;
}
sx = spriteptr[offs+1];
sx = spriteptr[offs + 1];
h = (spriteptr[offs+2]&0xf000)>>12;
w = (spriteptr[offs+2]&0x0f00)>> 8;
h = (spriteptr[offs + 2] & 0xf000) >> 12;
w = (spriteptr[offs + 2] & 0x0f00) >> 8;
sy = spriteptr[offs];
if ((sy&0x2000) && (video_screen_get_frame_number(machine->primary_screen) & 1)) {
offs+=inc;
if ((sy & 0x2000) && (video_screen_get_frame_number(machine->primary_screen) & 1))
{
offs += inc;
continue;
}
colour = (spriteptr[offs+2] >>0) & 0x1f;
colour = (spriteptr[offs + 2] >> 0) & 0x1f;
if (gfxbank==4) { /* Seems to be always alpha'd */
alpha=0x80;
colour&=0xf;
if (gfxbank == 4)
{ /* Seems to be always alpha'd */
alpha = 0x80;
colour &= 0xf;
}
fx = (spriteptr[offs+0]&0x4000);
fy = (spriteptr[offs+0]&0x8000);
fx = (spriteptr[offs + 0] & 0x4000);
fy = (spriteptr[offs + 0] & 0x8000);
if (flip_screen_get(machine)) {
if (fx) fx=0; else fx=1;
if (fy) fy=0; else fy=1;
if (flip_screen_get(machine))
{
if (fx) fx = 0; else fx = 1;
if (fy) fy = 0; else fy = 1;
sx = sx & 0x01ff;
sy = sy & 0x01ff;
if (sx>0x180) sx=-(0x200 - sx);
if (sy>0x180) sy=-(0x200 - sy);
if (sx > 0x180) sx = -(0x200 - sx);
if (sy > 0x180) sy = -(0x200 - sy);
if (fx) { x_mult=-16; sx+=16*w; } else { x_mult=16; sx-=16; }
if (fy) { y_mult=-16; sy+=16*h; } else { y_mult=16; sy-=16; }
} else {
if (fx) { x_mult = -16; sx += 16 * w; } else { x_mult = 16; sx -= 16; }
if (fy) { y_mult = -16; sy += 16 * h; } else { y_mult = 16; sy -= 16; }
}
else
{
sx = sx & 0x01ff;
sy = sy & 0x01ff;
if (sx&0x100) sx=-(0x100 - (sx&0xff));
if (sy&0x100) sy=-(0x100 - (sy&0xff));
if (sx & 0x100) sx = -(0x100 - (sx & 0xff));
if (sy & 0x100) sy = -(0x100 - (sy & 0xff));
sx = 304 - sx;
sy = 240 - sy;
if (sx >= 432) sx -= 512;
if (sy >= 384) sy -= 512;
if (fx) { x_mult=-16; sx+=16; } else { x_mult=16; sx-=16*w; }
if (fy) { y_mult=-16; sy+=16; } else { y_mult=16; sy-=16*h; }
if (fx) { x_mult = -16; sx += 16; } else { x_mult = 16; sx -= 16*w; }
if (fy) { y_mult = -16; sy += 16; } else { y_mult = 16; sy -= 16*h; }
}
for (x=0; x<w; x++) {
for (y=0; y<h; y++) {
for (x = 0; x < w; x++)
{
for (y = 0; y < h; y++)
{
pdrawgfx_alpha(bitmap,cliprect,machine->gfx[gfxbank],
sprite + y + h * x,
colour,
@ -364,8 +383,7 @@ static void mutantf_draw_sprites(running_machine *machine, bitmap_t *bitmap, con
0,alpha);
}
}
offs+=inc;
offs += inc;
}
}
@ -373,125 +391,125 @@ static void mutantf_draw_sprites(running_machine *machine, bitmap_t *bitmap, con
VIDEO_UPDATE( cninja )
{
running_device *deco16ic = devtag_get_device(screen->machine, "deco_custom");
UINT16 flip = deco16ic_pf12_control_r(deco16ic, 0, 0xffff);
cninja_state *state = (cninja_state *)screen->machine->driver_data;
UINT16 flip = deco16ic_pf12_control_r(state->deco16ic, 0, 0xffff);
flip_screen_set(screen->machine, BIT(flip, 7));
deco16ic_pf12_update(deco16ic, cninja_pf1_rowscroll, cninja_pf2_rowscroll);
deco16ic_pf34_update(deco16ic, cninja_pf3_rowscroll, cninja_pf4_rowscroll);
deco16ic_pf12_update(state->deco16ic, state->pf1_rowscroll, state->pf2_rowscroll);
deco16ic_pf34_update(state->deco16ic, state->pf3_rowscroll, state->pf4_rowscroll);
/* Draw playfields */
bitmap_fill(screen->machine->priority_bitmap, cliprect, 0);
bitmap_fill(bitmap, cliprect, 512);
deco16ic_tilemap_4_draw(deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 1);
deco16ic_tilemap_3_draw(deco16ic, bitmap, cliprect, 0, 2);
deco16ic_tilemap_2_draw(deco16ic, bitmap, cliprect, TILEMAP_DRAW_LAYER1, 2);
deco16ic_tilemap_2_draw(deco16ic, bitmap, cliprect, TILEMAP_DRAW_LAYER0, 4);
deco16ic_tilemap_4_draw(state->deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 1);
deco16ic_tilemap_3_draw(state->deco16ic, bitmap, cliprect, 0, 2);
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, TILEMAP_DRAW_LAYER1, 2);
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, TILEMAP_DRAW_LAYER0, 4);
cninja_draw_sprites(screen->machine, bitmap, cliprect);
deco16ic_tilemap_1_draw(deco16ic, bitmap, cliprect, 0, 0);
deco16ic_tilemap_1_draw(state->deco16ic, bitmap, cliprect, 0, 0);
return 0;
}
VIDEO_UPDATE( cninjabl )
{
running_device *deco16ic = devtag_get_device(screen->machine, "deco_custom");
UINT16 flip = deco16ic_pf12_control_r(deco16ic, 0, 0xffff);
cninja_state *state = (cninja_state *)screen->machine->driver_data;
UINT16 flip = deco16ic_pf12_control_r(state->deco16ic, 0, 0xffff);
flip_screen_set(screen->machine, BIT(flip, 7));
deco16ic_pf12_update(deco16ic, cninja_pf1_rowscroll, cninja_pf2_rowscroll);
deco16ic_pf34_update(deco16ic, cninja_pf3_rowscroll, cninja_pf4_rowscroll);
deco16ic_pf12_update(state->deco16ic, state->pf1_rowscroll, state->pf2_rowscroll);
deco16ic_pf34_update(state->deco16ic, state->pf3_rowscroll, state->pf4_rowscroll);
/* Draw playfields */
bitmap_fill(screen->machine->priority_bitmap, cliprect, 0);
bitmap_fill(bitmap, cliprect, 512);
deco16ic_tilemap_4_draw(deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 1);
deco16ic_tilemap_3_draw(deco16ic, bitmap, cliprect, 0, 2);
deco16ic_tilemap_2_draw(deco16ic, bitmap, cliprect, TILEMAP_DRAW_LAYER1, 2);
deco16ic_tilemap_2_draw(deco16ic, bitmap, cliprect, TILEMAP_DRAW_LAYER0, 4);
deco16ic_tilemap_4_draw(state->deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 1);
deco16ic_tilemap_3_draw(state->deco16ic, bitmap, cliprect, 0, 2);
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, TILEMAP_DRAW_LAYER1, 2);
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, TILEMAP_DRAW_LAYER0, 4);
cninjabl_draw_sprites(screen->machine, bitmap, cliprect);
deco16ic_tilemap_1_draw(deco16ic, bitmap, cliprect, 0, 0);
deco16ic_tilemap_1_draw(state->deco16ic, bitmap, cliprect, 0, 0);
return 0;
}
VIDEO_UPDATE( edrandy )
{
running_device *deco16ic = devtag_get_device(screen->machine, "deco_custom");
UINT16 flip = deco16ic_pf12_control_r(deco16ic, 0, 0xffff);
cninja_state *state = (cninja_state *)screen->machine->driver_data;
UINT16 flip = deco16ic_pf12_control_r(state->deco16ic, 0, 0xffff);
flip_screen_set(screen->machine, BIT(flip, 7));
deco16ic_pf12_update(deco16ic, cninja_pf1_rowscroll, cninja_pf2_rowscroll);
deco16ic_pf34_update(deco16ic, cninja_pf3_rowscroll, cninja_pf4_rowscroll);
deco16ic_pf12_update(state->deco16ic, state->pf1_rowscroll, state->pf2_rowscroll);
deco16ic_pf34_update(state->deco16ic, state->pf3_rowscroll, state->pf4_rowscroll);
bitmap_fill(screen->machine->priority_bitmap, cliprect, 0);
bitmap_fill(bitmap, cliprect, 0);
deco16ic_tilemap_4_draw(deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 1);
deco16ic_tilemap_3_draw(deco16ic, bitmap, cliprect, 0, 2);
deco16ic_tilemap_2_draw(deco16ic, bitmap, cliprect, 0, 4);
deco16ic_tilemap_4_draw(state->deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 1);
deco16ic_tilemap_3_draw(state->deco16ic, bitmap, cliprect, 0, 2);
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, 0, 4);
cninja_draw_sprites(screen->machine, bitmap, cliprect);
deco16ic_tilemap_1_draw(deco16ic, bitmap, cliprect, 0, 0);
deco16ic_tilemap_1_draw(state->deco16ic, bitmap, cliprect, 0, 0);
return 0;
}
VIDEO_UPDATE( robocop2 )
{
running_device *deco16ic = devtag_get_device(screen->machine, "deco_custom");
UINT16 flip = deco16ic_pf12_control_r(deco16ic, 0, 0xffff);
UINT16 priority = deco16ic_priority_r(deco16ic, 0, 0xffff);
cninja_state *state = (cninja_state *)screen->machine->driver_data;
UINT16 flip = deco16ic_pf12_control_r(state->deco16ic, 0, 0xffff);
UINT16 priority = deco16ic_priority_r(state->deco16ic, 0, 0xffff);
/* One of the tilemap chips can switch between 2 tilemaps at 4bpp, or 1 at 8bpp */
if (priority & 4)
{
deco16ic_set_tilemap_colour_mask(deco16ic, 2, 0);
deco16ic_set_tilemap_colour_mask(deco16ic, 3, 0);
deco16ic_pf34_set_gfxbank(deco16ic, 0, 4);
deco16ic_set_tilemap_colour_mask(state->deco16ic, 2, 0);
deco16ic_set_tilemap_colour_mask(state->deco16ic, 3, 0);
deco16ic_pf34_set_gfxbank(state->deco16ic, 0, 4);
}
else
{
deco16ic_set_tilemap_colour_mask(deco16ic, 2, 0xf);
deco16ic_set_tilemap_colour_mask(deco16ic, 3, 0xf);
deco16ic_pf34_set_gfxbank(deco16ic, 0, 2);
deco16ic_set_tilemap_colour_mask(state->deco16ic, 2, 0xf);
deco16ic_set_tilemap_colour_mask(state->deco16ic, 3, 0xf);
deco16ic_pf34_set_gfxbank(state->deco16ic, 0, 2);
}
/* Update playfields */
flip_screen_set(screen->machine, BIT(flip, 7));
deco16ic_pf12_update(deco16ic, cninja_pf1_rowscroll, cninja_pf2_rowscroll);
deco16ic_pf34_update(deco16ic, cninja_pf3_rowscroll, cninja_pf4_rowscroll);
deco16ic_pf12_update(state->deco16ic, state->pf1_rowscroll, state->pf2_rowscroll);
deco16ic_pf34_update(state->deco16ic, state->pf3_rowscroll, state->pf4_rowscroll);
/* Draw playfields */
bitmap_fill(screen->machine->priority_bitmap, cliprect, 0);
bitmap_fill(bitmap, cliprect, 0x200);
if ((priority & 4) == 0)
deco16ic_tilemap_4_draw(deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 1);
deco16ic_tilemap_4_draw(state->deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 1);
/* Switchable priority */
switch (priority & 0x8)
{
case 8:
deco16ic_tilemap_2_draw(deco16ic, bitmap, cliprect, 0, 2);
deco16ic_tilemap_3_draw(deco16ic, bitmap, cliprect, 0, 4);
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, 0, 2);
deco16ic_tilemap_3_draw(state->deco16ic, bitmap, cliprect, 0, 4);
break;
default:
case 0:
deco16ic_tilemap_3_draw(deco16ic, bitmap, cliprect, 0, 2);
deco16ic_tilemap_2_draw(deco16ic, bitmap, cliprect, 0, 4);
deco16ic_tilemap_3_draw(state->deco16ic, bitmap, cliprect, 0, 2);
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, 0, 4);
break;
}
robocop2_draw_sprites(screen->machine, bitmap, cliprect);
deco16ic_tilemap_1_draw(deco16ic, bitmap, cliprect, 0, 0);
deco16ic_tilemap_1_draw(state->deco16ic, bitmap, cliprect, 0, 0);
return 0;
}
VIDEO_UPDATE( mutantf )
{
running_device *deco16ic = devtag_get_device(screen->machine, "deco_custom");
UINT16 flip = deco16ic_pf12_control_r(deco16ic, 0, 0xffff);
UINT16 priority = deco16ic_priority_r(deco16ic, 0, 0xffff);
cninja_state *state = (cninja_state *)screen->machine->driver_data;
UINT16 flip = deco16ic_pf12_control_r(state->deco16ic, 0, 0xffff);
UINT16 priority = deco16ic_priority_r(state->deco16ic, 0, 0xffff);
flip_screen_set(screen->machine, BIT(flip, 7));
deco16ic_pf12_update(deco16ic, cninja_pf1_rowscroll, cninja_pf2_rowscroll);
deco16ic_pf34_update(deco16ic, cninja_pf3_rowscroll, cninja_pf4_rowscroll);
deco16ic_pf12_update(state->deco16ic, state->pf1_rowscroll, state->pf2_rowscroll);
deco16ic_pf34_update(state->deco16ic, state->pf3_rowscroll, state->pf4_rowscroll);
/* Draw playfields */
bitmap_fill(bitmap, cliprect, 0x400); /* Confirmed */
@ -507,9 +525,9 @@ VIDEO_UPDATE( mutantf )
The other bits may control alpha blend on the 2nd sprite chip, or
layer order.
*/
deco16ic_tilemap_4_draw(deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
deco16ic_tilemap_2_draw(deco16ic, bitmap, cliprect, 0, 0);
deco16ic_tilemap_3_draw(deco16ic, bitmap, cliprect, 0, 0);
deco16ic_tilemap_4_draw(state->deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, 0, 0);
deco16ic_tilemap_3_draw(state->deco16ic, bitmap, cliprect, 0, 0);
/* We need to abuse the priority bitmap a little by clearing it before
drawing each sprite layer. This is because there is no priority
@ -531,6 +549,6 @@ VIDEO_UPDATE( mutantf )
bitmap_fill(screen->machine->priority_bitmap, cliprect, 0);
mutantf_draw_sprites(screen->machine, bitmap, cliprect, screen->machine->generic.buffered_spriteram.u16, 3);
}
deco16ic_tilemap_1_draw(deco16ic, bitmap, cliprect, 0, 0);
deco16ic_tilemap_1_draw(state->deco16ic, bitmap, cliprect, 0, 0);
return 0;
}

View File

@ -6,15 +6,14 @@
#include "emu.h"
#include "video/deco16ic.h"
UINT16 *dassault_pf2_rowscroll,*dassault_pf4_rowscroll;
#include "includes/dassault.h"
/******************************************************************************/
static void draw_sprites( running_machine* machine, bitmap_t *bitmap, const rectangle *cliprect, int pf_priority )
{
running_device *deco16ic = devtag_get_device(machine, "deco_custom");
UINT16 *buffered_spriteram16 = machine->generic.buffered_spriteram.u16;
dassault_state *state = (dassault_state *)machine->driver_data;
UINT16 *buffered_spriteram = machine->generic.buffered_spriteram.u16;
int x, y, sprite, colour, multi, fx, fy, inc, flash, mult;
int offs, bank, gfxbank;
const UINT16 *spritebase;
@ -29,7 +28,7 @@ static void draw_sprites( running_machine* machine, bitmap_t *bitmap, const rect
/* Draw the main spritebank after the other one */
if (bank == 0)
{
spritebase = buffered_spriteram16;
spritebase = buffered_spriteram;
gfxbank = 3;
}
else
@ -157,7 +156,7 @@ static void draw_sprites( running_machine* machine, bitmap_t *bitmap, const rect
while (multi >= 0)
{
deco16ic_pdrawgfx(
deco16ic,
state->deco16ic,
bitmap,cliprect,machine->gfx[gfxbank],
sprite - multi * inc,
colour,
@ -175,36 +174,36 @@ static void draw_sprites( running_machine* machine, bitmap_t *bitmap, const rect
VIDEO_UPDATE( dassault )
{
running_device *deco16ic = devtag_get_device(screen->machine, "deco_custom");
UINT16 flip = deco16ic_pf12_control_r(deco16ic, 0, 0xffff);
UINT16 priority = deco16ic_priority_r(deco16ic, 0, 0xffff);
dassault_state *state = (dassault_state *)screen->machine->driver_data;
UINT16 flip = deco16ic_pf12_control_r(state->deco16ic, 0, 0xffff);
UINT16 priority = deco16ic_priority_r(state->deco16ic, 0, 0xffff);
/* Update tilemaps */
flip_screen_set(screen->machine, BIT(flip, 7));
deco16ic_pf12_update(deco16ic, 0, dassault_pf2_rowscroll);
deco16ic_pf34_update(deco16ic, 0, dassault_pf4_rowscroll);
deco16ic_pf12_update(state->deco16ic, 0, state->pf2_rowscroll);
deco16ic_pf34_update(state->deco16ic, 0, state->pf4_rowscroll);
/* Draw playfields/update priority bitmap */
deco16ic_clear_sprite_priority_bitmap(deco16ic);
deco16ic_clear_sprite_priority_bitmap(state->deco16ic);
bitmap_fill(screen->machine->priority_bitmap, cliprect, 0);
bitmap_fill(bitmap, cliprect, screen->machine->pens[3072]);
deco16ic_tilemap_4_draw(deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
deco16ic_tilemap_4_draw(state->deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
/* The middle playfields can be swapped priority-wise */
if ((priority & 3) == 0)
{
deco16ic_tilemap_2_draw(deco16ic, bitmap, cliprect, 0, 2);
deco16ic_tilemap_3_draw(deco16ic, bitmap, cliprect, 0, 16);
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, 0, 2);
deco16ic_tilemap_3_draw(state->deco16ic, bitmap, cliprect, 0, 16);
}
else if ((priority & 3) == 1)
{
deco16ic_tilemap_3_draw(deco16ic, bitmap, cliprect, 0, 2);
deco16ic_tilemap_2_draw(deco16ic, bitmap, cliprect, 0, 64);
deco16ic_tilemap_3_draw(state->deco16ic, bitmap, cliprect, 0, 2);
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, 0, 64);
}
else if ((priority & 3) == 3)
{
deco16ic_tilemap_3_draw(deco16ic, bitmap, cliprect, 0, 2);
deco16ic_tilemap_2_draw(deco16ic, bitmap, cliprect, 0, 16);
deco16ic_tilemap_3_draw(state->deco16ic, bitmap, cliprect, 0, 2);
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, 0, 16);
}
else
{
@ -213,6 +212,6 @@ VIDEO_UPDATE( dassault )
/* Draw sprites - two sprite generators, with selectable priority */
draw_sprites(screen->machine, bitmap, cliprect, priority);
deco16ic_tilemap_1_draw(deco16ic, bitmap, cliprect, 0, 0);
deco16ic_tilemap_1_draw(state->deco16ic, bitmap, cliprect, 0, 0);
return 0;
}

View File

@ -5,64 +5,65 @@
***************************************************************************/
#include "emu.h"
#include "includes/rohga.h"
#include "video/deco16ic.h"
static UINT16 * rohga_spriteram;
UINT16 *rohga_pf1_rowscroll,*rohga_pf2_rowscroll;
UINT16 *rohga_pf3_rowscroll,*rohga_pf4_rowscroll;
/******************************************************************************/
WRITE16_HANDLER( rohga_buffer_spriteram16_w )
{
// Spriteram seems to be triple buffered (no sprite lag on real pcb, but there
// is on driver with only double buffering)
memcpy(rohga_spriteram, space->machine->generic.buffered_spriteram.u16, 0x800);
rohga_state *state = (rohga_state *)space->machine->driver_data;
memcpy(state->spriteram, space->machine->generic.buffered_spriteram.u16, 0x800);
memcpy(space->machine->generic.buffered_spriteram.u16, space->machine->generic.spriteram.u16, 0x800);
}
VIDEO_START( rohga )
{
rohga_spriteram = auto_alloc_array(machine, UINT16, 0x800/2);
rohga_state *state = (rohga_state *)machine->driver_data;
state->spriteram = auto_alloc_array(machine, UINT16, 0x800/2);
state_save_register_global_pointer(machine, state->spriteram, 0x800/2);
}
/******************************************************************************/
static void rohga_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, const UINT16 *spriteptr, int is_schmeisr)
static void rohga_draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, const UINT16 *spriteptr, int is_schmeisr )
{
int offs;
for (offs = 0x400-4;offs >= 0;offs -= 4)
for (offs = 0x400 - 4; offs >= 0; offs -= 4)
{
int x,y,sprite,colour,multi,fx,fy,inc,flash,mult,pri=0;
sprite = spriteptr[offs+1];
if (!sprite) continue;
int x, y, sprite, colour, multi, fx, fy, inc, flash, mult, pri = 0;
sprite = spriteptr[offs + 1];
if (!sprite)
continue;
x = spriteptr[offs+2];
x = spriteptr[offs + 2];
/* Sprite/playfield priority */
switch (x&0x6000) {
case 0x0000: pri=0; break;
case 0x4000: pri=0xf0; break;
case 0x6000: pri=0xf0|0xcc; break;
case 0x2000: pri=0;//0xf0|0xcc; break; /* Perhaps 0xf0|0xcc|0xaa (Sprite under bottom layer) */
switch (x & 0x6000)
{
case 0x0000: pri = 0; break;
case 0x4000: pri = 0xf0; break;
case 0x6000: pri = 0xf0 | 0xcc; break;
case 0x2000: pri = 0;//0xf0|0xcc; break; /* Perhaps 0xf0|0xcc|0xaa (Sprite under bottom layer) */
}
y = spriteptr[offs];
flash=y&0x1000;
if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue;
flash = y & 0x1000;
if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1))
continue;
// Sprite colour is different between Rohga (6bpp) and Schmeisr (4bpp plus wire mods on pcb)
if (is_schmeisr)
{
colour = ((x >> 9) &0xf)<<2;
if (x&0x8000)
colour = ((x >> 9) & 0xf) << 2;
if (x & 0x8000)
colour++;
}
else
{
colour = (x >> 9) &0xf;
colour = (x >> 9) & 0xf;
}
fx = y & 0x2000;
@ -83,14 +84,16 @@ static void rohga_draw_sprites(running_machine *machine, bitmap_t *bitmap, const
inc = 1;
}
if (flip_screen_get(machine)) {
x=304-x;
y=240-y;
if (fx) fx=0; else fx=1;
if (fy) fy=0; else fy=1;
mult=-16;
if (flip_screen_get(machine))
{
x = 304 - x;
y = 240 - y;
if (fx) fx = 0; else fx = 1;
if (fy) fy = 0; else fy = 1;
mult = -16;
}
else mult=+16;
else
mult = +16;
while (multi >= 0)
{
@ -106,19 +109,20 @@ static void rohga_draw_sprites(running_machine *machine, bitmap_t *bitmap, const
}
}
static void wizdfire_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT16 *spriteptr, int mode, int bank)
static void wizdfire_draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT16 *spriteptr, int mode, int bank )
{
int offs;
for (offs = 0;offs < 0x400;offs += 4)
for (offs = 0; offs < 0x400; offs += 4)
{
int x,y,sprite,colour,multi,fx,fy,inc,flash,mult;
int alpha=0xff;
int x, y, sprite, colour, multi, fx, fy, inc, flash, mult;
int alpha = 0xff;
sprite = spriteptr[offs+1];
if (!sprite) continue;
sprite = spriteptr[offs + 1];
if (!sprite)
continue;
x = spriteptr[offs+2];
x = spriteptr[offs + 2];
/*
Sprite/playfield priority - we can't use pdrawgfx because we need alpha'd sprites overlaid
@ -127,35 +131,38 @@ static void wizdfire_draw_sprites(running_machine *machine, bitmap_t *bitmap, co
Hence, we rely on the hardware sorting everything correctly and not relying on any orthoganality
effects (it doesn't seem to), and instead draw seperate passes for each sprite priority. :(
*/
switch (mode) {
switch (mode)
{
case 4:
if ((x&0xc000)!=0xc000)
if ((x & 0xc000) != 0xc000)
continue;
break;
case 3:
if ((x&0xc000)!=0x8000)
if ((x & 0xc000) != 0x8000)
continue;
break;
case 2:
if ((x&0x8000)!=0x8000)
if ((x & 0x8000) != 0x8000)
continue;
break;
case 1:
case 0:
default:
if ((x&0x8000)!=0)
if ((x & 0x8000) != 0)
continue;
break;
}
y = spriteptr[offs];
flash=y&0x1000;
if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue;
colour = (x >> 9) &0x1f;
flash = y & 0x1000;
if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1))
continue;
colour = (x >> 9) & 0x1f;
if (bank==4 && colour&0x10) {
alpha=0x80;
colour&=0xf;
if (bank == 4 && colour & 0x10)
{
alpha = 0x80;
colour &= 0xf;
}
fx = y & 0x2000;
@ -176,18 +183,19 @@ static void wizdfire_draw_sprites(running_machine *machine, bitmap_t *bitmap, co
inc = 1;
}
if (flip_screen_get(machine)) {
x=304-x;
y=240-y;
if (fx) fx=0; else fx=1;
if (fy) fy=0; else fy=1;
mult=-16;
if (flip_screen_get(machine))
{
x = 304 - x;
y = 240 - y;
if (fx) fx = 0; else fx = 1;
if (fy) fy = 0; else fy = 1;
mult = -16;
}
else
mult=+16;
mult = +16;
if (fx) fx=0; else fx=1;
if (fy) fy=0; else fy=1;
if (fx) fx = 0; else fx = 1;
if (fy) fy = 0; else fy = 1;
while (multi >= 0)
{
@ -203,11 +211,11 @@ static void wizdfire_draw_sprites(running_machine *machine, bitmap_t *bitmap, co
}
}
static void nitrobal_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, const UINT16 *spriteptr, int gfxbank)
static void nitrobal_draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, const UINT16 *spriteptr, int gfxbank )
{
running_device *deco16ic = devtag_get_device(machine, "deco_custom");
int offs,end,inc;
UINT16 priority = deco16ic_priority_r(deco16ic, 0, 0xffff);
rohga_state *state = (rohga_state *)machine->driver_data;
int offs, end, inc;
UINT16 priority = deco16ic_priority_r(state->deco16ic, 0, 0xffff);
/*
Alternate format from most 16 bit games - same as Captain America and Mutant Fighter
@ -238,48 +246,52 @@ Sprites 2:
0xffff: Sprite value
*/
offs=0x3fc;
end=-4;
inc=-4;
offs = 0x3fc;
end = -4;
inc = -4;
while (offs!=end)
while (offs != end)
{
int x,y,sprite,colour,fx,fy,w,h,sx,sy,x_mult,y_mult,tilemap_pri,sprite_pri;
int alpha=0xff;
int x, y, sprite, colour, fx, fy, w, h, sx, sy, x_mult, y_mult, tilemap_pri, sprite_pri;
int alpha = 0xff;
sprite = spriteptr[offs+3];
if (!sprite) {
offs+=inc;
sprite = spriteptr[offs + 3];
if (!sprite)
{
offs += inc;
continue;
}
sx = spriteptr[offs+1];
sx = spriteptr[offs + 1];
h = (spriteptr[offs+2]&0xf000)>>12;
w = (spriteptr[offs+2]&0x0f00)>> 8;
h = (spriteptr[offs + 2] & 0xf000) >> 12;
w = (spriteptr[offs + 2] & 0x0f00) >> 8;
sy = spriteptr[offs];
if ((sy&0x2000) && (video_screen_get_frame_number(machine->primary_screen) & 1)) {
offs+=inc;
if ((sy & 0x2000) && (video_screen_get_frame_number(machine->primary_screen) & 1))
{
offs += inc;
continue;
}
colour = (spriteptr[offs+2] >>0) & 0x1f;
colour = (spriteptr[offs + 2] >> 0) & 0x1f;
// PRIORITIES - TODO
if (gfxbank==3) {
if (gfxbank == 3)
{
/* Sprite chip 1 */
switch (spriteptr[offs+2]&0xe0) {
// case 0xc0: colour=rand()%0xff; tilemap_pri=256; break; //todo
case 0xc0: tilemap_pri=8; break; //? under other sprites
case 0x80: tilemap_pri=32; break; //? under other sprites
case 0x20: tilemap_pri=32; break; /* Over pf2 and under other sprite chip */
case 0x40: tilemap_pri=8; break; /* Under pf2 and under other sprite chip */
case 0xa0: tilemap_pri=32; break;
switch (spriteptr[offs + 2] & 0xe0)
{
// case 0xc0: colour = rand()%0xff; tilemap_pri = 256; break; //todo
case 0xc0: tilemap_pri = 8; break; //? under other sprites
case 0x80: tilemap_pri = 32; break; //? under other sprites
case 0x20: tilemap_pri = 32; break; /* Over pf2 and under other sprite chip */
case 0x40: tilemap_pri = 8; break; /* Under pf2 and under other sprite chip */
case 0xa0: tilemap_pri = 32; break;
case 0:
tilemap_pri=128; break;
tilemap_pri = 128; break;
default:
tilemap_pri=128;
tilemap_pri = 128;
break;
}
@ -330,60 +342,68 @@ sprite 2:
*/
sprite_pri=1;
} else {
sprite_pri = 1;
}
else
{
/* Sprite chip 2 (with alpha blending) */
/* Sprite above playfield 2, but still below other sprite chip */
// if (spriteptr[offs+2]&0x80)
tilemap_pri=64;
// if (spriteptr[offs + 2] & 0x80)
tilemap_pri = 64;
// else
// tilemap_pri=8;
// tilemap_pri = 8;
if (priority)
tilemap_pri=8;
tilemap_pri = 8;
else
tilemap_pri=64;
tilemap_pri = 64;
sprite_pri=2;
sprite_pri = 2;
}
if (gfxbank==4 && colour&0x10) {
alpha=0x80;
colour&=0xf;
if (gfxbank == 4 && colour & 0x10)
{
alpha = 0x80;
colour &= 0xf;
}
fx = (spriteptr[offs+0]&0x4000);
fy = (spriteptr[offs+0]&0x8000);
fx = (spriteptr[offs + 0] & 0x4000);
fy = (spriteptr[offs + 0] & 0x8000);
if (!flip_screen_get(machine)) { /* Inverted from Mutant Fighter! */
if (fx) fx=0; else fx=1;
if (fy) fy=0; else fy=1;
if (!flip_screen_get(machine))
{ /* Inverted from Mutant Fighter! */
if (fx) fx = 0; else fx = 1;
if (fy) fy = 0; else fy = 1;
sx = sx & 0x01ff;
sy = sy & 0x01ff;
if (sx>0x180) sx=-(0x200 - sx);
if (sy>0x180) sy=-(0x200 - sy);
if (sx > 0x180) sx = -(0x200 - sx);
if (sy > 0x180) sy = -(0x200 - sy);
if (fx) { x_mult=-16; sx+=16*w; } else { x_mult=16; sx-=16; }
if (fy) { y_mult=-16; sy+=16*h; } else { y_mult=16; sy-=16; }
} else {
if (fx) { x_mult = -16; sx += 16 * w; } else { x_mult = 16; sx -= 16; }
if (fy) { y_mult = -16; sy += 16 * h; } else { y_mult = 16; sy -= 16; }
}
else
{
sx = sx & 0x01ff;
sy = sy & 0x01ff;
if (sx&0x100) sx=-(0x100 - (sx&0xff));
if (sy&0x100) sy=-(0x100 - (sy&0xff));
if (sx & 0x100) sx = -(0x100 - (sx & 0xff));
if (sy & 0x100) sy = -(0x100 - (sy & 0xff));
sx = 304 - sx;
sy = 240 - sy;
if (sx >= 432) sx -= 512;
if (sy >= 384) sy -= 512;
if (fx) { x_mult=-16; sx+=16; } else { x_mult=16; sx-=16*w; }
if (fy) { y_mult=-16; sy+=16; } else { y_mult=16; sy-=16*h; }
if (fx) { x_mult = -16; sx += 16; } else { x_mult = 16; sx -= 16 * w; }
if (fy) { y_mult = -16; sy += 16; } else { y_mult = 16; sy -= 16 * h; }
}
for (x=0; x<w; x++) {
for (y=0; y<h; y++) {
for (x = 0; x < w; x++)
{
for (y = 0; y < h; y++)
{
deco16ic_pdrawgfx(
deco16ic,
state->deco16ic,
bitmap,cliprect,machine->gfx[gfxbank],
sprite + y + h * x,
colour,
@ -393,22 +413,22 @@ sprite 2:
}
}
offs+=inc;
offs += inc;
}
}
/******************************************************************************/
static void update_rohga(running_device *screen, bitmap_t *bitmap, const rectangle *cliprect, int is_schmeisr)
static void update_rohga( running_device *screen, bitmap_t *bitmap, const rectangle *cliprect, int is_schmeisr )
{
running_device *deco16ic = devtag_get_device(screen->machine, "deco_custom");
UINT16 flip = deco16ic_pf12_control_r(deco16ic, 0, 0xffff);
UINT16 priority = deco16ic_priority_r(deco16ic, 0, 0xffff);
rohga_state *state = (rohga_state *)screen->machine->driver_data;
UINT16 flip = deco16ic_pf12_control_r(state->deco16ic, 0, 0xffff);
UINT16 priority = deco16ic_priority_r(state->deco16ic, 0, 0xffff);
/* Update playfields */
flip_screen_set(screen->machine, BIT(flip, 7));
deco16ic_pf12_update(deco16ic, rohga_pf1_rowscroll, rohga_pf2_rowscroll);
deco16ic_pf34_update(deco16ic, rohga_pf3_rowscroll, rohga_pf4_rowscroll);
deco16ic_pf12_update(state->deco16ic, state->pf1_rowscroll, state->pf2_rowscroll);
deco16ic_pf34_update(state->deco16ic, state->pf3_rowscroll, state->pf4_rowscroll);
/* Draw playfields */
bitmap_fill(screen->machine->priority_bitmap, cliprect, 0);
@ -420,30 +440,30 @@ static void update_rohga(running_device *screen, bitmap_t *bitmap, const rectang
if (priority & 4)
{
// Draw as 1 8BPP layer
deco16ic_tilemap_34_combine_draw(deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 3);
deco16ic_tilemap_34_combine_draw(state->deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 3);
}
else
{
// Draw as 2 4BPP layers
deco16ic_tilemap_4_draw(deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 1);
deco16ic_tilemap_3_draw(deco16ic, bitmap, cliprect, 0, 2);
deco16ic_tilemap_4_draw(state->deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 1);
deco16ic_tilemap_3_draw(state->deco16ic, bitmap, cliprect, 0, 2);
}
deco16ic_tilemap_2_draw(deco16ic, bitmap, cliprect, 0, 4);
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, 0, 4);
break;
case 1:
deco16ic_tilemap_4_draw(deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 1);
deco16ic_tilemap_2_draw(deco16ic, bitmap, cliprect, 0, 2);
deco16ic_tilemap_3_draw(deco16ic, bitmap, cliprect, 0, 4);
deco16ic_tilemap_4_draw(state->deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 1);
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, 0, 2);
deco16ic_tilemap_3_draw(state->deco16ic, bitmap, cliprect, 0, 4);
break;
case 2:
deco16ic_tilemap_2_draw(deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 1);
deco16ic_tilemap_4_draw(deco16ic, bitmap, cliprect, 0, 2);
deco16ic_tilemap_3_draw(deco16ic, bitmap, cliprect, 0, 4);
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 1);
deco16ic_tilemap_4_draw(state->deco16ic, bitmap, cliprect, 0, 2);
deco16ic_tilemap_3_draw(state->deco16ic, bitmap, cliprect, 0, 4);
break;
}
rohga_draw_sprites(screen->machine, bitmap, cliprect, rohga_spriteram, is_schmeisr);
deco16ic_tilemap_1_draw(deco16ic, bitmap, cliprect, 0, 0);
rohga_draw_sprites(screen->machine, bitmap, cliprect, state->spriteram, is_schmeisr);
deco16ic_tilemap_1_draw(state->deco16ic, bitmap, cliprect, 0, 0);
}
VIDEO_UPDATE( rohga )
@ -462,59 +482,59 @@ VIDEO_UPDATE( schmeisr )
VIDEO_UPDATE( wizdfire )
{
running_device *deco16ic = devtag_get_device(screen->machine, "deco_custom");
UINT16 flip = deco16ic_pf12_control_r(deco16ic, 0, 0xffff);
UINT16 priority = deco16ic_priority_r(deco16ic, 0, 0xffff);
rohga_state *state = (rohga_state *)screen->machine->driver_data;
UINT16 flip = deco16ic_pf12_control_r(state->deco16ic, 0, 0xffff);
UINT16 priority = deco16ic_priority_r(state->deco16ic, 0, 0xffff);
/* Update playfields */
flip_screen_set(screen->machine, BIT(flip, 7));
deco16ic_pf12_update(deco16ic, 0, 0);
deco16ic_pf34_update(deco16ic, rohga_pf3_rowscroll, rohga_pf4_rowscroll);
deco16ic_pf12_update(state->deco16ic, 0, 0);
deco16ic_pf34_update(state->deco16ic, state->pf3_rowscroll, state->pf4_rowscroll);
/* Draw playfields - Palette of 2nd playfield chip visible if playfields turned off */
bitmap_fill(bitmap, cliprect, screen->machine->pens[512]);
deco16ic_tilemap_4_draw(deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
deco16ic_tilemap_4_draw(state->deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
wizdfire_draw_sprites(screen->machine, bitmap, cliprect, screen->machine->generic.buffered_spriteram.u16, 4, 3);
deco16ic_tilemap_2_draw(deco16ic, bitmap, cliprect, 0, 0);
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, 0, 0);
wizdfire_draw_sprites(screen->machine, bitmap, cliprect, screen->machine->generic.buffered_spriteram.u16, 3, 3);
if ((priority & 0x1f) == 0x1f) /* Wizdfire has bit 0x40 always set, Dark Seal 2 doesn't?! */
deco16ic_tilemap_3_draw(deco16ic, bitmap, cliprect, TILEMAP_DRAW_ALPHA(0x80), 0);
deco16ic_tilemap_3_draw(state->deco16ic, bitmap, cliprect, TILEMAP_DRAW_ALPHA(0x80), 0);
else
deco16ic_tilemap_3_draw(deco16ic, bitmap, cliprect, 0, 0);
deco16ic_tilemap_3_draw(state->deco16ic, bitmap, cliprect, 0, 0);
/* See notes in wizdfire_draw_sprites about this */
wizdfire_draw_sprites(screen->machine, bitmap, cliprect, screen->machine->generic.buffered_spriteram.u16, 0, 3);
wizdfire_draw_sprites(screen->machine, bitmap, cliprect, screen->machine->generic.buffered_spriteram2.u16, 2, 4);
wizdfire_draw_sprites(screen->machine, bitmap, cliprect, screen->machine->generic.buffered_spriteram2.u16, 1, 4);
deco16ic_tilemap_1_draw(deco16ic, bitmap, cliprect, 0, 0);
deco16ic_tilemap_1_draw(state->deco16ic, bitmap, cliprect, 0, 0);
return 0;
}
VIDEO_UPDATE( nitrobal )
{
running_device *deco16ic = devtag_get_device(screen->machine, "deco_custom");
UINT16 flip = deco16ic_pf12_control_r(deco16ic, 0, 0xffff);
rohga_state *state = (rohga_state *)screen->machine->driver_data;
UINT16 flip = deco16ic_pf12_control_r(state->deco16ic, 0, 0xffff);
/* Update playfields */
flip_screen_set(screen->machine, BIT(flip, 7));
deco16ic_pf12_update(deco16ic, rohga_pf1_rowscroll, rohga_pf2_rowscroll);
deco16ic_pf34_update(deco16ic, rohga_pf3_rowscroll, rohga_pf4_rowscroll);
deco16ic_pf12_update(state->deco16ic, state->pf1_rowscroll, state->pf2_rowscroll);
deco16ic_pf34_update(state->deco16ic, state->pf3_rowscroll, state->pf4_rowscroll);
/* Draw playfields - Palette of 2nd playfield chip visible if playfields turned off */
bitmap_fill(bitmap, cliprect, screen->machine->pens[512]);
bitmap_fill(screen->machine->priority_bitmap, NULL, 0);
deco16ic_clear_sprite_priority_bitmap(deco16ic);
deco16ic_clear_sprite_priority_bitmap(state->deco16ic);
/* pf3 and pf4 are combined into a single 8bpp bitmap */
deco16ic_tilemap_34_combine_draw(deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
deco16ic_tilemap_34_combine_draw(state->deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
deco16ic_tilemap_2_draw(deco16ic, bitmap, cliprect, 0, 16);
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, 0, 16);
nitrobal_draw_sprites(screen->machine, bitmap, cliprect, screen->machine->generic.buffered_spriteram.u16, 3);
nitrobal_draw_sprites(screen->machine, bitmap, cliprect, screen->machine->generic.buffered_spriteram2.u16, 4);
deco16ic_tilemap_1_draw(deco16ic, bitmap, cliprect, 0, 0);
deco16ic_tilemap_1_draw(state->deco16ic, bitmap, cliprect, 0, 0);
return 0;
}

View File

@ -3,10 +3,9 @@
*/
#include "emu.h"
#include "includes/simpl156.h"
#include "video/deco16ic.h"
UINT16 *simpl156_pf1_rowscroll,*simpl156_pf2_rowscroll;
/*
offs +0
@ -37,34 +36,36 @@ x = xpos
/* spriteram is really 16-bit.. this can be changed to use 16-bit ram like the tilemaps
its the same sprite chip Data East used on many, many 16-bit era titles */
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 )
{
UINT32 *spriteram32 = machine->generic.spriteram.u32;
UINT32 *spriteram = machine->generic.spriteram.u32;
int offs;
//FIXME: flip_screen_x should not be written!
flip_screen_set_no_update(machine, 1);
for (offs = (0x1400/4)-4;offs >= 0;offs -= 4) // 0x1400 for charlien
for (offs = (0x1400 / 4) - 4; offs >= 0; offs -= 4) // 0x1400 for charlien
{
int x,y,sprite,colour,multi,fx,fy,inc,flash,mult, pri;
int x, y, sprite, colour, multi, fx, fy, inc, flash, mult, pri;
sprite = spriteram32[offs+1]&0xffff;
sprite = spriteram[offs + 1] & 0xffff;
y = spriteram32[offs]&0xffff;
flash=y&0x1000;
if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue;
y = spriteram[offs] & 0xffff;
flash = y & 0x1000;
if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1))
continue;
x = spriteram32[offs+2]&0xffff;
colour = (x >>9) & 0x1f;
x = spriteram[offs + 2] & 0xffff;
colour = (x >> 9) & 0x1f;
pri = (x&0xc000); // 2 bits or 1?
pri = (x & 0xc000); // 2 bits or 1?
switch (pri&0xc000) {
case 0x0000: pri=0; break;
case 0x4000: pri=0xf0; break;
case 0x8000: pri=0xf0|0xcc; break;
case 0xc000: pri=0xf0|0xcc; break; /* or 0xf0|0xcc|0xaa ? */
switch (pri & 0xc000)
{
case 0x0000: pri = 0; break;
case 0x4000: pri = 0xf0; break;
case 0x8000: pri = 0xf0 | 0xcc; break;
case 0xc000: pri = 0xf0 | 0xcc; break; /* or 0xf0|0xcc|0xaa ? */
}
fx = y & 0x2000;
@ -76,9 +77,10 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
if (x >= 320) x -= 512;
if (y >= 256) y -= 512;
y = 240 - y;
x = 304 - x;
x = 304 - x;
if (x>320) continue;
if (x > 320)
continue;
sprite &= ~multi;
if (fy)
@ -91,13 +93,14 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
if (flip_screen_get(machine))
{
y=240-y;
x=304-x;
if (fx) fx=0; else fx=1;
if (fy) fy=0; else fy=1;
mult=16;
y = 240 - y;
x = 304 - x;
if (fx) fx = 0; else fx = 1;
if (fy) fy = 0; else fy = 1;
mult = 16;
}
else mult=-16;
else
mult = -16;
while (multi >= 0)
{
@ -114,31 +117,34 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
}
VIDEO_START( simpl156 )
{
simpl156_state *state = (simpl156_state *)machine->driver_data;
/* allocate the ram as 16-bit (we do it here because the CPU is 32-bit) */
state->pf1_rowscroll = auto_alloc_array(machine, UINT16, 0x800/2);
state->pf2_rowscroll = auto_alloc_array(machine, UINT16, 0x800/2);
machine->generic.paletteram.u16 = auto_alloc_array(machine, UINT16, 0x1000/2);
/* and register the allocated ram so that save states still work */
state_save_register_global_pointer(machine, state->pf1_rowscroll, 0x800/2);
state_save_register_global_pointer(machine, state->pf2_rowscroll, 0x800/2);
state_save_register_global_pointer(machine, machine->generic.paletteram.u16, 0x1000/2);
}
VIDEO_UPDATE( simpl156 )
{
running_device *deco16ic = devtag_get_device(screen->machine, "deco_custom");
bitmap_fill(screen->machine->priority_bitmap,NULL,0);
simpl156_state *state = (simpl156_state *)screen->machine->driver_data;
deco16ic_pf12_update(deco16ic, simpl156_pf1_rowscroll, simpl156_pf2_rowscroll);
bitmap_fill(screen->machine->priority_bitmap, NULL, 0);
deco16ic_pf12_update(state->deco16ic, state->pf1_rowscroll, state->pf2_rowscroll);
bitmap_fill(bitmap, cliprect, 256);
deco16ic_tilemap_2_draw(deco16ic, bitmap, cliprect, 0, 2);
deco16ic_tilemap_1_draw(deco16ic, bitmap, cliprect, 0, 4);
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, 0, 2);
deco16ic_tilemap_1_draw(state->deco16ic, bitmap, cliprect, 0, 4);
draw_sprites(screen->machine, bitmap, cliprect);
return 0;
}
VIDEO_START( simpl156 )
{
/* allocate the ram as 16-bit (we do it here because the CPU is 32-bit) */
simpl156_pf1_rowscroll = auto_alloc_array(machine, UINT16, 0x800/2);
simpl156_pf2_rowscroll = auto_alloc_array(machine, UINT16, 0x800/2);
machine->generic.paletteram.u16 = auto_alloc_array(machine, UINT16, 0x1000/2);
/* and register the allocated ram so that save states still work */
state_save_register_global_pointer(machine, simpl156_pf1_rowscroll, 0x800/2);
state_save_register_global_pointer(machine, simpl156_pf2_rowscroll, 0x800/2);
state_save_register_global_pointer(machine, machine->generic.paletteram.u16, 0x1000/2);
}