Some misc cleanups:

- added warning messages for auto_malloc, timer, and save state
    allocations done after init time. These should be fixed when
    detected, as I would eventually like to disallow them entirely.
 - changed state registration functions to pass through the caller's
    file and line number to facilitate fixing the above warnings
 - converted Taito F3 sound to a separate machine driver which is
    imported into games that use it
 - converted the balsente driver to driver_data structure
 - converted harddriv timers into devices
 - fixed crash in cps2 games due to not configuring the qsound bank
 - cleaned up initialization in taito_l to allocate at init time
    instead of reset time
This commit is contained in:
Aaron Giles 2009-12-15 02:37:46 +00:00
parent c1c28e486b
commit f43747b221
28 changed files with 584 additions and 564 deletions

View File

@ -151,7 +151,7 @@ void intelflash_init(running_machine *machine, int chip, int type, void *data)
state_save_register_item( machine, "intelfsh", NULL, chip, c->status );
state_save_register_item( machine, "intelfsh", NULL, chip, c->flash_mode );
state_save_register_item( machine, "intelfsh", NULL, chip, c->flash_master_lock );
state_save_register_memory( machine, "intelfsh", NULL, chip, "flash_memory", c->flash_memory, c->bits/8, c->size / (c->bits/8) );
state_save_register_memory( machine, "intelfsh", NULL, chip, "flash_memory", c->flash_memory, c->bits/8, c->size / (c->bits/8), __FILE__, __LINE__ );
}
UINT32 intelflash_read(int chip, UINT32 address)

View File

@ -3443,7 +3443,7 @@ static void *block_allocate(const address_space *space, offs_t bytestart, offs_t
char name[256];
sprintf(name, "%08x-%08x", bytestart, byteend);
state_save_register_memory(space->machine, "memory", space->cpu->tag, space->spacenum, name, memory, bytes_per_element, (UINT32)(byteend - bytestart + 1) / bytes_per_element);
state_save_register_memory(space->machine, "memory", space->cpu->tag, space->spacenum, name, memory, bytes_per_element, (UINT32)(byteend - bytestart + 1) / bytes_per_element, __FILE__, __LINE__);
}
/* fill in the tracking block */

View File

@ -13,6 +13,7 @@
#include "pool.h"
#include "timer.h"
#include "state.h"
#include "mame.h"
@ -188,6 +189,7 @@ static object_pool *current_pool(void)
void *restrack_register_object(object_type type, void *ptr, size_t size, const char *file, int line)
{
if (resource_tracking_tag == 2) mame_printf_warning("restrack_register_object(%p,%d) called within reset scope by %s, line %d\n", ptr, size, file, line);
return pool_object_add_file_line(current_pool(), type, ptr, size, file, line);
}
@ -200,6 +202,7 @@ void *restrack_register_object(object_type type, void *ptr, size_t size, const c
void *auto_malloc_file_line(running_machine *machine, size_t size, const char *file, int line)
{
void *result = pool_malloc_file_line(current_pool(), size, file, line);
if (resource_tracking_tag == 2) mame_printf_warning("auto_malloc(%d) called within reset scope by %s, line %d\n", size, file, line);
#ifdef MAME_DEBUG
rand_memory(result, size);
#endif
@ -215,6 +218,7 @@ void *auto_malloc_file_line(running_machine *machine, size_t size, const char *f
void *auto_realloc_file_line(running_machine *machine, void *ptr, size_t size, const char *file, int line)
{
object_pool *pool = current_pool();
if (resource_tracking_tag == 2) mame_printf_warning("auto_realloc(%p, %d) called within reset scope by %s, line %d\n", ptr, size, file, line);
if (ptr != NULL)
{
int tag = resource_tracking_tag;
@ -238,6 +242,7 @@ void *auto_realloc_file_line(running_machine *machine, void *ptr, size_t size, c
char *auto_strdup_file_line(running_machine *machine, const char *str, const char *file, int line)
{
if (resource_tracking_tag == 2) mame_printf_warning("auto_strdup() called within reset scope by %s, line %d\n", file, line);
return pool_strdup_file_line(current_pool(), str, file, line);
}
@ -249,6 +254,7 @@ char *auto_strdup_file_line(running_machine *machine, const char *str, const cha
char *auto_strdup_allow_null_file_line(running_machine *machine, const char *str, const char *file, int line)
{
if (resource_tracking_tag == 2) mame_printf_warning("auto_strdup_allow_null() called within reset scope by %s, line %d\n", file, line);
return (str != NULL) ? auto_strdup_file_line(machine, str, file, line) : NULL;
}
@ -260,6 +266,7 @@ char *auto_strdup_allow_null_file_line(running_machine *machine, const char *str
astring *auto_astring_alloc_file_line(running_machine *machine, const char *file, int line)
{
if (resource_tracking_tag == 2) mame_printf_warning("auto_astring_alloc() called within reset scope by %s, line %d\n", file, line);
return (astring *)restrack_register_object(OBJTYPE_ASTRING, astring_alloc(), 0, file, line);
}
@ -271,6 +278,7 @@ astring *auto_astring_alloc_file_line(running_machine *machine, const char *file
bitmap_t *auto_bitmap_alloc_file_line(running_machine *machine, int width, int height, bitmap_format format, const char *file, int line)
{
if (resource_tracking_tag == 2) mame_printf_warning("auto_bitmap_alloc(%d,%d) called within reset scope by %s, line %d\n", width, height, file, line);
return (bitmap_t *)restrack_register_object(OBJTYPE_BITMAP, bitmap_alloc(width, height, format), width * height, file, line);
}

View File

@ -468,7 +468,7 @@ static DEVICE_START( cdp1864 )
state_save_register_device_item(device, 0, cdp1864->signal);
state_save_register_device_item(device, 0, cdp1864->incr);
state_save_register_bitmap(device->machine, "cdp1864", device->tag, 0, "cdp1864->bitmap", cdp1864->bitmap);
state_save_register_device_item_bitmap(device, 0, cdp1864->bitmap);
}
/*-------------------------------------------------

View File

@ -223,7 +223,7 @@ int state_save_registration_allowed(running_machine *machine)
array of data in memory
-------------------------------------------------*/
void state_save_register_memory(running_machine *machine, const char *module, const char *tag, UINT32 index, const char *name, void *val, UINT32 valsize, UINT32 valcount)
void state_save_register_memory(running_machine *machine, const char *module, const char *tag, UINT32 index, const char *name, void *val, UINT32 valsize, UINT32 valcount, const char *file, int line)
{
state_private *global = machine->state_data;
state_entry **entryptr, *next;
@ -272,7 +272,7 @@ void state_save_register_memory(running_machine *machine, const char *module, co
(*entryptr)->name = totalname;
(*entryptr)->typesize = valsize;
(*entryptr)->typecount = valcount;
restrack_register_object(OBJTYPE_STATEREG, *entryptr, 0, __FILE__, __LINE__);
restrack_register_object(OBJTYPE_STATEREG, *entryptr, 0, file, line);
}
@ -281,9 +281,9 @@ void state_save_register_memory(running_machine *machine, const char *module, co
bitmap to be saved
-------------------------------------------------*/
void state_save_register_bitmap(running_machine *machine, const char *module, const char *tag, UINT32 index, const char *name, bitmap_t *val)
void state_save_register_bitmap(running_machine *machine, const char *module, const char *tag, UINT32 index, const char *name, bitmap_t *val, const char *file, int line)
{
state_save_register_memory(machine, module, tag, index, name, val->base, val->bpp / 8, val->rowpixels * val->height);
state_save_register_memory(machine, module, tag, index, name, val->base, val->bpp / 8, val->rowpixels * val->height, file, line);
}

View File

@ -67,7 +67,7 @@ typedef enum _state_save_error state_save_error;
#define state_save_register_generic(_mach, _mod, _tag, _index, _name, _val, _valsize, _count) \
do { \
assert_always(IS_VALID_SAVE_TYPE(_valsize), "Invalid data type supplied for state saving."); \
state_save_register_memory(_mach, _mod, _tag, _index, _name, _val, sizeof(_valsize), _count); \
state_save_register_memory(_mach, _mod, _tag, _index, _name, _val, sizeof(_valsize), _count, __FILE__, __LINE__); \
} while (0)
@ -85,7 +85,7 @@ do { \
state_save_register_item_pointer(_mach, _mod, _tag, _index, _val[0], sizeof(_val)/sizeof(_val[0][0]))
#define state_save_register_item_bitmap(_mach, _mod, _tag, _index, _val) \
state_save_register_bitmap(_mach, _mod, _tag, _index, #_val, _val)
state_save_register_bitmap(_mach, _mod, _tag, _index, #_val, _val, __FILE__, __LINE__)
@ -103,7 +103,7 @@ do { \
state_save_register_item_pointer((_dev)->machine, device_get_name(_dev), (_dev)->tag, _index, _val[0], sizeof(_val)/sizeof(_val[0][0]))
#define state_save_register_device_item_bitmap(_dev, _index, _val) \
state_save_register_bitmap((_dev)->machine, device_get_name(_dev), (_dev)->tag, _index, #_val, _val)
state_save_register_bitmap((_dev)->machine, device_get_name(_dev), (_dev)->tag, _index, #_val, _val, __FILE__, __LINE__)
@ -121,7 +121,7 @@ do { \
state_save_register_item_2d_array(_mach, "globals", NULL, 0, _val)
#define state_save_register_global_bitmap(_mach, _val) \
state_save_register_bitmap(_mach, "globals", NULL, 0, #_val, _val)
state_save_register_bitmap(_mach, "globals", NULL, 0, #_val, _val, __FILE__, __LINE__)
@ -149,10 +149,10 @@ void state_save_allow_registration(running_machine *machine, int allowed);
int state_save_registration_allowed(running_machine *machine);
/* register an array of data in memory */
void state_save_register_memory(running_machine *machine, const char *module, const char *tag, UINT32 index, const char *name, void *val, UINT32 valsize, UINT32 valcount);
void state_save_register_memory(running_machine *machine, const char *module, const char *tag, UINT32 index, const char *name, void *val, UINT32 valsize, UINT32 valcount, const char *file, int line);
/* register a bitmap to be saved */
void state_save_register_bitmap(running_machine *machine, const char *module, const char *tag, UINT32 index, const char *name, bitmap_t *val);
void state_save_register_bitmap(running_machine *machine, const char *module, const char *tag, UINT32 index, const char *name, bitmap_t *val, const char *file, int line);

View File

@ -255,7 +255,7 @@ VIDEO_START( generic_bitmapped )
machine->generic.tmpbitmap = video_screen_auto_bitmap_alloc(machine->primary_screen);
/* ensure the contents of the bitmap are saved */
state_save_register_bitmap(machine, "video", NULL, 0, "tmpbitmap", machine->generic.tmpbitmap);
state_save_register_global_bitmap(machine, machine->generic.tmpbitmap);
}

View File

@ -138,8 +138,8 @@ INLINE int hash_object(void *object)
/*-------------------------------------------------
hash_object - compute the hash for a given
object
get_object_type - return the type entry for
a given object type
-------------------------------------------------*/
INLINE objtype_entry *get_object_type(object_pool *pool, object_type type)

View File

@ -7,7 +7,6 @@ static int counter,vector_reg,imr_status;
static UINT16 es5510_dsp_ram[0x200];
static UINT32 es5510_gpr[0xc0];
static UINT32 es5510_gpr_latch;
static emu_timer *timer_68681=NULL;
static int timer_mode,m68681_imr;
//static int es_tmp=1;
@ -17,6 +16,8 @@ static int timer_mode,m68681_imr;
enum { TIMER_SINGLESHOT, TIMER_PULSE };
static READ16_HANDLER(f3_68000_share_r)
{
if ((offset&3)==0) return (f3_shared_ram[offset/4]&0xff000000)>>16;
@ -68,22 +69,17 @@ static WRITE16_HANDLER( f3_volume_w )
/* Channels 0, 1, 2, 3 - Unused */
}
static TIMER_CALLBACK( taito_en_timer_callback )
static TIMER_DEVICE_CALLBACK( taito_en_timer_callback )
{
/* Only cause IRQ if the mask is set to allow it */
if (m68681_imr & 0x08)
{
cpu_set_input_line_vector(cputag_get_cpu(machine, "audiocpu"), 6, vector_reg);
cputag_set_input_line(machine, "audiocpu", 6, ASSERT_LINE);
cpu_set_input_line_vector(cputag_get_cpu(timer->machine, "audiocpu"), 6, vector_reg);
cputag_set_input_line(timer->machine, "audiocpu", 6, ASSERT_LINE);
imr_status |= 0x08;
}
}
void f3_68681_reset(running_machine *machine)
{
timer_68681 = timer_alloc(machine, taito_en_timer_callback, NULL);
}
static READ16_HANDLER(f3_68681_r)
{
if (offset == 0x05)
@ -123,7 +119,7 @@ static WRITE16_HANDLER(f3_68681_w)
case 3:
logerror("Counter: X1/Clk - divided by 16, counter is %04x, so interrupt every %d cycles\n",counter,(M68000_CLOCK/M68681_CLOCK)*counter*16);
timer_mode=TIMER_SINGLESHOT;
timer_adjust_oneshot(timer_68681, cpu_clocks_to_attotime(space->cpu, (M68000_CLOCK/M68681_CLOCK)*counter*16), 0);
timer_device_adjust_oneshot(devtag_get_device(space->machine, "timer_68681"), cpu_clocks_to_attotime(space->cpu, (M68000_CLOCK/M68681_CLOCK)*counter*16), 0);
break;
case 4:
logerror("Timer: Unimplemented external IP2\n");
@ -134,7 +130,7 @@ static WRITE16_HANDLER(f3_68681_w)
case 6:
logerror("Timer: X1/Clk, counter is %04x, so interrupt every %d cycles\n",counter,(M68000_CLOCK/M68681_CLOCK)*counter);
timer_mode=TIMER_PULSE;
timer_adjust_periodic(timer_68681, cpu_clocks_to_attotime(space->cpu, (M68000_CLOCK/M68681_CLOCK)*counter), 0, cpu_clocks_to_attotime(space->cpu, (M68000_CLOCK/M68681_CLOCK)*counter));
timer_device_adjust_periodic(devtag_get_device(space->machine, "timer_68681"), cpu_clocks_to_attotime(space->cpu, (M68000_CLOCK/M68681_CLOCK)*counter), 0, cpu_clocks_to_attotime(space->cpu, (M68000_CLOCK/M68681_CLOCK)*counter));
break;
case 7:
logerror("Timer: Unimplemented X1/Clk - divided by 16\n");
@ -247,7 +243,7 @@ ADDRESS_MAP_START( f3_sound_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xff0000, 0xffffff) AM_RAM AM_SHARE("share1") // mirror
ADDRESS_MAP_END
void taito_f3_soundsystem_reset(running_machine *machine)
static SOUND_RESET( taito_f3_soundsystem_reset )
{
/* Sound cpu program loads to 0xc00000 so we use a bank */
UINT16 *ROM = (UINT16 *)memory_region(machine, "audiocpu");
@ -265,9 +261,24 @@ void taito_f3_soundsystem_reset(running_machine *machine)
//cputag_set_input_line(machine, "audiocpu", INPUT_LINE_RESET, ASSERT_LINE);
}
const es5505_interface es5505_taito_f3_config =
static const es5505_interface es5505_taito_f3_config =
{
"ensoniq.0", /* Bank 0: Unused by F3 games? */
"ensoniq.0", /* Bank 1: All games seem to use this */
NULL /* irq */
};
MACHINE_DRIVER_START( taito_f3_sound )
MDRV_TIMER_ADD("timer_68681", taito_en_timer_callback)
MDRV_SOUND_RESET( taito_f3_soundsystem_reset )
MDRV_CPU_ADD("audiocpu", M68000, 16000000)
MDRV_CPU_PROGRAM_MAP(f3_sound_map)
MDRV_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
MDRV_SOUND_ADD("ensoniq", ES5505, 30476100/2)
MDRV_SOUND_CONFIG(es5505_taito_f3_config)
MDRV_SOUND_ROUTE(0, "lspeaker", 1.0)
MDRV_SOUND_ROUTE(1, "rspeaker", 1.0)
MACHINE_DRIVER_END

View File

@ -1,22 +1,4 @@
#include "cpu/m68000/m68000.h"
#include "sound/es5506.h"
void f3_68681_reset(running_machine *machine);
void taito_f3_soundsystem_reset(running_machine *machine);
#define TAITO_F3_SOUND_SYSTEM_CPU(freq) \
MDRV_CPU_ADD("audiocpu", M68000, freq) \
MDRV_CPU_PROGRAM_MAP(f3_sound_map) \
#define TAITO_F3_SOUND_SYSTEM_ES5505(freq) \
MDRV_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") \
MDRV_SOUND_ADD("ensoniq", ES5505, freq) \
MDRV_SOUND_CONFIG(es5505_taito_f3_config) \
MDRV_SOUND_ROUTE(0, "lspeaker", 1.0) \
MDRV_SOUND_ROUTE(1, "rspeaker", 1.0) \
ADDRESS_MAP_EXTERN(f3_sound_map, 16);
extern const es5505_interface es5505_taito_f3_config;
MACHINE_DRIVER_EXTERN( taito_f3_sound );

View File

@ -300,8 +300,8 @@ ADDRESS_MAP_END
/* CPU 1 read addresses */
static ADDRESS_MAP_START( shrike68k_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x003fff) AM_ROM
AM_RANGE(0x010000, 0x01001f) AM_RAM AM_BASE(&shrike_io)
AM_RANGE(0x018000, 0x018fff) AM_RAM AM_BASE(&shrike_shared)
AM_RANGE(0x010000, 0x01001f) AM_RAM AM_BASE_MEMBER(balsente_state, shrike_io)
AM_RANGE(0x018000, 0x018fff) AM_RAM AM_BASE_MEMBER(balsente_state, shrike_shared)
ADDRESS_MAP_END
@ -1191,6 +1191,7 @@ static const cem3394_interface cem_interface =
*************************************/
static MACHINE_DRIVER_START( balsente )
MDRV_DRIVER_DATA(balsente_state)
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", M6809, 5000000/4)
@ -1203,9 +1204,15 @@ static MACHINE_DRIVER_START( balsente )
MDRV_QUANTUM_TIME(HZ(600))
MDRV_MACHINE_START(balsente)
MDRV_MACHINE_RESET(balsente)
MDRV_NVRAM_HANDLER(generic_0fill)
MDRV_TIMER_ADD("scan_timer", balsente_interrupt_timer)
MDRV_TIMER_ADD("8253_0_timer", balsente_clock_counter_0_ff)
MDRV_TIMER_ADD("8253_1_timer", balsente_counter_callback)
MDRV_TIMER_ADD("8253_2_timer", balsente_counter_callback)
/* video hardware */
MDRV_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK)
@ -2047,67 +2054,71 @@ static void expand_roms(running_machine *machine, UINT8 cd_rom_mask)
}
}
static DRIVER_INIT( sentetst ) { expand_roms(machine, EXPAND_ALL); balsente_shooter = 0; /* noanalog */ }
static DRIVER_INIT( cshift ) { expand_roms(machine, EXPAND_ALL); balsente_shooter = 0; /* noanalog */ }
static DRIVER_INIT( gghost ) { expand_roms(machine, EXPAND_ALL); balsente_shooter = 0; balsente_adc_shift = 1; }
static DRIVER_INIT( hattrick ) { expand_roms(machine, EXPAND_ALL); balsente_shooter = 0; /* noanalog */ }
static DRIVER_INIT( otwalls ) { expand_roms(machine, EXPAND_ALL); balsente_shooter = 0; balsente_adc_shift = 0; }
static DRIVER_INIT( snakepit ) { expand_roms(machine, EXPAND_ALL); balsente_shooter = 0; balsente_adc_shift = 1; }
static DRIVER_INIT( snakjack ) { expand_roms(machine, EXPAND_ALL); balsente_shooter = 0; balsente_adc_shift = 1; }
static DRIVER_INIT( stocker ) { expand_roms(machine, EXPAND_ALL); balsente_shooter = 0; balsente_adc_shift = 0; }
static DRIVER_INIT( triviag1 ) { expand_roms(machine, EXPAND_ALL); balsente_shooter = 0; /* noanalog */ }
INLINE void config_shooter_adc(running_machine *machine, UINT8 shooter, UINT8 adc_shift)
{
balsente_state *state = (balsente_state *)machine->driver_data;
state->shooter = shooter;
state->adc_shift = adc_shift;
}
static DRIVER_INIT( sentetst ) { expand_roms(machine, EXPAND_ALL); config_shooter_adc(machine, FALSE, 0 /* noanalog */); }
static DRIVER_INIT( cshift ) { expand_roms(machine, EXPAND_ALL); config_shooter_adc(machine, FALSE, 0 /* noanalog */); }
static DRIVER_INIT( gghost ) { expand_roms(machine, EXPAND_ALL); config_shooter_adc(machine, FALSE, 1); }
static DRIVER_INIT( hattrick ) { expand_roms(machine, EXPAND_ALL); config_shooter_adc(machine, FALSE, 0 /* noanalog */); }
static DRIVER_INIT( otwalls ) { expand_roms(machine, EXPAND_ALL); config_shooter_adc(machine, FALSE, 0); }
static DRIVER_INIT( snakepit ) { expand_roms(machine, EXPAND_ALL); config_shooter_adc(machine, FALSE, 1); }
static DRIVER_INIT( snakjack ) { expand_roms(machine, EXPAND_ALL); config_shooter_adc(machine, FALSE, 1); }
static DRIVER_INIT( stocker ) { expand_roms(machine, EXPAND_ALL); config_shooter_adc(machine, FALSE, 0); }
static DRIVER_INIT( triviag1 ) { expand_roms(machine, EXPAND_ALL); config_shooter_adc(machine, FALSE, 0 /* noanalog */); }
static DRIVER_INIT( triviag2 )
{
UINT8 *rom = memory_region(machine, "maincpu");
memcpy(&rom[0x20000], &rom[0x28000], 0x4000);
memcpy(&rom[0x24000], &rom[0x28000], 0x4000);
expand_roms(machine, EXPAND_NONE); balsente_shooter = 0; /* noanalog */
expand_roms(machine, EXPAND_NONE); config_shooter_adc(machine, FALSE, 0 /* noanalog */);
}
static DRIVER_INIT( triviaes )
{
expand_roms(machine, EXPAND_NONE | SWAP_HALVES); balsente_shooter = 0; /* noanalog */
}
static DRIVER_INIT( gimeabrk ) { expand_roms(machine, EXPAND_ALL); balsente_shooter = 0; balsente_adc_shift = 1; }
static DRIVER_INIT( minigolf ) { expand_roms(machine, EXPAND_NONE); balsente_shooter = 0; balsente_adc_shift = 2; }
static DRIVER_INIT( minigol2 ) { expand_roms(machine, 0x0c); balsente_shooter = 0; balsente_adc_shift = 2; }
static DRIVER_INIT( toggle ) { expand_roms(machine, EXPAND_ALL); balsente_shooter = 0; /* noanalog */ }
static DRIVER_INIT( triviaes ) { expand_roms(machine, EXPAND_NONE | SWAP_HALVES); config_shooter_adc(machine, FALSE, 0 /* noanalog */); }
static DRIVER_INIT( gimeabrk ) { expand_roms(machine, EXPAND_ALL); config_shooter_adc(machine, FALSE, 1); }
static DRIVER_INIT( minigolf ) { expand_roms(machine, EXPAND_NONE); config_shooter_adc(machine, FALSE, 2); }
static DRIVER_INIT( minigol2 ) { expand_roms(machine, 0x0c); config_shooter_adc(machine, FALSE, 2); }
static DRIVER_INIT( toggle ) { expand_roms(machine, EXPAND_ALL); config_shooter_adc(machine, FALSE, 0 /* noanalog */); }
static DRIVER_INIT( nametune )
{
const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
memory_install_write8_handler(space, 0x9f00, 0x9f00, 0, 0, balsente_rombank2_select_w);
expand_roms(machine, EXPAND_NONE | SWAP_HALVES); balsente_shooter = 0; /* noanalog */
expand_roms(machine, EXPAND_NONE | SWAP_HALVES); config_shooter_adc(machine, FALSE, 0 /* noanalog */);
}
static DRIVER_INIT( nstocker )
{
const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
memory_install_write8_handler(space, 0x9f00, 0x9f00, 0, 0, balsente_rombank2_select_w);
expand_roms(machine, EXPAND_NONE | SWAP_HALVES); balsente_shooter = 1; balsente_adc_shift = 1;
expand_roms(machine, EXPAND_NONE | SWAP_HALVES); config_shooter_adc(machine, TRUE, 1);
}
static DRIVER_INIT( sfootbal )
{
const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
memory_install_write8_handler(space, 0x9f00, 0x9f00, 0, 0, balsente_rombank2_select_w);
expand_roms(machine, EXPAND_ALL | SWAP_HALVES); balsente_shooter = 0; balsente_adc_shift = 0;
expand_roms(machine, EXPAND_ALL | SWAP_HALVES); config_shooter_adc(machine, FALSE, 0);
}
static DRIVER_INIT( spiker )
{
const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
memory_install_readwrite8_handler(space, 0x9f80, 0x9f8f, 0, 0, spiker_expand_r, spiker_expand_w);
memory_install_write8_handler(space, 0x9f00, 0x9f00, 0, 0, balsente_rombank2_select_w);
expand_roms(machine, EXPAND_ALL | SWAP_HALVES); balsente_shooter = 0; balsente_adc_shift = 1;
expand_roms(machine, EXPAND_ALL | SWAP_HALVES); config_shooter_adc(machine, FALSE, 1);
}
static DRIVER_INIT( stompin )
{
const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
memory_install_write8_handler(space, 0x9f00, 0x9f00, 0, 0, balsente_rombank2_select_w);
expand_roms(machine, 0x0c | SWAP_HALVES); balsente_shooter = 0; balsente_adc_shift = 32;
expand_roms(machine, 0x0c | SWAP_HALVES); config_shooter_adc(machine, FALSE, 32);
}
static DRIVER_INIT( rescraid ) { expand_roms(machine, EXPAND_NONE); balsente_shooter = 0; /* noanalog */ }
static DRIVER_INIT( rescraid ) { expand_roms(machine, EXPAND_NONE); config_shooter_adc(machine, FALSE, 0 /* noanalog */); }
static DRIVER_INIT( grudge )
{
const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
memory_install_read8_handler(space, 0x9400, 0x9400, 0, 0, grudge_steering_r);
expand_roms(machine, EXPAND_NONE); balsente_shooter = 0;
expand_roms(machine, EXPAND_NONE); config_shooter_adc(machine, FALSE, 0);
}
static DRIVER_INIT( shrike )
{
@ -2116,7 +2127,7 @@ static DRIVER_INIT( shrike )
memory_install_write8_handler(space, 0x9e01, 0x9e01, 0, 0, shrike_sprite_select_w );
memory_install_readwrite16_handler(cputag_get_address_space(machine, "68k", ADDRESS_SPACE_PROGRAM), 0x10000, 0x1001f, 0, 0, shrike_io_68k_r, shrike_io_68k_w);
expand_roms(machine, EXPAND_ALL); balsente_shooter = 0; balsente_adc_shift = 32;
expand_roms(machine, EXPAND_ALL); config_shooter_adc(machine, FALSE, 32);
}

View File

@ -1191,6 +1191,8 @@ static MACHINE_START( cps2 )
state->audiocpu = devtag_get_device(machine, "audiocpu");
state_save_register_global(machine, state->scancount);
memory_configure_bank(machine, "bank1", 0, (QSOUND_SIZE - 0x10000) / 0x4000, memory_region(machine, "audiocpu") + 0x10000, 0x4000);
}

View File

@ -283,13 +283,6 @@ GFXDECODE_END
MACHINE DRIVERS
***********************************************************/
static MACHINE_RESET( galastrm )
{
taito_f3_soundsystem_reset(machine);
f3_68681_reset(machine);
}
static const UINT8 default_eeprom[128]={
0x45,0x58,0x00,0x00,0xff,0xff,0x00,0x00,0x00,0x28,0x00,0x01,0x00,0x00,0x00,0xfa,
0x00,0xec,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
@ -333,9 +326,6 @@ static MACHINE_DRIVER_START( galastrm )
MDRV_CPU_PROGRAM_MAP(galastrm_map)
MDRV_CPU_VBLANK_INT("screen", galastrm_interrupt) /* VBL */
TAITO_F3_SOUND_SYSTEM_CPU(16000000)
MDRV_MACHINE_RESET(galastrm)
MDRV_NVRAM_HANDLER(galastrm)
/* video hardware */
@ -353,7 +343,7 @@ static MACHINE_DRIVER_START( galastrm )
MDRV_VIDEO_UPDATE(galastrm)
/* sound hardware */
TAITO_F3_SOUND_SYSTEM_ES5505(30476100/2)
MDRV_IMPORT_FROM(taito_f3_sound)
MACHINE_DRIVER_END
/***************************************************************************/

View File

@ -353,12 +353,6 @@ GFXDECODE_END
MACHINE DRIVERS
***********************************************************/
static MACHINE_RESET( groundfx )
{
taito_f3_soundsystem_reset(machine);
f3_68681_reset(machine);
}
static INTERRUPT_GEN( groundfx_interrupt )
{
frame_counter^=1;
@ -372,9 +366,6 @@ static MACHINE_DRIVER_START( groundfx )
MDRV_CPU_PROGRAM_MAP(groundfx_map)
MDRV_CPU_VBLANK_INT("screen", groundfx_interrupt)
TAITO_F3_SOUND_SYSTEM_CPU(16000000)
MDRV_MACHINE_RESET(groundfx)
// MDRV_NVRAM_HANDLER(groundfx)
MDRV_EEPROM_ADD("eeprom", groundfx_eeprom_interface, 128, default_eeprom)
@ -393,7 +384,7 @@ static MACHINE_DRIVER_START( groundfx )
MDRV_VIDEO_UPDATE(groundfx)
/* sound hardware */
TAITO_F3_SOUND_SYSTEM_ES5505(30476100/2)
MDRV_IMPORT_FROM(taito_f3_sound)
MACHINE_DRIVER_END
/***************************************************************************

View File

@ -302,14 +302,6 @@ GFXDECODE_END
MACHINE DRIVERS
***********************************************************/
static MACHINE_RESET( gunbustr )
{
taito_f3_soundsystem_reset(machine);
f3_68681_reset(machine);
}
static const UINT8 default_eeprom[128]={
0x00,0x01,0x00,0x85,0x00,0xfd,0x00,0xff,0x00,0x67,0x00,0x02,0x00,0x00,0x00,0x7b,
0x00,0xff,0x00,0xff,0x00,0x78,0x00,0x03,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
@ -352,9 +344,6 @@ static MACHINE_DRIVER_START( gunbustr )
MDRV_CPU_PROGRAM_MAP(gunbustr_map)
MDRV_CPU_VBLANK_INT("screen", gunbustr_interrupt) /* VBL */
TAITO_F3_SOUND_SYSTEM_CPU(16000000)
MDRV_MACHINE_RESET(gunbustr)
MDRV_NVRAM_HANDLER(gunbustr)
/* video hardware */
@ -372,7 +361,7 @@ static MACHINE_DRIVER_START( gunbustr )
MDRV_VIDEO_UPDATE(gunbustr)
/* sound hardware */
TAITO_F3_SOUND_SYSTEM_ES5505(30476100/2)
MDRV_IMPORT_FROM(taito_f3_sound)
MACHINE_DRIVER_END
/***************************************************************************/

View File

@ -1022,6 +1022,8 @@ static MACHINE_DRIVER_START( driver_nomsp )
MDRV_MACHINE_RESET(harddriv)
MDRV_NVRAM_HANDLER(atarigen)
MDRV_TIMER_ADD("duart_timer", hd68k_duart_callback)
/* video hardware */
MDRV_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK)
MDRV_PALETTE_LENGTH(1024)

View File

@ -348,13 +348,6 @@ GFXDECODE_END
MACHINE DRIVERS
***********************************************************/
static MACHINE_RESET( superchs )
{
taito_f3_soundsystem_reset(machine);
f3_68681_reset(machine);
}
static const eeprom_interface superchs_eeprom_interface =
{
6, /* address bits */
@ -399,15 +392,12 @@ static MACHINE_DRIVER_START( superchs )
MDRV_CPU_PROGRAM_MAP(superchs_map)
MDRV_CPU_VBLANK_INT("screen", irq2_line_hold)/* VBL */
TAITO_F3_SOUND_SYSTEM_CPU(16000000)
MDRV_CPU_ADD("sub", M68000, 16000000) /* 16 MHz */
MDRV_CPU_PROGRAM_MAP(superchs_cpub_map)
MDRV_CPU_VBLANK_INT("screen", irq4_line_hold)/* VBL */
MDRV_QUANTUM_TIME(HZ(480)) /* CPU slices - Need to interleave Cpu's 1 & 3 */
MDRV_MACHINE_RESET(superchs)
MDRV_NVRAM_HANDLER(superchs)
/* video hardware */
@ -425,7 +415,7 @@ static MACHINE_DRIVER_START( superchs )
MDRV_VIDEO_UPDATE(superchs)
/* sound hardware */
TAITO_F3_SOUND_SYSTEM_ES5505(30476100/2)
MDRV_IMPORT_FROM(taito_f3_sound)
MACHINE_DRIVER_END
/***************************************************************************/

View File

@ -369,10 +369,7 @@ static INTERRUPT_GEN( f3_interrupt2 )
static MACHINE_RESET( f3 )
{
taito_f3_soundsystem_reset(machine);
cputag_set_input_line(machine, "audiocpu", INPUT_LINE_RESET, ASSERT_LINE);
f3_68681_reset(machine);
}
@ -399,8 +396,6 @@ static MACHINE_DRIVER_START( f3 )
MDRV_CPU_PROGRAM_MAP(f3_map)
MDRV_CPU_VBLANK_INT("screen", f3_interrupt2)
TAITO_F3_SOUND_SYSTEM_CPU(16000000)
MDRV_MACHINE_START(f3)
MDRV_MACHINE_RESET(f3)
@ -422,7 +417,7 @@ static MACHINE_DRIVER_START( f3 )
MDRV_VIDEO_UPDATE(f3)
/* sound hardware */
TAITO_F3_SOUND_SYSTEM_ES5505(30476100/2)
MDRV_IMPORT_FROM(taito_f3_sound)
MACHINE_DRIVER_END
/* These games reprogram the video output registers to display different scanlines,

View File

@ -136,13 +136,16 @@ logerror("%s:Large palette ? %03x\n", cpuexec_describe_context(machine), addr);
}
}
static void machine_init(running_machine *machine)
static MACHINE_START( taito_l )
{
int i;
taitol_rambanks = auto_alloc_array(machine, UINT8, 0x1000*12);
palette_ram = auto_alloc_array(machine, UINT8, 0x1000);
empty_ram = auto_alloc_array(machine, UINT8, 0x1000);
}
static void machine_reset(running_machine *machine)
{
int i;
for(i=0;i<3;i++)
irq_adr_table[i] = 0;
@ -178,7 +181,7 @@ static void machine_init(running_machine *machine)
static MACHINE_RESET( fhawk )
{
machine_init(machine);
machine_reset(machine);
porte0_tag = NULL;
porte1_tag = NULL;
portf0_tag = NULL;
@ -187,7 +190,7 @@ static MACHINE_RESET( fhawk )
static MACHINE_RESET( raimais )
{
machine_init(machine);
machine_reset(machine);
porte0_tag = NULL;
porte1_tag = NULL;
portf0_tag = NULL;
@ -196,7 +199,7 @@ static MACHINE_RESET( raimais )
static MACHINE_RESET( champwr )
{
machine_init(machine);
machine_reset(machine);
porte0_tag = NULL;
porte1_tag = NULL;
portf0_tag = NULL;
@ -206,7 +209,7 @@ static MACHINE_RESET( champwr )
static MACHINE_RESET( kurikint )
{
machine_init(machine);
machine_reset(machine);
porte0_tag = NULL;
porte1_tag = NULL;
portf0_tag = NULL;
@ -215,7 +218,7 @@ static MACHINE_RESET( kurikint )
static MACHINE_RESET( evilston )
{
machine_init(machine);
machine_reset(machine);
porte0_tag = NULL;
porte1_tag = NULL;
portf0_tag = NULL;
@ -224,7 +227,7 @@ static MACHINE_RESET( evilston )
static MACHINE_RESET( puzznic )
{
machine_init(machine);
machine_reset(machine);
porte0_tag = "DSWA";
porte1_tag = "DSWB";
portf0_tag = "IN0";
@ -233,7 +236,7 @@ static MACHINE_RESET( puzznic )
static MACHINE_RESET( plotting )
{
machine_init(machine);
machine_reset(machine);
porte0_tag = "DSWA";
porte1_tag = "DSWB";
portf0_tag = "IN0";
@ -242,7 +245,7 @@ static MACHINE_RESET( plotting )
static MACHINE_RESET( palamed )
{
machine_init(machine);
machine_reset(machine);
porte0_tag = "DSWA";
porte1_tag = NULL;
portf0_tag = "DSWB";
@ -251,7 +254,7 @@ static MACHINE_RESET( palamed )
static MACHINE_RESET( cachat )
{
machine_init(machine);
machine_reset(machine);
porte0_tag = "DSWA";
porte1_tag = NULL;
portf0_tag = "DSWB";
@ -260,7 +263,7 @@ static MACHINE_RESET( cachat )
static MACHINE_RESET( horshoes )
{
machine_init(machine);
machine_reset(machine);
porte0_tag = "DSWA";
porte1_tag = "DSWB";
portf0_tag = "IN0";
@ -1965,6 +1968,7 @@ static MACHINE_DRIVER_START( fhawk )
MDRV_QUANTUM_TIME(HZ(6000))
MDRV_MACHINE_START(taito_l)
MDRV_MACHINE_RESET(fhawk)
/* video hardware */
@ -2061,6 +2065,7 @@ static MACHINE_DRIVER_START( kurikint )
MDRV_QUANTUM_TIME(HZ(6000))
MDRV_MACHINE_START(taito_l)
MDRV_MACHINE_RESET(kurikint)
/* video hardware */
@ -2106,6 +2111,7 @@ static MACHINE_DRIVER_START( plotting )
MDRV_CPU_PROGRAM_MAP(plotting_map)
MDRV_CPU_VBLANK_INT_HACK(vbl_interrupt,3)
MDRV_MACHINE_START(taito_l)
MDRV_MACHINE_RESET(plotting)
/* video hardware */
@ -2201,6 +2207,7 @@ static MACHINE_DRIVER_START( evilston )
MDRV_QUANTUM_TIME(HZ(6000))
MDRV_MACHINE_START(taito_l)
MDRV_MACHINE_RESET(evilston)
/* video hardware */

View File

@ -1298,10 +1298,6 @@ static MACHINE_RESET( taitojc )
memset(projection_data, 0, sizeof(projection_data));
memset(intersection_data, 0, sizeof(intersection_data));
taito_f3_soundsystem_reset(machine);
f3_68681_reset(machine);
// hold the TMS in reset until we have code
cputag_set_input_line(machine, "dsp", INPUT_LINE_RESET, ASSERT_LINE);
}
@ -1329,8 +1325,6 @@ static MACHINE_DRIVER_START( taitojc )
MDRV_CPU_VBLANK_INT("screen", taitojc_vblank)
MDRV_CPU_PERIODIC_INT(taitojc_int6, 1000)
TAITO_F3_SOUND_SYSTEM_CPU(16000000)
MDRV_CPU_ADD("sub", MC68HC11, 4000000) //MC68HC11M0
MDRV_CPU_PROGRAM_MAP(hc11_pgm_map)
MDRV_CPU_IO_MAP(hc11_io_map)
@ -1358,7 +1352,7 @@ static MACHINE_DRIVER_START( taitojc )
MDRV_VIDEO_UPDATE(taitojc)
/* sound hardware */
TAITO_F3_SOUND_SYSTEM_ES5505(30476100/2)
MDRV_IMPORT_FROM(taito_f3_sound)
MACHINE_DRIVER_END
static DRIVER_INIT( taitojc )

View File

@ -717,14 +717,6 @@ GFXDECODE_END
MACHINE DRIVERS
***********************************************************/
static MACHINE_RESET( undrfire )
{
taito_f3_soundsystem_reset(machine);
f3_68681_reset(machine);
}
static INTERRUPT_GEN( undrfire_interrupt )
{
frame_counter^=1;
@ -738,9 +730,6 @@ static MACHINE_DRIVER_START( undrfire )
MDRV_CPU_PROGRAM_MAP(undrfire_map)
MDRV_CPU_VBLANK_INT("screen", undrfire_interrupt)
TAITO_F3_SOUND_SYSTEM_CPU(16000000)
MDRV_MACHINE_RESET(undrfire)
MDRV_NVRAM_HANDLER(undrfire)
/* video hardware */
@ -758,7 +747,7 @@ static MACHINE_DRIVER_START( undrfire )
MDRV_VIDEO_UPDATE(undrfire)
/* sound hardware */
TAITO_F3_SOUND_SYSTEM_ES5505(30476100/2)
MDRV_IMPORT_FROM(taito_f3_sound)
MACHINE_DRIVER_END
@ -769,15 +758,12 @@ static MACHINE_DRIVER_START( cbombers )
MDRV_CPU_PROGRAM_MAP(cbombers_cpua_map)
MDRV_CPU_VBLANK_INT("screen", irq4_line_hold)
TAITO_F3_SOUND_SYSTEM_CPU(16000000)
MDRV_CPU_ADD("sub", M68000, 16000000) /* 16 MHz */
MDRV_CPU_PROGRAM_MAP(cbombers_cpub_map)
MDRV_CPU_VBLANK_INT("screen", irq4_line_hold)
MDRV_QUANTUM_TIME(HZ(480)) /* CPU slices - Need to interleave Cpu's 1 & 3 */
MDRV_MACHINE_RESET(undrfire)
MDRV_NVRAM_HANDLER(undrfire)
/* video hardware */
@ -796,7 +782,7 @@ static MACHINE_DRIVER_START( cbombers )
MDRV_VIDEO_UPDATE(cbombers)
/* sound hardware */
TAITO_F3_SOUND_SYSTEM_ES5505(30476100/2)
MDRV_IMPORT_FROM(taito_f3_sound)
MACHINE_DRIVER_END

View File

@ -18,13 +18,99 @@
#define BALSENTE_VBSTART (0x100)
#define POLY17_BITS 17
#define POLY17_SIZE ((1 << POLY17_BITS) - 1)
#define POLY17_SHL 7
#define POLY17_SHR 10
#define POLY17_ADD 0x18000
typedef struct _balsente_state balsente_state;
struct _balsente_state
{
/* global data */
UINT8 shooter;
UINT8 shooter_x;
UINT8 shooter_y;
UINT8 adc_shift;
UINT16 *shrike_shared;
UINT16 *shrike_io;
/* 8253 counter state */
struct
{
const device_config *timer;
UINT8 timer_active;
INT32 initial;
INT32 count;
UINT8 gate;
UINT8 out;
UINT8 mode;
UINT8 readbyte;
UINT8 writebyte;
} counter[3];
const device_config *scanline_timer;
/* manually clocked counter 0 states */
UINT8 counter_control;
UINT8 counter_0_ff;
const device_config *counter_0_timer;
UINT8 counter_0_timer_active;
/* random number generator states */
UINT8 poly17[POLY17_SIZE + 1];
UINT8 rand17[POLY17_SIZE + 1];
/* ADC I/O states */
INT8 analog_input_data[4];
UINT8 adc_value;
/* CEM3394 DAC control states */
UINT16 dac_value;
UINT8 dac_register;
UINT8 chip_select;
/* main CPU 6850 states */
UINT8 m6850_status;
UINT8 m6850_control;
UINT8 m6850_input;
UINT8 m6850_output;
UINT8 m6850_data_ready;
/* sound CPU 6850 states */
UINT8 m6850_sound_status;
UINT8 m6850_sound_control;
UINT8 m6850_sound_input;
UINT8 m6850_sound_output;
/* noise generator states */
UINT32 noise_position[6];
const device_config *cem_device[6];
/* game-specific states */
UINT8 nstocker_bits;
UINT8 spiker_expand_color;
UINT8 spiker_expand_bgcolor;
UINT8 spiker_expand_bits;
UINT8 grudge_steering_result;
UINT8 grudge_last_steering[3];
/* video data */
UINT8 videoram[256 * 256];
UINT8 *sprite_data;
UINT32 sprite_mask;
UINT8 *sprite_bank[2];
UINT8 palettebank_vis;
};
/*----------- defined in machine/balsente.c -----------*/
extern UINT8 balsente_shooter;
extern UINT8 balsente_adc_shift;
extern UINT16 *shrike_shared;
extern UINT16 *shrike_io;
TIMER_DEVICE_CALLBACK( balsente_interrupt_timer );
MACHINE_START( balsente );
MACHINE_RESET( balsente );
void balsente_noise_gen(const device_config *device, int count, short *buffer);
@ -47,9 +133,13 @@ INTERRUPT_GEN( balsente_update_analog_inputs );
READ8_HANDLER( balsente_adc_data_r );
WRITE8_HANDLER( balsente_adc_select_w );
TIMER_DEVICE_CALLBACK( balsente_counter_callback );
READ8_HANDLER( balsente_counter_8253_r );
WRITE8_HANDLER( balsente_counter_8253_w );
TIMER_DEVICE_CALLBACK( balsente_clock_counter_0_ff );
READ8_HANDLER( balsente_counter_state_r );
WRITE8_HANDLER( balsente_counter_control_w );
@ -68,6 +158,7 @@ WRITE8_HANDLER( shrike_shared_6809_w );
READ16_HANDLER( shrike_io_68k_r );
WRITE16_HANDLER( shrike_io_68k_w );
/*----------- defined in video/balsente.c -----------*/
VIDEO_START( balsente );

View File

@ -77,7 +77,7 @@ struct _harddriv_state
UINT8 duart_read_data[16];
UINT8 duart_write_data[16];
UINT8 duart_output_port;
emu_timer * duart_timer;
const device_config * duart_timer;
UINT8 last_gsp_shiftreg;
@ -193,6 +193,7 @@ WRITE16_HANDLER( hdc68k_wheel_edge_reset_w );
READ16_HANDLER( hd68k_zram_r );
WRITE16_HANDLER( hd68k_zram_w );
TIMER_DEVICE_CALLBACK( hd68k_duart_callback );
READ16_HANDLER( hd68k_duart_r );
WRITE16_HANDLER( hd68k_duart_w );

File diff suppressed because it is too large Load Diff

View File

@ -38,7 +38,6 @@
static void hd68k_update_interrupts(running_machine *machine);
static TIMER_CALLBACK( duart_callback );
@ -61,6 +60,9 @@ MACHINE_START( harddriv )
state->sim_memory = (UINT16 *)memory_region(machine, "user1");
state->sim_memory_size = memory_region_length(machine, "user1") / 2;
state->adsp_pgm_memory_word = (UINT16 *)((UINT8 *)state->adsp_pgm_memory + 1);
/* allocate timers */
state->duart_timer = devtag_get_device(machine, "duart_timer");
}
@ -93,7 +95,6 @@ MACHINE_RESET( harddriv )
memset(state->duart_read_data, 0, sizeof(state->duart_read_data));
memset(state->duart_write_data, 0, sizeof(state->duart_write_data));
state->duart_output_port = 0;
state->duart_timer = timer_alloc(machine, duart_callback, NULL);
/* reset the ADSP/DSIII/DSIV boards */
state->adsp_halt = 1;
@ -523,18 +524,18 @@ INLINE attotime duart_clock_period(harddriv_state *state)
}
static TIMER_CALLBACK( duart_callback )
TIMER_DEVICE_CALLBACK( hd68k_duart_callback )
{
harddriv_state *state = (harddriv_state *)machine->driver_data;
harddriv_state *state = (harddriv_state *)timer->machine->driver_data;
logerror("DUART timer fired\n");
if (state->duart_write_data[0x05] & 0x08)
{
logerror("DUART interrupt generated\n");
state->duart_read_data[0x05] |= 0x08;
state->duart_irq_state = (state->duart_read_data[0x05] & state->duart_write_data[0x05]) != 0;
atarigen_update_interrupts(machine);
atarigen_update_interrupts(timer->machine);
}
timer_adjust_oneshot(state->duart_timer, attotime_mul(duart_clock_period(state), 65536), 0);
timer_device_adjust_oneshot(timer, attotime_mul(duart_clock_period(state), 65536), 0);
}
@ -562,14 +563,14 @@ READ16_HANDLER( hd68k_duart_r )
case 0x0e: /* Start-Counter Command 3 */
{
int reps = (state->duart_write_data[0x06] << 8) | state->duart_write_data[0x07];
timer_adjust_oneshot(state->duart_timer, attotime_mul(duart_clock_period(state), reps), 0);
timer_device_adjust_oneshot(state->duart_timer, attotime_mul(duart_clock_period(state), reps), 0);
logerror("DUART timer started (period=%f)\n", attotime_to_double(attotime_mul(duart_clock_period(state), reps)));
return 0x00ff;
}
case 0x0f: /* Stop-Counter Command 3 */
{
int reps = attotime_to_double(attotime_mul(timer_timeleft(state->duart_timer), duart_clock(state)));
timer_adjust_oneshot(state->duart_timer, attotime_never, 0);
int reps = attotime_to_double(attotime_mul(timer_device_timeleft(state->duart_timer), duart_clock(state)));
timer_device_adjust_oneshot(state->duart_timer, attotime_never, 0);
state->duart_read_data[0x06] = reps >> 8;
state->duart_read_data[0x07] = reps & 0xff;
logerror("DUART timer stopped (final count=%04X)\n", reps);

View File

@ -295,9 +295,9 @@ static void init_savestate(running_machine *machine, int index, atarimo_data *mo
state_save_register_item(machine, "atarimo", NULL, index, mo->dirtyheight);
#endif
state_save_register_bitmap(machine, "atarimo", NULL, index, "bitmap", mo->bitmap);
state_save_register_bitmap(machine, "atarimo", NULL, index, "bitmap", mo->bitmap, __FILE__, __LINE__);
state_save_register_memory(machine, "atarimo", NULL, index, "spriteram", mo->spriteram, sizeof(atarimo_entry), mo->spriteramsize);
state_save_register_memory(machine, "atarimo", NULL, index, "spriteram", mo->spriteram, sizeof(atarimo_entry), mo->spriteramsize, __FILE__, __LINE__);
state_save_register_item_pointer(machine, "atarimo", NULL, index, mo->codelookup, round_to_powerof2(mo->codemask.mask));

View File

@ -10,21 +10,6 @@
#include "balsente.h"
/*************************************
*
* Statics
*
*************************************/
static UINT8 *local_videoram;
static UINT8 *sprite_data;
static UINT32 sprite_mask;
static UINT8 *sprite_bank[2];
static UINT8 palettebank_vis;
/*************************************
*
* Video system start
@ -33,21 +18,20 @@ static UINT8 palettebank_vis;
VIDEO_START( balsente )
{
/* reset the system */
palettebank_vis = 0;
sprite_bank[0] = memory_region(machine, "gfx1");
sprite_bank[1] = memory_region(machine, "gfx1") + 0x10000;
balsente_state *state = (balsente_state *)machine->driver_data;
/* allocate a local copy of video RAM */
local_videoram = auto_alloc_array(machine, UINT8, 256 * 256);
/* reset the system */
state->palettebank_vis = 0;
state->sprite_bank[0] = memory_region(machine, "gfx1");
state->sprite_bank[1] = memory_region(machine, "gfx1") + 0x10000;
/* determine sprite size */
sprite_data = memory_region(machine, "gfx1");
sprite_mask = memory_region_length(machine, "gfx1") - 1;
state->sprite_data = memory_region(machine, "gfx1");
state->sprite_mask = memory_region_length(machine, "gfx1") - 1;
/* register for saving */
state_save_register_global_pointer(machine, local_videoram, 256 * 256);
state_save_register_global(machine, palettebank_vis);
state_save_register_global_array(machine, state->videoram);
state_save_register_global(machine, state->palettebank_vis);
}
@ -60,11 +44,13 @@ VIDEO_START( balsente )
WRITE8_HANDLER( balsente_videoram_w )
{
balsente_state *state = (balsente_state *)space->machine->driver_data;
space->machine->generic.videoram.u8[offset] = data;
/* expand the two pixel values into two bytes */
local_videoram[offset * 2 + 0] = data >> 4;
local_videoram[offset * 2 + 1] = data & 15;
state->videoram[offset * 2 + 0] = data >> 4;
state->videoram[offset * 2 + 1] = data & 15;
}
@ -77,12 +63,14 @@ WRITE8_HANDLER( balsente_videoram_w )
WRITE8_HANDLER( balsente_palette_select_w )
{
balsente_state *state = (balsente_state *)space->machine->driver_data;
/* only update if changed */
if (palettebank_vis != (data & 3))
if (state->palettebank_vis != (data & 3))
{
/* update the scanline palette */
video_screen_update_partial(space->machine->primary_screen, video_screen_get_vpos(space->machine->primary_screen) - 1 + BALSENTE_VBEND);
palettebank_vis = data & 3;
state->palettebank_vis = data & 3;
}
logerror("balsente_palette_select_w(%d) scanline=%d\n", data & 3, video_screen_get_vpos(space->machine->primary_screen));
@ -119,11 +107,12 @@ WRITE8_HANDLER( balsente_paletteram_w )
WRITE8_HANDLER( shrike_sprite_select_w )
{
if( sprite_data != sprite_bank[(data & 0x80 >> 7) ^ 1 ])
balsente_state *state = (balsente_state *)space->machine->driver_data;
if( state->sprite_data != state->sprite_bank[(data & 0x80 >> 7) ^ 1 ])
{
logerror( "shrike_sprite_select_w( 0x%02x )\n", data );
video_screen_update_partial(space->machine->primary_screen, video_screen_get_vpos(space->machine->primary_screen) - 1 + BALSENTE_VBEND);
sprite_data = sprite_bank[(data & 0x80 >> 7) ^ 1];
state->sprite_data = state->sprite_bank[(data & 0x80 >> 7) ^ 1];
}
shrike_shared_6809_w( space, 1, data );
@ -139,6 +128,7 @@ WRITE8_HANDLER( shrike_sprite_select_w )
static void draw_one_sprite(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8 *sprite)
{
balsente_state *state = (balsente_state *)machine->driver_data;
int flags = sprite[0];
int image = sprite[1] | ((flags & 7) << 8);
int ypos = sprite[2] + 17 + BALSENTE_VBEND;
@ -147,7 +137,7 @@ static void draw_one_sprite(running_machine *machine, bitmap_t *bitmap, const re
int x, y;
/* get a pointer to the source image */
src = &sprite_data[(64 * image) & sprite_mask];
src = &state->sprite_data[(64 * image) & state->sprite_mask];
if (flags & 0x80) src += 4 * 15;
/* loop over y */
@ -155,8 +145,8 @@ static void draw_one_sprite(running_machine *machine, bitmap_t *bitmap, const re
{
if (ypos >= (16 + BALSENTE_VBEND) && ypos >= cliprect->min_y && ypos <= cliprect->max_y)
{
const pen_t *pens = &machine->pens[palettebank_vis * 256];
UINT8 *old = &local_videoram[(ypos - BALSENTE_VBEND) * 256 + xpos];
const pen_t *pens = &machine->pens[state->palettebank_vis * 256];
UINT8 *old = &state->videoram[(ypos - BALSENTE_VBEND) * 256 + xpos];
int currx = xpos;
/* standard case */
@ -222,12 +212,13 @@ static void draw_one_sprite(running_machine *machine, bitmap_t *bitmap, const re
VIDEO_UPDATE( balsente )
{
const pen_t *pens = &screen->machine->pens[palettebank_vis * 256];
balsente_state *state = (balsente_state *)screen->machine->driver_data;
const pen_t *pens = &screen->machine->pens[state->palettebank_vis * 256];
int y, i;
/* draw scanlines from the VRAM directly */
for (y = cliprect->min_y; y <= cliprect->max_y; y++)
draw_scanline8(bitmap, 0, y, 256, &local_videoram[(y - BALSENTE_VBEND) * 256], pens);
draw_scanline8(bitmap, 0, y, 256, &state->videoram[(y - BALSENTE_VBEND) * 256], pens);
/* draw the sprite images */
for (i = 0; i < 40; i++)

View File

@ -739,7 +739,7 @@ static void psx_gpu_init( running_machine *machine )
}
// icky!!!
state_save_register_memory( machine, "globals", NULL, 0, "m_packet", (UINT8 *)&m_packet, 1, sizeof( m_packet ) );
state_save_register_memory( machine, "globals", NULL, 0, "m_packet", (UINT8 *)&m_packet, 1, sizeof( m_packet ), __FILE__, __LINE__ );
state_save_register_global_pointer(machine, m_p_vram, m_n_vram_size );
state_save_register_global(machine, m_n_gpu_buffer_offset );