diff options
author | 2008-02-29 15:09:04 +0000 | |
---|---|---|
committer | 2008-02-29 15:09:04 +0000 | |
commit | f126c9fc265d76dd145ce23051c4b10c3277779c (patch) | |
tree | d61d66f29018b15c5287087f692c84ae3bd5f076 /src/emu/validity.c | |
parent | 51a3a9eb016a91a3de8e8b4ed3e1ac57a1479bc2 (diff) |
Most of this descriptions taken directly from an e-mail by Aaron:
- Define a new MDRV_CPU_VBLANK_INT_HACK() (ZV: defined in deprecat.h) which is a copy of the current MDRV_CPU_VBLANK_INT()
- Find all the places where VBLANK_INT is used with something other than 1 interrupt per frame and change it to the new macro
- Remove the "# per frame" parameter from the MDRV_SCREEN_VBLANK_INT() and add a screen tag in its place; updated all callers appropriately.
- ZV: Added some validation of the interrupt setup to validate.c
The idea behind this is that using a VBLANK interrupt with more than one interrupt per frame in conceptually wrong.
The screen tag will allow us to move the interrupt timing code from cpuexec.c to video.c, where it really belongs.
Diffstat (limited to 'src/emu/validity.c')
-rw-r--r-- | src/emu/validity.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/emu/validity.c b/src/emu/validity.c index bd05902034d..04fc0141a98 100644 --- a/src/emu/validity.c +++ b/src/emu/validity.c @@ -759,6 +759,59 @@ static int validate_cpu(int drivnum, const machine_config *config, const UINT32 } } } + + /* validate the interrupts */ + if (cpu->vblank_interrupt != NULL) + { + if (cpu->vblank_interrupts_per_frame == 0) + { + mame_printf_error("%s: %s cpu #%d has a VBLANK interrupt handler with 0 interrupts!\n", driver->source_file, driver->name, cpunum); + error = TRUE; + } + else if (cpu->vblank_interrupts_per_frame == 1) + { + if (cpu->vblank_interrupt_screen == NULL) + { + mame_printf_error("%s: %s cpu #%d has a valid VBLANK interrupt handler with no screen tag supplied!\n", driver->source_file, driver->name, cpunum); + error = TRUE; + } + else + { + int screen_tag_found = FALSE; + const device_config *device; + + /* loop over screens looking for the tag */ + for (device = video_screen_first(config); device != NULL; device = video_screen_next(device)) + if (strcmp(device->tag, cpu->vblank_interrupt_screen) == 0) + { + screen_tag_found = TRUE; + break; + } + + if (!screen_tag_found) + { + mame_printf_error("%s: %s cpu #%d VBLANK interrupt with a non-existant screen tag (%s)!\n", driver->source_file, driver->name, cpunum, cpu->vblank_interrupt_screen); + error = TRUE; + } + } + } + } + else if (cpu->vblank_interrupts_per_frame != 0) + { + mame_printf_error("%s: %s cpu #%d has no VBLANK interrupt handler but a non-0 interrupt count is given!\n", driver->source_file, driver->name, cpunum); + error = TRUE; + } + + if ((cpu->timed_interrupt != NULL) && (cpu->timed_interrupt_period == 0)) + { + mame_printf_error("%s: %s cpu #%d has a timer interrupt handler with 0 period!\n", driver->source_file, driver->name, cpunum); + error = TRUE; + } + else if ((cpu->timed_interrupt == NULL) && (cpu->timed_interrupt_period != 0)) + { + mame_printf_error("%s: %s cpu #%d has a no timer interrupt handler but has a non-0 period given!\n", driver->source_file, driver->name, cpunum); + error = TRUE; + } } } |