From: Atari Ace [mailto:atari_ace@verizon.net]

Subject: [patch] memory_region madness reloaded
Hi mamedev,

The memory_region and memory_region_length functions are probably the
two most common functions in MAME that don't take a machine parameter
but should given the syntax of the related apis memory_region_type and
memory_region_flags.  Clearly they didn't get the parameter because of
the sheer number of changes needed to change the apis.  This pair of
patches makes the change, and deals with the consequences.

The second patch then changes the api for memory_region and
memory_region_length, and fixes the fallout.  It generally plumbs
through machine parameters where needed, except for the case of sound
apis which I deferred doing so till later.  This increased the number
of deprecat.h includes by ~50.  Given it is a massive patch, there are
bound to be a few mistakes in it (I had to make ~20% of the changes by
hand), but I exercised care and reviewed the patch several times to
minimize the problems.
This commit is contained in:
Aaron Giles 2008-06-23 08:32:42 +00:00
parent b3743812df
commit 57c35a0efc
961 changed files with 4953 additions and 4896 deletions

View File

@ -1256,8 +1256,8 @@ static void dispose_watch(watch_info *watch);
static watch_info
*get_unused_watch(void);
static void add_cheat_from_watch(watch_info *watch);
static void add_cheat_from_watch_as_watch(cheat_entry *entry, watch_info *watch);
static void add_cheat_from_watch(running_machine *machine, watch_info *watch);
static void add_cheat_from_watch_as_watch(running_machine *machine, cheat_entry *entry, watch_info *watch);
static void reset_watch(watch_info *watch);
@ -1301,7 +1301,7 @@ static void load_user_defined_search_region(running_machine *machine, char *fil
static void load_cheat_database(running_machine *machine, UINT8 flags);
static void reload_cheat_database(running_machine *machine);
static void dispose_cheat_database(void);
static void dispose_cheat_database(running_machine *machine);
/********** SAVER **********/
static void save_cheat_code(running_machine *machine, cheat_entry *entry);
@ -1313,8 +1313,8 @@ static void save_raw_code(running_machine *machine);
static void do_auto_save_cheats(running_machine *machine);
/********** CODE ADDITION **********/
static void add_cheat_from_result(search_info *search, search_region *region, UINT32 address);
static void add_cheat_from_first_result(search_info *search);
static void add_cheat_from_result(running_machine *machine, search_info *search, search_region *region, UINT32 address);
static void add_cheat_from_first_result(running_machine *machine, search_info *search);
static void add_watch_from_result(search_info *search, search_region *region, UINT32 address);
/********** SEARCH **********/
@ -1347,8 +1347,8 @@ static UINT32 do_memory_read(UINT8 *buf, UINT32 address, UINT8 bytes, UINT8 swap
static void do_cpu_write(UINT32 data, UINT8 cpu, UINT32 address, UINT8 bytes, UINT8 swap);
static void do_memory_write(UINT32 data, UINT8 *buf, UINT32 address, UINT8 bytes, UINT8 swap, cpu_region_info *info);
static UINT32 read_data(cheat_action *action);
static void write_data(cheat_action *action, UINT32 data);
static UINT32 read_data(running_machine *machine, cheat_action *action);
static void write_data(running_machine *machine, cheat_action *action, UINT32 data);
/********** WATCH **********/
static void watch_cheat_entry(cheat_entry *entry, UINT8 associate);
@ -1356,23 +1356,23 @@ static void add_action_watch(cheat_action *action, cheat_entry *entry);
static void remove_associated_watches(cheat_entry *entry);
/********** ACTIVE/DEACTIVE ENTRY **********/
static void reset_action(cheat_action *action);
static void activate_cheat(cheat_entry *entry);
static void restore_last_value(cheat_action *action);
static void deactivate_cheat(cheat_entry *entry);
static void temp_deactivate_cheat(cheat_entry *entry);
static void reset_action(running_machine *machine, cheat_action *action);
static void activate_cheat(running_machine *machine, cheat_entry *entry);
static void restore_last_value(running_machine *machine, cheat_action *action);
static void deactivate_cheat(running_machine *machine, cheat_entry *entry);
static void temp_deactivate_cheat(running_machine *machine, cheat_entry *entry);
/********** OPERATION CORE **********/
static void cheat_periodicOperation(cheat_action *action);
static UINT8 cheat_periodicCondition(cheat_action *action);
static void cheat_periodicOperation(running_machine *machine, cheat_action *action);
static UINT8 cheat_periodicCondition(running_machine *machine, cheat_action *action);
static int cheat_periodicAction(running_machine *machine, cheat_action *action, int selection);
static void cheat_periodicEntry(running_machine *machine, cheat_entry *entry);
/********** CONFIGURE ENTRY **********/
static void update_all_cheat_info(void);
static void update_cheat_info(cheat_entry *entry, UINT8 is_load_time);
static UINT32 analyse_code_format(cheat_entry *entry, cheat_action *action);
static void check_code_format(cheat_entry *entry);
static void update_all_cheat_info(running_machine *machine);
static void update_cheat_info(running_machine *machine, cheat_entry *entry, UINT8 is_load_time);
static UINT32 analyse_code_format(running_machine *machine, cheat_entry *entry, cheat_action *action);
static void check_code_format(running_machine *machine, cheat_entry *entry);
static void build_label_index_table(cheat_entry *entry);
static void set_layer_index(void);
@ -2134,7 +2134,7 @@ static void cheat_exit(running_machine *machine)
do_auto_save_cheats(machine);
/* free cheat list */
dispose_cheat_database();
dispose_cheat_database(machine);
/* free watch lists */
if(watch_list)
@ -2558,7 +2558,7 @@ static int user_select_value_menu(running_machine *machine, cheat_menu_stack *me
/* first setting 2 : save the value */
if(menu->first_time)
{
display_value = is_bcd ? DecimalToBCD(BCDToDecimal(read_data(action))) : read_data(action);
display_value = is_bcd ? DecimalToBCD(BCDToDecimal(read_data(machine, action))) : read_data(machine, action);
if(display_value < min)
display_value = min;
@ -2715,7 +2715,7 @@ static int user_select_value_menu(running_machine *machine, cheat_menu_stack *me
}
}
activate_cheat(entry);
activate_cheat(machine, entry);
menu->sel = -1;
}
@ -2840,9 +2840,9 @@ static int user_select_label_menu(running_machine *machine, cheat_menu_stack *me
/* set new label index */
if(entry->selection)
activate_cheat(entry);
activate_cheat(machine, entry);
else
deactivate_cheat(entry);
deactivate_cheat(machine, entry);
/* NOTE : the index number of master code should be stored into 1st table */
if(TEST_FIELD(entry->action_list[entry->label_index[0]].type, LabelSelectQuickClose))
@ -3426,9 +3426,9 @@ static int enable_disable_cheat_menu(running_machine *machine, cheat_menu_stack
/* NOTE : one shot cheat should not be activated by changing label */
if(entry->label_index[entry->selection] == 0)
deactivate_cheat(entry);
deactivate_cheat(machine, entry);
else if((entry->flags & kCheatFlag_OneShot) == 0 && (entry->flags & kCheatFlag_Active) == 0)
activate_cheat(entry);
activate_cheat(machine, entry);
}
}
else if(entry->flags & kCheatFlag_LayerIndex)
@ -3460,9 +3460,9 @@ static int enable_disable_cheat_menu(running_machine *machine, cheat_menu_stack
/* NOTE : one shot cheat should not be activated by changing label */
if(entry->label_index[entry->selection] == 0)
deactivate_cheat(entry);
deactivate_cheat(machine, entry);
else if((entry->flags & kCheatFlag_OneShot) == 0 && (entry->flags & kCheatFlag_Active) == 0)
activate_cheat(entry);
activate_cheat(machine, entry);
}
}
else if(entry->flags & kCheatFlag_LayerIndex)
@ -3491,9 +3491,9 @@ static int enable_disable_cheat_menu(running_machine *machine, cheat_menu_stack
else
{
if(active)
activate_cheat(entry);
activate_cheat(machine, entry);
else
deactivate_cheat(entry);
deactivate_cheat(machine, entry);
}
}
break;
@ -3564,7 +3564,7 @@ static int enable_disable_cheat_menu(running_machine *machine, cheat_menu_stack
else
{
/* activate selected code */
activate_cheat(entry);
activate_cheat(machine, entry);
}
}
}
@ -3907,7 +3907,7 @@ static int command_add_edit_menu(running_machine *machine, cheat_menu_stack *men
for(i = 0; i < entry->action_list_length; i++)
{
entry->action_list[i].flags |= kActionFlag_OldFormat;
update_cheat_info(entry, 0);
update_cheat_info(machine, entry, 0);
}
}
else
@ -3916,7 +3916,7 @@ static int command_add_edit_menu(running_machine *machine, cheat_menu_stack *men
for(i = 0; i < entry->action_list_length; i++)
{
entry->action_list[i].flags &= ~kActionFlag_OldFormat;
update_cheat_info(entry, 0);
update_cheat_info(machine, entry, 0);
}
}
break;
@ -6171,7 +6171,7 @@ static int analyse_cheat_menu(running_machine *machine, cheat_menu_stack *menu)
{
cheat_action *action = &entry->action_list[i];
UINT32 flags = analyse_code_format(entry, action);
UINT32 flags = analyse_code_format(machine, entry, action);
menu_item[total++] = action->optional_name ? action->optional_name : "(Null)";
menu_item[total++] = MENU_SEPARATOR_ITEM;
@ -6796,7 +6796,7 @@ static int search_minimum_menu(running_machine *machine, cheat_menu_stack *menu)
if(search->num_results == 1)
{
add_cheat_from_first_result(search);
add_cheat_from_first_result(machine, search);
SET_MESSAGE(CHEAT_MESSAGE_ONE_CHEAT_FOUND);
}
@ -7307,7 +7307,7 @@ static int search_standard_menu(running_machine *machine, cheat_menu_stack *menu
doneSaveMemory = 1;
if(search->num_results == 1)
add_cheat_from_first_result(search);
add_cheat_from_first_result(machine, search);
}
/********** EDIT **********/
@ -7747,7 +7747,7 @@ static int search_advanced_menu(running_machine *machine, cheat_menu_stack *menu
if(search->num_results == 1)
{
add_cheat_from_first_result(search);
add_cheat_from_first_result(machine, search);
popmessage("1 result found, added to list");
}
@ -8287,7 +8287,7 @@ static int view_search_result_menu(running_machine *machine, cheat_menu_stack *m
else if(input_ui_pressed(machine, IPT_UI_ADD_CHEAT))
{
if(selectedAddressGood)
add_cheat_from_result(search, region, selectedAddress);
add_cheat_from_result(machine, search, region, selectedAddress);
}
else if(input_ui_pressed(machine, IPT_UI_DELETE_CHEAT))
{
@ -8591,12 +8591,12 @@ static int choose_watch_menu(running_machine *machine, cheat_menu_stack *menu)
if(!editActive && watch)
{
if(ShiftKeyPressed())
add_cheat_from_watch(watch);
add_cheat_from_watch(machine, watch);
else if(ControlKeyPressed())
{
cheat_entry *entry = get_new_cheat();
add_cheat_from_watch_as_watch(entry, watch);
add_cheat_from_watch_as_watch(machine, entry, watch);
/* when fails to add, delete this entry because it causes the crash */
if(message_type == CHEAT_MESSAGE_FAILED_TO_ADD)
@ -8653,7 +8653,7 @@ static int choose_watch_menu(running_machine *machine, cheat_menu_stack *menu)
memset(&entry, 0, sizeof(cheat_entry));
add_cheat_from_watch_as_watch(&entry, watch);
add_cheat_from_watch_as_watch(machine, &entry, watch);
save_cheat_code(machine, &entry);
dispose_cheat(&entry);
}
@ -8795,14 +8795,14 @@ static int command_watch_menu(running_machine *machine, cheat_menu_stack *menu)
break;
case kMenu_AddAsCheatCode:
add_cheat_from_watch(entry);
add_cheat_from_watch(machine, entry);
break;
case kMenu_AddAsWatchCode:
{
cheat_entry *new_entry = get_new_cheat();
add_cheat_from_watch_as_watch(new_entry, entry);
add_cheat_from_watch_as_watch(machine, new_entry, entry);
/* when fails to add, delete this entry because it causes the crash */
if(message_type == CHEAT_MESSAGE_FAILED_TO_ADD)
@ -8823,7 +8823,7 @@ static int command_watch_menu(running_machine *machine, cheat_menu_stack *menu)
memset(&temp_entry, 0, sizeof(cheat_entry));
add_cheat_from_watch_as_watch(&temp_entry, entry);
add_cheat_from_watch_as_watch(machine, &temp_entry, entry);
save_cheat_code(machine, &temp_entry);
dispose_cheat(&temp_entry);
}
@ -9309,7 +9309,7 @@ static int edit_watch_menu(running_machine *machine, cheat_menu_stack *menu)
else
{
if(input_ui_pressed(machine, IPT_UI_ADD_CHEAT))
add_cheat_from_watch(entry);
add_cheat_from_watch(machine, entry);
if(input_ui_pressed(machine, IPT_UI_DELETE_CHEAT))
entry->num_elements = 0;
@ -9320,7 +9320,7 @@ static int edit_watch_menu(running_machine *machine, cheat_menu_stack *menu)
memset(&temp_entry, 0, sizeof(cheat_entry));
add_cheat_from_watch_as_watch(&temp_entry, entry);
add_cheat_from_watch_as_watch(machine, &temp_entry, entry);
save_cheat_code(machine, &temp_entry);
dispose_cheat(&temp_entry);
}
@ -10208,7 +10208,7 @@ static TIMER_CALLBACK( cheat_periodic )
if(cheats_disabled)
{
for(i = 0; i < cheat_list_length; i++)
temp_deactivate_cheat(&cheat_list[i]);
temp_deactivate_cheat(machine, &cheat_list[i]);
}
}
}
@ -10294,7 +10294,7 @@ static UINT32 PrintASCII(char * buf, UINT32 data, UINT8 size)
cheat_display_watches - display watchpoint
---------------------------------------------*/
void cheat_display_watches(void)
void cheat_display_watches(running_machine *machine)
{
int i;
@ -10367,7 +10367,7 @@ void cheat_display_watches(void)
}
else
{
UINT8 * buf = memory_region(info->cpu);
UINT8 * buf = memory_region(machine, info->cpu);
if(buf)
data = do_memory_read(buf, address, kSearchByteIncrementTable[info->element_bytes],
@ -10826,7 +10826,7 @@ static watch_info *get_unused_watch(void)
add_cheat_from_watch - add new cheat code from watchpoint
------------------------------------------------------------*/
static void add_cheat_from_watch(watch_info *watch)
static void add_cheat_from_watch(running_machine *machine, watch_info *watch)
{
if(watch)
{
@ -10841,14 +10841,14 @@ static void add_cheat_from_watch(watch_info *watch)
action->original_address = watch->address;
action->extend_data = ~0;
action->last_value = NULL;
action->data = read_data(action);
action->data = read_data(machine, action);
SET_FIELD(action->type, AddressSize, watch->element_bytes);
/* set name */
temp_string_length = sprintf(temp_string, "%.8X (%d) = %.*X", watch->address, watch->cpu, kSearchByteDigitsTable[watch->element_bytes], action->data);
entry->name = create_string_copy(temp_string);
update_cheat_info(entry, 0);
update_cheat_info(machine, entry, 0);
SET_MESSAGE(CHEAT_MESSAGE_SUCCEEDED_TO_ADD);
}
@ -10860,7 +10860,7 @@ static void add_cheat_from_watch(watch_info *watch)
add_cheat_from_watch_as_watch - add new watchpoint cheat from watchpoint
---------------------------------------------------------------------------*/
static void add_cheat_from_watch_as_watch(cheat_entry *entry, watch_info *watch)
static void add_cheat_from_watch_as_watch(running_machine *machine, cheat_entry *entry, watch_info *watch)
{
/* NOTE : don't add in case of undisplayed watchpoint */
if(watch && entry && watch->num_elements)
@ -10893,7 +10893,7 @@ static void add_cheat_from_watch_as_watch(cheat_entry *entry, watch_info *watch)
SET_FIELD(action->data, WatchElementsPerLine, watch->elements_per_line);
SET_FIELD(action->data, WatchAddValue, watch->add_value);
update_cheat_info(entry, 0);
update_cheat_info(machine, entry, 0);
SET_MESSAGE(CHEAT_MESSAGE_SUCCEEDED_TO_ADD);
}
@ -11740,7 +11740,7 @@ static void handle_local_command_cheat(running_machine *machine, int cpu, int ty
{
cheat_entry *entry = &cheat_list[address];
activate_cheat(entry);
activate_cheat(machine, entry);
if(data && data < entry->action_list_length)
entry->selection = data;
@ -12279,7 +12279,7 @@ static void load_cheat_database(running_machine *machine, UINT8 flags)
while(data);
if(flags & LOAD_CHEAT_CODE)
update_all_cheat_info();
update_all_cheat_info(machine);
}
/*---------------------------------------------------------------------------
@ -12288,7 +12288,7 @@ static void load_cheat_database(running_machine *machine, UINT8 flags)
static void reload_cheat_database(running_machine *machine)
{
dispose_cheat_database();
dispose_cheat_database(machine);
load_cheat_database(machine, LOAD_CHEAT_CODE);
SET_MESSAGE(found_database ? CHEAT_MESSAGE_RELOAD_CHEAT_CODE : CHEAT_MESSAGE_FAILED_TO_LOAD_DATABASE);
@ -12298,13 +12298,13 @@ static void reload_cheat_database(running_machine *machine)
dispose_cheat_database - free all cheat entries
--------------------------------------------------*/
static void dispose_cheat_database(void)
static void dispose_cheat_database(running_machine *machine)
{
int i;
/* first, turn all cheats "OFF" */
for(i = 0; i < cheat_list_length; i++)
temp_deactivate_cheat(&cheat_list[i]);
temp_deactivate_cheat(machine, &cheat_list[i]);
/* next, free memory for all cheat entries */
if(cheat_list)
@ -12696,7 +12696,7 @@ static void do_auto_save_cheats(running_machine *machine)
add_cheat_from_result - add a code from result viewer to cheat list
----------------------------------------------------------------------*/
static void add_cheat_from_result(search_info *search, search_region *region, UINT32 address)
static void add_cheat_from_result(running_machine *machine, search_info *search, search_region *region, UINT32 address)
{
if(region->target_type == kRegionType_CPU || region->target_type == kRegionType_Memory)
{
@ -12724,7 +12724,7 @@ static void add_cheat_from_result(search_info *search, search_region *region, UI
action->last_value = NULL;
SET_FIELD(action->type, AddressSize, kSearchByteIncrementTable[search->bytes] - 1);
update_cheat_info(entry, 0);
update_cheat_info(machine, entry, 0);
}
}
@ -12732,7 +12732,7 @@ static void add_cheat_from_result(search_info *search, search_region *region, UI
add_cheat_from_first_result - add a code from search box to cheat list if found result is one
------------------------------------------------------------------------------------------------*/
static void add_cheat_from_first_result(search_info *search)
static void add_cheat_from_first_result(running_machine *machine, search_info *search)
{
int i;
@ -12750,7 +12750,7 @@ static void add_cheat_from_first_result(search_info *search)
if(is_region_offset_valid(search, region, traverse))
{
add_cheat_from_result(search, region, address);
add_cheat_from_result(machine, search, region, address);
return;
}
}
@ -13514,7 +13514,7 @@ static void do_memory_write(UINT32 data, UINT8 *buf, UINT32 address, UINT8 bytes
read_data
------------*/
static UINT32 read_data(cheat_action *action)
static UINT32 read_data(running_machine *machine, cheat_action *action)
{
UINT8 read_from = EXTRACT_FIELD(action->type, AddressRead);
UINT8 bytes = EXTRACT_FIELD(action->type, AddressSize);
@ -13617,11 +13617,11 @@ static UINT32 read_data(cheat_action *action)
else
{
/* non-CPU region */
UINT8 * buf = memory_region(region);
UINT8 * buf = memory_region(machine, region);
if(buf)
{
if(is_address_in_range(action, memory_region_length(region)))
if(is_address_in_range(action, memory_region_length(machine, region)))
return do_memory_read( buf, address, bytes,
region_needs_swap(region) ^ EXTRACT_FIELD(action->type, Endianness),
get_region_info(region));
@ -13641,7 +13641,7 @@ static UINT32 read_data(cheat_action *action)
write_data - write a data to memory
--------------------------------------*/
static void write_data(cheat_action *action, UINT32 data)
static void write_data(running_machine *machine, cheat_action *action, UINT32 data)
{
UINT8 read_from = EXTRACT_FIELD(action->type, AddressRead);
UINT8 bytes = EXTRACT_FIELD(action->type, AddressSize);
@ -13745,11 +13745,11 @@ static void write_data(cheat_action *action, UINT32 data)
else
{
/* non-CPU region */
UINT8 * buf = memory_region(region);
UINT8 * buf = memory_region(machine, region);
if(buf)
{
if(is_address_in_range(action, memory_region_length(region)))
if(is_address_in_range(action, memory_region_length(machine, region)))
do_memory_write(data, buf, address, bytes,
region_needs_swap(region) ^ EXTRACT_FIELD(action->type, Endianness),
get_region_info(action->region));
@ -13922,7 +13922,7 @@ static void remove_associated_watches(cheat_entry *entry)
reset_action - back up data and set action flags
---------------------------------------------------*/
static void reset_action(cheat_action *action)
static void reset_action(running_machine *machine, cheat_action *action)
{
/* back up a value */
if(action->flags & kActionFlag_OldFormat)
@ -13932,7 +13932,7 @@ static void reset_action(cheat_action *action)
action->last_value = malloc(sizeof(action->last_value));
if(action->last_value == NULL) goto reset_action_error;
action->type = convert_to_new_code(action);
action->last_value[0] = read_data(action);
action->last_value[0] = read_data(machine, action);
action->type = type;
}
else
@ -13947,15 +13947,15 @@ static void reset_action(cheat_action *action)
/* Write, IWrite, CWrite, CBit */
action->last_value = malloc(sizeof(action->last_value));
if(action->last_value == NULL) goto reset_action_error;
action->last_value[0] = read_data(action);
action->last_value[0] = read_data(machine, action);
break;
case kCodeType_PDWWrite:
action->last_value = malloc(sizeof(action->last_value) * 2);
if(action->last_value == NULL) goto reset_action_error;
action->flags &= ~kActionFlag_IsFirst;
action->last_value[0] = read_data(action);
action->last_value[1] = read_data(action);
action->last_value[0] = read_data(machine, action);
action->last_value[1] = read_data(machine, action);
break;
case kCodeType_RWrite:
@ -13966,7 +13966,7 @@ static void reset_action(cheat_action *action)
{
action->last_value = realloc(action->last_value, sizeof(action->last_value) * EXTRACT_FIELD(action->extend_data, LSB16));
if(action->last_value == NULL) goto reset_action_error;
action->last_value[i] = read_data(action);
action->last_value[i] = read_data(machine, action);
action->address += EXTRACT_FIELD(action->extend_data, MSB16) ?
EXTRACT_FIELD(action->extend_data, MSB16) :
kSearchByteIncrementTable[EXTRACT_FIELD(action->type, AddressSize)];
@ -13989,7 +13989,7 @@ static void reset_action(cheat_action *action)
if(action->flags & kActionFlag_CheckCondition)
{
if(EXTRACT_FIELD(action->type, CodeParameter) == kCondition_PreviousValue)
action->extend_data = read_data(action);
action->extend_data = read_data(machine, action);
}
return;
@ -14007,7 +14007,7 @@ static void reset_action(cheat_action *action)
activate_cheat - reset action entry and set activate entry flag when turn CODE "ON"
--------------------------------------------------------------------------------------*/
static void activate_cheat(cheat_entry *entry)
static void activate_cheat(running_machine *machine, cheat_entry *entry)
{
int i;
@ -14015,7 +14015,7 @@ static void activate_cheat(cheat_entry *entry)
{
cheat_action *action = &entry->action_list[i];
reset_action(action);
reset_action(machine, action);
/* if watchpoint code, add watchpoint */
if(EXTRACT_FIELD(action->type, CodeType) == kCodeType_Watch)
@ -14030,7 +14030,7 @@ static void activate_cheat(cheat_entry *entry)
restore_last_value - restore previous value if needed
--------------------------------------------------------*/
static void restore_last_value(cheat_action *action)
static void restore_last_value(running_machine *machine, cheat_action *action)
{
if(action->flags & kActionFlag_MemoryWrite)
{
@ -14040,13 +14040,13 @@ static void restore_last_value(cheat_action *action)
{
default:
/* Write, IWrite, CWrite, CBit */
write_data(action, (UINT32)action->last_value[0]);
write_data(machine, action, (UINT32)action->last_value[0]);
break;
case kCodeType_PDWWrite:
action->flags &= ~kActionFlag_IsFirst;
write_data(action, (UINT32)action->last_value[0]);
write_data(action, (UINT32)action->last_value[1]);
write_data(machine, action, (UINT32)action->last_value[0]);
write_data(machine, action, (UINT32)action->last_value[1]);
break;
case kCodeType_RWrite:
@ -14055,7 +14055,7 @@ static void restore_last_value(cheat_action *action)
for(j = 0; j < EXTRACT_FIELD(action->extend_data, LSB16); j++)
{
write_data(action, (UINT32)action->last_value[j]);
write_data(machine, action, (UINT32)action->last_value[j]);
action->address += EXTRACT_FIELD(action->extend_data, MSB16) ?
EXTRACT_FIELD(action->extend_data, MSB16) :
kSearchByteIncrementTable[EXTRACT_FIELD(action->type, AddressSize)];
@ -14072,7 +14072,7 @@ static void restore_last_value(cheat_action *action)
deactivate_cheat - deactivate selecte cheat entry when turn CODE "OFF"
-------------------------------------------------------------------------*/
static void deactivate_cheat(cheat_entry *entry)
static void deactivate_cheat(running_machine *machine, cheat_entry *entry)
{
int i;
@ -14086,7 +14086,7 @@ static void deactivate_cheat(cheat_entry *entry)
/* restore previous value if needed */
if(action->last_value)
{
restore_last_value(action);
restore_last_value(machine, action);
action->flags &= ~kActionFlag_LastValueGood;
free(action->last_value);
}
@ -14105,7 +14105,7 @@ static void deactivate_cheat(cheat_entry *entry)
temp_deactivate_cheat - deactivate cheat when turn CHEAT "OFF"
-----------------------------------------------------------------*/
static void temp_deactivate_cheat(cheat_entry *entry)
static void temp_deactivate_cheat(running_machine *machine, cheat_entry *entry)
{
if(entry->flags & kCheatFlag_Active)
{
@ -14120,7 +14120,7 @@ static void temp_deactivate_cheat(cheat_entry *entry)
/* restore previous value if needed */
if(action->last_value)
restore_last_value(action);
restore_last_value(machine, action);
}
}
}
@ -14129,15 +14129,15 @@ static void temp_deactivate_cheat(cheat_entry *entry)
cheat_periodicOperation - management for cheat operations
------------------------------------------------------------*/
static void cheat_periodicOperation(cheat_action *action)
static void cheat_periodicOperation(running_machine *machine, cheat_action *action)
{
int data = TEST_FIELD(action->type, DataRead) ? cheat_variable[action->data] : action->data;
if(action->flags & kActionFlag_PDWWrite)
{
action->flags &= ~kActionFlag_IsFirst;
write_data(action, data);
write_data(action, action->extend_data);
write_data(machine, action, data);
write_data(machine, action, action->extend_data);
}
else if(action->flags & kActionFlag_Repeat)
{
@ -14145,7 +14145,7 @@ static void cheat_periodicOperation(cheat_action *action)
for(i = 0; i < EXTRACT_FIELD(action->extend_data, LSB16); i++)
{
write_data(action, data);
write_data(machine, action, data);
action->address += EXTRACT_FIELD(action->extend_data, MSB16) ?
EXTRACT_FIELD(action->extend_data, MSB16) :
kSearchByteIncrementTable[EXTRACT_FIELD(action->type, AddressSize)];
@ -14157,53 +14157,53 @@ static void cheat_periodicOperation(cheat_action *action)
switch(EXTRACT_FIELD(action->type, CodeType))
{
case kCodeType_Write:
write_data(action, (data & action->extend_data) | (read_data(action) & ~action->extend_data));
write_data(machine, action, (data & action->extend_data) | (read_data(machine, action) & ~action->extend_data));
break;
case kCodeType_IWrite:
switch(EXTRACT_FIELD(action->type, CodeParameter))
{
case IWRITE_WRITE:
write_data(action, data);
write_data(machine, action, data);
break;
case IWRITE_BIT_SET:
write_data(action, read_data(action) | data);
write_data(machine, action, read_data(machine, action) | data);
break;
case IWRITE_BIT_CLEAR:
write_data(action, read_data(action) & ~data);
write_data(machine, action, read_data(machine, action) & ~data);
break;
case IWRITE_LIMITED_MASK:
write_data(action, (EXTRACT_FIELD(data, MSB16) & EXTRACT_FIELD(data, LSB16)) | (read_data(action) & ~EXTRACT_FIELD(data, LSB16)));
write_data(machine, action, (EXTRACT_FIELD(data, MSB16) & EXTRACT_FIELD(data, LSB16)) | (read_data(machine, action) & ~EXTRACT_FIELD(data, LSB16)));
break;
}
break;
case kCodeType_CWrite:
write_data(action, data);
write_data(machine, action, data);
break;
case kCodeType_CBit:
switch(EXTRACT_FIELD(action->type, CodeParameterUpper))
{
case CBIT_BIT_SET:
write_data(action, read_data(action) | data);
write_data(machine, action, read_data(machine, action) | data);
break;
case CBIT_BIT_CLEAR:
write_data(action, read_data(action) & ~data);
write_data(machine, action, read_data(machine, action) & ~data);
break;
case CBIT_LIMITED_MASK:
write_data(action, (EXTRACT_FIELD(data, MSB16) & EXTRACT_FIELD(data, LSB16)) | (read_data(action) & ~EXTRACT_FIELD(data, LSB16)));
write_data(machine, action, (EXTRACT_FIELD(data, MSB16) & EXTRACT_FIELD(data, LSB16)) | (read_data(machine, action) & ~EXTRACT_FIELD(data, LSB16)));
break;
}
break;
case kCodeType_Move:
cheat_variable[EXTRACT_FIELD(action->type, CodeParameter)] = read_data(action) + data;
cheat_variable[EXTRACT_FIELD(action->type, CodeParameter)] = read_data(machine, action) + data;
break;
case kCodeType_Popup:
@ -14217,7 +14217,7 @@ static void cheat_periodicOperation(cheat_action *action)
ui_popup_time(1, "%*.*X",
kCheatSizeDigitsTable[EXTRACT_FIELD(action->type, AddressSize)],
kCheatSizeDigitsTable[EXTRACT_FIELD(action->type, AddressSize)],
read_data(action));
read_data(machine, action));
break;
case kPopup_LabelValue:
@ -14225,14 +14225,14 @@ static void cheat_periodicOperation(cheat_action *action)
action->optional_name,
kCheatSizeDigitsTable[EXTRACT_FIELD(action->type, AddressSize)],
kCheatSizeDigitsTable[EXTRACT_FIELD(action->type, AddressSize)],
read_data(action));
read_data(machine, action));
break;
case kPopup_ValueLabel:
ui_popup_time(1, "%*.*X %s",
kCheatSizeDigitsTable[EXTRACT_FIELD(action->type, AddressSize)],
kCheatSizeDigitsTable[EXTRACT_FIELD(action->type, AddressSize)],
read_data(action),
read_data(machine, action),
action->optional_name);
break;
}
@ -14249,9 +14249,9 @@ static void cheat_periodicOperation(cheat_action *action)
cheat_periodicCondition - management for cheat conditions
------------------------------------------------------------*/
static UINT8 cheat_periodicCondition(cheat_action *action)
static UINT8 cheat_periodicCondition(running_machine *machine, cheat_action *action)
{
int data = read_data(action);
int data = read_data(machine, action);
int value = action->extend_data;
if(EXTRACT_FIELD(action->type, CodeType) != kCodeType_CBit)
@ -14334,14 +14334,14 @@ static int cheat_periodicAction(running_machine *machine, cheat_action *action,
if((action->flags & kActionFlag_PrefillWritten) == 0)
{
/* set prefill */
write_data(action, prefillValue);
write_data(machine, action, prefillValue);
action->flags |= kActionFlag_PrefillWritten;
return (TEST_FIELD(action->type, Return) ? CHEAT_RETURN_VALUE : selection + 1);
}
else
{
/* do re-write */
if(read_data(action) == prefillValue)
if(read_data(machine, action) == prefillValue)
return (TEST_FIELD(action->type, Return) ? CHEAT_RETURN_VALUE : selection + 1);
action->flags |= kActionFlag_PrefillDone;
@ -14387,7 +14387,7 @@ static int cheat_periodicAction(running_machine *machine, cheat_action *action,
if(action->flags & kActionFlag_CheckCondition)
{
if(cheat_periodicCondition(action))
if(cheat_periodicCondition(machine, action))
execute_operation = 1;
else
execute_operation = 0;
@ -14406,7 +14406,7 @@ static int cheat_periodicAction(running_machine *machine, cheat_action *action,
case kCodeType_PDWWrite:
case kCodeType_Move:
case kCodeType_Popup:
cheat_periodicOperation(action);
cheat_periodicOperation(machine, action);
break;
case kCodeType_Branch:
@ -14414,11 +14414,11 @@ static int cheat_periodicAction(running_machine *machine, cheat_action *action,
case kCodeType_Loop:
{
int counter = read_data(action);
int counter = read_data(machine, action);
if(counter != 0)
{
write_data(action, counter - 1);
write_data(machine, action, counter - 1);
return (TEST_FIELD(action->type, DataRead) ? cheat_variable[action->data] : action->data);
}
@ -14467,9 +14467,9 @@ static void cheat_periodicEntry(running_machine *machine, cheat_entry *entry)
/* NOTE : in handling activatio key, forced to activate a cheat even if one shot */
if(!(entry->flags & kCheatFlag_OneShot) && !(entry->label_index[entry->selection]))
deactivate_cheat(entry);
deactivate_cheat(machine, entry);
else
activate_cheat(entry);
activate_cheat(machine, entry);
if(TEST_FIELD(cheat_options, ActivationKeyMessage))
{
@ -14487,21 +14487,21 @@ static void cheat_periodicEntry(running_machine *machine, cheat_entry *entry)
{
if(entry->flags & kCheatFlag_OneShot)
{
activate_cheat(entry);
activate_cheat(machine, entry);
if(TEST_FIELD(cheat_options, ActivationKeyMessage))
ui_popup_time(1,"set %s", entry->name);
}
else if(entry->flags & kCheatFlag_Active)
{
deactivate_cheat(entry);
deactivate_cheat(machine, entry);
if(TEST_FIELD(cheat_options, ActivationKeyMessage))
ui_popup_time(1,"%s disabled", entry->name);
}
else
{
activate_cheat(entry);
activate_cheat(machine, entry);
if(TEST_FIELD(cheat_options, ActivationKeyMessage))
ui_popup_time(1,"%s enabled", entry->name);
@ -14587,7 +14587,7 @@ static void cheat_periodicEntry(running_machine *machine, cheat_entry *entry)
}
if(done)
deactivate_cheat(entry);
deactivate_cheat(machine, entry);
}
}
@ -14595,14 +14595,14 @@ static void cheat_periodicEntry(running_machine *machine, cheat_entry *entry)
update_all_cheat_info - update all cheat info when database loaded
---------------------------------------------------------------------*/
static void update_all_cheat_info(void)
static void update_all_cheat_info(running_machine *machine)
{
int i;
/* update flags for all cheat entry */
for(i = 0; i < cheat_list_length; i++)
{
update_cheat_info(&cheat_list[i], 1);
update_cheat_info(machine, &cheat_list[i], 1);
if(cheat_list[i].flags & kCheatFlag_Select)
build_label_index_table(&cheat_list[i]);
@ -14616,7 +14616,7 @@ static void update_all_cheat_info(void)
"is_load_time" parameter is set when called update_all_cheat_info() right now
----------------------------------------------------------------------------------------------------*/
static void update_cheat_info(cheat_entry *entry, UINT8 is_load_time)
static void update_cheat_info(running_machine *machine, cheat_entry *entry, UINT8 is_load_time)
{
int i;
int flags = 0;
@ -14792,14 +14792,14 @@ static void update_cheat_info(cheat_entry *entry, UINT8 is_load_time)
if(is_load_time)
entry->flags &= ~kCheatFlag_Dirty;
check_code_format(entry);
check_code_format(machine, entry);
}
/*----------------------
analyse_code_format
----------------------*/
static UINT32 analyse_code_format(cheat_entry *entry, cheat_action *action)
static UINT32 analyse_code_format(running_machine *machine, cheat_entry *entry, cheat_action *action)
{
UINT32 errorFlag = 0;
@ -14950,7 +14950,7 @@ static UINT32 analyse_code_format(cheat_entry *entry, cheat_action *action)
if(region >= REGION_MAX) errorFlag |= kErrorFlag_OutOfCPURegion;
else if(!region_info_list[region].type) errorFlag |= kErrorFlag_InvalidCPURegion;
else if(!is_address_in_range(action, memory_region_length(action->region)))
else if(!is_address_in_range(action, memory_region_length(machine, action->region)))
errorFlag |= kErrorFlag_RegionOutOfRange;
}
}
@ -14969,7 +14969,7 @@ static UINT32 analyse_code_format(cheat_entry *entry, cheat_action *action)
check_code_format - code format checker
------------------------------------------*/
static void check_code_format(cheat_entry *entry)
static void check_code_format(running_machine *machine, cheat_entry *entry)
{
int i;
UINT8 is_error = 0;
@ -14978,7 +14978,7 @@ static void check_code_format(cheat_entry *entry)
{
cheat_action *action = &entry->action_list[i];
if(analyse_code_format(entry, action))
if(analyse_code_format(machine, entry, action))
is_error = 1;
}
@ -15208,7 +15208,7 @@ static void build_cpu_region_info_list(running_machine *machine)
if(region_type >= REGION_GFX1 && region_type <= REGION_PLDS)
{
UINT8 bit_state = 0;
UINT32 length = memory_region_length(region_type);
UINT32 length = memory_region_length(machine, region_type);
cpu_region_info *info = &region_info_list[region_type - REGION_INVALID];
info->type = region_type;

View File

@ -20,6 +20,6 @@ void cheat_init(running_machine *machine);
int cheat_menu(running_machine *machine, int selection);
void cheat_display_watches(void);
void cheat_display_watches(running_machine *machine);
#endif /* __CHEAT_H__ */

View File

@ -90,6 +90,7 @@
*****************************************************************************/
#include "debugger.h"
#include "deprecat.h"
#include "i8x41.h"
typedef struct {

View File

@ -2379,7 +2379,7 @@ static void memory_write_byte(debug_view_memory *memdata, offs_t offs, UINT8 dat
/* hack for FD1094 editing */
#ifdef FD1094_HACK
if (memdata->raw_base == memory_region(REGION_USER2))
if (memdata->raw_base == memory_region(machine, REGION_USER2))
{
extern void fd1094_regenerate_key(void);
fd1094_regenerate_key();

View File

@ -1,4 +1,5 @@
#include "driver.h"
#include "deprecat.h"
#include "machine/rp5h01.h"
/****************************************************************************/
@ -40,7 +41,7 @@ int RP5H01_init( const struct RP5H01_interface *interface ) {
for( i = 0; i < intf->num; i++ ) {
RP5H01_state[i].counter = 0;
RP5H01_state[i].counter_mode = COUNTER_MODE_6_BITS;
RP5H01_state[i].data = &( memory_region( intf->region[i] )[ intf->offset[i] ] );
RP5H01_state[i].data = &( memory_region( Machine, intf->region[i] )[ intf->offset[i] ] );
RP5H01_state[i].enabled = 0;
RP5H01_state[i].old_reset = -1;
RP5H01_state[i].old_clock = -1;

View File

@ -867,9 +867,8 @@ void free_memory_region(running_machine *machine, int num)
region
-------------------------------------------------*/
UINT8 *memory_region(int num)
UINT8 *memory_region(running_machine *machine, int num)
{
running_machine *machine = Machine;
mame_private *mame = machine->mame_data;
/* convert to an index and return the result */
@ -883,9 +882,8 @@ UINT8 *memory_region(int num)
memory region
-------------------------------------------------*/
UINT32 memory_region_length(int num)
UINT32 memory_region_length(running_machine *machine, int num)
{
running_machine *machine = Machine;
mame_private *mame = machine->mame_data;
/* convert to an index and return the result */

View File

@ -322,10 +322,10 @@ UINT8 *new_memory_region(running_machine *machine, int type, UINT32 length, UINT
void free_memory_region(running_machine *machine, int num);
/* return a pointer to a specified memory region */
UINT8 *memory_region(int num);
UINT8 *memory_region(running_machine *machine, int num);
/* return the size (in bytes) of a specified memory region */
UINT32 memory_region_length(int num);
UINT32 memory_region_length(running_machine *machine, int num);
/* return the type of a specified memory region */
UINT32 memory_region_type(running_machine *machine, int num);

View File

@ -1368,8 +1368,8 @@ static void memory_init_cpudata(const machine_config *config)
cpu_data *cpu = &cpudata[cpunum];
/* get pointers to the CPU's memory region */
cpu->region = memory_region(REGION_CPU1 + cpunum);
cpu->regionsize = memory_region_length(REGION_CPU1 + cpunum);
cpu->region = memory_region(Machine, REGION_CPU1 + cpunum);
cpu->regionsize = memory_region_length(Machine, REGION_CPU1 + cpunum);
/* initialize each address space, and build up a mask of spaces */
for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
@ -1417,10 +1417,10 @@ static void memory_init_cpudata(const machine_config *config)
}
/* set the RAM/ROM base */
cpu->opbase.ram = cpu->opbase.rom = memory_region(REGION_CPU1 + cpunum);
cpu->opbase.ram = cpu->opbase.rom = memory_region(Machine, REGION_CPU1 + cpunum);
cpu->opbase.mask = cpu->space[ADDRESS_SPACE_PROGRAM].bytemask;
cpu->opbase.mem_min = 0;
cpu->opbase.mem_max = memory_region_length(REGION_CPU1 + cpunum);
cpu->opbase.mem_max = memory_region_length(Machine, REGION_CPU1 + cpunum);
cpu->opbase.entry = STATIC_UNMAP;
cpu->opbase_handler = NULL;
}
@ -1488,8 +1488,8 @@ static void memory_init_preflight(const machine_config *config)
/* validate adjusted addresses against implicit regions */
if (entry->region != 0 && entry->share == 0 && entry->baseptr == NULL)
{
UINT8 *base = memory_region(entry->region);
offs_t length = memory_region_length(entry->region);
UINT8 *base = memory_region(Machine, entry->region);
offs_t length = memory_region_length(Machine, entry->region);
/* validate the region */
if (base == NULL)
@ -1500,7 +1500,7 @@ static void memory_init_preflight(const machine_config *config)
/* convert any region-relative entries to their memory pointers */
if (entry->region != 0)
entry->memory = memory_region(entry->region) + entry->region_offs;
entry->memory = memory_region(Machine, entry->region) + entry->region_offs;
/* assign static banks for explicitly specified entries */
if (HANDLER_IS_BANK(entry->read.generic))
@ -2204,7 +2204,7 @@ static int amentry_needs_backing_store(int cpunum, int spacenum, const address_m
{
if (handler != STATIC_INVALID &&
(handler < STATIC_BANK1 || handler > STATIC_BANK1 + MAX_BANKS - 1) &&
(handler != STATIC_ROM || spacenum != ADDRESS_SPACE_PROGRAM || entry->addrstart >= memory_region_length(REGION_CPU1 + cpunum)) &&
(handler != STATIC_ROM || spacenum != ADDRESS_SPACE_PROGRAM || entry->addrstart >= memory_region_length(Machine, REGION_CPU1 + cpunum)) &&
handler != STATIC_NOP &&
handler != STATIC_UNMAP)
return 1;
@ -2325,8 +2325,8 @@ static void *allocate_memory_block(int cpunum, int spacenum, offs_t bytestart, o
/* register for saving, but only if we're not part of a memory region */
for (region = 0; region < MAX_MEMORY_REGIONS; region++)
{
UINT8 *region_base = memory_region(region);
UINT32 region_length = memory_region_length(region);
UINT8 *region_base = memory_region(Machine, region);
UINT32 region_length = memory_region_length(Machine, region);
if (region_base != NULL && region_length != 0 && (UINT8 *)memory >= region_base && ((UINT8 *)memory + (byteend - bytestart + 1)) < region_base + region_length)
{
VPRINTF(("skipping save of this memory block as it is covered by a memory region\n"));

View File

@ -708,12 +708,12 @@ static void copy_rom_data(rom_load_data *romdata, const rom_entry *romp)
fatalerror("Error in RomModule definition: COPY has an invalid length\n");
/* make sure the source was valid */
srcbase = memory_region(srcregion);
srcbase = memory_region(Machine, srcregion);
if (!srcbase)
fatalerror("Error in RomModule definition: COPY from an invalid region\n");
/* make sure we find within the region space */
if (srcoffs + numbytes > memory_region_length(srcregion))
if (srcoffs + numbytes > memory_region_length(Machine, srcregion))
fatalerror("Error in RomModule definition: COPY out of source memory region space\n");
/* fill the data */
@ -1131,8 +1131,8 @@ void rom_init(running_machine *machine, const rom_entry *romp)
if (regionlist[regnum])
{
debugload("Post-processing region %02X\n", regnum);
romdata.regionlength = memory_region_length(regnum);
romdata.regionbase = memory_region(regnum);
romdata.regionlength = memory_region_length(machine, regnum);
romdata.regionbase = memory_region(machine, regnum);
region_post_process(&romdata, regionlist[regnum]);
}

View File

@ -152,8 +152,8 @@ static void *ym2608_start(int sndindex, int clock, const void *config)
/* stream system initialize */
info->stream = stream_create(0,2,rate,info,ym2608_stream_update);
/* setup adpcm buffers */
pcmbufa = (void *)(memory_region(info->intf->pcmrom));
pcmsizea = memory_region_length(info->intf->pcmrom);
pcmbufa = (void *)(memory_region(Machine, info->intf->pcmrom));
pcmsizea = memory_region_length(Machine, info->intf->pcmrom);
/* initialize YM2608 */
info->chip = YM2608Init(info,sndindex,clock,rate,

View File

@ -151,10 +151,10 @@ static void *ym2610_start(int sndindex, int clock, const void *config)
/* stream system initialize */
info->stream = stream_create(0,2,rate,info,ym2610_stream_update);
/* setup adpcm buffers */
pcmbufa = (void *)(memory_region(info->intf->pcmroma));
pcmsizea = memory_region_length(info->intf->pcmroma);
pcmbufb = (void *)(memory_region(info->intf->pcmromb));
pcmsizeb = memory_region_length(info->intf->pcmromb);
pcmbufa = (void *)(memory_region(Machine, info->intf->pcmroma));
pcmsizea = memory_region_length(Machine, info->intf->pcmroma);
pcmbufb = (void *)(memory_region(Machine, info->intf->pcmromb));
pcmsizeb = memory_region_length(Machine, info->intf->pcmromb);
/**** initialize YM2610 ****/
info->chip = YM2610Init(info,sndindex,clock,rate,
@ -209,10 +209,10 @@ static void *ym2610b_start(int sndindex, int clock, const void *config)
/* stream system initialize */
info->stream = stream_create(0,2,rate,info,ym2610b_stream_update);
/* setup adpcm buffers */
pcmbufa = (void *)(memory_region(info->intf->pcmroma));
pcmsizea = memory_region_length(info->intf->pcmroma);
pcmbufb = (void *)(memory_region(info->intf->pcmromb));
pcmsizeb = memory_region_length(info->intf->pcmromb);
pcmbufa = (void *)(memory_region(Machine, info->intf->pcmroma));
pcmsizea = memory_region_length(Machine, info->intf->pcmroma);
pcmbufb = (void *)(memory_region(Machine, info->intf->pcmromb));
pcmsizeb = memory_region_length(Machine, info->intf->pcmromb);
/**** initialize YM2610 ****/
info->chip = YM2610Init(info,sndindex,clock,rate,

View File

@ -462,8 +462,8 @@ static void *y8950_start(int sndindex, int clock, const void *config)
/* ADPCM ROM data */
Y8950SetDeltaTMemory(info->chip,
(void *)(memory_region(info->intf->rom_region)),
memory_region_length(info->intf->rom_region) );
(void *)(memory_region(Machine, info->intf->rom_region)),
memory_region_length(Machine, info->intf->rom_region) );
info->stream = stream_create(0,1,rate,info,y8950_stream_update);

View File

@ -13,6 +13,7 @@
#include <math.h>
#include "sndintrf.h"
#include "deprecat.h"
#include "streams.h"
#include "tms5110.h"
#include "5110intf.h"
@ -37,7 +38,7 @@ static void tms5110_update(void *param, stream_sample_t **inputs, stream_sample_
static int speech_rom_read_bit(void)
{
struct tms5110_info *info = sndti_token(SOUND_TMS5110, 0);
const UINT8 *table = memory_region(info->intf->rom_region);
const UINT8 *table = memory_region(Machine, info->intf->rom_region);
int r;

View File

@ -538,9 +538,9 @@ static void AICA_Init(struct _AICA *AICA, const struct AICAinterface *intf, int
if (intf->region)
{
AICA->AICARAM = memory_region(intf->region);
AICA->AICARAM = memory_region(Machine, intf->region);
AICA->AICARAM += intf->roffset;
AICA->AICARAM_LENGTH = memory_region_length(intf->region);
AICA->AICARAM_LENGTH = memory_region_length(Machine, intf->region);
AICA->RAM_MASK = AICA->AICARAM_LENGTH-1;
AICA->RAM_MASK16 = AICA->RAM_MASK & 0x7ffffe;
AICA->DSP.AICARAM = (UINT16 *)AICA->AICARAM;

View File

@ -14,6 +14,7 @@
#include <math.h>
#include "sndintrf.h"
#include "deprecat.h"
#include "streams.h"
#include "bsmt2000.h"
@ -132,8 +133,8 @@ static void *bsmt2000_start(int sndindex, int clock, const void *config)
chip->clock = clock;
/* initialize the regions */
chip->region_base = (INT8 *)memory_region(intf->region);
chip->total_banks = memory_region_length(intf->region) / 0x10000;
chip->region_base = (INT8 *)memory_region(Machine, intf->region);
chip->total_banks = memory_region_length(Machine, intf->region) / 0x10000;
/* register chip-wide data for save states */
state_save_register_item("bsmt2000", sndindex * 16, chip->last_register);

View File

@ -45,6 +45,7 @@ Unmapped registers:
#include <math.h>
#include "sndintrf.h"
#include "deprecat.h"
#include "streams.h"
#include "c140.h"
@ -469,7 +470,7 @@ static void *c140_start(int sndindex, int clock, const void *config)
info->stream = stream_create(0,2,info->sample_rate,info,update_stereo);
if (intf->region)
info->pRom=memory_region(intf->region);
info->pRom=memory_region(Machine, intf->region);
/* make decompress pcm table */ //2000.06.26 CAB
{

View File

@ -15,6 +15,7 @@
#include <math.h>
#include "sndintrf.h"
#include "deprecat.h"
#include "streams.h"
#include "c352.h"
@ -127,7 +128,7 @@ static void c352_mix_one_channel(struct c352_info *info, unsigned long ch, long
noisecnt = info->c352_ch[ch].noisecnt;
noisebuf = info->c352_ch[ch].noisebuf;
len = (UINT32)memory_region_length(info->c352_region);
len = (UINT32)memory_region_length(Machine, info->c352_region);
for(i = 0 ; (i < sample_count) && (flag & C352_FLG_BUSY) ; i++)
{
offset += delta;
@ -553,7 +554,7 @@ static void *c352_start(int sndindex, int clock, const void *config)
intf = config;
info->c352_rom_samples = memory_region(intf->region);
info->c352_rom_samples = memory_region(Machine, intf->region);
info->c352_region = intf->region;
info->sample_rate_base = clock / 192;

View File

@ -842,10 +842,10 @@ static void *es5506_start_common(sound_type sndtype, int sndindex, int clock, co
chip->stream = stream_create(0, 2, clock / (16*32), chip, es5506_update);
/* initialize the regions */
chip->region_base[0] = intf->region0 ? (UINT16 *)memory_region(intf->region0) : NULL;
chip->region_base[1] = intf->region1 ? (UINT16 *)memory_region(intf->region1) : NULL;
chip->region_base[2] = intf->region2 ? (UINT16 *)memory_region(intf->region2) : NULL;
chip->region_base[3] = intf->region3 ? (UINT16 *)memory_region(intf->region3) : NULL;
chip->region_base[0] = intf->region0 ? (UINT16 *)memory_region(Machine, intf->region0) : NULL;
chip->region_base[1] = intf->region1 ? (UINT16 *)memory_region(Machine, intf->region1) : NULL;
chip->region_base[2] = intf->region2 ? (UINT16 *)memory_region(Machine, intf->region2) : NULL;
chip->region_base[3] = intf->region3 ? (UINT16 *)memory_region(Machine, intf->region3) : NULL;
/* initialize the rest of the structure */
chip->master_clock = clock;

View File

@ -15,6 +15,7 @@
#include <math.h>
#include "sndintrf.h"
#include "deprecat.h"
#include "streams.h"
#include "es8712.h"
@ -232,7 +233,7 @@ static void *es8712_start(int sndindex, int clock, const void *config)
chip->repeat = 0;
chip->bank_offset = 0;
chip->region_base = memory_region(intf->region);
chip->region_base = memory_region(Machine, intf->region);
/* generate the name and create the stream */
chip->stream = stream_create(0, 1, clock, chip, es8712_update);

View File

@ -35,6 +35,7 @@ Registers per channel:
#include "sndintrf.h"
#include "cpuintrf.h"
#include "deprecat.h"
#include "streams.h"
#include "gaelco.h"
#include "wavwrite.h"
@ -261,7 +262,7 @@ static void *gaelcosnd_start(sound_type sndtype, int sndindex, int clock, const
info->banks[j] = intf->banks[j];
}
info->stream = stream_create(0, 2, 8000, info, gaelco_update);
info->snd_data = (UINT8 *)memory_region(intf->region);
info->snd_data = (UINT8 *)memory_region(Machine, intf->region);
/* init volume table */
for (vol = 0; vol < VOLUME_LEVELS; vol++){

View File

@ -458,7 +458,7 @@ static void *ics2115_start(int sndindex, int clock, const void *config)
chip->intf = config;
chip->index = sndindex;
chip->rom = memory_region(chip->intf->region);
chip->rom = memory_region(Machine, chip->intf->region);
chip->timer[0].timer = timer_alloc(timer_cb_0, chip);
chip->timer[1].timer = timer_alloc(timer_cb_1, chip);
chip->ulaw = auto_malloc(256*sizeof(INT16));

View File

@ -27,6 +27,7 @@ Revisions:
*********************************************************/
#include <math.h>
#include "sndintrf.h"
#include "deprecat.h"
#include "streams.h"
#include "iremga20.h"
@ -236,8 +237,8 @@ static void *iremga20_start(int sndindex, int clock, const void *config)
/* Initialize our chip structure */
chip->intf = config;
chip->rom = memory_region(chip->intf->region);
chip->rom_size = memory_region_length(chip->intf->region);
chip->rom = memory_region(Machine, chip->intf->region);
chip->rom_size = memory_region_length(Machine, chip->intf->region);
iremga20_reset(chip);

View File

@ -26,6 +26,7 @@
***************************************************************************/
#include "sndintrf.h"
#include "deprecat.h"
#include "streams.h"
#include "k005289.h"
@ -172,7 +173,7 @@ static void *k005289_start(int sndindex, int clock, const void *config)
if (make_mixer_table(info, 2))
return NULL;
info->sound_prom = memory_region(intf->region);
info->sound_prom = memory_region(Machine, intf->region);
/* reset all the voices */
voice[0].frequency = 0;

View File

@ -24,6 +24,7 @@ added external port callback, and functions to set the volume of the channels
#include "sndintrf.h"
#include "deprecat.h"
#include "streams.h"
#include "k007232.h"
#include <math.h>
@ -305,9 +306,9 @@ static void *k007232_start(int sndindex, int clock, const void *config)
/* Set up the chips */
info->pcmbuf[0] = (unsigned char *)memory_region(info->intf->bank);
info->pcmbuf[1] = (unsigned char *)memory_region(info->intf->bank);
info->pcmlimit = (unsigned int)memory_region_length(info->intf->bank);
info->pcmbuf[0] = (unsigned char *)memory_region(Machine, info->intf->bank);
info->pcmbuf[1] = (unsigned char *)memory_region(Machine, info->intf->bank);
info->pcmlimit = (unsigned int)memory_region_length(Machine, info->intf->bank);
info->clock = clock;

View File

@ -5,6 +5,7 @@
*********************************************************/
#include "sndintrf.h"
#include "deprecat.h"
#include "streams.h"
#include "cpuintrf.h"
#include "k053260.h"
@ -206,8 +207,8 @@ static void *k053260_start(int sndindex, int clock, const void *config)
ic->intf = config;
ic->mode = 0;
ic->rom = memory_region(ic->intf->region);
ic->rom_size = memory_region_length(ic->intf->region) - 1;
ic->rom = memory_region(Machine, ic->intf->region);
ic->rom_size = memory_region_length(Machine, ic->intf->region) - 1;
K053260_reset( ic );

View File

@ -447,8 +447,8 @@ static void K054539_init_chip(struct k054539_info *info, int clock, int sndindex
info->cur_ptr = 0;
memset(info->ram, 0, 0x4000*2+clock/50*2);
info->rom = memory_region(info->intf->region);
info->rom_size = memory_region_length(info->intf->region);
info->rom = memory_region(Machine, info->intf->region);
info->rom_size = memory_region_length(Machine, info->intf->region);
info->rom_mask = 0xffffffffU;
for(i=0; i<32; i++)
if((1U<<i) >= info->rom_size) {

View File

@ -496,7 +496,7 @@ static void *multipcm_start(int sndindex, int clock, const void *config)
ptChip=(struct _MultiPCM *)auto_malloc(sizeof(struct _MultiPCM));
ptChip->ROM=(INT8 *)memory_region(intf->region);
ptChip->ROM=(INT8 *)memory_region(Machine, intf->region);
ptChip->Rate=(float) clock / MULTIPCM_CLOCKDIV;
ptChip->stream = stream_create(0, 2, ptChip->Rate, ptChip, MultiPCM_update);

View File

@ -14,6 +14,7 @@ silence compression: '00 nn' must be replaced by nn+1 times '80'.
***************************************************************************/
#include "sndintrf.h"
#include "deprecat.h"
#include "streams.h"
#include "n63701x.h"
@ -108,7 +109,7 @@ static void *namco_63701x_start(int sndindex, int clock, const void *config)
memset(chip, 0, sizeof(*chip));
chip->intf = config;
chip->rom = memory_region(chip->intf->region);
chip->rom = memory_region(Machine, chip->intf->region);
chip->stream = stream_create(0, 2, clock/1000, chip, namco_63701x_update);

View File

@ -12,6 +12,7 @@
***************************************************************************/
#include "sndintrf.h"
#include "deprecat.h"
#include "streams.h"
#include "namco.h"
@ -133,7 +134,7 @@ static int build_decoded_waveform(struct namco_sound *chip, int region)
}
if (region != -1)
namco_wavedata = memory_region(region);
namco_wavedata = memory_region(Machine, region);
/* We need waveform data. It fails if region is not specified. */
if (namco_wavedata)

View File

@ -46,6 +46,7 @@ Jan 12, 2005. The 555 is probably an external playback frequency.
***************************************************************************/
#include "sndintrf.h"
#include "deprecat.h"
#include "streams.h"
#include "filter.h"
#include "namco52.h"
@ -138,8 +139,8 @@ static void *namco_52xx_start(int sndindex, int clock, const void *config)
memset(chip, 0, sizeof(*chip));
chip->intf = config;
chip->rom = memory_region(chip->intf->region);
chip->rom_len = memory_region_length(chip->intf->region);
chip->rom = memory_region(Machine, chip->intf->region);
chip->rom_len = memory_region_length(Machine, chip->intf->region);
if (chip->intf->play_rate == 0)
{

View File

@ -691,7 +691,7 @@ static void *nesapu_start(int sndindex, int clock, const void *config)
info->buffer_size+=info->samps_per_sync;
/* Initialize individual chips */
(info->APU.dpcm).cpu_mem=memory_region(intf->region);
(info->APU.dpcm).cpu_mem=memory_region(Machine, intf->region);
info->stream = stream_create(0, 1, rate, info, NESPSG_update_sound);

View File

@ -29,6 +29,7 @@
#include "streams.h"
#include "cpuintrf.h"
#include "nile.h"
#include "deprecat.h"
#define NILE_VOICES 8
@ -221,7 +222,7 @@ static void *nile_start(int sndindex, int clock, const void *config)
info = auto_malloc(sizeof(*info));
memset(info, 0, sizeof(*info));
info->sound_ram = (UINT8 *)memory_region(intf->region);
info->sound_ram = (UINT8 *)memory_region(Machine, intf->region);
info->stream = stream_create(0, 2, 44100, info, nile_update);

View File

@ -24,6 +24,7 @@
#include <math.h>
#include "sndintrf.h"
#include "deprecat.h"
#include "streams.h"
#include "okim6295.h"
@ -334,7 +335,7 @@ static void *okim6295_start(int sndindex, int clock, const void *config)
info->command = -1;
info->bank_offset = 0;
info->region_base = memory_region(intf->region);
info->region_base = memory_region(Machine, intf->region);
info->master_clock = clock;

View File

@ -33,6 +33,7 @@
#include <math.h>
#include "sndintrf.h"
#include "deprecat.h"
#include "streams.h"
#include "qsound.h"
@ -105,8 +106,8 @@ static void *qsound_start(int sndindex, int clock, const void *config)
chip->intf = config;
chip->sample_rom = (QSOUND_SRC_SAMPLE *)memory_region(chip->intf->region);
chip->sample_rom_length = memory_region_length(chip->intf->region);
chip->sample_rom = (QSOUND_SRC_SAMPLE *)memory_region(Machine, chip->intf->region);
chip->sample_rom_length = memory_region_length(Machine, chip->intf->region);
memset(chip->channel, 0, sizeof(chip->channel));

View File

@ -236,8 +236,8 @@ static void rf5c400_init_chip(struct rf5c400_info *info, int sndindex, int clock
{
int i;
info->rom = (INT16*)memory_region(info->intf->region);
info->rom_length = memory_region_length(info->intf->region) / 2;
info->rom = (INT16*)memory_region(Machine, info->intf->region);
info->rom_length = memory_region_length(Machine, info->intf->region) / 2;
// init volume table
{

View File

@ -465,7 +465,7 @@ static void *s14001a_start(int sndindex, int clock, const void *config)
intf = config;
chip->SpeechRom = memory_region(intf->region);
chip->SpeechRom = memory_region(Machine, intf->region);
chip->stream = stream_create(0, 1, clock ? clock : Machine->sample_rate, chip, s14001a_pcm_update);

View File

@ -530,8 +530,8 @@ static void SCSP_Init(struct _SCSP *SCSP, const struct SCSPinterface *intf, int
if (intf->region)
{
SCSP->SCSPRAM = memory_region(intf->region);
SCSP->SCSPRAM_LENGTH = memory_region_length(intf->region);
SCSP->SCSPRAM = memory_region(Machine, intf->region);
SCSP->SCSPRAM_LENGTH = memory_region_length(Machine, intf->region);
SCSP->DSP.SCSPRAM = (UINT16 *)SCSP->SCSPRAM;
SCSP->DSP.SCSPRAM_LENGTH = SCSP->SCSPRAM_LENGTH/2;
SCSP->SCSPRAM += intf->roffset;

View File

@ -3,6 +3,7 @@
/*********************************************************/
#include "sndintrf.h"
#include "deprecat.h"
#include "streams.h"
#include "segapcm.h"
@ -85,7 +86,7 @@ static void *segapcm_start(int sndindex, int clock, const void *config)
spcm = auto_malloc(sizeof(*spcm));
memset(spcm, 0, sizeof(*spcm));
spcm->rom = (const UINT8 *)memory_region(intf->region);
spcm->rom = (const UINT8 *)memory_region(Machine, intf->region);
spcm->ram = auto_malloc(0x800);
memset(spcm->ram, 0xff, 0x800);
@ -95,7 +96,7 @@ static void *segapcm_start(int sndindex, int clock, const void *config)
if(!mask)
mask = BANK_MASK7>>16;
len = memory_region_length(intf->region);
len = memory_region_length(Machine, intf->region);
for(rom_mask = 1; rom_mask < len; rom_mask *= 2);
rom_mask--;

View File

@ -33,6 +33,7 @@
#include <math.h>
#include "sndintrf.h"
#include "deprecat.h"
#include "streams.h"
#include "cpuintrf.h"
#include "sp0256.h"
@ -1205,7 +1206,7 @@ static void *sp0256_start(int sndindex, int clock, const void *config)
/* -------------------------------------------------------------------- */
/* Setup the ROM. */
/* -------------------------------------------------------------------- */
sp->rom = memory_region(intf->memory_region);
sp->rom = memory_region(Machine, intf->memory_region);
sp0256_bitrevbuff(sp->rom, 0, 0xffff);
return sp;

View File

@ -642,7 +642,7 @@ static void *upd7759_start(int sndindex, int clock, const void *config)
/* compute the ROM base or allocate a timer */
if (intf->region != 0)
chip->rom = chip->rombase = memory_region(intf->region);
chip->rom = chip->rombase = memory_region(Machine, intf->region);
else
chip->timer = timer_alloc(upd7759_slave_update, chip);

View File

@ -650,10 +650,10 @@ static void *vlm5030_start(int sndindex, int clock, const void *config)
VLM5030_reset(chip);
chip->phase = PH_IDLE;
chip->rom = memory_region(chip->intf->memory_region);
chip->rom = memory_region(Machine, chip->intf->memory_region);
/* memory size */
if( chip->intf->memory_size == 0)
chip->address_mask = memory_region_length(chip->intf->memory_region)-1;
chip->address_mask = memory_region_length(Machine, chip->intf->memory_region)-1;
else
chip->address_mask = chip->intf->memory_size-1;

View File

@ -53,6 +53,7 @@ Hardcoded Values:
***************************************************************************/
#include "sndintrf.h"
#include "deprecat.h"
#include "cpuintrf.h"
#include "streams.h"
#include "x1_010.h"
@ -113,7 +114,7 @@ static void seta_update( void *param, stream_sample_t **inputs, stream_sample_t
register INT8 *start, *end, data;
register UINT8 *env;
register UINT32 smp_offs, smp_step, env_offs, env_step, delta;
UINT8 *snd1 = memory_region(REGION_SOUND1);
UINT8 *snd1 = memory_region(Machine, REGION_SOUND1);
// mixer buffer zero clear
memset( buffer[0], 0, length*sizeof(*buffer[0]) );

View File

@ -1755,7 +1755,7 @@ static void *ymf271_start(int sndindex, int clock, const void *config)
intf = config;
ymf271_init(chip, memory_region(intf->region), intf->irq_callback, intf->ext_read, intf->ext_write);
ymf271_init(chip, memory_region(Machine, intf->region), intf->irq_callback, intf->ext_read, intf->ext_write);
chip->stream = stream_create(0, 2, clock/384, chip, ymf271_update);
for (i = 0; i < 256; i++)

View File

@ -59,6 +59,7 @@
#include <math.h>
#include "sndintrf.h"
#include "deprecat.h"
#include "streams.h"
#include "cpuintrf.h"
#include "ymf278b.h"
@ -678,7 +679,7 @@ static void *ymf278b_start(int sndindex, int clock, const void *config)
intf = config;
ymf278b_init(chip, memory_region(intf->region), intf->irq_callback, clock);
ymf278b_init(chip, memory_region(Machine, intf->region), intf->irq_callback, clock);
chip->stream = stream_create(0, 2, clock/768, chip, ymf278b_pcm_update);
// Volume table, 1 = -0.375dB, 8 = -3dB, 256 = -96dB

View File

@ -643,7 +643,7 @@ static void *ymz280b_start(int sndindex, int clock, const void *config)
/* initialize the rest of the structure */
chip->master_clock = (double)clock / 384.0;
chip->region_base = memory_region(intf->region);
chip->region_base = memory_region(Machine, intf->region);
chip->irq_callback = intf->irq_callback;
/* create the stream */

View File

@ -1235,7 +1235,7 @@ static UINT32 handler_ingame(running_machine *machine, UINT32 state)
/* let the cheat engine display its stuff */
if (options_get_bool(mame_options(), OPTION_CHEAT))
cheat_display_watches();
cheat_display_watches(machine);
/* display any popup messages */
if (osd_ticks() < popup_text_end)

View File

@ -339,7 +339,7 @@ void video_init(running_machine *machine)
/* call the PALETTE_INIT function */
if (machine->config->init_palette != NULL)
(*machine->config->init_palette)(machine, memory_region(REGION_PROMS));
(*machine->config->init_palette)(machine, memory_region(machine, REGION_PROMS));
/* actually decode the graphics */
if (machine->config->gfxdecodeinfo != NULL)
@ -477,7 +477,7 @@ static void allocate_graphics(running_machine *machine, const gfx_decode_entry *
/* loop over all elements */
for (i = 0; i < MAX_GFX_ELEMENTS && gfxdecodeinfo[i].memory_region != -1; i++)
{
int region_length = 8 * memory_region_length(gfxdecodeinfo[i].memory_region);
int region_length = 8 * memory_region_length(machine, gfxdecodeinfo[i].memory_region);
int xscale = (gfxdecodeinfo[i].xscale == 0) ? 1 : gfxdecodeinfo[i].xscale;
int yscale = (gfxdecodeinfo[i].yscale == 0) ? 1 : gfxdecodeinfo[i].yscale;
UINT32 *extpoffs, extxoffs[MAX_ABS_GFX_SIZE], extyoffs[MAX_ABS_GFX_SIZE];
@ -611,7 +611,7 @@ static void decode_graphics(running_machine *machine, const gfx_decode_entry *gf
/* if we have a valid region, decode it now */
if (gfxdecodeinfo[i].memory_region > REGION_INVALID)
{
UINT8 *region_base = memory_region(gfxdecodeinfo[i].memory_region);
UINT8 *region_base = memory_region(machine, gfxdecodeinfo[i].memory_region);
gfx_element *gfx = machine->gfx[i];
int j;

View File

@ -116,7 +116,7 @@ void atarijsa_init(running_machine *machine, const char *testport, int testmask)
test_mask = testmask;
/* predetermine the bank base */
rgn = memory_region(REGION_CPU1+cpu_num);
rgn = memory_region(machine, REGION_CPU1+cpu_num);
bank_base = &rgn[0x03000];
bank_source_data = &rgn[0x10000];
@ -152,9 +152,9 @@ void atarijsa_init(running_machine *machine, const char *testport, int testmask)
}
void atarijsa3_init_adpcm(int region)
void atarijsa3_init_adpcm(running_machine *machine, int region)
{
UINT8 *base = memory_region(region);
UINT8 *base = memory_region(machine, region);
/* expand the ADPCM data to avoid lots of memcpy's during gameplay */
/* the upper 128k is fixed, the lower 128k is bankswitched */

View File

@ -6,7 +6,7 @@
void atarijsa_init(running_machine *machine, const char *testport, int testmask);
void atarijsa3_init_adpcm(int region);
void atarijsa3_init_adpcm(running_machine *machine, int region);
void atarijsa_reset(void);

View File

@ -158,8 +158,8 @@ void cage_init(running_machine *machine, int boot_region, offs_t speedup)
cage_irqhandler = NULL;
memory_set_bankptr(10, memory_region(boot_region));
memory_set_bankptr(11, memory_region(boot_region + 1));
memory_set_bankptr(10, memory_region(machine, boot_region));
memory_set_bankptr(11, memory_region(machine, boot_region + 1));
cage_cpu = mame_find_cpu_index(machine, "cage");
cage_cpu_clock_period = ATTOTIME_IN_HZ(cpunum_get_clock(cage_cpu));

View File

@ -1,4 +1,5 @@
#include "driver.h"
#include "deprecat.h"
#include "sound/ay8910.h"
#include "sound/samples.h"
#include "includes/cclimber.h"
@ -16,16 +17,16 @@ static INT16 *samplebuf; /* buffer to decode samples at run time */
static void cclimber_sh_start(void)
{
samplebuf = 0;
if (memory_region(REGION_SOUND1))
samplebuf = auto_malloc(sizeof(*samplebuf)*2*memory_region_length(REGION_SOUND1));
if (memory_region(Machine, REGION_SOUND1))
samplebuf = auto_malloc(sizeof(*samplebuf)*2*memory_region_length(Machine, REGION_SOUND1));
}
static void cclimber_play_sample(int start,int freq,int volume)
{
int len;
int romlen = memory_region_length(REGION_SOUND1);
const UINT8 *rom = memory_region(REGION_SOUND1);
int romlen = memory_region_length(Machine, REGION_SOUND1);
const UINT8 *rom = memory_region(Machine, REGION_SOUND1);
if (!rom) return;

View File

@ -1603,7 +1603,7 @@ static MACHINE_RESET( qb3_sound )
/* this patch prevents the sound ROM from eating itself when command $0A is sent */
/* on a cube rotate */
memory_region(REGION_CPU2)[0x11dc] = 0x09;
memory_region(machine, REGION_CPU2)[0x11dc] = 0x09;
}

View File

@ -175,7 +175,7 @@ DISCRETE_SOUND_END
WRITE8_HANDLER( circus_clown_z_w )
{
clown_z = (data & 0x0f);
*(memory_region(REGION_CPU1)+0x8000)=data; logerror("Z:%02x\n",data); //DEBUG
*(memory_region(machine, REGION_CPU1)+0x8000)=data; logerror("Z:%02x\n",data); //DEBUG
/* Bits 4-6 enable/disable trigger different events */
switch (circus_game)

View File

@ -4,6 +4,7 @@
***************************************************************************/
#include "driver.h"
#include "deprecat.h"
#include "streams.h"
#include "includes/cps3.h"
@ -27,7 +28,7 @@ static struct
static void cps3_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
{
int i;
INT8 *base = (INT8*)memory_region(REGION_USER5);
INT8 *base = (INT8*)memory_region(Machine, REGION_USER5);
/* Clear the buffers */
memset(buffer[0], 0, length*sizeof(*buffer[0]));

View File

@ -20,10 +20,10 @@ static void update_sound_68k_interrupts(running_machine *machine);
void cyberbal_sound_reset(void)
void cyberbal_sound_reset(running_machine *machine)
{
/* reset the sound system */
bank_base = &memory_region(REGION_CPU2)[0x10000];
bank_base = &memory_region(machine, REGION_CPU2)[0x10000];
memory_set_bankptr(8, &bank_base[0x0000]);
fast_68k_int = io_68k_int = 0;
sound_data_from_68k = sound_data_from_6502 = 0;

View File

@ -910,8 +910,8 @@ void dcs_init(void)
dcs.channels = 1;
/* configure boot and sound ROMs */
dcs.bootrom = (UINT16 *)memory_region(REGION_SOUND1);
dcs.bootrom_words = memory_region_length(REGION_SOUND1) / 2;
dcs.bootrom = (UINT16 *)memory_region(Machine, REGION_SOUND1);
dcs.bootrom_words = memory_region_length(Machine, REGION_SOUND1) / 2;
dcs.sounddata = dcs.bootrom;
dcs.sounddata_words = dcs.bootrom_words;
@ -950,8 +950,8 @@ void dcs2_init(running_machine *machine, int dram_in_mb, offs_t polling_offset)
dcs.channels = 2;
/* always boot from the base of REGION_SOUND1 */
dcs.bootrom = (UINT16 *)memory_region(REGION_SOUND1);
dcs.bootrom_words = memory_region_length(REGION_SOUND1) / 2;
dcs.bootrom = (UINT16 *)memory_region(machine, REGION_SOUND1);
dcs.bootrom_words = memory_region_length(machine, REGION_SOUND1) / 2;
/* supports both RAM and ROM variants */
if (dram_in_mb != 0)

View File

@ -1058,7 +1058,7 @@ static READ8_HANDLER( dkong_voice_status_r )
static READ8_HANDLER( dkong_sh_tune_r )
{
dkong_state *state = machine->driver_data;
UINT8 *SND = memory_region(REGION_CPU2);
UINT8 *SND = memory_region(machine, REGION_CPU2);
if ( state->page & 0x40 )
{

View File

@ -8,6 +8,7 @@
***************************************************************************/
#include "driver.h"
#include "deprecat.h"
#include "streams.h"
#include "exidy440.h"
@ -163,7 +164,7 @@ static void *exidy440_sh_start(int clock, const struct CustomSound_interface *co
stream = stream_create(0, 2, clock, NULL, channel_update);
/* allocate the sample cache */
length = memory_region_length(REGION_SOUND1) * 16 + MAX_CACHE_ENTRIES * sizeof(sound_cache_entry);
length = memory_region_length(Machine, REGION_SOUND1) * 16 + MAX_CACHE_ENTRIES * sizeof(sound_cache_entry);
sound_cache = auto_malloc(length);
/* determine the hard end of the cache and reset */
@ -652,7 +653,7 @@ static INT16 *find_or_add_to_sound_cache(int address, int length, int bits, int
if (current->address == address && current->length == length && current->bits == bits && current->frequency == frequency)
return current->data;
return add_to_sound_cache(&memory_region(REGION_SOUND1)[address], address, length, bits, frequency);
return add_to_sound_cache(&memory_region(Machine, REGION_SOUND1)[address], address, length, bits, frequency);
}

View File

@ -5,6 +5,7 @@ Fighting Basketball PCM unsigned 8 bit mono samples
*/
#include "driver.h"
#include "deprecat.h"
#include "sound/samples.h"
static INT16 *samplebuf;
@ -17,8 +18,8 @@ WRITE8_HANDLER( fghtbskt_samples_w )
void fghtbskt_sh_start(void)
{
int i, len = memory_region_length(REGION_SOUND1);
UINT8 *ROM = memory_region(REGION_SOUND1);
int i, len = memory_region_length(Machine, REGION_SOUND1);
UINT8 *ROM = memory_region(Machine, REGION_SOUND1);
samplebuf = auto_malloc(len * 2);

View File

@ -5,6 +5,7 @@
***************************************************************************/
#include "driver.h"
#include "deprecat.h"
#include "streams.h"
#include "sound/custom.h"
@ -172,8 +173,8 @@ void * flower_sh_start(int clock, const struct CustomSound_interface *config)
num_voices = 8;
last_channel = channel_list + num_voices;
sound_rom1 = memory_region(REGION_SOUND1);
sound_rom2 = memory_region(REGION_SOUND2);
sound_rom1 = memory_region(Machine, REGION_SOUND1);
sound_rom2 = memory_region(Machine, REGION_SOUND2);
/* start with sound enabled, many games don't have a sound enable register */
sound_enable = 1;

View File

@ -7,6 +7,7 @@
***************************************************************************/
#include "driver.h"
#include "deprecat.h"
#include "streams.h"
#include "sound/custom.h"
@ -182,7 +183,7 @@ void *gomoku_sh_start(int clock, const struct CustomSound_interface *config)
num_voices = MAX_VOICES;
last_channel = channel_list + num_voices;
sound_rom = memory_region(REGION_SOUND1);
sound_rom = memory_region(Machine, REGION_SOUND1);
/* start with sound enabled, many games don't have a sound enable register */
sound_enable = 1;

View File

@ -49,10 +49,10 @@ static UINT64 last_bio_cycles;
*
*************************************/
void hdsnd_init(void)
void hdsnd_init(running_machine *machine)
{
rombase = (UINT8 *)memory_region(REGION_SOUND1);
romsize = memory_region_length(REGION_SOUND1);
rombase = (UINT8 *)memory_region(machine, REGION_SOUND1);
romsize = memory_region_length(machine, REGION_SOUND1);
comram = (UINT16 *)auto_malloc(0x400);
last_bio_cycles = 0;
}

View File

@ -519,7 +519,7 @@ void *leland_80186_sh_start(int clock, const struct CustomSound_interface *confi
/* if we have a 2151, install an externally driven DAC stream */
if (has_ym2151)
{
ext_base = memory_region(REGION_SOUND1);
ext_base = memory_region(Machine, REGION_SOUND1);
extern_stream = stream_create(0, 1, OUTPUT_RATE, NULL, leland_80186_extern_update);
}

View File

@ -198,11 +198,11 @@ WRITE8_HANDLER( poundfor_sample_addr_w )
READ8_HANDLER( m72_sample_r )
{
return memory_region(REGION_SOUND1)[sample_addr];
return memory_region(machine, REGION_SOUND1)[sample_addr];
}
WRITE8_HANDLER( m72_sample_w )
{
DAC_signed_data_w(0,data);
sample_addr = (sample_addr + 1) & (memory_region_length(REGION_SOUND1) - 1);
sample_addr = (sample_addr + 1) & (memory_region_length(machine, REGION_SOUND1) - 1);
}

View File

@ -237,7 +237,7 @@ static SOUND_START( mario )
{
mario_state *state = machine->driver_data;
#if USE_8039
UINT8 *SND = memory_region(REGION_CPU2);
UINT8 *SND = memory_region(machine, REGION_CPU2);
SND[1] = 0x01;
#endif
@ -298,8 +298,8 @@ static READ8_HANDLER( mario_sh_ea_r )
static READ8_HANDLER( mario_sh_tune_r )
{
UINT8 *SND = memory_region(REGION_CPU2);
UINT16 mask = memory_region_length(REGION_CPU2)-1;
UINT8 *SND = memory_region(machine, REGION_CPU2);
UINT16 mask = memory_region_length(machine, REGION_CPU2)-1;
UINT8 p2 = I8035_P2_R(machine);
if ((p2 >> 7) & 1)

View File

@ -109,7 +109,7 @@ static void ssio_compute_ay8910_modulation(void);
*
*************************************/
void mcr_sound_init(UINT8 config)
void mcr_sound_init(running_machine *machine, UINT8 config)
{
int sound_cpu = 1;
int dac_index = 0;
@ -269,7 +269,7 @@ void mcr_sound_reset(void)
*/
static void ssio_compute_ay8910_modulation(void)
{
UINT8 *prom = memory_region(REGION_PROMS);
UINT8 *prom = memory_region(Machine, REGION_PROMS);
int volval;
/* loop over all possible values of the duty cycle */

View File

@ -12,7 +12,7 @@
/************ Generic MCR routines ***************/
void mcr_sound_init(UINT8 config);
void mcr_sound_init(running_machine *machine, UINT8 config);
void mcr_sound_reset(void);
WRITE8_HANDLER( ssio_data_w );

View File

@ -54,9 +54,9 @@ void namcoc7x_sound_write16(UINT16 command, UINT32 offset)
namcoc7x_mcuram[offset] = command;
}
void namcoc7x_on_driver_init(void)
void namcoc7x_on_driver_init(running_machine *machine)
{
UINT8 *pROM = (UINT8 *)memory_region(REGION_USER4);
UINT8 *pROM = (UINT8 *)memory_region(machine, REGION_USER4);
int cpunum;
// clear the first page of the data ROM
@ -66,8 +66,8 @@ void namcoc7x_on_driver_init(void)
// install speedup cheat
for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
if (Machine->config->cpu[cpunum].type == CPU_M37702)
memory_install_readwrite16_handler(Machine, cpunum, ADDRESS_SPACE_PROGRAM, 0x82, 0x83, 0, 0, speedup_r, speedup_w);
if (machine->config->cpu[cpunum].type == CPU_M37702)
memory_install_readwrite16_handler(machine, cpunum, ADDRESS_SPACE_PROGRAM, 0x82, 0x83, 0, 0, speedup_r, speedup_w);
}
void namcoc7x_set_host_ram(UINT32 *hostram)

View File

@ -20,7 +20,7 @@ ADDRESS_MAP_EXTERN(namcoc7x_mcu_io, 8);
INTERRUPT_GEN( namcoc7x_interrupt );
void namcoc7x_sound_write16(UINT16 command, UINT32 offset);
void namcoc7x_on_driver_init(void);
void namcoc7x_on_driver_init(running_machine *machine);
void namcoc7x_set_host_ram(UINT32 *hostram);
#define NAMCO_C7X_HARDWARE \

View File

@ -3,6 +3,7 @@
Sound handler
****************************************************************************/
#include "driver.h"
#include "deprecat.h"
#include "streams.h"
#include "sound/filter.h"
#include "rescap.h"
@ -69,7 +70,7 @@ static void engine_sound_update(void *param, stream_sample_t **inputs, stream_sa
/* determine the volume */
slot = (sample_msb >> 3) & 7;
volume = volume_table[slot];
base = &memory_region(REGION_SOUND2)[slot * 0x800];
base = &memory_region(Machine, REGION_SOUND2)[slot * 0x800];
/* fill in the sample */
while (length--)

View File

@ -11,6 +11,7 @@
#include "driver.h"
#include "deprecat.h"
#include "streams.h"
#include "sound/custom.h"
#include "sound/sn76477.h"
@ -114,11 +115,11 @@ const char *const fantasy_sample_names[] =
};
INLINE void validate_tone_channel(int channel)
INLINE void validate_tone_channel(running_machine *machine, int channel)
{
if (!tone_channels[channel].mute)
{
UINT8 *ROM = memory_region(REGION_SOUND1);
UINT8 *ROM = memory_region(machine, REGION_SOUND1);
UINT8 romdata = ROM[tone_channels[channel].base + tone_channels[channel].offset];
if (romdata != 0xff)
@ -134,7 +135,7 @@ static void rockola_tone_update(void *param, stream_sample_t **inputs, stream_sa
int i;
for (i = 0; i < CHANNELS; i++)
validate_tone_channel(i);
validate_tone_channel(Machine, i);
while (len-- > 0)
{
@ -169,7 +170,7 @@ static void rockola_tone_update(void *param, stream_sample_t **inputs, stream_sa
tone_channels[i].offset++;
tone_channels[i].offset &= tone_channels[i].mask;
validate_tone_channel(i);
validate_tone_channel(Machine, i);
}
if (tone_channels[0].offset == 0 && Sound0StopOnRollover)

View File

@ -332,7 +332,7 @@ static TIMER_CALLBACK( ad2083_step )
static int ad2083_speech_rom_read_bit(void)
{
UINT8 *ROM = memory_region(REGION_SOUND1);
UINT8 *ROM = memory_region(Machine, REGION_SOUND1);
int bit;
speech_rom_address %= 4096;

View File

@ -8,6 +8,7 @@
***************************************************************************/
#include "driver.h"
#include "deprecat.h"
#include "streams.h"
#include "cpu/i8039/i8039.h"
#include "segag80r.h"
@ -507,9 +508,9 @@ WRITE8_HANDLER( sega005_sound_a_w )
}
INLINE void sega005_update_sound_data(void)
INLINE void sega005_update_sound_data(running_machine *machine)
{
UINT8 newval = memory_region(REGION_SOUND1)[sound_addr];
UINT8 newval = memory_region(machine, REGION_SOUND1)[sound_addr];
UINT8 diff = newval ^ sound_data;
//mame_printf_debug(" [%03X] = %02X\n", sound_addr, newval);
@ -564,7 +565,7 @@ WRITE8_HANDLER( sega005_sound_b_w )
sound_addr = (sound_addr & 0x780) | ((sound_addr + 1) & 0x07f);
/* update the sound data */
sega005_update_sound_data();
sega005_update_sound_data(machine);
}
@ -585,7 +586,7 @@ static void *sega005_custom_start(int clock, const struct CustomSound_interface
/* set the initial sound data */
sound_data = 0x00;
sega005_update_sound_data();
sega005_update_sound_data(Machine);
return auto_malloc(1);
}
@ -593,7 +594,7 @@ static void *sega005_custom_start(int clock, const struct CustomSound_interface
static void sega005_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
{
const UINT8 *sound_prom = memory_region(REGION_PROMS);
const UINT8 *sound_prom = memory_region(Machine, REGION_PROMS);
int i;
/* no implementation yet */
@ -620,7 +621,7 @@ static TIMER_CALLBACK( sega005_auto_timer )
if ((sound_state[1] & 0x20) && !(sound_state[1] & 0x10))
{
sound_addr = (sound_addr & 0x780) | ((sound_addr + 1) & 0x07f);
sega005_update_sound_data();
sega005_update_sound_data(machine);
}
}
@ -888,7 +889,7 @@ static WRITE8_HANDLER( monsterb_sound_a_w )
tms36xx_note_w(0, 0, data & 15);
/* Top four data lines address an 82S123 ROM that enables/disables voices */
enable_val = memory_region(REGION_SOUND2)[(data & 0xF0) >> 4];
enable_val = memory_region(machine, REGION_SOUND2)[(data & 0xF0) >> 4];
tms3617_enable_w(0, enable_val >> 2);
}
@ -956,7 +957,7 @@ static WRITE8_HANDLER( n7751_rom_offset_w )
static WRITE8_HANDLER( n7751_rom_select_w )
{
/* P7 - ROM selects */
int numroms = memory_region_length(REGION_SOUND1) / 0x1000;
int numroms = memory_region_length(machine, REGION_SOUND1) / 0x1000;
sound_addr &= 0xfff;
if (!(data & 0x01) && numroms >= 1) sound_addr |= 0x0000;
if (!(data & 0x02) && numroms >= 2) sound_addr |= 0x1000;
@ -968,7 +969,7 @@ static WRITE8_HANDLER( n7751_rom_select_w )
static READ8_HANDLER( n7751_rom_r )
{
/* read from BUS */
return memory_region(REGION_SOUND1)[sound_addr];
return memory_region(machine, REGION_SOUND1)[sound_addr];
}

View File

@ -171,7 +171,7 @@ static READ8_HANDLER( speech_p1_r )
static READ8_HANDLER( speech_rom_r )
{
return memory_region(REGION_SOUND1)[0x100 * (speech_p2 & 0x3f) + offset];
return memory_region(machine, REGION_SOUND1)[0x100 * (speech_p2 & 0x3f) + offset];
}
static WRITE8_HANDLER( speech_p1_w )

View File

@ -33,6 +33,7 @@
***************************************************************************/
#include "driver.h"
#include "deprecat.h"
#include "streams.h"
#include "audio/seibu.h"
#include "sound/3812intf.h"
@ -102,10 +103,10 @@ static UINT8 decrypt_opcode(int a,int src)
return src;
}
void seibu_sound_decrypt(int cpu_region,int length)
void seibu_sound_decrypt(running_machine *machine,int cpu_region,int length)
{
UINT8 *decrypt = auto_malloc(length);
UINT8 *rom = memory_region(cpu_region);
UINT8 *rom = memory_region(machine, cpu_region);
int i;
memory_set_decrypted_region(cpu_region - REGION_CPU1, 0x0000, (length < 0x10000) ? (length - 1) : 0x1fff, decrypt);
@ -178,7 +179,7 @@ static void *seibu_adpcm_start(int clock, const struct CustomSound_interface *co
state->allocated = 1;
state->playing = 0;
state->stream = stream_create(0, 1, clock, state, seibu_adpcm_callback);
state->base = memory_region(REGION_SOUND1);
state->base = memory_region(Machine, REGION_SOUND1);
reset_adpcm(&state->adpcm);
return state;
}
@ -195,10 +196,10 @@ static void seibu_adpcm_stop(void *token)
// simplify PCB layout/routing rather than intentional protection, but it
// still fits, especially since the Z80s for all these games are truly encrypted.
void seibu_adpcm_decrypt(int region)
void seibu_adpcm_decrypt(running_machine *machine, int region)
{
UINT8 *ROM = memory_region(region);
int len = memory_region_length(region);
UINT8 *ROM = memory_region(machine, region);
int len = memory_region_length(machine, region);
int i;
for (i = 0; i < len; i++)
@ -356,8 +357,8 @@ void seibu_ym2203_irqhandler(running_machine *machine, int linestate)
/* Use this if the sound cpu is cpu 1 */
MACHINE_RESET( seibu_sound_1 )
{
int romlength = memory_region_length(REGION_CPU2);
UINT8 *rom = memory_region(REGION_CPU2);
int romlength = memory_region_length(machine, REGION_CPU2);
UINT8 *rom = memory_region(machine, REGION_CPU2);
sound_cpu=1;
update_irq_lines(machine, VECTOR_INIT);
@ -368,8 +369,8 @@ MACHINE_RESET( seibu_sound_1 )
/* Use this if the sound cpu is cpu 2 */
MACHINE_RESET( seibu_sound_2 )
{
int romlength = memory_region_length(REGION_CPU3);
UINT8 *rom = memory_region(REGION_CPU3);
int romlength = memory_region_length(machine, REGION_CPU3);
UINT8 *rom = memory_region(machine, REGION_CPU3);
sound_cpu=2;
update_irq_lines(machine, VECTOR_INIT);

View File

@ -55,9 +55,9 @@ READ8_HANDLER( seibu_main_data_pending_r );
WRITE8_HANDLER( seibu_main_data_w );
MACHINE_RESET( seibu_sound_1 );
MACHINE_RESET( seibu_sound_2 );
void seibu_sound_decrypt(int cpu_region,int length);
void seibu_sound_decrypt(running_machine *machine,int cpu_region,int length);
void seibu_adpcm_decrypt(int region);
void seibu_adpcm_decrypt(running_machine *machine,int region);
WRITE8_HANDLER( seibu_adpcm_adr_1_w );
WRITE8_HANDLER( seibu_adpcm_ctl_1_w );
WRITE8_HANDLER( seibu_adpcm_adr_2_w );

View File

@ -27,6 +27,7 @@
#include <math.h>
#include "driver.h"
#include "deprecat.h"
#include "streams.h"
#include "includes/snes.h"
@ -1140,7 +1141,7 @@ void *snes_sh_start(int clock, const struct CustomSound_interface *config)
UINT8 ii;
/* put IPL image at the top of RAM */
memcpy(snes_ipl_region, memory_region(REGION_USER5), 64);
memcpy(snes_ipl_region, memory_region(Machine, REGION_USER5), 64);
/* default to ROM visible */
spc_ram[0xf1] = 0x80;
@ -1292,7 +1293,7 @@ WRITE8_HANDLER( spc_io_w )
{
if (data & 0x80)
{
memcpy(snes_ipl_region, memory_region(REGION_USER5), 64);
memcpy(snes_ipl_region, memory_region(machine, REGION_USER5), 64);
}
else
{

View File

@ -7,6 +7,7 @@
*/
#include "driver.h"
#include "deprecat.h"
#include "sound/samples.h"
static INT16 *samplebuf;
@ -35,8 +36,8 @@ WRITE8_HANDLER( suna8_samples_number_w )
void suna8_sh_start(void)
{
int i, len = memory_region_length(REGION_SOUND1);
UINT8 *ROM = memory_region(REGION_SOUND1);
int i, len = memory_region_length(Machine, REGION_SOUND1);
UINT8 *ROM = memory_region(Machine, REGION_SOUND1);
samplebuf = auto_malloc(len * sizeof(samplebuf[0]));

View File

@ -54,7 +54,7 @@ READ8_HANDLER( sys16_7751_audio_8255_r )
/* read from BUS */
READ8_HANDLER( sys16_7751_sh_rom_r )
{
UINT8 *sound_rom = memory_region(REGION_SOUND1);
UINT8 *sound_rom = memory_region(machine, REGION_SOUND1);
return sound_rom[rom_offset+rom_base];
}

View File

@ -36,7 +36,7 @@ WRITE16_HANDLER(f3_68000_share_w)
WRITE16_HANDLER( f3_es5505_bank_w )
{
UINT32 max_banks_this_game=(memory_region_length(REGION_SOUND1)/0x200000)-1;
UINT32 max_banks_this_game=(memory_region_length(machine, REGION_SOUND1)/0x200000)-1;
#if 0
{
@ -190,7 +190,7 @@ READ16_HANDLER(es5510_dsp_r)
WRITE16_HANDLER(es5510_dsp_w)
{
UINT8 *snd_mem = (UINT8 *)memory_region(REGION_SOUND1);
UINT8 *snd_mem = (UINT8 *)memory_region(machine, REGION_SOUND1);
// if (offset>4 && offset!=0x80 && offset!=0xa0 && offset!=0xc0 && offset!=0xe0)
// logerror("%06x: DSP write offset %04x %04x\n",activecpu_get_pc(),offset,data);
@ -245,10 +245,10 @@ ADDRESS_MAP_START( f3_sound_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xff0000, 0xffffff) AM_RAM AM_SHARE(1) // mirror
ADDRESS_MAP_END
void taito_f3_soundsystem_reset(void)
void taito_f3_soundsystem_reset(running_machine *machine)
{
/* Sound cpu program loads to 0xc00000 so we use a bank */
UINT16 *ROM = (UINT16 *)memory_region(REGION_CPU2);
UINT16 *ROM = (UINT16 *)memory_region(machine, REGION_CPU2);
memory_set_bankptr(1,&ROM[0x80000]);
memory_set_bankptr(2,&ROM[0x90000]);
memory_set_bankptr(3,&ROM[0xa0000]);

View File

@ -9,7 +9,7 @@ WRITE16_HANDLER(f3_volume_w);
WRITE16_HANDLER(f3_es5505_bank_w);
void f3_68681_reset(void);
void taito_f3_soundsystem_reset(void);
void taito_f3_soundsystem_reset(running_machine *machine);
#define TAITO_F3_SOUND_SYSTEM_CPU(freq) \
MDRV_CPU_ADD(M68000, freq) \

View File

@ -112,7 +112,7 @@ WRITE8_HANDLER( targ_audio_2_w )
{
if ((data & 0x01) && !(port_2_last & 0x01))
{
UINT8 *prom = memory_region(TARG_TONE_REGION);
UINT8 *prom = memory_region(machine, TARG_TONE_REGION);
tone_pointer = (tone_pointer + 1) & 0x0f;

View File

@ -119,7 +119,7 @@ READ8_HANDLER( hyprolyb_speech_r )
WRITE8_HANDLER( hyprolyb_ADPCM_data_w )
{
int cmd,start,end;
UINT8 *RAM = memory_region(REGION_CPU3);
UINT8 *RAM = memory_region(machine, REGION_CPU3);
/* simulate the operation of the 6802 */

View File

@ -273,7 +273,7 @@ void williams_cvsd_init(int pianum)
pia_config(pianum, &cvsd_pia_intf);
/* configure master CPU banks */
ROM = memory_region(REGION_CPU1 + sound_cpunum);
ROM = memory_region(Machine, REGION_CPU1 + sound_cpunum);
for (bank = 0; bank < 16; bank++)
{
/*
@ -305,7 +305,7 @@ void williams_narc_init(void)
soundalt_cpunum = mame_find_cpu_index(Machine, "narc2");
/* configure master CPU banks */
ROM = memory_region(REGION_CPU1 + sound_cpunum);
ROM = memory_region(Machine, REGION_CPU1 + sound_cpunum);
for (bank = 0; bank < 16; bank++)
{
/*
@ -319,7 +319,7 @@ void williams_narc_init(void)
memory_set_bankptr(6, &ROM[0x10000 + 0x4000 + 0x8000 + 0x10000 + 0x20000 * 3]);
/* configure slave CPU banks */
ROM = memory_region(REGION_CPU1 + soundalt_cpunum);
ROM = memory_region(Machine, REGION_CPU1 + soundalt_cpunum);
for (bank = 0; bank < 16; bank++)
{
/*
@ -348,13 +348,13 @@ void williams_adpcm_init(void)
soundalt_cpunum = -1;
/* configure banks */
ROM = memory_region(REGION_CPU1 + sound_cpunum);
ROM = memory_region(Machine, REGION_CPU1 + sound_cpunum);
memory_configure_bank(5, 0, 8, &ROM[0x10000], 0x8000);
memory_set_bankptr(6, &ROM[0x10000 + 0x4000 + 7 * 0x8000]);
/* expand ADPCM data */
/* it is assumed that U12 is loaded @ 0x00000 and U13 is loaded @ 0x40000 */
ROM = memory_region(REGION_SOUND1);
ROM = memory_region(Machine, REGION_SOUND1);
memcpy(ROM + 0x1c0000, ROM + 0x080000, 0x20000); /* expand individual banks */
memcpy(ROM + 0x180000, ROM + 0x0a0000, 0x20000);
memcpy(ROM + 0x140000, ROM + 0x0c0000, 0x20000);

View File

@ -7,6 +7,7 @@
***************************************************************************/
#include "driver.h"
#include "deprecat.h"
#include "streams.h"
#include "sound/custom.h"
@ -180,8 +181,8 @@ void *wiping_sh_start(int clock, const struct CustomSound_interface *config)
num_voices = 8;
last_channel = channel_list + num_voices;
sound_rom = memory_region(REGION_SOUND1);
sound_prom = memory_region(REGION_SOUND2);
sound_rom = memory_region(Machine, REGION_SOUND1);
sound_prom = memory_region(Machine, REGION_SOUND2);
/* start with sound enabled, many games don't have a sound enable register */
sound_enable = 1;

View File

@ -477,7 +477,7 @@ ROM_END
static DRIVER_INIT( 1942 )
{
UINT8 *ROM = memory_region(REGION_CPU1);
UINT8 *ROM = memory_region(machine, REGION_CPU1);
memory_configure_bank(1, 0, 3, &ROM[0x10000], 0x4000);
}

View File

@ -168,7 +168,7 @@ static WRITE8_HANDLER( rom_bank_select_w )
if (state->game_selected == 0)
{
UINT8 *rom = memory_region(REGION_CPU1);
UINT8 *rom = memory_region(machine, REGION_CPU1);
memcpy(rom+0x48000, rom+0x8000, 0x2000);
}
}
@ -183,7 +183,7 @@ static WRITE8_HANDLER( rom_48000_w )
if (offset < 0x0800)
state->video_ram[offset & 0x07ff] = data;
memory_region(REGION_CPU1)[0x48000 + offset] = data;
memory_region(machine, REGION_CPU1)[0x48000 + offset] = data;
}
}

View File

@ -238,9 +238,9 @@ ROM_END
static DRIVER_INIT( drill )
{
// rearrange gfx roms to something we can decode, two of the roms form 4bpp of the graphics, the third forms another 2bpp but is in a different format
UINT32 *src = (UINT32*)memory_region( REGION_GFX2 );
UINT32 *dst = (UINT32*)memory_region( REGION_GFX1 );// + 0x400000;
UINT8 *rom = memory_region( REGION_CPU1 );
UINT32 *src = (UINT32*)memory_region( machine, REGION_GFX2 );
UINT32 *dst = (UINT32*)memory_region( machine, REGION_GFX1 );// + 0x400000;
UINT8 *rom = memory_region( machine, REGION_CPU1 );
int i;
for (i=0; i< 0x400000/4; i++)

View File

@ -597,7 +597,7 @@ static READ8_HANDLER( undoukai_mcu_status_r )
static DRIVER_INIT( undoukai )
{
UINT8 *ROM = memory_region(REGION_CPU1);
UINT8 *ROM = memory_region(machine, REGION_CPU1);
memory_configure_bank(1, 0, 2, &ROM[0x10000], 0x2000);
from_mcu = 0xff;
@ -611,14 +611,14 @@ static DRIVER_INIT( undoukai )
static DRIVER_INIT( 40love )
{
UINT8 *ROM = memory_region(REGION_CPU1);
UINT8 *ROM = memory_region(machine, REGION_CPU1);
memory_configure_bank(1, 0, 2, &ROM[0x10000], 0x2000);
#if 0
/* character ROM hack
to show a white line on the opponent side */
UINT8 *ROM = memory_region(REGION_GFX2);
UINT8 *ROM = memory_region(machine, REGION_GFX2);
int adr = 0x10 * 0x022b;
ROM[adr+0x000a] = 0x00;
ROM[adr+0x000b] = 0x00;

View File

@ -5,6 +5,7 @@
***************************************************************************/
#include "driver.h"
#include "deprecat.h"
#include "cpu/konami/konami.h"
#include "cpu/z80/z80.h"
#include "video/konamiic.h"
@ -484,7 +485,7 @@ ROM_END
static void k88games_banking( int lines )
{
UINT8 *RAM = memory_region(REGION_CPU1);
UINT8 *RAM = memory_region(Machine, REGION_CPU1);
int offs;
logerror("%04x: bank select %02x\n",activecpu_get_pc(),lines);
@ -525,7 +526,7 @@ logerror("%04x: bank select %02x\n",activecpu_get_pc(),lines);
static MACHINE_RESET( 88games )
{
cpunum_set_info_fct(0, CPUINFO_PTR_KONAMI_SETLINES_CALLBACK, (genf *)k88games_banking);
paletteram = &memory_region(REGION_CPU1)[0x20000];
paletteram = &memory_region(machine, REGION_CPU1)[0x20000];
}

View File

@ -571,7 +571,7 @@ MACHINE_DRIVER_END
static DRIVER_INIT( sidewndr )
{
UINT8 *ROM = memory_region( REGION_CPU1 );
UINT8 *ROM = memory_region( machine, REGION_CPU1 );
/* replace "ret nc" ( 0xd0 ) with "di" */
ROM[ 0 ] = 0xf3;
/* this is either a bad dump or the cpu core should set the carry flag on reset */

View File

@ -147,7 +147,7 @@ static WRITE8_HANDLER( pending_command_clear_w )
static WRITE8_HANDLER( aerofgt_sh_bankswitch_w )
{
UINT8 *rom = memory_region(REGION_CPU2) + 0x10000;
UINT8 *rom = memory_region(machine, REGION_CPU2) + 0x10000;
memory_set_bankptr(1,rom + (data & 0x03) * 0x8000);
}

View File

@ -278,9 +278,9 @@ static WRITE8_HANDLER( master_nmi_trigger_w )
cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
}
static void airbustr_bankswitch(int cpunum, int data)
static void airbustr_bankswitch(running_machine *machine, int cpunum, int data)
{
UINT8 *ROM = memory_region(REGION_CPU1 + cpunum);
UINT8 *ROM = memory_region(machine, REGION_CPU1 + cpunum);
if ((data & 0x07) < 3)
ROM = &ROM[0x4000 * (data & 0x07)];
@ -292,12 +292,12 @@ static void airbustr_bankswitch(int cpunum, int data)
static WRITE8_HANDLER( master_bankswitch_w )
{
airbustr_bankswitch(0, data);
airbustr_bankswitch(machine, 0, data);
}
static WRITE8_HANDLER( slave_bankswitch_w )
{
airbustr_bankswitch(1, data);
airbustr_bankswitch(machine, 1, data);
flip_screen_set(data & 0x10);
@ -307,7 +307,7 @@ static WRITE8_HANDLER( slave_bankswitch_w )
static WRITE8_HANDLER( sound_bankswitch_w )
{
airbustr_bankswitch(2, data);
airbustr_bankswitch(machine, 2, data);
}
static READ8_HANDLER( soundcommand_status_r )

View File

@ -459,7 +459,7 @@ MACHINE_DRIVER_END
static DRIVER_INIT( aleck64 )
{
UINT8 *rom = memory_region(REGION_USER2);
UINT8 *rom = memory_region(machine, REGION_USER2);
rom[0x67c] = 0;
rom[0x67d] = 0;

View File

@ -735,7 +735,7 @@ static void alg_init(void)
/* set up memory */
memory_configure_bank(1, 0, 1, amiga_chip_ram, 0);
memory_configure_bank(1, 1, 1, memory_region(REGION_USER1), 0);
memory_configure_bank(1, 1, 1, memory_region(Machine, REGION_USER1), 0);
}
@ -748,8 +748,8 @@ static void alg_init(void)
static DRIVER_INIT( palr1 )
{
UINT32 length = memory_region_length(REGION_USER2);
UINT8 *rom = memory_region(REGION_USER2);
UINT32 length = memory_region_length(machine, REGION_USER2);
UINT8 *rom = memory_region(machine, REGION_USER2);
UINT8 *original = malloc_or_die(length);
UINT32 srcaddr;
@ -768,8 +768,8 @@ static DRIVER_INIT( palr1 )
static DRIVER_INIT( palr3 )
{
UINT32 length = memory_region_length(REGION_USER2);
UINT8 *rom = memory_region(REGION_USER2);
UINT32 length = memory_region_length(machine, REGION_USER2);
UINT8 *rom = memory_region(machine, REGION_USER2);
UINT8 *original = malloc_or_die(length);
UINT32 srcaddr;
@ -787,8 +787,8 @@ static DRIVER_INIT( palr3 )
static DRIVER_INIT( palr6 )
{
UINT32 length = memory_region_length(REGION_USER2);
UINT8 *rom = memory_region(REGION_USER2);
UINT32 length = memory_region_length(machine, REGION_USER2);
UINT8 *rom = memory_region(machine, REGION_USER2);
UINT8 *original = malloc_or_die(length);
UINT32 srcaddr;
@ -809,7 +809,7 @@ static DRIVER_INIT( palr6 )
static DRIVER_INIT( aplatoon )
{
/* NOT DONE TODO FIGURE OUT THE RIGHT ORDER!!!! */
UINT8 *rom = memory_region(REGION_USER2);
UINT8 *rom = memory_region(machine, REGION_USER2);
char *decrypted = auto_malloc(0x40000);
int i;

View File

@ -8,6 +8,7 @@ Preliminary driver by:
***************************************************************************/
#include "driver.h"
#include "deprecat.h"
#include "cpu/konami/konami.h" /* for the callback and the firq irq definition */
#include "video/konamiic.h"
#include "sound/k007232.h"
@ -480,7 +481,7 @@ ROM_END
static void aliens_banking( int lines )
{
UINT8 *RAM = memory_region(REGION_CPU1);
UINT8 *RAM = memory_region(Machine, REGION_CPU1);
int offs = 0x18000;
@ -492,7 +493,7 @@ static void aliens_banking( int lines )
static MACHINE_RESET( aliens )
{
UINT8 *RAM = memory_region(REGION_CPU1);
UINT8 *RAM = memory_region(machine, REGION_CPU1);
cpunum_set_info_fct(0, CPUINFO_PTR_KONAMI_SETLINES_CALLBACK, (genf *)aliens_banking);

View File

@ -769,7 +769,7 @@ ADDRESS_MAP_END
static WRITE8_HANDLER( sound_bank_w )
{
int bankaddress;
UINT8 *RAM = memory_region(REGION_CPU2);
UINT8 *RAM = memory_region(machine, REGION_CPU2);
bankaddress = 0x10000 + (data) * 0x4000;
memory_set_bankptr(7,&RAM[bankaddress]);
@ -3216,7 +3216,7 @@ static DRIVER_INIT( btlfildb )
static DRIVER_INIT( skysoldr )
{
memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x40008, 0x40009, 0, 0, skysoldr_cycle_r);
memory_set_bankptr(8, (memory_region(REGION_USER1))+0x40000);
memory_set_bankptr(8, (memory_region(machine, REGION_USER1))+0x40000);
invert_controls=0;
microcontroller_id=0;
coin_id=0x22|(0x22<<8);
@ -3231,7 +3231,7 @@ static DRIVER_INIT( goldmedl )
static DRIVER_INIT( goldmeda )
{
memory_set_bankptr(8, memory_region(REGION_CPU1) + 0x20000);
memory_set_bankptr(8, memory_region(machine, REGION_CPU1) + 0x20000);
invert_controls=0;
microcontroller_id=0x8803; //Guess - routine to handle coinage is the same as in 'goldmedl'
coin_id=0x23|(0x24<<8);
@ -3256,7 +3256,7 @@ static DRIVER_INIT( skyadvnu )
static DRIVER_INIT( gangwars )
{
memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x40206, 0x40207, 0, 0, gangwars_cycle_r);
memory_set_bankptr(8, memory_region(REGION_USER1));
memory_set_bankptr(8, memory_region(machine, REGION_USER1));
invert_controls=0;
microcontroller_id=0x8512;
coin_id=0x23|(0x24<<8);
@ -3265,7 +3265,7 @@ static DRIVER_INIT( gangwars )
static DRIVER_INIT( gangwarb )
{
memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x40206, 0x40207, 0, 0, gangwarb_cycle_r);
memory_set_bankptr(8, memory_region(REGION_USER1));
memory_set_bankptr(8, memory_region(machine, REGION_USER1));
invert_controls=0;
microcontroller_id=0x8512;
coin_id=0x23|(0x24<<8);
@ -3273,7 +3273,7 @@ static DRIVER_INIT( gangwarb )
static DRIVER_INIT( sbasebal )
{
UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1);
UINT16 *rom = (UINT16 *)memory_region(machine, REGION_CPU1);
/* Game hangs on divide by zero?! Patch it */
rom[0xb672/2] = 0x4e71;

View File

@ -93,7 +93,7 @@ ADDRESS_MAP_END
static READ8_HANDLER( amspdwy_port_r )
{
UINT8 *Tracks = memory_region(REGION_CPU1)+0x10000;
UINT8 *Tracks = memory_region(machine, REGION_CPU1)+0x10000;
return Tracks[offset];
}

View File

@ -161,7 +161,7 @@ VIDEO_UPDATE( angelkds );
static WRITE8_HANDLER ( angelkds_cpu_bank_write )
{
int bankaddress;
UINT8 *RAM = memory_region(REGION_USER1);
UINT8 *RAM = memory_region(machine, REGION_USER1);
bankaddress = data & 0x0f;
memory_set_bankptr(1,&RAM[bankaddress*0x4000]);
@ -737,7 +737,7 @@ ROM_START( spcpostn )
ROM_END
static DRIVER_INIT( spcpostn ) { spcpostn_decode(); }
static DRIVER_INIT( spcpostn ) { spcpostn_decode(machine); }
GAME( 1988, angelkds, 0, angelkds, angelkds, 0, ROT90, "Sega / Nasco?", "Angel Kids (Japan)" , 0) /* Nasco not displayed but 'Exa Planning' is */

View File

@ -78,7 +78,7 @@ static void appoooh_adpcm_int(running_machine *machine, int num)
/* adpcm address write */
static WRITE8_HANDLER( appoooh_adpcm_w )
{
UINT8 *RAM = memory_region(REGION_SOUND1);
UINT8 *RAM = memory_region(machine, REGION_SOUND1);
adpcmptr = &RAM[data*256];
MSM5205_reset_w(0,0);
appoooh_adpcm_data=-1;
@ -550,11 +550,11 @@ ROM_END
static DRIVER_INIT(robowres){
robowres_decode();
robowres_decode(machine);
}
static DRIVER_INIT(robowrb){
memory_set_decrypted_region(0, 0x0000, 0x7fff, memory_region(REGION_CPU1) + 0x1c000);
memory_set_decrypted_region(0, 0x0000, 0x7fff, memory_region(machine, REGION_CPU1) + 0x1c000);
}

Some files were not shown because too many files have changed in this diff Show More