diff options
790 files changed, 2658 insertions, 3001 deletions
diff --git a/src/emu/audit.c b/src/emu/audit.c index dc7b8343887..b7aa96e1c22 100644 --- a/src/emu/audit.c +++ b/src/emu/audit.c @@ -88,8 +88,7 @@ int audit_images(core_options *options, const game_driver *gamedrv, UINT32 valid if (records > 0) { /* allocate memory for the records */ - *audit = (audit_record *)malloc_or_die(sizeof(**audit) * records); - memset(*audit, 0, sizeof(**audit) * records); + *audit = alloc_array_clear_or_die(audit_record, records); record = *audit; /* iterate over ROM sources and regions */ @@ -174,8 +173,7 @@ int audit_samples(core_options *options, const game_driver *gamedrv, audit_recor goto skip; /* allocate memory for the records */ - *audit = (audit_record *)malloc_or_die(sizeof(**audit) * records); - memset(*audit, 0, sizeof(**audit) * records); + *audit = alloc_array_clear_or_die(audit_record, records); record = *audit; /* now iterate over sample entries */ diff --git a/src/emu/cheat.c b/src/emu/cheat.c index c317afa79cb..57e1b23cdad 100644 --- a/src/emu/cheat.c +++ b/src/emu/cheat.c @@ -371,8 +371,7 @@ void cheat_init(running_machine *machine) add_exit_callback(machine, cheat_exit); /* allocate memory */ - cheatinfo = (cheat_private *)auto_malloc(sizeof(*cheatinfo)); - memset(cheatinfo, 0, sizeof(*cheatinfo)); + cheatinfo = auto_alloc_clear(machine, cheat_private); machine->cheat_data = cheatinfo; /* load the cheat file */ @@ -1061,8 +1060,7 @@ static cheat_entry *cheat_entry_load(running_machine *machine, const char *filen } /* allocate memory for the cheat */ - cheat = (cheat_entry *)malloc_or_die(sizeof(*cheat) + (tempcount - 1) * sizeof(cheat->tempvar)); - memset(cheat, 0, sizeof(*cheat) + (tempcount - 1) * sizeof(cheat->tempvar)); + cheat = (cheat_entry *)alloc_array_clear_or_die(UINT8, sizeof(*cheat) + (tempcount - 1) * sizeof(cheat->tempvar)); cheat->numtemp = tempcount; /* get the description */ @@ -1232,8 +1230,7 @@ static cheat_parameter *cheat_parameter_load(const char *filename, xml_data_node cheat_parameter *param; /* allocate memory for it */ - param = (cheat_parameter *)malloc_or_die(sizeof(*param)); - memset(param, 0, sizeof(*param)); + param = alloc_clear_or_die(cheat_parameter); /* read the core attributes */ param->minval = xml_get_attribute_int(paramnode, "min", 0); @@ -1250,8 +1247,7 @@ static cheat_parameter *cheat_parameter_load(const char *filename, xml_data_node parameter_item *curitem; /* allocate memory for it */ - curitem = (parameter_item *)malloc_or_die(sizeof(*curitem)); - memset(curitem, 0, sizeof(*curitem)); + curitem = alloc_clear_or_die(parameter_item); /* check for NULL text */ if (itemnode->value == NULL || itemnode->value[0] == 0) @@ -1361,8 +1357,7 @@ static cheat_script *cheat_script_load(running_machine *machine, const char *fil const char *state; /* allocate memory for it */ - script = (cheat_script *)malloc_or_die(sizeof(*script)); - memset(script, 0, sizeof(*script)); + script = alloc_clear_or_die(cheat_script); /* read the core attributes */ script->state = SCRIPT_STATE_RUN; @@ -1476,8 +1471,7 @@ static script_entry *script_entry_load(running_machine *machine, const char *fil EXPRERR experr; /* allocate memory for it */ - entry = (script_entry *)malloc_or_die(sizeof(*entry)); - memset(entry, 0, sizeof(*entry)); + entry = alloc_clear_or_die(script_entry); /* read the condition if present */ expression = xml_get_attribute_string(entrynode, "condition", NULL); @@ -1546,8 +1540,7 @@ static script_entry *script_entry_load(running_machine *machine, const char *fil output_argument *curarg; /* allocate memory for it */ - curarg = (output_argument *)malloc_or_die(sizeof(*curarg)); - memset(curarg, 0, sizeof(*curarg)); + curarg = alloc_clear_or_die(output_argument); /* first extract attributes */ curarg->count = xml_get_attribute_int(argnode, "count", 1); diff --git a/src/emu/clifront.c b/src/emu/clifront.c index 6ea65dca75d..02f6efcef29 100644 --- a/src/emu/clifront.c +++ b/src/emu/clifront.c @@ -440,7 +440,7 @@ int cli_info_listclones(core_options *options, const char *gamename) int cli_info_listbrothers(core_options *options, const char *gamename) { - UINT8 *didit = (UINT8 *)malloc_or_die(driver_list_get_count(drivers)); + UINT8 *didit = alloc_array_or_die(UINT8, driver_list_get_count(drivers)); astring *filename = astring_alloc(); int drvindex, count = 0; diff --git a/src/emu/config.c b/src/emu/config.c index 3d0edbf74f7..f7842cb6a59 100644 --- a/src/emu/config.c +++ b/src/emu/config.c @@ -92,7 +92,7 @@ void config_register(running_machine *machine, const char *nodename, config_call config_type **ptype; /* allocate a new type */ - newtype = (config_type *)auto_malloc(sizeof(*newtype)); + newtype = auto_alloc(machine, config_type); newtype->next = NULL; newtype->name = nodename; newtype->load = load; diff --git a/src/emu/cpu/asap/asap.c b/src/emu/cpu/asap/asap.c index ba373a15b73..c26f956a678 100644 --- a/src/emu/cpu/asap/asap.c +++ b/src/emu/cpu/asap/asap.c @@ -217,7 +217,9 @@ static void jsr_c(asap_state *); static void jsr_c0(asap_state *); static void trapf(asap_state *); -static void (*const opcodetable[32][4])(asap_state *) = +typedef void (*asap_ophandler)(asap_state *); + +static const asap_ophandler opcodetable[32][4] = { { trap0, trap0, trap0, trap0 }, { NULL, NULL, NULL, NULL }, @@ -407,11 +409,11 @@ static void set_irq_line(asap_state *asap, int irqline, int state) INITIALIZATION AND SHUTDOWN ***************************************************************************/ -static void init_tables(void) +static void init_tables(running_machine *machine) { /* allocate opcode table */ if (!opcode) - opcode = (void (**)(asap_state *))auto_malloc(32 * 32 * 2 * sizeof(void *)); + opcode = auto_alloc_array(machine, asap_ophandler, 32 * 32 * 2); /* fill opcode table */ if (opcode) @@ -439,7 +441,7 @@ static CPU_INIT( asap ) asap_state *asap = get_safe_token(device); int i; - init_tables(); + init_tables(device->machine); for (i = 0; i < REGBASE; i++) asap->src2val[i] = i; asap->irq_callback = irqcallback; diff --git a/src/emu/cpu/cubeqcpu/cubeqcpu.c b/src/emu/cpu/cubeqcpu/cubeqcpu.c index 543a407199c..56e18979b61 100644 --- a/src/emu/cpu/cubeqcpu/cubeqcpu.c +++ b/src/emu/cpu/cubeqcpu/cubeqcpu.c @@ -326,7 +326,7 @@ static CPU_INIT( cquestsnd ) cpustate->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM); /* Allocate RAM shared with 68000 */ - cpustate->sram = (UINT16 *)auto_malloc(4096); + cpustate->sram = auto_alloc_array(device->machine, UINT16, 4096/2); cquestsnd_state_register(device); } @@ -392,8 +392,8 @@ static CPU_INIT( cquestrot ) memset(cpustate, 0, sizeof(*cpustate)); /* Allocate RAM */ - cpustate->dram = (UINT16 *)auto_malloc(16384 * sizeof(UINT16)); /* Shared with 68000 */ - cpustate->sram = (UINT16 *)auto_malloc(2048 * sizeof(UINT16)); /* Private */ + cpustate->dram = auto_alloc_array(device->machine, UINT16, 16384); /* Shared with 68000 */ + cpustate->sram = auto_alloc_array(device->machine, UINT16, 2048); /* Private */ cpustate->device = device; cpustate->lindevice = cputag_get_cpu(device->machine, rotconfig->lin_cpu_tag); @@ -475,10 +475,10 @@ static CPU_INIT( cquestlin ) memset(cpustate, 0, sizeof(*cpustate)); /* Allocate RAM */ - cpustate->sram = (UINT16 *)auto_malloc(4096 * sizeof(UINT16)); /* Shared with rotate CPU */ - cpustate->ptr_ram = (UINT8 *)auto_malloc(1024); /* Pointer RAM */ - cpustate->e_stack = (UINT32 *)auto_malloc(32768 * sizeof(UINT32)); /* Stack DRAM: 32kx20 */ - cpustate->o_stack = (UINT32 *)auto_malloc(32768 * sizeof(UINT32)); /* Stack DRAM: 32kx20 */ + cpustate->sram = auto_alloc_array(device->machine, UINT16, 4096); /* Shared with rotate CPU */ + cpustate->ptr_ram = auto_alloc_array(device->machine, UINT8, 1024); /* Pointer RAM */ + cpustate->e_stack = auto_alloc_array(device->machine, UINT32, 32768); /* Stack DRAM: 32kx20 */ + cpustate->o_stack = auto_alloc_array(device->machine, UINT32, 32768); /* Stack DRAM: 32kx20 */ cpustate->device = device; cpustate->rotdevice = cputag_get_cpu(device->machine, linconfig->rot_cpu_tag); diff --git a/src/emu/cpu/drcfe.c b/src/emu/cpu/drcfe.c index 7cb86b9fa58..695ae20d59a 100644 --- a/src/emu/cpu/drcfe.c +++ b/src/emu/cpu/drcfe.c @@ -97,7 +97,7 @@ INLINE opcode_desc *desc_alloc(drcfe_state *drcfe) if (desc != NULL) drcfe->desc_free_list = desc->next; else - desc = (opcode_desc *)malloc_or_die(sizeof(*desc)); + desc = alloc_or_die(opcode_desc); return desc; } @@ -128,12 +128,10 @@ drcfe_state *drcfe_init(const device_config *cpu, const drcfe_config *config, vo drcfe_state *drcfe; /* allocate some memory to hold the state */ - drcfe = (drcfe_state *)malloc_or_die(sizeof(*drcfe)); - memset(drcfe, 0, sizeof(*drcfe)); + drcfe = alloc_clear_or_die(drcfe_state); /* allocate the description array */ - drcfe->desc_array = (opcode_desc **)malloc_or_die((config->window_end + config->window_start + 2) * sizeof(*drcfe->desc_array)); - memset(drcfe->desc_array, 0, (config->window_end + config->window_start + 2) * sizeof(*drcfe->desc_array)); + drcfe->desc_array = alloc_array_clear_or_die(opcode_desc *, config->window_end + config->window_start + 2); /* copy in configuration information */ drcfe->window_start = config->window_start; diff --git a/src/emu/cpu/esrip/esrip.c b/src/emu/cpu/esrip/esrip.c index d25e4a40e56..c28286ed929 100644 --- a/src/emu/cpu/esrip/esrip.c +++ b/src/emu/cpu/esrip/esrip.c @@ -260,13 +260,13 @@ static CPU_INIT( esrip ) cpustate->draw = _config->draw; /* Allocate image pointer table RAM */ - cpustate->ipt_ram = (UINT16 *)auto_malloc(IPT_RAM_SIZE); + cpustate->ipt_ram = auto_alloc_array(device->machine, UINT16, IPT_RAM_SIZE/2); cpustate->device = device; cpustate->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM); /* Create the instruction decode lookup table */ - cpustate->optable = (UINT8 *)auto_malloc(65536); + cpustate->optable = auto_alloc_array(device->machine, UINT8, 65536); make_ops(cpustate); /* Register stuff for state saving */ diff --git a/src/emu/cpu/i386/i386.c b/src/emu/cpu/i386/i386.c index 21a71773cd6..874fd94342d 100644 --- a/src/emu/cpu/i386/i386.c +++ b/src/emu/cpu/i386/i386.c @@ -391,13 +391,13 @@ INLINE void CYCLES_RM(i386_state *cpustate,int modrm, int r, int m) } } -static void build_cycle_table(void) +static void build_cycle_table(running_machine *machine) { int i, j; for (j=0; j < X86_NUM_CPUS; j++) { - cycle_table_rm[j] = (UINT8 *)auto_malloc(sizeof(UINT8) * CYCLES_NUM_OPCODES); - cycle_table_pm[j] = (UINT8 *)auto_malloc(sizeof(UINT8) * CYCLES_NUM_OPCODES); + cycle_table_rm[j] = auto_alloc_array(machine, UINT8, CYCLES_NUM_OPCODES); + cycle_table_pm[j] = auto_alloc_array(machine, UINT8, CYCLES_NUM_OPCODES); for (i=0; i < sizeof(x86_cycle_table)/sizeof(X86_CYCLE_TABLE); i++) { @@ -507,7 +507,7 @@ static CPU_INIT( i386 ) static const int regs32[8] = {EAX,ECX,EDX,EBX,ESP,EBP,ESI,EDI}; i386_state *cpustate = get_safe_token(device); - build_cycle_table(); + build_cycle_table(device->machine); for( i=0; i < 256; i++ ) { int c=0; diff --git a/src/emu/cpu/jaguar/jaguar.c b/src/emu/cpu/jaguar/jaguar.c index d597b3cbfb5..aea65b19f00 100644 --- a/src/emu/cpu/jaguar/jaguar.c +++ b/src/emu/cpu/jaguar/jaguar.c @@ -367,7 +367,7 @@ static void init_tables(void) } /* fill in the mirror table */ - mirror_table = (UINT16 *)malloc_or_die(65536 * sizeof(mirror_table[0])); + mirror_table = alloc_array_or_die(UINT16, 65536); for (i = 0; i < 65536; i++) mirror_table[i] = ((i >> 15) & 0x0001) | ((i >> 13) & 0x0002) | ((i >> 11) & 0x0004) | ((i >> 9) & 0x0008) | @@ -379,7 +379,7 @@ static void init_tables(void) ((i << 13) & 0x4000) | ((i << 15) & 0x8000); /* fill in the condition table */ - condition_table = (UINT8 *)malloc_or_die(32 * 8 * sizeof(condition_table[0])); + condition_table = alloc_array_or_die(UINT8, 32 * 8); for (i = 0; i < 8; i++) for (j = 0; j < 32; j++) { diff --git a/src/emu/cpu/mb86233/mb86233.c b/src/emu/cpu/mb86233/mb86233.c index 9c477fadb48..c03e7aa8344 100644 --- a/src/emu/cpu/mb86233/mb86233.c +++ b/src/emu/cpu/mb86233/mb86233.c @@ -118,7 +118,7 @@ static CPU_INIT( mb86233 ) cpustate->fifo_write_cb = _config->fifo_write_cb; } - cpustate->RAM = (UINT32 *)auto_malloc(2 * 0x200 * sizeof(UINT32)); /* 2x 2KB */ + cpustate->RAM = auto_alloc_array(device->machine, UINT32, 2 * 0x200); /* 2x 2KB */ memset( cpustate->RAM, 0, 2 * 0x200 * sizeof(UINT32) ); cpustate->ARAM = &cpustate->RAM[0]; cpustate->BRAM = &cpustate->RAM[0x200]; diff --git a/src/emu/cpu/mc68hc11/mc68hc11.c b/src/emu/cpu/mc68hc11/mc68hc11.c index 19c9953709c..c5ced5d9020 100644 --- a/src/emu/cpu/mc68hc11/mc68hc11.c +++ b/src/emu/cpu/mc68hc11/mc68hc11.c @@ -356,7 +356,7 @@ static CPU_INIT( hc11 ) } cpustate->internal_ram_size = 1280; /* FIXME: this is for MC68HC11M0 */ - cpustate->internal_ram = (UINT8 *)auto_malloc(cpustate->internal_ram_size); + cpustate->internal_ram = auto_alloc_array(device->machine, UINT8, cpustate->internal_ram_size); cpustate->reg_position = 0; cpustate->ram_position = 0x100; diff --git a/src/emu/cpu/mips/mips3.c b/src/emu/cpu/mips/mips3.c index 68599760a49..be58d00e8b7 100644 --- a/src/emu/cpu/mips/mips3.c +++ b/src/emu/cpu/mips/mips3.c @@ -2137,14 +2137,14 @@ static CPU_GET_INFO( mips3 ) static CPU_INIT( r4600be ) { size_t memsize = mips3com_init(&mips3.core, MIPS3_TYPE_R4600, TRUE, device, index, clock, irqcallback, NULL); - void *memory = auto_malloc(memsize); + void *memory = auto_alloc_array(device->machine, UINT8, memsize); mips3com_init(&mips3.core, MIPS3_TYPE_R4600, TRUE, index, clock, irqcallback, memory); } static CPU_INIT( r4600le ) { size_t memsize = mips3com_init(&mips3.core, MIPS3_TYPE_R4600, FALSE, device, index, clock, irqcallback, NULL); - void *memory = auto_malloc(memsize); + void *memory = auto_alloc_array(device->machine, UINT8, memsize); mips3com_init(&mips3.core, MIPS3_TYPE_R4600, FALSE, index, clock, irqcallback, memory); } @@ -2193,14 +2193,14 @@ CPU_GET_INFO( r4600le ) static CPU_INIT( r4650be ) { size_t memsize = mips3com_init(&mips3.core, MIPS3_TYPE_R4650, TRUE, device, index, clock, irqcallback, NULL); - void *memory = auto_malloc(memsize); + void *memory = auto_alloc_array(device->machine, UINT8, memsize); mips3com_init(&mips3.core, MIPS3_TYPE_R4650, TRUE, index, clock, irqcallback, memory); } static CPU_INIT( r4650le ) { size_t memsize = mips3com_init(&mips3.core, MIPS3_TYPE_R4650, FALSE, device, index, clock, irqcallback, NULL); - void *memory = auto_malloc(memsize); + void *memory = auto_alloc_array(device->machine, UINT8, memsize); mips3com_init(&mips3.core, MIPS3_TYPE_R4650, FALSE, index, clock, irqcallback, memory); } @@ -2249,14 +2249,14 @@ CPU_GET_INFO( r4650le ) static CPU_INIT( r4700be ) { size_t memsize = mips3com_init(&mips3.core, MIPS3_TYPE_R4700, TRUE, device, index, clock, irqcallback, NULL); - void *memory = auto_malloc(memsize); + void *memory = auto_alloc_array(device->machine, UINT8, memsize); mips3com_init(&mips3.core, MIPS3_TYPE_R4700, TRUE, index, clock, irqcallback, memory); } static CPU_INIT( r4700le ) { size_t memsize = mips3com_init(&mips3.core, MIPS3_TYPE_R4700, FALSE, device, index, clock, irqcallback, NULL); - void *memory = auto_malloc(memsize); + void *memory = auto_alloc_array(device->machine, UINT8, memsize); mips3com_init(&mips3.core, MIPS3_TYPE_R4700, FALSE, index, clock, irqcallback, memory); } @@ -2306,14 +2306,14 @@ CPU_GET_INFO( r4700le ) static CPU_INIT( r5000be ) { size_t memsize = mips3com_init(&mips3.core, MIPS3_TYPE_R5000, TRUE, device, index, clock, irqcallback, NULL); - void *memory = auto_malloc(memsize); + void *memory = auto_alloc_array(device->machine, UINT8, memsize); mips3com_init(&mips3.core, MIPS3_TYPE_R5000, TRUE, index, clock, irqcallback, memory); } static CPU_INIT( r5000le ) { size_t memsize = mips3com_init(&mips3.core, MIPS3_TYPE_R5000, FALSE, device, index, clock, irqcallback, NULL); - void *memory = auto_malloc(memsize); + void *memory = auto_alloc_array(device->machine, UINT8, memsize); mips3com_init(&mips3.core, MIPS3_TYPE_R5000, FALSE, index, clock, irqcallback, memory); } @@ -2362,14 +2362,14 @@ CPU_GET_INFO( r5000le ) static CPU_INIT( qed5271be ) { size_t memsize = mips3com_init(&mips3.core, MIPS3_TYPE_QED5271, TRUE, device, index, clock, irqcallback, NULL); - void *memory = auto_malloc(memsize); + void *memory = auto_alloc_array(device->machine, UINT8, memsize); mips3com_init(&mips3.core, MIPS3_TYPE_QED5271, TRUE, index, clock, irqcallback, memory); } static CPU_INIT( qed5271le ) { size_t memsize = mips3com_init(&mips3.core, MIPS3_TYPE_QED5271, FALSE, device, index, clock, irqcallback, NULL); - void *memory = auto_malloc(memsize); + void *memory = auto_alloc_array(device->machine, UINT8, memsize); mips3com_init(&mips3.core, MIPS3_TYPE_QED5271, FALSE, index, clock, irqcallback, memory); } @@ -2418,14 +2418,14 @@ CPU_GET_INFO( qed5271le ) static CPU_INIT( rm7000be ) { size_t memsize = mips3com_init(&mips3.core, MIPS3_TYPE_RM7000, TRUE, device, index, clock, irqcallback, NULL); - void *memory = auto_malloc(memsize); + void *memory = auto_alloc_array(device->machine, UINT8, memsize); mips3com_init(&mips3.core, MIPS3_TYPE_RM7000, TRUE, index, clock, irqcallback, memory); } static CPU_INIT( rm7000le ) { size_t memsize = mips3com_init(&mips3.core, MIPS3_TYPE_RM7000, FALSE, device, index, clock, irqcallback, NULL); - void *memory = auto_malloc(memsize); + void *memory = auto_alloc_array(device->machine, UINT8, memsize); mips3com_init(&mips3.core, MIPS3_TYPE_RM7000, FALSE, index, clock, irqcallback, memory); } diff --git a/src/emu/cpu/mips/psx.c b/src/emu/cpu/mips/psx.c index 0f204a6f09f..a86bfbcf135 100644 --- a/src/emu/cpu/mips/psx.c +++ b/src/emu/cpu/mips/psx.c @@ -1316,7 +1316,7 @@ static void mips_update_scratchpad( const address_space *space ) } else { - memory_install_readwrite32_handler( space, 0x1f800000, 0x1f8003ff, 0, 0, (read32_space_func)SMH_BANK32, (write32_space_func)SMH_BANK32 ); + memory_install_readwrite32_handler( space, 0x1f800000, 0x1f8003ff, 0, 0, (read32_space_func)SMH_BANK(32), (write32_space_func)SMH_BANK(32) ); memory_set_bankptr(space->machine, 32, psxcpu->dcache ); } diff --git a/src/emu/cpu/mips/r3000.c b/src/emu/cpu/mips/r3000.c index d5120d66d70..9dd2d3722a9 100644 --- a/src/emu/cpu/mips/r3000.c +++ b/src/emu/cpu/mips/r3000.c @@ -301,8 +301,8 @@ static CPU_INIT( r3000 ) r3000_state *r3000 = get_safe_token(device); /* allocate memory */ - r3000->icache = (UINT32 *)auto_malloc(configdata->icache); - r3000->dcache = (UINT32 *)auto_malloc(configdata->dcache); + r3000->icache = auto_alloc_array(device->machine, UINT32, configdata->icache/4); + r3000->dcache = auto_alloc_array(device->machine, UINT32, configdata->dcache/4); r3000->icache_size = configdata->icache; r3000->dcache_size = configdata->dcache; diff --git a/src/emu/cpu/se3208/se3208.c b/src/emu/cpu/se3208/se3208.c index c908fa382f9..b5e31bace87 100644 --- a/src/emu/cpu/se3208/se3208.c +++ b/src/emu/cpu/se3208/se3208.c @@ -1705,7 +1705,7 @@ static void BuildTable(void) { int i; if(!OpTable) - OpTable=(_OP *)malloc_or_die(sizeof(_OP)*0x10000); + OpTable=alloc_array_or_die(_OP, 0x10000); for(i=0;i<0x10000;++i) OpTable[i]=DecodeOp(i); } diff --git a/src/emu/cpu/sh2/sh2.c b/src/emu/cpu/sh2/sh2.c index ae3736e4b9e..9f8d8aac311 100644 --- a/src/emu/cpu/sh2/sh2.c +++ b/src/emu/cpu/sh2/sh2.c @@ -2247,8 +2247,7 @@ static CPU_DISASSEMBLE( sh2 ) static CPU_INIT( sh2 ) { /* allocate the core memory */ - sh2 = auto_malloc(sizeof(SH2)); - memset(sh2, 0, sizeof(SH2)); + sh2 = auto_alloc_clear(device->machine, SH2); /* initialize the common core parts */ sh2_common_init(sh2, device, irqcallback); diff --git a/src/emu/cpu/sh2/sh2comn.c b/src/emu/cpu/sh2/sh2comn.c index a046cc7c7a6..691e62dbe4d 100644 --- a/src/emu/cpu/sh2/sh2comn.c +++ b/src/emu/cpu/sh2/sh2comn.c @@ -712,7 +712,7 @@ void sh2_common_init(SH2 *sh2, const device_config *device, cpu_irq_callback irq sh2->dma_timer[1] = timer_alloc(device->machine, sh2_dmac_callback, sh2); timer_adjust_oneshot(sh2->dma_timer[1], attotime_never, 0); - sh2->m = (UINT32 *)auto_malloc(0x200); + sh2->m = auto_alloc_array(device->machine, UINT32, 0x200/4); if(conf) { diff --git a/src/emu/cpu/sh4/sh4comn.c b/src/emu/cpu/sh4/sh4comn.c index 0f06c7fe8f0..0218bf5e121 100644 --- a/src/emu/cpu/sh4/sh4comn.c +++ b/src/emu/cpu/sh4/sh4comn.c @@ -1182,7 +1182,7 @@ void sh4_common_init(const device_config *device) sh4->rtc_timer = timer_alloc(device->machine, sh4_rtc_timer_callback, sh4); timer_adjust_oneshot(sh4->rtc_timer, attotime_never, 0); - sh4->m = (UINT32 *)auto_malloc(16384*4); + sh4->m = auto_alloc_array(device->machine, UINT32, 16384); } void sh4_dma_ddt(const device_config *device, struct sh4_ddt_dma *s) diff --git a/src/emu/cpu/sharc/sharc.c b/src/emu/cpu/sharc/sharc.c index c441c656b19..8ffbebd970a 100644 --- a/src/emu/cpu/sharc/sharc.c +++ b/src/emu/cpu/sharc/sharc.c @@ -445,7 +445,7 @@ static CPU_INIT( sharc ) build_opcode_table(); - cpustate->internal_ram = (UINT16 *)auto_malloc(2 * 0x10000 * sizeof(UINT16)); // 2x 128KB + cpustate->internal_ram = auto_alloc_array(device->machine, UINT16, 2 * 0x10000); // 2x 128KB cpustate->internal_ram_block0 = &cpustate->internal_ram[0]; cpustate->internal_ram_block1 = &cpustate->internal_ram[0x20000/2]; diff --git a/src/emu/cpu/tms32025/tms32025.c b/src/emu/cpu/tms32025/tms32025.c index e12e6722ef0..2660eff27c7 100644 --- a/src/emu/cpu/tms32025/tms32025.c +++ b/src/emu/cpu/tms32025/tms32025.c @@ -1719,7 +1719,7 @@ static CPU_INIT( tms32025 ) { tms32025_state *cpustate = get_safe_token(device); - cpustate->intRAM = (UINT16 *)auto_malloc(0x800*2); + cpustate->intRAM = auto_alloc_array(device->machine, UINT16, 0x800); cpustate->irq_callback = irqcallback; cpustate->device = device; cpustate->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM); diff --git a/src/emu/cpu/tms34010/tms34010.c b/src/emu/cpu/tms34010/tms34010.c index 59b865436b1..4598a8874dc 100644 --- a/src/emu/cpu/tms34010/tms34010.c +++ b/src/emu/cpu/tms34010/tms34010.c @@ -704,7 +704,7 @@ static CPU_INIT( tms34010 ) timer_adjust_oneshot(tms->scantimer, attotime_zero, 0); /* allocate the shiftreg */ - tms->shiftreg = (UINT16 *)auto_malloc(SHIFTREG_SIZE); + tms->shiftreg = auto_alloc_array(device->machine, UINT16, SHIFTREG_SIZE/2); state_save_register_device_item(device, 0, tms->pc); state_save_register_device_item(device, 0, tms->st); diff --git a/src/emu/cpu/vtlb.c b/src/emu/cpu/vtlb.c index de4a755e17a..c921831e977 100644 --- a/src/emu/cpu/vtlb.c +++ b/src/emu/cpu/vtlb.c @@ -60,8 +60,7 @@ vtlb_state *vtlb_alloc(const device_config *cpu, int space, int fixed_entries, i vtlb_state *vtlb; /* allocate memory for the core structure */ - vtlb = (vtlb_state *)malloc_or_die(sizeof(*vtlb)); - memset(vtlb, 0, sizeof(*vtlb)); + vtlb = alloc_clear_or_die(vtlb_state); /* fill in CPU information */ vtlb->device = cpu; @@ -78,20 +77,17 @@ vtlb_state *vtlb_alloc(const device_config *cpu, int space, int fixed_entries, i assert(vtlb->addrwidth > vtlb->pageshift); /* allocate the entry array */ - vtlb->live = (offs_t *)malloc_or_die(sizeof(vtlb->live[0]) * (fixed_entries + dynamic_entries)); - memset(vtlb->live, 0, sizeof(vtlb->live[0]) * (fixed_entries + dynamic_entries)); + vtlb->live = alloc_array_clear_or_die(offs_t, fixed_entries + dynamic_entries); state_save_register_device_item_pointer(cpu, space, vtlb->live, fixed_entries + dynamic_entries); /* allocate the lookup table */ - vtlb->table = (vtlb_entry *)malloc_or_die(sizeof(vtlb->table[0]) << (vtlb->addrwidth - vtlb->pageshift)); - memset(vtlb->table, 0, sizeof(vtlb->table[0]) << (vtlb->addrwidth - vtlb->pageshift)); + vtlb->table = alloc_array_clear_or_die(vtlb_entry, 1 << (vtlb->addrwidth - vtlb->pageshift)); state_save_register_device_item_pointer(cpu, space, vtlb->table, 1 << (vtlb->addrwidth - vtlb->pageshift)); /* allocate the fixed page count array */ if (fixed_entries > 0) { - vtlb->fixedpages = (int *)malloc_or_die(sizeof(vtlb->fixedpages[0]) * fixed_entries); - memset(vtlb->fixedpages, 0, sizeof(vtlb->fixedpages[0]) * fixed_entries); + vtlb->fixedpages = alloc_array_clear_or_die(int, fixed_entries); state_save_register_device_item_pointer(cpu, space, vtlb->fixedpages, fixed_entries); } return vtlb; diff --git a/src/emu/cpu/x86log.c b/src/emu/cpu/x86log.c index 94f02970587..d961387a1ba 100644 --- a/src/emu/cpu/x86log.c +++ b/src/emu/cpu/x86log.c @@ -91,8 +91,7 @@ x86log_context *x86log_create_context(const char *filename) x86log_context *log; /* allocate the log */ - log = (x86log_context *)malloc_or_die(sizeof(*log)); - memset(log, 0, sizeof(*log)); + log = alloc_clear_or_die(x86log_context); /* allocate the filename */ log->filename = astring_dupc(filename); diff --git a/src/emu/cpu/z180/z180.c b/src/emu/cpu/z180/z180.c index 9d8d0b02bc2..5ddc56e1f04 100644 --- a/src/emu/cpu/z180/z180.c +++ b/src/emu/cpu/z180/z180.c @@ -2067,8 +2067,8 @@ static CPU_RESET( z180 ) int oldval, newval, val; UINT8 *padd, *padc, *psub, *psbc; /* allocate big flag arrays once */ - SZHVC_add = (UINT8 *)auto_malloc(2*256*256); - SZHVC_sub = (UINT8 *)auto_malloc(2*256*256); + SZHVC_add = auto_alloc_array(device->machine, UINT8, 2*256*256); + SZHVC_sub = auto_alloc_array(device->machine, UINT8, 2*256*256); padd = &SZHVC_add[ 0*256]; padc = &SZHVC_add[256*256]; psub = &SZHVC_sub[ 0*256]; diff --git a/src/emu/cpu/z80/z80daisy.c b/src/emu/cpu/z80/z80daisy.c index eb15e3c2621..bcfd2640d54 100644 --- a/src/emu/cpu/z80/z80daisy.c +++ b/src/emu/cpu/z80/z80daisy.c @@ -29,7 +29,7 @@ z80_daisy_state *z80daisy_init(const device_config *cpudevice, const z80_daisy_c /* create a linked list of devices */ for ( ; daisy->devname != NULL; daisy++) { - *tailptr = (z80_daisy_state *)auto_malloc(sizeof(**tailptr)); + *tailptr = auto_alloc(cpudevice->machine, z80_daisy_state); (*tailptr)->next = NULL; (*tailptr)->device = devtag_get_device(cpudevice->machine, device_inherit_tag(tempstring, cpudevice->tag, daisy->devname)); if ((*tailptr)->device == NULL) diff --git a/src/emu/cpuexec.c b/src/emu/cpuexec.c index 255cddab94a..721fe97d9ec 100644 --- a/src/emu/cpuexec.c +++ b/src/emu/cpuexec.c @@ -223,8 +223,7 @@ void cpuexec_init(running_machine *machine) attotime min_quantum; /* allocate global state */ - machine->cpuexec_data = (cpuexec_private *)auto_malloc(sizeof(*machine->cpuexec_data)); - memset(machine->cpuexec_data, 0, sizeof(*machine->cpuexec_data)); + machine->cpuexec_data = auto_alloc_clear(machine, cpuexec_private); /* set the core scheduling quantum */ min_quantum = machine->config->minimum_quantum; diff --git a/src/emu/debug/debugcmt.c b/src/emu/debug/debugcmt.c index 6200c76d2d3..4db231cce50 100644 --- a/src/emu/debug/debugcmt.c +++ b/src/emu/debug/debugcmt.c @@ -110,8 +110,7 @@ int debug_comment_init(running_machine *machine) if (numcpu > 0) { /* allocate enough comment groups for the total # of cpu's */ - debug_comments = (comment_group*) auto_malloc(numcpu * sizeof(comment_group)); - memset(debug_comments, 0, numcpu * sizeof(comment_group)); + debug_comments = auto_alloc_array_clear(machine, comment_group, numcpu); /* automatically load em up */ debug_comment_load(machine); @@ -137,7 +136,7 @@ int debug_comment_add(const device_config *device, offs_t addr, const char *comm int match = 0; /* Create a new item to insert into the list */ - debug_comment *insert_me = (debug_comment*) malloc_or_die(sizeof(debug_comment)); + debug_comment *insert_me = alloc_or_die(debug_comment); insert_me->color = color; insert_me->is_valid = 1; insert_me->address = addr; diff --git a/src/emu/debug/debugcon.c b/src/emu/debug/debugcon.c index cc2fd0b7117..c56efb8f5ef 100644 --- a/src/emu/debug/debugcon.c +++ b/src/emu/debug/debugcon.c @@ -404,8 +404,7 @@ void debug_console_register_command(running_machine *machine, const char *comman assert_always(mame_get_phase(machine) == MAME_PHASE_INIT, "Can only call debug_console_register_command() at init time!"); assert_always((machine->debug_flags & DEBUG_FLAG_ENABLED) != 0, "Cannot call debug_console_register_command() when debugger is not running"); - cmd = (debug_command *)auto_malloc(sizeof(*cmd)); - memset(cmd, 0, sizeof(*cmd)); + cmd = auto_alloc_clear(machine, debug_command); /* fill in the command */ strcpy(cmd->command, command); diff --git a/src/emu/debug/debugcpu.c b/src/emu/debug/debugcpu.c index 0c7987df683..911b9bbe72b 100644 --- a/src/emu/debug/debugcpu.c +++ b/src/emu/debug/debugcpu.c @@ -158,8 +158,7 @@ void debug_cpu_init(running_machine *machine) int regnum; /* allocate and reset globals */ - machine->debugcpu_data = global = (debugcpu_private *)auto_malloc(sizeof(*global)); - memset(global, 0, sizeof(*global)); + machine->debugcpu_data = global = auto_alloc_clear(machine, debugcpu_private); global->execution_state = EXECUTION_STATE_STOPPED; global->bpindex = 1; global->wpindex = 1; @@ -190,8 +189,7 @@ void debug_cpu_init(running_machine *machine) cpu_debug_data *info; /* allocate some information */ - info = (cpu_debug_data *)auto_malloc(sizeof(*info)); - memset(info, 0, sizeof(*info)); + info = auto_alloc_clear(machine, cpu_debug_data); classheader->debug = info; /* reset the PC data */ @@ -983,7 +981,7 @@ int debug_cpu_breakpoint_set(const device_config *device, offs_t address, parsed assert_always(device != NULL, "debug_cpu_breakpoint_set() called with invalid cpu!"); /* allocate breakpoint */ - bp = (debug_cpu_breakpoint *)malloc_or_die(sizeof(*bp)); + bp = alloc_or_die(debug_cpu_breakpoint); bp->index = global->bpindex++; bp->enabled = TRUE; bp->address = address; @@ -991,7 +989,7 @@ int debug_cpu_breakpoint_set(const device_config *device, offs_t address, parsed bp->action = NULL; if (action != NULL) { - bp->action = (char *)malloc_or_die(strlen(action) + 1); + bp->action = alloc_array_or_die(char, strlen(action) + 1); strcpy(bp->action, action); } @@ -1087,7 +1085,7 @@ int debug_cpu_watchpoint_set(const address_space *space, int type, offs_t addres { debugcpu_private *global = space->machine->debugcpu_data; cpu_debug_data *info = cpu_get_debug_data(space->cpu); - debug_cpu_watchpoint *wp = (debug_cpu_watchpoint *)malloc_or_die(sizeof(*wp)); + debug_cpu_watchpoint *wp = alloc_or_die(debug_cpu_watchpoint); /* fill in the structure */ wp->index = global->wpindex++; @@ -1099,7 +1097,7 @@ int debug_cpu_watchpoint_set(const address_space *space, int type, offs_t addres wp->action = NULL; if (action != NULL) { - wp->action = (char *)malloc_or_die(strlen(action) + 1); + wp->action = alloc_array_or_die(char, strlen(action) + 1); strcpy(wp->action, action); } @@ -1245,7 +1243,7 @@ void debug_cpu_trace(const device_config *device, FILE *file, int trace_over, co info->trace.trace_over_target = ~0; if (action != NULL) { - info->trace.action = (char *)malloc_or_die(strlen(action) + 1); + info->trace.action = alloc_array_or_die(char, strlen(action) + 1); strcpy(info->trace.action, action); } @@ -1313,7 +1311,7 @@ int debug_cpu_hotspot_track(const device_config *device, int numspots, int thres if (numspots > 0) { /* allocate memory for hotspots */ - info->hotspots = (debug_hotspot_entry *)malloc_or_die(sizeof(*info->hotspots) * numspots); + info->hotspots = alloc_array_or_die(debug_hotspot_entry, numspots); memset(info->hotspots, 0xff, sizeof(*info->hotspots) * numspots); /* fill in the info */ diff --git a/src/emu/debug/debugvw.c b/src/emu/debug/debugvw.c index 9ee2cd06faa..765990a985d 100644 --- a/src/emu/debug/debugvw.c +++ b/src/emu/debug/debugvw.c @@ -342,8 +342,7 @@ void debug_view_init(running_machine *machine) debugvw_private *global; /* allocate memory for our globals */ - global = machine->debugvw_data = (debugvw_private *)auto_malloc(sizeof(*machine->debugvw_data)); - memset(global, 0, sizeof(*global)); + global = machine->debugvw_data = auto_alloc_clear(machine, debugvw_private); /* register for some manual cleanup */ add_exit_callback(machine, debug_view_exit); @@ -1053,8 +1052,7 @@ static const registers_subview_item *registers_view_enumerate_subviews(running_m /* determine the string and allocate a subview large enough */ astring_printf(tempstring, "CPU '%s' (%s)", cpu->tag, cpu_get_name(cpu)); - subview = (registers_subview_item *)auto_malloc(sizeof(*subview) + astring_len(tempstring)); - memset(subview, 0, sizeof(*subview)); + subview = (registers_subview_item *)auto_alloc_array_clear(machine, UINT8, sizeof(*subview) + astring_len(tempstring)); /* populate the subview */ subview->next = NULL; @@ -1523,8 +1521,7 @@ static const disasm_subview_item *disasm_view_enumerate_subviews(running_machine /* determine the string and allocate a subview large enough */ astring_printf(tempstring, "CPU '%s' (%s)", cpu->tag, cpu_get_name(cpu)); - subview = (disasm_subview_item *)auto_malloc(sizeof(*subview) + astring_len(tempstring)); - memset(subview, 0, sizeof(*subview)); + subview = (disasm_subview_item *)auto_alloc_array_clear(machine, UINT8, sizeof(*subview) + astring_len(tempstring)); /* populate the subview */ subview->next = NULL; @@ -1881,12 +1878,12 @@ static int disasm_view_recompute(debug_view *view, offs_t pc, int startline, int /* allocate address array */ if (dasmdata->byteaddress != NULL) free(dasmdata->byteaddress); - dasmdata->byteaddress = (offs_t *)malloc_or_die(sizeof(dasmdata->byteaddress[0]) * dasmdata->allocated.y); + dasmdata->byteaddress = alloc_array_or_die(offs_t, dasmdata->allocated.y); /* allocate disassembly buffer */ if (dasmdata->dasm != NULL) free(dasmdata->dasm); - dasmdata->dasm = (char *)malloc_or_die(sizeof(dasmdata->dasm[0]) * dasmdata->allocated.x * dasmdata->allocated.y); + dasmdata->dasm = alloc_array_or_die(char, dasmdata->allocated.x * dasmdata->allocated.y); } /* iterate over lines */ @@ -2446,8 +2443,7 @@ static const memory_subview_item *memory_view_enumerate_subviews(running_machine /* determine the string and allocate a subview large enough */ astring_printf(tempstring, "CPU '%s' (%s) %s memory", cpu->tag, cpu_get_name(cpu), space->name); - subview = (memory_subview_item *)auto_malloc(sizeof(*subview) + astring_len(tempstring)); - memset(subview, 0, sizeof(*subview)); + subview = (memory_subview_item *)auto_alloc_array_clear(machine, UINT8, sizeof(*subview) + astring_len(tempstring)); /* populate the subview */ subview->next = NULL; @@ -2476,8 +2472,7 @@ static const memory_subview_item *memory_view_enumerate_subviews(running_machine /* determine the string and allocate a subview large enough */ astring_printf(tempstring, "Region '%s'", rgntag); - subview = (memory_subview_item *)auto_malloc(sizeof(*subview) + astring_len(tempstring)); - memset(subview, 0, sizeof(*subview)); + subview = (memory_subview_item *)auto_alloc_array_clear(machine, UINT8, sizeof(*subview) + astring_len(tempstring)); /* populate the subview */ subview->next = NULL; @@ -2514,8 +2509,7 @@ static const memory_subview_item *memory_view_enumerate_subviews(running_machine /* determine the string and allocate a subview large enough */ astring_printf(tempstring, "%s", strrchr(name, '/') + 1); - subview = (memory_subview_item *)auto_malloc(sizeof(*subview) + astring_len(tempstring)); - memset(subview, 0, sizeof(*subview)); + subview = (memory_subview_item *)auto_alloc_array_clear(machine, UINT8, sizeof(*subview) + astring_len(tempstring)); /* populate the subview */ subview->next = NULL; diff --git a/src/emu/debugger.c b/src/emu/debugger.c index a6541e5237a..3e8625bd03e 100644 --- a/src/emu/debugger.c +++ b/src/emu/debugger.c @@ -75,7 +75,7 @@ void debugger_init(running_machine *machine) /* allocate a new entry for our global list */ add_exit_callback(machine, debugger_exit); - entry = (machine_entry *)malloc_or_die(sizeof(*entry)); + entry = alloc_or_die(machine_entry); entry->next = machine_list; entry->machine = machine; machine_list = entry; diff --git a/src/emu/devintrf.c b/src/emu/devintrf.c index f9daef51023..e362660628f 100644 --- a/src/emu/devintrf.c +++ b/src/emu/devintrf.c @@ -111,7 +111,7 @@ device_config *device_list_add(device_config **listheadptr, const device_config configlen = (UINT32)devtype_get_info_int(type, DEVINFO_INT_INLINE_CONFIG_BYTES); /* allocate a new device */ - device = (device_config *)malloc_or_die(sizeof(*device) + strlen(tag) + configlen); + device = (device_config *)alloc_array_or_die(UINT8, sizeof(*device) + strlen(tag) + configlen); /* populate device relationships */ device->next = NULL; @@ -554,8 +554,7 @@ void device_list_start(running_machine *machine) fatalerror("Device %s specifies a 0 token length!\n", device_get_name(device)); /* allocate memory for the token */ - device->token = malloc_or_die(device->tokenbytes); - memset(device->token, 0, device->tokenbytes); + device->token = alloc_array_clear_or_die(UINT8, device->tokenbytes); /* fill in the remaining runtime fields */ device->execute = (device_execute_func)device_get_info_fct(device, DEVINFO_FCT_EXECUTE); diff --git a/src/emu/drawgfx.c b/src/emu/drawgfx.c index 732f5fa9523..70332549135 100644 --- a/src/emu/drawgfx.c +++ b/src/emu/drawgfx.c @@ -90,8 +90,7 @@ gfx_element *gfx_element_alloc(running_machine *machine, const gfx_layout *gl, c gfx_element *gfx; /* allocate memory for the gfx_element structure */ - gfx = (gfx_element *)malloc_or_die(sizeof(*gfx)); - memset(gfx, 0, sizeof(*gfx)); + gfx = alloc_clear_or_die(gfx_element); /* fill in the data */ gfx->width = width; @@ -120,7 +119,7 @@ gfx_element *gfx_element_alloc(running_machine *machine, const gfx_layout *gl, c } else { - UINT32 *buffer = (UINT32 *)malloc_or_die(sizeof(buffer[0]) * gfx->layout.width); + UINT32 *buffer = alloc_array_or_die(UINT32, gfx->layout.width); memcpy(buffer, gfx->layout.extxoffs, sizeof(gfx->layout.extxoffs[0]) * gfx->layout.width); gfx->layout.extxoffs = buffer; } @@ -135,7 +134,7 @@ gfx_element *gfx_element_alloc(running_machine *machine, const gfx_layout *gl, c } else { - UINT32 *buffer = (UINT32 *)malloc_or_die(sizeof(buffer[0]) * gfx->layout.height); + UINT32 *buffer = alloc_array_or_die(UINT32, gfx->layout.height); memcpy(buffer, gfx->layout.extyoffs, sizeof(gfx->layout.extyoffs[0]) * gfx->layout.height); gfx->layout.extyoffs = buffer; } @@ -143,10 +142,10 @@ gfx_element *gfx_element_alloc(running_machine *machine, const gfx_layout *gl, c /* allocate a pen usage array for entries with 32 pens or less */ if (gfx->color_depth <= 32) - gfx->pen_usage = (UINT32 *)malloc_or_die(gfx->total_elements * sizeof(*gfx->pen_usage)); + gfx->pen_usage = alloc_array_or_die(UINT32, gfx->total_elements); /* allocate a dirty array */ - gfx->dirty = (UINT8 *)malloc_or_die(gfx->total_elements * sizeof(*gfx->dirty)); + gfx->dirty = alloc_array_or_die(UINT8, gfx->total_elements); memset(gfx->dirty, 1, gfx->total_elements * sizeof(*gfx->dirty)); /* raw graphics case */ @@ -173,7 +172,7 @@ gfx_element *gfx_element_alloc(running_machine *machine, const gfx_layout *gl, c gfx->char_modulo = gfx->line_modulo * gfx->origheight; /* allocate memory for the data */ - gfx->gfxdata = (UINT8 *)malloc_or_die(gfx->total_elements * gfx->char_modulo); + gfx->gfxdata = alloc_array_or_die(UINT8, gfx->total_elements * gfx->char_modulo); } return gfx; diff --git a/src/emu/driver.c b/src/emu/driver.c index d28094e66ee..bcd2e7610dd 100644 --- a/src/emu/driver.c +++ b/src/emu/driver.c @@ -114,7 +114,7 @@ void driver_list_get_approx_matches(const game_driver * const driverlist[], cons int shufnum; /* allocate a temporary list */ - templist = (const game_driver **)malloc_or_die(driver_list_get_count(driverlist) * sizeof(*templist)); + templist = alloc_array_or_die(const game_driver *, driver_list_get_count(driverlist)); /* build up a list of valid entries */ for (drvnum = driver_count = 0; driverlist[drvnum] != NULL; drvnum++) @@ -145,7 +145,7 @@ void driver_list_get_approx_matches(const game_driver * const driverlist[], cons } /* allocate some temp memory */ - penalty = (int *)malloc_or_die(matches * sizeof(*penalty)); + penalty = alloc_array_or_die(int, matches); /* initialize everyone's states */ for (matchnum = 0; matchnum < matches; matchnum++) diff --git a/src/emu/emupal.c b/src/emu/emupal.c index 02268a67738..5cb9f9762f7 100644 --- a/src/emu/emupal.c +++ b/src/emu/emupal.c @@ -95,7 +95,7 @@ static void configure_rgb_shadows(running_machine *machine, int mode, float fact void palette_init(running_machine *machine) { - palette_private *palette = (palette_private *)auto_malloc(sizeof(*palette)); + palette_private *palette = auto_alloc_clear(machine, palette_private); const device_config *device = video_screen_first(machine->config); bitmap_format format; @@ -113,7 +113,6 @@ void palette_init(running_machine *machine) add_exit_callback(machine, palette_exit); /* reset all our data */ - memset(palette, 0, sizeof(*palette)); palette->format = format; /* determine the color mode */ @@ -146,8 +145,8 @@ void palette_init(running_machine *machine) /* set up save/restore of the palette */ numcolors = palette_get_num_colors(machine->palette); - palette->save_pen = (pen_t *)auto_malloc(sizeof(*palette->save_pen) * numcolors); - palette->save_bright = (float *)auto_malloc(sizeof(*palette->save_bright) * numcolors); + palette->save_pen = auto_alloc_array(machine, pen_t, numcolors); + palette->save_bright = auto_alloc_array(machine, float, numcolors); state_save_register_global_pointer(machine, palette->save_pen, numcolors); state_save_register_global_pointer(machine, palette->save_bright, numcolors); state_save_register_presave(machine, palette_presave, palette); @@ -330,8 +329,7 @@ colortable_t *colortable_alloc(running_machine *machine, UINT32 palettesize) assert(palettesize > 0); /* allocate the colortable */ - ctable = (colortable_t *)auto_malloc(sizeof(*ctable)); - memset(ctable, 0, sizeof(*ctable)); + ctable = auto_alloc_clear(machine, colortable_t); /* fill in the basics */ ctable->machine = machine; @@ -339,13 +337,13 @@ colortable_t *colortable_alloc(running_machine *machine, UINT32 palettesize) ctable->palentries = palettesize; /* allocate the raw colortable */ - ctable->raw = (UINT16 *)auto_malloc(ctable->entries * sizeof(*ctable->raw)); + ctable->raw = auto_alloc_array(machine, UINT16, ctable->entries); for (index = 0; index < ctable->entries; index++) ctable->raw[index] = index % ctable->palentries; state_save_register_global_pointer(machine, ctable->raw, ctable->entries); /* allocate the palette */ - ctable->palette = (rgb_t *)auto_malloc(ctable->palentries * sizeof(*ctable->palette)); + ctable->palette = auto_alloc_array(machine, rgb_t, ctable->palentries); for (index = 0; index < ctable->palentries; index++) ctable->palette[index] = MAKE_ARGB(0x80,0xff,0xff,0xff); state_save_register_global_pointer(machine, ctable->palette, ctable->palentries); @@ -660,7 +658,7 @@ static void allocate_color_tables(running_machine *machine, palette_private *pal { case BITMAP_FORMAT_INDEXED16: /* create a dummy 1:1 mapping */ - machine->pens = pentable = (pen_t *)auto_malloc((total_colors + 2) * sizeof(machine->pens[0])); + machine->pens = pentable = auto_alloc_array(machine, pen_t, total_colors + 2); for (i = 0; i < total_colors + 2; i++) pentable[i] = i; break; @@ -690,7 +688,7 @@ static void allocate_shadow_tables(running_machine *machine, palette_private *pa /* if we have shadows, allocate shadow tables */ if (machine->config->video_attributes & VIDEO_HAS_SHADOWS) { - pen_t *table = (pen_t *)auto_malloc(65536 * sizeof(*table)); + pen_t *table = auto_alloc_array(machine, pen_t, 65536); int i; /* palettized mode gets a single 64k table in slots 0 and 2 */ @@ -713,7 +711,7 @@ static void allocate_shadow_tables(running_machine *machine, palette_private *pa /* if we have hilights, allocate shadow tables */ if (machine->config->video_attributes & VIDEO_HAS_HIGHLIGHTS) { - pen_t *table = (pen_t *)auto_malloc(65536 * sizeof(*table)); + pen_t *table = auto_alloc_array(machine, pen_t, 65536); int i; /* palettized mode gets a single 64k table in slots 1 and 3 */ diff --git a/src/emu/inptport.c b/src/emu/inptport.c index ec95895acc7..c3b05cf5a7f 100644 --- a/src/emu/inptport.c +++ b/src/emu/inptport.c @@ -630,8 +630,7 @@ time_t input_port_init(running_machine *machine, const input_port_token *tokens) time_t basetime; /* allocate memory for our data structure */ - machine->input_port_data = (input_port_private *)auto_malloc(sizeof(*machine->input_port_data)); - memset(machine->input_port_data, 0, sizeof(*machine->input_port_data)); + machine->input_port_data = auto_alloc_clear(machine, input_port_private); portdata = machine->input_port_data; /* add an exit callback and a frame callback */ @@ -1506,8 +1505,7 @@ static void init_port_types(running_machine *machine) for (typenum = 0; typenum < ARRAY_LENGTH(core_types); typenum++) { /* allocate memory for the state and link it to the end of the list */ - *stateptr = (input_type_state *)auto_malloc(sizeof(**stateptr)); - memset(*stateptr, 0, sizeof(**stateptr)); + *stateptr = auto_alloc_clear(machine, input_type_state); /* copy the type description and link the previous description to it */ (*stateptr)->typedesc = core_types[typenum]; @@ -1556,8 +1554,7 @@ static void init_port_state(running_machine *machine) input_port_state *portstate; /* allocate a new input_port_info structure */ - portstate = (input_port_state *)auto_malloc(sizeof(*portstate)); - memset(portstate, 0, sizeof(*portstate)); + portstate = auto_alloc_clear(machine, input_port_state); ((input_port_config *)port)->state = portstate; ((input_port_config *)port)->machine = machine; @@ -1573,8 +1570,7 @@ static void init_port_state(running_machine *machine) int seqtype; /* allocate a new input_field_info structure */ - fieldstate = (input_field_state *)auto_malloc(sizeof(*fieldstate)); - memset(fieldstate, 0, sizeof(*fieldstate)); + fieldstate = auto_alloc_clear(machine, input_field_state); ((input_field_config *)field)->state = fieldstate; /* fill in the basic values */ @@ -1619,7 +1615,7 @@ static void init_port_state(running_machine *machine) astring *name = mess_get_keyboard_key_name(field); if (name != NULL) { - field->state->name = auto_strdup(astring_c(name)); + field->state->name = auto_strdup(machine, astring_c(name)); astring_free(name); } } @@ -1720,8 +1716,7 @@ static callback_field_info *init_field_callback_info(const input_field_config *f input_port_value mask; /* allocate memory */ - info = (callback_field_info *)auto_malloc(sizeof(*info)); - memset(info, 0, sizeof(*info)); + info = auto_alloc_clear(field->port->machine, callback_field_info); /* fill in the data */ info->field = field; @@ -1743,8 +1738,7 @@ static analog_field_state *init_field_analog_state(const input_field_config *fie input_port_value mask; /* allocate memory */ - state = (analog_field_state *)auto_malloc(sizeof(*state)); - memset(state, 0, sizeof(*state)); + state = auto_alloc_clear(field->port->machine, analog_field_state); /* compute the shift amount and number of bits */ for (mask = field->mask; !(mask & 1); mask >>= 1) @@ -2958,8 +2952,7 @@ static input_port_config *port_config_alloc(const input_port_config **listhead) input_port_config *config; /* allocate memory */ - config = (input_port_config *)malloc_or_die(sizeof(*config)); - memset(config, 0, sizeof(*config)); + config = alloc_clear_or_die(input_port_config); /* add it to the tail */ for (tailptr = listhead; *tailptr != NULL; tailptr = &(*tailptr)->next) ; @@ -3020,8 +3013,7 @@ static input_field_config *field_config_alloc(input_port_config *port, int type, int seqtype; /* allocate memory */ - config = (input_field_config *)malloc_or_die(sizeof(*config)); - memset(config, 0, sizeof(*config)); + config = alloc_clear_or_die(input_field_config); /* fill in the basic field values */ config->port = port; @@ -3128,8 +3120,7 @@ static input_setting_config *setting_config_alloc(input_field_config *field, inp input_setting_config *config; /* allocate memory */ - config = (input_setting_config *)malloc_or_die(sizeof(*config)); - memset(config, 0, sizeof(*config)); + config = alloc_clear_or_die(input_setting_config); /* fill in the basic setting values */ config->field = field; @@ -3188,8 +3179,7 @@ static const input_field_diplocation *diplocation_list_alloc(const input_field_c const char *comma, *colon, *number; /* allocate a new entry */ - *tailptr = (input_field_diplocation *)malloc_or_die(sizeof(**tailptr)); - memset(*tailptr, 0, sizeof(**tailptr)); + *tailptr = alloc_clear_or_die(input_field_diplocation); entries++; /* find the end of this entry */ @@ -3208,7 +3198,7 @@ static const input_field_diplocation *diplocation_list_alloc(const input_field_c /* allocate and copy the name if it is present */ if (colon != NULL) { - (*tailptr)->swname = lastname = (char *)malloc_or_die(colon - tempbuf + 1); + (*tailptr)->swname = lastname = alloc_array_or_die(char, colon - tempbuf + 1); strncpy(lastname, tempbuf, colon - tempbuf); lastname[colon - tempbuf] = 0; number = colon + 1; @@ -3223,7 +3213,7 @@ static const input_field_diplocation *diplocation_list_alloc(const input_field_c error_buf_append(errorbuf, errorbuflen, "Switch location '%s' missing switch name!\n", location); lastname = (char *)"UNK"; } - (*tailptr)->swname = namecopy = (char *)malloc_or_die(strlen(lastname) + 1); + (*tailptr)->swname = namecopy = alloc_array_or_die(char, strlen(lastname) + 1); strcpy(namecopy, lastname); } @@ -3455,8 +3445,8 @@ static void load_remap_table(running_machine *machine, xml_data_node *parentnode int remapnum; /* allocate tables */ - oldtable = (input_code *)malloc_or_die(count * sizeof(*oldtable)); - newtable = (input_code *)malloc_or_die(count * sizeof(*newtable)); + oldtable = alloc_array_or_die(input_code, count); + newtable = alloc_array_or_die(input_code, count); /* build up the remap table */ count = 0; diff --git a/src/emu/input.c b/src/emu/input.c index b50e51d415f..536b0b2a063 100644 --- a/src/emu/input.c +++ b/src/emu/input.c @@ -731,13 +731,13 @@ input_device *input_device_add(running_machine *machine, input_device_class devc assert(devclass != DEVICE_CLASS_INVALID && devclass < DEVICE_CLASS_MAXIMUM); /* allocate a new device */ - devlist->list = (input_device *)auto_realloc(devlist->list, (devlist->count + 1) * sizeof(devlist->list[0])); + devlist->list = auto_extend_array(machine, devlist->list, input_device, devlist->count + 1); device = &devlist->list[devlist->count++]; memset(device, 0, sizeof(*device)); /* fill in the data */ device->machine = machine; - device->name = astring_cpyc(auto_astring_alloc(), name); + device->name = astring_cpyc(auto_astring_alloc(machine), name); device->devclass = devclass; device->devindex = devlist->count - 1; device->internal = internal; @@ -780,15 +780,14 @@ void input_device_item_add(input_device *device, const char *name, void *interna assert(device->item[itemid] == NULL); /* allocate a new item and copy data into it */ - item = (input_device_item *)auto_malloc(sizeof(*item)); - memset(item, 0, sizeof(*item)); + item = auto_alloc_clear(device->machine, input_device_item); device->item[itemid] = item; device->maxitem = MAX(device->maxitem, itemid); /* copy in the data passed in from the item list */ item->devclass = device->devclass; item->devindex = device->devindex; - item->name = astring_cpyc(auto_astring_alloc(), name); + item->name = astring_cpyc(auto_astring_alloc(device->machine), name); item->token = NULL; item->internal = internal; item->itemclass = input_item_standard_class(device->devclass, itemid_std); @@ -799,7 +798,7 @@ void input_device_item_add(input_device *device, const char *name, void *interna if (itemid > ITEM_ID_MAXIMUM) { /* copy the item name, removing spaces/underscores and making all caps */ - item->token = astring_toupper(astring_cpyc(auto_astring_alloc(), name)); + item->token = astring_toupper(astring_cpyc(auto_astring_alloc(device->machine), name)); astring_delchr(item->token, ' '); astring_delchr(item->token, '_'); } diff --git a/src/emu/inputseq.c b/src/emu/inputseq.c index b136ea4b8f8..e2f481bfaa2 100644 --- a/src/emu/inputseq.c +++ b/src/emu/inputseq.c @@ -511,7 +511,7 @@ astring *input_seq_to_tokens(astring *string, const input_seq *seq) int input_seq_from_tokens(const char *string, input_seq *seq) { - char *strcopy = (char *)malloc_or_die(strlen(string) + 1); + char *strcopy = alloc_array_or_die(char, strlen(string) + 1); char *str = strcopy; int result = FALSE; diff --git a/src/emu/machine/at28c16.c b/src/emu/machine/at28c16.c index 9c22e5a8f24..c2fa87dd5c6 100644 --- a/src/emu/machine/at28c16.c +++ b/src/emu/machine/at28c16.c @@ -137,8 +137,8 @@ static DEVICE_START(at28c16) assert(device->machine != NULL); assert(device->machine->config != NULL); - c->data = (UINT8 *)auto_malloc( SIZE_DATA ); - c->id = (UINT8 *)auto_malloc( SIZE_ID ); + c->data = auto_alloc_array( device->machine, UINT8, SIZE_DATA ); + c->id = auto_alloc_array( device->machine, UINT8, SIZE_ID ); c->a9_12v = 0; c->oe_12v = 0; c->last_write = -1; diff --git a/src/emu/machine/i2cmem.c b/src/emu/machine/i2cmem.c index 43cb3ca0ed1..8450ed311ca 100644 --- a/src/emu/machine/i2cmem.c +++ b/src/emu/machine/i2cmem.c @@ -53,9 +53,9 @@ struct i2cmem_chip int shift; int devsel; int byteaddr; - unsigned char *data; + UINT8 *data; int data_size; - unsigned char *page; + UINT8 *page; int page_offset; int page_size; }; @@ -71,10 +71,10 @@ struct i2cmem_chip static struct i2cmem_chip i2cmem[ I2CMEM_MAXCHIP ]; -void i2cmem_init( running_machine *machine, int chip, int slave_address, int page_size, int data_size, unsigned char *data ) +void i2cmem_init( running_machine *machine, int chip, int slave_address, int page_size, int data_size, UINT8 *data ) { struct i2cmem_chip *c; - unsigned char *page = NULL; + UINT8 *page = NULL; if( chip >= I2CMEM_MAXCHIP ) { @@ -86,12 +86,12 @@ void i2cmem_init( running_machine *machine, int chip, int slave_address, int pag if( data == NULL ) { - data = (unsigned char *)auto_malloc( data_size ); + data = auto_alloc_array( machine, UINT8, data_size ); } if( page_size > 0 ) { - page = (unsigned char *)auto_malloc( page_size ); + page = auto_alloc_array( machine, UINT8, page_size ); } c->slave_address = slave_address; diff --git a/src/emu/machine/i2cmemdev.c b/src/emu/machine/i2cmemdev.c index be0ae9bb6bb..9485b405956 100644 --- a/src/emu/machine/i2cmemdev.c +++ b/src/emu/machine/i2cmemdev.c @@ -393,12 +393,11 @@ static DEVICE_START( i2cmem ) if( config != NULL ) { - c->data = auto_malloc( config->data_size ); - if( config->data != NULL ) - memcpy(c->data, config->data, config->data_size); + c->data = auto_alloc_array( device->machine, UINT8, config->data_size ); + memcpy(c->data, config->data, config->data_size); if( config->page_size > 0 ) - page = auto_malloc( config->page_size ); + page = auto_alloc_array( device->machine, UINT8, config->page_size ); c->slave_address = config->slave_address; c->data_size = config->data_size; diff --git a/src/emu/machine/intelfsh.c b/src/emu/machine/intelfsh.c index 7014b011bb9..2f4bfba1a46 100644 --- a/src/emu/machine/intelfsh.c +++ b/src/emu/machine/intelfsh.c @@ -125,7 +125,7 @@ void intelflash_init(running_machine *machine, int chip, int type, void *data) } if( data == NULL ) { - data = auto_malloc( c->size ); + data = auto_alloc_array( machine, UINT8, c->size ); memset( data, 0xff, c->size ); } diff --git a/src/emu/machine/ldcore.c b/src/emu/machine/ldcore.c index 43540d24062..ded391e0642 100644 --- a/src/emu/machine/ldcore.c +++ b/src/emu/machine/ldcore.c @@ -1349,7 +1349,7 @@ static void init_disc(const device_config *device) ldcore->chdtracks = totalhunks / 2; /* allocate memory for the precomputed per-frame metadata */ - ldcore->vbidata = (UINT8 *)auto_malloc(totalhunks * VBI_PACKED_BYTES); + ldcore->vbidata = auto_alloc_array(device->machine, UINT8, totalhunks * VBI_PACKED_BYTES); err = chd_get_metadata(ldcore->disc, AV_LD_METADATA_TAG, 0, ldcore->vbidata, totalhunks * VBI_PACKED_BYTES, &vbilength, NULL, NULL); if (err != CHDERR_NONE || vbilength != totalhunks * VBI_PACKED_BYTES) fatalerror("Precomputed VBI metadata missing or incorrect size"); @@ -1378,11 +1378,11 @@ static void init_video(const device_config *device) frame_data *frame = &ldcore->frame[index]; /* first allocate a YUY16 bitmap at 2x the height */ - frame->bitmap = auto_bitmap_alloc(ldcore->width, ldcore->height * 2, BITMAP_FORMAT_YUY16); + frame->bitmap = auto_bitmap_alloc(device->machine, ldcore->width, ldcore->height * 2, BITMAP_FORMAT_YUY16); fillbitmap_yuy16(frame->bitmap, 40, 109, 240); /* make a copy of the bitmap that clips out the VBI and horizontal blanking areas */ - frame->visbitmap = (bitmap_t *)auto_malloc(sizeof(*frame->visbitmap)); + frame->visbitmap = auto_alloc(device->machine, bitmap_t); *frame->visbitmap = *frame->bitmap; frame->visbitmap->base = BITMAP_ADDR16(frame->visbitmap, 44, frame->bitmap->width * 8 / 720); frame->visbitmap->height -= 44; @@ -1390,7 +1390,7 @@ static void init_video(const device_config *device) } /* allocate an empty frame of the same size */ - ldcore->emptyframe = auto_bitmap_alloc(ldcore->width, ldcore->height * 2, BITMAP_FORMAT_YUY16); + ldcore->emptyframe = auto_bitmap_alloc(device->machine, ldcore->width, ldcore->height * 2, BITMAP_FORMAT_YUY16); fillbitmap_yuy16(ldcore->emptyframe, 0, 128, 128); /* allocate texture for rendering */ @@ -1410,8 +1410,8 @@ static void init_video(const device_config *device) if (ldcore->config.overwidth > 0 && ldcore->config.overheight > 0 && ldcore->config.overupdate != NULL) { ldcore->overenable = TRUE; - ldcore->overbitmap[0] = auto_bitmap_alloc(ldcore->config.overwidth, ldcore->config.overheight, (bitmap_format)ldcore->config.overformat); - ldcore->overbitmap[1] = auto_bitmap_alloc(ldcore->config.overwidth, ldcore->config.overheight, (bitmap_format)ldcore->config.overformat); + ldcore->overbitmap[0] = auto_bitmap_alloc(device->machine, ldcore->config.overwidth, ldcore->config.overheight, (bitmap_format)ldcore->config.overformat); + ldcore->overbitmap[1] = auto_bitmap_alloc(device->machine, ldcore->config.overwidth, ldcore->config.overheight, (bitmap_format)ldcore->config.overformat); ldcore->overtex = render_texture_alloc(NULL, NULL); if (ldcore->overtex == NULL) fatalerror("Out of memory allocating overlay texture"); @@ -1435,8 +1435,8 @@ static void init_audio(const device_config *device) /* allocate audio buffers */ ldcore->audiomaxsamples = ((UINT64)ldcore->samplerate * 1000000 + ldcore->fps_times_1million - 1) / ldcore->fps_times_1million; ldcore->audiobufsize = ldcore->audiomaxsamples * 4; - ldcore->audiobuffer[0] = (INT16 *)auto_malloc(ldcore->audiobufsize * sizeof(ldcore->audiobuffer[0][0])); - ldcore->audiobuffer[1] = (INT16 *)auto_malloc(ldcore->audiobufsize * sizeof(ldcore->audiobuffer[1][0])); + ldcore->audiobuffer[0] = auto_alloc_array(device->machine, INT16, ldcore->audiobufsize); + ldcore->audiobuffer[1] = auto_alloc_array(device->machine, INT16, ldcore->audiobufsize); } @@ -1470,16 +1470,14 @@ static DEVICE_START( laserdisc ) ld->device = device; /* allocate memory for the core state */ - ld->core = (ldcore_data *)auto_malloc(sizeof(*ld->core)); - memset(ld->core, 0, sizeof(*ld->core)); + ld->core = auto_alloc_clear(device->machine, ldcore_data); ldcore = ld->core; /* determine the maximum player-specific state size and allocate it */ statesize = 0; for (index = 0; index < ARRAY_LENGTH(player_interfaces); index++) statesize = MAX(statesize, player_interfaces[index]->statesize); - ld->player = (ldplayer_data *)auto_malloc(statesize); - memset(ld->player, 0, statesize); + ld->player = (ldplayer_data *)auto_alloc_array_clear(device->machine, UINT8, statesize); /* copy config data to the live state */ ldcore->config = *config; diff --git a/src/emu/machine/mc146818.c b/src/emu/machine/mc146818.c index 8099f0ec3b6..938e60b9f16 100644 --- a/src/emu/machine/mc146818.c +++ b/src/emu/machine/mc146818.c @@ -199,8 +199,7 @@ static TIMER_CALLBACK( mc146818_timer ) void mc146818_init(running_machine *machine, MC146818_TYPE type) { - mc146818 = (struct mc146818_chip *)auto_malloc(sizeof(*mc146818)); - memset(mc146818, 0, sizeof(*mc146818)); + mc146818 = auto_alloc_clear(machine, struct mc146818_chip); mc146818->type = type; mc146818->last_refresh = timer_get_time(machine); timer_pulse(machine, ATTOTIME_IN_HZ(1), NULL, 0, mc146818_timer); diff --git a/src/emu/machine/scsi.c b/src/emu/machine/scsi.c index f2ce60f3b72..0c3a9b858de 100644 --- a/src/emu/machine/scsi.c +++ b/src/emu/machine/scsi.c @@ -105,7 +105,7 @@ int SCSIBase( const SCSIClass *scsiClass, int operation, void *file, INT64 intpa SCSIInstance *SCSIMalloc( running_machine *machine, const SCSIClass *scsiClass ) { - SCSIInstance *scsiInstance = (SCSIInstance *) malloc_or_die( SCSISizeof( scsiClass ) ); + SCSIInstance *scsiInstance = alloc_or_die(SCSIInstance); scsiInstance->scsiClass = scsiClass; scsiInstance->machine = machine; return scsiInstance; diff --git a/src/emu/machine/timekpr.c b/src/emu/machine/timekpr.c index f90b578fd74..2a7f8699ed6 100644 --- a/src/emu/machine/timekpr.c +++ b/src/emu/machine/timekpr.c @@ -308,7 +308,7 @@ static DEVICE_START(timekeeper) c->month = make_bcd( systime.local_time.month + 1 ); c->year = make_bcd( systime.local_time.year % 100 ); c->century = make_bcd( systime.local_time.year / 100 ); - c->data = (UINT8 *)auto_malloc( c->size ); + c->data = auto_alloc_array( device->machine, UINT8, c->size ); c->default_data = device->region; if (c->default_data != NULL) diff --git a/src/emu/machine/wd33c93.c b/src/emu/machine/wd33c93.c index df52db848e3..ef570b22ef6 100644 --- a/src/emu/machine/wd33c93.c +++ b/src/emu/machine/wd33c93.c @@ -798,7 +798,7 @@ void wd33c93_init( running_machine *machine, const struct WD33C93interface *inte /* allocate a timer for commands */ scsi_data.cmd_timer = timer_alloc(machine, wd33c93_complete_cb, NULL); - scsi_data.temp_input = (UINT8 *)auto_malloc( TEMP_INPUT_LEN ); + scsi_data.temp_input = auto_alloc_array( machine, UINT8, TEMP_INPUT_LEN ); // state_save_register_item_array(machine, "wd33c93", NULL, 0, scsi_data); } diff --git a/src/emu/machine/x2212.c b/src/emu/machine/x2212.c index 0a1526f07b7..50a1dffeb57 100644 --- a/src/emu/machine/x2212.c +++ b/src/emu/machine/x2212.c @@ -88,8 +88,8 @@ static DEVICE_START(x2212) assert(device->machine != NULL); assert(device->machine->config != NULL); - c->sram = (UINT8 *)auto_malloc( SIZE_DATA ); - c->e2prom = (UINT8 *)auto_malloc( SIZE_DATA ); + c->sram = auto_alloc_array( device->machine, UINT8, SIZE_DATA ); + c->e2prom = auto_alloc_array( device->machine, UINT8, SIZE_DATA ); c->store = 1; c->array_recall = 1; diff --git a/src/emu/machine/x76f041.c b/src/emu/machine/x76f041.c index a4aa5f1e840..fb26eaf74de 100644 --- a/src/emu/machine/x76f041.c +++ b/src/emu/machine/x76f041.c @@ -115,7 +115,7 @@ void x76f041_init( running_machine *machine, int chip, UINT8 *data ) if( data == NULL ) { - data = (UINT8 *)auto_malloc( + data = auto_alloc_array( machine, UINT8, SIZE_RESPONSE_TO_RESET + SIZE_READ_PASSWORD + SIZE_WRITE_PASSWORD + diff --git a/src/emu/machine/x76f100.c b/src/emu/machine/x76f100.c index 33d3089ce98..d355b7c6cac 100644 --- a/src/emu/machine/x76f100.c +++ b/src/emu/machine/x76f100.c @@ -84,7 +84,7 @@ void x76f100_init( running_machine *machine, int chip, UINT8 *data ) if( data == NULL ) { - data = (UINT8 *)auto_malloc( + data = auto_alloc_array( machine, UINT8, SIZE_RESPONSE_TO_RESET + SIZE_READ_PASSWORD + SIZE_WRITE_PASSWORD + diff --git a/src/emu/mame.c b/src/emu/mame.c index 3a7340e55d9..26952ea6a01 100644 --- a/src/emu/mame.c +++ b/src/emu/mame.c @@ -458,7 +458,7 @@ void add_frame_callback(running_machine *machine, void (*callback)(running_machi assert_always(mame_get_phase(machine) == MAME_PHASE_INIT, "Can only call add_frame_callback at init time!"); /* allocate memory */ - cb = (callback_item *)malloc_or_die(sizeof(*cb)); + cb = alloc_or_die(callback_item); /* add us to the end of the list */ cb->func.frame = callback; @@ -481,7 +481,7 @@ void add_reset_callback(running_machine *machine, void (*callback)(running_machi assert_always(mame_get_phase(machine) == MAME_PHASE_INIT, "Can only call add_reset_callback at init time!"); /* allocate memory */ - cb = (callback_item *)malloc_or_die(sizeof(*cb)); + cb = alloc_or_die(callback_item); /* add us to the end of the list */ cb->func.reset = callback; @@ -504,7 +504,7 @@ void add_pause_callback(running_machine *machine, void (*callback)(running_machi assert_always(mame_get_phase(machine) == MAME_PHASE_INIT, "Can only call add_pause_callback at init time!"); /* allocate memory */ - cb = (callback_item *)malloc_or_die(sizeof(*cb)); + cb = alloc_or_die(callback_item); /* add us to the end of the list */ cb->func.pause = callback; @@ -527,7 +527,7 @@ void add_exit_callback(running_machine *machine, void (*callback)(running_machin assert_always(mame_get_phase(machine) == MAME_PHASE_INIT, "Can only call add_exit_callback at init time!"); /* allocate memory */ - cb = (callback_item *)malloc_or_die(sizeof(*cb)); + cb = alloc_or_die(callback_item); /* add us to the head of the list */ cb->func.exit = callback; @@ -782,7 +782,7 @@ UINT8 *memory_region_alloc(running_machine *machine, const char *name, UINT32 le fatalerror("memory_region_alloc called with duplicate region name \"%s\"\n", name); /* allocate the region */ - info = (region_info *)malloc_or_die(sizeof(*info) + length); + info = (region_info *)alloc_array_or_die(UINT8, sizeof(*info) + length); info->next = NULL; info->name = astring_dupc(name); info->length = length; @@ -1247,7 +1247,7 @@ void add_logerror_callback(running_machine *machine, void (*callback)(running_ma assert_always(mame_get_phase(machine) == MAME_PHASE_INIT, "Can only call add_logerror_callback at init time!"); - cb = (callback_item *)auto_malloc(sizeof(*cb)); + cb = auto_alloc(machine, callback_item); cb->func.log = callback; cb->next = NULL; diff --git a/src/emu/mconfig.c b/src/emu/mconfig.c index 4859725550e..a4fe4e41031 100644 --- a/src/emu/mconfig.c +++ b/src/emu/mconfig.c @@ -69,8 +69,7 @@ machine_config *machine_config_alloc(const machine_config_token *tokens) machine_config *config; /* allocate a new configuration object */ - config = (machine_config *)malloc_or_die(sizeof(*config)); - memset(config, 0, sizeof(*config)); + config = alloc_clear_or_die(machine_config); /* parse tokens into the config */ machine_config_detokenize(config, tokens, NULL, 0); diff --git a/src/emu/memory.c b/src/emu/memory.c index d72cfdaecb7..0c8b7232000 100644 --- a/src/emu/memory.c +++ b/src/emu/memory.c @@ -441,7 +441,7 @@ INLINE void add_bank_reference(bank_info *bank, const address_space *space) return; /* allocate a new entry and fill it */ - (*refptr) = (bank_reference *)malloc_or_die(sizeof(**refptr)); + (*refptr) = alloc_or_die(bank_reference); (*refptr)->next = NULL; (*refptr)->space = space; } @@ -712,8 +712,7 @@ void memory_init(running_machine *machine) add_exit_callback(machine, memory_exit); /* allocate our private data */ - memdata = machine->memory_data = (memory_private *)auto_malloc(sizeof(*machine->memory_data)); - memset(memdata, 0, sizeof(*memdata)); + memdata = machine->memory_data = auto_alloc_clear(machine, memory_private); /* build up the cpudata array with info about all CPUs and address spaces */ memory_init_spaces(machine); @@ -769,8 +768,7 @@ address_map *address_map_alloc(const device_config *device, const game_driver *d const addrmap_token *internal_map; address_map *map; - map = (address_map *)malloc_or_die(sizeof(*map)); - memset(map, 0, sizeof(*map)); + map = alloc_clear_or_die(address_map); /* append the internal CPU map (first so it takes priority) */ internal_map = (const addrmap_token *)device_get_info_ptr(device, CPUINFO_PTR_INTERNAL_MEMORY_MAP + spacenum); @@ -1494,7 +1492,7 @@ static void memory_init_spaces(running_machine *machine) int spacenum; /* create a global watchpoint-filled table */ - memdata->wptable = (UINT8 *)auto_malloc(1 << LEVEL1_BITS); + memdata->wptable = auto_alloc_array(machine, UINT8, 1 << LEVEL1_BITS); memset(memdata->wptable, STATIC_WATCHPOINT, 1 << LEVEL1_BITS); /* loop over CPUs */ @@ -1502,7 +1500,7 @@ static void memory_init_spaces(running_machine *machine) for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++) if (cpu_get_addrbus_width(device, spacenum) > 0) { - address_space *space = (address_space *)malloc_or_die(sizeof(*space)); + address_space *space = alloc_clear_or_die(address_space); int logbits = cpu_get_logaddr_width(device, spacenum); int ashift = cpu_get_addrbus_shift(device, spacenum); int abits = cpu_get_addrbus_width(device, spacenum); @@ -1516,7 +1514,6 @@ static void memory_init_spaces(running_machine *machine) logbits = abits; /* determine the address and data bits */ - memset(space, 0, sizeof(*space)); space->machine = machine; space->cpu = device; space->name = address_space_names[spacenum]; @@ -1536,16 +1533,12 @@ static void memory_init_spaces(running_machine *machine) space->log_unmap = TRUE; /* allocate subtable information; we malloc this manually because it will be realloc'ed */ - space->read.subtable = (subtable_data *)auto_malloc(sizeof(*space->read.subtable) * SUBTABLE_COUNT); - memset(space->read.subtable, 0, sizeof(*space->read.subtable) * SUBTABLE_COUNT); - space->write.subtable = (subtable_data *)auto_malloc(sizeof(*space->write.subtable) * SUBTABLE_COUNT); - memset(space->write.subtable, 0, sizeof(*space->write.subtable) * SUBTABLE_COUNT); + space->read.subtable = auto_alloc_array_clear(machine, subtable_data, SUBTABLE_COUNT); + space->write.subtable = auto_alloc_array_clear(machine, subtable_data, SUBTABLE_COUNT); /* allocate the handler table */ - space->read.handlers[0] = (handler_data *)auto_malloc(sizeof(*space->read.handlers[0]) * ARRAY_LENGTH(space->read.handlers)); - memset(space->read.handlers[0], 0, sizeof(*space->read.handlers[0]) * ARRAY_LENGTH(space->read.handlers)); - space->write.handlers[0] = (handler_data *)auto_malloc(sizeof(*space->write.handlers[0]) * ARRAY_LENGTH(space->write.handlers)); - memset(space->write.handlers[0], 0, sizeof(*space->write.handlers[0]) * ARRAY_LENGTH(space->write.handlers)); + space->read.handlers[0] = auto_alloc_array_clear(machine, handler_data, ARRAY_LENGTH(space->read.handlers)); + space->write.handlers[0] = auto_alloc_array_clear(machine, handler_data, ARRAY_LENGTH(space->write.handlers)); for (entrynum = 1; entrynum < ARRAY_LENGTH(space->read.handlers); entrynum++) { space->read.handlers[entrynum] = space->read.handlers[0] + entrynum; @@ -1568,8 +1561,8 @@ static void memory_init_spaces(running_machine *machine) space->write.handlers[STATIC_WATCHPOINT]->bytemask = ~0; /* allocate memory; these aren't auto-malloc'ed as we need to expand them */ - space->read.table = (UINT8 *)malloc_or_die(1 << LEVEL1_BITS); - space->write.table = (UINT8 *)malloc_or_die(1 << LEVEL1_BITS); + space->read.table = alloc_array_or_die(UINT8, 1 << LEVEL1_BITS); + space->write.table = alloc_array_or_die(UINT8, 1 << LEVEL1_BITS); /* initialize everything to unmapped */ memset(space->read.table, STATIC_UNMAP, 1 << LEVEL1_BITS); @@ -2059,9 +2052,8 @@ static void map_detokenize(address_map *map, const game_driver *driver, const ch /* start a new range */ case ADDRMAP_TOKEN_RANGE: - entry = *entryptr = (address_map_entry *)malloc_or_die(sizeof(**entryptr)); + entry = *entryptr = alloc_clear_or_die(address_map_entry); entryptr = &entry->next; - memset(entry, 0, sizeof(*entry)); TOKEN_GET_UINT64_UNPACK2(tokens, entry->addrstart, 32, entry->addrend, 32); break; @@ -3030,7 +3022,7 @@ static direct_range *direct_range_find(address_space *space, offs_t byteaddress, if (range != NULL) space->direct.freerangelist = range->next; else - range = (direct_range *)malloc_or_die(sizeof(*range)); + range = alloc_or_die(direct_range); /* fill in the range */ table_derive_range(&space->read, byteaddress, &range->bytestart, &range->byteend); @@ -3102,8 +3094,7 @@ static void *block_allocate(const address_space *space, offs_t bytestart, offs_t bytestoalloc += byteend - bytestart + 1; /* allocate and clear the memory */ - block = (memory_block *)malloc_or_die(bytestoalloc); - memset(block, 0, bytestoalloc); + block = (memory_block *)alloc_array_clear_or_die(UINT8, bytestoalloc); if (allocatemem) memory = block + 1; diff --git a/src/emu/memory.h b/src/emu/memory.h index 94e6e1a6a44..d2d1208b50c 100644 --- a/src/emu/memory.h +++ b/src/emu/memory.h @@ -443,38 +443,6 @@ union _addrmap64_token #define SMH_NOP ((void *)STATIC_NOP) #define SMH_UNMAP ((void *)STATIC_UNMAP) #define SMH_BANK(n) ((void *)(STATIC_BANK1 + (n) - 1)) -#define SMH_BANK1 SMH_BANK(1) -#define SMH_BANK2 SMH_BANK(2) -#define SMH_BANK3 SMH_BANK(3) -#define SMH_BANK4 SMH_BANK(4) -#define SMH_BANK5 SMH_BANK(5) -#define SMH_BANK6 SMH_BANK(6) -#define SMH_BANK7 SMH_BANK(7) -#define SMH_BANK8 SMH_BANK(8) -#define SMH_BANK9 SMH_BANK(9) -#define SMH_BANK10 SMH_BANK(10) -#define SMH_BANK11 SMH_BANK(11) -#define SMH_BANK12 SMH_BANK(12) -#define SMH_BANK13 SMH_BANK(13) -#define SMH_BANK14 SMH_BANK(14) -#define SMH_BANK15 SMH_BANK(15) -#define SMH_BANK16 SMH_BANK(16) -#define SMH_BANK17 SMH_BANK(17) -#define SMH_BANK18 SMH_BANK(18) -#define SMH_BANK19 SMH_BANK(19) -#define SMH_BANK20 SMH_BANK(20) -#define SMH_BANK21 SMH_BANK(21) -#define SMH_BANK22 SMH_BANK(22) -#define SMH_BANK23 SMH_BANK(23) -#define SMH_BANK24 SMH_BANK(24) -#define SMH_BANK25 SMH_BANK(25) -#define SMH_BANK26 SMH_BANK(26) -#define SMH_BANK27 SMH_BANK(27) -#define SMH_BANK28 SMH_BANK(28) -#define SMH_BANK29 SMH_BANK(29) -#define SMH_BANK30 SMH_BANK(30) -#define SMH_BANK31 SMH_BANK(31) -#define SMH_BANK32 SMH_BANK(32) /* helper macro for merging data with the memory mask */ diff --git a/src/emu/output.c b/src/emu/output.c index beb3dde3c7b..ae5ff296379 100644 --- a/src/emu/output.c +++ b/src/emu/output.c @@ -78,7 +78,7 @@ static void output_exit(running_machine *machine); INLINE const char *copy_string(const char *string) { - char *newstring = (char *)malloc_or_die(strlen(string) + 1); + char *newstring = alloc_array_or_die(char, strlen(string) + 1); strcpy(newstring, string); return newstring; } @@ -118,7 +118,7 @@ INLINE output_item *find_item(const char *string) INLINE output_item *create_new_item(const char *outname, INT32 value) { - output_item *item = (output_item *)malloc_or_die(sizeof(*item)); + output_item *item = alloc_or_die(output_item); UINT32 hash = get_hash(outname); /* fill in the data */ @@ -343,7 +343,7 @@ void output_set_notifier(const char *outname, output_notifier_func callback, voi /* find the end of the list and add to it */ while (*headptr != NULL) headptr = &(*headptr)->next; - *headptr = (output_notify *)malloc_or_die(sizeof(**headptr)); + *headptr = alloc_or_die(output_notify); /* fill in the new record */ (*headptr)->next = NULL; diff --git a/src/emu/render.c b/src/emu/render.c index 984e8f5e522..a791a824575 100644 --- a/src/emu/render.c +++ b/src/emu/render.c @@ -343,7 +343,7 @@ INLINE container_item *alloc_container_item(void) if (result != NULL) container_item_free_list = result->next; else - result = (container_item *)malloc_or_die(sizeof(*result)); + result = alloc_or_die(container_item); memset(result, 0, sizeof(*result)); return result; @@ -375,7 +375,7 @@ INLINE render_primitive *alloc_render_primitive(int type) if (result != NULL) render_primitive_free_list = result->next; else - result = (render_primitive *)malloc_or_die(sizeof(*result)); + result = alloc_or_die(render_primitive); /* clear to 0 */ memset(result, 0, sizeof(*result)); @@ -426,7 +426,7 @@ INLINE void add_render_ref(render_ref **list, void *refptr) if (ref != NULL) render_ref_free_list = ref->next; else - ref = (render_ref *)malloc_or_die(sizeof(*ref)); + ref = alloc_or_die(render_ref); /* set the refptr and link us into the list */ ref->refptr = refptr; @@ -1073,8 +1073,7 @@ render_target *render_target_alloc(running_machine *machine, const char *layoutf int listnum; /* allocate memory for the target */ - target = (render_target *)malloc_or_die(sizeof(*target)); - memset(target, 0, sizeof(*target)); + target = alloc_clear_or_die(render_target); /* add it to the end of the list */ for (nextptr = &targetlist; *nextptr != NULL; nextptr = &(*nextptr)->next) ; @@ -2433,8 +2432,7 @@ render_texture *render_texture_alloc(texture_scaler_func scaler, void *param) int texnum; /* allocate a new group */ - texture = (render_texture *)malloc_or_die(sizeof(*texture) * TEXTURE_GROUP_SIZE); - memset(texture, 0, sizeof(*texture) * TEXTURE_GROUP_SIZE); + texture = alloc_array_clear_or_die(render_texture, TEXTURE_GROUP_SIZE); /* add them to the list */ for (texnum = 0; texnum < TEXTURE_GROUP_SIZE; texnum++) @@ -2770,8 +2768,7 @@ static render_container *render_container_alloc(running_machine *machine) int color; /* allocate and clear memory */ - container = (render_container *)malloc_or_die(sizeof(*container)); - memset(container, 0, sizeof(*container)); + container = alloc_clear_or_die(render_container); /* default values */ container->brightness = 1.0f; diff --git a/src/emu/rendfont.c b/src/emu/rendfont.c index eab3f5d572d..bceeadb170e 100644 --- a/src/emu/rendfont.c +++ b/src/emu/rendfont.c @@ -141,8 +141,7 @@ render_font *render_font_alloc(const char *filename) render_font *font; /* allocate and clear memory */ - font = (render_font *)malloc_or_die(sizeof(*font)); - memset(font, 0, sizeof(*font)); + font = alloc_clear_or_die(render_font); /* attempt to load the cached version of the font first */ if (filename != NULL && render_font_load_cached_bdf(font, filename) == 0) @@ -150,8 +149,7 @@ render_font *render_font_alloc(const char *filename) /* if we failed, clean up and realloc */ render_font_free(font); - font = (render_font *)malloc_or_die(sizeof(*font)); - memset(font, 0, sizeof(*font)); + font = alloc_clear_or_die(render_font); /* load the raw data instead */ filerr = mame_fopen_ram(font_uismall, sizeof(font_uismall), OPEN_FLAG_READ, &ramfile); @@ -434,7 +432,7 @@ static int render_font_load_cached_bdf(render_font *font, const char *filename) /* determine the file size and allocate memory */ font->rawsize = mame_fsize(file); - data = (char *)malloc_or_die(font->rawsize + 1); + data = alloc_array_clear_or_die(char, font->rawsize + 1); /* read and hash the first chunk */ bytes = mame_fread(file, data, MIN(CACHED_BDF_HASH_SIZE, font->rawsize)); @@ -583,10 +581,7 @@ static int render_font_load_bdf(render_font *font) /* if we don't have a subtable yet, make one */ if (font->chars[charnum / 256] == NULL) - { - font->chars[charnum / 256] = (render_font_char *)malloc_or_die(256 * sizeof(font->chars[0][0])); - memset(font->chars[charnum / 256], 0, 256 * sizeof(font->chars[0][0])); - } + font->chars[charnum / 256] = alloc_array_clear_or_die(render_font_char, 256); /* fill in the entry */ ch = &font->chars[charnum / 256][charnum % 256]; @@ -642,7 +637,7 @@ static int render_font_load_cached(render_font *font, mame_file *file, UINT32 ha goto error; /* now read the rest of the data */ - data = (UINT8 *)malloc_or_die(filesize - CACHED_HEADER_SIZE); + data = alloc_array_or_die(UINT8, filesize - CACHED_HEADER_SIZE); bytes_read = mame_fread(file, data, filesize - CACHED_HEADER_SIZE); if (bytes_read != filesize - CACHED_HEADER_SIZE) goto error; @@ -657,10 +652,7 @@ static int render_font_load_cached(render_font *font, mame_file *file, UINT32 ha /* if we don't have a subtable yet, make one */ if (font->chars[chnum / 256] == NULL) - { - font->chars[chnum / 256] = (render_font_char *)malloc_or_die(256 * sizeof(font->chars[0][0])); - memset(font->chars[chnum / 256], 0, 256 * sizeof(font->chars[0][0])); - } + font->chars[chnum / 256] = alloc_array_clear_or_die(render_font_char, 256); /* fill in the entry */ ch = &font->chars[chnum / 256][chnum % 256]; @@ -728,11 +720,10 @@ static int render_font_save_cached(render_font *font, const char *filename, UINT } /* allocate an array to hold the character data */ - chartable = (UINT8 *)malloc_or_die(numchars * CACHED_CHAR_SIZE); - memset(chartable, 0, numchars * CACHED_CHAR_SIZE); + chartable = alloc_array_clear_or_die(UINT8, numchars * CACHED_CHAR_SIZE); /* allocate a temp buffer to compress into */ - tempbuffer = (UINT8 *)malloc_or_die(65536); + tempbuffer = alloc_array_or_die(UINT8, 65536); /* write the header */ dest = tempbuffer; diff --git a/src/emu/rendlay.c b/src/emu/rendlay.c index f3b0d0cbf66..5fe1318d89b 100644 --- a/src/emu/rendlay.c +++ b/src/emu/rendlay.c @@ -217,7 +217,7 @@ INLINE void reduce_fraction(int *num, int *den) INLINE const char *copy_string(const char *string) { - char *newstring = (char *)malloc_or_die(strlen(string) + 1); + char *newstring = alloc_array_or_die(char, strlen(string) + 1); strcpy(newstring, string); return newstring; } @@ -1509,8 +1509,7 @@ layout_file *layout_file_load(const machine_config *config, const char *dirname, return NULL; /* allocate the layout group object first */ - file = (layout_file *)malloc_or_die(sizeof(*file)); - memset(file, 0, sizeof(*file)); + file = alloc_clear_or_die(layout_file); /* find the layout node */ mamelayoutnode = xml_get_sibling(rootnode->child, "mamelayout"); @@ -1579,8 +1578,7 @@ static layout_element *load_layout_element(const machine_config *config, xml_dat int first; /* allocate a new element */ - element = (layout_element *)malloc_or_die(sizeof(*element)); - memset(element, 0, sizeof(*element)); + element = alloc_clear_or_die(layout_element); /* extract the name */ name = xml_get_attribute_string_with_subst(config, elemnode, "name", NULL); @@ -1642,7 +1640,7 @@ static layout_element *load_layout_element(const machine_config *config, xml_dat } /* allocate an array of element textures for the states */ - element->elemtex = (element_texture *)malloc_or_die((element->maxstate + 1) * sizeof(element->elemtex[0])); + element->elemtex = alloc_array_or_die(element_texture, element->maxstate + 1); for (state = 0; state <= element->maxstate; state++) { element->elemtex[state].element = element; @@ -1668,8 +1666,7 @@ static element_component *load_element_component(const machine_config *config, x element_component *component; /* allocate memory for the component */ - component = (element_component *)malloc_or_die(sizeof(*component)); - memset(component, 0, sizeof(*component)); + component = alloc_clear_or_die(element_component); /* fetch common data */ component->state = xml_get_attribute_int_with_subst(config, compnode, "state", -1); @@ -1699,7 +1696,7 @@ static element_component *load_element_component(const machine_config *config, x /* allocate a copy of the string */ component->type = COMPONENT_TYPE_TEXT; - string = (char *)malloc_or_die(strlen(text) + 1); + string = alloc_array_or_die(char, strlen(text) + 1); strcpy(string, text); component->string = string; } @@ -1756,8 +1753,7 @@ static layout_view *load_layout_view(const machine_config *config, xml_data_node int layer; /* first allocate memory */ - view = (layout_view *)malloc_or_die(sizeof(*view)); - memset(view, 0, sizeof(*view)); + view = alloc_clear_or_die(layout_view); /* allocate a copy of the name */ view->name = copy_string(xml_get_attribute_string_with_subst(config, viewnode, "name", "")); @@ -1810,8 +1806,7 @@ static view_item *load_view_item(const machine_config *config, xml_data_node *it const char *name; /* allocate a new item */ - item = (view_item *)malloc_or_die(sizeof(*item)); - memset(item, 0, sizeof(*item)); + item = alloc_clear_or_die(view_item); /* allocate a copy of the output name */ item->output_name = copy_string(xml_get_attribute_string_with_subst(config, itemnode, "name", "")); diff --git a/src/emu/restrack.c b/src/emu/restrack.c index 1f899cb5efb..72e3704497f 100644 --- a/src/emu/restrack.c +++ b/src/emu/restrack.c @@ -197,7 +197,7 @@ void *restrack_register_object(object_type type, void *ptr, size_t size, const c freeing memory -------------------------------------------------*/ -void *auto_malloc_file_line(size_t size, const char *file, int line) +void *auto_malloc_file_line(running_machine *machine, size_t size, const char *file, int line) { void *result = pool_malloc_file_line(current_pool(), size, file, line); #ifdef MAME_DEBUG @@ -212,7 +212,7 @@ void *auto_malloc_file_line(size_t size, const char *file, int line) freeing memory -------------------------------------------------*/ -void *auto_realloc_file_line(void *ptr, size_t size, const char *file, int line) +void *auto_realloc_file_line(running_machine *machine, void *ptr, size_t size, const char *file, int line) { object_pool *pool = current_pool(); if (ptr != NULL) @@ -236,7 +236,7 @@ void *auto_realloc_file_line(void *ptr, size_t size, const char *file, int line) string -------------------------------------------------*/ -char *auto_strdup_file_line(const char *str, const char *file, int line) +char *auto_strdup_file_line(running_machine *machine, const char *str, const char *file, int line) { return pool_strdup_file_line(current_pool(), str, file, line); } @@ -247,9 +247,9 @@ char *auto_strdup_file_line(const char *str, const char *file, int line) auto-freeing string if str is null -------------------------------------------------*/ -char *auto_strdup_allow_null_file_line(const char *str, const char *file, int line) +char *auto_strdup_allow_null_file_line(running_machine *machine, const char *str, const char *file, int line) { - return (str != NULL) ? auto_strdup_file_line(str, file, line) : NULL; + return (str != NULL) ? auto_strdup_file_line(machine, str, file, line) : NULL; } @@ -258,7 +258,7 @@ char *auto_strdup_allow_null_file_line(const char *str, const char *file, int li auto-freeing astring -------------------------------------------------*/ -astring *auto_astring_alloc_file_line(const char *file, int line) +astring *auto_astring_alloc_file_line(running_machine *machine, const char *file, int line) { return (astring *)restrack_register_object(OBJTYPE_ASTRING, astring_alloc(), 0, file, line); } @@ -269,7 +269,7 @@ astring *auto_astring_alloc_file_line(const char *file, int line) auto-freeing bitmap -------------------------------------------------*/ -bitmap_t *auto_bitmap_alloc_file_line(int width, int height, bitmap_format format, const char *file, int line) +bitmap_t *auto_bitmap_alloc_file_line(running_machine *machine, int width, int height, bitmap_format format, const char *file, int line) { return (bitmap_t *)restrack_register_object(OBJTYPE_BITMAP, bitmap_alloc(width, height, format), width * height, file, line); } diff --git a/src/emu/restrack.h b/src/emu/restrack.h index 5caf0672644..d62cc0e7a21 100644 --- a/src/emu/restrack.h +++ b/src/emu/restrack.h @@ -59,32 +59,39 @@ INLINE int get_resource_tag(void) /* allocate memory and fatalerror if there's a problem */ -#define malloc_or_die(s) malloc_or_die_file_line(s, __FILE__, __LINE__) +#define alloc_or_die(t) ((t *)malloc_or_die_file_line(sizeof(t), __FILE__, __LINE__)) +#define alloc_clear_or_die(t) ((t *)memset(malloc_or_die_file_line(sizeof(t), __FILE__, __LINE__), 0, sizeof(t))) +#define alloc_array_or_die(t, c) ((t *)malloc_or_die_file_line((c) * sizeof(t), __FILE__, __LINE__)) +#define alloc_array_clear_or_die(t, c) ((t *)memset(malloc_or_die_file_line((c) * sizeof(t), __FILE__, __LINE__), 0, (c) * sizeof(t))) void *malloc_or_die_file_line(size_t size, const char *file, int line) ATTR_MALLOC; + /* allocate memory that will be freed at the next end_resource_tracking */ -#define auto_malloc(s) auto_malloc_file_line(s, __FILE__, __LINE__) -void *auto_malloc_file_line(size_t size, const char *file, int line) ATTR_MALLOC; +#define auto_alloc(m, t) ((t *)auto_malloc_file_line(m, sizeof(t), __FILE__, __LINE__)) +#define auto_alloc_clear(m, t) ((t *)memset(auto_malloc_file_line(m, sizeof(t), __FILE__, __LINE__), 0, sizeof(t))) +#define auto_alloc_array(m, t, c) ((t *)auto_malloc_file_line(m, (c) * sizeof(t), __FILE__, __LINE__)) +#define auto_alloc_array_clear(m, t, c) ((t *)memset(auto_malloc_file_line(m, (c) * sizeof(t), __FILE__, __LINE__), 0, (c) * sizeof(t))) +void *auto_malloc_file_line(running_machine *machine, size_t size, const char *file, int line) ATTR_MALLOC; /* allocate memory that will be freed at the next end_resource_tracking */ -#define auto_realloc(p, s) auto_realloc_file_line(p, s, __FILE__, __LINE__) -void *auto_realloc_file_line(void *ptr, size_t size, const char *file, int line) ATTR_MALLOC; +#define auto_extend_array(m, p, t, c) ((t *)auto_realloc_file_line(m, p, (c) * sizeof(t), __FILE__, __LINE__)) +void *auto_realloc_file_line(running_machine *machine, void *ptr, size_t size, const char *file, int line) ATTR_MALLOC; /* allocate memory and duplicate a string that will be freed at the next end_resource_tracking */ -#define auto_strdup(s) auto_strdup_file_line(s, __FILE__, __LINE__) -char *auto_strdup_file_line(const char *str, const char *file, int line) ATTR_MALLOC; +#define auto_strdup(m, s) auto_strdup_file_line(m, s, __FILE__, __LINE__) +char *auto_strdup_file_line(running_machine *machine, const char *str, const char *file, int line) ATTR_MALLOC; /* auto_strdup() variant that tolerates NULL */ -#define auto_strdup_allow_null(s) auto_strdup_allow_null_file_line(s, __FILE__, __LINE__) -char *auto_strdup_allow_null_file_line(const char *str, const char *file, int line) ATTR_MALLOC; +#define auto_strdup_allow_null(m, s) auto_strdup_allow_null_file_line(m, s, __FILE__, __LINE__) +char *auto_strdup_allow_null_file_line(running_machine *machine, const char *str, const char *file, int line) ATTR_MALLOC; /* allocate a bitmap that will be freed at the next end_resource_tracking */ -#define auto_astring_alloc() auto_astring_alloc_file_line(__FILE__, __LINE__) -astring *auto_astring_alloc_file_line(const char *file, int line); +#define auto_astring_alloc(m) auto_astring_alloc_file_line(m, __FILE__, __LINE__) +astring *auto_astring_alloc_file_line(running_machine *machine, const char *file, int line); /* allocate a bitmap that will be freed at the next end_resource_tracking */ -#define auto_bitmap_alloc(w,h,f) auto_bitmap_alloc_file_line(w, h, f, __FILE__, __LINE__) -bitmap_t *auto_bitmap_alloc_file_line(int width, int height, bitmap_format format, const char *file, int line); +#define auto_bitmap_alloc(m, w, h, f) auto_bitmap_alloc_file_line(m, w, h, f, __FILE__, __LINE__) +bitmap_t *auto_bitmap_alloc_file_line(running_machine *machine, int width, int height, bitmap_format format, const char *file, int line); #endif /* __RESTRACK_H__ */ diff --git a/src/emu/romload.c b/src/emu/romload.c index 140190e4669..49d8330b40d 100644 --- a/src/emu/romload.c +++ b/src/emu/romload.c @@ -115,7 +115,7 @@ chd_file *get_disk_handle(const char *region) file associated with the given region -------------------------------------------------*/ -void set_disk_handle(const char *region, mame_file *file, chd_file *chdfile) +void set_disk_handle(running_machine *machine, const char *region, mame_file *file, chd_file *chdfile) { open_chd chd = { 0 }; @@ -125,7 +125,7 @@ void set_disk_handle(const char *region, mame_file *file, chd_file *chdfile) chd.origfile = file; /* we're okay, add to the list of disks */ - *chd_list_tailptr = (open_chd *)auto_malloc(sizeof(**chd_list_tailptr)); + *chd_list_tailptr = auto_alloc(machine, open_chd); **chd_list_tailptr = chd; chd_list_tailptr = &(*chd_list_tailptr)->next; } @@ -757,7 +757,7 @@ static int read_rom_data(rom_load_data *romdata, const rom_entry *romp) /* use a temporary buffer for complex loads */ tempbufsize = MIN(TEMPBUFFER_MAX_SIZE, numbytes); - tempbuf = (UINT8 *)malloc_or_die(tempbufsize); + tempbuf = alloc_array_or_die(UINT8, tempbufsize); /* chunky reads for complex loads */ skip += groupsize; @@ -1225,7 +1225,7 @@ static void process_disk_entries(rom_load_data *romdata, const char *regiontag, /* we're okay, add to the list of disks */ LOG(("Assigning to handle %d\n", DISK_GETINDEX(romp))); - *chd_list_tailptr = (open_chd *)auto_malloc(sizeof(**chd_list_tailptr)); + *chd_list_tailptr = auto_alloc(romdata->machine, open_chd); **chd_list_tailptr = chd; chd_list_tailptr = &(*chd_list_tailptr)->next; } diff --git a/src/emu/romload.h b/src/emu/romload.h index 9a653ffd9ae..9150cf2faf3 100644 --- a/src/emu/romload.h +++ b/src/emu/romload.h @@ -328,7 +328,7 @@ chd_error open_disk_image_options(core_options *options, const game_driver *game chd_file *get_disk_handle(const char *region); /* set a pointer to the CHD file associated with the given region */ -void set_disk_handle(const char *region, mame_file *file, chd_file *chd); +void set_disk_handle(running_machine *machine, const char *region, mame_file *file, chd_file *chd); #endif /* __ROMLOAD_H__ */ diff --git a/src/emu/sound.c b/src/emu/sound.c index 03ed3fc27f1..9f54ae418c4 100644 --- a/src/emu/sound.c +++ b/src/emu/sound.c @@ -202,9 +202,9 @@ void sound_init(running_machine *machine) VPRINTF(("total speakers = %d\n", speaker_output_count(machine->config))); /* allocate memory for mix buffers */ - leftmix = (INT32 *)auto_malloc(machine->sample_rate * sizeof(*leftmix)); - rightmix = (INT32 *)auto_malloc(machine->sample_rate * sizeof(*rightmix)); - finalmix = (INT16 *)auto_malloc(machine->sample_rate * sizeof(*finalmix)); + leftmix = auto_alloc_array(machine, INT32, machine->sample_rate); + rightmix = auto_alloc_array(machine, INT32, machine->sample_rate); + finalmix = auto_alloc_array(machine, INT16, machine->sample_rate); /* allocate a global timer for sound timing */ sound_update_timer = timer_alloc(machine, sound_update, NULL); @@ -341,7 +341,7 @@ static DEVICE_CUSTOM_CONFIG( sound ) /* allocate a new route */ for (routeptr = &config->routelist; *routeptr != NULL; routeptr = &(*routeptr)->next) ; - *routeptr = (sound_route *)malloc_or_die(sizeof(**routeptr)); + *routeptr = alloc_or_die(sound_route); (*routeptr)->next = NULL; (*routeptr)->output = output; (*routeptr)->input = input; @@ -451,7 +451,7 @@ static void route_sound(running_machine *machine) { info->mixer_stream = stream_create(curspeak, info->inputs, 1, machine->sample_rate, info, mixer_update); state_save_register_postload(machine, mixer_postload, info->mixer_stream); - info->input = (speaker_input *)auto_malloc(info->inputs * sizeof(*info->input)); + info->input = auto_alloc_array(machine, speaker_input, info->inputs); info->inputs = 0; } else @@ -490,7 +490,7 @@ static void route_sound(running_machine *machine) /* fill in the input data on this speaker */ speakerinfo->input[speakerinfo->inputs].gain = route->gain; speakerinfo->input[speakerinfo->inputs].default_gain = route->gain; - speakerinfo->input[speakerinfo->inputs].name = auto_strdup(astring_c(tempstring)); + speakerinfo->input[speakerinfo->inputs].name = auto_strdup(machine, astring_c(tempstring)); /* connect the output to the input */ if (stream_device_output_to_stream_output(sound, outputnum, &stream, &streamoutput)) diff --git a/src/emu/sound/aica.c b/src/emu/sound/aica.c index db4408125a8..0c34fe515e9 100644 --- a/src/emu/sound/aica.c +++ b/src/emu/sound/aica.c @@ -647,10 +647,8 @@ static void AICA_Init(const device_config *device, aica_state *AICA, const aica_ } AICALFO_Init(device->machine); - AICA->buffertmpl=(signed int*) auto_malloc(44100*sizeof(signed int)); - AICA->buffertmpr=(signed int*) auto_malloc(44100*sizeof(signed int)); - memset(AICA->buffertmpl,0,44100*sizeof(signed int)); - memset(AICA->buffertmpr,0,44100*sizeof(signed int)); + AICA->buffertmpl=auto_alloc_array_clear(device->machine, signed int, 44100); + AICA->buffertmpr=auto_alloc_array_clear(device->machine, signed int, 44100); // no "pend" AICA[0].udata.data[0xa0/2] = 0; diff --git a/src/emu/sound/ay8910.c b/src/emu/sound/ay8910.c index 9f1092a11b0..0da96f3ee4d 100644 --- a/src/emu/sound/ay8910.c +++ b/src/emu/sound/ay8910.c @@ -743,10 +743,8 @@ void *ay8910_start_ym(void *infoptr, sound_type chip_type, const device_config * ay8910_context *info = (ay8910_context *)infoptr; if (info == NULL) - { - info = (ay8910_context *)auto_malloc(sizeof(*info)); - memset(info, 0, sizeof(*info)); - } + info = auto_alloc_clear(device->machine, ay8910_context); + info->device = device; info->intf = intf; devcb_resolve_read8(&info->portAread, &intf->portAread, device); diff --git a/src/emu/sound/c140.c b/src/emu/sound/c140.c index 0d258903405..300840e7e04 100644 --- a/src/emu/sound/c140.c +++ b/src/emu/sound/c140.c @@ -496,7 +496,7 @@ static DEVICE_START( c140 ) } /* allocate a pair of buffers to mix into - 1 second's worth should be more than enough */ - info->mixer_buffer_left = (INT16 *)auto_malloc(2 * sizeof(INT16)*info->sample_rate ); + info->mixer_buffer_left = auto_alloc_array(device->machine, INT16, 2 * info->sample_rate); info->mixer_buffer_right = info->mixer_buffer_left + info->sample_rate; } diff --git a/src/emu/sound/cdda.c b/src/emu/sound/cdda.c index 20ba3ec46a4..7c99a6aa766 100644 --- a/src/emu/sound/cdda.c +++ b/src/emu/sound/cdda.c @@ -59,7 +59,7 @@ static DEVICE_START( cdda ) cdda_info *info = get_safe_token(device); /* allocate an audio cache */ - info->audio_cache = (UINT8 *)auto_malloc( CD_MAX_SECTOR_DATA * MAX_SECTORS ); + info->audio_cache = auto_alloc_array( device->machine, UINT8, CD_MAX_SECTOR_DATA * MAX_SECTORS ); intf = (const struct CDDAinterface *)device->static_config; diff --git a/src/emu/sound/cem3394.c b/src/emu/sound/cem3394.c index e3ba18f8d09..f01a02230cf 100644 --- a/src/emu/sound/cem3394.c +++ b/src/emu/sound/cem3394.c @@ -344,8 +344,8 @@ static DEVICE_START( cem3394 ) chip->filter_zero_freq = intf->filter_zero_freq; /* allocate memory for a mixer buffer and external buffer (1 second should do it!) */ - chip->mixer_buffer = (INT16 *)auto_malloc(chip->sample_rate * sizeof(INT16)); - chip->external_buffer = (INT16 *)auto_malloc(chip->sample_rate * sizeof(INT16)); + chip->mixer_buffer = auto_alloc_array(device->machine, INT16, chip->sample_rate); + chip->external_buffer = auto_alloc_array(device->machine, INT16, chip->sample_rate); state_save_register_device_item_array(device, 0, chip->values); state_save_register_device_item(device, 0, chip->wave_select); diff --git a/src/emu/sound/discrete.c b/src/emu/sound/discrete.c index f71bb6b0ccd..b56c4b0523c 100644 --- a/src/emu/sound/discrete.c +++ b/src/emu/sound/discrete.c @@ -292,16 +292,13 @@ static DEVICE_START( discrete ) discrete_log("discrete_start() - Sanity check counted %d nodes", info->node_count); /* allocate memory for the array of actual nodes */ - info->node_list = (node_description *)auto_malloc(info->node_count * sizeof(info->node_list[0])); - memset(info->node_list, 0, info->node_count * sizeof(info->node_list[0])); + info->node_list = auto_alloc_array_clear(device->machine, node_description, info->node_count); /* allocate memory for the node execution order array */ - info->running_order = (node_description **)auto_malloc(info->node_count * sizeof(info->running_order[0])); - memset(info->running_order, 0, info->node_count * sizeof(info->running_order[0])); + info->running_order = auto_alloc_array_clear(device->machine, node_description *, info->node_count); /* allocate memory to hold pointers to nodes by index */ - info->indexed_node = (node_description **)auto_malloc(DISCRETE_MAX_NODES * sizeof(info->indexed_node[0])); - memset(info->indexed_node, 0, DISCRETE_MAX_NODES * sizeof(info->indexed_node[0])); + info->indexed_node = auto_alloc_array_clear(device->machine, node_description *, DISCRETE_MAX_NODES); /* initialize the node data */ init_nodes(info, intf, device); @@ -605,10 +602,7 @@ static void init_nodes(discrete_info *info, discrete_sound_block *block_list, co /* allocate memory if necessary */ if (node->module.contextsize) - { - node->context = auto_malloc(node->module.contextsize); - memset(node->context, 0, node->module.contextsize); - } + node->context = auto_alloc_array_clear(device->machine, UINT8, node->module.contextsize); /* if we are an stream input node, track that */ if (block->type == DSS_INPUT_STREAM) diff --git a/src/emu/sound/dmadac.c b/src/emu/sound/dmadac.c index 1e0e64b068e..9367be43f80 100644 --- a/src/emu/sound/dmadac.c +++ b/src/emu/sound/dmadac.c @@ -106,8 +106,7 @@ static DEVICE_START( dmadac ) dmadac_state *info = get_safe_token(device); /* allocate a clear a buffer */ - info->buffer = (INT16 *)auto_malloc(sizeof(info->buffer[0]) * BUFFER_SIZE); - memset(info->buffer, 0, sizeof(info->buffer[0]) * BUFFER_SIZE); + info->buffer = auto_alloc_array_clear(device->machine, INT16, BUFFER_SIZE); /* reset the state */ info->volume = 0x100; diff --git a/src/emu/sound/es5506.c b/src/emu/sound/es5506.c index a3948c479b3..3d650a68dfb 100644 --- a/src/emu/sound/es5506.c +++ b/src/emu/sound/es5506.c @@ -194,7 +194,7 @@ static void compute_tables(es5506_state *chip) int i; /* allocate ulaw lookup table */ - chip->ulaw_lookup = (INT16 *)auto_malloc(sizeof(chip->ulaw_lookup[0]) << ULAW_MAXBITS); + chip->ulaw_lookup = auto_alloc_array(chip->device->machine, INT16, 1 << ULAW_MAXBITS); /* generate ulaw lookup table */ for (i = 0; i < (1 << ULAW_MAXBITS); i++) @@ -213,7 +213,7 @@ static void compute_tables(es5506_state *chip) } /* allocate volume lookup table */ - chip->volume_lookup = (UINT16 *)auto_malloc(sizeof(chip->volume_lookup[0]) * 4096); + chip->volume_lookup = auto_alloc_array(chip->device->machine, UINT16, 4096); /* generate ulaw lookup table */ for (i = 0; i < 4096; i++) @@ -842,9 +842,6 @@ static void es5506_start_common(const device_config *device, const void *config, if (LOG_COMMANDS && !eslog) eslog = fopen("es.log", "w"); - /* compute the tables */ - compute_tables(chip); - /* create the stream */ chip->stream = stream_create(device, 0, 2, device->clock / (16*32), chip, es5506_update); @@ -860,6 +857,9 @@ static void es5506_start_common(const device_config *device, const void *config, chip->irq_callback = intf->irq_callback; chip->irqv = 0x80; + /* compute the tables */ + compute_tables(chip); + /* init the voices */ accum_mask = (sndtype == SOUND_ES5506) ? 0xffffffff : 0x7fffffff; for (j = 0; j < 32; j++) @@ -873,7 +873,7 @@ static void es5506_start_common(const device_config *device, const void *config, } /* allocate memory */ - chip->scratch = (INT32 *)auto_malloc(sizeof(chip->scratch[0]) * 2 * MAX_SAMPLE_CHUNK); + chip->scratch = auto_alloc_array(device->machine, INT32, 2 * MAX_SAMPLE_CHUNK); /* success */ } diff --git a/src/emu/sound/filter.c b/src/emu/sound/filter.c index f59a1e8082d..2996f8a28e4 100644 --- a/src/emu/sound/filter.c +++ b/src/emu/sound/filter.c @@ -2,7 +2,7 @@ #include "filter.h" static filter* filter_alloc(void) { - filter* f = (filter *)malloc_or_die(sizeof(filter)); + filter* f = alloc_or_die(filter); return f; } @@ -20,7 +20,7 @@ void filter_state_reset(filter* f, filter_state* s) { filter_state* filter_state_alloc(void) { int i; - filter_state* s = (filter_state *)malloc_or_die(sizeof(filter_state)); + filter_state* s = alloc_or_die(filter_state); s->prev_mac = 0; for(i=0;i<FILTER_ORDER_MAX;++i) s->xprev[i] = 0; diff --git a/src/emu/sound/ics2115.c b/src/emu/sound/ics2115.c index e3257411b4e..ea217f60eeb 100644 --- a/src/emu/sound/ics2115.c +++ b/src/emu/sound/ics2115.c @@ -459,7 +459,7 @@ static DEVICE_START( ics2115 ) chip->rom = device->region; chip->timer[0].timer = timer_alloc(device->machine, timer_cb_0, chip); chip->timer[1].timer = timer_alloc(device->machine, timer_cb_1, chip); - chip->ulaw = (INT16 *)auto_malloc(256*sizeof(INT16)); + chip->ulaw = auto_alloc_array(device->machine, INT16, 256); chip->stream = stream_create(device, 0, 2, 33075, chip, update); for(i=0; i<256; i++) { diff --git a/src/emu/sound/k005289.c b/src/emu/sound/k005289.c index 5266041ca75..cb5acc9098f 100644 --- a/src/emu/sound/k005289.c +++ b/src/emu/sound/k005289.c @@ -71,14 +71,14 @@ INLINE k005289_state *get_safe_token(const device_config *device) } /* build a table to divide by the number of voices */ -static void make_mixer_table(k005289_state *info, int voices) +static void make_mixer_table(running_machine *machine, k005289_state *info, int voices) { int count = voices * 128; int i; int gain = 16; /* allocate memory */ - info->mixer_table = (INT16 *)auto_malloc(256 * voices * sizeof(INT16)); + info->mixer_table = auto_alloc_array(machine, INT16, 256 * voices); /* find the middle of the table */ info->mixer_lookup = info->mixer_table + (128 * voices); @@ -171,10 +171,10 @@ static DEVICE_START( k005289 ) info->mclock = device->clock; /* allocate a pair of buffers to mix into - 1 second's worth should be more than enough */ - info->mixer_buffer = (short *)auto_malloc(2 * sizeof(short) * info->rate); + info->mixer_buffer = auto_alloc_array(device->machine, short, 2 * info->rate); /* build the mixer table */ - make_mixer_table(info, 2); + make_mixer_table(device->machine, info, 2); info->sound_prom = device->region; diff --git a/src/emu/sound/k051649.c b/src/emu/sound/k051649.c index 7ac4b9b4896..1f8ace78b32 100644 --- a/src/emu/sound/k051649.c +++ b/src/emu/sound/k051649.c @@ -65,14 +65,14 @@ INLINE k051649_state *get_safe_token(const device_config *device) } /* build a table to divide by the number of voices */ -static void make_mixer_table(k051649_state *info, int voices) +static void make_mixer_table(running_machine *machine, k051649_state *info, int voices) { int count = voices * 256; int i; int gain = 8; /* allocate memory */ - info->mixer_table = (INT16 *)auto_malloc(512 * voices * sizeof(INT16)); + info->mixer_table = auto_alloc_array(machine, INT16, 512 * voices); /* find the middle of the table */ info->mixer_lookup = info->mixer_table + (256 * voices); @@ -145,10 +145,10 @@ static DEVICE_START( k051649 ) info->mclock = device->clock; /* allocate a buffer to mix into - 1 second's worth should be more than enough */ - info->mixer_buffer = (short *)auto_malloc(2 * sizeof(short) * info->rate); + info->mixer_buffer = auto_alloc_array(device->machine, short, 2 * info->rate); /* build the mixer table */ - make_mixer_table(info, 5); + make_mixer_table(device->machine, info, 5); } static DEVICE_RESET( k051649 ) diff --git a/src/emu/sound/k053260.c b/src/emu/sound/k053260.c index d03b673d86b..fe721516fb7 100644 --- a/src/emu/sound/k053260.c +++ b/src/emu/sound/k053260.c @@ -233,7 +233,7 @@ static DEVICE_START( k053260 ) for ( i = 0; i < 0x30; i++ ) ic->regs[i] = 0; - ic->delta_table = ( UINT32 * )auto_malloc( 0x1000 * sizeof( UINT32 ) ); + ic->delta_table = auto_alloc_array( device->machine, UINT32, 0x1000 ); ic->channel = stream_create( device, 0, 2, rate, ic, k053260_update ); diff --git a/src/emu/sound/k054539.c b/src/emu/sound/k054539.c index d6025c62fbd..6707bfcdfdc 100644 --- a/src/emu/sound/k054539.c +++ b/src/emu/sound/k054539.c @@ -455,7 +455,7 @@ static void k054539_init_chip(const device_config *device, k054539_state *info) info->k054539_flags |= K054539_UPDATE_AT_KEYON; //* make it default until proven otherwise // Real size of 0x4000, the addon is to simplify the reverb buffer computations - info->ram = (unsigned char *)auto_malloc(0x4000*2+device->clock/50*2); + info->ram = auto_alloc_array(device->machine, unsigned char, 0x4000*2+device->clock/50*2); info->reverb_pos = 0; info->cur_ptr = 0; memset(info->ram, 0, 0x4000*2+device->clock/50*2); diff --git a/src/emu/sound/namco.c b/src/emu/sound/namco.c index 471b7f9de6e..3070b670080 100644 --- a/src/emu/sound/namco.c +++ b/src/emu/sound/namco.c @@ -117,7 +117,7 @@ static void update_namco_waveform(namco_sound *chip, int offset, UINT8 data) /* build the decoded waveform table */ -static void build_decoded_waveform(namco_sound *chip, UINT8 *rgnbase) +static void build_decoded_waveform(running_machine *machine, namco_sound *chip, UINT8 *rgnbase) { INT16 *p; int size; @@ -139,7 +139,7 @@ static void build_decoded_waveform(namco_sound *chip, UINT8 *rgnbase) size = 32 * 8; /* 32 samples, 8 waveforms */ } - p = (INT16 *)auto_malloc(size * MAX_VOLUME * sizeof (INT16)); + p = auto_alloc_array(machine, INT16, size * MAX_VOLUME); for (v = 0; v < MAX_VOLUME; v++) { @@ -388,7 +388,7 @@ static DEVICE_START( namco ) logerror("Namco: freq fractional bits = %d: internal freq = %d, output freq = %d\n", chip->f_fracbits, chip->namco_clock, chip->sample_rate); /* build the waveform table */ - build_decoded_waveform(chip, device->region); + build_decoded_waveform(device->machine, chip, device->region); /* get stream channels */ if (intf->stereo) diff --git a/src/emu/sound/psx.c b/src/emu/sound/psx.c index bd7ecdd5071..5cc70a5c55e 100644 --- a/src/emu/sound/psx.c +++ b/src/emu/sound/psx.c @@ -329,7 +329,7 @@ static DEVICE_START( psxspu ) chip->m_p_n_effect[ n_effect ] = 0; } - chip->m_p_n_spuram = (UINT16 *)auto_malloc( SPU_RAM_SIZE ); + chip->m_p_n_spuram = auto_alloc_array( device->machine, UINT16, SPU_RAM_SIZE/2 ); state_save_register_device_item( device, 0, chip->m_n_mainvolumeleft ); state_save_register_device_item( device, 0, chip->m_n_mainvolumeright ); diff --git a/src/emu/sound/samples.c b/src/emu/sound/samples.c index 22174b7699a..56b2b86be17 100644 --- a/src/emu/sound/samples.c +++ b/src/emu/sound/samples.c @@ -25,7 +25,7 @@ struct _samples_info const device_config *device; int numchannels; /* how many channels */ sample_channel *channel;/* array of channels */ - struct loaded_samples *samples;/* array of samples */ + loaded_samples *samples;/* array of samples */ }; @@ -50,7 +50,7 @@ INLINE samples_info *get_safe_token(const device_config *device) read_wav_sample - read a WAV file as a sample -------------------------------------------------*/ -static int read_wav_sample(mame_file *f, struct loaded_sample *sample) +static int read_wav_sample(running_machine *machine, mame_file *f, loaded_sample *sample) { unsigned long offset = 0; UINT32 length, rate, filesize; @@ -153,7 +153,7 @@ static int read_wav_sample(mame_file *f, struct loaded_sample *sample) unsigned char *tempptr; int sindex; - sample->data = (INT16 *)auto_malloc(sizeof(*sample->data) * length); + sample->data = auto_alloc_array(machine, INT16, length); mame_fread(f, sample->data, length); /* convert 8-bit data to signed samples */ @@ -164,7 +164,7 @@ static int read_wav_sample(mame_file *f, struct loaded_sample *sample) else { /* 16-bit data is fine as-is */ - sample->data = (INT16 *)auto_malloc(sizeof(*sample->data) * (length/2)); + sample->data = auto_alloc_array(machine, INT16, length/2); mame_fread(f, sample->data, length); sample->length /= 2; if (ENDIANNESS_NATIVE != ENDIANNESS_LITTLE) @@ -179,9 +179,9 @@ static int read_wav_sample(mame_file *f, struct loaded_sample *sample) readsamples - load all samples -------------------------------------------------*/ -struct loaded_samples *readsamples(const char *const *samplenames, const char *basename) +loaded_samples *readsamples(running_machine *machine, const char *const *samplenames, const char *basename) { - struct loaded_samples *samples; + loaded_samples *samples; int skipfirst = 0; int i; @@ -201,8 +201,7 @@ struct loaded_samples *readsamples(const char *const *samplenames, const char *b return NULL; /* allocate the array */ - samples = (struct loaded_samples *)auto_malloc(sizeof(struct loaded_samples) + (i-1) * sizeof(struct loaded_sample)); - memset(samples, 0, sizeof(struct loaded_samples) + (i-1) * sizeof(struct loaded_sample)); + samples = (loaded_samples *)auto_alloc_array_clear(machine, UINT8, sizeof(loaded_samples) + (i-1) * sizeof(loaded_sample)); samples->total = i; /* load the samples */ @@ -223,7 +222,7 @@ struct loaded_samples *readsamples(const char *const *samplenames, const char *b } if (filerr == FILERR_NONE) { - read_wav_sample(f, &samples->sample[i]); + read_wav_sample(machine, f, &samples->sample[i]); mame_fclose(f); } @@ -243,7 +242,7 @@ void sample_start(const device_config *device,int channel,int samplenum,int loop { samples_info *info = get_safe_token(device); sample_channel *chan; - struct loaded_sample *sample; + loaded_sample *sample; /* if samples are disabled, just return quietly */ if (info->samples == NULL) @@ -450,7 +449,7 @@ static STATE_POSTLOAD( samples_postload ) /* attach any samples that were loaded and playing */ if (chan->source_num >= 0 && chan->source_num < info->samples->total) { - struct loaded_sample *sample = &info->samples->sample[chan->source_num]; + loaded_sample *sample = &info->samples->sample[chan->source_num]; chan->source = sample->data; chan->source_length = sample->length; if (!sample->data) @@ -482,12 +481,12 @@ static DEVICE_START( samples ) /* read audio samples */ if (intf->samplenames) - info->samples = readsamples(intf->samplenames,device->machine->gamedrv->name); + info->samples = readsamples(device->machine, intf->samplenames,device->machine->gamedrv->name); /* allocate channels */ info->numchannels = intf->channels; assert(info->numchannels < MAX_CHANNELS); - info->channel = (sample_channel *)auto_malloc(sizeof(*info->channel) * info->numchannels); + info->channel = auto_alloc_array(device->machine, sample_channel, info->numchannels); for (i = 0; i < info->numchannels; i++) { info->channel[i].stream = stream_create(device, 0, 1, device->machine->sample_rate, &info->channel[i], sample_update_sound); diff --git a/src/emu/sound/samples.h b/src/emu/sound/samples.h index ff8e3fa0911..27c52fe0832 100644 --- a/src/emu/sound/samples.h +++ b/src/emu/sound/samples.h @@ -3,17 +3,19 @@ #ifndef __SAMPLES_H__ #define __SAMPLES_H__ -struct loaded_sample +typedef struct _loaded_sample loaded_sample; +struct _loaded_sample { int length; /* length in samples */ int frequency; /* frequency of the sample */ INT16 * data; /* 16-bit signed data */ }; -struct loaded_samples +typedef struct _loaded_samples loaded_samples; +struct _loaded_samples { int total; /* number of samples */ - struct loaded_sample sample[1]; /* array of samples */ + loaded_sample sample[1]; /* array of samples */ }; typedef struct _samples_interface samples_interface; @@ -38,7 +40,7 @@ int sample_playing(const device_config *device,int channel); /* helper function that reads samples from disk - this can be used by other */ /* drivers as well (e.g. a sound chip emulator needing drum samples) */ -struct loaded_samples *readsamples(const char *const *samplenames, const char *name); +loaded_samples *readsamples(running_machine *machine, const char *const *samplenames, const char *name); DEVICE_GET_INFO( samples ); #define SOUND_SAMPLES DEVICE_GET_INFO_NAME( samples ) diff --git a/src/emu/sound/scsp.c b/src/emu/sound/scsp.c index 892bdd4e528..67c07770925 100644 --- a/src/emu/sound/scsp.c +++ b/src/emu/sound/scsp.c @@ -648,10 +648,8 @@ static void SCSP_Init(const device_config *device, struct _SCSP *SCSP, const scs } LFO_Init(device->machine); - SCSP->buffertmpl=(signed int*) auto_malloc(44100*sizeof(signed int)); - SCSP->buffertmpr=(signed int*) auto_malloc(44100*sizeof(signed int)); - memset(SCSP->buffertmpl,0,44100*sizeof(signed int)); - memset(SCSP->buffertmpr,0,44100*sizeof(signed int)); + SCSP->buffertmpl=auto_alloc_array_clear(device->machine, signed int, 44100); + SCSP->buffertmpr=auto_alloc_array_clear(device->machine, signed int, 44100); // no "pend" SCSP[0].udata.data[0x20/2] = 0; diff --git a/src/emu/sound/segapcm.c b/src/emu/sound/segapcm.c index 6413a5e6fde..2999e72c733 100644 --- a/src/emu/sound/segapcm.c +++ b/src/emu/sound/segapcm.c @@ -93,7 +93,7 @@ static DEVICE_START( segapcm ) segapcm_state *spcm = get_safe_token(device); spcm->rom = (const UINT8 *)device->region; - spcm->ram = (UINT8 *)auto_malloc(0x800); + spcm->ram = auto_alloc_array(device->machine, UINT8, 0x800); memset(spcm->ram, 0xff, 0x800); diff --git a/src/emu/sound/sid.c b/src/emu/sound/sid.c index 887f3f4f302..01221310efa 100644 --- a/src/emu/sound/sid.c +++ b/src/emu/sound/sid.c @@ -166,8 +166,8 @@ static void filterTableInit(running_machine *machine) float resDyMin; float resDy; - filterTable = auto_malloc(sizeof(*filterTable) * 0x800); - bandPassParam = auto_malloc(sizeof(*bandPassParam) * 0x800); + filterTable = auto_alloc_array(machine, float, 0x800); + bandPassParam = auto_alloc_array(machine, float, 0x800); uk = 0; for ( rk = 0; rk < 0x800; rk++ ) @@ -233,7 +233,7 @@ void sid6581_init (SID6581 *This) This->filter.Enabled = TRUE; - sidInitMixerEngine(); + sidInitMixerEngine(This->device->machine); filterTableInit(This->device->machine); sidInitWaveformTables(This->type); diff --git a/src/emu/sound/sidvoice.c b/src/emu/sound/sidvoice.c index 3ee758e84ab..64b2f8df0a2 100644 --- a/src/emu/sound/sidvoice.c +++ b/src/emu/sound/sidvoice.c @@ -26,7 +26,7 @@ static INT8* ampMod1x8; static const UINT32 noiseSeed = 0x7ffff8; -void sidInitMixerEngine(void) +void sidInitMixerEngine(running_machine *machine) { UINT16 uk; INT32 si, sj ; @@ -34,7 +34,7 @@ void sidInitMixerEngine(void) /* 8-bit volume modulation tables. */ float filterAmpl = 0.7f; - ampMod1x8=(INT8*) auto_malloc(256*256); + ampMod1x8=auto_alloc_array(machine, INT8, 256*256); uk = 0; for ( si = 0; si < 256; si++ ) diff --git a/src/emu/sound/sidvoice.h b/src/emu/sound/sidvoice.h index d3f788afe76..81241196275 100644 --- a/src/emu/sound/sidvoice.h +++ b/src/emu/sound/sidvoice.h @@ -107,7 +107,7 @@ void sidEmuSet2(sidOperator* pVoice); INT8 sidWaveCalcNormal(sidOperator* pVoice); void sidInitWaveformTables(SIDTYPE type); -void sidInitMixerEngine(void); +void sidInitMixerEngine(running_machine *machine); #if 0 extern ptr2sidVoidFunc sid6581ModeNormalTable[16]; diff --git a/src/emu/sound/sp0256.c b/src/emu/sound/sp0256.c index 11011cbe598..59137e34a27 100644 --- a/src/emu/sound/sp0256.c +++ b/src/emu/sound/sp0256.c @@ -1201,7 +1201,7 @@ static DEVICE_START( sp0256 ) /* -------------------------------------------------------------------- */ /* Allocate a scratch buffer for generating ~10kHz samples. */ /* -------------------------------------------------------------------- */ - sp->scratch = (INT16 *)malloc_or_die(SCBUF_SIZE * sizeof(INT16)); + sp->scratch = auto_alloc_array(device->machine, INT16, SCBUF_SIZE); sp->sc_head = sp->sc_tail = 0; /* -------------------------------------------------------------------- */ @@ -1220,12 +1220,6 @@ static DEVICE_START( sp0256 ) sp0256_bitrevbuff(sp->rom, 0, 0xffff); } -static DEVICE_STOP( sp0256 ) -{ - sp0256_state *sp = get_safe_token(device); - free( sp->scratch ); -} - static void sp0256_reset(sp0256_state *sp) { /* ---------------------------------------------------------------- */ @@ -1364,7 +1358,6 @@ DEVICE_GET_INFO( sp0256 ) /* --- the following bits of info are returned as pointers to data or functions --- */ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( sp0256 ); break; - case DEVINFO_FCT_STOP: info->stop = DEVICE_STOP_NAME( sp0256 ); break; case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( sp0256 ); break; /* --- the following bits of info are returned as NULL-terminated strings --- */ diff --git a/src/emu/sound/tms5110.c b/src/emu/sound/tms5110.c index 9adf77d6faa..bc30a852e02 100644 --- a/src/emu/sound/tms5110.c +++ b/src/emu/sound/tms5110.c @@ -181,8 +181,7 @@ void *tms5110_create(const device_config *device, int variant) { struct tms5110 *tms; - tms = (struct tms5110 *)malloc_or_die(sizeof(*tms)); - memset(tms, 0, sizeof(*tms)); + tms = alloc_clear_or_die(struct tms5110); tms->device = device; tms5110_set_variant(tms, variant); diff --git a/src/emu/sound/tms5220.c b/src/emu/sound/tms5220.c index d00d5f5bacd..e19333fa3b8 100644 --- a/src/emu/sound/tms5220.c +++ b/src/emu/sound/tms5220.c @@ -179,8 +179,7 @@ void *tms5220_create(const device_config *device) { struct tms5220 *tms; - tms = (struct tms5220 *)malloc_or_die(sizeof(*tms)); - memset(tms, 0, sizeof(*tms)); + tms = alloc_clear_or_die(struct tms5220); tms->device = device; state_save_register_device_item_array(device, 0, tms->fifo); diff --git a/src/emu/sound/votrax.c b/src/emu/sound/votrax.c index 299e1ee5fd9..a63cc45f92e 100644 --- a/src/emu/sound/votrax.c +++ b/src/emu/sound/votrax.c @@ -30,7 +30,7 @@ struct _votrax_state int volume; sound_stream * channel; - struct loaded_sample *sample; + loaded_sample *sample; UINT32 pos; UINT32 frac; UINT32 step; @@ -116,7 +116,7 @@ static DEVICE_START( votrax ) votrax_state *votrax = get_safe_token(device); votrax->device = device; - votrax->samples = readsamples(VotraxTable,"votrax"); + votrax->samples = readsamples(device->machine,VotraxTable,"votrax"); votrax->frequency = 8000; votrax->volume = 230; diff --git a/src/emu/sound/ymf271.c b/src/emu/sound/ymf271.c index bf7ec832c54..6372b032b4f 100644 --- a/src/emu/sound/ymf271.c +++ b/src/emu/sound/ymf271.c @@ -1568,13 +1568,13 @@ READ8_DEVICE_HANDLER( ymf271_r ) return 0; } -static void init_tables(void) +static void init_tables(running_machine *machine) { int i,j; for (i=0; i < ARRAY_LENGTH(wavetable); i++) { - wavetable[i] = (INT16 *)auto_malloc(SIN_LEN * sizeof(INT16)); + wavetable[i] = auto_alloc_array(machine, INT16, SIN_LEN); } for (i=0; i < SIN_LEN; i++) @@ -1652,7 +1652,7 @@ static void init_tables(void) alfo_table[3][i] = (i < (LFO_LENGTH/2)) ? ALFO_MAX-tri_wave : tri_wave; } - mix = (INT32 *)auto_malloc(48000*2*sizeof(*mix)); + mix = auto_alloc_array(machine, INT32, 48000*2); } static void init_state(YMF271Chip *chip, const device_config *device) @@ -1741,7 +1741,7 @@ static void ymf271_init(const device_config *device, YMF271Chip *chip, UINT8 *ro devcb_resolve_read8(&chip->ext_mem_read, ext_read, device); devcb_resolve_write8(&chip->ext_mem_write, ext_write, device); - init_tables(); + init_tables(device->machine); init_state(chip, device); } diff --git a/src/emu/sound/ymf278b.c b/src/emu/sound/ymf278b.c index 76dbac1820d..00939c8762b 100644 --- a/src/emu/sound/ymf278b.c +++ b/src/emu/sound/ymf278b.c @@ -676,7 +676,7 @@ static void ymf278b_init(const device_config *device, YMF278BChip *chip, void (* chip->irq_line = CLEAR_LINE; chip->clock = device->clock; - mix = (INT32 *)auto_malloc(44100*2*sizeof(*mix)); + mix = auto_alloc_array(device->machine, INT32, 44100*2); } static DEVICE_START( ymf278b ) diff --git a/src/emu/sound/ymz280b.c b/src/emu/sound/ymz280b.c index 40750d9be5a..360b3aac8de 100644 --- a/src/emu/sound/ymz280b.c +++ b/src/emu/sound/ymz280b.c @@ -659,7 +659,7 @@ static DEVICE_START( ymz280b ) chip->stream = stream_create(device, 0, 2, INTERNAL_SAMPLE_RATE, chip, ymz280b_update); /* allocate memory */ - chip->scratch = (INT16 *)auto_malloc(sizeof(chip->scratch[0]) * MAX_SAMPLE_CHUNK); + chip->scratch = auto_alloc_array(device->machine, INT16, MAX_SAMPLE_CHUNK); /* state save */ { diff --git a/src/emu/state.c b/src/emu/state.c index cf7a82f07ed..1c408a4e0b8 100644 --- a/src/emu/state.c +++ b/src/emu/state.c @@ -165,8 +165,7 @@ INLINE void flip_data(state_entry *entry) void state_init(running_machine *machine) { - machine->state_data = (state_private *)auto_malloc(sizeof(*machine->state_data)); - memset(machine->state_data, 0, sizeof(*machine->state_data)); + machine->state_data = auto_alloc_clear(machine, state_private); } @@ -264,8 +263,7 @@ void state_save_register_memory(running_machine *machine, const char *module, co /* didn't find one; allocate a new one */ next = *entryptr; - *entryptr = (state_entry *)malloc_or_die(sizeof(**entryptr)); - memset(*entryptr, 0, sizeof(**entryptr)); + *entryptr = alloc_clear_or_die(state_entry); /* fill in the rest */ (*entryptr)->next = next; @@ -314,7 +312,7 @@ void state_save_register_presave(running_machine *machine, state_presave_func fu fatalerror("Duplicate save state function (%p, %p)", param, func); /* allocate a new entry */ - *cbptr = (state_callback *)malloc_or_die(sizeof(state_callback)); + *cbptr = alloc_or_die(state_callback); /* fill it in */ (*cbptr)->next = NULL; @@ -345,7 +343,7 @@ void state_save_register_postload(running_machine *machine, state_postload_func fatalerror("Duplicate save state function (%p, %p)", param, func); /* allocate a new entry */ - *cbptr = (state_callback *)malloc_or_die(sizeof(state_callback)); + *cbptr = alloc_or_die(state_callback); /* fill it in */ (*cbptr)->next = NULL; diff --git a/src/emu/streams.c b/src/emu/streams.c index 829cbed2a51..66efcc49fa0 100644 --- a/src/emu/streams.c +++ b/src/emu/streams.c @@ -165,9 +165,9 @@ struct _streams_private ***************************************************************************/ static STATE_POSTLOAD( stream_postload ); -static void allocate_resample_buffers(streams_private *strdata, sound_stream *stream); -static void allocate_output_buffers(streams_private *strdata, sound_stream *stream); -static void recompute_sample_rate_data(streams_private *strdata, sound_stream *stream); +static void allocate_resample_buffers(running_machine *machine, sound_stream *stream); +static void allocate_output_buffers(running_machine *machine, sound_stream *stream); +static void recompute_sample_rate_data(running_machine *machine, sound_stream *stream); static void generate_samples(sound_stream *stream, int samples); static stream_sample_t *generate_resampled_data(stream_input *input, UINT32 numsamples); @@ -218,8 +218,7 @@ void streams_init(running_machine *machine) streams_private *strdata; /* allocate memory for our private data */ - strdata = (streams_private *)auto_malloc(sizeof(*strdata)); - memset(strdata, 0, sizeof(*strdata)); + strdata = auto_alloc_clear(machine, streams_private); /* reset globals */ strdata->stream_tailptr = &strdata->stream_head; @@ -311,7 +310,7 @@ void streams_update(running_machine *machine) stream->new_sample_rate = 0; /* recompute all the data */ - recompute_sample_rate_data(strdata, stream); + recompute_sample_rate_data(machine, stream); /* reset our sample indexes to the current time */ stream->output_sampindex = (INT64)stream->output_sampindex * (INT64)stream->sample_rate / old_rate; @@ -343,8 +342,7 @@ sound_stream *stream_create(const device_config *device, int inputs, int outputs char statetag[30]; /* allocate memory */ - stream = (sound_stream *)auto_malloc(sizeof(*stream)); - memset(stream, 0, sizeof(*stream)); + stream = auto_alloc_clear(device->machine, sound_stream); VPRINTF(("stream_create(%d, %d, %d) => %p\n", inputs, outputs, sample_rate, stream)); @@ -365,10 +363,8 @@ sound_stream *stream_create(const device_config *device, int inputs, int outputs /* allocate space for the inputs */ if (inputs > 0) { - stream->input = (stream_input *)auto_malloc(inputs * sizeof(*stream->input)); - memset(stream->input, 0, inputs * sizeof(*stream->input)); - stream->input_array = (stream_sample_t **)auto_malloc(inputs * sizeof(*stream->input_array)); - memset(stream->input_array, 0, inputs * sizeof(*stream->input_array)); + stream->input = auto_alloc_array_clear(device->machine, stream_input, inputs); + stream->input_array = auto_alloc_array_clear(device->machine, stream_sample_t *, inputs); } /* initialize the state of each input */ @@ -382,10 +378,8 @@ sound_stream *stream_create(const device_config *device, int inputs, int outputs /* allocate space for the outputs */ if (outputs > 0) { - stream->output = (stream_output *)auto_malloc(outputs * sizeof(*stream->output)); - memset(stream->output, 0, outputs * sizeof(*stream->output)); - stream->output_array = (stream_sample_t **)auto_malloc(outputs * sizeof(*stream->output_array)); - memset(stream->output_array, 0, outputs * sizeof(*stream->output_array)); + stream->output = auto_alloc_array_clear(device->machine, stream_output, outputs); + stream->output_array = auto_alloc_array_clear(device->machine, stream_sample_t *, outputs); } /* initialize the state of each output */ @@ -402,7 +396,7 @@ sound_stream *stream_create(const device_config *device, int inputs, int outputs /* force an update to the sample rates; this will cause everything to be recomputed and will generate the initial resample buffers for our inputs */ - recompute_sample_rate_data(strdata, stream); + recompute_sample_rate_data(device->machine, stream); /* set up the initial output buffer positions now that we have data */ stream->output_base_sampindex = -stream->max_samples_per_update; @@ -497,7 +491,7 @@ void stream_set_input(sound_stream *stream, int index, sound_stream *input_strea input->source->dependents++; /* update sample rates now that we know the input */ - recompute_sample_rate_data(stream->device->machine->streams_data, stream); + recompute_sample_rate_data(stream->device->machine, stream); } @@ -702,7 +696,7 @@ static STATE_POSTLOAD( stream_postload ) int outputnum; /* recompute the same rate information */ - recompute_sample_rate_data(strdata, stream); + recompute_sample_rate_data(machine, stream); /* make sure our output buffers are fully cleared */ for (outputnum = 0; outputnum < stream->outputs; outputnum++) @@ -720,7 +714,7 @@ static STATE_POSTLOAD( stream_postload ) resample buffer sizes and expand if necessary -------------------------------------------------*/ -static void allocate_resample_buffers(streams_private *strdata, sound_stream *stream) +static void allocate_resample_buffers(running_machine *machine, sound_stream *stream) { /* compute the target number of samples */ INT32 bufsize = 2 * stream->max_samples_per_update; @@ -737,7 +731,7 @@ static void allocate_resample_buffers(streams_private *strdata, sound_stream *st for (inputnum = 0; inputnum < stream->inputs; inputnum++) { stream_input *input = &stream->input[inputnum]; - input->resample = (stream_sample_t *)auto_realloc(input->resample, stream->resample_bufalloc * sizeof(input->resample[0])); + input->resample = auto_extend_array(machine, input->resample, stream_sample_t, stream->resample_bufalloc); } } } @@ -748,7 +742,7 @@ static void allocate_resample_buffers(streams_private *strdata, sound_stream *st output buffer sizes and expand if necessary -------------------------------------------------*/ -static void allocate_output_buffers(streams_private *strdata, sound_stream *stream) +static void allocate_output_buffers(running_machine *machine, sound_stream *stream) { /* compute the target number of samples */ INT32 bufsize = OUTPUT_BUFFER_UPDATES * stream->max_samples_per_update; @@ -767,7 +761,7 @@ static void allocate_output_buffers(streams_private *strdata, sound_stream *stre for (outputnum = 0; outputnum < stream->outputs; outputnum++) { stream_output *output = &stream->output[outputnum]; - output->buffer = (stream_sample_t *)auto_realloc(output->buffer, stream->output_bufalloc * sizeof(output->buffer[0])); + output->buffer = auto_extend_array(machine, output->buffer, stream_sample_t, stream->output_bufalloc); memset(&output->buffer[oldsize], 0, (stream->output_bufalloc - oldsize) * sizeof(output->buffer[0])); } } @@ -780,8 +774,9 @@ static void allocate_output_buffers(streams_private *strdata, sound_stream *stre by this stream -------------------------------------------------*/ -static void recompute_sample_rate_data(streams_private *strdata, sound_stream *stream) +static void recompute_sample_rate_data(running_machine *machine, sound_stream *stream) { + streams_private *strdata = machine->streams_data; int inputnum; /* recompute the timing parameters */ @@ -789,8 +784,8 @@ static void recompute_sample_rate_data(streams_private *strdata, sound_stream *s stream->max_samples_per_update = (strdata->update_attoseconds + stream->attoseconds_per_sample - 1) / stream->attoseconds_per_sample; /* update resample and output buffer sizes */ - allocate_resample_buffers(strdata, stream); - allocate_output_buffers(strdata, stream); + allocate_resample_buffers(machine, stream); + allocate_output_buffers(machine, stream); /* iterate over each input */ for (inputnum = 0; inputnum < stream->inputs; inputnum++) diff --git a/src/emu/tilemap.c b/src/emu/tilemap.c index f776e6b2501..71c9cb334bf 100644 --- a/src/emu/tilemap.c +++ b/src/emu/tilemap.c @@ -303,7 +303,7 @@ void tilemap_init(running_machine *machine) tilemap_tailptr = &tilemap_list; tilemap_instance = 0; - priority_bitmap = auto_bitmap_alloc(screen_width, screen_height, BITMAP_FORMAT_INDEXED8); + priority_bitmap = auto_bitmap_alloc(machine, screen_width, screen_height, BITMAP_FORMAT_INDEXED8); add_exit_callback(machine, tilemap_exit); } } @@ -324,8 +324,7 @@ tilemap *tilemap_create(running_machine *machine, tile_get_info_func tile_get_in int group; /* allocate the tilemap itself */ - tmap = (tilemap *)malloc_or_die(sizeof(*tmap)); - memset(tmap, 0, sizeof(*tmap)); + tmap = alloc_clear_or_die(tilemap); /* fill in the basic metrics */ tmap->machine = machine; @@ -354,19 +353,16 @@ tilemap *tilemap_create(running_machine *machine, tile_get_info_func tile_get_in /* initialize scroll information */ tmap->scrollrows = 1; tmap->scrollcols = 1; - tmap->rowscroll = (INT32 *)malloc_or_die(tmap->height * sizeof(*tmap->rowscroll)); - memset(tmap->rowscroll, 0, tmap->height * sizeof(*tmap->rowscroll)); - tmap->colscroll = (INT32 *)malloc_or_die(tmap->width * sizeof(*tmap->colscroll)); - memset(tmap->colscroll, 0, tmap->width * sizeof(*tmap->colscroll)); + tmap->rowscroll = alloc_array_clear_or_die(INT32, tmap->height); + tmap->colscroll = alloc_array_clear_or_die(INT32, tmap->width); /* allocate the pixel data cache */ tmap->pixmap = bitmap_alloc(tmap->width, tmap->height, BITMAP_FORMAT_INDEXED16); /* allocate transparency mapping data */ - tmap->tileflags = (UINT8 *)malloc_or_die(tmap->max_logical_index); + tmap->tileflags = alloc_array_or_die(UINT8, tmap->max_logical_index); tmap->flagsmap = bitmap_alloc(tmap->width, tmap->height, BITMAP_FORMAT_INDEXED8); - tmap->pen_to_flags = (UINT8 *)malloc_or_die(sizeof(tmap->pen_to_flags[0]) * MAX_PEN_TO_FLAGS * TILEMAP_NUM_GROUPS); - memset(tmap->pen_to_flags, 0, sizeof(tmap->pen_to_flags[0]) * MAX_PEN_TO_FLAGS * TILEMAP_NUM_GROUPS); + tmap->pen_to_flags = alloc_array_clear_or_die(UINT8, MAX_PEN_TO_FLAGS * TILEMAP_NUM_GROUPS); for (group = 0; group < TILEMAP_NUM_GROUPS; group++) tilemap_map_pens_to_layer(tmap, group, 0, 0, TILEMAP_PIXEL_LAYER0); @@ -1157,8 +1153,8 @@ static void mappings_create(tilemap *tmap) tmap->max_memory_index++; /* allocate the necessary mappings */ - tmap->memory_to_logical = (tilemap_logical_index *)malloc_or_die(tmap->max_memory_index * sizeof(*tmap->memory_to_logical)); - tmap->logical_to_memory = (tilemap_memory_index *)malloc_or_die(tmap->max_logical_index * sizeof(*tmap->logical_to_memory)); + tmap->memory_to_logical = alloc_array_or_die(tilemap_logical_index, tmap->max_memory_index); + tmap->logical_to_memory = alloc_array_or_die(tilemap_memory_index, tmap->max_logical_index); /* update the mappings */ mappings_update(tmap); diff --git a/src/emu/timer.c b/src/emu/timer.c index f2422276a3a..62080cacfe8 100644 --- a/src/emu/timer.c +++ b/src/emu/timer.c @@ -300,8 +300,7 @@ void timer_init(running_machine *machine) int i; /* allocate global data */ - global = machine->timer_data = (timer_private *)auto_malloc(sizeof(*global)); - memset(global, 0, sizeof(*global)); + global = machine->timer_data = auto_alloc_clear(machine, timer_private); /* we need to wait until the first call to timer_cyclestorun before using real CPU times */ global->exec.basetime = attotime_zero; diff --git a/src/emu/ui.c b/src/emu/ui.c index c6bad41f5f1..bafc859e1c8 100644 --- a/src/emu/ui.c +++ b/src/emu/ui.c @@ -97,7 +97,7 @@ static UINT32 handler_ingame(running_machine *machine, UINT32 state); static UINT32 handler_load_save(running_machine *machine, UINT32 state); /* slider controls */ -static slider_state *slider_alloc(const char *title, INT32 minval, INT32 defval, INT32 maxval, INT32 incval, slider_update update, void *arg); +static slider_state *slider_alloc(running_machine *machine, const char *title, INT32 minval, INT32 defval, INT32 maxval, INT32 incval, slider_update update, void *arg); static slider_state *slider_init(running_machine *machine); static INT32 slider_volume(running_machine *machine, void *arg, astring *string, INT32 newval); static INT32 slider_mixervol(running_machine *machine, void *arg, astring *string, INT32 newval); @@ -1390,11 +1390,10 @@ const slider_state *ui_get_slider_list(void) slider_alloc - allocate a new slider entry -------------------------------------------------*/ -static slider_state *slider_alloc(const char *title, INT32 minval, INT32 defval, INT32 maxval, INT32 incval, slider_update update, void *arg) +static slider_state *slider_alloc(running_machine *machine, const char *title, INT32 minval, INT32 defval, INT32 maxval, INT32 incval, slider_update update, void *arg) { int size = sizeof(slider_state) + strlen(title); - slider_state *state = (slider_state *)auto_malloc(size); - memset(state, 0, size); + slider_state *state = (slider_state *)auto_alloc_array_clear(machine, UINT8, size); state->minval = minval; state->defval = defval; @@ -1424,7 +1423,7 @@ static slider_state *slider_init(running_machine *machine) int numitems, item; /* add overall volume */ - *tailptr = slider_alloc("Master Volume", -32, 0, 0, 1, slider_volume, NULL); + *tailptr = slider_alloc(machine, "Master Volume", -32, 0, 0, 1, slider_volume, NULL); tailptr = &(*tailptr)->next; /* add per-channel volume */ @@ -1438,7 +1437,7 @@ static slider_state *slider_init(running_machine *machine) maxval = 2 * defval; astring_printf(string, "%s Volume", sound_get_user_gain_name(machine, item)); - *tailptr = slider_alloc(astring_c(string), 0, defval, maxval, 20, slider_mixervol, (void *)(FPTR)item); + *tailptr = slider_alloc(machine, astring_c(string), 0, defval, maxval, 20, slider_mixervol, (void *)(FPTR)item); tailptr = &(*tailptr)->next; } @@ -1448,7 +1447,7 @@ static slider_state *slider_init(running_machine *machine) if (field->type == IPT_ADJUSTER) { void *param = (void *)field; - *tailptr = slider_alloc(field->name, 0, field->defvalue, 100, 1, slider_adjuster, param); + *tailptr = slider_alloc(machine, field->name, 0, field->defvalue, 100, 1, slider_adjuster, param); tailptr = &(*tailptr)->next; } @@ -1459,7 +1458,7 @@ static slider_state *slider_init(running_machine *machine) if (machine->cpu[item] != NULL) { astring_printf(string, "Overclock CPU %s", machine->cpu[item]->tag); - *tailptr = slider_alloc(astring_c(string), 10, 1000, 2000, 1, slider_overclock, (void *)(FPTR)item); + *tailptr = slider_alloc(machine, astring_c(string), 10, 1000, 2000, 1, slider_overclock, (void *)(FPTR)item); tailptr = &(*tailptr)->next; } } @@ -1478,33 +1477,33 @@ static slider_state *slider_init(running_machine *machine) if (options_get_bool(mame_options(), OPTION_CHEAT)) { astring_printf(string, "%s Refresh Rate", slider_get_screen_desc(device)); - *tailptr = slider_alloc(astring_c(string), -10000, 0, 10000, 1000, slider_refresh, param); + *tailptr = slider_alloc(machine, astring_c(string), -10000, 0, 10000, 1000, slider_refresh, param); tailptr = &(*tailptr)->next; } /* add standard brightness/contrast/gamma controls per-screen */ astring_printf(string, "%s Brightness", slider_get_screen_desc(device)); - *tailptr = slider_alloc(astring_c(string), 100, 1000, 2000, 10, slider_brightness, param); + *tailptr = slider_alloc(machine, astring_c(string), 100, 1000, 2000, 10, slider_brightness, param); tailptr = &(*tailptr)->next; astring_printf(string, "%s Contrast", slider_get_screen_desc(device)); - *tailptr = slider_alloc(astring_c(string), 100, 1000, 2000, 50, slider_contrast, param); + *tailptr = slider_alloc(machine, astring_c(string), 100, 1000, 2000, 50, slider_contrast, param); tailptr = &(*tailptr)->next; astring_printf(string, "%s Gamma", slider_get_screen_desc(device)); - *tailptr = slider_alloc(astring_c(string), 100, 1000, 3000, 50, slider_gamma, param); + *tailptr = slider_alloc(machine, astring_c(string), 100, 1000, 3000, 50, slider_gamma, param); tailptr = &(*tailptr)->next; /* add scale and offset controls per-screen */ astring_printf(string, "%s Horiz Stretch", slider_get_screen_desc(device)); - *tailptr = slider_alloc(astring_c(string), 500, (defxscale == 0) ? 1000 : defxscale, 1500, 2, slider_xscale, param); + *tailptr = slider_alloc(machine, astring_c(string), 500, (defxscale == 0) ? 1000 : defxscale, 1500, 2, slider_xscale, param); tailptr = &(*tailptr)->next; astring_printf(string, "%s Horiz Position", slider_get_screen_desc(device)); - *tailptr = slider_alloc(astring_c(string), -500, defxoffset, 500, 2, slider_xoffset, param); + *tailptr = slider_alloc(machine, astring_c(string), -500, defxoffset, 500, 2, slider_xoffset, param); tailptr = &(*tailptr)->next; astring_printf(string, "%s Vert Stretch", slider_get_screen_desc(device)); - *tailptr = slider_alloc(astring_c(string), 500, (defyscale == 0) ? 1000 : defyscale, 1500, 2, slider_yscale, param); + *tailptr = slider_alloc(machine, astring_c(string), 500, (defyscale == 0) ? 1000 : defyscale, 1500, 2, slider_yscale, param); tailptr = &(*tailptr)->next; astring_printf(string, "%s Vert Position", slider_get_screen_desc(device)); - *tailptr = slider_alloc(astring_c(string), -500, defyoffset, 500, 2, slider_yoffset, param); + *tailptr = slider_alloc(machine, astring_c(string), -500, defyoffset, 500, 2, slider_yoffset, param); tailptr = &(*tailptr)->next; } @@ -1521,16 +1520,16 @@ static slider_state *slider_init(running_machine *machine) /* add scale and offset controls per-overlay */ astring_printf(string, "%s Horiz Stretch", slider_get_laserdisc_desc(device)); - *tailptr = slider_alloc(astring_c(string), 500, (defxscale == 0) ? 1000 : defxscale, 1500, 2, slider_overxscale, param); + *tailptr = slider_alloc(machine, astring_c(string), 500, (defxscale == 0) ? 1000 : defxscale, 1500, 2, slider_overxscale, param); tailptr = &(*tailptr)->next; astring_printf(string, "%s Horiz Position", slider_get_laserdisc_desc(device)); - *tailptr = slider_alloc(astring_c(string), -500, defxoffset, 500, 2, slider_overxoffset, param); + *tailptr = slider_alloc(machine, astring_c(string), -500, defxoffset, 500, 2, slider_overxoffset, param); tailptr = &(*tailptr)->next; astring_printf(string, "%s Vert Stretch", slider_get_laserdisc_desc(device)); - *tailptr = slider_alloc(astring_c(string), 500, (defyscale == 0) ? 1000 : defyscale, 1500, 2, slider_overyscale, param); + *tailptr = slider_alloc(machine, astring_c(string), 500, (defyscale == 0) ? 1000 : defyscale, 1500, 2, slider_overyscale, param); tailptr = &(*tailptr)->next; astring_printf(string, "%s Vert Position", slider_get_laserdisc_desc(device)); - *tailptr = slider_alloc(astring_c(string), -500, defyoffset, 500, 2, slider_overyoffset, param); + *tailptr = slider_alloc(machine, astring_c(string), -500, defyoffset, 500, 2, slider_overyoffset, param); tailptr = &(*tailptr)->next; } } @@ -1541,9 +1540,9 @@ static slider_state *slider_init(running_machine *machine) if (scrconfig->type == SCREEN_TYPE_VECTOR) { /* add flicker control */ - *tailptr = slider_alloc("Vector Flicker", 0, 0, 1000, 10, slider_flicker, NULL); + *tailptr = slider_alloc(machine, "Vector Flicker", 0, 0, 1000, 10, slider_flicker, NULL); tailptr = &(*tailptr)->next; - *tailptr = slider_alloc("Beam Width", 10, 100, 1000, 10, slider_beam, NULL); + *tailptr = slider_alloc(machine, "Beam Width", 10, 100, 1000, 10, slider_beam, NULL); tailptr = &(*tailptr)->next; break; } @@ -1557,10 +1556,10 @@ static slider_state *slider_init(running_machine *machine) { void *param = (void *)field; astring_printf(string, "Crosshair Scale %s", (field->crossaxis == CROSSHAIR_AXIS_X) ? "X" : "Y"); - *tailptr = slider_alloc(astring_c(string), -3000, 1000, 3000, 100, slider_crossscale, param); + *tailptr = slider_alloc(machine, astring_c(string), -3000, 1000, 3000, 100, slider_crossscale, param); tailptr = &(*tailptr)->next; astring_printf(string, "Crosshair Offset %s", (field->crossaxis == CROSSHAIR_AXIS_X) ? "X" : "Y"); - *tailptr = slider_alloc(astring_c(string), -3000, 0, 3000, 100, slider_crossoffset, param); + *tailptr = slider_alloc(machine, astring_c(string), -3000, 0, 3000, 100, slider_crossoffset, param); tailptr = &(*tailptr)->next; } #endif diff --git a/src/emu/uiinput.c b/src/emu/uiinput.c index bc6d42d2595..fc2190c2013 100644 --- a/src/emu/uiinput.c +++ b/src/emu/uiinput.c @@ -76,8 +76,7 @@ static void ui_input_frame_update(running_machine *machine); void ui_input_init(running_machine *machine) { /* create the private data */ - machine->ui_input_data = (ui_input_private *)auto_malloc(sizeof(*machine->ui_input_data)); - memset(machine->ui_input_data, 0, sizeof(*machine->ui_input_data)); + machine->ui_input_data = auto_alloc_clear(machine, ui_input_private); machine->ui_input_data->current_mouse_x = -1; machine->ui_input_data->current_mouse_y = -1; diff --git a/src/emu/uimenu.c b/src/emu/uimenu.c index 0457dec6bca..d36d10226dd 100644 --- a/src/emu/uimenu.c +++ b/src/emu/uimenu.c @@ -448,8 +448,7 @@ ui_menu *ui_menu_alloc(running_machine *machine, ui_menu_handler_func handler, v ui_menu *menu; /* allocate and clear memory for the menu and the state */ - menu = (ui_menu *)malloc_or_die(sizeof(*menu)); - memset(menu, 0, sizeof(*menu)); + menu = alloc_clear_or_die(ui_menu); /* initialize the state */ menu->machine = machine; @@ -652,9 +651,8 @@ void *ui_menu_alloc_state(ui_menu *menu, size_t size, ui_menu_destroy_state_func (*menu->destroy_state)(menu, menu->state); free(menu->state); } - menu->state = malloc_or_die(size); + menu->state = alloc_array_clear_or_die(UINT8, size); menu->destroy_state = destroy_state; - memset(menu->state, 0, size); return menu->state; } @@ -681,8 +679,7 @@ void *ui_menu_pool_alloc(ui_menu *menu, size_t size) } /* allocate a new pool */ - pool = (ui_menu_pool *)malloc_or_die(sizeof(*pool) + UI_MENU_POOL_SIZE); - memset(pool, 0, sizeof(*pool)); + pool = (ui_menu_pool *)alloc_array_clear_or_die(UINT8, sizeof(*pool) + UI_MENU_POOL_SIZE); /* wire it up */ pool->next = menu->pool; diff --git a/src/emu/validity.c b/src/emu/validity.c index 49f0f09052b..adfbb207a48 100644 --- a/src/emu/validity.c +++ b/src/emu/validity.c @@ -233,7 +233,7 @@ static quark_table *quark_table_alloc(UINT32 entries, UINT32 hashsize) /* determine how many total bytes we need */ total_bytes = sizeof(*table) + entries * sizeof(table->entry[0]) + hashsize * sizeof(table->hash[0]); - table = (quark_table *)auto_malloc(total_bytes); + table = (quark_table *)alloc_array_or_die(UINT8, total_bytes); /* fill in the details */ table->entries = entries; @@ -292,6 +292,34 @@ static void quark_tables_create(void) } +/*------------------------------------------------- + quark_tables_free - free allocated tables +-------------------------------------------------*/ + +static void quark_tables_free(void) +{ + if (source_table != NULL) + free(source_table); + source_table = NULL; + + if (name_table != NULL) + free(name_table); + name_table = NULL; + + if (description_table != NULL) + free(description_table); + description_table = NULL; + + if (roms_table != NULL) + free(roms_table); + roms_table = NULL; + + if (defstr_table != NULL) + free(defstr_table); + defstr_table = NULL; +} + + /*************************************************************************** VALIDATION FUNCTIONS @@ -1718,6 +1746,7 @@ int mame_validitychecks(const game_driver *curdriver) end_resource_tracking(); exit_resource_tracking(); + quark_tables_free(); return error; } diff --git a/src/emu/video.c b/src/emu/video.c index 9b890fe995e..aefd99440ef 100644 --- a/src/emu/video.c +++ b/src/emu/video.c @@ -434,7 +434,7 @@ static void init_buffered_spriteram(running_machine *machine) assert_always(spriteram_size != 0, "Video buffers spriteram but spriteram_size is 0"); /* allocate memory for the back buffer */ - buffered_spriteram = (UINT8 *)auto_malloc(spriteram_size); + buffered_spriteram = auto_alloc_array(machine, UINT8, spriteram_size); /* register for saving it */ state_save_register_global_pointer(machine, buffered_spriteram, spriteram_size); @@ -443,7 +443,7 @@ static void init_buffered_spriteram(running_machine *machine) if (spriteram_2_size) { /* allocate memory */ - buffered_spriteram_2 = (UINT8 *)auto_malloc(spriteram_2_size); + buffered_spriteram_2 = auto_alloc_array(machine, UINT8, spriteram_2_size); /* register for saving it */ state_save_register_global_pointer(machine, buffered_spriteram_2, spriteram_2_size); diff --git a/src/emu/video.h b/src/emu/video.h index f86269739ef..3579d07b4aa 100644 --- a/src/emu/video.h +++ b/src/emu/video.h @@ -52,7 +52,7 @@ enum #define video_screen_get_format(screen) (((screen_config *)(screen)->inline_config)->format) /* allocates a bitmap that has the same dimensions and format as the passed in screen */ -#define video_screen_auto_bitmap_alloc(screen) auto_bitmap_alloc(video_screen_get_width(screen), video_screen_get_height(screen), video_screen_get_format(screen)) +#define video_screen_auto_bitmap_alloc(screen) auto_bitmap_alloc(screen->machine, video_screen_get_width(screen), video_screen_get_height(screen), video_screen_get_format(screen)) diff --git a/src/emu/video/generic.c b/src/emu/video/generic.c index 4b41a7526b7..2b085fb3c2b 100644 --- a/src/emu/video/generic.c +++ b/src/emu/video/generic.c @@ -367,7 +367,7 @@ equal to the size of normal spriteram. Spriteram size _must_ be declared in the memory map: - { 0x120000, 0x1207ff, SMH_BANK2, &spriteram, &spriteram_size }, + { 0x120000, 0x1207ff, SMH_BANK(2), &spriteram, &spriteram_size }, Then the video driver must draw the sprites from the buffered_spriteram pointer. The function buffer_spriteram_w() is used to simulate hardware diff --git a/src/emu/video/poly.c b/src/emu/video/poly.c index d78279762cc..9e658218828 100644 --- a/src/emu/video/poly.c +++ b/src/emu/video/poly.c @@ -333,8 +333,7 @@ poly_manager *poly_alloc(running_machine *machine, int max_polys, size_t extra_d poly_manager *poly; /* allocate the manager itself */ - poly = (poly_manager *)malloc_or_die(sizeof(*poly)); - memset(poly, 0, sizeof(*poly)); + poly = alloc_clear_or_die(poly_manager); poly->flags = flags; /* allocate polygons */ @@ -1314,12 +1313,10 @@ static void **allocate_array(size_t *itemsize, UINT32 itemcount) *itemsize = ((*itemsize + CACHE_LINE_SIZE - 1) / CACHE_LINE_SIZE) * CACHE_LINE_SIZE; /* allocate the array */ - ptrarray = (void **)malloc_or_die(sizeof(*ptrarray) * itemcount); - memset(ptrarray, 0, sizeof(*ptrarray) * itemcount); + ptrarray = alloc_array_clear_or_die(void *, itemcount); /* allocate the actual items */ - ptrarray[0] = malloc_or_die(*itemsize * itemcount); - memset(ptrarray[0], 0, *itemsize * itemcount); + ptrarray[0] = alloc_array_clear_or_die(UINT8, *itemsize * itemcount); /* initialize the pointer array */ for (itemnum = 1; itemnum < itemcount; itemnum++) diff --git a/src/emu/video/resnet.c b/src/emu/video/resnet.c index 2acba3d1d46..c17b2e67623 100644 --- a/src/emu/video/resnet.c +++ b/src/emu/video/resnet.c @@ -260,8 +260,8 @@ double compute_resistor_net_outputs( /* parse input parameters */ - o = (double *)malloc_or_die( sizeof(double) * (1<<MAX_RES_PER_NET) * MAX_NETS); - os = (double *)malloc_or_die( sizeof(double) * (1<<MAX_RES_PER_NET) * MAX_NETS); + o = alloc_array_or_die(double, (1<<MAX_RES_PER_NET) * MAX_NETS); + os = alloc_array_or_die(double, (1<<MAX_RES_PER_NET) * MAX_NETS); networks_no = 0; for (n = 0; n < MAX_NETS; n++) @@ -700,7 +700,7 @@ rgb_t *compute_res_net_all(const UINT8 *prom, const res_net_decode_info *rdi, co int i,j,k; rgb_t *rgb; - rgb = (rgb_t *)malloc_or_die((rdi->end - rdi->start + 1)*sizeof(rgb_t)); + rgb = alloc_array_or_die(rgb_t, rdi->end - rdi->start + 1); for (i=rdi->start; i<=rdi->end; i++) { UINT8 t[3] = {0,0,0}; diff --git a/src/emu/video/s2636.c b/src/emu/video/s2636.c index f52f172f951..b539415f814 100644 --- a/src/emu/video/s2636.c +++ b/src/emu/video/s2636.c @@ -117,19 +117,19 @@ struct _s2636_t * *************************************/ -s2636_t *s2636_config(UINT8 *work_ram, int screen_height, int screen_width, int y_offset, int x_offset) +s2636_t *s2636_config(running_machine *machine, UINT8 *work_ram, int screen_height, int screen_width, int y_offset, int x_offset) { s2636_t *s2636; /* allocate the object that holds the state */ - s2636 = (s2636_t *)auto_malloc(sizeof(*s2636)); + s2636 = auto_alloc(machine, s2636_t); s2636->work_ram = work_ram; s2636->y_offset = y_offset; s2636->x_offset = x_offset; - s2636->bitmap = auto_bitmap_alloc(screen_width, screen_height, BITMAP_FORMAT_INDEXED16); - s2636->collision_bitmap = auto_bitmap_alloc(screen_width, screen_height, BITMAP_FORMAT_INDEXED16); + s2636->bitmap = auto_bitmap_alloc(machine, screen_width, screen_height, BITMAP_FORMAT_INDEXED16); + s2636->collision_bitmap = auto_bitmap_alloc(machine, screen_width, screen_height, BITMAP_FORMAT_INDEXED16); return s2636; } diff --git a/src/emu/video/s2636.h b/src/emu/video/s2636.h index 17dce840297..ad2034dea53 100644 --- a/src/emu/video/s2636.h +++ b/src/emu/video/s2636.h @@ -14,7 +14,7 @@ typedef struct _s2636_t s2636_t; #define S2636_IS_PIXEL_DRAWN(p) (((p) & 0x08) ? TRUE : FALSE) #define S2636_PIXEL_COLOR(p) ((p) & 0x07) -s2636_t *s2636_config(UINT8 *work_ram, int screen_height, int screen_width, int y_offset, int x_offset); +s2636_t *s2636_config(running_machine *machine, UINT8 *work_ram, int screen_height, int screen_width, int y_offset, int x_offset); /* returns a BITMAP_FORMAT_INDEXED16 bitmap the size of the screen D0-D2 of each pixel is the pixel color diff --git a/src/emu/video/tms34061.c b/src/emu/video/tms34061.c index f94edb7fec3..68d3291419d 100644 --- a/src/emu/video/tms34061.c +++ b/src/emu/video/tms34061.c @@ -84,14 +84,12 @@ void tms34061_start(running_machine *machine, const struct tms34061_interface *i tms34061.vrammask = tms34061.intf.vramsize - 1; /* allocate memory for VRAM */ - tms34061.vram = (UINT8 *)auto_malloc(tms34061.intf.vramsize + 256 * 2); - memset(tms34061.vram, 0, tms34061.intf.vramsize + 256 * 2); + tms34061.vram = auto_alloc_array_clear(machine, UINT8, tms34061.intf.vramsize + 256 * 2); /* not really a save state, just there for debugging purposes */ state_save_register_global_pointer(machine, tms34061.vram, tms34061.intf.vramsize); /* allocate memory for latch RAM */ - tms34061.latchram = (UINT8 *)auto_malloc(tms34061.intf.vramsize + 256 * 2); - memset(tms34061.latchram, 0, tms34061.intf.vramsize + 256 * 2); + tms34061.latchram = auto_alloc_array_clear(machine, UINT8, tms34061.intf.vramsize + 256 * 2); /* add some buffer space for VRAM and latch RAM */ tms34061.vram += 256; diff --git a/src/emu/video/tms9928a.c b/src/emu/video/tms9928a.c index 85367e1646b..615f2d982e3 100644 --- a/src/emu/video/tms9928a.c +++ b/src/emu/video/tms9928a.c @@ -200,14 +200,13 @@ static void TMS9928A_start (running_machine *machine, const TMS9928a_interface * /* Video RAM */ tms.vramsize = intf->vram; - tms.vMem = (UINT8*) auto_malloc (intf->vram); - memset (tms.vMem, 0, intf->vram); + tms.vMem = auto_alloc_array_clear(machine, UINT8, intf->vram); /* Sprite back buffer */ - tms.dBackMem = (UINT8*)auto_malloc (IMAGE_SIZE); + tms.dBackMem = auto_alloc_array(machine, UINT8, IMAGE_SIZE); /* back bitmap */ - tms.tmpbmp = auto_bitmap_alloc (256, 192, video_screen_get_format(machine->primary_screen)); + tms.tmpbmp = auto_bitmap_alloc (machine, 256, 192, video_screen_get_format(machine->primary_screen)); TMS9928A_reset (); tms.LimitSprites = 1; diff --git a/src/emu/video/v9938.c b/src/emu/video/v9938.c index 70072ae1eb5..512564b2331 100644 --- a/src/emu/video/v9938.c +++ b/src/emu/video/v9938.c @@ -164,7 +164,7 @@ PALETTE_INIT( v9958 ) PALETTE_INIT_CALL(v9938); /* set up YJK table */ - pal_indYJK = (UINT16 *)auto_malloc(0x20000 * sizeof(UINT16)); + pal_indYJK = auto_alloc_array(machine, UINT16, 0x20000); LOG(("Building YJK table for V9958 screens, may take a while ... \n")); i = 0; @@ -494,8 +494,7 @@ void v9938_init (running_machine *machine, int which, const device_config *scree vdp->size_old = -1; /* allocate VRAM */ - vdp->vram = (UINT8 *)auto_malloc (0x20000); - memset (vdp->vram, 0, 0x20000); + vdp->vram = auto_alloc_array_clear(machine, UINT8, 0x20000); if (vdp->vram_size < 0x20000) { /* set unavailable RAM to 0xff */ @@ -504,10 +503,7 @@ void v9938_init (running_machine *machine, int which, const device_config *scree /* do we have expanded memory? */ if (vdp->vram_size > 0x20000) - { - vdp->vram_exp = (UINT8 *)auto_malloc (0x10000); - memset (vdp->vram_exp, 0, 0x10000); - } + vdp->vram_exp = auto_alloc_array_clear(machine, UINT8, 0x10000); else vdp->vram_exp = NULL; diff --git a/src/emu/video/vector.c b/src/emu/video/vector.c index 3ab6f36a703..0c664e77178 100644 --- a/src/emu/video/vector.c +++ b/src/emu/video/vector.c @@ -184,7 +184,7 @@ VIDEO_START( vector ) vector_index = 0; /* allocate memory for tables */ - vector_list = (point *)auto_malloc (MAX_POINTS * sizeof (vector_list[0])); + vector_list = auto_alloc_array(machine, point, MAX_POINTS); } diff --git a/src/emu/video/voodoo.c b/src/emu/video/voodoo.c index 7644c5dc6fd..9b455699dcf 100644 --- a/src/emu/video/voodoo.c +++ b/src/emu/video/voodoo.c @@ -4471,7 +4471,7 @@ static DEVICE_START( voodoo ) /* create a multiprocessor work queue */ v->poly = poly_alloc(device->machine, 64, sizeof(poly_extra_data), 0); - v->thread_stats = (stats_block *)auto_malloc(sizeof(v->thread_stats[0]) * WORK_MAX_THREADS); + v->thread_stats = auto_alloc_array(device->machine, stats_block, WORK_MAX_THREADS); /* create a table of precomputed 1/n and log2(n) values */ /* n ranges from 1.0000 to 2.0000 */ @@ -4565,14 +4565,14 @@ static DEVICE_START( voodoo ) if (config->type <= VOODOO_2) { /* separate FB/TMU memory */ - fbmem = auto_malloc(config->fbmem << 20); - tmumem[0] = auto_malloc(config->tmumem0 << 20); - tmumem[1] = (config->tmumem1 != 0) ? auto_malloc(config->tmumem1 << 20) : NULL; + fbmem = auto_alloc_array(device->machine, UINT8, config->fbmem << 20); + tmumem[0] = auto_alloc_array(device->machine, UINT8, config->tmumem0 << 20); + tmumem[1] = (config->tmumem1 != 0) ? auto_alloc_array(device->machine, UINT8, config->tmumem1 << 20) : NULL; } else { /* shared memory */ - tmumem[0] = tmumem[1] = fbmem = auto_malloc(config->fbmem << 20); + tmumem[0] = tmumem[1] = fbmem = auto_alloc_array(device->machine, UINT8, config->fbmem << 20); tmumem0 = config->fbmem; } diff --git a/src/ldplayer/ldplayer.c b/src/ldplayer/ldplayer.c index 14995fe0449..3be984e31a5 100644 --- a/src/ldplayer/ldplayer.c +++ b/src/ldplayer/ldplayer.c @@ -122,7 +122,7 @@ static chd_file *get_disc(const device_config *device) chderr = chd_open_file(mame_core_file(image_file), CHD_OPEN_READ, NULL, &image_chd); if (chderr == CHDERR_NONE) { - set_disk_handle("laserdisc", image_file, image_chd); + set_disk_handle(device->machine, "laserdisc", image_file, image_chd); filename = astring_dupc(dir->name); add_exit_callback(device->machine, free_string); break; diff --git a/src/mame/audio/amiga.c b/src/mame/audio/amiga.c index 2a879e0ded2..9f35ea17f6e 100644 --- a/src/mame/audio/amiga.c +++ b/src/mame/audio/amiga.c @@ -124,7 +124,7 @@ void amiga_audio_update(void) static STREAM_UPDATE( amiga_stream_update ) { - amiga_audio *audio = param; + amiga_audio *audio = (amiga_audio *)param; int channum, sampoffs = 0; /* if all DMA off, disable all channels */ @@ -267,7 +267,7 @@ static DEVICE_START( amiga_sound ) int i; /* allocate a new audio state */ - audio_state = device->token; + audio_state = (amiga_audio *)device->token; for (i = 0; i < 4; i++) { audio_state->channel[i].index = i; diff --git a/src/mame/audio/attckufo.c b/src/mame/audio/attckufo.c index d59717a9618..9330ee29728 100644 --- a/src/mame/audio/attckufo.c +++ b/src/mame/audio/attckufo.c @@ -219,7 +219,7 @@ static DEVICE_START( attckufo_sound ) noisesize = NOISE_FREQUENCY_MAX * NOISE_BUFFER_SIZE_SEC; noisepos = 0; noisesamples = 1; - noise = (INT8*) auto_malloc (noisesize * sizeof (noise[0])); + noise = auto_alloc_array(device->machine, INT8, noisesize); { int noiseshift = 0x7ffff8; char data; @@ -254,7 +254,7 @@ static DEVICE_START( attckufo_sound ) tone1pos = tone2pos = tone3pos = 0; tone1samples = tone2samples = tone3samples = 1; - tone = (INT16*) auto_malloc (tonesize * sizeof (tone[0])); + tone = auto_alloc_array(device->machine, INT16, tonesize); for (i = 0; i < tonesize; i++) { diff --git a/src/mame/audio/bzone.c b/src/mame/audio/bzone.c index 4b1088460a7..f21a83c44a2 100644 --- a/src/mame/audio/bzone.c +++ b/src/mame/audio/bzone.c @@ -274,7 +274,7 @@ static DEVICE_START( bzone_sound ) { int i; - discharge = (INT16 *)auto_malloc(32768 * sizeof(INT16)); + discharge = auto_alloc_array(device->machine, INT16, 32768); for( i = 0; i < 0x8000; i++ ) discharge[0x7fff-i] = (INT16) (0x7fff/exp(1.0*i/4096)); diff --git a/src/mame/audio/cclimber.c b/src/mame/audio/cclimber.c index a296ac5aad5..0a0b1fe0f0a 100644 --- a/src/mame/audio/cclimber.c +++ b/src/mame/audio/cclimber.c @@ -18,7 +18,7 @@ static SAMPLES_START( cclimber_sh_start ) running_machine *machine = device->machine; samplebuf = 0; if (memory_region(machine, "samples")) - samplebuf = auto_malloc(sizeof(*samplebuf)*2*memory_region_length(machine, "samples")); + samplebuf = auto_alloc_array(machine, INT16, 2 * memory_region_length(machine, "samples")); } diff --git a/src/mame/audio/dcs.c b/src/mame/audio/dcs.c index 0802cc740e3..a6fbca64890 100644 --- a/src/mame/audio/dcs.c +++ b/src/mame/audio/dcs.c @@ -997,7 +997,7 @@ void dcs2_init(running_machine *machine, int dram_in_mb, offs_t polling_offset) /* supports both RAM and ROM variants */ if (dram_in_mb != 0) { - dcs.sounddata = auto_malloc(dram_in_mb << 20); + dcs.sounddata = auto_alloc_array(machine, UINT16, dram_in_mb << (20-1)); dcs.sounddata_words = (dram_in_mb << 20) / 2; } else @@ -1010,7 +1010,7 @@ void dcs2_init(running_machine *machine, int dram_in_mb, offs_t polling_offset) memory_configure_bank(machine, 20, 0, dcs.sounddata_banks, dcs.sounddata, soundbank_words*2); /* allocate memory for the SRAM */ - dcs_sram = auto_malloc(0x8000*4); + dcs_sram = auto_alloc_array(machine, UINT16, 0x8000*4/2); /* create the timers */ dcs.internal_timer = timer_alloc(machine, internal_timer_callback, NULL); @@ -1114,24 +1114,24 @@ static void sdrc_remap_memory(running_machine *machine) /* if SRAM disabled, clean it out */ if (SDRC_SM_EN == 0) { - memory_install_readwrite32_handler(dcs.program, 0x0800, 0x3fff, 0, 0, SMH_UNMAP, SMH_UNMAP); - memory_install_readwrite16_handler(dcs.data, 0x0800, 0x37ff, 0, 0, SMH_UNMAP, SMH_UNMAP); + memory_install_readwrite32_handler(dcs.program, 0x0800, 0x3fff, 0, 0, (read32_space_func)SMH_UNMAP, (write32_space_func)SMH_UNMAP); + memory_install_readwrite16_handler(dcs.data, 0x0800, 0x37ff, 0, 0, (read16_space_func)SMH_UNMAP, (write16_space_func)SMH_UNMAP); } /* otherwise, map the SRAM */ else { /* first start with a clean program map */ - memory_install_readwrite32_handler(dcs.program, 0x0800, 0x3fff, 0, 0, SMH_BANK21, SMH_BANK21); + memory_install_readwrite32_handler(dcs.program, 0x0800, 0x3fff, 0, 0, (read32_space_func)SMH_BANK(21), (write32_space_func)SMH_BANK(21)); memory_set_bankptr(machine, 21, dcs_sram + 0x4800); /* set up the data map based on the SRAM banking */ /* map 0: ram from 0800-37ff */ if (SDRC_SM_BK == 0) { - memory_install_readwrite16_handler(dcs.data, 0x0800, 0x17ff, 0, 0, SMH_BANK22, SMH_BANK22); - memory_install_readwrite16_handler(dcs.data, 0x1800, 0x27ff, 0, 0, SMH_BANK23, SMH_BANK23); - memory_install_readwrite16_handler(dcs.data, 0x2800, 0x37ff, 0, 0, SMH_BANK24, SMH_BANK24); + memory_install_readwrite16_handler(dcs.data, 0x0800, 0x17ff, 0, 0, (read16_space_func)SMH_BANK(22), (write16_space_func)SMH_BANK(22)); + memory_install_readwrite16_handler(dcs.data, 0x1800, 0x27ff, 0, 0, (read16_space_func)SMH_BANK(23), (write16_space_func)SMH_BANK(23)); + memory_install_readwrite16_handler(dcs.data, 0x2800, 0x37ff, 0, 0, (read16_space_func)SMH_BANK(24), (write16_space_func)SMH_BANK(24)); memory_set_bankptr(machine, 22, dcs_sram + 0x0000); memory_set_bankptr(machine, 23, dcs_sram + 0x1000); memory_set_bankptr(machine, 24, dcs_sram + 0x2000); @@ -1140,9 +1140,9 @@ static void sdrc_remap_memory(running_machine *machine) /* map 1: nothing from 0800-17ff, alternate RAM at 1800-27ff, same RAM at 2800-37ff */ else { - memory_install_readwrite16_handler(dcs.data, 0x0800, 0x17ff, 0, 0, SMH_UNMAP, SMH_UNMAP); - memory_install_readwrite16_handler(dcs.data, 0x1800, 0x27ff, 0, 0, SMH_BANK23, SMH_BANK23); - memory_install_readwrite16_handler(dcs.data, 0x2800, 0x37ff, 0, 0, SMH_BANK24, SMH_BANK24); + memory_install_readwrite16_handler(dcs.data, 0x0800, 0x17ff, 0, 0, (read16_space_func)SMH_UNMAP, (write16_space_func)SMH_UNMAP); + memory_install_readwrite16_handler(dcs.data, 0x1800, 0x27ff, 0, 0, (read16_space_func)SMH_BANK(23), (write16_space_func)SMH_BANK(23)); + memory_install_readwrite16_handler(dcs.data, 0x2800, 0x37ff, 0, 0, (read16_space_func)SMH_BANK(24), (write16_space_func)SMH_BANK(24)); memory_set_bankptr(machine, 23, dcs_sram + 0x3000); memory_set_bankptr(machine, 24, dcs_sram + 0x2000); } @@ -1153,14 +1153,14 @@ static void sdrc_remap_memory(running_machine *machine) { int baseaddr = (SDRC_ROM_ST == 0) ? 0x0000 : (SDRC_ROM_ST == 1) ? 0x3000 : 0x3400; int pagesize = (SDRC_ROM_SZ == 0 && SDRC_ROM_ST != 0) ? 4096 : 1024; - memory_install_read16_handler(dcs.data, baseaddr, baseaddr + pagesize - 1, 0, 0, SMH_BANK25); + memory_install_read16_handler(dcs.data, baseaddr, baseaddr + pagesize - 1, 0, 0, (read16_space_func)SMH_BANK(25)); } /* map the DRAM page as bank 26 */ if (SDRC_DM_ST != 0) { int baseaddr = (SDRC_DM_ST == 1) ? 0x0000 : (SDRC_DM_ST == 2) ? 0x3000 : 0x3400; - memory_install_readwrite16_handler(dcs.data, baseaddr, baseaddr + 0x3ff, 0, 0, SMH_BANK26, SMH_BANK26); + memory_install_readwrite16_handler(dcs.data, baseaddr, baseaddr + 0x3ff, 0, 0, (read16_space_func)SMH_BANK(26), (write16_space_func)SMH_BANK(26)); } /* update the bank pointers */ diff --git a/src/mame/audio/exidy440.c b/src/mame/audio/exidy440.c index 7b5d9d754fd..e6922c7ada1 100644 --- a/src/mame/audio/exidy440.c +++ b/src/mame/audio/exidy440.c @@ -166,14 +166,14 @@ static DEVICE_START( exidy440_sound ) /* allocate the sample cache */ length = memory_region_length(machine, "cvsd") * 16 + MAX_CACHE_ENTRIES * sizeof(sound_cache_entry); - sound_cache = auto_malloc(length); + sound_cache = (sound_cache_entry *)auto_alloc_array(machine, UINT8, length); /* determine the hard end of the cache and reset */ sound_cache_max = (sound_cache_entry *)((UINT8 *)sound_cache + length); reset_sound_cache(); /* allocate the mixer buffer */ - mixer_buffer_left = auto_malloc(2 * device->clock * sizeof(INT32)); + mixer_buffer_left = auto_alloc_array(machine, INT32, 2 * device->clock); mixer_buffer_right = mixer_buffer_left + device->clock; if (SOUND_LOG) diff --git a/src/mame/audio/fghtbskt.c b/src/mame/audio/fghtbskt.c index 9d2406da3e2..f9f29f5b012 100644 --- a/src/mame/audio/fghtbskt.c +++ b/src/mame/audio/fghtbskt.c @@ -24,7 +24,7 @@ SAMPLES_START( fghtbskt_sh_start ) int i, len = memory_region_length(machine, "samples"); UINT8 *ROM = memory_region(machine, "samples"); - samplebuf = auto_malloc(len * 2); + samplebuf = auto_alloc_array(machine, INT16, len); for(i=0;i<len;i++) samplebuf[i] = ((INT8)(ROM[i] ^ 0x80)) * 256; diff --git a/src/mame/audio/flower.c b/src/mame/audio/flower.c index d699ae3d4d8..6ade6689322 100644 --- a/src/mame/audio/flower.c +++ b/src/mame/audio/flower.c @@ -52,13 +52,13 @@ static short *mixer_buffer_2; /* build a table to divide by the number of voices; gain is specified as gain*16 */ -static void make_mixer_table(int voices, int gain) +static void make_mixer_table(running_machine *machine, int voices, int gain) { int count = voices * 128; int i; /* allocate memory */ - mixer_table = auto_malloc(256 * voices * sizeof(INT16)); + mixer_table = auto_alloc_array(machine, INT16, 256 * voices); /* find the middle of the table */ mixer_lookup = mixer_table + (128 * voices); @@ -162,11 +162,11 @@ static DEVICE_START( flower_sound ) stream = stream_create(device, 0, 1, samplerate, 0, flower_update_mono); /* allocate a pair of buffers to mix into - 1 second's worth should be more than enough */ - mixer_buffer = auto_malloc(2 * sizeof(short) * samplerate); + mixer_buffer = auto_alloc_array(device->machine, short, 2 * samplerate); mixer_buffer_2 = mixer_buffer + samplerate; /* build the mixer table */ - make_mixer_table(8, defgain); + make_mixer_table(machine, 8, defgain); /* extract globals from the interface */ num_voices = 8; diff --git a/src/mame/audio/galaxian.c b/src/mame/audio/galaxian.c index 11b371b8d8e..35f9bd3673c 100644 --- a/src/mame/audio/galaxian.c +++ b/src/mame/audio/galaxian.c @@ -197,12 +197,12 @@ static SAMPLES_START( galaxian_sh_start ) sample_set_volume(device, CHANNEL_LFO+1, LFO_VOLUME); sample_set_volume(device, CHANNEL_LFO+2, LFO_VOLUME); - noisewave = auto_malloc(NOISE_LENGTH * sizeof(INT16)); + noisewave = auto_alloc_array(machine, INT16, NOISE_LENGTH); #define SHOOT_SEC 2 shoot_rate = machine->sample_rate; shoot_length = SHOOT_SEC * shoot_rate; - shootwave = auto_malloc(shoot_length * sizeof(INT16)); + shootwave = auto_alloc_array(machine, INT16, shoot_length); /* * The RNG shifter is clocked with RNG_RATE, bit 17 is diff --git a/src/mame/audio/geebee.c b/src/mame/audio/geebee.c index 26f3922469f..b19085161ad 100644 --- a/src/mame/audio/geebee.c +++ b/src/mame/audio/geebee.c @@ -116,7 +116,7 @@ static DEVICE_START( geebee_sound ) running_machine *machine = device->machine; int i; - decay = (UINT16 *)auto_malloc(32768 * sizeof(INT16)); + decay = auto_alloc_array(machine, UINT16, 32768); for( i = 0; i < 0x8000; i++ ) decay[0x7fff-i] = (INT16) (0x7fff/exp(1.0*i/4096)); diff --git a/src/mame/audio/gomoku.c b/src/mame/audio/gomoku.c index 4d33932d43f..9bdda0d7bc5 100644 --- a/src/mame/audio/gomoku.c +++ b/src/mame/audio/gomoku.c @@ -53,13 +53,13 @@ static short *mixer_buffer_2; /* build a table to divide by the number of voices; gain is specified as gain*16 */ -static void make_mixer_table(int voices, int gain) +static void make_mixer_table(running_machine *machine, int voices, int gain) { int count = voices * 128; int i; /* allocate memory */ - mixer_table = auto_malloc(256 * voices * sizeof(INT16)); + mixer_table = auto_alloc_array(machine, INT16, 256 * voices); /* find the middle of the table */ mixer_lookup = mixer_table + (128 * voices); @@ -170,11 +170,11 @@ static DEVICE_START( gomoku_sound ) stream = stream_create(device, 0, 1, samplerate, NULL, gomoku_update_mono); /* allocate a pair of buffers to mix into - 1 second's worth should be more than enough */ - mixer_buffer = auto_malloc(2 * sizeof(short) * samplerate); + mixer_buffer = auto_alloc_array(machine, short, 2 * samplerate); mixer_buffer_2 = mixer_buffer + samplerate; /* build the mixer table */ - make_mixer_table(8, defgain); + make_mixer_table(machine, 8, defgain); /* extract globals from the interface */ num_voices = MAX_VOICES; diff --git a/src/mame/audio/harddriv.c b/src/mame/audio/harddriv.c index 7f1bab012db..b5cb894a5dc 100644 --- a/src/mame/audio/harddriv.c +++ b/src/mame/audio/harddriv.c @@ -53,7 +53,7 @@ void hdsnd_init(running_machine *machine) { rombase = (UINT8 *)memory_region(machine, "serialroms"); romsize = memory_region_length(machine, "serialroms"); - comram = (UINT16 *)auto_malloc(0x400); + comram = auto_alloc_array(machine, UINT16, 0x400/2); last_bio_cycles = 0; } diff --git a/src/mame/audio/leland.c b/src/mame/audio/leland.c index 6c5f0105f91..fb7b423923c 100644 --- a/src/mame/audio/leland.c +++ b/src/mame/audio/leland.c @@ -142,8 +142,8 @@ static DEVICE_START( leland_sound ) dac_stream = stream_create(device, 0, 1, 256*60, NULL, leland_update); /* allocate memory */ - dac_buffer[0] = auto_malloc(DAC_BUFFER_SIZE); - dac_buffer[1] = auto_malloc(DAC_BUFFER_SIZE); + dac_buffer[0] = auto_alloc_array(device->machine, UINT8, DAC_BUFFER_SIZE); + dac_buffer[1] = auto_alloc_array(device->machine, UINT8, DAC_BUFFER_SIZE); } diff --git a/src/mame/audio/mario.c b/src/mame/audio/mario.c index d4f0c77ff7b..a7598c0244d 100644 --- a/src/mame/audio/mario.c +++ b/src/mame/audio/mario.c @@ -390,7 +390,7 @@ static SOUND_START( mario ) if (audiocpu != NULL && cpu_get_type(audiocpu) != CPU_Z80) { state->eabank = 1; - memory_install_read8_handler(cpu_get_address_space(audiocpu, ADDRESS_SPACE_PROGRAM), 0x000, 0x7ff, 0, 0, SMH_BANK1); + memory_install_read8_handler(cpu_get_address_space(audiocpu, ADDRESS_SPACE_PROGRAM), 0x000, 0x7ff, 0, 0, (read8_space_func)SMH_BANK(1)); memory_configure_bank(machine, 1, 0, 1, memory_region(machine, "audiocpu"), 0); memory_configure_bank(machine, 1, 1, 1, memory_region(machine, "audiocpu") + 0x1000, 0x800); } diff --git a/src/mame/audio/phoenix.c b/src/mame/audio/phoenix.c index b414e7c0adb..9f7eef89496 100644 --- a/src/mame/audio/phoenix.c +++ b/src/mame/audio/phoenix.c @@ -524,7 +524,7 @@ static DEVICE_START( phoenix_sound ) int i, j; UINT32 shiftreg; - poly18 = (UINT32 *)auto_malloc((1ul << (18-5)) * sizeof(UINT32)); + poly18 = auto_alloc_array(machine, UINT32, 1ul << (18-5)); shiftreg = 0; for( i = 0; i < (1ul << (18-5)); i++ ) diff --git a/src/mame/audio/pleiads.c b/src/mame/audio/pleiads.c index be00549795a..b7844a4c51e 100644 --- a/src/mame/audio/pleiads.c +++ b/src/mame/audio/pleiads.c @@ -459,7 +459,7 @@ static DEVICE_START( common_sh_start ) int i, j; UINT32 shiftreg; - poly18 = (UINT32 *)auto_malloc((1ul << (18-5)) * sizeof(UINT32)); + poly18 = auto_alloc_array(machine, UINT32, 1ul << (18-5)); shiftreg = 0; for( i = 0; i < (1ul << (18-5)); i++ ) diff --git a/src/mame/audio/redbaron.c b/src/mame/audio/redbaron.c index 24fd47dc150..4e46d5bae21 100644 --- a/src/mame/audio/redbaron.c +++ b/src/mame/audio/redbaron.c @@ -172,7 +172,7 @@ static DEVICE_START( redbaron_sound ) { int i; - vol_lookup = (INT16 *)auto_malloc(32768 * sizeof(INT16)); + vol_lookup = auto_alloc_array(device->machine, INT16, 32768); for( i = 0; i < 0x8000; i++ ) vol_lookup[0x7fff-i] = (INT16) (0x7fff/exp(1.0*i/4096)); diff --git a/src/mame/audio/segasnd.c b/src/mame/audio/segasnd.c index f55b3a8aa7b..0a7d042454b 100644 --- a/src/mame/audio/segasnd.c +++ b/src/mame/audio/segasnd.c @@ -650,7 +650,7 @@ static DEVICE_START( usb_sound ) assert(usb.cpu != NULL); /* allocate work RAM */ - usb.work_ram = auto_malloc(0x400); + usb.work_ram = auto_alloc_array(machine, UINT8, 0x400); /* create a sound stream */ usb.stream = stream_create(device, 0, 1, SAMPLE_RATE, NULL, usb_stream_update); diff --git a/src/mame/audio/seibu.c b/src/mame/audio/seibu.c index 20e1230a596..f43424e1ae7 100644 --- a/src/mame/audio/seibu.c +++ b/src/mame/audio/seibu.c @@ -105,7 +105,7 @@ static UINT8 decrypt_opcode(int a,int src) void seibu_sound_decrypt(running_machine *machine,const char *cpu,int length) { const address_space *space = cputag_get_address_space(machine, cpu, ADDRESS_SPACE_PROGRAM); - UINT8 *decrypt = auto_malloc(length); + UINT8 *decrypt = auto_alloc_array(machine, UINT8, length); UINT8 *rom = memory_region(machine, cpu); int i; diff --git a/src/mame/audio/senjyo.c b/src/mame/audio/senjyo.c index ad5e3636d2d..a650c888ef5 100644 --- a/src/mame/audio/senjyo.c +++ b/src/mame/audio/senjyo.c @@ -76,7 +76,7 @@ SAMPLES_START( senjyo_sh_start ) running_machine *machine = device->machine; int i; - _single = (INT16 *)auto_malloc(SINGLE_LENGTH*2); + _single = auto_alloc_array(machine, INT16, SINGLE_LENGTH); for (i = 0;i < SINGLE_LENGTH;i++) /* freq = ctc2 zco / 8 */ _single[i] = ((i/SINGLE_DIVIDER)&0x01)*127*256; diff --git a/src/mame/audio/suna8.c b/src/mame/audio/suna8.c index 96992c738bf..c4b8b35c075 100644 --- a/src/mame/audio/suna8.c +++ b/src/mame/audio/suna8.c @@ -51,7 +51,7 @@ SAMPLES_START( suna8_sh_start ) int i, len = memory_region_length(machine, "samples"); UINT8 *ROM = memory_region(machine, "samples"); - samplebuf = auto_malloc(len * sizeof(samplebuf[0])); + samplebuf = auto_alloc_array(machine, INT16, len); for(i=0;i<len;i++) samplebuf[i] = (INT8)(ROM[i] ^ 0x80) * 256; diff --git a/src/mame/audio/warpwarp.c b/src/mame/audio/warpwarp.c index 95014f1b2be..80bcd5d5c84 100644 --- a/src/mame/audio/warpwarp.c +++ b/src/mame/audio/warpwarp.c @@ -208,7 +208,7 @@ static DEVICE_START( warpwarp_sound ) running_machine *machine = device->machine; int i; - decay = (INT16 *) auto_malloc(32768 * sizeof(INT16)); + decay = auto_alloc_array(machine, INT16, 32768); for( i = 0; i < 0x8000; i++ ) decay[0x7fff-i] = (INT16) (0x7fff/exp(1.0*i/4096)); diff --git a/src/mame/audio/wiping.c b/src/mame/audio/wiping.c index 5c4ee7feabb..999927b64a8 100644 --- a/src/mame/audio/wiping.c +++ b/src/mame/audio/wiping.c @@ -52,13 +52,13 @@ static short *mixer_buffer_2; /* build a table to divide by the number of voices; gain is specified as gain*16 */ -static void make_mixer_table(int voices, int gain) +static void make_mixer_table(running_machine *machine, int voices, int gain) { int count = voices * 128; int i; /* allocate memory */ - mixer_table = auto_malloc(256 * voices * sizeof(INT16)); + mixer_table = auto_alloc_array(machine, INT16, 256 * voices); /* find the middle of the table */ mixer_lookup = mixer_table + (128 * voices); @@ -167,11 +167,11 @@ static DEVICE_START( wiping_sound ) stream = stream_create(device, 0, 1, samplerate, NULL, wiping_update_mono); /* allocate a pair of buffers to mix into - 1 second's worth should be more than enough */ - mixer_buffer = auto_malloc(2 * sizeof(short) * samplerate); + mixer_buffer = auto_alloc_array(machine, short, 2 * samplerate); mixer_buffer_2 = mixer_buffer + samplerate; /* build the mixer table */ - make_mixer_table(8, defgain); + make_mixer_table(device->machine, 8, defgain); /* extract globals from the interface */ num_voices = 8; diff --git a/src/mame/drivers/acommand.c b/src/mame/drivers/acommand.c index bc079b80539..885dbf308cd 100644 --- a/src/mame/drivers/acommand.c +++ b/src/mame/drivers/acommand.c @@ -155,7 +155,7 @@ static VIDEO_START( acommand ) tx_tilemap = tilemap_create(machine, ac_get_tx_tile_info,tilemap_scan_cols,8,8,512,32); bg_tilemap = tilemap_create(machine, ac_get_bg_tile_info,bg_scan,16,16,256,16); - ac_vregs = auto_malloc(0x80); + ac_vregs = auto_alloc_array(machine, UINT16, 0x80/2); tilemap_set_transparent_pen(tx_tilemap,15); } diff --git a/src/mame/drivers/adp.c b/src/mame/drivers/adp.c index c595ff4340a..e14ef09cf9d 100644 --- a/src/mame/drivers/adp.c +++ b/src/mame/drivers/adp.c @@ -241,7 +241,7 @@ static VIDEO_START(adp) // UINT32 i; // UINT16 *prgrom = (UINT16*)memory_region(machine, "maincpu"); - HD63484_start(); + HD63484_start(machine); // for (i = 0; i < 0x70000; i++) // HD63484_ram[0x90000 + i] = prgrom[i]; diff --git a/src/mame/drivers/alg.c b/src/mame/drivers/alg.c index 6b5d4ff0614..b47915d18db 100644 --- a/src/mame/drivers/alg.c +++ b/src/mame/drivers/alg.c @@ -198,17 +198,19 @@ static CUSTOM_INPUT( lightgun_holster_r ) static WRITE8_DEVICE_HANDLER( alg_cia_0_porta_w ) { + const address_space *space = cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM); + /* switch banks as appropriate */ memory_set_bank(device->machine, 1, data & 1); /* swap the write handlers between ROM and bank 1 based on the bit */ if ((data & 1) == 0) /* overlay disabled, map RAM on 0x000000 */ - memory_install_write16_handler(cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, SMH_BANK1); + memory_install_write16_handler(space, 0x000000, 0x07ffff, 0, 0, (write16_space_func)SMH_BANK(1)); else /* overlay enabled, map Amiga system ROM on 0x000000 */ - memory_install_write16_handler(cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, SMH_UNMAP); + memory_install_write16_handler(space, 0x000000, 0x07ffff, 0, 0, (write16_space_func)SMH_UNMAP); } @@ -683,7 +685,7 @@ static DRIVER_INIT( palr1 ) { UINT32 length = memory_region_length(machine, "user2"); UINT8 *rom = memory_region(machine, "user2"); - UINT8 *original = malloc_or_die(length); + UINT8 *original = alloc_array_or_die(UINT8, length); UINT32 srcaddr; memcpy(original, rom, length); @@ -703,7 +705,7 @@ static DRIVER_INIT( palr3 ) { UINT32 length = memory_region_length(machine, "user2"); UINT8 *rom = memory_region(machine, "user2"); - UINT8 *original = malloc_or_die(length); + UINT8 *original = alloc_array_or_die(UINT8, length); UINT32 srcaddr; memcpy(original, rom, length); @@ -722,7 +724,7 @@ static DRIVER_INIT( palr6 ) { UINT32 length = memory_region_length(machine, "user2"); UINT8 *rom = memory_region(machine, "user2"); - UINT8 *original = malloc_or_die(length); + UINT8 *original = alloc_array_or_die(UINT8, length); UINT32 srcaddr; memcpy(original, rom, length); @@ -743,7 +745,7 @@ static DRIVER_INIT( aplatoon ) { /* NOT DONE TODO FIGURE OUT THE RIGHT ORDER!!!! */ UINT8 *rom = memory_region(machine, "user2"); - char *decrypted = auto_malloc(0x40000); + UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0x40000); int i; static const int shuffle[] = diff --git a/src/mame/drivers/arcadia.c b/src/mame/drivers/arcadia.c index a2ee9687e6c..29cfb2c12bc 100644 --- a/src/mame/drivers/arcadia.c +++ b/src/mame/drivers/arcadia.c @@ -72,7 +72,7 @@ static UINT8 coin_counter[2]; static WRITE16_HANDLER( arcadia_multibios_change_game ) { - memory_install_read16_handler(space, 0x800000, 0x97ffff, 0, 0, (data == 0) ? SMH_BANK2 : SMH_NOP); + memory_install_read16_handler(space, 0x800000, 0x97ffff, 0, 0, (data == 0) ? SMH_BANK(2) : SMH_NOP); } @@ -100,11 +100,11 @@ static WRITE8_DEVICE_HANDLER( arcadia_cia_0_porta_w ) /* swap the write handlers between ROM and bank 1 based on the bit */ if ((data & 1) == 0) /* overlay disabled, map RAM on 0x000000 */ - memory_install_write16_handler(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, SMH_BANK1); + memory_install_write16_handler(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, (write16_space_func)SMH_BANK(1)); else /* overlay enabled, map Amiga system ROM on 0x000000 */ - memory_install_write16_handler(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, SMH_UNMAP); + memory_install_write16_handler(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, (write16_space_func)SMH_UNMAP); /* bit 2 = Power Led on Amiga */ set_led_status(0, (data & 2) ? 0 : 1); diff --git a/src/mame/drivers/astinvad.c b/src/mame/drivers/astinvad.c index 235b2f0e808..8160ad39201 100644 --- a/src/mame/drivers/astinvad.c +++ b/src/mame/drivers/astinvad.c @@ -96,7 +96,7 @@ static const ppi8255_interface ppi8255_intf[2] = static VIDEO_START( spaceint ) { - colorram = auto_malloc(videoram_size); + colorram = auto_alloc_array(machine, UINT8, videoram_size); } diff --git a/src/mame/drivers/astrocde.c b/src/mame/drivers/astrocde.c index 30ee3322858..54cbbce061f 100644 --- a/src/mame/drivers/astrocde.c +++ b/src/mame/drivers/astrocde.c @@ -427,7 +427,7 @@ static WRITE8_HANDLER( profpac_banksw_w ) profpac_bank = data; /* set the main banking */ - memory_install_read8_handler(space, 0x4000, 0xbfff, 0, 0, SMH_BANK1); + memory_install_read8_handler(space, 0x4000, 0xbfff, 0, 0, (read8_space_func)SMH_BANK(1)); memory_set_bankptr(space->machine, 1, memory_region(space->machine, "user1") + 0x8000 * bank); /* bank 0 reads video RAM in the 4000-7FFF range */ @@ -443,11 +443,11 @@ static WRITE8_HANDLER( profpac_banksw_w ) /* if the bank is in range, map the appropriate bank */ if (bank < 0x28) { - memory_install_read8_handler(space, 0x4000, 0x7fff, 0, 0, SMH_BANK2); + memory_install_read8_handler(space, 0x4000, 0x7fff, 0, 0, (read8_space_func)SMH_BANK(2)); memory_set_bankptr(space->machine, 2, memory_region(space->machine, "user2") + 0x4000 * bank); } else - memory_install_read8_handler(space, 0x4000, 0x7fff, 0, 0, SMH_UNMAP); + memory_install_read8_handler(space, 0x4000, 0x7fff, 0, 0, (read8_space_func)SMH_UNMAP); } } diff --git a/src/mame/drivers/astrof.c b/src/mame/drivers/astrof.c index e161cacb8b1..76fe44f1f73 100644 --- a/src/mame/drivers/astrof.c +++ b/src/mame/drivers/astrof.c @@ -173,7 +173,7 @@ static CUSTOM_INPUT( tomahawk_controls_r ) static VIDEO_START( astrof ) { /* allocate the color RAM -- half the size of the video RAM as A0 is not connected */ - astrof_colorram = auto_malloc(astrof_videoram_size / 2); + astrof_colorram = auto_alloc_array(machine, UINT8, astrof_videoram_size / 2); state_save_register_global_pointer(machine, astrof_colorram, astrof_videoram_size / 2); } diff --git a/src/mame/drivers/atarig1.c b/src/mame/drivers/atarig1.c index b98ca9961ba..ba343566380 100644 --- a/src/mame/drivers/atarig1.c +++ b/src/mame/drivers/atarig1.c @@ -196,7 +196,7 @@ static void pitfighb_cheap_slapstic_init(running_machine *machine) bslapstic_base = memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x038000, 0x03ffff, 0, 0, pitfighb_cheap_slapstic_r); /* allocate memory for a copy of bank 0 */ - bslapstic_bank0 = auto_malloc(0x2000); + bslapstic_bank0 = auto_alloc_array(machine, UINT8, 0x2000); memcpy(bslapstic_bank0, bslapstic_base, 0x2000); /* not primed by default */ diff --git a/src/mame/drivers/ataxx.c b/src/mame/drivers/ataxx.c index 8a30f545d1b..31e678608ed 100644 --- a/src/mame/drivers/ataxx.c +++ b/src/mame/drivers/ataxx.c @@ -777,8 +777,8 @@ static DRIVER_INIT( asylum ) leland_rotate_memory(machine, "slave"); /* asylum appears to have some extra RAM for the slave CPU */ - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xf000, 0xfffb, 0, 0, SMH_BANK4, SMH_BANK4); - memory_set_bankptr(machine, 4, auto_malloc(0x1000)); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xf000, 0xfffb, 0, 0, (read8_space_func)SMH_BANK(4), (write8_space_func)SMH_BANK(4)); + memory_set_bankptr(machine, 4, auto_alloc_array(machine, UINT8, 0x1000)); /* set up additional input ports */ memory_install_read_port_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x0d, 0x0d, 0, 0, "P2"); diff --git a/src/mame/drivers/backfire.c b/src/mame/drivers/backfire.c index e26da53b4de..8d7a07c7710 100644 --- a/src/mame/drivers/backfire.c +++ b/src/mame/drivers/backfire.c @@ -48,16 +48,16 @@ static int backfire_bank_callback(int bank) static VIDEO_START(backfire) { /* allocate the ram as 16-bit (we do it here because the CPU is 32-bit) */ - deco16_pf1_data = auto_malloc(0x2000); - deco16_pf2_data = auto_malloc(0x2000); - deco16_pf3_data = auto_malloc(0x2000); - deco16_pf4_data = auto_malloc(0x2000); - deco16_pf1_rowscroll = auto_malloc(0x0800); - deco16_pf2_rowscroll = auto_malloc(0x0800); - deco16_pf3_rowscroll = auto_malloc(0x0800); - deco16_pf4_rowscroll = auto_malloc(0x0800); - deco16_pf12_control = auto_malloc(0x10); - deco16_pf34_control = auto_malloc(0x10); + deco16_pf1_data = auto_alloc_array(machine, UINT16, 0x2000/2); + deco16_pf2_data = auto_alloc_array(machine, UINT16, 0x2000/2); + deco16_pf3_data = auto_alloc_array(machine, UINT16, 0x2000/2); + deco16_pf4_data = auto_alloc_array(machine, UINT16, 0x2000/2); + deco16_pf1_rowscroll = auto_alloc_array(machine, UINT16, 0x0800/2); + deco16_pf2_rowscroll = auto_alloc_array(machine, UINT16, 0x0800/2); + deco16_pf3_rowscroll = auto_alloc_array(machine, UINT16, 0x0800/2); + deco16_pf4_rowscroll = auto_alloc_array(machine, UINT16, 0x0800/2); + deco16_pf12_control = auto_alloc_array(machine, UINT16, 0x10/2); + deco16_pf34_control =auto_alloc_array(machine, UINT16, 0x10/2); /* and register the allocated ram so that save states still work */ state_save_register_global_pointer(machine, deco16_pf1_data, 0x2000/2); @@ -83,8 +83,8 @@ static VIDEO_START(backfire) deco16_set_tilemap_bank_callback(2, backfire_bank_callback); deco16_set_tilemap_bank_callback(3, backfire_bank_callback); - backfire_left = auto_bitmap_alloc(80*8, 32*8, BITMAP_FORMAT_INDEXED16); - backfire_right = auto_bitmap_alloc(80*8, 32*8, BITMAP_FORMAT_INDEXED16); + backfire_left = auto_bitmap_alloc(machine, 80*8, 32*8, BITMAP_FORMAT_INDEXED16); + backfire_right = auto_bitmap_alloc(machine, 80*8, 32*8, BITMAP_FORMAT_INDEXED16); } static void draw_sprites(running_machine *machine,bitmap_t *bitmap,const rectangle *cliprect, UINT32 *backfire_spriteram32, int region) @@ -628,7 +628,7 @@ static void descramble_sound( running_machine *machine ) { UINT8 *rom = memory_region(machine, "ymz"); int length = 0x200000; // only the first rom is swapped on backfire! - UINT8 *buf1 = malloc_or_die(length); + UINT8 *buf1 = alloc_array_or_die(UINT8, length); UINT32 x; for (x=0;x<length;x++) diff --git a/src/mame/drivers/balsente.c b/src/mame/drivers/balsente.c index 6a9b7d902b0..38dbea98bba 100644 --- a/src/mame/drivers/balsente.c +++ b/src/mame/drivers/balsente.c @@ -1983,7 +1983,7 @@ static void expand_roms(running_machine *machine, UINT8 cd_rom_mask) /* load EF from 0x2e000-0x30000 */ /* ROM region must be 0x40000 total */ - UINT8 *temp = malloc_or_die(0x20000); + UINT8 *temp = alloc_array_or_die(UINT8, 0x20000); { UINT8 *rom = memory_region(machine, "maincpu"); UINT32 len = memory_region_length(machine, "maincpu"); diff --git a/src/mame/drivers/bfcobra.c b/src/mame/drivers/bfcobra.c index f39c7b84d2c..fcb3b25c6b4 100644 --- a/src/mame/drivers/bfcobra.c +++ b/src/mame/drivers/bfcobra.c @@ -1306,10 +1306,10 @@ static MACHINE_RESET( bfcobra ) ***************************************************************************/ static ADDRESS_MAP_START( z80_prog_map, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_BANK4) - AM_RANGE(0x4000, 0x7fff) AM_READWRITE(SMH_BANK1, SMH_BANK1) - AM_RANGE(0x8000, 0xbfff) AM_READWRITE(SMH_BANK2, SMH_BANK2) - AM_RANGE(0xc000, 0xffff) AM_READWRITE(SMH_BANK3, SMH_BANK3) + AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_BANK(4)) + AM_RANGE(0x4000, 0x7fff) AM_READWRITE(SMH_BANK(1), SMH_BANK(1)) + AM_RANGE(0x8000, 0xbfff) AM_READWRITE(SMH_BANK(2), SMH_BANK(2)) + AM_RANGE(0xc000, 0xffff) AM_READWRITE(SMH_BANK(3), SMH_BANK(3)) ADDRESS_MAP_END static ADDRESS_MAP_START( z80_io_map, ADDRESS_SPACE_IO, 8 ) @@ -1564,16 +1564,13 @@ INPUT_PORTS_END /* Allocate work RAM and video RAM shared by the Z80 and chipset. */ -static void init_ram(void) +static void init_ram(running_machine *machine) { /* 768kB work RAM */ - work_ram = auto_malloc(0xC0000); + work_ram = auto_alloc_array_clear(machine, UINT8, 0xC0000); /* 128kB video RAM */ - video_ram = auto_malloc(0x20000); - - memset(work_ram, 0, 0xc0000); - memset(video_ram, 0, 0x20000); + video_ram = auto_alloc_array_clear(machine, UINT8, 0x20000); } /* @@ -1673,7 +1670,7 @@ static DRIVER_INIT( bfcobra ) UINT8 *rom; UINT8 *tmp; - tmp = malloc_or_die(0x8000); + tmp = alloc_array_or_die(UINT8, 0x8000); rom = memory_region(machine, "audiocpu") + 0x8000; memcpy(tmp, rom, 0x8000); @@ -1695,7 +1692,7 @@ static DRIVER_INIT( bfcobra ) free(tmp); - init_ram(); + init_ram(machine); bank[0] = 1; bank[1] = 0; diff --git a/src/mame/drivers/bfm_sc1.c b/src/mame/drivers/bfm_sc1.c index 3d72e47e0c1..2924471b505 100644 --- a/src/mame/drivers/bfm_sc1.c +++ b/src/mame/drivers/bfm_sc1.c @@ -662,7 +662,7 @@ static void decode_sc1(running_machine *machine,const char *rom_region) rom = memory_region(machine,rom_region); - tmp = malloc_or_die(0x10000); + tmp = alloc_array_or_die(UINT8, 0x10000); { int i; @@ -797,7 +797,7 @@ static ADDRESS_MAP_START( memmap, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x3800, 0x39FF) AM_WRITE(reel56_w) // reel 5+6 latch AM_RANGE(0x4000, 0x5FFF) AM_ROM // 8k ROM - AM_RANGE(0x6000, 0x7FFF) AM_READ(SMH_BANK1) // 8k paged ROM (4 pages) + AM_RANGE(0x6000, 0x7FFF) AM_READ(SMH_BANK(1)) // 8k paged ROM (4 pages) AM_RANGE(0x8000, 0xFFFF) AM_READWRITE(SMH_ROM,watchdog_w) // 32k ROM ADDRESS_MAP_END @@ -845,7 +845,7 @@ static ADDRESS_MAP_START( memmap_adder2, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x3E01, 0x3E01) AM_READWRITE(vid_uart_rx_r,vid_uart_tx_w) // video uart receive reg AM_RANGE(0x4000, 0x5FFF) AM_ROM // 8k ROM - AM_RANGE(0x6000, 0x7FFF) AM_READ(SMH_BANK1) // 8k paged ROM (4 pages) + AM_RANGE(0x6000, 0x7FFF) AM_READ(SMH_BANK(1)) // 8k paged ROM (4 pages) AM_RANGE(0x8000, 0xFFFF) AM_READWRITE(SMH_ROM,watchdog_w) // 32k ROM ADDRESS_MAP_END @@ -890,7 +890,7 @@ static ADDRESS_MAP_START( sc1_nec_uk, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x3800, 0x39FF) AM_DEVWRITE("upd", nec_latch_w) AM_RANGE(0x4000, 0x5FFF) AM_ROM // 8k ROM - AM_RANGE(0x6000, 0x7FFF) AM_READ(SMH_BANK1) // 8k paged ROM (4 pages) + AM_RANGE(0x6000, 0x7FFF) AM_READ(SMH_BANK(1)) // 8k paged ROM (4 pages) AM_RANGE(0x8000, 0xFFFF) AM_READWRITE(SMH_ROM,watchdog_w) // 32k ROM ADDRESS_MAP_END diff --git a/src/mame/drivers/bfm_sc2.c b/src/mame/drivers/bfm_sc2.c index adbc4860730..b398599357d 100644 --- a/src/mame/drivers/bfm_sc2.c +++ b/src/mame/drivers/bfm_sc2.c @@ -1434,7 +1434,7 @@ static void decode_mainrom(running_machine *machine, const char *rom_region) rom = memory_region(machine, rom_region); - tmp = malloc_or_die(0x10000); + tmp = alloc_array_or_die(UINT8, 0x10000); { int i; long address; @@ -1556,7 +1556,7 @@ static ADDRESS_MAP_START( memmap_vid, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x3FFF, 0x3FFF) AM_READ(coin_input_r) AM_RANGE(0x4000, 0x5fff) AM_ROM // 8k fixed ROM AM_RANGE(0x4000, 0xFFFF) AM_WRITE(unknown_w) // contains unknown I/O registers - AM_RANGE(0x6000, 0x7FFF) AM_READ(SMH_BANK1) // 8k paged ROM (4 pages) + AM_RANGE(0x6000, 0x7FFF) AM_READ(SMH_BANK(1)) // 8k paged ROM (4 pages) AM_RANGE(0x8000, 0xFFFF) AM_ROM // 32k ROM ADDRESS_MAP_END @@ -2790,7 +2790,7 @@ static ADDRESS_MAP_START( sc2_memmap, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x3FFF, 0x3FFF) AM_READ( coin_input_r) AM_RANGE(0x4000, 0x5FFF) AM_ROM /* 8k fixed ROM */ - AM_RANGE(0x6000, 0x7FFF) AM_READ(SMH_BANK1) /* 8k paged ROM (4 pages) */ + AM_RANGE(0x6000, 0x7FFF) AM_READ(SMH_BANK(1)) /* 8k paged ROM (4 pages) */ AM_RANGE(0x8000, 0xFFFF) AM_ROM /* 32k ROM */ ADDRESS_MAP_END @@ -2839,7 +2839,7 @@ static ADDRESS_MAP_START( sc3_memmap, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x3FFF, 0x3FFF) AM_READ( coin_input_r) AM_RANGE(0x4000, 0x5FFF) AM_ROM // AM_RANGE(0x4000, 0xFFFF) AM_WRITE(unknown_w) - AM_RANGE(0x6000, 0x7FFF) AM_READ(SMH_BANK1) + AM_RANGE(0x6000, 0x7FFF) AM_READ(SMH_BANK(1)) AM_RANGE(0x8000, 0xFFFF) AM_ROM ADDRESS_MAP_END @@ -2889,7 +2889,7 @@ static ADDRESS_MAP_START( memmap_sc2_dm01, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x3FFF, 0x3FFF) AM_READ( coin_input_r) AM_RANGE(0x4000, 0x5FFF) AM_ROM // AM_RANGE(0x4000, 0xFFFF) AM_WRITE(unknown_w) - AM_RANGE(0x6000, 0x7FFF) AM_READ(SMH_BANK1) + AM_RANGE(0x6000, 0x7FFF) AM_READ(SMH_BANK(1)) AM_RANGE(0x8000, 0xFFFF) AM_ROM ADDRESS_MAP_END diff --git a/src/mame/drivers/bishjan.c b/src/mame/drivers/bishjan.c index 6161251a926..983d7730eaa 100644 --- a/src/mame/drivers/bishjan.c +++ b/src/mame/drivers/bishjan.c @@ -213,21 +213,21 @@ static VIDEO_START(bishjan) tilemap_set_scrolldy( tmap_1, -1, +1 ); tilemap_set_scrolldy( tmap_2, -1, +1 ); - bishjan_videoram_1_lo = auto_malloc(0x80 * 0x40); - bishjan_videoram_1_hi = auto_malloc(0x80 * 0x40); + bishjan_videoram_1_lo = auto_alloc_array(machine, UINT8, 0x80 * 0x40); + bishjan_videoram_1_hi = auto_alloc_array(machine, UINT8, 0x80 * 0x40); - bishjan_videoram_2_lo = auto_malloc(0x80 * 0x40); - bishjan_videoram_2_hi = auto_malloc(0x80 * 0x40); + bishjan_videoram_2_lo = auto_alloc_array(machine, UINT8, 0x80 * 0x40); + bishjan_videoram_2_hi = auto_alloc_array(machine, UINT8, 0x80 * 0x40); - bishjan_scrollram_1_lo = auto_malloc(0x200); - bishjan_scrollram_1_hi = auto_malloc(0x200); + bishjan_scrollram_1_lo = auto_alloc_array(machine, UINT8, 0x200); + bishjan_scrollram_1_hi = auto_alloc_array(machine, UINT8, 0x200); - bishjan_scrollram_2_lo = auto_malloc(0x200); - bishjan_scrollram_2_hi = auto_malloc(0x200); + bishjan_scrollram_2_lo = auto_alloc_array(machine, UINT8, 0x200); + bishjan_scrollram_2_hi = auto_alloc_array(machine, UINT8, 0x200); - bishjan_videoram_2_hi = auto_malloc(0x80 * 0x40); + bishjan_videoram_2_hi = auto_alloc_array(machine, UINT8, 0x80 * 0x40); - colorram = auto_malloc(256*3); + colorram = auto_alloc_array(machine, UINT8, 256*3); } static VIDEO_UPDATE( bishjan ) diff --git a/src/mame/drivers/bladestl.c b/src/mame/drivers/bladestl.c index 978d3f4e415..5a2363c3f27 100644 --- a/src/mame/drivers/bladestl.c +++ b/src/mame/drivers/bladestl.c @@ -127,7 +127,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x2f80, 0x2f9f) AM_READWRITE(K051733_r, K051733_w) /* Protection: 051733 */ AM_RANGE(0x2fc0, 0x2fc0) AM_WRITENOP /* ??? */ AM_RANGE(0x4000, 0x5fff) AM_RAM /* Work RAM */ - AM_RANGE(0x6000, 0x7fff) AM_READWRITE(SMH_BANK1, SMH_RAM) /* banked ROM */ + AM_RANGE(0x6000, 0x7fff) AM_READWRITE(SMH_BANK(1), SMH_RAM) /* banked ROM */ AM_RANGE(0x8000, 0xffff) AM_ROM ADDRESS_MAP_END diff --git a/src/mame/drivers/blktiger.c b/src/mame/drivers/blktiger.c index d822c7fe38b..f0470f32cfe 100644 --- a/src/mame/drivers/blktiger.c +++ b/src/mame/drivers/blktiger.c @@ -63,7 +63,7 @@ static WRITE8_HANDLER( blktiger_coinlockout_w ) static ADDRESS_MAP_START( mem_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0xbfff) AM_READWRITE(SMH_BANK1, SMH_ROM) + AM_RANGE(0x8000, 0xbfff) AM_READWRITE(SMH_BANK(1), SMH_ROM) AM_RANGE(0xc000, 0xcfff) AM_READWRITE(blktiger_bgvideoram_r, blktiger_bgvideoram_w) AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(blktiger_txvideoram_w) AM_BASE(&blktiger_txvideoram) AM_RANGE(0xd800, 0xdbff) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_split1_w) AM_BASE(&paletteram) diff --git a/src/mame/drivers/blockhl.c b/src/mame/drivers/blockhl.c index f652a271694..01b09eba0a7 100644 --- a/src/mame/drivers/blockhl.c +++ b/src/mame/drivers/blockhl.c @@ -79,7 +79,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_READWRITE(K052109_051960_r, K052109_051960_w) AM_RANGE(0x4000, 0x57ff) AM_RAM AM_RANGE(0x5800, 0x5fff) AM_READWRITE(bankedram_r, bankedram_w) AM_BASE(&ram) - AM_RANGE(0x6000, 0x7fff) AM_READWRITE(SMH_BANK1, SMH_ROM) + AM_RANGE(0x6000, 0x7fff) AM_READWRITE(SMH_BANK(1), SMH_ROM) AM_RANGE(0x8000, 0xffff) AM_ROM ADDRESS_MAP_END diff --git a/src/mame/drivers/bmcbowl.c b/src/mame/drivers/bmcbowl.c index a5a55c344a5..d0fdcb98f17 100644 --- a/src/mame/drivers/bmcbowl.c +++ b/src/mame/drivers/bmcbowl.c @@ -551,7 +551,7 @@ ROM_END static DRIVER_INIT(bmcbowl) { - colorram=auto_malloc(768); + colorram = auto_alloc_array(machine, UINT8, 768); } GAME( 1994, bmcbowl, 0, bmcbowl, bmcbowl, bmcbowl, ROT0, "BMC", "BMC Bowling", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) diff --git a/src/mame/drivers/bnstars.c b/src/mame/drivers/bnstars.c index 90cc2b7c9c0..4a48ff96c3e 100644 --- a/src/mame/drivers/bnstars.c +++ b/src/mame/drivers/bnstars.c @@ -1266,7 +1266,7 @@ static ADDRESS_MAP_START( bnstars_map, ADDRESS_SPACE_PROGRAM, 32 ) AM_RANGE(0xfec08000, 0xfec0ffff) AM_RAM_WRITE(ms32_bg0_ram_w) AM_BASE(&ms32_bg0_ram) AM_RANGE(0xfee00000, 0xfee1ffff) AM_RAM - AM_RANGE(0xffe00000, 0xffffffff) AM_READWRITE(SMH_BANK1, SMH_ROM) + AM_RANGE(0xffe00000, 0xffffffff) AM_READWRITE(SMH_BANK(1), SMH_ROM) ADDRESS_MAP_END #if 0 diff --git a/src/mame/drivers/boogwing.c b/src/mame/drivers/boogwing.c index 1ebd2f274a6..709351e8062 100644 --- a/src/mame/drivers/boogwing.c +++ b/src/mame/drivers/boogwing.c @@ -137,7 +137,7 @@ static ADDRESS_MAP_START( audio_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x120000, 0x120001) AM_DEVREADWRITE("oki1", okim6295_r, okim6295_w) AM_RANGE(0x130000, 0x130001) AM_DEVREADWRITE("oki2", okim6295_r, okim6295_w) AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r) - AM_RANGE(0x1f0000, 0x1f1fff) AM_READWRITE(SMH_BANK8, SMH_BANK8) + AM_RANGE(0x1f0000, 0x1f1fff) AM_READWRITE(SMH_BANK(8), SMH_BANK(8)) AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE(h6280_timer_w) AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE(h6280_irq_status_w) ADDRESS_MAP_END diff --git a/src/mame/drivers/bottom9.c b/src/mame/drivers/bottom9.c index aa33a3a2918..960e3d5d393 100644 --- a/src/mame/drivers/bottom9.c +++ b/src/mame/drivers/bottom9.c @@ -147,7 +147,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x2000, 0x27ff) AM_READWRITE(bottom9_bankedram2_r, bottom9_bankedram2_w) AM_BASE(&paletteram) AM_RANGE(0x0000, 0x3fff) AM_READWRITE(K052109_051960_r, K052109_051960_w) AM_RANGE(0x4000, 0x5fff) AM_RAM - AM_RANGE(0x6000, 0x7fff) AM_READWRITE(SMH_BANK1, SMH_ROM) + AM_RANGE(0x6000, 0x7fff) AM_READWRITE(SMH_BANK(1), SMH_ROM) AM_RANGE(0x8000, 0xffff) AM_ROM ADDRESS_MAP_END diff --git a/src/mame/drivers/btime.c b/src/mame/drivers/btime.c index e75c3669dec..62fa86b5a2b 100644 --- a/src/mame/drivers/btime.c +++ b/src/mame/drivers/btime.c @@ -1981,7 +1981,7 @@ ROM_END static void decrypt_C10707_cpu(running_machine *machine, const char *cputag) { const address_space *space = cputag_get_address_space(machine, cputag, ADDRESS_SPACE_PROGRAM); - UINT8 *decrypt = auto_malloc(0x10000); + UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x10000); UINT8 *rom = memory_region(machine, cputag); offs_t addr; @@ -2013,7 +2013,7 @@ static void init_rom1(running_machine *machine) const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); UINT8 *rom = memory_region(machine, "maincpu"); - decrypted = auto_malloc(0x10000); + decrypted = auto_alloc_array(machine, UINT8, 0x10000); memory_set_decrypted_region(space, 0x0000, 0xffff, decrypted); /* For now, just copy the RAM array over to ROM. Decryption will happen */ @@ -2078,7 +2078,7 @@ static DRIVER_INIT( cookrace ) { decrypt_C10707_cpu(machine, "maincpu"); - memory_install_read8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x0200, 0x0fff, 0, 0, SMH_BANK10); + memory_install_read8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x0200, 0x0fff, 0, 0, (read8_space_func)SMH_BANK(10)); memory_set_bankptr(machine, 10, memory_region(machine, "audiocpu") + 0xe200); audio_nmi_enable_type = AUDIO_ENABLE_DIRECT; } @@ -2095,7 +2095,7 @@ static DRIVER_INIT( wtennis ) memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc15f, 0xc15f, 0, 0, wtennis_reset_hack_r); - memory_install_read8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x0200, 0x0fff, 0, 0, SMH_BANK10); + memory_install_read8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x0200, 0x0fff, 0, 0, (read8_space_func)SMH_BANK(10)); memory_set_bankptr(machine, 10, memory_region(machine, "audiocpu") + 0xe200); audio_nmi_enable_type = AUDIO_ENABLE_DIRECT; } diff --git a/src/mame/drivers/buggychl.c b/src/mame/drivers/buggychl.c index ad1c2666a66..16e6df0045a 100644 --- a/src/mame/drivers/buggychl.c +++ b/src/mame/drivers/buggychl.c @@ -138,7 +138,7 @@ static ADDRESS_MAP_START( buggychl_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x8000, 0x87ff) AM_RAM /* 6116 SRAM (36) */ AM_RANGE(0x8800, 0x8fff) AM_RAM /* 6116 SRAM (35) */ AM_RANGE(0x9000, 0x9fff) AM_WRITE(buggychl_sprite_lookup_w) - AM_RANGE(0xa000, 0xbfff) AM_READWRITE(SMH_BANK1, buggychl_chargen_w) AM_BASE(&buggychl_character_ram) + AM_RANGE(0xa000, 0xbfff) AM_READWRITE(SMH_BANK(1), buggychl_chargen_w) AM_BASE(&buggychl_character_ram) AM_RANGE(0xc800, 0xcfff) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size) AM_RANGE(0xd100, 0xd100) AM_WRITE(buggychl_ctrl_w) AM_RANGE(0xd200, 0xd200) AM_WRITE(bankswitch_w) diff --git a/src/mame/drivers/buster.c b/src/mame/drivers/buster.c index b787595ba7c..1eea50d0e71 100644 --- a/src/mame/drivers/buster.c +++ b/src/mame/drivers/buster.c @@ -114,7 +114,7 @@ ROM_END static DRIVER_INIT( buster ) { UINT8 *ROM = memory_region(machine, "maincpu"); -// vram = auto_malloc(0x2000); +// vram = auto_alloc_array(machine, UINT8, 0x2000); memcpy(buster_rom, ROM, 0x4000); } diff --git a/src/mame/drivers/bzone.c b/src/mame/drivers/bzone.c index dbbf4d2eb12..d03d96d50f4 100644 --- a/src/mame/drivers/bzone.c +++ b/src/mame/drivers/bzone.c @@ -787,8 +787,8 @@ static WRITE8_HANDLER( analog_select_w ) static DRIVER_INIT( bradley ) { - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x400, 0x7ff, 0, 0, SMH_BANK1, SMH_BANK1); - memory_set_bankptr(machine, 1, auto_malloc(0x400)); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x400, 0x7ff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_BANK(1)); + memory_set_bankptr(machine, 1, auto_alloc_array(machine, UINT8, 0x400)); memory_install_read_port_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1808, 0x1808, 0, 0, "1808"); memory_install_read_port_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1809, 0x1809, 0, 0, "1809"); diff --git a/src/mame/drivers/calchase.c b/src/mame/drivers/calchase.c index c5b76714eb9..52839345f0e 100644 --- a/src/mame/drivers/calchase.c +++ b/src/mame/drivers/calchase.c @@ -677,7 +677,7 @@ MACHINE_DRIVER_END static DRIVER_INIT( calchase ) { - bios_ram = auto_malloc(0x10000); + bios_ram = auto_alloc_array(machine, UINT32, 0x10000/4); init_pc_common(machine, PCCOMMON_KEYBOARD_AT, calchase_set_keyb_int); mc146818_init(machine, MC146818_STANDARD); diff --git a/src/mame/drivers/cave.c b/src/mame/drivers/cave.c index c47aad72952..59945e7a8be 100644 --- a/src/mame/drivers/cave.c +++ b/src/mame/drivers/cave.c @@ -779,7 +779,7 @@ static ADDRESS_MAP_START( mazinger_map, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0x800002, 0x800003) AM_READ_PORT("IN1") // Inputs + EEPROM AM_RANGE(0x900000, 0x900001) AM_WRITE(cave_eeprom_msb_w) // EEPROM /**/AM_RANGE(0xc08000, 0xc0ffff) AM_RAM AM_BASE(&paletteram16) AM_SIZE(&cave_paletteram_size) // Palette - AM_RANGE(0xd00000, 0xd7ffff) AM_READWRITE(SMH_BANK1, SMH_ROM) // ROM + AM_RANGE(0xd00000, 0xd7ffff) AM_ROMBANK(1) // ROM ADDRESS_MAP_END @@ -978,7 +978,7 @@ static WRITE8_HANDLER( hotdogst_okibank_w ) static ADDRESS_MAP_START( hotdogst_sound_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_ROM // ROM - AM_RANGE(0x4000, 0x7fff) AM_READWRITE(SMH_BANK2, SMH_ROM) // ROM (Banked) + AM_RANGE(0x4000, 0x7fff) AM_ROMBANK(2) // ROM (Banked) AM_RANGE(0xe000, 0xffff) AM_RAM // RAM ADDRESS_MAP_END @@ -1008,7 +1008,7 @@ static WRITE8_HANDLER( mazinger_rombank_w ) static ADDRESS_MAP_START( mazinger_sound_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_ROM // ROM - AM_RANGE(0x4000, 0x7fff) AM_READWRITE(SMH_BANK2, SMH_ROM) // ROM (Banked) + AM_RANGE(0x4000, 0x7fff) AM_ROMBANK(2) // ROM (Banked) AM_RANGE(0xc000, 0xc7ff) AM_RAM // RAM AM_RANGE(0xf800, 0xffff) AM_RAM // RAM ADDRESS_MAP_END @@ -1058,7 +1058,7 @@ static WRITE8_HANDLER( metmqstr_okibank1_w ) static ADDRESS_MAP_START( metmqstr_sound_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_ROM // ROM - AM_RANGE(0x4000, 0x7fff) AM_READWRITE(SMH_BANK1, SMH_ROM) // ROM (Banked) + AM_RANGE(0x4000, 0x7fff) AM_ROMBANK(1) // ROM (Banked) AM_RANGE(0xe000, 0xffff) AM_RAM // RAM ADDRESS_MAP_END @@ -1091,7 +1091,7 @@ static WRITE8_HANDLER( pwrinst2_rombank_w ) static ADDRESS_MAP_START( pwrinst2_sound_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM // ROM - AM_RANGE(0x8000, 0xbfff) AM_READWRITE(SMH_BANK1, SMH_ROM) // ROM (Banked) + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK(1) // ROM (Banked) AM_RANGE(0xe000, 0xffff) AM_RAM // RAM ADDRESS_MAP_END @@ -1152,7 +1152,7 @@ static WRITE8_HANDLER( sailormn_okibank1_w ) static ADDRESS_MAP_START( sailormn_sound_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_ROM // ROM - AM_RANGE(0x4000, 0x7fff) AM_READWRITE(SMH_BANK1, SMH_ROM) // ROM (Banked) + AM_RANGE(0x4000, 0x7fff) AM_ROMBANK(1) // ROM (Banked) AM_RANGE(0xc000, 0xdfff) AM_READWRITE(mirror_ram_r, mirror_ram_w) AM_BASE(&mirror_ram) // RAM AM_RANGE(0xe000, 0xffff) AM_READWRITE(mirror_ram_r, mirror_ram_w) // Mirrored RAM (agallet) ADDRESS_MAP_END @@ -3947,7 +3947,7 @@ static DRIVER_INIT( mazinger ) init_cave(machine); /* decrypt sprites */ - buffer = malloc_or_die(len); + buffer = alloc_array_or_die(UINT8, len); { int i; for (i = 0;i < len; i++) @@ -3990,7 +3990,7 @@ static DRIVER_INIT( pwrins2j ) init_cave(machine); - buffer = malloc_or_die(len); + buffer = alloc_array_or_die(UINT8, len); { for(i=0; i<len/2; i++) { j = BITSWAP24(i,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7, 2,4,6,1,5,3, 0); @@ -4036,7 +4036,7 @@ static DRIVER_INIT( sailormn ) init_cave(machine); /* decrypt sprites */ - buffer = malloc_or_die(len); + buffer = alloc_array_or_die(UINT8, len); { int i; for (i = 0;i < len; i++) diff --git a/src/mame/drivers/cbuster.c b/src/mame/drivers/cbuster.c index 4d437e6155a..32a34af3fad 100644 --- a/src/mame/drivers/cbuster.c +++ b/src/mame/drivers/cbuster.c @@ -142,7 +142,7 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x120000, 0x120001) AM_DEVREADWRITE("oki1", okim6295_r, okim6295_w) AM_RANGE(0x130000, 0x130001) AM_DEVREADWRITE("oki2", okim6295_r, okim6295_w) AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r) - AM_RANGE(0x1f0000, 0x1f1fff) AM_READWRITE(SMH_BANK8, SMH_BANK8) + AM_RANGE(0x1f0000, 0x1f1fff) AM_RAMBANK(8) AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE(h6280_timer_w) AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE(h6280_irq_status_w) ADDRESS_MAP_END diff --git a/src/mame/drivers/ccastles.c b/src/mame/drivers/ccastles.c index c898fd88fe5..f731025097c 100644 --- a/src/mame/drivers/ccastles.c +++ b/src/mame/drivers/ccastles.c @@ -238,7 +238,7 @@ static MACHINE_START( ccastles ) schedule_next_irq(machine, 0); /* allocate backing memory for the NVRAM */ - generic_nvram = auto_malloc(generic_nvram_size); + generic_nvram = auto_alloc_array(machine, UINT8, generic_nvram_size); /* setup for save states */ state_save_register_global(machine, irq_state); diff --git a/src/mame/drivers/cclimber.c b/src/mame/drivers/cclimber.c index 1c055b78a54..80a6d93ae1e 100644 --- a/src/mame/drivers/cclimber.c +++ b/src/mame/drivers/cclimber.c @@ -358,7 +358,7 @@ static ADDRESS_MAP_START( yamato_map, ADDRESS_SPACE_PROGRAM, 8 ) ADDRESS_MAP_END static ADDRESS_MAP_START( toprollr_map, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x5fff) AM_READ(SMH_BANK1) + AM_RANGE(0x0000, 0x5fff) AM_READ(SMH_BANK(1)) AM_RANGE(0x6000, 0x6bff) AM_RAM AM_RANGE(0x8800, 0x88ff) AM_RAM AM_BASE(&cclimber_bigsprite_videoram) AM_RANGE(0x8c00, 0x8fff) AM_RAM AM_BASE(&toprollr_bg_videoram) diff --git a/src/mame/drivers/chaknpop.c b/src/mame/drivers/chaknpop.c index 70c013697b7..2532316e448 100644 --- a/src/mame/drivers/chaknpop.c +++ b/src/mame/drivers/chaknpop.c @@ -57,7 +57,7 @@ static ADDRESS_MAP_START( chaknpop_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(chaknpop_attrram_w) AM_BASE(&chaknpop_attrram) // Color attribute AM_RANGE(0x9840, 0x98ff) AM_RAM AM_BASE(&chaknpop_sprram) AM_SIZE(&chaknpop_sprram_size) // sprite AM_RANGE(0xa000, 0xbfff) AM_ROM - AM_RANGE(0xc000, 0xffff) AM_READWRITE(SMH_BANK1, SMH_BANK1) // bitmap plane 1-4 + AM_RANGE(0xc000, 0xffff) AM_RAMBANK(1) // bitmap plane 1-4 ADDRESS_MAP_END static const ay8910_interface ay8910_interface_1 = diff --git a/src/mame/drivers/chanbara.c b/src/mame/drivers/chanbara.c index cc38d8500d4..806a118bd14 100644 --- a/src/mame/drivers/chanbara.c +++ b/src/mame/drivers/chanbara.c @@ -184,7 +184,7 @@ static ADDRESS_MAP_START( memmap, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x2001, 0x2001) AM_READ_PORT("SYSTEM") AM_RANGE(0x2003, 0x2003) AM_READ_PORT("JOY") AM_RANGE(0x3800, 0x3801) AM_DEVREADWRITE("ym", ym2203_r, ym2203_w) - AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK1) + AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK(1)) AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM) ADDRESS_MAP_END diff --git a/src/mame/drivers/chinagat.c b/src/mame/drivers/chinagat.c index 96900bf166c..5a82a8a6db3 100644 --- a/src/mame/drivers/chinagat.c +++ b/src/mame/drivers/chinagat.c @@ -337,7 +337,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x2800, 0x2fff) AM_RAM_WRITE(ddragon_bgvideoram_w) AM_BASE(&ddragon_bgvideoram) AM_RANGE(0x3000, 0x317f) AM_WRITE(paletteram_xxxxBBBBGGGGRRRR_split1_w) AM_BASE(&paletteram) AM_RANGE(0x3400, 0x357f) AM_WRITE(paletteram_xxxxBBBBGGGGRRRR_split2_w) AM_BASE(&paletteram_2) - AM_RANGE(0x3800, 0x397f) AM_WRITE(SMH_BANK3) AM_BASE(&spriteram) AM_SIZE(&spriteram_size) + AM_RANGE(0x3800, 0x397f) AM_WRITE(SMH_BANK(3)) AM_BASE(&spriteram) AM_SIZE(&spriteram_size) AM_RANGE(0x3e00, 0x3e04) AM_WRITE(chinagat_interrupt_w) AM_RANGE(0x3e06, 0x3e06) AM_WRITE(SMH_RAM) AM_BASE(&ddragon_scrolly_lo) AM_RANGE(0x3e07, 0x3e07) AM_WRITE(SMH_RAM) AM_BASE(&ddragon_scrollx_lo) diff --git a/src/mame/drivers/chqflag.c b/src/mame/drivers/chqflag.c index 6ae34e7eee2..6ae2cd59dc4 100644 --- a/src/mame/drivers/chqflag.c +++ b/src/mame/drivers/chqflag.c @@ -56,7 +56,7 @@ static WRITE8_HANDLER( chqflag_bankswitch_w ) /* bit 5 = memory bank select */ if (data & 0x20) { - memory_install_readwrite8_handler(space, 0x1800, 0x1fff, 0, 0, SMH_BANK5, paletteram_xBBBBBGGGGGRRRRR_be_w); + memory_install_readwrite8_handler(space, 0x1800, 0x1fff, 0, 0, (read8_space_func)SMH_BANK(5), paletteram_xBBBBBGGGGGRRRRR_be_w); memory_set_bankptr(space->machine, 5, paletteram); if (K051316_readroms) @@ -66,8 +66,8 @@ static WRITE8_HANDLER( chqflag_bankswitch_w ) } else { - memory_install_readwrite8_handler(space, 0x1000, 0x17ff, 0, 0, SMH_BANK1, SMH_BANK1); /* RAM */ - memory_install_readwrite8_handler(space, 0x1800, 0x1fff, 0, 0, SMH_BANK2, SMH_BANK2); /* RAM */ + memory_install_readwrite8_handler(space, 0x1000, 0x17ff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_BANK(1)); /* RAM */ + memory_install_readwrite8_handler(space, 0x1800, 0x1fff, 0, 0, (read8_space_func)SMH_BANK(2), (write8_space_func)SMH_BANK(2)); /* RAM */ } /* other bits unknown/unused */ @@ -148,11 +148,11 @@ static WRITE8_HANDLER( chqflag_sh_irqtrigger_w ) static ADDRESS_MAP_START( chqflag_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x0fff) AM_RAM /* RAM */ - AM_RANGE(0x1000, 0x17ff) AM_READWRITE(SMH_BANK1, SMH_BANK1) /* banked RAM (RAM/051316 (chip 1)) */ - AM_RANGE(0x1800, 0x1fff) AM_READWRITE(SMH_BANK2, SMH_BANK2) /* palette + RAM */ + AM_RANGE(0x1000, 0x17ff) AM_RAMBANK(1) /* banked RAM (RAM/051316 (chip 1)) */ + AM_RANGE(0x1800, 0x1fff) AM_RAMBANK(2) /* palette + RAM */ AM_RANGE(0x2000, 0x2007) AM_READWRITE(K051937_r, K051937_w) /* Sprite control registers */ AM_RANGE(0x2400, 0x27ff) AM_READWRITE(K051960_r, K051960_w) /* Sprite RAM */ - AM_RANGE(0x2800, 0x2fff) AM_READWRITE(SMH_BANK3, K051316_1_w) /* 051316 zoom/rotation (chip 2) */ + AM_RANGE(0x2800, 0x2fff) AM_READWRITE(SMH_BANK(3), K051316_1_w) /* 051316 zoom/rotation (chip 2) */ AM_RANGE(0x3000, 0x3000) AM_WRITE(soundlatch_w) /* sound code # */ AM_RANGE(0x3001, 0x3001) AM_WRITE(chqflag_sh_irqtrigger_w) /* cause interrupt on audio CPU */ AM_RANGE(0x3002, 0x3002) AM_WRITE(chqflag_bankswitch_w) /* bankswitch control */ @@ -168,8 +168,8 @@ static ADDRESS_MAP_START( chqflag_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x3700, 0x3700) AM_WRITE(select_analog_ctrl_w) /* select accelerator/wheel */ AM_RANGE(0x3701, 0x3701) AM_READ_PORT("IN2") /* Brake + Shift + ? */ AM_RANGE(0x3702, 0x3702) AM_READWRITE(analog_read_r, select_analog_ctrl_w) /* accelerator/wheel */ - AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK4) /* banked ROM */ - AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM) /* ROM */ + AM_RANGE(0x4000, 0x7fff) AM_ROMBANK(4) /* banked ROM */ + AM_RANGE(0x8000, 0xffff) AM_ROM /* ROM */ ADDRESS_MAP_END static WRITE8_HANDLER( k007232_bankswitch_w ) diff --git a/src/mame/drivers/cloud9.c b/src/mame/drivers/cloud9.c index 28ec3eb51aa..a3c5a061c84 100644 --- a/src/mame/drivers/cloud9.c +++ b/src/mame/drivers/cloud9.c @@ -202,7 +202,7 @@ static MACHINE_START( cloud9 ) schedule_next_irq(machine, 0-64); /* allocate backing memory for the NVRAM */ - generic_nvram = auto_malloc(generic_nvram_size); + generic_nvram = auto_alloc_array(machine, UINT8, generic_nvram_size); /* setup for save states */ state_save_register_global(machine, irq_state); @@ -303,7 +303,7 @@ static READ8_HANDLER( nvram_r ) static ADDRESS_MAP_START( cloud9_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x0001) AM_WRITE(cloud9_bitmode_addr_w) AM_RANGE(0x0002, 0x0002) AM_READWRITE(cloud9_bitmode_r, cloud9_bitmode_w) - AM_RANGE(0x0000, 0x4fff) AM_READWRITE(SMH_BANK1, cloud9_videoram_w) + AM_RANGE(0x0000, 0x4fff) AM_READWRITE(SMH_BANK(1), cloud9_videoram_w) AM_RANGE(0x5000, 0x53ff) AM_RAM AM_BASE(&spriteram) AM_RANGE(0x5400, 0x547f) AM_WRITE(watchdog_reset_w) AM_RANGE(0x5480, 0x54ff) AM_WRITE(irq_ack_w) diff --git a/src/mame/drivers/cninja.c b/src/mame/drivers/cninja.c index f6f56c72c5f..8b2e79e4fb1 100644 --- a/src/mame/drivers/cninja.c +++ b/src/mame/drivers/cninja.c @@ -270,7 +270,7 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x120000, 0x120001) AM_DEVREADWRITE("oki1", okim6295_r, okim6295_w) AM_RANGE(0x130000, 0x130001) AM_DEVREADWRITE("oki2", okim6295_r, okim6295_w) AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r) - AM_RANGE(0x1f0000, 0x1f1fff) AM_READWRITE(SMH_BANK8, SMH_BANK8) + AM_RANGE(0x1f0000, 0x1f1fff) AM_RAMBANK(8) AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE(h6280_timer_w) AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE(h6280_irq_status_w) ADDRESS_MAP_END @@ -282,7 +282,7 @@ static ADDRESS_MAP_START( sound_map_mutantf, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x120000, 0x120001) AM_DEVREADWRITE("oki1", okim6295_r, okim6295_w) AM_RANGE(0x130000, 0x130001) AM_DEVREADWRITE("oki2", okim6295_r, okim6295_w) AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r) - AM_RANGE(0x1f0000, 0x1f1fff) AM_READWRITE(SMH_BANK8, SMH_BANK8) + AM_RANGE(0x1f0000, 0x1f1fff) AM_RAMBANK(8) AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE(h6280_timer_w) AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE(h6280_irq_status_w) ADDRESS_MAP_END diff --git a/src/mame/drivers/coinmstr.c b/src/mame/drivers/coinmstr.c index eb6e97b7ff2..b66afa25c4f 100644 --- a/src/mame/drivers/coinmstr.c +++ b/src/mame/drivers/coinmstr.c @@ -1194,7 +1194,7 @@ static DRIVER_INIT( coinmstr ) { UINT8 *rom = memory_region(machine, "user1"); int length = memory_region_length(machine, "user1"); - UINT8 *buf = malloc_or_die(length); + UINT8 *buf = alloc_array_or_die(UINT8, length); int i; memcpy(buf,rom,length); diff --git a/src/mame/drivers/combatsc.c b/src/mame/drivers/combatsc.c index 4216ecccca8..2b150a8eac4 100644 --- a/src/mame/drivers/combatsc.c +++ b/src/mame/drivers/combatsc.c @@ -291,7 +291,7 @@ static ADDRESS_MAP_START( combasc_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0600, 0x06ff) AM_RAM AM_BASE(&paletteram) /* palette */ AM_RANGE(0x0800, 0x1fff) AM_RAM /* RAM */ AM_RANGE(0x2000, 0x3fff) AM_READWRITE(combasc_video_r, combasc_video_w) - AM_RANGE(0x4000, 0x7fff) AM_READWRITE(SMH_BANK1, SMH_ROM) /* banked ROM area */ + AM_RANGE(0x4000, 0x7fff) AM_ROMBANK(1) /* banked ROM area */ AM_RANGE(0x8000, 0xffff) AM_ROM /* ROM */ ADDRESS_MAP_END @@ -301,7 +301,7 @@ static ADDRESS_MAP_START( combascb_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0600, 0x06ff) AM_RAM AM_BASE(&paletteram) /* palette */ AM_RANGE(0x0800, 0x1fff) AM_RAM AM_RANGE(0x2000, 0x3fff) AM_READWRITE(combasc_video_r, combasc_video_w) - AM_RANGE(0x4000, 0x7fff) AM_READWRITE(SMH_BANK1, SMH_ROM) /* banked ROM/RAM area */ + AM_RANGE(0x4000, 0x7fff) AM_ROMBANK(1) /* banked ROM/RAM area */ AM_RANGE(0x8000, 0xffff) AM_ROM /* ROM */ ADDRESS_MAP_END diff --git a/src/mame/drivers/commando.c b/src/mame/drivers/commando.c index 48d9f2fb29b..132d16a317a 100644 --- a/src/mame/drivers/commando.c +++ b/src/mame/drivers/commando.c @@ -506,7 +506,7 @@ static DRIVER_INIT( commando ) { const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); UINT8 *rom = memory_region(machine, "maincpu"); - UINT8 *decrypt = auto_malloc(0xc000); + UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0xc000); int A; memory_set_decrypted_region(space, 0x0000, 0xbfff, decrypt); @@ -526,7 +526,7 @@ static DRIVER_INIT( spaceinv ) { const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); UINT8 *rom = memory_region(machine, "maincpu"); - UINT8 *decrypt = auto_malloc(0xc000); + UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0xc000); int A; memory_set_decrypted_region(space, 0x0000, 0xbfff, decrypt); diff --git a/src/mame/drivers/compgolf.c b/src/mame/drivers/compgolf.c index 1f9d9fbc1cc..ed3fd70afc7 100644 --- a/src/mame/drivers/compgolf.c +++ b/src/mame/drivers/compgolf.c @@ -62,7 +62,7 @@ static ADDRESS_MAP_START( compgolf_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x3002, 0x3002) AM_READ_PORT("DSW1") AM_RANGE(0x3003, 0x3003) AM_READ_PORT("DSW2") AM_RANGE(0x3800, 0x3801) AM_DEVREADWRITE("ym", ym2203_r, ym2203_w) - AM_RANGE(0x4000, 0x7fff) AM_READWRITE(SMH_BANK1, SMH_ROM) + AM_RANGE(0x4000, 0x7fff) AM_ROMBANK(1) AM_RANGE(0x8000, 0xffff) AM_ROM ADDRESS_MAP_END diff --git a/src/mame/drivers/contra.c b/src/mame/drivers/contra.c index 703cb0a0d39..bc4dd40990f 100644 --- a/src/mame/drivers/contra.c +++ b/src/mame/drivers/contra.c @@ -100,10 +100,8 @@ static ADDRESS_MAP_START( contra_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x4400, 0x47ff) AM_WRITE(contra_bg_vram_w) AM_BASE(&contra_bg_vram) AM_RANGE(0x4800, 0x5fff) AM_WRITE(SMH_RAM) - AM_RANGE(0x6000, 0x7fff) AM_READ(SMH_BANK1) - AM_RANGE(0x6000, 0x6fff) AM_WRITE(SMH_ROM) + AM_RANGE(0x6000, 0x7fff) AM_ROMBANK(1) AM_RANGE(0x7000, 0x7000) AM_WRITE(contra_bankswitch_w) - AM_RANGE(0x7001, 0xffff) AM_WRITE(SMH_ROM) AM_RANGE(0x8000, 0xffff) AM_ROM ADDRESS_MAP_END diff --git a/src/mame/drivers/cosmic.c b/src/mame/drivers/cosmic.c index 5460edcae95..bd3f529b29a 100644 --- a/src/mame/drivers/cosmic.c +++ b/src/mame/drivers/cosmic.c @@ -1578,7 +1578,7 @@ static DRIVER_INIT( nomnlnd ) { const device_config *dac = devtag_get_device(machine, "dac"); memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5000, 0x5001, 0, 0, nomnlnd_port_0_1_r); - memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4800, 0x4800, 0, 0, SMH_NOP); + memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4800, 0x4800, 0, 0, (write8_space_func)SMH_NOP); memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4807, 0x4807, 0, 0, cosmic_background_enable_w); memory_install_write8_device_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), dac, 0x480a, 0x480a, 0, 0, dac_w); } diff --git a/src/mame/drivers/cps2.c b/src/mame/drivers/cps2.c index 7442ab8215b..103f0d65b25 100644 --- a/src/mame/drivers/cps2.c +++ b/src/mame/drivers/cps2.c @@ -7435,7 +7435,7 @@ static DRIVER_INIT( gigamn2 ) DRIVER_INIT_CALL(cps2); - gigamn2_dummyqsound_ram = auto_malloc(0x20000); + gigamn2_dummyqsound_ram = auto_alloc_array(machine, UINT16, 0x20000/2); memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x618000, 0x619fff, 0, 0, gigamn2_dummyqsound_r, gigamn2_dummyqsound_w); // no qsound.. memory_set_decrypted_region(space, 0x000000, (length) - 1, &rom[length/4]); m68k_set_encrypted_opcode_range(machine->cpu[0],0,length); diff --git a/src/mame/drivers/cps3.c b/src/mame/drivers/cps3.c index 059a3125ebe..57aaa8182f7 100644 --- a/src/mame/drivers/cps3.c +++ b/src/mame/drivers/cps3.c @@ -690,22 +690,22 @@ static DRIVER_INIT( cps3 ) cps3_user4region = memory_region(machine,"user4"); cps3_user5region = memory_region(machine,"user5"); - if (!cps3_user4region) cps3_user4region = auto_malloc(USER4REGION_LENGTH); - if (!cps3_user5region) cps3_user5region = auto_malloc(USER5REGION_LENGTH); + if (!cps3_user4region) cps3_user4region = auto_alloc_array(machine, UINT8, USER4REGION_LENGTH); + if (!cps3_user5region) cps3_user5region = auto_alloc_array(machine, UINT8, USER5REGION_LENGTH); // set strict verify sh2drc_set_options(machine->cpu[0], SH2DRC_STRICT_VERIFY); cps3_decrypt_bios(machine); - decrypted_gamerom = auto_malloc(0x1000000); + decrypted_gamerom = auto_alloc_array(machine, UINT32, 0x1000000/4); /* just some NOPs for the game to execute if it crashes and starts executing unmapped addresses - this prevents MAME from crashing */ - cps3_nops = auto_malloc(0x4); + cps3_nops = auto_alloc(machine, UINT32); cps3_nops[0] = 0x00090009; - cps3_0xc0000000_ram_decrypted = auto_malloc(0x400); + cps3_0xc0000000_ram_decrypted = auto_alloc_array(machine, UINT32, 0x400/4); memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), cps3_direct_handler); // flash roms @@ -713,7 +713,7 @@ static DRIVER_INIT( cps3 ) for (i=0;i<48;i++) intelflash_init( machine, i, FLASH_FUJITSU_29F016A, NULL ); - cps3_eeprom = auto_malloc(0x400); + cps3_eeprom = auto_alloc_array(machine, UINT32, 0x400/4); } static DRIVER_INIT( jojo ) { cps3_key1 = 0x02203ee3; cps3_key2 = 0x01301972; cps3_altEncryption = 0; DRIVER_INIT_CALL(cps3); } @@ -796,11 +796,11 @@ static void cps3_set_mame_colours(running_machine *machine, int colournum, UINT1 static VIDEO_START(cps3) { - cps3_ss_ram = auto_malloc(0x10000); + cps3_ss_ram = auto_alloc_array(machine, UINT32, 0x10000/4); memset(cps3_ss_ram, 0x00, 0x10000); state_save_register_global_pointer(machine, cps3_ss_ram, 0x10000/4); - cps3_char_ram = auto_malloc(0x800000); + cps3_char_ram = auto_alloc_array(machine, UINT32, 0x800000/4); memset(cps3_char_ram, 0x00, 0x800000); state_save_register_global_pointer(machine, cps3_char_ram, 0x800000 /4); @@ -815,14 +815,14 @@ static VIDEO_START(cps3) //decode_charram(); - cps3_mame_colours = auto_malloc(0x80000); + cps3_mame_colours = auto_alloc_array(machine, UINT32, 0x80000/4); memset(cps3_mame_colours, 0x00, 0x80000); cps3_screenwidth = 384; // the renderbuffer can be twice the size of the screen, this allows us to handle framebuffer zoom values // between 0x00 and 0x80 (0x40 is normal, 0x80 would be 'view twice as much', 0x20 is 'view half as much') - renderbuffer_bitmap = auto_bitmap_alloc(512*2,224*2,video_screen_get_format(machine->primary_screen)); + renderbuffer_bitmap = auto_bitmap_alloc(machine,512*2,224*2,video_screen_get_format(machine->primary_screen)); renderbuffer_clip.min_x = 0; renderbuffer_clip.max_x = cps3_screenwidth-1; diff --git a/src/mame/drivers/crimfght.c b/src/mame/drivers/crimfght.c index 5fb624d67a8..c02b355fe79 100644 --- a/src/mame/drivers/crimfght.c +++ b/src/mame/drivers/crimfght.c @@ -53,7 +53,7 @@ static WRITE8_DEVICE_HANDLER( crimfght_snd_bankswitch_w ) /********************************************/ static ADDRESS_MAP_START( crimfght_map, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x03ff) AM_READWRITE(SMH_BANK1, SMH_BANK1) /* banked RAM */ + AM_RANGE(0x0000, 0x03ff) AM_RAMBANK(1) /* banked RAM */ AM_RANGE(0x0400, 0x1fff) AM_RAM /* RAM */ AM_RANGE(0x3f80, 0x3f80) AM_READ_PORT("SYSTEM") AM_RANGE(0x3f81, 0x3f81) AM_READ_PORT("P1") @@ -66,7 +66,7 @@ static ADDRESS_MAP_START( crimfght_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x3f88, 0x3f88) AM_READWRITE(watchdog_reset_r, crimfght_coin_w) /* watchdog reset */ AM_RANGE(0x3f8c, 0x3f8c) AM_WRITE(crimfght_sh_irqtrigger_w) /* cause interrupt on audio CPU? */ AM_RANGE(0x2000, 0x5fff) AM_READWRITE(K052109_051960_r, K052109_051960_w) /* video RAM + sprite RAM */ - AM_RANGE(0x6000, 0x7fff) AM_READWRITE(SMH_BANK2, SMH_ROM) /* banked ROM */ + AM_RANGE(0x6000, 0x7fff) AM_ROMBANK(2) /* banked ROM */ AM_RANGE(0x8000, 0xffff) AM_ROM /* ROM */ ADDRESS_MAP_END @@ -344,11 +344,11 @@ static KONAMI_SETLINES_CALLBACK( crimfght_banking ) /* bit 5 = select work RAM or palette */ if (lines & 0x20) { - memory_install_readwrite8_handler(cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM), 0x0000, 0x03ff, 0, 0, SMH_BANK3, paletteram_xBBBBBGGGGGRRRRR_be_w); + memory_install_readwrite8_handler(cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM), 0x0000, 0x03ff, 0, 0, (read8_space_func)SMH_BANK(3), paletteram_xBBBBBGGGGGRRRRR_be_w); memory_set_bankptr(device->machine, 3, paletteram); } else - memory_install_readwrite8_handler(cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM), 0x0000, 0x03ff, 0, 0, SMH_BANK1, SMH_BANK1); /* RAM */ + memory_install_readwrite8_handler(cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM), 0x0000, 0x03ff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_BANK(1)); /* RAM */ /* bit 6 = enable char ROM reading through the video RAM */ K052109_set_RMRD_line((lines & 0x40) ? ASSERT_LINE : CLEAR_LINE); diff --git a/src/mame/drivers/crshrace.c b/src/mame/drivers/crshrace.c index cb35a0e5815..3dc45c26e07 100644 --- a/src/mame/drivers/crshrace.c +++ b/src/mame/drivers/crshrace.c @@ -213,7 +213,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x77ff) AM_ROM AM_RANGE(0x7800, 0x7fff) AM_RAM - AM_RANGE(0x8000, 0xffff) AM_READWRITE(SMH_BANK1, SMH_ROM) + AM_RANGE(0x8000, 0xffff) AM_ROMBANK(1) ADDRESS_MAP_END static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 ) diff --git a/src/mame/drivers/crystal.c b/src/mame/drivers/crystal.c index 04158448b8e..7025943be5e 100644 --- a/src/mame/drivers/crystal.c +++ b/src/mame/drivers/crystal.c @@ -443,7 +443,7 @@ static ADDRESS_MAP_START( crystal_mem, ADDRESS_SPACE_PROGRAM, 32 ) AM_RANGE(0x04800000, 0x04800fff) AM_DEVREADWRITE("vrender", vr0_snd_read, vr0_snd_write) AM_RANGE(0x05000000, 0x05000003) AM_READ(FlashCmd_r) AM_WRITE(FlashCmd_w) - AM_RANGE(0x05000000, 0x05ffffff) AM_READ(SMH_BANK1) + AM_RANGE(0x05000000, 0x05ffffff) AM_READ(SMH_BANK(1)) AM_RANGE(0x44414F4C, 0x44414F7F) AM_RAM AM_BASE(&ResetPatch) diff --git a/src/mame/drivers/cshooter.c b/src/mame/drivers/cshooter.c index cc3d476a46c..092418b3d9e 100644 --- a/src/mame/drivers/cshooter.c +++ b/src/mame/drivers/cshooter.c @@ -260,7 +260,7 @@ static READ8_HANDLER(pal_r) static ADDRESS_MAP_START( cshooter_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0xafff) AM_READWRITE(SMH_BANK1, SMH_RAM) + AM_RANGE(0x8000, 0xafff) AM_READWRITE(SMH_BANK(1), SMH_RAM) AM_RANGE(0xb000, 0xb0ff) AM_READ(SMH_RAM) // sound related ? AM_RANGE(0xc000, 0xc1ff) AM_WRITE(pal_w) AM_READ(pal_r) AM_BASE(&paletteram) AM_RANGE(0xc200, 0xc200) AM_READ_PORT("IN0") @@ -280,9 +280,9 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( airraid_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xb000, 0xb0ff) AM_RAM // sound related ? - AM_RANGE(0xb100, 0xb1ff) AM_RAM//READ(SMH_BANK1) // sound related ? + AM_RANGE(0xb100, 0xb1ff) AM_RAM//READ(SMH_BANK(1)) // sound related ? AM_RANGE(0xc000, 0xc000) AM_READ_PORT("IN0") AM_RANGE(0xc001, 0xc001) AM_READ_PORT("IN1") AM_RANGE(0xc002, 0xc002) AM_READ_PORT("IN2") @@ -666,7 +666,7 @@ static DRIVER_INIT( cshootre ) const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); int A; UINT8 *rom = memory_region(machine, "maincpu"); - UINT8 *decrypt = auto_malloc(0x8000); + UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x8000); memory_set_decrypted_region(space, 0x0000, 0x7fff, decrypt); diff --git a/src/mame/drivers/cubeqst.c b/src/mame/drivers/cubeqst.c index c0af730747b..e556967d274 100644 --- a/src/mame/drivers/cubeqst.c +++ b/src/mame/drivers/cubeqst.c @@ -72,7 +72,7 @@ static const rectangle overlay_clip = { 0, 320-1, 0, 256-8 }; static VIDEO_START( cubeqst ) { video_field = 0; - depth_buffer = auto_malloc(512); + depth_buffer = auto_alloc_array(machine, UINT8, 512); } /* TODO: Use resistor values */ @@ -80,7 +80,7 @@ static PALETTE_INIT( cubeqst ) { int i; - colormap = auto_malloc(65536 * sizeof(colormap[0])); + colormap = auto_alloc_array(machine, rgb_t, 65536); for (i = 0; i < 65536; ++i) { UINT8 a, r, g, b, y; diff --git a/src/mame/drivers/cubocd32.c b/src/mame/drivers/cubocd32.c index e7cb94fff64..235959b372a 100644 --- a/src/mame/drivers/cubocd32.c +++ b/src/mame/drivers/cubocd32.c @@ -64,10 +64,10 @@ static WRITE32_HANDLER( aga_overlay_w ) /* swap the write handlers between ROM and bank 1 based on the bit */ if ((data & 1) == 0) /* overlay disabled, map RAM on 0x000000 */ - memory_install_write32_handler(space, 0x000000, 0x1fffff, 0, 0, SMH_BANK1); + memory_install_write32_handler(space, 0x000000, 0x1fffff, 0, 0, (write32_space_func)SMH_BANK(1)); else /* overlay enabled, map Amiga system ROM on 0x000000 */ - memory_install_write32_handler(space, 0x000000, 0x1fffff, 0, 0, SMH_UNMAP); + memory_install_write32_handler(space, 0x000000, 0x1fffff, 0, 0, (write32_space_func)SMH_UNMAP); } } diff --git a/src/mame/drivers/cultures.c b/src/mame/drivers/cultures.c index 8771e7b0a86..0c6141a778d 100644 --- a/src/mame/drivers/cultures.c +++ b/src/mame/drivers/cultures.c @@ -435,7 +435,7 @@ ROM_END static DRIVER_INIT( cultures ) { - paletteram = auto_malloc(0x4000); + paletteram = auto_alloc_array(machine, UINT8, 0x4000); } GAME( 1994, cultures, 0, cultures, cultures, cultures, ROT0, "Face", "Jibun wo Migaku Culture School Mahjong Hen", 0 ) diff --git a/src/mame/drivers/cvs.c b/src/mame/drivers/cvs.c index 206b5cd13c3..bcb3d88618e 100644 --- a/src/mame/drivers/cvs.c +++ b/src/mame/drivers/cvs.c @@ -504,9 +504,9 @@ static WRITE8_HANDLER( audio_command_w ) MACHINE_START( cvs ) { /* allocate memory */ - cvs_color_ram = auto_malloc(0x400); - cvs_palette_ram = auto_malloc(0x10); - cvs_character_ram = auto_malloc(3 * 0x800); /* only half is used, but + cvs_color_ram = auto_alloc_array(machine, UINT8, 0x400); + cvs_palette_ram = auto_alloc_array(machine, UINT8, 0x10); + cvs_character_ram = auto_alloc_array(machine, UINT8, 3 * 0x800); /* only half is used, but by allocating twice the amount, we can use the same gfx_layout */ diff --git a/src/mame/drivers/darius.c b/src/mame/drivers/darius.c index 02b320ccb63..0b8e602a4ac 100644 --- a/src/mame/drivers/darius.c +++ b/src/mame/drivers/darius.c @@ -473,7 +473,7 @@ static WRITE8_DEVICE_HANDLER( darius_write_portB1 ) *****************************************************/ static ADDRESS_MAP_START( darius_sound_map, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x7fff) AM_READWRITE(SMH_BANK1, SMH_ROM) + AM_RANGE(0x0000, 0x7fff) AM_ROMBANK(1) AM_RANGE(0x8000, 0x8fff) AM_RAM AM_RANGE(0x9000, 0x9001) AM_DEVREADWRITE("ym1", ym2203_r, ym2203_w) AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE("ym2", ym2203_r, ym2203_w) diff --git a/src/mame/drivers/darkmist.c b/src/mame/drivers/darkmist.c index 2bf7f30aa62..82b8eaa8fb9 100644 --- a/src/mame/drivers/darkmist.c +++ b/src/mame/drivers/darkmist.c @@ -60,7 +60,7 @@ static WRITE8_HANDLER(t5182shared_w) static ADDRESS_MAP_START( memmap, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xc801, 0xc801) AM_READ_PORT("P1") AM_RANGE(0xc802, 0xc802) AM_READ_PORT("P2") AM_RANGE(0xc803, 0xc803) AM_READ_PORT("START") @@ -336,7 +336,7 @@ ROM_END static void decrypt_gfx(running_machine *machine) { - UINT8 *buf = malloc_or_die(0x40000); + UINT8 *buf = alloc_array_or_die(UINT8, 0x40000); UINT8 *rom; int size; int i; @@ -426,8 +426,8 @@ static DRIVER_INIT(darkmist) const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); int i, len; UINT8 *ROM = memory_region(machine, "maincpu"); - UINT8 *buffer = malloc_or_die(0x10000); - UINT8 *decrypt = auto_malloc(0x8000); + UINT8 *buffer = alloc_array_or_die(UINT8, 0x10000); + UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x8000); decrypt_gfx(machine); diff --git a/src/mame/drivers/darkseal.c b/src/mame/drivers/darkseal.c index 6a1d59d96cd..e2a3455700e 100644 --- a/src/mame/drivers/darkseal.c +++ b/src/mame/drivers/darkseal.c @@ -97,7 +97,7 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x120000, 0x120001) AM_DEVREADWRITE("oki1", okim6295_r, okim6295_w) AM_RANGE(0x130000, 0x130001) AM_DEVREADWRITE("oki2", okim6295_r, okim6295_w) AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r) - AM_RANGE(0x1f0000, 0x1f1fff) AM_READWRITE(SMH_BANK8, SMH_BANK8) + AM_RANGE(0x1f0000, 0x1f1fff) AM_RAMBANK(8) AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE(h6280_timer_w) AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE(h6280_irq_status_w) ADDRESS_MAP_END diff --git a/src/mame/drivers/dassault.c b/src/mame/drivers/dassault.c index 11577d59ef4..9f3a88cf16d 100644 --- a/src/mame/drivers/dassault.c +++ b/src/mame/drivers/dassault.c @@ -260,7 +260,7 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x120000, 0x120001) AM_DEVREADWRITE("oki1", okim6295_r, okim6295_w) AM_RANGE(0x130000, 0x130001) AM_DEVREADWRITE("oki2", okim6295_r, okim6295_w) AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r) - AM_RANGE(0x1f0000, 0x1f1fff) AM_READWRITE(SMH_BANK8, SMH_BANK8) + AM_RANGE(0x1f0000, 0x1f1fff) AM_RAMBANK(8) AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE(h6280_timer_w) AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE(h6280_irq_status_w) ADDRESS_MAP_END @@ -807,7 +807,7 @@ static DRIVER_INIT( dassault ) { const UINT8 *src = memory_region(machine, "gfx1"); UINT8 *dst = memory_region(machine, "gfx2"); - UINT8 *tmp = malloc_or_die(0x80000); + UINT8 *tmp = alloc_array_or_die(UINT8, 0x80000); /* Playfield 4 also has access to the char graphics, make things easier by just copying the chars to both banks (if I just used a different gfx @@ -827,7 +827,7 @@ static DRIVER_INIT( thndzone ) { const UINT8 *src = memory_region(machine, "gfx1"); UINT8 *dst = memory_region(machine, "gfx2"); - UINT8 *tmp = malloc_or_die(0x80000); + UINT8 *tmp = alloc_array_or_die(UINT8, 0x80000); /* Playfield 4 also has access to the char graphics, make things easier by just copying the chars to both banks (if I just used a different gfx diff --git a/src/mame/drivers/ddayjlc.c b/src/mame/drivers/ddayjlc.c index 3f2c69197a5..61b395816e7 100644 --- a/src/mame/drivers/ddayjlc.c +++ b/src/mame/drivers/ddayjlc.c @@ -556,7 +556,7 @@ static DRIVER_INIT( ddayjlc ) { UINT32 oldaddr, newadr, length,j; UINT8 *src, *dst, *temp; - temp = malloc_or_die(0x10000); + temp = alloc_array_or_die(UINT8, 0x10000); src = temp; dst = memory_region(machine, "gfx1"); length = memory_region_length(machine, "gfx1"); diff --git a/src/mame/drivers/ddenlovr.c b/src/mame/drivers/ddenlovr.c index 0bec46656e1..7ddd461b987 100644 --- a/src/mame/drivers/ddenlovr.c +++ b/src/mame/drivers/ddenlovr.c @@ -159,7 +159,7 @@ VIDEO_START(ddenlovr) int i; for (i = 0; i < 8; i++) { - ddenlovr_pixmap[i] = auto_malloc(512*512); + ddenlovr_pixmap[i] = auto_alloc_array(machine, UINT8, 512*512); ddenlovr_scroll[i*2+0] = ddenlovr_scroll[i*2+1] = 0; } @@ -1881,8 +1881,8 @@ static WRITE8_HANDLER( rongrong_select_w ) static ADDRESS_MAP_START( quizchq_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x5fff) AM_ROM // ROM AM_RANGE(0x6000, 0x6fff) AM_RAM // RAM - AM_RANGE(0x7000, 0x7fff) AM_READWRITE(SMH_BANK2, SMH_BANK2) // RAM (Banked) - AM_RANGE(0x8000, 0xffff) AM_READWRITE(SMH_BANK1, rongrong_palette_w) // ROM (Banked) + AM_RANGE(0x7000, 0x7fff) AM_RAMBANK(2) // RAM (Banked) + AM_RANGE(0x8000, 0xffff) AM_ROMBANK(1) AM_WRITE(rongrong_palette_w) // ROM (Banked) ADDRESS_MAP_END static ADDRESS_MAP_START( quizchq_portmap, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_GLOBAL_MASK(0xff) @@ -1917,8 +1917,8 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( rongrong_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x5fff) AM_ROM // ROM AM_RANGE(0x6000, 0x6fff) AM_RAM // RAM - AM_RANGE(0x7000, 0x7fff) AM_READWRITE(SMH_BANK2, SMH_BANK2) // RAM (Banked) - AM_RANGE(0x8000, 0xffff) AM_READWRITE(SMH_BANK1, rongrong_palette_w) // ROM (Banked) + AM_RANGE(0x7000, 0x7fff) AM_RAMBANK(2) // RAM (Banked) + AM_RANGE(0x8000, 0xffff) AM_ROMBANK(1) AM_WRITE(rongrong_palette_w) // ROM (Banked) ADDRESS_MAP_END static ADDRESS_MAP_START( rongrong_portmap, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_GLOBAL_MASK(0xff) @@ -2026,8 +2026,8 @@ static ADDRESS_MAP_START( mmpanic_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0051, 0x0051) AM_READ(magic_r) // ? AM_RANGE(0x0000, 0x5fff) AM_ROM // ROM AM_RANGE(0x6000, 0x6fff) AM_RAM // RAM - AM_RANGE(0x7000, 0x7fff) AM_READWRITE(SMH_BANK2, SMH_BANK2) // RAM (Banked) - AM_RANGE(0x8000, 0xffff) AM_READWRITE(SMH_BANK1, rongrong_palette_w) // ROM (Banked) + AM_RANGE(0x7000, 0x7fff) AM_RAMBANK(2) // RAM (Banked) + AM_RANGE(0x8000, 0xffff) AM_ROMBANK(1) AM_WRITE(rongrong_palette_w) // ROM (Banked) ADDRESS_MAP_END static ADDRESS_MAP_START( mmpanic_portmap, ADDRESS_SPACE_IO, 8 ) @@ -2103,9 +2103,9 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( funkyfig_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x5fff) AM_ROM AM_RANGE(0x6000, 0x6fff) AM_RAM - AM_RANGE(0x7000, 0x7fff) AM_READWRITE(SMH_BANK2, SMH_BANK2) // RAM (Banked) + AM_RANGE(0x7000, 0x7fff) AM_RAMBANK(2) // RAM (Banked) - AM_RANGE(0x8000, 0xffff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xffff) AM_ROMBANK(1) AM_RANGE(0x8000, 0x81ff) AM_WRITE(rongrong_palette_w) AM_RANGE(0x8400, 0x87ff) AM_WRITENOP ADDRESS_MAP_END @@ -2242,8 +2242,8 @@ static WRITE8_HANDLER( hanakanz_rombank_w ) static ADDRESS_MAP_START( hanakanz_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x5fff) AM_ROM // ROM AM_RANGE(0x6000, 0x6fff) AM_RAM // RAM - AM_RANGE(0x7000, 0x7fff) AM_READWRITE(SMH_BANK2, SMH_BANK2) // RAM (Banked) - AM_RANGE(0x8000, 0xffff) AM_READ(SMH_BANK1) // ROM (Banked) + AM_RANGE(0x7000, 0x7fff) AM_RAMBANK(2) // RAM (Banked) + AM_RANGE(0x8000, 0xffff) AM_ROMBANK(1) // ROM (Banked) ADDRESS_MAP_END @@ -2570,8 +2570,8 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( mjmyster_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x5fff) AM_ROM // ROM AM_RANGE(0x6000, 0x6fff) AM_RAM // RAM - AM_RANGE(0x7000, 0x7fff) AM_READWRITE(SMH_BANK2, SMH_BANK2) // RAM (Banked) - AM_RANGE(0x8000, 0xffff) AM_READ(SMH_BANK1) // ROM/RAM (Banked) + AM_RANGE(0x7000, 0x7fff) AM_RAMBANK(2) // RAM (Banked) + AM_RANGE(0x8000, 0xffff) AM_ROMBANK(1) // ROM/RAM (Banked) AM_RANGE(0xf000, 0xf1ff) AM_WRITE(rongrong_palette_w) // RAM enabled by bit 4 of rombank AM_RANGE(0xf200, 0xffff) AM_WRITENOP // "" ADDRESS_MAP_END @@ -2706,9 +2706,9 @@ static READ8_HANDLER( hginga_protection_r ) static ADDRESS_MAP_START( hginga_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x5fff) AM_ROM // ROM AM_RANGE(0x6000, 0x6fff) AM_RAM // RAM - AM_RANGE(0x7000, 0x7fff) AM_READWRITE(SMH_BANK2, SMH_BANK2) // RAM (Banked) + AM_RANGE(0x7000, 0x7fff) AM_RAMBANK(2) // RAM (Banked) AM_RANGE(0xf601, 0xf601) AM_READ(hginga_protection_r) - AM_RANGE(0x8000, 0xffff) AM_READ(SMH_BANK1) // ROM/RAM (Banked) + AM_RANGE(0x8000, 0xffff) AM_ROMBANK(1) // ROM/RAM (Banked) AM_RANGE(0xf000, 0xf1ff) AM_WRITE(rongrong_palette_w) // RAM enabled by bit 4 of rombank AM_RANGE(0xf700, 0xf706) AM_WRITENOP ADDRESS_MAP_END @@ -2920,9 +2920,9 @@ static READ8_HANDLER( hgokou_protection_r ) static ADDRESS_MAP_START( hgokou_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x5fff) AM_ROM // ROM AM_RANGE(0x6000, 0x6fff) AM_RAM // RAM - AM_RANGE(0x7000, 0x7fff) AM_READWRITE(SMH_BANK2, SMH_BANK2) // RAM (Banked) + AM_RANGE(0x7000, 0x7fff) AM_RAMBANK(2) // RAM (Banked) AM_RANGE(0xe601, 0xe601) AM_READ(hgokou_protection_r) - AM_RANGE(0x8000, 0xffff) AM_READ(SMH_BANK1) // ROM (Banked) + AM_RANGE(0x8000, 0xffff) AM_ROMBANK(1) // ROM (Banked) AM_RANGE(0xe000, 0xe1ff) AM_WRITE(rongrong_palette_w) AM_RANGE(0xe700, 0xe706) AM_WRITENOP ADDRESS_MAP_END @@ -3012,8 +3012,8 @@ static WRITE8_HANDLER( hparadis_coin_w ) static ADDRESS_MAP_START( hparadis_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x5fff) AM_ROM // ROM AM_RANGE(0x6000, 0x6fff) AM_RAM // RAM - AM_RANGE(0x7000, 0x7fff) AM_READWRITE(SMH_BANK2, SMH_BANK2) // RAM (Banked) - AM_RANGE(0x8000, 0xffff) AM_READ(SMH_BANK1) // ROM (Banked) + AM_RANGE(0x7000, 0x7fff) AM_RAMBANK(2) // RAM (Banked) + AM_RANGE(0x8000, 0xffff) AM_ROMBANK(1) // ROM (Banked) AM_RANGE(0xc000, 0xc1ff) AM_WRITE(rongrong_palette_w) ADDRESS_MAP_END @@ -7896,7 +7896,7 @@ static DRIVER_INIT( rongrong ) version of the game might be a bootleg with the protection patched. (both sets need this) */ - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x60d4, 0x60d4, 0, 0, SMH_NOP); + memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x60d4, 0x60d4, 0, 0, (read8_space_func)SMH_NOP); } /*************************************************************************** diff --git a/src/mame/drivers/ddragon.c b/src/mame/drivers/ddragon.c index ca69361538f..6908ebf5ec4 100644 --- a/src/mame/drivers/ddragon.c +++ b/src/mame/drivers/ddragon.c @@ -293,7 +293,7 @@ static WRITE8_HANDLER( darktowr_bankswitch_w ) if (newbank == 4 && oldbank != 4) memory_install_readwrite8_handler(space, 0x4000, 0x7fff, 0, 0, darktowr_mcu_bank_r, darktowr_mcu_bank_w); else if (newbank != 4 && oldbank == 4) - memory_install_readwrite8_handler(space, 0x4000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1); + memory_install_readwrite8_handler(space, 0x4000, 0x7fff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_BANK(1)); } diff --git a/src/mame/drivers/ddrible.c b/src/mame/drivers/ddrible.c index 2708d830226..ec16800f33b 100644 --- a/src/mame/drivers/ddrible.c +++ b/src/mame/drivers/ddrible.c @@ -135,7 +135,7 @@ static ADDRESS_MAP_START( cpu0_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x6000, 0x6fff) AM_RAM_WRITE(ddrible_bg_videoram_w) AM_BASE(&ddrible_bg_videoram) /* Video RAM 2 */ AM_RANGE(0x7000, 0x7fff) AM_RAM AM_BASE(&ddrible_spriteram_2) /* Object RAM 2 */ AM_RANGE(0x8000, 0x8000) AM_WRITE(ddrible_bankswitch_w) /* bankswitch control */ - AM_RANGE(0x8000, 0x9fff) AM_READ(SMH_BANK1) /* banked ROM */ + AM_RANGE(0x8000, 0x9fff) AM_ROMBANK(1) /* banked ROM */ AM_RANGE(0x8000, 0xffff) AM_WRITE(SMH_ROM) /* ROM */ AM_RANGE(0xa000, 0xffff) AM_ROM /* ROM */ ADDRESS_MAP_END diff --git a/src/mame/drivers/dec0.c b/src/mame/drivers/dec0.c index 49d14090bef..dfbe7121eb9 100644 --- a/src/mame/drivers/dec0.c +++ b/src/mame/drivers/dec0.c @@ -208,7 +208,7 @@ static ADDRESS_MAP_START( hippodrm_sub_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x1a0000, 0x1a001f) AM_WRITE(dec0_pf3_control_8bit_w) AM_RANGE(0x1a1000, 0x1a17ff) AM_READWRITE(dec0_pf3_data_8bit_r, dec0_pf3_data_8bit_w) AM_RANGE(0x1d0000, 0x1d00ff) AM_READWRITE(hippodrm_prot_r, hippodrm_prot_w) - AM_RANGE(0x1f0000, 0x1f1fff) AM_READWRITE(SMH_BANK8, SMH_BANK8) /* Main ram */ + AM_RANGE(0x1f0000, 0x1f1fff) AM_RAMBANK(8) /* Main ram */ AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE(h6280_irq_status_w) AM_RANGE(0x1ff402, 0x1ff403) AM_READ_PORT("VBLANK") ADDRESS_MAP_END @@ -301,7 +301,7 @@ static ADDRESS_MAP_START( slyspy_s_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0b0000, 0x0b0001) AM_DEVWRITE("ym1", ym2203_w) AM_RANGE(0x0e0000, 0x0e0001) AM_DEVREADWRITE("oki", okim6295_r, okim6295_w) AM_RANGE(0x0f0000, 0x0f0001) AM_READ(soundlatch_r) - AM_RANGE(0x1f0000, 0x1f1fff) AM_READWRITE(SMH_BANK8, SMH_BANK8) + AM_RANGE(0x1f0000, 0x1f1fff) AM_RAMBANK(8) AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE(h6280_irq_status_w) ADDRESS_MAP_END @@ -311,7 +311,7 @@ static ADDRESS_MAP_START( midres_s_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x118000, 0x118001) AM_DEVWRITE("ym1", ym2203_w) AM_RANGE(0x130000, 0x130001) AM_DEVREADWRITE("oki", okim6295_r, okim6295_w) AM_RANGE(0x138000, 0x138001) AM_READ(soundlatch_r) - AM_RANGE(0x1f0000, 0x1f1fff) AM_READWRITE(SMH_BANK8, SMH_BANK8) + AM_RANGE(0x1f0000, 0x1f1fff) AM_RAMBANK(8) AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE(h6280_irq_status_w) ADDRESS_MAP_END diff --git a/src/mame/drivers/dec8.c b/src/mame/drivers/dec8.c index 7fc0f4d2718..18b1735b243 100644 --- a/src/mame/drivers/dec8.c +++ b/src/mame/drivers/dec8.c @@ -522,7 +522,7 @@ static ADDRESS_MAP_START( cobra_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x3c00, 0x3c00) AM_WRITE(dec8_bank_w) AM_RANGE(0x3c02, 0x3c02) AM_WRITE(buffer_spriteram_w) /* DMA */ AM_RANGE(0x3e00, 0x3e00) AM_WRITE(dec8_sound_w) - AM_RANGE(0x4000, 0x7fff) AM_READWRITE(SMH_BANK1, SMH_ROM) + AM_RANGE(0x4000, 0x7fff) AM_ROMBANK(1) AM_RANGE(0x8000, 0xffff) AM_ROM ADDRESS_MAP_END @@ -546,7 +546,7 @@ static ADDRESS_MAP_START( ghostb_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x3840, 0x3840) AM_WRITE(ghostb_bank_w) AM_RANGE(0x3860, 0x3860) AM_READ(i8751_l_r) AM_RANGE(0x3860, 0x3861) AM_WRITE(ghostb_i8751_w) - AM_RANGE(0x4000, 0x7fff) AM_READWRITE(SMH_BANK1, SMH_ROM) + AM_RANGE(0x4000, 0x7fff) AM_ROMBANK(1) AM_RANGE(0x8000, 0xffff) AM_ROM ADDRESS_MAP_END @@ -569,7 +569,7 @@ static ADDRESS_MAP_START( srdarwin_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x3801, 0x3801) AM_READ_PORT("IN0") /* Player 1 */ AM_RANGE(0x3802, 0x3802) AM_READ_PORT("IN1") /* Player 2 (cocktail) + VBL */ AM_RANGE(0x3803, 0x3803) AM_READ_PORT("DSW1") /* Dip 2 */ - AM_RANGE(0x4000, 0x7fff) AM_READWRITE(SMH_BANK1, SMH_ROM) + AM_RANGE(0x4000, 0x7fff) AM_ROMBANK(1) AM_RANGE(0x8000, 0xffff) AM_ROM ADDRESS_MAP_END @@ -592,7 +592,7 @@ static ADDRESS_MAP_START( gondo_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x3838, 0x3838) AM_READ(i8751_h_r) AM_RANGE(0x3839, 0x3839) AM_READ(i8751_l_r) AM_RANGE(0x383a, 0x383b) AM_WRITE(gondo_i8751_w) - AM_RANGE(0x4000, 0x7fff) AM_READWRITE(SMH_BANK1, SMH_ROM) + AM_RANGE(0x4000, 0x7fff) AM_ROMBANK(1) AM_RANGE(0x8000, 0xffff) AM_ROM ADDRESS_MAP_END @@ -615,7 +615,7 @@ static ADDRESS_MAP_START( oscar_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x3d80, 0x3d80) AM_WRITE(oscar_sound_w) /* SOUN */ AM_RANGE(0x3e00, 0x3e00) AM_WRITENOP /* COINCL */ AM_RANGE(0x3e80, 0x3e83) AM_WRITE(oscar_int_w) - AM_RANGE(0x4000, 0x7fff) AM_READWRITE(SMH_BANK1, SMH_ROM) + AM_RANGE(0x4000, 0x7fff) AM_ROMBANK(1) AM_RANGE(0x8000, 0xffff) AM_ROM ADDRESS_MAP_END @@ -649,7 +649,7 @@ static ADDRESS_MAP_START( lastmiss_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x2800, 0x2fff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size) AM_RANGE(0x3000, 0x37ff) AM_RAM AM_SHARE(2) AM_RANGE(0x3800, 0x3fff) AM_READWRITE(dec8_pf0_data_r, dec8_pf0_data_w) AM_BASE(&dec8_pf0_data) - AM_RANGE(0x4000, 0x7fff) AM_READWRITE(SMH_BANK1, SMH_ROM) + AM_RANGE(0x4000, 0x7fff) AM_ROMBANK(1) AM_RANGE(0x8000, 0xffff) AM_ROM ADDRESS_MAP_END @@ -693,7 +693,7 @@ static ADDRESS_MAP_START( shackled_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x2800, 0x2fff) AM_READWRITE(shackled_sprite_r, shackled_sprite_w) AM_RANGE(0x3000, 0x37ff) AM_RAM AM_SHARE(2) AM_RANGE(0x3800, 0x3fff) AM_READWRITE(dec8_pf0_data_r, dec8_pf0_data_w) AM_BASE(&dec8_pf0_data) - AM_RANGE(0x4000, 0x7fff) AM_READWRITE(SMH_BANK1, SMH_ROM) + AM_RANGE(0x4000, 0x7fff) AM_ROMBANK(1) AM_RANGE(0x8000, 0xffff) AM_ROM ADDRESS_MAP_END @@ -743,7 +743,7 @@ static ADDRESS_MAP_START( csilver_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x2800, 0x2fff) AM_READWRITE(shackled_sprite_r, shackled_sprite_w) AM_RANGE(0x3000, 0x37ff) AM_RAM AM_SHARE(2) AM_RANGE(0x3800, 0x3fff) AM_READWRITE(dec8_pf0_data_r, dec8_pf0_data_w) AM_BASE(&dec8_pf0_data) - AM_RANGE(0x4000, 0x7fff) AM_READWRITE(SMH_BANK1, SMH_ROM) + AM_RANGE(0x4000, 0x7fff) AM_ROMBANK(1) AM_RANGE(0x8000, 0xffff) AM_ROM ADDRESS_MAP_END @@ -781,7 +781,7 @@ static ADDRESS_MAP_START( garyoret_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x3838, 0x3839) AM_WRITE(garyoret_i8751_w) AM_RANGE(0x383a, 0x383a) AM_READ(i8751_h_r) AM_RANGE(0x383b, 0x383b) AM_READ(i8751_l_r) - AM_RANGE(0x4000, 0x7fff) AM_READWRITE(SMH_BANK1, SMH_ROM) + AM_RANGE(0x4000, 0x7fff) AM_ROMBANK(1) AM_RANGE(0x8000, 0xffff) AM_ROM ADDRESS_MAP_END @@ -823,7 +823,7 @@ static ADDRESS_MAP_START( csilver_s_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x2000, 0x2000) AM_WRITE(csilver_sound_bank_w) AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_r) AM_RANGE(0x3400, 0x3400) AM_DEVREAD("msm", csilver_adpcm_reset_r) /* ? not sure */ - AM_RANGE(0x4000, 0x7fff) AM_READWRITE(SMH_BANK3, SMH_ROM) + AM_RANGE(0x4000, 0x7fff) AM_ROMBANK(3) AM_RANGE(0x8000, 0xffff) AM_ROM ADDRESS_MAP_END @@ -3303,7 +3303,7 @@ static DRIVER_INIT( deco222 ) /* bits 5 and 6 of the opcodes are swapped */ rom = memory_region(machine, "audiocpu"); - decrypt = auto_malloc(0x8000); + decrypt = auto_alloc_array(machine, UINT8, 0x8000); memory_set_decrypted_region(space, 0x8000, 0xffff, decrypt); diff --git a/src/mame/drivers/deco156.c b/src/mame/drivers/deco156.c index ea15888b8ff..25273bb58db 100644 --- a/src/mame/drivers/deco156.c +++ b/src/mame/drivers/deco156.c @@ -34,12 +34,12 @@ static int simpl156_bank_callback(const int bank) static VIDEO_START( wcvol95 ) { /* allocate the ram as 16-bit (we do it here because the CPU is 32-bit) */ - deco16_pf1_data = auto_malloc(0x2000); - deco16_pf2_data = auto_malloc(0x2000); - deco16_pf1_rowscroll = auto_malloc(0x800); - deco16_pf2_rowscroll = auto_malloc(0x800); - deco16_pf12_control = auto_malloc(0x10); - paletteram16 = auto_malloc(0x1000); + deco16_pf1_data = auto_alloc_array(machine, UINT16, 0x2000/2); + deco16_pf2_data = auto_alloc_array(machine, UINT16, 0x2000/2); + deco16_pf1_rowscroll = auto_alloc_array(machine, UINT16, 0x800/2); + deco16_pf2_rowscroll = auto_alloc_array(machine, UINT16, 0x800/2); + deco16_pf12_control = auto_alloc_array(machine, UINT16, 0x10/2); + paletteram16 = auto_alloc_array(machine, UINT16, 0x1000/2); /* and register the allocated ram so that save states still work */ state_save_register_global_pointer(machine, deco16_pf1_data, 0x2000/2); @@ -640,7 +640,7 @@ static void descramble_sound( running_machine *machine, const char *tag ) { UINT8 *rom = memory_region(machine, tag); int length = memory_region_length(machine, tag); - UINT8 *buf1 = malloc_or_die(length); + UINT8 *buf1 = alloc_array_or_die(UINT8, length); UINT32 x; for (x=0;x<length;x++) diff --git a/src/mame/drivers/deco32.c b/src/mame/drivers/deco32.c index 70be0403129..b6118d26182 100644 --- a/src/mame/drivers/deco32.c +++ b/src/mame/drivers/deco32.c @@ -955,7 +955,7 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x120000, 0x120001) AM_DEVREADWRITE("oki1", okim6295_r, okim6295_w) AM_RANGE(0x130000, 0x130001) AM_DEVREADWRITE("oki2", okim6295_r, okim6295_w) AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r) - AM_RANGE(0x1f0000, 0x1f1fff) AM_READWRITE(SMH_BANK8, SMH_BANK8) + AM_RANGE(0x1f0000, 0x1f1fff) AM_RAMBANK(8) AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE(h6280_timer_w) AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE(h6280_irq_status_w) ADDRESS_MAP_END @@ -3027,7 +3027,7 @@ static DRIVER_INIT( lockload ) static DRIVER_INIT( tattass ) { UINT8 *RAM = memory_region(machine, "gfx1"); - UINT8 *tmp = malloc_or_die(0x80000); + UINT8 *tmp = alloc_array_or_die(UINT8, 0x80000); /* Reorder bitplanes to make decoding easier */ memcpy(tmp,RAM+0x80000,0x80000); @@ -3048,7 +3048,7 @@ static DRIVER_INIT( tattass ) static DRIVER_INIT( nslasher ) { UINT8 *RAM = memory_region(machine, "gfx1"); - UINT8 *tmp = malloc_or_die(0x80000); + UINT8 *tmp = alloc_array_or_die(UINT8, 0x80000); /* Reorder bitplanes to make decoding easier */ memcpy(tmp,RAM+0x80000,0x80000); diff --git a/src/mame/drivers/deco_mlc.c b/src/mame/drivers/deco_mlc.c index 058829fa8b9..3fb3bd05331 100644 --- a/src/mame/drivers/deco_mlc.c +++ b/src/mame/drivers/deco_mlc.c @@ -697,7 +697,7 @@ static void descramble_sound( running_machine *machine ) /* the same as simpl156 / heavy smash? */ UINT8 *rom = memory_region(machine, "ymz"); int length = memory_region_length(machine, "ymz"); - UINT8 *buf1 = malloc_or_die(length); + UINT8 *buf1 = alloc_array_or_die(UINT8, length); UINT32 x; diff --git a/src/mame/drivers/decocass.c b/src/mame/drivers/decocass.c index beccad3b916..4fc24cee401 100644 --- a/src/mame/drivers/decocass.c +++ b/src/mame/drivers/decocass.c @@ -1048,7 +1048,7 @@ static DRIVER_INIT( decocass ) int A; /* allocate memory and mark all RAM regions with their decrypted pointers */ - decrypted = auto_malloc(0x10000); + decrypted = auto_alloc_array(machine, UINT8, 0x10000); memory_set_decrypted_region(space, 0x0000, 0xc7ff, &decrypted[0x0000]); memory_set_decrypted_region(space, 0xd000, 0xdbff, &decrypted[0xd000]); memory_set_decrypted_region(space, 0xf000, 0xffff, &decrypted[0xf000]); @@ -1067,7 +1067,7 @@ static DRIVER_INIT( decocrom ) { int romlength = memory_region_length(machine, "user3"); UINT8 *rom = memory_region(machine, "user3"); - UINT8 *decrypted2 = auto_malloc(romlength); + UINT8 *decrypted2 = auto_alloc_array(machine, UINT8, romlength); int i; /* standard init */ @@ -1078,7 +1078,7 @@ static DRIVER_INIT( decocrom ) decrypted2[i] = swap_bits_5_6(rom[i]); /* convert charram to a banked ROM */ - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6000, 0xafff, 0, 0, SMH_BANK1, decocass_de0091_w); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6000, 0xafff, 0, 0, (read8_space_func)SMH_BANK(1), decocass_de0091_w); memory_configure_bank(machine, 1, 0, 1, decocass_charram, 0); memory_configure_bank(machine, 1, 1, 1, memory_region(machine, "user3"), 0); memory_configure_bank_decrypted(machine, 1, 0, 1, &decrypted[0x6000], 0); diff --git a/src/mame/drivers/deshoros.c b/src/mame/drivers/deshoros.c index b221e892a80..9616df3ce2e 100644 --- a/src/mame/drivers/deshoros.c +++ b/src/mame/drivers/deshoros.c @@ -92,7 +92,7 @@ static WRITE8_HANDLER( io_w ) } static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x5fff) AM_READWRITE(SMH_BANK1, SMH_ROM) + AM_RANGE(0x0000, 0x5fff) AM_READWRITE(SMH_BANK(1), SMH_ROM) AM_RANGE(0x8000, 0x87ff) AM_RAM AM_RANGE(0x9000, 0x900f) AM_READWRITE(io_r,io_w) AM_BASE(&io_ram) //i/o area AM_RANGE(0xc000, 0xffff) AM_ROM diff --git a/src/mame/drivers/dgpix.c b/src/mame/drivers/dgpix.c index c61107efbc0..6ac3dfd3f42 100644 --- a/src/mame/drivers/dgpix.c +++ b/src/mame/drivers/dgpix.c @@ -269,7 +269,7 @@ INPUT_PORTS_END static VIDEO_START( dgpix ) { - vram = auto_malloc(0x40000*2); + vram = auto_alloc_array(machine, UINT32, 0x40000*2/4); } static VIDEO_UPDATE( dgpix ) @@ -566,7 +566,7 @@ static DRIVER_INIT( xfiles ) rom[BYTE4_XOR_BE(0x3aa933)] = 0; // protection related ? -// memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf0c8b440, 0xf0c8b447, 0, 0, SMH_NOP ); +// memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf0c8b440, 0xf0c8b447, 0, 0, (read32_space_func)SMH_NOP ); flash_roms = 2; } @@ -586,7 +586,7 @@ static DRIVER_INIT( kdynastg ) rom[BYTE4_XOR_BE(0x3a45c9)] = 0; // protection related ? -// memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x12341234, 0x12341243, 0, 0, SMH_NOP ); +// memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x12341234, 0x12341243, 0, 0, (read32_space_func)SMH_NOP ); flash_roms = 4; } diff --git a/src/mame/drivers/dietgo.c b/src/mame/drivers/dietgo.c index 53bfecd70fc..963d21bb5b7 100644 --- a/src/mame/drivers/dietgo.c +++ b/src/mame/drivers/dietgo.c @@ -39,7 +39,7 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x120000, 0x120001) AM_DEVREADWRITE("oki", okim6295_r, okim6295_w) AM_RANGE(0x130000, 0x130001) AM_NOP /* This board only has 1 oki chip */ AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r) - AM_RANGE(0x1f0000, 0x1f1fff) AM_READWRITE(SMH_BANK8, SMH_BANK8) + AM_RANGE(0x1f0000, 0x1f1fff) AM_RAMBANK(8) AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE(h6280_timer_w) AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE(h6280_irq_status_w) ADDRESS_MAP_END diff --git a/src/mame/drivers/discoboy.c b/src/mame/drivers/discoboy.c index e5dee3d4de5..217e797cc6b 100644 --- a/src/mame/drivers/discoboy.c +++ b/src/mame/drivers/discoboy.c @@ -287,7 +287,7 @@ static WRITE8_HANDLER( discoboy_ram_att_w ) static ADDRESS_MAP_START( discoboy_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0xbfff) AM_READWRITE(SMH_BANK1, SMH_ROM) + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK(1) AM_RANGE(0xc000, 0xc7ff) AM_READWRITE(rambank_r, rambank_w) AM_RANGE(0xc800, 0xcfff) AM_READWRITE(discoboy_ram_att_r, discoboy_ram_att_w) AM_RANGE(0xd000, 0xdfff) AM_READWRITE(rambank2_r, rambank2_w) @@ -489,12 +489,12 @@ static DRIVER_INIT( discoboy ) { UINT8 *ROM = memory_region(machine, "maincpu"); - discoboy_ram_part1 = auto_malloc(0x800); - discoboy_ram_part2 = auto_malloc(0x800); - discoboy_ram_att = auto_malloc(0x800); + discoboy_ram_part1 = auto_alloc_array(machine, UINT8, 0x800); + discoboy_ram_part2 = auto_alloc_array(machine, UINT8, 0x800); + discoboy_ram_att = auto_alloc_array(machine, UINT8, 0x800); - discoboy_ram_part3 = auto_malloc(0x1000); - discoboy_ram_part4 = auto_malloc(0x1000); + discoboy_ram_part3 = auto_alloc_array(machine, UINT8, 0x1000); + discoboy_ram_part4 = auto_alloc_array(machine, UINT8, 0x1000); memset(discoboy_ram_part1,0,0x800); memset(discoboy_ram_part2,0,0x800); diff --git a/src/mame/drivers/djboy.c b/src/mame/drivers/djboy.c index d5877fd0ec2..ef3dccba747 100644 --- a/src/mame/drivers/djboy.c +++ b/src/mame/drivers/djboy.c @@ -738,9 +738,9 @@ static WRITE8_HANDLER( cpu2_bankswitch_w ) static ADDRESS_MAP_START( cpu0_am, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0xafff) AM_READ(SMH_BANK4) + AM_RANGE(0x8000, 0xafff) AM_READ(SMH_BANK(4)) AM_RANGE(0xb000, 0xbfff) AM_READWRITE( pandora_spriteram_r, pandora_spriteram_w ) - AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_BANK1) + AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xe000, 0xefff) AM_READ(SMH_RAM) AM_WRITE(SMH_RAM) AM_BASE(&sharedram) AM_RANGE(0xf000, 0xf7ff) AM_READ(SMH_RAM) AM_WRITE(SMH_RAM) AM_RANGE(0xf800, 0xffff) AM_READ(SMH_RAM) AM_WRITE(SMH_RAM) @@ -755,7 +755,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( cpu1_am, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK2) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(2)) AM_RANGE(0xc000, 0xcfff) AM_READ(SMH_RAM) AM_WRITE(djboy_videoram_w) AM_BASE(&videoram) AM_RANGE(0xd000, 0xd3ff) AM_READ(SMH_RAM) AM_WRITE(djboy_paletteram_w) AM_BASE(&paletteram) AM_RANGE(0xd400, 0xd8ff) AM_READ(SMH_RAM) AM_WRITE(SMH_RAM) @@ -778,7 +778,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( cpu2_am, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK3) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(3)) AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_RAM) AM_WRITE(SMH_RAM) ADDRESS_MAP_END diff --git a/src/mame/drivers/dkong.c b/src/mame/drivers/dkong.c index 4f1651cd3f0..ae470e3aaad 100644 --- a/src/mame/drivers/dkong.c +++ b/src/mame/drivers/dkong.c @@ -2899,7 +2899,7 @@ static DRIVER_INIT( drakton ) {7,1,4,0,3,6,2,5}, }; - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0x3fff, 0, 0, SMH_BANK1 ); + memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0x3fff, 0, 0, (read8_space_func)SMH_BANK(1) ); /* While the PAL supports up to 16 decryption methods, only four are actually used in the PAL. Therefore, we'll take a little @@ -2921,7 +2921,7 @@ static DRIVER_INIT( strtheat ) {6,3,4,1,0,7,2,5}, }; - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0x3fff, 0, 0, SMH_BANK1 ); + memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0x3fff, 0, 0, (read8_space_func)SMH_BANK(1) ); /* While the PAL supports up to 16 decryption methods, only four are actually used in the PAL. Therefore, we'll take a little diff --git a/src/mame/drivers/dooyong.c b/src/mame/drivers/dooyong.c index 4e84f46c806..883e281b313 100644 --- a/src/mame/drivers/dooyong.c +++ b/src/mame/drivers/dooyong.c @@ -84,7 +84,7 @@ static WRITE8_HANDLER( flip_screen_w ) static ADDRESS_MAP_START( lastday_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0xbfff) AM_READWRITE(SMH_BANK1, SMH_ROM) + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK(1) AM_RANGE(0xc000, 0xc007) AM_WRITE(dooyong_bgscroll8_w) AM_RANGE(0xc008, 0xc00f) AM_WRITE(dooyong_fgscroll8_w) AM_RANGE(0xc010, 0xc010) AM_READ_PORT("SYSTEM") @@ -103,7 +103,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( pollux_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0xbfff) AM_READWRITE(SMH_BANK1, SMH_ROM) + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK(1) AM_RANGE(0xc000, 0xcfff) AM_RAM AM_RANGE(0xd000, 0xdfff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size) AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(dooyong_txvideoram8_w) AM_BASE(&dooyong_txvideoram) @@ -121,7 +121,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( gulfstrm_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0xbfff) AM_READWRITE(SMH_BANK1, SMH_ROM) + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK(1) AM_RANGE(0xc000, 0xcfff) AM_RAM AM_RANGE(0xd000, 0xdfff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size) AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(dooyong_txvideoram8_w) AM_BASE(&dooyong_txvideoram) @@ -140,7 +140,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( bluehawk_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0xbfff) AM_READWRITE(SMH_BANK1, SMH_ROM) + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK(1) AM_RANGE(0xc000, 0xc000) AM_READ_PORT("DSWA") AM_RANGE(0xc000, 0xc000) AM_WRITE(flip_screen_w) AM_RANGE(0xc001, 0xc001) AM_READ_PORT("DSWB") @@ -160,7 +160,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( flytiger_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0xbfff) AM_READWRITE(SMH_BANK1, SMH_ROM) + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK(1) AM_RANGE(0xc000, 0xcfff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size) AM_RANGE(0xd000, 0xdfff) AM_RAM AM_RANGE(0xe000, 0xe000) AM_READ_PORT("P1") @@ -179,7 +179,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( primella_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0xbfff) AM_READWRITE(SMH_BANK1, SMH_ROM) + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK(1) AM_RANGE(0xc000, 0xcfff) AM_RAM AM_RANGE(0xd000, 0xd3ff) AM_RAM /* what is this? looks like a palette? scratchpad RAM maybe? */ AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(dooyong_txvideoram8_w) AM_BASE(&dooyong_txvideoram) diff --git a/src/mame/drivers/dunhuang.c b/src/mame/drivers/dunhuang.c index c9f119a8d4a..31915d42ea4 100644 --- a/src/mame/drivers/dunhuang.c +++ b/src/mame/drivers/dunhuang.c @@ -103,13 +103,13 @@ static VIDEO_START(dunhuang) tilemap_set_transparent_pen(tmap, 0); tilemap_set_transparent_pen(tmap2, 0); - dunhuang_videoram = (UINT16*)auto_malloc(sizeof(UINT16) * 0x40 * 0x20); - dunhuang_colorram = (UINT8*) auto_malloc(sizeof(UINT8) * 0x40 * 0x20); + dunhuang_videoram = auto_alloc_array(machine, UINT16, 0x40 * 0x20); + dunhuang_colorram = auto_alloc_array(machine, UINT8, 0x40 * 0x20); - dunhuang_videoram2 = (UINT16*)auto_malloc(sizeof(UINT16) * 0x40 * 0x8); - dunhuang_colorram2 = (UINT8*) auto_malloc(sizeof(UINT8) * 0x40 * 0x8); + dunhuang_videoram2 = auto_alloc_array(machine, UINT16, 0x40 * 0x8); + dunhuang_colorram2 = auto_alloc_array(machine, UINT8, 0x40 * 0x8); - dunhuang_paldata = (UINT8*)auto_malloc(sizeof(UINT8) * 3 * 256); + dunhuang_paldata = auto_alloc_array(machine, UINT8, 3 * 256); } static VIDEO_UPDATE( dunhuang ) @@ -334,7 +334,7 @@ static WRITE8_HANDLER( dunhuang_layers_w ) static ADDRESS_MAP_START( dunhuang_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE( 0x0000, 0x5fff ) AM_ROM AM_RANGE( 0x6000, 0x7fff ) AM_RAM - AM_RANGE( 0x8000, 0xffff ) AM_READ( SMH_BANK1 ) + AM_RANGE( 0x8000, 0xffff ) AM_READ( SMH_BANK(1) ) ADDRESS_MAP_END // Inputs diff --git a/src/mame/drivers/dwarfd.c b/src/mame/drivers/dwarfd.c index 40d2e1970b1..3bf580292da 100644 --- a/src/mame/drivers/dwarfd.c +++ b/src/mame/drivers/dwarfd.c @@ -784,8 +784,8 @@ static DRIVER_INIT(dwarfd) // src[i] = src[i]&0xe0; } - videobuf=auto_malloc(0x8000); - dwarfd_ram=auto_malloc(0x1000); + videobuf=auto_alloc_array(machine, UINT8, 0x8000); + dwarfd_ram=auto_alloc_array(machine, UINT8, 0x1000); memset(videobuf,0,0x8000); memset(dwarfd_ram,0,0x1000); diff --git a/src/mame/drivers/dynax.c b/src/mame/drivers/dynax.c index 32d0b3cfe1f..68657ad5d43 100644 --- a/src/mame/drivers/dynax.c +++ b/src/mame/drivers/dynax.c @@ -463,14 +463,14 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( hnoridur_mem_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE( 0x0000, 0x6fff ) AM_ROM AM_RANGE( 0x7000, 0x7fff ) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size) - AM_RANGE( 0x8000, 0xffff ) AM_READWRITE(SMH_BANK1, hnoridur_palette_w) + AM_RANGE( 0x8000, 0xffff ) AM_READWRITE(SMH_BANK(1), hnoridur_palette_w) ADDRESS_MAP_END static ADDRESS_MAP_START( mcnpshnt_mem_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE( 0x0000, 0x5fff ) AM_ROM AM_RANGE( 0x6000, 0x6fff ) AM_RAM AM_RANGE( 0x7000, 0x7fff ) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size) - AM_RANGE( 0x8000, 0xffff ) AM_READWRITE(SMH_BANK1, hnoridur_palette_w) + AM_RANGE( 0x8000, 0xffff ) AM_READWRITE(SMH_BANK(1), hnoridur_palette_w) ADDRESS_MAP_END static ADDRESS_MAP_START( nanajign_mem_map, ADDRESS_SPACE_PROGRAM, 8 ) @@ -4543,7 +4543,7 @@ static DRIVER_INIT( maya ) } /* Address lines scrambling on the blitter data roms */ - rom = malloc_or_die(0xc0000); + rom = alloc_array_or_die(UINT8, 0xc0000); memcpy(rom, gfx, 0xc0000); for (i = 0; i < 0xc0000; i++) gfx[i] = rom[BITSWAP24(i,23,22,21,20,19,18,14,15, 16,17,13,12,11,10,9,8, 7,6,5,4,3,2,1,0)]; @@ -5250,7 +5250,7 @@ static DRIVER_INIT( mjelct3 ) int i; UINT8 *rom = memory_region(machine, "maincpu"); size_t size = memory_region_length(machine, "maincpu"); - UINT8 *rom1 = malloc_or_die(size); + UINT8 *rom1 = alloc_array_or_die(UINT8, size); memcpy(rom1,rom,size); for (i = 0; i < size; i++) @@ -5263,7 +5263,7 @@ static DRIVER_INIT( mjelct3a ) int i,j; UINT8 *rom = memory_region(machine, "maincpu"); size_t size = memory_region_length(machine, "maincpu"); - UINT8 *rom1 = malloc_or_die(size); + UINT8 *rom1 = alloc_array_or_die(UINT8, size); memcpy(rom1,rom,size); for (i = 0; i < size; i++) diff --git a/src/mame/drivers/egghunt.c b/src/mame/drivers/egghunt.c index 1f640231fd9..d8aed4e1656 100644 --- a/src/mame/drivers/egghunt.c +++ b/src/mame/drivers/egghunt.c @@ -146,8 +146,8 @@ static WRITE8_HANDLER( egghunt_atram_w ) static VIDEO_START(egghunt) { bg_tilemap = tilemap_create(machine, get_bg_tile_info,tilemap_scan_rows,8,8,64, 32); - egghunt_bgram = auto_malloc(0x1000); - egghunt_spram = auto_malloc(0x1000); + egghunt_bgram = auto_alloc_array(machine, UINT8, 0x1000); + egghunt_spram = auto_alloc_array(machine, UINT8, 0x1000); } static VIDEO_UPDATE(egghunt) diff --git a/src/mame/drivers/eolith.c b/src/mame/drivers/eolith.c index 5bebb90f6d4..879a580f82f 100644 --- a/src/mame/drivers/eolith.c +++ b/src/mame/drivers/eolith.c @@ -1033,7 +1033,7 @@ static DRIVER_INIT( hidctch2 ) static DRIVER_INIT( hidctch3 ) { - memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xfc200000, 0xfc200003, 0, 0, SMH_NOP); // this generates pens vibration + memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xfc200000, 0xfc200003, 0, 0, (write32_space_func)SMH_NOP); // this generates pens vibration // It is not clear why the first reads are needed too diff --git a/src/mame/drivers/eolith16.c b/src/mame/drivers/eolith16.c index 678db068fd7..ec8fbc35f0f 100644 --- a/src/mame/drivers/eolith16.c +++ b/src/mame/drivers/eolith16.c @@ -102,7 +102,7 @@ INPUT_PORTS_END static VIDEO_START( eolith16 ) { - vram = auto_malloc(0x10000*2); + vram = auto_alloc_array(machine, UINT16, 0x10000); } static VIDEO_UPDATE( eolith16 ) diff --git a/src/mame/drivers/epos.c b/src/mame/drivers/epos.c index b91b4a6a150..85b3f04a60f 100644 --- a/src/mame/drivers/epos.c +++ b/src/mame/drivers/epos.c @@ -68,8 +68,8 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( dealer_map, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x5fff) AM_READWRITE(SMH_BANK1, SMH_ROM) - AM_RANGE(0x6000, 0x6fff) AM_READWRITE(SMH_BANK2, SMH_ROM) + AM_RANGE(0x0000, 0x5fff) AM_ROMBANK(1) + AM_RANGE(0x6000, 0x6fff) AM_ROMBANK(2) AM_RANGE(0x7000, 0x7fff) AM_RAM AM_RANGE(0x8000, 0xffff) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size) ADDRESS_MAP_END diff --git a/src/mame/drivers/esd16.c b/src/mame/drivers/esd16.c index 17b76f44168..5a4a58f1a04 100644 --- a/src/mame/drivers/esd16.c +++ b/src/mame/drivers/esd16.c @@ -256,7 +256,7 @@ static WRITE8_HANDLER( esd16_sound_rombank_w ) static ADDRESS_MAP_START( multchmp_sound_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM // ROM - AM_RANGE(0x8000, 0xbfff) AM_READWRITE(SMH_BANK1, SMH_ROM) // Banked ROM + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK(1) // Banked ROM AM_RANGE(0xf800, 0xffff) AM_RAM // RAM ADDRESS_MAP_END diff --git a/src/mame/drivers/esripsys.c b/src/mame/drivers/esripsys.c index 4a9bf23301b..98719f5bc96 100644 --- a/src/mame/drivers/esripsys.c +++ b/src/mame/drivers/esripsys.c @@ -676,9 +676,9 @@ static DRIVER_INIT( esripsys ) { UINT8 *rom = memory_region(machine, "sound_data"); - fdt_a = auto_malloc(FDT_RAM_SIZE); - fdt_b = auto_malloc(FDT_RAM_SIZE); - cmos_ram = auto_malloc(CMOS_RAM_SIZE); + fdt_a = auto_alloc_array(machine, UINT8, FDT_RAM_SIZE); + fdt_b = auto_alloc_array(machine, UINT8, FDT_RAM_SIZE); + cmos_ram = auto_alloc_array(machine, UINT8, CMOS_RAM_SIZE); ptm6840_config(machine, 0, &ptm_intf); diff --git a/src/mame/drivers/exerion.c b/src/mame/drivers/exerion.c index 2d6aab732c9..d76e7846b4e 100644 --- a/src/mame/drivers/exerion.c +++ b/src/mame/drivers/exerion.c @@ -417,7 +417,7 @@ static DRIVER_INIT( exerion ) UINT8 *src, *dst, *temp; /* allocate some temporary space */ - temp = malloc_or_die(0x10000); + temp = alloc_array_or_die(UINT8, 0x10000); /* make a temporary copy of the character data */ src = temp; diff --git a/src/mame/drivers/exidy.c b/src/mame/drivers/exidy.c index d2e426d7a80..81221c8bf35 100644 --- a/src/mame/drivers/exidy.c +++ b/src/mame/drivers/exidy.c @@ -1386,7 +1386,7 @@ static DRIVER_INIT( phantoma ) exidy_color_latch[0] = 0x09; /* the ROM is actually mapped high */ - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf800, 0xffff, 0, 0, SMH_BANK1); + memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf800, 0xffff, 0, 0, (read8_space_func)SMH_BANK(1)); memory_set_bankptr(machine, 1, memory_region(machine, "maincpu") + 0xf800); } diff --git a/src/mame/drivers/exidy440.c b/src/mame/drivers/exidy440.c index a1527b7d5db..ee1473671f6 100644 --- a/src/mame/drivers/exidy440.c +++ b/src/mame/drivers/exidy440.c @@ -312,7 +312,7 @@ void exidy440_bank_select(running_machine *machine, UINT8 bank) if (bank == 0 && exidy440_bank != 0) memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4000, 0x7fff, 0, 0, showdown_bank0_r); else if (bank != 0 && exidy440_bank == 0) - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4000, 0x7fff, 0, 0, SMH_BANK1); + memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4000, 0x7fff, 0, 0, (read8_space_func)SMH_BANK(1)); } /* select the bank and update the bank pointer */ @@ -485,7 +485,7 @@ static ADDRESS_MAP_START( exidy440_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x2ea0, 0x2ebf) AM_READWRITE(sound_command_ack_r, SMH_NOP) AM_RANGE(0x2ec0, 0x2eff) AM_NOP AM_RANGE(0x3000, 0x3fff) AM_RAM - AM_RANGE(0x4000, 0x7fff) AM_READWRITE(SMH_BANK1, bankram_w) + AM_RANGE(0x4000, 0x7fff) AM_READWRITE(SMH_BANK(1), bankram_w) AM_RANGE(0x8000, 0xffff) AM_ROM ADDRESS_MAP_END diff --git a/src/mame/drivers/exzisus.c b/src/mame/drivers/exzisus.c index cd7c05eb3c2..5a954662113 100644 --- a/src/mame/drivers/exzisus.c +++ b/src/mame/drivers/exzisus.c @@ -159,7 +159,7 @@ static DRIVER_INIT( exzisus ) static ADDRESS_MAP_START( cpua_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0xbfff) AM_READWRITE(SMH_BANK2, SMH_ROM) + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK(2) AM_RANGE(0xc000, 0xc5ff) AM_READWRITE(exzisus_objectram_1_r, exzisus_objectram_1_w) AM_BASE(&exzisus_objectram1) AM_SIZE(&exzisus_objectram_size1) AM_RANGE(0xc600, 0xdfff) AM_READWRITE(exzisus_videoram_1_r, exzisus_videoram_1_w) AM_BASE(&exzisus_videoram1) AM_RANGE(0xe000, 0xefff) AM_READWRITE(exzisus_sharedram_ac_r, exzisus_sharedram_ac_w) AM_BASE(&exzisus_sharedram_ac) @@ -170,7 +170,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( cpub_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0xbfff) AM_READWRITE(SMH_BANK1, SMH_ROM) + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK(1) AM_RANGE(0xc000, 0xc5ff) AM_READWRITE(exzisus_objectram_0_r, exzisus_objectram_0_w) AM_BASE(&exzisus_objectram0) AM_SIZE(&exzisus_objectram_size0) AM_RANGE(0xc600, 0xdfff) AM_READWRITE(exzisus_videoram_0_r, exzisus_videoram_0_w) AM_BASE(&exzisus_videoram0) AM_RANGE(0xe000, 0xefff) AM_RAM diff --git a/src/mame/drivers/f1gp.c b/src/mame/drivers/f1gp.c index f2e31ad7909..f4cb7098855 100644 --- a/src/mame/drivers/f1gp.c +++ b/src/mame/drivers/f1gp.c @@ -184,7 +184,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x77ff) AM_READ(SMH_ROM) AM_RANGE(0x7800, 0x7fff) AM_READ(SMH_RAM) - AM_RANGE(0x8000, 0xffff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xffff) AM_READ(SMH_BANK(1)) ADDRESS_MAP_END static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 ) diff --git a/src/mame/drivers/fastfred.c b/src/mame/drivers/fastfred.c index ad4ddfe0163..fa4ff1a5948 100644 --- a/src/mame/drivers/fastfred.c +++ b/src/mame/drivers/fastfred.c @@ -965,19 +965,19 @@ static DRIVER_INIT( flyboyb ) static DRIVER_INIT( fastfred ) { - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc800, 0xcfff, 0, 0, fastfred_custom_io_r, SMH_NOP); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc800, 0xcfff, 0, 0, fastfred_custom_io_r, (write8_space_func)SMH_NOP); fastfred_hardware_type = 1; } static DRIVER_INIT( jumpcoas ) { - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc800, 0xcfff, 0, 0, jumpcoas_custom_io_r, SMH_NOP); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc800, 0xcfff, 0, 0, jumpcoas_custom_io_r, (write8_space_func)SMH_NOP); fastfred_hardware_type = 0; } static DRIVER_INIT( boggy84 ) { - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc800, 0xcfff, 0, 0, jumpcoas_custom_io_r, SMH_NOP); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc800, 0xcfff, 0, 0, jumpcoas_custom_io_r, (write8_space_func)SMH_NOP); fastfred_hardware_type = 2; } diff --git a/src/mame/drivers/fastlane.c b/src/mame/drivers/fastlane.c index f7500c42fae..f3df545f76a 100644 --- a/src/mame/drivers/fastlane.c +++ b/src/mame/drivers/fastlane.c @@ -93,7 +93,7 @@ static ADDRESS_MAP_START( fastlane_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0f00, 0x0f1f) AM_READ(K051733_r) /* 051733 (protection) */ AM_RANGE(0x1000, 0x1fff) AM_READ(SMH_RAM) /* Palette RAM/Work RAM */ AM_RANGE(0x2000, 0x3fff) AM_READ(SMH_RAM) /* Video RAM + Sprite RAM */ - AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK1) /* banked ROM */ + AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK(1)) /* banked ROM */ AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM) /* ROM */ ADDRESS_MAP_END diff --git a/src/mame/drivers/fcombat.c b/src/mame/drivers/fcombat.c index f4ed57b2887..2aaa9c92ded 100644 --- a/src/mame/drivers/fcombat.c +++ b/src/mame/drivers/fcombat.c @@ -322,7 +322,7 @@ static DRIVER_INIT( fcombat ) UINT8 *src, *dst, *temp; /* allocate some temporary space */ - temp = malloc_or_die(0x10000); + temp = alloc_array_or_die(UINT8, 0x10000); /* make a temporary copy of the character data */ src = temp; diff --git a/src/mame/drivers/firebeat.c b/src/mame/drivers/firebeat.c index 440e6649936..b1e694b9b88 100644 --- a/src/mame/drivers/firebeat.c +++ b/src/mame/drivers/firebeat.c @@ -140,8 +140,8 @@ static GCU_REGS gcu[2]; static VIDEO_START(firebeat) { - gcu[0].vram = auto_malloc(0x2000000); - gcu[1].vram = auto_malloc(0x2000000); + gcu[0].vram = auto_alloc_array(machine, UINT32, 0x2000000/4); + gcu[1].vram = auto_alloc_array(machine, UINT32, 0x2000000/4); memset(gcu[0].vram, 0, 0x2000000); memset(gcu[1].vram, 0, 0x2000000); } diff --git a/src/mame/drivers/firetrap.c b/src/mame/drivers/firetrap.c index 545a9d73c87..ddd532ecd6f 100644 --- a/src/mame/drivers/firetrap.c +++ b/src/mame/drivers/firetrap.c @@ -246,7 +246,7 @@ static WRITE8_HANDLER( flip_screen_w ) static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xc000, 0xe97f) AM_READ(SMH_RAM) AM_RANGE(0xf010, 0xf010) AM_READ_PORT("IN0") AM_RANGE(0xf011, 0xf011) AM_READ_PORT("IN1") @@ -277,7 +277,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( readmem_bootleg, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xc000, 0xe97f) AM_READ(SMH_RAM) AM_RANGE(0xf010, 0xf010) AM_READ_PORT("IN0") AM_RANGE(0xf011, 0xf011) AM_READ_PORT("IN1") @@ -311,7 +311,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x07ff) AM_READ(SMH_RAM) AM_RANGE(0x3400, 0x3400) AM_READ(soundlatch_r) - AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK2) + AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK(2)) AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM) ADDRESS_MAP_END diff --git a/src/mame/drivers/fitfight.c b/src/mame/drivers/fitfight.c index e9b954a3dff..9a08d9e46ea 100644 --- a/src/mame/drivers/fitfight.c +++ b/src/mame/drivers/fitfight.c @@ -221,7 +221,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( snd_mem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_ROM - AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK1) /* ??? External ROM */ + AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK(1)) /* ??? External ROM */ AM_RANGE(0x8000, 0x87ff) AM_RAM AM_RANGE(0xff00, 0xffff) AM_RAM ADDRESS_MAP_END diff --git a/src/mame/drivers/flkatck.c b/src/mame/drivers/flkatck.c index af651dd33ce..d22e50abe09 100644 --- a/src/mame/drivers/flkatck.c +++ b/src/mame/drivers/flkatck.c @@ -112,7 +112,7 @@ static ADDRESS_MAP_START( flkatck_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0800, 0x0bff) AM_READ(SMH_RAM) /* palette */ AM_RANGE(0x1000, 0x1fff) AM_READ(SMH_RAM) /* RAM */ AM_RANGE(0x2000, 0x3fff) AM_READ(SMH_RAM) /* Video RAM (007121) */ - AM_RANGE(0x4000, 0x5fff) AM_READ(SMH_BANK1) /* banked ROM */ + AM_RANGE(0x4000, 0x5fff) AM_READ(SMH_BANK(1)) /* banked ROM */ AM_RANGE(0x6000, 0xffff) AM_READ(SMH_ROM) /* ROM */ ADDRESS_MAP_END @@ -123,7 +123,7 @@ static ADDRESS_MAP_START( flkatck_writemem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0800, 0x0bff) AM_WRITE(paletteram_xBBBBBGGGGGRRRRR_le_w) AM_BASE(&paletteram)/* palette */ AM_RANGE(0x1000, 0x1fff) AM_WRITE(SMH_RAM) /* RAM */ AM_RANGE(0x2000, 0x3fff) AM_WRITE(flkatck_k007121_w) AM_BASE(&k007121_ram) /* Video RAM (007121) */ - AM_RANGE(0x4000, 0x5fff) AM_WRITE(SMH_BANK1) /* banked ROM */ + AM_RANGE(0x4000, 0x5fff) AM_WRITE(SMH_BANK(1)) /* banked ROM */ AM_RANGE(0x6000, 0xffff) AM_WRITE(SMH_ROM) /* ROM */ ADDRESS_MAP_END diff --git a/src/mame/drivers/forte2.c b/src/mame/drivers/forte2.c index 4a5850bed93..608862b3b88 100644 --- a/src/mame/drivers/forte2.c +++ b/src/mame/drivers/forte2.c @@ -154,7 +154,7 @@ static DRIVER_INIT(pesadelo) } // address line swap - buf = (UINT8*)malloc_or_die(memsize); + buf = alloc_array_or_die(UINT8, memsize); memcpy(buf, mem, memsize); for ( i = 0; i < memsize; i++ ) { diff --git a/src/mame/drivers/fortecar.c b/src/mame/drivers/fortecar.c index c9587c59a58..a6d904d7c72 100644 --- a/src/mame/drivers/fortecar.c +++ b/src/mame/drivers/fortecar.c @@ -101,7 +101,7 @@ static const ay8910_interface ay8910_config = static ADDRESS_MAP_START( fortecar_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0xbfff) AM_ROM - AM_RANGE(0xc000, 0xc7ff) AM_READWRITE(SMH_BANK1, SMH_ROM) //bank + AM_RANGE(0xc000, 0xc7ff) AM_READWRITE(SMH_BANK(1), SMH_ROM) //bank AM_RANGE(0xd000, 0xd7ff) AM_RAM AM_RANGE(0xd800, 0xffff) AM_RAM AM_BASE(&fortecar_ram) ADDRESS_MAP_END diff --git a/src/mame/drivers/freekick.c b/src/mame/drivers/freekick.c index 6affd3e0683..ec1abc18f49 100644 --- a/src/mame/drivers/freekick.c +++ b/src/mame/drivers/freekick.c @@ -180,7 +180,7 @@ static WRITE8_HANDLER (freekick_ff_w) static ADDRESS_MAP_START( pbillrd_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_RAM) AM_RANGE(0xe000, 0xe000) AM_READ_PORT("IN0") AM_RANGE(0xe800, 0xe800) AM_READ_PORT("IN1") diff --git a/src/mame/drivers/fromanc2.c b/src/mame/drivers/fromanc2.c index ac3175d5936..4da1572b2a5 100644 --- a/src/mame/drivers/fromanc2.c +++ b/src/mame/drivers/fromanc2.c @@ -397,16 +397,16 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( fromanc2_readmem_sub, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_ROM) // ROM - AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK1) // ROM(BANK) + AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK(1)) // ROM(BANK) AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_RAM) // RAM(WORK) - AM_RANGE(0xc000, 0xffff) AM_READ(SMH_BANK2) // RAM(BANK) + AM_RANGE(0xc000, 0xffff) AM_READ(SMH_BANK(2)) // RAM(BANK) ADDRESS_MAP_END static ADDRESS_MAP_START( fromanc2_writemem_sub, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_WRITE(SMH_ROM) // ROM - AM_RANGE(0x4000, 0x7fff) AM_WRITE(SMH_BANK1) // ROM(BANK) + AM_RANGE(0x4000, 0x7fff) AM_WRITE(SMH_BANK(1)) // ROM(BANK) AM_RANGE(0x8000, 0xbfff) AM_WRITE(SMH_RAM) // RAM(WORK) - AM_RANGE(0xc000, 0xffff) AM_WRITE(SMH_BANK2) // RAM(BANK) + AM_RANGE(0xc000, 0xffff) AM_WRITE(SMH_BANK(2)) // RAM(BANK) ADDRESS_MAP_END static ADDRESS_MAP_START( fromanc2_sub_io_map, ADDRESS_SPACE_IO, 8 ) diff --git a/src/mame/drivers/fromance.c b/src/mame/drivers/fromance.c index 6f81e8d9f89..0f04932dd3b 100644 --- a/src/mame/drivers/fromance.c +++ b/src/mame/drivers/fromance.c @@ -287,7 +287,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( nekkyoku_readmem_sub, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xc000, 0xefff) AM_READ(fromance_videoram_r) AM_RANGE(0xf000, 0xf7ff) AM_READ(SMH_RAM) AM_RANGE(0xf800, 0xffff) AM_READ(fromance_paletteram_r) @@ -304,7 +304,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( fromance_readmem_sub, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xc000, 0xc7ff) AM_READ(SMH_RAM) AM_RANGE(0xc800, 0xcfff) AM_READ(fromance_paletteram_r) AM_RANGE(0xd000, 0xffff) AM_READ(fromance_videoram_r) diff --git a/src/mame/drivers/funkyjet.c b/src/mame/drivers/funkyjet.c index b76ed4b5dbc..4431464dea9 100644 --- a/src/mame/drivers/funkyjet.c +++ b/src/mame/drivers/funkyjet.c @@ -139,7 +139,7 @@ static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x120000, 0x120001) AM_DEVREAD("oki", okim6295_r) AM_RANGE(0x130000, 0x130001) AM_READNOP /* This board only has 1 oki chip */ AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r) - AM_RANGE(0x1f0000, 0x1f1fff) AM_READ(SMH_BANK8) + AM_RANGE(0x1f0000, 0x1f1fff) AM_READ(SMH_BANK(8)) ADDRESS_MAP_END static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 ) @@ -148,7 +148,7 @@ static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x110000, 0x110001) AM_DEVWRITE("ym", ym2151_w) AM_RANGE(0x120000, 0x120001) AM_DEVWRITE("oki", okim6295_w) AM_RANGE(0x130000, 0x130001) AM_WRITENOP - AM_RANGE(0x1f0000, 0x1f1fff) AM_WRITE(SMH_BANK8) + AM_RANGE(0x1f0000, 0x1f1fff) AM_WRITE(SMH_BANK(8)) AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE(h6280_timer_w) AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE(h6280_irq_status_w) ADDRESS_MAP_END diff --git a/src/mame/drivers/funworld.c b/src/mame/drivers/funworld.c index 30a1ca9dd9b..efef1a8fc89 100644 --- a/src/mame/drivers/funworld.c +++ b/src/mame/drivers/funworld.c @@ -3061,7 +3061,7 @@ static DRIVER_INIT( saloon ) rom[i] = BITSWAP8(rom[i], 7, 6, 5, 4, 3, 0, 1, 2); } - buffer = malloc_or_die(size); + buffer = alloc_array_or_die(UINT8, size); memcpy(buffer, rom, size); @@ -3080,7 +3080,7 @@ static DRIVER_INIT( saloon ) * Graphics ROM decryption * ******************************/ - buffer = malloc_or_die(sizeg); + buffer = alloc_array_or_die(UINT8, sizeg); memcpy(buffer, gfxrom, sizeg); /* address lines swap: fedcba9876543210 -> fedcb67584a39012 */ @@ -3105,7 +3105,7 @@ static DRIVER_INIT( saloon ) prom[i] = BITSWAP8(prom[i], 2, 3, 5, 4, 6, 7, 1, 0); } - buffer = malloc_or_die(sizep); + buffer = alloc_array_or_die(UINT8, sizep); memcpy(buffer, prom, sizep); diff --git a/src/mame/drivers/funybubl.c b/src/mame/drivers/funybubl.c index 37489b342ec..268258c6830 100644 --- a/src/mame/drivers/funybubl.c +++ b/src/mame/drivers/funybubl.c @@ -92,10 +92,10 @@ static WRITE8_DEVICE_HANDLER( funybubl_oki_bank_sw ) static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK2) // banked port 1? + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(2)) // banked port 1? AM_RANGE(0xc400, 0xc7ff) AM_READ(SMH_RAM) AM_RANGE(0xc800, 0xcfff) AM_READ(SMH_RAM) - AM_RANGE(0xd000, 0xdfff) AM_READ(SMH_BANK1) // banked port 0? + AM_RANGE(0xd000, 0xdfff) AM_READ(SMH_BANK(1)) // banked port 0? AM_RANGE(0xe000, 0xffff) AM_READ(SMH_RAM) ADDRESS_MAP_END @@ -103,7 +103,7 @@ static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM) AM_RANGE(0x8000, 0xbfff) AM_WRITE(SMH_ROM) AM_RANGE(0xc400, 0xcfff) AM_WRITE(funybubl_paldatawrite) AM_BASE(&funybubl_paletteram) // palette - AM_RANGE(0xd000, 0xdfff) AM_WRITE(SMH_BANK1) // banked port 0? + AM_RANGE(0xd000, 0xdfff) AM_WRITE(SMH_BANK(1)) // banked port 0? AM_RANGE(0xe000, 0xffff) AM_WRITE(SMH_RAM) ADDRESS_MAP_END @@ -228,7 +228,7 @@ GFXDECODE_END static DRIVER_INIT( funybubl ) { - funybubl_banked_videoram = auto_malloc (0x2000); + funybubl_banked_videoram = auto_alloc_array(machine, UINT8, 0x2000); memory_set_bankptr(machine, 1,&funybubl_banked_videoram[0x000000]); } diff --git a/src/mame/drivers/fuukifg2.c b/src/mame/drivers/fuukifg2.c index f13552fd810..94b851f3336 100644 --- a/src/mame/drivers/fuukifg2.c +++ b/src/mame/drivers/fuukifg2.c @@ -150,7 +150,7 @@ static WRITE8_DEVICE_HANDLER( fuuki16_oki_banking_w ) static ADDRESS_MAP_START( fuuki16_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x5fff) AM_READ(SMH_ROM ) // ROM AM_RANGE(0x6000, 0x7fff) AM_READ(SMH_RAM ) // RAM - AM_RANGE(0x8000, 0xffff) AM_READ(SMH_BANK1 ) // Banked ROM + AM_RANGE(0x8000, 0xffff) AM_READ(SMH_BANK(1) ) // Banked ROM ADDRESS_MAP_END static ADDRESS_MAP_START( fuuki16_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 ) diff --git a/src/mame/drivers/fuukifg3.c b/src/mame/drivers/fuukifg3.c index 6fc217189b0..446c2c6b056 100644 --- a/src/mame/drivers/fuukifg3.c +++ b/src/mame/drivers/fuukifg3.c @@ -338,7 +338,7 @@ static ADDRESS_MAP_START( fuuki32_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x5fff) AM_READ(SMH_ROM ) // ROM AM_RANGE(0x6000, 0x6fff) AM_READ(SMH_RAM ) // RAM AM_RANGE(0x7ff0, 0x7fff) AM_READ(snd_z80_r) - AM_RANGE(0x8000, 0xffff) AM_READ(SMH_BANK1 ) // ROM + AM_RANGE(0x8000, 0xffff) AM_READ(SMH_BANK(1) ) // ROM ADDRESS_MAP_END static ADDRESS_MAP_START( fuuki32_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 ) diff --git a/src/mame/drivers/gaelco3d.c b/src/mame/drivers/gaelco3d.c index 143624b9b5b..579a1b48dac 100644 --- a/src/mame/drivers/gaelco3d.c +++ b/src/mame/drivers/gaelco3d.c @@ -1147,8 +1147,8 @@ static DRIVER_INIT( gaelco3d ) /* allocate memory */ gaelco3d_texture_size = memory_region_length(machine, "gfx1"); gaelco3d_texmask_size = memory_region_length(machine, "gfx2") * 8; - gaelco3d_texture = auto_malloc(gaelco3d_texture_size); - gaelco3d_texmask = auto_malloc(gaelco3d_texmask_size); + gaelco3d_texture = auto_alloc_array(machine, UINT8, gaelco3d_texture_size); + gaelco3d_texmask = auto_alloc_array(machine, UINT8, gaelco3d_texmask_size); /* first expand the pixel data */ src = memory_region(machine, "gfx1"); diff --git a/src/mame/drivers/gaiden.c b/src/mame/drivers/gaiden.c index f4a853c86dd..d90db992d25 100644 --- a/src/mame/drivers/gaiden.c +++ b/src/mame/drivers/gaiden.c @@ -1369,7 +1369,7 @@ static DRIVER_INIT( drgnbowl ) int i; UINT8 *ROM = memory_region(machine, "maincpu"); size_t size = memory_region_length(machine, "maincpu"); - UINT8 *buffer = malloc_or_die(size); + UINT8 *buffer = alloc_array_or_die(UINT8, size); memcpy(buffer,ROM,size); for( i = 0; i < size; i++ ) @@ -1386,7 +1386,7 @@ static DRIVER_INIT( drgnbowl ) ROM = memory_region(machine, "gfx2"); size = memory_region_length(machine, "gfx2"); - buffer = malloc_or_die(size); + buffer = alloc_array_or_die(UINT8, size); memcpy(buffer,ROM,size); for( i = 0; i < size; i++ ) diff --git a/src/mame/drivers/galaxia.c b/src/mame/drivers/galaxia.c index ee553dd11c8..4ac1e9fe077 100644 --- a/src/mame/drivers/galaxia.c +++ b/src/mame/drivers/galaxia.c @@ -41,9 +41,9 @@ static VIDEO_START( galaxia ) int height = video_screen_get_height(machine->primary_screen); /* configure the S2636 chips */ - s2636_0 = s2636_config(galaxia_s2636_0_ram, height, width, 3, -27); - s2636_1 = s2636_config(galaxia_s2636_1_ram, height, width, 3, -27); - s2636_2 = s2636_config(galaxia_s2636_2_ram, height, width, 3, -27); + s2636_0 = s2636_config(machine, galaxia_s2636_0_ram, height, width, 3, -27); + s2636_1 = s2636_config(machine, galaxia_s2636_1_ram, height, width, 3, -27); + s2636_2 = s2636_config(machine, galaxia_s2636_2_ram, height, width, 3, -27); } static VIDEO_UPDATE( galaxia ) @@ -318,7 +318,7 @@ ROM_END static DRIVER_INIT(galaxia) { - galaxia_color=auto_malloc(0x400); + galaxia_color=auto_alloc_array(machine, UINT8, 0x400); } GAME( 1979, galaxia, 0, galaxia, galaxia, galaxia, ROT90, "Zaccaria", "Galaxia", GAME_NOT_WORKING|GAME_NO_SOUND ) diff --git a/src/mame/drivers/galaxian.c b/src/mame/drivers/galaxian.c index 6d7f272580b..0f5e812e1fc 100644 --- a/src/mame/drivers/galaxian.c +++ b/src/mame/drivers/galaxian.c @@ -2229,7 +2229,7 @@ static void decode_anteater_gfx(running_machine *machine) { UINT32 romlength = memory_region_length(machine, "gfx1"); UINT8 *rombase = memory_region(machine, "gfx1"); - UINT8 *scratch = malloc_or_die(romlength); + UINT8 *scratch = alloc_array_or_die(UINT8, romlength); UINT32 offs; memcpy(scratch, rombase, romlength); @@ -2249,7 +2249,7 @@ static void decode_losttomb_gfx(running_machine *machine) { UINT32 romlength = memory_region_length(machine, "gfx1"); UINT8 *rombase = memory_region(machine, "gfx1"); - UINT8 *scratch = malloc_or_die(romlength); + UINT8 *scratch = alloc_array_or_die(UINT8, romlength); UINT32 offs; memcpy(scratch, rombase, romlength); @@ -2326,9 +2326,9 @@ static void unmap_galaxian_sound(running_machine *machine, offs_t base) { const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); - memory_install_write8_handler(space, base + 0x0004, base + 0x0007, 0, 0x07f8, SMH_UNMAP); - memory_install_write8_handler(space, base + 0x0800, base + 0x0807, 0, 0x07f8, SMH_UNMAP); - memory_install_write8_handler(space, base + 0x1800, base + 0x1800, 0, 0x07ff, SMH_UNMAP); + memory_install_write8_handler(space, base + 0x0004, base + 0x0007, 0, 0x07f8, (write8_space_func)SMH_UNMAP); + memory_install_write8_handler(space, base + 0x0800, base + 0x0807, 0, 0x07f8, (write8_space_func)SMH_UNMAP); + memory_install_write8_handler(space, base + 0x1800, base + 0x1800, 0, 0x07ff, (write8_space_func)SMH_UNMAP); } @@ -2353,7 +2353,7 @@ static DRIVER_INIT( nolock ) DRIVER_INIT_CALL(galaxian); /* ...but coin lockout disabled/disconnected */ - memory_install_write8_handler(space, 0x6002, 0x6002, 0, 0x7f8, SMH_UNMAP); + memory_install_write8_handler(space, 0x6002, 0x6002, 0, 0x7f8, (write8_space_func)SMH_UNMAP); } @@ -2365,7 +2365,7 @@ static DRIVER_INIT( azurian ) common_init(machine, scramble_draw_bullet, galaxian_draw_background, NULL, NULL); /* coin lockout disabled */ - memory_install_write8_handler(space, 0x6002, 0x6002, 0, 0x7f8, SMH_UNMAP); + memory_install_write8_handler(space, 0x6002, 0x6002, 0, 0x7f8, (write8_space_func)SMH_UNMAP); } @@ -2377,7 +2377,7 @@ static DRIVER_INIT( gmgalax ) common_init(machine, galaxian_draw_bullet, galaxian_draw_background, gmgalax_extend_tile_info, gmgalax_extend_sprite_info); /* ROM is banked */ - memory_install_read8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_BANK1); + memory_install_read8_handler(space, 0x0000, 0x3fff, 0, 0, (read8_space_func)SMH_BANK(1)); memory_configure_bank(machine, 1, 0, 2, memory_region(machine, "maincpu") + 0x10000, 0x4000); /* callback when the game select is toggled */ @@ -2418,8 +2418,8 @@ static DRIVER_INIT( frogg ) common_init(machine, galaxian_draw_bullet, frogger_draw_background, frogger_extend_tile_info, frogger_extend_sprite_info); /* ...but needs a full 2k of RAM */ - memory_install_readwrite8_handler(space, 0x4000, 0x47ff, 0, 0, SMH_BANK1, SMH_BANK1); - frogg_ram = auto_malloc(0x800); + memory_install_readwrite8_handler(space, 0x4000, 0x47ff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_BANK(1)); + frogg_ram = auto_alloc_array(machine, UINT8, 0x800); memory_set_bankptr(machine, 1, frogg_ram); state_save_register_global_pointer(machine, frogg_ram, 0x800); @@ -2465,7 +2465,7 @@ static DRIVER_INIT( mooncrgx ) static DRIVER_INIT( moonqsr ) { const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); - UINT8 *decrypt = auto_malloc(0x8000); + UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x8000); /* video extensions */ common_init(machine, galaxian_draw_bullet, galaxian_draw_background, moonqsr_extend_tile_info, moonqsr_extend_sprite_info); @@ -2484,7 +2484,7 @@ static DRIVER_INIT( pacmanbl ) DRIVER_INIT_CALL(galaxian); /* ...but coin lockout disabled/disconnected */ - memory_install_write8_handler(space, 0x6002, 0x6002, 0, 0x7f8, SMH_UNMAP); + memory_install_write8_handler(space, 0x6002, 0x6002, 0, 0x7f8, (write8_space_func)SMH_UNMAP); /* also shift the sprite clip offset */ galaxian_sprite_clip_start = 7; @@ -2510,14 +2510,14 @@ static DRIVER_INIT( zigzag ) common_init(machine, NULL, galaxian_draw_background, NULL, NULL); /* make ROMs 2 & 3 swappable */ - memory_install_read8_handler(space, 0x2000, 0x2fff, 0, 0, SMH_BANK1); - memory_install_read8_handler(space, 0x3000, 0x3fff, 0, 0, SMH_BANK2); + memory_install_read8_handler(space, 0x2000, 0x2fff, 0, 0, (read8_space_func)SMH_BANK(1)); + memory_install_read8_handler(space, 0x3000, 0x3fff, 0, 0, (read8_space_func)SMH_BANK(2)); memory_configure_bank(machine, 1, 0, 2, memory_region(machine, "maincpu") + 0x2000, 0x1000); memory_configure_bank(machine, 2, 0, 2, memory_region(machine, "maincpu") + 0x2000, 0x1000); /* also re-install the fixed ROM area as a bank in order to inform the memory system that the fixed area only extends to 0x1fff */ - memory_install_read8_handler(space, 0x0000, 0x1fff, 0, 0, SMH_BANK3); + memory_install_read8_handler(space, 0x0000, 0x1fff, 0, 0, (read8_space_func)SMH_BANK(3)); memory_set_bankptr(machine, 3, memory_region(machine, "maincpu") + 0x0000); /* handler for doing the swaps */ @@ -2525,7 +2525,7 @@ static DRIVER_INIT( zigzag ) zigzag_bankswap_w(space, 0, 0); /* coin lockout disabled */ - memory_install_write8_handler(space, 0x6002, 0x6002, 0, 0x7f8, SMH_UNMAP); + memory_install_write8_handler(space, 0x6002, 0x6002, 0, 0x7f8, (write8_space_func)SMH_UNMAP); /* remove the galaxian sound hardware */ unmap_galaxian_sound(machine, 0x6000); @@ -2551,7 +2551,7 @@ static DRIVER_INIT( checkman ) common_init(machine, galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info); /* move the interrupt enable from $b000 to $b001 */ - memory_install_write8_handler(space, 0xb000, 0xb000, 0, 0x7f8, SMH_UNMAP); + memory_install_write8_handler(space, 0xb000, 0xb000, 0, 0x7f8, (write8_space_func)SMH_UNMAP); memory_install_write8_handler(space, 0xb001, 0xb001, 0, 0x7f8, irq_enable_w); /* attach the sound command handler */ @@ -2601,7 +2601,7 @@ static DRIVER_INIT( dingoe ) common_init(machine, galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info); /* move the interrupt enable from $b000 to $b001 */ - memory_install_write8_handler(space, 0xb000, 0xb000, 0, 0x7f8, SMH_UNMAP); + memory_install_write8_handler(space, 0xb000, 0xb000, 0, 0x7f8, (write8_space_func)SMH_UNMAP); memory_install_write8_handler(space, 0xb001, 0xb001, 0, 0x7f8, irq_enable_w); /* attach the sound command handler */ @@ -2625,11 +2625,11 @@ static DRIVER_INIT( skybase ) memory_install_write8_handler(space, 0xa002, 0xa002, 0, 0x7f8, galaxian_gfxbank_w); /* needs a full 2k of RAM */ - memory_install_readwrite8_handler(space, 0x8000, 0x87ff, 0, 0, SMH_BANK1, SMH_BANK1); - memory_set_bankptr(machine, 1, auto_malloc(0x800)); + memory_install_readwrite8_handler(space, 0x8000, 0x87ff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_BANK(1)); + memory_set_bankptr(machine, 1, auto_alloc_array(machine, UINT8, 0x800)); /* extend ROM */ - memory_install_read8_handler(space, 0x0000, 0x5fff, 0, 0, SMH_BANK2); + memory_install_read8_handler(space, 0x0000, 0x5fff, 0, 0, (read8_space_func)SMH_BANK(2)); memory_set_bankptr(machine, 2, memory_region(machine, "maincpu")); } @@ -2685,19 +2685,19 @@ static DRIVER_INIT( scorpnmc ) common_init(machine, galaxian_draw_bullet, galaxian_draw_background, batman2_extend_tile_info, upper_extend_sprite_info); /* move the interrupt enable from $b000 to $b001 */ - memory_install_write8_handler(space, 0xb000, 0xb000, 0, 0x7f8, SMH_UNMAP); + memory_install_write8_handler(space, 0xb000, 0xb000, 0, 0x7f8, (write8_space_func)SMH_UNMAP); memory_install_write8_handler(space, 0xb001, 0xb001, 0, 0x7f8, irq_enable_w); /* extra ROM */ - memory_install_read8_handler(space, 0x5000, 0x67ff, 0, 0, SMH_BANK1); + memory_install_read8_handler(space, 0x5000, 0x67ff, 0, 0, (read8_space_func)SMH_BANK(1)); memory_set_bankptr(machine, 1, memory_region(machine, "maincpu") + 0x5000); /* install RAM at $4000-$4800 */ - memory_install_readwrite8_handler(space, 0x4000, 0x47ff, 0, 0, SMH_BANK2, SMH_BANK2); - memory_set_bankptr(machine, 2, auto_malloc(0x800)); + memory_install_readwrite8_handler(space, 0x4000, 0x47ff, 0, 0, (read8_space_func)SMH_BANK(2), (write8_space_func)SMH_BANK(2)); + memory_set_bankptr(machine, 2, auto_alloc_array(machine, UINT8, 0x800)); /* doesn't appear to use original RAM */ - memory_install_readwrite8_handler(space, 0x8000, 0x87ff, 0, 0, SMH_UNMAP, SMH_UNMAP); + memory_install_readwrite8_handler(space, 0x8000, 0x87ff, 0, 0, (read8_space_func)SMH_UNMAP, (write8_space_func)SMH_UNMAP); } @@ -2716,7 +2716,7 @@ static DRIVER_INIT( theend ) common_init(machine, theend_draw_bullet, galaxian_draw_background, NULL, NULL); /* coin counter on the upper bit of port C */ - memory_install_write8_handler(space, 0x6802, 0x6802, 0, 0x7f8, SMH_UNMAP); + memory_install_write8_handler(space, 0x6802, 0x6802, 0, 0x7f8, (write8_space_func)SMH_UNMAP); } @@ -2738,7 +2738,7 @@ static DRIVER_INIT( explorer ) memory_install_write8_handler(space, 0x7000, 0x7000, 0, 0x7ff, watchdog_reset_w); /* I/O appears to be direct, not via PPIs */ - memory_install_readwrite8_handler(space, 0x8000, 0xffff, 0, 0, SMH_UNMAP, SMH_UNMAP); + memory_install_readwrite8_handler(space, 0x8000, 0xffff, 0, 0, (read8_space_func)SMH_UNMAP, (write8_space_func)SMH_UNMAP); memory_install_read_port_handler(space, 0x8000, 0x8000, 0, 0xffc, "IN0"); memory_install_read_port_handler(space, 0x8001, 0x8001, 0, 0xffc, "IN1"); memory_install_read_port_handler(space, 0x8002, 0x8002, 0, 0xffc, "IN2"); @@ -2755,7 +2755,7 @@ static DRIVER_INIT( sfx ) galaxian_sfx_tilemap = TRUE; /* sound board has space for extra ROM */ - memory_install_read8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x0000, 0x3fff, 0, 0, SMH_BANK1); + memory_install_read8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x0000, 0x3fff, 0, 0, (read8_space_func)SMH_BANK(1)); memory_set_bankptr(machine, 1, memory_region(machine, "audiocpu")); } @@ -2768,7 +2768,7 @@ static DRIVER_INIT( atlantis ) common_init(machine, scramble_draw_bullet, scramble_draw_background, NULL, NULL); /* watchdog is at $7800? (or is it just disabled?) */ - memory_install_read8_handler(space, 0x7000, 0x7000, 0, 0x7ff, SMH_UNMAP); + memory_install_read8_handler(space, 0x7000, 0x7000, 0, 0x7ff, (read8_space_func)SMH_UNMAP); memory_install_read8_handler(space, 0x7800, 0x7800, 0, 0x7ff, watchdog_reset_r); } @@ -2813,8 +2813,8 @@ static DRIVER_INIT( froggrmc ) memory_install_write8_handler(space, 0xb001, 0xb001, 0, 0x7f8, froggrmc_sound_control_w); /* actually needs 2k of RAM */ - memory_install_readwrite8_handler(space, 0x8000, 0x87ff, 0, 0, SMH_BANK1, SMH_BANK1); - frogg_ram = auto_malloc(0x800); + memory_install_readwrite8_handler(space, 0x8000, 0x87ff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_BANK(1)); + frogg_ram = auto_alloc_array(machine, UINT8, 0x800); memory_set_bankptr(machine, 1, frogg_ram); state_save_register_global_pointer(machine, frogg_ram, 0x800); @@ -2861,11 +2861,11 @@ static DRIVER_INIT( scorpion ) memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_IO), 0x00, 0xff, 0, 0, scorpion_ay8910_r, scorpion_ay8910_w); /* extra ROM */ - memory_install_read8_handler(space, 0x5800, 0x67ff, 0, 0, SMH_BANK1); + memory_install_read8_handler(space, 0x5800, 0x67ff, 0, 0, (read8_space_func)SMH_BANK(1)); memory_set_bankptr(machine, 1, memory_region(machine, "maincpu") + 0x5800); /* no background related */ -// memory_install_write8_handler(space, 0x6803, 0x6803, 0, 0, SMH_NOP); +// memory_install_write8_handler(space, 0x6803, 0x6803, 0, 0, (write8_space_func)SMH_NOP); memory_install_read8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x3000, 0x3000, 0, 0, scorpion_digitalker_intr_r); /* diff --git a/src/mame/drivers/galaxold.c b/src/mame/drivers/galaxold.c index 2cff6c40666..93ce326da7c 100644 --- a/src/mame/drivers/galaxold.c +++ b/src/mame/drivers/galaxold.c @@ -583,7 +583,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( _4in1_readmem, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_BANK1) /* banked game code */ + AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_BANK(1)) /* banked game code */ AM_RANGE(0x4000, 0x47ff) AM_READ(SMH_RAM) AM_RANGE(0x5000, 0x53ff) AM_READ(SMH_RAM) AM_RANGE(0x5400, 0x57ff) AM_READ(galaxold_videoram_r) diff --git a/src/mame/drivers/galivan.c b/src/mame/drivers/galivan.c index fdbc45230cb..7a257c96ab4 100644 --- a/src/mame/drivers/galivan.c +++ b/src/mame/drivers/galivan.c @@ -104,7 +104,7 @@ static WRITE8_HANDLER( ninjemak_videoreg_w ) static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0xbfff) AM_READ(SMH_ROM) - AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_BANK1) + AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xe000, 0xffff) AM_READ(SMH_RAM) ADDRESS_MAP_END @@ -988,15 +988,15 @@ static WRITE8_HANDLER( youmab_84_w ) static DRIVER_INIT( youmab ) { memory_install_write8_handler(cpu_get_address_space(machine->cpu[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(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0x7fff, 0, 0, SMH_BANK3); + memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0x7fff, 0, 0, (read8_space_func)SMH_BANK(3)); memory_set_bankptr(machine, 3, memory_region(machine, "maincpu") ); - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0xbfff, 0, 0, SMH_BANK2); + memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0xbfff, 0, 0, (read8_space_func)SMH_BANK(2)); memory_set_bankptr(machine, 2, memory_region(machine, "user2") ); memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x81, 0x81, 0, 0, youmab_81_w); // ?? often, alternating values memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x84, 0x84, 0, 0, youmab_84_w); // ?? often, sequence.. - memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xd800, 0xd81f, 0, 0, SMH_NOP); // scrolling isn't here.. + memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xd800, 0xd81f, 0, 0, (write8_space_func)SMH_NOP); // scrolling isn't here.. memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x8a, 0x8a, 0, 0, youmab_8a_r); // ??? diff --git a/src/mame/drivers/galpani3.c b/src/mame/drivers/galpani3.c index 1a6b220bacb..85ff54c5072 100644 --- a/src/mame/drivers/galpani3.c +++ b/src/mame/drivers/galpani3.c @@ -124,13 +124,13 @@ static INTERRUPT_GEN( galpani3_vblank ) // 2, 3, 5 ? static VIDEO_START(galpani3) { /* so we can use suprnova.c */ - galpani3_spriteram32 = auto_malloc ( 0x4000 ); + galpani3_spriteram32 = auto_alloc_array(machine, UINT32, 0x4000/4); spriteram_size = 0x4000; - galpani3_spc_regs = auto_malloc (0x40); + galpani3_spc_regs = auto_alloc_array(machine, UINT32, 0x40/4); suprnova_alt_enable_sprites = 1; - sprite_bitmap_1 = auto_bitmap_alloc(1024,1024,BITMAP_FORMAT_INDEXED16); + sprite_bitmap_1 = auto_bitmap_alloc(machine,1024,1024,BITMAP_FORMAT_INDEXED16); } diff --git a/src/mame/drivers/gamecstl.c b/src/mame/drivers/gamecstl.c index 887e9af448b..4005dc81337 100644 --- a/src/mame/drivers/gamecstl.c +++ b/src/mame/drivers/gamecstl.c @@ -722,7 +722,7 @@ static void gamecstl_set_keyb_int(running_machine *machine, int state) { static DRIVER_INIT( gamecstl ) { - bios_ram = auto_malloc(0x10000); + bios_ram = auto_alloc_array(machine, UINT32, 0x10000/4); init_pc_common(machine, PCCOMMON_KEYBOARD_AT, gamecstl_set_keyb_int); mc146818_init(machine, MC146818_STANDARD); diff --git a/src/mame/drivers/gauntlet.c b/src/mame/drivers/gauntlet.c index 54c16cc9aa8..0de7849e485 100644 --- a/src/mame/drivers/gauntlet.c +++ b/src/mame/drivers/gauntlet.c @@ -1665,7 +1665,7 @@ static DRIVER_INIT( gauntlet2 ) static DRIVER_INIT( vindctr2 ) { UINT8 *gfx2_base = memory_region(machine, "gfx2"); - UINT8 *data = malloc_or_die(0x8000); + UINT8 *data = alloc_array_or_die(UINT8, 0x8000); int i; gauntlet_common_init(machine, 118, 1); diff --git a/src/mame/drivers/gbusters.c b/src/mame/drivers/gbusters.c index d1969a2921f..90eabb6e408 100644 --- a/src/mame/drivers/gbusters.c +++ b/src/mame/drivers/gbusters.c @@ -132,7 +132,7 @@ static ADDRESS_MAP_START( gbusters_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_READ(K052109_051960_r) /* tiles + sprites (RAM H21, G21 & H6) */ AM_RANGE(0x4000, 0x57ff) AM_READ(SMH_RAM) /* RAM I12 */ AM_RANGE(0x5800, 0x5fff) AM_READ(bankedram_r) /* palette + work RAM (RAM D16 & C16) */ - AM_RANGE(0x6000, 0x7fff) AM_READ(SMH_BANK1) /* banked ROM */ + AM_RANGE(0x6000, 0x7fff) AM_READ(SMH_BANK(1)) /* banked ROM */ AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM) /* ROM 878n02.rom */ ADDRESS_MAP_END diff --git a/src/mame/drivers/genesis.c b/src/mame/drivers/genesis.c index 4c631bb4cce..8b0f918b539 100644 --- a/src/mame/drivers/genesis.c +++ b/src/mame/drivers/genesis.c @@ -470,7 +470,7 @@ static ADDRESS_MAP_START( genesis_readmem, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0xa10000, 0xa1001f) AM_READ(genesis_io_r) /* Genesis Input */ AM_RANGE(0xa00000, 0xa0ffff) AM_READ(genesis_68k_to_z80_r) AM_RANGE(0xc00000, 0xc0001f) AM_READ(genesis_vdp_r) /* VDP Access */ - AM_RANGE(0xfe0000, 0xfeffff) AM_READ(SMH_BANK3) /* Main Ram */ + AM_RANGE(0xfe0000, 0xfeffff) AM_READ(SMH_BANK(3)) /* Main Ram */ AM_RANGE(0xff0000, 0xffffff) AM_READ(SMH_RAM) /* Main Ram */ ADDRESS_MAP_END @@ -481,7 +481,7 @@ static ADDRESS_MAP_START( genesis_writemem, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0xa11000, 0xa11203) AM_WRITE(genesis_ctrl_w) AM_RANGE(0xa00000, 0xa0ffff) AM_WRITE(genesis_68k_to_z80_w) AM_RANGE(0xc00000, 0xc0001f) AM_WRITE(genesis_vdp_w) /* VDP Access */ - AM_RANGE(0xfe0000, 0xfeffff) AM_WRITE(SMH_BANK3) /* Main Ram */ + AM_RANGE(0xfe0000, 0xfeffff) AM_WRITE(SMH_BANK(3)) /* Main Ram */ AM_RANGE(0xff0000, 0xffffff) AM_WRITE(SMH_RAM) AM_BASE(&genesis_68k_ram)/* Main Ram */ ADDRESS_MAP_END #endif @@ -587,15 +587,15 @@ READ8_HANDLER ( genesis_z80_bank_r ) #if 0 static ADDRESS_MAP_START( genesis_z80_readmem, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x1fff) AM_READ(SMH_BANK1) - AM_RANGE(0x2000, 0x3fff) AM_READ(SMH_BANK2) /* mirror */ + AM_RANGE(0x0000, 0x1fff) AM_READ(SMH_BANK(1)) + AM_RANGE(0x2000, 0x3fff) AM_READ(SMH_BANK(2)) /* mirror */ AM_RANGE(0x4000, 0x7fff) AM_READ(genesis_z80_r) AM_RANGE(0x8000, 0xffff) AM_READ(genesis_z80_bank_r) ADDRESS_MAP_END static ADDRESS_MAP_START( genesis_z80_writemem, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x1fff) AM_WRITE(SMH_BANK1) AM_BASE(&genesis_z80_ram) - AM_RANGE(0x2000, 0x3fff) AM_WRITE(SMH_BANK2) /* mirror */ + AM_RANGE(0x0000, 0x1fff) AM_WRITE(SMH_BANK(1)) AM_BASE(&genesis_z80_ram) + AM_RANGE(0x2000, 0x3fff) AM_WRITE(SMH_BANK(2)) /* mirror */ AM_RANGE(0x4000, 0x7fff) AM_WRITE(genesis_z80_w) // AM_RANGE(0x8000, 0xffff) AM_WRITE(genesis_z80_bank_w) ADDRESS_MAP_END diff --git a/src/mame/drivers/gng.c b/src/mame/drivers/gng.c index 48cdf8a7a5d..9ccc944aa53 100644 --- a/src/mame/drivers/gng.c +++ b/src/mame/drivers/gng.c @@ -74,7 +74,7 @@ static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x3003, 0x3003) AM_READ_PORT("DSW1") AM_RANGE(0x3004, 0x3004) AM_READ_PORT("DSW2") AM_RANGE(0x3c00, 0x3c00) AM_READNOP /* watchdog? */ - AM_RANGE(0x4000, 0x5fff) AM_READ(SMH_BANK1) + AM_RANGE(0x4000, 0x5fff) AM_READ(SMH_BANK(1)) AM_RANGE(0x6000, 0xffff) AM_READ(SMH_ROM) ADDRESS_MAP_END diff --git a/src/mame/drivers/goindol.c b/src/mame/drivers/goindol.c index 1b5adb88ff3..9a6dc0a999d 100644 --- a/src/mame/drivers/goindol.c +++ b/src/mame/drivers/goindol.c @@ -98,7 +98,7 @@ logerror("%04x: prot_fcb0_w(%02x)\n",cpu_get_pc(space->cpu),data); static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xc000, 0xc7ff) AM_READ(SMH_RAM) AM_RANGE(0xc800, 0xc800) AM_READNOP // watchdog? AM_RANGE(0xd000, 0xefff) AM_READ(SMH_RAM) diff --git a/src/mame/drivers/goldstar.c b/src/mame/drivers/goldstar.c index 3a1c6c13133..ec969b8a238 100644 --- a/src/mame/drivers/goldstar.c +++ b/src/mame/drivers/goldstar.c @@ -7067,7 +7067,7 @@ static DRIVER_INIT( chry10 ) ROM[i] = chry10_decrypt(ROM[i]); } - buffer = malloc_or_die(size); + buffer = alloc_array_or_die(UINT8, size); memcpy(buffer, ROM, size); free(buffer); @@ -7097,7 +7097,7 @@ static DRIVER_INIT( cb3 ) ROM[i] = decrypt(ROM[i], i); } - buffer = malloc_or_die(size); + buffer = alloc_array_or_die(UINT8, size); memcpy(buffer, ROM, size); free(buffer); diff --git a/src/mame/drivers/gottlieb.c b/src/mame/drivers/gottlieb.c index 8bd89ee8b47..0118d540264 100644 --- a/src/mame/drivers/gottlieb.c +++ b/src/mame/drivers/gottlieb.c @@ -266,7 +266,7 @@ static MACHINE_START( gottlieb ) laserdisc_philips_timer = timer_alloc(machine, laserdisc_philips_callback, NULL); /* create some audio RAM */ - laserdisc_audio_buffer = auto_malloc(AUDIORAM_SIZE); + laserdisc_audio_buffer = auto_alloc_array(machine, UINT8, AUDIORAM_SIZE); laserdisc_status = 0x38; /* more save state registration */ diff --git a/src/mame/drivers/gridlee.c b/src/mame/drivers/gridlee.c index 012bc8996dd..242a62a4bef 100644 --- a/src/mame/drivers/gridlee.c +++ b/src/mame/drivers/gridlee.c @@ -97,7 +97,7 @@ static UINT8 *poly17 = NULL; static UINT8 *rand17 = NULL; /* local prototypes */ -static void poly17_init(void); +static void poly17_init(running_machine *machine); /* local timers */ static emu_timer *irq_off; @@ -154,7 +154,7 @@ static TIMER_CALLBACK( firq_timer_tick ) static MACHINE_START( gridlee ) { /* create the polynomial tables */ - poly17_init(); + poly17_init(machine); state_save_register_global_array(machine, last_analog_input); state_save_register_global_array(machine, last_analog_output); @@ -233,13 +233,13 @@ static READ8_HANDLER( analog_port_r ) #define POLY17_SHR 10 #define POLY17_ADD 0x18000 -static void poly17_init(void) +static void poly17_init(running_machine *machine) { UINT32 i, x = 0; UINT8 *p, *r; /* allocate memory */ - p = poly17 = auto_malloc(2 * (POLY17_SIZE + 1)); + p = poly17 = auto_alloc_array(machine, UINT8, 2 * (POLY17_SIZE + 1)); r = rand17 = poly17 + POLY17_SIZE + 1; /* generate the polynomial */ diff --git a/src/mame/drivers/gstriker.c b/src/mame/drivers/gstriker.c index 70becacb7a8..990f2beb0f7 100644 --- a/src/mame/drivers/gstriker.c +++ b/src/mame/drivers/gstriker.c @@ -319,7 +319,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x77ff) AM_READ(SMH_ROM) AM_RANGE(0x7800, 0x7fff) AM_READ(SMH_RAM) - AM_RANGE(0x8000, 0xffff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xffff) AM_READ(SMH_BANK(1)) ADDRESS_MAP_END static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 ) diff --git a/src/mame/drivers/gticlub.c b/src/mame/drivers/gticlub.c index 8cbd93f58f3..d3338e7b985 100644 --- a/src/mame/drivers/gticlub.c +++ b/src/mame/drivers/gticlub.c @@ -1217,7 +1217,7 @@ static DRIVER_INIT(gticlub) { init_konami_cgboard(machine, 1, CGBOARD_TYPE_GTICLUB); - sharc_dataram_0 = auto_malloc(0x100000); + sharc_dataram_0 = auto_alloc_array(machine, UINT32, 0x100000/4); gticlub_led_reg0 = gticlub_led_reg1 = 0x7f; K001005_preprocess_texture_data(memory_region(machine, "gfx1"), memory_region_length(machine, "gfx1"), 1); @@ -1233,8 +1233,8 @@ static DRIVER_INIT(hangplt) set_cgboard_texture_bank(machine, 0, 5, memory_region(machine, "user5")); set_cgboard_texture_bank(machine, 1, 6, memory_region(machine, "user5")); - sharc_dataram_0 = auto_malloc(0x100000); - sharc_dataram_1 = auto_malloc(0x100000); + sharc_dataram_0 = auto_alloc_array(machine, UINT32, 0x100000/4); + sharc_dataram_1 = auto_alloc_array(machine, UINT32, 0x100000/4); gticlub_led_reg0 = gticlub_led_reg1 = 0x7f; K056800_init(machine, sound_irq_callback); diff --git a/src/mame/drivers/halleys.c b/src/mame/drivers/halleys.c index 76f90d27dde..9e44dd0bdb7 100644 --- a/src/mame/drivers/halleys.c +++ b/src/mame/drivers/halleys.c @@ -2148,30 +2148,30 @@ static void init_common(running_machine *machine) // allocate memory for unpacked graphics - buf = auto_malloc(0x100000); + buf = auto_alloc_array(machine, UINT8, 0x100000); gfx_plane02 = buf; gfx_plane13 = buf + 0x80000; // allocate memory for render layers - buf = auto_malloc(SCREEN_BYTESIZE * MAX_LAYERS); + buf = auto_alloc_array(machine, UINT8, SCREEN_BYTESIZE * MAX_LAYERS); for (i=0; i<MAX_LAYERS; buf+=SCREEN_BYTESIZE, i++) render_layer[i] = (UINT16*)buf; // allocate memory for pre-processed ROMs - gfx1_base = auto_malloc(0x20000); + gfx1_base = auto_alloc_array(machine, UINT8, 0x20000); // allocate memory for alpha table - alpha_table = auto_malloc(sizeof(UINT32) * 0x10000); + alpha_table = auto_alloc_array(machine, UINT32, 0x10000); // allocate memory for internal palette - internal_palette = auto_malloc(sizeof(UINT32) * PALETTE_SIZE); + internal_palette = auto_alloc_array(machine, UINT32, PALETTE_SIZE); // allocate memory for hardware collision list - collision_list = auto_malloc(MAX_SPRITES); + collision_list = auto_alloc_array(machine, UINT8, MAX_SPRITES); // decrypt main program ROM diff --git a/src/mame/drivers/hcastle.c b/src/mame/drivers/hcastle.c index 859dba6cdad..2956442391c 100644 --- a/src/mame/drivers/hcastle.c +++ b/src/mame/drivers/hcastle.c @@ -61,7 +61,7 @@ static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0418, 0x0418) AM_READ(hcastle_gfxbank_r) AM_RANGE(0x0600, 0x06ff) AM_READ(SMH_RAM) AM_RANGE(0x0700, 0x5fff) AM_READ(SMH_RAM) - AM_RANGE(0x6000, 0x7fff) AM_READ(SMH_BANK1) + AM_RANGE(0x6000, 0x7fff) AM_READ(SMH_BANK(1)) AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM) ADDRESS_MAP_END diff --git a/src/mame/drivers/hexa.c b/src/mame/drivers/hexa.c index 627819e0395..3046985a56a 100644 --- a/src/mame/drivers/hexa.c +++ b/src/mame/drivers/hexa.c @@ -61,7 +61,7 @@ WRITE8_HANDLER( hexa_d008_w ); static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xc000, 0xc7ff) AM_READ(SMH_RAM) AM_RANGE(0xd001, 0xd001) AM_DEVREAD("ay", ay8910_r) AM_RANGE(0xe000, 0xe7ff) AM_READ(SMH_RAM) diff --git a/src/mame/drivers/hexion.c b/src/mame/drivers/hexion.c index 7a3d9018c18..fa5b047f779 100644 --- a/src/mame/drivers/hexion.c +++ b/src/mame/drivers/hexion.c @@ -115,7 +115,7 @@ if ((data & 0xdc) != 0x10) popmessage("coincntr %02x",data); static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0x9fff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0x9fff) AM_READ(SMH_BANK(1)) AM_RANGE(0xa000, 0xbfff) AM_READ(SMH_RAM) AM_RANGE(0xc000, 0xdffe) AM_READ(hexion_bankedram_r) AM_RANGE(0xf400, 0xf400) AM_READ_PORT("DSW1") diff --git a/src/mame/drivers/hng64.c b/src/mame/drivers/hng64.c index 26dc1ca13b4..c630d91796d 100644 --- a/src/mame/drivers/hng64.c +++ b/src/mame/drivers/hng64.c @@ -1250,8 +1250,8 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( hng_sound_map, ADDRESS_SPACE_PROGRAM, 16 ) - AM_RANGE(0x00000, 0x3ffff) AM_READ(SMH_BANK2) - AM_RANGE(0xe0000, 0xfffff) AM_READ(SMH_BANK1) + AM_RANGE(0x00000, 0x3ffff) AM_READ(SMH_BANK(2)) + AM_RANGE(0xe0000, 0xfffff) AM_READ(SMH_BANK(1)) ADDRESS_MAP_END @@ -1459,7 +1459,7 @@ static void hng64_reorder(UINT8* gfxregion, size_t gfxregionsize) int i; UINT8 tilesize = 4*8; // 4 bytes per line, 8 lines - buffer = malloc_or_die(gfxregionsize); + buffer = alloc_array_or_die(UINT8, gfxregionsize); for (i=0;i<gfxregionsize/2;i+=tilesize) { @@ -1483,7 +1483,7 @@ static DRIVER_INIT( hng64_reorder_gfx ) static DRIVER_INIT( hng64 ) { - hng64_soundram=auto_malloc(0x200000); + hng64_soundram=auto_alloc_array(machine, UINT16, 0x200000/2); DRIVER_INIT_CALL(hng64_reorder_gfx); } @@ -1582,8 +1582,8 @@ static MACHINE_RESET(hyperneo) KL5C80_init(); /* 1 meg of virtual address space for the com cpu */ - hng64_com_virtual_mem = auto_malloc(0x100000); - hng64_com_op_base = auto_malloc(0x10000); + hng64_com_virtual_mem = auto_alloc_array(machine, UINT8, 0x100000); + hng64_com_op_base = auto_alloc_array(machine, UINT8, 0x10000); /* Fill up virtual memory with ROM */ for (i = 0x0; i < 0x100000; i++) diff --git a/src/mame/drivers/homedata.c b/src/mame/drivers/homedata.c index 71ce2f7a9df..e1c0dec965b 100644 --- a/src/mame/drivers/homedata.c +++ b/src/mame/drivers/homedata.c @@ -620,7 +620,7 @@ static ADDRESS_MAP_START( reikaids_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x7801, 0x7801) AM_READ_PORT("IN0") AM_RANGE(0x7802, 0x7802) AM_READ_PORT("IN1") AM_RANGE(0x7803, 0x7803) AM_READ(reikaids_io_r) // coin, blitter, upd7807 - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xc000, 0xffff) AM_READ(SMH_ROM) ADDRESS_MAP_END @@ -640,7 +640,7 @@ static ADDRESS_MAP_START( reikaids_writemem, ADDRESS_SPACE_PROGRAM, 8 ) ADDRESS_MAP_END static ADDRESS_MAP_START( reikaids_upd7807_readmem, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0xfeff) AM_READ(SMH_BANK2) /* External ROM (Banked) */ + AM_RANGE(0x0000, 0xfeff) AM_READ(SMH_BANK(2)) /* External ROM (Banked) */ AM_RANGE(0xff00, 0xffff) AM_READ(SMH_RAM) /* Internal RAM */ ADDRESS_MAP_END @@ -666,7 +666,7 @@ static ADDRESS_MAP_START( pteacher_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x7800, 0x7800) AM_READ(SMH_RAM) AM_RANGE(0x7801, 0x7801) AM_READ(pteacher_io_r) // vblank, visible page AM_RANGE(0x7ff2, 0x7ff2) AM_READ(pteacher_snd_r) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xc000, 0xffff) AM_READ(SMH_ROM) ADDRESS_MAP_END @@ -687,7 +687,7 @@ static ADDRESS_MAP_START( pteacher_writemem, ADDRESS_SPACE_PROGRAM, 8 ) ADDRESS_MAP_END static ADDRESS_MAP_START( pteacher_upd7807_readmem, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0xfeff) AM_READ(SMH_BANK2) /* External ROM (Banked) */ + AM_RANGE(0x0000, 0xfeff) AM_READ(SMH_BANK(2)) /* External ROM (Banked) */ AM_RANGE(0xff00, 0xffff) AM_READ(SMH_RAM) /* Internal RAM */ ADDRESS_MAP_END diff --git a/src/mame/drivers/homerun.c b/src/mame/drivers/homerun.c index 2bb637fc06a..2058515501e 100644 --- a/src/mame/drivers/homerun.c +++ b/src/mame/drivers/homerun.c @@ -81,7 +81,7 @@ GFXDECODE_END static ADDRESS_MAP_START( homerun_memmap, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_ROM - AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK1) + AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK(1)) AM_RANGE(0x8000, 0x9fff) AM_RAM_WRITE(homerun_videoram_w) AM_BASE(&homerun_videoram) AM_RANGE(0xa000, 0xa0ff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size) AM_RANGE(0xb000, 0xb0ff) AM_WRITE(homerun_color_w) diff --git a/src/mame/drivers/hornet.c b/src/mame/drivers/hornet.c index 441eb040632..803491a9159 100644 --- a/src/mame/drivers/hornet.c +++ b/src/mame/drivers/hornet.c @@ -417,11 +417,11 @@ static int K037122_vh_start(running_machine *machine, int chip) if(K037122_gfx_index[chip] == MAX_GFX_ELEMENTS) return 1; - K037122_char_ram[chip] = auto_malloc(0x200000); + K037122_char_ram[chip] = auto_alloc_array(machine, UINT32, 0x200000/4); - K037122_tile_ram[chip] = auto_malloc(0x20000); + K037122_tile_ram[chip] = auto_alloc_array(machine, UINT32, 0x20000/4); - K037122_reg[chip] = auto_malloc(0x400); + K037122_reg[chip] = auto_alloc_array(machine, UINT32, 0x400/4); if (chip == 0) { @@ -965,8 +965,7 @@ static const sharc_config sharc_cfg = static MACHINE_START( hornet ) { jvs_sdata_ptr = 0; - jvs_sdata = auto_malloc(1024); - memset(jvs_sdata, 0, 1024); + jvs_sdata = auto_alloc_array_clear(machine, UINT8, 1024); /* set conservative DRC options */ ppcdrc_set_options(machine->cpu[0], PPCDRC_COMPATIBLE_OPTIONS); diff --git a/src/mame/drivers/hotblock.c b/src/mame/drivers/hotblock.c index 0025615ffad..994db191eba 100644 --- a/src/mame/drivers/hotblock.c +++ b/src/mame/drivers/hotblock.c @@ -117,7 +117,7 @@ ADDRESS_MAP_END static VIDEO_START(hotblock) { - hotblock_pal=auto_malloc(0x10000); + hotblock_pal=auto_alloc_array(machine, UINT8, 0x10000); } static VIDEO_UPDATE(hotblock) diff --git a/src/mame/drivers/hshavoc.c b/src/mame/drivers/hshavoc.c index 19e46df2414..52968532cb8 100644 --- a/src/mame/drivers/hshavoc.c +++ b/src/mame/drivers/hshavoc.c @@ -99,8 +99,8 @@ static ADDRESS_MAP_START( topshoot_readmem, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0x202000, 0x2023ff) AM_READ(SMH_RAM) AM_RANGE(0xa00000, 0xa0ffff) AM_READ(genesis_68k_to_z80_r) AM_RANGE(0xc00000, 0xc0001f) AM_READ(genesis_vdp_r) /* VDP Access */ - AM_RANGE(0xe00000, 0xe1ffff) AM_READ(SMH_BANK3) - AM_RANGE(0xfe0000, 0xfeffff) AM_READ(SMH_BANK4) + AM_RANGE(0xe00000, 0xe1ffff) AM_READ(SMH_BANK(3)) + AM_RANGE(0xfe0000, 0xfeffff) AM_READ(SMH_BANK(4)) AM_RANGE(0xff0000, 0xffffff) AM_READ(SMH_RAM) /* Main Ram */ ADDRESS_MAP_END @@ -113,20 +113,20 @@ static ADDRESS_MAP_START( topshoot_writemem, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0xa11000, 0xa11203) AM_WRITE(genesis_ctrl_w) AM_RANGE(0xa00000, 0xa0ffff) AM_WRITE(genesis_68k_to_z80_w) AM_RANGE(0xc00000, 0xc0001f) AM_WRITE(genesis_vdp_w) /* VDP Access */ - AM_RANGE(0xfe0000, 0xfeffff) AM_WRITE(SMH_BANK4) + AM_RANGE(0xfe0000, 0xfeffff) AM_WRITE(SMH_BANK(4)) AM_RANGE(0xff0000, 0xffffff) AM_WRITE(SMH_RAM) AM_BASE(&genesis_68k_ram)/* Main Ram */ ADDRESS_MAP_END static ADDRESS_MAP_START( genesis_z80_readmem, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x1fff) AM_READ(SMH_BANK1) - AM_RANGE(0x2000, 0x3fff) AM_READ(SMH_BANK2) /* mirror */ + AM_RANGE(0x0000, 0x1fff) AM_READ(SMH_BANK(1)) + AM_RANGE(0x2000, 0x3fff) AM_READ(SMH_BANK(2)) /* mirror */ AM_RANGE(0x4000, 0x7fff) AM_READ(genesis_z80_r) AM_RANGE(0x8000, 0xffff) AM_READ(genesis_z80_bank_r) ADDRESS_MAP_END static ADDRESS_MAP_START( genesis_z80_writemem, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x1fff) AM_WRITE(SMH_BANK1) AM_BASE(&genesis_z80_ram) - AM_RANGE(0x2000, 0x3fff) AM_WRITE(SMH_BANK2) /* mirror */ + AM_RANGE(0x0000, 0x1fff) AM_WRITE(SMH_BANK(1)) AM_BASE(&genesis_z80_ram) + AM_RANGE(0x2000, 0x3fff) AM_WRITE(SMH_BANK(2)) /* mirror */ AM_RANGE(0x4000, 0x7fff) AM_WRITE(genesis_z80_w) // AM_RANGE(0x8000, 0xffff) AM_WRITE(genesis_z80_bank_w) ADDRESS_MAP_END diff --git a/src/mame/drivers/hvyunit.c b/src/mame/drivers/hvyunit.c index ac5c50c6fa1..294f497d8ef 100644 --- a/src/mame/drivers/hvyunit.c +++ b/src/mame/drivers/hvyunit.c @@ -345,7 +345,7 @@ WRITE8_HANDLER( hu_colorram_w ) static ADDRESS_MAP_START( main_memory, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xc000, 0xcfff) AM_READWRITE( pandora_spriteram_r, pandora_spriteram_w ) AM_RANGE(0xd000, 0xdfff) AM_RAM AM_RANGE(0xe000, 0xefff) AM_RAM AM_SHARE(1) @@ -381,7 +381,7 @@ static WRITE8_HANDLER( hu_scrolly_w) static ADDRESS_MAP_START( sub_memory, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK2) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(2)) AM_RANGE(0xc000, 0xc3ff) AM_RAM_WRITE(hu_videoram_w) AM_BASE(&videoram) AM_RANGE(0xc400, 0xc7ff) AM_RAM_WRITE(hu_colorram_w) AM_BASE(&colorram) AM_RANGE(0xd000, 0xd1ff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_split2_w) AM_BASE(&paletteram_2) @@ -418,7 +418,7 @@ static WRITE8_HANDLER( sound_bankswitch_w ) static ADDRESS_MAP_START( sound_memory, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK3) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(3)) AM_RANGE(0xc000, 0xc7ff) AM_RAM ADDRESS_MAP_END diff --git a/src/mame/drivers/igs017.c b/src/mame/drivers/igs017.c index 5948190bb9c..aa22e1fe959 100644 --- a/src/mame/drivers/igs017.c +++ b/src/mame/drivers/igs017.c @@ -124,7 +124,7 @@ static void expand_sprites(running_machine *machine) int i; sprites_gfx_size = size / 2 * 3; - sprites_gfx = auto_malloc(sprites_gfx_size); + sprites_gfx = auto_alloc_array(machine, UINT8, sprites_gfx_size); for (i = 0; i < size / 2 ; i++) { @@ -296,7 +296,7 @@ static void decrypt_program_rom(running_machine *machine, int mask, int a7, int { int length = memory_region_length(machine, "maincpu"); UINT8 *rom = memory_region(machine, "maincpu"); - UINT8 *tmp = auto_malloc(length); + UINT8 *tmp = auto_alloc_array(machine, UINT8, length); int i; // decrypt the program ROM @@ -394,7 +394,7 @@ static void tjsb_decrypt_sprites(running_machine *machine) { int length = memory_region_length(machine, "sprites"); UINT8 *rom = memory_region(machine, "sprites"); - UINT8 *tmp = auto_malloc(length); + UINT8 *tmp = auto_alloc_array(machine, UINT8, length); int i; // address lines swap (to do: collapse into one bitswap) @@ -491,7 +491,7 @@ static void mgcs_decrypt_tiles(running_machine *machine) { int length = memory_region_length(machine, "tilemaps"); UINT8 *rom = memory_region(machine, "tilemaps"); - UINT8 *tmp = malloc_or_die(length); + UINT8 *tmp = alloc_array_or_die(UINT8, length); int i; memcpy(tmp,rom,length); diff --git a/src/mame/drivers/igs_blit.c b/src/mame/drivers/igs_blit.c index c862cd15640..6a6b82721fd 100644 --- a/src/mame/drivers/igs_blit.c +++ b/src/mame/drivers/igs_blit.c @@ -87,7 +87,7 @@ static VIDEO_START(igs) for (i = 0; i < 8; i++) { - layer[i] = auto_malloc(512 * 256); + layer[i] = auto_alloc_array(machine, UINT8, 512 * 256); } chmplst2_pen_hi = 0; @@ -503,7 +503,7 @@ static void chmplst2_decrypt(running_machine *machine) int i,j; int rom_size = 0x80000; UINT16 *src = (UINT16 *) (memory_region(machine, "maincpu")); - UINT16 *result_data = malloc_or_die(rom_size); + UINT16 *result_data = alloc_array_or_die(UINT16, rom_size/2); for (i=0; i<rom_size/2; i++) { @@ -625,7 +625,7 @@ static void chmplst2_decrypt_gfx(running_machine *machine) int i; unsigned rom_size = 0x200000; UINT8 *src = (UINT8 *) (memory_region(machine, "gfx1")); - UINT8 *result_data = malloc_or_die(rom_size); + UINT8 *result_data = alloc_array_or_die(UINT8, rom_size); for (i=0; i<rom_size; i++) result_data[i] = src[BITSWAP24(i, 23,22,21,20, 19, 17,16,15, 13,12, 10,9,8,7,6,5,4, 2,1, 3, 11, 14, 18, 0)]; @@ -640,7 +640,7 @@ static void chindrag_gfx_decrypt(running_machine *machine) int i; unsigned rom_size = 0x400000; UINT8 *src = (UINT8 *) (memory_region(machine, "gfx1")); - UINT8 *result_data = malloc_or_die(rom_size); + UINT8 *result_data = alloc_array_or_die(UINT8, rom_size); for (i=0; i<rom_size; i++) result_data[i] = src[BITSWAP24(i, 23,22,21,20,19,18,17,16,15, 12, 13, 14, 11,10,9,8,7,6,5,4,3,2,1,0)]; diff --git a/src/mame/drivers/igs_m027.c b/src/mame/drivers/igs_m027.c index da6530b2fb2..d03267fd5c7 100644 --- a/src/mame/drivers/igs_m027.c +++ b/src/mame/drivers/igs_m027.c @@ -269,7 +269,7 @@ static void sdwx_gfx_decrypt(running_machine *machine) int i; unsigned rom_size = 0x80000; UINT8 *src = (UINT8 *) (memory_region(machine, "gfx1")); - UINT8 *result_data = malloc_or_die(rom_size); + UINT8 *result_data = alloc_array_or_die(UINT8, rom_size); for (i=0; i<rom_size; i++) result_data[i] = src[BITSWAP24(i, 23,22,21,20,19,18,17,16,15,14,13,12,11,8,7,6,10,9,5,4,3,2,1,0)]; diff --git a/src/mame/drivers/igspoker.c b/src/mame/drivers/igspoker.c index 162077b7f83..274d3c41fe8 100644 --- a/src/mame/drivers/igspoker.c +++ b/src/mame/drivers/igspoker.c @@ -2100,7 +2100,7 @@ static DRIVER_INIT( number10 ) /* Descramble graphic */ rom = memory_region(machine, "gfx1"); length = memory_region_length(machine, "gfx1"); - tmp = malloc_or_die(length); + tmp = alloc_array_or_die(UINT8, length); memcpy(tmp,rom,length); for (A = 0;A < length;A++) { diff --git a/src/mame/drivers/ilpag.c b/src/mame/drivers/ilpag.c index 3ea9221f43a..f9823d85b37 100644 --- a/src/mame/drivers/ilpag.c +++ b/src/mame/drivers/ilpag.c @@ -83,7 +83,7 @@ static UINT8 *blit_buffer; static VIDEO_START(ilpag) { - blit_buffer = auto_malloc(512*512*4); //just to be sure,number is wrong + blit_buffer = auto_alloc_array(machine, UINT8, 512*512*4); //just to be sure,number is wrong } static VIDEO_UPDATE(ilpag) diff --git a/src/mame/drivers/imolagp.c b/src/mame/drivers/imolagp.c index 8f283b25f74..0ed8b708785 100644 --- a/src/mame/drivers/imolagp.c +++ b/src/mame/drivers/imolagp.c @@ -164,7 +164,7 @@ static VIDEO_START( imolagp ) int i; for( i=0; i<3; i++ ) { - imola_videoram[i] = auto_malloc(0x4000); + imola_videoram[i] = auto_alloc_array(machine, UINT8, 0x4000); memset( imola_videoram[i], 0x00, 0x4000 ); } InitializeColors(machine); diff --git a/src/mame/drivers/inufuku.c b/src/mame/drivers/inufuku.c index a83de7e39ad..8b870ac6b1a 100644 --- a/src/mame/drivers/inufuku.c +++ b/src/mame/drivers/inufuku.c @@ -219,7 +219,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( inufuku_readmem_sound, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x77ff) AM_READ(SMH_ROM) AM_RANGE(0x7800, 0x7fff) AM_READ(SMH_RAM) - AM_RANGE(0x8000, 0xffff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xffff) AM_READ(SMH_BANK(1)) ADDRESS_MAP_END static ADDRESS_MAP_START( inufuku_writemem_sound, ADDRESS_SPACE_PROGRAM, 8 ) diff --git a/src/mame/drivers/irobot.c b/src/mame/drivers/irobot.c index 31ec93324c2..0c5fc34a9ab 100644 --- a/src/mame/drivers/irobot.c +++ b/src/mame/drivers/irobot.c @@ -121,7 +121,7 @@ static WRITE8_HANDLER( irobot_clearfirq_w ) static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x07ff) AM_READ(SMH_RAM) - AM_RANGE(0x0800, 0x0fff) AM_READ(SMH_BANK2) + AM_RANGE(0x0800, 0x0fff) AM_READ(SMH_BANK(2)) AM_RANGE(0x1000, 0x103f) AM_READ_PORT("IN0") AM_RANGE(0x1040, 0x1040) AM_READ_PORT("IN1") AM_RANGE(0x1080, 0x1080) AM_READ(irobot_status_r) @@ -131,14 +131,14 @@ static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x1400, 0x143f) AM_READ(quad_pokey_r) AM_RANGE(0x1c00, 0x1fff) AM_READ(SMH_RAM) AM_RANGE(0x2000, 0x3fff) AM_READ(irobot_sharedmem_r) - AM_RANGE(0x4000, 0x5fff) AM_READ(SMH_BANK1) + AM_RANGE(0x4000, 0x5fff) AM_READ(SMH_BANK(1)) AM_RANGE(0x6000, 0xffff) AM_READ(SMH_ROM) ADDRESS_MAP_END static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x07ff) AM_WRITE(SMH_RAM) - AM_RANGE(0x0800, 0x0fff) AM_WRITE(SMH_BANK2) + AM_RANGE(0x0800, 0x0fff) AM_WRITE(SMH_BANK(2)) AM_RANGE(0x1100, 0x1100) AM_WRITE(irobot_clearirq_w) AM_RANGE(0x1140, 0x1140) AM_WRITE(irobot_statwr_w) AM_RANGE(0x1180, 0x1180) AM_WRITE(irobot_out0_w) diff --git a/src/mame/drivers/itech32.c b/src/mame/drivers/itech32.c index 48fad98c83c..244077f5994 100644 --- a/src/mame/drivers/itech32.c +++ b/src/mame/drivers/itech32.c @@ -3936,8 +3936,8 @@ static DRIVER_INIT( wcbowl ) memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x680000, 0x680001, 0, 0, trackball_r); - memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x578000, 0x57ffff, 0, 0, SMH_NOP); - memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x680080, 0x680081, 0, 0, wcbowl_prot_result_r, SMH_NOP); + memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x578000, 0x57ffff, 0, 0, (read16_space_func)SMH_NOP); + memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x680080, 0x680081, 0, 0, wcbowl_prot_result_r, (write16_space_func)SMH_NOP); } diff --git a/src/mame/drivers/itech8.c b/src/mame/drivers/itech8.c index 36522f4239f..0b2e86bc845 100644 --- a/src/mame/drivers/itech8.c +++ b/src/mame/drivers/itech8.c @@ -2662,7 +2662,7 @@ static DRIVER_INIT( grmatch ) { memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0160, 0x0160, 0, 0, grmatch_palette_w); memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0180, 0x0180, 0, 0, grmatch_xscroll_w); - memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x01e0, 0x01ff, 0, 0, SMH_UNMAP); + memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x01e0, 0x01ff, 0, 0, (write8_space_func)SMH_UNMAP); } diff --git a/src/mame/drivers/jack.c b/src/mame/drivers/jack.c index f0bea7bcb3d..94a166f9f4e 100644 --- a/src/mame/drivers/jack.c +++ b/src/mame/drivers/jack.c @@ -1336,7 +1336,7 @@ static void treahunt_decode(running_machine *machine) int A; const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); UINT8 *rom = memory_region(machine, "maincpu"); - UINT8 *decrypt = auto_malloc(0x4000); + UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x4000); int data; memory_set_decrypted_region(space, 0x0000, 0x3fff, decrypt); @@ -1439,7 +1439,7 @@ static DRIVER_INIT( striv ) memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc000, 0xcfff, 0, 0, striv_question_r); // Nop out unused sprites writes - memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xb000, 0xb0ff, 0, 0, SMH_NOP); + memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xb000, 0xb0ff, 0, 0, (write8_space_func)SMH_NOP); timer_rate = 128; } diff --git a/src/mame/drivers/jalmah.c b/src/mame/drivers/jalmah.c index 0cee32e412c..356ade8f938 100644 --- a/src/mame/drivers/jalmah.c +++ b/src/mame/drivers/jalmah.c @@ -231,8 +231,8 @@ static VIDEO_START( jalmah ) sc3_tilemap_2 = tilemap_create(machine, get_sc3_tile_info,range2_8x8,8,8,128,64); sc3_tilemap_3 = tilemap_create(machine, get_sc3_tile_info,range3_8x8,8,8,64,128); - jm_scrollram = auto_malloc(0x80); - jm_vregs = auto_malloc(0x40); + jm_scrollram = auto_alloc_array(machine, UINT16, 0x80/2); + jm_vregs = auto_alloc_array(machine, UINT16, 0x40/2); tilemap_set_transparent_pen(sc0_tilemap_0,15); tilemap_set_transparent_pen(sc0_tilemap_1,15); @@ -259,8 +259,8 @@ static VIDEO_START( urashima ) sc0_tilemap_0 = tilemap_create(machine, get_sc0_tile_info,range0_16x16,16,16,256,32); sc3_tilemap_0 = tilemap_create(machine, get_sc3_tile_info,range2_8x8,8,8,128,64); - jm_scrollram = auto_malloc(0x80); - jm_vregs = auto_malloc(0x40); + jm_scrollram = auto_alloc_array(machine, UINT16, 0x80/2); + jm_vregs = auto_alloc_array(machine, UINT16, 0x40/2); tilemap_set_transparent_pen(sc0_tilemap_0,15); tilemap_set_transparent_pen(sc3_tilemap_0,15); diff --git a/src/mame/drivers/jangou.c b/src/mame/drivers/jangou.c index de8f0159162..80117a43687 100644 --- a/src/mame/drivers/jangou.c +++ b/src/mame/drivers/jangou.c @@ -95,7 +95,7 @@ static PALETTE_INIT( jangou ) static VIDEO_START( jangou ) { - blit_buffer = auto_malloc(256*256); + blit_buffer = auto_alloc_array(machine, UINT8, 256*256); } static VIDEO_UPDATE( jangou ) diff --git a/src/mame/drivers/jantotsu.c b/src/mame/drivers/jantotsu.c index f3e6b7acb17..b647c9c2cec 100644 --- a/src/mame/drivers/jantotsu.c +++ b/src/mame/drivers/jantotsu.c @@ -73,10 +73,10 @@ static UINT8 mux_data; static VIDEO_START(jantotsu) { - jan_bitmap_1 = auto_malloc(0x2000); - jan_bitmap_2 = auto_malloc(0x2000); - jan_bitmap_3 = auto_malloc(0x2000); - jan_bitmap_4 = auto_malloc(0x2000); + jan_bitmap_1 = auto_alloc_array(machine, UINT8, 0x2000); + jan_bitmap_2 = auto_alloc_array(machine, UINT8, 0x2000); + jan_bitmap_3 = auto_alloc_array(machine, UINT8, 0x2000); + jan_bitmap_4 = auto_alloc_array(machine, UINT8, 0x2000); vram_bank = 0; } diff --git a/src/mame/drivers/jchan.c b/src/mame/drivers/jchan.c index 4ff25376901..55b35550044 100644 --- a/src/mame/drivers/jchan.c +++ b/src/mame/drivers/jchan.c @@ -346,15 +346,15 @@ static INTERRUPT_GEN( jchan_vblank ) static VIDEO_START(jchan) { /* so we can use suprnova.c */ - jchan_sprite_ram32_1 = auto_malloc ( 0x4000 ); - jchan_sprite_ram32_2 = auto_malloc ( 0x4000 ); + jchan_sprite_ram32_1 = auto_alloc_array(machine, UINT32, 0x4000/4); + jchan_sprite_ram32_2 = auto_alloc_array(machine, UINT32, 0x4000/4); spriteram_size = 0x4000; - jchan_sprite_regs32_1 = auto_malloc (0x40); - jchan_sprite_regs32_2 = auto_malloc (0x40); + jchan_sprite_regs32_1 = auto_alloc_array(machine, UINT32, 0x40/4); + jchan_sprite_regs32_2 = auto_alloc_array(machine, UINT32, 0x40/4); - sprite_bitmap_1 = auto_bitmap_alloc(1024,1024,BITMAP_FORMAT_INDEXED16); - sprite_bitmap_2 = auto_bitmap_alloc(1024,1024,BITMAP_FORMAT_INDEXED16); + sprite_bitmap_1 = auto_bitmap_alloc(machine,1024,1024,BITMAP_FORMAT_INDEXED16); + sprite_bitmap_2 = auto_bitmap_alloc(machine,1024,1024,BITMAP_FORMAT_INDEXED16); suprnova_alt_enable_sprites = 1; diff --git a/src/mame/drivers/jongkyo.c b/src/mame/drivers/jongkyo.c index 0e18d44fa1d..83d4bebd937 100644 --- a/src/mame/drivers/jongkyo.c +++ b/src/mame/drivers/jongkyo.c @@ -195,7 +195,7 @@ static WRITE8_HANDLER( unknown_w ) static ADDRESS_MAP_START( jongkyo_memmap, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_ROM) AM_WRITE(videoram2_w) // wrong, this doesn't seem to be video ram on write.. AM_RANGE(0x4000, 0x6bff) AM_READ(SMH_ROM) // fixed rom - AM_RANGE(0x6c00, 0x6fff) AM_READ(SMH_BANK1) // banked (8 banks) + AM_RANGE(0x6c00, 0x6fff) AM_READ(SMH_BANK(1)) // banked (8 banks) AM_RANGE(0x7000, 0x77ff) AM_RAM AM_RANGE(0x8000, 0xffff) AM_RAM AM_BASE(&videoram) ADDRESS_MAP_END @@ -476,7 +476,7 @@ static DRIVER_INIT( jongkyo ) /* then do the standard Sega decryption */ jongkyo_decode(machine, "maincpu"); - videoram2 = auto_malloc(0x4000); + videoram2 = auto_alloc_array(machine, UINT8, 0x4000); state_save_register_global_pointer(machine, videoram2, 0x4000); } diff --git a/src/mame/drivers/junofrst.c b/src/mame/drivers/junofrst.c index c1e8cd636ec..cb4e2818ba3 100644 --- a/src/mame/drivers/junofrst.c +++ b/src/mame/drivers/junofrst.c @@ -194,7 +194,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x8060, 0x8060) AM_WRITE(junofrst_bankselect_w) AM_RANGE(0x8070, 0x8073) AM_WRITE(junofrst_blitter_w) AM_RANGE(0x8100, 0x8fff) AM_RAM - AM_RANGE(0x9000, 0x9fff) AM_READ(SMH_BANK1) + AM_RANGE(0x9000, 0x9fff) AM_READ(SMH_BANK(1)) AM_RANGE(0xa000, 0xffff) AM_ROM ADDRESS_MAP_END diff --git a/src/mame/drivers/kchamp.c b/src/mame/drivers/kchamp.c index dfd249a87c4..d82297ccc52 100644 --- a/src/mame/drivers/kchamp.c +++ b/src/mame/drivers/kchamp.c @@ -679,7 +679,7 @@ ROM_END static DRIVER_INIT( kchampvs ) { const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); - UINT8 *decrypted = auto_malloc(0x10000); + UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0x10000); UINT8 *rom = memory_region(machine, "maincpu"); int A; diff --git a/src/mame/drivers/koftball.c b/src/mame/drivers/koftball.c index e1359ffff4c..bfc3b1586e6 100644 --- a/src/mame/drivers/koftball.c +++ b/src/mame/drivers/koftball.c @@ -271,7 +271,7 @@ static const UINT16 nvram[]= #endif static DRIVER_INIT(koftball) { - colorram=auto_malloc(768); + colorram=auto_alloc_array(machine, UINT8, 768); #if NVRAM_HACK { diff --git a/src/mame/drivers/konamigv.c b/src/mame/drivers/konamigv.c index c01e969e7d8..5aaff95481c 100644 --- a/src/mame/drivers/konamigv.c +++ b/src/mame/drivers/konamigv.c @@ -636,7 +636,7 @@ static DRIVER_INIT( btchamp ) intelflash_init( machine, 0, FLASH_SHARP_LH28F400, NULL ); memory_install_readwrite32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f680080, 0x1f68008f, 0, 0, btc_trackball_r, btc_trackball_w ); - memory_install_write32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f6800e0, 0x1f6800e3, 0, 0, SMH_NOP ); + memory_install_write32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f6800e0, 0x1f6800e3, 0, 0, (write32_space_func)SMH_NOP ); memory_install_readwrite32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f380000, 0x1f3fffff, 0, 0, btcflash_r, btcflash_w ); DRIVER_INIT_CALL(konamigv); diff --git a/src/mame/drivers/ksayakyu.c b/src/mame/drivers/ksayakyu.c index 5cef97c4648..01d2628f466 100644 --- a/src/mame/drivers/ksayakyu.c +++ b/src/mame/drivers/ksayakyu.c @@ -107,7 +107,7 @@ static WRITE8_HANDLER(tomaincpu_w) static ADDRESS_MAP_START( maincpu_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_ROM - AM_RANGE(0x4000, 0x7fff) AM_READWRITE(SMH_BANK1, SMH_NOP) + AM_RANGE(0x4000, 0x7fff) AM_READWRITE(SMH_BANK(1), SMH_NOP) AM_RANGE(0x8000, 0x9fff) AM_ROM AM_RANGE(0xa000, 0xa7ff) AM_RAM AM_RANGE(0xa800, 0xa800) AM_READ_PORT("P1") diff --git a/src/mame/drivers/ksys573.c b/src/mame/drivers/ksys573.c index 1029f6cbd71..d9eefa5f66f 100644 --- a/src/mame/drivers/ksys573.c +++ b/src/mame/drivers/ksys573.c @@ -952,7 +952,7 @@ static void atapi_init(running_machine *machine) { int i; - atapi_regs = auto_malloc( ATAPI_REG_MAX ); + atapi_regs = auto_alloc_array(machine, UINT8, ATAPI_REG_MAX ); memset(atapi_regs, 0, sizeof(atapi_regs)); atapi_regs[ATAPI_REG_CMDSTATUS] = 0; @@ -980,7 +980,7 @@ static void atapi_init(running_machine *machine) } add_exit_callback(machine, atapi_exit); - atapi_data = auto_malloc( ATAPI_DATA_SIZE ); + atapi_data = auto_alloc_array(machine, UINT8, ATAPI_DATA_SIZE ); state_save_register_global_pointer(machine, atapi_regs, ATAPI_REG_MAX ); state_save_register_global_pointer(machine, atapi_data, ATAPI_DATA_SIZE / 2 ); @@ -2388,7 +2388,7 @@ static void gx894pwbba_init( running_machine *machine, void (*output_callback_fu gx894_ram_write_offset = 0; gx894_ram_read_offset = 0; - gx894_ram = auto_malloc( gx894_ram_size ); + gx894_ram = auto_alloc_array(machine, UINT16, gx894_ram_size/2); ds2401_init( machine, 2, ds2401_xid ); /* todo: load this from roms */ diff --git a/src/mame/drivers/kyugo.c b/src/mame/drivers/kyugo.c index 35c9b0f66e2..0b8daed0707 100644 --- a/src/mame/drivers/kyugo.c +++ b/src/mame/drivers/kyugo.c @@ -1211,12 +1211,12 @@ static DRIVER_INIT( gyrodine ) static DRIVER_INIT( srdmissn ) { /* shared RAM is mapped at 0xe000 as well */ - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xe000, 0xe7ff, 0, 0, SMH_BANK1, SMH_BANK1); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xe000, 0xe7ff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_BANK(1)); memory_set_bankptr(machine, 1, shared_ram); /* extra RAM on sub CPU */ - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x8800, 0x8fff, 0, 0, SMH_BANK2, SMH_BANK2); - memory_set_bankptr(machine, 2, auto_malloc(0x800)); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x8800, 0x8fff, 0, 0, (read8_space_func)SMH_BANK(2), (write8_space_func)SMH_BANK(2)); + memory_set_bankptr(machine, 2, auto_alloc_array(machine, UINT8, 0x800)); } diff --git a/src/mame/drivers/ladybug.c b/src/mame/drivers/ladybug.c index c8dd5a2709c..c144a6ce668 100644 --- a/src/mame/drivers/ladybug.c +++ b/src/mame/drivers/ladybug.c @@ -963,7 +963,7 @@ static DRIVER_INIT( dorodon ) offs_t i; const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); - UINT8 *decrypted = auto_malloc(0x6000); + UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0x6000); UINT8 *rom = memory_region(machine, "maincpu"); UINT8 *table = memory_region(machine, "user1"); diff --git a/src/mame/drivers/laserbas.c b/src/mame/drivers/laserbas.c index 208b9752534..60286fc8e98 100644 --- a/src/mame/drivers/laserbas.c +++ b/src/mame/drivers/laserbas.c @@ -25,8 +25,8 @@ static int vrambank=0; static VIDEO_START(laserbas) { - vram1=auto_malloc(0x8000); - vram2=auto_malloc(0x8000); + vram1=auto_alloc_array(machine, UINT8, 0x8000); + vram2=auto_alloc_array(machine, UINT8, 0x8000); } static VIDEO_UPDATE(laserbas) diff --git a/src/mame/drivers/laserbat.c b/src/mame/drivers/laserbat.c index 246784aeb3e..bb31f037ff9 100644 --- a/src/mame/drivers/laserbat.c +++ b/src/mame/drivers/laserbat.c @@ -508,13 +508,13 @@ static VIDEO_START( laserbat ) bg_tilemap = tilemap_create(machine, get_tile_info,tilemap_scan_rows,8,8,32,32); - videoram = (UINT8 *)auto_malloc(0x400); - colorram = (UINT8 *)auto_malloc(0x400); + videoram = auto_alloc_array(machine, UINT8, 0x400); + colorram = auto_alloc_array(machine, UINT8, 0x400); /* configure the S2636 chips */ - s2636_0 = s2636_config(s2636_0_ram, screen_height, screen_width, 0, -19); - s2636_1 = s2636_config(s2636_1_ram, screen_height, screen_width, 0, -19); - s2636_2 = s2636_config(s2636_2_ram, screen_height, screen_width, 0, -19); + s2636_0 = s2636_config(machine, s2636_0_ram, screen_height, screen_width, 0, -19); + s2636_1 = s2636_config(machine, s2636_1_ram, screen_height, screen_width, 0, -19); + s2636_2 = s2636_config(machine, s2636_2_ram, screen_height, screen_width, 0, -19); } static VIDEO_UPDATE( laserbat ) diff --git a/src/mame/drivers/lastfght.c b/src/mame/drivers/lastfght.c index e48361b1241..3a2df3b989b 100644 --- a/src/mame/drivers/lastfght.c +++ b/src/mame/drivers/lastfght.c @@ -80,7 +80,7 @@ static VIDEO_START( lastfght ) for (i = 0; i < 2; i++) lastfght_bitmap[i] = video_screen_auto_bitmap_alloc(machine->primary_screen); - colorram = auto_malloc(256*3); + colorram = auto_alloc_array(machine, UINT8, 256*3); } diff --git a/src/mame/drivers/legionna.c b/src/mame/drivers/legionna.c index bb1041eef88..961294ef002 100644 --- a/src/mame/drivers/legionna.c +++ b/src/mame/drivers/legionna.c @@ -957,7 +957,7 @@ static void descramble_legionnaire_gfx(UINT8* src) int len = 0x10000; /* rearrange gfx */ - buffer = malloc_or_die(len); + buffer = alloc_array_or_die(UINT8, len); { int i; for (i = 0;i < len; i++) diff --git a/src/mame/drivers/lethal.c b/src/mame/drivers/lethal.c index 52bc050aeff..b62482fe670 100644 --- a/src/mame/drivers/lethal.c +++ b/src/mame/drivers/lethal.c @@ -481,7 +481,7 @@ static READ8_HANDLER(gunsaux_r) } static ADDRESS_MAP_START( le_main, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x1fff) AM_READ(SMH_BANK1) AM_WRITE(SMH_ROM) + AM_RANGE(0x0000, 0x1fff) AM_READ(SMH_BANK(1)) AM_WRITE(SMH_ROM) AM_RANGE(0x2000, 0x3fff) AM_RAM // work RAM AM_RANGE(0x4000, 0x403f) AM_WRITE(K056832_w) AM_RANGE(0x4040, 0x404f) AM_WRITE(K056832_b_w) @@ -497,7 +497,7 @@ static ADDRESS_MAP_START( le_main, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x40dc, 0x40dc) AM_WRITE(le_bankswitch_w) AM_RANGE(0x47fe, 0x47ff) AM_WRITE(le_bgcolor_w) // BG color AM_RANGE(0x4800, 0x7fff) AM_READWRITE(le_4800_r, le_4800_w) AM_BASE(&paletteram) // bankswitched: RAM and registers - AM_RANGE(0x8000, 0xffff) AM_READ(SMH_BANK2) AM_WRITE(SMH_ROM) + AM_RANGE(0x8000, 0xffff) AM_READ(SMH_BANK(2)) AM_WRITE(SMH_ROM) ADDRESS_MAP_END static ADDRESS_MAP_START( le_sound, ADDRESS_SPACE_PROGRAM, 8 ) diff --git a/src/mame/drivers/liberate.c b/src/mame/drivers/liberate.c index 1d86826c720..c30b149db6b 100644 --- a/src/mame/drivers/liberate.c +++ b/src/mame/drivers/liberate.c @@ -79,7 +79,7 @@ static WRITE8_HANDLER( deco16_bank_w ) if (deco16_bank) memory_install_read8_handler(cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0x800f, 0, 0, deco16_io_r); else - memory_install_read8_handler(cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0x800f, 0, 0, SMH_BANK1); + memory_install_read8_handler(cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0x800f, 0, 0, (read8_space_func)SMH_BANK(1)); } /************************************* @@ -92,7 +92,7 @@ static ADDRESS_MAP_START( prosport_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0200, 0x021f) AM_READ(SMH_RAM) AM_RANGE(0x0000, 0x0fff) AM_READ(SMH_RAM) AM_RANGE(0x1000, 0x2fff) AM_READ(SMH_RAM) - AM_RANGE(0x8000, 0x800f) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0x800f) AM_READ(SMH_BANK(1)) AM_RANGE(0x4000, 0xffff) AM_READ(SMH_ROM) ADDRESS_MAP_END @@ -110,7 +110,7 @@ static ADDRESS_MAP_START( liberate_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x0fff) AM_READ(SMH_RAM) AM_RANGE(0x1000, 0x3fff) AM_READ(SMH_ROM) /* Mirror of main rom */ AM_RANGE(0x4000, 0x7fff) AM_READ(deco16_bank_r) - AM_RANGE(0x8000, 0x800f) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0x800f) AM_READ(SMH_BANK(1)) AM_RANGE(0x6200, 0x67ff) AM_READ(SMH_RAM) AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM) ADDRESS_MAP_END @@ -930,7 +930,7 @@ ROM_END static void sound_cpu_decrypt(running_machine *machine) { const address_space *space = cputag_get_address_space(machine, "audiocpu", ADDRESS_SPACE_PROGRAM); - UINT8 *decrypted = auto_malloc(0x4000); + UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0x4000); UINT8 *rom = memory_region(machine, "audiocpu"); int i; @@ -964,7 +964,7 @@ static DRIVER_INIT( liberate ) { int A; const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); - UINT8 *decrypted = auto_malloc(0x10000); + UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0x10000); UINT8 *ROM = memory_region(machine, "maincpu"); memory_set_decrypted_region(space, 0x0000, 0xffff, decrypted); diff --git a/src/mame/drivers/limenko.c b/src/mame/drivers/limenko.c index 05ced387236..64e658b3515 100644 --- a/src/mame/drivers/limenko.c +++ b/src/mame/drivers/limenko.c @@ -432,8 +432,8 @@ static VIDEO_START( limenko ) tilemap_set_transparent_pen(md_tilemap,0); tilemap_set_transparent_pen(fg_tilemap,0); - sprites_bitmap = auto_bitmap_alloc(384,240,BITMAP_FORMAT_INDEXED16); - sprites_bitmap_pri = auto_bitmap_alloc(384,240,BITMAP_FORMAT_INDEXED8); + sprites_bitmap = auto_bitmap_alloc(machine,384,240,BITMAP_FORMAT_INDEXED16); + sprites_bitmap_pri = auto_bitmap_alloc(machine,384,240,BITMAP_FORMAT_INDEXED8); } static VIDEO_UPDATE( limenko ) diff --git a/src/mame/drivers/lsasquad.c b/src/mame/drivers/lsasquad.c index e97a32493e8..663db479d8a 100644 --- a/src/mame/drivers/lsasquad.c +++ b/src/mame/drivers/lsasquad.c @@ -170,7 +170,7 @@ static WRITE8_HANDLER( lsasquad_bankswitch_w ) static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0x9fff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0x9fff) AM_READ(SMH_BANK(1)) AM_RANGE(0xa000, 0xe5ff) AM_READ(SMH_RAM) AM_RANGE(0xe800, 0xe800) AM_READ_PORT("DSWA") AM_RANGE(0xe801, 0xe801) AM_READ_PORT("DSWB") @@ -364,7 +364,7 @@ INPUT_PORTS_END static ADDRESS_MAP_START( mem_daikaiju, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0x9fff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0x9fff) AM_READ(SMH_BANK(1)) AM_RANGE(0xa000, 0xbfff) AM_RAM /* SRAM */ AM_RANGE(0xc000, 0xdfff) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size) /* SCREEN RAM */ AM_RANGE(0xe000, 0xe3ff) AM_RAM AM_BASE(&lsasquad_scrollram) /* SCROLL RAM */ diff --git a/src/mame/drivers/luckgrln.c b/src/mame/drivers/luckgrln.c index cbbb65cbcd7..1f2e3a17d9f 100644 --- a/src/mame/drivers/luckgrln.c +++ b/src/mame/drivers/luckgrln.c @@ -79,7 +79,7 @@ static ADDRESS_MAP_START( mainmap, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x00000, 0x03fff) AM_ROM - AM_RANGE(0x10000, 0x1ffff) AM_READ(SMH_BANK1) + AM_RANGE(0x10000, 0x1ffff) AM_READ(SMH_BANK(1)) AM_RANGE(0x0d800, 0x0dfff) AM_RAM AM_RANGE(0x0f000, 0x0ffff) AM_RAM AM_RANGE(0xf0000, 0xfffff) AM_RAM diff --git a/src/mame/drivers/lwings.c b/src/mame/drivers/lwings.c index 4ba244e731a..7e07b2ba5ed 100644 --- a/src/mame/drivers/lwings.c +++ b/src/mame/drivers/lwings.c @@ -270,7 +270,7 @@ static WRITE8_DEVICE_HANDLER( msm5205_w ) static ADDRESS_MAP_START( avengers_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xc000, 0xf7ff) AM_READ(SMH_RAM) AM_RANGE(0xf808, 0xf808) AM_READ_PORT("SERVICE") AM_RANGE(0xf809, 0xf809) AM_READ_PORT("P1") @@ -302,7 +302,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) /* common to trojan and lwings */ AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xc000, 0xf7ff) AM_READ(SMH_RAM) AM_RANGE(0xf808, 0xf808) AM_READ_PORT("SERVICE") AM_RANGE(0xf809, 0xf809) AM_READ_PORT("P1") diff --git a/src/mame/drivers/m62.c b/src/mame/drivers/m62.c index 9d92735de79..7da0398d7a7 100644 --- a/src/mame/drivers/m62.c +++ b/src/mame/drivers/m62.c @@ -204,7 +204,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( battroad_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0xa000, 0xbfff) AM_READ(SMH_BANK1) + AM_RANGE(0xa000, 0xbfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xc800, 0xefff) AM_READ(SMH_RAM) ADDRESS_MAP_END @@ -242,7 +242,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( ldrun2_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0x9fff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0x9fff) AM_READ(SMH_BANK(1)) AM_RANGE(0xd000, 0xefff) AM_READ(SMH_RAM) ADDRESS_MAP_END @@ -297,7 +297,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( ldrun4_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xd000, 0xefff) AM_READ(SMH_RAM) ADDRESS_MAP_END @@ -335,7 +335,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( kidniki_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0x9fff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0x9fff) AM_READ(SMH_BANK(1)) AM_RANGE(0xa000, 0xafff) AM_READ(SMH_RAM) AM_RANGE(0xd000, 0xefff) AM_READ(SMH_RAM) ADDRESS_MAP_END @@ -363,7 +363,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( spelunkr_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0x9fff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0x9fff) AM_READ(SMH_BANK(1)) AM_RANGE(0xa000, 0xbfff) AM_READ(SMH_RAM) AM_RANGE(0xc800, 0xcfff) AM_READ(SMH_RAM) AM_RANGE(0xe000, 0xefff) AM_READ(SMH_RAM) @@ -386,8 +386,8 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( spelunk2_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0x8fff) AM_READ(SMH_BANK1) - AM_RANGE(0x9000, 0x9fff) AM_READ(SMH_BANK2) + AM_RANGE(0x8000, 0x8fff) AM_READ(SMH_BANK(1)) + AM_RANGE(0x9000, 0x9fff) AM_READ(SMH_BANK(2)) AM_RANGE(0xa000, 0xbfff) AM_READ(SMH_RAM) AM_RANGE(0xc800, 0xcfff) AM_READ(SMH_RAM) AM_RANGE(0xe000, 0xefff) AM_READ(SMH_RAM) @@ -408,7 +408,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( youjyudn_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xc800, 0xcfff) AM_READ(SMH_RAM) AM_RANGE(0xd000, 0xd7ff) AM_READ(SMH_RAM) AM_RANGE(0xe000, 0xefff) AM_READ(SMH_RAM) diff --git a/src/mame/drivers/m72.c b/src/mame/drivers/m72.c index cebbfb9fb0d..49c43b808db 100644 --- a/src/mame/drivers/m72.c +++ b/src/mame/drivers/m72.c @@ -327,8 +327,8 @@ INLINE DRIVER_INIT( loht_mcu ) const address_space *sndio = cputag_get_address_space(machine, "soundcpu", ADDRESS_SPACE_IO); const device_config *dac = devtag_get_device(machine, "dac"); - protection_ram = auto_malloc(0x10000); - memory_install_read16_handler(program, 0xb0000, 0xbffff, 0, 0, SMH_BANK1); + protection_ram = auto_alloc_array(machine, UINT16, 0x10000/2); + memory_install_read16_handler(program, 0xb0000, 0xbffff, 0, 0, (read16_space_func)SMH_BANK(1)); memory_install_write16_handler(program, 0xb0000, 0xb0fff, 0, 0, m72_main_mcu_w); memory_set_bankptr(machine, 1, protection_ram); @@ -697,10 +697,10 @@ static WRITE16_HANDLER( protection_w ) static void install_protection_handler(running_machine *machine, const UINT8 *code,const UINT8 *crc) { - protection_ram = auto_malloc(0x1000); + protection_ram = auto_alloc_array(machine, UINT16, 0x1000/2); protection_code = code; protection_crc = crc; - memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xb0000, 0xb0fff, 0, 0, SMH_BANK1); + memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xb0000, 0xb0fff, 0, 0, (read16_space_func)SMH_BANK(1)); memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xb0ffa, 0xb0ffb, 0, 0, protection_r); memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xb0000, 0xb0fff, 0, 0, protection_w); memory_set_bankptr(machine, 1, protection_ram); diff --git a/src/mame/drivers/m92.c b/src/mame/drivers/m92.c index 37cd97c2762..d587a63fdfe 100644 --- a/src/mame/drivers/m92.c +++ b/src/mame/drivers/m92.c @@ -2051,7 +2051,7 @@ static DRIVER_INIT( lethalth ) m92_irq_vectorbase=0x20; /* NOP out the bankswitcher */ - memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x20, 0x21, 0, 0, SMH_NOP); + memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x20, 0x21, 0, 0, (write16_space_func)SMH_NOP); } static DRIVER_INIT( nbbatman ) diff --git a/src/mame/drivers/macs.c b/src/mame/drivers/macs.c index cdda53bedd1..211d80fb052 100644 --- a/src/mame/drivers/macs.c +++ b/src/mame/drivers/macs.c @@ -590,19 +590,19 @@ static MACHINE_RESET(macs) static DRIVER_INIT(macs) { - macs_ram1=auto_malloc(0x20000); + macs_ram1=auto_alloc_array(machine, UINT8, 0x20000); st0016_game=10|0x80; } static DRIVER_INIT(kisekaeh) { - macs_ram1=auto_malloc(0x20000); + macs_ram1=auto_alloc_array(machine, UINT8, 0x20000); st0016_game=11|0x180; } static DRIVER_INIT(kisekaem) { - macs_ram1=auto_malloc(0x20000); + macs_ram1=auto_alloc_array(machine, UINT8, 0x20000); st0016_game=10|0x180; } diff --git a/src/mame/drivers/mainevt.c b/src/mame/drivers/mainevt.c index 6a906ded542..2f2e48ec6e9 100644 --- a/src/mame/drivers/mainevt.c +++ b/src/mame/drivers/mainevt.c @@ -153,7 +153,7 @@ static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_READ(K052109_051960_r) AM_RANGE(0x4000, 0x5fff) AM_READ(SMH_RAM) - AM_RANGE(0x6000, 0x7fff) AM_READ(SMH_BANK1) + AM_RANGE(0x6000, 0x7fff) AM_READ(SMH_BANK(1)) AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM) ADDRESS_MAP_END @@ -182,7 +182,7 @@ static ADDRESS_MAP_START( dv_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_READ(K052109_051960_r) AM_RANGE(0x4000, 0x5fff) AM_READ(SMH_RAM) - AM_RANGE(0x6000, 0x7fff) AM_READ(SMH_BANK1) + AM_RANGE(0x6000, 0x7fff) AM_READ(SMH_BANK(1)) AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM) ADDRESS_MAP_END diff --git a/src/mame/drivers/mappy.c b/src/mame/drivers/mappy.c index cbc323c00a9..e73073d4f3f 100644 --- a/src/mame/drivers/mappy.c +++ b/src/mame/drivers/mappy.c @@ -2141,7 +2141,7 @@ static DRIVER_INIT( grobda ) static DRIVER_INIT( digdug2 ) { /* appears to not use the watchdog */ - memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0x8000, 0, 0, SMH_NOP); + memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0x8000, 0, 0, (write8_space_func)SMH_NOP); DRIVER_INIT_CALL(58_56); } diff --git a/src/mame/drivers/marinedt.c b/src/mame/drivers/marinedt.c index 1d903d0eafd..c8eeb55248c 100644 --- a/src/mame/drivers/marinedt.c +++ b/src/mame/drivers/marinedt.c @@ -448,9 +448,9 @@ static VIDEO_START( marinedt ) tilemap_set_scrolldx(tx_tilemap, 0, 4*8); tilemap_set_scrolldy(tx_tilemap, 0, -4*8); - tile = auto_bitmap_alloc(32 * 8, 32 * 8, video_screen_get_format(machine->primary_screen)); - obj1 = auto_bitmap_alloc(32,32,video_screen_get_format(machine->primary_screen)); - obj2 = auto_bitmap_alloc(32,32,video_screen_get_format(machine->primary_screen)); + tile = auto_bitmap_alloc(machine,32 * 8, 32 * 8, video_screen_get_format(machine->primary_screen)); + obj1 = auto_bitmap_alloc(machine,32,32,video_screen_get_format(machine->primary_screen)); + obj2 = auto_bitmap_alloc(machine,32,32,video_screen_get_format(machine->primary_screen)); } diff --git a/src/mame/drivers/maygayv1.c b/src/mame/drivers/maygayv1.c index c39bb7d2b21..ce5c8568d17 100644 --- a/src/mame/drivers/maygayv1.c +++ b/src/mame/drivers/maygayv1.c @@ -962,8 +962,8 @@ static const pia6821_interface pia_intf = static MACHINE_START( maygayv1 ) { - i82716.dram = auto_malloc(0x80000); // ??? - i82716.line_buf = auto_malloc(512); + i82716.dram = auto_alloc_array(machine, UINT16, 0x80000/2); // ??? + i82716.line_buf = auto_alloc_array(machine, UINT8, 512); state_save_register_global_pointer(machine, i82716.dram, 0x40000); diff --git a/src/mame/drivers/mayumi.c b/src/mame/drivers/mayumi.c index d09e02b7bb3..9db1769aa56 100644 --- a/src/mame/drivers/mayumi.c +++ b/src/mame/drivers/mayumi.c @@ -77,7 +77,7 @@ static READ8_HANDLER( key_matrix_r ) static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_RAM) AM_RANGE(0xe000, 0xf7ff) AM_READ(mayumi_videoram_r) ADDRESS_MAP_END diff --git a/src/mame/drivers/mazerbla.c b/src/mame/drivers/mazerbla.c index 69ab18082cb..0af45d8560e 100644 --- a/src/mame/drivers/mazerbla.c +++ b/src/mame/drivers/mazerbla.c @@ -1031,7 +1031,7 @@ UINT8 * rom = memory_region(space->machine, "sub2") + (gfx_rom_bank * 0x2000) + static ADDRESS_MAP_START( readmem_cpu3, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x37ff) AM_READ(SMH_ROM) AM_RANGE(0x3800, 0x3fff) AM_READ(sharedram_CFB_ZPU_r) - AM_RANGE(0x4000, 0x5fff) AM_READ(SMH_BANK1) /* GFX roms */ + AM_RANGE(0x4000, 0x5fff) AM_READ(SMH_BANK(1)) /* GFX roms */ AM_RANGE(0x6000, 0x67ff) AM_READ(cfb_ram_r) /* RAM for VCU commands and parameters */ AM_RANGE(0xa000, 0xa7ff) AM_READ(VCU_set_cmd_param_r) /* VCU command and parameters LOAD */ diff --git a/src/mame/drivers/mediagx.c b/src/mame/drivers/mediagx.c index 83590efaaad..238258a0e3f 100644 --- a/src/mame/drivers/mediagx.c +++ b/src/mame/drivers/mediagx.c @@ -960,8 +960,8 @@ static MACHINE_RESET(mediagx) memcpy(bios_ram, rom, 0x40000); device_reset(machine->cpu[0]); - dacl = auto_malloc(65536 * sizeof(INT16)); - dacr = auto_malloc(65536 * sizeof(INT16)); + dacl = auto_alloc_array(machine, INT16, 65536); + dacr = auto_alloc_array(machine, INT16, 65536); sound_timer = timer_alloc(machine, sound_timer_callback, NULL); timer_adjust_oneshot(sound_timer, ATTOTIME_IN_MSEC(10), 0); diff --git a/src/mame/drivers/megadriv.c b/src/mame/drivers/megadriv.c index e75589321ba..20e197f6b35 100644 --- a/src/mame/drivers/megadriv.c +++ b/src/mame/drivers/megadriv.c @@ -2494,7 +2494,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( z80_readmem, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000 , 0x1fff) AM_READ(SMH_BANK1) AM_MIRROR(0x2000) // RAM can be accessed by the 68k + AM_RANGE(0x0000 , 0x1fff) AM_READ(SMH_BANK(1)) AM_MIRROR(0x2000) // RAM can be accessed by the 68k AM_RANGE(0x4000 , 0x4003) AM_DEVREAD("ym", ym2612_r) AM_RANGE(0x6100 , 0x7eff) AM_READ(megadriv_z80_unmapped_read) @@ -2505,7 +2505,7 @@ static ADDRESS_MAP_START( z80_readmem, ADDRESS_SPACE_PROGRAM, 8 ) ADDRESS_MAP_END static ADDRESS_MAP_START( z80_writemem, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000 , 0x1fff) AM_WRITE(SMH_BANK1) AM_MIRROR(0x2000) + AM_RANGE(0x0000 , 0x1fff) AM_WRITE(SMH_BANK(1)) AM_MIRROR(0x2000) AM_RANGE(0x4000 , 0x4003) AM_DEVWRITE("ym", ym2612_w) AM_RANGE(0x7f00 , 0x7fff) AM_WRITE(megadriv_z80_vdp_write) @@ -2698,13 +2698,13 @@ static WRITE16_HANDLER( _32x_68k_a15100_w ) if (data & 0x01) { _32x_adapter_enabled = 1; - memory_install_readwrite16_handler(space, 0x0880000, 0x08fffff, 0, 0, SMH_BANK11, SMH_BANK11); // 'fixed' 512kb rom bank + memory_install_readwrite16_handler(space, 0x0880000, 0x08fffff, 0, 0, (read16_space_func)SMH_BANK(11), (write16_space_func)SMH_BANK(11)); // 'fixed' 512kb rom bank memory_set_bankptr(space->machine, 11, memory_region(space->machine, "gamecart") ); - memory_install_readwrite16_handler(space, 0x0900000, 0x09fffff, 0, 0, SMH_BANK12, SMH_BANK12); // 'bankable' 1024kb rom bank + memory_install_readwrite16_handler(space, 0x0900000, 0x09fffff, 0, 0, (read16_space_func)SMH_BANK(12), (write16_space_func)SMH_BANK(12)); // 'bankable' 1024kb rom bank memory_set_bankptr(space->machine, 12, memory_region(space->machine, "gamecart") ); - memory_install_readwrite16_handler(space, 0x0000000, 0x03fffff, 0, 0, SMH_BANK10, SMH_BANK10); + memory_install_readwrite16_handler(space, 0x0000000, 0x03fffff, 0, 0, (read16_space_func)SMH_BANK(10), (write16_space_func)SMH_BANK(10)); memory_set_bankptr(space->machine, 10, memory_region(space->machine, "32x_68k_bios") ); memory_install_readwrite16_handler(space, 0x0a15180, 0x0a15181, 0, 0, _32x_68k_a15180_r, _32x_68k_a15180_w); // mode control regs @@ -2727,7 +2727,7 @@ static WRITE16_HANDLER( _32x_68k_a15100_w ) { _32x_adapter_enabled = 0; - memory_install_readwrite16_handler(space, 0x0000000, 0x03fffff, 0, 0, SMH_BANK10, SMH_BANK10); + memory_install_readwrite16_handler(space, 0x0000000, 0x03fffff, 0, 0, (read16_space_func)SMH_BANK(10), (write16_space_func)SMH_BANK(10)); memory_set_bankptr(space->machine, 10, memory_region(space->machine, "gamecart") ); @@ -3824,8 +3824,8 @@ static READ16_HANDLER( svp_68k_cell2_r ) } static ADDRESS_MAP_START( svp_ssp_map, ADDRESS_SPACE_PROGRAM, 16 ) - AM_RANGE(0x0000 , 0x03ff) AM_READ(SMH_BANK3) - AM_RANGE(0x0400 , 0xffff) AM_READ(SMH_BANK4) + AM_RANGE(0x0000 , 0x03ff) AM_READ(SMH_BANK(3)) + AM_RANGE(0x0400 , 0xffff) AM_READ(SMH_BANK(4)) ADDRESS_MAP_END static ADDRESS_MAP_START( svp_ext_map, ADDRESS_SPACE_IO, 16 ) @@ -3892,8 +3892,8 @@ static void svp_init(running_machine *machine) memset(&svp, 0, sizeof(svp)); /* SVP stuff */ - svp.dram = auto_malloc(0x20000); - memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x300000, 0x31ffff, 0, 0, SMH_BANK2, SMH_BANK2); + svp.dram = auto_alloc_array(machine, UINT8, 0x20000); + memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x300000, 0x31ffff, 0, 0, (read16_space_func)SMH_BANK(2), (write16_space_func)SMH_BANK(2)); memory_set_bankptr(machine, 2, svp.dram ); memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa15000, 0xa150ff, 0, 0, svp_68k_io_r, svp_68k_io_w); // "cell arrange" 1 and 2 @@ -3902,7 +3902,7 @@ static void svp_init(running_machine *machine) memory_install_read16_handler(cpu_get_address_space(machine->cpu[2], ADDRESS_SPACE_PROGRAM), 0x438, 0x438, 0, 0, svp_speedup_r); - svp.iram = auto_malloc(0x800); + svp.iram = auto_alloc_array(machine, UINT8, 0x800); memory_set_bankptr(machine, 3, svp.iram ); /* SVP ROM just shares m68k region.. */ ROM = memory_region(machine, "maincpu"); @@ -3953,10 +3953,10 @@ VIDEO_START(megadriv) render_bitmap = video_screen_auto_bitmap_alloc(machine->primary_screen); - megadrive_vdp_vram = auto_malloc(0x10000); - megadrive_vdp_cram = auto_malloc(0x80); - megadrive_vdp_vsram = auto_malloc(0x80); - megadrive_vdp_internal_sprite_attribute_table = auto_malloc(0x400); + megadrive_vdp_vram = auto_alloc_array(machine, UINT16, 0x10000/2); + megadrive_vdp_cram = auto_alloc_array(machine, UINT16, 0x80/2); + megadrive_vdp_vsram = auto_alloc_array(machine, UINT16, 0x80/2); + megadrive_vdp_internal_sprite_attribute_table = auto_alloc_array(machine, UINT16, 0x400/2); for (x=0;x<0x20;x++) megadrive_vdp_register[x]=0; @@ -3971,15 +3971,15 @@ VIDEO_START(megadriv) megadrive_max_hposition = 480; - sprite_renderline = auto_malloc(1024); - highpri_renderline = auto_malloc(320); - video_renderline = auto_malloc(320*4); + sprite_renderline = auto_alloc_array(machine, UINT8, 1024); + highpri_renderline = auto_alloc_array(machine, UINT8, 320); + video_renderline = auto_alloc_array(machine, UINT32, 320); - megadrive_vdp_palette_lookup = auto_malloc(0x40*2); - megadrive_vdp_palette_lookup_sprite = auto_malloc(0x40*2); + megadrive_vdp_palette_lookup = auto_alloc_array(machine, UINT16, 0x40); + megadrive_vdp_palette_lookup_sprite = auto_alloc_array(machine, UINT16, 0x40); - megadrive_vdp_palette_lookup_shadow = auto_malloc(0x40*2); - megadrive_vdp_palette_lookup_highlight = auto_malloc(0x40*2); + megadrive_vdp_palette_lookup_shadow = auto_alloc_array(machine, UINT16, 0x40); + megadrive_vdp_palette_lookup_highlight = auto_alloc_array(machine, UINT16, 0x40); memset(megadrive_vdp_palette_lookup,0x00,0x40*2); memset(megadrive_vdp_palette_lookup_sprite,0x00,0x40*2); @@ -6436,7 +6436,7 @@ static void megadriv_init_common(running_machine *machine) if (genesis_has_z80) { genz80.z80_cpunum = 1; - genz80.z80_prgram = auto_malloc(0x2000); + genz80.z80_prgram = auto_alloc_array(machine, UINT8, 0x2000); memory_set_bankptr(machine, 1, genz80.z80_prgram ); } @@ -6576,15 +6576,15 @@ void megatech_set_megadrive_z80_as_megadrive_z80(running_machine *machine) memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x0000, 0xffff, 0, 0, z80_unmapped_r, z80_unmapped_w); - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x0000, 0x1fff, 0, 0, SMH_BANK1, SMH_BANK1); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x0000, 0x1fff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_BANK(1)); memory_set_bankptr(machine, 1, genz80.z80_prgram ); - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x0000, 0x1fff, 0, 0, SMH_BANK6, SMH_BANK6); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x0000, 0x1fff, 0, 0, (read8_space_func)SMH_BANK(6), (write8_space_func)SMH_BANK(6)); memory_set_bankptr(machine, 6, genz80.z80_prgram ); // not allowed?? -// memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x2000, 0x3fff, 0, 0, SMH_BANK1, SMH_BANK1); +// memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x2000, 0x3fff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_BANK(1)); memory_install_readwrite8_device_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), ym, 0x4000, 0x4003, 0, 0, ym2612_r, ym2612_w); memory_install_write8_handler (cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x6000, 0x6000, 0, 0, megadriv_z80_z80_bank_w); @@ -6603,14 +6603,14 @@ DRIVER_INIT( _32x ) { - _32x_dram0 = auto_malloc(0x40000); - _32x_dram1 = auto_malloc(0x40000); + _32x_dram0 = auto_alloc_array(machine, UINT16, 0x40000/2); + _32x_dram1 = auto_alloc_array(machine, UINT16, 0x40000/2); memset(_32x_dram0, 0x00, 0x40000); memset(_32x_dram1, 0x00, 0x40000); - _32x_palette = auto_malloc(0x200); - _32x_palette_lookup = auto_malloc(0x200); + _32x_palette = auto_alloc_array(machine, UINT16, 0x200/2); + _32x_palette_lookup = auto_alloc_array(machine, UINT16, 0x200/2); memset(_32x_palette, 0x00, 0x200); memset(_32x_palette_lookup, 0x00, 0x200); @@ -6623,7 +6623,7 @@ DRIVER_INIT( _32x ) if (_32x_adapter_enabled == 0) { - memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000000, 0x03fffff, 0, 0, SMH_BANK10, SMH_BANK10); + memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000000, 0x03fffff, 0, 0, (read16_space_func)SMH_BANK(10), (write16_space_func)SMH_BANK(10)); memory_set_bankptr(machine, 10, memory_region(machine, "gamecart") ); }; diff --git a/src/mame/drivers/megaplay.c b/src/mame/drivers/megaplay.c index 9721ae05b40..d53f5278c15 100644 --- a/src/mame/drivers/megaplay.c +++ b/src/mame/drivers/megaplay.c @@ -992,9 +992,9 @@ static WRITE16_HANDLER( megadriv_68k_write_z80_extra_ram ) static DRIVER_INIT (megaplay) { /* to support the old code.. */ - ic36_ram = auto_malloc(0x10000); - ic37_ram = auto_malloc(0x10000); - genesis_io_ram = auto_malloc(0x20); + ic36_ram = auto_alloc_array(machine, UINT16, 0x10000/2); + ic37_ram = auto_alloc_array(machine, UINT8, 0x10000); + genesis_io_ram = auto_alloc_array(machine, UINT16, 0x20/2); DRIVER_INIT_CALL(megadrij); megplay_stat(machine); @@ -1003,7 +1003,7 @@ static DRIVER_INIT (megaplay) memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa10000, 0xa1001f, 0, 0, OLD_megaplay_genesis_io_r, OLD_megaplay_genesis_io_w); /* megaplay has ram shared with the bios cpu here */ - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x2000, 0x3fff, 0, 0, SMH_BANK7, SMH_BANK7); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x2000, 0x3fff, 0, 0, (read8_space_func)SMH_BANK(7), (write8_space_func)SMH_BANK(7)); memory_set_bankptr(machine, 7, &ic36_ram[0]); /* instead of a RAM mirror the 68k sees the extra ram of the 2nd z80 too */ diff --git a/src/mame/drivers/megasys1.c b/src/mame/drivers/megasys1.c index 3800682673d..9407152b460 100644 --- a/src/mame/drivers/megasys1.c +++ b/src/mame/drivers/megasys1.c @@ -3663,7 +3663,7 @@ static void rodlandj_gfx_unmangle(running_machine *machine, const char *region) | ((rom[i] & 0x48) << 1) | ((rom[i] & 0x10) << 2); - buffer = malloc_or_die(size); + buffer = alloc_array_or_die(UINT8, size); memcpy(buffer,rom,size); @@ -3692,7 +3692,7 @@ static void jitsupro_gfx_unmangle(running_machine *machine, const char *region) for (i = 0;i < size;i++) rom[i] = BITSWAP8(rom[i],0x4,0x3,0x5,0x7,0x6,0x2,0x1,0x0); - buffer = malloc_or_die(size); + buffer = alloc_array_or_die(UINT8, size); memcpy(buffer,rom,size); diff --git a/src/mame/drivers/megatech.c b/src/mame/drivers/megatech.c index cc70e2bb86e..577ac0f0ea8 100644 --- a/src/mame/drivers/megatech.c +++ b/src/mame/drivers/megatech.c @@ -273,7 +273,7 @@ static WRITE8_HANDLER( mt_sms_standard_rom_bank_w ) { case 0: logerror("bank w %02x %02x\n", offset, data); - memory_install_readwrite8_handler(space, 0x0000, 0xbfff, 0, 0, SMH_BANK5, SMH_UNMAP); + memory_install_readwrite8_handler(space, 0x0000, 0xbfff, 0, 0, (read8_space_func)SMH_BANK(5), (write8_space_func)SMH_UNMAP); //printf("bank ram??\n"); break; @@ -334,17 +334,17 @@ static void megatech_set_genz80_as_sms_standard_map(running_machine *machine) memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x0000, 0xffff, 0, 0, z80_unmapped_r, z80_unmapped_w); /* fixed rom bank area */ - sms_rom = auto_malloc(0x400000); - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x0000, 0xbfff, 0, 0, SMH_BANK5, SMH_UNMAP); + sms_rom = auto_alloc_array(machine, UINT8, 0x400000); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x0000, 0xbfff, 0, 0, (read8_space_func)SMH_BANK(5), (write8_space_func)SMH_UNMAP); memory_set_bankptr(machine, 5, sms_rom ); memcpy(sms_rom, memory_region(machine, "maincpu"), 0x400000); /* main ram area */ - sms_mainram = auto_malloc(0x2000); // 8kb of main ram - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xc000, 0xdfff, 0, 0, SMH_BANK6, SMH_BANK6); + sms_mainram = auto_alloc_array(machine, UINT8, 0x2000); // 8kb of main ram + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xc000, 0xdfff, 0, 0, (read8_space_func)SMH_BANK(6), (write8_space_func)SMH_BANK(6)); memory_set_bankptr(machine, 6, sms_mainram ); - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xe000, 0xffff, 0, 0, SMH_BANK7, SMH_BANK7); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xe000, 0xffff, 0, 0, (read8_space_func)SMH_BANK(7), (write8_space_func)SMH_BANK(7)); memory_set_bankptr(machine, 7, sms_mainram ); memset(sms_mainram,0x00,0x2000); @@ -574,7 +574,7 @@ ADDRESS_MAP_END static DRIVER_INIT(mtnew) { - megatech_banked_ram = auto_malloc(0x1000*8); + megatech_banked_ram = auto_alloc_array(machine, UINT8, 0x1000*8); DRIVER_INIT_CALL(megadriv); DRIVER_INIT_CALL(megatech_bios); } diff --git a/src/mame/drivers/merit.c b/src/mame/drivers/merit.c index 1fe48f409c9..3460d95d3e3 100644 --- a/src/mame/drivers/merit.c +++ b/src/mame/drivers/merit.c @@ -70,7 +70,7 @@ static UINT8 *backup_ram; static MACHINE_START(merit) { question_address = 0; - ram_palette = auto_malloc(RAM_PALETTE_SIZE); + ram_palette = auto_alloc_array(machine, UINT8, RAM_PALETTE_SIZE); state_save_register_global_pointer(machine, ram_palette, RAM_PALETTE_SIZE); state_save_register_global(machine, lscnblk); diff --git a/src/mame/drivers/meritm.c b/src/mame/drivers/meritm.c index 3cf3c87c1a2..b88ba475a41 100644 --- a/src/mame/drivers/meritm.c +++ b/src/mame/drivers/meritm.c @@ -848,7 +848,7 @@ static MACHINE_START(meritm_crt250_questions) static MACHINE_START(meritm_crt260) { - meritm_ram = auto_malloc( 0x8000 ); + meritm_ram = auto_alloc_array(machine, UINT8, 0x8000 ); memset( meritm_ram, 0x8000, 0x00 ); memory_configure_bank(machine, 1, 0, 128, memory_region(machine, "maincpu"), 0x8000); memory_configure_bank(machine, 2, 0, 128, memory_region(machine, "maincpu"), 0x8000); diff --git a/src/mame/drivers/metlclsh.c b/src/mame/drivers/metlclsh.c index 2730d13ca0d..24137fa6128 100644 --- a/src/mame/drivers/metlclsh.c +++ b/src/mame/drivers/metlclsh.c @@ -138,7 +138,7 @@ static ADDRESS_MAP_START( metlclsh_readmem2, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0xc001, 0xc001) AM_READ_PORT("IN1") AM_RANGE(0xc002, 0xc002) AM_READ_PORT("IN2") AM_RANGE(0xc003, 0xc003) AM_READ_PORT("DSW") - AM_RANGE(0xd000, 0xd7ff) AM_READ(SMH_BANK1 ) + AM_RANGE(0xd000, 0xd7ff) AM_READ(SMH_BANK(1) ) AM_RANGE(0xfff0, 0xffff) AM_READ(SMH_ROM ) // Reset/IRQ vectors ADDRESS_MAP_END diff --git a/src/mame/drivers/metro.c b/src/mame/drivers/metro.c index 2c40fdb7a48..00a84582189 100644 --- a/src/mame/drivers/metro.c +++ b/src/mame/drivers/metro.c @@ -810,14 +810,14 @@ static WRITE16_HANDLER( metro_blitter_w ) static ADDRESS_MAP_START( metro_snd_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_ROM) /* External ROM */ - AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK1) /* External ROM (Banked) */ + AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK(1)) /* External ROM (Banked) */ AM_RANGE(0x8000, 0x87ff) AM_READ(SMH_RAM) /* External RAM */ AM_RANGE(0xff00, 0xffff) AM_READ(SMH_RAM) /* Internal RAM */ ADDRESS_MAP_END static ADDRESS_MAP_START( metro_snd_writemem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_WRITE(SMH_ROM) /* External ROM */ - AM_RANGE(0x4000, 0x7fff) AM_WRITE(SMH_BANK1) /* External ROM (Banked) */ + AM_RANGE(0x4000, 0x7fff) AM_WRITE(SMH_BANK(1)) /* External ROM (Banked) */ AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM) /* External RAM */ AM_RANGE(0xff00, 0xffff) AM_WRITE(SMH_RAM) /* Internal RAM */ ADDRESS_MAP_END @@ -836,14 +836,14 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( daitorid_snd_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_ROM) /* External ROM */ - AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK1) /* External ROM (Banked) */ + AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK(1)) /* External ROM (Banked) */ AM_RANGE(0x8000, 0x87ff) AM_READ(SMH_RAM) /* External RAM */ AM_RANGE(0xff00, 0xffff) AM_READ(SMH_RAM) /* Internal RAM */ ADDRESS_MAP_END static ADDRESS_MAP_START( daitorid_snd_writemem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_WRITE(SMH_ROM) /* External ROM */ - AM_RANGE(0x4000, 0x7fff) AM_WRITE(SMH_BANK1) /* External ROM (Banked) */ + AM_RANGE(0x4000, 0x7fff) AM_WRITE(SMH_BANK(1)) /* External ROM (Banked) */ AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM) /* External RAM */ AM_RANGE(0xff00, 0xffff) AM_WRITE(SMH_RAM) /* Internal RAM */ ADDRESS_MAP_END @@ -1952,7 +1952,7 @@ static const ym2610_interface blzntrnd_ym2610_interface = static ADDRESS_MAP_START( blzntrnd_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xe000, 0xffff) AM_READ(SMH_RAM) ADDRESS_MAP_END @@ -4730,7 +4730,7 @@ static DRIVER_INIT( metro ) static DRIVER_INIT( karatour ) { - UINT16 *RAM = (UINT16 *)auto_malloc(0x20000*3); + UINT16 *RAM = auto_alloc_array(machine, UINT16, 0x20000*3/2); int i; metro_vram_0 = RAM + (0x20000/2) * 0; metro_vram_1 = RAM + (0x20000/2) * 1; diff --git a/src/mame/drivers/mexico86.c b/src/mame/drivers/mexico86.c index 8f71d6d530c..8ccc3083c6c 100644 --- a/src/mame/drivers/mexico86.c +++ b/src/mame/drivers/mexico86.c @@ -77,7 +77,7 @@ static WRITE8_HANDLER( shared_w ) static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) /* banked roms */ + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) /* banked roms */ AM_RANGE(0xc000, 0xe7ff) AM_READ(shared_r) /* shared with sound cpu */ AM_RANGE(0xe800, 0xe8ff) AM_READ(SMH_RAM) /* protection ram */ AM_RANGE(0xe900, 0xefff) AM_READ(SMH_RAM) diff --git a/src/mame/drivers/mitchell.c b/src/mame/drivers/mitchell.c index 6618c9f1d80..c9a40276c6f 100644 --- a/src/mame/drivers/mitchell.c +++ b/src/mame/drivers/mitchell.c @@ -350,7 +350,7 @@ logerror("PC %04x: write %02x to port 01\n",cpu_get_pc(space->cpu),data); static ADDRESS_MAP_START( mgakuen_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xc000, 0xc7ff) AM_READ(mgakuen_paletteram_r) /* palette RAM */ AM_RANGE(0xc800, 0xcfff) AM_READ(pang_colorram_r) /* Attribute RAM */ AM_RANGE(0xd000, 0xdfff) AM_READ(mgakuen_videoram_r) /* char RAM */ @@ -369,7 +369,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xc000, 0xc7ff) AM_READ(pang_paletteram_r) /* Banked palette RAM */ AM_RANGE(0xc800, 0xcfff) AM_READ(pang_colorram_r) /* Attribute RAM */ AM_RANGE(0xd000, 0xdfff) AM_READ(pang_videoram_r) /* Banked char / OBJ RAM */ @@ -405,7 +405,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( spangb_memmap, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0xbfff) AM_READWRITE(SMH_BANK1, SMH_NOP) + AM_RANGE(0x8000, 0xbfff) AM_READWRITE(SMH_BANK(1), SMH_NOP) AM_RANGE(0xc000, 0xc7ff) AM_READWRITE(pang_paletteram_r, pang_paletteram_w) /* Banked palette RAM */ AM_RANGE(0xc800, 0xcfff) AM_READWRITE(pang_colorram_r, pang_colorram_w) AM_BASE(&pang_colorram)/* Attribute RAM */ AM_RANGE(0xd000, 0xdfff) AM_READWRITE(pang_videoram_r, pang_videoram_w) AM_BASE(&pang_videoram) AM_SIZE(&pang_videoram_size) /* Banked char / OBJ RAM */ @@ -2151,7 +2151,7 @@ static DRIVER_INIT( mstworld ) { /* descramble the program rom .. */ int len = memory_region_length(machine, "maincpu"); - UINT8* source = malloc_or_die(len); + UINT8* source = alloc_array_or_die(UINT8, len); UINT8* dst = memory_region(machine, "maincpu") ; int x; diff --git a/src/mame/drivers/mjkjidai.c b/src/mame/drivers/mjkjidai.c index 5dbe516f0b6..7e9d2885fd9 100644 --- a/src/mame/drivers/mjkjidai.c +++ b/src/mame/drivers/mjkjidai.c @@ -173,7 +173,7 @@ static NVRAM_HANDLER( mjkjidai ) static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_RAM) AM_RANGE(0xe000, 0xf7ff) AM_READ(SMH_RAM) ADDRESS_MAP_END diff --git a/src/mame/drivers/mjsister.c b/src/mame/drivers/mjsister.c index 86701158ecc..5f6c5a0d594 100644 --- a/src/mame/drivers/mjsister.c +++ b/src/mame/drivers/mjsister.c @@ -154,7 +154,7 @@ static READ8_HANDLER( mjsister_keys_r ) static ADDRESS_MAP_START( mjsister_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x77ff) AM_READ(SMH_ROM) AM_RANGE(0x7800, 0x7fff) AM_READ(SMH_RAM) - AM_RANGE(0x8000, 0xffff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xffff) AM_READ(SMH_BANK(1)) ADDRESS_MAP_END static ADDRESS_MAP_START( mjsister_writemem, ADDRESS_SPACE_PROGRAM, 8 ) diff --git a/src/mame/drivers/mlanding.c b/src/mame/drivers/mlanding.c index edbc2ea2a31..799c109325d 100644 --- a/src/mame/drivers/mlanding.c +++ b/src/mame/drivers/mlanding.c @@ -155,7 +155,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( mlanding_z80_mem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_ROM - AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK1) + AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK(1)) AM_RANGE(0x8000, 0x8fff) AM_RAM AM_RANGE(0x9000, 0x9001) AM_DEVREADWRITE("ym", ym2151_r, ym2151_w) AM_RANGE(0x9002, 0x9100) AM_READ(SMH_RAM) diff --git a/src/mame/drivers/model1.c b/src/mame/drivers/model1.c index d46ae6d5d38..5d93b6968eb 100644 --- a/src/mame/drivers/model1.c +++ b/src/mame/drivers/model1.c @@ -758,7 +758,7 @@ static MACHINE_RESET(model1_vr) { memory_set_bankptr(machine, 1, memory_region(machine, "maincpu") + 0x1000000); irq_init(machine); - model1_vr_tgp_reset(); + model1_vr_tgp_reset(machine); model1_sound_irq = 3; // init the sound FIFO diff --git a/src/mame/drivers/model2.c b/src/mame/drivers/model2.c index 0ee58998469..9d6dffde52a 100644 --- a/src/mame/drivers/model2.c +++ b/src/mame/drivers/model2.c @@ -1713,8 +1713,8 @@ static ADDRESS_MAP_START( model2_snd, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0x400000, 0x400001) AM_WRITE(model2snd_ctrl) AM_RANGE(0x600000, 0x67ffff) AM_ROM AM_REGION("audiocpu", 0x80000) AM_RANGE(0x800000, 0x9fffff) AM_ROM AM_REGION("scsp", 0) - AM_RANGE(0xa00000, 0xdfffff) AM_READ(SMH_BANK4) - AM_RANGE(0xe00000, 0xffffff) AM_READ(SMH_BANK5) + AM_RANGE(0xa00000, 0xdfffff) AM_READ(SMH_BANK(4)) + AM_RANGE(0xe00000, 0xffffff) AM_READ(SMH_BANK(5)) ADDRESS_MAP_END static int scsp_last_line = 0; diff --git a/src/mame/drivers/model3.c b/src/mame/drivers/model3.c index 7017b1433e1..55c7f65c547 100644 --- a/src/mame/drivers/model3.c +++ b/src/mame/drivers/model3.c @@ -4298,8 +4298,8 @@ static ADDRESS_MAP_START( model3_snd, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0x400000, 0x400001) AM_WRITE(model3snd_ctrl) AM_RANGE(0x600000, 0x67ffff) AM_ROM AM_REGION("audiocpu", 0x80000) AM_RANGE(0x800000, 0x9fffff) AM_ROM AM_REGION("samples", 0) - AM_RANGE(0xa00000, 0xdfffff) AM_READ(SMH_BANK4) - AM_RANGE(0xe00000, 0xffffff) AM_READ(SMH_BANK5) + AM_RANGE(0xa00000, 0xdfffff) AM_READ(SMH_BANK(4)) + AM_RANGE(0xe00000, 0xffffff) AM_READ(SMH_BANK(5)) ADDRESS_MAP_END static int scsp_last_line = 0; @@ -4533,7 +4533,7 @@ static void interleave_vroms(running_machine *machine) int vrom_length = memory_region_length(machine, "user3"); UINT16 *vrom; - model3_vrom = auto_malloc(0x4000000); + model3_vrom = auto_alloc_array(machine, UINT32, 0x4000000/4); vrom = (UINT16 *)model3_vrom; if( vrom_length <= 0x1000000 ) { @@ -4560,7 +4560,7 @@ static DRIVER_INIT( model3_10 ) memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc0000000, 0xc00000ff, 0, 0, scsi_r, scsi_w ); - memory_install_read64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xff000000, 0xff7fffff, 0, 0, SMH_BANK1 ); + memory_install_read64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xff000000, 0xff7fffff, 0, 0, (read64_space_func)SMH_BANK(1) ); memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf0800cf8, 0xf0800cff, 0, 0, mpc105_addr_r, mpc105_addr_w ); memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf0c00cf8, 0xf0c00cff, 0, 0, mpc105_data_r, mpc105_data_w ); @@ -4570,7 +4570,7 @@ static DRIVER_INIT( model3_10 ) static DRIVER_INIT( model3_15 ) { interleave_vroms(machine); - memory_install_read64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xff000000, 0xff7fffff, 0, 0, SMH_BANK1 ); + memory_install_read64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xff000000, 0xff7fffff, 0, 0, (read64_space_func)SMH_BANK(1) ); memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf0800cf8, 0xf0800cff, 0, 0, mpc105_addr_r, mpc105_addr_w ); memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf0c00cf8, 0xf0c00cff, 0, 0, mpc105_data_r, mpc105_data_w ); @@ -4580,7 +4580,7 @@ static DRIVER_INIT( model3_15 ) static DRIVER_INIT( model3_20 ) { interleave_vroms(machine); - memory_install_read64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xff000000, 0xff7fffff, 0, 0, SMH_BANK1 ); + memory_install_read64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xff000000, 0xff7fffff, 0, 0, (read64_space_func)SMH_BANK(1) ); memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc2000000, 0xc20000ff, 0, 0, real3d_dma_r, real3d_dma_w ); @@ -4665,7 +4665,7 @@ static DRIVER_INIT( vs215 ) rom[(0x70e710^4)/4] = 0x60000000; interleave_vroms(machine); - memory_install_read64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xff000000, 0xff7fffff, 0, 0, SMH_BANK1 ); + memory_install_read64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xff000000, 0xff7fffff, 0, 0, (read64_space_func)SMH_BANK(1) ); memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf9000000, 0xf90000ff, 0, 0, scsi_r, scsi_w ); @@ -4684,7 +4684,7 @@ static DRIVER_INIT( vs29815 ) rom[(0x60290c^4)/4] = 0x60000000; interleave_vroms(machine); - memory_install_read64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xff000000, 0xff7fffff, 0, 0, SMH_BANK1 ); + memory_install_read64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xff000000, 0xff7fffff, 0, 0, (read64_space_func)SMH_BANK(1) ); memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf9000000, 0xf90000ff, 0, 0, scsi_r, scsi_w ); @@ -4703,7 +4703,7 @@ static DRIVER_INIT( bass ) rom[(0x7999c8^4)/4] = 0x60000000; interleave_vroms(machine); - memory_install_read64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xff000000, 0xff7fffff, 0, 0, SMH_BANK1 ); + memory_install_read64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xff000000, 0xff7fffff, 0, 0, (read64_space_func)SMH_BANK(1) ); memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf9000000, 0xf90000ff, 0, 0, scsi_r, scsi_w ); @@ -4717,7 +4717,7 @@ static DRIVER_INIT( bass ) static DRIVER_INIT( getbass ) { interleave_vroms(machine); - memory_install_read64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xff000000, 0xff7fffff, 0, 0, SMH_BANK1 ); + memory_install_read64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xff000000, 0xff7fffff, 0, 0, (read64_space_func)SMH_BANK(1) ); memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf9000000, 0xf90000ff, 0, 0, scsi_r, scsi_w ); diff --git a/src/mame/drivers/momoko.c b/src/mame/drivers/momoko.c index 3dae14ba539..aff1f1b0b66 100644 --- a/src/mame/drivers/momoko.c +++ b/src/mame/drivers/momoko.c @@ -84,7 +84,7 @@ static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0xd800, 0xdbff) AM_READ(SMH_RAM) AM_RANGE(0xe000, 0xe3ff) AM_READ(SMH_RAM) /* text */ - AM_RANGE(0xf000, 0xffff) AM_READ(SMH_BANK1) + AM_RANGE(0xf000, 0xffff) AM_READ(SMH_BANK(1)) ADDRESS_MAP_END static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 ) diff --git a/src/mame/drivers/mouser.c b/src/mame/drivers/mouser.c index ada242cd5ca..a5586315247 100644 --- a/src/mame/drivers/mouser.c +++ b/src/mame/drivers/mouser.c @@ -284,7 +284,7 @@ static DRIVER_INIT( mouser ) offs_t i; const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); UINT8 *rom = memory_region(machine, "maincpu"); - UINT8 *decrypted = auto_malloc(0x6000); + UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0x6000); UINT8 *table = memory_region(machine, "user1"); memory_set_decrypted_region(space, 0x0000, 0x5fff, decrypted); diff --git a/src/mame/drivers/mpu4.c b/src/mame/drivers/mpu4.c index 572da662606..df910c0675f 100644 --- a/src/mame/drivers/mpu4.c +++ b/src/mame/drivers/mpu4.c @@ -1756,7 +1756,7 @@ static ADDRESS_MAP_START( mod2_memmap, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0E00, 0x0E03) AM_DEVREADWRITE("pia_ic7", pia6821_r,pia6821_w) /* PIA6821 IC7 */ AM_RANGE(0x0F00, 0x0F03) AM_DEVREADWRITE("pia_ic8", pia6821_r,pia6821_w) /* PIA6821 IC8 */ - AM_RANGE(0x1000, 0xffff) AM_READ(SMH_BANK1) /* 64k paged ROM (4 pages) */ + AM_RANGE(0x1000, 0xffff) AM_READ(SMH_BANK(1)) /* 64k paged ROM (4 pages) */ ADDRESS_MAP_END static ADDRESS_MAP_START( mod4_yam_map, ADDRESS_SPACE_PROGRAM, 8 ) @@ -1778,7 +1778,7 @@ static ADDRESS_MAP_START( mod4_yam_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0E00, 0x0E03) AM_DEVREADWRITE("pia_ic7", pia6821_r,pia6821_w) /* PIA6821 IC7 */ AM_RANGE(0x0F00, 0x0F03) AM_DEVREADWRITE("pia_ic8", pia6821_r,pia6821_w) /* PIA6821 IC8 */ - AM_RANGE(0x1000, 0xffff) AM_READ(SMH_BANK1) // 64k paged ROM (4 pages) + AM_RANGE(0x1000, 0xffff) AM_READ(SMH_BANK(1)) // 64k paged ROM (4 pages) ADDRESS_MAP_END static ADDRESS_MAP_START( mod4_oki_map, ADDRESS_SPACE_PROGRAM, 8 ) @@ -1802,7 +1802,7 @@ static ADDRESS_MAP_START( mod4_oki_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0E00, 0x0E03) AM_DEVREADWRITE("pia_ic7", pia6821_r,pia6821_w) /* PIA6821 IC7 */ AM_RANGE(0x0F00, 0x0F03) AM_DEVREADWRITE("pia_ic8", pia6821_r,pia6821_w) /* PIA6821 IC8 */ - AM_RANGE(0x1000, 0xffff) AM_READ(SMH_BANK1) // 64k paged ROM (4 pages) + AM_RANGE(0x1000, 0xffff) AM_READ(SMH_BANK(1)) // 64k paged ROM (4 pages) ADDRESS_MAP_END // memory map for barcrest mpu4 board ///////////////////////////////////// @@ -1828,7 +1828,7 @@ static ADDRESS_MAP_START( dutch_memmap, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0E00, 0x0E03) AM_DEVREADWRITE("pia_ic7", pia6821_r,pia6821_w) /* PIA6821 IC7 */ AM_RANGE(0x0F00, 0x0F03) AM_DEVREADWRITE("pia_ic8", pia6821_r,pia6821_w) /* PIA6821 IC8 */ - AM_RANGE(0x1000, 0xffff) AM_READ(SMH_BANK1) // 64k paged ROM (4 pages) + AM_RANGE(0x1000, 0xffff) AM_READ(SMH_BANK(1)) // 64k paged ROM (4 pages) ADDRESS_MAP_END static const ay8910_interface ay8910_config = diff --git a/src/mame/drivers/mpu4drvr.c b/src/mame/drivers/mpu4drvr.c index 7d4221cac31..016e8a4109d 100644 --- a/src/mame/drivers/mpu4drvr.c +++ b/src/mame/drivers/mpu4drvr.c @@ -1018,7 +1018,7 @@ static VIDEO_START( mpu4_vid ) /* if anything uses tile sizes other than 8x8 we can't really do it this way.. we'll have to draw tiles by hand. maybe we will anyway, but for now we don't need to */ - mpu4_vid_vidram = auto_malloc (0x20000); + mpu4_vid_vidram = auto_alloc_array(machine, UINT16, 0x20000/2); memset(mpu4_vid_vidram,0,0x20000); diff --git a/src/mame/drivers/mquake.c b/src/mame/drivers/mquake.c index 4d0930e5b2f..3eab05af7b5 100644 --- a/src/mame/drivers/mquake.c +++ b/src/mame/drivers/mquake.c @@ -38,11 +38,11 @@ static WRITE8_DEVICE_HANDLER( mquake_cia_0_porta_w ) /* swap the write handlers between ROM and bank 1 based on the bit */ if ((data & 1) == 0) /* overlay disabled, map RAM on 0x000000 */ - memory_install_write16_handler(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, SMH_BANK1); + memory_install_write16_handler(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, (write16_space_func)SMH_BANK(1)); else /* overlay enabled, map Amiga system ROM on 0x000000 */ - memory_install_write16_handler(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, SMH_UNMAP); + memory_install_write16_handler(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, (write16_space_func)SMH_UNMAP); } diff --git a/src/mame/drivers/ms32.c b/src/mame/drivers/ms32.c index 924cc44c497..3b95821f004 100644 --- a/src/mame/drivers/ms32.c +++ b/src/mame/drivers/ms32.c @@ -305,7 +305,7 @@ static ADDRESS_MAP_START( ms32_readmem, ADDRESS_SPACE_PROGRAM, 32 ) AM_RANGE(0xfec10000, 0xfec17fff) AM_READ(ms32_txram_r) /* mirror only used by memory test in service mode */ AM_RANGE(0xfec18000, 0xfec1ffff) AM_READ(ms32_bgram_r) AM_RANGE(0xfee00000, 0xfee1ffff) AM_READ(SMH_RAM) - AM_RANGE(0xffe00000, 0xffffffff) AM_READ(SMH_BANK1) + AM_RANGE(0xffe00000, 0xffffffff) AM_READ(SMH_BANK(1)) ADDRESS_MAP_END static WRITE32_HANDLER( pip_w ) @@ -1178,8 +1178,8 @@ static ADDRESS_MAP_START( ms32_snd_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x3f10, 0x3f10) AM_READ(latch_r) AM_RANGE(0x3f20, 0x3f20) AM_READNOP /* 2nd latch ? */ AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_RAM) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK4) - AM_RANGE(0xc000, 0xffff) AM_READ(SMH_BANK5) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(4)) + AM_RANGE(0xc000, 0xffff) AM_READ(SMH_BANK(5)) ADDRESS_MAP_END static ADDRESS_MAP_START( ms32_snd_writemem, ADDRESS_SPACE_PROGRAM, 8 ) @@ -2029,7 +2029,7 @@ void ms32_rearrange_sprites(running_machine *machine, const char *region) source_data = memory_region ( machine, region ); source_size = memory_region_length( machine, region ); - result_data = malloc_or_die(source_size); + result_data = alloc_array_or_die(UINT8, source_size); for(i=0; i<source_size; i++) { @@ -2054,7 +2054,7 @@ void decrypt_ms32_tx(running_machine *machine, int addr_xor,int data_xor, const source_data = memory_region ( machine, region ); source_size = memory_region_length( machine, region ); - result_data = malloc_or_die(source_size); + result_data = alloc_array_or_die(UINT8, source_size); addr_xor ^= 0x1005d; @@ -2108,7 +2108,7 @@ void decrypt_ms32_bg(running_machine *machine, int addr_xor,int data_xor, const source_data = memory_region ( machine, region ); source_size = memory_region_length( machine, region ); - result_data = malloc_or_die(source_size); + result_data = alloc_array_or_die(UINT8, source_size); addr_xor ^= 0xc1c5b; diff --git a/src/mame/drivers/multfish.c b/src/mame/drivers/multfish.c index 1f308f0dbf8..0376a8ad48b 100644 --- a/src/mame/drivers/multfish.c +++ b/src/mame/drivers/multfish.c @@ -80,11 +80,11 @@ static TILE_GET_INFO( get_multfish_reel_tile_info ) static VIDEO_START(multfish) { - multfish_vid = auto_malloc(multfish_VIDRAM_SIZE); + multfish_vid = auto_alloc_array(machine, UINT8, multfish_VIDRAM_SIZE); memset(multfish_vid,0x00,multfish_VIDRAM_SIZE); state_save_register_global_pointer(machine, multfish_vid, multfish_VIDRAM_SIZE); - multfish_bram = auto_malloc(multfish_BRAM_SIZE); + multfish_bram = auto_alloc_array(machine, UINT8, multfish_BRAM_SIZE); memset(multfish_bram,0x00,multfish_BRAM_SIZE); state_save_register_global_pointer(machine, multfish_bram, multfish_BRAM_SIZE); @@ -210,7 +210,7 @@ static READ8_HANDLER( ray_r ) static ADDRESS_MAP_START( multfish_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READWRITE(SMH_ROM, multfish_vid_w) - AM_RANGE(0x8000, 0xbfff) AM_READWRITE(SMH_BANK1, SMH_ROM ) + AM_RANGE(0x8000, 0xbfff) AM_READWRITE(SMH_BANK(1), SMH_ROM ) AM_RANGE(0xc000, 0xdfff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size) AM_RANGE(0xe000, 0xffff) AM_READWRITE(bankedram_r, bankedram_w) ADDRESS_MAP_END diff --git a/src/mame/drivers/multigam.c b/src/mame/drivers/multigam.c index b7c2ca88f35..c7ad3c72a6f 100644 --- a/src/mame/drivers/multigam.c +++ b/src/mame/drivers/multigam.c @@ -725,7 +725,7 @@ static DRIVER_INIT(multigm3) multigm3_decrypt(memory_region(machine, "maincpu"), memory_region_length(machine, "maincpu"), decode ); multigm3_decrypt(memory_region(machine, "user1"), memory_region_length(machine, "user1"), decode ); - multigmc_mmc3_6000_ram = auto_malloc(0x2000); + multigmc_mmc3_6000_ram = auto_alloc_array(machine, UINT8, 0x2000); multigam_switch_prg_rom( space, 0x0, 0x01 ); } diff --git a/src/mame/drivers/mustache.c b/src/mame/drivers/mustache.c index 0c218f54144..6e4089833d7 100644 --- a/src/mame/drivers/mustache.c +++ b/src/mame/drivers/mustache.c @@ -265,7 +265,7 @@ static DRIVER_INIT( mustache ) int G2 = memory_region_length(machine, "gfx2")/2; UINT8 *gfx1 = memory_region(machine, "gfx1"); UINT8 *gfx2 = memory_region(machine, "gfx2"); - UINT8 *buf=malloc_or_die(G2*2); + UINT8 *buf=alloc_array_or_die(UINT8, G2*2); /* BG data lines */ for (i=0;i<G1; i++) diff --git a/src/mame/drivers/mwarr.c b/src/mame/drivers/mwarr.c index 3fc02bcd8fa..0d7c4c1b51f 100644 --- a/src/mame/drivers/mwarr.c +++ b/src/mame/drivers/mwarr.c @@ -318,7 +318,7 @@ static VIDEO_START( mwarr ) mhigh_tilemap = tilemap_create(machine, get_mhigh_tile_info,tilemap_scan_cols, 16, 16,64,16); tx_tilemap = tilemap_create(machine, get_tx_tile_info, tilemap_scan_rows, 8, 8,64,32); - sprites_buffer = auto_malloc(sizeof(UINT16) * 0x800); + sprites_buffer = auto_alloc_array(machine, UINT16, 0x800); tilemap_set_transparent_pen(mlow_tilemap,0); tilemap_set_transparent_pen(mhigh_tilemap,0); diff --git a/src/mame/drivers/mystwarr.c b/src/mame/drivers/mystwarr.c index 0b8697dfba8..aff733ffa32 100644 --- a/src/mame/drivers/mystwarr.c +++ b/src/mame/drivers/mystwarr.c @@ -772,7 +772,7 @@ static WRITE8_HANDLER( sound_bankswitch_w ) static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK2) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(2)) AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_RAM) AM_RANGE(0xe000, 0xe22f) AM_DEVREAD("konami1", k054539_r) AM_RANGE(0xe230, 0xe3ff) AM_READ(SMH_RAM) diff --git a/src/mame/drivers/namcofl.c b/src/mame/drivers/namcofl.c index 6a434117158..1c56ca00846 100644 --- a/src/mame/drivers/namcofl.c +++ b/src/mame/drivers/namcofl.c @@ -239,8 +239,8 @@ static WRITE32_HANDLER( namcofl_share_w ) } static ADDRESS_MAP_START( namcofl_mem, ADDRESS_SPACE_PROGRAM, 32 ) - AM_RANGE(0x00000000, 0x000fffff) AM_READWRITE(SMH_BANK1, SMH_BANK1) - AM_RANGE(0x10000000, 0x100fffff) AM_READWRITE(SMH_BANK2, SMH_BANK2) + AM_RANGE(0x00000000, 0x000fffff) AM_READWRITE(SMH_BANK(1), SMH_BANK(1)) + AM_RANGE(0x10000000, 0x100fffff) AM_READWRITE(SMH_BANK(2), SMH_BANK(2)) AM_RANGE(0x20000000, 0x201fffff) AM_ROM AM_REGION("user1", 0) /* data */ AM_RANGE(0x30000000, 0x30001fff) AM_RAM AM_BASE(&generic_nvram32) AM_SIZE(&generic_nvram_size) /* nvram */ AM_RANGE(0x30100000, 0x30100003) AM_WRITE(namcofl_spritebank_w) @@ -723,7 +723,7 @@ ROM_END static void namcofl_common_init(running_machine *machine) { - namcofl_workram = auto_malloc(0x100000); + namcofl_workram = auto_alloc_array(machine, UINT32, 0x100000/4); memory_set_bankptr(machine, 1, memory_region(machine, "maincpu") ); memory_set_bankptr(machine, 2, namcofl_workram ); diff --git a/src/mame/drivers/namcoic.c b/src/mame/drivers/namcoic.c index e5bfbf4f6d7..6e3f0e07714 100644 --- a/src/mame/drivers/namcoic.c +++ b/src/mame/drivers/namcoic.c @@ -59,7 +59,7 @@ namco_tilemap_init( running_machine *machine, int gfxbank, void *maskBaseAddr, mTilemapInfo.gfxbank = gfxbank; mTilemapInfo.maskBaseAddr = maskBaseAddr; mTilemapInfo.cb = cb; - mTilemapInfo.videoram = auto_malloc( 0x10000*2 ); + mTilemapInfo.videoram = auto_alloc_array(machine, UINT16, 0x10000 ); /* four scrolling tilemaps */ mTilemapInfo.tmap[0] = tilemap_create(machine, get_tile_info0,tilemap_scan_rows,8,8,64,64); @@ -910,7 +910,7 @@ static int DefaultCodeToTile( int code ) } void -namco_obj_init( int gfxbank, int palXOR, int (*codeToTile)( int code ) ) +namco_obj_init( running_machine *machine, int gfxbank, int palXOR, int (*codeToTile)( int code ) ) { mGfxC355 = gfxbank; mPalXOR = palXOR; @@ -922,7 +922,7 @@ namco_obj_init( int gfxbank, int palXOR, int (*codeToTile)( int code ) ) { mpCodeToTile = DefaultCodeToTile; } - spriteram16 = auto_malloc(0x20000); + spriteram16 = auto_alloc_array(machine, UINT16, 0x20000/2); memset( spriteram16, 0, 0x20000 ); /* needed for Nebulas Ray */ memset( mSpritePos,0x00,sizeof(mSpritePos) ); } /* namcosC355_init */ @@ -1130,9 +1130,9 @@ namco_roz_init( running_machine *machine, int gfxbank, const char * maskregion ) mRozGfxBank = gfxbank; mRozMaskRegion = maskregion; - rozbank16 = auto_malloc(0x10); - rozvideoram16 = auto_malloc(0x20000); - rozcontrol16 = auto_malloc(0x20); + rozbank16 = auto_alloc_array(machine, UINT16, 0x10/2); + rozvideoram16 = auto_alloc_array(machine, UINT16, 0x20000/2); + rozcontrol16 = auto_alloc_array(machine, UINT16, 0x20/2); for( i=0; i<ROZ_TILEMAP_COUNT; i++ ) { @@ -1580,7 +1580,7 @@ namco_road_init(running_machine *machine, int gfxbank ) mbRoadNeedTransparent = 0; mRoadGfxBank = gfxbank; - mpRoadRAM = auto_malloc(0x20000); + mpRoadRAM = auto_alloc_array(machine, UINT16, 0x20000/2); pGfx = gfx_element_alloc( machine, &RoadTileLayout, 0x10000+(UINT8 *)mpRoadRAM, 0x3f, 0xf00); diff --git a/src/mame/drivers/namcos11.c b/src/mame/drivers/namcos11.c index 34fb2b63975..57ceeda8662 100644 --- a/src/mame/drivers/namcos11.c +++ b/src/mame/drivers/namcos11.c @@ -818,14 +818,14 @@ static DRIVER_INIT( namcos11 ) UINT32 len = memory_region_length( machine, "user2" ); UINT8 *rgn = memory_region( machine, "user2" ); - memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f0fffff, 0, 0, SMH_BANK1 ); - memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f100000, 0x1f1fffff, 0, 0, SMH_BANK2 ); - memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f200000, 0x1f2fffff, 0, 0, SMH_BANK3 ); - memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f300000, 0x1f3fffff, 0, 0, SMH_BANK4 ); - memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f400000, 0x1f4fffff, 0, 0, SMH_BANK5 ); - memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f500000, 0x1f5fffff, 0, 0, SMH_BANK6 ); - memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f600000, 0x1f6fffff, 0, 0, SMH_BANK7 ); - memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f700000, 0x1f7fffff, 0, 0, SMH_BANK8 ); + memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f0fffff, 0, 0, (read32_space_func)SMH_BANK(1) ); + memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f100000, 0x1f1fffff, 0, 0, (read32_space_func)SMH_BANK(2) ); + memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f200000, 0x1f2fffff, 0, 0, (read32_space_func)SMH_BANK(3) ); + memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f300000, 0x1f3fffff, 0, 0, (read32_space_func)SMH_BANK(4) ); + memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f400000, 0x1f4fffff, 0, 0, (read32_space_func)SMH_BANK(5) ); + memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f500000, 0x1f5fffff, 0, 0, (read32_space_func)SMH_BANK(6) ); + memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f600000, 0x1f6fffff, 0, 0, (read32_space_func)SMH_BANK(7) ); + memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f700000, 0x1f7fffff, 0, 0, (read32_space_func)SMH_BANK(8) ); for( bank = 0; bank < 8; bank++ ) { @@ -841,13 +841,13 @@ static DRIVER_INIT( namcos11 ) { m_n_bankoffset = 0; memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f080000, 0x1f080003, 0, 0, bankswitch_rom64_upper_w ); - memory_install_readwrite32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fa10020, 0x1fa1002f, 0, 0, SMH_NOP, bankswitch_rom64_w ); + memory_install_readwrite32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fa10020, 0x1fa1002f, 0, 0, (read32_space_func)SMH_NOP, bankswitch_rom64_w ); state_save_register_global(machine, m_n_bankoffset ); } } else { - memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fa10020, 0x1fa1002f, 0, 0, SMH_NOP ); + memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fa10020, 0x1fa1002f, 0, 0, (write32_space_func)SMH_NOP ); } break; } diff --git a/src/mame/drivers/namcos12.c b/src/mame/drivers/namcos12.c index fe1c2d0d4b2..c25d2d78ccd 100644 --- a/src/mame/drivers/namcos12.c +++ b/src/mame/drivers/namcos12.c @@ -1260,7 +1260,7 @@ static MACHINE_RESET( namcos12 ) strcmp( machine->gamedrv->name, "ghlpanic" ) == 0 ) { /* this is based on guesswork, it might not even be keycus. */ - memory_install_read32_handler (space, 0x1fc20280, 0x1fc2028b, 0, 0, SMH_BANK2 ); + memory_install_read32_handler (space, 0x1fc20280, 0x1fc2028b, 0, 0, (read32_space_func)SMH_BANK(2) ); memory_install_write32_handler(space, 0x1f008000, 0x1f008003, 0, 0, kcon_w ); memory_install_write32_handler(space, 0x1f018000, 0x1f018003, 0, 0, kcoff_w ); diff --git a/src/mame/drivers/namcos21.c b/src/mame/drivers/namcos21.c index 6e26b9c8eef..b6d84b29b6f 100644 --- a/src/mame/drivers/namcos21.c +++ b/src/mame/drivers/namcos21.c @@ -331,7 +331,8 @@ static UINT16 pointram_control; #define DSP_BUF_MAX (4096*12) -static struct +typedef struct _dsp_state dsp_state; +struct _dsp_state { unsigned masterSourceAddr; UINT16 slaveInputBuffer[DSP_BUF_MAX]; @@ -344,7 +345,8 @@ static struct unsigned masterDirectDrawSize; int masterFinished; int slaveActive; -} *mpDspState; +}; +static dsp_state *mpDspState; static INT32 ReadPointROMData( running_machine *machine, unsigned offset ) @@ -632,8 +634,7 @@ InitDSP( running_machine *machine ) pMem[0x8000] = 0xFF80; pMem[0x8001] = 0x0000; - mpDspState = auto_malloc( sizeof(*mpDspState) ); - memset( mpDspState, 0, sizeof(*mpDspState) ); + mpDspState = auto_alloc_clear(machine, dsp_state); return 0; } @@ -2202,7 +2203,7 @@ ROM_END static void namcos21_init( running_machine *machine, int game_type ) { namcos2_gametype = game_type; - pointram = auto_malloc(PTRAM_SIZE); + pointram = auto_alloc_array(machine, UINT8, PTRAM_SIZE); mpDataROM = (UINT16 *)memory_region( machine, "user1" ); InitDSP(machine); mbNeedsKickstart = 20; @@ -2219,11 +2220,11 @@ static DRIVER_INIT( winrun ) pMem[pc++] = 0xff80; /* b */ pMem[pc++] = 0; - winrun_dspcomram = auto_malloc(sizeof(UINT16)*0x1000*2); + winrun_dspcomram = auto_alloc_array(machine, UINT16, 0x1000*2); namcos2_gametype = NAMCOS21_WINRUN91; mpDataROM = (UINT16 *)memory_region( machine, "user1" ); - pointram = auto_malloc(PTRAM_SIZE); + pointram = auto_alloc_array(machine, UINT8, PTRAM_SIZE); pointram_idx = 0; mbNeedsKickstart = 0; } @@ -2261,10 +2262,10 @@ static DRIVER_INIT( driveyes ) int pc = 0; pMem[pc++] = 0xff80; /* b */ pMem[pc++] = 0; - winrun_dspcomram = auto_malloc(sizeof(UINT16)*0x1000*2); + winrun_dspcomram = auto_alloc_array(machine, UINT16, 0x1000*2); namcos2_gametype = NAMCOS21_DRIVERS_EYES; mpDataROM = (UINT16 *)memory_region( machine, "user1" ); - pointram = auto_malloc(PTRAM_SIZE); + pointram = auto_alloc_array(machine, UINT8, PTRAM_SIZE); pointram_idx = 0; mbNeedsKickstart = 0; } diff --git a/src/mame/drivers/namcos22.c b/src/mame/drivers/namcos22.c index 9c95e6076ec..7ce253faf6c 100644 --- a/src/mame/drivers/namcos22.c +++ b/src/mame/drivers/namcos22.c @@ -1772,7 +1772,7 @@ static WRITE16_HANDLER( master_render_device_w ) mRenderBufData[mRenderBufSize++] = data; if( mRenderBufSize == MAX_RENDER_CMD_SEQ ) { - namcos22_draw_direct_poly( mRenderBufData ); + namcos22_draw_direct_poly( space->machine, mRenderBufData ); } } } @@ -5086,21 +5086,21 @@ static void install_141_speedup(running_machine *machine) memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[3], ADDRESS_SPACE_PROGRAM), 0x82, 0x83, 0, 0, mcu141_speedup_r, mcu_speedup_w); } -static void namcos22_init( enum namcos22_gametype game_type ) +static void namcos22_init( running_machine *machine, enum namcos22_gametype game_type ) { namcos22_gametype = game_type; - mpPointRAM = auto_malloc(0x20000*sizeof(*mpPointRAM)); + mpPointRAM = auto_alloc_array(machine, UINT32, 0x20000); } -static void namcos22s_init( enum namcos22_gametype game_type ) +static void namcos22s_init( running_machine *machine, enum namcos22_gametype game_type ) { - namcos22_init(game_type); - mSpotRAM.RAM = auto_malloc(SPOTRAM_SIZE*2); + namcos22_init(machine, game_type); + mSpotRAM.RAM = auto_alloc_array(machine, UINT16, SPOTRAM_SIZE); } static DRIVER_INIT( alpiner ) { - namcos22s_init(NAMCOS22_ALPINE_RACER); + namcos22s_init(machine, NAMCOS22_ALPINE_RACER); memory_install_read8_handler(cpu_get_address_space(machine->cpu[3], ADDRESS_SPACE_IO), M37710_ADC0_L, M37710_ADC7_H, 0, 0, alpineracer_mcu_adc_r); @@ -5109,7 +5109,7 @@ static DRIVER_INIT( alpiner ) static DRIVER_INIT( alpiner2 ) { - namcos22s_init(NAMCOS22_ALPINE_RACER_2); + namcos22s_init(machine, NAMCOS22_ALPINE_RACER_2); memory_install_read8_handler(cpu_get_address_space(machine->cpu[3], ADDRESS_SPACE_IO), M37710_ADC0_L, M37710_ADC7_H, 0, 0, alpineracer_mcu_adc_r); @@ -5118,7 +5118,7 @@ static DRIVER_INIT( alpiner2 ) static DRIVER_INIT( alpinesa ) { - namcos22s_init(NAMCOS22_ALPINE_SURFER); + namcos22s_init(machine, NAMCOS22_ALPINE_SURFER); memory_install_read8_handler(cpu_get_address_space(machine->cpu[3], ADDRESS_SPACE_IO), M37710_ADC0_L, M37710_ADC7_H, 0, 0, alpineracer_mcu_adc_r); @@ -5127,7 +5127,7 @@ static DRIVER_INIT( alpinesa ) static DRIVER_INIT( airco22 ) { - namcos22s_init(NAMCOS22_AIR_COMBAT22); + namcos22s_init(machine, NAMCOS22_AIR_COMBAT22); memory_install_read8_handler(cpu_get_address_space(machine->cpu[3], ADDRESS_SPACE_IO), M37710_ADC0_L, M37710_ADC7_H, 0, 0, airco22_mcu_adc_r); } @@ -5151,7 +5151,7 @@ static DRIVER_INIT( propcycl ) // pROM[0x22296/4] &= 0xffff0000; // pROM[0x22296/4] |= 0x00004e75; - namcos22s_init(NAMCOS22_PROP_CYCLE); + namcos22s_init(machine, NAMCOS22_PROP_CYCLE); memory_install_read8_handler(cpu_get_address_space(machine->cpu[3], ADDRESS_SPACE_IO), M37710_ADC0_L, M37710_ADC7_H, 0, 0, propcycle_mcu_adc_r); @@ -5160,7 +5160,7 @@ static DRIVER_INIT( propcycl ) static DRIVER_INIT( ridgeraj ) { - namcos22_init(NAMCOS22_RIDGE_RACER); + namcos22_init(machine, NAMCOS22_RIDGE_RACER); install_c74_speedup(machine); @@ -5170,7 +5170,7 @@ static DRIVER_INIT( ridgeraj ) static DRIVER_INIT( ridger2j ) { - namcos22_init(NAMCOS22_RIDGE_RACER2); + namcos22_init(machine, NAMCOS22_RIDGE_RACER2); install_c74_speedup(machine); @@ -5180,7 +5180,7 @@ static DRIVER_INIT( ridger2j ) static DRIVER_INIT( acedrvr ) { - namcos22_init(NAMCOS22_ACE_DRIVER); + namcos22_init(machine, NAMCOS22_ACE_DRIVER); install_c74_speedup(machine); @@ -5190,7 +5190,7 @@ static DRIVER_INIT( acedrvr ) static DRIVER_INIT( victlap ) { - namcos22_init(NAMCOS22_VICTORY_LAP); + namcos22_init(machine, NAMCOS22_VICTORY_LAP); install_c74_speedup(machine); @@ -5200,7 +5200,7 @@ static DRIVER_INIT( victlap ) static DRIVER_INIT( raveracw ) { - namcos22_init(NAMCOS22_RAVE_RACER); + namcos22_init(machine, NAMCOS22_RAVE_RACER); install_c74_speedup(machine); @@ -5217,7 +5217,7 @@ static DRIVER_INIT( cybrcomm ) pROM[0x18aec8/4] = 0x4e714e71; pROM[0x18aefc/4] = 0x4e714e71; - namcos22_init(NAMCOS22_CYBER_COMMANDO); + namcos22_init(machine, NAMCOS22_CYBER_COMMANDO); install_c74_speedup(machine); @@ -5232,7 +5232,7 @@ static DRIVER_INIT( cybrcyc ) pROM[0x355C/4] &= 0x0000ffff; pROM[0x355C/4] |= 0x4e710000; - namcos22s_init(NAMCOS22_CYBER_CYCLES); + namcos22s_init(machine, NAMCOS22_CYBER_CYCLES); memory_install_read8_handler(cpu_get_address_space(machine->cpu[3], ADDRESS_SPACE_IO), M37710_ADC0_L, M37710_ADC7_H, 0, 0, cybrcycc_mcu_adc_r); @@ -5241,7 +5241,7 @@ static DRIVER_INIT( cybrcyc ) static DRIVER_INIT( timecris ) { - namcos22s_init(NAMCOS22_TIME_CRISIS); + namcos22s_init(machine, NAMCOS22_TIME_CRISIS); // install_130_speedup(machine); // with speed up the SUBCPU START WAIT test fails } diff --git a/src/mame/drivers/namcos86.c b/src/mame/drivers/namcos86.c index 17c6d807d09..ead4faca639 100644 --- a/src/mame/drivers/namcos86.c +++ b/src/mame/drivers/namcos86.c @@ -360,7 +360,7 @@ static ADDRESS_MAP_START( cpu1_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x4000, 0x5fff) AM_READWRITE(rthunder_spriteram_r,rthunder_spriteram_w) - AM_RANGE(0x6000, 0x7fff) AM_READ(SMH_BANK1) + AM_RANGE(0x6000, 0x7fff) AM_READ(SMH_BANK(1)) AM_RANGE(0x8000, 0xffff) AM_ROM /* ROM & Voice expansion board - only some games have it */ @@ -387,7 +387,7 @@ static ADDRESS_MAP_START( NAME##_cpu2_map, ADDRESS_SPACE_PROGRAM, 8 ) \ AM_RANGE(ADDR_SPRITE+0x0000, ADDR_SPRITE+0x1fff) AM_READWRITE(rthunder_spriteram_r,rthunder_spriteram_w) AM_BASE(&rthunder_spriteram) \ AM_RANGE(ADDR_VIDEO1+0x0000, ADDR_VIDEO1+0x1fff) AM_READWRITE(rthunder_videoram1_r,rthunder_videoram1_w) \ AM_RANGE(ADDR_VIDEO2+0x0000, ADDR_VIDEO2+0x1fff) AM_READWRITE(rthunder_videoram2_r,rthunder_videoram2_w) \ - AM_RANGE(ADDR_ROM+0x0000, ADDR_ROM+0x1fff) AM_READ(SMH_BANK2) \ + AM_RANGE(ADDR_ROM+0x0000, ADDR_ROM+0x1fff) AM_READ(SMH_BANK(2)) \ AM_RANGE(0x8000, 0xffff) AM_ROM \ /* { ADDR_BANK+0x00, ADDR_BANK+0x02 } layer 2 scroll registers would be here */ \ AM_RANGE(ADDR_BANK+0x03, ADDR_BANK+0x03) AM_WRITE(bankswitch2_w) \ @@ -1506,7 +1506,7 @@ static DRIVER_INIT( namco86 ) /* shuffle tile ROMs so regular gfx unpack routines can be used */ gfx = memory_region(machine, "gfx1"); size = memory_region_length(machine, "gfx1") * 2 / 3; - buffer = malloc_or_die( size ); + buffer = alloc_array_or_die(UINT8, size ); { UINT8 *dest1 = gfx; @@ -1531,7 +1531,7 @@ static DRIVER_INIT( namco86 ) gfx = memory_region(machine, "gfx2"); size = memory_region_length(machine, "gfx2") * 2 / 3; - buffer = malloc_or_die( size ); + buffer = alloc_array_or_die(UINT8, size ); { UINT8 *dest1 = gfx; diff --git a/src/mame/drivers/nbmj8991.c b/src/mame/drivers/nbmj8991.c index 2ffa91eb2b8..ce43afee863 100644 --- a/src/mame/drivers/nbmj8991.c +++ b/src/mame/drivers/nbmj8991.c @@ -400,7 +400,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sound_readmem_nbmj8991, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x77ff) AM_READ(SMH_ROM) AM_RANGE(0x7800, 0x7fff) AM_READ(SMH_RAM) - AM_RANGE(0x8000, 0xffff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xffff) AM_READ(SMH_BANK(1)) ADDRESS_MAP_END static ADDRESS_MAP_START( sound_writemem_nbmj8991, ADDRESS_SPACE_PROGRAM, 8 ) diff --git a/src/mame/drivers/nbmj9195.c b/src/mame/drivers/nbmj9195.c index e6f732f1ade..212d06815ad 100644 --- a/src/mame/drivers/nbmj9195.c +++ b/src/mame/drivers/nbmj9195.c @@ -614,7 +614,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x77ff) AM_READ(SMH_ROM) AM_RANGE(0x7800, 0x7fff) AM_READ(SMH_RAM) - AM_RANGE(0x8000, 0xffff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xffff) AM_READ(SMH_BANK(1)) ADDRESS_MAP_END static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 ) diff --git a/src/mame/drivers/neodrvr.c b/src/mame/drivers/neodrvr.c index 258f8495343..37330275a1a 100644 --- a/src/mame/drivers/neodrvr.c +++ b/src/mame/drivers/neodrvr.c @@ -7482,7 +7482,7 @@ static DRIVER_INIT( kf2k3pcb ) neogeo_fixed_layer_bank_type = 2; DRIVER_INIT_CALL(neogeo); install_pvc_protection(machine); - memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc00000, 0xc7ffff, 0, 0, SMH_BANK6 ); // 512k bios + memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc00000, 0xc7ffff, 0, 0, (read16_space_func)SMH_BANK(6) ); // 512k bios } static DRIVER_INIT( kof2003 ) @@ -7555,10 +7555,10 @@ static DRIVER_INIT( jockeygp ) kof2000_neogeo_gfx_decrypt(machine, 0xac); /* install some extra RAM */ - extra_ram = auto_malloc(0x2000); + extra_ram = auto_alloc_array(machine, UINT16, 0x2000/2); state_save_register_global_pointer(machine, extra_ram, 0x2000 / 2); - memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x200000, 0x201fff, 0, 0, SMH_BANK8, SMH_BANK8); + memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x200000, 0x201fff, 0, 0, (read16_space_func)SMH_BANK(8), (write16_space_func)SMH_BANK(8)); memory_set_bankptr(machine, NEOGEO_BANK_EXTRA_RAM, extra_ram); // memory_install_read_port_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x280000, 0x280001, 0, 0, "IN5"); @@ -7572,10 +7572,10 @@ static DRIVER_INIT( vliner ) UINT16* extra_ram; /* install some extra RAM */ - extra_ram = auto_malloc(0x2000); + extra_ram = auto_alloc_array(machine, UINT16, 0x2000/2); state_save_register_global_pointer(machine, extra_ram, 0x2000 / 2); - memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x200000, 0x201fff, 0, 0, SMH_BANK8, SMH_BANK8); + memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x200000, 0x201fff, 0, 0, (read16_space_func)SMH_BANK(8), (write16_space_func)SMH_BANK(8)); memory_set_bankptr(machine, NEOGEO_BANK_EXTRA_RAM, extra_ram); memory_install_read_port_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x280000, 0x280001, 0, 0, "IN5"); diff --git a/src/mame/drivers/neogeo.c b/src/mame/drivers/neogeo.c index 527c5781965..87e4f3b442f 100644 --- a/src/mame/drivers/neogeo.c +++ b/src/mame/drivers/neogeo.c @@ -601,13 +601,6 @@ static WRITE16_HANDLER( save_ram_w ) #define MEMCARD_SIZE 0x0800 -static void memcard_init(void) -{ - memcard_data = auto_malloc(MEMCARD_SIZE); - memset(memcard_data, 0, MEMCARD_SIZE); -} - - static CUSTOM_INPUT( get_memcard_status ) { /* D0 and D1 are memcard presence indicators, D2 indicates memcard @@ -1082,7 +1075,7 @@ static MACHINE_START( neogeo ) calendar_init(machine); /* initialize the memcard data structure */ - memcard_init(); + memcard_data = auto_alloc_array_clear(machine, UINT8, MEMCARD_SIZE); /* start with an IRQ3 - but NOT on a reset */ irq3_pending = 1; diff --git a/src/mame/drivers/nightgal.c b/src/mame/drivers/nightgal.c index 54dc122152e..4cac94bc98b 100644 --- a/src/mame/drivers/nightgal.c +++ b/src/mame/drivers/nightgal.c @@ -36,7 +36,7 @@ static READ8_HANDLER( blitter_status_r ) static VIDEO_START( nightgal ) { - blit_buffer = auto_malloc(256*256); + blit_buffer = auto_alloc_array(machine, UINT8, 256*256); } static VIDEO_UPDATE( nightgal ) diff --git a/src/mame/drivers/ninjakd2.c b/src/mame/drivers/ninjakd2.c index d9a4f9b2d68..47f372cc1b8 100644 --- a/src/mame/drivers/ninjakd2.c +++ b/src/mame/drivers/ninjakd2.c @@ -214,7 +214,7 @@ static SAMPLES_START( ninjakd2_init_samples ) running_machine *machine = device->machine; const UINT8* const rom = memory_region(machine, "pcm"); const int length = memory_region_length(machine, "pcm"); - INT16* const sampledata = auto_malloc(length * sizeof(sampledata[0])); + INT16* sampledata = auto_alloc_array(machine, INT16, length); int i; @@ -1418,7 +1418,7 @@ static void lineswap_gfx_roms(running_machine *machine, const char *region, cons UINT8* const src = memory_region(machine, region); - UINT8* const temp = malloc_or_die(length); + UINT8* const temp = alloc_array_or_die(UINT8, length); const int mask = (1 << (bit + 1)) - 1; diff --git a/src/mame/drivers/ninjaw.c b/src/mame/drivers/ninjaw.c index ecc0b726166..d55f5134f32 100644 --- a/src/mame/drivers/ninjaw.c +++ b/src/mame/drivers/ninjaw.c @@ -408,7 +408,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( z80_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_ROM) - AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK10) + AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK(10)) AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_RAM) AM_RANGE(0xe000, 0xe003) AM_DEVREAD("ym", ym2610_r) AM_RANGE(0xe200, 0xe200) AM_READNOP diff --git a/src/mame/drivers/niyanpai.c b/src/mame/drivers/niyanpai.c index 897dd7526b9..1ed2faade93 100644 --- a/src/mame/drivers/niyanpai.c +++ b/src/mame/drivers/niyanpai.c @@ -456,7 +456,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x77ff) AM_READ(SMH_ROM) AM_RANGE(0x7800, 0x7fff) AM_READ(SMH_RAM) - AM_RANGE(0x8000, 0xffff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xffff) AM_READ(SMH_BANK(1)) ADDRESS_MAP_END static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 ) diff --git a/src/mame/drivers/nmk16.c b/src/mame/drivers/nmk16.c index 08a985157d7..764e4ae20c2 100644 --- a/src/mame/drivers/nmk16.c +++ b/src/mame/drivers/nmk16.c @@ -1055,7 +1055,7 @@ static WRITE8_HANDLER( raphero_sound_rombank_w ) static ADDRESS_MAP_START( raphero_sound_mem_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE( 0x0000, 0x7fff ) AM_ROM - AM_RANGE( 0x8000, 0xbfff ) AM_READ( SMH_BANK1 ) + AM_RANGE( 0x8000, 0xbfff ) AM_READ( SMH_BANK(1) ) AM_RANGE( 0xc000, 0xc001 ) AM_DEVREADWRITE("ym", ym2203_r, ym2203_w ) AM_RANGE( 0xc800, 0xc800 ) AM_DEVREADWRITE( "oki1", okim6295_r, okim6295_w ) AM_RANGE( 0xc808, 0xc808 ) AM_DEVREADWRITE( "oki2", okim6295_r, okim6295_w ) @@ -4584,7 +4584,7 @@ static READ16_HANDLER( vandykeb_r ) { return 0x0000; } static DRIVER_INIT (vandykeb) { memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x08000e, 0x08000f, 0, 0, vandykeb_r ); - memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x08001e, 0x08001f, 0, 0, SMH_NOP ); + memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x08001e, 0x08001f, 0, 0, (write16_space_func)SMH_NOP ); } @@ -4982,7 +4982,7 @@ static void decryptcode( running_machine *machine, int a23, int a22, int a21, in int i; UINT8 *RAM = memory_region( machine, "maincpu" ); size_t size = memory_region_length( machine, "maincpu" ); - UINT8 *buffer = malloc_or_die( size ); + UINT8 *buffer = alloc_array_or_die(UINT8, size ); memcpy( buffer, RAM, size ); for( i = 0; i < size; i++ ) diff --git a/src/mame/drivers/norautp.c b/src/mame/drivers/norautp.c index c33d89d162e..61aa4105a6a 100644 --- a/src/mame/drivers/norautp.c +++ b/src/mame/drivers/norautp.c @@ -170,7 +170,7 @@ static UINT16 np_addr; static VIDEO_START( norautp ) { - np_vram = auto_malloc(0x1000); + np_vram = auto_alloc_array(machine, UINT16, 0x1000/2); } diff --git a/src/mame/drivers/nova2001.c b/src/mame/drivers/nova2001.c index 6cffb1526ef..ed2b9ff8266 100644 --- a/src/mame/drivers/nova2001.c +++ b/src/mame/drivers/nova2001.c @@ -1009,7 +1009,7 @@ static void lineswap_gfx_roms(running_machine *machine, const char *region, cons UINT8* const src = memory_region(machine, region); - UINT8* const temp = malloc_or_die(length); + UINT8* const temp = alloc_array_or_die(UINT8, length); const int mask = (1 << (bit + 1)) - 1; diff --git a/src/mame/drivers/nwk-tr.c b/src/mame/drivers/nwk-tr.c index 15cbf412983..9ed13e83be7 100644 --- a/src/mame/drivers/nwk-tr.c +++ b/src/mame/drivers/nwk-tr.c @@ -417,11 +417,11 @@ int K001604_vh_start(running_machine *machine, int chip) return 1; } - K001604_char_ram[chip] = auto_malloc(0x200000); + K001604_char_ram[chip] = auto_alloc_array(machine, UINT32, 0x200000/4); - K001604_tile_ram[chip] = auto_malloc(0x20000); + K001604_tile_ram[chip] = auto_alloc_array(machine, UINT32, 0x20000/4); - K001604_reg[chip] = auto_malloc(0x400); + K001604_reg[chip] = auto_alloc_array(machine, UINT32, 0x400/4); if (chip == 0) { @@ -770,12 +770,12 @@ static int lanc2_ram_r = 0; static int lanc2_ram_w = 0; static UINT8 *lanc2_ram; -static void lanc2_init(void) +static void lanc2_init(running_machine *machine) { fpga_uploaded = 0; lanc2_ram_r = 0; lanc2_ram_w = 0; - lanc2_ram = auto_malloc(0x8000); + lanc2_ram = auto_alloc_array(machine, UINT8, 0x8000); } static READ32_HANDLER( lanc1_r ) @@ -1087,14 +1087,14 @@ static DRIVER_INIT(nwktr) init_konami_cgboard(machine, 1, CGBOARD_TYPE_NWKTR); set_cgboard_texture_bank(machine, 0, 5, memory_region(machine, "user5")); - sharc_dataram = auto_malloc(0x100000); + sharc_dataram = auto_alloc_array(machine, UINT32, 0x100000/4); led_reg0 = led_reg1 = 0x7f; K056800_init(machine, sound_irq_callback); K033906_init(machine); adc1213x_init(0, adc12138_input_callback); - lanc2_init(); + lanc2_init(machine); } diff --git a/src/mame/drivers/nycaptor.c b/src/mame/drivers/nycaptor.c index 568e767b468..44d9cb5a497 100644 --- a/src/mame/drivers/nycaptor.c +++ b/src/mame/drivers/nycaptor.c @@ -292,7 +292,7 @@ static WRITE8_HANDLER( nycaptor_generic_control_w ) static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xc000, 0xc7ff) AM_READ(nycaptor_videoram_r) AM_RANGE(0xd000, 0xd000) AM_READ(nycaptor_mcu_r) AM_RANGE(0xd002, 0xd002) AM_READ(nycaptor_generic_control_r) @@ -436,7 +436,7 @@ static WRITE8_HANDLER( cyclshtg_generic_control_w ) static ADDRESS_MAP_START( cyclshtg_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xc000, 0xcfff) AM_READ(nycaptor_videoram_r) AM_RANGE(0xd000, 0xd000) AM_READ(cyclshtg_mcu_r) AM_RANGE(0xd002, 0xd002) AM_READ(nycaptor_generic_control_r) @@ -506,7 +506,7 @@ static READ8_HANDLER(unk_r) static ADDRESS_MAP_START( bronx_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xc000, 0xcfff) AM_READ(nycaptor_videoram_r) AM_RANGE(0xd000, 0xd000) AM_READ(cyclshtg_mcu_r) AM_RANGE(0xd002, 0xd002) AM_READ(nycaptor_generic_control_r) diff --git a/src/mame/drivers/ojankohs.c b/src/mame/drivers/ojankohs.c index f0cb3a4b829..5e047541ef8 100644 --- a/src/mame/drivers/ojankohs.c +++ b/src/mame/drivers/ojankohs.c @@ -229,7 +229,7 @@ static ADDRESS_MAP_START( readmem_ojankohs, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x9000, 0x9fff) AM_READ(ojankohs_colorram_r) AM_RANGE(0xa000, 0xb7ff) AM_READ(SMH_RAM) AM_RANGE(0xb800, 0xbfff) AM_READ(ojankohs_palette_r) - AM_RANGE(0xc000, 0xffff) AM_READ(SMH_BANK1) + AM_RANGE(0xc000, 0xffff) AM_READ(SMH_BANK(1)) ADDRESS_MAP_END static ADDRESS_MAP_START( writemem_ojankohs, ADDRESS_SPACE_PROGRAM, 8 ) @@ -246,7 +246,7 @@ static ADDRESS_MAP_START( readmem_ojankoy, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x8000, 0x9fff) AM_READ(ojankohs_videoram_r) AM_RANGE(0xa000, 0xafff) AM_READ(ojankohs_colorram_r) AM_RANGE(0xb000, 0xbfff) AM_READ(SMH_RAM) - AM_RANGE(0xc000, 0xffff) AM_READ(SMH_BANK1) + AM_RANGE(0xc000, 0xffff) AM_READ(SMH_BANK(1)) ADDRESS_MAP_END static ADDRESS_MAP_START( writemem_ojankoy, ADDRESS_SPACE_PROGRAM, 8 ) @@ -260,7 +260,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( readmem_ojankoc, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x77ff) AM_READ(SMH_ROM) AM_RANGE(0x7800, 0x7fff) AM_READ(SMH_RAM) - AM_RANGE(0x8000, 0xffff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xffff) AM_READ(SMH_BANK(1)) ADDRESS_MAP_END static ADDRESS_MAP_START( writemem_ojankoc, ADDRESS_SPACE_PROGRAM, 8 ) diff --git a/src/mame/drivers/opwolf.c b/src/mame/drivers/opwolf.c index 57d24b4d0d2..3fc60be96a3 100644 --- a/src/mame/drivers/opwolf.c +++ b/src/mame/drivers/opwolf.c @@ -288,7 +288,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( z80_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_ROM) - AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK10) + AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK(10)) AM_RANGE(0x8000, 0x8fff) AM_READ(SMH_RAM) AM_RANGE(0x9000, 0x9001) AM_DEVREAD("ym", ym2151_r) AM_RANGE(0x9002, 0x9100) AM_READ(SMH_RAM) diff --git a/src/mame/drivers/pacland.c b/src/mame/drivers/pacland.c index dcb3c471640..8e0118b4ab7 100644 --- a/src/mame/drivers/pacland.c +++ b/src/mame/drivers/pacland.c @@ -255,7 +255,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x3800, 0x3801) AM_WRITE(pacland_scroll0_w) AM_RANGE(0x3a00, 0x3a01) AM_WRITE(pacland_scroll1_w) AM_RANGE(0x3c00, 0x3c00) AM_WRITE(pacland_bankswitch_w) - AM_RANGE(0x4000, 0x5fff) AM_READ(SMH_BANK1) + AM_RANGE(0x4000, 0x5fff) AM_READ(SMH_BANK(1)) AM_RANGE(0x6800, 0x6bff) AM_DEVREADWRITE("namco", namcos1_cus30_r, namcos1_cus30_w) /* PSG device, shared RAM */ AM_RANGE(0x7000, 0x7fff) AM_WRITE(pacland_irq_1_ctrl_w) AM_RANGE(0x7800, 0x7fff) AM_READ(watchdog_reset_r) diff --git a/src/mame/drivers/pacman.c b/src/mame/drivers/pacman.c index 16993178290..3d83ff4bd69 100644 --- a/src/mame/drivers/pacman.c +++ b/src/mame/drivers/pacman.c @@ -5301,7 +5301,7 @@ ROM_END static void maketrax_rom_decode(running_machine *machine) { const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); - UINT8 *decrypted = auto_malloc(0x4000); + UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0x4000); UINT8 *rom = memory_region(machine, "maincpu"); /* patch protection using a copy of the opcodes so ROM checksum */ @@ -5333,7 +5333,7 @@ static DRIVER_INIT( maketrax ) static void korosuke_rom_decode(running_machine *machine) { const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); - UINT8 *decrypted = auto_malloc(0x4000); + UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0x4000); UINT8 *rom = memory_region(machine, "maincpu"); /* patch protection using a copy of the opcodes so ROM checksum */ @@ -5692,8 +5692,8 @@ static READ8_HANDLER( cannonbp_protection_r ) static DRIVER_INIT( cannonbp ) { /* extra memory */ - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4800, 0x4bff, 0, 0, SMH_BANK5, SMH_BANK5); - memory_set_bankptr(machine, 5, auto_malloc(0x400)); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4800, 0x4bff, 0, 0, (read8_space_func)SMH_BANK(5), (write8_space_func)SMH_BANK(5)); + memory_set_bankptr(machine, 5, auto_alloc_array(machine, UINT8, 0x400)); /* protection? */ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x3000, 0x3fff, 0, 0, cannonbp_protection_r); diff --git a/src/mame/drivers/panicr.c b/src/mame/drivers/panicr.c index 23d39c3fdc9..aa1c47a0c8a 100644 --- a/src/mame/drivers/panicr.c +++ b/src/mame/drivers/panicr.c @@ -439,7 +439,7 @@ ROM_END static DRIVER_INIT( panicr ) { - UINT8 *buf = malloc_or_die(0x80000); + UINT8 *buf = alloc_array_or_die(UINT8, 0x80000); UINT8 *rom; int size; int i; diff --git a/src/mame/drivers/parodius.c b/src/mame/drivers/parodius.c index d92de821054..d1c427d5475 100644 --- a/src/mame/drivers/parodius.c +++ b/src/mame/drivers/parodius.c @@ -142,7 +142,7 @@ static ADDRESS_MAP_START( parodius_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x3fcc, 0x3fcd) AM_DEVREAD("konami", parodius_sound_r) /* K053260 */ AM_RANGE(0x2000, 0x27ff) AM_READ(parodius_052109_053245_r) AM_RANGE(0x2000, 0x5fff) AM_READ(K052109_r) - AM_RANGE(0x6000, 0x9fff) AM_READ(SMH_BANK1) /* banked ROM */ + AM_RANGE(0x6000, 0x9fff) AM_READ(SMH_BANK(1)) /* banked ROM */ AM_RANGE(0xa000, 0xffff) AM_READ(SMH_ROM) /* ROM */ ADDRESS_MAP_END diff --git a/src/mame/drivers/pasha2.c b/src/mame/drivers/pasha2.c index f1015641861..07d34a43dec 100644 --- a/src/mame/drivers/pasha2.c +++ b/src/mame/drivers/pasha2.c @@ -315,8 +315,8 @@ INPUT_PORTS_END static VIDEO_START( pasha2 ) { - bitmap0 = auto_malloc(0x40000); - bitmap1 = auto_malloc(0x40000); + bitmap0 = auto_alloc_array(machine, UINT16, 0x40000/2); + bitmap1 = auto_alloc_array(machine, UINT16, 0x40000/2); } static VIDEO_UPDATE( pasha2 ) diff --git a/src/mame/drivers/pcktgal.c b/src/mame/drivers/pcktgal.c index 2fb9e578e14..8baaa2477c9 100644 --- a/src/mame/drivers/pcktgal.c +++ b/src/mame/drivers/pcktgal.c @@ -81,8 +81,8 @@ static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x1800, 0x1800) AM_READ_PORT("P1") AM_RANGE(0x1a00, 0x1a00) AM_READ_PORT("P2") AM_RANGE(0x1c00, 0x1c00) AM_READ_PORT("DSW") - AM_RANGE(0x4000, 0x5fff) AM_READ(SMH_BANK1) - AM_RANGE(0x6000, 0x7fff) AM_READ(SMH_BANK2) + AM_RANGE(0x4000, 0x5fff) AM_READ(SMH_BANK(1)) + AM_RANGE(0x6000, 0x7fff) AM_READ(SMH_BANK(2)) AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM) ADDRESS_MAP_END @@ -103,7 +103,7 @@ static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x07ff) AM_READ(SMH_RAM) AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_r) AM_RANGE(0x3400, 0x3400) AM_DEVREAD("msm", pcktgal_adpcm_reset_r) /* ? not sure */ - AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK3) + AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK(3)) AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM) ADDRESS_MAP_END @@ -425,7 +425,7 @@ static DRIVER_INIT( deco222 ) { int A; const address_space *space = cputag_get_address_space(machine, "audiocpu", ADDRESS_SPACE_PROGRAM); - UINT8 *decrypted = auto_malloc(0x10000); + UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0x10000); UINT8 *rom = memory_region(machine, "audiocpu"); memory_set_decrypted_region(space, 0x8000, 0xffff, decrypted); diff --git a/src/mame/drivers/pcxt.c b/src/mame/drivers/pcxt.c index a03c1f5344f..f9d61a75427 100644 --- a/src/mame/drivers/pcxt.c +++ b/src/mame/drivers/pcxt.c @@ -662,7 +662,7 @@ static ADDRESS_MAP_START( filetto_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x00400, 0x007ff) AM_RAM AM_BASE(&work_ram) AM_RANGE(0x00800, 0x9ffff) AM_RAM //work RAM 640KB AM_RANGE(0xa0000, 0xbffff) AM_RAM_WRITE(vga_vram_w) AM_BASE(&vga_vram)//VGA RAM - AM_RANGE(0xc0000, 0xcffff) AM_READ(SMH_BANK1) + AM_RANGE(0xc0000, 0xcffff) AM_READ(SMH_BANK(1)) AM_RANGE(0xf0000, 0xfffff) AM_ROM ADDRESS_MAP_END diff --git a/src/mame/drivers/pengo.c b/src/mame/drivers/pengo.c index f916e67f7d8..dc00464109d 100644 --- a/src/mame/drivers/pengo.c +++ b/src/mame/drivers/pengo.c @@ -661,7 +661,7 @@ static DRIVER_INIT( penta ) { 0x88,0x0a,0x82,0x00,0xa0,0x22,0xaa,0x28 } /* ...1...1...1.... */ }; const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); - UINT8 *decrypt = auto_malloc(0x8000); + UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x8000); UINT8 *rom = memory_region(machine, "maincpu"); int A; diff --git a/src/mame/drivers/peplus.c b/src/mame/drivers/peplus.c index c20a483de6c..198869facea 100644 --- a/src/mame/drivers/peplus.c +++ b/src/mame/drivers/peplus.c @@ -659,9 +659,9 @@ static TILE_GET_INFO( get_bg_tile_info ) static VIDEO_START( peplus ) { bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 40, 25); - palette_ram = auto_malloc(0x3000); + palette_ram = auto_alloc_array(machine, UINT8, 0x3000); memset(palette_ram, 0, 0x3000); - palette_ram2 = auto_malloc(0x3000); + palette_ram2 = auto_alloc_array(machine, UINT8, 0x3000); memset(palette_ram2, 0, 0x3000); } diff --git a/src/mame/drivers/pgm.c b/src/mame/drivers/pgm.c index 1e1c7a2bf1c..a6e989dde16 100644 --- a/src/mame/drivers/pgm.c +++ b/src/mame/drivers/pgm.c @@ -1427,7 +1427,7 @@ static void expand_colourdata(running_machine *machine) while (pgm_sprite_a_region_allocate < needed) pgm_sprite_a_region_allocate = pgm_sprite_a_region_allocate <<1; - pgm_sprite_a_region = auto_malloc (pgm_sprite_a_region_allocate); + pgm_sprite_a_region = auto_alloc_array(machine, UINT8, pgm_sprite_a_region_allocate); for (cnt = 0 ; cnt < srcsize/2 ; cnt++) @@ -1581,8 +1581,8 @@ static DRIVER_INIT( ddp2 ) static void svg_basic_init(running_machine *machine) { pgm_basic_init(machine); - svg_shareram[0]=auto_malloc(0x10000); - svg_shareram[1]=auto_malloc(0x10000); + svg_shareram[0]=auto_alloc_array(machine, UINT32, 0x10000/4); + svg_shareram[1]=auto_alloc_array(machine, UINT32, 0x10000/4); svg_ram_sel=0; } diff --git a/src/mame/drivers/phoenix.c b/src/mame/drivers/phoenix.c index f7aaeb07f0e..c9e0b76cadb 100644 --- a/src/mame/drivers/phoenix.c +++ b/src/mame/drivers/phoenix.c @@ -39,7 +39,7 @@ Pleiads: static ADDRESS_MAP_START( phoenix_memory_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_ROM - AM_RANGE(0x4000, 0x4fff) AM_READWRITE(SMH_BANK1, phoenix_videoram_w) /* 2 pages selected by bit 0 of the video register */ + AM_RANGE(0x4000, 0x4fff) AM_READWRITE(SMH_BANK(1), phoenix_videoram_w) /* 2 pages selected by bit 0 of the video register */ AM_RANGE(0x5000, 0x53ff) AM_WRITE(phoenix_videoreg_w) AM_RANGE(0x5800, 0x5bff) AM_WRITE(phoenix_scroll_w) AM_RANGE(0x6000, 0x63ff) AM_DEVWRITE("discrete", phoenix_sound_control_a_w) @@ -50,7 +50,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( pleiads_memory_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_ROM - AM_RANGE(0x4000, 0x4fff) AM_READWRITE(SMH_BANK1, phoenix_videoram_w) /* 2 pages selected by bit 0 of the video register */ + AM_RANGE(0x4000, 0x4fff) AM_READWRITE(SMH_BANK(1), phoenix_videoram_w) /* 2 pages selected by bit 0 of the video register */ AM_RANGE(0x5000, 0x53ff) AM_WRITE(pleiads_videoreg_w) AM_RANGE(0x5800, 0x5bff) AM_WRITE(phoenix_scroll_w) AM_RANGE(0x6000, 0x63ff) AM_WRITE(pleiads_sound_control_a_w) @@ -61,7 +61,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( survival_memory_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_ROM - AM_RANGE(0x4000, 0x4fff) AM_READWRITE(SMH_BANK1, phoenix_videoram_w) /* 2 pages selected by bit 0 of the video register */ + AM_RANGE(0x4000, 0x4fff) AM_READWRITE(SMH_BANK(1), phoenix_videoram_w) /* 2 pages selected by bit 0 of the video register */ AM_RANGE(0x5000, 0x53ff) AM_WRITE(phoenix_videoreg_w) AM_RANGE(0x5800, 0x5bff) AM_WRITE(phoenix_scroll_w) AM_RANGE(0x6800, 0x68ff) AM_DEVWRITE("ay", ay8910_address_w) diff --git a/src/mame/drivers/pingpong.c b/src/mame/drivers/pingpong.c index 6b76c1fefdd..70cae56e237 100644 --- a/src/mame/drivers/pingpong.c +++ b/src/mame/drivers/pingpong.c @@ -598,14 +598,14 @@ static DRIVER_INIT( cashquiz ) memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4001, 0x4001, 0, 0, cashquiz_question_bank_low_w); // 8 independents banks for questions - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5000, 0x50ff, 0, 0, SMH_BANK1); - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5100, 0x51ff, 0, 0, SMH_BANK2); - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5200, 0x52ff, 0, 0, SMH_BANK3); - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5300, 0x53ff, 0, 0, SMH_BANK4); - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5400, 0x54ff, 0, 0, SMH_BANK5); - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5500, 0x55ff, 0, 0, SMH_BANK6); - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5600, 0x56ff, 0, 0, SMH_BANK7); - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5700, 0x57ff, 0, 0, SMH_BANK8); + memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5000, 0x50ff, 0, 0, (read8_space_func)SMH_BANK(1)); + memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5100, 0x51ff, 0, 0, (read8_space_func)SMH_BANK(2)); + memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5200, 0x52ff, 0, 0, (read8_space_func)SMH_BANK(3)); + memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5300, 0x53ff, 0, 0, (read8_space_func)SMH_BANK(4)); + memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5400, 0x54ff, 0, 0, (read8_space_func)SMH_BANK(5)); + memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5500, 0x55ff, 0, 0, (read8_space_func)SMH_BANK(6)); + memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5600, 0x56ff, 0, 0, (read8_space_func)SMH_BANK(7)); + memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5700, 0x57ff, 0, 0, (read8_space_func)SMH_BANK(8)); // setup default banks for(i = 0; i < 8; i++) diff --git a/src/mame/drivers/pipedrm.c b/src/mame/drivers/pipedrm.c index ce1f2f030e1..1f7fe62631a 100644 --- a/src/mame/drivers/pipedrm.c +++ b/src/mame/drivers/pipedrm.c @@ -769,7 +769,7 @@ static DRIVER_INIT( pipedrm ) /* sprite RAM lives at the end of palette RAM */ spriteram = &paletteram[0xc00]; spriteram_size = 0x400; - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xcc00, 0xcfff, 0, 0, SMH_BANK3, SMH_BANK3); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xcc00, 0xcfff, 0, 0, (read8_space_func)SMH_BANK(3), (write8_space_func)SMH_BANK(3)); memory_set_bankptr(machine, 3, spriteram); } diff --git a/src/mame/drivers/pipeline.c b/src/mame/drivers/pipeline.c index 79c6df6fef9..7a3b971bff5 100644 --- a/src/mame/drivers/pipeline.c +++ b/src/mame/drivers/pipeline.c @@ -90,7 +90,7 @@ static TILE_GET_INFO( get_tile_info2 ) static VIDEO_START ( pipeline ) { - palram=auto_malloc(0x1000); + palram=auto_alloc_array(machine, UINT8, 0x1000); tilemap1 = tilemap_create( machine, get_tile_info,tilemap_scan_rows,8,8,64,32 ); tilemap2 = tilemap_create( machine, get_tile_info2,tilemap_scan_rows,8,8,64,32 ); tilemap_set_transparent_pen(tilemap2,0); diff --git a/src/mame/drivers/pirates.c b/src/mame/drivers/pirates.c index 6bef85cd5f4..1def679adae 100644 --- a/src/mame/drivers/pirates.c +++ b/src/mame/drivers/pirates.c @@ -370,7 +370,7 @@ static void pirates_decrypt_68k(running_machine *machine) rom_size = memory_region_length(machine, "maincpu"); - buf = malloc_or_die(rom_size); + buf = alloc_array_or_die(UINT16, rom_size/2); rom = (UINT16 *)memory_region(machine, "maincpu"); memcpy (buf, rom, rom_size); @@ -399,7 +399,7 @@ static void pirates_decrypt_p(running_machine *machine) rom_size = memory_region_length(machine, "gfx1"); - buf = malloc_or_die(rom_size); + buf = alloc_array_or_die(UINT8, rom_size); rom = memory_region(machine, "gfx1"); memcpy (buf, rom, rom_size); @@ -423,7 +423,7 @@ static void pirates_decrypt_s(running_machine *machine) rom_size = memory_region_length(machine, "gfx2"); - buf = malloc_or_die(rom_size); + buf = alloc_array_or_die(UINT8, rom_size); rom = memory_region(machine, "gfx2"); memcpy (buf, rom, rom_size); @@ -448,7 +448,7 @@ static void pirates_decrypt_oki(running_machine *machine) rom_size = memory_region_length(machine, "oki"); - buf = malloc_or_die(rom_size); + buf = alloc_array_or_die(UINT8, rom_size); rom = memory_region(machine, "oki"); memcpy (buf, rom, rom_size); diff --git a/src/mame/drivers/plygonet.c b/src/mame/drivers/plygonet.c index 9ccef12b3fa..16de3fc8450 100644 --- a/src/mame/drivers/plygonet.c +++ b/src/mame/drivers/plygonet.c @@ -581,7 +581,7 @@ static INTERRUPT_GEN(audio_interrupt) static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK2) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(2)) AM_RANGE(0x0000, 0xbfff) AM_WRITENOP AM_RANGE(0xc000, 0xdfff) AM_RAM AM_RANGE(0xe000, 0xe22f) AM_DEVREADWRITE("konami1", k054539_r, k054539_w) @@ -709,18 +709,11 @@ static DRIVER_INIT(polygonet) reset_sound_region(machine); /* Allocate space for the dsp56k banking */ - dsp56k_bank00_ram = auto_malloc(2 * 8 * dsp56k_bank00_size * sizeof(UINT16)); /* 2 bank sets, 8 potential banks each */ - dsp56k_bank01_ram = auto_malloc(2 * 8 * dsp56k_bank01_size * sizeof(UINT16)); - dsp56k_bank02_ram = auto_malloc(2 * 8 * dsp56k_bank02_size * sizeof(UINT16)); - dsp56k_shared_ram_16 = auto_malloc(2 * 8 * dsp56k_shared_ram_16_size * sizeof(UINT16)); - dsp56k_bank04_ram = auto_malloc(2 * 8 * dsp56k_bank04_size * sizeof(UINT16)); - - /* Clear the newly-allocated memory */ - memset(dsp56k_bank00_ram, 0, 2 * 8 * dsp56k_bank00_size * sizeof(UINT16)); - memset(dsp56k_bank01_ram, 0, 2 * 8 * dsp56k_bank01_size * sizeof(UINT16)); - memset(dsp56k_bank02_ram, 0, 2 * 8 * dsp56k_bank02_size * sizeof(UINT16)); - memset(dsp56k_shared_ram_16, 0, 2 * 8 * dsp56k_shared_ram_16_size * sizeof(UINT16)); - memset(dsp56k_bank04_ram, 0, 2 * 8 * dsp56k_bank04_size * sizeof(UINT16)); + dsp56k_bank00_ram = auto_alloc_array_clear(machine, UINT16, 2 * 8 * dsp56k_bank00_size); /* 2 bank sets, 8 potential banks each */ + dsp56k_bank01_ram = auto_alloc_array_clear(machine, UINT16, 2 * 8 * dsp56k_bank01_size); + dsp56k_bank02_ram = auto_alloc_array_clear(machine, UINT16, 2 * 8 * dsp56k_bank02_size); + dsp56k_shared_ram_16 = auto_alloc_array_clear(machine, UINT16, 2 * 8 * dsp56k_shared_ram_16_size); + dsp56k_bank04_ram = auto_alloc_array_clear(machine, UINT16, 2 * 8 * dsp56k_bank04_size); /* The dsp56k occasionally executes out of mapped memory */ dsp56k_update_handler = memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), plygonet_dsp56k_direct_handler); diff --git a/src/mame/drivers/pntnpuzl.c b/src/mame/drivers/pntnpuzl.c index c94c9347fce..4bd142dd00e 100644 --- a/src/mame/drivers/pntnpuzl.c +++ b/src/mame/drivers/pntnpuzl.c @@ -186,7 +186,7 @@ static UINT16* pntnpuzl_bank; /* vid */ static VIDEO_START( pntnpuzl ) { - pntnpuzl_3a0000ram=auto_malloc(0x100000); + pntnpuzl_3a0000ram=auto_alloc_array(machine, UINT16, 0x100000/2); } static VIDEO_UPDATE( pntnpuzl ) diff --git a/src/mame/drivers/pokechmp.c b/src/mame/drivers/pokechmp.c index e42cf7df75c..1f8d5ef5f72 100644 --- a/src/mame/drivers/pokechmp.c +++ b/src/mame/drivers/pokechmp.c @@ -120,8 +120,8 @@ static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) /* Extra on Poke Champ (not on Pocket Gal) */ AM_RANGE(0x2000, 0x27ff) AM_READ(SMH_RAM) - AM_RANGE(0x4000, 0x5fff) AM_READ(SMH_BANK1) - AM_RANGE(0x6000, 0x7fff) AM_READ(SMH_BANK2) + AM_RANGE(0x4000, 0x5fff) AM_READ(SMH_BANK(1)) + AM_RANGE(0x6000, 0x7fff) AM_READ(SMH_BANK(2)) AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM) ADDRESS_MAP_END @@ -148,7 +148,7 @@ static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x2800, 0x2800) AM_DEVREAD("oki", okim6295_r) // extra AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_r) // AM_RANGE(0x3400, 0x3400) AM_READ(pokechmp_adpcm_reset_r) /* ? not sure */ - AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK3) + AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK(3)) AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM) ADDRESS_MAP_END diff --git a/src/mame/drivers/popeye.c b/src/mame/drivers/popeye.c index 25e4d947a24..f82f449c731 100644 --- a/src/mame/drivers/popeye.c +++ b/src/mame/drivers/popeye.c @@ -668,7 +668,7 @@ static DRIVER_INIT( skyskipr ) int len = 0x10000; /* decrypt the program ROMs */ - buffer = malloc_or_die(len); + buffer = alloc_array_or_die(UINT8, len); { int i; for (i = 0;i < len; i++) @@ -689,7 +689,7 @@ static DRIVER_INIT( popeye ) int len = 0x10000; /* decrypt the program ROMs */ - buffer = malloc_or_die(len); + buffer = alloc_array_or_die(UINT8, len); { int i; for (i = 0;i < len; i++) diff --git a/src/mame/drivers/ppmast93.c b/src/mame/drivers/ppmast93.c index 55c1cdac802..4c4230f916f 100644 --- a/src/mame/drivers/ppmast93.c +++ b/src/mame/drivers/ppmast93.c @@ -165,7 +165,7 @@ static WRITE8_HANDLER( ppmast93_port4_w ) static ADDRESS_MAP_START( ppmast93_cpu1_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) AM_WRITENOP AM_REGION("maincpu", 0x10000) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(ppmast93_bgram_w) AM_BASE(&ppmast93_bgram) AM_SHARE(1) AM_RANGE(0xd800, 0xdfff) AM_WRITENOP AM_RANGE(0xf000, 0xf7ff) AM_RAM_WRITE(ppmast93_fgram_w) AM_BASE(&ppmast93_fgram) AM_SHARE(2) diff --git a/src/mame/drivers/progolf.c b/src/mame/drivers/progolf.c index 4094532a616..3f3708d64f8 100644 --- a/src/mame/drivers/progolf.c +++ b/src/mame/drivers/progolf.c @@ -267,7 +267,7 @@ static DRIVER_INIT( progolf ) int A; const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); UINT8 *rom = memory_region(machine, "maincpu"); - UINT8* decrypted = auto_malloc(0x10000); + UINT8* decrypted = auto_alloc_array(machine, UINT8, 0x10000); memory_set_decrypted_region(space,0x0000,0xffff, decrypted); diff --git a/src/mame/drivers/psikyo.c b/src/mame/drivers/psikyo.c index 54985b25ee9..da37ba97bb5 100644 --- a/src/mame/drivers/psikyo.c +++ b/src/mame/drivers/psikyo.c @@ -407,7 +407,7 @@ static WRITE8_HANDLER( sngkace_sound_bankswitch_w ) static ADDRESS_MAP_START( sngkace_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x77ff) AM_READ(SMH_ROM ) // ROM AM_RANGE(0x7800, 0x7fff) AM_READ(SMH_RAM ) // RAM - AM_RANGE(0x8000, 0xffff) AM_READ(SMH_BANK1 ) // Banked ROM + AM_RANGE(0x8000, 0xffff) AM_READ(SMH_BANK(1) ) // Banked ROM ADDRESS_MAP_END static ADDRESS_MAP_START( sngkace_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 ) @@ -442,7 +442,7 @@ static WRITE8_HANDLER( gunbird_sound_bankswitch_w ) static ADDRESS_MAP_START( gunbird_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM ) // ROM AM_RANGE(0x8000, 0x81ff) AM_READ(SMH_RAM ) // RAM - AM_RANGE(0x8200, 0xffff) AM_READ(SMH_BANK1 ) // Banked ROM + AM_RANGE(0x8200, 0xffff) AM_READ(SMH_BANK(1) ) // Banked ROM ADDRESS_MAP_END static ADDRESS_MAP_START( gunbird_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 ) diff --git a/src/mame/drivers/psikyo4.c b/src/mame/drivers/psikyo4.c index d6ebac680ff..47e824cf047 100644 --- a/src/mame/drivers/psikyo4.c +++ b/src/mame/drivers/psikyo4.c @@ -393,7 +393,7 @@ static WRITE32_HANDLER( hotgmck_pcm_bank_w ) static ADDRESS_MAP_START( ps4_readmem, ADDRESS_SPACE_PROGRAM, 32 ) AM_RANGE(0x00000000, 0x000fffff) AM_READ(SMH_ROM) // program ROM (1 meg) - AM_RANGE(0x02000000, 0x021fffff) AM_READ(SMH_BANK1) // data ROM + AM_RANGE(0x02000000, 0x021fffff) AM_READ(SMH_BANK(1)) // data ROM AM_RANGE(0x03000000, 0x030037ff) AM_READ(SMH_RAM) AM_RANGE(0x03003fe0, 0x03003fe3) AM_READ(ps4_eeprom_r) AM_RANGE(0x03003fe4, 0x03003fe7) AM_READNOP // also writes to this address - might be vblank? @@ -406,7 +406,7 @@ static ADDRESS_MAP_START( ps4_readmem, ADDRESS_SPACE_PROGRAM, 32 ) #if ROMTEST AM_RANGE(0x05000004, 0x05000007) AM_READ(ps4_sample_r) // data for rom tests (Used to verify Sample rom) - AM_RANGE(0x03006000, 0x03007fff) AM_READ(SMH_BANK2) // data for rom tests (gfx), data is controlled by vidreg + AM_RANGE(0x03006000, 0x03007fff) AM_READ(SMH_BANK(2)) // data for rom tests (gfx), data is controlled by vidreg #endif ADDRESS_MAP_END diff --git a/src/mame/drivers/psikyosh.c b/src/mame/drivers/psikyosh.c index a7df4651978..a13127bee16 100644 --- a/src/mame/drivers/psikyosh.c +++ b/src/mame/drivers/psikyosh.c @@ -481,7 +481,7 @@ static READ32_HANDLER( psh_sample_r ) /* Send sample data for test */ static ADDRESS_MAP_START( ps3v1_readmem, ADDRESS_SPACE_PROGRAM, 32 ) AM_RANGE(0x00000000, 0x000fffff) AM_READ(SMH_ROM) // program ROM (1 meg) - AM_RANGE(0x02000000, 0x021fffff) AM_READ(SMH_BANK1) // data ROM + AM_RANGE(0x02000000, 0x021fffff) AM_READ(SMH_BANK(1)) // data ROM AM_RANGE(0x03000000, 0x03003fff) AM_READ(SMH_RAM) // sprites AM_RANGE(0x03004000, 0x0300ffff) AM_READ(SMH_RAM) AM_RANGE(0x03040000, 0x03044fff) AM_READ(SMH_RAM) @@ -495,8 +495,8 @@ static ADDRESS_MAP_START( ps3v1_readmem, ADDRESS_SPACE_PROGRAM, 32 ) #if ROMTEST AM_RANGE(0x05000004, 0x05000007) AM_READ(psh_sample_r) // data for rom tests (Used to verify Sample rom) - AM_RANGE(0x03060000, 0x0307ffff) AM_READ(SMH_BANK2) // data for rom tests (gfx), data is controlled by vidreg - AM_RANGE(0x04060000, 0x0407ffff) AM_READ(SMH_BANK2) // data for rom tests (gfx) (Mirrored?) + AM_RANGE(0x03060000, 0x0307ffff) AM_READ(SMH_BANK(2)) // data for rom tests (gfx), data is controlled by vidreg + AM_RANGE(0x04060000, 0x0407ffff) AM_READ(SMH_BANK(2)) // data for rom tests (gfx) (Mirrored?) #endif ADDRESS_MAP_END @@ -525,12 +525,12 @@ static ADDRESS_MAP_START( ps5_readmem, ADDRESS_SPACE_PROGRAM, 32 ) AM_RANGE(0x04050000, 0x040501ff) AM_READ(SMH_RAM) AM_RANGE(0x0405ffdc, 0x0405ffdf) AM_READNOP // also writes to this address - might be vblank reads? AM_RANGE(0x0405ffe0, 0x0405ffff) AM_READ(SMH_RAM) // video registers - AM_RANGE(0x05000000, 0x0507ffff) AM_READ(SMH_BANK1) // data ROM + AM_RANGE(0x05000000, 0x0507ffff) AM_READ(SMH_BANK(1)) // data ROM AM_RANGE(0x06000000, 0x060fffff) AM_READ(SMH_RAM) #if ROMTEST AM_RANGE(0x03100004, 0x03100007) AM_READ(psh_sample_r) // data for rom tests (Used to verify Sample rom) - AM_RANGE(0x04060000, 0x0407ffff) AM_READ(SMH_BANK2) // data for rom tests (gfx), data is controlled by vidreg + AM_RANGE(0x04060000, 0x0407ffff) AM_READ(SMH_BANK(2)) // data for rom tests (gfx), data is controlled by vidreg #endif ADDRESS_MAP_END diff --git a/src/mame/drivers/puckpkmn.c b/src/mame/drivers/puckpkmn.c index 90ad9872fb6..a3dceade83b 100644 --- a/src/mame/drivers/puckpkmn.c +++ b/src/mame/drivers/puckpkmn.c @@ -136,8 +136,8 @@ static ADDRESS_MAP_START( puckpkmn_readmem, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0x700022, 0x700023) AM_DEVREAD8("oki", okim6295_r, 0x00ff) /* M6295 Sound Chip Status Register */ AM_RANGE(0xa04000, 0xa04003) AM_DEVREAD8("ym", ym3438_r, 0xffff) /* Ym3438 Sound Chip Status Register */ AM_RANGE(0xc00000, 0xc0001f) AM_READ(genesis_vdp_r) /* VDP Access */ - AM_RANGE(0xe00000, 0xe1ffff) AM_READ(SMH_BANK1) /* VDP sees the roms here */ - AM_RANGE(0xfe0000, 0xfeffff) AM_READ(SMH_BANK2) /* VDP sees the ram here */ + AM_RANGE(0xe00000, 0xe1ffff) AM_READ(SMH_BANK(1)) /* VDP sees the roms here */ + AM_RANGE(0xfe0000, 0xfeffff) AM_READ(SMH_BANK(2)) /* VDP sees the ram here */ AM_RANGE(0xff0000, 0xffffff) AM_READ(SMH_RAM) /* Main Ram */ /* Unknown reads: */ diff --git a/src/mame/drivers/qix.c b/src/mame/drivers/qix.c index ea7636488b9..90d07157d03 100644 --- a/src/mame/drivers/qix.c +++ b/src/mame/drivers/qix.c @@ -1258,7 +1258,7 @@ static DRIVER_INIT( kram3 ) i = 0; patch = memory_region(machine, "user1"); rom = memory_region(machine, "maincpu"); - decrypted = auto_malloc(0x6000); + decrypted = auto_alloc_array(machine, UINT8, 0x6000); memory_set_decrypted_region(mainspace, 0xa000, 0xffff, decrypted); @@ -1272,7 +1272,7 @@ static DRIVER_INIT( kram3 ) patch = memory_region(machine, "user2"); size = memory_region_length(machine, "user2"); rom = memory_region(machine, "videocpu"); - decrypted = auto_malloc(0x6000); + decrypted = auto_alloc_array(machine, UINT8, 0x6000); memory_set_decrypted_region(videospace, 0xa000, 0xffff, decrypted); diff --git a/src/mame/drivers/quizo.c b/src/mame/drivers/quizo.c index 225d77234c7..d13267be4b9 100644 --- a/src/mame/drivers/quizo.c +++ b/src/mame/drivers/quizo.c @@ -244,7 +244,7 @@ ROM_END static DRIVER_INIT(quizo) { - videoram=auto_malloc(0x4000*2); + videoram=auto_alloc_array(machine, UINT8, 0x4000*2); } GAME( 1985, quizo, 0, quizo, quizo, quizo, ROT0, "Seoul Coin Corp.", "Quiz Olympic (set 1)", 0 ) diff --git a/src/mame/drivers/rabbit.c b/src/mame/drivers/rabbit.c index 4224a5cf86a..d5bda82ec73 100644 --- a/src/mame/drivers/rabbit.c +++ b/src/mame/drivers/rabbit.c @@ -339,14 +339,10 @@ static VIDEO_START(rabbit) { /* the tilemaps are bigger than the regions the cpu can see, need to allocate the ram here */ /* or maybe not for this game/hw .... */ - rabbit_tilemap_ram[0] = auto_malloc(0x20000); - rabbit_tilemap_ram[1] = auto_malloc(0x20000); - rabbit_tilemap_ram[2] = auto_malloc(0x20000); - rabbit_tilemap_ram[3] = auto_malloc(0x20000); - memset(rabbit_tilemap_ram[0], 0, 0x20000); - memset(rabbit_tilemap_ram[1], 0, 0x20000); - memset(rabbit_tilemap_ram[2], 0, 0x20000); - memset(rabbit_tilemap_ram[3], 0, 0x20000); + rabbit_tilemap_ram[0] = auto_alloc_array_clear(machine, UINT32, 0x20000/4); + rabbit_tilemap_ram[1] = auto_alloc_array_clear(machine, UINT32, 0x20000/4); + rabbit_tilemap_ram[2] = auto_alloc_array_clear(machine, UINT32, 0x20000/4); + rabbit_tilemap_ram[3] = auto_alloc_array_clear(machine, UINT32, 0x20000/4); rabbit_tilemap[0] = tilemap_create(machine, get_rabbit_tilemap0_tile_info,tilemap_scan_rows,16, 16, 128,32); rabbit_tilemap[1] = tilemap_create(machine, get_rabbit_tilemap1_tile_info,tilemap_scan_rows,16, 16, 128,32); @@ -356,7 +352,7 @@ static VIDEO_START(rabbit) tilemap_set_transparent_pen(rabbit_tilemap[1],0x0); tilemap_set_transparent_pen(rabbit_tilemap[2],0x0); tilemap_set_transparent_pen(rabbit_tilemap[3],0x0); - rabbit_sprite_bitmap = auto_bitmap_alloc(0x1000,0x1000,video_screen_get_format(machine->primary_screen)); + rabbit_sprite_bitmap = auto_bitmap_alloc(machine,0x1000,0x1000,video_screen_get_format(machine->primary_screen)); rabbit_sprite_clip.min_x = 0; rabbit_sprite_clip.max_x = 0x1000-1; rabbit_sprite_clip.min_y = 0; @@ -489,7 +485,7 @@ static ADDRESS_MAP_START( rabbit_readmem, ADDRESS_SPACE_PROGRAM, 32 ) AM_RANGE(0x400010, 0x400013) AM_READ(randomrabbits) // gfx chip status? AM_RANGE(0x400980, 0x400983) AM_READ(randomrabbits) // sound chip status? AM_RANGE(0x400984, 0x400987) AM_READ(randomrabbits) // sound chip status? - AM_RANGE(0x440000, 0x47ffff) AM_READ(SMH_BANK1) // roms read from here during testing + AM_RANGE(0x440000, 0x47ffff) AM_READ(SMH_BANK(1)) // roms read from here during testing /* tilemaps */ AM_RANGE(0x480000, 0x483fff) AM_READ(rabbit_tilemap0_r) AM_RANGE(0x484000, 0x487fff) AM_READ(rabbit_tilemap1_r) @@ -1108,14 +1104,10 @@ static VIDEO_START(tmmjprd) /* the tilemaps are bigger than the regions the cpu can see, need to allocate the ram here */ /* or maybe not for this game/hw .... */ - rabbit_tilemap_ram[0] = auto_malloc(0x20000); - rabbit_tilemap_ram[1] = auto_malloc(0x20000); - rabbit_tilemap_ram[2] = auto_malloc(0x20000); - rabbit_tilemap_ram[3] = auto_malloc(0x20000); - memset(rabbit_tilemap_ram[0], 0, 0x20000); - memset(rabbit_tilemap_ram[1], 0, 0x20000); - memset(rabbit_tilemap_ram[2], 0, 0x20000); - memset(rabbit_tilemap_ram[3], 0, 0x20000); + rabbit_tilemap_ram[0] = auto_alloc_array_clear(machine, UINT32, 0x20000/4); + rabbit_tilemap_ram[1] = auto_alloc_array_clear(machine, UINT32, 0x20000/4); + rabbit_tilemap_ram[2] = auto_alloc_array_clear(machine, UINT32, 0x20000/4); + rabbit_tilemap_ram[3] = auto_alloc_array_clear(machine, UINT32, 0x20000/4); rabbit_tilemap[0] = tilemap_create(machine, get_tmmjprd_tilemap0_tile_info,tilemap_scan_rows, 8, 8, 64, 64); rabbit_tilemap[1] = tilemap_create(machine, get_tmmjprd_tilemap1_tile_info,tilemap_scan_rows,16, 16, 64, 64); @@ -1125,7 +1117,7 @@ static VIDEO_START(tmmjprd) tilemap_set_transparent_pen(rabbit_tilemap[1],0x0); tilemap_set_transparent_pen(rabbit_tilemap[2],0x0); tilemap_set_transparent_pen(rabbit_tilemap[3],0x0); - rabbit_sprite_bitmap = auto_bitmap_alloc(0x1000,0x1000,video_screen_get_format(machine->primary_screen)); + rabbit_sprite_bitmap = auto_bitmap_alloc(machine,0x1000,0x1000,video_screen_get_format(machine->primary_screen)); rabbit_sprite_clip.min_x = 0; rabbit_sprite_clip.max_x = 0x1000-1; rabbit_sprite_clip.min_y = 0; diff --git a/src/mame/drivers/rainbow.c b/src/mame/drivers/rainbow.c index f953ad0ccf8..3a3db8a9ddb 100644 --- a/src/mame/drivers/rainbow.c +++ b/src/mame/drivers/rainbow.c @@ -360,7 +360,7 @@ static READ8_HANDLER( jumping_latch_r ) static ADDRESS_MAP_START( rainbow_s_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_ROM) - AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK5) + AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK(5)) AM_RANGE(0x8000, 0x8fff) AM_READ(SMH_RAM) AM_RANGE(0x9000, 0x9001) AM_DEVREAD("ym", ym2151_r) AM_RANGE(0x9002, 0x9100) AM_READ(SMH_RAM) diff --git a/src/mame/drivers/renegade.c b/src/mame/drivers/renegade.c index e1e12642432..43828dd10a1 100644 --- a/src/mame/drivers/renegade.c +++ b/src/mame/drivers/renegade.c @@ -543,7 +543,7 @@ static ADDRESS_MAP_START( main_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x3803, 0x3803) AM_READ_PORT("DSW1") /* DIP1 */ AM_RANGE(0x3804, 0x3804) AM_READ(mcu_r) AM_RANGE(0x3805, 0x3805) AM_READ(mcu_reset_r) - AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK1) + AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK(1)) AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM) ADDRESS_MAP_END diff --git a/src/mame/drivers/rmhaihai.c b/src/mame/drivers/rmhaihai.c index 9f8c70b8ea0..7c935685876 100644 --- a/src/mame/drivers/rmhaihai.c +++ b/src/mame/drivers/rmhaihai.c @@ -181,10 +181,10 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( themj_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0x9fff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0x9fff) AM_READ(SMH_BANK(1)) AM_RANGE(0xa000, 0xa7ff) AM_READ(SMH_RAM) AM_RANGE(0xa800, 0xb7ff) AM_READ(SMH_RAM) - AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_BANK2) + AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_BANK(2)) AM_RANGE(0xe000, 0xffff) AM_READ(SMH_ROM) ADDRESS_MAP_END diff --git a/src/mame/drivers/rockrage.c b/src/mame/drivers/rockrage.c index d819068eb0b..0f0a79ca102 100644 --- a/src/mame/drivers/rockrage.c +++ b/src/mame/drivers/rockrage.c @@ -111,7 +111,7 @@ static ADDRESS_MAP_START( rockrage_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x2e40, 0x2e40) AM_READ_PORT("DSW1") AM_RANGE(0x2e00, 0x2e00) AM_READ_PORT("SYSTEM") AM_RANGE(0x4000, 0x5fff) AM_READ(SMH_RAM) /* RAM */ - AM_RANGE(0x6000, 0x7fff) AM_READ(SMH_BANK1) /* banked ROM */ + AM_RANGE(0x6000, 0x7fff) AM_READ(SMH_BANK(1)) /* banked ROM */ AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM) /* ROM */ ADDRESS_MAP_END diff --git a/src/mame/drivers/rohga.c b/src/mame/drivers/rohga.c index dc04ca67aac..6d3a4ae7b9e 100644 --- a/src/mame/drivers/rohga.c +++ b/src/mame/drivers/rohga.c @@ -329,7 +329,7 @@ static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x120000, 0x120001) AM_DEVREAD("oki1", okim6295_r) AM_RANGE(0x130000, 0x130001) AM_DEVREAD("oki2", okim6295_r) AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r) - AM_RANGE(0x1f0000, 0x1f1fff) AM_READ(SMH_BANK8) + AM_RANGE(0x1f0000, 0x1f1fff) AM_READ(SMH_BANK(8)) ADDRESS_MAP_END static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 ) @@ -338,7 +338,7 @@ static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x110000, 0x110001) AM_DEVWRITE("ym", ym2151_w) AM_RANGE(0x120000, 0x120001) AM_DEVWRITE("oki1", okim6295_w) AM_RANGE(0x130000, 0x130001) AM_DEVWRITE("oki2", okim6295_w) - AM_RANGE(0x1f0000, 0x1f1fff) AM_WRITE(SMH_BANK8) + AM_RANGE(0x1f0000, 0x1f1fff) AM_WRITE(SMH_BANK(8)) AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE(h6280_timer_w) AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE(h6280_irq_status_w) ADDRESS_MAP_END diff --git a/src/mame/drivers/rollerg.c b/src/mame/drivers/rollerg.c index 628118180f4..752efc78851 100644 --- a/src/mame/drivers/rollerg.c +++ b/src/mame/drivers/rollerg.c @@ -94,7 +94,7 @@ static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x1000, 0x17ff) AM_READ(K053245_r) AM_RANGE(0x1800, 0x1fff) AM_READ(SMH_RAM) AM_RANGE(0x2000, 0x3aff) AM_READ(SMH_RAM) - AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK1) + AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK(1)) AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM) ADDRESS_MAP_END diff --git a/src/mame/drivers/roul.c b/src/mame/drivers/roul.c index 54a0e2dce50..62df553998f 100644 --- a/src/mame/drivers/roul.c +++ b/src/mame/drivers/roul.c @@ -180,8 +180,7 @@ ADDRESS_MAP_END static VIDEO_START(roul) { - videobuf = auto_malloc(VIDEOBUF_SIZE * sizeof(*videobuf)); - memset(videobuf, 0, VIDEOBUF_SIZE * sizeof(*videobuf)); + videobuf = auto_alloc_array_clear(machine, UINT8, VIDEOBUF_SIZE); } static VIDEO_UPDATE(roul) diff --git a/src/mame/drivers/royalmah.c b/src/mame/drivers/royalmah.c index 691fce529ed..a6b0ee75987 100644 --- a/src/mame/drivers/royalmah.c +++ b/src/mame/drivers/royalmah.c @@ -422,7 +422,7 @@ static WRITE8_HANDLER ( mjclub_bank_w ) static ADDRESS_MAP_START( royalmah_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE( 0x0000, 0x6fff ) AM_READWRITE( SMH_ROM, royalmah_rom_w ) AM_RANGE( 0x7000, 0x7fff ) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size) - AM_RANGE( 0x8000, 0xffff ) AM_READ( SMH_BANK1 ) // banked ROMs not present in royalmah + AM_RANGE( 0x8000, 0xffff ) AM_READ( SMH_BANK(1) ) // banked ROMs not present in royalmah AM_RANGE( 0x8000, 0xffff ) AM_WRITE( SMH_RAM ) AM_BASE(&videoram) ADDRESS_MAP_END @@ -432,7 +432,7 @@ static ADDRESS_MAP_START( mjapinky_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE( 0x7000, 0x77ff ) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size) AM_RANGE( 0x7800, 0x7fff ) AM_RAM AM_RANGE( 0x8000, 0x8000 ) AM_READ( mjapinky_dsw_r ) - AM_RANGE( 0x8000, 0xffff ) AM_READ( SMH_BANK1 ) + AM_RANGE( 0x8000, 0xffff ) AM_READ( SMH_BANK(1) ) AM_RANGE( 0x8000, 0xffff ) AM_WRITE( SMH_RAM ) AM_BASE(&videoram) ADDRESS_MAP_END @@ -709,7 +709,7 @@ static ADDRESS_MAP_START( janptr96_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE( 0x0000, 0x5fff) AM_ROM AM_RANGE( 0x6000, 0x6fff ) AM_RAMBANK(3) // nvram AM_RANGE( 0x7000, 0x7fff ) AM_RAMBANK(2) // banked nvram - AM_RANGE( 0x8000, 0xffff ) AM_READ(SMH_BANK1) + AM_RANGE( 0x8000, 0xffff ) AM_READ(SMH_BANK(1)) AM_RANGE( 0x8000, 0xffff ) AM_WRITE(SMH_RAM) AM_BASE(&videoram) ADDRESS_MAP_END @@ -981,7 +981,7 @@ static ADDRESS_MAP_START( mjtensin_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE( 0x6ff1, 0x6ff1 ) AM_WRITE( mjderngr_palbank_w ) AM_RANGE( 0x6ff3, 0x6ff3 ) AM_WRITE( mjtensin_6ff3_w ) AM_RANGE( 0x7000, 0x7fff ) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size) - AM_RANGE( 0x8000, 0xffff ) AM_READ( SMH_BANK1 ) + AM_RANGE( 0x8000, 0xffff ) AM_READ( SMH_BANK(1) ) AM_RANGE( 0x8000, 0xffff ) AM_WRITE( SMH_RAM ) AM_BASE(&videoram) ADDRESS_MAP_END @@ -1051,7 +1051,7 @@ static ADDRESS_MAP_START( cafetime_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE( 0x7fe3, 0x7fe3 ) AM_WRITE( cafetime_7fe3_w ) AM_RANGE( 0x7fe4, 0x7fe4 ) AM_READ( cafetime_7fe4_r ) AM_RANGE( 0x7ff0, 0x7fff ) AM_DEVREADWRITE("rtc", msm6242_r, msm6242_w) - AM_RANGE( 0x8000, 0xffff ) AM_READ( SMH_BANK1 ) + AM_RANGE( 0x8000, 0xffff ) AM_READ( SMH_BANK(1) ) AM_RANGE( 0x8000, 0xffff ) AM_WRITE( SMH_RAM ) AM_BASE(&videoram) ADDRESS_MAP_END @@ -4602,7 +4602,7 @@ static DRIVER_INIT( ippatsu ) { memory_set_bankptr(machine, 1, memory_region(mac static DRIVER_INIT( janptr96 ) { generic_nvram_size = 0x1000 * 9; - generic_nvram = auto_malloc( generic_nvram_size ); + generic_nvram = auto_alloc_array(machine, UINT8, generic_nvram_size ); memory_set_bankptr(machine, 3,generic_nvram); } diff --git a/src/mame/drivers/rungun.c b/src/mame/drivers/rungun.c index 5a2221eb2b1..e97e309db94 100644 --- a/src/mame/drivers/rungun.c +++ b/src/mame/drivers/rungun.c @@ -276,7 +276,7 @@ static INTERRUPT_GEN(audio_interrupt) static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK2) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(2)) AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_RAM) AM_RANGE(0xe000, 0xe22f) AM_DEVREAD("konami1", k054539_r) AM_RANGE(0xe230, 0xe3ff) AM_READ(SMH_RAM) diff --git a/src/mame/drivers/safarir.c b/src/mame/drivers/safarir.c index 137b49759cb..b70eca2caa6 100644 --- a/src/mame/drivers/safarir.c +++ b/src/mame/drivers/safarir.c @@ -186,8 +186,8 @@ static VIDEO_UPDATE( safarir ) static MACHINE_START( safarir ) { - ram_1 = auto_malloc(ram_size); - ram_2 = auto_malloc(ram_size); + ram_1 = auto_alloc_array(machine, UINT8, ram_size); + ram_2 = auto_alloc_array(machine, UINT8, ram_size); /* setup for save states */ state_save_register_global_pointer(machine, ram_1, ram_size); diff --git a/src/mame/drivers/sandscrp.c b/src/mame/drivers/sandscrp.c index 7c9ed08bc3c..133e2ca93c0 100644 --- a/src/mame/drivers/sandscrp.c +++ b/src/mame/drivers/sandscrp.c @@ -265,7 +265,7 @@ static WRITE8_HANDLER( sandscrp_soundlatch_w ) static ADDRESS_MAP_START( sandscrp_soundmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM // ROM - AM_RANGE(0x8000, 0xbfff) AM_READWRITE(SMH_BANK1, SMH_ROM) // Banked ROM + AM_RANGE(0x8000, 0xbfff) AM_READWRITE(SMH_BANK(1), SMH_ROM) // Banked ROM AM_RANGE(0xc000, 0xdfff) AM_RAM // RAM ADDRESS_MAP_END diff --git a/src/mame/drivers/sangho.c b/src/mame/drivers/sangho.c index 9e1ff484f4f..2e26303cf27 100644 --- a/src/mame/drivers/sangho.c +++ b/src/mame/drivers/sangho.c @@ -61,10 +61,10 @@ static WRITE8_HANDLER(sangho_ram_w) static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0xffff) AM_WRITE(sangho_ram_w) - AM_RANGE(0x0000, 0x3fff) AM_READ( SMH_BANK1 ) - AM_RANGE(0x4000, 0x7fff) AM_READ( SMH_BANK2 ) - AM_RANGE(0x8000, 0xbfff) AM_READ( SMH_BANK3 ) - AM_RANGE(0xc000, 0xffff) AM_READ( SMH_BANK4 ) + AM_RANGE(0x0000, 0x3fff) AM_READ( SMH_BANK(1) ) + AM_RANGE(0x4000, 0x7fff) AM_READ( SMH_BANK(2) ) + AM_RANGE(0x8000, 0xbfff) AM_READ( SMH_BANK(3) ) + AM_RANGE(0xc000, 0xffff) AM_READ( SMH_BANK(4) ) ADDRESS_MAP_END /* Wrong ! */ @@ -324,7 +324,7 @@ ROM_END static DRIVER_INIT(sangho) { - sangho_ram = auto_malloc(0x20000); + sangho_ram = auto_alloc_array(machine, UINT8, 0x20000); } GAME( 1991, pzlestar, 0, pzlestar, sangho, sangho, ROT270, "Sang Ho Soft", "Puzzle Star (Sang Ho Soft)", GAME_NOT_WORKING ) diff --git a/src/mame/drivers/sbowling.c b/src/mame/drivers/sbowling.c index 5c59b1a3a11..c5aa302f939 100644 --- a/src/mame/drivers/sbowling.c +++ b/src/mame/drivers/sbowling.c @@ -104,7 +104,7 @@ static VIDEO_UPDATE(sbowling) static VIDEO_START(sbowling) { - tmpbitmap = auto_bitmap_alloc(32*8,32*8,video_screen_get_format(machine->primary_screen)); + tmpbitmap = auto_bitmap_alloc(machine,32*8,32*8,video_screen_get_format(machine->primary_screen)); sb_tilemap = tilemap_create(machine, get_sb_tile_info, tilemap_scan_rows, 8, 8, 32, 32); } diff --git a/src/mame/drivers/seattle.c b/src/mame/drivers/seattle.c index 19ec6cb87cf..37ffd07b4dc 100644 --- a/src/mame/drivers/seattle.c +++ b/src/mame/drivers/seattle.c @@ -2777,7 +2777,7 @@ static void init_common(running_machine *machine, int ioasic, int serialnum, int { case PHOENIX_CONFIG: /* original Phoenix board only has 4MB of RAM */ - memory_install_readwrite32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x00400000, 0x007fffff, 0, 0, SMH_UNMAP, SMH_UNMAP); + memory_install_readwrite32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x00400000, 0x007fffff, 0, 0, (read32_space_func)SMH_UNMAP, (write32_space_func)SMH_UNMAP); break; case SEATTLE_WIDGET_CONFIG: diff --git a/src/mame/drivers/segac2.c b/src/mame/drivers/segac2.c index 3711001a6bf..63872bfd670 100644 --- a/src/mame/drivers/segac2.c +++ b/src/mame/drivers/segac2.c @@ -1341,10 +1341,10 @@ static VIDEO_START(segac2_new) VIDEO_START_CALL(megadriv); - megadrive_vdp_palette_lookup = auto_malloc(0x1000); - megadrive_vdp_palette_lookup_sprite = auto_malloc(0x1000); - megadrive_vdp_palette_lookup_shadow = auto_malloc(0x1000); - megadrive_vdp_palette_lookup_highlight = auto_malloc(0x1000); + megadrive_vdp_palette_lookup = auto_alloc_array(machine, UINT16, 0x1000/2); + megadrive_vdp_palette_lookup_sprite = auto_alloc_array(machine, UINT16, 0x1000/2); + megadrive_vdp_palette_lookup_shadow = auto_alloc_array(machine, UINT16, 0x1000/2); + megadrive_vdp_palette_lookup_highlight = auto_alloc_array(machine, UINT16, 0x1000/2); } static VIDEO_UPDATE(segac2_new) @@ -2088,7 +2088,7 @@ static DRIVER_INIT( tfrceacb ) { /* disable the palette bank switching from the protection chip */ segac2_common_init(machine, NULL); - memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x800000, 0x800001, 0, 0, SMH_NOP); + memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x800000, 0x800001, 0, 0, (write16_space_func)SMH_NOP); } static DRIVER_INIT( borench ) diff --git a/src/mame/drivers/segae.c b/src/mame/drivers/segae.c index 950f2a5bfac..01509a39c85 100644 --- a/src/mame/drivers/segae.c +++ b/src/mame/drivers/segae.c @@ -330,7 +330,7 @@ ADDRESS_MAP_END /* we have to fill in the ROM addresses for systeme due to the encrypted games */ static ADDRESS_MAP_START( systeme_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) /* Fixed ROM */ - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) /* Banked ROM */ + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) /* Banked ROM */ // AM_RANGE(0x0000 , 0xbfff) AM_READ(SMH_ROM) // AM_RANGE(0xc000 , 0xdfff) AM_READ(SMH_RAM) AM_MIRROR(0x2000) @@ -658,8 +658,7 @@ static void *start_vdp(running_machine *machine, int type) { struct sms_vdp *chip; - chip = auto_malloc(sizeof(*chip)); - memset(chip, 0, sizeof(*chip)); + chip = auto_alloc_clear(machine, struct sms_vdp); chip->vdp_type = type; @@ -684,35 +683,30 @@ static void *start_vdp(running_machine *machine, int type) chip->regs[0xa] = 0; /* b-f don't matter */ chip->readbuf = 0; - chip->vram = auto_malloc(0x4000); - memset(chip->vram,0x00,0x4000); + chip->vram = auto_alloc_array_clear(machine, UINT8, 0x4000); //printf("%d\n", (*chip->set_irq)(machine, 200)); if (chip->vdp_type==GG_VDP) { - chip->cram = auto_malloc(0x0040); - memset(chip->cram,0x00,0x0040); - chip->cram_mamecolours = auto_malloc(0x0080); - memset(chip->cram_mamecolours,0x00,0x0080); + chip->cram = auto_alloc_array_clear(machine, UINT8, 0x0040); + chip->cram_mamecolours = auto_alloc_array_clear(machine, UINT16, 0x0080/2); chip->gg_cram_latch = 0; } else { - chip->cram = auto_malloc(0x0020); - memset(chip->cram,0x00,0x0020); - chip->cram_mamecolours = auto_malloc(0x0040); - memset(chip->cram_mamecolours,0x00,0x0040); + chip->cram = auto_alloc_array_clear(machine, UINT8, 0x0020); + chip->cram_mamecolours = auto_alloc_array(machine, UINT16, 0x0040/2); } - chip->tile_renderline = auto_malloc(256+8); + chip->tile_renderline = auto_alloc_array(machine, UINT8, 256+8); memset(chip->tile_renderline,0x00,256+8); - chip->sprite_renderline = auto_malloc(256+32); + chip->sprite_renderline = auto_alloc_array(machine, UINT8, 256+32); memset(chip->sprite_renderline,0x00,256+32); chip->writemode = 0; - chip->r_bitmap = auto_bitmap_alloc(256, 256, BITMAP_FORMAT_RGB15); + chip->r_bitmap = auto_bitmap_alloc(machine, 256, 256, BITMAP_FORMAT_RGB15); chip->sms_scanline_timer = timer_alloc(machine, sms_scanline_timer_callback, chip); @@ -2189,8 +2183,8 @@ static void init_systeme_map(running_machine *machine) // memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0xffff, 0, 0, z80_unmapped_r, z80_unmapped_w); /* fixed rom bank area */ -// sms_rom = auto_malloc(0xc000); -// memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0xbfff, 0, 0, SMH_BANK1, SMH_UNMAP); +// sms_rom = auto_alloc_array(machine, UINT8, 0xc000); +// memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0xbfff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_UNMAP); // memory_set_bankptr(machine, 1, sms_rom ); memory_configure_bank(machine, 1, 0, 16, memory_region(machine, "z80") + 0x10000, 0x4000); @@ -2202,8 +2196,8 @@ static void init_systeme_map(running_machine *machine) // memcpy(sms_rom, memory_region(machine, "user1"), 0x8000); /* main ram area */ - sms_mainram = auto_malloc(0x4000); - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc000, 0xffff, 0, 0, SMH_BANK2, SMH_BANK2); + sms_mainram = auto_alloc_array(machine, UINT8, 0x4000); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc000, 0xffff, 0, 0, (read8_space_func)SMH_BANK(2), (write8_space_func)SMH_BANK(2)); memory_set_bankptr(machine, 2, sms_mainram ); memset(sms_mainram,0x00,0x4000); @@ -2234,7 +2228,7 @@ DRIVER_INIT( megatech_bios ) vdp1->chip_id = 1; vdp1_vram_bank0 = vdp1->vram; - vdp1_vram_bank1 = auto_malloc(0x4000); + vdp1_vram_bank1 = auto_alloc_array(machine, UINT8, 0x4000); } static DRIVER_INIT( segasyse ) @@ -2249,7 +2243,7 @@ static DRIVER_INIT( segasyse ) vdp1->chip_id = 1; vdp1_vram_bank0 = vdp1->vram; - vdp1_vram_bank1 = auto_malloc(0x4000); + vdp1_vram_bank1 = auto_alloc_array(machine, UINT8, 0x4000); vdp2 = start_vdp(machine, SMS2_VDP); @@ -2260,7 +2254,7 @@ static DRIVER_INIT( segasyse ) vdp2->chip_id = 2; vdp2_vram_bank0 = vdp2->vram; - vdp2_vram_bank1 = auto_malloc(0x4000); + vdp2_vram_bank1 = auto_alloc_array(machine, UINT8, 0x4000); } /*- Hang On Jr. Specific -*/ diff --git a/src/mame/drivers/segag80r.c b/src/mame/drivers/segag80r.c index a6ce32e3e28..0c80db7ffe9 100644 --- a/src/mame/drivers/segag80r.c +++ b/src/mame/drivers/segag80r.c @@ -1396,7 +1396,7 @@ static void monsterb_expand_gfx(running_machine *machine, const char *region) /* expand the background ROMs; A11/A12 of each ROM is independently controlled via */ /* banking */ dest = memory_region(machine, region); - temp = malloc_or_die(0x4000); + temp = alloc_array_or_die(UINT8, 0x4000); memcpy(temp, dest, 0x4000); /* 16 effective total banks */ diff --git a/src/mame/drivers/segahang.c b/src/mame/drivers/segahang.c index 24b38b5e1a6..7da10f5ffcf 100644 --- a/src/mame/drivers/segahang.c +++ b/src/mame/drivers/segahang.c @@ -1733,7 +1733,7 @@ static DRIVER_INIT( endurobl ) { const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); UINT16 *rom = (UINT16 *)memory_region(machine, "maincpu"); - UINT16 *decrypt = (UINT16 *)auto_malloc(0x40000); + UINT16 *decrypt = auto_alloc_array(machine, UINT16, 0x40000/2); hangon_generic_init(); memory_set_decrypted_region(space, 0x000000, 0x03ffff, decrypt); @@ -1747,7 +1747,7 @@ static DRIVER_INIT( endurob2 ) { const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); UINT16 *rom = (UINT16 *)memory_region(machine, "maincpu"); - UINT16 *decrypt = (UINT16 *)auto_malloc(0x40000); + UINT16 *decrypt = auto_alloc_array(machine, UINT16, 0x40000/2); hangon_generic_init(); memory_set_decrypted_region(space, 0x000000, 0x03ffff, decrypt); diff --git a/src/mame/drivers/segaorun.c b/src/mame/drivers/segaorun.c index ff61defbdbd..c1552ec2a2e 100644 --- a/src/mame/drivers/segaorun.c +++ b/src/mame/drivers/segaorun.c @@ -98,16 +98,16 @@ static const ppi8255_interface single_ppi_intf = static const segaic16_memory_map_entry outrun_info[] = { { 0x35/2, 0x90000, 0x10000, 0xf00000, ~0, segaic16_road_control_0_r, segaic16_road_control_0_w, NULL, "road control" }, - { 0x35/2, 0x80000, 0x01000, 0xf0f000, ~0, SMH_BANK10, SMH_BANK10, &segaic16_roadram_0, "road RAM" }, - { 0x35/2, 0x60000, 0x08000, 0xf18000, ~0, SMH_BANK11, SMH_BANK11, &cpu1ram, "CPU 1 RAM" }, - { 0x35/2, 0x00000, 0x60000, 0xf00000, ~0, SMH_BANK12, SMH_UNMAP, &cpu1rom, "CPU 1 ROM" }, + { 0x35/2, 0x80000, 0x01000, 0xf0f000, ~0, SMH_BANK(10), SMH_BANK(10), &segaic16_roadram_0, "road RAM" }, + { 0x35/2, 0x60000, 0x08000, 0xf18000, ~0, SMH_BANK(11), SMH_BANK(11), &cpu1ram, "CPU 1 RAM" }, + { 0x35/2, 0x00000, 0x60000, 0xf00000, ~0, SMH_BANK(12), SMH_UNMAP, &cpu1rom, "CPU 1 ROM" }, { 0x31/2, 0x00000, 0x04000, 0xffc000, ~0, misc_io_r, misc_io_w, NULL, "I/O space" }, - { 0x2d/2, 0x00000, 0x01000, 0xfff000, ~0, SMH_BANK13, SMH_BANK13, &segaic16_spriteram_0, "object RAM" }, - { 0x29/2, 0x00000, 0x02000, 0xffe000, ~0, SMH_BANK14, segaic16_paletteram_w, &paletteram16, "color RAM" }, - { 0x25/2, 0x00000, 0x10000, 0xfe0000, ~0, SMH_BANK15, segaic16_tileram_0_w, &segaic16_tileram_0, "tile RAM" }, - { 0x25/2, 0x10000, 0x01000, 0xfef000, ~0, SMH_BANK16, segaic16_textram_0_w, &segaic16_textram_0, "text RAM" }, - { 0x21/2, 0x60000, 0x08000, 0xf98000, ~0, SMH_BANK17, SMH_BANK17, &workram, "CPU 0 RAM" }, - { 0x21/2, 0x00000, 0x60000, 0xf80000, 0x00000, SMH_BANK18, SMH_UNMAP, NULL, "CPU 0 ROM" }, + { 0x2d/2, 0x00000, 0x01000, 0xfff000, ~0, SMH_BANK(13), SMH_BANK(13), &segaic16_spriteram_0, "object RAM" }, + { 0x29/2, 0x00000, 0x02000, 0xffe000, ~0, SMH_BANK(14), segaic16_paletteram_w, &paletteram16, "color RAM" }, + { 0x25/2, 0x00000, 0x10000, 0xfe0000, ~0, SMH_BANK(15), segaic16_tileram_0_w, &segaic16_tileram_0, "tile RAM" }, + { 0x25/2, 0x10000, 0x01000, 0xfef000, ~0, SMH_BANK(16), segaic16_textram_0_w, &segaic16_textram_0, "text RAM" }, + { 0x21/2, 0x60000, 0x08000, 0xf98000, ~0, SMH_BANK(17), SMH_BANK(17), &workram, "CPU 0 RAM" }, + { 0x21/2, 0x00000, 0x60000, 0xf80000, 0x00000, SMH_BANK(18), SMH_UNMAP, NULL, "CPU 0 ROM" }, { 0 } }; @@ -144,11 +144,11 @@ static READ8_HANDLER( sound_data_r ) static void outrun_generic_init(running_machine *machine) { /* allocate memory for regions not automatically assigned */ - segaic16_spriteram_0 = auto_malloc(0x01000); - paletteram16 = auto_malloc(0x02000); - segaic16_tileram_0 = auto_malloc(0x10000); - segaic16_textram_0 = auto_malloc(0x01000); - workram = auto_malloc(0x08000); + segaic16_spriteram_0 = auto_alloc_array(machine, UINT16, 0x01000/2); + paletteram16 = auto_alloc_array(machine, UINT16, 0x02000/2); + segaic16_tileram_0 = auto_alloc_array(machine, UINT16, 0x10000/2); + segaic16_textram_0 = auto_alloc_array(machine, UINT16, 0x01000/2); + workram = auto_alloc_array(machine, UINT16, 0x08000/2); /* init the memory mapper */ segaic16_memory_mapper_init(cputag_get_cpu(machine, "maincpu"), outrun_info, sound_data_w, NULL); diff --git a/src/mame/drivers/segas16b.c b/src/mame/drivers/segas16b.c index eb4722f22ea..c1e2b8789d0 100644 --- a/src/mame/drivers/segas16b.c +++ b/src/mame/drivers/segas16b.c @@ -951,70 +951,70 @@ static WRITE16_HANDLER( atomicp_sound_w ); static const segaic16_memory_map_entry rom_171_5358_info_small[] = { { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, misc_io_r, misc_io_w, NULL, "I/O space" }, - { 0x39/2, 0x00000, 0x01000, 0xfff000, ~0, SMH_BANK10, segaic16_paletteram_w, &paletteram16, "color RAM" }, - { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, SMH_BANK11, segaic16_tileram_0_w, &segaic16_tileram_0, "tile RAM" }, - { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, SMH_BANK12, segaic16_textram_0_w, &segaic16_textram_0, "text RAM" }, - { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, SMH_BANK13, SMH_BANK13, &segaic16_spriteram_0, "object RAM" }, - { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, SMH_BANK14, SMH_BANK14, &workram, "work RAM" }, - { 0x29/2, 0x00000, 0x20000, 0xfe0000, 0x20000, SMH_BANK15, SMH_UNMAP, NULL, "ROM 2" }, - { 0x25/2, 0x00000, 0x20000, 0xfe0000, 0x10000, SMH_BANK16, SMH_UNMAP, NULL, "ROM 1" }, - { 0x21/2, 0x00000, 0x20000, 0xfe0000, 0x00000, SMH_BANK17, SMH_UNMAP, NULL, "ROM 0" }, + { 0x39/2, 0x00000, 0x01000, 0xfff000, ~0, SMH_BANK(10), segaic16_paletteram_w, &paletteram16, "color RAM" }, + { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, SMH_BANK(11), segaic16_tileram_0_w, &segaic16_tileram_0, "tile RAM" }, + { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, SMH_BANK(12), segaic16_textram_0_w, &segaic16_textram_0, "text RAM" }, + { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, SMH_BANK(13), SMH_BANK(13), &segaic16_spriteram_0, "object RAM" }, + { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, SMH_BANK(14), SMH_BANK(14), &workram, "work RAM" }, + { 0x29/2, 0x00000, 0x20000, 0xfe0000, 0x20000, SMH_BANK(15), SMH_UNMAP, NULL, "ROM 2" }, + { 0x25/2, 0x00000, 0x20000, 0xfe0000, 0x10000, SMH_BANK(16), SMH_UNMAP, NULL, "ROM 1" }, + { 0x21/2, 0x00000, 0x20000, 0xfe0000, 0x00000, SMH_BANK(17), SMH_UNMAP, NULL, "ROM 0" }, { 0 } }; static const segaic16_memory_map_entry rom_171_5358_info[] = { { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, misc_io_r, misc_io_w, NULL, "I/O space" }, - { 0x39/2, 0x00000, 0x01000, 0xfff000, ~0, SMH_BANK10, segaic16_paletteram_w, &paletteram16, "color RAM" }, - { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, SMH_BANK11, segaic16_tileram_0_w, &segaic16_tileram_0, "tile RAM" }, - { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, SMH_BANK12, segaic16_textram_0_w, &segaic16_textram_0, "text RAM" }, - { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, SMH_BANK13, SMH_BANK13, &segaic16_spriteram_0, "object RAM" }, - { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, SMH_BANK14, SMH_BANK14, &workram, "work RAM" }, - { 0x29/2, 0x00000, 0x20000, 0xfe0000, 0x40000, SMH_BANK15, SMH_UNMAP, NULL, "ROM 2" }, - { 0x25/2, 0x00000, 0x20000, 0xfe0000, 0x20000, SMH_BANK16, SMH_UNMAP, NULL, "ROM 1" }, - { 0x21/2, 0x00000, 0x20000, 0xfe0000, 0x00000, SMH_BANK17, SMH_UNMAP, NULL, "ROM 0" }, + { 0x39/2, 0x00000, 0x01000, 0xfff000, ~0, SMH_BANK(10), segaic16_paletteram_w, &paletteram16, "color RAM" }, + { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, SMH_BANK(11), segaic16_tileram_0_w, &segaic16_tileram_0, "tile RAM" }, + { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, SMH_BANK(12), segaic16_textram_0_w, &segaic16_textram_0, "text RAM" }, + { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, SMH_BANK(13), SMH_BANK(13), &segaic16_spriteram_0, "object RAM" }, + { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, SMH_BANK(14), SMH_BANK(14), &workram, "work RAM" }, + { 0x29/2, 0x00000, 0x20000, 0xfe0000, 0x40000, SMH_BANK(15), SMH_UNMAP, NULL, "ROM 2" }, + { 0x25/2, 0x00000, 0x20000, 0xfe0000, 0x20000, SMH_BANK(16), SMH_UNMAP, NULL, "ROM 1" }, + { 0x21/2, 0x00000, 0x20000, 0xfe0000, 0x00000, SMH_BANK(17), SMH_UNMAP, NULL, "ROM 0" }, { 0 } }; static const segaic16_memory_map_entry rom_171_5704_info[] = { { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, misc_io_r, misc_io_w, NULL, "I/O space" }, - { 0x39/2, 0x00000, 0x01000, 0xfff000, ~0, SMH_BANK10, segaic16_paletteram_w, &paletteram16, "color RAM" }, - { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, SMH_BANK11, segaic16_tileram_0_w, &segaic16_tileram_0, "tile RAM" }, - { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, SMH_BANK12, segaic16_textram_0_w, &segaic16_textram_0, "text RAM" }, - { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, SMH_BANK13, SMH_BANK13, &segaic16_spriteram_0, "object RAM" }, - { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, SMH_BANK14, SMH_BANK14, &workram, "work RAM" }, + { 0x39/2, 0x00000, 0x01000, 0xfff000, ~0, SMH_BANK(10), segaic16_paletteram_w, &paletteram16, "color RAM" }, + { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, SMH_BANK(11), segaic16_tileram_0_w, &segaic16_tileram_0, "tile RAM" }, + { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, SMH_BANK(12), segaic16_textram_0_w, &segaic16_textram_0, "text RAM" }, + { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, SMH_BANK(13), SMH_BANK(13), &segaic16_spriteram_0, "object RAM" }, + { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, SMH_BANK(14), SMH_BANK(14), &workram, "work RAM" }, { 0x29/2, 0x00000, 0x10000, 0xff0000, ~0, NULL, rom_5704_bank_w, NULL, "tile bank" }, - { 0x25/2, 0x00000, 0x80000, 0xfc0000, 0x80000, SMH_BANK16, SMH_UNMAP, NULL, "ROM 1" }, - { 0x21/2, 0x00000, 0x80000, 0xfc0000, 0x00000, SMH_BANK17, SMH_UNMAP, NULL, "ROM 0" }, + { 0x25/2, 0x00000, 0x80000, 0xfc0000, 0x80000, SMH_BANK(16), SMH_UNMAP, NULL, "ROM 1" }, + { 0x21/2, 0x00000, 0x80000, 0xfc0000, 0x00000, SMH_BANK(17), SMH_UNMAP, NULL, "ROM 0" }, { 0 } }; static const segaic16_memory_map_entry rom_atomicp_info[] = { { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, misc_io_r, misc_io_w, NULL, "I/O space" }, - { 0x39/2, 0x00000, 0x01000, 0xfff000, ~0, SMH_BANK10, segaic16_paletteram_w, &paletteram16, "color RAM" }, - { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, SMH_BANK11, segaic16_tileram_0_w, &segaic16_tileram_0, "tile RAM" }, - { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, SMH_BANK12, segaic16_textram_0_w, &segaic16_textram_0, "text RAM" }, - { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, SMH_BANK13, SMH_BANK13, &segaic16_spriteram_0, "object RAM" }, - { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, SMH_BANK14, SMH_BANK14, &workram, "work RAM" }, + { 0x39/2, 0x00000, 0x01000, 0xfff000, ~0, SMH_BANK(10), segaic16_paletteram_w, &paletteram16, "color RAM" }, + { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, SMH_BANK(11), segaic16_tileram_0_w, &segaic16_tileram_0, "tile RAM" }, + { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, SMH_BANK(12), segaic16_textram_0_w, &segaic16_textram_0, "text RAM" }, + { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, SMH_BANK(13), SMH_BANK(13), &segaic16_spriteram_0, "object RAM" }, + { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, SMH_BANK(14), SMH_BANK(14), &workram, "work RAM" }, { 0x29/2, 0x00000, 0x10000, 0xff0000, ~0, NULL, rom_5704_bank_w, NULL, "tile bank" }, { 0x25/2, 0x00000, 0x10000, 0xff0000, ~0, NULL, atomicp_sound_w, NULL, "sound" }, - { 0x21/2, 0x00000, 0x80000, 0xfc0000, 0x00000, SMH_BANK17, SMH_UNMAP, NULL, "ROM 0" }, + { 0x21/2, 0x00000, 0x80000, 0xfc0000, 0x00000, SMH_BANK(17), SMH_UNMAP, NULL, "ROM 0" }, { 0 } }; static const segaic16_memory_map_entry rom_171_5797_info[] = { { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, misc_io_r, misc_io_w, NULL, "I/O space" }, - { 0x39/2, 0x00000, 0x01000, 0xfff000, ~0, SMH_BANK10, segaic16_paletteram_w, &paletteram16, "color RAM" }, - { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, SMH_BANK11, segaic16_tileram_0_w, &segaic16_tileram_0, "tile RAM" }, - { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, SMH_BANK12, segaic16_textram_0_w, &segaic16_textram_0, "text RAM" }, - { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, SMH_BANK13, SMH_BANK13, &segaic16_spriteram_0, "object RAM" }, - { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, SMH_BANK14, SMH_BANK14, &workram, "work RAM" }, + { 0x39/2, 0x00000, 0x01000, 0xfff000, ~0, SMH_BANK(10), segaic16_paletteram_w, &paletteram16, "color RAM" }, + { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, SMH_BANK(11), segaic16_tileram_0_w, &segaic16_tileram_0, "tile RAM" }, + { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, SMH_BANK(12), segaic16_textram_0_w, &segaic16_textram_0, "text RAM" }, + { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, SMH_BANK(13), SMH_BANK(13), &segaic16_spriteram_0, "object RAM" }, + { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, SMH_BANK(14), SMH_BANK(14), &workram, "work RAM" }, { 0x29/2, 0x00000, 0x10000, 0xff0000, ~0, unknown_rgn2_r, unknown_rgn2_w, NULL, "???" }, { 0x25/2, 0x00000, 0x04000, 0xffc000, ~0, rom_5797_bank_math_r, rom_5797_bank_math_w, NULL, "tile bank/math" }, - { 0x21/2, 0x00000, 0x80000, 0xf80000, 0x00000, SMH_BANK17, SMH_UNMAP, NULL, "ROM 0" }, + { 0x21/2, 0x00000, 0x80000, 0xf80000, 0x00000, SMH_BANK(17), SMH_UNMAP, NULL, "ROM 0" }, { 0 } }; @@ -1052,11 +1052,11 @@ static void system16b_generic_init(running_machine *machine, int _rom_board) rom_board = _rom_board; /* allocate memory for regions not autmatically assigned */ - segaic16_spriteram_0 = auto_malloc(0x00800); - paletteram16 = auto_malloc(0x01000); - segaic16_tileram_0 = auto_malloc(0x10000); - segaic16_textram_0 = auto_malloc(0x01000); - workram = auto_malloc(0x04000); + segaic16_spriteram_0 = auto_alloc_array(machine, UINT16, 0x00800/2); + paletteram16 = auto_alloc_array(machine, UINT16, 0x01000/2); + segaic16_tileram_0 = auto_alloc_array(machine, UINT16, 0x10000/2); + segaic16_textram_0 = auto_alloc_array(machine, UINT16, 0x01000/2); + workram = auto_alloc_array(machine, UINT16, 0x04000/2); /* init the memory mapper */ segaic16_memory_mapper_init(cputag_get_cpu(machine, "maincpu"), region_info_list[rom_board], sound_w, NULL); diff --git a/src/mame/drivers/segas18.c b/src/mame/drivers/segas18.c index 604276bce7c..0348d248cf6 100644 --- a/src/mame/drivers/segas18.c +++ b/src/mame/drivers/segas18.c @@ -93,42 +93,42 @@ static WRITE16_HANDLER( rom_5987_bank_w ); static const segaic16_memory_map_entry rom_171_shad_info[] = { { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, misc_io_r, misc_io_w, NULL, "I/O space" }, - { 0x39/2, 0x00000, 0x02000, 0xffe000, ~0, SMH_BANK10, segaic16_paletteram_w, &paletteram16, "color RAM" }, - { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, SMH_BANK11, segaic16_tileram_0_w, &segaic16_tileram_0, "tile RAM" }, - { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, SMH_BANK12, segaic16_textram_0_w, &segaic16_textram_0, "text RAM" }, - { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, SMH_BANK13, SMH_BANK13, &segaic16_spriteram_0, "object RAM" }, - { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, SMH_BANK14, SMH_BANK14, &workram, "work RAM" }, + { 0x39/2, 0x00000, 0x02000, 0xffe000, ~0, SMH_BANK(10), segaic16_paletteram_w, &paletteram16, "color RAM" }, + { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, SMH_BANK(11), segaic16_tileram_0_w, &segaic16_tileram_0, "tile RAM" }, + { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, SMH_BANK(12), segaic16_textram_0_w, &segaic16_textram_0, "text RAM" }, + { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, SMH_BANK(13), SMH_BANK(13), &segaic16_spriteram_0, "object RAM" }, + { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, SMH_BANK(14), SMH_BANK(14), &workram, "work RAM" }, { 0x29/2, 0x00000, 0x10000, 0xff0000, ~0, NULL, NULL, NULL, "????" }, { 0x25/2, 0x00000, 0x00010, 0xfffff0, ~0, genesis_vdp_r, genesis_vdp_w, NULL, "VDP" }, - { 0x21/2, 0x00000, 0x80000, 0xf80000, 0x00000, SMH_BANK17, SMH_UNMAP, NULL, "ROM 0" }, + { 0x21/2, 0x00000, 0x80000, 0xf80000, 0x00000, SMH_BANK(17), SMH_UNMAP, NULL, "ROM 0" }, { 0 } }; static const segaic16_memory_map_entry rom_171_5874_info[] = { { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, misc_io_r, misc_io_w, NULL, "I/O space" }, - { 0x39/2, 0x00000, 0x02000, 0xffe000, ~0, SMH_BANK10, segaic16_paletteram_w, &paletteram16, "color RAM" }, - { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, SMH_BANK11, segaic16_tileram_0_w, &segaic16_tileram_0, "tile RAM" }, - { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, SMH_BANK12, segaic16_textram_0_w, &segaic16_textram_0, "text RAM" }, - { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, SMH_BANK13, SMH_BANK13, &segaic16_spriteram_0, "object RAM" }, - { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, SMH_BANK14, SMH_BANK14, &workram, "work RAM" }, + { 0x39/2, 0x00000, 0x02000, 0xffe000, ~0, SMH_BANK(10), segaic16_paletteram_w, &paletteram16, "color RAM" }, + { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, SMH_BANK(11), segaic16_tileram_0_w, &segaic16_tileram_0, "tile RAM" }, + { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, SMH_BANK(12), segaic16_textram_0_w, &segaic16_textram_0, "text RAM" }, + { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, SMH_BANK(13), SMH_BANK(13), &segaic16_spriteram_0, "object RAM" }, + { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, SMH_BANK(14), SMH_BANK(14), &workram, "work RAM" }, { 0x29/2, 0x00000, 0x00010, 0xfffff0, ~0, genesis_vdp_r, genesis_vdp_w, NULL, "VDP" }, - { 0x25/2, 0x00000, 0x80000, 0xf80000, 0x80000, SMH_BANK16, SMH_UNMAP, NULL, "ROM 1" }, - { 0x21/2, 0x00000, 0x80000, 0xf80000, 0x00000, SMH_BANK17, SMH_UNMAP, NULL, "ROM 0" }, + { 0x25/2, 0x00000, 0x80000, 0xf80000, 0x80000, SMH_BANK(16), SMH_UNMAP, NULL, "ROM 1" }, + { 0x21/2, 0x00000, 0x80000, 0xf80000, 0x00000, SMH_BANK(17), SMH_UNMAP, NULL, "ROM 0" }, { 0 } }; static const segaic16_memory_map_entry rom_171_5987_info[] = { { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, misc_io_r, misc_io_w, NULL, "I/O space" }, - { 0x39/2, 0x00000, 0x02000, 0xffe000, ~0, SMH_BANK10, segaic16_paletteram_w, &paletteram16, "color RAM" }, - { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, SMH_BANK11, segaic16_tileram_0_w, &segaic16_tileram_0, "tile RAM" }, - { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, SMH_BANK12, segaic16_textram_0_w, &segaic16_textram_0, "text RAM" }, - { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, SMH_BANK13, SMH_BANK13, &segaic16_spriteram_0, "object RAM" }, - { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, SMH_BANK14, SMH_BANK14, &workram, "work RAM" }, + { 0x39/2, 0x00000, 0x02000, 0xffe000, ~0, SMH_BANK(10), segaic16_paletteram_w, &paletteram16, "color RAM" }, + { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, SMH_BANK(11), segaic16_tileram_0_w, &segaic16_tileram_0, "tile RAM" }, + { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, SMH_BANK(12), segaic16_textram_0_w, &segaic16_textram_0, "text RAM" }, + { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, SMH_BANK(13), SMH_BANK(13), &segaic16_spriteram_0, "object RAM" }, + { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, SMH_BANK(14), SMH_BANK(14), &workram, "work RAM" }, { 0x29/2, 0x00000, 0x00010, 0xfffff0, ~0, genesis_vdp_r, genesis_vdp_w, NULL, "VDP" }, - { 0x25/2, 0x00000, 0x80000, 0xf80000, 0x80000, SMH_BANK16, rom_5987_bank_w, NULL, "ROM 1/banking" }, - { 0x21/2, 0x00000, 0x100000,0xf00000, 0x00000, SMH_BANK17, SMH_UNMAP, NULL, "ROM 0" }, + { 0x25/2, 0x00000, 0x80000, 0xf80000, 0x80000, SMH_BANK(16), rom_5987_bank_w, NULL, "ROM 1/banking" }, + { 0x21/2, 0x00000, 0x100000,0xf00000, 0x00000, SMH_BANK(17), SMH_UNMAP, NULL, "ROM 0" }, { 0 } }; @@ -167,11 +167,11 @@ static void system18_generic_init(running_machine *machine, int _rom_board) rom_board = _rom_board; /* allocate memory for regions not autmatically assigned */ - segaic16_spriteram_0 = auto_malloc(0x00800); - paletteram16 = auto_malloc(0x04000); - segaic16_tileram_0 = auto_malloc(0x10000); - segaic16_textram_0 = auto_malloc(0x01000); - workram = auto_malloc(0x04000); + segaic16_spriteram_0 = auto_alloc_array(machine, UINT16, 0x00800/2); + paletteram16 = auto_alloc_array(machine, UINT16, 0x04000/2); + segaic16_tileram_0 = auto_alloc_array(machine, UINT16, 0x10000/2); + segaic16_textram_0 = auto_alloc_array(machine, UINT16, 0x01000/2); + workram = auto_alloc_array(machine, UINT16, 0x04000/2); /* init the memory mapper */ segaic16_memory_mapper_init(cputag_get_cpu(machine, "maincpu"), region_info_list[rom_board], sound_w, sound_r); diff --git a/src/mame/drivers/segas32.c b/src/mame/drivers/segas32.c index 683697831ac..ec63d29c261 100644 --- a/src/mame/drivers/segas32.c +++ b/src/mame/drivers/segas32.c @@ -3789,7 +3789,7 @@ static DRIVER_INIT( arescue ) segas32_common_init(analog_custom_io_r, analog_custom_io_w, NULL); memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa00000, 0xa00007, 0, 0, arescue_dsp_r, arescue_dsp_w); - dual_pcb_comms = auto_malloc(0x1000); + dual_pcb_comms = auto_alloc_array(machine, UINT16, 0x1000/2); memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x810000, 0x810fff, 0, 0, dual_pcb_comms_r, dual_pcb_comms_w); memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x818000, 0x818003, 0, 0, dual_pcb_masterslave); @@ -3813,7 +3813,7 @@ static DRIVER_INIT( brival ) segas32_common_init(extra_custom_io_r, NULL, NULL); /* install protection handlers */ - system32_protram = auto_malloc (0x1000); + system32_protram = auto_alloc_array(machine, UINT16, 0x1000/2); memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x20ba00, 0x20ba07, 0, 0, brival_protection_r); memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa00000, 0xa00fff, 0, 0, brival_protection_w); } @@ -3847,7 +3847,7 @@ static DRIVER_INIT( f1en ) { segas32_common_init(analog_custom_io_r, analog_custom_io_w, NULL); - dual_pcb_comms = auto_malloc(0x1000); + dual_pcb_comms = auto_alloc_array(machine, UINT16, 0x1000/2); memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x810000, 0x810fff, 0, 0, dual_pcb_comms_r, dual_pcb_comms_w); memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x818000, 0x818003, 0, 0, dual_pcb_masterslave); diff --git a/src/mame/drivers/seibuspi.c b/src/mame/drivers/seibuspi.c index e1f0b0e5fde..f46ae88e74d 100644 --- a/src/mame/drivers/seibuspi.c +++ b/src/mame/drivers/seibuspi.c @@ -1824,7 +1824,7 @@ static MACHINE_RESET( spi ) memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x00000688, 0x0000068b, 0, 0, z80_prg_fifo_w); memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000068c, 0x0000068f, 0, 0, z80_enable_w); - z80_rom = auto_malloc(0x40000); + z80_rom = auto_alloc_array(machine, UINT8, 0x40000); memory_set_bankptr(machine, 4, z80_rom); memory_set_bankptr(machine, 5, z80_rom); @@ -1887,7 +1887,7 @@ static MACHINE_RESET( sxx2f ) { UINT8 *rom = memory_region(machine, "soundcpu"); - z80_rom = auto_malloc(0x40000); + z80_rom = auto_alloc_array(machine, UINT8, 0x40000); memory_set_bankptr(machine, 4, z80_rom); memory_set_bankptr(machine, 5, z80_rom); diff --git a/src/mame/drivers/seta.c b/src/mame/drivers/seta.c index 23092c982fe..bd3ddc376af 100644 --- a/src/mame/drivers/seta.c +++ b/src/mame/drivers/seta.c @@ -2906,7 +2906,7 @@ static ADDRESS_MAP_START( tndrcade_sub_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x2000, 0x2001) AM_DEVREAD("ym1", ym2203_r ) AM_RANGE(0x5000, 0x57ff) AM_READ(SMH_RAM ) // Shared RAM AM_RANGE(0x6000, 0x7fff) AM_READ(SMH_ROM ) // ROM - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1 ) // Banked ROM + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1) ) // Banked ROM AM_RANGE(0xc000, 0xffff) AM_READ(SMH_ROM ) // ROM ADDRESS_MAP_END @@ -2932,7 +2932,7 @@ static ADDRESS_MAP_START( twineagl_sub_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x1002, 0x1002) AM_READ_PORT("COINS") // Coins AM_RANGE(0x5000, 0x57ff) AM_READ(SMH_RAM ) // Shared RAM AM_RANGE(0x7000, 0x7fff) AM_READ(SMH_ROM ) // ROM - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1 ) // Banked ROM + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1) ) // Banked ROM AM_RANGE(0xc000, 0xffff) AM_READ(SMH_ROM ) // ROM ADDRESS_MAP_END @@ -2979,7 +2979,7 @@ static ADDRESS_MAP_START( downtown_sub_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x1000, 0x1007) AM_READ(downtown_ip_r ) // Input Ports AM_RANGE(0x5000, 0x57ff) AM_READ(SMH_RAM ) // Shared RAM AM_RANGE(0x7000, 0x7fff) AM_READ(SMH_ROM ) // ROM - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1 ) // Banked ROM + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1) ) // Banked ROM AM_RANGE(0xc000, 0xffff) AM_READ(SMH_ROM ) // ROM ADDRESS_MAP_END @@ -3009,7 +3009,7 @@ static WRITE8_HANDLER( calibr50_soundlatch2_w ) static ADDRESS_MAP_START( calibr50_sub_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x1fff) AM_DEVREAD("x1", seta_sound_r ) // Sound AM_RANGE(0x4000, 0x4000) AM_READ(soundlatch_r ) // From Main CPU - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1 ) // Banked ROM + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1) ) // Banked ROM AM_RANGE(0xc000, 0xffff) AM_READ(SMH_ROM ) // ROM ADDRESS_MAP_END @@ -3035,7 +3035,7 @@ static ADDRESS_MAP_START( metafox_sub_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x1006, 0x1006) AM_READ_PORT("P2") // P2 AM_RANGE(0x5000, 0x57ff) AM_READ(SMH_RAM ) // Shared RAM AM_RANGE(0x7000, 0x7fff) AM_READ(SMH_ROM ) // ROM - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1 ) // Banked ROM + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1) ) // Banked ROM AM_RANGE(0xc000, 0xffff) AM_READ(SMH_ROM ) // ROM ADDRESS_MAP_END @@ -9539,7 +9539,7 @@ static DRIVER_INIT( metafox ) UINT16 *RAM = (UINT16 *) memory_region(machine, "maincpu"); /* This game uses the 21c000-21ffff area for protection? */ -// memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x21c000, 0x21ffff, 0, 0, SMH_NOP, SMH_NOP); +// memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x21c000, 0x21ffff, 0, 0, (read16_space_func)SMH_NOP, (write16_space_func)SMH_NOP); RAM[0x8ab1c/2] = 0x4e71; // patch protection test: "cp error" RAM[0x8ab1e/2] = 0x4e71; @@ -9557,7 +9557,7 @@ static DRIVER_INIT ( blandia ) int rpos; rom_size = 0x80000; - buf = malloc_or_die(rom_size); + buf = alloc_array_or_die(UINT8, rom_size); rom = memory_region(machine, "gfx2") + 0x40000; @@ -9583,7 +9583,7 @@ static DRIVER_INIT ( blandia ) static DRIVER_INIT( eightfrc ) { - memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x500004, 0x500005, 0, 0, SMH_NOP); // watchdog?? + memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x500004, 0x500005, 0, 0, (read16_space_func)SMH_NOP); // watchdog?? } @@ -9608,7 +9608,7 @@ static DRIVER_INIT( kiwame ) static DRIVER_INIT( rezon ) { - memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x500006, 0x500007, 0, 0, SMH_NOP); // irq ack? + memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x500006, 0x500007, 0, 0, (read16_space_func)SMH_NOP); // irq ack? } static DRIVER_INIT(wiggie) @@ -9640,7 +9640,7 @@ static DRIVER_INIT(wiggie) } /* X1_010 is not used. */ - memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x100000, 0x103fff, 0, 0, SMH_NOP, SMH_NOP); + memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x100000, 0x103fff, 0, 0, (read16_space_func)SMH_NOP, (write16_space_func)SMH_NOP); memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xB00008, 0xB00009, 0, 0, wiggie_soundlatch_w); @@ -9653,7 +9653,7 @@ static DRIVER_INIT( crazyfgt ) RAM[0x1078/2] = 0x4e71; // fixed priorities? - seta_vregs = (UINT16*)auto_malloc(sizeof(UINT16)*3); + seta_vregs = auto_alloc_array(machine, UINT16, 3); seta_vregs[0] = seta_vregs[1] = seta_vregs[2] = 0; DRIVER_INIT_CALL(blandia); diff --git a/src/mame/drivers/sf.c b/src/mame/drivers/sf.c index 6a421c9a9ff..9dbcd5173bb 100644 --- a/src/mame/drivers/sf.c +++ b/src/mame/drivers/sf.c @@ -266,7 +266,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sound2_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0xffff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xffff) AM_READ(SMH_BANK(1)) ADDRESS_MAP_END /* Yes, _no_ ram */ diff --git a/src/mame/drivers/sfbonus.c b/src/mame/drivers/sfbonus.c index d9554f3f556..0d8789ba62c 100644 --- a/src/mame/drivers/sfbonus.c +++ b/src/mame/drivers/sfbonus.c @@ -434,7 +434,7 @@ static WRITE8_HANDLER( sfbonus_videoram_w ) static VIDEO_START(sfbonus) { - temp_reel_bitmap = auto_bitmap_alloc(1024,512,BITMAP_FORMAT_INDEXED16); + temp_reel_bitmap = auto_bitmap_alloc(machine,1024,512,BITMAP_FORMAT_INDEXED16); sfbonus_tilemap = tilemap_create(machine,get_sfbonus_tile_info,tilemap_scan_rows,8,8, 128, 64); sfbonus_reel_tilemap = tilemap_create(machine,get_sfbonus_reel_tile_info,tilemap_scan_rows,8,32, 64, 16); @@ -5086,29 +5086,29 @@ ROM_END static DRIVER_INIT( sfbonus_common) { - sfbonus_tilemap_ram = auto_malloc(0x4000); + sfbonus_tilemap_ram = auto_alloc_array(machine, UINT8, 0x4000); memset(sfbonus_tilemap_ram,0xff,0x4000); state_save_register_global_pointer(machine, sfbonus_tilemap_ram , 0x4000); - sfbonus_reel_ram = auto_malloc(0x0800); + sfbonus_reel_ram = auto_alloc_array(machine, UINT8, 0x0800); memset(sfbonus_reel_ram,0xff,0x0800); state_save_register_global_pointer(machine, sfbonus_reel_ram , 0x0800); - sfbonus_reel2_ram = auto_malloc(0x0800); + sfbonus_reel2_ram = auto_alloc_array(machine, UINT8, 0x0800); memset(sfbonus_reel2_ram,0xff,0x0800); state_save_register_global_pointer(machine, sfbonus_reel2_ram , 0x0800); - sfbonus_reel3_ram = auto_malloc(0x0800); + sfbonus_reel3_ram = auto_alloc_array(machine, UINT8, 0x0800); memset(sfbonus_reel3_ram,0xff,0x0800); state_save_register_global_pointer(machine, sfbonus_reel3_ram , 0x0800); - sfbonus_reel4_ram = auto_malloc(0x0800); + sfbonus_reel4_ram = auto_alloc_array(machine, UINT8, 0x0800); memset(sfbonus_reel4_ram,0xff,0x0800); state_save_register_global_pointer(machine, sfbonus_reel4_ram , 0x0800); // hack, because the debugger is broken sfbonus_videoram = memory_region(machine,"debugram"); - if (!sfbonus_videoram) sfbonus_videoram = auto_malloc(0x10000); + if (!sfbonus_videoram) sfbonus_videoram = auto_alloc_array(machine, UINT8, 0x10000); memset(sfbonus_videoram,0xff,0x10000); diff --git a/src/mame/drivers/sfkick.c b/src/mame/drivers/sfkick.c index 6f11890f095..ad9554b4c59 100644 --- a/src/mame/drivers/sfkick.c +++ b/src/mame/drivers/sfkick.c @@ -294,14 +294,14 @@ static WRITE8_HANDLER(page3_w) } static ADDRESS_MAP_START (readmem, ADDRESS_SPACE_PROGRAM, 8) - AM_RANGE( 0x0000, 0x1fff) AM_READ( SMH_BANK1 ) - AM_RANGE( 0x2000, 0x3fff) AM_READ( SMH_BANK2 ) - AM_RANGE( 0x4000, 0x5fff) AM_READ( SMH_BANK3 ) - AM_RANGE( 0x6000, 0x7fff) AM_READ( SMH_BANK4 ) - AM_RANGE( 0x8000, 0x9fff) AM_READ( SMH_BANK5 ) - AM_RANGE( 0xa000, 0xbfff) AM_READ( SMH_BANK6 ) - AM_RANGE( 0xc000, 0xdfff) AM_READ( SMH_BANK7 ) - AM_RANGE( 0xe000, 0xffff) AM_READ( SMH_BANK8 ) + AM_RANGE( 0x0000, 0x1fff) AM_READ( SMH_BANK(1) ) + AM_RANGE( 0x2000, 0x3fff) AM_READ( SMH_BANK(2) ) + AM_RANGE( 0x4000, 0x5fff) AM_READ( SMH_BANK(3) ) + AM_RANGE( 0x6000, 0x7fff) AM_READ( SMH_BANK(4) ) + AM_RANGE( 0x8000, 0x9fff) AM_READ( SMH_BANK(5) ) + AM_RANGE( 0xa000, 0xbfff) AM_READ( SMH_BANK(6) ) + AM_RANGE( 0xc000, 0xdfff) AM_READ( SMH_BANK(7) ) + AM_RANGE( 0xe000, 0xffff) AM_READ( SMH_BANK(8) ) ADDRESS_MAP_END static ADDRESS_MAP_START( writemem , ADDRESS_SPACE_PROGRAM, 8) @@ -500,7 +500,7 @@ MACHINE_DRIVER_END static DRIVER_INIT(sfkick) { - main_mem=auto_malloc(0x4000); + main_mem=auto_alloc_array(machine, UINT8, 0x4000); } ROM_START( sfkick ) diff --git a/src/mame/drivers/shanghai.c b/src/mame/drivers/shanghai.c index 79238a84f0c..f3d7d0cf64d 100644 --- a/src/mame/drivers/shanghai.c +++ b/src/mame/drivers/shanghai.c @@ -59,7 +59,7 @@ static PALETTE_INIT( shanghai ) static VIDEO_START( shanghai ) { - HD63484_start(); + HD63484_start(machine); } static VIDEO_UPDATE( shanghai ) diff --git a/src/mame/drivers/shisen.c b/src/mame/drivers/shisen.c index 418442a26bf..343cfb7bc3e 100644 --- a/src/mame/drivers/shisen.c +++ b/src/mame/drivers/shisen.c @@ -50,7 +50,7 @@ static WRITE8_HANDLER( sichuan2_coin_w ) static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xc800, 0xcaff) AM_READ(SMH_RAM) AM_RANGE(0xd000, 0xffff) AM_READ(SMH_RAM) ADDRESS_MAP_END diff --git a/src/mame/drivers/shootout.c b/src/mame/drivers/shootout.c index df127436d75..aab02ec1d08 100644 --- a/src/mame/drivers/shootout.c +++ b/src/mame/drivers/shootout.c @@ -84,7 +84,7 @@ static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x1003, 0x1003) AM_READ_PORT("DSW2") AM_RANGE(0x2000, 0x27ff) AM_READ(SMH_RAM) /* foreground */ AM_RANGE(0x2800, 0x2fff) AM_READ(SMH_RAM) /* background */ - AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK1) + AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK(1)) AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM) ADDRESS_MAP_END @@ -111,7 +111,7 @@ static ADDRESS_MAP_START( readmem_alt, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x2800, 0x2801) AM_DEVREAD("ym", ym2203_r) AM_RANGE(0x3000, 0x37ff) AM_READ(SMH_RAM) /* foreground */ AM_RANGE(0x3800, 0x3fff) AM_READ(SMH_RAM) /* background */ - AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK1) + AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK(1)) AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM) ADDRESS_MAP_END @@ -459,7 +459,7 @@ static DRIVER_INIT( shootout ) { const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); int length = memory_region_length(machine, "maincpu"); - UINT8 *decrypt = auto_malloc(length - 0x8000); + UINT8 *decrypt = auto_alloc_array(machine, UINT8, length - 0x8000); UINT8 *rom = memory_region(machine, "maincpu"); int A; diff --git a/src/mame/drivers/sidearms.c b/src/mame/drivers/sidearms.c index 4179f5ce010..b0dbb99d9a8 100644 --- a/src/mame/drivers/sidearms.c +++ b/src/mame/drivers/sidearms.c @@ -87,7 +87,7 @@ static READ8_HANDLER( turtship_ports_r ) static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xc800, 0xc800) AM_READ_PORT("SYSTEM") AM_RANGE(0xc801, 0xc801) AM_READ_PORT("P1") AM_RANGE(0xc802, 0xc802) AM_READ_PORT("P2") @@ -119,7 +119,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( turtship_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xc000, 0xe7ff) AM_READ(SMH_RAM) AM_RANGE(0xe800, 0xe807) AM_READ(turtship_ports_r) AM_RANGE(0xf000, 0xffff) AM_READ(SMH_RAM) @@ -182,7 +182,7 @@ static WRITE8_HANDLER( whizz_bankswitch_w ) static ADDRESS_MAP_START( whizz_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xc800, 0xc800) AM_READ_PORT("DSW0") AM_RANGE(0xc801, 0xc801) AM_READ_PORT("DSW1") AM_RANGE(0xc802, 0xc802) AM_READ_PORT("DSW2") diff --git a/src/mame/drivers/silkroad.c b/src/mame/drivers/silkroad.c index 2adb6da9c5a..b5962b9e750 100644 --- a/src/mame/drivers/silkroad.c +++ b/src/mame/drivers/silkroad.c @@ -345,7 +345,7 @@ static DRIVER_INIT( silkroad ) src += tileoffset; len -=tileoffset; - buffer = malloc_or_die(len); + buffer = alloc_array_or_die(UINT8, len); { int i; for (i = 0;i < len; i++) diff --git a/src/mame/drivers/simpl156.c b/src/mame/drivers/simpl156.c index acb7433e226..b9a40510313 100644 --- a/src/mame/drivers/simpl156.c +++ b/src/mame/drivers/simpl156.c @@ -530,7 +530,7 @@ static DRIVER_INIT(simpl156) { UINT8 *rom = memory_region(machine, "okimusic"); int length = memory_region_length(machine, "okimusic"); - UINT8 *buf1 = malloc_or_die(length); + UINT8 *buf1 = alloc_array_or_die(UINT8, length); UINT32 x; diff --git a/src/mame/drivers/skykid.c b/src/mame/drivers/skykid.c index be142302069..8c297153b85 100644 --- a/src/mame/drivers/skykid.c +++ b/src/mame/drivers/skykid.c @@ -115,7 +115,7 @@ static MACHINE_START( skykid ) static ADDRESS_MAP_START( skykid_map, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x1fff) AM_READ(SMH_BANK1) /* banked ROM */ + AM_RANGE(0x0000, 0x1fff) AM_READ(SMH_BANK(1)) /* banked ROM */ AM_RANGE(0x2000, 0x2fff) AM_READWRITE(skykid_videoram_r,skykid_videoram_w) AM_BASE(&skykid_videoram)/* Video RAM (background) */ AM_RANGE(0x4000, 0x47ff) AM_READWRITE(skykid_textram_r,skykid_textram_w) AM_BASE(&skykid_textram) /* video RAM (text layer) */ AM_RANGE(0x4800, 0x5fff) AM_RAM AM_BASE(&skykid_spriteram) /* RAM + Sprite RAM */ diff --git a/src/mame/drivers/skylncr.c b/src/mame/drivers/skylncr.c index 3f0c24eb87f..97d85929d04 100644 --- a/src/mame/drivers/skylncr.c +++ b/src/mame/drivers/skylncr.c @@ -824,8 +824,8 @@ ROM_END static DRIVER_INIT( skylncr ) { - paletteram = auto_malloc(0x100 * 3); - paletteram_2 = auto_malloc(0x100 * 3); + paletteram = auto_alloc_array(machine, UINT8, 0x100 * 3); + paletteram_2 = auto_alloc_array(machine, UINT8, 0x100 * 3); } diff --git a/src/mame/drivers/slapfght.c b/src/mame/drivers/slapfght.c index 4fadf1254f6..a31c60a151e 100644 --- a/src/mame/drivers/slapfght.c +++ b/src/mame/drivers/slapfght.c @@ -412,7 +412,7 @@ static ADDRESS_MAP_START( perfrman_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) AM_RANGE(0x8000, 0x87ff) AM_READ(SMH_RAM) AM_RANGE(0x8800, 0x880f) AM_READ(slapfight_dpram_r) - AM_RANGE(0x8810, 0x8fff) AM_READ(SMH_BANK1) + AM_RANGE(0x8810, 0x8fff) AM_READ(SMH_BANK(1)) AM_RANGE(0x9000, 0x97ff) AM_READ(SMH_RAM) AM_RANGE(0x9800, 0x9fff) AM_READ(SMH_RAM) AM_RANGE(0xa000, 0xa7ff) AM_READ(SMH_RAM) @@ -422,7 +422,7 @@ static ADDRESS_MAP_START( perfrman_writemem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM) AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM) AM_RANGE(0x8800, 0x880f) AM_WRITE(slapfight_dpram_w) AM_BASE(&slapfight_dpram) AM_SIZE(&slapfight_dpram_size) - AM_RANGE(0x8810, 0x8fff) AM_WRITE(SMH_BANK1) /* Shared RAM with sound CPU */ + AM_RANGE(0x8810, 0x8fff) AM_WRITE(SMH_BANK(1)) /* Shared RAM with sound CPU */ AM_RANGE(0x9000, 0x97ff) AM_WRITE(slapfight_videoram_w) AM_BASE(&videoram) AM_SIZE(&videoram_size) AM_RANGE(0x9800, 0x9fff) AM_WRITE(slapfight_colorram_w) AM_BASE(&colorram) AM_RANGE(0xa000, 0xa7ff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size) @@ -441,7 +441,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xc000, 0xc7ff) AM_READ(SMH_RAM) AM_RANGE(0xc800, 0xc80f) AM_READ(slapfight_dpram_r) AM_RANGE(0xc810, 0xcfff) AM_READ(SMH_RAM) @@ -470,7 +470,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( slapbtuk_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xc000, 0xc7ff) AM_READ(SMH_RAM) AM_RANGE(0xc800, 0xc80f) AM_READ(slapfight_dpram_r) AM_RANGE(0xc810, 0xcfff) AM_READ(SMH_RAM) @@ -559,7 +559,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( perfrman_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x1fff) AM_READ(SMH_ROM) AM_RANGE(0x8800, 0x880f) AM_READ(slapfight_dpram_r) - AM_RANGE(0x8810, 0x8fff) AM_READ(SMH_BANK1) + AM_RANGE(0x8810, 0x8fff) AM_READ(SMH_BANK(1)) AM_RANGE(0xa081, 0xa081) AM_DEVREAD("ay1", ay8910_r) AM_RANGE(0xa091, 0xa091) AM_DEVREAD("ay2", ay8910_r) ADDRESS_MAP_END @@ -567,7 +567,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( perfrman_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x1fff) AM_WRITE(SMH_ROM) AM_RANGE(0x8800, 0x880f) AM_WRITE(slapfight_dpram_w) - AM_RANGE(0x8810, 0x8fff) AM_WRITE(SMH_BANK1) /* Shared RAM with main CPU */ + AM_RANGE(0x8810, 0x8fff) AM_WRITE(SMH_BANK(1)) /* Shared RAM with main CPU */ AM_RANGE(0xa080, 0xa080) AM_DEVWRITE("ay1", ay8910_address_w) AM_RANGE(0xa082, 0xa082) AM_DEVWRITE("ay1", ay8910_data_w) AM_RANGE(0xa090, 0xa090) AM_DEVWRITE("ay2", ay8910_address_w) diff --git a/src/mame/drivers/slapshot.c b/src/mame/drivers/slapshot.c index 6099a5e455c..740061c3e21 100644 --- a/src/mame/drivers/slapshot.c +++ b/src/mame/drivers/slapshot.c @@ -313,7 +313,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( z80_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_ROM) - AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK10) + AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK(10)) AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_RAM) AM_RANGE(0xe000, 0xe003) AM_DEVREAD("ym", ym2610_r) AM_RANGE(0xe200, 0xe200) AM_READNOP diff --git a/src/mame/drivers/sliver.c b/src/mame/drivers/sliver.c index b374a84dd29..4784d16038d 100644 --- a/src/mame/drivers/sliver.c +++ b/src/mame/drivers/sliver.c @@ -590,7 +590,7 @@ ROM_END static DRIVER_INIT(sliver) { jpeg_addr = -1; - colorram=auto_malloc(256*3); + colorram=auto_alloc_array(machine, UINT8, 256*3); } GAME( 1996, sliver, 0, sliver, sliver, sliver, ROT0, "Hollow Corp", "Sliver", GAME_IMPERFECT_GRAPHICS ) diff --git a/src/mame/drivers/slotcarn.c b/src/mame/drivers/slotcarn.c index b374e565658..42311fd6375 100644 --- a/src/mame/drivers/slotcarn.c +++ b/src/mame/drivers/slotcarn.c @@ -532,7 +532,7 @@ static VIDEO_UPDATE( slotcarn ) static MACHINE_START(merit) { - ram_palette = auto_malloc(RAM_PALETTE_SIZE); + ram_palette = auto_alloc_array(machine, UINT8, RAM_PALETTE_SIZE); state_save_register_global_pointer(machine, ram_palette, RAM_PALETTE_SIZE); } diff --git a/src/mame/drivers/snesb.c b/src/mame/drivers/snesb.c index 0a7576e043e..10746ece2d9 100644 --- a/src/mame/drivers/snesb.c +++ b/src/mame/drivers/snesb.c @@ -581,7 +581,7 @@ static DRIVER_INIT(kinstb) rom[i]=BITSWAP8(rom[i],5,0,6,1,7,4,3,2); } - shared_ram=auto_malloc(0x100); + shared_ram=auto_alloc_array(machine, INT8, 0x100); memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x781000, 0x7810ff, 0, 0, sharedram_r, sharedram_w); DRIVER_INIT_CALL(snes_hirom); diff --git a/src/mame/drivers/snowbros.c b/src/mame/drivers/snowbros.c index 063bdecf076..7b95407c2c6 100644 --- a/src/mame/drivers/snowbros.c +++ b/src/mame/drivers/snowbros.c @@ -2673,7 +2673,7 @@ static DRIVER_INIT(4in1boot) int len = memory_region_length(machine, "maincpu"); /* strange order */ - buffer = malloc_or_die(len); + buffer = alloc_array_or_die(UINT8, len); { int i; for (i = 0;i < len; i++) @@ -2688,7 +2688,7 @@ static DRIVER_INIT(4in1boot) len = memory_region_length(machine, "soundcpu"); /* strange order */ - buffer = malloc_or_die(len); + buffer = alloc_array_or_die(UINT8, len); { int i; for (i = 0;i < len; i++) @@ -2706,7 +2706,7 @@ static DRIVER_INIT(snowbro3) int len = memory_region_length(machine, "maincpu"); /* strange order */ - buffer = malloc_or_die(len); + buffer = alloc_array_or_die(UINT8, len); { int i; for (i = 0;i < len; i++) diff --git a/src/mame/drivers/spdodgeb.c b/src/mame/drivers/spdodgeb.c index 3fa9360e805..7724bf040ed 100644 --- a/src/mame/drivers/spdodgeb.c +++ b/src/mame/drivers/spdodgeb.c @@ -273,7 +273,7 @@ static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x3000, 0x3000) AM_READ(port_0_r) AM_RANGE(0x3001, 0x3001) AM_READ_PORT("DSW") /* DIPs */ AM_RANGE(0x3801, 0x3805) AM_READ(mcu63701_r) - AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK1) + AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK(1)) AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM) ADDRESS_MAP_END diff --git a/src/mame/drivers/speedspn.c b/src/mame/drivers/speedspn.c index 04cfdc7294e..374058d4857 100644 --- a/src/mame/drivers/speedspn.c +++ b/src/mame/drivers/speedspn.c @@ -124,7 +124,7 @@ static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0xa000, 0xa7ff) AM_READ(SMH_RAM) AM_RANGE(0xa800, 0xafff) AM_READ(SMH_RAM) AM_RANGE(0xb000, 0xbfff) AM_READ(SMH_RAM) - AM_RANGE(0xc000, 0xffff) AM_READ(SMH_BANK1) /* banked ROM */ + AM_RANGE(0xc000, 0xffff) AM_READ(SMH_BANK(1)) /* banked ROM */ ADDRESS_MAP_END static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 ) diff --git a/src/mame/drivers/spool99.c b/src/mame/drivers/spool99.c index 0cc7695e2b2..734f27a7f15 100644 --- a/src/mame/drivers/spool99.c +++ b/src/mame/drivers/spool99.c @@ -323,7 +323,7 @@ ROM_END static DRIVER_INIT( spool99 ) { UINT8 *ROM = memory_region(machine, "maincpu"); -// vram = auto_malloc(0x2000); +// vram = auto_alloc_array(machine, UINT8, 0x2000); memcpy(spool99_main, ROM, 0xae00); } diff --git a/src/mame/drivers/sprcros2.c b/src/mame/drivers/sprcros2.c index 70c720b4ad5..540983c2eac 100644 --- a/src/mame/drivers/sprcros2.c +++ b/src/mame/drivers/sprcros2.c @@ -123,14 +123,14 @@ static WRITE8_HANDLER( sprcros2_s_port3_w ) static ADDRESS_MAP_START( sprcros2_m_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0xbfff) AM_READ(SMH_ROM) - AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_BANK1) + AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xe000, 0xf7ff) AM_READ(SMH_RAM) AM_RANGE(0xf800, 0xffff) AM_READ(SMH_RAM) //shared with slave cpu ADDRESS_MAP_END static ADDRESS_MAP_START( sprcros2_m_writemem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0xbfff) AM_WRITE(SMH_ROM) - AM_RANGE(0xc000, 0xdfff) AM_WRITE(SMH_BANK1) + AM_RANGE(0xc000, 0xdfff) AM_WRITE(SMH_BANK(1)) AM_RANGE(0xe000, 0xe7ff) AM_WRITE(sprcros2_fgvideoram_w) AM_BASE(&sprcros2_fgvideoram) AM_RANGE(0xe800, 0xe817) AM_WRITE(SMH_RAM) //always zero AM_RANGE(0xe818, 0xe83f) AM_WRITE(SMH_RAM) AM_BASE(&sprcros2_spriteram) AM_SIZE(&sprcros2_spriteram_size) @@ -152,7 +152,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sprcros2_s_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_ROM) - AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_BANK2) + AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_BANK(2)) AM_RANGE(0xe000, 0xf7ff) AM_READ(SMH_RAM) AM_RANGE(0xf800, 0xffff) AM_READ(sprcros2_sharedram_r) ADDRESS_MAP_END @@ -160,7 +160,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sprcros2_s_writemem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM) AM_RANGE(0x8000, 0xbfff) AM_WRITE(SMH_ROM) - AM_RANGE(0xc000, 0xdfff) AM_WRITE(SMH_BANK2) + AM_RANGE(0xc000, 0xdfff) AM_WRITE(SMH_BANK(2)) AM_RANGE(0xe000, 0xe7ff) AM_WRITE(sprcros2_bgvideoram_w) AM_BASE(&sprcros2_bgvideoram) AM_RANGE(0xe800, 0xefff) AM_WRITE(SMH_RAM) //always zero AM_RANGE(0xf000, 0xf7ff) AM_WRITE(SMH_RAM) diff --git a/src/mame/drivers/spy.c b/src/mame/drivers/spy.c index 0576b04985c..54c9f51f9e5 100644 --- a/src/mame/drivers/spy.c +++ b/src/mame/drivers/spy.c @@ -360,7 +360,7 @@ static ADDRESS_MAP_START( spy_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x3fd3, 0x3fd3) AM_READ_PORT("DSW1") AM_RANGE(0x3fe0, 0x3fe0) AM_READ_PORT("DSW2") AM_RANGE(0x2000, 0x5fff) AM_READ(K052109_051960_r) - AM_RANGE(0x6000, 0x7fff) AM_READ(SMH_BANK1) + AM_RANGE(0x6000, 0x7fff) AM_READ(SMH_BANK(1)) AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM) ADDRESS_MAP_END diff --git a/src/mame/drivers/srmp2.c b/src/mame/drivers/srmp2.c index 623530bc4db..ec7d94783df 100644 --- a/src/mame/drivers/srmp2.c +++ b/src/mame/drivers/srmp2.c @@ -564,7 +564,7 @@ static WRITE8_HANDLER( srmp3_flags_w ) static ADDRESS_MAP_START( srmp3_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0x9fff) AM_READ(SMH_BANK1) /* rom bank */ + AM_RANGE(0x8000, 0x9fff) AM_READ(SMH_BANK(1)) /* rom bank */ AM_RANGE(0xa000, 0xa7ff) AM_READ(SMH_RAM) /* work ram */ AM_RANGE(0xb000, 0xb303) AM_READ(SMH_RAM) /* Sprites Y */ AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_RAM) /* Sprites Code + X + Attr */ diff --git a/src/mame/drivers/srmp5.c b/src/mame/drivers/srmp5.c index e5698189431..8984689a193 100644 --- a/src/mame/drivers/srmp5.c +++ b/src/mame/drivers/srmp5.c @@ -577,9 +577,9 @@ ROM_END static DRIVER_INIT(srmp5) { st0016_game=9; - tileram = (UINT16 *)auto_malloc(0x100000); - sprram = (UINT16 *)auto_malloc(0x080000); - palram = (UINT16 *)auto_malloc(0x040000); + tileram = auto_alloc_array(machine, UINT16, 0x100000/2); + sprram = auto_alloc_array(machine, UINT16, 0x080000/2); + palram = auto_alloc_array(machine, UINT16, 0x040000/2); #ifdef DEBUG_CHAR memset(tileduty, 1, 0x2000); #endif diff --git a/src/mame/drivers/srmp6.c b/src/mame/drivers/srmp6.c index b4eae3324ee..d585435bdea 100644 --- a/src/mame/drivers/srmp6.c +++ b/src/mame/drivers/srmp6.c @@ -126,12 +126,12 @@ static void update_palette(running_machine *machine) static VIDEO_START(srmp6) { - tileram = auto_malloc(0x100000*16); + tileram = auto_alloc_array(machine, UINT16, 0x100000*16/2); memset(tileram,0x00,(0x100000*16)); - dmaram = auto_malloc(0x100); + dmaram = auto_alloc_array(machine, UINT16, 0x100/2); - sprram_old = auto_malloc(0x80000); + sprram_old = auto_alloc_array(machine, UINT16, 0x80000/2); memset(sprram_old, 0, 0x80000); /* create the char set (gfx will then be updated dynamically from RAM) */ @@ -513,7 +513,7 @@ static WRITE16_HANDLER(paletteram_w) static ADDRESS_MAP_START( srmp6, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0x000000, 0x0fffff) AM_ROM AM_RANGE(0x200000, 0x23ffff) AM_RAM // work RAM - AM_RANGE(0x600000, 0x7fffff) AM_READ(SMH_BANK1) // banked ROM (used by ROM check) + AM_RANGE(0x600000, 0x7fffff) AM_READ(SMH_BANK(1)) // banked ROM (used by ROM check) AM_RANGE(0x800000, 0x9fffff) AM_ROM AM_REGION("user1", 0) AM_RANGE(0x300000, 0x300005) AM_READWRITE(srmp6_inputs_r, srmp6_input_select_w) // inputs diff --git a/src/mame/drivers/srumbler.c b/src/mame/drivers/srumbler.c index 3db77096c1a..790f19d2fee 100644 --- a/src/mame/drivers/srumbler.c +++ b/src/mame/drivers/srumbler.c @@ -75,17 +75,17 @@ static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x400a, 0x400a) AM_READ_PORT("P2") AM_RANGE(0x400b, 0x400b) AM_READ_PORT("DSW1") AM_RANGE(0x400c, 0x400c) AM_READ_PORT("DSW2") - AM_RANGE(0x5000, 0x5fff) AM_READ(SMH_BANK6) /* Banked ROM */ - AM_RANGE(0x6000, 0x6fff) AM_READ(SMH_BANK7) /* Banked ROM */ - AM_RANGE(0x7000, 0x7fff) AM_READ(SMH_BANK8) /* Banked ROM */ - AM_RANGE(0x8000, 0x8fff) AM_READ(SMH_BANK9) /* Banked ROM */ - AM_RANGE(0x9000, 0x9fff) AM_READ(SMH_BANK10) /* Banked ROM */ - AM_RANGE(0xa000, 0xafff) AM_READ(SMH_BANK11) /* Banked ROM */ - AM_RANGE(0xb000, 0xbfff) AM_READ(SMH_BANK12) /* Banked ROM */ - AM_RANGE(0xc000, 0xcfff) AM_READ(SMH_BANK13) /* Banked ROM */ - AM_RANGE(0xd000, 0xdfff) AM_READ(SMH_BANK14) /* Banked ROM */ - AM_RANGE(0xe000, 0xefff) AM_READ(SMH_BANK15) /* Banked ROM */ - AM_RANGE(0xf000, 0xffff) AM_READ(SMH_BANK16) /* Banked ROM */ + AM_RANGE(0x5000, 0x5fff) AM_READ(SMH_BANK(6)) /* Banked ROM */ + AM_RANGE(0x6000, 0x6fff) AM_READ(SMH_BANK(7)) /* Banked ROM */ + AM_RANGE(0x7000, 0x7fff) AM_READ(SMH_BANK(8)) /* Banked ROM */ + AM_RANGE(0x8000, 0x8fff) AM_READ(SMH_BANK(9)) /* Banked ROM */ + AM_RANGE(0x9000, 0x9fff) AM_READ(SMH_BANK(10)) /* Banked ROM */ + AM_RANGE(0xa000, 0xafff) AM_READ(SMH_BANK(11)) /* Banked ROM */ + AM_RANGE(0xb000, 0xbfff) AM_READ(SMH_BANK(12)) /* Banked ROM */ + AM_RANGE(0xc000, 0xcfff) AM_READ(SMH_BANK(13)) /* Banked ROM */ + AM_RANGE(0xd000, 0xdfff) AM_READ(SMH_BANK(14)) /* Banked ROM */ + AM_RANGE(0xe000, 0xefff) AM_READ(SMH_BANK(15)) /* Banked ROM */ + AM_RANGE(0xf000, 0xffff) AM_READ(SMH_BANK(16)) /* Banked ROM */ ADDRESS_MAP_END /* diff --git a/src/mame/drivers/ssf2md.c b/src/mame/drivers/ssf2md.c index d23f1073aa2..776a16b4cb0 100644 --- a/src/mame/drivers/ssf2md.c +++ b/src/mame/drivers/ssf2md.c @@ -18,8 +18,8 @@ static READ16_HANDLER( ssf2ghw_dsw_r ) static DRIVER_INIT( ssf2ghw ) { - memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xA130F0, 0xA130FF, 0, 0, SMH_NOP); // custom banking is disabled (!) - memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x400000, 0x5fffff, 0, 0, SMH_BANK5, SMH_UNMAP); + memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xA130F0, 0xA130FF, 0, 0, (write16_space_func)SMH_NOP); // custom banking is disabled (!) + memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x400000, 0x5fffff, 0, 0, (read16_space_func)SMH_BANK(5), (write16_space_func)SMH_UNMAP); memory_set_bankptr(machine, 5, memory_region( machine, "maincpu" )+0x400000 ); diff --git a/src/mame/drivers/ssingles.c b/src/mame/drivers/ssingles.c index fd798634c64..63d80085ebb 100644 --- a/src/mame/drivers/ssingles.c +++ b/src/mame/drivers/ssingles.c @@ -307,10 +307,8 @@ ROM_END static DRIVER_INIT(ssingles) { - ssingles_videoram=auto_malloc(VMEM_SIZE); - ssingles_colorram=auto_malloc(VMEM_SIZE); - memset(ssingles_videoram,0,VMEM_SIZE); - memset(ssingles_colorram,0,VMEM_SIZE); + ssingles_videoram=auto_alloc_array_clear(machine, UINT8, VMEM_SIZE); + ssingles_colorram=auto_alloc_array_clear(machine, UINT8, VMEM_SIZE); state_save_register_global_pointer(machine, ssingles_videoram, VMEM_SIZE); state_save_register_global_pointer(machine, ssingles_colorram, VMEM_SIZE); } diff --git a/src/mame/drivers/ssv.c b/src/mame/drivers/ssv.c index a131ac85a25..1cc7dbb0c40 100644 --- a/src/mame/drivers/ssv.c +++ b/src/mame/drivers/ssv.c @@ -442,7 +442,7 @@ static READ16_HANDLER( fake_r ) { return ssv_scroll[offset]; } AM_RANGE(0x260000, 0x260001) AM_WRITE(ssv_irq_enable_w) /* IRQ En */ \ AM_RANGE(0x300000, 0x30007f) AM_DEVREADWRITE8("ensoniq", es5506_r, es5506_w, 0x00ff) /* Sound */ \ AM_RANGE(0x482000, 0x482fff) AM_RAM_WRITE(dsp_w) AM_BASE(&dsp_ram) \ - AM_RANGE(_ROM, 0xffffff) AM_READ(SMH_BANK1 ) /* ROM */ \ + AM_RANGE(_ROM, 0xffffff) AM_ROMBANK(1) /* ROM */ \ //AM_RANGE(0x990000, 0x99007f) AM_READ(fake_r) diff --git a/src/mame/drivers/st0016.c b/src/mame/drivers/st0016.c index 7736b54fcf3..803cf88569f 100644 --- a/src/mame/drivers/st0016.c +++ b/src/mame/drivers/st0016.c @@ -136,7 +136,7 @@ static ADDRESS_MAP_START( v810_mem,ADDRESS_SPACE_PROGRAM, 32 ) AM_RANGE(0x80000000, 0x8001ffff) AM_RAM AM_RANGE(0xc0000000, 0xc001ffff) AM_RAM AM_RANGE(0x40000000, 0x4000000f) AM_READ(latch32_r) AM_WRITE(latch32_w) - AM_RANGE(0xfff80000, 0xffffffff) AM_READ(SMH_BANK2) + AM_RANGE(0xfff80000, 0xffffffff) AM_READ(SMH_BANK(2)) ADDRESS_MAP_END static ADDRESS_MAP_START( st0016_m2_io, ADDRESS_SPACE_IO, 8 ) diff --git a/src/mame/drivers/starwars.c b/src/mame/drivers/starwars.c index 29c3d886ce7..293b17ab8a1 100644 --- a/src/mame/drivers/starwars.c +++ b/src/mame/drivers/starwars.c @@ -496,7 +496,7 @@ ROM_END static DRIVER_INIT( starwars ) { /* X2212 nvram */ - generic_nvram = auto_malloc(generic_nvram_size); + generic_nvram = auto_alloc_array(machine, UINT8, generic_nvram_size); /* prepare the mathbox */ starwars_is_esb = 0; @@ -513,7 +513,7 @@ static DRIVER_INIT( esb ) UINT8 *rom = memory_region(machine, "maincpu"); /* X2212 nvram */ - generic_nvram = auto_malloc(generic_nvram_size); + generic_nvram = auto_alloc_array(machine, UINT8, generic_nvram_size); /* init the slapstic */ slapstic_init(machine, 101); @@ -527,7 +527,7 @@ static DRIVER_INIT( esb ) memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0x9fff, 0, 0, esb_slapstic_r, esb_slapstic_w); /* install additional banking */ - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa000, 0xffff, 0, 0, SMH_BANK2); + memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa000, 0xffff, 0, 0, (read8_space_func)SMH_BANK(2)); /* prepare the matrix processor */ starwars_is_esb = 1; diff --git a/src/mame/drivers/stv.c b/src/mame/drivers/stv.c index 9e3451d957a..7727c656efb 100644 --- a/src/mame/drivers/stv.c +++ b/src/mame/drivers/stv.c @@ -2309,9 +2309,9 @@ DRIVER_INIT ( stv ) minit_boost_timeslice = attotime_zero; sinit_boost_timeslice = attotime_zero; - smpc_ram = auto_malloc (0x80); - stv_scu = auto_malloc (0x100); - scsp_regs = auto_malloc (0x1000); + smpc_ram = auto_alloc_array(machine, UINT8, 0x80); + stv_scu = auto_alloc_array(machine, UINT32, 0x100/4); + scsp_regs = auto_alloc_array(machine, UINT16, 0x1000/2); install_stvbios_speedups(machine); diff --git a/src/mame/drivers/suna8.c b/src/mame/drivers/suna8.c index e347aaa02c3..b5bd4289d40 100644 --- a/src/mame/drivers/suna8.c +++ b/src/mame/drivers/suna8.c @@ -98,7 +98,7 @@ static UINT8 *brickzn_decrypt(running_machine *machine) const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); UINT8 *RAM = memory_region(machine, "maincpu"); size_t size = memory_region_length(machine, "maincpu"); - UINT8 *decrypt = auto_malloc(size); + UINT8 *decrypt = auto_alloc_array(machine, UINT8, size); int i; memory_set_decrypted_region(space, 0x0000, 0x7fff, decrypt); @@ -208,7 +208,7 @@ static DRIVER_INIT( hardhea2 ) const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); UINT8 *RAM = memory_region(machine, "maincpu"); size_t size = memory_region_length(machine, "maincpu"); - UINT8 *decrypt = auto_malloc(size); + UINT8 *decrypt = auto_alloc_array(machine, UINT8, size); UINT8 x; int i; @@ -282,7 +282,7 @@ rom13: 0?, 1y, 2n, 3n ?,?,?,? (palettes) } memory_configure_bank(machine, 1, 0, 16, memory_region(machine, "maincpu") + 0x10000, 0x4000); - memory_configure_bank(machine, 2, 0, 2, auto_malloc(0x2000 * 2), 0x2000); + memory_configure_bank(machine, 2, 0, 2, auto_alloc_array(machine, UINT8, 0x2000 * 2), 0x2000); } @@ -295,7 +295,7 @@ static DRIVER_INIT( starfigh ) const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); UINT8 *RAM = memory_region(machine, "maincpu"); size_t size = memory_region_length(machine, "maincpu"); - UINT8 *decrypt = auto_malloc(size); + UINT8 *decrypt = auto_alloc_array(machine, UINT8, size); UINT8 x; int i; @@ -363,7 +363,7 @@ static DRIVER_INIT( sparkman ) const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); UINT8 *RAM = memory_region(machine, "maincpu"); size_t size = memory_region_length(machine, "maincpu"); - UINT8 *decrypt = auto_malloc(size); + UINT8 *decrypt = auto_alloc_array(machine, UINT8, size); UINT8 x; int i; diff --git a/src/mame/drivers/superqix.c b/src/mame/drivers/superqix.c index bfec7c8afc6..3b8de6bbd11 100644 --- a/src/mame/drivers/superqix.c +++ b/src/mame/drivers/superqix.c @@ -142,7 +142,7 @@ static SAMPLES_START( pbillian_sh_start ) int i, len = memory_region_length(machine, "samples"); /* convert 8-bit unsigned samples to 8-bit signed */ - samplebuf = auto_malloc(len * 2); + samplebuf = auto_alloc_array(machine, INT16, len); for (i = 0;i < len;i++) samplebuf[i] = (INT8)(src[i] ^ 0x80) * 256; } diff --git a/src/mame/drivers/supertnk.c b/src/mame/drivers/supertnk.c index b7a0700e379..84b728276f7 100644 --- a/src/mame/drivers/supertnk.c +++ b/src/mame/drivers/supertnk.c @@ -172,9 +172,9 @@ static WRITE8_HANDLER( supertnk_interrupt_ack_w ) static VIDEO_START( supertnk ) { - supertnk_videoram[0] = auto_malloc(supertnk_videoram_size); - supertnk_videoram[1] = auto_malloc(supertnk_videoram_size); - supertnk_videoram[2] = auto_malloc(supertnk_videoram_size); + supertnk_videoram[0] = auto_alloc_array(machine, UINT8, supertnk_videoram_size); + supertnk_videoram[1] = auto_alloc_array(machine, UINT8, supertnk_videoram_size); + supertnk_videoram[2] = auto_alloc_array(machine, UINT8, supertnk_videoram_size); } diff --git a/src/mame/drivers/suprgolf.c b/src/mame/drivers/suprgolf.c index 03093c4f294..8468be6a398 100644 --- a/src/mame/drivers/suprgolf.c +++ b/src/mame/drivers/suprgolf.c @@ -70,9 +70,9 @@ static MACHINE_RESET( suprgolf ) static VIDEO_START( suprgolf ) { suprgolf_tilemap = tilemap_create( machine, get_tile_info,tilemap_scan_rows,8,8,32,32 ); - paletteram = auto_malloc(0x1000); - suprgolf_bg_vram = auto_malloc(0x2000*0x20); - suprgolf_bg_pen = auto_malloc(0x2000*0x20); + paletteram = auto_alloc_array(machine, UINT8, 0x1000); + suprgolf_bg_vram = auto_alloc_array(machine, UINT8, 0x2000*0x20); + suprgolf_bg_pen = auto_alloc_array(machine, UINT8, 0x2000*0x20); tilemap_set_transparent_pen(suprgolf_tilemap,15); } diff --git a/src/mame/drivers/tail2nos.c b/src/mame/drivers/tail2nos.c index ecb78537c08..026268ff718 100644 --- a/src/mame/drivers/tail2nos.c +++ b/src/mame/drivers/tail2nos.c @@ -70,8 +70,8 @@ static WRITE8_DEVICE_HANDLER( sound_bankswitch_w ) static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0x000000, 0x03ffff) AM_ROM - AM_RANGE(0x200000, 0x27ffff) AM_READWRITE(SMH_BANK1, SMH_ROM) /* extra ROM */ - AM_RANGE(0x2c0000, 0x2dffff) AM_READWRITE(SMH_BANK2, SMH_ROM) + AM_RANGE(0x200000, 0x27ffff) AM_READWRITE(SMH_BANK(1), SMH_ROM) /* extra ROM */ + AM_RANGE(0x2c0000, 0x2dffff) AM_READWRITE(SMH_BANK(2), SMH_ROM) AM_RANGE(0x400000, 0x41ffff) AM_READWRITE(tail2nos_zoomdata_r, tail2nos_zoomdata_w) AM_RANGE(0x500000, 0x500fff) AM_READWRITE(tail2nos_K051316_0_r, tail2nos_K051316_0_w) AM_RANGE(0x510000, 0x51001f) AM_WRITE(tail2nos_K051316_ctrl_0_w) @@ -88,7 +88,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x77ff) AM_ROM AM_RANGE(0x7800, 0x7fff) AM_RAM - AM_RANGE(0x8000, 0xffff) AM_READWRITE(SMH_BANK3, SMH_ROM) + AM_RANGE(0x8000, 0xffff) AM_READWRITE(SMH_BANK(3), SMH_ROM) ADDRESS_MAP_END static ADDRESS_MAP_START( sound_port_map, ADDRESS_SPACE_IO, 8 ) diff --git a/src/mame/drivers/taito_l.c b/src/mame/drivers/taito_l.c index b525f8780c2..09b84df0a0d 100644 --- a/src/mame/drivers/taito_l.c +++ b/src/mame/drivers/taito_l.c @@ -137,9 +137,9 @@ static void machine_init(running_machine *machine) { int i; - taitol_rambanks = auto_malloc(0x1000*12); - palette_ram = auto_malloc(0x1000); - empty_ram = auto_malloc(0x1000); + taitol_rambanks = auto_alloc_array(machine, UINT8, 0x1000*12); + palette_ram = auto_alloc_array(machine, UINT8, 0x1000); + empty_ram = auto_alloc_array(machine, UINT8, 0x1000); for(i=0;i<3;i++) irq_adr_table[i] = 0; diff --git a/src/mame/drivers/taitogn.c b/src/mame/drivers/taitogn.c index abb38a799e4..62dc7b76f8a 100644 --- a/src/mame/drivers/taitogn.c +++ b/src/mame/drivers/taitogn.c @@ -490,7 +490,7 @@ static void install_handlers(running_machine *machine, int mode) memory_install_readwrite32_handler(a, 0x1f000000, 0x1f1fffff, 0, 0, flash_subbios_r, flash_subbios_w); memory_install_readwrite32_handler(a, 0x1f200000, 0x1f2fffff, 0, 0, rf5c296_mem_r, rf5c296_mem_w); memory_install_readwrite32_handler(a, 0x1f300000, 0x1f37ffff, 0, 0, flash_mn102_r, flash_mn102_w); - memory_install_readwrite32_handler(a, 0x1f380000, 0x1f5fffff, 0, 0, SMH_NOP, SMH_NOP); + memory_install_readwrite32_handler(a, 0x1f380000, 0x1f5fffff, 0, 0, (read32_space_func)SMH_NOP, (write32_space_func)SMH_NOP); } else { // Mode 1 has access to the 3 samples flashes diff --git a/src/mame/drivers/taitojc.c b/src/mame/drivers/taitojc.c index b844fe7c32a..637b82fc585 100644 --- a/src/mame/drivers/taitojc.c +++ b/src/mame/drivers/taitojc.c @@ -1333,9 +1333,9 @@ MACHINE_DRIVER_END static DRIVER_INIT( taitojc ) { - f3_shared_ram = auto_malloc(0x800); + f3_shared_ram = auto_alloc_array(machine, UINT32, 0x800/4); - polygon_fifo = auto_malloc(POLYGON_FIFO_SIZE * sizeof(UINT16)); + polygon_fifo = auto_alloc_array(machine, UINT16, POLYGON_FIFO_SIZE); } ROM_START( sidebs ) diff --git a/src/mame/drivers/taitosj.c b/src/mame/drivers/taitosj.c index d7fc35729e3..ea9c0612dfe 100644 --- a/src/mame/drivers/taitosj.c +++ b/src/mame/drivers/taitosj.c @@ -199,7 +199,7 @@ static CUSTOM_INPUT( input_port_4_f0_r ) static ADDRESS_MAP_START( taitosj_main_nomcu_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x5fff) AM_ROM - AM_RANGE(0x6000, 0x7fff) AM_READWRITE(SMH_BANK1, SMH_ROM) + AM_RANGE(0x6000, 0x7fff) AM_READWRITE(SMH_BANK(1), SMH_ROM) AM_RANGE(0x8000, 0x87ff) AM_RAM AM_RANGE(0x8800, 0x8800) AM_MIRROR(0x07fe) AM_READWRITE(taitosj_fake_data_r, taitosj_fake_data_w) AM_RANGE(0x8801, 0x8801) AM_MIRROR(0x07fe) AM_READ(taitosj_fake_status_r) @@ -239,7 +239,7 @@ ADDRESS_MAP_END /* only difference is taitosj_fake_ replaced with taitosj_mcu_ */ static ADDRESS_MAP_START( taitosj_main_mcu_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x5fff) AM_ROM - AM_RANGE(0x6000, 0x7fff) AM_READWRITE(SMH_BANK1, SMH_ROM) + AM_RANGE(0x6000, 0x7fff) AM_READWRITE(SMH_BANK(1), SMH_ROM) AM_RANGE(0x8000, 0x87ff) AM_RAM AM_RANGE(0x8800, 0x8800) AM_MIRROR(0x07fe) AM_READWRITE(taitosj_mcu_data_r, taitosj_mcu_data_w) AM_RANGE(0x8801, 0x8801) AM_MIRROR(0x07fe) AM_READ(taitosj_mcu_status_r) @@ -302,7 +302,7 @@ static CUSTOM_INPUT( kikstart_gear_r ) static ADDRESS_MAP_START( kikstart_main_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x5fff) AM_ROM - AM_RANGE(0x6000, 0x7fff) AM_READWRITE(SMH_BANK1, SMH_ROM) + AM_RANGE(0x6000, 0x7fff) AM_READWRITE(SMH_BANK(1), SMH_ROM) AM_RANGE(0x8000, 0x87ff) AM_RAM AM_RANGE(0x8800, 0x8800) AM_READWRITE(taitosj_mcu_data_r, taitosj_mcu_data_w) AM_RANGE(0x8801, 0x8801) AM_READ(taitosj_mcu_status_r) diff --git a/src/mame/drivers/taitowlf.c b/src/mame/drivers/taitowlf.c index ba2d50ff2f1..cd4f904d740 100644 --- a/src/mame/drivers/taitowlf.c +++ b/src/mame/drivers/taitowlf.c @@ -667,7 +667,7 @@ static void taitowlf_set_keyb_int(running_machine *machine, int state) { static DRIVER_INIT( taitowlf ) { - bios_ram = auto_malloc(0x10000); + bios_ram = auto_alloc_array(machine, UINT32, 0x10000/4); init_pc_common(machine, PCCOMMON_KEYBOARD_AT, taitowlf_set_keyb_int); mc146818_init(machine, MC146818_STANDARD); diff --git a/src/mame/drivers/tankbust.c b/src/mame/drivers/tankbust.c index 2d0716ac826..1724c7f3c52 100644 --- a/src/mame/drivers/tankbust.c +++ b/src/mame/drivers/tankbust.c @@ -194,8 +194,8 @@ static READ8_HANDLER( some_changing_input ) static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x5fff) AM_ROM - AM_RANGE(0x6000, 0x9fff) AM_READWRITE(SMH_BANK1, SMH_ROM) - AM_RANGE(0xa000, 0xbfff) AM_READWRITE(SMH_BANK2, SMH_ROM) + AM_RANGE(0x6000, 0x9fff) AM_READWRITE(SMH_BANK(1), SMH_ROM) + AM_RANGE(0xa000, 0xbfff) AM_READWRITE(SMH_BANK(2), SMH_ROM) AM_RANGE(0xc000, 0xc7ff) AM_READWRITE(tankbust_background_videoram_r, tankbust_background_videoram_w) AM_BASE(&videoram) AM_RANGE(0xc800, 0xcfff) AM_READWRITE(tankbust_background_colorram_r, tankbust_background_colorram_w) AM_BASE(&colorram) AM_RANGE(0xd000, 0xd7ff) AM_READWRITE(tankbust_txtram_r, tankbust_txtram_w) AM_BASE(&tankbust_txtram) diff --git a/src/mame/drivers/taotaido.c b/src/mame/drivers/taotaido.c index 303299b5ed7..0a24b55936a 100644 --- a/src/mame/drivers/taotaido.c +++ b/src/mame/drivers/taotaido.c @@ -132,7 +132,7 @@ static WRITE8_HANDLER( taotaido_sh_bankswitch_w ) static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x77ff) AM_ROM AM_RANGE(0x7800, 0x7fff) AM_RAM - AM_RANGE(0x8000, 0xffff) AM_READWRITE(SMH_BANK1, SMH_ROM) + AM_RANGE(0x8000, 0xffff) AM_READWRITE(SMH_BANK(1), SMH_ROM) ADDRESS_MAP_END static ADDRESS_MAP_START( sound_port_map, ADDRESS_SPACE_IO, 8 ) diff --git a/src/mame/drivers/tbowl.c b/src/mame/drivers/tbowl.c index cf71b1787c7..473627be83b 100644 --- a/src/mame/drivers/tbowl.c +++ b/src/mame/drivers/tbowl.c @@ -110,7 +110,7 @@ static ADDRESS_MAP_START( 6206B_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0xc000, 0xdfff) AM_RAM_WRITE(tbowl_bgvideoram_w) AM_BASE(&tbowl_bgvideoram) AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(tbowl_txvideoram_w) AM_BASE(&tbowl_txvideoram) // AM_RANGE(0xf000, 0xf000) AM_WRITE(unknown_write) * written during start-up, not again */ - AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(SMH_BANK1, SMH_ROM) + AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(SMH_BANK(1), SMH_ROM) AM_RANGE(0xf800, 0xfbff) AM_READWRITE(shared_r, shared_w) AM_BASE(&shared_ram) /* check */ AM_RANGE(0xfc00, 0xfc00) AM_READ_PORT("P1") AM_WRITE(tbowlb_bankswitch_w) AM_RANGE(0xfc01, 0xfc01) AM_READ_PORT("P2") @@ -150,7 +150,7 @@ static ADDRESS_MAP_START( 6206C_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0xc000, 0xd7ff) AM_WRITE(SMH_RAM) AM_RANGE(0xd800, 0xdfff) AM_WRITE(SMH_RAM) AM_BASE(&tbowl_spriteram) AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_be_w) AM_BASE(&paletteram) // 2x palettes, one for each monitor? - AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(SMH_BANK2, SMH_ROM) + AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(SMH_BANK(2), SMH_ROM) AM_RANGE(0xf800, 0xfbff) AM_READWRITE(shared_r, shared_w) AM_RANGE(0xfc00, 0xfc00) AM_WRITE(tbowlc_bankswitch_w) AM_RANGE(0xfc01, 0xfc01) AM_WRITENOP /* ? */ diff --git a/src/mame/drivers/tcl.c b/src/mame/drivers/tcl.c index 5a27bce295e..754e31f14be 100644 --- a/src/mame/drivers/tcl.c +++ b/src/mame/drivers/tcl.c @@ -183,7 +183,7 @@ static DRIVER_INIT(tcl) const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); UINT8 *dest = memory_region(machine, "maincpu"); int len = memory_region_length(machine, "maincpu"); - UINT8 *src = malloc_or_die(len); + UINT8 *src = alloc_array_or_die(UINT8, len); int i,idx=0; memcpy(src, dest, len); diff --git a/src/mame/drivers/tecmosys.c b/src/mame/drivers/tecmosys.c index 42518710264..58184e216c5 100644 --- a/src/mame/drivers/tecmosys.c +++ b/src/mame/drivers/tecmosys.c @@ -559,11 +559,11 @@ ADDRESS_MAP_END static VIDEO_START(deroon) { - sprite_bitmap = auto_bitmap_alloc(320,240,BITMAP_FORMAT_INDEXED16); + sprite_bitmap = auto_bitmap_alloc(machine,320,240,BITMAP_FORMAT_INDEXED16); bitmap_fill(sprite_bitmap, NULL, 0x4000); - tmp_tilemap_composebitmap = auto_bitmap_alloc(320,240,BITMAP_FORMAT_INDEXED16); - tmp_tilemap_renderbitmap = auto_bitmap_alloc(320,240,BITMAP_FORMAT_INDEXED16); + tmp_tilemap_composebitmap = auto_bitmap_alloc(machine,320,240,BITMAP_FORMAT_INDEXED16); + tmp_tilemap_renderbitmap = auto_bitmap_alloc(machine,320,240,BITMAP_FORMAT_INDEXED16); bitmap_fill(tmp_tilemap_composebitmap, NULL, 0x0000); bitmap_fill(tmp_tilemap_renderbitmap, NULL, 0x0000); diff --git a/src/mame/drivers/thedeep.c b/src/mame/drivers/thedeep.c index 4d928a909bb..17568ec3f48 100644 --- a/src/mame/drivers/thedeep.c +++ b/src/mame/drivers/thedeep.c @@ -151,7 +151,7 @@ static WRITE8_HANDLER( thedeep_e100_w ) static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0xbfff) AM_READWRITE(SMH_BANK1, SMH_ROM) // ROM (banked) + AM_RANGE(0x8000, 0xbfff) AM_READWRITE(SMH_BANK(1), SMH_ROM) // ROM (banked) AM_RANGE(0xc000, 0xcfff) AM_RAM AM_RANGE(0xd000, 0xdfff) AM_RAM // RAM (MCU data copied here) AM_RANGE(0xe000, 0xe000) AM_READWRITE(thedeep_protection_r, thedeep_protection_w ) // To MCU diff --git a/src/mame/drivers/tmaster.c b/src/mame/drivers/tmaster.c index e8fd8f70cbb..bdaa9d9c2aa 100644 --- a/src/mame/drivers/tmaster.c +++ b/src/mame/drivers/tmaster.c @@ -602,9 +602,9 @@ static READ16_HANDLER( dummy_read_01 ) static ADDRESS_MAP_START( galgames_map, ADDRESS_SPACE_PROGRAM, 16 ) - AM_RANGE( 0x000000, 0x03ffff ) AM_READWRITE(SMH_BANK1, SMH_BANK2) + AM_RANGE( 0x000000, 0x03ffff ) AM_READWRITE(SMH_BANK(1), SMH_BANK(2)) AM_RANGE( 0x040000, 0x1fffff ) AM_ROM AM_REGION( "maincpu", 0 ) - AM_RANGE( 0x200000, 0x23ffff ) AM_READWRITE(SMH_BANK3, SMH_BANK4) + AM_RANGE( 0x200000, 0x23ffff ) AM_READWRITE(SMH_BANK(3), SMH_BANK(4)) AM_RANGE( 0x240000, 0x3fffff ) AM_ROM AM_REGION( "maincpu", 0 ) AM_RANGE( 0x400000, 0x400011 ) AM_WRITE( tmaster_blitter_w ) AM_BASE( &tmaster_regs ) diff --git a/src/mame/drivers/tmnt.c b/src/mame/drivers/tmnt.c index d3276f547c2..e7c4e19b3f1 100644 --- a/src/mame/drivers/tmnt.c +++ b/src/mame/drivers/tmnt.c @@ -280,7 +280,7 @@ static SAMPLES_START( tmnt_decode_sample ) int i; UINT8 *source = memory_region(machine, "title"); - sampledata = auto_malloc(0x40000*sizeof(sampledata[0])); + sampledata = auto_alloc_array(machine, INT16, 0x40000); /* Sound sample for TMNT.D05 is stored in the following mode (ym3012 format): * @@ -1229,7 +1229,7 @@ static WRITE8_DEVICE_HANDLER( k054539_ctrl_w ) static ADDRESS_MAP_START( prmrsocr_audio_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0xbfff) AM_READWRITE(SMH_BANK1, SMH_ROM) + AM_RANGE(0x8000, 0xbfff) AM_READWRITE(SMH_BANK(1), SMH_ROM) AM_RANGE(0xc000, 0xdfff) AM_RAM AM_RANGE(0xe000, 0xe0ff) AM_DEVREADWRITE("konami", k054539_r, k054539_w) AM_RANGE(0xe100, 0xe12f) AM_DEVREADWRITE("konami", k054539_ctrl_r, k054539_ctrl_w) @@ -3749,7 +3749,7 @@ static DRIVER_INIT( mia ) } } - temp = malloc_or_die(len); + temp = alloc_array_or_die(UINT8, len); memcpy(temp,gfxdata,len); for (A = 0;A < len/4;A++) { @@ -3845,7 +3845,7 @@ static DRIVER_INIT( tmnt ) } } - temp = malloc_or_die(len); + temp = alloc_array_or_die(UINT8, len); memcpy(temp,gfxdata,len); code_conv_table = &memory_region(machine, "proms")[0x0000]; for (A = 0;A < len/4;A++) diff --git a/src/mame/drivers/tnzs.c b/src/mame/drivers/tnzs.c index 8da05631fe8..15a11359c4d 100644 --- a/src/mame/drivers/tnzs.c +++ b/src/mame/drivers/tnzs.c @@ -664,7 +664,7 @@ static SAMPLES_START( kageki_init_samples ) size++; } } - sampledata[i] = auto_malloc(size * sizeof(sampledata[0])); + sampledata[i] = auto_alloc_array(machine, INT16, size); samplesize[i] = size; if (start < 0x100) start = size = 0; @@ -890,7 +890,7 @@ static WRITE8_HANDLER( jpopnics_palette_w ) static ADDRESS_MAP_START( jpopnics_main_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0xbfff) AM_READWRITE(SMH_BANK1, SMH_ROM) + AM_RANGE(0x8000, 0xbfff) AM_READWRITE(SMH_BANK(1), SMH_ROM) AM_RANGE(0xc000, 0xdfff) AM_RAM AM_BASE(&tnzs_objram) AM_RANGE(0xe000, 0xefff) AM_RAM AM_SHARE(1) /* WORK RAM (shared by the 2 z80's) */ AM_RANGE(0xf000, 0xf1ff) AM_RAM AM_BASE(&tnzs_vdcram) /* VDC RAM */ @@ -911,7 +911,7 @@ static WRITE8_HANDLER( jpopnics_subbankswitch_w ) static ADDRESS_MAP_START( jpopnics_sub_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0x9fff) AM_READWRITE(SMH_BANK2, SMH_ROM) + AM_RANGE(0x8000, 0x9fff) AM_READWRITE(SMH_BANK(2), SMH_ROM) AM_RANGE(0xa000, 0xa000) AM_WRITE(jpopnics_subbankswitch_w) AM_RANGE(0xb000, 0xb001) AM_DEVREADWRITE("ym", ym2151_r, ym2151_w) diff --git a/src/mame/drivers/toaplan2.c b/src/mame/drivers/toaplan2.c index 6d7310e0b7c..b51ede9fbd9 100644 --- a/src/mame/drivers/toaplan2.c +++ b/src/mame/drivers/toaplan2.c @@ -394,7 +394,7 @@ static DRIVER_INIT( fixeight ) #if USE_V25 #else - memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x28f002, 0x28fbff, 0, 0, SMH_BANK2, SMH_BANK2 ); + memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x28f002, 0x28fbff, 0, 0, (read16_space_func)SMH_BANK(2), (write16_space_func)SMH_BANK(2) ); memory_set_bankptr(machine, 2, fixeight_sec_cpu_mem); #endif @@ -921,7 +921,7 @@ static WRITE16_HANDLER( fixeight_sec_cpu_w ) /* game keeping service mode. It writes/reads the settings to/from */ /* these shared RAM locations. The secondary CPU reads/writes them */ /* from/to nvram to store the settings (a 93C45 EEPROM) */ - memory_install_readwrite16_handler(space, 0x28f002, 0x28fbff, 0, 0, SMH_BANK2, SMH_BANK2); + memory_install_readwrite16_handler(space, 0x28f002, 0x28fbff, 0, 0, (read16_space_func)SMH_BANK(2), (write16_space_func)SMH_BANK(2)); memory_set_bankptr(space->machine, 2, fixeight_sec_cpu_mem); memory_install_read_port_handler(space, 0x28f004, 0x28f005, 0, 0, "DSWA"); /* Dip Switch A - Wrong !!! */ memory_install_read_port_handler(space, 0x28f006, 0x28f007, 0, 0, "DSWB"); /* Dip Switch B - Wrong !!! */ @@ -1558,7 +1558,7 @@ static ADDRESS_MAP_START( fixeighb_68k_mem, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0x502000, 0x5021ff) AM_READWRITE(toaplan2_txvideoram16_offs_r, toaplan2_txvideoram16_offs_w) AM_BASE(&toaplan2_txvideoram16_offs) AM_SIZE(&toaplan2_tx_offs_vram_size) AM_RANGE(0x503000, 0x5031ff) AM_READWRITE(toaplan2_txscrollram16_r, toaplan2_txscrollram16_w) AM_BASE(&toaplan2_txscrollram16) AM_SIZE(&toaplan2_tx_scroll_vram_size) AM_RANGE(0x700000, 0x700001) AM_READ(video_count_r) - AM_RANGE(0x800000, 0x87ffff) AM_READ(SMH_BANK1) + AM_RANGE(0x800000, 0x87ffff) AM_READ(SMH_BANK(1)) ADDRESS_MAP_END diff --git a/src/mame/drivers/toki.c b/src/mame/drivers/toki.c index 70ec40c2b81..be0ff7074d1 100644 --- a/src/mame/drivers/toki.c +++ b/src/mame/drivers/toki.c @@ -148,7 +148,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( tokib_audio_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) AM_RANGE(0x0000, 0xbfff) AM_WRITE(SMH_ROM) AM_RANGE(0xe000, 0xe000) AM_DEVWRITE("msm", toki_adpcm_control_w) /* MSM5205 + ROM bank */ AM_RANGE(0xe400, 0xe400) AM_WRITE(toki_adpcm_data_w) @@ -729,7 +729,7 @@ ROM_END static DRIVER_INIT( toki ) { UINT8 *ROM = memory_region(machine, "oki"); - UINT8 *buffer = malloc_or_die(0x20000); + UINT8 *buffer = alloc_array_or_die(UINT8, 0x20000); int i; memcpy(buffer,ROM,0x20000); @@ -746,7 +746,7 @@ static DRIVER_INIT( toki ) static DRIVER_INIT( tokib ) { - UINT8 *temp = malloc_or_die(65536 * 2); + UINT8 *temp = alloc_array_or_die(UINT8, 65536 * 2); int i, offs, len; UINT8 *rom; @@ -808,7 +808,7 @@ static DRIVER_INIT(jujub) /* Decrypt data for z80 program */ { const address_space *space = cputag_get_address_space(machine, "audiocpu", ADDRESS_SPACE_PROGRAM); - UINT8 *decrypt = auto_malloc(0x20000); + UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x20000); UINT8 *rom = memory_region(machine, "audiocpu"); int i; @@ -825,7 +825,7 @@ static DRIVER_INIT(jujub) { UINT8 *ROM = memory_region(machine, "oki"); - UINT8 *buffer = malloc_or_die(0x20000); + UINT8 *buffer = alloc_array_or_die(UINT8, 0x20000); int i; memcpy(buffer,ROM,0x20000); diff --git a/src/mame/drivers/tomcat.c b/src/mame/drivers/tomcat.c index d1406299f2c..59799f13fd3 100644 --- a/src/mame/drivers/tomcat.c +++ b/src/mame/drivers/tomcat.c @@ -331,7 +331,7 @@ static MACHINE_START(tomcat) ((UINT16*)tomcat_shared_ram)[0x0002] = 0xf600; ((UINT16*)tomcat_shared_ram)[0x0003] = 0x0000; - tomcat_nvram = auto_malloc(0x800); + tomcat_nvram = auto_alloc_array(machine, UINT8, 0x800); state_save_register_global_pointer(machine, tomcat_nvram, 0x800); state_save_register_global(machine, tomcat_control_num); diff --git a/src/mame/drivers/trackfld.c b/src/mame/drivers/trackfld.c index 163a67622c7..3109e69835a 100644 --- a/src/mame/drivers/trackfld.c +++ b/src/mame/drivers/trackfld.c @@ -212,7 +212,7 @@ static ADDRESS_MAP_START( wizzquiz_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x3000, 0x37ff) AM_READ(SMH_RAM) AM_WRITE(trackfld_videoram_w) AM_BASE(&videoram) AM_RANGE(0x3800, 0x3fff) AM_READ(SMH_RAM) AM_WRITE(trackfld_colorram_w) AM_BASE(&colorram) AM_RANGE(0xc000, 0xc000) AM_WRITE(questions_bank_w) - AM_RANGE(0x6000, 0xdfff) AM_READ(SMH_BANK1) + AM_RANGE(0x6000, 0xdfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xe000, 0xffff) AM_ROM ADDRESS_MAP_END @@ -1132,13 +1132,13 @@ static DRIVER_INIT( atlantol ) memory_set_decrypted_region(space, 0x0000, 0xffff, decrypt); memory_install_write8_handler(space, 0x0800, 0x0800, 0, 0, atlantol_gfxbank_w); - memory_install_write8_handler(space, 0x1000, 0x1000, 0, 0, SMH_NOP); + memory_install_write8_handler(space, 0x1000, 0x1000, 0, 0, (write8_space_func)SMH_NOP); /* unmapped areas read as ROM */ - memory_install_read8_handler(space, 0x0000, 0x11ff, 0, 0, SMH_BANK10); - memory_install_read8_handler(space, 0x1380, 0x17ff, 0, 0, SMH_BANK11); - memory_install_read8_handler(space, 0x2000, 0x27ff, 0, 0, SMH_BANK12); - memory_install_read8_handler(space, 0x4000, 0x5fff, 0, 0, SMH_BANK13); + memory_install_read8_handler(space, 0x0000, 0x11ff, 0, 0, (read8_space_func)SMH_BANK(10)); + memory_install_read8_handler(space, 0x1380, 0x17ff, 0, 0, (read8_space_func)SMH_BANK(11)); + memory_install_read8_handler(space, 0x2000, 0x27ff, 0, 0, (read8_space_func)SMH_BANK(12)); + memory_install_read8_handler(space, 0x4000, 0x5fff, 0, 0, (read8_space_func)SMH_BANK(13)); memory_set_bankptr(machine, 10, &rom[0x0000]); memory_set_bankptr(machine, 11, &rom[0x1380]); memory_set_bankptr(machine, 12, &rom[0x2000]); diff --git a/src/mame/drivers/travrusa.c b/src/mame/drivers/travrusa.c index 2df0c734ca6..c6e7bf0abd9 100644 --- a/src/mame/drivers/travrusa.c +++ b/src/mame/drivers/travrusa.c @@ -462,7 +462,7 @@ static DRIVER_INIT( motorace ) { int A,j; UINT8 *rom = memory_region(machine, "maincpu"); - UINT8 *buffer = malloc_or_die(0x2000); + UINT8 *buffer = alloc_array_or_die(UINT8, 0x2000); memcpy(buffer,rom,0x2000); diff --git a/src/mame/drivers/trvmadns.c b/src/mame/drivers/trvmadns.c index b87bc7454b5..2dac079a6ac 100644 --- a/src/mame/drivers/trvmadns.c +++ b/src/mame/drivers/trvmadns.c @@ -198,8 +198,8 @@ static WRITE8_HANDLER( trvmadns_tileram_w ) static ADDRESS_MAP_START( cpu_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x5fff) AM_ROM - AM_RANGE(0x6000, 0x6fff) AM_READ(SMH_BANK1) - AM_RANGE(0x7000, 0x7fff) AM_READ(SMH_BANK2) + AM_RANGE(0x6000, 0x6fff) AM_READ(SMH_BANK(1)) + AM_RANGE(0x7000, 0x7fff) AM_READ(SMH_BANK(2)) AM_RANGE(0x6000, 0x7fff) AM_WRITE(trvmadns_gfxram_w) AM_BASE(&trvmadns_gfxram) AM_RANGE(0x8000, 0x87ff) AM_RAM AM_RANGE(0xc000, 0xc01f) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_le_w) AM_BASE(&paletteram) diff --git a/src/mame/drivers/ttchamp.c b/src/mame/drivers/ttchamp.c index 030b032e02e..e2376ce5579 100644 --- a/src/mame/drivers/ttchamp.c +++ b/src/mame/drivers/ttchamp.c @@ -123,8 +123,8 @@ static READ16_HANDLER( peno_rand2 ) static ADDRESS_MAP_START( ttchamp_map, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0x00000, 0x0ffff) AM_RAM AM_RANGE(0x10000, 0x1ffff) AM_RAM AM_BASE(&peno_vram) - AM_RANGE(0x20000, 0x7ffff) AM_READ(SMH_BANK1) // ? - AM_RANGE(0x80000, 0xfffff) AM_READ(SMH_BANK2) // ? + AM_RANGE(0x20000, 0x7ffff) AM_READ(SMH_BANK(1)) // ? + AM_RANGE(0x80000, 0xfffff) AM_READ(SMH_BANK(2)) // ? ADDRESS_MAP_END static ADDRESS_MAP_START( ttchamp_io, ADDRESS_SPACE_IO, 16 ) diff --git a/src/mame/drivers/tumbleb.c b/src/mame/drivers/tumbleb.c index 134623ac325..5e033cbc6d9 100644 --- a/src/mame/drivers/tumbleb.c +++ b/src/mame/drivers/tumbleb.c @@ -829,7 +829,7 @@ static WRITE8_HANDLER(jumppop_z80_bank_w) static ADDRESS_MAP_START( jumppop_sound_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x2fff) AM_ROM - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) AM_RANGE(0xf800, 0xffff) AM_RAM ADDRESS_MAP_END @@ -3574,7 +3574,7 @@ static DRIVER_INIT( htchctch ) HCROM[0x1e228/2] = 0x4e75; - memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x140000, 0x1407ff, 0, 0, SMH_NOP ); // kill palette writes as the interrupt code we don't have controls them + memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x140000, 0x1407ff, 0, 0, (write16_space_func)SMH_NOP ); // kill palette writes as the interrupt code we don't have controls them { @@ -3595,7 +3595,7 @@ static DRIVER_INIT( htchctch ) static void suprtrio_decrypt_code(running_machine *machine) { UINT16 *rom = (UINT16 *)memory_region(machine, "maincpu"); - UINT16 *buf = malloc_or_die(0x80000); + UINT16 *buf = alloc_array_or_die(UINT16, 0x80000/2); int i; /* decrypt main ROMs */ @@ -3615,7 +3615,7 @@ static void suprtrio_decrypt_code(running_machine *machine) static void suprtrio_decrypt_gfx(running_machine *machine) { UINT16 *rom = (UINT16 *)memory_region(machine, "gfx1"); - UINT16 *buf = malloc_or_die(0x100000); + UINT16 *buf = alloc_array_or_die(UINT16, 0x100000/2); int i; /* decrypt tiles */ diff --git a/src/mame/drivers/tumblep.c b/src/mame/drivers/tumblep.c index 8ce26b0a885..d03962a1ab5 100644 --- a/src/mame/drivers/tumblep.c +++ b/src/mame/drivers/tumblep.c @@ -136,7 +136,7 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x120000, 0x120001) AM_DEVREADWRITE("oki", okim6295_r, okim6295_w) AM_RANGE(0x130000, 0x130001) AM_NOP /* This board only has 1 oki chip */ AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r) - AM_RANGE(0x1f0000, 0x1f1fff) AM_READWRITE(SMH_BANK8, SMH_BANK8) + AM_RANGE(0x1f0000, 0x1f1fff) AM_READWRITE(SMH_BANK(8), SMH_BANK(8)) AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE(h6280_timer_w) AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE(h6280_irq_status_w) ADDRESS_MAP_END diff --git a/src/mame/drivers/twin16.c b/src/mame/drivers/twin16.c index 10eb8e5ad13..0a48f922964 100644 --- a/src/mame/drivers/twin16.c +++ b/src/mame/drivers/twin16.c @@ -94,8 +94,8 @@ enum /******************************************************************************************/ -#define COMRAM_r SMH_BANK1 -#define COMRAM_w SMH_BANK1 +#define COMRAM_r SMH_BANK(1) +#define COMRAM_w SMH_BANK(1) /* Read/Write Handlers */ @@ -1249,7 +1249,7 @@ static void gfx_untangle( running_machine *machine ) // sprite, tile data int i; - UINT16 *temp = malloc_or_die(0x200000); + UINT16 *temp = alloc_array_or_die(UINT16, 0x200000/2); twin16_gfx_rom = (UINT16 *)memory_region(machine, "gfx2"); memcpy( temp, twin16_gfx_rom, 0x200000 ); diff --git a/src/mame/drivers/twins.c b/src/mame/drivers/twins.c index f20b7b0ea19..4e5d6674bdb 100644 --- a/src/mame/drivers/twins.c +++ b/src/mame/drivers/twins.c @@ -94,7 +94,7 @@ ADDRESS_MAP_END static VIDEO_START(twins) { - twins_pal = auto_malloc(0x100*2); + twins_pal = auto_alloc_array(machine, UINT16, 0x100); } static VIDEO_UPDATE(twins) @@ -199,7 +199,7 @@ MACHINE_DRIVER_END static VIDEO_START(twinsa) { - twins_pal = auto_malloc(0x1000*2); + twins_pal = auto_alloc_array(machine, UINT16, 0x1000); } static VIDEO_UPDATE(twinsa) diff --git a/src/mame/drivers/upscope.c b/src/mame/drivers/upscope.c index b118c7bcbf9..f7a38651064 100644 --- a/src/mame/drivers/upscope.c +++ b/src/mame/drivers/upscope.c @@ -89,11 +89,11 @@ static WRITE8_DEVICE_HANDLER( upscope_cia_0_porta_w ) /* swap the write handlers between ROM and bank 1 based on the bit */ if ((data & 1) == 0) /* overlay disabled, map RAM on 0x000000 */ - memory_install_write16_handler(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, SMH_BANK1); + memory_install_write16_handler(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, (write16_space_func)SMH_BANK(1)); else /* overlay enabled, map Amiga system ROM on 0x000000 */ - memory_install_write16_handler(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, SMH_UNMAP); + memory_install_write16_handler(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, (write16_space_func)SMH_UNMAP); } @@ -388,7 +388,7 @@ static DRIVER_INIT( upscope ) /* allocate NVRAM */ generic_nvram_size = 0x100; - generic_nvram = auto_malloc(generic_nvram_size); + generic_nvram = auto_alloc_array(machine, UINT8, generic_nvram_size); /* set up memory */ memory_configure_bank(machine, 1, 0, 1, amiga_chip_ram, 0); diff --git a/src/mame/drivers/usgames.c b/src/mame/drivers/usgames.c index df061ff130c..2f7dcead51d 100644 --- a/src/mame/drivers/usgames.c +++ b/src/mame/drivers/usgames.c @@ -83,7 +83,7 @@ static ADDRESS_MAP_START( usgames_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x2400, 0x2401) AM_DEVWRITE("ay", ay8910_address_data_w) AM_RANGE(0x2800, 0x2fff) AM_RAM_WRITE(usgames_charram_w) AM_BASE(&usgames_charram) AM_RANGE(0x3000, 0x3fff) AM_RAM_WRITE(usgames_videoram_w) AM_BASE(&usgames_videoram) - AM_RANGE(0x4000, 0x7fff) AM_READWRITE(SMH_BANK1, SMH_ROM) + AM_RANGE(0x4000, 0x7fff) AM_READWRITE(SMH_BANK(1), SMH_ROM) AM_RANGE(0x8000, 0xffff) AM_ROM ADDRESS_MAP_END @@ -102,7 +102,7 @@ static ADDRESS_MAP_START( usg185_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x2470, 0x2470) AM_READ_PORT("UNK2") AM_RANGE(0x2800, 0x2fff) AM_RAM_WRITE(usgames_charram_w) AM_BASE(&usgames_charram) AM_RANGE(0x3000, 0x3fff) AM_RAM_WRITE(usgames_videoram_w) AM_BASE(&usgames_videoram) - AM_RANGE(0x4000, 0x7fff) AM_READWRITE(SMH_BANK1, SMH_ROM) + AM_RANGE(0x4000, 0x7fff) AM_READWRITE(SMH_BANK(1), SMH_ROM) AM_RANGE(0x8000, 0xffff) AM_ROM ADDRESS_MAP_END diff --git a/src/mame/drivers/vamphalf.c b/src/mame/drivers/vamphalf.c index 87f73a296cb..360a378a7e5 100644 --- a/src/mame/drivers/vamphalf.c +++ b/src/mame/drivers/vamphalf.c @@ -1707,7 +1707,7 @@ static DRIVER_INIT( wyvernwg ) static DRIVER_INIT( finalgdr ) { - finalgdr_backupram = auto_malloc(0x80*0x100); + finalgdr_backupram = auto_alloc_array(machine, UINT8, 0x80*0x100); memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x005e874, 0x005e877, 0, 0, finalgdr_speedup_r ); palshift = 0; diff --git a/src/mame/drivers/vaportra.c b/src/mame/drivers/vaportra.c index 7359b5773b6..38ce5025a85 100644 --- a/src/mame/drivers/vaportra.c +++ b/src/mame/drivers/vaportra.c @@ -86,7 +86,7 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x120000, 0x120001) AM_DEVREADWRITE("oki1", okim6295_r, okim6295_w) AM_RANGE(0x130000, 0x130001) AM_DEVREADWRITE("oki2", okim6295_r, okim6295_w) AM_RANGE(0x140000, 0x140001) AM_READ(vaportra_soundlatch_r) - AM_RANGE(0x1f0000, 0x1f1fff) AM_READWRITE(SMH_BANK8,SMH_BANK8) /* ??? LOOKUP ??? */ + AM_RANGE(0x1f0000, 0x1f1fff) AM_READWRITE(SMH_BANK(8),SMH_BANK(8)) /* ??? LOOKUP ??? */ AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE(h6280_timer_w) AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE(h6280_irq_status_w) ADDRESS_MAP_END diff --git a/src/mame/drivers/vcombat.c b/src/mame/drivers/vcombat.c index cd31f77e5a8..ded32d64cef 100644 --- a/src/mame/drivers/vcombat.c +++ b/src/mame/drivers/vcombat.c @@ -426,16 +426,16 @@ static DRIVER_INIT( vcombat ) memory_set_direct_update_handler(cputag_get_address_space(machine, "vid_1", ADDRESS_SPACE_PROGRAM), vid_1_direct_handler); /* Allocate the 68000 framebuffers */ - m68k_framebuffer[0] = auto_malloc(0x8000 * sizeof(UINT16)); - m68k_framebuffer[1] = auto_malloc(0x8000 * sizeof(UINT16)); + m68k_framebuffer[0] = auto_alloc_array(machine, UINT16, 0x8000); + m68k_framebuffer[1] = auto_alloc_array(machine, UINT16, 0x8000); /* First i860 */ - i860_framebuffer[0][0] = auto_malloc(0x8000 * sizeof(UINT16)); - i860_framebuffer[0][1] = auto_malloc(0x8000 * sizeof(UINT16)); + i860_framebuffer[0][0] = auto_alloc_array(machine, UINT16, 0x8000); + i860_framebuffer[0][1] = auto_alloc_array(machine, UINT16, 0x8000); /* Second i860 */ - i860_framebuffer[1][0] = auto_malloc(0x8000 * sizeof(UINT16)); - i860_framebuffer[1][1] = auto_malloc(0x8000 * sizeof(UINT16)); + i860_framebuffer[1][0] = auto_alloc_array(machine, UINT16, 0x8000); + i860_framebuffer[1][1] = auto_alloc_array(machine, UINT16, 0x8000); /* pc==4016 : jump 4038 ... There's something strange about how it waits at 402e (interrupts all masked out) I think what is happening here is that M0 snags the first time @@ -456,12 +456,12 @@ static DRIVER_INIT( vcombat ) static DRIVER_INIT( shadfgtr ) { /* Allocate th 68000 frame buffers */ - m68k_framebuffer[0] = auto_malloc(0x8000 * sizeof(UINT16)); - m68k_framebuffer[1] = auto_malloc(0x8000 * sizeof(UINT16)); + m68k_framebuffer[0] = auto_alloc_array(machine, UINT16, 0x8000); + m68k_framebuffer[1] = auto_alloc_array(machine, UINT16, 0x8000); /* Only one i860 */ - i860_framebuffer[0][0] = auto_malloc(0x8000 * sizeof(UINT16)); - i860_framebuffer[0][1] = auto_malloc(0x8000 * sizeof(UINT16)); + i860_framebuffer[0][0] = auto_alloc_array(machine, UINT16, 0x8000); + i860_framebuffer[0][1] = auto_alloc_array(machine, UINT16, 0x8000); i860_framebuffer[1][0] = NULL; i860_framebuffer[1][1] = NULL; diff --git a/src/mame/drivers/vegaeo.c b/src/mame/drivers/vegaeo.c index 1cef6f9946e..fe1eab56150 100644 --- a/src/mame/drivers/vegaeo.c +++ b/src/mame/drivers/vegaeo.c @@ -130,7 +130,7 @@ INPUT_PORTS_END static VIDEO_START( vega ) { - vega_vram = auto_malloc(0x14000*2); + vega_vram = auto_alloc_array(machine, UINT32, 0x14000*2/4); } static VIDEO_UPDATE( vega ) diff --git a/src/mame/drivers/vegas.c b/src/mame/drivers/vegas.c index 59dbed141d0..4b17ac28371 100644 --- a/src/mame/drivers/vegas.c +++ b/src/mame/drivers/vegas.c @@ -1557,7 +1557,7 @@ static void remap_dynamic_addresses(running_machine *machine) /* unmap everything we know about */ for (addr = 0; addr < dynamic_count; addr++) - memory_install_readwrite32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), dynamic[addr].start, dynamic[addr].end, 0, 0, SMH_UNMAP, SMH_UNMAP); + memory_install_readwrite32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), dynamic[addr].start, dynamic[addr].end, 0, 0, (read32_space_func)SMH_UNMAP, (write32_space_func)SMH_UNMAP); /* the build the list of stuff */ dynamic_count = 0; @@ -2469,7 +2469,7 @@ static void init_common(running_machine *machine, int ioasic, int serialnum) /* allocate RAM for the timekeeper */ timekeeper_nvram_size = 0x8000; - timekeeper_nvram = auto_malloc(timekeeper_nvram_size); + timekeeper_nvram = auto_alloc_array(machine, UINT32, timekeeper_nvram_size/4); } diff --git a/src/mame/drivers/vendetta.c b/src/mame/drivers/vendetta.c index c473345ad5a..7352e9dd27f 100644 --- a/src/mame/drivers/vendetta.c +++ b/src/mame/drivers/vendetta.c @@ -209,7 +209,7 @@ static void vendetta_video_banking( running_machine *machine, int select ) { if ( select & 1 ) { - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), video_banking_base + 0x2000, video_banking_base + 0x2fff, 0, 0, SMH_BANK4, paletteram_xBBBBBGGGGGRRRRR_be_w ); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), video_banking_base + 0x2000, video_banking_base + 0x2fff, 0, 0, (read8_space_func)SMH_BANK(4), paletteram_xBBBBBGGGGGRRRRR_be_w ); memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), video_banking_base + 0x0000, video_banking_base + 0x0fff, 0, 0, K053247_r, K053247_w ); memory_set_bankptr(machine, 4, paletteram); } diff --git a/src/mame/drivers/vigilant.c b/src/mame/drivers/vigilant.c index b9c13ef1166..61a0df20564 100644 --- a/src/mame/drivers/vigilant.c +++ b/src/mame/drivers/vigilant.c @@ -73,7 +73,7 @@ static WRITE8_HANDLER( kikcubic_coin_w ) static ADDRESS_MAP_START( vigilant_map, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) /* Fallthrough */ + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) /* Fallthrough */ AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0xc020, 0xc0df) AM_RAM_WRITE(SMH_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size) AM_RANGE(0xc800, 0xcfff) AM_RAM_WRITE(vigilant_paletteram_w) AM_BASE(&paletteram) @@ -94,7 +94,7 @@ static ADDRESS_MAP_START( vigilant_io_map, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_END static ADDRESS_MAP_START( kikcubic_map, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) /* Fallthrough */ + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1)) /* Fallthrough */ AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0xc000, 0xc0ff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size) AM_RANGE(0xc800, 0xcaff) AM_RAM_WRITE(vigilant_paletteram_w) AM_BASE(&paletteram) diff --git a/src/mame/drivers/wardner.c b/src/mame/drivers/wardner.c index 4efe2debc79..bbac58fa2c9 100644 --- a/src/mame/drivers/wardner.c +++ b/src/mame/drivers/wardner.c @@ -146,7 +146,7 @@ static WRITE8_HANDLER( wardner_ramrom_bank_sw ) if (data) { - memory_install_read8_handler(mainspace, 0x8000, 0xffff, 0, 0, SMH_BANK1); + memory_install_read8_handler(mainspace, 0x8000, 0xffff, 0, 0, (read8_space_func)SMH_BANK(1)); switch (data) { case 2: bankaddress = 0x10000; break; @@ -163,9 +163,9 @@ static WRITE8_HANDLER( wardner_ramrom_bank_sw ) else { memory_install_read8_handler(mainspace, 0x8000, 0x8fff, 0, 0, wardner_sprite_r); - memory_install_read8_handler(mainspace, 0xa000, 0xadff, 0, 0, SMH_BANK4); - memory_install_read8_handler(mainspace, 0xae00, 0xafff, 0, 0, SMH_BANK2); - memory_install_read8_handler(mainspace, 0xc000, 0xc7ff, 0, 0, SMH_BANK3); + memory_install_read8_handler(mainspace, 0xa000, 0xadff, 0, 0, (read8_space_func)SMH_BANK(4)); + memory_install_read8_handler(mainspace, 0xae00, 0xafff, 0, 0, (read8_space_func)SMH_BANK(2)); + memory_install_read8_handler(mainspace, 0xc000, 0xc7ff, 0, 0, (read8_space_func)SMH_BANK(3)); memory_set_bankptr(space->machine, 1, &RAM[0x0000]); memory_set_bankptr(space->machine, 2, rambase_ae00); memory_set_bankptr(space->machine, 3, rambase_c000); @@ -189,7 +189,7 @@ static ADDRESS_MAP_START( main_program_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x6fff) AM_ROM AM_RANGE(0x7000, 0x7fff) AM_RAM - AM_RANGE(0x8000, 0xffff) AM_READ(SMH_BANK1) /* Overlapped RAM/Banked ROM - See below */ + AM_RANGE(0x8000, 0xffff) AM_READ(SMH_BANK(1)) /* Overlapped RAM/Banked ROM - See below */ AM_RANGE(0x8000, 0x8fff) AM_WRITE(wardner_sprite_w) AM_BASE((void *)&spriteram16) AM_SIZE(&spriteram_size) AM_RANGE(0x9000, 0x9fff) AM_ROM diff --git a/src/mame/drivers/warriorb.c b/src/mame/drivers/warriorb.c index 867a731671e..b528db2dc04 100644 --- a/src/mame/drivers/warriorb.c +++ b/src/mame/drivers/warriorb.c @@ -249,7 +249,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( z80_sound_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_ROM - AM_RANGE(0x4000, 0x7fff) AM_READWRITE(SMH_BANK10, SMH_ROM) + AM_RANGE(0x4000, 0x7fff) AM_READWRITE(SMH_BANK(10), SMH_ROM) AM_RANGE(0xc000, 0xdfff) AM_RAM AM_RANGE(0xe000, 0xe003) AM_DEVREADWRITE("ym", ym2610_r, ym2610_w) AM_RANGE(0xe200, 0xe200) AM_READWRITE(SMH_NOP, taitosound_slave_port_w) diff --git a/src/mame/drivers/wc90.c b/src/mame/drivers/wc90.c index 987c73cf8e1..4b41d76b246 100644 --- a/src/mame/drivers/wc90.c +++ b/src/mame/drivers/wc90.c @@ -105,7 +105,7 @@ static ADDRESS_MAP_START( wc90_map_1, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0xc000, 0xcfff) AM_RAM_WRITE(wc90_bgvideoram_w) AM_BASE(&wc90_bgvideoram) AM_RANGE(0xd000, 0xdfff) AM_RAM AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(wc90_txvideoram_w) AM_BASE(&wc90_txvideoram) /* tx video ram */ - AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(SMH_BANK1, SMH_ROM) + AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(SMH_BANK(1), SMH_ROM) AM_RANGE(0xf800, 0xfbff) AM_READWRITE(wc90_shared_r, wc90_shared_w) AM_BASE(&wc90_shared) AM_RANGE(0xfc00, 0xfc00) AM_READ_PORT("P1") AM_RANGE(0xfc02, 0xfc02) AM_READ_PORT("P2") @@ -135,7 +135,7 @@ static ADDRESS_MAP_START( wc90_map_2, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(SMH_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size) AM_RANGE(0xd800, 0xdfff) AM_RAM AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_be_w) AM_BASE(&paletteram) - AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(SMH_BANK2, SMH_ROM) + AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(SMH_BANK(2), SMH_ROM) AM_RANGE(0xf800, 0xfbff) AM_READWRITE(wc90_shared_r, wc90_shared_w) AM_RANGE(0xfc00, 0xfc00) AM_WRITE(wc90_bankswitch1_w) AM_RANGE(0xfc01, 0xfc01) AM_WRITE(watchdog_reset_w) diff --git a/src/mame/drivers/wecleman.c b/src/mame/drivers/wecleman.c index 75ac23b0621..ff1055aa82d 100644 --- a/src/mame/drivers/wecleman.c +++ b/src/mame/drivers/wecleman.c @@ -1259,7 +1259,7 @@ static void wecleman_unpack_sprites(running_machine *machine) static void bitswap(UINT8 *src,size_t len,int _14,int _13,int _12,int _11,int _10,int _f,int _e,int _d,int _c,int _b,int _a,int _9,int _8,int _7,int _6,int _5,int _4,int _3,int _2,int _1,int _0) { - UINT8 *buffer = malloc_or_die(len); + UINT8 *buffer = alloc_array_or_die(UINT8, len); { int i; @@ -1375,7 +1375,7 @@ static void hotchase_sprite_decode( running_machine *machine, int num16_banks, i int i; base = memory_region(machine, "gfx1"); // sprites - temp = malloc_or_die( bank_size ); + temp = alloc_array_or_die(UINT8, bank_size ); for( i = num16_banks; i >0; i-- ){ UINT8 *finish = base + 2*bank_size*i; diff --git a/src/mame/drivers/welltris.c b/src/mame/drivers/welltris.c index 4a8a9461ae7..20a02ed631b 100644 --- a/src/mame/drivers/welltris.c +++ b/src/mame/drivers/welltris.c @@ -391,7 +391,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x77ff) AM_ROM AM_RANGE(0x7800, 0x7fff) AM_RAM - AM_RANGE(0x8000, 0xffff) AM_READ(SMH_BANK1) + AM_RANGE(0x8000, 0xffff) AM_READ(SMH_BANK(1)) ADDRESS_MAP_END static ADDRESS_MAP_START( sound_port_map, ADDRESS_SPACE_IO, 8 ) diff --git a/src/mame/drivers/wgp.c b/src/mame/drivers/wgp.c index 0ae1a49a018..e7ecf6cee8f 100644 --- a/src/mame/drivers/wgp.c +++ b/src/mame/drivers/wgp.c @@ -688,7 +688,7 @@ ADDRESS_MAP_END /***************************************************************************/ static ADDRESS_MAP_START( z80_sound_map, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK10) /* Fallthrough */ + AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK(10)) /* Fallthrough */ AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0xc000, 0xdfff) AM_RAM AM_RANGE(0xe000, 0xe003) AM_DEVREADWRITE("ym", ym2610_r, ym2610_w) diff --git a/src/mame/drivers/williams.c b/src/mame/drivers/williams.c index 77936881e0a..322a711a20b 100644 --- a/src/mame/drivers/williams.c +++ b/src/mame/drivers/williams.c @@ -527,10 +527,10 @@ void defender_install_io_space(const address_space *space) const device_config *pia_1 = devtag_get_device(space->machine, "pia_1"); /* this routine dynamically installs the memory mapped above from c000-cfff */ - memory_install_write8_handler (space, 0xc000, 0xc00f, 0, 0x03e0, SMH_BANK4); + memory_install_write8_handler (space, 0xc000, 0xc00f, 0, 0x03e0, (write8_space_func)SMH_BANK(4)); memory_install_write8_handler (space, 0xc010, 0xc01f, 0, 0x03e0, defender_video_control_w); memory_install_write8_handler (space, 0xc3ff, 0xc3ff, 0, 0, williams_watchdog_reset_w); - memory_install_readwrite8_handler(space, 0xc400, 0xc4ff, 0, 0x0300, SMH_BANK3, williams_cmos_w); + memory_install_readwrite8_handler(space, 0xc400, 0xc4ff, 0, 0x0300, (read8_space_func)SMH_BANK(3), williams_cmos_w); memory_install_read8_handler (space, 0xc800, 0xcbff, 0, 0x03e0, williams_video_counter_r); memory_install_readwrite8_device_handler(space, pia_1, 0xcc00, 0xcc03, 0, 0x03e0, pia6821_r, pia6821_w); memory_install_readwrite8_device_handler(space, pia_0, 0xcc04, 0xcc07, 0, 0x03e0, pia6821_r, pia6821_w); @@ -547,7 +547,7 @@ void defender_install_io_space(const address_space *space) *************************************/ static ADDRESS_MAP_START( williams_map, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x8fff) AM_READWRITE(SMH_BANK1, SMH_RAM) AM_BASE(&williams_videoram) + AM_RANGE(0x0000, 0x8fff) AM_READWRITE(SMH_BANK(1), SMH_RAM) AM_BASE(&williams_videoram) AM_RANGE(0x9000, 0xbfff) AM_RAM AM_RANGE(0xc000, 0xc00f) AM_MIRROR(0x03f0) AM_WRITE(SMH_RAM) AM_BASE(&paletteram) AM_RANGE(0xc804, 0xc807) AM_MIRROR(0x00f0) AM_DEVREADWRITE("pia_0", pia6821_r, pia6821_w) @@ -562,7 +562,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( williams_extra_ram_map, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x8fff) AM_READWRITE(SMH_BANK1, SMH_RAM) AM_BASE(&williams_videoram) + AM_RANGE(0x0000, 0x8fff) AM_READWRITE(SMH_BANK(1), SMH_RAM) AM_BASE(&williams_videoram) AM_RANGE(0x9000, 0xbfff) AM_RAM AM_RANGE(0xc000, 0xc00f) AM_MIRROR(0x03f0) AM_WRITE(SMH_RAM) AM_BASE(&paletteram) AM_RANGE(0xc804, 0xc807) AM_MIRROR(0x00f0) AM_DEVREADWRITE("pia_0", pia6821_r, pia6821_w) @@ -585,8 +585,8 @@ ADDRESS_MAP_END *************************************/ static ADDRESS_MAP_START( blaster_map, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x3fff) AM_READWRITE(SMH_BANK1, SMH_RAM) AM_BASE(&williams_videoram) - AM_RANGE(0x4000, 0x8fff) AM_READWRITE(SMH_BANK2, SMH_RAM) + AM_RANGE(0x0000, 0x3fff) AM_READWRITE(SMH_BANK(1), SMH_RAM) AM_BASE(&williams_videoram) + AM_RANGE(0x4000, 0x8fff) AM_READWRITE(SMH_BANK(2), SMH_RAM) AM_RANGE(0xbb00, 0xbbff) AM_WRITE(SMH_RAM) AM_BASE(&blaster_palette_0) AM_RANGE(0xbc00, 0xbcff) AM_WRITE(SMH_RAM) AM_BASE(&blaster_scanline_control) AM_RANGE(0x9000, 0xbfff) AM_RAM @@ -613,7 +613,7 @@ ADDRESS_MAP_END *************************************/ static ADDRESS_MAP_START( williams2_map, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x7fff) AM_READWRITE(SMH_BANK1, SMH_RAM) AM_BASE(&williams_videoram) + AM_RANGE(0x0000, 0x7fff) AM_READWRITE(SMH_BANK(1), SMH_RAM) AM_BASE(&williams_videoram) AM_RANGE(0x8000, 0xbfff) AM_RAM AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(williams2_tileram_w) AM_BASE(&williams2_tileram) AM_RANGE(0xc800, 0xc87f) AM_WRITE(williams2_bank_select_w) @@ -635,7 +635,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( williams2_extra_ram_map, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x7fff) AM_READWRITE(SMH_BANK1, SMH_RAM) AM_BASE(&williams_videoram) + AM_RANGE(0x0000, 0x7fff) AM_READWRITE(SMH_BANK(1), SMH_RAM) AM_BASE(&williams_videoram) AM_RANGE(0x8000, 0xbfff) AM_RAM AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(williams2_tileram_w) AM_BASE(&williams2_tileram) AM_RANGE(0xc800, 0xc87f) AM_WRITE(williams2_bank_select_w) @@ -2811,14 +2811,14 @@ static DRIVER_INIT( spdball ) static DRIVER_INIT( alienar ) { CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC01, 0xc000); - memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xcbff, 0xcbff, 0, 0, SMH_NOP); + memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xcbff, 0xcbff, 0, 0, (write8_space_func)SMH_NOP); } static DRIVER_INIT( alienaru ) { CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC01, 0xc000); - memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xcbff, 0xcbff, 0, 0, SMH_NOP); + memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xcbff, 0xcbff, 0, 0, (write8_space_func)SMH_NOP); } diff --git a/src/mame/drivers/wink.c b/src/mame/drivers/wink.c index 1cdb921bc27..53ff6bf44d7 100644 --- a/src/mame/drivers/wink.c +++ b/src/mame/drivers/wink.c @@ -394,7 +394,7 @@ static DRIVER_INIT( wink ) { UINT32 i; UINT8 *ROM = memory_region(machine, "maincpu"); - UINT8 *buffer = malloc_or_die(0x8000); + UINT8 *buffer = alloc_array_or_die(UINT8, 0x8000); // protection module reverse engineered by HIGHWAYMAN diff --git a/src/mame/drivers/witch.c b/src/mame/drivers/witch.c index 6d21c9f33be..8d6fc27c2d6 100644 --- a/src/mame/drivers/witch.c +++ b/src/mame/drivers/witch.c @@ -439,7 +439,7 @@ static const ym2203_interface ym2203_interface_1 = static ADDRESS_MAP_START( map_main, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, UNBANKED_SIZE-1) AM_ROM - AM_RANGE(UNBANKED_SIZE, 0x7fff) AM_READ(SMH_BANK1) + AM_RANGE(UNBANKED_SIZE, 0x7fff) AM_READ(SMH_BANK(1)) AM_RANGE(0x8000, 0x8001) AM_DEVREADWRITE("ym1", ym2203_r, ym2203_w) AM_RANGE(0x8008, 0x8009) AM_DEVREADWRITE("ym2", ym2203_r, ym2203_w) AM_RANGE(0xa000, 0xa00f) AM_READWRITE(read_a00x, write_a00x) diff --git a/src/mame/drivers/wiz.c b/src/mame/drivers/wiz.c index 6cc28179342..3c4bb580e8d 100644 --- a/src/mame/drivers/wiz.c +++ b/src/mame/drivers/wiz.c @@ -1052,7 +1052,7 @@ static DRIVER_INIT( stinger ) const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); UINT8 *rom = memory_region(machine, "maincpu"); int size = memory_region_length(machine, "maincpu"); - UINT8 *decrypt = auto_malloc(size); + UINT8 *decrypt = auto_alloc_array(machine, UINT8, size); int A; const UINT8 *tbl; @@ -1086,7 +1086,7 @@ static DRIVER_INIT( stinger ) static DRIVER_INIT( scion ) { - memory_install_write8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x4000, 0x4001, 0, 0, SMH_NOP); + memory_install_write8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x4000, 0x4001, 0, 0, (write8_space_func)SMH_NOP); } diff --git a/src/mame/drivers/xexex.c b/src/mame/drivers/xexex.c index dabdcd08d57..5f727ef167f 100644 --- a/src/mame/drivers/xexex.c +++ b/src/mame/drivers/xexex.c @@ -393,7 +393,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK2) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(2)) AM_RANGE(0x0000, 0xbfff) AM_ROM AM_RANGE(0xc000, 0xdfff) AM_RAM AM_RANGE(0xe000, 0xe22f) AM_DEVREADWRITE("konami", k054539_r, k054539_w) diff --git a/src/mame/drivers/xmen.c b/src/mame/drivers/xmen.c index 753656681fb..098cae35266 100644 --- a/src/mame/drivers/xmen.c +++ b/src/mame/drivers/xmen.c @@ -179,7 +179,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK4) + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(4)) AM_RANGE(0x8000, 0xbfff) AM_WRITE(SMH_ROM) AM_RANGE(0xc000, 0xdfff) AM_RAM AM_RANGE(0xe000, 0xe22f) AM_DEVREADWRITE("konami", k054539_r, k054539_w) diff --git a/src/mame/drivers/yumefuda.c b/src/mame/drivers/yumefuda.c index 1b9a8f7afb2..445658109e8 100644 --- a/src/mame/drivers/yumefuda.c +++ b/src/mame/drivers/yumefuda.c @@ -224,7 +224,7 @@ static const ay8910_interface ay8910_config = static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0x9fff) AM_READWRITE(SMH_BANK1, SMH_ROM) + AM_RANGE(0x8000, 0x9fff) AM_READWRITE(SMH_BANK(1), SMH_ROM) AM_RANGE(0xa7fc, 0xa7fc) AM_WRITE(prot_lock_w) AM_RANGE(0xa7ff, 0xa7ff) AM_WRITE(eeprom_w) AM_RANGE(0xaf80, 0xafff) AM_READWRITE(custom_ram_r, custom_ram_w) AM_BASE(&cus_ram) diff --git a/src/mame/drivers/yunsung8.c b/src/mame/drivers/yunsung8.c index 873f7e05ce2..45bb61cbe31 100644 --- a/src/mame/drivers/yunsung8.c +++ b/src/mame/drivers/yunsung8.c @@ -56,7 +56,7 @@ VIDEO_UPDATE( yunsung8 ); static MACHINE_RESET( yunsung8 ) { const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); - UINT8* yunsung8_videoram = auto_malloc(0x4000); + UINT8* yunsung8_videoram = auto_alloc_array(machine, UINT8, 0x4000); yunsung8_videoram_0 = yunsung8_videoram + 0x0000; // Ram is banked yunsung8_videoram_1 = yunsung8_videoram + 0x2000; @@ -99,7 +99,7 @@ static WRITE8_HANDLER( yunsung8_bankswitch_w ) static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0001, 0x0001) AM_WRITE(yunsung8_bankswitch_w ) // ROM Bank (again?) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1 ) // Banked ROM + AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK(1) ) // Banked ROM AM_RANGE(0x0000, 0xbfff) AM_ROM AM_RANGE(0xc000, 0xdfff) AM_READWRITE(yunsung8_videoram_r, yunsung8_videoram_w ) // Video RAM (Banked) AM_RANGE(0xe000, 0xffff) AM_RAM @@ -155,7 +155,7 @@ static WRITE8_HANDLER( yunsung8_adpcm_w ) static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0xbfff) AM_READWRITE(SMH_BANK2,SMH_ROM ) // Banked ROM + AM_RANGE(0x8000, 0xbfff) AM_READWRITE(SMH_BANK(2),SMH_ROM ) // Banked ROM AM_RANGE(0xe000, 0xe000) AM_DEVWRITE("msm", yunsung8_sound_bankswitch_w ) // ROM Bank AM_RANGE(0xe400, 0xe400) AM_WRITE(yunsung8_adpcm_w ) AM_RANGE(0xec00, 0xec01) AM_DEVWRITE("ym", ym3812_w ) diff --git a/src/mame/drivers/zaxxon.c b/src/mame/drivers/zaxxon.c index 2081327344f..04d4816cce4 100644 --- a/src/mame/drivers/zaxxon.c +++ b/src/mame/drivers/zaxxon.c @@ -1436,7 +1436,7 @@ static void zaxxonb_decode(running_machine *machine, const char *cputag) const address_space *space = cputag_get_address_space(machine, cputag, ADDRESS_SPACE_PROGRAM); UINT8 *rom = memory_region(machine, cputag); int size = memory_region_length(machine, cputag); - UINT8 *decrypt = auto_malloc(size); + UINT8 *decrypt = auto_alloc_array(machine, UINT8, size); memory_set_decrypted_region(space, 0x0000, size - 1, decrypt); diff --git a/src/mame/drivers/zn.c b/src/mame/drivers/zn.c index 3643c594b0b..828f1abdd79 100644 --- a/src/mame/drivers/zn.c +++ b/src/mame/drivers/zn.c @@ -653,12 +653,12 @@ static WRITE32_HANDLER( zn_qsound_w ) static DRIVER_INIT( coh1000c ) { - memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f3fffff, 0, 0, SMH_BANK1 ); /* fixed game rom */ - memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f400000, 0x1f7fffff, 0, 0, SMH_BANK2 ); /* banked game rom */ + memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f3fffff, 0, 0, (read32_space_func)SMH_BANK(1) ); /* fixed game rom */ + memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f400000, 0x1f7fffff, 0, 0, (read32_space_func)SMH_BANK(2) ); /* banked game rom */ memory_install_write32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb00000, 0x1fb00003, 0, 0, bank_coh1000c_w ); /* bankswitch */ memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb40010, 0x1fb40013, 0, 0, capcom_kickharness_r ); memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb40020, 0x1fb40023, 0, 0, capcom_kickharness_r ); - memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb80000, 0x1fbfffff, 0, 0, SMH_BANK3 ); /* country rom */ + memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb80000, 0x1fbfffff, 0, 0, (read32_space_func)SMH_BANK(3) ); /* country rom */ memory_install_write32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb60000, 0x1fb60003, 0, 0, zn_qsound_w ); zn_driver_init(machine); @@ -872,12 +872,12 @@ static WRITE32_HANDLER( bank_coh3002c_w ) static DRIVER_INIT( coh3002c ) { - memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f3fffff, 0, 0, SMH_BANK1 ); /* fixed game rom */ - memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f400000, 0x1f7fffff, 0, 0, SMH_BANK2 ); /* banked game rom */ + memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f3fffff, 0, 0, (read32_space_func)SMH_BANK(1) ); /* fixed game rom */ + memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f400000, 0x1f7fffff, 0, 0, (read32_space_func)SMH_BANK(2) ); /* banked game rom */ memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb40010, 0x1fb40013, 0, 0, capcom_kickharness_r ); memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb40020, 0x1fb40023, 0, 0, capcom_kickharness_r ); memory_install_write32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb00000, 0x1fb00003, 0, 0, bank_coh3002c_w ); /* bankswitch */ - memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb80000, 0x1fbfffff, 0, 0, SMH_BANK3 ); /* country rom */ + memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb80000, 0x1fbfffff, 0, 0, (read32_space_func)SMH_BANK(3) ); /* country rom */ memory_install_write32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb60000, 0x1fb60003, 0, 0, zn_qsound_w ); zn_driver_init(machine); @@ -1160,12 +1160,12 @@ static WRITE32_HANDLER( taitofx1a_ymsound_w ) static DRIVER_INIT( coh1000ta ) { - taitofx1_eeprom_size1 = 0x200; taitofx1_eeprom1 = auto_malloc( taitofx1_eeprom_size1 ); + taitofx1_eeprom_size1 = 0x200; taitofx1_eeprom1 = auto_alloc_array(machine, UINT8, taitofx1_eeprom_size1 ); - memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f7fffff, 0, 0, SMH_BANK1 ); /* banked game rom */ + memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f7fffff, 0, 0, (read32_space_func)SMH_BANK(1) ); /* banked game rom */ memory_install_write32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb40000, 0x1fb40003, 0, 0, bank_coh1000t_w ); /* bankswitch */ memory_install_readwrite32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb80000, 0x1fb80003, 0, 0, taitofx1a_ymsound_r, taitofx1a_ymsound_w ); - memory_install_readwrite32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fbe0000, 0x1fbe0000 + ( taitofx1_eeprom_size1 - 1 ), 0, 0, SMH_BANK2, SMH_BANK2 ); + memory_install_readwrite32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fbe0000, 0x1fbe0000 + ( taitofx1_eeprom_size1 - 1 ), 0, 0, (read32_space_func)SMH_BANK(2), (write32_space_func)SMH_BANK(2) ); zn_driver_init(machine); mb3773_init(machine); @@ -1195,7 +1195,7 @@ static NVRAM_HANDLER( coh1000ta ) } static ADDRESS_MAP_START( fx1a_sound_map, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK10) /* Fallthrough */ + AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK(10)) /* Fallthrough */ AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0xc000, 0xdfff) AM_RAM AM_RANGE(0xe000, 0xe003) AM_DEVREADWRITE("ym", ym2610_r, ym2610_w) @@ -1253,16 +1253,16 @@ static READ32_HANDLER( taitofx1b_sound_r ) static DRIVER_INIT( coh1000tb ) { - taitofx1_eeprom_size1 = 0x400; taitofx1_eeprom1 = auto_malloc( taitofx1_eeprom_size1 ); - taitofx1_eeprom_size2 = 0x200; taitofx1_eeprom2 = auto_malloc( taitofx1_eeprom_size2 ); + taitofx1_eeprom_size1 = 0x400; taitofx1_eeprom1 = auto_alloc_array(machine, UINT8, taitofx1_eeprom_size1 ); + taitofx1_eeprom_size2 = 0x200; taitofx1_eeprom2 = auto_alloc_array(machine, UINT8, taitofx1_eeprom_size2 ); - memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f7fffff, 0, 0, SMH_BANK1 ); /* banked game rom */ - memory_install_readwrite32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb00000, 0x1fb00000 + ( taitofx1_eeprom_size1 - 1 ), 0, 0, SMH_BANK2, SMH_BANK2 ); + memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f7fffff, 0, 0, (read32_space_func)SMH_BANK(1) ); /* banked game rom */ + memory_install_readwrite32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb00000, 0x1fb00000 + ( taitofx1_eeprom_size1 - 1 ), 0, 0, (read32_space_func)SMH_BANK(2), (write32_space_func)SMH_BANK(2) ); memory_install_write32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb40000, 0x1fb40003, 0, 0, bank_coh1000t_w ); /* bankswitch */ memory_install_write32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb80000, 0x1fb80003, 0, 0, taitofx1b_volume_w ); memory_install_write32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fba0000, 0x1fba0003, 0, 0, taitofx1b_sound_w ); memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fbc0000, 0x1fbc0003, 0, 0, taitofx1b_sound_r ); - memory_install_readwrite32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fbe0000, 0x1fbe0000 + ( taitofx1_eeprom_size2 - 1 ), 0, 0, SMH_BANK3, SMH_BANK3 ); + memory_install_readwrite32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fbe0000, 0x1fbe0000 + ( taitofx1_eeprom_size2 - 1 ), 0, 0, (read32_space_func)SMH_BANK(3), (write32_space_func)SMH_BANK(3) ); zn_driver_init(machine); mb3773_init(machine); @@ -1458,10 +1458,10 @@ static DRIVER_INIT( coh1000w ) { const device_config *ide = devtag_get_device(machine, "ide"); - memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f1fffff, 0, 0, SMH_BANK1 ); - memory_install_write32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f000003, 0, 0, SMH_NOP ); + memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f1fffff, 0, 0, (read32_space_func)SMH_BANK(1) ); + memory_install_write32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f000003, 0, 0, (write32_space_func)SMH_NOP ); memory_install_readwrite32_device_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), ide, 0x1f7e4000, 0x1f7e4fff, 0, 0, ide_controller32_r, ide_controller32_w ); - memory_install_readwrite32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f7e8000, 0x1f7e8003, 0, 0, SMH_NOP, SMH_NOP ); + memory_install_readwrite32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f7e8000, 0x1f7e8003, 0, 0, (read32_space_func)SMH_NOP, (write32_space_func)SMH_NOP ); memory_install_readwrite32_device_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), ide, 0x1f7f4000, 0x1f7f4fff, 0, 0, ide_controller32_r, ide_controller32_w ); zn_driver_init(machine); @@ -1649,7 +1649,7 @@ static WRITE32_HANDLER( coh1002e_latch_w ) static DRIVER_INIT( coh1002e ) { - memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f7fffff, 0, 0, SMH_BANK1 ); + memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f7fffff, 0, 0, (read32_space_func)SMH_BANK(1) ); memory_install_write32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fa10300, 0x1fa10303, 0, 0, coh1002e_bank_w ); memory_install_write32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb00000, 0x1fb00007, 0, 0, coh1002e_latch_w ); @@ -1791,8 +1791,8 @@ static READ32_HANDLER( bam2_unk_r ) static DRIVER_INIT( bam2 ) { - memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f3fffff, 0, 0, SMH_BANK1 ); - memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f400000, 0x1f7fffff, 0, 0, SMH_BANK2 ); + memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f3fffff, 0, 0, (read32_space_func)SMH_BANK(1) ); + memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f400000, 0x1f7fffff, 0, 0, (read32_space_func)SMH_BANK(2) ); memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb00000, 0x1fb00007, 0, 0, bam2_mcu_r ); memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fa20000, 0x1fa20003, 0, 0, bam2_unk_r ); memory_install_write32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fa10300, 0x1fa10303, 0, 0, bam2_sec_w ); @@ -2111,15 +2111,15 @@ static READ32_HANDLER( nbajamex_80_r ) static DRIVER_INIT( coh1000a ) { - memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f1fffff, 0, 0, SMH_BANK1 ); + memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f1fffff, 0, 0, (read32_space_func)SMH_BANK(1) ); memory_install_write32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fbfff00, 0x1fbfff03, 0, 0, acpsx_00_w ); memory_install_write32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fbfff10, 0x1fbfff13, 0, 0, acpsx_10_w ); if( strcmp( machine->gamedrv->name, "nbajamex" ) == 0 ) { - nbajamex_eeprom_size = 0x8000; nbajamex_eeprom = auto_malloc( nbajamex_eeprom_size ); + nbajamex_eeprom_size = 0x8000; nbajamex_eeprom = auto_alloc_array(machine, UINT8, nbajamex_eeprom_size ); - memory_install_readwrite32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f200000, 0x1f200000 + ( nbajamex_eeprom_size - 1 ), 0, 0, SMH_BANK2, SMH_BANK2 ); + memory_install_readwrite32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f200000, 0x1f200000 + ( nbajamex_eeprom_size - 1 ), 0, 0, (read32_space_func)SMH_BANK(2), (write32_space_func)SMH_BANK(2) ); memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fbfff08, 0x1fbfff0b, 0, 0, nbajamex_08_r ); memory_install_readwrite32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fbfff80, 0x1fbfff83, 0, 0, nbajamex_80_r, nbajamex_80_w ); @@ -2132,7 +2132,7 @@ static DRIVER_INIT( coh1000a ) const device_config *ide = devtag_get_device(machine, "ide"); memory_install_read32_device_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), ide, 0x1fbfff8c, 0x1fbfff8f, 0, 0, jdredd_idestat_r ); - memory_install_write32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fbfff8c, 0x1fbfff8f, 0, 0, SMH_NOP ); + memory_install_write32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fbfff8c, 0x1fbfff8f, 0, 0, (write32_space_func)SMH_NOP ); memory_install_readwrite32_device_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), ide, 0x1fbfff90, 0x1fbfff9f, 0, 0, jdredd_ide_r, jdredd_ide_w ); } @@ -2290,7 +2290,7 @@ static WRITE32_HANDLER( coh1001l_bnk_w ) static DRIVER_INIT( coh1001l ) { - memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f7fffff, 0, 0, SMH_BANK1 ); /* banked rom */ + memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f7fffff, 0, 0, (read32_space_func)SMH_BANK(1) ); /* banked rom */ memory_install_write32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb00000, 0x1fb00003, 0, 0, coh1001l_bnk_w ); zn_driver_init(machine); @@ -2333,8 +2333,8 @@ static WRITE32_HANDLER( coh1002v_bnk_w ) static DRIVER_INIT( coh1002v ) { - memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f27ffff, 0, 0, SMH_BANK1 ); - memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb00000, 0x1fbfffff, 0, 0, SMH_BANK2 ); + memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f27ffff, 0, 0, (read32_space_func)SMH_BANK(1) ); + memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb00000, 0x1fbfffff, 0, 0, (read32_space_func)SMH_BANK(2) ); memory_install_write32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb00000, 0x1fb00003, 0, 0, coh1002v_bnk_w ); zn_driver_init(machine); @@ -2536,7 +2536,7 @@ static WRITE32_HANDLER( cbaj_z80_w ) static DRIVER_INIT( coh1002m ) { - memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f7fffff, 0, 0, SMH_BANK1 ); + memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f7fffff, 0, 0, (read32_space_func)SMH_BANK(1) ); memory_install_readwrite32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb00000, 0x1fb00003, 0, 0, cbaj_z80_r, cbaj_z80_w ); memory_install_write32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb00004, 0x1fb00007, 0, 0, coh1002m_bank_w ); diff --git a/src/mame/drivers/zr107.c b/src/mame/drivers/zr107.c index a2bc2138364..f65e1cec42d 100644 --- a/src/mame/drivers/zr107.c +++ b/src/mame/drivers/zr107.c @@ -819,7 +819,7 @@ static void sound_irq_callback(running_machine *machine, int irq) static void init_zr107(running_machine *machine) { - sharc_dataram = auto_malloc(0x100000); + sharc_dataram = auto_alloc_array(machine, UINT32, 0x100000/4); led_reg0 = led_reg1 = 0x7f; ccu_vcth = ccu_vctl = 0; diff --git a/src/mame/includes/model1.h b/src/mame/includes/model1.h index 0ad0a8e40c5..0c3ae23a629 100644 --- a/src/mame/includes/model1.h +++ b/src/mame/includes/model1.h @@ -19,7 +19,7 @@ WRITE16_HANDLER( model1_vr_tgp_ram_w ); ADDRESS_MAP_EXTERN( model1_vr_tgp_map, 32 ); -void model1_vr_tgp_reset( void ); +void model1_vr_tgp_reset( running_machine *machine ); void model1_tgp_reset(running_machine *machine, int swa); diff --git a/src/mame/includes/namcoic.h b/src/mame/includes/namcoic.h index 96c655b6fd6..f7dbf86d65a 100644 --- a/src/mame/includes/namcoic.h +++ b/src/mame/includes/namcoic.h @@ -121,7 +121,7 @@ void namcos2_draw_sprites_metalhawk(running_machine *machine, bitmap_t *bitmap, /* C355 Motion Object Emulation */ /* for palXOR, supply either 0x0 (normal) or 0xf (palette mapping reversed) */ -void namco_obj_init( int gfxbank, int palXOR, int (*code2tile)( int code ) ); +void namco_obj_init( running_machine *machine, int gfxbank, int palXOR, int (*code2tile)( int code ) ); void namco_obj_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int pri ); WRITE16_HANDLER( namco_obj16_w ); diff --git a/src/mame/includes/namcos2.h b/src/mame/includes/namcos2.h index 16605597e43..94e85606604 100644 --- a/src/mame/includes/namcos2.h +++ b/src/mame/includes/namcos2.h @@ -207,20 +207,20 @@ INTERRUPT_GEN( namcos2_68k_gpu_vblank ); /* MASTER CPU RAM MEMORY */ /**************************************************************/ -#define NAMCOS2_68K_MASTER_RAM_W SMH_BANK3 -#define NAMCOS2_68K_MASTER_RAM_R SMH_BANK3 +#define NAMCOS2_68K_MASTER_RAM_W SMH_BANK(3) +#define NAMCOS2_68K_MASTER_RAM_R SMH_BANK(3) /**************************************************************/ /* SLAVE CPU RAM MEMORY */ /**************************************************************/ -#define NAMCOS2_68K_SLAVE_RAM_W SMH_BANK4 -#define NAMCOS2_68K_SLAVE_RAM_R SMH_BANK4 +#define NAMCOS2_68K_SLAVE_RAM_W SMH_BANK(4) +#define NAMCOS2_68K_SLAVE_RAM_R SMH_BANK(4) /**************************************************************/ /* */ /**************************************************************/ -#define BANKED_SOUND_ROM_R SMH_BANK6 +#define BANKED_SOUND_ROM_R SMH_BANK(6) #define CPU3_ROM1 6 /* Bank number */ /**************************************************************/ diff --git a/src/mame/includes/namcos22.h b/src/mame/includes/namcos22.h index d64f5dd8ae5..d00d0e523af 100644 --- a/src/mame/includes/namcos22.h +++ b/src/mame/includes/namcos22.h @@ -72,6 +72,6 @@ VIDEO_UPDATE( namcos22 ); VIDEO_START( namcos22s ); VIDEO_UPDATE( namcos22s ); -void namcos22_draw_direct_poly( const UINT16 *pSource ); +void namcos22_draw_direct_poly( running_machine *machine, const UINT16 *pSource ); extern UINT32 namcos22_point_rom_r( offs_t offs ); extern void namcos22_enable_slave_simulation( void ); diff --git a/src/mame/machine/amiga.c b/src/mame/machine/amiga.c index 2c82969f523..b953e0773f8 100644 --- a/src/mame/machine/amiga.c +++ b/src/mame/machine/amiga.c @@ -422,7 +422,7 @@ static TIMER_CALLBACK( amiga_irq_proc ) CUSTOM_INPUT( amiga_joystick_convert ) { - UINT8 bits = input_port_read(field->port->machine, param); + UINT8 bits = input_port_read(field->port->machine, (const char *)param); int up = (bits >> 0) & 1; int down = (bits >> 1) & 1; int left = (bits >> 2) & 1; @@ -1553,7 +1553,7 @@ void amiga_add_autoconfig(running_machine *machine, const amiga_autoconfig_devic assert_always((device->size & (device->size - 1)) == 0, "device->size must be power of 2!"); /* allocate memory and link it in at the end of the list */ - dev = auto_malloc(sizeof(*dev)); + dev = auto_alloc(machine, autoconfig_device); dev->next = NULL; for (d = &autoconfig_list; *d; d = &(*d)->next) ; *d = dev; diff --git a/src/mame/machine/atari.c b/src/mame/machine/atari.c index fa734cb2b08..3ebf30367c1 100644 --- a/src/mame/machine/atari.c +++ b/src/mame/machine/atari.c @@ -150,11 +150,11 @@ void a600xl_mmu(running_machine *machine, UINT8 new_mmu) else { logerror("%s MMU SELFTEST ROM\n", machine->gamedrv->name); - rbank2 = SMH_BANK2; + rbank2 = SMH_BANK(2); wbank2 = SMH_UNMAP; } memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5000, 0x57ff, 0, 0, rbank2, wbank2); - if (rbank2 == SMH_BANK2) + if (rbank2 == SMH_BANK(2)) memory_set_bankptr(machine, 2, memory_region(machine, "maincpu") + 0x5000); } @@ -168,21 +168,21 @@ void a800xl_mmu(running_machine *machine, UINT8 new_mmu) if( new_mmu & 0x01 ) { logerror("%s MMU BIOS ROM\n", machine->gamedrv->name); - rbank3 = SMH_BANK3; + rbank3 = SMH_BANK(3); wbank3 = SMH_UNMAP; base3 = memory_region(machine, "maincpu") + 0x14000; /* 8K lo BIOS */ - rbank4 = SMH_BANK4; + rbank4 = SMH_BANK(4); wbank4 = SMH_UNMAP; base4 = memory_region(machine, "maincpu") + 0x15800; /* 4K FP ROM + 8K hi BIOS */ } else { logerror("%s MMU BIOS RAM\n", machine->gamedrv->name); - rbank3 = SMH_BANK3; - wbank3 = SMH_BANK3; + rbank3 = SMH_BANK(3); + wbank3 = SMH_BANK(3); base3 = memory_region(machine, "maincpu") + 0x0c000; /* 8K RAM */ - rbank4 = SMH_BANK4; - wbank4 = SMH_BANK4; + rbank4 = SMH_BANK(4); + wbank4 = SMH_BANK(4); base4 = memory_region(machine, "maincpu") + 0x0d800; /* 4K RAM + 8K RAM */ } memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc000, 0xcfff, 0, 0, rbank3, wbank3); @@ -194,14 +194,14 @@ void a800xl_mmu(running_machine *machine, UINT8 new_mmu) if( new_mmu & 0x02 ) { logerror("%s MMU BASIC RAM\n", machine->gamedrv->name); - rbank1 = SMH_BANK1; - wbank1 = SMH_BANK1; + rbank1 = SMH_BANK(1); + wbank1 = SMH_BANK(1); base1 = memory_region(machine, "maincpu") + 0x0a000; /* 8K RAM */ } else { logerror("%s MMU BASIC ROM\n", machine->gamedrv->name); - rbank1 = SMH_BANK1; + rbank1 = SMH_BANK(1); wbank1 = SMH_UNMAP; base1 = memory_region(machine, "maincpu") + 0x10000; /* 8K BASIC */ } @@ -212,14 +212,14 @@ void a800xl_mmu(running_machine *machine, UINT8 new_mmu) if( new_mmu & 0x80 ) { logerror("%s MMU SELFTEST RAM\n", machine->gamedrv->name); - rbank2 = SMH_BANK2; - wbank2 = SMH_BANK2; + rbank2 = SMH_BANK(2); + wbank2 = SMH_BANK(2); base2 = memory_region(machine, "maincpu") + 0x05000; /* 0x0800 bytes */ } else { logerror("%s MMU SELFTEST ROM\n", machine->gamedrv->name); - rbank2 = SMH_BANK2; + rbank2 = SMH_BANK(2); wbank2 = SMH_UNMAP; base2 = memory_region(machine, "maincpu") + 0x15000; /* 0x0800 bytes */ } diff --git a/src/mame/machine/atarigen.c b/src/mame/machine/atarigen.c index 68a62965748..716bf622e44 100644 --- a/src/mame/machine/atarigen.c +++ b/src/mame/machine/atarigen.c @@ -556,7 +556,7 @@ void atarigen_slapstic_init(const device_config *device, offs_t base, offs_t mir atarigen_slapstic = memory_install_readwrite16_handler(cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM), base, base + 0x7fff, 0, mirror, atarigen_slapstic_r, atarigen_slapstic_w); /* allocate memory for a copy of bank 0 */ - atarigen_slapstic_bank0 = auto_malloc(0x2000); + atarigen_slapstic_bank0 = auto_alloc_array(device->machine, UINT8, 0x2000); memcpy(atarigen_slapstic_bank0, atarigen_slapstic, 0x2000); /* ensure we recopy memory for the bank */ @@ -1608,7 +1608,7 @@ void atarigen_blend_gfx(running_machine *machine, int gfx0, int gfx1, int mask0, int c, x, y; /* allocate memory for the assembled data */ - srcdata = auto_malloc(gx0->total_elements * gx0->width * gx0->height); + srcdata = auto_alloc_array(machine, UINT8, gx0->total_elements * gx0->width * gx0->height); /* loop over elements */ dest = srcdata; diff --git a/src/mame/machine/balsente.c b/src/mame/machine/balsente.c index 2d326d3e6c0..fe3871e66cc 100644 --- a/src/mame/machine/balsente.c +++ b/src/mame/machine/balsente.c @@ -16,7 +16,7 @@ /* local prototypes */ -static void poly17_init(void); +static void poly17_init(running_machine *machine); static void counter_set_out(running_machine *machine, int which, int gate); static TIMER_CALLBACK( counter_callback ); static TIMER_CALLBACK( clock_counter_0_ff ); @@ -152,7 +152,7 @@ MACHINE_RESET( balsente ) int numbanks, i; /* create the polynomial tables */ - poly17_init(); + poly17_init(machine); /* reset counters; counter 2's gate is tied high */ memset(counter, 0, sizeof(counter)); @@ -267,14 +267,14 @@ MACHINE_RESET( balsente ) #define POLY17_SHR 10 #define POLY17_ADD 0x18000 -static void poly17_init(void) +static void poly17_init(running_machine *machine) { UINT32 i, x = 0; UINT8 *p, *r; /* allocate memory */ - p = poly17 = auto_malloc(POLY17_SIZE + 1); - r = rand17 = auto_malloc(POLY17_SIZE + 1); + p = poly17 = auto_alloc_array(machine, UINT8, POLY17_SIZE + 1); + r = rand17 = auto_alloc_array(machine, UINT8, POLY17_SIZE + 1); /* generate the polynomial */ for (i = 0; i < POLY17_SIZE; i++) diff --git a/src/mame/machine/beezer.c b/src/mame/machine/beezer.c index 0fda09a6300..52eeeeff84f 100644 --- a/src/mame/machine/beezer.c +++ b/src/mame/machine/beezer.c @@ -117,7 +117,7 @@ WRITE8_HANDLER( beezer_bankswitch_w ) else { UINT8 *rom = memory_region(space->machine, "maincpu") + 0x10000; - memory_install_readwrite8_handler(space, 0xc000, 0xcfff, 0, 0, SMH_BANK1, SMH_BANK1); + memory_install_readwrite8_handler(space, 0xc000, 0xcfff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_BANK(1)); memory_set_bankptr(space->machine, 1, rom + (data & 0x07) * 0x2000 + ((data & 0x08) ? 0x1000: 0)); } } diff --git a/src/mame/machine/cclimber.c b/src/mame/machine/cclimber.c index ee9fba966de..ab41dae69fb 100644 --- a/src/mame/machine/cclimber.c +++ b/src/mame/machine/cclimber.c @@ -8,7 +8,7 @@ static void cclimber_decode(running_machine *machine, const UINT8 convtable[8][1 { const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); UINT8 *rom = memory_region(machine, "maincpu"); - UINT8 *decrypt = auto_malloc(0x10000); + UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x10000); int A; memory_set_decrypted_region(space, 0x0000, 0xffff, decrypt); diff --git a/src/mame/machine/cps2crpt.c b/src/mame/machine/cps2crpt.c index 8526e3e2ed3..1dcf3077040 100644 --- a/src/mame/machine/cps2crpt.c +++ b/src/mame/machine/cps2crpt.c @@ -635,7 +635,7 @@ static void cps2_decrypt(running_machine *machine, const UINT32 *master_key, UIN const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); UINT16 *rom = (UINT16 *)memory_region(machine, "maincpu"); int length = memory_region_length(machine, "maincpu"); - UINT16 *dec = auto_malloc(length); + UINT16 *dec = auto_alloc_array(machine, UINT16, length/2); int i; UINT32 key1[4]; struct optimised_sbox sboxes1[4*4]; diff --git a/src/mame/machine/cubocd32.c b/src/mame/machine/cubocd32.c index 6fec5045106..c2441c75fc2 100644 --- a/src/mame/machine/cubocd32.c +++ b/src/mame/machine/cubocd32.c @@ -122,7 +122,7 @@ void amiga_akiko_init(running_machine* machine) akiko.cdrom_numtracks = cdrom_get_last_track(akiko.cdrom)+3; - akiko.cdrom_toc = (UINT8*)auto_malloc(13*akiko.cdrom_numtracks); + akiko.cdrom_toc = auto_alloc_array(machine, UINT8, 13*akiko.cdrom_numtracks); memset( akiko.cdrom_toc, 0, 13*akiko.cdrom_numtracks); p = akiko.cdrom_toc; diff --git a/src/mame/machine/deco102.c b/src/mame/machine/deco102.c index 343a17cbfdc..e618755207e 100644 --- a/src/mame/machine/deco102.c +++ b/src/mame/machine/deco102.c @@ -53,8 +53,8 @@ void deco102_decrypt_cpu(running_machine *machine, const char *cputag, int addre const address_space *space = cputag_get_address_space(machine, cputag, ADDRESS_SPACE_PROGRAM); UINT16 *rom = (UINT16 *)memory_region(machine, cputag); int size = memory_region_length(machine, cputag); - UINT16 *opcodes = auto_malloc(size); - UINT16 *buf = malloc_or_die(size); + UINT16 *opcodes = auto_alloc_array(machine, UINT16, size/2); + UINT16 *buf = alloc_array_or_die(UINT16, size/2); memcpy(buf,rom,size); diff --git a/src/mame/machine/deco156.c b/src/mame/machine/deco156.c index baa9ec3642a..9de91a949c8 100644 --- a/src/mame/machine/deco156.c +++ b/src/mame/machine/deco156.c @@ -126,7 +126,7 @@ void deco156_decrypt(running_machine *machine) { UINT32 *rom = (UINT32 *)memory_region(machine, "maincpu"); int length = memory_region_length(machine, "maincpu"); - UINT32 *buf = malloc_or_die(length); + UINT32 *buf = alloc_array_or_die(UINT32, length/4); memcpy(buf, rom, length); decrypt(buf, rom, length); diff --git a/src/mame/machine/decocrpt.c b/src/mame/machine/decocrpt.c index 248cbcd2ac5..b575a480014 100644 --- a/src/mame/machine/decocrpt.c +++ b/src/mame/machine/decocrpt.c @@ -602,7 +602,7 @@ static void deco_decrypt(running_machine *machine,const char *rgntag,const UINT8 { UINT16 *rom = (UINT16 *)memory_region(machine, rgntag); int len = memory_region_length(machine, rgntag)/2; - UINT16 *buffer = malloc_or_die(len*2); + UINT16 *buffer = alloc_array_or_die(UINT16, len); int i; /* we work on 16-bit words but data is loaded as 8-bit, so swap bytes on LSB machines */ diff --git a/src/mame/machine/fd1089.c b/src/mame/machine/fd1089.c index fafa76e7d0a..8392dd0e8d5 100644 --- a/src/mame/machine/fd1089.c +++ b/src/mame/machine/fd1089.c @@ -403,7 +403,7 @@ static void sys16_decrypt(running_machine *machine, const UINT8 *key,int cputype UINT16 *rom = (UINT16 *)memory_region(machine, "maincpu"); int size = memory_region_length(machine, "maincpu"); int A; - decrypted = (UINT16 *)auto_malloc(size); + decrypted = auto_alloc_array(machine, UINT16, size/2); memory_set_decrypted_region(space, 0x000000, size - 1, decrypted); diff --git a/src/mame/machine/fddebug.c b/src/mame/machine/fddebug.c index 2ecd4fc6ab9..5189ee92a24 100644 --- a/src/mame/machine/fddebug.c +++ b/src/mame/machine/fddebug.c @@ -286,7 +286,7 @@ static int find_constraint_sequence(UINT32 global, int quick); static int does_key_work_for_constraints(const UINT16 *base, UINT8 *key); static UINT32 reconstruct_base_seed(int keybaseaddr, UINT32 startseed); -static void build_optable(void); +static void build_optable(running_machine *machine); static int validate_ea(const address_space *space, UINT32 pc, UINT8 modereg, const UINT8 *parambase, UINT32 flags); static int validate_opcode(const address_space *space, UINT32 pc, const UINT8 *opdata, int maxwords); @@ -490,18 +490,17 @@ void fd1094_init_debugging(running_machine *machine, const char *cpureg, const c assert(coderegion_words == keystatus_words); /* allocate memory for the ignore table */ - ignorepc = auto_malloc(1 << 23); - memset(ignorepc, 0, 1 << 23); + ignorepc = auto_alloc_array_clear(machine, UINT8, 1 << 23); /* allocate memory for the undo buffer */ - undobuff = auto_malloc(keystatus_words * 2); + undobuff = auto_alloc_array(machine, UINT8, keystatus_words * 2); memcpy(undobuff, keystatus, keystatus_words * 2); /* allocate memory for the possible seeds array */ - possible_seed = auto_malloc(65536 * sizeof(possible_seed[0])); + possible_seed = auto_alloc_array(machine, UINT32, 65536); /* build the opcode table */ - build_optable(); + build_optable(machine); /* set up default constraints */ constcount = 0; @@ -2089,12 +2088,12 @@ static const struct build_optable - build up the opcode table -----------------------------------------------*/ -static void build_optable(void) +static void build_optable(running_machine *machine) { int opnum, inum; /* allocate and initialize the opcode table */ - optable = auto_malloc(65536 * sizeof(optable[0])); + optable = auto_alloc_array(machine, optable_entry, 65536); for (opnum = 0; opnum < 65536; opnum++) { optable[opnum].flags = OF_INVALID; diff --git a/src/mame/machine/galaxold.c b/src/mame/machine/galaxold.c index a2b7f48f2e0..8fa691f087c 100644 --- a/src/mame/machine/galaxold.c +++ b/src/mame/machine/galaxold.c @@ -311,7 +311,7 @@ DRIVER_INIT( moonqsr ) offs_t i; const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); UINT8 *rom = memory_region(machine, "maincpu"); - UINT8 *decrypt = auto_malloc(0x8000); + UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x8000); memory_set_decrypted_region(space, 0x0000, 0x7fff, decrypt); diff --git a/src/mame/machine/harddriv.c b/src/mame/machine/harddriv.c index 2369416f1bb..2e9ed1b941d 100644 --- a/src/mame/machine/harddriv.c +++ b/src/mame/machine/harddriv.c @@ -157,7 +157,7 @@ MACHINE_START( harddriv ) { /* predetermine memory regions */ sim_memory = (UINT16 *)memory_region(machine, "user1"); - som_memory = (UINT16 *)auto_malloc(0x8000); + som_memory = auto_alloc_array(machine, UINT16, 0x8000/2); sim_memory_size = memory_region_length(machine, "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 e917b12dca1..904463e84fe 100644 --- a/src/mame/machine/irobot.c +++ b/src/mame/machine/irobot.c @@ -375,7 +375,7 @@ static void load_oproms(running_machine *machine) int i; /* allocate RAM */ - mbops = auto_malloc(sizeof(irmb_ops) * 1024); + mbops = auto_alloc_array(machine, irmb_ops, 1024); for (i = 0; i < 1024; i++) { diff --git a/src/mame/machine/kabuki.c b/src/mame/machine/kabuki.c index 99718909463..071472cf996 100644 --- a/src/mame/machine/kabuki.c +++ b/src/mame/machine/kabuki.c @@ -163,7 +163,7 @@ static void mitchell_decode(running_machine *machine, int swap_key1,int swap_key { const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); UINT8 *rom = memory_region(machine, "maincpu"); - UINT8 *decrypt = auto_malloc(memory_region_length(machine, "maincpu")); + UINT8 *decrypt = auto_alloc_array(machine, UINT8, memory_region_length(machine, "maincpu")); int numbanks = (memory_region_length(machine, "maincpu") - 0x10000) / 0x4000; int i; @@ -203,7 +203,7 @@ void block_decode(running_machine *machine) { mitchell_decode(machine,0x02461 static void cps1_decode(running_machine *machine,int swap_key1,int swap_key2,int addr_key,int xor_key) { const address_space *space = cputag_get_address_space(machine, "audiocpu", ADDRESS_SPACE_PROGRAM); - UINT8 *decrypt = auto_malloc(0x8000); + UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x8000); UINT8 *rom = memory_region(machine, "audiocpu"); memory_set_decrypted_region(space, 0x0000, 0x7fff, decrypt); diff --git a/src/mame/machine/konami1.c b/src/mame/machine/konami1.c index 7d2ab17136b..cb735e6c3d1 100644 --- a/src/mame/machine/konami1.c +++ b/src/mame/machine/konami1.c @@ -47,7 +47,7 @@ UINT8 *konami1_decode(running_machine *machine, const char *cpu) int size = memory_region_length(machine, cpu); int A; - UINT8 *decrypted = auto_malloc(size); + UINT8 *decrypted = auto_alloc_array(machine, UINT8, size); memory_set_decrypted_region(space, 0x0000, 0xffff, decrypted); for (A = 0;A < size;A++) diff --git a/src/mame/machine/konamigx.c b/src/mame/machine/konamigx.c index 86bb223b678..5a27bb15e30 100644 --- a/src/mame/machine/konamigx.c +++ b/src/mame/machine/konamigx.c @@ -1047,15 +1047,15 @@ void konamigx_mixer_init(running_machine *machine, int objdma) gx_primode = 0; gx_objzbuf = (UINT8 *)priority_bitmap->base; - gx_shdzbuf = auto_malloc(GX_ZBUFSIZE); - gx_objpool = auto_malloc(sizeof(struct GX_OBJ) * (GX_MAX_OBJECTS)); + gx_shdzbuf = auto_alloc_array(machine, UINT8, GX_ZBUFSIZE); + gx_objpool = auto_alloc_array(machine, struct GX_OBJ, GX_MAX_OBJECTS); K053247_export_config(&K053247_ram, &K053247_gfx, &K053247_callback, &K053247_dx, &K053247_dy); K054338_export_config(&K054338_shdRGB); if (objdma) { - gx_spriteram = auto_malloc(0x1000); + gx_spriteram = auto_alloc_array(machine, UINT16, 0x1000/2); gx_objdma = 1; } else diff --git a/src/mame/machine/konppc.c b/src/mame/machine/konppc.c index cf03b39ba52..dda9ca79bc7 100644 --- a/src/mame/machine/konppc.c +++ b/src/mame/machine/konppc.c @@ -47,7 +47,7 @@ void init_konami_cgboard(running_machine *machine, int num_boards, int type) for (i=0; i < num_boards; i++) { dsp_comm_ppc[i][0] = 0x00; - dsp_shared_ram[i] = auto_malloc(DSP_BANK_SIZE * 2); + dsp_shared_ram[i] = auto_alloc_array(machine, UINT32, DSP_BANK_SIZE * 2/4); dsp_shared_ram_bank[i] = 0; dsp_state[i] = 0x80; @@ -58,8 +58,8 @@ void init_konami_cgboard(running_machine *machine, int num_boards, int type) nwk_fifo_read_ptr[i] = 0; nwk_fifo_write_ptr[i] = 0; - nwk_fifo[i] = auto_malloc(sizeof(UINT32) * 0x800); - nwk_ram[i] = auto_malloc(sizeof(UINT32) * 0x2000); + nwk_fifo[i] = auto_alloc_array(machine, UINT32, 0x800); + nwk_ram[i] = auto_alloc_array(machine, UINT32, 0x2000); state_save_register_item_array(machine, "konppc", NULL, i, dsp_comm_ppc[i]); state_save_register_item_array(machine, "konppc", NULL, i, dsp_comm_sharc[i]); @@ -413,8 +413,8 @@ void K033906_init(running_machine *machine) int i; for (i=0; i < MAX_K033906_CHIPS; i++) { - K033906_reg[i] = auto_malloc(sizeof(UINT32) * 256); - K033906_ram[i] = auto_malloc(sizeof(UINT32) * 32768); + K033906_reg[i] = auto_alloc_array(machine, UINT32, 256); + K033906_ram[i] = auto_alloc_array(machine, UINT32, 32768); state_save_register_item_pointer(machine, "K033906", NULL, i, K033906_reg[i], 256); state_save_register_item_pointer(machine, "K033906", NULL, i, K033906_ram[i], 32768); } diff --git a/src/mame/machine/leland.c b/src/mame/machine/leland.c index 6d81078e7c4..23d8a002d29 100644 --- a/src/mame/machine/leland.c +++ b/src/mame/machine/leland.c @@ -365,7 +365,7 @@ WRITE8_HANDLER( indyheat_analog_w ) MACHINE_START( leland ) { /* allocate extra stuff */ - battery_ram = auto_malloc(LELAND_BATTERY_RAM_SIZE); + battery_ram = auto_alloc_array(machine, UINT8, LELAND_BATTERY_RAM_SIZE); /* start scanline interrupts going */ master_int_timer = timer_alloc(machine, leland_interrupt_callback, NULL); @@ -417,8 +417,8 @@ MACHINE_RESET( leland ) MACHINE_START( ataxx ) { /* set the odd data banks */ - battery_ram = auto_malloc(LELAND_BATTERY_RAM_SIZE); - extra_tram = auto_malloc(ATAXX_EXTRA_TRAM_SIZE); + battery_ram = auto_alloc_array(machine, UINT8, LELAND_BATTERY_RAM_SIZE); + extra_tram = auto_alloc_array(machine, UINT8, ATAXX_EXTRA_TRAM_SIZE); /* start scanline interrupts going */ master_int_timer = timer_alloc(machine, ataxx_interrupt_callback, NULL); diff --git a/src/mame/machine/mc8123.c b/src/mame/machine/mc8123.c index 94f7938dde4..a752afd0bb7 100644 --- a/src/mame/machine/mc8123.c +++ b/src/mame/machine/mc8123.c @@ -377,8 +377,8 @@ static UINT8 mc8123_decrypt(offs_t addr,UINT8 val,const UINT8 *key,int opcode) void mc8123_decrypt_rom(running_machine *machine, const char *cpu, const char *keyrgn, int banknum, int numbanks) { const address_space *space = cputag_get_address_space(machine, cpu, ADDRESS_SPACE_PROGRAM); - UINT8 *decrypted1 = auto_malloc(numbanks == 1 ? 0xc000 : 0x8000); - UINT8 *decrypted2 = numbanks > 1 ? auto_malloc(0x4000 * numbanks) : decrypted1 + 0x8000; + UINT8 *decrypted1 = auto_alloc_array(machine, UINT8, numbanks == 1 ? 0xc000 : 0x8000); + UINT8 *decrypted2 = numbanks > 1 ? auto_alloc_array(machine, UINT8, 0x4000 * numbanks) : decrypted1 + 0x8000; UINT8 *rom = memory_region(machine, cpu); UINT8 *key = memory_region(machine, keyrgn); int A, bank; diff --git a/src/mame/machine/midtunit.c b/src/mame/machine/midtunit.c index 419bad422bb..71f4fc2e934 100644 --- a/src/mame/machine/midtunit.c +++ b/src/mame/machine/midtunit.c @@ -450,8 +450,8 @@ DRIVER_INIT( mktunit ) memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1b00000, 0x1b6ffff, 0, 0, mk_prot_r, mk_prot_w); /* sound chip protection (hidden RAM) */ - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xfb9c, 0xfbc6, 0, 0, SMH_BANK9, SMH_BANK9); - memory_set_bankptr(machine, 9, auto_malloc(0x80)); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xfb9c, 0xfbc6, 0, 0, (read8_space_func)SMH_BANK(9), (write8_space_func)SMH_BANK(9)); + memory_set_bankptr(machine, 9, auto_alloc_array(machine, UINT8, 0x80)); } static void init_nbajam_common(running_machine *machine, int te_protection) @@ -474,10 +474,10 @@ static void init_nbajam_common(running_machine *machine, int te_protection) /* sound chip protection (hidden RAM) */ if (!te_protection) - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xfbaa, 0xfbd4, 0, 0, SMH_BANK9, SMH_BANK9); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xfbaa, 0xfbd4, 0, 0, (read8_space_func)SMH_BANK(9), (write8_space_func)SMH_BANK(9)); else - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xfbec, 0xfc16, 0, 0, SMH_BANK9, SMH_BANK9); - memory_set_bankptr(machine, 9, auto_malloc(0x80)); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xfbec, 0xfc16, 0, 0, (read8_space_func)SMH_BANK(9), (write8_space_func)SMH_BANK(9)); + memory_set_bankptr(machine, 9, auto_alloc_array(machine, UINT8, 0x80)); } DRIVER_INIT( nbajam ) @@ -496,14 +496,14 @@ DRIVER_INIT( jdreddp ) init_tunit_generic(machine, SOUND_ADPCM_LARGE); /* looks like the watchdog needs to be disabled */ - memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x01d81060, 0x01d8107f, 0, 0, SMH_NOP); + memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x01d81060, 0x01d8107f, 0, 0, (write16_space_func)SMH_NOP); /* protection */ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1b00000, 0x1bfffff, 0, 0, jdredd_prot_r, jdredd_prot_w); /* sound chip protection (hidden RAM) */ - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xfbcf, 0xfbf9, 0, 0, SMH_BANK7, SMH_BANK9); - memory_set_bankptr(machine, 9, auto_malloc(0x80)); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xfbcf, 0xfbf9, 0, 0, (read8_space_func)SMH_BANK(7), (write8_space_func)SMH_BANK(9)); + memory_set_bankptr(machine, 9, auto_alloc_array(machine, UINT8, 0x80)); #if ENABLE_ALL_JDREDD_LEVELS /* how about the final levels? */ diff --git a/src/mame/machine/midyunit.c b/src/mame/machine/midyunit.c index 94fffc629b9..0fb0804dfbb 100644 --- a/src/mame/machine/midyunit.c +++ b/src/mame/machine/midyunit.c @@ -298,20 +298,20 @@ static void init_generic(running_machine *machine, int bpp, int sound, int prot_ case SOUND_CVSD: williams_cvsd_init(machine); - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), prot_start, prot_end, 0, 0, SMH_BANK9, SMH_BANK9); - memory_set_bankptr(machine, 9, auto_malloc(0x80)); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), prot_start, prot_end, 0, 0, (read8_space_func)SMH_BANK(9), (write8_space_func)SMH_BANK(9)); + memory_set_bankptr(machine, 9, auto_alloc_array(machine, UINT8, 0x80)); break; case SOUND_ADPCM: williams_adpcm_init(machine); - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), prot_start, prot_end, 0, 0, SMH_BANK9, SMH_BANK9); - memory_set_bankptr(machine, 9, auto_malloc(0x80)); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), prot_start, prot_end, 0, 0, (read8_space_func)SMH_BANK(9), (write8_space_func)SMH_BANK(9)); + memory_set_bankptr(machine, 9, auto_alloc_array(machine, UINT8, 0x80)); break; case SOUND_NARC: williams_narc_init(machine); - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), prot_start, prot_end, 0, 0, SMH_BANK9, SMH_BANK9); - memory_set_bankptr(machine, 9, auto_malloc(0x80)); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), prot_start, prot_end, 0, 0, (read8_space_func)SMH_BANK(9), (write8_space_func)SMH_BANK(9)); + memory_set_bankptr(machine, 9, auto_alloc_array(machine, UINT8, 0x80)); break; case SOUND_YAWDIM: diff --git a/src/mame/machine/model1.c b/src/mame/machine/model1.c index 5524c7dffc3..bf8ba31b03b 100644 --- a/src/mame/machine/model1.c +++ b/src/mame/machine/model1.c @@ -1923,7 +1923,7 @@ WRITE16_HANDLER( model1_tgp_copro_ram_w ) void model1_tgp_reset(running_machine *machine, int swa) { ram_adr = 0; - ram_data = auto_malloc(0x10000*4); + ram_data = auto_alloc_array(machine, UINT32, 0x10000); memset(ram_data, 0, 0x10000*4); fifoout_rpos = 0; @@ -1969,10 +1969,10 @@ static int copro_fifoin_rpos, copro_fifoin_wpos; static UINT32 copro_fifoin_data[FIFO_SIZE]; static int copro_fifoin_num; -void model1_vr_tgp_reset( void ) +void model1_vr_tgp_reset( running_machine *machine ) { ram_adr = 0; - ram_data = auto_malloc(0x8000*4); + ram_data = auto_alloc_array(machine, UINT32, 0x8000); memset(ram_data, 0, 0x8000*4); copro_fifoout_rpos = 0; diff --git a/src/mame/machine/namcos1.c b/src/mame/machine/namcos1.c index 91f8f127650..1648bf8832e 100644 --- a/src/mame/machine/namcos1.c +++ b/src/mame/machine/namcos1.c @@ -66,18 +66,18 @@ static WRITE8_HANDLER( bank16_w ) { (*namcos1_active_bank[15].bank_handler_w)(sp static const read8_space_func ram_bank_handler_r[16] = { - SMH_BANK1 ,SMH_BANK2 ,SMH_BANK3 ,SMH_BANK4 , - SMH_BANK5 ,SMH_BANK6 ,SMH_BANK7 ,SMH_BANK8 , - SMH_BANK9 ,SMH_BANK10,SMH_BANK11,SMH_BANK12, - SMH_BANK13,SMH_BANK14,SMH_BANK15,SMH_BANK16 + SMH_BANK(1) ,SMH_BANK(2) ,SMH_BANK(3) ,SMH_BANK(4) , + SMH_BANK(5) ,SMH_BANK(6) ,SMH_BANK(7) ,SMH_BANK(8) , + SMH_BANK(9) ,SMH_BANK(10),SMH_BANK(11),SMH_BANK(12), + SMH_BANK(13),SMH_BANK(14),SMH_BANK(15),SMH_BANK(16) }; static const write8_space_func ram_bank_handler_w[16] = { - SMH_BANK1 ,SMH_BANK2 ,SMH_BANK3 ,SMH_BANK4 , - SMH_BANK5 ,SMH_BANK6 ,SMH_BANK7 ,SMH_BANK8 , - SMH_BANK9 ,SMH_BANK10,SMH_BANK11,SMH_BANK12, - SMH_BANK13,SMH_BANK14,SMH_BANK15,SMH_BANK16 + SMH_BANK(1) ,SMH_BANK(2) ,SMH_BANK(3) ,SMH_BANK(4) , + SMH_BANK(5) ,SMH_BANK(6) ,SMH_BANK(7) ,SMH_BANK(8) , + SMH_BANK(9) ,SMH_BANK(10),SMH_BANK(11),SMH_BANK(12), + SMH_BANK(13),SMH_BANK(14),SMH_BANK(15),SMH_BANK(16) }; static const read8_space_func io_bank_handler_r[16] = @@ -789,7 +789,7 @@ static void namcos1_build_banks(running_machine *machine,read8_space_func key_r, int i; /**** kludge alert ****/ - UINT8 *dummyrom = auto_malloc(0x2000); + UINT8 *dummyrom = auto_alloc_array(machine, UINT8, 0x2000); /* when the games want to reset because the test switch has been flipped (or because the protection checks failed!) they just set the top bits of bank #7 @@ -988,9 +988,9 @@ static void namcos1_driver_init( running_machine *machine, const struct namcos1_ key_top4 = specific->key_reg6; /* S1 RAM pointer set */ - s1ram = auto_malloc(0x8000); - namcos1_triram = auto_malloc(0x800); - namcos1_paletteram = auto_malloc(0x8000); + s1ram = auto_alloc_array(machine, UINT8, 0x8000); + namcos1_triram = auto_alloc_array(machine, UINT8, 0x800); + namcos1_paletteram = auto_alloc_array(machine, UINT8, 0x8000); /* Register volatile user memory for save state */ state_save_register_global_pointer(machine, s1ram, 0x8000); diff --git a/src/mame/machine/namcos2.c b/src/mame/machine/namcos2.c index 78ed31f7046..e2f7d96bac6 100644 --- a/src/mame/machine/namcos2.c +++ b/src/mame/machine/namcos2.c @@ -100,7 +100,7 @@ ResetAllSubCPUs( running_machine *machine, int state ) MACHINE_START( namcos2 ) { - namcos2_eeprom = auto_malloc(namcos2_eeprom_size); + namcos2_eeprom = auto_alloc_array(machine, UINT8, namcos2_eeprom_size); } MACHINE_RESET( namcos2 ) diff --git a/src/mame/machine/neoboot.c b/src/mame/machine/neoboot.c index 9acfcb3b670..272b4cf184e 100644 --- a/src/mame/machine/neoboot.c +++ b/src/mame/machine/neoboot.c @@ -24,7 +24,7 @@ void neogeo_bootleg_cx_decrypt( running_machine *machine ) int i; int cx_size = memory_region_length( machine, "sprites" ); UINT8 *rom = memory_region( machine, "sprites" ); - UINT8 *buf = malloc_or_die( cx_size ); + UINT8 *buf = alloc_array_or_die(UINT8, cx_size ); memcpy( buf, rom, cx_size ); @@ -44,7 +44,7 @@ void neogeo_bootleg_sx_decrypt( running_machine *machine, int value ) if (value == 1) { - UINT8 *buf = malloc_or_die( sx_size ); + UINT8 *buf = alloc_array_or_die(UINT8, sx_size ); memcpy( buf, rom, sx_size ); for( i = 0; i < sx_size; i += 0x10 ) @@ -72,7 +72,7 @@ void kog_px_decrypt( running_machine *machine ) { /* the protection chip does some *very* strange things to the rom */ UINT8 *src = memory_region(machine, "maincpu"); - UINT8 *dst = malloc_or_die( 0x600000 ); + UINT8 *dst = alloc_array_or_die(UINT8, 0x600000 ); UINT16 *rom = (UINT16 *)memory_region(machine, "maincpu"); int i; static const int sec[] = { 0x3, 0x8, 0x7, 0xC, 0x1, 0xA, 0x6, 0xD }; @@ -186,7 +186,7 @@ void install_kof10th_protection ( running_machine *machine ) void decrypt_kof10th(running_machine *machine) { int i, j; - UINT8 *dst = malloc_or_die(0x900000); + UINT8 *dst = alloc_array_or_die(UINT8, 0x900000); UINT8 *src = memory_region( machine, "maincpu" ); memcpy(dst + 0x000000, src + 0x700000, 0x100000); // Correct (Verified in Uni-bios) @@ -219,9 +219,9 @@ void decrypt_kf10thep(running_machine *machine) UINT8 *src = memory_region(machine, "maincpu"); UINT16 *buf = (UINT16*)memory_region(machine, "audiocrypt"); UINT8 *srom = (UINT8*)memory_region(machine, "fixed"); - UINT8 *sbuf = malloc_or_die(0x20000); + UINT8 *sbuf = alloc_array_or_die(UINT8, 0x20000); - UINT8 *dst = malloc_or_die(0x200000); + UINT8 *dst = alloc_array_or_die(UINT8, 0x200000); memcpy(dst,buf,0x200000); memcpy(src+0x000000,dst+0x060000,0x20000); @@ -257,7 +257,7 @@ static void kf2k5uni_px_decrypt( running_machine *machine ) { int i, j, ofst; UINT8 *src = memory_region( machine, "maincpu" ); - UINT8 *dst = malloc_or_die(0x80); + UINT8 *dst = alloc_array_or_die(UINT8, 0x80); for (i = 0; i < 0x800000; i+=0x80) { @@ -318,7 +318,7 @@ void kof2002b_gfx_decrypt(running_machine *machine, UINT8 *src, int size) { 8, 0, 7, 3, 4, 5, 6, 2, 1 }, }; - UINT8 *dst = malloc_or_die( 0x10000 ); + UINT8 *dst = alloc_array_or_die(UINT8, 0x10000 ); for ( i = 0; i < size; i+=0x10000 ) { @@ -344,7 +344,7 @@ void kf2k2mp_decrypt( running_machine *machine ) int i,j; UINT8 *src = memory_region(machine, "maincpu"); - UINT8 *dst = malloc_or_die(0x80); + UINT8 *dst = alloc_array_or_die(UINT8, 0x80); memmove(src, src + 0x300000, 0x500000); @@ -367,7 +367,7 @@ void kf2k2mp_decrypt( running_machine *machine ) void kf2k2mp2_px_decrypt( running_machine *machine ) { UINT8 *src = memory_region(machine, "maincpu"); - UINT8 *dst = malloc_or_die(0x600000); + UINT8 *dst = alloc_array_or_die(UINT8, 0x600000); memcpy (dst + 0x000000, src + 0x1C0000, 0x040000); memcpy (dst + 0x040000, src + 0x140000, 0x080000); @@ -387,7 +387,7 @@ static void cthd2003_neogeo_gfx_address_fix_do(running_machine *machine, int sta int i,j; int tilesize=128; - UINT8* rom = malloc_or_die(16*tilesize); // 16 tiles buffer + UINT8* rom = alloc_array_or_die(UINT8, 16*tilesize); // 16 tiles buffer UINT8* realrom = memory_region(machine, "sprites") + start*tilesize; for (i = 0; i < (end-start)/16; i++) { @@ -442,7 +442,7 @@ static void cthd2003_c(running_machine *machine, int pow) void decrypt_cthd2003( running_machine *machine ) { UINT8 *romdata = memory_region(machine, "fixed"); - UINT8 *tmp = malloc_or_die(8*128*128); + UINT8 *tmp = alloc_array_or_die(UINT8, 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); @@ -527,7 +527,7 @@ static void ct2k3sp_sx_decrypt( running_machine *machine ) { int rom_size = memory_region_length( machine, "fixed" ); UINT8 *rom = memory_region( machine, "fixed" ); - UINT8 *buf = malloc_or_die( rom_size ); + UINT8 *buf = alloc_array_or_die(UINT8, rom_size ); int i; int ofst; @@ -556,7 +556,7 @@ static void ct2k3sp_sx_decrypt( running_machine *machine ) void decrypt_ct2k3sp( running_machine *machine ) { UINT8 *romdata = memory_region(machine, "audiocpu")+0x10000; - UINT8*tmp = malloc_or_die(8*128*128); + UINT8*tmp = alloc_array_or_die(UINT8, 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); memcpy(tmp+8*64*128, romdata+8*32*128, 8*32*128); @@ -576,7 +576,7 @@ void decrypt_ct2k3sp( running_machine *machine ) void decrypt_ct2k3sa( running_machine *machine ) { UINT8 *romdata = memory_region(machine, "audiocpu")+0x10000; - UINT8*tmp = malloc_or_die(8*128*128); + UINT8*tmp = alloc_array_or_die(UINT8, 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); memcpy(tmp+8*64*128, romdata+8*32*128, 8*32*128); @@ -634,7 +634,7 @@ void patch_ct2k3sa( running_machine *machine ) void decrypt_kof2k4se_68k( running_machine *machine ) { UINT8 *src = memory_region(machine, "maincpu")+0x100000; - UINT8 *dst = malloc_or_die(0x400000); + UINT8 *dst = alloc_array_or_die(UINT8, 0x400000); int i; static const int sec[] = {0x300000,0x200000,0x100000,0x000000}; memcpy(dst,src,0x400000); @@ -664,7 +664,7 @@ void lans2004_decrypt_68k( running_machine *machine ) int i; UINT8 *src = memory_region( machine, "maincpu" ); UINT16 *rom = (UINT16*)memory_region( machine, "maincpu" ); - UINT8 *dst = malloc_or_die(0x600000); + UINT8 *dst = alloc_array_or_die(UINT8, 0x600000); { static const int sec[] = { 0x3, 0x8, 0x7, 0xC, 0x1, 0xA, 0x6, 0xD }; @@ -744,7 +744,7 @@ void svcboot_px_decrypt( running_machine *machine ) int i; int size = memory_region_length( machine, "maincpu" ); UINT8 *src = memory_region( machine, "maincpu" ); - UINT8 *dst = malloc_or_die( size ); + UINT8 *dst = alloc_array_or_die(UINT8, size ); int ofst; for( i = 0; i < size / 0x100000; i++ ){ memcpy( &dst[ i * 0x100000 ], &src[ sec[ i ] * 0x100000 ], 0x100000 ); @@ -773,7 +773,7 @@ void svcboot_cx_decrypt( running_machine *machine ) int i; int size = memory_region_length( machine, "sprites" ); UINT8 *src = memory_region( machine, "sprites" ); - UINT8 *dst = malloc_or_die( size ); + UINT8 *dst = alloc_array_or_die(UINT8, size ); int ofst; memcpy( dst, src, size ); for( i = 0; i < size / 0x80; i++ ){ @@ -800,7 +800,7 @@ void svcplus_px_decrypt( running_machine *machine ) }; int size = memory_region_length( machine, "maincpu" ); UINT8 *src = memory_region( machine, "maincpu" ); - UINT8 *dst = malloc_or_die( size ); + UINT8 *dst = alloc_array_or_die(UINT8, size ); int i; int ofst; memcpy( dst, src, size ); @@ -845,7 +845,7 @@ void svcplusa_px_decrypt( running_machine *machine ) }; int size = memory_region_length( machine, "maincpu" ); UINT8 *src = memory_region( machine, "maincpu" ); - UINT8 *dst = malloc_or_die( size ); + UINT8 *dst = alloc_array_or_die(UINT8, size ); memcpy( dst, src, size ); for( i = 0; i < 6; i++ ){ memcpy( &src[ i * 0x100000 ], &dst[ sec[ i ] * 0x100000 ], 0x100000 ); @@ -864,7 +864,7 @@ void svcsplus_px_decrypt( running_machine *machine ) }; int size = memory_region_length( machine, "maincpu" ); UINT8 *src = memory_region( machine, "maincpu" ); - UINT8 *dst = malloc_or_die( size ); + UINT8 *dst = alloc_array_or_die(UINT8, size ); int i; int ofst; memcpy( dst, src, size ); @@ -961,7 +961,7 @@ void kf2k3bl_px_decrypt( running_machine *machine ) int rom_size = 0x800000; UINT8 *rom = memory_region( machine, "maincpu" ); - UINT8 *buf = malloc_or_die( rom_size ); + UINT8 *buf = alloc_array_or_die(UINT8, rom_size ); memcpy( buf, rom, rom_size ); for( i = 0; i < rom_size / 0x100000; i++ ){ @@ -981,7 +981,7 @@ void kf2k3bl_install_protection(running_machine *machine) void kf2k3pl_px_decrypt( running_machine *machine ) { - UINT16*tmp = malloc_or_die(0x100000); + UINT16*tmp = alloc_array_or_die(UINT16, 0x100000/2); UINT16*rom = (UINT16*)memory_region( machine, "maincpu" ); int j; int i; @@ -1042,7 +1042,7 @@ void samsho5b_px_decrypt( running_machine *machine ) { int px_size = memory_region_length( machine, "maincpu" ); UINT8 *rom = memory_region( machine, "maincpu" ); - UINT8 *buf = malloc_or_die( px_size ); + UINT8 *buf = alloc_array_or_die(UINT8, px_size ); int ofst; int i; @@ -1085,7 +1085,7 @@ void matrimbl_decrypt( running_machine *machine ) { /* decrypt Z80 */ UINT8 *rom = memory_region( machine, "audiocpu" )+0x10000; - UINT8 *buf = malloc_or_die( 0x20000 ); + UINT8 *buf = alloc_array_or_die(UINT8, 0x20000 ); int i, j=0; memcpy( buf, rom, 0x20000 ); for( i=0x00000; i<0x20000; i++ ) diff --git a/src/mame/machine/neocrypt.c b/src/mame/machine/neocrypt.c index cb2c141cc7e..43d6c3efb37 100644 --- a/src/mame/machine/neocrypt.c +++ b/src/mame/machine/neocrypt.c @@ -537,7 +537,7 @@ static void neogeo_gfx_decrypt(running_machine *machine, int extra_xor) rom_size = memory_region_length(machine, "sprites"); - buf = malloc_or_die(rom_size); + buf = alloc_array_or_die(UINT8, rom_size); rom = memory_region(machine, "sprites"); @@ -679,7 +679,7 @@ void svcpcb_gfx_decrypt(running_machine *machine) int ofst; int rom_size = memory_region_length( machine, "sprites" ); UINT8 *rom = memory_region( machine, "sprites" ); - UINT8 *buf = malloc_or_die( rom_size ); + UINT8 *buf = alloc_array_or_die(UINT8, rom_size ); for( i = 0; i < rom_size; i++ ) { @@ -729,7 +729,7 @@ void kf2k3pcb_gfx_decrypt(running_machine *machine) int ofst; int rom_size = memory_region_length( machine, "sprites" ); UINT8 *rom = memory_region( machine, "sprites" ); - UINT8 *buf = malloc_or_die( rom_size ); + UINT8 *buf = alloc_array_or_die(UINT8, rom_size ); for ( i = 0; i < rom_size; i++ ) { @@ -891,7 +891,7 @@ void neogeo_cmc50_m1_decrypt(running_machine *machine) size_t rom_size = 0x80000; UINT8* rom2 = memory_region(machine, "audiocpu"); - UINT8* buffer = malloc_or_die(rom_size); + UINT8* buffer = alloc_array_or_die(UINT8, rom_size); UINT32 i; @@ -957,7 +957,7 @@ NeoGeo 'P' ROM encryption void kof98_decrypt_68k(running_machine *machine) { UINT8 *src = memory_region(machine, "maincpu"); - UINT8 *dst = malloc_or_die(0x200000); + UINT8 *dst = alloc_array_or_die(UINT8, 0x200000); int i, j, k; static const UINT32 sec[]={0x000000,0x100000,0x000004,0x100004,0x10000a,0x00000a,0x10000e,0x00000e}; static const UINT32 pos[]={0x000,0x004,0x00a,0x00e}; @@ -1174,7 +1174,7 @@ 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(machine, "maincpu")+0x100000; - UINT8 *dst = malloc_or_die(0x400000); + UINT8 *dst = alloc_array_or_die(UINT8, 0x400000); memcpy( dst, src, 0x400000 ); for( i=0; i<8; ++i ) { @@ -1189,7 +1189,7 @@ 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(machine, "maincpu")+0x100000; - UINT8 *dst = malloc_or_die(0x400000); + UINT8 *dst = alloc_array_or_die(UINT8, 0x400000); memcpy( dst, src, 0x400000); for( i=0; i<8; ++i ) { @@ -1204,7 +1204,7 @@ 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(machine, "maincpu"); - UINT8 *dst = malloc_or_die(0x800000); + UINT8 *dst = alloc_array_or_die(UINT8, 0x800000); memcpy( dst, src, 0x800000 ); for( i=0; i<16; ++i ) @@ -1220,7 +1220,7 @@ void samsh5sp_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(machine, "maincpu"); - UINT8 *dst = malloc_or_die(0x800000); + UINT8 *dst = alloc_array_or_die(UINT8, 0x800000); memcpy( dst, src, 0x800000 ); for( i=0; i<16; ++i ) @@ -1240,7 +1240,7 @@ void mslug5_decrypt_68k(running_machine *machine) int ofst; int rom_size = 0x800000; UINT8 *rom = memory_region( machine, "maincpu" ); - UINT8 *buf = malloc_or_die( rom_size ); + UINT8 *buf = alloc_array_or_die(UINT8, rom_size ); for( i = 0; i < 0x100000; i++ ) { @@ -1285,7 +1285,7 @@ void svc_px_decrypt(running_machine *machine) int ofst; int rom_size = 0x800000; UINT8 *rom = memory_region( machine, "maincpu" ); - UINT8 *buf = malloc_or_die( rom_size ); + UINT8 *buf = alloc_array_or_die(UINT8, rom_size ); for( i = 0; i < 0x100000; i++ ) { @@ -1329,7 +1329,7 @@ void kf2k3pcb_decrypt_68k(running_machine *machine) int ofst; int rom_size = 0x900000; UINT8 *rom = memory_region( machine, "maincpu" ); - UINT8 *buf = malloc_or_die( rom_size ); + UINT8 *buf = alloc_array_or_die(UINT8, rom_size ); for (i = 0; i < 0x100000; i++) { @@ -1372,7 +1372,7 @@ void kof2003_decrypt_68k(running_machine *machine) int ofst; int rom_size = 0x900000; UINT8 *rom = memory_region( machine, "maincpu" ); - UINT8 *buf = malloc_or_die( rom_size ); + UINT8 *buf = alloc_array_or_die(UINT8, rom_size ); for (i = 0; i < 0x100000; i++) { @@ -1420,7 +1420,7 @@ void kof2003h_decrypt_68k(running_machine *machine) int ofst; int rom_size = 0x900000; UINT8 *rom = memory_region( machine, "maincpu" ); - UINT8 *buf = malloc_or_die( rom_size ); + UINT8 *buf = alloc_array_or_die(UINT8, rom_size ); for (i = 0; i < 0x100000; i++) { @@ -1475,7 +1475,7 @@ void neo_pcm2_snk_1999(running_machine *machine, int value) if( rom != NULL ) { /* swap address lines on the whole ROMs */ - UINT16 *buffer = malloc_or_die((value / 2) * sizeof(UINT16)); + UINT16 *buffer = alloc_array_or_die(UINT16, value / 2); for( i = 0; i < size / 2; i += ( value / 2 ) ) { @@ -1510,7 +1510,7 @@ void neo_pcm2_swap(running_machine *machine, int value) {0x4b,0xa4,0x63,0x46,0xf0,0x91,0xea,0x62}, {0x4b,0xa4,0x63,0x46,0xf0,0x91,0xea,0x62}}; UINT8 *src = memory_region(machine, "ym"); - UINT8 *buf = malloc_or_die(0x1000000); + UINT8 *buf = alloc_array_or_die(UINT8, 0x1000000); int i, j, d; memcpy(buf,src,0x1000000); @@ -1554,7 +1554,7 @@ void kof2003biosdecode(running_machine *machine) 0xd3,0xd2,0x5c,0x5d,0x57,0x56,0xd8,0xd9, }; UINT16*src= (UINT16*)memory_region( machine, "mainbios" ); - UINT16*buf= malloc_or_die(0x80000); + UINT16*buf= alloc_array_or_die(UINT16, 0x80000/2); int a,addr; for (a=0;a<0x80000/2;a++) diff --git a/src/mame/machine/neoprot.c b/src/mame/machine/neoprot.c index e867c55bf53..77f6204ce8d 100644 --- a/src/mame/machine/neoprot.c +++ b/src/mame/machine/neoprot.c @@ -521,7 +521,7 @@ static WRITE16_HANDLER( pvc_prot_w ) void install_pvc_protection( running_machine *machine ) { - pvc_cartridge_ram = auto_malloc(0x2000); + pvc_cartridge_ram = auto_alloc_array(machine, UINT16, 0x2000/2); state_save_register_global_pointer(machine, pvc_cartridge_ram, 0x2000 / 2); memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2fe000, 0x2fffff, 0, 0, pvc_prot_r, pvc_prot_w); diff --git a/src/mame/machine/opwolf.c b/src/mame/machine/opwolf.c index dac06e5b333..07149445a35 100644 --- a/src/mame/machine/opwolf.c +++ b/src/mame/machine/opwolf.c @@ -720,7 +720,7 @@ static TIMER_CALLBACK( cchip_timer ) void opwolf_cchip_init(running_machine *machine) { - cchip_ram=auto_malloc(0x400 * 8); + cchip_ram=auto_alloc_array(machine, UINT8, 0x400 * 8); state_save_register_global(machine, current_bank); state_save_register_global(machine, current_cmd); diff --git a/src/mame/machine/playch10.c b/src/mame/machine/playch10.c index 67c5f511c52..e9bc51ecd0f 100644 --- a/src/mame/machine/playch10.c +++ b/src/mame/machine/playch10.c @@ -525,8 +525,8 @@ DRIVER_INIT( pcdboard ) DRIVER_INIT( pcdboard_2 ) { /* extra ram at $6000-$7fff */ - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x6000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1 ); - memory_set_bankptr(machine, 1, auto_malloc(0x2000)); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x6000, 0x7fff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_BANK(1) ); + memory_set_bankptr(machine, 1, auto_alloc_array(machine, UINT8, 0x2000)); /* common init */ DRIVER_INIT_CALL(pcdboard); @@ -623,8 +623,8 @@ DRIVER_INIT( pceboard ) ppu_latch = mapper9_latch; /* nvram at $6000-$6fff */ - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x6000, 0x6fff, 0, 0, SMH_BANK1, SMH_BANK1 ); - memory_set_bankptr(machine, 1, auto_malloc(0x1000)); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x6000, 0x6fff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_BANK(1) ); + memory_set_bankptr(machine, 1, auto_alloc_array(machine, UINT8, 0x1000)); /* common init */ DRIVER_INIT_CALL(playch10); @@ -656,8 +656,8 @@ DRIVER_INIT( pcfboard ) DRIVER_INIT( pcfboard_2 ) { /* extra ram at $6000-$6fff */ - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x6000, 0x6fff, 0, 0, SMH_BANK1, SMH_BANK1 ); - memory_set_bankptr(machine, 1, auto_malloc(0x1000)); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x6000, 0x6fff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_BANK(1) ); + memory_set_bankptr(machine, 1, auto_alloc_array(machine, UINT8, 0x1000)); /* common init */ DRIVER_INIT_CALL(pcfboard); @@ -834,8 +834,8 @@ DRIVER_INIT( pcgboard ) memory_install_write8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, gboard_rom_switch_w ); /* extra ram at $6000-$7fff */ - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x6000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1 ); - memory_set_bankptr(machine, 1, auto_malloc(0x2000)); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x6000, 0x7fff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_BANK(1) ); + memory_set_bankptr(machine, 1, auto_alloc_array(machine, UINT8, 0x2000)); gboard_banks[0] = 0x1e; gboard_banks[1] = 0x1f; @@ -951,8 +951,8 @@ DRIVER_INIT( pchboard ) memory_install_write8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, hboard_rom_switch_w ); /* extra ram at $6000-$7fff */ - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x6000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1 ); - memory_set_bankptr(machine, 1, auto_malloc(0x2000)); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x6000, 0x7fff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_BANK(1) ); + memory_set_bankptr(machine, 1, auto_alloc_array(machine, UINT8, 0x2000)); gboard_banks[0] = 0x1e; gboard_banks[1] = 0x1f; @@ -980,8 +980,8 @@ DRIVER_INIT( pckboard ) mmc1_rom_mask = 0x0f; /* extra ram at $6000-$7fff */ - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x6000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1 ); - memory_set_bankptr(machine, 1, auto_malloc(0x2000)); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x6000, 0x7fff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_BANK(1) ); + memory_set_bankptr(machine, 1, auto_alloc_array(machine, UINT8, 0x2000)); /* Roms are banked at $8000 to $bfff */ memory_install_write8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, mmc1_rom_switch_w ); diff --git a/src/mame/machine/rainbow.c b/src/mame/machine/rainbow.c index 695b5c7a39c..5be1df036eb 100644 --- a/src/mame/machine/rainbow.c +++ b/src/mame/machine/rainbow.c @@ -821,7 +821,7 @@ void rainbow_cchip_init(running_machine *machine, int version) for (i = 0; i < 8; i++) { - CRAM[i] = auto_malloc(0x400); + CRAM[i] = auto_alloc_array(machine, UINT8, 0x400); state_save_register_item_pointer(machine, "cchip", NULL, i, CRAM[i], 0x400); } diff --git a/src/mame/machine/s16fd.c b/src/mame/machine/s16fd.c index 16d16451d80..8027d6ade7f 100644 --- a/src/mame/machine/s16fd.c +++ b/src/mame/machine/s16fd.c @@ -210,7 +210,7 @@ void fd1094_driver_init(running_machine *machine, void (*set_decrypted)(running_ for (i = 0; i < CACHE_ENTRIES; i++) { - fd1094_cacheregion[i] = auto_malloc(fd1094_cpuregionsize); + fd1094_cacheregion[i] = auto_alloc_array(machine, UINT16, fd1094_cpuregionsize/2); fd1094_cached_states[i] = -1; } fd1094_current_cacheposition = 0; diff --git a/src/mame/machine/s24fd.c b/src/mame/machine/s24fd.c index 22904bbb465..3817b0cd9bb 100644 --- a/src/mame/machine/s24fd.c +++ b/src/mame/machine/s24fd.c @@ -167,7 +167,7 @@ void s24_fd1094_driver_init(running_machine *machine) for (i=0;i<S16_NUMCACHE;i++) { - s24_fd1094_cacheregion[i]=auto_malloc(s24_fd1094_cpuregionsize); + s24_fd1094_cacheregion[i]=auto_alloc_array(machine, UINT16, s24_fd1094_cpuregionsize/2); } /* flush the cached state array */ diff --git a/src/mame/machine/scramble.c b/src/mame/machine/scramble.c index 1f9fa92f8a0..a3e9ef7ce67 100644 --- a/src/mame/machine/scramble.c +++ b/src/mame/machine/scramble.c @@ -266,14 +266,14 @@ DRIVER_INIT( ckongs ) DRIVER_INIT( mariner ) { /* extra ROM */ - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5800, 0x67ff, 0, 0, SMH_BANK1, SMH_UNMAP); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5800, 0x67ff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_UNMAP); memory_set_bankptr(machine, 1, memory_region(machine, "maincpu") + 0x5800); memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x9008, 0x9008, 0, 0, mariner_protection_2_r); memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xb401, 0xb401, 0, 0, mariner_protection_1_r); /* ??? (it's NOT a background enable) */ - /*memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6803, 0x6803, 0, 0, SMH_NOP);*/ + /*memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6803, 0x6803, 0, 0, (write8_space_func)SMH_NOP);*/ } DRIVER_INIT( frogger ) @@ -349,15 +349,15 @@ DRIVER_INIT( cavelon ) UINT8 *ROM = memory_region(machine, "maincpu"); /* banked ROM */ - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0x3fff, 0, 0, SMH_BANK1); + memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0x3fff, 0, 0, (read8_space_func)SMH_BANK(1)); memory_configure_bank(machine, 1, 0, 2, &ROM[0x00000], 0x10000); cavelon_banksw(machine); /* A15 switches memory banks */ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, cavelon_banksw_r, cavelon_banksw_w); - memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2000, 0x2000, 0, 0, SMH_NOP); /* ??? */ - memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x3800, 0x3801, 0, 0, SMH_NOP); /* looks suspicously like + memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2000, 0x2000, 0, 0, (write8_space_func)SMH_NOP); /* ??? */ + memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x3800, 0x3801, 0, 0, (write8_space_func)SMH_NOP); /* looks suspicously like an AY8910, but not sure */ state_save_register_global(machine, cavelon_bank); } @@ -439,7 +439,7 @@ DRIVER_INIT( anteater ) RAM = memory_region(machine, "gfx1"); len = memory_region_length(machine, "gfx1"); - scratch = malloc_or_die(len); + scratch = alloc_array_or_die(UINT8, len); memcpy(scratch, RAM, len); @@ -476,7 +476,7 @@ DRIVER_INIT( rescue ) RAM = memory_region(machine, "gfx1"); len = memory_region_length(machine, "gfx1"); - scratch = malloc_or_die(len); + scratch = alloc_array_or_die(UINT8, len); memcpy(scratch, RAM, len); @@ -512,7 +512,7 @@ DRIVER_INIT( minefld ) RAM = memory_region(machine, "gfx1"); len = memory_region_length(machine, "gfx1"); - scratch = malloc_or_die(len); + scratch = alloc_array_or_die(UINT8, len); memcpy(scratch, RAM, len); @@ -550,7 +550,7 @@ DRIVER_INIT( losttomb ) RAM = memory_region(machine, "gfx1"); len = memory_region_length(machine, "gfx1"); - scratch = malloc_or_die(len); + scratch = alloc_array_or_die(UINT8, len); memcpy(scratch, RAM, len); diff --git a/src/mame/machine/segacrpt.c b/src/mame/machine/segacrpt.c index 0be0b3f35af..2d14f2f5cc9 100644 --- a/src/mame/machine/segacrpt.c +++ b/src/mame/machine/segacrpt.c @@ -241,7 +241,7 @@ static void sega_decode(running_machine *machine, const char *cputag, const UINT int length = memory_region_length(machine, cputag); int cryptlen = MIN(length, 0x8000); UINT8 *rom = memory_region(machine, cputag); - UINT8 *decrypted = auto_malloc(0xc000); + UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0xc000); memory_set_decrypted_region(space, 0x0000, cryptlen - 1, decrypted); @@ -462,7 +462,7 @@ void toprollr_decode(running_machine *machine, const char *cputag, const char *r const address_space *space = cputag_get_address_space(machine, cputag, ADDRESS_SPACE_PROGRAM); UINT8 *rom = memory_region(machine, regiontag); int bankstart; - decrypted = auto_malloc(0x6000*3); + decrypted = auto_alloc_array(machine, UINT8, 0x6000*3); for(bankstart=0;bankstart<0x6000*3;bankstart+=0x6000) @@ -819,7 +819,7 @@ void jongkyo_decode(running_machine *machine, const char *cputag) const address_space *space = cputag_get_address_space(machine, cputag, ADDRESS_SPACE_PROGRAM); UINT8 *rom = memory_region(machine, cputag); - decrypted = auto_malloc(0x9000); + decrypted = auto_alloc_array(machine, UINT8, 0x9000); for (A = 0x0000;A < 0x9000;A++) { @@ -1119,7 +1119,7 @@ static void sega_decode_2(running_machine *machine,const char *cputag, const address_space *space = cputag_get_address_space(machine, cputag, ADDRESS_SPACE_PROGRAM); UINT8 *rom = memory_region(machine, cputag); - UINT8 *decrypted = auto_malloc(0x8000); + UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0x8000); memory_set_decrypted_region(space, 0x0000, 0x7fff, decrypted); diff --git a/src/mame/machine/segas32.c b/src/mame/machine/segas32.c index fde6e1cd97b..2b8ddbedc7c 100644 --- a/src/mame/machine/segas32.c +++ b/src/mame/machine/segas32.c @@ -38,8 +38,8 @@ static void nec_v25_cpu_decrypt(running_machine *machine) int i; const address_space *space = cputag_get_address_space(machine, "mcu", ADDRESS_SPACE_PROGRAM); UINT8 *rom = memory_region(machine, "mcu"); - UINT8* decrypted = auto_malloc(0x100000); - UINT8* temp = malloc_or_die(0x100000); + UINT8* decrypted = auto_alloc_array(machine, UINT8, 0x100000); + UINT8* temp = alloc_array_or_die(UINT8, 0x100000); // set CPU3 opcode base memory_set_decrypted_region(space, 0x00000, 0xfffff, decrypted); diff --git a/src/mame/machine/snes.c b/src/mame/machine/snes.c index 5d4689e4169..e0179df8278 100644 --- a/src/mame/machine/snes.c +++ b/src/mame/machine/snes.c @@ -1631,9 +1631,9 @@ static DIRECT_UPDATE_HANDLER(snes_direct) MACHINE_START( snes ) { - snes_vram = auto_malloc(SNES_VRAM_SIZE); - snes_cgram = auto_malloc(SNES_CGRAM_SIZE); - snes_oam = auto_malloc(SNES_OAM_SIZE); + snes_vram = auto_alloc_array(machine, UINT8, SNES_VRAM_SIZE); + snes_cgram = auto_alloc_array(machine, UINT16, SNES_CGRAM_SIZE/2); + snes_oam = auto_alloc_array(machine, UINT16, SNES_OAM_SIZE/2); memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), snes_direct); memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), spc_direct); @@ -1673,7 +1673,7 @@ DRIVER_INIT( snes ) UINT8 *rom; rom = memory_region(machine, "user3"); - snes_ram = auto_malloc(0x1000000); + snes_ram = auto_alloc_array(machine, UINT8, 0x1000000); memset(snes_ram, 0, 0x1000000); /* all NSS games seem to use MODE 20 */ @@ -1739,7 +1739,7 @@ DRIVER_INIT( snes_hirom ) UINT8 *rom; rom = memory_region(machine, "user3"); - snes_ram = auto_malloc(0x1000000); + snes_ram = auto_alloc_array(machine, UINT8, 0x1000000); memset(snes_ram, 0, 0x1000000); snes_cart.mode = SNES_MODE_21; diff --git a/src/mame/machine/starwars.c b/src/mame/machine/starwars.c index ed93cee30fe..d601bfeea99 100644 --- a/src/mame/machine/starwars.c +++ b/src/mame/machine/starwars.c @@ -174,9 +174,9 @@ void starwars_mproc_init(running_machine *machine) UINT8 *src = memory_region(machine, "user2"); int cnt, val; - PROM_STR = auto_malloc(1024 * sizeof(PROM_STR[0])); - PROM_MAS = auto_malloc(1024 * sizeof(PROM_MAS[0])); - PROM_AM = auto_malloc(1024 * sizeof(PROM_AM[0])); + PROM_STR = auto_alloc_array(machine, UINT8, 1024); + PROM_MAS = auto_alloc_array(machine, UINT8, 1024); + PROM_AM = auto_alloc_array(machine, UINT8, 1024); for (cnt = 0; cnt < 1024; cnt++) { diff --git a/src/mame/machine/stfight.c b/src/mame/machine/stfight.c index a18d8f72389..9f956132639 100644 --- a/src/mame/machine/stfight.c +++ b/src/mame/machine/stfight.c @@ -53,7 +53,7 @@ DRIVER_INIT( empcity ) UINT8 *rom = memory_region(machine, "maincpu"); int A; - decrypt = auto_malloc(0x8000); + decrypt = auto_alloc_array(machine, UINT8, 0x8000); memory_set_decrypted_region(space, 0x0000, 0x7fff, decrypt); for (A = 0;A < 0x8000;A++) diff --git a/src/mame/machine/stvcd.c b/src/mame/machine/stvcd.c index 8c5dd61bf3b..36bb7f13cb9 100644 --- a/src/mame/machine/stvcd.c +++ b/src/mame/machine/stvcd.c @@ -1507,7 +1507,7 @@ static void make_dir_current(UINT32 fad) free((void *)curdir); } - curdir = (direntryT *)malloc_or_die(sizeof(direntryT)*numentries); + curdir = alloc_array_or_die(direntryT, numentries); curentry = curdir; numfiles = numentries; diff --git a/src/mame/machine/tnzs.c b/src/mame/machine/tnzs.c index 9d20f50aed8..d26f60793b1 100644 --- a/src/mame/machine/tnzs.c +++ b/src/mame/machine/tnzs.c @@ -521,7 +521,7 @@ DRIVER_INIT( drtoppel ) mcu_type = MCU_DRTOPPEL; /* drtoppel writes to the palette RAM area even if it has PROMs! We have to patch it out. */ - memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf800, 0xfbff, 0, 0, SMH_NOP); + memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf800, 0xfbff, 0, 0, (write8_space_func)SMH_NOP); } DRIVER_INIT( chukatai ) diff --git a/src/mame/machine/volfied.c b/src/mame/machine/volfied.c index c95e8dc003e..c14718e0a95 100644 --- a/src/mame/machine/volfied.c +++ b/src/mame/machine/volfied.c @@ -486,7 +486,7 @@ READ16_HANDLER( volfied_cchip_ram_r ) void volfied_cchip_init(running_machine *machine) { - cchip_ram=auto_malloc(0x400 * 8); + cchip_ram=auto_alloc_array(machine, UINT8, 0x400 * 8); state_save_register_global(machine, current_bank); state_save_register_global(machine, current_cmd); diff --git a/src/mame/machine/vsnes.c b/src/mame/machine/vsnes.c index d7eb634912b..2aedd43ad71 100644 --- a/src/mame/machine/vsnes.c +++ b/src/mame/machine/vsnes.c @@ -323,8 +323,8 @@ DRIVER_INIT( suprmrio ) DRIVER_INIT_CALL(vsnormal); /* extra ram at $6000 is enabled with bit 1 of $4016 */ - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1 ); - memory_set_bankptr(machine, 1, auto_malloc(0x2000)); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6000, 0x7fff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_BANK(1) ); + memory_set_bankptr(machine, 1, auto_alloc_array(machine, UINT8, 0x2000)); /* now override the vidaccess callback */ /* we need to remap color tables */ @@ -982,8 +982,8 @@ DRIVER_INIT( MMC3 ) memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, mapper4_w ); /* extra ram at $6000-$7fff */ - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1 ); - memory_set_bankptr(machine, 1, auto_malloc(0x2000)); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6000, 0x7fff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_BANK(1) ); + memory_set_bankptr(machine, 1, auto_alloc_array(machine, UINT8, 0x2000)); /* common init */ init_vsnes(machine); @@ -1208,8 +1208,8 @@ DRIVER_INIT( bnglngby ) memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0231, 0x0231, 0, 0, set_bnglngby_irq_r, set_bnglngby_irq_w ); /* extra ram */ - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1 ); - memory_set_bankptr(machine, 1, auto_malloc(0x2000)); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6000, 0x7fff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_BANK(1) ); + memory_set_bankptr(machine, 1, auto_alloc_array(machine, UINT8, 0x2000)); ret = 0; @@ -1299,8 +1299,8 @@ DRIVER_INIT( vstennis ) memory_install_write8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x4016, 0x4016, 0, 0, vstennis_vrom_banking ); /* shared ram at $6000 */ - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1 ); - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x6000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1 ); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6000, 0x7fff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_BANK(1) ); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x6000, 0x7fff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_BANK(1) ); memory_set_bankptr(machine, 1, &prg[0x6000]); } @@ -1370,8 +1370,8 @@ DRIVER_INIT( btlecity ) DRIVER_INIT( vstetris ) { /* extra ram at $6000 is enabled with bit 1 of $4016 */ - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1 ); - memory_set_bankptr(machine, 1, auto_malloc(0x2000)); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6000, 0x7fff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_BANK(1) ); + memory_set_bankptr(machine, 1, auto_alloc_array(machine, UINT8, 0x2000)); init_vsnes(machine); DRIVER_INIT_CALL(vsnormal); diff --git a/src/mame/machine/williams.c b/src/mame/machine/williams.c index 775da9dbbb7..2e819cc4733 100644 --- a/src/mame/machine/williams.c +++ b/src/mame/machine/williams.c @@ -508,8 +508,8 @@ WRITE8_HANDLER( williams2_bank_select_w ) { /* page 0 is video ram */ case 0: - memory_install_read8_handler(space, 0x0000, 0x8fff, 0, 0, SMH_BANK1); - memory_install_write8_handler(space, 0x8000, 0x87ff, 0, 0, SMH_BANK4); + memory_install_read8_handler(space, 0x0000, 0x8fff, 0, 0, (read8_space_func)SMH_BANK(1)); + memory_install_write8_handler(space, 0x8000, 0x87ff, 0, 0, (write8_space_func)SMH_BANK(4)); memory_set_bank(space->machine, 1, 0); memory_set_bankptr(space->machine, 4, &williams_videoram[0x8000]); break; @@ -517,15 +517,15 @@ WRITE8_HANDLER( williams2_bank_select_w ) /* pages 1 and 2 are ROM */ case 1: case 2: - memory_install_read8_handler(space, 0x0000, 0x8fff, 0, 0, SMH_BANK1); - memory_install_write8_handler(space, 0x8000, 0x87ff, 0, 0, SMH_BANK4); + memory_install_read8_handler(space, 0x0000, 0x8fff, 0, 0, (read8_space_func)(read8_space_func)(read8_space_func)(read8_space_func)(read8_space_func)(read8_space_func)(read8_space_func)(read8_space_func)(read8_space_func)(read8_space_func)(read8_space_func)(read8_space_func)(read8_space_func)(read8_space_func)(read8_space_func)(read8_space_func)(read8_space_func)SMH_BANK(1)); + memory_install_write8_handler(space, 0x8000, 0x87ff, 0, 0, (write8_space_func)(write8_space_func)(write8_space_func)(write8_space_func)(write8_space_func)(write8_space_func)(write8_space_func)(write8_space_func)(write8_space_func)(write8_space_func)(write8_space_func)(write8_space_func)(write8_space_func)(write8_space_func)(write8_space_func)(write8_space_func)(write8_space_func)SMH_BANK(4)); memory_set_bank(space->machine, 1, 1 + ((vram_bank & 6) >> 1)); memory_set_bankptr(space->machine, 4, &williams_videoram[0x8000]); break; /* page 3 accesses palette RAM; the remaining areas are as if page 1 ROM was selected */ case 3: - memory_install_readwrite8_handler(space, 0x8000, 0x87ff, 0, 0, SMH_BANK4, williams2_paletteram_w); + memory_install_readwrite8_handler(space, 0x8000, 0x87ff, 0, 0, (read8_space_func)SMH_BANK(4), williams2_paletteram_w); memory_set_bank(space->machine, 1, 1 + ((vram_bank & 4) >> 1)); memory_set_bankptr(space->machine, 4, paletteram); break; @@ -777,13 +777,13 @@ WRITE8_HANDLER( defender_bank_select_w ) case 7: case 8: case 9: - memory_install_readwrite8_handler(space, 0xc000, 0xcfff, 0, 0, SMH_BANK1, SMH_UNMAP); + memory_install_readwrite8_handler(space, 0xc000, 0xcfff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_UNMAP); memory_set_bank(space->machine, 1, vram_bank - 1); break; /* pages A-F are not connected */ default: - memory_install_readwrite8_handler(space, 0xc000, 0xcfff, 0, 0, SMH_NOP, SMH_NOP); + memory_install_readwrite8_handler(space, 0xc000, 0xcfff, 0, 0, (read8_space_func)SMH_NOP, (write8_space_func)SMH_NOP); break; } } diff --git a/src/mame/machine/zs01.c b/src/mame/machine/zs01.c index 2839f7d0fb7..a3f34e4a594 100644 --- a/src/mame/machine/zs01.c +++ b/src/mame/machine/zs01.c @@ -81,7 +81,7 @@ void zs01_init( running_machine *machine, int chip, UINT8 *data, zs01_write_hand if( data == NULL ) { - data = auto_malloc( + data = auto_alloc_array(machine, UINT8, SIZE_RESPONSE_TO_RESET + SIZE_KEY + SIZE_KEY + @@ -90,7 +90,7 @@ void zs01_init( running_machine *machine, int chip, UINT8 *data, zs01_write_hand if( ds2401 == NULL ) { - ds2401 = auto_malloc( SIZE_DATA_BUFFER ); + ds2401 = auto_alloc_array(machine, UINT8, SIZE_DATA_BUFFER ); } c->cs = 0; diff --git a/src/mame/video/40love.c b/src/mame/video/40love.c index b4a72e88ef0..a510792c3bf 100644 --- a/src/mame/video/40love.c +++ b/src/mame/video/40love.c @@ -119,13 +119,11 @@ static STATE_POSTLOAD( redraw_pixels ) VIDEO_START( fortyl ) { - fortyl_pixram1 = auto_malloc(0x4000); - fortyl_pixram2 = auto_malloc(0x4000); - memset(fortyl_pixram1,0,0x4000); - memset(fortyl_pixram2,0,0x4000); + fortyl_pixram1 = auto_alloc_array_clear(machine, UINT8, 0x4000); + fortyl_pixram2 = auto_alloc_array_clear(machine, UINT8, 0x4000); - pixel_bitmap1 = auto_bitmap_alloc(256,256,video_screen_get_format(machine->primary_screen)); - pixel_bitmap2 = auto_bitmap_alloc(256,256,video_screen_get_format(machine->primary_screen)); + pixel_bitmap1 = auto_bitmap_alloc(machine,256,256,video_screen_get_format(machine->primary_screen)); + pixel_bitmap2 = auto_bitmap_alloc(machine,256,256,video_screen_get_format(machine->primary_screen)); background = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8,8,64,32); diff --git a/src/mame/video/aeroboto.c b/src/mame/video/aeroboto.c index f8b759ad323..b6ec28674e9 100644 --- a/src/mame/video/aeroboto.c +++ b/src/mame/video/aeroboto.c @@ -58,7 +58,7 @@ VIDEO_START( aeroboto ) rom = memory_region(machine, "gfx2"); length = memory_region_length(machine, "gfx2"); - temp = malloc_or_die(length); + temp = alloc_array_or_die(UINT8, length); memcpy(temp, rom, length); for (i=0; i<length; i++) rom[(i&~0xff)+(i<<5&0xe0)+(i>>3&0x1f)] = temp[i]; diff --git a/src/mame/video/aliens.c b/src/mame/video/aliens.c index 48ef3ad208e..f9ed82804a0 100644 --- a/src/mame/video/aliens.c +++ b/src/mame/video/aliens.c @@ -53,7 +53,7 @@ static void sprite_callback(int *code,int *color,int *priority_mask,int *shadow) VIDEO_START( aliens ) { - paletteram = auto_malloc(0x400); + paletteram = auto_alloc_array(machine, UINT8, 0x400); layer_colorbase[0] = 0; layer_colorbase[1] = 4; diff --git a/src/mame/video/arabian.c b/src/mame/video/arabian.c index a90be49488c..037675178df 100644 --- a/src/mame/video/arabian.c +++ b/src/mame/video/arabian.c @@ -172,10 +172,10 @@ VIDEO_START( arabian ) /* allocate a common bitmap to use for both planes */ /* plane A (top plane with motion objects) is in the upper 4 bits */ /* plane B (bottom plane with playfield) is in the lower 4 bits */ - main_bitmap = auto_malloc(BITMAP_WIDTH * BITMAP_HEIGHT); + main_bitmap = auto_alloc_array(machine, UINT8, BITMAP_WIDTH * BITMAP_HEIGHT); /* allocate memory for the converted graphics data */ - converted_gfx = auto_malloc(0x8000 * 2); + converted_gfx = auto_alloc_array(machine, UINT8, 0x8000 * 2); /*-------------------------------------------------- transform graphics data into more usable format diff --git a/src/mame/video/argus.c b/src/mame/video/argus.c index ff7ffe5a2d4..9270d1857a5 100644 --- a/src/mame/video/argus.c +++ b/src/mame/video/argus.c @@ -321,9 +321,9 @@ VIDEO_START( argus ) tilemap_set_transparent_pen(tx_tilemap, 15); /* dummy RAM for back ground */ - argus_dummy_bg0ram = auto_malloc(0x800); + argus_dummy_bg0ram = auto_alloc_array(machine, UINT8, 0x800); - jal_blend_table = auto_malloc(0xc00); + jal_blend_table = auto_alloc_array(machine, UINT8, 0xc00); } VIDEO_RESET( argus ) @@ -346,7 +346,7 @@ VIDEO_START( valtric ) mosaicbitmap = video_screen_auto_bitmap_alloc(machine->primary_screen); - jal_blend_table = auto_malloc(0xc00); + jal_blend_table = auto_alloc_array(machine, UINT8, 0xc00); } VIDEO_RESET( valtric ) @@ -365,15 +365,15 @@ VIDEO_START( butasan ) tilemap_set_transparent_pen(bg1_tilemap, 15); tilemap_set_transparent_pen(tx_tilemap, 15); - butasan_pagedram[0] = auto_malloc(0x1000); - butasan_pagedram[1] = auto_malloc(0x1000); + butasan_pagedram[0] = auto_alloc_array(machine, UINT8, 0x1000); + butasan_pagedram[1] = auto_alloc_array(machine, UINT8, 0x1000); butasan_bg0ram = &butasan_pagedram[0][0x000]; butasan_bg0backram = &butasan_pagedram[0][0x800]; butasan_txram = &butasan_pagedram[1][0x000]; butasan_txbackram = &butasan_pagedram[1][0x800]; - jal_blend_table = auto_malloc(0xc00); + jal_blend_table = auto_alloc_array(machine, UINT8, 0xc00); //jal_blend_table = NULL; } diff --git a/src/mame/video/astrocde.c b/src/mame/video/astrocde.c index 5aca81b2a14..fa92d7b7249 100644 --- a/src/mame/video/astrocde.c +++ b/src/mame/video/astrocde.c @@ -92,7 +92,7 @@ static UINT8 profpac_vw; static void init_savestate(running_machine *machine); static TIMER_CALLBACK( scanline_callback ); -static void init_sparklestar(void); +static void init_sparklestar(running_machine *machine); @@ -230,7 +230,7 @@ VIDEO_START( astrocde ) /* initialize the sparkle and stars */ if (astrocade_video_config & AC_STARS) - init_sparklestar(); + init_sparklestar(machine); } @@ -241,7 +241,7 @@ VIDEO_START( profpac ) timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, 1, 0), 1); /* allocate videoram */ - profpac_videoram = auto_malloc(0x4000 * 4 * sizeof(*profpac_videoram)); + profpac_videoram = auto_alloc_array(machine, UINT16, 0x4000 * 4); /* register for save states */ init_savestate(machine); @@ -957,7 +957,7 @@ WRITE8_HANDLER( astrocade_pattern_board_w ) relative to the beginning of time and use that, mod RNG_PERIOD. */ -static void init_sparklestar(void) +static void init_sparklestar(running_machine *machine) { UINT32 shiftreg; int i; @@ -966,7 +966,7 @@ static void init_sparklestar(void) astrocade_sparkle[0] = astrocade_sparkle[1] = astrocade_sparkle[2] = astrocade_sparkle[3] = 0; /* allocate memory for the sparkle/star array */ - sparklestar = auto_malloc(RNG_PERIOD); + sparklestar = auto_alloc_array(machine, UINT8, RNG_PERIOD); /* generate the data for the sparkle/star array */ for (shiftreg = i = 0; i < RNG_PERIOD; i++) diff --git a/src/mame/video/atari.c b/src/mame/video/atari.c index 6fdff8b0fcb..a5decbcc8ba 100644 --- a/src/mame/video/atari.c +++ b/src/mame/video/atari.c @@ -713,7 +713,7 @@ VIDEO_START( atari ) LOG(("atari antic_vh_start\n")); memset(&antic, 0, sizeof(antic)); - antic.cclk_expand = auto_malloc(21 * 256 * sizeof(UINT32)); + antic.cclk_expand = auto_alloc_array(machine, UINT32, 21 * 256); antic.pf_21 = &antic.cclk_expand[ 0 * 256]; antic.pf_x10b = &antic.cclk_expand[ 1 * 256]; @@ -725,7 +725,7 @@ VIDEO_START( atari ) antic.pf_gtia2 = &antic.cclk_expand[19 * 256]; antic.pf_gtia3 = &antic.cclk_expand[20 * 256]; - antic.used_colors = auto_malloc(21 * 256 * sizeof(UINT8)); + antic.used_colors = auto_alloc_array(machine, UINT8, 21 * 256); memset(antic.used_colors, 0, 21 * 256 * sizeof(UINT8)); @@ -748,7 +748,7 @@ VIDEO_START( atari ) for( i = 0; i < 64; i++ ) { - antic.prio_table[i] = auto_malloc(8*256); + antic.prio_table[i] = auto_alloc_array(machine, UINT8, 8*256); } LOG(("atari prio_init\n")); @@ -756,8 +756,7 @@ VIDEO_START( atari ) for( i = 0; i < video_screen_get_height(machine->primary_screen); i++ ) { - antic.video[i] = auto_malloc(sizeof(VIDEO)); - memset(antic.video[i], 0, sizeof(VIDEO)); + antic.video[i] = auto_alloc_clear(machine, VIDEO); } VIDEO_START_CALL(generic_bitmapped); diff --git a/src/mame/video/atarigt.c b/src/mame/video/atarigt.c index d33fb7b0f20..5a00edf72d4 100644 --- a/src/mame/video/atarigt.c +++ b/src/mame/video/atarigt.c @@ -152,14 +152,14 @@ VIDEO_START( atarigt ) width = video_screen_get_width(machine->primary_screen); height = video_screen_get_height(machine->primary_screen); - pf_bitmap = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED16); - an_bitmap = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED16); + pf_bitmap = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16); + an_bitmap = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16); /* allocate memory */ - expanded_mram = auto_malloc(sizeof(*expanded_mram) * MRAM_ENTRIES * 3); + expanded_mram = auto_alloc_array(machine, UINT32, MRAM_ENTRIES * 3); /* map pens 1:1 */ - substitute_pens = auto_malloc(65536 * sizeof(*substitute_pens)); + substitute_pens = auto_alloc_array(machine, pen_t, 65536); for (i = 0; i < machine->config->total_colors; i++) substitute_pens[i] = i; machine->pens = substitute_pens; diff --git a/src/mame/video/atarimo.c b/src/mame/video/atarimo.c index 79e6eba1933..aa30676790d 100644 --- a/src/mame/video/atarimo.c +++ b/src/mame/video/atarimo.c @@ -406,24 +406,21 @@ void atarimo_init(running_machine *machine, int map, const atarimo_desc *desc) mo->slipram = (map == 0) ? &atarimo_0_slipram : &atarimo_1_slipram; /* allocate the temp bitmap */ - mo->bitmap = auto_bitmap_alloc(video_screen_get_width(machine->primary_screen), video_screen_get_height(machine->primary_screen), BITMAP_FORMAT_INDEXED16); + mo->bitmap = auto_bitmap_alloc(machine, video_screen_get_width(machine->primary_screen), video_screen_get_height(machine->primary_screen), BITMAP_FORMAT_INDEXED16); bitmap_fill(mo->bitmap, NULL, desc->transpen); /* allocate the spriteram */ - mo->spriteram = auto_malloc(sizeof(mo->spriteram[0]) * mo->spriteramsize); - - /* clear it to zero */ - memset(mo->spriteram, 0, sizeof(mo->spriteram[0]) * mo->spriteramsize); + mo->spriteram = auto_alloc_array_clear(machine, atarimo_entry, mo->spriteramsize); /* allocate the code lookup */ - mo->codelookup = auto_malloc(sizeof(mo->codelookup[0]) * round_to_powerof2(mo->codemask.mask)); + mo->codelookup = auto_alloc_array(machine, UINT16, round_to_powerof2(mo->codemask.mask)); /* initialize it 1:1 */ for (i = 0; i < round_to_powerof2(mo->codemask.mask); i++) mo->codelookup[i] = i; /* allocate the color lookup */ - mo->colorlookup = auto_malloc(sizeof(mo->colorlookup[0]) * round_to_powerof2(mo->colormask.mask)); + mo->colorlookup = auto_alloc_array(machine, UINT8, round_to_powerof2(mo->colormask.mask)); /* initialize it 1:1 */ for (i = 0; i < round_to_powerof2(mo->colormask.mask); i++) @@ -432,10 +429,10 @@ void atarimo_init(running_machine *machine, int map, const atarimo_desc *desc) /* allocate dirty grid */ mo->dirtywidth = (video_screen_get_width(machine->primary_screen) >> mo->tilexshift) + 2; mo->dirtyheight = (video_screen_get_height(machine->primary_screen) >> mo->tileyshift) + 2; - mo->dirtygrid = auto_malloc(mo->dirtywidth * mo->dirtyheight); + mo->dirtygrid = auto_alloc_array(machine, UINT8, mo->dirtywidth * mo->dirtyheight); /* allocate the gfx lookup */ - mo->gfxlookup = auto_malloc(sizeof(mo->gfxlookup[0]) * round_to_powerof2(mo->gfxmask.mask)); + mo->gfxlookup = auto_alloc_array(machine, UINT8, round_to_powerof2(mo->gfxmask.mask)); /* initialize it with the gfxindex we were passed in */ for (i = 0; i < round_to_powerof2(mo->gfxmask.mask); i++) diff --git a/src/mame/video/atarirle.c b/src/mame/video/atarirle.c index 41c240da725..2d2efc607e5 100644 --- a/src/mame/video/atarirle.c +++ b/src/mame/video/atarirle.c @@ -135,7 +135,7 @@ static UINT16 *rle_table[8]; STATIC FUNCTION DECLARATIONS ***************************************************************************/ -static void build_rle_tables(void); +static void build_rle_tables(running_machine *machine); static int count_objects(const UINT16 *base, int length); static void prescan_rle(const atarirle_data *mo, int which); static void sort_and_render(running_machine *machine, atarirle_data *mo); @@ -278,7 +278,7 @@ void atarirle_init(running_machine *machine, int map, const atarirle_desc *desc) assert_always(map >= 0 && map < ATARIRLE_MAX, "Invalid map index"); /* build and allocate the generic tables */ - build_rle_tables(); + build_rle_tables(machine); /* determine the masks first */ convert_mask(&desc->codemask, &mo->codemask); @@ -326,33 +326,29 @@ void atarirle_init(running_machine *machine, int map, const atarirle_desc *desc) } /* allocate the object info */ - mo->info = auto_malloc(sizeof(mo->info[0]) * mo->objectcount); + mo->info = auto_alloc_array_clear(machine, atarirle_info, mo->objectcount); /* fill in the data */ - memset(mo->info, 0, sizeof(mo->info[0]) * mo->objectcount); for (i = 0; i < mo->objectcount; i++) prescan_rle(mo, i); /* allocate the spriteram */ - mo->spriteram = auto_malloc(sizeof(mo->spriteram[0]) * mo->spriteramsize); - - /* clear it to zero */ - memset(mo->spriteram, 0, sizeof(mo->spriteram[0]) * mo->spriteramsize); + mo->spriteram = auto_alloc_array_clear(machine, atarirle_entry, mo->spriteramsize); /* allocate bitmaps */ width = video_screen_get_width(machine->primary_screen); height = video_screen_get_height(machine->primary_screen); - mo->vram[0][0] = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED16); - mo->vram[0][1] = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED16); + mo->vram[0][0] = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16); + mo->vram[0][1] = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16); bitmap_fill(mo->vram[0][0], NULL, 0); bitmap_fill(mo->vram[0][1], NULL, 0); /* allocate alternate bitmaps if needed */ if (mo->vrammask.mask != 0) { - mo->vram[1][0] = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED16); - mo->vram[1][1] = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED16); + mo->vram[1][0] = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16); + mo->vram[1][1] = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16); bitmap_fill(mo->vram[1][0], NULL, 0); bitmap_fill(mo->vram[1][1], NULL, 0); } @@ -540,13 +536,13 @@ bitmap_t *atarirle_get_vram(int map, int idx) build_rle_tables: Builds internal table for RLE mapping. ---------------------------------------------------------------*/ -static void build_rle_tables(void) +static void build_rle_tables(running_machine *machine) { UINT16 *base; int i; /* allocate all 5 tables */ - base = auto_malloc(0x500 * sizeof(UINT16)); + base = auto_alloc_array(machine, UINT16, 0x500); /* assign the tables */ rle_table[0] = &base[0x000]; diff --git a/src/mame/video/atarisy2.c b/src/mame/video/atarisy2.c index 0eac47bfaf4..01c1a444d28 100644 --- a/src/mame/video/atarisy2.c +++ b/src/mame/video/atarisy2.c @@ -116,7 +116,7 @@ VIDEO_START( atarisy2 ) }; /* allocate banked memory */ - vram = auto_malloc(0x8000); + vram = auto_alloc_array(machine, UINT16, 0x8000/2); memset(vram, 0, 0x8000); atarigen_alpha = &vram[0x0000]; atarimo_0_spriteram = &vram[0x0c00]; diff --git a/src/mame/video/balsente.c b/src/mame/video/balsente.c index 4b0bbe56521..38d44d388fe 100644 --- a/src/mame/video/balsente.c +++ b/src/mame/video/balsente.c @@ -39,7 +39,7 @@ VIDEO_START( balsente ) sprite_bank[1] = memory_region(machine, "gfx1") + 0x10000; /* allocate a local copy of video RAM */ - local_videoram = auto_malloc(256 * 256); + local_videoram = auto_alloc_array(machine, UINT8, 256 * 256); /* determine sprite size */ sprite_data = memory_region(machine, "gfx1"); diff --git a/src/mame/video/battlane.c b/src/mame/video/battlane.c index 2d1b575fc64..70f7db984bc 100644 --- a/src/mame/video/battlane.c +++ b/src/mame/video/battlane.c @@ -146,7 +146,7 @@ VIDEO_START( battlane ) bg_tilemap = tilemap_create(machine, get_tile_info_bg, battlane_tilemap_scan_rows_2x2, 16, 16, 32, 32); - screen_bitmap = auto_bitmap_alloc(32 * 8, 32 * 8, BITMAP_FORMAT_INDEXED8); + screen_bitmap = auto_bitmap_alloc(machine, 32 * 8, 32 * 8, BITMAP_FORMAT_INDEXED8); } static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) diff --git a/src/mame/video/battlera.c b/src/mame/video/battlera.c index e05d40ad496..18a4521df33 100644 --- a/src/mame/video/battlera.c +++ b/src/mame/video/battlera.c @@ -27,14 +27,14 @@ static UINT8 blank_tile[32]; VIDEO_START( battlera ) { - HuC6270_vram=auto_malloc(0x20000); - vram_dirty=auto_malloc(0x1000); + HuC6270_vram=auto_alloc_array(machine, UINT8, 0x20000); + vram_dirty=auto_alloc_array(machine, UINT8, 0x1000); memset(HuC6270_vram,0,0x20000); memset(vram_dirty,1,0x1000); - tile_bitmap=auto_bitmap_alloc(512,512,video_screen_get_format(machine->primary_screen)); - front_bitmap=auto_bitmap_alloc(512,512,video_screen_get_format(machine->primary_screen)); + tile_bitmap=auto_bitmap_alloc(machine,512,512,video_screen_get_format(machine->primary_screen)); + front_bitmap=auto_bitmap_alloc(machine,512,512,video_screen_get_format(machine->primary_screen)); vram_ptr=0; inc_value=1; diff --git a/src/mame/video/beathead.c b/src/mame/video/beathead.c index e6a9009c47c..61a963854a0 100644 --- a/src/mame/video/beathead.c +++ b/src/mame/video/beathead.c @@ -43,7 +43,7 @@ static UINT8 * hsyncram; VIDEO_START( beathead ) { - hsyncram = auto_malloc(0x800); + hsyncram = auto_alloc_array(machine, UINT8, 0x800); } diff --git a/src/mame/video/bfm_adr2.c b/src/mame/video/bfm_adr2.c index bb1d8657f5d..8723353d609 100644 --- a/src/mame/video/bfm_adr2.c +++ b/src/mame/video/bfm_adr2.c @@ -432,7 +432,7 @@ void adder2_decode_char_roms(running_machine *machine) { UINT8 *s; - s = malloc_or_die( 0x40000 ); + s = alloc_array_or_die(UINT8, 0x40000 ); { int x, y; @@ -471,7 +471,7 @@ void adder2_decode_char_roms(running_machine *machine) ADDRESS_MAP_START( adder2_memmap, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x0000) AM_WRITE(adder2_screen_page_w) // screen access/display select - AM_RANGE(0x0000, 0x7FFF) AM_READ(SMH_BANK2) // 8k paged ROM (4 pages) + AM_RANGE(0x0000, 0x7FFF) AM_READ(SMH_BANK(2)) // 8k paged ROM (4 pages) AM_RANGE(0x8000, 0x917F) AM_READWRITE(screen_ram_r, screen_ram_w) AM_RANGE(0x9180, 0x9FFF) AM_READWRITE(normal_ram_r, normal_ram_w) diff --git a/src/mame/video/bfm_dm01.c b/src/mame/video/bfm_dm01.c index f494fd9d7b6..5854b186ac9 100644 --- a/src/mame/video/bfm_dm01.c +++ b/src/mame/video/bfm_dm01.c @@ -240,7 +240,7 @@ INTERRUPT_GEN( bfm_dm01_vbl ) VIDEO_START( bfm_dm01 ) { - dm_bitmap = auto_bitmap_alloc(DM_BYTESPERROW*8, DM_MAXLINES,video_screen_get_format(machine->primary_screen)); + dm_bitmap = auto_bitmap_alloc(machine, DM_BYTESPERROW*8, DM_MAXLINES,video_screen_get_format(machine->primary_screen)); } /////////////////////////////////////////////////////////////////////////// diff --git a/src/mame/video/bigevglf.c b/src/mame/video/bigevglf.c index 919cd76eba5..a32cf10d842 100644 --- a/src/mame/video/bigevglf.c +++ b/src/mame/video/bigevglf.c @@ -66,7 +66,7 @@ VIDEO_START( bigevglf ) tmp_bitmap[1] = video_screen_auto_bitmap_alloc(machine->primary_screen); tmp_bitmap[2] = video_screen_auto_bitmap_alloc(machine->primary_screen); tmp_bitmap[3] = video_screen_auto_bitmap_alloc(machine->primary_screen); - vidram = auto_malloc(0x100*0x100 * 4); + vidram = auto_alloc_array(machine, UINT8, 0x100*0x100 * 4); } static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) diff --git a/src/mame/video/blktiger.c b/src/mame/video/blktiger.c index 9bc0686e82d..c0e9a27f00a 100644 --- a/src/mame/video/blktiger.c +++ b/src/mame/video/blktiger.c @@ -71,7 +71,7 @@ static TILE_GET_INFO( get_tx_tile_info ) VIDEO_START( blktiger ) { - scroll_ram = auto_malloc(BGRAM_BANK_SIZE * BGRAM_BANKS); + scroll_ram = auto_alloc_array(machine, UINT8, BGRAM_BANK_SIZE * BGRAM_BANKS); tx_tilemap = tilemap_create(machine, get_tx_tile_info,tilemap_scan_rows,8,8,32,32); bg_tilemap8x4 = tilemap_create(machine, get_bg_tile_info,bg8x4_scan, 16,16,128,64); diff --git a/src/mame/video/btime.c b/src/mame/video/btime.c index 3a780848545..c29ec1b7e6d 100644 --- a/src/mame/video/btime.c +++ b/src/mame/video/btime.c @@ -152,7 +152,7 @@ VIDEO_START( bnj ) int width = 256; int height = 256; bitmap_format format = video_screen_get_format(machine->primary_screen); - background_bitmap = auto_bitmap_alloc(2*width, height, format); + background_bitmap = auto_bitmap_alloc(machine, 2*width, height, format); VIDEO_START_CALL(btime); } diff --git a/src/mame/video/bwing.c b/src/mame/video/bwing.c index 5cccd28937f..c54adb48a5d 100644 --- a/src/mame/video/bwing.c +++ b/src/mame/video/bwing.c @@ -189,7 +189,7 @@ VIDEO_START( bwing ) charmap = tilemap_create(machine, get_charinfo,tilemap_scan_cols, 8, 8,32,32); fgmap = tilemap_create(machine, get_fgtileinfo,bwing_scan_cols,16,16,64,64); bgmap = tilemap_create(machine, get_bgtileinfo,bwing_scan_cols,16,16,64,64); - srxlat = auto_malloc(0x8000); + srxlat = auto_alloc_array(machine, int, 0x2000); scrollmap[0] = fgmap; scrollmap[1] = bgmap; diff --git a/src/mame/video/carpolo.c b/src/mame/video/carpolo.c index ccb2a538e18..1b1c7fe3bed 100644 --- a/src/mame/video/carpolo.c +++ b/src/mame/video/carpolo.c @@ -162,13 +162,13 @@ VIDEO_START( carpolo ) { bitmap_format format = video_screen_get_format(machine->primary_screen); - sprite_sprite_collision_bitmap1 = auto_bitmap_alloc(SPRITE_WIDTH*2, SPRITE_HEIGHT*2, format); - sprite_sprite_collision_bitmap2 = auto_bitmap_alloc(SPRITE_WIDTH*2, SPRITE_HEIGHT*2, format); + sprite_sprite_collision_bitmap1 = auto_bitmap_alloc(machine, SPRITE_WIDTH*2, SPRITE_HEIGHT*2, format); + sprite_sprite_collision_bitmap2 = auto_bitmap_alloc(machine, SPRITE_WIDTH*2, SPRITE_HEIGHT*2, format); - sprite_goal_collision_bitmap1 = auto_bitmap_alloc(SPRITE_WIDTH+GOAL_WIDTH, SPRITE_HEIGHT+GOAL_HEIGHT, format); - sprite_goal_collision_bitmap2 = auto_bitmap_alloc(SPRITE_WIDTH+GOAL_WIDTH, SPRITE_HEIGHT+GOAL_HEIGHT, format); + sprite_goal_collision_bitmap1 = auto_bitmap_alloc(machine, SPRITE_WIDTH+GOAL_WIDTH, SPRITE_HEIGHT+GOAL_HEIGHT, format); + sprite_goal_collision_bitmap2 = auto_bitmap_alloc(machine, SPRITE_WIDTH+GOAL_WIDTH, SPRITE_HEIGHT+GOAL_HEIGHT, format); - sprite_border_collision_bitmap = auto_bitmap_alloc(SPRITE_WIDTH, SPRITE_HEIGHT, format); + sprite_border_collision_bitmap = auto_bitmap_alloc(machine, SPRITE_WIDTH, SPRITE_HEIGHT, format); state_save_register_global_bitmap(machine, sprite_sprite_collision_bitmap1); state_save_register_global_bitmap(machine, sprite_sprite_collision_bitmap2); diff --git a/src/mame/video/cave.c b/src/mame/video/cave.c index 1f75ae3dc39..dc5f168fc54 100644 --- a/src/mame/video/cave.c +++ b/src/mame/video/cave.c @@ -144,7 +144,7 @@ PALETTE_INIT( cave ) int pen; /* create a 1:1 palette map covering everything */ - palette_map = auto_malloc(machine->config->total_colors * sizeof(palette_map[0])); + palette_map = auto_alloc_array(machine, UINT16, machine->config->total_colors); for (pen = 0; pen < machine->config->total_colors; pen++) palette_map[pen] = pen % maxpen; } @@ -788,13 +788,12 @@ static void sprite_init_cave(running_machine *machine) cave_spritetype2 = 0; } - sprite_zbuf = auto_bitmap_alloc(screen_width, screen_height, BITMAP_FORMAT_INDEXED16 ); + sprite_zbuf = auto_bitmap_alloc(machine, screen_width, screen_height, BITMAP_FORMAT_INDEXED16 ); blit.baseaddr_zbuf = sprite_zbuf->base; blit.line_offset_zbuf = sprite_zbuf->rowpixels * sprite_zbuf->bpp / 8; num_sprites = spriteram_size / 0x10 / 2; - sprite_cave = auto_malloc( num_sprites * sizeof(struct sprite_cave) ); - memset(sprite_cave, 0, num_sprites * sizeof(struct sprite_cave)); + sprite_cave = auto_alloc_array_clear(machine, struct sprite_cave, num_sprites); memset(sprite_table,0,sizeof(sprite_table)); cave_sprite_draw = sprite_draw_donpachi; diff --git a/src/mame/video/cbasebal.c b/src/mame/video/cbasebal.c index 9716dca24f9..077a15ea13e 100644 --- a/src/mame/video/cbasebal.c +++ b/src/mame/video/cbasebal.c @@ -45,8 +45,8 @@ static TILE_GET_INFO( get_fg_tile_info ) VIDEO_START( cbasebal ) { - cbasebal_textram = auto_malloc(0x1000); - cbasebal_scrollram = auto_malloc(0x1000); + cbasebal_textram = auto_alloc_array(machine, UINT8, 0x1000); + cbasebal_scrollram = auto_alloc_array(machine, UINT8, 0x1000); bg_tilemap = tilemap_create(machine, get_bg_tile_info,tilemap_scan_rows, 16,16,64,32); fg_tilemap = tilemap_create(machine, get_fg_tile_info,tilemap_scan_rows,8,8,64,32); diff --git a/src/mame/video/changela.c b/src/mame/video/changela.c index 8a09bb9d420..902a5a0f286 100644 --- a/src/mame/video/changela.c +++ b/src/mame/video/changela.c @@ -30,8 +30,8 @@ static TIMER_CALLBACK( changela_scanline_callback ); VIDEO_START( changela ) { - memory_devices = auto_malloc(4 * 0x800); /* 0 - not connected, 1,2,3 - RAMs*/ - tree_ram = auto_malloc(2 * 0x20); + memory_devices = auto_alloc_array(machine, UINT8, 4 * 0x800); /* 0 - not connected, 1,2,3 - RAMs*/ + tree_ram = auto_alloc_array(machine, UINT8, 2 * 0x20); obj0_bitmap = video_screen_auto_bitmap_alloc(machine->primary_screen); river_bitmap = video_screen_auto_bitmap_alloc(machine->primary_screen); diff --git a/src/mame/video/cidelsa.c b/src/mame/video/cidelsa.c index 41252ba6e49..365939a03da 100644 --- a/src/mame/video/cidelsa.c +++ b/src/mame/video/cidelsa.c @@ -192,9 +192,9 @@ static void video_start(running_machine *machine, UINT16 pageram_size) cidelsa_state *state = machine->driver_data; /* allocate memory */ - state->pageram = auto_malloc(pageram_size); - state->pcbram = auto_malloc(CIDELSA_CHARRAM_SIZE); - state->charram = auto_malloc(CIDELSA_CHARRAM_SIZE); + state->pageram = auto_alloc_array(machine, UINT8, pageram_size); + state->pcbram = auto_alloc_array(machine, UINT8, CIDELSA_CHARRAM_SIZE); + state->charram = auto_alloc_array(machine, UINT8, CIDELSA_CHARRAM_SIZE); /* find devices */ state->cdp1869 = devtag_get_device(machine, CDP1869_TAG); diff --git a/src/mame/video/cloak.c b/src/mame/video/cloak.c index 0d223a8a591..0dda7c3aa21 100644 --- a/src/mame/video/cloak.c +++ b/src/mame/video/cloak.c @@ -174,9 +174,9 @@ VIDEO_START( cloak ) { bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32); - bitmap_videoram1 = auto_malloc(256*256); - bitmap_videoram2 = auto_malloc(256*256); - palette_ram = auto_malloc(NUM_PENS * sizeof(palette_ram[0])); + bitmap_videoram1 = auto_alloc_array(machine, UINT8, 256*256); + bitmap_videoram2 = auto_alloc_array(machine, UINT8, 256*256); + palette_ram = auto_alloc_array(machine, UINT16, NUM_PENS); set_current_bitmap_videoram_pointer(); diff --git a/src/mame/video/cloud9.c b/src/mame/video/cloud9.c index 5ab1690f438..3274d226f0a 100644 --- a/src/mame/video/cloud9.c +++ b/src/mame/video/cloud9.c @@ -38,7 +38,7 @@ VIDEO_START( cloud9 ) static const int resistances[3] = { 22000, 10000, 4700 }; /* allocate second bank of videoram */ - videoram = auto_malloc(0x8000); + videoram = auto_alloc_array(machine, UINT8, 0x8000); memory_set_bankptr(machine, 1, videoram); /* get pointers to our PROMs */ diff --git a/src/mame/video/combatsc.c b/src/mame/video/combatsc.c index 8b1cdf87cec..728b035f620 100644 --- a/src/mame/video/combatsc.c +++ b/src/mame/video/combatsc.c @@ -264,10 +264,8 @@ VIDEO_START( combasc ) bg_tilemap[1] = tilemap_create(machine, get_tile_info1,tilemap_scan_rows,8,8,32,32); textlayer = tilemap_create(machine, get_text_info, tilemap_scan_rows, 8,8,32,32); - private_spriteram[0] = auto_malloc(0x800); - private_spriteram[1] = auto_malloc(0x800); - memset(private_spriteram[0],0,0x800); - memset(private_spriteram[1],0,0x800); + private_spriteram[0] = auto_alloc_array_clear(machine, UINT8, 0x800); + private_spriteram[1] = auto_alloc_array_clear(machine, UINT8, 0x800); tilemap_set_transparent_pen(bg_tilemap[0],0); tilemap_set_transparent_pen(bg_tilemap[1],0); @@ -284,10 +282,8 @@ VIDEO_START( combascb ) bg_tilemap[1] = tilemap_create(machine, get_tile_info1_bootleg,tilemap_scan_rows,8,8,32,32); textlayer = tilemap_create(machine, get_text_info_bootleg, tilemap_scan_rows,8,8,32,32); - private_spriteram[0] = auto_malloc(0x800); - private_spriteram[1] = auto_malloc(0x800); - memset(private_spriteram[0],0,0x800); - memset(private_spriteram[1],0,0x800); + private_spriteram[0] = auto_alloc_array_clear(machine, UINT8, 0x800); + private_spriteram[1] = auto_alloc_array_clear(machine, UINT8, 0x800); tilemap_set_transparent_pen(bg_tilemap[0],0); tilemap_set_transparent_pen(bg_tilemap[1],0); @@ -423,7 +419,7 @@ WRITE8_HANDLER( combascb_bankselect_w ) } else { - memory_install_readwrite8_handler(space, 0x4000, 0x7fff, 0, 0, SMH_BANK1, SMH_UNMAP); /* banked ROM */ + memory_install_readwrite8_handler(space, 0x4000, 0x7fff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_UNMAP); /* banked ROM */ } } } diff --git a/src/mame/video/contra.c b/src/mame/video/contra.c index 12fcfc41ee7..e2dd0fe1ed8 100644 --- a/src/mame/video/contra.c +++ b/src/mame/video/contra.c @@ -162,8 +162,8 @@ VIDEO_START( contra ) fg_tilemap = tilemap_create(machine, get_fg_tile_info,tilemap_scan_rows,8,8,32,32); tx_tilemap = tilemap_create(machine, get_tx_tile_info,tilemap_scan_rows, 8,8,32,32); - private_spriteram = auto_malloc(0x800); - private_spriteram_2 = auto_malloc(0x800); + private_spriteram = auto_alloc_array(machine, UINT8, 0x800); + private_spriteram_2 = auto_alloc_array(machine, UINT8, 0x800); bg_clip = *video_screen_get_visible_area(machine->primary_screen); bg_clip.min_x += 40; diff --git a/src/mame/video/cps1.c b/src/mame/video/cps1.c index 2f45735f29e..77ba51bf81e 100644 --- a/src/mame/video/cps1.c +++ b/src/mame/video/cps1.c @@ -2055,13 +2055,11 @@ static VIDEO_START( cps ) palette_set_color(machine,i,MAKE_RGB(0,0,0)); } - cps1_buffered_obj = auto_malloc (cps1_obj_size); - memset(cps1_buffered_obj, 0x00, cps1_obj_size); + cps1_buffered_obj = auto_alloc_array_clear(machine, UINT16, cps1_obj_size/2); if (cps_version==2) { - cps2_buffered_obj = auto_malloc (cps2_obj_size); - memset(cps2_buffered_obj, 0x00, cps2_obj_size); + cps2_buffered_obj = auto_alloc_array_clear(machine, UINT16, cps2_obj_size/2); } memset(cps1_gfxram, 0, cps1_gfxram_size); /* Clear GFX RAM */ diff --git a/src/mame/video/crgolf.c b/src/mame/video/crgolf.c index 7b330747753..b2d90551ea6 100644 --- a/src/mame/video/crgolf.c +++ b/src/mame/video/crgolf.c @@ -104,8 +104,8 @@ static void get_pens(running_machine *machine, pen_t *pens) static VIDEO_START( crgolf ) { /* allocate memory for the two bitmaps */ - crgolf_videoram_a = auto_malloc(VIDEORAM_SIZE); - crgolf_videoram_b = auto_malloc(VIDEORAM_SIZE); + crgolf_videoram_a = auto_alloc_array(machine, UINT8, VIDEORAM_SIZE); + crgolf_videoram_b = auto_alloc_array(machine, UINT8, VIDEORAM_SIZE); /* register for save states */ state_save_register_global_pointer(machine, crgolf_videoram_a, VIDEORAM_SIZE); diff --git a/src/mame/video/crimfght.c b/src/mame/video/crimfght.c index f690911fd61..3b164ef91a1 100644 --- a/src/mame/video/crimfght.c +++ b/src/mame/video/crimfght.c @@ -54,7 +54,7 @@ static void sprite_callback(int *code,int *color,int *priority,int *shadow) VIDEO_START( crimfght ) { - paletteram = auto_malloc(0x400); + paletteram = auto_alloc_array(machine, UINT8, 0x400); layer_colorbase[0] = 0; layer_colorbase[1] = 4; diff --git a/src/mame/video/cvs.c b/src/mame/video/cvs.c index aa3a8a08296..61346c2fba4 100644 --- a/src/mame/video/cvs.c +++ b/src/mame/video/cvs.c @@ -186,9 +186,9 @@ VIDEO_START( cvs ) width = video_screen_get_width(machine->primary_screen); height = video_screen_get_height(machine->primary_screen); - s2636_0 = s2636_config(cvs_s2636_0_ram, height, width, CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET); - s2636_1 = s2636_config(cvs_s2636_1_ram, height, width, CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET); - s2636_2 = s2636_config(cvs_s2636_2_ram, height, width, CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET); + s2636_0 = s2636_config(machine, cvs_s2636_0_ram, height, width, CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET); + s2636_1 = s2636_config(machine, cvs_s2636_1_ram, height, width, CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET); + s2636_2 = s2636_config(machine, cvs_s2636_2_ram, height, width, CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET); /* create helper bitmaps */ background_bitmap = video_screen_auto_bitmap_alloc(machine->primary_screen); diff --git a/src/mame/video/darius.c b/src/mame/video/darius.c index 605283f0197..38e161723de 100644 --- a/src/mame/video/darius.c +++ b/src/mame/video/darius.c @@ -42,7 +42,7 @@ VIDEO_START( darius ) { fg_tilemap = tilemap_create(machine, get_fg_tile_info,tilemap_scan_rows,8,8,128,64); - spritelist = auto_malloc(0x800 * sizeof(*spritelist)); + spritelist = auto_alloc_array(machine, struct tempsprite, 0x800); /* (chips, gfxnum, x_offs, y_offs, y_invert, opaque, dblwidth) */ PC080SN_vh_start(machine,1,1,-16,8,0,1,1); diff --git a/src/mame/video/dc.c b/src/mame/video/dc.c index 44be32d2367..9503b9dd73c 100644 --- a/src/mame/video/dc.c +++ b/src/mame/video/dc.c @@ -1454,7 +1454,7 @@ VIDEO_START(dc) timer_adjust_oneshot(endofrender_timer_tsp, attotime_never, 0); timer_adjust_oneshot(endofrender_timer_video, attotime_never, 0); - fakeframebuffer_bitmap = auto_bitmap_alloc(1024,1024,BITMAP_FORMAT_RGB32); + fakeframebuffer_bitmap = auto_bitmap_alloc(machine,1024,1024,BITMAP_FORMAT_RGB32); } diff --git a/src/mame/video/dcheese.c b/src/mame/video/dcheese.c index 6002b67d406..d03ee2414ca 100644 --- a/src/mame/video/dcheese.c +++ b/src/mame/video/dcheese.c @@ -108,7 +108,7 @@ static TIMER_CALLBACK( dcheese_signal_irq_callback ) VIDEO_START( dcheese ) { /* the destination bitmap is not directly accessible to the CPU */ - dstbitmap = auto_bitmap_alloc(DSTBITMAP_WIDTH, DSTBITMAP_HEIGHT, video_screen_get_format(machine->primary_screen)); + dstbitmap = auto_bitmap_alloc(machine, DSTBITMAP_WIDTH, DSTBITMAP_HEIGHT, video_screen_get_format(machine->primary_screen)); /* create a timer */ blitter_timer = timer_alloc(machine, blitter_scanline_callback, NULL); diff --git a/src/mame/video/dec0.c b/src/mame/video/dec0.c index 9e1663bbf07..bc51979f0d5 100644 --- a/src/mame/video/dec0.c +++ b/src/mame/video/dec0.c @@ -712,7 +712,7 @@ VIDEO_START( dec0_nodma ) VIDEO_START( dec0 ) { VIDEO_START_CALL(dec0_nodma); - dec0_spriteram=auto_malloc(0x800); + dec0_spriteram=auto_alloc_array(machine, UINT16, 0x800/2); } /******************************************************************************/ diff --git a/src/mame/video/deco16ic.c b/src/mame/video/deco16ic.c index 51b029e09e3..06ec4d5da9e 100644 --- a/src/mame/video/deco16ic.c +++ b/src/mame/video/deco16ic.c @@ -520,7 +520,7 @@ static void deco16_video_init(running_machine *machine, int pf12_only, int split { int width = video_screen_get_width(machine->primary_screen); int height = video_screen_get_height(machine->primary_screen); - sprite_priority_bitmap = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED8 ); + sprite_priority_bitmap = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED8 ); pf1_tilemap_16x16 = tilemap_create(machine, get_pf1_tile_info, deco16_scan_rows, 16,16,64,32); pf1_tilemap_8x8 = tilemap_create(machine, get_pf1_tile_info_b, tilemap_scan_rows,8,8,64,32); @@ -531,8 +531,8 @@ static void deco16_video_init(running_machine *machine, int pf12_only, int split pf2_tilemap_16x16 = tilemap_create(machine, get_pf2_tile_info, deco16_scan_rows, 16,16,full_width ? 64 : 32,32); pf2_tilemap_8x8 = tilemap_create(machine, get_pf2_tile_info_b, tilemap_scan_rows,8,8,full_width ? 64 : 32,32); - dirty_palette = auto_malloc(4096); - deco16_raster_display_list=auto_malloc(20 * 256); + dirty_palette = auto_alloc_array(machine, UINT8, 4096); + deco16_raster_display_list=auto_alloc_array(machine, UINT16, 20 * 256 / 2); if (!pf12_only) { @@ -602,7 +602,7 @@ void deco_allocate_sprite_bitmap(running_machine *machine) /* Allow sprite bitmap to be used by Deco32 games as well */ int width = video_screen_get_width(machine->primary_screen); int height = video_screen_get_height(machine->primary_screen); - sprite_priority_bitmap = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED16 ); + sprite_priority_bitmap = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16 ); } /*****************************************************************************************/ diff --git a/src/mame/video/deco32.c b/src/mame/video/deco32.c index 8ad581fac69..a1b6d0ff0a9 100644 --- a/src/mame/video/deco32.c +++ b/src/mame/video/deco32.c @@ -974,7 +974,7 @@ VIDEO_START( captaven ) pf1a_tilemap =tilemap_create(machine, get_pf1a_tile_info, deco16_scan_rows,16,16,64,32); pf2_tilemap = tilemap_create(machine, get_pf2_tile_info, deco16_scan_rows,16,16,64,32); pf3_tilemap = tilemap_create(machine, get_ca_pf3_tile_info, tilemap_scan_rows,16,16,32,32); - deco32_raster_display_list=auto_malloc(10 * 256); + deco32_raster_display_list=auto_alloc_array(machine, UINT16, 10 * 256 / 2); memset(deco32_raster_display_list, 0, 10 * 256); tilemap_set_transparent_pen(pf1_tilemap,0); @@ -994,7 +994,7 @@ VIDEO_START( fghthist ) pf3_tilemap = tilemap_create(machine, get_pf3_tile_info, deco16_scan_rows, 16,16,64,32); pf4_tilemap = tilemap_create(machine, get_pf4_tile_info, deco16_scan_rows, 16,16,64,32); pf1a_tilemap =0; - dirty_palette = auto_malloc(4096); + dirty_palette = auto_alloc_array(machine, UINT8, 4096); deco_allocate_sprite_bitmap(machine); @@ -1014,8 +1014,8 @@ VIDEO_START( dragngun ) pf3_tilemap = tilemap_create(machine, get_ll_pf3_tile_info, deco16_scan_rows,16,16,64,32); pf4_tilemap = tilemap_create(machine, get_ll_pf4_tile_info, deco16_scan_rows, 16,16,64,32); pf1a_tilemap =tilemap_create(machine, get_pf1a_tile_info, deco16_scan_rows,16,16,64,32); - dirty_palette = auto_malloc(4096); - deco32_raster_display_list = auto_malloc(10 * 256); + dirty_palette = auto_alloc_array(machine, UINT8, 4096); + deco32_raster_display_list = auto_alloc_array(machine, UINT16, 10 * 256 / 2); tilemap_set_transparent_pen(pf1_tilemap,0); tilemap_set_transparent_pen(pf2_tilemap,0); @@ -1036,8 +1036,8 @@ VIDEO_START( lockload ) pf3_tilemap = tilemap_create(machine, get_ll_pf3_tile_info, deco16_scan_rows,16,16,32,32); pf4_tilemap = tilemap_create(machine, get_ll_pf4_tile_info, deco16_scan_rows, 16,16,32,32); pf1a_tilemap =tilemap_create(machine, get_pf1a_tile_info, deco16_scan_rows,16,16,64,32); - dirty_palette = auto_malloc(4096); - deco32_raster_display_list = auto_malloc(10 * 256); + dirty_palette = auto_alloc_array(machine, UINT8, 4096); + deco32_raster_display_list = auto_alloc_array(machine, UINT16, 10 * 256 / 2); memset(deco32_raster_display_list, 0, 10 * 256); tilemap_set_transparent_pen(pf1_tilemap,0); @@ -1061,13 +1061,13 @@ VIDEO_START( nslasher ) pf3_tilemap = tilemap_create(machine, get_pf3_tile_info, deco16_scan_rows,16,16,64,32); pf4_tilemap = tilemap_create(machine, get_pf4_tile_info, deco16_scan_rows, 16,16,64,32); pf1a_tilemap =0; - dirty_palette = auto_malloc(4096); + dirty_palette = auto_alloc_array(machine, UINT8, 4096); width = video_screen_get_width(machine->primary_screen); height = video_screen_get_height(machine->primary_screen); - sprite0_mix_bitmap=auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED16 ); - sprite1_mix_bitmap=auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED16 ); - tilemap_alpha_bitmap=auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED16 ); + sprite0_mix_bitmap=auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16 ); + sprite1_mix_bitmap=auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16 ); + tilemap_alpha_bitmap=auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16 ); tilemap_set_transparent_pen(pf1_tilemap,0); tilemap_set_transparent_pen(pf2_tilemap,0); diff --git a/src/mame/video/deco_mlc.c b/src/mame/video/deco_mlc.c index 2dde34861a3..d3ecb32c9ab 100644 --- a/src/mame/video/deco_mlc.c +++ b/src/mame/video/deco_mlc.c @@ -27,8 +27,8 @@ VIDEO_START( mlc ) else colour_mask=0x1f; -// temp_bitmap = auto_bitmap_alloc( 512, 512, BITMAP_FORMAT_RGB32 ); - mlc_buffered_spriteram = auto_malloc(0x3000); +// temp_bitmap = auto_bitmap_alloc( machine, 512, 512, BITMAP_FORMAT_RGB32 ); + mlc_buffered_spriteram = auto_alloc_array(machine, UINT32, 0x3000/4); } #ifdef UNUSED_FUNCTION diff --git a/src/mame/video/dogfgt.c b/src/mame/video/dogfgt.c index c5554e6599f..0a1c5426d07 100644 --- a/src/mame/video/dogfgt.c +++ b/src/mame/video/dogfgt.c @@ -83,7 +83,7 @@ VIDEO_START( dogfgt ) { bg_tilemap = tilemap_create(machine, get_tile_info,tilemap_scan_rows,16,16,32,32); - bitmapram = auto_malloc(BITMAPRAM_SIZE); + bitmapram = auto_alloc_array(machine, UINT8, BITMAPRAM_SIZE); pixbitmap = video_screen_auto_bitmap_alloc(machine->primary_screen); } diff --git a/src/mame/video/drmicro.c b/src/mame/video/drmicro.c index d0baebde7ee..1135753d5f9 100644 --- a/src/mame/video/drmicro.c +++ b/src/mame/video/drmicro.c @@ -112,7 +112,7 @@ PALETTE_INIT( drmicro ) VIDEO_START( drmicro) { - drmicro_videoram = auto_malloc(0x1000); + drmicro_videoram = auto_alloc_array(machine, UINT8, 0x1000); drmicro_bg1 = tilemap_create(machine, get_bg1_tile_info, tilemap_scan_rows, 8,8,32,32); drmicro_bg2 = tilemap_create(machine, get_bg2_tile_info, tilemap_scan_rows, 8,8,32,32); diff --git a/src/mame/video/dynax.c b/src/mame/video/dynax.c index 0b033d14b94..a4bd480efe0 100644 --- a/src/mame/video/dynax.c +++ b/src/mame/video/dynax.c @@ -746,14 +746,14 @@ static void Video_Reset(void) VIDEO_START( hanamai ) { - dynax_pixmap[0][0] = auto_malloc(256*256); - dynax_pixmap[0][1] = auto_malloc(256*256); - dynax_pixmap[1][0] = auto_malloc(256*256); - dynax_pixmap[1][1] = auto_malloc(256*256); - dynax_pixmap[2][0] = auto_malloc(256*256); - dynax_pixmap[2][1] = auto_malloc(256*256); - dynax_pixmap[3][0] = auto_malloc(256*256); - dynax_pixmap[3][1] = auto_malloc(256*256); + dynax_pixmap[0][0] = auto_alloc_array(machine, UINT8, 256*256); + dynax_pixmap[0][1] = auto_alloc_array(machine, UINT8, 256*256); + dynax_pixmap[1][0] = auto_alloc_array(machine, UINT8, 256*256); + dynax_pixmap[1][1] = auto_alloc_array(machine, UINT8, 256*256); + dynax_pixmap[2][0] = auto_alloc_array(machine, UINT8, 256*256); + dynax_pixmap[2][1] = auto_alloc_array(machine, UINT8, 256*256); + dynax_pixmap[3][0] = auto_alloc_array(machine, UINT8, 256*256); + dynax_pixmap[3][1] = auto_alloc_array(machine, UINT8, 256*256); Video_Reset(); layer_layout = LAYOUT_HANAMAI; @@ -761,14 +761,14 @@ VIDEO_START( hanamai ) VIDEO_START( hnoridur ) { - dynax_pixmap[0][0] = auto_malloc(256*256); - dynax_pixmap[0][1] = auto_malloc(256*256); - dynax_pixmap[1][0] = auto_malloc(256*256); - dynax_pixmap[1][1] = auto_malloc(256*256); - dynax_pixmap[2][0] = auto_malloc(256*256); - dynax_pixmap[2][1] = auto_malloc(256*256); - dynax_pixmap[3][0] = auto_malloc(256*256); - dynax_pixmap[3][1] = auto_malloc(256*256); + dynax_pixmap[0][0] = auto_alloc_array(machine, UINT8, 256*256); + dynax_pixmap[0][1] = auto_alloc_array(machine, UINT8, 256*256); + dynax_pixmap[1][0] = auto_alloc_array(machine, UINT8, 256*256); + dynax_pixmap[1][1] = auto_alloc_array(machine, UINT8, 256*256); + dynax_pixmap[2][0] = auto_alloc_array(machine, UINT8, 256*256); + dynax_pixmap[2][1] = auto_alloc_array(machine, UINT8, 256*256); + dynax_pixmap[3][0] = auto_alloc_array(machine, UINT8, 256*256); + dynax_pixmap[3][1] = auto_alloc_array(machine, UINT8, 256*256); Video_Reset(); layer_layout = LAYOUT_HNORIDUR; @@ -784,12 +784,12 @@ VIDEO_START( mcnpshnt ) VIDEO_START( sprtmtch ) { - dynax_pixmap[0][0] = auto_malloc(256*256); - dynax_pixmap[0][1] = auto_malloc(256*256); - dynax_pixmap[1][0] = auto_malloc(256*256); - dynax_pixmap[1][1] = auto_malloc(256*256); - dynax_pixmap[2][0] = auto_malloc(256*256); - dynax_pixmap[2][1] = auto_malloc(256*256); + dynax_pixmap[0][0] = auto_alloc_array(machine, UINT8, 256*256); + dynax_pixmap[0][1] = auto_alloc_array(machine, UINT8, 256*256); + dynax_pixmap[1][0] = auto_alloc_array(machine, UINT8, 256*256); + dynax_pixmap[1][1] = auto_alloc_array(machine, UINT8, 256*256); + dynax_pixmap[2][0] = auto_alloc_array(machine, UINT8, 256*256); + dynax_pixmap[2][1] = auto_alloc_array(machine, UINT8, 256*256); Video_Reset(); layer_layout = LAYOUT_DRGPUNCH; @@ -797,22 +797,22 @@ VIDEO_START( sprtmtch ) VIDEO_START( jantouki ) { - dynax_pixmap[0][0] = auto_malloc(256*256); - dynax_pixmap[0][1] = auto_malloc(256*256); - dynax_pixmap[1][0] = auto_malloc(256*256); - dynax_pixmap[1][1] = auto_malloc(256*256); - dynax_pixmap[2][0] = auto_malloc(256*256); - dynax_pixmap[2][1] = auto_malloc(256*256); - dynax_pixmap[3][0] = auto_malloc(256*256); - dynax_pixmap[3][1] = auto_malloc(256*256); - dynax_pixmap[4][0] = auto_malloc(256*256); - dynax_pixmap[4][1] = auto_malloc(256*256); - dynax_pixmap[5][0] = auto_malloc(256*256); - dynax_pixmap[5][1] = auto_malloc(256*256); - dynax_pixmap[6][0] = auto_malloc(256*256); - dynax_pixmap[6][1] = auto_malloc(256*256); - dynax_pixmap[7][0] = auto_malloc(256*256); - dynax_pixmap[7][1] = auto_malloc(256*256); + dynax_pixmap[0][0] = auto_alloc_array(machine, UINT8, 256*256); + dynax_pixmap[0][1] = auto_alloc_array(machine, UINT8, 256*256); + dynax_pixmap[1][0] = auto_alloc_array(machine, UINT8, 256*256); + dynax_pixmap[1][1] = auto_alloc_array(machine, UINT8, 256*256); + dynax_pixmap[2][0] = auto_alloc_array(machine, UINT8, 256*256); + dynax_pixmap[2][1] = auto_alloc_array(machine, UINT8, 256*256); + dynax_pixmap[3][0] = auto_alloc_array(machine, UINT8, 256*256); + dynax_pixmap[3][1] = auto_alloc_array(machine, UINT8, 256*256); + dynax_pixmap[4][0] = auto_alloc_array(machine, UINT8, 256*256); + dynax_pixmap[4][1] = auto_alloc_array(machine, UINT8, 256*256); + dynax_pixmap[5][0] = auto_alloc_array(machine, UINT8, 256*256); + dynax_pixmap[5][1] = auto_alloc_array(machine, UINT8, 256*256); + dynax_pixmap[6][0] = auto_alloc_array(machine, UINT8, 256*256); + dynax_pixmap[6][1] = auto_alloc_array(machine, UINT8, 256*256); + dynax_pixmap[7][0] = auto_alloc_array(machine, UINT8, 256*256); + dynax_pixmap[7][1] = auto_alloc_array(machine, UINT8, 256*256); Video_Reset(); layer_layout = LAYOUT_JANTOUKI; @@ -822,8 +822,8 @@ VIDEO_START( jantouki ) VIDEO_START( mjdialq2 ) { - dynax_pixmap[0][0] = auto_malloc(256*256); - dynax_pixmap[1][0] = auto_malloc(256*256); + dynax_pixmap[0][0] = auto_alloc_array(machine, UINT8, 256*256); + dynax_pixmap[1][0] = auto_alloc_array(machine, UINT8, 256*256); Video_Reset(); layer_layout = LAYOUT_MJDIALQ2; diff --git a/src/mame/video/eolith.c b/src/mame/video/eolith.c index e5f0319aa55..ec9a6b70eed 100644 --- a/src/mame/video/eolith.c +++ b/src/mame/video/eolith.c @@ -30,7 +30,7 @@ READ32_HANDLER( eolith_vram_r ) VIDEO_START( eolith ) { - vram = auto_malloc(0x40000*2); + vram = auto_alloc_array(machine, UINT32, 0x40000*2/4); } VIDEO_UPDATE( eolith ) diff --git a/src/mame/video/equites.c b/src/mame/video/equites.c index 395c88f235f..dba04c93d26 100644 --- a/src/mame/video/equites.c +++ b/src/mame/video/equites.c @@ -121,7 +121,7 @@ static TILE_GET_INFO( splndrbt_bg_info ) VIDEO_START( equites ) { - equites_fg_videoram = (UINT8 *)auto_malloc(0x800); + equites_fg_videoram = auto_alloc_array(machine, UINT8, 0x800); fg_tilemap = tilemap_create(machine, equites_fg_info, tilemap_scan_cols, 8, 8, 32, 32); tilemap_set_transparent_pen(fg_tilemap, 0); @@ -135,7 +135,7 @@ VIDEO_START( splndrbt ) { assert(video_screen_get_format(machine->primary_screen) == BITMAP_FORMAT_INDEXED16); - equites_fg_videoram = (UINT8 *)auto_malloc(0x800); + equites_fg_videoram = auto_alloc_array(machine, UINT8, 0x800); fg_tilemap = tilemap_create(machine, splndrbt_fg_info, tilemap_scan_cols, 8, 8, 32, 32); tilemap_set_transparent_pen(fg_tilemap, 0); diff --git a/src/mame/video/esripsys.c b/src/mame/video/esripsys.c index 6362bfde03e..2812d280140 100644 --- a/src/mame/video/esripsys.c +++ b/src/mame/video/esripsys.c @@ -95,13 +95,13 @@ VIDEO_START( esripsys ) int i; /* Allocate memory for the two 512-pixel line buffers */ - line_buffer[0].colour_buf = auto_malloc(512); - line_buffer[0].intensity_buf = auto_malloc(512); - line_buffer[0].priority_buf = auto_malloc(512); + line_buffer[0].colour_buf = auto_alloc_array(machine, UINT8, 512); + line_buffer[0].intensity_buf = auto_alloc_array(machine, UINT8, 512); + line_buffer[0].priority_buf = auto_alloc_array(machine, UINT8, 512); - line_buffer[1].colour_buf = auto_malloc(512); - line_buffer[1].intensity_buf = auto_malloc(512); - line_buffer[1].priority_buf = auto_malloc(512); + line_buffer[1].colour_buf = auto_alloc_array(machine, UINT8, 512); + line_buffer[1].intensity_buf = auto_alloc_array(machine, UINT8, 512); + line_buffer[1].priority_buf = auto_alloc_array(machine, UINT8, 512); /* Create and initialise the HBLANK timers */ hblank_start_timer = timer_alloc(machine, hblank_start_callback, NULL); @@ -109,7 +109,7 @@ VIDEO_START( esripsys ) timer_adjust_oneshot(hblank_start_timer, video_screen_get_time_until_pos(machine->primary_screen, 0, ESRIPSYS_HBLANK_START), 0); /* Create the sprite scaling table */ - scale_table = auto_malloc(64 * 64); + scale_table = auto_alloc_array(machine, UINT8, 64 * 64); for (i = 0; i < 64; ++i) { @@ -142,7 +142,7 @@ VIDEO_START( esripsys ) } /* Now create a lookup table for scaling the sprite 'fig' value */ - fig_scale_table = auto_malloc(1024 * 64); + fig_scale_table = auto_alloc_array(machine, UINT8, 1024 * 64); for (i = 0; i < 1024; ++i) { diff --git a/src/mame/video/exerion.c b/src/mame/video/exerion.c index a9ee00bc3a1..141987b94dd 100644 --- a/src/mame/video/exerion.c +++ b/src/mame/video/exerion.c @@ -123,7 +123,7 @@ VIDEO_START( exerion ) background_mixer = memory_region(machine, "proms") + 0x320; /* allocate memory for the decoded background graphics */ - background_gfx[0] = auto_malloc(2 * 256 * 256 * 4); + background_gfx[0] = auto_alloc_array(machine, UINT16, 256 * 256 * 4); background_gfx[1] = background_gfx[0] + 256 * 256; background_gfx[2] = background_gfx[1] + 256 * 256; background_gfx[3] = background_gfx[2] + 256 * 256; diff --git a/src/mame/video/exidy.c b/src/mame/video/exidy.c index b6cf0b9c0bd..c9f11a876f4 100644 --- a/src/mame/video/exidy.c +++ b/src/mame/video/exidy.c @@ -57,9 +57,9 @@ VIDEO_START( exidy ) bitmap_format format = video_screen_get_format(machine->primary_screen); background_bitmap = video_screen_auto_bitmap_alloc(machine->primary_screen); - motion_object_1_vid = auto_bitmap_alloc(16, 16, format); - motion_object_2_vid = auto_bitmap_alloc(16, 16, format); - motion_object_2_clip = auto_bitmap_alloc(16, 16, format); + motion_object_1_vid = auto_bitmap_alloc(machine, 16, 16, format); + motion_object_2_vid = auto_bitmap_alloc(machine, 16, 16, format); + motion_object_2_clip = auto_bitmap_alloc(machine, 16, 16, format); state_save_register_global(machine, collision_mask); state_save_register_global(machine, collision_invert); diff --git a/src/mame/video/exidy440.c b/src/mame/video/exidy440.c index bd7afbc9e5c..ad94382fca8 100644 --- a/src/mame/video/exidy440.c +++ b/src/mame/video/exidy440.c @@ -66,11 +66,11 @@ static VIDEO_START( exidy440 ) exidy440_firq_beam = 0; /* allocate a buffer for VRAM */ - local_videoram = auto_malloc(256 * 256 * 2); + local_videoram = auto_alloc_array(machine, UINT8, 256 * 256 * 2); memset(local_videoram, 0, 256 * 256 * 2); /* allocate a buffer for palette RAM */ - local_paletteram = auto_malloc(512 * 2); + local_paletteram = auto_alloc_array(machine, UINT8, 512 * 2); memset(local_paletteram, 0, 512 * 2); } diff --git a/src/mame/video/flstory.c b/src/mame/video/flstory.c index a4c086f33db..ab4cce28743 100644 --- a/src/mame/video/flstory.c +++ b/src/mame/video/flstory.c @@ -53,8 +53,8 @@ VIDEO_START( flstory ) tilemap_set_transmask(bg_tilemap,1,0x8000,0x7fff); /* split type 1 has pen 15 transparent in front half */ tilemap_set_scroll_cols(bg_tilemap,32); - paletteram = auto_malloc(0x200); - paletteram_2 = auto_malloc(0x200); + paletteram = auto_alloc_array(machine, UINT8, 0x200); + paletteram_2 = auto_alloc_array(machine, UINT8, 0x200); } VIDEO_START( victnine ) @@ -62,8 +62,8 @@ VIDEO_START( victnine ) bg_tilemap = tilemap_create( machine, victnine_get_tile_info,tilemap_scan_rows,8,8,32,32 ); tilemap_set_scroll_cols(bg_tilemap,32); - paletteram = auto_malloc(0x200); - paletteram_2 = auto_malloc(0x200); + paletteram = auto_alloc_array(machine, UINT8, 0x200); + paletteram_2 = auto_alloc_array(machine, UINT8, 0x200); } WRITE8_HANDLER( flstory_videoram_w ) diff --git a/src/mame/video/fromanc2.c b/src/mame/video/fromanc2.c index b12ec804850..0714b468c88 100644 --- a/src/mame/video/fromanc2.c +++ b/src/mame/video/fromanc2.c @@ -380,17 +380,17 @@ VIDEO_START( fromanc2 ) fromanc2_tilemap[1][2] = tilemap_create(machine, fromanc2_get_v1_l2_tile_info, tilemap_scan_rows, 8, 8, 64, 64); fromanc2_tilemap[1][3] = tilemap_create(machine, fromanc2_get_v1_l3_tile_info, tilemap_scan_rows, 8, 8, 64, 64); - fromanc2_videoram[0][0] = auto_malloc((64 * 64) * sizeof(UINT16)); - fromanc2_videoram[0][1] = auto_malloc((64 * 64) * sizeof(UINT16)); - fromanc2_videoram[0][2] = auto_malloc((64 * 64) * sizeof(UINT16)); - fromanc2_videoram[0][3] = auto_malloc((64 * 64) * sizeof(UINT16)); - fromanc2_videoram[1][0] = auto_malloc((64 * 64) * sizeof(UINT16)); - fromanc2_videoram[1][1] = auto_malloc((64 * 64) * sizeof(UINT16)); - fromanc2_videoram[1][2] = auto_malloc((64 * 64) * sizeof(UINT16)); - fromanc2_videoram[1][3] = auto_malloc((64 * 64) * sizeof(UINT16)); - - fromanc2_paletteram[0] = auto_malloc(0x800 * 2); - fromanc2_paletteram[1] = auto_malloc(0x800 * 2); + fromanc2_videoram[0][0] = auto_alloc_array(machine, UINT16, (64 * 64)); + fromanc2_videoram[0][1] = auto_alloc_array(machine, UINT16, (64 * 64)); + fromanc2_videoram[0][2] = auto_alloc_array(machine, UINT16, (64 * 64)); + fromanc2_videoram[0][3] = auto_alloc_array(machine, UINT16, (64 * 64)); + fromanc2_videoram[1][0] = auto_alloc_array(machine, UINT16, (64 * 64)); + fromanc2_videoram[1][1] = auto_alloc_array(machine, UINT16, (64 * 64)); + fromanc2_videoram[1][2] = auto_alloc_array(machine, UINT16, (64 * 64)); + fromanc2_videoram[1][3] = auto_alloc_array(machine, UINT16, (64 * 64)); + + fromanc2_paletteram[0] = auto_alloc_array(machine, UINT16, 0x800); + fromanc2_paletteram[1] = auto_alloc_array(machine, UINT16, 0x800); tilemap_set_transparent_pen(fromanc2_tilemap[0][1], 0x000); tilemap_set_transparent_pen(fromanc2_tilemap[0][2], 0x000); @@ -411,15 +411,15 @@ VIDEO_START( fromancr ) fromanc2_tilemap[1][2] = tilemap_create(machine, fromancr_get_v1_l2_tile_info, tilemap_scan_rows, 8, 8, 64, 64); fromanc2_tilemap[1][3] = 0; - fromanc2_videoram[0][0] = auto_malloc((64 * 64) * sizeof(UINT16)); - fromanc2_videoram[0][1] = auto_malloc((64 * 64) * sizeof(UINT16)); - fromanc2_videoram[0][2] = auto_malloc((64 * 64) * sizeof(UINT16)); - fromanc2_videoram[1][0] = auto_malloc((64 * 64) * sizeof(UINT16)); - fromanc2_videoram[1][1] = auto_malloc((64 * 64) * sizeof(UINT16)); - fromanc2_videoram[1][2] = auto_malloc((64 * 64) * sizeof(UINT16)); + fromanc2_videoram[0][0] = auto_alloc_array(machine, UINT16, (64 * 64)); + fromanc2_videoram[0][1] = auto_alloc_array(machine, UINT16, (64 * 64)); + fromanc2_videoram[0][2] = auto_alloc_array(machine, UINT16, (64 * 64)); + fromanc2_videoram[1][0] = auto_alloc_array(machine, UINT16, (64 * 64)); + fromanc2_videoram[1][1] = auto_alloc_array(machine, UINT16, (64 * 64)); + fromanc2_videoram[1][2] = auto_alloc_array(machine, UINT16, (64 * 64)); - fromanc2_paletteram[0] = auto_malloc(0x800 * 2); - fromanc2_paletteram[1] = auto_malloc(0x800 * 2); + fromanc2_paletteram[0] = auto_alloc_array(machine, UINT16, 0x800); + fromanc2_paletteram[1] = auto_alloc_array(machine, UINT16, 0x800); tilemap_set_transparent_pen(fromanc2_tilemap[0][1], 0x0ff); tilemap_set_transparent_pen(fromanc2_tilemap[0][2], 0x0ff); @@ -439,15 +439,15 @@ VIDEO_START( fromanc4 ) fromanc2_tilemap[1][2] = tilemap_create(machine, fromancr_get_v1_l2_tile_info, tilemap_scan_rows, 8, 8, 256, 64); fromanc2_tilemap[1][3] = 0; - fromanc2_videoram[0][0] = auto_malloc((256 * 64) * sizeof(UINT16)); - fromanc2_videoram[0][1] = auto_malloc((256 * 64) * sizeof(UINT16)); - fromanc2_videoram[0][2] = auto_malloc((256 * 64) * sizeof(UINT16)); - fromanc2_videoram[1][0] = auto_malloc((256 * 64) * sizeof(UINT16)); - fromanc2_videoram[1][1] = auto_malloc((256 * 64) * sizeof(UINT16)); - fromanc2_videoram[1][2] = auto_malloc((256 * 64) * sizeof(UINT16)); + fromanc2_videoram[0][0] = auto_alloc_array(machine, UINT16, (256 * 64)); + fromanc2_videoram[0][1] = auto_alloc_array(machine, UINT16, (256 * 64)); + fromanc2_videoram[0][2] = auto_alloc_array(machine, UINT16, (256 * 64)); + fromanc2_videoram[1][0] = auto_alloc_array(machine, UINT16, (256 * 64)); + fromanc2_videoram[1][1] = auto_alloc_array(machine, UINT16, (256 * 64)); + fromanc2_videoram[1][2] = auto_alloc_array(machine, UINT16, (256 * 64)); - fromanc2_paletteram[0] = auto_malloc(0x800 * 2); - fromanc2_paletteram[1] = auto_malloc(0x800 * 2); + fromanc2_paletteram[0] = auto_alloc_array(machine, UINT16, 0x800); + fromanc2_paletteram[1] = auto_alloc_array(machine, UINT16, 0x800); tilemap_set_transparent_pen(fromanc2_tilemap[0][1], 0x000); tilemap_set_transparent_pen(fromanc2_tilemap[0][2], 0x000); diff --git a/src/mame/video/fromance.c b/src/mame/video/fromance.c index 5d81f617074..1c951f23c09 100644 --- a/src/mame/video/fromance.c +++ b/src/mame/video/fromance.c @@ -78,11 +78,11 @@ static void init_common(running_machine *machine) flipscreen_old = -1; /* allocate local videoram */ - local_videoram[0] = auto_malloc(0x1000 * 3); - local_videoram[1] = auto_malloc(0x1000 * 3); + local_videoram[0] = auto_alloc_array(machine, UINT8, 0x1000 * 3); + local_videoram[1] = auto_alloc_array(machine, UINT8, 0x1000 * 3); /* allocate local palette RAM */ - local_paletteram = auto_malloc(0x800 * 2); + local_paletteram = auto_alloc_array(machine, UINT8, 0x800 * 2); /* configure tilemaps */ tilemap_set_transparent_pen(fg_tilemap,15); diff --git a/src/mame/video/fuukifg3.c b/src/mame/video/fuukifg3.c index 6cbff95dabe..671ffbc3792 100644 --- a/src/mame/video/fuukifg3.c +++ b/src/mame/video/fuukifg3.c @@ -106,8 +106,8 @@ LAYER_4BPP( 3 ) VIDEO_START( fuuki32 ) { - buffered_spriteram32 = auto_malloc(spriteram_size); - buffered_spriteram32_2 = auto_malloc(spriteram_size); + buffered_spriteram32 = auto_alloc_array(machine, UINT32, spriteram_size/4); + buffered_spriteram32_2 = auto_alloc_array(machine, UINT32, spriteram_size/4); tilemap_0 = tilemap_create( machine, get_tile_info_0, tilemap_scan_rows, 16, 16, 64,32); diff --git a/src/mame/video/gaelco3d.c b/src/mame/video/gaelco3d.c index 282919946a8..a10208ad16d 100644 --- a/src/mame/video/gaelco3d.c +++ b/src/mame/video/gaelco3d.c @@ -83,10 +83,10 @@ VIDEO_START( gaelco3d ) width = video_screen_get_width(machine->primary_screen); height = video_screen_get_height(machine->primary_screen); - zbuffer = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED16); + zbuffer = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16); - palette = auto_malloc(32768 * sizeof(palette[0])); - polydata_buffer = auto_malloc(MAX_POLYDATA * sizeof(polydata_buffer[0])); + palette = auto_alloc_array(machine, rgb_t, 32768); + polydata_buffer = auto_alloc_array(machine, UINT32, MAX_POLYDATA); /* save states */ diff --git a/src/mame/video/gaiden.c b/src/mame/video/gaiden.c index b3c5fe5cb9a..5d4174efabb 100644 --- a/src/mame/video/gaiden.c +++ b/src/mame/video/gaiden.c @@ -92,8 +92,8 @@ VIDEO_START( raiga ) int height = video_screen_get_height(machine->primary_screen); /* set up tile layers */ - tile_bitmap_bg = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED16); - tile_bitmap_fg = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED16); + tile_bitmap_bg = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16); + tile_bitmap_fg = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16); background = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows,16,16,64,32); foreground = tilemap_create(machine, get_fg_tile_info_raiga,tilemap_scan_rows,16,16,64,32); @@ -104,7 +104,7 @@ VIDEO_START( raiga ) tilemap_set_transparent_pen(text_layer,0); /* set up sprites */ - sprite_bitmap = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED16); + sprite_bitmap = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16); } VIDEO_START( drgnbowl ) diff --git a/src/mame/video/galastrm.c b/src/mame/video/galastrm.c index 76fa899ca7b..a77aa60253b 100644 --- a/src/mame/video/galastrm.c +++ b/src/mame/video/galastrm.c @@ -45,7 +45,7 @@ static void galastrm_exit(running_machine *machine) VIDEO_START( galastrm ) { - spritelist = auto_malloc(0x4000 * sizeof(*spritelist)); + spritelist = auto_alloc_array(machine, struct tempsprite, 0x4000); TC0100SCN_vh_start(machine,1,TC0100SCN_GFX_NUM,48-X_OFFSET,4-Y_OFFSET,0,0,0,0,0); TC0480SCP_vh_start(machine,TC0480SCP_GFX_NUM,0,56-X_OFFSET,-63+Y_OFFSET,0,0,0,0,0); diff --git a/src/mame/video/galaxian.c b/src/mame/video/galaxian.c index dbb0bcd5442..a160221babf 100644 --- a/src/mame/video/galaxian.c +++ b/src/mame/video/galaxian.c @@ -290,7 +290,7 @@ static TILE_GET_INFO( bg_get_tile_info ); static void sprites_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, const UINT8 *spritebase); -static void stars_init(void); +static void stars_init(running_machine *machine); static void stars_update_origin(running_machine *machine); static void stars_draw_row(bitmap_t *bitmap, int maxx, int y, UINT32 star_offs, UINT8 starmask); @@ -468,7 +468,7 @@ VIDEO_START( galaxian ) background_green = 0; /* initialize stars */ - stars_init(); + stars_init(machine); /* register for save states */ state_save_register(machine); @@ -810,7 +810,7 @@ WRITE8_HANDLER( galaxian_gfxbank_w ) * *************************************/ -static void stars_init(void) +static void stars_init(running_machine *machine) { UINT32 shiftreg; int i; @@ -820,7 +820,7 @@ static void stars_init(void) stars_blink_state = 0; /* precalculate the RNG */ - stars = auto_malloc(STAR_RNG_PERIOD); + stars = auto_alloc_array(machine, UINT8, STAR_RNG_PERIOD); shiftreg = 0; for (i = 0; i < STAR_RNG_PERIOD; i++) { diff --git a/src/mame/video/galaxold.c b/src/mame/video/galaxold.c index 734245b270d..9e52464b65a 100644 --- a/src/mame/video/galaxold.c +++ b/src/mame/video/galaxold.c @@ -924,7 +924,7 @@ VIDEO_START( dambustr ) dambustr_tmpbitmap = video_screen_auto_bitmap_alloc(machine->primary_screen); /* make a copy of the tilemap to emulate background priority */ - dambustr_videoram2 = auto_malloc(0x0400); + dambustr_videoram2 = auto_alloc_array(machine, UINT8, 0x0400); dambustr_tilemap2 = tilemap_create(machine, dambustr_get_tile_info2,tilemap_scan_rows,8,8,32,32); tilemap_set_transparent_pen(dambustr_tilemap2,0); diff --git a/src/mame/video/galpani2.c b/src/mame/video/galpani2.c index 6c8c2c24cc1..a21eaa14d27 100644 --- a/src/mame/video/galpani2.c +++ b/src/mame/video/galpani2.c @@ -131,9 +131,9 @@ PALETTE_INIT( galpani2 ) VIDEO_START( galpani2 ) { - galpani2_bg15_bitmap = auto_bitmap_alloc(256*8, 256, BITMAP_FORMAT_INDEXED16); - galpani2_bg8_bitmap_0 = auto_bitmap_alloc(512, 256, BITMAP_FORMAT_INDEXED16); - galpani2_bg8_bitmap_1 = auto_bitmap_alloc(512, 256, BITMAP_FORMAT_INDEXED16); + galpani2_bg15_bitmap = auto_bitmap_alloc(machine, 256*8, 256, BITMAP_FORMAT_INDEXED16); + galpani2_bg8_bitmap_0 = auto_bitmap_alloc(machine, 512, 256, BITMAP_FORMAT_INDEXED16); + galpani2_bg8_bitmap_1 = auto_bitmap_alloc(machine, 512, 256, BITMAP_FORMAT_INDEXED16); VIDEO_START_CALL(kaneko16_sprites); } diff --git a/src/mame/video/gameplan.c b/src/mame/video/gameplan.c index aada6291769..562f242eb45 100644 --- a/src/mame/video/gameplan.c +++ b/src/mame/video/gameplan.c @@ -303,7 +303,7 @@ static VIDEO_START( common ) gameplan_state *state = machine->driver_data; state->videoram_size = (HBSTART - HBEND) * (VBSTART - VBEND); - state->videoram = auto_malloc(state->videoram_size); + state->videoram = auto_alloc_array(machine, UINT8, state->videoram_size); create_via_0_timer(machine, state); diff --git a/src/mame/video/genesis.c b/src/mame/video/genesis.c index 6296b7e55b0..c4eb0144b75 100644 --- a/src/mame/video/genesis.c +++ b/src/mame/video/genesis.c @@ -134,9 +134,9 @@ static void start_genesis_vdp(const device_config *screen) genesis_screen = screen; /* allocate memory for the VDP, the lookup table, and the buffer bitmap */ - vdp_vram = auto_malloc(VRAM_SIZE); - vdp_vsram = auto_malloc(VSRAM_SIZE); - transparent_lookup = auto_malloc(0x1000 * sizeof(UINT16)); + vdp_vram = auto_alloc_array(screen->machine, UINT8, VRAM_SIZE); + vdp_vsram = auto_alloc_array(screen->machine, UINT8, VSRAM_SIZE); + transparent_lookup = auto_alloc_array(screen->machine, UINT16, 0x1000); /* clear the VDP memory, prevents corrupt tile in Puyo Puyo 2 */ memset(vdp_vram, 0, VRAM_SIZE); diff --git a/src/mame/video/glass.c b/src/mame/video/glass.c index 2ca9fd70aab..8212daf1272 100644 --- a/src/mame/video/glass.c +++ b/src/mame/video/glass.c @@ -133,7 +133,7 @@ VIDEO_START( glass ) { pant[0] = tilemap_create(machine, get_tile_info_glass_screen0,tilemap_scan_rows,16,16,32,32); pant[1] = tilemap_create(machine, get_tile_info_glass_screen1,tilemap_scan_rows,16,16,32,32); - screen_bitmap = auto_bitmap_alloc (320, 200, video_screen_get_format(machine->primary_screen)); + screen_bitmap = auto_bitmap_alloc (machine, 320, 200, video_screen_get_format(machine->primary_screen)); tilemap_set_transparent_pen(pant[0],0); tilemap_set_transparent_pen(pant[1],0); diff --git a/src/mame/video/goal92.c b/src/mame/video/goal92.c index 0bd697c7aa9..d4e78e9c04d 100644 --- a/src/mame/video/goal92.c +++ b/src/mame/video/goal92.c @@ -139,7 +139,7 @@ VIDEO_START( goal92 ) foreground_layer = tilemap_create(machine, get_fore_tile_info,tilemap_scan_rows,16,16,32,32); text_layer = tilemap_create(machine, get_text_tile_info,tilemap_scan_rows, 8,8,64,32); - buffered_spriteram16 = auto_malloc(0x400*2); + buffered_spriteram16 = auto_alloc_array(machine, UINT16, 0x400*2); tilemap_set_transparent_pen(background_layer,15); tilemap_set_transparent_pen(foreground_layer,15); diff --git a/src/mame/video/grchamp.c b/src/mame/video/grchamp.c index 1309caba86b..d2585f45e8e 100644 --- a/src/mame/video/grchamp.c +++ b/src/mame/video/grchamp.c @@ -107,7 +107,7 @@ VIDEO_START( grchamp ) { grchamp_state *state = machine->driver_data; - state->work_bitmap = auto_bitmap_alloc(32,32,video_screen_get_format(machine->primary_screen)); + state->work_bitmap = auto_bitmap_alloc(machine,32,32,video_screen_get_format(machine->primary_screen)); /* allocate tilemaps for each of the three sections */ state->text_tilemap = tilemap_create(machine, get_text_tile_info, tilemap_scan_rows, 8,8, 32,32); diff --git a/src/mame/video/gridlee.c b/src/mame/video/gridlee.c index 06aa143ef63..03f792d9b4c 100644 --- a/src/mame/video/gridlee.c +++ b/src/mame/video/gridlee.c @@ -82,8 +82,7 @@ static STATE_POSTLOAD( expand_pixels ) VIDEO_START( gridlee ) { /* allocate a local copy of video RAM */ - local_videoram = auto_malloc(256 * 256); - memset(local_videoram, 0, 256 * 256); + local_videoram = auto_alloc_array_clear(machine, UINT8, 256 * 256); /* reset the palette */ palettebank_vis = 0; diff --git a/src/mame/video/groundfx.c b/src/mame/video/groundfx.c index d8031ed10d7..053491ab7b8 100644 --- a/src/mame/video/groundfx.c +++ b/src/mame/video/groundfx.c @@ -22,7 +22,7 @@ static rectangle hack_cliprect; VIDEO_START( groundfx ) { - spritelist = auto_malloc(0x4000 * sizeof(*spritelist)); + spritelist = auto_alloc_array(machine, struct tempsprite, 0x4000); TC0100SCN_vh_start(machine,1,TC0100SCN_GFX_NUM,50,8,0,0,0,0,0); TC0480SCP_vh_start(machine,TC0480SCP_GFX_NUM,0,0x24,0,-1,0,0,0,0); diff --git a/src/mame/video/gticlub.c b/src/mame/video/gticlub.c index 42b6b8cf0ce..431d04d5d3a 100644 --- a/src/mame/video/gticlub.c +++ b/src/mame/video/gticlub.c @@ -44,13 +44,11 @@ void K001006_init(running_machine *machine) int i; for (i=0; i<MAX_K001006_CHIPS; i++) { - K001006_pal_ram[i] = auto_malloc(0x800*sizeof(UINT16)); - memset(K001006_pal_ram[i], 0, 0x800*sizeof(UINT16)); - K001006_unknown_ram[i] = auto_malloc(0x1000*sizeof(UINT16)); - memset(K001006_unknown_ram[i], 0, 0x1000*sizeof(UINT16)); + K001006_pal_ram[i] = auto_alloc_array_clear(machine, UINT16, 0x800); + K001006_unknown_ram[i] = auto_alloc_array_clear(machine, UINT16, 0x1000); K001006_addr[i] = 0; K001006_device_sel[i] = 0; - K001006_palette[i] = auto_malloc(0x800*sizeof(UINT32)); + K001006_palette[i] = auto_alloc_array(machine, UINT32, 0x800); memset(K001006_palette[i], 0, 0x800*sizeof(UINT32)); } } @@ -208,21 +206,21 @@ void K001005_init(running_machine *machine) int width = video_screen_get_width(machine->primary_screen); int height = video_screen_get_height(machine->primary_screen); - K001005_zbuffer = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED32); + K001005_zbuffer = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED32); gfxrom = memory_region(machine, "gfx1"); K001005_bitmap[0] = video_screen_auto_bitmap_alloc(machine->primary_screen); K001005_bitmap[1] = video_screen_auto_bitmap_alloc(machine->primary_screen); - K001005_texture = auto_malloc(0x800000); + K001005_texture = auto_alloc_array(machine, UINT8, 0x800000); - K001005_ram[0] = auto_malloc(0x140000 * sizeof(UINT16)); - K001005_ram[1] = auto_malloc(0x140000 * sizeof(UINT16)); + K001005_ram[0] = auto_alloc_array(machine, UINT16, 0x140000); + K001005_ram[1] = auto_alloc_array(machine, UINT16, 0x140000); - K001005_fifo = auto_malloc(0x800 * sizeof(UINT32)); + K001005_fifo = auto_alloc_array(machine, UINT32, 0x800); - K001005_3d_fifo = auto_malloc(0x10000 * sizeof(UINT32)); + K001005_3d_fifo = auto_alloc_array(machine, UINT32, 0x10000); poly = poly_alloc(machine, 4000, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS); add_exit_callback(machine, K001005_exit); diff --git a/src/mame/video/gunbustr.c b/src/mame/video/gunbustr.c index 0746567e6b4..1e7b48d794c 100644 --- a/src/mame/video/gunbustr.c +++ b/src/mame/video/gunbustr.c @@ -18,7 +18,7 @@ static struct tempsprite *spritelist; VIDEO_START( gunbustr ) { - spritelist = auto_malloc(0x4000 * sizeof(*spritelist)); + spritelist = auto_alloc_array(machine, struct tempsprite, 0x4000); TC0480SCP_vh_start(machine,TC0480SCP_GFX_NUM,0,0x20,0x07,-1,-1,-1,0,0); } diff --git a/src/mame/video/harddriv.c b/src/mame/video/harddriv.c index 1e98a2f55ed..e56cd753fe7 100644 --- a/src/mame/video/harddriv.c +++ b/src/mame/video/harddriv.c @@ -78,7 +78,7 @@ VIDEO_START( harddriv ) gfx_palettebank = 0; /* allocate the mask table */ - mask_table = auto_malloc(sizeof(UINT32) * 4 * 65536); + mask_table = auto_alloc_array(machine, UINT32, 4 * 65536); /* fill in the mask table */ destmask = mask_table; diff --git a/src/mame/video/hd63484.c b/src/mame/video/hd63484.c index a03ed0e33a9..f1fab8aa3ff 100644 --- a/src/mame/video/hd63484.c +++ b/src/mame/video/hd63484.c @@ -72,11 +72,10 @@ static const char *const instruction_name[64] = "RGCPY","RGCPY","RGCPY","RGCPY" /* Fx */ }; -void HD63484_start(void) +void HD63484_start(running_machine *machine) { fifo_counter = 0; - HD63484_ram = auto_malloc(HD63484_RAM_SIZE * sizeof(*HD63484_ram)); - memset(HD63484_ram, 0, HD63484_RAM_SIZE * sizeof(*HD63484_ram)); + HD63484_ram = auto_alloc_array_clear(machine, UINT16, HD63484_RAM_SIZE); } static void doclr16(int opcode,UINT16 fill,int *dst,INT16 _ax,INT16 _ay) diff --git a/src/mame/video/hd63484.h b/src/mame/video/hd63484.h index 8d11cfb97b4..527cd70b715 100644 --- a/src/mame/video/hd63484.h +++ b/src/mame/video/hd63484.h @@ -3,7 +3,7 @@ extern UINT16 *HD63484_ram; extern UINT16 HD63484_reg[256/2]; -void HD63484_start(void); +void HD63484_start(running_machine *machine); READ16_HANDLER( HD63484_status_r ); WRITE16_HANDLER( HD63484_address_w ); diff --git a/src/mame/video/himesiki.c b/src/mame/video/himesiki.c index 4d81aadfaee..4d90ce9433e 100644 --- a/src/mame/video/himesiki.c +++ b/src/mame/video/himesiki.c @@ -29,7 +29,7 @@ static TILE_GET_INFO( get_bg_tile_info ) VIDEO_START( himesiki ) { - himesiki_bg_ram = auto_malloc(0x1000); + himesiki_bg_ram = auto_alloc_array(machine, UINT8, 0x1000); himesiki_bg_tilemap = tilemap_create( machine, get_bg_tile_info,tilemap_scan_rows,8,8,64,32 ); } diff --git a/src/mame/video/hnayayoi.c b/src/mame/video/hnayayoi.c index 3312e044fcd..15d6c461fa5 100644 --- a/src/mame/video/hnayayoi.c +++ b/src/mame/video/hnayayoi.c @@ -17,7 +17,7 @@ static int palbank; static int total_pixmaps; -static void common_vh_start(int num_pixmaps) +static void common_vh_start(running_machine *machine, int num_pixmaps) { int i; @@ -27,7 +27,7 @@ static void common_vh_start(int num_pixmaps) { if (i < total_pixmaps) { - pixmap[i] = auto_malloc(256*256); + pixmap[i] = auto_alloc_array(machine, UINT8, 256*256); } else pixmap[i] = NULL; @@ -36,12 +36,12 @@ static void common_vh_start(int num_pixmaps) VIDEO_START( hnayayoi ) { - common_vh_start(4); /* 4 bitmaps -> 2 layers */ + common_vh_start(machine, 4); /* 4 bitmaps -> 2 layers */ } VIDEO_START( untoucha ) { - common_vh_start(8); /* 8 bitmaps -> 4 layers */ + common_vh_start(machine, 8); /* 8 bitmaps -> 4 layers */ } diff --git a/src/mame/video/hng64.c b/src/mame/video/hng64.c index fe9ea13cd29..e604d3f5b5d 100644 --- a/src/mame/video/hng64.c +++ b/src/mame/video/hng64.c @@ -1143,11 +1143,11 @@ VIDEO_START( hng64 ) tilemap_set_transparent_pen(hng64_tilemap3,0); // 3d Buffer Allocation - depthBuffer = (float*)auto_malloc((visarea->max_x)*(visarea->max_y)*sizeof(float)) ; + depthBuffer = auto_alloc_array(machine, float, (visarea->max_x)*(visarea->max_y)) ; // The general display list of polygons in the scene... // !! This really should be a dynamic array !! - polys = auto_malloc(MAX_ONSCREEN_POLYS * sizeof(struct polygon)) ; + polys = auto_alloc_array(machine, struct polygon, MAX_ONSCREEN_POLYS) ; } /////////////// diff --git a/src/mame/video/hyprduel.c b/src/mame/video/hyprduel.c index 40034018c10..41d630167a8 100644 --- a/src/mame/video/hyprduel.c +++ b/src/mame/video/hyprduel.c @@ -309,11 +309,11 @@ WRITE16_HANDLER( hyprduel_window_w ) the tile's sizes to be known at startup - which we don't! */ -static void alloc_empty_tiles(void) +static void alloc_empty_tiles(running_machine *machine) { int code,i; - empty_tiles = auto_malloc(16*16*16); + empty_tiles = auto_alloc_array(machine, UINT8, 16*16*16); for (code = 0;code < 0x10;code++) for (i = 0;i < 16*16;i++) @@ -340,9 +340,9 @@ static STATE_POSTLOAD( hyprduel_postload ) VIDEO_START( hyprduel_14220 ) { - alloc_empty_tiles(); - hyprduel_tiletable_old = auto_malloc(hyprduel_tiletable_size); - dirtyindex = auto_malloc(hyprduel_tiletable_size/4); + alloc_empty_tiles(machine); + hyprduel_tiletable_old = auto_alloc_array(machine, UINT16, hyprduel_tiletable_size/2); + dirtyindex = auto_alloc_array(machine, UINT8, hyprduel_tiletable_size/4); bg_tilemap[0] = tilemap_create(machine, get_tile_info_0_8bit,tilemap_scan_rows,8,8,WIN_NX,WIN_NY); bg_tilemap[1] = tilemap_create(machine, get_tile_info_1_8bit,tilemap_scan_rows,8,8,WIN_NX,WIN_NY); diff --git a/src/mame/video/irobot.c b/src/mame/video/irobot.c index 44b18f97d36..a611178196a 100644 --- a/src/mame/video/irobot.c +++ b/src/mame/video/irobot.c @@ -100,8 +100,8 @@ VIDEO_START( irobot ) { /* Setup 2 bitmaps for the polygon generator */ int height = video_screen_get_height(machine->primary_screen); - polybitmap1 = auto_malloc(BITMAP_WIDTH * height); - polybitmap2 = auto_malloc(BITMAP_WIDTH * height); + polybitmap1 = auto_alloc_array(machine, UINT8, BITMAP_WIDTH * height); + polybitmap2 = auto_alloc_array(machine, UINT8, BITMAP_WIDTH * height); /* clear the bitmaps so we start with valid palette look-up values for drawing */ _irobot_poly_clear(machine, polybitmap1); diff --git a/src/mame/video/itech32.c b/src/mame/video/itech32.c index 1116818a73a..190e34c4bf7 100644 --- a/src/mame/video/itech32.c +++ b/src/mame/video/itech32.c @@ -204,7 +204,7 @@ VIDEO_START( itech32 ) int i; /* allocate memory */ - videoram16 = auto_malloc(VRAM_WIDTH * (itech32_vram_height + 16) * 2 * 2); + videoram16 = auto_alloc_array(machine, UINT16, VRAM_WIDTH * (itech32_vram_height + 16) * 2); memset(videoram16, 0xff, VRAM_WIDTH * (itech32_vram_height + 16) * 2 * 2); /* videoplane[0] is the foreground; videoplane[1] is the background */ diff --git a/src/mame/video/jagobj.c b/src/mame/video/jagobj.c index 4c4665a70eb..4dbf330d8fa 100644 --- a/src/mame/video/jagobj.c +++ b/src/mame/video/jagobj.c @@ -24,13 +24,13 @@ static UINT8 *blend_y, *blend_cc; * *************************************/ -void jagobj_init(void) +void jagobj_init(running_machine *machine) { int i; /* allocate memory for tables */ - blend_y = auto_malloc(256 * 256); - blend_cc = auto_malloc(256 * 256); + blend_y = auto_alloc_array(machine, UINT8, 256 * 256); + blend_cc = auto_alloc_array(machine, UINT8, 256 * 256); /* fill tables */ for (i = 0; i < 256 * 256; i++) diff --git a/src/mame/video/jaguar.c b/src/mame/video/jaguar.c index d9da12aa2db..259e923ed07 100644 --- a/src/mame/video/jaguar.c +++ b/src/mame/video/jaguar.c @@ -209,7 +209,7 @@ static pen_t *pen_table; *************************************/ /* from jagobj.c */ -static void jagobj_init(void); +static void jagobj_init(running_machine *machine); static void process_object_list(running_machine *machine, int vc, UINT16 *_scanline); /* from jagblit.c */ @@ -815,11 +815,11 @@ VIDEO_START( cojag ) object_timer = timer_alloc(machine, cojag_scanline_update, NULL); adjust_object_timer(machine, 0); - screen_bitmap = auto_bitmap_alloc(720, 512, BITMAP_FORMAT_RGB32); + screen_bitmap = auto_bitmap_alloc(machine, 720, 512, BITMAP_FORMAT_RGB32); - jagobj_init(); + jagobj_init(machine); - pen_table = auto_malloc(65536 * sizeof(pen_t)); + pen_table = auto_alloc_array(machine, pen_t, 65536); state_save_register_global_pointer(machine, pen_table, 65536); state_save_register_global_array(machine, blitter_regs); diff --git a/src/mame/video/kan_pand.c b/src/mame/video/kan_pand.c index 331675c0329..13f1bb76ed0 100644 --- a/src/mame/video/kan_pand.c +++ b/src/mame/video/kan_pand.c @@ -166,7 +166,7 @@ void pandora_start(running_machine *machine, UINT8 region, int x, int y) pandora_region = region; pandora_xoffset = x; pandora_yoffset = y; - pandora_spriteram = auto_malloc(0x1000); + pandora_spriteram = auto_alloc_array(machine, UINT8, 0x1000); memset(pandora_spriteram,0x00, 0x1000); pandora_sprites_bitmap = video_screen_auto_bitmap_alloc(machine->primary_screen); diff --git a/src/mame/video/kaneko16.c b/src/mame/video/kaneko16.c index 2c6905003f4..26e2a9c4204 100644 --- a/src/mame/video/kaneko16.c +++ b/src/mame/video/kaneko16.c @@ -125,7 +125,7 @@ KANEKO16_LAYER(3) VIDEO_START( kaneko16_sprites ) { /* 0x400 sprites max */ - spritelist.first_sprite = (struct tempsprite *)auto_malloc(0x400 * sizeof(spritelist.first_sprite[0])); + spritelist.first_sprite = auto_alloc_array(machine, struct tempsprite, 0x400); } VIDEO_START( kaneko16_1xVIEW2_tilemaps ) @@ -256,7 +256,7 @@ VIDEO_START( berlwall ) /* Render the hi-color static backgrounds held in the ROMs */ - kaneko16_bg15_bitmap = auto_bitmap_alloc(256 * 32, 256 * 1, BITMAP_FORMAT_INDEXED16); + kaneko16_bg15_bitmap = auto_bitmap_alloc(machine, 256 * 32, 256 * 1, BITMAP_FORMAT_INDEXED16); /* 8aba is used as background color diff --git a/src/mame/video/kangaroo.c b/src/mame/video/kangaroo.c index 228657b6fc2..2558760c9b4 100644 --- a/src/mame/video/kangaroo.c +++ b/src/mame/video/kangaroo.c @@ -24,7 +24,7 @@ static void blitter_execute(running_machine *machine); VIDEO_START( kangaroo ) { /* video RAM is accessed 32 bits at a time (two planes, 4bpp each, 4 pixels) */ - videoram32 = auto_malloc(256 * 64 * 4); + videoram32 = auto_alloc_array(machine, UINT32, 256 * 64); state_save_register_global_pointer(machine, videoram32, 256 * 64); } diff --git a/src/mame/video/karnov.c b/src/mame/video/karnov.c index e193c80ba7f..db34a21e1ac 100644 --- a/src/mame/video/karnov.c +++ b/src/mame/video/karnov.c @@ -205,7 +205,7 @@ WRITE16_HANDLER( karnov_playfield_swap_w ) VIDEO_START( karnov ) { /* Allocate bitmaps */ - bitmap_f = auto_bitmap_alloc(512,512,video_screen_get_format(machine->primary_screen)); + bitmap_f = auto_bitmap_alloc(machine,512,512,video_screen_get_format(machine->primary_screen)); fix_tilemap=tilemap_create(machine, get_fix_tile_info,tilemap_scan_rows,8,8,32,32); @@ -215,7 +215,7 @@ VIDEO_START( karnov ) VIDEO_START( wndrplnt ) { /* Allocate bitmaps */ - bitmap_f = auto_bitmap_alloc(512,512,video_screen_get_format(machine->primary_screen)); + bitmap_f = auto_bitmap_alloc(machine,512,512,video_screen_get_format(machine->primary_screen)); fix_tilemap=tilemap_create(machine, get_fix_tile_info,tilemap_scan_cols,8,8,32,32); diff --git a/src/mame/video/konamiic.c b/src/mame/video/konamiic.c index 8fb9e8abc3e..2a8bd077e97 100644 --- a/src/mame/video/konamiic.c +++ b/src/mame/video/konamiic.c @@ -1522,8 +1522,8 @@ void K007342_vh_start(running_machine *machine, int gfx_index, void (*callback)( K007342_tilemap[0] = tilemap_create(machine, K007342_get_tile_info0,K007342_scan,8,8,64,32); K007342_tilemap[1] = tilemap_create(machine, K007342_get_tile_info1,K007342_scan,8,8,64,32); - K007342_ram = auto_malloc(0x2000); - K007342_scroll_ram = auto_malloc(0x0200); + K007342_ram = auto_alloc_array(machine, UINT8, 0x2000); + K007342_scroll_ram = auto_alloc_array(machine, UINT8, 0x0200); memset(K007342_ram,0,0x2000); @@ -1697,9 +1697,7 @@ void K007420_vh_start(running_machine *machine, int gfxnum, void (*callback)(int { K007420_gfx = machine->gfx[gfxnum]; K007420_callback = callback; - K007420_ram = auto_malloc(0x200); - - memset(K007420_ram,0,0x200); + K007420_ram = auto_alloc_array_clear(machine, UINT8, 0x200); K007420_banklimit = -1; @@ -2041,7 +2039,7 @@ void K052109_vh_start(running_machine *machine,const char *gfx_memory_region,int K052109_tilemap[1] = tilemap_create(machine, K052109_get_tile_info1,tilemap_scan_rows,8,8,64,32); K052109_tilemap[2] = tilemap_create(machine, K052109_get_tile_info2,tilemap_scan_rows,8,8,64,32); - K052109_ram = auto_malloc(0x6000); + K052109_ram = auto_alloc_array(machine, UINT8, 0x6000); memset(K052109_ram,0,0x6000); @@ -2549,8 +2547,7 @@ void K051960_vh_start(running_machine *machine,const char *gfx_memory_region,int K051960_memory_region = gfx_memory_region; K051960_gfx = machine->gfx[gfx_index]; K051960_callback = callback; - K051960_ram = auto_malloc(0x400); - memset(K051960_ram,0,0x400); + K051960_ram = auto_alloc_array_clear(machine, UINT8, 0x400); state_save_register_global(machine, K051960_romoffset); state_save_register_global(machine, K051960_spriteflip); @@ -3046,13 +3043,10 @@ void K053245_vh_start(running_machine *machine,int chip, const char *gfx_memory_ K053245_callback[chip] = callback; K053244_rombank[chip] = 0; K053245_ramsize[chip] = 0x800; - K053245_ram[chip] = auto_malloc(K053245_ramsize[chip]); + K053245_ram[chip] = auto_alloc_array_clear(machine, UINT16, K053245_ramsize[chip]/2); K053245_dx[chip] = K053245_dy[chip] = 0; - K053245_buffer[chip] = auto_malloc(K053245_ramsize[chip]); - - memset(K053245_ram[chip],0,K053245_ramsize[chip]); - memset(K053245_buffer[chip],0,K053245_ramsize[chip]); + K053245_buffer[chip] = auto_alloc_array_clear(machine, UINT16, K053245_ramsize[chip]/2); state_save_register_item_pointer(machine, "K053245", NULL, chip, K053245_ram[chip], K053245_ramsize[chip] / 2); state_save_register_item_pointer(machine, "K053245", NULL, chip, K053245_buffer[chip], K053245_ramsize[chip] / 2); @@ -3812,7 +3806,7 @@ void K053247_vh_start(running_machine *machine, const char *gfx_memory_region, i K053247_gfx = machine->gfx[gfx_index]; K053247_callback = callback; K053246_OBJCHA_line = CLEAR_LINE; - K053247_ram = auto_malloc(0x1000); + K053247_ram = auto_alloc_array(machine, UINT16, 0x1000/2); memset(K053247_ram, 0, 0x1000); memset(K053246_regs, 0, 8); @@ -3893,7 +3887,7 @@ void K055673_vh_start(running_machine *machine, const char *gfx_memory_region, i 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); + K055673_rom = auto_alloc_array(machine, UINT16, size4 * 5 / 2); d = (UINT8 *)K055673_rom; // now combine the graphics together to form 5bpp s1 = memory_region(machine, gfx_memory_region); // 4bpp area @@ -3941,7 +3935,7 @@ void K055673_vh_start(running_machine *machine, const char *gfx_memory_region, i K053247_gfx = machine->gfx[gfx_index]; K053247_callback = callback; K053246_OBJCHA_line = CLEAR_LINE; - K053247_ram = auto_malloc(0x1000); + K053247_ram = auto_alloc_array(machine, UINT16, 0x1000/2); memset(K053247_ram, 0, 0x1000); memset(K053246_regs, 0, 8); @@ -4698,7 +4692,7 @@ static void K051316_vh_start(running_machine *machine,int chip, const char *gfx_ K051316_tilemap[chip] = tilemap_create(machine, get_tile_info[chip],tilemap_scan_rows,16,16,32,32); - K051316_ram[chip] = auto_malloc(0x800); + K051316_ram[chip] = auto_alloc_array(machine, UINT8, 0x800); if (!pen_is_mask) tilemap_set_transparent_pen(K051316_tilemap[chip],transparent_pen); @@ -5783,7 +5777,7 @@ void K056832_vh_start(running_machine *machine, const char *gfx_memory_region, i K056832_PageTileMode[i] = 1; } - K056832_videoram = auto_malloc(0x2000 * (K056832_PAGE_COUNT+1)); + K056832_videoram = auto_alloc_array(machine, UINT16, 0x2000 * (K056832_PAGE_COUNT+1) / 2); K056832_tilemap[0x0] = tilemap_create(machine, K056832_get_tile_info0, tilemap_scan_rows, 8, 8, 64, 32); K056832_tilemap[0x1] = tilemap_create(machine, K056832_get_tile_info1, tilemap_scan_rows, 8, 8, 64, 32); @@ -7528,7 +7522,7 @@ void K053250_vh_start(running_machine *machine, int chips, const char **region) for(chip=0; chip<chips; chip++) { K053250_info.chip[chip].base = memory_region(machine, region[chip]); - ram = auto_malloc(0x6000); + ram = auto_alloc_array(machine, UINT16, 0x6000/2); K053250_info.chip[chip].ram = ram; K053250_info.chip[chip].rammax = ram + 0x800; K053250_info.chip[chip].buffer[0] = ram + 0x2000; diff --git a/src/mame/video/ladyfrog.c b/src/mame/video/ladyfrog.c index b10c492f6e6..a5e37f4181f 100644 --- a/src/mame/video/ladyfrog.c +++ b/src/mame/video/ladyfrog.c @@ -136,11 +136,11 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta VIDEO_START( ladyfrog ) { - ladyfrog_spriteram = auto_malloc (160); + ladyfrog_spriteram = auto_alloc_array(machine, UINT8, 160); bg_tilemap = tilemap_create( machine, get_tile_info,tilemap_scan_rows,8,8,32,32 ); - paletteram = auto_malloc(0x200); - paletteram_2 = auto_malloc(0x200); + paletteram = auto_alloc_array(machine, UINT8, 0x200); + paletteram_2 = auto_alloc_array(machine, UINT8, 0x200); tilemap_set_scroll_cols(bg_tilemap,32); tilemap_set_scrolldy( bg_tilemap, 15, 15 ); } diff --git a/src/mame/video/legionna.c b/src/mame/video/legionna.c index eab3a2e9524..f83de741846 100644 --- a/src/mame/video/legionna.c +++ b/src/mame/video/legionna.c @@ -167,7 +167,7 @@ VIDEO_START( legionna ) text_layer = tilemap_create(machine, get_text_tile_info,tilemap_scan_rows, 8,8,64,32); legionna_layer_disable = 0x0000; - legionna_scrollram16 = auto_malloc(0x60); + legionna_scrollram16 = auto_alloc_array(machine, UINT16, 0x60/2); tilemap_set_transparent_pen(background_layer,15); tilemap_set_transparent_pen(midground_layer,15); @@ -183,7 +183,7 @@ VIDEO_START( denjinmk ) text_layer = tilemap_create(machine, get_text_tile_info,tilemap_scan_rows, 8,8,64,32); legionna_layer_disable = 0x0000; - legionna_scrollram16 = auto_malloc(0x60); + legionna_scrollram16 = auto_alloc_array(machine, UINT16, 0x60/2); tilemap_set_transparent_pen(background_layer,15); tilemap_set_transparent_pen(midground_layer,15); @@ -199,7 +199,7 @@ VIDEO_START( cupsoc ) text_layer = tilemap_create(machine, get_text_tile_info,tilemap_scan_rows, 8,8,64,32); legionna_layer_disable = 0x0000; - legionna_scrollram16 = auto_malloc(0x60); + legionna_scrollram16 = auto_alloc_array(machine, UINT16, 0x60/2); tilemap_set_transparent_pen(background_layer,15); tilemap_set_transparent_pen(midground_layer,15); diff --git a/src/mame/video/leland.c b/src/mame/video/leland.c index 75577773537..c2b5eb81ec6 100644 --- a/src/mame/video/leland.c +++ b/src/mame/video/leland.c @@ -86,10 +86,7 @@ static TIMER_CALLBACK( scanline_callback ) static VIDEO_START( leland ) { /* allocate memory */ - leland_video_ram = auto_malloc(VRAM_SIZE); - - /* reset videoram */ - memset(leland_video_ram, 0, VRAM_SIZE); + leland_video_ram = auto_alloc_array_clear(machine, UINT8, VRAM_SIZE); /* scanline timer */ scanline_timer = timer_alloc(machine, scanline_callback, NULL); @@ -104,10 +101,7 @@ static VIDEO_START( ataxx ) VIDEO_START_CALL(leland); /* allocate memory */ - ataxx_qram = auto_malloc(QRAM_SIZE); - - /* reset QRAM */ - memset(ataxx_qram, 0, QRAM_SIZE); + ataxx_qram = auto_alloc_array_clear(machine, UINT8, QRAM_SIZE); } diff --git a/src/mame/video/lemmings.c b/src/mame/video/lemmings.c index faf14a2e761..3e418123d73 100644 --- a/src/mame/video/lemmings.c +++ b/src/mame/video/lemmings.c @@ -93,12 +93,12 @@ static TILE_GET_INFO( get_tile_info ) VIDEO_START( lemmings ) { - bitmap0 = auto_bitmap_alloc(2048,256,video_screen_get_format(machine->primary_screen)); + bitmap0 = auto_bitmap_alloc(machine,2048,256,video_screen_get_format(machine->primary_screen)); vram_tilemap = tilemap_create(machine, get_tile_info,tilemap_scan_cols,8,8,64,32); - vram_buffer = (UINT8*)auto_malloc(2048*64); /* 64 bytes per VRAM character */ - sprite_triple_buffer_0 = (UINT16*)auto_malloc(0x800); - sprite_triple_buffer_1 = (UINT16*)auto_malloc(0x800); + vram_buffer = auto_alloc_array(machine, UINT8, 2048*64); /* 64 bytes per VRAM character */ + sprite_triple_buffer_0 = auto_alloc_array(machine, UINT16, 0x800/2); + sprite_triple_buffer_1 = auto_alloc_array(machine, UINT16, 0x800/2); tilemap_set_transparent_pen(vram_tilemap,0); bitmap_fill(bitmap0,0,0x100); diff --git a/src/mame/video/lethalj.c b/src/mame/video/lethalj.c index d413889b0a1..14fa783f471 100644 --- a/src/mame/video/lethalj.c +++ b/src/mame/video/lethalj.c @@ -91,7 +91,7 @@ READ16_HANDLER( lethalj_gun_r ) VIDEO_START( lethalj ) { /* allocate video RAM for screen */ - screenram = auto_malloc(BLITTER_DEST_WIDTH * BLITTER_DEST_HEIGHT * sizeof(screenram[0])); + screenram = auto_alloc_array(machine, UINT16, BLITTER_DEST_WIDTH * BLITTER_DEST_HEIGHT); /* predetermine blitter info */ blitter_base = (UINT16 *)memory_region(machine, "gfx1"); diff --git a/src/mame/video/liberatr.c b/src/mame/video/liberatr.c index 23bdf1eb5a9..2cf080af710 100644 --- a/src/mame/video/liberatr.c +++ b/src/mame/video/liberatr.c @@ -227,7 +227,7 @@ static void liberatr_init_planet(running_machine *machine, planet *liberatr_plan many segments it will take to store the description, allocate the space for it and copy the data to it. */ - buffer = auto_malloc(2*(128 + total_segment_count)); + buffer = auto_alloc_array(machine, UINT8, 2*(128 + total_segment_count)); liberatr_planet->frames[longitude] = buffer; @@ -267,11 +267,11 @@ static void liberatr_init_planet(running_machine *machine, planet *liberatr_plan VIDEO_START( liberatr ) { - liberatr_videoram = auto_malloc(0x10000); + liberatr_videoram = auto_alloc_array(machine, UINT8, 0x10000); /* allocate the planet descriptor structure */ - liberatr_planets[0] = auto_malloc(sizeof(planet)); - liberatr_planets[1] = auto_malloc(sizeof(planet)); + liberatr_planets[0] = auto_alloc(machine, planet); + liberatr_planets[1] = auto_alloc(machine, planet); /* for each planet in the planet ROMs */ liberatr_init_planet(machine, liberatr_planets[0], &memory_region(machine, "gfx1")[0x2000]); diff --git a/src/mame/video/lockon.c b/src/mame/video/lockon.c index 01afbb7e9cd..d92571b09d5 100644 --- a/src/mame/video/lockon.c +++ b/src/mame/video/lockon.c @@ -938,11 +938,11 @@ VIDEO_START( lockon ) tilemap_set_transparent_pen(lockon_tilemap, 0); /* Allocate the two frame buffers for rotation */ - back_buffer = auto_bitmap_alloc(512, 512, BITMAP_FORMAT_INDEXED16); - front_buffer = auto_bitmap_alloc(512, 512, BITMAP_FORMAT_INDEXED16); + back_buffer = auto_bitmap_alloc(machine, 512, 512, BITMAP_FORMAT_INDEXED16); + front_buffer = auto_bitmap_alloc(machine, 512, 512, BITMAP_FORMAT_INDEXED16); /* 2kB of object ASIC palette RAM */ - obj_pal_ram = auto_malloc(2048); + obj_pal_ram = auto_alloc_array(machine, UINT8, 2048); /* Timer for ground display list callback */ bufend_timer = timer_alloc(machine, bufend_callback, NULL); diff --git a/src/mame/video/m107.c b/src/mame/video/m107.c index d3b5f4de2f6..757061df0f7 100644 --- a/src/mame/video/m107.c +++ b/src/mame/video/m107.c @@ -147,8 +147,7 @@ VIDEO_START( m107 ) tilemap_set_transparent_pen(layer->tmap, 0); } - m107_spriteram = auto_malloc(0x1000); - memset(m107_spriteram,0,0x1000); + m107_spriteram = auto_alloc_array_clear(machine, UINT16, 0x1000/2); } /*****************************************************************************/ diff --git a/src/mame/video/m58.c b/src/mame/video/m58.c index 91438459278..9e46769669c 100644 --- a/src/mame/video/m58.c +++ b/src/mame/video/m58.c @@ -188,7 +188,7 @@ VIDEO_START( yard ) tilemap_set_scrolldx(bg_tilemap, visarea->min_x, width - (visarea->max_x + 1)); tilemap_set_scrolldy(bg_tilemap, visarea->min_y - 8, height + 16 - (visarea->max_y + 1)); - scroll_panel_bitmap = auto_bitmap_alloc(SCROLL_PANEL_WIDTH, height, format); + scroll_panel_bitmap = auto_bitmap_alloc(machine, SCROLL_PANEL_WIDTH, height, format); } diff --git a/src/mame/video/m72.c b/src/mame/video/m72.c index 8148d189af7..19a7fd6de6a 100644 --- a/src/mame/video/m72.c +++ b/src/mame/video/m72.c @@ -115,7 +115,7 @@ static void register_savestate(running_machine *machine) state_save_register_global(machine, scrolly1); state_save_register_global(machine, scrollx2); state_save_register_global(machine, scrolly2); - state_save_register_global_pointer(machine, m72_spriteram, spriteram_size); + state_save_register_global_pointer(machine, m72_spriteram, spriteram_size/2); } @@ -124,7 +124,7 @@ VIDEO_START( m72 ) bg_tilemap = tilemap_create(machine, m72_get_bg_tile_info,tilemap_scan_rows,8,8,64,64); fg_tilemap = tilemap_create(machine, m72_get_fg_tile_info,tilemap_scan_rows,8,8,64,64); - m72_spriteram = auto_malloc(spriteram_size); + m72_spriteram = auto_alloc_array(machine, UINT16, spriteram_size/2); tilemap_set_transmask(fg_tilemap,0,0xffff,0x0001); tilemap_set_transmask(fg_tilemap,1,0x00ff,0xff01); @@ -151,7 +151,7 @@ VIDEO_START( rtype2 ) bg_tilemap = tilemap_create(machine, rtype2_get_bg_tile_info,tilemap_scan_rows,8,8,64,64); fg_tilemap = tilemap_create(machine, rtype2_get_fg_tile_info,tilemap_scan_rows,8,8,64,64); - m72_spriteram = auto_malloc(spriteram_size); + m72_spriteram = auto_alloc_array(machine, UINT16, spriteram_size/2); tilemap_set_transmask(fg_tilemap,0,0xffff,0x0001); tilemap_set_transmask(fg_tilemap,1,0x00ff,0xff01); @@ -190,7 +190,7 @@ VIDEO_START( majtitle ) bg_tilemap = tilemap_create(machine, rtype2_get_bg_tile_info,majtitle_scan_rows,8,8,128,64); fg_tilemap = tilemap_create(machine, rtype2_get_fg_tile_info,tilemap_scan_rows,8,8,64,64); - m72_spriteram = auto_malloc(spriteram_size); + m72_spriteram = auto_alloc_array(machine, UINT16, spriteram_size/2); tilemap_set_transmask(fg_tilemap,0,0xffff,0x0001); tilemap_set_transmask(fg_tilemap,1,0x00ff,0xff01); @@ -216,7 +216,7 @@ VIDEO_START( hharry ) bg_tilemap = tilemap_create(machine, hharry_get_bg_tile_info,tilemap_scan_rows,8,8,64,64); fg_tilemap = tilemap_create(machine, m72_get_fg_tile_info, tilemap_scan_rows,8,8,64,64); - m72_spriteram = auto_malloc(spriteram_size); + m72_spriteram = auto_alloc_array(machine, UINT16, spriteram_size/2); tilemap_set_transmask(fg_tilemap,0,0xffff,0x0001); tilemap_set_transmask(fg_tilemap,1,0x00ff,0xff01); diff --git a/src/mame/video/m92.c b/src/mame/video/m92.c index 912e5197e65..b84777002b3 100644 --- a/src/mame/video/m92.c +++ b/src/mame/video/m92.c @@ -279,7 +279,7 @@ VIDEO_START( m92 ) state_save_register_item_array(machine, "layer", NULL, laynum, layer->control); } - paletteram16 = auto_malloc(0x1000); + paletteram16 = auto_alloc_array(machine, UINT16, 0x1000/2); memset(spriteram16,0,0x800); memset(buffered_spriteram16,0,0x800); diff --git a/src/mame/video/macrossp.c b/src/mame/video/macrossp.c index e9f4ebbab1d..2af63dbb888 100644 --- a/src/mame/video/macrossp.c +++ b/src/mame/video/macrossp.c @@ -146,11 +146,8 @@ static TILE_GET_INFO( get_macrossp_text_tile_info ) VIDEO_START(macrossp) { - spriteram_old = auto_malloc(spriteram_size); - spriteram_old2 = auto_malloc(spriteram_size); - - memset(spriteram_old,0,spriteram_size); - memset(spriteram_old2,0,spriteram_size); + spriteram_old = auto_alloc_array_clear(machine, UINT32, spriteram_size/4); + spriteram_old2 = auto_alloc_array_clear(machine, UINT32, spriteram_size/4); macrossp_text_tilemap = tilemap_create(machine, get_macrossp_text_tile_info,tilemap_scan_rows,16,16,64,64); macrossp_scra_tilemap = tilemap_create(machine, get_macrossp_scra_tile_info,tilemap_scan_rows,16,16,64,64); diff --git a/src/mame/video/madalien.c b/src/mame/video/madalien.c index 8e5b87522b5..e703b9682b0 100644 --- a/src/mame/video/madalien.c +++ b/src/mame/video/madalien.c @@ -164,7 +164,7 @@ static VIDEO_START( madalien ) tilemap_set_scrolldy(tilemap_edge2[i], 0, video_screen_get_height(machine->primary_screen) - 256); } - headlight_bitmap = auto_bitmap_alloc(128, 128, BITMAP_FORMAT_INDEXED16); + headlight_bitmap = auto_bitmap_alloc(machine, 128, 128, BITMAP_FORMAT_INDEXED16); gfx_element_set_source(machine->gfx[0], madalien_charram); diff --git a/src/mame/video/magmax.c b/src/mame/video/magmax.c index 88d6e787121..0fa624539e8 100644 --- a/src/mame/video/magmax.c +++ b/src/mame/video/magmax.c @@ -75,7 +75,7 @@ VIDEO_START( magmax ) /* Set up save state */ state_save_register_global(machine, flipscreen); - prom_tab = auto_malloc(256 * sizeof(UINT32)); + prom_tab = auto_alloc_array(machine, UINT32, 256); /* Allocate temporary bitmap */ tmpbitmap = video_screen_auto_bitmap_alloc(machine->primary_screen); diff --git a/src/mame/video/malzak.c b/src/mame/video/malzak.c index d25f62b35e8..7923fcaf3da 100644 --- a/src/mame/video/malzak.c +++ b/src/mame/video/malzak.c @@ -60,10 +60,10 @@ VIDEO_START( malzak ) int height = video_screen_get_height(machine->primary_screen); /* configure the S2636 chips */ -// s2636_0 = s2636_config(malzak_s2636_0_ram, height, width, -8, -16); -// s2636_1 = s2636_config(malzak_s2636_1_ram, height, width, -9, -16); - s2636_0 = s2636_config(malzak_s2636_0_ram, height, width, 0, -16); - s2636_1 = s2636_config(malzak_s2636_1_ram, height, width, 0, -16); +// s2636_0 = s2636_config(machine, malzak_s2636_0_ram, height, width, -8, -16); +// s2636_1 = s2636_config(machine, malzak_s2636_1_ram, height, width, -9, -16); + s2636_0 = s2636_config(machine, malzak_s2636_0_ram, height, width, 0, -16); + s2636_1 = s2636_config(machine, malzak_s2636_1_ram, height, width, 0, -16); } VIDEO_UPDATE( malzak ) diff --git a/src/mame/video/matmania.c b/src/mame/video/matmania.c index 6666afdee87..971c6ad336b 100644 --- a/src/mame/video/matmania.c +++ b/src/mame/video/matmania.c @@ -130,8 +130,8 @@ VIDEO_START( matmania ) bitmap_format format = video_screen_get_format(machine->primary_screen); /* Mat Mania has a virtual screen twice as large as the visible screen */ - tmpbitmap = auto_bitmap_alloc(width, 2*height, format); - tmpbitmap2 = auto_bitmap_alloc(width, 2*height, format); + tmpbitmap = auto_bitmap_alloc(machine, width, 2*height, format); + tmpbitmap2 = auto_bitmap_alloc(machine, width, 2*height, format); } diff --git a/src/mame/video/mayumi.c b/src/mame/video/mayumi.c index 7d432a294a0..6d7bbccf15e 100644 --- a/src/mame/video/mayumi.c +++ b/src/mame/video/mayumi.c @@ -22,7 +22,7 @@ static TILE_GET_INFO( get_tile_info ) VIDEO_START( mayumi ) { - mayumi_videoram = auto_malloc(0x1800); + mayumi_videoram = auto_alloc_array(machine, UINT8, 0x1800); mayumi_tilemap = tilemap_create( machine, get_tile_info,tilemap_scan_rows,8,8,64,32 ); } diff --git a/src/mame/video/mcatadv.c b/src/mame/video/mcatadv.c index 088568c9891..fd8c7691356 100644 --- a/src/mame/video/mcatadv.c +++ b/src/mame/video/mcatadv.c @@ -252,10 +252,8 @@ VIDEO_START( mcatadv ) mcatadv_tilemap2 = tilemap_create(machine, get_mcatadv_tile_info2,tilemap_scan_rows, 16, 16,32,32); tilemap_set_transparent_pen(mcatadv_tilemap2,0); - spriteram_old = auto_malloc(spriteram_size); - vidregs_old = auto_malloc(0xf); - - memset(spriteram_old,0,spriteram_size); + spriteram_old = auto_alloc_array_clear(machine, UINT16, spriteram_size/2); + vidregs_old = auto_alloc_array(machine, UINT16, 0xf/2); palette_bank1 = 0; palette_bank2 = 0; diff --git a/src/mame/video/mcr68.c b/src/mame/video/mcr68.c index 5b2ae58a744..1c104e3bf38 100644 --- a/src/mame/video/mcr68.c +++ b/src/mame/video/mcr68.c @@ -85,8 +85,8 @@ VIDEO_START( zwackery ) tilemap_set_transparent_pen(fg_tilemap, 0); /* allocate memory for the assembled gfx data */ - srcdata0 = auto_malloc(gfx0->total_elements * gfx0->width * gfx0->height); - srcdata2 = auto_malloc(gfx2->total_elements * gfx2->width * gfx2->height); + srcdata0 = auto_alloc_array(machine, UINT8, gfx0->total_elements * gfx0->width * gfx0->height); + srcdata2 = auto_alloc_array(machine, UINT8, gfx2->total_elements * gfx2->width * gfx2->height); /* "colorize" each code */ dest0 = srcdata0; diff --git a/src/mame/video/megazone.c b/src/mame/video/megazone.c index ab3ec46de8d..15b717a334e 100644 --- a/src/mame/video/megazone.c +++ b/src/mame/video/megazone.c @@ -109,7 +109,7 @@ WRITE8_HANDLER( megazone_flipscreen_w ) VIDEO_START( megazone ) { - tmpbitmap = auto_bitmap_alloc(256,256,video_screen_get_format(machine->primary_screen)); + tmpbitmap = auto_bitmap_alloc(machine,256,256,video_screen_get_format(machine->primary_screen)); } diff --git a/src/mame/video/metlclsh.c b/src/mame/video/metlclsh.c index 3649d840c3f..43a00f54878 100644 --- a/src/mame/video/metlclsh.c +++ b/src/mame/video/metlclsh.c @@ -142,7 +142,7 @@ WRITE8_HANDLER( metlclsh_fgram_w ) VIDEO_START( metlclsh ) { - metlclsh_otherram = auto_malloc(0x800); // banked ram + metlclsh_otherram = auto_alloc_array(machine, UINT8, 0x800); // banked ram bg_tilemap = tilemap_create(machine, get_bg_tile_info,metlclsh_bgtilemap_scan,16,16,32,16); fg_tilemap = tilemap_create(machine, get_fg_tile_info,tilemap_scan_rows,8,8,32,32); diff --git a/src/mame/video/metro.c b/src/mame/video/metro.c index 2fb5fc2b555..9e482a1d9fc 100644 --- a/src/mame/video/metro.c +++ b/src/mame/video/metro.c @@ -390,11 +390,11 @@ WRITE16_HANDLER( metro_window_w ) static int metro_sprite_xoffs, metro_sprite_yoffs; -static void alloc_empty_tiles(void) +static void alloc_empty_tiles(running_machine *machine) { int code,i; - empty_tiles = auto_malloc(16*16*16); + empty_tiles = auto_alloc_array(machine, UINT8, 16*16*16); for (code = 0;code < 0x10;code++) for (i = 0;i < 16*16;i++) @@ -407,9 +407,9 @@ VIDEO_START( metro_14100 ) support_16x16 = 0; has_zoom = 0; - alloc_empty_tiles(); - metro_tiletable_old = auto_malloc(metro_tiletable_size); - dirtyindex = auto_malloc(metro_tiletable_size/4); + alloc_empty_tiles(machine); + metro_tiletable_old = auto_alloc_array(machine, UINT16, metro_tiletable_size/2); + dirtyindex = auto_alloc_array(machine, UINT8, metro_tiletable_size/4); bg_tilemap[0] = tilemap_create(machine, get_tile_info_0,tilemap_scan_rows,8,8,WIN_NX,WIN_NY); bg_tilemap[1] = tilemap_create(machine, get_tile_info_1,tilemap_scan_rows,8,8,WIN_NX,WIN_NY); @@ -436,9 +436,9 @@ VIDEO_START( metro_14220 ) support_16x16 = 0; has_zoom = 0; - alloc_empty_tiles(); - metro_tiletable_old = auto_malloc(metro_tiletable_size); - dirtyindex = auto_malloc(metro_tiletable_size/4); + alloc_empty_tiles(machine); + metro_tiletable_old = auto_alloc_array(machine, UINT16, metro_tiletable_size/2); + dirtyindex = auto_alloc_array(machine, UINT8, metro_tiletable_size/4); bg_tilemap[0] = tilemap_create(machine, get_tile_info_0_8bit,tilemap_scan_rows,8,8,WIN_NX,WIN_NY); bg_tilemap[1] = tilemap_create(machine, get_tile_info_1_8bit,tilemap_scan_rows,8,8,WIN_NX,WIN_NY); @@ -468,9 +468,9 @@ VIDEO_START( metro_14300 ) support_16x16 = 1; has_zoom = 0; - alloc_empty_tiles(); - metro_tiletable_old = auto_malloc(metro_tiletable_size); - dirtyindex = auto_malloc(metro_tiletable_size/4); + alloc_empty_tiles(machine); + metro_tiletable_old = auto_alloc_array(machine, UINT16, metro_tiletable_size/2); + dirtyindex = auto_alloc_array(machine, UINT8, metro_tiletable_size/4); bg_tilemap[0] = tilemap_create(machine, get_tile_info_0_8bit,tilemap_scan_rows,8,8,WIN_NX,WIN_NY); bg_tilemap[1] = tilemap_create(machine, get_tile_info_1_8bit,tilemap_scan_rows,8,8,WIN_NX,WIN_NY); diff --git a/src/mame/video/midtunit.c b/src/mame/video/midtunit.c index e79fe372d86..95c9018ad82 100644 --- a/src/mame/video/midtunit.c +++ b/src/mame/video/midtunit.c @@ -86,7 +86,7 @@ static struct VIDEO_START( midtunit ) { /* allocate memory */ - local_videoram = auto_malloc(0x100000); + local_videoram = auto_alloc_array(machine, UINT16, 0x100000/2); /* reset all the globals */ gfxbank_offset[0] = 0x000000; diff --git a/src/mame/video/midyunit.c b/src/mame/video/midyunit.c index cfb58747a91..d27cf5c9589 100644 --- a/src/mame/video/midyunit.c +++ b/src/mame/video/midyunit.c @@ -70,12 +70,9 @@ static struct static VIDEO_START( common ) { /* allocate memory */ - midyunit_cmos_ram = auto_malloc(0x2000 * 4); - local_videoram = auto_malloc(0x80000); - pen_map = auto_malloc(65536 * sizeof(pen_map[0])); - - /* we have to erase this since we rely on upper bits being 0 */ - memset(local_videoram, 0, 0x80000); + midyunit_cmos_ram = auto_alloc_array(machine, UINT16, (0x2000 * 4)/2); + local_videoram = auto_alloc_array_clear(machine, UINT16, 0x80000/2); + pen_map = auto_alloc_array(machine, pen_t, 65536); /* reset all the globals */ midyunit_cmos_page = 0; @@ -88,8 +85,8 @@ static VIDEO_START( common ) /* register for state saving */ state_save_register_global(machine, autoerase_enable); - state_save_register_global_pointer(machine, local_videoram, 0x80000/sizeof(local_videoram[0])); - state_save_register_global_pointer(machine, midyunit_cmos_ram, (0x2000 * 4)/sizeof(midyunit_cmos_ram[0])); + state_save_register_global_pointer(machine, local_videoram, 0x80000/2); + state_save_register_global_pointer(machine, midyunit_cmos_ram, (0x2000 * 4)/2); state_save_register_global(machine, videobank_select); state_save_register_global_array(machine, dma_register); } diff --git a/src/mame/video/midzeus.c b/src/mame/video/midzeus.c index d172c62f4f0..8f4dff4df22 100644 --- a/src/mame/video/midzeus.c +++ b/src/mame/video/midzeus.c @@ -247,8 +247,8 @@ VIDEO_START( midzeus ) int i; /* allocate memory for "wave" RAM */ - waveram[0] = auto_malloc(WAVERAM0_WIDTH * WAVERAM0_HEIGHT * 8); - waveram[1] = auto_malloc(WAVERAM1_WIDTH * WAVERAM1_HEIGHT * 8); + waveram[0] = auto_alloc_array(machine, UINT32, WAVERAM0_WIDTH * WAVERAM0_HEIGHT * 8/4); + waveram[1] = auto_alloc_array(machine, UINT32, WAVERAM1_WIDTH * WAVERAM1_HEIGHT * 8/4); /* initialize a 5-5-5 palette */ for (i = 0; i < 32768; i++) diff --git a/src/mame/video/midzeus2.c b/src/mame/video/midzeus2.c index cc0b300f116..392c560571b 100644 --- a/src/mame/video/midzeus2.c +++ b/src/mame/video/midzeus2.c @@ -264,8 +264,8 @@ static TIMER_CALLBACK( int_timer_callback ) VIDEO_START( midzeus2 ) { /* allocate memory for "wave" RAM */ - waveram[0] = auto_malloc(WAVERAM0_WIDTH * WAVERAM0_HEIGHT * 8); - waveram[1] = auto_malloc(WAVERAM1_WIDTH * WAVERAM1_HEIGHT * 12); + waveram[0] = auto_alloc_array(machine, UINT32, WAVERAM0_WIDTH * WAVERAM0_HEIGHT * 8/4); + waveram[1] = auto_alloc_array(machine, UINT32, WAVERAM1_WIDTH * WAVERAM1_HEIGHT * 12/4); /* initialize polygon engine */ poly = poly_alloc(machine, 10000, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS); @@ -498,7 +498,7 @@ if (regdata_count[offset] < 256) break; if (*tailptr == NULL) { - *tailptr = malloc_or_die(sizeof(reg_info)); + *tailptr = alloc_or_die(reg_info); (*tailptr)->next = NULL; (*tailptr)->value = data; regdata_count[offset]++; @@ -742,7 +742,7 @@ if (subregdata_count[which] < 256) break; if (*tailptr == NULL) { - *tailptr = malloc_or_die(sizeof(reg_info)); + *tailptr = alloc_or_die(reg_info); (*tailptr)->next = NULL; (*tailptr)->value = value; subregdata_count[which]++; diff --git a/src/mame/video/mitchell.c b/src/mame/video/mitchell.c index 9c52266cc15..dba3325747b 100644 --- a/src/mame/video/mitchell.c +++ b/src/mame/video/mitchell.c @@ -59,14 +59,12 @@ VIDEO_START( pang ) /* OBJ RAM */ - pang_objram=auto_malloc(pang_videoram_size); - memset(pang_objram, 0, pang_videoram_size); + pang_objram=auto_alloc_array_clear(machine, UINT8, pang_videoram_size); /* Palette RAM */ - paletteram = auto_malloc(2*machine->config->total_colors); - memset(paletteram, 0, 2*machine->config->total_colors); + paletteram = auto_alloc_array_clear(machine, UINT8, 2*machine->config->total_colors); } diff --git a/src/mame/video/mjsister.c b/src/mame/video/mjsister.c index 2fe35aaff43..177b9b34b3a 100644 --- a/src/mame/video/mjsister.c +++ b/src/mame/video/mjsister.c @@ -23,10 +23,10 @@ static UINT8 *mjsister_videoram0, *mjsister_videoram1; VIDEO_START( mjsister ) { - mjsister_tmpbitmap0 = auto_bitmap_alloc(256,256,video_screen_get_format(machine->primary_screen)); - mjsister_tmpbitmap1 = auto_bitmap_alloc(256,256,video_screen_get_format(machine->primary_screen)); - mjsister_videoram0 = auto_malloc(0x8000); - mjsister_videoram1 = auto_malloc(0x8000); + mjsister_tmpbitmap0 = auto_bitmap_alloc(machine,256,256,video_screen_get_format(machine->primary_screen)); + mjsister_tmpbitmap1 = auto_bitmap_alloc(machine,256,256,video_screen_get_format(machine->primary_screen)); + mjsister_videoram0 = auto_alloc_array(machine, UINT8, 0x8000); + mjsister_videoram1 = auto_alloc_array(machine, UINT8, 0x8000); } static void mjsister_plot0(int offset,UINT8 data) diff --git a/src/mame/video/model1.c b/src/mame/video/model1.c index e3595af5dba..fb17c13c304 100644 --- a/src/mame/video/model1.c +++ b/src/mame/video/model1.c @@ -1438,16 +1438,11 @@ VIDEO_START(model1) sys24_tile_vh_start(machine, 0x3fff); poly_rom = (UINT32 *)memory_region(machine, "user1"); - poly_ram = auto_malloc(0x400000*4); - memset(poly_ram, 0, 0x400000*4); - tgp_ram = auto_malloc((0x100000-0x40000)*2); - memset(tgp_ram, 0, (0x100000-0x40000)*2); - pointdb = auto_malloc(1000000*2*sizeof(struct point)); - memset(pointdb, 0, 1000000*2*sizeof(struct point)); - quaddb = auto_malloc(1000000*sizeof(struct quad)); - memset(quaddb, 0, 1000000*sizeof(struct quad)); - quadind = auto_malloc(1000000*sizeof(struct quad *)); - memset(quadind, 0, 1000000*sizeof(struct quad *)); + poly_ram = auto_alloc_array_clear(machine, UINT32, 0x400000); + tgp_ram = auto_alloc_array_clear(machine, UINT16, 0x100000-0x40000); + pointdb = auto_alloc_array_clear(machine, struct point, 1000000*2); + quaddb = auto_alloc_array_clear(machine, struct quad, 1000000); + quadind = auto_alloc_array_clear(machine, struct quad *, 1000000); pointpt = pointdb; quadpt = quaddb; diff --git a/src/mame/video/model2.c b/src/mame/video/model2.c index 1b839bf514f..05be2657ada 100644 --- a/src/mame/video/model2.c +++ b/src/mame/video/model2.c @@ -331,15 +331,15 @@ static raster_state raster; * *******************************************/ -static void model2_3d_init( UINT16 *texture_rom ) +static void model2_3d_init( running_machine *machine, UINT16 *texture_rom ) { memset( &raster, 0, sizeof( raster_state ) ); raster.texture_rom = texture_rom; - raster.texture_ram = auto_malloc(0x10000 * sizeof(UINT16)); - raster.log_ram = auto_malloc(0x40000 * sizeof(UINT8)); - raster.tri_list = auto_malloc(MAX_TRIANGLES * sizeof(triangle)); - raster.tri_sorted_list = auto_malloc(0x10000 * sizeof( triangle * )); + raster.texture_ram = auto_alloc_array(machine, UINT16, 0x10000); + raster.log_ram = auto_alloc_array(machine, UINT8, 0x40000); + raster.tri_list = auto_alloc_array(machine, triangle, MAX_TRIANGLES); + raster.tri_sorted_list = auto_alloc_array(machine, triangle *, 0x10000); } /******************************************* @@ -1312,13 +1312,13 @@ static geo_state geo; * *******************************************/ -static void geo_init( UINT32 *polygon_rom ) +static void geo_init( running_machine *machine, UINT32 *polygon_rom ) { memset( &geo, 0, sizeof( geo_state ) ); geo.polygon_rom = polygon_rom; - geo.polygon_ram0 = auto_malloc(0x8000 * sizeof(UINT32)); - geo.polygon_ram1 = auto_malloc(0x8000 * sizeof(UINT32)); + geo.polygon_ram0 = auto_alloc_array(machine, UINT32, 0x8000); + geo.polygon_ram1 = auto_alloc_array(machine, UINT32, 0x8000); } /******************************************* @@ -2707,10 +2707,10 @@ VIDEO_START(model2) add_exit_callback(machine, model2_exit); /* initialize the geometry engine */ - geo_init( (UINT32*)memory_region(machine, "user2") ); + geo_init( machine, (UINT32*)memory_region(machine, "user2") ); /* initialize the hardware rasterizer */ - model2_3d_init( (UINT16*)memory_region(machine, "user3") ); + model2_3d_init( machine, (UINT16*)memory_region(machine, "user3") ); } static void convert_bitmap( running_machine *machine, bitmap_t *dst, bitmap_t *src, const rectangle *rect ) diff --git a/src/mame/video/model3.c b/src/mame/video/model3.c index 0e249197c30..b5932648067 100644 --- a/src/mame/video/model3.c +++ b/src/mame/video/model3.c @@ -172,34 +172,25 @@ VIDEO_START( model3 ) width = video_screen_get_width(machine->primary_screen); height = video_screen_get_height(machine->primary_screen); bitmap3d = video_screen_auto_bitmap_alloc(machine->primary_screen); - zbuffer = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED32); + zbuffer = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED32); - m3_char_ram = auto_malloc(0x100000); - m3_tile_ram = auto_malloc(0x8000); + m3_char_ram = auto_alloc_array_clear(machine, UINT64, 0x100000/8); + m3_tile_ram = auto_alloc_array_clear(machine, UINT64, 0x8000/8); - memset(m3_char_ram, 0, 0x100000); - memset(m3_tile_ram, 0, 0x8000); + pal_lookup = auto_alloc_array_clear(machine, UINT16, 65536); - pal_lookup = auto_malloc(65536*2); - memset(pal_lookup, 0, 65536*2); - - texture_fifo = auto_malloc(0x100000); + texture_fifo = auto_alloc_array_clear(machine, UINT32, 0x100000/4); /* 2x 4MB texture sheets */ - texture_ram[0] = auto_malloc(0x400000); - texture_ram[1] = auto_malloc(0x400000); + texture_ram[0] = auto_alloc_array(machine, UINT16, 0x400000/2); + texture_ram[1] = auto_alloc_array(machine, UINT16, 0x400000/2); /* 1MB Display List RAM */ - display_list_ram = auto_malloc(0x100000); + display_list_ram = auto_alloc_array_clear(machine, UINT32, 0x100000/4); /* 4MB for nodes (< Step 2.0 have only 2MB) */ - culling_ram = auto_malloc(0x400000); + culling_ram = auto_alloc_array_clear(machine, UINT32, 0x400000/4); /* 4MB Polygon RAM */ - polygon_ram = auto_malloc(0x400000); - - memset(display_list_ram, 0, 0x100000); - memset(culling_ram, 0, 0x400000); - memset(polygon_ram, 0, 0x400000); - memset(texture_fifo, 0, 0x100000); + polygon_ram = auto_alloc_array_clear(machine, UINT32, 0x400000/4); tick = 0; debug_layer_disable = 0; @@ -583,7 +574,7 @@ static cached_texture *get_texture(int page, int texx, int texy, int texwidth, i return tex; /* create a new texture */ - tex = malloc_or_die(sizeof(cached_texture) + (2 * pixwidth * 2 * pixheight) * sizeof(rgb_t)); + tex = (cached_texture *)alloc_array_or_die(UINT8, sizeof(cached_texture) + (2 * pixwidth * 2 * pixheight) * sizeof(rgb_t)); tex->width = texwidth; tex->height = texheight; tex->format = format; diff --git a/src/mame/video/mole.c b/src/mame/video/mole.c index 08af79419e1..54a035cb8a8 100644 --- a/src/mame/video/mole.c +++ b/src/mame/video/mole.c @@ -29,7 +29,7 @@ static TILE_GET_INFO( get_bg_tile_info ) VIDEO_START( mole ) { - tileram = (UINT16 *)auto_malloc(0x400 * sizeof(UINT16)); + tileram = auto_alloc_array(machine, UINT16, 0x400); bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 40, 25); } diff --git a/src/mame/video/munchmo.c b/src/mame/video/munchmo.c index 091f3fb993e..09f5b5547fa 100644 --- a/src/mame/video/munchmo.c +++ b/src/mame/video/munchmo.c @@ -50,7 +50,7 @@ WRITE8_HANDLER( mnchmobl_flipscreen_w ) VIDEO_START( mnchmobl ) { - tmpbitmap = auto_bitmap_alloc(512,512,video_screen_get_format(machine->primary_screen)); + tmpbitmap = auto_bitmap_alloc(machine,512,512,video_screen_get_format(machine->primary_screen)); } static void draw_status(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) diff --git a/src/mame/video/mystwarr.c b/src/mame/video/mystwarr.c index 847902985d1..be921a7bac9 100644 --- a/src/mame/video/mystwarr.c +++ b/src/mame/video/mystwarr.c @@ -30,7 +30,7 @@ static void mystwarr_decode_tiles(running_machine *machine) break; assert(gfxnum != ARRAY_LENGTH(machine->gfx)); - decoded = auto_malloc(len); + decoded = auto_alloc_array(machine, UINT8, len); d = decoded; // now convert the data into a drawable format so we can decode it diff --git a/src/mame/video/n64.c b/src/mame/video/n64.c index d9109089b4d..d8ea30029d4 100644 --- a/src/mame/video/n64.c +++ b/src/mame/video/n64.c @@ -262,7 +262,7 @@ VIDEO_START(n64) if (LOG_RDP_EXECUTION) rdp_exec = fopen("rdp_execute.txt", "wt"); - texture_cache = auto_malloc(0x100000); + texture_cache = auto_alloc_array(machine, UINT8, 0x100000); combiner_rgbsub_a_r[0] = combiner_rgbsub_a_r[1] = &one_color.r; combiner_rgbsub_a_g[0] = combiner_rgbsub_a_g[1] = &one_color.g; diff --git a/src/mame/video/namcofl.c b/src/mame/video/namcofl.c index c60a4550171..b3ba936bfb6 100644 --- a/src/mame/video/namcofl.c +++ b/src/mame/video/namcofl.c @@ -122,6 +122,6 @@ static int FLobjcode2tile( int code ) VIDEO_START( namcofl ) { namco_tilemap_init( machine, NAMCONB1_TILEGFX, memory_region(machine, NAMCONB1_TILEMASKREGION), TilemapCB ); - namco_obj_init(NAMCONB1_SPRITEGFX,0x0,FLobjcode2tile); + namco_obj_init(machine,NAMCONB1_SPRITEGFX,0x0,FLobjcode2tile); namco_roz_init(machine,NAMCONB1_ROTGFX,NAMCONB1_ROTMASKREGION); } diff --git a/src/mame/video/namcona1.c b/src/mame/video/namcona1.c index d1143f21c86..e850956b0c6 100644 --- a/src/mame/video/namcona1.c +++ b/src/mame/video/namcona1.c @@ -292,8 +292,8 @@ VIDEO_START( namcona1 ) tilemap_palette_bank[i] = -1; } - shaperam = auto_malloc( 0x2000*4 ); - cgram = auto_malloc( 0x1000*0x40 ); + shaperam = auto_alloc_array(machine, UINT16, 0x2000*4/2 ); + cgram = auto_alloc_array(machine, UINT16, 0x1000*0x40/2 ); machine->gfx[0] = gfx_element_alloc( machine, &cg_layout_8bpp, (UINT8 *)cgram, machine->config->total_colors/256, 0 ); machine->gfx[1] = gfx_element_alloc( machine, &cg_layout_4bpp, (UINT8 *)cgram, machine->config->total_colors/16, 0 ); diff --git a/src/mame/video/namconb1.c b/src/mame/video/namconb1.c index df9bc5d1b19..71630146bff 100644 --- a/src/mame/video/namconb1.c +++ b/src/mame/video/namconb1.c @@ -166,7 +166,7 @@ NB1objcode2tile( int code ) VIDEO_START( namconb1 ) { namco_tilemap_init( machine, NAMCONB1_TILEGFX, memory_region(machine, NAMCONB1_TILEMASKREGION), NB1TilemapCB ); - namco_obj_init(NAMCONB1_SPRITEGFX,0x0,NB1objcode2tile); + namco_obj_init(machine,NAMCONB1_SPRITEGFX,0x0,NB1objcode2tile); } /* namconb1 */ /****************************************************************************************************/ @@ -228,6 +228,6 @@ NB2objcode2tile( int code ) VIDEO_START( namconb2 ) { namco_tilemap_init(machine, NAMCONB1_TILEGFX, memory_region(machine, NAMCONB1_TILEMASKREGION), NB2TilemapCB ); - namco_obj_init(NAMCONB1_SPRITEGFX,0x0,NB2objcode2tile); + namco_obj_init(machine,NAMCONB1_SPRITEGFX,0x0,NB2objcode2tile); namco_roz_init(machine, NAMCONB1_ROTGFX,NAMCONB1_ROTMASKREGION); } /* namconb2_vh_start */ diff --git a/src/mame/video/namcos1.c b/src/mame/video/namcos1.c index d224dba8df3..c97fd64f120 100644 --- a/src/mame/video/namcos1.c +++ b/src/mame/video/namcos1.c @@ -105,8 +105,8 @@ VIDEO_START( namcos1 ) tilemap_maskdata = (UINT8 *)memory_region(machine, "gfx1"); /* allocate videoram */ - namcos1_videoram = auto_malloc(0x8000); - namcos1_spriteram = auto_malloc(0x1000); + namcos1_videoram = auto_alloc_array(machine, UINT8, 0x8000); + namcos1_spriteram = auto_alloc_array(machine, UINT8, 0x1000); /* initialize playfields */ bg_tilemap[0] = tilemap_create(machine, bg_get_info0,tilemap_scan_rows,8,8,64,64); diff --git a/src/mame/video/namcos2.c b/src/mame/video/namcos2.c index 7bf19f4334c..d80a42a1502 100644 --- a/src/mame/video/namcos2.c +++ b/src/mame/video/namcos2.c @@ -394,7 +394,7 @@ VIDEO_UPDATE( finallap ) VIDEO_START( luckywld ) { namco_tilemap_init(machine,2,memory_region(machine, "gfx4"),TilemapCB); - namco_obj_init( 0, 0x0, NULL ); + namco_obj_init( machine, 0, 0x0, NULL ); if( namcos2_gametype==NAMCOS2_LUCKY_AND_WILD ) { namco_roz_init( machine, 1, "gfx5" ); @@ -435,7 +435,7 @@ VIDEO_UPDATE( luckywld ) VIDEO_START( sgunner ) { namco_tilemap_init(machine,2,memory_region(machine, "gfx4"),TilemapCB); - namco_obj_init( 0, 0x0, NULL ); + namco_obj_init( machine, 0, 0x0, NULL ); } VIDEO_UPDATE( sgunner ) diff --git a/src/mame/video/namcos21.c b/src/mame/video/namcos21.c index d5c3602f4c8..1be034a3e18 100644 --- a/src/mame/video/namcos21.c +++ b/src/mame/video/namcos21.c @@ -64,13 +64,13 @@ READ16_HANDLER( winrun_gpu_videoram_r ) } /* winrun_gpu_videoram_r */ static void -AllocatePolyFrameBuffer( void ) +AllocatePolyFrameBuffer( running_machine *machine ) { - mpPolyFrameBufferZ = auto_malloc( FRAMEBUFFER_SIZE_IN_BYTES ); - mpPolyFrameBufferPens = auto_malloc( FRAMEBUFFER_SIZE_IN_BYTES ); + mpPolyFrameBufferZ = auto_alloc_array(machine, UINT16, FRAMEBUFFER_SIZE_IN_BYTES/2 ); + mpPolyFrameBufferPens = auto_alloc_array(machine, UINT16, FRAMEBUFFER_SIZE_IN_BYTES/2 ); - mpPolyFrameBufferZ2 = auto_malloc( FRAMEBUFFER_SIZE_IN_BYTES ); - mpPolyFrameBufferPens2 = auto_malloc( FRAMEBUFFER_SIZE_IN_BYTES ); + mpPolyFrameBufferZ2 = auto_alloc_array(machine, UINT16, FRAMEBUFFER_SIZE_IN_BYTES/2 ); + mpPolyFrameBufferPens2 = auto_alloc_array(machine, UINT16, FRAMEBUFFER_SIZE_IN_BYTES/2 ); namcos21_ClearPolyFrameBuffer(); namcos21_ClearPolyFrameBuffer(); @@ -129,10 +129,10 @@ VIDEO_START( namcos21 ) { if( namcos2_gametype == NAMCOS21_WINRUN91 ) { - videoram = auto_malloc(0x80000); + videoram = auto_alloc_array(machine, UINT8, 0x80000); } - AllocatePolyFrameBuffer(); - namco_obj_init( + AllocatePolyFrameBuffer(machine); + namco_obj_init(machine, 0, /* gfx bank */ 0xf, /* reverse palette mapping */ objcode2tile ); diff --git a/src/mame/video/namcos22.c b/src/mame/video/namcos22.c index 4e19a913c85..3e0f3c315b4 100644 --- a/src/mame/video/namcos22.c +++ b/src/mame/video/namcos22.c @@ -826,7 +826,7 @@ FreeSceneNode( struct SceneNode *node ) } /* FreeSceneNode */ static struct SceneNode * -MallocSceneNode( void ) +MallocSceneNode( running_machine *machine ) { struct SceneNode *node = mpFreeSceneNode; if( node ) @@ -836,14 +836,14 @@ MallocSceneNode( void ) else { #define SCENE_NODE_POOL_SIZE 64 - struct SceneNode *pSceneNodePool = auto_malloc(sizeof(struct SceneNode)*SCENE_NODE_POOL_SIZE); + struct SceneNode *pSceneNodePool = auto_alloc_array(machine, struct SceneNode, SCENE_NODE_POOL_SIZE); { int i; for( i=0; i<SCENE_NODE_POOL_SIZE; i++ ) { FreeSceneNode( &pSceneNodePool[i] ); } - return MallocSceneNode(); + return MallocSceneNode(machine); } } memset( node, 0, sizeof(*node) ); @@ -851,7 +851,7 @@ MallocSceneNode( void ) } /* MallocSceneNode */ static struct SceneNode * -NewSceneNode( UINT32 zsortvalue24, SceneNodeType type ) +NewSceneNode( running_machine *machine, UINT32 zsortvalue24, SceneNodeType type ) { struct SceneNode *node = &mSceneRoot; int i; @@ -861,7 +861,7 @@ NewSceneNode( UINT32 zsortvalue24, SceneNodeType type ) struct SceneNode *next = node->data.nonleaf.next[hash]; if( !next ) { /* lazily allocate tree node for this radix */ - next = MallocSceneNode(); + next = MallocSceneNode(machine); next->type = eSCENENODE_NONLEAF; node->data.nonleaf.next[hash] = next; } @@ -876,7 +876,7 @@ NewSceneNode( UINT32 zsortvalue24, SceneNodeType type ) } else { - struct SceneNode *leaf = MallocSceneNode(); + struct SceneNode *leaf = MallocSceneNode(machine); leaf->type = type; #if 0 leaf->nextInBucket = node->nextInBucket; @@ -1125,7 +1125,7 @@ PatchTexture( void ) } /* PatchTexture */ void -namcos22_draw_direct_poly( const UINT16 *pSource ) +namcos22_draw_direct_poly( running_machine *machine, const UINT16 *pSource ) { /** * word#0: @@ -1153,7 +1153,7 @@ namcos22_draw_direct_poly( const UINT16 *pSource ) * --xx xxxx // zpos */ INT32 zsortvalue24 = ((pSource[1]&0xfff)<<12)|(pSource[0]&0xfff); - struct SceneNode *node = NewSceneNode(zsortvalue24,eSCENENODE_QUAD3D); + struct SceneNode *node = NewSceneNode(machine, zsortvalue24,eSCENENODE_QUAD3D); int i; node->data.quad3d.flags = ((pSource[3]&0x7f00)*2)|(pSource[3]&3); node->data.quad3d.cmode = (pSource[2]&0x00f0)>>4; @@ -1216,13 +1216,13 @@ namcos22_draw_direct_poly( const UINT16 *pSource ) } /* namcos22_draw_direct_poly */ static void -Prepare3dTexture( void *pTilemapROM, void *pTextureROM ) +Prepare3dTexture( running_machine *machine, void *pTilemapROM, void *pTextureROM ) { int i; assert( pTilemapROM && pTextureROM ); { /* following setup is Namco System 22 specific */ const UINT8 *pPackedTileAttr = 0x200000 + (UINT8 *)pTilemapROM; - UINT8 *pUnpackedTileAttr = auto_malloc(0x080000*2); + UINT8 *pUnpackedTileAttr = auto_alloc_array(machine, UINT8, 0x080000*2); { InitXYAttrToPixel(); mpTextureTileMapAttr = pUnpackedTileAttr; @@ -1241,6 +1241,7 @@ Prepare3dTexture( void *pTilemapROM, void *pTextureROM ) static void DrawSpritesHelper( + running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, const UINT32 *pSource, @@ -1312,7 +1313,7 @@ DrawSpritesHelper( } { - struct SceneNode *node = NewSceneNode(zcoord,eSCENENODE_SPRITE); + struct SceneNode *node = NewSceneNode(machine, zcoord,eSCENENODE_SPRITE); node->data.sprite.tile = tile; node->data.sprite.pri = cz&0x80; // node->data.sprite.pri = (color&0x80); @@ -1336,7 +1337,7 @@ DrawSpritesHelper( } /* DrawSpritesHelper */ static void -DrawSprites( bitmap_t *bitmap, const rectangle *cliprect ) +DrawSprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect ) { /* // time crisis: @@ -1422,7 +1423,7 @@ DrawSprites( bitmap_t *bitmap, const rectangle *cliprect ) if( enable==6 /*&& namcos22_gametype!=NAMCOS22_AIR_COMBAT22*/ ) { - DrawSpritesHelper( bitmap, cliprect, pSource, pPal, num_sprites, deltax, deltay ); + DrawSpritesHelper( machine, bitmap, cliprect, pSource, pPal, num_sprites, deltax, deltay ); } /* VICS RAM provides two additional banks */ @@ -1445,7 +1446,7 @@ DrawSprites( bitmap_t *bitmap, const rectangle *cliprect ) { pSource = &namcos22_vics_data[(namcos22_vics_control[0x48/4]&0xffff)/4]; pPal = &namcos22_vics_data[(namcos22_vics_control[0x58/4]&0xffff)/4]; - DrawSpritesHelper( bitmap, cliprect, pSource, pPal, num_sprites, deltax, deltay ); + DrawSpritesHelper( machine, bitmap, cliprect, pSource, pPal, num_sprites, deltax, deltay ); } num_sprites = (namcos22_vics_control[0x60/4]&0xffff)/0x10; @@ -1453,7 +1454,7 @@ DrawSprites( bitmap_t *bitmap, const rectangle *cliprect ) { pSource = &namcos22_vics_data[(namcos22_vics_control[0x68/4]&0xffff)/4]; pPal = &namcos22_vics_data[(namcos22_vics_control[0x78/4]&0xffff)/4]; - DrawSpritesHelper( bitmap, cliprect, pSource, pPal, num_sprites, deltax, deltay ); + DrawSpritesHelper( machine, bitmap, cliprect, pSource, pPal, num_sprites, deltax, deltay ); } } /* DrawSprites */ @@ -1613,6 +1614,7 @@ Signed18( UINT32 value ) */ static void BlitQuadHelper( + running_machine *machine, bitmap_t *bitmap, unsigned color, unsigned addr, @@ -1729,7 +1731,7 @@ BlitQuadHelper( zsortvalue24 |= (absolutePriority<<21); { - struct SceneNode *node = NewSceneNode(zsortvalue24,eSCENENODE_QUAD3D); + struct SceneNode *node = NewSceneNode(machine, zsortvalue24,eSCENENODE_QUAD3D); node->data.quad3d.cmode = (v[0].u>>12)&0xf; node->data.quad3d.textureBank = (v[0].v>>12)&0xf; node->data.quad3d.color = (color>>8)&0xff; @@ -1779,7 +1781,7 @@ RegisterNormals( INT32 addr, float m[4][4] ) } /* RegisterNormals */ static void -BlitQuads( bitmap_t *bitmap, INT32 addr, float m[4][4], INT32 base ) +BlitQuads( running_machine *machine, bitmap_t *bitmap, INT32 addr, float m[4][4], INT32 base ) { int numAdditionalNormals = 0; int chunkLength = GetPolyData(addr++); @@ -1833,7 +1835,7 @@ BlitQuads( bitmap_t *bitmap, INT32 addr, float m[4][4], INT32 base ) flags = GetPolyData(addr+1); color = GetPolyData(addr+2); bias = 0; - BlitQuadHelper( bitmap,color,addr+3,m,bias,flags,packetFormat ); + BlitQuadHelper( machine,bitmap,color,addr+3,m,bias,flags,packetFormat ); break; case 0x18: @@ -1846,7 +1848,7 @@ BlitQuads( bitmap_t *bitmap, INT32 addr, float m[4][4], INT32 base ) flags = GetPolyData(addr+1); color = GetPolyData(addr+2); bias = GetPolyData(addr+3); - BlitQuadHelper( bitmap,color,addr+4,m,bias,flags,packetFormat ); + BlitQuadHelper( machine,bitmap,color,addr+4,m,bias,flags,packetFormat ); break; case 0x10: /* vertex lighting */ @@ -1884,7 +1886,7 @@ BlitQuads( bitmap_t *bitmap, INT32 addr, float m[4][4], INT32 base ) } /* BlitQuads */ static void -BlitPolyObject( bitmap_t *bitmap, int code, float M[4][4] ) +BlitPolyObject( running_machine *machine, bitmap_t *bitmap, int code, float M[4][4] ) { unsigned addr1 = GetPolyData(code); mLitSurfaceCount = 0; @@ -1894,7 +1896,7 @@ BlitPolyObject( bitmap_t *bitmap, int code, float M[4][4] ) INT32 addr2 = GetPolyData(addr1++); if( addr2<0 ) break; - BlitQuads( bitmap, addr2, M, code ); + BlitQuads( machine, bitmap, addr2, M, code ); } } /* BlitPolyObject */ @@ -2002,7 +2004,7 @@ HandleBB0003( const INT32 *pSource ) } /* HandleBB0003 */ static void -Handle200002( bitmap_t *bitmap, const INT32 *pSource ) +Handle200002( running_machine *machine, bitmap_t *bitmap, const INT32 *pSource ) { if( mPrimitiveID>=0x45 ) { @@ -2027,7 +2029,7 @@ Handle200002( bitmap_t *bitmap, const INT32 *pSource ) m[3][2] = pSource[0xc]; /* zpos */ matrix3d_Multiply( m, mViewMatrix ); - BlitPolyObject( bitmap, mPrimitiveID, m ); + BlitPolyObject( machine, bitmap, mPrimitiveID, m ); } else if( mPrimitiveID !=0 && mPrimitiveID !=2 ) { @@ -2068,7 +2070,7 @@ Handle233002( const INT32 *pSource ) } /* Handle233002 */ static void -SimulateSlaveDSP( bitmap_t *bitmap ) +SimulateSlaveDSP( running_machine *machine, bitmap_t *bitmap ) { const INT32 *pSource = 0x300 + (INT32 *)namcos22_polygonram; INT16 len; @@ -2105,7 +2107,7 @@ SimulateSlaveDSP( bitmap_t *bitmap ) break; case 0x0d: - Handle200002( bitmap, pSource ); /* render primitive */ + Handle200002( machine, bitmap, pSource ); /* render primitive */ break; default: @@ -2133,11 +2135,11 @@ SimulateSlaveDSP( bitmap_t *bitmap ) } /* SimulateSlaveDSP */ static void -DrawPolygons( bitmap_t *bitmap ) +DrawPolygons( running_machine *machine, bitmap_t *bitmap ) { if( mbDSPisActive ) { - SimulateSlaveDSP( bitmap ); + SimulateSlaveDSP( machine, bitmap ); poly_wait(poly, "DrawPolygons"); } } /* DrawPolygons */ @@ -2205,8 +2207,8 @@ static VIDEO_START( common ) for (code = 0; code < machine->gfx[GFX_TEXTURE_TILE]->total_elements; code++) gfx_element_decode(machine->gfx[GFX_TEXTURE_TILE], code); - Prepare3dTexture(memory_region(machine, "textilemap"), machine->gfx[GFX_TEXTURE_TILE]->gfxdata ); - dirtypal = auto_malloc(NAMCOS22_PALETTE_SIZE/4); + Prepare3dTexture(machine, memory_region(machine, "textilemap"), machine->gfx[GFX_TEXTURE_TILE]->gfxdata ); + dirtypal = auto_alloc_array(machine, UINT8, NAMCOS22_PALETTE_SIZE/4); mPtRomSize = memory_region_length(machine, "pointrom")/3; mpPolyL = memory_region(machine, "pointrom"); mpPolyM = mpPolyL + mPtRomSize; @@ -2232,10 +2234,10 @@ VIDEO_START( namcos22 ) VIDEO_START( namcos22s ) { mbSuperSystem22 = 1; - namcos22_czram[0] = auto_malloc( 0x200 ); - namcos22_czram[1] = auto_malloc( 0x200 ); - namcos22_czram[2] = auto_malloc( 0x200 ); - namcos22_czram[3] = auto_malloc( 0x200 ); + namcos22_czram[0] = auto_alloc_array(machine, UINT16, 0x200/2 ); + namcos22_czram[1] = auto_alloc_array(machine, UINT16, 0x200/2 ); + namcos22_czram[2] = auto_alloc_array(machine, UINT16, 0x200/2 ); + namcos22_czram[3] = auto_alloc_array(machine, UINT16, 0x200/2 ); VIDEO_START_CALL(common); } @@ -2247,8 +2249,8 @@ VIDEO_UPDATE( namcos22s ) bitmap_fill( bitmap, cliprect , bgColor); UpdatePaletteS(screen->machine); DrawCharacterLayer(screen->machine, bitmap, cliprect ); - DrawPolygons( bitmap ); - DrawSprites( bitmap, cliprect ); + DrawPolygons( screen->machine, bitmap ); + DrawSprites( screen->machine, bitmap, cliprect ); RenderScene(screen->machine, bitmap ); DrawTranslucentCharacters( bitmap, cliprect ); ApplyGamma( screen->machine, bitmap ); @@ -2298,7 +2300,7 @@ VIDEO_UPDATE( namcos22 ) bitmap_fill( bitmap, cliprect , get_black_pen(screen->machine)); UpdatePalette(screen->machine); DrawCharacterLayer(screen->machine, bitmap, cliprect ); - DrawPolygons( bitmap ); + DrawPolygons( screen->machine, bitmap ); RenderScene(screen->machine, bitmap); DrawTranslucentCharacters( bitmap, cliprect ); ApplyGamma( screen->machine, bitmap ); diff --git a/src/mame/video/naughtyb.c b/src/mame/video/naughtyb.c index 244177b2331..6130853185a 100644 --- a/src/mame/video/naughtyb.c +++ b/src/mame/video/naughtyb.c @@ -110,7 +110,7 @@ VIDEO_START( naughtyb ) palreg = bankreg = 0; /* Naughty Boy has a virtual screen twice as large as the visible screen */ - tmpbitmap = auto_bitmap_alloc(68*8,28*8,video_screen_get_format(machine->primary_screen)); + tmpbitmap = auto_bitmap_alloc(machine,68*8,28*8,video_screen_get_format(machine->primary_screen)); } diff --git a/src/mame/video/nbmj8688.c b/src/mame/video/nbmj8688.c index 38b9d4364e3..bbd11611bac 100644 --- a/src/mame/video/nbmj8688.c +++ b/src/mame/video/nbmj8688.c @@ -561,10 +561,9 @@ static void mbmj8688_gfxdraw(running_machine *machine, int gfxtype) static void common_video_start(running_machine *machine) { - mjsikaku_tmpbitmap = auto_bitmap_alloc(512, 256, video_screen_get_format(machine->primary_screen)); - mjsikaku_videoram = auto_malloc(512 * 256 * sizeof(UINT16)); - nbmj8688_clut = auto_malloc(0x20 * sizeof(UINT8)); - memset(mjsikaku_videoram, 0, (512 * 256 * sizeof(UINT16))); + mjsikaku_tmpbitmap = auto_bitmap_alloc(machine, 512, 256, video_screen_get_format(machine->primary_screen)); + mjsikaku_videoram = auto_alloc_array_clear(machine, UINT16, 512 * 256); + nbmj8688_clut = auto_alloc_array(machine, UINT8, 0x20); mjsikaku_scrolly = 0; // reset because crystalg/crystal2 don't write to this register } @@ -603,8 +602,8 @@ VIDEO_START( mbmj8688_pure_16bit_LCD ) { mjsikaku_gfxmode = GFXTYPE_PURE_16BIT; - HD61830B_ram[0] = auto_malloc(0x10000); - HD61830B_ram[1] = auto_malloc(0x10000); + HD61830B_ram[0] = auto_alloc_array(machine, UINT8, 0x10000); + HD61830B_ram[1] = auto_alloc_array(machine, UINT8, 0x10000); common_video_start(machine); } diff --git a/src/mame/video/nbmj8891.c b/src/mame/video/nbmj8891.c index 9772c816859..54b9eefc0d3 100644 --- a/src/mame/video/nbmj8891.c +++ b/src/mame/video/nbmj8891.c @@ -501,9 +501,9 @@ VIDEO_START( nbmj8891_1layer ) int height = video_screen_get_height(machine->primary_screen); nbmj8891_tmpbitmap0 = video_screen_auto_bitmap_alloc(machine->primary_screen); - nbmj8891_videoram0 = auto_malloc(width * height * sizeof(char)); - nbmj8891_palette = auto_malloc(0x200 * sizeof(char)); - nbmj8891_clut = auto_malloc(0x800 * sizeof(char)); + nbmj8891_videoram0 = auto_alloc_array(machine, UINT8, width * height); + nbmj8891_palette = auto_alloc_array(machine, UINT8, 0x200); + nbmj8891_clut = auto_alloc_array(machine, UINT8, 0x800); memset(nbmj8891_videoram0, 0xff, (width * height * sizeof(char))); gfxdraw_mode = 0; @@ -518,10 +518,10 @@ VIDEO_START( nbmj8891_2layer ) nbmj8891_tmpbitmap0 = video_screen_auto_bitmap_alloc(machine->primary_screen); nbmj8891_tmpbitmap1 = video_screen_auto_bitmap_alloc(machine->primary_screen); - nbmj8891_videoram0 = auto_malloc(width * height * sizeof(UINT8)); - nbmj8891_videoram1 = auto_malloc(width * height * sizeof(UINT8)); - nbmj8891_palette = auto_malloc(0x200 * sizeof(UINT8)); - nbmj8891_clut = auto_malloc(0x800 * sizeof(UINT8)); + nbmj8891_videoram0 = auto_alloc_array(machine, UINT8, width * height); + nbmj8891_videoram1 = auto_alloc_array(machine, UINT8, width * height); + nbmj8891_palette = auto_alloc_array(machine, UINT8, 0x200); + nbmj8891_clut = auto_alloc_array(machine, UINT8, 0x800); memset(nbmj8891_videoram0, 0xff, (width * height * sizeof(UINT8))); memset(nbmj8891_videoram1, 0xff, (width * height * sizeof(UINT8))); gfxdraw_mode = 1; diff --git a/src/mame/video/nbmj8991.c b/src/mame/video/nbmj8991.c index 8a6a7d2d6a2..e180d8e5fe1 100644 --- a/src/mame/video/nbmj8991.c +++ b/src/mame/video/nbmj8991.c @@ -307,8 +307,8 @@ VIDEO_START( nbmj8991 ) int height = video_screen_get_height(machine->primary_screen); nbmj8991_tmpbitmap = video_screen_auto_bitmap_alloc(machine->primary_screen); - nbmj8991_videoram = auto_malloc(width * height * sizeof(UINT8)); - nbmj8991_clut = auto_malloc(0x800 * sizeof(UINT8)); + nbmj8991_videoram = auto_alloc_array(machine, UINT8, width * height); + nbmj8991_clut = auto_alloc_array(machine, UINT8, 0x800); memset(nbmj8991_videoram, 0x00, (width * height * sizeof(UINT8))); } diff --git a/src/mame/video/nbmj9195.c b/src/mame/video/nbmj9195.c index 509b7949c0b..45be30600df 100644 --- a/src/mame/video/nbmj9195.c +++ b/src/mame/video/nbmj9195.c @@ -413,10 +413,9 @@ VIDEO_START( nbmj9195_1layer ) int height = video_screen_get_height(machine->primary_screen); nbmj9195_tmpbitmap[0] = video_screen_auto_bitmap_alloc(machine->primary_screen); - nbmj9195_videoram[0] = auto_malloc(width * height * sizeof(UINT16)); - nbmj9195_palette = auto_malloc(0x200 * sizeof(UINT8)); - nbmj9195_clut[0] = auto_malloc(0x1000 * sizeof(UINT8)); - memset(nbmj9195_videoram[0], 0x0000, (width * height * sizeof(UINT16))); + nbmj9195_videoram[0] = auto_alloc_array_clear(machine, UINT16, width * height); + nbmj9195_palette = auto_alloc_array(machine, UINT8, 0x200); + nbmj9195_clut[0] = auto_alloc_array(machine, UINT8, 0x1000); nbmj9195_scanline[0] = nbmj9195_scanline[1] = SCANLINE_MIN; nb19010_busyflag = 1; gfxdraw_mode = 0; @@ -429,13 +428,11 @@ VIDEO_START( nbmj9195_2layer ) nbmj9195_tmpbitmap[0] = video_screen_auto_bitmap_alloc(machine->primary_screen); nbmj9195_tmpbitmap[1] = video_screen_auto_bitmap_alloc(machine->primary_screen); - nbmj9195_videoram[0] = auto_malloc(width * height * sizeof(UINT16)); - nbmj9195_videoram[1] = auto_malloc(width * height * sizeof(UINT16)); - nbmj9195_palette = auto_malloc(0x200 * sizeof(UINT8)); - nbmj9195_clut[0] = auto_malloc(0x1000 * sizeof(UINT8)); - nbmj9195_clut[1] = auto_malloc(0x1000 * sizeof(UINT8)); - memset(nbmj9195_videoram[0], 0x0000, (width * height * sizeof(UINT16))); - memset(nbmj9195_videoram[1], 0x0000, (width * height * sizeof(UINT16))); + nbmj9195_videoram[0] = auto_alloc_array_clear(machine, UINT16, width * height); + nbmj9195_videoram[1] = auto_alloc_array_clear(machine, UINT16, width * height); + nbmj9195_palette = auto_alloc_array(machine, UINT8, 0x200); + nbmj9195_clut[0] = auto_alloc_array(machine, UINT8, 0x1000); + nbmj9195_clut[1] = auto_alloc_array(machine, UINT8, 0x1000); nbmj9195_scanline[0] = nbmj9195_scanline[1] = SCANLINE_MIN; nb19010_busyflag = 1; gfxdraw_mode = 1; @@ -448,17 +445,13 @@ VIDEO_START( nbmj9195_nb22090 ) nbmj9195_tmpbitmap[0] = video_screen_auto_bitmap_alloc(machine->primary_screen); nbmj9195_tmpbitmap[1] = video_screen_auto_bitmap_alloc(machine->primary_screen); - nbmj9195_videoram[0] = auto_malloc(width * height * sizeof(UINT16)); - nbmj9195_videoram[1] = auto_malloc(width * height * sizeof(UINT16)); - nbmj9195_videoworkram[0] = auto_malloc(width * height * sizeof(UINT16)); - nbmj9195_videoworkram[1] = auto_malloc(width * height * sizeof(UINT16)); - nbmj9195_nb22090_palette = auto_malloc(0xc00 * sizeof(UINT8)); - nbmj9195_clut[0] = auto_malloc(0x1000 * sizeof(UINT8)); - nbmj9195_clut[1] = auto_malloc(0x1000 * sizeof(UINT8)); - memset(nbmj9195_videoram[0], 0x0000, (width * height * sizeof(UINT16))); - memset(nbmj9195_videoram[1], 0x0000, (width * height * sizeof(UINT16))); - memset(nbmj9195_videoworkram[0], 0x0000, (width * height * sizeof(UINT16))); - memset(nbmj9195_videoworkram[1], 0x0000, (width * height * sizeof(UINT16))); + nbmj9195_videoram[0] = auto_alloc_array_clear(machine, UINT16, width * height); + nbmj9195_videoram[1] = auto_alloc_array_clear(machine, UINT16, width * height); + nbmj9195_videoworkram[0] = auto_alloc_array_clear(machine, UINT16, width * height); + nbmj9195_videoworkram[1] = auto_alloc_array_clear(machine, UINT16, width * height); + nbmj9195_nb22090_palette = auto_alloc_array(machine, UINT8, 0xc00); + nbmj9195_clut[0] = auto_alloc_array(machine, UINT8, 0x1000); + nbmj9195_clut[1] = auto_alloc_array(machine, UINT8, 0x1000); nbmj9195_scanline[0] = nbmj9195_scanline[1] = SCANLINE_MIN; nb19010_busyflag = 1; gfxdraw_mode = 2; diff --git a/src/mame/video/neogeo.c b/src/mame/video/neogeo.c index 772f762e102..b64ce75589a 100644 --- a/src/mame/video/neogeo.c +++ b/src/mame/video/neogeo.c @@ -708,8 +708,7 @@ static void optimize_sprite_data(running_machine *machine) sprite_gfx_address_mask >>= 1; } - sprite_gfx = auto_malloc(sprite_gfx_address_mask + 1); - memset(sprite_gfx, 0, sprite_gfx_address_mask + 1); + sprite_gfx = auto_alloc_array_clear(machine, UINT8, sprite_gfx_address_mask + 1); src = memory_region(machine, "sprites"); dest = sprite_gfx; @@ -858,10 +857,10 @@ WRITE16_HANDLER( neogeo_video_register_w ) VIDEO_START( neogeo ) { /* allocate memory not directly mapped */ - palettes[0] = auto_malloc(NUM_PENS * sizeof(UINT16)); - palettes[1] = auto_malloc(NUM_PENS * sizeof(UINT16)); - pens = auto_malloc(NUM_PENS * sizeof(pen_t)); - neogeo_videoram = auto_malloc(0x20000); + palettes[0] = auto_alloc_array(machine, UINT16, NUM_PENS); + palettes[1] = auto_alloc_array(machine, UINT16, NUM_PENS); + pens = auto_alloc_array(machine, pen_t, NUM_PENS); + neogeo_videoram = auto_alloc_array(machine, UINT16, 0x20000/2); /* clear allocated memory */ memset(palettes[0],0x00, NUM_PENS * sizeof(UINT16)); diff --git a/src/mame/video/ninjakd2.c b/src/mame/video/ninjakd2.c index 6fe9a180a00..f85d4290e09 100644 --- a/src/mame/video/ninjakd2.c +++ b/src/mame/video/ninjakd2.c @@ -126,19 +126,14 @@ static TILE_GET_INFO( robokid_get_bg2_tile_info ) * *************************************/ -static void videoram_alloc(const running_machine* const machine, int const size) +static void videoram_alloc(running_machine* const machine, int const size) { if (size) { /* create video ram */ - robokid_bg0_videoram = auto_malloc(size); - memset(robokid_bg0_videoram, 0x00, size); - - robokid_bg1_videoram = auto_malloc(size); - memset(robokid_bg1_videoram, 0x00, size); - - robokid_bg2_videoram = auto_malloc(size); - memset(robokid_bg2_videoram, 0x00, size); + robokid_bg0_videoram = auto_alloc_array_clear(machine, UINT8, size); + robokid_bg1_videoram = auto_alloc_array_clear(machine, UINT8, size); + robokid_bg2_videoram = auto_alloc_array_clear(machine, UINT8, size); } sp_bitmap = video_screen_auto_bitmap_alloc(machine->primary_screen); diff --git a/src/mame/video/ninjaw.c b/src/mame/video/ninjaw.c index eab61e514a5..29776852773 100644 --- a/src/mame/video/ninjaw.c +++ b/src/mame/video/ninjaw.c @@ -25,7 +25,7 @@ static VIDEO_START( ninjaw_core ) int chips; int mask; - spritelist = auto_malloc(0x1000 * sizeof(*spritelist)); + spritelist = auto_alloc_array(machine, struct tempsprite, 0x1000); chips = TC0100SCN_count(machine); diff --git a/src/mame/video/niyanpai.c b/src/mame/video/niyanpai.c index 4e2142607c8..cd41a7da903 100644 --- a/src/mame/video/niyanpai.c +++ b/src/mame/video/niyanpai.c @@ -382,22 +382,16 @@ VIDEO_START( niyanpai ) niyanpai_tmpbitmap[0] = video_screen_auto_bitmap_alloc(machine->primary_screen); niyanpai_tmpbitmap[1] = video_screen_auto_bitmap_alloc(machine->primary_screen); niyanpai_tmpbitmap[2] = video_screen_auto_bitmap_alloc(machine->primary_screen); - niyanpai_videoram[0] = auto_malloc(width * height * sizeof(short)); - niyanpai_videoram[1] = auto_malloc(width * height * sizeof(short)); - niyanpai_videoram[2] = auto_malloc(width * height * sizeof(short)); - niyanpai_videoworkram[0] = auto_malloc(width * height * sizeof(short)); - niyanpai_videoworkram[1] = auto_malloc(width * height * sizeof(short)); - niyanpai_videoworkram[2] = auto_malloc(width * height * sizeof(short)); - niyanpai_palette = auto_malloc(0x480 * sizeof(short)); - niyanpai_clut[0] = auto_malloc(0x1000 * sizeof(char)); - niyanpai_clut[1] = auto_malloc(0x1000 * sizeof(char)); - niyanpai_clut[2] = auto_malloc(0x1000 * sizeof(char)); - memset(niyanpai_videoram[0], 0x0000, (width * height * sizeof(short))); - memset(niyanpai_videoram[1], 0x0000, (width * height * sizeof(short))); - memset(niyanpai_videoram[2], 0x0000, (width * height * sizeof(short))); - memset(niyanpai_videoworkram[0], 0x0000, (width * height * sizeof(short))); - memset(niyanpai_videoworkram[1], 0x0000, (width * height * sizeof(short))); - memset(niyanpai_videoworkram[2], 0x0000, (width * height * sizeof(short))); + niyanpai_videoram[0] = auto_alloc_array_clear(machine, UINT16, width * height); + niyanpai_videoram[1] = auto_alloc_array_clear(machine, UINT16, width * height); + niyanpai_videoram[2] = auto_alloc_array_clear(machine, UINT16, width * height); + niyanpai_videoworkram[0] = auto_alloc_array_clear(machine, UINT16, width * height); + niyanpai_videoworkram[1] = auto_alloc_array_clear(machine, UINT16, width * height); + niyanpai_videoworkram[2] = auto_alloc_array_clear(machine, UINT16, width * height); + niyanpai_palette = auto_alloc_array(machine, UINT16, 0x480); + niyanpai_clut[0] = auto_alloc_array(machine, UINT8, 0x1000); + niyanpai_clut[1] = auto_alloc_array(machine, UINT8, 0x1000); + niyanpai_clut[2] = auto_alloc_array(machine, UINT8, 0x1000); nb19010_busyflag = 1; } diff --git a/src/mame/video/nmk16.c b/src/mame/video/nmk16.c index 8f49b7cd2de..5b0c2e7feaf 100644 --- a/src/mame/video/nmk16.c +++ b/src/mame/video/nmk16.c @@ -101,18 +101,15 @@ VIDEO_START( bioship ) { bg_tilemap = tilemap_create(machine, macross_get_bg_tile_info,bg_scan,16,16,256,32); tx_tilemap = tilemap_create(machine, macross_get_tx_tile_info,tilemap_scan_cols,8,8,32,32); - spriteram_old = auto_malloc(0x1000); - spriteram_old2 = auto_malloc(0x1000); - background_bitmap = auto_bitmap_alloc(8192,512,video_screen_get_format(machine->primary_screen)); + spriteram_old = auto_alloc_array_clear(machine, UINT16, 0x1000/2); + spriteram_old2 = auto_alloc_array_clear(machine, UINT16, 0x1000/2); + background_bitmap = auto_bitmap_alloc(machine,8192,512,video_screen_get_format(machine->primary_screen)); tilemap_set_transparent_pen(bg_tilemap,15); tilemap_set_transparent_pen(tx_tilemap,15); bioship_background_bank=0; redraw_bitmap = 1; - memset(spriteram_old,0,0x1000); - memset(spriteram_old2,0,0x1000); - videoshift = 0; /* 256x224 screen, no shift */ } @@ -121,15 +118,12 @@ VIDEO_START( strahl ) bg_tilemap = tilemap_create(machine, macross_get_bg_tile_info,bg_scan,16,16,256,32); fg_tilemap = tilemap_create(machine, strahl_get_fg_tile_info, bg_scan,16,16,256,32); tx_tilemap = tilemap_create(machine, macross_get_tx_tile_info,tilemap_scan_cols,8,8,32,32); - spriteram_old = auto_malloc(0x1000); - spriteram_old2 = auto_malloc(0x1000); + spriteram_old = auto_alloc_array_clear(machine, UINT16, 0x1000/2); + spriteram_old2 = auto_alloc_array_clear(machine, UINT16, 0x1000/2); tilemap_set_transparent_pen(fg_tilemap,15); tilemap_set_transparent_pen(tx_tilemap,15); - memset(spriteram_old,0,0x1000); - memset(spriteram_old2,0,0x1000); - videoshift = 0; /* 256x224 screen, no shift */ background_bitmap = NULL; } @@ -138,14 +132,11 @@ VIDEO_START( macross ) { bg_tilemap = tilemap_create(machine, macross_get_bg_tile_info,bg_scan,16,16,256,32); tx_tilemap = tilemap_create(machine, macross_get_tx_tile_info,tilemap_scan_cols,8,8,32,32); - spriteram_old = auto_malloc(0x1000); - spriteram_old2 = auto_malloc(0x1000); + spriteram_old = auto_alloc_array_clear(machine, UINT16, 0x1000/2); + spriteram_old2 = auto_alloc_array_clear(machine, UINT16, 0x1000/2); tilemap_set_transparent_pen(tx_tilemap,15); - memset(spriteram_old,0,0x1000); - memset(spriteram_old2,0,0x1000); - videoshift = 0; /* 256x224 screen, no shift */ background_bitmap = NULL; } @@ -154,15 +145,12 @@ VIDEO_START( gunnail ) { bg_tilemap = tilemap_create(machine, macross_get_bg_tile_info,bg_scan,16,16,256,32); tx_tilemap = tilemap_create(machine, macross_get_tx_tile_info,tilemap_scan_cols,8,8,64,32); - spriteram_old = auto_malloc(0x1000); - spriteram_old2 = auto_malloc(0x1000); + spriteram_old = auto_alloc_array_clear(machine, UINT16, 0x1000/2); + spriteram_old2 = auto_alloc_array_clear(machine, UINT16, 0x1000/2); tilemap_set_transparent_pen(tx_tilemap,15); tilemap_set_scroll_rows(bg_tilemap,512); - memset(spriteram_old,0,0x1000); - memset(spriteram_old2,0,0x1000); - videoshift = 64; /* 384x224 screen, leftmost 64 pixels have to be retrieved */ /* from the other side of the tilemap (!) */ background_bitmap = NULL; @@ -172,14 +160,11 @@ VIDEO_START( macross2 ) { bg_tilemap = tilemap_create(machine, macross_get_bg_tile_info,bg_scan,16,16,1024,128); tx_tilemap = tilemap_create(machine, macross_get_tx_tile_info,tilemap_scan_cols,8,8,64,32); - spriteram_old = auto_malloc(0x1000); - spriteram_old2 = auto_malloc(0x1000); + spriteram_old = auto_alloc_array_clear(machine, UINT16, 0x1000/2); + spriteram_old2 = auto_alloc_array_clear(machine, UINT16, 0x1000/2); tilemap_set_transparent_pen(tx_tilemap,15); - memset(spriteram_old,0,0x1000); - memset(spriteram_old2,0,0x1000); - videoshift = 64; /* 384x224 screen, leftmost 64 pixels have to be retrieved */ /* from the other side of the tilemap (!) */ background_bitmap = NULL; @@ -189,14 +174,11 @@ VIDEO_START( tdragon2 ) { bg_tilemap = tilemap_create(machine, macross_get_bg_tile_info,bg_scan_td2,16,16,1024,32); tx_tilemap = tilemap_create(machine, macross_get_tx_tile_info,tilemap_scan_cols,8,8,64,32); - spriteram_old = auto_malloc(0x1000); - spriteram_old2 = auto_malloc(0x1000); + spriteram_old = auto_alloc_array_clear(machine, UINT16, 0x1000/2); + spriteram_old2 = auto_alloc_array_clear(machine, UINT16, 0x1000/2); tilemap_set_transparent_pen(tx_tilemap,15); - memset(spriteram_old,0,0x1000); - memset(spriteram_old2,0,0x1000); - videoshift = 64; /* 384x224 screen, leftmost 64 pixels have to be retrieved */ /* from the other side of the tilemap (!) */ background_bitmap = NULL; @@ -205,11 +187,8 @@ VIDEO_START( tdragon2 ) VIDEO_START( bjtwin ) { bg_tilemap = tilemap_create(machine, bjtwin_get_bg_tile_info,tilemap_scan_cols,8,8,64,32); - spriteram_old = auto_malloc(0x1000); - spriteram_old2 = auto_malloc(0x1000); - - memset(spriteram_old,0,0x1000); - memset(spriteram_old2,0,0x1000); + spriteram_old = auto_alloc_array_clear(machine, UINT16, 0x1000/2); + spriteram_old2 = auto_alloc_array_clear(machine, UINT16, 0x1000/2); videoshift = 64; /* 384x224 screen, leftmost 64 pixels have to be retrieved */ /* from the other side of the tilemap (!) */ @@ -838,11 +817,8 @@ WRITE16_HANDLER( afega_vram_1_w ) VIDEO_START( afega ) { - spriteram_old = auto_malloc(0x1000); - spriteram_old2 = auto_malloc(0x1000); - memset(spriteram_old,0,0x1000); - memset(spriteram_old2,0,0x1000); - + spriteram_old = auto_alloc_array_clear(machine, UINT16, 0x1000/2); + spriteram_old2 = auto_alloc_array_clear(machine, UINT16, 0x1000/2); tilemap_0 = tilemap_create( machine, get_tile_info_0_4bit, afega_tilemap_scan_pages, @@ -860,10 +836,8 @@ VIDEO_START( afega ) VIDEO_START( grdnstrm ) { - spriteram_old = auto_malloc(0x1000); - spriteram_old2 = auto_malloc(0x1000); - memset(spriteram_old,0,0x1000); - memset(spriteram_old2,0,0x1000); + spriteram_old = auto_alloc_array_clear(machine, UINT16, 0x1000/2); + spriteram_old2 = auto_alloc_array_clear(machine, UINT16, 0x1000/2); tilemap_0 = tilemap_create( machine, get_tile_info_0_8bit, afega_tilemap_scan_pages, @@ -882,10 +856,8 @@ VIDEO_START( grdnstrm ) VIDEO_START( firehawk ) { - spriteram_old = auto_malloc(0x1000); - spriteram_old2 = auto_malloc(0x1000); - memset(spriteram_old,0,0x1000); - memset(spriteram_old2,0,0x1000); + spriteram_old = auto_alloc_array_clear(machine, UINT16, 0x1000/2); + spriteram_old2 = auto_alloc_array_clear(machine, UINT16, 0x1000/2); tilemap_0 = tilemap_create( machine, get_tile_info_0_8bit, firehawk_tilemap_scan_pages, diff --git a/src/mame/video/nycaptor.c b/src/mame/video/nycaptor.c index 2df095bea7a..1addf724ee4 100644 --- a/src/mame/video/nycaptor.c +++ b/src/mame/video/nycaptor.c @@ -70,7 +70,7 @@ static TILE_GET_INFO( get_tile_info ) VIDEO_START( nycaptor ) { - nycaptor_spriteram = auto_malloc (160); + nycaptor_spriteram = auto_alloc_array(machine, UINT8, 160); bg_tilemap = tilemap_create( machine, get_tile_info,tilemap_scan_rows,8,8,32,32 ); tilemap_set_transmask(bg_tilemap,0,0xf800,0x7ff); //split 0 @@ -78,8 +78,8 @@ VIDEO_START( nycaptor ) tilemap_set_transmask(bg_tilemap,2,0xfffc,0x0003);//split 2 tilemap_set_transmask(bg_tilemap,3,0xfff0,0x000f);//split 3 - paletteram = auto_malloc(0x200); - paletteram_2 = auto_malloc(0x200); + paletteram = auto_alloc_array(machine, UINT8, 0x200); + paletteram_2 = auto_alloc_array(machine, UINT8, 0x200); tilemap_set_scroll_cols(bg_tilemap,32); } diff --git a/src/mame/video/ojankohs.c b/src/mame/video/ojankohs.c index edccc283d36..3a7298ab11b 100644 --- a/src/mame/video/ojankohs.c +++ b/src/mame/video/ojankohs.c @@ -279,24 +279,24 @@ WRITE8_HANDLER( ojankoc_videoram_w ) VIDEO_START( ojankohs ) { ojankohs_tilemap = tilemap_create(machine, ojankohs_get_tile_info, tilemap_scan_rows, 8, 4, 64, 64); - ojankohs_videoram = auto_malloc(0x2000); - ojankohs_colorram = auto_malloc(0x1000); - ojankohs_paletteram = auto_malloc(0x800); + ojankohs_videoram = auto_alloc_array(machine, UINT8, 0x2000); + ojankohs_colorram = auto_alloc_array(machine, UINT8, 0x1000); + ojankohs_paletteram = auto_alloc_array(machine, UINT8, 0x800); } VIDEO_START( ojankoy ) { ojankohs_tilemap = tilemap_create(machine, ojankoy_get_tile_info, tilemap_scan_rows, 8, 4, 64, 64); - ojankohs_videoram = auto_malloc(0x2000); - ojankohs_colorram = auto_malloc(0x1000); - ojankohs_paletteram = auto_malloc(0x800); + ojankohs_videoram = auto_alloc_array(machine, UINT8, 0x2000); + ojankohs_colorram = auto_alloc_array(machine, UINT8, 0x1000); + ojankohs_paletteram = auto_alloc_array(machine, UINT8, 0x800); } VIDEO_START( ojankoc ) { ojankoc_tmpbitmap = video_screen_auto_bitmap_alloc(machine->primary_screen); - ojankohs_videoram = auto_malloc(0x8000); - ojankohs_paletteram = auto_malloc(0x20); + ojankohs_videoram = auto_alloc_array(machine, UINT8, 0x8000); + ojankohs_paletteram = auto_alloc_array(machine, UINT8, 0x20); } diff --git a/src/mame/video/othldrby.c b/src/mame/video/othldrby.c index 7ce34dceb63..47a80a00abf 100644 --- a/src/mame/video/othldrby.c +++ b/src/mame/video/othldrby.c @@ -63,8 +63,8 @@ VIDEO_START( othldrby ) bg_tilemap[1] = tilemap_create(machine, get_tile_info1,tilemap_scan_rows,16,16,32,32); bg_tilemap[2] = tilemap_create(machine, get_tile_info2,tilemap_scan_rows,16,16,32,32); - vram = auto_malloc(VIDEORAM_SIZE * sizeof(vram[0])); - buf_spriteram = auto_malloc(2*SPRITERAM_SIZE * sizeof(buf_spriteram[0])); + vram = auto_alloc_array(machine, UINT16, VIDEORAM_SIZE); + buf_spriteram = auto_alloc_array(machine, UINT16, 2*SPRITERAM_SIZE); buf_spriteram2 = buf_spriteram + SPRITERAM_SIZE; diff --git a/src/mame/video/othunder.c b/src/mame/video/othunder.c index d611ebc345c..9a3732e387a 100644 --- a/src/mame/video/othunder.c +++ b/src/mame/video/othunder.c @@ -24,7 +24,7 @@ VIDEO_START( othunder ) Multiply this by 32 to give room for the number of small sprites, which are what actually get put in the structure. */ - spritelist = auto_malloc(0x2000 * sizeof(*spritelist)); + spritelist = auto_alloc_array(machine, struct tempsprite, 0x2000); TC0100SCN_vh_start(machine,1,TC0100SCN_GFX_NUM,4,0,0,0,0,0,0); diff --git a/src/mame/video/pacland.c b/src/mame/video/pacland.c index fc75587aee2..c094a292cd4 100644 --- a/src/mame/video/pacland.c +++ b/src/mame/video/pacland.c @@ -125,9 +125,9 @@ PALETTE_INIT( pacland ) switch_palette(machine); /* precalculate transparency masks for sprites */ - transmask[0] = auto_malloc(64 * sizeof(transmask[0][0])); - transmask[1] = auto_malloc(64 * sizeof(transmask[0][0])); - transmask[2] = auto_malloc(64 * sizeof(transmask[0][0])); + transmask[0] = auto_alloc_array(machine, UINT32, 64); + transmask[1] = auto_alloc_array(machine, UINT32, 64); + transmask[2] = auto_alloc_array(machine, UINT32, 64); for (i = 0; i < 64; i++) { int palentry; diff --git a/src/mame/video/pastelg.c b/src/mame/video/pastelg.c index 4b0781b3a71..984478b7208 100644 --- a/src/mame/video/pastelg.c +++ b/src/mame/video/pastelg.c @@ -281,9 +281,8 @@ VIDEO_START( pastelg ) int width = video_screen_get_width(machine->primary_screen); int height = video_screen_get_height(machine->primary_screen); - pastelg_videoram = auto_malloc(width * height * sizeof(UINT8)); - pastelg_clut = auto_malloc(0x10 * sizeof(UINT8)); - memset(pastelg_videoram, 0x00, (width * height * sizeof(UINT8))); + pastelg_videoram = auto_alloc_array_clear(machine, UINT8, width * height); + pastelg_clut = auto_alloc_array(machine, UINT8, 0x10); } /****************************************************************************** diff --git a/src/mame/video/pgm.c b/src/mame/video/pgm.c index ff3dbd431f8..9eea9725500 100644 --- a/src/mame/video/pgm.c +++ b/src/mame/video/pgm.c @@ -326,16 +326,16 @@ VIDEO_START( pgm ) tilemap_set_transparent_pen(pgm_bg_tilemap,31); tilemap_set_scroll_rows(pgm_bg_tilemap,64*32); - tmppgmbitmap = auto_bitmap_alloc(448,224,BITMAP_FORMAT_RGB32); + tmppgmbitmap = auto_bitmap_alloc(machine,448,224,BITMAP_FORMAT_RGB32); for (i=0; i < 0x1200/2; i++) palette_set_color(machine, i, MAKE_RGB(0, 0, 0)); - pgm_spritebufferram = auto_malloc (0xa00); + pgm_spritebufferram = auto_alloc_array(machine, UINT16, 0xa00/2); /* we render each sprite to a bitmap then copy the bitmap to screen bitmap with zooming */ /* easier this way because of the funky sprite format */ - sprite_temp_render = auto_malloc(0x400*0x200*2); + sprite_temp_render = auto_alloc_array(machine, UINT16, 0x400*0x200); } VIDEO_UPDATE( pgm ) diff --git a/src/mame/video/phoenix.c b/src/mame/video/phoenix.c index e314c3cf0df..adf3efea1e8 100644 --- a/src/mame/video/phoenix.c +++ b/src/mame/video/phoenix.c @@ -178,8 +178,8 @@ static TILE_GET_INFO( get_bg_tile_info ) VIDEO_START( phoenix ) { - videoram_pg[0] = auto_malloc(0x1000); - videoram_pg[1] = auto_malloc(0x1000); + videoram_pg[0] = auto_alloc_array(machine, UINT8, 0x1000); + videoram_pg[1] = auto_alloc_array(machine, UINT8, 0x1000); memory_configure_bank(machine, 1, 0, 1, videoram_pg[0], 0); memory_configure_bank(machine, 1, 1, 1, videoram_pg[1], 0); diff --git a/src/mame/video/pitnrun.c b/src/mame/video/pitnrun.c index 5aac4ce903d..19b4689e36e 100644 --- a/src/mame/video/pitnrun.c +++ b/src/mame/video/pitnrun.c @@ -181,10 +181,10 @@ VIDEO_START(pitnrun) fg = tilemap_create( machine, get_tile_info1,tilemap_scan_rows,8,8,32,32 ); bg = tilemap_create( machine, get_tile_info2,tilemap_scan_rows,8,8,32*4,32 ); tilemap_set_transparent_pen( fg, 0 ); - tmp_bitmap[0] = auto_bitmap_alloc(128,128,video_screen_get_format(machine->primary_screen)); - 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)); + tmp_bitmap[0] = auto_bitmap_alloc(machine,128,128,video_screen_get_format(machine->primary_screen)); + tmp_bitmap[1] = auto_bitmap_alloc(machine,128,128,video_screen_get_format(machine->primary_screen)); + tmp_bitmap[2] = auto_bitmap_alloc(machine,128,128,video_screen_get_format(machine->primary_screen)); + tmp_bitmap[3] = auto_bitmap_alloc(machine,128,128,video_screen_get_format(machine->primary_screen)); pitnrun_spotlights(machine); } diff --git a/src/mame/video/policetr.c b/src/mame/video/policetr.c index 52bce56563a..7b9a2e5735b 100644 --- a/src/mame/video/policetr.c +++ b/src/mame/video/policetr.c @@ -48,7 +48,7 @@ VIDEO_START( policetr ) srcbitmap_height_mask = (memory_region_length(machine, "gfx1") / SRCBITMAP_WIDTH) - 1; /* the destination bitmap is not directly accessible to the CPU */ - dstbitmap = auto_malloc(DSTBITMAP_WIDTH * DSTBITMAP_HEIGHT); + dstbitmap = auto_alloc_array(machine, UINT8, DSTBITMAP_WIDTH * DSTBITMAP_HEIGHT); } diff --git a/src/mame/video/popeye.c b/src/mame/video/popeye.c index ef227aa459c..8732fc74bc7 100644 --- a/src/mame/video/popeye.c +++ b/src/mame/video/popeye.c @@ -244,8 +244,8 @@ static TILE_GET_INFO( get_fg_tile_info ) VIDEO_START( skyskipr ) { - popeye_bitmapram = auto_malloc(popeye_bitmapram_size); - tmpbitmap2 = auto_bitmap_alloc(1024,1024,video_screen_get_format(machine->primary_screen)); /* actually 1024x512 but not rolling over vertically? */ + popeye_bitmapram = auto_alloc_array(machine, UINT8, popeye_bitmapram_size); + tmpbitmap2 = auto_bitmap_alloc(machine,1024,1024,video_screen_get_format(machine->primary_screen)); /* actually 1024x512 but not rolling over vertically? */ bitmap_type = TYPE_SKYSKIPR; @@ -261,8 +261,8 @@ VIDEO_START( skyskipr ) VIDEO_START( popeye ) { - popeye_bitmapram = auto_malloc(popeye_bitmapram_size); - tmpbitmap2 = auto_bitmap_alloc(512,512,video_screen_get_format(machine->primary_screen)); + popeye_bitmapram = auto_alloc_array(machine, UINT8, popeye_bitmapram_size); + tmpbitmap2 = auto_bitmap_alloc(machine,512,512,video_screen_get_format(machine->primary_screen)); bitmap_type = TYPE_POPEYE; diff --git a/src/mame/video/ppu2c0x.c b/src/mame/video/ppu2c0x.c index 7856295c466..a73fcbaed1b 100644 --- a/src/mame/video/ppu2c0x.c +++ b/src/mame/video/ppu2c0x.c @@ -315,17 +315,13 @@ static DEVICE_START( ppu2c0x ) chip->scan_scale = 1; /* allocate a screen bitmap, videomem and spriteram, a dirtychar array and the monochromatic colortable */ - chip->bitmap = auto_bitmap_alloc( VISIBLE_SCREEN_WIDTH, VISIBLE_SCREEN_HEIGHT, video_screen_get_format(device->machine->primary_screen)); - chip->videomem = auto_malloc( VIDEOMEM_SIZE ); - chip->videoram = auto_malloc( VIDEOMEM_SIZE ); - chip->spriteram = auto_malloc( SPRITERAM_SIZE ); - chip->colortable = auto_malloc( sizeof( default_colortable ) ); - chip->colortable_mono = auto_malloc( sizeof( default_colortable_mono ) ); - - /* clear videomem & spriteram */ - memset( chip->videomem, 0, VIDEOMEM_SIZE ); - memset( chip->videoram, 0, VIDEOMEM_SIZE ); - memset( chip->spriteram, 0, SPRITERAM_SIZE ); + chip->bitmap = auto_bitmap_alloc(device->machine, VISIBLE_SCREEN_WIDTH, VISIBLE_SCREEN_HEIGHT, video_screen_get_format(device->machine->primary_screen)); + chip->videomem = auto_alloc_array_clear(device->machine, UINT8, VIDEOMEM_SIZE ); + chip->videoram = auto_alloc_array_clear(device->machine, UINT8, VIDEOMEM_SIZE ); + chip->spriteram = auto_alloc_array_clear(device->machine, UINT8, SPRITERAM_SIZE ); + chip->colortable = auto_alloc_array(device->machine, pen_t, ARRAY_LENGTH( default_colortable ) ); + chip->colortable_mono = auto_alloc_array(device->machine, pen_t, ARRAY_LENGTH( default_colortable_mono ) ); + memset( chip->videoram_banks_indices, 0xff, sizeof(chip->videoram_banks_indices) ); if ( intf->vram_enabled ) diff --git a/src/mame/video/psikyo.c b/src/mame/video/psikyo.c index 887b32af011..cd173c32ee4 100644 --- a/src/mame/video/psikyo.c +++ b/src/mame/video/psikyo.c @@ -215,8 +215,8 @@ VIDEO_START( psikyo ) 16,16, 0x100, 0x10 ); - spritebuf1 = auto_malloc(0x2000); - spritebuf2 = auto_malloc(0x2000); + spritebuf1 = auto_alloc_array(machine, UINT32, 0x2000/4); + spritebuf2 = auto_alloc_array(machine, UINT32, 0x2000/4); tilemap_set_scroll_rows(tilemap_0_size0,0x80*16); // line scrolling tilemap_set_scroll_cols(tilemap_0_size0,1); diff --git a/src/mame/video/psikyosh.c b/src/mame/video/psikyosh.c index e8d84aff5bf..2f964dbfbd9 100644 --- a/src/mame/video/psikyosh.c +++ b/src/mame/video/psikyosh.c @@ -1081,10 +1081,10 @@ VIDEO_START( psikyosh ) { int width = video_screen_get_width(machine->primary_screen); int height = video_screen_get_height(machine->primary_screen); - z_bitmap = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED16); + z_bitmap = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16); /* Need 16-bit z-buffer */ - zoom_bitmap = auto_bitmap_alloc(16*16, 16*16, BITMAP_FORMAT_INDEXED8); + zoom_bitmap = auto_bitmap_alloc(machine, 16*16, 16*16, BITMAP_FORMAT_INDEXED8); machine->gfx[1]->color_granularity=16; /* 256 colour sprites with palette selectable on 16 colour boundaries */ diff --git a/src/mame/video/psx.c b/src/mame/video/psx.c index 8c901d978aa..61eceaf735f 100644 --- a/src/mame/video/psx.c +++ b/src/mame/video/psx.c @@ -293,7 +293,7 @@ static void DebugMeshInit( running_machine *machine ) m_debug.b_clear = 1; m_debug.n_coord = 0; m_debug.n_skip = 0; - m_debug.mesh = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED16 ); + m_debug.mesh = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16 ); m_debug.machine = machine; } @@ -640,8 +640,7 @@ static void psx_gpu_init( running_machine *machine ) m_n_lightgun_y = 0; m_n_vram_size = width * height; - m_p_vram = auto_malloc( m_n_vram_size * 2 ); - memset( m_p_vram, 0x00, m_n_vram_size * 2 ); + m_p_vram = auto_alloc_array_clear(machine, UINT16, m_n_vram_size ); for( n_line = 0; n_line < 1024; n_line++ ) { diff --git a/src/mame/video/psychic5.c b/src/mame/video/psychic5.c index 7ace37e6a03..cdb2171fce2 100644 --- a/src/mame/video/psychic5.c +++ b/src/mame/video/psychic5.c @@ -254,8 +254,8 @@ VIDEO_START( psychic5 ) tilemap_set_transparent_pen(fg_tilemap, 15); - ps5_pagedram[0] = auto_malloc(0x2000); - ps5_pagedram[1] = auto_malloc(0x2000); + ps5_pagedram[0] = auto_alloc_array(machine, UINT8, 0x2000); + ps5_pagedram[1] = auto_alloc_array(machine, UINT8, 0x2000); psychic5_bg_videoram = &ps5_pagedram[0][0x0000]; ps5_dummy_bg_ram = &ps5_pagedram[0][0x1000]; @@ -263,7 +263,7 @@ VIDEO_START( psychic5 ) ps5_palette_ram = &ps5_pagedram[1][0x0400]; psychic5_fg_videoram = &ps5_pagedram[1][0x1000]; - jal_blend_table = auto_malloc(0xc00); + jal_blend_table = auto_alloc_array(machine, UINT8, 0xc00); bg_palette_ram_base = 0x400; bg_palette_base = 0x100; @@ -277,8 +277,8 @@ VIDEO_START( bombsa ) tilemap_set_transparent_pen(fg_tilemap, 15); - ps5_pagedram[0] = auto_malloc(0x2000); - ps5_pagedram[1] = auto_malloc(0x2000); + ps5_pagedram[0] = auto_alloc_array(machine, UINT8, 0x2000); + ps5_pagedram[1] = auto_alloc_array(machine, UINT8, 0x2000); psychic5_bg_videoram = &ps5_pagedram[0][0x0000]; ps5_dummy_bg_ram = &ps5_pagedram[0][0x1000]; @@ -286,7 +286,7 @@ VIDEO_START( bombsa ) psychic5_fg_videoram = &ps5_pagedram[1][0x0800]; ps5_palette_ram = &ps5_pagedram[1][0x1000]; - //jal_blend_table = auto_malloc(0xc00); + //jal_blend_table = auto_alloc_array(machine, UINT8, 0xc00); jal_blend_table = NULL; bg_palette_ram_base = 0x000; diff --git a/src/mame/video/qix.c b/src/mame/video/qix.c index 0d85e055ea3..b673cb45238 100644 --- a/src/mame/video/qix.c +++ b/src/mame/video/qix.c @@ -46,7 +46,7 @@ static VIDEO_START( qix ) qix_state *state = machine->driver_data; /* allocate memory for the full video RAM */ - state->videoram = auto_malloc(256 * 256); + state->videoram = auto_alloc_array(machine, UINT8, 256 * 256); /* set up save states */ state_save_register_global_pointer(machine, state->videoram, 256 * 256); diff --git a/src/mame/video/quasar.c b/src/mame/video/quasar.c index ce9d0ef5b9f..8418fab59c4 100644 --- a/src/mame/video/quasar.c +++ b/src/mame/video/quasar.c @@ -101,12 +101,12 @@ VIDEO_START( quasar ) int width = video_screen_get_width(machine->primary_screen); int height = video_screen_get_height(machine->primary_screen); - quasar_effectram = auto_malloc(0x400); + quasar_effectram = auto_alloc_array(machine, UINT8, 0x400); /* configure the S2636 chips */ - s2636_0 = s2636_config(cvs_s2636_0_ram, height, width, CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET); - s2636_1 = s2636_config(cvs_s2636_1_ram, height, width, CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET); - s2636_2 = s2636_config(cvs_s2636_2_ram, height, width, CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET); + s2636_0 = s2636_config(machine, cvs_s2636_0_ram, height, width, CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET); + s2636_1 = s2636_config(machine, cvs_s2636_1_ram, height, width, CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET); + s2636_2 = s2636_config(machine, cvs_s2636_2_ram, height, width, CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET); /* create helper bitmaps */ cvs_collision_background = video_screen_auto_bitmap_alloc(machine->primary_screen); diff --git a/src/mame/video/quizdna.c b/src/mame/video/quizdna.c index 9448b003bfa..32139b849b3 100644 --- a/src/mame/video/quizdna.c +++ b/src/mame/video/quizdna.c @@ -61,8 +61,8 @@ VIDEO_START( quizdna ) quizdna_bg_xscroll[0] = 0; quizdna_bg_xscroll[1] = 0; - quizdna_bg_ram = auto_malloc(0x2000); - quizdna_fg_ram = auto_malloc(0x1000); + quizdna_bg_ram = auto_alloc_array(machine, UINT8, 0x2000); + quizdna_fg_ram = auto_alloc_array(machine, UINT8, 0x1000); quizdna_bg_tilemap = tilemap_create( machine, get_bg_tile_info,tilemap_scan_rows,8,8,64,32 ); quizdna_fg_tilemap = tilemap_create( machine, get_fg_tile_info,tilemap_scan_rows,16,8,32,32 ); diff --git a/src/mame/video/realbrk.c b/src/mame/video/realbrk.c index bce6b36b446..20921b3a7ff 100644 --- a/src/mame/video/realbrk.c +++ b/src/mame/video/realbrk.c @@ -163,8 +163,8 @@ VIDEO_START(realbrk) tilemap_set_transparent_pen(tilemap_1,0); tilemap_set_transparent_pen(tilemap_2,0); - tmpbitmap0 = auto_bitmap_alloc(32,32, video_screen_get_format(machine->primary_screen)); - tmpbitmap1 = auto_bitmap_alloc(32,32, video_screen_get_format(machine->primary_screen)); + tmpbitmap0 = auto_bitmap_alloc(machine,32,32, video_screen_get_format(machine->primary_screen)); + tmpbitmap1 = auto_bitmap_alloc(machine,32,32, video_screen_get_format(machine->primary_screen)); } /*************************************************************************** diff --git a/src/mame/video/redalert.c b/src/mame/video/redalert.c index 1b84edf8481..584c3f01785 100644 --- a/src/mame/video/redalert.c +++ b/src/mame/video/redalert.c @@ -138,7 +138,7 @@ static void get_pens(running_machine *machine, pen_t *pens) static VIDEO_START( redalert ) { - redalert_bitmap_colorram = auto_malloc(0x0400); + redalert_bitmap_colorram = auto_alloc_array(machine, UINT8, 0x0400); state_save_register_global_pointer(machine, redalert_bitmap_colorram, 0x0400); diff --git a/src/mame/video/rohga.c b/src/mame/video/rohga.c index 12aea1a6f57..850ec5247f7 100644 --- a/src/mame/video/rohga.c +++ b/src/mame/video/rohga.c @@ -26,7 +26,7 @@ static int wizdfire_bank_callback(const int bank) VIDEO_START( rohga ) { - rohga_spriteram = (UINT16*)auto_malloc(0x800); + rohga_spriteram = auto_alloc_array(machine, UINT16, 0x800/2); deco16_2_video_init(machine, 0); diff --git a/src/mame/video/segag80r.c b/src/mame/video/segag80r.c index 786a2755602..43ecf29c1c7 100644 --- a/src/mame/video/segag80r.c +++ b/src/mame/video/segag80r.c @@ -211,7 +211,7 @@ VIDEO_START( segag80r ) gfx_element_set_source(machine->gfx[0], &videoram[0x800]); /* allocate paletteram */ - paletteram = auto_malloc(0x80); + paletteram = auto_alloc_array(machine, UINT8, 0x80); /* initialize the particulars for each type of background PCB */ switch (segag80r_background_pcb) diff --git a/src/mame/video/segaic16.c b/src/mame/video/segaic16.c index dfaeeaf0741..5cbd5550a1a 100644 --- a/src/mame/video/segaic16.c +++ b/src/mame/video/segaic16.c @@ -2734,7 +2734,7 @@ void segaic16_sprites_init(running_machine *machine, int which, int type, int co /* if the sprites need buffering, allocate memory for the buffer */ if (buffer) - info->buffer = auto_malloc(info->ramsize); + info->buffer = auto_alloc_array(machine, UINT16, info->ramsize/2); state_save_register_item(machine, "segaic16_sp", NULL, which, info->flip); state_save_register_item(machine, "segaic16_sp", NULL, which, info->shadow); @@ -2911,7 +2911,7 @@ static void segaic16_road_hangon_decode(running_machine *machine, struct road_in int len = memory_region_length(machine, "gfx3"); /* allocate memory for the unpacked road data */ - info->gfx = auto_malloc(256 * 512); + info->gfx = auto_alloc_array(machine, UINT8, 256 * 512); /* loop over rows */ for (y = 0; y < 256; y++) @@ -3172,7 +3172,7 @@ static void segaic16_road_outrun_decode(running_machine *machine, struct road_in int len = memory_region_length(machine, "gfx3"); /* allocate memory for the unpacked road data */ - info->gfx = auto_malloc((256 * 2 + 1) * 512); + info->gfx = auto_alloc_array(machine, UINT8, (256 * 2 + 1) * 512); /* loop over rows */ for (y = 0; y < 256 * 2; y++) @@ -3404,7 +3404,7 @@ void segaic16_road_init(running_machine *machine, int which, int type, int color case SEGAIC16_ROAD_OUTRUN: case SEGAIC16_ROAD_XBOARD: - info->buffer = auto_malloc(0x1000); + info->buffer = auto_alloc_array(machine, UINT16, 0x1000/2); info->draw = segaic16_road_outrun_draw; segaic16_road_outrun_decode(machine, info); break; @@ -3508,7 +3508,7 @@ void segaic16_rotate_init(running_machine *machine, int which, int type, int col } /* allocate a buffer for swapping */ - info->buffer = auto_malloc(info->ramsize); + info->buffer = auto_alloc_array(machine, UINT16, info->ramsize/2); state_save_register_item(machine, "segaic16_rot", NULL, which, info->colorbase); state_save_register_item_pointer(machine, "segaic16_rot", NULL, which, ((UINT8 *) info->buffer), info->ramsize); diff --git a/src/mame/video/segaic24.c b/src/mame/video/segaic24.c index da85b5e943f..f0359bbe835 100644 --- a/src/mame/video/segaic24.c +++ b/src/mame/video/segaic24.c @@ -143,9 +143,9 @@ void sys24_tile_vh_start(running_machine *machine, UINT16 tile_mask) break; assert(sys24_char_gfx_index != MAX_GFX_ELEMENTS); - sys24_char_ram = auto_malloc(0x80000); + sys24_char_ram = auto_alloc_array(machine, UINT16, 0x80000/2); - sys24_tile_ram = auto_malloc(0x10000); + sys24_tile_ram = auto_alloc_array(machine, UINT16, 0x10000/2); sys24_tile_layer[0] = tilemap_create(machine, sys24_tile_info_0s, tilemap_scan_rows, 8, 8, 64, 64); sys24_tile_layer[1] = tilemap_create(machine, sys24_tile_info_0w, tilemap_scan_rows, 8, 8, 64, 64); @@ -649,7 +649,7 @@ static UINT16 *sys24_sprite_ram; void sys24_sprite_vh_start(running_machine *machine) { - sys24_sprite_ram = auto_malloc(0x40000); + sys24_sprite_ram = auto_alloc_array(machine, UINT16, 0x40000/2); state_save_register_global_pointer(machine, sys24_sprite_ram, 0x40000/2); // kc = 0; diff --git a/src/mame/video/segas18.c b/src/mame/video/segas18.c index 6bcdf270a63..06c6d24526d 100644 --- a/src/mame/video/segas18.c +++ b/src/mame/video/segas18.c @@ -65,7 +65,7 @@ VIDEO_START( system18 ) /* create a temp bitmap to draw the VDP data into */ width = video_screen_get_width(machine->primary_screen); height = video_screen_get_height(machine->primary_screen); - tempbitmap = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED16); + tempbitmap = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16); } diff --git a/src/mame/video/segas32.c b/src/mame/video/segas32.c index 01b9c0bbc0c..48cc9e9def5 100644 --- a/src/mame/video/segas32.c +++ b/src/mame/video/segas32.c @@ -290,13 +290,13 @@ static void common_start(running_machine *machine, int multi32) is_multi32 = multi32; /* allocate a copy of spriteram in 32-bit format */ - spriteram_32bit = auto_malloc(0x20000); + spriteram_32bit = auto_alloc_array(machine, UINT32, 0x20000/4); /* allocate the tilemap cache */ cache_head = NULL; for (tmap = 0; tmap < TILEMAP_CACHE_SIZE; tmap++) { - struct cache_entry *entry = auto_malloc(sizeof(struct cache_entry)); + struct cache_entry *entry = auto_alloc(machine, struct cache_entry); entry->tmap = tilemap_create(machine, get_tile_info, tilemap_scan_rows, 16,16, 32,16); entry->page = 0xff; @@ -310,15 +310,14 @@ static void common_start(running_machine *machine, int multi32) /* allocate the bitmaps (a few extra for multi32) */ for (tmap = 0; tmap < 9 + 2 * multi32; tmap++) { - layer_data[tmap].bitmap = auto_bitmap_alloc(416, 224, BITMAP_FORMAT_INDEXED16); - layer_data[tmap].transparent = auto_malloc(sizeof(layer_data[tmap].transparent[0]) * 256); - memset(layer_data[tmap].transparent, 0, sizeof(layer_data[tmap].transparent[0]) * 256); + layer_data[tmap].bitmap = auto_bitmap_alloc(machine, 416, 224, BITMAP_FORMAT_INDEXED16); + layer_data[tmap].transparent = auto_alloc_array_clear(machine, UINT8, 256); } /* allocate pre-rendered solid lines of 0's and ffff's */ - solid_0000 = auto_malloc(sizeof(solid_0000[0]) * 512); + solid_0000 = auto_alloc_array(machine, UINT16, 512); memset(solid_0000, 0x00, sizeof(solid_0000[0]) * 512); - solid_ffff = auto_malloc(sizeof(solid_ffff[0]) * 512); + solid_ffff = auto_alloc_array(machine, UINT16, 512); memset(solid_ffff, 0xff, sizeof(solid_ffff[0]) * 512); /* initialize videoram */ diff --git a/src/mame/video/segasyse.c b/src/mame/video/segasyse.c index b9ec0bc5d29..811e29de6e2 100644 --- a/src/mame/video/segasyse.c +++ b/src/mame/video/segasyse.c @@ -59,7 +59,7 @@ VIDEO_START( megaplay_normal ) vdp_start(machine, 0); - cache_bitmap = auto_malloc( (16+256+16) * 192); /* 16 pixels either side to simplify drawing */ + cache_bitmap = auto_alloc_array(machine, UINT8, (16+256+16) * 192); /* 16 pixels either side to simplify drawing */ } VIDEO_UPDATE( megaplay_normal ) @@ -101,16 +101,16 @@ static void vdp_start(running_machine *machine, UINT8 chip) /*- VRAM -*/ - segae_vdp_vram[chip] = auto_malloc(0x8000); /* 32kb (2 banks) */ + segae_vdp_vram[chip] = auto_alloc_array(machine, UINT8, 0x8000); /* 32kb (2 banks) */ segae_vdp_vrambank[chip] = 0; /*- CRAM -*/ - vdp_cram[chip] = auto_malloc(0x20); + vdp_cram[chip] = auto_alloc_array(machine, UINT8, 0x20); /*- VDP Registers -*/ - segae_vdp_regs[chip] = auto_malloc(0x20); + segae_vdp_regs[chip] = auto_alloc_array(machine, UINT8, 0x20); /*- Clear Memory -*/ diff --git a/src/mame/video/segaybd.c b/src/mame/video/segaybd.c index 6ef31633a01..199ed641a57 100644 --- a/src/mame/video/segaybd.c +++ b/src/mame/video/segaybd.c @@ -32,7 +32,7 @@ VIDEO_START( yboard ) segaic16_palette_init(0x2000); /* allocate a bitmap for the yboard layer */ - yboard_bitmap = auto_bitmap_alloc(512, 512, BITMAP_FORMAT_INDEXED16); + yboard_bitmap = auto_bitmap_alloc(machine, 512, 512, BITMAP_FORMAT_INDEXED16); /* initialize the sprites */ segaic16_sprites_init(machine, 0, SEGAIC16_SPRITES_YBOARD_16B, 0x800, 0); diff --git a/src/mame/video/seibuspi.c b/src/mame/video/seibuspi.c index d67f264516c..b73554326a4 100644 --- a/src/mame/video/seibuspi.c +++ b/src/mame/video/seibuspi.c @@ -494,12 +494,9 @@ VIDEO_START( spi ) tilemap_set_transparent_pen(mid_layer, 63); tilemap_set_transparent_pen(fore_layer, 63); - tilemap_ram = auto_malloc(0x4000); - palette_ram = auto_malloc(0x3000); - sprite_ram = auto_malloc(0x1000); - memset(tilemap_ram, 0, 0x4000); - memset(palette_ram, 0, 0x3000); - memset(sprite_ram, 0, 0x1000); + tilemap_ram = auto_alloc_array_clear(machine, UINT32, 0x4000/4); + palette_ram = auto_alloc_array_clear(machine, UINT32, 0x3000/4); + sprite_ram = auto_alloc_array_clear(machine, UINT32, 0x1000/4); sprite_bpp = 6; sprite_dma_length = 0x1000; @@ -663,10 +660,8 @@ VIDEO_START( sys386f2 ) { int i; - palette_ram = auto_malloc(0x4000); - sprite_ram = auto_malloc(0x2000); - memset(palette_ram, 0, 0x4000); - memset(sprite_ram, 0, 0x2000); + palette_ram = auto_alloc_array_clear(machine, UINT32, 0x4000/4); + sprite_ram = auto_alloc_array_clear(machine, UINT32, 0x2000/4); sprite_bpp = 8; sprite_dma_length = 0x2000; diff --git a/src/mame/video/seta2.c b/src/mame/video/seta2.c index 312f792102e..6c7db4df7f6 100644 --- a/src/mame/video/seta2.c +++ b/src/mame/video/seta2.c @@ -359,7 +359,7 @@ VIDEO_START( seta2 ) machine->gfx[4]->color_granularity = 16; machine->gfx[5]->color_granularity = 16; - buffered_spriteram16 = auto_malloc(spriteram_size); + buffered_spriteram16 = auto_alloc_array(machine, UINT16, spriteram_size/2); yoffset = 0; } diff --git a/src/mame/video/shadfrce.c b/src/mame/video/shadfrce.c index c294ca8654c..9cc0dad09c5 100644 --- a/src/mame/video/shadfrce.c +++ b/src/mame/video/shadfrce.c @@ -75,7 +75,7 @@ VIDEO_START( shadfrce ) shadfrce_bg1tilemap = tilemap_create(machine, get_shadfrce_bg1tile_info,tilemap_scan_rows, 16, 16,32,32); - shadfrce_spvideoram_old = auto_malloc(spriteram_size); + shadfrce_spvideoram_old = auto_alloc_array(machine, UINT16, spriteram_size/2); } WRITE16_HANDLER ( shadfrce_bg0scrollx_w ) diff --git a/src/mame/video/simpl156.c b/src/mame/video/simpl156.c index 46ec8712a80..407cdb40c8a 100644 --- a/src/mame/video/simpl156.c +++ b/src/mame/video/simpl156.c @@ -135,12 +135,12 @@ static int simpl156_bank_callback(const int bank) VIDEO_START( simpl156 ) { /* allocate the ram as 16-bit (we do it here because the CPU is 32-bit) */ - deco16_pf1_data = auto_malloc(0x2000); - deco16_pf2_data = auto_malloc(0x2000); - deco16_pf1_rowscroll = auto_malloc(0x800); - deco16_pf2_rowscroll = auto_malloc(0x800); - deco16_pf12_control = auto_malloc(0x10); - paletteram16 = auto_malloc(0x1000); + deco16_pf1_data = auto_alloc_array(machine, UINT16, 0x2000/2); + deco16_pf2_data = auto_alloc_array(machine, UINT16, 0x2000/2); + deco16_pf1_rowscroll = auto_alloc_array(machine, UINT16, 0x800/2); + deco16_pf2_rowscroll = auto_alloc_array(machine, UINT16, 0x800/2); + deco16_pf12_control = auto_alloc_array(machine, UINT16, 0x10/2); + paletteram16 = auto_alloc_array(machine, UINT16, 0x1000/2); /* and register the allocated ram so that save states still work */ state_save_register_global_pointer(machine, deco16_pf1_data, 0x2000/2); diff --git a/src/mame/video/simpsons.c b/src/mame/video/simpsons.c index c9f8a57f6b4..c32ae253e04 100644 --- a/src/mame/video/simpsons.c +++ b/src/mame/video/simpsons.c @@ -104,7 +104,7 @@ void simpsons_video_banking(running_machine *machine, int bank) { if (bank & 1) { - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0x0fff, 0, 0, SMH_BANK5, paletteram_xBBBBBGGGGGRRRRR_be_w); + memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0x0fff, 0, 0, (read8_space_func)SMH_BANK(5), paletteram_xBBBBBGGGGGRRRRR_be_w); memory_set_bankptr(machine, 5, paletteram); } else diff --git a/src/mame/video/skyraid.c b/src/mame/video/skyraid.c index 093c4ec061b..0bd330af675 100644 --- a/src/mame/video/skyraid.c +++ b/src/mame/video/skyraid.c @@ -17,7 +17,7 @@ static bitmap_t *helper; VIDEO_START( skyraid ) { - helper = auto_bitmap_alloc(128, 240, video_screen_get_format(machine->primary_screen)); + helper = auto_bitmap_alloc(machine, 128, 240, video_screen_get_format(machine->primary_screen)); } diff --git a/src/mame/video/slapshot.c b/src/mame/video/slapshot.c index 512b0e039f4..397b17ccd86 100644 --- a/src/mame/video/slapshot.c +++ b/src/mame/video/slapshot.c @@ -34,9 +34,9 @@ static VIDEO_START( slapshot_core ) { int i; - spriteram_delayed = auto_malloc(spriteram_size); - spriteram_buffered = auto_malloc(spriteram_size); - spritelist = auto_malloc(0x400 * sizeof(*spritelist)); + spriteram_delayed = auto_alloc_array(machine, UINT16, spriteram_size/2); + spriteram_buffered = auto_alloc_array(machine, UINT16, spriteram_size/2); + spritelist = auto_alloc_array(machine, struct tempsprite, 0x400); if (has_TC0480SCP(machine)) /* it's a tc0480scp game */ TC0480SCP_vh_start(machine,TC0480SCP_GFX_NUM,taito_hide_pixels,30,9,-1,1,0,2,256); diff --git a/src/mame/video/spacefb.c b/src/mame/video/spacefb.c index b394d7ad020..0292c2521a5 100644 --- a/src/mame/video/spacefb.c +++ b/src/mame/video/spacefb.c @@ -92,7 +92,7 @@ VIDEO_START( spacefb ) width = video_screen_get_width(machine->primary_screen); height = video_screen_get_height(machine->primary_screen); - object_present_map = auto_malloc(width * height); + object_present_map = auto_alloc_array(machine, UINT8, width * height); /* this start value positions the stars to match the flyer screen shot, but most likely, the actual star position is random as the hardware diff --git a/src/mame/video/spbactn.c b/src/mame/video/spbactn.c index 55c8de92cea..abc4ef50907 100644 --- a/src/mame/video/spbactn.c +++ b/src/mame/video/spbactn.c @@ -113,8 +113,8 @@ VIDEO_START( spbactn ) int width = video_screen_get_width(machine->primary_screen); int height = video_screen_get_height(machine->primary_screen); - tile_bitmap_bg = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED16); - tile_bitmap_fg = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED16); + tile_bitmap_bg = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16); + tile_bitmap_fg = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16); } VIDEO_UPDATE( spbactn ) diff --git a/src/mame/video/speedspn.c b/src/mame/video/speedspn.c index 758ede58cea..c9a3fec75bd 100644 --- a/src/mame/video/speedspn.c +++ b/src/mame/video/speedspn.c @@ -20,7 +20,7 @@ static TILE_GET_INFO( get_speedspn_tile_info ) VIDEO_START(speedspn) { - speedspn_vidram = auto_malloc(0x1000 * 2); + speedspn_vidram = auto_alloc_array(machine, UINT8, 0x1000 * 2); speedspn_tilemap = tilemap_create(machine, get_speedspn_tile_info,tilemap_scan_cols, 8, 8,64,32); } diff --git a/src/mame/video/ssv.c b/src/mame/video/ssv.c index 0df61f4c414..41086e18205 100644 --- a/src/mame/video/ssv.c +++ b/src/mame/video/ssv.c @@ -202,7 +202,7 @@ VIDEO_START( eaglshot ) { VIDEO_START_CALL(ssv); - eaglshot_gfxram = (UINT16*)auto_malloc(16 * 0x40000); + eaglshot_gfxram = auto_alloc_array(machine, UINT16, 16 * 0x40000 / 2); gfx_element_set_source(machine->gfx[0], (UINT8 *)eaglshot_gfxram); gfx_element_set_source(machine->gfx[1], (UINT8 *)eaglshot_gfxram); @@ -226,7 +226,7 @@ VIDEO_START( gdfs ) { VIDEO_START_CALL(ssv); - eaglshot_gfxram = (UINT16*)auto_malloc(4 * 0x100000); + eaglshot_gfxram = auto_alloc_array(machine, UINT16, 4 * 0x100000 / 2); machine->gfx[2]->color_granularity = 64; /* 256 colour sprites with palette selectable on 64 colour boundaries */ gfx_element_set_source(machine->gfx[2], (UINT8 *)eaglshot_gfxram); diff --git a/src/mame/video/st0016.c b/src/mame/video/st0016.c index 5c5c861aff0..92b4f71b54c 100644 --- a/src/mame/video/st0016.c +++ b/src/mame/video/st0016.c @@ -435,9 +435,9 @@ void st0016_save_init(running_machine *machine) VIDEO_START( st0016 ) { int gfx_index=0; - st0016_charram=auto_malloc(ST0016_MAX_CHAR_BANK*ST0016_CHAR_BANK_SIZE); - st0016_spriteram=auto_malloc(ST0016_MAX_SPR_BANK*ST0016_SPR_BANK_SIZE); - st0016_paletteram=auto_malloc(ST0016_MAX_PAL_BANK*ST0016_PAL_BANK_SIZE); + st0016_charram=auto_alloc_array(machine, UINT8, ST0016_MAX_CHAR_BANK*ST0016_CHAR_BANK_SIZE); + st0016_spriteram=auto_alloc_array(machine, UINT8, ST0016_MAX_SPR_BANK*ST0016_SPR_BANK_SIZE); + st0016_paletteram=auto_alloc_array(machine, UINT8, ST0016_MAX_PAL_BANK*ST0016_PAL_BANK_SIZE); /* find first empty slot to decode gfx */ for (gfx_index = 0; gfx_index < MAX_GFX_ELEMENTS; gfx_index++) @@ -468,7 +468,7 @@ VIDEO_START( st0016 ) break; case 3: //super eagle shot - speglsht_bitmap = auto_bitmap_alloc( 512, 5122, BITMAP_FORMAT_INDEXED16 ); + speglsht_bitmap = auto_bitmap_alloc(machine, 512, 5122, BITMAP_FORMAT_INDEXED16 ); break; case 4: //mayjinsen 1&2 diff --git a/src/mame/video/stadhero.c b/src/mame/video/stadhero.c index a17a53d93c5..19f98d45caa 100644 --- a/src/mame/video/stadhero.c +++ b/src/mame/video/stadhero.c @@ -159,7 +159,7 @@ VIDEO_START( stadhero ) pf1_tilemap = tilemap_create(machine, get_pf1_tile_info,tilemap_scan_rows, 8, 8,32,32); pf2_tilemap = tilemap_create(machine, get_pf2_tile_info,stadhero_scan, 16,16,64,64); - stadhero_pf2_data = auto_malloc(0x2000 * 2); + stadhero_pf2_data = auto_alloc_array(machine, UINT16, 0x2000); tilemap_set_transparent_pen(pf1_tilemap,0); } diff --git a/src/mame/video/starcrus.c b/src/mame/video/starcrus.c index e0520c51c45..95183acf8f9 100644 --- a/src/mame/video/starcrus.c +++ b/src/mame/video/starcrus.c @@ -55,11 +55,11 @@ WRITE8_HANDLER( starcrus_p2_y_w ) { p2_y = data^0xff; } VIDEO_START( starcrus ) { - ship1_vid = auto_bitmap_alloc(16,16,video_screen_get_format(machine->primary_screen)); - ship2_vid = auto_bitmap_alloc(16,16,video_screen_get_format(machine->primary_screen)); + ship1_vid = auto_bitmap_alloc(machine,16,16,video_screen_get_format(machine->primary_screen)); + ship2_vid = auto_bitmap_alloc(machine,16,16,video_screen_get_format(machine->primary_screen)); - proj1_vid = auto_bitmap_alloc(16,16,video_screen_get_format(machine->primary_screen)); - proj2_vid = auto_bitmap_alloc(16,16,video_screen_get_format(machine->primary_screen)); + proj1_vid = auto_bitmap_alloc(machine,16,16,video_screen_get_format(machine->primary_screen)); + proj2_vid = auto_bitmap_alloc(machine,16,16,video_screen_get_format(machine->primary_screen)); } WRITE8_HANDLER( starcrus_ship_parm_1_w ) diff --git a/src/mame/video/starshp1.c b/src/mame/video/starshp1.c index 9b2522cf35a..744de904777 100644 --- a/src/mame/video/starshp1.c +++ b/src/mame/video/starshp1.c @@ -94,7 +94,7 @@ VIDEO_START( starshp1 ) tilemap_set_scrollx(bg_tilemap, 0, -8); - LSFR = auto_malloc(0x20000); + LSFR = auto_alloc_array(machine, UINT16, 0x10000); for (i = 0; i < 0x10000; i++) { diff --git a/src/mame/video/stvvdp1.c b/src/mame/video/stvvdp1.c index 64fd39fe654..45ea88bcf64 100644 --- a/src/mame/video/stvvdp1.c +++ b/src/mame/video/stvvdp1.c @@ -2095,20 +2095,17 @@ static STATE_POSTLOAD( stv_vdp1_state_save_postload ) int stv_vdp1_start ( running_machine *machine ) { - stv_vdp1_regs = auto_malloc ( 0x040000 ); - stv_vdp1_vram = auto_malloc ( 0x100000 ); - stv_vdp1_gfx_decode = auto_malloc( 0x100000 ); + stv_vdp1_regs = auto_alloc_array_clear(machine, UINT32, 0x040000/4 ); + stv_vdp1_vram = auto_alloc_array_clear(machine, UINT32, 0x100000/4 ); + stv_vdp1_gfx_decode = auto_alloc_array(machine, UINT8, 0x100000 ); - stv_vdp1_shading_data = auto_malloc( sizeof(struct stv_vdp1_poly_scanline_data) ); + stv_vdp1_shading_data = auto_alloc(machine, struct stv_vdp1_poly_scanline_data); - memset(stv_vdp1_regs, 0, 0x040000); - memset(stv_vdp1_vram, 0, 0x100000); + stv_framebuffer[0] = auto_alloc_array(machine, UINT16, 1024 * 256 * 2 ); /* *2 is for double interlace */ + stv_framebuffer[1] = auto_alloc_array(machine, UINT16, 1024 * 256 * 2 ); - stv_framebuffer[0] = auto_malloc( 1024 * 256 * sizeof(UINT16) * 2 ); /* *2 is for double interlace */ - stv_framebuffer[1] = auto_malloc( 1024 * 256 * sizeof(UINT16) * 2 ); - - stv_framebuffer_display_lines = auto_malloc( 512 * sizeof(UINT16*) ); - stv_framebuffer_draw_lines = auto_malloc( 512 * sizeof(UINT16*) ); + stv_framebuffer_display_lines = auto_alloc_array(machine, UINT16 *, 512); + stv_framebuffer_draw_lines = auto_alloc_array(machine, UINT16 *, 512); stv_framebuffer_width = stv_framebuffer_height = 0; stv_framebuffer_mode = -1; diff --git a/src/mame/video/stvvdp2.c b/src/mame/video/stvvdp2.c index 7b39bd5e896..a990937b229 100644 --- a/src/mame/video/stvvdp2.c +++ b/src/mame/video/stvvdp2.c @@ -4860,7 +4860,7 @@ static void stv_vdp2_draw_rotation_screen(running_machine *machine, bitmap_t *bi else { if ( stv_vdp2_roz_bitmap[iRP-1] == NULL ) - stv_vdp2_roz_bitmap[iRP-1] = auto_bitmap_alloc(4096, 4096, video_screen_get_format(machine->primary_screen)); + stv_vdp2_roz_bitmap[iRP-1] = auto_bitmap_alloc(machine, 4096, 4096, video_screen_get_format(machine->primary_screen)); roz_clip_rect.min_x = roz_clip_rect.min_y = 0; if ( (iRP == 1 && STV_VDP2_RAOVR == 3) || @@ -5389,14 +5389,10 @@ static STATE_POSTLOAD( stv_vdp2_state_save_postload ) static int stv_vdp2_start (running_machine *machine) { - stv_vdp2_regs = auto_malloc ( 0x040000 ); - stv_vdp2_vram = auto_malloc ( 0x100000 ); // actually we only need half of it since we don't emulate extra 4mbit ram cart. - stv_vdp2_cram = auto_malloc ( 0x080000 ); - stv_vdp2_gfx_decode = auto_malloc ( 0x100000 ); - - memset(stv_vdp2_regs, 0, 0x040000); - memset(stv_vdp2_vram, 0, 0x100000); - memset(stv_vdp2_cram, 0, 0x080000); + stv_vdp2_regs = auto_alloc_array_clear(machine, UINT32, 0x040000/4 ); + stv_vdp2_vram = auto_alloc_array_clear(machine, UINT32, 0x100000/4 ); // actually we only need half of it since we don't emulate extra 4mbit ram cart. + stv_vdp2_cram = auto_alloc_array_clear(machine, UINT32, 0x080000/4 ); + stv_vdp2_gfx_decode = auto_alloc_array(machine, UINT8, 0x100000 ); stv_vdp2_render_rbg0 = 1; // machine->gfx[0]->color_granularity=4; diff --git a/src/mame/video/suna16.c b/src/mame/video/suna16.c index 9f27340a8b9..98cae9e3a88 100644 --- a/src/mame/video/suna16.c +++ b/src/mame/video/suna16.c @@ -92,7 +92,7 @@ WRITE16_HANDLER( bestbest_flipscreen_w ) VIDEO_START( suna16 ) { - paletteram16 = auto_malloc( machine->config->total_colors * sizeof(UINT16) ); + paletteram16 = auto_alloc_array(machine, UINT16, machine->config->total_colors); } READ16_HANDLER( suna16_paletteram16_r ) diff --git a/src/mame/video/suna8.c b/src/mame/video/suna8.c index 0e0aa0a133d..e4112e95a4b 100644 --- a/src/mame/video/suna8.c +++ b/src/mame/video/suna8.c @@ -171,13 +171,13 @@ WRITE8_HANDLER( brickzn_banked_paletteram_w ) -static void suna8_vh_start_common(int dim) +static void suna8_vh_start_common(running_machine *machine, int dim) { suna8_text_dim = dim; if (!(suna8_text_dim > 0)) { - paletteram = auto_malloc(0x200 * 2); - spriteram = auto_malloc(0x2000 * 2); + paletteram = auto_alloc_array(machine, UINT8, 0x200 * 2); + spriteram = auto_alloc_array(machine, UINT8, 0x2000 * 2); suna8_spritebank = 0; suna8_palettebank = 0; } @@ -191,9 +191,9 @@ static void suna8_vh_start_common(int dim) #endif } -VIDEO_START( suna8_textdim0 ) { suna8_vh_start_common(0); } -VIDEO_START( suna8_textdim8 ) { suna8_vh_start_common(8); } -VIDEO_START( suna8_textdim12 ) { suna8_vh_start_common(12); } +VIDEO_START( suna8_textdim0 ) { suna8_vh_start_common(machine, 0); } +VIDEO_START( suna8_textdim8 ) { suna8_vh_start_common(machine, 8); } +VIDEO_START( suna8_textdim12 ) { suna8_vh_start_common(machine, 12); } /*************************************************************************** diff --git a/src/mame/video/superchs.c b/src/mame/video/superchs.c index dd95d9586f3..1749c564a1c 100644 --- a/src/mame/video/superchs.c +++ b/src/mame/video/superchs.c @@ -16,7 +16,7 @@ static struct tempsprite *spritelist; VIDEO_START( superchs ) { - spritelist = auto_malloc(0x4000 * sizeof(*spritelist)); + spritelist = auto_alloc_array(machine, struct tempsprite, 0x4000); TC0480SCP_vh_start(machine,TC0480SCP_GFX_NUM,0,0x20,0x08,-1,0,0,0,0); } diff --git a/src/mame/video/superqix.c b/src/mame/video/superqix.c index 5a14e0e1d4f..b23c43af639 100644 --- a/src/mame/video/superqix.c +++ b/src/mame/video/superqix.c @@ -66,8 +66,8 @@ VIDEO_START( pbillian ) VIDEO_START( superqix ) { - fg_bitmap[0] = auto_bitmap_alloc(256, 256, video_screen_get_format(machine->primary_screen)); - fg_bitmap[1] = auto_bitmap_alloc(256, 256, video_screen_get_format(machine->primary_screen)); + fg_bitmap[0] = auto_bitmap_alloc(machine, 256, 256, video_screen_get_format(machine->primary_screen)); + fg_bitmap[1] = auto_bitmap_alloc(machine, 256, 256, video_screen_get_format(machine->primary_screen)); bg_tilemap = tilemap_create(machine, sqix_get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32); tilemap_set_transmask(bg_tilemap,0,0xffff,0x0000); /* split type 0 is totally transparent in front half */ diff --git a/src/mame/video/suprnova.c b/src/mame/video/suprnova.c index 19d661ab2f0..19fb80e60b4 100644 --- a/src/mame/video/suprnova.c +++ b/src/mame/video/suprnova.c @@ -912,13 +912,13 @@ VIDEO_START(skns) skns_tilemap_B = tilemap_create(machine, get_tilemap_B_tile_info,tilemap_scan_rows,16,16,64, 64); tilemap_set_transparent_pen(skns_tilemap_B,0); - sprite_bitmap = auto_bitmap_alloc(1024,1024,BITMAP_FORMAT_INDEXED16); + sprite_bitmap = auto_bitmap_alloc(machine,1024,1024,BITMAP_FORMAT_INDEXED16); - tilemap_bitmap_lower = auto_bitmap_alloc(320,240,BITMAP_FORMAT_INDEXED16); - tilemap_bitmapflags_lower = auto_bitmap_alloc(320,240,BITMAP_FORMAT_INDEXED8); + tilemap_bitmap_lower = auto_bitmap_alloc(machine,320,240,BITMAP_FORMAT_INDEXED16); + tilemap_bitmapflags_lower = auto_bitmap_alloc(machine,320,240,BITMAP_FORMAT_INDEXED8); - tilemap_bitmap_higher = auto_bitmap_alloc(320,240,BITMAP_FORMAT_INDEXED16); - tilemap_bitmapflags_higher = auto_bitmap_alloc(320,240,BITMAP_FORMAT_INDEXED8); + tilemap_bitmap_higher = auto_bitmap_alloc(machine,320,240,BITMAP_FORMAT_INDEXED16); + tilemap_bitmapflags_higher = auto_bitmap_alloc(machine,320,240,BITMAP_FORMAT_INDEXED8); machine->gfx[2]->color_granularity=256; machine->gfx[3]->color_granularity=256; diff --git a/src/mame/video/system1.c b/src/mame/video/system1.c index 57b24a2f448..daac677f3e9 100644 --- a/src/mame/video/system1.c +++ b/src/mame/video/system1.c @@ -126,15 +126,12 @@ static void video_start_common(running_machine *machine, int pagecount) int pagenum; /* allocate memory for the collision arrays */ - mix_collide = auto_malloc(64); - memset(mix_collide, 0, 64); - sprite_collide = auto_malloc(1024); - memset(sprite_collide, 0, 1024); + mix_collide = auto_alloc_array_clear(machine, UINT8, 64); + sprite_collide = auto_alloc_array_clear(machine, UINT8, 1024); /* allocate memory for videoram */ tilemap_pages = pagecount; - videoram = auto_malloc(0x800 * pagecount); - memset(videoram, 0, 0x800 * pagecount); + videoram = auto_alloc_array_clear(machine, UINT8, 0x800 * pagecount); /* create the tilemap pages */ for (pagenum = 0; pagenum < pagecount; pagenum++) @@ -145,7 +142,7 @@ static void video_start_common(running_machine *machine, int pagecount) } /* allocate a temporary bitmap for sprite rendering */ - sprite_bitmap = auto_bitmap_alloc(256, 256, BITMAP_FORMAT_INDEXED16); + sprite_bitmap = auto_bitmap_alloc(machine, 256, 256, BITMAP_FORMAT_INDEXED16); /* register for save stats */ state_save_register_global(machine, system1_video_mode); diff --git a/src/mame/video/taito_b.c b/src/mame/video/taito_b.c index 17cab772641..1e996a3944f 100644 --- a/src/mame/video/taito_b.c +++ b/src/mame/video/taito_b.c @@ -205,8 +205,8 @@ static TILE_GET_INFO( get_tx_tile_info ) static VIDEO_START( taitob_core ) { - framebuffer[0] = auto_bitmap_alloc(512,256, video_screen_get_format(machine->primary_screen)); - framebuffer[1] = auto_bitmap_alloc(512,256, video_screen_get_format(machine->primary_screen)); + framebuffer[0] = auto_bitmap_alloc(machine,512,256, video_screen_get_format(machine->primary_screen)); + framebuffer[1] = auto_bitmap_alloc(machine,512,256, video_screen_get_format(machine->primary_screen)); pixel_bitmap = NULL; /* only hitice needs this */ bg_tilemap = tilemap_create(machine, get_bg_tile_info,tilemap_scan_rows, 16,16,64,64); @@ -279,7 +279,7 @@ VIDEO_START( hitice ) { VIDEO_START_CALL(taitob_color_order0); - pixel_bitmap = auto_bitmap_alloc(1024,512,video_screen_get_format(machine->primary_screen)); + pixel_bitmap = auto_bitmap_alloc(machine,1024,512,video_screen_get_format(machine->primary_screen)); state_save_register_global_bitmap(machine, pixel_bitmap); } diff --git a/src/mame/video/taito_f2.c b/src/mame/video/taito_f2.c index da2859effcc..4dab4477eb6 100644 --- a/src/mame/video/taito_f2.c +++ b/src/mame/video/taito_f2.c @@ -89,9 +89,9 @@ static void taitof2_core_vh_start (running_machine *machine, int sprite_type,int f2_hide_pixels = hide; f2_flip_hide_pixels = flip_hide; - spriteram_delayed = auto_malloc(spriteram_size); - spriteram_buffered = auto_malloc(spriteram_size); - spritelist = auto_malloc(0x400 * sizeof(*spritelist)); + spriteram_delayed = auto_alloc_array(machine, UINT16, spriteram_size/2); + spriteram_buffered = auto_alloc_array(machine, UINT16, spriteram_size/2); + spritelist = auto_alloc_array(machine, struct tempsprite, 0x400); chips = TC0100SCN_count(machine); diff --git a/src/mame/video/taito_f3.c b/src/mame/video/taito_f3.c index 2b2da8aa973..8724733fbe6 100644 --- a/src/mame/video/taito_f3.c +++ b/src/mame/video/taito_f3.c @@ -664,19 +664,19 @@ VIDEO_START( f3 ) twidth_mask_bit=5; } - spriteram32_buffered = (UINT32 *)auto_malloc(0x10000); - spritelist = auto_malloc(0x400 * sizeof(*spritelist)); + spriteram32_buffered = auto_alloc_array(machine, UINT32, 0x10000/4); + spritelist = auto_alloc_array(machine, struct tempsprite, 0x400); sprite_end = spritelist; vram_layer = tilemap_create(machine, get_tile_info_vram,tilemap_scan_rows,8,8,64,64); pixel_layer = tilemap_create(machine, get_tile_info_pixel,tilemap_scan_cols,8,8,64,32); - pf_line_inf = auto_malloc(5 * sizeof(struct f3_playfield_line_inf)); - sa_line_inf = auto_malloc(1 * sizeof(struct f3_spritealpha_line_inf)); + pf_line_inf = auto_alloc_array(machine, struct f3_playfield_line_inf, 5); + sa_line_inf = auto_alloc_array(machine, struct f3_spritealpha_line_inf, 1); width = video_screen_get_width(machine->primary_screen); height = video_screen_get_height(machine->primary_screen); - pri_alp_bitmap = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED8 ); - tile_opaque_sp = (UINT8 *)auto_malloc(machine->gfx[2]->total_elements); + pri_alp_bitmap = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED8 ); + tile_opaque_sp = auto_alloc_array(machine, UINT8, machine->gfx[2]->total_elements); for (i=0; i<4; i++) - tile_opaque_pf[i] = (UINT8 *)auto_malloc(machine->gfx[1]->total_elements); + tile_opaque_pf[i] = auto_alloc_array(machine, UINT8, machine->gfx[1]->total_elements); tilemap_set_transparent_pen(pf1_tilemap,0); tilemap_set_transparent_pen(pf2_tilemap,0); diff --git a/src/mame/video/taitoic.c b/src/mame/video/taitoic.c index 9c2665c55f3..3bb954c788e 100644 --- a/src/mame/video/taitoic.c +++ b/src/mame/video/taitoic.c @@ -806,13 +806,12 @@ void PC080SN_vh_start(running_machine *machine,int chips,int gfxnum,int x_offset PC080SN_tilemap[i][1] = tilemap_create(machine, PC080SN_get_tile_info[i][1],tilemap_scan_rows,8,8,128,64); } - PC080SN_ram[i] = auto_malloc(PC080SN_RAM_SIZE); + PC080SN_ram[i] = auto_alloc_array_clear(machine, UINT16, PC080SN_RAM_SIZE/2); PC080SN_bg_ram[i][0] = PC080SN_ram[i] + 0x0000 /2; PC080SN_bg_ram[i][1] = PC080SN_ram[i] + 0x8000 /2; PC080SN_bgscroll_ram[i][0] = PC080SN_ram[i] + 0x4000 /2; PC080SN_bgscroll_ram[i][1] = PC080SN_ram[i] + 0xc000 /2; - memset(PC080SN_ram[i],0,PC080SN_RAM_SIZE); state_save_register_item_pointer(machine, "PC080SN", NULL, i, PC080SN_ram[i], PC080SN_RAM_SIZE/2); state_save_register_item_array(machine, "PC080SN", NULL, i, PC080SN_ctrl[i]); @@ -1223,11 +1222,8 @@ void PC090OJ_vh_start(running_machine *machine,int gfxnum,int x_offset,int y_off PC090OJ_buffer = use_buffer; - PC090OJ_ram = auto_malloc(PC090OJ_RAM_SIZE); - PC090OJ_ram_buffered = auto_malloc(PC090OJ_RAM_SIZE); - - memset(PC090OJ_ram,0,PC090OJ_RAM_SIZE); - memset(PC090OJ_ram_buffered,0,PC090OJ_RAM_SIZE); + PC090OJ_ram = auto_alloc_array_clear(machine, UINT16, PC090OJ_RAM_SIZE/2); + PC090OJ_ram_buffered = auto_alloc_array_clear(machine, UINT16, PC090OJ_RAM_SIZE/2); state_save_register_global_pointer(machine, PC090OJ_ram, PC090OJ_RAM_SIZE/2); state_save_register_global_pointer(machine, PC090OJ_ram_buffered, PC090OJ_RAM_SIZE/2); @@ -1525,9 +1521,8 @@ void TC0080VCO_vh_start(running_machine *machine, int gfxnum,int has_fg0,int bg_ TC0080VCO_tilemap[0] = tilemap_create(machine, TC0080VCO_get_bg0_tile_info_0,tilemap_scan_rows,16,16,64,64); TC0080VCO_tilemap[1] = tilemap_create(machine, TC0080VCO_get_bg1_tile_info_0,tilemap_scan_rows,16,16,64,64); - TC0080VCO_ram = auto_malloc(TC0080VCO_RAM_SIZE); + TC0080VCO_ram = auto_alloc_array_clear(machine, UINT16, TC0080VCO_RAM_SIZE/2); - memset( TC0080VCO_ram,0,TC0080VCO_RAM_SIZE ); TC0080VCO_set_layer_ptrs(); /* use the given gfx set for bg tiles*/ @@ -2283,10 +2278,9 @@ void TC0100SCN_vh_start(running_machine *machine, int chips,int gfxnum,int x_off TC0100SCN_cliprect[i] = myclip; - TC0100SCN_ram[i] = auto_malloc(TC0100SCN_RAM_SIZE); + TC0100SCN_ram[i] = auto_alloc_array_clear(machine, UINT16, TC0100SCN_RAM_SIZE/2); TC0100SCN_set_layer_ptrs(i); - memset(TC0100SCN_ram[i],0,TC0100SCN_RAM_SIZE); { state_save_register_item_pointer(machine, "TC0100SCN", NULL, i, TC0100SCN_ram[i], TC0100SCN_RAM_SIZE/2); @@ -2724,7 +2718,7 @@ static TILE_GET_INFO( TC0280GRD_get_tile_info ) void TC0280GRD_vh_start(running_machine *machine, int gfxnum) { - TC0280GRD_ram = auto_malloc(TC0280GRD_RAM_SIZE); + TC0280GRD_ram = auto_alloc_array(machine, UINT16, TC0280GRD_RAM_SIZE/2); TC0280GRD_tilemap = tilemap_create(machine, TC0280GRD_get_tile_info,tilemap_scan_rows,8,8,64,64); state_save_register_global_pointer(machine, TC0280GRD_ram, TC0280GRD_RAM_SIZE/2); @@ -3086,10 +3080,9 @@ void TC0480SCP_vh_start(running_machine *machine, int gfxnum,int pixels,int x_of TC0480SCP_tilemap[3][1] = tilemap_create(machine, tc480_get_tile_info[3],tilemap_scan_rows,16,16,64,32); TC0480SCP_tilemap[4][1] = tilemap_create(machine, tc480_get_tile_info[4],tilemap_scan_rows,8,8,64,64); - TC0480SCP_ram = auto_malloc(TC0480SCP_RAM_SIZE); + TC0480SCP_ram = auto_alloc_array_clear(machine, UINT16, TC0480SCP_RAM_SIZE/2); TC0480SCP_set_layer_ptrs(); - memset(TC0480SCP_ram,0,TC0480SCP_RAM_SIZE); state_save_register_global_pointer(machine, TC0480SCP_ram, TC0480SCP_RAM_SIZE/2); state_save_register_global_array(machine, TC0480SCP_ctrl); @@ -3805,7 +3798,7 @@ WRITE16_HANDLER( TC0150ROD_word_w ) void TC0150ROD_vh_start(running_machine *machine) { - TC0150ROD_ram = auto_malloc(TC0150ROD_RAM_SIZE); + TC0150ROD_ram = auto_alloc_array(machine, UINT16, TC0150ROD_RAM_SIZE/2); state_save_register_global_pointer(machine, TC0150ROD_ram, TC0150ROD_RAM_SIZE/2); } @@ -4602,7 +4595,7 @@ static STATE_POSTLOAD( TC0110PCR_restore_colors ) void TC0110PCR_vh_start(running_machine *machine) { - TC0110PCR_ram[0] = auto_malloc(TC0110PCR_RAM_SIZE * sizeof(*TC0110PCR_ram[0])); + TC0110PCR_ram[0] = auto_alloc_array(machine, UINT16, TC0110PCR_RAM_SIZE); state_save_register_global_pointer(machine, TC0110PCR_ram[0], TC0110PCR_RAM_SIZE); state_save_register_postload(machine, TC0110PCR_restore_colors, (void *)0); @@ -4612,7 +4605,7 @@ void TC0110PCR_vh_start(running_machine *machine) void TC0110PCR_1_vh_start(running_machine *machine) { - TC0110PCR_ram[1] = auto_malloc(TC0110PCR_RAM_SIZE * sizeof(*TC0110PCR_ram[1])); + TC0110PCR_ram[1] = auto_alloc_array(machine, UINT16, TC0110PCR_RAM_SIZE); state_save_register_global_pointer(machine, TC0110PCR_ram[1], TC0110PCR_RAM_SIZE); state_save_register_postload(machine, TC0110PCR_restore_colors, (void *)1); @@ -4620,7 +4613,7 @@ void TC0110PCR_1_vh_start(running_machine *machine) void TC0110PCR_2_vh_start(running_machine *machine) { - TC0110PCR_ram[2] = auto_malloc(TC0110PCR_RAM_SIZE * sizeof(*TC0110PCR_ram[2])); + TC0110PCR_ram[2] = auto_alloc_array(machine, UINT16, TC0110PCR_RAM_SIZE); state_save_register_global_pointer(machine, TC0110PCR_ram[2], TC0110PCR_RAM_SIZE); state_save_register_postload(machine, TC0110PCR_restore_colors, (void *)2); diff --git a/src/mame/video/taitojc.c b/src/mame/video/taitojc.c index 7e66b920379..478cbf334da 100644 --- a/src/mame/video/taitojc.c +++ b/src/mame/video/taitojc.c @@ -189,22 +189,19 @@ VIDEO_START( taitojc ) tilemap_set_transparent_pen(taitojc_tilemap, 0); - taitojc_char_ram = auto_malloc(0x4000); - taitojc_tile_ram = auto_malloc(0x4000); - - memset(taitojc_char_ram, 0, 0x4000); - memset(taitojc_tile_ram, 0, 0x4000); + taitojc_char_ram = auto_alloc_array_clear(machine, UINT32, 0x4000/4); + taitojc_tile_ram = auto_alloc_array_clear(machine, UINT32, 0x4000/4); /* create the char set (gfx will then be updated dynamically from RAM) */ machine->gfx[taitojc_gfx_index] = gfx_element_alloc(machine, &taitojc_char_layout, (UINT8 *)taitojc_char_ram, machine->config->total_colors / 16, 0); - taitojc_texture = auto_malloc(0x400000); + taitojc_texture = auto_alloc_array(machine, UINT8, 0x400000); framebuffer = video_screen_auto_bitmap_alloc(machine->primary_screen); width = video_screen_get_width(machine->primary_screen); height = video_screen_get_height(machine->primary_screen); - zbuffer = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED16); + zbuffer = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16); } //static int tick = 0; diff --git a/src/mame/video/taitosj.c b/src/mame/video/taitosj.c index 5158ba191bb..387345ecf23 100644 --- a/src/mame/video/taitosj.c +++ b/src/mame/video/taitosj.c @@ -192,7 +192,7 @@ VIDEO_START( taitosj ) { int i; - sprite_layer_collbitmap1 = auto_bitmap_alloc(16,16,video_screen_get_format(machine->primary_screen)); + sprite_layer_collbitmap1 = auto_bitmap_alloc(machine,16,16,video_screen_get_format(machine->primary_screen)); for (i = 0; i < 3; i++) { @@ -200,8 +200,8 @@ VIDEO_START( taitosj ) sprite_layer_collbitmap2[i] = video_screen_auto_bitmap_alloc(machine->primary_screen); } - sprite_sprite_collbitmap1 = auto_bitmap_alloc(32,32,video_screen_get_format(machine->primary_screen)); - sprite_sprite_collbitmap2 = auto_bitmap_alloc(32,32,video_screen_get_format(machine->primary_screen)); + sprite_sprite_collbitmap1 = auto_bitmap_alloc(machine,32,32,video_screen_get_format(machine->primary_screen)); + sprite_sprite_collbitmap2 = auto_bitmap_alloc(machine,32,32,video_screen_get_format(machine->primary_screen)); gfx_element_set_source(machine->gfx[0], taitosj_characterram); gfx_element_set_source(machine->gfx[1], taitosj_characterram); diff --git a/src/mame/video/taotaido.c b/src/mame/video/taotaido.c index c985873c3d4..76c77cb5b67 100644 --- a/src/mame/video/taotaido.c +++ b/src/mame/video/taotaido.c @@ -194,11 +194,11 @@ VIDEO_START(taotaido) { bg_tilemap = tilemap_create(machine, taotaido_bg_tile_info,taotaido_tilemap_scan_rows, 16,16,128,64); - taotaido_spriteram_old = auto_malloc(0x2000); - taotaido_spriteram_older = auto_malloc(0x2000); + taotaido_spriteram_old = auto_alloc_array(machine, UINT16, 0x2000/2); + taotaido_spriteram_older = auto_alloc_array(machine, UINT16, 0x2000/2); - taotaido_spriteram2_old = auto_malloc(0x10000); - taotaido_spriteram2_older = auto_malloc(0x10000); + taotaido_spriteram2_old = auto_alloc_array(machine, UINT16, 0x10000/2); + taotaido_spriteram2_older = auto_alloc_array(machine, UINT16, 0x10000/2); } diff --git a/src/mame/video/tatsumi.c b/src/mame/video/tatsumi.c index 03ae2988c0d..425f3460026 100644 --- a/src/mame/video/tatsumi.c +++ b/src/mame/video/tatsumi.c @@ -206,21 +206,19 @@ static TILE_GET_INFO( get_tile_info_bigfight_1 ) VIDEO_START( apache3 ) { tx_layer = tilemap_create(machine, get_text_tile_info,tilemap_scan_rows,8,8,64,64); - shadow_pen_array = auto_malloc(8192); - temp_bitmap = auto_bitmap_alloc(512, 512, BITMAP_FORMAT_RGB32); - apache3_road_x_ram = auto_malloc(512 * sizeof(UINT16)); + shadow_pen_array = auto_alloc_array_clear(machine, UINT8, 8192); + temp_bitmap = auto_bitmap_alloc(machine, 512, 512, BITMAP_FORMAT_RGB32); + apache3_road_x_ram = auto_alloc_array(machine, UINT8, 512); - memset(shadow_pen_array, 0, 8192); tilemap_set_transparent_pen(tx_layer,0); } VIDEO_START( roundup5 ) { tx_layer = tilemap_create(machine, get_text_tile_info,tilemap_scan_rows,8,8,128,64); - shadow_pen_array = auto_malloc(8192); - roundup5_vram = auto_malloc(0x48000 * 4); + shadow_pen_array = auto_alloc_array_clear(machine, UINT8, 8192); + roundup5_vram = auto_alloc_array(machine, UINT16, (0x48000 * 4)/2); - memset(shadow_pen_array, 0, 8192); tilemap_set_transparent_pen(tx_layer,0); gfx_element_set_source(machine->gfx[1], (UINT8 *)roundup5_vram); @@ -234,8 +232,7 @@ VIDEO_START( cyclwarr ) layer2 = tilemap_create(machine, get_tile_info_bigfight_1,tilemap_scan_rows,8,8,64,512); layer3 = tilemap_create(machine, get_tile_info_bigfight_1,tilemap_scan_rows,8,8,64,512); - shadow_pen_array = auto_malloc(8192); - memset(shadow_pen_array, 0, 8192); + shadow_pen_array = auto_alloc_array_clear(machine, UINT8, 8192); } VIDEO_START( bigfight ) @@ -245,8 +242,7 @@ VIDEO_START( bigfight ) layer2 = tilemap_create(machine, get_tile_info_bigfight_1,tilemap_scan_rows,8,8,128,256); layer3 = tilemap_create(machine, get_tile_info_bigfight_1,tilemap_scan_rows,8,8,128,256); - shadow_pen_array = auto_malloc(8192); - memset(shadow_pen_array, 0, 8192); + shadow_pen_array = auto_alloc_array_clear(machine, UINT8, 8192); } /********************************************************************/ diff --git a/src/mame/video/tceptor.c b/src/mame/video/tceptor.c index a59b46f6b5f..bc97bdadfe7 100644 --- a/src/mame/video/tceptor.c +++ b/src/mame/video/tceptor.c @@ -263,7 +263,7 @@ static void decode_bg(running_machine *machine, const char * region) int len = 0x8000; int i; - buffer = malloc_or_die(len); + buffer = alloc_array_or_die(UINT8, len); /* expand rom tc2-19.10d */ for (i = 0; i < len / 2; i++) @@ -310,7 +310,7 @@ static void decode_sprite16(running_machine *machine, const char * region) UINT8 *dst; int i, y; - dst = auto_malloc(len); + dst = auto_alloc_array(machine, UINT8, len); for (i = 0; i < len / (4*4*16); i++) for (y = 0; y < 16; y++) @@ -363,7 +363,7 @@ static void decode_sprite32(running_machine *machine, const char * region) UINT8 *dst; int i; - dst = auto_malloc(len); + dst = auto_alloc_array(machine, UINT8, len); memset(dst, 0, len); @@ -385,8 +385,7 @@ VIDEO_START( tceptor ) { int gfx_index; - tceptor_sprite_ram_buffered = auto_malloc(0x200); - memset(tceptor_sprite_ram_buffered, 0, 0x200); + tceptor_sprite_ram_buffered = auto_alloc_array_clear(machine, UINT16, 0x200/2); /* find first empty slot to decode gfx */ for (gfx_index = 0; gfx_index < MAX_GFX_ELEMENTS; gfx_index++) diff --git a/src/mame/video/tecmo16.c b/src/mame/video/tecmo16.c index 1dc68bcb2ab..a2c87aa6ce7 100644 --- a/src/mame/video/tecmo16.c +++ b/src/mame/video/tecmo16.c @@ -68,11 +68,11 @@ VIDEO_START( fstarfrc ) int height = video_screen_get_height(machine->primary_screen); /* set up tile layers */ - tile_bitmap_bg = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED16); - tile_bitmap_fg = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED16); + tile_bitmap_bg = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16); + tile_bitmap_fg = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16); /* set up sprites */ - sprite_bitmap = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED16); + sprite_bitmap = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16); fg_tilemap = tilemap_create(machine, fg_get_tile_info,tilemap_scan_rows,16,16,32,32); bg_tilemap = tilemap_create(machine, bg_get_tile_info,tilemap_scan_rows,16,16,32,32); @@ -93,11 +93,11 @@ VIDEO_START( ginkun ) int height = video_screen_get_height(machine->primary_screen); /* set up tile layers */ - tile_bitmap_bg = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED16); - tile_bitmap_fg = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED16); + tile_bitmap_bg = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16); + tile_bitmap_fg = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16); /* set up sprites */ - sprite_bitmap = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED16); + sprite_bitmap = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16); fg_tilemap = tilemap_create(machine, fg_get_tile_info,tilemap_scan_rows,16,16,64,32); bg_tilemap = tilemap_create(machine, bg_get_tile_info,tilemap_scan_rows,16,16,64,32); @@ -116,11 +116,11 @@ VIDEO_START( riot ) int height = video_screen_get_height(machine->primary_screen); /* set up tile layers */ - tile_bitmap_bg = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED16); - tile_bitmap_fg = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED16); + tile_bitmap_bg = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16); + tile_bitmap_fg = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16); /* set up sprites */ - sprite_bitmap = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED16); + sprite_bitmap = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16); fg_tilemap = tilemap_create(machine, fg_get_tile_info,tilemap_scan_rows,16,16,64,32); bg_tilemap = tilemap_create(machine, bg_get_tile_info,tilemap_scan_rows,16,16,64,32); diff --git a/src/mame/video/thepit.c b/src/mame/video/thepit.c index f9a4f35f656..fe87b612683 100644 --- a/src/mame/video/thepit.c +++ b/src/mame/video/thepit.c @@ -155,8 +155,7 @@ VIDEO_START( thepit ) tilemap_set_scroll_cols(thepit_solid_tilemap, 32); tilemap_set_scroll_cols(thepit_tilemap, 32); - dummy_tile = auto_malloc(8*8); - memset(dummy_tile, 0, 8*8); + dummy_tile = auto_alloc_array_clear(machine, UINT8, 8*8); graphics_bank = 0; /* only used in intrepid */ } diff --git a/src/mame/video/thief.c b/src/mame/video/thief.c index 9c89281cddd..d7c21628a80 100644 --- a/src/mame/video/thief.c +++ b/src/mame/video/thief.c @@ -103,11 +103,10 @@ WRITE8_HANDLER( thief_videoram_w ){ VIDEO_START( thief ){ memset( &thief_coprocessor, 0x00, sizeof(thief_coprocessor) ); - videoram = auto_malloc( 0x2000*4*2 ); - memset( videoram, 0, 0x2000*4*2 ); + videoram = auto_alloc_array_clear(machine, UINT8, 0x2000*4*2 ); - thief_coprocessor.image_ram = auto_malloc( 0x2000 ); - thief_coprocessor.context_ram = auto_malloc( 0x400 ); + thief_coprocessor.image_ram = auto_alloc_array(machine, UINT8, 0x2000 ); + thief_coprocessor.context_ram = auto_alloc_array(machine, UINT8, 0x400 ); } VIDEO_UPDATE( thief ){ diff --git a/src/mame/video/thoop2.c b/src/mame/video/thoop2.c index 11768d76918..505025c4d57 100644 --- a/src/mame/video/thoop2.c +++ b/src/mame/video/thoop2.c @@ -95,7 +95,7 @@ VIDEO_START( thoop2 ) tilemap_set_transmask(pant[1],0,0xff01,0x00ff); /* pens 1-7 opaque, pens 0, 8-15 transparent */ for (i = 0; i < 5; i++){ - sprite_table[i] = auto_malloc(512*sizeof(int)); + sprite_table[i] = auto_alloc_array(machine, int, 512); } } diff --git a/src/mame/video/tia.c b/src/mame/video/tia.c index 6b56c5e05d1..d1e0e22b016 100644 --- a/src/mame/video/tia.c +++ b/src/mame/video/tia.c @@ -274,9 +274,9 @@ VIDEO_START( tia ) int cx = video_screen_get_width(machine->primary_screen); screen_height = video_screen_get_height(machine->primary_screen); - helper[0] = auto_bitmap_alloc(cx, TIA_MAX_SCREEN_HEIGHT, video_screen_get_format(machine->primary_screen)); - helper[1] = auto_bitmap_alloc(cx, TIA_MAX_SCREEN_HEIGHT, video_screen_get_format(machine->primary_screen)); - helper[2] = auto_bitmap_alloc(cx, TIA_MAX_SCREEN_HEIGHT, video_screen_get_format(machine->primary_screen)); + helper[0] = auto_bitmap_alloc(machine, cx, TIA_MAX_SCREEN_HEIGHT, video_screen_get_format(machine->primary_screen)); + helper[1] = auto_bitmap_alloc(machine, cx, TIA_MAX_SCREEN_HEIGHT, video_screen_get_format(machine->primary_screen)); + helper[2] = auto_bitmap_alloc(machine, cx, TIA_MAX_SCREEN_HEIGHT, video_screen_get_format(machine->primary_screen)); } diff --git a/src/mame/video/tiamc1.c b/src/mame/video/tiamc1.c index edfa35c5b0c..fbb039b664b 100644 --- a/src/mame/video/tiamc1.c +++ b/src/mame/video/tiamc1.c @@ -103,7 +103,7 @@ PALETTE_INIT( tiamc1 ) int r, g, b, ir, ig, ib; float tcol; - palette = auto_malloc(256 * sizeof(*palette)); + palette = auto_alloc_array(machine, rgb_t, 256); for (col = 0; col < 256; col++) { ir = (col >> 3) & 7; @@ -134,8 +134,7 @@ VIDEO_START( tiamc1 ) { UINT8 *video_ram; - video_ram = auto_malloc(0x3040); - memset(video_ram, 0, 0x3040); + video_ram = auto_alloc_array_clear(machine, UINT8, 0x3040); tiamc1_charram = video_ram + 0x0800; /* Ram is banked */ tiamc1_tileram = video_ram + 0x0000; diff --git a/src/mame/video/toaplan1.c b/src/mame/video/toaplan1.c index 15b9ff315aa..6d094b40e9d 100644 --- a/src/mame/video/toaplan1.c +++ b/src/mame/video/toaplan1.c @@ -267,39 +267,25 @@ static void toaplan1_create_tilemaps(running_machine *machine) } -static void toaplan1_paletteram_alloc(void) +static void toaplan1_paletteram_alloc(running_machine *machine) { - paletteram16 = auto_malloc(toaplan1_colorram1_size + toaplan1_colorram2_size); + paletteram16 = auto_alloc_array(machine, UINT16, (toaplan1_colorram1_size + toaplan1_colorram2_size)/2); } -static void toaplan1_vram_alloc(void) +static void toaplan1_vram_alloc(running_machine *machine) { - pf1_tilevram16 = auto_malloc(TOAPLAN1_TILEVRAM_SIZE); - memset(pf1_tilevram16,0,TOAPLAN1_TILEVRAM_SIZE); - - pf2_tilevram16 = auto_malloc(TOAPLAN1_TILEVRAM_SIZE); - memset(pf2_tilevram16,0,TOAPLAN1_TILEVRAM_SIZE); - - pf3_tilevram16 = auto_malloc(TOAPLAN1_TILEVRAM_SIZE); - memset(pf3_tilevram16,0,TOAPLAN1_TILEVRAM_SIZE); - - pf4_tilevram16 = auto_malloc(TOAPLAN1_TILEVRAM_SIZE); - memset(pf4_tilevram16,0,TOAPLAN1_TILEVRAM_SIZE); + pf1_tilevram16 = auto_alloc_array_clear(machine, UINT16, TOAPLAN1_TILEVRAM_SIZE/2); + pf2_tilevram16 = auto_alloc_array_clear(machine, UINT16, TOAPLAN1_TILEVRAM_SIZE/2); + pf3_tilevram16 = auto_alloc_array_clear(machine, UINT16, TOAPLAN1_TILEVRAM_SIZE/2); + pf4_tilevram16 = auto_alloc_array_clear(machine, UINT16, TOAPLAN1_TILEVRAM_SIZE/2); } -static void toaplan1_spritevram_alloc(void) +static void toaplan1_spritevram_alloc(running_machine *machine) { - spriteram16 = auto_malloc(TOAPLAN1_SPRITERAM_SIZE); - memset(spriteram16,0,TOAPLAN1_SPRITERAM_SIZE); - - buffered_spriteram16 = auto_malloc(TOAPLAN1_SPRITERAM_SIZE); - memset(buffered_spriteram16,0,TOAPLAN1_SPRITERAM_SIZE); - - toaplan1_spritesizeram16 = auto_malloc(TOAPLAN1_SPRITESIZERAM_SIZE); - memset(toaplan1_spritesizeram16,0,TOAPLAN1_SPRITESIZERAM_SIZE); - - toaplan1_buffered_spritesizeram16 = auto_malloc(TOAPLAN1_SPRITESIZERAM_SIZE); - memset(toaplan1_buffered_spritesizeram16,0,TOAPLAN1_SPRITESIZERAM_SIZE); + spriteram16 = auto_alloc_array_clear(machine, UINT16, TOAPLAN1_SPRITERAM_SIZE/2); + buffered_spriteram16 = auto_alloc_array_clear(machine, UINT16, TOAPLAN1_SPRITERAM_SIZE/2); + toaplan1_spritesizeram16 = auto_alloc_array_clear(machine, UINT16, TOAPLAN1_SPRITESIZERAM_SIZE/2); + toaplan1_buffered_spritesizeram16 = auto_alloc_array_clear(machine, UINT16, TOAPLAN1_SPRITESIZERAM_SIZE/2); spriteram_size = TOAPLAN1_SPRITERAM_SIZE; } @@ -332,8 +318,8 @@ static STATE_POSTLOAD( toaplan1_flipscreen ) VIDEO_START( rallybik ) { toaplan1_create_tilemaps(machine); - toaplan1_paletteram_alloc(); - toaplan1_vram_alloc(); + toaplan1_paletteram_alloc(machine); + toaplan1_vram_alloc(machine); scrollx_offs1 = 0x0d + 6; scrollx_offs2 = 0x0d + 4; @@ -375,9 +361,9 @@ VIDEO_START( rallybik ) VIDEO_START( toaplan1 ) { toaplan1_create_tilemaps(machine); - toaplan1_paletteram_alloc(); - toaplan1_vram_alloc(); - toaplan1_spritevram_alloc(); + toaplan1_paletteram_alloc(machine); + toaplan1_vram_alloc(machine); + toaplan1_spritevram_alloc(machine); scrollx_offs1 = 0x1ef + 6; scrollx_offs2 = 0x1ef + 4; diff --git a/src/mame/video/toaplan2.c b/src/mame/video/toaplan2.c index 5ff5bf161e8..6e16ae7eaa6 100644 --- a/src/mame/video/toaplan2.c +++ b/src/mame/video/toaplan2.c @@ -458,29 +458,20 @@ static void batrider_create_tilemaps_0(running_machine *machine) } -static void toaplan2_vram_alloc(int controller) +static void toaplan2_vram_alloc(running_machine *machine, int controller) { - spriteram16_new[controller] = auto_malloc(TOAPLAN2_SPRITERAM_SIZE); - memset(spriteram16_new[controller],0,TOAPLAN2_SPRITERAM_SIZE); - - spriteram16_now[controller] = auto_malloc(TOAPLAN2_SPRITERAM_SIZE); - memset(spriteram16_now[controller],0,TOAPLAN2_SPRITERAM_SIZE); - - topvideoram16[controller] = auto_malloc(TOAPLAN2_TOP_VRAM_SIZE); - memset(topvideoram16[controller],0,TOAPLAN2_TOP_VRAM_SIZE); - - fgvideoram16[controller] = auto_malloc(TOAPLAN2_FG_VRAM_SIZE); - memset(fgvideoram16[controller],0,TOAPLAN2_FG_VRAM_SIZE); - - bgvideoram16[controller] = auto_malloc(TOAPLAN2_BG_VRAM_SIZE); - memset(bgvideoram16[controller],0,TOAPLAN2_BG_VRAM_SIZE); + spriteram16_new[controller] = auto_alloc_array_clear(machine, UINT16, TOAPLAN2_SPRITERAM_SIZE/2); + spriteram16_now[controller] = auto_alloc_array_clear(machine, UINT16, TOAPLAN2_SPRITERAM_SIZE/2); + topvideoram16[controller] = auto_alloc_array_clear(machine, UINT16, TOAPLAN2_TOP_VRAM_SIZE/2); + fgvideoram16[controller] = auto_alloc_array_clear(machine, UINT16, TOAPLAN2_FG_VRAM_SIZE/2); + bgvideoram16[controller] = auto_alloc_array_clear(machine, UINT16, TOAPLAN2_BG_VRAM_SIZE/2); spriteram16_n[controller] = spriteram16_now[controller]; } static void toaplan2_vh_start(running_machine *machine, int controller) { - toaplan2_vram_alloc(controller); + toaplan2_vram_alloc(machine, controller); if (controller == 0) { @@ -556,7 +547,7 @@ VIDEO_START( toaplan2_1 ) VIDEO_START( truxton2_0 ) { - toaplan2_vram_alloc(0); + toaplan2_vram_alloc(machine, 0); truxton2_create_tilemaps_0(machine); if (machine->gfx[2]->srcdata == NULL) @@ -586,7 +577,7 @@ VIDEO_START( truxton2_0 ) VIDEO_START( bgaregga_0 ) { - toaplan2_vram_alloc(0); + toaplan2_vram_alloc(machine, 0); truxton2_create_tilemaps_0(machine); tilemap_set_scrolldx(tx_tilemap, 0x1d4, 0x2a); defaultOffsets(); @@ -595,13 +586,12 @@ VIDEO_START( bgaregga_0 ) VIDEO_START( batrider_0 ) { - raizing_tx_gfxram16 = auto_malloc(RAIZING_TX_GFXRAM_SIZE); - memset(raizing_tx_gfxram16,0,RAIZING_TX_GFXRAM_SIZE); + raizing_tx_gfxram16 = auto_alloc_array_clear(machine, UINT16, RAIZING_TX_GFXRAM_SIZE/2); state_save_register_global_pointer(machine, raizing_tx_gfxram16, RAIZING_TX_GFXRAM_SIZE/2); gfx_element_set_source(machine->gfx[2], (UINT8 *)raizing_tx_gfxram16); - toaplan2_vram_alloc(0); + toaplan2_vram_alloc(machine, 0); spriteram16_n[0] = spriteram16_new[0]; batrider_create_tilemaps_0(machine); diff --git a/src/mame/video/toobin.c b/src/mame/video/toobin.c index 416f1491ac6..71af177c6cd 100644 --- a/src/mame/video/toobin.c +++ b/src/mame/video/toobin.c @@ -104,7 +104,7 @@ VIDEO_START( toobin ) tilemap_set_transparent_pen(atarigen_alpha_tilemap, 0); /* allocate a playfield bitmap for rendering */ - pfbitmap = auto_bitmap_alloc(video_screen_get_width(machine->primary_screen), video_screen_get_height(machine->primary_screen), BITMAP_FORMAT_INDEXED16); + pfbitmap = auto_bitmap_alloc(machine, video_screen_get_width(machine->primary_screen), video_screen_get_height(machine->primary_screen), BITMAP_FORMAT_INDEXED16); } diff --git a/src/mame/video/tryout.c b/src/mame/video/tryout.c index ec32afafb05..8799ecc5500 100644 --- a/src/mame/video/tryout.c +++ b/src/mame/video/tryout.c @@ -175,8 +175,8 @@ VIDEO_START( tryout ) fg_tilemap = tilemap_create(machine, get_fg_tile_info,get_fg_memory_offset,8,8,32,32); bg_tilemap = tilemap_create(machine, get_bg_tile_info,get_bg_memory_offset,16,16,64,16); - tryout_vram=auto_malloc(8 * 0x800); - tryout_vram_gfx=auto_malloc(0x6000); + tryout_vram=auto_alloc_array(machine, UINT8, 8 * 0x800); + tryout_vram_gfx=auto_alloc_array(machine, UINT8, 0x6000); gfx_element_set_source(machine->gfx[2], tryout_vram_gfx); diff --git a/src/mame/video/tubep.c b/src/mame/video/tubep.c index c08bb903168..5cc6bd586b1 100644 --- a/src/mame/video/tubep.c +++ b/src/mame/video/tubep.c @@ -367,7 +367,7 @@ PALETTE_INIT( tubep ) VIDEO_START( tubep ) { - spritemap = auto_malloc(256*256*2); + spritemap = auto_alloc_array(machine, UINT8, 256*256*2); /* Set up save state */ state_save_register_global(machine, romD_addr); diff --git a/src/mame/video/tunhunt.c b/src/mame/video/tunhunt.c index 5874ee12b02..81f88d0bcf0 100644 --- a/src/mame/video/tunhunt.c +++ b/src/mame/video/tunhunt.c @@ -72,7 +72,7 @@ VIDEO_START( tunhunt ) We keep track of dirty lines and cache the expanded bitmap. With max RLE expansion, bitmap size is 256x64. */ - tmpbitmap = auto_bitmap_alloc(256, 64, video_screen_get_format(machine->primary_screen)); + tmpbitmap = auto_bitmap_alloc(machine, 256, 64, video_screen_get_format(machine->primary_screen)); fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_cols, 8, 8, 32, 32); diff --git a/src/mame/video/turbo.c b/src/mame/video/turbo.c index 386584fe5a3..031397292fd 100644 --- a/src/mame/video/turbo.c +++ b/src/mame/video/turbo.c @@ -190,7 +190,7 @@ VIDEO_START( buckrog ) state->fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows, 8,8, 32,32); /* allocate the bitmap RAM */ - state->buckrog_bitmap_ram = auto_malloc(0xe000); + state->buckrog_bitmap_ram = auto_alloc_array(machine, UINT8, 0xe000); state_save_register_global_pointer(machine, state->buckrog_bitmap_ram, 0xe000); } diff --git a/src/mame/video/twincobr.c b/src/mame/video/twincobr.c index 523f91c6482..93d04cc9c17 100644 --- a/src/mame/video/twincobr.c +++ b/src/mame/video/twincobr.c @@ -120,14 +120,9 @@ VIDEO_START( toaplan0 ) twincobr_create_tilemaps(machine); - twincobr_txvideoram16 = auto_malloc(twincobr_txvideoram_size*2); - memset(twincobr_txvideoram16,0,twincobr_txvideoram_size*2); - - twincobr_fgvideoram16 = auto_malloc(twincobr_fgvideoram_size*2); - memset(twincobr_fgvideoram16,0,twincobr_fgvideoram_size*2); - - twincobr_bgvideoram16 = auto_malloc(twincobr_bgvideoram_size*2); - memset(twincobr_bgvideoram16,0,twincobr_bgvideoram_size*2); + twincobr_txvideoram16 = auto_alloc_array_clear(machine, UINT16, twincobr_txvideoram_size); + twincobr_fgvideoram16 = auto_alloc_array_clear(machine, UINT16, twincobr_fgvideoram_size); + twincobr_bgvideoram16 = auto_alloc_array_clear(machine, UINT16, twincobr_bgvideoram_size); twincobr_display_on = 0; twincobr_display(twincobr_display_on); diff --git a/src/mame/video/tx1.c b/src/mame/video/tx1.c index d7cc8d708f7..f6a35ef4a83 100644 --- a/src/mame/video/tx1.c +++ b/src/mame/video/tx1.c @@ -1122,13 +1122,13 @@ static void tx1_draw_objects(running_machine *machine, UINT8 *bitmap) VIDEO_START( tx1 ) { /* Allocate a large bitmap that covers the three screens */ - tx1_bitmap = auto_bitmap_alloc(768, 256, BITMAP_FORMAT_INDEXED16); + tx1_bitmap = auto_bitmap_alloc(machine, 768, 256, BITMAP_FORMAT_INDEXED16); tx1_texture = render_texture_alloc(NULL, NULL); /* Allocate some bitmaps */ - tx1_chr_bmp = auto_malloc(sizeof(UINT8) * 256 * 3 * 240); - tx1_obj_bmp = auto_malloc(sizeof(UINT8) * 256 * 3 * 240); - tx1_rod_bmp = auto_malloc(sizeof(UINT8) * 256 * 3 * 240); + tx1_chr_bmp = auto_alloc_array(machine, UINT8, 256 * 3 * 240); + tx1_obj_bmp = auto_alloc_array(machine, UINT8, 256 * 3 * 240); + tx1_rod_bmp = auto_alloc_array(machine, UINT8, 256 * 3 * 240); /* Set a timer to run the interrupts */ interrupt_timer = timer_alloc(machine, interrupt_callback, NULL); @@ -3045,9 +3045,9 @@ static void bb_combine_layers(running_machine *machine, bitmap_t *bitmap, int sc VIDEO_START( buggyboy ) { /* Allocate some bitmaps */ - bb_chr_bmp = auto_malloc(sizeof(UINT8) * 3 * 256 * 240); - bb_obj_bmp = auto_malloc(sizeof(UINT8) * 3 * 256 * 240); - bb_rod_bmp = auto_malloc(sizeof(UINT8) * 3 * 256 * 240); + bb_chr_bmp = auto_alloc_array(machine, UINT8, 3 * 256 * 240); + bb_obj_bmp = auto_alloc_array(machine, UINT8, 3 * 256 * 240); + bb_rod_bmp = auto_alloc_array(machine, UINT8, 3 * 256 * 240); /* Set a timer to run the interrupts */ interrupt_timer = timer_alloc(machine, interrupt_callback, NULL); @@ -3059,9 +3059,9 @@ VIDEO_START( buggyboy ) VIDEO_START( buggybjr ) { /* Allocate some bitmaps */ - bb_chr_bmp = auto_malloc(sizeof(UINT8) * 256 * 240); - bb_obj_bmp = auto_malloc(sizeof(UINT8) * 256 * 240); - bb_rod_bmp = auto_malloc(sizeof(UINT8) * 256 * 240); + bb_chr_bmp = auto_alloc_array(machine, UINT8, 256 * 240); + bb_obj_bmp = auto_alloc_array(machine, UINT8, 256 * 240); + bb_rod_bmp = auto_alloc_array(machine, UINT8, 256 * 240); /* Set a timer to run the interrupts */ interrupt_timer = timer_alloc(machine, interrupt_callback, NULL); diff --git a/src/mame/video/undrfire.c b/src/mame/video/undrfire.c index e79cede8469..e169faaaa58 100644 --- a/src/mame/video/undrfire.c +++ b/src/mame/video/undrfire.c @@ -24,7 +24,7 @@ VIDEO_START( undrfire ) { int i; - spritelist = auto_malloc(0x4000 * sizeof(*spritelist)); + spritelist = auto_alloc_array(machine, struct tempsprite, 0x4000); TC0100SCN_vh_start(machine,1,TC0100SCN_GFX_NUM,50,8,0,0,0,0,0); TC0480SCP_vh_start(machine,TC0480SCP_GFX_NUM,0,0x24,0,-1,0,0,0,0); diff --git a/src/mame/video/vdc.c b/src/mame/video/vdc.c index 02a6b68140c..1c33f67bd1c 100644 --- a/src/mame/video/vdc.c +++ b/src/mame/video/vdc.c @@ -354,8 +354,8 @@ VIDEO_START( pce ) memset(&vpc, 0, sizeof(vpc)); /* allocate VRAM */ - vdc[0].vram = auto_malloc(0x10000); - vdc[1].vram = auto_malloc(0x10000); + vdc[0].vram = auto_alloc_array(machine, UINT8, 0x10000); + vdc[1].vram = auto_alloc_array(machine, UINT8, 0x10000); memset(vdc[0].vram, 0, 0x10000); memset(vdc[1].vram, 0, 0x10000); diff --git a/src/mame/video/victory.c b/src/mame/video/victory.c index 705ee9cbc01..541b5286276 100644 --- a/src/mame/video/victory.c +++ b/src/mame/video/victory.c @@ -71,13 +71,13 @@ static int command7(running_machine *machine); VIDEO_START( victory ) { /* allocate bitmapram */ - rram = auto_malloc(0x4000); - gram = auto_malloc(0x4000); - bram = auto_malloc(0x4000); + rram = auto_alloc_array(machine, UINT8, 0x4000); + gram = auto_alloc_array(machine, UINT8, 0x4000); + bram = auto_alloc_array(machine, UINT8, 0x4000); /* allocate bitmaps */ - bgbitmap = auto_malloc(256 * 256); - fgbitmap = auto_malloc(256 * 256); + bgbitmap = auto_alloc_array(machine, UINT8, 256 * 256); + fgbitmap = auto_alloc_array(machine, UINT8, 256 * 256); /* reset globals */ vblank_irq = 0; diff --git a/src/mame/video/vigilant.c b/src/mame/video/vigilant.c index 84926f1148e..23510d3cfb2 100644 --- a/src/mame/video/vigilant.c +++ b/src/mame/video/vigilant.c @@ -40,7 +40,7 @@ static bitmap_t *bg_bitmap; VIDEO_START( vigilant ) { - bg_bitmap = auto_bitmap_alloc(512*4,256,video_screen_get_format(machine->primary_screen)); + bg_bitmap = auto_bitmap_alloc(machine,512*4,256,video_screen_get_format(machine->primary_screen)); } diff --git a/src/mame/video/volfied.c b/src/mame/video/volfied.c index 2df9f8cb911..b148376d73d 100644 --- a/src/mame/video/volfied.c +++ b/src/mame/video/volfied.c @@ -13,7 +13,7 @@ static UINT16 video_mask = 0; VIDEO_START( volfied ) { - video_ram = auto_malloc(0x40000 * sizeof (UINT16)); + video_ram = auto_alloc_array(machine, UINT16, 0x40000); state_save_register_global_pointer(machine, video_ram, 0x40000); state_save_register_global(machine, video_ctrl); diff --git a/src/mame/video/wecleman.c b/src/mame/video/wecleman.c index 192ee2e0cda..50dcae9c7c6 100644 --- a/src/mame/video/wecleman.c +++ b/src/mame/video/wecleman.c @@ -94,17 +94,6 @@ static pen_t black_pen; ***************************************************************************/ -static struct sprite *sprite_list_create(int num_sprites) -{ - struct sprite *spr_list; - - spr_list = auto_malloc(num_sprites * sizeof(struct sprite)); - - memset(spr_list, 0, num_sprites * sizeof(struct sprite)); - - return spr_list; -} - static void get_sprite_info(running_machine *machine) { const pen_t *base_pal = machine->pens; @@ -924,7 +913,7 @@ VIDEO_START( wecleman ) int i, j; assert(video_screen_get_format(machine->primary_screen) == BITMAP_FORMAT_RGB32); - buffer = auto_malloc(0x12c00); // working buffer for sprite operations + buffer = auto_alloc_array(machine, UINT8, 0x12c00); // working buffer for sprite operations gameid = 0; wecleman_gfx_bank = bank; @@ -955,7 +944,7 @@ VIDEO_START( wecleman ) } } - sprite_list = sprite_list_create(NUM_SPRITES); + sprite_list = auto_alloc_array_clear(machine, struct sprite, NUM_SPRITES); bg_tilemap = tilemap_create(machine, wecleman_get_bg_tile_info, tilemap_scan_rows, @@ -1026,7 +1015,7 @@ VIDEO_START( hotchase ) UINT8 *buffer; - buffer = auto_malloc(0x400); // reserve 1k for sprite list + buffer = auto_alloc_array(machine, UINT8, 0x400); // reserve 1k for sprite list gameid = 1; wecleman_gfx_bank = bank; @@ -1036,7 +1025,7 @@ VIDEO_START( hotchase ) spr_ptr_list = (struct sprite **)buffer; - sprite_list = sprite_list_create(NUM_SPRITES); + sprite_list = auto_alloc_array_clear(machine, struct sprite, NUM_SPRITES); K051316_vh_start_0(machine,ZOOMROM0_MEM_REGION,4,FALSE,0,zoom_callback_0); K051316_vh_start_1(machine,ZOOMROM1_MEM_REGION,4,FALSE,0,zoom_callback_1); diff --git a/src/mame/video/williams.c b/src/mame/video/williams.c index 6c5ba7252fc..82fcd054fdc 100644 --- a/src/mame/video/williams.c +++ b/src/mame/video/williams.c @@ -155,8 +155,8 @@ static UINT8 williams2_fg_color; * *************************************/ -static void blitter_init(int blitter_config, const UINT8 *remap_prom); -static void create_palette_lookup(void); +static void blitter_init(running_machine *machine, int blitter_config, const UINT8 *remap_prom); +static void create_palette_lookup(running_machine *machine); static TILE_GET_INFO( get_tile_info ); static int blitter_core(const address_space *space, int sstart, int dstart, int w, int h, int data); @@ -183,26 +183,26 @@ static void state_save_register(running_machine *machine) VIDEO_START( williams ) { - blitter_init(williams_blitter_config, NULL); - create_palette_lookup(); + blitter_init(machine, williams_blitter_config, NULL); + create_palette_lookup(machine); state_save_register(machine); } VIDEO_START( blaster ) { - blitter_init(williams_blitter_config, memory_region(machine, "proms")); - create_palette_lookup(); + blitter_init(machine, williams_blitter_config, memory_region(machine, "proms")); + create_palette_lookup(machine); state_save_register(machine); } VIDEO_START( williams2 ) { - blitter_init(williams_blitter_config, NULL); + blitter_init(machine, williams_blitter_config, NULL); /* allocate paletteram */ - paletteram = auto_malloc(0x400 * 2); + paletteram = auto_alloc_array(machine, UINT8, 0x400 * 2); state_save_register_global_pointer(machine, paletteram, 0x400 * 2); /* create the tilemap */ @@ -329,7 +329,7 @@ VIDEO_UPDATE( williams2 ) * *************************************/ -static void create_palette_lookup(void) +static void create_palette_lookup(running_machine *machine) { static const int resistances_rg[3] = { 1200, 560, 330 }; static const int resistances_b[2] = { 560, 330 }; @@ -345,7 +345,7 @@ static void create_palette_lookup(void) 2, resistances_b, weights_b, 0, 0); /* build a palette lookup */ - palette_lookup = auto_malloc(256 * sizeof(*palette_lookup)); + palette_lookup = auto_alloc_array(machine, rgb_t, 256); for (i = 0; i < 256; i++) { int r = combine_3_weights(weights_r, BIT(i,0), BIT(i,1), BIT(i,2)); @@ -521,7 +521,7 @@ WRITE8_HANDLER( blaster_video_control_w ) * *************************************/ -static void blitter_init(int blitter_config, const UINT8 *remap_prom) +static void blitter_init(running_machine *machine, int blitter_config, const UINT8 *remap_prom) { static const UINT8 dummy_table[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 }; int i,j; @@ -533,7 +533,7 @@ static void blitter_init(int blitter_config, const UINT8 *remap_prom) blitter_xor = (blitter_config == WILLIAMS_BLITTER_SC01) ? 4 : 0; /* create the remap table; if no PROM, make an identity remap table */ - blitter_remap_lookup = auto_malloc(256 * 256); + blitter_remap_lookup = auto_alloc_array(machine, UINT8, 256 * 256); blitter_remap_index = 0; blitter_remap = blitter_remap_lookup; for (i = 0; i < 256; i++) diff --git a/src/mame/video/wolfpack.c b/src/mame/video/wolfpack.c index 31b5cad486e..cfcd0533d5e 100644 --- a/src/mame/video/wolfpack.c +++ b/src/mame/video/wolfpack.c @@ -123,7 +123,7 @@ VIDEO_START( wolfpack ) int i; - LFSR = auto_malloc(0x8000); + LFSR = auto_alloc_array(machine, UINT8, 0x8000); helper = video_screen_auto_bitmap_alloc(machine->primary_screen); diff --git a/src/mame/video/xmen.c b/src/mame/video/xmen.c index ea01de2cd7e..9b5aeec0ec7 100644 --- a/src/mame/video/xmen.c +++ b/src/mame/video/xmen.c @@ -67,8 +67,8 @@ VIDEO_START( xmen6p ) K053247_vh_start(machine,"gfx2",53,-2,NORMAL_PLANE_ORDER,xmen_sprite_callback); K053247_export_config(&K053247_ram, NULL, NULL, NULL, NULL); - screen_left = auto_bitmap_alloc(64*8, 32*8, BITMAP_FORMAT_INDEXED16); - screen_right = auto_bitmap_alloc(64*8, 32*8, BITMAP_FORMAT_INDEXED16); + screen_left = auto_bitmap_alloc(machine, 64*8, 32*8, BITMAP_FORMAT_INDEXED16); + screen_right = auto_bitmap_alloc(machine, 64*8, 32*8, BITMAP_FORMAT_INDEXED16); } diff --git a/src/mame/video/zaxxon.c b/src/mame/video/zaxxon.c index f284a7a6d84..7bd5b3ca72d 100644 --- a/src/mame/video/zaxxon.c +++ b/src/mame/video/zaxxon.c @@ -167,7 +167,7 @@ VIDEO_START( razmataz ) VIDEO_START( congo ) { /* allocate our own spriteram since it is not accessible by the main CPU */ - spriteram = auto_malloc(0x100); + spriteram = auto_alloc_array(machine, UINT8, 0x100); /* register for save states */ state_save_register_global(machine, congo_fg_bank); diff --git a/src/osd/windows/d3d8intf.c b/src/osd/windows/d3d8intf.c index 779d57230ff..a023f1b5cf6 100644 --- a/src/osd/windows/d3d8intf.c +++ b/src/osd/windows/d3d8intf.c @@ -104,7 +104,7 @@ d3d *drawd3d8_init(void) } // allocate an object to hold our data - d3dptr = (d3d *)malloc_or_die(sizeof(*d3dptr)); + d3dptr = alloc_or_die(d3d); d3dptr->version = 8; d3dptr->d3dobj = d3d8; d3dptr->dllhandle = dllhandle; diff --git a/src/osd/windows/d3d9intf.c b/src/osd/windows/d3d9intf.c index 251201487c8..0d9f0e335c8 100644 --- a/src/osd/windows/d3d9intf.c +++ b/src/osd/windows/d3d9intf.c @@ -102,7 +102,7 @@ d3d *drawd3d9_init(void) } // allocate an object to hold our data - d3dptr = (d3d *)malloc_or_die(sizeof(*d3dptr)); + d3dptr = alloc_or_die(d3d); d3dptr->version = 9; d3dptr->d3dobj = d3d9; d3dptr->dllhandle = dllhandle; diff --git a/src/osd/windows/debugwin.c b/src/osd/windows/debugwin.c index 78e3c794ec0..d4cfc7d7faf 100644 --- a/src/osd/windows/debugwin.c +++ b/src/osd/windows/debugwin.c @@ -503,8 +503,7 @@ static debugwin_info *debugwin_window_create(running_machine *machine, LPCSTR ti RECT work_bounds; // allocate memory - info = (debugwin_info *)malloc_or_die(sizeof(*info)); - memset(info, 0, sizeof(*info)); + info = alloc_clear_or_die(debugwin_info); // create the window info->handler = handler; diff --git a/src/osd/windows/drawd3d.c b/src/osd/windows/drawd3d.c index 570822ef5bd..fa72df8d2e2 100644 --- a/src/osd/windows/drawd3d.c +++ b/src/osd/windows/drawd3d.c @@ -500,8 +500,7 @@ static int drawd3d_window_init(win_window_info *window) d3d_info *d3d; // allocate memory for our structures - d3d = (d3d_info *)malloc_or_die(sizeof(*d3d)); - memset(d3d, 0, sizeof(*d3d)); + d3d = alloc_clear_or_die(d3d_info); window->drawdata = d3d; // experimental: load a PNG to use for vector rendering; it is treated @@ -1658,8 +1657,7 @@ static texture_info *texture_create(d3d_info *d3d, const render_texinfo *texsour HRESULT result; // allocate a new texture - texture = (texture_info *)malloc_or_die(sizeof(*texture)); - memset(texture, 0, sizeof(*texture)); + texture = alloc_clear_or_die(texture_info); // fill in the core data texture->hash = texture_compute_hash(texsource, flags); diff --git a/src/osd/windows/drawdd.c b/src/osd/windows/drawdd.c index bff50c0a2af..c8fb908264d 100644 --- a/src/osd/windows/drawdd.c +++ b/src/osd/windows/drawdd.c @@ -249,8 +249,7 @@ static int drawdd_window_init(win_window_info *window) dd_info *dd; // allocate memory for our structures - dd = (dd_info *)malloc_or_die(sizeof(*dd)); - memset(dd, 0, sizeof(*dd)); + dd = alloc_clear_or_die(dd_info); window->drawdata = dd; // configure the adapter for the mode we want diff --git a/src/osd/windows/drawgdi.c b/src/osd/windows/drawgdi.c index 2c3cbb238b0..63e9fdefc23 100644 --- a/src/osd/windows/drawgdi.c +++ b/src/osd/windows/drawgdi.c @@ -89,8 +89,7 @@ static int drawgdi_window_init(win_window_info *window) int i; // allocate memory for our structures - gdi = (gdi_info *)malloc_or_die(sizeof(*gdi)); - memset(gdi, 0, sizeof(*gdi)); + gdi = alloc_clear_or_die(gdi_info); window->drawdata = gdi; // fill in the bitmap info header diff --git a/src/osd/windows/input.c b/src/osd/windows/input.c index 72651deb517..a105e2dd35e 100644 --- a/src/osd/windows/input.c +++ b/src/osd/windows/input.c @@ -794,8 +794,7 @@ static device_info *generic_device_alloc(running_machine *machine, device_info * device_info *devinfo; // allocate memory for the device object - devinfo = (device_info *)malloc_or_die(sizeof(*devinfo)); - memset(devinfo, 0, sizeof(*devinfo)); + devinfo = alloc_clear_or_die(device_info); devinfo->head = devlist_head_ptr; devinfo->machine = machine; @@ -1267,7 +1266,7 @@ static const char *dinput_device_item_name(device_info *devinfo, int offset, con return utf8_from_tstring(namestring); // otherwise, allocate space to add the suffix - combined = (TCHAR *)malloc_or_die(sizeof(TCHAR) * (_tcslen(namestring) + 1 + _tcslen(suffix) + 1)); + combined = alloc_array_or_die(TCHAR, _tcslen(namestring) + 1 + _tcslen(suffix) + 1); _tcscpy(combined, namestring); _tcscat(combined, TEXT(" ")); _tcscat(combined, suffix); @@ -1652,7 +1651,7 @@ static void rawinput_init(running_machine *machine) goto error; if (device_count == 0) goto error; - devlist = (RAWINPUTDEVICELIST *)malloc_or_die(device_count * sizeof(*devlist)); + devlist = alloc_array_or_die(RAWINPUTDEVICELIST, device_count); if ((*get_rawinput_device_list)(devlist, &device_count, sizeof(*devlist)) == -1) goto error; @@ -1732,7 +1731,7 @@ static device_info *rawinput_device_create(running_machine *machine, device_info // determine the length of the device name, allocate it, and fetch it if ((*get_rawinput_device_info)(device->hDevice, RIDI_DEVICENAME, NULL, &name_length) != 0) goto error; - tname = (TCHAR *)malloc_or_die(name_length * sizeof(*tname)); + tname = alloc_array_or_die(TCHAR, name_length); if ((*get_rawinput_device_info)(device->hDevice, RIDI_DEVICENAME, tname, &name_length) == -1) goto error; @@ -1796,7 +1795,7 @@ static TCHAR *rawinput_device_improve_name(TCHAR *name) return name; // allocate a temporary string and concatenate the base path plus the name - regpath = (TCHAR *)malloc_or_die(sizeof(*regpath) * (_tcslen(basepath) + 1 + _tcslen(name))); + regpath = alloc_array_or_die(TCHAR, _tcslen(basepath) + 1 + _tcslen(name)); _tcscpy(regpath, basepath); chdst = regpath + _tcslen(regpath); @@ -1908,7 +1907,7 @@ convert: chsrc++; else chsrc = regstring; - name = (TCHAR *)malloc_or_die(sizeof(*name) * (_tcslen(chsrc) + 1)); + name = alloc_array_or_die(TCHAR, _tcslen(chsrc) + 1); _tcscpy(name, chsrc); exit: @@ -2129,7 +2128,7 @@ static TCHAR *reg_query_string(HKEY key, const TCHAR *path) return NULL; // allocate a buffer - buffer = (TCHAR *)malloc_or_die(datalen + sizeof(*buffer)); + buffer = alloc_array_or_die(TCHAR, datalen + sizeof(*buffer)); buffer[datalen / sizeof(*buffer)] = 0; // now get the actual data diff --git a/src/osd/windows/output.c b/src/osd/windows/output.c index bdb821a4f3a..74169c242b2 100644 --- a/src/osd/windows/output.c +++ b/src/osd/windows/output.c @@ -228,7 +228,7 @@ static LRESULT register_client(HWND hwnd, LPARAM id) } // add us to the end - *client = (registered_client *)malloc_or_die(sizeof(**client)); + *client = alloc_or_die(registered_client); (*client)->next = NULL; (*client)->id = id; (*client)->hwnd = hwnd; @@ -287,7 +287,7 @@ static LRESULT send_id_string(running_machine *machine, HWND hwnd, LPARAM id) // allocate memory for the message datalen = sizeof(*temp) + strlen(name); - temp = (copydata_id_string *)malloc_or_die(datalen); + temp = (copydata_id_string *)alloc_array_or_die(UINT8, datalen); temp->id = id; strcpy(temp->string, name); diff --git a/src/osd/windows/video.c b/src/osd/windows/video.c index 49fe4475268..bf3fc6d90c2 100644 --- a/src/osd/windows/video.c +++ b/src/osd/windows/video.c @@ -255,8 +255,7 @@ static BOOL CALLBACK monitor_enum_callback(HMONITOR handle, HDC dc, LPRECT rect, assert(result); // allocate a new monitor info - monitor = (win_monitor_info *)malloc_or_die(sizeof(*monitor)); - memset(monitor, 0, sizeof(*monitor)); + monitor = alloc_clear_or_die(win_monitor_info); // copy in the data monitor->handle = handle; @@ -439,7 +438,7 @@ static void extract_video_config(running_machine *machine) static void load_effect_overlay(running_machine *machine, const char *filename) { const device_config *screen; - char *tempstr = (char *)malloc_or_die(strlen(filename) + 5); + char *tempstr = alloc_array_or_die(char, strlen(filename) + 5); char *dest; // append a .PNG extension diff --git a/src/osd/windows/window.c b/src/osd/windows/window.c index d93b34c4bd2..fd93dc9d549 100644 --- a/src/osd/windows/window.c +++ b/src/osd/windows/window.c @@ -582,8 +582,7 @@ void winwindow_video_window_create(running_machine *machine, int index, win_moni assert(GetCurrentThreadId() == main_threadid); // allocate a new window object - window = (win_window_info *)malloc_or_die(sizeof(*window)); - memset(window, 0, sizeof(*window)); + window = alloc_clear_or_die(win_window_info); window->maxwidth = config->width; window->maxheight = config->height; window->refresh = config->refresh; |