mame_rand() -> machine->rand()

This commit is contained in:
Aaron Giles 2010-12-31 22:59:44 +00:00
parent 3b41606ca0
commit 996e1c365c
166 changed files with 324 additions and 333 deletions

View File

@ -2252,27 +2252,27 @@ static void bevalidate_initialize_random_state(drcuml_state *drcuml, drcuml_bloc
int regnum; int regnum;
/* initialize core state to random values */ /* initialize core state to random values */
state->fmod = mame_rand(machine) & 0x03; state->fmod = machine->rand() & 0x03;
state->flags = mame_rand(machine) & 0x1f; state->flags = machine->rand() & 0x1f;
state->exp = mame_rand(machine); state->exp = machine->rand();
/* initialize integer registers to random values */ /* initialize integer registers to random values */
for (regnum = 0; regnum < ARRAY_LENGTH(state->r); regnum++) for (regnum = 0; regnum < ARRAY_LENGTH(state->r); regnum++)
{ {
state->r[regnum].w.h = mame_rand(machine); state->r[regnum].w.h = machine->rand();
state->r[regnum].w.l = mame_rand(machine); state->r[regnum].w.l = machine->rand();
} }
/* initialize float registers to random values */ /* initialize float registers to random values */
for (regnum = 0; regnum < ARRAY_LENGTH(state->f); regnum++) for (regnum = 0; regnum < ARRAY_LENGTH(state->f); regnum++)
{ {
*(UINT32 *)&state->f[regnum].s.h = mame_rand(machine); *(UINT32 *)&state->f[regnum].s.h = machine->rand();
*(UINT32 *)&state->f[regnum].s.l = mame_rand(machine); *(UINT32 *)&state->f[regnum].s.l = machine->rand();
} }
/* initialize map variables to random values */ /* initialize map variables to random values */
for (regnum = 0; regnum < DRCUML_MAPVAR_END - DRCUML_MAPVAR_M0; regnum++) for (regnum = 0; regnum < DRCUML_MAPVAR_END - DRCUML_MAPVAR_M0; regnum++)
UML_MAPVAR(block, MVAR(regnum), mame_rand(machine)); UML_MAPVAR(block, MVAR(regnum), machine->rand());
} }

View File

@ -676,7 +676,7 @@ void ppccom_execute_tlbl(powerpc_state *ppc)
int entrynum; int entrynum;
/* determine entry number; we use rand() for associativity */ /* determine entry number; we use rand() for associativity */
entrynum = ((address >> 12) & 0x1f) | (mame_rand(ppc->device->machine) & 0x20) | (isitlb ? 0x40 : 0); entrynum = ((address >> 12) & 0x1f) | (ppc->device->machine->rand() & 0x20) | (isitlb ? 0x40 : 0);
/* determine the flags */ /* determine the flags */
flags = VTLB_FLAG_VALID | VTLB_READ_ALLOWED | VTLB_FETCH_ALLOWED; flags = VTLB_FLAG_VALID | VTLB_READ_ALLOWED | VTLB_FETCH_ALLOWED;

View File

@ -303,7 +303,7 @@ static CPU_INIT( rsp )
#endif #endif
// ...except for the accumulators. // ...except for the accumulators.
// We're not calling mame_rand() because initializing something with mame_rand() // We're not calling machine->rand() because initializing something with machine->rand()
// makes me retch uncontrollably. // makes me retch uncontrollably.
for(accumIdx = 0; accumIdx < 8; accumIdx++ ) for(accumIdx = 0; accumIdx < 8; accumIdx++ )
{ {

View File

@ -218,10 +218,6 @@ inline void operator--(_Type &value, int) { value = (_Type)((int)value - 1); }
#define mame_strwildcmp core_strwildcmp #define mame_strwildcmp core_strwildcmp
// prevent the use of rand() -- use mame_rand() instead
#define rand __error_use_mame_rand_instead__
// macros to convert radians to degrees and degrees to radians // macros to convert radians to degrees and degrees to radians
#define RADIAN_TO_DEGREE(x) ((180.0 / M_PI) * (x)) #define RADIAN_TO_DEGREE(x) ((180.0 / M_PI) * (x))
#define DEGREE_TO_RADIAN(x) ((M_PI / 180.0) * (x)) #define DEGREE_TO_RADIAN(x) ((M_PI / 180.0) * (x))

View File

@ -2624,7 +2624,7 @@ static void frame_update_digital_joysticks(running_machine *machine)
if ((joystick->current4way & (JOYDIR_UP_BIT | JOYDIR_DOWN_BIT)) && if ((joystick->current4way & (JOYDIR_UP_BIT | JOYDIR_DOWN_BIT)) &&
(joystick->current4way & (JOYDIR_LEFT_BIT | JOYDIR_RIGHT_BIT))) (joystick->current4way & (JOYDIR_LEFT_BIT | JOYDIR_RIGHT_BIT)))
{ {
if (mame_rand(machine) & 1) if (machine->rand() & 1)
joystick->current4way &= ~(JOYDIR_LEFT_BIT | JOYDIR_RIGHT_BIT); joystick->current4way &= ~(JOYDIR_LEFT_BIT | JOYDIR_RIGHT_BIT);
else else
joystick->current4way &= ~(JOYDIR_UP_BIT | JOYDIR_DOWN_BIT); joystick->current4way &= ~(JOYDIR_UP_BIT | JOYDIR_DOWN_BIT);

View File

@ -668,11 +668,6 @@ inline const region_info *running_machine::region(const char *tag)
return m_regionlist.find(tag); return m_regionlist.find(tag);
} }
inline UINT32 mame_rand(running_machine *machine)
{
return machine->rand();
}
inline UINT8 *memory_region(running_machine *machine, const char *name) inline UINT8 *memory_region(running_machine *machine, const char *name)
{ {
const region_info *region = machine->region(name); const region_info *region = machine->region(name);

View File

@ -179,7 +179,7 @@ void nvram_device::nvram_default()
{ {
UINT8 *nvram = reinterpret_cast<UINT8 *>(m_base); UINT8 *nvram = reinterpret_cast<UINT8 *>(m_base);
for (int index = 0; index < m_length; index++) for (int index = 0; index < m_length; index++)
nvram[index] = mame_rand(&m_machine); nvram[index] = m_machine.rand();
break; break;
} }

View File

@ -375,7 +375,7 @@ static void count_roms(rom_load_data *romdata)
static void fill_random(running_machine *machine, UINT8 *base, UINT32 length) static void fill_random(running_machine *machine, UINT8 *base, UINT32 length)
{ {
while (length--) while (length--)
*base++ = mame_rand(machine); *base++ = machine->rand();
} }

View File

@ -82,7 +82,7 @@ static void AICALFO_Init(running_machine *machine)
//noise //noise
//a=lfo_noise[i]; //a=lfo_noise[i];
a=mame_rand(machine)&0xff; a=machine->rand()&0xff;
p=128-a; p=128-a;
ALFO_NOI[i]=a; ALFO_NOI[i]=a;
PLFO_NOI[i]=p; PLFO_NOI[i]=p;

View File

@ -26,7 +26,7 @@
game will reset the index prior to playback so this isn't an issue. game will reset the index prior to playback so this isn't an issue.
- While the noise emulation is complete, the data for the pseudo-random - While the noise emulation is complete, the data for the pseudo-random
bitstream is calculated by mame_rand() and is not a representation of what bitstream is calculated by machine->rand() and is not a representation of what
the actual hardware does. the actual hardware does.
For some background on Hudson Soft's C62 chipset: For some background on Hudson Soft's C62 chipset:
@ -278,7 +278,7 @@ static STREAM_UPDATE( c6280_update )
p->channel[ch].noise_counter += step; p->channel[ch].noise_counter += step;
if(p->channel[ch].noise_counter >= 0x800) if(p->channel[ch].noise_counter >= 0x800)
{ {
data = (mame_rand(p->device->machine) & 1) ? 0x1F : 0; data = (p->device->machine->rand() & 1) ? 0x1F : 0;
} }
p->channel[ch].noise_counter &= 0x7FF; p->channel[ch].noise_counter &= 0x7FF;
outputs[0][i] += (INT16)(vll * (data - 16)); outputs[0][i] += (INT16)(vll * (data - 16));

View File

@ -586,7 +586,7 @@ DISCRETE_STEP(dss_noise)
if(context->phase > (2.0 * M_PI)) if(context->phase > (2.0 * M_PI))
{ {
/* GCC's rand returns a RAND_MAX value of 0x7fff */ /* GCC's rand returns a RAND_MAX value of 0x7fff */
int newval = (mame_rand(node->info->device->machine) & 0x7fff) - 16384; int newval = (node->info->device->machine->rand() & 0x7fff) - 16384;
/* make sure the peak to peak values are the amplitude */ /* make sure the peak to peak values are the amplitude */
node->output[0] = DSS_NOISE__AMP / 2; node->output[0] = DSS_NOISE__AMP / 2;

View File

@ -86,7 +86,7 @@ static void LFO_Init(running_machine *machine)
//noise //noise
//a=lfo_noise[i]; //a=lfo_noise[i];
a=mame_rand(machine)&0xff; a=machine->rand()&0xff;
p=128-a; p=128-a;
ALFO_NOI[i]=a; ALFO_NOI[i]=a;
PLFO_NOI[i]=p; PLFO_NOI[i]=p;

View File

@ -47,7 +47,7 @@ RST not only resets the chip on its rising edge but grabs a byte of mode state d
9bit DAC is composed of 5bit Physical and 3bitPWM. 9bit DAC is composed of 5bit Physical and 3bitPWM.
todo: todo:
Noise Generator circuit without 'mame_rand()' function. Noise Generator circuit without 'machine->rand()' function.
----------- command format (Analytical result) ---------- ----------- command format (Analytical result) ----------
@ -411,7 +411,7 @@ static STREAM_UPDATE( vlm5030_update_callback )
} }
else if (chip->old_pitch <= 1) else if (chip->old_pitch <= 1)
{ /* generate unvoiced samples here */ { /* generate unvoiced samples here */
current_val = (mame_rand(chip->device->machine)&1) ? chip->current_energy : -chip->current_energy; current_val = (chip->device->machine->rand()&1) ? chip->current_energy : -chip->current_energy;
} }
else else
{ {

View File

@ -1470,7 +1470,7 @@ READ16_DEVICE_HANDLER( hd63484_status_r )
// if (cpu_get_pc(space->cpu) != 0xfced6 && cpu_get_pc(space->cpu) != 0xfe1d6) // if (cpu_get_pc(space->cpu) != 0xfced6 && cpu_get_pc(space->cpu) != 0xfe1d6)
// logerror("%05x: HD63484 status read\n",cpu_get_pc(space->cpu)); // logerror("%05x: HD63484 status read\n",cpu_get_pc(space->cpu));
return 0xff22 | (mame_rand(device->machine) & 0x0004); /* write FIFO ready + command end + (read FIFO ready or read FIFO not ready) */ return 0xff22 | (device->machine->rand() & 0x0004); /* write FIFO ready + command end + (read FIFO ready or read FIFO not ready) */
} }
WRITE16_DEVICE_HANDLER( hd63484_address_w ) WRITE16_DEVICE_HANDLER( hd63484_address_w )

View File

@ -790,7 +790,7 @@ static UINT8 v9938_status_r(running_machine *machine)
if ( (n < 28) || (n > 199) ) vdp.statReg[2] |= 0x20; if ( (n < 28) || (n > 199) ) vdp.statReg[2] |= 0x20;
else vdp.statReg[2] &= ~0x20; else vdp.statReg[2] &= ~0x20;
*/ */
if (mame_rand(machine) & 1) vdp->statReg[2] |= 0x20; if (machine->rand() & 1) vdp->statReg[2] |= 0x20;
else vdp->statReg[2] &= ~0x20; else vdp->statReg[2] &= ~0x20;
ret = vdp->statReg[2]; ret = vdp->statReg[2];
break; break;

View File

@ -200,7 +200,7 @@ void vector_add_point (running_machine *machine, int x, int y, rgb_t color, int
if (flicker && (intensity > 0)) if (flicker && (intensity > 0))
{ {
intensity += (intensity * (0x80-(mame_rand(machine)&0xff)) * flicker)>>16; intensity += (intensity * (0x80-(machine->rand()&0xff)) * flicker)>>16;
if (intensity < 0) if (intensity < 0)
intensity = 0; intensity = 0;
if (intensity > 0xff) if (intensity > 0xff)

View File

@ -169,11 +169,11 @@ static void spacewar_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bi
/* Explosion - rising edge */ /* Explosion - rising edge */
if (SOUNDVAL_RISING_EDGE(0x01)) if (SOUNDVAL_RISING_EDGE(0x01))
sample_start(samples, 0, (mame_rand(machine) & 1) ? 0 : 6, 0); sample_start(samples, 0, (machine->rand() & 1) ? 0 : 6, 0);
/* Fire sound - rising edge */ /* Fire sound - rising edge */
if (SOUNDVAL_RISING_EDGE(0x02)) if (SOUNDVAL_RISING_EDGE(0x02))
sample_start(samples, 1, (mame_rand(machine) & 1) ? 1 : 7, 0); sample_start(samples, 1, (machine->rand() & 1) ? 1 : 7, 0);
/* Player 1 thrust - 0=on, 1=off */ /* Player 1 thrust - 0=on, 1=off */
if (SOUNDVAL_FALLING_EDGE(0x04)) if (SOUNDVAL_FALLING_EDGE(0x04))

View File

@ -252,13 +252,13 @@ void cojag_sound_init(running_machine *machine)
jaguar_wave_rom[0x200 + i] = (int)(32767. * sin(2.0 * M_PI * (double)i / (double)0x80)); jaguar_wave_rom[0x200 + i] = (int)(32767. * sin(2.0 * M_PI * (double)i / (double)0x80));
/* F1DA00 = traingle wave with noise */ /* F1DA00 = traingle wave with noise */
jaguar_wave_rom[0x280 + i] = jaguar_wave_rom[0x000 + i] * (mame_rand(machine) % 32768) / 32768; jaguar_wave_rom[0x280 + i] = jaguar_wave_rom[0x000 + i] * (machine->rand() % 32768) / 32768;
/* F1DC00 = spike */ /* F1DC00 = spike */
jaguar_wave_rom[0x300 + i] = (i == 0x40) ? 32767 : 0; jaguar_wave_rom[0x300 + i] = (i == 0x40) ? 32767 : 0;
/* F1DE00 = white noise */ /* F1DE00 = white noise */
jaguar_wave_rom[0x380 + i] = mame_rand(machine) % 32768; jaguar_wave_rom[0x380 + i] = machine->rand() % 32768;
} }
#if ENABLE_SPEEDUP_HACKS #if ENABLE_SPEEDUP_HACKS

View File

@ -179,7 +179,7 @@ static READ16_HANDLER(es5510_dsp_r)
*/ */
// offset<<=1; // offset<<=1;
//if (offset<7 && es5510_dsp_ram[0]!=0xff) return mame_rand(space->machine)%0xffff; //if (offset<7 && es5510_dsp_ram[0]!=0xff) return space->machine->rand()%0xffff;
if (offset==0x12) return 0; if (offset==0x12) return 0;

View File

@ -829,23 +829,23 @@ static READ32_HANDLER( pxa255_gpio_r )
verboselog( space->machine, 3, "pxa255_gpio_r: GPIO Pin Direction Register 2: %08x & %08x\n", gpio_regs->gpdr2, mem_mask ); verboselog( space->machine, 3, "pxa255_gpio_r: GPIO Pin Direction Register 2: %08x & %08x\n", gpio_regs->gpdr2, mem_mask );
return gpio_regs->gpdr2; return gpio_regs->gpdr2;
case PXA255_GPSR0: case PXA255_GPSR0:
verboselog( space->machine, 3, "pxa255_gpio_r: (Invalid Read) GPIO Pin Output Set Register 0: %08x & %08x\n", mame_rand(space->machine), mem_mask ); verboselog( space->machine, 3, "pxa255_gpio_r: (Invalid Read) GPIO Pin Output Set Register 0: %08x & %08x\n", space->machine->rand(), mem_mask );
return mame_rand(space->machine); return space->machine->rand();
case PXA255_GPSR1: case PXA255_GPSR1:
verboselog( space->machine, 3, "pxa255_gpio_r: (Invalid Read) GPIO Pin Output Set Register 1: %08x & %08x\n", mame_rand(space->machine), mem_mask ); verboselog( space->machine, 3, "pxa255_gpio_r: (Invalid Read) GPIO Pin Output Set Register 1: %08x & %08x\n", space->machine->rand(), mem_mask );
return mame_rand(space->machine); return space->machine->rand();
case PXA255_GPSR2: case PXA255_GPSR2:
verboselog( space->machine, 3, "pxa255_gpio_r: (Invalid Read) GPIO Pin Output Set Register 2: %08x & %08x\n", mame_rand(space->machine), mem_mask ); verboselog( space->machine, 3, "pxa255_gpio_r: (Invalid Read) GPIO Pin Output Set Register 2: %08x & %08x\n", space->machine->rand(), mem_mask );
return mame_rand(space->machine); return space->machine->rand();
case PXA255_GPCR0: case PXA255_GPCR0:
verboselog( space->machine, 3, "pxa255_gpio_r: (Invalid Read) GPIO Pin Output Clear Register 0: %08x & %08x\n", mame_rand(space->machine), mem_mask ); verboselog( space->machine, 3, "pxa255_gpio_r: (Invalid Read) GPIO Pin Output Clear Register 0: %08x & %08x\n", space->machine->rand(), mem_mask );
return mame_rand(space->machine); return space->machine->rand();
case PXA255_GPCR1: case PXA255_GPCR1:
verboselog( space->machine, 3, "pxa255_gpio_r: (Invalid Read) GPIO Pin Output Clear Register 1: %08x & %08x\n", mame_rand(space->machine), mem_mask ); verboselog( space->machine, 3, "pxa255_gpio_r: (Invalid Read) GPIO Pin Output Clear Register 1: %08x & %08x\n", space->machine->rand(), mem_mask );
return mame_rand(space->machine); return space->machine->rand();
case PXA255_GPCR2: case PXA255_GPCR2:
verboselog( space->machine, 3, "pxa255_gpio_r: (Invalid Read) GPIO Pin Output Clear Register 2: %08x & %08x\n", mame_rand(space->machine), mem_mask ); verboselog( space->machine, 3, "pxa255_gpio_r: (Invalid Read) GPIO Pin Output Clear Register 2: %08x & %08x\n", space->machine->rand(), mem_mask );
return mame_rand(space->machine); return space->machine->rand();
case PXA255_GRER0: case PXA255_GRER0:
verboselog( space->machine, 3, "pxa255_gpio_r: GPIO Rising Edge Detect Enable Register 0: %08x & %08x\n", gpio_regs->grer0, mem_mask ); verboselog( space->machine, 3, "pxa255_gpio_r: GPIO Rising Edge Detect Enable Register 0: %08x & %08x\n", gpio_regs->grer0, mem_mask );
return gpio_regs->grer0; return gpio_regs->grer0;

View File

@ -1736,7 +1736,7 @@ static READ8_HANDLER(indianbt_r)
case 0x5ffc: return 0; case 0x5ffc: return 0;
} }
logerror("unknown port 0 read @ %x\n",cpu_get_pc(space->cpu)); logerror("unknown port 0 read @ %x\n",cpu_get_pc(space->cpu));
return mame_rand(space->machine); return space->machine->rand();
} }
static ADDRESS_MAP_START( indianbt_io_map, ADDRESS_SPACE_IO, 8 ) static ADDRESS_MAP_START( indianbt_io_map, ADDRESS_SPACE_IO, 8 )

View File

@ -70,7 +70,7 @@ static VIDEO_UPDATE(lions)
static READ8_HANDLER( test_r ) static READ8_HANDLER( test_r )
{ {
return mame_rand(space->machine); return space->machine->rand();
} }
@ -215,39 +215,39 @@ static const ay8910_interface ay8910_config =
//static READ8_DEVICE_HANDLER( input_a ) //static READ8_DEVICE_HANDLER( input_a )
//{ //{
//return input_port_read(machine, "IN0"); //return input_port_read(machine, "IN0");
// return mame_rand(device->machine); // return device->machine->rand();
//return 0xff; //return 0xff;
//} //}
//static READ8_DEVICE_HANDLER( input_b ) //static READ8_DEVICE_HANDLER( input_b )
//{ //{
//return input_port_read(machine, "IN1"); //return input_port_read(machine, "IN1");
// return mame_rand(device->machine); // return device->machine->rand();
//return 0xff; //return 0xff;
//} //}
static READ8_DEVICE_HANDLER( input_ca1 ) static READ8_DEVICE_HANDLER( input_ca1 )
{ {
// return mame_rand(device->machine); // return device->machine->rand();
return 0x00; return 0x00;
} }
static READ8_DEVICE_HANDLER( input_cb1 ) static READ8_DEVICE_HANDLER( input_cb1 )
{ {
// return mame_rand(device->machine); // return device->machine->rand();
return 0x00; return 0x00;
} }
static READ8_DEVICE_HANDLER( input_ca2 ) static READ8_DEVICE_HANDLER( input_ca2 )
{ {
// return mame_rand(device->machine); // return device->machine->rand();
return 0x00; return 0x00;
} }
static READ8_DEVICE_HANDLER( input_cb2 ) static READ8_DEVICE_HANDLER( input_cb2 )
{ {
// return mame_rand(device->machine); // return device->machine->rand();
return 0x00; return 0x00;
} }

View File

@ -154,7 +154,7 @@ static WRITE8_HANDLER( ace_scoreram_w )
static READ8_HANDLER( unk_r ) static READ8_HANDLER( unk_r )
{ {
return mame_rand(space->machine) & 0xff; return space->machine->rand() & 0xff;
} }

View File

@ -393,17 +393,17 @@ static READ16_HANDLER( test_r )
state->mux_data++; state->mux_data++;
state->mux_data &= 0xf; state->mux_data &= 0xf;
/* /*
switch (mame_rand(space->machine) & 3) switch (space->machine->rand() & 3)
{ {
case 0: case 0:
return 0; return 0;
case 1: case 1:
return 0xffff; return 0xffff;
default: default:
return mame_rand(space->machine) & 0xffff; return space->machine->rand() & 0xffff;
} }
*/ */
return value | (mame_rand(space->machine) & 0x0000); return value | (space->machine->rand() & 0x0000);
} }
/*???*/ /*???*/

View File

@ -254,7 +254,7 @@ static READ8_HANDLER( devram_r )
/* Reading eff4, F0 times must yield at most 80-1 consecutive /* Reading eff4, F0 times must yield at most 80-1 consecutive
equal values */ equal values */
case 0xff4: case 0xff4:
return mame_rand(space->machine); return space->machine->rand();
default: default:
return state->devram[offset]; return state->devram[offset];

View File

@ -181,7 +181,7 @@ static void ultennis_protection(running_machine *machine)
{ {
case 0x00: /* reset */ case 0x00: /* reset */
prot_input_index = prot_output_index = 0; prot_input_index = prot_output_index = 0;
prot_output[0] = mame_rand(machine); prot_output[0] = machine->rand();
break; break;
case 0x01: /* 01 aaaa bbbb cccc dddd (xxxx) */ case 0x01: /* 01 aaaa bbbb cccc dddd (xxxx) */
@ -271,7 +271,7 @@ static void cheesech_protection(running_machine *machine)
{ {
case 0x00: /* reset */ case 0x00: /* reset */
prot_input_index = prot_output_index = 0; prot_input_index = prot_output_index = 0;
prot_output[0] = mame_rand(machine); prot_output[0] = machine->rand();
break; break;
case 0x01: /* 01 aaaa bbbb (xxxx) */ case 0x01: /* 01 aaaa bbbb (xxxx) */
@ -465,7 +465,7 @@ ADDRESS_MAP_END
static READ16_HANDLER(unk_r) static READ16_HANDLER(unk_r)
{ {
return mame_rand(space->machine); return space->machine->rand();
} }
static ADDRESS_MAP_START( shtstar_map, ADDRESS_SPACE_PROGRAM, 16 ) static ADDRESS_MAP_START( shtstar_map, ADDRESS_SPACE_PROGRAM, 16 )

View File

@ -455,7 +455,7 @@ static VIDEO_UPDATE( tomahawk )
static READ8_HANDLER( shoot_r ) static READ8_HANDLER( shoot_r )
{ {
/* not really sure about this */ /* not really sure about this */
return mame_rand(space->machine) & 8; return space->machine->rand() & 8;
} }

View File

@ -1126,7 +1126,7 @@ static READ32_HANDLER( atarigx2_protection_r )
if (lookup_table[i][0] == 0xffffffff) if (lookup_table[i][0] == 0xffffffff)
{ {
if (state->last_write_offset*2 >= 0x700 && state->last_write_offset*2 < 0x720) if (state->last_write_offset*2 >= 0x700 && state->last_write_offset*2 < 0x720)
result = mame_rand(space->machine) << 16; result = space->machine->rand() << 16;
else else
result = 0xffff << 16; result = 0xffff << 16;
logerror("%06X:Unhandled protection R@%04X = %04X\n", cpu_get_previouspc(space->cpu), offset, result); logerror("%06X:Unhandled protection R@%04X = %04X\n", cpu_get_previouspc(space->cpu), offset, result);

View File

@ -215,7 +215,7 @@ static VIDEO_UPDATE( backfire )
static READ32_DEVICE_HANDLER( backfire_eeprom_r ) static READ32_DEVICE_HANDLER( backfire_eeprom_r )
{ {
/* some kind of screen indicator? checked by backfirea set before it will boot */ /* some kind of screen indicator? checked by backfirea set before it will boot */
int backfire_screen = mame_rand(device->machine) & 1; int backfire_screen = device->machine->rand() & 1;
return ((eeprom_read_bit(device) << 24) | input_port_read(device->machine, "IN0") return ((eeprom_read_bit(device) << 24) | input_port_read(device->machine, "IN0")
| ((input_port_read(device->machine, "IN2") & 0xbf) << 16) | ((input_port_read(device->machine, "IN2") & 0xbf) << 16)
| ((input_port_read(device->machine, "IN3") & 0x40) << 16)) ^ (backfire_screen << 26) ; | ((input_port_read(device->machine, "IN3") & 0x40) << 16)) ^ (backfire_screen << 26) ;
@ -278,12 +278,12 @@ READ32_HANDLER( backfire_unknown_wheel_r )
READ32_HANDLER( backfire_wheel1_r ) READ32_HANDLER( backfire_wheel1_r )
{ {
return mame_rand(space->machine); return space->machine->rand();
} }
READ32_HANDLER( backfire_wheel2_r ) READ32_HANDLER( backfire_wheel2_r )
{ {
return mame_rand(space->machine); return space->machine->rand();
} }
#endif #endif

View File

@ -354,7 +354,7 @@ static READ16_HANDLER(sharedram_r)
if(state->read_latch) if(state->read_latch)
{ {
state->read_latch = 0; state->read_latch = 0;
return mame_rand(space->machine); // TODO return space->machine->rand(); // TODO
} }
break; break;
@ -380,7 +380,7 @@ static READ16_HANDLER(sharedram_r)
if(state->read_latch) if(state->read_latch)
{ {
state->read_latch = 0; state->read_latch = 0;
return mame_rand(space->machine); // TODO return space->machine->rand(); // TODO
} }
break; break;
case 0x642/2: case 0x642/2:

View File

@ -493,7 +493,7 @@ static VIDEO_UPDATE(bingor)
#if 0 #if 0
static READ16_HANDLER( test_r ) static READ16_HANDLER( test_r )
{ {
return mame_rand(space->machine); return space->machine->rand();
} }
#endif #endif
@ -514,7 +514,7 @@ ADDRESS_MAP_END
static READ8_HANDLER( test8_r ) static READ8_HANDLER( test8_r )
{ {
return mame_rand(space->machine); return space->machine->rand();
} }
static ADDRESS_MAP_START( pic_io_map, ADDRESS_SPACE_IO, 8 ) static ADDRESS_MAP_START( pic_io_map, ADDRESS_SPACE_IO, 8 )

View File

@ -325,9 +325,9 @@ static WRITE16_HANDLER( bishjan_sel_w )
static READ16_HANDLER( bishjan_serial_r ) static READ16_HANDLER( bishjan_serial_r )
{ {
return return
(mame_rand(space->machine) & 0x9800) | // bit 7 - serial communication (space->machine->rand() & 0x9800) | // bit 7 - serial communication
(((bishjan_sel==0x12) ? 0x40:0x00) << 8) | (((bishjan_sel==0x12) ? 0x40:0x00) << 8) |
// (mame_rand() & 0xff); // (machine->rand() & 0xff);
// (((space->machine->primary_screen->frame_number()%60)==0)?0x18:0x00); // (((space->machine->primary_screen->frame_number()%60)==0)?0x18:0x00);
0x18; 0x18;
} }

View File

@ -444,7 +444,7 @@ static WRITE8_HANDLER( blackt96_soundio_port00_w )
static READ8_HANDLER( blackt96_soundio_port01_r ) static READ8_HANDLER( blackt96_soundio_port01_r )
{ {
return mame_rand(space->machine); return space->machine->rand();
} }
static WRITE8_HANDLER( blackt96_soundio_port01_w ) static WRITE8_HANDLER( blackt96_soundio_port01_w )
@ -454,7 +454,7 @@ static WRITE8_HANDLER( blackt96_soundio_port01_w )
static READ8_HANDLER( blackt96_soundio_port02_r ) static READ8_HANDLER( blackt96_soundio_port02_r )
{ {
return mame_rand(space->machine); return space->machine->rand();
} }
static WRITE8_HANDLER( blackt96_soundio_port02_w ) static WRITE8_HANDLER( blackt96_soundio_port02_w )

View File

@ -564,7 +564,7 @@ static WRITE16_HANDLER( lamps_w )
static READ16_HANDLER( test_r ) static READ16_HANDLER( test_r )
{ {
return 0xffff;//mame_rand(space->machine); return 0xffff;//space->machine->rand();
} }
#if 0 #if 0
@ -644,13 +644,13 @@ ADDRESS_MAP_END
// MCU simulation (to be done) // MCU simulation (to be done)
static READ8_HANDLER( bankrob_mcu1_r ) static READ8_HANDLER( bankrob_mcu1_r )
{ {
UINT8 ret = 0; // mame_rand(space->machine) gives "interesting" results UINT8 ret = 0; // space->machine->rand() gives "interesting" results
logerror("%s: mcu1 reads %02x\n", cpuexec_describe_context(space->machine), ret); logerror("%s: mcu1 reads %02x\n", cpuexec_describe_context(space->machine), ret);
return ret; return ret;
} }
static READ8_HANDLER( bankrob_mcu2_r ) static READ8_HANDLER( bankrob_mcu2_r )
{ {
UINT8 ret = 0; // mame_rand(space->machine) gives "interesting" results UINT8 ret = 0; // space->machine->rand() gives "interesting" results
logerror("%s: mcu2 reads %02x\n", cpuexec_describe_context(space->machine), ret); logerror("%s: mcu2 reads %02x\n", cpuexec_describe_context(space->machine), ret);
return ret; return ret;
} }
@ -727,13 +727,13 @@ ADDRESS_MAP_END
// MCU simulation (to be done) // MCU simulation (to be done)
static READ8_HANDLER( bankroba_mcu1_r ) static READ8_HANDLER( bankroba_mcu1_r )
{ {
UINT8 ret = mame_rand(space->machine); // mame_rand(space->machine) gives "interesting" results UINT8 ret = space->machine->rand(); // space->machine->rand() gives "interesting" results
logerror("%s: mcu1 reads %02x\n", cpuexec_describe_context(space->machine), ret); logerror("%s: mcu1 reads %02x\n", cpuexec_describe_context(space->machine), ret);
return ret; return ret;
} }
static READ8_HANDLER( bankroba_mcu2_r ) static READ8_HANDLER( bankroba_mcu2_r )
{ {
UINT8 ret = mame_rand(space->machine); // mame_rand(space->machine) gives "interesting" results UINT8 ret = space->machine->rand(); // space->machine->rand() gives "interesting" results
logerror("%s: mcu2 reads %02x\n", cpuexec_describe_context(space->machine), ret); logerror("%s: mcu2 reads %02x\n", cpuexec_describe_context(space->machine), ret);
return ret; return ret;
} }
@ -883,7 +883,7 @@ static WRITE16_DEVICE_HANDLER( crtc_lpen_w )
// MCU simulation (to be done) // MCU simulation (to be done)
static READ16_HANDLER( cjffruit_mcu_r ) static READ16_HANDLER( cjffruit_mcu_r )
{ {
UINT8 ret = 0x00; // mame_rand(space->machine) gives "interesting" results UINT8 ret = 0x00; // space->machine->rand() gives "interesting" results
logerror("%s: mcu reads %02x\n", cpuexec_describe_context(space->machine), ret); logerror("%s: mcu reads %02x\n", cpuexec_describe_context(space->machine), ret);
return ret << 8; return ret << 8;
} }
@ -934,7 +934,7 @@ ADDRESS_MAP_END
// MCU simulation (to be done) // MCU simulation (to be done)
static READ16_HANDLER( deucesw2_mcu_r ) static READ16_HANDLER( deucesw2_mcu_r )
{ {
UINT8 ret = 0x00; // mame_rand(space->machine) gives "interesting" results UINT8 ret = 0x00; // space->machine->rand() gives "interesting" results
logerror("%s: mcu reads %02x\n", cpuexec_describe_context(space->machine), ret); logerror("%s: mcu reads %02x\n", cpuexec_describe_context(space->machine), ret);
return ret << 8; return ret << 8;
} }
@ -1030,13 +1030,13 @@ ADDRESS_MAP_END
// MCU simulation (to be done) // MCU simulation (to be done)
static READ8_HANDLER( dualgame_mcu1_r ) static READ8_HANDLER( dualgame_mcu1_r )
{ {
UINT8 ret = 0; // mame_rand(space->machine) gives "interesting" results UINT8 ret = 0; // space->machine->rand() gives "interesting" results
logerror("%s: mcu1 reads %02x\n", cpuexec_describe_context(space->machine), ret); logerror("%s: mcu1 reads %02x\n", cpuexec_describe_context(space->machine), ret);
return ret; return ret;
} }
static READ8_HANDLER( dualgame_mcu2_r ) static READ8_HANDLER( dualgame_mcu2_r )
{ {
UINT8 ret = 0; // mame_rand(space->machine) gives "interesting" results UINT8 ret = 0; // space->machine->rand() gives "interesting" results
logerror("%s: mcu2 reads %02x\n", cpuexec_describe_context(space->machine), ret); logerror("%s: mcu2 reads %02x\n", cpuexec_describe_context(space->machine), ret);
return ret; return ret;
} }
@ -1118,7 +1118,7 @@ ADDRESS_MAP_END
// MCU simulation (to be done) // MCU simulation (to be done)
static READ16_HANDLER( hermit_mcu_r ) static READ16_HANDLER( hermit_mcu_r )
{ {
UINT8 ret = 0x00; // mame_rand(space->machine) gives "interesting" results UINT8 ret = 0x00; // space->machine->rand() gives "interesting" results
logerror("%s: mcu reads %02x\n", cpuexec_describe_context(space->machine), ret); logerror("%s: mcu reads %02x\n", cpuexec_describe_context(space->machine), ret);
return ret << 8; return ret << 8;
} }
@ -1197,13 +1197,13 @@ ADDRESS_MAP_END
// MCU simulation (to be done) // MCU simulation (to be done)
static READ8_HANDLER( maxidbl_mcu1_r ) static READ8_HANDLER( maxidbl_mcu1_r )
{ {
UINT8 ret = 0; // mame_rand(space->machine) gives "interesting" results UINT8 ret = 0; // space->machine->rand() gives "interesting" results
logerror("%s: mcu1 reads %02x\n", cpuexec_describe_context(space->machine), ret); logerror("%s: mcu1 reads %02x\n", cpuexec_describe_context(space->machine), ret);
return ret; return ret;
} }
static READ8_HANDLER( maxidbl_mcu2_r ) static READ8_HANDLER( maxidbl_mcu2_r )
{ {
UINT8 ret = 0; // mame_rand(space->machine) gives "interesting" results UINT8 ret = 0; // space->machine->rand() gives "interesting" results
logerror("%s: mcu2 reads %02x\n", cpuexec_describe_context(space->machine), ret); logerror("%s: mcu2 reads %02x\n", cpuexec_describe_context(space->machine), ret);
return ret; return ret;
} }

View File

@ -81,7 +81,7 @@ static WRITE16_HANDLER( blmbycar_pot_wheel_shift_w )
static READ16_HANDLER( blmbycar_pot_wheel_r ) static READ16_HANDLER( blmbycar_pot_wheel_r )
{ {
blmbycar_state *state = space->machine->driver_data<blmbycar_state>(); blmbycar_state *state = space->machine->driver_data<blmbycar_state>();
return ((state->pot_wheel & 0x80) ? 0x04 : 0) | (mame_rand(space->machine) & 0x08); return ((state->pot_wheel & 0x80) ? 0x04 : 0) | (space->machine->rand() & 0x08);
} }

View File

@ -173,7 +173,7 @@ static VIDEO_UPDATE( bmcbowl )
static READ16_HANDLER( bmc_random_read ) static READ16_HANDLER( bmc_random_read )
{ {
return mame_rand(space->machine); return space->machine->rand();
} }
static READ16_HANDLER( bmc_protection_r ) static READ16_HANDLER( bmc_protection_r )
@ -190,7 +190,7 @@ static READ16_HANDLER( bmc_protection_r )
break; break;
} }
logerror("Protection read @ %X\n",cpu_get_previouspc(space->cpu)); logerror("Protection read @ %X\n",cpu_get_previouspc(space->cpu));
return mame_rand(space->machine); return space->machine->rand();
} }
static WRITE16_HANDLER( bmc_RAMDAC_offset_w ) static WRITE16_HANDLER( bmc_RAMDAC_offset_w )

View File

@ -258,7 +258,7 @@ static VIDEO_UPDATE(carrera)
static READ8_DEVICE_HANDLER( unknown_r ) static READ8_DEVICE_HANDLER( unknown_r )
{ {
return mame_rand(device->machine); return device->machine->rand();
} }
/* these are set as input, but I have no idea which input port it uses is for the AY */ /* these are set as input, but I have no idea which input port it uses is for the AY */

View File

@ -105,7 +105,7 @@ static WRITE8_HANDLER( vvillage_vregs_w )
static READ8_HANDLER( vvillage_rng_r ) static READ8_HANDLER( vvillage_rng_r )
{ {
return mame_rand(space->machine); return space->machine->rand();
} }
static WRITE8_HANDLER( vvillage_output_w ) static WRITE8_HANDLER( vvillage_output_w )

View File

@ -634,7 +634,7 @@ static WRITE8_HANDLER( led_w )
static READ8_DEVICE_HANDLER( caterplr_rand_r ) static READ8_DEVICE_HANDLER( caterplr_rand_r )
{ {
return mame_rand(device->machine) % 0xff; return device->machine->rand() % 0xff;
} }

View File

@ -188,7 +188,7 @@ static READ8_HANDLER( chinsan_input_port_0_r )
} }
printf("chinsan_input_port_0_r unk_r %02x\n", state->port_select); printf("chinsan_input_port_0_r unk_r %02x\n", state->port_select);
return mame_rand(space->machine); return space->machine->rand();
} }
static READ8_HANDLER( chinsan_input_port_1_r ) static READ8_HANDLER( chinsan_input_port_1_r )
@ -219,7 +219,7 @@ static READ8_HANDLER( chinsan_input_port_1_r )
} }
printf("chinsan_input_port_1_r unk_r %02x\n", state->port_select); printf("chinsan_input_port_1_r unk_r %02x\n", state->port_select);
return mame_rand(space->machine); return space->machine->rand();
} }
static WRITE8_DEVICE_HANDLER( chin_adpcm_w ) static WRITE8_DEVICE_HANDLER( chin_adpcm_w )

View File

@ -148,7 +148,7 @@ static WRITE8_HANDLER( cmmb_output_w )
static READ8_HANDLER( kludge_r ) static READ8_HANDLER( kludge_r )
{ {
return mame_rand(space->machine); return space->machine->rand();
} }
/* overlap empty addresses */ /* overlap empty addresses */

View File

@ -338,7 +338,7 @@ static WRITE16_HANDLER( ramdac_fg_w )
/* /*
static READ16_HANDLER( test_r ) static READ16_HANDLER( test_r )
{ {
return mame_rand(space->machine); return space->machine->rand();
}*/ }*/
/************************* /*************************

View File

@ -362,7 +362,7 @@ static WRITE32_HANDLER(sysh1_unk_w)
#if 0 #if 0
static READ32_HANDLER(sysh1_ioga_r) static READ32_HANDLER(sysh1_ioga_r)
{ {
//return mame_rand(space->machine);//h1_ioga[offset]; //return space->machine->rand();//h1_ioga[offset];
return h1_ioga[offset]; return h1_ioga[offset];
} }

View File

@ -586,7 +586,7 @@ INLINE void cps3_drawgfxzoom(bitmap_t *dest_bmp,const rectangle *clip,const gfx_
if (c&0x02) dest[x] |= 0x4000; if (c&0x02) dest[x] |= 0x4000;
if (c&0x04) dest[x] |= 0x8000; if (c&0x04) dest[x] |= 0x8000;
if (c&0x08) dest[x] |= 0x10000; if (c&0x08) dest[x] |= 0x10000;
if (c&0xf0) dest[x] |= mame_rand(gfx->machine); // ?? not used? if (c&0xf0) dest[x] |= gfx->machine->rand(); // ?? not used?
} }
else else
{ {

View File

@ -108,7 +108,7 @@ ADDRESS_MAP_END
#if USE_H8 #if USE_H8
static READ16_HANDLER( test_r ) static READ16_HANDLER( test_r )
{ {
return mame_rand(space->machine); return space->machine->rand();
} }
static ADDRESS_MAP_START( csplayh5_sub_map, ADDRESS_SPACE_PROGRAM, 16 ) static ADDRESS_MAP_START( csplayh5_sub_map, ADDRESS_SPACE_PROGRAM, 16 )

View File

@ -278,7 +278,7 @@ static READ16_HANDLER ( dblewing_prot_r )
mame_printf_debug("dblewing prot r %08x, %04x, %04x\n", cpu_get_pc(space->cpu), offset * 2, mem_mask); mame_printf_debug("dblewing prot r %08x, %04x, %04x\n", cpu_get_pc(space->cpu), offset * 2, mem_mask);
return 0;//mame_rand(space->machine); return 0;//space->machine->rand();
} }
static WRITE16_HANDLER( dblewing_prot_w ) static WRITE16_HANDLER( dblewing_prot_w )

View File

@ -350,10 +350,10 @@ static TIMER_DEVICE_CALLBACK( ddealer_mcu_sim )
} }
/*random number generators,controls order of cards*/ /*random number generators,controls order of cards*/
state->mcu_shared_ram[0x10 / 2] = mame_rand(timer.machine) & 0xffff; state->mcu_shared_ram[0x10 / 2] = timer.machine->rand() & 0xffff;
state->mcu_shared_ram[0x12 / 2] = mame_rand(timer.machine) & 0xffff; state->mcu_shared_ram[0x12 / 2] = timer.machine->rand() & 0xffff;
state->mcu_shared_ram[0x14 / 2] = mame_rand(timer.machine) & 0xffff; state->mcu_shared_ram[0x14 / 2] = timer.machine->rand() & 0xffff;
state->mcu_shared_ram[0x16 / 2] = mame_rand(timer.machine) & 0xffff; state->mcu_shared_ram[0x16 / 2] = timer.machine->rand() & 0xffff;
} }

View File

@ -1640,8 +1640,8 @@ static READ8_DEVICE_HANDLER( quiz365_input_r )
if (!BIT(state->dsw_sel, 0)) return input_port_read(device->machine, "DSW1"); if (!BIT(state->dsw_sel, 0)) return input_port_read(device->machine, "DSW1");
if (!BIT(state->dsw_sel, 1)) return input_port_read(device->machine, "DSW2"); if (!BIT(state->dsw_sel, 1)) return input_port_read(device->machine, "DSW2");
if (!BIT(state->dsw_sel, 2)) return input_port_read(device->machine, "DSW3"); if (!BIT(state->dsw_sel, 2)) return input_port_read(device->machine, "DSW3");
if (!BIT(state->dsw_sel, 3)) return 0xff;//mame_rand(device->machine); if (!BIT(state->dsw_sel, 3)) return 0xff;//device->machine->rand();
if (!BIT(state->dsw_sel, 4)) return 0xff;//mame_rand(device->machine); if (!BIT(state->dsw_sel, 4)) return 0xff;//device->machine->rand();
return 0xff; return 0xff;
} }
@ -2016,8 +2016,8 @@ static READ8_HANDLER( rongrong_input_r )
if (!BIT(state->dsw_sel, 0)) return input_port_read(space->machine, "DSW1"); if (!BIT(state->dsw_sel, 0)) return input_port_read(space->machine, "DSW1");
if (!BIT(state->dsw_sel, 1)) return input_port_read(space->machine, "DSW2"); if (!BIT(state->dsw_sel, 1)) return input_port_read(space->machine, "DSW2");
if (!BIT(state->dsw_sel, 2)) return 0xff;//mame_rand(space->machine); if (!BIT(state->dsw_sel, 2)) return 0xff;//space->machine->rand();
if (!BIT(state->dsw_sel, 3)) return 0xff;//mame_rand(space->machine); if (!BIT(state->dsw_sel, 3)) return 0xff;//space->machine->rand();
if (!BIT(state->dsw_sel, 4)) return input_port_read(space->machine, "DSW3"); if (!BIT(state->dsw_sel, 4)) return input_port_read(space->machine, "DSW3");
return 0xff; return 0xff;
} }
@ -2536,7 +2536,7 @@ static WRITE8_DEVICE_HANDLER( hanakanz_oki_bank_w )
static READ8_HANDLER( hanakanz_rand_r ) static READ8_HANDLER( hanakanz_rand_r )
{ {
return mame_rand(space->machine); return space->machine->rand();
} }
static ADDRESS_MAP_START( hanakanz_portmap, ADDRESS_SPACE_IO, 8 ) static ADDRESS_MAP_START( hanakanz_portmap, ADDRESS_SPACE_IO, 8 )

View File

@ -75,7 +75,7 @@ static WRITE8_HANDLER( ddribble_coin_counter_w )
static READ8_DEVICE_HANDLER( ddribble_vlm5030_busy_r ) static READ8_DEVICE_HANDLER( ddribble_vlm5030_busy_r )
{ {
return mame_rand(device->machine); /* patch */ return device->machine->rand(); /* patch */
/* FIXME: remove ? */ /* FIXME: remove ? */
#if 0 #if 0
if (vlm5030_bsy(device)) return 1; if (vlm5030_bsy(device)) return 1;

View File

@ -396,10 +396,10 @@ static READ32_HANDLER( dragngun_service_r )
static READ32_HANDLER( lockload_gun_mirror_r ) static READ32_HANDLER( lockload_gun_mirror_r )
{ {
//logerror("%08x:Read gun %d\n",cpu_get_pc(space->cpu),offset); //logerror("%08x:Read gun %d\n",cpu_get_pc(space->cpu),offset);
//return ((mame_rand(space->machine)%0xffff)<<16) | mame_rand(space->machine)%0xffff; //return ((space->machine->rand()%0xffff)<<16) | space->machine->rand()%0xffff;
if (offset) /* Mirror of player 1 and player 2 fire buttons */ if (offset) /* Mirror of player 1 and player 2 fire buttons */
return input_port_read(space->machine, "IN4") | ((mame_rand(space->machine)%0xff)<<16); return input_port_read(space->machine, "IN4") | ((space->machine->rand()%0xff)<<16);
return input_port_read(space->machine, "IN3") | input_port_read(space->machine, "LIGHT0_X") | (input_port_read(space->machine, "LIGHT0_X")<<16) | (input_port_read(space->machine, "LIGHT0_X")<<24); //((mame_rand(space->machine)%0xff)<<16); return input_port_read(space->machine, "IN3") | input_port_read(space->machine, "LIGHT0_X") | (input_port_read(space->machine, "LIGHT0_X")<<16) | (input_port_read(space->machine, "LIGHT0_X")<<24); //((space->machine->rand()%0xff)<<16);
} }
static READ32_HANDLER( dragngun_prot_r ) static READ32_HANDLER( dragngun_prot_r )

View File

@ -173,7 +173,7 @@ static WRITE8_HANDLER( laserdisc_w )
static READ8_HANDLER( test_r ) static READ8_HANDLER( test_r )
{ {
return mame_rand(space->machine); return space->machine->rand();
} }
static ADDRESS_MAP_START( begas_map, ADDRESS_SPACE_PROGRAM, 8 ) static ADDRESS_MAP_START( begas_map, ADDRESS_SPACE_PROGRAM, 8 )

View File

@ -117,7 +117,7 @@ static READ32_HANDLER(test2_r)
// if (offset==0) // if (offset==0)
// return input_port_read(space->machine, "IN0"); //0xffffffff; // return input_port_read(space->machine, "IN0"); //0xffffffff;
// logerror("%08x: Test2_r %d\n",cpu_get_pc(space->cpu),offset); // logerror("%08x: Test2_r %d\n",cpu_get_pc(space->cpu),offset);
return mame_rand(space->machine); //0xffffffff; return space->machine->rand(); //0xffffffff;
} }
static READ32_HANDLER(test3_r) static READ32_HANDLER(test3_r)
@ -127,7 +127,7 @@ static READ32_HANDLER(test3_r)
*/ */
//if (offset==0) //if (offset==0)
// return mame_rand(space->machine)|(mame_rand(space->machine)<<16); // return space->machine->rand()|(space->machine->rand()<<16);
// logerror("%08x: Test3_r %d\n",cpu_get_pc(space->cpu),offset); // logerror("%08x: Test3_r %d\n",cpu_get_pc(space->cpu),offset);
return 0xffffffff; return 0xffffffff;
} }

View File

@ -107,7 +107,7 @@ static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rect
} }
else else
{ {
code = mame_rand(machine); code = machine->rand();
} }
} }
@ -261,7 +261,7 @@ static READ8_HANDLER( rambank2_r )
else else
printf("unk rb2_r\n"); printf("unk rb2_r\n");
return mame_rand(space->machine); return space->machine->rand();
} }
static WRITE8_HANDLER( rambank2_w ) static WRITE8_HANDLER( rambank2_w )

View File

@ -568,7 +568,7 @@ static WRITE8_HANDLER(output2_w)
static READ8_HANDLER(qc_b8_r) static READ8_HANDLER(qc_b8_r)
{ {
return mame_rand(space->machine); return space->machine->rand();
} }
static ADDRESS_MAP_START( mem_map, ADDRESS_SPACE_PROGRAM, 8 ) static ADDRESS_MAP_START( mem_map, ADDRESS_SPACE_PROGRAM, 8 )
@ -725,7 +725,7 @@ static void drawCrt( running_machine *machine, bitmap_t *bitmap,const rectangle
if ((tile & 0xc0) == 0xc0) if ((tile & 0xc0) == 0xc0)
{ {
b = 1; b = 1;
tile = mame_rand(machine) & 0x7f;//(tile >> 2) & 0xf; tile = machine->rand() & 0x7f;//(tile >> 2) & 0xf;
} }
} }
else else
@ -887,9 +887,9 @@ static PALETTE_INIT(dwarfd)
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
{ {
int r = mame_rand(machine)|0x80; int r = machine->rand()|0x80;
int g = mame_rand(machine)|0x80; int g = machine->rand()|0x80;
int b = mame_rand(machine)|0x80; int b = machine->rand()|0x80;
if (i == 0) r = g = b = 0; if (i == 0) r = g = b = 0;
palette_set_color(machine,i,MAKE_RGB(r,g,b)); palette_set_color(machine,i,MAKE_RGB(r,g,b));

View File

@ -87,7 +87,7 @@ static READ32_HANDLER( eolith_custom_r )
*/ */
eolith_speedup_read(space); eolith_speedup_read(space);
return (input_port_read(space->machine, "IN0") & ~0x300) | (mame_rand(space->machine) & 0x300); return (input_port_read(space->machine, "IN0") & ~0x300) | (space->machine->rand() & 0x300);
} }
static WRITE32_HANDLER( systemcontrol_w ) static WRITE32_HANDLER( systemcontrol_w )

View File

@ -219,19 +219,19 @@ ADDRESS_MAP_END
static READ8_HANDLER(snd_porta_r) static READ8_HANDLER(snd_porta_r)
{ {
//mame_printf_debug("PA R @%x\n",cpu_get_pc(space->cpu)); //mame_printf_debug("PA R @%x\n",cpu_get_pc(space->cpu));
return mame_rand(space->machine); return space->machine->rand();
} }
static READ8_HANDLER(snd_portb_r) static READ8_HANDLER(snd_portb_r)
{ {
//mame_printf_debug("PB R @%x\n",cpu_get_pc(space->cpu)); //mame_printf_debug("PB R @%x\n",cpu_get_pc(space->cpu));
return mame_rand(space->machine); return space->machine->rand();
} }
static READ8_HANDLER(snd_portc_r) static READ8_HANDLER(snd_portc_r)
{ {
//mame_printf_debug("PC R @%x\n",cpu_get_pc(space->cpu)); //mame_printf_debug("PC R @%x\n",cpu_get_pc(space->cpu));
return mame_rand(space->machine); return space->machine->rand();
} }
static WRITE8_HANDLER(snd_porta_w) static WRITE8_HANDLER(snd_porta_w)

View File

@ -1118,7 +1118,7 @@ static CUSTOM_INPUT( kingball_noise_r )
/* bit 5 is the NOISE line from the sound circuit. The code just verifies /* bit 5 is the NOISE line from the sound circuit. The code just verifies
that it's working, doesn't actually use return value, so we can just use that it's working, doesn't actually use return value, so we can just use
rand() */ rand() */
return mame_rand(field->port->machine) & 1; return field->port->machine->rand() & 1;
} }

View File

@ -1026,7 +1026,7 @@ static WRITE8_HANDLER( youmab_extra_bank_w )
static READ8_HANDLER( youmab_8a_r ) static READ8_HANDLER( youmab_8a_r )
{ {
return mame_rand(space->machine); return space->machine->rand();
} }
static WRITE8_HANDLER( youmab_81_w ) static WRITE8_HANDLER( youmab_81_w )

View File

@ -297,20 +297,20 @@ static VIDEO_UPDATE(galpani3)
/* /*
else if (pridat==0x2f) // area outside of the girl else if (pridat==0x2f) // area outside of the girl
{ {
//dst[0] = mame_rand(screen->machine)&0x3fff; //dst[0] = screen->machine->rand()&0x3fff;
} }
else if (pridat==0x00) // the initial line / box that gets drawn else if (pridat==0x00) // the initial line / box that gets drawn
{ {
//dst[0] = mame_rand(screen->machine)&0x3fff; //dst[0] = screen->machine->rand()&0x3fff;
} }
else if (pridat==0x30) // during the 'gals boxes' on the intro else if (pridat==0x30) // during the 'gals boxes' on the intro
{ {
//dst[0] = mame_rand(screen->machine)&0x3fff; //dst[0] = screen->machine->rand()&0x3fff;
} }
else if (pridat==0x0c) // 'nice' at end of level else if (pridat==0x0c) // 'nice' at end of level
{ {
//dst[0] = mame_rand(screen->machine)&0x3fff; //dst[0] = screen->machine->rand()&0x3fff;
} }
else else
{ {

View File

@ -233,7 +233,7 @@ ADDRESS_MAP_END
static READ16_HANDLER( kludge ) static READ16_HANDLER( kludge )
{ {
return mame_rand(space->machine) & 0x0700; return space->machine->rand() & 0x0700;
} }
/* a kludge! */ /* a kludge! */
@ -242,7 +242,7 @@ static READ8_DEVICE_HANDLER( comad_okim6295_r )
UINT16 retvalue; UINT16 retvalue;
// retvalue = okim6295_r(offset,mem_mask) << 8; // doesn't work, causes lockups when girls change.. // retvalue = okim6295_r(offset,mem_mask) << 8; // doesn't work, causes lockups when girls change..
retvalue = mame_rand(device->machine); retvalue = device->machine->rand();
return retvalue; return retvalue;
} }
@ -306,7 +306,7 @@ ADDRESS_MAP_END
#ifdef UNUSED_FUNCTION #ifdef UNUSED_FUNCTION
READ16_HANDLER( zipzap_random_read ) READ16_HANDLER( zipzap_random_read )
{ {
return mame_rand(space->machine); return space->machine->rand();
} }
#endif #endif

View File

@ -344,9 +344,9 @@ static WRITE8_HANDLER(qx2_w){ }
static WRITE8_HANDLER(qx3_w){ } static WRITE8_HANDLER(qx3_w){ }
static READ8_HANDLER(qx2_r){ return mame_rand(space->machine); } static READ8_HANDLER(qx2_r){ return space->machine->rand(); }
static READ8_HANDLER(qx3_r){ return mame_rand(space->machine)&0xf; } static READ8_HANDLER(qx3_r){ return space->machine->rand()&0xf; }
static READ8_HANDLER(qx0_r) static READ8_HANDLER(qx0_r)
{ {
@ -623,7 +623,7 @@ GFXDECODE_END
static READ8_DEVICE_HANDLER(f1_r) static READ8_DEVICE_HANDLER(f1_r)
{ {
return mame_rand(device->machine); return device->machine->rand();
} }
static const ym2203_interface ppking_ym2203_interface = static const ym2203_interface ppking_ym2203_interface =

View File

@ -282,7 +282,7 @@ static PALETTE_INIT( goldngam )
static READ16_HANDLER(unk_r) static READ16_HANDLER(unk_r)
{ {
int test1 = (mame_rand(space->machine) & 0xae00); int test1 = (space->machine->rand() & 0xae00);
// popmessage("VAL = %02x", test1); // popmessage("VAL = %02x", test1);
return test1; return test1;

View File

@ -211,7 +211,7 @@ static WRITE8_HANDLER( hitpoker_pic_w )
#if 0 #if 0
static READ8_HANDLER( test_r ) static READ8_HANDLER( test_r )
{ {
return mame_rand(space->machine); return space->machine->rand();
} }
#endif #endif

View File

@ -459,7 +459,7 @@ WRITE32_HANDLER( trap_write )
static READ32_HANDLER( hng64_random_read ) static READ32_HANDLER( hng64_random_read )
{ {
return mame_rand(space->machine)&0xffffffff; return space->machine->rand()&0xffffffff;
} }
#endif #endif
@ -530,7 +530,7 @@ static READ32_HANDLER( hng64_sysregs_r )
switch(offset*4) switch(offset*4)
{ {
case 0x001c: return mame_rand(space->machine); // hng64 hangs on start-up if zero. case 0x001c: return space->machine->rand(); // hng64 hangs on start-up if zero.
//case 0x106c: //case 0x106c:
//case 0x107c: //case 0x107c:
case 0x1084: return 0x00000002; //MCU->MIPS latch port case 0x1084: return 0x00000002; //MCU->MIPS latch port
@ -559,7 +559,7 @@ static READ32_HANDLER( hng64_sysregs_r )
// printf("%08x\n",offset*4); // printf("%08x\n",offset*4);
// return mame_rand(space->machine)&0xffffffff; // return space->machine->rand()&0xffffffff;
return state->sysregs[offset]; return state->sysregs[offset];
} }
@ -697,7 +697,7 @@ static READ32_HANDLER( shoot_io_r )
{ {
/* Quick kludge for use the input test items */ /* Quick kludge for use the input test items */
if(input_port_read(space->machine, "D_IN") & 0x01000000) if(input_port_read(space->machine, "D_IN") & 0x01000000)
state->p1_trig = mame_rand(space->machine) & 0x01000000; state->p1_trig = space->machine->rand() & 0x01000000;
return (input_port_read(space->machine, "D_IN") & ~0x01000000) | (state->p1_trig); return (input_port_read(space->machine, "D_IN") & ~0x01000000) | (state->p1_trig);
} }

View File

@ -16,7 +16,7 @@ I've not had a chance to wire up the board yet, but it might be possible to writ
static READ8_HANDLER( unk_r ) static READ8_HANDLER( unk_r )
{ {
return mame_rand(space->machine); return space->machine->rand();
} }
static UINT8 *intrscti_ram; static UINT8 *intrscti_ram;

View File

@ -912,7 +912,7 @@ void itech32_state::nvram_init(nvram_device &nvram, void *base, size_t length)
// if nvram is the main RAM, don't overwrite exception vectors // if nvram is the main RAM, don't overwrite exception vectors
int start = (base == main_ram) ? 0x80 : 0x00; int start = (base == main_ram) ? 0x80 : 0x00;
for (int i = start; i < length; i++) for (int i = start; i < length; i++)
((UINT8 *)base)[i] = mame_rand(machine); ((UINT8 *)base)[i] = machine->rand();
// due to accessing uninitialized RAM, we need this hack // due to accessing uninitialized RAM, we need this hack
if (is_drivedge) if (is_drivedge)

View File

@ -740,7 +740,7 @@ static void mjzoomin_mcu_run(running_machine *machine)
MCU_READ("KEY1", 0x0002, 0x000/2, 0x13); /*CHI (trusted)*/ MCU_READ("KEY1", 0x0002, 0x000/2, 0x13); /*CHI (trusted)*/
MCU_READ("KEY0", 0x0004, 0x000/2, 0x14); /*START1*/ MCU_READ("KEY0", 0x0004, 0x000/2, 0x14); /*START1*/
} }
jm_shared_ram[0x00c/2] = mame_rand(machine) & 0xffff; jm_shared_ram[0x00c/2] = machine->rand() & 0xffff;
prg_prot++; prg_prot++;
if(prg_prot > 0x10) { prg_prot = 0; } if(prg_prot > 0x10) { prg_prot = 0; }
jm_shared_ram[0x00e/2] = prg_prot; jm_shared_ram[0x00e/2] = prg_prot;
@ -784,7 +784,7 @@ static void urashima_mcu_run(running_machine *machine)
MCU_READ("KEY1", 0x0002, 0x300/2, 0x13); /*CHI (trusted)*/ MCU_READ("KEY1", 0x0002, 0x300/2, 0x13); /*CHI (trusted)*/
MCU_READ("KEY0", 0x0004, 0x300/2, 0x14); /*START1*/ MCU_READ("KEY0", 0x0004, 0x300/2, 0x14); /*START1*/
} }
jm_shared_ram[0x30c/2] = mame_rand(machine) & 0xffff; jm_shared_ram[0x30c/2] = machine->rand() & 0xffff;
prg_prot++; prg_prot++;
if(prg_prot > 0x10) { prg_prot = 0; } if(prg_prot > 0x10) { prg_prot = 0; }
jm_shared_ram[0x30e/2] = prg_prot; jm_shared_ram[0x30e/2] = prg_prot;
@ -825,7 +825,7 @@ static void second_mcu_run(running_machine *machine)
// MCU_READ("KEY0", 0x0004, 0x7b8/2, 0x03); /*START1(correct?) */ // MCU_READ("KEY0", 0x0004, 0x7b8/2, 0x03); /*START1(correct?) */
} }
jm_shared_ram[0x20c/2] = mame_rand(machine) & 0xffff; //kakumei2 jm_shared_ram[0x20c/2] = machine->rand() & 0xffff; //kakumei2
} }

View File

@ -1356,7 +1356,7 @@ ROM_END
/*Temporary kludge for make the RNG work*/ /*Temporary kludge for make the RNG work*/
static READ8_HANDLER( jngolady_rng_r ) static READ8_HANDLER( jngolady_rng_r )
{ {
return mame_rand(space->machine); return space->machine->rand();
} }
static DRIVER_INIT( jngolady ) static DRIVER_INIT( jngolady )

View File

@ -171,7 +171,7 @@ static READ8_HANDLER( rng_r )
if(cpu_get_pc(space->cpu) == 0xab3a) if(cpu_get_pc(space->cpu) == 0xab3a)
return (offset == 2) ? 0x49 : 0x92; return (offset == 2) ? 0x49 : 0x92;
return mame_rand(space->machine) & 0xff; return space->machine->rand() & 0xff;
} }
/************************* /*************************

View File

@ -168,7 +168,7 @@ ADDRESS_MAP_END
static READ8_HANDLER(unk_r) static READ8_HANDLER(unk_r)
{ {
return (mame_rand(space->machine) & 0xff); return (space->machine->rand() & 0xff);
} }
static ADDRESS_MAP_START( jubileep_cru_map, ADDRESS_SPACE_IO, 8 ) static ADDRESS_MAP_START( jubileep_cru_map, ADDRESS_SPACE_IO, 8 )

View File

@ -270,7 +270,7 @@ static MACHINE_RESET( shogwarr )
static READ16_HANDLER( kaneko16_rnd_r ) static READ16_HANDLER( kaneko16_rnd_r )
{ {
return mame_rand(space->machine) & 0xffff; return space->machine->rand() & 0xffff;
} }
static WRITE16_HANDLER( kaneko16_coin_lockout_w ) static WRITE16_HANDLER( kaneko16_coin_lockout_w )

View File

@ -93,7 +93,7 @@ static READ16_HANDLER( bmc_RAMDAC_color_r )
static READ16_HANDLER(random_number_r) static READ16_HANDLER(random_number_r)
{ {
return mame_rand(space->machine); return space->machine->rand();
} }
static UINT16 prot_data; static UINT16 prot_data;
@ -109,7 +109,7 @@ static READ16_HANDLER(prot_r)
} }
logerror("unk prot r %x %x\n",prot_data, cpu_get_previouspc(space->cpu)); logerror("unk prot r %x %x\n",prot_data, cpu_get_previouspc(space->cpu));
return mame_rand(space->machine); return space->machine->rand();
} }
static WRITE16_HANDLER(prot_w) static WRITE16_HANDLER(prot_w)

View File

@ -18,9 +18,9 @@ static READ8_HANDLER( kopunch_in_r )
{ {
/* port 31 + low 3 bits of port 32 contain the punch strength */ /* port 31 + low 3 bits of port 32 contain the punch strength */
if (offset == 0) if (offset == 0)
return mame_rand(space->machine); return space->machine->rand();
else else
return (mame_rand(space->machine) & 0x07) | input_port_read(space->machine, "SYSTEM"); return (space->machine->rand() & 0x07) | input_port_read(space->machine, "SYSTEM");
} }
static WRITE8_HANDLER( kopunch_lamp_w ) static WRITE8_HANDLER( kopunch_lamp_w )

View File

@ -366,7 +366,7 @@ static READ16_HANDLER( lastfght_c00002_r )
{ {
// high byte: // high byte:
// mask 0x1c: from sound? // mask 0x1c: from sound?
return (mame_rand(space->machine) & 0x1c00) | input_port_read(space->machine, "IN0"); return (space->machine->rand() & 0x1c00) | input_port_read(space->machine, "IN0");
} }
static READ16_HANDLER( lastfght_c00004_r ) static READ16_HANDLER( lastfght_c00004_r )

View File

@ -434,7 +434,7 @@ static WRITE8_HANDLER( plr2_w )
static READ8_HANDLER( cop_io_r ) static READ8_HANDLER( cop_io_r )
{ {
// if (offset == 1) return mame_rand(space->machine) & 0x01; // if (offset == 1) return space->machine->rand() & 0x01;
return 1; // cop_io[offset]; return 1; // cop_io[offset];
} }

View File

@ -153,7 +153,7 @@ static WRITE8_HANDLER( m14_cram_w )
static READ8_HANDLER( m14_rng_r ) static READ8_HANDLER( m14_rng_r )
{ {
/* graphic artifacts happens if this doesn't return random values. */ /* graphic artifacts happens if this doesn't return random values. */
return (mame_rand(space->machine) & 0x0f) | 0xf0; /* | (input_port_read(space->machine, "IN1") & 0x80)*/; return (space->machine->rand() & 0x0f) | 0xf0; /* | (input_port_read(space->machine, "IN1") & 0x80)*/;
} }
/* Here routes the hopper & the inputs */ /* Here routes the hopper & the inputs */

View File

@ -254,7 +254,7 @@ static READ8_HANDLER(m72_mcu_data_r )
static INTERRUPT_GEN( m72_mcu_int ) static INTERRUPT_GEN( m72_mcu_int )
{ {
//mcu_snd_cmd_latch |= 0x11; /* 0x10 is special as well - FIXME */ //mcu_snd_cmd_latch |= 0x11; /* 0x10 is special as well - FIXME */
mcu_snd_cmd_latch = 0x11;// | (mame_rand(machine) & 1); /* 0x10 is special as well - FIXME */ mcu_snd_cmd_latch = 0x11;// | (machine->rand() & 1); /* 0x10 is special as well - FIXME */
cpu_set_input_line(device, 1, ASSERT_LINE); cpu_set_input_line(device, 1, ASSERT_LINE);
} }

View File

@ -438,7 +438,7 @@ static VIDEO_UPDATE(magicard)
static READ16_HANDLER( test_r ) static READ16_HANDLER( test_r )
{ {
return mame_rand(space->machine); return space->machine->rand();
} }
static WRITE16_HANDLER( paletteram_io_w ) static WRITE16_HANDLER( paletteram_io_w )
@ -481,7 +481,7 @@ static READ16_HANDLER( philips_66470_r )
switch(offset) switch(offset)
{ {
// case 0/2: // case 0/2:
// return mame_rand(space->machine); //TODO // return space->machine->rand(); //TODO
} }
//printf("[%04x]\n",offset*2); //printf("[%04x]\n",offset*2);
@ -533,7 +533,7 @@ static READ16_HANDLER( scc68070_uart_r )
switch(offset) switch(offset)
{ {
case 0x02/2: return mame_rand(space->machine); //uart mode register case 0x02/2: return space->machine->rand(); //uart mode register
} }
return scc68070_uart_regs[offset]; return scc68070_uart_regs[offset];

View File

@ -895,7 +895,7 @@ static UINT16 vdp_get_word_from_68k_mem_default(running_machine *machine, UINT32
else else
{ {
printf("DMA Read unmapped %06x\n",source); printf("DMA Read unmapped %06x\n",source);
return mame_rand(machine); return machine->rand();
} }
@ -1275,7 +1275,7 @@ static UINT16 megadriv_vdp_data_port_r(running_machine *machine)
{ {
UINT16 retdata=0; UINT16 retdata=0;
//return mame_rand(machine); //return machine->rand();
megadrive_vdp_command_pending = 0; megadrive_vdp_command_pending = 0;
@ -1289,12 +1289,12 @@ static UINT16 megadriv_vdp_data_port_r(running_machine *machine)
case 0x0001: case 0x0001:
logerror("Attempting to READ from DATA PORT in VRAM WRITE MODE\n"); logerror("Attempting to READ from DATA PORT in VRAM WRITE MODE\n");
retdata = mame_rand(machine); retdata = machine->rand();
break; break;
case 0x0003: case 0x0003:
logerror("Attempting to READ from DATA PORT in CRAM WRITE MODE\n"); logerror("Attempting to READ from DATA PORT in CRAM WRITE MODE\n");
retdata = mame_rand(machine); retdata = machine->rand();
break; break;
case 0x0004: case 0x0004:
@ -1315,7 +1315,7 @@ static UINT16 megadriv_vdp_data_port_r(running_machine *machine)
default: default:
logerror("Attempting to READ from DATA PORT in #UNDEFINED# MODE\n"); logerror("Attempting to READ from DATA PORT in #UNDEFINED# MODE\n");
retdata = mame_rand(machine); retdata = machine->rand();
break; break;
} }
@ -1622,7 +1622,7 @@ READ16_HANDLER( megadriv_vdp_r )
case 0x06: case 0x06:
// if ((!ACCESSING_BITS_8_15) || (!ACCESSING_BITS_0_7)) mame_printf_debug("8-bit VDP read control port access, offset %04x mem_mask %04x\n",offset,mem_mask); // if ((!ACCESSING_BITS_8_15) || (!ACCESSING_BITS_0_7)) mame_printf_debug("8-bit VDP read control port access, offset %04x mem_mask %04x\n",offset,mem_mask);
retvalue = megadriv_vdp_ctrl_port_r(); retvalue = megadriv_vdp_ctrl_port_r();
// retvalue = mame_rand(space->machine); // retvalue = space->machine->rand();
// mame_printf_debug("%06x: Read Control Port at scanline %d hpos %d (return %04x)\n",cpu_get_pc(space->cpu),genesis_scanline_counter, get_hposition(),retvalue); // mame_printf_debug("%06x: Read Control Port at scanline %d hpos %d (return %04x)\n",cpu_get_pc(space->cpu),genesis_scanline_counter, get_hposition(),retvalue);
break; break;
@ -1632,7 +1632,7 @@ READ16_HANDLER( megadriv_vdp_r )
case 0x0e: case 0x0e:
// if ((!ACCESSING_BITS_8_15) || (!ACCESSING_BITS_0_7)) mame_printf_debug("8-bit VDP read HV counter port access, offset %04x mem_mask %04x\n",offset,mem_mask); // if ((!ACCESSING_BITS_8_15) || (!ACCESSING_BITS_0_7)) mame_printf_debug("8-bit VDP read HV counter port access, offset %04x mem_mask %04x\n",offset,mem_mask);
retvalue = megadriv_read_hv_counters(); retvalue = megadriv_read_hv_counters();
// retvalue = mame_rand(space->machine); // retvalue = space->machine->rand();
// mame_printf_debug("%06x: Read HV counters at scanline %d hpos %d (return %04x)\n",cpu_get_pc(space->cpu),genesis_scanline_counter, get_hposition(),retvalue); // mame_printf_debug("%06x: Read HV counters at scanline %d hpos %d (return %04x)\n",cpu_get_pc(space->cpu),genesis_scanline_counter, get_hposition(),retvalue);
break; break;
@ -1979,7 +1979,7 @@ READ16_HANDLER( megadriv_68k_io_read )
D0 : Bit 0 of version number D0 : Bit 0 of version number
*/ */
//return (mame_rand(space->machine)&0x0f0f)|0xf0f0;//0x0000; //return (space->machine->rand()&0x0f0f)|0xf0f0;//0x0000;
switch (offset) switch (offset)
{ {
case 0: case 0:
@ -2172,7 +2172,7 @@ static READ16_HANDLER( megadriv_68k_read_z80_ram )
else else
{ {
logerror("%06x: 68000 attempting to access Z80 (read) address space without bus\n", cpu_get_pc(space->cpu)); logerror("%06x: 68000 attempting to access Z80 (read) address space without bus\n", cpu_get_pc(space->cpu));
return mame_rand(space->machine); return space->machine->rand();
} }
} }
@ -2214,7 +2214,7 @@ static READ16_HANDLER( megadriv_68k_check_z80_bus )
the value is never zero. Time Killers is the most fussy, and doesn't like the the value is never zero. Time Killers is the most fussy, and doesn't like the
read_next_instruction function from system16, so I just return a random value read_next_instruction function from system16, so I just return a random value
in the unused bits */ in the unused bits */
UINT16 nextvalue = mame_rand(space->machine);//read_next_instruction(space)&0xff00; UINT16 nextvalue = space->machine->rand();//read_next_instruction(space)&0xff00;
/* Check if the 68k has the z80 bus */ /* Check if the 68k has the z80 bus */
@ -2404,7 +2404,7 @@ static WRITE8_HANDLER( megadriv_z80_vdp_write )
static READ8_HANDLER( megadriv_z80_vdp_read ) static READ8_HANDLER( megadriv_z80_vdp_read )
{ {
mame_printf_debug("megadriv_z80_vdp_read %02x\n",offset); mame_printf_debug("megadriv_z80_vdp_read %02x\n",offset);
return mame_rand(space->machine); return space->machine->rand();
} }
static READ8_HANDLER( megadriv_z80_unmapped_read ) static READ8_HANDLER( megadriv_z80_unmapped_read )
@ -5670,7 +5670,7 @@ INLINE UINT8 read_pixel_from_stampmap( running_machine* machine, bitmap_t* srcbi
/* /*
if (!srcbitmap) if (!srcbitmap)
{ {
return mame_rand(machine); return machine->rand();
} }
if (x >= srcbitmap->width) return 0; if (x >= srcbitmap->width) return 0;
@ -5739,8 +5739,8 @@ INLINE void write_pixel_to_imagebuffer( running_machine* machine, UINT32 pix, in
default: default:
case 0x03: // invalid? case 0x03: // invalid?
segacd_dataram[offset] = mame_rand(machine); segacd_dataram[offset] = machine->rand();
segacd_dataram[offset+1] = mame_rand(machine); segacd_dataram[offset+1] = machine->rand();
break; break;
} }
@ -6759,7 +6759,7 @@ static void genesis_render_videoline_to_videobuffer(int scanline)
//mame_printf_debug("screenwidth %d\n",screenwidth); //mame_printf_debug("screenwidth %d\n",screenwidth);
//base_w = mame_rand(Machine)&0xff; //base_w = Machine->rand()&0xff;
/* Calculate Exactly where we're going to draw the Window, and if the Window Bug applies */ /* Calculate Exactly where we're going to draw the Window, and if the Window Bug applies */
window_is_bugged = 0; window_is_bugged = 0;
@ -7930,7 +7930,7 @@ static void genesis_render_videobuffer_to_screenbuffer(running_machine *machine,
case 0x1a000: // (sprite)shadow set, highlight set - not possible case 0x1a000: // (sprite)shadow set, highlight set - not possible
case 0x1e000: // (sprite)shadow set, highlight set, normal set, not possible case 0x1e000: // (sprite)shadow set, highlight set, normal set, not possible
default: default:
lineptr[x] = mame_rand(machine)&0x3f; lineptr[x] = machine->rand()&0x3f;
break; break;
} }
} }
@ -8681,7 +8681,7 @@ static NVRAM_HANDLER( megadriv )
{ {
int x; int x;
for (x=0;x<megadriv_backupram_length/2;x++) for (x=0;x<megadriv_backupram_length/2;x++)
megadriv_backupram[x]=0xffff;//mame_rand(machine); // dino dini's needs 0xff or game rules are broken megadriv_backupram[x]=0xffff;//machine->rand(); // dino dini's needs 0xff or game rules are broken
} }
} }
} }

View File

@ -340,7 +340,7 @@ static WRITE8_HANDLER(casino5_bank_w)
static CUSTOM_INPUT(rndbit_r) static CUSTOM_INPUT(rndbit_r)
{ {
return mame_rand(field->port->machine); return field->port->machine->rand();
} }
static ADDRESS_MAP_START( pitboss_map, ADDRESS_SPACE_PROGRAM, 8 ) static ADDRESS_MAP_START( pitboss_map, ADDRESS_SPACE_PROGRAM, 8 )

View File

@ -312,7 +312,7 @@ static VIDEO_UPDATE( metalmx )
static READ32_HANDLER( unk_r ) static READ32_HANDLER( unk_r )
{ {
return 0;//mame_rand(space->machine); return 0;//space->machine->rand();
} }
static READ32_HANDLER( watchdog_r ) static READ32_HANDLER( watchdog_r )

View File

@ -6044,7 +6044,7 @@ static DRIVER_INIT( karatour )
state->vram_2 = RAM + (0x20000/2) * 2; state->vram_2 = RAM + (0x20000/2) * 2;
for (i = 0; i < (0x20000 * 3) / 2; i++) for (i = 0; i < (0x20000 * 3) / 2; i++)
RAM[i] = mame_rand(machine); RAM[i] = machine->rand();
DRIVER_INIT_CALL(metro); DRIVER_INIT_CALL(metro);

View File

@ -524,7 +524,7 @@ static READ16_HANDLER( dsp_HOLD_signal_r )
static READ8_HANDLER( test_r ) static READ8_HANDLER( test_r )
{ {
return mame_rand(space->machine); return space->machine->rand();
} }
//mecha driver ? //mecha driver ?

View File

@ -107,7 +107,7 @@ ADDRESS_MAP_END
static READ8_HANDLER(rng_r) static READ8_HANDLER(rng_r)
{ {
return mame_rand(space->machine); return space->machine->rand();
} }
static WRITE8_HANDLER(port_w) static WRITE8_HANDLER(port_w)

View File

@ -238,7 +238,7 @@ static READ8_HANDLER( mixport_r )
*/ */
static int mixdata; static int mixdata;
mixdata = (input_port_read(space->machine, "SW2") & 0xfd) | (mame_rand(space->machine) & 0x02); mixdata = (input_port_read(space->machine, "SW2") & 0xfd) | (space->machine->rand() & 0x02);
return mixdata; return mixdata;
} }

View File

@ -1867,7 +1867,7 @@ INPUT_PORTS_END
/* OKI M6376 (for Mating Game) FIXME */ /* OKI M6376 (for Mating Game) FIXME */
static READ16_DEVICE_HANDLER( oki_r ) static READ16_DEVICE_HANDLER( oki_r )
{ {
return mame_rand(device->machine); return device->machine->rand();
} }
static WRITE16_DEVICE_HANDLER( oki_w ) static WRITE16_DEVICE_HANDLER( oki_w )

View File

@ -410,7 +410,7 @@ static READ16_HANDLER( custom_key_r )
old_count = count; old_count = count;
do do
{ {
count = mame_rand(space->machine); count = space->machine->rand();
} while( old_count == count ); } while( old_count == count );
switch( namcona1_gametype ) switch( namcona1_gametype )
@ -482,7 +482,7 @@ static READ16_HANDLER( custom_key_r )
default: default:
return 0; return 0;
} }
return mame_rand(space->machine)&0xffff; return space->machine->rand()&0xffff;
} /* custom_key_r */ } /* custom_key_r */
static WRITE16_HANDLER( custom_key_w ) static WRITE16_HANDLER( custom_key_w )

View File

@ -666,7 +666,7 @@ static READ32_HANDLER( custom_key_r )
do do
{ /* pick a random number, but don't pick the same twice in a row */ { /* pick a random number, but don't pick the same twice in a row */
count = mame_rand(space->machine); count = space->machine->rand();
} while( count==old_count ); } while( count==old_count );
switch( namcos2_gametype ) switch( namcos2_gametype )
@ -824,7 +824,7 @@ static READ32_HANDLER( gunbulet_gun_r )
static static
READ32_HANDLER( randgen_r ) READ32_HANDLER( randgen_r )
{ {
return mame_rand(space->machine); return space->machine->rand();
} /* randgen_r */ } /* randgen_r */
static static

View File

@ -2581,7 +2581,7 @@ static WRITE8_HANDLER( s23_iob_p4_w )
static READ8_HANDLER(iob_r) static READ8_HANDLER(iob_r)
{ {
return mame_rand(space->machine); return space->machine->rand();
} }
/* H8/3334 (Namco C78) I/O board MCU */ /* H8/3334 (Namco C78) I/O board MCU */

View File

@ -21,7 +21,7 @@ static VIDEO_UPDATE( neptunp2 )
static READ8_HANDLER( test_r ) static READ8_HANDLER( test_r )
{ {
return mame_rand(space->machine); return space->machine->rand();
} }
static ADDRESS_MAP_START( neptunp2_map, ADDRESS_SPACE_PROGRAM, 8 ) static ADDRESS_MAP_START( neptunp2_map, ADDRESS_SPACE_PROGRAM, 8 )

View File

@ -139,7 +139,7 @@ static INTERRUPT_GEN( nsmpoker_interrupt )
static READ8_HANDLER( debug_r ) static READ8_HANDLER( debug_r )
{ {
return mame_rand(space->machine) & 0xff; return space->machine->rand() & 0xff;
} }

View File

@ -439,7 +439,7 @@ static WRITE8_HANDLER(cyclshtg_mcu_w)
static READ8_HANDLER(cyclshtg_mcu_status_r1) static READ8_HANDLER(cyclshtg_mcu_status_r1)
{ {
return mame_rand(space->machine); return space->machine->rand();
} }
static WRITE8_HANDLER( cyclshtg_generic_control_w ) static WRITE8_HANDLER( cyclshtg_generic_control_w )
@ -498,7 +498,7 @@ ADDRESS_MAP_END
static READ8_HANDLER( unk_r ) static READ8_HANDLER( unk_r )
{ {
return mame_rand(space->machine); return space->machine->rand();
} }
static ADDRESS_MAP_START( bronx_master_map, ADDRESS_SPACE_PROGRAM, 8 ) static ADDRESS_MAP_START( bronx_master_map, ADDRESS_SPACE_PROGRAM, 8 )

View File

@ -134,7 +134,7 @@ ADDRESS_MAP_END
static READ8_HANDLER( unk_87_r ) static READ8_HANDLER( unk_87_r )
{ {
/* n7751_status_r ? bit 7 = ack/status from device connected to port 8a? */ /* n7751_status_r ? bit 7 = ack/status from device connected to port 8a? */
return mame_rand(space->machine); return space->machine->rand();
} }
static WRITE8_HANDLER( unk_8a_w ) static WRITE8_HANDLER( unk_8a_w )
@ -158,7 +158,7 @@ static WRITE8_HANDLER( unk_8c_w )
static READ8_HANDLER( unk_8c_r ) static READ8_HANDLER( unk_8c_r )
{ {
return mame_rand(space->machine); return space->machine->rand();
} }
static READ8_HANDLER( sound_ack_r ) static READ8_HANDLER( sound_ack_r )

View File

@ -28,7 +28,7 @@ static READ16_HANDLER( pip )
static READ16_HANDLER( pap ) static READ16_HANDLER( pap )
{ {
return mame_rand(space->machine); return space->machine->rand();
} }

View File

@ -540,7 +540,7 @@ static READ8_HANDLER( alibaba_mystery_1_r )
{ {
/* The return value determines what the mystery item is. Each bit corresponds /* The return value determines what the mystery item is. Each bit corresponds
to a question mark */ to a question mark */
return mame_rand(space->machine) & 0x0f; return space->machine->rand() & 0x0f;
} }

View File

@ -215,7 +215,7 @@ INPUT_PORTS_END
// stops the game hanging.. // stops the game hanging..
static CUSTOM_INPUT( nb1413m3_hackbusyflag_r ) static CUSTOM_INPUT( nb1413m3_hackbusyflag_r )
{ {
return mame_rand(field->port->machine) & 3; return field->port->machine->rand() & 3;
} }
static INPUT_PORTS_START( threeds ) static INPUT_PORTS_START( threeds )

View File

@ -313,7 +313,7 @@ ADDRESS_MAP_END
static READ32_HANDLER( kludge_r ) static READ32_HANDLER( kludge_r )
{ {
return mame_rand(space->machine); return space->machine->rand();
} }
/* 3c8-3c9 -> ramdac*/ /* 3c8-3c9 -> ramdac*/

View File

@ -297,7 +297,7 @@ ADDRESS_MAP_END
static READ32_HANDLER( kludge_r ) static READ32_HANDLER( kludge_r )
{ {
return mame_rand(space->machine); return space->machine->rand();
} }
/* 3c8-3c9 -> ramdac*/ /* 3c8-3c9 -> ramdac*/

View File

@ -302,7 +302,7 @@ static VIDEO_UPDATE( pinkiri8 )
if (bit) if (bit)
{ {
//col = mame_rand(screen->machine); //col = screen->machine->rand();
width = 2; width = 2;
} }
else else

View File

@ -259,7 +259,7 @@ static WRITE16_HANDLER( pntnpuzl_palette_w )
#ifdef UNUSED_FUNCTION #ifdef UNUSED_FUNCTION
READ16_HANDLER ( pntnpuzl_random_r ) READ16_HANDLER ( pntnpuzl_random_r )
{ {
return mame_rand(space->machine); return space->machine->rand();
} }
#endif #endif

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