02776: mwalk, mwalkj, mwalku: Crash when starting game

Also fixed rendering so that System 16 sprites don't attempt to
shadow VDP pixels (causes crash downstream in debug builds).
This commit is contained in:
Aaron Giles 2008-12-30 05:44:23 +00:00
parent cd91fd3613
commit e6a05fd4f6
5 changed files with 121 additions and 33 deletions

View File

@ -1453,7 +1453,6 @@ static TIMER_CALLBACK( triggertime_callback )
}
/*-------------------------------------------------
empty_event_queue - empty a CPU's event queue
for a specific input line

View File

@ -92,43 +92,43 @@ static WRITE16_HANDLER( rom_5987_bank_w );
static const segaic16_memory_map_entry rom_171_shad_info[] =
{
{ 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, misc_io_r, misc_io_w, NULL, "I/O space" },
{ 0x39/2, 0x00000, 0x02000, 0xffe000, ~0, SMH_BANK10, segaic16_paletteram_w, &paletteram16, "color RAM" },
{ 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, SMH_BANK11, segaic16_tileram_0_w, &segaic16_tileram_0, "tile RAM" },
{ 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, SMH_BANK12, segaic16_textram_0_w, &segaic16_textram_0, "text RAM" },
{ 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, SMH_BANK13, SMH_BANK13, &segaic16_spriteram_0, "object RAM" },
{ 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, SMH_BANK14, SMH_BANK14, &workram, "work RAM" },
{ 0x29/2, 0x00000, 0x10000, 0xff0000, ~0, NULL, NULL, NULL, "????" },
{ 0x25/2, 0x00000, 0x00010, 0xfffff0, ~0, genesis_vdp_r, genesis_vdp_w, NULL, "VDP" },
{ 0x21/2, 0x00000, 0x80000, 0xf80000, 0x00000, SMH_BANK17, SMH_UNMAP, NULL, "ROM 0" },
{ 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, misc_io_r, misc_io_w, NULL, "I/O space" },
{ 0x39/2, 0x00000, 0x02000, 0xffe000, ~0, SMH_BANK10, segaic16_paletteram_w, &paletteram16, "color RAM" },
{ 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, SMH_BANK11, segaic16_tileram_0_w, &segaic16_tileram_0, "tile RAM" },
{ 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, SMH_BANK12, segaic16_textram_0_w, &segaic16_textram_0, "text RAM" },
{ 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, SMH_BANK13, SMH_BANK13, &segaic16_spriteram_0, "object RAM" },
{ 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, SMH_BANK14, SMH_BANK14, &workram, "work RAM" },
{ 0x29/2, 0x00000, 0x10000, 0xff0000, ~0, NULL, NULL, NULL, "????" },
{ 0x25/2, 0x00000, 0x00010, 0xfffff0, ~0, genesis_vdp_r, genesis_vdp_w, NULL, "VDP" },
{ 0x21/2, 0x00000, 0x80000, 0xf80000, 0x00000, SMH_BANK17, SMH_UNMAP, NULL, "ROM 0" },
{ 0 }
};
static const segaic16_memory_map_entry rom_171_5874_info[] =
{
{ 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, misc_io_r, misc_io_w, NULL, "I/O space" },
{ 0x39/2, 0x00000, 0x02000, 0xffe000, ~0, SMH_BANK10, segaic16_paletteram_w, &paletteram16, "color RAM" },
{ 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, SMH_BANK11, segaic16_tileram_0_w, &segaic16_tileram_0, "tile RAM" },
{ 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, SMH_BANK12, segaic16_textram_0_w, &segaic16_textram_0, "text RAM" },
{ 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, SMH_BANK13, SMH_BANK13, &segaic16_spriteram_0, "object RAM" },
{ 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, SMH_BANK14, SMH_BANK14, &workram, "work RAM" },
{ 0x29/2, 0x00000, 0x00010, 0xfffff0, ~0, genesis_vdp_r, genesis_vdp_w, NULL, "VDP" },
{ 0x25/2, 0x00000, 0x80000, 0xf80000, 0x80000, SMH_BANK16, SMH_UNMAP, NULL, "ROM 1" },
{ 0x21/2, 0x00000, 0x80000, 0xf80000, 0x00000, SMH_BANK17, SMH_UNMAP, NULL, "ROM 0" },
{ 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, misc_io_r, misc_io_w, NULL, "I/O space" },
{ 0x39/2, 0x00000, 0x02000, 0xffe000, ~0, SMH_BANK10, segaic16_paletteram_w, &paletteram16, "color RAM" },
{ 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, SMH_BANK11, segaic16_tileram_0_w, &segaic16_tileram_0, "tile RAM" },
{ 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, SMH_BANK12, segaic16_textram_0_w, &segaic16_textram_0, "text RAM" },
{ 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, SMH_BANK13, SMH_BANK13, &segaic16_spriteram_0, "object RAM" },
{ 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, SMH_BANK14, SMH_BANK14, &workram, "work RAM" },
{ 0x29/2, 0x00000, 0x00010, 0xfffff0, ~0, genesis_vdp_r, genesis_vdp_w, NULL, "VDP" },
{ 0x25/2, 0x00000, 0x80000, 0xf80000, 0x80000, SMH_BANK16, SMH_UNMAP, NULL, "ROM 1" },
{ 0x21/2, 0x00000, 0x80000, 0xf80000, 0x00000, SMH_BANK17, SMH_UNMAP, NULL, "ROM 0" },
{ 0 }
};
static const segaic16_memory_map_entry rom_171_5987_info[] =
{
{ 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, misc_io_r, misc_io_w, NULL, "I/O space" },
{ 0x39/2, 0x00000, 0x02000, 0xffe000, ~0, SMH_BANK10, segaic16_paletteram_w, &paletteram16, "color RAM" },
{ 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, SMH_BANK11, segaic16_tileram_0_w, &segaic16_tileram_0, "tile RAM" },
{ 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, SMH_BANK12, segaic16_textram_0_w, &segaic16_textram_0, "text RAM" },
{ 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, SMH_BANK13, SMH_BANK13, &segaic16_spriteram_0, "object RAM" },
{ 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, SMH_BANK14, SMH_BANK14, &workram, "work RAM" },
{ 0x29/2, 0x00000, 0x00010, 0xfffff0, ~0, genesis_vdp_r, genesis_vdp_w, NULL, "VDP" },
{ 0x25/2, 0x00000, 0x80000, 0xf80000, 0x80000, SMH_BANK16, rom_5987_bank_w, NULL, "ROM 1/banking" },
{ 0x21/2, 0x00000, 0x100000,0xf00000, 0x00000, SMH_BANK17, SMH_UNMAP, NULL, "ROM 0" },
{ 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, misc_io_r, misc_io_w, NULL, "I/O space" },
{ 0x39/2, 0x00000, 0x02000, 0xffe000, ~0, SMH_BANK10, segaic16_paletteram_w, &paletteram16, "color RAM" },
{ 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, SMH_BANK11, segaic16_tileram_0_w, &segaic16_tileram_0, "tile RAM" },
{ 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, SMH_BANK12, segaic16_textram_0_w, &segaic16_textram_0, "text RAM" },
{ 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, SMH_BANK13, SMH_BANK13, &segaic16_spriteram_0, "object RAM" },
{ 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, SMH_BANK14, SMH_BANK14, &workram, "work RAM" },
{ 0x29/2, 0x00000, 0x00010, 0xfffff0, ~0, genesis_vdp_r, genesis_vdp_w, NULL, "VDP" },
{ 0x25/2, 0x00000, 0x80000, 0xf80000, 0x80000, SMH_BANK16, rom_5987_bank_w, NULL, "ROM 1/banking" },
{ 0x21/2, 0x00000, 0x100000,0xf00000, 0x00000, SMH_BANK17, SMH_UNMAP, NULL, "ROM 0" },
{ 0 }
};
@ -561,7 +561,7 @@ static WRITE8_HANDLER( soundbank_w )
static WRITE8_HANDLER( mcu_data_w )
{
mcu_data = data;
cpu_set_input_line(space->machine->cpu[2], 1, PULSE_LINE);
cpu_set_input_line(space->machine->cpu[2], MCS51_INT1_LINE, HOLD_LINE);
}
@ -1311,7 +1311,7 @@ static MACHINE_DRIVER_START( system18_8751 )
MDRV_CPU_ADD("mcu", I8751, 8000000)
MDRV_CPU_IO_MAP(mcu_io_map,0)
MDRV_CPU_VBLANK_INT("main", irq0_line_pulse)
MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
MACHINE_DRIVER_END

View File

@ -215,9 +215,11 @@ static void memory_mapper_w(const address_space *space, struct memory_mapper_chi
/* 03 - maybe controls halt and reset lines together? */
if ((oldval ^ chip->regs[offset]) & 3)
{
cpu_set_input_line(chip->cpu, INPUT_LINE_RESET, (chip->regs[offset] & 3) == 3 ? ASSERT_LINE : CLEAR_LINE);
if ((chip->regs[offset] & 3) == 3)
fd1094_machine_init(space->machine->cpu[0]);
/* fd1094_machine_init calls device_reset on the CPU, so we must do this afterwards */
cpu_set_input_line(chip->cpu, INPUT_LINE_RESET, (chip->regs[offset] & 3) == 3 ? ASSERT_LINE : CLEAR_LINE);
}
break;
@ -229,7 +231,11 @@ static void memory_mapper_w(const address_space *space, struct memory_mapper_chi
case 0x04:
/* controls IRQ lines to 68000, negative logic -- write $B to signal IRQ4 */
if ((chip->regs[offset] & 7) != 7)
cpu_set_input_line(chip->cpu, (~chip->regs[offset] & 7), HOLD_LINE);
{
int irqnum;
for (irqnum = 0; irqnum < 8; irqnum++)
cpu_set_input_line(chip->cpu, irqnum, (irqnum == (~chip->regs[offset] & 7)) ? HOLD_LINE : CLEAR_LINE);
}
break;
case 0x05:

View File

@ -1978,7 +1978,12 @@ static void segaic16_sprites_16a_draw(running_machine *machine, struct sprite_in
{ \
/* shadow/hilight mode? */ \
if (color == info->colorbase + (0x3f << 4)) \
dest[x] += (paletteram16[dest[x]] & 0x8000) ? palette.entries*2 : palette.entries; \
{ \
/* we have to check this for System 18 so that we don't */ \
/* attempt to shadow VDP pixels */ \
if (dest[x] < palette.entries) \
dest[x] += (paletteram16[dest[x]] & 0x8000) ? palette.entries*2 : palette.entries; \
} \
\
/* regular draw */ \
else \

View File

@ -218,26 +218,104 @@ VIDEO_UPDATE( system18 )
/* draw background opaquely first, not setting any priorities */
segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 0 | TILEMAP_DRAW_OPAQUE, 0x00);
{
int x,y;
for (y = cliprect->min_y; y <= cliprect->max_y; y++)
for (x = cliprect->min_x; x <= cliprect->max_x; x++)
if (*BITMAP_ADDR16(bitmap, y, x) >= 0x2000) printf("0: pix=%04X\n", *BITMAP_ADDR16(bitmap, y, x));
}
segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 1 | TILEMAP_DRAW_OPAQUE, 0x00);
{
int x,y;
for (y = cliprect->min_y; y <= cliprect->max_y; y++)
for (x = cliprect->min_x; x <= cliprect->max_x; x++)
if (*BITMAP_ADDR16(bitmap, y, x) >= 0x2000) printf("1: pix=%04X\n", *BITMAP_ADDR16(bitmap, y, x));
}
if (vdp_enable && vdplayer == 0) draw_vdp(bitmap, cliprect, vdppri);
{
int x,y;
for (y = cliprect->min_y; y <= cliprect->max_y; y++)
for (x = cliprect->min_x; x <= cliprect->max_x; x++)
if (*BITMAP_ADDR16(bitmap, y, x) >= 0x2000) printf("2: pix=%04X\n", *BITMAP_ADDR16(bitmap, y, x));
}
/* draw background again to draw non-transparent pixels over the VDP and set the priority */
segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 0, 0x01);
{
int x,y;
for (y = cliprect->min_y; y <= cliprect->max_y; y++)
for (x = cliprect->min_x; x <= cliprect->max_x; x++)
if (*BITMAP_ADDR16(bitmap, y, x) >= 0x2000) printf("3: pix=%04X\n", *BITMAP_ADDR16(bitmap, y, x));
}
segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 1, 0x02);
{
int x,y;
for (y = cliprect->min_y; y <= cliprect->max_y; y++)
for (x = cliprect->min_x; x <= cliprect->max_x; x++)
if (*BITMAP_ADDR16(bitmap, y, x) >= 0x2000) printf("4: pix=%04X\n", *BITMAP_ADDR16(bitmap, y, x));
}
if (vdp_enable && vdplayer == 1) draw_vdp(bitmap, cliprect, vdppri);
{
int x,y;
for (y = cliprect->min_y; y <= cliprect->max_y; y++)
for (x = cliprect->min_x; x <= cliprect->max_x; x++)
if (*BITMAP_ADDR16(bitmap, y, x) >= 0x2000) printf("5: pix=%04X\n", *BITMAP_ADDR16(bitmap, y, x));
}
/* draw foreground */
segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 0, 0x02);
{
int x,y;
for (y = cliprect->min_y; y <= cliprect->max_y; y++)
for (x = cliprect->min_x; x <= cliprect->max_x; x++)
if (*BITMAP_ADDR16(bitmap, y, x) >= 0x2000) printf("6: pix=%04X\n", *BITMAP_ADDR16(bitmap, y, x));
}
segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 1, 0x04);
{
int x,y;
for (y = cliprect->min_y; y <= cliprect->max_y; y++)
for (x = cliprect->min_x; x <= cliprect->max_x; x++)
if (*BITMAP_ADDR16(bitmap, y, x) >= 0x2000) printf("7: pix=%04X\n", *BITMAP_ADDR16(bitmap, y, x));
}
if (vdp_enable && vdplayer == 2) draw_vdp(bitmap, cliprect, vdppri);
{
int x,y;
for (y = cliprect->min_y; y <= cliprect->max_y; y++)
for (x = cliprect->min_x; x <= cliprect->max_x; x++)
if (*BITMAP_ADDR16(bitmap, y, x) >= 0x2000) printf("8: pix=%04X\n", *BITMAP_ADDR16(bitmap, y, x));
}
/* text layer */
segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 0, 0x04);
{
int x,y;
for (y = cliprect->min_y; y <= cliprect->max_y; y++)
for (x = cliprect->min_x; x <= cliprect->max_x; x++)
if (*BITMAP_ADDR16(bitmap, y, x) >= 0x2000) printf("9: pix=%04X\n", *BITMAP_ADDR16(bitmap, y, x));
}
segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 1, 0x08);
{
int x,y;
for (y = cliprect->min_y; y <= cliprect->max_y; y++)
for (x = cliprect->min_x; x <= cliprect->max_x; x++)
if (*BITMAP_ADDR16(bitmap, y, x) >= 0x2000) printf("A: pix=%04X\n", *BITMAP_ADDR16(bitmap, y, x));
}
if (vdp_enable && vdplayer == 3) draw_vdp(bitmap, cliprect, vdppri);
{
int x,y;
for (y = cliprect->min_y; y <= cliprect->max_y; y++)
for (x = cliprect->min_x; x <= cliprect->max_x; x++)
if (*BITMAP_ADDR16(bitmap, y, x) >= 0x2000) printf("B: pix=%04X\n", *BITMAP_ADDR16(bitmap, y, x));
}
/* draw the sprites */
segaic16_sprites_draw(screen, bitmap, cliprect, 0);
{
int x,y;
for (y = cliprect->min_y; y <= cliprect->max_y; y++)
for (x = cliprect->min_x; x <= cliprect->max_x; x++)
if (*BITMAP_ADDR16(bitmap, y, x) >= 0x2000) printf("C: pix=%04X\n", *BITMAP_ADDR16(bitmap, y, x));
}
#if DEBUG_VDP
if (vdp_enable && input_code_pressed(KEYCODE_V))