summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2010-12-31 22:59:44 +0000
committer Aaron Giles <aaron@aarongiles.com>2010-12-31 22:59:44 +0000
commit996e1c365c6b15adc1870027c2ba3ecaaf82cb36 (patch)
treec6213441d166de5e07df10149dbae6e7aad73636
parent3b41606ca0c02056604a55a7b1f5165e80bc11fb (diff)
mame_rand() -> machine->rand()
-rw-r--r--src/emu/cpu/drcuml.c16
-rw-r--r--src/emu/cpu/powerpc/ppccom.c2
-rw-r--r--src/emu/cpu/rsp/rsp.c2
-rw-r--r--src/emu/emucore.h4
-rw-r--r--src/emu/inptport.c2
-rw-r--r--src/emu/machine.h5
-rw-r--r--src/emu/machine/nvram.c2
-rw-r--r--src/emu/romload.c2
-rw-r--r--src/emu/sound/aicalfo.c2
-rw-r--r--src/emu/sound/c6280.c4
-rw-r--r--src/emu/sound/disc_wav.c2
-rw-r--r--src/emu/sound/scsplfo.c2
-rw-r--r--src/emu/sound/vlm5030.c4
-rw-r--r--src/emu/video/hd63484.c2
-rw-r--r--src/emu/video/v9938.c2
-rw-r--r--src/emu/video/vector.c2
-rw-r--r--src/mame/audio/cinemat.c4
-rw-r--r--src/mame/audio/jaguar.c4
-rw-r--r--src/mame/audio/taito_en.c2
-rw-r--r--src/mame/drivers/39in1.c24
-rw-r--r--src/mame/drivers/8080bw.c2
-rw-r--r--src/mame/drivers/86lions.c14
-rw-r--r--src/mame/drivers/ace.c2
-rw-r--r--src/mame/drivers/adp.c6
-rw-r--r--src/mame/drivers/airbustr.c2
-rw-r--r--src/mame/drivers/artmagic.c6
-rw-r--r--src/mame/drivers/astrof.c2
-rw-r--r--src/mame/drivers/atarigx2.c2
-rw-r--r--src/mame/drivers/backfire.c6
-rw-r--r--src/mame/drivers/bigfghtr.c4
-rw-r--r--src/mame/drivers/bingor.c4
-rw-r--r--src/mame/drivers/bishjan.c4
-rw-r--r--src/mame/drivers/blackt96.c4
-rw-r--r--src/mame/drivers/blitz68k.c24
-rw-r--r--src/mame/drivers/blmbycar.c2
-rw-r--r--src/mame/drivers/bmcbowl.c4
-rw-r--r--src/mame/drivers/carrera.c2
-rw-r--r--src/mame/drivers/caswin.c2
-rw-r--r--src/mame/drivers/centiped.c2
-rw-r--r--src/mame/drivers/chinsan.c4
-rw-r--r--src/mame/drivers/cmmb.c2
-rw-r--r--src/mame/drivers/coinmvga.c2
-rw-r--r--src/mame/drivers/coolridr.c2
-rw-r--r--src/mame/drivers/cps3.c2
-rw-r--r--src/mame/drivers/csplayh5.c2
-rw-r--r--src/mame/drivers/dblewing.c2
-rw-r--r--src/mame/drivers/ddealer.c8
-rw-r--r--src/mame/drivers/ddenlovr.c10
-rw-r--r--src/mame/drivers/ddribble.c2
-rw-r--r--src/mame/drivers/deco32.c6
-rw-r--r--src/mame/drivers/deco_ld.c2
-rw-r--r--src/mame/drivers/deco_mlc.c4
-rw-r--r--src/mame/drivers/discoboy.c4
-rw-r--r--src/mame/drivers/dwarfd.c10
-rw-r--r--src/mame/drivers/eolith.c2
-rw-r--r--src/mame/drivers/fitfight.c6
-rw-r--r--src/mame/drivers/galaxian.c2
-rw-r--r--src/mame/drivers/galivan.c2
-rw-r--r--src/mame/drivers/galpani3.c8
-rw-r--r--src/mame/drivers/galpanic.c6
-rw-r--r--src/mame/drivers/gladiatr.c6
-rw-r--r--src/mame/drivers/goldngam.c2
-rw-r--r--src/mame/drivers/hitpoker.c2
-rw-r--r--src/mame/drivers/hng64.c8
-rw-r--r--src/mame/drivers/intrscti.c2
-rw-r--r--src/mame/drivers/itech32.c2
-rw-r--r--src/mame/drivers/jalmah.c6
-rw-r--r--src/mame/drivers/jangou.c2
-rw-r--r--src/mame/drivers/jokrwild.c2
-rw-r--r--src/mame/drivers/jubilee.c2
-rw-r--r--src/mame/drivers/kaneko16.c2
-rw-r--r--src/mame/drivers/koftball.c4
-rw-r--r--src/mame/drivers/kopunch.c4
-rw-r--r--src/mame/drivers/lastfght.c2
-rw-r--r--src/mame/drivers/looping.c2
-rw-r--r--src/mame/drivers/m14.c2
-rw-r--r--src/mame/drivers/m72.c2
-rw-r--r--src/mame/drivers/magicard.c6
-rw-r--r--src/mame/drivers/megadriv.c34
-rw-r--r--src/mame/drivers/merit.c2
-rw-r--r--src/mame/drivers/metalmx.c2
-rw-r--r--src/mame/drivers/metro.c2
-rw-r--r--src/mame/drivers/mlanding.c2
-rw-r--r--src/mame/drivers/monzagp.c2
-rw-r--r--src/mame/drivers/mpoker.c2
-rw-r--r--src/mame/drivers/mpu4drvr.c2
-rw-r--r--src/mame/drivers/namcona1.c4
-rw-r--r--src/mame/drivers/namconb1.c4
-rw-r--r--src/mame/drivers/namcos23.c2
-rw-r--r--src/mame/drivers/neptunp2.c2
-rw-r--r--src/mame/drivers/nsmpoker.c2
-rw-r--r--src/mame/drivers/nycaptor.c4
-rw-r--r--src/mame/drivers/othello.c4
-rw-r--r--src/mame/drivers/othldrby.c2
-rw-r--r--src/mame/drivers/pacman.c2
-rw-r--r--src/mame/drivers/pastelg.c2
-rw-r--r--src/mame/drivers/pcat_dyn.c2
-rw-r--r--src/mame/drivers/photoply.c2
-rw-r--r--src/mame/drivers/pinkiri8.c2
-rw-r--r--src/mame/drivers/pntnpuzl.c2
-rw-r--r--src/mame/drivers/polyplay.c2
-rw-r--r--src/mame/drivers/poo.c4
-rw-r--r--src/mame/drivers/r2dx_v33.c2
-rw-r--r--src/mame/drivers/rabbit.c2
-rw-r--r--src/mame/drivers/rbmk.c2
-rw-r--r--src/mame/drivers/redalert.c2
-rw-r--r--src/mame/drivers/roul.c2
-rw-r--r--src/mame/drivers/sderby.c2
-rw-r--r--src/mame/drivers/segas32.c4
-rw-r--r--src/mame/drivers/seta.c16
-rw-r--r--src/mame/drivers/seta2.c4
-rw-r--r--src/mame/drivers/sfbonus.c8
-rw-r--r--src/mame/drivers/spcforce.c2
-rw-r--r--src/mame/drivers/ssfindo.c12
-rw-r--r--src/mame/drivers/ssv.c2
-rw-r--r--src/mame/drivers/stactics.c2
-rw-r--r--src/mame/drivers/stepstag.c8
-rw-r--r--src/mame/drivers/strnskil.c4
-rw-r--r--src/mame/drivers/stv.c2
-rw-r--r--src/mame/drivers/supdrapo.c2
-rw-r--r--src/mame/drivers/superqix.c2
-rw-r--r--src/mame/drivers/suprnova.c2
-rw-r--r--src/mame/drivers/taito_z.c2
-rw-r--r--src/mame/drivers/taitojc.c2
-rw-r--r--src/mame/drivers/tetrisp2.c4
-rw-r--r--src/mame/drivers/timetrv.c6
-rw-r--r--src/mame/drivers/tmaster.c2
-rw-r--r--src/mame/drivers/tmmjprd.c2
-rw-r--r--src/mame/drivers/tmnt.c2
-rw-r--r--src/mame/drivers/topspeed.c2
-rw-r--r--src/mame/drivers/ttchamp.c4
-rw-r--r--src/mame/drivers/tumbleb.c2
-rw-r--r--src/mame/drivers/wheelfir.c2
-rw-r--r--src/mame/machine/ajax.c2
-rw-r--r--src/mame/machine/bublbobl.c4
-rw-r--r--src/mame/machine/kaneko16.c6
-rw-r--r--src/mame/machine/konamigx.c2
-rw-r--r--src/mame/machine/midtunit.c2
-rw-r--r--src/mame/machine/midwayic.c4
-rw-r--r--src/mame/machine/midyunit.c2
-rw-r--r--src/mame/machine/model1.c4
-rw-r--r--src/mame/machine/namcos1.c2
-rw-r--r--src/mame/machine/namcos2.c4
-rw-r--r--src/mame/machine/rainbow.c2
-rw-r--r--src/mame/machine/seicop.c2
-rw-r--r--src/mame/machine/slapfght.c2
-rw-r--r--src/mame/machine/starwars.c2
-rw-r--r--src/mame/machine/tait8741.c4
-rw-r--r--src/mame/video/40love.c4
-rw-r--r--src/mame/video/atarirle.c8
-rw-r--r--src/mame/video/avgdvg.c2
-rw-r--r--src/mame/video/crshrace.c2
-rw-r--r--src/mame/video/darkmist.c2
-rw-r--r--src/mame/video/dkong.c2
-rw-r--r--src/mame/video/dynduke.c2
-rw-r--r--src/mame/video/f1gp.c4
-rw-r--r--src/mame/video/galpani2.c2
-rw-r--r--src/mame/video/konicdev.c4
-rw-r--r--src/mame/video/macrossp.c8
-rw-r--r--src/mame/video/ms32.c6
-rw-r--r--src/mame/video/n64.c20
-rw-r--r--src/mame/video/rdpblend.c2
-rw-r--r--src/mame/video/sbugger.c6
-rw-r--r--src/mame/video/seta2.c2
-rw-r--r--src/mame/video/st0016.c2
-rw-r--r--src/mame/video/stvvdp1.c4
166 files changed, 324 insertions, 333 deletions
diff --git a/src/emu/cpu/drcuml.c b/src/emu/cpu/drcuml.c
index 8f1e7f2b5fd..c558728827c 100644
--- a/src/emu/cpu/drcuml.c
+++ b/src/emu/cpu/drcuml.c
@@ -2252,27 +2252,27 @@ static void bevalidate_initialize_random_state(drcuml_state *drcuml, drcuml_bloc
int regnum;
/* initialize core state to random values */
- state->fmod = mame_rand(machine) & 0x03;
- state->flags = mame_rand(machine) & 0x1f;
- state->exp = mame_rand(machine);
+ state->fmod = machine->rand() & 0x03;
+ state->flags = machine->rand() & 0x1f;
+ state->exp = machine->rand();
/* initialize integer registers to random values */
for (regnum = 0; regnum < ARRAY_LENGTH(state->r); regnum++)
{
- state->r[regnum].w.h = mame_rand(machine);
- state->r[regnum].w.l = mame_rand(machine);
+ state->r[regnum].w.h = machine->rand();
+ state->r[regnum].w.l = machine->rand();
}
/* initialize float registers to random values */
for (regnum = 0; regnum < ARRAY_LENGTH(state->f); regnum++)
{
- *(UINT32 *)&state->f[regnum].s.h = mame_rand(machine);
- *(UINT32 *)&state->f[regnum].s.l = mame_rand(machine);
+ *(UINT32 *)&state->f[regnum].s.h = machine->rand();
+ *(UINT32 *)&state->f[regnum].s.l = machine->rand();
}
/* initialize map variables to random values */
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());
}
diff --git a/src/emu/cpu/powerpc/ppccom.c b/src/emu/cpu/powerpc/ppccom.c
index e336c24534f..39e532aef92 100644
--- a/src/emu/cpu/powerpc/ppccom.c
+++ b/src/emu/cpu/powerpc/ppccom.c
@@ -676,7 +676,7 @@ void ppccom_execute_tlbl(powerpc_state *ppc)
int entrynum;
/* 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 */
flags = VTLB_FLAG_VALID | VTLB_READ_ALLOWED | VTLB_FETCH_ALLOWED;
diff --git a/src/emu/cpu/rsp/rsp.c b/src/emu/cpu/rsp/rsp.c
index 8a8998b4b5e..47978d74cb7 100644
--- a/src/emu/cpu/rsp/rsp.c
+++ b/src/emu/cpu/rsp/rsp.c
@@ -303,7 +303,7 @@ static CPU_INIT( rsp )
#endif
// ...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.
for(accumIdx = 0; accumIdx < 8; accumIdx++ )
{
diff --git a/src/emu/emucore.h b/src/emu/emucore.h
index 0fba8172b22..3910c4a2fac 100644
--- a/src/emu/emucore.h
+++ b/src/emu/emucore.h
@@ -218,10 +218,6 @@ inline void operator--(_Type &value, int) { value = (_Type)((int)value - 1); }
#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
#define RADIAN_TO_DEGREE(x) ((180.0 / M_PI) * (x))
#define DEGREE_TO_RADIAN(x) ((M_PI / 180.0) * (x))
diff --git a/src/emu/inptport.c b/src/emu/inptport.c
index 260c2412fd3..695d5f332a8 100644
--- a/src/emu/inptport.c
+++ b/src/emu/inptport.c
@@ -2624,7 +2624,7 @@ static void frame_update_digital_joysticks(running_machine *machine)
if ((joystick->current4way & (JOYDIR_UP_BIT | JOYDIR_DOWN_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);
else
joystick->current4way &= ~(JOYDIR_UP_BIT | JOYDIR_DOWN_BIT);
diff --git a/src/emu/machine.h b/src/emu/machine.h
index 39ca122c5f7..84add63ca81 100644
--- a/src/emu/machine.h
+++ b/src/emu/machine.h
@@ -668,11 +668,6 @@ inline const region_info *running_machine::region(const char *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)
{
const region_info *region = machine->region(name);
diff --git a/src/emu/machine/nvram.c b/src/emu/machine/nvram.c
index 8f4472b0074..be30ff82002 100644
--- a/src/emu/machine/nvram.c
+++ b/src/emu/machine/nvram.c
@@ -179,7 +179,7 @@ void nvram_device::nvram_default()
{
UINT8 *nvram = reinterpret_cast<UINT8 *>(m_base);
for (int index = 0; index < m_length; index++)
- nvram[index] = mame_rand(&m_machine);
+ nvram[index] = m_machine.rand();
break;
}
diff --git a/src/emu/romload.c b/src/emu/romload.c
index ca1737caaac..f6c40756275 100644
--- a/src/emu/romload.c
+++ b/src/emu/romload.c
@@ -375,7 +375,7 @@ static void count_roms(rom_load_data *romdata)
static void fill_random(running_machine *machine, UINT8 *base, UINT32 length)
{
while (length--)
- *base++ = mame_rand(machine);
+ *base++ = machine->rand();
}
diff --git a/src/emu/sound/aicalfo.c b/src/emu/sound/aicalfo.c
index a2ca1fedeb6..d6b6436f9cd 100644
--- a/src/emu/sound/aicalfo.c
+++ b/src/emu/sound/aicalfo.c
@@ -82,7 +82,7 @@ static void AICALFO_Init(running_machine *machine)
//noise
//a=lfo_noise[i];
- a=mame_rand(machine)&0xff;
+ a=machine->rand()&0xff;
p=128-a;
ALFO_NOI[i]=a;
PLFO_NOI[i]=p;
diff --git a/src/emu/sound/c6280.c b/src/emu/sound/c6280.c
index f461e5b17f8..519264f6cf2 100644
--- a/src/emu/sound/c6280.c
+++ b/src/emu/sound/c6280.c
@@ -26,7 +26,7 @@
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
- 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.
For some background on Hudson Soft's C62 chipset:
@@ -278,7 +278,7 @@ static STREAM_UPDATE( c6280_update )
p->channel[ch].noise_counter += step;
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;
outputs[0][i] += (INT16)(vll * (data - 16));
diff --git a/src/emu/sound/disc_wav.c b/src/emu/sound/disc_wav.c
index 327501bc21b..7d4a9f63f39 100644
--- a/src/emu/sound/disc_wav.c
+++ b/src/emu/sound/disc_wav.c
@@ -586,7 +586,7 @@ DISCRETE_STEP(dss_noise)
if(context->phase > (2.0 * M_PI))
{
/* 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 */
node->output[0] = DSS_NOISE__AMP / 2;
diff --git a/src/emu/sound/scsplfo.c b/src/emu/sound/scsplfo.c
index cd7ef51631d..2609a612524 100644
--- a/src/emu/sound/scsplfo.c
+++ b/src/emu/sound/scsplfo.c
@@ -86,7 +86,7 @@ static void LFO_Init(running_machine *machine)
//noise
//a=lfo_noise[i];
- a=mame_rand(machine)&0xff;
+ a=machine->rand()&0xff;
p=128-a;
ALFO_NOI[i]=a;
PLFO_NOI[i]=p;
diff --git a/src/emu/sound/vlm5030.c b/src/emu/sound/vlm5030.c
index 8da977a9359..03fe3965788 100644
--- a/src/emu/sound/vlm5030.c
+++ b/src/emu/sound/vlm5030.c
@@ -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.
todo:
- Noise Generator circuit without 'mame_rand()' function.
+ Noise Generator circuit without 'machine->rand()' function.
----------- command format (Analytical result) ----------
@@ -411,7 +411,7 @@ static STREAM_UPDATE( vlm5030_update_callback )
}
else if (chip->old_pitch <= 1)
{ /* 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
{
diff --git a/src/emu/video/hd63484.c b/src/emu/video/hd63484.c
index 31e024e8114..3eb13b8e462 100644
--- a/src/emu/video/hd63484.c
+++ b/src/emu/video/hd63484.c
@@ -1470,7 +1470,7 @@ READ16_DEVICE_HANDLER( hd63484_status_r )
// if (cpu_get_pc(space->cpu) != 0xfced6 && cpu_get_pc(space->cpu) != 0xfe1d6)
// 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 )
diff --git a/src/emu/video/v9938.c b/src/emu/video/v9938.c
index 9ad0a6b7615..2a0a639b681 100644
--- a/src/emu/video/v9938.c
+++ b/src/emu/video/v9938.c
@@ -790,7 +790,7 @@ static UINT8 v9938_status_r(running_machine *machine)
if ( (n < 28) || (n > 199) ) 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;
ret = vdp->statReg[2];
break;
diff --git a/src/emu/video/vector.c b/src/emu/video/vector.c
index f636cb00717..c3d8bdda79a 100644
--- a/src/emu/video/vector.c
+++ b/src/emu/video/vector.c
@@ -200,7 +200,7 @@ void vector_add_point (running_machine *machine, int x, int y, rgb_t color, int
if (flicker && (intensity > 0))
{
- intensity += (intensity * (0x80-(mame_rand(machine)&0xff)) * flicker)>>16;
+ intensity += (intensity * (0x80-(machine->rand()&0xff)) * flicker)>>16;
if (intensity < 0)
intensity = 0;
if (intensity > 0xff)
diff --git a/src/mame/audio/cinemat.c b/src/mame/audio/cinemat.c
index 31927dd04e0..110fd4309c6 100644
--- a/src/mame/audio/cinemat.c
+++ b/src/mame/audio/cinemat.c
@@ -169,11 +169,11 @@ static void spacewar_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bi
/* Explosion - rising edge */
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 */
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 */
if (SOUNDVAL_FALLING_EDGE(0x04))
diff --git a/src/mame/audio/jaguar.c b/src/mame/audio/jaguar.c
index ba63bdc99a2..3c37a2d6e37 100644
--- a/src/mame/audio/jaguar.c
+++ b/src/mame/audio/jaguar.c
@@ -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));
/* 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 */
jaguar_wave_rom[0x300 + i] = (i == 0x40) ? 32767 : 0;
/* F1DE00 = white noise */
- jaguar_wave_rom[0x380 + i] = mame_rand(machine) % 32768;
+ jaguar_wave_rom[0x380 + i] = machine->rand() % 32768;
}
#if ENABLE_SPEEDUP_HACKS
diff --git a/src/mame/audio/taito_en.c b/src/mame/audio/taito_en.c
index 5865615734e..83d58519cc1 100644
--- a/src/mame/audio/taito_en.c
+++ b/src/mame/audio/taito_en.c
@@ -179,7 +179,7 @@ static READ16_HANDLER(es5510_dsp_r)
*/
// 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;
diff --git a/src/mame/drivers/39in1.c b/src/mame/drivers/39in1.c
index 40505c07c28..3968688a22f 100644
--- a/src/mame/drivers/39in1.c
+++ b/src/mame/drivers/39in1.c
@@ -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 );
return gpio_regs->gpdr2;
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 );
- return mame_rand(space->machine);
+ verboselog( space->machine, 3, "pxa255_gpio_r: (Invalid Read) GPIO Pin Output Set Register 0: %08x & %08x\n", space->machine->rand(), mem_mask );
+ return space->machine->rand();
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 );
- return mame_rand(space->machine);
+ verboselog( space->machine, 3, "pxa255_gpio_r: (Invalid Read) GPIO Pin Output Set Register 1: %08x & %08x\n", space->machine->rand(), mem_mask );
+ return space->machine->rand();
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 );
- return mame_rand(space->machine);
+ verboselog( space->machine, 3, "pxa255_gpio_r: (Invalid Read) GPIO Pin Output Set Register 2: %08x & %08x\n", space->machine->rand(), mem_mask );
+ return space->machine->rand();
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 );
- return mame_rand(space->machine);
+ verboselog( space->machine, 3, "pxa255_gpio_r: (Invalid Read) GPIO Pin Output Clear Register 0: %08x & %08x\n", space->machine->rand(), mem_mask );
+ return space->machine->rand();
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 );
- return mame_rand(space->machine);
+ verboselog( space->machine, 3, "pxa255_gpio_r: (Invalid Read) GPIO Pin Output Clear Register 1: %08x & %08x\n", space->machine->rand(), mem_mask );
+ return space->machine->rand();
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 );
- return mame_rand(space->machine);
+ verboselog( space->machine, 3, "pxa255_gpio_r: (Invalid Read) GPIO Pin Output Clear Register 2: %08x & %08x\n", space->machine->rand(), mem_mask );
+ return space->machine->rand();
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 );
return gpio_regs->grer0;
diff --git a/src/mame/drivers/8080bw.c b/src/mame/drivers/8080bw.c
index 3ac8711580d..26af6906191 100644
--- a/src/mame/drivers/8080bw.c
+++ b/src/mame/drivers/8080bw.c
@@ -1736,7 +1736,7 @@ static READ8_HANDLER(indianbt_r)
case 0x5ffc: return 0;
}
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 )
diff --git a/src/mame/drivers/86lions.c b/src/mame/drivers/86lions.c
index 51f8c86ab27..f4489891f35 100644
--- a/src/mame/drivers/86lions.c
+++ b/src/mame/drivers/86lions.c
@@ -70,7 +70,7 @@ static VIDEO_UPDATE(lions)
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 )
//{
//return input_port_read(machine, "IN0");
-// return mame_rand(device->machine);
+// return device->machine->rand();
//return 0xff;
//}
//static READ8_DEVICE_HANDLER( input_b )
//{
//return input_port_read(machine, "IN1");
-// return mame_rand(device->machine);
+// return device->machine->rand();
//return 0xff;
//}
static READ8_DEVICE_HANDLER( input_ca1 )
{
-// return mame_rand(device->machine);
+// return device->machine->rand();
return 0x00;
}
static READ8_DEVICE_HANDLER( input_cb1 )
{
-// return mame_rand(device->machine);
+// return device->machine->rand();
return 0x00;
}
static READ8_DEVICE_HANDLER( input_ca2 )
{
-// return mame_rand(device->machine);
+// return device->machine->rand();
return 0x00;
}
static READ8_DEVICE_HANDLER( input_cb2 )
{
-// return mame_rand(device->machine);
+// return device->machine->rand();
return 0x00;
}
diff --git a/src/mame/drivers/ace.c b/src/mame/drivers/ace.c
index 78743edd2fc..7bd1dea183f 100644
--- a/src/mame/drivers/ace.c
+++ b/src/mame/drivers/ace.c
@@ -154,7 +154,7 @@ static WRITE8_HANDLER( ace_scoreram_w )
static READ8_HANDLER( unk_r )
{
- return mame_rand(space->machine) & 0xff;
+ return space->machine->rand() & 0xff;
}
diff --git a/src/mame/drivers/adp.c b/src/mame/drivers/adp.c
index ce4168d2472..053663bc851 100644
--- a/src/mame/drivers/adp.c
+++ b/src/mame/drivers/adp.c
@@ -393,17 +393,17 @@ static READ16_HANDLER( test_r )
state->mux_data++;
state->mux_data &= 0xf;
/*
- switch (mame_rand(space->machine) & 3)
+ switch (space->machine->rand() & 3)
{
case 0:
return 0;
case 1:
return 0xffff;
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);
}
/*???*/
diff --git a/src/mame/drivers/airbustr.c b/src/mame/drivers/airbustr.c
index 3b0f4428c75..1253815de9d 100644
--- a/src/mame/drivers/airbustr.c
+++ b/src/mame/drivers/airbustr.c
@@ -254,7 +254,7 @@ static READ8_HANDLER( devram_r )
/* Reading eff4, F0 times must yield at most 80-1 consecutive
equal values */
case 0xff4:
- return mame_rand(space->machine);
+ return space->machine->rand();
default:
return state->devram[offset];
diff --git a/src/mame/drivers/artmagic.c b/src/mame/drivers/artmagic.c
index d23768ec7cc..7a46e15b809 100644
--- a/src/mame/drivers/artmagic.c
+++ b/src/mame/drivers/artmagic.c
@@ -181,7 +181,7 @@ static void ultennis_protection(running_machine *machine)
{
case 0x00: /* reset */
prot_input_index = prot_output_index = 0;
- prot_output[0] = mame_rand(machine);
+ prot_output[0] = machine->rand();
break;
case 0x01: /* 01 aaaa bbbb cccc dddd (xxxx) */
@@ -271,7 +271,7 @@ static void cheesech_protection(running_machine *machine)
{
case 0x00: /* reset */
prot_input_index = prot_output_index = 0;
- prot_output[0] = mame_rand(machine);
+ prot_output[0] = machine->rand();
break;
case 0x01: /* 01 aaaa bbbb (xxxx) */
@@ -465,7 +465,7 @@ ADDRESS_MAP_END
static READ16_HANDLER(unk_r)
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
static ADDRESS_MAP_START( shtstar_map, ADDRESS_SPACE_PROGRAM, 16 )
diff --git a/src/mame/drivers/astrof.c b/src/mame/drivers/astrof.c
index 08f200ae670..7cdccd7ff5c 100644
--- a/src/mame/drivers/astrof.c
+++ b/src/mame/drivers/astrof.c
@@ -455,7 +455,7 @@ static VIDEO_UPDATE( tomahawk )
static READ8_HANDLER( shoot_r )
{
/* not really sure about this */
- return mame_rand(space->machine) & 8;
+ return space->machine->rand() & 8;
}
diff --git a/src/mame/drivers/atarigx2.c b/src/mame/drivers/atarigx2.c
index 6c4822f528a..faaf3c29daf 100644
--- a/src/mame/drivers/atarigx2.c
+++ b/src/mame/drivers/atarigx2.c
@@ -1126,7 +1126,7 @@ static READ32_HANDLER( atarigx2_protection_r )
if (lookup_table[i][0] == 0xffffffff)
{
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
result = 0xffff << 16;
logerror("%06X:Unhandled protection R@%04X = %04X\n", cpu_get_previouspc(space->cpu), offset, result);
diff --git a/src/mame/drivers/backfire.c b/src/mame/drivers/backfire.c
index e9b011c0372..1751f20f145 100644
--- a/src/mame/drivers/backfire.c
+++ b/src/mame/drivers/backfire.c
@@ -215,7 +215,7 @@ static VIDEO_UPDATE( backfire )
static READ32_DEVICE_HANDLER( backfire_eeprom_r )
{
/* 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")
| ((input_port_read(device->machine, "IN2") & 0xbf) << 16)
| ((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 )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
READ32_HANDLER( backfire_wheel2_r )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
#endif
diff --git a/src/mame/drivers/bigfghtr.c b/src/mame/drivers/bigfghtr.c
index 854f60c479a..7f2f852e4a4 100644
--- a/src/mame/drivers/bigfghtr.c
+++ b/src/mame/drivers/bigfghtr.c
@@ -354,7 +354,7 @@ static READ16_HANDLER(sharedram_r)
if(state->read_latch)
{
state->read_latch = 0;
- return mame_rand(space->machine); // TODO
+ return space->machine->rand(); // TODO
}
break;
@@ -380,7 +380,7 @@ static READ16_HANDLER(sharedram_r)
if(state->read_latch)
{
state->read_latch = 0;
- return mame_rand(space->machine); // TODO
+ return space->machine->rand(); // TODO
}
break;
case 0x642/2:
diff --git a/src/mame/drivers/bingor.c b/src/mame/drivers/bingor.c
index 50a07c82c37..fb1fd7adc28 100644
--- a/src/mame/drivers/bingor.c
+++ b/src/mame/drivers/bingor.c
@@ -493,7 +493,7 @@ static VIDEO_UPDATE(bingor)
#if 0
static READ16_HANDLER( test_r )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
#endif
@@ -514,7 +514,7 @@ ADDRESS_MAP_END
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 )
diff --git a/src/mame/drivers/bishjan.c b/src/mame/drivers/bishjan.c
index 8b761577ae7..5e3f994b2cb 100644
--- a/src/mame/drivers/bishjan.c
+++ b/src/mame/drivers/bishjan.c
@@ -325,9 +325,9 @@ static WRITE16_HANDLER( bishjan_sel_w )
static READ16_HANDLER( bishjan_serial_r )
{
return
- (mame_rand(space->machine) & 0x9800) | // bit 7 - serial communication
+ (space->machine->rand() & 0x9800) | // bit 7 - serial communication
(((bishjan_sel==0x12) ? 0x40:0x00) << 8) |
-// (mame_rand() & 0xff);
+// (machine->rand() & 0xff);
// (((space->machine->primary_screen->frame_number()%60)==0)?0x18:0x00);
0x18;
}
diff --git a/src/mame/drivers/blackt96.c b/src/mame/drivers/blackt96.c
index 0c5d12377c1..2d55f3e6f82 100644
--- a/src/mame/drivers/blackt96.c
+++ b/src/mame/drivers/blackt96.c
@@ -444,7 +444,7 @@ static WRITE8_HANDLER( blackt96_soundio_port00_w )
static READ8_HANDLER( blackt96_soundio_port01_r )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
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 )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
static WRITE8_HANDLER( blackt96_soundio_port02_w )
diff --git a/src/mame/drivers/blitz68k.c b/src/mame/drivers/blitz68k.c
index e0f4737df11..6161094f17d 100644
--- a/src/mame/drivers/blitz68k.c
+++ b/src/mame/drivers/blitz68k.c
@@ -564,7 +564,7 @@ static WRITE16_HANDLER( lamps_w )
static READ16_HANDLER( test_r )
{
- return 0xffff;//mame_rand(space->machine);
+ return 0xffff;//space->machine->rand();
}
#if 0
@@ -644,13 +644,13 @@ ADDRESS_MAP_END
// MCU simulation (to be done)
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);
return ret;
}
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);
return ret;
}
@@ -727,13 +727,13 @@ ADDRESS_MAP_END
// MCU simulation (to be done)
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);
return ret;
}
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);
return ret;
}
@@ -883,7 +883,7 @@ static WRITE16_DEVICE_HANDLER( crtc_lpen_w )
// MCU simulation (to be done)
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);
return ret << 8;
}
@@ -934,7 +934,7 @@ ADDRESS_MAP_END
// MCU simulation (to be done)
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);
return ret << 8;
}
@@ -1030,13 +1030,13 @@ ADDRESS_MAP_END
// MCU simulation (to be done)
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);
return ret;
}
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);
return ret;
}
@@ -1118,7 +1118,7 @@ ADDRESS_MAP_END
// MCU simulation (to be done)
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);
return ret << 8;
}
@@ -1197,13 +1197,13 @@ ADDRESS_MAP_END
// MCU simulation (to be done)
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);
return ret;
}
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);
return ret;
}
diff --git a/src/mame/drivers/blmbycar.c b/src/mame/drivers/blmbycar.c
index 20fae8e685c..a4bad589b0e 100644
--- a/src/mame/drivers/blmbycar.c
+++ b/src/mame/drivers/blmbycar.c
@@ -81,7 +81,7 @@ static WRITE16_HANDLER( blmbycar_pot_wheel_shift_w )
static READ16_HANDLER( blmbycar_pot_wheel_r )
{
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);
}
diff --git a/src/mame/drivers/bmcbowl.c b/src/mame/drivers/bmcbowl.c
index 86f855f4a1c..0ce02ca6887 100644
--- a/src/mame/drivers/bmcbowl.c
+++ b/src/mame/drivers/bmcbowl.c
@@ -173,7 +173,7 @@ static VIDEO_UPDATE( bmcbowl )
static READ16_HANDLER( bmc_random_read )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
static READ16_HANDLER( bmc_protection_r )
@@ -190,7 +190,7 @@ static READ16_HANDLER( bmc_protection_r )
break;
}
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 )
diff --git a/src/mame/drivers/carrera.c b/src/mame/drivers/carrera.c
index 0ee58cf8e2e..950776263e6 100644
--- a/src/mame/drivers/carrera.c
+++ b/src/mame/drivers/carrera.c
@@ -258,7 +258,7 @@ static VIDEO_UPDATE(carrera)
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 */
diff --git a/src/mame/drivers/caswin.c b/src/mame/drivers/caswin.c
index 771c95c5f68..3254c15b161 100644
--- a/src/mame/drivers/caswin.c
+++ b/src/mame/drivers/caswin.c
@@ -105,7 +105,7 @@ static WRITE8_HANDLER( vvillage_vregs_w )
static READ8_HANDLER( vvillage_rng_r )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
static WRITE8_HANDLER( vvillage_output_w )
diff --git a/src/mame/drivers/centiped.c b/src/mame/drivers/centiped.c
index 830dc250050..1d8d361415b 100644
--- a/src/mame/drivers/centiped.c
+++ b/src/mame/drivers/centiped.c
@@ -634,7 +634,7 @@ static WRITE8_HANDLER( led_w )
static READ8_DEVICE_HANDLER( caterplr_rand_r )
{
- return mame_rand(device->machine) % 0xff;
+ return device->machine->rand() % 0xff;
}
diff --git a/src/mame/drivers/chinsan.c b/src/mame/drivers/chinsan.c
index e5fd435590b..9cc890ee242 100644
--- a/src/mame/drivers/chinsan.c
+++ b/src/mame/drivers/chinsan.c
@@ -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);
- return mame_rand(space->machine);
+ return space->machine->rand();
}
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);
- return mame_rand(space->machine);
+ return space->machine->rand();
}
static WRITE8_DEVICE_HANDLER( chin_adpcm_w )
diff --git a/src/mame/drivers/cmmb.c b/src/mame/drivers/cmmb.c
index e7efa89fbfb..bea2cd79942 100644
--- a/src/mame/drivers/cmmb.c
+++ b/src/mame/drivers/cmmb.c
@@ -148,7 +148,7 @@ static WRITE8_HANDLER( cmmb_output_w )
static READ8_HANDLER( kludge_r )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
/* overlap empty addresses */
diff --git a/src/mame/drivers/coinmvga.c b/src/mame/drivers/coinmvga.c
index 15fb3520078..586100b425e 100644
--- a/src/mame/drivers/coinmvga.c
+++ b/src/mame/drivers/coinmvga.c
@@ -338,7 +338,7 @@ static WRITE16_HANDLER( ramdac_fg_w )
/*
static READ16_HANDLER( test_r )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}*/
/*************************
diff --git a/src/mame/drivers/coolridr.c b/src/mame/drivers/coolridr.c
index 45a5f16cd35..514ac6a7861 100644
--- a/src/mame/drivers/coolridr.c
+++ b/src/mame/drivers/coolridr.c
@@ -362,7 +362,7 @@ static WRITE32_HANDLER(sysh1_unk_w)
#if 0
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];
}
diff --git a/src/mame/drivers/cps3.c b/src/mame/drivers/cps3.c
index a6a725010c2..a3f2889246b 100644
--- a/src/mame/drivers/cps3.c
+++ b/src/mame/drivers/cps3.c
@@ -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&0x04) dest[x] |= 0x8000;
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
{
diff --git a/src/mame/drivers/csplayh5.c b/src/mame/drivers/csplayh5.c
index d8667941ca4..021071d4177 100644
--- a/src/mame/drivers/csplayh5.c
+++ b/src/mame/drivers/csplayh5.c
@@ -108,7 +108,7 @@ ADDRESS_MAP_END
#if USE_H8
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 )
diff --git a/src/mame/drivers/dblewing.c b/src/mame/drivers/dblewing.c
index 73316bad437..a7b44a63c95 100644
--- a/src/mame/drivers/dblewing.c
+++ b/src/mame/drivers/dblewing.c
@@ -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);
- return 0;//mame_rand(space->machine);
+ return 0;//space->machine->rand();
}
static WRITE16_HANDLER( dblewing_prot_w )
diff --git a/src/mame/drivers/ddealer.c b/src/mame/drivers/ddealer.c
index 2dd54ca03da..bee29a61fe9 100644
--- a/src/mame/drivers/ddealer.c
+++ b/src/mame/drivers/ddealer.c
@@ -350,10 +350,10 @@ static TIMER_DEVICE_CALLBACK( ddealer_mcu_sim )
}
/*random number generators,controls order of cards*/
- state->mcu_shared_ram[0x10 / 2] = mame_rand(timer.machine) & 0xffff;
- state->mcu_shared_ram[0x12 / 2] = mame_rand(timer.machine) & 0xffff;
- state->mcu_shared_ram[0x14 / 2] = mame_rand(timer.machine) & 0xffff;
- state->mcu_shared_ram[0x16 / 2] = mame_rand(timer.machine) & 0xffff;
+ state->mcu_shared_ram[0x10 / 2] = timer.machine->rand() & 0xffff;
+ state->mcu_shared_ram[0x12 / 2] = timer.machine->rand() & 0xffff;
+ state->mcu_shared_ram[0x14 / 2] = timer.machine->rand() & 0xffff;
+ state->mcu_shared_ram[0x16 / 2] = timer.machine->rand() & 0xffff;
}
diff --git a/src/mame/drivers/ddenlovr.c b/src/mame/drivers/ddenlovr.c
index eb9c5c08ed5..e621bb30e11 100644
--- a/src/mame/drivers/ddenlovr.c
+++ b/src/mame/drivers/ddenlovr.c
@@ -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, 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, 3)) return 0xff;//mame_rand(device->machine);
- if (!BIT(state->dsw_sel, 4)) 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;//device->machine->rand();
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, 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, 3)) 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;//space->machine->rand();
if (!BIT(state->dsw_sel, 4)) return input_port_read(space->machine, "DSW3");
return 0xff;
}
@@ -2536,7 +2536,7 @@ static WRITE8_DEVICE_HANDLER( hanakanz_oki_bank_w )
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 )
diff --git a/src/mame/drivers/ddribble.c b/src/mame/drivers/ddribble.c
index 911c5c7a133..d43aa9c730b 100644
--- a/src/mame/drivers/ddribble.c
+++ b/src/mame/drivers/ddribble.c
@@ -75,7 +75,7 @@ static WRITE8_HANDLER( ddribble_coin_counter_w )
static READ8_DEVICE_HANDLER( ddribble_vlm5030_busy_r )
{
- return mame_rand(device->machine); /* patch */
+ return device->machine->rand(); /* patch */
/* FIXME: remove ? */
#if 0
if (vlm5030_bsy(device)) return 1;
diff --git a/src/mame/drivers/deco32.c b/src/mame/drivers/deco32.c
index 825af74e211..f0f37a1f413 100644
--- a/src/mame/drivers/deco32.c
+++ b/src/mame/drivers/deco32.c
@@ -396,10 +396,10 @@ static READ32_HANDLER( dragngun_service_r )
static READ32_HANDLER( lockload_gun_mirror_r )
{
//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 */
- return input_port_read(space->machine, "IN4") | ((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); //((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); //((space->machine->rand()%0xff)<<16);
}
static READ32_HANDLER( dragngun_prot_r )
diff --git a/src/mame/drivers/deco_ld.c b/src/mame/drivers/deco_ld.c
index 7e253e231fe..598948429fd 100644
--- a/src/mame/drivers/deco_ld.c
+++ b/src/mame/drivers/deco_ld.c
@@ -173,7 +173,7 @@ static WRITE8_HANDLER( laserdisc_w )
static READ8_HANDLER( test_r )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
static ADDRESS_MAP_START( begas_map, ADDRESS_SPACE_PROGRAM, 8 )
diff --git a/src/mame/drivers/deco_mlc.c b/src/mame/drivers/deco_mlc.c
index 4bbb0a6fb7d..5d5551efeb0 100644
--- a/src/mame/drivers/deco_mlc.c
+++ b/src/mame/drivers/deco_mlc.c
@@ -117,7 +117,7 @@ static READ32_HANDLER(test2_r)
// if (offset==0)
// return input_port_read(space->machine, "IN0"); //0xffffffff;
// 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)
@@ -127,7 +127,7 @@ static READ32_HANDLER(test3_r)
*/
//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);
return 0xffffffff;
}
diff --git a/src/mame/drivers/discoboy.c b/src/mame/drivers/discoboy.c
index 90b075b4311..8f4de52ee03 100644
--- a/src/mame/drivers/discoboy.c
+++ b/src/mame/drivers/discoboy.c
@@ -107,7 +107,7 @@ static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rect
}
else
{
- code = mame_rand(machine);
+ code = machine->rand();
}
}
@@ -261,7 +261,7 @@ static READ8_HANDLER( rambank2_r )
else
printf("unk rb2_r\n");
- return mame_rand(space->machine);
+ return space->machine->rand();
}
static WRITE8_HANDLER( rambank2_w )
diff --git a/src/mame/drivers/dwarfd.c b/src/mame/drivers/dwarfd.c
index 3d493605e86..b12e8c3d8e6 100644
--- a/src/mame/drivers/dwarfd.c
+++ b/src/mame/drivers/dwarfd.c
@@ -568,7 +568,7 @@ static WRITE8_HANDLER(output2_w)
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 )
@@ -725,7 +725,7 @@ static void drawCrt( running_machine *machine, bitmap_t *bitmap,const rectangle
if ((tile & 0xc0) == 0xc0)
{
b = 1;
- tile = mame_rand(machine) & 0x7f;//(tile >> 2) & 0xf;
+ tile = machine->rand() & 0x7f;//(tile >> 2) & 0xf;
}
}
else
@@ -887,9 +887,9 @@ static PALETTE_INIT(dwarfd)
for (i = 0; i < 256; i++)
{
- int r = mame_rand(machine)|0x80;
- int g = mame_rand(machine)|0x80;
- int b = mame_rand(machine)|0x80;
+ int r = machine->rand()|0x80;
+ int g = machine->rand()|0x80;
+ int b = machine->rand()|0x80;
if (i == 0) r = g = b = 0;
palette_set_color(machine,i,MAKE_RGB(r,g,b));
diff --git a/src/mame/drivers/eolith.c b/src/mame/drivers/eolith.c
index 2c79f15b441..3ff655a8dde 100644
--- a/src/mame/drivers/eolith.c
+++ b/src/mame/drivers/eolith.c
@@ -87,7 +87,7 @@ static READ32_HANDLER( eolith_custom_r )
*/
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 )
diff --git a/src/mame/drivers/fitfight.c b/src/mame/drivers/fitfight.c
index 17d62423250..2512634d3a6 100644
--- a/src/mame/drivers/fitfight.c
+++ b/src/mame/drivers/fitfight.c
@@ -219,19 +219,19 @@ ADDRESS_MAP_END
static READ8_HANDLER(snd_porta_r)
{
//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)
{
//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)
{
//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)
diff --git a/src/mame/drivers/galaxian.c b/src/mame/drivers/galaxian.c
index 4874b996fcd..34cbf0d10f1 100644
--- a/src/mame/drivers/galaxian.c
+++ b/src/mame/drivers/galaxian.c
@@ -1118,7 +1118,7 @@ static CUSTOM_INPUT( kingball_noise_r )
/* 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
rand() */
- return mame_rand(field->port->machine) & 1;
+ return field->port->machine->rand() & 1;
}
diff --git a/src/mame/drivers/galivan.c b/src/mame/drivers/galivan.c
index 1f3c17c9cfe..0e004a2574b 100644
--- a/src/mame/drivers/galivan.c
+++ b/src/mame/drivers/galivan.c
@@ -1026,7 +1026,7 @@ static WRITE8_HANDLER( youmab_extra_bank_w )
static READ8_HANDLER( youmab_8a_r )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
static WRITE8_HANDLER( youmab_81_w )
diff --git a/src/mame/drivers/galpani3.c b/src/mame/drivers/galpani3.c
index ed2fefaf17d..6ac5e8b151c 100644
--- a/src/mame/drivers/galpani3.c
+++ b/src/mame/drivers/galpani3.c
@@ -297,20 +297,20 @@ static VIDEO_UPDATE(galpani3)
/*
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
{
- //dst[0] = mame_rand(screen->machine)&0x3fff;
+ //dst[0] = screen->machine->rand()&0x3fff;
}
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
{
- //dst[0] = mame_rand(screen->machine)&0x3fff;
+ //dst[0] = screen->machine->rand()&0x3fff;
}
else
{
diff --git a/src/mame/drivers/galpanic.c b/src/mame/drivers/galpanic.c
index 43e252ea96f..66c336e7297 100644
--- a/src/mame/drivers/galpanic.c
+++ b/src/mame/drivers/galpanic.c
@@ -233,7 +233,7 @@ ADDRESS_MAP_END
static READ16_HANDLER( kludge )
{
- return mame_rand(space->machine) & 0x0700;
+ return space->machine->rand() & 0x0700;
}
/* a kludge! */
@@ -242,7 +242,7 @@ static READ8_DEVICE_HANDLER( comad_okim6295_r )
UINT16 retvalue;
// 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;
}
@@ -306,7 +306,7 @@ ADDRESS_MAP_END
#ifdef UNUSED_FUNCTION
READ16_HANDLER( zipzap_random_read )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
#endif
diff --git a/src/mame/drivers/gladiatr.c b/src/mame/drivers/gladiatr.c
index aa8a655c4f4..c09778edeed 100644
--- a/src/mame/drivers/gladiatr.c
+++ b/src/mame/drivers/gladiatr.c
@@ -344,9 +344,9 @@ static WRITE8_HANDLER(qx2_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)
{
@@ -623,7 +623,7 @@ GFXDECODE_END
static READ8_DEVICE_HANDLER(f1_r)
{
- return mame_rand(device->machine);
+ return device->machine->rand();
}
static const ym2203_interface ppking_ym2203_interface =
diff --git a/src/mame/drivers/goldngam.c b/src/mame/drivers/goldngam.c
index 26304821496..52dadbb7fb2 100644
--- a/src/mame/drivers/goldngam.c
+++ b/src/mame/drivers/goldngam.c
@@ -282,7 +282,7 @@ static PALETTE_INIT( goldngam )
static READ16_HANDLER(unk_r)
{
- int test1 = (mame_rand(space->machine) & 0xae00);
+ int test1 = (space->machine->rand() & 0xae00);
// popmessage("VAL = %02x", test1);
return test1;
diff --git a/src/mame/drivers/hitpoker.c b/src/mame/drivers/hitpoker.c
index 9bc89d08455..22ef7bdfa7f 100644
--- a/src/mame/drivers/hitpoker.c
+++ b/src/mame/drivers/hitpoker.c
@@ -211,7 +211,7 @@ static WRITE8_HANDLER( hitpoker_pic_w )
#if 0
static READ8_HANDLER( test_r )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
#endif
diff --git a/src/mame/drivers/hng64.c b/src/mame/drivers/hng64.c
index ed26f04a44f..e2e4bd02b8e 100644
--- a/src/mame/drivers/hng64.c
+++ b/src/mame/drivers/hng64.c
@@ -459,7 +459,7 @@ WRITE32_HANDLER( trap_write )
static READ32_HANDLER( hng64_random_read )
{
- return mame_rand(space->machine)&0xffffffff;
+ return space->machine->rand()&0xffffffff;
}
#endif
@@ -530,7 +530,7 @@ static READ32_HANDLER( hng64_sysregs_r )
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 0x107c:
case 0x1084: return 0x00000002; //MCU->MIPS latch port
@@ -559,7 +559,7 @@ static READ32_HANDLER( hng64_sysregs_r )
// printf("%08x\n",offset*4);
-// return mame_rand(space->machine)&0xffffffff;
+// return space->machine->rand()&0xffffffff;
return state->sysregs[offset];
}
@@ -697,7 +697,7 @@ static READ32_HANDLER( shoot_io_r )
{
/* Quick kludge for use the input test items */
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);
}
diff --git a/src/mame/drivers/intrscti.c b/src/mame/drivers/intrscti.c
index cd99807a5c6..87be6cae4af 100644
--- a/src/mame/drivers/intrscti.c
+++ b/src/mame/drivers/intrscti.c
@@ -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 )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
static UINT8 *intrscti_ram;
diff --git a/src/mame/drivers/itech32.c b/src/mame/drivers/itech32.c
index fbb116897ed..b7eb5a49b84 100644
--- a/src/mame/drivers/itech32.c
+++ b/src/mame/drivers/itech32.c
@@ -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
int start = (base == main_ram) ? 0x80 : 0x00;
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
if (is_drivedge)
diff --git a/src/mame/drivers/jalmah.c b/src/mame/drivers/jalmah.c
index 42457453dc7..bdff1a0247d 100644
--- a/src/mame/drivers/jalmah.c
+++ b/src/mame/drivers/jalmah.c
@@ -740,7 +740,7 @@ static void mjzoomin_mcu_run(running_machine *machine)
MCU_READ("KEY1", 0x0002, 0x000/2, 0x13); /*CHI (trusted)*/
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++;
if(prg_prot > 0x10) { prg_prot = 0; }
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("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++;
if(prg_prot > 0x10) { prg_prot = 0; }
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?) */
}
- jm_shared_ram[0x20c/2] = mame_rand(machine) & 0xffff; //kakumei2
+ jm_shared_ram[0x20c/2] = machine->rand() & 0xffff; //kakumei2
}
diff --git a/src/mame/drivers/jangou.c b/src/mame/drivers/jangou.c
index c4e11511056..8458a2ddc23 100644
--- a/src/mame/drivers/jangou.c
+++ b/src/mame/drivers/jangou.c
@@ -1356,7 +1356,7 @@ ROM_END
/*Temporary kludge for make the RNG work*/
static READ8_HANDLER( jngolady_rng_r )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
static DRIVER_INIT( jngolady )
diff --git a/src/mame/drivers/jokrwild.c b/src/mame/drivers/jokrwild.c
index b8a559a9d0f..8b5d9a6a4d7 100644
--- a/src/mame/drivers/jokrwild.c
+++ b/src/mame/drivers/jokrwild.c
@@ -171,7 +171,7 @@ static READ8_HANDLER( rng_r )
if(cpu_get_pc(space->cpu) == 0xab3a)
return (offset == 2) ? 0x49 : 0x92;
- return mame_rand(space->machine) & 0xff;
+ return space->machine->rand() & 0xff;
}
/*************************
diff --git a/src/mame/drivers/jubilee.c b/src/mame/drivers/jubilee.c
index bf5e0f5861c..05234b11e26 100644
--- a/src/mame/drivers/jubilee.c
+++ b/src/mame/drivers/jubilee.c
@@ -168,7 +168,7 @@ ADDRESS_MAP_END
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 )
diff --git a/src/mame/drivers/kaneko16.c b/src/mame/drivers/kaneko16.c
index 789acaa7034..67560c68371 100644
--- a/src/mame/drivers/kaneko16.c
+++ b/src/mame/drivers/kaneko16.c
@@ -270,7 +270,7 @@ static MACHINE_RESET( shogwarr )
static READ16_HANDLER( kaneko16_rnd_r )
{
- return mame_rand(space->machine) & 0xffff;
+ return space->machine->rand() & 0xffff;
}
static WRITE16_HANDLER( kaneko16_coin_lockout_w )
diff --git a/src/mame/drivers/koftball.c b/src/mame/drivers/koftball.c
index cbce1610a7e..7285b191ce7 100644
--- a/src/mame/drivers/koftball.c
+++ b/src/mame/drivers/koftball.c
@@ -93,7 +93,7 @@ static READ16_HANDLER( bmc_RAMDAC_color_r )
static READ16_HANDLER(random_number_r)
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
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));
- return mame_rand(space->machine);
+ return space->machine->rand();
}
static WRITE16_HANDLER(prot_w)
diff --git a/src/mame/drivers/kopunch.c b/src/mame/drivers/kopunch.c
index f23f84a4b40..ae3d7f72931 100644
--- a/src/mame/drivers/kopunch.c
+++ b/src/mame/drivers/kopunch.c
@@ -18,9 +18,9 @@ static READ8_HANDLER( kopunch_in_r )
{
/* port 31 + low 3 bits of port 32 contain the punch strength */
if (offset == 0)
- return mame_rand(space->machine);
+ return space->machine->rand();
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 )
diff --git a/src/mame/drivers/lastfght.c b/src/mame/drivers/lastfght.c
index cacb4efb29e..6c57ccf3038 100644
--- a/src/mame/drivers/lastfght.c
+++ b/src/mame/drivers/lastfght.c
@@ -366,7 +366,7 @@ static READ16_HANDLER( lastfght_c00002_r )
{
// high byte:
// 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 )
diff --git a/src/mame/drivers/looping.c b/src/mame/drivers/looping.c
index f37fb70d59d..7dd0d0f9486 100644
--- a/src/mame/drivers/looping.c
+++ b/src/mame/drivers/looping.c
@@ -434,7 +434,7 @@ static WRITE8_HANDLER( plr2_w )
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];
}
diff --git a/src/mame/drivers/m14.c b/src/mame/drivers/m14.c
index 8eb557dbddd..bf942387f5b 100644
--- a/src/mame/drivers/m14.c
+++ b/src/mame/drivers/m14.c
@@ -153,7 +153,7 @@ static WRITE8_HANDLER( m14_cram_w )
static READ8_HANDLER( m14_rng_r )
{
/* 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 */
diff --git a/src/mame/drivers/m72.c b/src/mame/drivers/m72.c
index 2d102da9697..559db1792cf 100644
--- a/src/mame/drivers/m72.c
+++ b/src/mame/drivers/m72.c
@@ -254,7 +254,7 @@ static READ8_HANDLER(m72_mcu_data_r )
static INTERRUPT_GEN( m72_mcu_int )
{
//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);
}
diff --git a/src/mame/drivers/magicard.c b/src/mame/drivers/magicard.c
index 72eaaac43af..beb87afed40 100644
--- a/src/mame/drivers/magicard.c
+++ b/src/mame/drivers/magicard.c
@@ -438,7 +438,7 @@ static VIDEO_UPDATE(magicard)
static READ16_HANDLER( test_r )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
static WRITE16_HANDLER( paletteram_io_w )
@@ -481,7 +481,7 @@ static READ16_HANDLER( philips_66470_r )
switch(offset)
{
// case 0/2:
-// return mame_rand(space->machine); //TODO
+// return space->machine->rand(); //TODO
}
//printf("[%04x]\n",offset*2);
@@ -533,7 +533,7 @@ static READ16_HANDLER( scc68070_uart_r )
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];
diff --git a/src/mame/drivers/megadriv.c b/src/mame/drivers/megadriv.c
index 5147b9c2726..624188576fe 100644
--- a/src/mame/drivers/megadriv.c
+++ b/src/mame/drivers/megadriv.c
@@ -895,7 +895,7 @@ static UINT16 vdp_get_word_from_68k_mem_default(running_machine *machine, UINT32
else
{
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;
- //return mame_rand(machine);
+ //return machine->rand();
megadrive_vdp_command_pending = 0;
@@ -1289,12 +1289,12 @@ static UINT16 megadriv_vdp_data_port_r(running_machine *machine)
case 0x0001:
logerror("Attempting to READ from DATA PORT in VRAM WRITE MODE\n");
- retdata = mame_rand(machine);
+ retdata = machine->rand();
break;
case 0x0003:
logerror("Attempting to READ from DATA PORT in CRAM WRITE MODE\n");
- retdata = mame_rand(machine);
+ retdata = machine->rand();
break;
case 0x0004:
@@ -1315,7 +1315,7 @@ static UINT16 megadriv_vdp_data_port_r(running_machine *machine)
default:
logerror("Attempting to READ from DATA PORT in #UNDEFINED# MODE\n");
- retdata = mame_rand(machine);
+ retdata = machine->rand();
break;
}
@@ -1622,7 +1622,7 @@ READ16_HANDLER( megadriv_vdp_r )
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);
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);
break;
@@ -1632,7 +1632,7 @@ READ16_HANDLER( megadriv_vdp_r )
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);
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);
break;
@@ -1979,7 +1979,7 @@ READ16_HANDLER( megadriv_68k_io_read )
D0 : Bit 0 of version number
*/
- //return (mame_rand(space->machine)&0x0f0f)|0xf0f0;//0x0000;
+ //return (space->machine->rand()&0x0f0f)|0xf0f0;//0x0000;
switch (offset)
{
case 0:
@@ -2172,7 +2172,7 @@ static READ16_HANDLER( megadriv_68k_read_z80_ram )
else
{
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
read_next_instruction function from system16, so I just return a random value
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 */
@@ -2404,7 +2404,7 @@ static WRITE8_HANDLER( megadriv_z80_vdp_write )
static READ8_HANDLER( megadriv_z80_vdp_read )
{
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 )
@@ -5670,7 +5670,7 @@ INLINE UINT8 read_pixel_from_stampmap( running_machine* machine, bitmap_t* srcbi
/*
if (!srcbitmap)
{
- return mame_rand(machine);
+ return machine->rand();
}
if (x >= srcbitmap->width) return 0;
@@ -5739,8 +5739,8 @@ INLINE void write_pixel_to_imagebuffer( running_machine* machine, UINT32 pix, in
default:
case 0x03: // invalid?
- segacd_dataram[offset] = mame_rand(machine);
- segacd_dataram[offset+1] = mame_rand(machine);
+ segacd_dataram[offset] = machine->rand();
+ segacd_dataram[offset+1] = machine->rand();
break;
}
@@ -6759,7 +6759,7 @@ static void genesis_render_videoline_to_videobuffer(int scanline)
//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 */
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 0x1e000: // (sprite)shadow set, highlight set, normal set, not possible
default:
- lineptr[x] = mame_rand(machine)&0x3f;
+ lineptr[x] = machine->rand()&0x3f;
break;
}
}
@@ -8681,7 +8681,7 @@ static NVRAM_HANDLER( megadriv )
{
int 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
}
}
}
diff --git a/src/mame/drivers/merit.c b/src/mame/drivers/merit.c
index 5e2add30414..4393a3a1706 100644
--- a/src/mame/drivers/merit.c
+++ b/src/mame/drivers/merit.c
@@ -340,7 +340,7 @@ static WRITE8_HANDLER(casino5_bank_w)
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 )
diff --git a/src/mame/drivers/metalmx.c b/src/mame/drivers/metalmx.c
index 88beb562a0b..16b3033892a 100644
--- a/src/mame/drivers/metalmx.c
+++ b/src/mame/drivers/metalmx.c
@@ -312,7 +312,7 @@ static VIDEO_UPDATE( metalmx )
static READ32_HANDLER( unk_r )
{
- return 0;//mame_rand(space->machine);
+ return 0;//space->machine->rand();
}
static READ32_HANDLER( watchdog_r )
diff --git a/src/mame/drivers/metro.c b/src/mame/drivers/metro.c
index 5373ca41b28..5c13a3ea6c0 100644
--- a/src/mame/drivers/metro.c
+++ b/src/mame/drivers/metro.c
@@ -6044,7 +6044,7 @@ static DRIVER_INIT( karatour )
state->vram_2 = RAM + (0x20000/2) * 2;
for (i = 0; i < (0x20000 * 3) / 2; i++)
- RAM[i] = mame_rand(machine);
+ RAM[i] = machine->rand();
DRIVER_INIT_CALL(metro);
diff --git a/src/mame/drivers/mlanding.c b/src/mame/drivers/mlanding.c
index 010347a62c0..83150b8cc43 100644
--- a/src/mame/drivers/mlanding.c
+++ b/src/mame/drivers/mlanding.c
@@ -524,7 +524,7 @@ static READ16_HANDLER( dsp_HOLD_signal_r )
static READ8_HANDLER( test_r )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
//mecha driver ?
diff --git a/src/mame/drivers/monzagp.c b/src/mame/drivers/monzagp.c
index 6cf322ca76d..ef48a8f77cd 100644
--- a/src/mame/drivers/monzagp.c
+++ b/src/mame/drivers/monzagp.c
@@ -107,7 +107,7 @@ ADDRESS_MAP_END
static READ8_HANDLER(rng_r)
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
static WRITE8_HANDLER(port_w)
diff --git a/src/mame/drivers/mpoker.c b/src/mame/drivers/mpoker.c
index f33d12df2d8..5b179a52189 100644
--- a/src/mame/drivers/mpoker.c
+++ b/src/mame/drivers/mpoker.c
@@ -238,7 +238,7 @@ static READ8_HANDLER( mixport_r )
*/
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;
}
diff --git a/src/mame/drivers/mpu4drvr.c b/src/mame/drivers/mpu4drvr.c
index c291928f656..3045cc77f52 100644
--- a/src/mame/drivers/mpu4drvr.c
+++ b/src/mame/drivers/mpu4drvr.c
@@ -1867,7 +1867,7 @@ INPUT_PORTS_END
/* OKI M6376 (for Mating Game) FIXME */
static READ16_DEVICE_HANDLER( oki_r )
{
- return mame_rand(device->machine);
+ return device->machine->rand();
}
static WRITE16_DEVICE_HANDLER( oki_w )
diff --git a/src/mame/drivers/namcona1.c b/src/mame/drivers/namcona1.c
index fe17e6ca9f8..9e476dc77b4 100644
--- a/src/mame/drivers/namcona1.c
+++ b/src/mame/drivers/namcona1.c
@@ -410,7 +410,7 @@ static READ16_HANDLER( custom_key_r )
old_count = count;
do
{
- count = mame_rand(space->machine);
+ count = space->machine->rand();
} while( old_count == count );
switch( namcona1_gametype )
@@ -482,7 +482,7 @@ static READ16_HANDLER( custom_key_r )
default:
return 0;
}
- return mame_rand(space->machine)&0xffff;
+ return space->machine->rand()&0xffff;
} /* custom_key_r */
static WRITE16_HANDLER( custom_key_w )
diff --git a/src/mame/drivers/namconb1.c b/src/mame/drivers/namconb1.c
index c989f2cfc68..fb1bd430ba7 100644
--- a/src/mame/drivers/namconb1.c
+++ b/src/mame/drivers/namconb1.c
@@ -666,7 +666,7 @@ static READ32_HANDLER( custom_key_r )
do
{ /* 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 );
switch( namcos2_gametype )
@@ -824,7 +824,7 @@ static READ32_HANDLER( gunbulet_gun_r )
static
READ32_HANDLER( randgen_r )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
} /* randgen_r */
static
diff --git a/src/mame/drivers/namcos23.c b/src/mame/drivers/namcos23.c
index df67dd09e02..3159f2b5cab 100644
--- a/src/mame/drivers/namcos23.c
+++ b/src/mame/drivers/namcos23.c
@@ -2581,7 +2581,7 @@ static WRITE8_HANDLER( s23_iob_p4_w )
static READ8_HANDLER(iob_r)
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
/* H8/3334 (Namco C78) I/O board MCU */
diff --git a/src/mame/drivers/neptunp2.c b/src/mame/drivers/neptunp2.c
index cee880469d1..d4c281e088e 100644
--- a/src/mame/drivers/neptunp2.c
+++ b/src/mame/drivers/neptunp2.c
@@ -21,7 +21,7 @@ static VIDEO_UPDATE( neptunp2 )
static READ8_HANDLER( test_r )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
static ADDRESS_MAP_START( neptunp2_map, ADDRESS_SPACE_PROGRAM, 8 )
diff --git a/src/mame/drivers/nsmpoker.c b/src/mame/drivers/nsmpoker.c
index b52bf714c76..b1c15fa6a60 100644
--- a/src/mame/drivers/nsmpoker.c
+++ b/src/mame/drivers/nsmpoker.c
@@ -139,7 +139,7 @@ static INTERRUPT_GEN( nsmpoker_interrupt )
static READ8_HANDLER( debug_r )
{
- return mame_rand(space->machine) & 0xff;
+ return space->machine->rand() & 0xff;
}
diff --git a/src/mame/drivers/nycaptor.c b/src/mame/drivers/nycaptor.c
index 150fb65db19..fa7fc1067d0 100644
--- a/src/mame/drivers/nycaptor.c
+++ b/src/mame/drivers/nycaptor.c
@@ -439,7 +439,7 @@ static WRITE8_HANDLER(cyclshtg_mcu_w)
static READ8_HANDLER(cyclshtg_mcu_status_r1)
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
static WRITE8_HANDLER( cyclshtg_generic_control_w )
@@ -498,7 +498,7 @@ ADDRESS_MAP_END
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 )
diff --git a/src/mame/drivers/othello.c b/src/mame/drivers/othello.c
index e488058cb23..36df596171c 100644
--- a/src/mame/drivers/othello.c
+++ b/src/mame/drivers/othello.c
@@ -134,7 +134,7 @@ ADDRESS_MAP_END
static READ8_HANDLER( unk_87_r )
{
/* 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 )
@@ -158,7 +158,7 @@ static WRITE8_HANDLER( unk_8c_w )
static READ8_HANDLER( unk_8c_r )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
static READ8_HANDLER( sound_ack_r )
diff --git a/src/mame/drivers/othldrby.c b/src/mame/drivers/othldrby.c
index 06e9448c4ef..b06434e5fc3 100644
--- a/src/mame/drivers/othldrby.c
+++ b/src/mame/drivers/othldrby.c
@@ -28,7 +28,7 @@ static READ16_HANDLER( pip )
static READ16_HANDLER( pap )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
diff --git a/src/mame/drivers/pacman.c b/src/mame/drivers/pacman.c
index 792b483d5dd..741f40b9054 100644
--- a/src/mame/drivers/pacman.c
+++ b/src/mame/drivers/pacman.c
@@ -540,7 +540,7 @@ static READ8_HANDLER( alibaba_mystery_1_r )
{
/* The return value determines what the mystery item is. Each bit corresponds
to a question mark */
- return mame_rand(space->machine) & 0x0f;
+ return space->machine->rand() & 0x0f;
}
diff --git a/src/mame/drivers/pastelg.c b/src/mame/drivers/pastelg.c
index 63791aacb17..e64d9d8b97a 100644
--- a/src/mame/drivers/pastelg.c
+++ b/src/mame/drivers/pastelg.c
@@ -215,7 +215,7 @@ INPUT_PORTS_END
// stops the game hanging..
static CUSTOM_INPUT( nb1413m3_hackbusyflag_r )
{
- return mame_rand(field->port->machine) & 3;
+ return field->port->machine->rand() & 3;
}
static INPUT_PORTS_START( threeds )
diff --git a/src/mame/drivers/pcat_dyn.c b/src/mame/drivers/pcat_dyn.c
index 7efb1c25b1e..1a3a54c2db5 100644
--- a/src/mame/drivers/pcat_dyn.c
+++ b/src/mame/drivers/pcat_dyn.c
@@ -313,7 +313,7 @@ ADDRESS_MAP_END
static READ32_HANDLER( kludge_r )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
/* 3c8-3c9 -> ramdac*/
diff --git a/src/mame/drivers/photoply.c b/src/mame/drivers/photoply.c
index 299a8af5a00..1c6b7f1865f 100644
--- a/src/mame/drivers/photoply.c
+++ b/src/mame/drivers/photoply.c
@@ -297,7 +297,7 @@ ADDRESS_MAP_END
static READ32_HANDLER( kludge_r )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
/* 3c8-3c9 -> ramdac*/
diff --git a/src/mame/drivers/pinkiri8.c b/src/mame/drivers/pinkiri8.c
index 3f4513b5be1..45166628f8f 100644
--- a/src/mame/drivers/pinkiri8.c
+++ b/src/mame/drivers/pinkiri8.c
@@ -302,7 +302,7 @@ static VIDEO_UPDATE( pinkiri8 )
if (bit)
{
- //col = mame_rand(screen->machine);
+ //col = screen->machine->rand();
width = 2;
}
else
diff --git a/src/mame/drivers/pntnpuzl.c b/src/mame/drivers/pntnpuzl.c
index d965276cb16..fbadf9fed54 100644
--- a/src/mame/drivers/pntnpuzl.c
+++ b/src/mame/drivers/pntnpuzl.c
@@ -259,7 +259,7 @@ static WRITE16_HANDLER( pntnpuzl_palette_w )
#ifdef UNUSED_FUNCTION
READ16_HANDLER ( pntnpuzl_random_r )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
#endif
diff --git a/src/mame/drivers/polyplay.c b/src/mame/drivers/polyplay.c
index cb993435517..08cf3fd6064 100644
--- a/src/mame/drivers/polyplay.c
+++ b/src/mame/drivers/polyplay.c
@@ -242,7 +242,7 @@ static WRITE8_HANDLER( polyplay_start_timer2 )
static READ8_HANDLER( polyplay_random_read )
{
- return mame_rand(space->machine) & 0xff;
+ return space->machine->rand() & 0xff;
}
/* graphic structures */
diff --git a/src/mame/drivers/poo.c b/src/mame/drivers/poo.c
index 412f5e1f470..b9fe4e84d7f 100644
--- a/src/mame/drivers/poo.c
+++ b/src/mame/drivers/poo.c
@@ -97,7 +97,7 @@ static VIDEO_UPDATE(unclepoo)
static READ8_HANDLER( unk_inp_r )
{
- return 0x00;//mame_rand(space->machine);
+ return 0x00;//space->machine->rand();
}
#if 0
@@ -109,7 +109,7 @@ static READ8_HANDLER( unk_inp2_r )
static READ8_HANDLER( unk_inp3_r )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
#endif
diff --git a/src/mame/drivers/r2dx_v33.c b/src/mame/drivers/r2dx_v33.c
index 15b57b6b60b..2e3d1f47aa0 100644
--- a/src/mame/drivers/r2dx_v33.c
+++ b/src/mame/drivers/r2dx_v33.c
@@ -298,7 +298,7 @@ static WRITE16_HANDLER( rdx_tx_vram_w )
static READ16_HANDLER( rdx_v33_unknown_r )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
diff --git a/src/mame/drivers/rabbit.c b/src/mame/drivers/rabbit.c
index 501d836150a..ff4cbca19cd 100644
--- a/src/mame/drivers/rabbit.c
+++ b/src/mame/drivers/rabbit.c
@@ -486,7 +486,7 @@ static READ32_HANDLER( rabbit_tilemap3_r )
static READ32_HANDLER( randomrabbits )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
/* rom bank is used when testing roms, not currently hooked up */
diff --git a/src/mame/drivers/rbmk.c b/src/mame/drivers/rbmk.c
index a229e08141e..02d483b1c39 100644
--- a/src/mame/drivers/rbmk.c
+++ b/src/mame/drivers/rbmk.c
@@ -63,7 +63,7 @@ static UINT16 tilebank=0;
static READ16_HANDLER( gms_read )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
diff --git a/src/mame/drivers/redalert.c b/src/mame/drivers/redalert.c
index 3ef8c69ee55..5aecabbc3ff 100644
--- a/src/mame/drivers/redalert.c
+++ b/src/mame/drivers/redalert.c
@@ -141,7 +141,7 @@ static READ8_HANDLER( panther_interrupt_clear_r )
static READ8_HANDLER( panther_unk_r )
{
- return ((mame_rand(space->machine) & 0x01) | (input_port_read(space->machine, "C020") & 0xfe));
+ return ((space->machine->rand() & 0x01) | (input_port_read(space->machine, "C020") & 0xfe));
}
/*************************************
diff --git a/src/mame/drivers/roul.c b/src/mame/drivers/roul.c
index db1efffd440..092c2df591c 100644
--- a/src/mame/drivers/roul.c
+++ b/src/mame/drivers/roul.c
@@ -93,7 +93,7 @@ bit 6 -> ??? (after unknown blitter command : [80][80][08][02])
*/
// return 0x80; // blitter ready
// logerror("Read unknown port $f5 at %04x\n",cpu_get_pc(space->cpu));
- return mame_rand(space->machine) & 0x00c0;
+ return space->machine->rand() & 0x00c0;
}
static WRITE8_HANDLER( blitter_cmd_w )
diff --git a/src/mame/drivers/sderby.c b/src/mame/drivers/sderby.c
index 161a1dc6e62..a8dbc45bca2 100644
--- a/src/mame/drivers/sderby.c
+++ b/src/mame/drivers/sderby.c
@@ -135,7 +135,7 @@ static READ16_HANDLER( rprot_r )
If someone more skilled in 68K code can help to trace it,
searching for an accurated response, I'll appreciate.
*/
- return mame_rand(space->machine) & 0x1f;
+ return space->machine->rand() & 0x1f;
}
static WRITE16_HANDLER( rprot_w )
diff --git a/src/mame/drivers/segas32.c b/src/mame/drivers/segas32.c
index 5d84219d803..183ae18af76 100644
--- a/src/mame/drivers/segas32.c
+++ b/src/mame/drivers/segas32.c
@@ -1020,7 +1020,7 @@ static WRITE16_HANDLER( random_number_16_w )
static READ16_HANDLER( random_number_16_r )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
static WRITE32_HANDLER( random_number_32_w )
@@ -1030,7 +1030,7 @@ static WRITE32_HANDLER( random_number_32_w )
static READ32_HANDLER( random_number_32_r )
{
- return mame_rand(space->machine) ^ (mame_rand(space->machine) << 16);
+ return space->machine->rand() ^ (space->machine->rand() << 16);
}
diff --git a/src/mame/drivers/seta.c b/src/mame/drivers/seta.c
index ed3397e92d1..8660579c884 100644
--- a/src/mame/drivers/seta.c
+++ b/src/mame/drivers/seta.c
@@ -2184,37 +2184,37 @@ ADDRESS_MAP_END
static READ16_HANDLER( setaroul_c0_r )
{
- return 0x00;//mame_rand(space->machine);
+ return 0x00;//space->machine->rand();
}
static READ16_HANDLER( setaroul_d4_0_r )
{
- return 0x00;//mame_rand(space->machine);
+ return 0x00;//space->machine->rand();
}
static READ16_HANDLER( setaroul_d4_4_r )
{
- return 0x00;//mame_rand(space->machine);
+ return 0x00;//space->machine->rand();
}
static READ16_HANDLER( setaroul_d4_6_r )
{
- return 0xffff;//mame_rand(space->machine);
+ return 0xffff;//space->machine->rand();
}
static READ16_HANDLER( setaroul_d4_8_r )
{
- return mame_rand(space->machine)&0x000f;
+ return space->machine->rand()&0x000f;
}
static READ16_HANDLER( setaroul_d4_a_r )
{
- return 0x00;//mame_rand(space->machine);
+ return 0x00;//space->machine->rand();
}
static READ16_HANDLER( setaroul_d4_10_r )
{
- return 0x00;// mame_rand(space->machine);
+ return 0x00;// space->machine->rand();
}
@@ -2872,7 +2872,7 @@ static WRITE16_HANDLER( jockeyc_mux_w )
static READ16_HANDLER( unk_r )
{
- return 0xffff;//mame_rand(space->machine);
+ return 0xffff;//space->machine->rand();
}
/* same as International Toote but without the protection and different RTC hook-up */
diff --git a/src/mame/drivers/seta2.c b/src/mame/drivers/seta2.c
index 7ae1faa36c9..2d3d762a83e 100644
--- a/src/mame/drivers/seta2.c
+++ b/src/mame/drivers/seta2.c
@@ -759,7 +759,7 @@ static READ16_HANDLER( pzlbowl_protection_r )
static READ16_HANDLER( pzlbowl_coins_r )
{
- return input_port_read(space->machine, "SYSTEM") | (mame_rand(space->machine) & 0x80 );
+ return input_port_read(space->machine, "SYSTEM") | (space->machine->rand() & 0x80 );
}
static WRITE16_HANDLER( pzlbowl_coin_counter_w )
@@ -939,7 +939,7 @@ static READ32_HANDLER( coldfire_regs_r )
switch( offset )
{
case CF_MBSR:
- return mame_rand(space->machine);
+ return space->machine->rand();
case CF_PPDAT:
return input_port_read(space->machine, "BATTERY") << 16;
diff --git a/src/mame/drivers/sfbonus.c b/src/mame/drivers/sfbonus.c
index 6590267f494..4c32c8a3350 100644
--- a/src/mame/drivers/sfbonus.c
+++ b/src/mame/drivers/sfbonus.c
@@ -1097,22 +1097,22 @@ static WRITE8_HANDLER( sfbonus_bank_w )
static READ8_HANDLER( sfbonus_2800_r )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
static READ8_HANDLER( sfbonus_2801_r )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
static READ8_HANDLER( sfbonus_2c00_r )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
static READ8_HANDLER( sfbonus_2c01_r )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
static READ8_HANDLER( sfbonus_3800_r )
diff --git a/src/mame/drivers/spcforce.c b/src/mame/drivers/spcforce.c
index d6a89a6c90e..32f57166556 100644
--- a/src/mame/drivers/spcforce.c
+++ b/src/mame/drivers/spcforce.c
@@ -70,7 +70,7 @@ static WRITE8_HANDLER( spcforce_SN76496_select_w )
static READ8_HANDLER( spcforce_t0_r )
{
/* SN76496 status according to Al - not supported by MAME?? */
- return mame_rand(space->machine) & 1;
+ return space->machine->rand() & 1;
}
diff --git a/src/mame/drivers/ssfindo.c b/src/mame/drivers/ssfindo.c
index 8a92a3b5f08..983c3f44270 100644
--- a/src/mame/drivers/ssfindo.c
+++ b/src/mame/drivers/ssfindo.c
@@ -313,7 +313,7 @@ static READ32_HANDLER(PS7500_IO_r)
switch(offset)
{
case MSECR:
- return mame_rand(space->machine);
+ return space->machine->rand();
case IOLINES: //TODO: eeprom 24c01
#if 0
@@ -323,7 +323,7 @@ static READ32_HANDLER(PS7500_IO_r)
if(flashType == 1)
return 0;
else
- return mame_rand(space->machine);
+ return space->machine->rand();
case IRQSTA:
return (PS7500_IO[offset] & (~2)) | 0x80;
@@ -351,7 +351,7 @@ static READ32_HANDLER(PS7500_IO_r)
//default:
//mame_printf_debug("ior %i @%x\n",offset,cpu_get_pc(space->cpu));
}
- return mame_rand(space->machine);//PS7500_IO[offset];
+ return space->machine->rand();//PS7500_IO[offset];
}
static WRITE32_HANDLER(PS7500_IO_w)
@@ -473,17 +473,17 @@ static WRITE32_HANDLER(debug_w)
static READ32_HANDLER(ff4_r)
{
- return mame_rand(space->machine)&0x20;
+ return space->machine->rand()&0x20;
}
static READ32_HANDLER(SIMPLEIO_r)
{
- return mame_rand(space->machine)&1;
+ return space->machine->rand()&1;
}
static READ32_HANDLER(randomized_r)
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
static ADDRESS_MAP_START( ssfindo_map, ADDRESS_SPACE_PROGRAM, 32 )
diff --git a/src/mame/drivers/ssv.c b/src/mame/drivers/ssv.c
index 9dbb26f76a3..222b487c072 100644
--- a/src/mame/drivers/ssv.c
+++ b/src/mame/drivers/ssv.c
@@ -425,7 +425,7 @@ static READ16_HANDLER( fake_r ) { return ssv_scroll[offset]; }
static READ16_HANDLER( drifto94_rand_r )
{
- return mame_rand(space->machine) & 0xffff;
+ return space->machine->rand() & 0xffff;
}
static ADDRESS_MAP_START( drifto94_map, ADDRESS_SPACE_PROGRAM, 16 )
diff --git a/src/mame/drivers/stactics.c b/src/mame/drivers/stactics.c
index 042f979c70d..66922a7b720 100644
--- a/src/mame/drivers/stactics.c
+++ b/src/mame/drivers/stactics.c
@@ -130,7 +130,7 @@ static void move_motor(running_machine *machine, stactics_state *state)
static CUSTOM_INPUT( get_rng )
{
/* this is a 555 timer, but cannot read one of the resistor values */
- return mame_rand(field->port->machine) & 0x07;
+ return field->port->machine->rand() & 0x07;
}
diff --git a/src/mame/drivers/stepstag.c b/src/mame/drivers/stepstag.c
index c0e5817c874..5a0fb01643b 100644
--- a/src/mame/drivers/stepstag.c
+++ b/src/mame/drivers/stepstag.c
@@ -22,17 +22,17 @@
static READ16_HANDLER( unknown_read_0xc00000 )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
static READ16_HANDLER( unknown_read_0xd00000 )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
static READ16_HANDLER( unknown_read_0xffff00 )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
static ADDRESS_MAP_START( stepstag_map, ADDRESS_SPACE_PROGRAM, 16 )
@@ -64,7 +64,7 @@ ADDRESS_MAP_END
static READ16_HANDLER( unknown_sub_read_0xbe0004 )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
diff --git a/src/mame/drivers/strnskil.c b/src/mame/drivers/strnskil.c
index 0f7a2fa14c3..113f219b6e5 100644
--- a/src/mame/drivers/strnskil.c
+++ b/src/mame/drivers/strnskil.c
@@ -41,7 +41,7 @@ static READ8_HANDLER( pettanp_protection_r )
case 0x6066: res = 0xa5; break;
case 0x60dc: res = 0x20; break; /* bits 0-3 unknown */
case 0x615d: res = 0x30; break; /* bits 0-3 unknown */
- case 0x61b9: res = 0x60|(mame_rand(space->machine)&0x0f); break; /* bits 0-3 unknown */
+ case 0x61b9: res = 0x60|(space->machine->rand()&0x0f); break; /* bits 0-3 unknown */
case 0x6219: res = 0x77; break;
case 0x626c: res = 0xb4; break;
default: res = 0xff; break;
@@ -60,7 +60,7 @@ static READ8_HANDLER( banbam_protection_r )
case 0x6094: res = 0xa5; break;
case 0x6118: res = 0x20; break; /* bits 0-3 unknown */
case 0x6199: res = 0x30; break; /* bits 0-3 unknown */
- case 0x61f5: res = 0x60|(mame_rand(space->machine)&0x0f); break; /* bits 0-3 unknown */
+ case 0x61f5: res = 0x60|(space->machine->rand()&0x0f); break; /* bits 0-3 unknown */
case 0x6255: res = 0x77; break;
case 0x62a8: res = 0xb4; break;
default: res = 0xff; break;
diff --git a/src/mame/drivers/stv.c b/src/mame/drivers/stv.c
index 80a967c1e51..6ee047f3b45 100644
--- a/src/mame/drivers/stv.c
+++ b/src/mame/drivers/stv.c
@@ -838,7 +838,7 @@ static READ32_HANDLER ( stv_io_r32 )
}
}
//default:
- //case 0x40: return mame_rand(space->machine);
+ //case 0x40: return space->machine->rand();
default:
//popmessage("%02x PORT SEL",port_sel);
return (input_port_read(space->machine, "P1") << 16) | (input_port_read(space->machine, "P2"));
diff --git a/src/mame/drivers/supdrapo.c b/src/mame/drivers/supdrapo.c
index 76df1afff67..5aafbb62a29 100644
--- a/src/mame/drivers/supdrapo.c
+++ b/src/mame/drivers/supdrapo.c
@@ -149,7 +149,7 @@ static PALETTE_INIT( sdpoker )
static READ8_HANDLER( sdpoker_rng_r )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
static WRITE8_HANDLER( wdog8000_w )
diff --git a/src/mame/drivers/superqix.c b/src/mame/drivers/superqix.c
index a0c350d99e6..29863a5ea15 100644
--- a/src/mame/drivers/superqix.c
+++ b/src/mame/drivers/superqix.c
@@ -516,7 +516,7 @@ static READ8_DEVICE_HANDLER(pbillian_ay_port_a_r)
{
// logerror("%04x: ay_port_a_r\n",cpu_get_pc(space->cpu));
/* bits 76------ MCU status bits */
- return (mame_rand(device->machine) & 0xc0) | input_port_read(device->machine, "BUTTONS");
+ return (device->machine->rand() & 0xc0) | input_port_read(device->machine, "BUTTONS");
}
diff --git a/src/mame/drivers/suprnova.c b/src/mame/drivers/suprnova.c
index 97df676ef39..5f6798099ef 100644
--- a/src/mame/drivers/suprnova.c
+++ b/src/mame/drivers/suprnova.c
@@ -370,7 +370,7 @@ static READ32_HANDLER( skns_hit_r )
switch(adr) {
case 0x28:
case 0x2a:
- return (UINT16)mame_rand(space->machine);
+ return (UINT16)space->machine->rand();
case 0x00:
case 0x10:
return (UINT16)hit.x_in;
diff --git a/src/mame/drivers/taito_z.c b/src/mame/drivers/taito_z.c
index 43bf9f487b9..c2ac4ab408f 100644
--- a/src/mame/drivers/taito_z.c
+++ b/src/mame/drivers/taito_z.c
@@ -1345,7 +1345,7 @@ static READ16_HANDLER( chasehq_motor_r )
switch (offset)
{
case 0x0:
- return (mame_rand(space->machine) &0xff); /* motor status ?? */
+ return (space->machine->rand() &0xff); /* motor status ?? */
case 0x101:
return 0x55; /* motor cpu status ? */
diff --git a/src/mame/drivers/taitojc.c b/src/mame/drivers/taitojc.c
index 900d5674ba7..d7eb8b0a030 100644
--- a/src/mame/drivers/taitojc.c
+++ b/src/mame/drivers/taitojc.c
@@ -426,7 +426,7 @@ static READ32_HANDLER ( jc_control_r )
{
if (ACCESSING_BITS_24_31)
{
- //r |= (mame_rand(space->machine) & 0xff) << 24;
+ //r |= (space->machine->rand() & 0xff) << 24;
}
return r;
}
diff --git a/src/mame/drivers/tetrisp2.c b/src/mame/drivers/tetrisp2.c
index 0996726abe0..d61ca2620bc 100644
--- a/src/mame/drivers/tetrisp2.c
+++ b/src/mame/drivers/tetrisp2.c
@@ -209,8 +209,8 @@ static WRITE16_HANDLER( nndmseal_sound_bank_w )
static READ16_HANDLER( tetrisp2_ip_1_word_r )
{
return ( input_port_read(space->machine, "SYSTEM") & 0xfcff ) |
- ( mame_rand(space->machine) & ~0xfcff ) |
- ( 1 << (8 + (mame_rand(space->machine)&1)) );
+ ( space->machine->rand() & ~0xfcff ) |
+ ( 1 << (8 + (space->machine->rand()&1)) );
}
diff --git a/src/mame/drivers/timetrv.c b/src/mame/drivers/timetrv.c
index 2d83e49745d..b08d04af8ed 100644
--- a/src/mame/drivers/timetrv.c
+++ b/src/mame/drivers/timetrv.c
@@ -41,13 +41,13 @@ static VIDEO_UPDATE( timetrv )
static READ8_HANDLER( test1_r )
{
- return input_port_read(space->machine, "IN0");//mame_rand(space->machine);
+ return input_port_read(space->machine, "IN0");//space->machine->rand();
}
static READ8_HANDLER( test2_r )
{
/*bit 7,eeprom read bit*/
- return (input_port_read(space->machine, "IN1") & 0x7f);//mame_rand(space->machine);
+ return (input_port_read(space->machine, "IN1") & 0x7f);//space->machine->rand();
}
@@ -58,7 +58,7 @@ static READ8_HANDLER( in_r )
static READ8_HANDLER( ld_r )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
static ADDRESS_MAP_START( timetrv_map, ADDRESS_SPACE_PROGRAM, 8 )
diff --git a/src/mame/drivers/tmaster.c b/src/mame/drivers/tmaster.c
index 7da8c75a276..222786abaee 100644
--- a/src/mame/drivers/tmaster.c
+++ b/src/mame/drivers/tmaster.c
@@ -470,7 +470,7 @@ static READ16_HANDLER( tmaster_blitter_r )
static READ16_HANDLER( tmaster_coins_r )
{
- return input_port_read(space->machine, "COIN")|(mame_rand(space->machine)&0x0800);
+ return input_port_read(space->machine, "COIN")|(space->machine->rand()&0x0800);
}
static ADDRESS_MAP_START( tmaster_map, ADDRESS_SPACE_PROGRAM, 16 )
diff --git a/src/mame/drivers/tmmjprd.c b/src/mame/drivers/tmmjprd.c
index e3077e88e43..d76b49e82cc 100644
--- a/src/mame/drivers/tmmjprd.c
+++ b/src/mame/drivers/tmmjprd.c
@@ -339,7 +339,7 @@ static READ32_HANDLER( tmmjprd_tilemap3_r )
static READ32_HANDLER( randomtmmjprds )
{
- return 0x0000;//mame_rand(space->machine);
+ return 0x0000;//space->machine->rand();
}
diff --git a/src/mame/drivers/tmnt.c b/src/mame/drivers/tmnt.c
index ae46b094b6f..7a912b8aece 100644
--- a/src/mame/drivers/tmnt.c
+++ b/src/mame/drivers/tmnt.c
@@ -358,7 +358,7 @@ static READ16_HANDLER( punkshot_kludge_r )
/* 0xffffff, and returning 0 causes the game to mess up - locking up in a */
/* loop where the ball is continuously bouncing from the basket. Returning */
/* a random number seems to prevent that. */
- return mame_rand(space->machine);
+ return space->machine->rand();
}
diff --git a/src/mame/drivers/topspeed.c b/src/mame/drivers/topspeed.c
index b9ae0c2f938..edcb82f2f58 100644
--- a/src/mame/drivers/topspeed.c
+++ b/src/mame/drivers/topspeed.c
@@ -371,7 +371,7 @@ static READ16_HANDLER( topspeed_motor_r )
switch (offset)
{
case 0x0:
- return (mame_rand(space->machine) & 0xff); /* motor status ?? */
+ return (space->machine->rand() & 0xff); /* motor status ?? */
case 0x101:
return 0x55; /* motor cpu status ? */
diff --git a/src/mame/drivers/ttchamp.c b/src/mame/drivers/ttchamp.c
index f229e4afb6e..1d32fd6a503 100644
--- a/src/mame/drivers/ttchamp.c
+++ b/src/mame/drivers/ttchamp.c
@@ -110,13 +110,13 @@ static WRITE16_HANDLER( paldat_w )
static READ16_HANDLER( peno_rand )
{
- return 0xffff;// mame_rand(space->machine);
+ return 0xffff;// space->machine->rand();
}
#ifdef UNUSED_FUNCTION
static READ16_HANDLER( peno_rand2 )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
#endif
diff --git a/src/mame/drivers/tumbleb.c b/src/mame/drivers/tumbleb.c
index dcfa4671aba..5689fb078a6 100644
--- a/src/mame/drivers/tumbleb.c
+++ b/src/mame/drivers/tumbleb.c
@@ -704,7 +704,7 @@ ADDRESS_MAP_END
static READ16_HANDLER( semibase_unknown_r )
{
- return mame_rand(space->machine);
+ return space->machine->rand();
}
static ADDRESS_MAP_START( htchctch_main_map, ADDRESS_SPACE_PROGRAM, 16 )
diff --git a/src/mame/drivers/wheelfir.c b/src/mame/drivers/wheelfir.c
index 20a1de8616d..8b2ee7bcacd 100644
--- a/src/mame/drivers/wheelfir.c
+++ b/src/mame/drivers/wheelfir.c
@@ -286,7 +286,7 @@ static READ16_HANDLER( wheelfir_status_r )
*/
wheelfir_state *state = space->machine->driver_data<wheelfir_state>();
- return state->toggle_bit| (mame_rand(space->machine)&0x2000);
+ return state->toggle_bit| (space->machine->rand()&0x2000);
}
static WRITE16_HANDLER( wheelfir_scanline_cnt_w )
diff --git a/src/mame/machine/ajax.c b/src/mame/machine/ajax.c
index efcbae073fd..0e52be9ec84 100644
--- a/src/mame/machine/ajax.c
+++ b/src/mame/machine/ajax.c
@@ -113,7 +113,7 @@ READ8_HANDLER( ajax_ls138_f10_r )
switch ((offset & 0x01c0) >> 6)
{
case 0x00: /* ??? */
- data = mame_rand(space->machine);
+ data = space->machine->rand();
break;
case 0x04: /* 2P inputs */
data = input_port_read(space->machine, "P2");
diff --git a/src/mame/machine/bublbobl.c b/src/mame/machine/bublbobl.c
index e6385c156ed..06f540a97ce 100644
--- a/src/mame/machine/bublbobl.c
+++ b/src/mame/machine/bublbobl.c
@@ -323,7 +323,7 @@ READ8_HANDLER( boblbobl_ic43_a_r )
if (offset == 0)
return state->ic43_a << 4;
else
- return mame_rand(space->machine) & 0xff;
+ return space->machine->rand() & 0xff;
}
WRITE8_HANDLER( boblbobl_ic43_a_w )
@@ -505,7 +505,7 @@ WRITE8_HANDLER( bublbobl_68705_port_b_w )
if ((state->ddr_b & 0x20) && (~data & 0x20) && (state->port_b_out & 0x20))
{
/* hack to get random EXTEND letters (who is supposed to do this? 68705? PAL?) */
- state->mcu_sharedram[0x7c] = mame_rand(space->machine) % 6;
+ state->mcu_sharedram[0x7c] = space->machine->rand() % 6;
cpu_set_input_line_vector(state->maincpu, 0, state->mcu_sharedram[0]);
cpu_set_input_line(state->maincpu, 0, HOLD_LINE);
diff --git a/src/mame/machine/kaneko16.c b/src/mame/machine/kaneko16.c
index 79b7ca6dab7..256d0db3c31 100644
--- a/src/mame/machine/kaneko16.c
+++ b/src/mame/machine/kaneko16.c
@@ -92,7 +92,7 @@ READ16_HANDLER(galpanib_calc_r) /* Simulation of the CALC1 MCU */
return (((UINT32)hit.mult_a * (UINT32)hit.mult_b) & 0xffff);
case 0x14/2:
- return (mame_rand(space->machine) & 0xffff);
+ return (space->machine->rand() & 0xffff);
default:
logerror("CPU #0 PC %06x: warning - read unmapped calc address %06x\n",cpu_get_pc(space->cpu),offset<<1);
@@ -243,7 +243,7 @@ READ16_HANDLER(bloodwar_calc_r)
return data;
case 0x14/2:
- return (mame_rand(space->machine) & 0xffff);
+ return (space->machine->rand() & 0xffff);
case 0x20/2: return hit.x1p;
case 0x22/2: return hit.x1s;
@@ -488,7 +488,7 @@ static READ16_HANDLER(shogwarr_calc_r)
return shogwarr_hit.flags;
case 0x28:
- return (mame_rand(space->machine) & 0xffff);
+ return (space->machine->rand() & 0xffff);
case 0x40: return shogwarr_hit.x1po;
case 0x44: return shogwarr_hit.x1so;
diff --git a/src/mame/machine/konamigx.c b/src/mame/machine/konamigx.c
index a247ab39d92..1eda769fbe0 100644
--- a/src/mame/machine/konamigx.c
+++ b/src/mame/machine/konamigx.c
@@ -137,7 +137,7 @@ WRITE16_HANDLER( K055550_word_w )
else
if (dy < 0) i = 0x80;
else
- i = mame_rand(space->machine) & 0xff; // vector direction indeterminate
+ i = space->machine->rand() & 0xff; // vector direction indeterminate
prot_data[0x10] = i;
break;
diff --git a/src/mame/machine/midtunit.c b/src/mame/machine/midtunit.c
index 9133b95b3e1..5c21d2b67db 100644
--- a/src/mame/machine/midtunit.c
+++ b/src/mame/machine/midtunit.c
@@ -184,7 +184,7 @@ static READ16_HANDLER( mkturbo_prot_r )
{
/* the security GAL overlays a counter of some sort at 0xfffff400 in ROM space.
* A startup protection check expects to read back two different values in succession */
- return mame_rand(space->machine);
+ return space->machine->rand();
}
diff --git a/src/mame/machine/midwayic.c b/src/mame/machine/midwayic.c
index 06b3a3b713a..06dd0d1caaf 100644
--- a/src/mame/machine/midwayic.c
+++ b/src/mame/machine/midwayic.c
@@ -126,8 +126,8 @@ static void generate_serial_data(running_machine *machine, int upper)
serial_digit[7] = (serial_number / 10) % 10;
serial_digit[8] = (serial_number / 1) % 10;
- serial.data[12] = mame_rand(machine) & 0xff;
- serial.data[13] = mame_rand(machine) & 0xff;
+ serial.data[12] = machine->rand() & 0xff;
+ serial.data[13] = machine->rand() & 0xff;
serial.data[14] = 0; /* ??? */
serial.data[15] = 0; /* ??? */
diff --git a/src/mame/machine/midyunit.c b/src/mame/machine/midyunit.c
index a381183c6a9..a1ebc916817 100644
--- a/src/mame/machine/midyunit.c
+++ b/src/mame/machine/midyunit.c
@@ -504,7 +504,7 @@ static READ16_HANDLER( mkturbo_prot_r )
{
/* the security GAL overlays a counter of some sort at 0xfffff400 in ROM space.
* A startup protection check expects to read back two different values in succession */
- return mame_rand(space->machine);
+ return space->machine->rand();
}
DRIVER_INIT( mkyturbo )
diff --git a/src/mame/machine/model1.c b/src/mame/machine/model1.c
index 11f6a3e7550..63b41274e9a 100644
--- a/src/mame/machine/model1.c
+++ b/src/mame/machine/model1.c
@@ -679,7 +679,7 @@ static TGP_FUNCTION( f42 )
(void)b;
(void)c;
logerror("TGP f42 %f, %f, %f (%x)\n", a, b, c, pushpc);
- // fifoout_push_f((mame_rand(machine) % 1000) - 500);
+ // fifoout_push_f((machine->rand() % 1000) - 500);
fifoout_push_f(0);
fifoout_push_f(0);
fifoout_push_f(0);
@@ -1531,7 +1531,7 @@ static TGP_FUNCTION( f100 )
int i;
logerror("TGP f100 get list (%x)\n", pushpc);
for(i=0; i<list_length; i++)
- fifoout_push_f((mame_rand(machine) % 1000)/100.0);
+ fifoout_push_f((machine->rand() % 1000)/100.0);
next_fn();
}
diff --git a/src/mame/machine/namcos1.c b/src/mame/machine/namcos1.c
index 099a25153bf..8d4af1a21ff 100644
--- a/src/mame/machine/namcos1.c
+++ b/src/mame/machine/namcos1.c
@@ -532,7 +532,7 @@ static READ8_HANDLER( key_type3_r )
op = (offset & 0x70) >> 4;
if (op == key_reg) return key_id;
- if (op == key_rng) return mame_rand(space->machine);
+ if (op == key_rng) return space->machine->rand();
if (op == key_swap4) return (key[key_swap4_arg] << 4) | (key[key_swap4_arg] >> 4);
if (op == key_bottom4) return (offset << 4) | (key[key_swap4_arg] & 0x0f);
if (op == key_top4) return (offset << 4) | (key[key_swap4_arg] >> 4);
diff --git a/src/mame/machine/namcos2.c b/src/mame/machine/namcos2.c
index 1821309c002..e9f4761be7a 100644
--- a/src/mame/machine/namcos2.c
+++ b/src/mame/machine/namcos2.c
@@ -343,7 +343,7 @@ READ16_HANDLER( namcos2_68k_key_r )
// case 3: return 0x142;
case 4: return 0x142;
// case 3: popmessage("blah %08x",cpu_get_pc(space->cpu));
- default: return mame_rand(space->machine);
+ default: return space->machine->rand();
}
break;
@@ -400,7 +400,7 @@ READ16_HANDLER( namcos2_68k_key_r )
- return mame_rand(space->machine)&0xffff;
+ return space->machine->rand()&0xffff;
}
WRITE16_HANDLER( namcos2_68k_key_w )
diff --git a/src/mame/machine/rainbow.c b/src/mame/machine/rainbow.c
index 010673fc2a5..b810e79c00d 100644
--- a/src/mame/machine/rainbow.c
+++ b/src/mame/machine/rainbow.c
@@ -714,7 +714,7 @@ static void request_world_data( running_machine *machine )
static void request_goalin_data( running_machine *machine )
{
rainbow_state *state = machine->driver_data<rainbow_state>();
- int n = mame_rand(machine) % 15;
+ int n = machine->rand() % 15;
state->CRAM[1][0x14B] = 0x00; /* x coordinates */
state->CRAM[1][0x14D] = 0x10;
diff --git a/src/mame/machine/seicop.c b/src/mame/machine/seicop.c
index 37b2be24208..d034fff0b9e 100644
--- a/src/mame/machine/seicop.c
+++ b/src/mame/machine/seicop.c
@@ -2031,7 +2031,7 @@ static READ16_HANDLER( generic_cop_r )
/* needed by Godzilla for selecting a character ... rng? PIT? */
case 0x1a4/2:
- return mame_rand(space->machine);
+ return space->machine->rand();
case 0x1b0/2:
return cop_status;
diff --git a/src/mame/machine/slapfght.c b/src/mame/machine/slapfght.c
index d6bd2e2df38..67334c162f7 100644
--- a/src/mame/machine/slapfght.c
+++ b/src/mame/machine/slapfght.c
@@ -931,5 +931,5 @@ WRITE8_HANDLER( tigerhb_e803_w )
READ8_HANDLER( perfrman_port_00_r )
{
/* TODO */
- return mame_rand(space->machine) & 1;
+ return space->machine->rand() & 1;
}
diff --git a/src/mame/machine/starwars.c b/src/mame/machine/starwars.c
index 9cc4b8b1478..2359a013ffb 100644
--- a/src/mame/machine/starwars.c
+++ b/src/mame/machine/starwars.c
@@ -401,7 +401,7 @@ READ8_HANDLER( starwars_prng_r )
*/
/* Use MAME's PRNG for now */
- return mame_rand(space->machine);
+ return space->machine->rand();
}
diff --git a/src/mame/machine/tait8741.c b/src/mame/machine/tait8741.c
index 4df82cf1c83..e0367526804 100644
--- a/src/mame/machine/tait8741.c
+++ b/src/mame/machine/tait8741.c
@@ -614,9 +614,9 @@ static INT8 cyclemb_8741_r(address_space *space,int num,int offset)
static UINT8 mux_r;
mux_r^=0x20;
if(mux_r & 0x20)
- cyclemb_mcu.rxd = ((input_port_read(space->machine,"DSW3")) & 0x9f) | (mux_r) | (mame_rand(space->machine) & 0x40);
+ cyclemb_mcu.rxd = ((input_port_read(space->machine,"DSW3")) & 0x9f) | (mux_r) | (space->machine->rand() & 0x40);
else
- cyclemb_mcu.rxd = ((input_port_read(space->machine,"IN0")) & 0x9f) | (mux_r) | (mame_rand(space->machine) & 0x40);
+ cyclemb_mcu.rxd = ((input_port_read(space->machine,"IN0")) & 0x9f) | (mux_r) | (space->machine->rand() & 0x40);
}
break;
}
diff --git a/src/mame/video/40love.c b/src/mame/video/40love.c
index 4e78d0b9ab3..c75865f000d 100644
--- a/src/mame/video/40love.c
+++ b/src/mame/video/40love.c
@@ -300,7 +300,7 @@ static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rect
color = (spriteram[offs + 2] & 0x07) + 0x08;
if (spriteram[offs + 2] & 0xe0)
- color = mame_rand(machine) & 0xf;
+ color = machine->rand() & 0xf;
drawgfx_transpen(bitmap,cliprect,machine->gfx[1],
code,
@@ -328,7 +328,7 @@ static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rect
color = (spriteram_2[offs + 2] & 0x07) + 0x08;
if (spriteram_2[offs + 2] & 0xe0)
- color = mame_rand(machine) & 0xf;
+ color = machine->rand() & 0xf;
drawgfx_transpen(bitmap,cliprect,machine->gfx[1],
code,
diff --git a/src/mame/video/atarirle.c b/src/mame/video/atarirle.c
index 70169e7b9ac..9b96a65cb1e 100644
--- a/src/mame/video/atarirle.c
+++ b/src/mame/video/atarirle.c
@@ -877,13 +877,13 @@ if (hilite)
for (ty = sy; ty <= ey; ty++)
{
- *BITMAP_ADDR16(bitmap1, ty, sx) = mame_rand(machine) & 0xff;
- *BITMAP_ADDR16(bitmap1, ty, ex) = mame_rand(machine) & 0xff;
+ *BITMAP_ADDR16(bitmap1, ty, sx) = machine->rand() & 0xff;
+ *BITMAP_ADDR16(bitmap1, ty, ex) = machine->rand() & 0xff;
}
for (tx = sx; tx <= ex; tx++)
{
- *BITMAP_ADDR16(bitmap1, sy, tx) = mame_rand(machine) & 0xff;
- *BITMAP_ADDR16(bitmap1, ey, tx) = mame_rand(machine) & 0xff;
+ *BITMAP_ADDR16(bitmap1, sy, tx) = machine->rand() & 0xff;
+ *BITMAP_ADDR16(bitmap1, ey, tx) = machine->rand() & 0xff;
}
} while (0);
fprintf(stderr, " Sprite: c=%04X l=%04X h=%d X=%4d (o=%4d w=%3d) Y=%4d (o=%4d h=%d) s=%04X\n",
diff --git a/src/mame/video/avgdvg.c b/src/mame/video/avgdvg.c
index 1aab254b8f9..8f2051157ca 100644
--- a/src/mame/video/avgdvg.c
+++ b/src/mame/video/avgdvg.c
@@ -811,7 +811,7 @@ static int mhavoc_strobe2(vgdata *vg)
| ((vg->dvy >> 1) & 2)
| ((vg->dvy << 1) & 4)
| ((vg->dvy << 2) & 8)
- | ((mame_rand(vg->machine) & 0x7) << 4);
+ | ((vg->machine->rand() & 0x7) << 4);
}
else
{
diff --git a/src/mame/video/crshrace.c b/src/mame/video/crshrace.c
index 08429a48608..4f8f7de2050 100644
--- a/src/mame/video/crshrace.c
+++ b/src/mame/video/crshrace.c
@@ -132,7 +132,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
zoomx = 16 - zoomtable[zoomx] / 8;
zoomy = 16 - zoomtable[zoomy] / 8;
- if (buffered_spriteram[attr_start + 2] & 0x20ff) color = mame_rand(machine);
+ if (buffered_spriteram[attr_start + 2] & 0x20ff) color = machine->rand();
for (y = 0; y <= ysize; y++)
{
diff --git a/src/mame/video/darkmist.c b/src/mame/video/darkmist.c
index 32c82dfad95..d4baedc1ea5 100644
--- a/src/mame/video/darkmist.c
+++ b/src/mame/video/darkmist.c
@@ -177,7 +177,7 @@ VIDEO_UPDATE( darkmist)
palette=((spriteram[i+1])>>1)&0xf;
if(spriteram[i+1]&0x1)
- palette=mame_rand(screen->machine)&15;
+ palette=screen->machine->rand()&15;
palette+=32;
diff --git a/src/mame/video/dkong.c b/src/mame/video/dkong.c
index 77d7305865e..647c05a927e 100644
--- a/src/mame/video/dkong.c
+++ b/src/mame/video/dkong.c
@@ -738,7 +738,7 @@ static void radarscp_step(running_machine *machine, int line_cnt)
if (line_cnt>=512)
line_cnt=512-VTOTAL;
- if ( ( !(line_cnt & 0x40) && ((line_cnt+1) & 0x40) ) && (mame_rand(machine) > RAND_MAX/2))
+ if ( ( !(line_cnt & 0x40) && ((line_cnt+1) & 0x40) ) && (machine->rand() > RAND_MAX/2))
state->sig30Hz = (1-state->sig30Hz);
/* Now mix with SND02 (sound 2) line - on 74ls259, bit2 */
diff --git a/src/mame/video/dynduke.c b/src/mame/video/dynduke.c
index 945e9c93e32..f95d8644f7f 100644
--- a/src/mame/video/dynduke.c
+++ b/src/mame/video/dynduke.c
@@ -213,7 +213,7 @@ static void draw_background(running_machine *machine, bitmap_t *bitmap, const re
if ((srcdat & 0x20) == pri)
{
if (srcdat & 0x10) srcdat += 0x400;
- //if (srcdat & 0x10) srcdat += mame_rand(machine)&0x1f;
+ //if (srcdat & 0x10) srcdat += machine->rand()&0x1f;
srcdat = (srcdat & 0x000f) | ((srcdat & 0xffc0) >> 2);
dst[x] = srcdat;
diff --git a/src/mame/video/f1gp.c b/src/mame/video/f1gp.c
index 2860d314a1b..f9a62fbea63 100644
--- a/src/mame/video/f1gp.c
+++ b/src/mame/video/f1gp.c
@@ -307,7 +307,7 @@ static void f1gpb_draw_sprites( running_machine *machine, bitmap_t *bitmap,const
if((spriteram[attr_start + 1] & 0x00f0) && (spriteram[attr_start + 1] & 0x00f0) != 0xc0)
{
printf("attr %X\n",spriteram[attr_start + 1] & 0x00f0);
- code = mame_rand(machine);
+ code = machine->rand();
}
/*
@@ -405,7 +405,7 @@ static void f1gp2_draw_sprites( running_machine *machine, bitmap_t *bitmap, cons
zoomy = 32 - zoomy;
if (state->spritelist[attr_start + 2] & 0x20ff)
- color = mame_rand(machine);
+ color = machine->rand();
for (y = 0; y <= ysize; y++)
{
diff --git a/src/mame/video/galpani2.c b/src/mame/video/galpani2.c
index 6edb07bdf87..d995c982c12 100644
--- a/src/mame/video/galpani2.c
+++ b/src/mame/video/galpani2.c
@@ -37,7 +37,7 @@ READ16_HANDLER( galpani2_bg8_regs_##_n_##_r ) \
{ \
switch (offset * 2) \
{ \
- case 0x16: return mame_rand(space->machine) & 1; \
+ case 0x16: return space->machine->rand() & 1; \
default: \
logerror("CPU #0 PC %06X : Warning, bg8 #%d screen reg %04X read\n",cpu_get_pc(space->cpu),_n_,offset*2); \
} \
diff --git a/src/mame/video/konicdev.c b/src/mame/video/konicdev.c
index 8029a404ca4..99890b07c37 100644
--- a/src/mame/video/konicdev.c
+++ b/src/mame/video/konicdev.c
@@ -10401,8 +10401,8 @@ READ32_DEVICE_HANDLER( k001604_reg_r )
switch (offset)
{
- case 0x54/4: return mame_rand(device->machine) << 16; break;
- case 0x5c/4: return mame_rand(device->machine) << 16 | mame_rand(device->machine); break;
+ case 0x54/4: return device->machine->rand() << 16; break;
+ case 0x5c/4: return device->machine->rand() << 16 | device->machine->rand(); break;
}
return k001604->reg[offset];
diff --git a/src/mame/video/macrossp.c b/src/mame/video/macrossp.c
index 9b83cc6faee..04a12dc046a 100644
--- a/src/mame/video/macrossp.c
+++ b/src/mame/video/macrossp.c
@@ -35,7 +35,7 @@ static TILE_GET_INFO( get_macrossp_scra_tile_info )
break;
default:
- color = mame_rand(machine) & 7;
+ color = machine->rand() & 7;
break;
}
@@ -73,7 +73,7 @@ static TILE_GET_INFO( get_macrossp_scrb_tile_info )
break;
default:
- color = mame_rand(machine) & 7;
+ color = machine->rand() & 7;
break;
}
@@ -111,7 +111,7 @@ static TILE_GET_INFO( get_macrossp_scrc_tile_info )
break;
default:
- color = mame_rand(machine) & 7;
+ color = machine->rand() & 7;
break;
}
@@ -232,7 +232,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
break;
default:
- col = mame_rand(machine);
+ col = machine->rand();
break;
}
diff --git a/src/mame/video/ms32.c b/src/mame/video/ms32.c
index 8c267619816..7ccc81df19b 100644
--- a/src/mame/video/ms32.c
+++ b/src/mame/video/ms32.c
@@ -542,7 +542,7 @@ VIDEO_UPDATE( ms32 )
}
else if (primask == 0xc0)
{
- dstptr_bitmap[xx] = paldata[mame_rand(screen->machine)&0xfff];
+ dstptr_bitmap[xx] = paldata[screen->machine->rand()&0xfff];
}
else if (primask == 0xf0)
{
@@ -626,12 +626,12 @@ VIDEO_UPDATE( ms32 )
}
else if (src_tilepri==0x06)
{
- //dstptr_bitmap[xx] = paldata[mame_rand(screen->machine)&0xfff];
+ //dstptr_bitmap[xx] = paldata[screen->machine->rand()&0xfff];
dstptr_bitmap[xx] = paldata[src_tile]; // assumed
}
else if (src_tilepri==0x07)
{
- //dstptr_bitmap[xx] = paldata[mame_rand(screen->machine)&0xfff];
+ //dstptr_bitmap[xx] = paldata[screen->machine->rand()&0xfff];
dstptr_bitmap[xx] = paldata[src_tile]; // assumed
}
}
diff --git a/src/mame/video/n64.c b/src/mame/video/n64.c
index dc02762504c..ba6c3be03ac 100644
--- a/src/mame/video/n64.c
+++ b/src/mame/video/n64.c
@@ -182,7 +182,7 @@ void Processor::VideoUpdate16(bitmap_t *bitmap)
/*
if (gamma_dither)
{
- dith = mame_rand(screen->machine) & 0x3f;
+ dith = screen->machine->rand() & 0x3f;
}
if (gamma)
{
@@ -412,7 +412,7 @@ void Processor::ColorCombiner1Cycle(bool noisecompute)
{
if (noisecompute)
{
- m_noise_color.i.r = m_noise_color.i.g = m_noise_color.i.b = mame_rand(m_machine) & 0xff; // Not accurate...
+ m_noise_color.i.r = m_noise_color.i.g = m_noise_color.i.b = m_machine->rand() & 0xff; // Not accurate...
}
m_pixel_color.i.r = ColorCombinerEquation(*m_color_inputs.combiner_rgbsub_a_r[1],*m_color_inputs.combiner_rgbsub_b_r[1],*m_color_inputs.combiner_rgbmul_r[1],*m_color_inputs.combiner_rgbadd_r[1]);
@@ -428,7 +428,7 @@ void Processor::ColorCombiner2Cycle(bool noisecompute)
{
if (noisecompute)
{
- m_noise_color.i.r = m_noise_color.i.g = m_noise_color.i.b = mame_rand(m_machine) & 0xff; // HACK
+ m_noise_color.i.r = m_noise_color.i.g = m_noise_color.i.b = m_machine->rand() & 0xff; // HACK
}
m_combined_color.i.r = ColorCombinerEquation(*m_color_inputs.combiner_rgbsub_a_r[0],*m_color_inputs.combiner_rgbsub_b_r[0],*m_color_inputs.combiner_rgbmul_r[0],*m_color_inputs.combiner_rgbadd_r[0]);
@@ -939,7 +939,7 @@ void Processor::GetDitherValues(int x, int y, int* cdith, int* adith)
break;
case 2:
*cdith = s_magic_matrix[dithindex];
- *adith = mame_rand(m_machine) & 7;
+ *adith = m_machine->rand() & 7;
break;
case 3:
*cdith = s_magic_matrix[dithindex];
@@ -954,26 +954,26 @@ void Processor::GetDitherValues(int x, int y, int* cdith, int* adith)
break;
case 6:
*cdith = s_bayer_matrix[dithindex];
- *adith = mame_rand(m_machine) & 7;
+ *adith = m_machine->rand() & 7;
break;
case 7:
*cdith = s_bayer_matrix[dithindex];
*adith = 0;
break;
case 8:
- *cdith = mame_rand(m_machine) & 7;
+ *cdith = m_machine->rand() & 7;
*adith = s_magic_matrix[dithindex];
break;
case 9:
- *cdith = mame_rand(m_machine) & 7;
+ *cdith = m_machine->rand() & 7;
*adith = (~s_magic_matrix[dithindex]) & 7;
break;
case 10:
- *cdith = mame_rand(m_machine) & 7;
+ *cdith = m_machine->rand() & 7;
*adith = (*cdith + 17) & 7;
break;
case 11:
- *cdith = mame_rand(m_machine) & 7;
+ *cdith = m_machine->rand() & 7;
*adith = 0;
break;
case 12:
@@ -986,7 +986,7 @@ void Processor::GetDitherValues(int x, int y, int* cdith, int* adith)
break;
case 14:
*cdith = 0;
- *adith = mame_rand(m_machine) & 7;
+ *adith = m_machine->rand() & 7;
break;
case 15:
*adith = *cdith = 0;
diff --git a/src/mame/video/rdpblend.c b/src/mame/video/rdpblend.c
index a3260f0a708..7a48b28c813 100644
--- a/src/mame/video/rdpblend.c
+++ b/src/mame/video/rdpblend.c
@@ -243,7 +243,7 @@ bool Blender::AlphaCompare(UINT8 alpha)
INT32 threshold;
if (m_other_modes->alpha_compare_en)
{
- threshold = (m_other_modes->dither_alpha_en) ? (mame_rand(m_machine) & 0xff) : m_rdp->GetBlendColor()->i.a;
+ threshold = (m_other_modes->dither_alpha_en) ? (m_machine->rand() & 0xff) : m_rdp->GetBlendColor()->i.a;
if (alpha < threshold)
{
return false;
diff --git a/src/mame/video/sbugger.c b/src/mame/video/sbugger.c
index 392cb780504..a09e88bccaa 100644
--- a/src/mame/video/sbugger.c
+++ b/src/mame/video/sbugger.c
@@ -51,9 +51,9 @@ PALETTE_INIT(sbugger)
for (i = 0;i < 256;i++)
{
- int r = mame_rand(machine)|0x80;
- int g = mame_rand(machine)|0x80;
- int b = mame_rand(machine)|0x80;
+ int r = machine->rand()|0x80;
+ int g = machine->rand()|0x80;
+ int b = machine->rand()|0x80;
if (i == 0) r = g = b = 0;
palette_set_color(machine,i*2+1,MAKE_RGB(r,g,b));
diff --git a/src/mame/video/seta2.c b/src/mame/video/seta2.c
index cf2c5c29402..45e16f21d42 100644
--- a/src/mame/video/seta2.c
+++ b/src/mame/video/seta2.c
@@ -191,7 +191,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
{
default:
popmessage("unknown gfxset %x",(num & 0x0700)>>8);
- gfx = mame_rand(machine)&3; break;
+ gfx = machine->rand()&3; break;
case 0x0700: // 8bpp tiles (76543210)
gfx = 3; break;
case 0x0600: // 6bpp tiles (--543210) (myangel sliding blocks test)
diff --git a/src/mame/video/st0016.c b/src/mame/video/st0016.c
index f4708dde3fe..0eaddfe49b5 100644
--- a/src/mame/video/st0016.c
+++ b/src/mame/video/st0016.c
@@ -144,7 +144,7 @@ READ8_HANDLER(st0016_vregs_r)
{
case 0:
case 1:
- return mame_rand(space->machine);
+ return space->machine->rand();
}
return st0016_vregs[offset];
diff --git a/src/mame/video/stvvdp1.c b/src/mame/video/stvvdp1.c
index 6bb7e934ac6..0fbe4271697 100644
--- a/src/mame/video/stvvdp1.c
+++ b/src/mame/video/stvvdp1.c
@@ -962,7 +962,7 @@ static void drawpixel_generic(running_machine *machine, int x, int y, int patter
pix = pix+(stv2_current_sprite.CMDCOLR&0xff80);
transmask = 0x7f;
mode = 3;
- // pix = mame_rand(machine);
+ // pix = machine->rand();
break;
case 0x0020: // mode 4 256 colour bank mode (8bits) (hanagumi title)
pix = gfxdata[patterndata+offsetcnt];
@@ -976,7 +976,7 @@ static void drawpixel_generic(running_machine *machine, int x, int y, int patter
transmask = 0xffff;
break;
default: // other settings illegal
- pix = mame_rand(machine);
+ pix = machine->rand();
mode = 0;
transmask = 0xff;
}