mirror of
https://github.com/holub/mame
synced 2025-05-12 17:14:19 +03:00
Fix ldplayer, and convert the driver to modern style.
This commit is contained in:
parent
23f4601cab
commit
60965715b2
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -1282,8 +1282,8 @@ src/emu/video/voodoo.h svneol=native#text/plain
|
|||||||
src/emu/watchdog.c svneol=native#text/plain
|
src/emu/watchdog.c svneol=native#text/plain
|
||||||
src/emu/watchdog.h svneol=native#text/plain
|
src/emu/watchdog.h svneol=native#text/plain
|
||||||
src/ldplayer/layout/pr8210.lay svneol=native#text/plain
|
src/ldplayer/layout/pr8210.lay svneol=native#text/plain
|
||||||
src/ldplayer/ldpdriv.c svneol=native#text/plain
|
|
||||||
src/ldplayer/ldplayer.c svneol=native#text/plain
|
src/ldplayer/ldplayer.c svneol=native#text/plain
|
||||||
|
src/ldplayer/ldplayer.lst svneol=native#text/plain
|
||||||
src/ldplayer/ldplayer.mak svneol=native#text/plain
|
src/ldplayer/ldplayer.mak svneol=native#text/plain
|
||||||
src/lib/expat/ascii.h svneol=native#text/plain
|
src/lib/expat/ascii.h svneol=native#text/plain
|
||||||
src/lib/expat/asciitab.h svneol=native#text/plain
|
src/lib/expat/asciitab.h svneol=native#text/plain
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
/******************************************************************************
|
|
||||||
|
|
||||||
ldpdriv.c
|
|
||||||
|
|
||||||
mamedriv.c substitute file for "ldplayer" MAME builds.
|
|
||||||
|
|
||||||
Copyright Nicola Salmoria and the MAME Team.
|
|
||||||
Visit http://mamedev.org for licensing and usage restrictions.
|
|
||||||
|
|
||||||
The list of used drivers. Drivers have to be included here to be recognized
|
|
||||||
by the executable.
|
|
||||||
|
|
||||||
To save some typing, we use a hack here. This file is recursively #included
|
|
||||||
twice, with different definitions of the DRIVER() macro. The first one
|
|
||||||
declares external references to the drivers; the second one builds an array
|
|
||||||
storing all the drivers.
|
|
||||||
|
|
||||||
******************************************************************************/
|
|
||||||
|
|
||||||
#include "emu.h"
|
|
||||||
|
|
||||||
#ifndef DRIVER_RECURSIVE
|
|
||||||
|
|
||||||
#define DRIVER_RECURSIVE
|
|
||||||
|
|
||||||
/* step 1: declare all external references */
|
|
||||||
#define DRIVER(NAME) extern game_driver driver_##NAME;
|
|
||||||
#include "ldpdriv.c"
|
|
||||||
|
|
||||||
/* step 2: define the drivers[] array */
|
|
||||||
#undef DRIVER
|
|
||||||
#define DRIVER(NAME) &driver_##NAME,
|
|
||||||
const game_driver * const drivers[] =
|
|
||||||
{
|
|
||||||
#include "ldpdriv.c"
|
|
||||||
0 /* end of array */
|
|
||||||
};
|
|
||||||
|
|
||||||
#else /* DRIVER_RECURSIVE */
|
|
||||||
|
|
||||||
DRIVER( ldv1000 ) /* Pioneer LD-V1000 */
|
|
||||||
DRIVER( pr8210 ) /* Pioneer PR-8210 */
|
|
||||||
|
|
||||||
#endif /* DRIVER_RECURSIVE */
|
|
@ -26,53 +26,130 @@
|
|||||||
*
|
*
|
||||||
*************************************/
|
*************************************/
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
CMD_SCAN_REVERSE,
|
|
||||||
CMD_STEP_REVERSE,
|
|
||||||
CMD_SLOW_REVERSE,
|
|
||||||
CMD_FAST_REVERSE,
|
|
||||||
CMD_SCAN_FORWARD,
|
|
||||||
CMD_STEP_FORWARD,
|
|
||||||
CMD_SLOW_FORWARD,
|
|
||||||
CMD_FAST_FORWARD,
|
|
||||||
CMD_PLAY,
|
|
||||||
CMD_PAUSE,
|
|
||||||
CMD_FRAME_TOGGLE,
|
|
||||||
CMD_CHAPTER_TOGGLE,
|
|
||||||
CMD_CH1_TOGGLE,
|
|
||||||
CMD_CH2_TOGGLE,
|
|
||||||
CMD_0,
|
|
||||||
CMD_1,
|
|
||||||
CMD_2,
|
|
||||||
CMD_3,
|
|
||||||
CMD_4,
|
|
||||||
CMD_5,
|
|
||||||
CMD_6,
|
|
||||||
CMD_7,
|
|
||||||
CMD_8,
|
|
||||||
CMD_9,
|
|
||||||
CMD_SEARCH
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************
|
/*************************************
|
||||||
*
|
*
|
||||||
* Globals
|
* Globals
|
||||||
*
|
*
|
||||||
*************************************/
|
*************************************/
|
||||||
|
|
||||||
static astring filename;
|
class ldplayer_state : public driver_device
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// construction/destruction
|
||||||
|
ldplayer_state(running_machine &machine, const driver_device_config_base &config)
|
||||||
|
: driver_device(machine, config),
|
||||||
|
m_last_controls(0),
|
||||||
|
m_playing(false),
|
||||||
|
m_laserdisc(*this, "laserdisc") { }
|
||||||
|
|
||||||
static input_port_value last_controls;
|
// callback hook
|
||||||
static UINT8 playing;
|
static chd_file *get_disc_static(device_t *device) { return device->machine().driver_data<ldplayer_state>()->get_disc(); }
|
||||||
|
|
||||||
static emu_timer *pr8210_bit_timer;
|
protected:
|
||||||
static UINT32 pr8210_command_buffer_in, pr8210_command_buffer_out;
|
// device overrides
|
||||||
static UINT8 pr8210_command_buffer[10];
|
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
|
||||||
|
virtual void machine_start();
|
||||||
|
virtual void machine_reset();
|
||||||
|
|
||||||
static void (*execute_command)(device_t *laserdisc, int command);
|
// internal helpers
|
||||||
|
chd_file *get_disc();
|
||||||
|
void process_commands();
|
||||||
|
|
||||||
|
// derived classes
|
||||||
|
virtual void execute_command(int command) { assert(false); }
|
||||||
|
|
||||||
|
// timer IDs
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
TIMER_ID_AUTOPLAY,
|
||||||
|
TIMER_ID_VSYNC_UPDATE
|
||||||
|
};
|
||||||
|
|
||||||
|
// commands
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
CMD_SCAN_REVERSE,
|
||||||
|
CMD_STEP_REVERSE,
|
||||||
|
CMD_SLOW_REVERSE,
|
||||||
|
CMD_FAST_REVERSE,
|
||||||
|
CMD_SCAN_FORWARD,
|
||||||
|
CMD_STEP_FORWARD,
|
||||||
|
CMD_SLOW_FORWARD,
|
||||||
|
CMD_FAST_FORWARD,
|
||||||
|
CMD_PLAY,
|
||||||
|
CMD_PAUSE,
|
||||||
|
CMD_FRAME_TOGGLE,
|
||||||
|
CMD_CHAPTER_TOGGLE,
|
||||||
|
CMD_CH1_TOGGLE,
|
||||||
|
CMD_CH2_TOGGLE,
|
||||||
|
CMD_0,
|
||||||
|
CMD_1,
|
||||||
|
CMD_2,
|
||||||
|
CMD_3,
|
||||||
|
CMD_4,
|
||||||
|
CMD_5,
|
||||||
|
CMD_6,
|
||||||
|
CMD_7,
|
||||||
|
CMD_8,
|
||||||
|
CMD_9,
|
||||||
|
CMD_SEARCH
|
||||||
|
};
|
||||||
|
|
||||||
|
// internal state
|
||||||
|
astring m_filename;
|
||||||
|
input_port_value m_last_controls;
|
||||||
|
bool m_playing;
|
||||||
|
required_device<laserdisc_device> m_laserdisc;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class pr8210_state : public ldplayer_state
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// construction/destruction
|
||||||
|
pr8210_state(running_machine &machine, const driver_device_config_base &config)
|
||||||
|
: ldplayer_state(machine, config),
|
||||||
|
m_bit_timer(timer_alloc(TIMER_ID_BIT)),
|
||||||
|
m_command_buffer_in(0),
|
||||||
|
m_command_buffer_out(0) { }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// device overrides
|
||||||
|
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
|
||||||
|
virtual void machine_reset();
|
||||||
|
|
||||||
|
// command execution hook
|
||||||
|
virtual void execute_command(int command);
|
||||||
|
|
||||||
|
// internal helpers
|
||||||
|
inline void add_command(UINT8 command);
|
||||||
|
|
||||||
|
// timer IDs
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
TIMER_ID_BIT = 100,
|
||||||
|
TIMER_ID_BIT_OFF
|
||||||
|
};
|
||||||
|
|
||||||
|
// internal state
|
||||||
|
emu_timer *m_bit_timer;
|
||||||
|
UINT32 m_command_buffer_in;
|
||||||
|
UINT32 m_command_buffer_out;
|
||||||
|
UINT8 m_command_buffer[10];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class ldv1000_state : public ldplayer_state
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// construction/destruction
|
||||||
|
ldv1000_state(running_machine &machine, const driver_device_config_base &config)
|
||||||
|
: ldplayer_state(machine, config) { }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// command execution hook
|
||||||
|
virtual void execute_command(int command);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -82,62 +159,52 @@ static void (*execute_command)(device_t *laserdisc, int command);
|
|||||||
*
|
*
|
||||||
*************************************/
|
*************************************/
|
||||||
|
|
||||||
static void free_string(running_machine &machine)
|
chd_file *ldplayer_state::get_disc()
|
||||||
{
|
{
|
||||||
}
|
// open a path to the ROMs and find the first CHD file
|
||||||
|
file_enumerator path(machine().options().media_path());
|
||||||
|
|
||||||
|
// iterate while we get new objects
|
||||||
static chd_file *get_disc(device_t *device)
|
const osd_directory_entry *dir;
|
||||||
{
|
|
||||||
emu_file *image_file = NULL;
|
emu_file *image_file = NULL;
|
||||||
chd_file *image_chd = NULL;
|
chd_file *image_chd = NULL;
|
||||||
|
|
||||||
/* open a path to the ROMs and find the first CHD file */
|
|
||||||
file_enumerator path(device->machine().options().media_path());
|
|
||||||
const osd_directory_entry *dir;
|
|
||||||
|
|
||||||
/* iterate while we get new objects */
|
|
||||||
while ((dir = path.next()) != NULL)
|
while ((dir = path.next()) != NULL)
|
||||||
{
|
{
|
||||||
int length = strlen(dir->name);
|
int length = strlen(dir->name);
|
||||||
|
|
||||||
/* look for files ending in .chd */
|
// look for files ending in .chd
|
||||||
if (length > 4 &&
|
if (length > 4 &&
|
||||||
dir->name[length - 4] == '.' &&
|
dir->name[length - 4] == '.' &&
|
||||||
tolower(dir->name[length - 3]) == 'c' &&
|
tolower(dir->name[length - 3]) == 'c' &&
|
||||||
tolower(dir->name[length - 2]) == 'h' &&
|
tolower(dir->name[length - 2]) == 'h' &&
|
||||||
tolower(dir->name[length - 1]) == 'd')
|
tolower(dir->name[length - 1]) == 'd')
|
||||||
{
|
{
|
||||||
file_error filerr;
|
// open the file itself via our search path
|
||||||
chd_error chderr;
|
image_file = auto_alloc(machine(), emu_file(machine().options().media_path(), OPEN_FLAG_READ));
|
||||||
|
file_error filerr = image_file->open(dir->name);
|
||||||
/* open the file itself via our search path */
|
|
||||||
image_file = auto_alloc(device->machine(), emu_file(device->machine().options().media_path(), OPEN_FLAG_READ));
|
|
||||||
filerr = image_file->open(dir->name);
|
|
||||||
if (filerr == FILERR_NONE)
|
if (filerr == FILERR_NONE)
|
||||||
{
|
{
|
||||||
/* try to open the CHD */
|
// try to open the CHD
|
||||||
chderr = chd_open_file(*image_file, CHD_OPEN_READ, NULL, &image_chd);
|
chd_error chderr = chd_open_file(*image_file, CHD_OPEN_READ, NULL, &image_chd);
|
||||||
if (chderr == CHDERR_NONE)
|
if (chderr == CHDERR_NONE)
|
||||||
{
|
{
|
||||||
set_disk_handle(device->machine(), "laserdisc", *image_file, *image_chd);
|
set_disk_handle(machine(), "laserdisc", *image_file, *image_chd);
|
||||||
filename.cpy(dir->name);
|
m_filename.cpy(dir->name);
|
||||||
device->machine().add_notifier(MACHINE_NOTIFY_EXIT, free_string);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* close the file on failure */
|
// close the file on failure
|
||||||
auto_free(device->machine(), image_file);
|
auto_free(machine(), image_file);
|
||||||
image_file = NULL;
|
image_file = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if we failed, pop a message and exit */
|
// if we failed, pop a message and exit
|
||||||
if (image_file == NULL)
|
if (image_file == NULL)
|
||||||
fatalerror("No valid image file found!\n");
|
throw emu_fatalerror("No valid image file found!\n");
|
||||||
|
|
||||||
return get_disk_handle(device->machine(), "laserdisc");
|
return get_disk_handle(machine(), "laserdisc");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -148,119 +215,119 @@ static chd_file *get_disc(device_t *device)
|
|||||||
*
|
*
|
||||||
*************************************/
|
*************************************/
|
||||||
|
|
||||||
static void process_commands(device_t *laserdisc)
|
void ldplayer_state::process_commands()
|
||||||
{
|
{
|
||||||
input_port_value controls = input_port_read(laserdisc->machine(), "controls");
|
input_port_value controls = input_port_read(machine(), "controls");
|
||||||
int number;
|
int number;
|
||||||
|
|
||||||
/* step backwards */
|
// step backwards
|
||||||
if (!(last_controls & 0x01) && (controls & 0x01))
|
if (!(m_last_controls & 0x01) && (controls & 0x01))
|
||||||
(*execute_command)(laserdisc, CMD_STEP_REVERSE);
|
execute_command(CMD_STEP_REVERSE);
|
||||||
|
|
||||||
/* step forwards */
|
// step forwards
|
||||||
if (!(last_controls & 0x02) && (controls & 0x02))
|
if (!(m_last_controls & 0x02) && (controls & 0x02))
|
||||||
(*execute_command)(laserdisc, CMD_STEP_FORWARD);
|
execute_command(CMD_STEP_FORWARD);
|
||||||
|
|
||||||
/* scan backwards */
|
// scan backwards
|
||||||
if (controls & 0x04)
|
if (controls & 0x04)
|
||||||
(*execute_command)(laserdisc, CMD_SCAN_REVERSE);
|
execute_command(CMD_SCAN_REVERSE);
|
||||||
|
|
||||||
/* scan forwards */
|
// scan forwards
|
||||||
if (controls & 0x08)
|
if (controls & 0x08)
|
||||||
(*execute_command)(laserdisc, CMD_SCAN_FORWARD);
|
execute_command(CMD_SCAN_FORWARD);
|
||||||
|
|
||||||
/* slow backwards */
|
// slow backwards
|
||||||
if (!(last_controls & 0x10) && (controls & 0x10))
|
if (!(m_last_controls & 0x10) && (controls & 0x10))
|
||||||
(*execute_command)(laserdisc, CMD_SLOW_REVERSE);
|
execute_command(CMD_SLOW_REVERSE);
|
||||||
|
|
||||||
/* slow forwards */
|
// slow forwards
|
||||||
if (!(last_controls & 0x20) && (controls & 0x20))
|
if (!(m_last_controls & 0x20) && (controls & 0x20))
|
||||||
(*execute_command)(laserdisc, CMD_SLOW_FORWARD);
|
execute_command(CMD_SLOW_FORWARD);
|
||||||
|
|
||||||
/* fast backwards */
|
// fast backwards
|
||||||
if (controls & 0x40)
|
if (controls & 0x40)
|
||||||
(*execute_command)(laserdisc, CMD_FAST_REVERSE);
|
execute_command(CMD_FAST_REVERSE);
|
||||||
|
|
||||||
/* fast forwards */
|
// fast forwards
|
||||||
if (controls & 0x80)
|
if (controls & 0x80)
|
||||||
(*execute_command)(laserdisc, CMD_FAST_FORWARD);
|
execute_command(CMD_FAST_FORWARD);
|
||||||
|
|
||||||
/* play/pause */
|
// play/pause
|
||||||
if (!(last_controls & 0x100) && (controls & 0x100))
|
if (!(m_last_controls & 0x100) && (controls & 0x100))
|
||||||
{
|
{
|
||||||
playing = !playing;
|
m_playing = !m_playing;
|
||||||
(*execute_command)(laserdisc, playing ? CMD_PLAY : CMD_PAUSE);
|
execute_command(m_playing ? CMD_PLAY : CMD_PAUSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* toggle frame display */
|
// toggle frame display
|
||||||
if (!(last_controls & 0x200) && (controls & 0x200))
|
if (!(m_last_controls & 0x200) && (controls & 0x200))
|
||||||
(*execute_command)(laserdisc, CMD_FRAME_TOGGLE);
|
execute_command(CMD_FRAME_TOGGLE);
|
||||||
|
|
||||||
/* toggle chapter display */
|
// toggle chapter display
|
||||||
if (!(last_controls & 0x400) && (controls & 0x400))
|
if (!(m_last_controls & 0x400) && (controls & 0x400))
|
||||||
(*execute_command)(laserdisc, CMD_CHAPTER_TOGGLE);
|
execute_command(CMD_CHAPTER_TOGGLE);
|
||||||
|
|
||||||
/* toggle left channel */
|
// toggle left channel
|
||||||
if (!(last_controls & 0x800) && (controls & 0x800))
|
if (!(m_last_controls & 0x800) && (controls & 0x800))
|
||||||
(*execute_command)(laserdisc, CMD_CH1_TOGGLE);
|
execute_command(CMD_CH1_TOGGLE);
|
||||||
|
|
||||||
/* toggle right channel */
|
// toggle right channel
|
||||||
if (!(last_controls & 0x1000) && (controls & 0x1000))
|
if (!(m_last_controls & 0x1000) && (controls & 0x1000))
|
||||||
(*execute_command)(laserdisc, CMD_CH2_TOGGLE);
|
execute_command(CMD_CH2_TOGGLE);
|
||||||
|
|
||||||
/* numbers */
|
// numbers
|
||||||
for (number = 0; number < 10; number++)
|
for (number = 0; number < 10; number++)
|
||||||
if (!(last_controls & (0x10000 << number)) && (controls & (0x10000 << number)))
|
if (!(m_last_controls & (0x10000 << number)) && (controls & (0x10000 << number)))
|
||||||
(*execute_command)(laserdisc, CMD_0 + number);
|
execute_command(CMD_0 + number);
|
||||||
|
|
||||||
/* enter */
|
// enter
|
||||||
if (!(last_controls & 0x4000000) && (controls & 0x4000000))
|
if (!(m_last_controls & 0x4000000) && (controls & 0x4000000))
|
||||||
(*execute_command)(laserdisc, CMD_SEARCH);
|
execute_command(CMD_SEARCH);
|
||||||
|
|
||||||
last_controls = controls;
|
m_last_controls = controls;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static TIMER_CALLBACK( vsync_update )
|
void ldplayer_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
|
||||||
{
|
{
|
||||||
device_t *laserdisc = machine.m_devicelist.first(LASERDISC);
|
switch (id)
|
||||||
int vblank_scanline;
|
{
|
||||||
attotime target;
|
case TIMER_ID_VSYNC_UPDATE:
|
||||||
|
{
|
||||||
|
// handle commands
|
||||||
|
if (param == 0)
|
||||||
|
process_commands();
|
||||||
|
|
||||||
/* handle commands */
|
// set a timer to go off on the next VBLANK
|
||||||
if (!param)
|
int vblank_scanline = machine().primary_screen->visible_area().max_y + 1;
|
||||||
process_commands(laserdisc);
|
attotime target = machine().primary_screen->time_until_pos(vblank_scanline);
|
||||||
|
timer_set(target, TIMER_ID_VSYNC_UPDATE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* set a timer to go off on the next VBLANK */
|
case TIMER_ID_AUTOPLAY:
|
||||||
vblank_scanline = machine.primary_screen->visible_area().max_y + 1;
|
// start playing
|
||||||
target = machine.primary_screen->time_until_pos(vblank_scanline);
|
execute_command(CMD_PLAY);
|
||||||
machine.scheduler().timer_set(target, FUNC(vsync_update));
|
m_playing = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static MACHINE_START( ldplayer )
|
void ldplayer_state::machine_start()
|
||||||
{
|
{
|
||||||
vsync_update(machine, NULL, 1);
|
// start the vsync timer going
|
||||||
|
timer_set(attotime::zero, TIMER_ID_VSYNC_UPDATE, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static TIMER_CALLBACK( autoplay )
|
void ldplayer_state::machine_reset()
|
||||||
{
|
{
|
||||||
device_t *laserdisc = machine.m_devicelist.first(LASERDISC);
|
// set up a timer to start playing immediately
|
||||||
|
timer_set(attotime::zero, TIMER_ID_AUTOPLAY);
|
||||||
|
|
||||||
/* start playing */
|
// indicate the name of the file we opened
|
||||||
(*execute_command)(laserdisc, CMD_PLAY);
|
popmessage("Opened %s\n", m_filename.cstr());
|
||||||
playing = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static MACHINE_RESET( ldplayer )
|
|
||||||
{
|
|
||||||
/* set up a timer to start playing immediately */
|
|
||||||
machine.scheduler().timer_set(attotime::zero, FUNC(autoplay));
|
|
||||||
|
|
||||||
/* indicate the name of the file we opened */
|
|
||||||
popmessage("Opened %s\n", filename.cstr());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -271,153 +338,152 @@ static MACHINE_RESET( ldplayer )
|
|||||||
*
|
*
|
||||||
*************************************/
|
*************************************/
|
||||||
|
|
||||||
INLINE void pr8210_add_command(UINT8 command)
|
void pr8210_state::add_command(UINT8 command)
|
||||||
{
|
{
|
||||||
pr8210_command_buffer[pr8210_command_buffer_in++ % ARRAY_LENGTH(pr8210_command_buffer)] = (command & 0x1f) | 0x20;
|
m_command_buffer[m_command_buffer_in++ % ARRAY_LENGTH(m_command_buffer)] = (command & 0x1f) | 0x20;
|
||||||
pr8210_command_buffer[pr8210_command_buffer_in++ % ARRAY_LENGTH(pr8210_command_buffer)] = 0x00 | 0x20;
|
m_command_buffer[m_command_buffer_in++ % ARRAY_LENGTH(m_command_buffer)] = 0x00 | 0x20;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static TIMER_CALLBACK( pr8210_bit_off_callback )
|
void pr8210_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
|
||||||
{
|
{
|
||||||
device_t *laserdisc = (device_t *)ptr;
|
switch (id)
|
||||||
|
|
||||||
/* deassert the control line */
|
|
||||||
laserdisc_line_w(laserdisc, LASERDISC_LINE_CONTROL, CLEAR_LINE);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static TIMER_CALLBACK( pr8210_bit_callback )
|
|
||||||
{
|
|
||||||
attotime duration = attotime::from_msec(30);
|
|
||||||
device_t *laserdisc = (device_t *)ptr;
|
|
||||||
UINT8 bitsleft = param >> 16;
|
|
||||||
UINT8 data = param;
|
|
||||||
|
|
||||||
/* if we have bits, process */
|
|
||||||
if (bitsleft != 0)
|
|
||||||
{
|
{
|
||||||
/* assert the line and set a timer for deassertion */
|
case TIMER_ID_BIT:
|
||||||
laserdisc_line_w(laserdisc, LASERDISC_LINE_CONTROL, ASSERT_LINE);
|
{
|
||||||
machine.scheduler().timer_set(attotime::from_usec(250), FUNC(pr8210_bit_off_callback), 0, ptr);
|
attotime duration = attotime::from_msec(30);
|
||||||
|
UINT8 bitsleft = param >> 16;
|
||||||
|
UINT8 data = param;
|
||||||
|
|
||||||
/* space 0 bits apart by 1msec, and 1 bits by 2msec */
|
// if we have bits, process
|
||||||
duration = attotime::from_msec((data & 0x80) ? 2 : 1);
|
if (bitsleft != 0)
|
||||||
data <<= 1;
|
{
|
||||||
bitsleft--;
|
// assert the line and set a timer for deassertion
|
||||||
|
laserdisc_line_w(m_laserdisc, LASERDISC_LINE_CONTROL, ASSERT_LINE);
|
||||||
|
timer_set(attotime::from_usec(250), TIMER_ID_BIT_OFF);
|
||||||
|
|
||||||
|
// space 0 bits apart by 1msec, and 1 bits by 2msec
|
||||||
|
duration = attotime::from_msec((data & 0x80) ? 2 : 1);
|
||||||
|
data <<= 1;
|
||||||
|
bitsleft--;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if we're out of bits, queue up the next command
|
||||||
|
else if (bitsleft == 0 && m_command_buffer_in != m_command_buffer_out)
|
||||||
|
{
|
||||||
|
data = m_command_buffer[m_command_buffer_out++ % ARRAY_LENGTH(m_command_buffer)];
|
||||||
|
bitsleft = 12;
|
||||||
|
}
|
||||||
|
m_bit_timer->adjust(duration, (bitsleft << 16) | data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// deassert the control line
|
||||||
|
case TIMER_ID_BIT_OFF:
|
||||||
|
laserdisc_line_w(m_laserdisc, LASERDISC_LINE_CONTROL, CLEAR_LINE);
|
||||||
|
break;
|
||||||
|
|
||||||
|
// others to the parent class
|
||||||
|
default:
|
||||||
|
ldplayer_state::device_timer(timer, id, param, ptr);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if we're out of bits, queue up the next command */
|
|
||||||
else if (bitsleft == 0 && pr8210_command_buffer_in != pr8210_command_buffer_out)
|
|
||||||
{
|
|
||||||
data = pr8210_command_buffer[pr8210_command_buffer_out++ % ARRAY_LENGTH(pr8210_command_buffer)];
|
|
||||||
bitsleft = 12;
|
|
||||||
}
|
|
||||||
pr8210_bit_timer->adjust(duration, (bitsleft << 16) | data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static MACHINE_START( pr8210 )
|
void pr8210_state::machine_reset()
|
||||||
{
|
{
|
||||||
device_t *laserdisc = machine.m_devicelist.first(LASERDISC);
|
ldplayer_state::machine_reset();
|
||||||
MACHINE_START_CALL(ldplayer);
|
m_bit_timer->adjust(attotime::zero);
|
||||||
pr8210_bit_timer = machine.scheduler().timer_alloc(FUNC(pr8210_bit_callback), (void *)laserdisc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static MACHINE_RESET( pr8210 )
|
void pr8210_state::execute_command(int command)
|
||||||
{
|
|
||||||
MACHINE_RESET_CALL(ldplayer);
|
|
||||||
pr8210_bit_timer->adjust(attotime::zero);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void pr8210_execute(device_t *laserdisc, int command)
|
|
||||||
{
|
{
|
||||||
static const UINT8 digits[10] = { 0x01, 0x11, 0x09, 0x19, 0x05, 0x15, 0x0d, 0x1d, 0x03, 0x13 };
|
static const UINT8 digits[10] = { 0x01, 0x11, 0x09, 0x19, 0x05, 0x15, 0x0d, 0x1d, 0x03, 0x13 };
|
||||||
|
|
||||||
switch (command)
|
switch (command)
|
||||||
{
|
{
|
||||||
case CMD_SCAN_REVERSE:
|
case CMD_SCAN_REVERSE:
|
||||||
if (pr8210_command_buffer_in == pr8210_command_buffer_out ||
|
if (m_command_buffer_in == m_command_buffer_out ||
|
||||||
pr8210_command_buffer_in == (pr8210_command_buffer_out + 1) % ARRAY_LENGTH(pr8210_command_buffer))
|
m_command_buffer_in == (m_command_buffer_out + 1) % ARRAY_LENGTH(m_command_buffer))
|
||||||
{
|
{
|
||||||
pr8210_add_command(0x1c);
|
add_command(0x1c);
|
||||||
playing = TRUE;
|
m_playing = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_STEP_REVERSE:
|
case CMD_STEP_REVERSE:
|
||||||
pr8210_add_command(0x12);
|
add_command(0x12);
|
||||||
playing = FALSE;
|
m_playing = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_SLOW_REVERSE:
|
case CMD_SLOW_REVERSE:
|
||||||
pr8210_add_command(0x02);
|
add_command(0x02);
|
||||||
playing = TRUE;
|
m_playing = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_FAST_REVERSE:
|
case CMD_FAST_REVERSE:
|
||||||
if (pr8210_command_buffer_in == pr8210_command_buffer_out ||
|
if (m_command_buffer_in == m_command_buffer_out ||
|
||||||
pr8210_command_buffer_in == (pr8210_command_buffer_out + 1) % ARRAY_LENGTH(pr8210_command_buffer))
|
m_command_buffer_in == (m_command_buffer_out + 1) % ARRAY_LENGTH(m_command_buffer))
|
||||||
{
|
{
|
||||||
pr8210_add_command(0x0c);
|
add_command(0x0c);
|
||||||
playing = TRUE;
|
m_playing = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_SCAN_FORWARD:
|
case CMD_SCAN_FORWARD:
|
||||||
if (pr8210_command_buffer_in == pr8210_command_buffer_out ||
|
if (m_command_buffer_in == m_command_buffer_out ||
|
||||||
pr8210_command_buffer_in == (pr8210_command_buffer_out + 1) % ARRAY_LENGTH(pr8210_command_buffer))
|
m_command_buffer_in == (m_command_buffer_out + 1) % ARRAY_LENGTH(m_command_buffer))
|
||||||
{
|
{
|
||||||
pr8210_add_command(0x08);
|
add_command(0x08);
|
||||||
playing = TRUE;
|
m_playing = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_STEP_FORWARD:
|
case CMD_STEP_FORWARD:
|
||||||
pr8210_add_command(0x04);
|
add_command(0x04);
|
||||||
playing = FALSE;
|
m_playing = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_SLOW_FORWARD:
|
case CMD_SLOW_FORWARD:
|
||||||
pr8210_add_command(0x18);
|
add_command(0x18);
|
||||||
playing = TRUE;
|
m_playing = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_FAST_FORWARD:
|
case CMD_FAST_FORWARD:
|
||||||
if (pr8210_command_buffer_in == pr8210_command_buffer_out ||
|
if (m_command_buffer_in == m_command_buffer_out ||
|
||||||
pr8210_command_buffer_in == (pr8210_command_buffer_out + 1) % ARRAY_LENGTH(pr8210_command_buffer))
|
m_command_buffer_in == (m_command_buffer_out + 1) % ARRAY_LENGTH(m_command_buffer))
|
||||||
{
|
{
|
||||||
pr8210_add_command(0x10);
|
add_command(0x10);
|
||||||
playing = TRUE;
|
m_playing = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_PLAY:
|
case CMD_PLAY:
|
||||||
pr8210_add_command(0x14);
|
add_command(0x14);
|
||||||
playing = TRUE;
|
m_playing = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_PAUSE:
|
case CMD_PAUSE:
|
||||||
pr8210_add_command(0x0a);
|
add_command(0x0a);
|
||||||
playing = FALSE;
|
m_playing = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_FRAME_TOGGLE:
|
case CMD_FRAME_TOGGLE:
|
||||||
pr8210_add_command(0x0b);
|
add_command(0x0b);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_CHAPTER_TOGGLE:
|
case CMD_CHAPTER_TOGGLE:
|
||||||
pr8210_add_command(0x06);
|
add_command(0x06);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_CH1_TOGGLE:
|
case CMD_CH1_TOGGLE:
|
||||||
pr8210_add_command(0x0e);
|
add_command(0x0e);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_CH2_TOGGLE:
|
case CMD_CH2_TOGGLE:
|
||||||
pr8210_add_command(0x16);
|
add_command(0x16);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_0:
|
case CMD_0:
|
||||||
@ -430,12 +496,12 @@ static void pr8210_execute(device_t *laserdisc, int command)
|
|||||||
case CMD_7:
|
case CMD_7:
|
||||||
case CMD_8:
|
case CMD_8:
|
||||||
case CMD_9:
|
case CMD_9:
|
||||||
pr8210_add_command(digits[command - CMD_0]);
|
add_command(digits[command - CMD_0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_SEARCH:
|
case CMD_SEARCH:
|
||||||
pr8210_add_command(0x1a);
|
add_command(0x1a);
|
||||||
playing = FALSE;
|
m_playing = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -448,43 +514,43 @@ static void pr8210_execute(device_t *laserdisc, int command)
|
|||||||
*
|
*
|
||||||
*************************************/
|
*************************************/
|
||||||
|
|
||||||
static void ldv1000_execute(device_t *laserdisc, int command)
|
void ldv1000_state::execute_command(int command)
|
||||||
{
|
{
|
||||||
static const UINT8 digits[10] = { 0x3f, 0x0f, 0x8f, 0x4f, 0x2f, 0xaf, 0x6f, 0x1f, 0x9f, 0x5f };
|
static const UINT8 digits[10] = { 0x3f, 0x0f, 0x8f, 0x4f, 0x2f, 0xaf, 0x6f, 0x1f, 0x9f, 0x5f };
|
||||||
switch (command)
|
switch (command)
|
||||||
{
|
{
|
||||||
case CMD_SCAN_REVERSE:
|
case CMD_SCAN_REVERSE:
|
||||||
laserdisc_data_w(laserdisc, 0xf8);
|
laserdisc_data_w(m_laserdisc, 0xf8);
|
||||||
playing = TRUE;
|
m_playing = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_STEP_REVERSE:
|
case CMD_STEP_REVERSE:
|
||||||
laserdisc_data_w(laserdisc, 0xfe);
|
laserdisc_data_w(m_laserdisc, 0xfe);
|
||||||
playing = FALSE;
|
m_playing = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_SCAN_FORWARD:
|
case CMD_SCAN_FORWARD:
|
||||||
laserdisc_data_w(laserdisc, 0xf0);
|
laserdisc_data_w(m_laserdisc, 0xf0);
|
||||||
playing = TRUE;
|
m_playing = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_STEP_FORWARD:
|
case CMD_STEP_FORWARD:
|
||||||
laserdisc_data_w(laserdisc, 0xf6);
|
laserdisc_data_w(m_laserdisc, 0xf6);
|
||||||
playing = FALSE;
|
m_playing = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_PLAY:
|
case CMD_PLAY:
|
||||||
laserdisc_data_w(laserdisc, 0xfd);
|
laserdisc_data_w(m_laserdisc, 0xfd);
|
||||||
playing = TRUE;
|
m_playing = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_PAUSE:
|
case CMD_PAUSE:
|
||||||
laserdisc_data_w(laserdisc, 0xa0);
|
laserdisc_data_w(m_laserdisc, 0xa0);
|
||||||
playing = FALSE;
|
m_playing = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_FRAME_TOGGLE:
|
case CMD_FRAME_TOGGLE:
|
||||||
laserdisc_data_w(laserdisc, 0xf1);
|
laserdisc_data_w(m_laserdisc, 0xf1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_0:
|
case CMD_0:
|
||||||
@ -497,12 +563,12 @@ static void ldv1000_execute(device_t *laserdisc, int command)
|
|||||||
case CMD_7:
|
case CMD_7:
|
||||||
case CMD_8:
|
case CMD_8:
|
||||||
case CMD_9:
|
case CMD_9:
|
||||||
laserdisc_data_w(laserdisc, digits[command - CMD_0]);
|
laserdisc_data_w(m_laserdisc, digits[command - CMD_0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_SEARCH:
|
case CMD_SEARCH:
|
||||||
laserdisc_data_w(laserdisc, 0xf7);
|
laserdisc_data_w(m_laserdisc, 0xf7);
|
||||||
playing = FALSE;
|
m_playing = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -551,12 +617,9 @@ INPUT_PORTS_END
|
|||||||
*
|
*
|
||||||
*************************************/
|
*************************************/
|
||||||
|
|
||||||
static MACHINE_CONFIG_FRAGMENT( ldplayer_core )
|
static MACHINE_CONFIG_START( ldplayer_core, ldplayer_state )
|
||||||
|
|
||||||
MCFG_MACHINE_START(ldplayer)
|
// audio hardware
|
||||||
MCFG_MACHINE_RESET(ldplayer)
|
|
||||||
|
|
||||||
/* audio hardware */
|
|
||||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||||
|
|
||||||
MCFG_SOUND_ADD("ldsound", LASERDISC_SOUND, 0)
|
MCFG_SOUND_ADD("ldsound", LASERDISC_SOUND, 0)
|
||||||
@ -570,17 +633,15 @@ static MACHINE_CONFIG_DERIVED( ldplayer_ntsc, ldplayer_core )
|
|||||||
MACHINE_CONFIG_END
|
MACHINE_CONFIG_END
|
||||||
|
|
||||||
|
|
||||||
static MACHINE_CONFIG_DERIVED( ldv1000, ldplayer_ntsc )
|
static MACHINE_CONFIG_DERIVED_CLASS( ldv1000, ldplayer_ntsc, ldv1000_state )
|
||||||
MCFG_LASERDISC_ADD("laserdisc", PIONEER_LDV1000, "screen", "ldsound")
|
MCFG_LASERDISC_ADD("laserdisc", PIONEER_LDV1000, "screen", "ldsound")
|
||||||
MCFG_LASERDISC_GET_DISC(get_disc)
|
MCFG_LASERDISC_GET_DISC(ldplayer_state::get_disc_static)
|
||||||
MACHINE_CONFIG_END
|
MACHINE_CONFIG_END
|
||||||
|
|
||||||
|
|
||||||
static MACHINE_CONFIG_DERIVED( pr8210, ldplayer_ntsc )
|
static MACHINE_CONFIG_DERIVED_CLASS( pr8210, ldplayer_ntsc, pr8210_state )
|
||||||
MCFG_MACHINE_START(pr8210)
|
|
||||||
MCFG_MACHINE_RESET(pr8210)
|
|
||||||
MCFG_LASERDISC_ADD("laserdisc", PIONEER_PR8210, "screen", "ldsound")
|
MCFG_LASERDISC_ADD("laserdisc", PIONEER_PR8210, "screen", "ldsound")
|
||||||
MCFG_LASERDISC_GET_DISC(get_disc)
|
MCFG_LASERDISC_GET_DISC(ldplayer_state::get_disc_static)
|
||||||
MACHINE_CONFIG_END
|
MACHINE_CONFIG_END
|
||||||
|
|
||||||
|
|
||||||
@ -602,22 +663,11 @@ ROM_END
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************
|
|
||||||
*
|
|
||||||
* Driver initialization
|
|
||||||
*
|
|
||||||
*************************************/
|
|
||||||
|
|
||||||
static DRIVER_INIT( ldv1000 ) { execute_command = ldv1000_execute; }
|
|
||||||
static DRIVER_INIT( pr8210 ) { execute_command = pr8210_execute; }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************
|
/*************************************
|
||||||
*
|
*
|
||||||
* Game drivers
|
* Game drivers
|
||||||
*
|
*
|
||||||
*************************************/
|
*************************************/
|
||||||
|
|
||||||
GAME( 2008, ldv1000, 0, ldv1000, ldplayer, ldv1000, ROT0, "MAME", "Pioneer LDV-1000 Simulator", 0 )
|
GAME( 2008, ldv1000, 0, ldv1000, ldplayer, 0, ROT0, "MAME", "Pioneer LDV-1000 Simulator", 0 )
|
||||||
GAMEL(2008, pr8210, 0, pr8210, ldplayer, pr8210, ROT0, "MAME", "Pioneer PR-8210 Simulator", 0, layout_pr8210 )
|
GAMEL(2008, pr8210, 0, pr8210, ldplayer, 0, ROT0, "MAME", "Pioneer PR-8210 Simulator", 0, layout_pr8210 )
|
||||||
|
42
src/ldplayer/ldplayer.lst
Normal file
42
src/ldplayer/ldplayer.lst
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
|
||||||
|
ldpdriv.c
|
||||||
|
|
||||||
|
List of all enabled drivers in the system. This file is parsed by
|
||||||
|
makelist.exe, sorted, and output as C code describing the drivers.
|
||||||
|
|
||||||
|
****************************************************************************
|
||||||
|
|
||||||
|
Copyright Aaron Giles
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are
|
||||||
|
met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in
|
||||||
|
the documentation and/or other materials provided with the
|
||||||
|
distribution.
|
||||||
|
* Neither the name 'MAME' nor the names of its contributors may be
|
||||||
|
used to endorse or promote products derived from this software
|
||||||
|
without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR
|
||||||
|
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT,
|
||||||
|
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
ldv1000 // Pioneer LD-V1000
|
||||||
|
pr8210 // Pioneer PR-8210
|
@ -44,7 +44,6 @@ SOUNDS += WAVE
|
|||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
|
|
||||||
DRVLIBS = \
|
DRVLIBS = \
|
||||||
$(LDPOBJ)/ldpdriv.o \
|
|
||||||
$(EMUDRIVERS)/emudummy.o \
|
$(EMUDRIVERS)/emudummy.o \
|
||||||
$(LDPOBJ)/ldplayer.o \
|
$(LDPOBJ)/ldplayer.o \
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user