diff options
961 files changed, 4959 insertions, 4902 deletions
diff --git a/src/emu/cheat.c b/src/emu/cheat.c index 86f23389622..5de55f3fa29 100644 --- a/src/emu/cheat.c +++ b/src/emu/cheat.c @@ -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 = ®ion_info_list[region_type - REGION_INVALID]; info->type = region_type; diff --git a/src/emu/cheat.h b/src/emu/cheat.h index 5c3c62e3419..4f219d96381 100644 --- a/src/emu/cheat.h +++ b/src/emu/cheat.h @@ -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__ */ diff --git a/src/emu/cpu/i8x41/i8x41.c b/src/emu/cpu/i8x41/i8x41.c index 903b0af4ebe..05c5d6f4a42 100644 --- a/src/emu/cpu/i8x41/i8x41.c +++ b/src/emu/cpu/i8x41/i8x41.c @@ -90,6 +90,7 @@ *****************************************************************************/ #include "debugger.h" +#include "deprecat.h" #include "i8x41.h" typedef struct { diff --git a/src/emu/debug/debugvw.c b/src/emu/debug/debugvw.c index 11935897d80..24ae7a8c305 100644 --- a/src/emu/debug/debugvw.c +++ b/src/emu/debug/debugvw.c @@ -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(); diff --git a/src/emu/machine/rp5h01.c b/src/emu/machine/rp5h01.c index 3abed1220da..6e6ff774b67 100644 --- a/src/emu/machine/rp5h01.c +++ b/src/emu/machine/rp5h01.c @@ -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; diff --git a/src/emu/mame.c b/src/emu/mame.c index 2732995256b..59080037c73 100644 --- a/src/emu/mame.c +++ b/src/emu/mame.c @@ -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 */ diff --git a/src/emu/mame.h b/src/emu/mame.h index 2190e54d065..ba75430b4ec 100644 --- a/src/emu/mame.h +++ b/src/emu/mame.h @@ -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); diff --git a/src/emu/memory.c b/src/emu/memory.c index efb2d615d7a..a350fbcad23 100644 --- a/src/emu/memory.c +++ b/src/emu/memory.c @@ -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")); diff --git a/src/emu/romload.c b/src/emu/romload.c index 72adb7b3151..067dbc48317 100644 --- a/src/emu/romload.c +++ b/src/emu/romload.c @@ -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]); } diff --git a/src/emu/sound/2608intf.c b/src/emu/sound/2608intf.c index af30d6341bb..19463695374 100644 --- a/src/emu/sound/2608intf.c +++ b/src/emu/sound/2608intf.c @@ -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, diff --git a/src/emu/sound/2610intf.c b/src/emu/sound/2610intf.c index 9f75245258c..072e9a47524 100644 --- a/src/emu/sound/2610intf.c +++ b/src/emu/sound/2610intf.c @@ -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, diff --git a/src/emu/sound/3812intf.c b/src/emu/sound/3812intf.c index f7854db25cf..ba17b8eb734 100644 --- a/src/emu/sound/3812intf.c +++ b/src/emu/sound/3812intf.c @@ -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); diff --git a/src/emu/sound/5110intf.c b/src/emu/sound/5110intf.c index 7eea702e10d..e5e51f0019a 100644 --- a/src/emu/sound/5110intf.c +++ b/src/emu/sound/5110intf.c @@ -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; diff --git a/src/emu/sound/aica.c b/src/emu/sound/aica.c index d4cc0263482..cf969ed0b1f 100644 --- a/src/emu/sound/aica.c +++ b/src/emu/sound/aica.c @@ -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; diff --git a/src/emu/sound/bsmt2000.c b/src/emu/sound/bsmt2000.c index 50c1135d967..85900c805d5 100644 --- a/src/emu/sound/bsmt2000.c +++ b/src/emu/sound/bsmt2000.c @@ -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); diff --git a/src/emu/sound/c140.c b/src/emu/sound/c140.c index c856bebae8d..241ae269d7f 100644 --- a/src/emu/sound/c140.c +++ b/src/emu/sound/c140.c @@ -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 { diff --git a/src/emu/sound/c352.c b/src/emu/sound/c352.c index 75458cac0da..ca2999f803c 100644 --- a/src/emu/sound/c352.c +++ b/src/emu/sound/c352.c @@ -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; diff --git a/src/emu/sound/es5506.c b/src/emu/sound/es5506.c index 8e31a8ef337..f674f532845 100644 --- a/src/emu/sound/es5506.c +++ b/src/emu/sound/es5506.c @@ -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; diff --git a/src/emu/sound/es8712.c b/src/emu/sound/es8712.c index 0f697adf4c7..6af3d7a7d9f 100644 --- a/src/emu/sound/es8712.c +++ b/src/emu/sound/es8712.c @@ -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); diff --git a/src/emu/sound/gaelco.c b/src/emu/sound/gaelco.c index 61fecc0d06d..010ad23cc25 100644 --- a/src/emu/sound/gaelco.c +++ b/src/emu/sound/gaelco.c @@ -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++){ diff --git a/src/emu/sound/ics2115.c b/src/emu/sound/ics2115.c index 244b5c8a4d4..5f9f621a452 100644 --- a/src/emu/sound/ics2115.c +++ b/src/emu/sound/ics2115.c @@ -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)); diff --git a/src/emu/sound/iremga20.c b/src/emu/sound/iremga20.c index c84fb04b062..53bc9734b39 100644 --- a/src/emu/sound/iremga20.c +++ b/src/emu/sound/iremga20.c @@ -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); diff --git a/src/emu/sound/k005289.c b/src/emu/sound/k005289.c index 264611ab307..c2e612febd2 100644 --- a/src/emu/sound/k005289.c +++ b/src/emu/sound/k005289.c @@ -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; diff --git a/src/emu/sound/k007232.c b/src/emu/sound/k007232.c index 44f08a617b9..b654f658cf2 100644 --- a/src/emu/sound/k007232.c +++ b/src/emu/sound/k007232.c @@ -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; diff --git a/src/emu/sound/k053260.c b/src/emu/sound/k053260.c index 78f96cf76cb..f24d04ba612 100644 --- a/src/emu/sound/k053260.c +++ b/src/emu/sound/k053260.c @@ -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 ); diff --git a/src/emu/sound/k054539.c b/src/emu/sound/k054539.c index d66a28ecccd..e0b98c9995b 100644 --- a/src/emu/sound/k054539.c +++ b/src/emu/sound/k054539.c @@ -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) { diff --git a/src/emu/sound/multipcm.c b/src/emu/sound/multipcm.c index 36ef597eee7..6db27d1959f 100644 --- a/src/emu/sound/multipcm.c +++ b/src/emu/sound/multipcm.c @@ -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); diff --git a/src/emu/sound/n63701x.c b/src/emu/sound/n63701x.c index 56e348d93ad..17c1a242934 100644 --- a/src/emu/sound/n63701x.c +++ b/src/emu/sound/n63701x.c @@ -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); diff --git a/src/emu/sound/namco.c b/src/emu/sound/namco.c index de56302d717..f9e75b11364 100644 --- a/src/emu/sound/namco.c +++ b/src/emu/sound/namco.c @@ -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) diff --git a/src/emu/sound/namco52.c b/src/emu/sound/namco52.c index 12b9da2b261..edb33b40049 100644 --- a/src/emu/sound/namco52.c +++ b/src/emu/sound/namco52.c @@ -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) { diff --git a/src/emu/sound/nes_apu.c b/src/emu/sound/nes_apu.c index 4c9c332a660..d644c431c0c 100644 --- a/src/emu/sound/nes_apu.c +++ b/src/emu/sound/nes_apu.c @@ -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); diff --git a/src/emu/sound/nile.c b/src/emu/sound/nile.c index 0423ab74b72..7400d5cedc0 100644 --- a/src/emu/sound/nile.c +++ b/src/emu/sound/nile.c @@ -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); diff --git a/src/emu/sound/okim6295.c b/src/emu/sound/okim6295.c index f2c4911a04b..f495429e69d 100644 --- a/src/emu/sound/okim6295.c +++ b/src/emu/sound/okim6295.c @@ -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; diff --git a/src/emu/sound/qsound.c b/src/emu/sound/qsound.c index b82e0d18282..1244efdf023 100644 --- a/src/emu/sound/qsound.c +++ b/src/emu/sound/qsound.c @@ -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)); diff --git a/src/emu/sound/rf5c400.c b/src/emu/sound/rf5c400.c index adb7b8c124f..352a0f719c6 100644 --- a/src/emu/sound/rf5c400.c +++ b/src/emu/sound/rf5c400.c @@ -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 { diff --git a/src/emu/sound/s14001a.c b/src/emu/sound/s14001a.c index 01420172e15..89636a2ff47 100644 --- a/src/emu/sound/s14001a.c +++ b/src/emu/sound/s14001a.c @@ -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); diff --git a/src/emu/sound/scsp.c b/src/emu/sound/scsp.c index 48ae5e51c08..daf95d12488 100644 --- a/src/emu/sound/scsp.c +++ b/src/emu/sound/scsp.c @@ -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; diff --git a/src/emu/sound/segapcm.c b/src/emu/sound/segapcm.c index ec484458824..0026de4fe77 100644 --- a/src/emu/sound/segapcm.c +++ b/src/emu/sound/segapcm.c @@ -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--; diff --git a/src/emu/sound/sp0256.c b/src/emu/sound/sp0256.c index 7a5db020111..b81dfbf51d9 100644 --- a/src/emu/sound/sp0256.c +++ b/src/emu/sound/sp0256.c @@ -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; diff --git a/src/emu/sound/upd7759.c b/src/emu/sound/upd7759.c index 1a181fa829c..c9e82572133 100644 --- a/src/emu/sound/upd7759.c +++ b/src/emu/sound/upd7759.c @@ -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); diff --git a/src/emu/sound/vlm5030.c b/src/emu/sound/vlm5030.c index 37f20816d6e..09b2247b093 100644 --- a/src/emu/sound/vlm5030.c +++ b/src/emu/sound/vlm5030.c @@ -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; diff --git a/src/emu/sound/x1_010.c b/src/emu/sound/x1_010.c index 9b22fde45cc..6f7d11ca63d 100644 --- a/src/emu/sound/x1_010.c +++ b/src/emu/sound/x1_010.c @@ -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]) ); diff --git a/src/emu/sound/ymf271.c b/src/emu/sound/ymf271.c index 063e3e1f847..a84d1893a2f 100644 --- a/src/emu/sound/ymf271.c +++ b/src/emu/sound/ymf271.c @@ -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++) diff --git a/src/emu/sound/ymf278b.c b/src/emu/sound/ymf278b.c index 1edaa6cc8de..7705826559e 100644 --- a/src/emu/sound/ymf278b.c +++ b/src/emu/sound/ymf278b.c @@ -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 diff --git a/src/emu/sound/ymz280b.c b/src/emu/sound/ymz280b.c index 4d01274b719..4ded68e5731 100644 --- a/src/emu/sound/ymz280b.c +++ b/src/emu/sound/ymz280b.c @@ -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 */ diff --git a/src/emu/ui.c b/src/emu/ui.c index b72d504fe17..82479d2d93e 100644 --- a/src/emu/ui.c +++ b/src/emu/ui.c @@ -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) diff --git a/src/emu/video.c b/src/emu/video.c index 2da1629a55e..51ecbe89d73 100644 --- a/src/emu/video.c +++ b/src/emu/video.c @@ -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; diff --git a/src/mame/audio/atarijsa.c b/src/mame/audio/atarijsa.c index 6f59fc741f6..0fcd6151d43 100644 --- a/src/mame/audio/atarijsa.c +++ b/src/mame/audio/atarijsa.c @@ -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 */ diff --git a/src/mame/audio/atarijsa.h b/src/mame/audio/atarijsa.h index 3e0dc09e13b..cde62e318a7 100644 --- a/src/mame/audio/atarijsa.h +++ b/src/mame/audio/atarijsa.h @@ -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); diff --git a/src/mame/audio/cage.c b/src/mame/audio/cage.c index 510548a23a9..681a22bca9d 100644 --- a/src/mame/audio/cage.c +++ b/src/mame/audio/cage.c @@ -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)); diff --git a/src/mame/audio/cclimber.c b/src/mame/audio/cclimber.c index bca19484fd7..351cf291e59 100644 --- a/src/mame/audio/cclimber.c +++ b/src/mame/audio/cclimber.c @@ -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; diff --git a/src/mame/audio/cinemat.c b/src/mame/audio/cinemat.c index 4a356d7b2d5..7734ea9d538 100644 --- a/src/mame/audio/cinemat.c +++ b/src/mame/audio/cinemat.c @@ -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; } diff --git a/src/mame/audio/circus.c b/src/mame/audio/circus.c index d32d3ed1e8c..208fa61414f 100644 --- a/src/mame/audio/circus.c +++ b/src/mame/audio/circus.c @@ -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) diff --git a/src/mame/audio/cps3.c b/src/mame/audio/cps3.c index 16e0e903a5f..fbd67342135 100644 --- a/src/mame/audio/cps3.c +++ b/src/mame/audio/cps3.c @@ -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])); diff --git a/src/mame/audio/cyberbal.c b/src/mame/audio/cyberbal.c index 0a72ad6fb0b..c8a3e568e3b 100644 --- a/src/mame/audio/cyberbal.c +++ b/src/mame/audio/cyberbal.c @@ -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; diff --git a/src/mame/audio/dcs.c b/src/mame/audio/dcs.c index e6cd8d7fcee..87b92feecb5 100644 --- a/src/mame/audio/dcs.c +++ b/src/mame/audio/dcs.c @@ -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) diff --git a/src/mame/audio/dkong.c b/src/mame/audio/dkong.c index f07b4b96af3..a51ce98d20c 100644 --- a/src/mame/audio/dkong.c +++ b/src/mame/audio/dkong.c @@ -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 ) { diff --git a/src/mame/audio/exidy440.c b/src/mame/audio/exidy440.c index 7fa3f00ee34..3006b1d4513 100644 --- a/src/mame/audio/exidy440.c +++ b/src/mame/audio/exidy440.c @@ -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); } diff --git a/src/mame/audio/fghtbskt.c b/src/mame/audio/fghtbskt.c index 6e5a7549db0..73ea7333a73 100644 --- a/src/mame/audio/fghtbskt.c +++ b/src/mame/audio/fghtbskt.c @@ -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); diff --git a/src/mame/audio/flower.c b/src/mame/audio/flower.c index 7d5c03c20c2..84991e0356c 100644 --- a/src/mame/audio/flower.c +++ b/src/mame/audio/flower.c @@ -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; diff --git a/src/mame/audio/gomoku.c b/src/mame/audio/gomoku.c index 22c00897aac..36d1423f8f6 100644 --- a/src/mame/audio/gomoku.c +++ b/src/mame/audio/gomoku.c @@ -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; diff --git a/src/mame/audio/harddriv.c b/src/mame/audio/harddriv.c index b8f2c889932..20c0441bf13 100644 --- a/src/mame/audio/harddriv.c +++ b/src/mame/audio/harddriv.c @@ -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; } diff --git a/src/mame/audio/leland.c b/src/mame/audio/leland.c index 97d54f7ff3d..89a11747de2 100644 --- a/src/mame/audio/leland.c +++ b/src/mame/audio/leland.c @@ -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); } diff --git a/src/mame/audio/m72.c b/src/mame/audio/m72.c index 682636cc096..3d17d181d73 100644 --- a/src/mame/audio/m72.c +++ b/src/mame/audio/m72.c @@ -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); } diff --git a/src/mame/audio/mario.c b/src/mame/audio/mario.c index 52a3dfc71c5..beeff05f12f 100644 --- a/src/mame/audio/mario.c +++ b/src/mame/audio/mario.c @@ -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) diff --git a/src/mame/audio/mcr.c b/src/mame/audio/mcr.c index 955da5a5642..e77e9b6042d 100644 --- a/src/mame/audio/mcr.c +++ b/src/mame/audio/mcr.c @@ -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 */ diff --git a/src/mame/audio/mcr.h b/src/mame/audio/mcr.h index d365260825b..dca6839837b 100644 --- a/src/mame/audio/mcr.h +++ b/src/mame/audio/mcr.h @@ -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 ); diff --git a/src/mame/audio/namcoc7x.c b/src/mame/audio/namcoc7x.c index d552cf48fe6..3af97b39325 100644 --- a/src/mame/audio/namcoc7x.c +++ b/src/mame/audio/namcoc7x.c @@ -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) diff --git a/src/mame/audio/namcoc7x.h b/src/mame/audio/namcoc7x.h index 733dd6dd5eb..6c606ea1a5e 100644 --- a/src/mame/audio/namcoc7x.h +++ b/src/mame/audio/namcoc7x.h @@ -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 \ diff --git a/src/mame/audio/polepos.c b/src/mame/audio/polepos.c index a56e4929135..84bf6eb6305 100644 --- a/src/mame/audio/polepos.c +++ b/src/mame/audio/polepos.c @@ -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--) diff --git a/src/mame/audio/rockola.c b/src/mame/audio/rockola.c index 4bfbbd23750..5e1590cdec2 100644 --- a/src/mame/audio/rockola.c +++ b/src/mame/audio/rockola.c @@ -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) diff --git a/src/mame/audio/scramble.c b/src/mame/audio/scramble.c index 01ec0abd67b..dfd750a23ad 100644 --- a/src/mame/audio/scramble.c +++ b/src/mame/audio/scramble.c @@ -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; diff --git a/src/mame/audio/segag80r.c b/src/mame/audio/segag80r.c index 184d25d7b1b..f1e0fb5ef34 100644 --- a/src/mame/audio/segag80r.c +++ b/src/mame/audio/segag80r.c @@ -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]; } diff --git a/src/mame/audio/segasnd.c b/src/mame/audio/segasnd.c index a587250da2c..b31788bbb77 100644 --- a/src/mame/audio/segasnd.c +++ b/src/mame/audio/segasnd.c @@ -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 ) diff --git a/src/mame/audio/seibu.c b/src/mame/audio/seibu.c index 15b1e185c1d..d04ae40acbf 100644 --- a/src/mame/audio/seibu.c +++ b/src/mame/audio/seibu.c @@ -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); diff --git a/src/mame/audio/seibu.h b/src/mame/audio/seibu.h index 97bc343c068..55582a23462 100644 --- a/src/mame/audio/seibu.h +++ b/src/mame/audio/seibu.h @@ -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 ); diff --git a/src/mame/audio/snes.c b/src/mame/audio/snes.c index f8c9b34caa9..dee76454aaf 100644 --- a/src/mame/audio/snes.c +++ b/src/mame/audio/snes.c @@ -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 { diff --git a/src/mame/audio/suna8.c b/src/mame/audio/suna8.c index 604066a30fa..243c09db4b3 100644 --- a/src/mame/audio/suna8.c +++ b/src/mame/audio/suna8.c @@ -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])); diff --git a/src/mame/audio/system16.c b/src/mame/audio/system16.c index 4d46bd9daf3..0fa22f4ac2a 100644 --- a/src/mame/audio/system16.c +++ b/src/mame/audio/system16.c @@ -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]; } diff --git a/src/mame/audio/taito_en.c b/src/mame/audio/taito_en.c index cbfa6273159..104ca371b60 100644 --- a/src/mame/audio/taito_en.c +++ b/src/mame/audio/taito_en.c @@ -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]); diff --git a/src/mame/audio/taito_en.h b/src/mame/audio/taito_en.h index 02e21527eae..ab8a2c84f3b 100644 --- a/src/mame/audio/taito_en.h +++ b/src/mame/audio/taito_en.h @@ -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) \ diff --git a/src/mame/audio/targ.c b/src/mame/audio/targ.c index 1ee108b8c13..8a52c5f628b 100644 --- a/src/mame/audio/targ.c +++ b/src/mame/audio/targ.c @@ -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; diff --git a/src/mame/audio/trackfld.c b/src/mame/audio/trackfld.c index 3c8f2217bac..048efcff495 100644 --- a/src/mame/audio/trackfld.c +++ b/src/mame/audio/trackfld.c @@ -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 */ diff --git a/src/mame/audio/williams.c b/src/mame/audio/williams.c index dcad8b49d82..16fcac9fc8f 100644 --- a/src/mame/audio/williams.c +++ b/src/mame/audio/williams.c @@ -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); diff --git a/src/mame/audio/wiping.c b/src/mame/audio/wiping.c index 6ca3348fd62..032b475a01c 100644 --- a/src/mame/audio/wiping.c +++ b/src/mame/audio/wiping.c @@ -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; diff --git a/src/mame/drivers/1942.c b/src/mame/drivers/1942.c index 53116ad0fd7..93f4ad0cc49 100644 --- a/src/mame/drivers/1942.c +++ b/src/mame/drivers/1942.c @@ -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); } diff --git a/src/mame/drivers/20pacgal.c b/src/mame/drivers/20pacgal.c index 1175f96bad4..6281a2ef049 100644 --- a/src/mame/drivers/20pacgal.c +++ b/src/mame/drivers/20pacgal.c @@ -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; } } diff --git a/src/mame/drivers/2mindril.c b/src/mame/drivers/2mindril.c index 0268a4e1174..5ce78e58e9b 100644 --- a/src/mame/drivers/2mindril.c +++ b/src/mame/drivers/2mindril.c @@ -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++) diff --git a/src/mame/drivers/40love.c b/src/mame/drivers/40love.c index ca6b951c9bd..26471196293 100644 --- a/src/mame/drivers/40love.c +++ b/src/mame/drivers/40love.c @@ -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; diff --git a/src/mame/drivers/88games.c b/src/mame/drivers/88games.c index 39ec7a7a075..3714db5e99c 100644 --- a/src/mame/drivers/88games.c +++ b/src/mame/drivers/88games.c @@ -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]; } diff --git a/src/mame/drivers/acefruit.c b/src/mame/drivers/acefruit.c index 8cd4a499718..fcdc13f0fca 100644 --- a/src/mame/drivers/acefruit.c +++ b/src/mame/drivers/acefruit.c @@ -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 */ diff --git a/src/mame/drivers/aerofgt.c b/src/mame/drivers/aerofgt.c index b34adf2b23e..41dfd8dae24 100644 --- a/src/mame/drivers/aerofgt.c +++ b/src/mame/drivers/aerofgt.c @@ -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); } diff --git a/src/mame/drivers/airbustr.c b/src/mame/drivers/airbustr.c index 8b3c446690d..9eab169867f 100644 --- a/src/mame/drivers/airbustr.c +++ b/src/mame/drivers/airbustr.c @@ -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 ) diff --git a/src/mame/drivers/aleck64.c b/src/mame/drivers/aleck64.c index 707cb6cf11f..73283e5e15e 100644 --- a/src/mame/drivers/aleck64.c +++ b/src/mame/drivers/aleck64.c @@ -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; diff --git a/src/mame/drivers/alg.c b/src/mame/drivers/alg.c index 90497a7ac20..60abc321d73 100644 --- a/src/mame/drivers/alg.c +++ b/src/mame/drivers/alg.c @@ -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; diff --git a/src/mame/drivers/aliens.c b/src/mame/drivers/aliens.c index e6d20ad361d..9e9c816f0f8 100644 --- a/src/mame/drivers/aliens.c +++ b/src/mame/drivers/aliens.c @@ -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); diff --git a/src/mame/drivers/alpha68k.c b/src/mame/drivers/alpha68k.c index 1179175140d..f60039150b7 100644 --- a/src/mame/drivers/alpha68k.c +++ b/src/mame/drivers/alpha68k.c @@ -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; diff --git a/src/mame/drivers/amspdwy.c b/src/mame/drivers/amspdwy.c index f8d6fcf0fd2..9eb9ed3755f 100644 --- a/src/mame/drivers/amspdwy.c +++ b/src/mame/drivers/amspdwy.c @@ -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]; } diff --git a/src/mame/drivers/angelkds.c b/src/mame/drivers/angelkds.c index de6d6f8eb6d..95cd8199ec7 100644 --- a/src/mame/drivers/angelkds.c +++ b/src/mame/drivers/angelkds.c @@ -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 */ diff --git a/src/mame/drivers/appoooh.c b/src/mame/drivers/appoooh.c index a470888a0c2..5cafad62d21 100644 --- a/src/mame/drivers/appoooh.c +++ b/src/mame/drivers/appoooh.c @@ -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); } diff --git a/src/mame/drivers/aquarium.c b/src/mame/drivers/aquarium.c index f162c5fd7f9..4949095a9ef 100644 --- a/src/mame/drivers/aquarium.c +++ b/src/mame/drivers/aquarium.c @@ -73,7 +73,7 @@ VIDEO_UPDATE(aquarium); #if AQUARIUS_HACK static MACHINE_RESET( aquarium ) { - UINT16 *RAM = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *RAM = (UINT16 *)memory_region(machine, REGION_CPU1); int data = input_port_read(machine, "FAKE"); /* Language : 0x0000 = Japanese - Other value = English */ @@ -108,7 +108,7 @@ static WRITE16_HANDLER( aquarium_sound_w ) static WRITE8_HANDLER( aquarium_z80_bank_w ) { int soundbank = ((data & 0x7) + 1) * 0x8000; - UINT8 *Z80 = (UINT8 *)memory_region(REGION_CPU2); + UINT8 *Z80 = (UINT8 *)memory_region(machine, REGION_CPU2); memory_set_bankptr(1, &Z80[soundbank + 0x10000]); } @@ -291,8 +291,8 @@ static DRIVER_INIT( aquarium ) the roms containing the 1bpp data so we can decode it correctly */ - UINT8 *DAT2 = memory_region(REGION_GFX1)+0x080000; - UINT8 *DAT = memory_region(REGION_USER1); + UINT8 *DAT2 = memory_region(machine, REGION_GFX1)+0x080000; + UINT8 *DAT = memory_region(machine, REGION_USER1); int len = 0x0200000; for (len = 0 ; len < 0x020000 ; len ++ ) @@ -307,8 +307,8 @@ static DRIVER_INIT( aquarium ) DAT2[len*4+2] |= (DAT[len] & 0x01) << 3; } - DAT2 = memory_region(REGION_GFX4)+0x080000; - DAT = memory_region(REGION_USER2); + DAT2 = memory_region(machine, REGION_GFX4)+0x080000; + DAT = memory_region(machine, REGION_USER2); for (len = 0 ; len < 0x020000 ; len ++ ) { diff --git a/src/mame/drivers/arcadecl.c b/src/mame/drivers/arcadecl.c index 7aabe92e5af..8c75debc8ff 100644 --- a/src/mame/drivers/arcadecl.c +++ b/src/mame/drivers/arcadecl.c @@ -423,7 +423,7 @@ static DRIVER_INIT( arcadecl ) static DRIVER_INIT( sparkz ) { atarigen_eeprom_default = NULL; - memset(memory_region(REGION_GFX1), 0, memory_region_length(REGION_GFX1)); + memset(memory_region(machine, REGION_GFX1), 0, memory_region_length(machine, REGION_GFX1)); } diff --git a/src/mame/drivers/arcadia.c b/src/mame/drivers/arcadia.c index 642dd2b06bd..ebd7e8626eb 100644 --- a/src/mame/drivers/arcadia.c +++ b/src/mame/drivers/arcadia.c @@ -633,7 +633,7 @@ ROM_END INLINE void generic_decode(int region, int bit7, int bit6, int bit5, int bit4, int bit3, int bit2, int bit1, int bit0) { - UINT16 *rom = (UINT16 *)memory_region(region); + UINT16 *rom = (UINT16 *)memory_region(Machine, region); int i; /* only the low byte of ROMs are encrypted in these games */ @@ -671,10 +671,10 @@ static void arcadia_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); /* OnePlay bios is encrypted, TenPlay is not */ - biosrom = (UINT16 *)memory_region(REGION_USER2); + biosrom = (UINT16 *)memory_region(Machine, REGION_USER2); if (biosrom[0] != 0x4afc) generic_decode(REGION_USER2, 6, 1, 0, 2, 3, 4, 5, 7); } diff --git a/src/mame/drivers/argus.c b/src/mame/drivers/argus.c index 97733c45307..f867e33eccf 100644 --- a/src/mame/drivers/argus.c +++ b/src/mame/drivers/argus.c @@ -202,7 +202,7 @@ static READ8_HANDLER( argus_bankselect_r ) static WRITE8_HANDLER( argus_bankselect_w ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); int bankaddress; argus_bank_latch = data; diff --git a/src/mame/drivers/arkanoid.c b/src/mame/drivers/arkanoid.c index 6fa085a84bf..2b4d3b1a991 100644 --- a/src/mame/drivers/arkanoid.c +++ b/src/mame/drivers/arkanoid.c @@ -1132,7 +1132,7 @@ static DRIVER_INIT( paddle2 ) static DRIVER_INIT( tetrsark ) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); int x; for (x=0;x<0x8000;x++) diff --git a/src/mame/drivers/armedf.c b/src/mame/drivers/armedf.c index 1fb4727561f..a18f98c7ef0 100644 --- a/src/mame/drivers/armedf.c +++ b/src/mame/drivers/armedf.c @@ -1434,7 +1434,7 @@ static DRIVER_INIT( legion ) #if LEGION_HACK /* This is a hack to allow you to use the extra features of 3 of the "Unused" Dip Switches (see notes above). */ - UINT16 *RAM = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *RAM = (UINT16 *)memory_region(machine, REGION_CPU1); RAM[0x0001d6/2] = 0x0001; /* To avoid checksum error */ RAM[0x000488/2] = 0x4e71; @@ -1448,7 +1448,7 @@ static DRIVER_INIT( legiono ) #if LEGION_HACK /* This is a hack to allow you to use the extra features of 3 of the "Unused" Dip Switches (see notes above). */ - UINT16 *RAM = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *RAM = (UINT16 *)memory_region(machine, REGION_CPU1); RAM[0x0001d6/2] = 0x0001; /* No need to patch the checksum routine (see notes) ! */ #endif diff --git a/src/mame/drivers/artmagic.c b/src/mame/drivers/artmagic.c index b168a97897e..734b6edb171 100644 --- a/src/mame/drivers/artmagic.c +++ b/src/mame/drivers/artmagic.c @@ -125,7 +125,7 @@ static WRITE16_HANDLER( control_w ) /* OKI banking here */ if (offset == 0) - OKIM6295_set_bank_base(0, (((data >> 4) & 1) * 0x40000) % memory_region_length(REGION_SOUND1)); + OKIM6295_set_bank_base(0, (((data >> 4) & 1) * 0x40000) % memory_region_length(machine, REGION_SOUND1)); logerror("%06X:control_w(%d) = %04X\n", activecpu_get_pc(), offset, data); } diff --git a/src/mame/drivers/ashnojoe.c b/src/mame/drivers/ashnojoe.c index 793b570a7db..18775bec55c 100644 --- a/src/mame/drivers/ashnojoe.c +++ b/src/mame/drivers/ashnojoe.c @@ -303,7 +303,7 @@ static WRITE8_HANDLER(writeA) static WRITE8_HANDLER(writeB) { - memory_set_bankptr(4, memory_region(REGION_SOUND1) + ((data & 0xf) * 0x8000)); + memory_set_bankptr(4, memory_region(machine, REGION_SOUND1) + ((data & 0xf) * 0x8000)); } static void ashnojoe_adpcm_int (running_machine *machine, int data) @@ -332,7 +332,7 @@ static const struct YM2203interface ym2203_interface = static DRIVER_INIT( ashnojoe ) { - memory_set_bankptr(4, memory_region(REGION_SOUND1)); + memory_set_bankptr(4, memory_region(machine, REGION_SOUND1)); } static MACHINE_DRIVER_START( ashnojoe ) diff --git a/src/mame/drivers/asterix.c b/src/mame/drivers/asterix.c index 291c160f5df..a769aae4cbe 100644 --- a/src/mame/drivers/asterix.c +++ b/src/mame/drivers/asterix.c @@ -364,8 +364,8 @@ static DRIVER_INIT( asterix ) konami_rom_deinterleave_2(REGION_GFX2); #if 0 - *(UINT16 *)(memory_region(REGION_CPU1) + 0x07f34) = 0x602a; - *(UINT16 *)(memory_region(REGION_CPU1) + 0x00008) = 0x0400; + *(UINT16 *)(memory_region(machine, REGION_CPU1) + 0x07f34) = 0x602a; + *(UINT16 *)(memory_region(machine, REGION_CPU1) + 0x00008) = 0x0400; #endif } diff --git a/src/mame/drivers/astinvad.c b/src/mame/drivers/astinvad.c index b6a209d1590..702cc16a00f 100644 --- a/src/mame/drivers/astinvad.c +++ b/src/mame/drivers/astinvad.c @@ -137,7 +137,7 @@ static void plot_byte(bitmap_t *bitmap, UINT8 y, UINT8 x, UINT8 data, UINT8 colo static VIDEO_UPDATE( astinvad ) { - const UINT8 *color_prom = memory_region(REGION_PROMS); + const UINT8 *color_prom = memory_region(screen->machine, REGION_PROMS); UINT8 yoffs = flip_yoffs & screen_flip; int x, y; @@ -156,7 +156,7 @@ static VIDEO_UPDATE( astinvad ) static VIDEO_UPDATE( spaceint ) { - const UINT8 *color_prom = memory_region(REGION_PROMS); + const UINT8 *color_prom = memory_region(screen->machine, REGION_PROMS); int offs; for (offs = 0; offs < videoram_size; offs++) diff --git a/src/mame/drivers/astrocde.c b/src/mame/drivers/astrocde.c index 04b464a6e41..4d6a74072d8 100644 --- a/src/mame/drivers/astrocde.c +++ b/src/mame/drivers/astrocde.c @@ -422,14 +422,14 @@ static WRITE8_HANDLER( profpac_banksw_w ) /* set the main banking */ memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0xbfff, 0, 0, SMH_BANK1); - memory_set_bankptr(1, memory_region(REGION_USER1) + 0x8000 * bank); + memory_set_bankptr(1, memory_region(machine, REGION_USER1) + 0x8000 * bank); /* bank 0 reads video RAM in the 4000-7FFF range */ if (bank == 0) memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x7fff, 0, 0, profpac_videoram_r); /* if we have a 640k EPROM board, map that on top of the 4000-7FFF range if specified */ - if ((data & 0x80) && memory_region(REGION_USER2) != NULL) + if ((data & 0x80) && memory_region(machine, REGION_USER2) != NULL) { /* Note: There is a jumper which could change the base offset to 0xa8 instead */ bank = data - 0x80; @@ -438,7 +438,7 @@ static WRITE8_HANDLER( profpac_banksw_w ) if (bank < 0x28) { memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x7fff, 0, 0, SMH_BANK2); - memory_set_bankptr(2, memory_region(REGION_USER2) + 0x4000 * bank); + memory_set_bankptr(2, memory_region(machine, REGION_USER2) + 0x4000 * bank); } else memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x7fff, 0, 0, SMH_UNMAP); diff --git a/src/mame/drivers/astrocorp.c b/src/mame/drivers/astrocorp.c index 52bbb635156..8cecb2f9986 100644 --- a/src/mame/drivers/astrocorp.c +++ b/src/mame/drivers/astrocorp.c @@ -331,7 +331,7 @@ ROM_END static DRIVER_INIT( showhand ) { /* - UINT16 *rom = (UINT16*)memory_region(REGION_CPU1); + UINT16 *rom = (UINT16*)memory_region(machine, REGION_CPU1); rom[0x0a1a/2] = 0x6000; // hopper jam diff --git a/src/mame/drivers/astrof.c b/src/mame/drivers/astrof.c index f683b421a1c..6238f1cb247 100644 --- a/src/mame/drivers/astrof.c +++ b/src/mame/drivers/astrof.c @@ -198,10 +198,10 @@ static rgb_t make_pen(UINT8 data) } -static void astrof_get_pens(pen_t *pens) +static void astrof_get_pens(running_machine *machine, pen_t *pens) { offs_t i; - UINT8 *prom = memory_region(REGION_PROMS); + UINT8 *prom = memory_region(machine, REGION_PROMS); for (i = 0; i < ASTROF_NUM_PENS; i++) { @@ -212,10 +212,10 @@ static void astrof_get_pens(pen_t *pens) } -static void tomahawk_get_pens(pen_t *pens) +static void tomahawk_get_pens(running_machine *machine, pen_t *pens) { offs_t i; - UINT8 *prom = memory_region(REGION_PROMS); + UINT8 *prom = memory_region(machine, REGION_PROMS); for (i = 0; i < TOMAHAWK_NUM_PENS; i++) { @@ -358,7 +358,7 @@ static VIDEO_UPDATE( astrof ) { pen_t pens[ASTROF_NUM_PENS]; - astrof_get_pens(pens); + astrof_get_pens(screen->machine, pens); video_update_common(bitmap, cliprect, pens); @@ -370,7 +370,7 @@ static VIDEO_UPDATE( tomahawk ) { pen_t pens[TOMAHAWK_NUM_PENS]; - tomahawk_get_pens(pens); + tomahawk_get_pens(screen->machine, pens); video_update_common(bitmap, cliprect, pens); @@ -1177,8 +1177,8 @@ ROM_END static DRIVER_INIT( abattle ) { /* use the protection PROM to decrypt the ROMs */ - UINT8 *rom = memory_region(REGION_CPU1); - UINT8 *prom = memory_region(REGION_USER1); + UINT8 *rom = memory_region(machine, REGION_CPU1); + UINT8 *prom = memory_region(machine, REGION_USER1); int i; for(i = 0xd000; i < 0x10000; i++) @@ -1192,7 +1192,7 @@ static DRIVER_INIT( abattle ) static DRIVER_INIT( afire ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); int i; for(i = 0xd000; i < 0x10000; i++) @@ -1206,7 +1206,7 @@ static DRIVER_INIT( afire ) static DRIVER_INIT( sstarbtl ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); int i; for(i = 0xd000; i < 0x10000; i++) diff --git a/src/mame/drivers/asuka.c b/src/mame/drivers/asuka.c index 0257694164e..06ac89d5b12 100644 --- a/src/mame/drivers/asuka.c +++ b/src/mame/drivers/asuka.c @@ -253,7 +253,7 @@ static INTERRUPT_GEN( cadash_interrupt ) static WRITE8_HANDLER( sound_bankswitch_w ) { - memory_set_bankptr( 1, memory_region(REGION_CPU2) + ((data-1) & 0x03) * 0x4000 + 0x10000 ); + memory_set_bankptr( 1, memory_region(machine, REGION_CPU2) + ((data-1) & 0x03) * 0x4000 + 0x10000 ); } @@ -271,7 +271,7 @@ static void asuka_msm5205_vck(running_machine *machine, int chip) } else { - adpcm_data = memory_region(REGION_SOUND1)[adpcm_pos]; + adpcm_data = memory_region(machine, REGION_SOUND1)[adpcm_pos]; adpcm_pos = (adpcm_pos + 1) & 0xffff; MSM5205_data_w(0, adpcm_data >> 4); } @@ -298,8 +298,8 @@ static WRITE8_HANDLER( asuka_msm5205_stop_w ) static MACHINE_START( asuka ) { /* configure the banks */ - memory_configure_bank(1, 0, 1, memory_region(REGION_CPU2), 0); - memory_configure_bank(1, 1, 3, memory_region(REGION_CPU2) + 0x10000, 0x04000); + memory_configure_bank(1, 0, 1, memory_region(machine, REGION_CPU2), 0); + memory_configure_bank(1, 1, 3, memory_region(machine, REGION_CPU2) + 0x10000, 0x04000); state_save_register_global(adpcm_pos); } diff --git a/src/mame/drivers/atarig42.c b/src/mame/drivers/atarig42.c index c8e0b594ddd..0c634975956 100644 --- a/src/mame/drivers/atarig42.c +++ b/src/mame/drivers/atarig42.c @@ -690,7 +690,7 @@ static DRIVER_INIT( roadriot ) }; atarigen_eeprom_default = default_eeprom; atarijsa_init(machine, "IN2", 0x0040); - atarijsa3_init_adpcm(REGION_SOUND1); + atarijsa3_init_adpcm(machine, REGION_SOUND1); atarig42_playfield_base = 0x400; atarig42_motion_object_base = 0x200; @@ -740,7 +740,7 @@ static DRIVER_INIT( guardian ) }; atarigen_eeprom_default = default_eeprom; atarijsa_init(machine, "IN2", 0x0040); - atarijsa3_init_adpcm(REGION_SOUND1); + atarijsa3_init_adpcm(machine, REGION_SOUND1); atarig42_playfield_base = 0x000; atarig42_motion_object_base = 0x400; @@ -748,7 +748,7 @@ static DRIVER_INIT( guardian ) /* it looks like they jsr to $80000 as some kind of protection */ /* put an RTS there so we don't die */ - *(UINT16 *)&memory_region(REGION_CPU1)[0x80000] = 0x4E75; + *(UINT16 *)&memory_region(machine, REGION_CPU1)[0x80000] = 0x4E75; sloop_base = memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x000000, 0x07ffff, 0, 0, guardians_sloop_data_r, guardians_sloop_data_w); memory_set_opbase_handler(0, sloop_opbase_handler); diff --git a/src/mame/drivers/atarigx2.c b/src/mame/drivers/atarigx2.c index 27b55554014..17aaf9fc893 100644 --- a/src/mame/drivers/atarigx2.c +++ b/src/mame/drivers/atarigx2.c @@ -2040,7 +2040,7 @@ static DRIVER_INIT( spclords ) { atarigen_eeprom_default = NULL; atarijsa_init(machine, "IN2", 0x0040); - atarijsa3_init_adpcm(REGION_SOUND1); + atarijsa3_init_adpcm(machine, REGION_SOUND1); atarigx2_playfield_base = 0x000; atarigx2_motion_object_base = 0x400; @@ -2052,7 +2052,7 @@ static DRIVER_INIT( motofren ) { atarigen_eeprom_default = NULL; atarijsa_init(machine, "IN2", 0x0040); - atarijsa3_init_adpcm(REGION_SOUND1); + atarijsa3_init_adpcm(machine, REGION_SOUND1); atarigx2_playfield_base = 0x400; atarigx2_motion_object_base = 0x200; @@ -2090,7 +2090,7 @@ static DRIVER_INIT( rrreveng ) { atarigen_eeprom_default = NULL; atarijsa_init(machine, "IN2", 0x0040); - atarijsa3_init_adpcm(REGION_SOUND1); + atarijsa3_init_adpcm(machine, REGION_SOUND1); atarigx2_playfield_base = 0x000; atarigx2_motion_object_base = 0x400; diff --git a/src/mame/drivers/atarisy2.c b/src/mame/drivers/atarisy2.c index 0ce25df5ba9..f810f2df43e 100644 --- a/src/mame/drivers/atarisy2.c +++ b/src/mame/drivers/atarisy2.c @@ -353,7 +353,7 @@ static WRITE16_HANDLER( bankselect_w ) COMBINE_DATA(&newword); bankselect[offset] = newword; - base = &memory_region(REGION_CPU1)[bankoffset[(newword >> 10) & 0x3f]]; + base = &memory_region(machine, REGION_CPU1)[bankoffset[(newword >> 10) & 0x3f]]; memcpy(offset ? rombank2 : rombank1, base, 0x2000); } @@ -3030,7 +3030,7 @@ static DRIVER_INIT( paperboy ) 0x0000 }; int i; - UINT8 *cpu1 = memory_region(REGION_CPU1); + UINT8 *cpu1 = memory_region(machine, REGION_CPU1); atarigen_eeprom_default = compressed_default_eeprom; slapstic_init(machine, 105); @@ -3090,7 +3090,7 @@ static DRIVER_INIT( 720 ) static void ssprint_init_common(running_machine *machine, const UINT16 *default_eeprom) { int i; - UINT8 *cpu1 = memory_region(REGION_CPU1); + UINT8 *cpu1 = memory_region(machine, REGION_CPU1); atarigen_eeprom_default = default_eeprom; slapstic_init(machine, 108); @@ -3214,7 +3214,7 @@ static DRIVER_INIT( csprint ) 0x0186,0x0100,0x011B,0x01BC,0x011D,0x011F,0x0000 }; int i; - UINT8 *cpu1 = memory_region(REGION_CPU1); + UINT8 *cpu1 = memory_region(machine, REGION_CPU1); atarigen_eeprom_default = compressed_default_eeprom; slapstic_init(machine, 109); diff --git a/src/mame/drivers/ataxx.c b/src/mame/drivers/ataxx.c index e05c8fb344a..278ae94c5a6 100644 --- a/src/mame/drivers/ataxx.c +++ b/src/mame/drivers/ataxx.c @@ -662,8 +662,8 @@ static DRIVER_INIT( ataxx ) }; ataxx_init_eeprom(0x00, ataxx_eeprom_data, 0x00); - leland_rotate_memory(0); - leland_rotate_memory(1); + leland_rotate_memory(machine, 0); + leland_rotate_memory(machine, 1); /* set up additional input ports */ memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x00, 0x03, 0, 0, ataxx_trackball_r); @@ -685,8 +685,8 @@ static DRIVER_INIT( ataxxj ) }; ataxx_init_eeprom(0x00, ataxxj_eeprom_data, 0x00); - leland_rotate_memory(0); - leland_rotate_memory(1); + leland_rotate_memory(machine, 0); + leland_rotate_memory(machine, 1); /* set up additional input ports */ memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x00, 0x03, 0, 0, ataxx_trackball_r); @@ -708,8 +708,8 @@ static DRIVER_INIT( wsf ) }; ataxx_init_eeprom(0x00, wsf_eeprom_data, 0x00); - leland_rotate_memory(0); - leland_rotate_memory(1); + leland_rotate_memory(machine, 0); + leland_rotate_memory(machine, 1); /* set up additional input ports */ memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x0d, 0x0d, 0, 0, input_port_3_r); @@ -733,8 +733,8 @@ static DRIVER_INIT( indyheat ) }; ataxx_init_eeprom(0x00, indyheat_eeprom_data, 0x00); - leland_rotate_memory(0); - leland_rotate_memory(1); + leland_rotate_memory(machine, 0); + leland_rotate_memory(machine, 1); /* set up additional input ports */ memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x00, 0x02, 0, 0, indyheat_wheel_r); @@ -763,8 +763,8 @@ static DRIVER_INIT( brutforc ) }; ataxx_init_eeprom(0x00, brutforc_eeprom_data, 0x00); - leland_rotate_memory(0); - leland_rotate_memory(1); + leland_rotate_memory(machine, 0); + leland_rotate_memory(machine, 1); /* set up additional input ports */ memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x0d, 0x0d, 0, 0, input_port_3_r); @@ -788,8 +788,8 @@ static DRIVER_INIT( asylum ) }; ataxx_init_eeprom(0x00, asylum_eeprom_data, 0x00); - leland_rotate_memory(0); - leland_rotate_memory(1); + leland_rotate_memory(machine, 0); + leland_rotate_memory(machine, 1); /* asylum appears to have some extra RAM for the slave CPU */ memory_install_readwrite8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0xf000, 0xfffb, 0, 0, SMH_BANK4, SMH_BANK4); diff --git a/src/mame/drivers/atetris.c b/src/mame/drivers/atetris.c index c4d9b48b035..df8f88477f7 100644 --- a/src/mame/drivers/atetris.c +++ b/src/mame/drivers/atetris.c @@ -493,7 +493,7 @@ ROM_END static DRIVER_INIT( atetris ) { - UINT8 *rgn = memory_region(REGION_CPU1); + UINT8 *rgn = memory_region(machine, REGION_CPU1); slapstic_init(machine, 101); slapstic_source = &rgn[0x10000]; slapstic_base = &rgn[0x04000]; diff --git a/src/mame/drivers/backfire.c b/src/mame/drivers/backfire.c index 261647273b0..dc844cb2986 100644 --- a/src/mame/drivers/backfire.c +++ b/src/mame/drivers/backfire.c @@ -642,9 +642,9 @@ ROM_START( backfira ) ROM_LOAD( "mbz-06.19l", 0x200000, 0x080000, CRC(4a38c635) SHA1(7f0fb6a7a4aa6774c04fa38e53ceff8744fe1e9f) ) ROM_END -static void descramble_sound( void ) +static void descramble_sound( running_machine *machine ) { - UINT8 *rom = memory_region(REGION_SOUND1); + UINT8 *rom = memory_region(machine, REGION_SOUND1); int length = 0x200000; // only the first rom is swapped on backfire! UINT8 *buf1 = malloc_or_die(length); UINT32 x; @@ -681,11 +681,11 @@ static READ32_HANDLER( backfire_speedup_r ) static DRIVER_INIT( backfire ) { - deco56_decrypt(REGION_GFX1); /* 141 */ - deco56_decrypt(REGION_GFX2); /* 141 */ - deco156_decrypt(); + deco56_decrypt(machine, REGION_GFX1); /* 141 */ + deco56_decrypt(machine, REGION_GFX2); /* 141 */ + deco156_decrypt(machine); cpunum_set_clockscale(machine, 0, 4.0f); /* core timings aren't accurate */ - descramble_sound(); + descramble_sound(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0170018, 0x017001b, 0, 0, backfire_speedup_r ); } diff --git a/src/mame/drivers/badlands.c b/src/mame/drivers/badlands.c index d6833719ecd..39fa3d2f231 100644 --- a/src/mame/drivers/badlands.c +++ b/src/mame/drivers/badlands.c @@ -520,8 +520,8 @@ static DRIVER_INIT( badlands ) atarigen_eeprom_default = NULL; /* initialize the audio system */ - bank_base = &memory_region(REGION_CPU2)[0x03000]; - bank_source_data = &memory_region(REGION_CPU2)[0x10000]; + bank_base = &memory_region(machine, REGION_CPU2)[0x03000]; + bank_source_data = &memory_region(machine, REGION_CPU2)[0x10000]; } diff --git a/src/mame/drivers/bagman.c b/src/mame/drivers/bagman.c index 3fe8845daca..803b66f6057 100644 --- a/src/mame/drivers/bagman.c +++ b/src/mame/drivers/bagman.c @@ -60,6 +60,7 @@ DIP locations verified for: ***************************************************************************/ #include "driver.h" +#include "deprecat.h" #include "sound/ay8910.h" #include "sound/5110intf.h" #include "sound/tms5110.h" @@ -115,7 +116,7 @@ static void reset_talking (running_machine *machine) static int bagman_speech_rom_read_bit(void) { - UINT8 *ROM = memory_region(REGION_SOUND1); + UINT8 *ROM = memory_region(Machine, REGION_SOUND1); int bit_no = (ls259_buf[0]<<2) | (ls259_buf[1]<<1) | (ls259_buf[2]<<0); int byte = 0; diff --git a/src/mame/drivers/balsente.c b/src/mame/drivers/balsente.c index fa85be30160..2a2f4d97ec2 100644 --- a/src/mame/drivers/balsente.c +++ b/src/mame/drivers/balsente.c @@ -1852,7 +1852,7 @@ ROM_END #define EXPAND_NONE 0x3f #define SWAP_HALVES 0x80 -static void expand_roms(UINT8 cd_rom_mask) +static void expand_roms(running_machine *machine, UINT8 cd_rom_mask) { /* load AB bank data from 0x10000-0x20000 */ /* load CD bank data from 0x20000-0x2e000 */ @@ -1861,8 +1861,8 @@ static void expand_roms(UINT8 cd_rom_mask) UINT8 *temp = malloc_or_die(0x20000); { - UINT8 *rom = memory_region(REGION_CPU1); - UINT32 len = memory_region_length(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); + UINT32 len = memory_region_length(machine, REGION_CPU1); UINT32 base; for (base = 0x10000; base < len; base += 0x30000) @@ -1918,62 +1918,62 @@ static void expand_roms(UINT8 cd_rom_mask) } } -static DRIVER_INIT( sentetst ) { expand_roms(EXPAND_ALL); balsente_shooter = 0; /* noanalog */ } -static DRIVER_INIT( cshift ) { expand_roms(EXPAND_ALL); balsente_shooter = 0; /* noanalog */ } -static DRIVER_INIT( gghost ) { expand_roms(EXPAND_ALL); balsente_shooter = 0; balsente_adc_shift = 1; } -static DRIVER_INIT( hattrick ) { expand_roms(EXPAND_ALL); balsente_shooter = 0; /* noanalog */ } -static DRIVER_INIT( otwalls ) { expand_roms(EXPAND_ALL); balsente_shooter = 0; balsente_adc_shift = 0; } -static DRIVER_INIT( snakepit ) { expand_roms(EXPAND_ALL); balsente_shooter = 0; balsente_adc_shift = 1; } -static DRIVER_INIT( snakjack ) { expand_roms(EXPAND_ALL); balsente_shooter = 0; balsente_adc_shift = 1; } -static DRIVER_INIT( stocker ) { expand_roms(EXPAND_ALL); balsente_shooter = 0; balsente_adc_shift = 0; } -static DRIVER_INIT( triviag1 ) { expand_roms(EXPAND_ALL); balsente_shooter = 0; /* noanalog */ } +static DRIVER_INIT( sentetst ) { expand_roms(machine, EXPAND_ALL); balsente_shooter = 0; /* noanalog */ } +static DRIVER_INIT( cshift ) { expand_roms(machine, EXPAND_ALL); balsente_shooter = 0; /* noanalog */ } +static DRIVER_INIT( gghost ) { expand_roms(machine, EXPAND_ALL); balsente_shooter = 0; balsente_adc_shift = 1; } +static DRIVER_INIT( hattrick ) { expand_roms(machine, EXPAND_ALL); balsente_shooter = 0; /* noanalog */ } +static DRIVER_INIT( otwalls ) { expand_roms(machine, EXPAND_ALL); balsente_shooter = 0; balsente_adc_shift = 0; } +static DRIVER_INIT( snakepit ) { expand_roms(machine, EXPAND_ALL); balsente_shooter = 0; balsente_adc_shift = 1; } +static DRIVER_INIT( snakjack ) { expand_roms(machine, EXPAND_ALL); balsente_shooter = 0; balsente_adc_shift = 1; } +static DRIVER_INIT( stocker ) { expand_roms(machine, EXPAND_ALL); balsente_shooter = 0; balsente_adc_shift = 0; } +static DRIVER_INIT( triviag1 ) { expand_roms(machine, EXPAND_ALL); balsente_shooter = 0; /* noanalog */ } static DRIVER_INIT( triviag2 ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); memcpy(&rom[0x20000], &rom[0x28000], 0x4000); memcpy(&rom[0x24000], &rom[0x28000], 0x4000); - expand_roms(EXPAND_NONE); balsente_shooter = 0; /* noanalog */ + expand_roms(machine, EXPAND_NONE); balsente_shooter = 0; /* noanalog */ } static DRIVER_INIT( triviaes ) { - expand_roms(EXPAND_NONE | SWAP_HALVES); balsente_shooter = 0; /* noanalog */ + expand_roms(machine, EXPAND_NONE | SWAP_HALVES); balsente_shooter = 0; /* noanalog */ } -static DRIVER_INIT( gimeabrk ) { expand_roms(EXPAND_ALL); balsente_shooter = 0; balsente_adc_shift = 1; } -static DRIVER_INIT( minigolf ) { expand_roms(EXPAND_NONE); balsente_shooter = 0; balsente_adc_shift = 2; } -static DRIVER_INIT( minigol2 ) { expand_roms(0x0c); balsente_shooter = 0; balsente_adc_shift = 2; } -static DRIVER_INIT( toggle ) { expand_roms(EXPAND_ALL); balsente_shooter = 0; /* noanalog */ } +static DRIVER_INIT( gimeabrk ) { expand_roms(machine, EXPAND_ALL); balsente_shooter = 0; balsente_adc_shift = 1; } +static DRIVER_INIT( minigolf ) { expand_roms(machine, EXPAND_NONE); balsente_shooter = 0; balsente_adc_shift = 2; } +static DRIVER_INIT( minigol2 ) { expand_roms(machine, 0x0c); balsente_shooter = 0; balsente_adc_shift = 2; } +static DRIVER_INIT( toggle ) { expand_roms(machine, EXPAND_ALL); balsente_shooter = 0; /* noanalog */ } static DRIVER_INIT( nametune ) { memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x9f00, 0x9f00, 0, 0, balsente_rombank2_select_w); - expand_roms(EXPAND_NONE | SWAP_HALVES); balsente_shooter = 0; /* noanalog */ + expand_roms(machine, EXPAND_NONE | SWAP_HALVES); balsente_shooter = 0; /* noanalog */ } static DRIVER_INIT( nstocker ) { memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x9902, 0x9902, 0, 0, nstocker_port2_r); memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x9f00, 0x9f00, 0, 0, balsente_rombank2_select_w); - expand_roms(EXPAND_NONE | SWAP_HALVES); balsente_shooter = 1; balsente_adc_shift = 1; + expand_roms(machine, EXPAND_NONE | SWAP_HALVES); balsente_shooter = 1; balsente_adc_shift = 1; } static DRIVER_INIT( sfootbal ) { memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x9f00, 0x9f00, 0, 0, balsente_rombank2_select_w); - expand_roms(EXPAND_ALL | SWAP_HALVES); balsente_shooter = 0; balsente_adc_shift = 0; + expand_roms(machine, EXPAND_ALL | SWAP_HALVES); balsente_shooter = 0; balsente_adc_shift = 0; } static DRIVER_INIT( spiker ) { memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x9f80, 0x9f8f, 0, 0, spiker_expand_r, spiker_expand_w); memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x9f00, 0x9f00, 0, 0, balsente_rombank2_select_w); - expand_roms(EXPAND_ALL | SWAP_HALVES); balsente_shooter = 0; balsente_adc_shift = 1; + expand_roms(machine, EXPAND_ALL | SWAP_HALVES); balsente_shooter = 0; balsente_adc_shift = 1; } static DRIVER_INIT( stompin ) { memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x9f00, 0x9f00, 0, 0, balsente_rombank2_select_w); - expand_roms(0x0c | SWAP_HALVES); balsente_shooter = 0; balsente_adc_shift = 32; + expand_roms(machine, 0x0c | SWAP_HALVES); balsente_shooter = 0; balsente_adc_shift = 32; } -static DRIVER_INIT( rescraid ) { expand_roms(EXPAND_NONE); balsente_shooter = 0; /* noanalog */ } +static DRIVER_INIT( rescraid ) { expand_roms(machine, EXPAND_NONE); balsente_shooter = 0; /* noanalog */ } static DRIVER_INIT( grudge ) { memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x9400, 0x9400, 0, 0, grudge_steering_r); - expand_roms(EXPAND_NONE); balsente_shooter = 0; + expand_roms(machine, EXPAND_NONE); balsente_shooter = 0; } static DRIVER_INIT( shrike ) { @@ -1981,7 +1981,7 @@ static DRIVER_INIT( shrike ) memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x9e01, 0x9e01, 0, 0, shrike_sprite_select_w ); memory_install_readwrite16_handler(machine, 2, ADDRESS_SPACE_PROGRAM, 0x10000, 0x1001f, 0, 0, shrike_io_68k_r, shrike_io_68k_w); - expand_roms(EXPAND_ALL); balsente_shooter = 0; balsente_adc_shift = 32; + expand_roms(machine, EXPAND_ALL); balsente_shooter = 0; balsente_adc_shift = 32; } diff --git a/src/mame/drivers/baraduke.c b/src/mame/drivers/baraduke.c index 35d1742e8cf..66b600dd41a 100644 --- a/src/mame/drivers/baraduke.c +++ b/src/mame/drivers/baraduke.c @@ -552,7 +552,7 @@ static DRIVER_INIT( baraduke ) int i; /* unpack the third tile ROM */ - rom = memory_region(REGION_GFX2) + 0x8000; + rom = memory_region(machine, REGION_GFX2) + 0x8000; for (i = 0x2000;i < 0x4000;i++) { rom[i + 0x2000] = rom[i]; diff --git a/src/mame/drivers/batman.c b/src/mame/drivers/batman.c index bfaa378d6e5..9c8817bc7b3 100644 --- a/src/mame/drivers/batman.c +++ b/src/mame/drivers/batman.c @@ -354,7 +354,7 @@ static DRIVER_INIT( batman ) }; atarigen_eeprom_default = default_eeprom; atarijsa_init(machine, "260010", 0x0040); - atarijsa3_init_adpcm(REGION_SOUND1); + atarijsa3_init_adpcm(machine, REGION_SOUND1); } diff --git a/src/mame/drivers/battlex.c b/src/mame/drivers/battlex.c index 601008b4836..edaf04f0cfb 100644 --- a/src/mame/drivers/battlex.c +++ b/src/mame/drivers/battlex.c @@ -263,9 +263,9 @@ ROM_END static DRIVER_INIT( battlex ) { - UINT8 *cold = memory_region ( REGION_USER1 ); - UINT8 *mskd = memory_region ( REGION_USER2 ); - UINT8 *dest = memory_region ( REGION_GFX1 ); + UINT8 *cold = memory_region ( machine, REGION_USER1 ); + UINT8 *mskd = memory_region ( machine, REGION_USER2 ); + UINT8 *dest = memory_region ( machine, REGION_GFX1 ); int outcount; diff --git a/src/mame/drivers/battlnts.c b/src/mame/drivers/battlnts.c index ebfa39cd639..d9375cb1350 100644 --- a/src/mame/drivers/battlnts.c +++ b/src/mame/drivers/battlnts.c @@ -34,7 +34,7 @@ static WRITE8_HANDLER( battlnts_sh_irqtrigger_w ) static WRITE8_HANDLER( battlnts_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); int bankaddress; /* bits 6 & 7 = bank number */ @@ -406,7 +406,7 @@ static void shuffle(UINT8 *buf,int len) static DRIVER_INIT( rackemup ) { /* rearrange char ROM */ - shuffle(memory_region(REGION_GFX1),memory_region_length(REGION_GFX1)); + shuffle(memory_region(machine, REGION_GFX1),memory_region_length(machine, REGION_GFX1)); } diff --git a/src/mame/drivers/bbusters.c b/src/mame/drivers/bbusters.c index c4bb5c430f0..dfb2e20c790 100644 --- a/src/mame/drivers/bbusters.c +++ b/src/mame/drivers/bbusters.c @@ -210,7 +210,7 @@ WRITE16_HANDLER( bbuster_video_w ); #if BBUSTERS_HACK static MACHINE_RESET( bbusters ) { - UINT16 *RAM = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *RAM = (UINT16 *)memory_region(machine, REGION_CPU1); int data = input_port_read(machine, "FAKE1") & 0x03; /* Country/Version : @@ -229,7 +229,7 @@ static MACHINE_RESET( bbusters ) #if MECHATT_HACK static MACHINE_RESET( mechatt ) { - UINT16 *RAM = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *RAM = (UINT16 *)memory_region(machine, REGION_CPU1); int data = input_port_read(machine, "FAKE1") & 0x03; /* Country : @@ -936,7 +936,7 @@ ROM_END static void bbusters_patch_code(UINT16 offset) { /* To avoid checksum error */ - UINT16 *RAM = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *RAM = (UINT16 *)memory_region(machine, REGION_CPU1); RAM[(offset + 0)/2] = 0x4e71; RAM[(offset + 2)/2] = 0x4e71; RAM[(offset + 10)/2] = 0x4e71; diff --git a/src/mame/drivers/beathead.c b/src/mame/drivers/beathead.c index 37cc361591a..3c1f97da036 100644 --- a/src/mame/drivers/beathead.c +++ b/src/mame/drivers/beathead.c @@ -512,7 +512,7 @@ static DRIVER_INIT( beathead ) /* initialize the common systems */ atarigen_eeprom_default = NULL; atarijsa_init(machine, "IN2", 0x0040); - atarijsa3_init_adpcm(REGION_SOUND1); + atarijsa3_init_adpcm(machine, REGION_SOUND1); /* prepare the speedups */ speedup_data = memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x00000ae8, 0x00000aeb, 0, 0, speedup_r); diff --git a/src/mame/drivers/bfcobra.c b/src/mame/drivers/bfcobra.c index 716f12f8678..65fb2db3bda 100644 --- a/src/mame/drivers/bfcobra.c +++ b/src/mame/drivers/bfcobra.c @@ -387,14 +387,14 @@ INLINE UINT8* blitter_get_addr(UINT32 addr) if (addr < 0x10000) { /* Is this region fixed? */ - return (UINT8*)(memory_region(REGION_USER1) + addr); + return (UINT8*)(memory_region(Machine, REGION_USER1) + addr); } else if(addr < 0x20000) { addr &= 0xffff; addr += (bank[0] & 1) ? 0x10000 : 0; - return (UINT8*)(memory_region(REGION_USER1) + addr + ((bank[0] >> 1) * 0x20000)); + return (UINT8*)(memory_region(Machine, REGION_USER1) + addr + ((bank[0] >> 1) * 0x20000)); } else if (addr >= 0x20000 && addr < 0x40000) { @@ -978,7 +978,7 @@ INLINE void z80_bank(int num, int data) UINT32 offset = ((bank[0] >> 1) * 0x20000) + offs_table[bank[0] & 0x1][data]; - memory_set_bankptr(num, memory_region(REGION_USER1) + offset); + memory_set_bankptr(num, memory_region(Machine, REGION_USER1) + offset); } else if (data < 0x10) { @@ -1116,7 +1116,7 @@ static READ8_HANDLER( fddata_r ) } fdc.offset = (BPT * fdc.track*2) + (fdc.side ? BPT : 0) + (BPS * (fdc.sector-1)) + fdc.byte_pos++; - val = *(memory_region(REGION_USER2) + fdc.offset); + val = *(memory_region(machine, REGION_USER2) + fdc.offset); /* Move on to next sector? */ if (fdc.byte_pos == 1024) @@ -1645,7 +1645,7 @@ static DRIVER_INIT( bfcobra ) UINT8 *tmp; tmp = malloc_or_die(0x8000); - rom = memory_region(REGION_CPU2) + 0x8000; + rom = memory_region(machine, REGION_CPU2) + 0x8000; memcpy(tmp, rom, 0x8000); for (i = 0; i < 0x8000; i++) @@ -1674,7 +1674,7 @@ static DRIVER_INIT( bfcobra ) bank[3] = 0; /* Fixed 16kB ROM region */ - memory_set_bankptr(4, memory_region(REGION_USER1)); + memory_set_bankptr(4, memory_region(machine, REGION_USER1)); /* Configure the ACIAs */ acia6850_config(0, &z80_acia_if); diff --git a/src/mame/drivers/bfm_sc2.c b/src/mame/drivers/bfm_sc2.c index 1d03397668f..bb01e1861c3 100644 --- a/src/mame/drivers/bfm_sc2.c +++ b/src/mame/drivers/bfm_sc2.c @@ -304,7 +304,7 @@ static int get_scorpion2_uart_status(void) // called if board is reset /////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// -static void on_scorpion2_reset(void) +static void on_scorpion2_reset(running_machine *machine) { vfd1_latch = 0; vfd2_latch = 0; @@ -372,7 +372,7 @@ send data to them, although obviously there's no response. */ // init rom bank //////////////////////////////////////////////////////// { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); memory_configure_bank(1, 0, 1, &rom[0x10000], 0); memory_configure_bank(1, 1, 3, &rom[0x02000], 0x02000); @@ -512,7 +512,7 @@ static INTERRUPT_GEN( timer_irq ) if ( watchdog_cnt > 2 ) // this is a hack, i don't know what the watchdog timeout is, 3 IRQ's works fine { // reset board mame_schedule_soft_reset(machine); // reset entire machine. CPU 0 should be enough, but that doesn't seem to work !! - on_scorpion2_reset(); + on_scorpion2_reset(machine); return; } } @@ -1429,11 +1429,11 @@ static const UINT8 DataDecode[]= static UINT8 codec_data[256]; /////////////////////////////////////////////////////////////////////////// -static void decode_mainrom(int rom_region) +static void decode_mainrom(running_machine *machine, int rom_region) { UINT8 *tmp, *rom; - rom = memory_region(rom_region); + rom = memory_region(machine, rom_region); tmp = malloc_or_die(0x10000); { @@ -1489,7 +1489,7 @@ static MACHINE_RESET( init ) // reset the board ////////////////////////////////////////////////////// - on_scorpion2_reset(); + on_scorpion2_reset(machine); BFM_BD1_init(0); BFM_BD1_init(1); //BFM_dm01_reset(); No known video based game has a Matrix board @@ -2260,13 +2260,13 @@ static MACHINE_DRIVER_START( scorpion2_vid ) MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_DRIVER_END -static void sc2_common_init(void) +static void sc2_common_init(running_machine *machine) { UINT8 *rom; - decode_mainrom(REGION_CPU1); // decode main rom + decode_mainrom(machine, REGION_CPU1); // decode main rom - rom = memory_region(REGION_CPU1); + rom = memory_region(machine, REGION_CPU1); if ( rom ) { memcpy(&rom[0x10000], &rom[0x00000], 0x2000); @@ -2275,11 +2275,11 @@ static void sc2_common_init(void) memset(sc2_Inputs, 0, sizeof(sc2_Inputs)); // clear all inputs } -static void adder2_common_init(void) +static void adder2_common_init(running_machine *machine) { UINT8 *pal; - pal = memory_region(REGION_PROMS); + pal = memory_region(machine, REGION_PROMS); if ( pal ) { memcpy(key, pal, 8); @@ -2290,8 +2290,8 @@ static void adder2_common_init(void) static DRIVER_INIT (quintoon) { - sc2_common_init(); - adder2_decode_char_roms(); + sc2_common_init(machine); + adder2_decode_char_roms(machine); Mechmtr_init(8); // setup mech meters has_hopper = 0; @@ -2311,9 +2311,9 @@ static DRIVER_INIT (quintoon) static DRIVER_INIT( pyramid ) { - sc2_common_init(); - adder2_decode_char_roms(); // decode GFX roms - adder2_common_init(); + sc2_common_init(machine); + adder2_decode_char_roms(machine); // decode GFX roms + adder2_common_init(machine); has_hopper = 1; @@ -2328,9 +2328,9 @@ static DRIVER_INIT( pyramid ) static DRIVER_INIT( sltsbelg ) { - sc2_common_init(); - adder2_decode_char_roms(); // decode GFX roms - adder2_common_init(); + sc2_common_init(machine); + adder2_decode_char_roms(machine); // decode GFX roms + adder2_common_init(machine); has_hopper = 1; @@ -2342,9 +2342,9 @@ static DRIVER_INIT( sltsbelg ) static DRIVER_INIT( adder_dutch ) { - sc2_common_init(); - adder2_decode_char_roms(); // decode GFX roms - adder2_common_init(); + sc2_common_init(machine); + adder2_decode_char_roms(machine); // decode GFX roms + adder2_common_init(machine); has_hopper = 0; @@ -2360,9 +2360,9 @@ static DRIVER_INIT( adder_dutch ) static DRIVER_INIT( gldncrwn ) { - sc2_common_init(); - adder2_decode_char_roms(); // decode GFX roms - adder2_common_init(); + sc2_common_init(machine); + adder2_decode_char_roms(machine); // decode GFX roms + adder2_common_init(machine); has_hopper = 0; diff --git a/src/mame/drivers/bigevglf.c b/src/mame/drivers/bigevglf.c index 6eb1e599a8c..7e373d68a72 100644 --- a/src/mame/drivers/bigevglf.c +++ b/src/mame/drivers/bigevglf.c @@ -77,7 +77,7 @@ static WRITE8_HANDLER( beg_banking_w ) /* d0-d3 connect to A11-A14 of the ROMs (via ls273 latch) d4-d7 select one of ROMs (via ls273(above) and then ls154) */ - memory_set_bankptr(1, memory_region(REGION_CPU1) + 0x10000 + 0x800*(beg_bank&0xff)); /* empty sockets for IC37-IC44 ROMS */ + memory_set_bankptr(1, memory_region(machine, REGION_CPU1) + 0x10000 + 0x800*(beg_bank&0xff)); /* empty sockets for IC37-IC44 ROMS */ } static TIMER_CALLBACK( from_sound_latch_callback ) diff --git a/src/mame/drivers/bigfghtr.c b/src/mame/drivers/bigfghtr.c index ae946f584b4..ec9b759593d 100644 --- a/src/mame/drivers/bigfghtr.c +++ b/src/mame/drivers/bigfghtr.c @@ -539,7 +539,7 @@ INPUT_PORTS_END static DRIVER_INIT( skyrobo ) { //RAM TESTS - UINT16 *RAM = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *RAM = (UINT16 *)memory_region(machine, REGION_CPU1); RAM[0x2e822/2] = 0x4ef9; RAM[0x2e824/2] = 0x0002; RAM[0x2e826/2] = 0xe9ae; @@ -550,7 +550,7 @@ static DRIVER_INIT( skyrobo ) static DRIVER_INIT( bigfghtr ) { //RAM TESTS - UINT16 *RAM = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *RAM = (UINT16 *)memory_region(machine, REGION_CPU1); RAM[0x2e8cc/2] = 0x4ef9; RAM[0x2e8ce/2] = 0x0002; RAM[0x2e8d0/2] = 0xea58; diff --git a/src/mame/drivers/bishjan.c b/src/mame/drivers/bishjan.c index bf38ab95baf..94dd9bef2b1 100644 --- a/src/mame/drivers/bishjan.c +++ b/src/mame/drivers/bishjan.c @@ -481,7 +481,7 @@ ROM_END static DRIVER_INIT(bishjan) { - UINT16 *rom = (UINT16*)memory_region(REGION_CPU1); + UINT16 *rom = (UINT16*)memory_region(machine, REGION_CPU1); // check rom[0x042EA/2] = 0x4008; diff --git a/src/mame/drivers/bking.c b/src/mame/drivers/bking.c index 3ddd45bd6f0..9e959ffe0b1 100644 --- a/src/mame/drivers/bking.c +++ b/src/mame/drivers/bking.c @@ -99,7 +99,7 @@ static WRITE8_HANDLER( bking3_addr_h_w ) static READ8_HANDLER( bking3_extrarom_r ) { - UINT8 *rom = memory_region(REGION_USER2); + UINT8 *rom = memory_region(machine, REGION_USER2); return rom[bking3_addr_h * 256 + bking3_addr_l]; } diff --git a/src/mame/drivers/bladestl.c b/src/mame/drivers/bladestl.c index ae9d3ec6a96..4f3a1d27434 100644 --- a/src/mame/drivers/bladestl.c +++ b/src/mame/drivers/bladestl.c @@ -65,7 +65,7 @@ static READ8_HANDLER( trackball_r ) static WRITE8_HANDLER( bladestl_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); int bankaddress; /* bits 0 & 1 = coin counters */ diff --git a/src/mame/drivers/blktiger.c b/src/mame/drivers/blktiger.c index b5fd2e40b8c..f86ceb689e3 100644 --- a/src/mame/drivers/blktiger.c +++ b/src/mame/drivers/blktiger.c @@ -246,7 +246,7 @@ static const struct YM2203interface ym2203_interface = static MACHINE_START( blktiger ) { /* configure bankswitching */ - memory_configure_bank(1, 0, 16, memory_region(REGION_CPU1) + 0x10000, 0x4000); + memory_configure_bank(1, 0, 16, memory_region(machine, REGION_CPU1) + 0x10000, 0x4000); } static MACHINE_DRIVER_START( blktiger ) diff --git a/src/mame/drivers/blmbycar.c b/src/mame/drivers/blmbycar.c index c361863f42f..b3d6119d752 100644 --- a/src/mame/drivers/blmbycar.c +++ b/src/mame/drivers/blmbycar.c @@ -56,7 +56,7 @@ static WRITE16_HANDLER( blmbycar_okibank_w ) { if (ACCESSING_BITS_0_7) { - UINT8 *RAM = memory_region(REGION_SOUND1); + UINT8 *RAM = memory_region(machine, REGION_SOUND1); memcpy(&RAM[0x30000],&RAM[0x40000 + 0x10000*(data & 0xf)],0x10000); } } @@ -532,8 +532,8 @@ ROM_END static DRIVER_INIT( blmbycar ) { - UINT16 *RAM = (UINT16 *) memory_region(REGION_CPU1); - size_t size = memory_region_length(REGION_CPU1) / 2; + UINT16 *RAM = (UINT16 *) memory_region(machine, REGION_CPU1); + size_t size = memory_region_length(machine, REGION_CPU1) / 2; int i; for (i = 0; i < size; i++) diff --git a/src/mame/drivers/blockhl.c b/src/mame/drivers/blockhl.c index 613d86963b2..a451ba8ddde 100644 --- a/src/mame/drivers/blockhl.c +++ b/src/mame/drivers/blockhl.c @@ -20,6 +20,7 @@ found it. ***************************************************************************/ #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/2151intf.h" @@ -304,7 +305,7 @@ ROM_END static void blockhl_banking( int lines ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(Machine, REGION_CPU1); int offs; /* bits 0-1 = ROM bank */ @@ -331,7 +332,7 @@ static void blockhl_banking( int lines ) static MACHINE_RESET( blockhl ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); cpunum_set_info_fct(0, CPUINFO_PTR_KONAMI_SETLINES_CALLBACK, (genf *)blockhl_banking); diff --git a/src/mame/drivers/bloodbro.c b/src/mame/drivers/bloodbro.c index f927aeb3b49..cd935cf088e 100644 --- a/src/mame/drivers/bloodbro.c +++ b/src/mame/drivers/bloodbro.c @@ -632,8 +632,8 @@ ROM_END static DRIVER_INIT( weststry ) { - UINT8 *gfx = memory_region(REGION_GFX3); - int len = memory_region_length(REGION_GFX3); + UINT8 *gfx = memory_region(machine, REGION_GFX3); + int len = memory_region_length(machine, REGION_GFX3); int i; // invert sprite data diff --git a/src/mame/drivers/bnstars.c b/src/mame/drivers/bnstars.c index 2136cff1db7..b0e35e3aa12 100644 --- a/src/mame/drivers/bnstars.c +++ b/src/mame/drivers/bnstars.c @@ -1445,14 +1445,14 @@ ROM_END /* SS92046_01: bbbxing, f1superb, tetrisp, hayaosi1 */ static DRIVER_INIT (bnstars) { - ms32_rearrange_sprites(REGION_GFX1); + ms32_rearrange_sprites(machine, REGION_GFX1); - decrypt_ms32_tx(0x00020,0x7e, REGION_GFX5); - decrypt_ms32_bg(0x00001,0x9b, REGION_GFX4); - decrypt_ms32_tx(0x00020,0x7e, REGION_GFX7); - decrypt_ms32_bg(0x00001,0x9b, REGION_GFX6); + decrypt_ms32_tx(machine, 0x00020,0x7e, REGION_GFX5); + decrypt_ms32_bg(machine, 0x00001,0x9b, REGION_GFX4); + decrypt_ms32_tx(machine, 0x00020,0x7e, REGION_GFX7); + decrypt_ms32_bg(machine, 0x00001,0x9b, REGION_GFX6); - memory_set_bankptr(1, memory_region(REGION_CPU1)); + memory_set_bankptr(1, memory_region(machine, REGION_CPU1)); } GAME( 1997, bnstars1, 0, bnstars, bnstars, bnstars, ROT0, "Jaleco", "Vs. Janshi Brandnew Stars", GAME_NO_SOUND ) diff --git a/src/mame/drivers/boogwing.c b/src/mame/drivers/boogwing.c index 77fc414bceb..d7507c78d26 100644 --- a/src/mame/drivers/boogwing.c +++ b/src/mame/drivers/boogwing.c @@ -479,14 +479,14 @@ ROM_END static DRIVER_INIT( boogwing ) { - const UINT8* src=memory_region(REGION_GFX6); - UINT8* dst=memory_region(REGION_GFX2) + 0x200000; - - deco56_decrypt(REGION_GFX1); - deco56_decrypt(REGION_GFX2); - deco56_decrypt(REGION_GFX3); - deco56_remap(REGION_GFX6); - deco102_decrypt(REGION_CPU1, 0x42ba, 0x00, 0x18); + const UINT8* src=memory_region(machine, REGION_GFX6); + UINT8* dst=memory_region(machine, REGION_GFX2) + 0x200000; + + deco56_decrypt(machine, REGION_GFX1); + deco56_decrypt(machine, REGION_GFX2); + deco56_decrypt(machine, REGION_GFX3); + deco56_remap(machine, REGION_GFX6); + deco102_decrypt(machine, REGION_CPU1, 0x42ba, 0x00, 0x18); memcpy(dst, src, 0x100000); } diff --git a/src/mame/drivers/bottom9.c b/src/mame/drivers/bottom9.c index afe383a1c66..1e352d9f896 100644 --- a/src/mame/drivers/bottom9.c +++ b/src/mame/drivers/bottom9.c @@ -64,7 +64,7 @@ static WRITE8_HANDLER( bottom9_bankedram2_w ) static WRITE8_HANDLER( bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); int offs; /* bit 0 = RAM bank */ diff --git a/src/mame/drivers/btime.c b/src/mame/drivers/btime.c index ae3d4746098..24bbea66b93 100644 --- a/src/mame/drivers/btime.c +++ b/src/mame/drivers/btime.c @@ -83,12 +83,12 @@ static void btime_decrypt(void) /* however if the previous instruction was JSR (which caused a write to */ /* the stack), fetch the address of the next instruction. */ addr1 = activecpu_get_previouspc(); - src1 = (addr1 < 0x9000) ? rambase : memory_region(REGION_CPU1); + src1 = (addr1 < 0x9000) ? rambase : memory_region(Machine, REGION_CPU1); if (decrypted[addr1] == 0x20) /* JSR $xxxx */ addr = src1[addr1+1] + 256 * src1[addr1+2]; /* If the address of the next instruction is xxxx xxx1 xxxx x1xx, decode it. */ - src = (addr < 0x9000) ? rambase : memory_region(REGION_CPU1); + src = (addr < 0x9000) ? rambase : memory_region(Machine, REGION_CPU1); if ((addr & 0x0104) == 0x0104) { /* 76543210 -> 65342710 bit rotation */ @@ -1629,7 +1629,7 @@ ROM_END static void decrypt_C10707_cpu(int cpu, int region) { UINT8 *decrypt = auto_malloc(0x10000); - UINT8 *rom = memory_region(region); + UINT8 *rom = memory_region(Machine, region); offs_t addr; memory_set_decrypted_region(cpu, 0x0000, 0xffff, decrypt); @@ -1644,7 +1644,7 @@ static void decrypt_C10707_cpu(int cpu, int region) static READ8_HANDLER( wtennis_reset_hack_r ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); /* Otherwise the game goes into test mode and there is no way out that I can see. I'm not sure how it can work, it probably somehow has to do @@ -1657,7 +1657,7 @@ static READ8_HANDLER( wtennis_reset_hack_r ) static void init_rom1(void) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(Machine, REGION_CPU1); decrypted = auto_malloc(0x10000); memory_set_decrypted_region(0, 0x0000, 0xffff, decrypted); @@ -1675,7 +1675,7 @@ static DRIVER_INIT( btime ) static DRIVER_INIT( zoar ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); /* At location 0xD50A is what looks like an undocumented opcode. I tried implementing it given what opcode 0x23 should do, but it still didn't @@ -1693,13 +1693,13 @@ static DRIVER_INIT( lnc ) static DRIVER_INIT( cookrace ) { - memcpy(&audio_rambase[0x200], memory_region(REGION_CPU2) + 0xf200, 0x200); + memcpy(&audio_rambase[0x200], memory_region(machine, REGION_CPU2) + 0xf200, 0x200); decrypt_C10707_cpu(0, REGION_CPU1); } static DRIVER_INIT( wtennis ) { - memcpy(&audio_rambase[0x200], memory_region(REGION_CPU2) + 0xf200, 0x200); + memcpy(&audio_rambase[0x200], memory_region(machine, REGION_CPU2) + 0xf200, 0x200); memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc15f, 0xc15f, 0, 0, wtennis_reset_hack_r); decrypt_C10707_cpu(0, REGION_CPU1); } diff --git a/src/mame/drivers/bublbobl.c b/src/mame/drivers/bublbobl.c index 512a33b8f2e..9ba6660374a 100644 --- a/src/mame/drivers/bublbobl.c +++ b/src/mame/drivers/bublbobl.c @@ -1272,7 +1272,7 @@ ROM_END static DRIVER_INIT( bublbobl ) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); /* in Bubble Bobble, bank 0 has code falling from 7fff to 8000, */ /* so I have to copy it there because bank switching wouldn't catch it */ diff --git a/src/mame/drivers/buggychl.c b/src/mame/drivers/buggychl.c index 062fab81e84..0e1a7ccbacd 100644 --- a/src/mame/drivers/buggychl.c +++ b/src/mame/drivers/buggychl.c @@ -88,7 +88,7 @@ dcxx = /SPOSI (S36) static WRITE8_HANDLER( bankswitch_w ) { - memory_set_bankptr(1,&memory_region(REGION_CPU1)[0x10000 + (data & 7) * 0x2000]); + memory_set_bankptr(1,&memory_region(machine, REGION_CPU1)[0x10000 + (data & 7) * 0x2000]); } diff --git a/src/mame/drivers/bwing.c b/src/mame/drivers/bwing.c index df8ad9ebb93..4ea8d19515f 100644 --- a/src/mame/drivers/bwing.c +++ b/src/mame/drivers/bwing.c @@ -613,9 +613,9 @@ static void fix_bwp3(void) static DRIVER_INIT( bwing ) { - bwp123_membase[0] = memory_region(REGION_CPU1); - bwp123_membase[1] = memory_region(REGION_CPU2); - bwp123_membase[2] = memory_region(REGION_CPU3); + bwp123_membase[0] = memory_region(machine, REGION_CPU1); + bwp123_membase[1] = memory_region(machine, REGION_CPU2); + bwp123_membase[2] = memory_region(machine, REGION_CPU3); fix_bwp3(); } diff --git a/src/mame/drivers/cabal.c b/src/mame/drivers/cabal.c index 62eb72b9998..54cb2f4e2ab 100644 --- a/src/mame/drivers/cabal.c +++ b/src/mame/drivers/cabal.c @@ -843,8 +843,8 @@ ROM_END static DRIVER_INIT( cabal ) { - seibu_sound_decrypt(REGION_CPU2,0x2000); - seibu_adpcm_decrypt(REGION_SOUND1); + seibu_sound_decrypt(machine,REGION_CPU2,0x2000); + seibu_adpcm_decrypt(machine,REGION_SOUND1); } diff --git a/src/mame/drivers/calomega.c b/src/mame/drivers/calomega.c index dbf9ab23bde..f1f2f1e9176 100644 --- a/src/mame/drivers/calomega.c +++ b/src/mame/drivers/calomega.c @@ -2904,7 +2904,7 @@ static DRIVER_INIT( standard ) { /* background color is adjusted through RGB pots */ int x; - UINT8 *BPR = memory_region( REGION_PROMS ); + UINT8 *BPR = memory_region( machine, REGION_PROMS ); for (x = 0x0000; x < 0x0400; x++) { @@ -2916,7 +2916,7 @@ static DRIVER_INIT( standard ) static DRIVER_INIT( elgrande ) { int x; - UINT8 *BPR = memory_region( REGION_PROMS ); + UINT8 *BPR = memory_region( machine, REGION_PROMS ); /* background color is adjusted through RGB pots */ for (x = 0x0000; x < 0x0400; x++) @@ -2930,7 +2930,7 @@ static DRIVER_INIT( jjpoker ) { /* background color is adjusted through RGB pots */ int x; - UINT8 *BPR = memory_region( REGION_PROMS ); + UINT8 *BPR = memory_region( machine, REGION_PROMS ); for (x = 0x0000; x < 0x0400; x++) { diff --git a/src/mame/drivers/calorie.c b/src/mame/drivers/calorie.c index 7f4f5b65b4b..976218d3f28 100644 --- a/src/mame/drivers/calorie.c +++ b/src/mame/drivers/calorie.c @@ -89,7 +89,7 @@ static tilemap *bg_tilemap,*fg_tilemap; static TILE_GET_INFO( get_bg_tile_info ) { - UINT8 *src = memory_region(REGION_USER1); + UINT8 *src = memory_region(machine, REGION_USER1); int bg_base = (calorie_bg & 0x0f) * 0x200; int code = src[bg_base + tile_index] | (((src[bg_base + tile_index + 0x100]) & 0x10) << 4); int color = src[bg_base + tile_index + 0x100] & 0x0f; @@ -458,12 +458,12 @@ ROM_END static DRIVER_INIT( calorie ) { - calorie_decode(); + calorie_decode(machine); } static DRIVER_INIT( calorieb ) { - memory_set_decrypted_region(0, 0x0000, 0x7fff, memory_region(REGION_CPU1) + 0x10000); + memory_set_decrypted_region(0, 0x0000, 0x7fff, memory_region(machine, REGION_CPU1) + 0x10000); } diff --git a/src/mame/drivers/capbowl.c b/src/mame/drivers/capbowl.c index cc1615647fb..02659926e01 100644 --- a/src/mame/drivers/capbowl.c +++ b/src/mame/drivers/capbowl.c @@ -149,7 +149,7 @@ static MACHINE_RESET( capbowl ) static WRITE8_HANDLER( capbowl_rom_select_w ) { int bankaddress = ((data & 0x0c) << 13) + ((data & 0x01) << 14); - memory_set_bankptr(1, memory_region(REGION_CPU1) + 0x10000 + bankaddress); + memory_set_bankptr(1, memory_region(machine, REGION_CPU1) + 0x10000 + bankaddress); } diff --git a/src/mame/drivers/carpolo.c b/src/mame/drivers/carpolo.c index 74db3330bde..73217f68c0a 100644 --- a/src/mame/drivers/carpolo.c +++ b/src/mame/drivers/carpolo.c @@ -316,8 +316,8 @@ static DRIVER_INIT( carpolo ) /* invert gfx PROM since the bits are active LO */ - ROM = memory_region(REGION_GFX2); - len = memory_region_length(REGION_GFX2); + ROM = memory_region(machine, REGION_GFX2); + len = memory_region_length(machine, REGION_GFX2); for (i = 0;i < len; i++) ROM[i] ^= 0x0f; } diff --git a/src/mame/drivers/carrera.c b/src/mame/drivers/carrera.c index 51d6aeccf24..7522d92fcb4 100644 --- a/src/mame/drivers/carrera.c +++ b/src/mame/drivers/carrera.c @@ -282,7 +282,7 @@ static const struct AY8910interface ay8910_interface = static PALETTE_INIT(carrera) { int x; - UINT8 *src = memory_region ( REGION_PROMS ); + UINT8 *src = memory_region ( machine, REGION_PROMS ); for (x=0;x<32;x++) palette_set_color_rgb(machine, x, pal3bit(src[x] >> 0), pal3bit(src[x] >> 3), pal2bit(src[x] >> 6)); diff --git a/src/mame/drivers/cave.c b/src/mame/drivers/cave.c index 7dad95ca320..e1e4654be94 100644 --- a/src/mame/drivers/cave.c +++ b/src/mame/drivers/cave.c @@ -1176,7 +1176,7 @@ ADDRESS_MAP_END static WRITE8_HANDLER( hotdogst_rombank_w ) { - UINT8 *RAM = memory_region(REGION_CPU2); + UINT8 *RAM = memory_region(machine, REGION_CPU2); int bank = data & 0x0f; if ( data & ~0x0f ) logerror("CPU #1 - PC %04X: Bank %02X\n",activecpu_get_pc(),data); if (bank > 1) bank+=2; @@ -1185,7 +1185,7 @@ static WRITE8_HANDLER( hotdogst_rombank_w ) static WRITE8_HANDLER( hotdogst_okibank_w ) { - UINT8 *RAM = memory_region(REGION_SOUND1); + UINT8 *RAM = memory_region(machine, REGION_SOUND1); int bank1 = (data >> 0) & 0x3; int bank2 = (data >> 4) & 0x3; memcpy(RAM + 0x20000 * 0, RAM + 0x40000 + 0x20000 * bank1, 0x20000); @@ -1229,7 +1229,7 @@ ADDRESS_MAP_END static WRITE8_HANDLER( mazinger_rombank_w ) { - UINT8 *RAM = memory_region(REGION_CPU2); + UINT8 *RAM = memory_region(machine, REGION_CPU2); int bank = data & 0x07; if ( data & ~0x07 ) logerror("CPU #1 - PC %04X: Bank %02X\n",activecpu_get_pc(),data); if (bank > 1) bank+=2; @@ -1273,7 +1273,7 @@ ADDRESS_MAP_END static WRITE8_HANDLER( metmqstr_rombank_w ) { - UINT8 *ROM = memory_region(REGION_CPU2); + UINT8 *ROM = memory_region(machine, REGION_CPU2); int bank = data & 0xf; if ( bank != data ) logerror("CPU #1 - PC %04X: Bank %02X\n",activecpu_get_pc(),data); if (bank >= 2) bank += 2; @@ -1282,7 +1282,7 @@ static WRITE8_HANDLER( metmqstr_rombank_w ) static WRITE8_HANDLER( metmqstr_okibank0_w ) { - UINT8 *ROM = memory_region(REGION_SOUND1); + UINT8 *ROM = memory_region(machine, REGION_SOUND1); int bank1 = (data >> 0) & 0x7; int bank2 = (data >> 4) & 0x7; memcpy(ROM + 0x20000 * 0, ROM + 0x40000 + 0x20000 * bank1, 0x20000); @@ -1291,7 +1291,7 @@ static WRITE8_HANDLER( metmqstr_okibank0_w ) static WRITE8_HANDLER( metmqstr_okibank1_w ) { - UINT8 *ROM = memory_region(REGION_SOUND2); + UINT8 *ROM = memory_region(machine, REGION_SOUND2); int bank1 = (data >> 0) & 0x7; int bank2 = (data >> 4) & 0x7; memcpy(ROM + 0x20000 * 0, ROM + 0x40000 + 0x20000 * bank1, 0x20000); @@ -1336,7 +1336,7 @@ ADDRESS_MAP_END static WRITE8_HANDLER( pwrinst2_rombank_w ) { - UINT8 *ROM = memory_region(REGION_CPU2); + UINT8 *ROM = memory_region(machine, REGION_CPU2); int bank = data & 0x07; if ( data & ~0x07 ) logerror("CPU #1 - PC %04X: Bank %02X\n",activecpu_get_pc(),data); if (bank > 2) bank+=1; @@ -1394,7 +1394,7 @@ static WRITE8_HANDLER( mirror_ram_w ) static WRITE8_HANDLER( sailormn_rombank_w ) { - UINT8 *RAM = memory_region(REGION_CPU2); + UINT8 *RAM = memory_region(machine, REGION_CPU2); int bank = data & 0x1f; if ( data & ~0x1f ) logerror("CPU #1 - PC %04X: Bank %02X\n",activecpu_get_pc(),data); if (bank > 1) bank+=2; @@ -1403,7 +1403,7 @@ static WRITE8_HANDLER( sailormn_rombank_w ) static WRITE8_HANDLER( sailormn_okibank0_w ) { - UINT8 *RAM = memory_region(REGION_SOUND1); + UINT8 *RAM = memory_region(machine, REGION_SOUND1); int bank1 = (data >> 0) & 0xf; int bank2 = (data >> 4) & 0xf; memcpy(RAM + 0x20000 * 0, RAM + 0x40000 + 0x20000 * bank1, 0x20000); @@ -1412,7 +1412,7 @@ static WRITE8_HANDLER( sailormn_okibank0_w ) static WRITE8_HANDLER( sailormn_okibank1_w ) { - UINT8 *RAM = memory_region(REGION_SOUND2); + UINT8 *RAM = memory_region(machine, REGION_SOUND2); int bank1 = (data >> 0) & 0xf; int bank2 = (data >> 4) & 0xf; memcpy(RAM + 0x20000 * 0, RAM + 0x40000 + 0x20000 * bank1, 0x20000); @@ -2598,12 +2598,12 @@ MACHINE_DRIVER_END ***************************************************************************/ /* 4 bits -> 8 bits. Even and odd pixels are swapped */ -static void unpack_sprites(void) +static void unpack_sprites(running_machine *machine) { const int region = REGION_GFX1; // sprites - const UINT32 len = memory_region_length(region); - UINT8 *rgn = memory_region(region); + const UINT32 len = memory_region_length(machine, region); + UINT8 *rgn = memory_region(machine, region); UINT8 *src = rgn + len / 2 - 1; UINT8 *dst = rgn + len - 1; @@ -2617,12 +2617,12 @@ static void unpack_sprites(void) /* 4 bits -> 8 bits. Even and odd pixels and even and odd words, are swapped */ -static void ddonpach_unpack_sprites(void) +static void ddonpach_unpack_sprites(running_machine *machine) { const int region = REGION_GFX1; // sprites - const UINT32 len = memory_region_length(region); - UINT8 *rgn = memory_region(region); + const UINT32 len = memory_region_length(machine, region); + UINT8 *rgn = memory_region(machine, region); UINT8 *src = rgn + len / 2 - 1; UINT8 *dst = rgn + len - 1; @@ -2643,12 +2643,12 @@ static void ddonpach_unpack_sprites(void) /* 2 pages of 4 bits -> 8 bits */ -static void esprade_unpack_sprites(void) +static void esprade_unpack_sprites(running_machine *machine) { const int region = REGION_GFX1; // sprites - UINT8 *src = memory_region(region); - UINT8 *dst = src + memory_region_length(region); + UINT8 *src = memory_region(machine, region); + UINT8 *dst = src + memory_region_length(machine, region); while(src < dst) { @@ -4047,10 +4047,10 @@ ROM_END /* Tiles are 6 bit, 4 bits stored in one rom, 2 bits in the other. Expand the 2 bit part into a 4 bit layout, so we can decode it */ -static void sailormn_unpack_tiles( const int region ) +static void sailormn_unpack_tiles( running_machine *machine, const int region ) { - const UINT32 len = memory_region_length(region); - UINT8 *rgn = memory_region(region); + const UINT32 len = memory_region_length(machine, region); + UINT8 *rgn = memory_region(machine, region); UINT8 *src = rgn + (len/4)*3 - 1; UINT8 *dst = rgn + (len/4)*4 - 2; @@ -4085,13 +4085,13 @@ static DRIVER_INIT( agallet ) { init_cave(machine); - sailormn_unpack_tiles( REGION_GFX4 ); + sailormn_unpack_tiles( machine, REGION_GFX4 ); cave_default_eeprom = cave_default_eeprom_type7; cave_default_eeprom_length = sizeof(cave_default_eeprom_type7); cave_region_byte = 0x1f; - unpack_sprites(); + unpack_sprites(machine); // Speed Hack memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xb80000, 0xb80001, 0, 0, agallet_irq_cause_r); @@ -4105,7 +4105,7 @@ static DRIVER_INIT( dfeveron ) cave_default_eeprom_length = sizeof(cave_default_eeprom_type1); cave_region_byte = -1; - unpack_sprites(); + unpack_sprites(machine); cave_kludge = 2; } @@ -4117,7 +4117,7 @@ static DRIVER_INIT( feversos ) cave_default_eeprom_length = sizeof(cave_default_eeprom_type1feversos); cave_region_byte = -1; - unpack_sprites(); + unpack_sprites(machine); cave_kludge = 2; } @@ -4129,7 +4129,7 @@ static DRIVER_INIT( ddonpach ) cave_default_eeprom_length = sizeof(cave_default_eeprom_type2); cave_region_byte = -1; - ddonpach_unpack_sprites(); + ddonpach_unpack_sprites(machine); cave_spritetype = 1; // "different" sprites (no zooming?) time_vblank_irq = 90; } @@ -4142,7 +4142,7 @@ static DRIVER_INIT( donpachi ) cave_default_eeprom_length = sizeof(cave_default_eeprom_type2); cave_region_byte = -1; - ddonpach_unpack_sprites(); + ddonpach_unpack_sprites(machine); cave_spritetype = 1; // "different" sprites (no zooming?) time_vblank_irq = 90; @@ -4157,12 +4157,12 @@ static DRIVER_INIT( esprade ) cave_default_eeprom_length = sizeof(cave_default_eeprom_type2); cave_region_byte = -1; - esprade_unpack_sprites(); + esprade_unpack_sprites(machine); time_vblank_irq = 2000; /**/ #if 0 //ROM PATCH { - UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *rom = (UINT16 *)memory_region(machine, REGION_CPU1); rom[0x118A/2] = 0x4e71; //palette fix 118A: 5548 SUBQ.W #2,A0 --> NOP } #endif @@ -4174,7 +4174,7 @@ static DRIVER_INIT( gaia ) /* No EEPROM */ - unpack_sprites(); + unpack_sprites(machine); cave_spritetype = 2; // Normal sprites with different position handling time_vblank_irq = 2000; /**/ } @@ -4187,7 +4187,7 @@ static DRIVER_INIT( guwange ) cave_default_eeprom_length = sizeof(cave_default_eeprom_type1); cave_region_byte = -1; - esprade_unpack_sprites(); + esprade_unpack_sprites(machine); time_vblank_irq = 2000; /**/ } @@ -4199,7 +4199,7 @@ static DRIVER_INIT( hotdogst ) cave_default_eeprom_length = sizeof(cave_default_eeprom_type4); cave_region_byte = -1; - unpack_sprites(); + unpack_sprites(machine); cave_spritetype = 2; // Normal sprites with different position handling time_vblank_irq = 2000; /**/ } @@ -4207,8 +4207,8 @@ static DRIVER_INIT( hotdogst ) static DRIVER_INIT( mazinger ) { UINT8 *buffer; - UINT8 *src = memory_region(REGION_GFX1); - int len = memory_region_length(REGION_GFX1); + UINT8 *src = memory_region(machine, REGION_GFX1); + int len = memory_region_length(machine, REGION_GFX1); init_cave(machine); @@ -4226,13 +4226,13 @@ static DRIVER_INIT( mazinger ) cave_default_eeprom_length = sizeof(cave_default_eeprom_type5); cave_region_byte = 0x05; - unpack_sprites(); + unpack_sprites(machine); cave_spritetype = 2; // Normal sprites with different position handling cave_kludge = 3; time_vblank_irq = 2100; /* setup extra ROM */ - memory_set_bankptr(1,memory_region(REGION_USER1)); + memory_set_bankptr(1,memory_region(machine, REGION_USER1)); } @@ -4240,7 +4240,7 @@ static DRIVER_INIT( metmqstr ) { init_cave(machine); - unpack_sprites(); + unpack_sprites(machine); cave_spritetype = 2; // Normal sprites with different position handling cave_kludge = 3; time_vblank_irq = 17376; @@ -4250,8 +4250,8 @@ static DRIVER_INIT( metmqstr ) static DRIVER_INIT( pwrins2j ) { UINT8 *buffer; - UINT8 *src = memory_region(REGION_GFX1); - int len = memory_region_length(REGION_GFX1); + UINT8 *src = memory_region(machine, REGION_GFX1); + int len = memory_region_length(machine, REGION_GFX1); int i, j; init_cave(machine); @@ -4269,7 +4269,7 @@ static DRIVER_INIT( pwrins2j ) free(buffer); } - unpack_sprites(); + unpack_sprites(machine); cave_spritetype = 3; cave_kludge = 4; time_vblank_irq = 2000; /**/ @@ -4285,7 +4285,7 @@ static DRIVER_INIT( pwrinst2 ) #if 1 //ROM PATCH { - UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *rom = (UINT16 *)memory_region(machine, REGION_CPU1); rom[0xD46C/2] = 0xD482; // kurara dash fix 0xd400 -> 0xd482 } #endif @@ -4296,8 +4296,8 @@ static DRIVER_INIT( pwrinst2 ) static DRIVER_INIT( sailormn ) { UINT8 *buffer; - UINT8 *src = memory_region(REGION_GFX1); - int len = memory_region_length(REGION_GFX1); + UINT8 *src = memory_region(machine, REGION_GFX1); + int len = memory_region_length(machine, REGION_GFX1); init_cave(machine); @@ -4311,13 +4311,13 @@ static DRIVER_INIT( sailormn ) free(buffer); } - sailormn_unpack_tiles( REGION_GFX4 ); + sailormn_unpack_tiles( machine, REGION_GFX4 ); cave_default_eeprom = cave_default_eeprom_type6; cave_default_eeprom_length = sizeof(cave_default_eeprom_type6); cave_region_byte = 0x11; - unpack_sprites(); + unpack_sprites(machine); cave_spritetype = 2; // Normal sprites with different position handling cave_kludge = 1; time_vblank_irq = 2000; @@ -4331,7 +4331,7 @@ static DRIVER_INIT( uopoko ) cave_default_eeprom_length = sizeof(cave_default_eeprom_type4); cave_region_byte = -1; - unpack_sprites(); + unpack_sprites(machine); cave_kludge = 2; time_vblank_irq = 2000; /**/ } @@ -4342,7 +4342,7 @@ static DRIVER_INIT( korokoro ) irq_level = 2; - unpack_sprites(); + unpack_sprites(machine); time_vblank_irq = 2000; /**/ } diff --git a/src/mame/drivers/cbasebal.c b/src/mame/drivers/cbasebal.c index 1cf316c6cfb..6f6912dafce 100644 --- a/src/mame/drivers/cbasebal.c +++ b/src/mame/drivers/cbasebal.c @@ -306,8 +306,8 @@ ROM_END static DRIVER_INIT( cbasebal ) { - memory_configure_bank(1, 0, 32, memory_region(REGION_CPU1) + 0x10000, 0x4000); - pang_decode(); + memory_configure_bank(1, 0, 32, memory_region(machine, REGION_CPU1) + 0x10000, 0x4000); + pang_decode(machine); } diff --git a/src/mame/drivers/cbuster.c b/src/mame/drivers/cbuster.c index 586c59c2b75..8c968de3b3f 100644 --- a/src/mame/drivers/cbuster.c +++ b/src/mame/drivers/cbuster.c @@ -544,7 +544,7 @@ ROM_END static DRIVER_INIT( twocrude ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); UINT8 *PTR; int i,j; @@ -566,8 +566,8 @@ static DRIVER_INIT( twocrude ) } /* Rearrange the 'extra' sprite bank to be in the same format as main sprites */ - RAM = memory_region(REGION_GFX3) + 0x080000; - PTR = memory_region(REGION_GFX3) + 0x140000; + RAM = memory_region(machine, REGION_GFX3) + 0x080000; + PTR = memory_region(machine, REGION_GFX3) + 0x140000; for (i=0; i<0x20000; i+=64) { for (j=0; j<16; j+=1) { /* Copy 16 lines down */ RAM[i+ 0+j*2]=PTR[i/2+ 0+j]; /* Pixels 0-7 for each plane */ diff --git a/src/mame/drivers/ccastles.c b/src/mame/drivers/ccastles.c index 6ad2c51d0ea..8c1b845a1e0 100644 --- a/src/mame/drivers/ccastles.c +++ b/src/mame/drivers/ccastles.c @@ -204,7 +204,7 @@ static MACHINE_START( ccastles ) rectangle visarea; /* initialize globals */ - syncprom = memory_region(REGION_PROMS) + 0x000; + syncprom = memory_region(machine, REGION_PROMS) + 0x000; /* find the start of VBLANK in the SYNC PROM */ for (ccastles_vblank_start = 0; ccastles_vblank_start < 256; ccastles_vblank_start++) @@ -229,7 +229,7 @@ static MACHINE_START( ccastles ) video_screen_configure(machine->primary_screen, 320, 256, &visarea, HZ_TO_ATTOSECONDS(PIXEL_CLOCK) * VTOTAL * HTOTAL); /* configure the ROM banking */ - memory_configure_bank(1, 0, 2, memory_region(REGION_CPU1) + 0xa000, 0x6000); + memory_configure_bank(1, 0, 2, memory_region(machine, REGION_CPU1) + 0xa000, 0x6000); /* create a timer for IRQs and set up the first callback */ irq_timer = timer_alloc(clock_irq, NULL); diff --git a/src/mame/drivers/cclimber.c b/src/mame/drivers/cclimber.c index c8e517ba25a..799738a4e52 100644 --- a/src/mame/drivers/cclimber.c +++ b/src/mame/drivers/cclimber.c @@ -1991,13 +1991,13 @@ ROM_END static DRIVER_INIT( yamato ) { - yamato_decode(); + yamato_decode(machine); } static DRIVER_INIT( toprollr ) { - toprollr_decode(); + toprollr_decode(machine); } diff --git a/src/mame/drivers/cham24.c b/src/mame/drivers/cham24.c index 75e29ce4d45..43db52d5734 100644 --- a/src/mame/drivers/cham24.c +++ b/src/mame/drivers/cham24.c @@ -124,8 +124,8 @@ static WRITE8_HANDLER( cham24_mapper_w ) UINT32 prg_bank_page_size = (offset >> 12) & 0x01; UINT32 gfx_mirroring = (offset >> 13) & 0x01; - UINT8* dst = memory_region( REGION_CPU1 ); - UINT8* src = memory_region( REGION_USER1 ); + UINT8* dst = memory_region( machine, REGION_CPU1 ); + UINT8* src = memory_region( machine, REGION_USER1 ); // switch PPU VROM bank ppu2c0x_set_videorom_bank( 0, 0, 8, gfx_bank, 512 ); @@ -198,8 +198,8 @@ static const struct NESinterface cham24_interface_1 = static MACHINE_RESET( cham24 ) { /* switch PRG rom */ - UINT8* dst = memory_region( REGION_CPU1 ); - UINT8* src = memory_region( REGION_USER1 ); + UINT8* dst = memory_region( machine, REGION_CPU1 ); + UINT8* src = memory_region( machine, REGION_USER1 ); memcpy( &dst[0x8000], &src[0x0f8000], 0x4000 ); memcpy( &dst[0xc000], &src[0x0f8000], 0x4000 ); diff --git a/src/mame/drivers/champbas.c b/src/mame/drivers/champbas.c index 0a1633d0f78..04a3fcfa2b4 100644 --- a/src/mame/drivers/champbas.c +++ b/src/mame/drivers/champbas.c @@ -629,9 +629,9 @@ ROM_END static DRIVER_INIT(champbas) { // chars and sprites are mixed in the same ROMs, so rearrange them for easier decoding - UINT8 *rom1 = memory_region(REGION_GFX1); - UINT8 *rom2 = memory_region(REGION_GFX2); - int len = memory_region_length(REGION_GFX1); + UINT8 *rom1 = memory_region(machine, REGION_GFX1); + UINT8 *rom2 = memory_region(machine, REGION_GFX2); + int len = memory_region_length(machine, REGION_GFX1); int i; for (i = 0; i < len/2; ++i) diff --git a/src/mame/drivers/champbwl.c b/src/mame/drivers/champbwl.c index 4a18c61eedf..45e5c855863 100644 --- a/src/mame/drivers/champbwl.c +++ b/src/mame/drivers/champbwl.c @@ -178,7 +178,7 @@ static WRITE8_HANDLER( champbwl_misc_w ) coin_lockout_w(0, ~data & 8); coin_lockout_w(1, ~data & 4); - memory_set_bankptr(1, memory_region(REGION_CPU1) + 0x10000 + 0x4000 * ((data & 0x30)>>4)); + memory_set_bankptr(1, memory_region(machine, REGION_CPU1) + 0x10000 + 0x4000 * ((data & 0x30)>>4)); } static WRITE8_HANDLER( champbwl_objctrl_w ) diff --git a/src/mame/drivers/chinagat.c b/src/mame/drivers/chinagat.c index 92148a6f0fb..c2a3846999a 100644 --- a/src/mame/drivers/chinagat.c +++ b/src/mame/drivers/chinagat.c @@ -129,13 +129,13 @@ static WRITE8_HANDLER( chinagat_video_ctrl_w ) static WRITE8_HANDLER( chinagat_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); memory_set_bankptr( 1,&RAM[ 0x10000 + (0x4000 * (data & 7)) ] ); } static WRITE8_HANDLER( chinagat_sub_bankswitch_w ) { - UINT8 *RAM = memory_region( REGION_CPU2 ); + UINT8 *RAM = memory_region( machine, REGION_CPU2 ); memory_set_bankptr( 4,&RAM[ 0x10000 + (0x4000 * (data & 7)) ] ); } @@ -182,7 +182,7 @@ static WRITE8_HANDLER( saiyugb1_adpcm_control_w ) { /* i8748 Port 2 write */ - UINT8 *saiyugb1_adpcm_rom = memory_region(REGION_SOUND1); + UINT8 *saiyugb1_adpcm_rom = memory_region(machine, REGION_SOUND1); if (data & 0x80) /* Reset m5205 and disable ADPCM ROM outputs */ { diff --git a/src/mame/drivers/chinsan.c b/src/mame/drivers/chinsan.c index dc1621a88e3..19b9da9982d 100644 --- a/src/mame/drivers/chinsan.c +++ b/src/mame/drivers/chinsan.c @@ -73,7 +73,7 @@ static VIDEO_UPDATE(chinsan) static MACHINE_RESET( chinsan ) { - memory_configure_bank(1, 0, 4, memory_region(REGION_CPU1) + 0x10000, 0x4000); + memory_configure_bank(1, 0, 4, memory_region(machine, REGION_CPU1) + 0x10000, 0x4000); } @@ -526,9 +526,9 @@ static DRIVER_INIT( chinsan ) { int i; - UINT8 *src = memory_region( REGION_USER3 ); + UINT8 *src = memory_region( machine, REGION_USER3 ); - mc8123_decrypt_rom(0, memory_region(REGION_USER1), 1, 4); + mc8123_decrypt_rom(machine, 0, memory_region(machine, REGION_USER1), 1, 4); for (i=0;i<0x100;i++) { diff --git a/src/mame/drivers/chqflag.c b/src/mame/drivers/chqflag.c index e6f2bfa153b..cbcd929d979 100644 --- a/src/mame/drivers/chqflag.c +++ b/src/mame/drivers/chqflag.c @@ -42,7 +42,7 @@ static INTERRUPT_GEN( chqflag_interrupt ) static WRITE8_HANDLER( chqflag_bankswitch_w ) { int bankaddress; - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); /* bits 0-4 = ROM bank # (0x00-0x11) */ bankaddress = 0x10000 + (data & 0x1f)*0x4000; @@ -470,7 +470,7 @@ ROM_END static DRIVER_INIT( chqflag ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); konami_rom_deinterleave_2(REGION_GFX1); paletteram = &RAM[0x58000]; diff --git a/src/mame/drivers/cidelsa.c b/src/mame/drivers/cidelsa.c index d137baaccd8..b8869eacee8 100644 --- a/src/mame/drivers/cidelsa.c +++ b/src/mame/drivers/cidelsa.c @@ -566,7 +566,7 @@ static MACHINE_START( draco ) // COP402 memory banking - memory_configure_bank(1, 0, 2, memory_region(REGION_CPU2), 0x400); + memory_configure_bank(1, 0, 2, memory_region(machine, REGION_CPU2), 0x400); memory_set_bank(1, 0); // register save states diff --git a/src/mame/drivers/circusc.c b/src/mame/drivers/circusc.c index 0e8fe311619..a869a8a34b5 100644 --- a/src/mame/drivers/circusc.c +++ b/src/mame/drivers/circusc.c @@ -524,7 +524,7 @@ ROM_END static DRIVER_INIT( circusc ) { - konami1_decode(0); + konami1_decode(machine, 0); } diff --git a/src/mame/drivers/cischeat.c b/src/mame/drivers/cischeat.c index 7158034fcef..f9708f55b38 100644 --- a/src/mame/drivers/cischeat.c +++ b/src/mame/drivers/cischeat.c @@ -1971,10 +1971,10 @@ MACHINE_DRIVER_END We need to untangle it */ -static void cischeat_untangle_sprites(int region) +static void cischeat_untangle_sprites(running_machine *machine, int region) { - UINT8 *src = memory_region(region); - const UINT8 *end = src + memory_region_length(region); + UINT8 *src = memory_region(machine, region); + const UINT8 *end = src + memory_region_length(machine, region); while (src < end) { @@ -2127,9 +2127,9 @@ ROM_END static DRIVER_INIT( bigrun ) { /* Split ROMs */ - rom_1 = (UINT16 *) memory_region(REGION_USER1); + rom_1 = (UINT16 *) memory_region(machine, REGION_USER1); - cischeat_untangle_sprites(REGION_GFX4); // Untangle sprites + cischeat_untangle_sprites(machine, REGION_GFX4); // Untangle sprites phantasm_rom_decode(3); // Decrypt sound cpu code } @@ -2249,19 +2249,19 @@ ROM_END static DRIVER_INIT( cischeat ) { /* Split ROMs */ - rom_1 = (UINT16 *) (memory_region(REGION_USER1) + 0x00000); - rom_2 = (UINT16 *) (memory_region(REGION_CPU2) + 0x40000); - rom_3 = (UINT16 *) (memory_region(REGION_CPU3) + 0x40000); + rom_1 = (UINT16 *) (memory_region(machine, REGION_USER1) + 0x00000); + rom_2 = (UINT16 *) (memory_region(machine, REGION_CPU2) + 0x40000); + rom_3 = (UINT16 *) (memory_region(machine, REGION_CPU3) + 0x40000); - memcpy(memory_region(REGION_USER1) + 0x80000, rom_2, 0x40000); + memcpy(memory_region(machine, REGION_USER1) + 0x80000, rom_2, 0x40000); memset(rom_2, 0, 0x40000); - rom_2 = (UINT16 *) (memory_region(REGION_USER1) + 0x80000); + rom_2 = (UINT16 *) (memory_region(machine, REGION_USER1) + 0x80000); - memcpy(memory_region(REGION_USER1) + 0xc0000, rom_3, 0x40000); + memcpy(memory_region(machine, REGION_USER1) + 0xc0000, rom_3, 0x40000); memset(rom_3, 0, 0x40000); - rom_3 = (UINT16 *) (memory_region(REGION_USER1) + 0xc0000); + rom_3 = (UINT16 *) (memory_region(machine, REGION_USER1) + 0xc0000); - cischeat_untangle_sprites(REGION_GFX4); // Untangle sprites + cischeat_untangle_sprites(machine, REGION_GFX4); // Untangle sprites astyanax_rom_decode(3); // Decrypt sound cpu code } @@ -2476,9 +2476,9 @@ ROM_END static DRIVER_INIT( f1gpstar ) { /* Split ROMs */ - rom_1 = (UINT16 *) memory_region(REGION_USER1); + rom_1 = (UINT16 *) memory_region(machine, REGION_USER1); - cischeat_untangle_sprites(REGION_GFX4); + cischeat_untangle_sprites(machine, REGION_GFX4); } diff --git a/src/mame/drivers/citycon.c b/src/mame/drivers/citycon.c index 7fced57ada0..8118d614cac 100644 --- a/src/mame/drivers/citycon.c +++ b/src/mame/drivers/citycon.c @@ -344,7 +344,7 @@ ROM_END static DRIVER_INIT( citycon ) { - UINT8 *rom = memory_region(REGION_GFX1); + UINT8 *rom = memory_region(machine, REGION_GFX1); int i; diff --git a/src/mame/drivers/cloud9.c b/src/mame/drivers/cloud9.c index fa3608def8f..3b0f7eb0c57 100644 --- a/src/mame/drivers/cloud9.c +++ b/src/mame/drivers/cloud9.c @@ -171,7 +171,7 @@ static MACHINE_START( cloud9 ) rectangle visarea; /* initialize globals */ - syncprom = memory_region(REGION_PROMS) + 0x000; + syncprom = memory_region(machine, REGION_PROMS) + 0x000; /* find the start of VBLANK in the SYNC PROM */ for (cloud9_vblank_start = 0; cloud9_vblank_start < 256; cloud9_vblank_start++) diff --git a/src/mame/drivers/clshroad.c b/src/mame/drivers/clshroad.c index 51a60136527..6a71a310372 100644 --- a/src/mame/drivers/clshroad.c +++ b/src/mame/drivers/clshroad.c @@ -491,7 +491,7 @@ without this the death sequence never ends so the game is unplayable after you die once, it would be nice to avoid the hack however */ - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); ROM[0x05C6] = 0xc3; ROM[0x05C7] = 0x8d; diff --git a/src/mame/drivers/cninja.c b/src/mame/drivers/cninja.c index ba4bf43f117..22e83d09767 100644 --- a/src/mame/drivers/cninja.c +++ b/src/mame/drivers/cninja.c @@ -1747,9 +1747,9 @@ ROM_END /**********************************************************************************/ -static void cninja_patch(void) +static void cninja_patch(running_machine *machine) { - UINT16 *RAM = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *RAM = (UINT16 *)memory_region(machine, REGION_CPU1); int i; for (i=0; i<0x80000/2; i++) { @@ -1775,7 +1775,7 @@ static void cninja_patch(void) static DRIVER_INIT( cninja ) { memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1bc0a8, 0x1bc0a9, 0, 0, cninja_sound_w); - cninja_patch(); + cninja_patch(machine); } static DRIVER_INIT( stoneage ) @@ -1785,16 +1785,16 @@ static DRIVER_INIT( stoneage ) static DRIVER_INIT( mutantf ) { - const UINT8 *src = memory_region(REGION_GFX2); - UINT8 *dst = memory_region(REGION_GFX1); + const UINT8 *src = memory_region(machine, REGION_GFX2); + UINT8 *dst = memory_region(machine, REGION_GFX1); /* The 16x16 graphic has some 8x8 chars in it - decode them in GFX1 */ memcpy(dst+0x50000,dst+0x10000,0x10000); memcpy(dst+0x10000,src,0x40000); memcpy(dst+0x60000,src+0x40000,0x40000); - deco56_decrypt(REGION_GFX1); - deco56_decrypt(REGION_GFX2); + deco56_decrypt(machine, REGION_GFX1); + deco56_decrypt(machine, REGION_GFX2); } /**********************************************************************************/ diff --git a/src/mame/drivers/cntsteer.c b/src/mame/drivers/cntsteer.c index 433c386ff54..b596996be90 100644 --- a/src/mame/drivers/cntsteer.c +++ b/src/mame/drivers/cntsteer.c @@ -253,7 +253,7 @@ static int scroll=0; int i,j; char buf[60]; struct osd_bitmap *mybitmap = bitmap; - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); buf[0] = 0; for (i = 0;i < 8;i+=2) @@ -925,8 +925,8 @@ ROM_END static void zerotrgt_rearrange_gfx(int romsize, int romarea) { - UINT8 *src = memory_region(REGION_GFX4); - UINT8 *dst = memory_region(REGION_GFX3); + UINT8 *src = memory_region(Machine, REGION_GFX4); + UINT8 *dst = memory_region(Machine, REGION_GFX3); int rm; int cnt1; @@ -946,7 +946,7 @@ static void zerotrgt_rearrange_gfx(int romsize, int romarea) #if 0 static void init_cntsteer(void) { - UINT8 *RAM = memory_region(REGION_CPU2); + UINT8 *RAM = memory_region(machine, REGION_CPU2); RAM[0xc2cf]=0x43; /* Patch out Cpu 1 ram test - it never ends..?! */ RAM[0xc2d0]=0x43; diff --git a/src/mame/drivers/coinmstr.c b/src/mame/drivers/coinmstr.c index 4bb4f26284a..d93518a22a8 100644 --- a/src/mame/drivers/coinmstr.c +++ b/src/mame/drivers/coinmstr.c @@ -60,7 +60,7 @@ static WRITE8_HANDLER( quizmstr_attr2_w ) static READ8_HANDLER( question_r ) { int address; - UINT8 *questions = memory_region(REGION_USER1); + UINT8 *questions = memory_region(machine, REGION_USER1); switch(question_adr[2]) { @@ -810,8 +810,8 @@ ROM_END static DRIVER_INIT( coinmstr ) { - UINT8 *rom = memory_region(REGION_USER1); - int length = memory_region_length(REGION_USER1); + UINT8 *rom = memory_region(machine, REGION_USER1); + int length = memory_region_length(machine, REGION_USER1); UINT8 *buf = malloc_or_die(length); int i; diff --git a/src/mame/drivers/cojag.c b/src/mame/drivers/cojag.c index b2a8cbdb072..ce7a2b42cd1 100644 --- a/src/mame/drivers/cojag.c +++ b/src/mame/drivers/cojag.c @@ -219,7 +219,7 @@ static UINT32 *rom_base; static MACHINE_RESET( cojag ) { - UINT8 *rom = memory_region(REGION_USER2); + UINT8 *rom = memory_region(machine, REGION_USER2); /* 68020 only: copy the interrupt vectors into RAM */ if (!cojag_is_r3000) @@ -304,7 +304,7 @@ static WRITE32_HANDLER( misc_control_w ) } /* adjust banking */ - if (memory_region(REGION_USER2)) + if (memory_region(machine, REGION_USER2)) { memory_set_bank(2, (data >> 1) & 7); memory_set_bank(9, (data >> 1) & 7); @@ -396,7 +396,7 @@ static WRITE32_HANDLER( latch_w ) logerror("%08X:latch_w(%X)\n", activecpu_get_previouspc(), data); /* adjust banking */ - if (memory_region(REGION_USER2)) + if (memory_region(machine, REGION_USER2)) { if (cojag_is_r3000) memory_set_bank(1, data & 1); diff --git a/src/mame/drivers/commando.c b/src/mame/drivers/commando.c index 28221b7812b..4db0e7611d7 100644 --- a/src/mame/drivers/commando.c +++ b/src/mame/drivers/commando.c @@ -506,7 +506,7 @@ ROM_END static DRIVER_INIT( commando ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); UINT8 *decrypt = auto_malloc(0xc000); int A; @@ -525,7 +525,7 @@ static DRIVER_INIT( commando ) static DRIVER_INIT( spaceinv ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); UINT8 *decrypt = auto_malloc(0xc000); int A; diff --git a/src/mame/drivers/compgolf.c b/src/mame/drivers/compgolf.c index 7cfb4d700d3..042faa21bc2 100644 --- a/src/mame/drivers/compgolf.c +++ b/src/mame/drivers/compgolf.c @@ -42,7 +42,7 @@ static WRITE8_HANDLER( compgolf_ctrl_w ) if( bank != new_bank ) { bank = new_bank; - memory_set_bankptr(1, memory_region(REGION_USER1) + 0x4000 * bank); + memory_set_bankptr(1, memory_region(machine, REGION_USER1) + 0x4000 * bank); } compgolf_scrollx_hi = (data & 1) << 8; @@ -292,10 +292,10 @@ ROM_START( compglfo ) ROM_LOAD( "cv08-1.bpr", 0x00000, 0x0100, CRC(b7c43db9) SHA1(418b11e4c8a9bce6873b0624ac53a5011c5807d0) ) ROM_END -static void compgolf_expand_bg(void) +static void compgolf_expand_bg(running_machine *machine) { - UINT8 *GFXDST = memory_region(REGION_GFX2); - UINT8 *GFXSRC = memory_region(REGION_GFX4); + UINT8 *GFXDST = memory_region(machine, REGION_GFX2); + UINT8 *GFXSRC = memory_region(machine, REGION_GFX4); int x; @@ -308,7 +308,7 @@ static void compgolf_expand_bg(void) static DRIVER_INIT( compgolf ) { - compgolf_expand_bg(); + compgolf_expand_bg(machine); } GAME( 1986, compgolf, 0, compgolf, compgolf, compgolf, ROT0, "Data East", "Competition Golf Final Round (revision 3)", 0 ) diff --git a/src/mame/drivers/contra.c b/src/mame/drivers/contra.c index a79e55511aa..a63704570fa 100644 --- a/src/mame/drivers/contra.c +++ b/src/mame/drivers/contra.c @@ -39,7 +39,7 @@ VIDEO_START( contra ); static WRITE8_HANDLER( contra_bankswitch_w ) { int bankaddress; - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); bankaddress = 0x10000 + (data & 0x0f) * 0x2000; diff --git a/src/mame/drivers/coolpool.c b/src/mame/drivers/coolpool.c index c824c4780df..b01421a3f9a 100644 --- a/src/mame/drivers/coolpool.c +++ b/src/mame/drivers/coolpool.c @@ -381,8 +381,8 @@ static READ16_HANDLER( dsp_hold_line_r ) static READ16_HANDLER( dsp_rom_r ) { - UINT8 *rom = memory_region(REGION_USER2); - return rom[iop_romaddr & (memory_region_length(REGION_USER2) - 1)]; + UINT8 *rom = memory_region(machine, REGION_USER2); + return rom[iop_romaddr & (memory_region_length(machine, REGION_USER2) - 1)]; } @@ -944,8 +944,8 @@ static DRIVER_INIT( 9ballsht ) UINT16 *rom; /* decrypt the main program ROMs */ - rom = (UINT16 *)memory_region(REGION_USER1); - len = memory_region_length(REGION_USER1); + rom = (UINT16 *)memory_region(machine, REGION_USER1); + len = memory_region_length(machine, REGION_USER1); for (a = 0;a < len/2;a++) { int hi,lo,nhi,nlo; @@ -968,8 +968,8 @@ static DRIVER_INIT( 9ballsht ) } /* decrypt the sub data ROMs */ - rom = (UINT16 *)memory_region(REGION_USER2); - len = memory_region_length(REGION_USER2); + rom = (UINT16 *)memory_region(machine, REGION_USER2); + len = memory_region_length(machine, REGION_USER2); for (a = 1;a < len/2;a+=4) { /* just swap bits 1 and 2 of the address */ diff --git a/src/mame/drivers/cop01.c b/src/mame/drivers/cop01.c index b9f91c16c03..a815d667528 100644 --- a/src/mame/drivers/cop01.c +++ b/src/mame/drivers/cop01.c @@ -600,7 +600,7 @@ static DRIVER_INIT( mightguy ) #if MIGHTGUY_HACK /* This is a hack to fix the game code to get a fully working "Starting Area" fake Dip Switch */ - UINT8 *RAM = (UINT8 *)memory_region(REGION_CPU1); + UINT8 *RAM = (UINT8 *)memory_region(machine, REGION_CPU1); RAM[0x00e4] = 0x07; // rlca RAM[0x00e5] = 0x07; // rlca RAM[0x00e6] = 0x07; // rlca diff --git a/src/mame/drivers/cosmic.c b/src/mame/drivers/cosmic.c index ff1a540a47b..dcf9bc72d8c 100644 --- a/src/mame/drivers/cosmic.c +++ b/src/mame/drivers/cosmic.c @@ -1463,8 +1463,8 @@ static DRIVER_INIT( cosmicg ) offs_t offs, len; UINT8 *rom; - len = memory_region_length(REGION_CPU1); - rom = memory_region(REGION_CPU1); + len = memory_region_length(machine, REGION_CPU1); + rom = memory_region(machine, REGION_CPU1); for (offs =0; offs < len; offs++) { UINT8 scrambled = rom[offs]; diff --git a/src/mame/drivers/couple.c b/src/mame/drivers/couple.c index 5cb52bfbc22..25c9459fa1a 100644 --- a/src/mame/drivers/couple.c +++ b/src/mame/drivers/couple.c @@ -530,7 +530,7 @@ ROM_END static DRIVER_INIT( couple ) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); #if 0 //quick rom compare test { diff --git a/src/mame/drivers/cps1.c b/src/mame/drivers/cps1.c index 229ccc1e7b5..c7faf364486 100644 --- a/src/mame/drivers/cps1.c +++ b/src/mame/drivers/cps1.c @@ -215,7 +215,7 @@ static WRITE16_HANDLER( forgottn_dial_1_reset_w ) static WRITE8_HANDLER( cps1_snd_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_CPU2); + UINT8 *RAM = memory_region(machine, REGION_CPU2); int bankaddr; bankaddr = ((data & 1) * 0x4000); @@ -292,7 +292,7 @@ INTERRUPT_GEN( cps1_qsound_interrupt ) static READ16_HANDLER( qsound_rom_r ) { - UINT8 *rom = memory_region(REGION_USER1); + UINT8 *rom = memory_region(machine, REGION_USER1); if (rom) return rom[offset] | 0xff00; else @@ -330,9 +330,9 @@ static WRITE8_HANDLER( qsound_banksw_w ) Z80 bank register for music note data. It's odd that it isn't encrypted though. */ - UINT8 *RAM = memory_region(REGION_CPU2); + UINT8 *RAM = memory_region(machine, REGION_CPU2); int bankaddress=0x10000+((data&0x0f)*0x4000); - if (bankaddress >= memory_region_length(REGION_CPU2)) + if (bankaddress >= memory_region_length(machine, REGION_CPU2)) { logerror("WARNING: Q sound bank overflow (%02x)\n", data); bankaddress=0x10000; @@ -7803,25 +7803,25 @@ static DRIVER_INIT( sf2hack ) static DRIVER_INIT( wof ) { - wof_decode(); + wof_decode(machine); DRIVER_INIT_CALL(cps1); } static DRIVER_INIT( dino ) { - dino_decode(); + dino_decode(machine); DRIVER_INIT_CALL(cps1); } static DRIVER_INIT( punisher ) { - punisher_decode(); + punisher_decode(machine); DRIVER_INIT_CALL(cps1); } static DRIVER_INIT( slammast ) { - slammast_decode(); + slammast_decode(machine); DRIVER_INIT_CALL(cps1); } @@ -7836,7 +7836,7 @@ static DRIVER_INIT( pang3 ) static DRIVER_INIT( pang3j ) { - UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *rom = (UINT16 *)memory_region(machine, REGION_CPU1); int A,src,dst; for (A = 0x80000;A < 0x100000;A += 2) diff --git a/src/mame/drivers/cps3.c b/src/mame/drivers/cps3.c index 15ddb451bfa..9d990f11b3c 100644 --- a/src/mame/drivers/cps3.c +++ b/src/mame/drivers/cps3.c @@ -689,9 +689,9 @@ static const struct game_keys2 keys_table2[] = static void cps3_decrypt_bios(running_machine *machine) { int i; - UINT32 *coderegion = (UINT32*)memory_region(REGION_USER1); + UINT32 *coderegion = (UINT32*)memory_region(machine, REGION_USER1); - decrypted_bios = (UINT32*)memory_region(REGION_USER1); + decrypted_bios = (UINT32*)memory_region(machine, REGION_USER1); for (i=0;i<0x80000;i+=4) { @@ -1355,7 +1355,7 @@ static OPBASE_HANDLER( cps3_opbase_handler ) /* BIOS ROM */ if (address < 0x80000) { - opbase->rom = opbase->ram = memory_region(REGION_USER1); + opbase->rom = opbase->ram = memory_region(machine, REGION_USER1); return ~0; } /* RAM */ @@ -1364,7 +1364,7 @@ static OPBASE_HANDLER( cps3_opbase_handler ) opbase->rom = (UINT8*)decrypted_gamerom-0x06000000; opbase->ram = (UINT8*)decrypted_gamerom-0x06000000; - if (cps3_isSpecial) opbase->ram = (UINT8*) memory_region(REGION_USER4)-0x06000000; + if (cps3_isSpecial) opbase->ram = (UINT8*) memory_region(machine, REGION_USER4)-0x06000000; return ~0; @@ -1512,7 +1512,7 @@ static WRITE32_HANDLER( cps3_gfxflash_w ) /* make a copy in the linear memory region we actually use for drawing etc. having it stored in interleaved flash roms isnt' very useful */ { - UINT32* romdata = (UINT32*)memory_region(REGION_USER5); + UINT32* romdata = (UINT32*)memory_region(machine, REGION_USER5); int real_offset = 0; UINT32 newdata; UINT8* ptr1 = intelflash_getmemptr(flash1); @@ -1646,7 +1646,7 @@ static READ32_HANDLER( cps3_flash2_r ) return retvalue; } -static void cps3_flashmain_w(int base, UINT32 offset, UINT32 data, UINT32 mem_mask) +static void cps3_flashmain_w(running_machine *machine, int base, UINT32 offset, UINT32 data, UINT32 mem_mask) { int command; if (ACCESSING_BITS_24_31) // Flash 1 @@ -1676,7 +1676,7 @@ static void cps3_flashmain_w(int base, UINT32 offset, UINT32 data, UINT32 mem_ma /* copy data into regions to execute from */ { - UINT32* romdata = (UINT32*)memory_region(REGION_USER4); + UINT32* romdata = (UINT32*)memory_region(machine, REGION_USER4); UINT32* romdata2 = (UINT32*)decrypted_gamerom; int real_offset = 0; UINT32 newdata; @@ -1708,12 +1708,12 @@ static void cps3_flashmain_w(int base, UINT32 offset, UINT32 data, UINT32 mem_ma static WRITE32_HANDLER( cps3_flash1_w ) { - cps3_flashmain_w(0, offset,data,mem_mask); + cps3_flashmain_w(machine,0,offset,data,mem_mask); } static WRITE32_HANDLER( cps3_flash2_w ) { - cps3_flashmain_w(4, offset,data,mem_mask); + cps3_flashmain_w(machine,4,offset,data,mem_mask); } static WRITE32_HANDLER( cram_gfxflash_bank_w ) @@ -1951,7 +1951,7 @@ static WRITE32_HANDLER( cps3_palettedma_w ) if (data & 0x0002) { int i; - UINT16* src = (UINT16*)memory_region(REGION_USER5); + UINT16* src = (UINT16*)memory_region(machine, REGION_USER5); // if(DEBUG_PRINTF) printf("CPS3 pal dma start %08x (real: %08x) dest %08x fade %08x other2 %08x (length %04x)\n", paldma_source, paldma_realsource, paldma_dest, paldma_fade, paldma_other2, paldma_length); for (i=0;i<paldma_length;i++) @@ -2030,9 +2030,9 @@ static UINT32 process_byte( UINT8 real_byte, UINT32 destination, int max_length } } -static void cps3_do_char_dma( UINT32 real_source, UINT32 real_destination, UINT32 real_length ) +static void cps3_do_char_dma( running_machine *machine, UINT32 real_source, UINT32 real_destination, UINT32 real_length ) { - UINT8* sourcedata = (UINT8*)memory_region(REGION_USER5); + UINT8* sourcedata = (UINT8*)memory_region(machine, REGION_USER5); int length_remaining; last_normal_byte = 0; @@ -2117,9 +2117,9 @@ static UINT32 ProcessByte8(UINT8 b,UINT32 dst_offset) } } -static void cps3_do_alt_char_dma( UINT32 src, UINT32 real_dest, UINT32 real_length ) +static void cps3_do_alt_char_dma( running_machine *machine, UINT32 src, UINT32 real_dest, UINT32 real_length ) { - UINT8* px = (UINT8*)memory_region(REGION_USER5); + UINT8* px = (UINT8*)memory_region(machine, REGION_USER5); UINT32 start = real_dest; UINT32 ds = real_dest; @@ -2191,7 +2191,7 @@ static void cps3_process_character_dma(running_machine *machine, UINT32 address) { /* 6bpp DMA decompression - this is used for the majority of sprites and backgrounds */ - cps3_do_char_dma( real_source, real_destination, real_length ); + cps3_do_char_dma( machine, real_source, real_destination, real_length ); cpunum_set_input_line(machine, 0,10, ASSERT_LINE); } @@ -2199,7 +2199,7 @@ static void cps3_process_character_dma(running_machine *machine, UINT32 address) { /* 8bpp DMA decompression - this is used on SFIII NG Sean's Stage ONLY */ - cps3_do_alt_char_dma( real_source, real_destination, real_length); + cps3_do_alt_char_dma( machine, real_source, real_destination, real_length); cpunum_set_input_line(machine, 0,10, ASSERT_LINE); } else @@ -2429,8 +2429,8 @@ static emu_timer* fastboot_timer; static TIMER_CALLBACK( fastboot_timer_callback ) { - UINT32 *rom = (UINT32*)decrypted_gamerom;//memory_region ( REGION_USER4 ); - if (cps3_isSpecial) rom = (UINT32*)memory_region(REGION_USER4); + UINT32 *rom = (UINT32*)decrypted_gamerom;//memory_region ( machine, REGION_USER4 ); + if (cps3_isSpecial) rom = (UINT32*)memory_region(machine, REGION_USER4); // printf("fastboot callback %08x %08x", rom[0], rom[1]); cpunum_set_reg(0,SH2_PC, rom[0]); @@ -2475,9 +2475,9 @@ static MACHINE_RESET( cps3 ) -static void precopy_to_flash(void) +static void precopy_to_flash(running_machine *machine) { - UINT32* romdata = (UINT32*)memory_region(REGION_USER4); + UINT32* romdata = (UINT32*)memory_region(machine, REGION_USER4); int i; /* precopy program roms, ok, sfiii2 tests pass, others fail because of how the decryption affects testing */ for (i=0;i<0x800000;i+=4) @@ -2514,10 +2514,10 @@ static void precopy_to_flash(void) /* precopy gfx roms, good, tests pass */ { - UINT32 thebase, len = memory_region_length(REGION_USER5); + UINT32 thebase, len = memory_region_length(machine, REGION_USER5); int flashnum = 8; - romdata = (UINT32*)memory_region(REGION_USER5); + romdata = (UINT32*)memory_region(machine, REGION_USER5); for (thebase = 0;thebase < len/2; thebase+=0x200000) { // printf("flashnums %d. %d\n",flashnum, flashnum+1); @@ -2541,9 +2541,9 @@ static void precopy_to_flash(void) // make a copy in the regions we execute code / draw gfx from -static void copy_from_nvram(void) +static void copy_from_nvram(running_machine *machine) { - UINT32* romdata = (UINT32*)memory_region(REGION_USER4); + UINT32* romdata = (UINT32*)memory_region(machine, REGION_USER4); UINT32* romdata2 = (UINT32*)decrypted_gamerom; int i; /* copy + decrypt program roms which have been loaded from flashroms/nvram */ @@ -2583,11 +2583,11 @@ static void copy_from_nvram(void) /* copy gfx from loaded flashroms to user reigon 5, where it's used */ { - UINT32 thebase, len = memory_region_length(REGION_USER5); + UINT32 thebase, len = memory_region_length(machine, REGION_USER5); int flashnum = 8; int countoffset = 0; - romdata = (UINT32*)memory_region(REGION_USER5); + romdata = (UINT32*)memory_region(machine, REGION_USER5); for (thebase = 0;thebase < len/2; thebase+=0x200000) { // printf("flashnums %d. %d\n",flashnum, flashnum+1); @@ -2647,13 +2647,13 @@ static NVRAM_HANDLER( cps3 ) for (i=0;i<48;i++) nvram_handler_intelflash( machine, i, file, read_or_write ); - copy_from_nvram(); // copy data from flashroms back into user regions + decrypt into regions we execute/draw from. + copy_from_nvram(machine); // copy data from flashroms back into user regions + decrypt into regions we execute/draw from. } else { //printf("nothing?\n"); - precopy_to_flash(); // attempt to copy data from user regions into flash roms (incase this is a NOCD set) - copy_from_nvram(); // copy data from flashroms back into user regions + decrypt into regions we execute/draw from. + precopy_to_flash(machine); // attempt to copy data from user regions into flash roms (incase this is a NOCD set) + copy_from_nvram(machine); // copy data from flashroms back into user regions + decrypt into regions we execute/draw from. } @@ -3052,7 +3052,7 @@ static DRIVER_INIT( jojo ) // DEVELOPMENT VERSION add 0x70 mask! -// UINT32 *rom = (UINT32*)memory_region ( REGION_USER1 ); +// UINT32 *rom = (UINT32*)memory_region ( machine, REGION_USER1 ); // rom[0x1fec8/4]^=0x00000001; // region hack (clear jpn) // rom[0x1fec8/4]^=0x00000004; // region @@ -3080,7 +3080,7 @@ static DRIVER_INIT (jojoba) // DEVELOPMENT VERSION add 0x70 mask! -// UINT32 *rom = (UINT32*)memory_region ( REGION_USER1 ); +// UINT32 *rom = (UINT32*)memory_region ( machine, REGION_USER1 ); // rom[0x1fec8/4]^=0x00000001; // region (clear jpn) // rom[0x1fec8/4]^=0x00000002; // region // rom[0x1fec8/4]^=0x00000070; // DEV mode @@ -3105,7 +3105,7 @@ static DRIVER_INIT( warzard ) // OCEANIA 7 // ASIA NCD 8 -// UINT32 *rom = (UINT32*)memory_region ( REGION_USER1 ); +// UINT32 *rom = (UINT32*)memory_region ( machine, REGION_USER1 ); // rom[0x1fed8/4]^=0x00000001; // clear region to 0 (invalid) // rom[0x1fed8/4]^=0x00000008; // region 8 - ASIA NO CD - doesn't actually skip the CD test on startup, // only during game, must be another flag somewhere too, and we don't have @@ -3133,7 +3133,7 @@ static DRIVER_INIT( sfiii ) // bios rom also lists korea, but game rom does not. -// UINT32 *rom = (UINT32*)memory_region ( REGION_USER1 ); +// UINT32 *rom = (UINT32*)memory_region ( machine, REGION_USER1 ); // rom[0x1fec8/4]^=0x00000001; // region (clear region) // rom[0x1fec8/4]^=0x00000008; // region // rom[0x1fecc/4]^=0x01000000; // nocd - this ONLY skips the cd check in the bios test menu is region is ASIA NCD, otherwise it will report NG, Asia was probably the only NCD region for this @@ -3157,7 +3157,7 @@ static DRIVER_INIT( sfiii2 ) // OCEANIA 7 // ASIA 8 -// UINT32 *rom = (UINT32*)memory_region ( REGION_USER1 ); +// UINT32 *rom = (UINT32*)memory_region ( machine, REGION_USER1 ); // rom[0x1fec8/4]^=0x00000001; // region (clear region) // rom[0x1fec8/4]^=0x00000008; // region // rom[0x1fecc/4]^=0x01000000; // nocd - this ONLY skips the cd check in the bios test menu is region is ASIA NCD, otherwise it will report NG, Asia was probably the only NCD region for this @@ -3180,7 +3180,7 @@ static DRIVER_INIT( sfiii3 ) // BRAZIL 6 // OCEANIA 7 -// UINT32 *rom = (UINT32*)memory_region ( REGION_USER1 ); +// UINT32 *rom = (UINT32*)memory_region ( machine, REGION_USER1 ); // rom[0x1fec8/4]^=0x00000004; // region (clear region) // rom[0x1fec8/4]^=0x00000001; // region diff --git a/src/mame/drivers/crgolf.c b/src/mame/drivers/crgolf.c index f471def19c5..b864de311bd 100644 --- a/src/mame/drivers/crgolf.c +++ b/src/mame/drivers/crgolf.c @@ -59,7 +59,7 @@ static WRITE8_HANDLER( rom_bank_select_w ) static MACHINE_START( crgolf ) { /* configure the banking */ - memory_configure_bank(1, 0, 16, memory_region(REGION_CPU1) + 0x10000, 0x2000); + memory_configure_bank(1, 0, 16, memory_region(machine, REGION_CPU1) + 0x10000, 0x2000); memory_set_bank(1, 0); /* register for save states */ @@ -176,7 +176,7 @@ static void vck_callback(running_machine *machine, int data) /* only play back if we have data remaining */ if (sample_count != 0xff) { - UINT8 data = memory_region(REGION_SOUND1)[sample_offset >> 1]; + UINT8 data = memory_region(machine, REGION_SOUND1)[sample_offset >> 1]; /* write the next nibble and advance */ MSM5205_data_w(0, (data >> (4 * (~sample_offset & 1))) & 0x0f); diff --git a/src/mame/drivers/crimfght.c b/src/mame/drivers/crimfght.c index 8f8ae970da7..505c485ba44 100644 --- a/src/mame/drivers/crimfght.c +++ b/src/mame/drivers/crimfght.c @@ -489,7 +489,7 @@ ROM_END static void crimfght_banking( int lines ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(Machine, REGION_CPU1); int offs = 0; /* bit 5 = select work RAM or palette */ @@ -510,7 +510,7 @@ static void crimfght_banking( int lines ) static MACHINE_RESET( crimfght ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); cpunum_set_info_fct(0, CPUINFO_PTR_KONAMI_SETLINES_CALLBACK, (genf *)crimfght_banking); diff --git a/src/mame/drivers/crospang.c b/src/mame/drivers/crospang.c index 5bc4ad7f077..9bb67ec5a13 100644 --- a/src/mame/drivers/crospang.c +++ b/src/mame/drivers/crospang.c @@ -639,10 +639,10 @@ ROM_START( bestri ) ROM_END -static void tumblepb_gfx1_rearrange(void) +static void tumblepb_gfx1_rearrange(running_machine *machine) { - UINT8 *rom = memory_region(REGION_GFX1); - int len = memory_region_length(REGION_GFX1); + UINT8 *rom = memory_region(machine, REGION_GFX1); + int len = memory_region_length(machine, REGION_GFX1); int i; /* gfx data is in the wrong order */ @@ -662,7 +662,7 @@ static void tumblepb_gfx1_rearrange(void) static DRIVER_INIT( crospang ) { - tumblepb_gfx1_rearrange(); + tumblepb_gfx1_rearrange(machine); } GAME( 1998, crospang, 0, crospang, crospang, crospang, ROT0, "F2 System", "Cross Pang", 0 ) diff --git a/src/mame/drivers/crshrace.c b/src/mame/drivers/crshrace.c index 3fc0ac9608b..3fee3ae8fdc 100644 --- a/src/mame/drivers/crshrace.c +++ b/src/mame/drivers/crshrace.c @@ -134,7 +134,7 @@ TODO: static READ16_HANDLER( extrarom1_r ) { - UINT8 *rom = memory_region(REGION_USER1); + UINT8 *rom = memory_region(machine, REGION_USER1); offset *= 2; @@ -143,7 +143,7 @@ static READ16_HANDLER( extrarom1_r ) static READ16_HANDLER( extrarom2_r ) { - UINT8 *rom = memory_region(REGION_USER2); + UINT8 *rom = memory_region(machine, REGION_USER2); offset *= 2; @@ -152,7 +152,7 @@ static READ16_HANDLER( extrarom2_r ) static WRITE8_HANDLER( crshrace_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); } @@ -732,7 +732,7 @@ ROM_END void crshrace_patch_code(UINT16 offset) { /* A hack which shows 3 player mode in code which is disabled */ - UINT16 *RAM = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *RAM = (UINT16 *)memory_region(machine, REGION_CPU1); RAM[(offset + 0)/2] = 0x4e71; RAM[(offset + 2)/2] = 0x4e71; RAM[(offset + 4)/2] = 0x4e71; diff --git a/src/mame/drivers/crystal.c b/src/mame/drivers/crystal.c index 2e9d944af85..d26987b7b9b 100644 --- a/src/mame/drivers/crystal.c +++ b/src/mame/drivers/crystal.c @@ -230,9 +230,9 @@ static WRITE32_HANDLER(Banksw_w) { Bank=(data>>1)&7; if(Bank<=2) - memory_set_bankptr(1,memory_region(REGION_USER1)+Bank*0x1000000); + memory_set_bankptr(1,memory_region(machine, REGION_USER1)+Bank*0x1000000); else - memory_set_bankptr(1,memory_region(REGION_USER2)); + memory_set_bankptr(1,memory_region(machine, REGION_USER2)); } static TIMER_CALLBACK( Timer0cb ) @@ -353,7 +353,7 @@ static READ32_HANDLER(FlashCmd_r) { if(Bank<=2) { - UINT32 *ptr=(UINT32*)(memory_region(REGION_USER1)+Bank*0x1000000); + UINT32 *ptr=(UINT32*)(memory_region(machine, REGION_USER1)+Bank*0x1000000); return ptr[0]; } else @@ -580,7 +580,7 @@ static MACHINE_RESET(crystal) IntHigh=0; cpunum_set_irq_callback(0,icallback); Bank=0; - memory_set_bankptr(1,memory_region(REGION_USER1)+0); + memory_set_bankptr(1,memory_region(machine, REGION_USER1)+0); FlashCmd=0xff; OldPort4=0; @@ -904,7 +904,7 @@ ROM_END static DRIVER_INIT(crysking) { - UINT16 *Rom=(UINT16*) memory_region(REGION_USER1); + UINT16 *Rom=(UINT16*) memory_region(machine, REGION_USER1); //patch the data feed by the protection @@ -923,7 +923,7 @@ static DRIVER_INIT(crysking) static DRIVER_INIT(evosocc) { - UINT16 *Rom=(UINT16*) memory_region(REGION_USER1); + UINT16 *Rom=(UINT16*) memory_region(machine, REGION_USER1); Rom+=0x1000000*2/2; Rom[WORD_XOR_LE(0x97388E/2)]=0x90FC; //PUSH R2..R7 @@ -941,7 +941,7 @@ static DRIVER_INIT(evosocc) static DRIVER_INIT(topbladv) { - UINT16 *Rom=(UINT16*) memory_region(REGION_USER1); + UINT16 *Rom=(UINT16*) memory_region(machine, REGION_USER1); Rom[WORD_XOR_LE(0x12d7a/2)]=0x90FC; //PUSH R7-R6-R5-R4-R3-R2 Rom[WORD_XOR_LE(0x12d7c/2)]=0x9001; //PUSH R0 @@ -959,7 +959,7 @@ static DRIVER_INIT(topbladv) static DRIVER_INIT(officeye) { - UINT16 *Rom=(UINT16*) memory_region(REGION_USER1); + UINT16 *Rom=(UINT16*) memory_region(machine, REGION_USER1); Rom[WORD_XOR_LE(0x9c9e/2)]=0x901C; //PUSH R4-R3-R2 Rom[WORD_XOR_LE(0x9ca0/2)]=0x9001; //PUSH R0 diff --git a/src/mame/drivers/cshooter.c b/src/mame/drivers/cshooter.c index ee71ff40cc1..6ba057d82c2 100644 --- a/src/mame/drivers/cshooter.c +++ b/src/mame/drivers/cshooter.c @@ -234,7 +234,7 @@ static WRITE8_HANDLER ( cshooter_c700_w ) static WRITE8_HANDLER ( bank_w ) { - memory_set_bankptr(1,&memory_region(REGION_USER1)[0x4000*((data>>4)&3)]); + memory_set_bankptr(1,&memory_region(machine, REGION_USER1)[0x4000*((data>>4)&3)]); } @@ -706,18 +706,18 @@ ROM_END static DRIVER_INIT( cshooter ) { /* temp so it boots */ - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); rom[0xa2] = 0x00; rom[0xa3] = 0x00; rom[0xa4] = 0x00; - memory_set_bankptr(1,&memory_region(REGION_USER1)[0]); + memory_set_bankptr(1,&memory_region(machine, REGION_USER1)[0]); } static DRIVER_INIT( cshootre ) { int A; - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); UINT8 *decrypt = auto_malloc(0x8000); memory_set_decrypted_region(0, 0x0000, 0x7fff, decrypt); @@ -747,8 +747,8 @@ static DRIVER_INIT( cshootre ) rom[A] = BITSWAP8(rom[A],7,6,1,4,3,2,5,0); } - memory_set_bankptr(1,&memory_region(REGION_USER1)[0]); - seibu_sound_decrypt(REGION_CPU2,0x2000); + memory_set_bankptr(1,&memory_region(machine, REGION_USER1)[0]); + seibu_sound_decrypt(machine,REGION_CPU2,0x2000); } diff --git a/src/mame/drivers/csk.c b/src/mame/drivers/csk.c index cf65878426f..37fb790134a 100644 --- a/src/mame/drivers/csk.c +++ b/src/mame/drivers/csk.c @@ -887,7 +887,7 @@ ROM_END static DRIVER_INIT( cpoker ) { int A; - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); for (A = 0;A < 0x10000;A++) @@ -902,7 +902,7 @@ static DRIVER_INIT( cpoker ) static DRIVER_INIT( cska ) { int A; - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); for (A = 0;A < 0x10000;A++) diff --git a/src/mame/drivers/cubocd32.c b/src/mame/drivers/cubocd32.c index 7f28a442d03..a26ef785a4e 100644 --- a/src/mame/drivers/cubocd32.c +++ b/src/mame/drivers/cubocd32.c @@ -343,7 +343,7 @@ static DRIVER_INIT( cd32 ) /* set up memory */ memory_configure_bank(1, 0, 1, amiga_chip_ram32, 0); - memory_configure_bank(1, 1, 1, memory_region(REGION_USER1), 0); + memory_configure_bank(1, 1, 1, memory_region(machine, REGION_USER1), 0); /* intialize akiko */ amiga_akiko_init(machine); diff --git a/src/mame/drivers/cultures.c b/src/mame/drivers/cultures.c index ab56c45a51c..5bf2fb620d5 100644 --- a/src/mame/drivers/cultures.c +++ b/src/mame/drivers/cultures.c @@ -23,14 +23,14 @@ static int bg1_bank = 0, bg2_bank = 0; static TILE_GET_INFO( get_bg1_tile_info ) { - UINT8 *region = memory_region(REGION_GFX3) + 0x200000 + 0x80000 * bg1_bank; + UINT8 *region = memory_region(machine, REGION_GFX3) + 0x200000 + 0x80000 * bg1_bank; int code = region[tile_index*2] + (region[tile_index*2+1] << 8); SET_TILE_INFO(2, code, 0, 0); } static TILE_GET_INFO( get_bg2_tile_info ) { - UINT8 *region = memory_region(REGION_GFX2) + 0x200000 + 0x80000 * bg2_bank; + UINT8 *region = memory_region(machine, REGION_GFX2) + 0x200000 + 0x80000 * bg2_bank; int code = region[tile_index*2] + (region[tile_index*2+1] << 8); SET_TILE_INFO(1, code, 0, 0); } @@ -98,7 +98,7 @@ static VIDEO_UPDATE( cultures ) static WRITE8_HANDLER( cpu_bankswitch_w ) { - memory_set_bankptr(1, memory_region(REGION_CPU1) + 0x4000 * (data & 0xf)); + memory_set_bankptr(1, memory_region(machine, REGION_CPU1) + 0x4000 * (data & 0xf)); video_enable = ~data & 0x20; } @@ -116,8 +116,8 @@ static WRITE8_HANDLER( misc_w ) if(old_bank != new_bank) { // oki banking - UINT8 *src = memory_region(REGION_SOUND1) + 0x40000 + 0x20000 * new_bank; - UINT8 *dst = memory_region(REGION_SOUND1) + 0x20000; + UINT8 *src = memory_region(machine, REGION_SOUND1) + 0x40000 + 0x20000 * new_bank; + UINT8 *dst = memory_region(machine, REGION_SOUND1) + 0x20000; memcpy(dst, src, 0x20000); old_bank = new_bank; diff --git a/src/mame/drivers/cvs.c b/src/mame/drivers/cvs.c index c08f3a51858..e395816ed3b 100644 --- a/src/mame/drivers/cvs.c +++ b/src/mame/drivers/cvs.c @@ -436,11 +436,11 @@ static WRITE8_HANDLER( cvs_tms5110_pdc_w ) static int speech_rom_read_bit(void) { - UINT8 *ROM = memory_region(CVS_REGION_SPEECH_DATA); + UINT8 *ROM = memory_region(Machine, CVS_REGION_SPEECH_DATA); int bit; /* before reading the bit, clamp the address to the region length */ - speech_rom_bit_address = speech_rom_bit_address & ((memory_region_length(CVS_REGION_SPEECH_DATA) * 8) - 1); + speech_rom_bit_address = speech_rom_bit_address & ((memory_region_length(Machine, CVS_REGION_SPEECH_DATA) * 8) - 1); bit = (ROM[speech_rom_bit_address >> 3] >> (speech_rom_bit_address & 0x07)) & 0x01; /* prepare for next bit */ @@ -1535,7 +1535,7 @@ ROM_END static DRIVER_INIT( huncholy ) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); /* patch out protection */ ROM[0x0082] = 0xc0; @@ -1555,7 +1555,7 @@ static DRIVER_INIT( huncholy ) static DRIVER_INIT( hunchbka ) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); offs_t offs; @@ -1567,7 +1567,7 @@ static DRIVER_INIT( hunchbka ) static DRIVER_INIT( superbik ) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); /* patch out protection */ ROM[0x0079] = 0xc0; @@ -1595,7 +1595,7 @@ static DRIVER_INIT( superbik ) static DRIVER_INIT( hero ) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); /* patch out protection */ ROM[0x0087] = 0xc0; @@ -1617,7 +1617,7 @@ static DRIVER_INIT( hero ) static DRIVER_INIT( raiders ) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); offs_t offs; diff --git a/src/mame/drivers/cyberbal.c b/src/mame/drivers/cyberbal.c index 8fc1c945631..c8f23bbaf73 100644 --- a/src/mame/drivers/cyberbal.c +++ b/src/mame/drivers/cyberbal.c @@ -64,7 +64,7 @@ static MACHINE_RESET( cyberbal ) atarigen_scanline_timer_reset(machine->primary_screen, cyberbal_scanline_update, 8); atarigen_sound_io_reset(1); - cyberbal_sound_reset(); + cyberbal_sound_reset(machine); /* CPU 2 doesn't run until reset */ cpunum_set_input_line(machine, 2, INPUT_LINE_RESET, ASSERT_LINE); diff --git a/src/mame/drivers/cybertnk.c b/src/mame/drivers/cybertnk.c index 427243421ce..647ed6430ff 100644 --- a/src/mame/drivers/cybertnk.c +++ b/src/mame/drivers/cybertnk.c @@ -205,7 +205,7 @@ static VIDEO_UPDATE( cybertnk ) static DRIVER_INIT( cybertnk ) { #ifdef IGNORE_MISSING_ROM - UINT16 *ROM = (UINT16*)memory_region(REGION_CPU1); + UINT16 *ROM = (UINT16*)memory_region(machine, REGION_CPU1); /* nop the rom checksum branch */ ROM[0x1546/2] = 0x4e71; diff --git a/src/mame/drivers/dambustr.c b/src/mame/drivers/dambustr.c index b205420a6a9..a8d2e56228b 100644 --- a/src/mame/drivers/dambustr.c +++ b/src/mame/drivers/dambustr.c @@ -142,9 +142,9 @@ static DRIVER_INIT(dambustr) { int i, j, tmp; int tmpram[16]; - UINT8 *rom = memory_region(REGION_CPU1); - UINT8 *usr = memory_region(REGION_USER1); - UINT8 *gfx = memory_region(REGION_GFX1); + UINT8 *rom = memory_region(machine, REGION_CPU1); + UINT8 *usr = memory_region(machine, REGION_USER1); + UINT8 *gfx = memory_region(machine, REGION_GFX1); // Bit swap addresses for(i=0; i<4096*4; i++) { diff --git a/src/mame/drivers/darius.c b/src/mame/drivers/darius.c index a80b7354e38..9bdbeada888 100644 --- a/src/mame/drivers/darius.c +++ b/src/mame/drivers/darius.c @@ -296,17 +296,17 @@ static INT32 banknum = -1; static UINT8 adpcm_command = 0; static UINT8 nmi_enable = 0; -static void reset_sound_region(void) +static void reset_sound_region(running_machine *machine) { - memory_set_bankptr( STATIC_BANK1, memory_region(REGION_CPU2) + (banknum * 0x8000) + 0x10000 ); -// memory_set_bankptr( 1, memory_region(REGION_CPU2) + (banknum * 0x8000) + 0x10000 ); + memory_set_bankptr( STATIC_BANK1, memory_region(machine, REGION_CPU2) + (banknum * 0x8000) + 0x10000 ); +// memory_set_bankptr( 1, memory_region(machine, REGION_CPU2) + (banknum * 0x8000) + 0x10000 ); } static WRITE8_HANDLER( sound_bankswitch_w ) { banknum = data &0x03; - reset_sound_region(); + reset_sound_region(machine); // banknum = data; // reset_sound_region(); } @@ -1200,7 +1200,7 @@ static DRIVER_INIT( darius ) static STATE_POSTLOAD( darius_postload ) { parse_control(machine); - reset_sound_region(); + reset_sound_region(machine); } static MACHINE_START( darius ) @@ -1220,7 +1220,7 @@ static MACHINE_RESET( darius ) int i; /**** setup sound bank image ****/ - UINT8 *RAM = memory_region(REGION_CPU2); + UINT8 *RAM = memory_region(machine, REGION_CPU2); for( i = 3; i >= 0; i-- ){ memcpy( RAM + 0x8000*i + 0x10000, RAM, 0x4000 ); diff --git a/src/mame/drivers/darkhors.c b/src/mame/drivers/darkhors.c index b9bbdf327bb..6c1c05bf1ba 100644 --- a/src/mame/drivers/darkhors.c +++ b/src/mame/drivers/darkhors.c @@ -226,7 +226,7 @@ static NVRAM_HANDLER( darkhors ) else { // Set the EEPROM to Factory Defaults - eeprom_set_data(memory_region(REGION_USER1),(1<<7)); + eeprom_set_data(memory_region(machine, REGION_USER1),(1<<7)); } } } @@ -662,8 +662,8 @@ ROM_END static DRIVER_INIT( darkhors ) { - UINT32 *rom = (UINT32 *) memory_region(REGION_CPU1); - UINT8 *eeprom = (UINT8 *) memory_region(REGION_USER1); + UINT32 *rom = (UINT32 *) memory_region(machine, REGION_CPU1); + UINT8 *eeprom = (UINT8 *) memory_region(machine, REGION_USER1); int i; #if 1 diff --git a/src/mame/drivers/darkmist.c b/src/mame/drivers/darkmist.c index db206313988..dc5ad4f7d78 100644 --- a/src/mame/drivers/darkmist.c +++ b/src/mame/drivers/darkmist.c @@ -43,7 +43,7 @@ int darkmist_hw; static WRITE8_HANDLER(darkmist_hw_w) { darkmist_hw=data; - memory_set_bankptr(1,&memory_region(REGION_CPU1)[0x010000+((data&0x80)?0x4000:0)]); + memory_set_bankptr(1,&memory_region(machine, REGION_CPU1)[0x010000+((data&0x80)?0x4000:0)]); } static READ8_HANDLER(t5182shared_r) @@ -333,15 +333,15 @@ ROM_START( darkmist ) ROM_END -static void decrypt_gfx(void) +static void decrypt_gfx(running_machine *machine) { UINT8 *buf = malloc_or_die(0x40000); UINT8 *rom; int size; int i; - rom = memory_region(REGION_GFX1); - size = memory_region_length(REGION_GFX1); + rom = memory_region(machine, REGION_GFX1); + size = memory_region_length(machine, REGION_GFX1); /* data lines */ for (i = 0;i < size/2;i++) @@ -363,8 +363,8 @@ static void decrypt_gfx(void) } - rom = memory_region(REGION_GFX2); - size = memory_region_length(REGION_GFX2); + rom = memory_region(machine, REGION_GFX2); + size = memory_region_length(machine, REGION_GFX2); /* data lines */ for (i = 0;i < size/2;i++) @@ -386,8 +386,8 @@ static void decrypt_gfx(void) } - rom = memory_region(REGION_GFX3); - size = memory_region_length(REGION_GFX3); + rom = memory_region(machine, REGION_GFX3); + size = memory_region_length(machine, REGION_GFX3); /* data lines */ for (i = 0;i < size/2;i++) @@ -411,10 +411,10 @@ static void decrypt_gfx(void) free(buf); } -static void decrypt_snd(void) +static void decrypt_snd(running_machine *machine) { int i; - UINT8 *ROM = memory_region(REGION_CPU2); + UINT8 *ROM = memory_region(machine, REGION_CPU2); for(i=0x8000;i<0x10000;i++) ROM[i] = BITSWAP8(ROM[i], 7,1,2,3,4,5,6,0); @@ -423,13 +423,13 @@ static void decrypt_snd(void) static DRIVER_INIT(darkmist) { int i, len; - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); UINT8 *buffer = malloc_or_die(0x10000); UINT8 *decrypt = auto_malloc(0x8000); - decrypt_gfx(); + decrypt_gfx(machine); - decrypt_snd(); + decrypt_snd(machine); for(i=0;i<0x8000;i++) { @@ -459,8 +459,8 @@ static DRIVER_INIT(darkmist) memory_set_bankptr(1,&ROM[0x010000]); /* adr line swaps */ - ROM = memory_region(REGION_USER1); - len = memory_region_length(REGION_USER1); + ROM = memory_region(machine, REGION_USER1); + len = memory_region_length(machine, REGION_USER1); memcpy( buffer, ROM, len ); for(i=0;i<len;i++) @@ -468,24 +468,24 @@ static DRIVER_INIT(darkmist) ROM[i]=buffer[BITSWAP24(i,23,22,21,20,19,18,17,16,15,6,5,4,3,2,14,13,12,11,8,7,1,0,10,9)]; } - ROM = memory_region(REGION_USER2); - len = memory_region_length(REGION_USER2); + ROM = memory_region(machine, REGION_USER2); + len = memory_region_length(machine, REGION_USER2); memcpy( buffer, ROM, len ); for(i=0;i<len;i++) { ROM[i]=buffer[BITSWAP24(i,23,22,21,20,19,18,17,16,15,6,5,4,3,2,14,13,12,11,8,7,1,0,10,9)]; } - ROM = memory_region(REGION_USER3); - len = memory_region_length(REGION_USER3); + ROM = memory_region(machine, REGION_USER3); + len = memory_region_length(machine, REGION_USER3); memcpy( buffer, ROM, len ); for(i=0;i<len;i++) { ROM[i]=buffer[BITSWAP24(i,23,22,21,20,19,18,17,16,15,14 ,5,4,3,2,11,10,9,8,13,12,1,0,7,6)]; } - ROM = memory_region(REGION_USER4); - len = memory_region_length(REGION_USER4); + ROM = memory_region(machine, REGION_USER4); + len = memory_region_length(machine, REGION_USER4); memcpy( buffer, ROM, len ); for(i=0;i<len;i++) { diff --git a/src/mame/drivers/darkseal.c b/src/mame/drivers/darkseal.c index f500fa98c00..e3a429fe399 100644 --- a/src/mame/drivers/darkseal.c +++ b/src/mame/drivers/darkseal.c @@ -494,7 +494,7 @@ ROM_END static DRIVER_INIT( darkseal ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); int i; for (i=0x00000; i<0x80000; i++) diff --git a/src/mame/drivers/dassault.c b/src/mame/drivers/dassault.c index 745305c08ab..36f73b21bea 100644 --- a/src/mame/drivers/dassault.c +++ b/src/mame/drivers/dassault.c @@ -830,8 +830,8 @@ static READ16_HANDLER( thndzone_main_skip ) static DRIVER_INIT( dassault ) { - const UINT8 *src = memory_region(REGION_GFX1); - UINT8 *dst = memory_region(REGION_GFX2); + const UINT8 *src = memory_region(machine, REGION_GFX1); + UINT8 *dst = memory_region(machine, REGION_GFX2); UINT8 *tmp = malloc_or_die(0x80000); /* Playfield 4 also has access to the char graphics, make things easier @@ -850,8 +850,8 @@ static DRIVER_INIT( dassault ) static DRIVER_INIT( thndzone ) { - const UINT8 *src = memory_region(REGION_GFX1); - UINT8 *dst = memory_region(REGION_GFX2); + const UINT8 *src = memory_region(machine, REGION_GFX1); + UINT8 *dst = memory_region(machine, REGION_GFX2); UINT8 *tmp = malloc_or_die(0x80000); /* Playfield 4 also has access to the char graphics, make things easier diff --git a/src/mame/drivers/dblewing.c b/src/mame/drivers/dblewing.c index 89ca8949b64..84f484b4e46 100644 --- a/src/mame/drivers/dblewing.c +++ b/src/mame/drivers/dblewing.c @@ -636,8 +636,8 @@ ROM_END static DRIVER_INIT( dblewing ) { - deco56_decrypt(REGION_GFX1); - deco102_decrypt(REGION_CPU1, 0x399d, 0x25, 0x3d); + deco56_decrypt(machine, REGION_GFX1); + deco102_decrypt(machine, REGION_CPU1, 0x399d, 0x25, 0x3d); } diff --git a/src/mame/drivers/dbz.c b/src/mame/drivers/dbz.c index fdd7c4f4d6e..4568787bd36 100644 --- a/src/mame/drivers/dbz.c +++ b/src/mame/drivers/dbz.c @@ -562,7 +562,7 @@ static DRIVER_INIT( dbz ) konami_rom_deinterleave_2(REGION_GFX1); - ROM = (UINT16 *)memory_region(REGION_CPU1); + ROM = (UINT16 *)memory_region(machine, REGION_CPU1); // nop out dbz1's mask rom test // tile ROM test diff --git a/src/mame/drivers/dcon.c b/src/mame/drivers/dcon.c index adcd253216a..ca9446f7a7d 100644 --- a/src/mame/drivers/dcon.c +++ b/src/mame/drivers/dcon.c @@ -405,7 +405,7 @@ ROM_END /***************************************************************************/ static DRIVER_INIT( sdgndmps ) { - UINT16 *RAM = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *RAM = (UINT16 *)memory_region(machine, REGION_CPU1); RAM[0x1356/2] = 0x4e71; /* beq -> nop */ RAM[0x1358/2] = 0x4e71; diff --git a/src/mame/drivers/ddayjlc.c b/src/mame/drivers/ddayjlc.c index f0780b2188e..34f8da1f8d4 100644 --- a/src/mame/drivers/ddayjlc.c +++ b/src/mame/drivers/ddayjlc.c @@ -165,7 +165,7 @@ static WRITE8_HANDLER(bg2_w) { bgadr=(bgadr&0xfb)|((data&1)<<2); if(bgadr>2) bgadr=0; - memory_set_bankptr( 1, memory_region(REGION_USER1)+bgadr*0x4000 ); + memory_set_bankptr( 1, memory_region(machine, REGION_USER1)+bgadr*0x4000 ); } static WRITE8_HANDLER( sound_w ) @@ -559,8 +559,8 @@ static DRIVER_INIT( ddayjlc ) UINT8 *src, *dst, *temp; temp = malloc_or_die(0x10000); src = temp; - dst = memory_region(REGION_GFX1); - length = memory_region_length(REGION_GFX1); + dst = memory_region(machine, REGION_GFX1); + length = memory_region_length(machine, REGION_GFX1); memcpy(src, dst, length); newadr=0; oldaddr=0; @@ -574,7 +574,7 @@ static DRIVER_INIT( ddayjlc ) free(temp); } - memory_set_bankptr( 1, memory_region(REGION_USER1) ); + memory_set_bankptr( 1, memory_region(machine, REGION_USER1) ); } diff --git a/src/mame/drivers/ddenlovr.c b/src/mame/drivers/ddenlovr.c index 4fda5268a3b..f205217352b 100644 --- a/src/mame/drivers/ddenlovr.c +++ b/src/mame/drivers/ddenlovr.c @@ -358,8 +358,8 @@ INLINE void log_draw_error(int src, int cmd) static int blit_draw(int src,int sx) { - UINT8 *src_data = memory_region(REGION_GFX1); - int src_len = memory_region_length(REGION_GFX1); + UINT8 *src_data = memory_region(Machine, REGION_GFX1); + int src_len = memory_region_length(Machine, REGION_GFX1); int bit_addr = (src & 0xffffff) * ddenlovr_blit_rom_bits; /* convert to bit address */ int pen_size, arg_size, cmd; int x; @@ -1145,8 +1145,8 @@ static WRITE16_HANDLER( ddenlovr_blitter_irq_ack_w ) static READ8_HANDLER( rongrong_gfxrom_r ) { - UINT8 *rom = memory_region( REGION_GFX1 ); - size_t size = memory_region_length( REGION_GFX1 ); + UINT8 *rom = memory_region( machine, REGION_GFX1 ); + size_t size = memory_region_length( machine, REGION_GFX1 ); int address = ddenlovr_blit_address; if (address >= size) @@ -1217,7 +1217,7 @@ VIDEO_UPDATE(ddenlovr) #if 0 static int base = 0x0; - const UINT8 *gfx = memory_region(REGION_GFX1); + const UINT8 *gfx = memory_region(screen->machine, REGION_GFX1); int next; memset(ddenlovr_pixmap[0],0,512*512); memset(ddenlovr_pixmap[1],0,512*512); @@ -1822,7 +1822,7 @@ static READ8_HANDLER( rongrong_input_r ) static WRITE8_HANDLER( rongrong_select_w ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); //logerror("%04x: rongrong_select_w %02x\n",activecpu_get_pc(),data); /* bits 0-4 = **both** ROM bank **AND** input select */ @@ -1941,7 +1941,7 @@ static READ8_HANDLER( magic_r ) static WRITE8_HANDLER( mmpanic_rombank_w ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); memory_set_bankptr(1, &rom[0x10000 + 0x8000 * (data & 0x7)]); /* Bit 4? */ } @@ -2124,7 +2124,7 @@ static WRITE8_HANDLER( funkyfig_blitter_w ) static WRITE8_HANDLER( funkyfig_rombank_w ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); ddenlovr_select = data; @@ -2237,7 +2237,7 @@ ADDRESS_MAP_END static WRITE8_HANDLER( hanakanz_rombank_w ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); memory_set_bankptr(1, &rom[0x10000 + 0x8000 * (data & 0x0f)]); @@ -2297,8 +2297,8 @@ static READ8_HANDLER( hanakanz_busy_r ) static READ8_HANDLER( hanakanz_gfxrom_r ) { - UINT8 *rom = memory_region( REGION_GFX1 ); - size_t size = memory_region_length( REGION_GFX1 ); + UINT8 *rom = memory_region( machine, REGION_GFX1 ); + size_t size = memory_region_length( machine, REGION_GFX1 ); int address = (ddenlovr_blit_address & 0xffffff) * 2; static UINT8 romdata[2]; @@ -2496,8 +2496,8 @@ static UINT8 mjchuuka_romdata[2]; static void mjchuuka_get_romdata(void) { - UINT8 *rom = memory_region( REGION_GFX1 ); - size_t size = memory_region_length( REGION_GFX1 ); + UINT8 *rom = memory_region( Machine, REGION_GFX1 ); + size_t size = memory_region_length( Machine, REGION_GFX1 ); int address = (ddenlovr_blit_address & 0xffffff) * 2; if (address >= size) @@ -2621,7 +2621,7 @@ ADDRESS_MAP_END static WRITE8_HANDLER( mjmyster_rambank_w ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); memory_set_bankptr(2, &rom[0x90000 + 0x1000 * (data & 0x07)]); // logerror("%04x: rambank = %02x\n", activecpu_get_pc(), data); } @@ -2738,7 +2738,7 @@ ADDRESS_MAP_END static UINT8 hginga_rombank; static WRITE8_HANDLER( hginga_rombank_w ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); memory_set_bankptr(1, &rom[0x10000 + 0x8000 * (data & 0x7)]); hginga_rombank = data; } @@ -2746,7 +2746,7 @@ static WRITE8_HANDLER( hginga_rombank_w ) // similar to rongrong static READ8_HANDLER( hginga_protection_r ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); if (hginga_rombank & 0x10) return hanakanz_rand_r(machine,0); return rom[0x10000 + 0x8000 * (hginga_rombank & 0x7) + 0xf601 - 0x8000]; @@ -2971,7 +2971,7 @@ static WRITE8_HANDLER( hgokou_input_w ) // similar to rongrong static READ8_HANDLER( hgokou_protection_r ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); if (hginga_rombank == 0) return hanakanz_rand_r(machine,0); return rom[0x10000 + 0x8000 * (hginga_rombank & 0x7) + 0xe601 - 0x8000]; @@ -3030,7 +3030,7 @@ ADDRESS_MAP_END static WRITE8_HANDLER( hparadis_select_w ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); ddenlovr_select = data; hginga_ip = 0; @@ -3271,7 +3271,7 @@ ADDRESS_MAP_END static WRITE8_HANDLER( mjflove_rombank_w ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); memory_set_bankptr(1, &rom[0x10000 + 0x8000 * (data & 0xf)]); } diff --git a/src/mame/drivers/ddragon.c b/src/mame/drivers/ddragon.c index 307af492e6f..1ac95860dee 100644 --- a/src/mame/drivers/ddragon.c +++ b/src/mame/drivers/ddragon.c @@ -173,7 +173,7 @@ static TIMER_CALLBACK( ddragon_scanline_callback ) static MACHINE_START( ddragon ) { /* configure banks */ - memory_configure_bank(1, 0, 8, memory_region(REGION_CPU1) + 0x10000, 0x4000); + memory_configure_bank(1, 0, 8, memory_region(machine, REGION_CPU1) + 0x10000, 0x4000); /* allocate timer for scanlines */ scanline_timer = timer_alloc(ddragon_scanline_callback, NULL); @@ -473,7 +473,7 @@ static void dd_adpcm_int(running_machine *machine, int chip) } else { - UINT8 *ROM = memory_region(REGION_SOUND1) + 0x10000 * chip; + UINT8 *ROM = memory_region(machine, REGION_SOUND1) + 0x10000 * chip; adpcm_data[chip] = ROM[adpcm_pos[chip]++]; MSM5205_data_w(chip,adpcm_data[chip] >> 4); @@ -1903,26 +1903,26 @@ static DRIVER_INIT( toffy ) memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3808, 0x3808, 0, 0, toffy_bankswitch_w); /* the program rom has a simple bitswap encryption */ - rom = memory_region(REGION_CPU1); - length = memory_region_length(REGION_CPU1); + rom = memory_region(machine, REGION_CPU1); + length = memory_region_length(machine, REGION_CPU1); for (i = 0; i < length; i++) rom[i] = BITSWAP8(rom[i], 6,7,5,4,3,2,1,0); /* and the fg gfx ... */ - rom = memory_region(REGION_GFX1); - length = memory_region_length(REGION_GFX1); + rom = memory_region(machine, REGION_GFX1); + length = memory_region_length(machine, REGION_GFX1); for (i = 0; i < length; i++) rom[i] = BITSWAP8(rom[i], 7,6,5,3,4,2,1,0); /* and the sprites gfx */ - rom = memory_region(REGION_GFX2); - length = memory_region_length(REGION_GFX2); + rom = memory_region(machine, REGION_GFX2); + length = memory_region_length(machine, REGION_GFX2); for (i = 0; i < length; i++) rom[i] = BITSWAP8(rom[i], 7,6,5,4,3,2,0,1); /* and the bg gfx */ - rom = memory_region(REGION_GFX3); - length = memory_region_length(REGION_GFX3); + rom = memory_region(machine, REGION_GFX3); + length = memory_region_length(machine, REGION_GFX3); for (i = 0; i < length / 2; i++) { rom[i + 0*length/2] = BITSWAP8(rom[i + 0*length/2], 7,6,1,4,3,2,5,0); diff --git a/src/mame/drivers/ddrible.c b/src/mame/drivers/ddrible.c index f19a57f2b45..d8c5577c0f9 100644 --- a/src/mame/drivers/ddrible.c +++ b/src/mame/drivers/ddrible.c @@ -51,7 +51,7 @@ static INTERRUPT_GEN( ddrible_interrupt_1 ) static WRITE8_HANDLER( ddrible_bankswitch_w ) { int bankaddress; - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); bankaddress = 0x10000 + (data & 0x0f)*0x2000; memory_set_bankptr(1,&RAM[bankaddress]); @@ -100,7 +100,7 @@ static READ8_HANDLER( ddrible_vlm5030_busy_r ) static WRITE8_HANDLER( ddrible_vlm5030_ctrl_w ) { - UINT8 *SPEECH_ROM = memory_region(REGION_SOUND1); + UINT8 *SPEECH_ROM = memory_region(machine, REGION_SOUND1); /* b7 : vlm data bus OE */ /* b6 : VLM5030-RST */ /* b5 : VLM5030-ST */ diff --git a/src/mame/drivers/deadang.c b/src/mame/drivers/deadang.c index a6858bda98b..2897bfb558b 100644 --- a/src/mame/drivers/deadang.c +++ b/src/mame/drivers/deadang.c @@ -453,14 +453,14 @@ ROM_END static DRIVER_INIT( deadang ) { - seibu_sound_decrypt(REGION_CPU3, 0x2000); - seibu_adpcm_decrypt(REGION_SOUND1); + seibu_sound_decrypt(machine, REGION_CPU3, 0x2000); + seibu_adpcm_decrypt(machine, REGION_SOUND1); } static DRIVER_INIT( ghunter ) { - seibu_sound_decrypt(REGION_CPU3, 0x2000); - seibu_adpcm_decrypt(REGION_SOUND1); + seibu_sound_decrypt(machine, REGION_CPU3, 0x2000); + seibu_adpcm_decrypt(machine, REGION_SOUND1); memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x80000, 0x80001, 0, 0, ghunter_trackball_low_r); memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xb0000, 0xb0001, 0, 0, ghunter_trackball_high_r); diff --git a/src/mame/drivers/dec8.c b/src/mame/drivers/dec8.c index dfa71842713..3dfdaaddb5e 100644 --- a/src/mame/drivers/dec8.c +++ b/src/mame/drivers/dec8.c @@ -382,7 +382,7 @@ static WRITE8_HANDLER( garyoret_i8751_w ) static WRITE8_HANDLER( dec8_bank_w ) { int bankaddress; - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); bankaddress = 0x10000 + (data & 0x0f) * 0x4000; memory_set_bankptr(1,&RAM[bankaddress]); @@ -392,7 +392,7 @@ static WRITE8_HANDLER( dec8_bank_w ) static WRITE8_HANDLER( ghostb_bank_w ) { int bankaddress; - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); /* Bit 0: Interrupt enable/disable (I think..) Bit 1: NMI enable/disable @@ -411,7 +411,7 @@ static WRITE8_HANDLER( ghostb_bank_w ) static WRITE8_HANDLER( csilver_control_w ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); /* Bit 0x0f - ROM bank switch. @@ -460,7 +460,7 @@ static WRITE8_HANDLER( csilver_adpcm_data_w ) static WRITE8_HANDLER( csilver_sound_bank_w ) { - UINT8 *RAM = memory_region(REGION_CPU3); + UINT8 *RAM = memory_region(machine, REGION_CPU3); if (data&8) { memory_set_bankptr(3,&RAM[0x14000]); } else { memory_set_bankptr(3,&RAM[0x10000]); } @@ -3416,7 +3416,7 @@ static DRIVER_INIT( deco222 ) if (machine->config->cpu[2].type != CPU_DUMMY) sound_cpu = 2; /* bits 5 and 6 of the opcodes are swapped */ - rom = memory_region(REGION_CPU1+sound_cpu); + rom = memory_region(machine, REGION_CPU1+sound_cpu); decrypt = auto_malloc(0x8000); memory_set_decrypted_region(sound_cpu, 0x8000, 0xffff, decrypt); @@ -3428,7 +3428,7 @@ static DRIVER_INIT( deco222 ) static DRIVER_INIT( meikyuh ) { /* Blank out unused garbage in colour prom to avoid colour overflow */ - UINT8 *RAM = memory_region(REGION_PROMS); + UINT8 *RAM = memory_region(machine, REGION_PROMS); memset(RAM+0x20,0,0xe0); } diff --git a/src/mame/drivers/deco156.c b/src/mame/drivers/deco156.c index b8eeb35ab71..844fba53968 100644 --- a/src/mame/drivers/deco156.c +++ b/src/mame/drivers/deco156.c @@ -659,10 +659,10 @@ ROM_END /**********************************************************************************/ -static void descramble_sound( int region ) +static void descramble_sound( running_machine *machine, int region ) { - UINT8 *rom = memory_region(region); - int length = memory_region_length(region); + UINT8 *rom = memory_region(machine, region); + int length = memory_region_length(machine, region); UINT8 *buf1 = malloc_or_die(length); UINT32 x; @@ -687,16 +687,16 @@ static void descramble_sound( int region ) static DRIVER_INIT( hvysmsh ) { - deco56_decrypt(REGION_GFX1); /* 141 */ - deco156_decrypt(); - descramble_sound(REGION_SOUND2); + deco56_decrypt(machine, REGION_GFX1); /* 141 */ + deco156_decrypt(machine); + descramble_sound(machine, REGION_SOUND2); } static DRIVER_INIT( wcvol95 ) { - deco56_decrypt(REGION_GFX1); /* 141 */ - deco156_decrypt(); - descramble_sound(REGION_SOUND1); + deco56_decrypt(machine, REGION_GFX1); /* 141 */ + deco156_decrypt(machine); + descramble_sound(machine, REGION_SOUND1); } diff --git a/src/mame/drivers/deco32.c b/src/mame/drivers/deco32.c index be9712fed95..562405a58dc 100644 --- a/src/mame/drivers/deco32.c +++ b/src/mame/drivers/deco32.c @@ -3189,19 +3189,19 @@ ROM_END static DRIVER_INIT( captaven ) { - deco56_decrypt(REGION_GFX1); - deco56_decrypt(REGION_GFX2); + deco56_decrypt(machine, REGION_GFX1); + deco56_decrypt(machine, REGION_GFX2); } static DRIVER_INIT( dragngun ) { - UINT32 *ROM = (UINT32 *)memory_region(REGION_CPU1); - const UINT8 *SRC_RAM = memory_region(REGION_GFX1); - UINT8 *DST_RAM = memory_region(REGION_GFX2); + UINT32 *ROM = (UINT32 *)memory_region(machine, REGION_CPU1); + const UINT8 *SRC_RAM = memory_region(machine, REGION_GFX1); + UINT8 *DST_RAM = memory_region(machine, REGION_GFX2); - deco74_decrypt(REGION_GFX1); - deco74_decrypt(REGION_GFX2); - deco74_decrypt(REGION_GFX3); + deco74_decrypt(machine, REGION_GFX1); + deco74_decrypt(machine, REGION_GFX2); + deco74_decrypt(machine, REGION_GFX3); memcpy(DST_RAM+0x80000,SRC_RAM,0x10000); memcpy(DST_RAM+0x110000,SRC_RAM+0x10000,0x10000); @@ -3211,20 +3211,20 @@ static DRIVER_INIT( dragngun ) static DRIVER_INIT( fghthist ) { - deco56_decrypt(REGION_GFX1); - deco74_decrypt(REGION_GFX2); + deco56_decrypt(machine, REGION_GFX1); + deco74_decrypt(machine, REGION_GFX2); decoprot_reset(); } static DRIVER_INIT( lockload ) { - UINT8 *RAM = memory_region(REGION_CPU1); -// UINT32 *ROM = (UINT32 *)memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); +// UINT32 *ROM = (UINT32 *)memory_region(machine, REGION_CPU1); - deco74_decrypt(REGION_GFX1); - deco74_decrypt(REGION_GFX2); - deco74_decrypt(REGION_GFX3); + deco74_decrypt(machine, REGION_GFX1); + deco74_decrypt(machine, REGION_GFX2); + deco74_decrypt(machine, REGION_GFX3); memcpy(RAM+0x300000,RAM+0x100000,0x100000); memset(RAM+0x100000,0,0x100000); @@ -3236,7 +3236,7 @@ static DRIVER_INIT( lockload ) static DRIVER_INIT( tattass ) { - UINT8 *RAM = memory_region(REGION_GFX1); + UINT8 *RAM = memory_region(machine, REGION_GFX1); UINT8 *tmp = malloc_or_die(0x80000); /* Reorder bitplanes to make decoding easier */ @@ -3244,20 +3244,20 @@ static DRIVER_INIT( tattass ) memcpy(RAM+0x80000,RAM+0x100000,0x80000); memcpy(RAM+0x100000,tmp,0x80000); - RAM = memory_region(REGION_GFX2); + RAM = memory_region(machine, REGION_GFX2); memcpy(tmp,RAM+0x80000,0x80000); memcpy(RAM+0x80000,RAM+0x100000,0x80000); memcpy(RAM+0x100000,tmp,0x80000); free(tmp); - deco56_decrypt(REGION_GFX1); /* 141 */ - deco56_decrypt(REGION_GFX2); /* 141 */ + deco56_decrypt(machine, REGION_GFX1); /* 141 */ + deco56_decrypt(machine, REGION_GFX2); /* 141 */ } static DRIVER_INIT( nslasher ) { - UINT8 *RAM = memory_region(REGION_GFX1); + UINT8 *RAM = memory_region(machine, REGION_GFX1); UINT8 *tmp = malloc_or_die(0x80000); /* Reorder bitplanes to make decoding easier */ @@ -3265,17 +3265,17 @@ static DRIVER_INIT( nslasher ) memcpy(RAM+0x80000,RAM+0x100000,0x80000); memcpy(RAM+0x100000,tmp,0x80000); - RAM = memory_region(REGION_GFX2); + RAM = memory_region(machine, REGION_GFX2); memcpy(tmp,RAM+0x80000,0x80000); memcpy(RAM+0x80000,RAM+0x100000,0x80000); memcpy(RAM+0x100000,tmp,0x80000); free(tmp); - deco56_decrypt(REGION_GFX1); /* 141 */ - deco74_decrypt(REGION_GFX2); + deco56_decrypt(machine, REGION_GFX1); /* 141 */ + deco74_decrypt(machine, REGION_GFX2); - deco156_decrypt(); + deco156_decrypt(machine); soundlatch_setclearedvalue(machine, 0xff); diff --git a/src/mame/drivers/deco_mlc.c b/src/mame/drivers/deco_mlc.c index aef90499f7c..987c2e2a3d8 100644 --- a/src/mame/drivers/deco_mlc.c +++ b/src/mame/drivers/deco_mlc.c @@ -682,11 +682,11 @@ ROM_END /***************************************************************************/ -static void descramble_sound( void ) +static void descramble_sound( running_machine *machine ) { /* the same as simpl156 / heavy smash? */ - UINT8 *rom = memory_region(REGION_SOUND1); - int length = memory_region_length(REGION_SOUND1); + UINT8 *rom = memory_region(machine, REGION_SOUND1); + int length = memory_region_length(machine, REGION_SOUND1); UINT8 *buf1 = malloc_or_die(length); UINT32 x; @@ -724,7 +724,7 @@ static DRIVER_INIT( avengrgs ) { mainCpuIsArm=0; memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x01089a0, 0x01089a3, 0, 0, avengrgs_speedup_r ); - descramble_sound(); + descramble_sound(machine); } static DRIVER_INIT( mlc ) @@ -734,8 +734,8 @@ static DRIVER_INIT( mlc ) Skull Fung where there probably shouldn't be. */ cpunum_set_clockscale(machine, 0, 2.0f); mainCpuIsArm=1; - deco156_decrypt(); - descramble_sound(); + deco156_decrypt(machine); + descramble_sound(machine); } /***************************************************************************/ diff --git a/src/mame/drivers/decocass.c b/src/mame/drivers/decocass.c index 53dbefc1b6a..fb94a0a5320 100644 --- a/src/mame/drivers/decocass.c +++ b/src/mame/drivers/decocass.c @@ -1104,7 +1104,7 @@ ROM_END static DRIVER_INIT( decocass ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); int A; /* allocate memory and mark all RAM regions with their decrypted pointers */ @@ -1125,8 +1125,8 @@ static DRIVER_INIT( decocass ) static DRIVER_INIT( decocrom ) { - int romlength = memory_region_length(REGION_USER3); - UINT8 *rom = memory_region(REGION_USER3); + int romlength = memory_region_length(machine, REGION_USER3); + UINT8 *rom = memory_region(machine, REGION_USER3); UINT8 *decrypted2 = auto_malloc(romlength); int i; @@ -1140,7 +1140,7 @@ static DRIVER_INIT( decocrom ) /* convert charram to a banked ROM */ memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000, 0xafff, 0, 0, SMH_BANK1, decocass_de0091_w); memory_configure_bank(1, 0, 1, decocass_charram, 0); - memory_configure_bank(1, 1, 1, memory_region(REGION_USER3), 0); + memory_configure_bank(1, 1, 1, memory_region(machine, REGION_USER3), 0); memory_configure_bank_decrypted(1, 0, 1, &decrypted[0x6000], 0); memory_configure_bank_decrypted(1, 1, 1, decrypted2, 0); memory_set_bank(1, 0); diff --git a/src/mame/drivers/dgpix.c b/src/mame/drivers/dgpix.c index d829bdd2e5e..201c6e4998e 100644 --- a/src/mame/drivers/dgpix.c +++ b/src/mame/drivers/dgpix.c @@ -59,7 +59,7 @@ static UINT32 flash_cmd = 0; static READ32_HANDLER( flash_r ) { - UINT32 *ROM = (UINT32 *)memory_region(REGION_USER1); + UINT32 *ROM = (UINT32 *)memory_region(machine, REGION_USER1); if(offset >= (0x2000000 - flash_roms * 0x400000) / 4) { @@ -98,7 +98,7 @@ static WRITE32_HANDLER( flash_w ) if(data == 0xd0d00000) { // point to game settings - UINT8 *rom = (UINT8 *)memory_region(REGION_USER1) + offset*4; + UINT8 *rom = (UINT8 *)memory_region(machine, REGION_USER1) + offset*4; // erase one block memset(rom, 0xff, 0x10000); @@ -116,7 +116,7 @@ static WRITE32_HANDLER( flash_w ) } else { - UINT16 *rom = (UINT16 *)memory_region(REGION_USER1); + UINT16 *rom = (UINT16 *)memory_region(machine, REGION_USER1); // write game settings @@ -209,7 +209,7 @@ static NVRAM_HANDLER( flashroms ) if (read_or_write) { // point to game settings - UINT8 *rom = (UINT8 *)memory_region(REGION_USER1) + 0x1c00000 + 0x360000; + UINT8 *rom = (UINT8 *)memory_region(machine, REGION_USER1) + 0x1c00000 + 0x360000; UINT8 tmp[0x40000]; int i; @@ -222,7 +222,7 @@ static NVRAM_HANDLER( flashroms ) else if (file) { // point to game settings - UINT8 *rom = (UINT8 *)memory_region(REGION_USER1) + 0x1c00000 + 0x360000; + UINT8 *rom = (UINT8 *)memory_region(machine, REGION_USER1) + 0x1c00000 + 0x360000; UINT8 tmp[0x40000]; int i; @@ -547,7 +547,7 @@ ROM_END static DRIVER_INIT( xfiles ) { - UINT8 *rom = (UINT8 *)memory_region(REGION_USER1) + 0x1c00000; + UINT8 *rom = (UINT8 *)memory_region(machine, REGION_USER1) + 0x1c00000; rom[BYTE4_XOR_BE(0x3aa92e)] = 3; rom[BYTE4_XOR_BE(0x3aa92f)] = 0; @@ -564,7 +564,7 @@ static DRIVER_INIT( xfiles ) static DRIVER_INIT( kdynastg ) { - UINT8 *rom = (UINT8 *)memory_region(REGION_USER1) + 0x1c00000; + UINT8 *rom = (UINT8 *)memory_region(machine, REGION_USER1) + 0x1c00000; rom[BYTE4_XOR_BE(0x3aaa10)] = 3; // 129f0 - nopped call rom[BYTE4_XOR_BE(0x3aaa11)] = 0; diff --git a/src/mame/drivers/dietgo.c b/src/mame/drivers/dietgo.c index 8223af9c60a..6114e587883 100644 --- a/src/mame/drivers/dietgo.c +++ b/src/mame/drivers/dietgo.c @@ -350,8 +350,8 @@ ROM_END static DRIVER_INIT( dietgo ) { - deco56_decrypt(REGION_GFX1); - deco102_decrypt(REGION_CPU1, 0xe9ba, 0x01, 0x19); + deco56_decrypt(machine, REGION_GFX1); + deco102_decrypt(machine, REGION_CPU1, 0xe9ba, 0x01, 0x19); } GAME( 1992, dietgo, 0, dietgo, dietgo, dietgo, ROT0, "Data East Corporation", "Diet Go Go (Euro v1.1 1992.09.26)", 0 ) diff --git a/src/mame/drivers/discoboy.c b/src/mame/drivers/discoboy.c index 9ace5478f0d..fe4e6978b32 100644 --- a/src/mame/drivers/discoboy.c +++ b/src/mame/drivers/discoboy.c @@ -167,7 +167,7 @@ static VIDEO_UPDATE( discoboy ) #ifdef UNUSED_FUNCTION void discoboy_setrombank(UINT8 data) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); data &=0x2f; memory_set_bankptr(1, &ROM[0x6000+(data*0x1000)] ); } @@ -187,7 +187,7 @@ static WRITE8_HANDLER( discoboy_port_00_w ) static WRITE8_HANDLER( discoboy_port_01_w ) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); int rombank; // 00 10 20 30 during gameplay 1,2,3 other times?? title screen bit 0x40 toggle @@ -514,7 +514,7 @@ MACHINE_DRIVER_END static DRIVER_INIT( discoboy ) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); discoboy_ram_part1 = auto_malloc(0x800); discoboy_ram_part2 = auto_malloc(0x800); diff --git a/src/mame/drivers/djboy.c b/src/mame/drivers/djboy.c index 91666de337a..4f4d91d581d 100644 --- a/src/mame/drivers/djboy.c +++ b/src/mame/drivers/djboy.c @@ -662,7 +662,7 @@ static WRITE8_HANDLER( trigger_nmi_on_cpu0 ) static WRITE8_HANDLER( cpu0_bankswitch_w ) { - unsigned char *RAM = memory_region(REGION_CPU1); + unsigned char *RAM = memory_region(machine, REGION_CPU1); data ^= bankxor; memory_set_bankptr(4,&RAM[0x10000]); /* unsure if/how this area is banked */ if( data < 4 ) @@ -686,7 +686,7 @@ static WRITE8_HANDLER( cpu0_bankswitch_w ) */ static WRITE8_HANDLER( cpu1_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_CPU2); + UINT8 *RAM = memory_region(machine, REGION_CPU2); djboy_set_videoreg( data ); switch( data&0xf ) { @@ -721,7 +721,7 @@ static WRITE8_HANDLER( trigger_nmi_on_sound_cpu2 ) static WRITE8_HANDLER( cpu2_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_CPU3); + UINT8 *RAM = memory_region(machine, REGION_CPU3); if( data<3 ) { diff --git a/src/mame/drivers/djmain.c b/src/mame/drivers/djmain.c index 540c60aacb1..70037742c63 100644 --- a/src/mame/drivers/djmain.c +++ b/src/mame/drivers/djmain.c @@ -92,9 +92,9 @@ static WRITE32_HANDLER( paletteram32_w ) //--------- -static void sndram_set_bank(void) +static void sndram_set_bank(running_machine *machine) { - sndram = memory_region(REGION_SOUND1) + 0x80000 * sndram_bank; + sndram = memory_region(machine, REGION_SOUND1) + 0x80000 * sndram_bank; } static WRITE32_HANDLER( sndram_bank_w ) @@ -102,7 +102,7 @@ static WRITE32_HANDLER( sndram_bank_w ) if (ACCESSING_BITS_16_31) { sndram_bank = (data >> 16) & 0x1f; - sndram_set_bank(); + sndram_set_bank(machine); } } @@ -203,7 +203,7 @@ static WRITE32_HANDLER( obj_ctrl_w ) static READ32_HANDLER( obj_rom_r ) { - UINT8 *mem8 = memory_region(REGION_GFX1); + UINT8 *mem8 = memory_region(machine, REGION_GFX1); int bank = obj_regs[0x28/4] >> 16; offset += bank * 0x200; @@ -239,7 +239,7 @@ static WRITE32_HANDLER( v_ctrl_w ) static READ32_HANDLER( v_rom_r ) { - UINT8 *mem8 = memory_region(REGION_GFX2); + UINT8 *mem8 = memory_region(machine, REGION_GFX2); int bank = K056832_word_r(machine, 0x34/2, 0xffff); offset *= 2; @@ -1176,13 +1176,13 @@ static const struct K054539interface k054539_interface = static STATE_POSTLOAD( djmain_postload ) { - sndram_set_bank(); + sndram_set_bank(machine); } static MACHINE_START( djmain ) { const device_config *ide = device_list_find_by_tag(machine->config->devicelist, IDE_CONTROLLER, "ide"); - UINT8 *region = memory_region(REGION_SOUND1); + UINT8 *region = memory_region(machine, REGION_SOUND1); if (ide != NULL && ide_master_password != NULL) ide_set_master_password(ide, ide_master_password); @@ -1203,7 +1203,7 @@ static MACHINE_RESET( djmain ) { /* reset sound ram bank */ sndram_bank = 0; - sndram_set_bank(); + sndram_set_bank(machine); /* reset the IDE controller */ devtag_reset(machine, IDE_CONTROLLER, "ide"); diff --git a/src/mame/drivers/dkong.c b/src/mame/drivers/dkong.c index 4aebe6fe5a3..ff4d49c1d1b 100644 --- a/src/mame/drivers/dkong.c +++ b/src/mame/drivers/dkong.c @@ -399,7 +399,7 @@ static MACHINE_START( dkong2b ) static MACHINE_START( hunchbkd ) { - UINT8 *p = memory_region(REGION_USER1); + UINT8 *p = memory_region(machine, REGION_USER1); int i; dkong_state *state = machine->driver_data; @@ -448,7 +448,7 @@ static MACHINE_RESET( dkong ) static MACHINE_RESET( strtheat ) { dkong_state *state = machine->driver_data; - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); MACHINE_RESET_CALL(dkong); @@ -461,7 +461,7 @@ static MACHINE_RESET( strtheat ) static MACHINE_RESET( drakton ) { dkong_state *state = machine->driver_data; - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); MACHINE_RESET_CALL(dkong); @@ -2849,13 +2849,13 @@ ROM_END * *************************************/ -static void drakton_decrypt_rom(UINT8 mod, int offs, int *bs) +static void drakton_decrypt_rom(running_machine *machine, UINT8 mod, int offs, int *bs) { UINT8 oldbyte,newbyte; UINT8 *ROM; int mem; - ROM = memory_region(REGION_CPU1); + ROM = memory_region(machine, REGION_CPU1); for (mem=0;mem<0x4000;mem++) { @@ -2881,7 +2881,7 @@ static void drakton_decrypt_rom(UINT8 mod, int offs, int *bs) static DRIVER_INIT( herodk ) { int A; - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); /* swap data lines D3 and D4 */ for (A = 0;A < 0x8000;A++) @@ -2912,10 +2912,10 @@ static DRIVER_INIT( drakton ) are actually used in the PAL. Therefore, we'll take a little memory overhead and decrypt the ROMs using each method in advance. */ - drakton_decrypt_rom(0x02, 0x10000, bs[0]); - drakton_decrypt_rom(0x40, 0x14000, bs[1]); - drakton_decrypt_rom(0x8a, 0x18000, bs[2]); - drakton_decrypt_rom(0xc8, 0x1c000, bs[3]); + drakton_decrypt_rom(machine, 0x02, 0x10000, bs[0]); + drakton_decrypt_rom(machine, 0x40, 0x14000, bs[1]); + drakton_decrypt_rom(machine, 0x8a, 0x18000, bs[2]); + drakton_decrypt_rom(machine, 0xc8, 0x1c000, bs[3]); } @@ -2933,10 +2933,10 @@ static DRIVER_INIT( strtheat ) /* While the PAL supports up to 16 decryption methods, only four are actually used in the PAL. Therefore, we'll take a little memory overhead and decrypt the ROMs using each method in advance. */ - drakton_decrypt_rom(0x03, 0x10000, bs[0]); - drakton_decrypt_rom(0x81, 0x14000, bs[1]); - drakton_decrypt_rom(0x0a, 0x18000, bs[2]); - drakton_decrypt_rom(0x88, 0x1c000, bs[3]); + drakton_decrypt_rom(machine, 0x03, 0x10000, bs[0]); + drakton_decrypt_rom(machine, 0x81, 0x14000, bs[1]); + drakton_decrypt_rom(machine, 0x0a, 0x18000, bs[2]); + drakton_decrypt_rom(machine, 0x88, 0x1c000, bs[3]); /* custom handlers supporting Joystick or Steering Wheel */ memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x7c00, 0x7c00, 0, 0, strtheat_inputport_0_r); diff --git a/src/mame/drivers/docastle.c b/src/mame/drivers/docastle.c index 430c3dd488e..c1075ff9fca 100644 --- a/src/mame/drivers/docastle.c +++ b/src/mame/drivers/docastle.c @@ -163,7 +163,7 @@ static void idsoccer_adpcm_int(running_machine *machine, int chip) { static int adpcm_data = -1; - if (adpcm_pos >= memory_region_length(REGION_SOUND1)) + if (adpcm_pos >= memory_region_length(machine, REGION_SOUND1)) { adpcm_idle = 1; MSM5205_reset_w(0, 1); @@ -175,7 +175,7 @@ static void idsoccer_adpcm_int(running_machine *machine, int chip) } else { - adpcm_data = memory_region(REGION_SOUND1)[adpcm_pos++]; + adpcm_data = memory_region(machine, REGION_SOUND1)[adpcm_pos++]; MSM5205_data_w(0, adpcm_data >> 4); } } diff --git a/src/mame/drivers/dooyong.c b/src/mame/drivers/dooyong.c index 479f1332383..06ec4c12a49 100644 --- a/src/mame/drivers/dooyong.c +++ b/src/mame/drivers/dooyong.c @@ -107,7 +107,7 @@ static WRITE8_HANDLER( lastday_bankswitch_w ) static MACHINE_START( lastday ) { - memory_configure_bank(1, 0, 8, memory_region(REGION_CPU1) + 0x10000, 0x4000); + memory_configure_bank(1, 0, 8, memory_region(machine, REGION_CPU1) + 0x10000, 0x4000); } static WRITE8_HANDLER( flip_screen_w ) diff --git a/src/mame/drivers/dorachan.c b/src/mame/drivers/dorachan.c index c75e04aa802..e6d8f85550b 100644 --- a/src/mame/drivers/dorachan.c +++ b/src/mame/drivers/dorachan.c @@ -75,7 +75,7 @@ static VIDEO_UPDATE( dorachan ) get_pens(pens); - color_map_base = memory_region(REGION_PROMS); + color_map_base = memory_region(screen->machine, REGION_PROMS); for (offs = 0; offs < dorachan_videoram_size; offs++) { diff --git a/src/mame/drivers/dreamwld.c b/src/mame/drivers/dreamwld.c index 8db1baa8700..9042c84ed25 100644 --- a/src/mame/drivers/dreamwld.c +++ b/src/mame/drivers/dreamwld.c @@ -55,7 +55,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta const gfx_element *gfx = machine->gfx[0]; UINT32 *source = spriteram32; UINT32 *finish = spriteram32 + 0x1000/4; - UINT16 *redirect = (UINT16 *)memory_region(REGION_GFX3); + UINT16 *redirect = (UINT16 *)memory_region(machine, REGION_GFX3); while( source<finish ) { @@ -183,8 +183,8 @@ static VIDEO_UPDATE(dreamwld) static READ32_HANDLER( dreamwld_protdata_r ) { static int protindex = 0; - UINT8 *protdata = memory_region( REGION_USER1 ); - size_t protsize = memory_region_length( REGION_USER1 ); + UINT8 *protdata = memory_region( machine, REGION_USER1 ); + size_t protsize = memory_region_length( machine, REGION_USER1 ); UINT8 dat = protdata[(protindex++)%protsize]; return dat<<24; } @@ -235,11 +235,11 @@ static WRITE32_HANDLER(dreamwld_6295_0_w) } } -static void dreamwld_oki_setbank( UINT8 chip, UINT8 bank ) +static void dreamwld_oki_setbank( running_machine *machine, UINT8 chip, UINT8 bank ) { /* 0x30000-0x3ffff is banked. banks are at 0x30000,0x40000,0x50000 and 0x60000 in rom */ - UINT8 *sound = memory_region(chip ? REGION_SOUND1 : REGION_SOUND2); + UINT8 *sound = memory_region(machine, chip ? REGION_SOUND1 : REGION_SOUND2); logerror("OKI%d: set bank %02x\n",chip,bank); memcpy(sound+0x30000, sound+0xb0000+0x10000*bank, 0x10000); } @@ -249,7 +249,7 @@ static WRITE32_HANDLER( dreamwld_6295_0_bank_w ) { if (ACCESSING_BITS_0_7) { - dreamwld_oki_setbank(0,data&0x3); + dreamwld_oki_setbank(machine,0,data&0x3); } else { @@ -278,7 +278,7 @@ static WRITE32_HANDLER( dreamwld_6295_1_bank_w ) { if (ACCESSING_BITS_0_7) { - dreamwld_oki_setbank(1,data&0x3); + dreamwld_oki_setbank(machine,1,data&0x3); } else { diff --git a/src/mame/drivers/drgnmst.c b/src/mame/drivers/drgnmst.c index 0f71afdea88..8a4eb79112f 100644 --- a/src/mame/drivers/drgnmst.c +++ b/src/mame/drivers/drgnmst.c @@ -448,9 +448,9 @@ static UINT8 drgnmst_asciitohex(UINT8 data) static DRIVER_INIT( drgnmst ) { - UINT8 *drgnmst_PICROM_HEX = memory_region(REGION_USER1); - UINT16 *drgnmst_PICROM = (UINT16 *)memory_region(REGION_CPU2); - UINT8 *drgnmst_PCM = memory_region(REGION_SOUND1); + UINT8 *drgnmst_PICROM_HEX = memory_region(machine, REGION_USER1); + UINT16 *drgnmst_PICROM = (UINT16 *)memory_region(machine, REGION_CPU2); + UINT8 *drgnmst_PCM = memory_region(machine, REGION_SOUND1); INT32 offs, data; UINT16 src_pos = 0; UINT16 dst_pos = 0; diff --git a/src/mame/drivers/drmicro.c b/src/mame/drivers/drmicro.c index a285fea2d34..d6e55c082ea 100644 --- a/src/mame/drivers/drmicro.c +++ b/src/mame/drivers/drmicro.c @@ -47,7 +47,7 @@ static int pcm_adr; static void pcm_w(running_machine *machine, int irq) { - UINT8 *PCM = memory_region(REGION_SOUND1); + UINT8 *PCM = memory_region(machine, REGION_SOUND1); int data = PCM[pcm_adr / 2]; diff --git a/src/mame/drivers/dunhuang.c b/src/mame/drivers/dunhuang.c index 422d4c889d3..56628a2bba6 100644 --- a/src/mame/drivers/dunhuang.c +++ b/src/mame/drivers/dunhuang.c @@ -262,7 +262,7 @@ static WRITE8_HANDLER( dunhuang_block_h_w ) dunhuang_block_h = data; - tile_addr = memory_region(REGION_GFX2) + ((dunhuang_block_addr_hi << 8) + dunhuang_block_addr_lo)*4; + tile_addr = memory_region(machine, REGION_GFX2) + ((dunhuang_block_addr_hi << 8) + dunhuang_block_addr_lo)*4; switch (dunhuang_block_dest) { @@ -373,7 +373,7 @@ static READ8_HANDLER( dunhuang_input_r ) static WRITE8_HANDLER( dunhuang_rombank_w ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); memory_set_bankptr( 1, rom + 0x10000 + 0x8000 * ((data >> 2) & 0x7) ); // ? data & 0x01 diff --git a/src/mame/drivers/dwarfd.c b/src/mame/drivers/dwarfd.c index 282bfbd19b5..9b9f01acb50 100644 --- a/src/mame/drivers/dwarfd.c +++ b/src/mame/drivers/dwarfd.c @@ -746,8 +746,8 @@ static DRIVER_INIT(dwarfd) UINT8 *src, *dst; /* expand gfx roms */ - src = memory_region ( REGION_GFX1 ); - dst = memory_region ( REGION_GFX2 ); + src = memory_region ( machine, REGION_GFX1 ); + dst = memory_region ( machine, REGION_GFX2 ); for (i=0;i<0x4000;i++) { UINT8 dat; @@ -759,7 +759,7 @@ static DRIVER_INIT(dwarfd) } /* use low bit as 'interpolation' bit */ - src = memory_region ( REGION_GFX2 ); + src = memory_region ( machine, REGION_GFX2 ); for (i=0;i<0x8000;i++) { if (src[i]&0x10) diff --git a/src/mame/drivers/dynadice.c b/src/mame/drivers/dynadice.c index bb9b5c4fb8e..57267da2b61 100644 --- a/src/mame/drivers/dynadice.c +++ b/src/mame/drivers/dynadice.c @@ -250,10 +250,10 @@ ROM_END static DRIVER_INIT( dynadice ) { int i,j; - UINT8 *usr1 = memory_region(REGION_USER1); - UINT8 *cpu2 = memory_region(REGION_CPU2); - UINT8 *gfx1 = memory_region(REGION_GFX1); - UINT8 *gfx2 = memory_region(REGION_GFX2); + UINT8 *usr1 = memory_region(machine, REGION_USER1); + UINT8 *cpu2 = memory_region(machine, REGION_CPU2); + UINT8 *gfx1 = memory_region(machine, REGION_GFX1); + UINT8 *gfx2 = memory_region(machine, REGION_GFX2); cpu2[0x0b]=0x23; /* bug in game code Dec HL -> Inc HL*/ diff --git a/src/mame/drivers/dynax.c b/src/mame/drivers/dynax.c index 1691bac1070..061ce643cbc 100644 --- a/src/mame/drivers/dynax.c +++ b/src/mame/drivers/dynax.c @@ -268,13 +268,13 @@ static WRITE8_HANDLER( hanamai_keyboard_w ) static WRITE8_HANDLER( dynax_rombank_w ) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); memory_set_bankptr(1,&ROM[0x08000+0x8000*(data & 0x0f)]); } static WRITE8_HANDLER( jantouki_sound_rombank_w ) { - UINT8 *ROM = memory_region(REGION_CPU2); + UINT8 *ROM = memory_region(machine, REGION_CPU2); memory_set_bankptr(2,&ROM[0x08000+0x8000*data]); } @@ -283,7 +283,7 @@ static int hnoridur_bank; static WRITE8_HANDLER( hnoridur_rombank_w ) { - UINT8 *ROM = memory_region(REGION_CPU1) + 0x10000 + 0x8000*data; + UINT8 *ROM = memory_region(machine, REGION_CPU1) + 0x10000 + 0x8000*data; //logerror("%04x: rom bank = %02x\n",activecpu_get_pc(),data); memory_set_bankptr(1,ROM); hnoridur_bank = data; @@ -315,7 +315,7 @@ static WRITE8_HANDLER( hnoridur_palette_w ) // hnoridur: R/W RAM case 0x18: { - UINT8 *RAM = memory_region(REGION_CPU1) + 0x10000 + hnoridur_bank * 0x8000; + UINT8 *RAM = memory_region(machine, REGION_CPU1) + 0x10000 + hnoridur_bank * 0x8000; RAM[offset] = data; return; } @@ -654,7 +654,7 @@ static READ8_HANDLER( yarunara_input_r ) static WRITE8_HANDLER( yarunara_rombank_w ) { - UINT8 *rom = memory_region(REGION_CPU1) + 0x10000 + 0x8000 * data; + UINT8 *rom = memory_region(machine, REGION_CPU1) + 0x10000 + 0x8000 * data; memory_set_bankptr(1, rom); hnoridur_bank = data; @@ -876,7 +876,7 @@ static READ8_HANDLER( jantouki_blitter_busy_r ) static WRITE8_HANDLER( jantouki_rombank_w ) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); memory_set_bankptr(1,&ROM[0x8000 + 0x8000*(data&0x0f)]); set_led_status(0,data & 0x10); // maybe } @@ -1097,7 +1097,7 @@ static READ8_HANDLER( htengoku_coin_r ) static WRITE8_HANDLER( htengoku_rombank_w ) { - UINT8 *rom = memory_region(REGION_CPU1) + 0x10000 + 0x8000 * (data & 0x7); + UINT8 *rom = memory_region(machine, REGION_CPU1) + 0x10000 + 0x8000 * (data & 0x7); memory_set_bankptr(1, rom); hnoridur_bank = data; @@ -1282,7 +1282,7 @@ static WRITE8_HANDLER( tenkai_palette_w ) static void tenkai_update_rombank(void) { - romptr = memory_region(REGION_CPU1) + 0x10000 + 0x8000 * rombank; + romptr = memory_region(Machine, REGION_CPU1) + 0x10000 + 0x8000 * rombank; // logerror("rombank = %02x\n",rombank); } @@ -4516,7 +4516,7 @@ ROM_END static DRIVER_INIT( blktouch ) { // fearsome encryption ;-) - UINT8 *src = (UINT8 *)memory_region(REGION_CPU1); + UINT8 *src = (UINT8 *)memory_region(machine, REGION_CPU1); int i; for (i=0;i<0x90000;i++) @@ -4525,7 +4525,7 @@ static DRIVER_INIT( blktouch ) } - src = (UINT8 *)memory_region(REGION_GFX1); + src = (UINT8 *)memory_region(machine, REGION_GFX1); for (i=0;i<0xc0000;i++) { @@ -4538,8 +4538,8 @@ static DRIVER_INIT( maya ) { /* Address lines scrambling on 1 z80 rom */ int i; - UINT8 *gfx = (UINT8 *)memory_region(REGION_GFX1); - UINT8 *rom = memory_region(REGION_CPU1) + 0x28000, + UINT8 *gfx = (UINT8 *)memory_region(machine, REGION_GFX1); + UINT8 *rom = memory_region(machine, REGION_CPU1) + 0x28000, *end = rom + 0x10000; for (;rom < end; rom+=8) { @@ -5203,8 +5203,8 @@ ROM_END static DRIVER_INIT( mjelct3 ) { int i; - UINT8 *rom = memory_region(REGION_CPU1); - size_t size = memory_region_length(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); + size_t size = memory_region_length(machine, REGION_CPU1); UINT8 *rom1 = malloc_or_die(size); memcpy(rom1,rom,size); @@ -5216,8 +5216,8 @@ static DRIVER_INIT( mjelct3 ) static DRIVER_INIT( mjelct3a ) { int i,j; - UINT8 *rom = memory_region(REGION_CPU1); - size_t size = memory_region_length(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); + size_t size = memory_region_length(machine, REGION_CPU1); UINT8 *rom1 = malloc_or_die(size); memcpy(rom1,rom,size); diff --git a/src/mame/drivers/dynduke.c b/src/mame/drivers/dynduke.c index c9b25b99298..285c3192513 100644 --- a/src/mame/drivers/dynduke.c +++ b/src/mame/drivers/dynduke.c @@ -512,7 +512,7 @@ ROM_END static DRIVER_INIT( dynduke ) { - seibu_sound_decrypt(REGION_CPU3,0x20000); + seibu_sound_decrypt(machine,REGION_CPU3,0x20000); } /* Game Drivers */ diff --git a/src/mame/drivers/enigma2.c b/src/mame/drivers/enigma2.c index 7cb33d1024d..e8ff28b16b5 100644 --- a/src/mame/drivers/enigma2.c +++ b/src/mame/drivers/enigma2.c @@ -170,7 +170,7 @@ static VIDEO_UPDATE( enigma2 ) pen_t pens[NUM_PENS]; const rectangle *visarea = video_screen_get_visible_area(screen); - UINT8 *prom = memory_region(REGION_PROMS); + UINT8 *prom = memory_region(screen->machine, REGION_PROMS); UINT8 *color_map_base = engima2_flip_screen ? &prom[0x0400] : &prom[0x0000]; UINT8 *star_map_base = (blink_count & 0x08) ? &prom[0x0c00] : &prom[0x0800]; @@ -656,7 +656,7 @@ ROM_END static DRIVER_INIT(enigma2) { offs_t i; - UINT8 *rom = memory_region(REGION_CPU2); + UINT8 *rom = memory_region(machine, REGION_CPU2); for(i = 0; i < 0x2000; i++) { diff --git a/src/mame/drivers/eolith.c b/src/mame/drivers/eolith.c index 014cfa7bdd2..130019c0ab5 100644 --- a/src/mame/drivers/eolith.c +++ b/src/mame/drivers/eolith.c @@ -855,7 +855,7 @@ static DRIVER_INIT( landbrka ) //it fails compares with memories: //$4002d338 -> $4002d348 .... $4002d33f -> $4002d34f //related with bits 0x100 - 0x200 read at startup from input(0) ? - UINT32 *rombase = (UINT32*)memory_region(REGION_CPU1); + UINT32 *rombase = (UINT32*)memory_region(machine, REGION_CPU1); rombase[0x14f00/4] = (rombase[0x14f00/4] & 0xffff) | 0x03000000; /* Change BR to NOP */ coin_counter_bit = 0x2000; @@ -865,7 +865,7 @@ static DRIVER_INIT( landbrka ) static DRIVER_INIT( hidctch2 ) { //it fails compares in memory like in landbrka - UINT32 *rombase = (UINT32*)memory_region(REGION_CPU1); + UINT32 *rombase = (UINT32*)memory_region(machine, REGION_CPU1); rombase[0xbcc8/4] = (rombase[0xbcc8/4] & 0xffff) | 0x03000000; /* Change BR to NOP */ init_eolith_speedup(machine); } diff --git a/src/mame/drivers/epos.c b/src/mame/drivers/epos.c index ed302de2a2f..320f27bbec6 100644 --- a/src/mame/drivers/epos.c +++ b/src/mame/drivers/epos.c @@ -38,7 +38,7 @@ static MACHINE_RESET( dealer ); static WRITE8_HANDLER( dealer_decrypt_rom ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); if (offset & 0x04) counter = (counter + 1) & 0x03; @@ -128,7 +128,7 @@ ADDRESS_MAP_END */ static WRITE8_HANDLER( write_prtc ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); memory_set_bankptr(2, rom + 0x6000 + (0x1000 * (data & 1))); } @@ -571,7 +571,7 @@ ROM_END static MACHINE_RESET( dealer ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); counter = 0; memory_set_bankptr(1, rom); memory_set_bankptr(2, rom + 0x6000); @@ -579,7 +579,7 @@ static MACHINE_RESET( dealer ) static DRIVER_INIT( dealer ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); int A; /* Key 0 */ diff --git a/src/mame/drivers/equites.c b/src/mame/drivers/equites.c index 3112de7288f..d44a63968eb 100644 --- a/src/mame/drivers/equites.c +++ b/src/mame/drivers/equites.c @@ -460,7 +460,7 @@ static WRITE8_HANDLER(equites_c0f8_w) case 4: // c0fc: increment PROM address (written by NMI handler) equites_sound_prom_address = (equites_sound_prom_address + 1) & 0x1f; // at this point, the 5-bit value -// memory_region(REGION_SOUND1)[equites_sound_prom_address] & 0x1f +// memory_region(machine, REGION_SOUND1)[equites_sound_prom_address] & 0x1f // goes to an op-amp and to the base of a transistor. The transistor is part // of a resonator that is used to generate the M5232 clock. The PROM doesn't // actually seem to be important, since even removing it the M5232 clock @@ -1787,7 +1787,7 @@ ROM_END static void unpack_block(int region, int offset, int size) { - UINT8 *rom = memory_region(region); + UINT8 *rom = memory_region(Machine, region); int i; for (i = 0; i < size; ++i) diff --git a/src/mame/drivers/ertictac.c b/src/mame/drivers/ertictac.c index 73c9e136992..ddb37bd8a59 100644 --- a/src/mame/drivers/ertictac.c +++ b/src/mame/drivers/ertictac.c @@ -441,13 +441,13 @@ ROM_END static DRIVER_INIT( ertictac ) { - ((UINT32 *)memory_region(REGION_USER1))[0x55]=0;// patched TSTS r11,r15,lsl #32 @ $3800154 + ((UINT32 *)memory_region(machine, REGION_USER1))[0x55]=0;// patched TSTS r11,r15,lsl #32 @ $3800154 } static DRIVER_INIT( poizone ) { - ((UINT32 *)memory_region(REGION_USER1))[0x21C/4]=0;// patched TSTS r11,r15,lsl #32 @ $380021C + ((UINT32 *)memory_region(machine, REGION_USER1))[0x21C/4]=0;// patched TSTS r11,r15,lsl #32 @ $380021C } diff --git a/src/mame/drivers/esd16.c b/src/mame/drivers/esd16.c index 3f87e65a3b8..8411f545dff 100644 --- a/src/mame/drivers/esd16.c +++ b/src/mame/drivers/esd16.c @@ -280,7 +280,7 @@ static WRITE8_HANDLER( esd16_sound_rombank_w ) int bank = data & 0xf; if (data != bank) logerror("CPU #1 - PC %04X: unknown bank bits: %02X\n",activecpu_get_pc(),data); if (bank >= 3) bank += 1; - memory_set_bankptr(1, memory_region(REGION_CPU2) + 0x4000 * bank); + memory_set_bankptr(1, memory_region(machine, REGION_CPU2) + 0x4000 * bank); } static ADDRESS_MAP_START( multchmp_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) diff --git a/src/mame/drivers/ettrivia.c b/src/mame/drivers/ettrivia.c index 1d1ea7cabd5..d4676f8bab4 100644 --- a/src/mame/drivers/ettrivia.c +++ b/src/mame/drivers/ettrivia.c @@ -69,7 +69,7 @@ static WRITE8_HANDLER( ettrivia_control_w ) static READ8_HANDLER( ettrivia_question_r ) { - UINT8 *QUESTIONS = memory_region(REGION_USER1); + UINT8 *QUESTIONS = memory_region(machine, REGION_USER1); return QUESTIONS[offset + 0x10000 * question_bank]; } diff --git a/src/mame/drivers/exctsccr.c b/src/mame/drivers/exctsccr.c index 7401cbe11a9..a641b6d5e7c 100644 --- a/src/mame/drivers/exctsccr.c +++ b/src/mame/drivers/exctsccr.c @@ -508,8 +508,8 @@ ROM_END static DRIVER_INIT( exctsccr ) { // chars and sprites are mixed in the same ROMs, so rearrange them for easier decoding - UINT8 *rom1 = memory_region(REGION_GFX1); - UINT8 *rom2 = memory_region(REGION_GFX2); + UINT8 *rom1 = memory_region(machine, REGION_GFX1); + UINT8 *rom2 = memory_region(machine, REGION_GFX2); int i; // planes 0,1 diff --git a/src/mame/drivers/exerion.c b/src/mame/drivers/exerion.c index 38d9eb9de2c..ad0d13352ae 100644 --- a/src/mame/drivers/exerion.c +++ b/src/mame/drivers/exerion.c @@ -64,7 +64,7 @@ static READ8_HANDLER( exerion_porta_r ) static WRITE8_HANDLER( exerion_portb_w ) { /* pull the expected value from the ROM */ - porta = memory_region(REGION_CPU1)[0x5f76]; + porta = memory_region(machine, REGION_CPU1)[0x5f76]; portb = data; logerror("Port B = %02X\n", data); @@ -74,7 +74,7 @@ static WRITE8_HANDLER( exerion_portb_w ) static READ8_HANDLER( exerion_protection_r ) { if (activecpu_get_pc() == 0x4143) - return memory_region(REGION_CPU1)[0x33c0 + (exerion_ram[0xd] << 2) + offset]; + return memory_region(machine, REGION_CPU1)[0x33c0 + (exerion_ram[0xd] << 2) + offset]; else return exerion_ram[0x8 + offset]; } @@ -422,8 +422,8 @@ static DRIVER_INIT( exerion ) /* make a temporary copy of the character data */ src = temp; - dst = memory_region(REGION_GFX1); - length = memory_region_length(REGION_GFX1); + dst = memory_region(machine, REGION_GFX1); + length = memory_region_length(machine, REGION_GFX1); memcpy(src, dst, length); /* decode the characters */ @@ -440,8 +440,8 @@ static DRIVER_INIT( exerion ) /* make a temporary copy of the sprite data */ src = temp; - dst = memory_region(REGION_GFX2); - length = memory_region_length(REGION_GFX2); + dst = memory_region(machine, REGION_GFX2); + length = memory_region_length(machine, REGION_GFX2); memcpy(src, dst, length); /* decode the sprites */ @@ -463,7 +463,7 @@ static DRIVER_INIT( exerion ) static DRIVER_INIT( exerionb ) { - UINT8 *ram = memory_region(REGION_CPU1); + UINT8 *ram = memory_region(machine, REGION_CPU1); int addr; /* the program ROMs have data lines D1 and D2 swapped. Decode them. */ diff --git a/src/mame/drivers/exidy.c b/src/mame/drivers/exidy.c index 0c6a3a75b59..9dfd6ebcc30 100644 --- a/src/mame/drivers/exidy.c +++ b/src/mame/drivers/exidy.c @@ -172,7 +172,7 @@ static CUSTOM_INPUT( teetert_input_r ) static WRITE8_HANDLER( fax_bank_select_w ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); memory_set_bankptr(1, &RAM[0x10000 + (0x2000 * (data & 0x1f))]); if ((data & 0x1f) > 0x17) @@ -1372,7 +1372,7 @@ static DRIVER_INIT( phantoma ) /* the ROM is actually mapped high */ memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf800, 0xffff, 0, 0, SMH_BANK1); - memory_set_bankptr(1, memory_region(REGION_CPU1) + 0xf800); + memory_set_bankptr(1, memory_region(machine, REGION_CPU1) + 0xf800); } diff --git a/src/mame/drivers/exidy440.c b/src/mame/drivers/exidy440.c index 52604162960..194232051e9 100644 --- a/src/mame/drivers/exidy440.c +++ b/src/mame/drivers/exidy440.c @@ -241,7 +241,7 @@ static READ8_HANDLER( showdown_bank0_r ); static NVRAM_HANDLER( exidy440 ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); if (read_or_write) /* the EEROM lives in the uppermost 8k of the top bank */ mame_fwrite(file, &rom[0x10000 + 15 * 0x4000 + 0x2000], 0x2000); @@ -316,7 +316,7 @@ void exidy440_bank_select(running_machine *machine, UINT8 bank) /* select the bank and update the bank pointer */ exidy440_bank = bank; - memory_set_bankptr(1, &memory_region(REGION_CPU1)[0x10000 + exidy440_bank * 0x4000]); + memory_set_bankptr(1, &memory_region(machine, REGION_CPU1)[0x10000 + exidy440_bank * 0x4000]); } @@ -325,7 +325,7 @@ static WRITE8_HANDLER( bankram_w ) /* EEROM lives in the upper 8k of bank 15 */ if (exidy440_bank == 15 && offset >= 0x2000) { - memory_region(REGION_CPU1)[0x10000 + 15 * 0x4000 + offset] = data; + memory_region(machine, REGION_CPU1)[0x10000 + 15 * 0x4000 + offset] = data; logerror("W EEROM[%04X] = %02X\n", offset - 0x2000, data); } diff --git a/src/mame/drivers/expro02.c b/src/mame/drivers/expro02.c index 276a5ab234f..30565191a7f 100644 --- a/src/mame/drivers/expro02.c +++ b/src/mame/drivers/expro02.c @@ -223,7 +223,7 @@ static WRITE16_HANDLER( galsnew_6295_bankswitch_w ) { if (ACCESSING_BITS_8_15) { - UINT8 *rom = memory_region(REGION_SOUND1); + UINT8 *rom = memory_region(machine, REGION_SOUND1); memcpy(&rom[0x30000],&rom[0x40000 + ((data >> 8) & 0x0f) * 0x10000],0x10000); } } @@ -344,8 +344,8 @@ MACHINE_DRIVER_END /* the tile roms seem lineswapped.. but I don't know how to descramble them yet */ static DRIVER_INIT(galsnew) { - UINT8 *src = memory_region ( REGION_GFX3 ); - UINT8 *dst = memory_region ( REGION_GFX2 ); + UINT8 *src = memory_region ( machine, REGION_GFX3 ); + UINT8 *dst = memory_region ( machine, REGION_GFX2 ); int x; for (x=0; x<0x200000;x++) diff --git a/src/mame/drivers/exprraid.c b/src/mame/drivers/exprraid.c index eb8a6334fc7..6e0aaf241c8 100644 --- a/src/mame/drivers/exprraid.c +++ b/src/mame/drivers/exprraid.c @@ -532,11 +532,11 @@ ROM_START( wexpresc ) ROM_END -static void exprraid_gfx_expand(void) +static void exprraid_gfx_expand(running_machine *machine) { /* Expand the background rom so we can use regular decode routines */ - UINT8 *gfx = memory_region(REGION_GFX3); + UINT8 *gfx = memory_region(machine, REGION_GFX3); int offs = 0x10000-0x1000; int i; @@ -554,9 +554,9 @@ static void exprraid_gfx_expand(void) } -static void patch_rom1(void) +static void patch_rom1(running_machine *machine) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); int i; /* HACK!: Implement custom opcode as regular with a mapped io read */ @@ -575,13 +575,13 @@ static void patch_rom1(void) static DRIVER_INIT( wexpress ) { - patch_rom1(); - exprraid_gfx_expand(); + patch_rom1(machine); + exprraid_gfx_expand(machine); } static DRIVER_INIT( exprraid ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); /* decode vectors */ @@ -594,20 +594,20 @@ static DRIVER_INIT( exprraid ) rom[0xfffe] = rom[0xfff3]; rom[0xffff] = rom[0xfff2]; - patch_rom1(); - exprraid_gfx_expand(); + patch_rom1(machine); + exprraid_gfx_expand(machine); } static DRIVER_INIT( wexpresb ) { memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3800, 0x3800, 0, 0, vblank_r); - exprraid_gfx_expand(); + exprraid_gfx_expand(machine); } static DRIVER_INIT( wexpresc ) { memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xFFC0, 0xFFC0, 0, 0, vblank_r); - exprraid_gfx_expand(); + exprraid_gfx_expand(machine); } diff --git a/src/mame/drivers/exzisus.c b/src/mame/drivers/exzisus.c index 4123b368b84..7e3db62422f 100644 --- a/src/mame/drivers/exzisus.c +++ b/src/mame/drivers/exzisus.c @@ -69,7 +69,7 @@ VIDEO_UPDATE( exzisus ); static WRITE8_HANDLER( exzisus_cpua_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); static int exzisus_cpua_bank = 0; if ( (data & 0x0f) != exzisus_cpua_bank ) @@ -86,7 +86,7 @@ static WRITE8_HANDLER( exzisus_cpua_bankswitch_w ) static WRITE8_HANDLER( exzisus_cpub_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_CPU3); + UINT8 *RAM = memory_region(machine, REGION_CPU3); static int exzisus_cpub_bank = 0; if ( (data & 0x0f) != exzisus_cpub_bank ) @@ -139,7 +139,7 @@ static WRITE8_HANDLER( exzisus_cpub_reset_w ) // the RAM check to work static DRIVER_INIT( exzisus ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); /* Fix WORK RAM error */ RAM[0x67fd] = 0x18; diff --git a/src/mame/drivers/f1gp.c b/src/mame/drivers/f1gp.c index 0749afff57a..a4970ac5c3b 100644 --- a/src/mame/drivers/f1gp.c +++ b/src/mame/drivers/f1gp.c @@ -40,7 +40,7 @@ static WRITE16_HANDLER( sharedram_w ) static READ16_HANDLER( extrarom_r ) { - UINT8 *rom = memory_region(REGION_USER1); + UINT8 *rom = memory_region(machine, REGION_USER1); offset *= 2; @@ -49,7 +49,7 @@ static READ16_HANDLER( extrarom_r ) static READ16_HANDLER( extrarom2_r ) { - UINT8 *rom = memory_region(REGION_USER2); + UINT8 *rom = memory_region(machine, REGION_USER2); offset *= 2; @@ -58,7 +58,7 @@ static READ16_HANDLER( extrarom2_r ) static WRITE8_HANDLER( f1gp_sh_bankswitch_w ) { - UINT8 *rom = memory_region(REGION_CPU3) + 0x10000; + UINT8 *rom = memory_region(machine, REGION_CPU3) + 0x10000; memory_set_bankptr(1,rom + (data & 0x01) * 0x8000); } @@ -219,8 +219,8 @@ static WRITE16_HANDLER( f1gpb_misc_w ) if(old_bank != new_bank && new_bank < 5) { // oki banking - UINT8 *src = memory_region(REGION_SOUND1) + 0x40000 + 0x10000 * new_bank; - UINT8 *dst = memory_region(REGION_SOUND1) + 0x30000; + UINT8 *src = memory_region(machine, REGION_SOUND1) + 0x40000 + 0x10000 * new_bank; + UINT8 *dst = memory_region(machine, REGION_SOUND1) + 0x30000; memcpy(dst, src, 0x10000); old_bank = new_bank; diff --git a/src/mame/drivers/fantland.c b/src/mame/drivers/fantland.c index b267bb6469b..6028bb09b04 100644 --- a/src/mame/drivers/fantland.c +++ b/src/mame/drivers/fantland.c @@ -343,8 +343,8 @@ static void borntofi_adpcm_int(running_machine *machine, int voice) if (!borntofi_adpcm[voice].playing) return; - rom = memory_region( REGION_SOUND1 ); - len = memory_region_length( REGION_SOUND1 ) * 2; + rom = memory_region( machine, REGION_SOUND1 ); + len = memory_region_length( machine, REGION_SOUND1 ) * 2; start = borntofi_adpcm[voice].addr[0] + borntofi_adpcm[voice].nibble; stop = borntofi_adpcm[voice].addr[1]; diff --git a/src/mame/drivers/fastlane.c b/src/mame/drivers/fastlane.c index 3049dd0fda3..f0c7f37754e 100644 --- a/src/mame/drivers/fastlane.c +++ b/src/mame/drivers/fastlane.c @@ -50,7 +50,7 @@ static WRITE8_HANDLER( k007121_registers_w ) static WRITE8_HANDLER( fastlane_bankswitch_w ) { int bankaddress; - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); /* bits 0 & 1 coin counters */ coin_counter_w(0,data & 0x01); diff --git a/src/mame/drivers/fcombat.c b/src/mame/drivers/fcombat.c index 48566f00b15..a22dd806b5a 100644 --- a/src/mame/drivers/fcombat.c +++ b/src/mame/drivers/fcombat.c @@ -187,7 +187,7 @@ static READ8_HANDLER(e300_r) int wx=(tx+fcombat_sh)/16; int wy=(ty*2+fcombat_sv)/16; - return memory_region(REGION_USER2)[wx*32*16+wy]; + return memory_region(machine, REGION_USER2)[wx*32*16+wy]; } static WRITE8_HANDLER(ee00_w) @@ -329,8 +329,8 @@ static DRIVER_INIT( fcombat ) /* make a temporary copy of the character data */ src = temp; - dst = memory_region(REGION_GFX1); - length = memory_region_length(REGION_GFX1); + dst = memory_region(machine, REGION_GFX1); + length = memory_region_length(machine, REGION_GFX1); memcpy(src, dst, length); /* decode the characters */ @@ -347,8 +347,8 @@ static DRIVER_INIT( fcombat ) /* make a temporary copy of the sprite data */ src = temp; - dst = memory_region(REGION_GFX2); - length = memory_region_length(REGION_GFX2); + dst = memory_region(machine, REGION_GFX2); + length = memory_region_length(machine, REGION_GFX2); memcpy(src, dst, length); /* decode the sprites */ @@ -368,8 +368,8 @@ static DRIVER_INIT( fcombat ) /* make a temporary copy of the character data */ src = temp; - dst = memory_region(REGION_GFX3); - length = memory_region_length(REGION_GFX3); + dst = memory_region(machine, REGION_GFX3); + length = memory_region_length(machine, REGION_GFX3); memcpy(src, dst, length); /* decode the characters */ @@ -387,8 +387,8 @@ static DRIVER_INIT( fcombat ) } src = temp; - dst = memory_region(REGION_USER1); - length = memory_region_length(REGION_USER1); + dst = memory_region(machine, REGION_USER1); + length = memory_region_length(machine, REGION_USER1); memcpy(src, dst, length); for (oldaddr = 0; oldaddr < 32; oldaddr++) @@ -399,8 +399,8 @@ static DRIVER_INIT( fcombat ) src = temp; - dst = memory_region(REGION_USER2); - length = memory_region_length(REGION_USER2); + dst = memory_region(machine, REGION_USER2); + length = memory_region_length(machine, REGION_USER2); memcpy(src, dst, length); for (oldaddr = 0; oldaddr < 32; oldaddr++) diff --git a/src/mame/drivers/fcrash.c b/src/mame/drivers/fcrash.c index 0da7e5ccfb7..826787fb185 100644 --- a/src/mame/drivers/fcrash.c +++ b/src/mame/drivers/fcrash.c @@ -53,7 +53,7 @@ static WRITE16_HANDLER( fcrash_soundlatch_w ) static WRITE8_HANDLER( fcrash_snd_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_CPU2); + UINT8 *RAM = memory_region(machine, REGION_CPU2); int bankaddr; sndti_set_output_gain(SOUND_MSM5205, 0, 0, (data & 0x08) ? 0.0 : 1.0); diff --git a/src/mame/drivers/filetto.c b/src/mame/drivers/filetto.c index d10c703ff97..bb535cca7ef 100644 --- a/src/mame/drivers/filetto.c +++ b/src/mame/drivers/filetto.c @@ -355,7 +355,7 @@ static WRITE8_HANDLER( disk_iobank_w ) if (newbank != bank) { bank = newbank; - memory_set_bankptr( 1,memory_region(REGION_USER1) + 0x10000 * bank ); + memory_set_bankptr( 1,memory_region(machine, REGION_USER1) + 0x10000 * bank ); } lastvalue = data; diff --git a/src/mame/drivers/finalizr.c b/src/mame/drivers/finalizr.c index 43d0b1780c7..c7d361a1d57 100644 --- a/src/mame/drivers/finalizr.c +++ b/src/mame/drivers/finalizr.c @@ -499,7 +499,7 @@ ROM_END static DRIVER_INIT( finalizr ) { - konami1_decode(0); + konami1_decode(machine, 0); } diff --git a/src/mame/drivers/findout.c b/src/mame/drivers/findout.c index b6e070f7ec4..6a980c8a6e6 100644 --- a/src/mame/drivers/findout.c +++ b/src/mame/drivers/findout.c @@ -140,27 +140,27 @@ static READ8_HANDLER( catchall ) static WRITE8_HANDLER( banksel_main_w ) { - memory_set_bankptr(1,memory_region(REGION_CPU1) + 0x8000); + memory_set_bankptr(1,memory_region(machine, REGION_CPU1) + 0x8000); } static WRITE8_HANDLER( banksel_1_w ) { - memory_set_bankptr(1,memory_region(REGION_CPU1) + 0x10000); + memory_set_bankptr(1,memory_region(machine, REGION_CPU1) + 0x10000); } static WRITE8_HANDLER( banksel_2_w ) { - memory_set_bankptr(1,memory_region(REGION_CPU1) + 0x18000); + memory_set_bankptr(1,memory_region(machine, REGION_CPU1) + 0x18000); } static WRITE8_HANDLER( banksel_3_w ) { - memory_set_bankptr(1,memory_region(REGION_CPU1) + 0x20000); + memory_set_bankptr(1,memory_region(machine, REGION_CPU1) + 0x20000); } static WRITE8_HANDLER( banksel_4_w ) { - memory_set_bankptr(1,memory_region(REGION_CPU1) + 0x28000); + memory_set_bankptr(1,memory_region(machine, REGION_CPU1) + 0x28000); } static WRITE8_HANDLER( banksel_5_w ) { - memory_set_bankptr(1,memory_region(REGION_CPU1) + 0x30000); + memory_set_bankptr(1,memory_region(machine, REGION_CPU1) + 0x30000); } diff --git a/src/mame/drivers/firebeat.c b/src/mame/drivers/firebeat.c index 2b282115641..422cca16817 100644 --- a/src/mame/drivers/firebeat.c +++ b/src/mame/drivers/firebeat.c @@ -2003,7 +2003,7 @@ static MACHINE_RESET( firebeat ) { void *cd; int i; - UINT8 *sound = memory_region(REGION_SOUND1); + UINT8 *sound = memory_region(machine, REGION_SOUND1); for (i=0; i < 0x200000; i++) { @@ -2274,7 +2274,7 @@ static void init_lights(running_machine *machine, write32_machine_func out1, wri static void init_firebeat(running_machine *machine) { - UINT8 *rom = memory_region(REGION_USER2); + UINT8 *rom = memory_region(machine, REGION_USER2); atapi_init(machine); intelflash_init(0, FLASH_FUJITSU_29F016A, NULL); diff --git a/src/mame/drivers/firetrap.c b/src/mame/drivers/firetrap.c index 5d489def94d..4d3c9a67f10 100644 --- a/src/mame/drivers/firetrap.c +++ b/src/mame/drivers/firetrap.c @@ -90,7 +90,7 @@ static WRITE8_HANDLER( firetrap_nmi_disable_w ) static WRITE8_HANDLER( firetrap_bankselect_w ) { int bankaddress; - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); bankaddress = 0x10000 + (data & 0x03) * 0x4000; memory_set_bankptr(1,&RAM[bankaddress]); @@ -212,7 +212,7 @@ static WRITE8_HANDLER( firetrap_sound_2400_w ) static WRITE8_HANDLER( firetrap_sound_bankselect_w ) { int bankaddress; - UINT8 *RAM = memory_region(REGION_CPU2); + UINT8 *RAM = memory_region(machine, REGION_CPU2); bankaddress = 0x10000 + (data & 0x01) * 0x4000; memory_set_bankptr(2,&RAM[bankaddress]); diff --git a/src/mame/drivers/fitfight.c b/src/mame/drivers/fitfight.c index de273f93985..32aba70542d 100644 --- a/src/mame/drivers/fitfight.c +++ b/src/mame/drivers/fitfight.c @@ -988,7 +988,7 @@ ROM_END static DRIVER_INIT( fitfight ) { -// UINT16 *mem16 = (UINT16 *)memory_region(REGION_CPU1); +// UINT16 *mem16 = (UINT16 *)memory_region(machine, REGION_CPU1); // mem16[0x0165B2/2]=0x4e71; // for now so it boots memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x700000, 0x700001, 0, 0, fitfight_700000_r); bbprot_kludge = 0; @@ -996,7 +996,7 @@ static DRIVER_INIT( fitfight ) static DRIVER_INIT( histryma ) { -// UINT16 *mem16 = (UINT16 *)memory_region(REGION_CPU1); +// UINT16 *mem16 = (UINT16 *)memory_region(machine, REGION_CPU1); // mem16[0x017FDC/2]=0x4e71; // for now so it boots memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x700000, 0x700001, 0, 0, histryma_700000_r); bbprot_kludge = 0; diff --git a/src/mame/drivers/flkatck.c b/src/mame/drivers/flkatck.c index 432cc9d093a..0db82876316 100644 --- a/src/mame/drivers/flkatck.c +++ b/src/mame/drivers/flkatck.c @@ -42,7 +42,7 @@ static INTERRUPT_GEN( flkatck_interrupt ) static WRITE8_HANDLER( flkatck_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); int bankaddress = 0; /* bits 3-4: coin counters */ diff --git a/src/mame/drivers/flyball.c b/src/mame/drivers/flyball.c index a52cfb1ac90..3c993674aa9 100644 --- a/src/mame/drivers/flyball.c +++ b/src/mame/drivers/flyball.c @@ -66,7 +66,7 @@ static MACHINE_RESET( flyball ) /* address bits 0 through 8 are inverted */ - UINT8* ROM = memory_region(REGION_CPU1) + 0x2000; + UINT8* ROM = memory_region(machine, REGION_CPU1) + 0x2000; for (i = 0; i < 0x1000; i++) rombase[i] = ROM[i ^ 0x1ff]; diff --git a/src/mame/drivers/freekick.c b/src/mame/drivers/freekick.c index b69bba6f0be..9b5749114f5 100644 --- a/src/mame/drivers/freekick.c +++ b/src/mame/drivers/freekick.c @@ -98,7 +98,7 @@ static READ8_HANDLER( spinner_r ) static MACHINE_RESET( pbillrd ) { - memory_configure_bank(1, 0, 2, memory_region(REGION_CPU1) + 0x10000, 0x4000); + memory_configure_bank(1, 0, 2, memory_region(machine, REGION_CPU1) + 0x10000, 0x4000); } static WRITE8_HANDLER( pbillrd_bankswitch_w ) @@ -589,7 +589,7 @@ static WRITE8_HANDLER( snd_rom_addr_h_w ) static READ8_HANDLER( snd_rom_r ) { - return memory_region(REGION_USER1)[romaddr & 0x7fff]; + return memory_region(machine, REGION_USER1)[romaddr & 0x7fff]; } static const ppi8255_interface ppi8255_intf[2] = @@ -1031,13 +1031,13 @@ ROM_END static DRIVER_INIT(gigas) { - memory_set_decrypted_region(0, 0x0000, 0x7fff, memory_region(REGION_CPU1) + 0x10000); + memory_set_decrypted_region(0, 0x0000, 0x7fff, memory_region(machine, REGION_CPU1) + 0x10000); } static DRIVER_INIT( pbillrds ) { - mc8123_decrypt_rom(0, memory_region(REGION_USER1), 1, 2); + mc8123_decrypt_rom(machine, 0, memory_region(machine, REGION_USER1), 1, 2); } diff --git a/src/mame/drivers/fromanc2.c b/src/mame/drivers/fromanc2.c index c7d54829976..317d1f8d47a 100644 --- a/src/mame/drivers/fromanc2.c +++ b/src/mame/drivers/fromanc2.c @@ -291,7 +291,7 @@ static READ8_HANDLER( fromanc2_sndcpu_nmi_clr ) static WRITE8_HANDLER( fromanc2_subcpu_rombank_w ) { - UINT8 *RAM = memory_region(REGION_CPU3); + UINT8 *RAM = memory_region(machine, REGION_CPU3); int rombank = data & 0x03; int rambank = (data & 0x0c) >> 2; diff --git a/src/mame/drivers/fromance.c b/src/mame/drivers/fromance.c index ed5ba6bd15d..04efb99b1ae 100644 --- a/src/mame/drivers/fromance.c +++ b/src/mame/drivers/fromance.c @@ -135,7 +135,7 @@ static WRITE8_HANDLER( fromance_busycheck_sub_w ) static WRITE8_HANDLER( fromance_rombank_w ) { - UINT8 *ROM = memory_region(REGION_CPU2); + UINT8 *ROM = memory_region(machine, REGION_CPU2); memory_set_bankptr(1, &ROM[0x010000 + (0x4000 * data)]); } diff --git a/src/mame/drivers/funkyjet.c b/src/mame/drivers/funkyjet.c index 30021e6c25c..4b4d599158b 100644 --- a/src/mame/drivers/funkyjet.c +++ b/src/mame/drivers/funkyjet.c @@ -462,7 +462,7 @@ ROM_END static DRIVER_INIT( funkyjet ) { - deco74_decrypt(REGION_GFX1); + deco74_decrypt(machine, REGION_GFX1); } /******************************************************************************/ diff --git a/src/mame/drivers/funworld.c b/src/mame/drivers/funworld.c index fa76834f0fd..4dd557947e9 100644 --- a/src/mame/drivers/funworld.c +++ b/src/mame/drivers/funworld.c @@ -2330,7 +2330,7 @@ static DRIVER_INIT( tabblue ) *****************************************************************************************************/ int x, na, nb, nad, nbd; - UINT8 *src = memory_region( REGION_GFX1 ); + UINT8 *src = memory_region( machine, REGION_GFX1 ); for (x=0x0000; x < 0x10000; x++) @@ -2354,8 +2354,8 @@ static DRIVER_INIT( jolycdae ) /* Decrypting roms... */ int x; - UINT8 *srcp = memory_region( REGION_CPU1 ); - UINT8 *srcg = memory_region( REGION_GFX1 ); + UINT8 *srcp = memory_region( machine, REGION_CPU1 ); + UINT8 *srcg = memory_region( machine, REGION_GFX1 ); for (x=0x8000;x<0x18000;x++) { @@ -2387,7 +2387,7 @@ static DRIVER_INIT( jolyc980 ) *************************************************************************************************/ -// UINT8 *ROM = memory_region(REGION_CPU1); +// UINT8 *ROM = memory_region(machine, REGION_CPU1); // ROM[0xc1fc] = 0x4c; // ROM[0xc1fd] = 0x1c; @@ -2413,7 +2413,7 @@ static DRIVER_INIT( magiccda ) ******************************************************************/ { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); ROM[0xc1c6] = 0x92; @@ -2426,8 +2426,8 @@ static DRIVER_INIT( magiccdb ) /*** same as blue TAB PCB, with the magiccda patch ***/ { int x, na, nb, nad, nbd; - UINT8 *src = memory_region( REGION_GFX1 ); - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *src = memory_region( machine, REGION_GFX1 ); + UINT8 *ROM = memory_region(machine, REGION_CPU1); for (x=0x0000; x < 0x10000; x++) { @@ -2450,7 +2450,7 @@ static DRIVER_INIT( magiccdb ) static DRIVER_INIT( soccernw ) { /* temporary patch to avoid hardware errors for debug purposes */ - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); ROM[0x80b2] = 0xa9; ROM[0x80b3] = 0x00; diff --git a/src/mame/drivers/funybubl.c b/src/mame/drivers/funybubl.c index 83c0962b8a9..8ed8c18b523 100644 --- a/src/mame/drivers/funybubl.c +++ b/src/mame/drivers/funybubl.c @@ -70,7 +70,7 @@ static WRITE8_HANDLER ( funybubl_vidram_bank_w ) static WRITE8_HANDLER ( funybubl_cpurombank_w ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); memory_set_bankptr(2,&rom[0x10000+0x4000*(data&0x3f)]); } diff --git a/src/mame/drivers/fuukifg2.c b/src/mame/drivers/fuukifg2.c index 95d42648483..fd04f31b3ef 100644 --- a/src/mame/drivers/fuukifg2.c +++ b/src/mame/drivers/fuukifg2.c @@ -128,7 +128,7 @@ ADDRESS_MAP_END static WRITE8_HANDLER( fuuki16_sound_rombank_w ) { if (data <= 2) - memory_set_bankptr(1, memory_region(REGION_CPU2) + 0x8000 * data + 0x10000); + memory_set_bankptr(1, memory_region(machine, REGION_CPU2) + 0x8000 * data + 0x10000); else logerror("CPU #1 - PC %04X: unknown bank bits: %02X\n",activecpu_get_pc(),data); } diff --git a/src/mame/drivers/fuukifg3.c b/src/mame/drivers/fuukifg3.c index 6790f0450b9..ee86234f90f 100644 --- a/src/mame/drivers/fuukifg3.c +++ b/src/mame/drivers/fuukifg3.c @@ -331,7 +331,7 @@ ADDRESS_MAP_END static WRITE8_HANDLER ( fuuki32_sound_bw_w ) { - UINT8 *rom = memory_region(REGION_CPU2); + UINT8 *rom = memory_region(machine, REGION_CPU2); memory_set_bankptr(1, rom + 0x10000 + (data * 0x8000)); } diff --git a/src/mame/drivers/gaelco.c b/src/mame/drivers/gaelco.c index 31ba99dd606..628948b724a 100644 --- a/src/mame/drivers/gaelco.c +++ b/src/mame/drivers/gaelco.c @@ -300,7 +300,7 @@ ADDRESS_MAP_END static WRITE16_HANDLER( OKIM6295_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_SOUND1); + UINT8 *RAM = memory_region(machine, REGION_SOUND1); if (ACCESSING_BITS_0_7){ memcpy(&RAM[0x30000], &RAM[0x40000 + (data & 0x0f)*0x10000], 0x10000); diff --git a/src/mame/drivers/gaelco3d.c b/src/mame/drivers/gaelco3d.c index 6c886b51657..f152d4fb87f 100644 --- a/src/mame/drivers/gaelco3d.c +++ b/src/mame/drivers/gaelco3d.c @@ -187,7 +187,7 @@ static MACHINE_RESET( common ) framenum = 0; /* boot the ADSP chip */ - src = (UINT16 *)memory_region(REGION_USER1); + src = (UINT16 *)memory_region(machine, REGION_USER1); for (i = 0; i < (src[3] & 0xff) * 8; i++) { UINT32 opcode = ((src[i*4+0] & 0xff) << 16) | ((src[i*4+1] & 0xff) << 8) | (src[i*4+2] & 0xff); @@ -200,7 +200,7 @@ static MACHINE_RESET( common ) /* allocate a timer for feeding the autobuffer */ adsp_autobuffer_timer = timer_alloc(adsp_autobuffer_irq, NULL); - memory_configure_bank(1, 0, 256, memory_region(REGION_USER1), 0x4000); + memory_configure_bank(1, 0, 256, memory_region(machine, REGION_USER1), 0x4000); memory_set_bank(1, 0); /* keep the TMS32031 halted until the code is ready to go */ @@ -1095,13 +1095,13 @@ static DRIVER_INIT( gaelco3d ) int x, y; /* allocate memory */ - gaelco3d_texture_size = memory_region_length(REGION_GFX1); - gaelco3d_texmask_size = memory_region_length(REGION_GFX2) * 8; + gaelco3d_texture_size = memory_region_length(machine, REGION_GFX1); + gaelco3d_texmask_size = memory_region_length(machine, REGION_GFX2) * 8; gaelco3d_texture = auto_malloc(gaelco3d_texture_size); gaelco3d_texmask = auto_malloc(gaelco3d_texmask_size); /* first expand the pixel data */ - src = memory_region(REGION_GFX1); + src = memory_region(machine, REGION_GFX1); dst = gaelco3d_texture; for (y = 0; y < gaelco3d_texture_size/4096; y += 2) for (x = 0; x < 4096; x += 2) @@ -1113,7 +1113,7 @@ static DRIVER_INIT( gaelco3d ) } /* then expand the mask data */ - src = memory_region(REGION_GFX2); + src = memory_region(machine, REGION_GFX2); dst = gaelco3d_texmask; for (y = 0; y < gaelco3d_texmask_size/4096; y++) for (x = 0; x < 4096; x++) diff --git a/src/mame/drivers/gaiden.c b/src/mame/drivers/gaiden.c index beb0af19707..8358571b46a 100644 --- a/src/mame/drivers/gaiden.c +++ b/src/mame/drivers/gaiden.c @@ -1503,8 +1503,8 @@ static DRIVER_INIT( raiga ) static DRIVER_INIT( drgnbowl ) { int i; - UINT8 *ROM = memory_region(REGION_CPU1); - size_t size = memory_region_length(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); + size_t size = memory_region_length(machine, REGION_CPU1); UINT8 *buffer = malloc_or_die(size); memcpy(buffer,ROM,size); @@ -1520,8 +1520,8 @@ static DRIVER_INIT( drgnbowl ) free(buffer); - ROM = memory_region(REGION_GFX2); - size = memory_region_length(REGION_GFX2); + ROM = memory_region(machine, REGION_GFX2); + size = memory_region_length(machine, REGION_GFX2); buffer = malloc_or_die(size); memcpy(buffer,ROM,size); diff --git a/src/mame/drivers/galaga.c b/src/mame/drivers/galaga.c index 64d8daac383..c29f26c81b0 100644 --- a/src/mame/drivers/galaga.c +++ b/src/mame/drivers/galaga.c @@ -3049,8 +3049,8 @@ ROM_END static DRIVER_INIT (galaga) { /* swap bytes for flipped character so we can decode them together with normal characters */ - UINT8 *rom = memory_region(REGION_GFX1); - int i, len = memory_region_length(REGION_GFX1); + UINT8 *rom = memory_region(machine, REGION_GFX1); + int i, len = memory_region_length(machine, REGION_GFX1); for (i = 0;i < len;i++) { @@ -3077,7 +3077,7 @@ static DRIVER_INIT( xevious ) UINT8 *rom; int i; - rom = memory_region(REGION_GFX3) + 0x5000; + rom = memory_region(machine, REGION_GFX3) + 0x5000; for (i = 0;i < 0x2000;i++) rom[i + 0x2000] = rom[i] >> 4; } @@ -3089,14 +3089,14 @@ static DRIVER_INIT( xevios ) /* convert one of the sprite ROMs to the format used by Xevious */ - rom = memory_region(REGION_GFX3); + rom = memory_region(machine, REGION_GFX3); for (A = 0x5000;A < 0x7000;A++) { rom[A] = BITSWAP8(rom[A],1,3,5,7,0,2,4,6); } /* convert one of tile map ROMs to the format used by Xevious */ - rom = memory_region(REGION_GFX4); + rom = memory_region(machine, REGION_GFX4); for (A = 0x0000;A < 0x1000;A++) { rom[A] = BITSWAP8(rom[A],3,7,5,1,2,6,4,0); diff --git a/src/mame/drivers/galaxian.c b/src/mame/drivers/galaxian.c index 8d008acc0f8..573d1512350 100644 --- a/src/mame/drivers/galaxian.c +++ b/src/mame/drivers/galaxian.c @@ -2166,9 +2166,9 @@ MACHINE_DRIVER_END * *************************************/ -static void decode_mooncrst(int length, UINT8 *dest) +static void decode_mooncrst(running_machine *machine, int length, UINT8 *dest) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); int offs; for (offs = 0; offs < length; offs++) @@ -2183,7 +2183,7 @@ static void decode_mooncrst(int length, UINT8 *dest) } -static void decode_checkman(void) +static void decode_checkman(running_machine *machine) { /* Encryption Table @@ -2230,8 +2230,8 @@ static void decode_checkman(void) { 0,2,0,2 }, { 1,4,1,4 } }; - UINT8 *rombase = memory_region(REGION_CPU1); - UINT32 romlength = memory_region_length(REGION_CPU1); + UINT8 *rombase = memory_region(machine, REGION_CPU1); + UINT32 romlength = memory_region_length(machine, REGION_CPU1); UINT32 offs; for (offs = 0; offs < romlength; offs++) @@ -2245,10 +2245,10 @@ static void decode_checkman(void) } -static void decode_dingoe(void) +static void decode_dingoe(running_machine *machine) { - UINT8 *rombase = memory_region(REGION_CPU1); - UINT32 romlength = memory_region_length(REGION_CPU1); + UINT8 *rombase = memory_region(machine, REGION_CPU1); + UINT32 romlength = memory_region_length(machine, REGION_CPU1); UINT32 offs; for (offs = 0; offs < romlength; offs++) @@ -2268,9 +2268,9 @@ static void decode_dingoe(void) } -static void decode_frogger_sound(void) +static void decode_frogger_sound(running_machine *machine) { - UINT8 *rombase = memory_region(REGION_CPU2); + UINT8 *rombase = memory_region(machine, REGION_CPU2); UINT32 offs; /* the first ROM of the sound CPU has data lines D0 and D1 swapped */ @@ -2279,9 +2279,9 @@ static void decode_frogger_sound(void) } -static void decode_frogger_gfx(void) +static void decode_frogger_gfx(running_machine *machine) { - UINT8 *rombase = memory_region(REGION_GFX1); + UINT8 *rombase = memory_region(machine, REGION_GFX1); UINT32 offs; /* the 2nd gfx ROM has data lines D0 and D1 swapped */ @@ -2290,10 +2290,10 @@ static void decode_frogger_gfx(void) } -static void decode_anteater_gfx(void) +static void decode_anteater_gfx(running_machine *machine) { - UINT32 romlength = memory_region_length(REGION_GFX1); - UINT8 *rombase = memory_region(REGION_GFX1); + UINT32 romlength = memory_region_length(machine, REGION_GFX1); + UINT8 *rombase = memory_region(machine, REGION_GFX1); UINT8 *scratch = malloc_or_die(romlength); UINT32 offs; @@ -2310,10 +2310,10 @@ static void decode_anteater_gfx(void) } -static void decode_losttomb_gfx(void) +static void decode_losttomb_gfx(running_machine *machine) { - UINT32 romlength = memory_region_length(REGION_GFX1); - UINT8 *rombase = memory_region(REGION_GFX1); + UINT32 romlength = memory_region_length(machine, REGION_GFX1); + UINT8 *rombase = memory_region(machine, REGION_GFX1); UINT8 *scratch = malloc_or_die(romlength); UINT32 offs; @@ -2330,14 +2330,14 @@ static void decode_losttomb_gfx(void) } -static void decode_superbon(void) +static void decode_superbon(running_machine *machine) { offs_t i; UINT8 *RAM; /* Deryption worked out by hand by Chris Hardy. */ - RAM = memory_region(REGION_CPU1); + RAM = memory_region(machine, REGION_CPU1); for (i = 0;i < 0x1000;i++) { @@ -2434,7 +2434,7 @@ static DRIVER_INIT( gmgalax ) /* ROM is banked */ memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x3fff, 0, 0, SMH_BANK1); - memory_configure_bank(1, 0, 2, memory_region(REGION_CPU1) + 0x10000, 0x4000); + memory_configure_bank(1, 0, 2, memory_region(machine, REGION_CPU1) + 0x10000, 0x4000); /* callback when the game select is toggled */ gmgalax_game_changed(machine->portconfig->fieldlist, NULL, 0, 0); @@ -2486,7 +2486,7 @@ static DRIVER_INIT( mooncrst ) common_init(machine, galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info); /* decrypt program code */ - decode_mooncrst(0x8000, memory_region(REGION_CPU1)); + decode_mooncrst(machine, 0x8000, memory_region(machine, REGION_CPU1)); } @@ -2515,7 +2515,7 @@ static DRIVER_INIT( moonqsr ) common_init(machine, galaxian_draw_bullet, galaxian_draw_background, moonqsr_extend_tile_info, moonqsr_extend_sprite_info); /* decrypt program code */ - decode_mooncrst(0x8000, decrypt); + decode_mooncrst(machine, 0x8000, decrypt); memory_set_decrypted_region(0, 0x0000, 0x7fff, decrypt); } @@ -2552,8 +2552,8 @@ static DRIVER_INIT( zigzag ) /* make ROMs 2 & 3 swappable */ memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2000, 0x2fff, 0, 0, SMH_BANK1); memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3000, 0x3fff, 0, 0, SMH_BANK2); - memory_configure_bank(1, 0, 2, memory_region(REGION_CPU1) + 0x2000, 0x1000); - memory_configure_bank(2, 0, 2, memory_region(REGION_CPU1) + 0x2000, 0x1000); + memory_configure_bank(1, 0, 2, memory_region(machine, REGION_CPU1) + 0x2000, 0x1000); + memory_configure_bank(2, 0, 2, memory_region(machine, REGION_CPU1) + 0x2000, 0x1000); /* handler for doing the swaps */ memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x7002, 0x7002, 0, 0x07f8, zigzag_bankswap_w); @@ -2590,7 +2590,7 @@ static DRIVER_INIT( checkman ) memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x00, 0x00, 0, 0xffff, checkman_sound_command_w); /* decrypt program code */ - decode_checkman(); + decode_checkman(machine); } @@ -2635,7 +2635,7 @@ static DRIVER_INIT( dingoe ) memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3001, 0x3001, 0, 0, dingoe_3001_r); /* Protection check */ /* decrypt program code */ - decode_dingoe(); + decode_dingoe(machine); } @@ -2653,7 +2653,7 @@ static DRIVER_INIT( skybase ) /* extend ROM */ memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x5fff, 0, 0, SMH_BANK2); - memory_set_bankptr(2, memory_region(REGION_CPU1)); + memory_set_bankptr(2, memory_region(machine, REGION_CPU1)); } @@ -2666,7 +2666,7 @@ static DRIVER_INIT( mshuttle ) irq_line = 0; /* decrypt the code */ - mshuttle_decode(); + mshuttle_decode(machine); } @@ -2679,7 +2679,7 @@ static DRIVER_INIT( mshuttlj ) irq_line = 0; /* decrypt the code */ - cclimbrj_decode(); + cclimbrj_decode(machine); } @@ -2709,7 +2709,7 @@ static DRIVER_INIT( scorpnmc ) /* extra ROM */ memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x5000, 0x67ff, 0, 0, SMH_BANK1); - memory_set_bankptr(1, memory_region(REGION_CPU1) + 0x5000); + memory_set_bankptr(1, memory_region(machine, REGION_CPU1) + 0x5000); /* install RAM at $4000-$4800 */ memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x47ff, 0, 0, SMH_BANK2, SMH_BANK2); @@ -2771,7 +2771,7 @@ static DRIVER_INIT( sfx ) /* sound board has space for extra ROM */ memory_install_read8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x0000, 0x3fff, 0, 0, SMH_BANK1); - memory_set_bankptr(1, memory_region(REGION_CPU2)); + memory_set_bankptr(1, memory_region(machine, REGION_CPU2)); } @@ -2799,7 +2799,7 @@ static DRIVER_INIT( losttomb ) common_init(machine, scramble_draw_bullet, scramble_draw_background, NULL, NULL); /* decrypt */ - decode_losttomb_gfx(); + decode_losttomb_gfx(machine); } @@ -2810,8 +2810,8 @@ static DRIVER_INIT( frogger ) galaxian_frogger_adjust = TRUE; /* decrypt */ - decode_frogger_sound(); - decode_frogger_gfx(); + decode_frogger_sound(machine); + decode_frogger_gfx(machine); } @@ -2828,7 +2828,7 @@ static DRIVER_INIT( froggrmc ) memory_set_bankptr(1, auto_malloc(0x800)); /* decrypt */ - decode_frogger_sound(); + decode_frogger_sound(machine); } @@ -2838,7 +2838,7 @@ static DRIVER_INIT( froggers ) common_init(machine, NULL, frogger_draw_background, frogger_extend_tile_info, frogger_extend_sprite_info); /* decrypt */ - decode_frogger_sound(); + decode_frogger_sound(machine); } @@ -2868,7 +2868,7 @@ static DRIVER_INIT( scorpion ) /* extra ROM */ memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x5800, 0x67ff, 0, 0, SMH_BANK1); - memory_set_bankptr(1, memory_region(REGION_CPU1) + 0x5800); + memory_set_bankptr(1, memory_region(machine, REGION_CPU1) + 0x5800); /* no background related */ // memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6803, 0x6803, 0, 0, SMH_NOP); @@ -2876,7 +2876,7 @@ static DRIVER_INIT( scorpion ) memory_install_read8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x3000, 0x3000, 0, 0, scorpion_sound_status_r); /* { - const UINT8 *rom = memory_region(REGION_SOUND1); + const UINT8 *rom = memory_region(machine, REGION_SOUND1); int i; for (i = 0; i < 0x2c; i++) @@ -2900,7 +2900,7 @@ static DRIVER_INIT( anteater ) common_init(machine, scramble_draw_bullet, scramble_draw_background, NULL, NULL); /* decode graphics */ - decode_anteater_gfx(); + decode_anteater_gfx(machine); } @@ -2911,7 +2911,7 @@ static DRIVER_INIT( superbon ) common_init(machine, scramble_draw_bullet, scramble_draw_background, NULL, NULL); /* decode code */ - decode_superbon(); + decode_superbon(machine); } diff --git a/src/mame/drivers/galivan.c b/src/mame/drivers/galivan.c index 0a9cc43e592..1a2934f1fd0 100644 --- a/src/mame/drivers/galivan.c +++ b/src/mame/drivers/galivan.c @@ -50,7 +50,7 @@ VIDEO_UPDATE( ninjemak ); static MACHINE_RESET( galivan ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); memory_set_bankptr(1,&RAM[0x10000]); // layers = 0x60; @@ -1008,11 +1008,11 @@ static WRITE8_HANDLER( youmab_extra_bank_w ) { if (data==0xff) { - memory_set_bankptr( 2, memory_region(REGION_USER2)+0x4000 ); + memory_set_bankptr( 2, memory_region(machine, REGION_USER2)+0x4000 ); } else if (data==0x00) { - memory_set_bankptr( 2, memory_region(REGION_USER2) ); + memory_set_bankptr( 2, memory_region(machine, REGION_USER2) ); } else { @@ -1039,7 +1039,7 @@ static DRIVER_INIT( youmab ) { memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x82, 0x82, 0, 0, youmab_extra_bank_w); // banks rom at 0x8000? writes 0xff and 0x00 before executing code there memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xbfff, 0, 0, SMH_BANK2); - memory_set_bankptr( 2, memory_region(REGION_USER2) ); + memory_set_bankptr( 2, memory_region(machine, REGION_USER2) ); memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x81, 0x81, 0, 0, youmab_81_w); // ?? often, alternating values memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x84, 0x84, 0, 0, youmab_84_w); // ?? often, sequence.. diff --git a/src/mame/drivers/galpani2.c b/src/mame/drivers/galpani2.c index f20130943d2..8d8fdad9994 100644 --- a/src/mame/drivers/galpani2.c +++ b/src/mame/drivers/galpani2.c @@ -202,7 +202,7 @@ static WRITE16_HANDLER( galpani2_oki_0_bank_w ) { if (ACCESSING_BITS_0_7) { - UINT8 *ROM = memory_region(REGION_SOUND1); + UINT8 *ROM = memory_region(machine, REGION_SOUND1); logerror("CPU #0 PC %06X : OKI 0 bank %08X\n",activecpu_get_pc(),data); memcpy(ROM + 0x30000, ROM + 0x40000 + 0x10000 * (~data & 0xf), 0x10000); } @@ -266,8 +266,8 @@ static UINT16 *galpani2_rombank; static READ16_HANDLER( galpani2_bankedrom_r ) { - UINT16 *ROM = (UINT16 *) memory_region( REGION_USER1 ); - size_t len = memory_region_length( REGION_USER1 ) / 2; + UINT16 *ROM = (UINT16 *) memory_region( machine, REGION_USER1 ); + size_t len = memory_region_length( machine, REGION_USER1 ) / 2; offset += (0x800000/2) * (*galpani2_rombank & 0x0003); diff --git a/src/mame/drivers/galpani3.c b/src/mame/drivers/galpani3.c index 5df23c79aed..bc82adcd266 100644 --- a/src/mame/drivers/galpani3.c +++ b/src/mame/drivers/galpani3.c @@ -424,7 +424,7 @@ ROM_END static DRIVER_INIT( galpani3 ) { - UINT16 *patchrom = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *patchrom = (UINT16 *)memory_region(machine, REGION_CPU1); // weird checks of supposed tilemap registers patchrom[0x3a0c6/2] = 0x4e71; diff --git a/src/mame/drivers/galpanic.c b/src/mame/drivers/galpanic.c index d2e62d9d383..f71b5cb78c8 100644 --- a/src/mame/drivers/galpanic.c +++ b/src/mame/drivers/galpanic.c @@ -163,7 +163,7 @@ static WRITE16_HANDLER( galpanic_6295_bankswitch_w ) { if (ACCESSING_BITS_8_15) { - UINT8 *rom = memory_region(REGION_SOUND1); + UINT8 *rom = memory_region(machine, REGION_SOUND1); memcpy(&rom[0x30000],&rom[0x40000 + ((data >> 8) & 0x0f) * 0x10000],0x10000); @@ -176,7 +176,7 @@ static WRITE16_HANDLER( galpania_6295_bankswitch_w ) { if (ACCESSING_BITS_8_15) { - UINT8 *rom = memory_region(REGION_SOUND1); + UINT8 *rom = memory_region(machine, REGION_SOUND1); memcpy(&rom[0x30000],&rom[0x40000 + ((data >> 8) & 0x0f) * 0x10000],0x10000); } diff --git a/src/mame/drivers/gamecstl.c b/src/mame/drivers/gamecstl.c index ec6d72412ef..ed16d069b82 100644 --- a/src/mame/drivers/gamecstl.c +++ b/src/mame/drivers/gamecstl.c @@ -176,7 +176,7 @@ static void mxtc_config_w(int function, int reg, UINT8 data) } else // disable RAM access (reads go to BIOS ROM) { - memory_set_bankptr(1, memory_region(REGION_USER1) + 0x30000); + memory_set_bankptr(1, memory_region(Machine, REGION_USER1) + 0x30000); } break; } @@ -570,7 +570,7 @@ static IRQ_CALLBACK(irq_callback) static MACHINE_RESET(gamecstl) { - memory_set_bankptr(1, memory_region(REGION_USER1) + 0x30000); + memory_set_bankptr(1, memory_region(machine, REGION_USER1) + 0x30000); cpunum_set_irq_callback(0, irq_callback); diff --git a/src/mame/drivers/gaplus.c b/src/mame/drivers/gaplus.c index 92dcc32a7e8..722c33b79d6 100644 --- a/src/mame/drivers/gaplus.c +++ b/src/mame/drivers/gaplus.c @@ -201,25 +201,25 @@ static const struct namcoio_interface intf1 = }; /* TODO: chip #2: test/cocktail, optional buttons */ -static void unpack_gfx(void); +static void unpack_gfx(running_machine *machine); static DRIVER_INIT( 56_58 ) { - unpack_gfx(); + unpack_gfx(machine); namcoio_init(0, NAMCOIO_56XX, &intf0); namcoio_init(1, NAMCOIO_58XX, &intf1); } static DRIVER_INIT( 56_58l ) { - unpack_gfx(); + unpack_gfx(machine); namcoio_init(0, NAMCOIO_56XX, &intf0_lamps); namcoio_init(1, NAMCOIO_58XX, &intf1); } static DRIVER_INIT( 58_56 ) { - unpack_gfx(); + unpack_gfx(machine); namcoio_init(0, NAMCOIO_58XX, &intf0); namcoio_init(1, NAMCOIO_56XX, &intf1); } @@ -823,16 +823,16 @@ ROM_START( galaga3m ) ROM_END -static void unpack_gfx(void) +static void unpack_gfx(running_machine *machine) { UINT8 *rom; int i; - rom = memory_region(REGION_GFX1); + rom = memory_region(machine, REGION_GFX1); for (i = 0;i < 0x2000;i++) rom[i + 0x2000] = rom[i] >> 4; - rom = memory_region(REGION_GFX2) + 0x6000; + rom = memory_region(machine, REGION_GFX2) + 0x6000; for (i = 0;i < 0x2000;i++) rom[i + 0x2000] = rom[i] << 4; } diff --git a/src/mame/drivers/gauntlet.c b/src/mame/drivers/gauntlet.c index 1177217b900..c307773cd65 100644 --- a/src/mame/drivers/gauntlet.c +++ b/src/mame/drivers/gauntlet.c @@ -1633,7 +1633,7 @@ ROM_END static void gauntlet_common_init(running_machine *machine, int slapstic, int vindctr2) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); atarigen_eeprom_default = NULL; atarigen_slapstic_init(machine, 0, 0x038000, 0, slapstic); @@ -1669,7 +1669,7 @@ static DRIVER_INIT( gauntlet2 ) static DRIVER_INIT( vindctr2 ) { - UINT8 *gfx2_base = memory_region(REGION_GFX2); + UINT8 *gfx2_base = memory_region(machine, REGION_GFX2); UINT8 *data = malloc_or_die(0x8000); int i; diff --git a/src/mame/drivers/gberet.c b/src/mame/drivers/gberet.c index e948891a427..175d32025ab 100644 --- a/src/mame/drivers/gberet.c +++ b/src/mame/drivers/gberet.c @@ -132,7 +132,7 @@ static WRITE8_HANDLER( mrgoemon_coin_counter_w ) /* bits 5-7 = ROM bank select */ offs = 0x10000 + ((data & 0xe0) >> 5) * 0x800; - memory_set_bankptr(1, &memory_region(REGION_CPU1)[offs]); + memory_set_bankptr(1, &memory_region(machine, REGION_CPU1)[offs]); } static WRITE8_HANDLER( mrgoemon_flipscreen_w ) diff --git a/src/mame/drivers/gbusters.c b/src/mame/drivers/gbusters.c index 4870ef1b8de..211c0d2644b 100644 --- a/src/mame/drivers/gbusters.c +++ b/src/mame/drivers/gbusters.c @@ -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/2151intf.h" @@ -418,7 +419,7 @@ ROM_END static void gbusters_banking( int lines ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(Machine, REGION_CPU1); int offs = 0x10000; /* bits 0-3 ROM bank */ @@ -435,7 +436,7 @@ static void gbusters_banking( int lines ) static MACHINE_RESET( gbusters ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); cpunum_set_info_fct(0, CPUINFO_PTR_KONAMI_SETLINES_CALLBACK, (genf *)gbusters_banking); diff --git a/src/mame/drivers/genesis.c b/src/mame/drivers/genesis.c index 2ed23406fbc..6be3dd7c6e7 100644 --- a/src/mame/drivers/genesis.c +++ b/src/mame/drivers/genesis.c @@ -626,7 +626,7 @@ READ8_HANDLER ( genesis_z80_bank_r ) logerror("z80 read from address %x\n", address); /* Read the data out of the 68k ROM */ - if (address < 0x400000) return memory_region(REGION_CPU1)[BYTE_XOR(address)]; + if (address < 0x400000) return memory_region(machine, REGION_CPU1)[BYTE_XOR(address)]; /* else read the data out of the 68k RAM */ // else if (address > 0xff0000) return genesis_68k_ram[BYTE_XOR(offset)]; diff --git a/src/mame/drivers/getrivia.c b/src/mame/drivers/getrivia.c index 936dc4250f3..f7579487552 100644 --- a/src/mame/drivers/getrivia.c +++ b/src/mame/drivers/getrivia.c @@ -190,43 +190,43 @@ static WRITE8_HANDLER( nmi_w ) static WRITE8_HANDLER( banksel_1_1_w ) { - memory_set_bankptr(1,memory_region(REGION_CPU1) + 0x10000); + memory_set_bankptr(1,memory_region(machine, REGION_CPU1) + 0x10000); } static WRITE8_HANDLER( banksel_2_1_w ) { - memory_set_bankptr(1,memory_region(REGION_CPU1) + 0x14000); + memory_set_bankptr(1,memory_region(machine, REGION_CPU1) + 0x14000); } static WRITE8_HANDLER( banksel_3_1_w ) { - memory_set_bankptr(1,memory_region(REGION_CPU1) + 0x18000); + memory_set_bankptr(1,memory_region(machine, REGION_CPU1) + 0x18000); } static WRITE8_HANDLER( banksel_4_1_w ) { - memory_set_bankptr(1,memory_region(REGION_CPU1) + 0x1c000); + memory_set_bankptr(1,memory_region(machine, REGION_CPU1) + 0x1c000); } static WRITE8_HANDLER( banksel_5_1_w ) { - memory_set_bankptr(1,memory_region(REGION_CPU1) + 0x20000); + memory_set_bankptr(1,memory_region(machine, REGION_CPU1) + 0x20000); } static WRITE8_HANDLER( banksel_1_2_w ) { - memory_set_bankptr(1,memory_region(REGION_CPU1) + 0x12000); + memory_set_bankptr(1,memory_region(machine, REGION_CPU1) + 0x12000); } static WRITE8_HANDLER( banksel_2_2_w ) { - memory_set_bankptr(1,memory_region(REGION_CPU1) + 0x16000); + memory_set_bankptr(1,memory_region(machine, REGION_CPU1) + 0x16000); } static WRITE8_HANDLER( banksel_3_2_w ) { - memory_set_bankptr(1,memory_region(REGION_CPU1) + 0x1a000); + memory_set_bankptr(1,memory_region(machine, REGION_CPU1) + 0x1a000); } static WRITE8_HANDLER( banksel_4_2_w ) { - memory_set_bankptr(1,memory_region(REGION_CPU1) + 0x1e000); + memory_set_bankptr(1,memory_region(machine, REGION_CPU1) + 0x1e000); } static WRITE8_HANDLER( banksel_5_2_w ) { - memory_set_bankptr(1,memory_region(REGION_CPU1) + 0x22000); + memory_set_bankptr(1,memory_region(machine, REGION_CPU1) + 0x22000); } static ADDRESS_MAP_START( getrivia_map, ADDRESS_SPACE_PROGRAM, 8 ) @@ -840,7 +840,7 @@ ROM_END static DRIVER_INIT( setbank ) { - memory_set_bankptr(1,memory_region(REGION_CPU1) + 0x2000); + memory_set_bankptr(1,memory_region(machine, REGION_CPU1) + 0x2000); } GAME( 1982, jokpoker, 0, gselect, gselect, setbank, ROT0, "Greyhound Electronics", "Joker Poker (Version 16.03B)", GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) diff --git a/src/mame/drivers/ghosteo.c b/src/mame/drivers/ghosteo.c index 86a096daa8c..aee54684be4 100644 --- a/src/mame/drivers/ghosteo.c +++ b/src/mame/drivers/ghosteo.c @@ -147,9 +147,9 @@ static READ32_HANDLER( flash_reg_r ) static READ32_HANDLER( flash_r ) { - UINT8 *flash = (UINT8 *)memory_region(REGION_USER1); + UINT8 *flash = (UINT8 *)memory_region(machine, REGION_USER1); UINT8 value = flash[flash_addr]; - flash_addr = (flash_addr + 1) % memory_region_length(REGION_USER1); + flash_addr = (flash_addr + 1) % memory_region_length(machine, REGION_USER1); return value; } @@ -554,7 +554,7 @@ ROM_END static DRIVER_INIT( bballoon ) { - UINT8 *flash = (UINT8 *)memory_region(REGION_USER1); + UINT8 *flash = (UINT8 *)memory_region(machine, REGION_USER1); // nop flash ECC checks diff --git a/src/mame/drivers/ginganin.c b/src/mame/drivers/ginganin.c index 23f852a0d89..f54a3634009 100644 --- a/src/mame/drivers/ginganin.c +++ b/src/mame/drivers/ginganin.c @@ -467,7 +467,7 @@ static DRIVER_INIT( ginganin ) UINT16 *rom; /* main cpu patches */ - rom = (UINT16 *)memory_region(REGION_CPU1); + rom = (UINT16 *)memory_region(machine, REGION_CPU1); /* avoid writes to rom getting to the log */ rom[0x408/2] = 0x6000; rom[0x40a/2] = 0x001c; @@ -475,7 +475,7 @@ static DRIVER_INIT( ginganin ) /* sound cpu patches */ /* let's clear the RAM: ROM starts at 0x4000 */ - memset(memory_region(REGION_CPU2),0,0x800); + memset(memory_region(machine, REGION_CPU2),0,0x800); } diff --git a/src/mame/drivers/gladiatr.c b/src/mame/drivers/gladiatr.c index 3aa2189c246..ec7e04a0da7 100644 --- a/src/mame/drivers/gladiatr.c +++ b/src/mame/drivers/gladiatr.c @@ -207,7 +207,7 @@ VIDEO_UPDATE( gladiatr ); /*Rom bankswitching*/ static WRITE8_HANDLER( gladiatr_bankswitch_w ) { - UINT8 *rom = memory_region(REGION_CPU1) + 0x10000; + UINT8 *rom = memory_region(machine, REGION_CPU1) + 0x10000; memory_set_bankptr(1, rom + 0x6000 * (data & 0x01)); } @@ -269,7 +269,7 @@ static MACHINE_RESET( gladiator ) TAITO8741_start(&gsword_8741interface); /* 6809 bank memory set */ { - UINT8 *rom = memory_region(REGION_CPU3) + 0x10000; + UINT8 *rom = memory_region(machine, REGION_CPU3) + 0x10000; memory_set_bankptr(2,rom); } } @@ -296,7 +296,7 @@ static void gladiator_ym_irq(running_machine *machine, int irq) /*Sound Functions*/ static WRITE8_HANDLER( glad_adpcm_w ) { - UINT8 *rom = memory_region(REGION_CPU3) + 0x10000; + UINT8 *rom = memory_region(machine, REGION_CPU3) + 0x10000; /* bit6 = bank offset */ memory_set_bankptr(2,rom + ((data & 0x40) ? 0xc000 : 0)); @@ -980,7 +980,7 @@ static DRIVER_INIT( gladiatr ) UINT8 *rom; int i,j; - rom = memory_region(REGION_GFX2); + rom = memory_region(machine, REGION_GFX2); // unpack 3bpp graphics for (j = 3; j >= 0; j--) { @@ -994,7 +994,7 @@ static DRIVER_INIT( gladiatr ) swap_block(rom + 0x14000, rom + 0x18000, 0x4000); - rom = memory_region(REGION_GFX3); + rom = memory_region(machine, REGION_GFX3); // unpack 3bpp graphics for (j = 5; j >= 0; j--) { @@ -1025,14 +1025,14 @@ static DRIVER_INIT(ppking) UINT8 *rom; int i,j; - rom = memory_region(REGION_GFX2); + rom = memory_region(machine, REGION_GFX2); // unpack 3bpp graphics for (i = 0; i < 0x2000; i++) { rom[i+0x2000] = rom[i] >> 4; } - rom = memory_region(REGION_GFX3); + rom = memory_region(machine, REGION_GFX3); // unpack 3bpp graphics for (j = 1; j >= 0; j--) { diff --git a/src/mame/drivers/glass.c b/src/mame/drivers/glass.c index 563c99a1ca1..6eafc866e38 100644 --- a/src/mame/drivers/glass.c +++ b/src/mame/drivers/glass.c @@ -84,7 +84,7 @@ ADDRESS_MAP_END static WRITE16_HANDLER( OKIM6295_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_SOUND1); + UINT8 *RAM = memory_region(machine, REGION_SOUND1); if (ACCESSING_BITS_0_7){ memcpy(&RAM[0x30000], &RAM[0x40000 + (data & 0x0f)*0x10000], 0x10000); @@ -299,15 +299,15 @@ ROM_END ***************************************************************************/ -static void glass_ROM16_split(int src_reg, int dst_reg, int start, int length, int dest1, int dest2) +static void glass_ROM16_split(running_machine *machine, int src_reg, int dst_reg, int start, int length, int dest1, int dest2) { int i; /* get a pointer to the source data */ - UINT8 *src = (UINT8 *)memory_region(src_reg); + UINT8 *src = (UINT8 *)memory_region(machine, src_reg); /* get a pointer to the destination data */ - UINT8 *dst = (UINT8 *)memory_region(dst_reg); + UINT8 *dst = (UINT8 *)memory_region(machine, dst_reg); /* fill destination areas with the proper data */ for (i = 0; i < length/2; i++){ @@ -331,10 +331,10 @@ static DRIVER_INIT( glass ) */ /* split ROM H13 */ - glass_ROM16_split(REGION_GFX2, REGION_GFX1, 0x0000000, 0x0200000, 0x0000000, 0x0100000); + glass_ROM16_split(machine, REGION_GFX2, REGION_GFX1, 0x0000000, 0x0200000, 0x0000000, 0x0100000); /* split ROM H11 */ - glass_ROM16_split(REGION_GFX2, REGION_GFX1, 0x0200000, 0x0200000, 0x0200000, 0x0300000); + glass_ROM16_split(machine, REGION_GFX2, REGION_GFX1, 0x0200000, 0x0200000, 0x0200000, 0x0300000); } GAME( 1993, glass, 0, glass, glass, glass, ROT0, "Gaelco", "Glass (Ver 1.1)", GAME_UNEMULATED_PROTECTION ) diff --git a/src/mame/drivers/gng.c b/src/mame/drivers/gng.c index 1ae269e7851..c9843e69d11 100644 --- a/src/mame/drivers/gng.c +++ b/src/mame/drivers/gng.c @@ -60,7 +60,7 @@ static WRITE8_HANDLER( gng_coin_counter_w ) static MACHINE_START( gng ) { /* configure ROM banking */ - UINT8 *rombase = memory_region(REGION_CPU1); + UINT8 *rombase = memory_region(machine, REGION_CPU1); memory_configure_bank(1,0,4,&rombase[0x10000],0x2000); memory_configure_bank(1,4,1,&rombase[0x4000],0x2000); } diff --git a/src/mame/drivers/goal92.c b/src/mame/drivers/goal92.c index 7f6c62f56a6..cae9eb6728d 100644 --- a/src/mame/drivers/goal92.c +++ b/src/mame/drivers/goal92.c @@ -87,7 +87,7 @@ ADDRESS_MAP_END static WRITE8_HANDLER( adpcm_control_w ) { int bankaddress; - UINT8 *RAM = memory_region(REGION_CPU2); + UINT8 *RAM = memory_region(machine, REGION_CPU2); /* the code writes either 2 or 3 in the bottom two bits */ bankaddress = 0x10000 + (data & 0x01) * 0x4000; diff --git a/src/mame/drivers/goindol.c b/src/mame/drivers/goindol.c index be8374efee7..1b3f38659e9 100644 --- a/src/mame/drivers/goindol.c +++ b/src/mame/drivers/goindol.c @@ -38,7 +38,7 @@ extern int goindol_char_bank; static WRITE8_HANDLER( goindol_bankswitch_w ) { int bankaddress; - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); bankaddress = 0x10000 + ((data & 3) * 0x4000); memory_set_bankptr(1,&RAM[bankaddress]); @@ -414,7 +414,7 @@ ROM_END static DRIVER_INIT( goindol ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); /* I hope that's all patches to avoid protection */ diff --git a/src/mame/drivers/goldstar.c b/src/mame/drivers/goldstar.c index 5fb743a9bf5..72076013da7 100644 --- a/src/mame/drivers/goldstar.c +++ b/src/mame/drivers/goldstar.c @@ -444,7 +444,7 @@ ROM_END static DRIVER_INIT(goldstar) { int A; - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); for (A = 0;A < 0x10000;A++) diff --git a/src/mame/drivers/gottlieb.c b/src/mame/drivers/gottlieb.c index 252d3072450..68e54bcfef2 100644 --- a/src/mame/drivers/gottlieb.c +++ b/src/mame/drivers/gottlieb.c @@ -189,7 +189,7 @@ static UINT8 *audiobuffer_region; static MACHINE_RESET( gottlieb ) { - audiobuffer_region = memory_region(REGION_USER1); + audiobuffer_region = memory_region(machine, REGION_USER1); } diff --git a/src/mame/drivers/gpworld.c b/src/mame/drivers/gpworld.c index fc72a2aea68..ec6fb2dd9b5 100644 --- a/src/mame/drivers/gpworld.c +++ b/src/mame/drivers/gpworld.c @@ -105,7 +105,7 @@ static void gpworld_draw_sprites(running_machine *machine, bitmap_t *bitmap, con int i; - UINT8 *GFX = memory_region(REGION_GFX2); + UINT8 *GFX = memory_region(machine, REGION_GFX2); /* Heisted from Daphne which heisted it from MAME */ for (i = 0; i < 0x800; i += 8) diff --git a/src/mame/drivers/groundfx.c b/src/mame/drivers/groundfx.c index 89e6fe26420..be625179f49 100644 --- a/src/mame/drivers/groundfx.c +++ b/src/mame/drivers/groundfx.c @@ -393,7 +393,7 @@ GFXDECODE_END static MACHINE_RESET( groundfx ) { - taito_f3_soundsystem_reset(); + taito_f3_soundsystem_reset(machine); f3_68681_reset(); } @@ -491,8 +491,8 @@ static READ32_HANDLER( irq_speedup_r_groundfx ) static DRIVER_INIT( groundfx ) { UINT32 offset,i; - UINT8 *gfx = memory_region(REGION_GFX3); - int size=memory_region_length(REGION_GFX3); + UINT8 *gfx = memory_region(machine, REGION_GFX3); + int size=memory_region_length(machine, REGION_GFX3); int data; /* Speedup handlers */ diff --git a/src/mame/drivers/gstriker.c b/src/mame/drivers/gstriker.c index 7a2516507ed..6ce7cb5b4cc 100644 --- a/src/mame/drivers/gstriker.c +++ b/src/mame/drivers/gstriker.c @@ -219,7 +219,7 @@ static WRITE8_HANDLER( gs_sh_pending_command_clear_w ) static WRITE8_HANDLER( gs_sh_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_CPU2); + UINT8 *RAM = memory_region(machine, REGION_CPU2); int bankaddress; bankaddress = 0x10000 + (data & 0x03) * 0x8000; diff --git a/src/mame/drivers/gsword.c b/src/mame/drivers/gsword.c index 9e1c26349cf..5b79d740d03 100644 --- a/src/mame/drivers/gsword.c +++ b/src/mame/drivers/gsword.c @@ -935,7 +935,7 @@ ROM_END static DRIVER_INIT( gsword ) { #if 0 - UINT8 *ROM2 = memory_region(REGION_CPU2); + UINT8 *ROM2 = memory_region(machine, REGION_CPU2); ROM2[0x1da] = 0xc3; /* patch for rom self check */ ROM2[0x71e] = 0; /* patch for sound protection or time out function */ @@ -950,7 +950,7 @@ static DRIVER_INIT( gsword ) static DRIVER_INIT( gsword2 ) { #if 0 - UINT8 *ROM2 = memory_region(REGION_CPU2); + UINT8 *ROM2 = memory_region(machine, REGION_CPU2); ROM2[0x1da] = 0xc3; /* patch for rom self check */ ROM2[0x726] = 0; /* patch for sound protection or time out function */ diff --git a/src/mame/drivers/gticlub.c b/src/mame/drivers/gticlub.c index 24860a56b6d..06ff7517987 100644 --- a/src/mame/drivers/gticlub.c +++ b/src/mame/drivers/gticlub.c @@ -958,7 +958,7 @@ static DRIVER_INIT(gticlub) init_konami_cgboard(1, CGBOARD_TYPE_GTICLUB); sharc_dataram_0 = auto_malloc(0x100000); - K001005_preprocess_texture_data(memory_region(REGION_GFX1), memory_region_length(REGION_GFX1), 1); + K001005_preprocess_texture_data(memory_region(machine, REGION_GFX1), memory_region_length(machine, REGION_GFX1), 1); K056800_init(sound_irq_callback); @@ -973,8 +973,8 @@ static DRIVER_INIT(gticlub) static DRIVER_INIT(hangplt) { init_konami_cgboard(2, CGBOARD_TYPE_HANGPLT); - set_cgboard_texture_bank(0, 5, memory_region(REGION_USER5)); - set_cgboard_texture_bank(1, 6, memory_region(REGION_USER5)); + set_cgboard_texture_bank(0, 5, memory_region(machine, REGION_USER5)); + set_cgboard_texture_bank(1, 6, memory_region(machine, REGION_USER5)); sharc_dataram_0 = auto_malloc(0x100000); sharc_dataram_1 = auto_malloc(0x100000); diff --git a/src/mame/drivers/guab.c b/src/mame/drivers/guab.c index 26dbd014cd1..679b879f1fe 100644 --- a/src/mame/drivers/guab.c +++ b/src/mame/drivers/guab.c @@ -295,7 +295,7 @@ enum static TIMER_CALLBACK( fdc_data_callback ) { - UINT8* disk = (UINT8*)memory_region(REGION_USER1); + UINT8* disk = (UINT8*)memory_region(machine, REGION_USER1); int more_data = 0; /* diff --git a/src/mame/drivers/gunbustr.c b/src/mame/drivers/gunbustr.c index 7cf81b8ce8a..824868ebb3e 100644 --- a/src/mame/drivers/gunbustr.c +++ b/src/mame/drivers/gunbustr.c @@ -329,7 +329,7 @@ GFXDECODE_END static MACHINE_RESET( gunbustr ) { - taito_f3_soundsystem_reset(); + taito_f3_soundsystem_reset(machine); f3_68681_reset(); } diff --git a/src/mame/drivers/gundealr.c b/src/mame/drivers/gundealr.c index ace7b60aa26..ebed2ea2e1e 100644 --- a/src/mame/drivers/gundealr.c +++ b/src/mame/drivers/gundealr.c @@ -86,7 +86,7 @@ static INTERRUPT_GEN( yamyam_interrupt ) static WRITE8_HANDLER( yamyam_bankswitch_w ) { int bankaddress; - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); bankaddress = 0x10000 + (data & 0x07) * 0x4000; memory_set_bankptr(1,&RAM[bankaddress]); diff --git a/src/mame/drivers/gyruss.c b/src/mame/drivers/gyruss.c index 02ac25cd3b7..8cf1357eec2 100644 --- a/src/mame/drivers/gyruss.c +++ b/src/mame/drivers/gyruss.c @@ -701,7 +701,7 @@ ROM_END static DRIVER_INIT( gyruss ) { - konami1_decode(1); + konami1_decode(machine, 1); } diff --git a/src/mame/drivers/halleys.c b/src/mame/drivers/halleys.c index 202efcf90ad..b22ce051833 100644 --- a/src/mame/drivers/halleys.c +++ b/src/mame/drivers/halleys.c @@ -1099,7 +1099,7 @@ static PALETTE_INIT( halleys ) } } -static void halleys_decode_rgb(UINT32 *r, UINT32 *g, UINT32 *b, int addr, int data) +static void halleys_decode_rgb(running_machine *machine, UINT32 *r, UINT32 *g, UINT32 *b, int addr, int data) { /* proms contain: @@ -1116,7 +1116,7 @@ static void halleys_decode_rgb(UINT32 *r, UINT32 *g, UINT32 *b, int addr, int da sram_189 = paletteram; // each of the three 32-byte 6330 PROM is wired to an RGB component output - prom_6330 = memory_region(REGION_PROMS); + prom_6330 = memory_region(machine, REGION_PROMS); // latch1 holds 8 bits from the selected palette RAM address latch1_273 = sram_189[addr]; @@ -1168,7 +1168,7 @@ static WRITE8_HANDLER( halleys_paletteram_IIRRGGBB_w ) palette_set_color(machine, offset+SP_ALPHA, MAKE_RGB(r, g, b)); palette_set_color(machine, offset+SP_COLLD, MAKE_RGB(r, g, b)); - halleys_decode_rgb(&r, &g, &b, offset, 0); + halleys_decode_rgb(machine, &r, &g, &b, offset, 0); palette_set_color(machine, offset+0x20, MAKE_RGB(r, g, b)); } @@ -2146,7 +2146,7 @@ ROM_END //************************************************************************** // Driver Initializations -static void init_common(void) +static void init_common(running_machine *machine) { UINT8 *buf, *rom; int addr, i; @@ -2181,7 +2181,7 @@ static void init_common(void) // decrypt main program ROM - rom = cpu1_base = memory_region(REGION_CPU1); + rom = cpu1_base = memory_region(machine, REGION_CPU1); buf = gfx1_base; for (i=0; i<0x10000; i++) @@ -2194,7 +2194,7 @@ static void init_common(void) // swap graphics ROM addresses and unpack each pixel - rom = memory_region(REGION_GFX1); + rom = memory_region(machine, REGION_GFX1); buf = gfx_plane02; for (i=0xffff; i>=0; i--) @@ -2230,7 +2230,7 @@ static DRIVER_INIT( benberob ) { game_id = GAME_BENBEROB; - init_common(); + init_common(machine); blitter_reset_timer = timer_alloc(blitter_reset, NULL); } @@ -2241,7 +2241,7 @@ static DRIVER_INIT( halleys ) game_id = GAME_HALLEYS; halleys_collision_detection = 0xb114; - init_common(); + init_common(machine); } static DRIVER_INIT( halley87 ) @@ -2249,7 +2249,7 @@ static DRIVER_INIT( halley87 ) game_id = GAME_HALLEYS; halleys_collision_detection = 0xb10d; - init_common(); + init_common(machine); } diff --git a/src/mame/drivers/harddriv.c b/src/mame/drivers/harddriv.c index c4e7dba50ad..1763a22d7bd 100644 --- a/src/mame/drivers/harddriv.c +++ b/src/mame/drivers/harddriv.c @@ -3421,12 +3421,12 @@ static void init_ds3(running_machine *machine) /* if we have a sound DSP, boot it */ if (hdcpu_sound != -1 && machine->config->cpu[hdcpu_sound].type == CPU_ADSP2105) { - UINT8 *snd = memory_region(REGION_CPU1 + hdcpu_sound); + UINT8 *snd = memory_region(machine, REGION_CPU1 + hdcpu_sound); adsp2105_load_boot_data((UINT8 *)(snd + 0x10000), (UINT32 *)(snd)); } if (hdcpu_sounddsp != -1 && machine->config->cpu[hdcpu_sounddsp].type == CPU_ADSP2105) { - UINT8 *dsp = memory_region(REGION_CPU1 + hdcpu_sounddsp); + UINT8 *dsp = memory_region(machine, REGION_CPU1 + hdcpu_sounddsp); adsp2105_load_boot_data((UINT8 *)(dsp + 0x10000), (UINT32 *)(dsp)); } @@ -3502,7 +3502,7 @@ static void init_ds3(running_machine *machine) /* COMMON INIT: initialize the DSK add-on board */ static void init_dsk(running_machine *machine) { - UINT8 *usr3 = memory_region(REGION_USER3); + UINT8 *usr3 = memory_region(machine, REGION_USER3); /* install ASIC61 */ memory_install_readwrite16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x85c000, 0x85c7ff, 0, 0, hd68k_dsk_dsp32_r, hd68k_dsk_dsp32_w); @@ -3535,7 +3535,7 @@ static void init_dsk(running_machine *machine) /* COMMON INIT: initialize the DSK II add-on board */ static void init_dsk2(running_machine *machine) { - UINT8 *usr3 = memory_region(REGION_USER3); + UINT8 *usr3 = memory_region(machine, REGION_USER3); /* install ASIC65 */ memory_install_write16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x824000, 0x824003, 0, 0, asic65_data_w); @@ -3580,7 +3580,7 @@ static void init_dspcom(running_machine *machine) /* COMMON INIT: initialize the original "driver" sound board */ static void init_driver_sound(running_machine *machine) { - hdsnd_init(); + hdsnd_init(machine); /* install sound handlers */ memory_install_readwrite16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x840000, 0x840001, 0, 0, hd68k_snd_data_r, hd68k_snd_data_w); @@ -3758,7 +3758,7 @@ static void steeltal_init_common(running_machine *machine, offs_t ds3_transfer_p init_multisync(machine, 0); init_ds3(machine); init_dspcom(machine); - atarijsa3_init_adpcm(REGION_SOUND1); + atarijsa3_init_adpcm(machine, REGION_SOUND1); atarijsa_init(machine, "IN0", 0x0020); memory_install_read16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x908000, 0x908001, 0, 0, steeltal_dummy_r); diff --git a/src/mame/drivers/hcastle.c b/src/mame/drivers/hcastle.c index fdb0d149fcb..62bdd2c6bbc 100644 --- a/src/mame/drivers/hcastle.c +++ b/src/mame/drivers/hcastle.c @@ -28,7 +28,7 @@ WRITE8_HANDLER( hcastle_pf2_control_w ); static WRITE8_HANDLER( hcastle_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); int bankaddress; bankaddress = 0x10000 + (data & 0x1f) * 0x2000; diff --git a/src/mame/drivers/hexa.c b/src/mame/drivers/hexa.c index ac539805a35..287e772e74b 100644 --- a/src/mame/drivers/hexa.c +++ b/src/mame/drivers/hexa.c @@ -190,7 +190,7 @@ ROM_END static DRIVER_INIT( hexa ) { #if 0 - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); /* Hexa is not protected or anything, but it keeps writing 0x3f to register */ diff --git a/src/mame/drivers/hnayayoi.c b/src/mame/drivers/hnayayoi.c index 88c51ebaf76..98074b6da7e 100644 --- a/src/mame/drivers/hnayayoi.c +++ b/src/mame/drivers/hnayayoi.c @@ -708,8 +708,8 @@ ROM_END static DRIVER_INIT( hnfubuki ) { - UINT8 *rom = memory_region(REGION_GFX1); - int len = memory_region_length(REGION_GFX1); + UINT8 *rom = memory_region(machine, REGION_GFX1); + int len = memory_region_length(machine, REGION_GFX1); int i,j; /* interestingly, the blitter data has a slight encryption */ diff --git a/src/mame/drivers/hng64.c b/src/mame/drivers/hng64.c index 68387d4f485..3c5bca020c5 100644 --- a/src/mame/drivers/hng64.c +++ b/src/mame/drivers/hng64.c @@ -1458,7 +1458,7 @@ static INTERRUPT_GEN( irq_start ) static MACHINE_RESET(hyperneo) { int i ; - const UINT8 *rom = memory_region(REGION_USER2); + const UINT8 *rom = memory_region(machine, REGION_USER2); /* Sound CPU */ UINT8 *RAM = (UINT8*)hng64_soundram; diff --git a/src/mame/drivers/homedata.c b/src/mame/drivers/homedata.c index a565c1eefcc..890f706fb4b 100644 --- a/src/mame/drivers/homedata.c +++ b/src/mame/drivers/homedata.c @@ -300,7 +300,7 @@ static READ8_HANDLER( mrokumei_sound_io_r ) if (sndbank & 4) return(soundlatch_r(machine,0)); else - return memory_region(REGION_CPU2)[0x10000 + offset + (sndbank & 1) * 0x10000]; + return memory_region(machine, REGION_CPU2)[0x10000 + offset + (sndbank & 1) * 0x10000]; } static WRITE8_HANDLER( mrokumei_sound_bank_w ) @@ -366,7 +366,7 @@ static WRITE8_HANDLER( reikaids_upd7807_portc_w ) // logerror("%04x: port C wr %02x (STATUS %d DATA %d)\n",activecpu_get_pc(),data,BIT(data,2),BIT(data,6)); - memory_set_bankptr(2,memory_region(REGION_CPU2) + 0x10000 * (data & 0x03)); + memory_set_bankptr(2,memory_region(machine, REGION_CPU2) + 0x10000 * (data & 0x03)); coin_counter_w(0,~data & 0x80); @@ -525,7 +525,7 @@ static WRITE8_HANDLER( pteacher_upd7807_portc_w ) // logerror("%04x: port C wr %02x\n",activecpu_get_pc(),data); - memory_set_bankptr(2,memory_region(REGION_CPU2) + 0x10000 * ((data & 0x0c) >> 2)); + memory_set_bankptr(2,memory_region(machine, REGION_CPU2) + 0x10000 * ((data & 0x0c) >> 2)); coin_counter_w(0,~data & 0x80); @@ -547,8 +547,8 @@ static MACHINE_RESET( pteacher_upd7807 ) static WRITE8_HANDLER( bankswitch_w ) { - UINT8 *rom = memory_region(REGION_CPU1); - int len = memory_region_length(REGION_CPU1) - 0x10000+0x4000; + UINT8 *rom = memory_region(machine, REGION_CPU1); + int len = memory_region_length(machine, REGION_CPU1) - 0x10000+0x4000; int offs = (data * 0x4000) & (len-1); /* last bank is fixed */ diff --git a/src/mame/drivers/hornet.c b/src/mame/drivers/hornet.c index fc19d58ae3b..63a6c13164c 100644 --- a/src/mame/drivers/hornet.c +++ b/src/mame/drivers/hornet.c @@ -702,7 +702,7 @@ static WRITE32_HANDLER( comm1_w ) static WRITE32_HANDLER( comm_rombank_w ) { int bank = data >> 24; - UINT8 *usr3 = memory_region(REGION_USER3); + UINT8 *usr3 = memory_region(machine, REGION_USER3); if (usr3) if( bank != comm_rombank ) { printf("rombank %02X\n", bank); @@ -933,8 +933,8 @@ static MACHINE_START( hornet ) static MACHINE_RESET( hornet ) { - UINT8 *usr3 = memory_region(REGION_USER3); - UINT8 *usr5 = memory_region(REGION_USER5); + UINT8 *usr3 = memory_region(machine, REGION_USER3); + UINT8 *usr5 = memory_region(machine, REGION_USER5); if (usr3) memory_set_bankptr(1, usr3); cpunum_set_input_line(machine, 2, INPUT_LINE_RESET, ASSERT_LINE); @@ -990,8 +990,8 @@ MACHINE_DRIVER_END static MACHINE_RESET( hornet_2board ) { - UINT8 *usr3 = memory_region(REGION_USER3); - UINT8 *usr5 = memory_region(REGION_USER5); + UINT8 *usr3 = memory_region(machine, REGION_USER3); + UINT8 *usr5 = memory_region(machine, REGION_USER5); if (usr3) memory_set_bankptr(1, usr3); @@ -1212,7 +1212,7 @@ static UINT8 backup_ram[0x2000]; static void init_hornet(running_machine *machine) { init_konami_cgboard(1, CGBOARD_TYPE_HORNET); - set_cgboard_texture_bank(0, 5, memory_region(REGION_USER5)); + set_cgboard_texture_bank(0, 5, memory_region(machine, REGION_USER5)); sharc_dataram[0] = auto_malloc(0x100000); @@ -1227,8 +1227,8 @@ static void init_hornet(running_machine *machine) static void init_hornet_2board(running_machine *machine) { init_konami_cgboard(2, CGBOARD_TYPE_HORNET); - set_cgboard_texture_bank(0, 5, memory_region(REGION_USER5)); - set_cgboard_texture_bank(1, 6, memory_region(REGION_USER5)); + set_cgboard_texture_bank(0, 5, memory_region(machine, REGION_USER5)); + set_cgboard_texture_bank(1, 6, memory_region(machine, REGION_USER5)); sharc_dataram[0] = auto_malloc(0x100000); sharc_dataram[1] = auto_malloc(0x100000); diff --git a/src/mame/drivers/hshavoc.c b/src/mame/drivers/hshavoc.c index 9166a32a89c..2bc73d473f4 100644 --- a/src/mame/drivers/hshavoc.c +++ b/src/mame/drivers/hshavoc.c @@ -208,7 +208,7 @@ static DRIVER_INIT(genesis) /* hack -- fix vdp emulation instead */ memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xC00004, 0xC00005, 0, 0, vdp_fake_r); - memory_set_bankptr(3, memory_region(REGION_CPU1) ); + memory_set_bankptr(3, memory_region(machine, REGION_CPU1) ); memory_set_bankptr(4, genesis_68k_ram ); } @@ -216,7 +216,7 @@ static DRIVER_INIT(hshavoc) { int x; - UINT16 *src = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *src = (UINT16 *)memory_region(machine, REGION_CPU1); static const UINT16 typedat[16] = { 1,1,1,1, 1,1,1,1, diff --git a/src/mame/drivers/hyperspt.c b/src/mame/drivers/hyperspt.c index 801212901e2..03f6fd9deec 100644 --- a/src/mame/drivers/hyperspt.c +++ b/src/mame/drivers/hyperspt.c @@ -591,7 +591,7 @@ ROM_END static DRIVER_INIT( hyperspt ) { - konami1_decode(0); + konami1_decode(machine, 0); } diff --git a/src/mame/drivers/hyprduel.c b/src/mame/drivers/hyprduel.c index da493ce55e6..d15dc390132 100644 --- a/src/mame/drivers/hyprduel.c +++ b/src/mame/drivers/hyprduel.c @@ -244,8 +244,8 @@ static READ16_HANDLER( hyprduel_bankedrom_r ) { const int region = REGION_GFX1; - UINT8 *ROM = memory_region( region ); - size_t len = memory_region_length( region ); + UINT8 *ROM = memory_region( machine, region ); + size_t len = memory_region_length( machine, region ); offset = offset * 2 + 0x10000 * (*hyprduel_rombank); @@ -330,8 +330,8 @@ static WRITE16_HANDLER( hyprduel_blitter_w ) { const int region = REGION_GFX1; - UINT8 *src = memory_region(region); - size_t src_len = memory_region_length(region); + UINT8 *src = memory_region(machine, region); + size_t src_len = memory_region_length(machine, region); UINT32 tmap = (hyprduel_blitter_regs[ 0x00 / 2 ] << 16 ) + hyprduel_blitter_regs[ 0x02 / 2 ]; @@ -802,8 +802,8 @@ MACHINE_DRIVER_END static DRIVER_INIT( hyprduel ) { - int i, len = memory_region_length(REGION_GFX1); - UINT8 *ROM = memory_region(REGION_GFX1); + int i, len = memory_region_length(machine, REGION_GFX1); + UINT8 *ROM = memory_region(machine, REGION_GFX1); /* Tiles can be either 4-bit or 8-bit, and both depths can be used at the same diff --git a/src/mame/drivers/igs_180.c b/src/mame/drivers/igs_180.c index 0cbb138be98..aca84e80c6d 100644 --- a/src/mame/drivers/igs_180.c +++ b/src/mame/drivers/igs_180.c @@ -77,10 +77,10 @@ static int sprites_gfx_size; // Eeach 16 bit word in the sprites gfx roms contains three 5 bit pens: x-22222-11111-00000. // This routine expands each word into three bytes. -static void expand_sprites(void) +static void expand_sprites(running_machine *machine) { - UINT8 *rom = memory_region(REGION_GFX1); - int size = memory_region_length(REGION_GFX1); + UINT8 *rom = memory_region(machine, REGION_GFX1); + int size = memory_region_length(machine, REGION_GFX1); int i; sprites_gfx_size = size / 2 * 3; @@ -264,8 +264,8 @@ static VIDEO_UPDATE(igs_180) static void decrypt_program_rom(int mask, int a7, int a6, int a5, int a4, int a3, int a2, int a1, int a0) { - int length = memory_region_length(REGION_CPU1); - UINT8 *rom = memory_region(REGION_CPU1); + int length = memory_region_length(Machine, REGION_CPU1); + UINT8 *rom = memory_region(Machine, REGION_CPU1); UINT8 *tmp = auto_malloc(length); int i; @@ -315,9 +315,9 @@ static void decrypt_program_rom(int mask, int a7, int a6, int a5, int a4, int a3 // iqblocka -static void iqblocka_patch_rom(void) +static void iqblocka_patch_rom(running_machine *machine) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); // rom[0x7b64] = 0xc9; @@ -343,9 +343,9 @@ static void iqblocka_patch_rom(void) static DRIVER_INIT( iqblocka ) { decrypt_program_rom(0x11, 7, 6, 5, 4, 3, 2, 1, 0); - iqblocka_patch_rom(); + iqblocka_patch_rom(machine); - expand_sprites(); + expand_sprites(machine); } // iqblockf @@ -353,17 +353,17 @@ static DRIVER_INIT( iqblocka ) static DRIVER_INIT( iqblockf ) { decrypt_program_rom(0x11, 7, 6, 5, 4, 3, 2, 1, 0); -// iqblockf_patch_rom(); +// iqblockf_patch_rom(machine); - expand_sprites(); + expand_sprites(machine); } // tjsb -static void tjsb_decrypt_sprites(void) +static void tjsb_decrypt_sprites(running_machine *machine) { - int length = memory_region_length(REGION_GFX1); - UINT8 *rom = memory_region(REGION_GFX1); + int length = memory_region_length(machine, REGION_GFX1); + UINT8 *rom = memory_region(machine, REGION_GFX1); UINT8 *tmp = auto_malloc(length); int i; @@ -390,19 +390,19 @@ static void tjsb_decrypt_sprites(void) } } -static void tjsb_patch_rom(void) +static void tjsb_patch_rom(running_machine *machine) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); rom[0x011df] = 0x18; } static DRIVER_INIT( tjsb ) { decrypt_program_rom(0x05, 7, 6, 3, 2, 5, 4, 1, 0); - tjsb_patch_rom(); + tjsb_patch_rom(machine); - tjsb_decrypt_sprites(); - expand_sprites(); + tjsb_decrypt_sprites(machine); + expand_sprites(machine); } /*************************************************************************** diff --git a/src/mame/drivers/igs_blit.c b/src/mame/drivers/igs_blit.c index 8f1b5ab61fe..5adc906ab4d 100644 --- a/src/mame/drivers/igs_blit.c +++ b/src/mame/drivers/igs_blit.c @@ -211,10 +211,10 @@ static WRITE16_HANDLER( igs_blit_flags_w ) UINT8 trans_pen, clear_pen, pen_hi, *dest; UINT8 pen = 0; - UINT8 *gfx = memory_region(REGION_GFX1); - UINT8 *gfx2 = memory_region(REGION_GFX2); - int gfx_size = memory_region_length(REGION_GFX1); - int gfx2_size = memory_region_length(REGION_GFX2); + UINT8 *gfx = memory_region(machine, REGION_GFX1); + UINT8 *gfx2 = memory_region(machine, REGION_GFX2); + int gfx_size = memory_region_length(machine, REGION_GFX1); + int gfx2_size = memory_region_length(machine, REGION_GFX2); const rectangle *clip = video_screen_get_visible_area(machine->primary_screen); @@ -369,10 +369,10 @@ static WRITE16_HANDLER( igs_palette_w ) ***************************************************************************/ -static void grtwall_decrypt(void) +static void grtwall_decrypt(running_machine *machine) { int i; - UINT16 *src = (UINT16 *) (memory_region(REGION_CPU1)); + UINT16 *src = (UINT16 *) (memory_region(machine, REGION_CPU1)); int rom_size = 0x80000; @@ -393,10 +393,10 @@ static void grtwall_decrypt(void) } -static void lhb_decrypt(void) +static void lhb_decrypt(running_machine *machine) { int i; - UINT16 *src = (UINT16 *) (memory_region(REGION_CPU1)); + UINT16 *src = (UINT16 *) (memory_region(machine, REGION_CPU1)); int rom_size = 0x80000; @@ -418,10 +418,10 @@ static void lhb_decrypt(void) } -static void chindrag_decrypt(void) +static void chindrag_decrypt(running_machine *machine) { int i; - UINT16 *src = (UINT16 *) (memory_region(REGION_CPU1)); + UINT16 *src = (UINT16 *) (memory_region(machine, REGION_CPU1)); int rom_size = 0x80000; @@ -447,10 +447,10 @@ static void chindrag_decrypt(void) } -static void drgnwrld_decrypt(void) +static void drgnwrld_decrypt(running_machine *machine) { int i; - UINT16 *src = (UINT16 *) (memory_region(REGION_CPU1)); + UINT16 *src = (UINT16 *) (memory_region(machine, REGION_CPU1)); int rom_size = 0x80000; @@ -476,11 +476,11 @@ static void drgnwrld_decrypt(void) } -static void chmplst2_decrypt(void) +static void chmplst2_decrypt(running_machine *machine) { int i,j; int rom_size = 0x80000; - UINT16 *src = (UINT16 *) (memory_region(REGION_CPU1)); + UINT16 *src = (UINT16 *) (memory_region(machine, REGION_CPU1)); UINT16 *result_data = malloc_or_die(rom_size); for (i=0; i<rom_size/2; i++) @@ -508,10 +508,10 @@ static void chmplst2_decrypt(void) -static void vbowlj_decrypt(void) +static void vbowlj_decrypt(running_machine *machine) { int i; - UINT16 *src = (UINT16 *) (memory_region(REGION_CPU1)); + UINT16 *src = (UINT16 *) (memory_region(machine, REGION_CPU1)); int rom_size = 0x80000; @@ -543,10 +543,10 @@ static void vbowlj_decrypt(void) // To do: #ifdef UNUSED_FUNCTION -void vbowl_decrypt(void) +void vbowl_decrypt(running_machine *machine) { int i; - UINT16 *src = (UINT16 *) (memory_region(REGION_CPU1)); + UINT16 *src = (UINT16 *) (memory_region(machine, REGION_CPU1)); int rom_size = 0x80000; @@ -576,11 +576,11 @@ void vbowl_decrypt(void) ***************************************************************************/ -static void chmplst2_decrypt_gfx(void) +static void chmplst2_decrypt_gfx(running_machine *machine) { int i; unsigned rom_size = 0x200000; - UINT8 *src = (UINT8 *) (memory_region(REGION_GFX1)); + UINT8 *src = (UINT8 *) (memory_region(machine, REGION_GFX1)); UINT8 *result_data = malloc_or_die(rom_size); for (i=0; i<rom_size; i++) @@ -591,11 +591,11 @@ static void chmplst2_decrypt_gfx(void) free(result_data); } -static void chindrag_gfx_decrypt(void) +static void chindrag_gfx_decrypt(running_machine *machine) { int i; unsigned rom_size = 0x400000; - UINT8 *src = (UINT8 *) (memory_region(REGION_GFX1)); + UINT8 *src = (UINT8 *) (memory_region(machine, REGION_GFX1)); UINT8 *result_data = malloc_or_die(rom_size); for (i=0; i<rom_size; i++) @@ -2504,10 +2504,10 @@ MACHINE_DRIVER_END static DRIVER_INIT( chmplst2 ) { - UINT16 *rom = (UINT16 *) memory_region(REGION_CPU1); + UINT16 *rom = (UINT16 *) memory_region(machine, REGION_CPU1); - chmplst2_decrypt(); - chmplst2_decrypt_gfx(); + chmplst2_decrypt(machine); + chmplst2_decrypt_gfx(machine); // PROTECTION CHECKS rom[0x034f4/2] = 0x4e71; // 0034F4: 660E bne 3504 (rom test, fills palette with white otherwise) @@ -2526,10 +2526,10 @@ static DRIVER_INIT( chmplst2 ) static DRIVER_INIT( chindrag ) { - UINT16 *rom = (UINT16 *) memory_region(REGION_CPU1); + UINT16 *rom = (UINT16 *) memory_region(machine, REGION_CPU1); - chindrag_decrypt(); - chindrag_gfx_decrypt(); + chindrag_decrypt(machine); + chindrag_gfx_decrypt(machine); // PROTECTION CHECKS rom[0x033d2/2] = 0x606c; // 0033D2: 676C beq 3440 (ASIC11 CHECK PORT ERROR 3) @@ -2552,10 +2552,10 @@ static DRIVER_INIT( chindrag ) static DRIVER_INIT( chugokur ) { - UINT16 *rom = (UINT16 *) memory_region(REGION_CPU1); + UINT16 *rom = (UINT16 *) memory_region(machine, REGION_CPU1); - chindrag_decrypt(); - chindrag_gfx_decrypt(); + chindrag_decrypt(machine); + chindrag_gfx_decrypt(machine); // PROTECTION CHECKS rom[0x033d2/2] = 0x606c; // 0033D2: 676C beq 3440 (ASIC11 CHECK PORT ERROR 3) @@ -2579,10 +2579,10 @@ static DRIVER_INIT( chugokur ) static DRIVER_INIT( drgnwrld ) { - UINT16 *rom = (UINT16 *) memory_region(REGION_CPU1); + UINT16 *rom = (UINT16 *) memory_region(machine, REGION_CPU1); - drgnwrld_decrypt(); - chindrag_gfx_decrypt(); + drgnwrld_decrypt(machine); + chindrag_gfx_decrypt(machine); // PROTECTION CHECKS rom[0x032ee/2] = 0x606c; // 0032EE: 676C beq 335c (ASIC11 CHECK PORT ERROR 3) @@ -2602,9 +2602,9 @@ static DRIVER_INIT( drgnwrld ) static DRIVER_INIT( grtwall ) { - UINT16 *rom = (UINT16 *) memory_region(REGION_CPU1); + UINT16 *rom = (UINT16 *) memory_region(machine, REGION_CPU1); - grtwall_decrypt(); + grtwall_decrypt(machine); // PROTECTION CHECKS rom[0x16b96/2] = 0x6000; // 016B96: 6700 02FE beq 16e96 (fills palette with red otherwise) @@ -2624,9 +2624,9 @@ static DRIVER_INIT( grtwall ) static DRIVER_INIT( lhb ) { - UINT16 *rom = (UINT16 *) memory_region(REGION_CPU1); + UINT16 *rom = (UINT16 *) memory_region(machine, REGION_CPU1); - lhb_decrypt(); + lhb_decrypt(machine); // PROTECTION CHECKS rom[0x2eef6/2] = 0x4e75; // 02EEF6: 4E56 FE00 link A6, #-$200 (fills palette with pink otherwise) @@ -2637,11 +2637,11 @@ static DRIVER_INIT( lhb ) static DRIVER_INIT( vbowl ) { - UINT16 *rom = (UINT16 *) memory_region(REGION_CPU1); - UINT8 *gfx = (UINT8 *) memory_region(REGION_GFX1); + UINT16 *rom = (UINT16 *) memory_region(machine, REGION_CPU1); + UINT8 *gfx = (UINT8 *) memory_region(machine, REGION_GFX1); int i; - vbowlj_decrypt(); + vbowlj_decrypt(machine); for (i = 0x400000-1; i >= 0; i--) { @@ -2655,11 +2655,11 @@ static DRIVER_INIT( vbowl ) static DRIVER_INIT( vbowlj ) { - UINT16 *rom = (UINT16 *) memory_region(REGION_CPU1); - UINT8 *gfx = (UINT8 *) memory_region(REGION_GFX1); + UINT16 *rom = (UINT16 *) memory_region(machine, REGION_CPU1); + UINT8 *gfx = (UINT8 *) memory_region(machine, REGION_GFX1); int i; - vbowlj_decrypt(); + vbowlj_decrypt(machine); for (i = 0x400000-1; i >= 0; i--) { @@ -2675,9 +2675,9 @@ static DRIVER_INIT( vbowlj ) static DRIVER_INIT( xymg ) { - UINT16 *rom = (UINT16 *) memory_region(REGION_CPU1); + UINT16 *rom = (UINT16 *) memory_region(machine, REGION_CPU1); - lhb_decrypt(); + lhb_decrypt(machine); // PROTECTION CHECKS rom[0x00502/2] = 0x6006; // 000502: 6050 bra 554 diff --git a/src/mame/drivers/igs_m027.c b/src/mame/drivers/igs_m027.c index 3d2ba9c89f0..45d13826d00 100644 --- a/src/mame/drivers/igs_m027.c +++ b/src/mame/drivers/igs_m027.c @@ -218,11 +218,11 @@ static const UINT8 sdwx_tab[] = 0x12,0x56,0x97,0x26,0x1D,0x5F,0xA7,0xF8,0x89,0x3F,0x14,0x36,0x72,0x3B,0x48,0x7B, 0xF1,0xED,0x72,0xB7,0x7A,0x56,0x05,0xDE,0x7B,0x27,0x6D,0xCF,0x33,0x4C,0x14,0x86, }; -static void sdwx_decrypt(void) +static void sdwx_decrypt(running_machine *machine) { int i; - UINT16 *src = (UINT16 *) memory_region(REGION_USER1); + UINT16 *src = (UINT16 *) memory_region(machine, REGION_USER1); int rom_size = 0x80000; @@ -263,11 +263,11 @@ static void sdwx_decrypt(void) -static void sdwx_gfx_decrypt(void) +static void sdwx_gfx_decrypt(running_machine *machine) { int i; unsigned rom_size = 0x80000; - UINT8 *src = (UINT8 *) (memory_region(REGION_GFX1)); + UINT8 *src = (UINT8 *) (memory_region(machine, REGION_GFX1)); UINT8 *result_data = malloc_or_die(rom_size); for (i=0; i<rom_size; i++) @@ -395,8 +395,8 @@ MACHINE_DRIVER_END static DRIVER_INIT( sdwx ) { - sdwx_decrypt(); - sdwx_gfx_decrypt(); + sdwx_decrypt(machine); + sdwx_gfx_decrypt(machine); logerror("init OK!\n"); } diff --git a/src/mame/drivers/intrscti.c b/src/mame/drivers/intrscti.c index 45e98f01062..b80008c3262 100644 --- a/src/mame/drivers/intrscti.c +++ b/src/mame/drivers/intrscti.c @@ -126,7 +126,7 @@ ROM_END static DRIVER_INIT( intrscti ) { - UINT8 *cpu = memory_region( REGION_CPU1 ); + UINT8 *cpu = memory_region( machine, REGION_CPU1 ); int i; for (i=0x8000;i<0x8fff;i++) { diff --git a/src/mame/drivers/inufuku.c b/src/mame/drivers/inufuku.c index 8a48ed8f399..12fc4674246 100644 --- a/src/mame/drivers/inufuku.c +++ b/src/mame/drivers/inufuku.c @@ -120,7 +120,7 @@ static WRITE8_HANDLER( pending_command_clear_w ) static WRITE8_HANDLER( inufuku_soundrombank_w ) { - UINT8 *ROM = memory_region(REGION_CPU2) + 0x10000; + UINT8 *ROM = memory_region(machine, REGION_CPU2) + 0x10000; memory_set_bankptr(1, ROM + (data & 0x03) * 0x8000); } diff --git a/src/mame/drivers/iqblock.c b/src/mame/drivers/iqblock.c index 0cf16048953..dcae42f5f19 100644 --- a/src/mame/drivers/iqblock.c +++ b/src/mame/drivers/iqblock.c @@ -94,7 +94,7 @@ static READ8_HANDLER( iqblock_irqack_r ) static READ8_HANDLER( extrarom_r ) { - return memory_region(REGION_USER1)[offset]; + return memory_region(machine, REGION_USER1)[offset]; } @@ -503,7 +503,7 @@ ROM_END static DRIVER_INIT( iqblock ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); int i; /* decrypt the program ROM */ @@ -525,7 +525,7 @@ static DRIVER_INIT( iqblock ) static DRIVER_INIT( grndtour ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); int i; /* decrypt the program ROM */ @@ -548,7 +548,7 @@ static DRIVER_INIT( grndtour ) static DRIVER_INIT( cabaret ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); int i; /* decrypt the program ROM */ @@ -567,7 +567,7 @@ static DRIVER_INIT( cabaret ) static DRIVER_INIT( pokerigs ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); int i; /* decrypt the program ROM */ diff --git a/src/mame/drivers/itech32.c b/src/mame/drivers/itech32.c index 20b394e7d96..d3ac38c8a8f 100644 --- a/src/mame/drivers/itech32.c +++ b/src/mame/drivers/itech32.c @@ -522,7 +522,7 @@ static READ32_HANDLER( gtclass_prot_result_r ) static WRITE8_HANDLER( sound_bank_w ) { - memory_set_bankptr(1, &memory_region(REGION_CPU2)[0x10000 + data * 0x4000]); + memory_set_bankptr(1, &memory_region(machine, REGION_CPU2)[0x10000 + data * 0x4000]); } diff --git a/src/mame/drivers/itech8.c b/src/mame/drivers/itech8.c index 4798d701a56..196b1fb0c6f 100644 --- a/src/mame/drivers/itech8.c +++ b/src/mame/drivers/itech8.c @@ -628,7 +628,7 @@ static MACHINE_RESET( itech8 ) { /* make sure bank 0 is selected */ if (machine->config->cpu[0].type == CPU_M6809) - memory_set_bankptr(1, &memory_region(REGION_CPU1)[0x4000]); + memory_set_bankptr(1, &memory_region(machine, REGION_CPU1)[0x4000]); /* reset the PIA (if used) */ pia_reset(); @@ -688,7 +688,7 @@ static WRITE8_HANDLER( blitter_w ) { /* bit 0x20 on address 7 controls CPU banking */ if (offset / 2 == 7) - memory_set_bankptr(1, &memory_region(REGION_CPU1)[0x4000 + 0xc000 * ((data >> 5) & 1)]); + memory_set_bankptr(1, &memory_region(machine, REGION_CPU1)[0x4000 + 0xc000 * ((data >> 5) & 1)]); /* the rest is handled by the video hardware */ itech8_blitter_w(machine, offset, data); @@ -698,7 +698,7 @@ static WRITE8_HANDLER( blitter_w ) static WRITE8_HANDLER( rimrockn_bank_w ) { /* banking is controlled here instead of by the blitter output */ - memory_set_bankptr(1, &memory_region(REGION_CPU1)[0x4000 + 0xc000 * (data & 3)]); + memory_set_bankptr(1, &memory_region(machine, REGION_CPU1)[0x4000 + 0xc000 * (data & 3)]); } diff --git a/src/mame/drivers/jack.c b/src/mame/drivers/jack.c index e575f7df1a3..72585481409 100644 --- a/src/mame/drivers/jack.c +++ b/src/mame/drivers/jack.c @@ -121,7 +121,7 @@ static READ8_HANDLER( striv_question_r ) // Read the actual byte from question roms else { - UINT8 *ROM = memory_region(REGION_USER1); + UINT8 *ROM = memory_region(machine, REGION_USER1); int real_address; real_address = question_address | (offset & 0x3f0) | remap_address[offset & 0x0f]; @@ -1356,7 +1356,7 @@ ROM_END static void treahunt_decode(void) { int A; - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(Machine, REGION_CPU1); UINT8 *decrypt = auto_malloc(0x4000); int data; @@ -1420,7 +1420,7 @@ static DRIVER_INIT( loverboy ) the start of the game code. ToDo: Figure out what's really going on */ - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); ROM[0x13] = 0x01; ROM[0x12] = 0x9d; @@ -1430,7 +1430,7 @@ static DRIVER_INIT( loverboy ) static DRIVER_INIT( striv ) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); UINT8 data; int A; diff --git a/src/mame/drivers/jailbrek.c b/src/mame/drivers/jailbrek.c index 9488845d4ce..000eacc422e 100644 --- a/src/mame/drivers/jailbrek.c +++ b/src/mame/drivers/jailbrek.c @@ -392,7 +392,7 @@ ROM_END static DRIVER_INIT( jailbrek ) { - UINT8 *SPEECH_ROM = memory_region(REGION_SOUND1); + UINT8 *SPEECH_ROM = memory_region(machine, REGION_SOUND1); int nIndex; /* @@ -404,7 +404,7 @@ static DRIVER_INIT( jailbrek ) represents address line A13.) */ - if (memory_region_length(REGION_SOUND1) == 0x4000) + if (memory_region_length(machine, REGION_SOUND1) == 0x4000) { for (nIndex = 0; nIndex < 0x2000; ++nIndex) { @@ -412,7 +412,7 @@ static DRIVER_INIT( jailbrek ) } } - konami1_decode(0); + konami1_decode(machine, 0); } GAME( 1986, jailbrek, 0, jailbrek, jailbrek, jailbrek, ROT0, "Konami", "Jail Break", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/jalmah.c b/src/mame/drivers/jalmah.c index 709b16cee27..48e7edffd55 100644 --- a/src/mame/drivers/jalmah.c +++ b/src/mame/drivers/jalmah.c @@ -493,7 +493,7 @@ static WRITE16_HANDLER( jalmah_okirom_w ) { if(ACCESSING_BITS_0_7) { - UINT8 *oki = memory_region(REGION_SOUND1); + UINT8 *oki = memory_region(machine, REGION_SOUND1); oki_rom = data & 1; memcpy(&oki[0x20000], &oki[(oki_rom * 0x80000) + (oki_bank * 0x20000) + 0x40000], 0x20000); } @@ -507,7 +507,7 @@ static WRITE16_HANDLER( jalmah_okibank_w ) { if(ACCESSING_BITS_0_7) { - UINT8 *oki = memory_region(REGION_SOUND1); + UINT8 *oki = memory_region(machine, REGION_SOUND1); oki_bank = data & 3; memcpy(&oki[0x20000], &oki[(oki_rom * 0x80000) + (oki_bank * 0x20000) + 0x40000], 0x20000); } diff --git a/src/mame/drivers/jedi.c b/src/mame/drivers/jedi.c index b4108aad95f..e0beb6d5011 100644 --- a/src/mame/drivers/jedi.c +++ b/src/mame/drivers/jedi.c @@ -161,7 +161,7 @@ static MACHINE_START( jedi ) timer_adjust_oneshot(state->interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, 32, 0), 32); /* configure the banks */ - memory_configure_bank(1, 0, 3, memory_region(REGION_CPU1) + 0x10000, 0x4000); + memory_configure_bank(1, 0, 3, memory_region(machine, REGION_CPU1) + 0x10000, 0x4000); /* set up save state */ state_save_register_global(state->nvram_enabled); diff --git a/src/mame/drivers/jongkyo.c b/src/mame/drivers/jongkyo.c index fea9257cfd4..d16083e6c46 100644 --- a/src/mame/drivers/jongkyo.c +++ b/src/mame/drivers/jongkyo.c @@ -565,7 +565,7 @@ INPUT_PORTS_END static PALETTE_INIT(jongkyo) { int i; - UINT8* proms = memory_region(REGION_PROMS); + UINT8* proms = memory_region(machine, REGION_PROMS); for (i=0;i<0x40;i++) { int data = proms[i]; @@ -639,7 +639,7 @@ ROM_END static DRIVER_INIT( jongkyo ) { int i; - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); /* first of all, do a simple bitswap */ for (i = 0x6000; i < 0x9000; ++i) @@ -648,7 +648,7 @@ static DRIVER_INIT( jongkyo ) } /* then do the standard Sega decryption */ - jongkyo_decode(); + jongkyo_decode(machine); videoram2 = auto_malloc(0x4000); state_save_register_global_pointer(videoram2, 0x4000); diff --git a/src/mame/drivers/jrpacman.c b/src/mame/drivers/jrpacman.c index 3d77f80f74d..e2621428dbc 100644 --- a/src/mame/drivers/jrpacman.c +++ b/src/mame/drivers/jrpacman.c @@ -368,7 +368,7 @@ static DRIVER_INIT( jrpacman ) { 0,0 } }; - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); int i, j, A; for (i = A = 0; table[i].count; i++) diff --git a/src/mame/drivers/junofrst.c b/src/mame/drivers/junofrst.c index 8b591805d26..74f5a61ff72 100644 --- a/src/mame/drivers/junofrst.c +++ b/src/mame/drivers/junofrst.c @@ -434,10 +434,10 @@ ROM_END static DRIVER_INIT( junofrst ) { - UINT8 *decrypt = konami1_decode(0); + UINT8 *decrypted = konami1_decode(machine, 0); - memory_configure_bank(1, 0, 16, memory_region(REGION_CPU1) + 0x10000, 0x1000); - memory_configure_bank_decrypted(1, 0, 16, decrypt + 0x10000, 0x1000); + memory_configure_bank(1, 0, 16, memory_region(machine, REGION_CPU1) + 0x10000, 0x1000); + memory_configure_bank_decrypted(1, 0, 16, decrypted + 0x10000, 0x1000); } diff --git a/src/mame/drivers/kaneko16.c b/src/mame/drivers/kaneko16.c index 5b95d9c4f3d..5e224e43ca5 100644 --- a/src/mame/drivers/kaneko16.c +++ b/src/mame/drivers/kaneko16.c @@ -842,7 +842,7 @@ ADDRESS_MAP_END #if 0 static WRITE8_HANDLER( blazeon_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); int bank = data & 7; memory_set_bankptr(15, &RAM[bank * 0x10000 + 0x1000]); } @@ -2043,10 +2043,10 @@ MACHINE_DRIVER_END have the even and odd pixels swapped. So we use this function to untangle them and have one single gfxlayout for both tiles and sprites. */ -static void kaneko16_unscramble_tiles(int region) +static void kaneko16_unscramble_tiles(running_machine *machine, int region) { - UINT8 *RAM = memory_region(region); - int size = memory_region_length(region); + UINT8 *RAM = memory_region(machine, region); + int size = memory_region_length(machine, region); int i; if (RAM == NULL) return; @@ -2057,7 +2057,7 @@ static void kaneko16_unscramble_tiles(int region) } } -static void kaneko16_expand_sample_banks(int region) +static void kaneko16_expand_sample_banks(running_machine *machine, int region) { /* The sample data for the first OKI has an address translator/ banking register in it that munges the addresses as follows: @@ -2071,11 +2071,11 @@ static void kaneko16_expand_sample_banks(int region) int bank; UINT8 *src0; - if (memory_region_length(region) < 0x40000 * 16) + if (memory_region_length(machine, region) < 0x40000 * 16) fatalerror("gtmr SOUND1 region too small"); /* bank 0 maps to itself, so we just leave it alone */ - src0 = memory_region(region); + src0 = memory_region(machine, region); for (bank = 15; bank > 0; bank--) { UINT8 *srcn = src0 + 0x10000 * (bank < 3 ? 3 : bank); @@ -2088,20 +2088,20 @@ static void kaneko16_expand_sample_banks(int region) static DRIVER_INIT( kaneko16 ) { - kaneko16_unscramble_tiles(REGION_GFX2); - kaneko16_unscramble_tiles(REGION_GFX3); + kaneko16_unscramble_tiles(machine, REGION_GFX2); + kaneko16_unscramble_tiles(machine, REGION_GFX3); } static DRIVER_INIT( berlwall ) { - kaneko16_unscramble_tiles(REGION_GFX2); + kaneko16_unscramble_tiles(machine, REGION_GFX2); } static DRIVER_INIT( samplebank ) { - kaneko16_unscramble_tiles(REGION_GFX2); - kaneko16_unscramble_tiles(REGION_GFX3); - kaneko16_expand_sample_banks(REGION_SOUND1); + kaneko16_unscramble_tiles(machine, REGION_GFX2); + kaneko16_unscramble_tiles(machine, REGION_GFX3); + kaneko16_expand_sample_banks(machine, REGION_SOUND1); } diff --git a/src/mame/drivers/kangaroo.c b/src/mame/drivers/kangaroo.c index dfaa5680852..facd2d95849 100644 --- a/src/mame/drivers/kangaroo.c +++ b/src/mame/drivers/kangaroo.c @@ -108,7 +108,7 @@ static UINT8 kangaroo_clock; static MACHINE_START( kangaroo ) { - memory_configure_bank(1, 0, 2, memory_region(REGION_GFX1), 0x2000); + memory_configure_bank(1, 0, 2, memory_region(machine, REGION_GFX1), 0x2000); state_save_register_global(kangaroo_clock); } diff --git a/src/mame/drivers/karnov.c b/src/mame/drivers/karnov.c index 093fb821e96..9cf723f5336 100644 --- a/src/mame/drivers/karnov.c +++ b/src/mame/drivers/karnov.c @@ -998,7 +998,7 @@ static DRIVER_INIT( wndrplnt ) static DRIVER_INIT( chelnov ) { - UINT16 *RAM = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *RAM = (UINT16 *)memory_region(machine, REGION_CPU1); microcontroller_id=CHELNOV; coin_mask=0xe0; @@ -1008,7 +1008,7 @@ static DRIVER_INIT( chelnov ) static DRIVER_INIT( chelnovw ) { - UINT16 *RAM = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *RAM = (UINT16 *)memory_region(machine, REGION_CPU1); microcontroller_id=CHELNOVW; coin_mask=0xe0; @@ -1018,7 +1018,7 @@ static DRIVER_INIT( chelnovw ) static DRIVER_INIT( chelnovj ) { - UINT16 *RAM = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *RAM = (UINT16 *)memory_region(machine, REGION_CPU1); microcontroller_id=CHELNOVJ; coin_mask=0xe0; diff --git a/src/mame/drivers/kchamp.c b/src/mame/drivers/kchamp.c index d747bbf1951..c3d50183a4a 100644 --- a/src/mame/drivers/kchamp.c +++ b/src/mame/drivers/kchamp.c @@ -707,7 +707,7 @@ ROM_END static DRIVER_INIT( kchampvs ) { UINT8 *decrypted = auto_malloc(0x10000); - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); int A; memory_set_decrypted_region(0, 0x0000, 0xffff, decrypted); diff --git a/src/mame/drivers/kickgoal.c b/src/mame/drivers/kickgoal.c index a555032a9d7..0c5d317a20d 100644 --- a/src/mame/drivers/kickgoal.c +++ b/src/mame/drivers/kickgoal.c @@ -798,7 +798,7 @@ ROM_END static DRIVER_INIT( kickgoal ) { #if 0 /* we should find a real fix instead */ - UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *rom = (UINT16 *)memory_region(machine, REGION_CPU1); /* fix "bug" that prevents game from writing to EEPROM */ rom[0x12b0/2] = 0x0001; diff --git a/src/mame/drivers/kingobox.c b/src/mame/drivers/kingobox.c index 4ec34ce9220..81e1b846075 100644 --- a/src/mame/drivers/kingobox.c +++ b/src/mame/drivers/kingobox.c @@ -865,7 +865,7 @@ ROM_END static DRIVER_INIT( ringkin3 ) { int i; - UINT8 *RAM = memory_region(REGION_PROMS); + UINT8 *RAM = memory_region(machine, REGION_PROMS); /* expand the first color PROM to look like the kingofb ones... */ for (i = 0;i < 0x100;i++) @@ -875,8 +875,8 @@ static DRIVER_INIT( ringkin3 ) static DRIVER_INIT( ringkinw ) { int i,j,k; - UINT8 *PROMS = memory_region(REGION_PROMS); - UINT8 *USER1 = memory_region(REGION_USER1); + UINT8 *PROMS = memory_region(machine, REGION_PROMS); + UINT8 *USER1 = memory_region(machine, REGION_USER1); /* change the PROMs encode in a simple format to use kingofb decode */ for(i=0,j=0; j < 0x40; i++,j++) diff --git a/src/mame/drivers/kingpin.c b/src/mame/drivers/kingpin.c index 24cbae4b11c..293a83b713c 100644 --- a/src/mame/drivers/kingpin.c +++ b/src/mame/drivers/kingpin.c @@ -182,7 +182,7 @@ static DRIVER_INIT( kingpin ) TMS9928A_configure(&tms9928a_interface); /* Hacks to keep the emu a'runnin */ - code_base = memory_region(REGION_CPU1); + code_base = memory_region(machine, REGION_CPU1); code_base[0x17d4] = 0xc3; /* Maybe sound related? */ } diff --git a/src/mame/drivers/kinstb.c b/src/mame/drivers/kinstb.c index 56c24e2697d..96158f2bfbe 100644 --- a/src/mame/drivers/kinstb.c +++ b/src/mame/drivers/kinstb.c @@ -234,7 +234,7 @@ MACHINE_DRIVER_END static DRIVER_INIT(kinstb) { INT32 i; - UINT8 *rom = memory_region(REGION_USER3); + UINT8 *rom = memory_region(machine, REGION_USER3); for(i=0;i<0x400000;i++) { diff --git a/src/mame/drivers/konamigq.c b/src/mame/drivers/konamigq.c index 7a68a413fa8..4c23608d1b6 100644 --- a/src/mame/drivers/konamigq.c +++ b/src/mame/drivers/konamigq.c @@ -338,7 +338,7 @@ static DRIVER_INIT( konamigq ) { psx_driver_init(machine); - m_p_n_pcmram = memory_region( REGION_SOUND1 ) + 0x80000; + m_p_n_pcmram = memory_region( machine, REGION_SOUND1 ) + 0x80000; } static void konamigq_exit(running_machine *machine) diff --git a/src/mame/drivers/konamigv.c b/src/mame/drivers/konamigv.c index 377b8893352..4705c951700 100644 --- a/src/mame/drivers/konamigv.c +++ b/src/mame/drivers/konamigv.c @@ -150,7 +150,7 @@ static NVRAM_HANDLER( konamigv_93C46 ) } else { - eeprom_set_data( memory_region( REGION_USER2 ), memory_region_length( REGION_USER2 ) ); + eeprom_set_data( memory_region( machine, REGION_USER2 ), memory_region_length( machine, REGION_USER2 ) ); } } } diff --git a/src/mame/drivers/konamigx.c b/src/mame/drivers/konamigx.c index 5b22e79a4ca..746526626fd 100644 --- a/src/mame/drivers/konamigx.c +++ b/src/mame/drivers/konamigx.c @@ -928,14 +928,14 @@ static READ32_HANDLER( gx6bppspr_r ) static READ32_HANDLER( type1_roz_r1 ) { - UINT32 *ROM = (UINT32 *)memory_region(REGION_GFX3); + UINT32 *ROM = (UINT32 *)memory_region(machine, REGION_GFX3); return ROM[offset]; } static READ32_HANDLER( type1_roz_r2 ) { - UINT32 *ROM = (UINT32 *)memory_region(REGION_GFX3); + UINT32 *ROM = (UINT32 *)memory_region(machine, REGION_GFX3); ROM += (0x600000/2); @@ -3200,7 +3200,7 @@ static DRIVER_INIT(konamigx) case 2: // tkmmpzdm hack { - UINT32 *rom = (UINT32*)memory_region(REGION_CPU1); + UINT32 *rom = (UINT32*)memory_region(machine, REGION_CPU1); // The display is initialized after POST but the copyright screen disabled // planes B,C,D and didn't bother restoring them. I've spent a good diff --git a/src/mame/drivers/kopunch.c b/src/mame/drivers/kopunch.c index 64d014b8b7f..0677b09944d 100644 --- a/src/mame/drivers/kopunch.c +++ b/src/mame/drivers/kopunch.c @@ -222,7 +222,7 @@ ROM_END static DRIVER_INIT( kopunch ) { -// UINT8 *rom = memory_region(REGION_CPU1); +// UINT8 *rom = memory_region(machine, REGION_CPU1); /* It looks like there is a security chip, that changes instruction of the form: 0334: 3E 0C ld a,$0C diff --git a/src/mame/drivers/ksayakyu.c b/src/mame/drivers/ksayakyu.c index a83dd3ee6f4..548c0af12f5 100644 --- a/src/mame/drivers/ksayakyu.c +++ b/src/mame/drivers/ksayakyu.c @@ -85,7 +85,7 @@ static WRITE8_HANDLER( bank_select_w ) xxxxxxx - unused ? */ - memory_set_bankptr( 1, memory_region(REGION_CPU1) + ((data&1) * 0x4000) + 0x10000 ); + memory_set_bankptr( 1, memory_region(machine, REGION_CPU1) + ((data&1) * 0x4000) + 0x10000 ); } static WRITE8_HANDLER( latch_w ) diff --git a/src/mame/drivers/ksys573.c b/src/mame/drivers/ksys573.c index 92d4cf0d980..af067dfeb80 100644 --- a/src/mame/drivers/ksys573.c +++ b/src/mame/drivers/ksys573.c @@ -1325,7 +1325,7 @@ static ADDRESS_MAP_START( konami573_map, ADDRESS_SPACE_PROGRAM, 32 ) ADDRESS_MAP_END -static void flash_init( void ) +static void flash_init( running_machine *machine ) { int i; int chip; @@ -1354,7 +1354,7 @@ static void flash_init( void ) i = 0; while( flash_init[ i ].start != NULL ) { - data = memory_region( flash_init[ i ].region ); + data = memory_region( machine, flash_init[ i ].region ); if( data != NULL ) { size = 0; @@ -1365,7 +1365,7 @@ static void flash_init( void ) size += flash_init[ i ].size; flash_chips++; } - if( size != memory_region_length( flash_init[ i ].region ) ) + if( size != memory_region_length( machine, flash_init[ i ].region ) ) { fatalerror( "flash_init %d incorrect region length\n", i ); } @@ -1408,11 +1408,11 @@ static void *atapi_get_device(void) return ret; } -static void security_cart_init( int cart, int eeprom_region, int ds2401_region ) +static void security_cart_init( running_machine *machine, int cart, int eeprom_region, int ds2401_region ) { - UINT8 *eeprom_rom = memory_region( eeprom_region ); - int eeprom_length = memory_region_length( eeprom_region ); - UINT8 *ds2401_rom = memory_region( ds2401_region ); + UINT8 *eeprom_rom = memory_region( machine, eeprom_region ); + int eeprom_length = memory_region_length( machine, eeprom_region ); + UINT8 *ds2401_rom = memory_region( machine, ds2401_region ); if( eeprom_rom != NULL ) { @@ -1501,12 +1501,12 @@ static DRIVER_INIT( konami573 ) m_p_timer_root[i] = timer_alloc(root_finished, NULL); } - timekeeper_init( 0, TIMEKEEPER_M48T58, memory_region( REGION_USER11 ) ); + timekeeper_init( 0, TIMEKEEPER_M48T58, memory_region( machine, REGION_USER11 ) ); state_save_register_global( m_n_security_control ); - security_cart_init( 0, REGION_USER2, REGION_USER9 ); - security_cart_init( 1, REGION_USER8, REGION_USER10 ); + security_cart_init( machine, 0, REGION_USER2, REGION_USER9 ); + security_cart_init( machine, 1, REGION_USER8, REGION_USER10 ); state_save_register_item_array( "KSYS573", 0, m_p_n_root_count ); state_save_register_item_array( "KSYS573", 0, m_p_n_root_mode ); @@ -1514,7 +1514,7 @@ static DRIVER_INIT( konami573 ) state_save_register_item_array( "KSYS573", 0, m_p_n_root_start ); adc083x_init( 0, ADC0834, analogue_inputs_callback ); - flash_init(); + flash_init(machine); } static MACHINE_RESET( konami573 ) diff --git a/src/mame/drivers/labyrunr.c b/src/mame/drivers/labyrunr.c index e3ac8e5cdf1..102dee8fef3 100644 --- a/src/mame/drivers/labyrunr.c +++ b/src/mame/drivers/labyrunr.c @@ -40,7 +40,7 @@ static INTERRUPT_GEN( labyrunr_interrupt ) static WRITE8_HANDLER( labyrunr_bankswitch_w ) { int bankaddress; - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); if (data & 0xe0) popmessage("bankswitch %02x",data); diff --git a/src/mame/drivers/ladybug.c b/src/mame/drivers/ladybug.c index 86b9258daf9..810610fe2e3 100644 --- a/src/mame/drivers/ladybug.c +++ b/src/mame/drivers/ladybug.c @@ -951,8 +951,8 @@ static DRIVER_INIT( dorodon ) offs_t i; UINT8 *decrypted = auto_malloc(0x6000); - UINT8 *rom = memory_region(REGION_CPU1); - UINT8 *table = memory_region(REGION_USER1); + UINT8 *rom = memory_region(machine, REGION_CPU1); + UINT8 *table = memory_region(machine, REGION_USER1); memory_set_decrypted_region(0, 0x0000, 0x5fff, decrypted); diff --git a/src/mame/drivers/lastduel.c b/src/mame/drivers/lastduel.c index 4323d56b48b..eea91de11bf 100644 --- a/src/mame/drivers/lastduel.c +++ b/src/mame/drivers/lastduel.c @@ -124,7 +124,7 @@ ADDRESS_MAP_END static WRITE8_HANDLER( mg_bankswitch_w ) { int bankaddress; - UINT8 *RAM = memory_region(REGION_CPU2); + UINT8 *RAM = memory_region(machine, REGION_CPU2); bankaddress = 0x10000 + (data & 0x01) * 0x4000; memory_set_bankptr(3,&RAM[bankaddress]); diff --git a/src/mame/drivers/lastfght.c b/src/mame/drivers/lastfght.c index 64881a6e88f..fd0606e4ba4 100644 --- a/src/mame/drivers/lastfght.c +++ b/src/mame/drivers/lastfght.c @@ -92,7 +92,7 @@ static VIDEO_UPDATE( lastfght ) int x, y, count = 0; static unsigned base = 0; static int view_roms = 0; - UINT8 *gfxdata = memory_region( REGION_GFX1 ); + UINT8 *gfxdata = memory_region( screen->machine, REGION_GFX1 ); UINT8 data; if ( input_code_pressed_once(KEYCODE_ENTER) ) view_roms ^= 1; @@ -100,7 +100,7 @@ static VIDEO_UPDATE( lastfght ) { if ( input_code_pressed_once(KEYCODE_PGDN) ) base += 512 * 256; if ( input_code_pressed_once(KEYCODE_PGUP) ) base -= 512 * 256; - base %= memory_region_length( REGION_GFX1 ); + base %= memory_region_length( screen->machine, REGION_GFX1 ); count = base; @@ -257,7 +257,7 @@ static WRITE16_HANDLER( lastfght_blit_w ) if (ACCESSING_BITS_8_15) { int x,y, addr; - UINT8 *gfxdata = memory_region( REGION_GFX1 ); + UINT8 *gfxdata = memory_region( machine, REGION_GFX1 ); bitmap_t *dest = lastfght_bitmap[lastfght_dest]; #if 0 @@ -501,7 +501,7 @@ ROM_END static DRIVER_INIT(lastfght) { - UINT16 *rom = (UINT16*)memory_region(REGION_CPU1); + UINT16 *rom = (UINT16*)memory_region(machine, REGION_CPU1); // pass initial check (protection ? hw?) rom[0x00354/2] = 0x403e; diff --git a/src/mame/drivers/lazercmd.c b/src/mame/drivers/lazercmd.c index 303724eb1dc..0525d295b38 100644 --- a/src/mame/drivers/lazercmd.c +++ b/src/mame/drivers/lazercmd.c @@ -767,7 +767,7 @@ ROM_END static DRIVER_INIT( lazercmd ) { int i, y; -UINT8 *gfx = memory_region(REGION_GFX1); +UINT8 *gfx = memory_region(machine, REGION_GFX1); /****************************************************************** * To show the maze bit #6 and #7 of the video ram are used. @@ -796,7 +796,7 @@ UINT8 *gfx = memory_region(REGION_GFX1); static DRIVER_INIT( medlanes ) { int i, y; -UINT8 *gfx = memory_region(REGION_GFX1); +UINT8 *gfx = memory_region(machine, REGION_GFX1); /****************************************************************** * To show the maze bit #6 and #7 of the video ram are used. @@ -825,7 +825,7 @@ UINT8 *gfx = memory_region(REGION_GFX1); static DRIVER_INIT( bbonk ) { int i, y; -UINT8 *gfx = memory_region(REGION_GFX1); +UINT8 *gfx = memory_region(machine, REGION_GFX1); /****************************************************************** * To show the maze bit #6 and #7 of the video ram are used. diff --git a/src/mame/drivers/legionna.c b/src/mame/drivers/legionna.c index 405c01d33c8..3250aade88a 100644 --- a/src/mame/drivers/legionna.c +++ b/src/mame/drivers/legionna.c @@ -2038,7 +2038,7 @@ ROM_END static DRIVER_INIT( cupsoc ) { #if CUPSOC_DEBUG_MODE - UINT16 *ROM = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *ROM = (UINT16 *)memory_region(machine, REGION_CPU1); /*Press p1 button 3 to enter into debug mode during gameplay*/ ROM[0xffffb/2] = 0x0000; @@ -2049,13 +2049,13 @@ static DRIVER_INIT( cupsoc ) static DRIVER_INIT( denjinmk ) { /* problem with audio comms? */ - UINT16 *ROM = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *ROM = (UINT16 *)memory_region(machine, REGION_CPU1); ROM[0x5fe4/2] = 0x4e71; } static DRIVER_INIT( legiongfx ) { - descramble_legionnaire_gfx( memory_region(REGION_GFX5) ); + descramble_legionnaire_gfx( memory_region(machine, REGION_GFX5) ); } diff --git a/src/mame/drivers/leland.c b/src/mame/drivers/leland.c index 1b833e14ebb..eb2ea65c5d4 100644 --- a/src/mame/drivers/leland.c +++ b/src/mame/drivers/leland.c @@ -1853,7 +1853,7 @@ ROM_END /* Copy this code into the init function and modify: { - UINT8 *ram = memory_region(REGION_CPU1); + UINT8 *ram = memory_region(machine, REGION_CPU1); FILE *output; output = fopen("indyheat.m", "w"); @@ -1943,9 +1943,9 @@ static DRIVER_INIT( cerberus ) /* master CPU bankswitching */ leland_update_master_bank = cerberus_bankswitch; - memory_set_bankptr(1, memory_region(REGION_CPU1) + 0x2000); - memory_set_bankptr(2, memory_region(REGION_CPU1) + 0xa000); - memory_set_bankptr(3, memory_region(REGION_CPU2) + 0x2000); + memory_set_bankptr(1, memory_region(machine, REGION_CPU1) + 0x2000); + memory_set_bankptr(2, memory_region(machine, REGION_CPU1) + 0xa000); + memory_set_bankptr(3, memory_region(machine, REGION_CPU2) + 0x2000); /* set up the master CPU I/O ports */ init_master_ports(machine, 0x40, 0x80); @@ -2211,7 +2211,7 @@ static DRIVER_INIT( redlin2p ) /* master CPU bankswitching */ leland_update_master_bank = redline_bankswitch; - leland_rotate_memory(0); + leland_rotate_memory(machine, 0); /* set up the master CPU I/O ports */ init_master_ports(machine, 0x00, 0xc0); @@ -2242,7 +2242,7 @@ static DRIVER_INIT( quarterb ) /* master CPU bankswitching */ leland_update_master_bank = viper_bankswitch; - leland_rotate_memory(0); + leland_rotate_memory(machine, 0); /* set up the master CPU I/O ports */ init_master_ports(machine, 0x40, 0x80); @@ -2267,9 +2267,9 @@ static DRIVER_INIT( viper ) /* master CPU bankswitching */ leland_update_master_bank = viper_bankswitch; - leland_rotate_memory(0); - leland_rotate_memory(1); - leland_rotate_memory(1); + leland_rotate_memory(machine, 0); + leland_rotate_memory(machine, 1); + leland_rotate_memory(machine, 1); /* set up the master CPU I/O ports */ init_master_ports(machine, 0x00, 0xc0); @@ -2298,9 +2298,9 @@ static DRIVER_INIT( teamqb ) /* master CPU bankswitching */ leland_update_master_bank = viper_bankswitch; - leland_rotate_memory(0); - leland_rotate_memory(1); - leland_rotate_memory(1); + leland_rotate_memory(machine, 0); + leland_rotate_memory(machine, 1); + leland_rotate_memory(machine, 1); /* set up the master CPU I/O ports */ init_master_ports(machine, 0x40, 0x80); @@ -2328,9 +2328,9 @@ static DRIVER_INIT( aafb ) /* master CPU bankswitching */ leland_update_master_bank = viper_bankswitch; - leland_rotate_memory(0); - leland_rotate_memory(1); - leland_rotate_memory(1); + leland_rotate_memory(machine, 0); + leland_rotate_memory(machine, 1); + leland_rotate_memory(machine, 1); /* set up the master CPU I/O ports */ init_master_ports(machine, 0x00, 0xc0); @@ -2358,9 +2358,9 @@ static DRIVER_INIT( aafbb ) /* master CPU bankswitching */ leland_update_master_bank = viper_bankswitch; - leland_rotate_memory(0); - leland_rotate_memory(1); - leland_rotate_memory(1); + leland_rotate_memory(machine, 0); + leland_rotate_memory(machine, 1); + leland_rotate_memory(machine, 1); /* set up the master CPU I/O ports */ init_master_ports(machine, 0x80, 0x40); @@ -2388,9 +2388,9 @@ static DRIVER_INIT( aafbd2p ) /* master CPU bankswitching */ leland_update_master_bank = viper_bankswitch; - leland_rotate_memory(0); - leland_rotate_memory(1); - leland_rotate_memory(1); + leland_rotate_memory(machine, 0); + leland_rotate_memory(machine, 1); + leland_rotate_memory(machine, 1); /* set up the master CPU I/O ports */ init_master_ports(machine, 0x00, 0x40); @@ -2423,9 +2423,9 @@ static DRIVER_INIT( offroad ) /* master CPU bankswitching */ leland_update_master_bank = offroad_bankswitch; - leland_rotate_memory(0); - leland_rotate_memory(1); - leland_rotate_memory(1); + leland_rotate_memory(machine, 0); + leland_rotate_memory(machine, 1); + leland_rotate_memory(machine, 1); /* set up the master CPU I/O ports */ init_master_ports(machine, 0x00, 0xc0); @@ -2460,9 +2460,9 @@ static DRIVER_INIT( offroadt ) /* master CPU bankswitching */ leland_update_master_bank = offroad_bankswitch; - leland_rotate_memory(0); - leland_rotate_memory(1); - leland_rotate_memory(1); + leland_rotate_memory(machine, 0); + leland_rotate_memory(machine, 1); + leland_rotate_memory(machine, 1); /* set up the master CPU I/O ports */ init_master_ports(machine, 0x80, 0x40); @@ -2494,9 +2494,9 @@ static DRIVER_INIT( pigout ) /* master CPU bankswitching */ leland_update_master_bank = offroad_bankswitch; - leland_rotate_memory(0); - leland_rotate_memory(1); - leland_rotate_memory(1); + leland_rotate_memory(machine, 0); + leland_rotate_memory(machine, 1); + leland_rotate_memory(machine, 1); /* set up the master CPU I/O ports */ init_master_ports(machine, 0x00, 0x40); diff --git a/src/mame/drivers/lethal.c b/src/mame/drivers/lethal.c index f7998559e22..ddeda1101ea 100644 --- a/src/mame/drivers/lethal.c +++ b/src/mame/drivers/lethal.c @@ -279,7 +279,7 @@ static void sound_nmi(running_machine *machine) static WRITE8_HANDLER( le_bankswitch_w ) { - UINT8 *prgrom = (UINT8 *)memory_region(REGION_CPU1)+0x10000; + UINT8 *prgrom = (UINT8 *)memory_region(machine, REGION_CPU1)+0x10000; memory_set_bankptr(1, &prgrom[data * 0x2000]); } @@ -631,7 +631,7 @@ static MACHINE_START( lethalen ) static MACHINE_RESET( lethalen ) { - UINT8 *prgrom = (UINT8 *)memory_region(REGION_CPU1); + UINT8 *prgrom = (UINT8 *)memory_region(machine, REGION_CPU1); memory_set_bankptr(1, &prgrom[0x10000]); memory_set_bankptr(2, &prgrom[0x48000]); diff --git a/src/mame/drivers/liberate.c b/src/mame/drivers/liberate.c index 6359ad4d9b6..1267e8932f1 100644 --- a/src/mame/drivers/liberate.c +++ b/src/mame/drivers/liberate.c @@ -44,7 +44,7 @@ WRITE8_HANDLER( liberate_videoram_w ); static READ8_HANDLER( deco16_bank_r ) { - const UINT8 *ROM = memory_region(REGION_USER1); + const UINT8 *ROM = memory_region(machine, REGION_USER1); /* The tilemap bank can be swapped into main memory */ if (deco16_bank) @@ -67,7 +67,7 @@ static WRITE8_HANDLER( deco16_bank_w ) static READ8_HANDLER( deco16_io_r ) { - const UINT8 *ROM = memory_region(REGION_CPU1); + const UINT8 *ROM = memory_region(machine, REGION_CPU1); if (deco16_bank) { if (offset==0) return input_port_read(machine, "IN1"); /* Player 1 controls */ @@ -902,10 +902,10 @@ ROM_END * *************************************/ -static void sound_cpu_decrypt(void) +static void sound_cpu_decrypt(running_machine *machine) { UINT8 *decrypted = auto_malloc(0x4000); - UINT8 *rom = memory_region(REGION_CPU2); + UINT8 *rom = memory_region(machine, REGION_CPU2); int i; /* Bit swapping on sound cpu - Opcodes only */ @@ -917,14 +917,14 @@ static void sound_cpu_decrypt(void) static DRIVER_INIT( prosport ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); int i; /* Main cpu has the nibbles swapped */ for (i=0; i<0x10000; i++) RAM[i]=((RAM[i] & 0x0f) << 4) | ((RAM[i] & 0xf0) >> 4); - sound_cpu_decrypt(); + sound_cpu_decrypt(machine); } static DRIVER_INIT( yellowcb ) @@ -938,7 +938,7 @@ static DRIVER_INIT( liberate ) { int A; UINT8 *decrypted = auto_malloc(0x10000); - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); memory_set_decrypted_region(0, 0x0000, 0xffff, decrypted); @@ -949,7 +949,7 @@ static DRIVER_INIT( liberate ) decrypted[A] = (decrypted[A] & 0x7d) | ((decrypted[A] & 0x02) << 6) | ((decrypted[A] & 0x80) >> 6); } - sound_cpu_decrypt(); + sound_cpu_decrypt(machine); } /************************************* diff --git a/src/mame/drivers/limenko.c b/src/mame/drivers/limenko.c index a74604dc7eb..21411e67dd3 100644 --- a/src/mame/drivers/limenko.c +++ b/src/mame/drivers/limenko.c @@ -193,8 +193,8 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta int i; int sprites_on_screen = (limenko_videoreg[0] & 0x1ff0000) >> 16; - UINT8 *base_gfx = memory_region(REGION_GFX1); - UINT8 *gfx_max = base_gfx + memory_region_length(REGION_GFX1); + UINT8 *base_gfx = memory_region(machine, REGION_GFX1); + UINT8 *gfx_max = base_gfx + memory_region_length(machine, REGION_GFX1); UINT8 *gfxdata; gfx_element gfx; @@ -859,8 +859,8 @@ static DRIVER_INIT( sb2003 ) static DRIVER_INIT( spotty ) { - UINT8 *dst = memory_region(REGION_GFX1); - UINT8 *src = memory_region(REGION_USER2); + UINT8 *dst = memory_region(machine, REGION_GFX1); + UINT8 *src = memory_region(machine, REGION_USER2); int x; /* expand 4bpp roms to 8bpp space */ diff --git a/src/mame/drivers/lkage.c b/src/mame/drivers/lkage.c index 43aa700022d..08e6f57de97 100644 --- a/src/mame/drivers/lkage.c +++ b/src/mame/drivers/lkage.c @@ -87,7 +87,7 @@ ADDRESS_MAP_END static READ8_HANDLER( port_fetch_r ) { - return memory_region(REGION_USER1)[offset]; + return memory_region(machine, REGION_USER1)[offset]; } static ADDRESS_MAP_START( readport, ADDRESS_SPACE_IO, 8 ) diff --git a/src/mame/drivers/looping.c b/src/mame/drivers/looping.c index 041a7a6613e..89ea820674e 100644 --- a/src/mame/drivers/looping.c +++ b/src/mame/drivers/looping.c @@ -784,8 +784,8 @@ ROM_END static DRIVER_INIT( looping ) { - int length = memory_region_length(REGION_CPU1); - UINT8 *rom = memory_region(REGION_CPU1); + int length = memory_region_length(machine, REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); int i; /* bitswap the TMS9995 ROMs */ diff --git a/src/mame/drivers/lordgun.c b/src/mame/drivers/lordgun.c index 0b4feda975f..d3fc3308af5 100644 --- a/src/mame/drivers/lordgun.c +++ b/src/mame/drivers/lordgun.c @@ -68,7 +68,7 @@ VIDEO_UPDATE( lordgun ); static DRIVER_INIT( lordgun ) { int i; - UINT16 *src = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *src = (UINT16 *)memory_region(machine, REGION_CPU1); int rom_size = 0x100000; diff --git a/src/mame/drivers/lsasquad.c b/src/mame/drivers/lsasquad.c index ef33e9722f5..2cc200e7f28 100644 --- a/src/mame/drivers/lsasquad.c +++ b/src/mame/drivers/lsasquad.c @@ -154,7 +154,7 @@ Notes: static WRITE8_HANDLER( lsasquad_bankswitch_w ) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); /* bits 0-2 select ROM bank */ memory_set_bankptr(1,&ROM[0x10000 + 0x2000 * (data & 7)]); @@ -757,9 +757,9 @@ ROM_START( daikaiju ) ROM_LOAD( "a74_06.ic9", 0x0600, 0x0400, CRC(cad554e7) SHA1(7890d948bfef198309df810f8401d224224a73a1) ) /* priority */ ROM_END -static void init_common(void) +static void init_common(running_machine *machine) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); /* an instruction at $7FFF straddles the bank switch boundary at $8000 into rom bank #0 and then continues into the bank so @@ -768,9 +768,9 @@ static void init_common(void) } /* coin inputs are inverted in storming */ -static DRIVER_INIT( lsasquad ) { lsasquad_invertcoin = 0x00; init_common(); } -static DRIVER_INIT( storming ) { lsasquad_invertcoin = 0x0c; init_common(); } -static DRIVER_INIT( daikaiju ) { init_common(); } +static DRIVER_INIT( lsasquad ) { lsasquad_invertcoin = 0x00; init_common(machine); } +static DRIVER_INIT( storming ) { lsasquad_invertcoin = 0x0c; init_common(machine); } +static DRIVER_INIT( daikaiju ) { init_common(machine); } GAME( 1986, lsasquad, 0, lsasquad, lsasquad, lsasquad, ROT270, "Taito", "Land Sea Air Squad / Riku Kai Kuu Saizensen", GAME_IMPERFECT_GRAPHICS ) diff --git a/src/mame/drivers/ltcasino.c b/src/mame/drivers/ltcasino.c index 29faa81f1e6..ab01ec15301 100644 --- a/src/mame/drivers/ltcasino.c +++ b/src/mame/drivers/ltcasino.c @@ -716,7 +716,7 @@ ROM_END static DRIVER_INIT(mv4in1) { int i; - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); for(i=0;i<0x10000;i++) rom[i]=BITSWAP8(rom[i],7,6,5,4,3,1,2,0); } diff --git a/src/mame/drivers/lucky8.c b/src/mame/drivers/lucky8.c index 0ed645de7da..2b536871e96 100644 --- a/src/mame/drivers/lucky8.c +++ b/src/mame/drivers/lucky8.c @@ -410,7 +410,7 @@ ROM_END static DRIVER_INIT( lucky8 ) { // patch rst $10 timing routine that gets stuck in an endless loop - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); ROM[0x0010] = 0xc9; } diff --git a/src/mame/drivers/lwings.c b/src/mame/drivers/lwings.c index cd0926e9cf8..296884ad2a8 100644 --- a/src/mame/drivers/lwings.c +++ b/src/mame/drivers/lwings.c @@ -83,7 +83,7 @@ static WRITE8_HANDLER( lwings_bankswitch_w ) flip_screen_set(~data & 0x01); /* bits 1 and 2 select ROM bank */ - RAM = memory_region(REGION_CPU1); + RAM = memory_region(machine, REGION_CPU1); bank = (data & 0x06) >> 1; memory_set_bankptr(1,&RAM[0x10000 + bank*0x4000]); diff --git a/src/mame/drivers/m107.c b/src/mame/drivers/m107.c index 7bb9af9f7f0..9614f16f58a 100644 --- a/src/mame/drivers/m107.c +++ b/src/mame/drivers/m107.c @@ -39,7 +39,7 @@ static WRITE16_HANDLER( bankswitch_w ) { if (ACCESSING_BITS_0_7) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); memory_set_bankptr(1,&RAM[0x100000 + ((data&0x7)*0x10000)]); } } @@ -638,12 +638,12 @@ ROM_END static DRIVER_INIT( firebarr ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); memcpy(RAM+0xffff0,RAM+0x7fff0,0x10); /* Start vector */ memory_set_bankptr(1,&RAM[0xa0000]); /* Initial bank */ - RAM = memory_region(REGION_CPU2); + RAM = memory_region(machine, REGION_CPU2); memcpy(RAM+0xffff0,RAM+0x1fff0,0x10); /* Sound cpu Start vector */ m107_irq_vectorbase=0x20; @@ -652,12 +652,12 @@ static DRIVER_INIT( firebarr ) static DRIVER_INIT( dsoccr94 ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); memcpy(RAM+0xffff0,RAM+0x7fff0,0x10); /* Start vector */ memory_set_bankptr(1,&RAM[0xa0000]); /* Initial bank */ - RAM = memory_region(REGION_CPU2); + RAM = memory_region(machine, REGION_CPU2); memcpy(RAM+0xffff0,RAM+0x1fff0,0x10); /* Sound cpu Start vector */ m107_irq_vectorbase=0x80; @@ -666,12 +666,12 @@ static DRIVER_INIT( dsoccr94 ) static DRIVER_INIT( wpksoc ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); memcpy(RAM+0xffff0,RAM+0x7fff0,0x10); /* Start vector */ memory_set_bankptr(1,&RAM[0xa0000]); /* Initial bank */ - RAM = memory_region(REGION_CPU2); + RAM = memory_region(machine, REGION_CPU2); memcpy(RAM+0xffff0,RAM+0x1fff0,0x10); /* Sound cpu Start vector */ diff --git a/src/mame/drivers/m62.c b/src/mame/drivers/m62.c index 535310898f6..751a387a19e 100644 --- a/src/mame/drivers/m62.c +++ b/src/mame/drivers/m62.c @@ -2506,50 +2506,50 @@ ROM_END static DRIVER_INIT( battroad ) { /* configure memory banks */ - memory_configure_bank(1, 0, 16, memory_region(REGION_CPU1) + 0x10000, 0x2000); + memory_configure_bank(1, 0, 16, memory_region(machine, REGION_CPU1) + 0x10000, 0x2000); } static DRIVER_INIT( ldrun2 ) { /* configure memory banks */ - memory_configure_bank(1, 0, 2, memory_region(REGION_CPU1) + 0x10000, 0x2000); + memory_configure_bank(1, 0, 2, memory_region(machine, REGION_CPU1) + 0x10000, 0x2000); } static DRIVER_INIT( ldrun4 ) { /* configure memory banks */ - memory_configure_bank(1, 0, 2, memory_region(REGION_CPU1) + 0x10000, 0x4000); + memory_configure_bank(1, 0, 2, memory_region(machine, REGION_CPU1) + 0x10000, 0x4000); } static DRIVER_INIT( kidniki ) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); /* in Kid Niki, bank 0 has code falling from 7fff to 8000, */ /* so I have to copy it there because bank switching wouldn't catch it */ memcpy(ROM + 0x08000, ROM + 0x10000, 0x2000); /* configure memory banks */ - memory_configure_bank(1, 0, 16, memory_region(REGION_CPU1) + 0x10000, 0x2000); + memory_configure_bank(1, 0, 16, memory_region(machine, REGION_CPU1) + 0x10000, 0x2000); } static DRIVER_INIT( spelunkr ) { /* configure memory banks */ - memory_configure_bank(1, 0, 4, memory_region(REGION_CPU1) + 0x10000, 0x2000); + memory_configure_bank(1, 0, 4, memory_region(machine, REGION_CPU1) + 0x10000, 0x2000); } static DRIVER_INIT( spelunk2 ) { /* configure memory banks */ - memory_configure_bank(1, 0, 4, memory_region(REGION_CPU1) + 0x20000, 0x1000); - memory_configure_bank(2, 0, 16, memory_region(REGION_CPU1) + 0x10000, 0x1000); + memory_configure_bank(1, 0, 4, memory_region(machine, REGION_CPU1) + 0x20000, 0x1000); + memory_configure_bank(2, 0, 16, memory_region(machine, REGION_CPU1) + 0x10000, 0x1000); } static DRIVER_INIT( youjyudn ) { /* configure memory banks */ - memory_configure_bank(1, 0, 2, memory_region(REGION_CPU1) + 0x10000, 0x4000); + memory_configure_bank(1, 0, 2, memory_region(machine, REGION_CPU1) + 0x10000, 0x4000); } GAME( 1984, kungfum, 0, kungfum, kungfum, 0, ROT0, "Irem", "Kung-Fu Master", 0 ) diff --git a/src/mame/drivers/m72.c b/src/mame/drivers/m72.c index f3804b72a1c..258dca5ee56 100644 --- a/src/mame/drivers/m72.c +++ b/src/mame/drivers/m72.c @@ -167,8 +167,8 @@ the NMI handler in the other games. #if 0 static int find_sample(int num) { - UINT8 *rom = memory_region(REGION_SOUND1); - int len = memory_region_length(REGION_SOUND1); + UINT8 *rom = memory_region(machine, REGION_SOUND1); + int len = memory_region_length(machine, REGION_SOUND1); int addr = 0; while (num--) diff --git a/src/mame/drivers/m79amb.c b/src/mame/drivers/m79amb.c index df47c0143fc..ae401b87e8e 100644 --- a/src/mame/drivers/m79amb.c +++ b/src/mame/drivers/m79amb.c @@ -182,7 +182,7 @@ static INTERRUPT_GEN( m79amb_interrupt ) static DRIVER_INIT( m79amb ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); int i; /* PROM data is active low */ diff --git a/src/mame/drivers/m90.c b/src/mame/drivers/m90.c index bd85f7cb8d0..14b0ac97c93 100644 --- a/src/mame/drivers/m90.c +++ b/src/mame/drivers/m90.c @@ -52,9 +52,9 @@ WRITE16_HANDLER( m90_video_control_w ); /***************************************************************************/ -static void set_m90_bank(void) +static void set_m90_bank(running_machine *machine) { - UINT8 *rom = memory_region(REGION_USER1); + UINT8 *rom = memory_region(machine, REGION_USER1); if (!rom) popmessage("bankswitch with no banked ROM!"); @@ -80,7 +80,7 @@ static WRITE16_HANDLER( quizf1_bankswitch_w ) if (ACCESSING_BITS_0_7) { bankaddress = 0x10000 * (data & 0x0f); - set_m90_bank(); + set_m90_bank(machine); } } @@ -1260,13 +1260,13 @@ ROM_END static STATE_POSTLOAD( quizf1_postload ) { - set_m90_bank(); + set_m90_bank(machine); } static DRIVER_INIT( quizf1 ) { bankaddress = 0; - set_m90_bank(); + set_m90_bank(machine); state_save_register_global(bankaddress); state_save_register_postload(machine, quizf1_postload, NULL); @@ -1276,7 +1276,7 @@ static DRIVER_INIT( quizf1 ) static DRIVER_INIT( bomblord ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); int i; for (i=0; i<0x100000; i+=8) diff --git a/src/mame/drivers/m92.c b/src/mame/drivers/m92.c index d630c1c2ca0..38e9566a4ae 100644 --- a/src/mame/drivers/m92.c +++ b/src/mame/drivers/m92.c @@ -213,15 +213,15 @@ static TIMER_CALLBACK( m92_scanline_interrupt ); /*****************************************************************************/ -static void set_m92_bank(void) +static void set_m92_bank(running_machine *machine) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); memory_set_bankptr(1,&RAM[bankaddress]); } static STATE_POSTLOAD( m92_postload ) { - set_m92_bank(); + set_m92_bank(machine); } static MACHINE_START( m92 ) @@ -269,14 +269,14 @@ static TIMER_CALLBACK( m92_scanline_interrupt ) static READ16_HANDLER( m92_eeprom_r ) { - UINT8 *RAM = memory_region(REGION_USER1); + UINT8 *RAM = memory_region(machine, REGION_USER1); // logerror("%05x: EEPROM RE %04x\n",activecpu_get_pc(),offset); return RAM[offset] | 0xff00; } static WRITE16_HANDLER( m92_eeprom_w ) { - UINT8 *RAM = memory_region(REGION_USER1); + UINT8 *RAM = memory_region(machine, REGION_USER1); // logerror("%05x: EEPROM WR %04x\n",activecpu_get_pc(),offset); if (ACCESSING_BITS_0_7) RAM[offset] = data; @@ -299,7 +299,7 @@ static WRITE16_HANDLER( m92_bankswitch_w ) if (ACCESSING_BITS_0_7) { bankaddress = 0x100000 + ((data & 0x7) * 0x10000); - set_m92_bank(); + set_m92_bank(machine); } } @@ -1994,20 +1994,20 @@ ROM_END static void init_m92(running_machine *machine, int hasbanks) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); if (hasbanks) { memcpy(RAM+0xffff0,RAM+0x7fff0,0x10); /* Start vector */ bankaddress = 0xa0000; /* Initial bank */ - set_m92_bank(); + set_m92_bank(machine); /* Mirror used by In The Hunt for protection */ memcpy(RAM+0xc0000,RAM+0x00000,0x10000); memory_set_bankptr(2,&RAM[0xc0000]); } - RAM = memory_region(REGION_CPU2); + RAM = memory_region(machine, REGION_CPU2); memcpy(RAM+0xffff0, RAM+0x1fff0, 0x10); /* Sound cpu Start vector */ m92_game_kludge=0; @@ -2086,7 +2086,7 @@ static DRIVER_INIT( lethalth ) static DRIVER_INIT( nbbatman ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); init_m92(machine, 1); @@ -2116,7 +2116,7 @@ static DRIVER_INIT( dsccr94j ) static DRIVER_INIT( gunforc2 ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); init_m92(machine, 1); memcpy(RAM+0x80000,RAM+0x100000,0x20000); } diff --git a/src/mame/drivers/macs.c b/src/mame/drivers/macs.c index 3ade01fcbaf..a43fa37b525 100644 --- a/src/mame/drivers/macs.c +++ b/src/mame/drivers/macs.c @@ -544,11 +544,11 @@ static MACHINE_RESET(macs) 730E: ED B0 ldir ... */ - memcpy(macs_ram1 + 0x0e9f, memory_region(REGION_USER1)+0x7327, 0xc7); - memcpy(macs_ram1 + 0x1e9f, memory_region(REGION_USER1)+0x7327, 0xc7); + memcpy(macs_ram1 + 0x0e9f, memory_region(machine, REGION_USER1)+0x7327, 0xc7); + memcpy(macs_ram1 + 0x1e9f, memory_region(machine, REGION_USER1)+0x7327, 0xc7); - memcpy(macs_ram1 + 0x0800, memory_region(REGION_USER1)+0x73fa, 0x507); - memcpy(macs_ram1 + 0x1800, memory_region(REGION_USER1)+0x73fa, 0x507); + memcpy(macs_ram1 + 0x0800, memory_region(machine, REGION_USER1)+0x73fa, 0x507); + memcpy(macs_ram1 + 0x1800, memory_region(machine, REGION_USER1)+0x73fa, 0x507); #define MAKEJMP(n,m) macs_ram2[(n) - 0xe800 + 0]=0xc3;\ macs_ram2[(n) - 0xe800 + 1]=(m)&0xff;\ @@ -583,7 +583,7 @@ static MACHINE_RESET(macs) macs_ram1[0x0ff9]=0x07; macs_ram1[0x1ff9]=0x07; - memory_set_bankptr( 1, memory_region(REGION_CPU1) + 0x10000 ); + memory_set_bankptr( 1, memory_region(machine, REGION_CPU1) + 0x10000 ); memory_set_bankptr( 2, macs_ram1+0x800); memory_set_bankptr( 3, macs_ram1+0x10000); } diff --git a/src/mame/drivers/madalien.c b/src/mame/drivers/madalien.c index f49877b897f..bb4982fc25a 100644 --- a/src/mame/drivers/madalien.c +++ b/src/mame/drivers/madalien.c @@ -26,16 +26,16 @@ static INPUT_CHANGED( coin_inserted ) } -INLINE UINT8 shift_common(UINT8 hi, UINT8 lo) +INLINE UINT8 shift_common(running_machine *machine, UINT8 hi, UINT8 lo) { - const UINT8 *table = memory_region(REGION_USER2); + const UINT8 *table = memory_region(machine, REGION_USER2); return table[((hi & 0x07) << 8) | lo]; } static READ8_HANDLER( shift_r ) { - return shift_common(*shift_hi, *shift_lo); + return shift_common(machine, *shift_hi, *shift_lo); } static READ8_HANDLER( shift_rev_r ) @@ -43,7 +43,7 @@ static READ8_HANDLER( shift_rev_r ) UINT8 hi = *shift_hi ^ 0x07; UINT8 lo = BITSWAP8(*shift_lo,0,1,2,3,4,5,6,7); - UINT8 ret = shift_common(hi, lo); + UINT8 ret = shift_common(machine, hi, lo); return BITSWAP8(ret,7,0,1,2,3,4,5,6) & 0x7f; } diff --git a/src/mame/drivers/madmotor.c b/src/mame/drivers/madmotor.c index 0d6eef49612..15cee1b76a3 100644 --- a/src/mame/drivers/madmotor.c +++ b/src/mame/drivers/madmotor.c @@ -375,7 +375,7 @@ ROM_END static DRIVER_INIT( madmotor ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); int i; for (i = 0x00000;i < 0x80000;i++) diff --git a/src/mame/drivers/mainevt.c b/src/mame/drivers/mainevt.c index a00d3dd38c6..4899b49b405 100644 --- a/src/mame/drivers/mainevt.c +++ b/src/mame/drivers/mainevt.c @@ -59,7 +59,7 @@ static INTERRUPT_GEN( dv_interrupt ) static WRITE8_HANDLER( mainevt_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); int bankaddress; /* bit 0-1 ROM bank select */ diff --git a/src/mame/drivers/malzak.c b/src/mame/drivers/malzak.c index 67bac54a3ac..3ca20aeb35d 100644 --- a/src/mame/drivers/malzak.c +++ b/src/mame/drivers/malzak.c @@ -65,7 +65,7 @@ static READ8_HANDLER( fake_VRLE_r ) static READ8_HANDLER( bank_r ) { - UINT8* bank = memory_region(REGION_USER2); + UINT8* bank = memory_region(machine, REGION_USER2); return bank[offset + (malzak_bank1 * 0x0400)]; } diff --git a/src/mame/drivers/marinedt.c b/src/mame/drivers/marinedt.c index da18efd5451..f1d69c5c2b0 100644 --- a/src/mame/drivers/marinedt.c +++ b/src/mame/drivers/marinedt.c @@ -157,7 +157,7 @@ static READ8_HANDLER( marinedt_obj1_x_r ) //xxxx---- unknown //----xxxx x pos in tile ram - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); if(RAM[0x430e]) --cx; else ++cx; //figure out why inc/dec based on 430e? return cx | (cxh<<4); diff --git a/src/mame/drivers/marvins.c b/src/mame/drivers/marvins.c index 1f4fee9e1d6..a5876cd5ba5 100644 --- a/src/mame/drivers/marvins.c +++ b/src/mame/drivers/marvins.c @@ -758,7 +758,7 @@ static DRIVER_INIT( madcrash ) because of bit rot, so the rest of the test mode (what little there is) can be explored. - UINT8 *mem = memory_region(REGION_CPU1); + UINT8 *mem = memory_region(machine, REGION_CPU1); mem[0x3a5d] = 0; mem[0x3a5e] = 0; mem[0x3a5f] = 0; */ init_sound( 0x20 ); diff --git a/src/mame/drivers/mastboy.c b/src/mame/drivers/mastboy.c index d371a73cf66..d3e567639fc 100644 --- a/src/mame/drivers/mastboy.c +++ b/src/mame/drivers/mastboy.c @@ -517,7 +517,7 @@ static READ8_HANDLER(banked_ram_r) if (bank>0x3) // ROM access { - UINT8 *src = memory_region( REGION_GFX1 ); + UINT8 *src = memory_region( machine, REGION_GFX1 ); bank &=0x3; return src[offset+(bank*0x4000)]; } @@ -533,7 +533,7 @@ static READ8_HANDLER(banked_ram_r) UINT8 *src; int bank; bank = mastboy_bank & 0x7f; - src = memory_region ( REGION_USER1 ) + bank * 0x4000; + src = memory_region ( machine, REGION_USER1 ) + bank * 0x4000; return src[offset]; } } @@ -972,7 +972,7 @@ ROM_END static DRIVER_INIT( mastboy ) { - mastboy_vram = memory_region( REGION_GFX1 ); // makes decoding the RAM based tiles easier this way + mastboy_vram = memory_region( machine, REGION_GFX1 ); // makes decoding the RAM based tiles easier this way } GAME( 1991, mastboy, 0, mastboy, mastboy, mastboy, ROT0, "Gaelco", "Master Boy (Spanish, PCB Rev A)", 0 ) diff --git a/src/mame/drivers/maxaflex.c b/src/mame/drivers/maxaflex.c index 1095791390e..061c2e690ea 100644 --- a/src/mame/drivers/maxaflex.c +++ b/src/mame/drivers/maxaflex.c @@ -531,7 +531,7 @@ ROM_END static DRIVER_INIT( a600xl ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); memcpy( rom + 0x5000, rom + 0xd000, 0x800 ); } diff --git a/src/mame/drivers/mayumi.c b/src/mame/drivers/mayumi.c index 5f651ee462a..3706346aefe 100644 --- a/src/mame/drivers/mayumi.c +++ b/src/mame/drivers/mayumi.c @@ -30,7 +30,7 @@ static INTERRUPT_GEN( mayumi_interrupt ) static WRITE8_HANDLER( bank_sel_w ) { - UINT8 *BANKROM = memory_region(REGION_CPU1); + UINT8 *BANKROM = memory_region(machine, REGION_CPU1); int bank = ((data & 0x80)) >> 7 | ((data & 0x40) >> 5); memory_set_bankptr(1, &BANKROM[0x10000+bank*0x4000]); diff --git a/src/mame/drivers/mazerbla.c b/src/mame/drivers/mazerbla.c index 251041c84cc..03ba5cf56a3 100644 --- a/src/mame/drivers/mazerbla.c +++ b/src/mame/drivers/mazerbla.c @@ -604,13 +604,13 @@ static WRITE8_HANDLER(cfb_rom_bank_sel_w) /* mazer blazer */ { gfx_rom_bank = data; - memory_set_bankptr( 1, memory_region(REGION_CPU3) + (gfx_rom_bank * 0x2000) + 0x10000 ); + memory_set_bankptr( 1, memory_region(machine, REGION_CPU3) + (gfx_rom_bank * 0x2000) + 0x10000 ); } static WRITE8_HANDLER(cfb_rom_bank_sel_w_gg) /* great guns */ { gfx_rom_bank = data>>1; - memory_set_bankptr( 1, memory_region(REGION_CPU3) + (gfx_rom_bank * 0x2000) + 0x10000 ); + memory_set_bankptr( 1, memory_region(machine, REGION_CPU3) + (gfx_rom_bank * 0x2000) + 0x10000 ); } @@ -687,7 +687,7 @@ int bits = 0; UINT8 color_base=0; -UINT8 * rom = memory_region(REGION_CPU3) + (gfx_rom_bank * 0x2000) + 0x10000; +UINT8 * rom = memory_region(machine, REGION_CPU3) + (gfx_rom_bank * 0x2000) + 0x10000; /* if ((mode<=0x07) || (mode>=0x10)) @@ -852,7 +852,7 @@ int bits = 0; UINT8 color_base=0; -UINT8 * rom = memory_region(REGION_CPU3) + (gfx_rom_bank * 0x2000) + 0x10000; +UINT8 * rom = memory_region(machine, REGION_CPU3) + (gfx_rom_bank * 0x2000) + 0x10000; /* //if (0) //(mode != 0x07) @@ -1452,7 +1452,7 @@ static MACHINE_RESET( mazerbla ) static MACHINE_RESET( greatgun ) { - UINT8 *rom = memory_region(REGION_CPU3); + UINT8 *rom = memory_region(machine, REGION_CPU3); game_id = GREATGUN; zpu_int_vector = 0xff; cpunum_set_irq_callback(0, irq_callback); diff --git a/src/mame/drivers/mcatadv.c b/src/mame/drivers/mcatadv.c index 60ecfaee9c3..af219e90901 100644 --- a/src/mame/drivers/mcatadv.c +++ b/src/mame/drivers/mcatadv.c @@ -237,7 +237,7 @@ ADDRESS_MAP_END static WRITE8_HANDLER ( mcatadv_sound_bw_w ) { - UINT8 *rom = memory_region(REGION_CPU2) + 0x10000; + UINT8 *rom = memory_region(machine, REGION_CPU2) + 0x10000; memory_set_bankptr(1,rom + data * 0x4000); } @@ -539,7 +539,7 @@ MACHINE_DRIVER_END static DRIVER_INIT( mcatadv ) { - UINT8 *z80rom = memory_region(REGION_CPU2) + 0x10000; + UINT8 *z80rom = memory_region(machine, REGION_CPU2) + 0x10000; memory_set_bankptr(1, z80rom + 0x4000); } diff --git a/src/mame/drivers/mcr.c b/src/mame/drivers/mcr.c index c2f0ed377d5..2572242fd36 100644 --- a/src/mame/drivers/mcr.c +++ b/src/mame/drivers/mcr.c @@ -2427,7 +2427,7 @@ static void mcr_init(int cpuboard, int vidboard, int ssioboard) static DRIVER_INIT( solarfox ) { mcr_init(90009, 91399, 90908); - mcr_sound_init(MCR_SSIO); + mcr_sound_init(machine, MCR_SSIO); ssio_set_custom_input(0, 0x1c, solarfox_ip0_r); ssio_set_custom_input(1, 0xff, solarfox_ip1_r); @@ -2439,7 +2439,7 @@ static DRIVER_INIT( solarfox ) static DRIVER_INIT( kick ) { mcr_init(90009, 91399, 90908); - mcr_sound_init(MCR_SSIO); + mcr_sound_init(machine, MCR_SSIO); ssio_set_custom_input(1, 0xf0, kick_ip1_r); @@ -2450,14 +2450,14 @@ static DRIVER_INIT( kick ) static DRIVER_INIT( mcr_90010 ) { mcr_init(90010, 91399, 90913); - mcr_sound_init(MCR_SSIO); + mcr_sound_init(machine, MCR_SSIO); } static DRIVER_INIT( wacko ) { mcr_init(90010, 91399, 90913); - mcr_sound_init(MCR_SSIO); + mcr_sound_init(machine, MCR_SSIO); ssio_set_custom_input(1, 0xff, wacko_ip1_r); ssio_set_custom_input(2, 0xff, wacko_ip2_r); @@ -2468,7 +2468,7 @@ static DRIVER_INIT( wacko ) static DRIVER_INIT( twotiger ) { mcr_init(90010, 91399, 90913); - mcr_sound_init(MCR_SSIO); + mcr_sound_init(machine, MCR_SSIO); memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe800, 0xefff, 0, 0x1000, twotiger_videoram_r, twotiger_videoram_w); } @@ -2477,7 +2477,7 @@ static DRIVER_INIT( twotiger ) static DRIVER_INIT( kroozr ) { mcr_init(90010, 91399, 91483); - mcr_sound_init(MCR_SSIO); + mcr_sound_init(machine, MCR_SSIO); ssio_set_custom_input(1, 0x47, kroozr_ip1_r); ssio_set_custom_output(4, 0x34, kroozr_op4_w); @@ -2487,7 +2487,7 @@ static DRIVER_INIT( kroozr ) static DRIVER_INIT( journey ) { mcr_init(91475, 91464, 90913); - mcr_sound_init(MCR_SSIO); + mcr_sound_init(machine, MCR_SSIO); ssio_set_custom_output(4, 0x01, journey_op4_w); } @@ -2496,14 +2496,14 @@ static DRIVER_INIT( journey ) static DRIVER_INIT( mcr_91490 ) { mcr_init(91490, 91464, 90913); - mcr_sound_init(MCR_SSIO); + mcr_sound_init(machine, MCR_SSIO); } static DRIVER_INIT( dotrone ) { mcr_init(91490, 91464, 91657); - mcr_sound_init(MCR_SSIO | MCR_SQUAWK_N_TALK); + mcr_sound_init(machine, MCR_SSIO | MCR_SQUAWK_N_TALK); ssio_set_custom_output(4, 0xff, dotron_op4_w); } @@ -2512,7 +2512,7 @@ static DRIVER_INIT( dotrone ) static DRIVER_INIT( nflfoot ) { mcr_init(91490, 91464, 91657); - mcr_sound_init(MCR_SSIO | MCR_SQUAWK_N_TALK); + mcr_sound_init(machine, MCR_SSIO | MCR_SQUAWK_N_TALK); ssio_set_custom_input(2, 0x80, nflfoot_ip2_r); ssio_set_custom_output(4, 0xff, nflfoot_op4_w); @@ -2532,7 +2532,7 @@ static DRIVER_INIT( nflfoot ) static DRIVER_INIT( demoderb ) { mcr_init(91490, 91464, 90913); - mcr_sound_init(MCR_SSIO | MCR_TURBO_CHIP_SQUEAK); + mcr_sound_init(machine, MCR_SSIO | MCR_TURBO_CHIP_SQUEAK); ssio_set_custom_input(1, 0xfc, demoderb_ip1_r); ssio_set_custom_input(2, 0xfc, demoderb_ip2_r); diff --git a/src/mame/drivers/mcr3.c b/src/mame/drivers/mcr3.c index 1cfde1c1b13..771e7ba349e 100644 --- a/src/mame/drivers/mcr3.c +++ b/src/mame/drivers/mcr3.c @@ -1453,9 +1453,9 @@ ROM_END * *************************************/ -static void mcr_common_init(int sound_board) +static void mcr_common_init(running_machine *machine, int sound_board) { - mcr_sound_init(sound_board); + mcr_sound_init(machine, sound_board); state_save_register_global(input_mux); state_save_register_global(latched_input); @@ -1465,7 +1465,7 @@ static void mcr_common_init(int sound_board) static DRIVER_INIT( demoderm ) { - mcr_common_init(MCR_TURBO_CHIP_SQUEAK); + mcr_common_init(machine, MCR_TURBO_CHIP_SQUEAK); memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x01, 0x01, 0, 0, demoderm_ip1_r); memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x02, 0x02, 0, 0, demoderm_ip2_r); memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x06, 0x06, 0, 0, demoderm_op6_w); @@ -1474,14 +1474,14 @@ static DRIVER_INIT( demoderm ) static DRIVER_INIT( sarge ) { - mcr_common_init(MCR_TURBO_CHIP_SQUEAK); + mcr_common_init(machine, MCR_TURBO_CHIP_SQUEAK); memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x06, 0x06, 0, 0, turbocs_data_w); } static DRIVER_INIT( maxrpm ) { - mcr_common_init(MCR_TURBO_CHIP_SQUEAK); + mcr_common_init(machine, MCR_TURBO_CHIP_SQUEAK); memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x01, 0x01, 0, 0, maxrpm_ip1_r); memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x02, 0x02, 0, 0, maxrpm_ip2_r); memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x05, 0x05, 0, 0, maxrpm_op5_w); @@ -1497,7 +1497,7 @@ static DRIVER_INIT( maxrpm ) static DRIVER_INIT( rampage ) { - mcr_common_init(MCR_SOUNDS_GOOD); + mcr_common_init(machine, MCR_SOUNDS_GOOD); memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x04, 0x04, 0, 0, rampage_ip4_r); memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x06, 0x06, 0, 0, rampage_op6_w); } @@ -1505,7 +1505,7 @@ static DRIVER_INIT( rampage ) static DRIVER_INIT( powerdrv ) { - mcr_common_init(MCR_SOUNDS_GOOD); + mcr_common_init(machine, MCR_SOUNDS_GOOD); memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x02, 0x02, 0, 0, powerdrv_ip2_r); memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x05, 0x05, 0, 0, powerdrv_op5_w); memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x06, 0x06, 0, 0, powerdrv_op6_w); @@ -1514,7 +1514,7 @@ static DRIVER_INIT( powerdrv ) static DRIVER_INIT( stargrds ) { - mcr_common_init(MCR_SOUNDS_GOOD); + mcr_common_init(machine, MCR_SOUNDS_GOOD); memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x00, 0x00, 0, 0, stargrds_ip0_r); memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x05, 0x05, 0, 0, stargrds_op5_w); memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x06, 0x06, 0, 0, stargrds_op6_w); @@ -1523,7 +1523,7 @@ static DRIVER_INIT( stargrds ) static DRIVER_INIT( spyhunt ) { - mcr_common_init(MCR_SSIO | MCR_CHIP_SQUEAK_DELUXE); + mcr_common_init(machine, MCR_SSIO | MCR_CHIP_SQUEAK_DELUXE); ssio_set_custom_input(1, 0x60, spyhunt_ip1_r); ssio_set_custom_input(2, 0xff, spyhunt_ip2_r); ssio_set_custom_output(4, 0xff, spyhunt_op4_w); @@ -1535,7 +1535,7 @@ static DRIVER_INIT( spyhunt ) static DRIVER_INIT( crater ) { - mcr_common_init(MCR_SSIO); + mcr_common_init(machine, MCR_SSIO); spyhunt_sprite_color_mask = 0x03; spyhunt_scroll_offset = 96; @@ -1544,7 +1544,7 @@ static DRIVER_INIT( crater ) static DRIVER_INIT( turbotag ) { - mcr_common_init(MCR_SSIO | MCR_CHIP_SQUEAK_DELUXE); + mcr_common_init(machine, MCR_SSIO | MCR_CHIP_SQUEAK_DELUXE); ssio_set_custom_input(1, 0x60, spyhunt_ip1_r); ssio_set_custom_input(2, 0xff, turbotag_ip2_r); ssio_set_custom_output(4, 0xff, spyhunt_op4_w); diff --git a/src/mame/drivers/mcr68.c b/src/mame/drivers/mcr68.c index f0c4c3e4298..62c9f95d486 100644 --- a/src/mame/drivers/mcr68.c +++ b/src/mame/drivers/mcr68.c @@ -1366,9 +1366,9 @@ ROM_END * *************************************/ -static void mcr68_common_init(int sound_board, int clip, int xoffset) +static void mcr68_common_init(running_machine *machine, int sound_board, int clip, int xoffset) { - mcr_sound_init(sound_board); + mcr_sound_init(machine, sound_board); mcr68_sprite_clip = clip; mcr68_sprite_xoffset = xoffset; @@ -1379,7 +1379,7 @@ static void mcr68_common_init(int sound_board, int clip, int xoffset) static DRIVER_INIT( zwackery ) { - mcr68_common_init(MCR_CHIP_SQUEAK_DELUXE, 0, 0); + mcr68_common_init(machine, MCR_CHIP_SQUEAK_DELUXE, 0, 0); /* Zwackery doesn't care too much about this value; currently taken from Blasted */ mcr68_timing_factor = attotime_make(0, HZ_TO_ATTOSECONDS(cpunum_get_clock(0) / 10) * (256 + 16)); @@ -1388,7 +1388,7 @@ static DRIVER_INIT( zwackery ) static DRIVER_INIT( xenophob ) { - mcr68_common_init(MCR_SOUNDS_GOOD, 0, -4); + mcr68_common_init(machine, MCR_SOUNDS_GOOD, 0, -4); /* Xenophobe doesn't care too much about this value; currently taken from Blasted */ mcr68_timing_factor = attotime_make(0, HZ_TO_ATTOSECONDS(cpunum_get_clock(0) / 10) * (256 + 16)); @@ -1400,7 +1400,7 @@ static DRIVER_INIT( xenophob ) static DRIVER_INIT( spyhunt2 ) { - mcr68_common_init(MCR_TURBO_CHIP_SQUEAK | MCR_SOUNDS_GOOD, 0, -6); + mcr68_common_init(machine, MCR_TURBO_CHIP_SQUEAK | MCR_SOUNDS_GOOD, 0, -6); /* Spy Hunter 2 doesn't care too much about this value; currently taken from Blasted */ mcr68_timing_factor = attotime_make(0, HZ_TO_ATTOSECONDS(cpunum_get_clock(0) / 10) * (256 + 16)); @@ -1414,7 +1414,7 @@ static DRIVER_INIT( spyhunt2 ) static DRIVER_INIT( blasted ) { - mcr68_common_init(MCR_SOUNDS_GOOD, 0, 0); + mcr68_common_init(machine, MCR_SOUNDS_GOOD, 0, 0); /* Blasted checks the timing of VBLANK relative to the 493 interrupt */ /* VBLANK is required to come within 220-256 E clocks (i.e., 2200-2560 CPU clocks) */ @@ -1431,7 +1431,7 @@ static DRIVER_INIT( blasted ) static DRIVER_INIT( archrivl ) { - mcr68_common_init(MCR_WILLIAMS_SOUND, 16, 0); + mcr68_common_init(machine, MCR_WILLIAMS_SOUND, 16, 0); /* Arch Rivals doesn't care too much about this value; currently taken from Blasted */ mcr68_timing_factor = attotime_make(0, HZ_TO_ATTOSECONDS(cpunum_get_clock(0) / 10) * (256 + 16)); @@ -1449,7 +1449,7 @@ static DRIVER_INIT( archrivl ) static DRIVER_INIT( pigskin ) { - mcr68_common_init(MCR_WILLIAMS_SOUND, 16, 0); + mcr68_common_init(machine, MCR_WILLIAMS_SOUND, 16, 0); /* Pigskin doesn't care too much about this value; currently taken from Tri-Sports */ mcr68_timing_factor = attotime_make(0, HZ_TO_ATTOSECONDS(cpunum_get_clock(0) / 10) * 115); @@ -1460,7 +1460,7 @@ static DRIVER_INIT( pigskin ) static DRIVER_INIT( trisport ) { - mcr68_common_init(MCR_WILLIAMS_SOUND, 0, 0); + mcr68_common_init(machine, MCR_WILLIAMS_SOUND, 0, 0); /* Tri-Sports checks the timing of VBLANK relative to the 493 interrupt */ /* VBLANK is required to come within 87-119 E clocks (i.e., 870-1190 CPU clocks) */ diff --git a/src/mame/drivers/meadows.c b/src/mame/drivers/meadows.c index 90ac83d5714..fb0871faafd 100644 --- a/src/mame/drivers/meadows.c +++ b/src/mame/drivers/meadows.c @@ -791,12 +791,12 @@ static DRIVER_INIT( gypsyjug ) 0x01,0x80, 0x03,0xc0, 0x03,0xc0, 0x01,0x80 }; int i; - UINT8 *gfx2 = memory_region(REGION_GFX2); - UINT8 *gfx3 = memory_region(REGION_GFX3); - UINT8 *gfx4 = memory_region(REGION_GFX4); - UINT8 *gfx5 = memory_region(REGION_GFX5); - int len3 = memory_region_length(REGION_GFX3); - int len4 = memory_region_length(REGION_GFX4); + UINT8 *gfx2 = memory_region(machine, REGION_GFX2); + UINT8 *gfx3 = memory_region(machine, REGION_GFX3); + UINT8 *gfx4 = memory_region(machine, REGION_GFX4); + UINT8 *gfx5 = memory_region(machine, REGION_GFX5); + int len3 = memory_region_length(machine, REGION_GFX3); + int len4 = memory_region_length(machine, REGION_GFX4); memcpy(gfx3,gfx2,len3); @@ -815,8 +815,8 @@ static DRIVER_INIT( minferno ) UINT8 *mem; /* create an inverted copy of the graphics data */ - mem = memory_region(REGION_GFX1); - length = memory_region_length(REGION_GFX1); + mem = memory_region(machine, REGION_GFX1); + length = memory_region_length(machine, REGION_GFX1); for (i = 0; i < length/2; i++) mem[i] = ~mem[i + length/2]; } diff --git a/src/mame/drivers/mediagx.c b/src/mame/drivers/mediagx.c index 85dfd995965..556e4e0019b 100644 --- a/src/mame/drivers/mediagx.c +++ b/src/mame/drivers/mediagx.c @@ -957,7 +957,7 @@ static MACHINE_START(mediagx) static MACHINE_RESET(mediagx) { - UINT8 *rom = memory_region(REGION_USER1); + UINT8 *rom = memory_region(machine, REGION_USER1); cpunum_set_irq_callback(0, irq_callback); diff --git a/src/mame/drivers/megadriv.c b/src/mame/drivers/megadriv.c index 1e4517423f7..3a521284cde 100644 --- a/src/mame/drivers/megadriv.c +++ b/src/mame/drivers/megadriv.c @@ -563,7 +563,7 @@ static UINT16 vdp_get_word_from_68k_mem_default(UINT32 source) { if (( source >= 0x000000 ) && ( source <= 0x3fffff )) { - UINT16 *rom = (UINT16*)memory_region(REGION_CPU1); + UINT16 *rom = (UINT16*)memory_region(Machine, REGION_CPU1); return rom[(source&0x3fffff)>>1]; } else if (( source >= 0xe00000 ) && ( source <= 0xffffff )) @@ -2365,7 +2365,7 @@ static READ8_HANDLER( z80_read_68k_banked_data ) UINT32 fulladdress; fulladdress = genz80.z80_bank_addr + offset; - return memory_region(REGION_CPU1)[fulladdress^1]; // ^1? better.. + return memory_region(machine, REGION_CPU1)[fulladdress^1]; // ^1? better.. } @@ -2681,7 +2681,7 @@ static UINT32 pm_io(int reg, int write, UINT32 d) int addr = svp.pmac_read[reg]&0xffff; if ((mode & 0xfff0) == 0x0800) // ROM, inc 1, verified to be correct { - UINT16 *ROM = (UINT16 *) memory_region(REGION_CPU1); + UINT16 *ROM = (UINT16 *) memory_region(Machine, REGION_CPU1); svp.pmac_read[reg] += 1; d = ROM[addr|((mode&0xf)<<16)]; } @@ -2883,7 +2883,7 @@ static UINT16 vdp_get_word_from_68k_mem_svp(UINT32 source) { if ((source & 0xe00000) == 0x000000) { - UINT16 *rom = (UINT16*)memory_region(REGION_CPU1); + UINT16 *rom = (UINT16*)memory_region(Machine, REGION_CPU1); source -= 2; // DMA latency return rom[source >> 1]; } @@ -2933,7 +2933,7 @@ static void svp_init(running_machine *machine) svp.iram = auto_malloc(0x800); memory_set_bankptr( 3, svp.iram ); /* SVP ROM just shares m68k region.. */ - ROM = memory_region(REGION_CPU1); + ROM = memory_region(machine, REGION_CPU1); memory_set_bankptr( 4, ROM + 0x800 ); vdp_get_word_from_68k_mem = vdp_get_word_from_68k_mem_svp; @@ -5142,7 +5142,7 @@ static void megadriv_init_common(running_machine *machine) some games specify a single address, (start 200001, end 200001) this usually means there is serial eeprom instead */ int i; - UINT16 *rom = (UINT16*)memory_region(REGION_CPU1); + UINT16 *rom = (UINT16*)memory_region(machine, REGION_CPU1); mame_printf_debug("DEBUG:: Header: Backup RAM string (ignore for games without)\n"); for (i=0;i<12;i++) diff --git a/src/mame/drivers/megaplay.c b/src/mame/drivers/megaplay.c index c8027bc4f66..9715cb756c6 100644 --- a/src/mame/drivers/megaplay.c +++ b/src/mame/drivers/megaplay.c @@ -531,8 +531,8 @@ static WRITE16_HANDLER ( OLD_megaplay_genesis_io_w ) static READ8_HANDLER( bank_r ) { - UINT8* bank = memory_region(REGION_CPU3); - UINT8* game = memory_region(REGION_CPU1); + UINT8* bank = memory_region(machine, REGION_CPU3); + UINT8* game = memory_region(machine, REGION_CPU1); if(game_banksel == 0x142) // Genesis I/O return OLD_megaplay_genesis_io_r(machine, (offset & 0x1f) / 2, 0xffff); @@ -919,11 +919,11 @@ ROM_START( mp_mazin ) /* Mazin Wars */ ROM_END -static void megplay_stat(void) +static void megplay_stat(running_machine *machine) { - UINT8 *src = memory_region(REGION_CPU3); - UINT8 *instruction_rom = memory_region(REGION_USER1); - UINT8 *game_rom = memory_region(REGION_CPU1); + UINT8 *src = memory_region(machine, REGION_CPU3); + UINT8 *instruction_rom = memory_region(machine, REGION_USER1); + UINT8 *game_rom = memory_region(machine, REGION_CPU1); int offs; @@ -973,7 +973,7 @@ static DRIVER_INIT (megaplay) genesis_io_ram = auto_malloc(0x20); DRIVER_INIT_CALL(megadrij); - megplay_stat(); + megplay_stat(machine); /* for now ... */ memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa10000, 0xa1001f, 0, 0, OLD_megaplay_genesis_io_r, OLD_megaplay_genesis_io_w); diff --git a/src/mame/drivers/megasys1.c b/src/mame/drivers/megasys1.c index 3084aada86b..1594b710b45 100644 --- a/src/mame/drivers/megasys1.c +++ b/src/mame/drivers/megasys1.c @@ -2996,7 +2996,7 @@ static WRITE16_HANDLER( protection_peekaboo_w ) if ((protection_val & 0x90) == 0x90) { - UINT8 *RAM = memory_region(okim6295_interface_region_1_pin7high.region); + UINT8 *RAM = memory_region(machine, okim6295_interface_region_1_pin7high.region); int new_bank = (protection_val & 0x7) % 7; if (bank != new_bank) @@ -3639,8 +3639,8 @@ INPUT_PORTS_END void phantasm_rom_decode(int cpu) { - UINT16 *RAM = (UINT16 *) memory_region(REGION_CPU1+cpu); - int i, size = memory_region_length(REGION_CPU1+cpu); + UINT16 *RAM = (UINT16 *) memory_region(Machine, REGION_CPU1+cpu); + int i, size = memory_region_length(Machine, REGION_CPU1+cpu); if (size > 0x40000) size = 0x40000; for (i = 0 ; i < size/2 ; i++) @@ -3673,8 +3673,8 @@ void phantasm_rom_decode(int cpu) void astyanax_rom_decode(int cpu) { - UINT16 *RAM = (UINT16 *) memory_region(REGION_CPU1+cpu); - int i, size = memory_region_length(REGION_CPU1+cpu); + UINT16 *RAM = (UINT16 *) memory_region(Machine, REGION_CPU1+cpu); + int i, size = memory_region_length(Machine, REGION_CPU1+cpu); if (size > 0x40000) size = 0x40000; for (i = 0 ; i < size/2 ; i++) @@ -3707,8 +3707,8 @@ void astyanax_rom_decode(int cpu) void rodland_rom_decode(int cpu) { - UINT16 *RAM = (UINT16 *) memory_region(REGION_CPU1+cpu); - int i, size = memory_region_length(REGION_CPU1+cpu); + UINT16 *RAM = (UINT16 *) memory_region(Machine, REGION_CPU1+cpu); + int i, size = memory_region_length(Machine, REGION_CPU1+cpu); if (size > 0x40000) size = 0x40000; for (i = 0 ; i < size/2 ; i++) @@ -3742,8 +3742,8 @@ void rodland_rom_decode(int cpu) static void rodlandj_gfx_unmangle(int region) { - UINT8 *rom = memory_region(REGION_GFX1+region); - int size = memory_region_length(REGION_GFX1+region); + UINT8 *rom = memory_region(Machine, REGION_GFX1+region); + int size = memory_region_length(Machine, REGION_GFX1+region); UINT8 *buffer; int i; @@ -3774,8 +3774,8 @@ static void rodlandj_gfx_unmangle(int region) static void jitsupro_gfx_unmangle(int region) { - UINT8 *rom = memory_region(REGION_GFX1+region); - int size = memory_region_length(REGION_GFX1+region); + UINT8 *rom = memory_region(Machine, REGION_GFX1+region); + int size = memory_region_length(Machine, REGION_GFX1+region); UINT8 *buffer; int i; @@ -3804,7 +3804,7 @@ static void jitsupro_gfx_unmangle(int region) static DRIVER_INIT( 64street ) { -// UINT16 *RAM = (UINT16 *) memory_region(REGION_CPU1); +// UINT16 *RAM = (UINT16 *) memory_region(machine, REGION_CPU1); // RAM[0x006b8/2] = 0x6004; // d8001 test // RAM[0x10EDE/2] = 0x6012; // watchdog @@ -3821,7 +3821,7 @@ static DRIVER_INIT( astyanax ) astyanax_rom_decode(0); - RAM = (UINT16 *) memory_region(REGION_CPU1); + RAM = (UINT16 *) memory_region(machine, REGION_CPU1); RAM[0x0004e6/2] = 0x6040; // protection } @@ -3882,7 +3882,7 @@ static DRIVER_INIT( hachoo ) astyanax_rom_decode(0); - RAM = (UINT16 *) memory_region(REGION_CPU1); + RAM = (UINT16 *) memory_region(machine, REGION_CPU1); RAM[0x0006da/2] = 0x6000; // protection } @@ -3901,7 +3901,7 @@ static DRIVER_INIT( iganinju ) phantasm_rom_decode(0); - RAM = (UINT16 *) memory_region(REGION_CPU1); + RAM = (UINT16 *) memory_region(machine, REGION_CPU1); RAM[0x02f000/2] = 0x835d; // protection RAM[0x00006e/2] = 0x0420; // the only game that does @@ -3921,7 +3921,7 @@ static WRITE16_HANDLER( OKIM6295_data_1_both_w ) static DRIVER_INIT( jitsupro ) { - UINT16 *RAM = (UINT16 *) memory_region(REGION_CPU1); + UINT16 *RAM = (UINT16 *) memory_region(machine, REGION_CPU1); astyanax_rom_decode(0); // Code @@ -3952,7 +3952,7 @@ static DRIVER_INIT( plusalph ) astyanax_rom_decode(0); - RAM = (UINT16 *) memory_region(REGION_CPU1); + RAM = (UINT16 *) memory_region(machine, REGION_CPU1); RAM[0x0012b6/2] = 0x0000; // protection } @@ -3984,7 +3984,7 @@ static DRIVER_INIT( stdragon ) phantasm_rom_decode(0); - RAM = (UINT16 *) memory_region(REGION_CPU1); + RAM = (UINT16 *) memory_region(machine, REGION_CPU1); RAM[0x00045e/2] = 0x0098; // protection } @@ -3995,7 +3995,7 @@ static READ16_HANDLER( monkelf_input_r ) static DRIVER_INIT( monkelf ) { - UINT16 *ROM = (UINT16*)memory_region(REGION_CPU1); + UINT16 *ROM = (UINT16*)memory_region(machine, REGION_CPU1); ROM[0x00744/2] = 0x4e71; memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe0000, 0xe000f, 0, 0, monkelf_input_r); diff --git a/src/mame/drivers/megatech.c b/src/mame/drivers/megatech.c index 0cb295728f5..f8d9a0a45d3 100644 --- a/src/mame/drivers/megatech.c +++ b/src/mame/drivers/megatech.c @@ -224,7 +224,7 @@ static UINT8 mt_cart_select_reg; static READ8_HANDLER( megatech_instr_r ) { - UINT8* instr = memory_region(REGION_CPU3)+0x8000; + UINT8* instr = memory_region(machine, REGION_CPU3)+0x8000; return instr[offset/2]; // else @@ -277,13 +277,13 @@ static WRITE8_HANDLER( mt_sms_standard_rom_bank_w ) //printf("bank ram??\n"); break; case 1: - memcpy(sms_rom+0x0000, memory_region(REGION_CPU1)+bank*0x4000, 0x4000); + memcpy(sms_rom+0x0000, memory_region(machine, REGION_CPU1)+bank*0x4000, 0x4000); break; case 2: - memcpy(sms_rom+0x4000, memory_region(REGION_CPU1)+bank*0x4000, 0x4000); + memcpy(sms_rom+0x4000, memory_region(machine, REGION_CPU1)+bank*0x4000, 0x4000); break; case 3: - memcpy(sms_rom+0x8000, memory_region(REGION_CPU1)+bank*0x4000, 0x4000); + memcpy(sms_rom+0x8000, memory_region(machine, REGION_CPU1)+bank*0x4000, 0x4000); break; } @@ -333,7 +333,7 @@ static void megatech_set_genz80_as_sms_standard_map(running_machine *machine) memory_install_readwrite8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x0000, 0xbfff, 0, 0, SMH_BANK5, SMH_UNMAP); memory_set_bankptr( 5, sms_rom ); - memcpy(sms_rom, memory_region(REGION_CPU1), 0x400000); + memcpy(sms_rom, memory_region(machine, REGION_CPU1), 0x400000); /* main ram area */ sms_mainram = auto_malloc(0x2000); // 8kb of main ram @@ -363,8 +363,8 @@ static void megatech_select_game(running_machine *machine, int gameno) cpunum_set_input_line(machine, 1, INPUT_LINE_HALT, ASSERT_LINE); sndti_reset(SOUND_YM2612, 0); - game_region = memory_region(REGION_USER1 + (gameno*2) + 0); - bios_region = memory_region(REGION_USER1 + (gameno*2) + 1); + game_region = memory_region(machine, REGION_USER1 + (gameno*2) + 0); + bios_region = memory_region(machine, REGION_USER1 + (gameno*2) + 1); megadriv_stop_scanline_timer();// stop the scanline timer for the genesis vdp... it can be restarted in video eof when needed segae_md_sms_stop_scanline_timer();// stop the scanline timer for the sms vdp @@ -373,8 +373,8 @@ static void megatech_select_game(running_machine *machine, int gameno) /* if the regions exist we're fine */ if (game_region && bios_region) { - memcpy(memory_region(REGION_CPU3)+0x8000, bios_region, 0x8000); - memcpy(memory_region(REGION_CPU1), game_region, 0x300000); + memcpy(memory_region(machine, REGION_CPU3)+0x8000, bios_region, 0x8000); + memcpy(memory_region(machine, REGION_CPU1), game_region, 0x300000); // I store an extra byte at the end of the instruction rom region when loading // to indicate if the current cart is an SMS cart.. the original hardware @@ -410,8 +410,8 @@ static void megatech_select_game(running_machine *machine, int gameno) // cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, ASSERT_LINE); /* no cart.. */ - memset(memory_region(REGION_CPU3)+0x8000, 0x00, 0x8000); - memset(memory_region(REGION_CPU1), 0x00, 0x300000); + memset(memory_region(machine, REGION_CPU3)+0x8000, 0x00, 0x8000); + memset(memory_region(machine, REGION_CPU1), 0x00, 0x300000); } return; @@ -435,21 +435,21 @@ static WRITE8_HANDLER( megatech_cart_select_w ) if (mt_cart_select_reg==2) { printf("game 2 selected\n"); - memcpy(memory_region(REGION_CPU3)+0x8000, memory_region(REGION_USER2), 0x8000); + memcpy(memory_region(machine, REGION_CPU3)+0x8000, memory_region(machine, REGION_USER2), 0x8000); } // else if (mt_cart_select_reg==0) // { // printf("game 0 selected\n"); -// memcpy(memory_region(REGION_CPU3)+0x8000, memory_region(REGION_USER4), 0x8000); +// memcpy(memory_region(machine, REGION_CPU3)+0x8000, memory_region(machine, REGION_USER4), 0x8000); // } else if (mt_cart_select_reg==6) { printf("game 6 selected\n"); - memcpy(memory_region(REGION_CPU3)+0x8000, memory_region(REGION_USER6), 0x8000); + memcpy(memory_region(machine, REGION_CPU3)+0x8000, memory_region(machine, REGION_USER6), 0x8000); } else { - memset(memory_region(REGION_CPU3)+0x8000, 0x00, 0x8000); + memset(memory_region(machine, REGION_CPU3)+0x8000, 0x00, 0x8000); } */ diff --git a/src/mame/drivers/megazone.c b/src/mame/drivers/megazone.c index ba20f401bab..19ac78403df 100644 --- a/src/mame/drivers/megazone.c +++ b/src/mame/drivers/megazone.c @@ -587,7 +587,7 @@ ROM_END static DRIVER_INIT( megazone ) { - konami1_decode(0); + konami1_decode(machine, 0); } /* these just display a Konami copyright, no logo */ diff --git a/src/mame/drivers/merit.c b/src/mame/drivers/merit.c index 991f20385e3..763fe2b275e 100644 --- a/src/mame/drivers/merit.c +++ b/src/mame/drivers/merit.c @@ -44,7 +44,7 @@ static int decryption_key; static READ8_HANDLER( questions_r ) { - UINT8 *questions = memory_region(REGION_USER1); + UINT8 *questions = memory_region(machine, REGION_USER1); int address; switch(question_address >> 16) diff --git a/src/mame/drivers/meritm.c b/src/mame/drivers/meritm.c index 4f5a62c76e5..fc72117d52b 100644 --- a/src/mame/drivers/meritm.c +++ b/src/mame/drivers/meritm.c @@ -427,7 +427,7 @@ static WRITE8_HANDLER(meritm_crt250_questions_bank_w) return; } - dst = memory_region(REGION_CPU1) + 0x70000 + 2; + dst = memory_region(machine, REGION_CPU1) + 0x70000 + 2; if (data == 0) { @@ -456,7 +456,7 @@ static WRITE8_HANDLER(meritm_crt250_questions_bank_w) default: logerror( "meritm_crt250_questions_bank_w: unknown data = %02x\n", data ); return; } logerror( "Reading question byte at %06X\n", questions_address | questions_loword_address); - *dst = memory_region(REGION_USER1)[questions_address | questions_loword_address]; + *dst = memory_region(machine, REGION_USER1)[questions_address | questions_loword_address]; } }; @@ -828,7 +828,7 @@ static MACHINE_START(merit_common) static MACHINE_START(meritm_crt250) { - memory_configure_bank(1, 0, 8, memory_region(REGION_CPU1), 0x10000); + memory_configure_bank(1, 0, 8, memory_region(machine, REGION_CPU1), 0x10000); meritm_bank = 0xff; meritm_crt250_switch_banks(); machine_start_merit_common(machine); @@ -846,8 +846,8 @@ static MACHINE_START(meritm_crt260) { meritm_ram = auto_malloc( 0x8000 ); memset( meritm_ram, 0x8000, 0x00 ); - memory_configure_bank(1, 0, 128, memory_region(REGION_CPU1), 0x8000); - memory_configure_bank(2, 0, 128, memory_region(REGION_CPU1), 0x8000); + memory_configure_bank(1, 0, 128, memory_region(machine, REGION_CPU1), 0x8000); + memory_configure_bank(2, 0, 128, memory_region(machine, REGION_CPU1), 0x8000); memory_configure_bank(3, 0, 4, meritm_ram, 0x2000); meritm_bank = 0xff; meritm_psd_a15 = 0; @@ -868,8 +868,8 @@ static NVRAM_HANDLER(meritm_crt260) if (file) mame_fread(file, meritm_ram, 0x8000); else - if ( memory_region(REGION_USER1) ) - memcpy(meritm_ram, memory_region(REGION_USER1), 0x8000); + if ( memory_region(machine, REGION_USER1) ) + memcpy(meritm_ram, memory_region(machine, REGION_USER1), 0x8000); }; // from MSX2 driver, may be not accurate for merit games diff --git a/src/mame/drivers/metro.c b/src/mame/drivers/metro.c index b39959719f7..c507131f5b8 100644 --- a/src/mame/drivers/metro.c +++ b/src/mame/drivers/metro.c @@ -385,7 +385,7 @@ static WRITE16_HANDLER( metro_soundstatus_w ) static WRITE8_HANDLER( metro_sound_rombank_w ) { int bankaddress; - UINT8 *ROM = memory_region(REGION_CPU2); + UINT8 *ROM = memory_region(machine, REGION_CPU2); bankaddress = 0x10000-0x4000 + ((data >> 4) & 0x03) * 0x4000; if (bankaddress < 0x10000) bankaddress = 0x0000; @@ -396,7 +396,7 @@ static WRITE8_HANDLER( metro_sound_rombank_w ) static WRITE8_HANDLER( daitorid_sound_rombank_w ) { int bankaddress; - UINT8 *ROM = memory_region(REGION_CPU2); + UINT8 *ROM = memory_region(machine, REGION_CPU2); bankaddress = 0x10000-0x4000 + ((data >> 4) & 0x07) * 0x4000; if (bankaddress < 0x10000) bankaddress = 0x10000; @@ -616,8 +616,8 @@ static READ16_HANDLER( metro_bankedrom_r ) { const int region = REGION_GFX1; - UINT8 *ROM = memory_region( region ); - size_t len = memory_region_length( region ); + UINT8 *ROM = memory_region( machine, region ); + size_t len = memory_region_length( machine, region ); offset = offset * 2 + 0x10000 * (*metro_rombank); @@ -707,8 +707,8 @@ static WRITE16_HANDLER( metro_blitter_w ) { const int region = REGION_GFX1; - UINT8 *src = memory_region(region); - size_t src_len = memory_region_length(region); + UINT8 *src = memory_region(machine, region); + size_t src_len = memory_region_length(machine, region); UINT32 tmap = (metro_blitter_regs[ 0x00 / 2 ] << 16 ) + metro_blitter_regs[ 0x02 / 2 ]; @@ -1932,7 +1932,7 @@ static WRITE16_HANDLER( blzntrnd_sound_w ) static WRITE8_HANDLER( blzntrnd_sh_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_CPU2); + UINT8 *RAM = memory_region(machine, REGION_CPU2); int bankaddress; bankaddress = 0x10000 + (data & 0x03) * 0x4000; @@ -4782,8 +4782,8 @@ static DRIVER_INIT( balcube ) { const int region = REGION_GFX1; - const size_t len = memory_region_length(region); - UINT8 *src = memory_region(region); + const size_t len = memory_region_length(machine, region); + UINT8 *src = memory_region(machine, region); UINT8 *end = src + len; while(src < end) @@ -4805,7 +4805,7 @@ static DRIVER_INIT( balcube ) static DRIVER_INIT( dharmak ) { - UINT8 *src = memory_region( REGION_GFX1 ); + UINT8 *src = memory_region( machine, REGION_GFX1 ); int i; for (i=0;i<0x200000;i+=4) { diff --git a/src/mame/drivers/micro3d.c b/src/mame/drivers/micro3d.c index dc887429c7e..83f919ca468 100644 --- a/src/mame/drivers/micro3d.c +++ b/src/mame/drivers/micro3d.c @@ -173,7 +173,7 @@ static MACHINE_RESET( micro3d ) static DRIVER_INIT( stankatk ) { - UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *rom = (UINT16 *)memory_region(machine, REGION_CPU1); rom[0x1F543]=0x4E71; /* 3ea86 - nop */ rom[0x1F546]=0x4E71; /* 3ea8c - nop */ rom[0x1F596]=0x4E71; @@ -188,7 +188,7 @@ static DRIVER_INIT( stankatk ) static DRIVER_INIT( botss ) { - UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *rom = (UINT16 *)memory_region(machine, REGION_CPU1); rom[0x1FCC0]=0x4E71; /* Eliminate startup Am29000 timeout */ rom[0x1FBF0]=0x4E71; /* Skip AM29k code version detect */ rom[0x1FC88]=0x4E71; @@ -200,12 +200,12 @@ static DRIVER_INIT( botss ) static DRIVER_INIT( f15se ) { -// UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1); +// UINT16 *rom = (UINT16 *)memory_region(machine, REGION_CPU1); } static DRIVER_INIT( f15se21 ) { - UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *rom = (UINT16 *)memory_region(machine, REGION_CPU1); rom[0x2A8B3]=0x6006; //055166: 6606 bne 5516e -> bra rom[0x2A8BF]=0x4E71; //05517E: 6704 beq 55184 -> nop diff --git a/src/mame/drivers/midas.c b/src/mame/drivers/midas.c index 73f6b7cb33c..2fdfbf47acb 100644 --- a/src/mame/drivers/midas.c +++ b/src/mame/drivers/midas.c @@ -580,7 +580,7 @@ ROM_END static DRIVER_INIT( livequiz ) { - UINT16 *rom = (UINT16 *) memory_region(REGION_CPU1); + UINT16 *rom = (UINT16 *) memory_region(machine, REGION_CPU1); // PROTECTION CHECKS rom[0x13345a/2] = 0x4e75; diff --git a/src/mame/drivers/midvunit.c b/src/mame/drivers/midvunit.c index d3a488f9369..ccee383c6f5 100644 --- a/src/mame/drivers/midvunit.c +++ b/src/mame/drivers/midvunit.c @@ -73,7 +73,7 @@ static MACHINE_RESET( midvunit ) dcs_reset_w(1); dcs_reset_w(0); - memcpy(ram_base, memory_region(REGION_USER1), 0x20000*4); + memcpy(ram_base, memory_region(machine, REGION_USER1), 0x20000*4); timer[0] = timer_alloc(NULL, NULL); timer[1] = timer_alloc(NULL, NULL); @@ -85,7 +85,7 @@ static MACHINE_RESET( midvplus ) dcs_reset_w(1); dcs_reset_w(0); - memcpy(ram_base, memory_region(REGION_USER1), 0x20000*4); + memcpy(ram_base, memory_region(machine, REGION_USER1), 0x20000*4); timer[0] = timer_alloc(NULL, NULL); timer[1] = timer_alloc(NULL, NULL); diff --git a/src/mame/drivers/midzeus.c b/src/mame/drivers/midzeus.c index ec505ed0e95..042144199de 100644 --- a/src/mame/drivers/midzeus.c +++ b/src/mame/drivers/midzeus.c @@ -98,7 +98,7 @@ static MACHINE_START( midzeus2 ) static MACHINE_RESET( midzeus ) { - memcpy(ram_base, memory_region(REGION_USER1), 0x40000*4); + memcpy(ram_base, memory_region(machine, REGION_USER1), 0x40000*4); *ram_base <<= 1; cmos_protected = TRUE; @@ -1343,7 +1343,7 @@ static DRIVER_INIT( crusnexo ) { dcs2_init(machine, 0, 0); midway_ioasic_init(machine, MIDWAY_IOASIC_STANDARD, 472/* or 476,477,478,110 */, 99, NULL); - memory_configure_bank(1, 0, 3, memory_region(REGION_USER2), 0x400000*4); + memory_configure_bank(1, 0, 3, memory_region(machine, REGION_USER2), 0x400000*4); memory_install_readwrite32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x9b0004, 0x9b0007, 0, 0, crusnexo_leds_r, crusnexo_leds_w); memory_install_write32_handler (machine, 0, ADDRESS_SPACE_PROGRAM, 0x8d0009, 0x8d000a, 0, 0, keypad_select_w); @@ -1354,7 +1354,7 @@ static DRIVER_INIT( thegrid ) { dcs2_init(machine, 0, 0); midway_ioasic_init(machine, MIDWAY_IOASIC_STANDARD, 474/* or 491 */, 99, NULL); - memory_configure_bank(1, 0, 3, memory_region(REGION_USER2), 0x400000*4); + memory_configure_bank(1, 0, 3, memory_region(machine, REGION_USER2), 0x400000*4); } diff --git a/src/mame/drivers/mirage.c b/src/mame/drivers/mirage.c index 64a2b10a81f..240c848baca 100644 --- a/src/mame/drivers/mirage.c +++ b/src/mame/drivers/mirage.c @@ -396,10 +396,10 @@ ROM_START( mirage ) ROM_LOAD( "mbl-04.12k", 0x000000, 0x100000, CRC(b533123d) SHA1(2cb2f11331d00c2d282113932ed2836805f4fc6e) ) ROM_END -static void descramble_sound( int region ) +static void descramble_sound( running_machine *machine, int region ) { - UINT8 *rom = memory_region(region); - int length = memory_region_length(region); + UINT8 *rom = memory_region(machine, region); + int length = memory_region_length(machine, region); UINT8 *buf1 = malloc_or_die(length); UINT32 x; @@ -438,8 +438,8 @@ static void descramble_sound( int region ) static DRIVER_INIT( mirage ) { - deco56_decrypt(REGION_GFX1); - descramble_sound(REGION_SOUND1); + deco56_decrypt(machine, REGION_GFX1); + descramble_sound(machine, REGION_SOUND1); } GAME( 1994, mirage, 0, mirage, mirage, mirage, ROT0, "Mitchell", "Mirage Youjuu Mahjongden (Japan)", GAME_NOT_WORKING ) diff --git a/src/mame/drivers/missb2.c b/src/mame/drivers/missb2.c index 7aee66fc7b9..d66a7adb6b7 100644 --- a/src/mame/drivers/missb2.c +++ b/src/mame/drivers/missb2.c @@ -54,7 +54,7 @@ static VIDEO_UPDATE( missb2 ) sx = 0; - prom = memory_region(REGION_PROMS); + prom = memory_region(screen->machine, REGION_PROMS); for (offs = 0;offs < bublbobl_objectram_size;offs += 4) { /* skip empty sprites */ @@ -132,7 +132,7 @@ static WRITE8_HANDLER( bg_paletteram_RRRRGGGGBBBBxxxx_be_w ) static WRITE8_HANDLER( missb2_bg_bank_w ) { int bankaddress; - UINT8 *RAM = memory_region(REGION_CPU2); + UINT8 *RAM = memory_region(machine, REGION_CPU2); // I don't know how this is really connected,bit 1 is always high afaik... bankaddress = ((data & 2) ? 0x1000 : 0x0000) | ((data & 1) ? 0x4000 : 0x0000) | (0x8000); @@ -435,7 +435,7 @@ ROM_END static DRIVER_INIT( missb2 ) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); /* in Bubble Bobble, bank 0 has code falling from 7fff to 8000, so I have to copy it there because bank switching wouldn't catch it */ diff --git a/src/mame/drivers/missile.c b/src/mame/drivers/missile.c index f7a07c241ed..ee812cf3983 100644 --- a/src/mame/drivers/missile.c +++ b/src/mame/drivers/missile.c @@ -371,7 +371,7 @@ static OPBASE_HANDLER( missile_opbase_handler ) /* ROM? */ else if (address >= 0x5000) { - opbase->rom = opbase->ram = memory_region(REGION_CPU1) - offset; + opbase->rom = opbase->ram = memory_region(machine, REGION_CPU1) - offset; return ~0; } @@ -383,7 +383,7 @@ static OPBASE_HANDLER( missile_opbase_handler ) static MACHINE_START( missile ) { /* initialize globals */ - writeprom = memory_region(REGION_PROMS); + writeprom = memory_region(machine, REGION_PROMS); flipscreen = 0; /* set up an opcode base handler since we use mapped handlers for RAM */ @@ -644,7 +644,7 @@ static READ8_HANDLER( missile_r ) /* ROM */ else if (offset >= 0x5000) - result = memory_region(REGION_CPU1)[offset]; + result = memory_region(machine, REGION_CPU1)[offset]; /* POKEY */ else if (offset < 0x4800) @@ -1025,7 +1025,7 @@ ROM_END static DRIVER_INIT( suprmatk ) { int i; - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); for (i = 0; i < 0x40; i++) { diff --git a/src/mame/drivers/mitchell.c b/src/mame/drivers/mitchell.c index 132bbd0cb5e..f12de75a9ea 100644 --- a/src/mame/drivers/mitchell.c +++ b/src/mame/drivers/mitchell.c @@ -2194,16 +2194,16 @@ ROM_START( blockbl ) ROM_END -static void bootleg_decode(void) +static void bootleg_decode(running_machine *machine) { - memory_set_decrypted_region(0, 0x0000, 0x7fff, memory_region(REGION_CPU1) + 0x50000); - memory_configure_bank_decrypted(1, 0, 16, memory_region(REGION_CPU1) + 0x60000, 0x4000); + memory_set_decrypted_region(0, 0x0000, 0x7fff, memory_region(machine, REGION_CPU1) + 0x50000); + memory_configure_bank_decrypted(1, 0, 16, memory_region(machine, REGION_CPU1) + 0x60000, 0x4000); } -static void configure_banks(void) +static void configure_banks(running_machine *machine) { - memory_configure_bank(1, 0, 16, memory_region(REGION_CPU1) + 0x10000, 0x4000); + memory_configure_bank(1, 0, 16, memory_region(machine, REGION_CPU1) + 0x10000, 0x4000); pang_port5_kludge = 0; } @@ -2212,66 +2212,66 @@ static DRIVER_INIT( dokaben ) { input_type = 0; nvram_size = 0; - mgakuen2_decode(); - configure_banks(); + mgakuen2_decode(machine); + configure_banks(machine); } static DRIVER_INIT( pang ) { input_type = 0; nvram_size = 0; - pang_decode(); - configure_banks(); + pang_decode(machine); + configure_banks(machine); } static DRIVER_INIT( pangb ) { input_type = 0; nvram_size = 0; - bootleg_decode(); - configure_banks(); + bootleg_decode(machine); + configure_banks(machine); } static DRIVER_INIT( cworld ) { input_type = 0; nvram_size = 0; - cworld_decode(); - configure_banks(); + cworld_decode(machine); + configure_banks(machine); } static DRIVER_INIT( hatena ) { input_type = 0; nvram_size = 0; - hatena_decode(); - configure_banks(); + hatena_decode(machine); + configure_banks(machine); } static DRIVER_INIT( spang ) { input_type = 3; nvram_size = 0x80; - nvram = &memory_region(REGION_CPU1)[0xe000]; /* NVRAM */ - spang_decode(); - configure_banks(); + nvram = &memory_region(machine, REGION_CPU1)[0xe000]; /* NVRAM */ + spang_decode(machine); + configure_banks(machine); } static DRIVER_INIT( spangbl ) { input_type = 3; nvram_size = 0x80; - nvram = &memory_region(REGION_CPU1)[0xe000]; /* NVRAM */ - bootleg_decode(); - configure_banks(); + nvram = &memory_region(machine, REGION_CPU1)[0xe000]; /* NVRAM */ + bootleg_decode(machine); + configure_banks(machine); } static DRIVER_INIT( spangj ) { input_type = 3; nvram_size = 0x80; - nvram = &memory_region(REGION_CPU1)[0xe000]; /* NVRAM */ - spangj_decode(); - configure_banks(); + nvram = &memory_region(machine, REGION_CPU1)[0xe000]; /* NVRAM */ + spangj_decode(machine); + configure_banks(machine); /* fix data that will be written to nvram */ { - UINT8 *rom = memory_region(REGION_CPU1) + 0x10000; + UINT8 *rom = memory_region(machine, REGION_CPU1) + 0x10000; rom[0x0183] = 0xcd; rom[0x0184] = 0x81; rom[0x0185] = 0x0e; @@ -2281,74 +2281,74 @@ static DRIVER_INIT( sbbros ) { input_type = 3; nvram_size = 0x80; - nvram = &memory_region(REGION_CPU1)[0xe000]; /* NVRAM */ - sbbros_decode(); - configure_banks(); + nvram = &memory_region(machine, REGION_CPU1)[0xe000]; /* NVRAM */ + sbbros_decode(machine); + configure_banks(machine); } static DRIVER_INIT( qtono1 ) { input_type = 0; nvram_size = 0; - qtono1_decode(); - configure_banks(); + qtono1_decode(machine); + configure_banks(machine); } static DRIVER_INIT( qsangoku ) { input_type = 0; nvram_size = 0; - qsangoku_decode(); - configure_banks(); + qsangoku_decode(machine); + configure_banks(machine); } static DRIVER_INIT( mgakuen ) { input_type = 1; - configure_banks(); + configure_banks(machine); } static DRIVER_INIT( mgakuen2 ) { input_type = 1; nvram_size = 0; - mgakuen2_decode(); - configure_banks(); + mgakuen2_decode(machine); + configure_banks(machine); pang_port5_kludge = 1; } static DRIVER_INIT( pkladies ) { input_type = 1; nvram_size = 0; - mgakuen2_decode(); - configure_banks(); + mgakuen2_decode(machine); + configure_banks(machine); } static DRIVER_INIT( marukin ) { input_type = 1; nvram_size = 0; - marukin_decode(); - configure_banks(); + marukin_decode(machine); + configure_banks(machine); } static DRIVER_INIT( block ) { input_type = 2; nvram_size = 0x80; - nvram = &memory_region(REGION_CPU1)[0xff80]; /* NVRAM */ - block_decode(); - configure_banks(); + nvram = &memory_region(machine, REGION_CPU1)[0xff80]; /* NVRAM */ + block_decode(machine); + configure_banks(machine); } static DRIVER_INIT( blockbl ) { input_type = 2; nvram_size = 0x80; - nvram = &memory_region(REGION_CPU1)[0xff80]; /* NVRAM */ - bootleg_decode(); - configure_banks(); + nvram = &memory_region(machine, REGION_CPU1)[0xff80]; /* NVRAM */ + bootleg_decode(machine); + configure_banks(machine); } static DRIVER_INIT( mstworld ) { /* descramble the program rom .. */ - int len = memory_region_length(REGION_CPU1); + int len = memory_region_length(machine, REGION_CPU1); UINT8* source = malloc_or_die(len); - UINT8* dst = memory_region(REGION_CPU1) ; + UINT8* dst = memory_region(machine, REGION_CPU1) ; int x; static const int tablebank[]= @@ -2386,8 +2386,8 @@ static DRIVER_INIT( mstworld ) } free(source); - bootleg_decode(); - configure_banks(); + bootleg_decode(machine); + configure_banks(machine); } diff --git a/src/mame/drivers/mjkjidai.c b/src/mame/drivers/mjkjidai.c index 3026426dd43..32e04bf9920 100644 --- a/src/mame/drivers/mjkjidai.c +++ b/src/mame/drivers/mjkjidai.c @@ -22,6 +22,7 @@ TODO: ***************************************************************************/ #include "driver.h" +#include "deprecat.h" #include "streams.h" #include "sound/sn76496.h" #include "sound/okim6295.h" @@ -78,7 +79,7 @@ static void *mjkjidai_adpcm_start (int clock, const struct CustomSound_interface struct mjkjidai_adpcm_state *state = &mjkjidai_adpcm; state->playing = 0; state->stream = stream_create(0, 1, clock, state, mjkjidai_adpcm_callback); - state->base = memory_region(REGION_SOUND1); + state->base = memory_region(Machine, REGION_SOUND1); reset_adpcm(&state->adpcm); return state; } diff --git a/src/mame/drivers/mjsister.c b/src/mame/drivers/mjsister.c index f7ec4793692..b15c725ea72 100644 --- a/src/mame/drivers/mjsister.c +++ b/src/mame/drivers/mjsister.c @@ -35,7 +35,7 @@ static UINT32 dac_adr,dac_bank,dac_adr_s,dac_adr_e,dac_busy; static TIMER_CALLBACK( dac_callback ) { - UINT8 *DACROM = memory_region(REGION_SOUND1); + UINT8 *DACROM = memory_region(machine, REGION_SOUND1); DAC_data_w(0,DACROM[(dac_bank * 0x10000 + dac_adr++) & 0x1ffff]); @@ -68,7 +68,7 @@ static MACHINE_RESET( mjsister ) static WRITE8_HANDLER( mjsister_banksel1_w ) { - UINT8 *BANKROM = memory_region(REGION_CPU1); + UINT8 *BANKROM = memory_region(machine, REGION_CPU1); int tmp = mjsister_colorbank; switch (data) @@ -104,7 +104,7 @@ static WRITE8_HANDLER( mjsister_banksel1_w ) static WRITE8_HANDLER( mjsister_banksel2_w ) { - UINT8 *BANKROM = memory_region(REGION_CPU1); + UINT8 *BANKROM = memory_region(machine, REGION_CPU1); switch (data) { diff --git a/src/mame/drivers/mlanding.c b/src/mame/drivers/mlanding.c index d695d7c689c..8e0508b0ba0 100644 --- a/src/mame/drivers/mlanding.c +++ b/src/mame/drivers/mlanding.c @@ -84,7 +84,7 @@ static WRITE16_HANDLER(ml_subreset_w) static WRITE8_HANDLER( sound_bankswitch_w ) { data=0; - memory_set_bankptr( 1, memory_region(REGION_CPU2) + ((data) & 0x03) * 0x4000 + 0x10000 ); + memory_set_bankptr( 1, memory_region(machine, REGION_CPU2) + ((data) & 0x03) * 0x4000 + 0x10000 ); } static int adpcm_pos; @@ -100,7 +100,7 @@ static void ml_msm5205_vck(running_machine *machine, int chip) } else { - adpcm_data = memory_region(REGION_SOUND1)[adpcm_pos]; + adpcm_data = memory_region(machine, REGION_SOUND1)[adpcm_pos]; adpcm_pos = (adpcm_pos + 1) & 0xffff; MSM5205_data_w(0, adpcm_data >> 4); } @@ -436,7 +436,7 @@ ROM_END static DRIVER_INIT(mlanding) { - UINT8 *rom = memory_region(REGION_CPU3); + UINT8 *rom = memory_region(machine, REGION_CPU3); rom[0x88b]=0x4e; rom[0x88a]=0x71; } diff --git a/src/mame/drivers/model1.c b/src/mame/drivers/model1.c index 464d7667e91..f9fb3804a64 100644 --- a/src/mame/drivers/model1.c +++ b/src/mame/drivers/model1.c @@ -665,7 +665,7 @@ static WRITE16_HANDLER( bank_w ) if(ACCESSING_BITS_0_7) { switch(data & 0xf) { case 0x1: // 100000-1fffff data roms banking - memory_set_bankptr(1, memory_region(REGION_CPU1) + 0x1000000 + 0x100000*((data >> 4) & 0xf)); + memory_set_bankptr(1, memory_region(machine, REGION_CPU1) + 0x1000000 + 0x100000*((data >> 4) & 0xf)); logerror("BANK %x\n", 0x1000000 + 0x100000*((data >> 4) & 0xf)); break; case 0x2: // 200000-2fffff data roms banking (unused, all known games have only one bank) @@ -731,7 +731,7 @@ static INTERRUPT_GEN(model1_interrupt) static MACHINE_RESET(model1) { - memory_set_bankptr(1, memory_region(REGION_CPU1) + 0x1000000); + memory_set_bankptr(1, memory_region(machine, REGION_CPU1) + 0x1000000); irq_init(machine); model1_tgp_reset(!strcmp(machine->gamedrv->name, "swa") || !strcmp(machine->gamedrv->name, "wingwar") || !strcmp(machine->gamedrv->name, "wingwara")); if (!strcmp(machine->gamedrv->name, "swa")) @@ -750,7 +750,7 @@ static MACHINE_RESET(model1) static MACHINE_RESET(model1_vr) { - memory_set_bankptr(1, memory_region(REGION_CPU1) + 0x1000000); + memory_set_bankptr(1, memory_region(machine, REGION_CPU1) + 0x1000000); irq_init(machine); model1_vr_tgp_reset(); model1_sound_irq = 3; diff --git a/src/mame/drivers/model2.c b/src/mame/drivers/model2.c index f74b3d77647..d8d8ce491e7 100644 --- a/src/mame/drivers/model2.c +++ b/src/mame/drivers/model2.c @@ -366,11 +366,11 @@ static MACHINE_RESET(model2o) static MACHINE_RESET(model2_scsp) { - memory_set_bankptr(4, memory_region(REGION_SOUND1) + 0x200000); - memory_set_bankptr(5, memory_region(REGION_SOUND1) + 0x600000); + memory_set_bankptr(4, memory_region(machine, REGION_SOUND1) + 0x200000); + memory_set_bankptr(5, memory_region(machine, REGION_SOUND1) + 0x600000); // copy the 68k vector table into RAM - memcpy(model2_soundram, memory_region(REGION_CPU2)+0x80000, 16); + memcpy(model2_soundram, memory_region(machine, REGION_CPU2)+0x80000, 16); } static MACHINE_RESET(model2) @@ -1080,7 +1080,7 @@ static int model2_maxxstate = 0; static READ32_HANDLER( maxx_r ) { - UINT32 *ROM = (UINT32 *)memory_region(REGION_CPU1); + UINT32 *ROM = (UINT32 *)memory_region(machine, REGION_CPU1); if (offset <= 0x1f/4) { @@ -1660,9 +1660,9 @@ ADDRESS_MAP_END static WRITE16_HANDLER( model2snd_ctrl ) { // handle sample banking - if (memory_region_length(REGION_SOUND1) > 0x800000) + if (memory_region_length(machine, REGION_SOUND1) > 0x800000) { - UINT8 *snd = memory_region(REGION_SOUND1); + UINT8 *snd = memory_region(machine, REGION_SOUND1); if (data & 0x20) { memory_set_bankptr(4, snd + 0x200000); @@ -4028,7 +4028,7 @@ static DRIVER_INIT( genprot ) static DRIVER_INIT( pltkids ) { - UINT32 *ROM = (UINT32 *)memory_region(REGION_CPU1); + UINT32 *ROM = (UINT32 *)memory_region(machine, REGION_CPU1); memory_install_readwrite32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x01d80000, 0x01dfffff, 0, 0, model2_prot_r, model2_prot_w); protstate = protpos = 0; @@ -4039,7 +4039,7 @@ static DRIVER_INIT( pltkids ) static DRIVER_INIT( zerogun ) { - UINT32 *ROM = (UINT32 *)memory_region(REGION_CPU1); + UINT32 *ROM = (UINT32 *)memory_region(machine, REGION_CPU1); memory_install_readwrite32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x01d80000, 0x01dfffff, 0, 0, model2_prot_r, model2_prot_w); protstate = protpos = 0; @@ -4055,7 +4055,7 @@ static DRIVER_INIT( daytonam ) static DRIVER_INIT( sgt24h ) { - UINT32 *ROM = (UINT32 *)memory_region(REGION_CPU1); + UINT32 *ROM = (UINT32 *)memory_region(machine, REGION_CPU1); memory_install_readwrite32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x01d80000, 0x01dfffff, 0, 0, model2_prot_r, model2_prot_w); protstate = protpos = 0; @@ -4066,7 +4066,7 @@ static DRIVER_INIT( sgt24h ) static DRIVER_INIT( doa ) { - UINT32 *ROM = (UINT32 *)memory_region(REGION_CPU1); + UINT32 *ROM = (UINT32 *)memory_region(machine, REGION_CPU1); memory_install_readwrite32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x01d80000, 0x01dfffff, 0, 0, model2_prot_r, model2_prot_w); protstate = protpos = 0; diff --git a/src/mame/drivers/model3.c b/src/mame/drivers/model3.c index 827709830c6..6f53ea15901 100644 --- a/src/mame/drivers/model3.c +++ b/src/mame/drivers/model3.c @@ -1012,13 +1012,13 @@ static MACHINE_START(model3_21) static void model3_init(running_machine *machine, int step) { model3_step = step; - memory_set_bankptr( 1, memory_region( REGION_USER1 ) + 0x800000 ); /* banked CROM */ + memory_set_bankptr( 1, memory_region( machine, REGION_USER1 ) + 0x800000 ); /* banked CROM */ - memory_set_bankptr(4, memory_region(REGION_SOUND1) + 0x200000); - memory_set_bankptr(5, memory_region(REGION_SOUND1) + 0x600000); + memory_set_bankptr(4, memory_region(machine, REGION_SOUND1) + 0x200000); + memory_set_bankptr(5, memory_region(machine, REGION_SOUND1) + 0x600000); // copy the 68k vector table into RAM - memcpy(model3_soundram, memory_region(REGION_CPU2)+0x80000, 16); + memcpy(model3_soundram, memory_region(machine, REGION_CPU2)+0x80000, 16); model3_machine_init(step); // step 1.5 model3_tap_reset(); @@ -1276,7 +1276,7 @@ static WRITE64_HANDLER( model3_sys_w ) data >>= 56; data = (~data) & 0xf; - memory_set_bankptr( 1, memory_region( REGION_USER1 ) + 0x800000 + (data * 0x800000)); /* banked CROM */ + memory_set_bankptr( 1, memory_region( machine, REGION_USER1 ) + 0x800000 + (data * 0x800000)); /* banked CROM */ } if (ACCESSING_BITS_24_31) { @@ -1495,7 +1495,7 @@ static WRITE64_HANDLER(daytona2_rombank_w) { data >>= 56; data = (~data) & 0xf; - memory_set_bankptr( 1, memory_region( REGION_USER1 ) + 0x800000 + (data * 0x800000)); /* banked CROM */ + memory_set_bankptr( 1, memory_region( machine, REGION_USER1 ) + 0x800000 + (data * 0x800000)); /* banked CROM */ } } @@ -3998,9 +3998,9 @@ ROM_END static WRITE16_HANDLER( model3snd_ctrl ) { // handle sample banking - if (memory_region_length(REGION_SOUND1) > 0x800000) + if (memory_region_length(machine, REGION_SOUND1) > 0x800000) { - UINT8 *snd = memory_region(REGION_SOUND1); + UINT8 *snd = memory_region(machine, REGION_SOUND1); if (data & 0x20) { memory_set_bankptr(4, snd + 0x200000); @@ -4244,13 +4244,13 @@ static MACHINE_DRIVER_START( model3_21 ) MDRV_SOUND_ROUTE(0, "right", 2.0) MACHINE_DRIVER_END -static void interleave_vroms(void) +static void interleave_vroms(running_machine *machine) { int start; int i,j,x; - UINT16 *vrom1 = (UINT16*)memory_region(REGION_USER3); - UINT16 *vrom2 = (UINT16*)memory_region(REGION_USER4); - int vrom_length = memory_region_length(REGION_USER3); + UINT16 *vrom1 = (UINT16*)memory_region(machine, REGION_USER3); + UINT16 *vrom2 = (UINT16*)memory_region(machine, REGION_USER4); + int vrom_length = memory_region_length(machine, REGION_USER3); UINT16 *vrom; model3_vrom = auto_malloc(0x4000000); @@ -4276,7 +4276,7 @@ static void interleave_vroms(void) static DRIVER_INIT( model3_10 ) { - interleave_vroms(); + interleave_vroms(machine); memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc0000000, 0xc00000ff, 0, 0, scsi_r, scsi_w ); @@ -4289,7 +4289,7 @@ static DRIVER_INIT( model3_10 ) static DRIVER_INIT( model3_15 ) { - interleave_vroms(); + interleave_vroms(machine); memory_install_read64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xff000000, 0xff7fffff, 0, 0, SMH_BANK1 ); memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf0800cf8, 0xf0800cff, 0, 0, mpc105_addr_r, mpc105_addr_w ); @@ -4299,7 +4299,7 @@ static DRIVER_INIT( model3_15 ) static DRIVER_INIT( model3_20 ) { - interleave_vroms(); + interleave_vroms(machine); memory_install_read64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xff000000, 0xff7fffff, 0, 0, SMH_BANK1 ); memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc2000000, 0xc20000ff, 0, 0, real3d_dma_r, real3d_dma_w ); @@ -4311,7 +4311,7 @@ static DRIVER_INIT( model3_20 ) static DRIVER_INIT( lostwsga ) { - UINT32 *rom = (UINT32*)memory_region(REGION_USER1); + UINT32 *rom = (UINT32*)memory_region(machine, REGION_USER1); DRIVER_INIT_CALL(model3_15); /* TODO: there's an M68K device at 0xC0000000 - FF, maybe lightgun controls ? */ @@ -4322,7 +4322,7 @@ static DRIVER_INIT( lostwsga ) static DRIVER_INIT( scud ) { - UINT32 *rom = (UINT32*)memory_region(REGION_USER1); + UINT32 *rom = (UINT32*)memory_region(machine, REGION_USER1); DRIVER_INIT_CALL(model3_15); /* TODO: network device at 0xC0000000 - FF */ @@ -4334,7 +4334,7 @@ static DRIVER_INIT( scud ) static DRIVER_INIT( scudp ) { - UINT32 *rom = (UINT32*)memory_region(REGION_USER1); + UINT32 *rom = (UINT32*)memory_region(machine, REGION_USER1); DRIVER_INIT_CALL(model3_15); /* TODO: network device at 0xC0000000 - FF */ @@ -4351,7 +4351,7 @@ static DRIVER_INIT( scudp ) static DRIVER_INIT( lemans24 ) { - UINT32 *rom = (UINT32*)memory_region(REGION_USER1); + UINT32 *rom = (UINT32*)memory_region(machine, REGION_USER1); DRIVER_INIT_CALL(model3_15); memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc1000000, 0xc10000ff, 0, 0, scsi_r, scsi_w ); @@ -4365,7 +4365,7 @@ static DRIVER_INIT( lemans24 ) static DRIVER_INIT( vf3 ) { - UINT32 *rom = (UINT32*)memory_region(REGION_USER1); + UINT32 *rom = (UINT32*)memory_region(machine, REGION_USER1); DRIVER_INIT_CALL(model3_10); @@ -4378,13 +4378,13 @@ static DRIVER_INIT( vf3 ) static DRIVER_INIT( vs215 ) { - UINT32 *rom = (UINT32*)memory_region(REGION_USER1); + UINT32 *rom = (UINT32*)memory_region(machine, REGION_USER1); rom[(0x70dde0^4)/4] = 0x60000000; rom[(0x70e6f0^4)/4] = 0x60000000; rom[(0x70e710^4)/4] = 0x60000000; - interleave_vroms(); + interleave_vroms(machine); memory_install_read64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xff000000, 0xff7fffff, 0, 0, SMH_BANK1 ); memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf9000000, 0xf90000ff, 0, 0, scsi_r, scsi_w ); @@ -4398,12 +4398,12 @@ static DRIVER_INIT( vs215 ) static DRIVER_INIT( vs29815 ) { - UINT32 *rom = (UINT32*)memory_region(REGION_USER1); + UINT32 *rom = (UINT32*)memory_region(machine, REGION_USER1); rom[(0x6028ec^4)/4] = 0x60000000; rom[(0x60290c^4)/4] = 0x60000000; - interleave_vroms(); + interleave_vroms(machine); memory_install_read64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xff000000, 0xff7fffff, 0, 0, SMH_BANK1 ); memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf9000000, 0xf90000ff, 0, 0, scsi_r, scsi_w ); @@ -4417,12 +4417,12 @@ static DRIVER_INIT( vs29815 ) static DRIVER_INIT( bass ) { - UINT32 *rom = (UINT32*)memory_region(REGION_USER1); + UINT32 *rom = (UINT32*)memory_region(machine, REGION_USER1); rom[(0x7999a8^4)/4] = 0x60000000; rom[(0x7999c8^4)/4] = 0x60000000; - interleave_vroms(); + interleave_vroms(machine); memory_install_read64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xff000000, 0xff7fffff, 0, 0, SMH_BANK1 ); memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf9000000, 0xf90000ff, 0, 0, scsi_r, scsi_w ); @@ -4436,7 +4436,7 @@ static DRIVER_INIT( bass ) static DRIVER_INIT( getbass ) { - interleave_vroms(); + interleave_vroms(machine); memory_install_read64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xff000000, 0xff7fffff, 0, 0, SMH_BANK1 ); memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf9000000, 0xf90000ff, 0, 0, scsi_r, scsi_w ); @@ -4448,7 +4448,7 @@ static DRIVER_INIT( getbass ) static DRIVER_INIT( vs2 ) { - UINT32 *rom = (UINT32*)memory_region(REGION_USER1); + UINT32 *rom = (UINT32*)memory_region(machine, REGION_USER1); DRIVER_INIT_CALL(model3_20); @@ -4458,7 +4458,7 @@ static DRIVER_INIT( vs2 ) static DRIVER_INIT( vs298 ) { - UINT32 *rom = (UINT32*)memory_region(REGION_USER1); + UINT32 *rom = (UINT32*)memory_region(machine, REGION_USER1); DRIVER_INIT_CALL(model3_20); @@ -4469,7 +4469,7 @@ static DRIVER_INIT( vs298 ) static DRIVER_INIT( vs2v991 ) { - UINT32 *rom = (UINT32*)memory_region(REGION_USER1); + UINT32 *rom = (UINT32*)memory_region(machine, REGION_USER1); DRIVER_INIT_CALL(model3_20); @@ -4479,7 +4479,7 @@ static DRIVER_INIT( vs2v991 ) static DRIVER_INIT( vs299 ) { - UINT32 *rom = (UINT32*)memory_region(REGION_USER1); + UINT32 *rom = (UINT32*)memory_region(machine, REGION_USER1); DRIVER_INIT_CALL(model3_20); @@ -4489,7 +4489,7 @@ static DRIVER_INIT( vs299 ) static DRIVER_INIT( harley ) { - UINT32 *rom = (UINT32*)memory_region(REGION_USER1); + UINT32 *rom = (UINT32*)memory_region(machine, REGION_USER1); DRIVER_INIT_CALL(model3_20); memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc0000000, 0xc00fffff, 0, 0, network_r, network_w ); @@ -4503,7 +4503,7 @@ static DRIVER_INIT( harley ) static DRIVER_INIT( srally2 ) { - UINT32 *rom = (UINT32*)memory_region(REGION_USER1); + UINT32 *rom = (UINT32*)memory_region(machine, REGION_USER1); DRIVER_INIT_CALL(model3_20); rom[(0x7c0c4^4)/4] = 0x60000000; @@ -4513,7 +4513,7 @@ static DRIVER_INIT( srally2 ) static DRIVER_INIT( swtrilgy ) { - UINT32 *rom = (UINT32*)memory_region(REGION_USER1); + UINT32 *rom = (UINT32*)memory_region(machine, REGION_USER1); DRIVER_INIT_CALL(model3_20); rom[(0xf0e48^4)/4] = 0x60000000; @@ -4524,7 +4524,7 @@ static DRIVER_INIT( swtrilgy ) static DRIVER_INIT( swtrilga ) { - UINT32 *rom = (UINT32*)memory_region(REGION_USER1); + UINT32 *rom = (UINT32*)memory_region(machine, REGION_USER1); DRIVER_INIT_CALL(model3_20); rom[(0xf6dd0^4)/4] = 0x60000000; @@ -4532,7 +4532,7 @@ static DRIVER_INIT( swtrilga ) static DRIVER_INIT( von2 ) { - UINT32 *rom = (UINT32*)memory_region(REGION_USER1); + UINT32 *rom = (UINT32*)memory_region(machine, REGION_USER1); DRIVER_INIT_CALL(model3_20); rom[(0x189168^4)/4] = 0x60000000; @@ -4544,7 +4544,7 @@ static DRIVER_INIT( von2 ) static DRIVER_INIT( dirtdvls ) { - UINT32 *rom = (UINT32*)memory_region(REGION_USER1); + UINT32 *rom = (UINT32*)memory_region(machine, REGION_USER1); DRIVER_INIT_CALL(model3_20); rom[(0x0600a0^4)/4] = 0x60000000; @@ -4557,7 +4557,7 @@ static DRIVER_INIT( dirtdvls ) static DRIVER_INIT( daytona2 ) { - UINT32 *rom = (UINT32*)memory_region(REGION_USER1); + UINT32 *rom = (UINT32*)memory_region(machine, REGION_USER1); DRIVER_INIT_CALL(model3_20); memory_install_write64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc3800000, 0xc3800007, 0, 0, daytona2_rombank_w ); @@ -4570,7 +4570,7 @@ static DRIVER_INIT( daytona2 ) static DRIVER_INIT( dayto2pe ) { - UINT32 *rom = (UINT32*)memory_region(REGION_USER1); + UINT32 *rom = (UINT32*)memory_region(machine, REGION_USER1); DRIVER_INIT_CALL(model3_20); memory_install_write64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc3800000, 0xc3800007, 0, 0, daytona2_rombank_w ); @@ -4584,7 +4584,7 @@ static DRIVER_INIT( dayto2pe ) static DRIVER_INIT( spikeout ) { - UINT32 *rom = (UINT32*)memory_region(REGION_USER1); + UINT32 *rom = (UINT32*)memory_region(machine, REGION_USER1); DRIVER_INIT_CALL(model3_20); rom[(0x6059cc^4)/4] = 0x60000000; @@ -4593,7 +4593,7 @@ static DRIVER_INIT( spikeout ) static DRIVER_INIT( spikeofe ) { - UINT32 *rom = (UINT32*)memory_region(REGION_USER1); + UINT32 *rom = (UINT32*)memory_region(machine, REGION_USER1); DRIVER_INIT_CALL(model3_20); rom[(0x6059cc^4)/4] = 0x60000000; @@ -4602,7 +4602,7 @@ static DRIVER_INIT( spikeofe ) static DRIVER_INIT( eca ) { - UINT32 *rom = (UINT32*)memory_region(REGION_USER1); + UINT32 *rom = (UINT32*)memory_region(machine, REGION_USER1); DRIVER_INIT_CALL(model3_20); rom[(0x535580^4)/4] = 0x60000000; @@ -4612,7 +4612,7 @@ static DRIVER_INIT( eca ) static DRIVER_INIT( skichamp ) { - UINT32 *rom = (UINT32*)memory_region(REGION_USER1); + UINT32 *rom = (UINT32*)memory_region(machine, REGION_USER1); DRIVER_INIT_CALL(model3_20); rom[(0x5263c8^4)/4] = 0x60000000; diff --git a/src/mame/drivers/momoko.c b/src/mame/drivers/momoko.c index 26e578246a0..bf4cd4370ab 100644 --- a/src/mame/drivers/momoko.c +++ b/src/mame/drivers/momoko.c @@ -37,7 +37,7 @@ WRITE8_HANDLER( momoko_bg_priority_w); static WRITE8_HANDLER( momoko_bg_read_bank_w ) { - UINT8 *BG_MAP = memory_region(REGION_USER1); + UINT8 *BG_MAP = memory_region(machine, REGION_USER1); int bank_address = (data & 0x1f) * 0x1000; memory_set_bankptr(1, &BG_MAP[bank_address]); } diff --git a/src/mame/drivers/moo.c b/src/mame/drivers/moo.c index 619d6c5ef91..2d9ea1857f5 100644 --- a/src/mame/drivers/moo.c +++ b/src/mame/drivers/moo.c @@ -224,7 +224,7 @@ static READ16_HANDLER( sound_status_r ) static WRITE8_HANDLER( sound_bankswitch_w ) { - memory_set_bankptr(2, memory_region(REGION_CPU2) + 0x10000 + (data&0xf)*0x4000); + memory_set_bankptr(2, memory_region(machine, REGION_CPU2) + 0x10000 + (data&0xf)*0x4000); } diff --git a/src/mame/drivers/mouser.c b/src/mame/drivers/mouser.c index f9dc2a5d981..f08c1d03ea6 100644 --- a/src/mame/drivers/mouser.c +++ b/src/mame/drivers/mouser.c @@ -288,9 +288,9 @@ static DRIVER_INIT( mouser ) /* Decode the opcodes */ offs_t i; - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); UINT8 *decrypted = auto_malloc(0x6000); - UINT8 *table = memory_region(REGION_USER1); + UINT8 *table = memory_region(machine, REGION_USER1); memory_set_decrypted_region(0, 0x0000, 0x5fff, decrypted); diff --git a/src/mame/drivers/mpu4.c b/src/mame/drivers/mpu4.c index dab7f38236b..1da26e8e63b 100644 --- a/src/mame/drivers/mpu4.c +++ b/src/mame/drivers/mpu4.c @@ -429,7 +429,7 @@ static MACHINE_RESET( mpu4 ) /* init rom bank, some games don't set this */ { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); memory_configure_bank(1, 0, 8, &rom[0x01000], 0x10000); diff --git a/src/mame/drivers/mpu4drvr.c b/src/mame/drivers/mpu4drvr.c index c04daec6fe2..14cb1132733 100644 --- a/src/mame/drivers/mpu4drvr.c +++ b/src/mame/drivers/mpu4drvr.c @@ -1577,7 +1577,7 @@ static PALETTE_INIT( dealem ) 3, resistances_rg, weights_g, 1000, 0, 2, resistances_b, weights_b, 1000, 0); - len = memory_region_length(REGION_PROMS); + len = memory_region_length(machine, REGION_PROMS); for (i = 0; i < len; i++) { int bit0,bit1,bit2,r,g,b; diff --git a/src/mame/drivers/mquake.c b/src/mame/drivers/mquake.c index b4ac228d52b..3c3492cd470 100644 --- a/src/mame/drivers/mquake.c +++ b/src/mame/drivers/mquake.c @@ -105,7 +105,7 @@ static WRITE16_HANDLER( es5503_word_lsb_w ) // if not writing a "halt", set the bank if (!(data & 1)) { - ES5503_set_base_0(memory_region(REGION_SOUND1) + ((data>>4)*0x10000)); + ES5503_set_base_0(memory_region(machine, REGION_SOUND1) + ((data>>4)*0x10000)); } } } @@ -337,7 +337,7 @@ static const struct ES5503interface es5503_intf = static MACHINE_RESET(mquake) { /* set ES5503 wave memory (this is banked in 64k increments) */ - ES5503_set_base_0(memory_region(REGION_SOUND1)); + ES5503_set_base_0(memory_region(machine, REGION_SOUND1)); MACHINE_RESET_CALL(amiga); } @@ -452,7 +452,7 @@ static DRIVER_INIT(mquake) /* 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); } diff --git a/src/mame/drivers/mrdo.c b/src/mame/drivers/mrdo.c index c989c4d5ad5..b5b7260d2c9 100644 --- a/src/mame/drivers/mrdo.c +++ b/src/mame/drivers/mrdo.c @@ -33,7 +33,7 @@ VIDEO_UPDATE( mrdo ); /* if a read from this address doesn't return the value it expects. */ static READ8_HANDLER( mrdo_SECRE_r ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); return RAM[ activecpu_get_reg(Z80_HL) ]; } diff --git a/src/mame/drivers/ms32.c b/src/mame/drivers/ms32.c index 7798810cdab..731c29d4eac 100644 --- a/src/mame/drivers/ms32.c +++ b/src/mame/drivers/ms32.c @@ -1388,7 +1388,7 @@ static const struct YMF271interface ymf271_interface = static MACHINE_RESET( ms32 ) { - memory_set_bankptr(1, memory_region(REGION_CPU1)); + memory_set_bankptr(1, memory_region(machine, REGION_CPU1)); memory_set_bank(4, 0); memory_set_bank(5, 1); irq_init(machine); @@ -2158,7 +2158,7 @@ ROM_END /* SS92048-01: p47aces, 47pie2, 47pie2o */ -void ms32_rearrange_sprites(int region) +void ms32_rearrange_sprites(running_machine *machine, int region) { /* sprites are not encrypted, but we need to move the data around to handle them as 256x256 tiles */ int i; @@ -2167,8 +2167,8 @@ void ms32_rearrange_sprites(int region) UINT8 *result_data; - source_data = memory_region ( region ); - source_size = memory_region_length( region ); + source_data = memory_region ( machine, region ); + source_size = memory_region_length( machine, region ); result_data = malloc_or_die(source_size); @@ -2184,7 +2184,7 @@ void ms32_rearrange_sprites(int region) } -void decrypt_ms32_tx(int addr_xor,int data_xor, int region) +void decrypt_ms32_tx(running_machine *machine, int addr_xor,int data_xor, int region) { int i; UINT8 *source_data; @@ -2192,8 +2192,8 @@ void decrypt_ms32_tx(int addr_xor,int data_xor, int region) UINT8 *result_data; - source_data = memory_region ( region ); - source_size = memory_region_length( region ); + source_data = memory_region ( machine, region ); + source_size = memory_region_length( machine, region ); result_data = malloc_or_die(source_size); @@ -2238,7 +2238,7 @@ void decrypt_ms32_tx(int addr_xor,int data_xor, int region) free (result_data); } -void decrypt_ms32_bg(int addr_xor,int data_xor, int region) +void decrypt_ms32_bg(running_machine *machine, int addr_xor,int data_xor, int region) { int i; UINT8 *source_data; @@ -2246,8 +2246,8 @@ void decrypt_ms32_bg(int addr_xor,int data_xor, int region) UINT8 *result_data; - source_data = memory_region ( region ); - source_size = memory_region_length( region ); + source_data = memory_region ( machine, region ); + source_size = memory_region_length( machine, region ); result_data = malloc_or_die(source_size); @@ -2295,47 +2295,47 @@ void decrypt_ms32_bg(int addr_xor,int data_xor, int region) -static void configure_banks(void) +static void configure_banks(running_machine *machine) { state_save_register_global(to_main); - memory_configure_bank(4, 0, 16, memory_region(REGION_CPU2) + 0x14000, 0x4000); - memory_configure_bank(5, 0, 16, memory_region(REGION_CPU2) + 0x14000, 0x4000); + memory_configure_bank(4, 0, 16, memory_region(machine, REGION_CPU2) + 0x14000, 0x4000); + memory_configure_bank(5, 0, 16, memory_region(machine, REGION_CPU2) + 0x14000, 0x4000); } /* SS91022-10: desertwr, gratiaa, tp2m32, gametngk */ static DRIVER_INIT (ss91022_10) { - configure_banks(); - ms32_rearrange_sprites(REGION_GFX1); - decrypt_ms32_tx(0x00000,0x35, REGION_GFX4); - decrypt_ms32_bg(0x00000,0xa3, REGION_GFX3); + configure_banks(machine); + ms32_rearrange_sprites(machine, REGION_GFX1); + decrypt_ms32_tx(machine, 0x00000,0x35, REGION_GFX4); + decrypt_ms32_bg(machine, 0x00000,0xa3, REGION_GFX3); } /* SS92046_01: bbbxing, f1superb, tetrisp, hayaosi2 */ static DRIVER_INIT (ss92046_01) { - configure_banks(); - ms32_rearrange_sprites(REGION_GFX1); - decrypt_ms32_tx(0x00020,0x7e, REGION_GFX4); - decrypt_ms32_bg(0x00001,0x9b, REGION_GFX3); + configure_banks(machine); + ms32_rearrange_sprites(machine, REGION_GFX1); + decrypt_ms32_tx(machine, 0x00020,0x7e, REGION_GFX4); + decrypt_ms32_bg(machine, 0x00001,0x9b, REGION_GFX3); } /* SS92047-01: gratia, kirarast */ static DRIVER_INIT (ss92047_01) { - configure_banks(); - ms32_rearrange_sprites(REGION_GFX1); - decrypt_ms32_tx(0x24000,0x18, REGION_GFX4); - decrypt_ms32_bg(0x24000,0x55, REGION_GFX3); + configure_banks(machine); + ms32_rearrange_sprites(machine, REGION_GFX1); + decrypt_ms32_tx(machine, 0x24000,0x18, REGION_GFX4); + decrypt_ms32_bg(machine, 0x24000,0x55, REGION_GFX3); } /* SS92048-01: p47aces, 47pie2, 47pie2o */ static DRIVER_INIT (ss92048_01) { - configure_banks(); - ms32_rearrange_sprites(REGION_GFX1); - decrypt_ms32_tx(0x20400,0xd6, REGION_GFX4); - decrypt_ms32_bg(0x20400,0xd4, REGION_GFX3); + configure_banks(machine); + ms32_rearrange_sprites(machine, REGION_GFX1); + decrypt_ms32_tx(machine, 0x20400,0xd6, REGION_GFX4); + decrypt_ms32_bg(machine, 0x20400,0xd4, REGION_GFX3); } static DRIVER_INIT (kirarast) @@ -2357,7 +2357,7 @@ static DRIVER_INIT (47pie2) static DRIVER_INIT (f1superb) { #if 0 // we shouldn't need this hack, something else is wrong, and the x offsets are never copied either, v70 problems?? - UINT32 *pROM = (UINT32 *)memory_region(REGION_CPU1); + UINT32 *pROM = (UINT32 *)memory_region(machine, REGION_CPU1); pROM[0x19d04/4]=0x167a021a; // bne->br : sprite Y offset table is always copied to RAM #endif DRIVER_INIT_CALL(ss92046_01); diff --git a/src/mame/drivers/multigam.c b/src/mame/drivers/multigam.c index 69b183587b6..9a5324ef566 100644 --- a/src/mame/drivers/multigam.c +++ b/src/mame/drivers/multigam.c @@ -132,8 +132,8 @@ static int multigam_game_gfx_bank = 0; static WRITE8_HANDLER(multigam_switch_prg_rom) { /* switch PRG rom */ - UINT8* dst = memory_region( REGION_CPU1 ); - UINT8* src = memory_region( REGION_USER1 ); + UINT8* dst = memory_region( machine, REGION_CPU1 ); + UINT8* src = memory_region( machine, REGION_USER1 ); if ( data & 0x80 ) { @@ -232,7 +232,7 @@ static WRITE8_HANDLER( multigam3_mmc3_rom_switch_w ) if ( multigam3_mmc3_last_bank != ( data & 0xc0 ) ) { int bank; - UINT8 *prg = memory_region( REGION_CPU1 ); + UINT8 *prg = memory_region( machine, REGION_CPU1 ); /* reset the banks */ if ( multigam3_mmc3_command & 0x40 ) @@ -285,7 +285,7 @@ static WRITE8_HANDLER( multigam3_mmc3_rom_switch_w ) case 6: /* program banking */ { - UINT8 *prg = memory_region( REGION_CPU1 ); + UINT8 *prg = memory_region( machine, REGION_CPU1 ); if ( multigam3_mmc3_command & 0x40 ) { /* high bank */ @@ -310,7 +310,7 @@ static WRITE8_HANDLER( multigam3_mmc3_rom_switch_w ) case 7: /* program banking */ { /* mid bank */ - UINT8 *prg = memory_region( REGION_CPU1 ); + UINT8 *prg = memory_region( machine, REGION_CPU1 ); multigam3_mmc3_banks[1] = data & 0x1f; bank = multigam3_mmc3_banks[1] * 0x2000 + 0xa0000; @@ -355,8 +355,8 @@ static WRITE8_HANDLER( multigam3_mmc3_rom_switch_w ) static void multigam_init_smb3(running_machine *machine) { - UINT8* dst = memory_region( REGION_CPU1 ); - UINT8* src = memory_region( REGION_USER1 ); + UINT8* dst = memory_region( machine, REGION_CPU1 ); + UINT8* src = memory_region( machine, REGION_USER1 ); memcpy(&dst[0x8000], &src[0xa0000 + 0x3c000], 0x4000); memcpy(&dst[0xc000], &src[0xa0000 + 0x3c000], 0x4000); @@ -389,8 +389,8 @@ static WRITE8_HANDLER(multigm3_mapper2_w) static WRITE8_HANDLER(multigm3_switch_prg_rom) { /* switch PRG rom */ - UINT8* dst = memory_region( REGION_CPU1 ); - UINT8* src = memory_region( REGION_USER1 ); + UINT8* dst = memory_region( machine, REGION_CPU1 ); + UINT8* src = memory_region( machine, REGION_USER1 ); if ( data == 0xa8 ) { @@ -400,7 +400,7 @@ static WRITE8_HANDLER(multigm3_switch_prg_rom) else { memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xffff, 0, 0, multigm3_mapper2_w ); - memory_set_bankptr(1, memory_region(REGION_CPU1) + 0x6000); + memory_set_bankptr(1, memory_region(machine, REGION_CPU1) + 0x6000); } if ( data & 0x80 ) @@ -681,8 +681,8 @@ static DRIVER_INIT(multigm3) { const UINT8 decode[16] = { 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a }; - multigm3_decrypt(memory_region(REGION_CPU1), memory_region_length(REGION_CPU1), decode ); - multigm3_decrypt(memory_region(REGION_USER1), memory_region_length(REGION_USER1), decode ); + multigm3_decrypt(memory_region(machine, REGION_CPU1), memory_region_length(machine, REGION_CPU1), decode ); + multigm3_decrypt(memory_region(machine, REGION_USER1), memory_region_length(machine, REGION_USER1), decode ); multigmc_mmc3_6000_ram = auto_malloc(0x2000); } diff --git a/src/mame/drivers/mustache.c b/src/mame/drivers/mustache.c index 0848525a5f5..cf806588c1e 100644 --- a/src/mame/drivers/mustache.c +++ b/src/mame/drivers/mustache.c @@ -268,10 +268,10 @@ static DRIVER_INIT( mustache ) { int i; - int G1 = memory_region_length(REGION_GFX1)/3; - int G2 = memory_region_length(REGION_GFX2)/2; - UINT8 *gfx1 = memory_region(REGION_GFX1); - UINT8 *gfx2 = memory_region(REGION_GFX2); + int G1 = memory_region_length(machine, REGION_GFX1)/3; + int G2 = memory_region_length(machine, REGION_GFX2)/2; + UINT8 *gfx1 = memory_region(machine, REGION_GFX1); + UINT8 *gfx2 = memory_region(machine, REGION_GFX2); UINT8 *buf=malloc_or_die(G2*2); /* BG data lines */ @@ -309,7 +309,7 @@ static DRIVER_INIT( mustache ) gfx2[i] = buf[BITSWAP24(i,23,22,21,20,19,18,17,16,15,12,11,10,9,8,7,6,5,4,13,14,3,2,1,0)]; free(buf); - seibu_sound_decrypt(REGION_CPU1,0x8000); + seibu_sound_decrypt(machine,REGION_CPU1,0x8000); } diff --git a/src/mame/drivers/mystwarr.c b/src/mame/drivers/mystwarr.c index 7cf0a3ab09e..97883b76b40 100644 --- a/src/mame/drivers/mystwarr.c +++ b/src/mame/drivers/mystwarr.c @@ -770,15 +770,15 @@ ADDRESS_MAP_END static int cur_sound_region; -static void reset_sound_region(void) +static void reset_sound_region(running_machine *machine) { - memory_set_bankptr(2, memory_region(REGION_CPU2) + 0x10000 + cur_sound_region*0x4000); + memory_set_bankptr(2, memory_region(machine, REGION_CPU2) + 0x10000 + cur_sound_region*0x4000); } static WRITE8_HANDLER( sound_bankswitch_w ) { cur_sound_region = (data & 0xf); - reset_sound_region(); + reset_sound_region(machine); } /* sound memory maps @@ -852,14 +852,14 @@ GFXDECODE_END static STATE_POSTLOAD( mystwarr_postload ) { - reset_sound_region(); + reset_sound_region(machine); } static MACHINE_START( mystwarr ) { /* set default bankswitch */ cur_sound_region = 2; - reset_sound_region(); + reset_sound_region(machine); mw_irq_control = 0; diff --git a/src/mame/drivers/namcofl.c b/src/mame/drivers/namcofl.c index a9526ea5b57..9c3ada2d1d0 100644 --- a/src/mame/drivers/namcofl.c +++ b/src/mame/drivers/namcofl.c @@ -164,11 +164,11 @@ static WRITE32_HANDLER( namcofl_sysreg_w ) if (data == 0) // RAM at 00000000, ROM at 10000000 { memory_set_bankptr( 1, namcofl_workram ); - memory_set_bankptr( 2, memory_region(REGION_CPU1) ); + memory_set_bankptr( 2, memory_region(machine, REGION_CPU1) ); } else // ROM at 00000000, RAM at 10000000 { - memory_set_bankptr( 1, memory_region(REGION_CPU1) ); + memory_set_bankptr( 1, memory_region(machine, REGION_CPU1) ); memory_set_bankptr( 2, namcofl_workram ); } } @@ -529,26 +529,26 @@ ROM_START( finalapr ) ROM_LOAD("flr1voi.23s", 0x000000, 0x200000, CRC(ff6077cd) SHA1(73c289125ddeae3e43153e4c570549ca04501262) ) ROM_END -static void namcofl_common_init(void) +static void namcofl_common_init(running_machine *machine) { namcofl_workram = auto_malloc(0x100000); - memory_set_bankptr( 1, memory_region(REGION_CPU1) ); + memory_set_bankptr( 1, memory_region(machine, REGION_CPU1) ); memory_set_bankptr( 2, namcofl_workram ); - namcoc7x_on_driver_init(); + namcoc7x_on_driver_init(machine); namcoc7x_set_host_ram(namcofl_mcuram); } static DRIVER_INIT(speedrcr) { - namcofl_common_init(); + namcofl_common_init(machine); namcos2_gametype = NAMCOFL_SPEED_RACER; } static DRIVER_INIT(finalapr) { - namcofl_common_init(); + namcofl_common_init(machine); namcos2_gametype = NAMCOFL_FINAL_LAP_R; } diff --git a/src/mame/drivers/namcoic.c b/src/mame/drivers/namcoic.c index a802b75d7b6..73519db5856 100644 --- a/src/mame/drivers/namcoic.c +++ b/src/mame/drivers/namcoic.c @@ -1092,7 +1092,7 @@ roz_get_info( running_machine *machine, tile_data *tileinfo, int tile_index, int break; } SET_TILE_INFO( mRozGfxBank,mangle,0/*color*/,0/*flag*/ ); - tileinfo->mask_data = 32*tile + (UINT8 *)memory_region( mRozMaskRegion ); + tileinfo->mask_data = 32*tile + (UINT8 *)memory_region( machine, mRozMaskRegion ); } /* roz_get_info */ static @@ -1647,7 +1647,7 @@ namco_road_set_transparent_color(pen_t pen) void namco_road_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int pri ) { - const UINT8 *clut = (void *)memory_region(REGION_USER3); + const UINT8 *clut = (void *)memory_region(machine, REGION_USER3); bitmap_t *pSourceBitmap; unsigned yscroll; int i; diff --git a/src/mame/drivers/namcona1.c b/src/mame/drivers/namcona1.c index 5fdc2f63da2..eeeaa4ba995 100644 --- a/src/mame/drivers/namcona1.c +++ b/src/mame/drivers/namcona1.c @@ -1406,9 +1406,9 @@ static MACHINE_DRIVER_START( namcona2 ) MACHINE_DRIVER_END static void -init_namcona1( int gametype ) +init_namcona1( running_machine *machine, int gametype ) { - UINT16 *pMem = (UINT16 *)memory_region( REGION_CPU1 ); + UINT16 *pMem = (UINT16 *)memory_region( machine, REGION_CPU1 ); namcona1_gametype = gametype; mpBank0 = &pMem[0x80000/2]; @@ -1419,9 +1419,9 @@ init_namcona1( int gametype ) } static void -init_namcona2( int gametype ) +init_namcona2( running_machine *machine, int gametype ) { - UINT16 *pMem = (UINT16 *)memory_region( REGION_CPU1 ); + UINT16 *pMem = (UINT16 *)memory_region( machine, REGION_CPU1 ); namcona1_workram[0] = 0x0007; namcona1_workram[1] = 0xfffc; /* (?) stack */ namcona1_workram[2] = 0x00c0; namcona1_workram[3] = 0x0000; /* reset vector */ @@ -1442,18 +1442,18 @@ init_namcona2( int gametype ) NAMCONA_interface.metadata_offset = 0x70000/2; } -static DRIVER_INIT( bkrtmaq ){ init_namcona1(NAMCO_BKRTMAQ); } -static DRIVER_INIT( cgangpzl ){ init_namcona1(NAMCO_CGANGPZL); } -static DRIVER_INIT( emeralda ){ init_namcona2(NAMCO_EMERALDA); } /* NA-2 Hardware */ -static DRIVER_INIT( emeraldj ){ init_namcona1(NAMCO_EMERALDA); } /* NA-1 Hardware */ -static DRIVER_INIT( exbania ){ init_namcona1(NAMCO_EXBANIA); } -static DRIVER_INIT( fa ){ init_namcona1(NAMCO_FA); } -static DRIVER_INIT( knckhead ){ init_namcona2(NAMCO_KNCKHEAD); } -static DRIVER_INIT( numanath ){ init_namcona2(NAMCO_NUMANATH); } -static DRIVER_INIT( quiztou ){ init_namcona2(NAMCO_QUIZTOU); } -static DRIVER_INIT( swcourt ){ init_namcona1(NAMCO_SWCOURT); } -static DRIVER_INIT( tinklpit ){ init_namcona1(NAMCO_TINKLPIT); } -static DRIVER_INIT( xday2 ){ init_namcona2(NAMCO_XDAY2); } +static DRIVER_INIT( bkrtmaq ){ init_namcona1(machine, NAMCO_BKRTMAQ); } +static DRIVER_INIT( cgangpzl ){ init_namcona1(machine, NAMCO_CGANGPZL); } +static DRIVER_INIT( emeralda ){ init_namcona2(machine, NAMCO_EMERALDA); } /* NA-2 Hardware */ +static DRIVER_INIT( emeraldj ){ init_namcona1(machine, NAMCO_EMERALDA); } /* NA-1 Hardware */ +static DRIVER_INIT( exbania ){ init_namcona1(machine, NAMCO_EXBANIA); } +static DRIVER_INIT( fa ){ init_namcona1(machine, NAMCO_FA); } +static DRIVER_INIT( knckhead ){ init_namcona2(machine, NAMCO_KNCKHEAD); } +static DRIVER_INIT( numanath ){ init_namcona2(machine, NAMCO_NUMANATH); } +static DRIVER_INIT( quiztou ){ init_namcona2(machine, NAMCO_QUIZTOU); } +static DRIVER_INIT( swcourt ){ init_namcona1(machine, NAMCO_SWCOURT); } +static DRIVER_INIT( tinklpit ){ init_namcona1(machine, NAMCO_TINKLPIT); } +static DRIVER_INIT( xday2 ){ init_namcona2(machine, NAMCO_XDAY2); } ROM_START( bkrtmaq ) ROM_REGION( 0xa80000, REGION_CPU1, 0 ) diff --git a/src/mame/drivers/namconb1.c b/src/mame/drivers/namconb1.c index 2373c061073..308c452a6f6 100644 --- a/src/mame/drivers/namconb1.c +++ b/src/mame/drivers/namconb1.c @@ -443,56 +443,56 @@ static NVRAM_HANDLER( namconb1 ) static DRIVER_INIT( nebulray ) { - UINT8 *pMem = (UINT8 *)memory_region(NAMCONB1_TILEMASKREGION); + UINT8 *pMem = (UINT8 *)memory_region(machine, NAMCONB1_TILEMASKREGION); size_t numBytes = (0xfe7-0xe6f)*8; memset( &pMem[0xe6f*8], 0, numBytes ); namcos2_gametype = NAMCONB1_NEBULRAY; - namcoc7x_on_driver_init(); + namcoc7x_on_driver_init(machine); } /* nebulray */ static DRIVER_INIT( gslgr94u ) { namcos2_gametype = NAMCONB1_GSLGR94U; - namcoc7x_on_driver_init(); + namcoc7x_on_driver_init(machine); } /* gslgr94u */ static DRIVER_INIT( sws95 ) { namcos2_gametype = NAMCONB1_SWS95; - namcoc7x_on_driver_init(); + namcoc7x_on_driver_init(machine); } /* sws95 */ static DRIVER_INIT( sws96 ) { namcos2_gametype = NAMCONB1_SWS96; - namcoc7x_on_driver_init(); + namcoc7x_on_driver_init(machine); } /* sws96 */ static DRIVER_INIT( sws97 ) { namcos2_gametype = NAMCONB1_SWS97; - namcoc7x_on_driver_init(); + namcoc7x_on_driver_init(machine); } /* sws97 */ static DRIVER_INIT( gunbulet ) { namcos2_gametype = NAMCONB1_GUNBULET; - namcoc7x_on_driver_init(); + namcoc7x_on_driver_init(machine); } /* gunbulet */ static DRIVER_INIT( vshoot ) { namcos2_gametype = NAMCONB1_VSHOOT; - namcoc7x_on_driver_init(); + namcoc7x_on_driver_init(machine); } /* vshoot */ static void -ShuffleDataROMs( void ) +ShuffleDataROMs( running_machine *machine ) { - size_t len = memory_region_length(REGION_USER1)/4; - UINT8 *pMem8 = (UINT8 *)memory_region( REGION_USER1 ); + size_t len = memory_region_length(machine, REGION_USER1)/4; + UINT8 *pMem8 = (UINT8 *)memory_region( machine, REGION_USER1 ); UINT32 *pMem32 = (UINT32 *)pMem8; int i; @@ -507,15 +507,15 @@ ShuffleDataROMs( void ) static DRIVER_INIT( machbrkr ) { namcos2_gametype = NAMCONB2_MACH_BREAKERS; - ShuffleDataROMs(); - namcoc7x_on_driver_init(); + ShuffleDataROMs(machine); + namcoc7x_on_driver_init(machine); } static DRIVER_INIT( outfxies ) { namcos2_gametype = NAMCONB2_OUTFOXIES; - ShuffleDataROMs(); - namcoc7x_on_driver_init(); + ShuffleDataROMs(machine); + namcoc7x_on_driver_init(machine); } static READ32_HANDLER( custom_key_r ) diff --git a/src/mame/drivers/namcos10.c b/src/mame/drivers/namcos10.c index 5126385b02a..513b887af07 100644 --- a/src/mame/drivers/namcos10.c +++ b/src/mame/drivers/namcos10.c @@ -311,8 +311,8 @@ static void memm_driver_init( running_machine *machine ) static void memn_driver_init( running_machine *machine ) { - UINT8 *BIOS = (UINT8 *)memory_region( REGION_USER1 ); - UINT8 *ROM = (UINT8 *)memory_region( REGION_USER2 ); + UINT8 *BIOS = (UINT8 *)memory_region( machine, REGION_USER1 ); + UINT8 *ROM = (UINT8 *)memory_region( machine, REGION_USER2 ); memcpy32le( (UINT32 *)( BIOS + 0x0000000 ), ROM + 0x08000, 0x001c000 ); memcpy32le( (UINT32 *)( BIOS + 0x0020000 ), ROM + 0x24000, 0x03dffff ); @@ -320,11 +320,11 @@ static void memn_driver_init( running_machine *machine ) psx_driver_init(machine); } -static void decrypt_bios( int b15, int b14, int b13, int b12, int b11, int b10, int b9, int b8, +static void decrypt_bios( running_machine *machine, int b15, int b14, int b13, int b12, int b11, int b10, int b9, int b8, int b7, int b6, int b5, int b4, int b3, int b2, int b1, int b0 ) { - UINT16 *BIOS = (UINT16 *)memory_region( REGION_USER1 ); - int len = memory_region_length( REGION_USER1 ) / 2; + UINT16 *BIOS = (UINT16 *)memory_region( machine, REGION_USER1 ); + int len = memory_region_length( machine, REGION_USER1 ) / 2; int i; for( i = 0; i < len; i++ ) @@ -337,37 +337,37 @@ static void decrypt_bios( int b15, int b14, int b13, int b12, int b11, int b10, static DRIVER_INIT( mrdrilr2 ) { memm_driver_init(machine); - decrypt_bios( 0xc, 0xd, 0xf, 0xe, 0xb, 0xa, 0x9, 0x8, 0x7, 0x6, 0x4, 0x1, 0x2, 0x5, 0x0, 0x3 ); + decrypt_bios( machine, 0xc, 0xd, 0xf, 0xe, 0xb, 0xa, 0x9, 0x8, 0x7, 0x6, 0x4, 0x1, 0x2, 0x5, 0x0, 0x3 ); } static DRIVER_INIT( gjspace ) { memn_driver_init(machine); - decrypt_bios( 0x0, 0x2, 0xe, 0xd, 0xf, 0x6, 0xc, 0x7, 0x5, 0x1, 0x9, 0x8, 0xa, 0x3, 0x4, 0xb ); + decrypt_bios( machine, 0x0, 0x2, 0xe, 0xd, 0xf, 0x6, 0xc, 0x7, 0x5, 0x1, 0x9, 0x8, 0xa, 0x3, 0x4, 0xb ); } static DRIVER_INIT( mrdrilrg ) { memn_driver_init(machine); - decrypt_bios( 0x6, 0x4, 0x7, 0x5, 0x2, 0x1, 0x0, 0x3, 0xc, 0xd, 0xe, 0xf, 0x8, 0x9, 0xb, 0xa ); + decrypt_bios( machine, 0x6, 0x4, 0x7, 0x5, 0x2, 0x1, 0x0, 0x3, 0xc, 0xd, 0xe, 0xf, 0x8, 0x9, 0xb, 0xa ); } static DRIVER_INIT( knpuzzle ) { memn_driver_init(machine); - decrypt_bios( 0x6, 0x7, 0x4, 0x5, 0x2, 0x0, 0x3, 0x1, 0xc, 0xd, 0xe, 0xf, 0x9, 0xb, 0x8, 0xa ); + decrypt_bios( machine, 0x6, 0x7, 0x4, 0x5, 0x2, 0x0, 0x3, 0x1, 0xc, 0xd, 0xe, 0xf, 0x9, 0xb, 0x8, 0xa ); } static DRIVER_INIT( startrgn ) { memn_driver_init(machine); - decrypt_bios( 0x6, 0x5, 0x4, 0x7, 0x1, 0x3, 0x0, 0x2, 0xc, 0xd, 0xe, 0xf, 0x8, 0xb, 0xa, 0x9 ); + decrypt_bios( machine, 0x6, 0x5, 0x4, 0x7, 0x1, 0x3, 0x0, 0x2, 0xc, 0xd, 0xe, 0xf, 0x8, 0xb, 0xa, 0x9 ); } static DRIVER_INIT( gamshara ) { memn_driver_init(machine); - decrypt_bios( 0x5, 0x4, 0x7, 0x6, 0x0, 0x1, 0x3, 0x2, 0xd, 0xf, 0xc, 0xe, 0x8, 0x9, 0xa, 0xb ); + decrypt_bios( machine, 0x5, 0x4, 0x7, 0x6, 0x0, 0x1, 0x3, 0x2, 0xd, 0xf, 0xc, 0xe, 0x8, 0x9, 0xa, 0xb ); } static MACHINE_RESET( namcos10 ) diff --git a/src/mame/drivers/namcos11.c b/src/mame/drivers/namcos11.c index a3cf5f5dc8e..4f1216d9a12 100644 --- a/src/mame/drivers/namcos11.c +++ b/src/mame/drivers/namcos11.c @@ -801,7 +801,7 @@ static DRIVER_INIT( namcos11 ) timer_adjust_periodic( timer, ATTOTIME_IN_HZ( 600 ), 0, ATTOTIME_IN_HZ( 600 ) ); psx_driver_init(machine); - namcoc7x_on_driver_init(); + namcoc7x_on_driver_init(machine); namcoc7x_set_host_ram(namcos11_sharedram); n_game = 0; @@ -816,8 +816,8 @@ static DRIVER_INIT( namcos11 ) if( namcos11_config_table[ n_game ].n_daughterboard != 0 ) { int bank; - UINT32 len = memory_region_length( REGION_USER2 ); - UINT8 *rgn = memory_region( REGION_USER2 ); + UINT32 len = memory_region_length( machine, REGION_USER2 ); + UINT8 *rgn = memory_region( machine, REGION_USER2 ); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f000000, 0x1f0fffff, 0, 0, SMH_BANK1 ); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f100000, 0x1f1fffff, 0, 0, SMH_BANK2 ); diff --git a/src/mame/drivers/namcos12.c b/src/mame/drivers/namcos12.c index c57f5c440a4..e5155a2a775 100644 --- a/src/mame/drivers/namcos12.c +++ b/src/mame/drivers/namcos12.c @@ -922,6 +922,7 @@ Notes: */ #include "driver.h" +#include "deprecat.h" #include "cpu/mips/psx.h" #include "cpu/h83002/h83002.h" #include "includes/psx.h" @@ -1058,8 +1059,8 @@ static void namcos12_rom_read( UINT32 n_address, INT32 n_size ) verboselog( 1, "namcos12_rom_read( %08x, %08x ) game %08x\n", n_address, n_size, n_offset ); } - p_n_src = (UINT32 *)( memory_region( n_region ) + n_offset ); - n_romleft = ( memory_region_length( n_region ) - n_offset ) / 4; + p_n_src = (UINT32 *)( memory_region( Machine, n_region ) + n_offset ); + n_romleft = ( memory_region_length( Machine, n_region ) - n_offset ) / 4; if( n_size > n_romleft ) { verboselog( 1, "namcos12_rom_read dma truncated %d to %d passed end of rom\n", n_size, n_romleft ); @@ -1171,7 +1172,7 @@ static UINT8 kcram[ 12 ]; static WRITE32_HANDLER( kcoff_w ) { - memory_set_bankptr( 2, memory_region( REGION_USER1 ) + 0x20280 ); + memory_set_bankptr( 2, memory_region( machine, REGION_USER1 ) + 0x20280 ); } static WRITE32_HANDLER( kcon_w ) @@ -1443,7 +1444,7 @@ static DRIVER_INIT( namcos12 ) at28c16_init( 0, NULL, NULL ); - memory_configure_bank( 1, 0, memory_region_length( REGION_USER2 ) / 0x200000, memory_region( REGION_USER2 ), 0x200000 ); + memory_configure_bank( 1, 0, memory_region_length( machine, REGION_USER2 ) / 0x200000, memory_region( machine, REGION_USER2 ), 0x200000 ); m_n_bankoffset = 0; memory_set_bank( 1, 0 ); @@ -1457,7 +1458,7 @@ static DRIVER_INIT( ptblank2 ) DRIVER_INIT_CALL(namcos12); /* patch out wait for dma 5 to complete */ - *( (UINT32 *)( memory_region( REGION_USER1 ) + 0x331c4 ) ) = 0; + *( (UINT32 *)( memory_region( machine, REGION_USER1 ) + 0x331c4 ) ) = 0; system11gun_install(machine); } diff --git a/src/mame/drivers/namcos2.c b/src/mame/drivers/namcos2.c index f76d3061752..748b66c819f 100644 --- a/src/mame/drivers/namcos2.c +++ b/src/mame/drivers/namcos2.c @@ -4602,7 +4602,7 @@ static DRIVER_INIT( metlhawk ) { /* unscramble sprites */ int i, j, k, l; - UINT8 *data = memory_region(REGION_GFX1); + UINT8 *data = memory_region(machine, REGION_GFX1); for(i=0; i<0x200000; i+=32*32) { for(j=0; j<32*32; j+=32*4) @@ -4719,7 +4719,7 @@ static DRIVER_INIT( bubbletr ){ static DRIVER_INIT( luckywld ){ - UINT8 *pData = (UINT8 *)memory_region( REGION_GFX5 ); + UINT8 *pData = (UINT8 *)memory_region( machine, REGION_GFX5 ); int i; for( i=0; i<32*0x4000; i++ ) { /* unscramble gfx mask */ diff --git a/src/mame/drivers/namcos21.c b/src/mame/drivers/namcos21.c index 52f514e2f4c..f2136f3d109 100644 --- a/src/mame/drivers/namcos21.c +++ b/src/mame/drivers/namcos21.c @@ -328,7 +328,7 @@ static struct static INT32 ReadPointROMData( unsigned offset ) { - const INT32 *pPointData = (INT32 *)memory_region( REGION_USER2 ); + const INT32 *pPointData = (INT32 *)memory_region( Machine, REGION_USER2 ); INT32 result = pPointData[offset]; return result; } @@ -602,7 +602,7 @@ static WRITE16_HANDLER( dspram16_w ) static int InitDSP( void ) { - UINT16 *pMem = (UINT16 *)memory_region(CPU_DSP_MASTER_REGION); + UINT16 *pMem = (UINT16 *)memory_region(Machine, CPU_DSP_MASTER_REGION); /** * DSP BIOS tests "CPU ID" on startup * "JAPAN (C)1990 NAMCO LTD. by H.F " @@ -1235,7 +1235,7 @@ static WRITE16_HANDLER( winrun_dsp_pointrom_addr_w ) static READ16_HANDLER( winrun_dsp_pointrom_data_r ) { - UINT16 *ptrom = (UINT16 *)memory_region(REGION_USER2); + UINT16 *ptrom = (UINT16 *)memory_region(machine, REGION_USER2); return ptrom[winrun_pointrom_addr++]; } /* winrun_dsp_pointrom_data_r */ @@ -1277,7 +1277,7 @@ ADDRESS_MAP_END static READ16_HANDLER( gpu_data_r ) { - const UINT16 *pSrc = (UINT16 *)memory_region( REGION_USER3 ); + const UINT16 *pSrc = (UINT16 *)memory_region( machine, REGION_USER3 ); return pSrc[offset]; } @@ -1295,7 +1295,7 @@ static WRITE16_HANDLER( winrun_dspbios_w ) COMBINE_DATA( &winrun_dspbios[offset] ); if( offset==0xfff ) { - UINT16 *mem = (UINT16 *)memory_region(REGION_CPU5); + UINT16 *mem = (UINT16 *)memory_region(machine, REGION_CPU5); memcpy( mem, winrun_dspbios, 0x2000 ); winrun_dsp_alive = 1; } @@ -2184,7 +2184,7 @@ static void namcos21_init( int game_type ) { namcos2_gametype = game_type; pointram = auto_malloc(PTRAM_SIZE); - mpDataROM = (UINT16 *)memory_region( REGION_USER1 ); + mpDataROM = (UINT16 *)memory_region( Machine, REGION_USER1 ); InitDSP(); mbNeedsKickstart = 20; if( game_type==NAMCOS21_CYBERSLED ) @@ -2195,7 +2195,7 @@ static void namcos21_init( int game_type ) static DRIVER_INIT( winrun ) { - UINT16 *pMem = (UINT16 *)memory_region(REGION_CPU5); + UINT16 *pMem = (UINT16 *)memory_region(machine, REGION_CPU5); int pc = 0; pMem[pc++] = 0xff80; /* b */ pMem[pc++] = 0; @@ -2203,7 +2203,7 @@ static DRIVER_INIT( winrun ) winrun_dspcomram = auto_malloc(sizeof(UINT16)*0x1000*2); namcos2_gametype = NAMCOS21_WINRUN91; - mpDataROM = (UINT16 *)memory_region( REGION_USER1 ); + mpDataROM = (UINT16 *)memory_region( machine, REGION_USER1 ); pointram = auto_malloc(PTRAM_SIZE); pointram_idx = 0; mbNeedsKickstart = 0; @@ -2227,7 +2227,7 @@ static DRIVER_INIT( cybsled ) static DRIVER_INIT( solvalou ) { - UINT16 *mem = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *mem = (UINT16 *)memory_region(machine, REGION_CPU1); mem[0x20ce4/2+1] = 0x0000; // $200128 mem[0x20cf4/2+0] = 0x4e71; // 2nd ptr_booting mem[0x20cf4/2+1] = 0x4e71; @@ -2238,13 +2238,13 @@ static DRIVER_INIT( solvalou ) static DRIVER_INIT( driveyes ) { - UINT16 *pMem = (UINT16 *)memory_region(REGION_CPU5); + UINT16 *pMem = (UINT16 *)memory_region(machine, REGION_CPU5); int pc = 0; pMem[pc++] = 0xff80; /* b */ pMem[pc++] = 0; winrun_dspcomram = auto_malloc(sizeof(UINT16)*0x1000*2); namcos2_gametype = NAMCOS21_DRIVERS_EYES; - mpDataROM = (UINT16 *)memory_region( REGION_USER1 ); + mpDataROM = (UINT16 *)memory_region( machine, REGION_USER1 ); pointram = auto_malloc(PTRAM_SIZE); pointram_idx = 0; mbNeedsKickstart = 0; diff --git a/src/mame/drivers/namcos22.c b/src/mame/drivers/namcos22.c index de86b767494..a25f326a6d8 100644 --- a/src/mame/drivers/namcos22.c +++ b/src/mame/drivers/namcos22.c @@ -5047,7 +5047,7 @@ static DRIVER_INIT( airco22 ) static DRIVER_INIT( propcycl ) { - UINT32 *pROM = (UINT32 *)memory_region(REGION_CPU1); + UINT32 *pROM = (UINT32 *)memory_region(machine, REGION_CPU1); /* patch out strange routine (uninitialized-eprom related?) */ pROM[0x1992C/4] = 0x4E754E75; @@ -5123,7 +5123,7 @@ static DRIVER_INIT( raveracw ) static DRIVER_INIT( cybrcomm ) { - UINT32 *pROM = (UINT32 *)memory_region(REGION_CPU1); + UINT32 *pROM = (UINT32 *)memory_region(machine, REGION_CPU1); pROM[0x18ade8/4] = 0x4e714e71; pROM[0x18ae38/4] = 0x4e714e71; pROM[0x18ae80/4] = 0x4e714e71; @@ -5141,7 +5141,7 @@ static DRIVER_INIT( cybrcomm ) static DRIVER_INIT( cybrcyc ) { /* patch DSP RAM test */ - UINT32 *pROM = (UINT32 *)memory_region(REGION_CPU1); + UINT32 *pROM = (UINT32 *)memory_region(machine, REGION_CPU1); pROM[0x355C/4] &= 0x0000ffff; pROM[0x355C/4] |= 0x4e710000; diff --git a/src/mame/drivers/namcos23.c b/src/mame/drivers/namcos23.c index b17dfeaeea2..15a16a69eca 100644 --- a/src/mame/drivers/namcos23.c +++ b/src/mame/drivers/namcos23.c @@ -652,7 +652,7 @@ static VIDEO_UPDATE( ss23 ) #if 0 static int bNew = 1; static int code = 0x80; - const UINT32 *pSource = (UINT32 *)memory_region(REGION_GFX4); + const UINT32 *pSource = (UINT32 *)memory_region(machine, REGION_GFX4); pSource = pSource + pSource[code]; diff --git a/src/mame/drivers/namcos86.c b/src/mame/drivers/namcos86.c index 20c67ba93cb..5068eabb06f 100644 --- a/src/mame/drivers/namcos86.c +++ b/src/mame/drivers/namcos86.c @@ -202,18 +202,18 @@ WRITE8_HANDLER( rthunder_spriteram_w ); static WRITE8_HANDLER( bankswitch1_w ) { - UINT8 *base = memory_region(REGION_CPU1) + 0x10000; + UINT8 *base = memory_region(machine, REGION_CPU1) + 0x10000; /* if the ROM expansion module is available, don't do anything. This avoids conflict */ /* with bankswitch1_ext_w() in wndrmomo */ - if (memory_region(REGION_USER1)) return; + if (memory_region(machine, REGION_USER1)) return; memory_set_bankptr(1,base + ((data & 0x03) * 0x2000)); } static WRITE8_HANDLER( bankswitch1_ext_w ) { - UINT8 *base = memory_region(REGION_USER1); + UINT8 *base = memory_region(machine, REGION_USER1); if (base == 0) return; @@ -222,7 +222,7 @@ static WRITE8_HANDLER( bankswitch1_ext_w ) static WRITE8_HANDLER( bankswitch2_w ) { - UINT8 *base = memory_region(REGION_CPU2) + 0x10000; + UINT8 *base = memory_region(machine, REGION_CPU2) + 0x10000; memory_set_bankptr(2,base + ((data & 0x03) * 0x2000)); } @@ -314,7 +314,7 @@ static WRITE8_HANDLER( namcos86_led_w ) static WRITE8_HANDLER( cus115_w ) { /* make sure the expansion board is present */ - if (!memory_region(REGION_USER1)) + if (!memory_region(machine, REGION_USER1)) { popmessage("expansion board not present"); return; @@ -344,7 +344,7 @@ static WRITE8_HANDLER( cus115_w ) static MACHINE_RESET( namco86 ) { - UINT8 *base = memory_region(REGION_CPU1) + 0x10000; + UINT8 *base = memory_region(machine, REGION_CPU1) + 0x10000; memory_set_bankptr(1,base); } @@ -1553,8 +1553,8 @@ static DRIVER_INIT( namco86 ) UINT8 *buffer; /* shuffle tile ROMs so regular gfx unpack routines can be used */ - gfx = memory_region(REGION_GFX1); - size = memory_region_length(REGION_GFX1) * 2 / 3; + gfx = memory_region(machine, REGION_GFX1); + size = memory_region_length(machine, REGION_GFX1) * 2 / 3; buffer = malloc_or_die( size ); { @@ -1578,8 +1578,8 @@ static DRIVER_INIT( namco86 ) free( buffer ); } - gfx = memory_region(REGION_GFX2); - size = memory_region_length(REGION_GFX2) * 2 / 3; + gfx = memory_region(machine, REGION_GFX2); + size = memory_region_length(machine, REGION_GFX2) * 2 / 3; buffer = malloc_or_die( size ); { diff --git a/src/mame/drivers/naomi.c b/src/mame/drivers/naomi.c index 6880c4f2ffc..831682f0532 100644 --- a/src/mame/drivers/naomi.c +++ b/src/mame/drivers/naomi.c @@ -569,7 +569,7 @@ static WRITE64_HANDLER( naomi_unknown1_w ) static READ64_HANDLER( naomi_rom_board_r ) { - UINT8 *ROM = (UINT8 *)memory_region(REGION_USER1); + UINT8 *ROM = (UINT8 *)memory_region(machine, REGION_USER1); // ROM_DATA if ((offset == 1) && ACCESSING_BITS_0_15) diff --git a/src/mame/drivers/naughtyb.c b/src/mame/drivers/naughtyb.c index 5e185050934..7cb576ae2fb 100644 --- a/src/mame/drivers/naughtyb.c +++ b/src/mame/drivers/naughtyb.c @@ -777,7 +777,7 @@ static int question_offset = 0; static READ8_HANDLER( trvmstr_questions_r ) { - return memory_region(REGION_USER1)[question_offset]; + return memory_region(machine, REGION_USER1)[question_offset]; } static WRITE8_HANDLER( trvmstr_questions_w ) diff --git a/src/mame/drivers/nbmj8688.c b/src/mame/drivers/nbmj8688.c index bd39060563a..a0b8288f0ba 100644 --- a/src/mame/drivers/nbmj8688.c +++ b/src/mame/drivers/nbmj8688.c @@ -90,8 +90,8 @@ static DRIVER_INIT( otonano ) static DRIVER_INIT( mjcamera ) { - UINT8 *rom = memory_region(REGION_SOUND1) + 0x20000; - UINT8 *prot = memory_region(REGION_USER1); + UINT8 *rom = memory_region(machine, REGION_SOUND1) + 0x20000; + UINT8 *prot = memory_region(machine, REGION_USER1); int i; /* this is one possible way to rearrange the protection ROM data to get the @@ -110,7 +110,7 @@ static DRIVER_INIT( mjcamera ) static DRIVER_INIT( kanatuen ) { /* uses the same protection data as mjcamer, but a different check */ - UINT8 *rom = memory_region(REGION_SOUND1) + 0x30000; + UINT8 *rom = memory_region(machine, REGION_SOUND1) + 0x30000; rom[0x0004] = 0x09; rom[0x0103] = 0x0e; @@ -124,7 +124,7 @@ static DRIVER_INIT( kyuhito ) { #if 1 /* uses the same protection data as ????, but a different check */ - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); rom[0x0149] = 0x00; rom[0x014a] = 0x00; @@ -136,8 +136,8 @@ static DRIVER_INIT( kyuhito ) static DRIVER_INIT( idhimitu ) { - UINT8 *rom = memory_region(REGION_SOUND1) + 0x20000; - UINT8 *prot = memory_region(REGION_USER1); + UINT8 *rom = memory_region(machine, REGION_SOUND1) + 0x20000; + UINT8 *prot = memory_region(machine, REGION_USER1); int i; /* this is one possible way to rearrange the protection ROM data to get the @@ -161,8 +161,8 @@ static DRIVER_INIT( kaguya ) static DRIVER_INIT( kaguya2 ) { - UINT8 *rom = memory_region(REGION_SOUND1) + 0x20000; - UINT8 *prot = memory_region(REGION_USER1); + UINT8 *rom = memory_region(machine, REGION_SOUND1) + 0x20000; + UINT8 *prot = memory_region(machine, REGION_USER1); int i; /* this is one possible way to rearrange the protection ROM data to get the diff --git a/src/mame/drivers/nbmj8891.c b/src/mame/drivers/nbmj8891.c index 0b5ac518cfb..11dadf0679e 100644 --- a/src/mame/drivers/nbmj8891.c +++ b/src/mame/drivers/nbmj8891.c @@ -83,7 +83,7 @@ extern WRITE8_HANDLER( nbmj8891_taiwanmb_mcu_w ); static DRIVER_INIT( gionbana ) { - UINT8 *prot = memory_region(REGION_USER1); + UINT8 *prot = memory_region(machine, REGION_USER1); int i; /* this is one possible way to rearrange the protection ROM data to get the @@ -107,7 +107,7 @@ static DRIVER_INIT( mgion ) static DRIVER_INIT( omotesnd ) { #if 0 - UINT8 *prot = memory_region(REGION_USER1); + UINT8 *prot = memory_region(machine, REGION_USER1); int i; /* this is one possible way to rearrange the protection ROM data to get the @@ -122,7 +122,7 @@ static DRIVER_INIT( omotesnd ) #endif #if 1 - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); // Protection ROM check skip ROM[0x0106] = 0x00; @@ -157,7 +157,7 @@ static DRIVER_INIT( msjiken ) static DRIVER_INIT( telmahjn ) { - UINT8 *prot = memory_region(REGION_USER1); + UINT8 *prot = memory_region(machine, REGION_USER1); int i; /* this is one possible way to rearrange the protection ROM data to get the @@ -175,7 +175,7 @@ static DRIVER_INIT( telmahjn ) static DRIVER_INIT( mgmen89 ) { - UINT8 *prot = memory_region(REGION_USER1); + UINT8 *prot = memory_region(machine, REGION_USER1); int i; /* this is one possible way to rearrange the protection ROM data to get the @@ -193,8 +193,8 @@ static DRIVER_INIT( mgmen89 ) static DRIVER_INIT( mjfocus ) { - UINT8 *prot = memory_region(REGION_USER1); - UINT8 *ram = memory_region(REGION_CPU1) + 0xf800; + UINT8 *prot = memory_region(machine, REGION_USER1); + UINT8 *ram = memory_region(machine, REGION_CPU1) + 0xf800; int i; /* need to clear RAM otherwise it doesn't boot... */ @@ -216,7 +216,7 @@ static DRIVER_INIT( mjfocus ) static DRIVER_INIT( mjfocusm ) { #if 1 - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); // Protection ROM check skip ROM[0x014e] = 0x00; @@ -228,7 +228,7 @@ static DRIVER_INIT( mjfocusm ) static DRIVER_INIT( scandal ) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); int i; for (i = 0xf800; i < 0x10000; i++) ROM[i] = 0x00; @@ -245,10 +245,10 @@ static DRIVER_INIT( mjnanpas ) { /* they forgot to enable the protection check in this game... */ #if 0 - UINT8 *prot = memory_region(REGION_USER1); + UINT8 *prot = memory_region(machine, REGION_USER1); int i; - memory_region(REGION_CPU1)[0x003d] = 0x01; // force the protection check to be executed + memory_region(machine, REGION_CPU1)[0x003d] = 0x01; // force the protection check to be executed /* this is one possible way to rearrange the protection ROM data to get the expected 0xfe1a checksum. It's probably completely wrong! But since the @@ -306,7 +306,7 @@ static DRIVER_INIT( hanaoji ) static DRIVER_INIT( pairsnb ) { - UINT8 *prot = memory_region(REGION_USER1); + UINT8 *prot = memory_region(machine, REGION_USER1); int i; /* this is one possible way to rearrange the protection ROM data to get the @@ -324,7 +324,7 @@ static DRIVER_INIT( pairsnb ) static DRIVER_INIT( pairsten ) { - UINT8 *prot = memory_region(REGION_USER1); + UINT8 *prot = memory_region(machine, REGION_USER1); int i; /* this is one possible way to rearrange the protection ROM data to get the diff --git a/src/mame/drivers/nbmj8991.c b/src/mame/drivers/nbmj8991.c index 7401be649ff..d36ddcb8fea 100644 --- a/src/mame/drivers/nbmj8991.c +++ b/src/mame/drivers/nbmj8991.c @@ -81,7 +81,7 @@ static MACHINE_RESET( nbmj8991 ) { if (machine->config->cpu[1].type == CPU_Z80) { - memory_configure_bank(1, 0, 4, memory_region(REGION_CPU2) + 0x8000, 0x8000); + memory_configure_bank(1, 0, 4, memory_region(machine, REGION_CPU2) + 0x8000, 0x8000); memory_set_bank(1, 0); } MACHINE_RESET_CALL(nb1413m3); @@ -119,7 +119,7 @@ static DRIVER_INIT( vanilla ) static DRIVER_INIT( finalbny ) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); int i; for (i = 0xf800; i < 0x10000; i++) ROM[i] = 0x00; @@ -145,7 +145,7 @@ static DRIVER_INIT( hyouban ) static DRIVER_INIT( galkaika ) { #if 1 - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); // Patch to IM2 -> IM1 ROM[0x0002] = 0x56; @@ -156,7 +156,7 @@ static DRIVER_INIT( galkaika ) static DRIVER_INIT( tokyogal ) { #if 1 - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); // Patch to IM2 -> IM1 ROM[0x0002] = 0x56; @@ -167,7 +167,7 @@ static DRIVER_INIT( tokyogal ) static DRIVER_INIT( tokimbsj ) { #if 1 - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); // Patch to IM2 -> IM1 ROM[0x0002] = 0x56; diff --git a/src/mame/drivers/nbmj9195.c b/src/mame/drivers/nbmj9195.c index 59d146d683a..8cd14751a9c 100644 --- a/src/mame/drivers/nbmj9195.c +++ b/src/mame/drivers/nbmj9195.c @@ -78,9 +78,9 @@ static NVRAM_HANDLER( nbmj9195 ) } } -static void nbmj9195_soundbank_w(int data) +static void nbmj9195_soundbank_w(running_machine *machine, int data) { - UINT8 *SNDROM = memory_region(REGION_CPU2); + UINT8 *SNDROM = memory_region(machine, REGION_CPU2); memory_set_bankptr(1, &SNDROM[0x08000 + (0x8000 * (data & 0x03))]); } @@ -373,7 +373,7 @@ static void tmpz84c011_pio_w(running_machine *machine, int offset, int data) break; case 5: /* PA_1 */ - nbmj9195_soundbank_w(data); + nbmj9195_soundbank_w(machine, data); break; case 6: /* PB_1 */ DAC_1_WRITE(machine, 0, data); @@ -411,7 +411,7 @@ static void tmpz84c011_pio_w(running_machine *machine, int offset, int data) break; case 5: /* PA_1 */ - nbmj9195_soundbank_w(data); + nbmj9195_soundbank_w(machine, data); break; case 6: /* PB_1 */ DAC_1_WRITE(machine, 0, data); @@ -546,7 +546,7 @@ static MACHINE_RESET( sailorws ) static DRIVER_INIT( nbmj9195 ) { - UINT8 *ROM = memory_region(REGION_CPU2); + UINT8 *ROM = memory_region(machine, REGION_CPU2); // sound program patch ROM[0x0213] = 0x00; // DI -> NOP @@ -555,7 +555,7 @@ static DRIVER_INIT( nbmj9195 ) tmpz84c011_init(machine); // initialize sound rom bank - nbmj9195_soundbank_w(0); + nbmj9195_soundbank_w(machine, 0); } diff --git a/src/mame/drivers/neodrvr.c b/src/mame/drivers/neodrvr.c index 2c22aa053af..5cc4bc1a355 100644 --- a/src/mame/drivers/neodrvr.c +++ b/src/mame/drivers/neodrvr.c @@ -6841,240 +6841,240 @@ static DRIVER_INIT( fatfury2 ) static DRIVER_INIT( mslugx ) { DRIVER_INIT_CALL(neogeo); - mslugx_install_protection(); + mslugx_install_protection(machine); } static DRIVER_INIT( kof99 ) { - kof99_decrypt_68k(); + kof99_decrypt_68k(machine); neogeo_fixed_layer_bank_type = 1; - kof99_neogeo_gfx_decrypt(0x00); + kof99_neogeo_gfx_decrypt(machine, 0x00); DRIVER_INIT_CALL(neogeo); kof99_install_protection(machine); } static DRIVER_INIT( garou ) { - garou_decrypt_68k(); + garou_decrypt_68k(machine); neogeo_fixed_layer_bank_type = 1; - kof99_neogeo_gfx_decrypt(0x06); + kof99_neogeo_gfx_decrypt(machine, 0x06); DRIVER_INIT_CALL(neogeo); garou_install_protection(machine); } static DRIVER_INIT( garouo ) { - garouo_decrypt_68k(); + garouo_decrypt_68k(machine); neogeo_fixed_layer_bank_type = 1; - kof99_neogeo_gfx_decrypt(0x06); + kof99_neogeo_gfx_decrypt(machine, 0x06); DRIVER_INIT_CALL(neogeo); garouo_install_protection(machine); } static DRIVER_INIT( garoubl ) { - neogeo_bootleg_sx_decrypt(2); - neogeo_bootleg_cx_decrypt(); + neogeo_bootleg_sx_decrypt(machine, 2); + neogeo_bootleg_cx_decrypt(machine); DRIVER_INIT_CALL(neogeo); } static DRIVER_INIT( mslug3 ) { - mslug3_decrypt_68k(); + mslug3_decrypt_68k(machine); neogeo_fixed_layer_bank_type = 1; - kof99_neogeo_gfx_decrypt(0xad); + kof99_neogeo_gfx_decrypt(machine, 0xad); DRIVER_INIT_CALL(neogeo); mslug3_install_protection(machine); } static DRIVER_INIT( kof2000 ) { - kof2000_decrypt_68k(); + kof2000_decrypt_68k(machine); neogeo_fixed_layer_bank_type = 2; - kof2000_neogeo_gfx_decrypt(0x00); + kof2000_neogeo_gfx_decrypt(machine, 0x00); DRIVER_INIT_CALL(neogeo); kof2000_install_protection(machine); } static DRIVER_INIT( kof2001 ) { - kof2000_neogeo_gfx_decrypt(0x1e); + kof2000_neogeo_gfx_decrypt(machine, 0x1e); DRIVER_INIT_CALL(neogeo); } static DRIVER_INIT( mslug4 ) { neogeo_fixed_layer_bank_type = 1; /* USA violent content screen is wrong -- not a bug, confirmed on real hardware! */ - kof2000_neogeo_gfx_decrypt(0x31); + kof2000_neogeo_gfx_decrypt(machine, 0x31); DRIVER_INIT_CALL(neogeo); - neo_pcm2_snk_1999(8); + neo_pcm2_snk_1999(machine, 8); } static DRIVER_INIT( kof99n ) { neogeo_fixed_layer_bank_type = 1; - kof99_neogeo_gfx_decrypt(0x00); + kof99_neogeo_gfx_decrypt(machine, 0x00); DRIVER_INIT_CALL(neogeo); } static DRIVER_INIT( ganryu ) { neogeo_fixed_layer_bank_type = 1; - kof99_neogeo_gfx_decrypt(0x07); + kof99_neogeo_gfx_decrypt(machine, 0x07); DRIVER_INIT_CALL(neogeo); } static DRIVER_INIT( s1945p ) { neogeo_fixed_layer_bank_type = 1; - kof99_neogeo_gfx_decrypt(0x05); + kof99_neogeo_gfx_decrypt(machine, 0x05); DRIVER_INIT_CALL(neogeo); } static DRIVER_INIT( preisle2 ) { neogeo_fixed_layer_bank_type = 1; - kof99_neogeo_gfx_decrypt(0x9f); + kof99_neogeo_gfx_decrypt(machine, 0x9f); DRIVER_INIT_CALL(neogeo); } static DRIVER_INIT( mslug3h ) { neogeo_fixed_layer_bank_type = 1; - kof99_neogeo_gfx_decrypt(0xad); + kof99_neogeo_gfx_decrypt(machine, 0xad); DRIVER_INIT_CALL(neogeo); } static DRIVER_INIT( kof2000n ) { neogeo_fixed_layer_bank_type = 2; - kof2000_neogeo_gfx_decrypt(0x00); + kof2000_neogeo_gfx_decrypt(machine, 0x00); DRIVER_INIT_CALL(neogeo); } static DRIVER_INIT( bangbead ) { neogeo_fixed_layer_bank_type = 1; - kof99_neogeo_gfx_decrypt(0xf8); + kof99_neogeo_gfx_decrypt(machine, 0xf8); DRIVER_INIT_CALL(neogeo); } static DRIVER_INIT( nitd ) { neogeo_fixed_layer_bank_type = 1; - kof99_neogeo_gfx_decrypt(0xff); + kof99_neogeo_gfx_decrypt(machine, 0xff); DRIVER_INIT_CALL(neogeo); } static DRIVER_INIT( zupapa ) { neogeo_fixed_layer_bank_type = 1; - kof99_neogeo_gfx_decrypt(0xbd); + kof99_neogeo_gfx_decrypt(machine, 0xbd); DRIVER_INIT_CALL(neogeo); } static DRIVER_INIT( sengoku3 ) { neogeo_fixed_layer_bank_type = 1; - kof99_neogeo_gfx_decrypt(0xfe); + kof99_neogeo_gfx_decrypt(machine, 0xfe); DRIVER_INIT_CALL(neogeo); } static DRIVER_INIT ( kof98 ) { - kof98_decrypt_68k(); + kof98_decrypt_68k(machine); DRIVER_INIT_CALL(neogeo); install_kof98_protection(machine); } static DRIVER_INIT( rotd ) { - neo_pcm2_snk_1999(16); + neo_pcm2_snk_1999(machine, 16); neogeo_fixed_layer_bank_type = 1; - kof2000_neogeo_gfx_decrypt(0x3f); + kof2000_neogeo_gfx_decrypt(machine, 0x3f); DRIVER_INIT_CALL(neogeo); } static DRIVER_INIT( kof2002 ) { - kof2002_decrypt_68k(); - neo_pcm2_swap(0 ); - kof2000_neogeo_gfx_decrypt(0xec); + kof2002_decrypt_68k(machine); + neo_pcm2_swap(machine, 0); + kof2000_neogeo_gfx_decrypt(machine, 0xec); DRIVER_INIT_CALL(neogeo); } static DRIVER_INIT( kf2k2pls ) { - kof2002_decrypt_68k(); - neo_pcm2_swap(0 ); - cmc50_neogeo_gfx_decrypt(0xec); + kof2002_decrypt_68k(machine); + neo_pcm2_swap(machine, 0); + cmc50_neogeo_gfx_decrypt(machine, 0xec); DRIVER_INIT_CALL(neogeo); } static DRIVER_INIT( kf2k2mp ) { - kf2k2mp_decrypt(); - neo_pcm2_swap(0 ); - neogeo_bootleg_sx_decrypt(2); - cmc50_neogeo_gfx_decrypt(0xec); + kf2k2mp_decrypt(machine); + neo_pcm2_swap(machine, 0); + neogeo_bootleg_sx_decrypt(machine, 2); + cmc50_neogeo_gfx_decrypt(machine, 0xec); DRIVER_INIT_CALL(neogeo); } static DRIVER_INIT( kof2km2 ) { - kof2km2_px_decrypt(); - neo_pcm2_swap(0 ); - neogeo_bootleg_sx_decrypt(1); - cmc50_neogeo_gfx_decrypt(0xec); + kof2km2_px_decrypt(machine); + neo_pcm2_swap(machine, 0); + neogeo_bootleg_sx_decrypt(machine, 1); + cmc50_neogeo_gfx_decrypt(machine, 0xec); DRIVER_INIT_CALL(neogeo); } static DRIVER_INIT( matrim ) { - matrim_decrypt_68k(); - neo_pcm2_swap(1); + matrim_decrypt_68k(machine); + neo_pcm2_swap(machine, 1); neogeo_fixed_layer_bank_type = 2; - kof2000_neogeo_gfx_decrypt(0x6a); + kof2000_neogeo_gfx_decrypt(machine, 0x6a); DRIVER_INIT_CALL(neogeo); } static DRIVER_INIT( pnyaa ) { - neo_pcm2_snk_1999(4); + neo_pcm2_snk_1999(machine, 4); neogeo_fixed_layer_bank_type = 1; - kof2000_neogeo_gfx_decrypt(0x2e); + kof2000_neogeo_gfx_decrypt(machine, 0x2e); DRIVER_INIT_CALL(neogeo); } static DRIVER_INIT( mslug5 ) { - mslug5_decrypt_68k(); - neo_pcm2_swap(2); + mslug5_decrypt_68k(machine); + neo_pcm2_swap(machine, 2); neogeo_fixed_layer_bank_type = 1; - kof2000_neogeo_gfx_decrypt(0x19); + kof2000_neogeo_gfx_decrypt(machine, 0x19); DRIVER_INIT_CALL(neogeo); install_pvc_protection(machine); } static DRIVER_INIT( ms5pcb ) { - mslug5_decrypt_68k(); - svcpcb_gfx_decrypt(); - kof2000_neogeo_gfx_decrypt(0x19); + mslug5_decrypt_68k(machine); + svcpcb_gfx_decrypt(machine); + kof2000_neogeo_gfx_decrypt(machine, 0x19); neogeo_fixed_layer_bank_type = 2; - svcpcb_s1data_decrypt(); - neo_pcm2_swap(2); + svcpcb_s1data_decrypt(machine); + neo_pcm2_swap(machine, 2); DRIVER_INIT_CALL(neogeo); install_pvc_protection(machine); } static DRIVER_INIT( ms5plus ) { - cmc50_neogeo_gfx_decrypt(0x19); - neo_pcm2_swap(2); -// decrypt_ms5plus_s1(); - neogeo_bootleg_sx_decrypt(1); + cmc50_neogeo_gfx_decrypt(machine, 0x19); + neo_pcm2_swap(machine, 2); + //decrypt_ms5plus_s1(); + neogeo_bootleg_sx_decrypt(machine, 1); neogeo_fixed_layer_bank_type = 1; DRIVER_INIT_CALL(neogeo); install_ms5plus_protection(machine); @@ -7084,7 +7084,7 @@ static DRIVER_INIT( ms5plus ) static TIMER_CALLBACK( svcpcb_bios_timer_callback ) { int harddip3 = input_port_read(machine, "HARDDIP") & 1; - memory_set_bankptr(NEOGEO_BANK_BIOS, memory_region(NEOGEO_REGION_MAIN_CPU_BIOS)+0x20000+harddip3*0x20000); + memory_set_bankptr(NEOGEO_BANK_BIOS, memory_region(machine, NEOGEO_REGION_MAIN_CPU_BIOS)+0x20000+harddip3*0x20000); } static DRIVER_INIT( svcpcb ) @@ -7093,11 +7093,11 @@ static DRIVER_INIT( svcpcb ) timer_pulse(ATTOTIME_IN_MSEC(1000), NULL, 0, svcpcb_bios_timer_callback); svcpcb_bios_timer_callback(machine, NULL, 0 ); - svcchaos_px_decrypt(); - svcpcb_gfx_decrypt(); - kof2000_neogeo_gfx_decrypt(0x57); - svcpcb_s1data_decrypt(); - neo_pcm2_swap(3); + svcchaos_px_decrypt(machine); + svcpcb_gfx_decrypt(machine); + kof2000_neogeo_gfx_decrypt(machine, 0x57); + svcpcb_s1data_decrypt(machine); + neo_pcm2_swap(machine, 3); neogeo_fixed_layer_bank_type = 2; DRIVER_INIT_CALL(neogeo); install_pvc_protection(machine); @@ -7105,78 +7105,78 @@ static DRIVER_INIT( svcpcb ) static DRIVER_INIT( svc ) { - svcchaos_px_decrypt(); - neo_pcm2_swap(3); + svcchaos_px_decrypt(machine); + neo_pcm2_swap(machine, 3); neogeo_fixed_layer_bank_type = 2; - kof2000_neogeo_gfx_decrypt(0x57); + kof2000_neogeo_gfx_decrypt(machine, 0x57); DRIVER_INIT_CALL(neogeo); install_pvc_protection(machine); } static DRIVER_INIT( svcboot ) { - svcboot_px_decrypt(); - svcboot_cx_decrypt(); + svcboot_px_decrypt(machine); + svcboot_cx_decrypt(machine); DRIVER_INIT_CALL(neogeo); install_pvc_protection(machine); } static DRIVER_INIT( svcplus ) { - svcplus_px_decrypt(); - svcboot_cx_decrypt(); -// svcplus_sx_decrypt(); - neogeo_bootleg_sx_decrypt(1); - svcplus_px_hack(); + svcplus_px_decrypt(machine); + svcboot_cx_decrypt(machine); + //svcplus_sx_decrypt(machine); + neogeo_bootleg_sx_decrypt(machine, 1); + svcplus_px_hack(machine); DRIVER_INIT_CALL(neogeo); } static DRIVER_INIT( svcplusa ) { - svcplusa_px_decrypt(); - svcboot_cx_decrypt(); - svcplus_px_hack(); + svcplusa_px_decrypt(machine); + svcboot_cx_decrypt(machine); + svcplus_px_hack(machine); DRIVER_INIT_CALL(neogeo); } static DRIVER_INIT( svcsplus ) { - svcsplus_px_decrypt(); -// svcsplus_sx_decrypt(); - neogeo_bootleg_sx_decrypt(2); - svcboot_cx_decrypt(); - svcsplus_px_hack(); + svcsplus_px_decrypt(machine); + //svcsplus_sx_decrypt(machine); + neogeo_bootleg_sx_decrypt(machine, 2); + svcboot_cx_decrypt(machine); + svcsplus_px_hack(machine); DRIVER_INIT_CALL(neogeo); install_pvc_protection(machine); } static DRIVER_INIT( samsho5 ) { - samsho5_decrypt_68k(); - neo_pcm2_swap(4); + samsho5_decrypt_68k(machine); + neo_pcm2_swap(machine, 4); neogeo_fixed_layer_bank_type = 1; - kof2000_neogeo_gfx_decrypt(0x0f); + kof2000_neogeo_gfx_decrypt(machine, 0x0f); DRIVER_INIT_CALL(neogeo); } static DRIVER_INIT( samsho5b ) { - neo_pcm2_swap(4); + neo_pcm2_swap(machine, 4); neogeo_fixed_layer_bank_type = 1; - kof2000_neogeo_gfx_decrypt(0x0f); - samsh5bl_px_decrypt(); + kof2000_neogeo_gfx_decrypt(machine, 0x0f); + samsh5bl_px_decrypt(machine); DRIVER_INIT_CALL(neogeo); } static DRIVER_INIT( kf2k3pcb ) { - kf2k3pcb_decrypt_68k(); - kf2k3pcb_gfx_decrypt(); - kof2000_neogeo_gfx_decrypt(0x9d); - kf2k3pcb_decrypt_s1data(); - kof2003biosdecode(); + kf2k3pcb_decrypt_68k(machine); + kf2k3pcb_gfx_decrypt(machine); + kof2000_neogeo_gfx_decrypt(machine, 0x9d); + kf2k3pcb_decrypt_s1data(machine); + kof2003biosdecode(machine); /* rom[i] = BITSWAP8(rom[i], 5, 6, 1, 4, 3, 0, 7, 2) -- extra encrypted m1 swap? not confirmed */ - neo_pcm2_swap(5); + neo_pcm2_swap(machine, 5); neogeo_fixed_layer_bank_type = 2; DRIVER_INIT_CALL(neogeo); install_pvc_protection(machine); @@ -7186,27 +7186,27 @@ static DRIVER_INIT( kf2k3pcb ) static DRIVER_INIT( kof2003 ) { - kof2003_decrypt_68k(); - neo_pcm2_swap(5); + kof2003_decrypt_68k(machine); + neo_pcm2_swap(machine, 5); neogeo_fixed_layer_bank_type = 2; - kof2000_neogeo_gfx_decrypt(0x9d); + kof2000_neogeo_gfx_decrypt(machine, 0x9d); DRIVER_INIT_CALL(neogeo); install_pvc_protection(machine); } static DRIVER_INIT( kof2003b ) { -// kof2003b_sx_decrypt(); - neogeo_bootleg_sx_decrypt(1); + //kof2003b_sx_decrypt(machine); + neogeo_bootleg_sx_decrypt(machine, 1); DRIVER_INIT_CALL(neogeo); kof2003b_install_protection(machine); } static DRIVER_INIT( kof2k3pl ) { - kof2k3pl_px_decrypt(); - //decrypt_ms5plus_s1(); - neogeo_bootleg_sx_decrypt(1); + kof2k3pl_px_decrypt(machine); + //decrypt_ms5plus_s1(machine); + neogeo_bootleg_sx_decrypt(machine, 1); DRIVER_INIT_CALL(neogeo); kf2k3pl_install_protection(machine); } @@ -7214,9 +7214,9 @@ static DRIVER_INIT( kof2k3pl ) static DRIVER_INIT( kof2k3up ) { - kof2k3up_px_decrypt(); -// kof2k3up_sx_decrypt(); - neogeo_bootleg_sx_decrypt(2); + kof2k3up_px_decrypt(machine); + //kof2k3up_sx_decrypt(machine); + neogeo_bootleg_sx_decrypt(machine, 2); DRIVER_INIT_CALL(neogeo); kof2k3up_install_protection(machine); } @@ -7225,10 +7225,10 @@ static DRIVER_INIT( kof2k3up ) static DRIVER_INIT( samsh5sp ) { - samsh5p_decrypt_68k(); - neo_pcm2_swap(6); + samsh5p_decrypt_68k(machine); + neo_pcm2_swap(machine, 6); neogeo_fixed_layer_bank_type = 1; - kof2000_neogeo_gfx_decrypt(0x0d); + kof2000_neogeo_gfx_decrypt(machine, 0x0d); DRIVER_INIT_CALL(neogeo); } @@ -7238,7 +7238,7 @@ static DRIVER_INIT( jockeygp ) UINT16* extra_ram; neogeo_fixed_layer_bank_type = 1; - kof2000_neogeo_gfx_decrypt(0xac); + kof2000_neogeo_gfx_decrypt(machine, 0xac); /* install some extra RAM */ extra_ram = auto_malloc(0x2000); @@ -7265,7 +7265,7 @@ static DRIVER_INIT( vliner ) memory_set_bankptr(NEOGEO_BANK_EXTRA_RAM, extra_ram); memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x280000, 0x280001, 0, 0, input_port_read_handler16(machine->portconfig, "IN5") ); - memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2c0000, 0x2c0001, 0, 0, input_port_read_handler16(machine->portconfig, "IN6") ); + memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2c0000, 0x2c0001, 0, 0, input_port_read_handler16(machine->portconfig, "IN6") ); DRIVER_INIT_CALL(neogeo); } @@ -7276,73 +7276,73 @@ static DRIVER_INIT( kog ) /* overlay cartridge ROM */ memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0ffffe, 0x0fffff, 0, 0, input_port_read_handler16(machine->portconfig, "JUMPER") ); - kog_px_decrypt(); - neogeo_bootleg_sx_decrypt(1); - neogeo_bootleg_cx_decrypt(); + kog_px_decrypt(machine); + neogeo_bootleg_sx_decrypt(machine, 1); + neogeo_bootleg_cx_decrypt(machine); DRIVER_INIT_CALL(neogeo); } static DRIVER_INIT( kof10th ) { - decrypt_kof10th(); + decrypt_kof10th(machine); DRIVER_INIT_CALL(neogeo); install_kof10th_protection(machine); } static DRIVER_INIT( kf10thep ) { - decrypt_kf10thep(); + decrypt_kf10thep(machine); DRIVER_INIT_CALL(neogeo); } static DRIVER_INIT( kf2k5uni ) { - decrypt_kf2k5uni(); + decrypt_kf2k5uni(machine); DRIVER_INIT_CALL(neogeo); } static DRIVER_INIT( cthd2003 ) { - decrypt_cthd2003(); + decrypt_cthd2003(machine); DRIVER_INIT_CALL(neogeo); patch_cthd2003(machine); } static DRIVER_INIT ( ct2k3sp ) { - decrypt_ct2k3sp(); + decrypt_ct2k3sp(machine); DRIVER_INIT_CALL(neogeo); patch_cthd2003(machine); } static DRIVER_INIT ( ct2k3sa ) { - decrypt_ct2k3sa(); + decrypt_ct2k3sa(machine); DRIVER_INIT_CALL(neogeo); - patch_ct2k3sa(); + patch_ct2k3sa(machine); } static DRIVER_INIT( kof2k4se ) { - decrypt_kof2k4se_68k(); + decrypt_kof2k4se_68k(machine); DRIVER_INIT_CALL(neogeo); } static DRIVER_INIT( lans2004 ) { - lans2004_decrypt_68k(); - lans2004_vx_decrypt(); - neogeo_bootleg_sx_decrypt(1); - neogeo_bootleg_cx_decrypt(); + lans2004_decrypt_68k(machine); + lans2004_vx_decrypt(machine); + neogeo_bootleg_sx_decrypt(machine, 1); + neogeo_bootleg_cx_decrypt(machine); DRIVER_INIT_CALL(neogeo); } static DRIVER_INIT( mslug3b6 ) { - neogeo_bootleg_sx_decrypt(2); - cmc42_neogeo_gfx_decrypt(0xad); + neogeo_bootleg_sx_decrypt(machine, 2); + cmc42_neogeo_gfx_decrypt(machine, 0xad); DRIVER_INIT_CALL(neogeo); } diff --git a/src/mame/drivers/neogeo.c b/src/mame/drivers/neogeo.c index 846c1ecc8c7..dcb417ef6ba 100644 --- a/src/mame/drivers/neogeo.c +++ b/src/mame/drivers/neogeo.c @@ -80,6 +80,7 @@ ****************************************************************************/ #include "driver.h" +#include "deprecat.h" #include "neogeo.h" #include "machine/pd4990a.h" #include "cpu/z80/z80.h" @@ -627,9 +628,9 @@ static void set_main_cpu_vector_table_source(UINT8 data) } -static void _set_main_cpu_bank_address(void) +static void _set_main_cpu_bank_address(running_machine *machine) { - memory_set_bankptr(NEOGEO_BANK_CARTRIDGE, &memory_region(NEOGEO_REGION_MAIN_CPU_CARTRIDGE)[main_cpu_bank_address]); + memory_set_bankptr(NEOGEO_BANK_CARTRIDGE, &memory_region(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE)[main_cpu_bank_address]); } @@ -639,14 +640,15 @@ void neogeo_set_main_cpu_bank_address(UINT32 bank_address) main_cpu_bank_address = bank_address; - _set_main_cpu_bank_address(); + _set_main_cpu_bank_address(Machine); } static WRITE16_HANDLER( main_cpu_bank_select_w ) { UINT32 bank_address; - UINT32 len = memory_region_length(NEOGEO_REGION_MAIN_CPU_CARTRIDGE); + UINT32 len = memory_region_length(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE); + if ((len <= 0x100000) && (data & 0x07)) logerror("PC %06x: warning: bankswitch to %02x but no banks available\n", activecpu_get_pc(), data); else @@ -664,14 +666,14 @@ static WRITE16_HANDLER( main_cpu_bank_select_w ) } -static void main_cpu_banking_init(void) +static void main_cpu_banking_init(running_machine *machine) { /* create vector banks */ - memory_configure_bank(NEOGEO_BANK_VECTORS, 0, 1, memory_region(NEOGEO_REGION_MAIN_CPU_BIOS), 0); - memory_configure_bank(NEOGEO_BANK_VECTORS, 1, 1, memory_region(NEOGEO_REGION_MAIN_CPU_CARTRIDGE), 0); + memory_configure_bank(NEOGEO_BANK_VECTORS, 0, 1, memory_region(machine, NEOGEO_REGION_MAIN_CPU_BIOS), 0); + memory_configure_bank(NEOGEO_BANK_VECTORS, 1, 1, memory_region(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE), 0); /* set initial main CPU bank */ - if (memory_region_length(NEOGEO_REGION_MAIN_CPU_CARTRIDGE) > 0x100000) + if (memory_region_length(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE) > 0x100000) neogeo_set_main_cpu_bank_address(0x100000); else neogeo_set_main_cpu_bank_address(0x000000); @@ -738,7 +740,7 @@ static READ8_HANDLER( audio_cpu_bank_select_8000_bfff_r ) static void _set_audio_cpu_rom_source(running_machine *machine) { -/* if (!memory_region(NEOGEO_REGION_AUDIO_CPU_BIOS)) */ +/* if (!memory_region(machine, NEOGEO_REGION_AUDIO_CPU_BIOS)) */ audio_cpu_rom_source = 1; memory_set_bank(NEOGEO_BANK_AUDIO_CPU_MAIN_BANK, audio_cpu_rom_source); @@ -771,14 +773,14 @@ static void audio_cpu_banking_init(running_machine *machine) UINT32 address_mask; /* audio bios/cartridge selection */ - if (memory_region(NEOGEO_REGION_AUDIO_CPU_BIOS)) - memory_configure_bank(NEOGEO_BANK_AUDIO_CPU_MAIN_BANK, 0, 1, memory_region(NEOGEO_REGION_AUDIO_CPU_BIOS), 0); - memory_configure_bank(NEOGEO_BANK_AUDIO_CPU_MAIN_BANK, 1, 1, memory_region(NEOGEO_REGION_AUDIO_CPU_CARTRIDGE), 0); + if (memory_region(machine, NEOGEO_REGION_AUDIO_CPU_BIOS)) + memory_configure_bank(NEOGEO_BANK_AUDIO_CPU_MAIN_BANK, 0, 1, memory_region(machine, NEOGEO_REGION_AUDIO_CPU_BIOS), 0); + memory_configure_bank(NEOGEO_BANK_AUDIO_CPU_MAIN_BANK, 1, 1, memory_region(machine, NEOGEO_REGION_AUDIO_CPU_CARTRIDGE), 0); /* audio banking */ - address_mask = memory_region_length(NEOGEO_REGION_AUDIO_CPU_CARTRIDGE) - 0x10000 - 1; + address_mask = memory_region_length(machine, NEOGEO_REGION_AUDIO_CPU_CARTRIDGE) - 0x10000 - 1; - rgn = memory_region(NEOGEO_REGION_AUDIO_CPU_CARTRIDGE); + rgn = memory_region(machine, NEOGEO_REGION_AUDIO_CPU_CARTRIDGE); for (region = 0; region < 4; region++) { for (bank = 0; bank < 0x100; bank++) @@ -947,7 +949,7 @@ static void set_output_data(UINT8 data) static STATE_POSTLOAD( neogeo_postload ) { - _set_main_cpu_bank_address(); + _set_main_cpu_bank_address(machine); _set_main_cpu_vector_table_source(); set_audio_cpu_banking(); _set_audio_cpu_rom_source(machine); @@ -957,10 +959,10 @@ static STATE_POSTLOAD( neogeo_postload ) static MACHINE_START( neogeo ) { /* set the BIOS bank */ - memory_set_bankptr(NEOGEO_BANK_BIOS, memory_region(NEOGEO_REGION_MAIN_CPU_BIOS)); + memory_set_bankptr(NEOGEO_BANK_BIOS, memory_region(machine, NEOGEO_REGION_MAIN_CPU_BIOS)); /* set the initial main CPU bank */ - main_cpu_banking_init(); + main_cpu_banking_init(machine); /* set the initial audio CPU ROM banks */ audio_cpu_banking_init(machine); @@ -1276,7 +1278,7 @@ MACHINE_DRIVER_END static DRIVER_INIT( neogeo ) { /* set the Delta-T sample region */ - ym2610_interface.pcmromb = memory_region(NEOGEO_REGION_AUDIO_DATA_2) ? NEOGEO_REGION_AUDIO_DATA_2 : NEOGEO_REGION_AUDIO_DATA_1; + ym2610_interface.pcmromb = memory_region(machine, NEOGEO_REGION_AUDIO_DATA_2) ? NEOGEO_REGION_AUDIO_DATA_2 : NEOGEO_REGION_AUDIO_DATA_1; } diff --git a/src/mame/drivers/ninjakd2.c b/src/mame/drivers/ninjakd2.c index 855d31df846..3d51a7724b4 100644 --- a/src/mame/drivers/ninjakd2.c +++ b/src/mame/drivers/ninjakd2.c @@ -121,6 +121,7 @@ TODO: ******************************************************************************/ #include "driver.h" +#include "deprecat.h" #include "sound/2203intf.h" #include "sound/samples.h" #include "machine/mc8123.h" @@ -151,26 +152,26 @@ static INTERRUPT_GEN( ninjakd2_interrupt ) static MACHINE_RESET( ninjakd2 ) { /* initialize main Z80 bank */ - memory_configure_bank(1, 0, 8, memory_region(REGION_CPU1) + 0x10000, 0x4000); + memory_configure_bank(1, 0, 8, memory_region(machine, REGION_CPU1) + 0x10000, 0x4000); memory_set_bank(1, 0); } -static void robokid_init_banks(void) +static void robokid_init_banks(running_machine *machine) { /* initialize main Z80 bank */ - memory_configure_bank(1, 0, 2, memory_region(REGION_CPU1), 0x4000); - memory_configure_bank(1, 2, 14, memory_region(REGION_CPU1) + 0x10000, 0x4000); + memory_configure_bank(1, 0, 2, memory_region(machine, REGION_CPU1), 0x4000); + memory_configure_bank(1, 2, 14, memory_region(machine, REGION_CPU1) + 0x10000, 0x4000); memory_set_bank(1, 0); } static MACHINE_RESET( robokid ) { - robokid_init_banks(); + robokid_init_banks(machine); } static MACHINE_RESET( omegaf ) { - robokid_init_banks(); + robokid_init_banks(machine); omegaf_io_protection_reset(); } @@ -202,9 +203,9 @@ static WRITE8_HANDLER( ninjakd2_soundreset_w ) static void ninjakd2_init_samples(void) { - const UINT8* const rom = memory_region(REGION_SOUND1); + const UINT8* const rom = memory_region(Machine, REGION_SOUND1); - const int length = memory_region_length(REGION_SOUND1); + const int length = memory_region_length(Machine, REGION_SOUND1); INT16* const sampledata = auto_malloc(length * sizeof(sampledata[0])); @@ -219,12 +220,12 @@ static void ninjakd2_init_samples(void) static WRITE8_HANDLER( ninjakd2_pcm_play_w ) { - const UINT8* const rom = memory_region(REGION_SOUND1); + const UINT8* const rom = memory_region(machine, REGION_SOUND1); // only Ninja Kid II uses this if (rom) { - const int length = memory_region_length(REGION_SOUND1); + const int length = memory_region_length(machine, REGION_SOUND1); const int start = data << 8; @@ -1408,11 +1409,11 @@ by one place all the intervening bits. ******************************************************************************/ -static void lineswap_gfx_roms(const int region, const int bit) +static void lineswap_gfx_roms(running_machine *machine, const int region, const int bit) { - const int length = memory_region_length(region); + const int length = memory_region_length(machine, region); - UINT8* const src = memory_region(region); + UINT8* const src = memory_region(machine, region); UINT8* const temp = malloc_or_die(length); @@ -1432,11 +1433,11 @@ static void lineswap_gfx_roms(const int region, const int bit) free(temp); } -static void gfx_unscramble(void) +static void gfx_unscramble(running_machine *machine) { - lineswap_gfx_roms(REGION_GFX1, 13); // fg tiles - lineswap_gfx_roms(REGION_GFX2, 14); // sprites - lineswap_gfx_roms(REGION_GFX3, 14); // bg tiles + lineswap_gfx_roms(machine, REGION_GFX1, 13); // fg tiles + lineswap_gfx_roms(machine, REGION_GFX2, 14); // sprites + lineswap_gfx_roms(machine, REGION_GFX3, 14); // bg tiles } @@ -1449,21 +1450,21 @@ static void gfx_unscramble(void) static DRIVER_INIT( ninjakd2 ) { - mc8123_decrypt_rom(1, memory_region(REGION_USER1), 0, 0); + mc8123_decrypt_rom(machine, 1, memory_region(machine, REGION_USER1), 0, 0); - gfx_unscramble(); + gfx_unscramble(machine); } static DRIVER_INIT( bootleg ) { - memory_set_decrypted_region(1, 0x0000, 0x7fff, memory_region(REGION_CPU2) + 0x10000); + memory_set_decrypted_region(1, 0x0000, 0x7fff, memory_region(machine, REGION_CPU2) + 0x10000); - gfx_unscramble(); + gfx_unscramble(machine); } static DRIVER_INIT(mnight) { - gfx_unscramble(); + gfx_unscramble(machine); } diff --git a/src/mame/drivers/ninjaw.c b/src/mame/drivers/ninjaw.c index 31ca3a8203d..45a9b0c2807 100644 --- a/src/mame/drivers/ninjaw.c +++ b/src/mame/drivers/ninjaw.c @@ -234,15 +234,15 @@ static WRITE16_HANDLER( cpua_ctrl_w ) static INT32 banknum = -1; -static void reset_sound_region(void) +static void reset_sound_region(running_machine *machine) { - memory_set_bankptr( 10, memory_region(REGION_CPU2) + (banknum * 0x4000) + 0x10000 ); + memory_set_bankptr( 10, memory_region(machine, REGION_CPU2) + (banknum * 0x4000) + 0x10000 ); } static WRITE8_HANDLER( sound_bankswitch_w ) { banknum = (data - 1) & 7; - reset_sound_region(); + reset_sound_region(machine); } static WRITE16_HANDLER( ninjaw_sound_w ) @@ -929,7 +929,7 @@ ROM_END static STATE_POSTLOAD( ninjaw_postload ) { parse_control(machine); - reset_sound_region(); + reset_sound_region(machine); } static MACHINE_START( ninjaw ) diff --git a/src/mame/drivers/niyanpai.c b/src/mame/drivers/niyanpai.c index b16fee02360..87fcd20bfe8 100644 --- a/src/mame/drivers/niyanpai.c +++ b/src/mame/drivers/niyanpai.c @@ -76,9 +76,9 @@ static int musobana_inputport; static int musobana_outcoin_flag; -static void niyanpai_soundbank_w(int data) +static void niyanpai_soundbank_w(running_machine *machine, int data) { - UINT8 *SNDROM = memory_region(REGION_CPU2); + UINT8 *SNDROM = memory_region(machine, REGION_CPU2); memory_set_bankptr(1, &SNDROM[0x08000 + (0x8000 * (data & 0x03))]); } @@ -138,7 +138,7 @@ static void tmpz84c011_pio_w(running_machine *machine, int offset, int data) switch (offset) { case 0: /* PA_0 */ - niyanpai_soundbank_w(data & 0x03); + niyanpai_soundbank_w(machine, data & 0x03); break; case 1: /* PB_0 */ DAC_1_WRITE(machine, 0, data); @@ -220,8 +220,8 @@ static MACHINE_RESET( niyanpai ) static DRIVER_INIT( niyanpai ) { - UINT8 *MAINROM = memory_region(REGION_CPU1); - UINT8 *SNDROM = memory_region(REGION_CPU2); + UINT8 *MAINROM = memory_region(machine, REGION_CPU1); + UINT8 *SNDROM = memory_region(machine, REGION_CPU2); // main program patch (USR0 -> IRQ LEVEL1) MAINROM[(25 * 4) + 0] = MAINROM[(64 * 4) + 0]; @@ -236,7 +236,7 @@ static DRIVER_INIT( niyanpai ) tmpz84c011_init(machine); // initialize sound rom bank - niyanpai_soundbank_w(0); + niyanpai_soundbank_w(machine, 0); // initialize out coin flag (musobana) musobana_outcoin_flag = 1; diff --git a/src/mame/drivers/nmk16.c b/src/mame/drivers/nmk16.c index 4843036ba35..9dc86fe7aab 100644 --- a/src/mame/drivers/nmk16.c +++ b/src/mame/drivers/nmk16.c @@ -289,7 +289,7 @@ static WRITE16_HANDLER ( ssmissin_sound_w ) static WRITE8_HANDLER ( ssmissin_soundbank_w ) { - UINT8 *rom = memory_region(REGION_SOUND1); + UINT8 *rom = memory_region(machine, REGION_SOUND1); int bank; bank = data & 0x3; @@ -349,14 +349,14 @@ static READ16_HANDLER( macross2_sound_result_r ) static WRITE8_HANDLER( macross2_sound_bank_w ) { - UINT8 *rom = memory_region(REGION_CPU2) + 0x10000; + UINT8 *rom = memory_region(machine, REGION_CPU2) + 0x10000; memory_set_bankptr(1,rom + (data & 0x07) * 0x4000); } static WRITE8_HANDLER( tharrier_oki6295_bankswitch_0_w ) { - UINT8 *rom = memory_region(REGION_SOUND1); + UINT8 *rom = memory_region(machine, REGION_SOUND1); data &= 3; if (data != 3) @@ -365,7 +365,7 @@ static WRITE8_HANDLER( tharrier_oki6295_bankswitch_0_w ) static WRITE8_HANDLER( tharrier_oki6295_bankswitch_1_w ) { - UINT8 *rom = memory_region(REGION_SOUND2); + UINT8 *rom = memory_region(machine, REGION_SOUND2); data &= 3; if (data != 3) @@ -1067,7 +1067,7 @@ static WRITE8_HANDLER( okibank_w ) static WRITE8_HANDLER( raphero_sound_rombank_w ) { - memory_set_bankptr(1,memory_region(REGION_CPU2) + 0x10000 + (data & 0x07) * 0x4000); + memory_set_bankptr(1,memory_region(machine, REGION_CPU2) + 0x10000 + (data & 0x07) * 0x4000); } static ADDRESS_MAP_START( raphero_sound_mem_map, ADDRESS_SPACE_PROGRAM, 8 ) @@ -4592,7 +4592,7 @@ static UINT32 bjtwin_address_map_sprites(UINT32 addr) } -static void decode_gfx(void) +static void decode_gfx(running_machine *machine) { /* GFX are scrambled. We decode them here. (BIG Thanks to Antiriad for descrambling info) */ UINT8 *rom; @@ -4625,16 +4625,16 @@ static void decode_gfx(void) /* background */ - rom = memory_region(REGION_GFX2); - len = memory_region_length(REGION_GFX2); + rom = memory_region(machine, REGION_GFX2); + len = memory_region_length(machine, REGION_GFX2); for (A = 0;A < len;A++) { rom[A] = decode_byte( rom[A], decode_data_bg[bjtwin_address_map_bg0(A)]); } /* sprites */ - rom = memory_region(REGION_GFX3); - len = memory_region_length(REGION_GFX3); + rom = memory_region(machine, REGION_GFX3); + len = memory_region_length(machine, REGION_GFX3); for (A = 0;A < len;A += 2) { UINT16 tmp = decode_word( rom[A+1]*256 + rom[A], decode_data_sprite[bjtwin_address_map_sprites(A)]); @@ -4643,7 +4643,7 @@ static void decode_gfx(void) } } -static void decode_tdragonb(void) +static void decode_tdragonb(running_machine *machine) { /* Descrambling Info Again Taken from Raine, Huge Thanks to Antiriad and the Raine Team for going Open Source, best of luck in future development. */ @@ -4663,8 +4663,8 @@ static void decode_tdragonb(void) {0x7,0x6,0x5,0x3,0x4,0x2,0x1,0x0}, }; - rom = memory_region(REGION_CPU1); - len = memory_region_length(REGION_CPU1); + rom = memory_region(machine, REGION_CPU1); + len = memory_region_length(machine, REGION_CPU1); for (A = 0;A < len;A += 2) { #ifdef LSB_FIRST @@ -4678,22 +4678,22 @@ static void decode_tdragonb(void) #endif } - rom = memory_region(REGION_GFX2); - len = memory_region_length(REGION_GFX2); + rom = memory_region(machine, REGION_GFX2); + len = memory_region_length(machine, REGION_GFX2); for (A = 0;A < len;A++) { rom[A] = decode_byte( rom[A], decode_data_tdragonbgfx[0]); } - rom = memory_region(REGION_GFX3); - len = memory_region_length(REGION_GFX3); + rom = memory_region(machine, REGION_GFX3); + len = memory_region_length(machine, REGION_GFX3); for (A = 0;A < len;A++) { rom[A] = decode_byte( rom[A], decode_data_tdragonbgfx[0]); } } -static void decode_ssmissin(void) +static void decode_ssmissin(running_machine *machine) { /* Like Thunder Dragon Bootleg without the Program Rom Swapping */ UINT8 *rom; @@ -4705,15 +4705,15 @@ static void decode_ssmissin(void) {0x7,0x6,0x5,0x3,0x4,0x2,0x1,0x0}, }; - rom = memory_region(REGION_GFX2); - len = memory_region_length(REGION_GFX2); + rom = memory_region(machine, REGION_GFX2); + len = memory_region_length(machine, REGION_GFX2); for (A = 0;A < len;A++) { rom[A] = decode_byte( rom[A], decode_data_tdragonbgfx[0]); } - rom = memory_region(REGION_GFX3); - len = memory_region_length(REGION_GFX3); + rom = memory_region(machine, REGION_GFX3); + len = memory_region_length(machine, REGION_GFX3); for (A = 0;A < len;A++) { rom[A] = decode_byte( rom[A], decode_data_tdragonbgfx[0]); @@ -4723,12 +4723,12 @@ static void decode_ssmissin(void) static DRIVER_INIT( nmk ) { - decode_gfx(); + decode_gfx(machine); } static DRIVER_INIT( hachamf ) { - UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *rom = (UINT16 *)memory_region(machine, REGION_CPU1); //rom[0x0006/2] = 0x7dc2; /* replace reset vector with the "real" one */ @@ -4739,9 +4739,9 @@ static DRIVER_INIT( hachamf ) static DRIVER_INIT( tdragonb ) { - UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *rom = (UINT16 *)memory_region(machine, REGION_CPU1); - decode_tdragonb(); + decode_tdragonb(machine); /* The Following Patch is taken from Raine, Otherwise the game has no Sprites in Attract Mode or After Level 1 which is rather odd considering its a bootleg.. */ @@ -4750,7 +4750,7 @@ static DRIVER_INIT( tdragonb ) static DRIVER_INIT( tdragon ) { - UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *rom = (UINT16 *)memory_region(machine, REGION_CPU1); //rom[0x94b0/2] = 0; /* Patch out JMP to shared memory (protection) */ //rom[0x94b2/2] = 0x92f4; @@ -4762,7 +4762,7 @@ static DRIVER_INIT( tdragon ) static DRIVER_INIT( ssmissin ) { - decode_ssmissin(); + decode_ssmissin(machine); } static DRIVER_INIT( bjtwin ) @@ -4784,7 +4784,7 @@ static DRIVER_INIT( bjtwin ) * 008F7E: 207C 000F 9000 movea.l #$f9000, A0 */ #if 0 - UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *rom = (UINT16 *)memory_region(machine, REGION_CPU1); rom[0x09172/2] = 0x6006; /* patch checksum error */ rom[0x08f74/2] = 0x4e71; #endif @@ -5185,12 +5185,12 @@ MACHINE_DRIVER_END /* Address lines scrambling */ -static void decryptcode( int a23, int a22, int a21, int a20, int a19, int a18, int a17, int a16, int a15, int a14, int a13, int a12, +static void decryptcode( running_machine *machine, int a23, int a22, int a21, int a20, int a19, int a18, int a17, int a16, int a15, int a14, int a13, int a12, int a11, int a10, int a9, int a8, int a7, int a6, int a5, int a4, int a3, int a2, int a1, int a0 ) { int i; - UINT8 *RAM = memory_region( REGION_CPU1 ); - size_t size = memory_region_length( REGION_CPU1 ); + UINT8 *RAM = memory_region( machine, REGION_CPU1 ); + size_t size = memory_region_length( machine, REGION_CPU1 ); UINT8 *buffer = malloc_or_die( size ); memcpy( buffer, RAM, size ); @@ -6479,7 +6479,7 @@ ROM_END static DRIVER_INIT( redhawk ) { - decryptcode( 23, 22, 21, 20, 19, 18, 16, 15, 14, 17, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 ); + decryptcode( machine, 23, 22, 21, 20, 19, 18, 16, 15, 14, 17, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 ); } ROM_START( redhawkb ) @@ -6558,7 +6558,7 @@ ROM_END static DRIVER_INIT( grdnstrm ) { - decryptcode( 23, 22, 21, 20, 19, 18, 16, 17, 14, 15, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 ); + decryptcode( machine, 23, 22, 21, 20, 19, 18, 16, 17, 14, 15, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 ); } /* Pop's Pop's */ @@ -6808,7 +6808,7 @@ ROM_END static DRIVER_INIT( bubl2000 ) { - decryptcode( 23, 22, 21, 20, 19, 18, 13, 14, 15, 16, 17, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 ); + decryptcode( machine, 23, 22, 21, 20, 19, 18, 13, 14, 15, 16, 17, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 ); } /* @@ -6928,7 +6928,7 @@ ROM_END static DRIVER_INIT( spec2k ) { - decryptcode( 23, 22, 21, 20, + decryptcode( machine, 23, 22, 21, 20, 19, 18, 17, 13, 14, 15, 16, 12, 11, 10, 9, 8, diff --git a/src/mame/drivers/nova2001.c b/src/mame/drivers/nova2001.c index 01cb1c396c8..1db8b46896b 100644 --- a/src/mame/drivers/nova2001.c +++ b/src/mame/drivers/nova2001.c @@ -1002,11 +1002,11 @@ This code is overly generic because it is used for several games in ninjakd2.c ******************************************************************************/ -static void lineswap_gfx_roms(const int region, const int bit) +static void lineswap_gfx_roms(running_machine *machine, const int region, const int bit) { - const int length = memory_region_length(region); + const int length = memory_region_length(machine, region); - UINT8* const src = memory_region(region); + UINT8* const src = memory_region(machine, region); UINT8* const temp = malloc_or_die(length); @@ -1036,13 +1036,13 @@ static void lineswap_gfx_roms(const int region, const int bit) static DRIVER_INIT( pkunwar ) { - lineswap_gfx_roms(REGION_GFX1, 13); + lineswap_gfx_roms(machine, REGION_GFX1, 13); } static DRIVER_INIT( raiders5 ) { - lineswap_gfx_roms(REGION_GFX1, 13); - lineswap_gfx_roms(REGION_GFX2, 13); + lineswap_gfx_roms(machine, REGION_GFX1, 13); + lineswap_gfx_roms(machine, REGION_GFX2, 13); } diff --git a/src/mame/drivers/nwk-tr.c b/src/mame/drivers/nwk-tr.c index e8f377502ea..275a67b1a58 100644 --- a/src/mame/drivers/nwk-tr.c +++ b/src/mame/drivers/nwk-tr.c @@ -961,7 +961,7 @@ static void sound_irq_callback(running_machine *machine, int irq) static DRIVER_INIT( nwktr ) { init_konami_cgboard(1, CGBOARD_TYPE_NWKTR); - set_cgboard_texture_bank(0, 5, memory_region(REGION_USER5)); + set_cgboard_texture_bank(0, 5, memory_region(machine, REGION_USER5)); sharc_dataram = auto_malloc(0x100000); timekeeper_init(0, TIMEKEEPER_M48T58, backup_ram); diff --git a/src/mame/drivers/nycaptor.c b/src/mame/drivers/nycaptor.c index dcc3d6b89f7..5ffa8fe943b 100644 --- a/src/mame/drivers/nycaptor.c +++ b/src/mame/drivers/nycaptor.c @@ -287,7 +287,7 @@ static READ8_HANDLER ( nycaptor_generic_control_r ) static WRITE8_HANDLER( nycaptor_generic_control_w ) { generic_control_reg = data; - memory_set_bankptr(1, memory_region(REGION_CPU1) + 0x10000 + ((data&0x08)>>3)*0x4000 ); + memory_set_bankptr(1, memory_region(machine, REGION_CPU1) + 0x10000 + ((data&0x08)>>3)*0x4000 ); } static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) @@ -432,7 +432,7 @@ static WRITE8_HANDLER( cyclshtg_generic_control_w ) { int bank=(data>>2)&3; generic_control_reg = data; - memory_set_bankptr(1, memory_region(REGION_CPU1) + 0x10000 + bank*0x4000 ); + memory_set_bankptr(1, memory_region(machine, REGION_CPU1) + 0x10000 + bank*0x4000 ); } @@ -1285,7 +1285,7 @@ ROM_END static DRIVER_INIT(bronx) { int i; - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); for(i=0;i<0x20000;i++) rom[i]=BITSWAP8(rom[i],0,1,2,3,4,5,6,7); nyc_gametype=1; @@ -1294,7 +1294,7 @@ static DRIVER_INIT(bronx) static DRIVER_INIT(colt) { int i; - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); for(i=0;i<0x20000;i++) rom[i]=BITSWAP8(rom[i],0,1,2,3,4,5,6,7); nyc_gametype=2; diff --git a/src/mame/drivers/ohmygod.c b/src/mame/drivers/ohmygod.c index 731d2b834ce..7eb950df86f 100644 --- a/src/mame/drivers/ohmygod.c +++ b/src/mame/drivers/ohmygod.c @@ -31,7 +31,7 @@ static int nosound_kludge_step; static MACHINE_RESET( ohmygod ) { - UINT8 *rom = memory_region(REGION_SOUND1); + UINT8 *rom = memory_region(machine, REGION_SOUND1); sndbank = 0; memcpy(rom + 0x20000,rom + 0x40000 + 0x20000 * sndbank,0x20000); @@ -43,7 +43,7 @@ static WRITE16_HANDLER( ohmygod_ctrl_w ) { if (ACCESSING_BITS_0_7) { - UINT8 *rom = memory_region(REGION_SOUND1); + UINT8 *rom = memory_region(machine, REGION_SOUND1); /* ADPCM bank switch */ if (sndbank != ((data >> adpcm_bank_shift) & 0x0f)) diff --git a/src/mame/drivers/ojankohs.c b/src/mame/drivers/ojankohs.c index fa18819ec75..a52fb4c2568 100644 --- a/src/mame/drivers/ojankohs.c +++ b/src/mame/drivers/ojankohs.c @@ -74,14 +74,14 @@ static MACHINE_RESET( ojankohs ) static WRITE8_HANDLER( ojankohs_rombank_w ) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); memory_set_bankptr(1, &ROM[0x10000 + (0x4000 * (data & 0x3f))]); } static WRITE8_HANDLER( ojankoy_rombank_w ) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); memory_set_bankptr(1, &ROM[0x10000 + (0x4000 * (data & 0x1f))]); @@ -125,7 +125,7 @@ static void ojankohs_adpcm_int(running_machine *machine, int irq) static WRITE8_HANDLER( ojankoc_ctrl_w ) { - UINT8 *BANKROM = memory_region(REGION_USER1); + UINT8 *BANKROM = memory_region(machine, REGION_USER1); UINT32 bank_address = (data & 0x0f) * 0x8000; memory_set_bankptr(1, &BANKROM[bank_address]); diff --git a/src/mame/drivers/omegrace.c b/src/mame/drivers/omegrace.c index bb179f6ae8a..67e1e7e4931 100644 --- a/src/mame/drivers/omegrace.c +++ b/src/mame/drivers/omegrace.c @@ -568,8 +568,8 @@ ROM_END static DRIVER_INIT( omegrace ) { - int i, len = memory_region_length(REGION_USER1); - UINT8 *prom = memory_region(REGION_USER1); + int i, len = memory_region_length(machine, REGION_USER1); + UINT8 *prom = memory_region(machine, REGION_USER1); /* Omega Race has two pairs of the state PROM output * lines swapped before going into the decoder. diff --git a/src/mame/drivers/onetwo.c b/src/mame/drivers/onetwo.c index 9ee7d92362d..f77774b3338 100644 --- a/src/mame/drivers/onetwo.c +++ b/src/mame/drivers/onetwo.c @@ -64,7 +64,7 @@ static WRITE8_HANDLER( onetwo_fgram_w ) static WRITE8_HANDLER( onetwo_cpubank_w ) { - UINT8 *RAM = memory_region(REGION_CPU1) + 0x10000; + UINT8 *RAM = memory_region(machine, REGION_CPU1) + 0x10000; memory_set_bankptr(1,&RAM[data * 0x4000]); } diff --git a/src/mame/drivers/opwolf.c b/src/mame/drivers/opwolf.c index f00f137c9bf..18fce3d1373 100644 --- a/src/mame/drivers/opwolf.c +++ b/src/mame/drivers/opwolf.c @@ -317,7 +317,7 @@ static void opwolf_msm5205_vck(running_machine *machine, int chip) } else { - adpcm_data[chip] = memory_region(REGION_SOUND1)[adpcm_pos[chip]]; + adpcm_data[chip] = memory_region(machine, REGION_SOUND1)[adpcm_pos[chip]]; adpcm_pos[chip] = (adpcm_pos[chip] + 1) & 0x7ffff; MSM5205_data_w(chip, adpcm_data[chip] >> 4); } @@ -777,7 +777,7 @@ ROM_END static DRIVER_INIT( opwolf ) { - UINT16* rom=(UINT16*)memory_region(REGION_CPU1); + UINT16* rom=(UINT16*)memory_region(machine, REGION_CPU1); opwolf_region = rom[0x03fffe / 2] & 0xff; @@ -787,13 +787,13 @@ static DRIVER_INIT( opwolf ) opwolf_gun_xoffs = 0xec - (rom[0x03ffb0 / 2] & 0xff); opwolf_gun_yoffs = 0x1c - (rom[0x03ffae / 2] & 0xff); - memory_configure_bank(10, 0, 4, memory_region(REGION_CPU2) + 0x10000, 0x4000); + memory_configure_bank(10, 0, 4, memory_region(machine, REGION_CPU2) + 0x10000, 0x4000); } static DRIVER_INIT( opwolfb ) { - UINT16* rom=(UINT16*)memory_region(REGION_CPU1); + UINT16* rom=(UINT16*)memory_region(machine, REGION_CPU1); opwolf_region = rom[0x03fffe / 2] & 0xff; @@ -801,7 +801,7 @@ static DRIVER_INIT( opwolfb ) opwolf_gun_xoffs = -2; opwolf_gun_yoffs = 17; - memory_configure_bank(10, 0, 4, memory_region(REGION_CPU2) + 0x10000, 0x4000); + memory_configure_bank(10, 0, 4, memory_region(machine, REGION_CPU2) + 0x10000, 0x4000); } diff --git a/src/mame/drivers/othunder.c b/src/mame/drivers/othunder.c index 44da9d868b7..76ace1f6641 100644 --- a/src/mame/drivers/othunder.c +++ b/src/mame/drivers/othunder.c @@ -435,14 +435,14 @@ static WRITE16_HANDLER( othunder_lightgun_w ) static INT32 banknum = -1; -static void reset_sound_region(void) +static void reset_sound_region(running_machine *machine) { - memory_set_bankptr( 10, memory_region(REGION_CPU2) + (banknum * 0x4000) + 0x10000 ); + memory_set_bankptr( 10, memory_region(machine, REGION_CPU2) + (banknum * 0x4000) + 0x10000 ); } static STATE_POSTLOAD( othunder_postload ) { - reset_sound_region(); + reset_sound_region(machine); } static MACHINE_START( othunder ) @@ -455,7 +455,7 @@ static MACHINE_START( othunder ) static WRITE8_HANDLER( sound_bankswitch_w ) { banknum = (data - 1) & 7; - reset_sound_region(); + reset_sound_region(machine); } static WRITE16_HANDLER( othunder_sound_w ) diff --git a/src/mame/drivers/pacman.c b/src/mame/drivers/pacman.c index 86de6aa2ed5..3d3fdc6a803 100644 --- a/src/mame/drivers/pacman.c +++ b/src/mame/drivers/pacman.c @@ -367,7 +367,7 @@ static UINT8 cannonb_bit_to_read; static MACHINE_RESET( mschamp ) { - UINT8 *rom = memory_region(REGION_CPU1) + 0x10000; + UINT8 *rom = memory_region(machine, REGION_CPU1) + 0x10000; int whichbank = input_port_read(machine, "GAME") & 1; memory_configure_bank(1, 0, 2, &rom[0x0000], 0x8000); @@ -664,7 +664,7 @@ static WRITE8_HANDLER( bigbucks_bank_w ) static READ8_HANDLER( bigbucks_question_r ) { - UINT8 *question = memory_region(REGION_USER1); + UINT8 *question = memory_region(machine, REGION_USER1); UINT8 ret; ret = question[(bigbucks_bank << 16) | (offset ^ 0xffff)]; @@ -768,7 +768,7 @@ static WRITE8_HANDLER( rocktrv2_question_bank_w ) static READ8_HANDLER( rocktrv2_question_r ) { - UINT8 *question = memory_region(REGION_USER1); + UINT8 *question = memory_region(machine, REGION_USER1); return question[offset | (rocktrv2_question_bank * 0x8000)]; } @@ -5100,10 +5100,10 @@ ROM_END * *************************************/ -static void maketrax_rom_decode(void) +static void maketrax_rom_decode(running_machine *machine) { UINT8 *decrypted = auto_malloc(0x4000); - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); /* patch protection using a copy of the opcodes so ROM checksum */ /* tests will not fail */ @@ -5128,13 +5128,13 @@ static DRIVER_INIT( maketrax ) memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x5080, 0x50bf, 0, 0, maketrax_special_port2_r); memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x50c0, 0x50ff, 0, 0, maketrax_special_port3_r); - maketrax_rom_decode(); + maketrax_rom_decode(machine); } -static void korosuke_rom_decode(void) +static void korosuke_rom_decode(running_machine *machine) { UINT8 *decrypted = auto_malloc(0x4000); - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); /* patch protection using a copy of the opcodes so ROM checksum */ /* tests will not fail */ @@ -5159,7 +5159,7 @@ static DRIVER_INIT( korosuke ) memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x5080, 0x5080, 0, 0, korosuke_special_port2_r); memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x50c0, 0x50ff, 0, 0, korosuke_special_port3_r); - korosuke_rom_decode(); + korosuke_rom_decode(machine); } static DRIVER_INIT( ponpoko ) @@ -5169,10 +5169,10 @@ static DRIVER_INIT( ponpoko ) int i, j; UINT8 *RAM, temp; - int length = memory_region_length(REGION_GFX1)/2; + int length = memory_region_length(machine, REGION_GFX1)/2; /* Characters */ - RAM = memory_region(REGION_GFX1); + RAM = memory_region(machine, REGION_GFX1); for (i = 0;i < length;i += 0x10) { for (j = 0; j < 8; j++) @@ -5184,7 +5184,7 @@ static DRIVER_INIT( ponpoko ) } /* Sprites */ - RAM = memory_region(REGION_GFX1)+length; + RAM = memory_region(machine, REGION_GFX1)+length; for (i = 0;i < length;i += 0x20) { for (j = 0; j < 8; j++) @@ -5222,7 +5222,7 @@ static DRIVER_INIT( eyes ) /* CPU ROMs */ /* Data lines D3 and D5 swapped */ - RAM = memory_region(REGION_CPU1); + RAM = memory_region(machine, REGION_CPU1); for (i = 0; i < 0x4000; i++) { RAM[i] = BITSWAP8(RAM[i],7,6,3,4,5,2,1,0); @@ -5232,8 +5232,8 @@ static DRIVER_INIT( eyes ) /* Graphics ROMs */ /* Data lines D4 and D6 and address lines A0 and A2 are swapped */ - RAM = memory_region(REGION_GFX1); - len = memory_region_length(REGION_GFX1); + RAM = memory_region(machine, REGION_GFX1); + len = memory_region_length(machine, REGION_GFX1); for (i = 0;i < len;i += 8) eyes_decode(&RAM[i]); } @@ -5246,25 +5246,25 @@ static DRIVER_INIT( woodpek ) /* Graphics ROMs */ /* Data lines D4 and D6 and address lines A0 and A2 are swapped */ - RAM = memory_region(REGION_GFX1); - len = memory_region_length(REGION_GFX1); + RAM = memory_region(machine, REGION_GFX1); + len = memory_region_length(machine, REGION_GFX1); for (i = 0;i < len;i += 8) eyes_decode(&RAM[i]); } static DRIVER_INIT( pacplus ) { - pacplus_decode(); + pacplus_decode(machine); } static DRIVER_INIT( jumpshot ) { - jumpshot_decode(); + jumpshot_decode(machine); } static DRIVER_INIT( drivfrcp ) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); int i; for( i = 0; i < 4; i++) @@ -5273,7 +5273,7 @@ static DRIVER_INIT( drivfrcp ) static DRIVER_INIT( 8bpm ) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); int i; /* Data lines D0 and D6 swapped */ @@ -5288,7 +5288,7 @@ static DRIVER_INIT( 8bpm ) static DRIVER_INIT( porky ) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); int i; /* Data lines D0 and D4 swapped */ @@ -5307,7 +5307,7 @@ static DRIVER_INIT( porky ) static DRIVER_INIT( rocktrv2 ) { /* hack to pass the rom check for the bad rom */ - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); ROM[0x7ffe] = 0xa7; ROM[0x7fee] = 0x6d; @@ -5319,7 +5319,7 @@ socket and run through the 74298. Clock is tied to system clock. */ static DRIVER_INIT( mspacmbe ) { UINT8 temp; - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); int i; /* Address lines A1 and A0 swapped if A2=0 */ diff --git a/src/mame/drivers/panicr.c b/src/mame/drivers/panicr.c index 451f2d2fa26..3aaf21549f9 100644 --- a/src/mame/drivers/panicr.c +++ b/src/mame/drivers/panicr.c @@ -126,8 +126,8 @@ static TILE_GET_INFO( get_bgtile_info ) { int code,attr; - code=memory_region(REGION_USER1)[tile_index]; - attr=memory_region(REGION_USER2)[tile_index]; + code=memory_region(machine, REGION_USER1)[tile_index]; + attr=memory_region(machine, REGION_USER2)[tile_index]; code+=((attr&7)<<8); SET_TILE_INFO( 1, @@ -438,8 +438,8 @@ static DRIVER_INIT( panicr ) int size; int i; - rom = memory_region(REGION_GFX1); - size = memory_region_length(REGION_GFX1); + rom = memory_region(machine, REGION_GFX1); + size = memory_region_length(machine, REGION_GFX1); // text data lines for (i = 0;i < size/2;i++) @@ -461,8 +461,8 @@ static DRIVER_INIT( panicr ) } - rom = memory_region(REGION_GFX2); - size = memory_region_length(REGION_GFX2); + rom = memory_region(machine, REGION_GFX2); + size = memory_region_length(machine, REGION_GFX2); // tiles data lines for (i = 0;i < size/4;i++) @@ -488,8 +488,8 @@ static DRIVER_INIT( panicr ) } - rom = memory_region(REGION_GFX3); - size = memory_region_length(REGION_GFX3); + rom = memory_region(machine, REGION_GFX3); + size = memory_region_length(machine, REGION_GFX3); // sprites data lines for (i = 0;i < size/2;i++) @@ -514,8 +514,8 @@ static DRIVER_INIT( panicr ) //rearrange bg tilemaps a bit.... - rom = memory_region(REGION_USER1); - size = memory_region_length(REGION_USER1); + rom = memory_region(machine, REGION_USER1); + size = memory_region_length(machine, REGION_USER1); memcpy(buf,rom, size); { @@ -527,8 +527,8 @@ static DRIVER_INIT( panicr ) } } - rom = memory_region(REGION_USER2); - size = memory_region_length(REGION_USER2); + rom = memory_region(machine, REGION_USER2); + size = memory_region_length(machine, REGION_USER2); memcpy(buf,rom, size); { diff --git a/src/mame/drivers/paradise.c b/src/mame/drivers/paradise.c index ceeaec0e6d3..2146777ffc4 100644 --- a/src/mame/drivers/paradise.c +++ b/src/mame/drivers/paradise.c @@ -43,7 +43,7 @@ paradise: I'm not sure it's working correctly: static WRITE8_HANDLER( paradise_rombank_w ) { int bank = data; - int bank_n = memory_region_length(REGION_CPU1)/0x4000 - 1; + int bank_n = memory_region_length(machine, REGION_CPU1)/0x4000 - 1; if (bank >= bank_n) { logerror("PC %04X - invalid rom bank %x\n",activecpu_get_pc(),bank); @@ -51,7 +51,7 @@ static WRITE8_HANDLER( paradise_rombank_w ) } if (bank >= 3) bank+=1; - memory_set_bankptr(1, memory_region(REGION_CPU1) + bank * 0x4000); + memory_set_bankptr(1, memory_region(machine, REGION_CPU1) + bank * 0x4000); } static WRITE8_HANDLER( paradise_okibank_w ) diff --git a/src/mame/drivers/parodius.c b/src/mame/drivers/parodius.c index 62292e5f0f8..ea8ce5d9f56 100644 --- a/src/mame/drivers/parodius.c +++ b/src/mame/drivers/parodius.c @@ -392,7 +392,7 @@ ROM_END static void parodius_banking(int lines) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(Machine, REGION_CPU1); int offs = 0; if (lines & 0xf0) logerror("%04x: setlines %02x\n",activecpu_get_pc(),lines); @@ -404,11 +404,11 @@ static void parodius_banking(int lines) static MACHINE_RESET( parodius ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); cpunum_set_info_fct(0, CPUINFO_PTR_KONAMI_SETLINES_CALLBACK, (genf *)parodius_banking); - paletteram = &memory_region(REGION_CPU1)[0x48000]; + paletteram = &memory_region(machine, REGION_CPU1)[0x48000]; videobank = 0; diff --git a/src/mame/drivers/pasha2.c b/src/mame/drivers/pasha2.c index 1df056108ac..9c7f111c586 100644 --- a/src/mame/drivers/pasha2.c +++ b/src/mame/drivers/pasha2.c @@ -99,7 +99,7 @@ static WRITE16_HANDLER( pasha2_misc_w ) case 0xb000: case 0xc000: case 0xd000: - memory_set_bankptr(1, memory_region(REGION_USER2) + 0x400 * (bank - 0x8000)); break; + memory_set_bankptr(1, memory_region(machine, REGION_USER2) + 0x400 * (bank - 0x8000)); break; } } } @@ -459,7 +459,7 @@ static DRIVER_INIT( pasha2 ) { memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x95744, 0x95747, 0, 0, pasha2_speedup_r ); - memory_set_bankptr(1, memory_region(REGION_USER2)); + memory_set_bankptr(1, memory_region(machine, REGION_USER2)); } GAME( 1998, pasha2, 0, pasha2, pasha2, pasha2, ROT0, "Dong Sung", "Pasha Pasha 2", GAME_IMPERFECT_SOUND ) diff --git a/src/mame/drivers/pastelg.c b/src/mame/drivers/pastelg.c index 9bc8fd1b7d0..775bc2851d0 100644 --- a/src/mame/drivers/pastelg.c +++ b/src/mame/drivers/pastelg.c @@ -51,7 +51,7 @@ static DRIVER_INIT( pastelg ) static READ8_HANDLER( pastelg_sndrom_r ) { - UINT8 *ROM = memory_region(REGION_SOUND1); + UINT8 *ROM = memory_region(machine, REGION_SOUND1); return ROM[pastelg_blitter_src_addr_r() & 0x7fff]; } diff --git a/src/mame/drivers/pbaction.c b/src/mame/drivers/pbaction.c index 09682f26c24..b178786e77d 100644 --- a/src/mame/drivers/pbaction.c +++ b/src/mame/drivers/pbaction.c @@ -406,7 +406,7 @@ static READ8_HANDLER( pbactio3_prot_kludge_r ) static DRIVER_INIT( pbactio3 ) { int i; - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); /* first of all, do a simple bitswap */ for (i = 0;i < 0xc000;i++) @@ -415,7 +415,7 @@ static DRIVER_INIT( pbactio3 ) } /* then do the standard Sega decryption */ - pbaction_decode(); + pbaction_decode(machine); /* install a protection (?) workaround */ memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xc000, 0, 0, pbactio3_prot_kludge_r ); diff --git a/src/mame/drivers/pcktgal.c b/src/mame/drivers/pcktgal.c index 75e6cfd028b..825aa169319 100644 --- a/src/mame/drivers/pcktgal.c +++ b/src/mame/drivers/pcktgal.c @@ -29,7 +29,7 @@ extern VIDEO_UPDATE( pcktgal ); static WRITE8_HANDLER( pcktgal_bank_w ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); if (data & 1) { memory_set_bankptr(1,&RAM[0x4000]); } else { memory_set_bankptr(1,&RAM[0x10000]); } @@ -428,7 +428,7 @@ static DRIVER_INIT( deco222 ) { int A; UINT8 *decrypted = auto_malloc(0x10000); - UINT8 *rom = memory_region(REGION_CPU2); + UINT8 *rom = memory_region(machine, REGION_CPU2); memory_set_decrypted_region(1, 0x8000, 0xffff, decrypted); @@ -436,17 +436,17 @@ static DRIVER_INIT( deco222 ) for (A = 0x8000;A < 0x18000;A++) decrypted[A-0x8000] = (rom[A] & 0x9f) | ((rom[A] & 0x20) << 1) | ((rom[A] & 0x40) >> 1); - memory_configure_bank(3, 0, 2, memory_region(REGION_CPU2) + 0x10000, 0x4000); + memory_configure_bank(3, 0, 2, memory_region(machine, REGION_CPU2) + 0x10000, 0x4000); memory_configure_bank_decrypted(3, 0, 2, &decrypted[0x8000], 0x4000); } static DRIVER_INIT( graphics ) { - UINT8 *rom = memory_region(REGION_GFX1); - int len = memory_region_length(REGION_GFX1); + UINT8 *rom = memory_region(machine, REGION_GFX1); + int len = memory_region_length(machine, REGION_GFX1); int i,j,temp[16]; - memory_configure_bank(3, 0, 2, memory_region(REGION_CPU2) + 0x10000, 0x4000); + memory_configure_bank(3, 0, 2, memory_region(machine, REGION_CPU2) + 0x10000, 0x4000); /* Tile graphics roms have some swapped lines, original version only */ for (i = 0x00000;i < len;i += 32) diff --git a/src/mame/drivers/pengo.c b/src/mame/drivers/pengo.c index e611ae76990..1bbecf76193 100644 --- a/src/mame/drivers/pengo.c +++ b/src/mame/drivers/pengo.c @@ -613,7 +613,7 @@ ROM_END static DRIVER_INIT( pengo ) { - pengo_decode(); + pengo_decode(machine); } @@ -660,7 +660,7 @@ static DRIVER_INIT( penta ) { 0x88,0x0a,0x82,0x00,0xa0,0x22,0xaa,0x28 } /* ...1...1...1.... */ }; UINT8 *decrypt = auto_malloc(0x8000); - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); int A; memory_set_decrypted_region(0, 0x0000, 0x7fff, decrypt); diff --git a/src/mame/drivers/peplus.c b/src/mame/drivers/peplus.c index debe79c4475..cc6ff3fbc22 100644 --- a/src/mame/drivers/peplus.c +++ b/src/mame/drivers/peplus.c @@ -1065,7 +1065,7 @@ static DRIVER_INIT( peplus ) /* Superboard */ static DRIVER_INIT( peplussb ) { - UINT8 *super_data = memory_region(REGION_USER1); + UINT8 *super_data = memory_region(machine, REGION_USER1); /* Distribute Superboard Data */ memcpy(s3000_ram, &super_data[0x3000], 0x1000); diff --git a/src/mame/drivers/pgm.c b/src/mame/drivers/pgm.c index e735618a987..3f776f97432 100644 --- a/src/mame/drivers/pgm.c +++ b/src/mame/drivers/pgm.c @@ -1638,11 +1638,11 @@ MACHINE_DRIVER_END /* This function expands the 32x32 5-bit data into a format which is easier to decode in MAME */ -static void expand_32x32x5bpp(void) +static void expand_32x32x5bpp(running_machine *machine) { - UINT8 *src = memory_region ( REGION_GFX1 ); - UINT8 *dst = memory_region ( REGION_GFX2 ); - size_t srcsize = memory_region_length( REGION_GFX1 ); + UINT8 *src = memory_region ( machine, REGION_GFX1 ); + UINT8 *dst = memory_region ( machine, REGION_GFX2 ); + size_t srcsize = memory_region_length( machine, REGION_GFX1 ); int cnt, pix; for (cnt = 0; cnt < srcsize/5 ; cnt ++) @@ -1664,10 +1664,10 @@ static void expand_32x32x5bpp(void) UINT8 *pgm_sprite_a_region; size_t pgm_sprite_a_region_allocate; -static void expand_colourdata(void) +static void expand_colourdata(running_machine *machine) { - UINT8 *src = memory_region ( REGION_GFX3 ); - size_t srcsize = memory_region_length( REGION_GFX3 ); + UINT8 *src = memory_region ( machine, REGION_GFX3 ); + size_t srcsize = memory_region_length( machine, REGION_GFX3 ); int cnt; size_t needed = srcsize / 2 * 3; @@ -1691,25 +1691,25 @@ static void expand_colourdata(void) } } -static void pgm_basic_init(void) +static void pgm_basic_init(running_machine *machine) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); memory_set_bankptr(1,&ROM[0x100000]); - expand_32x32x5bpp(); - expand_colourdata(); + expand_32x32x5bpp(machine); + expand_colourdata(machine); } static DRIVER_INIT( pgm ) { - pgm_basic_init(); + pgm_basic_init(machine); } /* Oriental Legend INIT */ static DRIVER_INIT( orlegend ) { - pgm_basic_init(); + pgm_basic_init(machine); memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xC0400e, 0xC0400f, 0, 0, pgm_asic3_r, pgm_asic3_w); memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xC04000, 0xC04001, 0, 0, pgm_asic3_reg_w); @@ -1717,8 +1717,8 @@ static DRIVER_INIT( orlegend ) static void drgwld2_common_init(running_machine *machine) { - pgm_basic_init(); - pgm_dw2_decrypt(); + pgm_basic_init(machine); + pgm_dw2_decrypt(machine); /* Info from Elsemi Here is how to "bypass" the dw2 hang protection, it fixes the mode @@ -1730,7 +1730,7 @@ static void drgwld2_common_init(running_machine *machine) static DRIVER_INIT( drgw2 ) { /* incomplete? */ - UINT16 *mem16 = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *mem16 = (UINT16 *)memory_region(machine, REGION_CPU1); drgwld2_common_init(machine); /* These ROM patches are not hacks, the protection device overlays the normal ROM code, this has been confirmed on a real PCB @@ -1742,7 +1742,7 @@ static DRIVER_INIT( drgw2 ) static DRIVER_INIT( drgw2c ) { - UINT16 *mem16 = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *mem16 = (UINT16 *)memory_region(machine, REGION_CPU1); drgwld2_common_init(machine); /* These ROM patches are not hacks, the protection device overlays the normal ROM code, this has been confirmed on a real PCB @@ -1754,7 +1754,7 @@ static DRIVER_INIT( drgw2c ) static DRIVER_INIT( drgw2j ) { - UINT16 *mem16 = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *mem16 = (UINT16 *)memory_region(machine, REGION_CPU1); drgwld2_common_init(machine); /* These ROM patches are not hacks, the protection device overlays the normal ROM code, this has been confirmed on a real PCB @@ -1766,7 +1766,7 @@ static DRIVER_INIT( drgw2j ) static DRIVER_INIT( kov ) { - pgm_basic_init(); + pgm_basic_init(machine); memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x500000, 0x500003, 0, 0, ASIC28_r16, ASIC28_w16); @@ -1774,26 +1774,26 @@ static DRIVER_INIT( kov ) the protection device provides the region code */ memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4f0000, 0x4fffff, 0, 0, sango_protram_r); - pgm_kov_decrypt(); + pgm_kov_decrypt(machine); } static DRIVER_INIT( kov2 ) { - pgm_basic_init(); - pgm_kov2_decrypt(); + pgm_basic_init(machine); + pgm_kov2_decrypt(machine); } static DRIVER_INIT( martmast ) { - pgm_basic_init(); - pgm_mm_decrypt(); + pgm_basic_init(machine); + pgm_mm_decrypt(machine); } static DRIVER_INIT( pstar ) { - pgm_basic_init(); - pgm_pstar_decrypt(); + pgm_basic_init(machine); + pgm_pstar_decrypt(machine); memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4f0000, 0x4f0025, 0, 0, PSTARS_protram_r); memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x500000, 0x500003, 0, 0, PSTARS_r16); @@ -1804,7 +1804,7 @@ static DRIVER_INIT( pstar ) static DRIVER_INIT( kovsh ) { - pgm_basic_init(); + pgm_basic_init(machine); // memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x500000, 0x500003, 0, 0, ASIC28_r16, ASIC28_w16); @@ -1812,12 +1812,12 @@ static DRIVER_INIT( kovsh ) the protection device provides the region code */ // memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4f0000, 0x4fffff, 0, 0, sango_protram_r); - pgm_kovsh_decrypt(); + pgm_kovsh_decrypt(machine); } static DRIVER_INIT( djlzz ) { - pgm_basic_init(); + pgm_basic_init(machine); memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x500000, 0x500003, 0, 0, ASIC28_r16, ASIC28_w16); @@ -1825,16 +1825,16 @@ static DRIVER_INIT( djlzz ) the protection device provides the region code */ memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4f0000, 0x4fffff, 0, 0, sango_protram_r); - pgm_djlzz_decrypt(); + pgm_djlzz_decrypt(machine); } static DRIVER_INIT( dw3 ) { - pgm_basic_init(); + pgm_basic_init(machine); // memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xda0000, 0xdaffff, 0, 0, dw3_prot_r, dw3_prot_w); - pgm_dw3_decrypt(); + pgm_dw3_decrypt(machine); } @@ -1935,7 +1935,7 @@ static WRITE16_HANDLER( killbld_prot_w ) /* for now, cheat -- the scramble isn't understood, it might be state based */ int x; - UINT16 *RAMDUMP = (UINT16*)memory_region(REGION_USER2); + UINT16 *RAMDUMP = (UINT16*)memory_region(machine, REGION_USER2); for (x=0;x<size;x++) { UINT16 dat; @@ -1948,8 +1948,8 @@ static WRITE16_HANDLER( killbld_prot_w ) { /* mode 5 seems to be a straight copy */ int x; - UINT16 *RAMDUMP = (UINT16*)memory_region(REGION_USER2); - UINT16 *PROTROM = (UINT16*)memory_region(REGION_USER1); + UINT16 *RAMDUMP = (UINT16*)memory_region(machine, REGION_USER2); + UINT16 *PROTROM = (UINT16*)memory_region(machine, REGION_USER1); for (x=0;x<size;x++) { UINT16 dat; @@ -1965,8 +1965,8 @@ static WRITE16_HANDLER( killbld_prot_w ) { /* mode 6 seems to swap bytes and nibbles */ int x; - UINT16 *RAMDUMP = (UINT16*)memory_region(REGION_USER2); - UINT16 *PROTROM = (UINT16*)memory_region(REGION_USER1); + UINT16 *RAMDUMP = (UINT16*)memory_region(machine, REGION_USER2); + UINT16 *PROTROM = (UINT16*)memory_region(machine, REGION_USER1); for (x=0;x<size;x++) { UINT16 dat; @@ -2052,10 +2052,10 @@ static MACHINE_RESET( killbld ) static DRIVER_INIT( killbld ) { - UINT16 *mem16 = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *mem16 = (UINT16 *)memory_region(machine, REGION_CPU1); - pgm_basic_init(); - pgm_killbld_decrypt(); + pgm_basic_init(machine); + pgm_killbld_decrypt(machine); @@ -2124,7 +2124,7 @@ static WRITE16_HANDLER(ddp2_protram_w) static DRIVER_INIT( ddp2 ) { - pgm_basic_init(); + pgm_basic_init(machine); /* some kind of busy / counter */ /* the actual protection is an arm cpu with internal rom */ @@ -2142,9 +2142,9 @@ static DRIVER_INIT( puzzli2 ) it uses an arm with no external rom an acts in a similar way to kov etc. */ - UINT16 *mem16 = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *mem16 = (UINT16 *)memory_region(machine, REGION_CPU1); - pgm_basic_init(); + pgm_basic_init(machine); memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x500000, 0x500003, 0, 0, ASIC28_r16, ASIC28_w16); @@ -2152,7 +2152,7 @@ static DRIVER_INIT( puzzli2 ) the protection device provides the region code */ memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4f0000, 0x4fffff, 0, 0, sango_protram_r); - pgm_puzzli2_decrypt(); + pgm_puzzli2_decrypt(machine); /* protection related? */ mem16[0x1548ec/2]=0x4e71; @@ -2174,8 +2174,8 @@ static DRIVER_INIT( puzzli2 ) static MACHINE_RESET( olds ) { - UINT16 *mem16 = (UINT16 *)memory_region(REGION_USER2); -// UINT16 *mem16_a = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *mem16 = (UINT16 *)memory_region(machine, REGION_USER2); +// UINT16 *mem16_a = (UINT16 *)memory_region(machine, REGION_CPU1); int i; MACHINE_RESET_CALL(pgm); @@ -2277,9 +2277,9 @@ static WRITE16_HANDLER( olds_w16 ) static DRIVER_INIT( olds ) { -// UINT16 *mem16 = (UINT16 *)memory_region(REGION_CPU1); +// UINT16 *mem16 = (UINT16 *)memory_region(machine, REGION_CPU1); - pgm_basic_init(); + pgm_basic_init(machine); memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xdcb400, 0xdcb403, 0, 0, olds_r16, olds_w16); diff --git a/src/mame/drivers/phoenix.c b/src/mame/drivers/phoenix.c index f6647bdf021..13a91c6601e 100644 --- a/src/mame/drivers/phoenix.c +++ b/src/mame/drivers/phoenix.c @@ -440,7 +440,7 @@ static const struct AY8910interface survival_ay8910_interface = static MACHINE_RESET( phoenix ) { - memory_set_bankptr(1, memory_region(REGION_CPU1) + 0x4000); + memory_set_bankptr(1, memory_region(machine, REGION_CPU1) + 0x4000); } @@ -1027,7 +1027,7 @@ static DRIVER_INIT( condor ) static DRIVER_INIT( survival ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); rom[0x0157] = 0x21; /* ROM check */ rom[0x02e8] = 0x21; /* crash due to protection, it still locks up somewhere else */ diff --git a/src/mame/drivers/pingpong.c b/src/mame/drivers/pingpong.c index 8b79d8615d7..33048415f6b 100644 --- a/src/mame/drivers/pingpong.c +++ b/src/mame/drivers/pingpong.c @@ -53,7 +53,7 @@ static WRITE8_HANDLER( cashquiz_question_bank_low_w ) { int bank = data & 7; int bankaddr = question_addr_high | ((data - 0x60) * 0x100); - UINT8 *questions = memory_region(REGION_USER1) + bankaddr; + UINT8 *questions = memory_region(machine, REGION_USER1) + bankaddr; memory_set_bankptr(bank + 1,questions); } @@ -569,7 +569,7 @@ ROM_END static DRIVER_INIT( merlinmm ) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); int i; /* decrypt program code */ @@ -583,12 +583,12 @@ static DRIVER_INIT( cashquiz ) int i; /* decrypt program code */ - ROM = memory_region(REGION_CPU1); + ROM = memory_region(machine, REGION_CPU1); for( i = 0; i < 0x4000; i++ ) ROM[i] = BITSWAP8(ROM[i],0,1,2,3,4,5,6,7); /* decrypt questions */ - ROM = memory_region(REGION_USER1); + ROM = memory_region(machine, REGION_USER1); for( i = 0; i < 0x40000; i++ ) ROM[i] = BITSWAP8(ROM[i],0,1,2,3,4,5,6,7); @@ -608,7 +608,7 @@ static DRIVER_INIT( cashquiz ) // setup default banks for(i = 0; i < 8; i++) - memory_set_bankptr( i+1, memory_region(REGION_USER1) + 0x100*i ); + memory_set_bankptr( i+1, memory_region(machine, REGION_USER1) + 0x100*i ); } diff --git a/src/mame/drivers/pipedrm.c b/src/mame/drivers/pipedrm.c index a5b877fa982..4d134e99182 100644 --- a/src/mame/drivers/pipedrm.c +++ b/src/mame/drivers/pipedrm.c @@ -124,11 +124,11 @@ static UINT8 sound_command; static MACHINE_RESET( pipedrm ) { /* initialize main Z80 bank */ - memory_configure_bank(1, 0, 8, memory_region(REGION_CPU1) + 0x10000, 0x2000); + memory_configure_bank(1, 0, 8, memory_region(machine, REGION_CPU1) + 0x10000, 0x2000); memory_set_bank(1, 0); /* initialize sound bank */ - memory_configure_bank(2, 0, 2, memory_region(REGION_CPU2) + 0x10000, 0x8000); + memory_configure_bank(2, 0, 2, memory_region(machine, REGION_CPU2) + 0x10000, 0x8000); memory_set_bank(2, 0); /* state save */ state_save_register_global(pending_command); diff --git a/src/mame/drivers/pipeline.c b/src/mame/drivers/pipeline.c index 34d4d0446f6..7730791a8d9 100644 --- a/src/mame/drivers/pipeline.c +++ b/src/mame/drivers/pipeline.c @@ -347,8 +347,8 @@ static const struct YM2203interface ym2203_interface = static PALETTE_INIT(pipeline) { int r,g,b,i,c; - UINT8 *prom1 = &memory_region(REGION_PROMS)[0x000]; - UINT8 *prom2 = &memory_region(REGION_PROMS)[0x100]; + UINT8 *prom1 = &memory_region(machine, REGION_PROMS)[0x000]; + UINT8 *prom2 = &memory_region(machine, REGION_PROMS)[0x100]; for(i=0;i<0x100;i++) { diff --git a/src/mame/drivers/pirates.c b/src/mame/drivers/pirates.c index 7f082c0e4d3..95abb23dbab 100644 --- a/src/mame/drivers/pirates.c +++ b/src/mame/drivers/pirates.c @@ -362,17 +362,17 @@ ROM_END /* Init */ -static void pirates_decrypt_68k(void) +static void pirates_decrypt_68k(running_machine *machine) { int rom_size; UINT16 *buf, *rom; int i; - rom_size = memory_region_length(REGION_CPU1); + rom_size = memory_region_length(machine, REGION_CPU1); buf = malloc_or_die(rom_size); - rom = (UINT16 *)memory_region(REGION_CPU1); + rom = (UINT16 *)memory_region(machine, REGION_CPU1); memcpy (buf, rom, rom_size); for (i=0; i<rom_size/2; i++) @@ -391,17 +391,17 @@ static void pirates_decrypt_68k(void) free (buf); } -static void pirates_decrypt_p(void) +static void pirates_decrypt_p(running_machine *machine) { int rom_size; UINT8 *buf, *rom; int i; - rom_size = memory_region_length(REGION_GFX1); + rom_size = memory_region_length(machine, REGION_GFX1); buf = malloc_or_die(rom_size); - rom = memory_region(REGION_GFX1); + rom = memory_region(machine, REGION_GFX1); memcpy (buf, rom, rom_size); for (i=0; i<rom_size/4; i++) @@ -415,17 +415,17 @@ static void pirates_decrypt_p(void) free (buf); } -static void pirates_decrypt_s(void) +static void pirates_decrypt_s(running_machine *machine) { int rom_size; UINT8 *buf, *rom; int i; - rom_size = memory_region_length(REGION_GFX2); + rom_size = memory_region_length(machine, REGION_GFX2); buf = malloc_or_die(rom_size); - rom = memory_region(REGION_GFX2); + rom = memory_region(machine, REGION_GFX2); memcpy (buf, rom, rom_size); for (i=0; i<rom_size/4; i++) @@ -440,17 +440,17 @@ static void pirates_decrypt_s(void) } -static void pirates_decrypt_oki(void) +static void pirates_decrypt_oki(running_machine *machine) { int rom_size; UINT8 *buf, *rom; int i; - rom_size = memory_region_length(REGION_SOUND1); + rom_size = memory_region_length(machine, REGION_SOUND1); buf = malloc_or_die(rom_size); - rom = memory_region(REGION_SOUND1); + rom = memory_region(machine, REGION_SOUND1); memcpy (buf, rom, rom_size); for (i=0; i<rom_size; i++) @@ -464,12 +464,12 @@ static void pirates_decrypt_oki(void) static DRIVER_INIT( pirates ) { - UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *rom = (UINT16 *)memory_region(machine, REGION_CPU1); - pirates_decrypt_68k(); - pirates_decrypt_p(); - pirates_decrypt_s(); - pirates_decrypt_oki(); + pirates_decrypt_68k(machine); + pirates_decrypt_p(machine); + pirates_decrypt_s(machine); + pirates_decrypt_oki(machine); /* patch out protection check */ rom[0x62c0/2] = 0x6006; // beq -> bra @@ -479,10 +479,10 @@ static READ16_HANDLER( genix_prot_r ) { if(!offset) return 0x0004; else return 0 static DRIVER_INIT( genix ) { - pirates_decrypt_68k(); - pirates_decrypt_p(); - pirates_decrypt_s(); - pirates_decrypt_oki(); + pirates_decrypt_68k(machine); + pirates_decrypt_p(machine); + pirates_decrypt_s(machine); + pirates_decrypt_oki(machine); /* If this value is increased then something has gone wrong and the protection failed */ /* Write-protect it for now */ diff --git a/src/mame/drivers/pktgaldx.c b/src/mame/drivers/pktgaldx.c index ccdfe9f84ae..ee4a0d76501 100644 --- a/src/mame/drivers/pktgaldx.c +++ b/src/mame/drivers/pktgaldx.c @@ -460,8 +460,8 @@ ROM_END static DRIVER_INIT( pktgaldx ) { - deco56_decrypt(REGION_GFX1); - deco102_decrypt(REGION_CPU1, 0x42ba, 0x00, 0x00); + deco56_decrypt(machine, REGION_GFX1); + deco102_decrypt(machine, REGION_CPU1, 0x42ba, 0x00, 0x00); } GAME( 1992, pktgaldx, 0, pktgaldx, pktgaldx, pktgaldx, ROT0, "Data East Corporation", "Pocket Gal Deluxe (Euro v3.00)", 0 ) diff --git a/src/mame/drivers/playch10.c b/src/mame/drivers/playch10.c index 50b690bd34b..d8c4e1885cf 100644 --- a/src/mame/drivers/playch10.c +++ b/src/mame/drivers/playch10.c @@ -337,7 +337,7 @@ static WRITE8_HANDLER( sprite_dma_w ) static NVRAM_HANDLER( playch10 ) { - UINT8 *mem = memory_region( REGION_CPU2 ) + 0x6000; + UINT8 *mem = memory_region( machine, REGION_CPU2 ) + 0x6000; if ( read_or_write ) mame_fwrite( file, mem, 0x1000 ); diff --git a/src/mame/drivers/playmark.c b/src/mame/drivers/playmark.c index 7e9d3577b1d..92fc5fea38f 100644 --- a/src/mame/drivers/playmark.c +++ b/src/mame/drivers/playmark.c @@ -228,7 +228,7 @@ static WRITE8_HANDLER( playmark_oki_banking_w ) { old_bank = data & 7; - if(((old_bank - 1) * 0x40000) < memory_region_length(REGION_SOUND1)) + if(((old_bank - 1) * 0x40000) < memory_region_length(machine, REGION_SOUND1)) { OKIM6295_set_bank_base(0, 0x40000 * (old_bank - 1)); } @@ -1452,8 +1452,8 @@ static UINT8 playmark_asciitohex(UINT8 data) static DRIVER_INIT( bigtwin ) { - UINT8 *playmark_PICROM_HEX = memory_region(REGION_USER1); - UINT16 *playmark_PICROM = (UINT16 *)memory_region(REGION_CPU2); + UINT8 *playmark_PICROM_HEX = memory_region(machine, REGION_USER1); + UINT16 *playmark_PICROM = (UINT16 *)memory_region(machine, REGION_CPU2); INT32 offs, data; UINT16 src_pos = 0; UINT16 dst_pos = 0; diff --git a/src/mame/drivers/plygonet.c b/src/mame/drivers/plygonet.c index a4ef4f5a497..5ab48728a2c 100644 --- a/src/mame/drivers/plygonet.c +++ b/src/mame/drivers/plygonet.c @@ -135,7 +135,7 @@ static WRITE32_HANDLER( polygonet_eeprom_w ) static READ32_HANDLER( ttl_rom_r ) { UINT32 *ROM; - ROM = (UINT32 *)memory_region(REGION_GFX1); + ROM = (UINT32 *)memory_region(machine, REGION_GFX1); return ROM[offset]; } @@ -144,7 +144,7 @@ static READ32_HANDLER( ttl_rom_r ) static READ32_HANDLER( psac_rom_r ) { UINT32 *ROM; - ROM = (UINT32 *)memory_region(REGION_GFX2); + ROM = (UINT32 *)memory_region(machine, REGION_GFX2); return ROM[offset]; } @@ -628,16 +628,16 @@ ADDRESS_MAP_END static int cur_sound_region; -static void reset_sound_region(void) +static void reset_sound_region(running_machine *machine) { - memory_set_bankptr(2, memory_region(REGION_CPU3) + 0x10000 + cur_sound_region*0x4000); + memory_set_bankptr(2, memory_region(machine, REGION_CPU3) + 0x10000 + cur_sound_region*0x4000); } static WRITE8_HANDLER( sound_bankswitch_w ) { cur_sound_region = (data & 0x1f); - reset_sound_region(); + reset_sound_region(machine); } static INTERRUPT_GEN(audio_interrupt) @@ -787,7 +787,7 @@ static DRIVER_INIT(polygonet) { /* set default bankswitch */ cur_sound_region = 2; - reset_sound_region(); + reset_sound_region(machine); /* allocate space for all the fun dsp56k banking */ dsp56k_bank00_ram = auto_malloc( ( 0x1000 + (0x8*0x1000)) * 2) ; diff --git a/src/mame/drivers/pntnpuzl.c b/src/mame/drivers/pntnpuzl.c index e4b837350b4..afb580716fc 100644 --- a/src/mame/drivers/pntnpuzl.c +++ b/src/mame/drivers/pntnpuzl.c @@ -481,7 +481,7 @@ ROM_END static DRIVER_INIT(pip) { -// UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1); +// UINT16 *rom = (UINT16 *)memory_region(machine, REGION_CPU1); // rom[0x2696/2] = 0x4e71; // rom[0x26a0/2] = 0x4e71; } diff --git a/src/mame/drivers/pokechmp.c b/src/mame/drivers/pokechmp.c index be4181ddf8f..26457e44569 100644 --- a/src/mame/drivers/pokechmp.c +++ b/src/mame/drivers/pokechmp.c @@ -59,7 +59,7 @@ extern VIDEO_UPDATE( pokechmp ); static WRITE8_HANDLER( pokechmp_bank_w ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); if (data == 0x00) { @@ -285,7 +285,7 @@ MACHINE_DRIVER_END static DRIVER_INIT( pokechmp ) { - memory_configure_bank(3, 0, 2, memory_region(REGION_CPU2) + 0x10000, 0x4000); + memory_configure_bank(3, 0, 2, memory_region(machine, REGION_CPU2) + 0x10000, 0x4000); } diff --git a/src/mame/drivers/policetr.c b/src/mame/drivers/policetr.c index 52f7e3ccd79..33a73468b79 100644 --- a/src/mame/drivers/policetr.c +++ b/src/mame/drivers/policetr.c @@ -225,7 +225,7 @@ static WRITE32_HANDLER( bsmt2000_data_w ) static READ32_HANDLER( bsmt2000_data_r ) { - return memory_region(REGION_SOUND1)[bsmt_data_bank * 0x10000 + bsmt_data_offset] << 8; + return memory_region(machine, REGION_SOUND1)[bsmt_data_bank * 0x10000 + bsmt_data_offset] << 8; } diff --git a/src/mame/drivers/poolshrk.c b/src/mame/drivers/poolshrk.c index 98a598f2099..b987f6429dd 100644 --- a/src/mame/drivers/poolshrk.c +++ b/src/mame/drivers/poolshrk.c @@ -14,8 +14,8 @@ static int poolshrk_da_latch; static DRIVER_INIT( poolshrk ) { - UINT8* pSprite = memory_region(REGION_GFX1); - UINT8* pOffset = memory_region(REGION_PROMS); + UINT8* pSprite = memory_region(machine, REGION_GFX1); + UINT8* pOffset = memory_region(machine, REGION_PROMS); int i; int j; diff --git a/src/mame/drivers/popeye.c b/src/mame/drivers/popeye.c index 0667d78fbec..39a54297e79 100644 --- a/src/mame/drivers/popeye.c +++ b/src/mame/drivers/popeye.c @@ -671,7 +671,7 @@ ROM_END static DRIVER_INIT( skyskipr ) { UINT8 *buffer; - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); int len = 0x10000; /* decrypt the program ROMs */ @@ -688,7 +688,7 @@ static DRIVER_INIT( skyskipr ) static DRIVER_INIT( popeye ) { UINT8 *buffer; - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); int len = 0x10000; /* decrypt the program ROMs */ diff --git a/src/mame/drivers/powerbal.c b/src/mame/drivers/powerbal.c index 45bf764c923..f2e54ec784a 100644 --- a/src/mame/drivers/powerbal.c +++ b/src/mame/drivers/powerbal.c @@ -99,7 +99,7 @@ static WRITE16_HANDLER( oki_banking ) { int addr = 0x40000 * ((data & 3) - 1); - if(addr < memory_region_length(REGION_SOUND1)) + if(addr < memory_region_length(machine, REGION_SOUND1)) OKIM6295_set_bank_base(0, addr); } } diff --git a/src/mame/drivers/powerins.c b/src/mame/drivers/powerins.c index 770a0cebd67..8db29d9dcca 100644 --- a/src/mame/drivers/powerins.c +++ b/src/mame/drivers/powerins.c @@ -61,7 +61,7 @@ static WRITE16_HANDLER( powerins_okibank_w ) { if (ACCESSING_BITS_0_7) { - UINT8 *RAM = memory_region(REGION_SOUND1); + UINT8 *RAM = memory_region(machine, REGION_SOUND1); int new_bank = data & 0x7; if (new_bank != oki_bank) diff --git a/src/mame/drivers/ppmast93.c b/src/mame/drivers/ppmast93.c index 17eeb9079a6..17bdbb96144 100644 --- a/src/mame/drivers/ppmast93.c +++ b/src/mame/drivers/ppmast93.c @@ -148,7 +148,7 @@ static WRITE8_HANDLER( ppmast93_bgram_w ) static WRITE8_HANDLER( ppmast93_port4_w ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); int bank; coin_counter_w(0, data & 0x08); diff --git a/src/mame/drivers/progolf.c b/src/mame/drivers/progolf.c index d9ffad832d5..e4b1847fd56 100644 --- a/src/mame/drivers/progolf.c +++ b/src/mame/drivers/progolf.c @@ -272,7 +272,7 @@ ROM_END static DRIVER_INIT( progolf ) { int A; - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); UINT8* decrypted = auto_malloc(0x10000); memory_set_decrypted_region(0,0x0000,0xffff, decrypted); diff --git a/src/mame/drivers/psikyo.c b/src/mame/drivers/psikyo.c index 5b840ddd6d1..d489c1e88aa 100644 --- a/src/mame/drivers/psikyo.c +++ b/src/mame/drivers/psikyo.c @@ -391,7 +391,7 @@ static WRITE8_HANDLER( psikyo_clear_nmi_w ) static WRITE8_HANDLER( sngkace_sound_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_CPU2); + UINT8 *RAM = memory_region(machine, REGION_CPU2); int bank = data & 3; memory_set_bankptr(1, &RAM[bank * 0x8000 + 0x10000]); } @@ -433,7 +433,7 @@ ADDRESS_MAP_END static WRITE8_HANDLER( gunbird_sound_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_CPU2); + UINT8 *RAM = memory_region(machine, REGION_CPU2); int bank = (data >> 4) & 3; /* The banked rom is seen at 8200-ffff, so the last 0x200 bytes @@ -1798,8 +1798,8 @@ ROM_END static DRIVER_INIT( sngkace ) { { - UINT8 *RAM = memory_region(REGION_SOUND1); - int len = memory_region_length(REGION_SOUND1); + UINT8 *RAM = memory_region(machine, REGION_SOUND1); + int len = memory_region_length(machine, REGION_SOUND1); int i; /* Bit 6&7 of the samples are swapped. Naughty, naughty... */ @@ -1824,7 +1824,7 @@ static DRIVER_INIT( sngkace ) #if 0 if (!strcmp(machine->gamedrv->name,"sngkace")) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); ROM[0x995] = 0x4e; ROM[0x994] = 0x71; ROM[0x997] = 0x4e; diff --git a/src/mame/drivers/psikyo4.c b/src/mame/drivers/psikyo4.c index b92be25257e..06ae4ad1f99 100644 --- a/src/mame/drivers/psikyo4.c +++ b/src/mame/drivers/psikyo4.c @@ -345,7 +345,7 @@ static WRITE32_HANDLER( ps4_vidregs_w ) { if (ACCESSING_BITS_0_15) // Bank { - UINT8 *ROM = memory_region(REGION_GFX1); + UINT8 *ROM = memory_region(machine, REGION_GFX1); memory_set_bankptr(2,&ROM[0x2000 * (psikyo4_vidregs[offset]&0x1fff)]); /* Bank comes from vidregs */ } } @@ -357,7 +357,7 @@ static UINT32 sample_offs = 0; static READ32_HANDLER( ps4_sample_r ) /* Send sample data for test */ { - UINT8 *ROM = memory_region(REGION_SOUND1); + UINT8 *ROM = memory_region(machine, REGION_SOUND1); return ROM[sample_offs++]<<16; } #endif @@ -412,10 +412,10 @@ static WRITE32_HANDLER( psh_ymf_pcm_w ) #define PCM_BANK_NO(n) ((ps4_io_select[0] >> (n * 4 + 24)) & 0x07) -static void set_hotgmck_pcm_bank(int n) +static void set_hotgmck_pcm_bank(running_machine *machine, int n) { - UINT8 *ymf_pcmbank = memory_region(REGION_SOUND1) + 0x200000; - UINT8 *pcm_rom = memory_region(REGION_SOUND2); + UINT8 *ymf_pcmbank = memory_region(machine, REGION_SOUND1) + 0x200000; + UINT8 *pcm_rom = memory_region(machine, REGION_SOUND2); memcpy(ymf_pcmbank + n * 0x100000, pcm_rom + PCM_BANK_NO(n) * 0x100000, 0x100000); } @@ -432,10 +432,10 @@ static WRITE32_HANDLER( hotgmck_pcm_bank_w ) new_bank1 = PCM_BANK_NO(1); if (old_bank0 != new_bank0) - set_hotgmck_pcm_bank(0); + set_hotgmck_pcm_bank(machine, 0); if (old_bank1 != new_bank1) - set_hotgmck_pcm_bank(1); + set_hotgmck_pcm_bank(machine, 1); } static ADDRESS_MAP_START( ps4_readmem, ADDRESS_SPACE_PROGRAM, 32 ) @@ -1069,19 +1069,19 @@ PC :000029F8: BT $000029EC static STATE_POSTLOAD( hotgmck_pcm_bank_postload ) { - set_hotgmck_pcm_bank((FPTR)param); + set_hotgmck_pcm_bank(machine, (FPTR)param); } static void install_hotgmck_pcm_bank(running_machine *machine) { - UINT8 *ymf_pcm = memory_region(REGION_SOUND1); - UINT8 *pcm_rom = memory_region(REGION_SOUND2); + UINT8 *ymf_pcm = memory_region(machine, REGION_SOUND1); + UINT8 *pcm_rom = memory_region(machine, REGION_SOUND2); memcpy(ymf_pcm, pcm_rom, 0x200000); ps4_io_select[0] = (ps4_io_select[0] & 0x00ffffff) | 0x32000000; - set_hotgmck_pcm_bank(0); - set_hotgmck_pcm_bank(1); + set_hotgmck_pcm_bank(machine, 0); + set_hotgmck_pcm_bank(machine, 1); memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x5800008, 0x580000b, 0, 0, hotgmck_pcm_bank_w ); state_save_register_postload(machine, hotgmck_pcm_bank_postload, (void *)0); @@ -1090,7 +1090,7 @@ static void install_hotgmck_pcm_bank(running_machine *machine) static DRIVER_INIT( hotgmck ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); memory_set_bankptr(1,&RAM[0x100000]); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x5800000, 0x5800007, 0, 0, hotgmck_io32_r ); // Different Inputs install_hotgmck_pcm_bank(machine); // Banked PCM ROM diff --git a/src/mame/drivers/psikyosh.c b/src/mame/drivers/psikyosh.c index 2c5bb32622f..cafdb1ca384 100644 --- a/src/mame/drivers/psikyosh.c +++ b/src/mame/drivers/psikyosh.c @@ -442,7 +442,7 @@ static WRITE32_HANDLER( psikyosh_vidregs_w ) { if (ACCESSING_BITS_0_15) // Bank { - UINT8 *ROM = memory_region(REGION_GFX1); + UINT8 *ROM = memory_region(machine, REGION_GFX1); memory_set_bankptr(2,&ROM[0x20000 * (psikyosh_vidregs[offset]&0xfff)]); /* Bank comes from vidregs */ } } @@ -454,7 +454,7 @@ static UINT32 sample_offs = 0; static READ32_HANDLER( psh_sample_r ) /* Send sample data for test */ { - UINT8 *ROM = memory_region(REGION_SOUND1); + UINT8 *ROM = memory_region(machine, REGION_SOUND1); return ROM[sample_offs++]<<16; } @@ -1241,7 +1241,7 @@ static DRIVER_INIT( s1945ii ) static DRIVER_INIT( daraku ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); memory_set_bankptr(1,&RAM[0x100000]); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x600000c, 0x600000f, 0, 0, daraku_speedup_r ); use_factory_eeprom=eeprom_DARAKU; @@ -1255,7 +1255,7 @@ static DRIVER_INIT( sbomberb ) static DRIVER_INIT( gunbird2 ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); memory_set_bankptr(1,&RAM[0x100000]); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x604000c, 0x604000f, 0, 0, gunbird2_speedup_r ); use_factory_eeprom=eeprom_DEFAULT; @@ -1263,7 +1263,7 @@ static DRIVER_INIT( gunbird2 ) static DRIVER_INIT( s1945iii ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); memory_set_bankptr(1,&RAM[0x100000]); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x606000c, 0x606000f, 0, 0, s1945iii_speedup_r ); use_factory_eeprom=eeprom_S1945III; diff --git a/src/mame/drivers/psychic5.c b/src/mame/drivers/psychic5.c index eefc4922635..0bf4c122b30 100644 --- a/src/mame/drivers/psychic5.c +++ b/src/mame/drivers/psychic5.c @@ -336,7 +336,7 @@ static READ8_HANDLER( psychic5_bankselect_r ) static WRITE8_HANDLER( psychic5_bankselect_w ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); int bankaddress; if (data != psychic5_bank_latch) diff --git a/src/mame/drivers/pturn.c b/src/mame/drivers/pturn.c index 0515b5e9d72..4bdb3d5c795 100644 --- a/src/mame/drivers/pturn.c +++ b/src/mame/drivers/pturn.c @@ -109,7 +109,7 @@ static TILE_GET_INFO( get_pturn_tile_info ) static TILE_GET_INFO( get_pturn_bg_tile_info ) { int tileno,palno; - tileno = memory_region(REGION_USER1)[tile_index]; + tileno = memory_region(machine, REGION_USER1)[tile_index]; palno=bgpalette; if(palno==1) { diff --git a/src/mame/drivers/puckpkmn.c b/src/mame/drivers/puckpkmn.c index def9b2f6938..679d2af156c 100644 --- a/src/mame/drivers/puckpkmn.c +++ b/src/mame/drivers/puckpkmn.c @@ -269,14 +269,14 @@ Screenshots available on my site at http://unemulated.emuunlim.com (under PCB Sh static DRIVER_INIT( puckpkmn ) { - UINT8 *rom = memory_region(REGION_CPU1); - size_t len = memory_region_length(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); + size_t len = memory_region_length(machine, REGION_CPU1); int i; for (i = 0; i < len; i++) rom[i] = BITSWAP8(rom[i],1,4,2,0,7,5,3,6); - memory_set_bankptr(1, memory_region(REGION_CPU1) ); // VDP reads the roms from here + memory_set_bankptr(1, memory_region(machine, REGION_CPU1) ); // VDP reads the roms from here memory_set_bankptr(2, main_ram ); // VDP reads the ram from here } diff --git a/src/mame/drivers/qdrmfgp.c b/src/mame/drivers/qdrmfgp.c index 3246856de29..9dd4a058c36 100644 --- a/src/mame/drivers/qdrmfgp.c +++ b/src/mame/drivers/qdrmfgp.c @@ -127,7 +127,7 @@ static WRITE16_HANDLER( gp2_control_w ) static READ16_HANDLER( v_rom_r ) { - UINT8 *mem8 = memory_region(REGION_GFX1); + UINT8 *mem8 = memory_region(machine, REGION_GFX1); int bank = K056832_word_r(machine, 0x34/2, 0xffff); offset += bank * 0x800 * 4; @@ -627,7 +627,7 @@ static MACHINE_START( qdrmfgp ) static MACHINE_RESET( qdrmfgp ) { - sndram = memory_region(REGION_SOUND1) + 0x100000; + sndram = memory_region(machine, REGION_SOUND1) + 0x100000; /* reset the IDE controller */ gp2_irq_control = 0; @@ -636,7 +636,7 @@ static MACHINE_RESET( qdrmfgp ) static MACHINE_RESET( qdrmfgp2 ) { - sndram = memory_region(REGION_SOUND1) + 0x100000; + sndram = memory_region(machine, REGION_SOUND1) + 0x100000; /* sound irq (CCU? 240Hz) */ timer_pulse(ATTOTIME_IN_HZ(18432000/76800), NULL, 0, gp2_timer_callback); diff --git a/src/mame/drivers/qix.c b/src/mame/drivers/qix.c index 2acfa8c9fbc..584b33c2c6e 100644 --- a/src/mame/drivers/qix.c +++ b/src/mame/drivers/qix.c @@ -1049,9 +1049,9 @@ static DRIVER_INIT( kram3 ) ********************************/ i = 0; - patch = memory_region(REGION_USER1); - size = memory_region_length(REGION_USER1); - rom = memory_region(REGION_CPU1); + patch = memory_region(machine, REGION_USER1); + size = memory_region_length(machine, REGION_USER1); + rom = memory_region(machine, REGION_CPU1); decrypted = auto_malloc(0x6000); memory_set_decrypted_region(0, 0xa000, 0xffff, decrypted); @@ -1069,9 +1069,9 @@ static DRIVER_INIT( kram3 ) } i = 0; - patch = memory_region(REGION_USER2); - size = memory_region_length(REGION_USER2); - rom = memory_region(REGION_CPU2); + patch = memory_region(machine, REGION_USER2); + size = memory_region_length(machine, REGION_USER2); + rom = memory_region(machine, REGION_CPU2); decrypted = auto_malloc(0x6000); memory_set_decrypted_region(1, 0xa000, 0xffff, decrypted); @@ -1093,8 +1093,8 @@ static DRIVER_INIT( kram3 ) static DRIVER_INIT( zookeep ) { /* configure the banking */ - memory_configure_bank(1, 0, 1, memory_region(REGION_CPU2) + 0xa000, 0); - memory_configure_bank(1, 1, 1, memory_region(REGION_CPU2) + 0x10000, 0); + memory_configure_bank(1, 0, 1, memory_region(machine, REGION_CPU2) + 0xa000, 0); + memory_configure_bank(1, 1, 1, memory_region(machine, REGION_CPU2) + 0x10000, 0); memory_set_bank(1, 0); } diff --git a/src/mame/drivers/quizdna.c b/src/mame/drivers/quizdna.c index dab09b775a6..c0bc6220e78 100644 --- a/src/mame/drivers/quizdna.c +++ b/src/mame/drivers/quizdna.c @@ -28,13 +28,13 @@ WRITE8_HANDLER( paletteram_xBGR_RRRR_GGGG_BBBB_w ); static WRITE8_HANDLER( quizdna_rombank_w ) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); memory_set_bankptr(1,&ROM[0x10000+0x4000*(data & 0x3f)]); } static WRITE8_HANDLER( gekiretu_rombank_w ) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); memory_set_bankptr(1,&ROM[0x10000+0x4000*((data & 0x3f) ^ 0x0a)]); } diff --git a/src/mame/drivers/quizo.c b/src/mame/drivers/quizo.c index 5bcd26a341d..ee1c309c037 100644 --- a/src/mame/drivers/quizo.c +++ b/src/mame/drivers/quizo.c @@ -112,7 +112,7 @@ static WRITE8_HANDLER(port60_w) data=0; } port60=data; - memory_set_bankptr( 1, &memory_region(REGION_USER1)[rombankLookup[data]*0x4000] ); + memory_set_bankptr( 1, &memory_region(machine, REGION_USER1)[rombankLookup[data]*0x4000] ); } static ADDRESS_MAP_START( memmap, ADDRESS_SPACE_PROGRAM, 8 ) diff --git a/src/mame/drivers/rabbit.c b/src/mame/drivers/rabbit.c index a32a674dbbe..948aa41cb5a 100644 --- a/src/mame/drivers/rabbit.c +++ b/src/mame/drivers/rabbit.c @@ -521,7 +521,7 @@ ADDRESS_MAP_END /* rom bank is used when testing roms, not currently hooked up */ static WRITE32_HANDLER ( rabbit_rombank_w ) { - UINT8 *dataroms = memory_region(REGION_USER1); + UINT8 *dataroms = memory_region(machine, REGION_USER1); int bank; // mame_printf_debug("rabbit rombank %08x\n",data&0x3ff); bank = data & 0x3ff; @@ -613,9 +613,9 @@ static TIMER_CALLBACK( rabbit_blit_done ) cpunum_set_input_line(machine, 0, rabbit_bltirqlevel, HOLD_LINE); } -static void rabbit_do_blit(void) +static void rabbit_do_blit(running_machine *machine) { - UINT8 *blt_data = memory_region(REGION_USER1); + UINT8 *blt_data = memory_region(machine, REGION_USER1); int blt_source = (rabbit_blitterregs[0]&0x000fffff)>>0; int blt_column = (rabbit_blitterregs[1]&0x00ff0000)>>16; int blt_line = (rabbit_blitterregs[1]&0x000000ff); @@ -714,7 +714,7 @@ static WRITE32_HANDLER( rabbit_blitter_w ) if (offset == 0x0c/4) { - rabbit_do_blit(); + rabbit_do_blit(machine); } } diff --git a/src/mame/drivers/raiden.c b/src/mame/drivers/raiden.c index 5b7fafb36ac..981a2f56e68 100644 --- a/src/mame/drivers/raiden.c +++ b/src/mame/drivers/raiden.c @@ -485,9 +485,9 @@ static void memory_patcha(running_machine *machine) /* This is based on code by Niclas Karlsson Mate, who figured out the encryption method! The technique is a combination of a XOR table plus bit-swapping */ -static void common_decrypt(void) +static void common_decrypt(running_machine *machine) { - UINT16 *RAM = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *RAM = (UINT16 *)memory_region(machine, REGION_CPU1); int i; for (i = 0; i < 0x20000; i++) @@ -499,7 +499,7 @@ static void common_decrypt(void) RAM[0xc0000/2 + i] = data; } - RAM = (UINT16 *)memory_region(REGION_CPU2); + RAM = (UINT16 *)memory_region(machine, REGION_CPU2); for (i = 0; i < 0x20000; i++) { @@ -514,14 +514,14 @@ static void common_decrypt(void) static DRIVER_INIT( raidenk ) { memory_patcha(machine); - common_decrypt(); + common_decrypt(machine); } static DRIVER_INIT( raidena ) { memory_patcha(machine); - common_decrypt(); - seibu_sound_decrypt(REGION_CPU3,0x20000); + common_decrypt(machine); + seibu_sound_decrypt(machine,REGION_CPU3,0x20000); } /***************************************************************************/ diff --git a/src/mame/drivers/raiden2.c b/src/mame/drivers/raiden2.c index 15d4f9ab0b0..d559e30a9d3 100644 --- a/src/mame/drivers/raiden2.c +++ b/src/mame/drivers/raiden2.c @@ -661,7 +661,7 @@ static WRITE16_HANDLER(any_w) logerror("mainram_w %04x, %04x & %04x (%x)\n", offset*2, data, mem_mask, activecpu_get_pc()); // if(offset == 0x700) - // cpu_setbank(2, memory_region(REGION_USER1)+0x20000*data); + // cpu_setbank(2, memory_region(machine, REGION_USER1)+0x20000*data); COMBINE_DATA(&mainram[offset]); } @@ -722,7 +722,7 @@ static void r2_dt(UINT16 sc, UINT16 cc, UINT16 ent, UINT16 tm, UINT16 x, UINT16 logerror("Draw tilemap %04x:%04x %04x %04x %04x %04x, bank %d\n", sc, cc, ent, tm, x, y, bank); - // cpu_setbank(2, memory_region(REGION_USER1)+0x20000*bank); + // cpu_setbank(2, memory_region(machine, REGION_USER1)+0x20000*bank); } static void r2_6f6c(UINT16 cc, UINT16 v1, UINT16 v2) @@ -730,7 +730,7 @@ static void r2_6f6c(UINT16 cc, UINT16 v1, UINT16 v2) // int bank = 0; logerror("6f6c: 9800:%04x %04x %04x\n", cc, v1, v2); - // cpu_setbank(2, memory_region(REGION_USER1)+0x20000*bank); + // cpu_setbank(2, memory_region(machine, REGION_USER1)+0x20000*bank); } #endif @@ -1898,12 +1898,12 @@ ROM_END static DRIVER_INIT (raiden2) { /* wrong , there must be some banking this just stops it crashing */ - UINT8 *RAM = memory_region(REGION_USER1); + UINT8 *RAM = memory_region(machine, REGION_USER1); memory_set_bankptr(1,&RAM[0x100000]); memory_set_bankptr(2,&RAM[0x040000]); - raiden2_decrypt_sprites(); + raiden2_decrypt_sprites(machine); } @@ -2158,7 +2158,7 @@ MACHINE_DRIVER_END static DRIVER_INIT(rdx_v33) { - UINT8 *prg = memory_region(REGION_CPU1); + UINT8 *prg = memory_region(machine, REGION_CPU1); memory_set_bankptr(1,&prg[0x020000]); memory_set_bankptr(2,&prg[0x030000]); memory_set_bankptr(3,&prg[0x040000]); @@ -2174,7 +2174,7 @@ static DRIVER_INIT(rdx_v33) memory_set_bankptr(13,&prg[0x0e0000]); memory_set_bankptr(14,&prg[0x0f0000]); - raiden2_decrypt_sprites(); + raiden2_decrypt_sprites(machine); } diff --git a/src/mame/drivers/rainbow.c b/src/mame/drivers/rainbow.c index 01ab30d0fb2..3d6245680a3 100644 --- a/src/mame/drivers/rainbow.c +++ b/src/mame/drivers/rainbow.c @@ -347,7 +347,7 @@ ADDRESS_MAP_END static WRITE8_HANDLER( bankswitch_w ) { - memory_set_bankptr(5, memory_region(REGION_CPU2) + ((data - 1) & 3) * 0x4000 + 0x10000); + memory_set_bankptr(5, memory_region(machine, REGION_CPU2) + ((data - 1) & 3) * 0x4000 + 0x10000); } static READ8_HANDLER( jumping_latch_r ) @@ -803,8 +803,8 @@ static DRIVER_INIT( rainbowe ) static DRIVER_INIT( jumping ) { - int i, len = memory_region_length(REGION_GFX2); - UINT8 *rom = memory_region(REGION_GFX2); + int i, len = memory_region_length(machine, REGION_GFX2); + UINT8 *rom = memory_region(machine, REGION_GFX2); /* Sprite colour map is reversed - switch to normal */ diff --git a/src/mame/drivers/rampart.c b/src/mame/drivers/rampart.c index 2dc5f96825d..3edebcd4666 100644 --- a/src/mame/drivers/rampart.c +++ b/src/mame/drivers/rampart.c @@ -532,7 +532,7 @@ static DRIVER_INIT( rampart ) 0x01FF,0x0E00,0x01FF,0x0E00,0x01FF,0x0E00,0x01FF,0x0E00, 0x0000 }; - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); atarigen_eeprom_default = compressed_default_eeprom; memcpy(&rom[0x140000], &rom[0x40000], 0x8000); diff --git a/src/mame/drivers/rastan.c b/src/mame/drivers/rastan.c index 1d6cda8e0da..86446eda492 100644 --- a/src/mame/drivers/rastan.c +++ b/src/mame/drivers/rastan.c @@ -178,7 +178,7 @@ static WRITE8_HANDLER( rastan_bankswitch_w ) if (data == 0) offs = 0x0000; else offs = (data-1) * 0x4000 + 0x10000; - memory_set_bankptr( 1, memory_region(REGION_CPU2) + offs ); + memory_set_bankptr( 1, memory_region(machine, REGION_CPU2) + offs ); } @@ -195,7 +195,7 @@ static void rastan_msm5205_vck(running_machine *machine, int chip) } else { - adpcm_data = memory_region(REGION_SOUND1)[adpcm_pos]; + adpcm_data = memory_region(machine, REGION_SOUND1)[adpcm_pos]; adpcm_pos = (adpcm_pos + 1) & 0xffff; MSM5205_data_w(0, adpcm_data >> 4); } diff --git a/src/mame/drivers/rbmk.c b/src/mame/drivers/rbmk.c index 5fbd5090e42..7051655434e 100644 --- a/src/mame/drivers/rbmk.c +++ b/src/mame/drivers/rbmk.c @@ -490,7 +490,7 @@ static NVRAM_HANDLER( syf ) } else { - eeprom_set_data(memory_region(REGION_USER2),128); + eeprom_set_data(memory_region(machine, REGION_USER2),128); } } } diff --git a/src/mame/drivers/redclash.c b/src/mame/drivers/redclash.c index e4cf41bb6c2..7d642fef9b5 100644 --- a/src/mame/drivers/redclash.c +++ b/src/mame/drivers/redclash.c @@ -507,9 +507,9 @@ ROM_END static DRIVER_INIT( redclash ) { int i,j; - const UINT8 *src = memory_region(REGION_GFX2); - UINT8 *dst = memory_region(REGION_GFX3); - int len = memory_region_length(REGION_GFX3); + const UINT8 *src = memory_region(machine, REGION_GFX2); + UINT8 *dst = memory_region(machine, REGION_GFX3); + int len = memory_region_length(machine, REGION_GFX3); /* rearrange the sprite graphics */ for (i = 0;i < len;i++) diff --git a/src/mame/drivers/relief.c b/src/mame/drivers/relief.c index bc819c6bd0a..b3770d628f6 100644 --- a/src/mame/drivers/relief.c +++ b/src/mame/drivers/relief.c @@ -451,9 +451,9 @@ ROM_END * *************************************/ -static void init_common(const UINT16 *def_eeprom) +static void init_common(running_machine *machine, const UINT16 *def_eeprom) { - UINT8 *sound_base = memory_region(REGION_SOUND1); + UINT8 *sound_base = memory_region(machine, REGION_SOUND1); atarigen_eeprom_default = def_eeprom; @@ -490,7 +490,7 @@ static DRIVER_INIT( relief ) 0x0188,0x0120,0x0600,0x0196,0x013C,0x0192,0x0150,0xFF00, 0x9500,0x0000 }; - init_common(default_eeprom); + init_common(machine, default_eeprom); } @@ -513,7 +513,7 @@ static DRIVER_INIT( relief2 ) 0x0100,0x0145,0x0100,0x0109,0x0184,0x012C,0x0200,0x0107, 0x01AA,0x0149,0x60FF,0x3300,0x0000 }; - init_common(default_eeprom); + init_common(machine, default_eeprom); } diff --git a/src/mame/drivers/renegade.c b/src/mame/drivers/renegade.c index 1ac071f6102..ac59924e896 100644 --- a/src/mame/drivers/renegade.c +++ b/src/mame/drivers/renegade.c @@ -170,7 +170,7 @@ static void *renegade_adpcm_start(int clock, const struct CustomSound_interface struct renegade_adpcm_state *state = &renegade_adpcm; state->playing = 0; state->stream = stream_create(0, 1, clock, state, renegade_adpcm_callback); - state->base = memory_region(REGION_SOUND1); + state->base = memory_region(Machine, REGION_SOUND1); reset_adpcm(&state->adpcm); return state; } @@ -237,15 +237,15 @@ static const UINT8 kuniokun_xor_table[0x2a] = 0x68, 0x60 }; -static void setbank(void) +static void setbank(running_machine *machine) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); memory_set_bankptr(1, &RAM[bank ? 0x10000 : 0x4000]); } static STATE_POSTLOAD( renegade_postload ) { - setbank(); + setbank(machine); } static MACHINE_START( renegade ) @@ -486,7 +486,7 @@ static WRITE8_HANDLER( bankswitch_w ) if ((data & 1) != bank) { bank = data & 1; - setbank(); + setbank(machine); } } @@ -784,7 +784,7 @@ static const struct CustomSound_interface adpcm_interface = static MACHINE_RESET( renegade ) { bank = 0; - setbank(); + setbank(machine); } diff --git a/src/mame/drivers/rmhaihai.c b/src/mame/drivers/rmhaihai.c index 8f75c58b3fe..ecfa9b44ba7 100644 --- a/src/mame/drivers/rmhaihai.c +++ b/src/mame/drivers/rmhaihai.c @@ -128,7 +128,7 @@ logerror("%04x: keyboard_w %02x\n",activecpu_get_pc(),data); static READ8_HANDLER( samples_r ) { - return memory_region(REGION_SOUND1)[offset]; + return memory_region(machine, REGION_SOUND1)[offset]; } static WRITE8_HANDLER( adpcm_w ) @@ -154,7 +154,7 @@ static WRITE8_HANDLER( ctrl_w ) static WRITE8_HANDLER( themj_rombank_w ) { - UINT8 *rom = memory_region(REGION_CPU1) + 0x10000; + UINT8 *rom = memory_region(machine, REGION_CPU1) + 0x10000; int bank = data & 0x03; logerror("banksw %d\n",bank); memory_set_bankptr(1, rom + bank*0x4000); @@ -718,8 +718,8 @@ ROM_END static DRIVER_INIT( rmhaihai ) { - UINT8 *rom = memory_region(REGION_GFX1); - int size = memory_region_length(REGION_GFX1); + UINT8 *rom = memory_region(machine, REGION_GFX1); + int size = memory_region_length(machine, REGION_GFX1); int a,b; size /= 2; diff --git a/src/mame/drivers/rockrage.c b/src/mame/drivers/rockrage.c index 592eaa9364b..762fb73352c 100644 --- a/src/mame/drivers/rockrage.c +++ b/src/mame/drivers/rockrage.c @@ -71,7 +71,7 @@ static INTERRUPT_GEN( rockrage_interrupt ) static WRITE8_HANDLER( rockrage_bankswitch_w ) { int bankaddress; - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); /* bits 4-6 = bank number */ bankaddress = 0x10000 + ((data & 0x70) >> 4) * 0x2000; diff --git a/src/mame/drivers/rocnrope.c b/src/mame/drivers/rocnrope.c index 4942c813fcd..4d616c6c66d 100644 --- a/src/mame/drivers/rocnrope.c +++ b/src/mame/drivers/rocnrope.c @@ -22,7 +22,7 @@ extern VIDEO_UPDATE( rocnrope ); /* Roc'n'Rope has the IRQ vectors in RAM. The rom contains $FFFF at this address! */ static WRITE8_HANDLER( rocnrope_interrupt_vector_w ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); RAM[0xFFF2+offset] = data; @@ -309,14 +309,14 @@ ROM_END static DRIVER_INIT( rocnrope ) { - UINT8 *decrypted = konami1_decode(0); + UINT8 *decrypted = konami1_decode(machine, 0); decrypted[0x703d] = 0x98; /* fix one instruction */ } static DRIVER_INIT( rocnropk ) { - konami1_decode(0); + konami1_decode(machine, 0); } diff --git a/src/mame/drivers/rohga.c b/src/mame/drivers/rohga.c index a0cb9b69a82..f2171887054 100644 --- a/src/mame/drivers/rohga.c +++ b/src/mame/drivers/rohga.c @@ -1410,38 +1410,38 @@ ROM_END static DRIVER_INIT( rohga ) { - deco56_decrypt(REGION_GFX1); - deco56_decrypt(REGION_GFX2); + deco56_decrypt(machine, REGION_GFX1); + deco56_decrypt(machine, REGION_GFX2); decoprot_reset(); } static DRIVER_INIT( wizdfire ) { - deco74_decrypt(REGION_GFX1); - deco74_decrypt(REGION_GFX2); - deco74_decrypt(REGION_GFX3); + deco74_decrypt(machine, REGION_GFX1); + deco74_decrypt(machine, REGION_GFX2); + deco74_decrypt(machine, REGION_GFX3); } static DRIVER_INIT( nitrobal ) { - deco56_decrypt(REGION_GFX1); - deco56_decrypt(REGION_GFX2); - deco74_decrypt(REGION_GFX3); + deco56_decrypt(machine, REGION_GFX1); + deco56_decrypt(machine, REGION_GFX2); + deco74_decrypt(machine, REGION_GFX3); decoprot_reset(); } static DRIVER_INIT( schmeisr ) { - const UINT8 *src = memory_region(REGION_GFX2); - UINT8 *dst = memory_region(REGION_GFX1); + const UINT8 *src = memory_region(machine, REGION_GFX2); + UINT8 *dst = memory_region(machine, REGION_GFX1); memcpy(dst,src,0x20000); memcpy(dst+0x20000,src+0x80000,0x20000); - deco74_decrypt(REGION_GFX1); - deco74_decrypt(REGION_GFX2); + deco74_decrypt(machine, REGION_GFX1); + deco74_decrypt(machine, REGION_GFX2); decoprot_reset(); } diff --git a/src/mame/drivers/rollerg.c b/src/mame/drivers/rollerg.c index 181d7244ace..e393fc151b5 100644 --- a/src/mame/drivers/rollerg.c +++ b/src/mame/drivers/rollerg.c @@ -7,6 +7,7 @@ driver by Nicola Salmoria ***************************************************************************/ #include "driver.h" +#include "deprecat.h" #include "video/konamiic.h" #include "cpu/konami/konami.h" /* for the callback and the firq irq definition */ #include "machine/eeprom.h" @@ -338,7 +339,7 @@ ROM_END static void rollerg_banking( int lines ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(Machine, REGION_CPU1); int offs = 0; diff --git a/src/mame/drivers/route16.c b/src/mame/drivers/route16.c index d575eb17dd7..37027c4f134 100644 --- a/src/mame/drivers/route16.c +++ b/src/mame/drivers/route16.c @@ -913,7 +913,7 @@ static READ8_HANDLER( routex_prot_read ) static DRIVER_INIT( route16 ) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); /* Is this actually a bootleg? some of the protection has been removed */ @@ -928,7 +928,7 @@ static DRIVER_INIT( route16 ) static DRIVER_INIT( route16a ) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); /* TO DO : Replace these patches with simulation of the protection device */ /* patch the protection */ diff --git a/src/mame/drivers/royalmah.c b/src/mame/drivers/royalmah.c index 7c773fde2c0..1a9f2314e52 100644 --- a/src/mame/drivers/royalmah.c +++ b/src/mame/drivers/royalmah.c @@ -98,8 +98,8 @@ static int palette_base; static PALETTE_INIT( royalmah ) { offs_t i; - const UINT8 *prom = memory_region(REGION_PROMS); - int len = memory_region_length(REGION_PROMS); + const UINT8 *prom = memory_region(machine, REGION_PROMS); + int len = memory_region_length(machine, REGION_PROMS); for (i = 0; i < len; i++) { @@ -133,8 +133,8 @@ static PALETTE_INIT( royalmah ) static PALETTE_INIT( mjderngr ) { offs_t i; - const UINT8 *prom = memory_region(REGION_PROMS); - int len = memory_region_length(REGION_PROMS); + const UINT8 *prom = memory_region(machine, REGION_PROMS); + int len = memory_region_length(machine, REGION_PROMS); for (i = 0; i < len / 2; i++) { @@ -285,7 +285,7 @@ static READ8_HANDLER ( suzume_dsw_r ) static WRITE8_HANDLER ( suzume_bank_w ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); int address; suzume_bank = data; @@ -301,7 +301,7 @@ logerror("%04x: bank %02x\n",activecpu_get_pc(),data); static WRITE8_HANDLER ( mjapinky_bank_w ) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); rombank = data; memory_set_bankptr(1,ROM + 0x10000 + 0x8000 * data); } @@ -317,12 +317,12 @@ static WRITE8_HANDLER( mjapinky_palbank_w ) static READ8_HANDLER( mjapinky_dsw_r ) { if (rombank == 0x0e) return input_port_read_indexed(machine, 13); - else return *(memory_region(REGION_CPU1) + 0x10000 + 0x8000 * rombank); + else return *(memory_region(machine, REGION_CPU1) + 0x10000 + 0x8000 * rombank); } static WRITE8_HANDLER ( tontonb_bank_w ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); int address; logerror("%04x: bank %02x\n",activecpu_get_pc(),data); @@ -340,7 +340,7 @@ logerror("%04x: bank %02x\n",activecpu_get_pc(),data); /* bits 5 and 6 seem to affect which Dip Switch to read in 'majs101b' */ static WRITE8_HANDLER ( dynax_bank_w ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); int address; //logerror("%04x: bank %02x\n",activecpu_get_pc(),data); @@ -516,7 +516,7 @@ static READ8_HANDLER( janptr96_dsw_r ) static WRITE8_HANDLER( janptr96_rombank_w ) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); memory_set_bankptr(1,ROM + 0x10000 + 0x8000 * data); } @@ -570,7 +570,7 @@ static WRITE8_HANDLER( mjifb_coin_counter_w ) static READ8_HANDLER( mjifb_rom_io_r ) { if (mjifb_rom_enable) - return ((UINT8*)(memory_region(REGION_CPU1) + 0x10000 + rombank * 0x4000))[offset]; + return ((UINT8*)(memory_region(machine, REGION_CPU1) + 0x10000 + rombank * 0x4000))[offset]; offset += 0x8000; @@ -677,7 +677,7 @@ ADDRESS_MAP_END static READ8_HANDLER( mjdejavu_rom_io_r ) { if (mjifb_rom_enable) - return ((UINT8*)(memory_region(REGION_CPU1) + 0x10000 + rombank * 0x4000))[offset]; + return ((UINT8*)(memory_region(machine, REGION_CPU1) + 0x10000 + rombank * 0x4000))[offset]; offset += 0x8000; @@ -736,7 +736,7 @@ static READ8_HANDLER( mjtensin_p3_r ) static void mjtensin_update_rombank(void) { - memory_set_bankptr( 1, memory_region(REGION_CPU1) + 0x10000 + rombank * 0x8000 ); + memory_set_bankptr( 1, memory_region(Machine, REGION_CPU1) + 0x10000 + rombank * 0x8000 ); } static WRITE8_HANDLER( mjtensin_p4_w ) { @@ -778,7 +778,7 @@ ADDRESS_MAP_END static void cafetime_update_rombank(void) { - memory_set_bankptr( 1, memory_region(REGION_CPU1) + 0x10000 + rombank * 0x8000 ); + memory_set_bankptr( 1, memory_region(Machine, REGION_CPU1) + 0x10000 + rombank * 0x8000 ); } static WRITE8_HANDLER( cafetime_p4_w ) { @@ -4247,7 +4247,7 @@ ROM_START( janoh ) ROM_END -static DRIVER_INIT( ippatsu ) { memory_set_bankptr(1, memory_region(REGION_CPU1) + 0x8000 ); } +static DRIVER_INIT( ippatsu ) { memory_set_bankptr(1, memory_region(machine, REGION_CPU1) + 0x8000 ); } static DRIVER_INIT( janptr96 ) { diff --git a/src/mame/drivers/rpunch.c b/src/mame/drivers/rpunch.c index 008ab1e3da4..af749772a91 100644 --- a/src/mame/drivers/rpunch.c +++ b/src/mame/drivers/rpunch.c @@ -151,7 +151,7 @@ static void ym2151_irq_gen(running_machine *machine, int state) static MACHINE_RESET( rpunch ) { - UINT8 *snd = memory_region(REGION_SOUND1); + UINT8 *snd = memory_region(machine, REGION_SOUND1); memcpy(snd, snd + 0x20000, 0x20000); } @@ -216,7 +216,7 @@ static WRITE8_HANDLER( upd_control_w ) { if ((data & 1) != upd_rom_bank) { - UINT8 *snd = memory_region(REGION_SOUND1); + UINT8 *snd = memory_region(machine, REGION_SOUND1); upd_rom_bank = data & 1; memcpy(snd, snd + 0x20000 * (upd_rom_bank + 1), 0x20000); } diff --git a/src/mame/drivers/rungun.c b/src/mame/drivers/rungun.c index 26f65297360..12b17ba33d2 100644 --- a/src/mame/drivers/rungun.c +++ b/src/mame/drivers/rungun.c @@ -262,7 +262,7 @@ static WRITE8_HANDLER( z80ctrl_w ) { rng_z80_control = data; - memory_set_bankptr(2, memory_region(REGION_CPU2) + 0x10000 + (data & 0x07) * 0x4000); + memory_set_bankptr(2, memory_region(machine, REGION_CPU2) + 0x10000 + (data & 0x07) * 0x4000); if (data & 0x10) cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, CLEAR_LINE); diff --git a/src/mame/drivers/sandscrp.c b/src/mame/drivers/sandscrp.c index eff39ed7ca1..907bdb39528 100644 --- a/src/mame/drivers/sandscrp.c +++ b/src/mame/drivers/sandscrp.c @@ -232,7 +232,7 @@ ADDRESS_MAP_END static WRITE8_HANDLER( sandscrp_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); int bank = data & 0x07; if ( bank != data ) logerror("CPU #1 - PC %04X: Bank %02X\n",activecpu_get_pc(),data); diff --git a/src/mame/drivers/sangho.c b/src/mame/drivers/sangho.c index 7c3057b9369..b608963e076 100644 --- a/src/mame/drivers/sangho.c +++ b/src/mame/drivers/sangho.c @@ -70,8 +70,8 @@ ADDRESS_MAP_END /* Wrong ! */ static WRITE8_HANDLER(pzlestar_bank_w) { - memory_set_bankptr(2,&memory_region(REGION_USER1)[0x20000+ ( ((0x8000*data)^0x10000)) ]); - memory_set_bankptr(3,&memory_region(REGION_USER1)[ 0x18000 ]); + memory_set_bankptr(2,&memory_region(machine, REGION_USER1)[0x20000+ ( ((0x8000*data)^0x10000)) ]); + memory_set_bankptr(3,&memory_region(machine, REGION_USER1)[ 0x18000 ]); } /* Puzzle Star Ports */ @@ -192,7 +192,7 @@ static void sangho_common_machine_reset(void) static MACHINE_RESET(pzlestar) { /* give it some code to run, note this isn't at 0 in the rom! */ - memcpy(sangho_ram,&memory_region(REGION_USER1)[0x10000],0x8000); + memcpy(sangho_ram,&memory_region(machine, REGION_USER1)[0x10000],0x8000); /* patch out rom check (it fails, due to bad banking) */ sangho_ram[0x25c1]=0xaf; @@ -204,7 +204,7 @@ static MACHINE_RESET(pzlestar) static MACHINE_RESET(sexyboom) { /* give it some code to run */ - memcpy(sangho_ram,memory_region(REGION_USER1),0x8000); + memcpy(sangho_ram,memory_region(machine, REGION_USER1),0x8000); /* patch out rom check */ sangho_ram[0x022e]=0xc9; sangho_ram[0x4604]=0xc9; diff --git a/src/mame/drivers/sauro.c b/src/mame/drivers/sauro.c index cf397b1dc8b..9b0cdb91e30 100644 --- a/src/mame/drivers/sauro.c +++ b/src/mame/drivers/sauro.c @@ -510,7 +510,7 @@ static DRIVER_INIT( tecfri ) /* This game doesn't like all memory to be initialized to zero, it won't initialize the high scores */ - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); memset(&RAM[0xe000], 0, 0x100); RAM[0xe000] = 1; diff --git a/src/mame/drivers/sbasketb.c b/src/mame/drivers/sbasketb.c index b07bd2b8097..2b3c607894d 100644 --- a/src/mame/drivers/sbasketb.c +++ b/src/mame/drivers/sbasketb.c @@ -381,7 +381,7 @@ ROM_END static DRIVER_INIT( sbasketb ) { - konami1_decode(0); + konami1_decode(machine, 0); } diff --git a/src/mame/drivers/sbowling.c b/src/mame/drivers/sbowling.c index e4b27056797..b2f31182871 100644 --- a/src/mame/drivers/sbowling.c +++ b/src/mame/drivers/sbowling.c @@ -54,7 +54,7 @@ static UINT8 pix[2] = {0, 0}; static TILE_GET_INFO( get_sb_tile_info ) { - UINT8 *rom = memory_region(REGION_USER1); + UINT8 *rom = memory_region(machine, REGION_USER1); int tileno = rom[tile_index + bgmap * 1024]; SET_TILE_INFO(0, tileno, 0, 0); diff --git a/src/mame/drivers/scregg.c b/src/mame/drivers/scregg.c index 1a2d387d0fe..47d4071808f 100644 --- a/src/mame/drivers/scregg.c +++ b/src/mame/drivers/scregg.c @@ -387,7 +387,7 @@ static DRIVER_INIT( rockduck ) { // rd2.rdh and rd1.rdj are bitswapped, but not rd3.rdg .. are they really from the same board? int x; - UINT8 *src = memory_region( REGION_GFX1 ); + UINT8 *src = memory_region( machine, REGION_GFX1 ); for (x=0x2000;x<0x6000;x++) { diff --git a/src/mame/drivers/segac2.c b/src/mame/drivers/segac2.c index 8d5ca6c818a..c31145d3a59 100644 --- a/src/mame/drivers/segac2.c +++ b/src/mame/drivers/segac2.c @@ -148,8 +148,8 @@ static MACHINE_RESET( segac2 ) /* determine how many sound banks */ sound_banks = 0; - if (memory_region(REGION_SOUND1)) - sound_banks = memory_region_length(REGION_SOUND1) / 0x20000; + if (memory_region(machine, REGION_SOUND1)) + sound_banks = memory_region_length(machine, REGION_SOUND1) / 0x20000; /* reset the protection */ prot_write_buf = 0; @@ -2160,7 +2160,7 @@ static DRIVER_INIT( ichirj ) static DRIVER_INIT( ichirjbl ) { /* when did this actually work? - the protection is patched but the new check fails? */ - UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *rom = (UINT16 *)memory_region(machine, REGION_CPU1); rom[0x390/2] = 0x6600; } diff --git a/src/mame/drivers/segae.c b/src/mame/drivers/segae.c index 2aafda5aa9f..4aaee7eef89 100644 --- a/src/mame/drivers/segae.c +++ b/src/mame/drivers/segae.c @@ -2146,7 +2146,7 @@ static WRITE8_HANDLER( systeme_bank_w ) vdp2->vram = vdp2_vram_bank0; } - //memcpy(sms_rom+0x8000, memory_region(REGION_USER1)+0x10000+rombank*0x4000, 0x4000); + //memcpy(sms_rom+0x8000, memory_region(machine, REGION_USER1)+0x10000+rombank*0x4000, 0x4000); memory_set_bank(1, rombank); } @@ -2193,13 +2193,13 @@ static void init_systeme_map(running_machine *machine) // memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0xbfff, 0, 0, SMH_BANK1, SMH_UNMAP); // memory_set_bankptr( 1, sms_rom ); - memory_configure_bank(1, 0, 16, memory_region(REGION_CPU1) + 0x10000, 0x4000); + memory_configure_bank(1, 0, 16, memory_region(machine, REGION_CPU1) + 0x10000, 0x4000); /* alternate way of accessing video ram */ memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xbfff, 0, 0, segasyse_videoram_w); -// memcpy(sms_rom, memory_region(REGION_USER1), 0x8000); +// memcpy(sms_rom, memory_region(machine, REGION_USER1), 0x8000); /* main ram area */ sms_mainram = auto_malloc(0x4000); @@ -2345,21 +2345,21 @@ static DRIVER_INIT( opaopa ) { DRIVER_INIT_CALL(segasyse); - mc8123_decrypt_rom(0, memory_region(REGION_USER1), 1, 8); + mc8123_decrypt_rom(machine, 0, memory_region(machine, REGION_USER1), 1, 8); } static DRIVER_INIT( fantzn2 ) { DRIVER_INIT_CALL(segasyse); - mc8123_decrypt_rom(0, memory_region(REGION_USER1), 0, 0); + mc8123_decrypt_rom(machine, 0, memory_region(machine, REGION_USER1), 0, 0); } static DRIVER_INIT( astrofl ) { DRIVER_INIT_CALL(segasyse); - astrofl_decode(); + astrofl_decode(machine); } GAME( 1985, hangonjr, 0, systeme, hangonjr, hangonjr, ROT0, "Sega", "Hang-On Jr.", 0 ) diff --git a/src/mame/drivers/segag80r.c b/src/mame/drivers/segag80r.c index 2b9ebf51376..39c8995f4fa 100644 --- a/src/mame/drivers/segag80r.c +++ b/src/mame/drivers/segag80r.c @@ -1413,7 +1413,7 @@ static void monsterb_expand_gfx(int region) /* expand the background ROMs; A11/A12 of each ROM is independently controlled via */ /* banking */ - dest = memory_region(region); + dest = memory_region(Machine, region); temp = malloc_or_die(0x4000); memcpy(temp, dest, 0x4000); @@ -1499,7 +1499,7 @@ static DRIVER_INIT( monsterb ) static DRIVER_INIT( monster2 ) { /* configure the 315-5006 security chip */ - spatter_decode(); + spatter_decode(machine); sega_security(0); /* configure video */ @@ -1536,7 +1536,7 @@ static DRIVER_INIT( pignewt ) static DRIVER_INIT( sindbadm ) { /* configure the encrypted Z80 */ - sindbadm_decode(); + sindbadm_decode(machine); sega_security(0); /* configure video */ diff --git a/src/mame/drivers/segahang.c b/src/mame/drivers/segahang.c index a9b99ab4d93..987f7baac56 100644 --- a/src/mame/drivers/segahang.c +++ b/src/mame/drivers/segahang.c @@ -1712,13 +1712,13 @@ static DRIVER_INIT( sharrier ) static DRIVER_INIT( enduror ) { hangon_generic_init(); - fd1089_decrypt_0013A(); + fd1089_decrypt_0013A(machine); } static DRIVER_INIT( endurobl ) { - UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *rom = (UINT16 *)memory_region(machine, REGION_CPU1); UINT16 *decrypt = (UINT16 *)auto_malloc(0x40000); hangon_generic_init(); @@ -1731,7 +1731,7 @@ static DRIVER_INIT( endurobl ) static DRIVER_INIT( endurob2 ) { - UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *rom = (UINT16 *)memory_region(machine, REGION_CPU1); UINT16 *decrypt = (UINT16 *)auto_malloc(0x40000); hangon_generic_init(); diff --git a/src/mame/drivers/segald.c b/src/mame/drivers/segald.c index 551ace4953d..0d85cf99a03 100644 --- a/src/mame/drivers/segald.c +++ b/src/mame/drivers/segald.c @@ -554,7 +554,7 @@ ROM_END static DRIVER_INIT( astron ) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); memory_configure_bank(1, 0, 2, &ROM[0x8000], 0x4000); } diff --git a/src/mame/drivers/segaorun.c b/src/mame/drivers/segaorun.c index 6e05bb3c644..f975e575570 100644 --- a/src/mame/drivers/segaorun.c +++ b/src/mame/drivers/segaorun.c @@ -1754,22 +1754,22 @@ static DRIVER_INIT( outrunb ) custom_io_w = outrun_custom_io_w; /* main CPU: swap bits 11,12 and 6,7 */ - word = (UINT16 *)memory_region(REGION_CPU1); - length = memory_region_length(REGION_CPU1) / 2; + word = (UINT16 *)memory_region(machine, REGION_CPU1); + length = memory_region_length(machine, REGION_CPU1) / 2; for (i = 0; i < length; i++) word[i] = BITSWAP16(word[i], 15,14,11,12,13,10,9,8,6,7,5,4,3,2,1,0); /* sub CPU: swap bits 14,15 and 2,3 */ - word = (UINT16 *)memory_region(REGION_CPU2); - length = memory_region_length(REGION_CPU2) / 2; + word = (UINT16 *)memory_region(machine, REGION_CPU2); + length = memory_region_length(machine, REGION_CPU2) / 2; for (i = 0; i < length; i++) word[i] = BITSWAP16(word[i], 14,15,13,12,11,10,9,8,7,6,5,4,2,3,1,0); /* road gfx */ /* rom a-2.bin: swap bits 6,7 */ /* rom a-3.bin: swap bits 5,6 */ - byte = memory_region(REGION_GFX3); - length = memory_region_length(REGION_GFX3) / 2; + byte = memory_region(machine, REGION_GFX3); + length = memory_region_length(machine, REGION_GFX3) / 2; for (i = 0; i < length; i++) { byte[i] = BITSWAP8(byte[i], 6,7,5,4,3,2,1,0); @@ -1777,8 +1777,8 @@ static DRIVER_INIT( outrunb ) } /* Z80 code: swap bits 5,6 */ - byte = memory_region(REGION_CPU3); - length = memory_region_length(REGION_CPU3); + byte = memory_region(machine, REGION_CPU3); + length = memory_region_length(machine, REGION_CPU3); for (i = 0; i < length; i++) byte[i] = BITSWAP8(byte[i], 7,5,6,4,3,2,1,0); } @@ -1795,7 +1795,7 @@ static DRIVER_INIT( shangon ) static DRIVER_INIT( shangon3 ) { outrun_generic_init(machine); - fd1089_decrypt_0034(); + fd1089_decrypt_0034(machine); custom_io_r = shangon_custom_io_r; custom_io_w = shangon_custom_io_w; } diff --git a/src/mame/drivers/segas16a.c b/src/mame/drivers/segas16a.c index f146678b0b6..a3122809d0d 100644 --- a/src/mame/drivers/segas16a.c +++ b/src/mame/drivers/segas16a.c @@ -406,7 +406,7 @@ static WRITE8_HANDLER( n7751_command_w ) D1 = /CS for ROM 0 D0 = A14 line to ROMs */ - int numroms = memory_region_length(REGION_SOUND1) / 0x8000; + int numroms = memory_region_length(machine, REGION_SOUND1) / 0x8000; n7751_rom_address &= 0x3fff; n7751_rom_address |= (data & 0x01) << 14; if (!(data & 0x02) && numroms >= 1) n7751_rom_address |= 0x00000; @@ -446,7 +446,7 @@ static WRITE8_HANDLER( n7751_rom_offset_w ) static READ8_HANDLER( n7751_rom_r ) { /* read from BUS */ - return memory_region(REGION_SOUND1)[n7751_rom_address]; + return memory_region(machine, REGION_SOUND1)[n7751_rom_address]; } @@ -3105,27 +3105,27 @@ static DRIVER_INIT( aceattaa ) static DRIVER_INIT( afighter ) { system16a_generic_init(machine); - fd1089_decrypt_0018(); + fd1089_decrypt_0018(machine); } static DRIVER_INIT( alexkid1 ) { system16a_generic_init(machine); - fd1089_decrypt_0021(); + fd1089_decrypt_0021(machine); } static DRIVER_INIT( aliensy1 ) { system16a_generic_init(machine); - fd1089_decrypt_0033(); + fd1089_decrypt_0033(machine); } static DRIVER_INIT( aliensy5 ) { system16a_generic_init(machine); - fd1089_decrypt_0037(); + fd1089_decrypt_0037(machine); } static DRIVER_INIT( bodyslam ) @@ -3157,7 +3157,7 @@ static DRIVER_INIT( quartet ) static DRIVER_INIT( sdi ) { system16a_generic_init(machine); - fd1089_decrypt_0027(); + fd1089_decrypt_0027(machine); custom_io_r = sdi_custom_io_r; } @@ -3165,7 +3165,7 @@ static DRIVER_INIT( sdi ) static DRIVER_INIT( sjryukoa ) { system16a_generic_init(machine); - fd1089_decrypt_5021(); + fd1089_decrypt_5021(machine); custom_io_r = sjryuko_custom_io_r; lamp_changed_w = sjryuko_lamp_changed_w; } @@ -3174,13 +3174,13 @@ static DRIVER_INIT( sjryukoa ) static DRIVER_INIT( timesca1 ) { system16a_generic_init(machine); - fd1089_decrypt_0024(); + fd1089_decrypt_0024(machine); } static DRIVER_INIT( wb35 ) { system16a_generic_init(machine); - fd1089_decrypt_wb35(); + fd1089_decrypt_wb35(machine); } /************************************* diff --git a/src/mame/drivers/segas16b.c b/src/mame/drivers/segas16b.c index a5dbded1407..37a7a46598a 100644 --- a/src/mame/drivers/segas16b.c +++ b/src/mame/drivers/segas16b.c @@ -1270,7 +1270,7 @@ static WRITE16_HANDLER( unknown_rgn2_w ) static WRITE8_HANDLER( upd7759_control_w ) { - int size = memory_region_length(REGION_CPU2) - 0x10000; + int size = memory_region_length(machine, REGION_CPU2) - 0x10000; if (size > 0) { int bankoffs = 0; @@ -1327,7 +1327,7 @@ static WRITE8_HANDLER( upd7759_control_w ) bankoffs += (data & 0x07) * 0x04000; break; } - memory_set_bankptr(1, memory_region(REGION_CPU2) + 0x10000 + (bankoffs % size)); + memory_set_bankptr(1, memory_region(machine, REGION_CPU2) + 0x10000 + (bankoffs % size)); } } @@ -6127,7 +6127,7 @@ static DRIVER_INIT( generic_5797 ) static DRIVER_INIT( aliensy3_5358 ) { DRIVER_INIT_CALL(generic_5358); - fd1089_decrypt_0033(); + fd1089_decrypt_0033(machine); } @@ -6155,21 +6155,21 @@ static DRIVER_INIT( altbeas5_5521 ) static DRIVER_INIT( altbeas4_5521 ) { DRIVER_INIT_CALL(generic_5521); - mc8123_decrypt_rom(1, memory_region(REGION_USER2), 0, 0); + mc8123_decrypt_rom(machine, 1, memory_region(machine, REGION_USER2), 0, 0); } static DRIVER_INIT( aurail1_5704 ) { DRIVER_INIT_CALL(generic_5704); - fd1089_decrypt_0168(); + fd1089_decrypt_0168(machine); } static DRIVER_INIT( aurailj_5704 ) { DRIVER_INIT_CALL(generic_5704); - fd1089_decrypt_0167(); + fd1089_decrypt_0167(machine); } @@ -6183,7 +6183,7 @@ static DRIVER_INIT( ddux_5704 ) static DRIVER_INIT( dunkshot_5358 ) { DRIVER_INIT_CALL(generic_5358); - fd1089_decrypt_0022(); + fd1089_decrypt_0022(machine); custom_io_r = dunkshot_custom_io_r; } @@ -6228,7 +6228,7 @@ static DRIVER_INIT( sdi_5358 ) static DRIVER_INIT( defense_5358 ) { DRIVER_INIT_CALL(generic_5358); - fd1089_decrypt_0028(); + fd1089_decrypt_0028(machine); custom_io_r = sdi_custom_io_r; } @@ -6236,21 +6236,21 @@ static DRIVER_INIT( defense_5358 ) static DRIVER_INIT( shinobi4_5521 ) { DRIVER_INIT_CALL(generic_5521); - mc8123_decrypt_rom(1, memory_region(REGION_USER2), 0, 0); + mc8123_decrypt_rom(machine, 1, memory_region(machine, REGION_USER2), 0, 0); } static DRIVER_INIT( shinobi3_5358 ) { DRIVER_INIT_CALL(generic_5358); - mc8123_decrypt_rom(1, memory_region(REGION_USER2), 0, 0); + mc8123_decrypt_rom(machine, 1, memory_region(machine, REGION_USER2), 0, 0); } static DRIVER_INIT( sjryuko_5358 ) { DRIVER_INIT_CALL(generic_5358); - fd1089_decrypt_5021(); + fd1089_decrypt_5021(machine); custom_io_r = sjryuko_custom_io_r; custom_io_w = sjryuko_custom_io_w; } diff --git a/src/mame/drivers/segas18.c b/src/mame/drivers/segas18.c index 7978a2bebea..6d2e00398cf 100644 --- a/src/mame/drivers/segas18.c +++ b/src/mame/drivers/segas18.c @@ -399,7 +399,7 @@ static WRITE16_HANDLER( rom_5987_bank_w ) /* sprite banking */ else { - int maxbanks = memory_region_length(REGION_GFX2) / 0x40000; + int maxbanks = memory_region_length(machine, REGION_GFX2) / 0x40000; if (data >= maxbanks) data = 255; segaic16_sprites_set_bank(0, (offset - 8) * 2 + 0, data * 2 + 0); @@ -550,7 +550,7 @@ static WRITE16_HANDLER( wwally_custom_io_w ) static WRITE8_HANDLER( soundbank_w ) { - memory_set_bankptr(1, memory_region(REGION_CPU2) + 0x10000 + 0x2000 * data); + memory_set_bankptr(1, memory_region(machine, REGION_CPU2) + 0x10000 + 0x2000 * data); } diff --git a/src/mame/drivers/segas24.c b/src/mame/drivers/segas24.c index 03ddf5421d7..3e4c42e31c8 100644 --- a/src/mame/drivers/segas24.c +++ b/src/mame/drivers/segas24.c @@ -429,7 +429,7 @@ static WRITE16_HANDLER( fdc_w ) break; case 0x9: logerror("Read multiple [%02x] %d..%d side %d track %d\n", data, fdc_sector, fdc_sector+fdc_data-1, data & 8 ? 1 : 0, fdc_phys_track); - fdc_pt = memory_region(REGION_USER2) + track_size*(2*fdc_phys_track+(data & 8 ? 1 : 0)); + fdc_pt = memory_region(machine, REGION_USER2) + track_size*(2*fdc_phys_track+(data & 8 ? 1 : 0)); fdc_span = track_size; fdc_status = 3; fdc_drq = 1; @@ -437,7 +437,7 @@ static WRITE16_HANDLER( fdc_w ) break; case 0xb: logerror("Write multiple [%02x] %d..%d side %d track %d\n", data, fdc_sector, fdc_sector+fdc_data-1, data & 8 ? 1 : 0, fdc_phys_track); - fdc_pt = memory_region(REGION_USER2) + track_size*(2*fdc_phys_track+(data & 8 ? 1 : 0)); + fdc_pt = memory_region(machine, REGION_USER2) + track_size*(2*fdc_phys_track+(data & 8 ? 1 : 0)); fdc_span = track_size; fdc_status = 3; fdc_drq = 1; @@ -719,9 +719,9 @@ static void resetcontrol_w(UINT8 data) static UINT8 curbank; -static void reset_bank(void) +static void reset_bank(running_machine *machine) { - if (memory_region(REGION_USER1)) + if (memory_region(machine, REGION_USER1)) { memory_set_bank(1, curbank & 15); memory_set_bank(2, curbank & 15); @@ -737,7 +737,7 @@ static WRITE16_HANDLER( curbank_w ) { if(ACCESSING_BITS_0_7) { curbank = data & 0xff; - reset_bank(); + reset_bank(machine); } } @@ -1250,14 +1250,14 @@ static NVRAM_HANDLER(system24) if(!track_size || !file) return; if(read_or_write) - mame_fwrite(file, memory_region(REGION_USER2), 2*track_size); + mame_fwrite(file, memory_region(machine, REGION_USER2), 2*track_size); else - mame_fread(file, memory_region(REGION_USER2), 2*track_size); + mame_fread(file, memory_region(machine, REGION_USER2), 2*track_size); } static MACHINE_START( system24 ) { - UINT8 *usr1 = memory_region(REGION_USER1); + UINT8 *usr1 = memory_region(machine, REGION_USER1); if (usr1) { memory_configure_bank(1, 0, 16, usr1, 0x40000); @@ -1271,7 +1271,7 @@ static MACHINE_RESET(system24) prev_resetcontrol = resetcontrol = 0x06; fdc_init(); curbank = 0; - reset_bank(); + reset_bank(machine); irq_init(); mlatch = 0x00; } diff --git a/src/mame/drivers/segas32.c b/src/mame/drivers/segas32.c index 3a57bf52ec5..c0c93fdb5e6 100644 --- a/src/mame/drivers/segas32.c +++ b/src/mame/drivers/segas32.c @@ -1103,14 +1103,14 @@ static void ym3438_irq_handler(running_machine *machine, int state) static WRITE8_HANDLER( sound_bank_lo_w ) { sound_bank = (sound_bank & ~0x3f) | (data & 0x3f); - memory_set_bankptr(1, memory_region(REGION_CPU2) + 0x100000 + 0x2000 * sound_bank); + memory_set_bankptr(1, memory_region(machine, REGION_CPU2) + 0x100000 + 0x2000 * sound_bank); } static WRITE8_HANDLER( sound_bank_hi_w ) { sound_bank = (sound_bank & 0x3f) | ((data & 0x04) << 4) | ((data & 0x03) << 7); - memory_set_bankptr(1, memory_region(REGION_CPU2) + 0x100000 + 0x2000 * sound_bank); + memory_set_bankptr(1, memory_region(machine, REGION_CPU2) + 0x100000 + 0x2000 * sound_bank); } @@ -3894,7 +3894,7 @@ static DRIVER_INIT( ga2 ) { segas32_common_init(extra_custom_io_r, NULL, NULL); - decrypt_ga2_protrom(); + decrypt_ga2_protrom(machine); memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa00000, 0xa00fff, 0, 0, ga2_dpram_r, ga2_dpram_w); } @@ -3914,7 +3914,7 @@ static DRIVER_INIT( holo ) static DRIVER_INIT( jpark ) { /* Temp. Patch until we emulate the 'Drive Board', thanks to Malice */ - UINT16 *pROM = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *pROM = (UINT16 *)memory_region(machine, REGION_CPU1); segas32_common_init(analog_custom_io_r, analog_custom_io_w, NULL); diff --git a/src/mame/drivers/seibuspi.c b/src/mame/drivers/seibuspi.c index c43b5f69635..3844a9c5490 100644 --- a/src/mame/drivers/seibuspi.c +++ b/src/mame/drivers/seibuspi.c @@ -973,8 +973,8 @@ static READ8_HANDLER( z80_coin_r ) static READ32_HANDLER( soundrom_r ) { - UINT8 *sound = (UINT8*)memory_region(REGION_USER2); - UINT16 *sound16 = (UINT16*)memory_region(REGION_USER2); + UINT8 *sound = (UINT8*)memory_region(machine, REGION_USER2); + UINT16 *sound16 = (UINT16*)memory_region(machine, REGION_USER2); if (mem_mask == 0x000000ff) { @@ -1727,9 +1727,9 @@ static IRQ_CALLBACK(spi_irq_callback) static MACHINE_RESET( spi ) { int i; - UINT8 *sound = memory_region(REGION_SOUND1); + UINT8 *sound = memory_region(machine, REGION_SOUND1); - UINT8 *rombase = memory_region(REGION_USER1); + UINT8 *rombase = memory_region(machine, REGION_USER1); UINT8 flash_data = rombase[0x1ffffc]; cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, ASSERT_LINE ); @@ -1801,7 +1801,7 @@ MACHINE_DRIVER_END static MACHINE_RESET( sxx2f ) { - UINT8 *rom = memory_region(REGION_CPU2); + UINT8 *rom = memory_region(machine, REGION_CPU2); z80_rom = auto_malloc(0x40000); memory_set_bankptr(4, z80_rom); @@ -1974,9 +1974,9 @@ static void init_spi(running_machine *machine) intelflash_init( 0, FLASH_INTEL_E28F008SA, NULL ); intelflash_init( 1, FLASH_INTEL_E28F008SA, NULL ); - seibuspi_text_decrypt(memory_region(REGION_GFX1)); - seibuspi_bg_decrypt(memory_region(REGION_GFX2), memory_region_length(REGION_GFX2)); - seibuspi_sprite_decrypt(memory_region(REGION_GFX3), 0x400000); + seibuspi_text_decrypt(memory_region(machine, REGION_GFX1)); + seibuspi_bg_decrypt(memory_region(machine, REGION_GFX2), memory_region_length(machine, REGION_GFX2)); + seibuspi_sprite_decrypt(memory_region(machine, REGION_GFX3), 0x400000); } static DRIVER_INIT( rdft ) @@ -2037,9 +2037,9 @@ static void init_rf2(running_machine *machine) intelflash_init( 1, FLASH_INTEL_E28F008SA, NULL ); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0282AC, 0x0282AF, 0, 0, rf2_speedup_r ); - seibuspi_rise10_text_decrypt(memory_region(REGION_GFX1)); - seibuspi_rise10_bg_decrypt(memory_region(REGION_GFX2), memory_region_length(REGION_GFX2)); - seibuspi_rise10_sprite_decrypt(memory_region(REGION_GFX3), 0x600000); + seibuspi_rise10_text_decrypt(memory_region(machine, REGION_GFX1)); + seibuspi_rise10_bg_decrypt(memory_region(machine, REGION_GFX2), memory_region_length(machine, REGION_GFX2)); + seibuspi_rise10_sprite_decrypt(memory_region(machine, REGION_GFX3), 0x600000); memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x560, 0x563, 0, 0, sprite_dma_start_w); } @@ -2061,9 +2061,9 @@ static DRIVER_INIT( rfjet ) intelflash_init( 1, FLASH_INTEL_E28F008SA, NULL ); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x002894c, 0x002894f, 0, 0, rfjet_speedup_r ); - seibuspi_rise11_text_decrypt(memory_region(REGION_GFX1)); - seibuspi_rise11_bg_decrypt(memory_region(REGION_GFX2), memory_region_length(REGION_GFX2)); - seibuspi_rise11_sprite_decrypt(memory_region(REGION_GFX3), 0x800000); + seibuspi_rise11_text_decrypt(memory_region(machine, REGION_GFX1)); + seibuspi_rise11_bg_decrypt(memory_region(machine, REGION_GFX2), memory_region_length(machine, REGION_GFX2)); + seibuspi_rise11_sprite_decrypt(memory_region(machine, REGION_GFX3), 0x800000); memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x560, 0x563, 0, 0, sprite_dma_start_w); } diff --git a/src/mame/drivers/seta.c b/src/mame/drivers/seta.c index f63ca1a56c9..760c99acf8c 100644 --- a/src/mame/drivers/seta.c +++ b/src/mame/drivers/seta.c @@ -2808,7 +2808,7 @@ ADDRESS_MAP_END static WRITE8_HANDLER( sub_bankswitch_w ) { - UINT8 *rom = memory_region(REGION_CPU2); + UINT8 *rom = memory_region(machine, REGION_CPU2); int bank = data >> 4; memory_set_bankptr(1, &rom[bank * 0x4000 + 0xc000]); @@ -9347,7 +9347,7 @@ static DRIVER_INIT( arbalest ) static DRIVER_INIT( metafox ) { - UINT16 *RAM = (UINT16 *) memory_region(REGION_CPU1); + UINT16 *RAM = (UINT16 *) memory_region(machine, REGION_CPU1); /* This game uses the 21c000-21ffff area for protection? */ // memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x21c000, 0x21ffff, 0, 0, SMH_NOP, SMH_NOP); @@ -9370,7 +9370,7 @@ static DRIVER_INIT ( blandia ) rom_size = 0x80000; buf = malloc_or_die(rom_size); - rom = memory_region(REGION_GFX2) + 0x40000; + rom = memory_region(machine, REGION_GFX2) + 0x40000; for (rpos = 0; rpos < rom_size/2; rpos++) { buf[rpos+0x40000] = rom[rpos*2]; @@ -9379,7 +9379,7 @@ static DRIVER_INIT ( blandia ) memcpy( rom, buf, rom_size ); - rom = memory_region(REGION_GFX3) + 0x40000; + rom = memory_region(machine, REGION_GFX3) + 0x40000; for (rpos = 0; rpos < rom_size/2; rpos++) { buf[rpos+0x40000] = rom[rpos*2]; @@ -9407,7 +9407,7 @@ static DRIVER_INIT( zombraid ) static DRIVER_INIT( kiwame ) { - UINT16 *RAM = (UINT16 *) memory_region(REGION_CPU1); + UINT16 *RAM = (UINT16 *) memory_region(machine, REGION_CPU1); /* WARNING: This game writes to the interrupt vector table. Lev 1 routine address is stored at $100 */ @@ -9429,8 +9429,8 @@ static DRIVER_INIT(wiggie) UINT8 temp[16]; int i,j; - src = memory_region(REGION_CPU1); - len = memory_region_length(REGION_CPU1); + src = memory_region(machine, REGION_CPU1); + len = memory_region_length(machine, REGION_CPU1); for (i = 0;i < len;i += 16) { memcpy(temp,&src[i],16); @@ -9460,7 +9460,7 @@ static DRIVER_INIT(wiggie) static DRIVER_INIT( crazyfgt ) { // protection check at boot - UINT16 *RAM = (UINT16 *) memory_region(REGION_CPU1); + UINT16 *RAM = (UINT16 *) memory_region(machine, REGION_CPU1); RAM[0x1078/2] = 0x4e71; // fixed priorities? @@ -9500,7 +9500,7 @@ static const pia6821_interface inttoote_pia1_intf = static DRIVER_INIT( inttoote ) { - UINT16 *ROM = (UINT16 *)memory_region( REGION_CPU1 ); + UINT16 *ROM = (UINT16 *)memory_region( machine, REGION_CPU1 ); static UINT16 seta_vregs_unused[3] = {0,0,0}; // missing / unused video regs diff --git a/src/mame/drivers/seta2.c b/src/mame/drivers/seta2.c index 7a7fd35ef77..8a58cab6f96 100644 --- a/src/mame/drivers/seta2.c +++ b/src/mame/drivers/seta2.c @@ -425,8 +425,8 @@ static WRITE16_HANDLER( seta2_sound_bank_w ) { if (ACCESSING_BITS_0_7) { - UINT8 *ROM = memory_region( REGION_SOUND1 ); - int banks = (memory_region_length( REGION_SOUND1 ) - 0x100000) / 0x20000; + UINT8 *ROM = memory_region( machine, REGION_SOUND1 ); + int banks = (memory_region_length( machine, REGION_SOUND1 ) - 0x100000) / 0x20000; if (data >= banks) { logerror("CPU #0 PC %06X: invalid sound bank %04X\n",activecpu_get_pc(),data); @@ -681,7 +681,7 @@ ADDRESS_MAP_END static READ16_HANDLER( pzlbowl_protection_r ) { UINT32 address = (program_read_word(0x20ba16) << 16) | program_read_word(0x20ba18); - return memory_region(REGION_CPU1)[address - 2]; + return memory_region(machine, REGION_CPU1)[address - 2]; } static READ16_HANDLER( pzlbowl_coins_r ) diff --git a/src/mame/drivers/sf.c b/src/mame/drivers/sf.c index 2418ac7ce7e..2aa377b1334 100644 --- a/src/mame/drivers/sf.c +++ b/src/mame/drivers/sf.c @@ -176,7 +176,7 @@ static READ16_HANDLER( button2_r ) static WRITE8_HANDLER( sound2_bank_w ) { - memory_set_bankptr(1,memory_region(REGION_CPU3)+0x8000*(data+1)); + memory_set_bankptr(1,memory_region(machine, REGION_CPU3)+0x8000*(data+1)); } diff --git a/src/mame/drivers/sg1000a.c b/src/mame/drivers/sg1000a.c index 5d3074a0022..f82528d754b 100644 --- a/src/mame/drivers/sg1000a.c +++ b/src/mame/drivers/sg1000a.c @@ -325,7 +325,7 @@ static DRIVER_INIT( sg1000a ) static DRIVER_INIT(chwrestl) { DRIVER_INIT_CALL(sg1000a); - regulus_decode(); + regulus_decode(machine); } /************************************* diff --git a/src/mame/drivers/shangha3.c b/src/mame/drivers/shangha3.c index 95bb5535be7..5e0215aa93f 100644 --- a/src/mame/drivers/shangha3.c +++ b/src/mame/drivers/shangha3.c @@ -67,7 +67,7 @@ logerror("PC %04x: write %02x to 20004e\n",activecpu_get_pc(),data); static READ16_HANDLER( heberpop_gfxrom_r ) { - UINT8 *ROM = memory_region(REGION_GFX1); + UINT8 *ROM = memory_region(machine, REGION_GFX1); return ROM[2*offset] | (ROM[2*offset+1] << 8); } diff --git a/src/mame/drivers/shangkid.c b/src/mame/drivers/shangkid.c index 7f6c7cedf52..be5e8888443 100644 --- a/src/mame/drivers/shangkid.c +++ b/src/mame/drivers/shangkid.c @@ -172,8 +172,8 @@ static DRIVER_INIT( shangkid ) shangkid_gfx_type = 1; /* set up banking */ - memory_configure_bank(1, 0, 2, memory_region(REGION_CPU1) + 0x8000, 0x8000); - memory_configure_bank(2, 0, 2, memory_region(REGION_CPU3) + 0x0000, 0x10000); + memory_configure_bank(1, 0, 2, memory_region(machine, REGION_CPU1) + 0x8000, 0x8000); + memory_configure_bank(2, 0, 2, memory_region(machine, REGION_CPU3) + 0x0000, 0x10000); } /***************************************************************************************/ diff --git a/src/mame/drivers/shootout.c b/src/mame/drivers/shootout.c index 59b17246b9c..f317c8e8728 100644 --- a/src/mame/drivers/shootout.c +++ b/src/mame/drivers/shootout.c @@ -460,9 +460,9 @@ ROM_END static DRIVER_INIT( shootout ) { - int length = memory_region_length(REGION_CPU1); + int length = memory_region_length(machine, REGION_CPU1); UINT8 *decrypt = auto_malloc(length - 0x8000); - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); int A; memory_set_decrypted_region(0, 0x8000, 0xffff, decrypt); @@ -470,13 +470,13 @@ static DRIVER_INIT( shootout ) for (A = 0x8000;A < length;A++) decrypt[A-0x8000] = (rom[A] & 0x9f) | ((rom[A] & 0x40) >> 1) | ((rom[A] & 0x20) << 1); - memory_configure_bank(1, 0, 16, memory_region(REGION_CPU1) + 0x10000, 0x4000); + memory_configure_bank(1, 0, 16, memory_region(machine, REGION_CPU1) + 0x10000, 0x4000); memory_configure_bank_decrypted(1, 0, 16, decrypt + 0x8000, 0x4000); } static DRIVER_INIT( shootouj ) { - memory_configure_bank(1, 0, 16, memory_region(REGION_CPU1) + 0x10000, 0x4000); + memory_configure_bank(1, 0, 16, memory_region(machine, REGION_CPU1) + 0x10000, 0x4000); } diff --git a/src/mame/drivers/sidearms.c b/src/mame/drivers/sidearms.c index c01f4e7139b..87fddd09a03 100644 --- a/src/mame/drivers/sidearms.c +++ b/src/mame/drivers/sidearms.c @@ -59,7 +59,7 @@ int sidearms_gameid; static WRITE8_HANDLER( sidearms_bankswitch_w ) { int bankaddress; - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); /* bits 0 and 1 select the ROM bank */ @@ -166,7 +166,7 @@ ADDRESS_MAP_END static WRITE8_HANDLER( whizz_bankswitch_w ) { int bankaddress; - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); int bank = 0; switch (data & 0xC0) diff --git a/src/mame/drivers/silkroad.c b/src/mame/drivers/silkroad.c index 080976f1a99..bd4005e7809 100644 --- a/src/mame/drivers/silkroad.c +++ b/src/mame/drivers/silkroad.c @@ -419,7 +419,7 @@ static DRIVER_INIT( silkroad ) verified as correct... problem with the original which the gfx hardware didn't care about? */ - UINT8 *src = memory_region(REGION_GFX1)+0x1000000; + UINT8 *src = memory_region(machine, REGION_GFX1)+0x1000000; int len = 0x0200000; UINT8 *buffer; diff --git a/src/mame/drivers/simpl156.c b/src/mame/drivers/simpl156.c index c7a6ce06ee4..de10736ed56 100644 --- a/src/mame/drivers/simpl156.c +++ b/src/mame/drivers/simpl156.c @@ -550,8 +550,8 @@ MACHINE_DRIVER_END static DRIVER_INIT(simpl156) { - UINT8 *rom = memory_region(REGION_SOUND2); - int length = memory_region_length(REGION_SOUND2); + UINT8 *rom = memory_region(machine, REGION_SOUND2); + int length = memory_region_length(machine, REGION_SOUND2); UINT8 *buf1 = malloc_or_die(length); UINT32 x; @@ -575,8 +575,8 @@ static DRIVER_INIT(simpl156) free (buf1); - deco56_decrypt(REGION_GFX1); - deco156_decrypt(); + deco56_decrypt(machine, REGION_GFX1); + deco156_decrypt(machine); simpl156_default_eeprom = NULL; } diff --git a/src/mame/drivers/skullxbo.c b/src/mame/drivers/skullxbo.c index 48fb0cdb63f..13741551c23 100644 --- a/src/mame/drivers/skullxbo.c +++ b/src/mame/drivers/skullxbo.c @@ -619,7 +619,7 @@ static DRIVER_INIT( skullxbo ) { atarigen_eeprom_default = NULL; atarijsa_init(machine, "FF5802", 0x0080); - memset(memory_region(REGION_GFX1) + 0x170000, 0, 0x20000); + memset(memory_region(machine, REGION_GFX1) + 0x170000, 0, 0x20000); } diff --git a/src/mame/drivers/skyfox.c b/src/mame/drivers/skyfox.c index b465848ad00..788ade61383 100644 --- a/src/mame/drivers/skyfox.c +++ b/src/mame/drivers/skyfox.c @@ -415,8 +415,8 @@ ROM_END /* Untangle the graphics: cut each 32x32x8 tile in 16 8x8x8 tiles */ static DRIVER_INIT( skyfox ) { - UINT8 *RAM = memory_region(REGION_GFX1); - UINT8 *end = RAM + memory_region_length(REGION_GFX1); + UINT8 *RAM = memory_region(machine, REGION_GFX1); + UINT8 *end = RAM + memory_region_length(machine, REGION_GFX1); UINT8 buf[32*32]; while (RAM < end) diff --git a/src/mame/drivers/skykid.c b/src/mame/drivers/skykid.c index 848e595fe0d..e799ab042fa 100644 --- a/src/mame/drivers/skykid.c +++ b/src/mame/drivers/skykid.c @@ -106,7 +106,7 @@ static WRITE8_HANDLER( skykid_irq_2_ctrl_w ) static MACHINE_START( skykid ) { /* configure the banks */ - memory_configure_bank(1, 0, 2, memory_region(REGION_CPU1) + 0x10000, 0x2000); + memory_configure_bank(1, 0, 2, memory_region(machine, REGION_CPU1) + 0x10000, 0x2000); state_save_register_global(inputport_selected); } @@ -646,7 +646,7 @@ static DRIVER_INIT( skykid ) int i; /* unpack the third sprite ROM */ - rom = memory_region(REGION_GFX3) + 0x4000; + rom = memory_region(machine, REGION_GFX3) + 0x4000; for (i = 0;i < 0x2000;i++) { rom[i + 0x4000] = rom[i]; // sprite set #1, plane 3 diff --git a/src/mame/drivers/slapshot.c b/src/mame/drivers/slapshot.c index 40ce763585e..45931fbc185 100644 --- a/src/mame/drivers/slapshot.c +++ b/src/mame/drivers/slapshot.c @@ -226,14 +226,14 @@ static WRITE16_HANDLER( opwolf3_adc_req_w ) static INT32 banknum = -1; -static void reset_sound_region(void) +static void reset_sound_region(running_machine *machine) { - memory_set_bankptr( 10, memory_region(REGION_CPU2) + (banknum * 0x4000) + 0x10000 ); + memory_set_bankptr( 10, memory_region(machine, REGION_CPU2) + (banknum * 0x4000) + 0x10000 ); } static STATE_POSTLOAD( slapshot_postload ) { - reset_sound_region(); + reset_sound_region(machine); } static MACHINE_START( slapshot ) @@ -246,7 +246,7 @@ static MACHINE_START( slapshot ) static WRITE8_HANDLER( sound_bankswitch_w ) { banknum = (data - 1) & 7; - reset_sound_region(); + reset_sound_region(machine); } static WRITE16_HANDLER( slapshot_msb_sound_w ) @@ -727,8 +727,8 @@ ROM_END static DRIVER_INIT( slapshot ) { UINT32 offset,i; - UINT8 *gfx = memory_region(REGION_GFX2); - int size=memory_region_length(REGION_GFX2); + UINT8 *gfx = memory_region(machine, REGION_GFX2); + int size=memory_region_length(machine, REGION_GFX2); int data; timekeeper_init( 0, TIMEKEEPER_MK48T08, NULL ); diff --git a/src/mame/drivers/sliver.c b/src/mame/drivers/sliver.c index be5243cbe94..76520cb2aeb 100644 --- a/src/mame/drivers/sliver.c +++ b/src/mame/drivers/sliver.c @@ -253,10 +253,10 @@ static WRITE16_HANDLER( fifo_data_w ) } } -static void blit_gfx(void) +static void blit_gfx(running_machine *machine) { int tmpptr=0; - const UINT8 *rom = memory_region(REGION_USER1); + const UINT8 *rom = memory_region(machine, REGION_USER1); while(tmpptr<fptr) { @@ -295,7 +295,7 @@ static WRITE16_HANDLER( fifo_clear_w ) static WRITE16_HANDLER( fifo_flush_w ) { - blit_gfx(); + blit_gfx(machine); } @@ -304,7 +304,7 @@ static WRITE16_HANDLER( jpeg1_w ) COMBINE_DATA(&jpeg1); } -static void render_jpeg(void) +static void render_jpeg(running_machine *machine) { int x,y; int addr=jpeg_addr; @@ -315,7 +315,7 @@ static void render_jpeg(void) { return; } - rom = memory_region(REGION_USER3); + rom = memory_region(machine, REGION_USER3); for (y=0;y<jpeg_h;y++) { for (x=0;x<jpeg_w;x++) @@ -351,7 +351,7 @@ static WRITE16_HANDLER( jpeg2_w ) jpeg_addr=gfxlookup[idx][0]; jpeg_w=gfxlookup[idx][2]; jpeg_h=gfxlookup[idx][3]; - render_jpeg(); + render_jpeg(machine); } else { @@ -379,7 +379,7 @@ static WRITE16_HANDLER(io_data_w) { jpeg_x=tmpx; jpeg_y=tmpy; - render_jpeg(); + render_jpeg(machine); } } else @@ -426,7 +426,7 @@ ADDRESS_MAP_END static WRITE8_HANDLER(oki_setbank) { - UINT8 *sound = memory_region(REGION_SOUND1); + UINT8 *sound = memory_region(machine, REGION_SOUND1); int bank=(data^0xff)&3; //xor or not ? memcpy(sound+0x20000, sound+0x100000+0x20000*bank, 0x20000); } diff --git a/src/mame/drivers/snk.c b/src/mame/drivers/snk.c index 8893c0878e2..751092e9751 100644 --- a/src/mame/drivers/snk.c +++ b/src/mame/drivers/snk.c @@ -4376,7 +4376,7 @@ static const SNK_INPUT_PORT_TYPE tdfever_io[SNK_MAX_INPUT_PORTS] = { }; static DRIVER_INIT( ikari ){ - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); /* Hack ROM test */ RAM[0x11a6] = 0x00; RAM[0x11a7] = 0x00; @@ -4395,7 +4395,7 @@ static DRIVER_INIT( ikari ){ } static DRIVER_INIT( ikarijp ){ - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); RAM[0x190b] = 0xc9; /* faster test */ snk_sound_busy_bit = 0x20; @@ -4406,7 +4406,7 @@ static DRIVER_INIT( ikarijp ){ } static DRIVER_INIT( ikarijpb ){ - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); RAM[0x190b] = 0xc9; /* faster test */ snk_sound_busy_bit = 0x20; @@ -4417,7 +4417,7 @@ static DRIVER_INIT( ikarijpb ){ } static DRIVER_INIT( victroad ){ - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); /* Hack ROM test */ RAM[0x17bd] = 0x00; RAM[0x17be] = 0x00; @@ -4436,7 +4436,7 @@ static DRIVER_INIT( victroad ){ } static DRIVER_INIT( dogosoke ){ - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); /* Hack ROM test */ RAM[0x179f] = 0x00; RAM[0x17a0] = 0x00; @@ -4489,7 +4489,7 @@ static DRIVER_INIT( choppera ){ } static DRIVER_INIT( bermudat ){ - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); // Patch "Turbo Error" RAM[0x127e] = 0xc9; diff --git a/src/mame/drivers/snk68.c b/src/mame/drivers/snk68.c index fce93653dba..ce728ed7208 100644 --- a/src/mame/drivers/snk68.c +++ b/src/mame/drivers/snk68.c @@ -1196,7 +1196,7 @@ ROM_END static DRIVER_INIT( searchar ) { - memory_set_bankptr(1, memory_region(REGION_USER1)); + memory_set_bankptr(1, memory_region(machine, REGION_USER1)); } /******************************************************************************/ diff --git a/src/mame/drivers/snowbros.c b/src/mame/drivers/snowbros.c index f4f7dc8d86b..fa32466f652 100644 --- a/src/mame/drivers/snowbros.c +++ b/src/mame/drivers/snowbros.c @@ -409,7 +409,7 @@ static READ16_HANDLER( sb3_sound_r ) return 0x0003; } -static void sb3_play_music(int data) +static void sb3_play_music(running_machine *machine, int data) { UINT8 *snd; @@ -420,13 +420,13 @@ static void sb3_play_music(int data) { case 0x23: case 0x26: - snd = memory_region(REGION_SOUND1); + snd = memory_region(machine, REGION_SOUND1); memcpy(snd+0x20000, snd+0x80000+0x00000, 0x20000); sb3_music_is_playing = 1; break; case 0x24: - snd = memory_region(REGION_SOUND1); + snd = memory_region(machine, REGION_SOUND1); memcpy(snd+0x20000, snd+0x80000+0x20000, 0x20000); sb3_music_is_playing = 1; break; @@ -439,7 +439,7 @@ static void sb3_play_music(int data) case 0x2b: case 0x2c: case 0x2d: - snd = memory_region(REGION_SOUND1); + snd = memory_region(machine, REGION_SOUND1); memcpy(snd+0x20000, snd+0x80000+0x40000, 0x20000); sb3_music_is_playing = 1; break; @@ -491,7 +491,7 @@ static WRITE16_HANDLER( sb3_sound_w ) if (data>=0x22 && data<=0x31) { - sb3_play_music(data); + sb3_play_music(machine, data); } if ((data>=0x30) && (data<=0x51)) @@ -501,7 +501,7 @@ static WRITE16_HANDLER( sb3_sound_w ) if (data>=0x52 && data<=0x5f) { - sb3_play_music(data-0x30); + sb3_play_music(machine, data-0x30); } } @@ -1534,7 +1534,7 @@ static const struct YM2151interface ym2151_interface = static MACHINE_RESET (semiprot) { - UINT16 *PROTDATA = (UINT16*)memory_region(REGION_USER1); + UINT16 *PROTDATA = (UINT16*)memory_region(machine, REGION_USER1); int i; for (i = 0;i < 0x200/2;i++) @@ -1543,7 +1543,7 @@ static MACHINE_RESET (semiprot) static MACHINE_RESET (finalttr) { - UINT16 *PROTDATA = (UINT16*)memory_region(REGION_USER1); + UINT16 *PROTDATA = (UINT16*)memory_region(machine, REGION_USER1); int i; for (i = 0;i < 0x200/2;i++) @@ -2306,7 +2306,7 @@ static READ16_HANDLER ( moremorp_0a_read ) static DRIVER_INIT( moremorp ) { -// UINT16 *PROTDATA = (UINT16*)memory_region(REGION_USER1); +// UINT16 *PROTDATA = (UINT16*)memory_region(machine, REGION_USER1); // int i; // for (i = 0;i < 0x200/2;i++) @@ -2319,8 +2319,8 @@ static DRIVER_INIT( moremorp ) static DRIVER_INIT( cookbib2 ) { -// UINT16 *HCROM = (UINT16*)memory_region(REGION_CPU1); -// UINT16 *PROTDATA = (UINT16*)memory_region(REGION_USER1); +// UINT16 *HCROM = (UINT16*)memory_region(machine, REGION_CPU1); +// UINT16 *PROTDATA = (UINT16*)memory_region(machine, REGION_USER1); // int i; // hyperpac_ram[0xf000/2] = 0x46fc; // hyperpac_ram[0xf002/2] = 0x2700; @@ -2682,8 +2682,8 @@ static READ16_HANDLER ( _4in1_02_read ) static DRIVER_INIT(4in1boot) { UINT8 *buffer; - UINT8 *src = memory_region(REGION_CPU1); - int len = memory_region_length(REGION_CPU1); + UINT8 *src = memory_region(machine, REGION_CPU1); + int len = memory_region_length(machine, REGION_CPU1); /* strange order */ buffer = malloc_or_die(len); @@ -2697,8 +2697,8 @@ static DRIVER_INIT(4in1boot) free(buffer); } - src = memory_region(REGION_CPU2); - len = memory_region_length(REGION_CPU2); + src = memory_region(machine, REGION_CPU2); + len = memory_region_length(machine, REGION_CPU2); /* strange order */ buffer = malloc_or_die(len); @@ -2715,8 +2715,8 @@ static DRIVER_INIT(4in1boot) static DRIVER_INIT(snowbro3) { UINT8 *buffer; - UINT8 *src = memory_region(REGION_CPU1); - int len = memory_region_length(REGION_CPU1); + UINT8 *src = memory_region(machine, REGION_CPU1); + int len = memory_region_length(machine, REGION_CPU1); /* strange order */ buffer = malloc_or_die(len); diff --git a/src/mame/drivers/spdodgeb.c b/src/mame/drivers/spdodgeb.c index d6a45edae51..5490c10699b 100644 --- a/src/mame/drivers/spdodgeb.c +++ b/src/mame/drivers/spdodgeb.c @@ -92,7 +92,7 @@ static void spd_adpcm_int(running_machine *machine, int chip) } else { - UINT8 *ROM = memory_region(REGION_SOUND1) + 0x10000 * chip; + UINT8 *ROM = memory_region(machine, REGION_SOUND1) + 0x10000 * chip; adpcm_data[chip] = ROM[adpcm_pos[chip]++]; MSM5205_data_w(chip,adpcm_data[chip] >> 4); diff --git a/src/mame/drivers/speedspn.c b/src/mame/drivers/speedspn.c index 4813d7c722a..52910179f9a 100644 --- a/src/mame/drivers/speedspn.c +++ b/src/mame/drivers/speedspn.c @@ -75,7 +75,7 @@ static WRITE8_HANDLER(speedspn_banked_rom_change) { /* is this weird banking some form of protection? */ - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); int addr; switch (data) diff --git a/src/mame/drivers/spiders.c b/src/mame/drivers/spiders.c index 1e929d41f9a..594d724548e 100644 --- a/src/mame/drivers/spiders.c +++ b/src/mame/drivers/spiders.c @@ -540,7 +540,7 @@ static READ8_HANDLER( gfx_rom_r ) if (gfx_rom_ctrl_mode) { - UINT8 *rom = memory_region(REGION_GFX1); + UINT8 *rom = memory_region(machine, REGION_GFX1); ret = rom[gfx_rom_address]; diff --git a/src/mame/drivers/splash.c b/src/mame/drivers/splash.c index 8bf13093806..d56700f42d7 100644 --- a/src/mame/drivers/splash.c +++ b/src/mame/drivers/splash.c @@ -903,7 +903,7 @@ static DRIVER_INIT( roldfrog ) static DRIVER_INIT( rebus ) { - UINT16 *ROM = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *ROM = (UINT16 *)memory_region(machine, REGION_CPU1); splash_bitmap_type = 1; splash_sprite_attr2_shift = 0; @@ -931,7 +931,7 @@ static DRIVER_INIT( rebus ) static DRIVER_INIT( funystrp ) { - UINT16 *ROM = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *ROM = (UINT16 *)memory_region(machine, REGION_CPU1); splash_bitmap_type = 0; splash_sprite_attr2_shift = 0; diff --git a/src/mame/drivers/sprcros2.c b/src/mame/drivers/sprcros2.c index 4b70bb85a59..7af4f184e57 100644 --- a/src/mame/drivers/sprcros2.c +++ b/src/mame/drivers/sprcros2.c @@ -85,7 +85,7 @@ static WRITE8_HANDLER( sprcros2_sharedram_w ) static WRITE8_HANDLER( sprcros2_m_port7_w ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); //76543210 //x------- unused @@ -106,7 +106,7 @@ static WRITE8_HANDLER( sprcros2_m_port7_w ) static WRITE8_HANDLER( sprcros2_s_port3_w ) { - UINT8 *RAM = memory_region(REGION_CPU2); + UINT8 *RAM = memory_region(machine, REGION_CPU2); //76543210 //xxxx---- unused diff --git a/src/mame/drivers/spy.c b/src/mame/drivers/spy.c index 32f39ffe203..8abdfa7a70a 100644 --- a/src/mame/drivers/spy.c +++ b/src/mame/drivers/spy.c @@ -153,7 +153,7 @@ this is the data written to internal ram on startup: static WRITE8_HANDLER( bankswitch_w ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); int offs; /* bit 0 = RAM bank? */ @@ -649,8 +649,8 @@ static void gfx_untangle(void) static DRIVER_INIT( spy ) { - paletteram = &memory_region(REGION_CPU1)[0x28000]; - pmcram = &memory_region(REGION_CPU1)[0x28800]; + paletteram = &memory_region(machine, REGION_CPU1)[0x28000]; + pmcram = &memory_region(machine, REGION_CPU1)[0x28800]; gfx_untangle(); } diff --git a/src/mame/drivers/srmp2.c b/src/mame/drivers/srmp2.c index d7d72e9cb6f..62022425ce0 100644 --- a/src/mame/drivers/srmp2.c +++ b/src/mame/drivers/srmp2.c @@ -104,7 +104,7 @@ static INTERRUPT_GEN( srmp2_interrupt ) static DRIVER_INIT( srmp2 ) { - UINT16 *RAM = (UINT16 *) memory_region(REGION_CPU1); + UINT16 *RAM = (UINT16 *) memory_region(machine, REGION_CPU1); /* Fix "ERROR BACK UP" and "ERROR IOX" */ RAM[0x20c80 / 2] = 0x4e75; // RTS @@ -112,7 +112,7 @@ static DRIVER_INIT( srmp2 ) static DRIVER_INIT( srmp3 ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); /* BANK ROM (0x08000 - 0x1ffff) Check skip [MAIN ROM side] */ RAM[0x00000 + 0x7b69] = 0x00; // NOP @@ -198,7 +198,7 @@ static WRITE16_HANDLER( srmp2_adpcm_code_w ) table and plays the ADPCM for itself. */ - UINT8 *ROM = memory_region(REGION_SOUND1); + UINT8 *ROM = memory_region(machine, REGION_SOUND1); srmp2_adpcm_sptr = (ROM[((srmp2_adpcm_bank * 0x10000) + (data << 2) + 0)] << 8); srmp2_adpcm_eptr = (ROM[((srmp2_adpcm_bank * 0x10000) + (data << 2) + 1)] << 8); @@ -221,7 +221,7 @@ static WRITE8_HANDLER( srmp3_adpcm_code_w ) table and plays the ADPCM for itself. */ - UINT8 *ROM = memory_region(REGION_SOUND1); + UINT8 *ROM = memory_region(machine, REGION_SOUND1); srmp2_adpcm_sptr = (ROM[((srmp2_adpcm_bank * 0x10000) + (data << 2) + 0)] << 8); srmp2_adpcm_eptr = (ROM[((srmp2_adpcm_bank * 0x10000) + (data << 2) + 1)] << 8); @@ -237,7 +237,7 @@ static WRITE8_HANDLER( srmp3_adpcm_code_w ) static void srmp2_adpcm_int(running_machine *machine, int num) { - UINT8 *ROM = memory_region(REGION_SOUND1); + UINT8 *ROM = memory_region(machine, REGION_SOUND1); if (srmp2_adpcm_sptr) { @@ -365,7 +365,7 @@ static WRITE8_HANDLER( srmp3_rombank_w ) xxx- ---- : ADPCM ROM bank */ - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); int addr; srmp2_adpcm_bank = ((data & 0xe0) >> 5); diff --git a/src/mame/drivers/srmp5.c b/src/mame/drivers/srmp5.c index 1ede7f487e1..acf3442df61 100644 --- a/src/mame/drivers/srmp5.c +++ b/src/mame/drivers/srmp5.c @@ -157,7 +157,7 @@ static WRITE32_HANDLER(spr_w) static READ32_HANDLER(data_r) { UINT32 data; - const UINT8 *usr = memory_region(REGION_USER2); + const UINT8 *usr = memory_region(machine, REGION_USER2); data=((databank>>4)&0xf)*0x100000; //guess data=usr[data+offset*2]+usr[data+offset*2+1]*256; return data|(data<<16); diff --git a/src/mame/drivers/srmp6.c b/src/mame/drivers/srmp6.c index da29b882d8c..e5a7d59e5cf 100644 --- a/src/mame/drivers/srmp6.c +++ b/src/mame/drivers/srmp6.c @@ -341,7 +341,7 @@ static WRITE16_HANDLER( video_regs_w ) case 0x5e/2: // bank switch, used by ROM check LOG(("%x\n",data)); - memory_set_bankptr(1,(UINT16 *)(memory_region(REGION_USER2) + (data & 0x0f)*0x200000)); + memory_set_bankptr(1,(UINT16 *)(memory_region(machine, REGION_USER2) + (data & 0x0f)*0x200000)); break; // set by IT4 @@ -424,7 +424,7 @@ static WRITE16_HANDLER(srmp6_dma_w) COMBINE_DATA(&dmaram[offset]); if(offset==13 && dmaram[offset]==0x40) { - const UINT8 *rom = memory_region(REGION_USER2); + const UINT8 *rom = memory_region(machine, REGION_USER2); UINT32 srctab=2*((((UINT32)dmaram[5])<<16)|dmaram[4]); UINT32 srcdata=2*((((UINT32)dmaram[11])<<16)|dmaram[10]); UINT32 len=4*(((((UINT32)dmaram[7]&3)<<16)|dmaram[6])+1); //??? WRONG! diff --git a/src/mame/drivers/srumbler.c b/src/mame/drivers/srumbler.c index 7b64e7f885a..9dc53fcc2c6 100644 --- a/src/mame/drivers/srumbler.c +++ b/src/mame/drivers/srumbler.c @@ -37,9 +37,9 @@ static WRITE8_HANDLER( srumbler_bankswitch_w ) that as well to be 100% accurate. */ int i; - UINT8 *ROM = memory_region(REGION_USER1); - UINT8 *prom1 = memory_region(REGION_PROMS) + (data & 0xf0); - UINT8 *prom2 = memory_region(REGION_PROMS) + 0x100 + ((data & 0x0f) << 4); + UINT8 *ROM = memory_region(machine, REGION_USER1); + UINT8 *prom1 = memory_region(machine, REGION_PROMS) + (data & 0xf0); + UINT8 *prom2 = memory_region(machine, REGION_PROMS) + 0x100 + ((data & 0x0f) << 4); for (i = 0x05;i < 0x10;i++) { diff --git a/src/mame/drivers/ssf2md.c b/src/mame/drivers/ssf2md.c index 7ab9c810aee..e42f690c481 100644 --- a/src/mame/drivers/ssf2md.c +++ b/src/mame/drivers/ssf2md.c @@ -21,7 +21,7 @@ static DRIVER_INIT( ssf2ghw ) memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xA130F0, 0xA130FF, 0, 0, SMH_NOP); // custom banking is disabled (!) memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x400000, 0x5fffff, 0, 0, SMH_BANK5, SMH_UNMAP); - memory_set_bankptr( 5, memory_region( REGION_CPU1 )+0x400000 ); + memory_set_bankptr( 5, memory_region( machine, REGION_CPU1 )+0x400000 ); memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x770070, 0x770075, 0, 0, ssf2ghw_dsw_r ); diff --git a/src/mame/drivers/ssfindo.c b/src/mame/drivers/ssfindo.c index d5085920b5d..967a6ae345b 100644 --- a/src/mame/drivers/ssfindo.c +++ b/src/mame/drivers/ssfindo.c @@ -422,7 +422,7 @@ static WRITE32_HANDLER(PS7500_IO_w) static READ32_HANDLER(io_r) { - UINT16 *FLASH = (UINT16 *)memory_region(REGION_USER2); //16 bit - WORD access + UINT16 *FLASH = (UINT16 *)memory_region(machine, REGION_USER2); //16 bit - WORD access int adr=flashAdr*0x200+(flashOffset); diff --git a/src/mame/drivers/sshangha.c b/src/mame/drivers/sshangha.c index b43b1046813..4de45bfe7b4 100644 --- a/src/mame/drivers/sshangha.c +++ b/src/mame/drivers/sshangha.c @@ -432,7 +432,7 @@ static DRIVER_INIT( sshangha ) #if SSHANGHA_HACK /* This is a hack to allow you to use the extra features of the first "Unused" Dip Switch (see notes above). */ - UINT16 *RAM = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *RAM = (UINT16 *)memory_region(machine, REGION_CPU1); RAM[0x000384/2] = 0x4e71; RAM[0x000386/2] = 0x4e71; RAM[0x000388/2] = 0x4e71; diff --git a/src/mame/drivers/ssingles.c b/src/mame/drivers/ssingles.c index 78e8954fb49..f482ad28267 100644 --- a/src/mame/drivers/ssingles.c +++ b/src/mame/drivers/ssingles.c @@ -52,7 +52,7 @@ static MC6845_UPDATE_ROW( update_row ) UINT32 tile_address; UINT16 cell,palette; UINT8 b0,b1; - const UINT8 *gfx = memory_region(REGION_GFX1); + const UINT8 *gfx = memory_region(device->machine, REGION_GFX1); for(cx=0;cx<x_count;++cx) { diff --git a/src/mame/drivers/ssrj.c b/src/mame/drivers/ssrj.c index 98c52858d30..92192eaa6af 100644 --- a/src/mame/drivers/ssrj.c +++ b/src/mame/drivers/ssrj.c @@ -49,7 +49,7 @@ static int oldport=0x80; static MACHINE_RESET(ssrj) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); memset(&rom[0xc000],0,0x3fff); /* req for some control types */ oldport=0x80; } diff --git a/src/mame/drivers/sstrangr.c b/src/mame/drivers/sstrangr.c index b4ea3bb2e13..15fe9917bb6 100644 --- a/src/mame/drivers/sstrangr.c +++ b/src/mame/drivers/sstrangr.c @@ -80,7 +80,7 @@ static VIDEO_UPDATE( sstrngr2 ) get_pens(pens); - color_map_base = &memory_region(REGION_PROMS)[sstrngr_flip_screen ? 0x0000 : 0x0200]; + color_map_base = &memory_region(screen->machine, REGION_PROMS)[sstrngr_flip_screen ? 0x0000 : 0x0200]; for (offs = 0; offs < sstrngr_ram_size; offs++) { diff --git a/src/mame/drivers/ssv.c b/src/mame/drivers/ssv.c index d419810f55f..6f9fd26d253 100644 --- a/src/mame/drivers/ssv.c +++ b/src/mame/drivers/ssv.c @@ -338,7 +338,7 @@ static MACHINE_RESET( ssv ) { requested_int = 0; cpunum_set_irq_callback(0, ssv_irq_callback); - memory_set_bankptr(1, memory_region(REGION_USER1)); + memory_set_bankptr(1, memory_region(machine, REGION_USER1)); } @@ -579,8 +579,8 @@ static WRITE16_HANDLER( gdfs_blitram_w ) UINT32 dst = (gdfs_blitram[0xc4/2] + (gdfs_blitram[0xc6/2] << 16)) << 4; UINT32 len = (gdfs_blitram[0xc8/2]) << 4; - UINT8 *rom = memory_region(REGION_GFX2); - size_t size = memory_region_length(REGION_GFX2); + UINT8 *rom = memory_region(machine, REGION_GFX2); + size_t size = memory_region_length(machine, REGION_GFX2); if ( (src+len <= size) && (dst+len <= 4 * 0x100000) ) { @@ -1050,8 +1050,8 @@ static UINT8 trackball_select, gfxrom_select; static READ16_HANDLER( eaglshot_gfxrom_r ) { - UINT8 *rom = memory_region(REGION_GFX1); - size_t size = memory_region_length(REGION_GFX1); + UINT8 *rom = memory_region(machine, REGION_GFX1); + size_t size = memory_region_length(machine, REGION_GFX1); offset = offset * 2 + gfxrom_select * 0x200000; @@ -2752,7 +2752,7 @@ static DRIVER_INIT( ryorioh ) { init_ssv(); static DRIVER_INIT( srmp4 ) { init_ssv(); ssv_sprites_offsx = -8; ssv_sprites_offsy = +0xf0; ssv_tilemap_offsx = +0; ssv_tilemap_offsy = -0xf0; -// ((UINT16 *)memory_region(REGION_USER1))[0x2b38/2] = 0x037a; /* patch to see gal test mode */ +// ((UINT16 *)memory_region(machine, REGION_USER1))[0x2b38/2] = 0x037a; /* patch to see gal test mode */ } static DRIVER_INIT( srmp7 ) { init_ssv(); ssv_sprites_offsx = +0; ssv_sprites_offsy = -0xf; diff --git a/src/mame/drivers/st0016.c b/src/mame/drivers/st0016.c index a3e4984575d..ac8c323f950 100644 --- a/src/mame/drivers/st0016.c +++ b/src/mame/drivers/st0016.c @@ -62,7 +62,7 @@ static WRITE8_HANDLER(mux_select_w) WRITE8_HANDLER(st0016_rom_bank_w) { - memory_set_bankptr( 1, memory_region(REGION_CPU1) + (data* 0x4000) + 0x10000 ); + memory_set_bankptr( 1, memory_region(machine, REGION_CPU1) + (data* 0x4000) + 0x10000 ); st0016_rom_bank=data; } @@ -639,13 +639,13 @@ static DRIVER_INIT(nratechu) static DRIVER_INIT(mayjinsn) { st0016_game=4|0x80; - memory_set_bankptr(2, memory_region(REGION_USER1)); + memory_set_bankptr(2, memory_region(machine, REGION_USER1)); } static DRIVER_INIT(mayjisn2) { st0016_game=4; - memory_set_bankptr(2, memory_region(REGION_USER1)); + memory_set_bankptr(2, memory_region(machine, REGION_USER1)); } /************************************* diff --git a/src/mame/drivers/starwars.c b/src/mame/drivers/starwars.c index d642d0bac41..82351bc2ebc 100644 --- a/src/mame/drivers/starwars.c +++ b/src/mame/drivers/starwars.c @@ -556,17 +556,17 @@ static DRIVER_INIT( starwars ) /* prepare the mathbox */ starwars_is_esb = 0; - starwars_mproc_init(); + starwars_mproc_init(machine); /* initialize banking */ - memory_configure_bank(1, 0, 2, memory_region(REGION_CPU1) + 0x6000, 0x10000 - 0x6000); + memory_configure_bank(1, 0, 2, memory_region(machine, REGION_CPU1) + 0x6000, 0x10000 - 0x6000); memory_set_bank(1, 0); } static DRIVER_INIT( esb ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); /* X2212 nvram */ generic_nvram = auto_malloc(generic_nvram_size); @@ -587,7 +587,7 @@ static DRIVER_INIT( esb ) /* prepare the matrix processor */ starwars_is_esb = 1; - starwars_mproc_init(); + starwars_mproc_init(machine); /* initialize banking */ memory_configure_bank(1, 0, 2, rom + 0x6000, 0x10000 - 0x6000); diff --git a/src/mame/drivers/statriv2.c b/src/mame/drivers/statriv2.c index 0315ec71461..caa93d38c00 100644 --- a/src/mame/drivers/statriv2.c +++ b/src/mame/drivers/statriv2.c @@ -189,7 +189,7 @@ static WRITE8_HANDLER ( question_offset_high_w ) static READ8_HANDLER (statriv2_questions_read) { - UINT8 *question_data = memory_region ( REGION_USER1 ); + UINT8 *question_data = memory_region ( machine, REGION_USER1 ); int offs; question_offset_low++; @@ -261,7 +261,7 @@ static READ8_HANDLER (statriv2_questions_read) static READ8_HANDLER (supertr2_questions_read) { - UINT8 *question_data = memory_region( REGION_USER1 ); + UINT8 *question_data = memory_region( machine, REGION_USER1 ); int offs; int XORval; @@ -278,7 +278,7 @@ static READ8_HANDLER (supertr2_questions_read) static READ8_HANDLER (supertr3_questions_read) { - UINT8 *question_data = memory_region( REGION_USER1 ); + UINT8 *question_data = memory_region( machine, REGION_USER1 ); int offs; offs = (question_offset_high << 16) | (question_offset_med << 8) | question_offset_low; @@ -288,7 +288,7 @@ static READ8_HANDLER (supertr3_questions_read) static READ8_HANDLER (hangman_questions_read) { - UINT8 *question_data = memory_region( REGION_USER1 ); + UINT8 *question_data = memory_region( machine, REGION_USER1 ); int offs; offs = (question_offset_high << 16) | (question_offset_med << 8) | question_offset_low; diff --git a/src/mame/drivers/stv.c b/src/mame/drivers/stv.c index 08c41c198b1..a99be68c552 100644 --- a/src/mame/drivers/stv.c +++ b/src/mame/drivers/stv.c @@ -2468,7 +2468,7 @@ DRIVER_INIT ( stv ) #ifdef UNUSED_FUNCTION static void print_game_info(void) { - UINT8 *ROM = memory_region(REGION_USER1); + UINT8 *ROM = memory_region(machine, REGION_USER1); static FILE *print_file = NULL; UINT8 STR[0x100]; UINT32 src_i,dst_i; @@ -3717,7 +3717,7 @@ by Sega titles,and this is a Sunsoft game)It's likely to be a left-over... static DRIVER_INIT( sanjeon ) { - UINT8 *src = memory_region ( REGION_USER1 ); + UINT8 *src = memory_region ( machine, REGION_USER1 ); int x; for (x=0;x<0x3000000;x++) diff --git a/src/mame/drivers/stvinit.c b/src/mame/drivers/stvinit.c index 06b7f015022..ce51d6d267d 100644 --- a/src/mame/drivers/stvinit.c +++ b/src/mame/drivers/stvinit.c @@ -17,9 +17,9 @@ ODD (in every sense) bytes.This gets the IC-13 rom status to good and ends a emu weird issue once and for all... We need to remove this and add the whole thing into the ROM loading structure... */ -static void ic13_shifter(void) +static void ic13_shifter(running_machine *machine) { - UINT32 *rom = (UINT32 *)memory_region(REGION_USER1); + UINT32 *rom = (UINT32 *)memory_region(machine, REGION_USER1); UINT32 i; UINT32 *tmp = malloc_or_die(0x80000*2); @@ -67,7 +67,7 @@ static void ic13_shifter(void) DRIVER_INIT ( ic13 ) { - ic13_shifter(); + ic13_shifter(machine); DRIVER_INIT_CALL(stv); } /* diff --git a/src/mame/drivers/subs.c b/src/mame/drivers/subs.c index 9c4400ccdf7..bbcd6a6abdb 100644 --- a/src/mame/drivers/subs.c +++ b/src/mame/drivers/subs.c @@ -266,7 +266,7 @@ ROM_END static DRIVER_INIT( subs ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); int i; /* Merge nibble-wide roms together, diff --git a/src/mame/drivers/subsino.c b/src/mame/drivers/subsino.c index c97358e6119..f5955817153 100644 --- a/src/mame/drivers/subsino.c +++ b/src/mame/drivers/subsino.c @@ -693,12 +693,12 @@ ROM_END static DRIVER_INIT( smoto20 ) { - UINT8 *rom = memory_region( REGION_CPU1 ); + UINT8 *rom = memory_region( machine, REGION_CPU1 ); rom[0x12e1] = 0x20; // "ERROR 951010" } static DRIVER_INIT( smoto16 ) { - UINT8 *rom = memory_region( REGION_CPU1 ); + UINT8 *rom = memory_region( machine, REGION_CPU1 ); rom[0x12d0] = 0x20; // "ERROR 951010" } diff --git a/src/mame/drivers/suna16.c b/src/mame/drivers/suna16.c index c6233b911ab..de642389186 100644 --- a/src/mame/drivers/suna16.c +++ b/src/mame/drivers/suna16.c @@ -336,7 +336,7 @@ ADDRESS_MAP_END static WRITE8_HANDLER( bssoccer_pcm_1_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_CPU3); + UINT8 *RAM = memory_region(machine, REGION_CPU3); int bank = data & 7; if (bank & ~7) logerror("CPU#2 PC %06X - ROM bank unknown bits: %02X\n", activecpu_get_pc(), data); memory_set_bankptr(1, &RAM[bank * 0x10000 + 0x1000]); @@ -344,7 +344,7 @@ static WRITE8_HANDLER( bssoccer_pcm_1_bankswitch_w ) static WRITE8_HANDLER( bssoccer_pcm_2_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_CPU4); + UINT8 *RAM = memory_region(machine, REGION_CPU4); int bank = data & 7; if (bank & ~7) logerror("CPU#3 PC %06X - ROM bank unknown bits: %02X\n", activecpu_get_pc(), data); memory_set_bankptr(2, &RAM[bank * 0x10000 + 0x1000]); @@ -417,7 +417,7 @@ ADDRESS_MAP_END static WRITE8_HANDLER( uballoon_pcm_1_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_CPU3); + UINT8 *RAM = memory_region(machine, REGION_CPU3); int bank = data & 1; if (bank & ~1) logerror("CPU#2 PC %06X - ROM bank unknown bits: %02X\n", activecpu_get_pc(), data); memory_set_bankptr(1, &RAM[bank * 0x10000 + 0x400]); @@ -1201,7 +1201,7 @@ ROM_END static DRIVER_INIT( uballoon ) { - UINT16 *RAM = (UINT16 *) memory_region(REGION_CPU1); + UINT16 *RAM = (UINT16 *) memory_region(machine, REGION_CPU1); // Patch out the protection checks RAM[0x0113c/2] = 0x4e71; // bne $646 diff --git a/src/mame/drivers/suna8.c b/src/mame/drivers/suna8.c index ea4260f7250..759d04fa22f 100644 --- a/src/mame/drivers/suna8.c +++ b/src/mame/drivers/suna8.c @@ -85,7 +85,7 @@ void suna8_sh_start(void); static DRIVER_INIT( hardhead ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); int i; for (i = 0; i < 0x8000; i++) @@ -100,14 +100,14 @@ static DRIVER_INIT( hardhead ) rom[i] = BITSWAP8(rom[i], 7,6,5,3,4,2,1,0) ^ 0x58; } - memory_configure_bank(1, 0, 16, memory_region(REGION_CPU1) + 0x10000, 0x4000); + memory_configure_bank(1, 0, 16, memory_region(machine, REGION_CPU1) + 0x10000, 0x4000); } /* Non encrypted bootleg */ static DRIVER_INIT( hardhedb ) { - memory_set_decrypted_region(0, 0x0000, 0x7fff, memory_region(REGION_CPU1) + 0x48000); - memory_configure_bank(1, 0, 16, memory_region(REGION_CPU1) + 0x10000, 0x4000); + memory_set_decrypted_region(0, 0x0000, 0x7fff, memory_region(machine, REGION_CPU1) + 0x48000); + memory_configure_bank(1, 0, 16, memory_region(machine, REGION_CPU1) + 0x10000, 0x4000); } /*************************************************************************** @@ -116,10 +116,10 @@ static DRIVER_INIT( hardhedb ) /* !! BRICKZN3 !! */ -static UINT8 *brickzn_decrypt(void) +static UINT8 *brickzn_decrypt(running_machine *machine) { - UINT8 *RAM = memory_region(REGION_CPU1); - size_t size = memory_region_length(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); + size_t size = memory_region_length(machine, REGION_CPU1); UINT8 *decrypt = auto_malloc(size); int i; @@ -160,8 +160,8 @@ static UINT8 *brickzn_decrypt(void) static DRIVER_INIT( brickzn ) { - UINT8 *RAM = memory_region(REGION_CPU1); - UINT8 *decrypt = brickzn_decrypt(); + UINT8 *RAM = memory_region(machine, REGION_CPU1); + UINT8 *decrypt = brickzn_decrypt(machine); int i; // restore opcodes which for some reason shouldn't be decrypted... */ @@ -185,14 +185,14 @@ static DRIVER_INIT( brickzn ) decrypt[0x24b5] = 0x00; // HALT -> NOP decrypt[0x2583] = 0x00; // HALT -> NOP - memory_configure_bank(1, 0, 16, memory_region(REGION_CPU1) + 0x10000, 0x4000); + memory_configure_bank(1, 0, 16, memory_region(machine, REGION_CPU1) + 0x10000, 0x4000); memory_configure_bank_decrypted(1, 0, 16, decrypt + 0x10000, 0x4000); } static DRIVER_INIT( brickzn3 ) { - UINT8 *RAM = memory_region(REGION_CPU1); - UINT8 *decrypt = brickzn_decrypt(); + UINT8 *RAM = memory_region(machine, REGION_CPU1); + UINT8 *decrypt = brickzn_decrypt(machine); int i; // restore opcodes which for some reason shouldn't be decrypted... */ @@ -216,7 +216,7 @@ static DRIVER_INIT( brickzn3 ) decrypt[0x2487] = 0x00; // HALT -> NOP decrypt[0x256c] = 0x00; // HALT -> NOP - memory_configure_bank(1, 0, 16, memory_region(REGION_CPU1) + 0x10000, 0x4000); + memory_configure_bank(1, 0, 16, memory_region(machine, REGION_CPU1) + 0x10000, 0x4000); memory_configure_bank_decrypted(1, 0, 16, decrypt + 0x10000, 0x4000); } @@ -227,8 +227,8 @@ static DRIVER_INIT( brickzn3 ) static DRIVER_INIT( hardhea2 ) { - UINT8 *RAM = memory_region(REGION_CPU1); - size_t size = memory_region_length(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); + size_t size = memory_region_length(machine, REGION_CPU1); UINT8 *decrypt = auto_malloc(size); UINT8 x; int i; @@ -302,7 +302,7 @@ rom13: 0?, 1y, 2n, 3n ?,?,?,? (palettes) RAM[i] = BITSWAP8(RAM[i], 5,6,7,4,3,2,1,0) ^ 0x41; } - memory_configure_bank(1, 0, 16, memory_region(REGION_CPU1) + 0x10000, 0x4000); + memory_configure_bank(1, 0, 16, memory_region(machine, REGION_CPU1) + 0x10000, 0x4000); memory_configure_bank(2, 0, 2, auto_malloc(0x2000 * 2), 0x2000); } @@ -313,8 +313,8 @@ rom13: 0?, 1y, 2n, 3n ?,?,?,? (palettes) static DRIVER_INIT( starfigh ) { - UINT8 *RAM = memory_region(REGION_CPU1); - size_t size = memory_region_length(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); + size_t size = memory_region_length(machine, REGION_CPU1); UINT8 *decrypt = auto_malloc(size); UINT8 x; int i; @@ -370,7 +370,7 @@ static DRIVER_INIT( starfigh ) RAM[i] = BITSWAP8(RAM[i], 5,6,7,4,3,2,1,0) ^ 0x45; } - memory_configure_bank(1, 0, 16, memory_region(REGION_CPU1) + 0x10000, 0x4000); + memory_configure_bank(1, 0, 16, memory_region(machine, REGION_CPU1) + 0x10000, 0x4000); } @@ -380,8 +380,8 @@ static DRIVER_INIT( starfigh ) static DRIVER_INIT( sparkman ) { - UINT8 *RAM = memory_region(REGION_CPU1); - size_t size = memory_region_length(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); + size_t size = memory_region_length(machine, REGION_CPU1); UINT8 *decrypt = auto_malloc(size); UINT8 x; int i; @@ -437,7 +437,7 @@ static DRIVER_INIT( sparkman ) RAM[i] = BITSWAP8(RAM[i], 5,6,7,4,3,2,1,0) ^ 0x44; } - memory_configure_bank(1, 0, 16, memory_region(REGION_CPU1) + 0x10000, 0x4000); + memory_configure_bank(1, 0, 16, memory_region(machine, REGION_CPU1) + 0x10000, 0x4000); } /*************************************************************************** @@ -2400,7 +2400,7 @@ ROM_END static DRIVER_INIT( suna8 ) { - memory_configure_bank(1, 0, 16, memory_region(REGION_CPU1) + 0x10000, 0x4000); + memory_configure_bank(1, 0, 16, memory_region(machine, REGION_CPU1) + 0x10000, 0x4000); } /* Working Games */ diff --git a/src/mame/drivers/superchs.c b/src/mame/drivers/superchs.c index c133dc75914..0198a6dded3 100644 --- a/src/mame/drivers/superchs.c +++ b/src/mame/drivers/superchs.c @@ -369,7 +369,7 @@ GFXDECODE_END static MACHINE_RESET( superchs ) { - taito_f3_soundsystem_reset(); + taito_f3_soundsystem_reset(machine); f3_68681_reset(); } diff --git a/src/mame/drivers/superqix.c b/src/mame/drivers/superqix.c index 5a2dcabc3cd..154e447d90e 100644 --- a/src/mame/drivers/superqix.c +++ b/src/mame/drivers/superqix.c @@ -135,8 +135,8 @@ static INT16 *samplebuf; static void pbillian_sh_start(void) { - UINT8 *src = memory_region(REGION_SOUND1); - int i, len = memory_region_length(REGION_SOUND1); + UINT8 *src = memory_region(Machine, REGION_SOUND1); + int i, len = memory_region_length(Machine, REGION_SOUND1); /* convert 8-bit unsigned samples to 8-bit signed */ samplebuf = auto_malloc(len * 2); @@ -510,7 +510,7 @@ static void machine_init_common(void) static MACHINE_START( superqix ) { /* configure the banks */ - memory_configure_bank(1, 0, 4, memory_region(REGION_CPU1) + 0x10000, 0x4000); + memory_configure_bank(1, 0, 4, memory_region(machine, REGION_CPU1) + 0x10000, 0x4000); machine_init_common(); } @@ -518,7 +518,7 @@ static MACHINE_START( superqix ) static MACHINE_START( pbillian ) { /* configure the banks */ - memory_configure_bank(1, 0, 2, memory_region(REGION_CPU1) + 0x10000, 0x4000); + memory_configure_bank(1, 0, 2, memory_region(machine, REGION_CPU1) + 0x10000, 0x4000); machine_init_common(); } @@ -1304,8 +1304,8 @@ static DRIVER_INIT( perestro ) int i,j; /* decrypt program code; the address lines are shuffled around in a non-trivial way */ - src = memory_region(REGION_CPU1); - len = memory_region_length(REGION_CPU1); + src = memory_region(machine, REGION_CPU1); + len = memory_region_length(machine, REGION_CPU1); for (i = 0;i < len;i += 16) { memcpy(temp,&src[i],16); @@ -1324,8 +1324,8 @@ static DRIVER_INIT( perestro ) } /* decrypt gfx ROMs; simple bit swap on the address lines */ - src = memory_region(REGION_GFX1); - len = memory_region_length(REGION_GFX1); + src = memory_region(machine, REGION_GFX1); + len = memory_region_length(machine, REGION_GFX1); for (i = 0;i < len;i += 16) { memcpy(temp,&src[i],16); @@ -1335,8 +1335,8 @@ static DRIVER_INIT( perestro ) } } - src = memory_region(REGION_GFX2); - len = memory_region_length(REGION_GFX2); + src = memory_region(machine, REGION_GFX2); + len = memory_region_length(machine, REGION_GFX2); for (i = 0;i < len;i += 16) { memcpy(temp,&src[i],16); @@ -1346,8 +1346,8 @@ static DRIVER_INIT( perestro ) } } - src = memory_region(REGION_GFX3); - len = memory_region_length(REGION_GFX3); + src = memory_region(machine, REGION_GFX3); + len = memory_region_length(machine, REGION_GFX3); for (i = 0;i < len;i += 16) { memcpy(temp,&src[i],16); diff --git a/src/mame/drivers/supertnk.c b/src/mame/drivers/supertnk.c index 683d3d2f383..55471661710 100644 --- a/src/mame/drivers/supertnk.c +++ b/src/mame/drivers/supertnk.c @@ -126,7 +126,7 @@ static WRITE8_HANDLER( supertnk_bankswitch_0_w ) bank_address = 0x10000 + (supertnk_rom_bank * 0x1000); - memory_set_bankptr(1, &memory_region(REGION_CPU1)[bank_address]); + memory_set_bankptr(1, &memory_region(machine, REGION_CPU1)[bank_address]); } @@ -138,7 +138,7 @@ static WRITE8_HANDLER( supertnk_bankswitch_1_w ) bank_address = 0x10000 + (supertnk_rom_bank * 0x1000); - memory_set_bankptr(1, &memory_region(REGION_CPU1)[bank_address]); + memory_set_bankptr(1, &memory_region(machine, REGION_CPU1)[bank_address]); } @@ -215,10 +215,10 @@ static WRITE8_HANDLER( supertnk_bitplane_select_1_w ) } -static void get_pens(pen_t *pens) +static void get_pens(running_machine *machine, pen_t *pens) { offs_t i; - const UINT8 *prom = memory_region(REGION_PROMS); + const UINT8 *prom = memory_region(machine, REGION_PROMS); for (i = 0; i < NUM_PENS; i++) { @@ -234,7 +234,7 @@ static VIDEO_UPDATE( supertnk ) pen_t pens[NUM_PENS]; offs_t offs; - get_pens(pens); + get_pens(screen->machine, pens); for (offs = 0; offs < supertnk_videoram_size; offs++) { @@ -476,8 +476,8 @@ static DRIVER_INIT( supertnk ) { /* decode the TMS9980 ROMs */ offs_t offs; - UINT8 *rom = memory_region(REGION_CPU1); - size_t len = memory_region_length(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); + size_t len = memory_region_length(machine, REGION_CPU1); for (offs = 0; offs < len; offs++) { diff --git a/src/mame/drivers/suprgolf.c b/src/mame/drivers/suprgolf.c index 6a4a3dcbf8f..3675e72e416 100644 --- a/src/mame/drivers/suprgolf.c +++ b/src/mame/drivers/suprgolf.c @@ -39,7 +39,7 @@ static READ8_HANDLER( rom_bank_select_r ) */ static WRITE8_HANDLER( rom_bank_select_w ) { - UINT8 *region_base = memory_region(REGION_USER1); + UINT8 *region_base = memory_region(machine, REGION_USER1); suprgolf_rom_bank = data; @@ -49,7 +49,7 @@ static WRITE8_HANDLER( rom_bank_select_w ) static WRITE8_HANDLER( rom2_bank_select_w ) { - UINT8 *region_base = memory_region(REGION_USER2); + UINT8 *region_base = memory_region(machine, REGION_USER2); mame_printf_debug("ROM_BANK 0x4000 - %X @%X\n",data,activecpu_get_previouspc()); memory_set_bankptr(1, region_base + (data&0x3f ) * 0x4000); } diff --git a/src/mame/drivers/suprloco.c b/src/mame/drivers/suprloco.c index 7a4ec3f1cf5..d5d2488239d 100644 --- a/src/mame/drivers/suprloco.c +++ b/src/mame/drivers/suprloco.c @@ -247,9 +247,9 @@ static DRIVER_INIT( suprloco ) int i, j, k, color_source, color_dest; UINT8 *source, *dest, *lookup; - source = memory_region(REGION_GFX1); + source = memory_region(machine, REGION_GFX1); dest = source + 0x6000; - lookup = memory_region(REGION_PROMS) + 0x0200; + lookup = memory_region(machine, REGION_PROMS) + 0x0200; for (i = 0; i < 0x80; i++, lookup += 8) { @@ -275,7 +275,7 @@ static DRIVER_INIT( suprloco ) /* decrypt program ROMs */ - suprloco_decode(); + suprloco_decode(machine); } diff --git a/src/mame/drivers/suprnova.c b/src/mame/drivers/suprnova.c index 62234ba9d0d..da97adc87f8 100644 --- a/src/mame/drivers/suprnova.c +++ b/src/mame/drivers/suprnova.c @@ -471,7 +471,7 @@ static MACHINE_RESET(skns) timer_pulse(ATTOTIME_IN_MSEC(8), NULL, 11, interrupt_callback); timer_pulse(ATTOTIME_IN_CYCLES(1824, 0), NULL, 9, interrupt_callback); - memory_set_bankptr(1,memory_region(REGION_USER1)); + memory_set_bankptr(1,memory_region(machine, REGION_USER1)); } @@ -833,7 +833,7 @@ static READ32_HANDLER( skns_msm6242_r ) static WRITE32_HANDLER( skns_v3t_w ) { - UINT8 *btiles = memory_region(REGION_GFX3); + UINT8 *btiles = memory_region(machine, REGION_GFX3); COMBINE_DATA(&skns_v3t_ram[offset]); diff --git a/src/mame/drivers/suprslam.c b/src/mame/drivers/suprslam.c index 0ec47a24e93..fa2663619ef 100644 --- a/src/mame/drivers/suprslam.c +++ b/src/mame/drivers/suprslam.c @@ -124,7 +124,7 @@ static WRITE8_HANDLER( pending_command_clear_w ) static WRITE8_HANDLER( suprslam_sh_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_CPU2); + UINT8 *RAM = memory_region(machine, REGION_CPU2); int bankaddress; bankaddress = 0x10000 + (data & 0x03) * 0x8000; diff --git a/src/mame/drivers/surpratk.c b/src/mame/drivers/surpratk.c index dd88a42247d..b32e023e03b 100644 --- a/src/mame/drivers/surpratk.c +++ b/src/mame/drivers/surpratk.c @@ -9,6 +9,7 @@ driver by Nicola Salmoria ***************************************************************************/ #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/2151intf.h" @@ -326,7 +327,7 @@ ROM_END static void surpratk_banking(int lines) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(Machine, REGION_CPU1); int offs = 0; logerror("%04x: setlines %02x\n",activecpu_get_pc(),lines); @@ -340,7 +341,7 @@ static MACHINE_RESET( surpratk ) { cpunum_set_info_fct(0, CPUINFO_PTR_KONAMI_SETLINES_CALLBACK, (genf *)surpratk_banking); - paletteram = &memory_region(REGION_CPU1)[0x48000]; + paletteram = &memory_region(machine, REGION_CPU1)[0x48000]; } static DRIVER_INIT( surpratk ) diff --git a/src/mame/drivers/system1.c b/src/mame/drivers/system1.c index fb808495182..783152b64ae 100644 --- a/src/mame/drivers/system1.c +++ b/src/mame/drivers/system1.c @@ -39,13 +39,13 @@ static MACHINE_RESET( system1 ) static MACHINE_RESET( system1_banked ) { MACHINE_RESET_CALL(system1); - memory_configure_bank(1, 0, 4, memory_region(REGION_CPU1) + 0x10000, 0x4000); + memory_configure_bank(1, 0, 4, memory_region(machine, REGION_CPU1) + 0x10000, 0x4000); } static MACHINE_RESET( wbml ) { system1_define_background_memory(system1_BACKGROUND_MEMORY_BANKED); - memory_configure_bank(1, 0, 4, memory_region(REGION_CPU1) + 0x10000, 0x4000); + memory_configure_bank(1, 0, 4, memory_region(machine, REGION_CPU1) + 0x10000, 0x4000); } // Noboranka: there seems to be some protection? involving reads / writes to ports in the 2x region @@ -4767,31 +4767,31 @@ ROM_START( noboranb ) ROM_LOAD( "nobo_pr.13a", 0x0300, 0x0100, CRC(648350b8) SHA1(c7986aa9127ef5b50b845434cb4e81dff9861cd2) ) /* timing? (not used) */ ROM_END -static DRIVER_INIT( regulus ) { regulus_decode(); } -static DRIVER_INIT( mrviking ) { mrviking_decode(); } -static DRIVER_INIT( swat ) { swat_decode(); } -static DRIVER_INIT( flicky ) { flicky_decode(); } -static DRIVER_INIT( wmatch ) { wmatch_decode(); } -static DRIVER_INIT( bullfgtj ) { bullfgtj_decode(); } -static DRIVER_INIT( spatter ) { spatter_decode(); } -static DRIVER_INIT( pitfall2 ) { pitfall2_decode(); } -static DRIVER_INIT( nprinces ) { nprinces_decode(); } -static DRIVER_INIT( seganinj ) { seganinj_decode(); } -static DRIVER_INIT( imsorry ) { imsorry_decode(); } -static DRIVER_INIT( teddybb ) { teddybb_decode(); } -static DRIVER_INIT( hvymetal ) { hvymetal_decode(); } -static DRIVER_INIT( myheroj ) { myheroj_decode(); } -static DRIVER_INIT( 4dwarrio ) { fdwarrio_decode(); } -static DRIVER_INIT( wboy ) { astrofl_decode(); } -static DRIVER_INIT( wboy2 ) { wboy2_decode(); } -static DRIVER_INIT( gardia ) { gardia_decode(); } -static DRIVER_INIT( gardiab ) { gardiab_decode(); } - - - -static DRIVER_INIT( blockgal ) { mc8123_decrypt_rom(0, memory_region(REGION_USER1), 0, 0); } -static DRIVER_INIT( wbml ) { mc8123_decrypt_rom(0, memory_region(REGION_USER1), 1, 4); } -static DRIVER_INIT( ufosensi ) { mc8123_decrypt_rom(0, memory_region(REGION_USER1), 1, 4); } +static DRIVER_INIT( regulus ) { regulus_decode(machine); } +static DRIVER_INIT( mrviking ) { mrviking_decode(machine); } +static DRIVER_INIT( swat ) { swat_decode(machine); } +static DRIVER_INIT( flicky ) { flicky_decode(machine); } +static DRIVER_INIT( wmatch ) { wmatch_decode(machine); } +static DRIVER_INIT( bullfgtj ) { bullfgtj_decode(machine); } +static DRIVER_INIT( spatter ) { spatter_decode(machine); } +static DRIVER_INIT( pitfall2 ) { pitfall2_decode(machine); } +static DRIVER_INIT( nprinces ) { nprinces_decode(machine); } +static DRIVER_INIT( seganinj ) { seganinj_decode(machine); } +static DRIVER_INIT( imsorry ) { imsorry_decode(machine); } +static DRIVER_INIT( teddybb ) { teddybb_decode(machine); } +static DRIVER_INIT( hvymetal ) { hvymetal_decode(machine); } +static DRIVER_INIT( myheroj ) { myheroj_decode(machine); } +static DRIVER_INIT( 4dwarrio ) { fdwarrio_decode(machine); } +static DRIVER_INIT( wboy ) { astrofl_decode(machine); } +static DRIVER_INIT( wboy2 ) { wboy2_decode(machine); } +static DRIVER_INIT( gardia ) { gardia_decode(machine); } +static DRIVER_INIT( gardiab ) { gardiab_decode(machine); } + + + +static DRIVER_INIT( blockgal ) { mc8123_decrypt_rom(machine, 0, memory_region(machine, REGION_USER1), 0, 0); } +static DRIVER_INIT( wbml ) { mc8123_decrypt_rom(machine, 0, memory_region(machine, REGION_USER1), 1, 4); } +static DRIVER_INIT( ufosensi ) { mc8123_decrypt_rom(machine, 0, memory_region(machine, REGION_USER1), 1, 4); } static UINT8 dakkochn_control; @@ -4818,7 +4818,7 @@ static WRITE8_HANDLER( dakkochn_port_15_w ) static DRIVER_INIT( dakkochn ) { - mc8123_decrypt_rom(0, memory_region(REGION_USER1), 1, 4); + mc8123_decrypt_rom(machine, 0, memory_region(machine, REGION_USER1), 1, 4); memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x00, 0x00, 0, 0, dakkochn_port_00_r); memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x03, 0x03, 0, 0, dakkochn_port_03_r); @@ -4836,12 +4836,12 @@ static DRIVER_INIT( myherok ) /* additionally to the usual protection, all the program ROMs have data lines */ /* D0 and D1 swapped. */ - rom = memory_region(REGION_CPU1); + rom = memory_region(machine, REGION_CPU1); for (A = 0;A < 0xc000;A++) rom[A] = (rom[A] & 0xfc) | ((rom[A] & 1) << 1) | ((rom[A] & 2) >> 1); /* the tile gfx ROMs are mangled as well: */ - rom = memory_region(REGION_GFX1); + rom = memory_region(machine, REGION_GFX1); /* the first ROM has data lines D0 and D6 swapped. */ for (A = 0x0000;A < 0x4000;A++) @@ -4870,7 +4870,7 @@ static DRIVER_INIT( myherok ) } } - myheroj_decode(); + myheroj_decode(machine); } static DRIVER_INIT( noboranb ) @@ -4878,7 +4878,7 @@ static DRIVER_INIT( noboranb ) /* Patch to get PRG ROMS ('T', 'R' and 'S) status as "GOOD" in the "test mode" */ /* not really needed */ -// UINT8 *ROM = memory_region(REGION_CPU1); +// UINT8 *ROM = memory_region(machine, REGION_CPU1); // ROM[0x3296] = 0x18; // 'jr' instead of 'jr z' - 'T' (PRG Main ROM) // ROM[0x32be] = 0x18; // 'jr' instead of 'jr z' - 'R' (Banked ROM 1) @@ -4890,7 +4890,7 @@ static DRIVER_INIT( noboranb ) // ROM[0x10000 + 0 * 0x8000 + 0x3347] = 0x18; // 'jr' instead of 'jr z' /* Patch to get sound in later levels(the program enters into a tight loop)*/ - UINT8 *ROM2 = memory_region(REGION_CPU2); + UINT8 *ROM2 = memory_region(machine, REGION_CPU2); ROM2[0x02f9] = 0x28;//'jr z' instead of 'jr' } @@ -4898,14 +4898,14 @@ static DRIVER_INIT( noboranb ) static DRIVER_INIT( bootleg ) { - memory_set_decrypted_region(0, 0x0000, 0x7fff, memory_region(REGION_CPU1) + 0x10000); + memory_set_decrypted_region(0, 0x0000, 0x7fff, memory_region(machine, REGION_CPU1) + 0x10000); } static DRIVER_INIT( bootlegb ) { - memory_set_decrypted_region(0, 0x0000, 0x7fff, memory_region(REGION_CPU1) + 0x20000); - memory_configure_bank_decrypted(1, 0, 4, memory_region(REGION_CPU1) + 0x30000, 0x4000); + memory_set_decrypted_region(0, 0x0000, 0x7fff, memory_region(machine, REGION_CPU1) + 0x20000); + memory_configure_bank_decrypted(1, 0, 4, memory_region(machine, REGION_CPU1) + 0x30000, 0x4000); } diff --git a/src/mame/drivers/system16.c b/src/mame/drivers/system16.c index 8c899a0c511..fd802157933 100644 --- a/src/mame/drivers/system16.c +++ b/src/mame/drivers/system16.c @@ -291,7 +291,7 @@ static READ8_HANDLER( tturfbl_soundbank_r ) static WRITE8_HANDLER( tturfbl_soundbank_w ) { - UINT8 *mem = memory_region(REGION_CPU2); + UINT8 *mem = memory_region(machine, REGION_CPU2); switch(data) { @@ -386,11 +386,11 @@ ADDRESS_MAP_END static WRITE8_HANDLER( upd7759_bank_w ) //* { - int offs, size = memory_region_length(REGION_CPU2) - 0x10000; + int offs, size = memory_region_length(machine, REGION_CPU2) - 0x10000; upd7759_reset_w(0, data & 0x40); offs = 0x10000 + (data * 0x4000) % size; - memory_set_bankptr(1, memory_region(REGION_CPU2) + offs); + memory_set_bankptr(1, memory_region(machine, REGION_CPU2) + offs); } @@ -2106,7 +2106,7 @@ static DRIVER_INIT( tturfbl ) MACHINE_RESET_CALL(sys16_onetime); - mem = memory_region(REGION_CPU2); + mem = memory_region(machine, REGION_CPU2); memcpy(mem, mem+0x10000, 0x8000); } @@ -2849,7 +2849,7 @@ GAME( 1988, wb3bbl, wb3, wb3bbl, wb3b, wb3bbl, ROT0, "bootleg", static DRIVER_INIT( beautyb ) { - UINT16*rom = (UINT16*)memory_region( REGION_CPU1 ); + UINT16*rom = (UINT16*)memory_region( machine, REGION_CPU1 ); int x; for (x=0;x<0x8000;x++) diff --git a/src/mame/drivers/system18.c b/src/mame/drivers/system18.c index 630081203cc..b29e524ec6a 100644 --- a/src/mame/drivers/system18.c +++ b/src/mame/drivers/system18.c @@ -203,7 +203,7 @@ static READ8_HANDLER( shdancbl_soundbank_r ) static WRITE8_HANDLER( shdancbl_bankctrl_w ) { - UINT8 *mem = memory_region(REGION_CPU2); + UINT8 *mem = memory_region(machine, REGION_CPU2); switch(data) { @@ -300,7 +300,7 @@ ADDRESS_MAP_END static WRITE8_HANDLER( sys18_soundbank_w ) { - UINT8 *mem = memory_region(REGION_CPU2); + UINT8 *mem = memory_region(machine, REGION_CPU2); int rom = (data >> 6) & 3; int bank = (data & 0x3f); int mask = sys18_sound_info[rom*2+0]; @@ -768,7 +768,7 @@ static DRIVER_INIT( shdancbl ) UINT8 *mem; /* Invert tile ROM data*/ - mem = memory_region(REGION_GFX1); + mem = memory_region(machine, REGION_GFX1); for(i = 0; i < 0xc0000; i++) mem[i] ^= 0xFF; @@ -780,7 +780,7 @@ static DRIVER_INIT( shdancbl ) sys16_MaxShadowColors=0; /* Copy first 32K of IC45 to Z80 address space */ - mem = memory_region(REGION_CPU2); + mem = memory_region(machine, REGION_CPU2); memcpy(mem, mem+0x10000, 0x8000); } @@ -906,7 +906,7 @@ static MACHINE_RESET( mwalkbl ){ } static DRIVER_INIT( mwalkbl ){ - UINT8 *RAM= memory_region(REGION_CPU2); + UINT8 *RAM= memory_region(machine, REGION_CPU2); static const int mwalk_sound_info[] = { 0x0f, 0x00000, // ROM #1 = 128K @@ -1087,7 +1087,7 @@ static MACHINE_RESET( astormbl ){ static DRIVER_INIT( astormbl ){ - UINT8 *RAM= memory_region(REGION_CPU2); + UINT8 *RAM= memory_region(machine, REGION_CPU2); static const int astormbl_sound_info[] = { 0x0f, 0x00000, // ROM #1 = 128K diff --git a/src/mame/drivers/tail2nos.c b/src/mame/drivers/tail2nos.c index a02d3242698..9a034760827 100644 --- a/src/mame/drivers/tail2nos.c +++ b/src/mame/drivers/tail2nos.c @@ -28,11 +28,11 @@ VIDEO_UPDATE( tail2nos ); static MACHINE_RESET( tail2nos ) { /* point to the extra ROMs */ - memory_set_bankptr(1,memory_region(REGION_USER1)); - memory_set_bankptr(2,memory_region(REGION_USER2)); + memory_set_bankptr(1,memory_region(machine, REGION_USER1)); + memory_set_bankptr(2,memory_region(machine, REGION_USER2)); /* initialize sound bank */ - memory_set_bankptr(3,memory_region(REGION_CPU2) + 0x10000); + memory_set_bankptr(3,memory_region(machine, REGION_CPU2) + 0x10000); } @@ -64,7 +64,7 @@ static WRITE16_HANDLER( tail2nos_K051316_ctrl_0_w ) static WRITE8_HANDLER( sound_bankswitch_w ) { - memory_set_bankptr(3,memory_region(REGION_CPU2) + 0x10000 + (data & 0x01) * 0x8000); + memory_set_bankptr(3,memory_region(machine, REGION_CPU2) + 0x10000 + (data & 0x01) * 0x8000); } static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 ) diff --git a/src/mame/drivers/taito_b.c b/src/mame/drivers/taito_b.c index c849383da7f..2c2a5c38590 100644 --- a/src/mame/drivers/taito_b.c +++ b/src/mame/drivers/taito_b.c @@ -3269,7 +3269,7 @@ MACHINE_DRIVER_END #if 0 static void ryujin_patch(void) { - UINT16 *rom = (UINT16*)memory_region(REGION_CPU1); + UINT16 *rom = (UINT16*)memory_region(machine, REGION_CPU1); rom[ 0x62/2 ] = 1; //0 (already in rom) - Taito Corporation 1993 //1 - Taito America corp with blue FBI logo @@ -3316,7 +3316,7 @@ MACHINE_DRIVER_END #if 0 static void sbm_patch(void) { - UINT16 *rom = (UINT16*)memory_region(REGION_CPU1); + UINT16 *rom = (UINT16*)memory_region(machine, REGION_CPU1); rom[ 0x7ffff/2 ] = 2; //US version } #endif @@ -3995,7 +3995,7 @@ ROM_END static DRIVER_INIT( taito_b ) { - memory_configure_bank(1, 0, 4, memory_region(REGION_CPU2) + 0x10000, 0x4000); + memory_configure_bank(1, 0, 4, memory_region(machine, REGION_CPU2) + 0x10000, 0x4000); } GAME( 1989, masterw, 0, masterw, masterw, taito_b, ROT270, "Taito Corporation Japan", "Master of Weapon (World)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/taito_f2.c b/src/mame/drivers/taito_f2.c index 515b7cf458f..8f77d1ca2a0 100644 --- a/src/mame/drivers/taito_f2.c +++ b/src/mame/drivers/taito_f2.c @@ -810,15 +810,15 @@ static INTERRUPT_GEN( taitof2_interrupt ) SOUND ****************************************************************/ -static void reset_sound_region(void) +static void reset_sound_region(running_machine *machine) { - memory_set_bankptr( 2, memory_region(REGION_CPU2) + (banknum * 0x4000) + 0x10000 ); + memory_set_bankptr( 2, memory_region(machine, REGION_CPU2) + (banknum * 0x4000) + 0x10000 ); } static WRITE8_HANDLER( sound_bankswitch_w ) { banknum = (data - 1) & 7; - reset_sound_region(); + reset_sound_region(machine); #ifdef MAME_DEBUG if (banknum>2) logerror("CPU #1 switch to ROM bank %06x: should only happen if Z80 prg rom is 128K!\n",banknum); @@ -3857,7 +3857,7 @@ static const struct YM2203interface ym2203_interface = static STATE_POSTLOAD( f2_postload ) { - reset_sound_region(); + reset_sound_region(machine); } static MACHINE_START( f2 ) @@ -3869,7 +3869,7 @@ static MACHINE_START( f2 ) static MACHINE_RESET( qcrayon ) { /* point to the extra ROM */ - memory_set_bankptr(1,memory_region(REGION_USER1)); + memory_set_bankptr(1,memory_region(machine, REGION_USER1)); } @@ -5865,7 +5865,7 @@ static DRIVER_INIT( finalb ) int i; UINT8 data; UINT32 offset; - UINT8 *gfx = memory_region(REGION_GFX2); + UINT8 *gfx = memory_region(machine, REGION_GFX2); offset = 0x100000; for (i = 0x180000; i<0x200000; i++) @@ -5889,8 +5889,8 @@ static DRIVER_INIT( finalb ) static DRIVER_INIT( mjnquest ) { - int i, len = memory_region_length(REGION_GFX2); - UINT8 *gfx = memory_region(REGION_GFX2); + int i, len = memory_region_length(machine, REGION_GFX2); + UINT8 *gfx = memory_region(machine, REGION_GFX2); /* the bytes in each longword are in reversed order, put them in the order used by the other games. */ diff --git a/src/mame/drivers/taito_f3.c b/src/mame/drivers/taito_f3.c index 51cd474bb29..791a7d11690 100644 --- a/src/mame/drivers/taito_f3.c +++ b/src/mame/drivers/taito_f3.c @@ -129,7 +129,7 @@ static WRITE32_HANDLER( f3_sound_reset_1_w ) static WRITE32_HANDLER( f3_sound_bankswitch_w ) { if (f3_game==KIRAMEKI) { - UINT16 *rom = (UINT16 *)memory_region(REGION_CPU2); + UINT16 *rom = (UINT16 *)memory_region(machine, REGION_CPU2); UINT32 idx; idx = (offset << 1) & 0x1e; @@ -398,7 +398,7 @@ static INTERRUPT_GEN( f3_interrupt2 ) static MACHINE_RESET( f3 ) { - taito_f3_soundsystem_reset(); + taito_f3_soundsystem_reset(machine); cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, ASSERT_LINE); f3_68681_reset(); @@ -3132,12 +3132,12 @@ ROM_END /******************************************************************************/ -static void tile_decode(int uses_5bpp_tiles) +static void tile_decode(running_machine *machine, int uses_5bpp_tiles) { UINT8 lsb,msb; UINT32 offset,i; - UINT8 *gfx = memory_region(REGION_GFX2); - int size=memory_region_length(REGION_GFX2); + UINT8 *gfx = memory_region(machine, REGION_GFX2); + int size=memory_region_length(machine, REGION_GFX2); int half=size/2,data; /* Setup ROM formats: @@ -3167,8 +3167,8 @@ static void tile_decode(int uses_5bpp_tiles) offset+=4; } - gfx = memory_region(REGION_GFX1); - size=memory_region_length(REGION_GFX1); + gfx = memory_region(machine, REGION_GFX1); + size=memory_region_length(machine, REGION_GFX1); offset = size/2; for (i = size/2+size/4; i<size; i++) @@ -3249,59 +3249,59 @@ F3_IRQ_SPEEDUP_2_R(kirameki, 0x12fc6, 0x0414/4, 0x0000ff00 ) static DRIVER_INIT( ringrage ) { f3_game=RINGRAGE; - tile_decode(0); + tile_decode(machine, 0); } static DRIVER_INIT( arabianm ) { memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x408124, 0x408127, 0, 0, irq_speedup_r_arabianm ); f3_game=ARABIANM; - tile_decode(1); + tile_decode(machine, 1); } static DRIVER_INIT( ridingf ) { f3_game=RIDINGF; - tile_decode(1); + tile_decode(machine, 1); } static DRIVER_INIT( gseeker ) { memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x40ad94, 0x40ad97, 0, 0, irq_speedup_r_gseeker ); f3_game=GSEEKER; - tile_decode(0); + tile_decode(machine, 0); } static DRIVER_INIT( gunlock ) { memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x400004, 0x400007, 0, 0, irq_speedup_r_gunlock ); f3_game=GUNLOCK; - tile_decode(1); + tile_decode(machine, 1); } static DRIVER_INIT( elvactr ) { memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4007a0, 0x4007a3, 0, 0, irq_speedup_r_eaction2 ); f3_game=EACTION2; - tile_decode(1); + tile_decode(machine, 1); } static DRIVER_INIT( cupfinal ) { memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x408114, 0x408117, 0, 0, irq_speedup_r_cupfinal ); f3_game=SCFINALS; - tile_decode(1); + tile_decode(machine, 1); } static DRIVER_INIT( trstaroj ) { f3_game=TRSTAR; - tile_decode(1); + tile_decode(machine, 1); } static DRIVER_INIT( scfinals ) { - UINT32 *RAM = (UINT32 *)memory_region(REGION_CPU1); + UINT32 *RAM = (UINT32 *)memory_region(machine, REGION_CPU1); /* Doesn't boot without this - eprom related? */ RAM[0x5af0/4]=0x4e710000|(RAM[0x5af0/4]&0xffff); @@ -3311,102 +3311,102 @@ static DRIVER_INIT( scfinals ) memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x408114, 0x408117, 0, 0, irq_speedup_r_scfinals ); f3_game=SCFINALS; - tile_decode(1); + tile_decode(machine, 1); } static DRIVER_INIT( lightbr ) { memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x400130, 0x400133, 0, 0, irq_speedup_r_lightbr ); f3_game=LIGHTBR; - tile_decode(1); + tile_decode(machine, 1); } static DRIVER_INIT( kaiserkn ) { memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x408110, 0x408113, 0, 0, irq_speedup_r_kaiserkn ); f3_game=KAISERKN; - tile_decode(1); + tile_decode(machine, 1); } static DRIVER_INIT( dariusg ) { memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x406ba8, 0x406bab, 0, 0, irq_speedup_r_dariusg ); f3_game=DARIUSG; - tile_decode(0); + tile_decode(machine, 0); } static DRIVER_INIT( spcinvdj ) { memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x400230, 0x400233, 0, 0, irq_speedup_r_spcinvdj ); f3_game=SPCINVDX; - tile_decode(0); + tile_decode(machine, 0); } static DRIVER_INIT( qtheater ) { f3_game=QTHEATER; - tile_decode(0); + tile_decode(machine, 0); } static DRIVER_INIT( spcinv95 ) { memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x408114, 0x408117, 0, 0, irq_speedup_r_spcinv95 ); f3_game=SPCINV95; - tile_decode(1); + tile_decode(machine, 1); } static DRIVER_INIT( gekirido ) { memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x406bb0, 0x406bb3, 0, 0, irq_speedup_r_gekirido ); f3_game=GEKIRIDO; - tile_decode(1); + tile_decode(machine, 1); } static DRIVER_INIT( ktiger2 ) { memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x400570, 0x400573, 0, 0, irq_speedup_r_ktiger2 ); f3_game=KTIGER2; - tile_decode(0); + tile_decode(machine, 0); } static DRIVER_INIT( bubsymph ) { memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x400134, 0x400137, 0, 0, irq_speedup_r_bubsymph ); f3_game=BUBSYMPH; - tile_decode(1); + tile_decode(machine, 1); } static DRIVER_INIT( bubblem ) { memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x400134, 0x400137, 0, 0, irq_speedup_r_bubblem ); f3_game=BUBBLEM; - tile_decode(1); + tile_decode(machine, 1); } static DRIVER_INIT( cleopatr ) { memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x408114, 0x408117, 0, 0, irq_speedup_r_cleopatr ); f3_game=CLEOPATR; - tile_decode(0); + tile_decode(machine, 0); } static DRIVER_INIT( popnpop ) { memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x401cf8, 0x401cfb, 0, 0, irq_speedup_r_popnpop ); f3_game=POPNPOP; - tile_decode(0); + tile_decode(machine, 0); } static DRIVER_INIT( landmakr ) { memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x400824, 0x400827, 0, 0, irq_speedup_r_landmakr ); f3_game=LANDMAKR; - tile_decode(0); + tile_decode(machine, 0); } static DRIVER_INIT( landmkrp ) { - UINT32 *RAM = (UINT32 *)memory_region(REGION_CPU1); + UINT32 *RAM = (UINT32 *)memory_region(machine, REGION_CPU1); /* For some reason the least significant byte in the last 2 long words of ROM is swapped. As the roms have been verified ok, I assume this is some @@ -3417,94 +3417,94 @@ static DRIVER_INIT( landmkrp ) memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x400824, 0x400827, 0, 0, irq_speedup_r_landmakr ); f3_game=LANDMAKR; - tile_decode(0); + tile_decode(machine, 0); } static DRIVER_INIT( pbobble3 ) { memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x405af4, 0x405af7, 0, 0, irq_speedup_r_pbobble3 ); f3_game=PBOBBLE3; - tile_decode(0); + tile_decode(machine, 0); } static DRIVER_INIT( pbobble4 ) { memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4058f4, 0x4058f7, 0, 0, irq_speedup_r_pbobble4 ); f3_game=PBOBBLE4; - tile_decode(0); + tile_decode(machine, 0); } static DRIVER_INIT( quizhuhu ) { f3_game=QUIZHUHU; - tile_decode(0); + tile_decode(machine, 0); } static DRIVER_INIT( pbobble2 ) { memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x404a50, 0x404a53, 0, 0, irq_speedup_r_pbobble2 ); f3_game=PBOBBLE2; - tile_decode(0); + tile_decode(machine, 0); } static DRIVER_INIT( pbobbl2x ) { memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x405c58, 0x405c5b, 0, 0, irq_speedup_r_pbobbl2x ); f3_game=PBOBBLE2; - tile_decode(0); + tile_decode(machine, 0); } static DRIVER_INIT( hthero95 ) { memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x408114, 0x408117, 0, 0, irq_speedup_r_pwrgoal ); f3_game=HTHERO95; - tile_decode(0); + tile_decode(machine, 0); } static DRIVER_INIT( kirameki ) { memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x400414, 0x400417, 0, 0, irq_speedup_r_kirameki ); f3_game=KIRAMEKI; - tile_decode(0); + tile_decode(machine, 0); } static DRIVER_INIT( puchicar ) { memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4024d8, 0x4024db, 0, 0, irq_speedup_r_puchicar ); f3_game=PUCHICAR; - tile_decode(0); + tile_decode(machine, 0); } static DRIVER_INIT( twinqix ) { memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x400134, 0x400137, 0, 0, irq_speedup_r_twinqix ); f3_game=TWINQIX; - tile_decode(0); + tile_decode(machine, 0); } static DRIVER_INIT( arkretrn ) { memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x402154, 0x402157, 0, 0, irq_speedup_r_arkretrn ); f3_game=ARKRETRN; - tile_decode(0); + tile_decode(machine, 0); } static DRIVER_INIT( intcup94 ) { f3_game=SCFINALS; - tile_decode(1); + tile_decode(machine, 1); } static DRIVER_INIT( recalh ) { f3_game=RECALH; - tile_decode(0); + tile_decode(machine, 0); } static DRIVER_INIT( commandw ) { f3_game=COMMANDW; - tile_decode(1); + tile_decode(machine, 1); } /******************************************************************************/ diff --git a/src/mame/drivers/taito_h.c b/src/mame/drivers/taito_h.c index f3ff0324451..82b432b3768 100644 --- a/src/mame/drivers/taito_h.c +++ b/src/mame/drivers/taito_h.c @@ -247,15 +247,15 @@ static READ16_HANDLER( syvalion_input_bypass_r ) static INT32 banknum = -1; -static void reset_sound_region(void) +static void reset_sound_region(running_machine *machine) { - memory_set_bankptr(1, memory_region(REGION_CPU2) + (banknum * 0x4000) + 0x10000); + memory_set_bankptr(1, memory_region(machine, REGION_CPU2) + (banknum * 0x4000) + 0x10000); } static WRITE8_HANDLER( sound_bankswitch_w ) { banknum = (data - 1) & 3; - reset_sound_region(); + reset_sound_region(machine); } @@ -567,7 +567,7 @@ GFXDECODE_END static STATE_POSTLOAD( taitoh_postload ) { - reset_sound_region(); + reset_sound_region(machine); } static MACHINE_START( taitoh ) diff --git a/src/mame/drivers/taito_l.c b/src/mame/drivers/taito_l.c index 7448ebdd992..a4cb189ca7a 100644 --- a/src/mame/drivers/taito_l.c +++ b/src/mame/drivers/taito_l.c @@ -159,7 +159,7 @@ static void machine_init(running_machine *machine) memory_set_bankptr(2+i, current_base[i]); } cur_rombank = cur_rombank2 = 0; - memory_set_bankptr(1, memory_region(REGION_CPU1) + 0x10000); + memory_set_bankptr(1, memory_region(machine, REGION_CPU1) + 0x10000); for(i=0;i<512;i++) { @@ -334,7 +334,7 @@ static WRITE8_HANDLER( rombankswitch_w ) // logerror("robs %d, %02x (%04x)\n", offset, data, activecpu_get_pc()); cur_rombank = data; - memory_set_bankptr(1, memory_region(REGION_CPU1)+0x10000+0x2000*cur_rombank); + memory_set_bankptr(1, memory_region(machine, REGION_CPU1)+0x10000+0x2000*cur_rombank); } } @@ -355,7 +355,7 @@ static WRITE8_HANDLER( rombank2switch_w ) // logerror("robs2 %02x (%04x)\n", data, activecpu_get_pc()); cur_rombank2 = data; - memory_set_bankptr(6, memory_region(REGION_CPU3)+0x10000+0x4000*cur_rombank2); + memory_set_bankptr(6, memory_region(machine, REGION_CPU3)+0x10000+0x4000*cur_rombank2); } } @@ -588,7 +588,7 @@ static void champwr_msm5205_vck(running_machine *machine, int chip) } else { - adpcm_data = memory_region(REGION_SOUND1)[adpcm_pos]; + adpcm_data = memory_region(machine, REGION_SOUND1)[adpcm_pos]; adpcm_pos = (adpcm_pos + 1) & 0x1ffff; MSM5205_data_w(0, adpcm_data >> 4); } @@ -800,7 +800,7 @@ ADDRESS_MAP_END static WRITE8_HANDLER( sound_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_CPU2); + UINT8 *RAM = memory_region(machine, REGION_CPU2); int banknum = (data - 1) & 3; memory_set_bankptr (7, &RAM [0x10000 + (banknum * 0x4000)]); @@ -2258,7 +2258,7 @@ static WRITE8_HANDLER( portA_w ) if (cur_bank != (data & 0x03) ) { int bankaddress; - UINT8 *RAM = memory_region(REGION_CPU2); + UINT8 *RAM = memory_region(machine, REGION_CPU2); cur_bank = data & 0x03; bankaddress = 0x10000 + (cur_bank-1) * 0x4000; @@ -3113,7 +3113,7 @@ static DRIVER_INIT( plottina ) v |= 1<<(7-j); tab[i] = v; } - p = memory_region(REGION_CPU1); + p = memory_region(machine, REGION_CPU1); for(i=0;i<0x20000;i++) { *p = tab[*p]; @@ -3123,7 +3123,7 @@ static DRIVER_INIT( plottina ) static DRIVER_INIT( evilston ) { - UINT8 *ROM = memory_region(REGION_CPU2); + UINT8 *ROM = memory_region(machine, REGION_CPU2); ROM[0x72]=0x45; /* reti -> retn ('dead' loop @ $1104 )*/ memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa7fe, 0xa7fe, 0, 0, evilston_snd_w); } diff --git a/src/mame/drivers/taito_x.c b/src/mame/drivers/taito_x.c index 9e56846fe87..7954c94c188 100644 --- a/src/mame/drivers/taito_x.c +++ b/src/mame/drivers/taito_x.c @@ -395,15 +395,15 @@ static WRITE16_HANDLER( kyustrkr_input_w ) static INT32 banknum = -1; -static void reset_sound_region(void) +static void reset_sound_region(running_machine *machine) { - memory_set_bankptr( 2, memory_region(REGION_CPU2) + (banknum * 0x4000) + 0x10000 ); + memory_set_bankptr( 2, memory_region(machine, REGION_CPU2) + (banknum * 0x4000) + 0x10000 ); } static WRITE8_HANDLER( sound_bankswitch_w ) { banknum = (data - 1) & 3; - reset_sound_region(); + reset_sound_region(machine); } @@ -990,7 +990,7 @@ static const struct YM2151interface ym2151_interface = static STATE_POSTLOAD( taitox_postload ) { - reset_sound_region(); + reset_sound_region(machine); } static MACHINE_START( taitox ) diff --git a/src/mame/drivers/taito_z.c b/src/mame/drivers/taito_z.c index 4a16e3b4af0..591b738cb4e 100644 --- a/src/mame/drivers/taito_z.c +++ b/src/mame/drivers/taito_z.c @@ -1335,15 +1335,15 @@ static READ16_HANDLER( aquajack_unknown_r ) static INT32 banknum = -1; -static void reset_sound_region(void) /* assumes Z80 sandwiched between 68Ks */ +static void reset_sound_region(running_machine *machine) /* assumes Z80 sandwiched between 68Ks */ { - memory_set_bankptr( 10, memory_region(REGION_CPU2) + (banknum * 0x4000) + 0x10000 ); + memory_set_bankptr( 10, memory_region(machine, REGION_CPU2) + (banknum * 0x4000) + 0x10000 ); } static WRITE8_HANDLER( sound_bankswitch_w ) { banknum = (data - 1) & 7; - reset_sound_region(); + reset_sound_region(machine); } static WRITE16_HANDLER( taitoz_sound_w ) @@ -1426,7 +1426,7 @@ static WRITE16_HANDLER( spacegun_pancontrol ) static STATE_POSTLOAD( taitoz_postload ) { parse_control(machine); - reset_sound_region(); + reset_sound_region(machine); } static MACHINE_START( taitoz ) diff --git a/src/mame/drivers/taitoair.c b/src/mame/drivers/taitoair.c index ec355275997..18776082d99 100644 --- a/src/mame/drivers/taitoair.c +++ b/src/mame/drivers/taitoair.c @@ -343,20 +343,20 @@ static READ16_HANDLER( stick2_input_r ) static INT32 banknum = -1; -static void reset_sound_region(void) +static void reset_sound_region(running_machine *machine) { - memory_set_bankptr(1, memory_region(REGION_CPU2) + (banknum * 0x4000) + 0x10000); + memory_set_bankptr(1, memory_region(machine, REGION_CPU2) + (banknum * 0x4000) + 0x10000); } static WRITE8_HANDLER( sound_bankswitch_w ) { banknum = (data - 1) & 3; - reset_sound_region(); + reset_sound_region(machine); } static STATE_POSTLOAD( taitoair_postload ) { - reset_sound_region(); + reset_sound_region(machine); } static MACHINE_START( taitoair ) diff --git a/src/mame/drivers/taitojc.c b/src/mame/drivers/taitojc.c index b2c078bf0a3..75a7c738306 100644 --- a/src/mame/drivers/taitojc.c +++ b/src/mame/drivers/taitojc.c @@ -896,7 +896,7 @@ static UINT16 dsp_tex_offset = 0; static READ16_HANDLER( dsp_rom_r ) { - UINT16 *rom = (UINT16*)memory_region(REGION_GFX2); + UINT16 *rom = (UINT16*)memory_region(machine, REGION_GFX2); UINT16 data = rom[dsp_rom_pos++]; //mame_printf_debug("dsp_rom_r: %08X, %08X at %08X\n", offset, mem_mask, activecpu_get_pc()); return data; @@ -1251,7 +1251,7 @@ INPUT_PORTS_END static MACHINE_RESET( taitojc ) { - taito_f3_soundsystem_reset(); + taito_f3_soundsystem_reset(machine); f3_68681_reset(); diff --git a/src/mame/drivers/taitowlf.c b/src/mame/drivers/taitowlf.c index 1c78597c231..b7b7e45f4b8 100644 --- a/src/mame/drivers/taitowlf.c +++ b/src/mame/drivers/taitowlf.c @@ -142,7 +142,7 @@ static void mxtc_config_w(int function, int reg, UINT8 data) } else // disable RAM access (reads go to BIOS ROM) { - memory_set_bankptr(1, memory_region(REGION_USER1) + 0x30000); + memory_set_bankptr(1, memory_region(Machine, REGION_USER1) + 0x30000); } break; } @@ -536,7 +536,7 @@ static IRQ_CALLBACK(irq_callback) static MACHINE_RESET(taitowlf) { - memory_set_bankptr(1, memory_region(REGION_USER1) + 0x30000); + memory_set_bankptr(1, memory_region(machine, REGION_USER1) + 0x30000); cpunum_set_irq_callback(0, irq_callback); diff --git a/src/mame/drivers/tank8.c b/src/mame/drivers/tank8.c index 6cb2f22bcbb..c56a229bff3 100644 --- a/src/mame/drivers/tank8.c +++ b/src/mame/drivers/tank8.c @@ -466,10 +466,10 @@ ROM_END static DRIVER_INIT( decode ) { - const UINT8* DECODE = memory_region(REGION_USER1); + const UINT8* DECODE = memory_region(machine, REGION_USER1); - UINT8* p1 = memory_region(REGION_CPU1) + 0x00000; - UINT8* p2 = memory_region(REGION_CPU1) + 0x10000; + UINT8* p1 = memory_region(machine, REGION_CPU1) + 0x00000; + UINT8* p2 = memory_region(machine, REGION_CPU1) + 0x10000; int i; diff --git a/src/mame/drivers/tankbust.c b/src/mame/drivers/tankbust.c index 2721d49e3f3..c8e064e72e2 100644 --- a/src/mame/drivers/tankbust.c +++ b/src/mame/drivers/tankbust.c @@ -113,8 +113,8 @@ static WRITE8_HANDLER( tankbust_e0xx_w ) case 7: /* 0xe007 bankswitch */ /* bank 1 at 0x6000-9fff = from 0x10000 when bit0=0 else from 0x14000 */ /* bank 2 at 0xa000-bfff = from 0x18000 when bit0=0 else from 0x1a000 */ - memory_set_bankptr( 1, memory_region(REGION_CPU1) + 0x10000 + ((data&1) * 0x4000) ); - memory_set_bankptr( 2, memory_region(REGION_CPU1) + 0x18000 + ((data&1) * 0x2000) ); /* verified (the game will reset after the "game over" otherwise) */ + memory_set_bankptr( 1, memory_region(machine, REGION_CPU1) + 0x10000 + ((data&1) * 0x4000) ); + memory_set_bankptr( 2, memory_region(machine, REGION_CPU1) + 0x18000 + ((data&1) * 0x2000) ); /* verified (the game will reset after the "game over" otherwise) */ break; } } diff --git a/src/mame/drivers/taotaido.c b/src/mame/drivers/taotaido.c index 0785dbaf7cf..53b42d0ff56 100644 --- a/src/mame/drivers/taotaido.c +++ b/src/mame/drivers/taotaido.c @@ -135,7 +135,7 @@ static WRITE8_HANDLER( pending_command_clear_w ) static WRITE8_HANDLER( taotaido_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); } diff --git a/src/mame/drivers/targeth.c b/src/mame/drivers/targeth.c index 79fc0669f28..0f6a2167b40 100644 --- a/src/mame/drivers/targeth.c +++ b/src/mame/drivers/targeth.c @@ -56,7 +56,7 @@ static INTERRUPT_GEN(targeth_interrupt ) static WRITE16_HANDLER( OKIM6295_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_SOUND1); + UINT8 *RAM = memory_region(machine, REGION_SOUND1); if (ACCESSING_BITS_0_7){ memcpy(&RAM[0x30000], &RAM[0x40000 + (data & 0x0f)*0x10000], 0x10000); diff --git a/src/mame/drivers/tatsumi.c b/src/mame/drivers/tatsumi.c index d397c6ff8c5..02f53ce1376 100644 --- a/src/mame/drivers/tatsumi.c +++ b/src/mame/drivers/tatsumi.c @@ -1187,9 +1187,9 @@ ROM_END static DRIVER_INIT( apache3 ) { - UINT8 *dst = memory_region(REGION_GFX1); - UINT8 *src1 = memory_region(REGION_GFX2); - UINT8 *src2 = memory_region(REGION_GFX3); + UINT8 *dst = memory_region(machine, REGION_GFX1); + UINT8 *src1 = memory_region(machine, REGION_GFX2); + UINT8 *src2 = memory_region(machine, REGION_GFX3); int i; cpunum_set_input_line(machine, 3, INPUT_LINE_HALT, ASSERT_LINE); // ? @@ -1204,19 +1204,19 @@ static DRIVER_INIT( apache3 ) } // Copy sprite & palette data out of GFX rom area - tatsumi_rom_sprite_lookup1 = memory_region(REGION_GFX2); - tatsumi_rom_sprite_lookup2 = memory_region(REGION_GFX3); - tatsumi_rom_clut0 = memory_region(REGION_GFX2)+ 0x100000 - 0x800; - tatsumi_rom_clut1 = memory_region(REGION_GFX3)+ 0x100000 - 0x800; + tatsumi_rom_sprite_lookup1 = memory_region(machine, REGION_GFX2); + tatsumi_rom_sprite_lookup2 = memory_region(machine, REGION_GFX3); + tatsumi_rom_clut0 = memory_region(machine, REGION_GFX2)+ 0x100000 - 0x800; + tatsumi_rom_clut1 = memory_region(machine, REGION_GFX3)+ 0x100000 - 0x800; tatsumi_reset(); } static DRIVER_INIT( roundup5 ) { - UINT8 *dst = memory_region(REGION_GFX1); - UINT8 *src1 = memory_region(REGION_GFX2); - UINT8 *src2 = memory_region(REGION_GFX3); + UINT8 *dst = memory_region(machine, REGION_GFX1); + UINT8 *src1 = memory_region(machine, REGION_GFX2); + UINT8 *src2 = memory_region(machine, REGION_GFX3); int i; for (i=0; i<0xc0000; i+=32) { @@ -1229,23 +1229,23 @@ static DRIVER_INIT( roundup5 ) } // Copy sprite & palette data out of GFX rom area - tatsumi_rom_sprite_lookup1 = memory_region(REGION_GFX2); - tatsumi_rom_sprite_lookup2 = memory_region(REGION_GFX3); - tatsumi_rom_clut0 = memory_region(REGION_GFX2)+ 0xc0000 - 0x800; - tatsumi_rom_clut1 = memory_region(REGION_GFX3)+ 0xc0000 - 0x800; + tatsumi_rom_sprite_lookup1 = memory_region(machine, REGION_GFX2); + tatsumi_rom_sprite_lookup2 = memory_region(machine, REGION_GFX3); + tatsumi_rom_clut0 = memory_region(machine, REGION_GFX2)+ 0xc0000 - 0x800; + tatsumi_rom_clut1 = memory_region(machine, REGION_GFX3)+ 0xc0000 - 0x800; tatsumi_reset(); } static DRIVER_INIT( cyclwarr ) { - UINT8 *dst = memory_region(REGION_GFX1); - UINT8 *src1 = memory_region(REGION_GFX2); - int len1 = memory_region_length(REGION_GFX2); - UINT8 *src2 = memory_region(REGION_GFX3); - int len2 = memory_region_length(REGION_GFX3); + UINT8 *dst = memory_region(machine, REGION_GFX1); + UINT8 *src1 = memory_region(machine, REGION_GFX2); + int len1 = memory_region_length(machine, REGION_GFX2); + UINT8 *src2 = memory_region(machine, REGION_GFX3); + int len2 = memory_region_length(machine, REGION_GFX3); int i; - for (i=0; i<len2; i+=32) { + for (i=0; i<len1; i+=32) { memcpy(dst,src1,32); src1+=32; dst+=32; @@ -1254,11 +1254,11 @@ static DRIVER_INIT( cyclwarr ) src2+=32; } - dst = memory_region(REGION_CPU1); + dst = memory_region(machine, REGION_CPU1); memcpy(cyclwarr_cpua_ram,dst,8); memory_set_bankptr(1, dst); - dst = memory_region(REGION_CPU2); + dst = memory_region(machine, REGION_CPU2); memcpy(cyclwarr_cpub_ram,dst,8); memory_set_bankptr(2, dst); diff --git a/src/mame/drivers/tattack.c b/src/mame/drivers/tattack.c index 20d200afcc6..8b7e3e54c88 100644 --- a/src/mame/drivers/tattack.c +++ b/src/mame/drivers/tattack.c @@ -223,7 +223,7 @@ ROM_END static DRIVER_INIT(tattack) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); rom[0x1b4]=0; rom[0x1b5]=0; diff --git a/src/mame/drivers/tbowl.c b/src/mame/drivers/tbowl.c index 598e2c821fd..73f5aa5bef2 100644 --- a/src/mame/drivers/tbowl.c +++ b/src/mame/drivers/tbowl.c @@ -48,7 +48,7 @@ note: check this, its borrowed from tecmo.c / wc90.c at the moment and could wel static WRITE8_HANDLER( tbowlb_bankswitch_w ) { int bankaddress; - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); bankaddress = 0x10000 + ((data & 0xf8) << 8); @@ -58,7 +58,7 @@ static WRITE8_HANDLER( tbowlb_bankswitch_w ) static WRITE8_HANDLER( tbowlc_bankswitch_w ) { int bankaddress; - UINT8 *RAM = memory_region(REGION_CPU2); + UINT8 *RAM = memory_region(machine, REGION_CPU2); bankaddress = 0x10000 + ((data & 0xf8) << 8); @@ -201,7 +201,7 @@ static void tbowl_adpcm_int(running_machine *machine, int num) static int adpcm_data[2] = { -1, -1 }; if (adpcm_pos[num] >= adpcm_end[num] || - adpcm_pos[num] >= memory_region_length(REGION_SOUND1)/2) + adpcm_pos[num] >= memory_region_length(machine, REGION_SOUND1)/2) MSM5205_reset_w(num,1); else if (adpcm_data[num] != -1) { @@ -210,7 +210,7 @@ static void tbowl_adpcm_int(running_machine *machine, int num) } else { - UINT8 *ROM = memory_region(REGION_SOUND1) + 0x10000 * num; + UINT8 *ROM = memory_region(machine, REGION_SOUND1) + 0x10000 * num; adpcm_data[num] = ROM[adpcm_pos[num]++]; MSM5205_data_w(num,adpcm_data[num] >> 4); diff --git a/src/mame/drivers/tcl.c b/src/mame/drivers/tcl.c index e1a463d7622..d7b47ca9acb 100644 --- a/src/mame/drivers/tcl.c +++ b/src/mame/drivers/tcl.c @@ -178,8 +178,8 @@ static DRIVER_INIT(tcl) { /* only the first part is decrypted (and verified)*/ - UINT8 *dest = memory_region(REGION_CPU1); - int len = memory_region_length(REGION_CPU1); + UINT8 *dest = memory_region(machine, REGION_CPU1); + int len = memory_region_length(machine, REGION_CPU1); UINT8 *src = malloc_or_die(len); int i,idx=0; diff --git a/src/mame/drivers/tecmo.c b/src/mame/drivers/tecmo.c index 109be2b5f09..722d9f7136a 100644 --- a/src/mame/drivers/tecmo.c +++ b/src/mame/drivers/tecmo.c @@ -69,7 +69,7 @@ VIDEO_UPDATE( tecmo ); static WRITE8_HANDLER( tecmo_bankswitch_w ) { int bankaddress; - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); bankaddress = 0x10000 + ((data & 0xf8) << 8); @@ -102,7 +102,7 @@ static void tecmo_adpcm_int(running_machine *machine, int num) static int adpcm_data = -1; if (adpcm_pos >= adpcm_end || - adpcm_pos >= memory_region_length(REGION_SOUND1)) + adpcm_pos >= memory_region_length(machine, REGION_SOUND1)) MSM5205_reset_w(0,1); else if (adpcm_data != -1) { @@ -111,7 +111,7 @@ static void tecmo_adpcm_int(running_machine *machine, int num) } else { - UINT8 *ROM = memory_region(REGION_SOUND1); + UINT8 *ROM = memory_region(machine, REGION_SOUND1); adpcm_data = ROM[adpcm_pos++]; MSM5205_data_w(0,adpcm_data >> 4); diff --git a/src/mame/drivers/tecmosys.c b/src/mame/drivers/tecmosys.c index 7f9638a1346..3469751b726 100644 --- a/src/mame/drivers/tecmosys.c +++ b/src/mame/drivers/tecmosys.c @@ -539,7 +539,7 @@ GFXDECODE_END static WRITE8_HANDLER( deroon_bankswitch_w ) { - memory_set_bankptr( 1, memory_region(REGION_CPU2) + ((data-2) & 0x0f) * 0x4000 + 0x10000 ); + memory_set_bankptr( 1, memory_region(machine, REGION_CPU2) + ((data-2) & 0x0f) * 0x4000 + 0x10000 ); } static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) @@ -565,7 +565,7 @@ static WRITE8_HANDLER( tecmosys_oki_bank_w ) { UINT8 upperbank = (data & 0x30) >> 4; UINT8 lowerbank = (data & 0x03) >> 0; - UINT8* region = memory_region(REGION_SOUND2); + UINT8* region = memory_region(machine, REGION_SOUND2); memcpy( region+0x00000, region+0x80000 + lowerbank * 0x20000, 0x20000 ); memcpy( region+0x20000, region+0x80000 + upperbank * 0x20000, 0x20000 ); @@ -615,9 +615,9 @@ static VIDEO_START(deroon) } -static void tecmosys_render_sprites_to_bitmap(bitmap_t *bitmap, UINT16 extrax, UINT16 extray ) +static void tecmosys_render_sprites_to_bitmap(running_machine *machine, bitmap_t *bitmap, UINT16 extrax, UINT16 extray ) { - UINT8 *gfxsrc = memory_region ( REGION_GFX1 ); + UINT8 *gfxsrc = memory_region ( machine, REGION_GFX1 ); int i; /* render sprites (with priority information) to temp bitmap */ @@ -857,7 +857,7 @@ static VIDEO_UPDATE(deroon) // tecmosys_a80000regs[0], tecmosys_a80000regs[1], tecmosys_a80000regs[2]); // prepare sprites for NEXT frame - causes 1 frame palette errors, but prevents sprite lag in tkdensho, which is correct? - tecmosys_render_sprites_to_bitmap(bitmap, tecmosys_880000regs[0x0], tecmosys_880000regs[0x1]); + tecmosys_render_sprites_to_bitmap(screen->machine, bitmap, tecmosys_880000regs[0x0], tecmosys_880000regs[0x1]); return 0; @@ -1105,10 +1105,10 @@ static MACHINE_RESET( deroon ) device_status = DS_IDLE; } -static void tecmosys_decramble(void) +static void tecmosys_decramble(running_machine *machine) { - UINT8 *gfxsrc = memory_region ( REGION_GFX1 ); - size_t srcsize = memory_region_length( REGION_GFX1 ); + UINT8 *gfxsrc = memory_region ( machine, REGION_GFX1 ); + size_t srcsize = memory_region_length( machine, REGION_GFX1 ); int i; for (i=0; i < srcsize; i+=4) @@ -1131,19 +1131,19 @@ static void tecmosys_decramble(void) static DRIVER_INIT( deroon ) { - tecmosys_decramble(); + tecmosys_decramble(machine); device_data = &deroon_data; } static DRIVER_INIT( tkdensho ) { - tecmosys_decramble(); + tecmosys_decramble(machine); device_data = &tkdensho_data; } static DRIVER_INIT( tkdensha ) { - tecmosys_decramble(); + tecmosys_decramble(machine); device_data = &tkdensha_data; } GAME( 1995, deroon, 0, deroon, deroon, deroon, ROT0, "Tecmo", "Deroon DeroDero", 0 ) diff --git a/src/mame/drivers/tehkanwc.c b/src/mame/drivers/tehkanwc.c index 82e2a07823f..0867d213f83 100644 --- a/src/mame/drivers/tehkanwc.c +++ b/src/mame/drivers/tehkanwc.c @@ -216,7 +216,7 @@ static void tehkanwc_adpcm_int(running_machine *machine, int data) { static int toggle; - UINT8 *SAMPLES = memory_region(REGION_SOUND1); + UINT8 *SAMPLES = memory_region(machine, REGION_SOUND1); int msm_data = SAMPLES[msm_data_offs & 0x7fff]; if (toggle == 0) @@ -729,7 +729,7 @@ static DRIVER_INIT( teedoff ) 023A: 00 nop */ - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); ROM[0x0238] = 0x00; ROM[0x0239] = 0x00; diff --git a/src/mame/drivers/tetrisp2.c b/src/mame/drivers/tetrisp2.c index 852b9c901b8..8d1004b5d06 100644 --- a/src/mame/drivers/tetrisp2.c +++ b/src/mame/drivers/tetrisp2.c @@ -167,7 +167,7 @@ static READ16_HANDLER( rockn_adpcmbank_r ) static WRITE16_HANDLER( rockn_adpcmbank_w ) { - UINT8 *SNDROM = memory_region(REGION_SOUND1); + UINT8 *SNDROM = memory_region(machine, REGION_SOUND1); int bank; rockn_adpcmbank = data; @@ -184,7 +184,7 @@ static WRITE16_HANDLER( rockn_adpcmbank_w ) static WRITE16_HANDLER( rockn2_adpcmbank_w ) { - UINT8 *SNDROM = memory_region(REGION_SOUND1); + UINT8 *SNDROM = memory_region(machine, REGION_SOUND1); int bank; char banktable[9][3]= @@ -232,13 +232,13 @@ static WRITE16_HANDLER( nndmseal_sound_bank_w ) if (ACCESSING_BITS_0_7) { - UINT8 *rom = memory_region(REGION_SOUND2); + UINT8 *rom = memory_region(machine, REGION_SOUND2); if (data & 0x04) { bank_lo = data & 0x03; - memcpy(memory_region(REGION_SOUND1), rom + (bank_lo * 0x80000), 0x20000); + memcpy(memory_region(machine, REGION_SOUND1), rom + (bank_lo * 0x80000), 0x20000); // logerror("PC:%06X sound bank_lo = %02X\n",activecpu_get_pc(),bank_lo); } @@ -246,7 +246,7 @@ static WRITE16_HANDLER( nndmseal_sound_bank_w ) { bank_hi = data & 0x03; - memcpy(memory_region(REGION_SOUND1) + 0x20000, rom + (bank_lo * 0x80000) + (bank_hi * 0x20000), 0x20000); + memcpy(memory_region(machine, REGION_SOUND1) + 0x20000, rom + (bank_lo * 0x80000) + (bank_hi * 0x20000), 0x20000); // logerror("PC:%06X sound bank_hi = %02X\n",activecpu_get_pc(),bank_hi); } diff --git a/src/mame/drivers/tetriunk.c b/src/mame/drivers/tetriunk.c index 4f8082392ee..d21eb5d178c 100644 --- a/src/mame/drivers/tetriunk.c +++ b/src/mame/drivers/tetriunk.c @@ -86,7 +86,7 @@ static VIDEO_UPDATE(tetriunk) { int x,y,z; int count = 0; - UINT8 *region = memory_region(REGION_USER1); + UINT8 *region = memory_region(screen->machine, REGION_USER1); if(input_code_pressed_once(KEYCODE_Z)) { @@ -220,8 +220,8 @@ static DRIVER_INIT (tetriunk) { int i,j,k; int index=0; - UINT8 *region = memory_region(REGION_USER1); - UINT8 *gfx = memory_region(REGION_GFX2); + UINT8 *region = memory_region(machine, REGION_USER1); + UINT8 *gfx = memory_region(machine, REGION_GFX2); for(i=0;i<0x20000;i++) { diff --git a/src/mame/drivers/thedeep.c b/src/mame/drivers/thedeep.c index e7e2363af5e..ba150fa397b 100644 --- a/src/mame/drivers/thedeep.c +++ b/src/mame/drivers/thedeep.c @@ -54,7 +54,7 @@ static int rombank; static MACHINE_RESET( thedeep ) { - memory_set_bankptr(1, memory_region(REGION_CPU1) + 0x10000 + 0 * 0x4000); + memory_set_bankptr(1, memory_region(machine, REGION_CPU1) + 0x10000 + 0 * 0x4000); thedeep_scroll[0] = 0; thedeep_scroll[1] = 0; thedeep_scroll[2] = 0; @@ -87,7 +87,7 @@ static WRITE8_HANDLER( thedeep_protection_w ) int new_rombank = protection_command & 3; if (rombank == new_rombank) break; rombank = new_rombank; - rom = memory_region(REGION_CPU1); + rom = memory_region(machine, REGION_CPU1); memory_set_bankptr(1, rom + 0x10000 + rombank * 0x4000); /* there's code which falls through from the fixed ROM to bank #1, I have to */ /* copy it there otherwise the CPU bank switching support will not catch it. */ @@ -117,7 +117,7 @@ static WRITE8_HANDLER( thedeep_protection_w ) // d166-d174: hl = (hl + 2*a) // d175-d181: hl *= e (e must be non zero) // d182-d19a: hl /= de - protection_data = memory_region(REGION_CPU3)[0x185+protection_index++]; + protection_data = memory_region(machine, REGION_CPU3)[0x185+protection_index++]; else protection_data = 0xc9; diff --git a/src/mame/drivers/thepit.c b/src/mame/drivers/thepit.c index 6eff367ecbe..0f8c1dffd88 100644 --- a/src/mame/drivers/thepit.c +++ b/src/mame/drivers/thepit.c @@ -1028,7 +1028,7 @@ static READ8_HANDLER( rtriv_question_r ) // Read the actual byte from question roms else if((offset & 0xc00) == 0xc00) { - UINT8 *ROM = memory_region(REGION_USER1); + UINT8 *ROM = memory_region(machine, REGION_USER1); int real_address; real_address = (0x8000 * question_rom) | question_address | (offset & 0x3f0) | remap_address[offset & 0x0f]; diff --git a/src/mame/drivers/thief.c b/src/mame/drivers/thief.c index 90079d24411..141b95084c2 100644 --- a/src/mame/drivers/thief.c +++ b/src/mame/drivers/thief.c @@ -662,8 +662,8 @@ ROM_END static DRIVER_INIT( thief ) { - UINT8 *dest = memory_region( REGION_CPU1 ); - const UINT8 *source = memory_region( REGION_CPU2 ); + UINT8 *dest = memory_region( machine, REGION_CPU1 ); + const UINT8 *source = memory_region( machine, REGION_CPU2 ); /* C8 is mapped (banked) in CPU1's address space; it contains Z80 code */ memcpy( &dest[0xe010], &source[0x290], 0x20 ); diff --git a/src/mame/drivers/thoop2.c b/src/mame/drivers/thoop2.c index bf143835963..4205caf2109 100644 --- a/src/mame/drivers/thoop2.c +++ b/src/mame/drivers/thoop2.c @@ -70,7 +70,7 @@ ADDRESS_MAP_END static WRITE16_HANDLER( OKIM6295_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_SOUND1); + UINT8 *RAM = memory_region(machine, REGION_SOUND1); if (ACCESSING_BITS_0_7){ memcpy(&RAM[0x30000], &RAM[0x40000 + (data & 0x0f)*0x10000], 0x10000); diff --git a/src/mame/drivers/thunderj.c b/src/mame/drivers/thunderj.c index 1d17a68e21c..6e8159b38a3 100644 --- a/src/mame/drivers/thunderj.c +++ b/src/mame/drivers/thunderj.c @@ -63,8 +63,8 @@ static MACHINE_RESET( thunderj ) atarivc_reset(machine->primary_screen, atarivc_eof_data, 2); atarijsa_reset(); - rom_base[0] = (UINT16 *)memory_region(REGION_CPU1); - rom_base[1] = (UINT16 *)memory_region(REGION_CPU2); + rom_base[0] = (UINT16 *)memory_region(machine, REGION_CPU1); + rom_base[1] = (UINT16 *)memory_region(machine, REGION_CPU2); memory_set_bankptr(1, shared_ram); } diff --git a/src/mame/drivers/thunderx.c b/src/mame/drivers/thunderx.c index d6fc70c3698..cb18469c9e9 100644 --- a/src/mame/drivers/thunderx.c +++ b/src/mame/drivers/thunderx.c @@ -9,6 +9,7 @@ K052591 emulation by Eddie Edwards ***************************************************************************/ #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/2151intf.h" @@ -316,7 +317,7 @@ static WRITE8_HANDLER( thunderx_1f98_w ) static WRITE8_HANDLER( scontra_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); int offs; //logerror("%04x: bank switch %02x\n",activecpu_get_pc(),data); @@ -1024,7 +1025,7 @@ ROM_END static void thunderx_banking( int lines ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(Machine, REGION_CPU1); int offs; // logerror("thunderx %04x: bank select %02x\n", activecpu_get_pc(), lines ); @@ -1036,14 +1037,14 @@ static void thunderx_banking( int lines ) static MACHINE_RESET( scontra ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); paletteram = &RAM[0x30000]; } static MACHINE_RESET( thunderx ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); cpunum_set_info_fct(0, CPUINFO_PTR_KONAMI_SETLINES_CALLBACK, (genf *)thunderx_banking); memory_set_bankptr( 1, &RAM[0x10000] ); /* init the default bank */ diff --git a/src/mame/drivers/tmaster.c b/src/mame/drivers/tmaster.c index 123975bb539..742cfa45bea 100644 --- a/src/mame/drivers/tmaster.c +++ b/src/mame/drivers/tmaster.c @@ -318,12 +318,12 @@ static WRITE16_HANDLER( tmaster_addr_w ) COMBINE_DATA( &tmaster_addr ); } -static void tmaster_draw(void) +static void tmaster_draw(running_machine *machine) { int x,y,x0,x1,y0,y1,dx,dy,flipx,flipy,sx,sy,sw,sh, addr, mode, layer,buffer, color; - UINT8 *gfxdata = memory_region( REGION_GFX1 ); - size_t size = memory_region_length( REGION_GFX1 ); + UINT8 *gfxdata = memory_region( machine, REGION_GFX1 ); + size_t size = memory_region_length( machine, REGION_GFX1 ); UINT16 data; @@ -407,7 +407,7 @@ static WRITE16_HANDLER( tmaster_blitter_w ) switch (offset*2) { case 0x0e: - tmaster_draw(); + tmaster_draw(machine); cpunum_set_input_line(machine, 0, 2, HOLD_LINE); break; } @@ -540,12 +540,12 @@ static WRITE16_HANDLER( galgames_palette_data_w ) // Sound static READ16_HANDLER( galgames_okiram_r ) { - return memory_region(REGION_SOUND1)[offset] | 0xff00; + return memory_region(machine, REGION_SOUND1)[offset] | 0xff00; } static WRITE16_HANDLER( galgames_okiram_w ) { if (ACCESSING_BITS_0_7) - memory_region(REGION_SOUND1)[offset] = data & 0xff; + memory_region(machine, REGION_SOUND1)[offset] = data & 0xff; } @@ -1190,7 +1190,7 @@ ROM_END static DRIVER_INIT( tm4k ) { - UINT16 *ROM = (UINT16 *)memory_region( REGION_CPU1 ); + UINT16 *ROM = (UINT16 *)memory_region( machine, REGION_CPU1 ); // protection ROM[0x83476/2] = 0x4e75; @@ -1211,7 +1211,7 @@ Protection starts: static DRIVER_INIT( tm5k ) { - UINT16 *ROM = (UINT16 *)memory_region( REGION_CPU1 ); + UINT16 *ROM = (UINT16 *)memory_region( machine, REGION_CPU1 ); // protection ROM[0x96002/2] = 0x4e75; @@ -1234,7 +1234,7 @@ Protection starts: static DRIVER_INIT( tm7k ) { - UINT16 *ROM = (UINT16 *)memory_region( REGION_CPU1 ); + UINT16 *ROM = (UINT16 *)memory_region( machine, REGION_CPU1 ); // protection ROM[0x81730/2] = 0x4e75; @@ -1257,7 +1257,7 @@ Protection starts: static DRIVER_INIT( tm7ka ) { - UINT16 *ROM = (UINT16 *)memory_region( REGION_CPU1 ); + UINT16 *ROM = (UINT16 *)memory_region( machine, REGION_CPU1 ); // protection ROM[0x81594/2] = 0x4e75; @@ -1280,7 +1280,7 @@ Protection starts: static DRIVER_INIT( galgames ) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); // configure memory banks memory_configure_bank(1, 0, 2, ROM+0x1c0000, 0x40000); memory_configure_bank(3, 0, 2, ROM+0x1c0000, 0x40000); diff --git a/src/mame/drivers/tmnt.c b/src/mame/drivers/tmnt.c index d3fc747326b..022280b4a70 100644 --- a/src/mame/drivers/tmnt.c +++ b/src/mame/drivers/tmnt.c @@ -279,7 +279,7 @@ static WRITE16_HANDLER( prmrsocr_sound_irq_w ) static WRITE8_HANDLER( prmrsocr_audio_bankswitch_w ) { - UINT8 *rom = memory_region(REGION_CPU2) + 0x10000; + UINT8 *rom = memory_region(machine, REGION_CPU2) + 0x10000; memory_set_bankptr(1,rom + (data & 7) * 0x4000); } @@ -313,7 +313,7 @@ static WRITE8_HANDLER( tmnt_sres_w ) static void tmnt_decode_sample(void) { int i; - UINT8 *source = memory_region(REGION_SOUND3); + UINT8 *source = memory_region(Machine, REGION_SOUND3); sampledata = auto_malloc(0x40000*sizeof(sampledata[0])); @@ -1054,7 +1054,7 @@ static WRITE16_HANDLER( tmnt2_1c0800_w ) CellSrc = tmnt2_1c0800[0x00] | (tmnt2_1c0800[0x01] << 16 ); // if ( CellDest >= 0x180000 && CellDest < 0x183fe0 ) { CellVar -= 0x104000; - src = (UINT16 *)(memory_region(REGION_CPU1) + CellSrc); + src = (UINT16 *)(memory_region(machine, REGION_CPU1) + CellSrc); CellVar >>= 1; @@ -3955,8 +3955,8 @@ static DRIVER_INIT( mia ) be shuffled around because the ROMs are connected differently to the 051962 custom IC. */ - gfxdata = memory_region(REGION_GFX1); - len = memory_region_length(REGION_GFX1); + gfxdata = memory_region(machine, REGION_GFX1); + len = memory_region_length(machine, REGION_GFX1); for (i = 0;i < len;i += 4) { for (j = 0;j < 4;j++) @@ -3976,8 +3976,8 @@ static DRIVER_INIT( mia ) be shuffled around because the ROMs are connected differently to the 051937 custom IC. */ - gfxdata = memory_region(REGION_GFX2); - len = memory_region_length(REGION_GFX2); + gfxdata = memory_region(machine, REGION_GFX2); + len = memory_region_length(machine, REGION_GFX2); for (i = 0;i < len;i += 4) { for (j = 0;j < 4;j++) @@ -4051,8 +4051,8 @@ static DRIVER_INIT( tmnt ) be shuffled around because the ROMs are connected differently to the 051962 custom IC. */ - gfxdata = memory_region(REGION_GFX1); - len = memory_region_length(REGION_GFX1); + gfxdata = memory_region(machine, REGION_GFX1); + len = memory_region_length(machine, REGION_GFX1); for (i = 0;i < len;i += 4) { for (j = 0;j < 4;j++) @@ -4072,8 +4072,8 @@ static DRIVER_INIT( tmnt ) be shuffled around because the ROMs are connected differently to the 051937 custom IC. */ - gfxdata = memory_region(REGION_GFX2); - len = memory_region_length(REGION_GFX2); + gfxdata = memory_region(machine, REGION_GFX2); + len = memory_region_length(machine, REGION_GFX2); for (i = 0;i < len;i += 4) { for (j = 0;j < 4;j++) @@ -4090,7 +4090,7 @@ static DRIVER_INIT( tmnt ) temp = malloc_or_die(len); memcpy(temp,gfxdata,len); - code_conv_table = &memory_region(REGION_PROMS)[0x0000]; + code_conv_table = &memory_region(machine, REGION_PROMS)[0x0000]; for (A = 0;A < len/4;A++) { #define CA0 0 @@ -4168,8 +4168,8 @@ static void shuffle(UINT8 *buf,int len) static DRIVER_INIT( glfgreat ) { /* ROMs are interleaved at byte level */ - shuffle(memory_region(REGION_GFX1),memory_region_length(REGION_GFX1)); - shuffle(memory_region(REGION_GFX2),memory_region_length(REGION_GFX2)); + shuffle(memory_region(machine, REGION_GFX1),memory_region_length(machine, REGION_GFX1)); + shuffle(memory_region(machine, REGION_GFX2),memory_region_length(machine, REGION_GFX2)); } static DRIVER_INIT( cuebrick ) @@ -4178,8 +4178,8 @@ static DRIVER_INIT( cuebrick ) generic_nvram_size = 0x400*0x20; /* ROMs are interleaved at byte level */ - shuffle(memory_region(REGION_GFX1),memory_region_length(REGION_GFX1)); - shuffle(memory_region(REGION_GFX2),memory_region_length(REGION_GFX2)); + shuffle(memory_region(machine, REGION_GFX1),memory_region_length(machine, REGION_GFX1)); + shuffle(memory_region(machine, REGION_GFX2),memory_region_length(machine, REGION_GFX2)); } GAME( 1989, cuebrick, 0, cuebrick, cuebrick, cuebrick, ROT0, "Konami", "Cue Brick (World version D)", 0 ) diff --git a/src/mame/drivers/tnzs.c b/src/mame/drivers/tnzs.c index 394f6b13bb8..18c01491011 100644 --- a/src/mame/drivers/tnzs.c +++ b/src/mame/drivers/tnzs.c @@ -246,6 +246,7 @@ Driver by Takahiro Nogi (nogi@kt.rim.or.jp) 1999/11/06 #include "driver.h" +#include "deprecat.h" #include "cpu/i8x41/i8x41.h" #include "sound/2203intf.h" #include "sound/dac.h" @@ -270,7 +271,7 @@ static void kageki_init_samples(void) int start, size; int i, n; - src = memory_region(REGION_SOUND1) + 0x0090; + src = memory_region(Machine, REGION_SOUND1) + 0x0090; for (i = 0; i < MAX_SAMPLES; i++) { start = (src[(i * 2) + 1] * 256) + src[(i * 2)]; @@ -362,7 +363,7 @@ static WRITE8_HANDLER( kabukiz_sound_bank_w ) // to avoid the write when the sound chip is initialized if(data != 0xff) { - UINT8 *ROM = memory_region(REGION_CPU3); + UINT8 *ROM = memory_region(machine, REGION_CPU3); memory_set_bankptr(3, &ROM[0x10000 + 0x4000 * (data & 0x07)]); } } @@ -589,7 +590,7 @@ READ8_HANDLER( bbb_r ) static WRITE8_HANDLER( jpopnics_subbankswitch_w ) { - UINT8 *RAM = memory_region(REGION_CPU2); + UINT8 *RAM = memory_region(machine, REGION_CPU2); /* bits 0-1 select ROM bank */ memory_set_bankptr (2, &RAM[0x10000 + 0x2000 * (data & 3)]); diff --git a/src/mame/drivers/toaplan2.c b/src/mame/drivers/toaplan2.c index 3f03e500e36..df4c67b3289 100644 --- a/src/mame/drivers/toaplan2.c +++ b/src/mame/drivers/toaplan2.c @@ -432,7 +432,7 @@ static MACHINE_RESET( vfive ) static MACHINE_RESET( bgaregga ) { - UINT8 *Z80 = (UINT8 *)memory_region(REGION_CPU2); + UINT8 *Z80 = (UINT8 *)memory_region(machine, REGION_CPU2); // Set Z80 bank switch - default bank is 2 current_bank = 2; @@ -476,7 +476,7 @@ static DRIVER_INIT( fixeight ) static DRIVER_INIT( fixeighb ) { - UINT16 *bgdata = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *bgdata = (UINT16 *)memory_region(machine, REGION_CPU1); memory_set_bankptr(1, &bgdata[0x40000]); /* $80000 - $fffff */ toaplan2_sub_cpu = CPU_2_NONE; @@ -487,7 +487,7 @@ static DRIVER_INIT( pipibibi ) int A; int oldword, newword; - UINT16 *pipibibi_68k_rom = (UINT16 *)(memory_region(REGION_CPU1)); + UINT16 *pipibibi_68k_rom = (UINT16 *)(memory_region(machine, REGION_CPU1)); /* unscramble the 68K ROM data. */ @@ -1052,7 +1052,7 @@ static WRITE16_HANDLER( fixeighb_oki_bankswitch_w ) data &= 7; if (data <= 4) { - UINT8 *fixeighb_oki = memory_region(REGION_SOUND1); + UINT8 *fixeighb_oki = memory_region(machine, REGION_SOUND1); memcpy(&fixeighb_oki[0x30000], &fixeighb_oki[(data * 0x10000) + 0x40000], 0x10000); } } @@ -1108,7 +1108,7 @@ static WRITE8_HANDLER( bgaregga_E00C_w ) static WRITE8_HANDLER( bgaregga_bankswitch_w ) { - UINT8 *RAM = (UINT8 *)memory_region(REGION_CPU2); + UINT8 *RAM = (UINT8 *)memory_region(machine, REGION_CPU2); int bankaddress; int bank; @@ -1155,7 +1155,7 @@ static WRITE8_HANDLER( raizing_okim6295_bankselect_3 ) static WRITE8_HANDLER( batrider_bankswitch_w ) { - UINT8 *RAM = (UINT8 *)memory_region(REGION_CPU2); + UINT8 *RAM = (UINT8 *)memory_region(machine, REGION_CPU2); int bankaddress; int bank; @@ -1197,7 +1197,7 @@ static WRITE16_HANDLER( batrider_z80_busreq_w ) static READ16_HANDLER( raizing_z80rom_r ) { - UINT8 *Z80_ROM_test = (UINT8 *)memory_region(REGION_CPU2); + UINT8 *Z80_ROM_test = (UINT8 *)memory_region(machine, REGION_CPU2); if (offset < 0x8000) return Z80_ROM_test[offset] & 0xff; diff --git a/src/mame/drivers/toki.c b/src/mame/drivers/toki.c index 4fcc761901d..475657382dc 100644 --- a/src/mame/drivers/toki.c +++ b/src/mame/drivers/toki.c @@ -87,7 +87,7 @@ static void toki_adpcm_int (running_machine *machine, int data) static WRITE8_HANDLER( toki_adpcm_control_w ) { int bankaddress; - UINT8 *RAM = memory_region(REGION_CPU2); + UINT8 *RAM = memory_region(machine, REGION_CPU2); /* the code writes either 2 or 3 in the bottom two bits */ @@ -731,7 +731,7 @@ ROM_END static DRIVER_INIT( toki ) { - UINT8 *ROM = memory_region(REGION_SOUND1); + UINT8 *ROM = memory_region(machine, REGION_SOUND1); UINT8 *buffer = malloc_or_die(0x20000); int i; @@ -743,7 +743,7 @@ static DRIVER_INIT( toki ) free(buffer); - seibu_sound_decrypt(REGION_CPU2,0x2000); + seibu_sound_decrypt(machine,REGION_CPU2,0x2000); } @@ -754,14 +754,14 @@ static DRIVER_INIT( tokib ) UINT8 *rom; /* invert the sprite data in the ROMs */ - len = memory_region_length(REGION_GFX2); - rom = memory_region(REGION_GFX2); + len = memory_region_length(machine, REGION_GFX2); + rom = memory_region(machine, REGION_GFX2); for (i = 0; i < len; i++) rom[i] ^= 0xff; /* merge background tile graphics together */ - len = memory_region_length(REGION_GFX3); - rom = memory_region(REGION_GFX3); + len = memory_region_length(machine, REGION_GFX3); + rom = memory_region(machine, REGION_GFX3); for (offs = 0; offs < len; offs += 0x20000) { UINT8 *base = &rom[offs]; @@ -774,8 +774,8 @@ static DRIVER_INIT( tokib ) memcpy (&base[0x18000 + i * 0x800], &temp[0x1800 + i * 0x2000], 0x800); } } - len = memory_region_length(REGION_GFX4); - rom = memory_region(REGION_GFX4); + len = memory_region_length(machine, REGION_GFX4); + rom = memory_region(machine, REGION_GFX4); for (offs = 0; offs < len; offs += 0x20000) { UINT8 *base = &rom[offs]; @@ -797,7 +797,7 @@ static DRIVER_INIT(jujub) /* Program ROMs are bitswapped */ { int i; - UINT16 *prgrom = (UINT16*)memory_region(REGION_CPU1); + UINT16 *prgrom = (UINT16*)memory_region(machine, REGION_CPU1); for (i = 0; i < 0x60000/2; i++) { @@ -811,7 +811,7 @@ static DRIVER_INIT(jujub) /* Decrypt data for z80 program */ { UINT8 *decrypt = auto_malloc(0x20000); - UINT8 *rom = memory_region(REGION_CPU2); + UINT8 *rom = memory_region(machine, REGION_CPU2); int i; memcpy(decrypt,rom,0x20000); @@ -826,7 +826,7 @@ static DRIVER_INIT(jujub) } { - UINT8 *ROM = memory_region(REGION_SOUND1); + UINT8 *ROM = memory_region(machine, REGION_SOUND1); UINT8 *buffer = malloc_or_die(0x20000); int i; diff --git a/src/mame/drivers/topshoot.c b/src/mame/drivers/topshoot.c index c294cd663e0..cb60dc1018c 100644 --- a/src/mame/drivers/topshoot.c +++ b/src/mame/drivers/topshoot.c @@ -304,7 +304,7 @@ static DRIVER_INIT(topshoot) /* hack -- fix vdp emulation instead */ memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xC00004, 0xC00005, 0, 0, vdp_fake_r); - memory_set_bankptr(3, memory_region(REGION_CPU1) ); + memory_set_bankptr(3, memory_region(machine, REGION_CPU1) ); memory_set_bankptr(4, genesis_68k_ram ); } diff --git a/src/mame/drivers/topspeed.c b/src/mame/drivers/topspeed.c index 88d6f87e7d5..810ca17f203 100644 --- a/src/mame/drivers/topspeed.c +++ b/src/mame/drivers/topspeed.c @@ -402,15 +402,15 @@ logerror("CPU #0 PC %06x: warning - write %04x to motor cpu %03x\n",activecpu_ge static INT32 banknum = -1; -static void reset_sound_region(void) +static void reset_sound_region(running_machine *machine) { - memory_set_bankptr( 10, memory_region(REGION_CPU2) + (banknum * 0x4000) + 0x10000 ); + memory_set_bankptr( 10, memory_region(machine, REGION_CPU2) + (banknum * 0x4000) + 0x10000 ); } static WRITE8_HANDLER( sound_bankswitch_w ) /* assumes Z80 sandwiched between 68Ks */ { banknum = (data - 1) & 7; - reset_sound_region(); + reset_sound_region(machine); } static int adpcm_pos; @@ -426,7 +426,7 @@ static void topspeed_msm5205_vck(running_machine *machine, int chip) } else { - adpcm_data = memory_region(REGION_SOUND1)[adpcm_pos]; + adpcm_data = memory_region(machine, REGION_SOUND1)[adpcm_pos]; adpcm_pos = (adpcm_pos + 1) & 0x1ffff; MSM5205_data_w(0, adpcm_data >> 4); } @@ -681,7 +681,7 @@ static const struct MSM5205interface msm5205_interface = static STATE_POSTLOAD( topspeed_postload ) { parse_control(machine); - reset_sound_region(); + reset_sound_region(machine); } static MACHINE_START( topspeed ) diff --git a/src/mame/drivers/trackfld.c b/src/mame/drivers/trackfld.c index 6662434c317..95f8352ae47 100644 --- a/src/mame/drivers/trackfld.c +++ b/src/mame/drivers/trackfld.c @@ -79,7 +79,7 @@ static WRITE8_HANDLER( questions_bank_w ) { if( data != 0xff ) { - UINT8 *questions = memory_region(REGION_USER1); + UINT8 *questions = memory_region(machine, REGION_USER1); int bankaddr = 0; switch( ~data & 0xff ) @@ -1248,17 +1248,17 @@ ROM_END static DRIVER_INIT( trackfld ) { - konami1_decode(0); + konami1_decode(machine, 0); } static DRIVER_INIT( atlantol ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); UINT8 *decrypt; int A; /* "konami1" encrypted opcodes */ - decrypt = konami1_decode(0); + decrypt = konami1_decode(machine, 0); /* not encrypted opcodes */ for (A = 0;A < 0x6000;A++) @@ -1271,7 +1271,7 @@ static DRIVER_INIT( atlantol ) static DRIVER_INIT( mastkin ) { - UINT8 *prom = memory_region(REGION_PROMS); + UINT8 *prom = memory_region(machine, REGION_PROMS); int i; /* build a fake palette so the screen won't be all black */ @@ -1292,14 +1292,14 @@ static DRIVER_INIT( mastkin ) static DRIVER_INIT( wizzquiz ) { - UINT8 *ROM = memory_region(REGION_CPU1) + 0xe000; + UINT8 *ROM = memory_region(machine, REGION_CPU1) + 0xe000; int i; /* decrypt program rom */ for( i = 0; i < 0x2000; i++ ) ROM[i] = BITSWAP8(ROM[i],0,1,2,3,4,5,6,7); - ROM = memory_region(REGION_USER1); + ROM = memory_region(machine, REGION_USER1); /* decrypt questions roms */ for( i = 0; i < 0x40000; i++ ) diff --git a/src/mame/drivers/travrusa.c b/src/mame/drivers/travrusa.c index 6b8f9375d7c..8572b4deee4 100644 --- a/src/mame/drivers/travrusa.c +++ b/src/mame/drivers/travrusa.c @@ -480,7 +480,7 @@ ROM_END static DRIVER_INIT( motorace ) { int A,j; - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); UINT8 *buffer = malloc_or_die(0x2000); memcpy(buffer,rom,0x2000); @@ -498,7 +498,7 @@ static DRIVER_INIT( motorace ) static DRIVER_INIT( shtridra ) { int A; - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); /* D3/D4 and D5/D6 swapped */ for (A = 0; A < 0x2000; A++) diff --git a/src/mame/drivers/trucocl.c b/src/mame/drivers/trucocl.c index 63759f3b32e..c33790c08e0 100644 --- a/src/mame/drivers/trucocl.c +++ b/src/mame/drivers/trucocl.c @@ -58,7 +58,7 @@ static TIMER_CALLBACK( dac_irq ) static WRITE8_HANDLER( audio_dac_w) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); int dac_address = ( data & 0xf0 ) << 8; int sel = ( ( (~data) >> 1 ) & 2 ) | ( data & 1 ); diff --git a/src/mame/drivers/trvmadns.c b/src/mame/drivers/trvmadns.c index 425feab57f9..108f4ef0249 100644 --- a/src/mame/drivers/trvmadns.c +++ b/src/mame/drivers/trvmadns.c @@ -79,7 +79,7 @@ static WRITE8_HANDLER( trvmadns_banking_w ) } else if((data & 0xf0) == 0x80 || (data & 0xf0) == 0x90) { - rom = memory_region(REGION_USER2); + rom = memory_region(machine, REGION_USER2); switch(data & 0xf) { @@ -106,7 +106,7 @@ static WRITE8_HANDLER( trvmadns_banking_w ) // logerror("port80 = %02X\n",old=data); } - rom = memory_region(REGION_USER1); + rom = memory_region(machine, REGION_USER1); /* 7 diff --git a/src/mame/drivers/trvquest.c b/src/mame/drivers/trvquest.c index d7e177478fc..e2b26bc987c 100644 --- a/src/mame/drivers/trvquest.c +++ b/src/mame/drivers/trvquest.c @@ -43,7 +43,7 @@ static READ8_HANDLER( trvquest_question_r ) { gameplan_state *state = machine->driver_data; - return memory_region(REGION_USER1)[*state->trvquest_question * 0x2000 + offset]; + return memory_region(machine, REGION_USER1)[*state->trvquest_question * 0x2000 + offset]; } static WRITE8_HANDLER( trvquest_coin_w ) diff --git a/src/mame/drivers/tryout.c b/src/mame/drivers/tryout.c index 37564c56f51..e1c4c13f963 100644 --- a/src/mame/drivers/tryout.c +++ b/src/mame/drivers/tryout.c @@ -46,7 +46,7 @@ static WRITE8_HANDLER( tryout_sound_irq_ack_w ) static WRITE8_HANDLER( tryout_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); int bankaddress; bankaddress = 0x10000 + (data & 0x01) * 0x2000; diff --git a/src/mame/drivers/ttchamp.c b/src/mame/drivers/ttchamp.c index e2e17e1028f..c5ddba7f276 100644 --- a/src/mame/drivers/ttchamp.c +++ b/src/mame/drivers/ttchamp.c @@ -92,7 +92,7 @@ static WRITE16_HANDLER( paloff_w ) static WRITE16_HANDLER( pcup_prgbank_w ) { int bank; - UINT8 *ROM1 = memory_region(REGION_USER1); + UINT8 *ROM1 = memory_region(machine, REGION_USER1); if (ACCESSING_BITS_0_7) { @@ -321,7 +321,7 @@ ROM_END static DRIVER_INIT (ttchamp) { - UINT8 *ROM1 = memory_region(REGION_USER1); + UINT8 *ROM1 = memory_region(machine, REGION_USER1); memory_set_bankptr(1,&ROM1[0x120000]); memory_set_bankptr(2,&ROM1[0x180000]); } diff --git a/src/mame/drivers/tumbleb.c b/src/mame/drivers/tumbleb.c index 50657e69fb8..7a447fc3426 100644 --- a/src/mame/drivers/tumbleb.c +++ b/src/mame/drivers/tumbleb.c @@ -483,9 +483,9 @@ static const int tumbleb_sound_lookup[256] = { }; /* we use channels 1,2,3 for sound effects, and channel 4 for music */ -static void tumbleb2_set_music_bank(int bank) +static void tumbleb2_set_music_bank(running_machine *machine, int bank) { - UINT8 *oki = memory_region(REGION_SOUND1); + UINT8 *oki = memory_region(machine, REGION_SOUND1); memcpy(&oki[0x38000], &oki[0x80000+0x38000+0x8000*bank],0x8000); } @@ -612,7 +612,7 @@ static void process_tumbleb2_music_command(running_machine *machine, int data) tumblep_music_command = 0x38; break; } - tumbleb2_set_music_bank(tumblep_music_bank); + tumbleb2_set_music_bank(machine, tumblep_music_bank); tumbleb2_playmusic(machine); } @@ -858,7 +858,7 @@ static WRITE16_HANDLER( semicom_soundcmd_w ) static WRITE8_HANDLER( oki_sound_bank_w ) { - UINT8 *oki = memory_region(REGION_SOUND1); + UINT8 *oki = memory_region(machine, REGION_SOUND1); memcpy(&oki[0x30000], &oki[(data * 0x10000) + 0x40000], 0x10000); } @@ -882,7 +882,7 @@ ADDRESS_MAP_END static WRITE8_HANDLER(jumppop_z80_bank_w) { - memory_set_bankptr(1, memory_region(REGION_CPU2) + 0x10000 + (0x4000 * data)); + memory_set_bankptr(1, memory_region(machine, REGION_CPU2) + 0x10000 + (0x4000 * data)); } static ADDRESS_MAP_START( jumppop_sound_map, ADDRESS_SPACE_PROGRAM, 8 ) @@ -939,8 +939,8 @@ ADDRESS_MAP_END static WRITE8_HANDLER( jumpkids_oki_bank_w ) { - UINT8* sound1 = memory_region(REGION_SOUND1); - UINT8* sound2 = memory_region(REGION_SOUND2); + UINT8* sound1 = memory_region(machine, REGION_SOUND1); + UINT8* sound2 = memory_region(machine, REGION_SOUND2); int bank = data & 0x03; memcpy (sound1+0x20000, sound2+bank*0x20000, 0x20000); @@ -2167,8 +2167,8 @@ static MACHINE_RESET (htchctch) { /* copy protection data every reset */ - UINT16 *PROTDATA = (UINT16*)memory_region(REGION_USER1); - int i, len = memory_region_length(REGION_USER1); + UINT16 *PROTDATA = (UINT16*)memory_region(machine, REGION_USER1); + int i, len = memory_region_length(machine, REGION_USER1); for (i = 0;i < len/2;i++) tumblepb_mainram[0x000/2 + i] = PROTDATA[i]; @@ -3282,17 +3282,17 @@ ROM_END void tumblepb_patch_code(UINT16 offset) { /* A hack which enables all Dip Switches effects */ - UINT16 *RAM = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *RAM = (UINT16 *)memory_region(Machine, REGION_CPU1); RAM[(offset + 0)/2] = 0x0240; RAM[(offset + 2)/2] = 0xffff; // andi.w #$f3ff, D0 } #endif -static void tumblepb_gfx1_rearrange(void) +static void tumblepb_gfx1_rearrange(running_machine *machine) { - UINT8 *rom = memory_region(REGION_GFX1); - int len = memory_region_length(REGION_GFX1); + UINT8 *rom = memory_region(machine, REGION_GFX1); + int len = memory_region_length(machine, REGION_GFX1); int i; /* gfx data is in the wrong order */ @@ -3312,7 +3312,7 @@ static void tumblepb_gfx1_rearrange(void) static DRIVER_INIT( tumblepb ) { - tumblepb_gfx1_rearrange(); + tumblepb_gfx1_rearrange(machine); #if TUMBLEP_HACK tumblepb_patch_code(0x000132); @@ -3321,7 +3321,7 @@ static DRIVER_INIT( tumblepb ) static DRIVER_INIT( tumbleb2 ) { - tumblepb_gfx1_rearrange(); + tumblepb_gfx1_rearrange(machine); #if TUMBLEP_HACK tumblepb_patch_code(0x000132); @@ -3333,7 +3333,7 @@ static DRIVER_INIT( tumbleb2 ) static DRIVER_INIT( jumpkids ) { - tumblepb_gfx1_rearrange(); + tumblepb_gfx1_rearrange(machine); #if TUMBLEP_HACK tumblepb_patch_code(0x00013a); @@ -3345,12 +3345,12 @@ static DRIVER_INIT( fncywld ) #if FNCYWLD_HACK /* This is a hack to allow you to use the extra features of the 2 first "Unused" Dip Switch (see notes above). */ - UINT16 *RAM = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *RAM = (UINT16 *)memory_region(machine, REGION_CPU1); RAM[0x0005fa/2] = 0x4e71; RAM[0x00060a/2] = 0x4e71; #endif - tumblepb_gfx1_rearrange(); + tumblepb_gfx1_rearrange(machine); } @@ -3363,7 +3363,7 @@ static READ16_HANDLER( bcstory_1a0_read ) static DRIVER_INIT ( bcstory ) { - tumblepb_gfx1_rearrange(); + tumblepb_gfx1_rearrange(machine); memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x180008, 0x180009, 0, 0, bcstory_1a0_read ); // io should be here?? } @@ -3372,9 +3372,9 @@ static DRIVER_INIT ( bcstory ) static DRIVER_INIT( htchctch ) { -// UINT16 *HCROM = (UINT16*)memory_region(REGION_CPU1); - UINT16 *PROTDATA = (UINT16*)memory_region(REGION_USER1); - int i, len = memory_region_length(REGION_USER1); +// UINT16 *HCROM = (UINT16*)memory_region(machine, REGION_CPU1); + UINT16 *PROTDATA = (UINT16*)memory_region(machine, REGION_USER1); + int i, len = memory_region_length(machine, REGION_USER1); /* simulate RAM initialization done by the protection MCU */ /* verified on real hardware */ // static UINT16 htchctch_mcu68k[] = @@ -3391,7 +3391,7 @@ static DRIVER_INIT( htchctch ) - tumblepb_gfx1_rearrange(); + tumblepb_gfx1_rearrange(machine); /* trojan.. */ #if 0 @@ -3624,9 +3624,9 @@ static DRIVER_INIT( htchctch ) } -static void suprtrio_decrypt_code(void) +static void suprtrio_decrypt_code(running_machine *machine) { - UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *rom = (UINT16 *)memory_region(machine, REGION_CPU1); UINT16 *buf = malloc_or_die(0x80000); int i; @@ -3644,9 +3644,9 @@ static void suprtrio_decrypt_code(void) } } -static void suprtrio_decrypt_gfx(void) +static void suprtrio_decrypt_gfx(running_machine *machine) { - UINT16 *rom = (UINT16 *)memory_region(REGION_GFX1); + UINT16 *rom = (UINT16 *)memory_region(machine, REGION_GFX1); UINT16 *buf = malloc_or_die(0x100000); int i; @@ -3663,8 +3663,8 @@ static void suprtrio_decrypt_gfx(void) static DRIVER_INIT( suprtrio ) { - suprtrio_decrypt_code(); - suprtrio_decrypt_gfx(); + suprtrio_decrypt_code(machine); + suprtrio_decrypt_gfx(machine); } static DRIVER_INIT( chokchok ) @@ -3688,7 +3688,7 @@ static DRIVER_INIT( wlstar ) static DRIVER_INIT ( dquizgo ) { - tumblepb_gfx1_rearrange(); + tumblepb_gfx1_rearrange(machine); } diff --git a/src/mame/drivers/tumblep.c b/src/mame/drivers/tumblep.c index d20f0b5b1f3..8ee76eccc6d 100644 --- a/src/mame/drivers/tumblep.c +++ b/src/mame/drivers/tumblep.c @@ -383,7 +383,7 @@ ROM_END void tumblep_patch_code(UINT16 offset) { /* A hack which enables all Dip Switches effects */ - UINT16 *RAM = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *RAM = (UINT16 *)memory_region(machine, REGION_CPU1); RAM[(offset + 0)/2] = 0x0240; RAM[(offset + 2)/2] = 0xffff; // andi.w #$f3ff, D0 } @@ -391,7 +391,7 @@ void tumblep_patch_code(UINT16 offset) static DRIVER_INIT( tumblep ) { - deco56_decrypt(REGION_GFX1); + deco56_decrypt(machine, REGION_GFX1); #if TUMBLEP_HACK tumblep_patch_code(0x000132); diff --git a/src/mame/drivers/turbo.c b/src/mame/drivers/turbo.c index e9d1975528d..9138f0b66a8 100644 --- a/src/mame/drivers/turbo.c +++ b/src/mame/drivers/turbo.c @@ -1518,7 +1518,7 @@ ROM_END * *************************************/ -static void turbo_rom_decode(void) +static void turbo_rom_decode(running_machine *machine) { /* * The table is arranged this way (second half is mirror image of first) @@ -1604,7 +1604,7 @@ static void turbo_rom_decode(void) 2,1,2,1 /* 0x5000-0x5fff */ }; - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); int offs, i, j; UINT8 src; @@ -1628,13 +1628,13 @@ static void turbo_rom_decode(void) static DRIVER_INIT( turbo_enc ) { - turbo_rom_decode(); + turbo_rom_decode(machine); } static DRIVER_INIT( buckrog_enc ) { - buckrog_decode(); + buckrog_decode(machine); } diff --git a/src/mame/drivers/turbosub.c b/src/mame/drivers/turbosub.c index 5ab6778495b..95103e87ea9 100644 --- a/src/mame/drivers/turbosub.c +++ b/src/mame/drivers/turbosub.c @@ -71,7 +71,7 @@ static VIDEO_UPDATE( turbosub ) static MACHINE_RESET( turbosub ) { #if ROM_PATCHES - UINT8 *rom = (UINT8 *)memory_region(REGION_CPU1); + UINT8 *rom = (UINT8 *)memory_region(machine, REGION_CPU1); rom[0xf564]=0; /* Display test status */ rom[0xf60a]=0x20; /* Skip on error */ @@ -121,7 +121,7 @@ static READ8_HANDLER( G_STATUS_R ) static WRITE8_HANDLER( G_STATUS_W ) { int bankaddress; - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); bankaddress = 0x10000 + (data & 0x03) * 0x10000; memory_set_bankptr(1,&ROM[bankaddress]); diff --git a/src/mame/drivers/tutankhm.c b/src/mame/drivers/tutankhm.c index 7c9eb102d00..6c48d62cb41 100644 --- a/src/mame/drivers/tutankhm.c +++ b/src/mame/drivers/tutankhm.c @@ -56,7 +56,7 @@ static WRITE8_HANDLER( irq_enable_w ) static MACHINE_START( tutankhm ) { - memory_configure_bank(1, 0, 16, memory_region(REGION_CPU1) + 0x10000, 0x1000); + memory_configure_bank(1, 0, 16, memory_region(machine, REGION_CPU1) + 0x10000, 0x1000); state_save_register_global(irq_toggle); state_save_register_global(irq_enable); } diff --git a/src/mame/drivers/twin16.c b/src/mame/drivers/twin16.c index 26bc48db2ca..fe96d5517bb 100644 --- a/src/mame/drivers/twin16.c +++ b/src/mame/drivers/twin16.c @@ -123,7 +123,7 @@ static WRITE16_HANDLER( videoram16_w ) static READ16_HANDLER( extra_rom_r ) { - return ((UINT16 *)memory_region(REGION_GFX3))[offset]; + return ((UINT16 *)memory_region(machine, REGION_GFX3))[offset]; } static READ16_HANDLER( twin16_gfx_rom1_r ) @@ -1434,14 +1434,14 @@ ROM_END /* Driver Initialization */ -static void gfx_untangle( void ) +static void gfx_untangle( running_machine *machine ) { // sprite, tile data int i; UINT16 *temp = malloc_or_die(0x200000); - twin16_gfx_rom = (UINT16 *)memory_region(REGION_GFX2); + twin16_gfx_rom = (UINT16 *)memory_region(machine, REGION_GFX2); memcpy( temp, twin16_gfx_rom, 0x200000 ); for( i=0; i<0x080000; i++ ) @@ -1454,25 +1454,25 @@ static void gfx_untangle( void ) static DRIVER_INIT( twin16 ) { - gfx_untangle(); + gfx_untangle(machine); twin16_custom_video = 0; } static DRIVER_INIT( fround ) { - gfx_untangle(); + gfx_untangle(machine); twin16_custom_video = 1; } static DRIVER_INIT( hpuncher ) { - gfx_untangle(); + gfx_untangle(machine); twin16_custom_video = 2; } static DRIVER_INIT( cuebrckj ) { - gfx_untangle(); + gfx_untangle(machine); twin16_custom_video = 2; generic_nvram = (UINT8 *)cuebrckj_nvram; diff --git a/src/mame/drivers/undrfire.c b/src/mame/drivers/undrfire.c index 583faafda7d..f6c1d54aa61 100644 --- a/src/mame/drivers/undrfire.c +++ b/src/mame/drivers/undrfire.c @@ -715,7 +715,7 @@ GFXDECODE_END static MACHINE_RESET( undrfire ) { - taito_f3_soundsystem_reset(); + taito_f3_soundsystem_reset(machine); f3_68681_reset(); } @@ -964,8 +964,8 @@ ROM_END static DRIVER_INIT( undrfire ) { UINT32 offset,i; - UINT8 *gfx = memory_region(REGION_GFX3); - int size=memory_region_length(REGION_GFX3); + UINT8 *gfx = memory_region(machine, REGION_GFX3); + int size=memory_region_length(machine, REGION_GFX3); int data; /* make piv tile GFX format suitable for gfxdecode */ @@ -993,8 +993,8 @@ static DRIVER_INIT( undrfire ) static DRIVER_INIT( cbombers ) { UINT32 offset,i; - UINT8 *gfx = memory_region(REGION_GFX3); - int size=memory_region_length(REGION_GFX3); + UINT8 *gfx = memory_region(machine, REGION_GFX3); + int size=memory_region_length(machine, REGION_GFX3); int data; diff --git a/src/mame/drivers/unico.c b/src/mame/drivers/unico.c index 9ed23e347b8..79bf4e406c2 100644 --- a/src/mame/drivers/unico.c +++ b/src/mame/drivers/unico.c @@ -115,7 +115,7 @@ static WRITE16_HANDLER( zeropnt_sound_bank_w ) contains garbage. Indeed, only banks 0&1 are used */ int bank = (data >> 8 ) & 1; - UINT8 *dst = memory_region(REGION_SOUND1); + UINT8 *dst = memory_region(machine, REGION_SOUND1); UINT8 *src = dst + 0x80000 + 0x20000 + 0x20000 * bank; memcpy(dst + 0x20000, src, 0x20000); @@ -238,7 +238,7 @@ static WRITE32_HANDLER( zeropnt2_sound_bank_w ) if (ACCESSING_BITS_24_31) { int bank = ((data >> 24) & 3) % 4; - UINT8 *dst = memory_region(REGION_SOUND1); + UINT8 *dst = memory_region(machine, REGION_SOUND1); UINT8 *src = dst + 0x80000 + 0x20000 + 0x20000 * bank; memcpy(dst + 0x20000, src, 0x20000); } diff --git a/src/mame/drivers/upscope.c b/src/mame/drivers/upscope.c index 387ab383ce3..ec217611f68 100644 --- a/src/mame/drivers/upscope.c +++ b/src/mame/drivers/upscope.c @@ -383,7 +383,7 @@ static DRIVER_INIT( upscope ) /* 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); } diff --git a/src/mame/drivers/usgames.c b/src/mame/drivers/usgames.c index 7495ee8c424..b5f063d9f58 100644 --- a/src/mame/drivers/usgames.c +++ b/src/mame/drivers/usgames.c @@ -41,7 +41,7 @@ extern UINT8 *usgames_videoram,*usgames_charram; static WRITE8_HANDLER( usgames_rombank_w ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); // logerror ("BANK WRITE? -%02x-\n",data); //popmessage("%02x",data); diff --git a/src/mame/drivers/vaportra.c b/src/mame/drivers/vaportra.c index 390c5c87119..c8f8290a814 100644 --- a/src/mame/drivers/vaportra.c +++ b/src/mame/drivers/vaportra.c @@ -790,7 +790,7 @@ C3D54* static DRIVER_INIT( vaportra ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); int i; for (i=0x00000; i<0x80000; i++) diff --git a/src/mame/drivers/vball.c b/src/mame/drivers/vball.c index b018a050b77..84b65e6b013 100644 --- a/src/mame/drivers/vball.c +++ b/src/mame/drivers/vball.c @@ -129,7 +129,7 @@ INTERRUPT_GEN( vball_interrupt ); */ static WRITE8_HANDLER( vb_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); memory_set_bankptr( 1,&RAM[ 0x10000 + ( 0x4000 * ( data & 1 ) ) ] ); if (vball_gfxset != ((data & 0x20) ^ 0x20)) { diff --git a/src/mame/drivers/vendetta.c b/src/mame/drivers/vendetta.c index aab9cc870c7..ad53cac9fdd 100644 --- a/src/mame/drivers/vendetta.c +++ b/src/mame/drivers/vendetta.c @@ -87,6 +87,7 @@ Notes: ***************************************************************************/ #include "driver.h" +#include "deprecat.h" #include "video/konamiic.h" #include "cpu/konami/konami.h" /* for the callback and the firq irq definition */ #include "machine/eeprom.h" @@ -828,7 +829,7 @@ ROM_END static void vendetta_banking( int lines ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(Machine, REGION_CPU1); if ( lines >= 0x1c ) { @@ -842,11 +843,11 @@ static MACHINE_RESET( vendetta ) { cpunum_set_info_fct(0, CPUINFO_PTR_KONAMI_SETLINES_CALLBACK, (genf *)vendetta_banking); - paletteram = &memory_region(REGION_CPU1)[0x48000]; + paletteram = &memory_region(machine, REGION_CPU1)[0x48000]; irq_enabled = 0; /* init banks */ - memory_set_bankptr( 1, &memory_region(REGION_CPU1)[0x10000] ); + memory_set_bankptr( 1, &memory_region(machine, REGION_CPU1)[0x10000] ); vendetta_video_banking( machine, 0 ); } diff --git a/src/mame/drivers/vigilant.c b/src/mame/drivers/vigilant.c index c86e3f31701..79b262aa9d7 100644 --- a/src/mame/drivers/vigilant.c +++ b/src/mame/drivers/vigilant.c @@ -35,7 +35,7 @@ VIDEO_UPDATE( kikcubic ); static WRITE8_HANDLER( vigilant_bank_select_w ) { int bankaddress; - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); bankaddress = 0x10000 + (data & 0x07) * 0x4000; memory_set_bankptr(1,&RAM[bankaddress]); diff --git a/src/mame/drivers/viper.c b/src/mame/drivers/viper.c index f5fb5df039c..8678304f1c1 100644 --- a/src/mame/drivers/viper.c +++ b/src/mame/drivers/viper.c @@ -675,7 +675,7 @@ static DRIVER_INIT(viper) timekeeper_init(0, TIMEKEEPER_M48T58, backup_ram); - nvram = memory_region(REGION_USER2); + nvram = memory_region(machine, REGION_USER2); memcpy(backup_ram, nvram, 0x2000); } diff --git a/src/mame/drivers/vmetal.c b/src/mame/drivers/vmetal.c index ff78aa9a4bd..729b1be836f 100644 --- a/src/mame/drivers/vmetal.c +++ b/src/mame/drivers/vmetal.c @@ -98,7 +98,7 @@ static READ16_HANDLER ( varia_crom_read ) { /* game reads the cgrom, result is 7772, verified to be correct on the real board */ - UINT8 *cgrom = memory_region(REGION_GFX1); + UINT8 *cgrom = memory_region(machine, REGION_GFX1); UINT16 retdat; offset = offset << 1; offset |= (vmetal_videoregs[0x0ab/2]&0x7f) << 16; diff --git a/src/mame/drivers/wallc.c b/src/mame/drivers/wallc.c index 33126dd4998..36a4d0c385f 100644 --- a/src/mame/drivers/wallc.c +++ b/src/mame/drivers/wallc.c @@ -238,7 +238,7 @@ static DRIVER_INIT( wallc ) UINT8 c; UINT32 i; - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); for (i=0; i<0x2000*2; i++) { @@ -253,7 +253,7 @@ static DRIVER_INIT( wallca ) UINT8 c; UINT32 i; - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); for (i=0; i<0x4000; i++) { diff --git a/src/mame/drivers/wardner.c b/src/mame/drivers/wardner.c index b9b7e3af3ef..4189bcb6b9c 100644 --- a/src/mame/drivers/wardner.c +++ b/src/mame/drivers/wardner.c @@ -137,7 +137,7 @@ static WRITE8_HANDLER( wardner_ramrom_bank_sw ) if (wardner_membank != data) { int bankaddress = 0; - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); wardner_membank = data; diff --git a/src/mame/drivers/warriorb.c b/src/mame/drivers/warriorb.c index a7bbc8b087c..ceb97ce19c8 100644 --- a/src/mame/drivers/warriorb.c +++ b/src/mame/drivers/warriorb.c @@ -166,15 +166,15 @@ VIDEO_UPDATE( warriorb ); static INT32 banknum = -1; -static void reset_sound_region(void) +static void reset_sound_region(running_machine *machine) { - memory_set_bankptr( 10, memory_region(REGION_CPU2) + (banknum * 0x4000) + 0x10000 ); + memory_set_bankptr( 10, memory_region(machine, REGION_CPU2) + (banknum * 0x4000) + 0x10000 ); } static WRITE8_HANDLER( sound_bankswitch_w ) { banknum = (data - 1) & 7; - reset_sound_region(); + reset_sound_region(machine); } static WRITE16_HANDLER( warriorb_sound_w ) @@ -696,7 +696,7 @@ ROM_END static STATE_POSTLOAD( warriorb_postload ) { - reset_sound_region(); + reset_sound_region(machine); } static MACHINE_START( warriorb ) diff --git a/src/mame/drivers/wc90.c b/src/mame/drivers/wc90.c index 5b6907fb80a..670e71b5062 100644 --- a/src/mame/drivers/wc90.c +++ b/src/mame/drivers/wc90.c @@ -90,7 +90,7 @@ static WRITE8_HANDLER( wc90_shared_w ) static WRITE8_HANDLER( wc90_bankswitch_w ) { int bankaddress; - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); bankaddress = 0x10000 + ( ( data & 0xf8 ) << 8 ); @@ -100,7 +100,7 @@ static WRITE8_HANDLER( wc90_bankswitch_w ) static WRITE8_HANDLER( wc90_bankswitch1_w ) { int bankaddress; - UINT8 *RAM = memory_region(REGION_CPU2); + UINT8 *RAM = memory_region(machine, REGION_CPU2); bankaddress = 0x10000 + ( ( data & 0xf8 ) << 8 ); diff --git a/src/mame/drivers/wc90b.c b/src/mame/drivers/wc90b.c index 9f759d3521b..631cf707a56 100644 --- a/src/mame/drivers/wc90b.c +++ b/src/mame/drivers/wc90b.c @@ -121,7 +121,7 @@ static WRITE8_HANDLER( wc90b_shared_w ) static WRITE8_HANDLER( wc90b_bankswitch_w ) { int bankaddress; - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); bankaddress = 0x10000 + ((data & 0xf8) << 8); @@ -131,7 +131,7 @@ static WRITE8_HANDLER( wc90b_bankswitch_w ) static WRITE8_HANDLER( wc90b_bankswitch1_w ) { int bankaddress; - UINT8 *RAM = memory_region(REGION_CPU2); + UINT8 *RAM = memory_region(machine, REGION_CPU2); bankaddress = 0x10000 + ((data & 0xf8) << 8); @@ -147,7 +147,7 @@ static WRITE8_HANDLER( wc90b_sound_command_w ) static WRITE8_HANDLER( adpcm_control_w ) { int bankaddress; - UINT8 *RAM = memory_region(REGION_CPU2); + UINT8 *RAM = memory_region(machine, REGION_CPU2); /* the code writes either 2 or 3 in the bottom two bits */ bankaddress = 0x10000 + (data & 0x01) * 0x4000; diff --git a/src/mame/drivers/wecleman.c b/src/mame/drivers/wecleman.c index 682f7e4650f..8ab2bbca0ca 100644 --- a/src/mame/drivers/wecleman.c +++ b/src/mame/drivers/wecleman.c @@ -1260,13 +1260,13 @@ ROM_START( wecleman ) ROM_END -static void wecleman_unpack_sprites(void) +static void wecleman_unpack_sprites(running_machine *machine) { const int region = REGION_GFX1; // sprites - const UINT32 len = memory_region_length(region); - UINT8 *src = memory_region(region) + len / 2 - 1; - UINT8 *dst = memory_region(region) + len - 1; + const UINT32 len = memory_region_length(machine, region); + UINT8 *src = memory_region(machine, region) + len / 2 - 1; + UINT8 *dst = memory_region(machine, region) + len - 1; while(dst > src) { @@ -1298,7 +1298,7 @@ static DRIVER_INIT( wecleman ) { int i, len; UINT8 *RAM; -// UINT16 *RAM1 = (UINT16 *) memory_region(REGION_CPU1); /* Main CPU patches */ +// UINT16 *RAM1 = (UINT16 *) memory_region(machine, REGION_CPU1); /* Main CPU patches */ // RAM1[0x08c2/2] = 0x601e; // faster self test /* Decode GFX Roms - Compensate for the address lines scrambling */ @@ -1308,8 +1308,8 @@ static DRIVER_INIT( wecleman ) I hope you'll appreciate this effort! */ /* let's swap even and odd *pixels* of the sprites */ - RAM = memory_region(REGION_GFX1); - len = memory_region_length(REGION_GFX1); + RAM = memory_region(machine, REGION_GFX1); + len = memory_region_length(machine, REGION_GFX1); for (i = 0; i < len; i ++) { /* TODO: could be wrong, colors have to be fixed. */ @@ -1318,18 +1318,18 @@ static DRIVER_INIT( wecleman ) RAM[i] = BITSWAP8(RAM[i],7,0,1,2,3,4,5,6); } - bitswap(memory_region(REGION_GFX1), memory_region_length(REGION_GFX1), + bitswap(memory_region(machine, REGION_GFX1), memory_region_length(machine, REGION_GFX1), 0,1,20,19,18,17,14,9,16,6,4,7,8,15,10,11,13,5,12,3,2); /* Now we can unpack each nibble of the sprites into a pixel (one byte) */ - wecleman_unpack_sprites(); + wecleman_unpack_sprites(machine); /* Bg & Fg & Txt */ - bitswap(memory_region(REGION_GFX2), memory_region_length(REGION_GFX2), + bitswap(memory_region(machine, REGION_GFX2), memory_region_length(machine, REGION_GFX2), 20,19,18,17,16,15,12,7,14,4,2,5,6,13,8,9,11,3,10,1,0); /* Road */ - bitswap(memory_region(REGION_GFX3), memory_region_length(REGION_GFX3), + bitswap(memory_region(machine, REGION_GFX3), memory_region_length(machine, REGION_GFX3), 20,19,18,17,16,15,14,7,12,4,2,5,6,13,8,9,11,3,10,1,0); spr_color_offs = 0x40; @@ -1389,12 +1389,12 @@ ROM_END in a ROM module definition. This routine unpacks each sprite nibble into a byte, doubling the memory consumption. */ -static void hotchase_sprite_decode( int num16_banks, int bank_size ) +static void hotchase_sprite_decode( running_machine *machine, int num16_banks, int bank_size ) { UINT8 *base, *temp; int i; - base = memory_region(REGION_GFX1); // sprites + base = memory_region(machine, REGION_GFX1); // sprites temp = malloc_or_die( bank_size ); for( i = num16_banks; i >0; i-- ){ @@ -1439,7 +1439,7 @@ static void hotchase_sprite_decode( int num16_banks, int bank_size ) /* Unpack sprites data and do some patching */ static DRIVER_INIT( hotchase ) { -// UINT16 *RAM1 = (UINT16) memory_region(REGION_CPU1); /* Main CPU patches */ +// UINT16 *RAM1 = (UINT16) memory_region(machine, REGION_CPU1); /* Main CPU patches */ // RAM[0x1140/2] = 0x0015; RAM[0x195c/2] = 0x601A; // faster self test UINT8 *RAM; @@ -1447,13 +1447,13 @@ static DRIVER_INIT( hotchase ) /* Decode GFX Roms */ /* Let's swap even and odd bytes of the sprites gfx roms */ - RAM = memory_region(REGION_GFX1); + RAM = memory_region(machine, REGION_GFX1); /* Now we can unpack each nibble of the sprites into a pixel (one byte) */ - hotchase_sprite_decode(3,0x80000*2); // num banks, bank len + hotchase_sprite_decode(machine,3,0x80000*2); // num banks, bank len /* Let's copy the second half of the fg layer gfx (charset) over the first */ - RAM = memory_region(REGION_GFX3); + RAM = memory_region(machine, REGION_GFX3); memcpy(&RAM[0], &RAM[0x10000/2], 0x10000/2); spr_color_offs = 0; diff --git a/src/mame/drivers/welltris.c b/src/mame/drivers/welltris.c index 7149f5fd339..7096c5f6761 100644 --- a/src/mame/drivers/welltris.c +++ b/src/mame/drivers/welltris.c @@ -333,7 +333,7 @@ VIDEO_UPDATE( welltris ); static WRITE8_HANDLER( welltris_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); } @@ -705,7 +705,7 @@ static DRIVER_INIT( welltris ) { #if WELLTRIS_4P_HACK /* A Hack which shows 4 player mode in code which is disabled */ - UINT16 *RAM = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *RAM = (UINT16 *)memory_region(machine, REGION_CPU1); RAM[0xB91C/2] = 0x4e71; RAM[0xB91E/2] = 0x4e71; #endif diff --git a/src/mame/drivers/wgp.c b/src/mame/drivers/wgp.c index b58b1ca84eb..cd5d3749b2d 100644 --- a/src/mame/drivers/wgp.c +++ b/src/mame/drivers/wgp.c @@ -621,15 +621,15 @@ static WRITE16_HANDLER( wgp_adinput_w ) static INT32 banknum = -1; -static void reset_sound_region(void) /* assumes Z80 sandwiched between the 68Ks */ +static void reset_sound_region(running_machine *machine) /* assumes Z80 sandwiched between the 68Ks */ { - memory_set_bankptr( 10, memory_region(REGION_CPU2) + (banknum * 0x4000) + 0x10000 ); + memory_set_bankptr( 10, memory_region(machine, REGION_CPU2) + (banknum * 0x4000) + 0x10000 ); } static WRITE8_HANDLER( sound_bankswitch_w ) { banknum = (data - 1) & 7; - reset_sound_region(); + reset_sound_region(machine); } static WRITE16_HANDLER( wgp_sound_w ) @@ -937,7 +937,7 @@ graphics glitches. static STATE_POSTLOAD( wgp_postload ) { parse_control(machine); - reset_sound_region(); + reset_sound_region(machine); } static MACHINE_START( wgp ) @@ -1211,7 +1211,7 @@ static DRIVER_INIT( wgp ) #if 0 /* Patch for coding error that causes corrupt data in sprite tilemapping area from $4083c0-847f */ - UINT16 *ROM = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *ROM = (UINT16 *)memory_region(machine, REGION_CPU1); ROM[0x25dc / 2] = 0x0602; // faulty value is 0x0206 #endif @@ -1222,7 +1222,7 @@ static DRIVER_INIT( wgp ) static DRIVER_INIT( wgp2 ) { /* Code patches to prevent failure in memory checks */ - UINT16 *ROM = (UINT16 *)memory_region(REGION_CPU3); + UINT16 *ROM = (UINT16 *)memory_region(machine, REGION_CPU3); ROM[0x8008 / 2] = 0x0; ROM[0x8010 / 2] = 0x0; diff --git a/src/mame/drivers/wheelfir.c b/src/mame/drivers/wheelfir.c index 0939a790ba3..c26088d5bb8 100644 --- a/src/mame/drivers/wheelfir.c +++ b/src/mame/drivers/wheelfir.c @@ -186,7 +186,7 @@ static WRITE16_HANDLER(wheelfir_blit_w) int x,y; int xsize,ysize; - UINT8 *rom = memory_region(REGION_GFX1); + UINT8 *rom = memory_region(machine, REGION_GFX1); int dir=0; @@ -310,7 +310,7 @@ static VIDEO_UPDATE(wheelfir) if ( input_code_pressed(KEYCODE_R) ) { - const UINT8 *gfx = memory_region(REGION_GFX1); + const UINT8 *gfx = memory_region(machine, REGION_GFX1); for (y=0;y<128;y++) { for (x=0;x<512;x++) @@ -680,7 +680,7 @@ ROM_END static DRIVER_INIT(wheelfir) { - UINT16 *RAM = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *RAM = (UINT16 *)memory_region(machine, REGION_CPU1); RAM[0xdd3da/2] = 0x4e71; // hack! } diff --git a/src/mame/drivers/williams.c b/src/mame/drivers/williams.c index af85830ebc0..1fb67548644 100644 --- a/src/mame/drivers/williams.c +++ b/src/mame/drivers/williams.c @@ -2599,7 +2599,7 @@ static DRIVER_INIT( defender ) static DRIVER_INIT( defndjeu ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); int i; CONFIGURE_BLITTER(WILLIAMS_BLITTER_NONE, 0x0000); diff --git a/src/mame/drivers/wilytowr.c b/src/mame/drivers/wilytowr.c index 8d7435a4b82..e1de5b42664 100644 --- a/src/mame/drivers/wilytowr.c +++ b/src/mame/drivers/wilytowr.c @@ -283,7 +283,7 @@ static READ8_HANDLER( snddata_r ) switch(p2&0xf0) { case 0x60: return soundlatch_r(machine,0); ; - case 0x70: return memory_region(REGION_USER1)[((p1&0x1f)<<8)|offset]; + case 0x70: return memory_region(machine, REGION_USER1)[((p1&0x1f)<<8)|offset]; } return 0xff; } diff --git a/src/mame/drivers/wink.c b/src/mame/drivers/wink.c index fe1f4b6ee18..39c94f65159 100644 --- a/src/mame/drivers/wink.c +++ b/src/mame/drivers/wink.c @@ -392,7 +392,7 @@ ROM_END static DRIVER_INIT( wink ) { UINT32 i; - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); UINT8 *buffer = malloc_or_die(0x8000); // protection module reverse engineered by HIGHWAYMAN diff --git a/src/mame/drivers/witch.c b/src/mame/drivers/witch.c index e1393f5eb80..4adb02a6f94 100644 --- a/src/mame/drivers/witch.c +++ b/src/mame/drivers/witch.c @@ -353,7 +353,7 @@ static WRITE8_HANDLER(write_a00x) newbank=(data>>6)&3; if(newbank!=bank) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); bank=newbank; ROM = &ROM[0x10000+0x8000 * newbank + UNBANKED_SIZE]; memory_set_bankptr(1,ROM); @@ -392,7 +392,7 @@ static READ8_HANDLER(prot_read_700x) case 0x25e: return offset;//enough to pass... } - return memory_region(REGION_CPU2)[0x7000+offset]; + return memory_region(machine, REGION_CPU2)[0x7000+offset]; } /* @@ -859,7 +859,7 @@ ROM_END static DRIVER_INIT(witch) { - UINT8 *ROM = (UINT8 *)memory_region(REGION_CPU1); + UINT8 *ROM = (UINT8 *)memory_region(machine, REGION_CPU1); memory_set_bankptr(1,&ROM[0x10000+UNBANKED_SIZE]); memory_install_read8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x7000, 0x700f, 0, 0, prot_read_700x); diff --git a/src/mame/drivers/wiz.c b/src/mame/drivers/wiz.c index 03ba74b35c1..20f832e1e1b 100644 --- a/src/mame/drivers/wiz.c +++ b/src/mame/drivers/wiz.c @@ -1010,8 +1010,8 @@ static DRIVER_INIT( stinger ) { 5,3,7, 0x80 }, { 5,7,3, 0x28 } }; - UINT8 *rom = memory_region(REGION_CPU1); - int size = memory_region_length(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); + int size = memory_region_length(machine, REGION_CPU1); UINT8 *decrypt = auto_malloc(size); int A; const UINT8 *tbl; diff --git a/src/mame/drivers/wldarrow.c b/src/mame/drivers/wldarrow.c index c26c13ca27c..f4de9c569fd 100644 --- a/src/mame/drivers/wldarrow.c +++ b/src/mame/drivers/wldarrow.c @@ -453,7 +453,7 @@ ROM_END static DRIVER_INIT( wldarrow ) { offs_t i; - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); for (i = 0; i < 0x3000; i++) rom[i] ^= 0xff; diff --git a/src/mame/drivers/xain.c b/src/mame/drivers/xain.c index 7c512ee85ca..11b5859ac94 100644 --- a/src/mame/drivers/xain.c +++ b/src/mame/drivers/xain.c @@ -181,7 +181,7 @@ static WRITE8_HANDLER( xain_sharedram_w ) static WRITE8_HANDLER( xainCPUA_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); xain_pri=data&0x7; @@ -191,7 +191,7 @@ static WRITE8_HANDLER( xainCPUA_bankswitch_w ) static WRITE8_HANDLER( xainCPUB_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_CPU2); + UINT8 *RAM = memory_region(machine, REGION_CPU2); if (data & 0x01) {memory_set_bankptr(2,&RAM[0x10000]);} else {memory_set_bankptr(2,&RAM[0x4000]);} @@ -679,7 +679,7 @@ ROM_END static DRIVER_INIT( xsleena ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); /* do the same patch as the bootleg xsleena */ RAM[0xd488] = 0x12; @@ -692,7 +692,7 @@ static DRIVER_INIT( xsleena ) static DRIVER_INIT( solarwar ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); /* do the same patch as the bootleg xsleena */ RAM[0xd47e] = 0x12; diff --git a/src/mame/drivers/xexex.c b/src/mame/drivers/xexex.c index a0d9ca97ad3..97eef056b78 100644 --- a/src/mame/drivers/xexex.c +++ b/src/mame/drivers/xexex.c @@ -280,15 +280,15 @@ static READ16_HANDLER( sound_status_r ) return soundlatch3_r(machine, 0); } -static void reset_sound_region(void) +static void reset_sound_region(running_machine *machine) { - memory_set_bankptr(2, memory_region(REGION_CPU2) + 0x10000 + cur_sound_region*0x4000); + memory_set_bankptr(2, memory_region(machine, REGION_CPU2) + 0x10000 + cur_sound_region*0x4000); } static WRITE8_HANDLER( sound_bankswitch_w ) { cur_sound_region = data & 7; - reset_sound_region(); + reset_sound_region(machine); } static void ym_set_mixing(double left, double right) @@ -612,7 +612,7 @@ static MACHINE_RESET( xexex ) static STATE_POSTLOAD( xexex_postload ) { parse_control2(); - reset_sound_region(); + reset_sound_region(machine); } static MACHINE_START( xexex ) @@ -632,8 +632,8 @@ static DRIVER_INIT( xexex ) if (!strcmp(machine->gamedrv->name, "xexex")) { // Invulnerability -// *(UINT16 *)(memory_region(REGION_CPU1) + 0x648d4) = 0x4a79; -// *(UINT16 *)(memory_region(REGION_CPU1) + 0x00008) = 0x5500; +// *(UINT16 *)(memory_region(machine, REGION_CPU1) + 0x648d4) = 0x4a79; +// *(UINT16 *)(memory_region(machine, REGION_CPU1) + 0x00008) = 0x5500; xexex_strip0x1a = 1; } diff --git a/src/mame/drivers/xmen.c b/src/mame/drivers/xmen.c index 33e84a3aeb0..001a414578f 100644 --- a/src/mame/drivers/xmen.c +++ b/src/mame/drivers/xmen.c @@ -158,15 +158,15 @@ static WRITE16_HANDLER( xmen_18fa00_w ) static UINT8 sound_curbank; -static void sound_reset_bank(void) +static void sound_reset_bank(running_machine *machine) { - memory_set_bankptr(4, memory_region(REGION_CPU2) + 0x10000 + (sound_curbank & 0x07) * 0x4000); + memory_set_bankptr(4, memory_region(machine, REGION_CPU2) + 0x10000 + (sound_curbank & 0x07) * 0x4000); } static WRITE8_HANDLER( sound_bankswitch_w ) { sound_curbank = data; - sound_reset_bank(); + sound_reset_bank(machine); } @@ -462,7 +462,7 @@ static INTERRUPT_GEN( xmen_interrupt ) static STATE_POSTLOAD( xmen_postload ) { - sound_reset_bank(); + sound_reset_bank(machine); } static MACHINE_START( xmen ) diff --git a/src/mame/drivers/xorworld.c b/src/mame/drivers/xorworld.c index fd248b4130f..e62ebae5477 100644 --- a/src/mame/drivers/xorworld.c +++ b/src/mame/drivers/xorworld.c @@ -261,7 +261,7 @@ static DRIVER_INIT( xorworld ) /* patch some strange protection (without this, strange characters appear after level 5 and some pieces don't rotate properly some times) */ - UINT16 *rom = (UINT16 *)(memory_region(REGION_CPU1) + 0x1390); + UINT16 *rom = (UINT16 *)(memory_region(machine, REGION_CPU1) + 0x1390); PATCH(0x4239); PATCH(0x00ff); PATCH(0xe196); /* clr.b $ffe196 */ PATCH(0x4239); PATCH(0x00ff); PATCH(0xe197); /* clr.b $ffe197 */ diff --git a/src/mame/drivers/xxmissio.c b/src/mame/drivers/xxmissio.c index 6ce655e567c..c4d18b707c3 100644 --- a/src/mame/drivers/xxmissio.c +++ b/src/mame/drivers/xxmissio.c @@ -94,7 +94,7 @@ static INTERRUPT_GEN( xxmissio_interrupt_s ) static MACHINE_START( xxmissio ) { - memory_configure_bank(1, 0, 8, memory_region(REGION_USER1), 0x4000); + memory_configure_bank(1, 0, 8, memory_region(machine, REGION_USER1), 0x4000); memory_set_bank(1, 0); } diff --git a/src/mame/drivers/yumefuda.c b/src/mame/drivers/yumefuda.c index d96dedbd3c6..93ae096d3cc 100644 --- a/src/mame/drivers/yumefuda.c +++ b/src/mame/drivers/yumefuda.c @@ -184,7 +184,7 @@ static WRITE8_HANDLER( mux_w ) //0x14000 bonus game //0x16000 ? if(bank!=new_bank) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); UINT32 bankaddress; bank = new_bank; diff --git a/src/mame/drivers/yunsun16.c b/src/mame/drivers/yunsun16.c index 99db89a1e4d..6c17bbea0d1 100644 --- a/src/mame/drivers/yunsun16.c +++ b/src/mame/drivers/yunsun16.c @@ -117,7 +117,7 @@ static WRITE16_HANDLER( yunsun16_sound_bank_w ) if (ACCESSING_BITS_0_7) { int bank = data & 3; - UINT8 *dst = memory_region(REGION_SOUND1); + UINT8 *dst = memory_region(machine, REGION_SOUND1); UINT8 *src = dst + 0x80000 + 0x20000 * bank; memcpy(dst + 0x20000, src, 0x20000); } diff --git a/src/mame/drivers/yunsung8.c b/src/mame/drivers/yunsung8.c index a985f077fa1..caafbf4be5a 100644 --- a/src/mame/drivers/yunsung8.c +++ b/src/mame/drivers/yunsung8.c @@ -55,7 +55,7 @@ VIDEO_UPDATE( yunsung8 ); static MACHINE_RESET( yunsung8 ) { - UINT8 *RAM = memory_region(REGION_CPU1) + 0x24000; + UINT8 *RAM = memory_region(machine, REGION_CPU1) + 0x24000; yunsung8_videoram_0 = RAM + 0x0000; // Ram is banked yunsung8_videoram_1 = RAM + 0x2000; @@ -74,7 +74,7 @@ static MACHINE_RESET( yunsung8 ) static WRITE8_HANDLER( yunsung8_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); int bank = data & 7; // ROM bank yunsung8_layers_ctrl = data & 0x30; // Layers enable @@ -131,7 +131,7 @@ static int adpcm; static WRITE8_HANDLER( yunsung8_sound_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_CPU2); + UINT8 *RAM = memory_region(machine, REGION_CPU2); int bank = data & 7; if ( bank != (data&(~0x20)) ) logerror("CPU #1 - PC %04X: Bank %02X\n",activecpu_get_pc(),data); diff --git a/src/mame/drivers/zaxxon.c b/src/mame/drivers/zaxxon.c index 9650ff930c7..9834c0e3294 100644 --- a/src/mame/drivers/zaxxon.c +++ b/src/mame/drivers/zaxxon.c @@ -1389,7 +1389,7 @@ ROM_END * *************************************/ -static void zaxxonb_decode(void) +static void zaxxonb_decode(running_machine *machine) { /* the values vary, but the translation mask is always laid out like this: @@ -1434,8 +1434,8 @@ static void zaxxonb_decode(void) }; int A; - UINT8 *rom = memory_region(REGION_CPU1); - int size = memory_region_length(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); + int size = memory_region_length(machine, REGION_CPU1); UINT8 *decrypt = auto_malloc(size); memory_set_decrypted_region(0, 0x0000, size - 1, decrypt); @@ -1475,25 +1475,25 @@ static void zaxxonb_decode(void) static DRIVER_INIT( zaxxonb ) { - zaxxonb_decode(); + zaxxonb_decode(machine); } static DRIVER_INIT( szaxxon ) { - szaxxon_decode(); + szaxxon_decode(machine); } static DRIVER_INIT( futspy ) { - futspy_decode(); + futspy_decode(machine); } static DRIVER_INIT( razmataz ) { - nprinces_decode(); + nprinces_decode(machine); /* additional input ports are wired */ memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc004, 0xc004, 0, 0x18f3, input_port_read_handler8(machine->portconfig, "SW04")); @@ -1514,7 +1514,7 @@ static DRIVER_INIT( razmataz ) static DRIVER_INIT( ixion ) { - szaxxon_decode(); + szaxxon_decode(machine); /* connect the universal sound board */ memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe03c, 0xe03c, 0, 0x1f00, sega_usb_status_r, sega_usb_data_w); diff --git a/src/mame/drivers/zn.c b/src/mame/drivers/zn.c index e600aec1d0f..afbdcb4ec47 100644 --- a/src/mame/drivers/zn.c +++ b/src/mame/drivers/zn.c @@ -401,7 +401,7 @@ static void zn_driver_init( running_machine *machine ) n_game++; } - at28c16_init( 0, memory_region( REGION_USER4 ), NULL ); + at28c16_init( 0, memory_region( machine, REGION_USER4 ), NULL ); } static const struct PSXSPUinterface psxspu_interface = @@ -606,12 +606,12 @@ static READ32_HANDLER( capcom_kickharness_r ) static WRITE32_HANDLER( bank_coh1000c_w ) { - memory_set_bankptr( 2, memory_region( REGION_USER2 ) + 0x400000 + ( data * 0x400000 ) ); + memory_set_bankptr( 2, memory_region( machine, REGION_USER2 ) + 0x400000 + ( data * 0x400000 ) ); } static WRITE8_HANDLER( qsound_bankswitch_w ) { - memory_set_bankptr( 10, memory_region( REGION_CPU2 ) + 0x10000 + ( ( data & 0x0f ) * 0x4000 ) ); + memory_set_bankptr( 10, memory_region( machine, REGION_CPU2 ) + 0x10000 + ( ( data & 0x0f ) * 0x4000 ) ); } static INTERRUPT_GEN( qsound_interrupt ) @@ -649,9 +649,9 @@ static DRIVER_INIT( coh1000c ) static MACHINE_RESET( coh1000c ) { - memory_set_bankptr( 1, memory_region( REGION_USER2 ) ); /* fixed game rom */ - memory_set_bankptr( 2, memory_region( REGION_USER2 ) + 0x400000 ); /* banked game rom */ - memory_set_bankptr( 3, memory_region( REGION_USER3 ) ); /* country rom */ + memory_set_bankptr( 1, memory_region( machine, REGION_USER2 ) ); /* fixed game rom */ + memory_set_bankptr( 2, memory_region( machine, REGION_USER2 ) + 0x400000 ); /* banked game rom */ + memory_set_bankptr( 3, memory_region( machine, REGION_USER3 ) ); /* country rom */ zn_machine_init(machine); } @@ -854,7 +854,7 @@ Notes: static WRITE32_HANDLER( bank_coh3002c_w ) { - memory_set_bankptr( 2, memory_region( REGION_USER2 ) + 0x400000 + ( data * 0x400000 ) ); + memory_set_bankptr( 2, memory_region( machine, REGION_USER2 ) + 0x400000 + ( data * 0x400000 ) ); } static DRIVER_INIT( coh3002c ) @@ -872,9 +872,9 @@ static DRIVER_INIT( coh3002c ) static MACHINE_RESET( coh3002c ) { - memory_set_bankptr( 1, memory_region( REGION_USER2 ) ); /* fixed game rom */ - memory_set_bankptr( 2, memory_region( REGION_USER2 ) + 0x400000 ); /* banked game rom */ - memory_set_bankptr( 3, memory_region( REGION_USER3 ) ); /* country rom */ + memory_set_bankptr( 1, memory_region( machine, REGION_USER2 ) ); /* fixed game rom */ + memory_set_bankptr( 2, memory_region( machine, REGION_USER2 ) + 0x400000 ); /* banked game rom */ + memory_set_bankptr( 3, memory_region( machine, REGION_USER3 ) ); /* country rom */ zn_machine_init(machine); } @@ -1123,7 +1123,7 @@ static WRITE32_HANDLER( bank_coh1000t_w ) { mb3773_set_ck( ( data & 0x20 ) >> 5 ); verboselog( 1, "bank_coh1000t_w( %08x, %08x, %08x )\n", offset, data, mem_mask ); - memory_set_bankptr( 1, memory_region( REGION_USER2 ) + ( ( data & 3 ) * 0x800000 ) ); + memory_set_bankptr( 1, memory_region( machine, REGION_USER2 ) + ( ( data & 3 ) * 0x800000 ) ); } static INTERRUPT_GEN( coh1000t_vblank ) @@ -1184,7 +1184,7 @@ static INTERRUPT_GEN( coh1000t_vblank ) static WRITE8_HANDLER( fx1a_sound_bankswitch_w ) { - memory_set_bankptr( 10, memory_region( REGION_CPU2 ) + 0x10000 + ( ( ( data - 1 ) & 0x07 ) * 0x4000 ) ); + memory_set_bankptr( 10, memory_region( machine, REGION_CPU2 ) + 0x10000 + ( ( ( data - 1 ) & 0x07 ) * 0x4000 ) ); } static READ32_HANDLER( taitofx1a_ymsound_r ) @@ -1219,7 +1219,7 @@ static DRIVER_INIT( coh1000ta ) static MACHINE_RESET( coh1000ta ) { - memory_set_bankptr( 1, memory_region( REGION_USER2 ) ); /* banked game rom */ + memory_set_bankptr( 1, memory_region( machine, REGION_USER2 ) ); /* banked game rom */ memory_set_bankptr( 2, taitofx1_eeprom1 ); zn_machine_init(machine); @@ -1337,7 +1337,7 @@ static DRIVER_INIT( coh1000tb ) static MACHINE_RESET( coh1000tb ) { - memory_set_bankptr( 1, memory_region( REGION_USER2 ) ); /* banked game rom */ + memory_set_bankptr( 1, memory_region( machine, REGION_USER2 ) ); /* banked game rom */ memory_set_bankptr( 2, taitofx1_eeprom1 ); memory_set_bankptr( 3, taitofx1_eeprom2 ); zn_machine_init(machine); @@ -1526,7 +1526,7 @@ static DRIVER_INIT( coh3002t ) static MACHINE_RESET( coh3002t ) { - memory_set_bankptr( 1, memory_region( REGION_USER2 ) ); /* GNET boot rom */ + memory_set_bankptr( 1, memory_region( machine, REGION_USER2 ) ); /* GNET boot rom */ zn_machine_init(machine); } @@ -1704,7 +1704,7 @@ static DRIVER_INIT( coh1000w ) static MACHINE_RESET( coh1000w ) { - memory_set_bankptr( 1, memory_region( REGION_USER2 ) ); /* fixed game rom */ + memory_set_bankptr( 1, memory_region( machine, REGION_USER2 ) ); /* fixed game rom */ zn_machine_init(machine); devtag_reset(machine, IDE_CONTROLLER, "ide"); @@ -1872,7 +1872,7 @@ static WRITE32_HANDLER( coh1002e_bank_w ) { znsecsel_w( machine, offset, data, mem_mask ); - memory_set_bankptr( 1, memory_region( REGION_USER2 ) + ( ( data & 3 ) * 0x800000 ) ); + memory_set_bankptr( 1, memory_region( machine, REGION_USER2 ) + ( ( data & 3 ) * 0x800000 ) ); } static WRITE32_HANDLER( coh1002e_latch_w ) @@ -1894,7 +1894,7 @@ static DRIVER_INIT( coh1002e ) static MACHINE_RESET( coh1002e ) { - memory_set_bankptr( 1, memory_region( REGION_USER2 ) ); /* banked game rom */ + memory_set_bankptr( 1, memory_region( machine, REGION_USER2 ) ); /* banked game rom */ zn_machine_init(machine); } @@ -2230,7 +2230,7 @@ static DRIVER_INIT( coh1000a ) static MACHINE_RESET( coh1000a ) { - memory_set_bankptr( 1, memory_region( REGION_USER2 ) ); /* fixed game rom */ + memory_set_bankptr( 1, memory_region( machine, REGION_USER2 ) ); /* fixed game rom */ zn_machine_init(machine); if( ( !strcmp( machine->gamedrv->name, "jdredd" ) ) || ( !strcmp( machine->gamedrv->name, "jdreddb" ) ) ) @@ -2373,7 +2373,7 @@ Notes: static WRITE32_HANDLER( coh1001l_bnk_w ) { - memory_set_bankptr( 1, memory_region( REGION_USER2 ) + ( ( ( data >> 16 ) & 3 ) * 0x800000 ) ); + memory_set_bankptr( 1, memory_region( machine, REGION_USER2 ) + ( ( ( data >> 16 ) & 3 ) * 0x800000 ) ); } static DRIVER_INIT( coh1001l ) @@ -2386,7 +2386,7 @@ static DRIVER_INIT( coh1001l ) static MACHINE_RESET( coh1001l ) { - memory_set_bankptr( 1, memory_region( REGION_USER2 ) ); /* banked rom */ + memory_set_bankptr( 1, memory_region( machine, REGION_USER2 ) ); /* banked rom */ zn_machine_init(machine); } @@ -2418,7 +2418,7 @@ Key: Mother KN01 static WRITE32_HANDLER( coh1002v_bnk_w ) { - memory_set_bankptr( 2, memory_region( REGION_USER3 ) + ( data * 0x100000 ) ); + memory_set_bankptr( 2, memory_region( machine, REGION_USER3 ) + ( data * 0x100000 ) ); } static DRIVER_INIT( coh1002v ) @@ -2432,8 +2432,8 @@ static DRIVER_INIT( coh1002v ) static MACHINE_RESET( coh1002v ) { - memory_set_bankptr( 1, memory_region( REGION_USER2 ) ); /* fixed game rom */ - memory_set_bankptr( 2, memory_region( REGION_USER3 ) ); /* banked rom */ + memory_set_bankptr( 1, memory_region( machine, REGION_USER2 ) ); /* fixed game rom */ + memory_set_bankptr( 2, memory_region( machine, REGION_USER3 ) ); /* banked rom */ zn_machine_init(machine); } @@ -2624,7 +2624,7 @@ Notes: static WRITE32_HANDLER( coh1002m_bank_w ) { verboselog( 1, "coh1002m_bank_w( %08x, %08x, %08x )\n", offset, data, mem_mask ); - memory_set_bankptr( 1, memory_region( REGION_USER2 ) + ((data>>16) * 0x800000)); + memory_set_bankptr( 1, memory_region( machine, REGION_USER2 ) + ((data>>16) * 0x800000)); } static int cbaj_to_z80 = 0, cbaj_to_r3k = 0; @@ -2656,7 +2656,7 @@ static DRIVER_INIT( coh1002m ) static MACHINE_RESET( coh1002m ) { - memory_set_bankptr( 1, memory_region( REGION_USER2 ) ); + memory_set_bankptr( 1, memory_region( machine, REGION_USER2 ) ); zn_machine_init(machine); } diff --git a/src/mame/drivers/zr107.c b/src/mame/drivers/zr107.c index 430072243ab..3d30375c7b6 100644 --- a/src/mame/drivers/zr107.c +++ b/src/mame/drivers/zr107.c @@ -681,7 +681,7 @@ static DRIVER_INIT(zr107) init_konami_cgboard(1, CGBOARD_TYPE_ZR107); sharc_dataram = auto_malloc(0x100000); - K001005_preprocess_texture_data(memory_region(REGION_GFX1), memory_region_length(REGION_GFX1), 0); + K001005_preprocess_texture_data(memory_region(machine, REGION_GFX1), memory_region_length(machine, REGION_GFX1), 0); K056800_init(sound_irq_callback); @@ -693,7 +693,7 @@ static DRIVER_INIT(jetwave) init_konami_cgboard(1, CGBOARD_TYPE_GTICLUB); sharc_dataram = auto_malloc(0x100000); - K001005_preprocess_texture_data(memory_region(REGION_GFX1), memory_region_length(REGION_GFX1), 0); + K001005_preprocess_texture_data(memory_region(machine, REGION_GFX1), memory_region_length(machine, REGION_GFX1), 0); K056800_init(sound_irq_callback); diff --git a/src/mame/includes/atari.h b/src/mame/includes/atari.h index 0df5f0e68ed..635c552a214 100644 --- a/src/mame/includes/atari.h +++ b/src/mame/includes/atari.h @@ -322,11 +322,11 @@ typedef struct { #define RDPMGFXS(o) cpunum_read_byte(0, antic.pmbase_s+(o)+(antic.scanline>>1)) #define RDPMGFXD(o) cpunum_read_byte(0, antic.pmbase_d+(o)+antic.scanline) #else -#define RDANTIC() (memory_region(REGION_CPU1))[antic.dpage+antic.doffs] -#define RDVIDEO(o) (memory_region(REGION_CPU1))[antic.vpage+((antic.voffs+(o))&VOFFS)] -#define RDCHGEN(o) (memory_region(REGION_CPU1))[antic.chbase+(o)] -#define RDPMGFXS(o) (memory_region(REGION_CPU1))[antic.pmbase_s+(o)+(antic.scanline>>1)] -#define RDPMGFXD(o) (memory_region(REGION_CPU1))[antic.pmbase_d+(o)+antic.scanline] +#define RDANTIC() (memory_region(machine, REGION_CPU1))[antic.dpage+antic.doffs] +#define RDVIDEO(o) (memory_region(machine, REGION_CPU1))[antic.vpage+((antic.voffs+(o))&VOFFS)] +#define RDCHGEN(o) (memory_region(machine, REGION_CPU1))[antic.chbase+(o)] +#define RDPMGFXS(o) (memory_region(machine, REGION_CPU1))[antic.pmbase_s+(o)+(antic.scanline>>1)] +#define RDPMGFXD(o) (memory_region(machine, REGION_CPU1))[antic.pmbase_d+(o)+antic.scanline] #endif #define PREPARE() \ diff --git a/src/mame/includes/cclimber.h b/src/mame/includes/cclimber.h index ce1d93e7026..ce22908f4e7 100644 --- a/src/mame/includes/cclimber.h +++ b/src/mame/includes/cclimber.h @@ -2,8 +2,8 @@ DRIVER_INIT( cclimber ); DRIVER_INIT( cclimbrj ); -void cclimbrj_decode(void); -void mshuttle_decode(void); +void cclimbrj_decode(running_machine *machine); +void mshuttle_decode(running_machine *machine); DRIVER_INIT( cannonb ); DRIVER_INIT( cannonb2 ); DRIVER_INIT( ckongb ); diff --git a/src/mame/includes/cps1.h b/src/mame/includes/cps1.h index bb6c2be72d0..3bb7bc56437 100644 --- a/src/mame/includes/cps1.h +++ b/src/mame/includes/cps1.h @@ -32,22 +32,22 @@ DRIVER_INIT( cps2crpt ); /*----------- defined in machine/kabuki.c -----------*/ -void mgakuen2_decode(void); -void pang_decode(void); -void cworld_decode(void); -void hatena_decode(void); -void spang_decode(void); -void spangj_decode(void); -void sbbros_decode(void); -void marukin_decode(void); -void qtono1_decode(void); -void qsangoku_decode(void); -void block_decode(void); - -void wof_decode(void); -void dino_decode(void); -void punisher_decode(void); -void slammast_decode(void); +void mgakuen2_decode(running_machine *machine); +void pang_decode(running_machine *machine); +void cworld_decode(running_machine *machine); +void hatena_decode(running_machine *machine); +void spang_decode(running_machine *machine); +void spangj_decode(running_machine *machine); +void sbbros_decode(running_machine *machine); +void marukin_decode(running_machine *machine); +void qtono1_decode(running_machine *machine); +void qsangoku_decode(running_machine *machine); +void block_decode(running_machine *machine); + +void wof_decode(running_machine *machine); +void dino_decode(running_machine *machine); +void punisher_decode(running_machine *machine); +void slammast_decode(running_machine *machine); /*----------- defined in video/cps1.c -----------*/ diff --git a/src/mame/includes/cyberbal.h b/src/mame/includes/cyberbal.h index 89e0c7d1219..840154ae0ff 100644 --- a/src/mame/includes/cyberbal.h +++ b/src/mame/includes/cyberbal.h @@ -7,7 +7,7 @@ /*----------- defined in audio/cyberbal.c -----------*/ -void cyberbal_sound_reset(void); +void cyberbal_sound_reset(running_machine *machine); INTERRUPT_GEN( cyberbal_sound_68k_irq_gen ); diff --git a/src/mame/includes/decocrpt.h b/src/mame/includes/decocrpt.h index 48614ed5642..06b7dedf740 100644 --- a/src/mame/includes/decocrpt.h +++ b/src/mame/includes/decocrpt.h @@ -1,15 +1,15 @@ /*----------- defined in machine/decocrpt.c -----------*/ -void deco56_decrypt(int region); -void deco74_decrypt(int region); -void deco56_remap(int region); +void deco56_decrypt(running_machine *machine, int region); +void deco74_decrypt(running_machine *machine, int region); +void deco56_remap(running_machine *machine, int region); /*----------- defined in machine/deco102.c -----------*/ -void deco102_decrypt(int region, int address_xor, int data_select_xor, int opcode_select_xor); +void deco102_decrypt(running_machine *machine, int region, int address_xor, int data_select_xor, int opcode_select_xor); /*----------- defined in machine/deco156.c -----------*/ -void deco156_decrypt(void); +void deco156_decrypt(running_machine *machine); diff --git a/src/mame/includes/harddriv.h b/src/mame/includes/harddriv.h index 2d97686e1a6..3f793c6e438 100644 --- a/src/mame/includes/harddriv.h +++ b/src/mame/includes/harddriv.h @@ -173,7 +173,7 @@ READ16_HANDLER( hdds3_speedup_r ); /*----------- defined in audio/harddriv.c -----------*/ -void hdsnd_init(void); +void hdsnd_init(running_machine *machine); extern UINT16 *hdsnddsp_ram; diff --git a/src/mame/includes/leland.h b/src/mame/includes/leland.h index a547a5015f5..5e218a786a6 100644 --- a/src/mame/includes/leland.h +++ b/src/mame/includes/leland.h @@ -96,7 +96,7 @@ WRITE8_HANDLER( ataxx_slave_banksw_w ); READ8_HANDLER( leland_raster_r ); -void leland_rotate_memory(int cpunum); +void leland_rotate_memory(running_machine *machine, int cpunum); /*----------- defined in audio/leland.c -----------*/ diff --git a/src/mame/includes/ms32.h b/src/mame/includes/ms32.h index 0e9d9d0a781..6cd76340432 100644 --- a/src/mame/includes/ms32.h +++ b/src/mame/includes/ms32.h @@ -1,8 +1,8 @@ /*----------- defined in drivers/ms32.c -----------*/ -extern void ms32_rearrange_sprites(int region); -extern void decrypt_ms32_tx(int addr_xor,int data_xor, int region); -extern void decrypt_ms32_bg(int addr_xor,int data_xor, int region); +extern void ms32_rearrange_sprites(running_machine *machine, int region); +extern void decrypt_ms32_tx(running_machine *machine, int addr_xor,int data_xor, int region); +extern void decrypt_ms32_bg(running_machine *machine, int addr_xor,int data_xor, int region); /*----------- defined in video/ms32.c -----------*/ diff --git a/src/mame/includes/neogeo.h b/src/mame/includes/neogeo.h index bd2969c6d8b..5136f1aae47 100644 --- a/src/mame/includes/neogeo.h +++ b/src/mame/includes/neogeo.h @@ -52,39 +52,39 @@ READ16_HANDLER( neogeo_unmapped_r ); /*----------- defined in machine/neocrypt.c -----------*/ -void kof99_neogeo_gfx_decrypt(int extra_xor); -void kof2000_neogeo_gfx_decrypt(int extra_xor); -void cmc50_neogeo_gfx_decrypt(int extra_xor); -void cmc42_neogeo_gfx_decrypt(int extra_xor); -void kof99_decrypt_68k(void); -void garou_decrypt_68k(void); -void garouo_decrypt_68k(void); -void mslug3_decrypt_68k(void); -void kof2000_decrypt_68k(void); -void kof98_decrypt_68k(void); -void kof2002_decrypt_68k(void); -void matrim_decrypt_68k(void); -void mslug5_decrypt_68k(void); -void svcchaos_px_decrypt(void); -void svcpcb_gfx_decrypt(void); -void svcpcb_s1data_decrypt(void); -void samsho5_decrypt_68k(void); -void kf2k3pcb_gfx_decrypt(void); -void kf2k3pcb_decrypt_68k(void); -void kf2k3pcb_decrypt_s1data(void); -void kof2003_decrypt_68k(void); -void kof2003biosdecode(void); -void samsh5p_decrypt_68k(void); - -void neo_pcm2_snk_1999(int value); -void neo_pcm2_swap(int value); +void kof99_neogeo_gfx_decrypt(running_machine *machine, int extra_xor); +void kof2000_neogeo_gfx_decrypt(running_machine *machine, int extra_xor); +void cmc50_neogeo_gfx_decrypt(running_machine *machine, int extra_xor); +void cmc42_neogeo_gfx_decrypt(running_machine *machine, int extra_xor); +void kof99_decrypt_68k(running_machine *machine); +void garou_decrypt_68k(running_machine *machine); +void garouo_decrypt_68k(running_machine *machine); +void mslug3_decrypt_68k(running_machine *machine); +void kof2000_decrypt_68k(running_machine *machine); +void kof98_decrypt_68k(running_machine *machine); +void kof2002_decrypt_68k(running_machine *machine); +void matrim_decrypt_68k(running_machine *machine); +void mslug5_decrypt_68k(running_machine *machine); +void svcchaos_px_decrypt(running_machine *machine); +void svcpcb_gfx_decrypt(running_machine *machine); +void svcpcb_s1data_decrypt(running_machine *machine); +void samsho5_decrypt_68k(running_machine *machine); +void kf2k3pcb_gfx_decrypt(running_machine *machine); +void kf2k3pcb_decrypt_68k(running_machine *machine); +void kf2k3pcb_decrypt_s1data(running_machine *machine); +void kof2003_decrypt_68k(running_machine *machine); +void kof2003biosdecode(running_machine *machine); +void samsh5p_decrypt_68k(running_machine *machine); + +void neo_pcm2_snk_1999(running_machine *machine, int value); +void neo_pcm2_swap(running_machine *machine, int value); /*----------- defined in machine/neoprot.c -----------*/ void neogeo_reset_rng(void); void fatfury2_install_protection(running_machine *machine); -void mslugx_install_protection(void); +void mslugx_install_protection(running_machine *machine); void kof99_install_protection(running_machine *machine); void garou_install_protection(running_machine *machine); void garouo_install_protection(running_machine *machine); @@ -96,38 +96,38 @@ void install_pvc_protection(running_machine *machine); /*----------- defined in machine/neoboot.c -----------*/ -void kog_px_decrypt(void); -void neogeo_bootleg_cx_decrypt(void); +void kog_px_decrypt(running_machine *machine); +void neogeo_bootleg_cx_decrypt(running_machine *machine); void install_kof10th_protection(running_machine *machine); -void decrypt_kof10th(void); -void decrypt_kf10thep(void); -void decrypt_kf2k5uni(void); -void neogeo_bootleg_sx_decrypt(int value); -void kf2k2mp_decrypt(void); -void kof2km2_px_decrypt(void); -void decrypt_cthd2003(void); +void decrypt_kof10th(running_machine *machine); +void decrypt_kf10thep(running_machine *machine); +void decrypt_kf2k5uni(running_machine *machine); +void neogeo_bootleg_sx_decrypt(running_machine *machine, int value); +void kf2k2mp_decrypt(running_machine *machine); +void kof2km2_px_decrypt(running_machine *machine); +void decrypt_cthd2003(running_machine *machine); void patch_cthd2003(running_machine *machine); -void decrypt_ct2k3sp(void); -void decrypt_ct2k3sa(void); -void patch_ct2k3sa(void); -void decrypt_kof2k4se_68k(void); -void lans2004_decrypt_68k(void); -void lans2004_vx_decrypt(void); +void decrypt_ct2k3sp(running_machine *machine); +void decrypt_ct2k3sa(running_machine *machine); +void patch_ct2k3sa(running_machine *machine); +void decrypt_kof2k4se_68k(running_machine *machine); +void lans2004_decrypt_68k(running_machine *machine); +void lans2004_vx_decrypt(running_machine *machine); void install_ms5plus_protection(running_machine *machine); -void svcboot_px_decrypt( void ); -void svcboot_cx_decrypt( void ); -void svcplus_px_decrypt( void ); -void svcplus_px_hack( void ); -void svcplusa_px_decrypt( void ); -void svcsplus_px_decrypt( void ); -void svcsplus_px_hack( void ); -void kof2003b_px_decrypt( void ); +void svcboot_px_decrypt(running_machine *machine); +void svcboot_cx_decrypt(running_machine *machine); +void svcplus_px_decrypt(running_machine *machine); +void svcplus_px_hack(running_machine *machine); +void svcplusa_px_decrypt(running_machine *machine); +void svcsplus_px_decrypt(running_machine *machine); +void svcsplus_px_hack(running_machine *machine); +void kof2003b_px_decrypt(running_machine *machine); void kof2003b_install_protection(running_machine *machine); -void kof2k3pl_px_decrypt( void ); -void kof2k3up_px_decrypt( void ); +void kof2k3pl_px_decrypt(running_machine *machine); +void kof2k3up_px_decrypt(running_machine *machine); void kof2k3up_install_protection(running_machine *machine); void kf2k3pl_install_protection(running_machine *machine); -void samsh5bl_px_decrypt( void ); +void samsh5bl_px_decrypt(running_machine *machine); /*----------- defined in video/neogeo.c -----------*/ diff --git a/src/mame/includes/pacman.h b/src/mame/includes/pacman.h index 3152be645fb..147e72714b7 100644 --- a/src/mame/includes/pacman.h +++ b/src/mame/includes/pacman.h @@ -48,12 +48,12 @@ WRITE8_HANDLER( jrpacman_bgpriority_w ); /*----------- defined in machine/pacplus.c -----------*/ -void pacplus_decode(void); +void pacplus_decode(running_machine *machine); /*----------- defined in machine/jumpshot.c -----------*/ -void jumpshot_decode(void); +void jumpshot_decode(running_machine *machine); /*----------- defined in machine/theglobp.c -----------*/ diff --git a/src/mame/includes/pgm.h b/src/mame/includes/pgm.h index 888d4553b06..be29b13a5b0 100644 --- a/src/mame/includes/pgm.h +++ b/src/mame/includes/pgm.h @@ -9,16 +9,16 @@ extern size_t pgm_sprite_a_region_allocate; /*----------- defined in machine/pgmcrypt.c -----------*/ -void pgm_kov_decrypt(void); -void pgm_kovsh_decrypt(void); -void pgm_kov2_decrypt(void); -void pgm_mm_decrypt(void); -void pgm_dw2_decrypt(void); -void pgm_djlzz_decrypt(void); -void pgm_dw3_decrypt(void); -void pgm_killbld_decrypt(void); -void pgm_pstar_decrypt(void); -void pgm_puzzli2_decrypt(void); +void pgm_kov_decrypt(running_machine *machine); +void pgm_kovsh_decrypt(running_machine *machine); +void pgm_kov2_decrypt(running_machine *machine); +void pgm_mm_decrypt(running_machine *machine); +void pgm_dw2_decrypt(running_machine *machine); +void pgm_djlzz_decrypt(running_machine *machine); +void pgm_dw3_decrypt(running_machine *machine); +void pgm_killbld_decrypt(running_machine *machine); +void pgm_pstar_decrypt(running_machine *machine); +void pgm_puzzli2_decrypt(running_machine *machine); /*----------- defined in machine/pgmprot.c -----------*/ diff --git a/src/mame/includes/raiden2.h b/src/mame/includes/raiden2.h index 9876644bf64..5627814de6b 100644 --- a/src/mame/includes/raiden2.h +++ b/src/mame/includes/raiden2.h @@ -13,4 +13,4 @@ WRITE16_HANDLER( sprcpt_flags_2_w ); /*----------- defined in machine/r2crypt.c -----------*/ -void raiden2_decrypt_sprites(void); +void raiden2_decrypt_sprites(running_machine *machine); diff --git a/src/mame/includes/segas32.h b/src/mame/includes/segas32.h index 71ac77c96d8..401d0d587c6 100644 --- a/src/mame/includes/segas32.h +++ b/src/mame/includes/segas32.h @@ -29,7 +29,7 @@ WRITE16_HANDLER( jleague_protection_w ); READ16_HANDLER( dbzvrvs_protection_r ); WRITE16_HANDLER( dbzvrvs_protection_w ); -void decrypt_ga2_protrom(void); +void decrypt_ga2_protrom(running_machine *machine); READ16_HANDLER( ga2_dpram_r ); WRITE16_HANDLER( ga2_dpram_w ); diff --git a/src/mame/includes/starwars.h b/src/mame/includes/starwars.h index c3e30813003..f44a99c7c2d 100644 --- a/src/mame/includes/starwars.h +++ b/src/mame/includes/starwars.h @@ -22,7 +22,7 @@ READ8_HANDLER( starwars_input_1_r ); READ8_HANDLER( starwars_adc_r ); WRITE8_HANDLER( starwars_adc_select_w ); -void starwars_mproc_init(void); +void starwars_mproc_init(running_machine *machine); void starwars_mproc_reset(void); READ8_HANDLER( starwars_prng_r ); diff --git a/src/mame/includes/system16.h b/src/mame/includes/system16.h index 49d0036ca32..07ee1355c22 100644 --- a/src/mame/includes/system16.h +++ b/src/mame/includes/system16.h @@ -85,7 +85,7 @@ extern int sys16_sprite_quartet2( struct sys16_sprite_attributes *sprite, const void *fd1094_get_decrypted_base(void); void fd1094_machine_init(void); -void fd1094_driver_init(running_machine *machine, void (*set_decrypted)(UINT8 *)); +void fd1094_driver_init(running_machine *machine, void (*set_decrypted)(running_machine *, UINT8 *)); /*----------- defined in machine/system16.c -----------*/ diff --git a/src/mame/includes/vertigo.h b/src/mame/includes/vertigo.h index 607b1a722c7..d98b99fbd29 100644 --- a/src/mame/includes/vertigo.h +++ b/src/mame/includes/vertigo.h @@ -23,6 +23,6 @@ MACHINE_RESET( vertigo ); extern UINT16 *vertigo_vectorram; -void vertigo_vproc_init(void); +void vertigo_vproc_init(running_machine *machine); void vertigo_vproc(int cycles, int irq4); diff --git a/src/mame/machine/acitya.c b/src/mame/machine/acitya.c index ea71c9e265c..30540f23ce1 100644 --- a/src/mame/machine/acitya.c +++ b/src/mame/machine/acitya.c @@ -18,13 +18,13 @@ David Widel d_widel@hotmail.com static INT8 counter=0; -static void acitya_decrypt_rom_8(void) +static void acitya_decrypt_rom_8(running_machine *machine) { int oldbyte,inverted_oldbyte,newbyte; int mem; UINT8 *RAM; - RAM = memory_region(REGION_CPU1); + RAM = memory_region(machine, REGION_CPU1); for (mem=0;mem<0x4000;mem++) @@ -54,13 +54,13 @@ static void acitya_decrypt_rom_8(void) } -static void acitya_decrypt_rom_9(void) +static void acitya_decrypt_rom_9(running_machine *machine) { int oldbyte,inverted_oldbyte,newbyte; int mem; UINT8 *RAM; - RAM = memory_region(REGION_CPU1); + RAM = memory_region(machine, REGION_CPU1); for (mem=0;mem<0x4000;mem++) { @@ -87,13 +87,13 @@ static void acitya_decrypt_rom_9(void) return; } -static void acitya_decrypt_rom_A(void) +static void acitya_decrypt_rom_A(running_machine *machine) { int oldbyte,inverted_oldbyte,newbyte; int mem; UINT8 *RAM; - RAM = memory_region(REGION_CPU1); + RAM = memory_region(machine, REGION_CPU1); for (mem=0;mem<0x4000;mem++) { @@ -120,13 +120,13 @@ static void acitya_decrypt_rom_A(void) return; } -static void acitya_decrypt_rom_B(void) +static void acitya_decrypt_rom_B(running_machine *machine) { int oldbyte,inverted_oldbyte,newbyte; int mem; UINT8 *RAM; - RAM = memory_region(REGION_CPU1); + RAM = memory_region(machine, REGION_CPU1); for (mem=0;mem<0x4000;mem++) { @@ -186,15 +186,15 @@ READ8_HANDLER( acitya_decrypt_rom ) MACHINE_RESET( acitya ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); /* While the PAL supports up to 16 decryption methods, only four are actually used in the PAL. Therefore, we'll take a little memory overhead and decrypt the ROMs using each method in advance. */ - acitya_decrypt_rom_8(); - acitya_decrypt_rom_9(); - acitya_decrypt_rom_A(); - acitya_decrypt_rom_B(); + acitya_decrypt_rom_8(machine); + acitya_decrypt_rom_9(machine); + acitya_decrypt_rom_A(machine); + acitya_decrypt_rom_B(machine); /* The initial state of the counter is 0x0B */ counter = 0x0B; diff --git a/src/mame/machine/ajax.c b/src/mame/machine/ajax.c index 7680c0d6f83..b6e6afa95c4 100644 --- a/src/mame/machine/ajax.c +++ b/src/mame/machine/ajax.c @@ -35,7 +35,7 @@ static int firq_enable; static WRITE8_HANDLER( ajax_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); int bankaddress = 0; /* rom select */ @@ -180,7 +180,7 @@ WRITE8_HANDLER( ajax_ls138_f10_w ) WRITE8_HANDLER( ajax_bankswitch_2_w ) { - UINT8 *RAM = memory_region(REGION_CPU2); + UINT8 *RAM = memory_region(machine, REGION_CPU2); int bankaddress; /* enable char ROM reading through the video RAM */ diff --git a/src/mame/machine/atari.c b/src/mame/machine/atari.c index 97de8f5ef29..4eb264d6f17 100644 --- a/src/mame/machine/atari.c +++ b/src/mame/machine/atari.c @@ -147,7 +147,7 @@ void a600xl_mmu(running_machine *machine, UINT8 new_mmu) } memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x5000, 0x57ff, 0, 0, rbank2, wbank2); if (rbank2 == SMH_BANK2) - memory_set_bankptr(2, memory_region(REGION_CPU1)+0x5000); + memory_set_bankptr(2, memory_region(machine, REGION_CPU1)+0x5000); } void a800xl_mmu(running_machine *machine, UINT8 new_mmu) @@ -162,20 +162,20 @@ void a800xl_mmu(running_machine *machine, UINT8 new_mmu) logerror("%s MMU BIOS ROM\n", machine->gamedrv->name); rbank3 = SMH_BANK3; wbank3 = SMH_UNMAP; - base3 = memory_region(REGION_CPU1)+0x14000; /* 8K lo BIOS */ + base3 = memory_region(machine, REGION_CPU1)+0x14000; /* 8K lo BIOS */ rbank4 = SMH_BANK4; wbank4 = SMH_UNMAP; - base4 = memory_region(REGION_CPU1)+0x15800; /* 4K FP ROM + 8K hi BIOS */ + base4 = memory_region(machine, REGION_CPU1)+0x15800; /* 4K FP ROM + 8K hi BIOS */ } else { logerror("%s MMU BIOS RAM\n", machine->gamedrv->name); rbank3 = SMH_BANK3; wbank3 = SMH_BANK3; - base3 = memory_region(REGION_CPU1)+0x0c000; /* 8K RAM */ + base3 = memory_region(machine, REGION_CPU1)+0x0c000; /* 8K RAM */ rbank4 = SMH_BANK4; wbank4 = SMH_BANK4; - base4 = memory_region(REGION_CPU1)+0x0d800; /* 4K RAM + 8K RAM */ + base4 = memory_region(machine, REGION_CPU1)+0x0d800; /* 4K RAM + 8K RAM */ } memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xcfff, 0, 0, rbank3, wbank3); memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xd800, 0xffff, 0, 0, rbank4, wbank4); @@ -188,14 +188,14 @@ void a800xl_mmu(running_machine *machine, UINT8 new_mmu) logerror("%s MMU BASIC RAM\n", machine->gamedrv->name); rbank1 = SMH_BANK1; wbank1 = SMH_BANK1; - base1 = memory_region(REGION_CPU1)+0x0a000; /* 8K RAM */ + base1 = memory_region(machine, REGION_CPU1)+0x0a000; /* 8K RAM */ } else { logerror("%s MMU BASIC ROM\n", machine->gamedrv->name); rbank1 = SMH_BANK1; wbank1 = SMH_UNMAP; - base1 = memory_region(REGION_CPU1)+0x10000; /* 8K BASIC */ + base1 = memory_region(machine, REGION_CPU1)+0x10000; /* 8K BASIC */ } memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa000, 0xbfff, 0, 0, rbank1, wbank1); memory_set_bankptr(1, base1); @@ -206,14 +206,14 @@ void a800xl_mmu(running_machine *machine, UINT8 new_mmu) logerror("%s MMU SELFTEST RAM\n", machine->gamedrv->name); rbank2 = SMH_BANK2; wbank2 = SMH_BANK2; - base2 = memory_region(REGION_CPU1)+0x05000; /* 0x0800 bytes */ + base2 = memory_region(machine, REGION_CPU1)+0x05000; /* 0x0800 bytes */ } else { logerror("%s MMU SELFTEST ROM\n", machine->gamedrv->name); rbank2 = SMH_BANK2; wbank2 = SMH_UNMAP; - base2 = memory_region(REGION_CPU1)+0x15000; /* 0x0800 bytes */ + base2 = memory_region(machine, REGION_CPU1)+0x15000; /* 0x0800 bytes */ } memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x5000, 0x57ff, 0, 0, rbank2, wbank2); memory_set_bankptr(2, base2); @@ -654,7 +654,7 @@ static void a800_setbank(running_machine *machine, int n) { void *read_addr; void *write_addr; - UINT8 *mem = memory_region(REGION_CPU1); + UINT8 *mem = memory_region(machine, REGION_CPU1); switch (n) { @@ -835,7 +835,7 @@ MACHINE_START( a800 ) #ifdef MESS DEVICE_IMAGE_LOAD( a800_cart ) { - UINT8 *mem = memory_region(REGION_CPU1); + UINT8 *mem = memory_region(machine, REGION_CPU1); int size; /* load an optional (dual) cartridge (e.g. basic.rom) */ @@ -889,7 +889,7 @@ MACHINE_START( a800xl ) #ifdef MESS DEVICE_IMAGE_LOAD( a800xl_cart ) { - UINT8 *mem = memory_region(REGION_CPU1); + UINT8 *mem = memory_region(machine, REGION_CPU1); astring *fname; mame_file *basic_fp; file_error filerr; @@ -946,7 +946,7 @@ MACHINE_START( a5200 ) #ifdef MESS DEVICE_IMAGE_LOAD( a5200_cart ) { - UINT8 *mem = memory_region(REGION_CPU1); + UINT8 *mem = memory_region(machine, REGION_CPU1); int size; /* load an optional (dual) cartidge */ @@ -973,7 +973,7 @@ DEVICE_IMAGE_LOAD( a5200_cart ) DEVICE_IMAGE_UNLOAD( a5200_cart ) { - UINT8 *mem = memory_region(REGION_CPU1); + UINT8 *mem = memory_region(machine, REGION_CPU1); /* zap the cartridge memory (again) */ memset(&mem[0x4000], 0x00, 0x8000); } diff --git a/src/mame/machine/balsente.c b/src/mame/machine/balsente.c index d9600c9c0e3..e0faa82d5d7 100644 --- a/src/mame/machine/balsente.c +++ b/src/mame/machine/balsente.c @@ -183,9 +183,9 @@ MACHINE_RESET( balsente ) memset(noise_position, 0, sizeof(noise_position)); /* point the banks to bank 0 */ - numbanks = (memory_region_length(REGION_CPU1) > 0x40000) ? 16 : 8; - memory_configure_bank(1, 0, numbanks, &memory_region(REGION_CPU1)[0x10000], 0x6000); - memory_configure_bank(2, 0, numbanks, &memory_region(REGION_CPU1)[0x12000], 0x6000); + numbanks = (memory_region_length(machine, REGION_CPU1) > 0x40000) ? 16 : 8; + memory_configure_bank(1, 0, numbanks, &memory_region(machine, REGION_CPU1)[0x10000], 0x6000); + memory_configure_bank(2, 0, numbanks, &memory_region(machine, REGION_CPU1)[0x12000], 0x6000); memory_set_bank(1, 0); memory_set_bank(2, 0); @@ -341,7 +341,7 @@ WRITE8_HANDLER( balsente_rombank2_select_w ) int bank = data & 7; /* top bit controls which half of the ROMs to use (Name that Tune only) */ - if (memory_region_length(REGION_CPU1) > 0x40000) bank |= (data >> 4) & 8; + if (memory_region_length(machine, REGION_CPU1) > 0x40000) bank |= (data >> 4) & 8; /* when they set the AB bank, it appears as though the CD bank is reset */ if (data & 0x20) diff --git a/src/mame/machine/beezer.c b/src/mame/machine/beezer.c index d6f434c0c75..9ce01cd9af6 100644 --- a/src/mame/machine/beezer.c +++ b/src/mame/machine/beezer.c @@ -130,7 +130,7 @@ WRITE8_HANDLER( beezer_bankswitch_w ) } else { - UINT8 *rom = memory_region(REGION_CPU1) + 0x10000; + UINT8 *rom = memory_region(machine, REGION_CPU1) + 0x10000; memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xcfff, 0, 0, SMH_BANK1, SMH_BANK1); memory_set_bankptr(1, rom + (data & 0x07) * 0x2000 + ((data & 0x08) ? 0x1000: 0)); } diff --git a/src/mame/machine/btime.c b/src/mame/machine/btime.c index 1bfd8005ef6..8525c9b4ce3 100644 --- a/src/mame/machine/btime.c +++ b/src/mame/machine/btime.c @@ -13,7 +13,7 @@ static int protection_ret = 0; READ8_HANDLER( mmonkey_protection_r ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); int ret = 0; @@ -29,7 +29,7 @@ READ8_HANDLER( mmonkey_protection_r ) WRITE8_HANDLER( mmonkey_protection_w ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); if (offset == 0) diff --git a/src/mame/machine/bublbobl.c b/src/mame/machine/bublbobl.c index 55ef79ae79c..ba45b6b20df 100644 --- a/src/mame/machine/bublbobl.c +++ b/src/mame/machine/bublbobl.c @@ -18,7 +18,7 @@ UINT8 *bublbobl_mcu_sharedram; WRITE8_HANDLER( bublbobl_bankswitch_w ) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); /* bits 0-2 select ROM bank */ memory_set_bankptr(1,&ROM[0x10000 + 0x4000 * ((data ^ 4) & 7)]); @@ -41,7 +41,7 @@ WRITE8_HANDLER( bublbobl_bankswitch_w ) WRITE8_HANDLER( tokio_bankswitch_w ) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); /* bits 0-2 select ROM bank */ memory_set_bankptr(1,&ROM[0x10000 + 0x4000 * (data & 7)]); diff --git a/src/mame/machine/cclimber.c b/src/mame/machine/cclimber.c index 224a8ce8b6a..14714e83733 100644 --- a/src/mame/machine/cclimber.c +++ b/src/mame/machine/cclimber.c @@ -4,9 +4,9 @@ /* set to 1 to fix protection check after bonus round (see notes in pacman.c driver) */ #define CANNONB_HACK 0 -static void cclimber_decode(const UINT8 convtable[8][16]) +static void cclimber_decode(running_machine *machine, const UINT8 convtable[8][16]) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); UINT8 *decrypt = auto_malloc(0x10000); int A; @@ -47,10 +47,10 @@ DRIVER_INIT( cclimber ) { -1, -1,0x54,0x01,0x15,0x40,0x45,0x41,0x51,0x04,0x50,0x05,0x11,0x44,0x10,0x14 } }; - cclimber_decode(convtable); + cclimber_decode(machine, convtable); } -void cclimbrj_decode(void) +void cclimbrj_decode(running_machine *machine) { static const UINT8 convtable[8][16] = { @@ -64,15 +64,15 @@ void cclimbrj_decode(void) { 0x55,0x50,0x15,0x10,0x01,0x04,0x41,0x44,0x45,0x40,0x05,0x00,0x11,0x14,0x51,0x54 }, }; - cclimber_decode(convtable); + cclimber_decode(machine, convtable); } DRIVER_INIT( cclimbrj ) { - cclimbrj_decode(); + cclimbrj_decode(machine); } -void mshuttle_decode(void) +void mshuttle_decode(running_machine *machine) { static const UINT8 convtable[8][16] = { @@ -87,13 +87,13 @@ void mshuttle_decode(void) { 0x05,0x04,0x51,0x01, -1, -1,0x55, -1,0x00,0x50,0x15,0x14,0x44,0x41,0x40,0x54 }, }; - cclimber_decode(convtable); + cclimber_decode(machine, convtable); } DRIVER_INIT( ckongb ) { int A; - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); for (A = 0x0000;A < 0x6000;A++) /* all the program ROMs are encrypted */ { @@ -104,7 +104,7 @@ DRIVER_INIT( ckongb ) #if CANNONB_HACK static void cannonb_patch(void) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); rom[0x2ba0] = 0x21; rom[0x2ba1] = 0xfb; @@ -116,7 +116,7 @@ static void cannonb_patch(void) DRIVER_INIT( cannonb ) { int A; - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); for (A = 0x0000;A < 0x1000;A++) /* only first ROM is encrypted */ { diff --git a/src/mame/machine/cps2crpt.c b/src/mame/machine/cps2crpt.c index fd3a748b554..47e884c5691 100644 --- a/src/mame/machine/cps2crpt.c +++ b/src/mame/machine/cps2crpt.c @@ -632,8 +632,8 @@ static void optimise_sboxes(struct optimised_sbox* out, const struct sbox* in) static void cps2_decrypt(running_machine *machine, const UINT32 *master_key, UINT32 upper_limit) { - UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1); - int length = memory_region_length(REGION_CPU1); + UINT16 *rom = (UINT16 *)memory_region(machine, REGION_CPU1); + int length = memory_region_length(machine, REGION_CPU1); UINT16 *dec = auto_malloc(length); int i; UINT32 key1[4]; diff --git a/src/mame/machine/dc.c b/src/mame/machine/dc.c index 0d0c5ad25e9..4cc0753ccd5 100644 --- a/src/mame/machine/dc.c +++ b/src/mame/machine/dc.c @@ -683,7 +683,7 @@ WRITE64_HANDLER( dc_g1_ctrl_w ) UINT64 shift; UINT32 old,dat; struct sh4_ddt_dma ddtdata; - UINT8 *ROM = (UINT8 *)memory_region(REGION_USER1); + UINT8 *ROM = (UINT8 *)memory_region(machine, REGION_USER1); reg = decode_reg_64(offset, mem_mask, &shift); dat = (UINT32)(data >> shift); diff --git a/src/mame/machine/dec0.c b/src/mame/machine/dec0.c index 53b624853ef..0390a6c5805 100644 --- a/src/mame/machine/dec0.c +++ b/src/mame/machine/dec0.c @@ -531,10 +531,10 @@ static WRITE16_HANDLER( robocop_68000_share_w ) /******************************************************************************/ -static void h6280_decrypt(int memory_area) +static void h6280_decrypt(running_machine *machine, int memory_area) { int i; - UINT8 *RAM = memory_region(memory_area); + UINT8 *RAM = memory_region(machine, memory_area); /* Read each byte, decrypt it */ for (i=0x00000; i<0x10000; i++) @@ -543,12 +543,12 @@ static void h6280_decrypt(int memory_area) DRIVER_INIT( hippodrm ) { - UINT8 *RAM = memory_region(REGION_CPU3); + UINT8 *RAM = memory_region(machine, REGION_CPU3); memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x180000, 0x180fff, 0, 0, hippodrm_68000_share_r, hippodrm_68000_share_w); memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xffc800, 0xffcfff, 0, 0, sprite_mirror_w); - h6280_decrypt(REGION_CPU3); + h6280_decrypt(machine, REGION_CPU3); /* The protection cpu has additional memory mapped protection! */ RAM[0x189]=0x60; /* RTS prot area */ @@ -559,9 +559,9 @@ DRIVER_INIT( hippodrm ) DRIVER_INIT( slyspy ) { - UINT8 *RAM = memory_region(REGION_CPU2); + UINT8 *RAM = memory_region(machine, REGION_CPU2); - h6280_decrypt(REGION_CPU2); + h6280_decrypt(machine, REGION_CPU2); /* Slyspy sound cpu has some protection */ RAM[0xf2d]=0xea; @@ -582,7 +582,7 @@ DRIVER_INIT( hbarrel ) { GAME=1; { /* Remove this patch once processing time of i8751 is simulated */ -UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1); +UINT16 *rom = (UINT16 *)memory_region(machine, REGION_CPU1); rom[0xb68/2] = 0x8008; } } @@ -591,7 +591,7 @@ DRIVER_INIT( hbarrelw ) { GAME=1; { /* Remove this patch once processing time of i8751 is simulated */ -UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1); +UINT16 *rom = (UINT16 *)memory_region(machine, REGION_CPU1); rom[0xb3e/2] = 0x8008; } } @@ -603,7 +603,7 @@ DRIVER_INIT( birdtry ) GAME=3; - src = memory_region(REGION_GFX4); + src = memory_region(machine, REGION_GFX4); /* some parts of the graphic have bytes swapped */ for (k = 0;k < 0x70000;k += 0x20000) diff --git a/src/mame/machine/deco102.c b/src/mame/machine/deco102.c index b9af2811e21..de137bac215 100644 --- a/src/mame/machine/deco102.c +++ b/src/mame/machine/deco102.c @@ -47,11 +47,11 @@ static UINT16 decrypt(UINT16 data, int address, int select_xor) bs[8],bs[9],bs[10],bs[11],bs[12],bs[13],bs[14],bs[15]); } -void deco102_decrypt(int region, int address_xor, int data_select_xor, int opcode_select_xor) +void deco102_decrypt(running_machine *machine, int region, int address_xor, int data_select_xor, int opcode_select_xor) { int i; - UINT16 *rom = (UINT16 *)memory_region(region); - int size = memory_region_length(region); + UINT16 *rom = (UINT16 *)memory_region(machine, region); + int size = memory_region_length(machine, region); UINT16 *opcodes = auto_malloc(size); UINT16 *buf = malloc_or_die(size); diff --git a/src/mame/machine/deco156.c b/src/mame/machine/deco156.c index 132dcf25e98..cdec85cfa10 100644 --- a/src/mame/machine/deco156.c +++ b/src/mame/machine/deco156.c @@ -122,10 +122,10 @@ static void decrypt(UINT32 *src, UINT32 *dst, int length) } -void deco156_decrypt(void) +void deco156_decrypt(running_machine *machine) { - UINT32 *rom = (UINT32 *)memory_region(REGION_CPU1); - int length = memory_region_length(REGION_CPU1); + UINT32 *rom = (UINT32 *)memory_region(machine, REGION_CPU1); + int length = memory_region_length(machine, REGION_CPU1); UINT32 *buf = malloc_or_die(length); memcpy(buf, rom, length); diff --git a/src/mame/machine/decocass.c b/src/mame/machine/decocass.c index 03814335086..32602b3d637 100644 --- a/src/mame/machine/decocass.c +++ b/src/mame/machine/decocass.c @@ -366,7 +366,7 @@ attotime decocass_adjust_tape_time(attotime tape_time) } -static void tape_update(void) +static void tape_update(running_machine *machine) { static int last_byte; int offset, rclk, rdata, tape_bit, tape_byte, tape_block; @@ -455,7 +455,7 @@ static void tape_update(void) else if (tape_byte < TAPE_BLOCK) { - UINT8 *ptr = memory_region(REGION_USER2) + tape_block * 256 + tape_byte - TAPE_HEADER; + UINT8 *ptr = memory_region(machine, REGION_USER2) + tape_block * 256 + tape_byte - TAPE_HEADER; rdata = (*ptr >> tape_bit) & 1; if (tape_byte != last_byte) LOG(4,("tape %5.4fs: DATA(%02x) $%02x\n", attotime_to_double(tape_time), tape_byte - TAPE_HEADER, *ptr)); @@ -607,7 +607,7 @@ static READ8_HANDLER( decocass_type1_latch_26_pass_3_inv_2_r ) { offs_t promaddr; UINT8 save; - UINT8 *prom = memory_region(REGION_USER1); + UINT8 *prom = memory_region(machine, REGION_USER1); if (firsttime) { @@ -687,7 +687,7 @@ static READ8_HANDLER( decocass_type1_pass_136_r ) { offs_t promaddr; UINT8 save; - UINT8 *prom = memory_region(REGION_USER1); + UINT8 *prom = memory_region(machine, REGION_USER1); if (firsttime) { @@ -767,7 +767,7 @@ static READ8_HANDLER( decocass_type1_latch_27_pass_3_inv_2_r ) { offs_t promaddr; UINT8 save; - UINT8 *prom = memory_region(REGION_USER1); + UINT8 *prom = memory_region(machine, REGION_USER1); if (firsttime) { @@ -847,7 +847,7 @@ static READ8_HANDLER( decocass_type1_latch_26_pass_5_inv_2_r ) { offs_t promaddr; UINT8 save; - UINT8 *prom = memory_region(REGION_USER1); + UINT8 *prom = memory_region(machine, REGION_USER1); if (firsttime) { @@ -929,7 +929,7 @@ static READ8_HANDLER( decocass_type1_latch_16_pass_3_inv_1_r ) { offs_t promaddr; UINT8 save; - UINT8 *prom = memory_region(REGION_USER1); + UINT8 *prom = memory_region(machine, REGION_USER1); if (firsttime) { @@ -996,7 +996,7 @@ static READ8_HANDLER( decocass_type2_r ) { if (1 == (offset & 1)) { - UINT8 *prom = memory_region(REGION_USER1); + UINT8 *prom = memory_region(machine, REGION_USER1); data = prom[256 * type2_d2_latch + type2_promaddr]; LOG(3,("%9.7f 6502-PC: %04x decocass_type2_r(%02x): $%02x <- prom[%03x]\n", attotime_to_double(timer_get_time()), activecpu_get_previouspc(), offset, data, 256 * type2_d2_latch + type2_promaddr)); } @@ -1076,7 +1076,7 @@ static READ8_HANDLER( decocass_type3_r ) { if (1 == type3_pal_19) { - UINT8 *prom = memory_region(REGION_USER1); + UINT8 *prom = memory_region(machine, REGION_USER1); data = prom[type3_ctrs]; LOG(3,("%9.7f 6502-PC: %04x decocass_type3_r(%02x): $%02x <- prom[$%03x]\n", attotime_to_double(timer_get_time()), activecpu_get_previouspc(), offset, data, type3_ctrs)); if (++type3_ctrs == 4096) @@ -1315,7 +1315,7 @@ static READ8_HANDLER( decocass_type4_r ) { if (type4_latch) { - UINT8 *prom = memory_region(REGION_USER1); + UINT8 *prom = memory_region(machine, REGION_USER1); data = prom[type4_ctrs]; LOG(3,("%9.7f 6502-PC: %04x decocass_type4_r(%02x): $%02x '%c' <- PROM[%04x]\n", attotime_to_double(timer_get_time()), activecpu_get_previouspc(), offset, data, (data >= 32) ? data : '.', type4_ctrs)); @@ -1595,8 +1595,8 @@ static STATE_POSTLOAD( decocass_state_save_postload ) #if 0 /* fix me - this won't work anymore */ int A; - UINT8 *mem = memory_region(REGION_CPU1); - int diff = memory_region_length(REGION_CPU1) / 2; + UINT8 *mem = memory_region(machine, REGION_CPU1); + int diff = memory_region_length(machine, REGION_CPU1) / 2; memory_set_opcode_base(0, mem + diff); @@ -1650,9 +1650,9 @@ void decocass_machine_state_save_init(running_machine *machine) * ***************************************************************************/ -static void decocass_init_common(void) +static void decocass_init_common(running_machine *machine) { - UINT8 *image = memory_region(REGION_USER2); + UINT8 *image = memory_region(machine, REGION_USER2); int i, offs; tape_dir = 0; @@ -1662,7 +1662,7 @@ static void decocass_init_common(void) firsttime = 1; tape_present = 1; tape_blocks = 0; - for (i = memory_region_length(REGION_USER2) / 256 - 1; !tape_blocks && i > 0; i--) + for (i = memory_region_length(machine, REGION_USER2) / 256 - 1; !tape_blocks && i > 0; i--) for (offs = 256 * i; !tape_blocks && offs < 256 * i + 256; offs++) if (image[offs]) tape_blocks = i+1; @@ -1716,26 +1716,26 @@ static void decocass_init_common(void) MACHINE_RESET( decocass ) { - decocass_init_common(); + decocass_init_common(machine); } MACHINE_RESET( ctsttape ) { - decocass_init_common(); + decocass_init_common(machine); LOG(0,("dongle type #1 (DE-0061)\n")); decocass_dongle_r = decocass_type1_pass_136_r; } MACHINE_RESET( chwy ) { - decocass_init_common(); + decocass_init_common(machine); LOG(0,("dongle type #1 (DE-0061 own PROM)\n")); decocass_dongle_r = decocass_type1_latch_27_pass_3_inv_2_r; } MACHINE_RESET( clocknch ) { - decocass_init_common(); + decocass_init_common(machine); LOG(0,("dongle type #1 (DE-0061 flip 2-3)\n")); decocass_dongle_r = decocass_type1_latch_26_pass_3_inv_2_r; type1_inmap = MAKE_MAP(0,1,3,2,4,5,6,7); @@ -1744,7 +1744,7 @@ MACHINE_RESET( clocknch ) MACHINE_RESET( ctisland ) { - decocass_init_common(); + decocass_init_common(machine); LOG(0,("dongle type #1 (DE-0061 flip 0-2)\n")); decocass_dongle_r = decocass_type1_latch_26_pass_3_inv_2_r; type1_inmap = MAKE_MAP(2,1,0,3,4,5,6,7); @@ -1753,7 +1753,7 @@ MACHINE_RESET( ctisland ) MACHINE_RESET( csuperas ) { - decocass_init_common(); + decocass_init_common(machine); LOG(0,("dongle type #1 (DE-0061 flip 4-5)\n")); decocass_dongle_r = decocass_type1_latch_26_pass_3_inv_2_r; type1_inmap = MAKE_MAP(0,1,2,3,5,4,6,7); @@ -1762,14 +1762,14 @@ MACHINE_RESET( csuperas ) MACHINE_RESET( castfant ) { - decocass_init_common(); + decocass_init_common(machine); LOG(0,("dongle type #1 (DE-0061)\n")); decocass_dongle_r = decocass_type1_latch_16_pass_3_inv_1_r; } MACHINE_RESET( cluckypo ) { - decocass_init_common(); + decocass_init_common(machine); LOG(0,("dongle type #1 (DE-0061 flip 1-3)\n")); decocass_dongle_r = decocass_type1_latch_26_pass_3_inv_2_r; type1_inmap = MAKE_MAP(0,3,2,1,4,5,6,7); @@ -1778,7 +1778,7 @@ MACHINE_RESET( cluckypo ) MACHINE_RESET( cterrani ) { - decocass_init_common(); + decocass_init_common(machine); LOG(0,("dongle type #1 (DE-0061 straight)\n")); decocass_dongle_r = decocass_type1_latch_26_pass_3_inv_2_r; type1_inmap = MAKE_MAP(0,1,2,3,4,5,6,7); @@ -1787,14 +1787,14 @@ MACHINE_RESET( cterrani ) MACHINE_RESET( cexplore ) { - decocass_init_common(); + decocass_init_common(machine); LOG(0,("dongle type #1 (DE-0061 own PROM)\n")); decocass_dongle_r = decocass_type1_latch_26_pass_5_inv_2_r; } MACHINE_RESET( cprogolf ) { - decocass_init_common(); + decocass_init_common(machine); LOG(0,("dongle type #1 (DE-0061 flip 0-1)\n")); decocass_dongle_r = decocass_type1_latch_26_pass_3_inv_2_r; type1_inmap = MAKE_MAP(1,0,2,3,4,5,6,7); @@ -1803,7 +1803,7 @@ MACHINE_RESET( cprogolf ) MACHINE_RESET( cmissnx ) { - decocass_init_common(); + decocass_init_common(machine); LOG(0,("dongle type #2 (CS82-007)\n")); decocass_dongle_r = decocass_type2_r; decocass_dongle_w = decocass_type2_w; @@ -1811,7 +1811,7 @@ MACHINE_RESET( cmissnx ) MACHINE_RESET( cdiscon1 ) { - decocass_init_common(); + decocass_init_common(machine); LOG(0,("dongle type #2 (CS82-007)\n")); decocass_dongle_r = decocass_type2_r; decocass_dongle_w = decocass_type2_w; @@ -1819,7 +1819,7 @@ MACHINE_RESET( cdiscon1 ) MACHINE_RESET( cptennis ) { - decocass_init_common(); + decocass_init_common(machine); LOG(0,("dongle type #2 (CS82-007)\n")); decocass_dongle_r = decocass_type2_r; decocass_dongle_w = decocass_type2_w; @@ -1827,7 +1827,7 @@ MACHINE_RESET( cptennis ) MACHINE_RESET( ctornado ) { - decocass_init_common(); + decocass_init_common(machine); LOG(0,("dongle type #2 (CS82-007)\n")); decocass_dongle_r = decocass_type2_r; decocass_dongle_w = decocass_type2_w; @@ -1835,7 +1835,7 @@ MACHINE_RESET( ctornado ) MACHINE_RESET( cbnj ) { - decocass_init_common(); + decocass_init_common(machine); LOG(0,("dongle type #3 (PAL)\n")); decocass_dongle_r = decocass_type3_r; decocass_dongle_w = decocass_type3_w; @@ -1844,7 +1844,7 @@ MACHINE_RESET( cbnj ) MACHINE_RESET( cburnrub ) { - decocass_init_common(); + decocass_init_common(machine); LOG(0,("dongle type #3 (PAL)\n")); decocass_dongle_r = decocass_type3_r; decocass_dongle_w = decocass_type3_w; @@ -1853,7 +1853,7 @@ MACHINE_RESET( cburnrub ) MACHINE_RESET( cbtime ) { - decocass_init_common(); + decocass_init_common(machine); LOG(0,("dongle type #3 (PAL)\n")); decocass_dongle_r = decocass_type3_r; decocass_dongle_w = decocass_type3_w; @@ -1862,7 +1862,7 @@ MACHINE_RESET( cbtime ) MACHINE_RESET( cgraplop ) { - decocass_init_common(); + decocass_init_common(machine); LOG(0,("dongle type #3 (PAL)\n")); decocass_dongle_r = decocass_type3_r; decocass_dongle_w = decocass_type3_w; @@ -1871,7 +1871,7 @@ MACHINE_RESET( cgraplop ) MACHINE_RESET( cgraplp2 ) { - decocass_init_common(); + decocass_init_common(machine); LOG(0,("dongle type #3 (PAL)\n")); decocass_dongle_r = decocass_type3_r; decocass_dongle_w = decocass_type3_w; @@ -1880,7 +1880,7 @@ MACHINE_RESET( cgraplp2 ) MACHINE_RESET( clapapa ) { - decocass_init_common(); + decocass_init_common(machine); LOG(0,("dongle type #3 (PAL)\n")); decocass_dongle_r = decocass_type3_r; decocass_dongle_w = decocass_type3_w; @@ -1889,7 +1889,7 @@ MACHINE_RESET( clapapa ) MACHINE_RESET( cfghtice ) { - decocass_init_common(); + decocass_init_common(machine); LOG(0,("dongle type #3 (PAL)\n")); decocass_dongle_r = decocass_type3_r; decocass_dongle_w = decocass_type3_w; @@ -1898,7 +1898,7 @@ MACHINE_RESET( cfghtice ) MACHINE_RESET( cprobowl ) { - decocass_init_common(); + decocass_init_common(machine); LOG(0,("dongle type #3 (PAL)\n")); decocass_dongle_r = decocass_type3_r; decocass_dongle_w = decocass_type3_w; @@ -1907,7 +1907,7 @@ MACHINE_RESET( cprobowl ) MACHINE_RESET( cnightst ) { - decocass_init_common(); + decocass_init_common(machine); LOG(0,("dongle type #3 (PAL)\n")); decocass_dongle_r = decocass_type3_r; decocass_dongle_w = decocass_type3_w; @@ -1916,7 +1916,7 @@ MACHINE_RESET( cnightst ) MACHINE_RESET( cprosocc ) { - decocass_init_common(); + decocass_init_common(machine); LOG(0,("dongle type #3 (PAL)\n")); decocass_dongle_r = decocass_type3_r; decocass_dongle_w = decocass_type3_w; @@ -1925,7 +1925,7 @@ MACHINE_RESET( cprosocc ) MACHINE_RESET( cppicf ) { - decocass_init_common(); + decocass_init_common(machine); LOG(0,("dongle type #3 (PAL)\n")); decocass_dongle_r = decocass_type3_r; decocass_dongle_w = decocass_type3_w; @@ -1934,7 +1934,7 @@ MACHINE_RESET( cppicf ) MACHINE_RESET( cscrtry ) { - decocass_init_common(); + decocass_init_common(machine); LOG(0,("dongle type #4 (32K ROM)\n")); decocass_dongle_r = decocass_type4_r; decocass_dongle_w = decocass_type4_w; @@ -1942,7 +1942,7 @@ MACHINE_RESET( cscrtry ) MACHINE_RESET( cbdash ) { - decocass_init_common(); + decocass_init_common(machine); LOG(0,("dongle type #5 (NOP)\n")); decocass_dongle_r = decocass_type5_r; decocass_dongle_w = decocass_type5_w; @@ -1950,15 +1950,15 @@ MACHINE_RESET( cbdash ) MACHINE_RESET( cflyball ) { - decocass_init_common(); + decocass_init_common(machine); LOG(0,("no dongle\n")); decocass_dongle_r = decocass_nodong_r; } MACHINE_RESET( czeroize ) { - UINT8 *mem = memory_region(REGION_USER1); - decocass_init_common(); + UINT8 *mem = memory_region(machine, REGION_USER1); + decocass_init_common(machine); LOG(0,("dongle type #3 (PAL)\n")); decocass_dongle_r = decocass_type3_r; decocass_dongle_w = decocass_type3_w; @@ -2133,7 +2133,7 @@ READ8_HANDLER( i8041_p2_r ) UINT8 data; static int i8041_p2_old; - tape_update(); + tape_update(machine); data = i8041_p2; diff --git a/src/mame/machine/decocrpt.c b/src/mame/machine/decocrpt.c index c482017d344..391c27aa65e 100644 --- a/src/mame/machine/decocrpt.c +++ b/src/mame/machine/decocrpt.c @@ -598,10 +598,10 @@ static const UINT8 deco74_swap_table[0x800] = 4,7,2,2,1,3,4,4,1,7,0,2,5,4,7,3,7,6,1,5,6,0,7,4,1,1,5,2,2,6,7,2, }; -static void deco_decrypt(int mem_region,const UINT8 *xor_table,const UINT16 *address_table,const UINT8 *swap_table,int remap_only) +static void deco_decrypt(running_machine *machine,int mem_region,const UINT8 *xor_table,const UINT16 *address_table,const UINT8 *swap_table,int remap_only) { - UINT16 *rom = (UINT16 *)memory_region(mem_region); - int len = memory_region_length(mem_region)/2; + UINT16 *rom = (UINT16 *)memory_region(machine, mem_region); + int len = memory_region_length(machine, mem_region)/2; UINT16 *buffer = malloc_or_die(len*2); int i; @@ -653,18 +653,18 @@ static void deco_decrypt(int mem_region,const UINT8 *xor_table,const UINT16 *add #endif } -void deco56_decrypt(int region) +void deco56_decrypt(running_machine *machine, int region) { - deco_decrypt(region,deco56_xor_table,deco56_address_table,deco56_swap_table, 0); + deco_decrypt(machine,region,deco56_xor_table,deco56_address_table,deco56_swap_table, 0); } -void deco74_decrypt(int region) +void deco74_decrypt(running_machine *machine, int region) { - deco_decrypt(region,deco74_xor_table,deco74_address_table,deco74_swap_table, 0); + deco_decrypt(machine,region,deco74_xor_table,deco74_address_table,deco74_swap_table, 0); } -void deco56_remap(int region) +void deco56_remap(running_machine *machine, int region) { // Apply address remap, but not XOR/shift - deco_decrypt(region,deco56_xor_table,deco56_address_table,deco56_swap_table, 1); + deco_decrypt(machine,region,deco56_xor_table,deco56_address_table,deco56_swap_table, 1); } diff --git a/src/mame/machine/fd1089.c b/src/mame/machine/fd1089.c index c24d7d9cf52..cdcb8ccb530 100644 --- a/src/mame/machine/fd1089.c +++ b/src/mame/machine/fd1089.c @@ -7571,10 +7571,10 @@ static UINT16 fd1089_decrypt(offs_t addr,UINT16 val,const UINT8 *key,int opcode, static UINT16 *decrypted; -static void sys16_decrypt(const UINT8 *key,int cputype) +static void sys16_decrypt(running_machine *machine, const UINT8 *key,int cputype) { - UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1); - int size = memory_region_length(REGION_CPU1); + UINT16 *rom = (UINT16 *)memory_region(machine, REGION_CPU1); + int size = memory_region_length(machine, REGION_CPU1); int A; decrypted = (UINT16 *)auto_malloc(size); @@ -7599,73 +7599,73 @@ void *fd1089_get_decrypted_base(void) -void fd1089_decrypt_0013A(void) +void fd1089_decrypt_0013A(running_machine *machine) { - sys16_decrypt(key_0013A,FD1089B); + sys16_decrypt(machine, key_0013A,FD1089B); } -void fd1089_decrypt_0018(void) +void fd1089_decrypt_0018(running_machine *machine) { - sys16_decrypt(key_0018,FD1089A); + sys16_decrypt(machine, key_0018,FD1089A); } -void fd1089_decrypt_0021(void) +void fd1089_decrypt_0021(running_machine *machine) { - sys16_decrypt(key_0021,FD1089A); + sys16_decrypt(machine, key_0021,FD1089A); } -void fd1089_decrypt_0022(void) +void fd1089_decrypt_0022(running_machine *machine) { - sys16_decrypt(key_0022,FD1089A); + sys16_decrypt(machine, key_0022,FD1089A); } -void fd1089_decrypt_0024(void) +void fd1089_decrypt_0024(running_machine *machine) { - sys16_decrypt(key_0024,FD1089B); + sys16_decrypt(machine, key_0024,FD1089B); } -void fd1089_decrypt_0027(void) +void fd1089_decrypt_0027(running_machine *machine) { - sys16_decrypt(key_0027,FD1089B); + sys16_decrypt(machine, key_0027,FD1089B); } -void fd1089_decrypt_0028(void) +void fd1089_decrypt_0028(running_machine *machine) { - sys16_decrypt(key_0028,FD1089A); + sys16_decrypt(machine, key_0028,FD1089A); } -void fd1089_decrypt_0033(void) +void fd1089_decrypt_0033(running_machine *machine) { - sys16_decrypt(key_0033,FD1089A); + sys16_decrypt(machine, key_0033,FD1089A); } -void fd1089_decrypt_0034(void) +void fd1089_decrypt_0034(running_machine *machine) { - sys16_decrypt(key_0034,FD1089B); + sys16_decrypt(machine, key_0034,FD1089B); } -void fd1089_decrypt_0037(void) +void fd1089_decrypt_0037(running_machine *machine) { - sys16_decrypt(key_0037,FD1089B); + sys16_decrypt(machine, key_0037,FD1089B); } -void fd1089_decrypt_0167(void) +void fd1089_decrypt_0167(running_machine *machine) { - sys16_decrypt(key_0167,FD1089A); + sys16_decrypt(machine, key_0167,FD1089A); } -void fd1089_decrypt_0168(void) +void fd1089_decrypt_0168(running_machine *machine) { - sys16_decrypt(key_0168,FD1089B); + sys16_decrypt(machine, key_0168,FD1089B); } -void fd1089_decrypt_5021(void) +void fd1089_decrypt_5021(running_machine *machine) { - sys16_decrypt(key_5021,FD1089B); + sys16_decrypt(machine, key_5021,FD1089B); } -void fd1089_decrypt_wb35(void) +void fd1089_decrypt_wb35(running_machine *machine) { - sys16_decrypt(key_wb35,FD1089A); + sys16_decrypt(machine, key_wb35,FD1089A); } diff --git a/src/mame/machine/fd1089.h b/src/mame/machine/fd1089.h index 322d6506ea1..a02d5abc5f9 100644 --- a/src/mame/machine/fd1089.h +++ b/src/mame/machine/fd1089.h @@ -1,15 +1,16 @@ void *fd1089_get_decrypted_base(void); -void fd1089_decrypt_0013A(void); -void fd1089_decrypt_0018(void); -void fd1089_decrypt_0021(void); -void fd1089_decrypt_0022(void); -void fd1089_decrypt_0024(void); -void fd1089_decrypt_0027(void); -void fd1089_decrypt_0028(void); -void fd1089_decrypt_0033(void); -void fd1089_decrypt_0034(void); -void fd1089_decrypt_0037(void); -void fd1089_decrypt_0167(void); -void fd1089_decrypt_0168(void); -void fd1089_decrypt_5021(void); -void fd1089_decrypt_wb35(void); + +void fd1089_decrypt_0013A(running_machine *machine); +void fd1089_decrypt_0018(running_machine *machine); +void fd1089_decrypt_0021(running_machine *machine); +void fd1089_decrypt_0022(running_machine *machine); +void fd1089_decrypt_0024(running_machine *machine); +void fd1089_decrypt_0027(running_machine *machine); +void fd1089_decrypt_0028(running_machine *machine); +void fd1089_decrypt_0033(running_machine *machine); +void fd1089_decrypt_0034(running_machine *machine); +void fd1089_decrypt_0037(running_machine *machine); +void fd1089_decrypt_0167(running_machine *machine); +void fd1089_decrypt_0168(running_machine *machine); +void fd1089_decrypt_5021(running_machine *machine); +void fd1089_decrypt_wb35(running_machine *machine); diff --git a/src/mame/machine/fddebug.c b/src/mame/machine/fddebug.c index def710dde05..76702632bb2 100644 --- a/src/mame/machine/fddebug.c +++ b/src/mame/machine/fddebug.c @@ -485,11 +485,11 @@ void fd1094_init_debugging(running_machine *machine, int cpureg, int keyreg, int key_changed = changed; /* set up the regions */ - coderegion = (UINT16 *)memory_region(cpureg); - coderegion_words = memory_region_length(cpureg) / 2; - keyregion = (UINT8 *)memory_region(keyreg); - keystatus = (UINT16 *)memory_region(statreg); - keystatus_words = memory_region_length(statreg) / 2; + coderegion = (UINT16 *)memory_region(machine, cpureg); + coderegion_words = memory_region_length(machine, cpureg) / 2; + keyregion = (UINT8 *)memory_region(machine, keyreg); + keystatus = (UINT16 *)memory_region(machine, statreg); + keystatus_words = memory_region_length(machine, statreg) / 2; assert(coderegion_words == keystatus_words); /* allocate memory for the ignore table */ diff --git a/src/mame/machine/gaelco2.c b/src/mame/machine/gaelco2.c index 7faae0a55a6..78f80460661 100644 --- a/src/mame/machine/gaelco2.c +++ b/src/mame/machine/gaelco2.c @@ -17,15 +17,15 @@ ***************************************************************************/ -static void gaelco2_ROM16_split(int src_reg, int dst_reg, int start, int length, int dest1, int dest2) +static void gaelco2_ROM16_split(running_machine *machine, int src_reg, int dst_reg, int start, int length, int dest1, int dest2) { int i; /* get a pointer to the source data */ - UINT8 *src = (UINT8 *)memory_region(src_reg); + UINT8 *src = (UINT8 *)memory_region(machine, src_reg); /* get a pointer to the destination data */ - UINT8 *dst = (UINT8 *)memory_region(dst_reg); + UINT8 *dst = (UINT8 *)memory_region(machine, dst_reg); /* fill destination areas with the proper data */ for (i = 0; i < length/2; i++){ @@ -62,16 +62,16 @@ DRIVER_INIT( alighunt ) */ /* split ROM u48 */ - gaelco2_ROM16_split(REGION_GFX2, REGION_GFX1, 0x0000000, 0x0400000, 0x0000000, 0x0400000); + gaelco2_ROM16_split(machine, REGION_GFX2, REGION_GFX1, 0x0000000, 0x0400000, 0x0000000, 0x0400000); /* split ROM u47 */ - gaelco2_ROM16_split(REGION_GFX2, REGION_GFX1, 0x0400000, 0x0400000, 0x0200000, 0x0600000); + gaelco2_ROM16_split(machine, REGION_GFX2, REGION_GFX1, 0x0400000, 0x0400000, 0x0200000, 0x0600000); /* split ROM u50 */ - gaelco2_ROM16_split(REGION_GFX2, REGION_GFX1, 0x0800000, 0x0400000, 0x0800000, 0x0c00000); + gaelco2_ROM16_split(machine, REGION_GFX2, REGION_GFX1, 0x0800000, 0x0400000, 0x0800000, 0x0c00000); /* split ROM u49 */ - gaelco2_ROM16_split(REGION_GFX2, REGION_GFX1, 0x0c00000, 0x0400000, 0x0a00000, 0x0e00000); + gaelco2_ROM16_split(machine, REGION_GFX2, REGION_GFX1, 0x0c00000, 0x0400000, 0x0a00000, 0x0e00000); } @@ -93,13 +93,13 @@ DRIVER_INIT( touchgo ) */ /* split ROM ic65 */ - gaelco2_ROM16_split(REGION_GFX2, REGION_GFX1, 0x0000000, 0x0400000, 0x0000000, 0x0400000); + gaelco2_ROM16_split(machine, REGION_GFX2, REGION_GFX1, 0x0000000, 0x0400000, 0x0000000, 0x0400000); /* split ROM ic66 */ - gaelco2_ROM16_split(REGION_GFX2, REGION_GFX1, 0x0400000, 0x0200000, 0x0200000, 0x0600000); + gaelco2_ROM16_split(machine, REGION_GFX2, REGION_GFX1, 0x0400000, 0x0200000, 0x0200000, 0x0600000); /* split ROM ic67 */ - gaelco2_ROM16_split(REGION_GFX2, REGION_GFX1, 0x0800000, 0x0400000, 0x0800000, 0x0c00000); + gaelco2_ROM16_split(machine, REGION_GFX2, REGION_GFX1, 0x0800000, 0x0400000, 0x0800000, 0x0c00000); } @@ -121,13 +121,13 @@ DRIVER_INIT( snowboar ) */ /* split ROM sb44 */ - gaelco2_ROM16_split(REGION_GFX2, REGION_GFX1, 0x0000000, 0x0400000, 0x0000000, 0x0400000); + gaelco2_ROM16_split(machine, REGION_GFX2, REGION_GFX1, 0x0000000, 0x0400000, 0x0000000, 0x0400000); /* split ROM sb45 */ - gaelco2_ROM16_split(REGION_GFX2, REGION_GFX1, 0x0400000, 0x0400000, 0x0200000, 0x0600000); + gaelco2_ROM16_split(machine, REGION_GFX2, REGION_GFX1, 0x0400000, 0x0400000, 0x0200000, 0x0600000); /* split ROM sb46 */ - gaelco2_ROM16_split(REGION_GFX2, REGION_GFX1, 0x0800000, 0x0400000, 0x0800000, 0x0c00000); + gaelco2_ROM16_split(machine, REGION_GFX2, REGION_GFX1, 0x0800000, 0x0400000, 0x0800000, 0x0c00000); } /*************************************************************************** diff --git a/src/mame/machine/galaxold.c b/src/mame/machine/galaxold.c index b5d7fe55247..d13aaf312be 100644 --- a/src/mame/machine/galaxold.c +++ b/src/mame/machine/galaxold.c @@ -159,7 +159,7 @@ WRITE8_HANDLER( zigzag_sillyprotection_w ) DRIVER_INIT( zigzag ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); memory_configure_bank(1, 0, 2, &RAM[0x2000], 0x1000); memory_configure_bank(2, 0, 2, &RAM[0x2000], 0x1000); memory_set_bank(1, 0); @@ -187,7 +187,7 @@ static READ8_HANDLER( dingoe_3001_r ) DRIVER_INIT( dingoe ) { offs_t i; - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); for (i = 0; i < 0x3000; i++) { @@ -299,8 +299,8 @@ DRIVER_INIT( mooncrsu ) DRIVER_INIT( mooncrst ) { - offs_t i, len = memory_region_length(REGION_CPU1); - UINT8 *rom = memory_region(REGION_CPU1); + offs_t i, len = memory_region_length(machine, REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); for (i = 0;i < len;i++) @@ -317,7 +317,7 @@ DRIVER_INIT( mooncrgx ) DRIVER_INIT( moonqsr ) { offs_t i; - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); UINT8 *decrypt = auto_malloc(0x8000); memory_set_decrypted_region(0, 0x0000, 0x7fff, decrypt); @@ -375,8 +375,8 @@ Pin layout is such that links can replace the PAL if encryption is not used. { 1,4,1,4 } }; - offs_t i, len = memory_region_length(REGION_CPU1); - UINT8 *rom = memory_region(REGION_CPU1); + offs_t i, len = memory_region_length(machine, REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); for (i = 0; i < len; i++) @@ -393,8 +393,8 @@ Pin layout is such that links can replace the PAL if encryption is not used. DRIVER_INIT( 4in1 ) { - offs_t i, len = memory_region_length(REGION_CPU1); - UINT8 *RAM = memory_region(REGION_CPU1); + offs_t i, len = memory_region_length(machine, REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); /* Decrypt Program Roms */ for (i = 0; i < len; i++) diff --git a/src/mame/machine/harddriv.c b/src/mame/machine/harddriv.c index ce6c48c0dd0..e400b62e3c3 100644 --- a/src/mame/machine/harddriv.c +++ b/src/mame/machine/harddriv.c @@ -167,9 +167,9 @@ static TIMER_CALLBACK( duart_callback ); MACHINE_START( harddriv ) { /* predetermine memory regions */ - sim_memory = (UINT16 *)memory_region(REGION_USER1); + sim_memory = (UINT16 *)memory_region(machine, REGION_USER1); som_memory = (UINT16 *)auto_malloc(0x8000); - sim_memory_size = memory_region_length(REGION_USER1) / 2; + sim_memory_size = memory_region_length(machine, REGION_USER1) / 2; adsp_pgm_memory_word = (UINT16 *)((UINT8 *)hdadsp_pgm_memory + 1); } diff --git a/src/mame/machine/irobot.c b/src/mame/machine/irobot.c index 20ffcd94025..6219e064d73 100644 --- a/src/mame/machine/irobot.c +++ b/src/mame/machine/irobot.c @@ -123,7 +123,7 @@ WRITE8_HANDLER( irobot_statwr_w ) WRITE8_HANDLER( irobot_out0_w ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); irobot_out0 = data; switch (data & 0x60) @@ -145,7 +145,7 @@ WRITE8_HANDLER( irobot_out0_w ) WRITE8_HANDLER( irobot_rom_banksel_w ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); switch ((data & 0x0E) >> 1) { @@ -191,7 +191,7 @@ static TIMER_CALLBACK( scanline_callback ) static TIMER_CALLBACK( irmb_done_callback ); MACHINE_RESET( irobot ) { - UINT8 *MB = memory_region(REGION_CPU2); + UINT8 *MB = memory_region(machine, REGION_CPU2); /* initialize the memory regions */ mbROM = MB + 0x00000; @@ -369,9 +369,9 @@ static void irmb_dout(const irmb_ops *curop, UINT32 d) /* Convert microcode roms to a more usable form */ -static void load_oproms(void) +static void load_oproms(running_machine *machine) { - UINT8 *MB = memory_region(REGION_PROMS) + 0x20; + UINT8 *MB = memory_region(machine, REGION_PROMS) + 0x20; int i; /* allocate RAM */ @@ -450,7 +450,7 @@ DRIVER_INIT( irobot ) irmb_regs[i] = 0; } irmb_latch=0; - load_oproms(); + load_oproms(machine); } static TIMER_CALLBACK( irmb_done_callback ) diff --git a/src/mame/machine/jackal.c b/src/mame/machine/jackal.c index 76e0f3a3e88..43da9db24c7 100644 --- a/src/mame/machine/jackal.c +++ b/src/mame/machine/jackal.c @@ -19,7 +19,7 @@ static UINT8 *jackal_spritebank = 0; MACHINE_RESET( jackal ) { - UINT8 *rgn = memory_region(REGION_CPU1); + UINT8 *rgn = memory_region(machine, REGION_CPU1); // HACK: running at the nominal clock rate, music stops working // at the beginning of the game. This fixes it. @@ -52,7 +52,7 @@ READ8_HANDLER( jackal_spriteram_r ) WRITE8_HANDLER( jackal_rambank_w ) { - UINT8 *rgn = memory_region(REGION_CPU1); + UINT8 *rgn = memory_region(machine, REGION_CPU1); if (data & 0x04) popmessage("jackal_rambank_w %02x",data); coin_counter_w(0,data & 0x01); diff --git a/src/mame/machine/jumpshot.c b/src/mame/machine/jumpshot.c index 587fee3b99b..17613023444 100644 --- a/src/mame/machine/jumpshot.c +++ b/src/mame/machine/jumpshot.c @@ -39,14 +39,14 @@ static UINT8 decrypt(int addr, UINT8 e) } -void jumpshot_decode(void) +void jumpshot_decode(running_machine *machine) { int i; UINT8 *RAM; /* CPU ROMs */ - RAM = memory_region(REGION_CPU1); + RAM = memory_region(machine, REGION_CPU1); for (i = 0; i < 0x4000; i++) { RAM[i] = decrypt(i,RAM[i]); diff --git a/src/mame/machine/kabuki.c b/src/mame/machine/kabuki.c index 13dd5c2f1b8..18c7e80bf77 100644 --- a/src/mame/machine/kabuki.c +++ b/src/mame/machine/kabuki.c @@ -159,11 +159,11 @@ static void kabuki_decode(UINT8 *src,UINT8 *dest_op,UINT8 *dest_data, -static void mitchell_decode(int swap_key1,int swap_key2,int addr_key,int xor_key) +static void mitchell_decode(running_machine *machine, int swap_key1,int swap_key2,int addr_key,int xor_key) { - UINT8 *rom = memory_region(REGION_CPU1); - UINT8 *decrypt = auto_malloc(memory_region_length(REGION_CPU1)); - int numbanks = (memory_region_length(REGION_CPU1) - 0x10000) / 0x4000; + UINT8 *rom = memory_region(machine, REGION_CPU1); + UINT8 *decrypt = auto_malloc(memory_region_length(machine, REGION_CPU1)); + int numbanks = (memory_region_length(machine, REGION_CPU1) - 0x10000) / 0x4000; int i; memory_set_decrypted_region(0, 0x0000, 0x7fff, decrypt); @@ -186,29 +186,29 @@ static void mitchell_decode(int swap_key1,int swap_key2,int addr_key,int xor_key */ } -void mgakuen2_decode(void) { mitchell_decode(0x76543210,0x01234567,0xaa55,0xa5); } -void pang_decode(void) { mitchell_decode(0x01234567,0x76543210,0x6548,0x24); } -void cworld_decode(void) { mitchell_decode(0x04152637,0x40516273,0x5751,0x43); } -void hatena_decode(void) { mitchell_decode(0x45670123,0x45670123,0x5751,0x43); } -void spang_decode(void) { mitchell_decode(0x45670123,0x45670123,0x5852,0x43); } -void spangj_decode(void) { mitchell_decode(0x45123670,0x67012345,0x55aa,0x5a); } -void sbbros_decode(void) { mitchell_decode(0x45670123,0x45670123,0x2130,0x12); } -void marukin_decode(void) { mitchell_decode(0x54321076,0x54321076,0x4854,0x4f); } -void qtono1_decode(void) { mitchell_decode(0x12345670,0x12345670,0x1111,0x11); } -void qsangoku_decode(void) { mitchell_decode(0x23456701,0x23456701,0x1828,0x18); } -void block_decode(void) { mitchell_decode(0x02461357,0x64207531,0x0002,0x01); } +void mgakuen2_decode(running_machine *machine) { mitchell_decode(machine,0x76543210,0x01234567,0xaa55,0xa5); } +void pang_decode(running_machine *machine) { mitchell_decode(machine,0x01234567,0x76543210,0x6548,0x24); } +void cworld_decode(running_machine *machine) { mitchell_decode(machine,0x04152637,0x40516273,0x5751,0x43); } +void hatena_decode(running_machine *machine) { mitchell_decode(machine,0x45670123,0x45670123,0x5751,0x43); } +void spang_decode(running_machine *machine) { mitchell_decode(machine,0x45670123,0x45670123,0x5852,0x43); } +void spangj_decode(running_machine *machine) { mitchell_decode(machine,0x45123670,0x67012345,0x55aa,0x5a); } +void sbbros_decode(running_machine *machine) { mitchell_decode(machine,0x45670123,0x45670123,0x2130,0x12); } +void marukin_decode(running_machine *machine) { mitchell_decode(machine,0x54321076,0x54321076,0x4854,0x4f); } +void qtono1_decode(running_machine *machine) { mitchell_decode(machine,0x12345670,0x12345670,0x1111,0x11); } +void qsangoku_decode(running_machine *machine) { mitchell_decode(machine,0x23456701,0x23456701,0x1828,0x18); } +void block_decode(running_machine *machine) { mitchell_decode(machine,0x02461357,0x64207531,0x0002,0x01); } -static void cps1_decode(int swap_key1,int swap_key2,int addr_key,int xor_key) +static void cps1_decode(running_machine *machine,int swap_key1,int swap_key2,int addr_key,int xor_key) { UINT8 *decrypt = auto_malloc(0x8000); - UINT8 *rom = memory_region(REGION_CPU2); + UINT8 *rom = memory_region(machine, REGION_CPU2); memory_set_decrypted_region(1, 0x0000, 0x7fff, decrypt); kabuki_decode(rom,decrypt,rom,0x0000,0x8000, swap_key1,swap_key2,addr_key,xor_key); } -void wof_decode(void) { cps1_decode(0x01234567,0x54163072,0x5151,0x51); } -void dino_decode(void) { cps1_decode(0x76543210,0x24601357,0x4343,0x43); } -void punisher_decode(void) { cps1_decode(0x67452103,0x75316024,0x2222,0x22); } -void slammast_decode(void) { cps1_decode(0x54321076,0x65432107,0x3131,0x19); } +void wof_decode(running_machine *machine) { cps1_decode(machine,0x01234567,0x54163072,0x5151,0x51); } +void dino_decode(running_machine *machine) { cps1_decode(machine,0x76543210,0x24601357,0x4343,0x43); } +void punisher_decode(running_machine *machine) { cps1_decode(machine,0x67452103,0x75316024,0x2222,0x22); } +void slammast_decode(running_machine *machine) { cps1_decode(machine,0x54321076,0x65432107,0x3131,0x19); } diff --git a/src/mame/machine/konami1.c b/src/mame/machine/konami1.c index fe5e9efed91..f01f7833961 100644 --- a/src/mame/machine/konami1.c +++ b/src/mame/machine/konami1.c @@ -40,10 +40,10 @@ static UINT8 konami1_decodebyte( UINT8 opcode, UINT16 address ) -UINT8 *konami1_decode(int cpu) +UINT8 *konami1_decode(running_machine *machine, int cpu) { - const UINT8 *rom = memory_region(REGION_CPU1+cpu); - int size = memory_region_length(REGION_CPU1+cpu); + const UINT8 *rom = memory_region(machine, REGION_CPU1+cpu); + int size = memory_region_length(machine, REGION_CPU1+cpu); int A; UINT8 *decrypted = auto_malloc(size); diff --git a/src/mame/machine/konami1.h b/src/mame/machine/konami1.h index 231fa992e49..4c7ac7c0ebf 100644 --- a/src/mame/machine/konami1.h +++ b/src/mame/machine/konami1.h @@ -1 +1 @@ -UINT8 *konami1_decode(int cpu); +UINT8 *konami1_decode(running_machine *machine, int cpu); diff --git a/src/mame/machine/leland.c b/src/mame/machine/leland.c index 9d1632c3c57..c2d9598813c 100644 --- a/src/mame/machine/leland.c +++ b/src/mame/machine/leland.c @@ -397,13 +397,13 @@ MACHINE_RESET( leland ) alternate_bank = 0; /* initialize the master banks */ - master_length = memory_region_length(REGION_CPU1); - master_base = memory_region(REGION_CPU1); + master_length = memory_region_length(machine, REGION_CPU1); + master_base = memory_region(machine, REGION_CPU1); (*leland_update_master_bank)(); /* initialize the slave banks */ - slave_length = memory_region_length(REGION_CPU2); - slave_base = memory_region(REGION_CPU2); + slave_length = memory_region_length(machine, REGION_CPU2); + slave_base = memory_region(machine, REGION_CPU2); if (slave_length > 0x10000) memory_set_bankptr(3, &slave_base[0x10000]); @@ -430,8 +430,8 @@ MACHINE_RESET( ataxx ) timer_adjust_oneshot(master_int_timer, video_screen_get_time_until_pos(machine->primary_screen, 8, 0), 8); /* initialize the XROM */ - xrom_length = memory_region_length(REGION_USER1); - xrom_base = memory_region(REGION_USER1); + xrom_length = memory_region_length(machine, REGION_USER1); + xrom_base = memory_region(machine, REGION_USER1); xrom1_addr = 0; xrom2_addr = 0; @@ -445,13 +445,13 @@ MACHINE_RESET( ataxx ) master_bank = 0; /* initialize the master banks */ - master_length = memory_region_length(REGION_CPU1); - master_base = memory_region(REGION_CPU1); + master_length = memory_region_length(machine, REGION_CPU1); + master_base = memory_region(machine, REGION_CPU1); ataxx_bankswitch(); /* initialize the slave banks */ - slave_length = memory_region_length(REGION_CPU2); - slave_base = memory_region(REGION_CPU2); + slave_length = memory_region_length(machine, REGION_CPU2); + slave_base = memory_region(machine, REGION_CPU2); if (slave_length > 0x10000) memory_set_bankptr(3, &slave_base[0x10000]); @@ -1475,11 +1475,11 @@ READ8_HANDLER( leland_raster_r ) *************************************/ /* also called by Ataxx */ -void leland_rotate_memory(int cpunum) +void leland_rotate_memory(running_machine *machine, int cpunum) { int startaddr = 0x10000; - int banks = (memory_region_length(REGION_CPU1 + cpunum) - startaddr) / 0x8000; - UINT8 *ram = memory_region(REGION_CPU1 + cpunum); + int banks = (memory_region_length(machine, REGION_CPU1 + cpunum) - startaddr) / 0x8000; + UINT8 *ram = memory_region(machine, REGION_CPU1 + cpunum); UINT8 temp[0x2000]; int i; diff --git a/src/mame/machine/mc8123.c b/src/mame/machine/mc8123.c index 111fd215d13..d3ff375b24e 100644 --- a/src/mame/machine/mc8123.c +++ b/src/mame/machine/mc8123.c @@ -374,11 +374,11 @@ static UINT8 mc8123_decrypt(offs_t addr,UINT8 val,const UINT8 *key,int opcode) } -void mc8123_decrypt_rom(int cpunum, const UINT8* key, int banknum, int numbanks) +void mc8123_decrypt_rom(running_machine *machine, int cpunum, const UINT8* key, int banknum, int numbanks) { UINT8 *decrypted1 = auto_malloc(numbanks == 1 ? 0xc000 : 0x8000); UINT8 *decrypted2 = numbanks > 1 ? auto_malloc(0x4000 * numbanks) : decrypted1 + 0x8000; - UINT8 *rom = memory_region(REGION_CPU1 + cpunum); + UINT8 *rom = memory_region(machine, REGION_CPU1 + cpunum); int A, bank; memory_set_decrypted_region(cpunum, 0x0000, 0x7fff, decrypted1); diff --git a/src/mame/machine/mc8123.h b/src/mame/machine/mc8123.h index 009a24f2433..dd236e2558e 100644 --- a/src/mame/machine/mc8123.h +++ b/src/mame/machine/mc8123.h @@ -2,4 +2,4 @@ // an arbitrary amount of banks at 8000-BFFF. // numbanks may be 0, meaning there is no ROM to decrypt at 8000-BFFF, // or 1, meaning 0000-BFFF will be decrypted as a single unit. -void mc8123_decrypt_rom(int cpunum, const UINT8* key, int banknum, int numbanks); +void mc8123_decrypt_rom(running_machine *machine, int cpunum, const UINT8* key, int banknum, int numbanks); diff --git a/src/mame/machine/mhavoc.c b/src/mame/machine/mhavoc.c index 2fb9c903afe..371768c9f6b 100644 --- a/src/mame/machine/mhavoc.c +++ b/src/mame/machine/mhavoc.c @@ -88,7 +88,7 @@ MACHINE_RESET( mhavoc ) memory_configure_bank(1, 0, 1, mhavoc_zram0, 0); memory_configure_bank(1, 1, 1, mhavoc_zram1, 0); - memory_configure_bank(2, 0, 4, memory_region(REGION_CPU1) + 0x10000, 0x2000); + memory_configure_bank(2, 0, 4, memory_region(machine, REGION_CPU1) + 0x10000, 0x2000); /* reset RAM/ROM banks to 0 */ mhavoc_ram_banksel_w(machine, 0, 0); diff --git a/src/mame/machine/midtunit.c b/src/mame/machine/midtunit.c index 0c592359f00..7417a8b73ad 100644 --- a/src/mame/machine/midtunit.c +++ b/src/mame/machine/midtunit.c @@ -392,7 +392,7 @@ static READ16_HANDLER( jdredd_hack_r ) * *************************************/ -static void init_tunit_generic(int sound) +static void init_tunit_generic(running_machine *machine, int sound) { offs_t gfx_chunk = midyunit_gfx_rom_size / 4; UINT8 *base; @@ -402,7 +402,7 @@ static void init_tunit_generic(int sound) register_state_saving(); /* load the graphics ROMs -- quadruples */ - base = memory_region(REGION_GFX1); + base = memory_region(machine, REGION_GFX1); for (i = 0; i < midyunit_gfx_rom_size; i += 4) { midyunit_gfx_rom[i + 0] = base[0 * gfx_chunk + i / 4]; @@ -442,7 +442,7 @@ static void init_tunit_generic(int sound) DRIVER_INIT( mktunit ) { /* common init */ - init_tunit_generic(SOUND_ADPCM); + init_tunit_generic(machine, SOUND_ADPCM); /* protection */ memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1b00000, 0x1b6ffff, 0, 0, mk_prot_r, mk_prot_w); @@ -455,7 +455,7 @@ DRIVER_INIT( mktunit ) static void init_nbajam_common(running_machine *machine, int te_protection) { /* common init */ - init_tunit_generic(SOUND_ADPCM_LARGE); + init_tunit_generic(machine, SOUND_ADPCM_LARGE); /* protection */ if (!te_protection) @@ -491,7 +491,7 @@ DRIVER_INIT( nbajamte ) DRIVER_INIT( jdreddp ) { /* common init */ - init_tunit_generic(SOUND_ADPCM_LARGE); + init_tunit_generic(machine, SOUND_ADPCM_LARGE); /* looks like the watchdog needs to be disabled */ memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x01d81060, 0x01d8107f, 0, 0, SMH_NOP); @@ -522,7 +522,7 @@ DRIVER_INIT( jdreddp ) DRIVER_INIT( mk2 ) { /* common init */ - init_tunit_generic(SOUND_DCS); + init_tunit_generic(machine, SOUND_DCS); midtunit_gfx_rom_large = 1; /* protection */ diff --git a/src/mame/machine/midwunit.c b/src/mame/machine/midwunit.c index 1ed8369ec52..fa27d282da9 100644 --- a/src/mame/machine/midwunit.c +++ b/src/mame/machine/midwunit.c @@ -376,8 +376,8 @@ static void init_wunit_generic(void) register_state_saving(); /* load the graphics ROMs -- quadruples */ - midyunit_gfx_rom = base = memory_region(REGION_GFX1); - len = memory_region_length(REGION_GFX1); + midyunit_gfx_rom = base = memory_region(Machine, REGION_GFX1); + len = memory_region_length(Machine, REGION_GFX1); for (i = 0; i < len / 0x400000; i++) { memcpy(midwunit_decode_memory, base, 0x400000); @@ -582,8 +582,8 @@ DRIVER_INIT( revx ) register_state_saving(); /* load the graphics ROMs -- quadruples */ - midyunit_gfx_rom = base = memory_region(REGION_GFX1); - len = memory_region_length(REGION_GFX1); + midyunit_gfx_rom = base = memory_region(machine, REGION_GFX1); + len = memory_region_length(Machine, REGION_GFX1); for (i = 0; i < len / 0x200000; i++) { memcpy(midwunit_decode_memory, base, 0x200000); diff --git a/src/mame/machine/midyunit.c b/src/mame/machine/midyunit.c index 923f5476d83..5966cd9b720 100644 --- a/src/mame/machine/midyunit.c +++ b/src/mame/machine/midyunit.c @@ -241,7 +241,7 @@ static void init_generic(running_machine *machine, int bpp, int sound, int prot_ int i; /* load graphics ROMs */ - base = memory_region(REGION_GFX1); + base = memory_region(machine, REGION_GFX1); switch (bpp) { case 4: @@ -290,7 +290,7 @@ static void init_generic(running_machine *machine, int bpp, int sound, int prot_ case SOUND_CVSD_SMALL: williams_cvsd_init(0); memory_install_write8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, prot_start, prot_end, 0, 0, cvsd_protection_w); - cvsd_protection_base = memory_region(REGION_CPU2) + 0x10000 + (prot_start - 0x8000); + cvsd_protection_base = memory_region(machine, REGION_CPU2) + 0x10000 + (prot_start - 0x8000); break; case SOUND_CVSD: diff --git a/src/mame/machine/model1.c b/src/mame/machine/model1.c index 50df7288041..f0e47855e67 100644 --- a/src/mame/machine/model1.c +++ b/src/mame/machine/model1.c @@ -494,7 +494,7 @@ static void matrix_rotz(void) static void track_read_quad(void) { - const UINT32 *tgp_data = (const UINT32 *)memory_region(REGION_USER2); + const UINT32 *tgp_data = (const UINT32 *)memory_region(Machine, REGION_USER2); UINT32 a = fifoin_pop(); int offd; @@ -859,7 +859,7 @@ static void f47(void) static void track_read_info(void) { - const UINT32 *tgp_data = (const UINT32 *)memory_region(REGION_USER2); + const UINT32 *tgp_data = (const UINT32 *)memory_region(Machine, REGION_USER2); UINT16 a = fifoin_pop(); int offd; @@ -1006,7 +1006,7 @@ static void tri_calc_pq(float ax, float ay, float bx, float by, float cx, float static void track_lookup(void) { - const UINT32 *tgp_data = (const UINT32 *)memory_region(REGION_USER2); + const UINT32 *tgp_data = (const UINT32 *)memory_region(Machine, REGION_USER2); float a = fifoin_pop_f(); UINT32 b = fifoin_pop(); float c = fifoin_pop_f(); diff --git a/src/mame/machine/mspacman.c b/src/mame/machine/mspacman.c index c387f86a956..734454af72e 100644 --- a/src/mame/machine/mspacman.c +++ b/src/mame/machine/mspacman.c @@ -94,7 +94,7 @@ static UINT32 decrypta2(UINT32 e) -static void mspacman_decode(void) +static void mspacman_decode(running_machine *machine) { int i; UINT8 *RAM; @@ -103,7 +103,7 @@ static void mspacman_decode(void) /* CPU ROMs */ - RAM = memory_region(REGION_CPU1); + RAM = memory_region(machine, REGION_CPU1); for (i = 0; i < 0x1000; i++) { RAM[0x10000+i] = RAM[0x0000+i]; @@ -179,8 +179,8 @@ static void mspacman_decode(void) MACHINE_RESET( mspacman ) { - UINT8 *RAM = memory_region(REGION_CPU1); - mspacman_decode(); + UINT8 *RAM = memory_region(machine, REGION_CPU1); + mspacman_decode(machine); memory_configure_bank(1, 0, 2, &RAM[0x00000], 0x10000); memory_set_bank(1, 0); diff --git a/src/mame/machine/n64.c b/src/mame/machine/n64.c index 518920b5add..dd35b9b4e81 100644 --- a/src/mame/machine/n64.c +++ b/src/mame/machine/n64.c @@ -1577,8 +1577,8 @@ WRITE32_HANDLER( n64_pif_ram_w ) void n64_machine_reset(running_machine *machine) { int i; - //UINT32 *pif_rom = (UINT32*)memory_region(REGION_USER1); - UINT32 *cart = (UINT32*)memory_region(REGION_USER2); + //UINT32 *pif_rom = (UINT32*)memory_region(machine, REGION_USER1); + UINT32 *cart = (UINT32*)memory_region(machine, REGION_USER2); UINT64 boot_checksum; mi_version = 0; diff --git a/src/mame/machine/namcond1.c b/src/mame/machine/namcond1.c index 2544ff3f187..e5880bceea5 100644 --- a/src/mame/machine/namcond1.c +++ b/src/mame/machine/namcond1.c @@ -27,7 +27,7 @@ MACHINE_START( namcond1 ) MACHINE_RESET( namcond1 ) { #ifdef MAME_DEBUG - /*UINT8 *ROM = memory_region(REGION_CPU1);*/ + /*UINT8 *ROM = memory_region(machine, REGION_CPU1);*/ /*UINT32 debug_trigger_addr;*/ /*int i;*/ diff --git a/src/mame/machine/namcos1.c b/src/mame/machine/namcos1.c index e287f18483b..facfe52f5e7 100644 --- a/src/mame/machine/namcos1.c +++ b/src/mame/machine/namcos1.c @@ -573,7 +573,7 @@ static WRITE8_HANDLER( key_type3_w ) WRITE8_HANDLER( namcos1_sound_bankswitch_w ) { - UINT8 *rom = memory_region(REGION_CPU3) + 0xc000; + UINT8 *rom = memory_region(machine, REGION_CPU3) + 0xc000; int bank = (data & 0x70) >> 4; memory_set_bankptr(17,rom + 0x4000 * bank); @@ -787,7 +787,7 @@ static void namcos1_install_bank(int start,int end,read8_machine_func hr,write8_ -static void namcos1_build_banks(read8_machine_func key_r,write8_machine_func key_w) +static void namcos1_build_banks(running_machine *machine,read8_machine_func key_r,write8_machine_func key_w) { int i; @@ -833,7 +833,7 @@ static void namcos1_build_banks(read8_machine_func key_r,write8_machine_func key /* PRG0-PRG7 */ { - UINT8 *rom = memory_region(REGION_USER1); + UINT8 *rom = memory_region(machine, REGION_USER1); namcos1_install_bank(0x200,0x3ff,0,rom_w,0,rom); @@ -924,7 +924,7 @@ WRITE8_HANDLER( namcos1_mcu_bankswitch_w ) /* bit 0-1 : address line A15-A16 */ addr += (data & 3) * 0x8000; - memory_set_bankptr(20, memory_region(REGION_CPU4) + addr); + memory_set_bankptr(20, memory_region(machine, REGION_CPU4) + addr); } @@ -970,7 +970,7 @@ struct namcos1_specific int key_reg6; }; -static void namcos1_driver_init(const struct namcos1_specific *specific ) +static void namcos1_driver_init( running_machine *machine, const struct namcos1_specific *specific ) { static const struct namcos1_specific no_key = { @@ -1004,7 +1004,7 @@ static void namcos1_driver_init(const struct namcos1_specific *specific ) memory_set_bankptr( 19, namcos1_triram ); /* build bank elements */ - namcos1_build_banks(specific->key_r,specific->key_w); + namcos1_build_banks(machine,specific->key_r,specific->key_w); } @@ -1013,7 +1013,7 @@ static void namcos1_driver_init(const struct namcos1_specific *specific ) *******************************************************************************/ DRIVER_INIT( shadowld ) { - namcos1_driver_init(NULL); + namcos1_driver_init(machine, NULL); } /******************************************************************************* @@ -1025,7 +1025,7 @@ DRIVER_INIT( dspirit ) { key_type1_r,key_type1_w, 0x36 }; - namcos1_driver_init(&dspirit_specific); + namcos1_driver_init(machine, &dspirit_specific); } /******************************************************************************* @@ -1037,7 +1037,7 @@ DRIVER_INIT( wldcourt ) { key_type1_r,key_type1_w, 0x35 }; - namcos1_driver_init(&worldcourt_specific); + namcos1_driver_init(machine, &worldcourt_specific); } /******************************************************************************* @@ -1049,7 +1049,7 @@ DRIVER_INIT( blazer ) { key_type1_r,key_type1_w, 0x13 }; - namcos1_driver_init(&blazer_specific); + namcos1_driver_init(machine, &blazer_specific); } /******************************************************************************* @@ -1061,7 +1061,7 @@ DRIVER_INIT( puzlclub ) { key_type1_r,key_type1_w, 0x35 }; - namcos1_driver_init(&puzlclub_specific); + namcos1_driver_init(machine, &puzlclub_specific); } /******************************************************************************* @@ -1073,7 +1073,7 @@ DRIVER_INIT( pacmania ) { key_type2_r,key_type2_w, 0x12 }; - namcos1_driver_init(&pacmania_specific); + namcos1_driver_init(machine, &pacmania_specific); } /******************************************************************************* @@ -1085,7 +1085,7 @@ DRIVER_INIT( alice ) { key_type2_r,key_type2_w, 0x25 }; - namcos1_driver_init(&alice_specific); + namcos1_driver_init(machine, &alice_specific); } /******************************************************************************* @@ -1097,7 +1097,7 @@ DRIVER_INIT( galaga88 ) { key_type2_r,key_type2_w, 0x31 }; - namcos1_driver_init(&galaga88_specific); + namcos1_driver_init(machine, &galaga88_specific); } /******************************************************************************* @@ -1109,7 +1109,7 @@ DRIVER_INIT( ws ) { key_type2_r,key_type2_w, 0x07 }; - namcos1_driver_init(&ws_specific); + namcos1_driver_init(machine, &ws_specific); } /******************************************************************************* @@ -1121,7 +1121,7 @@ DRIVER_INIT( bakutotu ) { key_type2_r,key_type2_w, 0x22 }; - namcos1_driver_init(&bakutotu_specific); + namcos1_driver_init(machine, &bakutotu_specific); #if 0 // resolves CPU deadlocks caused by sloppy coding(see driver\namcos1.c) @@ -1129,7 +1129,7 @@ DRIVER_INIT( bakutotu ) static const UINT8 target[8] = {0x34,0x37,0x35,0x37,0x96,0x00,0x2e,0xed}; UINT8 *rombase, *srcptr, *endptr, *scanptr; - rombase = memory_region(REGION_USER1); + rombase = memory_region(machine, REGION_USER1); srcptr = rombase + 0x1e000; endptr = srcptr + 0xa000; @@ -1159,7 +1159,7 @@ DRIVER_INIT( splatter ) key_type3_r,key_type3_w, 181, 3, 4,-1,-1,-1,-1 }; - namcos1_driver_init(&splatter_specific); + namcos1_driver_init(machine, &splatter_specific); } /******************************************************************************* @@ -1171,7 +1171,7 @@ DRIVER_INIT( rompers ) { key_type3_r,key_type3_w, 182, 7,-1,-1,-1,-1,-1 }; - namcos1_driver_init(&rompers_specific); + namcos1_driver_init(machine, &rompers_specific); } /******************************************************************************* @@ -1183,7 +1183,7 @@ DRIVER_INIT( blastoff ) { key_type3_r,key_type3_w, 183, 0, 7, 3, 5,-1,-1 }; - namcos1_driver_init(&blastoff_specific); + namcos1_driver_init(machine, &blastoff_specific); } /******************************************************************************* @@ -1195,7 +1195,7 @@ DRIVER_INIT( ws89 ) { key_type3_r,key_type3_w, 184, 2,-1,-1,-1,-1,-1 }; - namcos1_driver_init(&ws89_specific); + namcos1_driver_init(machine, &ws89_specific); } /******************************************************************************* @@ -1207,7 +1207,7 @@ DRIVER_INIT( tankfrce ) { key_type3_r,key_type3_w, 185, 5,-1, 1,-1, 2,-1 }; - namcos1_driver_init(&tankfrce_specific); + namcos1_driver_init(machine, &tankfrce_specific); } // Inputs are multiplexed, somehow @@ -1233,7 +1233,7 @@ DRIVER_INIT( tankfrc4 ) { key_type3_r,key_type3_w, 185, 5,-1, 1,-1, 2,-1 }; - namcos1_driver_init(&tankfrce_specific); + namcos1_driver_init(machine, &tankfrce_specific); memory_install_read8_handler(machine, 3, ADDRESS_SPACE_PROGRAM, 0x1400, 0x1401, 0, 0, tankfrc4_input_r); } @@ -1247,7 +1247,7 @@ DRIVER_INIT( dangseed ) { key_type3_r,key_type3_w, 308, 6,-1, 5,-1, 0, 4 }; - namcos1_driver_init(&dangseed_specific); + namcos1_driver_init(machine, &dangseed_specific); } /******************************************************************************* @@ -1259,7 +1259,7 @@ DRIVER_INIT( pistoldm ) { key_type3_r,key_type3_w, 309, 1, 2, 0,-1, 4,-1 }; - namcos1_driver_init(&pistoldm_specific); + namcos1_driver_init(machine, &pistoldm_specific); } /******************************************************************************* @@ -1271,7 +1271,7 @@ DRIVER_INIT( ws90 ) { key_type3_r,key_type3_w, 310, 4,-1, 7,-1, 3,-1 }; - namcos1_driver_init(&ws90_specific); + namcos1_driver_init(machine, &ws90_specific); } /******************************************************************************* @@ -1283,7 +1283,7 @@ DRIVER_INIT( soukobdx ) { key_type3_r,key_type3_w, 311, 2, 3/*?*/, 0,-1, 4,-1 }; - namcos1_driver_init(&soukobdx_specific); + namcos1_driver_init(machine, &soukobdx_specific); } @@ -1325,7 +1325,7 @@ static READ8_HANDLER( quester_paddle_r ) DRIVER_INIT( quester ) { - namcos1_driver_init(NULL); + namcos1_driver_init(machine, NULL); memory_install_read8_handler(machine, 3, ADDRESS_SPACE_PROGRAM, 0x1400, 0x1401, 0, 0, quester_paddle_r); } @@ -1414,7 +1414,7 @@ static READ8_HANDLER( berabohm_buttons_r ) DRIVER_INIT( berabohm ) { - namcos1_driver_init(NULL); + namcos1_driver_init(machine, NULL); memory_install_read8_handler(machine, 3, ADDRESS_SPACE_PROGRAM, 0x1400, 0x1401, 0, 0, berabohm_buttons_r); } @@ -1476,6 +1476,6 @@ static READ8_HANDLER( faceoff_inputs_r ) DRIVER_INIT( faceoff ) { - namcos1_driver_init(NULL); + namcos1_driver_init(machine, NULL); memory_install_read8_handler(machine, 3, ADDRESS_SPACE_PROGRAM, 0x1400, 0x1401, 0, 0, faceoff_inputs_r); } diff --git a/src/mame/machine/namcos2.c b/src/mame/machine/namcos2.c index cf2b8bc60c2..fb5b945bb42 100644 --- a/src/mame/machine/namcos2.c +++ b/src/mame/machine/namcos2.c @@ -163,7 +163,7 @@ READ16_HANDLER( namcos2_68k_eeprom_r ){ /* 68000 Shared memory area - Data ROM area */ /*************************************************************/ READ16_HANDLER( namcos2_68k_data_rom_r ){ - UINT16 *ROM = (UINT16 *)memory_region(REGION_USER1); + UINT16 *ROM = (UINT16 *)memory_region(machine, REGION_USER1); return ROM[offset]; } @@ -712,8 +712,8 @@ INTERRUPT_GEN( namcos2_68k_gpu_vblank ) WRITE8_HANDLER( namcos2_sound_bankselect_w ) { - UINT8 *RAM=memory_region(REGION_CPU3); - UINT32 max = (memory_region_length(REGION_CPU3) - 0x10000) / 0x4000; + UINT8 *RAM=memory_region(machine, REGION_CPU3); + UINT32 max = (memory_region_length(machine, REGION_CPU3) - 0x10000) / 0x4000; int bank = ( data >> 4 ) % max; /* 991104.CAB */ memory_set_bankptr( CPU3_ROM1, &RAM[ 0x10000 + ( 0x4000 * bank ) ] ); } diff --git a/src/mame/machine/nb1413m3.c b/src/mame/machine/nb1413m3.c index 331deba726a..1ec9082b7be 100644 --- a/src/mame/machine/nb1413m3.c +++ b/src/mame/machine/nb1413m3.c @@ -327,8 +327,8 @@ READ8_HANDLER( nb1413m3_sndrom_r ) popmessage("Sound ROM %02X:%05X [B1:%02X B2:%02X]", rombank, offset, nb1413m3_sndrombank1, nb1413m3_sndrombank2); #endif - if (offset < memory_region_length(nb1413m3_sndromregion)) - return memory_region(nb1413m3_sndromregion)[offset]; + if (offset < memory_region_length(machine, nb1413m3_sndromregion)) + return memory_region(machine, nb1413m3_sndromregion)[offset]; else { popmessage("read past sound ROM length (%05x[%02X])",offset, rombank); @@ -351,7 +351,7 @@ WRITE8_HANDLER( nb1413m3_sndrombank2_w ) READ8_HANDLER( nb1413m3_gfxrom_r ) { - UINT8 *GFXROM = memory_region(REGION_GFX1); + UINT8 *GFXROM = memory_region(machine, REGION_GFX1); return GFXROM[(0x20000 * (nb1413m3_gfxrombank | ((nb1413m3_sndrombank1 & 0x02) << 3))) + ((0x0200 * nb1413m3_gfxradr_h) + (0x0002 * nb1413m3_gfxradr_l)) + (offset & 0x01)]; } diff --git a/src/mame/machine/neoboot.c b/src/mame/machine/neoboot.c index 721718d730d..17ee06f2983 100644 --- a/src/mame/machine/neoboot.c +++ b/src/mame/machine/neoboot.c @@ -18,11 +18,11 @@ /* General Bootleg Functions - used by more than 1 game */ -void neogeo_bootleg_cx_decrypt( void ) +void neogeo_bootleg_cx_decrypt( running_machine *machine ) { int i; - int cx_size = memory_region_length( NEOGEO_REGION_SPRITES ); - UINT8 *rom = memory_region( NEOGEO_REGION_SPRITES ); + int cx_size = memory_region_length( machine, NEOGEO_REGION_SPRITES ); + UINT8 *rom = memory_region( machine, NEOGEO_REGION_SPRITES ); UINT8 *buf = malloc_or_die( cx_size ); memcpy( buf, rom, cx_size ); @@ -34,10 +34,10 @@ void neogeo_bootleg_cx_decrypt( void ) free( buf ); } -void neogeo_bootleg_sx_decrypt( int value ) +void neogeo_bootleg_sx_decrypt( running_machine *machine, int value ) { - int sx_size = memory_region_length( NEOGEO_REGION_FIXED_LAYER_CARTRIDGE ); - UINT8 *rom = memory_region( NEOGEO_REGION_FIXED_LAYER_CARTRIDGE ); + int sx_size = memory_region_length( machine, NEOGEO_REGION_FIXED_LAYER_CARTRIDGE ); + UINT8 *rom = memory_region( machine, NEOGEO_REGION_FIXED_LAYER_CARTRIDGE ); int i; if (value == 1) @@ -66,12 +66,12 @@ void neogeo_bootleg_sx_decrypt( int value ) // Thanks to Razoola for the info -void kog_px_decrypt( void ) +void kog_px_decrypt( running_machine *machine ) { /* the protection chip does some *very* strange things to the rom */ - UINT8 *src = memory_region(NEOGEO_REGION_MAIN_CPU_CARTRIDGE); + UINT8 *src = memory_region(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE); UINT8 *dst = malloc_or_die( 0x600000 ); - UINT16 *rom = (UINT16 *)memory_region(NEOGEO_REGION_MAIN_CPU_CARTRIDGE); + UINT16 *rom = (UINT16 *)memory_region(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE); int i; static const int sec[] = { 0x3, 0x8, 0x7, 0xC, 0x1, 0xA, 0x6, 0xD }; @@ -151,10 +151,10 @@ static READ16_HANDLER( kof10th_RAMB_r ) static WRITE16_HANDLER( kof10th_custom_w ) { if (!kof10thExtraRAMB[0xFFE]) { // Write to RAM bank A - UINT16 *prom = (UINT16*)memory_region( NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); + UINT16 *prom = (UINT16*)memory_region( machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); COMBINE_DATA(&prom[(0xE0000/2) + (offset & 0xFFFF)]); } else { // Write S data on-the-fly - UINT8 *srom = memory_region( NEOGEO_REGION_FIXED_LAYER_CARTRIDGE ); + UINT8 *srom = memory_region( machine, NEOGEO_REGION_FIXED_LAYER_CARTRIDGE ); srom[offset] = BITSWAP8(data,7,6,0,4,3,2,1,5); } } @@ -165,7 +165,7 @@ static WRITE16_HANDLER( kof10th_bankswitch_w ) if (offset == 0x5FFF8) { // Standard bankswitch kof10thBankswitch(data); } else if (offset == 0x5FFFC && kof10thExtraRAMB[0xFFC] != data) { // Special bankswitch - UINT8 *src = memory_region( NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); + UINT8 *src = memory_region( machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); memcpy (src + 0x10000, src + ((data & 1) ? 0x810000 : 0x710000), 0xcffff); } COMBINE_DATA(&kof10thExtraRAMB[offset & 0xFFF]); @@ -179,11 +179,11 @@ void install_kof10th_protection ( running_machine *machine ) memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x240000, 0x2fffff, 0, 0, kof10th_bankswitch_w); } -void decrypt_kof10th( void ) +void decrypt_kof10th(running_machine *machine) { int i, j; UINT8 *dst = malloc_or_die(0x900000); - UINT8 *src = memory_region( NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); + UINT8 *src = memory_region( machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); memcpy(dst + 0x000000, src + 0x700000, 0x100000); // Correct (Verified in Uni-bios) memcpy(dst + 0x100000, src + 0x000000, 0x800000); @@ -204,13 +204,13 @@ void decrypt_kof10th( void ) ((UINT16*)src)[0x8bf8/2] = 0xf980; } -void decrypt_kf10thep(void) +void decrypt_kf10thep(running_machine *machine) { int i; - UINT16 *rom = (UINT16*)memory_region(NEOGEO_REGION_MAIN_CPU_CARTRIDGE); - UINT8 *src = memory_region(NEOGEO_REGION_MAIN_CPU_CARTRIDGE); - UINT16 *buf = (UINT16*)memory_region(NEOGEO_REGION_AUDIO_CPU_ENCRYPTED); - UINT8 *srom = (UINT8*)memory_region(NEOGEO_REGION_FIXED_LAYER_CARTRIDGE); + UINT16 *rom = (UINT16*)memory_region(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE); + UINT8 *src = memory_region(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE); + UINT16 *buf = (UINT16*)memory_region(machine, NEOGEO_REGION_AUDIO_CPU_ENCRYPTED); + UINT8 *srom = (UINT8*)memory_region(machine, NEOGEO_REGION_FIXED_LAYER_CARTRIDGE); UINT8 *sbuf = malloc_or_die(0x20000); UINT8 *dst = malloc_or_die(0x200000); @@ -241,10 +241,10 @@ void decrypt_kf10thep(void) free(sbuf); } -static void kf2k5uni_px_decrypt( void ) +static void kf2k5uni_px_decrypt( running_machine *machine ) { int i, j, ofst; - UINT8 *src = memory_region( NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); + UINT8 *src = memory_region( machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); UINT8 *dst = malloc_or_die(0x80); for (i = 0; i < 0x800000; i+=0x80) @@ -261,38 +261,38 @@ static void kf2k5uni_px_decrypt( void ) memcpy(src, src + 0x600000, 0x100000); // Seems to be the same as kof10th } -static void kf2k5uni_sx_decrypt( void ) +static void kf2k5uni_sx_decrypt( running_machine *machine ) { int i; - UINT8 *srom = memory_region( NEOGEO_REGION_FIXED_LAYER_CARTRIDGE ); + UINT8 *srom = memory_region( machine, NEOGEO_REGION_FIXED_LAYER_CARTRIDGE ); for (i = 0; i < 0x20000; i++) srom[i] = BITSWAP8(srom[i], 4, 5, 6, 7, 0, 1, 2, 3); } -static void kf2k5uni_mx_decrypt( void ) +static void kf2k5uni_mx_decrypt( running_machine *machine ) { int i; - UINT8 *mrom = memory_region( NEOGEO_REGION_AUDIO_CPU_CARTRIDGE ); + UINT8 *mrom = memory_region( machine, NEOGEO_REGION_AUDIO_CPU_CARTRIDGE ); for (i = 0; i < 0x30000; i++) mrom[i] = BITSWAP8(mrom[i], 4, 5, 6, 7, 0, 1, 2, 3); } -void decrypt_kf2k5uni(void) +void decrypt_kf2k5uni( running_machine *machine ) { - kf2k5uni_px_decrypt(); - kf2k5uni_sx_decrypt(); - kf2k5uni_mx_decrypt(); + kf2k5uni_px_decrypt(machine); + kf2k5uni_sx_decrypt(machine); + kf2k5uni_mx_decrypt(machine); } /* Kof2002 Magic Plus */ -void kf2k2mp_decrypt( void ) +void kf2k2mp_decrypt( running_machine *machine ) { int i,j; - UINT8 *src = memory_region(NEOGEO_REGION_MAIN_CPU_CARTRIDGE); + UINT8 *src = memory_region(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE); UINT8 *dst = malloc_or_die(0x80); memmove(src, src + 0x300000, 0x500000); @@ -312,9 +312,9 @@ void kf2k2mp_decrypt( void ) /* Kof2002 Magic Plus 2 */ -void kof2km2_px_decrypt( void ) +void kof2km2_px_decrypt( running_machine *machine ) { - UINT8 *src = memory_region(NEOGEO_REGION_MAIN_CPU_CARTRIDGE); + UINT8 *src = memory_region(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE); UINT8 *dst = malloc_or_die(0x600000); memcpy (dst + 0x000000, src + 0x1C0000, 0x040000); @@ -329,13 +329,13 @@ void kof2km2_px_decrypt( void ) /* Crouching Tiger Hidden Dragon 2003 (bootleg of King of Fighters 2001) */ /* descrambling information from razoola */ -static void cthd2003_neogeo_gfx_address_fix_do(int start, int end, int bit3shift, int bit2shift, int bit1shift, int bit0shift) +static void cthd2003_neogeo_gfx_address_fix_do(running_machine *machine, int start, int end, int bit3shift, int bit2shift, int bit1shift, int bit0shift) { int i,j; int tilesize=128; UINT8* rom = malloc_or_die(16*tilesize); // 16 tiles buffer - UINT8* realrom = memory_region(NEOGEO_REGION_SPRITES) + start*tilesize; + UINT8* realrom = memory_region(machine, NEOGEO_REGION_SPRITES) + start*tilesize; for (i = 0; i < (end-start)/16; i++) { for (j = 0; j < 16; j++) { @@ -352,43 +352,43 @@ static void cthd2003_neogeo_gfx_address_fix_do(int start, int end, int bit3shift free(rom); } -static void cthd2003_neogeo_gfx_address_fix(int start, int end) +static void cthd2003_neogeo_gfx_address_fix(running_machine *machine, int start, int end) { - cthd2003_neogeo_gfx_address_fix_do(start+512*0, end+512*0, 0,3,2,1); - cthd2003_neogeo_gfx_address_fix_do(start+512*1, end+512*1, 1,0,3,2); - cthd2003_neogeo_gfx_address_fix_do(start+512*2, end+512*2, 2,1,0,3); + cthd2003_neogeo_gfx_address_fix_do(machine, start+512*0, end+512*0, 0,3,2,1); + cthd2003_neogeo_gfx_address_fix_do(machine, start+512*1, end+512*1, 1,0,3,2); + cthd2003_neogeo_gfx_address_fix_do(machine, start+512*2, end+512*2, 2,1,0,3); // skip 3 & 4 - cthd2003_neogeo_gfx_address_fix_do(start+512*5, end+512*5, 0,1,2,3); - cthd2003_neogeo_gfx_address_fix_do(start+512*6, end+512*6, 0,1,2,3); - cthd2003_neogeo_gfx_address_fix_do(start+512*7, end+512*7, 0,2,3,1); + cthd2003_neogeo_gfx_address_fix_do(machine, start+512*5, end+512*5, 0,1,2,3); + cthd2003_neogeo_gfx_address_fix_do(machine, start+512*6, end+512*6, 0,1,2,3); + cthd2003_neogeo_gfx_address_fix_do(machine, start+512*7, end+512*7, 0,2,3,1); } -static void cthd2003_c(int pow) +static void cthd2003_c(running_machine *machine, int pow) { int i; for (i=0; i<=192; i+=8) - cthd2003_neogeo_gfx_address_fix(i*512,i*512+512); + cthd2003_neogeo_gfx_address_fix(machine, i*512,i*512+512); for (i=200; i<=392; i+=8) - cthd2003_neogeo_gfx_address_fix(i*512,i*512+512); + cthd2003_neogeo_gfx_address_fix(machine, i*512,i*512+512); for (i=400; i<=592; i+=8) - cthd2003_neogeo_gfx_address_fix(i*512,i*512+512); + cthd2003_neogeo_gfx_address_fix(machine, i*512,i*512+512); for (i=600; i<=792; i+=8) - cthd2003_neogeo_gfx_address_fix(i*512,i*512+512); + cthd2003_neogeo_gfx_address_fix(machine, i*512,i*512+512); for (i=800; i<=992; i+=8) - cthd2003_neogeo_gfx_address_fix(i*512,i*512+512); + cthd2003_neogeo_gfx_address_fix(machine, i*512,i*512+512); for (i=1000; i<=1016; i+=8) - cthd2003_neogeo_gfx_address_fix(i*512,i*512+512); + cthd2003_neogeo_gfx_address_fix(machine, i*512,i*512+512); } -void decrypt_cthd2003(void) +void decrypt_cthd2003( running_machine *machine ) { - UINT8 *romdata = memory_region(NEOGEO_REGION_FIXED_LAYER_CARTRIDGE); + UINT8 *romdata = memory_region(machine, NEOGEO_REGION_FIXED_LAYER_CARTRIDGE); UINT8 *tmp = malloc_or_die(8*128*128); memcpy(tmp+8*0*128, romdata+8*0*128, 8*32*128); @@ -397,7 +397,7 @@ void decrypt_cthd2003(void) memcpy(tmp+8*96*128, romdata+8*96*128, 8*32*128); memcpy(romdata, tmp, 8*128*128); - romdata = memory_region(NEOGEO_REGION_AUDIO_CPU_CARTRIDGE)+0x10000; + romdata = memory_region(machine, NEOGEO_REGION_AUDIO_CPU_CARTRIDGE)+0x10000; memcpy(tmp+8*0*128, romdata+8*0*128, 8*32*128); memcpy(tmp+8*32*128, romdata+8*64*128, 8*32*128); memcpy(tmp+8*64*128, romdata+8*32*128, 8*32*128); @@ -408,7 +408,7 @@ void decrypt_cthd2003(void) memcpy(romdata-0x10000,romdata,0x10000); - cthd2003_c(0); + cthd2003_c(machine, 0); } static WRITE16_HANDLER ( cthd2003_bankswitch_w ) @@ -429,7 +429,7 @@ void patch_cthd2003( running_machine *machine ) { /* patches thanks to razoola */ int i; - UINT16 *mem16 = (UINT16 *)memory_region(NEOGEO_REGION_MAIN_CPU_CARTRIDGE); + UINT16 *mem16 = (UINT16 *)memory_region(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE); /* special ROM banking handler */ memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2ffff0, 0x2fffff, 0, 0, cthd2003_bankswitch_w); @@ -468,10 +468,10 @@ void patch_cthd2003( running_machine *machine ) /* Crouching Tiger Hidden Dragon 2003 Super Plus (bootleg of King of Fighters 2001) */ -static void ct2k3sp_sx_decrypt( void ) +static void ct2k3sp_sx_decrypt( running_machine *machine ) { - int rom_size = memory_region_length( NEOGEO_REGION_FIXED_LAYER_CARTRIDGE ); - UINT8 *rom = memory_region( NEOGEO_REGION_FIXED_LAYER_CARTRIDGE ); + int rom_size = memory_region_length( machine, NEOGEO_REGION_FIXED_LAYER_CARTRIDGE ); + UINT8 *rom = memory_region( machine, NEOGEO_REGION_FIXED_LAYER_CARTRIDGE ); UINT8 *buf = malloc_or_die( rom_size ); int i; int ofst; @@ -498,9 +498,9 @@ static void ct2k3sp_sx_decrypt( void ) free( buf ); } -void decrypt_ct2k3sp(void) +void decrypt_ct2k3sp( running_machine *machine ) { - UINT8 *romdata = memory_region(NEOGEO_REGION_AUDIO_CPU_CARTRIDGE)+0x10000; + UINT8 *romdata = memory_region(machine, NEOGEO_REGION_AUDIO_CPU_CARTRIDGE)+0x10000; UINT8*tmp = malloc_or_die(8*128*128); memcpy(tmp+8*0*128, romdata+8*0*128, 8*32*128); memcpy(tmp+8*32*128, romdata+8*64*128, 8*32*128); @@ -510,15 +510,15 @@ void decrypt_ct2k3sp(void) free(tmp); memcpy(romdata-0x10000,romdata,0x10000); - ct2k3sp_sx_decrypt(); - cthd2003_c(0); + ct2k3sp_sx_decrypt(machine); + cthd2003_c(machine, 0); } /* Crouching Tiger Hidden Dragon 2003 Super Plus alternate (bootleg of King of Fighters 2001) */ -void decrypt_ct2k3sa(void) +void decrypt_ct2k3sa( running_machine *machine ) { - UINT8 *romdata = memory_region(NEOGEO_REGION_AUDIO_CPU_CARTRIDGE)+0x10000; + UINT8 *romdata = memory_region(machine, NEOGEO_REGION_AUDIO_CPU_CARTRIDGE)+0x10000; UINT8*tmp = malloc_or_die(8*128*128); memcpy(tmp+8*0*128, romdata+8*0*128, 8*32*128); memcpy(tmp+8*32*128, romdata+8*64*128, 8*32*128); @@ -528,14 +528,14 @@ void decrypt_ct2k3sa(void) free(tmp); memcpy(romdata-0x10000,romdata,0x10000); - cthd2003_c(0); + cthd2003_c(machine, 0); } -void patch_ct2k3sa( void ) +void patch_ct2k3sa( running_machine *machine ) { /* patches thanks to razoola - same as for cthd2003*/ int i; - UINT16 *mem16 = (UINT16 *)memory_region(NEOGEO_REGION_MAIN_CPU_CARTRIDGE); + UINT16 *mem16 = (UINT16 *)memory_region(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE); // theres still a problem on the character select screen but it seems to be related to cpu core timing issues, // overclocking the 68k prevents it. @@ -572,9 +572,9 @@ void patch_ct2k3sa( void ) /* King of Fighters Special Edition 2004 (bootleg of King of Fighters 2002) */ -void decrypt_kof2k4se_68k( void ) +void decrypt_kof2k4se_68k( running_machine *machine ) { - UINT8 *src = memory_region(NEOGEO_REGION_MAIN_CPU_CARTRIDGE)+0x100000; + UINT8 *src = memory_region(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE)+0x100000; UINT8 *dst = malloc_or_die(0x400000); int i; static const int sec[] = {0x300000,0x200000,0x100000,0x000000}; @@ -589,20 +589,20 @@ void decrypt_kof2k4se_68k( void ) /* Lans2004 (bootleg of Shock Troopers 2) */ -void lans2004_vx_decrypt( void ) +void lans2004_vx_decrypt( running_machine *machine ) { int i; - UINT8 *rom = memory_region( NEOGEO_REGION_AUDIO_DATA_1 ); + UINT8 *rom = memory_region( machine, NEOGEO_REGION_AUDIO_DATA_1 ); for (i = 0; i < 0xA00000; i++) rom[i] = BITSWAP8(rom[i], 0, 1, 5, 4, 3, 2, 6, 7); } -void lans2004_decrypt_68k( void ) +void lans2004_decrypt_68k( running_machine *machine ) { /* Descrambling P ROMs - Thanks to Razoola for the info */ int i; - UINT8 *src = memory_region( NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); - UINT16 *rom = (UINT16*)memory_region( NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); + UINT8 *src = memory_region( machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); + UINT16 *rom = (UINT16*)memory_region( machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); UINT8 *dst = malloc_or_die(0x600000); { @@ -668,14 +668,14 @@ void install_ms5plus_protection(running_machine *machine) -void svcboot_px_decrypt( void ) +void svcboot_px_decrypt( running_machine *machine ) { static const UINT8 sec[] = { 0x06, 0x07, 0x01, 0x02, 0x03, 0x04, 0x05, 0x00 }; int i; - int size = memory_region_length( NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); - UINT8 *src = memory_region( NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); + int size = memory_region_length( machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); + UINT8 *src = memory_region( machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); UINT8 *dst = malloc_or_die( size ); int ofst; for( i = 0; i < size / 0x100000; i++ ){ @@ -691,7 +691,7 @@ void svcboot_px_decrypt( void ) -void svcboot_cx_decrypt( void ) +void svcboot_cx_decrypt( running_machine *machine ) { static const UINT8 idx_tbl[ 0x10 ] = { 0, 1, 0, 1, 2, 3, 2, 3, 3, 4, 3, 4, 4, 5, 4, 5, @@ -705,8 +705,8 @@ void svcboot_cx_decrypt( void ) { 3, 0, 2, 1 }, }; int i; - int size = memory_region_length( NEOGEO_REGION_SPRITES ); - UINT8 *src = memory_region( NEOGEO_REGION_SPRITES ); + int size = memory_region_length( machine, NEOGEO_REGION_SPRITES ); + UINT8 *src = memory_region( machine, NEOGEO_REGION_SPRITES ); UINT8 *dst = malloc_or_die( size ); int ofst; memcpy( dst, src, size ); @@ -725,13 +725,13 @@ void svcboot_cx_decrypt( void ) -void svcplus_px_decrypt( void ) +void svcplus_px_decrypt( running_machine *machine ) { static const int sec[] = { 0x00, 0x03, 0x02, 0x05, 0x04, 0x01 }; - int size = memory_region_length( NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); - UINT8 *src = memory_region( NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); + int size = memory_region_length( machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); + UINT8 *src = memory_region( machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); UINT8 *dst = malloc_or_die( size ); int i; int ofst; @@ -753,10 +753,10 @@ void svcplus_px_decrypt( void ) -void svcplus_px_hack( void ) +void svcplus_px_hack( running_machine *machine ) { /* patched by the protection chip? */ - UINT8 *src = memory_region( NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); + UINT8 *src = memory_region( machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); src[ 0x0f8010 ] = 0x40; src[ 0x0f8011 ] = 0x04; src[ 0x0f8012 ] = 0x00; @@ -767,14 +767,14 @@ void svcplus_px_hack( void ) src[ 0x0f802c ] = 0x16; } -void svcplusa_px_decrypt( void ) +void svcplusa_px_decrypt( running_machine *machine ) { int i; static const int sec[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x00 }; - int size = memory_region_length( NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); - UINT8 *src = memory_region( NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); + int size = memory_region_length( machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); + UINT8 *src = memory_region( machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); UINT8 *dst = malloc_or_die( size ); memcpy( dst, src, size ); for( i = 0; i < 6; i++ ){ @@ -785,13 +785,13 @@ void svcplusa_px_decrypt( void ) -void svcsplus_px_decrypt( void ) +void svcsplus_px_decrypt( running_machine *machine ) { static const int sec[] = { 0x06, 0x07, 0x01, 0x02, 0x03, 0x04, 0x05, 0x00 }; - int size = memory_region_length( NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); - UINT8 *src = memory_region( NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); + int size = memory_region_length( machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); + UINT8 *src = memory_region( machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); UINT8 *dst = malloc_or_die( size ); int i; int ofst; @@ -809,10 +809,10 @@ void svcsplus_px_decrypt( void ) -void svcsplus_px_hack( void ) +void svcsplus_px_hack( running_machine *machine ) { /* patched by the protection chip? */ - UINT16 *mem16 = (UINT16 *)memory_region(NEOGEO_REGION_MAIN_CPU_CARTRIDGE); + UINT16 *mem16 = (UINT16 *)memory_region(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE); mem16[0x9e90/2] = 0x000f; mem16[0x9e92/2] = 0xc9c0; mem16[0xa10c/2] = 0x4eb9; @@ -857,7 +857,7 @@ static WRITE16_HANDLER( kof2003_w ) UINT8* cr = (UINT8 *)kof2003_tbl; UINT32 address = (cr[BYTE_XOR_LE(0x1ff3)]<<16)|(cr[BYTE_XOR_LE(0x1ff2)]<<8)|cr[BYTE_XOR_LE(0x1ff1)]; UINT8 prt = cr[BYTE_XOR_LE(0x1ff2)]; - UINT8* mem = (UINT8 *)memory_region(NEOGEO_REGION_MAIN_CPU_CARTRIDGE); + UINT8* mem = (UINT8 *)memory_region(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE); cr[BYTE_XOR_LE(0x1ff0)] = 0xa0; cr[BYTE_XOR_LE(0x1ff1)] &= 0xfe; @@ -875,7 +875,7 @@ static WRITE16_HANDLER( kof2003p_w ) UINT8* cr = (UINT8 *)kof2003_tbl; UINT32 address = (cr[BYTE_XOR_LE(0x1ff3)]<<16)|(cr[BYTE_XOR_LE(0x1ff2)]<<8)|cr[BYTE_XOR_LE(0x1ff0)]; UINT8 prt = cr[BYTE_XOR_LE(0x1ff2)]; - UINT8* mem = (UINT8 *)memory_region(NEOGEO_REGION_MAIN_CPU_CARTRIDGE); + UINT8* mem = (UINT8 *)memory_region(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE); cr[BYTE_XOR_LE(0x1ff0)] &= 0xfe; cr[BYTE_XOR_LE(0x1ff3)] &= 0x7f; @@ -885,7 +885,7 @@ static WRITE16_HANDLER( kof2003p_w ) } } -void kof2003b_px_decrypt( void ) +void kof2003b_px_decrypt( running_machine *machine ) { int i; static const UINT8 sec[] = { @@ -893,7 +893,7 @@ void kof2003b_px_decrypt( void ) }; int rom_size = 0x800000; - UINT8 *rom = memory_region( NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); + UINT8 *rom = memory_region( machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); UINT8 *buf = malloc_or_die( rom_size ); memcpy( buf, rom, rom_size ); @@ -913,10 +913,10 @@ void kof2003b_install_protection(running_machine *machine) kof2k3pl ***************************************************************************/ -void kof2k3pl_px_decrypt( void ) +void kof2k3pl_px_decrypt( running_machine *machine ) { UINT16*tmp = malloc_or_die(0x100000); - UINT16*rom = (UINT16*)memory_region( NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); + UINT16*rom = (UINT16*)memory_region( machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); int j; int i; @@ -943,10 +943,10 @@ void kf2k3pl_install_protection(running_machine *machine) ***************************************************************************/ -void kof2k3up_px_decrypt( void ) +void kof2k3up_px_decrypt( running_machine *machine ) { { - UINT8 *src = memory_region(NEOGEO_REGION_MAIN_CPU_CARTRIDGE); + UINT8 *src = memory_region(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE); memmove(src+0x100000, src, 0x600000); memmove(src, src+0x700000, 0x100000); } @@ -955,8 +955,8 @@ void kof2k3up_px_decrypt( void ) int ofst; int i; - UINT8 *rom = memory_region( NEOGEO_REGION_MAIN_CPU_CARTRIDGE ) + 0xfe000; - UINT8 *buf = memory_region( NEOGEO_REGION_MAIN_CPU_CARTRIDGE ) + 0xd0610; + UINT8 *rom = memory_region( machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE ) + 0xfe000; + UINT8 *buf = memory_region( machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE ) + 0xd0610; for( i = 0; i < 0x2000 / 2; i++ ){ ofst = (i & 0xff00) + BITSWAP8( (i & 0x00ff), 7, 6, 0, 4, 3, 2, 1, 5 ); @@ -972,10 +972,10 @@ void kof2k3up_install_protection(running_machine *machine) /* samsho5bl */ -void samsh5bl_px_decrypt( void ) +void samsh5bl_px_decrypt( running_machine *machine ) { - int px_size = memory_region_length( NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); - UINT8 *rom = memory_region( NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); + int px_size = memory_region_length( machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); + UINT8 *rom = memory_region( machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); UINT8 *buf = malloc_or_die( px_size ); int ofst; int i; diff --git a/src/mame/machine/neocrypt.c b/src/mame/machine/neocrypt.c index 3f2d2733874..e5776a5138f 100644 --- a/src/mame/machine/neocrypt.c +++ b/src/mame/machine/neocrypt.c @@ -523,18 +523,18 @@ static void decrypt(UINT8 *r0, UINT8 *r1, } -static void neogeo_gfx_decrypt(int extra_xor) +static void neogeo_gfx_decrypt(running_machine *machine, int extra_xor) { int rom_size; UINT8 *buf; UINT8 *rom; int rpos; - rom_size = memory_region_length(NEOGEO_REGION_SPRITES); + rom_size = memory_region_length(machine, NEOGEO_REGION_SPRITES); buf = malloc_or_die(rom_size); - rom = memory_region(NEOGEO_REGION_SPRITES); + rom = memory_region(machine, NEOGEO_REGION_SPRITES); // Data xor for (rpos = 0;rpos < rom_size/4;rpos++) @@ -587,13 +587,13 @@ static void neogeo_gfx_decrypt(int extra_xor) /* the S data comes from the end of the C data */ -static void neogeo_sfix_decrypt(void) +static void neogeo_sfix_decrypt(running_machine *machine) { int i; - int rom_size = memory_region_length(NEOGEO_REGION_SPRITES); - int tx_size = memory_region_length(NEOGEO_REGION_FIXED_LAYER_CARTRIDGE); - UINT8 *src = memory_region(NEOGEO_REGION_SPRITES)+rom_size-tx_size; - UINT8 *dst = memory_region(NEOGEO_REGION_FIXED_LAYER_CARTRIDGE); + int rom_size = memory_region_length(machine, NEOGEO_REGION_SPRITES); + int tx_size = memory_region_length(machine, NEOGEO_REGION_FIXED_LAYER_CARTRIDGE); + UINT8 *src = memory_region(machine, NEOGEO_REGION_SPRITES)+rom_size-tx_size; + UINT8 *dst = memory_region(machine, NEOGEO_REGION_FIXED_LAYER_CARTRIDGE); for (i = 0;i < tx_size;i++) dst[i] = src[(i & ~0x1f) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4)]; @@ -601,7 +601,7 @@ static void neogeo_sfix_decrypt(void) /* CMC42 protection chip */ -void kof99_neogeo_gfx_decrypt(int extra_xor) +void kof99_neogeo_gfx_decrypt(running_machine *machine, int extra_xor) { type0_t03 = kof99_type0_t03; type0_t12 = kof99_type0_t12; @@ -612,13 +612,13 @@ void kof99_neogeo_gfx_decrypt(int extra_xor) address_16_23_xor1 = kof99_address_16_23_xor1; address_16_23_xor2 = kof99_address_16_23_xor2; address_0_7_xor = kof99_address_0_7_xor; - neogeo_gfx_decrypt(extra_xor); - neogeo_sfix_decrypt(); + neogeo_gfx_decrypt(machine, extra_xor); + neogeo_sfix_decrypt(machine); } /* CMC50 protection chip */ -void kof2000_neogeo_gfx_decrypt(int extra_xor) +void kof2000_neogeo_gfx_decrypt(running_machine *machine, int extra_xor) { type0_t03 = kof2000_type0_t03; type0_t12 = kof2000_type0_t12; @@ -629,15 +629,15 @@ void kof2000_neogeo_gfx_decrypt(int extra_xor) address_16_23_xor1 = kof2000_address_16_23_xor1; address_16_23_xor2 = kof2000_address_16_23_xor2; address_0_7_xor = kof2000_address_0_7_xor; - neogeo_gfx_decrypt(extra_xor); - neogeo_sfix_decrypt(); + neogeo_gfx_decrypt(machine, extra_xor); + neogeo_sfix_decrypt(machine); /* here I should also decrypt the sound ROM */ } /* CMC42 protection chip */ -void cmc42_neogeo_gfx_decrypt(int extra_xor) +void cmc42_neogeo_gfx_decrypt(running_machine *machine, int extra_xor) { type0_t03 = kof99_type0_t03; type0_t12 = kof99_type0_t12; @@ -648,12 +648,12 @@ void cmc42_neogeo_gfx_decrypt(int extra_xor) address_16_23_xor1 = kof99_address_16_23_xor1; address_16_23_xor2 = kof99_address_16_23_xor2; address_0_7_xor = kof99_address_0_7_xor; - neogeo_gfx_decrypt(extra_xor); + neogeo_gfx_decrypt(machine, extra_xor); } /* CMC50 protection chip */ -void cmc50_neogeo_gfx_decrypt(int extra_xor) +void cmc50_neogeo_gfx_decrypt(running_machine *machine, int extra_xor) { type0_t03 = kof2000_type0_t03; type0_t12 = kof2000_type0_t12; @@ -664,20 +664,20 @@ void cmc50_neogeo_gfx_decrypt(int extra_xor) address_16_23_xor1 = kof2000_address_16_23_xor1; address_16_23_xor2 = kof2000_address_16_23_xor2; address_0_7_xor = kof2000_address_0_7_xor; - neogeo_gfx_decrypt(extra_xor); + neogeo_gfx_decrypt(machine, extra_xor); /* here I should also decrypt the sound ROM */ } /* svcchaos has an additional scramble on top of the standard CMC scrambling */ -void svcpcb_gfx_decrypt(void) +void svcpcb_gfx_decrypt(running_machine *machine) { static const UINT8 xor[ 4 ] = { 0x34, 0x21, 0xc4, 0xe9 }; int i; int ofst; - int rom_size = memory_region_length( NEOGEO_REGION_SPRITES ); - UINT8 *rom = memory_region( NEOGEO_REGION_SPRITES ); + int rom_size = memory_region_length( machine, NEOGEO_REGION_SPRITES ); + UINT8 *rom = memory_region( machine, NEOGEO_REGION_SPRITES ); UINT8 *buf = malloc_or_die( rom_size ); for( i = 0; i < rom_size; i++ ) @@ -706,11 +706,11 @@ void svcpcb_gfx_decrypt(void) /* and a further swap on the s1 data */ -void svcpcb_s1data_decrypt(void) +void svcpcb_s1data_decrypt(running_machine *machine) { int i; - UINT8 *s1 = memory_region( NEOGEO_REGION_FIXED_LAYER_CARTRIDGE ); - size_t s1_size = memory_region_length( NEOGEO_REGION_FIXED_LAYER_CARTRIDGE ); + UINT8 *s1 = memory_region( machine, NEOGEO_REGION_FIXED_LAYER_CARTRIDGE ); + size_t s1_size = memory_region_length( machine, NEOGEO_REGION_FIXED_LAYER_CARTRIDGE ); for( i = 0; i < s1_size; i++ ) // Decrypt S { @@ -720,13 +720,13 @@ void svcpcb_s1data_decrypt(void) /* Razoola & Halrin */ -void kf2k3pcb_gfx_decrypt(void) +void kf2k3pcb_gfx_decrypt(running_machine *machine) { static const UINT8 xor[ 4 ] = { 0x34, 0x21, 0xc4, 0xe9 }; int i; int ofst; - int rom_size = memory_region_length( NEOGEO_REGION_SPRITES ); - UINT8 *rom = memory_region( NEOGEO_REGION_SPRITES ); + int rom_size = memory_region_length( machine, NEOGEO_REGION_SPRITES ); + UINT8 *rom = memory_region( machine, NEOGEO_REGION_SPRITES ); UINT8 *buf = malloc_or_die( rom_size ); for ( i = 0; i < rom_size; i++ ) @@ -757,9 +757,9 @@ NeoGeo 'P' ROM encryption ***************************************************************************/ /* Kof98 uses an early encryption, quite different from the others */ -void kof98_decrypt_68k(void) +void kof98_decrypt_68k(running_machine *machine) { - UINT8 *src = memory_region(NEOGEO_REGION_MAIN_CPU_CARTRIDGE); + UINT8 *src = memory_region(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE); UINT8 *dst = malloc_or_die(0x200000); int i, j, k; static const UINT32 sec[]={0x000000,0x100000,0x000004,0x100004,0x10000a,0x00000a,0x10000e,0x00000e}; @@ -804,12 +804,12 @@ void kof98_decrypt_68k(void) /* kof99, garou, garouo, mslug3 and kof2000 have and SMA chip which contains program code and decrypts the 68k roms */ -void kof99_decrypt_68k(void) +void kof99_decrypt_68k(running_machine *machine) { UINT16 *rom; int i,j; - rom = (UINT16 *)(memory_region(NEOGEO_REGION_MAIN_CPU_CARTRIDGE) + 0x100000); + rom = (UINT16 *)(memory_region(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE) + 0x100000); /* swap data lines on the whole ROMs */ for (i = 0;i < 0x800000/2;i++) { @@ -828,7 +828,7 @@ void kof99_decrypt_68k(void) } /* swap address lines & relocate fixed part */ - rom = (UINT16 *)memory_region(NEOGEO_REGION_MAIN_CPU_CARTRIDGE); + rom = (UINT16 *)memory_region(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE); for (i = 0;i < 0x0c0000/2;i++) { rom[i] = rom[0x700000/2 + BITSWAP24(i,23,22,21,20,19,18,11,6,14,17,16,5,8,10,12,0,4,3,2,7,9,15,13,1)]; @@ -836,13 +836,13 @@ void kof99_decrypt_68k(void) } -void garou_decrypt_68k(void) +void garou_decrypt_68k(running_machine *machine) { UINT16 *rom; int i,j; /* thanks to Razoola and Mr K for the info */ - rom = (UINT16 *)(memory_region(NEOGEO_REGION_MAIN_CPU_CARTRIDGE) + 0x100000); + rom = (UINT16 *)(memory_region(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE) + 0x100000); /* swap data lines on the whole ROMs */ for (i = 0;i < 0x800000/2;i++) { @@ -850,14 +850,14 @@ void garou_decrypt_68k(void) } /* swap address lines & relocate fixed part */ - rom = (UINT16 *)memory_region(NEOGEO_REGION_MAIN_CPU_CARTRIDGE); + rom = (UINT16 *)memory_region(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE); for (i = 0;i < 0x0c0000/2;i++) { rom[i] = rom[0x710000/2 + BITSWAP24(i,23,22,21,20,19,18,4,5,16,14,7,9,6,13,17,15,3,1,2,12,11,8,10,0)]; } /* swap address lines for the banked part */ - rom = (UINT16 *)(memory_region(NEOGEO_REGION_MAIN_CPU_CARTRIDGE) + 0x100000); + rom = (UINT16 *)(memory_region(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE) + 0x100000); for (i = 0;i < 0x800000/2;i+=0x8000/2) { UINT16 buffer[0x8000/2]; @@ -870,13 +870,13 @@ void garou_decrypt_68k(void) } -void garouo_decrypt_68k(void) +void garouo_decrypt_68k(running_machine *machine) { UINT16 *rom; int i,j; /* thanks to Razoola and Mr K for the info */ - rom = (UINT16 *)(memory_region(NEOGEO_REGION_MAIN_CPU_CARTRIDGE) + 0x100000); + rom = (UINT16 *)(memory_region(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE) + 0x100000); /* swap data lines on the whole ROMs */ for (i = 0;i < 0x800000/2;i++) { @@ -884,14 +884,14 @@ void garouo_decrypt_68k(void) } /* swap address lines & relocate fixed part */ - rom = (UINT16 *)memory_region(NEOGEO_REGION_MAIN_CPU_CARTRIDGE); + rom = (UINT16 *)memory_region(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE); for (i = 0;i < 0x0c0000/2;i++) { rom[i] = rom[0x7f8000/2 + BITSWAP24(i,23,22,21,20,19,18,5,16,11,2,6,7,17,3,12,8,14,4,0,9,1,10,15,13)]; } /* swap address lines for the banked part */ - rom = (UINT16 *)(memory_region(NEOGEO_REGION_MAIN_CPU_CARTRIDGE) + 0x100000); + rom = (UINT16 *)(memory_region(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE) + 0x100000); for (i = 0;i < 0x800000/2;i+=0x8000/2) { UINT16 buffer[0x8000/2]; @@ -904,13 +904,13 @@ void garouo_decrypt_68k(void) } -void mslug3_decrypt_68k(void) +void mslug3_decrypt_68k(running_machine *machine) { UINT16 *rom; int i,j; /* thanks to Razoola and Mr K for the info */ - rom = (UINT16 *)(memory_region(NEOGEO_REGION_MAIN_CPU_CARTRIDGE) + 0x100000); + rom = (UINT16 *)(memory_region(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE) + 0x100000); /* swap data lines on the whole ROMs */ for (i = 0;i < 0x800000/2;i++) { @@ -918,14 +918,14 @@ void mslug3_decrypt_68k(void) } /* swap address lines & relocate fixed part */ - rom = (UINT16 *)memory_region(NEOGEO_REGION_MAIN_CPU_CARTRIDGE); + rom = (UINT16 *)memory_region(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE); for (i = 0;i < 0x0c0000/2;i++) { rom[i] = rom[0x5d0000/2 + BITSWAP24(i,23,22,21,20,19,18,15,2,1,13,3,0,9,6,16,4,11,5,7,12,17,14,10,8)]; } /* swap address lines for the banked part */ - rom = (UINT16 *)(memory_region(NEOGEO_REGION_MAIN_CPU_CARTRIDGE) + 0x100000); + rom = (UINT16 *)(memory_region(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE) + 0x100000); for (i = 0;i < 0x800000/2;i+=0x10000/2) { UINT16 buffer[0x10000/2]; @@ -938,13 +938,13 @@ void mslug3_decrypt_68k(void) } -void kof2000_decrypt_68k(void) +void kof2000_decrypt_68k(running_machine *machine) { UINT16 *rom; int i,j; /* thanks to Razoola and Mr K for the info */ - rom = (UINT16 *)(memory_region(NEOGEO_REGION_MAIN_CPU_CARTRIDGE) + 0x100000); + rom = (UINT16 *)(memory_region(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE) + 0x100000); /* swap data lines on the whole ROMs */ for (i = 0;i < 0x800000/2;i++) { @@ -963,7 +963,7 @@ void kof2000_decrypt_68k(void) } /* swap address lines & relocate fixed part */ - rom = (UINT16 *)memory_region(NEOGEO_REGION_MAIN_CPU_CARTRIDGE); + rom = (UINT16 *)memory_region(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE); for (i = 0;i < 0x0c0000/2;i++) { rom[i] = rom[0x73a000/2 + BITSWAP24(i,23,22,21,20,19,18,8,4,15,13,3,14,16,2,6,17,7,12,10,0,5,11,1,9)]; @@ -972,11 +972,11 @@ void kof2000_decrypt_68k(void) /* kof2002, matrim, samsho5, samsh5p have some simple block swapping */ -void kof2002_decrypt_68k(void) +void kof2002_decrypt_68k(running_machine *machine) { int i; static const int sec[]={0x100000,0x280000,0x300000,0x180000,0x000000,0x380000,0x200000,0x080000}; - UINT8 *src = memory_region(NEOGEO_REGION_MAIN_CPU_CARTRIDGE)+0x100000; + UINT8 *src = memory_region(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE)+0x100000; UINT8 *dst = malloc_or_die(0x400000); memcpy( dst, src, 0x400000 ); for( i=0; i<8; ++i ) @@ -987,11 +987,11 @@ void kof2002_decrypt_68k(void) } -void matrim_decrypt_68k(void) +void matrim_decrypt_68k(running_machine *machine) { int i; static const int sec[]={0x100000,0x280000,0x300000,0x180000,0x000000,0x380000,0x200000,0x080000}; - UINT8 *src = memory_region(NEOGEO_REGION_MAIN_CPU_CARTRIDGE)+0x100000; + UINT8 *src = memory_region(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE)+0x100000; UINT8 *dst = malloc_or_die(0x400000); memcpy( dst, src, 0x400000); for( i=0; i<8; ++i ) @@ -1002,11 +1002,11 @@ void matrim_decrypt_68k(void) } -void samsho5_decrypt_68k(void) +void samsho5_decrypt_68k(running_machine *machine) { int i; static const int sec[]={0x000000,0x080000,0x700000,0x680000,0x500000,0x180000,0x200000,0x480000,0x300000,0x780000,0x600000,0x280000,0x100000,0x580000,0x400000,0x380000}; - UINT8 *src = memory_region(NEOGEO_REGION_MAIN_CPU_CARTRIDGE); + UINT8 *src = memory_region(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE); UINT8 *dst = malloc_or_die(0x800000); memcpy( dst, src, 0x800000 ); @@ -1018,11 +1018,11 @@ void samsho5_decrypt_68k(void) } -void samsh5p_decrypt_68k(void) +void samsh5p_decrypt_68k(running_machine *machine) { int i; static const int sec[]={0x000000,0x080000,0x500000,0x480000,0x600000,0x580000,0x700000,0x280000,0x100000,0x680000,0x400000,0x780000,0x200000,0x380000,0x300000,0x180000}; - UINT8 *src = memory_region(NEOGEO_REGION_MAIN_CPU_CARTRIDGE); + UINT8 *src = memory_region(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE); UINT8 *dst = malloc_or_die(0x800000); memcpy( dst, src, 0x800000 ); @@ -1035,14 +1035,14 @@ void samsh5p_decrypt_68k(void) /* mslug5, svcchaos, kof2003 have updated P rom scramble */ -void mslug5_decrypt_68k(void) +void mslug5_decrypt_68k(running_machine *machine) { static const UINT8 xor1[ 0x20 ] = { 0xc2, 0x4b, 0x74, 0xfd, 0x0b, 0x34, 0xeb, 0xd7, 0x10, 0x6d, 0xf9, 0xce, 0x5d, 0xd5, 0x61, 0x29, 0xf5, 0xbe, 0x0d, 0x82, 0x72, 0x45, 0x0f, 0x24, 0xb3, 0x34, 0x1b, 0x99, 0xea, 0x09, 0xf3, 0x03 }; static const UINT8 xor2[ 0x20 ] = { 0x36, 0x09, 0xb0, 0x64, 0x95, 0x0f, 0x90, 0x42, 0x6e, 0x0f, 0x30, 0xf6, 0xe5, 0x08, 0x30, 0x64, 0x08, 0x04, 0x00, 0x2f, 0x72, 0x09, 0xa0, 0x13, 0xc9, 0x0b, 0xa0, 0x3e, 0xc2, 0x00, 0x40, 0x2b }; int i; int ofst; int rom_size = 0x800000; - UINT8 *rom = memory_region( NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); + UINT8 *rom = memory_region( machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); UINT8 *buf = malloc_or_die( rom_size ); for( i = 0; i < 0x100000; i++ ) @@ -1080,14 +1080,14 @@ void mslug5_decrypt_68k(void) } -void svcchaos_px_decrypt(void) +void svcchaos_px_decrypt(running_machine *machine) { static const UINT8 xor1[ 0x20 ] = { 0x3b, 0x6a, 0xf7, 0xb7, 0xe8, 0xa9, 0x20, 0x99, 0x9f, 0x39, 0x34, 0x0c, 0xc3, 0x9a, 0xa5, 0xc8, 0xb8, 0x18, 0xce, 0x56, 0x94, 0x44, 0xe3, 0x7a, 0xf7, 0xdd, 0x42, 0xf0, 0x18, 0x60, 0x92, 0x9f }; static const UINT8 xor2[ 0x20 ] = { 0x69, 0x0b, 0x60, 0xd6, 0x4f, 0x01, 0x40, 0x1a, 0x9f, 0x0b, 0xf0, 0x75, 0x58, 0x0e, 0x60, 0xb4, 0x14, 0x04, 0x20, 0xe4, 0xb9, 0x0d, 0x10, 0x89, 0xeb, 0x07, 0x30, 0x90, 0x50, 0x0e, 0x20, 0x26 }; int i; int ofst; int rom_size = 0x800000; - UINT8 *rom = memory_region( NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); + UINT8 *rom = memory_region( machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); UINT8 *buf = malloc_or_die( rom_size ); for( i = 0; i < 0x100000; i++ ) @@ -1125,31 +1125,31 @@ void svcchaos_px_decrypt(void) } -void kf2k3pcb_decrypt_s1data(void) +void kf2k3pcb_decrypt_s1data(running_machine *machine) { UINT8 *src; UINT8 *dst; int i; - int tx_size = memory_region_length( NEOGEO_REGION_FIXED_LAYER_CARTRIDGE ); - int srom_size = memory_region_length( NEOGEO_REGION_SPRITES ); + int tx_size = memory_region_length( machine, NEOGEO_REGION_FIXED_LAYER_CARTRIDGE ); + int srom_size = memory_region_length( machine, NEOGEO_REGION_SPRITES ); - src = memory_region( NEOGEO_REGION_SPRITES ) + srom_size - 0x1000000 - 0x80000; // Decrypt S - dst = memory_region( NEOGEO_REGION_FIXED_LAYER_CARTRIDGE ); + src = memory_region( machine, NEOGEO_REGION_SPRITES ) + srom_size - 0x1000000 - 0x80000; // Decrypt S + dst = memory_region( machine, NEOGEO_REGION_FIXED_LAYER_CARTRIDGE ); for( i = 0; i < tx_size / 2; i++ ) { dst[ i ] = src[ (i & ~0x1f) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4) ]; } - src = memory_region( NEOGEO_REGION_SPRITES ) + srom_size - 0x80000; - dst = memory_region( NEOGEO_REGION_FIXED_LAYER_CARTRIDGE ) + 0x80000; + src = memory_region( machine, NEOGEO_REGION_SPRITES ) + srom_size - 0x80000; + dst = memory_region( machine, NEOGEO_REGION_FIXED_LAYER_CARTRIDGE ) + 0x80000; for( i = 0; i < tx_size / 2; i++ ) { dst[ i ] = src[ (i & ~0x1f) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4) ]; } - dst = memory_region( NEOGEO_REGION_FIXED_LAYER_CARTRIDGE ); + dst = memory_region( machine, NEOGEO_REGION_FIXED_LAYER_CARTRIDGE ); for( i = 0; i < tx_size; i++ ) { @@ -1158,13 +1158,13 @@ void kf2k3pcb_decrypt_s1data(void) } -void kf2k3pcb_decrypt_68k(void) +void kf2k3pcb_decrypt_68k(running_machine *machine) { static const UINT8 xor2[ 0x20 ] = { 0xb4, 0x0f, 0x40, 0x6c, 0x38, 0x07, 0xd0, 0x3f, 0x53, 0x08, 0x80, 0xaa, 0xbe, 0x07, 0xc0, 0xfa, 0xd0, 0x08, 0x10, 0xd2, 0xf1, 0x03, 0x70, 0x7e, 0x87, 0x0b, 0x40, 0xf6, 0x2a, 0x0a, 0xe0, 0xf9 }; int i; int ofst; int rom_size = 0x900000; - UINT8 *rom = memory_region( NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); + UINT8 *rom = memory_region( machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); UINT8 *buf = malloc_or_die( rom_size ); for (i = 0; i < 0x100000; i++) @@ -1200,14 +1200,14 @@ void kf2k3pcb_decrypt_68k(void) } -void kof2003_decrypt_68k(void) +void kof2003_decrypt_68k(running_machine *machine) { static const UINT8 xor1[0x20] = { 0x3b, 0x6a, 0xf7, 0xb7, 0xe8, 0xa9, 0x20, 0x99, 0x9f, 0x39, 0x34, 0x0c, 0xc3, 0x9a, 0xa5, 0xc8, 0xb8, 0x18, 0xce, 0x56, 0x94, 0x44, 0xe3, 0x7a, 0xf7, 0xdd, 0x42, 0xf0, 0x18, 0x60, 0x92, 0x9f }; static const UINT8 xor2[0x20] = { 0x2f, 0x02, 0x60, 0xbb, 0x77, 0x01, 0x30, 0x08, 0xd8, 0x01, 0xa0, 0xdf, 0x37, 0x0a, 0xf0, 0x65, 0x28, 0x03, 0xd0, 0x23, 0xd3, 0x03, 0x70, 0x42, 0xbb, 0x06, 0xf0, 0x28, 0xba, 0x0f, 0xf0, 0x7a }; int i; int ofst; int rom_size = 0x900000; - UINT8 *rom = memory_region( NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); + UINT8 *rom = memory_region( machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE ); UINT8 *buf = malloc_or_die( rom_size ); for (i = 0; i < 0x100000; i++) @@ -1247,7 +1247,7 @@ void kof2003_decrypt_68k(void) } -void kof2003biosdecode(void) +void kof2003biosdecode(running_machine *machine) { static const UINT8 address[0x80]={ 0xb9,0xb8,0x36,0x37,0x3d,0x3c,0xb2,0xb3, @@ -1267,7 +1267,7 @@ void kof2003biosdecode(void) 0xd3,0xd2,0x5c,0x5d,0x57,0x56,0xd8,0xd9, 0xd3,0xd2,0x5c,0x5d,0x57,0x56,0xd8,0xd9, }; - UINT16*src= (UINT16*)memory_region( NEOGEO_REGION_MAIN_CPU_BIOS ); + UINT16*src= (UINT16*)memory_region( machine, NEOGEO_REGION_MAIN_CPU_BIOS ); UINT16*buf= malloc_or_die(0x80000); int a,addr; @@ -1307,10 +1307,10 @@ NeoGeo 'V' (PCM) ROM encryption ***************************************************************************/ /* Neo-Pcm2 Drivers for Encrypted V Roms */ -void neo_pcm2_snk_1999(int value) +void neo_pcm2_snk_1999(running_machine *machine, int value) { /* thanks to Elsemi for the NEO-PCM2 info */ - UINT16 *rom = (UINT16 *)memory_region(NEOGEO_REGION_AUDIO_DATA_1); - int size = memory_region_length(NEOGEO_REGION_AUDIO_DATA_1); + UINT16 *rom = (UINT16 *)memory_region(machine, NEOGEO_REGION_AUDIO_DATA_1); + int size = memory_region_length(machine, NEOGEO_REGION_AUDIO_DATA_1); int i, j; if( rom != NULL ) @@ -1331,7 +1331,7 @@ void neo_pcm2_snk_1999(int value) /* the later PCM2 games have additional scrambling */ -void neo_pcm2_swap(int value) +void neo_pcm2_swap(running_machine *machine, int value) { static const UINT32 addrs[7][2]={ {0x000000,0xa5000}, @@ -1349,7 +1349,7 @@ void neo_pcm2_swap(int value) {0xcb,0x29,0x7d,0x43,0xd2,0x3a,0xc2,0xb4}, {0x4b,0xa4,0x63,0x46,0xf0,0x91,0xea,0x62}, {0x4b,0xa4,0x63,0x46,0xf0,0x91,0xea,0x62}}; - UINT8 *src = memory_region(NEOGEO_REGION_AUDIO_DATA_1); + UINT8 *src = memory_region(machine, NEOGEO_REGION_AUDIO_DATA_1); UINT8 *buf = malloc_or_die(0x1000000); int i, j, d; diff --git a/src/mame/machine/neoprot.c b/src/mame/machine/neoprot.c index ef03d92ff58..7820c6fb688 100644 --- a/src/mame/machine/neoprot.c +++ b/src/mame/machine/neoprot.c @@ -119,7 +119,7 @@ void fatfury2_install_protection(running_machine *machine) static WRITE16_HANDLER ( kof98_prot_w ) { /* info from razoola */ - UINT16* mem16 = (UINT16*)memory_region(NEOGEO_REGION_MAIN_CPU_CARTRIDGE); + UINT16* mem16 = (UINT16*)memory_region(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE); switch (data) { @@ -154,10 +154,10 @@ void install_kof98_protection(running_machine *machine) todo: emulate, not patch! ***************************************************************/ -void mslugx_install_protection(void) +void mslugx_install_protection(running_machine *machine) { int i; - UINT16 *mem16 = (UINT16 *)memory_region(NEOGEO_REGION_MAIN_CPU_CARTRIDGE); + UINT16 *mem16 = (UINT16 *)memory_region(machine, NEOGEO_REGION_MAIN_CPU_CARTRIDGE); for (i = 0;i < (0x100000/2) - 4;i++) { diff --git a/src/mame/machine/nmk004.c b/src/mame/machine/nmk004.c index 458a5b14b3a..992eed527ef 100644 --- a/src/mame/machine/nmk004.c +++ b/src/mame/machine/nmk004.c @@ -167,7 +167,7 @@ static void oki_play_sample(running_machine *machine, int sample_no) if (sample != 0) { - UINT8 *rom = memory_region(REGION_SOUND1 + chip); + UINT8 *rom = memory_region(machine, REGION_SOUND1 + chip); int bank = (byte2 & 0x0c) >> 2; int vol = (byte2 & 0x70) >> 4; @@ -1029,7 +1029,7 @@ static TIMER_CALLBACK( real_nmk004_init ) memset(&NMK004_state, 0, sizeof(NMK004_state)); - NMK004_state.rom = memory_region(REGION_CPU2); + NMK004_state.rom = memory_region(machine, REGION_CPU2); YM2203_control_port_0_w(machine, 0, 0x2f); diff --git a/src/mame/machine/nmk112.c b/src/mame/machine/nmk112.c index f99d76004f6..ff47a5fc1d9 100644 --- a/src/mame/machine/nmk112.c +++ b/src/mame/machine/nmk112.c @@ -31,8 +31,8 @@ WRITE8_HANDLER( NMK112_okibank_w ) int banknum = offset & 3; int paged = (page_mask & (1 << chip)); - UINT8 *rom = memory_region(REGION_SOUND1 + chip); - int size = memory_region_length(REGION_SOUND1 + chip) - 0x40000; + UINT8 *rom = memory_region(machine, REGION_SOUND1 + chip); + int size = memory_region_length(machine, REGION_SOUND1 + chip) - 0x40000; int bankaddr = (data * BANKSIZE) % size; if (current_bank[offset] == data) return; diff --git a/src/mame/machine/opwolf.c b/src/mame/machine/opwolf.c index da0b98a2abb..7cbc6dd408d 100644 --- a/src/mame/machine/opwolf.c +++ b/src/mame/machine/opwolf.c @@ -427,7 +427,7 @@ WRITE16_HANDLER( opwolf_cchip_data_w ) if (offset == 0x14) { #if OPWOLF_READ_COINAGE_FROM_ROM - UINT16* rom=(UINT16*)memory_region(REGION_CPU1); + UINT16* rom=(UINT16*)memory_region(machine, REGION_CPU1); UINT32 coin_table[2]={0,0}; UINT8 coin_offset[2]; int slot; diff --git a/src/mame/machine/pacplus.c b/src/mame/machine/pacplus.c index 1791c2a5ab5..63d0b276b69 100644 --- a/src/mame/machine/pacplus.c +++ b/src/mame/machine/pacplus.c @@ -39,14 +39,14 @@ static UINT8 decrypt(int addr, UINT8 e) } -void pacplus_decode(void) +void pacplus_decode(running_machine *machine) { int i; UINT8 *RAM; /* CPU ROMs */ - RAM = memory_region(REGION_CPU1); + RAM = memory_region(machine, REGION_CPU1); for (i = 0; i < 0x4000; i++) { RAM[i] = decrypt(i,RAM[i]); diff --git a/src/mame/machine/pgmcrypt.c b/src/mame/machine/pgmcrypt.c index dff9b729fa3..1110066f79a 100644 --- a/src/mame/machine/pgmcrypt.c +++ b/src/mame/machine/pgmcrypt.c @@ -23,11 +23,11 @@ static const UINT8 kov_tab[256] = { 0x80, 0xe6, 0xba, 0xb3, 0x08, 0xd8, 0x30, 0x5b, 0x5f, 0xf2, 0x5a, 0xfb, 0x63, 0xb0, 0xa4, 0x41 }; -void pgm_kov_decrypt(void) +void pgm_kov_decrypt(running_machine *machine) { int i; - UINT16 *src = (UINT16 *) (memory_region(REGION_CPU1)+0x100000); + UINT16 *src = (UINT16 *) (memory_region(machine, REGION_CPU1)+0x100000); int rom_size = 0x400000; @@ -85,11 +85,11 @@ static const UINT8 kovsh_tab[256] = { }; -void pgm_kovsh_decrypt(void) +void pgm_kovsh_decrypt(running_machine *machine) { int i; - UINT16 *src = (UINT16 *) (memory_region(REGION_CPU1)+0x100000); + UINT16 *src = (UINT16 *) (memory_region(machine, REGION_CPU1)+0x100000); int rom_size = 0x400000; @@ -126,11 +126,11 @@ void pgm_kovsh_decrypt(void) } } -void pgm_dw2_decrypt(void) +void pgm_dw2_decrypt(running_machine *machine) { int i; - UINT16 *src = (UINT16 *) (memory_region(REGION_CPU1)+0x100000); + UINT16 *src = (UINT16 *) (memory_region(machine, REGION_CPU1)+0x100000); int rom_size = 0x80000; @@ -168,11 +168,11 @@ static const UINT8 djlzz_tab[256] = { 0x92, 0x14, 0x23, 0xae, 0x4b, 0x80, 0xae, 0x6a, 0x56, 0x01, 0xac, 0x55, 0xf7, 0x6d, 0x9b, 0x6d, }; -void pgm_djlzz_decrypt(void) +void pgm_djlzz_decrypt(running_machine *machine) { int i; - UINT16 *src = (UINT16 *) (memory_region(REGION_CPU1)+0x100000); + UINT16 *src = (UINT16 *) (memory_region(machine, REGION_CPU1)+0x100000); int rom_size = 0x400000; @@ -228,11 +228,11 @@ static const UINT8 pstar[256] = { 0x62, 0x51, 0xf6, 0xe3, 0xa6, 0xea, 0x32, 0x86, 0x67, 0xcc, 0x4a, 0x46, 0x4d, 0x37, 0x45, 0xd5, }; -void pgm_pstar_decrypt(void) +void pgm_pstar_decrypt(running_machine *machine) { int i; - UINT16 *src = (UINT16 *) (memory_region(REGION_CPU1)+0x100000); + UINT16 *src = (UINT16 *) (memory_region(machine, REGION_CPU1)+0x100000); int rom_size = 0x100000; @@ -265,14 +265,14 @@ void pgm_pstar_decrypt(void) } } -void pgm_dw3_decrypt(void) +void pgm_dw3_decrypt(running_machine *machine) { // int i; // UINT16 *src=(UINT16 *) (OP_ROM+0x100000); int i; - UINT16 *src = (UINT16 *) (memory_region(REGION_CPU1)+0x100000); + UINT16 *src = (UINT16 *) (memory_region(machine, REGION_CPU1)+0x100000); int rom_size = 0x100000; @@ -297,14 +297,14 @@ void pgm_dw3_decrypt(void) } } -void pgm_killbld_decrypt(void) +void pgm_killbld_decrypt(running_machine *machine) { // int i; // UINT16 *src=(UINT16 *) (OP_ROM+0x100000); int i; - UINT16 *src = (UINT16 *) (memory_region(REGION_CPU1)+0x100000); + UINT16 *src = (UINT16 *) (memory_region(machine, REGION_CPU1)+0x100000); int rom_size = 0x200000; @@ -341,10 +341,10 @@ static const UINT8 dfront_tab[256] = { 0x08, 0x75, 0xa1, 0x33, 0xab, 0xd2, 0xda, 0x81, 0xbf, 0x7a, 0x3b, 0x3f, 0x4a, 0xfd, 0x25, 0x36, }; -void pgm_dfront_decrypt(void) +void pgm_dfront_decrypt(running_machine *machine) { int i; - UINT16 *src = (UINT16 *)(memory_region(REGION_USER1)); + UINT16 *src = (UINT16 *)(memory_region(machine, REGION_USER1)); int rom_size = 0x200000; @@ -401,10 +401,10 @@ static const UINT8 ddp2_tab[256] = { 0xdc, 0xca, 0xd4, 0xda, 0xcd, 0xd2, 0x83, 0xca, 0xeb, 0x4f, 0xf2, 0x2f, 0x2d, 0x2a, 0xec, 0x1f }; -void pgm_ddp2_decrypt(void) +void pgm_ddp2_decrypt(running_machine *machine) { int i; - UINT16 *src = (UINT16 *)(memory_region(REGION_USER1)); + UINT16 *src = (UINT16 *)(memory_region(machine, REGION_USER1)); int rom_size = 0x200000; @@ -456,10 +456,10 @@ static const UINT8 mm_tab[256] = { 0x7c, 0x01, 0x43, 0xdb, 0x53, 0x85, 0xfe, 0x78, 0x91, 0x40, 0xa3, 0xdf, 0x4f, 0xff, 0x10, 0x6c, }; -void pgm_mm_decrypt(void) +void pgm_mm_decrypt(running_machine *machine) { int i; - UINT16 *src = (UINT16 *)(memory_region(REGION_USER1)); + UINT16 *src = (UINT16 *)(memory_region(machine, REGION_USER1)); int rom_size = 0x200000; @@ -515,10 +515,10 @@ static const UINT8 kov2_tab[256] = { 0x9c, 0xc8, 0xd4, 0xda, 0xcd, 0xd2, 0x83, 0xca, 0xeb, 0x4f, 0xf2, 0x0f, 0x0d, 0x2a, 0xec, 0x1f, }; -void pgm_kov2_decrypt(void) +void pgm_kov2_decrypt(running_machine *machine) { int i; - UINT16 *src = (UINT16 *)(memory_region(REGION_USER1)); + UINT16 *src = (UINT16 *)(memory_region(machine, REGION_USER1)); int rom_size = 0x200000; @@ -571,10 +571,10 @@ static const UINT8 puzzli2_tab[256] = { 0x1d, 0x18, 0xa2, 0xb6, 0xb2, 0xa9, 0xac, 0xab, 0xae, 0x91, 0x98, 0x8d, 0x91, 0xbb, 0xb1, 0xc0, }; -void pgm_puzzli2_decrypt(void) +void pgm_puzzli2_decrypt(running_machine *machine) { int i; - UINT16 *src = (UINT16 *) (memory_region(REGION_CPU1)+0x100000); + UINT16 *src = (UINT16 *) (memory_region(machine, REGION_CPU1)+0x100000); int rom_size = 0x100000; diff --git a/src/mame/machine/playch10.c b/src/mame/machine/playch10.c index b610aecb993..ffc677afa64 100644 --- a/src/mame/machine/playch10.c +++ b/src/mame/machine/playch10.c @@ -167,7 +167,7 @@ WRITE8_HANDLER( pc10_prot_w ) /* is the actual protection memory area */ /* setting the whole 0x2000 region every time is a waste */ /* so we just set $ffff with the current value */ - memory_region( REGION_CPU1 )[0xffff] = pc10_prot_r(machine,0); + memory_region( machine, REGION_CPU1 )[0xffff] = pc10_prot_r(machine,0); } } @@ -398,7 +398,7 @@ static WRITE8_HANDLER( mmc1_rom_switch_w ) case 3: /* program banking */ { int bank = ( mmc1_shiftreg & mmc1_rom_mask ) * 0x4000; - UINT8 *prg = memory_region( REGION_CPU2 ); + UINT8 *prg = memory_region( machine, REGION_CPU2 ); if ( !size16k ) { @@ -453,14 +453,14 @@ DRIVER_INIT( pcaboard ) static WRITE8_HANDLER( bboard_rom_switch_w ) { int bankoffset = 0x10000 + ( ( data & 7 ) * 0x4000 ); - UINT8 *prg = memory_region( REGION_CPU2 ); + UINT8 *prg = memory_region( machine, REGION_CPU2 ); memcpy( &prg[0x08000], &prg[bankoffset], 0x4000 ); } DRIVER_INIT( pcbboard ) { - UINT8 *prg = memory_region( REGION_CPU2 ); + UINT8 *prg = memory_region( machine, REGION_CPU2 ); /* We do manual banking, in case the code falls through */ /* Copy the initial banks */ @@ -500,7 +500,7 @@ DRIVER_INIT( pccboard ) DRIVER_INIT( pcdboard ) { - UINT8 *prg = memory_region( REGION_CPU2 ); + UINT8 *prg = memory_region( machine, REGION_CPU2 ); /* We do manual banking, in case the code falls through */ /* Copy the initial banks */ @@ -564,7 +564,7 @@ static WRITE8_HANDLER( eboard_rom_switch_w ) case 0x2000: /* code bank switching */ { int bankoffset = 0x10000 + ( data & 0x0f ) * 0x2000; - UINT8 *prg = memory_region( REGION_CPU2 ); + UINT8 *prg = memory_region( machine, REGION_CPU2 ); memcpy( &prg[0x08000], &prg[bankoffset], 0x2000 ); } break; @@ -602,7 +602,7 @@ static WRITE8_HANDLER( eboard_rom_switch_w ) DRIVER_INIT( pceboard ) { - UINT8 *prg = memory_region( REGION_CPU2 ); + UINT8 *prg = memory_region( machine, REGION_CPU2 ); /* We do manual banking, in case the code falls through */ /* Copy the initial banks */ @@ -628,7 +628,7 @@ DRIVER_INIT( pceboard ) DRIVER_INIT( pcfboard ) { - UINT8 *prg = memory_region( REGION_CPU2 ); + UINT8 *prg = memory_region( machine, REGION_CPU2 ); /* We do manual banking, in case the code falls through */ /* Copy the initial banks */ @@ -690,7 +690,7 @@ static WRITE8_HANDLER( gboard_rom_switch_w ) if ( gboard_last_bank != ( data & 0xc0 ) ) { int bank; - UINT8 *prg = memory_region( REGION_CPU2 ); + UINT8 *prg = memory_region( machine, REGION_CPU2 ); /* reset the banks */ if ( gboard_command & 0x40 ) @@ -743,7 +743,7 @@ static WRITE8_HANDLER( gboard_rom_switch_w ) case 6: /* program banking */ { - UINT8 *prg = memory_region( REGION_CPU2 ); + UINT8 *prg = memory_region( machine, REGION_CPU2 ); if ( gboard_command & 0x40 ) { /* high bank */ @@ -768,7 +768,7 @@ static WRITE8_HANDLER( gboard_rom_switch_w ) case 7: /* program banking */ { /* mid bank */ - UINT8 *prg = memory_region( REGION_CPU2 ); + UINT8 *prg = memory_region( machine, REGION_CPU2 ); gboard_banks[1] = data & 0x1f; bank = gboard_banks[1] * 0x2000 + 0x10000; @@ -813,7 +813,7 @@ static WRITE8_HANDLER( gboard_rom_switch_w ) DRIVER_INIT( pcgboard ) { - UINT8 *prg = memory_region( REGION_CPU2 ); + UINT8 *prg = memory_region( machine, REGION_CPU2 ); /* We do manual banking, in case the code falls through */ /* Copy the initial banks */ @@ -853,7 +853,7 @@ DRIVER_INIT( pcgboard_type2 ) static WRITE8_HANDLER( iboard_rom_switch_w ) { int bank = data & 7; - UINT8 *prg = memory_region( REGION_CPU2 ); + UINT8 *prg = memory_region( machine, REGION_CPU2 ); if ( data & 0x10 ) ppu2c0x_set_mirroring( 0, PPU_MIRROR_HIGH ); @@ -865,7 +865,7 @@ static WRITE8_HANDLER( iboard_rom_switch_w ) DRIVER_INIT( pciboard ) { - UINT8 *prg = memory_region( REGION_CPU2 ); + UINT8 *prg = memory_region( machine, REGION_CPU2 ); /* We do manual banking, in case the code falls through */ /* Copy the initial banks */ @@ -930,7 +930,7 @@ static WRITE8_HANDLER( hboard_rom_switch_w ) DRIVER_INIT( pchboard ) { - UINT8 *prg = memory_region( REGION_CPU2 ); + UINT8 *prg = memory_region( machine, REGION_CPU2 ); memcpy( &prg[0x08000], &prg[0x4c000], 0x4000 ); memcpy( &prg[0x0c000], &prg[0x4c000], 0x4000 ); @@ -956,7 +956,7 @@ DRIVER_INIT( pchboard ) DRIVER_INIT( pckboard ) { - UINT8 *prg = memory_region( REGION_CPU2 ); + UINT8 *prg = memory_region( machine, REGION_CPU2 ); /* We do manual banking, in case the code falls through */ /* Copy the initial banks */ diff --git a/src/mame/machine/r2crypt.c b/src/mame/machine/r2crypt.c index 524182fb345..ea8abf49636 100644 --- a/src/mame/machine/r2crypt.c +++ b/src/mame/machine/r2crypt.c @@ -248,10 +248,10 @@ static UINT32 trans(UINT32 v, UINT32 x) return r; } -void raiden2_decrypt_sprites(void) +void raiden2_decrypt_sprites(running_machine *machine) { int i; - UINT32 *data = (UINT32 *)memory_region(REGION_GFX3); + UINT32 *data = (UINT32 *)memory_region(machine, REGION_GFX3); for(i=0; i<0x800000/4; i++) { UINT32 x1, v1, y1; diff --git a/src/mame/machine/s16fd.c b/src/mame/machine/s16fd.c index 343f4c60194..617be67aaed 100644 --- a/src/mame/machine/s16fd.c +++ b/src/mame/machine/s16fd.c @@ -9,7 +9,7 @@ make more configurable (select caches per game?) */ #include "driver.h" - +#include "deprecat.h" #include "cpu/m68000/m68000.h" #include "machine/fd1094.h" #include "includes/system16.h" @@ -29,7 +29,7 @@ static int fd1094_current_cacheposition; // current position in cache array static int fd1094_state; static int fd1094_selected_state; -static void (*fd1094_set_decrypted)(UINT8 *); +static void (*fd1094_set_decrypted)(running_machine *, UINT8 *); void *fd1094_get_decrypted_base(void) { @@ -41,7 +41,7 @@ void *fd1094_get_decrypted_base(void) static void set_decrypted_region(void) { if (fd1094_set_decrypted != NULL) - (*fd1094_set_decrypted)((UINT8 *)fd1094_userregion); + (*fd1094_set_decrypted)(Machine, (UINT8 *)fd1094_userregion); else memory_set_decrypted_region(0, 0, fd1094_cpuregionsize - 1, fd1094_userregion); } @@ -195,13 +195,13 @@ static void key_changed(void) /* startup function, to be called from DRIVER_INIT (once on startup) */ -void fd1094_driver_init(running_machine *machine, void (*set_decrypted)(UINT8 *)) +void fd1094_driver_init(running_machine *machine, void (*set_decrypted)(running_machine *, UINT8 *)) { int i; - fd1094_cpuregion = (UINT16*)memory_region(REGION_CPU1); - fd1094_cpuregionsize = memory_region_length(REGION_CPU1); - fd1094_key = memory_region(REGION_USER1); + fd1094_cpuregion = (UINT16*)memory_region(machine, REGION_CPU1); + fd1094_cpuregionsize = memory_region_length(machine, REGION_CPU1); + fd1094_key = memory_region(machine, REGION_USER1); fd1094_set_decrypted = set_decrypted; /* punt if no key; this allows us to be called even for non-FD1094 games */ @@ -218,7 +218,7 @@ void fd1094_driver_init(running_machine *machine, void (*set_decrypted)(UINT8 *) #ifdef ENABLE_DEBUGGER /* key debugging */ - if (machine->debug_mode && memory_region(REGION_USER2) != NULL) + if (machine->debug_mode && memory_region(machine, REGION_USER2) != NULL) { void fd1094_init_debugging(running_machine *, int, int, int, void (*changed)(void)); fd1094_init_debugging(machine, REGION_CPU1, REGION_USER1, REGION_USER2, key_changed); diff --git a/src/mame/machine/s24fd.c b/src/mame/machine/s24fd.c index 56479cb5bb0..525b7fc4ae3 100644 --- a/src/mame/machine/s24fd.c +++ b/src/mame/machine/s24fd.c @@ -158,7 +158,7 @@ void s24_fd1094_driver_init(running_machine *machine) s24_fd1094_cpuregion = (UINT16*)s24_mainram1; s24_fd1094_cpuregionsize = 0x40000; - s24_fd1094_key = memory_region(REGION_USER3); + s24_fd1094_key = memory_region(Machine, REGION_USER3); /* punt if no key; this allows us to be called even for non-s24_fd1094 games */ if (!s24_fd1094_key) diff --git a/src/mame/machine/scramble.c b/src/mame/machine/scramble.c index 8b0d7f17dda..98a2acde460 100644 --- a/src/mame/machine/scramble.c +++ b/src/mame/machine/scramble.c @@ -40,7 +40,7 @@ MACHINE_RESET( monsterz ) { /* // patch rom crc - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); ROM[0x363f] = 0; ROM[0x3640] = 0; ROM[0x3641] = 0; @@ -56,7 +56,7 @@ MACHINE_RESET( monsterz ) MACHINE_RESET( explorer ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); RAM[0x47ff] = 0; /* If not set, it doesn't reset after the 1st time */ MACHINE_RESET_CALL(galaxold); @@ -388,7 +388,7 @@ DRIVER_INIT( mariner ) { /* extra ROM */ memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x5800, 0x67ff, 0, 0, SMH_BANK1, SMH_UNMAP); - memory_set_bankptr(1, memory_region(REGION_CPU1) + 0x5800); + memory_set_bankptr(1, memory_region(machine, REGION_CPU1) + 0x5800); memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x9008, 0x9008, 0, 0, mariner_protection_2_r); memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xb401, 0xb401, 0, 0, mariner_protection_1_r); @@ -403,12 +403,12 @@ DRIVER_INIT( frogger ) UINT8 *ROM; /* the first ROM of the second CPU has data lines D0 and D1 swapped. Decode it. */ - ROM = memory_region(REGION_CPU2); + ROM = memory_region(machine, REGION_CPU2); for (A = 0;A < 0x0800;A++) ROM[A] = BITSWAP8(ROM[A],7,6,5,4,3,2,0,1); /* likewise, the 2nd gfx ROM has data lines D0 and D1 swapped. Decode it. */ - ROM = memory_region(REGION_GFX1); + ROM = memory_region(machine, REGION_GFX1); for (A = 0x0800;A < 0x1000;A++) ROM[A] = BITSWAP8(ROM[A],7,6,5,4,3,2,0,1); } @@ -419,7 +419,7 @@ DRIVER_INIT( froggers ) UINT8 *ROM; /* the first ROM of the second CPU has data lines D0 and D1 swapped. Decode it. */ - ROM = memory_region(REGION_CPU2); + ROM = memory_region(machine, REGION_CPU2); for (A = 0;A < 0x0800;A++) ROM[A] = BITSWAP8(ROM[A],7,6,5,4,3,2,0,1); } @@ -436,7 +436,7 @@ DRIVER_INIT( devilfsh ) /* A2 -> A3 */ /* A3 -> A1 */ - RAM = memory_region(REGION_CPU1); + RAM = memory_region(machine, REGION_CPU1); for (i = 0; i < 0x10000; i += 16) { offs_t j; @@ -462,12 +462,12 @@ DRIVER_INIT( hotshock ) { /* protection??? The game jumps into never-neverland here. I think it just expects a RET there */ - memory_region(REGION_CPU1)[0x2ef9] = 0xc9; + memory_region(machine, REGION_CPU1)[0x2ef9] = 0xc9; } DRIVER_INIT( cavelon ) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); /* banked ROM */ memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x3fff, 0, 0, SMH_BANK1); @@ -512,7 +512,7 @@ DRIVER_INIT( mimonkey ) { 0x80,0x87,0x81,0x87,0x83,0x00,0x84,0x01,0x01,0x86,0x86,0x80,0x86,0x00,0x86,0x86 } }; - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); int A, ctr = 0, line, col; for( A = 0; A < 0x4000; A++ ) @@ -557,8 +557,8 @@ DRIVER_INIT( anteater ) * Optimizations done by Fabio Buffoni */ - RAM = memory_region(REGION_GFX1); - len = memory_region_length(REGION_GFX1); + RAM = memory_region(machine, REGION_GFX1); + len = memory_region_length(machine, REGION_GFX1); scratch = malloc_or_die(len); @@ -594,8 +594,8 @@ DRIVER_INIT( rescue ) * Optimizations done by Fabio Buffoni */ - RAM = memory_region(REGION_GFX1); - len = memory_region_length(REGION_GFX1); + RAM = memory_region(machine, REGION_GFX1); + len = memory_region_length(machine, REGION_GFX1); scratch = malloc_or_die(len); @@ -630,8 +630,8 @@ DRIVER_INIT( minefld ) * Code To Decode Minefield by Mike Balfour and Nicola Salmoria */ - RAM = memory_region(REGION_GFX1); - len = memory_region_length(REGION_GFX1); + RAM = memory_region(machine, REGION_GFX1); + len = memory_region_length(machine, REGION_GFX1); scratch = malloc_or_die(len); @@ -668,8 +668,8 @@ DRIVER_INIT( losttomb ) * Optimizations done by Fabio Buffoni */ - RAM = memory_region(REGION_GFX1); - len = memory_region_length(REGION_GFX1); + RAM = memory_region(machine, REGION_GFX1); + len = memory_region_length(machine, REGION_GFX1); scratch = malloc_or_die(len); @@ -695,7 +695,7 @@ DRIVER_INIT( losttomb ) DRIVER_INIT( hustler ) { offs_t A; - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); for (A = 0;A < 0x4000;A++) @@ -723,7 +723,7 @@ DRIVER_INIT( hustler ) /* the first ROM of the second CPU has data lines D0 and D1 swapped. Decode it. */ { - rom = memory_region(REGION_CPU2); + rom = memory_region(machine, REGION_CPU2); for (A = 0;A < 0x0800;A++) @@ -734,7 +734,7 @@ DRIVER_INIT( hustler ) DRIVER_INIT( billiard ) { offs_t A; - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); for (A = 0;A < 0x4000;A++) @@ -764,7 +764,7 @@ DRIVER_INIT( billiard ) /* the first ROM of the second CPU has data lines D0 and D1 swapped. Decode it. */ { - rom = memory_region(REGION_CPU2); + rom = memory_region(machine, REGION_CPU2); for (A = 0;A < 0x0800;A++) @@ -792,8 +792,8 @@ DRIVER_INIT( mrkougb ) DRIVER_INIT( ad2083 ) { UINT8 c; - int i, len = memory_region_length(REGION_CPU1); - UINT8 *ROM = memory_region(REGION_CPU1); + int i, len = memory_region_length(machine, REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); for (i=0; i<len; i++) { diff --git a/src/mame/machine/segacrpt.c b/src/mame/machine/segacrpt.c index 2d11dbfc216..24cea82ffe4 100644 --- a/src/mame/machine/segacrpt.c +++ b/src/mame/machine/segacrpt.c @@ -179,7 +179,7 @@ static void lfkp(int mask) { int A; - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); for (A = 0x0000;A < 0x8000-14;A++) @@ -233,13 +233,13 @@ static void look_for_known_plaintext(void) } #endif -static void sega_decode(const UINT8 convtable[32][4]) +static void sega_decode(running_machine *machine, const UINT8 convtable[32][4]) { int A; - int length = memory_region_length(REGION_CPU1); + int length = memory_region_length(machine, REGION_CPU1); int cryptlen = MIN(length, 0x8000); - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); UINT8 *decrypted = auto_malloc(0xc000); memory_set_decrypted_region(0, 0x0000, cryptlen - 1, decrypted); @@ -285,7 +285,7 @@ static void sega_decode(const UINT8 convtable[32][4]) -void buckrog_decode(void) +void buckrog_decode(running_machine *machine) { static const UINT8 convtable[32][4] = { @@ -310,11 +310,11 @@ void buckrog_decode(void) }; - sega_decode(convtable); + sega_decode(machine, convtable); } -void pengo_decode(void) +void pengo_decode(running_machine *machine) { static const UINT8 convtable[32][4] = { @@ -339,11 +339,11 @@ void pengo_decode(void) }; - sega_decode(convtable); + sega_decode(machine, convtable); } -void szaxxon_decode(void) +void szaxxon_decode(running_machine *machine) { static const UINT8 convtable[32][4] = { @@ -368,11 +368,11 @@ void szaxxon_decode(void) }; - sega_decode(convtable); + sega_decode(machine, convtable); } -void suprloco_decode(void) +void suprloco_decode(running_machine *machine) { static const UINT8 convtable[32][4] = { @@ -397,11 +397,11 @@ void suprloco_decode(void) }; - sega_decode(convtable); + sega_decode(machine, convtable); } -void yamato_decode(void) +void yamato_decode(running_machine *machine) { static const UINT8 convtable[32][4] = { @@ -426,10 +426,10 @@ void yamato_decode(void) }; - sega_decode(convtable); + sega_decode(machine, convtable); } -void toprollr_decode(void) +void toprollr_decode(running_machine *machine) { /* same tables as in Yamato, but encrypted ROM is banked */ UINT8 *decrypted; @@ -458,7 +458,7 @@ void toprollr_decode(void) int A; - UINT8 *rom = memory_region(REGION_USER1); + UINT8 *rom = memory_region(machine, REGION_USER1); int bankstart; decrypted = auto_malloc(0x6000*3); @@ -489,14 +489,14 @@ void toprollr_decode(void) rom[A+bankstart] = (src & ~0xa8) | (convtable[2*row+1][col] ^ xor); } - memory_configure_bank(1,0,3, memory_region(REGION_USER1),0x6000); + memory_configure_bank(1,0,3, memory_region(machine, REGION_USER1),0x6000); memory_configure_bank_decrypted(1,0,3,decrypted,0x6000); memory_set_decrypted_region(0, 0x0000, 0x5fff, decrypted); memory_set_bank(1, 0); } -void sindbadm_decode(void) +void sindbadm_decode(running_machine *machine) { static const UINT8 convtable[32][4] = { @@ -521,11 +521,11 @@ void sindbadm_decode(void) }; - sega_decode(convtable); + sega_decode(machine, convtable); } -void regulus_decode(void) +void regulus_decode(running_machine *machine) { static const UINT8 convtable[32][4] = { @@ -550,11 +550,11 @@ void regulus_decode(void) }; - sega_decode(convtable); + sega_decode(machine, convtable); } -void mrviking_decode(void) +void mrviking_decode(running_machine *machine) { static const UINT8 convtable[32][4] = { @@ -579,11 +579,11 @@ void mrviking_decode(void) }; - sega_decode(convtable); + sega_decode(machine, convtable); } -void swat_decode(void) +void swat_decode(running_machine *machine) { static const UINT8 convtable[32][4] = { @@ -608,11 +608,11 @@ void swat_decode(void) }; - sega_decode(convtable); + sega_decode(machine, convtable); } -void flicky_decode(void) +void flicky_decode(running_machine *machine) { static const UINT8 convtable[32][4] = { @@ -637,11 +637,11 @@ void flicky_decode(void) }; - sega_decode(convtable); + sega_decode(machine, convtable); } -void futspy_decode(void) +void futspy_decode(running_machine *machine) { static const UINT8 convtable[32][4] = { @@ -666,11 +666,11 @@ void futspy_decode(void) }; - sega_decode(convtable); + sega_decode(machine, convtable); } -void wmatch_decode(void) +void wmatch_decode(running_machine *machine) { static const UINT8 convtable[32][4] = { @@ -695,11 +695,11 @@ void wmatch_decode(void) }; - sega_decode(convtable); + sega_decode(machine, convtable); } -void bullfgtj_decode(void) +void bullfgtj_decode(running_machine *machine) { static const UINT8 convtable[32][4] = { @@ -724,11 +724,11 @@ void bullfgtj_decode(void) }; - sega_decode(convtable); + sega_decode(machine, convtable); } -void pbaction_decode(void) +void pbaction_decode(running_machine *machine) { static const UINT8 convtable[32][4] = { @@ -753,11 +753,11 @@ void pbaction_decode(void) }; - sega_decode(convtable); + sega_decode(machine, convtable); } -void spatter_decode(void) +void spatter_decode(running_machine *machine) { static const UINT8 convtable[32][4] = { @@ -782,11 +782,11 @@ void spatter_decode(void) }; - sega_decode(convtable); + sega_decode(machine, convtable); } -void jongkyo_decode(void) +void jongkyo_decode(running_machine *machine) { /* encrypted ROM is banked */ UINT8 *decrypted; @@ -815,7 +815,7 @@ void jongkyo_decode(void) int A; - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); decrypted = auto_malloc(0x9000); for (A = 0x0000;A < 0x9000;A++) @@ -847,14 +847,14 @@ void jongkyo_decode(void) rom[A] = (src & ~0xa8) | (convtable[2*row+1][col] ^ xor); } - memory_configure_bank(1,0,8, memory_region(REGION_CPU1)+0x7000,0x0400); + memory_configure_bank(1,0,8, memory_region(machine, REGION_CPU1)+0x7000,0x0400); memory_configure_bank_decrypted(1,0,8,decrypted+0x7000,0x0400); memory_set_decrypted_region(0, 0x0000, 0x6bff, decrypted); memory_set_bank(1, 0); } -void pitfall2_decode(void) +void pitfall2_decode(running_machine *machine) { static const UINT8 convtable[32][4] = { @@ -879,11 +879,11 @@ void pitfall2_decode(void) }; - sega_decode(convtable); + sega_decode(machine, convtable); } -void nprinces_decode(void) +void nprinces_decode(running_machine *machine) { static const UINT8 convtable[32][4] = { @@ -908,11 +908,11 @@ void nprinces_decode(void) }; - sega_decode(convtable); + sega_decode(machine, convtable); } -void seganinj_decode(void) +void seganinj_decode(running_machine *machine) { static const UINT8 convtable[32][4] = { @@ -937,11 +937,11 @@ void seganinj_decode(void) }; - sega_decode(convtable); + sega_decode(machine, convtable); } -void imsorry_decode(void) +void imsorry_decode(running_machine *machine) { static const UINT8 convtable[32][4] = { @@ -966,11 +966,11 @@ void imsorry_decode(void) }; - sega_decode(convtable); + sega_decode(machine, convtable); } -void teddybb_decode(void) +void teddybb_decode(running_machine *machine) { static const UINT8 convtable[32][4] = { @@ -995,11 +995,11 @@ void teddybb_decode(void) }; - sega_decode(convtable); + sega_decode(machine, convtable); } -void myheroj_decode(void) +void myheroj_decode(running_machine *machine) { static const UINT8 convtable[32][4] = { @@ -1024,11 +1024,11 @@ void myheroj_decode(void) }; - sega_decode(convtable); + sega_decode(machine, convtable); } -void hvymetal_decode(void) +void hvymetal_decode(running_machine *machine) { static const UINT8 convtable[32][4] = { @@ -1053,11 +1053,11 @@ void hvymetal_decode(void) }; - sega_decode(convtable); + sega_decode(machine, convtable); } -void lvcards_decode(void) +void lvcards_decode(running_machine *machine) { static const UINT8 convtable[32][4] = { @@ -1082,7 +1082,7 @@ void lvcards_decode(void) }; - sega_decode(convtable); + sega_decode(machine, convtable); } @@ -1098,7 +1098,8 @@ void lvcards_decode(void) ******************************************************************************/ -static void sega_decode_2(const UINT8 opcode_xor[64],const int opcode_swap_select[64], +static void sega_decode_2(running_machine *machine, + const UINT8 opcode_xor[64],const int opcode_swap_select[64], const UINT8 data_xor[64],const int data_swap_select[64]) { int A; @@ -1113,7 +1114,7 @@ static void sega_decode_2(const UINT8 opcode_xor[64],const int opcode_swap_selec }; - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); UINT8 *decrypted = auto_malloc(0x8000); memory_set_decrypted_region(0, 0x0000, 0x7fff, decrypted); @@ -1144,7 +1145,7 @@ static void sega_decode_2(const UINT8 opcode_xor[64],const int opcode_swap_selec -void fdwarrio_decode(void) +void fdwarrio_decode(running_machine *machine) { static const UINT8 opcode_xor[64] = { @@ -1188,11 +1189,11 @@ void fdwarrio_decode(void) }; - sega_decode_2(opcode_xor,opcode_swap_select,data_xor,data_swap_select); + sega_decode_2(machine,opcode_xor,opcode_swap_select,data_xor,data_swap_select); } -void astrofl_decode(void) +void astrofl_decode(running_machine *machine) { static const UINT8 opcode_xor[64] = { @@ -1233,11 +1234,11 @@ void astrofl_decode(void) }; - sega_decode_2(opcode_xor,opcode_swap_select,data_xor,data_swap_select); + sega_decode_2(machine,opcode_xor,opcode_swap_select,data_xor,data_swap_select); } -void wboy2_decode(void) +void wboy2_decode(running_machine *machine) { static const UINT8 opcode_xor[64] = { @@ -1298,11 +1299,11 @@ void wboy2_decode(void) }; - sega_decode_2(opcode_xor,opcode_swap_select,data_xor,data_swap_select); + sega_decode_2(machine,opcode_xor,opcode_swap_select,data_xor,data_swap_select); } -void robowres_decode(void) +void robowres_decode(running_machine *machine) { static const UINT8 opcode_xor[64] = { @@ -1351,7 +1352,7 @@ void robowres_decode(void) }; - sega_decode_2(opcode_xor,opcode_swap_select,data_xor,data_swap_select); + sega_decode_2(machine,opcode_xor,opcode_swap_select,data_xor,data_swap_select); } @@ -1362,7 +1363,7 @@ void robowres_decode(void) ******************************************************************************/ -static void sega_decode_317(int order, int opcode_shift, int data_shift) +static void sega_decode_317(running_machine *machine,int order, int opcode_shift, int data_shift) { static const UINT8 xor1_317[1+64] = { @@ -1411,12 +1412,12 @@ static void sega_decode_317(int order, int opcode_shift, int data_shift) }; if (order) - sega_decode_2( xor2_317+opcode_shift, swap2_317+opcode_shift, xor1_317+data_shift, swap1_317+data_shift ); + sega_decode_2( machine, xor2_317+opcode_shift, swap2_317+opcode_shift, xor1_317+data_shift, swap1_317+data_shift ); else - sega_decode_2( xor1_317+opcode_shift, swap1_317+opcode_shift, xor2_317+data_shift, swap2_317+data_shift ); + sega_decode_2( machine, xor1_317+opcode_shift, swap1_317+opcode_shift, xor2_317+data_shift, swap2_317+data_shift ); } -void spcpostn_decode(void) { sega_decode_317( 0, 0, 1 ); } -void calorie_decode(void) { sega_decode_317( 1, 0, 0 ); } -void gardia_decode(void) { sega_decode_317( 1, 1, 1 ); } -void gardiab_decode(void) { sega_decode_317( 0, 1, 2 ); } +void spcpostn_decode(running_machine *machine) { sega_decode_317( machine, 0, 0, 1 ); } +void calorie_decode(running_machine *machine) { sega_decode_317( machine, 1, 0, 0 ); } +void gardia_decode(running_machine *machine) { sega_decode_317( machine, 1, 1, 1 ); } +void gardiab_decode(running_machine *machine) { sega_decode_317( machine, 0, 1, 2 ); } diff --git a/src/mame/machine/segacrpt.h b/src/mame/machine/segacrpt.h index 100be5af546..3662c68c468 100644 --- a/src/mame/machine/segacrpt.h +++ b/src/mame/machine/segacrpt.h @@ -1,35 +1,35 @@ -void buckrog_decode(void); -void pengo_decode(void); -void szaxxon_decode(void); -void suprloco_decode(void); -void yamato_decode(void); -void toprollr_decode(void); -void sindbadm_decode(void); -void regulus_decode(void); -void mrviking_decode(void); -void swat_decode(void); -void flicky_decode(void); -void futspy_decode(void); -void wmatch_decode(void); -void bullfgtj_decode(void); -void pbaction_decode(void); -void spatter_decode(void); -void jongkyo_decode(void); -void pitfall2_decode(void); -void nprinces_decode(void); -void seganinj_decode(void); -void imsorry_decode(void); -void teddybb_decode(void); -void myheroj_decode(void); -void hvymetal_decode(void); -void lvcards_decode(void); +void buckrog_decode(running_machine *machine); +void pengo_decode(running_machine *machine); +void szaxxon_decode(running_machine *machine); +void suprloco_decode(running_machine *machine); +void yamato_decode(running_machine *machine); +void toprollr_decode(running_machine *machine); +void sindbadm_decode(running_machine *machine); +void regulus_decode(running_machine *machine); +void mrviking_decode(running_machine *machine); +void swat_decode(running_machine *machine); +void flicky_decode(running_machine *machine); +void futspy_decode(running_machine *machine); +void wmatch_decode(running_machine *machine); +void bullfgtj_decode(running_machine *machine); +void pbaction_decode(running_machine *machine); +void spatter_decode(running_machine *machine); +void jongkyo_decode(running_machine *machine); +void pitfall2_decode(running_machine *machine); +void nprinces_decode(running_machine *machine); +void seganinj_decode(running_machine *machine); +void imsorry_decode(running_machine *machine); +void teddybb_decode(running_machine *machine); +void myheroj_decode(running_machine *machine); +void hvymetal_decode(running_machine *machine); +void lvcards_decode(running_machine *machine); -void fdwarrio_decode(void); -void astrofl_decode(void); -void wboy2_decode(void); -void robowres_decode(void); -void calorie_decode(void); -void spcpostn_decode(void); -void gardia_decode(void); -void gardiab_decode(void); +void fdwarrio_decode(running_machine *machine); +void astrofl_decode(running_machine *machine); +void wboy2_decode(running_machine *machine); +void robowres_decode(running_machine *machine); +void calorie_decode(running_machine *machine); +void spcpostn_decode(running_machine *machine); +void gardia_decode(running_machine *machine); +void gardiab_decode(running_machine *machine); diff --git a/src/mame/machine/segaic16.c b/src/mame/machine/segaic16.c index 6afa95ea83b..5d77651d1d0 100644 --- a/src/mame/machine/segaic16.c +++ b/src/mame/machine/segaic16.c @@ -160,10 +160,10 @@ void segaic16_memory_mapper_config(running_machine *machine, const UINT8 *map_da } -void segaic16_memory_mapper_set_decrypted(UINT8 *decrypted) +void segaic16_memory_mapper_set_decrypted(running_machine *machine, UINT8 *decrypted) { struct memory_mapper_chip *chip = &memory_mapper; - offs_t romsize = memory_region_length(REGION_CPU1 + chip->cpunum); + offs_t romsize = memory_region_length(machine, REGION_CPU1 + chip->cpunum); int rgnum; /* loop over the regions */ @@ -352,7 +352,7 @@ static void update_memory_mapping(running_machine *machine, struct memory_mapper /* ROM areas need extra clamping */ if (rgn->romoffset != ~0) { - offs_t romsize = memory_region_length(REGION_CPU1 + chip->cpunum); + offs_t romsize = memory_region_length(machine, REGION_CPU1 + chip->cpunum); if (region_start >= romsize) read = NULL; else if (region_start + rgn->length > romsize) @@ -381,7 +381,7 @@ static void update_memory_mapping(running_machine *machine, struct memory_mapper if (!decrypted) decrypted = fd1089_get_decrypted_base(); - memory_configure_bank(banknum, 0, 1, memory_region(REGION_CPU1 + chip->cpunum) + region_start, 0); + memory_configure_bank(banknum, 0, 1, memory_region(machine, REGION_CPU1 + chip->cpunum) + region_start, 0); if (decrypted) memory_configure_bank_decrypted(banknum, 0, 1, decrypted ? (decrypted + region_start) : 0, 0); memory_set_bank(banknum, 0); diff --git a/src/mame/machine/segaic16.h b/src/mame/machine/segaic16.h index 40e7abe073c..fa0f5a52628 100644 --- a/src/mame/machine/segaic16.h +++ b/src/mame/machine/segaic16.h @@ -24,7 +24,7 @@ struct segaic16_memory_map_entry void segaic16_memory_mapper_init(running_machine *machine, int cpunum, const struct segaic16_memory_map_entry *entrylist, void (*sound_w_callback)(UINT8), UINT8 (*sound_r_callback)(void)); void segaic16_memory_mapper_reset(running_machine *machine); void segaic16_memory_mapper_config(running_machine *machine, const UINT8 *map_data); -void segaic16_memory_mapper_set_decrypted(UINT8 *decrypted); +void segaic16_memory_mapper_set_decrypted(running_machine *machine, UINT8 *decrypted); READ8_HANDLER( segaic16_memory_mapper_r ); WRITE8_HANDLER( segaic16_memory_mapper_w ); READ16_HANDLER( segaic16_memory_mapper_lsb_r ); diff --git a/src/mame/machine/segas32.c b/src/mame/machine/segas32.c index 8a1bbc51fd3..9646d895969 100644 --- a/src/mame/machine/segas32.c +++ b/src/mame/machine/segas32.c @@ -33,10 +33,10 @@ static const UINT8 ga2_v25_opcode_table[256] = { #undef xxxx -static void nec_v25_cpu_decrypt(void) +static void nec_v25_cpu_decrypt(running_machine *machine) { int i; - UINT8 *rom = memory_region(REGION_CPU3); + UINT8 *rom = memory_region(machine, REGION_CPU3); UINT8* decrypted = auto_malloc(0x100000); UINT8* temp = malloc_or_die(0x100000); @@ -63,9 +63,9 @@ static void nec_v25_cpu_decrypt(void) free(temp); } -void decrypt_ga2_protrom(void) +void decrypt_ga2_protrom(running_machine *machine) { - nec_v25_cpu_decrypt(); + nec_v25_cpu_decrypt(machine); } @@ -133,7 +133,7 @@ WRITE16_HANDLER(sonic_level_load_protection) } else { - const UINT8 *ROM = memory_region(REGION_CPU1); + const UINT8 *ROM = memory_region(machine, REGION_CPU1); level = *((ROM + LEVEL_ORDER_ARRAY) + (system32_workram[CLEARED_LEVELS / 2] * 2) - 1); level |= *((ROM + LEVEL_ORDER_ARRAY) + (system32_workram[CLEARED_LEVELS / 2] * 2) - 2) << 8; } @@ -184,7 +184,7 @@ WRITE16_HANDLER(brival_protection_w) }; char ret[32]; int curProtType; - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(machine, REGION_CPU1); switch (offset) { diff --git a/src/mame/machine/simpsons.c b/src/mame/machine/simpsons.c index 7ec9ae5baed..6c200666b7d 100644 --- a/src/mame/machine/simpsons.c +++ b/src/mame/machine/simpsons.c @@ -121,7 +121,7 @@ static void simpsons_banking( int lines ) MACHINE_RESET( simpsons ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); cpunum_set_info_fct(0, CPUINFO_PTR_KONAMI_SETLINES_CALLBACK, (genf *)simpsons_banking); @@ -132,11 +132,11 @@ MACHINE_RESET( simpsons ) simpsons_firq_enabled = 0; /* init the default banks */ - memory_configure_bank(1, 0, 64, memory_region(REGION_CPU1) + 0x10000, 0x2000); + memory_configure_bank(1, 0, 64, memory_region(machine, REGION_CPU1) + 0x10000, 0x2000); memory_set_bank(1, 0); - memory_configure_bank(2, 0, 2, memory_region(REGION_CPU2) + 0x10000, 0); - memory_configure_bank(2, 2, 6, memory_region(REGION_CPU2) + 0x10000, 0x4000); + memory_configure_bank(2, 0, 2, memory_region(machine, REGION_CPU2) + 0x10000, 0); + memory_configure_bank(2, 2, 6, memory_region(machine, REGION_CPU2) + 0x10000, 0x4000); memory_set_bank(2, 0); simpsons_video_banking( machine, 0 ); diff --git a/src/mame/machine/slapfght.c b/src/mame/machine/slapfght.c index b1601538b75..9d5b0fba6f4 100644 --- a/src/mame/machine/slapfght.c +++ b/src/mame/machine/slapfght.c @@ -87,14 +87,14 @@ WRITE8_HANDLER( slapfight_port_07_w ) WRITE8_HANDLER( slapfight_port_08_w ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); memory_set_bankptr(1,&RAM[0x10000]); } WRITE8_HANDLER( slapfight_port_09_w ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); memory_set_bankptr(1,&RAM[0x14000]); } diff --git a/src/mame/machine/snes.c b/src/mame/machine/snes.c index be5fcd5767d..6b7a62ac990 100644 --- a/src/mame/machine/snes.c +++ b/src/mame/machine/snes.c @@ -275,7 +275,7 @@ static void snes_init_ram(running_machine *machine) int i; /* Init DSP1 */ - DSP1_reset(); + DSP1_reset(machine); /* Init VRAM */ memset( snes_vram, 0, SNES_VRAM_SIZE ); @@ -1530,7 +1530,7 @@ DRIVER_INIT( snes ) UINT16 totalblocks, readblocks; UINT8 *rom; - rom = memory_region( REGION_USER3 ); + rom = memory_region( machine, REGION_USER3 ); snes_ram = auto_malloc(0x1000000); memset( snes_ram, 0, 0x1000000 ); @@ -1540,7 +1540,7 @@ DRIVER_INIT( snes ) /* Find the number of blocks in this ROM */ //totalblocks = ((mame_fsize(file) - offset) >> (snes_cart.mode == MODE_20 ? 15 : 16)); - totalblocks = (memory_region_length(REGION_USER3) / 0x8000) - 1; + totalblocks = (memory_region_length(machine, REGION_USER3) / 0x8000) - 1; /* FIXME: Insert crc check here */ @@ -1581,7 +1581,7 @@ DRIVER_INIT( snes_hirom ) UINT16 totalblocks, readblocks; UINT8 *rom; - rom = memory_region( REGION_USER3 ); + rom = memory_region( machine, REGION_USER3 ); snes_ram = auto_malloc(0x1000000); memset( snes_ram, 0, 0x1000000 ); @@ -1590,7 +1590,7 @@ DRIVER_INIT( snes_hirom ) /* Find the number of blocks in this ROM */ //totalblocks = ((mame_fsize(file) - offset) >> (snes_cart.mode == MODE_20 ? 15 : 16)); - totalblocks = (memory_region_length(REGION_USER3) / 0x10000) - 1; + totalblocks = (memory_region_length(machine, REGION_USER3) / 0x10000) - 1; /* FIXME: Insert crc check here */ diff --git a/src/mame/machine/snesdsp1.c b/src/mame/machine/snesdsp1.c index 656e2e8c358..2d41426fb53 100644 --- a/src/mame/machine/snesdsp1.c +++ b/src/mame/machine/snesdsp1.c @@ -153,10 +153,10 @@ void DSP1_setDr(UINT8 iDr) ////////////////////////////////////////////////////////////////// -void DSP1_reset(void) +void DSP1_reset(running_machine *machine) { UINT32 i; - UINT8 *dspin = memory_region(REGION_USER6); + UINT8 *dspin = memory_region(machine, REGION_USER6); mSr = DRC|RQM; mSrLowByteAccess = FALSE; diff --git a/src/mame/machine/starwars.c b/src/mame/machine/starwars.c index 876676f2cc1..9c5c1b81333 100644 --- a/src/mame/machine/starwars.c +++ b/src/mame/machine/starwars.c @@ -182,9 +182,9 @@ WRITE8_HANDLER( starwars_adc_select_w ) * *************************************/ -void starwars_mproc_init(void) +void starwars_mproc_init(running_machine *machine) { - UINT8 *src = memory_region(REGION_USER2); + UINT8 *src = memory_region(machine, REGION_USER2); int cnt, val; PROM_STR = auto_malloc(1024 * sizeof(PROM_STR[0])); diff --git a/src/mame/machine/stfight.c b/src/mame/machine/stfight.c index fd05a896089..e33f2733502 100644 --- a/src/mame/machine/stfight.c +++ b/src/mame/machine/stfight.c @@ -39,7 +39,7 @@ static UINT8 *decrypt; DRIVER_INIT( empcity ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); int A; decrypt = auto_malloc(0x8000); @@ -90,7 +90,7 @@ MACHINE_RESET( stfight ) // - in fact I don't even know how/where it's switched in! static WRITE8_HANDLER( stfight_bank_w ) { - UINT8 *ROM2 = memory_region(REGION_CPU1) + 0x10000; + UINT8 *ROM2 = memory_region(machine, REGION_CPU1) + 0x10000; memory_set_bankptr( 1, &ROM2[data<<14] ); } @@ -186,7 +186,7 @@ static int adpcm_data_end; void stfight_adpcm_int( running_machine *machine, int data ) { static int toggle; - UINT8 *SAMPLES = memory_region(REGION_SOUND1); + UINT8 *SAMPLES = memory_region(machine, REGION_SOUND1); int adpcm_data = SAMPLES[adpcm_data_offs & 0x7fff]; // finished playing sample? diff --git a/src/mame/machine/stvprot.c b/src/mame/machine/stvprot.c index 922b258a1ee..94565500718 100644 --- a/src/mame/machine/stvprot.c +++ b/src/mame/machine/stvprot.c @@ -120,7 +120,7 @@ static const UINT32 vector_prot[] = { 0x0603B1B2,0x234 }; static READ32_HANDLER( a_bus_ctrl_r ) { - UINT32 *ROM = (UINT32 *)memory_region(REGION_USER1); + UINT32 *ROM = (UINT32 *)memory_region(machine, REGION_USER1); if(a_bus[0] & 0x00010000)//protection calculation is activated { @@ -294,11 +294,11 @@ static READ32_HANDLER(astrass_prot_r) if ( offset == 3 && ctrl_index != -1 ) { UINT32 data = 0; - UINT32 *prot_data = (UINT32 *)memory_region(REGION_USER2); + UINT32 *prot_data = (UINT32 *)memory_region(machine, REGION_USER2); data = prot_data[ctrl_index++]; - if ( ctrl_index >= memory_region_length(REGION_USER2)/4 ) + if ( ctrl_index >= memory_region_length(machine, REGION_USER2)/4 ) { ctrl_index = -1; } @@ -335,7 +335,7 @@ static UINT16 decathlt_prottable2[128]; static READ32_HANDLER( decathlt_prot_r ) { - UINT32 *ROM = (UINT32 *)memory_region(REGION_USER1); + UINT32 *ROM = (UINT32 *)memory_region(machine, REGION_USER1); if (offset==2) { diff --git a/src/mame/machine/system16.c b/src/mame/machine/system16.c index f3ea5f3b31e..7c2906468cf 100644 --- a/src/mame/machine/system16.c +++ b/src/mame/machine/system16.c @@ -11,7 +11,7 @@ UINT16 *sys16_extraram3; static void patch_codeX( int offset, int data, int cpu ){ int aligned_offset = offset&0xfffffe; - UINT16 *mem = (UINT16 *)memory_region(REGION_CPU1+cpu); + UINT16 *mem = (UINT16 *)memory_region(Machine, REGION_CPU1+cpu); int old_word = mem[aligned_offset/2]; if( offset&1 ) diff --git a/src/mame/machine/taitosj.c b/src/mame/machine/taitosj.c index 8c3fed1381c..638df9d500b 100644 --- a/src/mame/machine/taitosj.c +++ b/src/mame/machine/taitosj.c @@ -28,8 +28,8 @@ void taitosj_register_main_savestate(void); MACHINE_START( taitosj ) { - memory_configure_bank(1, 0, 1, memory_region(REGION_CPU1) + 0x6000, 0); - memory_configure_bank(1, 1, 1, memory_region(REGION_CPU1) + 0x10000, 0); + memory_configure_bank(1, 0, 1, memory_region(machine, REGION_CPU1) + 0x6000, 0); + memory_configure_bank(1, 1, 1, memory_region(machine, REGION_CPU1) + 0x10000, 0); taitosj_register_main_savestate(); diff --git a/src/mame/machine/tatsumi.c b/src/mame/machine/tatsumi.c index 9a5ed97239b..50a95b0c740 100644 --- a/src/mame/machine/tatsumi.c +++ b/src/mame/machine/tatsumi.c @@ -305,7 +305,7 @@ WRITE16_HANDLER(cyclwarr_control_w) READ16_HANDLER( tatsumi_v30_68000_r ) { - const UINT16* rom=(UINT16*)memory_region(REGION_CPU2); + const UINT16* rom=(UINT16*)memory_region(machine, REGION_CPU2); logerror("%05X:68000_r(%04X),cw=%04X\n", activecpu_get_pc(), offset*2, tatsumi_control_word); /* Read from 68k RAM */ @@ -314,7 +314,7 @@ logerror("%05X:68000_r(%04X),cw=%04X\n", activecpu_get_pc(), offset*2, tatsumi_c // hack to make roundup 5 boot if (activecpu_get_pc()==0xec575) { - UINT8 *dst = memory_region(REGION_CPU1); + UINT8 *dst = memory_region(machine, REGION_CPU1); dst[BYTE_XOR_LE(0xec57a)]=0x46; dst[BYTE_XOR_LE(0xec57b)]=0x46; diff --git a/src/mame/machine/theglobp.c b/src/mame/machine/theglobp.c index 429df9c5f66..8e4fe55613f 100644 --- a/src/mame/machine/theglobp.c +++ b/src/mame/machine/theglobp.c @@ -67,13 +67,13 @@ static INT8 counter=0; -static void theglobp_decrypt_rom_8(void) +static void theglobp_decrypt_rom_8(running_machine *machine) { int oldbyte,inverted_oldbyte,newbyte; int mem; UINT8 *RAM; - RAM = memory_region(REGION_CPU1); + RAM = memory_region(machine, REGION_CPU1); for (mem=0;mem<0x4000;mem++) @@ -104,13 +104,13 @@ static void theglobp_decrypt_rom_8(void) } -static void theglobp_decrypt_rom_9(void) +static void theglobp_decrypt_rom_9(running_machine *machine) { int oldbyte,inverted_oldbyte,newbyte; int mem; UINT8 *RAM; - RAM = memory_region(REGION_CPU1); + RAM = memory_region(machine, REGION_CPU1); for (mem=0;mem<0x4000;mem++) { @@ -139,13 +139,13 @@ static void theglobp_decrypt_rom_9(void) return; } -static void theglobp_decrypt_rom_A(void) +static void theglobp_decrypt_rom_A(running_machine *machine) { int oldbyte,inverted_oldbyte,newbyte; int mem; UINT8 *RAM; - RAM = memory_region(REGION_CPU1); + RAM = memory_region(machine, REGION_CPU1); for (mem=0;mem<0x4000;mem++) { @@ -174,13 +174,13 @@ static void theglobp_decrypt_rom_A(void) return; } -static void theglobp_decrypt_rom_B(void) +static void theglobp_decrypt_rom_B(running_machine *machine) { int oldbyte,inverted_oldbyte,newbyte; int mem; UINT8 *RAM; - RAM = memory_region(REGION_CPU1); + RAM = memory_region(machine, REGION_CPU1); for (mem=0;mem<0x4000;mem++) { @@ -240,15 +240,15 @@ READ8_HANDLER( theglobp_decrypt_rom ) MACHINE_RESET( theglobp ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); /* While the PAL supports up to 16 decryption methods, only four are actually used in the PAL. Therefore, we'll take a little memory overhead and decrypt the ROMs using each method in advance. */ - theglobp_decrypt_rom_8(); - theglobp_decrypt_rom_9(); - theglobp_decrypt_rom_A(); - theglobp_decrypt_rom_B(); + theglobp_decrypt_rom_8(machine); + theglobp_decrypt_rom_9(machine); + theglobp_decrypt_rom_A(machine); + theglobp_decrypt_rom_B(machine); /* The initial state of the counter is 0x0A */ counter = 0x0A; diff --git a/src/mame/machine/tnzs.c b/src/mame/machine/tnzs.c index e42905ad42c..1ab5955ce48 100644 --- a/src/mame/machine/tnzs.c +++ b/src/mame/machine/tnzs.c @@ -520,7 +520,7 @@ DRIVER_INIT( plumpop ) DRIVER_INIT( extrmatn ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); mcu_type = MCU_EXTRMATN; @@ -531,7 +531,7 @@ DRIVER_INIT( extrmatn ) DRIVER_INIT( arknoid2 ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); mcu_type = MCU_ARKANOID; @@ -542,7 +542,7 @@ DRIVER_INIT( arknoid2 ) DRIVER_INIT( drtoppel ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); mcu_type = MCU_DRTOPPEL; @@ -561,7 +561,7 @@ DRIVER_INIT( chukatai ) DRIVER_INIT( tnzs ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); mcu_type = MCU_TNZS; /* there's code which falls through from the fixed ROM to bank #7, I have to */ @@ -574,7 +574,7 @@ DRIVER_INIT( tnzs ) DRIVER_INIT( tnzsb ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); mcu_type = MCU_NONE_TNZSB; /* there's code which falls through from the fixed ROM to bank #7, I have to */ @@ -692,10 +692,10 @@ MACHINE_RESET( tnzs ) { UINT8 *RAM; - RAM = memory_region(REGION_CPU1); + RAM = memory_region(machine, REGION_CPU1); memory_set_bankptr(1,&RAM[0x18000]); - RAM = memory_region(REGION_CPU2); + RAM = memory_region(machine, REGION_CPU2); memory_set_bankptr(2,&RAM[0x10000]); } } @@ -715,7 +715,7 @@ WRITE8_HANDLER( tnzs_sharedram_w ) WRITE8_HANDLER( tnzs_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); // logerror("PC %04x: writing %02x to bankswitch\n", activecpu_get_pc(),data); @@ -731,7 +731,7 @@ WRITE8_HANDLER( tnzs_bankswitch_w ) WRITE8_HANDLER( tnzs_bankswitch1_w ) { - UINT8 *RAM = memory_region(REGION_CPU2); + UINT8 *RAM = memory_region(machine, REGION_CPU2); // logerror("PC %04x: writing %02x to bankswitch 1\n", activecpu_get_pc(),data); diff --git a/src/mame/machine/tx1.c b/src/mame/machine/tx1.c index 1a9e49261ae..be701976c79 100644 --- a/src/mame/machine/tx1.c +++ b/src/mame/machine/tx1.c @@ -472,7 +472,7 @@ INLINE UINT16 get_tx1_datarom_addr(void) return addr & 0x3fff; } -static void tx1_update_state(void) +static void tx1_update_state(running_machine *machine) { #define LHIEN(a) !(a & 0x80) #define LLOEN(a) !(a & 0x40) @@ -538,7 +538,7 @@ static void tx1_update_state(void) data = math.muxlatch; else if ( dsel == 1 ) { - UINT16 *romdata = (UINT16*)memory_region(REGION_USER1); + UINT16 *romdata = (UINT16*)memory_region(machine, REGION_USER1); UINT16 addr = get_tx1_datarom_addr(); data = romdata[addr]; } @@ -714,7 +714,7 @@ READ16_HANDLER( tx1_math_r ) TODO make this constant somewhere e.g. math.retval = math.romptr[ get_tx1_datarom_addr() ]; */ - UINT16 *romdata = (UINT16*)memory_region(REGION_USER1); + UINT16 *romdata = (UINT16*)memory_region(machine, REGION_USER1); UINT16 addr = get_tx1_datarom_addr(); math.retval = romdata[addr]; } @@ -741,7 +741,7 @@ READ16_HANDLER( tx1_math_r ) if ( math.mux != TX1_SEL_ILDEN ) { INC_PROM_ADDR; - tx1_update_state(); + tx1_update_state(machine); // MUST RETURN HERE? return math.retval; @@ -760,12 +760,12 @@ READ16_HANDLER( tx1_math_r ) if ( offset & TX1_INSLD ) { math.promaddr = (offset << 2) & 0x1ff; - tx1_update_state(); + tx1_update_state(machine); } else if ( offset & TX1_CNTST ) { INC_PROM_ADDR; - tx1_update_state(); + tx1_update_state(machine); } return math.retval; @@ -849,18 +849,18 @@ WRITE16_HANDLER( tx1_math_w ) if ( offset & TX1_INSLD ) { math.promaddr = (offset << 2) & 0x1ff; - tx1_update_state(); + tx1_update_state(machine); } else if ( offset & TX1_CNTST ) { INC_PROM_ADDR; - tx1_update_state(); + tx1_update_state(machine); } } READ16_HANDLER( tx1_spcs_rom_r ) { - math.cpulatch = *(UINT16*)((UINT8*)memory_region(REGION_CPU2) + 0xfc000 + 0x1000 + offset*2); + math.cpulatch = *(UINT16*)((UINT8*)memory_region(machine, REGION_CPU2) + 0xfc000 + 0x1000 + offset*2); if ( math.mux == TX1_SEL_ILDEN ) { @@ -913,7 +913,7 @@ READ16_HANDLER( tx1_spcs_rom_r ) if ( math.mux != TX1_SEL_ILDEN ) { INC_PROM_ADDR; - tx1_update_state(); + tx1_update_state(machine); } return math.cpulatch; @@ -975,7 +975,7 @@ READ16_HANDLER( tx1_spcs_ram_r ) if ( math.mux != TX1_SEL_ILDEN ) { INC_PROM_ADDR; - tx1_update_state(); + tx1_update_state(machine); } return math.cpulatch; @@ -1031,7 +1031,7 @@ INLINE UINT16 get_bb_datarom_addr(void) return addr & 0x3fff; } -static void buggyboy_update_state(void) +static void buggyboy_update_state(running_machine *machine) { #define LHIEN(a) !(a & 0x80) #define LLOEN(a) !(a & 0x40) @@ -1068,7 +1068,7 @@ static void buggyboy_update_state(void) if ( math.mux == BB_MUX_DPROE ) { - UINT16 *romdata = (UINT16*)memory_region(REGION_USER1); + UINT16 *romdata = (UINT16*)memory_region(machine, REGION_USER1); UINT16 addr = get_bb_datarom_addr(); kick_sn74s516(&romdata[addr], ins); } @@ -1183,7 +1183,7 @@ READ16_HANDLER( buggyboy_math_r ) /* /DPROE */ else if ( (offset & 0xc00) == 0xc00 ) { - UINT16 *romdata = (UINT16*)memory_region(REGION_USER1); + UINT16 *romdata = (UINT16*)memory_region(machine, REGION_USER1); UINT16 addr = get_bb_datarom_addr(); math.retval = romdata[addr]; @@ -1198,7 +1198,7 @@ READ16_HANDLER( buggyboy_math_r ) if ( math.mux != BB_MUX_ILDEN ) { INC_PROM_ADDR; - buggyboy_update_state(); + buggyboy_update_state(machine); } } } @@ -1214,12 +1214,12 @@ READ16_HANDLER( buggyboy_math_r ) if ( offset & BB_INSLD ) { math.promaddr = (offset << 2) & 0x1ff; - buggyboy_update_state(); + buggyboy_update_state(machine); } else if ( offset & BB_CNTST ) { INC_PROM_ADDR; - buggyboy_update_state(); + buggyboy_update_state(machine); } return math.retval; @@ -1300,12 +1300,12 @@ WRITE16_HANDLER( buggyboy_math_w ) if ( offset & BB_INSLD ) { math.promaddr = (offset << 2) & 0x1ff; - buggyboy_update_state(); + buggyboy_update_state(machine); } else if ( offset & BB_CNTST ) { INC_PROM_ADDR; - buggyboy_update_state(); + buggyboy_update_state(machine); } } @@ -1314,7 +1314,7 @@ WRITE16_HANDLER( buggyboy_math_w ) */ READ16_HANDLER( buggyboy_spcs_rom_r ) { - math.cpulatch = *(UINT16*)((UINT8*)memory_region(REGION_CPU2) + 0xfc000 + 0x1000 + offset*2); + math.cpulatch = *(UINT16*)((UINT8*)memory_region(machine, REGION_CPU2) + 0xfc000 + 0x1000 + offset*2); if ( math.mux == BB_MUX_ILDEN ) { @@ -1367,7 +1367,7 @@ READ16_HANDLER( buggyboy_spcs_rom_r ) if ( math.mux != BB_MUX_ILDEN ) { INC_PROM_ADDR; - buggyboy_update_state(); + buggyboy_update_state(machine); } return math.cpulatch; @@ -1435,7 +1435,7 @@ READ16_HANDLER( buggyboy_spcs_ram_r ) if ( math.mux != BB_MUX_ILDEN ) { INC_PROM_ADDR; - buggyboy_update_state(); + buggyboy_update_state(machine); } return math.cpulatch; @@ -1473,7 +1473,7 @@ MACHINE_RESET( tx1 ) MACHINE_START( tx1 ) { /* Initialise for each game */ - prom = (UINT16*)memory_region(REGION_USER1) + (0x8000 >> 1); + prom = (UINT16*)memory_region(machine, REGION_USER1) + (0x8000 >> 1); /* set a timer to run the interrupts */ interrupt_timer = timer_alloc(interrupt_callback, NULL); @@ -1485,7 +1485,7 @@ MACHINE_START( tx1 ) MACHINE_START( buggyboy ) { /* Initialise for each game */ - prom = (UINT16*)memory_region(REGION_USER1) + (0x8000 >> 1); + prom = (UINT16*)memory_region(machine, REGION_USER1) + (0x8000 >> 1); /* set a timer to run the interrupts */ interrupt_timer = timer_alloc(interrupt_callback, NULL); @@ -1497,7 +1497,7 @@ MACHINE_START( buggyboy ) MACHINE_START( buggybjr ) { /* Initialise for each game */ - prom = (UINT16*)memory_region(REGION_USER1) + (0x8000 >> 1); + prom = (UINT16*)memory_region(machine, REGION_USER1) + (0x8000 >> 1); /* set a timer to run the interrupts */ interrupt_timer = timer_alloc(interrupt_callback, NULL); diff --git a/src/mame/machine/vertigo.c b/src/mame/machine/vertigo.c index 64c519f8a6f..999792172ca 100644 --- a/src/mame/machine/vertigo.c +++ b/src/mame/machine/vertigo.c @@ -220,7 +220,7 @@ MACHINE_RESET( vertigo ) TTL74148_input_line_w(0, i, 1); TTL74148_update(0); - vertigo_vproc_init(); + vertigo_vproc_init(machine); irq4_time = timer_get_time(); irq_state = 7; diff --git a/src/mame/machine/vsnes.c b/src/mame/machine/vsnes.c index de35bbf3cb4..5252a8b8b7a 100644 --- a/src/mame/machine/vsnes.c +++ b/src/mame/machine/vsnes.c @@ -409,7 +409,7 @@ static WRITE8_HANDLER( goonies_rom_banking ) case 2: /* code bank 1 */ case 4: /* code bank 2 */ { - UINT8 *prg = memory_region( REGION_CPU1 ); + UINT8 *prg = memory_region( machine, REGION_CPU1 ); memcpy( &prg[0x08000 + reg*0x1000], &prg[bankoffset], 0x2000 ); } break; @@ -428,7 +428,7 @@ DRIVER_INIT( goonies ) { /* We do manual banking, in case the code falls through */ /* Copy the initial banks */ - UINT8 *prg = memory_region( REGION_CPU1 ); + UINT8 *prg = memory_region( machine, REGION_CPU1 ); memcpy( &prg[0x08000], &prg[0x18000], 0x8000 ); /* banking is done with writes to the $8000-$ffff area */ @@ -445,7 +445,7 @@ DRIVER_INIT( vsgradus ) { /* We do manual banking, in case the code falls through */ /* Copy the initial banks */ - UINT8 *prg = memory_region( REGION_CPU1 ); + UINT8 *prg = memory_region( machine, REGION_CPU1 ); memcpy( &prg[0x08000], &prg[0x18000], 0x8000 ); /* banking is done with writes to the $8000-$ffff area */ @@ -504,7 +504,7 @@ static WRITE8_HANDLER( vsgshoe_gun_in0_w ) int addr; if((data & 0x04) != old_bank) { - UINT8 *prg = memory_region( REGION_CPU1 ); + UINT8 *prg = memory_region( machine, REGION_CPU1 ); old_bank = data & 0x04; addr = old_bank ? 0x12000: 0x10000; memcpy (&prg[0x08000], &prg[addr], 0x2000); @@ -516,7 +516,7 @@ static WRITE8_HANDLER( vsgshoe_gun_in0_w ) DRIVER_INIT( vsgshoe ) { /* set up the default bank */ - UINT8 *prg = memory_region( REGION_CPU1 ); + UINT8 *prg = memory_region( machine, REGION_CPU1 ); memcpy (&prg[0x08000], &prg[0x12000], 0x2000); /* Protection */ @@ -622,7 +622,7 @@ static WRITE8_HANDLER( drmario_rom_banking ) case 3: /* program banking */ { int bank = ( drmario_shiftreg & 0x03 ) * 0x4000; - UINT8 *prg = memory_region( REGION_CPU1 ); + UINT8 *prg = memory_region( machine, REGION_CPU1 ); if ( !size16k ) { @@ -655,7 +655,7 @@ DRIVER_INIT( drmario ) { /* We do manual banking, in case the code falls through */ /* Copy the initial banks */ - UINT8 *prg = memory_region( REGION_CPU1 ); + UINT8 *prg = memory_region( machine, REGION_CPU1 ); memcpy( &prg[0x08000], &prg[0x10000], 0x4000 ); memcpy( &prg[0x0c000], &prg[0x1c000], 0x4000 ); @@ -745,7 +745,7 @@ DRIVER_INIT( vsslalom ) static WRITE8_HANDLER( castlevania_rom_banking ) { int rombank = 0x10000 + ( data & 7 ) * 0x4000; - UINT8 *prg = memory_region( REGION_CPU1 ); + UINT8 *prg = memory_region( machine, REGION_CPU1 ); memcpy( &prg[0x08000], &prg[rombank], 0x4000 ); } @@ -753,7 +753,7 @@ static WRITE8_HANDLER( castlevania_rom_banking ) DRIVER_INIT( cstlevna ) { /* when starting the game, the 1st 16k and the last 16k are loaded into the 2 banks */ - UINT8 *prg = memory_region( REGION_CPU1 ); + UINT8 *prg = memory_region( machine, REGION_CPU1 ); memcpy( &prg[0x08000], &prg[0x28000], 0x8000 ); /* banking is done with writes to the $8000-$ffff area */ @@ -781,7 +781,7 @@ static READ8_HANDLER( topgun_security_r ) DRIVER_INIT( topgun ) { /* when starting the game, the 1st 16k and the last 16k are loaded into the 2 banks */ - UINT8 *prg = memory_region( REGION_CPU1 ); + UINT8 *prg = memory_region( machine, REGION_CPU1 ); memcpy( &prg[0x08000], &prg[0x28000], 0x8000 ); /* banking is done with writes to the $8000-$ffff area */ @@ -804,7 +804,7 @@ static int IRQ_enable, IRQ_count, IRQ_count_latch; static void mapper4_set_prg (void) { - UINT8 *prg = memory_region( REGION_CPU1 ); + UINT8 *prg = memory_region( Machine, REGION_CPU1 ); MMC3_prg0 &= MMC3_prg_mask; MMC3_prg1 &= MMC3_prg_mask; @@ -953,13 +953,13 @@ static WRITE8_HANDLER( mapper4_w ) DRIVER_INIT( MMC3 ) { - UINT8 *prg = memory_region( REGION_CPU1 ); + UINT8 *prg = memory_region( machine, REGION_CPU1 ); IRQ_enable = IRQ_count = IRQ_count_latch = 0; MMC3_prg0 = 0xfe; MMC3_prg1 = 0xff; MMC3_cmd = 0; - MMC3_prg_chunks = (memory_region_length(REGION_CPU1) - 0x10000) / 0x4000; + MMC3_prg_chunks = (memory_region_length(machine, REGION_CPU1) - 0x10000) / 0x4000; MMC3_prg_mask = ((MMC3_prg_chunks << 1) - 1); @@ -1150,7 +1150,7 @@ static WRITE8_HANDLER( mapper68_rom_banking ){ case 0x7000: { - UINT8 *prg = memory_region( REGION_CPU1 ); + UINT8 *prg = memory_region( machine, REGION_CPU1 ); memcpy( &prg[0x08000], &prg[0x10000 +data*0x4000], 0x4000 ); } break; @@ -1165,7 +1165,7 @@ DRIVER_INIT( platoon ) /* when starting a mapper 68 game the first 16K ROM bank in the cart is loaded into $8000 the LAST 16K ROM bank is loaded into $C000. The last 16K of ROM cannot be swapped. */ - UINT8 *prg = memory_region( REGION_CPU1 ); + UINT8 *prg = memory_region( machine, REGION_CPU1 ); memcpy( &prg[0x08000], &prg[0x10000], 0x4000 ); memcpy( &prg[0x0c000], &prg[0x2c000], 0x4000 ); @@ -1281,7 +1281,7 @@ static WRITE8_HANDLER( vstennis_vrom_banking ) DRIVER_INIT( vstennis ) { - UINT8 *prg = memory_region( REGION_CPU1 ); + UINT8 *prg = memory_region( machine, REGION_CPU1 ); /* vrom switching is enabled with bit 2 of $4016 */ memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4016, 0x4016, 0, 0, vstennis_vrom_banking ); diff --git a/src/mame/machine/williams.c b/src/mame/machine/williams.c index d96b8e9fdc8..e8b4b384c3f 100644 --- a/src/mame/machine/williams.c +++ b/src/mame/machine/williams.c @@ -371,7 +371,7 @@ MACHINE_RESET( williams ) /* configure the memory bank */ memory_configure_bank(1, 0, 1, williams_videoram, 0); - memory_configure_bank(1, 1, 1, memory_region(REGION_CPU1) + 0x10000, 0); + memory_configure_bank(1, 1, 1, memory_region(machine, REGION_CPU1) + 0x10000, 0); } @@ -437,7 +437,7 @@ MACHINE_RESET( williams2 ) /* configure memory banks */ memory_configure_bank(1, 0, 1, williams_videoram, 0); - memory_configure_bank(1, 1, 4, memory_region(REGION_CPU1) + 0x10000, 0x10000); + memory_configure_bank(1, 1, 4, memory_region(machine, REGION_CPU1) + 0x10000, 0x10000); /* make sure our banking is reset */ williams2_bank_select_w(machine, 0, 0); @@ -709,7 +709,7 @@ MACHINE_RESET( defender ) MACHINE_RESET_CALL(williams_common); /* configure the banking and make sure it is reset to 0 */ - memory_configure_bank(1, 0, 9, &memory_region(REGION_CPU1)[0x10000], 0x1000); + memory_configure_bank(1, 0, 9, &memory_region(machine, REGION_CPU1)[0x10000], 0x1000); defender_bank_select_w(machine, 0, 0); state_save_register_postload(machine, defender_postload, NULL); @@ -804,10 +804,10 @@ MACHINE_RESET( blaster ) /* banking is different for blaster */ memory_configure_bank(1, 0, 1, williams_videoram, 0); - memory_configure_bank(1, 1, 16, memory_region(REGION_CPU1) + 0x18000, 0x4000); + memory_configure_bank(1, 1, 16, memory_region(machine, REGION_CPU1) + 0x18000, 0x4000); memory_configure_bank(2, 0, 1, williams_videoram + 0x4000, 0); - memory_configure_bank(2, 1, 16, memory_region(REGION_CPU1) + 0x10000, 0x0000); + memory_configure_bank(2, 1, 16, memory_region(machine, REGION_CPU1) + 0x10000, 0x0000); state_save_register_global(blaster_bank); } diff --git a/src/mame/machine/wrally.c b/src/mame/machine/wrally.c index 937ba096850..9de5697bdac 100644 --- a/src/mame/machine/wrally.c +++ b/src/mame/machine/wrally.c @@ -33,7 +33,7 @@ WRITE16_HANDLER( wrally_flipscreen_w ) WRITE16_HANDLER( OKIM6295_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_SOUND1); + UINT8 *RAM = memory_region(machine, REGION_SOUND1); if (ACCESSING_BITS_0_7){ memcpy(&RAM[0x30000], &RAM[0x40000 + (data & 0x0f)*0x10000], 0x10000); diff --git a/src/mame/video/1943.c b/src/mame/video/1943.c index dc4dfc74494..2c1b43ba009 100644 --- a/src/mame/video/1943.c +++ b/src/mame/video/1943.c @@ -111,7 +111,7 @@ WRITE8_HANDLER( c1943_colorram_w ) WRITE8_HANDLER( c1943_c804_w ) { int bankaddress; - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); /* bits 0 and 1 are coin counters */ coin_counter_w(0, data & 0x01); @@ -144,7 +144,7 @@ WRITE8_HANDLER( c1943_d806_w ) static TILE_GET_INFO( c1943_get_bg2_tile_info ) { - UINT8 *tilerom = memory_region(REGION_GFX5) + 0x8000; + UINT8 *tilerom = memory_region(machine, REGION_GFX5) + 0x8000; int offs = tile_index * 2; int attr = tilerom[offs + 1]; @@ -157,7 +157,7 @@ static TILE_GET_INFO( c1943_get_bg2_tile_info ) static TILE_GET_INFO( c1943_get_bg_tile_info ) { - UINT8 *tilerom = memory_region(REGION_GFX5); + UINT8 *tilerom = memory_region(machine, REGION_GFX5); int offs = tile_index * 2; int attr = tilerom[offs + 1]; diff --git a/src/mame/video/20pacgal.c b/src/mame/video/20pacgal.c index e6d60d06809..3b228b4eb8a 100644 --- a/src/mame/video/20pacgal.c +++ b/src/mame/video/20pacgal.c @@ -22,10 +22,10 @@ * *************************************/ -static void get_pens(const _20pacgal_state *state, pen_t *pens) +static void get_pens(running_machine *machine, const _20pacgal_state *state, pen_t *pens) { offs_t offs; - UINT8 *color_prom = memory_region(REGION_PROMS) + (NUM_PENS * state->game_selected); + UINT8 *color_prom = memory_region(machine, REGION_PROMS) + (NUM_PENS * state->game_selected); for (offs = 0; offs < NUM_PENS ;offs++) { @@ -56,12 +56,12 @@ static void get_pens(const _20pacgal_state *state, pen_t *pens) } - static void do_pen_lookup(const _20pacgal_state *state, bitmap_t *bitmap, const rectangle *cliprect) +static void do_pen_lookup(running_machine *machine, const _20pacgal_state *state, bitmap_t *bitmap, const rectangle *cliprect) { int y, x; pen_t pens[NUM_PENS]; - get_pens(state, pens); + get_pens(machine, state, pens); for (y = cliprect->min_y; y <= cliprect->max_y; y++) for(x = cliprect->min_x; x <= cliprect->max_x; x++) @@ -296,7 +296,7 @@ static VIDEO_UPDATE( 20pacgal ) draw_chars(state, bitmap); draw_sprites(state, bitmap); - do_pen_lookup(state, bitmap, cliprect); + do_pen_lookup(screen->machine, state, bitmap, cliprect); return 0; } diff --git a/src/mame/video/8080bw.c b/src/mame/video/8080bw.c index 016944d4517..fea3a03cdab 100644 --- a/src/mame/video/8080bw.c +++ b/src/mame/video/8080bw.c @@ -135,7 +135,7 @@ VIDEO_UPDATE( invadpt2 ) invadpt2_get_pens(pens); - prom = memory_region(REGION_PROMS); + prom = memory_region(screen->machine, REGION_PROMS); color_map_base = color_map ? &prom[0x0400] : &prom[0x0000]; for (offs = 0; offs < mw8080bw_ram_size; offs++) @@ -166,7 +166,7 @@ VIDEO_UPDATE( ballbomb ) invadpt2_get_pens(pens); - prom = memory_region(REGION_PROMS); + prom = memory_region(screen->machine, REGION_PROMS); color_map_base = color_map ? &prom[0x0400] : &prom[0x0000]; for (offs = 0; offs < mw8080bw_ram_size; offs++) @@ -197,7 +197,7 @@ VIDEO_UPDATE( schaser ) invadpt2_get_pens(pens); - background_map_base = memory_region(REGION_PROMS); + background_map_base = memory_region(screen->machine, REGION_PROMS); for (offs = 0; offs < mw8080bw_ram_size; offs++) { @@ -287,8 +287,8 @@ VIDEO_UPDATE( polaris ) invadpt2_get_pens(pens); - color_map_base = memory_region(REGION_PROMS); - cloud_gfx = memory_region(REGION_USER1); + color_map_base = memory_region(screen->machine, REGION_PROMS); + cloud_gfx = memory_region(screen->machine, REGION_USER1); for (offs = 0; offs < mw8080bw_ram_size; offs++) { @@ -408,7 +408,7 @@ VIDEO_UPDATE( indianbt ) cosmo_get_pens(pens); - prom = memory_region(REGION_PROMS); + prom = memory_region(screen->machine, REGION_PROMS); color_map_base = color_map ? &prom[0x0400] : &prom[0x0000]; for (offs = 0; offs < mw8080bw_ram_size; offs++) diff --git a/src/mame/video/aeroboto.c b/src/mame/video/aeroboto.c index 68aa27f7db4..2d9b4164ee1 100644 --- a/src/mame/video/aeroboto.c +++ b/src/mame/video/aeroboto.c @@ -53,8 +53,8 @@ VIDEO_START( aeroboto ) UINT8 *rom, *temp; int i, length; - rom = memory_region(REGION_GFX2); - length = memory_region_length(REGION_GFX2); + rom = memory_region(machine, REGION_GFX2); + length = memory_region_length(machine, REGION_GFX2); temp = malloc_or_die(length); memcpy(temp, rom, length); @@ -170,7 +170,7 @@ VIDEO_UPDATE( aeroboto ) oy = *aeroboto_stary; y = sy / SCROLL_SPEED; - src_base = memory_region(REGION_GFX2); + src_base = memory_region(screen->machine, REGION_GFX2); for (i=0; i<256; i++) { diff --git a/src/mame/video/aerofgt.c b/src/mame/video/aerofgt.c index 965045def19..01be08c7219 100644 --- a/src/mame/video/aerofgt.c +++ b/src/mame/video/aerofgt.c @@ -132,7 +132,7 @@ VIDEO_START( spinlbrk ) /* sprite maps are hardcoded in this game */ /* enemy sprites use ROM instead of RAM */ - aerofgt_spriteram2 = (UINT16 *)memory_region(REGION_GFX5); + aerofgt_spriteram2 = (UINT16 *)memory_region(machine, REGION_GFX5); aerofgt_spriteram2_size = 0x20000; /* front sprites are direct maps */ @@ -562,7 +562,7 @@ static void spikes91_draw_sprites(running_machine *machine, bitmap_t *bitmap,con { int i; UINT8 *lookup; - lookup = memory_region(REGION_USER1); + lookup = memory_region(machine, REGION_USER1); spritepalettebank = 1; for (i = aerofgt_spriteram3_size/2 - 4 ; i >= 4 ; i -= 4) diff --git a/src/mame/video/alpha68k.c b/src/mame/video/alpha68k.c index 08023b8b1a0..bda84f3d562 100644 --- a/src/mame/video/alpha68k.c +++ b/src/mame/video/alpha68k.c @@ -324,7 +324,7 @@ VIDEO_UPDATE( alpha68k_V_sb ) static void draw_sprites_I(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int c, int d, int yshift) { int data, offs, mx, my, tile, color, fy, i; - UINT8 *color_prom = memory_region(REGION_USER1); + UINT8 *color_prom = memory_region(machine, REGION_USER1); gfx_element *gfx = machine->gfx[0]; for (offs=0; offs<0x400; offs+=0x20) @@ -431,7 +431,7 @@ static void kyros_draw_sprites(running_machine *machine, bitmap_t *bitmap, const { int offs,mx,my,color,tile,i,bank,fy,fx; int data; - UINT8 *color_prom = memory_region(REGION_USER1); + UINT8 *color_prom = memory_region(machine, REGION_USER1); //AT for (offs=0; offs<0x400; offs+=0x20) diff --git a/src/mame/video/appoooh.c b/src/mame/video/appoooh.c index c20da493e08..7bc9dc86fef 100644 --- a/src/mame/video/appoooh.c +++ b/src/mame/video/appoooh.c @@ -195,7 +195,7 @@ WRITE8_HANDLER( appoooh_out_w ) /* bit 6 ROM bank select */ { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); memory_set_bankptr(1,&RAM[data&0x40 ? 0x10000 : 0x0a000]); } diff --git a/src/mame/video/arabian.c b/src/mame/video/arabian.c index 079da38610d..ff08f363f28 100644 --- a/src/mame/video/arabian.c +++ b/src/mame/video/arabian.c @@ -166,7 +166,7 @@ PALETTE_INIT( arabian ) VIDEO_START( arabian ) { - UINT8 *gfxbase = memory_region(REGION_GFX1); + UINT8 *gfxbase = memory_region(machine, REGION_GFX1); int offs; /* allocate a common bitmap to use for both planes */ diff --git a/src/mame/video/argus.c b/src/mame/video/argus.c index bab6e58d294..25d10870491 100644 --- a/src/mame/video/argus.c +++ b/src/mame/video/argus.c @@ -426,14 +426,14 @@ VIDEO_START( bombsa ) ***************************************************************************/ /* Write bg0 pattern data to dummy bg0 ram */ -static void argus_write_dummy_rams( int dramoffs, int vromoffs ) +static void argus_write_dummy_rams( running_machine *machine, int dramoffs, int vromoffs ) { int i; int voffs; int offs; - UINT8 *VROM1 = memory_region( REGION_USER1 ); /* "ag_15.bin" */ - UINT8 *VROM2 = memory_region( REGION_USER2 ); /* "ag_16.bin" */ + UINT8 *VROM1 = memory_region( machine, REGION_USER1 ); /* "ag_15.bin" */ + UINT8 *VROM2 = memory_region( machine, REGION_USER2 ); /* "ag_16.bin" */ /* offset in pattern data */ offs = VROM1[ vromoffs ] | ( VROM1[ vromoffs + 1 ] << 8 ); @@ -1007,7 +1007,7 @@ WRITE8_HANDLER( butasan_bg1_status_w ) Screen refresh ***************************************************************************/ -static void argus_bg0_scroll_handle( void ) +static void argus_bg0_scroll_handle( running_machine *machine ) { int delta; int scrollx; @@ -1048,7 +1048,7 @@ static void argus_bg0_scroll_handle( void ) { for ( j = 0 ; j < 4 ; j ++ ) { - argus_write_dummy_rams( woffs, roffs ); + argus_write_dummy_rams( machine, woffs, roffs ); woffs += 16; roffs += 2; } @@ -1090,7 +1090,7 @@ static void argus_bg0_scroll_handle( void ) { for ( j = 0 ; j < 4 ; j ++ ) { - argus_write_dummy_rams( woffs, roffs ); + argus_write_dummy_rams( machine, woffs, roffs ); woffs += 16; roffs += 2; } @@ -1539,7 +1539,7 @@ static void bombsa_draw_sprites(running_machine *machine, bitmap_t *bitmap, cons VIDEO_UPDATE( argus ) { /* scroll BG0 and render tile at proper position */ - argus_bg0_scroll_handle(); + argus_bg0_scroll_handle(screen->machine); fillbitmap(bitmap, screen->machine->pens[0], cliprect); diff --git a/src/mame/video/artmagic.c b/src/mame/video/artmagic.c index eb845f48ca9..3cd32d35ade 100644 --- a/src/mame/video/artmagic.c +++ b/src/mame/video/artmagic.c @@ -59,8 +59,8 @@ INLINE UINT16 *address_to_vram(offs_t *address) VIDEO_START( artmagic ) { - blitter_base = (UINT16 *)memory_region(REGION_GFX1); - blitter_mask = memory_region_length(REGION_GFX1)/2 - 1; + blitter_base = (UINT16 *)memory_region(machine, REGION_GFX1); + blitter_mask = memory_region_length(machine, REGION_GFX1)/2 - 1; } diff --git a/src/mame/video/atarirle.c b/src/mame/video/atarirle.c index 7d3c6935089..2aada17e682 100644 --- a/src/mame/video/atarirle.c +++ b/src/mame/video/atarirle.c @@ -271,7 +271,7 @@ INLINE int convert_mask(const atarirle_entry *input, atarirle_mask *result) void atarirle_init(running_machine *machine, int map, const atarirle_desc *desc) { - const UINT16 *base = (const UINT16 *)memory_region(desc->region); + const UINT16 *base = (const UINT16 *)memory_region(machine, desc->region); atarirle_data *mo = &atarirle[map]; int i, width, height; @@ -305,7 +305,7 @@ void atarirle_init(running_machine *machine, int map, const atarirle_desc *desc) mo->maxcolors = desc->maxcolors / 16; mo->rombase = base; - mo->romlength = memory_region_length(desc->region); + mo->romlength = memory_region_length(machine, desc->region); mo->objectcount = count_objects(base, mo->romlength); mo->cliprect = *video_screen_get_visible_area(machine->primary_screen); diff --git a/src/mame/video/atarisy1.c b/src/mame/video/atarisy1.c index 6937903c934..4213c7f964b 100644 --- a/src/mame/video/atarisy1.c +++ b/src/mame/video/atarisy1.c @@ -566,8 +566,8 @@ VIDEO_UPDATE( atarisy1 ) static void decode_gfx(running_machine *machine, UINT16 *pflookup, UINT16 *molookup) { - UINT8 *prom1 = &memory_region(REGION_PROMS)[0x000]; - UINT8 *prom2 = &memory_region(REGION_PROMS)[0x200]; + UINT8 *prom1 = &memory_region(machine, REGION_PROMS)[0x000]; + UINT8 *prom2 = &memory_region(machine, REGION_PROMS)[0x200]; int obj, i; /* reset the globals */ @@ -656,7 +656,7 @@ static int get_bank(running_machine *machine, UINT8 prom1, UINT8 prom2, int bpp) return bank_gfx[bpp - 4][bank_index]; /* if the bank is out of range, call it 0 */ - if (0x80000 * (bank_index - 1) >= memory_region_length(REGION_GFX2)) + if (0x80000 * (bank_index - 1) >= memory_region_length(machine, REGION_GFX2)) return 0; /* don't have one? let's make it ... first find any empty slot */ @@ -683,7 +683,7 @@ static int get_bank(running_machine *machine, UINT8 prom1, UINT8 prom2, int bpp) default: fatalerror("Unsupported bpp"); } - decodegfx(machine->gfx[gfx_index], &memory_region(REGION_GFX2)[0x80000 * (bank_index - 1)], 0, machine->gfx[gfx_index]->total_elements); + decodegfx(machine->gfx[gfx_index], &memory_region(machine, REGION_GFX2)[0x80000 * (bank_index - 1)], 0, machine->gfx[gfx_index]->total_elements); /* set the color information */ machine->gfx[gfx_index]->color_base = 256; diff --git a/src/mame/video/avgdvg.c b/src/mame/video/avgdvg.c index a5c4bfedc0c..d5b76a822c4 100644 --- a/src/mame/video/avgdvg.c +++ b/src/mame/video/avgdvg.c @@ -475,7 +475,7 @@ static void mhavoc_data(vgdata *vg) if (vg->pc & 0x2000) { - bank = &memory_region(REGION_CPU1)[0x18000]; + bank = &memory_region(Machine, REGION_CPU1)[0x18000]; vg->data = bank[(vg->map << 13) | ((vg->pc ^ 1) & 0x1fff)]; } else @@ -1182,7 +1182,7 @@ static TIMER_CALLBACK( vg_set_halt_callback ) static TIMER_CALLBACK( run_state_machine ) { int cycles = 0; - UINT8 *state_prom = memory_region(REGION_USER1); + UINT8 *state_prom = memory_region(machine, REGION_USER1); while (cycles < VGSLICE) { diff --git a/src/mame/video/balsente.c b/src/mame/video/balsente.c index d5d88c59f81..080742606e5 100644 --- a/src/mame/video/balsente.c +++ b/src/mame/video/balsente.c @@ -35,15 +35,15 @@ VIDEO_START( balsente ) { /* reset the system */ palettebank_vis = 0; - sprite_bank[0] = memory_region(REGION_GFX1); - sprite_bank[1] = memory_region(REGION_GFX1) + 0x10000; + sprite_bank[0] = memory_region(machine, REGION_GFX1); + sprite_bank[1] = memory_region(machine, REGION_GFX1) + 0x10000; /* allocate a local copy of video RAM */ local_videoram = auto_malloc(256 * 256); /* determine sprite size */ - sprite_data = memory_region(REGION_GFX1); - sprite_mask = memory_region_length(REGION_GFX1) - 1; + sprite_data = memory_region(machine, REGION_GFX1); + sprite_mask = memory_region_length(machine, REGION_GFX1) - 1; /* register for saving */ state_save_register_global_pointer(local_videoram, 256 * 256); diff --git a/src/mame/video/bbusters.c b/src/mame/video/bbusters.c index 11e8d63f768..4e87c38f23e 100644 --- a/src/mame/video/bbusters.c +++ b/src/mame/video/bbusters.c @@ -193,7 +193,7 @@ static void bbusters_draw_block(running_machine *machine, bitmap_t *dest,int x,i static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const UINT16 *source, int bank, int colval, int colmask) { - const UINT8 *scale_table=memory_region(REGION_USER1); + const UINT8 *scale_table=memory_region(machine, REGION_USER1); int offs; for (offs = 0;offs <0x800 ;offs += 4) { diff --git a/src/mame/video/bfm_adr2.c b/src/mame/video/bfm_adr2.c index be80f4c2ac0..e86c78f614c 100644 --- a/src/mame/video/bfm_adr2.c +++ b/src/mame/video/bfm_adr2.c @@ -186,7 +186,7 @@ VIDEO_RESET( adder2 ) adder2_data_to_sc2 = 0; { - UINT8 *rom = memory_region(REGION_CPU2); + UINT8 *rom = memory_region(machine, REGION_CPU2); memory_configure_bank(2, 0, 4, &rom[0x00000], 0x08000); @@ -422,11 +422,11 @@ static READ8_HANDLER( adder2_irq_r ) // // //////////////////////////////////////////////////////////////////// -void adder2_decode_char_roms(void) +void adder2_decode_char_roms(running_machine *machine) { UINT8 *p; - p = memory_region(REGION_GFX1); + p = memory_region(machine, REGION_GFX1); if ( p ) { diff --git a/src/mame/video/bfm_adr2.h b/src/mame/video/bfm_adr2.h index d17fdcf7056..6613ee174c4 100644 --- a/src/mame/video/bfm_adr2.h +++ b/src/mame/video/bfm_adr2.h @@ -9,7 +9,7 @@ extern UINT8 adder2_data; // data extern int adder2_acia_triggered; // flag <>0, ACIA receive IRQ GFXDECODE_EXTERN( adder2 ); -extern void adder2_decode_char_roms(void); +extern void adder2_decode_char_roms(running_machine *machine); MACHINE_RESET( adder2 ); INTERRUPT_GEN( adder2_vbl ); diff --git a/src/mame/video/bking.c b/src/mame/video/bking.c index 647725335c9..4cfa7cbdb95 100644 --- a/src/mame/video/bking.c +++ b/src/mame/video/bking.c @@ -333,7 +333,7 @@ VIDEO_EOF( bking ) if (latch != 0) { - const UINT8* MASK = memory_region(REGION_USER1) + 8 * hit; + const UINT8* MASK = memory_region(machine, REGION_USER1) + 8 * hit; int x; int y; diff --git a/src/mame/video/bombjack.c b/src/mame/video/bombjack.c index 12346ccce0e..62d513a4454 100644 --- a/src/mame/video/bombjack.c +++ b/src/mame/video/bombjack.c @@ -44,7 +44,7 @@ WRITE8_HANDLER( bombjack_flipscreen_w ) static TILE_GET_INFO( get_bg_tile_info ) { - UINT8 *tilerom = memory_region(REGION_GFX4); + UINT8 *tilerom = memory_region(machine, REGION_GFX4); int offs = (background_image & 0x07) * 0x200 + tile_index; int code = (background_image & 0x10) ? tilerom[offs] : 0; diff --git a/src/mame/video/boxer.c b/src/mame/video/boxer.c index f5c631ec26a..643e02678f8 100644 --- a/src/mame/video/boxer.c +++ b/src/mame/video/boxer.c @@ -16,7 +16,7 @@ static void draw_boxer(running_machine *machine, bitmap_t* bitmap, const rectang for (n = 0; n < 2; n++) { - const UINT8* p = memory_region(n == 0 ? REGION_USER1 : REGION_USER2); + const UINT8* p = memory_region(machine, n == 0 ? REGION_USER1 : REGION_USER2); int i; int j; diff --git a/src/mame/video/brkthru.c b/src/mame/video/brkthru.c index f3461a1027e..653bfb882f7 100644 --- a/src/mame/video/brkthru.c +++ b/src/mame/video/brkthru.c @@ -133,7 +133,7 @@ WRITE8_HANDLER( brkthru_1800_w ) else if (offset == 1) { int bankaddress; - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); /* bit 0-2 = ROM bank select */ diff --git a/src/mame/video/btime.c b/src/mame/video/btime.c index 08ac0b453af..c5812ec8d8c 100644 --- a/src/mame/video/btime.c +++ b/src/mame/video/btime.c @@ -408,7 +408,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta static void draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8* tmap, UINT8 color) { int i; - const UINT8 *gfx = memory_region(REGION_GFX3); + const UINT8 *gfx = memory_region(machine, REGION_GFX3); int scroll = -(bnj_scroll2 | ((bnj_scroll1 & 0x03) << 8)); // One extra iteration for wrap around diff --git a/src/mame/video/bublbobl.c b/src/mame/video/bublbobl.c index 22fd6e9b6b5..1419e8df59f 100644 --- a/src/mame/video/bublbobl.c +++ b/src/mame/video/bublbobl.c @@ -36,7 +36,7 @@ VIDEO_UPDATE( bublbobl ) sx = 0; - prom = memory_region(REGION_PROMS); + prom = memory_region(screen->machine, REGION_PROMS); for (offs = 0;offs < bublbobl_objectram_size;offs += 4) { /* skip empty sprites */ diff --git a/src/mame/video/buggychl.c b/src/mame/video/buggychl.c index 7847de93ce6..509d53b76e8 100644 --- a/src/mame/video/buggychl.c +++ b/src/mame/video/buggychl.c @@ -171,7 +171,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta profiler_mark(PROFILER_USER1); - gfx = memory_region(REGION_GFX2); + gfx = memory_region(machine, REGION_GFX2); for (offs = 0;offs < spriteram_size;offs += 4) { int sx,sy,flipy,zoom,ch,x,px,y; diff --git a/src/mame/video/bwing.c b/src/mame/video/bwing.c index a6ae1d06882..4818c27c681 100644 --- a/src/mame/video/bwing.c +++ b/src/mame/video/bwing.c @@ -123,7 +123,7 @@ WRITE8_HANDLER( bwing_scrollreg_w ) } #if BW_DEBUG - (memory_region(REGION_CPU1))[0x1b10 + offset] = data; + (memory_region(machine, REGION_CPU1))[0x1b10 + offset] = data; #endif } @@ -208,7 +208,7 @@ VIDEO_START( bwing ) fill_srxlat(srxlat); - fgdata = memory_region(REGION_USER1); + fgdata = memory_region(machine, REGION_USER1); bgdata = fgdata + 0x1000; for (i=0; i<4; i++) srbase[i] = fgdata + i * 0x2000; diff --git a/src/mame/video/capbowl.c b/src/mame/video/capbowl.c index 942886d2334..20fd5d72859 100644 --- a/src/mame/video/capbowl.c +++ b/src/mame/video/capbowl.c @@ -118,7 +118,7 @@ WRITE8_HANDLER( bowlrama_blitter_w ) READ8_HANDLER( bowlrama_blitter_r ) { - UINT8 data = memory_region(REGION_GFX1)[blitter_addr]; + UINT8 data = memory_region(machine, REGION_GFX1)[blitter_addr]; UINT8 result = 0; switch (offset) diff --git a/src/mame/video/carpolo.c b/src/mame/video/carpolo.c index f704b83fa1c..53f9f80ce4b 100644 --- a/src/mame/video/carpolo.c +++ b/src/mame/video/carpolo.c @@ -199,9 +199,9 @@ static void draw_alpha_line(running_machine *machine, bitmap_t *bitmap, const re } -static void remap_sprite_code(int bank, int code, int *remapped_code, int *flipy) +static void remap_sprite_code(running_machine *machine, int bank, int code, int *remapped_code, int *flipy) { - UINT8* PROM = memory_region(REGION_USER1); + UINT8* PROM = memory_region(machine, REGION_USER1); code = (bank << 4) | code; *remapped_code = PROM[code] & 0x0f; @@ -214,7 +214,7 @@ static void draw_sprite(running_machine *machine, bitmap_t *bitmap, const rectan { int remapped_code, flipy; - remap_sprite_code(bank, code, &remapped_code, &flipy); + remap_sprite_code(machine, bank, code, &remapped_code, &flipy); x = 240 - x; y = 240 - y; @@ -579,23 +579,23 @@ VIDEO_EOF( carpolo ) car1_x = carpolo_spriteram[0x00]; car1_y = carpolo_spriteram[0x01]; - remap_sprite_code(0, carpolo_spriteram[0x0c] & 0x0f, &car1_code, &car1_flipy); + remap_sprite_code(machine, 0, carpolo_spriteram[0x0c] & 0x0f, &car1_code, &car1_flipy); car2_x = carpolo_spriteram[0x02]; car2_y = carpolo_spriteram[0x03]; - remap_sprite_code(0, carpolo_spriteram[0x0c] >> 4, &car2_code, &car2_flipy); + remap_sprite_code(machine, 0, carpolo_spriteram[0x0c] >> 4, &car2_code, &car2_flipy); car3_x = carpolo_spriteram[0x04]; car3_y = carpolo_spriteram[0x05]; - remap_sprite_code(0, carpolo_spriteram[0x0d] & 0x0f, &car3_code, &car3_flipy); + remap_sprite_code(machine, 0, carpolo_spriteram[0x0d] & 0x0f, &car3_code, &car3_flipy); car4_x = carpolo_spriteram[0x06]; car4_y = carpolo_spriteram[0x07]; - remap_sprite_code(0, carpolo_spriteram[0x0d] >> 4, &car4_code, &car4_flipy); + remap_sprite_code(machine, 0, carpolo_spriteram[0x0d] >> 4, &car4_code, &car4_flipy); ball_x = carpolo_spriteram[0x08]; ball_y = carpolo_spriteram[0x09]; - remap_sprite_code(1, carpolo_spriteram[0x0e] & 0x0f, &ball_code, &ball_flipy); + remap_sprite_code(machine, 1, carpolo_spriteram[0x0e] & 0x0f, &ball_code, &ball_flipy); /* cars 1 and 2 */ diff --git a/src/mame/video/cave.c b/src/mame/video/cave.c index 137fc4e1c3e..9caa68facd5 100644 --- a/src/mame/video/cave.c +++ b/src/mame/video/cave.c @@ -561,8 +561,8 @@ static void get_sprite_info_cave(running_machine *machine) const int region = REGION_GFX1; pen_t base_pal = 0; - const UINT8 *base_gfx = memory_region(region); - int code_max = memory_region_length(region) / (16*16); + const UINT8 *base_gfx = memory_region(machine, region); + int code_max = memory_region_length(machine, region) / (16*16); UINT16 *source = spriteram16 + ((spriteram_size/2) / 2) * spriteram_bank; UINT16 *finish = source + ((spriteram_size/2) / 2); @@ -682,8 +682,8 @@ static void get_sprite_info_donpachi(running_machine *machine) const int region = REGION_GFX1; pen_t base_pal = 0; - const UINT8 *base_gfx = memory_region(region); - int code_max = memory_region_length(region) / (16*16); + const UINT8 *base_gfx = memory_region(machine, region); + int code_max = memory_region_length(machine, region) / (16*16); UINT16 *source = spriteram16 + ((spriteram_size/2) / 2) * spriteram_bank; UINT16 *finish = source + ((spriteram_size/2) / 2); diff --git a/src/mame/video/ccastles.c b/src/mame/video/ccastles.c index 5ded3888be6..b0fd7080d45 100644 --- a/src/mame/video/ccastles.c +++ b/src/mame/video/ccastles.c @@ -41,9 +41,9 @@ VIDEO_START( ccastles ) static const int resistances[3] = { 22000, 10000, 4700 }; /* get pointers to our PROMs */ - syncprom = memory_region(REGION_PROMS) + 0x000; - wpprom = memory_region(REGION_PROMS) + 0x200; - priprom = memory_region(REGION_PROMS) + 0x300; + syncprom = memory_region(machine, REGION_PROMS) + 0x000; + wpprom = memory_region(machine, REGION_PROMS) + 0x200; + priprom = memory_region(machine, REGION_PROMS) + 0x300; /* compute the color output resistor weights at startup */ compute_resistor_weights(0, 255, -1.0, diff --git a/src/mame/video/cclimber.c b/src/mame/video/cclimber.c index 9f376bda4b6..0720651b208 100644 --- a/src/mame/video/cclimber.c +++ b/src/mame/video/cclimber.c @@ -650,7 +650,7 @@ VIDEO_UPDATE( cclimber ) VIDEO_UPDATE( yamato ) { int i; - UINT8 *sky_rom = memory_region(REGION_USER1) + 0x1200; + UINT8 *sky_rom = memory_region(screen->machine, REGION_USER1) + 0x1200; for (i = 0; i < 0x100; i++) { diff --git a/src/mame/video/centiped.c b/src/mame/video/centiped.c index 063fbbddb7e..ad513428654 100644 --- a/src/mame/video/centiped.c +++ b/src/mame/video/centiped.c @@ -398,7 +398,7 @@ WRITE8_HANDLER( mazeinv_paletteram_w ) paletteram[offset] = data; /* the value passed in is a look-up index into the color PROM */ - melliped_mazeinv_set_color(machine, offset, ~memory_region(REGION_PROMS)[~data & 0x0f]); + melliped_mazeinv_set_color(machine, offset, ~memory_region(machine, REGION_PROMS)[~data & 0x0f]); } diff --git a/src/mame/video/chaknpop.c b/src/mame/video/chaknpop.c index 89b829eddaa..9ece5d88452 100644 --- a/src/mame/video/chaknpop.c +++ b/src/mame/video/chaknpop.c @@ -74,9 +74,9 @@ PALETTE_INIT( chaknpop ) Memory handlers ***************************************************************************/ -static void set_vram_bank(void) +static void set_vram_bank(running_machine *machine) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); int bankaddress; if (gfxmode & GFX_VRAM_BANK) @@ -106,7 +106,7 @@ WRITE8_HANDLER( chaknpop_gfxmode_w ) int all_dirty = 0; gfxmode = data; - set_vram_bank(); + set_vram_bank(machine); if (flip_x != (gfxmode & GFX_FLIP_X)) { @@ -174,14 +174,14 @@ static TILE_GET_INFO( chaknpop_get_tx_tile_info ) static STATE_POSTLOAD( chaknpop_postload ) { - set_vram_bank(); + set_vram_bank(machine); tx_tilemap_mark_all_dirty(); } VIDEO_START( chaknpop ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); /* info offset type w h col row */ tx_tilemap = tilemap_create(chaknpop_get_tx_tile_info, tilemap_scan_rows, 8, 8, 32, 32); @@ -191,7 +191,7 @@ VIDEO_START( chaknpop ) vram3 = &RAM[0x14000]; vram4 = &RAM[0x16000]; - set_vram_bank(); + set_vram_bank(machine); tx_tilemap_mark_all_dirty(); state_save_register_global(gfxmode); diff --git a/src/mame/video/changela.c b/src/mame/video/changela.c index c1997c42aa6..6fb9539fa32 100644 --- a/src/mame/video/changela.c +++ b/src/mame/video/changela.c @@ -63,11 +63,11 @@ VIDEO_START( changela ) Obj 0 - Sprite Layer ***************************************************************************/ -static void draw_obj0(bitmap_t *bitmap, int sy) +static void draw_obj0(running_machine *machine, bitmap_t *bitmap, int sy) { int sx, i; - UINT8* ROM = memory_region(REGION_USER1); + UINT8* ROM = memory_region(machine, REGION_USER1); UINT8* RAM = spriteram; for(sx = 0; sx < 256; sx++) @@ -124,11 +124,11 @@ static void draw_obj0(bitmap_t *bitmap, int sy) Obj 1 - Text Layer ***************************************************************************/ -static void draw_obj1(bitmap_t *bitmap) +static void draw_obj1(running_machine *machine, bitmap_t *bitmap) { int sx, sy; - UINT8* ROM = memory_region(REGION_GFX2); + UINT8* ROM = memory_region(machine, REGION_GFX2); UINT8* RAM = videoram; UINT8 reg[4] = { 0 }; /* 4x4-bit registers (U58, U59) */ @@ -187,15 +187,15 @@ static void draw_obj1(bitmap_t *bitmap) River Video Generator ***************************************************************************/ -static void draw_river(bitmap_t *bitmap, int sy) +static void draw_river(running_machine *machine, bitmap_t *bitmap, int sy) { int sx, i, j; - UINT8* ROM = memory_region(REGION_USER2); + UINT8* ROM = memory_region(machine, REGION_USER2); UINT8* RAM = memory_devices + 0x800; - UINT8* TILE_ROM = memory_region(REGION_GFX1); + UINT8* TILE_ROM = memory_region(machine, REGION_GFX1); UINT8* TILE_RAM = memory_devices + 0x1000; - UINT8* PROM = memory_region(REGION_PROMS); + UINT8* PROM = memory_region(machine, REGION_PROMS); static UINT8 v_count = 0; @@ -366,19 +366,19 @@ static void draw_river(bitmap_t *bitmap, int sy) Tree Generators ***************************************************************************/ -static void draw_tree(bitmap_t *bitmap, int sy, int tree_num) +static void draw_tree(running_machine *machine, bitmap_t *bitmap, int sy, int tree_num) { int sx, i, j; /* State machine */ - UINT8* ROM = memory_region(REGION_USER2); + UINT8* ROM = memory_region(machine, REGION_USER2); UINT8* RAM = memory_devices + 0x840 + 0x40*tree_num; - UINT8* PROM = memory_region(REGION_PROMS); + UINT8* PROM = memory_region(machine, REGION_PROMS); /* Tree Data */ UINT8* RAM2 = tree_ram + 0x20*tree_num; - UINT8* TILE_ROM = ( tree_num ? (memory_region(REGION_USER3) + 0x1000) : (memory_region(REGION_GFX1) + 0x2000) ); - UINT8* TILE_RAM = ( tree_num ? (memory_region(REGION_USER3)) : (memory_devices + 0x1800) ); + UINT8* TILE_ROM = ( tree_num ? (memory_region(machine, REGION_USER3) + 0x1000) : (memory_region(machine, REGION_GFX1) + 0x2000) ); + UINT8* TILE_RAM = ( tree_num ? (memory_region(machine, REGION_USER3)) : (memory_devices + 0x1800) ); static UINT8 v_count = 0; static int tree_on[2] = { 0 }; @@ -676,10 +676,10 @@ static TIMER_CALLBACK( changela_scanline_callback ) fillbitmap(tree0_bitmap, 0x00, &rect); fillbitmap(tree1_bitmap, 0x00, &rect); - draw_river(river_bitmap, sy); - draw_obj0(obj0_bitmap, sy); - draw_tree(tree0_bitmap, sy, 0); - draw_tree(tree1_bitmap, sy, 1); + draw_river(machine, river_bitmap, sy); + draw_obj0(machine, obj0_bitmap, sy); + draw_tree(machine, tree0_bitmap, sy, 0); + draw_tree(machine, tree1_bitmap, sy, 1); /* Collision Detection */ for(sx = 1; sx < 256; sx++) @@ -746,7 +746,7 @@ VIDEO_UPDATE( changela ) copybitmap_trans(bitmap, obj0_bitmap, 0, 0, 0, 0, cliprect, 0); copybitmap_trans(bitmap, tree0_bitmap, 0, 0, 0, 0, cliprect, 0); copybitmap_trans(bitmap, tree1_bitmap, 0, 0, 0, 0, cliprect, 0); - draw_obj1(bitmap); + draw_obj1(screen->machine, bitmap); return 0; } diff --git a/src/mame/video/citycon.c b/src/mame/video/citycon.c index 4c02518b9ec..6971e74b985 100644 --- a/src/mame/video/citycon.c +++ b/src/mame/video/citycon.c @@ -41,7 +41,7 @@ static TILE_GET_INFO( get_fg_tile_info ) static TILE_GET_INFO( get_bg_tile_info ) { - UINT8 *rom = memory_region(REGION_GFX4); + UINT8 *rom = memory_region(machine, REGION_GFX4); int code = rom[0x1000 * bg_image + tile_index]; SET_TILE_INFO( 3 + bg_image, diff --git a/src/mame/video/cloud9.c b/src/mame/video/cloud9.c index d3ea5ed363d..70ebc0b9d85 100644 --- a/src/mame/video/cloud9.c +++ b/src/mame/video/cloud9.c @@ -42,9 +42,9 @@ VIDEO_START( cloud9 ) memory_set_bankptr(1, videoram); /* get pointers to our PROMs */ - syncprom = memory_region(REGION_PROMS) + 0x000; - wpprom = memory_region(REGION_PROMS) + 0x200; - priprom = memory_region(REGION_PROMS) + 0x300; + syncprom = memory_region(machine, REGION_PROMS) + 0x000; + wpprom = memory_region(machine, REGION_PROMS) + 0x200; + priprom = memory_region(machine, REGION_PROMS) + 0x300; /* compute the color output resistor weights at startup */ compute_resistor_weights(0, 255, -1.0, diff --git a/src/mame/video/combatsc.c b/src/mame/video/combatsc.c index a2f421c5e78..05e1bb46932 100644 --- a/src/mame/video/combatsc.c +++ b/src/mame/video/combatsc.c @@ -357,7 +357,7 @@ static WRITE8_HANDLER( combascb_priority_w ) WRITE8_HANDLER( combasc_bankselect_w ) { - UINT8 *page = memory_region(REGION_CPU1) + 0x10000; + UINT8 *page = memory_region(machine, REGION_CPU1) + 0x10000; if (data & 0x40) { @@ -400,7 +400,7 @@ WRITE8_HANDLER( combascb_bankselect_w ) data = data & 0x1f; if( data != combasc_bank_select ) { - UINT8 *page = memory_region(REGION_CPU1) + 0x10000; + UINT8 *page = memory_region(machine, REGION_CPU1) + 0x10000; combasc_bank_select = data; if (data & 0x10) @@ -429,7 +429,7 @@ WRITE8_HANDLER( combascb_bankselect_w ) MACHINE_RESET( combasc ) { - UINT8 *MEM = memory_region(REGION_CPU1) + 0x38000; + UINT8 *MEM = memory_region(machine, REGION_CPU1) + 0x38000; combasc_io_ram = MEM + 0x0000; diff --git a/src/mame/video/cosmic.c b/src/mame/video/cosmic.c index a99108379f5..89798c284d9 100644 --- a/src/mame/video/cosmic.c +++ b/src/mame/video/cosmic.c @@ -9,7 +9,7 @@ #include "driver.h" -static pen_t (*map_color)(UINT8 x, UINT8 y); +static pen_t (*map_color)(running_machine *machine, UINT8 x, UINT8 y); static int color_registers[3]; static int background_enable; @@ -23,10 +23,10 @@ WRITE8_HANDLER( cosmic_color_register_w ) } -static pen_t panic_map_color(UINT8 x, UINT8 y) +static pen_t panic_map_color(running_machine *machine, UINT8 x, UINT8 y) { offs_t offs = (color_registers[0] << 9) | (color_registers[2] << 10) | ((x >> 4) << 5) | (y >> 3); - pen_t pen = memory_region(REGION_USER1)[offs]; + pen_t pen = memory_region(machine, REGION_USER1)[offs]; if (color_registers[1]) pen >>= 4; @@ -34,10 +34,10 @@ static pen_t panic_map_color(UINT8 x, UINT8 y) return pen & 0x0f; } -static pen_t cosmica_map_color(UINT8 x, UINT8 y) +static pen_t cosmica_map_color(running_machine *machine, UINT8 x, UINT8 y) { offs_t offs = (color_registers[0] << 9) | ((x >> 4) << 5) | (y >> 3); - pen_t pen = memory_region(REGION_USER1)[offs]; + pen_t pen = memory_region(machine, REGION_USER1)[offs]; if (color_registers[0]) /* yes, 0 again according to the schematics */ pen >>= 4; @@ -45,20 +45,20 @@ static pen_t cosmica_map_color(UINT8 x, UINT8 y) return pen & 0x07; } -static pen_t cosmicg_map_color(UINT8 x, UINT8 y) +static pen_t cosmicg_map_color(running_machine *machine, UINT8 x, UINT8 y) { offs_t offs = (color_registers[0] << 8) | (color_registers[1] << 9) | ((y >> 4) << 4) | (x >> 4); - pen_t pen = memory_region(REGION_USER1)[offs]; + pen_t pen = memory_region(machine, REGION_USER1)[offs]; /* the upper 4 bits are for cocktail mode support */ return pen & 0x0f; } -static pen_t magspot_map_color(UINT8 x, UINT8 y) +static pen_t magspot_map_color(running_machine *machine, UINT8 x, UINT8 y) { offs_t offs = (color_registers[0] << 9) | ((x >> 3) << 4) | (y >> 4); - pen_t pen = memory_region(REGION_USER1)[offs]; + pen_t pen = memory_region(machine, REGION_USER1)[offs]; if (color_registers[1]) pen >>= 4; @@ -248,7 +248,7 @@ WRITE8_HANDLER( cosmic_background_enable_w ) } -static void draw_bitmap(bitmap_t *bitmap, const rectangle *cliprect) +static void draw_bitmap(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) { offs_t offs; @@ -260,7 +260,7 @@ static void draw_bitmap(bitmap_t *bitmap, const rectangle *cliprect) UINT8 x = offs << 3; UINT8 y = offs >> 5; - pen_t pen = map_color(x, y); + pen_t pen = map_color(machine, x, y); for (i = 0; i < 8; i++) { @@ -318,7 +318,7 @@ static void cosmica_draw_starfield(const device_config *screen, bitmap_t *bitmap { UINT8 y = 0; UINT8 map = 0; - UINT8 *PROM = memory_region(REGION_USER2); + UINT8 *PROM = memory_region(screen->machine, REGION_USER2); while (1) { @@ -363,11 +363,11 @@ static void cosmica_draw_starfield(const device_config *screen, bitmap_t *bitmap } -static void devzone_draw_grid(bitmap_t *bitmap, const rectangle *cliprect) +static void devzone_draw_grid(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) { UINT8 y; - UINT8 *horz_PROM = memory_region(REGION_USER2); - UINT8 *vert_PROM = memory_region(REGION_USER3); + UINT8 *horz_PROM = memory_region(machine, REGION_USER2); + UINT8 *vert_PROM = memory_region(machine, REGION_USER3); offs_t horz_addr = 0; UINT8 count = 0; @@ -425,7 +425,7 @@ static void nomnlnd_draw_background(const device_config *screen, bitmap_t *bitma { UINT8 y = 0; UINT8 water = video_screen_get_frame_number(screen); - UINT8 *PROM = memory_region(REGION_USER2); + UINT8 *PROM = memory_region(screen->machine, REGION_USER2); /* all positioning is via logic gates: @@ -546,7 +546,7 @@ static void nomnlnd_draw_background(const device_config *screen, bitmap_t *bitma VIDEO_UPDATE( cosmicg ) { fillbitmap(bitmap, 0, cliprect); - draw_bitmap(bitmap, cliprect); + draw_bitmap(screen->machine, bitmap, cliprect); return 0; } @@ -554,7 +554,7 @@ VIDEO_UPDATE( cosmicg ) VIDEO_UPDATE( panic ) { fillbitmap(bitmap, 0, cliprect); - draw_bitmap(bitmap, cliprect); + draw_bitmap(screen->machine, bitmap, cliprect); draw_sprites(screen->machine, bitmap, cliprect, 0x07, 1); return 0; } @@ -564,7 +564,7 @@ VIDEO_UPDATE( cosmica ) { fillbitmap(bitmap, 0, cliprect); cosmica_draw_starfield(screen, bitmap, cliprect); - draw_bitmap(bitmap, cliprect); + draw_bitmap(screen->machine, bitmap, cliprect); draw_sprites(screen->machine, bitmap, cliprect, 0x0f, 0); return 0; } @@ -573,7 +573,7 @@ VIDEO_UPDATE( cosmica ) VIDEO_UPDATE( magspot ) { fillbitmap(bitmap, 0, cliprect); - draw_bitmap(bitmap, cliprect); + draw_bitmap(screen->machine, bitmap, cliprect); draw_sprites(screen->machine, bitmap, cliprect, 0x07, 0); return 0; } @@ -583,10 +583,10 @@ VIDEO_UPDATE( devzone ) { fillbitmap(bitmap, 0, cliprect); - if (background_enable) - devzone_draw_grid(bitmap, cliprect); + if (background_enable) + devzone_draw_grid(screen->machine, bitmap, cliprect); - draw_bitmap(bitmap, cliprect); + draw_bitmap(screen->machine, bitmap, cliprect); draw_sprites(screen->machine, bitmap, cliprect, 0x07, 0); return 0; } @@ -598,7 +598,7 @@ VIDEO_UPDATE( nomnlnd ) have the highest priority */ fillbitmap(bitmap, 0, cliprect); - draw_bitmap(bitmap, cliprect); + draw_bitmap(screen->machine, bitmap, cliprect); draw_sprites(screen->machine, bitmap, cliprect, 0x07, 0); if (background_enable) diff --git a/src/mame/video/cps1.c b/src/mame/video/cps1.c index c22dbdefdfb..3a8f22147e2 100644 --- a/src/mame/video/cps1.c +++ b/src/mame/video/cps1.c @@ -1418,13 +1418,13 @@ static MACHINE_RESET( cps ) if (strcmp(gamename, "sf2rb" )==0) { /* Patch out protection check */ - UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *rom = (UINT16 *)memory_region(machine, REGION_CPU1); rom[0xe5464/2] = 0x6012; } if (strcmp(gamename, "sf2rb2" )==0) { /* Patch out protection check */ - UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *rom = (UINT16 *)memory_region(machine, REGION_CPU1); rom[0xe5332/2] = 0x6014; } @@ -1435,13 +1435,13 @@ static MACHINE_RESET( cps ) by the cpu core as a 32-bit branch. This branch would make the game crash (address error, since it would branch to an odd address) if location 180ca6 (outside ROM space) isn't 0. Protection check? */ - UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *rom = (UINT16 *)memory_region(machine, REGION_CPU1); rom[0x11756/2] = 0x4e71; } else if (strcmp(gamename, "ghouls" )==0) { /* Patch out self-test... it takes forever */ - UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1); + UINT16 *rom = (UINT16 *)memory_region(machine, REGION_CPU1); rom[0x61964/2] = 0x4ef9; rom[0x61966/2] = 0x0000; rom[0x61968/2] = 0x0400; @@ -1613,11 +1613,11 @@ INLINE int cps2_port(int offset) -static void cps1_gfx_decode(void) +static void cps1_gfx_decode(running_machine *machine) { - int size=memory_region_length(REGION_GFX1); + int size=memory_region_length(machine, REGION_GFX1); int i,j,gfxsize; - UINT8 *cps1_gfx = memory_region(REGION_GFX1); + UINT8 *cps1_gfx = memory_region(machine, REGION_GFX1); gfxsize=size/4; @@ -1668,29 +1668,29 @@ static void unshuffle(UINT64 *buf,int len) } } -static void cps2_gfx_decode(void) +static void cps2_gfx_decode(running_machine *machine) { const int banksize=0x200000; - int size=memory_region_length(REGION_GFX1); + int size=memory_region_length(machine, REGION_GFX1); int i; for (i = 0;i < size;i += banksize) - unshuffle((UINT64 *)(memory_region(REGION_GFX1) + i),banksize/8); + unshuffle((UINT64 *)(memory_region(machine, REGION_GFX1) + i),banksize/8); - cps1_gfx_decode(); + cps1_gfx_decode(machine); } DRIVER_INIT( cps1 ) { - cps1_gfx_decode(); + cps1_gfx_decode(machine); } DRIVER_INIT( cps2_video ) { - cps2_gfx_decode(); + cps2_gfx_decode(machine); cps1_scanline1 = 262; cps1_scanline2 = 262; @@ -2513,7 +2513,7 @@ static void cps2_render_sprites(running_machine *machine, bitmap_t *bitmap,const static void cps1_render_stars(const device_config *screen, bitmap_t *bitmap,const rectangle *cliprect) { int offs; - UINT8 *stars_rom = memory_region(REGION_GFX2); + UINT8 *stars_rom = memory_region(screen->machine, REGION_GFX2); if (!stars_rom && (cps1_stars_enabled[0] || cps1_stars_enabled[1])) { diff --git a/src/mame/video/crbaloon.c b/src/mame/video/crbaloon.c index 2d6b33e7815..8ad722b98e6 100644 --- a/src/mame/video/crbaloon.c +++ b/src/mame/video/crbaloon.c @@ -105,7 +105,7 @@ static void draw_sprite_and_check_collision(running_machine *machine, bitmap_t * UINT8 color = crbaloon_spriteram[0] >> 4; UINT8 sy = crbaloon_spriteram[2] - 32; - UINT8 *gfx = memory_region(REGION_GFX2) + (code << 7); + UINT8 *gfx = memory_region(machine, REGION_GFX2) + (code << 7); if (flip_screen_get()) diff --git a/src/mame/video/crgolf.c b/src/mame/video/crgolf.c index 2fd9edf906d..06990fccffc 100644 --- a/src/mame/video/crgolf.c +++ b/src/mame/video/crgolf.c @@ -61,10 +61,10 @@ READ8_HANDLER( crgolf_videoram_r ) * *************************************/ -static void get_pens(pen_t *pens) +static void get_pens(running_machine *machine, pen_t *pens) { offs_t offs; - const UINT8 *prom = memory_region(REGION_PROMS); + const UINT8 *prom = memory_region(machine, REGION_PROMS); for (offs = 0; offs < NUM_PENS; offs++) { @@ -127,7 +127,7 @@ static VIDEO_UPDATE( crgolf ) offs_t offs; pen_t pens[NUM_PENS]; - get_pens(pens); + get_pens(screen->machine, pens); /* for each byte in the video RAM */ for (offs = 0; offs < VIDEORAM_SIZE / 3; offs++) diff --git a/src/mame/video/csk.c b/src/mame/video/csk.c index 7ec0015c8bc..fdbf9e3d657 100644 --- a/src/mame/video/csk.c +++ b/src/mame/video/csk.c @@ -48,7 +48,7 @@ WRITE8_HANDLER( cpk_palette2_w ) READ8_HANDLER( cpk_expansion_r ) { - UINT8 * RAM = memory_region(REGION_GFX3); + UINT8 * RAM = memory_region(machine, REGION_GFX3); return RAM[offset]; } @@ -120,7 +120,7 @@ INTERRUPT_GEN( cpoker_interrupt ) INTERRUPT_GEN( cska_interrupt ) { - UINT8 * RAM = memory_region(REGION_CPU1); + UINT8 * RAM = memory_region(machine, REGION_CPU1); RAM[ hopperOK ] = 1; /* simulate hopper working! */ diff --git a/src/mame/video/cvs.c b/src/mame/video/cvs.c index 292611abbc2..dbe513bcfb9 100644 --- a/src/mame/video/cvs.c +++ b/src/mame/video/cvs.c @@ -225,7 +225,7 @@ VIDEO_UPDATE( cvs ) /* ROM based tiles first */ for (code = 0; code < ram_based_char_start_indices[character_banking_mode]; code++) - decodechar(screen->machine->gfx[0], code, memory_region(REGION_GFX1)); + decodechar(screen->machine->gfx[0], code, memory_region(screen->machine, REGION_GFX1)); /* now the RAM based ones */ for (; code < 0x100; code++) diff --git a/src/mame/video/darkmist.c b/src/mame/video/darkmist.c index aec9b3ad353..04ff55db6a3 100644 --- a/src/mame/video/darkmist.c +++ b/src/mame/video/darkmist.c @@ -20,8 +20,8 @@ static TILE_GET_INFO( get_bgtile_info ) { int code,attr,pal; - code=memory_region(REGION_USER1)[tile_index]; /* TTTTTTTT */ - attr=memory_region(REGION_USER2)[tile_index]; /* -PPP--TT - FIXED BITS (0xxx00xx) */ + code=memory_region(machine, REGION_USER1)[tile_index]; /* TTTTTTTT */ + attr=memory_region(machine, REGION_USER2)[tile_index]; /* -PPP--TT - FIXED BITS (0xxx00xx) */ code+=(attr&3)<<8; pal=(attr>>4); @@ -36,8 +36,8 @@ static TILE_GET_INFO( get_fgtile_info ) { int code,attr,pal; - code=memory_region(REGION_USER3)[tile_index]; /* TTTTTTTT */ - attr=memory_region(REGION_USER4)[tile_index]; /* -PPP--TT - FIXED BITS (0xxx00xx) */ + code=memory_region(machine, REGION_USER3)[tile_index]; /* TTTTTTTT */ + attr=memory_region(machine, REGION_USER4)[tile_index]; /* -PPP--TT - FIXED BITS (0xxx00xx) */ pal=attr>>4; code+=(attr&3)<<8; diff --git a/src/mame/video/dcheese.c b/src/mame/video/dcheese.c index cb06c62fb2c..08e8b52560d 100644 --- a/src/mame/video/dcheese.c +++ b/src/mame/video/dcheese.c @@ -44,7 +44,7 @@ static emu_timer *blitter_timer; PALETTE_INIT( dcheese ) { - const UINT16 *src = (UINT16 *)memory_region(REGION_USER1); + const UINT16 *src = (UINT16 *)memory_region(machine, REGION_USER1); int i; /* really 65536 colors, but they don't use the later ones so we can stay */ @@ -178,8 +178,8 @@ static void do_blit(running_machine *machine) INT32 dxdy = (INT32)(((blitter_xparam[6] & 0x0fff) | ((blitter_xparam[7] & 0x0fff) << 12)) << 12) >> 12; INT32 dydx = (INT32)(((blitter_yparam[4] & 0x0fff) | ((blitter_yparam[5] & 0x0fff) << 12)) << 12) >> 12; INT32 dydy = (INT32)(((blitter_yparam[6] & 0x0fff) | ((blitter_yparam[7] & 0x0fff) << 12)) << 12) >> 12; - UINT8 *src = memory_region(REGION_GFX1); - UINT32 pagemask = (memory_region_length(REGION_GFX1) - 1) / 0x40000; + UINT8 *src = memory_region(machine, REGION_GFX1); + UINT32 pagemask = (memory_region_length(machine, REGION_GFX1) - 1) / 0x40000; int xstart = blitter_xparam[14]; int xend = blitter_xparam[15] + 1; int ystart = blitter_yparam[14]; diff --git a/src/mame/video/dday.c b/src/mame/video/dday.c index 6d73f0b7202..fe2f6bd355f 100644 --- a/src/mame/video/dday.c +++ b/src/mame/video/dday.c @@ -190,7 +190,7 @@ static TILE_GET_INFO( get_sl_tile_info ) int code, sl_flipx, flipx; UINT8* sl_map; - sl_map = &memory_region(REGION_USER1)[(sl_image & 0x07) * 0x0200]; + sl_map = &memory_region(machine, REGION_USER1)[(sl_image & 0x07) * 0x0200]; flipx = (tile_index >> 4) & 0x01; sl_flipx = (sl_image >> 3) & 0x01; diff --git a/src/mame/video/deadang.c b/src/mame/video/deadang.c index 1284f16c868..a02180d1788 100644 --- a/src/mame/video/deadang.c +++ b/src/mame/video/deadang.c @@ -40,14 +40,14 @@ static TILEMAP_MAPPER( bg_scan ) static TILE_GET_INFO( get_pf3_tile_info ) { - const UINT16 *bgMap = (const UINT16 *)memory_region(REGION_GFX6); + const UINT16 *bgMap = (const UINT16 *)memory_region(machine, REGION_GFX6); int code= bgMap[tile_index]; SET_TILE_INFO(4,code&0x7ff,code>>12,0); } static TILE_GET_INFO( get_pf2_tile_info ) { - const UINT16 *bgMap = (const UINT16 *)memory_region(REGION_GFX7); + const UINT16 *bgMap = (const UINT16 *)memory_region(machine, REGION_GFX7); int code= bgMap[tile_index]; SET_TILE_INFO(3,code&0x7ff,code>>12,0); } diff --git a/src/mame/video/dec8.c b/src/mame/video/dec8.c index 46d2885701d..41a6214d35c 100644 --- a/src/mame/video/dec8.c +++ b/src/mame/video/dec8.c @@ -163,7 +163,7 @@ WRITE8_HANDLER( dec8_scroll2_w ) WRITE8_HANDLER( srdarwin_control_w ) { int bankaddress; - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); switch (offset) { case 0: /* Top 3 bits - bank switch, bottom 4 - scroll MSB */ @@ -180,7 +180,7 @@ WRITE8_HANDLER( srdarwin_control_w ) WRITE8_HANDLER( lastmiss_control_w ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); /* Bit 0x0f - ROM bank switch. @@ -203,7 +203,7 @@ WRITE8_HANDLER( lastmiss_control_w ) WRITE8_HANDLER( shackled_control_w ) { int bankaddress; - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); /* Bottom 4 bits - bank switch, Bits 4 & 5 - Scroll MSBs */ bankaddress = 0x10000 + (data & 0x0f) * 0x4000; diff --git a/src/mame/video/deco_mlc.c b/src/mame/video/deco_mlc.c index b37a106d164..0dfa3226390 100644 --- a/src/mame/video/deco_mlc.c +++ b/src/mame/video/deco_mlc.c @@ -231,8 +231,8 @@ static void draw_sprites(running_machine* machine, bitmap_t *bitmap,const rectan UINT32 *index_ptr=0; int offs,fx=0,fy=0,x,y,color,colorOffset,sprite,indx,h,w,bx,by,fx1,fy1; int xmult,ymult,xoffs,yoffs; - UINT8 *rom = memory_region(REGION_GFX2) + 0x20000, *index_ptr8; - UINT8 *rawrom = memory_region(REGION_GFX2); + UINT8 *rom = memory_region(machine, REGION_GFX2) + 0x20000, *index_ptr8; + UINT8 *rawrom = memory_region(machine, REGION_GFX2); int blockIsTilemapIndex=0; int sprite2=0,indx2=0,use8bppMode=0; int yscale,xscale; diff --git a/src/mame/video/deniam.c b/src/mame/video/deniam.c index a8acf4b9c9a..21c902f1020 100644 --- a/src/mame/video/deniam.c +++ b/src/mame/video/deniam.c @@ -201,10 +201,10 @@ WRITE16_HANDLER( deniam_coinctrl_w ) * c | ---------------- | zoomy like in System 16? * e | ---------------- | */ -static void draw_sprites(bitmap_t *bitmap, const rectangle *cliprect) +static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) { int offs; - UINT8 *gfx = memory_region(REGION_GFX2); + UINT8 *gfx = memory_region(machine, REGION_GFX2); for (offs = spriteram_size/2-8;offs >= 0;offs -= 8) { @@ -396,6 +396,6 @@ VIDEO_UPDATE( deniam ) tilemap_draw(bitmap,cliprect,fg_tilemap,0,2); tilemap_draw(bitmap,cliprect,tx_tilemap,0,4); - draw_sprites(bitmap,cliprect); + draw_sprites(screen->machine,bitmap,cliprect); return 0; } diff --git a/src/mame/video/digdug.c b/src/mame/video/digdug.c index 618148ad2fa..0bd3472d0b7 100644 --- a/src/mame/video/digdug.c +++ b/src/mame/video/digdug.c @@ -97,7 +97,7 @@ static TILEMAP_MAPPER( tilemap_scan ) static TILE_GET_INFO( bg_get_tile_info ) { - UINT8 *rom = memory_region(REGION_GFX4); + UINT8 *rom = memory_region(machine, REGION_GFX4); int code = rom[tile_index | (bg_select << 10)]; /* when the background is "disabled", it is actually still drawn, but using a color code that makes all pixels black. There are pullups setting the diff --git a/src/mame/video/dkong.c b/src/mame/video/dkong.c index 86be39460f6..035d4f01664 100644 --- a/src/mame/video/dkong.c +++ b/src/mame/video/dkong.c @@ -761,7 +761,7 @@ static void radarscp_step(running_machine *machine, int line_cnt) } -static void radarscp_draw_background(dkong_state *state, bitmap_t *bitmap, const rectangle *cliprect) +static void radarscp_draw_background(running_machine *machine, dkong_state *state, bitmap_t *bitmap, const rectangle *cliprect) { const UINT8 *htable = NULL; int x,y; @@ -769,7 +769,7 @@ static void radarscp_draw_background(dkong_state *state, bitmap_t *bitmap, const UINT16 *pixel; if (state->hardware_type == HARDWARE_TRS01) - htable = memory_region(REGION_GFX4); + htable = memory_region(machine, REGION_GFX4); y = cliprect->min_y; while (y <= cliprect->max_y) @@ -793,8 +793,8 @@ static void radarscp_draw_background(dkong_state *state, bitmap_t *bitmap, const static TIMER_CALLBACK( scanline_callback ) { dkong_state *state = machine->driver_data; - const UINT8 *table = memory_region(REGION_GFX3); - int table_len = memory_region_length(REGION_GFX3); + const UINT8 *table = memory_region(machine, REGION_GFX3); + int table_len = memory_region_length(machine, REGION_GFX3); int x,y,offset; UINT16 *pixel; static int counter=0; @@ -847,10 +847,10 @@ static void check_palette(running_machine *machine) switch (newset) { case 0x00: - palette_init_radarscp(machine, memory_region(REGION_PROMS)); + palette_init_radarscp(machine, memory_region(machine, REGION_PROMS)); break; case 0x01: - palette_init_dkong2b(machine, memory_region(REGION_PROMS)); + palette_init_dkong2b(machine, memory_region(machine, REGION_PROMS)); break; } } @@ -937,7 +937,7 @@ VIDEO_UPDATE( dkong ) case HARDWARE_TRS02: tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0); draw_sprites(screen->machine, bitmap, cliprect, 0x40, 1); - radarscp_draw_background(state, bitmap, cliprect); + radarscp_draw_background(screen->machine, state, bitmap, cliprect); break; default: fatalerror("Invalid hardware type in dkong_video_update"); diff --git a/src/mame/video/dooyong.c b/src/mame/video/dooyong.c index 2b04302c3fa..cbbdb113462 100644 --- a/src/mame/video/dooyong.c +++ b/src/mame/video/dooyong.c @@ -620,8 +620,8 @@ VIDEO_UPDATE( popbingo ) VIDEO_START( lastday ) { /* Configure tilemap callbacks */ - bg_tilerom = memory_region(REGION_GFX5); - fg_tilerom = memory_region(REGION_GFX6); + bg_tilerom = memory_region(machine, REGION_GFX5); + fg_tilerom = memory_region(machine, REGION_GFX6); bg_tilerom2 = NULL; fg_tilerom2 = NULL; bg_gfx = 2; @@ -657,8 +657,8 @@ VIDEO_START( lastday ) VIDEO_START( gulfstrm ) { /* Configure tilemap callbacks */ - bg_tilerom = memory_region(REGION_GFX5); - fg_tilerom = memory_region(REGION_GFX6); + bg_tilerom = memory_region(machine, REGION_GFX5); + fg_tilerom = memory_region(machine, REGION_GFX6); bg_tilerom2 = NULL; fg_tilerom2 = NULL; bg_gfx = 2; @@ -693,8 +693,8 @@ VIDEO_START( gulfstrm ) VIDEO_START( pollux ) { /* Configure tilemap callbacks */ - bg_tilerom = memory_region(REGION_GFX5); - fg_tilerom = memory_region(REGION_GFX6); + bg_tilerom = memory_region(machine, REGION_GFX5); + fg_tilerom = memory_region(machine, REGION_GFX6); bg_tilerom2 = NULL; fg_tilerom2 = NULL; bg_gfx = 2; @@ -726,9 +726,9 @@ VIDEO_START( pollux ) VIDEO_START( bluehawk ) { /* Configure tilemap callbacks */ - bg_tilerom = memory_region(REGION_GFX3) + 0x78000; - fg_tilerom = memory_region(REGION_GFX4) + 0x78000; - fg2_tilerom = memory_region(REGION_GFX5) + 0x38000; + bg_tilerom = memory_region(machine, REGION_GFX3) + 0x78000; + fg_tilerom = memory_region(machine, REGION_GFX4) + 0x78000; + fg2_tilerom = memory_region(machine, REGION_GFX5) + 0x38000; bg_tilerom2 = NULL; fg_tilerom2 = NULL; fg2_tilerom2 = NULL; @@ -766,8 +766,8 @@ VIDEO_START( bluehawk ) VIDEO_START( flytiger ) { /* Configure tilemap callbacks */ - bg_tilerom = memory_region(REGION_GFX3) + 0x78000; - fg_tilerom = memory_region(REGION_GFX4) + 0x78000; + bg_tilerom = memory_region(machine, REGION_GFX3) + 0x78000; + fg_tilerom = memory_region(machine, REGION_GFX4) + 0x78000; bg_tilerom2 = NULL; fg_tilerom2 = NULL; bg_gfx = 2; @@ -801,8 +801,8 @@ VIDEO_START( flytiger ) VIDEO_START( primella ) { /* Configure tilemap callbacks */ - bg_tilerom = memory_region(REGION_GFX2) + memory_region_length(REGION_GFX2) - 0x8000; - fg_tilerom = memory_region(REGION_GFX3) + memory_region_length(REGION_GFX3) - 0x8000; + bg_tilerom = memory_region(machine, REGION_GFX2) + memory_region_length(machine, REGION_GFX2) - 0x8000; + fg_tilerom = memory_region(machine, REGION_GFX3) + memory_region_length(machine, REGION_GFX3) - 0x8000; bg_tilerom2 = NULL; fg_tilerom2 = NULL; bg_gfx = 1; @@ -835,14 +835,14 @@ VIDEO_START( primella ) VIDEO_START( rshark ) { /* Configure tilemap callbacks */ - bg_tilerom = memory_region(REGION_GFX5); - bg2_tilerom = memory_region(REGION_GFX4); - fg_tilerom = memory_region(REGION_GFX3); - fg2_tilerom = memory_region(REGION_GFX2); - bg_tilerom2 = memory_region(REGION_GFX6) + 0x60000; - bg2_tilerom2 = memory_region(REGION_GFX6) + 0x40000; - fg_tilerom2 = memory_region(REGION_GFX6) + 0x20000; - fg2_tilerom2 = memory_region(REGION_GFX6) + 0x00000; + bg_tilerom = memory_region(machine, REGION_GFX5); + bg2_tilerom = memory_region(machine, REGION_GFX4); + fg_tilerom = memory_region(machine, REGION_GFX3); + fg2_tilerom = memory_region(machine, REGION_GFX2); + bg_tilerom2 = memory_region(machine, REGION_GFX6) + 0x60000; + bg2_tilerom2 = memory_region(machine, REGION_GFX6) + 0x40000; + fg_tilerom2 = memory_region(machine, REGION_GFX6) + 0x20000; + fg2_tilerom2 = memory_region(machine, REGION_GFX6) + 0x00000; bg_gfx = 4; bg2_gfx = 3; fg_gfx = 2; @@ -879,7 +879,7 @@ VIDEO_START( rshark ) VIDEO_START( popbingo ) { /* Configure tilemap callbacks */ - bg_tilerom = memory_region(REGION_GFX2); + bg_tilerom = memory_region(machine, REGION_GFX2); bg_gfx = 1; /* Create tilemaps */ diff --git a/src/mame/video/dribling.c b/src/mame/video/dribling.c index 91c61755e48..0e188ea5fa3 100644 --- a/src/mame/video/dribling.c +++ b/src/mame/video/dribling.c @@ -17,7 +17,7 @@ PALETTE_INIT( dribling ) { - const UINT8 *prom = memory_region(REGION_PROMS) + 0x400; + const UINT8 *prom = memory_region(machine, REGION_PROMS) + 0x400; int i; for (i = 0; i < 256; i++) @@ -58,8 +58,8 @@ WRITE8_HANDLER( dribling_colorram_w ) VIDEO_UPDATE( dribling ) { - UINT8 *prombase = memory_region(REGION_PROMS); - UINT8 *gfxbase = memory_region(REGION_GFX1); + UINT8 *prombase = memory_region(screen->machine, REGION_PROMS); + UINT8 *gfxbase = memory_region(screen->machine, REGION_GFX1); int x, y; /* loop over rows */ diff --git a/src/mame/video/dynax.c b/src/mame/video/dynax.c index 5ce7ef6357d..66b38a86135 100644 --- a/src/mame/video/dynax.c +++ b/src/mame/video/dynax.c @@ -353,12 +353,12 @@ INLINE void blitter_plot_pixel(int layer,int mask, int x, int y, int pen, int wr } -static int blitter_drawgfx( int layer, int mask, int gfx, int src, int pen, int x, int y, int wrap, int flags ) +static int blitter_drawgfx( running_machine *machine, int layer, int mask, int gfx, int src, int pen, int x, int y, int wrap, int flags ) { UINT8 cmd; - UINT8 *ROM = memory_region( gfx ); - size_t ROM_size = memory_region_length( gfx ); + UINT8 *ROM = memory_region( machine, gfx ); + size_t ROM_size = memory_region_length( machine, gfx ); int sx; @@ -511,6 +511,7 @@ static void dynax_blitter_start(running_machine *machine, int flags) blit_newsrc = blitter_drawgfx( + machine, 0, // layer dynax_blit_dest, // layer mask dynax_blit_romregion, // rom region @@ -540,6 +541,7 @@ static void jantouki_blitter_start(running_machine *machine, int flags) blit_newsrc = blitter_drawgfx( + machine, 0, // layer dynax_blit_dest, // layer mask dynax_blit_romregion, // rom region @@ -569,6 +571,7 @@ static void jantouki_blitter2_start(running_machine *machine, int flags) blit2_newsrc = blitter_drawgfx( + machine, 4, // layer dynax_blit2_dest, // layer mask dynax_blit2_romregion, // rom region @@ -1072,14 +1075,14 @@ static int debug_mask(void) I,O - Change palette (-,+) J,K & N,M - Change "tile" (-,+, slow & fast) R - move "tile" to the next 1/8th of the gfx */ -static int debug_viewer(bitmap_t *bitmap,const rectangle *cliprect) +static int debug_viewer(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect) { #ifdef MAME_DEBUG static int toggle; if (input_code_pressed_once(KEYCODE_T)) toggle = 1-toggle; if (toggle) { - UINT8 *RAM = memory_region( REGION_GFX1 ); - size_t size = memory_region_length( REGION_GFX1 ); + UINT8 *RAM = memory_region( machine, REGION_GFX1 ); + size_t size = memory_region_length( machine, REGION_GFX1 ); static int i = 0, c = 0, r = 0; if (input_code_pressed_once(KEYCODE_I)) c = (c-1) & 0x1f; @@ -1098,7 +1101,7 @@ static int debug_viewer(bitmap_t *bitmap,const rectangle *cliprect) if (layer_layout != LAYOUT_MJDIALQ2) memset(dynax_pixmap[0][1],0,sizeof(UINT8)*0x100*0x100); for (hanamai_layer_half = 0; hanamai_layer_half < 2; hanamai_layer_half++) - blitter_drawgfx(0,1,REGION_GFX1,i,0,cliprect->min_x,cliprect->min_y,3,0); + blitter_drawgfx(machine,0,1,REGION_GFX1,i,0,cliprect->min_x,cliprect->min_y,3,0); if (layer_layout != LAYOUT_MJDIALQ2) hanamai_copylayer(bitmap, cliprect, 0); else mjdialq2_copylayer(bitmap,cliprect, 0); popmessage("%06X C%02X",i,c); @@ -1116,7 +1119,7 @@ VIDEO_UPDATE( hanamai ) int layers_ctrl = ~dynax_layer_enable; int lay[4]; - if (debug_viewer(bitmap,cliprect)) return 0; + if (debug_viewer(screen->machine,bitmap,cliprect)) return 0; layers_ctrl &= debug_mask(); fillbitmap( @@ -1152,7 +1155,7 @@ VIDEO_UPDATE( hnoridur ) int lay[4]; int pri; - if (debug_viewer(bitmap,cliprect)) return 0; + if (debug_viewer(screen->machine,bitmap,cliprect)) return 0; layers_ctrl &= debug_mask(); fillbitmap( @@ -1187,7 +1190,7 @@ VIDEO_UPDATE( sprtmtch ) { int layers_ctrl = ~dynax_layer_enable; - if (debug_viewer(bitmap,cliprect)) return 0; + if (debug_viewer(screen->machine,bitmap,cliprect)) return 0; layers_ctrl &= debug_mask(); fillbitmap( @@ -1208,7 +1211,7 @@ VIDEO_UPDATE( jantouki ) const device_config *top_screen = device_list_find_by_tag(screen->machine->config->devicelist, VIDEO_SCREEN, "top"); const device_config *bottom_screen = device_list_find_by_tag(screen->machine->config->devicelist, VIDEO_SCREEN, "bottom"); - if (debug_viewer(bitmap,cliprect)) return 0; + if (debug_viewer(screen->machine,bitmap,cliprect)) return 0; layers_ctrl &= debug_mask(); fillbitmap( @@ -1239,7 +1242,7 @@ VIDEO_UPDATE( mjdialq2 ) { int layers_ctrl = ~dynax_layer_enable; - if (debug_viewer(bitmap,cliprect)) return 0; + if (debug_viewer(screen->machine,bitmap,cliprect)) return 0; layers_ctrl &= debug_mask(); fillbitmap( diff --git a/src/mame/video/epos.c b/src/mame/video/epos.c index 44c36cc03bb..30900df67b9 100644 --- a/src/mame/video/epos.c +++ b/src/mame/video/epos.c @@ -26,11 +26,11 @@ static UINT8 palette; ***************************************************************************/ -static void get_pens(pen_t *pens) +static void get_pens(running_machine *machine, pen_t *pens) { offs_t i; - const UINT8 *prom = memory_region(REGION_PROMS); - int len = memory_region_length(REGION_PROMS); + const UINT8 *prom = memory_region(machine, REGION_PROMS); + int len = memory_region_length(machine, REGION_PROMS); for (i = 0; i < len; i++) { @@ -80,7 +80,7 @@ VIDEO_UPDATE( epos ) pen_t pens[0x20]; offs_t offs; - get_pens(pens); + get_pens(screen->machine, pens); for (offs = 0; offs < videoram_size; offs++) { diff --git a/src/mame/video/equites.c b/src/mame/video/equites.c index e5316bcbd74..06f6b161560 100644 --- a/src/mame/video/equites.c +++ b/src/mame/video/equites.c @@ -328,7 +328,7 @@ Also, note that sprites are 30x30, not 32x32. static void splndrbt_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) { - const UINT8 * const xrom = memory_region(REGION_USER2); + const UINT8 * const xrom = memory_region(machine, REGION_USER2); const UINT8 * const yrom = xrom + 0x100; const gfx_element* const gfx = machine->gfx[2]; int offs; @@ -401,11 +401,11 @@ static void splndrbt_draw_sprites(running_machine *machine, bitmap_t *bitmap, co } -static void splndrbt_copy_bg(bitmap_t *dst_bitmap, const rectangle *cliprect) +static void splndrbt_copy_bg(running_machine *machine, bitmap_t *dst_bitmap, const rectangle *cliprect) { bitmap_t * const src_bitmap = tilemap_get_pixmap(bg_tilemap); bitmap_t * const flags_bitmap = tilemap_get_flagsmap(bg_tilemap); - const UINT8 * const xrom = memory_region(REGION_USER1); + const UINT8 * const xrom = memory_region(machine, REGION_USER1); const UINT8 * const yrom = xrom + 0x2000; int scroll_x = splndrbt_bg_scrollx; int scroll_y = splndrbt_bg_scrolly; @@ -472,7 +472,7 @@ VIDEO_UPDATE( splndrbt ) { fillbitmap(bitmap, bgcolor, cliprect); - splndrbt_copy_bg(bitmap, cliprect); + splndrbt_copy_bg(screen->machine, bitmap, cliprect); if (fg_char_bank) tilemap_draw(bitmap, cliprect, fg_tilemap, 0, 0); diff --git a/src/mame/video/exedexes.c b/src/mame/video/exedexes.c index f19e4b00dd5..baac71b5cab 100644 --- a/src/mame/video/exedexes.c +++ b/src/mame/video/exedexes.c @@ -15,8 +15,8 @@ UINT8 *exedexes_nbg_xscroll; static int chon,objon,sc1on,sc2on; -#define TileMap(offs) (memory_region(REGION_GFX5)[offs]) -#define BackTileMap(offs) (memory_region(REGION_GFX5)[offs+0x4000]) +#define TileMap(offs) (memory_region(machine, REGION_GFX5)[offs]) +#define BackTileMap(offs) (memory_region(machine, REGION_GFX5)[offs+0x4000]) static tilemap *bg_tilemap, *fg_tilemap, *tx_tilemap; @@ -129,7 +129,7 @@ WRITE8_HANDLER( exedexes_gfxctrl_w ) static TILE_GET_INFO( get_bg_tile_info ) { - UINT8 *tilerom = memory_region(REGION_GFX5); + UINT8 *tilerom = memory_region(machine, REGION_GFX5); int attr = tilerom[tile_index]; int code = attr & 0x3f; @@ -141,7 +141,7 @@ static TILE_GET_INFO( get_bg_tile_info ) static TILE_GET_INFO( get_fg_tile_info ) { - int code = memory_region(REGION_GFX5)[tile_index]; + int code = memory_region(machine, REGION_GFX5)[tile_index]; SET_TILE_INFO(2, code, 0, 0); } diff --git a/src/mame/video/exerion.c b/src/mame/video/exerion.c index 65d78711e1c..6a07fa01ced 100644 --- a/src/mame/video/exerion.c +++ b/src/mame/video/exerion.c @@ -120,7 +120,7 @@ VIDEO_START( exerion ) UINT8 *gfx; /* get pointers to the mixing and lookup PROMs */ - background_mixer = memory_region(REGION_PROMS) + 0x320; + background_mixer = memory_region(machine, REGION_PROMS) + 0x320; /* allocate memory for the decoded background graphics */ background_gfx[0] = auto_malloc(2 * 256 * 256 * 4); @@ -143,7 +143,7 @@ VIDEO_START( exerion ) * Where AA,BB,CC,DD are the 2bpp data for the pixel,and a,b,c,d are the OR * of these two bits together. */ - gfx = memory_region(REGION_GFX3); + gfx = memory_region(machine, REGION_GFX3); for (i = 0; i < 4; i++) { int y; diff --git a/src/mame/video/exprraid.c b/src/mame/video/exprraid.c index ebe3b98d316..646c6c3d330 100644 --- a/src/mame/video/exprraid.c +++ b/src/mame/video/exprraid.c @@ -46,7 +46,7 @@ WRITE8_HANDLER( exprraid_scrolly_w ) static TILE_GET_INFO( get_bg_tile_info ) { - UINT8 *tilerom = memory_region(REGION_GFX4); + UINT8 *tilerom = memory_region(machine, REGION_GFX4); int data, attr, bank, code, color, flags; int quadrant = 0, offs; diff --git a/src/mame/video/f1gp.c b/src/mame/video/f1gp.c index 7666bb29272..ab8ce0e8a77 100644 --- a/src/mame/video/f1gp.c +++ b/src/mame/video/f1gp.c @@ -66,7 +66,7 @@ VIDEO_START( f1gp ) dirtychar = auto_malloc(TOTAL_CHARS); memset(dirtychar,1,TOTAL_CHARS); - zoomdata = (UINT16 *)memory_region(REGION_GFX4); + zoomdata = (UINT16 *)memory_region(machine, REGION_GFX4); } VIDEO_START( f1gpb ) @@ -79,7 +79,7 @@ VIDEO_START( f1gpb ) dirtychar = auto_malloc(TOTAL_CHARS); memset(dirtychar,1,TOTAL_CHARS); - zoomdata = (UINT16 *)memory_region(REGION_GFX4); + zoomdata = (UINT16 *)memory_region(machine, REGION_GFX4); } VIDEO_START( f1gp2 ) @@ -99,7 +99,7 @@ VIDEO_START( f1gp2 ) dirtychar = auto_malloc(TOTAL_CHARS); memset(dirtychar,1,TOTAL_CHARS); - zoomdata = (UINT16 *)memory_region(REGION_GFX4); + zoomdata = (UINT16 *)memory_region(machine, REGION_GFX4); } diff --git a/src/mame/video/fcombat.c b/src/mame/video/fcombat.c index 6acbff1589b..0f92dd447e8 100644 --- a/src/mame/video/fcombat.c +++ b/src/mame/video/fcombat.c @@ -27,8 +27,8 @@ static TILE_GET_INFO( get_bg_tile_info ) //palno=(tile_index-(tile_index/32*16)*32*16)/32; - tileno = memory_region(REGION_USER1)[tile_index]; - palno=0x18;//memory_region(REGION_USER2)[tile_index]>>3; + tileno = memory_region(machine, REGION_USER1)[tile_index]; + palno=0x18;//memory_region(machine, REGION_USER2)[tile_index]>>3; SET_TILE_INFO(2,tileno,palno,0); } diff --git a/src/mame/video/galaxian.c b/src/mame/video/galaxian.c index 42ea49ee06e..debe3f97008 100644 --- a/src/mame/video/galaxian.c +++ b/src/mame/video/galaxian.c @@ -343,7 +343,7 @@ PALETTE_INIT( galaxian ) 2, &rgb_resistances[1], bweights, 470, 0); /* decode the palette first */ - len = memory_region_length(REGION_PROMS); + len = memory_region_length(machine, REGION_PROMS); for (i = 0; i < len; i++) { UINT8 bit0, bit1, bit2, r, g, b; @@ -1011,7 +1011,7 @@ void frogger_draw_background(running_machine *machine, bitmap_t *bitmap, const r void amidar_draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) { - const UINT8 *prom = memory_region(REGION_USER1); + const UINT8 *prom = memory_region(machine, REGION_USER1); rectangle draw; int x; diff --git a/src/mame/video/galaxold.c b/src/mame/video/galaxold.c index f34e39c4fb1..860bb33235c 100644 --- a/src/mame/video/galaxold.c +++ b/src/mame/video/galaxold.c @@ -5,6 +5,7 @@ ***************************************************************************/ #include "driver.h" +#include "deprecat.h" #include "includes/galaxold.h" static const rectangle _spritevisiblearea = @@ -22,7 +23,7 @@ static const rectangle* spritevisiblearea; static const rectangle* spritevisibleareaflipx; -#define STARS_COLOR_BASE (memory_region_length(REGION_PROMS)) +#define STARS_COLOR_BASE (memory_region_length(Machine, REGION_PROMS)) #define BULLETS_COLOR_BASE (STARS_COLOR_BASE + 64) #define BACKGROUND_COLOR_BASE (BULLETS_COLOR_BASE + 2) @@ -169,7 +170,7 @@ PALETTE_INIT( galaxold ) /* first, the character/sprite palette */ - len = memory_region_length(REGION_PROMS); + len = memory_region_length(machine, REGION_PROMS); for (i = 0;i < len;i++) { int bit0,bit1,bit2,r,g,b; @@ -242,7 +243,7 @@ PALETTE_INIT( rockclim ) /* first, the character/sprite palette */ - len = memory_region_length(REGION_PROMS); + len = memory_region_length(machine, REGION_PROMS); for (i = 0;i < len;i++) { int bit0,bit1,bit2,r,g,b; @@ -1121,7 +1122,7 @@ static void mariner_modify_charcode(UINT16 *code,UINT8 x) /* bit 0 of the PROM controls character banking */ - prom = memory_region(REGION_USER2); + prom = memory_region(Machine, REGION_USER2); *code |= ((prom[x] & 0x01) << 8); } @@ -1299,7 +1300,7 @@ static void stratgyx_draw_background(bitmap_t *bitmap, const rectangle *cliprect the green gun if BCG is asserted bits 2-7 are unconnected */ - prom = memory_region(REGION_USER1); + prom = memory_region(Machine, REGION_USER1); for (x = 0; x < 32; x++) { @@ -1368,7 +1369,7 @@ static void mariner_draw_background(bitmap_t *bitmap, const rectangle *cliprect) line (column) of the screen. The first 0x20 bytes for unflipped, and the 2nd 0x20 bytes for flipped screen. */ - prom = memory_region(REGION_USER1); + prom = memory_region(Machine, REGION_USER1); if (flipscreen_x) { @@ -1663,7 +1664,7 @@ static void mariner_draw_stars(running_machine *machine, bitmap_t *bitmap, const /* bit 2 of the PROM controls star visibility */ - prom = memory_region(REGION_USER2); + prom = memory_region(machine, REGION_USER2); for (offs = 0;offs < STAR_COUNT;offs++) { diff --git a/src/mame/video/galivan.c b/src/mame/video/galivan.c index 0e76299860c..894f24fdd2c 100644 --- a/src/mame/video/galivan.c +++ b/src/mame/video/galivan.c @@ -127,7 +127,7 @@ PALETTE_INIT( galivan ) static TILE_GET_INFO( get_bg_tile_info ) { - UINT8 *BGROM = memory_region(REGION_GFX4); + UINT8 *BGROM = memory_region(machine, REGION_GFX4); int attr = BGROM[tile_index + 0x4000]; int code = BGROM[tile_index] | ((attr & 0x03) << 8); SET_TILE_INFO( @@ -151,7 +151,7 @@ static TILE_GET_INFO( get_tx_tile_info ) static TILE_GET_INFO( ninjemak_get_bg_tile_info ) { - UINT8 *BGROM = memory_region(REGION_GFX4); + UINT8 *BGROM = memory_region(machine, REGION_GFX4); int attr = BGROM[tile_index + 0x4000]; int code = BGROM[tile_index] | ((attr & 0x03) << 8); SET_TILE_INFO( @@ -183,7 +183,7 @@ static TILE_GET_INFO( ninjemak_get_tx_tile_info ) VIDEO_START( galivan ) { /* configure ROM banking */ - UINT8 *rombase = memory_region(REGION_CPU1); + UINT8 *rombase = memory_region(machine, REGION_CPU1); memory_configure_bank(1, 0, 2, &rombase[0x10000], 0x2000); bg_tilemap = tilemap_create(get_bg_tile_info,tilemap_scan_rows, 16,16,128,128); @@ -202,7 +202,7 @@ VIDEO_START( galivan ) VIDEO_START( ninjemak ) { /* configure ROM banking */ - UINT8 *rombase = memory_region(REGION_CPU1); + UINT8 *rombase = memory_region(machine, REGION_CPU1); memory_configure_bank(1, 0, 4, &rombase[0x10000], 0x2000); bg_tilemap = tilemap_create(ninjemak_get_bg_tile_info,tilemap_scan_cols, 16,16,512,32); @@ -350,7 +350,7 @@ WRITE8_HANDLER( ninjemak_scrolly_w ) static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) { - const UINT8 *spritepalettebank = memory_region(REGION_USER1); + const UINT8 *spritepalettebank = memory_region(machine, REGION_USER1); int offs; /* draw the sprites */ diff --git a/src/mame/video/ginganin.c b/src/mame/video/ginganin.c index 997de5f1fa2..45c8290c520 100644 --- a/src/mame/video/ginganin.c +++ b/src/mame/video/ginganin.c @@ -84,7 +84,7 @@ UINT16 *ginganin_fgram16, *ginganin_txtram16, *ginganin_vregs16; static TILE_GET_INFO( get_bg_tile_info ) { - UINT8 *gfx = memory_region(REGION_GFX5); + UINT8 *gfx = memory_region(machine, REGION_GFX5); int code = gfx[2*tile_index + 0] * 256 + gfx[2*tile_index + 1]; SET_TILE_INFO( BG_GFX, diff --git a/src/mame/video/glass.c b/src/mame/video/glass.c index 5eef51fe533..5870c00a9fc 100644 --- a/src/mame/video/glass.c +++ b/src/mame/video/glass.c @@ -91,7 +91,7 @@ WRITE16_HANDLER( glass_blitter_w ) /* fill the screen bitmap with the current picture */ { int i, j; - UINT8 *gfx = (UINT8 *)memory_region(REGION_GFX3); + UINT8 *gfx = (UINT8 *)memory_region(machine, REGION_GFX3); gfx = gfx + (current_command & 0x07)*0x10000 + (current_command & 0x08)*0x10000 + 0x140; diff --git a/src/mame/video/gomoku.c b/src/mame/video/gomoku.c index c8a93e8cbbb..ff93f3a0d8c 100644 --- a/src/mame/video/gomoku.c +++ b/src/mame/video/gomoku.c @@ -112,9 +112,9 @@ WRITE8_HANDLER( gomoku_bg_dispsw_w ) VIDEO_START( gomoku ) { - UINT8 *GOMOKU_BG_X = memory_region( REGION_USER1 ); - UINT8 *GOMOKU_BG_Y = memory_region( REGION_USER2 ); - UINT8 *GOMOKU_BG_D = memory_region( REGION_USER3 ); + UINT8 *GOMOKU_BG_X = memory_region( machine, REGION_USER1 ); + UINT8 *GOMOKU_BG_Y = memory_region( machine, REGION_USER2 ); + UINT8 *GOMOKU_BG_D = memory_region( machine, REGION_USER3 ); int x, y; int bgdata; int color; @@ -154,9 +154,9 @@ VIDEO_START( gomoku ) VIDEO_UPDATE( gomoku ) { - UINT8 *GOMOKU_BG_X = memory_region( REGION_USER1 ); - UINT8 *GOMOKU_BG_Y = memory_region( REGION_USER2 ); - UINT8 *GOMOKU_BG_D = memory_region( REGION_USER3 ); + UINT8 *GOMOKU_BG_X = memory_region( screen->machine, REGION_USER1 ); + UINT8 *GOMOKU_BG_Y = memory_region( screen->machine, REGION_USER2 ); + UINT8 *GOMOKU_BG_D = memory_region( screen->machine, REGION_USER3 ); int x, y; int bgram; int bgoffs; diff --git a/src/mame/video/gradius3.c b/src/mame/video/gradius3.c index 5f1fbe6cdab..8f308a90afd 100644 --- a/src/mame/video/gradius3.c +++ b/src/mame/video/gradius3.c @@ -77,7 +77,7 @@ VIDEO_START( gradius3 ) /* re-decode the sprites because the ROMs are connected to the custom IC differently from how they are connected to the CPU. */ for (i = 0;i < TOTAL_SPRITES;i++) - decodechar(machine->gfx[1],i,memory_region(REGION_GFX2)); + decodechar(machine->gfx[1],i,memory_region(machine, REGION_GFX2)); dirtychar = auto_malloc(TOTAL_CHARS); memset(dirtychar,1,TOTAL_CHARS); @@ -93,7 +93,7 @@ VIDEO_START( gradius3 ) READ16_HANDLER( gradius3_gfxrom_r ) { - UINT8 *gfxdata = memory_region(REGION_GFX2); + UINT8 *gfxdata = memory_region(machine, REGION_GFX2); return (gfxdata[2*offset+1] << 8) | gfxdata[2*offset]; } diff --git a/src/mame/video/grchamp.c b/src/mame/video/grchamp.c index 0e70a52628f..0a6f389ec54 100644 --- a/src/mame/video/grchamp.c +++ b/src/mame/video/grchamp.c @@ -250,7 +250,7 @@ static void draw_objects(running_machine *machine, grchamp_state *state, int y, */ - const UINT8 *prom = memory_region(REGION_PROMS) + 0x20; + const UINT8 *prom = memory_region(machine, REGION_PROMS) + 0x20; const gfx_element *gfx; int change = (state->cpu0_out[0] & 0x20) << 3; int num; @@ -369,9 +369,9 @@ VIDEO_UPDATE( grchamp ) }; grchamp_state *state = screen->machine->driver_data; - const UINT8 *amedata = memory_region(REGION_GFX5); - const UINT8 *headdata = memory_region(REGION_GFX6); - const UINT8 *pldata = memory_region(REGION_GFX7); + const UINT8 *amedata = memory_region(screen->machine, REGION_GFX5); + const UINT8 *headdata = memory_region(screen->machine, REGION_GFX6); + const UINT8 *pldata = memory_region(screen->machine, REGION_GFX7); bitmap_t *lpixmap = tilemap_get_pixmap(state->left_tilemap); bitmap_t *rpixmap = tilemap_get_pixmap(state->right_tilemap); bitmap_t *cpixmap = tilemap_get_pixmap(state->center_tilemap); diff --git a/src/mame/video/gridlee.c b/src/mame/video/gridlee.c index c363151b8cd..13c7ee51db9 100644 --- a/src/mame/video/gridlee.c +++ b/src/mame/video/gridlee.c @@ -153,7 +153,7 @@ VIDEO_UPDATE( gridlee ) } /* draw the sprite images */ - gfx = memory_region(REGION_GFX1); + gfx = memory_region(screen->machine, REGION_GFX1); for (i = 0; i < 32; i++) { UINT8 *sprite = spriteram + i * 4; diff --git a/src/mame/video/groundfx.c b/src/mame/video/groundfx.c index b2e2df0047c..7ac7228c659 100644 --- a/src/mame/video/groundfx.c +++ b/src/mame/video/groundfx.c @@ -83,7 +83,7 @@ Heavy use is made of sprite zooming. static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int do_hack,int x_offs,int y_offs) { - UINT16 *spritemap = (UINT16 *)memory_region(REGION_USER1); + UINT16 *spritemap = (UINT16 *)memory_region(machine, REGION_USER1); int offs, data, tilenum, color, flipx, flipy; int x, y, priority, dblsize, curx, cury; int sprites_flipscreen = 0; diff --git a/src/mame/video/gticlub.c b/src/mame/video/gticlub.c index bfc38ead4f0..9b0b853deda 100644 --- a/src/mame/video/gticlub.c +++ b/src/mame/video/gticlub.c @@ -1,4 +1,5 @@ #include "driver.h" +#include "deprecat.h" #include "cpu/sharc/sharc.h" #include "machine/konppc.h" #include "video/poly.h" @@ -42,7 +43,7 @@ static int K001006_device_sel[MAX_K001006_CHIPS] = { 0, 0 }; static UINT32 K001006_palette[MAX_K001006_CHIPS][0x800]; -static UINT32 K001006_r(int chip, int offset, UINT32 mem_mask) +static UINT32 K001006_r(running_machine *machine, int chip, int offset, UINT32 mem_mask) { if (offset == 1) { @@ -50,7 +51,7 @@ static UINT32 K001006_r(int chip, int offset, UINT32 mem_mask) { case 0x0b: // CG Board ROM read { - UINT16 *rom = (UINT16*)memory_region(REGION_GFX1); + UINT16 *rom = (UINT16*)memory_region(machine, REGION_GFX1); return rom[K001006_addr[chip] / 2] << 16; } case 0x0d: // Palette RAM read @@ -125,7 +126,7 @@ static void K001006_w(int chip, int offset, UINT32 data, UINT32 mem_mask) READ32_HANDLER(K001006_0_r) { - return K001006_r(0, offset, mem_mask); + return K001006_r(machine, 0, offset, mem_mask); } WRITE32_HANDLER(K001006_0_w) @@ -135,7 +136,7 @@ WRITE32_HANDLER(K001006_0_w) READ32_HANDLER(K001006_1_r) { - return K001006_r(1, offset, mem_mask); + return K001006_r(machine, 1, offset, mem_mask); } WRITE32_HANDLER(K001006_1_w) @@ -468,7 +469,7 @@ static void draw_scanline_tex(void *dest, INT32 scanline, const poly_extent *ext { const poly_extra_data *extra = extradata; bitmap_t *destmap = dest; - UINT8 *texrom = memory_region(REGION_GFX1) + (extra->texture_page * 0x40000); + UINT8 *texrom = memory_region(Machine, REGION_GFX1) + (extra->texture_page * 0x40000); int pal_chip = (extra->texture_palette & 0x8) ? 1 : 0; int palette_index = (extra->texture_palette & 0x7) * 256; float z = extent->param[0].start; @@ -1007,7 +1008,7 @@ VIDEO_UPDATE( gticlub ) int index = (debug_tex_page - 1) * 0x40000; int pal = debug_tex_palette & 7; int tp = (debug_tex_palette >> 3) & 1; - UINT8 *rom = memory_region(REGION_GFX1); + UINT8 *rom = memory_region(machine, REGION_GFX1); for (y=0; y < 384; y++) { diff --git a/src/mame/video/gunbustr.c b/src/mame/video/gunbustr.c index 3e4e1c6ae6b..5af720772f6 100644 --- a/src/mame/video/gunbustr.c +++ b/src/mame/video/gunbustr.c @@ -71,7 +71,7 @@ Heavy use is made of sprite zooming. static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,const int *primasks,int x_offs,int y_offs) { - UINT16 *spritemap = (UINT16 *)memory_region(REGION_USER1); + UINT16 *spritemap = (UINT16 *)memory_region(machine, REGION_USER1); int offs, data, tilenum, color, flipx, flipy; int x, y, priority, dblsize, curx, cury; int sprites_flipscreen = 0; diff --git a/src/mame/video/gunsmoke.c b/src/mame/video/gunsmoke.c index a3db2253c27..7b3da8ef7ff 100644 --- a/src/mame/video/gunsmoke.c +++ b/src/mame/video/gunsmoke.c @@ -108,7 +108,7 @@ WRITE8_HANDLER( gunsmoke_d806_w ) static TILE_GET_INFO( get_bg_tile_info ) { - UINT8 *tilerom = memory_region(REGION_GFX4); + UINT8 *tilerom = memory_region(machine, REGION_GFX4); int offs = tile_index * 2; int attr = tilerom[offs + 1]; @@ -133,7 +133,7 @@ static TILE_GET_INFO( get_fg_tile_info ) VIDEO_START( gunsmoke ) { /* configure ROM banking */ - UINT8 *rombase = memory_region(REGION_CPU1); + UINT8 *rombase = memory_region(machine, REGION_CPU1); memory_configure_bank(1, 0, 4, &rombase[0x10000], 0x4000); /* create tilemaps */ diff --git a/src/mame/video/hexa.c b/src/mame/video/hexa.c index 45b48da130c..5c1856b65d3 100644 --- a/src/mame/video/hexa.c +++ b/src/mame/video/hexa.c @@ -19,7 +19,7 @@ WRITE8_HANDLER( hexa_videoram_w ) WRITE8_HANDLER( hexa_d008_w ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); int bankaddress; /* bit 0 = flipx (or y?) */ diff --git a/src/mame/video/hexion.c b/src/mame/video/hexion.c index f70cb61328c..96d301c0d1e 100644 --- a/src/mame/video/hexion.c +++ b/src/mame/video/hexion.c @@ -50,7 +50,7 @@ VIDEO_START( hexion ) tilemap_set_scrollx(bg_tilemap[1],0,-4); tilemap_set_scrolly(bg_tilemap[1],0,4); - vram[0] = memory_region(REGION_CPU1) + 0x30000; + vram[0] = memory_region(machine, REGION_CPU1) + 0x30000; vram[1] = vram[0] + 0x2000; unkram = vram[1] + 0x2000; } @@ -65,7 +65,7 @@ VIDEO_START( hexion ) WRITE8_HANDLER( hexion_bankswitch_w ) { - UINT8 *rom = memory_region(REGION_CPU1) + 0x10000; + UINT8 *rom = memory_region(machine, REGION_CPU1) + 0x10000; /* bits 0-3 select ROM bank */ memory_set_bankptr(1,rom + 0x2000 * (data & 0x0f)); @@ -91,7 +91,7 @@ READ8_HANDLER( hexion_bankedram_r ) { if (gfxrom_select && offset < 0x1000) { - return memory_region(REGION_GFX1)[((gfxrom_select & 0x7f) << 12) + offset]; + return memory_region(machine, REGION_GFX1)[((gfxrom_select & 0x7f) << 12) + offset]; } else if (bankctrl == 0) { diff --git a/src/mame/video/hnayayoi.c b/src/mame/video/hnayayoi.c index 820d9e3756e..4af9dca9dff 100644 --- a/src/mame/video/hnayayoi.c +++ b/src/mame/video/hnayayoi.c @@ -121,8 +121,8 @@ static void copy_pixel(int x,int y,int pen) WRITE8_HANDLER( dynax_blitter_rev1_start_w ) { - UINT8 *rom = memory_region(REGION_GFX1); - int romlen = memory_region_length(REGION_GFX1); + UINT8 *rom = memory_region(machine, REGION_GFX1); + int romlen = memory_region_length(machine, REGION_GFX1); int sx = blit_dest & 0xff; int sy = blit_dest >> 8; int x,y; diff --git a/src/mame/video/hng64.c b/src/mame/video/hng64.c index faece8968d1..0e621beeb2f 100644 --- a/src/mame/video/hng64.c +++ b/src/mame/video/hng64.c @@ -518,7 +518,7 @@ static void draw3d(running_machine *machine, bitmap_t *bitmap, const rectangle * // GEOMETRY ; - threeDRoms = memory_region(REGION_GFX4) ; + threeDRoms = memory_region(machine, REGION_GFX4) ; ///////////////////////// // GET THE HEADER INFO // @@ -1716,7 +1716,7 @@ INLINE void FillSmoothTexPCHorizontalLine(running_machine *machine, bitmap_t *Co { float *dp = &(depthBuffer[y*video_screen_get_visible_area(machine->primary_screen)->max_x+x_start]); - const UINT8 *gfx = memory_region(REGION_GFX3); + const UINT8 *gfx = memory_region(machine, REGION_GFX3); const UINT8 *textureOffset ; UINT8 paletteEntry ; float t_coord, s_coord ; diff --git a/src/mame/video/homedata.c b/src/mame/video/homedata.c index cb35d69b930..9d36c5a0411 100644 --- a/src/mame/video/homedata.c +++ b/src/mame/video/homedata.c @@ -56,7 +56,7 @@ static void mrokumei_handleblit( running_machine *machine, int rom_base ) int DestAddr; int BaseAddr; int opcode,data,NumTiles; - UINT8 *pBlitData = memory_region(REGION_USER1) + rom_base; + UINT8 *pBlitData = memory_region(machine, REGION_USER1) + rom_base; DestParam = blitter_param[(blitter_param_count-4)&3]*256+ @@ -142,7 +142,7 @@ static void reikaids_handleblit( running_machine *machine, int rom_base ) int flipx; int SourceAddr, BaseAddr; int DestAddr; - UINT8 *pBlitData = memory_region(REGION_USER1) + rom_base; + UINT8 *pBlitData = memory_region(machine, REGION_USER1) + rom_base; int opcode,data,NumTiles; @@ -242,7 +242,7 @@ static void pteacher_handleblit( running_machine *machine, int rom_base ) int SourceAddr; int DestAddr, BaseAddr; int opcode,data,NumTiles; - UINT8 *pBlitData = memory_region(REGION_USER1) + rom_base; + UINT8 *pBlitData = memory_region(machine, REGION_USER1) + rom_base; DestParam = blitter_param[(blitter_param_count-4)&3]*256+ @@ -663,7 +663,7 @@ WRITE8_HANDLER( reikaids_blitter_start_w ) WRITE8_HANDLER( pteacher_blitter_start_w ) { - pteacher_handleblit(machine, (blitter_bank >> 5) * 0x10000 & (memory_region_length(REGION_USER1) - 1)); + pteacher_handleblit(machine, (blitter_bank >> 5) * 0x10000 & (memory_region_length(machine, REGION_USER1) - 1)); } diff --git a/src/mame/video/homerun.c b/src/mame/video/homerun.c index 7818984ab9a..e08072e0ac8 100644 --- a/src/mame/video/homerun.c +++ b/src/mame/video/homerun.c @@ -20,9 +20,9 @@ WRITE8_HANDLER(homerun_banking_w) data>>=5; if(!data) - memory_set_bankptr(1, memory_region(REGION_CPU1) ); + memory_set_bankptr(1, memory_region(machine, REGION_CPU1) ); else - memory_set_bankptr(1, memory_region(REGION_CPU1) + 0x10000 + (((data-1)&0x7)*0x4000 )); + memory_set_bankptr(1, memory_region(machine, REGION_CPU1) + 0x10000 + (((data-1)&0x7)*0x4000 )); } WRITE8_HANDLER( homerun_videoram_w ) diff --git a/src/mame/video/hyhoo.c b/src/mame/video/hyhoo.c index 992789d3c56..d161003cd40 100644 --- a/src/mame/video/hyhoo.c +++ b/src/mame/video/hyhoo.c @@ -22,7 +22,7 @@ static int hyhoo_highcolorflag; static int hyhoo_flipscreen; static bitmap_t *hyhoo_tmpbitmap; -static void hyhoo_gfxdraw(void); +static void hyhoo_gfxdraw(running_machine *machine); WRITE8_HANDLER( hyhoo_blitter_w ) @@ -38,7 +38,7 @@ WRITE8_HANDLER( hyhoo_blitter_w ) case 0x04: blitter_sizex = data; break; case 0x05: blitter_sizey = data; /* writing here also starts the blit */ - hyhoo_gfxdraw(); + hyhoo_gfxdraw(machine); break; case 0x06: blitter_direction_x = (data >> 0) & 0x01; blitter_direction_y = (data >> 1) & 0x01; @@ -52,7 +52,7 @@ WRITE8_HANDLER( hyhoo_blitter_w ) WRITE8_HANDLER( hyhoo_romsel_w ) { - int gfxlen = memory_region_length(REGION_GFX1); + int gfxlen = memory_region_length(machine, REGION_GFX1); hyhoo_gfxrom = (((data & 0xc0) >> 4) + (data & 0x03)); hyhoo_highcolorflag = data; nb1413m3_gfxrombank_w(machine, 0, data); @@ -72,9 +72,9 @@ static TIMER_CALLBACK( blitter_timer_callback ) nb1413m3_busyflag = 1; } -void hyhoo_gfxdraw(void) +static void hyhoo_gfxdraw(running_machine *machine) { - UINT8 *GFX = memory_region(REGION_GFX1); + UINT8 *GFX = memory_region(machine, REGION_GFX1); int x, y; int dx1, dx2, dy; @@ -116,7 +116,7 @@ void hyhoo_gfxdraw(void) skipy = -1; } - gfxlen = memory_region_length(REGION_GFX1); + gfxlen = memory_region_length(machine, REGION_GFX1); gfxaddr = (hyhoo_gfxrom << 17) + (blitter_src_addr << 1); for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--) diff --git a/src/mame/video/hyprduel.c b/src/mame/video/hyprduel.c index 36a10676000..6466752d80e 100644 --- a/src/mame/video/hyprduel.c +++ b/src/mame/video/hyprduel.c @@ -395,8 +395,8 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta { const int region = REGION_GFX1; - UINT8 *base_gfx = memory_region(region); - UINT8 *gfx_max = base_gfx + memory_region_length(region); + UINT8 *base_gfx = memory_region(machine, region); + UINT8 *gfx_max = base_gfx + memory_region_length(machine, region); int max_x = video_screen_get_width(machine->primary_screen); int max_y = video_screen_get_height(machine->primary_screen); diff --git a/src/mame/video/ikki.c b/src/mame/video/ikki.c index d33028c8789..2426dd52d02 100644 --- a/src/mame/video/ikki.c +++ b/src/mame/video/ikki.c @@ -127,7 +127,7 @@ VIDEO_START( ikki ) VIDEO_UPDATE( ikki ) { offs_t offs; - UINT8 *VIDEOATTR = memory_region( REGION_USER1 ); + UINT8 *VIDEOATTR = memory_region( screen->machine, REGION_USER1 ); /* draw bg layer */ diff --git a/src/mame/video/itech32.c b/src/mame/video/itech32.c index 08e1d06bab1..b051647ea6e 100644 --- a/src/mame/video/itech32.c +++ b/src/mame/video/itech32.c @@ -221,8 +221,8 @@ VIDEO_START( itech32 ) videoplane[0][i] = videoplane[1][i] = 0xff; /* fetch the GROM base */ - grom_base = memory_region(REGION_GFX1); - grom_size = memory_region_length(REGION_GFX1); + grom_base = memory_region(machine, REGION_GFX1); + grom_size = memory_region_length(machine, REGION_GFX1); grom_bank = 0; grom_bank_mask = grom_size >> 24; if (grom_bank_mask == 2) diff --git a/src/mame/video/itech8.c b/src/mame/video/itech8.c index 79679842dcd..dff682a325f 100644 --- a/src/mame/video/itech8.c +++ b/src/mame/video/itech8.c @@ -198,8 +198,8 @@ VIDEO_START( itech8 ) page_select = 0xc0; /* fetch the GROM base */ - grom_base = memory_region(REGION_GFX1); - grom_size = memory_region_length(REGION_GFX1); + grom_base = memory_region(machine, REGION_GFX1); + grom_size = memory_region_length(machine, REGION_GFX1); } diff --git a/src/mame/video/jackal.c b/src/mame/video/jackal.c index 11950a64363..e83f7842458 100644 --- a/src/mame/video/jackal.c +++ b/src/mame/video/jackal.c @@ -66,7 +66,7 @@ void jackal_mark_tile_dirty(int offset) static TILE_GET_INFO( get_bg_tile_info ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); int attr = RAM[0x2000 + tile_index]; int code = RAM[0x2400 + tile_index] + ((attr & 0xc0) << 2) + ((attr & 0x30) << 6); @@ -81,9 +81,9 @@ VIDEO_START( jackal ) bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32); } -static void draw_background( bitmap_t *bitmap, const rectangle *cliprect ) +static void draw_background( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); int i; jackal_scrollram = &RAM[0x0020]; @@ -204,7 +204,7 @@ static void draw_sprites_region(running_machine *machine, bitmap_t *bitmap, cons static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); UINT8 *sr, *ss; if (jackal_videoctrl[0x03] & 0x08) @@ -225,7 +225,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta VIDEO_UPDATE( jackal ) { set_pens(screen->machine->colortable); - draw_background(bitmap, cliprect); + draw_background(screen->machine, bitmap, cliprect); draw_sprites(screen->machine, bitmap, cliprect); return 0; } diff --git a/src/mame/video/jcross.c b/src/mame/video/jcross.c index 4f9233684d0..a10568f15a9 100644 --- a/src/mame/video/jcross.c +++ b/src/mame/video/jcross.c @@ -18,7 +18,7 @@ WRITE8_HANDLER( jcross_palettebank_w ) static void stuff_palette( running_machine *machine, int source_index, int dest_index, int num_colors ) { - UINT8 *color_prom = memory_region(REGION_PROMS) + source_index; + UINT8 *color_prom = memory_region(machine, REGION_PROMS) + source_index; int i; for( i=0; i<num_colors; i++ ) { diff --git a/src/mame/video/jedi.c b/src/mame/video/jedi.c index 122ee38f120..3dacf99f47c 100644 --- a/src/mame/video/jedi.c +++ b/src/mame/video/jedi.c @@ -132,15 +132,15 @@ WRITE8_HANDLER( jedi_hscroll_w ) * *************************************/ -static void draw_background_and_text(jedi_state *state, bitmap_t *bitmap, const rectangle *cliprect) +static void draw_background_and_text(running_machine *machine, jedi_state *state, bitmap_t *bitmap, const rectangle *cliprect) { int y; int background_line_buffer[0x200]; /* RAM chip at 2A */ - UINT8 *tx_gfx = memory_region(REGION_GFX1); - UINT8 *bg_gfx = memory_region(REGION_GFX2); - UINT8 *prom1 = &memory_region(REGION_PROMS)[0x0000 | ((*state->smoothing_table & 0x03) << 8)]; - UINT8 *prom2 = &memory_region(REGION_PROMS)[0x0800 | ((*state->smoothing_table & 0x03) << 8)]; + UINT8 *tx_gfx = memory_region(machine, REGION_GFX1); + UINT8 *bg_gfx = memory_region(machine, REGION_GFX2); + UINT8 *prom1 = &memory_region(machine, REGION_PROMS)[0x0000 | ((*state->smoothing_table & 0x03) << 8)]; + UINT8 *prom2 = &memory_region(machine, REGION_PROMS)[0x0800 | ((*state->smoothing_table & 0x03) << 8)]; int vscroll = state->vscroll; int hscroll = state->hscroll; int tx_bank = *state->foreground_bank; @@ -232,11 +232,11 @@ static void draw_background_and_text(jedi_state *state, bitmap_t *bitmap, const * *************************************/ -static void draw_sprites(jedi_state *state, bitmap_t *bitmap, const rectangle *cliprect) +static void draw_sprites(running_machine *machine, jedi_state *state, bitmap_t *bitmap, const rectangle *cliprect) { offs_t offs; UINT8 *spriteram = state->spriteram; - UINT8 *gfx3 = memory_region(REGION_GFX3); + UINT8 *gfx3 = memory_region(machine, REGION_GFX3); for (offs = 0x00; offs < 0x30; offs++) { @@ -338,8 +338,8 @@ static VIDEO_UPDATE( jedi ) { /* draw the background/text layers, followed by the sprites - it needs to be done in this order*/ - draw_background_and_text(state, bitmap, cliprect); - draw_sprites(state, bitmap, cliprect); + draw_background_and_text(screen->machine, state, bitmap, cliprect); + draw_sprites(screen->machine, state, bitmap, cliprect); do_pen_lookup(state, bitmap, cliprect); } diff --git a/src/mame/video/kaneko16.c b/src/mame/video/kaneko16.c index 73331366668..f7c2fb61d4d 100644 --- a/src/mame/video/kaneko16.c +++ b/src/mame/video/kaneko16.c @@ -245,7 +245,7 @@ PALETTE_INIT( berlwall ) VIDEO_START( berlwall ) { int sx, x,y; - UINT8 *RAM = memory_region(REGION_GFX3); + UINT8 *RAM = memory_region(machine, REGION_GFX3); /* Render the hi-color static backgrounds held in the ROMs */ diff --git a/src/mame/video/kangaroo.c b/src/mame/video/kangaroo.c index 205fb5bb934..6af49c96658 100644 --- a/src/mame/video/kangaroo.c +++ b/src/mame/video/kangaroo.c @@ -11,7 +11,7 @@ UINT8 *kangaroo_video_control; -static void blitter_execute(void); +static void blitter_execute(running_machine *machine); @@ -83,7 +83,7 @@ WRITE8_HANDLER( kangaroo_video_control_w ) switch (offset) { case 5: /* blitter start */ - blitter_execute(); + blitter_execute(machine); break; case 8: /* bank select */ @@ -100,10 +100,10 @@ WRITE8_HANDLER( kangaroo_video_control_w ) * *************************************/ -static void blitter_execute(void) +static void blitter_execute(running_machine *machine) { - UINT32 gfxhalfsize = memory_region_length(REGION_GFX1) / 2; - const UINT8 *gfxbase = memory_region(REGION_GFX1); + UINT32 gfxhalfsize = memory_region_length(machine, REGION_GFX1) / 2; + const UINT8 *gfxbase = memory_region(machine, REGION_GFX1); UINT16 src = kangaroo_video_control[0] + 256 * kangaroo_video_control[1]; UINT16 dst = kangaroo_video_control[2] + 256 * kangaroo_video_control[3]; UINT8 height = kangaroo_video_control[5]; diff --git a/src/mame/video/kncljoe.c b/src/mame/video/kncljoe.c index bcc02e33c45..225667a9d84 100644 --- a/src/mame/video/kncljoe.c +++ b/src/mame/video/kncljoe.c @@ -157,7 +157,7 @@ WRITE8_HANDLER( kncljoe_control_w ) if (sprite_bank != i) { sprite_bank = i; - memset(memory_region(REGION_CPU1)+0xf100, 0, 0x180); + memset(memory_region(machine, REGION_CPU1)+0xf100, 0, 0x180); } } diff --git a/src/mame/video/konamigx.c b/src/mame/video/konamigx.c index 0c7df0987fc..37c0fbc6bab 100644 --- a/src/mame/video/konamigx.c +++ b/src/mame/video/konamigx.c @@ -34,7 +34,7 @@ static TILE_GET_INFO( get_gx_psac_tile_info ) static TILE_GET_INFO( get_gx_psac3_tile_info ) { int tileno, colour, flip; - UINT8 *tmap = memory_region(REGION_GFX4); + UINT8 *tmap = memory_region(machine, REGION_GFX4); tileno = tmap[tile_index*2] | ((tmap[(tile_index*2)+1] & 0x0f)<<8); colour = (psac_colorbase << 8); diff --git a/src/mame/video/konamiic.c b/src/mame/video/konamiic.c index 32510c8d441..28facb1408d 100644 --- a/src/mame/video/konamiic.c +++ b/src/mame/video/konamiic.c @@ -1149,6 +1149,7 @@ Registers (word-wise): ***************************************************************************/ #include "driver.h" +#include "deprecat.h" #include "video/konamiic.h" #define VERBOSE 0 @@ -1185,16 +1186,16 @@ static void shuffle(UINT16 *buf,int len) /* helper function to join two 16-bit ROMs and form a 32-bit data stream */ void konami_rom_deinterleave_2(int mem_region) { - shuffle((UINT16 *)memory_region(mem_region),memory_region_length(mem_region)/2); + shuffle((UINT16 *)memory_region(Machine, mem_region),memory_region_length(Machine, mem_region)/2); } /* hacked version of rom_deinterleave_2_half for Lethal Enforcers */ void konami_rom_deinterleave_2_half(int mem_region) { - UINT8 *rgn = memory_region(mem_region); + UINT8 *rgn = memory_region(Machine, mem_region); - shuffle((UINT16 *)rgn,memory_region_length(mem_region)/4); - shuffle((UINT16 *)(rgn+memory_region_length(mem_region)/2),memory_region_length(mem_region)/4); + shuffle((UINT16 *)rgn,memory_region_length(Machine, mem_region)/4); + shuffle((UINT16 *)(rgn+memory_region_length(Machine, mem_region)/2),memory_region_length(Machine, mem_region)/4); } /* helper function to join four 16-bit ROMs and form a 64-bit data stream */ @@ -2019,13 +2020,13 @@ void K052109_vh_start(running_machine *machine,int gfx_memory_region,int plane_o switch (plane_order) { case NORMAL_PLANE_ORDER: - total = memory_region_length(gfx_memory_region) / 32; - decode_gfx(machine, gfx_index, memory_region(gfx_memory_region), total, &charlayout, 4); + total = memory_region_length(machine, gfx_memory_region) / 32; + decode_gfx(machine, gfx_index, memory_region(machine, gfx_memory_region), total, &charlayout, 4); break; case GRADIUS3_PLANE_ORDER: total = 0x1000; - decode_gfx(machine, gfx_index, memory_region(gfx_memory_region), total, &charlayout_gradius3, 4); + decode_gfx(machine, gfx_index, memory_region(machine, gfx_memory_region), total, &charlayout_gradius3, 4); break; default: @@ -2119,11 +2120,11 @@ else (*K052109_callback)(0,bank,&code,&color,&flags,&priority); addr = (code << 5) + (offset & 0x1f); - addr &= memory_region_length(K052109_memory_region)-1; + addr &= memory_region_length(machine, K052109_memory_region)-1; // logerror("%04x: off = %04x sub = %02x (bnk = %x) adr = %06x\n",activecpu_get_pc(),offset,K052109_romsubbank,bank,addr); - return memory_region(K052109_memory_region)[addr]; + return memory_region(machine, K052109_memory_region)[addr]; } } @@ -2526,18 +2527,18 @@ void K051960_vh_start(running_machine *machine,int gfx_memory_region,int plane_o switch (plane_order) { case NORMAL_PLANE_ORDER: - total = memory_region_length(gfx_memory_region) / 128; - decode_gfx(machine, gfx_index, memory_region(gfx_memory_region), total, &spritelayout, 4); + total = memory_region_length(machine, gfx_memory_region) / 128; + decode_gfx(machine, gfx_index, memory_region(machine, gfx_memory_region), total, &spritelayout, 4); break; case REVERSE_PLANE_ORDER: - total = memory_region_length(gfx_memory_region) / 128; - decode_gfx(machine, gfx_index, memory_region(gfx_memory_region), total, &spritelayout_reverse, 4); + total = memory_region_length(machine, gfx_memory_region) / 128; + decode_gfx(machine, gfx_index, memory_region(machine, gfx_memory_region), total, &spritelayout_reverse, 4); break; case GRADIUS3_PLANE_ORDER: total = 0x4000; - decode_gfx(machine, gfx_index, memory_region(gfx_memory_region), total, &spritelayout_gradius3, 4); + decode_gfx(machine, gfx_index, memory_region(machine, gfx_memory_region), total, &spritelayout_gradius3, 4); break; default: @@ -2571,7 +2572,7 @@ void K051960_vh_start(running_machine *machine,int gfx_memory_region,int plane_o } -static int K051960_fetchromdata(int byte) +static int K051960_fetchromdata(running_machine *machine, int byte) { int code,color,pri,shadow,off1,addr; @@ -2586,11 +2587,11 @@ static int K051960_fetchromdata(int byte) (*K051960_callback)(&code,&color,&pri,&shadow); addr = (code << 7) | (off1 << 2) | byte; - addr &= memory_region_length(K051960_memory_region)-1; + addr &= memory_region_length(machine, K051960_memory_region)-1; // popmessage("%04x: addr %06x",activecpu_get_pc(),addr); - return memory_region(K051960_memory_region)[addr]; + return memory_region(machine, K051960_memory_region)[addr]; } READ8_HANDLER( K051960_r ) @@ -2599,7 +2600,7 @@ READ8_HANDLER( K051960_r ) { /* the 051960 remembers the last address read and uses it when reading the sprite ROMs */ K051960_romoffset = (offset & 0x3fc) >> 2; - return K051960_fetchromdata(offset & 3); /* only 88 Games reads the ROMs from here */ + return K051960_fetchromdata(machine, offset & 3); /* only 88 Games reads the ROMs from here */ } else return K051960_ram[offset]; @@ -2627,7 +2628,7 @@ READ8_HANDLER( K051937_r ) { if (K051960_readroms && offset >= 4 && offset < 8) { - return K051960_fetchromdata(offset & 3); + return K051960_fetchromdata(machine, offset & 3); } else { @@ -3029,8 +3030,8 @@ void K053245_vh_start(running_machine *machine,int chip, int gfx_memory_region,i switch (plane_order) { case NORMAL_PLANE_ORDER: - total = memory_region_length(gfx_memory_region) / 128; - decode_gfx(machine, gfx_index, memory_region(gfx_memory_region), total, &spritelayout, 4); + total = memory_region_length(machine, gfx_memory_region) / 128; + decode_gfx(machine, gfx_index, memory_region(machine, gfx_memory_region), total, &spritelayout, 4); break; default: @@ -3123,7 +3124,7 @@ INLINE void K053245_update_buffer( int chip ) memcpy(K053245_buffer[chip], K053245_ram[chip], K053245_ramsize[chip]); } -static UINT8 K053244_chip_r (int chip, int offset) +static UINT8 K053244_chip_r (running_machine *machine, int chip, int offset) { if ((K053244_regs[chip][5] & 0x10) && offset >= 0x0c && offset < 0x10) { @@ -3132,11 +3133,11 @@ static UINT8 K053244_chip_r (int chip, int offset) addr = (K053244_rombank[chip] << 19) | ((K053244_regs[chip][11] & 0x7) << 18) | (K053244_regs[chip][8] << 10) | (K053244_regs[chip][9] << 2) | ((offset & 3) ^ 1); - addr &= memory_region_length(K053245_memory_region[chip])-1; + addr &= memory_region_length(machine, K053245_memory_region[chip])-1; // popmessage("%04x: offset %02x addr %06x",activecpu_get_pc(),offset&3,addr); - return memory_region(K053245_memory_region[chip])[addr]; + return memory_region(machine, K053245_memory_region[chip])[addr]; } else if (offset == 0x06) { @@ -3152,7 +3153,7 @@ static UINT8 K053244_chip_r (int chip, int offset) READ8_HANDLER( K053244_r ) { - return K053244_chip_r(0,offset); + return K053244_chip_r(machine,0,offset); } static void K053244_chip_w(int chip, int offset, int data) @@ -3771,8 +3772,8 @@ void K053247_vh_start(running_machine *machine, int gfx_memory_region, int dx, i switch (plane_order) { case NORMAL_PLANE_ORDER: - total = memory_region_length(gfx_memory_region) / 128; - decode_gfx(machine, gfx_index, memory_region(gfx_memory_region), total, &spritelayout, 4); + total = memory_region_length(machine, gfx_memory_region) / 128; + decode_gfx(machine, gfx_index, memory_region(machine, gfx_memory_region), total, &spritelayout, 4); break; default: @@ -3879,19 +3880,19 @@ void K055673_vh_start(running_machine *machine, int gfx_memory_region, int layou break; assert(gfx_index != MAX_GFX_ELEMENTS); - K055673_rom = (UINT16 *)memory_region(gfx_memory_region); + K055673_rom = (UINT16 *)memory_region(machine, gfx_memory_region); /* decode the graphics */ switch(layout) { case K055673_LAYOUT_GX: - size4 = (memory_region_length(gfx_memory_region)/(1024*1024))/5; + size4 = (memory_region_length(machine, gfx_memory_region)/(1024*1024))/5; size4 *= 4*1024*1024; /* set the # of tiles based on the 4bpp section */ K055673_rom = auto_malloc(size4 * 5); d = (UINT8 *)K055673_rom; // now combine the graphics together to form 5bpp - s1 = memory_region(gfx_memory_region); // 4bpp area + s1 = memory_region(machine, gfx_memory_region); // 4bpp area s2 = s1 + (size4); // 1bpp area for (i = 0; i < size4; i+= 4) { @@ -3907,17 +3908,17 @@ void K055673_vh_start(running_machine *machine, int gfx_memory_region, int layou break; case K055673_LAYOUT_RNG: - total = memory_region_length(gfx_memory_region) / (16*16/2); + total = memory_region_length(machine, gfx_memory_region) / (16*16/2); decode_gfx(machine, gfx_index, (UINT8 *)K055673_rom, total, &spritelayout2, 4); break; case K055673_LAYOUT_LE2: - total = memory_region_length(gfx_memory_region) / (16*16); + total = memory_region_length(machine, gfx_memory_region) / (16*16); decode_gfx(machine, gfx_index, (UINT8 *)K055673_rom, total, &spritelayout3, 4); break; case K055673_LAYOUT_GX6: - total = memory_region_length(gfx_memory_region) / (16*16*6/8); + total = memory_region_length(machine, gfx_memory_region) / (16*16*6/8); decode_gfx(machine, gfx_index, (UINT8 *)K055673_rom, total, &spritelayout4, 4); break; @@ -4019,9 +4020,9 @@ WRITE8_HANDLER( K053247_w ) // in this window, +0 = 32 bits from one set of ROMs, and +8 = 32 bits from another set READ16_HANDLER( K055673_rom_word_r ) // 5bpp { - UINT8 *ROM8 = (UINT8 *)memory_region(K053247_memory_region); - UINT16 *ROM = (UINT16 *)memory_region(K053247_memory_region); - int size4 = (memory_region_length(K053247_memory_region)/(1024*1024))/5; + UINT8 *ROM8 = (UINT8 *)memory_region(machine, K053247_memory_region); + UINT16 *ROM = (UINT16 *)memory_region(machine, K053247_memory_region); + int size4 = (memory_region_length(machine, K053247_memory_region)/(1024*1024))/5; int romofs; size4 *= 4*1024*1024; // get offset to 5th bit @@ -4063,7 +4064,7 @@ READ16_HANDLER( K055673_rom_word_r ) // 5bpp READ16_HANDLER( K055673_GX6bpp_rom_word_r ) { - UINT16 *ROM = (UINT16 *)memory_region(K053247_memory_region); + UINT16 *ROM = (UINT16 *)memory_region(machine, K053247_memory_region); int romofs; romofs = K053246_regs[6]<<16 | K053246_regs[7]<<8 | K053246_regs[4]; @@ -4108,10 +4109,10 @@ READ8_HANDLER( K053246_r ) int addr; addr = (K053246_regs[6] << 17) | (K053246_regs[7] << 9) | (K053246_regs[4] << 1) | ((offset & 1) ^ 1); - addr &= memory_region_length(K053247_memory_region)-1; + addr &= memory_region_length(machine, K053247_memory_region)-1; if (VERBOSE) popmessage("%04x: offset %02x addr %06x",activecpu_get_pc(),offset,addr); - return memory_region(K053247_memory_region)[addr]; + return memory_region(machine, K053247_memory_region)[addr]; } else { @@ -4672,22 +4673,22 @@ static void K051316_vh_start(running_machine *machine,int chip, int gfx_memory_r case -4: total = 0x400; bpp = 4; - decode_gfx(machine, gfx_index, memory_region(gfx_memory_region), total, &charlayout_tail2nos, 4); + decode_gfx(machine, gfx_index, memory_region(machine, gfx_memory_region), total, &charlayout_tail2nos, 4); break; case 4: - total = memory_region_length(gfx_memory_region) / 128; - decode_gfx(machine, gfx_index, memory_region(gfx_memory_region), total, &charlayout4, 4); + total = memory_region_length(machine, gfx_memory_region) / 128; + decode_gfx(machine, gfx_index, memory_region(machine, gfx_memory_region), total, &charlayout4, 4); break; case 7: - total = memory_region_length(gfx_memory_region) / 256; - decode_gfx(machine, gfx_index, memory_region(gfx_memory_region), total, &charlayout7, 7); + total = memory_region_length(machine, gfx_memory_region) / 256; + decode_gfx(machine, gfx_index, memory_region(machine, gfx_memory_region), total, &charlayout7, 7); break; case 8: - total = memory_region_length(gfx_memory_region) / 256; - decode_gfx(machine, gfx_index, memory_region(gfx_memory_region), total, &charlayout8, 8); + total = memory_region_length(machine, gfx_memory_region) / 256; + decode_gfx(machine, gfx_index, memory_region(machine, gfx_memory_region), total, &charlayout8, 8); break; default: @@ -4786,7 +4787,7 @@ WRITE8_HANDLER( K051316_2_w ) } -static int K051316_rom_r(int chip, int offset) +static int K051316_rom_r(running_machine *machine, int chip, int offset) { if ((K051316_ctrlram[chip][0x0e] & 0x01) == 0) { @@ -4794,11 +4795,11 @@ static int K051316_rom_r(int chip, int offset) addr = offset + (K051316_ctrlram[chip][0x0c] << 11) + (K051316_ctrlram[chip][0x0d] << 19); if (K051316_bpp[chip] <= 4) addr /= 2; - addr &= memory_region_length(K051316_memory_region[chip])-1; + addr &= memory_region_length(machine, K051316_memory_region[chip])-1; // popmessage("%04x: offset %04x addr %04x",activecpu_get_pc(),offset,addr); - return memory_region(K051316_memory_region[chip])[addr]; + return memory_region(machine, K051316_memory_region[chip])[addr]; } else { @@ -4809,17 +4810,17 @@ static int K051316_rom_r(int chip, int offset) READ8_HANDLER( K051316_rom_0_r ) { - return K051316_rom_r(0,offset); + return K051316_rom_r(machine,0,offset); } READ8_HANDLER( K051316_rom_1_r ) { - return K051316_rom_r(1,offset); + return K051316_rom_r(machine,1,offset); } READ8_HANDLER( K051316_rom_2_r ) { - return K051316_rom_r(2,offset); + return K051316_rom_r(machine,2,offset); } @@ -5708,33 +5709,33 @@ void K056832_vh_start(running_machine *machine, int gfx_memory_region, int bpp, switch (bpp) { case K056832_BPP_4: - total = memory_region_length(gfx_memory_region) / (i*4); - decode_gfx(machine, gfx_index, memory_region(gfx_memory_region), total, &charlayout4, 4); + total = memory_region_length(machine, gfx_memory_region) / (i*4); + decode_gfx(machine, gfx_index, memory_region(machine, gfx_memory_region), total, &charlayout4, 4); break; case K056832_BPP_5: - total = memory_region_length(gfx_memory_region) / (i*5); - decode_gfx(machine, gfx_index, memory_region(gfx_memory_region), total, &charlayout5, 4); + total = memory_region_length(machine, gfx_memory_region) / (i*5); + decode_gfx(machine, gfx_index, memory_region(machine, gfx_memory_region), total, &charlayout5, 4); break; case K056832_BPP_6: - total = memory_region_length(gfx_memory_region) / (i*6); - decode_gfx(machine, gfx_index, memory_region(gfx_memory_region), total, &charlayout6, 4); + total = memory_region_length(machine, gfx_memory_region) / (i*6); + decode_gfx(machine, gfx_index, memory_region(machine, gfx_memory_region), total, &charlayout6, 4); break; case K056832_BPP_8: - total = memory_region_length(gfx_memory_region) / (i*8); - decode_gfx(machine, gfx_index, memory_region(gfx_memory_region), total, &charlayout8, 4); + total = memory_region_length(machine, gfx_memory_region) / (i*8); + decode_gfx(machine, gfx_index, memory_region(machine, gfx_memory_region), total, &charlayout8, 4); break; case K056832_BPP_8LE: - total = memory_region_length(gfx_memory_region) / (i*8); - decode_gfx(machine, gfx_index, memory_region(gfx_memory_region), total, &charlayout8le, 4); + total = memory_region_length(machine, gfx_memory_region) / (i*8); + decode_gfx(machine, gfx_index, memory_region(machine, gfx_memory_region), total, &charlayout8le, 4); break; case K056832_BPP_4dj: - total = memory_region_length(gfx_memory_region) / (i*4); - decode_gfx(machine, gfx_index, memory_region(gfx_memory_region), total, &charlayout4dj, 4); + total = memory_region_length(machine, gfx_memory_region) / (i*4); + decode_gfx(machine, gfx_index, memory_region(machine, gfx_memory_region), total, &charlayout4dj, 4); break; default: @@ -5747,8 +5748,8 @@ void K056832_vh_start(running_machine *machine, int gfx_memory_region, int bpp, K056832_gfxnum = gfx_index; K056832_callback = callback; - K056832_rombase = memory_region(gfx_memory_region); - K056832_NumGfxBanks = memory_region_length(gfx_memory_region) / 0x2000; + K056832_rombase = memory_region(machine, gfx_memory_region); + K056832_NumGfxBanks = memory_region_length(machine, gfx_memory_region) / 0x2000; K056832_CurGfxBank = 0; K056832_use_ext_linescroll = 0; K056832_uses_tile_banks = 0; @@ -5841,12 +5842,12 @@ void K056832_SetExtLinescroll(void) } /* generic helper routine for ROM checksumming */ -static int K056832_rom_read_b(int offset, int blksize, int blksize2, int zerosec) +static int K056832_rom_read_b(running_machine *machine, int offset, int blksize, int blksize2, int zerosec) { UINT8 *rombase; int base, ret; - rombase = (UINT8 *)memory_region(K056832_memory_region); + rombase = (UINT8 *)memory_region(machine, K056832_memory_region); if ((K056832_rom_half) && (zerosec)) { @@ -5879,11 +5880,11 @@ READ16_HANDLER( K056832_5bpp_rom_word_r ) { if (mem_mask == 0xff00) { - return K056832_rom_read_b(offset*2, 4, 5, 0)<<8; + return K056832_rom_read_b(machine, offset*2, 4, 5, 0)<<8; } else if (mem_mask == 0x00ff) { - return K056832_rom_read_b(offset*2+1, 4, 5, 0)<<16; + return K056832_rom_read_b(machine, offset*2+1, 4, 5, 0)<<16; } else { @@ -5896,19 +5897,19 @@ READ32_HANDLER( K056832_5bpp_rom_long_r ) { if (mem_mask == 0xff000000) { - return K056832_rom_read_b(offset*4, 4, 5, 0)<<24; + return K056832_rom_read_b(machine, offset*4, 4, 5, 0)<<24; } else if (mem_mask == 0x00ff0000) { - return K056832_rom_read_b(offset*4+1, 4, 5, 0)<<16; + return K056832_rom_read_b(machine, offset*4+1, 4, 5, 0)<<16; } else if (mem_mask == 0x0000ff00) { - return K056832_rom_read_b(offset*4+2, 4, 5, 0)<<8; + return K056832_rom_read_b(machine, offset*4+2, 4, 5, 0)<<8; } else if (mem_mask == 0x000000ff) { - return K056832_rom_read_b(offset*4+3, 4, 5, 1); + return K056832_rom_read_b(machine, offset*4+3, 4, 5, 1); } else { @@ -5921,19 +5922,19 @@ READ32_HANDLER( K056832_6bpp_rom_long_r ) { if (mem_mask == 0xff000000) { - return K056832_rom_read_b(offset*4, 4, 6, 0)<<24; + return K056832_rom_read_b(machine, offset*4, 4, 6, 0)<<24; } else if (mem_mask == 0x00ff0000) { - return K056832_rom_read_b(offset*4+1, 4, 6, 0)<<16; + return K056832_rom_read_b(machine, offset*4+1, 4, 6, 0)<<16; } else if (mem_mask == 0x0000ff00) { - return K056832_rom_read_b(offset*4+2, 4, 6, 0)<<8; + return K056832_rom_read_b(machine, offset*4+2, 4, 6, 0)<<8; } else if (mem_mask == 0x000000ff) { - return K056832_rom_read_b(offset*4+3, 4, 6, 0); + return K056832_rom_read_b(machine, offset*4+3, 4, 6, 0); } else { @@ -5956,7 +5957,7 @@ READ16_HANDLER( K056832_rom_word_r ) if (!K056832_rombase) { - K056832_rombase = memory_region(K056832_memory_region); + K056832_rombase = memory_region(machine, K056832_memory_region); } rombase = (UINT8 *)K056832_rombase; @@ -5982,7 +5983,7 @@ READ16_HANDLER( K056832_mw_rom_word_r ) if (!K056832_rombase) { - K056832_rombase = memory_region(K056832_memory_region); + K056832_rombase = memory_region(machine, K056832_memory_region); } if (K056832_regsb[2] & 0x8) @@ -6046,7 +6047,7 @@ READ16_HANDLER( K056832_bishi_rom_word_r ) if (!K056832_rombase) { - K056832_rombase = memory_region(K056832_memory_region); + K056832_rombase = memory_region(machine, K056832_memory_region); } return K056832_rombase[addr+2] | (K056832_rombase[addr] << 8); @@ -6058,7 +6059,7 @@ READ16_HANDLER( K056832_rom_word_8000_r ) if (!K056832_rombase) { - K056832_rombase = memory_region(K056832_memory_region); + K056832_rombase = memory_region(machine, K056832_memory_region); } return K056832_rombase[addr+2] | (K056832_rombase[addr] << 8); @@ -6070,7 +6071,7 @@ READ16_HANDLER( K056832_old_rom_word_r ) if (!K056832_rombase) { - K056832_rombase = memory_region(K056832_memory_region); + K056832_rombase = memory_region(machine, K056832_memory_region); } return K056832_rombase[addr+1] | (K056832_rombase[addr] << 8); @@ -7508,8 +7509,8 @@ void K053250_unpack_pixels(int region) UINT8 *src_ptr, *dst_ptr; int hi_nibble, lo_nibble, offset; - dst_ptr = src_ptr = memory_region(region); - offset = memory_region_length(region) / 2 - 1; + dst_ptr = src_ptr = memory_region(Machine, region); + offset = memory_region_length(Machine, region) / 2 - 1; do { @@ -7531,14 +7532,14 @@ void K053250_vh_start(int chips, int *region) for(chip=0; chip<chips; chip++) { - K053250_info.chip[chip].base = memory_region(region[chip]); + K053250_info.chip[chip].base = memory_region(Machine, region[chip]); ram = auto_malloc(0x6000); K053250_info.chip[chip].ram = ram; K053250_info.chip[chip].rammax = ram + 0x800; K053250_info.chip[chip].buffer[0] = ram + 0x2000; K053250_info.chip[chip].buffer[1] = ram + 0x2800; memset(ram+0x2000, 0, 0x2000); - K053250_info.chip[chip].rommask = memory_region_length(region[chip]); + K053250_info.chip[chip].rommask = memory_region_length(Machine, region[chip]); K053250_info.chip[chip].page[1] = K053250_info.chip[chip].page[0] = 0; K053250_info.chip[chip].offsy = K053250_info.chip[chip].offsx = 0; K053250_info.chip[chip].frame = -1; diff --git a/src/mame/video/ksayakyu.c b/src/mame/video/ksayakyu.c index 59198addb26..8ba8088edd2 100644 --- a/src/mame/video/ksayakyu.c +++ b/src/mame/video/ksayakyu.c @@ -33,7 +33,8 @@ WRITE8_HANDLER(ksayakyu_videoctrl_w) PALETTE_INIT( ksayakyu ) { int i,j,b1,b2; - const UINT8 *prom = memory_region(REGION_PROMS); + const UINT8 *prom = memory_region(machine, REGION_PROMS); + for(j=0;j<16;j++) for(i=0;i<8;i++) { @@ -47,8 +48,8 @@ PALETTE_INIT( ksayakyu ) static TILE_GET_INFO( get_ksayakyu_tile_info ) { - int code = memory_region(REGION_USER1)[tile_index]; - int attr = memory_region(REGION_USER1)[tile_index+0x2000]; + int code = memory_region(machine, REGION_USER1)[tile_index]; + int attr = memory_region(machine, REGION_USER1)[tile_index+0x2000]; code+=(attr&3)<<8; SET_TILE_INFO(1,code,((attr>>2)&0x07)*2,(attr&0x80) ? TILE_FLIPX : 0); } diff --git a/src/mame/video/kyugo.c b/src/mame/video/kyugo.c index 8a336c835b2..d6d86c79533 100644 --- a/src/mame/video/kyugo.c +++ b/src/mame/video/kyugo.c @@ -60,7 +60,7 @@ static TILE_GET_INFO( get_bg_tile_info ) VIDEO_START( kyugo ) { - color_codes = memory_region(REGION_PROMS) + 0x300; + color_codes = memory_region(machine, REGION_PROMS) + 0x300; fg_tilemap = tilemap_create(get_fg_tile_info, tilemap_scan_rows, 8,8, 64,32); diff --git a/src/mame/video/lasso.c b/src/mame/video/lasso.c index 118766f63a8..2816179f82f 100644 --- a/src/mame/video/lasso.c +++ b/src/mame/video/lasso.c @@ -147,7 +147,7 @@ static TILE_GET_INFO( lasso_get_bg_tile_info ) static TILE_GET_INFO( wwjgtin_get_track_tile_info ) { - UINT8 *ROM = memory_region(REGION_USER1); + UINT8 *ROM = memory_region(machine, REGION_USER1); int code = ROM[tile_index]; int color = ROM[tile_index + 0x2000]; diff --git a/src/mame/video/leland.c b/src/mame/video/leland.c index b4b1c3ef912..8cb6f2f9cdc 100644 --- a/src/mame/video/leland.c +++ b/src/mame/video/leland.c @@ -391,9 +391,9 @@ static VIDEO_UPDATE( leland ) { int y; - const UINT8 *bg_prom = memory_region(REGION_USER1); - const UINT8 *bg_gfx = memory_region(REGION_GFX1); - offs_t bg_gfx_bank_page_size = memory_region_length(REGION_GFX1) / 3; + const UINT8 *bg_prom = memory_region(screen->machine, REGION_USER1); + const UINT8 *bg_gfx = memory_region(screen->machine, REGION_GFX1); + offs_t bg_gfx_bank_page_size = memory_region_length(screen->machine, REGION_GFX1) / 3; offs_t char_bank = (((gfxbank >> 4) & 0x03) * 0x2000) & (bg_gfx_bank_page_size - 1); offs_t prom_bank = ((gfxbank >> 3) & 0x01) * 0x2000; @@ -469,8 +469,8 @@ static VIDEO_UPDATE( ataxx ) { int y; - const UINT8 *bg_gfx = memory_region(REGION_GFX1); - offs_t bg_gfx_bank_page_size = memory_region_length(REGION_GFX1) / 6; + const UINT8 *bg_gfx = memory_region(screen->machine, REGION_GFX1); + offs_t bg_gfx_bank_page_size = memory_region_length(screen->machine, REGION_GFX1) / 6; offs_t bg_gfx_offs_mask = bg_gfx_bank_page_size - 1; /* for each scanline in the visible region */ diff --git a/src/mame/video/lethalj.c b/src/mame/video/lethalj.c index 1524b0dab50..bd1291c16a0 100644 --- a/src/mame/video/lethalj.c +++ b/src/mame/video/lethalj.c @@ -94,8 +94,8 @@ VIDEO_START( lethalj ) screenram = auto_malloc(BLITTER_DEST_WIDTH * BLITTER_DEST_HEIGHT * sizeof(screenram[0])); /* predetermine blitter info */ - blitter_base = (UINT16 *)memory_region(REGION_GFX1); - blitter_rows = memory_region_length(REGION_GFX1) / (2*BLITTER_SOURCE_WIDTH); + blitter_base = (UINT16 *)memory_region(machine, REGION_GFX1); + blitter_rows = memory_region_length(machine, REGION_GFX1) / (2*BLITTER_SOURCE_WIDTH); } diff --git a/src/mame/video/liberate.c b/src/mame/video/liberate.c index 705cb118c73..5996cf045e0 100644 --- a/src/mame/video/liberate.c +++ b/src/mame/video/liberate.c @@ -42,7 +42,7 @@ static TILEMAP_MAPPER( fix_scan ) static TILE_GET_INFO( get_back_tile_info ) { - const UINT8 *RAM = memory_region(REGION_USER1); + const UINT8 *RAM = memory_region(machine, REGION_USER1); int tile,bank; /* Convert tile index of 512x512 to paged format */ diff --git a/src/mame/video/liberatr.c b/src/mame/video/liberatr.c index f9952bd0f27..08a1c545f8c 100644 --- a/src/mame/video/liberatr.c +++ b/src/mame/video/liberatr.c @@ -124,8 +124,8 @@ static void liberatr_init_planet(running_machine *machine, planet *liberatr_plan { UINT16 longitude; - const UINT8 *latitude_scale = memory_region(REGION_USER1); - const UINT8 *longitude_scale = memory_region(REGION_USER2); + const UINT8 *latitude_scale = memory_region(machine, REGION_USER1); + const UINT8 *longitude_scale = memory_region(machine, REGION_USER2); /* for each starting longitude */ for (longitude = 0; longitude < 0x100; longitude++) @@ -274,8 +274,8 @@ VIDEO_START( liberatr ) liberatr_planets[1] = auto_malloc(sizeof(planet)); /* for each planet in the planet ROMs */ - liberatr_init_planet(machine, liberatr_planets[0], &memory_region(REGION_GFX1)[0x2000]); - liberatr_init_planet(machine, liberatr_planets[1], &memory_region(REGION_GFX1)[0x0000]); + liberatr_init_planet(machine, liberatr_planets[0], &memory_region(machine, REGION_GFX1)[0x2000]); + liberatr_init_planet(machine, liberatr_planets[1], &memory_region(machine, REGION_GFX1)[0x0000]); } diff --git a/src/mame/video/lockon.c b/src/mame/video/lockon.c index 5316b83c1ac..83858f7f3f5 100644 --- a/src/mame/video/lockon.c +++ b/src/mame/video/lockon.c @@ -212,12 +212,12 @@ WRITE16_HANDLER( lockon_scene_v_scr_w ) scroll_v = data & 0x81ff; } -static void scene_draw(void) +static void scene_draw(running_machine *machine) { UINT32 y; /* 3bpp characters */ - const UINT8 *const gfx1 = memory_region(REGION_GFX2); + const UINT8 *const gfx1 = memory_region(machine, REGION_GFX2); const UINT8 *const gfx2 = gfx1 + 0x10000; const UINT8 *const gfx3 = gfx1 + 0x20000; const UINT8 *const clut = gfx1 + 0x30000; @@ -347,10 +347,10 @@ static TIMER_CALLBACK( bufend_callback ) rom_data3 = gfx_rom[gfx_addr + 0x20000]; \ } -static void ground_draw(void) +static void ground_draw(running_machine *machine) { /* ROM pointers */ - const UINT8 *const gfx_rom = memory_region(REGION_GFX4); + const UINT8 *const gfx_rom = memory_region(machine, REGION_GFX4); const UINT8 *const lut_rom = gfx_rom + 0x30000 + ((ground_ctrl >> 2) & 0x3 ? 0x10000 : 0); const UINT8 *const clut_rom = gfx_rom + 0x50000; @@ -472,14 +472,14 @@ do { \ px = (px + 1) & 0x7ff; \ } while(0) -static void objects_draw(void) +static void objects_draw(running_machine *machine) { UINT32 offs; - const UINT8 *const romlut = memory_region(REGION_USER1); - const UINT16 *const chklut = (UINT16*)memory_region(REGION_USER2); - const UINT8 *const gfxrom = memory_region(REGION_GFX5); - const UINT8 *const sproms = memory_region(REGION_PROMS) + 0x800; + const UINT8 *const romlut = memory_region(machine, REGION_USER1); + const UINT16 *const chklut = (UINT16*)memory_region(machine, REGION_USER2); + const UINT8 *const gfxrom = memory_region(machine, REGION_GFX5); + const UINT8 *const sproms = memory_region(machine, REGION_PROMS) + 0x800; for (offs = 0; offs < lockon_objectram_size; offs += 4) { @@ -652,7 +652,7 @@ WRITE16_HANDLER( lockon_tza112_w ) { obj_pal_latch = data & 0xff; obj_pal_addr = offset & 0xf; - objects_draw(); + objects_draw(machine); } } @@ -833,9 +833,9 @@ static void rotate_draw(bitmap_t *bitmap, const rectangle *cliprect) *******************************************************************************************/ -static void hud_draw(bitmap_t *bitmap, const rectangle *cliprect) +static void hud_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) { - UINT8 *tile_rom = memory_region(REGION_GFX3); + UINT8 *tile_rom = memory_region(machine, REGION_GFX3); UINT32 offs; for (offs = 0x0; offs <= lockon_hudram_size; offs += 2) @@ -968,7 +968,7 @@ VIDEO_UPDATE( lockon ) tilemap_draw(bitmap, cliprect, lockon_tilemap, 0, 0); /* Draw the HUD */ - hud_draw(bitmap, cliprect); + hud_draw(screen->machine, bitmap, cliprect); return 0; } @@ -981,8 +981,8 @@ VIDEO_EOF( lockon ) back_buffer = tmp; /* Draw the frame buffer layers */ - scene_draw(); - ground_draw(); - objects_draw(); + scene_draw(machine); + ground_draw(machine); + objects_draw(machine); } diff --git a/src/mame/video/lwings.c b/src/mame/video/lwings.c index 9f7b76f830a..97276591eae 100644 --- a/src/mame/video/lwings.c +++ b/src/mame/video/lwings.c @@ -70,8 +70,8 @@ static TILE_GET_INFO( trojan_get_bg1_tile_info ) static TILE_GET_INFO( get_bg2_tile_info ) { int code, color; - UINT8 *rom = memory_region(REGION_GFX5); - int mask = memory_region_length(REGION_GFX5) - 1; + UINT8 *rom = memory_region(machine, REGION_GFX5); + int mask = memory_region_length(machine, REGION_GFX5) - 1; tile_index = (tile_index + bg2_image * 0x20) & mask; code = rom[tile_index]; diff --git a/src/mame/video/m107.c b/src/mame/video/m107.c index 800c3edc0c6..82e180772ae 100644 --- a/src/mame/video/m107.c +++ b/src/mame/video/m107.c @@ -156,7 +156,7 @@ VIDEO_START( m107 ) static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int pri) { int offs; - UINT8 *rom = memory_region(REGION_USER1); + UINT8 *rom = memory_region(machine, REGION_USER1); for (offs = 0x800-4;offs >= 0;offs -= 4) { diff --git a/src/mame/video/madalien.c b/src/mame/video/madalien.c index 0ee87a78ae0..0e520ae018b 100644 --- a/src/mame/video/madalien.c +++ b/src/mame/video/madalien.c @@ -108,7 +108,7 @@ static TILEMAP_MAPPER( scan_mode3 ) static TILE_GET_INFO( get_tile_info_BG_1 ) { - UINT8 *map = memory_region(REGION_USER1) + ((*madalien_video_flags & 0x08) << 6); + UINT8 *map = memory_region(machine, REGION_USER1) + ((*madalien_video_flags & 0x08) << 6); SET_TILE_INFO(1, map[tile_index], BIT(*madalien_video_flags, 2) ? 2 : 0, 0); } @@ -116,7 +116,7 @@ static TILE_GET_INFO( get_tile_info_BG_1 ) static TILE_GET_INFO( get_tile_info_BG_2 ) { - UINT8 *map = memory_region(REGION_USER1) + ((*madalien_video_flags & 0x08) << 6) + 0x80; + UINT8 *map = memory_region(machine, REGION_USER1) + ((*madalien_video_flags & 0x08) << 6) + 0x80; SET_TILE_INFO(1, map[tile_index], BIT(*madalien_video_flags, 2) ? 2 : 0, 0); } diff --git a/src/mame/video/magmax.c b/src/mame/video/magmax.c index fc3e733cc98..797d8602ff3 100644 --- a/src/mame/video/magmax.c +++ b/src/mame/video/magmax.c @@ -70,7 +70,7 @@ PALETTE_INIT( magmax ) VIDEO_START( magmax ) { int i,v; - UINT8 * prom14D = memory_region(REGION_USER2); + UINT8 * prom14D = memory_region(machine, REGION_USER2); /* Set up save state */ state_save_register_global(flipscreen); @@ -102,7 +102,7 @@ VIDEO_UPDATE( magmax ) else { int v; - UINT8 * rom18B = memory_region(REGION_USER1); + UINT8 * rom18B = memory_region(screen->machine, REGION_USER1); UINT32 scroll_h = (*magmax_scroll_x) & 0x3fff; UINT32 scroll_v = (*magmax_scroll_y) & 0xff; diff --git a/src/mame/video/mainsnk.c b/src/mame/video/mainsnk.c index ef182419dd6..e17e5794c4f 100644 --- a/src/mame/video/mainsnk.c +++ b/src/mame/video/mainsnk.c @@ -32,7 +32,7 @@ static void stuff_palette( running_machine *machine, int source_index, int dest_ - UINT8 *color_prom = memory_region(REGION_PROMS) + source_index; + UINT8 *color_prom = memory_region(machine, REGION_PROMS) + source_index; int i; for( i=0; i<num_colors; i++ ) { diff --git a/src/mame/video/marvins.c b/src/mame/video/marvins.c index 5f4841fc03c..9f8e394cc66 100644 --- a/src/mame/video/marvins.c +++ b/src/mame/video/marvins.c @@ -34,7 +34,7 @@ WRITE8_HANDLER( marvins_palette_bank_w ) static void stuff_palette( running_machine *machine, int source_index, int dest_index, int num_colors ) { - UINT8 *color_prom = memory_region(REGION_PROMS) + source_index; + UINT8 *color_prom = memory_region(machine, REGION_PROMS) + source_index; int i; for( i=0; i<num_colors; i++ ) { diff --git a/src/mame/video/mcatadv.c b/src/mame/video/mcatadv.c index dbd5b2cbc7c..c4a5ea7a5f1 100644 --- a/src/mame/video/mcatadv.c +++ b/src/mame/video/mcatadv.c @@ -60,7 +60,7 @@ WRITE16_HANDLER( mcatadv_videoram2_w ) } -static void draw_sprites( bitmap_t *bitmap, const rectangle *cliprect ) +static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect ) { UINT16 *source = spriteram_old; UINT16 *finish = source + (spriteram_size/2)/2; @@ -97,7 +97,7 @@ static void draw_sprites( bitmap_t *bitmap, const rectangle *cliprect ) int width = ((source[2]&0xf000)>>12)*16; int offset = tileno * 256; - UINT8 *sprdata = memory_region ( REGION_GFX1 ); + UINT8 *sprdata = memory_region ( machine, REGION_GFX1 ); int drawxpos, drawypos; int xcnt,ycnt; @@ -244,7 +244,7 @@ VIDEO_UPDATE( mcatadv ) #ifdef MAME_DEBUG if (!input_code_pressed(KEYCODE_E)) #endif - draw_sprites (bitmap, cliprect); + draw_sprites (screen->machine, bitmap, cliprect); profiler_mark(PROFILER_END); return 0; } diff --git a/src/mame/video/mcr68.c b/src/mame/video/mcr68.c index 9c3107c35a7..84e6155b81a 100644 --- a/src/mame/video/mcr68.c +++ b/src/mame/video/mcr68.c @@ -70,7 +70,7 @@ VIDEO_START( mcr68 ) VIDEO_START( zwackery ) { - const UINT8 *colordatabase = (const UINT8 *)memory_region(REGION_GFX3); + const UINT8 *colordatabase = (const UINT8 *)memory_region(machine, REGION_GFX3); gfx_element *gfx0 = machine->gfx[0]; gfx_element *gfx2 = machine->gfx[2]; int code, y, x; diff --git a/src/mame/video/metro.c b/src/mame/video/metro.c index 71e01ea6fcd..f7bcbd34bfb 100644 --- a/src/mame/video/metro.c +++ b/src/mame/video/metro.c @@ -601,8 +601,8 @@ void metro_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectan { const int region = REGION_GFX1; - UINT8 *base_gfx = memory_region(region); - UINT8 *gfx_max = base_gfx + memory_region_length(region); + UINT8 *base_gfx = memory_region(machine, region); + UINT8 *gfx_max = base_gfx + memory_region_length(machine, region); int max_x = video_screen_get_width(machine->primary_screen); int max_y = video_screen_get_height(machine->primary_screen); diff --git a/src/mame/video/mexico86.c b/src/mame/video/mexico86.c index 7d53cb223a3..8bdaca11aaf 100644 --- a/src/mame/video/mexico86.c +++ b/src/mame/video/mexico86.c @@ -9,7 +9,7 @@ static int charbank; WRITE8_HANDLER( mexico86_bankswitch_w ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); if ((data & 7) > 5) popmessage( "Switching to invalid bank!" ); diff --git a/src/mame/video/mjkjidai.c b/src/mame/video/mjkjidai.c index c7d686b19c1..01299d04035 100644 --- a/src/mame/video/mjkjidai.c +++ b/src/mame/video/mjkjidai.c @@ -51,7 +51,7 @@ WRITE8_HANDLER( mjkjidai_videoram_w ) WRITE8_HANDLER( mjkjidai_ctrl_w ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); // logerror("%04x: port c0 = %02x\n",activecpu_get_pc(),data); diff --git a/src/mame/video/model1.c b/src/mame/video/model1.c index faab9c940f8..9539427d91f 100644 --- a/src/mame/video/model1.c +++ b/src/mame/video/model1.c @@ -1436,7 +1436,7 @@ VIDEO_START(model1) sys24_tile_vh_start(machine, 0x3fff); - poly_rom = (UINT32 *)memory_region(REGION_USER1); + poly_rom = (UINT32 *)memory_region(machine, REGION_USER1); poly_ram = auto_malloc(0x400000*4); memset(poly_ram, 0, 0x400000*4); tgp_ram = auto_malloc((0x100000-0x40000)*2); diff --git a/src/mame/video/model2.c b/src/mame/video/model2.c index 431da7f7845..6a25f43165b 100644 --- a/src/mame/video/model2.c +++ b/src/mame/video/model2.c @@ -2714,10 +2714,10 @@ VIDEO_START(model2) add_exit_callback(machine, model2_exit); /* initialize the geometry engine */ - geo_init( (UINT32*)memory_region(REGION_USER2) ); + geo_init( (UINT32*)memory_region(machine, REGION_USER2) ); /* initialize the hardware rasterizer */ - model2_3d_init( (UINT16*)memory_region(REGION_USER3) ); + model2_3d_init( (UINT16*)memory_region(machine, REGION_USER3) ); } static void convert_bitmap( running_machine *machine, bitmap_t *dst, bitmap_t *src, const rectangle *rect ) diff --git a/src/mame/video/momoko.c b/src/mame/video/momoko.c index a984c4e3356..9a323894ca2 100644 --- a/src/mame/video/momoko.c +++ b/src/mame/video/momoko.c @@ -69,12 +69,12 @@ WRITE8_HANDLER( momoko_flipscreen_w ) } /****************************************************************************/ -static void momoko_draw_bg_pri(bitmap_t *bitmap, int chr, int col, int flipx, int flipy, int x,int y, int pri) +static void momoko_draw_bg_pri(running_machine *machine, bitmap_t *bitmap, int chr, int col, int flipx, int flipy, int x,int y, int pri) { int xx,sx,sy,px,py,dot; UINT32 gfxadr; UINT8 d0, d1; - UINT8 *BG_GFX = memory_region( REGION_GFX2 ); + UINT8 *BG_GFX = memory_region( machine, REGION_GFX2 ); for (sy=0; sy<8; sy++) { gfxadr = chr*16 + sy*2; @@ -105,10 +105,10 @@ VIDEO_UPDATE( momoko ) { int x, y, dx, dy, rx, ry, radr, chr, sy, fx, fy, px, py, offs, col, pri, flip ; - UINT8 *BG_MAP = memory_region( REGION_USER1 ); - UINT8 *BG_COL_MAP = memory_region( REGION_USER2 ); - UINT8 *FG_MAP = memory_region( REGION_USER3 ); - UINT8 *TEXT_COLOR = memory_region( REGION_PROMS ); + UINT8 *BG_MAP = memory_region( screen->machine, REGION_USER1 ); + UINT8 *BG_COL_MAP = memory_region( screen->machine, REGION_USER2 ); + UINT8 *FG_MAP = memory_region( screen->machine, REGION_USER3 ); + UINT8 *TEXT_COLOR = memory_region( screen->machine, REGION_PROMS ); flip = momoko_flipscreen ^ (input_port_read_indexed(screen->machine, 4) & 0x01); @@ -213,7 +213,7 @@ VIDEO_UPDATE( momoko ) { col = col & 0x0f; chr = chr + momoko_bg_select * 512; - momoko_draw_bg_pri(bitmap,chr,col,flip,flip,px,py,pri); + momoko_draw_bg_pri(screen->machine,bitmap,chr,col,flip,flip,px,py,pri); } } } diff --git a/src/mame/video/munchmo.c b/src/mame/video/munchmo.c index 9d25f4b1a90..e8392bc117d 100644 --- a/src/mame/video/munchmo.c +++ b/src/mame/video/munchmo.c @@ -95,7 +95,7 @@ static void draw_background(running_machine *machine, bitmap_t *bitmap, const re ROM B1.2C contains 256 tilemaps defining 4x4 configurations of the tiles in ROM B2.2B */ - UINT8 *rom = memory_region(REGION_GFX2); + UINT8 *rom = memory_region(machine, REGION_GFX2); const gfx_element *gfx = machine->gfx[1]; int offs; diff --git a/src/mame/video/mw8080bw.c b/src/mame/video/mw8080bw.c index f4be6c575f9..3af9cbd61ff 100644 --- a/src/mame/video/mw8080bw.c +++ b/src/mame/video/mw8080bw.c @@ -227,7 +227,7 @@ VIDEO_UPDATE( phantom2 ) UINT16 cloud_counter = phantom2_get_cloud_counter(); - UINT8 *cloud_region = memory_region(REGION_PROMS); + UINT8 *cloud_region = memory_region(screen->machine, REGION_PROMS); while (1) { diff --git a/src/mame/video/mystston.c b/src/mame/video/mystston.c index e31bf4eb698..d71e1f4d1ab 100644 --- a/src/mame/video/mystston.c +++ b/src/mame/video/mystston.c @@ -75,7 +75,7 @@ static void set_palette(running_machine *machine, mystston_state *state) static const int resistances_b [2] = { 3300, 1500 }; double weights_rg[3], weights_b[2]; - UINT8 *color_prom = memory_region(REGION_PROMS); + UINT8 *color_prom = memory_region(machine, REGION_PROMS); compute_resistor_weights(0, 255, -1.0, 3, resistances_rg, weights_rg, 0, 1000, diff --git a/src/mame/video/mystwarr.c b/src/mame/video/mystwarr.c index a480f10d278..bb0396e4eb8 100644 --- a/src/mame/video/mystwarr.c +++ b/src/mame/video/mystwarr.c @@ -18,10 +18,10 @@ static char *orig_roms; // do some trickery since we know the graphics decode doesn't touch the source data again // and we want the original data -static void mystwarr_save_orig_tiles(void) +static void mystwarr_save_orig_tiles(running_machine *machine) { - UINT8 *s = memory_region(REGION_GFX1); - int len = memory_region_length(REGION_GFX1); + UINT8 *s = memory_region(machine, REGION_GFX1); + int len = memory_region_length(machine, REGION_GFX1); UINT8 *pFinish = s+len-3; orig_roms = malloc_or_die(len); @@ -52,10 +52,10 @@ static void mystwarr_save_orig_tiles(void) } } -static void mystwarr_rest_orig_tiles(void) +static void mystwarr_rest_orig_tiles(running_machine *machine) { - UINT8 *s = memory_region(REGION_GFX1); - int len = memory_region_length(REGION_GFX1); + UINT8 *s = memory_region(machine, REGION_GFX1); + int len = memory_region_length(machine, REGION_GFX1); // restore the original data so the ROM test can pass memcpy(s, orig_roms, len); @@ -140,7 +140,7 @@ static void martchmp_sprite_callback(int *code, int *color, int *priority) static TILE_GET_INFO( get_gai_936_tile_info ) { int tileno, colour; - UINT8 *ROM = memory_region(REGION_GFX4); + UINT8 *ROM = memory_region(machine, REGION_GFX4); UINT8 *dat1 = ROM, *dat2 = ROM + 0x20000, *dat3 = ROM + 0x60000; tileno = dat3[tile_index] | ((dat2[tile_index]&0x3f)<<8); @@ -164,11 +164,11 @@ VIDEO_START(gaiapols) gametype = 0; - mystwarr_save_orig_tiles(); + mystwarr_save_orig_tiles(machine); K056832_vh_start(machine, REGION_GFX1, K056832_BPP_5, 0, NULL, game4bpp_tile_callback, 0); - mystwarr_rest_orig_tiles(); + mystwarr_rest_orig_tiles(machine); K055673_vh_start(machine, REGION_GFX2, 1, -61, -22, gaiapols_sprite_callback); // stage2 brick walls @@ -189,7 +189,7 @@ VIDEO_START(gaiapols) static TILE_GET_INFO( get_ult_936_tile_info ) { int tileno, colour; - UINT8 *ROM = memory_region(REGION_GFX4); + UINT8 *ROM = memory_region(machine, REGION_GFX4); UINT8 *dat1 = ROM, *dat2 = ROM + 0x40000; tileno = dat2[tile_index] | ((dat1[tile_index]&0x1f)<<8); @@ -206,11 +206,11 @@ VIDEO_START(dadandrn) gametype = 1; - mystwarr_save_orig_tiles(); + mystwarr_save_orig_tiles(machine); K056832_vh_start(machine, REGION_GFX1, K056832_BPP_5, 0, NULL, game5bpp_tile_callback, 0); - mystwarr_rest_orig_tiles(); + mystwarr_rest_orig_tiles(machine); K055673_vh_start(machine, REGION_GFX2, 0, -42, -22, gaiapols_sprite_callback); @@ -237,11 +237,11 @@ VIDEO_START(mystwarr) gametype = 0; - mystwarr_save_orig_tiles(); + mystwarr_save_orig_tiles(machine); K056832_vh_start(machine, REGION_GFX1, K056832_BPP_5, 0, NULL, mystwarr_tile_callback, 0); - mystwarr_rest_orig_tiles(); + mystwarr_rest_orig_tiles(machine); K055673_vh_start(machine, REGION_GFX2, 0, -48, -24, mystwarr_sprite_callback); @@ -265,11 +265,11 @@ VIDEO_START(metamrph) K054338_vh_start(); K053250_vh_start(1, &rgn_250); - mystwarr_save_orig_tiles(); + mystwarr_save_orig_tiles(machine); K056832_vh_start(machine, REGION_GFX1, K056832_BPP_5, 0, NULL, game4bpp_tile_callback, 0); - mystwarr_rest_orig_tiles(); + mystwarr_rest_orig_tiles(machine); K055673_vh_start(machine, REGION_GFX2, 1, -51, -22, metamrph_sprite_callback); @@ -291,11 +291,11 @@ VIDEO_START(viostorm) K055555_vh_start(); K054338_vh_start(); - mystwarr_save_orig_tiles(); + mystwarr_save_orig_tiles(machine); K056832_vh_start(machine, REGION_GFX1, K056832_BPP_5, 0, NULL, game4bpp_tile_callback, 0); - mystwarr_rest_orig_tiles(); + mystwarr_rest_orig_tiles(machine); K055673_vh_start(machine, REGION_GFX2, 1, -62, -23, metamrph_sprite_callback); @@ -314,11 +314,11 @@ VIDEO_START(martchmp) K055555_vh_start(); K054338_vh_start(); - mystwarr_save_orig_tiles(); + mystwarr_save_orig_tiles(machine); K056832_vh_start(machine, REGION_GFX1, K056832_BPP_5, 0, NULL, game5bpp_tile_callback, 0); - mystwarr_rest_orig_tiles(); + mystwarr_rest_orig_tiles(machine); K055673_vh_start(machine, REGION_GFX2, 0, -58, -23, martchmp_sprite_callback); @@ -452,8 +452,8 @@ WRITE16_HANDLER(ddd_053936_clip_w) // reference: 223e5c in gaiapolis (ROMs 34j and 36m) READ16_HANDLER(gai_053936_tilerom_0_r) { - UINT8 *ROM1 = (UINT8 *)memory_region(REGION_GFX4); - UINT8 *ROM2 = (UINT8 *)memory_region(REGION_GFX4); + UINT8 *ROM1 = (UINT8 *)memory_region(machine, REGION_GFX4); + UINT8 *ROM2 = (UINT8 *)memory_region(machine, REGION_GFX4); ROM1 += 0x20000; ROM2 += 0x20000+0x40000; @@ -463,8 +463,8 @@ READ16_HANDLER(gai_053936_tilerom_0_r) READ16_HANDLER(ddd_053936_tilerom_0_r) { - UINT8 *ROM1 = (UINT8 *)memory_region(REGION_GFX4); - UINT8 *ROM2 = (UINT8 *)memory_region(REGION_GFX4); + UINT8 *ROM1 = (UINT8 *)memory_region(machine, REGION_GFX4); + UINT8 *ROM2 = (UINT8 *)memory_region(machine, REGION_GFX4); ROM2 += 0x40000; @@ -474,7 +474,7 @@ READ16_HANDLER(ddd_053936_tilerom_0_r) // reference: 223e1a in gaiapolis (ROM 36j) READ16_HANDLER(ddd_053936_tilerom_1_r) { - UINT8 *ROM = (UINT8 *)memory_region(REGION_GFX4); + UINT8 *ROM = (UINT8 *)memory_region(machine, REGION_GFX4); return ROM[offset/2]; } @@ -482,7 +482,7 @@ READ16_HANDLER(ddd_053936_tilerom_1_r) // reference: 223db0 in gaiapolis (ROMs 32n, 29n, 26n) READ16_HANDLER(gai_053936_tilerom_2_r) { - UINT8 *ROM = (UINT8 *)memory_region(REGION_GFX3); + UINT8 *ROM = (UINT8 *)memory_region(machine, REGION_GFX3); offset += (roz_rombank * 0x100000); @@ -491,7 +491,7 @@ READ16_HANDLER(gai_053936_tilerom_2_r) READ16_HANDLER(ddd_053936_tilerom_2_r) { - UINT8 *ROM = (UINT8 *)memory_region(REGION_GFX3); + UINT8 *ROM = (UINT8 *)memory_region(machine, REGION_GFX3); offset += (roz_rombank * 0x100000); diff --git a/src/mame/video/n8080.c b/src/mame/video/n8080.c index 2f7792dd825..ee22ab5aa1b 100644 --- a/src/mame/video/n8080.c +++ b/src/mame/video/n8080.c @@ -157,7 +157,7 @@ VIDEO_UPDATE( spacefev ) int y; const UINT8* pRAM = videoram; - const UINT8* pPROM = memory_region(REGION_PROMS); + const UINT8* pPROM = memory_region(screen->machine, REGION_PROMS); for (y = 0; y < 256; y++) { @@ -224,7 +224,7 @@ VIDEO_UPDATE( sheriff ) { UINT8 mask = flip_screen_get() ? 0xff : 0x00; - const UINT8* pPROM = memory_region(REGION_PROMS); + const UINT8* pPROM = memory_region(screen->machine, REGION_PROMS); int x; int y; diff --git a/src/mame/video/namcofl.c b/src/mame/video/namcofl.c index 202b1ec1ae0..d1b9bd93fda 100644 --- a/src/mame/video/namcofl.c +++ b/src/mame/video/namcofl.c @@ -183,7 +183,7 @@ VIDEO_START( namcofl ) old_coin_state = 0x00; //input_port_read_indexed(machine, 3)&0x30; - namco_tilemap_init( NAMCONB1_TILEGFX, memory_region(NAMCONB1_TILEMASKREGION), TilemapCB ); + namco_tilemap_init( NAMCONB1_TILEGFX, memory_region(machine, NAMCONB1_TILEMASKREGION), TilemapCB ); namco_obj_init(NAMCONB1_SPRITEGFX,0x0,FLobjcode2tile); namco_roz_init(NAMCONB1_ROTGFX,NAMCONB1_ROTMASKREGION); } /* namcofl_vh_start */ diff --git a/src/mame/video/namconb1.c b/src/mame/video/namconb1.c index 36606bc2f12..9da8a4f50b4 100644 --- a/src/mame/video/namconb1.c +++ b/src/mame/video/namconb1.c @@ -221,7 +221,7 @@ NB1objcode2tile( int code ) VIDEO_START( namconb1 ) { - namco_tilemap_init( NAMCONB1_TILEGFX, memory_region(NAMCONB1_TILEMASKREGION), NB1TilemapCB ); + namco_tilemap_init( NAMCONB1_TILEGFX, memory_region(machine, NAMCONB1_TILEMASKREGION), NB1TilemapCB ); namco_obj_init(NAMCONB1_SPRITEGFX,0x0,NB1objcode2tile); } /* namconb1 */ @@ -283,7 +283,7 @@ NB2objcode2tile( int code ) VIDEO_START( namconb2 ) { - namco_tilemap_init(NAMCONB1_TILEGFX, memory_region(NAMCONB1_TILEMASKREGION), NB2TilemapCB ); + namco_tilemap_init(NAMCONB1_TILEGFX, memory_region(machine, NAMCONB1_TILEMASKREGION), NB2TilemapCB ); namco_obj_init(NAMCONB1_SPRITEGFX,0x0,NB2objcode2tile); namco_roz_init(NAMCONB1_ROTGFX,NAMCONB1_ROTMASKREGION); } /* namconb2_vh_start */ diff --git a/src/mame/video/namcos1.c b/src/mame/video/namcos1.c index c317a5c61a3..02549277da6 100644 --- a/src/mame/video/namcos1.c +++ b/src/mame/video/namcos1.c @@ -100,7 +100,7 @@ VIDEO_START( namcos1 ) { int i; - tilemap_maskdata = (UINT8 *)memory_region(REGION_GFX1); + tilemap_maskdata = (UINT8 *)memory_region(machine, REGION_GFX1); /* allocate videoram */ namcos1_videoram = auto_malloc(0x8000); diff --git a/src/mame/video/namcos2.c b/src/mame/video/namcos2.c index 43500bda7f7..1bcf6e5486a 100644 --- a/src/mame/video/namcos2.c +++ b/src/mame/video/namcos2.c @@ -320,7 +320,7 @@ READ16_HANDLER( namcos2_sprite_ram_r ) VIDEO_START( namcos2 ) { - namco_tilemap_init(2,memory_region(REGION_GFX4),TilemapCB); + namco_tilemap_init(2,memory_region(machine, REGION_GFX4),TilemapCB); tilemap_roz = tilemap_create(get_tile_info_roz,tilemap_scan_rows,8,8,256,256); tilemap_set_transparent_pen(tilemap_roz,0xff); DrawSpriteInit(machine); @@ -372,7 +372,7 @@ VIDEO_UPDATE( namcos2_default ) VIDEO_START( finallap ) { - namco_tilemap_init(2,memory_region(REGION_GFX4),TilemapCB); + namco_tilemap_init(2,memory_region(machine, REGION_GFX4),TilemapCB); DrawSpriteInit(machine); namco_road_init(machine, 3); } @@ -402,7 +402,7 @@ VIDEO_UPDATE( finallap ) VIDEO_START( luckywld ) { - namco_tilemap_init(2,memory_region(REGION_GFX4),TilemapCB); + namco_tilemap_init(2,memory_region(machine, REGION_GFX4),TilemapCB); namco_obj_init( 0, 0x0, NULL ); if( namcos2_gametype==NAMCOS2_LUCKY_AND_WILD ) { @@ -443,7 +443,7 @@ VIDEO_UPDATE( luckywld ) VIDEO_START( sgunner ) { - namco_tilemap_init(2,memory_region(REGION_GFX4),TilemapCB); + namco_tilemap_init(2,memory_region(machine, REGION_GFX4),TilemapCB); namco_obj_init( 0, 0x0, NULL ); } @@ -469,7 +469,7 @@ VIDEO_UPDATE( sgunner ) VIDEO_START( metlhawk ) { - namco_tilemap_init(2,memory_region(REGION_GFX4),TilemapCB); + namco_tilemap_init(2,memory_region(machine, REGION_GFX4),TilemapCB); namco_roz_init( 1, REGION_GFX5 ); } diff --git a/src/mame/video/namcos22.c b/src/mame/video/namcos22.c index 6c1b29c6cc4..79f171978a2 100644 --- a/src/mame/video/namcos22.c +++ b/src/mame/video/namcos22.c @@ -611,7 +611,7 @@ ApplyGamma( bitmap_t *bitmap ) { int x,y; if( mbSuperSystem22 ) - { /* super system 22 */ + { /* super system 22 */ #ifdef LSB_FIRST #define XORPAT 0x3 #else @@ -635,7 +635,7 @@ ApplyGamma( bitmap_t *bitmap ) } else { /* system 22 */ - const UINT8 *rlut = 0x000+(const UINT8 *)memory_region(REGION_USER1); + const UINT8 *rlut = 0x000+(const UINT8 *)memory_region(Machine, REGION_USER1); const UINT8 *glut = 0x100+rlut; const UINT8 *blut = 0x200+rlut; for( y=0; y<bitmap->height; y++ ) @@ -2236,11 +2236,11 @@ static VIDEO_START( common ) mbDSPisActive = 0; memset( namcos22_polygonram, 0xcc, 0x20000 ); - Prepare3dTexture(memory_region(REGION_TEXTURE_TILEMAP), machine->gfx[GFX_TEXTURE_TILE]->gfxdata ); + Prepare3dTexture(memory_region(machine, REGION_TEXTURE_TILEMAP), machine->gfx[GFX_TEXTURE_TILE]->gfxdata ); dirtypal = auto_malloc(NAMCOS22_PALETTE_SIZE/4); cgdirty = auto_malloc( 0x400 ); - mPtRomSize = memory_region_length(REGION_POINTROM)/3; - mpPolyL = memory_region(REGION_POINTROM); + mPtRomSize = memory_region_length(machine, REGION_POINTROM)/3; + mpPolyL = memory_region(machine, REGION_POINTROM); mpPolyM = mpPolyL + mPtRomSize; mpPolyH = mpPolyM + mPtRomSize; diff --git a/src/mame/video/nbmj8688.c b/src/mame/video/nbmj8688.c index df0fc80747e..137beb6e0c8 100644 --- a/src/mame/video/nbmj8688.c +++ b/src/mame/video/nbmj8688.c @@ -33,7 +33,7 @@ static int HD61830B_addr[2]; static void mjsikaku_vramflip(void); -static void mbmj8688_gfxdraw(int gfxtype); +static void mbmj8688_gfxdraw(running_machine *machine, int gfxtype); /* the blitter can copy data both in "direct" mode, where every byte of the source @@ -145,7 +145,7 @@ WRITE8_HANDLER( nbmj8688_blitter_w ) case 0x04: blitter_sizex = data; break; case 0x05: blitter_sizey = data; /* writing here also starts the blit */ - mbmj8688_gfxdraw(mjsikaku_gfxmode); + mbmj8688_gfxdraw(machine, mjsikaku_gfxmode); break; case 0x06: blitter_direction_x = (data & 0x01) ? 1 : 0; blitter_direction_y = (data & 0x02) ? 1 : 0; @@ -184,7 +184,7 @@ WRITE8_HANDLER( mjsikaku_scrolly_w ) WRITE8_HANDLER( mjsikaku_romsel_w ) { - int gfxlen = memory_region_length(REGION_GFX1); + int gfxlen = memory_region_length(machine, REGION_GFX1); mjsikaku_gfxrom = (data & 0x0f); if ((mjsikaku_gfxrom << 17) > (gfxlen - 1)) @@ -198,7 +198,7 @@ WRITE8_HANDLER( mjsikaku_romsel_w ) WRITE8_HANDLER( secolove_romsel_w ) { - int gfxlen = memory_region_length(REGION_GFX1); + int gfxlen = memory_region_length(machine, REGION_GFX1); mjsikaku_gfxrom = ((data & 0xc0) >> 4) + (data & 0x03); mjsikaku_gfxflag2_w(machine, 0, data); @@ -213,7 +213,7 @@ WRITE8_HANDLER( secolove_romsel_w ) WRITE8_HANDLER( crystalg_romsel_w ) { - int gfxlen = memory_region_length(REGION_GFX1); + int gfxlen = memory_region_length(machine, REGION_GFX1); mjsikaku_gfxrom = (data & 0x03); mjsikaku_gfxflag2_w(machine, 0, data); @@ -228,7 +228,7 @@ WRITE8_HANDLER( crystalg_romsel_w ) WRITE8_HANDLER( seiha_romsel_w ) { - int gfxlen = memory_region_length(REGION_GFX1); + int gfxlen = memory_region_length(machine, REGION_GFX1); mjsikaku_gfxrom = (data & 0x1f); mjsikaku_gfxflag3_w(machine, 0, data); @@ -294,9 +294,9 @@ static TIMER_CALLBACK( blitter_timer_callback ) nb1413m3_busyflag = 1; } -static void mbmj8688_gfxdraw(int gfxtype) +static void mbmj8688_gfxdraw(running_machine *machine, int gfxtype) { - UINT8 *GFX = memory_region(REGION_GFX1); + UINT8 *GFX = memory_region(machine, REGION_GFX1); int x, y; int dx1, dx2, dy; @@ -339,7 +339,7 @@ static void mbmj8688_gfxdraw(int gfxtype) skipy = -1; } - gfxlen = memory_region_length(REGION_GFX1); + gfxlen = memory_region_length(machine, REGION_GFX1); gfxaddr = (mjsikaku_gfxrom << 17) + (blitter_src_addr << 1); //popmessage("ADDR:%08X DX:%03d DY:%03d SX:%03d SY:%03d", gfxaddr, startx, starty, sizex, sizey); //if (blitter_direction_x|blitter_direction_y) popmessage("ADDR:%08X FX:%01d FY:%01d", gfxaddr, blitter_direction_x, blitter_direction_y); diff --git a/src/mame/video/nbmj8891.c b/src/mame/video/nbmj8891.c index 21c95741380..9cd1835cabc 100644 --- a/src/mame/video/nbmj8891.c +++ b/src/mame/video/nbmj8891.c @@ -272,7 +272,7 @@ WRITE8_HANDLER( nbmj8891_vramsel_w ) WRITE8_HANDLER( nbmj8891_romsel_w ) { - int gfxlen = memory_region_length(REGION_GFX1); + int gfxlen = memory_region_length(machine, REGION_GFX1); nbmj8891_gfxrom = (data & 0x0f); if ((0x20000 * nbmj8891_gfxrom) > (gfxlen - 1)) @@ -337,7 +337,7 @@ static TIMER_CALLBACK( blitter_timer_callback ) static void nbmj8891_gfxdraw(running_machine *machine) { - UINT8 *GFX = memory_region(REGION_GFX1); + UINT8 *GFX = memory_region(machine, REGION_GFX1); int width = video_screen_get_width(machine->primary_screen); int x, y; @@ -376,7 +376,7 @@ static void nbmj8891_gfxdraw(running_machine *machine) skipy = -1; } - gfxlen = memory_region_length(REGION_GFX1); + gfxlen = memory_region_length(machine, REGION_GFX1); gfxaddr = (nbmj8891_gfxrom << 17) + (blitter_src_addr << 1); for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--) @@ -494,7 +494,7 @@ static void nbmj8891_gfxdraw(running_machine *machine) ******************************************************************************/ VIDEO_START( nbmj8891_1layer ) { - UINT8 *CLUT = memory_region(REGION_USER1); + UINT8 *CLUT = memory_region(machine, REGION_USER1); int i; int width = video_screen_get_width(machine->primary_screen); int height = video_screen_get_height(machine->primary_screen); diff --git a/src/mame/video/nbmj8991.c b/src/mame/video/nbmj8991.c index 94c90444e8b..5838310ebd3 100644 --- a/src/mame/video/nbmj8991.c +++ b/src/mame/video/nbmj8991.c @@ -93,7 +93,7 @@ WRITE8_HANDLER( nbmj8991_palette_type3_w ) ******************************************************************************/ WRITE8_HANDLER( nbmj8991_blitter_w ) { - int gfxlen = memory_region_length(REGION_GFX1); + int gfxlen = memory_region_length(machine, REGION_GFX1); switch (offset) { @@ -193,7 +193,7 @@ static TIMER_CALLBACK( blitter_timer_callback ) static void nbmj8991_gfxdraw(running_machine *machine) { - UINT8 *GFX = memory_region(REGION_GFX1); + UINT8 *GFX = memory_region(machine, REGION_GFX1); int width = video_screen_get_width(machine->primary_screen); int x, y; @@ -233,7 +233,7 @@ static void nbmj8991_gfxdraw(running_machine *machine) skipy = -1; } - gfxlen = memory_region_length(REGION_GFX1); + gfxlen = memory_region_length(machine, REGION_GFX1); gfxaddr = (nbmj8991_gfxrom << 17) + (blitter_src_addr << 1); for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--) diff --git a/src/mame/video/nbmj9195.c b/src/mame/video/nbmj9195.c index 18bbaeab92f..8eba6f17f30 100644 --- a/src/mame/video/nbmj9195.c +++ b/src/mame/video/nbmj9195.c @@ -98,10 +98,10 @@ WRITE8_HANDLER( nbmj9195_nb22090_palette_w ) ******************************************************************************/ -static int nbmj9195_blitter_r(int vram, int offset) +static int nbmj9195_blitter_r(running_machine *machine, int vram, int offset) { int ret; - UINT8 *GFXROM = memory_region(REGION_GFX1); + UINT8 *GFXROM = memory_region(machine, REGION_GFX1); switch (offset) { @@ -231,7 +231,7 @@ static TIMER_CALLBACK( blitter_timer_callback ) static void nbmj9195_gfxdraw(running_machine *machine, int vram) { - UINT8 *GFX = memory_region(REGION_GFX1); + UINT8 *GFX = memory_region(machine, REGION_GFX1); int width = video_screen_get_width(machine->primary_screen); int x, y; @@ -278,7 +278,7 @@ static void nbmj9195_gfxdraw(running_machine *machine, int vram) skipy = -1; } - gfxlen = memory_region_length(REGION_GFX1); + gfxlen = memory_region_length(machine, REGION_GFX1); gfxaddr = ((blitter_src_addr[vram] + 2) & 0x00ffffff); for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--) @@ -396,8 +396,8 @@ static void nbmj9195_gfxdraw(running_machine *machine, int vram) WRITE8_HANDLER( nbmj9195_blitter_0_w ) { nbmj9195_blitter_w(machine, 0, offset, data); } WRITE8_HANDLER( nbmj9195_blitter_1_w ) { nbmj9195_blitter_w(machine, 1, offset, data); } -READ8_HANDLER( nbmj9195_blitter_0_r ) { return nbmj9195_blitter_r(0, offset); } -READ8_HANDLER( nbmj9195_blitter_1_r ) { return nbmj9195_blitter_r(1, offset); } +READ8_HANDLER( nbmj9195_blitter_0_r ) { return nbmj9195_blitter_r(machine, 0, offset); } +READ8_HANDLER( nbmj9195_blitter_1_r ) { return nbmj9195_blitter_r(machine, 1, offset); } WRITE8_HANDLER( nbmj9195_clut_0_w ) { nbmj9195_clut_w(0, offset, data); } WRITE8_HANDLER( nbmj9195_clut_1_w ) { nbmj9195_clut_w(1, offset, data); } diff --git a/src/mame/video/neogeo.c b/src/mame/video/neogeo.c index 65eade6ea28..db72192dd97 100644 --- a/src/mame/video/neogeo.c +++ b/src/mame/video/neogeo.c @@ -279,12 +279,12 @@ void neogeo_set_fixed_layer_source(UINT8 data) } -static void draw_fixed_layer(bitmap_t *bitmap, int scanline) +static void draw_fixed_layer(running_machine *machine, bitmap_t *bitmap, int scanline) { int x; - UINT8* gfx_base = memory_region(fixed_layer_source ? NEOGEO_REGION_FIXED_LAYER_CARTRIDGE : NEOGEO_REGION_FIXED_LAYER_BIOS); - UINT32 addr_mask = memory_region_length(fixed_layer_source ? NEOGEO_REGION_FIXED_LAYER_CARTRIDGE : NEOGEO_REGION_FIXED_LAYER_BIOS) - 1; + UINT8* gfx_base = memory_region(machine, fixed_layer_source ? NEOGEO_REGION_FIXED_LAYER_CARTRIDGE : NEOGEO_REGION_FIXED_LAYER_BIOS); + UINT32 addr_mask = memory_region_length(machine, fixed_layer_source ? NEOGEO_REGION_FIXED_LAYER_CARTRIDGE : NEOGEO_REGION_FIXED_LAYER_BIOS) - 1; UINT16 *video_data = &neogeo_videoram[0x7000 | (scanline >> 3)]; UINT32 *pixel_addr = BITMAP_ADDR32(bitmap, scanline, NEOGEO_HBEND); @@ -413,7 +413,7 @@ INLINE int sprite_on_scanline(int scanline, int y, int rows) } -static void draw_sprites(bitmap_t *bitmap, int scanline) +static void draw_sprites(running_machine *machine, bitmap_t *bitmap, int scanline) { int sprite_index; int max_sprite_index; @@ -504,7 +504,7 @@ static void draw_sprites(bitmap_t *bitmap, int scanline) } } - sprite_y_and_tile = memory_region(NEOGEO_REGION_ZOOM_Y_TABLE)[(zoom_y << 8) | zoom_line]; + sprite_y_and_tile = memory_region(machine, NEOGEO_REGION_ZOOM_Y_TABLE)[(zoom_y << 8) | zoom_line]; sprite_y = sprite_y_and_tile & 0x0f; tile = sprite_y_and_tile >> 4; @@ -688,7 +688,7 @@ static void start_sprite_line_timer(running_machine *machine) } -static void optimize_sprite_data(void) +static void optimize_sprite_data(running_machine *machine) { /* convert the sprite graphics data into a format that allows faster blitting */ @@ -702,7 +702,7 @@ static void optimize_sprite_data(void) power of 2 */ sprite_gfx_address_mask = 0xffffffff; - len = memory_region_length(NEOGEO_REGION_SPRITES); + len = memory_region_length(machine, NEOGEO_REGION_SPRITES); for (bit = 0x80000000; bit != 0; bit >>= 1) { if (((len * 2) - 1) & bit) @@ -714,7 +714,7 @@ static void optimize_sprite_data(void) sprite_gfx = auto_malloc(sprite_gfx_address_mask + 1); memset(sprite_gfx, 0, sprite_gfx_address_mask + 1); - src = memory_region(NEOGEO_REGION_SPRITES); + src = memory_region(machine, NEOGEO_REGION_SPRITES); dest = sprite_gfx; for (i = 0; i < len; i += 0x80, src += 0x80) @@ -875,7 +875,7 @@ VIDEO_START( neogeo ) compute_rgb_weights(); create_sprite_line_timer(); create_auto_animation_timer(); - optimize_sprite_data(); + optimize_sprite_data(machine); /* initialize values that are not modified on a reset */ videoram_read_buffer = 0; @@ -931,9 +931,9 @@ VIDEO_UPDATE( neogeo ) /* fill with background color first */ fillbitmap(bitmap, pens[0x0fff], cliprect); - draw_sprites(bitmap, cliprect->min_y); + draw_sprites(screen->machine, bitmap, cliprect->min_y); - draw_fixed_layer(bitmap, cliprect->min_y); + draw_fixed_layer(screen->machine, bitmap, cliprect->min_y); return 0; } diff --git a/src/mame/video/niyanpai.c b/src/mame/video/niyanpai.c index 5dbe60e2cfa..06f3b5c1886 100644 --- a/src/mame/video/niyanpai.c +++ b/src/mame/video/niyanpai.c @@ -85,10 +85,10 @@ WRITE16_HANDLER( niyanpai_palette_w ) ******************************************************************************/ -static int niyanpai_blitter_r(int vram, int offset) +static int niyanpai_blitter_r(running_machine *machine, int vram, int offset) { int ret; - UINT8 *GFXROM = memory_region(REGION_GFX1); + UINT8 *GFXROM = memory_region(machine, REGION_GFX1); switch (offset) { @@ -196,7 +196,7 @@ static TIMER_CALLBACK( blitter_timer_callback ) static void niyanpai_gfxdraw(running_machine *machine, int vram) { - UINT8 *GFX = memory_region(REGION_GFX1); + UINT8 *GFX = memory_region(machine, REGION_GFX1); int width = video_screen_get_width(machine->primary_screen); int x, y; @@ -243,7 +243,7 @@ static void niyanpai_gfxdraw(running_machine *machine, int vram) skipy = -1; } - gfxlen = memory_region_length(REGION_GFX1); + gfxlen = memory_region_length(machine, REGION_GFX1); gfxaddr = ((blitter_src_addr[vram] + 2) & 0x00ffffff); for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--) @@ -357,9 +357,9 @@ WRITE16_HANDLER( niyanpai_blitter_0_w ) { niyanpai_blitter_w(machine, 0, offset, WRITE16_HANDLER( niyanpai_blitter_1_w ) { niyanpai_blitter_w(machine, 1, offset, data); } WRITE16_HANDLER( niyanpai_blitter_2_w ) { niyanpai_blitter_w(machine, 2, offset, data); } -READ16_HANDLER( niyanpai_blitter_0_r ) { return niyanpai_blitter_r(0, offset); } -READ16_HANDLER( niyanpai_blitter_1_r ) { return niyanpai_blitter_r(1, offset); } -READ16_HANDLER( niyanpai_blitter_2_r ) { return niyanpai_blitter_r(2, offset); } +READ16_HANDLER( niyanpai_blitter_0_r ) { return niyanpai_blitter_r(machine, 0, offset); } +READ16_HANDLER( niyanpai_blitter_1_r ) { return niyanpai_blitter_r(machine, 1, offset); } +READ16_HANDLER( niyanpai_blitter_2_r ) { return niyanpai_blitter_r(machine, 2, offset); } WRITE16_HANDLER( niyanpai_clut_0_w ) { niyanpai_clut_w(0, offset, data); } WRITE16_HANDLER( niyanpai_clut_1_w ) { niyanpai_clut_w(1, offset, data); } diff --git a/src/mame/video/nmk16.c b/src/mame/video/nmk16.c index 44bd34296a5..e8659427413 100644 --- a/src/mame/video/nmk16.c +++ b/src/mame/video/nmk16.c @@ -775,7 +775,7 @@ VIDEO_UPDATE( gunnail ) VIDEO_UPDATE( bioship ) { - UINT16 *tilerom = (UINT16 *)memory_region(REGION_GFX5); + UINT16 *tilerom = (UINT16 *)memory_region(screen->machine, REGION_GFX5); int scrollx=-(bioship_scroll[1] + bioship_scroll[0]*256); int scrolly=-(bioship_scroll[3] + bioship_scroll[2]*256); diff --git a/src/mame/video/othunder.c b/src/mame/video/othunder.c index 85f8c1f6b3a..aefbcbe5787 100644 --- a/src/mame/video/othunder.c +++ b/src/mame/video/othunder.c @@ -85,7 +85,7 @@ spriteram is being tested, take no notice of that.] static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,const int *primasks,int y_offs) { - UINT16 *spritemap = (UINT16 *)memory_region(REGION_USER1); + UINT16 *spritemap = (UINT16 *)memory_region(machine, REGION_USER1); UINT16 tile_mask = (machine->gfx[0]->total_elements) - 1; int offs, data, tilenum, color, flipx, flipy; int x, y, priority, curx, cury; diff --git a/src/mame/video/pacland.c b/src/mame/video/pacland.c index d6258631c2b..b700987affb 100644 --- a/src/mame/video/pacland.c +++ b/src/mame/video/pacland.c @@ -262,7 +262,7 @@ WRITE8_HANDLER( pacland_scroll1_w ) WRITE8_HANDLER( pacland_bankswitch_w ) { int bankaddress; - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); bankaddress = 0x10000 + ((data & 0x07) << 13); memory_set_bankptr(1,&RAM[bankaddress]); diff --git a/src/mame/video/pastelg.c b/src/mame/video/pastelg.c index 1d577b80969..2ef27e8e076 100644 --- a/src/mame/video/pastelg.c +++ b/src/mame/video/pastelg.c @@ -97,7 +97,7 @@ WRITE8_HANDLER( pastelg_blitter_w ) WRITE8_HANDLER( pastelg_romsel_w ) { - int gfxlen = memory_region_length(REGION_GFX1); + int gfxlen = memory_region_length(machine, REGION_GFX1); pastelg_gfxrom = ((data & 0xc0) >> 6); pastelg_palbank = ((data & 0x10) >> 4); nb1413m3_sndrombank1_w(machine, 0, data); @@ -146,7 +146,7 @@ static TIMER_CALLBACK( blitter_timer_callback ) static void pastelg_gfxdraw(running_machine *machine) { - UINT8 *GFX = memory_region(REGION_GFX1); + UINT8 *GFX = memory_region(machine, REGION_GFX1); int width = video_screen_get_width(machine->primary_screen); int x, y; @@ -186,7 +186,7 @@ static void pastelg_gfxdraw(running_machine *machine) skipy = -1; } - gfxlen = memory_region_length(REGION_GFX1); + gfxlen = memory_region_length(machine, REGION_GFX1); gfxaddr = (pastelg_gfxrom << 16) + blitter_src_addr; readflag = 0; diff --git a/src/mame/video/pgm.c b/src/mame/video/pgm.c index 5599683e8d7..28425d51ddb 100644 --- a/src/mame/video/pgm.c +++ b/src/mame/video/pgm.c @@ -11,10 +11,10 @@ static UINT16 *sprite_temp_render; /* Sprites - These are a pain! */ /* this decodes one of the funky sprites to a bitmap so we can draw it more easily -- slow but easier to use*/ -static void pgm_prepare_sprite(int wide, int high,int palt, int boffset) +static void pgm_prepare_sprite(running_machine *machine, int wide, int high,int palt, int boffset) { - UINT8 *bdata = memory_region ( REGION_GFX4 ); - size_t bdatasize = memory_region_length( REGION_GFX4 )-1; + UINT8 *bdata = memory_region ( machine, REGION_GFX4 ); + size_t bdatasize = memory_region_length( machine, REGION_GFX4 )-1; UINT8 *adata = pgm_sprite_a_region; size_t adatasize = pgm_sprite_a_region_allocate-1; int xcnt, ycnt; @@ -109,7 +109,7 @@ static void draw_sprite_line(int wide, UINT16* dest, int xzoom, int xgrow, int y } } /* this just loops over our decoded bitmap and puts it on the screen */ -static void draw_sprite_new_zoomed(int wide, int high, int xpos, int ypos, int palt, int boffset, int flip, bitmap_t* bitmap, UINT32 xzoom, int xgrow, UINT32 yzoom, int ygrow ) +static void draw_sprite_new_zoomed(running_machine *machine, int wide, int high, int xpos, int ypos, int palt, int boffset, int flip, bitmap_t* bitmap, UINT32 xzoom, int xgrow, UINT32 yzoom, int ygrow ) { int ycnt; int ydrawpos; @@ -118,7 +118,7 @@ static void draw_sprite_new_zoomed(int wide, int high, int xpos, int ypos, int p int ycntdraw; int yzoombit; - pgm_prepare_sprite( wide,high, palt, boffset ); + pgm_prepare_sprite( machine, wide,high, palt, boffset ); /* now draw it */ ycnt = 0; @@ -180,7 +180,7 @@ static void draw_sprite_new_zoomed(int wide, int high, int xpos, int ypos, int p static UINT16 *pgm_sprite_source; -static void draw_sprites(int priority, bitmap_t* bitmap) +static void draw_sprites(running_machine *machine, int priority, bitmap_t* bitmap) { /* ZZZZ Zxxx xxxx xxxx zzzz z-yy yyyy yyyy @@ -234,7 +234,7 @@ static void draw_sprites(int priority, bitmap_t* bitmap) if ((priority == 1) && (pri == 0)) break; - draw_sprite_new_zoomed(wide, high, xpos, ypos, palt, boff, flip, bitmap, xzoom,xgrow, yzoom,ygrow); + draw_sprite_new_zoomed(machine, wide, high, xpos, ypos, palt, boff, flip, bitmap, xzoom,xgrow, yzoom,ygrow); pgm_sprite_source += 5; } @@ -325,7 +325,7 @@ VIDEO_UPDATE( pgm ) fillbitmap(bitmap,get_black_pen(screen->machine),cliprect); pgm_sprite_source = pgm_spritebufferram; - draw_sprites(1, bitmap); + draw_sprites(screen->machine, 1, bitmap); tilemap_set_scrolly(pgm_bg_tilemap,0, pgm_videoregs[0x2000/2]); @@ -334,7 +334,7 @@ VIDEO_UPDATE( pgm ) tilemap_draw(bitmap,cliprect,pgm_bg_tilemap,0,0); - draw_sprites(0, bitmap); + draw_sprites(screen->machine, 0, bitmap); tilemap_set_scrolly(pgm_tx_tilemap,0, pgm_videoregs[0x5000/2]); tilemap_set_scrollx(pgm_tx_tilemap,0, pgm_videoregs[0x6000/2]); // Check diff --git a/src/mame/video/phoenix.c b/src/mame/video/phoenix.c index c808950d5e0..a137ba3f8d4 100644 --- a/src/mame/video/phoenix.c +++ b/src/mame/video/phoenix.c @@ -209,7 +209,7 @@ VIDEO_START( phoenix ) WRITE8_HANDLER( phoenix_videoram_w ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); videoram_pg[videoram_pg_index][offset] = data; diff --git a/src/mame/video/pitnrun.c b/src/mame/video/pitnrun.c index 91f8c6cdec4..4f528885645 100644 --- a/src/mame/video/pitnrun.c +++ b/src/mame/video/pitnrun.c @@ -112,10 +112,10 @@ WRITE8_HANDLER(pitnrun_color_select_w) tilemap_mark_all_tiles_dirty(ALL_TILEMAPS); } -static void pitnrun_spotlights(void) +static void pitnrun_spotlights(running_machine *machine) { int x,y,i,b,datapix; - UINT8 *ROM = memory_region(REGION_USER1); + UINT8 *ROM = memory_region(machine, REGION_USER1); for(i=0;i<4;i++) for(y=0;y<128;y++) for(x=0;x<16;x++) @@ -185,7 +185,7 @@ VIDEO_START(pitnrun) tmp_bitmap[1] = auto_bitmap_alloc(128,128,video_screen_get_format(machine->primary_screen)); tmp_bitmap[2] = auto_bitmap_alloc(128,128,video_screen_get_format(machine->primary_screen)); tmp_bitmap[3] = auto_bitmap_alloc(128,128,video_screen_get_format(machine->primary_screen)); - pitnrun_spotlights(); + pitnrun_spotlights(machine); } static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect ) @@ -230,19 +230,19 @@ VIDEO_UPDATE( pitnrun ) #ifdef MAME_DEBUG if (input_code_pressed_once(KEYCODE_Q)) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(screen->machine, REGION_CPU1); ROM[0x84f6]=0; /* lap 0 - normal */ } if (input_code_pressed_once(KEYCODE_W)) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(screen->machine, REGION_CPU1); ROM[0x84f6]=6; /* lap 6 = spotlight */ } if (input_code_pressed_once(KEYCODE_E)) { - UINT8 *ROM = memory_region(REGION_CPU1); + UINT8 *ROM = memory_region(screen->machine, REGION_CPU1); ROM[0x84f6]=2; /* lap 3 (trial 2)= lightnings */ ROM[0x8102]=1; } diff --git a/src/mame/video/playch10.c b/src/mame/video/playch10.c index 67c4c6cabf2..000351b326b 100644 --- a/src/mame/video/playch10.c +++ b/src/mame/video/playch10.c @@ -103,7 +103,7 @@ static TILE_GET_INFO( get_bg_tile_info ) VIDEO_START( playch10 ) { - const UINT8 *bios = memory_region(REGION_CPU1); + const UINT8 *bios = memory_region(machine, REGION_CPU1); pc10_bios = (bios[3] == 0x2a) ? 1 : 2; bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, @@ -114,7 +114,7 @@ VIDEO_START( playch10 ) VIDEO_START( playch10_hboard ) { - const UINT8 *bios = memory_region(REGION_CPU1); + const UINT8 *bios = memory_region(machine, REGION_CPU1); pc10_bios = (bios[3] == 0x2a) ? 1 : 2; bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, diff --git a/src/mame/video/plygonet.c b/src/mame/video/plygonet.c index 7e53146c887..ea51a8737af 100644 --- a/src/mame/video/plygonet.c +++ b/src/mame/video/plygonet.c @@ -67,7 +67,7 @@ VIDEO_START( polygonet ) // decode the ttl layer's gfx machine->gfx[ttl_gfx_index] = allocgfx(&charlayout); - decodegfx(machine->gfx[ttl_gfx_index], memory_region(REGION_GFX1), 0, machine->gfx[ttl_gfx_index]->total_elements); + decodegfx(machine->gfx[ttl_gfx_index], memory_region(machine, REGION_GFX1), 0, machine->gfx[ttl_gfx_index]->total_elements); machine->gfx[ttl_gfx_index]->total_colors = machine->config->total_colors / 16; diff --git a/src/mame/video/polepos.c b/src/mame/video/polepos.c index 71a6e8903e6..11251cd831b 100644 --- a/src/mame/video/polepos.c +++ b/src/mame/video/polepos.c @@ -352,9 +352,9 @@ WRITE8_HANDLER( polepos_alpha_w ) ***************************************************************************/ -static void draw_road(bitmap_t *bitmap) +static void draw_road(running_machine *machine, bitmap_t *bitmap) { - const UINT8 *road_control = memory_region(REGION_GFX5); + const UINT8 *road_control = memory_region(machine, REGION_GFX5); const UINT8 *road_bits1 = road_control + 0x2000; const UINT8 *road_bits2 = road_control + 0x4000; int x, y, i; @@ -433,7 +433,7 @@ static void zoom_sprite(running_machine *machine, bitmap_t *bitmap,int big, { const gfx_element *gfx = machine->gfx[big ? 3 : 2]; UINT8 *gfxdata = gfx->gfxdata + (code % gfx->total_elements) * gfx->char_modulo; - UINT8 *scaling_rom = memory_region(REGION_GFX6); + UINT8 *scaling_rom = memory_region(machine, REGION_GFX6); UINT32 transmask = colortable_get_transpen_mask(machine->colortable, gfx, color, 0x1f); int coloroffs = gfx->color_base + color * gfx->color_granularity; int x,y; @@ -512,7 +512,7 @@ VIDEO_UPDATE( polepos ) rectangle clip = *cliprect; clip.max_y = 127; tilemap_draw(bitmap,&clip,bg_tilemap,0,0); - draw_road(bitmap); + draw_road(screen->machine, bitmap); draw_sprites(screen->machine, bitmap,cliprect); tilemap_draw(bitmap,cliprect,tx_tilemap,0,0); /* following code should be enabled only in a debug build */ diff --git a/src/mame/video/policetr.c b/src/mame/video/policetr.c index 6cc0693cab3..efe01f73e21 100644 --- a/src/mame/video/policetr.c +++ b/src/mame/video/policetr.c @@ -42,10 +42,10 @@ static UINT32 srcbitmap_height_mask; VIDEO_START( policetr ) { /* the source bitmap is in ROM */ - srcbitmap = memory_region(REGION_GFX1); + srcbitmap = memory_region(machine, REGION_GFX1); /* compute the height */ - srcbitmap_height_mask = (memory_region_length(REGION_GFX1) / SRCBITMAP_WIDTH) - 1; + srcbitmap_height_mask = (memory_region_length(machine, REGION_GFX1) / SRCBITMAP_WIDTH) - 1; /* the destination bitmap is not directly accessible to the CPU */ dstbitmap = auto_malloc(DSTBITMAP_WIDTH * DSTBITMAP_HEIGHT); diff --git a/src/mame/video/popeye.c b/src/mame/video/popeye.c index a7caff31312..d758ec83582 100644 --- a/src/mame/video/popeye.c +++ b/src/mame/video/popeye.c @@ -137,7 +137,7 @@ PALETTE_INIT( popeyebl ) static void set_background_palette(running_machine *machine,int bank) { int i; - UINT8 *color_prom = memory_region(REGION_PROMS) + 16 * bank; + UINT8 *color_prom = memory_region(machine, REGION_PROMS) + 16 * bank; for (i = 0;i < 16;i++) { diff --git a/src/mame/video/ppu2c0x.c b/src/mame/video/ppu2c0x.c index 05f1ba96e96..9e17e822928 100644 --- a/src/mame/video/ppu2c0x.c +++ b/src/mame/video/ppu2c0x.c @@ -330,13 +330,13 @@ void ppu2c0x_init(running_machine *machine, const ppu2c0x_interface *interface ) } /* initialize the video ROM portion, if available */ - if ( ( intf->vrom_region[i] != REGION_INVALID ) && ( memory_region( intf->vrom_region[i] ) != 0 ) ) + if ( ( intf->vrom_region[i] != REGION_INVALID ) && ( memory_region( machine, intf->vrom_region[i] ) != 0 ) ) { /* mark that we have a videorom */ chips[i].has_videorom = 1; /* find out how many banks */ - chips[i].videorom_banks = memory_region_length( intf->vrom_region[i] ) / 0x2000; + chips[i].videorom_banks = memory_region_length( machine, intf->vrom_region[i] ) / 0x2000; /* tweak the layout accordingly */ if ( chips[i].has_videoram ) @@ -359,7 +359,7 @@ void ppu2c0x_init(running_machine *machine, const ppu2c0x_interface *interface ) /* now create the gfx region */ { gfx_layout gl; - UINT8 *src = (chips[i].has_videorom && !chips[i].has_videoram) ? memory_region( intf->vrom_region[i] ) : chips[i].videomem; + UINT8 *src = (chips[i].has_videorom && !chips[i].has_videoram) ? memory_region( machine, intf->vrom_region[i] ) : chips[i].videomem; memcpy(&gl, &ppu_charlayout, sizeof(gl)); gl.total = total; @@ -1415,7 +1415,7 @@ void ppu2c0x_set_videorom_bank( int num, int start_page, int num_pages, int bank int count = num_pages * 0x400; int rom_start = bank * bank_size * 16; - memcpy( &chips[num].videomem[vram_start], &memory_region( intf->vrom_region[num] )[rom_start], count ); + memcpy( &chips[num].videomem[vram_start], &memory_region( Machine, intf->vrom_region[num] )[rom_start], count ); } } diff --git a/src/mame/video/prehisle.c b/src/mame/video/prehisle.c index 14a0e0cffa2..b628db9a5cc 100644 --- a/src/mame/video/prehisle.c +++ b/src/mame/video/prehisle.c @@ -62,7 +62,7 @@ WRITE16_HANDLER( prehisle_control16_w ) static TILE_GET_INFO( get_bg2_tile_info ) { - UINT8 *tilerom = memory_region(REGION_GFX5); + UINT8 *tilerom = memory_region(machine, REGION_GFX5); int offs = tile_index * 2; int attr = tilerom[offs + 1] + (tilerom[offs] << 8); diff --git a/src/mame/video/psikyo.c b/src/mame/video/psikyo.c index 5a8a04e0d18..e430b03b03b 100644 --- a/src/mame/video/psikyo.c +++ b/src/mame/video/psikyo.c @@ -298,8 +298,8 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta UINT16 *spritelist = (UINT16 *)(spritebuf2 + 0x1800/4); - UINT8 *TILES = memory_region(REGION_USER1); // Sprites LUT - int TILES_LEN = memory_region_length(REGION_USER1); + UINT8 *TILES = memory_region(machine, REGION_USER1); // Sprites LUT + int TILES_LEN = memory_region_length(machine, REGION_USER1); int width = video_screen_get_width(machine->primary_screen); int height = video_screen_get_height(machine->primary_screen); diff --git a/src/mame/video/punchout.c b/src/mame/video/punchout.c index ebe6adf485b..447ff19b39e 100644 --- a/src/mame/video/punchout.c +++ b/src/mame/video/punchout.c @@ -332,7 +332,7 @@ static void drawbs2(running_machine *machine, bitmap_t *bitmap, const rectangle static void punchout_copy_top_palette(running_machine *machine, int bank) { int i; - const UINT8 *color_prom = memory_region(REGION_PROMS); + const UINT8 *color_prom = memory_region(machine, REGION_PROMS); // top monitor palette for (i = 0; i < 0x100; i++) @@ -351,7 +351,7 @@ static void punchout_copy_top_palette(running_machine *machine, int bank) static void punchout_copy_bot_palette(running_machine *machine, int bank) { int i; - const UINT8 *color_prom = memory_region(REGION_PROMS) + 0x600; + const UINT8 *color_prom = memory_region(machine, REGION_PROMS) + 0x600; // bottom monitor palette for (i = 0; i < 0x100; i++) diff --git a/src/mame/video/pushman.c b/src/mame/video/pushman.c index c9091c1eb4f..bf295b182ba 100644 --- a/src/mame/video/pushman.c +++ b/src/mame/video/pushman.c @@ -18,7 +18,7 @@ static TILEMAP_MAPPER( background_scan_rows ) static TILE_GET_INFO( get_back_tile_info ) { - UINT8 *bgMap = memory_region(REGION_GFX4); + UINT8 *bgMap = memory_region(machine, REGION_GFX4); int tile; tile=bgMap[tile_index<<1]+(bgMap[(tile_index<<1)+1]<<8); diff --git a/src/mame/video/quizdna.c b/src/mame/video/quizdna.c index f300cdd750c..c777b639080 100644 --- a/src/mame/video/quizdna.c +++ b/src/mame/video/quizdna.c @@ -37,7 +37,7 @@ static TILE_GET_INFO( get_bg_tile_info ) static TILE_GET_INFO( get_fg_tile_info ) { int code,col,x,y; - UINT8 *FG = memory_region(REGION_USER1); + UINT8 *FG = memory_region(machine, REGION_USER1); x = tile_index & 0x1f; y = FG[(tile_index >> 5) & 0x1f] & 0x3f; @@ -67,7 +67,7 @@ VIDEO_START( quizdna ) WRITE8_HANDLER( quizdna_bg_ram_w ) { - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); quizdna_bg_ram[offset] = data; RAM[0x12000+offset] = data; @@ -78,7 +78,7 @@ WRITE8_HANDLER( quizdna_fg_ram_w ) { int i; int offs = offset & 0xfff; - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); RAM[0x10000+offs] = data; RAM[0x11000+offs] = data; /* mirror */ diff --git a/src/mame/video/redalert.c b/src/mame/video/redalert.c index bd88867f7bf..7a51b1ee587 100644 --- a/src/mame/video/redalert.c +++ b/src/mame/video/redalert.c @@ -61,7 +61,7 @@ WRITE8_HANDLER( redalert_bitmap_videoram_w ) * *************************************/ -static void get_pens(pen_t *pens) +static void get_pens(running_machine *machine, pen_t *pens) { static const int resistances_bitmap[] = { 100 }; static const int resistances_charmap_rg[] = { 390, 220, 180 }; @@ -76,7 +76,7 @@ static void get_pens(pen_t *pens) double charmap_b_weights[2]; double back_r_weight[1]; double back_gb_weight[1]; - const UINT8 *prom = memory_region(REGION_PROMS); + const UINT8 *prom = memory_region(machine, REGION_PROMS); scaler = compute_resistor_weights(0, 0xff, -1, 1, resistances_bitmap, bitmap_weight, 470, 0, @@ -156,7 +156,7 @@ static VIDEO_UPDATE( redalert ) pen_t pens[NUM_CHARMAP_PENS + NUM_BITMAP_PENS + 1]; offs_t offs; - get_pens(pens); + get_pens(screen->machine, pens); for (offs = 0; offs < 0x2000; offs++) { @@ -228,7 +228,7 @@ static VIDEO_UPDATE( demoneye ) pen_t pens[NUM_CHARMAP_PENS + NUM_BITMAP_PENS + 1]; offs_t offs; - get_pens(pens); + get_pens(screen->machine, pens); for (offs = 0; offs < 0x2000; offs++) { diff --git a/src/mame/video/rollrace.c b/src/mame/video/rollrace.c index 51ab94e175a..e4b75bbdf39 100644 --- a/src/mame/video/rollrace.c +++ b/src/mame/video/rollrace.c @@ -64,7 +64,7 @@ VIDEO_UPDATE( rollrace ) int sx, sy; int scroll; int col; - const UINT8 *mem = memory_region(REGION_USER1); + const UINT8 *mem = memory_region(screen->machine, REGION_USER1); /* fill in background colour*/ fillbitmap(bitmap,ra_bkgpen,cliprect); diff --git a/src/mame/video/route16.c b/src/mame/video/route16.c index 3869d5b0ecc..40d3bbe4c75 100644 --- a/src/mame/video/route16.c +++ b/src/mame/video/route16.c @@ -82,8 +82,8 @@ VIDEO_UPDATE( route16 ) { offs_t offs; - UINT8 *color_prom1 = &memory_region(REGION_PROMS)[0x000]; - UINT8 *color_prom2 = &memory_region(REGION_PROMS)[0x100]; + UINT8 *color_prom1 = &memory_region(screen->machine, REGION_PROMS)[0x000]; + UINT8 *color_prom2 = &memory_region(screen->machine, REGION_PROMS)[0x100]; for (offs = 0; offs < route16_videoram_size; offs++) { @@ -132,14 +132,14 @@ VIDEO_UPDATE( route16 ) * The Stratovox video connections have been verified from the schematics */ -static int video_update_stratvox_ttmahjng(bitmap_t *bitmap, +static int video_update_stratvox_ttmahjng(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, pen_t (*make_pen)(UINT8)) { offs_t offs; - UINT8 *color_prom1 = &memory_region(REGION_PROMS)[0x000]; - UINT8 *color_prom2 = &memory_region(REGION_PROMS)[0x100]; + UINT8 *color_prom1 = &memory_region(machine, REGION_PROMS)[0x000]; + UINT8 *color_prom2 = &memory_region(machine, REGION_PROMS)[0x100]; for (offs = 0; offs < route16_videoram_size; offs++) { @@ -185,11 +185,11 @@ static int video_update_stratvox_ttmahjng(bitmap_t *bitmap, VIDEO_UPDATE( stratvox ) { - return video_update_stratvox_ttmahjng(bitmap, cliprect, route16_make_pen); + return video_update_stratvox_ttmahjng(screen->machine, bitmap, cliprect, route16_make_pen); } VIDEO_UPDATE( ttmahjng ) { - return video_update_stratvox_ttmahjng(bitmap, cliprect, ttmajng_make_pen); + return video_update_stratvox_ttmahjng(screen->machine, bitmap, cliprect, ttmajng_make_pen); } diff --git a/src/mame/video/rungun.c b/src/mame/video/rungun.c index 98c8cd4fae5..57f20234bd5 100644 --- a/src/mame/video/rungun.c +++ b/src/mame/video/rungun.c @@ -98,7 +98,7 @@ VIDEO_START(rng) // decode the ttl layer's gfx machine->gfx[ttl_gfx_index] = allocgfx(&charlayout); - decodegfx(machine->gfx[ttl_gfx_index], memory_region(REGION_GFX3), 0, machine->gfx[ttl_gfx_index]->total_elements); + decodegfx(machine->gfx[ttl_gfx_index], memory_region(machine, REGION_GFX3), 0, machine->gfx[ttl_gfx_index]->total_elements); machine->gfx[ttl_gfx_index]->total_colors = machine->config->total_colors / 16; diff --git a/src/mame/video/segag80r.c b/src/mame/video/segag80r.c index 1c4d57ed85c..17b41eafa75 100644 --- a/src/mame/video/segag80r.c +++ b/src/mame/video/segag80r.c @@ -171,7 +171,7 @@ static void spaceod_bg_init_palette(running_machine *machine) static TILE_GET_INFO( spaceod_get_tile_info ) { - int code = memory_region(REGION_GFX2)[tile_index + 0x1000 * (spaceod_bg_control >> 6)]; + int code = memory_region(machine, REGION_GFX2)[tile_index + 0x1000 * (spaceod_bg_control >> 6)]; SET_TILE_INFO(1, code + 0x100 * ((spaceod_bg_control >> 2) & 1), 0, 0); } @@ -186,7 +186,7 @@ static TILEMAP_MAPPER( spaceod_scan_rows ) static TILE_GET_INFO( bg_get_tile_info ) { - int code = memory_region(REGION_GFX2)[tile_index]; + int code = memory_region(machine, REGION_GFX2)[tile_index]; SET_TILE_INFO(1, code + 0x100 * bg_char_bank, code >> 4, 0); } @@ -233,13 +233,13 @@ VIDEO_START( segag80r ) /* background tilemap is effectively 1 screen x n screens */ case G80_BACKGROUND_MONSTERB: - bg_tilemap = tilemap_create(bg_get_tile_info, tilemap_scan_rows, 8,8, 32,memory_region_length(REGION_GFX2) / 32); + bg_tilemap = tilemap_create(bg_get_tile_info, tilemap_scan_rows, 8,8, 32,memory_region_length(machine, REGION_GFX2) / 32); break; /* background tilemap is effectively 4 screens x n screens */ case G80_BACKGROUND_PIGNEWT: case G80_BACKGROUND_SINDBADM: - bg_tilemap = tilemap_create(bg_get_tile_info, tilemap_scan_rows, 8,8, 128,memory_region_length(REGION_GFX2) / 128); + bg_tilemap = tilemap_create(bg_get_tile_info, tilemap_scan_rows, 8,8, 128,memory_region_length(machine, REGION_GFX2) / 128); break; } diff --git a/src/mame/video/segag80v.c b/src/mame/video/segag80v.c index 27825052f2a..05f49a4a3db 100644 --- a/src/mame/video/segag80v.c +++ b/src/mame/video/segag80v.c @@ -110,9 +110,9 @@ INLINE int adjust_xy(int rawx, int rawy, int *outx, int *outy) } -static void sega_generate_vector_list(void) +static void sega_generate_vector_list(running_machine *machine) { - UINT8 *sintable = memory_region(REGION_PROMS); + UINT8 *sintable = memory_region(machine, REGION_PROMS); double total_time = 1.0 / (double)IRQ_CLOCK; UINT16 symaddr = 0; @@ -337,7 +337,7 @@ VIDEO_START( sega ) VIDEO_UPDATE( sega ) { - sega_generate_vector_list(); + sega_generate_vector_list(screen->machine); VIDEO_UPDATE_CALL(vector); return 0; } diff --git a/src/mame/video/segaic16.c b/src/mame/video/segaic16.c index cecd7c6bce2..e1dbd3088cf 100644 --- a/src/mame/video/segaic16.c +++ b/src/mame/video/segaic16.c @@ -424,7 +424,7 @@ struct sprite_info UINT16 colorbase; /* base color index */ INT32 ramsize; /* size of sprite RAM */ INT32 xoffs; /* X scroll offset */ - void (*draw)(struct sprite_info *info, bitmap_t *bitmap, const rectangle *cliprect); + void (*draw)(running_machine *machine, struct sprite_info *info, bitmap_t *bitmap, const rectangle *cliprect); UINT16 * spriteram; /* pointer to spriteram pointer */ UINT16 * buffer; /* buffered spriteram for those that use it */ }; @@ -1496,11 +1496,11 @@ WRITE16_HANDLER( segaic16_textram_0_w ) pri[x] = 0xff; \ } \ -static void segaic16_sprites_hangon_draw(struct sprite_info *info, bitmap_t *bitmap, const rectangle *cliprect) +static void segaic16_sprites_hangon_draw(running_machine *machine, struct sprite_info *info, bitmap_t *bitmap, const rectangle *cliprect) { - UINT8 numbanks = memory_region_length(REGION_GFX2) / 0x10000; - const UINT16 *spritebase = (const UINT16 *)memory_region(REGION_GFX2); - const UINT8 *zoom = (const UINT8 *)memory_region(REGION_PROMS); + UINT8 numbanks = memory_region_length(machine, REGION_GFX2) / 0x10000; + const UINT16 *spritebase = (const UINT16 *)memory_region(machine, REGION_GFX2); + const UINT8 *zoom = (const UINT8 *)memory_region(machine, REGION_PROMS); UINT16 *data; /* first scan forward to find the end of the list */ @@ -1660,11 +1660,11 @@ static void segaic16_sprites_hangon_draw(struct sprite_info *info, bitmap_t *bit pri[x] = 0xff; \ } \ -static void segaic16_sprites_sharrier_draw(struct sprite_info *info, bitmap_t *bitmap, const rectangle *cliprect) +static void segaic16_sprites_sharrier_draw(running_machine *machine, struct sprite_info *info, bitmap_t *bitmap, const rectangle *cliprect) { - UINT8 numbanks = memory_region_length(REGION_GFX2) / 0x20000; - const UINT32 *spritebase = (const UINT32 *)memory_region(REGION_GFX2); - const UINT8 *zoom = (const UINT8 *)memory_region(REGION_PROMS); + UINT8 numbanks = memory_region_length(machine, REGION_GFX2) / 0x20000; + const UINT32 *spritebase = (const UINT32 *)memory_region(machine, REGION_GFX2); + const UINT8 *zoom = (const UINT8 *)memory_region(machine, REGION_PROMS); UINT16 *data; /* first scan forward to find the end of the list */ @@ -1830,10 +1830,10 @@ static void segaic16_sprites_sharrier_draw(struct sprite_info *info, bitmap_t *b pri[x] = 0xff; \ } \ -static void segaic16_sprites_16a_draw(struct sprite_info *info, bitmap_t *bitmap, const rectangle *cliprect) +static void segaic16_sprites_16a_draw(running_machine *machine, struct sprite_info *info, bitmap_t *bitmap, const rectangle *cliprect) { - UINT8 numbanks = memory_region_length(REGION_GFX2) / 0x10000; - const UINT16 *spritebase = (const UINT16 *)memory_region(REGION_GFX2); + UINT8 numbanks = memory_region_length(machine, REGION_GFX2) / 0x10000; + const UINT16 *spritebase = (const UINT16 *)memory_region(machine, REGION_GFX2); UINT16 *data; /* first scan forward to find the end of the list */ @@ -1985,17 +1985,17 @@ static void segaic16_sprites_16a_draw(struct sprite_info *info, bitmap_t *bitmap pri[x] = 0xff; \ } \ -static void segaic16_sprites_16b_draw(struct sprite_info *info, bitmap_t *bitmap, const rectangle *cliprect) +static void segaic16_sprites_16b_draw(running_machine *machine, struct sprite_info *info, bitmap_t *bitmap, const rectangle *cliprect) { UINT8 numbanks; const UINT16 *spritebase; UINT16 *data; - spritebase = (const UINT16 *)memory_region(REGION_GFX2); + spritebase = (const UINT16 *)memory_region(machine, REGION_GFX2); if (!spritebase) return; - numbanks = memory_region_length(REGION_GFX2) / 0x20000; + numbanks = memory_region_length(machine, REGION_GFX2) / 0x20000; /* first scan forward to find the end of the list */ for (data = info->spriteram; data < info->spriteram + info->ramsize/2; data += 8) @@ -2143,10 +2143,10 @@ static void segaic16_sprites_16b_draw(struct sprite_info *info, bitmap_t *bitmap pri[x] = 0; \ } \ -static void segaic16_sprites_yboard_16b_draw(struct sprite_info *info, bitmap_t *bitmap, const rectangle *cliprect) +static void segaic16_sprites_yboard_16b_draw(running_machine *machine, struct sprite_info *info, bitmap_t *bitmap, const rectangle *cliprect) { - UINT8 numbanks = memory_region_length(REGION_GFX2) / 0x20000; - const UINT16 *spritebase = (const UINT16 *)memory_region(REGION_GFX2); + UINT8 numbanks = memory_region_length(machine, REGION_GFX2) / 0x20000; + const UINT16 *spritebase = (const UINT16 *)memory_region(machine, REGION_GFX2); UINT16 *data; /* first scan forward to find the end of the list */ @@ -2320,10 +2320,10 @@ static void segaic16_sprites_yboard_16b_draw(struct sprite_info *info, bitmap_t pri[x] = 0xff; \ } \ -static void segaic16_sprites_outrun_draw(struct sprite_info *info, bitmap_t *bitmap, const rectangle *cliprect) +static void segaic16_sprites_outrun_draw(running_machine *machine, struct sprite_info *info, bitmap_t *bitmap, const rectangle *cliprect) { - UINT8 numbanks = memory_region_length(REGION_GFX2) / 0x40000; - const UINT32 *spritebase = (const UINT32 *)memory_region(REGION_GFX2); + UINT8 numbanks = memory_region_length(machine, REGION_GFX2) / 0x40000; + const UINT32 *spritebase = (const UINT32 *)memory_region(machine, REGION_GFX2); UINT16 *data; /* first scan forward to find the end of the list */ @@ -2481,10 +2481,10 @@ static void segaic16_sprites_outrun_draw(struct sprite_info *info, bitmap_t *bit if (x >= minx && x <= maxx && ind < 0x1fe) \ dest[x] = ind | colorpri; \ -static void segaic16_sprites_yboard_draw(struct sprite_info *info, bitmap_t *bitmap, const rectangle *cliprect) +static void segaic16_sprites_yboard_draw(running_machine *machine, struct sprite_info *info, bitmap_t *bitmap, const rectangle *cliprect) { - UINT8 numbanks = memory_region_length(REGION_GFX1) / 0x80000; - const UINT64 *spritebase = (const UINT64 *)memory_region(REGION_GFX1); + UINT8 numbanks = memory_region_length(machine, REGION_GFX1) / 0x80000; + const UINT64 *spritebase = (const UINT64 *)memory_region(machine, REGION_GFX1); const UINT16 *rotatebase = rotate[0].buffer ? rotate[0].buffer : rotate[0].rotateram; UINT8 visited[0x1000]; UINT16 *data; @@ -2747,7 +2747,7 @@ void segaic16_sprites_init(int which, int type, int colorbase, int xoffs) void segaic16_sprites_draw(int which, bitmap_t *bitmap, const rectangle *cliprect) { struct sprite_info *info = &sprites[which]; - (*info->draw)(info, bitmap, cliprect); + (*info->draw)(Machine, info, bitmap, cliprect); } @@ -2892,11 +2892,11 @@ WRITE16_HANDLER( segaic16_sprites_draw_1_w ) * *******************************************************************************************/ -static void segaic16_road_hangon_decode(struct road_info *info) +static void segaic16_road_hangon_decode(running_machine *machine, struct road_info *info) { int x, y; - const UINT8 *gfx = memory_region(REGION_GFX3); - int len = memory_region_length(REGION_GFX3); + const UINT8 *gfx = memory_region(machine, REGION_GFX3); + int len = memory_region_length(machine, REGION_GFX3); /* allocate memory for the unpacked road data */ info->gfx = auto_malloc(256 * 512); @@ -3153,11 +3153,11 @@ static void segaic16_road_hangon_draw(struct road_info *info, bitmap_t *bitmap, * *******************************************************************************************/ -static void segaic16_road_outrun_decode(struct road_info *info) +static void segaic16_road_outrun_decode(running_machine *machine, struct road_info *info) { int x, y; - const UINT8 *gfx = memory_region(REGION_GFX3); - int len = memory_region_length(REGION_GFX3); + const UINT8 *gfx = memory_region(machine, REGION_GFX3); + int len = memory_region_length(machine, REGION_GFX3); /* allocate memory for the unpacked road data */ info->gfx = auto_malloc((256 * 2 + 1) * 512); @@ -3387,14 +3387,14 @@ void segaic16_road_init(int which, int type, int colorbase1, int colorbase2, int case SEGAIC16_ROAD_HANGON: case SEGAIC16_ROAD_SHARRIER: info->draw = segaic16_road_hangon_draw; - segaic16_road_hangon_decode(info); + segaic16_road_hangon_decode(Machine, info); break; case SEGAIC16_ROAD_OUTRUN: case SEGAIC16_ROAD_XBOARD: info->buffer = auto_malloc(0x1000); info->draw = segaic16_road_outrun_draw; - segaic16_road_outrun_decode(info); + segaic16_road_outrun_decode(Machine, info); break; default: diff --git a/src/mame/video/segas32.c b/src/mame/video/segas32.c index d2756710881..734799f6238 100644 --- a/src/mame/video/segas32.c +++ b/src/mame/video/segas32.c @@ -275,7 +275,7 @@ static UINT32 *spriteram_32bit; static TILE_GET_INFO( get_tile_info ); static void sprite_erase_buffer(void); static void sprite_swap_buffers(void); -static void sprite_render_list(void); +static void sprite_render_list(running_machine *machine); @@ -368,7 +368,7 @@ static TIMER_CALLBACK( update_sprites ) if (sprite_control[0] & 1) { sprite_swap_buffers(); - sprite_render_list(); + sprite_render_list(machine); } sprite_control[0] = 0; } @@ -1696,7 +1696,7 @@ static void sprite_swap_buffers(void) } \ } -static int draw_one_sprite(UINT16 *data, int xoffs, int yoffs, const rectangle *clipin, const rectangle *clipout) +static int draw_one_sprite(running_machine *machine, UINT16 *data, int xoffs, int yoffs, const rectangle *clipin, const rectangle *clipout) { static const int transparency_masks[4][4] = { @@ -1707,8 +1707,8 @@ static int draw_one_sprite(UINT16 *data, int xoffs, int yoffs, const rectangle * }; bitmap_t *bitmap = layer_data[(!is_multi32 || !(data[3] & 0x0800)) ? MIXER_LAYER_SPRITES_2 : MIXER_LAYER_MULTISPR_2].bitmap; - UINT8 numbanks = memory_region_length(REGION_GFX2) / 0x400000; - const UINT32 *spritebase = (const UINT32 *)memory_region(REGION_GFX2); + UINT8 numbanks = memory_region_length(machine, REGION_GFX2) / 0x400000; + const UINT32 *spritebase = (const UINT32 *)memory_region(machine, REGION_GFX2); int indirect = data[0] & 0x2000; int indlocal = data[0] & 0x1000; @@ -1897,7 +1897,7 @@ bail: -static void sprite_render_list(void) +static void sprite_render_list(running_machine *machine) { rectangle outerclip, clipin, clipout; int xoffs = 0, yoffs = 0; @@ -1928,7 +1928,7 @@ static void sprite_render_list(void) { /* command 0 = draw sprite */ case 0: - spritenum += 1 + draw_one_sprite(sprite, xoffs, yoffs, &clipin, &clipout); + spritenum += 1 + draw_one_sprite(machine, sprite, xoffs, yoffs, &clipin, &clipout); break; /* command 1 = set clipping */ diff --git a/src/mame/video/seibuspi.c b/src/mame/video/seibuspi.c index e91902114c1..5a4608138c0 100644 --- a/src/mame/video/seibuspi.c +++ b/src/mame/video/seibuspi.c @@ -523,7 +523,7 @@ VIDEO_START( spi ) for (i = 6000; i < 6016; i++) { alpha_table[i] = 1; } for (i = 6128; i < 6144; i++) { alpha_table[i] = 1; } - region_length = memory_region_length(REGION_GFX2); + region_length = memory_region_length(machine, REGION_GFX2); if (region_length <= 0x300000) { diff --git a/src/mame/video/senjyo.c b/src/mame/video/senjyo.c index de06d1460fe..525715a883e 100644 --- a/src/mame/video/senjyo.c +++ b/src/mame/video/senjyo.c @@ -32,7 +32,7 @@ DRIVER_INIT( starforc ) DRIVER_INIT( starfore ) { /* encrypted CPU */ - suprloco_decode(); + suprloco_decode(machine); senjyo = 0; scrollhack = 0; diff --git a/src/mame/video/seta.c b/src/mame/video/seta.c index 27f84fb85c4..c639662eab5 100644 --- a/src/mame/video/seta.c +++ b/src/mame/video/seta.c @@ -304,8 +304,8 @@ WRITE16_HANDLER( seta_vregs_w ) if (new_bank != seta_samples_bank) { - UINT8 *rom = memory_region(REGION_SOUND1); - int samples_len = memory_region_length(REGION_SOUND1); + UINT8 *rom = memory_region(machine, REGION_SOUND1); + int samples_len = memory_region_length(machine, REGION_SOUND1); int addr; seta_samples_bank = new_bank; diff --git a/src/mame/video/sf.c b/src/mame/video/sf.c index 0b04d74d2ee..66e15edf172 100644 --- a/src/mame/video/sf.c +++ b/src/mame/video/sf.c @@ -16,7 +16,7 @@ static tilemap *bg_tilemap, *fg_tilemap, *tx_tilemap; static TILE_GET_INFO( get_bg_tile_info ) { - UINT8 *base = memory_region(REGION_GFX5) + 2*tile_index; + UINT8 *base = memory_region(machine, REGION_GFX5) + 2*tile_index; int attr = base[0x10000]; int color = base[0]; int code = (base[0x10000+1]<<8) | base[1]; @@ -29,7 +29,7 @@ static TILE_GET_INFO( get_bg_tile_info ) static TILE_GET_INFO( get_fg_tile_info ) { - UINT8 *base = memory_region(REGION_GFX5) + 0x20000 + 2*tile_index; + UINT8 *base = memory_region(machine, REGION_GFX5) + 0x20000 + 2*tile_index; int attr = base[0x10000]; int color = base[0]; int code = (base[0x10000+1]<<8) | base[1]; diff --git a/src/mame/video/shangkid.c b/src/mame/video/shangkid.c index e9ba17beb75..2d7fb4c6741 100644 --- a/src/mame/video/shangkid.c +++ b/src/mame/video/shangkid.c @@ -45,7 +45,7 @@ static TILE_GET_INFO( get_bg_tile_info ){ } tileinfo->category = - (memory_region( REGION_PROMS )[0x800+color*4]==2)?1:0; + (memory_region( machine, REGION_PROMS )[0x800+color*4]==2)?1:0; } VIDEO_START( shangkid ) diff --git a/src/mame/video/shisen.c b/src/mame/video/shisen.c index aa2d13b0132..ca7432af02f 100644 --- a/src/mame/video/shisen.c +++ b/src/mame/video/shisen.c @@ -14,7 +14,7 @@ WRITE8_HANDLER( sichuan2_bankswitch_w ) { int bankaddress; int bank; - UINT8 *RAM = memory_region(REGION_CPU1); + UINT8 *RAM = memory_region(machine, REGION_CPU1); if (data & 0xc0) logerror("bank switch %02x\n",data); diff --git a/src/mame/video/sidearms.c b/src/mame/video/sidearms.c index 61283170deb..eb34b24986f 100644 --- a/src/mame/video/sidearms.c +++ b/src/mame/video/sidearms.c @@ -146,7 +146,7 @@ static TILEMAP_MAPPER( sidearms_tilemap_scan ) VIDEO_START( sidearms ) { - tilerom = memory_region(REGION_GFX4); + tilerom = memory_region(machine, REGION_GFX4); if (!sidearms_gameid) { @@ -203,7 +203,7 @@ static void draw_sprites_region(running_machine *machine, bitmap_t *bitmap, cons } } -static void sidearms_draw_starfield( bitmap_t *bitmap ) +static void sidearms_draw_starfield( running_machine *machine, bitmap_t *bitmap ) { int x, y, i; UINT32 hadd_283, vadd_283, _hflop_74a_n, _hcount_191, _vcount_191; @@ -227,7 +227,7 @@ static void sidearms_draw_starfield( bitmap_t *bitmap ) _vcount_191 = vcount_191; _hcount_191 = hcount_191 & 0xff; - sf_rom = memory_region(REGION_USER1); + sf_rom = memory_region(machine, REGION_USER1); #if 0 // old loop (for reference; easier to read) if (!flipon) @@ -341,7 +341,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta VIDEO_UPDATE( sidearms ) { - sidearms_draw_starfield(bitmap); + sidearms_draw_starfield(screen->machine, bitmap); tilemap_set_scrollx(bg_tilemap, 0, sidearms_bg_scrollx[0] + (sidearms_bg_scrollx[1] << 8 & 0xf00)); tilemap_set_scrolly(bg_tilemap, 0, sidearms_bg_scrolly[0] + (sidearms_bg_scrolly[1] << 8 & 0xf00)); diff --git a/src/mame/video/skyfox.c b/src/mame/video/skyfox.c index 13f3a26b8b9..ec1c83a9e8a 100644 --- a/src/mame/video/skyfox.c +++ b/src/mame/video/skyfox.c @@ -243,9 +243,9 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta ***************************************************************************/ -static void draw_background(bitmap_t *bitmap, const rectangle *cliprect) +static void draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) { - UINT8 *RAM = memory_region(REGION_GFX2); + UINT8 *RAM = memory_region(machine, REGION_GFX2); int x,y,i; /* The foreground stars (sprites) move at twice this speed when @@ -288,7 +288,7 @@ static void draw_background(bitmap_t *bitmap, const rectangle *cliprect) VIDEO_UPDATE( skyfox ) { fillbitmap(bitmap,255,cliprect); // the bg is black - draw_background(bitmap, cliprect); + draw_background(screen->machine, bitmap, cliprect); draw_sprites(screen->machine, bitmap, cliprect); return 0; } diff --git a/src/mame/video/skyraid.c b/src/mame/video/skyraid.c index 1cc462b232c..4d46170fd87 100644 --- a/src/mame/video/skyraid.c +++ b/src/mame/video/skyraid.c @@ -40,9 +40,9 @@ static void draw_text(running_machine *machine, bitmap_t* bitmap, const rectangl } -static void draw_terrain(bitmap_t* bitmap, const rectangle *cliprect) +static void draw_terrain(running_machine *machine, bitmap_t* bitmap, const rectangle *cliprect) { - const UINT8* p = memory_region(REGION_USER1); + const UINT8* p = memory_region(machine, REGION_USER1); int x; int y; @@ -118,9 +118,9 @@ static void draw_missiles(running_machine *machine, bitmap_t* bitmap, const rect } -static void draw_trapezoid(bitmap_t* dst, bitmap_t* src) +static void draw_trapezoid(running_machine *machine, bitmap_t* dst, bitmap_t* src) { - const UINT8* p = memory_region(REGION_USER2); + const UINT8* p = memory_region(machine, REGION_USER2); int x; int y; @@ -143,10 +143,10 @@ VIDEO_UPDATE( skyraid ) { fillbitmap(bitmap, 0, cliprect); - draw_terrain(helper, cliprect); + draw_terrain(screen->machine, helper, cliprect); draw_sprites(screen->machine, helper, cliprect); draw_missiles(screen->machine, helper, cliprect); - draw_trapezoid(bitmap, helper); + draw_trapezoid(screen->machine, bitmap, helper); draw_text(screen->machine, bitmap, cliprect); return 0; } diff --git a/src/mame/video/spacefb.c b/src/mame/video/spacefb.c index dbe750e7907..1de9549b5af 100644 --- a/src/mame/video/spacefb.c +++ b/src/mame/video/spacefb.c @@ -215,10 +215,10 @@ static void draw_starfield(const device_config *screen, bitmap_t *bitmap, const #define NUM_SPRITE_PENS (0x40) -static void get_sprite_pens(pen_t *pens) +static void get_sprite_pens(running_machine *machine, pen_t *pens) { static const double fade_weights[] = { 1.0, 1.5, 2.5, 4.0 }; - const UINT8 *prom = memory_region(REGION_PROMS); + const UINT8 *prom = memory_region(machine, REGION_PROMS); int i; for (i = 0; i < NUM_SPRITE_PENS; i++) @@ -255,11 +255,11 @@ static void get_sprite_pens(pen_t *pens) } -static void draw_bullet(offs_t offs, pen_t pen, bitmap_t *bitmap, const rectangle *cliprect, int flip) +static void draw_bullet(running_machine *machine, offs_t offs, pen_t pen, bitmap_t *bitmap, const rectangle *cliprect, int flip) { UINT8 sy; - UINT8 *gfx = memory_region(REGION_GFX2); + UINT8 *gfx = memory_region(machine, REGION_GFX2); UINT8 code = spacefb_videoram[offs + 0x0200] & 0x3f; UINT8 y = ~spacefb_videoram[offs + 0x0100] - 2; @@ -306,11 +306,11 @@ static void draw_bullet(offs_t offs, pen_t pen, bitmap_t *bitmap, const rectangl } -static void draw_sprite(offs_t offs, pen_t *pens, bitmap_t *bitmap, const rectangle *cliprect, int flip) +static void draw_sprite(running_machine *machine, offs_t offs, pen_t *pens, bitmap_t *bitmap, const rectangle *cliprect, int flip) { UINT8 sy; - UINT8 *gfx = memory_region(REGION_GFX1); + UINT8 *gfx = memory_region(machine, REGION_GFX1); UINT8 code = ~spacefb_videoram[offs + 0x0200]; UINT8 color_base = (~spacefb_videoram[offs + 0x0300] & 0x0f) << 2; @@ -363,7 +363,7 @@ static void draw_sprite(offs_t offs, pen_t *pens, bitmap_t *bitmap, const rectan } -static void draw_objects(bitmap_t *bitmap, const rectangle *cliprect) +static void draw_objects(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) { pen_t sprite_pens[NUM_SPRITE_PENS]; @@ -374,16 +374,16 @@ static void draw_objects(bitmap_t *bitmap, const rectangle *cliprect) connected is impossible, just use pure red for now */ pen_t bullet_pen = MAKE_RGB(0xff, 0x00, 0x00); - get_sprite_pens(sprite_pens); + get_sprite_pens(machine, sprite_pens); memset(object_present_map, 0, bitmap->width * bitmap->height); while (1) { if (spacefb_videoram[offs + 0x0300] & 0x20) - draw_bullet(offs, bullet_pen, bitmap, cliprect, flip); + draw_bullet(machine, offs, bullet_pen, bitmap, cliprect, flip); else if (spacefb_videoram[offs + 0x0300] & 0x40) - draw_sprite(offs, sprite_pens, bitmap, cliprect, flip); + draw_sprite(machine, offs, sprite_pens, bitmap, cliprect, flip); /* next object */ offs = offs + 1; @@ -403,7 +403,7 @@ static void draw_objects(bitmap_t *bitmap, const rectangle *cliprect) VIDEO_UPDATE( spacefb ) { - draw_objects(bitmap, cliprect); + draw_objects(screen->machine, bitmap, cliprect); draw_starfield(screen, bitmap, cliprect); return 0; diff --git a/src/mame/video/spdodgeb.c b/src/mame/video/spdodgeb.c index 8f6c4155e37..eaa4cffe480 100644 --- a/src/mame/video/spdodgeb.c +++ b/src/mame/video/spdodgeb.c @@ -115,7 +115,7 @@ WRITE8_HANDLER( spdodgeb_scrollx_lo_w ) WRITE8_HANDLER( spdodgeb_ctrl_w ) { - UINT8 *rom = memory_region(REGION_CPU1); + UINT8 *rom = memory_region(machine, REGION_CPU1); /* bit 0 = flip screen */ flip_screen_set(data & 0x01); diff --git a/src/mame/video/sspeedr.c b/src/mame/video/sspeedr.c index 07e42268896..17152f77455 100644 --- a/src/mame/video/sspeedr.c +++ b/src/mame/video/sspeedr.c @@ -93,9 +93,9 @@ WRITE8_HANDLER( sspeedr_track_ice_w ) } -static void draw_track(bitmap_t* bitmap) +static void draw_track(running_machine *machine, bitmap_t* bitmap) { - const UINT8* p = memory_region(REGION_GFX3); + const UINT8* p = memory_region(machine, REGION_GFX3); int x; int y; @@ -259,7 +259,7 @@ VIDEO_START( sspeedr ) VIDEO_UPDATE( sspeedr ) { - draw_track(bitmap); + draw_track(screen->machine, bitmap); draw_drones(screen->machine, bitmap, cliprect); draw_driver(screen->machine, bitmap, cliprect); return 0; diff --git a/src/mame/video/st0016.c b/src/mame/video/st0016.c index a7016604049..f0fad33fe46 100644 --- a/src/mame/video/st0016.c +++ b/src/mame/video/st0016.c @@ -190,8 +190,8 @@ WRITE8_HANDLER(st0016_vregs_w) UINT32 srcadr=(st0016_vregs[0xa0]|(st0016_vregs[0xa1]<<8)|(st0016_vregs[0xa2]<<16))<<1; UINT32 dstadr=(st0016_vregs[0xa3]|(st0016_vregs[0xa4]<<8)|(st0016_vregs[0xa5]<<16))<<1; UINT32 length=((st0016_vregs[0xa6]|(st0016_vregs[0xa7]<<8)|((st0016_vregs[0xa8]&0x1f)<<16))+1)<<1; - UINT32 srclen = (memory_region_length(REGION_CPU1)-0x10000); - UINT8 *mem = memory_region(REGION_CPU1); + UINT32 srclen = (memory_region_length(machine, REGION_CPU1)-0x10000); + UINT8 *mem = memory_region(machine, REGION_CPU1); while(length>0) { if( srcadr < srclen && (dstadr < ST0016_MAX_CHAR_BANK*ST0016_CHAR_BANK_SIZE)) diff --git a/src/mame/video/stactics.c b/src/mame/video/stactics.c index af2457fa61d..c58c7e5cfba 100644 --- a/src/mame/video/stactics.c +++ b/src/mame/video/stactics.c @@ -309,10 +309,10 @@ static void set_indicator_leds(int data, const char *output_name, int base_index } -static void update_artwork(stactics_state *state) +static void update_artwork(running_machine *machine, stactics_state *state) { int i; - UINT8 *beam_region = memory_region(REGION_USER1); + UINT8 *beam_region = memory_region(machine, REGION_USER1); /* set the lamps first */ output_set_indexed_value("base_lamp", 4, state->lamps[0] & 0x01); @@ -394,7 +394,7 @@ static VIDEO_UPDATE( stactics ) update_beam(state); draw_background(state, bitmap, cliprect); - update_artwork(state); + update_artwork(screen->machine, state); state->frame_count = (state->frame_count + 1) & 0x0f; diff --git a/src/mame/video/stfight.c b/src/mame/video/stfight.c index a0b89b3e02c..02f9957e735 100644 --- a/src/mame/video/stfight.c +++ b/src/mame/video/stfight.c @@ -103,7 +103,7 @@ static TILEMAP_MAPPER( fg_scan ) static TILE_GET_INFO( get_fg_tile_info ) { - UINT8 *fgMap = memory_region(REGION_GFX5); + UINT8 *fgMap = memory_region(machine, REGION_GFX5); int attr,tile_base; attr = fgMap[0x8000+tile_index]; @@ -126,7 +126,7 @@ static TILEMAP_MAPPER( bg_scan ) static TILE_GET_INFO( get_bg_tile_info ) { - UINT8 *bgMap = memory_region(REGION_GFX6); + UINT8 *bgMap = memory_region(machine, REGION_GFX6); int attr,tile_bank,tile_base; attr = bgMap[0x8000+tile_index]; diff --git a/src/mame/video/strnskil.c b/src/mame/video/strnskil.c index 0cc4e421bb4..94f917c3fd0 100644 --- a/src/mame/video/strnskil.c +++ b/src/mame/video/strnskil.c @@ -124,7 +124,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta VIDEO_UPDATE( strnskil ) { int row; - const UINT8 *usr1 = memory_region(REGION_USER1); + const UINT8 *usr1 = memory_region(screen->machine, REGION_USER1); for (row = 0; row < 32; row++) { diff --git a/src/mame/video/stvvdp2.c b/src/mame/video/stvvdp2.c index 9b78ce7cdd6..51bc4252abb 100644 --- a/src/mame/video/stvvdp2.c +++ b/src/mame/video/stvvdp2.c @@ -6270,7 +6270,7 @@ static void stv_dump_ram() fp=fopen("68k.dmp", "w+b"); if (fp) { - fwrite(memory_region(REGION_CPU3), 0x100000, 1, fp); + fwrite(memory_region(machine, REGION_CPU3), 0x100000, 1, fp); fclose(fp); } } diff --git a/src/mame/video/suna8.c b/src/mame/video/suna8.c index ca921da2362..b15d3b1df10 100644 --- a/src/mame/video/suna8.c +++ b/src/mame/video/suna8.c @@ -98,7 +98,7 @@ static TILE_GET_INFO( get_tile_info ) { UINT8 code, attr; if (input_code_pressed(KEYCODE_X)) - { UINT8 *rom = memory_region(REGION_CPU1) + 0x10000 + 0x4000*rombank; + { UINT8 *rom = memory_region(machine, REGION_CPU1) + 0x10000 + 0x4000*rombank; code = rom[ 2 * tile_index + 0 ]; attr = rom[ 2 * tile_index + 1 ]; } else @@ -415,7 +415,7 @@ VIDEO_UPDATE( suna8 ) #if TILEMAPS if (input_code_pressed(KEYCODE_Z) || input_code_pressed(KEYCODE_X)) { - int max_tiles = memory_region_length(REGION_GFX1) / (0x400 * 0x20); + int max_tiles = memory_region_length(machine, REGION_GFX1) / (0x400 * 0x20); if (input_code_pressed_once(KEYCODE_Q)) { page--; tilemap_mark_all_tiles_dirty(ALL_TILEMAPS); } if (input_code_pressed_once(KEYCODE_W)) { page++; tilemap_mark_all_tiles_dirty(ALL_TILEMAPS); } diff --git a/src/mame/video/superchs.c b/src/mame/video/superchs.c index 004afb0ba41..034c2e680f9 100644 --- a/src/mame/video/superchs.c +++ b/src/mame/video/superchs.c @@ -69,7 +69,7 @@ Heavy use is made of sprite zooming. static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,const int *primasks,int x_offs,int y_offs) { - UINT16 *spritemap = (UINT16 *)memory_region(REGION_USER1); + UINT16 *spritemap = (UINT16 *)memory_region(machine, REGION_USER1); int offs, data, tilenum, color, flipx, flipy; int x, y, priority, dblsize, curx, cury; int sprites_flipscreen = 0; diff --git a/src/mame/video/suprloco.c b/src/mame/video/suprloco.c index e7cafe7d119..6ebf2902859 100644 --- a/src/mame/video/suprloco.c +++ b/src/mame/video/suprloco.c @@ -176,7 +176,7 @@ INLINE void draw_pixel(bitmap_t *bitmap,const rectangle *cliprect,int x,int y,in } -static void draw_sprite(bitmap_t *bitmap,const rectangle *cliprect,int spr_number) +static void draw_sprite(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int spr_number) { int sx,sy,col,row,height,src,adjy,dy; UINT8 *spr_reg; @@ -206,7 +206,7 @@ static void draw_sprite(bitmap_t *bitmap,const rectangle *cliprect,int spr_numbe dy = -1; } - gfx2 = memory_region(REGION_GFX2); + gfx2 = memory_region(machine, REGION_GFX2); for (row = 0;row < height;row++,adjy+=dy) { int color1,color2,flipx; @@ -249,7 +249,7 @@ static void draw_sprite(bitmap_t *bitmap,const rectangle *cliprect,int spr_numbe } } -static void draw_sprites(bitmap_t *bitmap, const rectangle *cliprect) +static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) { int spr_number; UINT8 *spr_reg; @@ -259,14 +259,14 @@ static void draw_sprites(bitmap_t *bitmap, const rectangle *cliprect) { spr_reg = spriteram + 0x10 * spr_number; if (spr_reg[SPR_X] != 0xff) - draw_sprite(bitmap, cliprect, spr_number); + draw_sprite(machine, bitmap, cliprect, spr_number); } } VIDEO_UPDATE( suprloco ) { tilemap_draw(bitmap,cliprect,bg_tilemap,0,0); - draw_sprites(bitmap,cliprect); + draw_sprites(screen->machine,bitmap,cliprect); tilemap_draw(bitmap,cliprect,bg_tilemap,1,0); return 0; } diff --git a/src/mame/video/suprnova.c b/src/mame/video/suprnova.c index 139684542ec..84c0aad6e4e 100644 --- a/src/mame/video/suprnova.c +++ b/src/mame/video/suprnova.c @@ -318,10 +318,10 @@ static void palette_update(running_machine *machine) } -static int skns_rle_decode ( int romoffset, int size ) +static int skns_rle_decode ( running_machine *machine, int romoffset, int size ) { - UINT8 *src = memory_region (REGION_GFX1); - size_t srcsize = memory_region_length (REGION_GFX1); + UINT8 *src = memory_region (machine, REGION_GFX1); + size_t srcsize = memory_region_length (machine, REGION_GFX1); UINT8 *dst = decodebuffer; int decodeoffset = 0; @@ -342,7 +342,7 @@ static int skns_rle_decode ( int romoffset, int size ) } while(code != 0xff); } } - return &src[romoffset%srcsize]-memory_region (REGION_GFX1); + return &src[romoffset%srcsize]-memory_region (machine, REGION_GFX1); } void skns_sprite_kludge(int x, int y) @@ -618,7 +618,7 @@ void skns_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectang sprite_y_scroll += sprite_kludge_y; - gfxlen = memory_region_length (REGION_GFX1); + gfxlen = memory_region_length (machine, REGION_GFX1); while( source<finish ) { xflip = (source[0] & 0x00000200) >> 9; @@ -721,7 +721,7 @@ void skns_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectang romoffset &= gfxlen-1; - endromoffs = skns_rle_decode ( romoffset, size ); + endromoffs = skns_rle_decode ( machine, romoffset, size ); // in Cyvern @@ -993,7 +993,7 @@ VIDEO_UPDATE(skns) palette_update(screen->machine); - btiles = memory_region (REGION_GFX3); + btiles = memory_region (screen->machine, REGION_GFX3); // if (!(skns_v3_regs[0x0c/4] & 0x0100)); // if tilemap b is in 8bpp mode { diff --git a/src/mame/video/system1.c b/src/mame/video/system1.c index 18b10427ba1..45ef9c0d5c0 100644 --- a/src/mame/video/system1.c +++ b/src/mame/video/system1.c @@ -266,7 +266,7 @@ static void draw_sprite(running_machine *machine, bitmap_t *bitmap,int spr_numbe src = sprite_base[SPR_GFXOFS_LO] + (sprite_base[SPR_GFXOFS_HI] << 8); bank = 0x8000 * (((sprite_base[SPR_X_HI] & 0x80) >> 7) + ((sprite_base[SPR_X_HI] & 0x40) >> 5)); - bank &= (memory_region_length(REGION_GFX2)-1); /* limit to the range of available ROMs */ + bank &= (memory_region_length(machine, REGION_GFX2)-1); /* limit to the range of available ROMs */ skip = sprite_base[SPR_SKIP_LO] + (sprite_base[SPR_SKIP_HI] << 8); height = sprite_base[SPR_Y_BOTTOM] - sprite_base[SPR_Y_TOP]; @@ -275,7 +275,7 @@ static void draw_sprite(running_machine *machine, bitmap_t *bitmap,int spr_numbe sy = sprite_base[SPR_Y_TOP] + 1; /* graphics region #2 contains the packed sprite data */ - gfx = &memory_region(REGION_GFX2)[bank]; + gfx = &memory_region(machine, REGION_GFX2)[bank]; for (row = 0;row < height;row++) { @@ -683,7 +683,7 @@ VIDEO_UPDATE( choplifter ) #ifdef MAME_DEBUG if (input_code_pressed(KEYCODE_SPACE)) // goto next level { - memory_region(REGION_CPU1)[0xC085]=33; + memory_region(screen->machine, REGION_CPU1)[0xC085]=33; } #endif return 0; diff --git a/src/mame/video/system16.c b/src/mame/video/system16.c index a0756218f88..54f2172ea2f 100644 --- a/src/mame/video/system16.c +++ b/src/mame/video/system16.c @@ -333,8 +333,8 @@ static void draw_sprite(running_machine *machine, static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int b3d ) //* { pen_t pen_base = machine->gfx[0]->color_base; - const UINT8 *base_gfx = memory_region(REGION_GFX2); - const int gfx_rom_size = memory_region_length(REGION_GFX2); + const UINT8 *base_gfx = memory_region(machine, REGION_GFX2); + const int gfx_rom_size = memory_region_length(machine, REGION_GFX2); const UINT16 *source = sys16_spriteram; struct sys16_sprite_attributes sprite; int xpos, ypos, screen_width, width, logical_height, pitch, flipy, flipx; diff --git a/src/mame/video/tail2nos.c b/src/mame/video/tail2nos.c index b4fc86c5b6c..3a34d2fd13e 100644 --- a/src/mame/video/tail2nos.c +++ b/src/mame/video/tail2nos.c @@ -63,7 +63,7 @@ VIDEO_START( tail2nos ) K051316_wraparound_enable(0,1); K051316_set_offset(0,-89,-14); - zoomdata = (UINT16 *)memory_region(REGION_GFX3); + zoomdata = (UINT16 *)memory_region(machine, REGION_GFX3); } diff --git a/src/mame/video/taito_z.c b/src/mame/video/taito_z.c index 668b792ca68..643a5039da6 100644 --- a/src/mame/video/taito_z.c +++ b/src/mame/video/taito_z.c @@ -168,7 +168,7 @@ confirmed static void contcirc_draw_sprites_16x8(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int y_offs) { - UINT16 *spritemap = (UINT16 *)memory_region(REGION_USER1); + UINT16 *spritemap = (UINT16 *)memory_region(machine, REGION_USER1); int offs, data, tilenum, color, flipx, flipy; int x, y, priority, curx, cury; int sprites_flipscreen = 0; @@ -260,7 +260,7 @@ logerror("Sprite number %04x had %02x invalid chunks\n",tilenum,bad_chunks); static void chasehq_draw_sprites_16x16(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int y_offs) { - UINT16 *spritemap = (UINT16 *)memory_region(REGION_USER1); + UINT16 *spritemap = (UINT16 *)memory_region(machine, REGION_USER1); int offs, data, tilenum, color, flipx, flipy; int x, y, priority, curx, cury; int sprites_flipscreen = 0; @@ -445,7 +445,7 @@ logerror("Sprite number %04x had %02x invalid chunks\n",tilenum,bad_chunks); static void bshark_draw_sprites_16x8(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int y_offs) { - UINT16 *spritemap = (UINT16 *)memory_region(REGION_USER1); + UINT16 *spritemap = (UINT16 *)memory_region(machine, REGION_USER1); int offs, data, tilenum, color, flipx, flipy; int x, y, priority, curx, cury; int sprites_flipscreen = 0; @@ -538,7 +538,7 @@ logerror("Sprite number %04x had %02x invalid chunks\n",tilenum,bad_chunks); static void sci_draw_sprites_16x8(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int y_offs) { - UINT16 *spritemap = (UINT16 *)memory_region(REGION_USER1); + UINT16 *spritemap = (UINT16 *)memory_region(machine, REGION_USER1); int offs, start_offs, data, tilenum, color, flipx, flipy; int x, y, priority, curx, cury; int sprites_flipscreen = 0; @@ -640,7 +640,7 @@ logerror("Sprite number %04x had %02x invalid chunks\n",tilenum,bad_chunks); static void aquajack_draw_sprites_16x8(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int y_offs) { - UINT16 *spritemap = (UINT16 *)memory_region(REGION_USER1); + UINT16 *spritemap = (UINT16 *)memory_region(machine, REGION_USER1); int offs, data, tilenum, color, flipx, flipy; int x, y, priority, curx, cury; int sprites_flipscreen = 0; @@ -732,7 +732,7 @@ logerror("Sprite number %04x had %02x invalid chunks\n",tilenum,bad_chunks); static void spacegun_draw_sprites_16x8(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int y_offs) { - UINT16 *spritemap = (UINT16 *)memory_region(REGION_USER1); + UINT16 *spritemap = (UINT16 *)memory_region(machine, REGION_USER1); int offs, data, tilenum, color, flipx, flipy; int x, y, priority, curx, cury; int sprites_flipscreen = 0; @@ -860,7 +860,7 @@ VIDEO_UPDATE( contcirc ) TC0100SCN_tilemap_draw(screen->machine,bitmap,cliprect,0,layer[0],0,0); TC0100SCN_tilemap_draw(screen->machine,bitmap,cliprect,0,layer[1],0,1); - TC0150ROD_draw(bitmap,cliprect,-3,road_palbank << 6,1,0,1,2); // -6 + TC0150ROD_draw(screen->machine,bitmap,cliprect,-3,road_palbank << 6,1,0,1,2); // -6 TC0100SCN_tilemap_draw(screen->machine,bitmap,cliprect,0,layer[2],0,4); contcirc_draw_sprites_16x8(screen->machine, bitmap,cliprect,5); // 7 @@ -887,7 +887,7 @@ VIDEO_UPDATE( chasehq ) TC0100SCN_tilemap_draw(screen->machine,bitmap,cliprect,0,layer[0],TILEMAP_DRAW_OPAQUE,0); TC0100SCN_tilemap_draw(screen->machine,bitmap,cliprect,0,layer[1],0,1); - TC0150ROD_draw(bitmap,cliprect,-1,0xc0,0,0,1,2); + TC0150ROD_draw(screen->machine,bitmap,cliprect,-1,0xc0,0,0,1,2); TC0100SCN_tilemap_draw(screen->machine,bitmap,cliprect,0,layer[2],0,4); chasehq_draw_sprites_16x16(screen->machine, bitmap,cliprect,7); @@ -912,7 +912,7 @@ VIDEO_UPDATE( bshark ) TC0100SCN_tilemap_draw(screen->machine,bitmap,cliprect,0,layer[0],TILEMAP_DRAW_OPAQUE,0); TC0100SCN_tilemap_draw(screen->machine,bitmap,cliprect,0,layer[1],0,1); - TC0150ROD_draw(bitmap,cliprect,-1,0xc0,0,1,1,2); + TC0150ROD_draw(screen->machine,bitmap,cliprect,-1,0xc0,0,1,1,2); TC0100SCN_tilemap_draw(screen->machine,bitmap,cliprect,0,layer[2],0,4); bshark_draw_sprites_16x8(screen->machine, bitmap,cliprect,8); @@ -937,7 +937,7 @@ VIDEO_UPDATE( sci ) TC0100SCN_tilemap_draw(screen->machine,bitmap,cliprect,0,layer[0],TILEMAP_DRAW_OPAQUE,0); TC0100SCN_tilemap_draw(screen->machine,bitmap,cliprect,0,layer[1],0,1); - TC0150ROD_draw(bitmap,cliprect,-1,0xc0,0,0,1,2); + TC0150ROD_draw(screen->machine,bitmap,cliprect,-1,0xc0,0,0,1,2); TC0100SCN_tilemap_draw(screen->machine,bitmap,cliprect,0,layer[2],0,4); sci_draw_sprites_16x8(screen->machine, bitmap,cliprect,6); @@ -962,7 +962,7 @@ VIDEO_UPDATE( aquajack ) TC0100SCN_tilemap_draw(screen->machine,bitmap,cliprect,0,layer[0],TILEMAP_DRAW_OPAQUE,0); TC0100SCN_tilemap_draw(screen->machine,bitmap,cliprect,0,layer[1],0,1); - TC0150ROD_draw(bitmap,cliprect,-1,0,2,1,1,2); + TC0150ROD_draw(screen->machine,bitmap,cliprect,-1,0,2,1,1,2); TC0100SCN_tilemap_draw(screen->machine,bitmap,cliprect,0,layer[2],0,4); aquajack_draw_sprites_16x8(screen->machine, bitmap,cliprect,3); @@ -1019,7 +1019,7 @@ VIDEO_UPDATE( dblaxle ) TC0480SCP_tilemap_draw(bitmap,cliprect,layer[1],0,0); TC0480SCP_tilemap_draw(bitmap,cliprect,layer[2],0,1); - TC0150ROD_draw(bitmap,cliprect,-1,0xc0,0,0,1,2); + TC0150ROD_draw(screen->machine,bitmap,cliprect,-1,0xc0,0,0,1,2); bshark_draw_sprites_16x8(screen->machine, bitmap,cliprect,7); /* This layer used for the big numeric displays */ diff --git a/src/mame/video/taitoic.c b/src/mame/video/taitoic.c index 85169933fdd..36b60349129 100644 --- a/src/mame/video/taitoic.c +++ b/src/mame/video/taitoic.c @@ -4110,7 +4110,7 @@ lookup table from rom for the TaitoZ sprites. ******************************************************************************/ -void TC0150ROD_draw(bitmap_t *bitmap,const rectangle *cliprect,int y_offs,int palette_offs,int type,int road_trans,UINT32 low_priority,UINT32 high_priority) +void TC0150ROD_draw(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int y_offs,int palette_offs,int type,int road_trans,UINT32 low_priority,UINT32 high_priority) { #ifdef MAME_DEBUG static int dislayer[6]; /* Road Layer toggles to help get road correct */ @@ -4121,7 +4121,7 @@ void TC0150ROD_draw(bitmap_t *bitmap,const rectangle *cliprect,int y_offs,int pa UINT16 roada_line[512],roadb_line[512]; UINT16 *dst16; UINT16 *roada,*roadb; - UINT16 *roadgfx = (UINT16 *)memory_region(REGION_GFX3); + UINT16 *roadgfx = (UINT16 *)memory_region(machine, REGION_GFX3); UINT16 pixel,color,gfx_word; UINT16 roada_clipl,roada_clipr,roada_bodyctrl; diff --git a/src/mame/video/taitoic.h b/src/mame/video/taitoic.h index bb8393a29cd..14484c859a8 100644 --- a/src/mame/video/taitoic.h +++ b/src/mame/video/taitoic.h @@ -175,7 +175,7 @@ extern int TC0480SCP_pri_reg; READ16_HANDLER( TC0150ROD_word_r ); WRITE16_HANDLER( TC0150ROD_word_w ); void TC0150ROD_vh_start(void); -void TC0150ROD_draw(bitmap_t *bitmap,const rectangle *cliprect,int y_offs,int palette_offs,int type,int road_trans,UINT32 low_priority,UINT32 high_priority); +void TC0150ROD_draw(running_machine *machine,bitmap_t *bitmap,const rectangle *cliprect,int y_offs,int palette_offs,int type,int road_trans,UINT32 low_priority,UINT32 high_priority); /***************************************************************************/ diff --git a/src/mame/video/taitosj.c b/src/mame/video/taitosj.c index f53ddf8221a..497a081e420 100644 --- a/src/mame/video/taitosj.c +++ b/src/mame/video/taitosj.c @@ -169,10 +169,10 @@ static STATE_POSTLOAD( taitosj_postload ) ***************************************************************************/ -static void compute_draw_order(void) +static void compute_draw_order(running_machine *machine) { int i; - UINT8 *color_prom = memory_region(REGION_PROMS); + UINT8 *color_prom = memory_region(machine, REGION_PROMS); /* do a simple conversion of the PROM into layer priority order. Note that */ /* this is a simplification, which assumes the PROM encodes a sensible priority */ @@ -219,7 +219,7 @@ VIDEO_START( taitosj ) memset(dirtysprite1, 1, sizeof(dirtysprite1)); memset(dirtysprite2, 1, sizeof(dirtysprite2)); - compute_draw_order(); + compute_draw_order(machine); state_save_register_postload(machine, taitosj_postload, NULL); } @@ -233,7 +233,7 @@ READ8_HANDLER( taitosj_gfxrom_r ) offs_t offs = taitosj_gfxpointer[0] | (taitosj_gfxpointer[1] << 8); if (offs < 0x8000) - ret = memory_region(REGION_GFX1)[offs]; + ret = memory_region(machine, REGION_GFX1)[offs]; else ret = 0; diff --git a/src/mame/video/tatsumi.c b/src/mame/video/tatsumi.c index e461c52b67e..bbece34dfc7 100644 --- a/src/mame/video/tatsumi.c +++ b/src/mame/video/tatsumi.c @@ -966,7 +966,7 @@ static void draw_bg(running_machine *machine, bitmap_t *dst, tilemap *src, const Each tile (0x4000 of them) has a lookup table in ROM to build an individual 3-bit palette from sets of 8 bit palettes! */ - const UINT8* tile_cluts = memory_region(REGION_GFX4); + const UINT8* tile_cluts = memory_region(machine, REGION_GFX4); const bitmap_t *src_bitmap = tilemap_get_pixmap(src); int src_y_mask=ysize-1; int src_x_mask=xsize-1; diff --git a/src/mame/video/tceptor.c b/src/mame/video/tceptor.c index 191a6ee12e5..68cfaf514a3 100644 --- a/src/mame/video/tceptor.c +++ b/src/mame/video/tceptor.c @@ -258,7 +258,7 @@ static void decode_bg(running_machine *machine, int region) }; int gfx_index = bg; - UINT8 *src = memory_region(region) + 0x8000; + UINT8 *src = memory_region(machine, region) + 0x8000; UINT8 *buffer; int len = 0x8000; int i; @@ -277,7 +277,7 @@ static void decode_bg(running_machine *machine, int region) /* decode the graphics */ machine->gfx[gfx_index] = allocgfx(&bg_layout); - decodegfx(machine->gfx[gfx_index], memory_region(region), 0, machine->gfx[gfx_index]->total_elements); + decodegfx(machine->gfx[gfx_index], memory_region(machine, region), 0, machine->gfx[gfx_index]->total_elements); /* set the color information */ machine->gfx[gfx_index]->color_base = 2048; @@ -315,8 +315,8 @@ static void decode_sprite16(running_machine *machine, int region) 2*16*16 }; - UINT8 *src = memory_region(region); - int len = memory_region_length(region); + UINT8 *src = memory_region(machine, region); + int len = memory_region_length(machine, region); UINT8 *dst; int i, y; @@ -368,8 +368,8 @@ static void decode_sprite32(running_machine *machine, int region) 2*32*32 }; - UINT8 *src = memory_region(region); - int len = memory_region_length(region); + UINT8 *src = memory_region(machine, region); + int len = memory_region_length(machine, region); int total = spr32_layout.total; int size = spr32_layout.charincrement / 8; UINT8 *dst; diff --git a/src/mame/video/terracre.c b/src/mame/video/terracre.c index 717db45d0ca..c57841b2219 100644 --- a/src/mame/video/terracre.c +++ b/src/mame/video/terracre.c @@ -34,7 +34,7 @@ TILE_GET_INFO( get_fg_tile_info ) static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect ) { - const UINT8 *spritepalettebank = memory_region(REGION_USER1); + const UINT8 *spritepalettebank = memory_region(machine, REGION_USER1); const gfx_element *pGfx = machine->gfx[2]; const UINT16 *pSource = spriteram16; int i; diff --git a/src/mame/video/thief.c b/src/mame/video/thief.c index 03736e7e89a..3e4b5360e9b 100644 --- a/src/mame/video/thief.c +++ b/src/mame/video/thief.c @@ -161,7 +161,7 @@ static UINT16 fetch_image_addr( void ){ WRITE8_HANDLER( thief_blit_w ){ int i, offs, xoffset, dy; - UINT8 *gfx_rom = memory_region( REGION_GFX1 ); + UINT8 *gfx_rom = memory_region( machine, REGION_GFX1 ); UINT8 x = thief_coprocessor.param[SCREEN_XPOS]; UINT8 y = thief_coprocessor.param[SCREEN_YPOS]; UINT8 width = thief_coprocessor.param[BLIT_WIDTH]; @@ -238,7 +238,7 @@ READ8_HANDLER( thief_coprocessor_r ){ return thief_coprocessor.image_ram[addr]; } else { - UINT8 *gfx_rom = memory_region( REGION_GFX1 ); + UINT8 *gfx_rom = memory_region( machine, REGION_GFX1 ); addr -= 0x2000; if( addr<0x6000 ) return gfx_rom[addr]; } diff --git a/src/mame/video/tigeroad.c b/src/mame/video/tigeroad.c index a28f3cc460d..794a42823df 100644 --- a/src/mame/video/tigeroad.c +++ b/src/mame/video/tigeroad.c @@ -111,7 +111,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta static TILE_GET_INFO( get_bg_tile_info ) { - UINT8 *tilerom = memory_region(REGION_GFX4); + UINT8 *tilerom = memory_region(machine, REGION_GFX4); int data = tilerom[tile_index]; int attr = tilerom[tile_index + 1]; diff --git a/src/mame/video/tmnt.c b/src/mame/video/tmnt.c index ed81585b471..06c21ac69c7 100644 --- a/src/mame/video/tmnt.c +++ b/src/mame/video/tmnt.c @@ -18,7 +18,7 @@ static int glfgreat_roz_rom_bank,glfgreat_roz_char_bank,glfgreat_roz_rom_mode; static TILE_GET_INFO( glfgreat_get_roz_tile_info ) { - UINT8 *rom = memory_region(REGION_USER1); + UINT8 *rom = memory_region(machine, REGION_USER1); int code; tile_index += 0x40000 * glfgreat_roz_rom_bank; @@ -30,7 +30,7 @@ static TILE_GET_INFO( glfgreat_get_roz_tile_info ) static TILE_GET_INFO( prmrsocr_get_roz_tile_info ) { - UINT8 *rom = memory_region(REGION_USER1); + UINT8 *rom = memory_region(machine, REGION_USER1); int code = rom[tile_index+0x20000] + 256*rom[tile_index]; SET_TILE_INFO(0,code & 0x1fff,code >> 13,0); @@ -422,15 +422,15 @@ WRITE16_HANDLER( blswhstl_700300_w ) READ16_HANDLER( glfgreat_rom_r ) { if (glfgreat_roz_rom_mode) - return memory_region(REGION_GFX3)[glfgreat_roz_char_bank * 0x80000 + offset]; + return memory_region(machine, REGION_GFX3)[glfgreat_roz_char_bank * 0x80000 + offset]; else if (offset < 0x40000) { - UINT8 *usr = memory_region(REGION_USER1); + UINT8 *usr = memory_region(machine, REGION_USER1); return usr[offset + 0x80000 + glfgreat_roz_rom_bank * 0x40000] + 256 * usr[offset + glfgreat_roz_rom_bank * 0x40000]; } else - return memory_region(REGION_USER1)[((offset & 0x3ffff) >> 2) + 0x100000 + glfgreat_roz_rom_bank * 0x10000]; + return memory_region(machine, REGION_USER1)[((offset & 0x3ffff) >> 2) + 0x100000 + glfgreat_roz_rom_bank * 0x10000]; } WRITE16_HANDLER( glfgreat_122000_w ) @@ -526,10 +526,10 @@ WRITE16_HANDLER( prmrsocr_122000_w ) READ16_HANDLER( prmrsocr_rom_r ) { if(glfgreat_roz_char_bank) - return memory_region(REGION_GFX3)[offset]; + return memory_region(machine, REGION_GFX3)[offset]; else { - UINT8 *usr = memory_region(REGION_USER1); + UINT8 *usr = memory_region(machine, REGION_USER1); return 256 * usr[offset] + usr[offset + 0x020000]; } } diff --git a/src/mame/video/tryout.c b/src/mame/video/tryout.c index 68d50972722..b63c61e3867 100644 --- a/src/mame/video/tryout.c +++ b/src/mame/video/tryout.c @@ -235,7 +235,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan VIDEO_UPDATE( tryout ) { -// UINT8* mem=memory_region(REGION_CPU1); +// UINT8* mem=memory_region(machine, REGION_CPU1); int scrollx; diff --git a/src/mame/video/tubep.c b/src/mame/video/tubep.c index 499b2d5b894..36b7a1d49fc 100644 --- a/src/mame/video/tubep.c +++ b/src/mame/video/tubep.c @@ -431,11 +431,11 @@ static TIMER_CALLBACK( sprite_timer_callback ) } -static void draw_sprite(void) +static void draw_sprite(running_machine *machine) { UINT32 XDOT; UINT32 YDOT; - UINT8 * romCxx = memory_region(REGION_USER2)+0x00000; + UINT8 * romCxx = memory_region(machine, REGION_USER2)+0x00000; UINT8 * romD10 = romCxx+0x10000; UINT8 * romEF13 = romCxx+0x12000; UINT8 * romHI2 = romCxx+0x14000; @@ -562,7 +562,7 @@ WRITE8_HANDLER( tubep_sprite_control_w ) timer_set( attotime_mul(ATTOTIME_IN_HZ(19968000/8), (XSize+1)*(YSize+1)), NULL, 0, sprite_timer_callback); /* 3.clear of /SINT starts sprite drawing circuit */ - draw_sprite(); + draw_sprite(machine); break; } } @@ -584,8 +584,8 @@ VIDEO_UPDATE( tubep ) pen_t pen_base = 32; //change it later UINT32 v; - UINT8 *text_gfx_base = memory_region(REGION_GFX1); - UINT8 *romBxx = memory_region(REGION_USER1) + 0x2000*background_romsel; + UINT8 *text_gfx_base = memory_region(screen->machine, REGION_GFX1); + UINT8 *romBxx = memory_region(screen->machine, REGION_USER1) + 0x2000*background_romsel; /* logerror(" update: from DISP=%i y_min=%3i y_max=%3i\n", DISP_, cliprect->min_y, cliprect->max_y+1); */ @@ -737,8 +737,8 @@ VIDEO_UPDATE( rjammer ) int DISP_ = DISP^1; UINT32 v; - UINT8 *text_gfx_base = memory_region(REGION_GFX1); - UINT8 *rom13D = memory_region(REGION_USER1); + UINT8 *text_gfx_base = memory_region(screen->machine, REGION_GFX1); + UINT8 *rom13D = memory_region(screen->machine, REGION_USER1); UINT8 *rom11BD = rom13D+0x1000; UINT8 *rom19C = rom13D+0x5000; diff --git a/src/mame/video/tunhunt.c b/src/mame/video/tunhunt.c index a6386dd41ab..bd06196b0bb 100644 --- a/src/mame/video/tunhunt.c +++ b/src/mame/video/tunhunt.c @@ -140,7 +140,7 @@ Color Array Ram Assignments: */ static void set_pens(colortable_t *colortable) { -// const UINT8 *color_prom = memory_region( REGION_PROMS ); +// const UINT8 *color_prom = memory_region( machine, REGION_PROMS ); /* The actual contents of the color proms (unused by this driver) are as follows: diff --git a/src/mame/video/turbo.c b/src/mame/video/turbo.c index df6c85e6720..02a10cd9f12 100644 --- a/src/mame/video/turbo.c +++ b/src/mame/video/turbo.c @@ -275,7 +275,7 @@ INLINE UINT32 sprite_xscale(UINT8 dacinput, double vr1, double vr2, double cext) static void turbo_prepare_sprites(running_machine *machine, turbo_state *state, UINT8 y, sprite_info *info) { - const UINT8 *pr1119 = memory_region(REGION_PROMS) + 0x200; + const UINT8 *pr1119 = memory_region(machine, REGION_PROMS) + 0x200; int sprnum; /* initialize the line enable signals to 0 */ @@ -339,9 +339,9 @@ static void turbo_prepare_sprites(running_machine *machine, turbo_state *state, } -static UINT32 turbo_get_sprite_bits(UINT8 road, sprite_info *sprinfo) +static UINT32 turbo_get_sprite_bits(running_machine *machine, UINT8 road, sprite_info *sprinfo) { - const UINT8 *sprite_gfxdata = memory_region(REGION_GFX1); + const UINT8 *sprite_gfxdata = memory_region(machine, REGION_GFX1); UINT8 sprlive = sprinfo->lst; UINT32 sprdata = 0; int level; @@ -398,8 +398,8 @@ VIDEO_UPDATE( turbo ) { turbo_state *state = screen->machine->driver_data; bitmap_t *fgpixmap = tilemap_get_pixmap(state->fg_tilemap); - const UINT8 *road_gfxdata = memory_region(REGION_GFX3); - const UINT8 *prom_base = memory_region(REGION_PROMS); + const UINT8 *road_gfxdata = memory_region(screen->machine, REGION_GFX3); + const UINT8 *prom_base = memory_region(screen->machine, REGION_PROMS); const UINT8 *pr1114 = prom_base + 0x000; const UINT8 *pr1115 = prom_base + 0x020; const UINT8 *pr1116 = prom_base + 0x040; @@ -523,7 +523,7 @@ VIDEO_UPDATE( turbo ) /* CDG0-7 = D8 -D15 */ /* CDR0-7 = D16-D23 */ /* PLB0-7 = D24-D31 */ - sprbits = turbo_get_sprite_bits(road, &sprinfo); + sprbits = turbo_get_sprite_bits(screen->machine, road, &sprinfo); /* perform collision detection here via lookup in IC20/PR1116 (p. 144) */ state->turbo_collision |= pr1116[((sprbits >> 24) & 7) | (slipar_acciar >> 1)]; @@ -632,9 +632,9 @@ VIDEO_UPDATE( turbo ) */ -static void subroc3d_prepare_sprites(turbo_state *state, UINT8 y, sprite_info *info) +static void subroc3d_prepare_sprites(running_machine *machine, turbo_state *state, UINT8 y, sprite_info *info) { - const UINT8 *pr1449 = memory_region(REGION_PROMS) + 0x300; + const UINT8 *pr1449 = memory_region(machine, REGION_PROMS) + 0x300; int sprnum; /* initialize the line enable signals to 0 */ @@ -692,7 +692,7 @@ static void subroc3d_prepare_sprites(turbo_state *state, UINT8 y, sprite_info *i } -static UINT32 subroc3d_get_sprite_bits(sprite_info *sprinfo, UINT8 *plb) +static UINT32 subroc3d_get_sprite_bits(running_machine *machine, sprite_info *sprinfo, UINT8 *plb) { /* see logic on each sprite: END = (CDA == 1 && (CDA ^ CDB) == 0 && (CDC ^ CDD) == 0) @@ -700,7 +700,7 @@ static UINT32 subroc3d_get_sprite_bits(sprite_info *sprinfo, UINT8 *plb) end is in bit 1, plb in bit 0 */ static const UINT8 plb_end[16] = { 0,1,1,2, 1,1,1,1, 1,1,1,1, 0,1,1,2 }; - const UINT8 *sprite_gfxdata = memory_region(REGION_GFX1); + const UINT8 *sprite_gfxdata = memory_region(machine, REGION_GFX1); UINT32 sprdata = 0; int level; @@ -753,7 +753,7 @@ VIDEO_UPDATE( subroc3d ) { turbo_state *state = screen->machine->driver_data; bitmap_t *fgpixmap = tilemap_get_pixmap(state->fg_tilemap); - const UINT8 *prom_base = memory_region(REGION_PROMS); + const UINT8 *prom_base = memory_region(screen->machine, REGION_PROMS); const UINT8 *pr1419 = prom_base + 0x000; const UINT8 *pr1620 = prom_base + 0x200; const UINT8 *pr1450 = prom_base + 0x500; @@ -769,7 +769,7 @@ VIDEO_UPDATE( subroc3d ) /* compute the sprite information; we use y-1 since this info was computed during HBLANK */ /* on the previous scanline */ - subroc3d_prepare_sprites(state, y, &sprinfo); + subroc3d_prepare_sprites(screen->machine, state, y, &sprinfo); /* loop over columns */ for (x = 0; x <= cliprect->max_x; x += TURBO_X_SCALE) @@ -809,7 +809,7 @@ VIDEO_UPDATE( subroc3d ) /* CDB0-7 = D8 -D15 */ /* CDC0-7 = D16-D23 */ /* CDD0-7 = D24-D31 */ - sprbits = subroc3d_get_sprite_bits(&sprinfo, &plb); + sprbits = subroc3d_get_sprite_bits(screen->machine, &sprinfo, &plb); /* MUX0-3 is selected by PLY0-3 and the sprite enable bits, and is the output */ /* of IC21/PR1450 (p. 141), unless MPLB = 0, in which case the values are grounded (p. 141) */ @@ -851,9 +851,9 @@ VIDEO_UPDATE( subroc3d ) * *************************************/ -static void buckrog_prepare_sprites(turbo_state *state, UINT8 y, sprite_info *info) +static void buckrog_prepare_sprites(running_machine *machine, turbo_state *state, UINT8 y, sprite_info *info) { - const UINT8 *pr5196 = memory_region(REGION_PROMS) + 0x100; + const UINT8 *pr5196 = memory_region(machine, REGION_PROMS) + 0x100; int sprnum; /* initialize the line enable signals to 0 */ @@ -911,7 +911,7 @@ static void buckrog_prepare_sprites(turbo_state *state, UINT8 y, sprite_info *in } -static UINT32 buckrog_get_sprite_bits(sprite_info *sprinfo, UINT8 *plb) +static UINT32 buckrog_get_sprite_bits(running_machine *machine, sprite_info *sprinfo, UINT8 *plb) { /* see logic on each sprite: END = (CDA == 1 && (CDA ^ CDB) == 0 && (CDC ^ CDD) == 0) @@ -919,7 +919,7 @@ static UINT32 buckrog_get_sprite_bits(sprite_info *sprinfo, UINT8 *plb) end is in bit 1, plb in bit 0 */ static const UINT8 plb_end[16] = { 0,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,2 }; - const UINT8 *sprite_gfxdata = memory_region(REGION_GFX1); + const UINT8 *sprite_gfxdata = memory_region(machine, REGION_GFX1); UINT32 sprdata = 0; int level; @@ -972,8 +972,8 @@ VIDEO_UPDATE( buckrog ) { turbo_state *state = screen->machine->driver_data; bitmap_t *fgpixmap = tilemap_get_pixmap(state->fg_tilemap); - const UINT8 *bgcolor = memory_region(REGION_GFX3); - const UINT8 *prom_base = memory_region(REGION_PROMS); + const UINT8 *bgcolor = memory_region(screen->machine, REGION_GFX3); + const UINT8 *prom_base = memory_region(screen->machine, REGION_PROMS); const UINT8 *pr5194 = prom_base + 0x000; const UINT8 *pr5198 = prom_base + 0x500; const UINT8 *pr5199 = prom_base + 0x700; @@ -988,7 +988,7 @@ VIDEO_UPDATE( buckrog ) /* compute the sprite information; we use y-1 since this info was computed during HBLANK */ /* on the previous scanline */ - buckrog_prepare_sprites(state, y, &sprinfo); + buckrog_prepare_sprites(screen->machine, state, y, &sprinfo); /* loop over columns */ for (x = 0; x <= cliprect->max_x; x += TURBO_X_SCALE) @@ -1025,7 +1025,7 @@ VIDEO_UPDATE( buckrog ) /* CDB0-7 = D8 -D15 */ /* CDC0-7 = D16-D23 */ /* CDD0-7 = D24-D31 */ - sprbits = buckrog_get_sprite_bits(&sprinfo, &plb); + sprbits = buckrog_get_sprite_bits(screen->machine, &sprinfo, &plb); /* the PLB bits go into an LS148 8-to-1 decoder and become MUX0-3 (PROM board SH 2/10) */ if (plb == 0) diff --git a/src/mame/video/tutankhm.c b/src/mame/video/tutankhm.c index 9bfef47d51d..8ac9cccae1c 100644 --- a/src/mame/video/tutankhm.c +++ b/src/mame/video/tutankhm.c @@ -137,7 +137,7 @@ WRITE8_HANDLER( junofrst_blitter_w ) if (offset == 3) { int i; - UINT8 *gfx_rom = memory_region(REGION_GFX1); + UINT8 *gfx_rom = memory_region(machine, REGION_GFX1); offs_t src = ((junofrst_blitterdata[2] << 8) | junofrst_blitterdata[3]) & 0xfffc; offs_t dest = (junofrst_blitterdata[0] << 8) | junofrst_blitterdata[1]; diff --git a/src/mame/video/tx1.c b/src/mame/video/tx1.c index 3392d4783a9..af54eca6ba8 100644 --- a/src/mame/video/tx1.c +++ b/src/mame/video/tx1.c @@ -221,24 +221,24 @@ WRITE16_HANDLER( tx1_flgcs_w ) /* Preliminary */ -static void tx1_draw_objects(bitmap_t *bitmap, const rectangle *cliprect) +static void tx1_draw_objects(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) { #define FRAC 16 UINT32 offs; /* The many lookup table ROMs */ - const UINT8 *const ic48 = (UINT8*)memory_region(REGION_USER3); - const UINT8 *const ic281 = (UINT8*)memory_region(REGION_USER3) + 0x2000; - const UINT8 *const ic25 = (UINT8*)memory_region(REGION_PROMS) + 0x1000; + const UINT8 *const ic48 = (UINT8*)memory_region(machine, REGION_USER3); + const UINT8 *const ic281 = (UINT8*)memory_region(machine, REGION_USER3) + 0x2000; + const UINT8 *const ic25 = (UINT8*)memory_region(machine, REGION_PROMS) + 0x1000; - const UINT8 *const ic106 = (UINT8*)memory_region(REGION_USER2); - const UINT8 *const ic73 = (UINT8*)memory_region(REGION_USER2) + 0x4000; + const UINT8 *const ic106 = (UINT8*)memory_region(machine, REGION_USER2); + const UINT8 *const ic73 = (UINT8*)memory_region(machine, REGION_USER2) + 0x4000; - const UINT8 *const ic190 = (UINT8*)memory_region(REGION_PROMS) + 0xc00; - const UINT8 *const ic162 = (UINT8*)memory_region(REGION_PROMS) + 0xe00; + const UINT8 *const ic190 = (UINT8*)memory_region(machine, REGION_PROMS) + 0xc00; + const UINT8 *const ic162 = (UINT8*)memory_region(machine, REGION_PROMS) + 0xe00; - const UINT8 *const pixdata_rgn = (UINT8*)memory_region(REGION_GFX2); + const UINT8 *const pixdata_rgn = (UINT8*)memory_region(machine, REGION_GFX2); for (offs = 0x0; offs <= tx1_objram_size; offs += 8) { @@ -498,7 +498,7 @@ VIDEO_UPDATE( tx1 ) // tilemap_set_scrollx(tx1_tilemap, 0, scroll); tilemap_draw(tx1_bitmap, &rect, tx1_tilemap, 0, 0); // tx1_draw_road(tx1_bitmap, &rect); - tx1_draw_objects(tx1_bitmap, &rect); + tx1_draw_objects(screen->machine, tx1_bitmap, &rect); for (y = 0; y < 240; ++y) memcpy(BITMAP_ADDR16(bitmap, y, 0), BITMAP_ADDR16(tx1_bitmap, y, 0 * 256), sizeof(UINT16) * 256); @@ -731,7 +731,7 @@ static TILE_GET_INFO( get_buggyboy_tile_info ) http://philwip.mameworld.info/buggyboy/PAL16L8.150.htm ***************************************************************************/ -static void buggybjr_draw_road(UINT8 *bitmap) +static void buggybjr_draw_road(running_machine *machine, UINT8 *bitmap) { #define X_ADJUST 384 #define LOAD_HPOS_COUNTER( NUM ) \ @@ -768,8 +768,8 @@ static void buggybjr_draw_road(UINT8 *bitmap) UINT32 rva20_6; /* ROM/PROM lookup tables */ - const UINT8 *rcols = (UINT8*)(memory_region(REGION_PROMS) + 0x1500); - const UINT8 *rom = memory_region(REGION_GFX6); + const UINT8 *rcols = (UINT8*)(memory_region(machine, REGION_PROMS) + 0x1500); + const UINT8 *rom = memory_region(machine, REGION_GFX6); const UINT8 *prom0 = rom + 0x4000; const UINT8 *prom1 = rom + 0x4200; const UINT8 *prom2 = rom + 0x4400; @@ -1254,24 +1254,24 @@ static void buggybjr_draw_road(UINT8 *bitmap) ------xx xxxxxxxx X position **************************************************************************/ -static void buggyboy_draw_objs(UINT8 *bitmap) +static void buggyboy_draw_objs(running_machine *machine, UINT8 *bitmap) { #define FRAC 16 UINT32 offs; /* The many lookup table ROMs */ - const UINT8 *const bug13 = (UINT8*)memory_region(REGION_USER3); - const UINT8 *const bug18s = (UINT8*)memory_region(REGION_USER3) + 0x2000; - const UINT8 *const bb8 = (UINT8*)memory_region(REGION_PROMS) + 0x1600; + const UINT8 *const bug13 = (UINT8*)memory_region(machine, REGION_USER3); + const UINT8 *const bug18s = (UINT8*)memory_region(machine, REGION_USER3) + 0x2000; + const UINT8 *const bb8 = (UINT8*)memory_region(machine, REGION_PROMS) + 0x1600; - const UINT8 *const bug16s = (UINT8*)memory_region(REGION_USER2); - const UINT8 *const bug17s = (UINT8*)memory_region(REGION_USER2) + 0x8000; + const UINT8 *const bug16s = (UINT8*)memory_region(machine, REGION_USER2); + const UINT8 *const bug17s = (UINT8*)memory_region(machine, REGION_USER2) + 0x8000; - const UINT8 *const bb9o = (UINT8*)memory_region(REGION_PROMS) + 0x500; - const UINT8 *const bb9e = (UINT8*)memory_region(REGION_PROMS) + 0xd00; + const UINT8 *const bb9o = (UINT8*)memory_region(machine, REGION_PROMS) + 0x500; + const UINT8 *const bb9e = (UINT8*)memory_region(machine, REGION_PROMS) + 0xd00; - const UINT8 *const pixdata_rgn = (UINT8*)memory_region(REGION_GFX2); + const UINT8 *const pixdata_rgn = (UINT8*)memory_region(machine, REGION_GFX2); profiler_mark(PROFILER_USER1); @@ -1658,7 +1658,7 @@ VIDEO_START( buggybjr ) /* Draw the tilemap with scrolling */ -static void buggyboy_draw_char(UINT8 *bitmap) +static void buggyboy_draw_char(running_machine *machine, UINT8 *bitmap) { INT32 x, y; UINT32 scroll_x, scroll_y; @@ -1667,8 +1667,8 @@ static void buggyboy_draw_char(UINT8 *bitmap) profiler_mark(PROFILER_USER3); /* 2bpp characters */ - gfx1 = memory_region(REGION_GFX1); - gfx2 = memory_region(REGION_GFX1) + 0x4000; + gfx1 = memory_region(machine, REGION_GFX1); + gfx2 = memory_region(machine, REGION_GFX1) + 0x4000; /* X/Y scroll values are the last word in char RAM */ scroll_y = (buggybjr_vram[0x7ff] >> 10) & 0x3f; @@ -1743,13 +1743,13 @@ static void buggyboy_draw_char(UINT8 *bitmap) VIDEO_UPDATE( buggybjr ) { int x, y; - UINT8 *chr_pal = (memory_region(REGION_PROMS) + 0x400); + UINT8 *chr_pal = (memory_region(screen->machine, REGION_PROMS) + 0x400); memset(obj_bmp, 0, 256*240); - buggyboy_draw_char(chr_bmp); - buggybjr_draw_road(rod_bmp); - buggyboy_draw_objs(obj_bmp); + buggyboy_draw_char(screen->machine, chr_bmp); + buggybjr_draw_road(screen->machine, rod_bmp); + buggyboy_draw_objs(screen->machine, obj_bmp); for (y = 0; y < 240; ++y) { diff --git a/src/mame/video/undrfire.c b/src/mame/video/undrfire.c index 088c12e58fd..76110f87223 100644 --- a/src/mame/video/undrfire.c +++ b/src/mame/video/undrfire.c @@ -82,7 +82,7 @@ Heavy use is made of sprite zooming. static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,const int *primasks,int x_offs,int y_offs) { - UINT16 *spritemap = (UINT16 *)memory_region(REGION_USER1); + UINT16 *spritemap = (UINT16 *)memory_region(machine, REGION_USER1); int offs, data, tilenum, color, flipx, flipy; int x, y, priority, dblsize, curx, cury; int sprites_flipscreen = 0; @@ -226,8 +226,8 @@ logerror("Sprite number %04x had %02x invalid chunks\n",tilenum,bad_chunks); static void draw_sprites_cbombers(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,const int *primasks,int x_offs,int y_offs) { - UINT16 *spritemap = (UINT16 *)memory_region(REGION_USER1); - UINT8 *spritemapHibit = (UINT8 *)memory_region(REGION_USER2); + UINT16 *spritemap = (UINT16 *)memory_region(machine, REGION_USER1); + UINT8 *spritemapHibit = (UINT8 *)memory_region(machine, REGION_USER2); int offs, data, tilenum, color, flipx, flipy; int x, y, priority, dblsize, curx, cury; diff --git a/src/mame/video/vball.c b/src/mame/video/vball.c index dd74413ecd9..5b58bcc3734 100644 --- a/src/mame/video/vball.c +++ b/src/mame/video/vball.c @@ -81,7 +81,7 @@ void vb_bgprombank_w( running_machine *machine, int bank ) if (bank==vb_bgprombank) return; - color_prom = memory_region(REGION_PROMS) + bank*0x80; + color_prom = memory_region(machine, REGION_PROMS) + bank*0x80; for (i=0;i<128;i++, color_prom++) { palette_set_color_rgb(machine,i,pal4bit(color_prom[0] >> 0),pal4bit(color_prom[0] >> 4), pal4bit(color_prom[0x800] >> 0)); @@ -97,7 +97,7 @@ void vb_spprombank_w( running_machine *machine, int bank ) if (bank==vb_spprombank) return; - color_prom = memory_region(REGION_PROMS)+0x400 + bank*0x80; + color_prom = memory_region(machine, REGION_PROMS)+0x400 + bank*0x80; for (i=128;i<256;i++,color_prom++) { palette_set_color_rgb(machine,i,pal4bit(color_prom[0] >> 0),pal4bit(color_prom[0] >> 4), pal4bit(color_prom[0x800] >> 0)); diff --git a/src/mame/video/vertigo.c b/src/mame/video/vertigo.c index b1df3ca4a54..daeeae8dfdb 100644 --- a/src/mame/video/vertigo.c +++ b/src/mame/video/vertigo.c @@ -210,13 +210,13 @@ static microcode mc[MC_LENGTH]; * *************************************/ -void vertigo_vproc_init(void) +void vertigo_vproc_init(running_machine *machine) { int i; UINT64 *mcode; - vertigo_vectorrom = (UINT16 *)memory_region(REGION_USER1); - mcode = (UINT64 *)memory_region(REGION_PROMS); + vertigo_vectorrom = (UINT16 *)memory_region(machine, REGION_USER1); + mcode = (UINT64 *)memory_region(machine, REGION_PROMS); /* Decode microcode */ for (i = 0; i < MC_LENGTH; i++) diff --git a/src/mame/video/vicdual.c b/src/mame/video/vicdual.c index 48e93533818..3e37697936b 100644 --- a/src/mame/video/vicdual.c +++ b/src/mame/video/vicdual.c @@ -83,7 +83,7 @@ VIDEO_UPDATE( vicdual_bw ) VIDEO_UPDATE( vicdual_color ) { - UINT8 *color_prom = (UINT8 *)memory_region(REGION_PROMS); + UINT8 *color_prom = (UINT8 *)memory_region(screen->machine, REGION_PROMS); UINT8 x = 0; UINT8 y = cliprect->min_y; UINT8 video_data = 0; diff --git a/src/mame/video/wecleman.c b/src/mame/video/wecleman.c index a38a0bdfb9b..c40fa39d78a 100644 --- a/src/mame/video/wecleman.c +++ b/src/mame/video/wecleman.c @@ -107,8 +107,8 @@ static struct sprite *sprite_list_create(int num_sprites) static void get_sprite_info(running_machine *machine) { const pen_t *base_pal = machine->pens; - UINT8 *base_gfx = memory_region(REGION_GFX1); - int gfx_max = memory_region_length(REGION_GFX1); + UINT8 *base_gfx = memory_region(machine, REGION_GFX1); + int gfx_max = memory_region_length(machine, REGION_GFX1); UINT16 *source = spriteram16; diff --git a/src/mame/video/williams.c b/src/mame/video/williams.c index 95c932d21a8..f243920ce59 100644 --- a/src/mame/video/williams.c +++ b/src/mame/video/williams.c @@ -191,7 +191,7 @@ VIDEO_START( williams ) VIDEO_START( blaster ) { - blitter_init(williams_blitter_config, memory_region(REGION_PROMS)); + blitter_init(williams_blitter_config, memory_region(machine, REGION_PROMS)); create_palette_lookup(); state_save_register(); } diff --git a/src/mame/video/xevious.c b/src/mame/video/xevious.c index c254958bcd6..b210db5a406 100644 --- a/src/mame/video/xevious.c +++ b/src/mame/video/xevious.c @@ -328,7 +328,7 @@ WRITE8_HANDLER( xevious_bs_w ) READ8_HANDLER( xevious_bb_r ) { - UINT8 *rom2a = memory_region(REGION_GFX4); + UINT8 *rom2a = memory_region(machine, REGION_GFX4); UINT8 *rom2b = rom2a+0x1000; UINT8 *rom2c = rom2a+0x3000; int adr_2b,adr_2c; diff --git a/src/mame/video/zaxxon.c b/src/mame/video/zaxxon.c index 087ba34743d..71adf347607 100644 --- a/src/mame/video/zaxxon.c +++ b/src/mame/video/zaxxon.c @@ -82,8 +82,8 @@ PALETTE_INIT( zaxxon ) static TILE_GET_INFO( get_bg_tile_info ) { - const UINT8 *source = memory_region(REGION_GFX4); - int size = memory_region_length(REGION_GFX4) / 2; + const UINT8 *source = memory_region(machine, REGION_GFX4); + int size = memory_region_length(machine, REGION_GFX4) / 2; int eff_index = tile_index & (size - 1); int code = source[eff_index] + 256 * (source[eff_index + size] & 3); int color = source[eff_index + size] >> 4; diff --git a/src/osd/windows/debugwin.c b/src/osd/windows/debugwin.c index f23c2a8f899..4c77142ac02 100644 --- a/src/osd/windows/debugwin.c +++ b/src/osd/windows/debugwin.c @@ -1754,7 +1754,7 @@ static void memory_determine_combo_items(running_machine *machine) for (rgnnum = 0; rgnnum < MAX_MEMORY_REGIONS; rgnnum++) { TCHAR* t_memory_region_name; - UINT8 *base = memory_region(rgnnum); + UINT8 *base = memory_region(machine, rgnnum); UINT32 type = memory_region_type(machine, rgnnum); if (base != NULL && type > REGION_INVALID && (type - REGION_INVALID) < ARRAY_LENGTH(memory_region_names)) { @@ -1763,7 +1763,7 @@ static void memory_determine_combo_items(running_machine *machine) UINT8 width, little_endian; memset(ci, 0, sizeof(*ci)); ci->base = base; - ci->length = memory_region_length(rgnnum); + ci->length = memory_region_length(machine, rgnnum); width = 1 << (flags & ROMREGION_WIDTHMASK); little_endian = ((flags & ROMREGION_ENDIANMASK) == ROMREGION_LE); if (type >= REGION_CPU1 && type <= REGION_CPU8) |