Made k051733 RNG to behave like an adder, improves pseudo-random events in Fast Lane [Angelo Salese]

This commit is contained in:
Angelo Salese 2011-05-01 22:54:18 +00:00
parent 6d3978f1ed
commit a70ef51f08
4 changed files with 27 additions and 28 deletions

View File

@ -64,7 +64,6 @@ hard drive 3.5 adapter long 3.5 IDE cable 3.5 adapter PCB
*/
#include "emu.h"
#include "deprecat.h"
#include "cpu/m68000/m68000.h"
#include "machine/idectrl.h"
#include "sound/k054539.h"

View File

@ -79,7 +79,6 @@ be verified on real PCB.
#include "emu.h"
#include "cpu/z80/z80.h"
#include "cpu/m68000/m68000.h"
#include "deprecat.h"
#include "sound/2203intf.h"
#include "sound/2151intf.h"
#include "sound/okim6295.h"
@ -1071,20 +1070,24 @@ static MACHINE_CONFIG_START( primella, dooyong_state )
MCFG_FRAGMENT_ADD( sound_2151 )
MACHINE_CONFIG_END
static INTERRUPT_GEN( rshark_interrupt )
static TIMER_DEVICE_CALLBACK( rshark_scanline )
{
if (cpu_getiloops(device) == 0)
device_set_input_line(device, 5, HOLD_LINE);
else
device_set_input_line(device, 6, HOLD_LINE);
int scanline = param;
if(scanline == 248) // vblank-out irq
cputag_set_input_line(timer.machine(), "maincpu", 5, HOLD_LINE);
if(scanline == 120) // timer irq?
cputag_set_input_line(timer.machine(), "maincpu", 6, HOLD_LINE);
}
static MACHINE_CONFIG_START( rshark, dooyong_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", M68000, 8000000) /* measured on super-x */
MCFG_CPU_PROGRAM_MAP(rshark_map)
MCFG_CPU_VBLANK_INT_HACK(rshark_interrupt,2) /* 5 and 6 */
MCFG_TIMER_ADD_SCANLINE("scantimer", rshark_scanline, "screen", 0, 1)
MCFG_CPU_ADD("audiocpu", Z80, 4000000) /* measured on super-x */
MCFG_CPU_PROGRAM_MAP(bluehawk_sound_map)
@ -1115,7 +1118,7 @@ static MACHINE_CONFIG_START( superx, dooyong_state ) // dif mem map
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", M68000, 8000000) /* measured on super-x */
MCFG_CPU_PROGRAM_MAP(superx_map)
MCFG_CPU_VBLANK_INT_HACK(rshark_interrupt,2) /* 5 and 6 */
MCFG_TIMER_ADD_SCANLINE("scantimer", rshark_scanline, "screen", 0, 1)
MCFG_CPU_ADD("audiocpu", Z80, 4000000) /* measured on super-x */
MCFG_CPU_PROGRAM_MAP(bluehawk_sound_map)
@ -1146,7 +1149,7 @@ static MACHINE_CONFIG_START( popbingo, dooyong_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", M68000, 10000000)
MCFG_CPU_PROGRAM_MAP(popbingo_map)
MCFG_CPU_VBLANK_INT_HACK(rshark_interrupt,2) /* 5 and 6 */
MCFG_TIMER_ADD_SCANLINE("scantimer", rshark_scanline, "screen", 0, 1)
MCFG_CPU_ADD("audiocpu", Z80, 4000000) /* measured on super-x */
MCFG_CPU_PROGRAM_MAP(bluehawk_sound_map)

View File

@ -5,35 +5,29 @@
Driver by Manuel Abadia <manu@teleline.es>
TODO:
- colors don't seem 100% accurate.
- verify that sound is correct (volume and bank switching)
***************************************************************************/
#include "emu.h"
#include "deprecat.h"
#include "cpu/hd6309/hd6309.h"
#include "sound/k007232.h"
#include "video/konicdev.h"
#include "includes/konamipt.h"
#include "includes/fastlane.h"
static INTERRUPT_GEN( fastlane_interrupt )
static TIMER_DEVICE_CALLBACK( fastlane_scanline )
{
fastlane_state *state = device->machine().driver_data<fastlane_state>();
fastlane_state *state = timer.machine().driver_data<fastlane_state>();
int scanline = param;
if (cpu_getiloops(device) == 0)
{
if (k007121_ctrlram_r(state->m_k007121, 7) & 0x02)
device_set_input_line(device, HD6309_IRQ_LINE, HOLD_LINE);
}
else if (cpu_getiloops(device) % 2)
{
if (k007121_ctrlram_r(state->m_k007121, 7) & 0x01)
device_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE);
}
if(scanline == 240 && k007121_ctrlram_r(state->m_k007121, 7) & 0x02) // vblank irq
cputag_set_input_line(timer.machine(), "maincpu", HD6309_IRQ_LINE, HOLD_LINE);
else if(((scanline % 32) == 0) && k007121_ctrlram_r(state->m_k007121, 7) & 0x01) // timer irq
cputag_set_input_line(timer.machine(), "maincpu", INPUT_LINE_NMI, PULSE_LINE);
}
static WRITE8_HANDLER( k007121_registers_w )
{
fastlane_state *state = space->machine().driver_data<fastlane_state>();
@ -215,7 +209,7 @@ static MACHINE_CONFIG_START( fastlane, fastlane_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", HD6309, 3000000*4) /* 24MHz/8? */
MCFG_CPU_PROGRAM_MAP(fastlane_map)
MCFG_CPU_VBLANK_INT_HACK(fastlane_interrupt,16) /* 1 IRQ + ??? NMI (generated by the 007121) */
MCFG_TIMER_ADD_SCANLINE("scantimer", fastlane_scanline, "screen", 0, 1)
MCFG_MACHINE_START(fastlane)

View File

@ -5894,6 +5894,7 @@ typedef struct _k051733_state k051733_state;
struct _k051733_state
{
UINT8 ram[0x20];
UINT8 rng;
};
/*****************************************************************************
@ -5953,8 +5954,6 @@ READ8_DEVICE_HANDLER( k051733_r )
int yobj2c = (k051733->ram[0x0c] << 8) | k051733->ram[0x0d];
int xobj2c = (k051733->ram[0x0e] << 8) | k051733->ram[0x0f];
//logerror("%04x: read 051733 address %02x\n", cpu_get_pc(&space->device()), offset);
switch (offset)
{
case 0x00:
@ -5987,7 +5986,8 @@ READ8_DEVICE_HANDLER( k051733_r )
return k051733_int_sqrt(op3 << 16) & 0xff;
case 0x06:
return k051733->ram[0x13]; //RNG read, used by Chequered Flag for differentiate cars, could be wrong
k051733->rng += k051733->ram[0x13];
return k051733->rng; //RNG read, used by Chequered Flag for differentiate cars, implementation is a raw guess
case 0x07:{ /* note: Chequered Flag definitely wants all these bits to be enabled */
if (xobj1c + rad < xobj2c)
@ -6022,6 +6022,7 @@ static DEVICE_START( k051733 )
k051733_state *k051733 = k051733_get_safe_token(device);
device->save_item(NAME(k051733->ram));
device->save_item(NAME(k051733->rng));
}
static DEVICE_RESET( k051733 )
@ -6031,6 +6032,8 @@ static DEVICE_RESET( k051733 )
for (i = 0; i < 0x20; i++)
k051733->ram[i] = 0;
k051733->rng = 0;
}