diff options
author | Aaron Giles <aaron@aarongiles.com> | 2007-12-31 01:46:50 +0000 |
---|---|---|
committer | Aaron Giles <aaron@aarongiles.com> | 2007-12-31 01:46:50 +0000 |
commit | b482fd8c82adf5ad5d4945767b11cf4ed7284008 (patch) | |
tree | 901694ee264c2e75448ec3223fb63262c54b9f2f /src/mame | |
parent | 3228b1b341ba28ec9be0e2148a481bd4b8e1c2f0 (diff) |
Add register usage tracking to Zeus 2.
Added artifical Z offset of -2 to make the full screen show in crusnexo.
Really fixed TMS3203x interrupt handling.
Added hack to catch invalid SP values during 32031 execution (debug mode only).
Diffstat (limited to 'src/mame')
-rw-r--r-- | src/mame/drivers/gaelco3d.c | 2 | ||||
-rw-r--r-- | src/mame/drivers/midzeus.c | 26 | ||||
-rw-r--r-- | src/mame/video/midvunit.c | 2 | ||||
-rw-r--r-- | src/mame/video/midzeus2.c | 103 |
4 files changed, 127 insertions, 6 deletions
diff --git a/src/mame/drivers/gaelco3d.c b/src/mame/drivers/gaelco3d.c index 9c0b64746b6..7c8ad1adcf2 100644 --- a/src/mame/drivers/gaelco3d.c +++ b/src/mame/drivers/gaelco3d.c @@ -453,7 +453,7 @@ static WRITE16_HANDLER( tms_irq_w ) /* done after uploading, and after modifying the comm area */ logerror("%06X:tms_irq_w(%02X) = %08X & %08X\n", activecpu_get_pc(), offset, data, ~mem_mask); if (!(mem_mask & 0xff)) - cpunum_set_input_line(1, 0, (data & 0x01) ? ASSERT_LINE : CLEAR_LINE); + cpunum_set_input_line(1, 0, (data & 0x01) ? CLEAR_LINE : ASSERT_LINE); } static WRITE32_HANDLER( tms_irq_020_w ) { if ((mem_mask & 0xffff) != 0xffff) tms_irq_w(offset, data, mem_mask); } diff --git a/src/mame/drivers/midzeus.c b/src/mame/drivers/midzeus.c index a7e9de8d5c9..bd4b888aa91 100644 --- a/src/mame/drivers/midzeus.c +++ b/src/mame/drivers/midzeus.c @@ -89,6 +89,25 @@ static MACHINE_RESET( midzeus ) /************************************* * + * Display interrupt generation + * + *************************************/ + +static TIMER_CALLBACK( display_irq_off ) +{ + cpunum_set_input_line(0, 0, CLEAR_LINE); +} + +static INTERRUPT_GEN( display_irq ) +{ + cpunum_set_input_line(0, 0, ASSERT_LINE); + timer_set(ATTOTIME_IN_HZ(30000000), NULL, 0, display_irq_off); +} + + + +/************************************* + * * CMOS access (Zeus only) * *************************************/ @@ -417,7 +436,7 @@ static ADDRESS_MAP_START( zeus2_map, ADDRESS_SPACE_PROGRAM, 32 ) AM_RANGE(0x000000, 0x03ffff) AM_RAM AM_BASE(&ram_base) AM_RANGE(0x400000, 0x43ffff) AM_RAM AM_RANGE(0x808000, 0x80807f) AM_READWRITE(tms32031_control_r, tms32031_control_w) AM_BASE(&tms32031_control) - AM_RANGE(0x880000, 0x8801ff) AM_READWRITE(zeus2_r, zeus2_w) AM_BASE(&zeusbase) + AM_RANGE(0x880000, 0x88007f) AM_READWRITE(zeus2_r, zeus2_w) AM_BASE(&zeusbase) AM_RANGE(0x8a0000, 0x8a0027) AM_READWRITE(unknown_8a0000_r, unknown_8a0000_w) AM_BASE(&unknown_8a0000) AM_RANGE(0x8d0000, 0x8d0003) AM_READWRITE(unknown_8d0000_r, unknown_8d0000_w) AM_BASE(&unknown_8d0000) AM_RANGE(0x8d0005, 0x8d0005) AM_WRITE(rombank_select_w) @@ -884,7 +903,7 @@ static MACHINE_DRIVER_START( midzeus ) /* basic machine hardware */ MDRV_CPU_ADD_TAG("main", TMS32032, CPU_CLOCK) MDRV_CPU_PROGRAM_MAP(zeus_map,0) - MDRV_CPU_VBLANK_INT(irq0_line_assert,1) + MDRV_CPU_VBLANK_INT(display_irq,1) MDRV_MACHINE_START(midzeus) MDRV_MACHINE_RESET(midzeus) @@ -911,7 +930,7 @@ static MACHINE_DRIVER_START( midzeus2 ) /* basic machine hardware */ MDRV_CPU_ADD_TAG("main", TMS32032, CPU_CLOCK) MDRV_CPU_PROGRAM_MAP(zeus2_map,0) - MDRV_CPU_VBLANK_INT(irq0_line_assert,1) + MDRV_CPU_VBLANK_INT(display_irq,1) MDRV_MACHINE_START(midzeus2) MDRV_MACHINE_RESET(midzeus) @@ -1081,7 +1100,6 @@ static DRIVER_INIT( crusnexo ) static DRIVER_INIT( thegrid ) { - cpunum_set_input_line(0, INPUT_LINE_HALT, ASSERT_LINE); dcs2_init(0, 0); midway_ioasic_init(MIDWAY_IOASIC_STANDARD, 474/* or 491 */, 99, NULL); memory_configure_bank(1, 0, 3, memory_region(REGION_USER2), 0x400000*4); diff --git a/src/mame/video/midvunit.c b/src/mame/video/midvunit.c index 5960ea2fdd3..606d377feb6 100644 --- a/src/mame/video/midvunit.c +++ b/src/mame/video/midvunit.c @@ -61,7 +61,7 @@ static TIMER_CALLBACK( scanline_timer_cb ) { cpunum_set_input_line(0, 0, ASSERT_LINE); timer_adjust(scanline_timer, video_screen_get_time_until_pos(0, scanline + 1, 0), scanline, attotime_zero); - timer_set(video_screen_get_time_until_pos(0, video_screen_get_vpos(0) + 1, video_screen_get_hpos(0)), NULL, -1, scanline_timer_cb); + timer_set(ATTOTIME_IN_HZ(25000000), NULL, -1, scanline_timer_cb); } else cpunum_set_input_line(0, 0, CLEAR_LINE); diff --git a/src/mame/video/midzeus2.c b/src/mame/video/midzeus2.c index 7f761683516..2a0ade616e7 100644 --- a/src/mame/video/midzeus2.c +++ b/src/mame/video/midzeus2.c @@ -20,6 +20,7 @@ *************************************/ #define DUMP_WAVE_RAM 0 +#define TRACK_REG_USAGE 0 #define WAVERAM0_WIDTH 1024 #define WAVERAM0_HEIGHT 2048 @@ -76,6 +77,23 @@ static int zeus_quad_size; static UINT32 *waveram[2]; static emu_timer *int_timer; +#if TRACK_REG_USAGE +typedef struct reg_info +{ + struct reg_info *next; + UINT32 value; +} reg_info; + +static reg_info *regdata[0x80]; +static int regdata_count[0x80]; +static int regread_count[0x80]; +static int regwrite_count[0x80]; +static reg_info *subregdata[0x100]; +static int subregdata_count[0x80]; +static int subregwrite_count[0x100]; + +#endif + /************************************* @@ -286,6 +304,39 @@ static void exit_handler(running_machine *machine) fclose(f); #endif +#if TRACK_REG_USAGE +{ + reg_info *info; + int regnum; + + for (regnum = 0; regnum < 0x80; regnum++) + { + printf("Register %02X\n", regnum); + if (regread_count[regnum] == 0) + printf("\tNever read\n"); + else + printf("\tRead %d times\n", regread_count[regnum]); + + if (regwrite_count[regnum] == 0) + printf("\tNever written\n"); + else + { + printf("\tWritten %d times\n", regwrite_count[regnum]); + for (info = regdata[regnum]; info != NULL; info = info->next) + printf("\t%08X\n", info->value); + } + } + + for (regnum = 0; regnum < 0x100; regnum++) + if (subregwrite_count[regnum] != 0) + { + printf("Sub-Register %02X (%d writes)\n", regnum, subregwrite_count[regnum]); + for (info = subregdata[regnum]; info != NULL; info = info->next) + printf("\t%08X\n", info->value); + } +} +#endif + poly_free(poly); } @@ -297,12 +348,17 @@ static void exit_handler(running_machine *machine) * *************************************/ +static float zbase = 2.0f; + VIDEO_UPDATE( midzeus2 ) { int x, y; poly_wait(poly, "VIDEO_UPDATE"); +if (input_code_pressed(KEYCODE_UP)) { zbase += 1.0f; popmessage("Zbase = %f", zbase); } +if (input_code_pressed(KEYCODE_DOWN)) { zbase -= 1.0f; popmessage("Zbase = %f", zbase); } + /* normal update case */ if (!input_code_pressed(KEYCODE_W)) { @@ -359,6 +415,10 @@ READ32_HANDLER( zeus2_r ) int logit = (offset != 0x00 && offset != 0x01 && offset != 0x54 && offset != 0x48 && offset != 0x49 && offset != 0x58 && offset != 0x59 && offset != 0x5a); UINT32 result = zeusbase[offset]; +#if TRACK_REG_USAGE + regread_count[offset]++; +#endif + if (logit) logerror("%06X:zeus2_r(%02X)\n", activecpu_get_pc(), offset); @@ -422,6 +482,25 @@ static void zeus_register32_w(offs_t offset, UINT32 data, int logit) { UINT32 oldval = zeusbase[offset]; +#if TRACK_REG_USAGE +regwrite_count[offset]++; +if (regdata_count[offset] < 256) +{ + reg_info **tailptr; + + for (tailptr = ®data[offset]; *tailptr != NULL; tailptr = &(*tailptr)->next) + if ((*tailptr)->value == data) + break; + if (*tailptr == NULL) + { + *tailptr = malloc_or_die(sizeof(reg_info)); + (*tailptr)->next = NULL; + (*tailptr)->value = data; + regdata_count[offset]++; + } +} +#endif + /* writes to register $CC need to force a partial update */ // if ((offset & ~1) == 0xcc) // video_screen_update_partial(0, video_screen_get_vpos(0)); @@ -647,6 +726,25 @@ static void zeus_register_update(offs_t offset, UINT32 oldval, int logit) static void zeus_pointer_write(UINT8 which, UINT32 value) { +#if TRACK_REG_USAGE +subregwrite_count[which]++; +if (subregdata_count[which] < 256) +{ + reg_info **tailptr; + + for (tailptr = &subregdata[which]; *tailptr != NULL; tailptr = &(*tailptr)->next) + if ((*tailptr)->value == value) + break; + if (*tailptr == NULL) + { + *tailptr = malloc_or_die(sizeof(reg_info)); + (*tailptr)->next = NULL; + (*tailptr)->value = value; + subregdata_count[which]++; + } +} +#endif + switch (which) { case 0x04: @@ -842,6 +940,9 @@ static void zeus_draw_model(UINT32 baseaddr, UINT16 count, int logit) if (logit) logerror(" -- model @ %08X, len %04X\n", baseaddr, count); + if (count > 0x1000) + fatalerror("Extreme count\n"); + while (baseaddr != 0 && !model_done) { const void *base = waveram0_ptr_from_expanded_addr(baseaddr); @@ -1063,6 +1164,7 @@ In memory: vert[i].x = x * zeus_matrix[0][0] + y * zeus_matrix[0][1] + z * zeus_matrix[0][2] + zeus_point[0]; vert[i].y = x * zeus_matrix[1][0] + y * zeus_matrix[1][1] + z * zeus_matrix[1][2] + zeus_point[1]; vert[i].p[0] = x * zeus_matrix[2][0] + y * zeus_matrix[2][1] + z * zeus_matrix[2][2] + zeus_point[2]; +vert[i].p[0] += zbase; vert[i].p[2] += texoffs >> 16; vert[i].p[1] *= 256.0f; vert[i].p[2] *= 256.0f; @@ -1082,6 +1184,7 @@ In memory: maxx = maxy = -1000.0f; for (i = 0; i < numverts; i++) { +// 412.0f here works for crusnexo float ooz = 512.0f / clipvert[i].p[0]; // ooz *= 1.0f / (512.0f * 512.0f); |