diff options
-rw-r--r-- | src/emu/devintrf.c | 1 | ||||
-rw-r--r-- | src/emu/devintrf.h | 2 | ||||
-rw-r--r-- | src/emu/machine/laserdsc.h | 1 | ||||
-rw-r--r-- | src/emu/machine/ldcore.c | 34 | ||||
-rw-r--r-- | src/emu/machine/ldcore.h | 2 | ||||
-rw-r--r-- | src/emu/machine/ldpr8210.c | 233 | ||||
-rw-r--r-- | src/emu/machine/ldv1000.c | 2 | ||||
-rw-r--r-- | src/emu/mconfig.c | 77 | ||||
-rw-r--r-- | src/emu/mconfig.h | 12 | ||||
-rw-r--r-- | src/emu/romload.c | 138 | ||||
-rw-r--r-- | src/emu/romload.h | 5 | ||||
-rw-r--r-- | src/emu/validity.c | 194 | ||||
-rw-r--r-- | src/ldplayer/ldplayer.c | 197 |
13 files changed, 508 insertions, 390 deletions
diff --git a/src/emu/devintrf.c b/src/emu/devintrf.c index f0bc72b2a32..c62a03438e6 100644 --- a/src/emu/devintrf.c +++ b/src/emu/devintrf.c @@ -703,7 +703,6 @@ void *device_get_info_ptr(const device_config *device, UINT32 state) deviceinfo info; assert(device != NULL); - assert(device->token != NULL); assert(device->type != NULL); assert(state >= DEVINFO_PTR_FIRST && state <= DEVINFO_PTR_LAST); diff --git a/src/emu/devintrf.h b/src/emu/devintrf.h index da0d0c05ce0..9d5b9476fd0 100644 --- a/src/emu/devintrf.h +++ b/src/emu/devintrf.h @@ -58,6 +58,7 @@ enum DEVINFO_PTR_FIRST = 0x10000, DEVINFO_PTR_ROM_REGION = DEVINFO_PTR_FIRST, /* R/O: pointer to device-specific ROM region */ + DEVINFO_PTR_MACHINE_CONFIG, /* R/O: pointer to device-specific machine config */ DEVINFO_PTR_DEVICE_SPECIFIC = 0x18000, /* R/W: device-specific values start here */ DEVINFO_PTR_LAST = 0x1ffff, @@ -162,6 +163,7 @@ union _deviceinfo device_validity_check_func validity_check; /* DEVINFO_FCT_VALIDITY_CHECK */ device_nvram_func nvram; /* DEVINFO_FCT_NVRAM */ const rom_entry * romregion; /* DEVINFO_PTR_ROM_REGION */ + const union _machine_config_token *machine_config;/* DEVINFO_PTR_MACHINE_CONFIG */ }; diff --git a/src/emu/machine/laserdsc.h b/src/emu/machine/laserdsc.h index 6c4c50923d0..99db8cd06c5 100644 --- a/src/emu/machine/laserdsc.h +++ b/src/emu/machine/laserdsc.h @@ -29,6 +29,7 @@ enum LASERDISC_TYPE_PIONEER_PR8210, /* Pioneer PR-8210 / LD-V1100 */ LASERDISC_TYPE_SIMUTREK_SPECIAL, /* Pioneer PR-8210 with mods */ LASERDISC_TYPE_PIONEER_LDV1000, /* Pioneer LD-V1000 */ + LASERDISC_TYPE_PHILLIPS_22VP931, /* Phillips 22VP931 */ LASERDISC_TYPE_PHILLIPS_22VP932, /* Phillips 22VP932 (PAL) */ LASERDISC_TYPE_SONY_LDP1450 /* Sony LDP-1450 */ }; diff --git a/src/emu/machine/ldcore.c b/src/emu/machine/ldcore.c index b8c67ea2068..09c8e401577 100644 --- a/src/emu/machine/ldcore.c +++ b/src/emu/machine/ldcore.c @@ -1538,14 +1538,29 @@ static DEVICE_SET_INFO( laserdisc ) DEVICE_GET_INFO( laserdisc ) { const laserdisc_config *config = NULL; + const ldplayer_interface *intf = NULL; int pltype; /* if we have a device, figure out where our config lives */ if (device != NULL) { laserdisc_state *ld = device->token; - config = (ld == NULL || ld->core == NULL) ? device->inline_config : &ld->core->config; + config = device->inline_config; + if (ld != NULL && ld->core != NULL) + { + config = &ld->core->config; + intf = &ld->core->intf; + } } + + /* if we don't have an interface, but we have a config, look up the interface */ + if (intf == NULL && config != NULL) + for (pltype = 0; pltype < ARRAY_LENGTH(player_interfaces); pltype++) + if (player_interfaces[pltype]->type == config->type) + { + intf = player_interfaces[pltype]; + break; + } switch (state) { @@ -1555,6 +1570,10 @@ DEVICE_GET_INFO( laserdisc ) case DEVINFO_INT_CLASS: info->i = DEVICE_CLASS_VIDEO; break; case LDINFO_INT_TYPE: info->i = config->type; break; + /* --- the following bits of info are returned as pointers --- */ + case DEVINFO_PTR_ROM_REGION: info->romregion = intf->romregion; break; + case DEVINFO_PTR_MACHINE_CONFIG: info->machine_config = intf->machine_config; break; + /* --- the following bits of info are returned as pointers to data or functions --- */ case DEVINFO_FCT_SET_INFO: info->set_info = DEVICE_SET_INFO_NAME(laserdisc); break; case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(laserdisc); break; @@ -1562,15 +1581,10 @@ DEVICE_GET_INFO( laserdisc ) case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(laserdisc); break; /* --- the following bits of info are returned as NULL-terminated strings --- */ - case DEVINFO_STR_NAME: - info->s = "Unknown Laserdisc Player"; - for (pltype = 0; pltype < ARRAY_LENGTH(player_interfaces); pltype++) - if (player_interfaces[pltype]->type == config->type) - info->s = player_interfaces[pltype]->name; - break; - case DEVINFO_STR_FAMILY: info->s = "Laserdisc Player"; break; - case DEVINFO_STR_VERSION: info->s = "1.0"; break; - case DEVINFO_STR_SOURCE_FILE: info->s = __FILE__; break; + case DEVINFO_STR_NAME: info->s = intf->name; break; + case DEVINFO_STR_FAMILY: info->s = "Laserdisc Player"; break; + case DEVINFO_STR_VERSION: info->s = "1.0"; break; + case DEVINFO_STR_SOURCE_FILE: info->s = __FILE__; break; case DEVINFO_STR_CREDITS: info->s = "Copyright Nicola Salmoria and the MAME Team"; break; } } diff --git a/src/emu/machine/ldcore.h b/src/emu/machine/ldcore.h index 5960ef576fb..8fe3f4feb46 100644 --- a/src/emu/machine/ldcore.h +++ b/src/emu/machine/ldcore.h @@ -131,6 +131,8 @@ struct _ldplayer_interface int type; /* type of the player */ size_t statesize; /* size of the state */ const char * name; /* name of the player */ + const rom_entry * romregion; /* pointer to ROM region information */ + const machine_config_token *machine_config; /* pointer to machine configuration */ laserdisc_init_func init; /* initialization callback */ laserdisc_update_func update; /* update callback */ laserdisc_w_func writedata; /* parallel data write */ diff --git a/src/emu/machine/ldpr8210.c b/src/emu/machine/ldpr8210.c index c361335c1cc..b5c358a0c54 100644 --- a/src/emu/machine/ldpr8210.c +++ b/src/emu/machine/ldpr8210.c @@ -10,6 +10,7 @@ *************************************************************************/ #include "ldcore.h" +#include "cpu/mcs48/mcs48.h" @@ -17,6 +18,8 @@ DEBUGGING ***************************************************************************/ +#define EMULATE_PR8210_ROM 0 + #define PRINTF_COMMANDS 1 #define CMDPRINTF(x) do { if (PRINTF_COMMANDS) mame_printf_debug x; } while (0) @@ -69,6 +72,13 @@ struct _ldplayer_data UINT8 cmdcnt; /* counter for multi-byte command */ UINT8 cmdbytes[3]; /* storage for multi-byte command */ void (*cmd_ack_callback)(void); /* callback to clear game command write flag */ + + /* low-level emulation data */ + UINT8 pia[0x100]; + UINT8 porta; + UINT8 portb; + UINT8 pia_porta; + UINT8 pia_portb; }; @@ -82,7 +92,9 @@ static void pr8210_soft_reset(laserdisc_state *ld); static void pr8210_update_squelch(laserdisc_state *ld); static int pr8210_switch_state(laserdisc_state *ld, UINT8 newstate, INT32 stateparam); static INT32 pr8210_update(laserdisc_state *ld, const vbi_metadata *vbi, int fieldnum, attotime curtime); +#if (!EMULATE_PR8210_ROM) static void pr8210_command(laserdisc_state *ld); +#endif static void pr8210_control_w(laserdisc_state *ld, UINT8 prev, UINT8 data); static void simutrek_init(laserdisc_state *ld); @@ -92,6 +104,21 @@ static void simutrek_data_w(laserdisc_state *ld, UINT8 prev, UINT8 data); /*************************************************************************** + ROM AND MACHINE INTERFACES +***************************************************************************/ + +MACHINE_DRIVER_EXTERN( pr8210 ); + +#if EMULATE_PR8210_ROM +ROM_START( pr8210 ) + ROM_REGION( 0x800, "pr8210", ROMREGION_LOADBYNAME ) + ROM_LOAD( "pr-8210_mcu_ud6005a.bin", 0x000, 0x800, CRC(120fa83b) SHA1(b514326ca1f52d6d89056868f9d17eabd4e3f31d) ) +ROM_END +#endif + + + +/*************************************************************************** INTERFACES ***************************************************************************/ @@ -100,6 +127,13 @@ const ldplayer_interface pr8210_interface = LASERDISC_TYPE_PIONEER_PR8210, /* type of the player */ sizeof(ldplayer_data), /* size of the state */ "Pioneer PR-8210", /* name of the player */ +#if EMULATE_PR8210_ROM + rom_pr8210, /* pointer to ROM region information */ + machine_config_pr8210, /* pointer to machine configuration */ +#else + NULL, /* pointer to ROM region information */ + NULL, /* pointer to machine configuration */ +#endif pr8210_init, /* initialization callback */ pr8210_update, /* update callback */ NULL, /* parallel data write */ @@ -122,6 +156,8 @@ const ldplayer_interface simutrek_interface = LASERDISC_TYPE_SIMUTREK_SPECIAL, /* type of the player */ sizeof(ldplayer_data), /* size of the state */ "Simutrek Modified PR-8210", /* name of the player */ + NULL, /* pointer to ROM region information */ + NULL, /* pointer to machine configuration */ simutrek_init, /* initialization callback */ pr8210_update, /* update callback */ simutrek_data_w, /* parallel data write */ @@ -383,6 +419,7 @@ static INT32 pr8210_update(laserdisc_state *ld, const vbi_metadata *vbi, int fie command processing -------------------------------------------------*/ +#if (!EMULATE_PR8210_ROM) static void pr8210_command(laserdisc_state *ld) { ldplayer_data *player = ld->player; @@ -526,6 +563,7 @@ static void pr8210_command(laserdisc_state *ld) break; } } +#endif /*------------------------------------------------- @@ -576,6 +614,9 @@ static void pr8210_control_w(laserdisc_state *ld, UINT8 prev, UINT8 data) //printf("New command = %02X (last=%02X)\n", newcommand, player->lastcommand); +#if EMULATE_PR8210_ROM + player->pia_porta = BITSWAP8(newcommand, 0,1,2,3,4,5,6,7); +#else /* if we got a double command, act on it */ if (newcommand == player->lastcommand) { @@ -584,6 +625,7 @@ static void pr8210_control_w(laserdisc_state *ld, UINT8 prev, UINT8 data) } else player->lastcommand = newcommand; +#endif } } } @@ -720,3 +762,194 @@ void simutrek_set_cmd_ack_callback(const device_config *device, void (*callback) player->cmd_ack_callback = callback; } + + + +/*************************************************************************** + RE-IMPLEMENTATION USING ACTUAL ROMS +***************************************************************************/ + +/************************************* + * + * Test PR-8210 ROM emulation + * + *************************************/ + +static ldplayer_data *find_pr8210(running_machine *machine) +{ + return ldcore_get_safe_token(device_list_first(machine->config->devicelist, LASERDISC))->player; +} + + +static READ8_HANDLER( pr8210_pia_r ) +{ + ldplayer_data *player = find_pr8210(machine); + UINT8 result = player->pia[offset]; + switch (offset) + { + case 0xa0: +// printf("%03X:pia_r(%02X) = %02X\n", activecpu_get_pc(), offset, player->pia_porta); + result = player->pia_porta; + player->pia_porta = 0; + break; + + default: + printf("%03X:pia_r(%02X)\n", activecpu_get_pc(), offset); + break; + } + return result; +} + +static WRITE8_HANDLER( pr8210_pia_w ) +{ + /* + $22-26 (R) = read and copied to memory $23-27 + $23 (R) = something compared against $F4 + $22-26 (W) = SRCH. text + $27-2B (W) = FRAME/CHAP. text + $2C-30 (W) = frame or chapter number + $40 (W) = $CF at initialization, tracked by ($78) + $60 (W) = port B output, tracked by ($77) + $80 = n/c + $40 = (out) LED3 + $20 = (out) LED2 + $10 = (out) LED1 + 123 -> LHL = Play + -> HLL = Slow fwd + -> LLL = Slow rev + -> HHL = Still + -> LLH = Pause + -> HHH = all off + $08 = (out) CAV LED + $04 = (out) CLV LED + $02 = (out) A2 LED/AUDIO 2 + $01 = (out) A1 LED/AUDIO 1 + $80 (W) = 0 or 1 + $A0 (R) = port A input + $C0 (R) = stored to ($2E) + $E0 (R) = stored to ($2F) + */ + ldplayer_data *player = find_pr8210(machine); + if (player->pia[offset] != data) + { + switch (offset) + { + case 0x60: + printf("%03X:pia_w(%02X) = %02X (PORT B LEDS:", activecpu_get_pc(), offset, data); + if (!(data & 0x01)) printf(" AUDIO1"); + if (!(data & 0x02)) printf(" AUDIO2"); + if (!(data & 0x04)) printf(" CLV"); + if (!(data & 0x08)) printf(" CAV"); + printf(" LED123=%c%c%c", (data & 0x10) ? 'H' : 'L', (data & 0x20) ? 'H' : 'L', (data & 0x40) ? 'H' : 'L'); + if (!(data & 0x80)) printf(" ???"); + printf(")\n"); + player->pia_portb = data; + break; + + default: + printf("%03X:pia_w(%02X) = %02X\n", activecpu_get_pc(), offset, data); + break; + } + player->pia[offset] = data; + } +} + +static READ8_HANDLER( pr8210_bus_r ) +{ + /* + $80 = n/c + $40 = (in) slide pot interrupt source (slider position limit detector, inside and outside) + $20 = n/c + $10 = (in) /FOCUS LOCK + $08 = (in) /SPDL LOCK + $04 = (in) SIZE 8/12 + $02 = (in) FG via op-amp (spindle motor stop detector) + $01 = (in) SLOW TIMER OUT + */ + offs_t pc = activecpu_get_pc(); + if (pc != 0x11c) + printf("%03X:bus_r\n", pc); + + /* loop at beginning waits for $40=0, $02=1 */ + return 0xff & ~0x40 & ~0x04; +} + +static WRITE8_HANDLER( pr8210_porta_w ) +{ + /* + $80 = (out) SCAN C (F/R) + $40 = (out) AUDIO SQ + $20 = (out) VIDEO SQ + $10 = (out) /SPDL ON + $08 = (out) /FOCUS ON + $04 = (out) SCAN B (L/H) + $02 = (out) SCAN A (/SCAN) + $01 = (out) JUMP TRG (jump back trigger, clock on high->low) + */ + ldplayer_data *player = find_pr8210(machine); + if (data != player->porta) + { + printf("%03X:porta_w = %02X", activecpu_get_pc(), data); + if (!(data & 0x01)) printf(" JUMPTRG"); + if (!(data & 0x02)) + { + printf(" SCAN:%c:%c", (data & 0x80) ? 'F' : 'R', (data & 0x04) ? 'L' : 'H'); + } + if (!(data & 0x08)) printf(" /FOCUSON"); + if (!(data & 0x10)) printf(" /SPDLON"); + if (data & 0x20) printf(" VIDEOSQ"); + if (data & 0x40) printf(" AUDIOSQ"); + printf("\n"); + player->porta = data; + } +} + +static WRITE8_HANDLER( pr8210_portb_w ) +{ + /* + $80 = (out) /CS on PIA + $40 = (out) 0 to self-generate IRQ + $20 = (out) SLOW TRG + $10 = (out) STANDBY LED + $08 = (out) TP2 + $04 = (out) TP1 + $02 = (out) ??? + $01 = (out) LASER ON + */ + ldplayer_data *player = find_pr8210(machine); + cputag_set_input_line(machine, "pr8210", 0, (data & 0x40) ? CLEAR_LINE : ASSERT_LINE); + if ((data & 0x7f) != (player->portb & 0x7f)) + { + printf("%03X:portb_w = %02X", activecpu_get_pc(), data); + if (!(data & 0x01)) printf(" LASERON"); + if (!(data & 0x02)) printf(" ???"); + if (!(data & 0x04)) printf(" TP1"); + if (!(data & 0x08)) printf(" TP2"); + if (!(data & 0x10)) printf(" STANDBYLED"); + if (!(data & 0x20)) printf(" SLOWTRG"); + if (!(data & 0x40)) printf(" IRQGEN"); +// if (data & 0x80) printf(" PIASEL"); + printf("\n"); + player->portb = data; + } +} + + +static ADDRESS_MAP_START( pr8210_map, ADDRESS_SPACE_PROGRAM, 8 ) + AM_RANGE(0x000, 0x7ff) AM_ROM +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( pr8210_portmap, ADDRESS_SPACE_IO, 8 ) + AM_RANGE(0x00, 0xff) AM_READWRITE(pr8210_pia_r, pr8210_pia_w) + AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READ(pr8210_bus_r) + AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(pr8210_porta_w) + AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(pr8210_portb_w) +ADDRESS_MAP_END + + +MACHINE_DRIVER_START( pr8210 ) + MDRV_CPU_ADD("pr8210", I8049, XTAL_4_41MHz) + MDRV_CPU_PROGRAM_MAP(pr8210_map,0) + MDRV_CPU_IO_MAP(pr8210_portmap,0) +MACHINE_DRIVER_END diff --git a/src/emu/machine/ldv1000.c b/src/emu/machine/ldv1000.c index 5c2354e0f51..2a273d6ad19 100644 --- a/src/emu/machine/ldv1000.c +++ b/src/emu/machine/ldv1000.c @@ -99,6 +99,8 @@ const ldplayer_interface ldv1000_interface = LASERDISC_TYPE_PIONEER_LDV1000, /* type of the player */ sizeof(ldplayer_data), /* size of the state */ "Pioneer LD-V1000", /* name of the player */ + NULL, /* pointer to ROM region information */ + NULL, /* pointer to machine configuration */ ldv1000_init, /* initialization callback */ ldv1000_update, /* update callback */ ldv1000_data_w, /* parallel data write */ diff --git a/src/emu/mconfig.c b/src/emu/mconfig.c index 24be39ebda3..4115af021ed 100644 --- a/src/emu/mconfig.c +++ b/src/emu/mconfig.c @@ -18,7 +18,7 @@ FUNCTION PROTOTYPES ***************************************************************************/ -static void machine_config_detokenize(machine_config *config, const machine_config_token *tokens); +static void machine_config_detokenize(machine_config *config, const machine_config_token *tokens, int depth); @@ -41,7 +41,7 @@ machine_config *machine_config_alloc(const machine_config_token *tokens) memset(config, 0, sizeof(*config)); /* parse tokens into the config */ - machine_config_detokenize(config, tokens); + machine_config_detokenize(config, tokens, 0); return config; } @@ -62,14 +62,12 @@ void machine_config_free(machine_config *config) } - - /*------------------------------------------------- - machine_config_add_cpu - add a CPU during machine - driver expansion + cpu_add - add a CPU during machine driver + expansion -------------------------------------------------*/ -cpu_config *machine_config_add_cpu(machine_config *machine, const char *tag, cpu_type type, int cpuclock) +static cpu_config *cpu_add(machine_config *machine, const char *tag, cpu_type type, int cpuclock) { int cpunum; @@ -88,11 +86,11 @@ cpu_config *machine_config_add_cpu(machine_config *machine, const char *tag, cpu /*------------------------------------------------- - machine_config_find_cpu - find a tagged CPU during - machine driver expansion + cpu_find - find a tagged CPU during machine + driver expansion -------------------------------------------------*/ -cpu_config *machine_config_find_cpu(machine_config *machine, const char *tag) +static cpu_config *cpu_find(machine_config *machine, const char *tag) { int cpunum; @@ -106,11 +104,11 @@ cpu_config *machine_config_find_cpu(machine_config *machine, const char *tag) /*------------------------------------------------- - machine_config_remove_cpu - remove a tagged CPU - during machine driver expansion + cpu_remove - remove a tagged CPU during + machine driver expansion -------------------------------------------------*/ -void machine_config_remove_cpu(machine_config *machine, const char *tag) +static void cpu_remove(machine_config *machine, const char *tag) { int cpunum; @@ -127,11 +125,11 @@ void machine_config_remove_cpu(machine_config *machine, const char *tag) /*------------------------------------------------- - machine_config_add_sound - add a sound system during + sound_add - add a sound system during machine driver expansion -------------------------------------------------*/ -sound_config *machine_config_add_sound(machine_config *machine, const char *tag, sound_type type, int clock) +static sound_config *sound_add(machine_config *machine, const char *tag, sound_type type, int clock) { int soundnum; @@ -152,11 +150,11 @@ sound_config *machine_config_add_sound(machine_config *machine, const char *tag, /*------------------------------------------------- - machine_config_find_sound - find a tagged sound - system during machine driver expansion + sound_find - find a tagged sound system during + machine driver expansion -------------------------------------------------*/ -sound_config *machine_config_find_sound(machine_config *machine, const char *tag) +static sound_config *sound_find(machine_config *machine, const char *tag) { int soundnum; @@ -170,11 +168,11 @@ sound_config *machine_config_find_sound(machine_config *machine, const char *tag /*------------------------------------------------- - machine_config_remove_sound - remove a tagged sound - system during machine driver expansion + sound_remove - remove a tagged sound system + during machine driver expansion -------------------------------------------------*/ -void machine_config_remove_sound(machine_config *machine, const char *tag) +static void sound_remove(machine_config *machine, const char *tag) { int soundnum; @@ -195,20 +193,20 @@ void machine_config_remove_sound(machine_config *machine, const char *tag) machine config -------------------------------------------------*/ -static void machine_config_detokenize(machine_config *config, const machine_config_token *tokens) +static void machine_config_detokenize(machine_config *config, const machine_config_token *tokens, int depth) { UINT32 entrytype = MCONFIG_TOKEN_INVALID; device_config *device = NULL; - cpu_config *cpu = NULL; sound_config *sound = NULL; - + cpu_config *cpu = NULL; + /* loop over tokens until we hit the end */ while (entrytype != MCONFIG_TOKEN_END) { - device_type devtype; - const char *tag; int size, offset, type, bits, in, out; UINT32 data32, clock, gain; + device_type devtype; + const char *tag; UINT64 data64; /* unpack the token from the first entry */ @@ -221,7 +219,7 @@ static void machine_config_detokenize(machine_config *config, const machine_conf /* including */ case MCONFIG_TOKEN_INCLUDE: - machine_config_detokenize(config, TOKEN_GET_PTR(tokens, tokenptr)); + machine_config_detokenize(config, TOKEN_GET_PTR(tokens, tokenptr), depth + 1); break; /* device management */ @@ -308,17 +306,17 @@ static void machine_config_detokenize(machine_config *config, const machine_conf TOKEN_UNGET_UINT32(tokens); TOKEN_GET_UINT64_UNPACK3(tokens, entrytype, 8, type, 24, clock, 32); tag = TOKEN_GET_STRING(tokens); - cpu = machine_config_add_cpu(config, tag, type, clock); + cpu = cpu_add(config, tag, type, clock); break; case MCONFIG_TOKEN_CPU_MODIFY: tag = TOKEN_GET_STRING(tokens); - cpu = machine_config_find_cpu(config, tag); + cpu = cpu_find(config, tag); break; case MCONFIG_TOKEN_CPU_REMOVE: tag = TOKEN_GET_STRING(tokens); - machine_config_remove_cpu(config, tag); + cpu_remove(config, tag); cpu = NULL; break; @@ -326,7 +324,7 @@ static void machine_config_detokenize(machine_config *config, const machine_conf TOKEN_UNGET_UINT32(tokens); TOKEN_GET_UINT64_UNPACK3(tokens, entrytype, 8, type, 24, clock, 32); tag = TOKEN_GET_STRING(tokens); - cpu = machine_config_find_cpu(config, tag); + cpu = cpu_find(config, tag); if (cpu == NULL) fatalerror("Unable to find CPU: tag=%s\n", tag); cpu->type = type; @@ -479,16 +477,16 @@ static void machine_config_detokenize(machine_config *config, const machine_conf TOKEN_UNGET_UINT32(tokens); TOKEN_GET_UINT64_UNPACK3(tokens, entrytype, 8, type, 24, clock, 32); tag = TOKEN_GET_STRING(tokens); - sound = machine_config_add_sound(config, tag, type, clock); + sound = sound_add(config, tag, type, clock); break; case MCONFIG_TOKEN_SOUND_REMOVE: - machine_config_remove_sound(config, TOKEN_GET_STRING(tokens)); + sound_remove(config, TOKEN_GET_STRING(tokens)); break; case MCONFIG_TOKEN_SOUND_MODIFY: tag = TOKEN_GET_STRING(tokens); - sound = machine_config_find_sound(config, tag); + sound = sound_find(config, tag); if (sound == NULL) fatalerror("Unable to find sound: tag=%s\n", tag); sound->routes = 0; @@ -503,7 +501,7 @@ static void machine_config_detokenize(machine_config *config, const machine_conf TOKEN_UNGET_UINT32(tokens); TOKEN_GET_UINT64_UNPACK3(tokens, entrytype, 8, type, 24, clock, 32); tag = TOKEN_GET_STRING(tokens); - sound = machine_config_find_sound(config, tag); + sound = sound_find(config, tag); if (sound == NULL) fatalerror("Unable to find sound: tag=%s\n", tag); sound->type = type; @@ -528,4 +526,13 @@ static void machine_config_detokenize(machine_config *config, const machine_conf break; } } + + /* if we are the outermost level, process any device-specific machine configurations */ + if (depth == 0) + for (device = config->devicelist; device != NULL; device = device->next) + { + tokens = device_get_info_ptr(device, DEVINFO_PTR_MACHINE_CONFIG); + if (tokens != NULL) + machine_config_detokenize(config, tokens, depth + 1); + } } diff --git a/src/emu/mconfig.h b/src/emu/mconfig.h index 23092de95e3..e1d20e9fb1b 100644 --- a/src/emu/mconfig.h +++ b/src/emu/mconfig.h @@ -462,16 +462,4 @@ machine_config *machine_config_alloc(const machine_config_token *tokens); void machine_config_free(machine_config *config); - - - -cpu_config *machine_config_add_cpu(machine_config *machine, const char *tag, cpu_type type, int cpuclock); -cpu_config *machine_config_find_cpu(machine_config *machine, const char *tag); -void machine_config_remove_cpu(machine_config *machine, const char *tag); - -sound_config *machine_config_add_sound(machine_config *machine, const char *tag, sound_type type, int clock); -sound_config *machine_config_find_sound(machine_config *machine, const char *tag); -void machine_config_remove_sound(machine_config *machine, const char *tag); - - #endif /* __MCONFIG_H__ */ diff --git a/src/emu/romload.c b/src/emu/romload.c index 93d6f97a68e..116652d2548 100644 --- a/src/emu/romload.c +++ b/src/emu/romload.c @@ -510,35 +510,47 @@ static void region_post_process(running_machine *machine, rom_load_data *romdata up the parent and loading by checksum -------------------------------------------------*/ -static int open_rom_file(rom_load_data *romdata, const rom_entry *romp) +static int open_rom_file(rom_load_data *romdata, const char *regiontag, const rom_entry *romp) { file_error filerr = FILERR_NOT_FOUND; const game_driver *drv; - - ++romdata->romsloaded; + int has_crc = FALSE; + UINT8 crcbytes[4]; + UINT32 crc = 0; /* update status display */ + ++romdata->romsloaded; display_loading_rom_message(ROM_GETNAME(romp), romdata); + + /* extract CRC to use for searching */ + has_crc = hash_data_extract_binary_checksum(ROM_GETHASHDATA(romp), HASH_CRC, crcbytes); + if (has_crc) + crc = (crcbytes[0] << 24) | (crcbytes[1] << 16) | (crcbytes[2] << 8) | crcbytes[3]; - /* Attempt reading up the chain through the parents. It automatically also + /* attempt reading up the chain through the parents. It automatically also attempts any kind of load by checksum supported by the archives. */ romdata->file = NULL; - for (drv = Machine->gamedrv; !romdata->file && drv; drv = driver_get_clone(drv)) - if (drv->name && *drv->name) + for (drv = Machine->gamedrv; romdata->file == NULL && drv != NULL; drv = driver_get_clone(drv)) + if (drv->name != NULL && *drv->name != 0) { - UINT8 crcs[4]; - astring *fname; - - fname = astring_assemble_3(astring_alloc(), drv->name, PATH_SEPARATOR, ROM_GETNAME(romp)); - if (hash_data_extract_binary_checksum(ROM_GETHASHDATA(romp), HASH_CRC, crcs)) - { - UINT32 crc = (crcs[0] << 24) | (crcs[1] << 16) | (crcs[2] << 8) | crcs[3]; + astring *fname = astring_assemble_3(astring_alloc(), drv->name, PATH_SEPARATOR, ROM_GETNAME(romp)); + if (has_crc) filerr = mame_fopen_crc(SEARCHPATH_ROM, astring_c(fname), crc, OPEN_FLAG_READ, &romdata->file); - } else filerr = mame_fopen(SEARCHPATH_ROM, astring_c(fname), OPEN_FLAG_READ, &romdata->file); astring_free(fname); } + + /* if the region is load by name, load the ROM from there */ + if (regiontag != NULL) + { + astring *fname = astring_assemble_3(astring_alloc(), regiontag, PATH_SEPARATOR, ROM_GETNAME(romp)); + if (has_crc) + filerr = mame_fopen_crc(SEARCHPATH_ROM, astring_c(fname), crc, OPEN_FLAG_READ, &romdata->file); + else + filerr = mame_fopen(SEARCHPATH_ROM, astring_c(fname), OPEN_FLAG_READ, &romdata->file); + astring_free(fname); + } /* return the result */ return (filerr == FILERR_NONE); @@ -735,7 +747,7 @@ static void copy_rom_data(rom_load_data *romdata, const rom_entry *romp) for a region -------------------------------------------------*/ -static void process_rom_entries(rom_load_data *romdata, const rom_entry *romp) +static void process_rom_entries(rom_load_data *romdata, const char *regiontag, const rom_entry *romp) { UINT32 lastflags = 0; @@ -773,7 +785,7 @@ static void process_rom_entries(rom_load_data *romdata, const rom_entry *romp) /* open the file */ LOG(("Opening ROM file: %s\n", ROM_GETNAME(romp))); - if (!open_rom_file(romdata, romp)) + if (!open_rom_file(romdata, regiontag, romp)) handle_missing_file(romdata, romp); /* loop until we run out of reloads */ @@ -1097,34 +1109,13 @@ static UINT32 normalize_flags_for_cpu(running_machine *machine, UINT32 startflag /*------------------------------------------------- - rom_init - new, more flexible ROM - loading system + process_region_list - process a region list -------------------------------------------------*/ -void rom_init(running_machine *machine, const rom_entry *romp) +static void process_region_list(running_machine *machine, rom_load_data *romdata, const rom_entry *romp) { - static rom_load_data romdata; const rom_entry *region; - /* if no roms, bail */ - if (romp == NULL) - return; - - /* make sure we get called back on the way out */ - add_exit_callback(machine, rom_exit); - - /* reset the romdata struct */ - memset(&romdata, 0, sizeof(romdata)); - - /* determine the correct biosset to load based on OPTION_BIOS string */ - system_bios = determine_bios_rom(&romdata, romp); - - romdata.romstotal = count_roms(romp); - - /* reset the disk list */ - chd_list = NULL; - chd_list_tailptr = &chd_list; - /* loop until we hit the end */ for (region = romp; region; region = rom_next_region(region)) { @@ -1142,34 +1133,83 @@ void rom_init(running_machine *machine, const rom_entry *romp) regionflags = normalize_flags_for_cpu(machine, regionflags, regiontag); /* remember the base and length */ - romdata.regionbase = memory_region_alloc(machine, regiontag, regionlength, regionflags); - romdata.regionlength = regionlength; - LOG(("Allocated %X bytes @ %p\n", romdata.regionlength, romdata.regionbase)); + romdata->regionbase = memory_region_alloc(machine, regiontag, regionlength, regionflags); + romdata->regionlength = regionlength; + LOG(("Allocated %X bytes @ %p\n", romdata->regionlength, romdata->regionbase)); /* clear the region if it's requested */ if (ROMREGION_ISERASE(region)) - memset(romdata.regionbase, ROMREGION_GETERASEVAL(region), romdata.regionlength); + memset(romdata->regionbase, ROMREGION_GETERASEVAL(region), romdata->regionlength); /* or if it's sufficiently small (<= 4MB) */ - else if (romdata.regionlength <= 0x400000) - memset(romdata.regionbase, 0, romdata.regionlength); + else if (romdata->regionlength <= 0x400000) + memset(romdata->regionbase, 0, romdata->regionlength); #ifdef MAME_DEBUG /* if we're debugging, fill region with random data to catch errors */ else - fill_random(romdata.regionbase, romdata.regionlength); + fill_random(romdata->regionbase, romdata->regionlength); #endif /* now process the entries in the region */ if (ROMREGION_ISROMDATA(region)) - process_rom_entries(&romdata, region + 1); + process_rom_entries(romdata, ROMREGION_ISLOADBYNAME(region) ? regiontag : NULL, region + 1); else if (ROMREGION_ISDISKDATA(region)) - process_disk_entries(&romdata, regiontag, region + 1); + process_disk_entries(romdata, regiontag, region + 1); } /* now go back and post-process all the regions */ for (region = romp; region != NULL; region = rom_next_region(region)) - region_post_process(machine, &romdata, ROMREGION_GETTAG(region)); + region_post_process(machine, romdata, ROMREGION_GETTAG(region)); +} + + +/*------------------------------------------------- + rom_init - new, more flexible ROM + loading system +-------------------------------------------------*/ + +void rom_init(running_machine *machine, const rom_entry *romp) +{ + static rom_load_data romdata; + const device_config *device; + + /* if no roms, bail */ + if (romp == NULL) + return; + + /* make sure we get called back on the way out */ + add_exit_callback(machine, rom_exit); + + /* reset the romdata struct */ + memset(&romdata, 0, sizeof(romdata)); + + /* determine the correct biosset to load based on OPTION_BIOS string */ + system_bios = determine_bios_rom(&romdata, romp); + + /* count the total number of ROMs */ + romdata.romstotal = count_roms(romp); + for (device = machine->config->devicelist; device != NULL; device = device->next) + { + const rom_entry *devromp = device_get_info_ptr(device, DEVINFO_PTR_ROM_REGION); + if (devromp != NULL) + romdata.romstotal += count_roms(devromp); + } + + /* reset the disk list */ + chd_list = NULL; + chd_list_tailptr = &chd_list; + + /* process the ROM entries we were passed */ + process_region_list(machine, &romdata, romp); + + /* look through the devices and process any ROM entries they have */ + for (device = machine->config->devicelist; device != NULL; device = device->next) + { + const rom_entry *devromp = device_get_info_ptr(device, DEVINFO_PTR_ROM_REGION); + if (devromp != NULL) + process_region_list(machine, &romdata, devromp); + } /* display the results and exit */ total_rom_load_warnings = romdata.warnings; diff --git a/src/emu/romload.h b/src/emu/romload.h index 1df8eea801f..8d2dd26a9f9 100644 --- a/src/emu/romload.h +++ b/src/emu/romload.h @@ -68,6 +68,10 @@ enum #define ROMREGION_DATATYPEROM 0x00000000 #define ROMREGION_DATATYPEDISK 0x00004000 +#define ROMREGION_LOADBYNAMEMASK 0x00008000 /* use region name as path to read from */ +#define ROMREGION_NOLOADBYNAME 0x00000000 +#define ROMREGION_LOADBYNAME 0x00008000 + #define ROMREGION_ERASEVALMASK 0x00ff0000 /* value to erase the region to */ #define ROMREGION_ERASEVAL(x) ((((x) & 0xff) << 16) | ROMREGION_ERASE) #define ROMREGION_ERASE00 ROMREGION_ERASEVAL(0) @@ -185,6 +189,7 @@ struct _rom_load_data #define ROMREGION_GETDATATYPE(r) (ROMREGION_GETFLAGS(r) & ROMREGION_DATATYPEMASK) #define ROMREGION_ISROMDATA(r) (ROMREGION_GETDATATYPE(r) == ROMREGION_DATATYPEROM) #define ROMREGION_ISDISKDATA(r) (ROMREGION_GETDATATYPE(r) == ROMREGION_DATATYPEDISK) +#define ROMREGION_ISLOADBYNAME(r) ((ROMREGION_GETFLAGS(r) & ROMREGION_LOADBYNAMEMASK) == ROMREGION_LOADBYNAME) /* ----- per-ROM macros ----- */ diff --git a/src/emu/validity.c b/src/emu/validity.c index 7bedce63f52..3294233ead9 100644 --- a/src/emu/validity.c +++ b/src/emu/validity.c @@ -504,6 +504,7 @@ static int validate_driver(int drivnum, const machine_config *config) static int validate_roms(int drivnum, const machine_config *config, region_info *rgninfo) { const game_driver *driver = drivers[drivnum]; + const device_config *device = NULL; const rom_entry *romp; const char *last_name = "???"; int error = FALSE; @@ -513,126 +514,147 @@ static int validate_roms(int drivnum, const machine_config *config, region_info /* reset region info */ memset(rgninfo, 0, sizeof(*rgninfo)); - - /* scan the ROM entries */ - for (romp = driver->rom; romp && !ROMENTRY_ISEND(romp); romp++) + + /* iterate, starting with the driver's ROMs and continuing with device ROMs */ + romp = driver->rom; + while (romp != NULL) { - /* if this is a region, make sure it's valid, and record the length */ - if (ROMENTRY_ISREGION(romp)) + /* scan the ROM entries */ + for ( ; !ROMENTRY_ISEND(romp); romp++) { - const char *region = ROMREGION_GETTAG(romp); - - /* if we haven't seen any items since the last region, print a warning */ - if (items_since_region == 0) - mame_printf_warning("%s: %s has empty ROM region (warning)\n", driver->source_file, driver->name); - items_since_region = (ROMREGION_ISERASE(romp) || ROMREGION_ISDISPOSE(romp) || ROMREGION_ISDISKDATA(romp)) ? 1 : 0; - currgn = NULL; - - /* check for an invalid tag */ - if (region == NULL || region[0] == 0) + /* if this is a region, make sure it's valid, and record the length */ + if (ROMENTRY_ISREGION(romp)) { - mame_printf_error("%s: %s has duplicate ROM_REGION tag \"%s\"\n", driver->source_file, driver->name, region); - error = TRUE; - } + const char *region = ROMREGION_GETTAG(romp); - /* find any empty entry, checking for duplicates */ - else - { - int rgnnum; + /* if we haven't seen any items since the last region, print a warning */ + if (items_since_region == 0) + mame_printf_warning("%s: %s has empty ROM region (warning)\n", driver->source_file, driver->name); + items_since_region = (ROMREGION_ISERASE(romp) || ROMREGION_ISDISPOSE(romp) || ROMREGION_ISDISKDATA(romp)) ? 1 : 0; + currgn = NULL; - /* iterate over all regions found so far */ - for (rgnnum = 0; rgnnum < ARRAY_LENGTH(rgninfo->entries); rgnnum++) + /* check for an invalid tag */ + if (region == NULL || region[0] == 0) { - /* stop when we hit an empty */ - if (rgninfo->entries[rgnnum].tag == NULL) - { - currgn = &rgninfo->entries[rgnnum]; - currgn->tag = region; - currgn->length = ROMREGION_GETLENGTH(romp); - break; - } + mame_printf_error("%s: %s has duplicate ROM_REGION tag \"%s\"\n", driver->source_file, driver->name, region); + error = TRUE; + } - /* fail if we hit a duplicate */ - if (strcmp(rgninfo->entries[rgnnum].tag, region) == 0) + /* find any empty entry, checking for duplicates */ + else + { + int rgnnum; + + /* iterate over all regions found so far */ + for (rgnnum = 0; rgnnum < ARRAY_LENGTH(rgninfo->entries); rgnnum++) { - mame_printf_error("%s: %s has duplicate ROM_REGION type \"%s\"\n", driver->source_file, driver->name, region); - error = TRUE; - break; + /* stop when we hit an empty */ + if (rgninfo->entries[rgnnum].tag == NULL) + { + currgn = &rgninfo->entries[rgnnum]; + currgn->tag = region; + currgn->length = ROMREGION_GETLENGTH(romp); + break; + } + + /* fail if we hit a duplicate */ + if (strcmp(rgninfo->entries[rgnnum].tag, region) == 0) + { + mame_printf_error("%s: %s has duplicate ROM_REGION type \"%s\"\n", driver->source_file, driver->name, region); + error = TRUE; + break; + } } } + + /* load by name entries must be 8 characters or less */ + if (ROMREGION_ISLOADBYNAME(romp) && strlen(region) > 8) + { + mame_printf_error("%s: %s has load-by-name region \"%s\" with name >8 characters\n", driver->source_file, driver->name, region); + error = TRUE; + } } - } - /* If this is a system bios, make sure it is using the next available bios number */ - else if (ROMENTRY_ISSYSTEM_BIOS(romp)) - { - bios_flags = ROM_GETBIOSFLAGS(romp); - if (last_bios+1 != bios_flags) + /* If this is a system bios, make sure it is using the next available bios number */ + else if (ROMENTRY_ISSYSTEM_BIOS(romp)) { - const char *name = ROM_GETNAME(romp); - mame_printf_error("%s: %s has non-sequential bios %s\n", driver->source_file, driver->name, name); - error = TRUE; + bios_flags = ROM_GETBIOSFLAGS(romp); + if (last_bios+1 != bios_flags) + { + const char *name = ROM_GETNAME(romp); + mame_printf_error("%s: %s has non-sequential bios %s\n", driver->source_file, driver->name, name); + error = TRUE; + } + last_bios = bios_flags; } - last_bios = bios_flags; - } - /* if this is a file, make sure it is properly formatted */ - else if (ROMENTRY_ISFILE(romp)) - { - const char *hash; - const char *s; + /* if this is a file, make sure it is properly formatted */ + else if (ROMENTRY_ISFILE(romp)) + { + const char *hash; + const char *s; - items_since_region++; + items_since_region++; - /* track the last filename we found */ - last_name = ROM_GETNAME(romp); + /* track the last filename we found */ + last_name = ROM_GETNAME(romp); - /* make sure it's all lowercase */ - for (s = last_name; *s; s++) - if (tolower(*s) != *s) + /* make sure it's all lowercase */ + for (s = last_name; *s; s++) + if (tolower(*s) != *s) + { + mame_printf_error("%s: %s has upper case ROM name %s\n", driver->source_file, driver->name, last_name); + error = TRUE; + break; + } + + /* if this is a bios rom, make sure it has the same flags as the last system bios entry */ + bios_flags = ROM_GETBIOSFLAGS(romp); + if (bios_flags != 0) { - mame_printf_error("%s: %s has upper case ROM name %s\n", driver->source_file, driver->name, last_name); - error = TRUE; - break; + if (bios_flags != last_bios) + { + mame_printf_error("%s: %s has bios rom name %s without preceding matching system bios definition\n", driver->source_file, driver->name, last_name); + error = TRUE; + } } - /* if this is a bios rom, make sure it has the same flags as the last system bios entry */ - bios_flags = ROM_GETBIOSFLAGS(romp); - if (bios_flags != 0) - { - if (bios_flags != last_bios) + /* make sure the has is valid */ + hash = ROM_GETHASHDATA(romp); + if (!hash_verify_string(hash)) { - mame_printf_error("%s: %s has bios rom name %s without preceding matching system bios definition\n", driver->source_file, driver->name, last_name); + mame_printf_error("%s: rom '%s' has an invalid hash string '%s'\n", driver->name, last_name, hash); error = TRUE; } } - /* make sure the has is valid */ - hash = ROM_GETHASHDATA(romp); - if (!hash_verify_string(hash)) + /* for any non-region ending entries, make sure they don't extend past the end */ + if (!ROMENTRY_ISREGIONEND(romp) && currgn != NULL) { - mame_printf_error("%s: rom '%s' has an invalid hash string '%s'\n", driver->name, last_name, hash); - error = TRUE; + items_since_region++; + + if (ROM_GETOFFSET(romp) + ROM_GETLENGTH(romp) > currgn->length) + { + mame_printf_error("%s: %s has ROM %s extending past the defined memory region\n", driver->source_file, driver->name, last_name); + error = TRUE; + } } } - /* for any non-region ending entries, make sure they don't extend past the end */ - if (!ROMENTRY_ISREGIONEND(romp) && currgn != NULL) - { - items_since_region++; + /* final check for empty regions */ + if (items_since_region == 0) + mame_printf_warning("%s: %s has empty ROM region (warning)\n", driver->source_file, driver->name); - if (ROM_GETOFFSET(romp) + ROM_GETLENGTH(romp) > currgn->length) - { - mame_printf_error("%s: %s has ROM %s extending past the defined memory region\n", driver->source_file, driver->name, last_name); - error = TRUE; - } + /* look for more devices with regions */ + romp = NULL; + for (device = (device == NULL) ? config->devicelist : device->next; device != NULL; device = device->next) + { + romp = device_get_info_ptr(device, DEVINFO_PTR_ROM_REGION); + if (romp != NULL) + break; } } - /* final check for empty regions */ - if (items_since_region == 0) - mame_printf_warning("%s: %s has empty ROM region (warning)\n", driver->source_file, driver->name); - return error; } diff --git a/src/ldplayer/ldplayer.c b/src/ldplayer/ldplayer.c index ed83ac7cc93..f7d49cd3f90 100644 --- a/src/ldplayer/ldplayer.c +++ b/src/ldplayer/ldplayer.c @@ -16,10 +16,6 @@ #include <ctype.h> -#define TEST_PR8210_ROM 0 - - - /************************************* * * Constants @@ -70,16 +66,6 @@ static UINT8 pr8210_command_buffer[10]; static void (*execute_command)(const device_config *laserdisc, int command); -#if TEST_PR8210_ROM - -static UINT8 pia[0x100]; -static UINT8 pr8210_porta; -static UINT8 pr8210_portb; -static UINT8 pr8210_pia_porta; -static UINT8 pr8210_pia_portb; - -#endif - /************************************* @@ -241,11 +227,7 @@ static TIMER_CALLBACK( pr8210_bit_callback ) 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)]; -#if TEST_PR8210_ROM - pr8210_pia_porta = BITSWAP8(data, 0,1,2,3,4,5,6,7); -#else bitsleft = 12; -#endif } timer_adjust_oneshot(pr8210_bit_timer, duration, (bitsleft << 16) | data); } @@ -449,175 +431,6 @@ INPUT_PORTS_END /************************************* * - * Test PR-8210 ROM emulation - * - *************************************/ - -#if TEST_PR8210_ROM - -static READ8_HANDLER( pr8210_pia_r ) -{ - UINT8 result = pia[offset]; - switch (offset) - { - case 0xa0: -// printf("%03X:pia_r(%02X) = %02X\n", activecpu_get_pc(), offset, pr8210_pia_porta); - result = pr8210_pia_porta; - pr8210_pia_porta = 0; - break; - - default: - printf("%03X:pia_r(%02X)\n", activecpu_get_pc(), offset); - break; - } - return result; -} - -static WRITE8_HANDLER( pr8210_pia_w ) -{ - /* - $22-26 (R) = read and copied to memory $23-27 - $23 (R) = something compared against $F4 - $22-26 (W) = SRCH. text - $27-2B (W) = FRAME/CHAP. text - $2C-30 (W) = frame or chapter number - $40 (W) = $CF at initialization, tracked by ($78) - $60 (W) = port B output, tracked by ($77) - $80 = n/c - $40 = (out) LED3 - $20 = (out) LED2 - $10 = (out) LED1 - 123 -> LHL = Play - -> HLL = Slow fwd - -> LLL = Slow rev - -> HHL = Still - -> LLH = Pause - -> HHH = all off - $08 = (out) CAV LED - $04 = (out) CLV LED - $02 = (out) A2 LED/AUDIO 2 - $01 = (out) A1 LED/AUDIO 1 - $80 (W) = 0 or 1 - $A0 (R) = port A input - $C0 (R) = stored to ($2E) - $E0 (R) = stored to ($2F) - */ - if (pia[offset] != data) - { - switch (offset) - { - case 0x60: - printf("%03X:pia_w(%02X) = %02X (PORT B LEDS:", activecpu_get_pc(), offset, data); - if (!(data & 0x01)) printf(" AUDIO1"); - if (!(data & 0x02)) printf(" AUDIO2"); - if (!(data & 0x04)) printf(" CLV"); - if (!(data & 0x08)) printf(" CAV"); - printf(" LED123=%c%c%c", (data & 0x10) ? 'H' : 'L', (data & 0x20) ? 'H' : 'L', (data & 0x40) ? 'H' : 'L'); - if (!(data & 0x80)) printf(" ???"); - printf(")\n"); - pr8210_pia_portb = data; - break; - - default: - printf("%03X:pia_w(%02X) = %02X\n", activecpu_get_pc(), offset, data); - break; - } - pia[offset] = data; - } -} - -static READ8_HANDLER( pr8210_bus_r ) -{ - /* - $80 = n/c - $40 = (in) slide pot interrupt source (slider position limit detector, inside and outside) - $20 = n/c - $10 = (in) /FOCUS LOCK - $08 = (in) /SPDL LOCK - $04 = (in) SIZE 8/12 - $02 = (in) FG via op-amp (spindle motor stop detector) - $01 = (in) SLOW TIMER OUT - */ - offs_t pc = activecpu_get_pc(); - if (pc != 0x11c) - printf("%03X:bus_r\n", pc); - - /* loop at beginning waits for $40=0, $02=1 */ - return 0xff & ~0x40 & ~0x04; -} - -static WRITE8_HANDLER( pr8210_porta_w ) -{ - /* - $80 = (out) SCAN C (F/R) - $40 = (out) AUDIO SQ - $20 = (out) VIDEO SQ - $10 = (out) /SPDL ON - $08 = (out) /FOCUS ON - $04 = (out) SCAN B (L/H) - $02 = (out) SCAN A (/SCAN) - $01 = (out) JUMP TRG (jump back trigger, clock on high->low) - */ - if (data != pr8210_porta) - { - printf("%03X:porta_w = %02X", activecpu_get_pc(), data); - if (!(data & 0x01)) printf(" JUMPTRG"); - if (!(data & 0x02)) - { - printf(" SCAN:%c:%c", (data & 0x80) ? 'F' : 'R', (data & 0x04) ? 'L' : 'H'); - } - if (!(data & 0x08)) printf(" /FOCUSON"); - if (!(data & 0x10)) printf(" /SPDLON"); - if (data & 0x20) printf(" VIDEOSQ"); - if (data & 0x40) printf(" AUDIOSQ"); - printf("\n"); - pr8210_porta = data; - } -} - -static WRITE8_HANDLER( pr8210_portb_w ) -{ - /* - $80 = (out) /CS on PIA - $40 = (out) 0 to self-generate IRQ - $20 = (out) SLOW TRG - $10 = (out) STANDBY LED - $08 = (out) TP2 - $04 = (out) TP1 - $02 = (out) ??? - $01 = (out) LASER ON - */ - cputag_set_input_line(machine, "pr8210", 0, (data & 0x40) ? CLEAR_LINE : ASSERT_LINE); - if ((data & 0x7f) != (pr8210_portb & 0x7f)) - { - printf("%03X:portb_w = %02X", activecpu_get_pc(), data); - if (!(data & 0x01)) printf(" LASERON"); - if (!(data & 0x02)) printf(" ???"); - if (!(data & 0x04)) printf(" TP1"); - if (!(data & 0x08)) printf(" TP2"); - if (!(data & 0x10)) printf(" STANDBYLED"); - if (!(data & 0x20)) printf(" SLOWTRG"); - if (!(data & 0x40)) printf(" IRQGEN"); -// if (data & 0x80) printf(" PIASEL"); - printf("\n"); - pr8210_portb = data; - } -} - - -static ADDRESS_MAP_START( pr8210_portmap, ADDRESS_SPACE_IO, 8 ) - AM_RANGE(0x00, 0xff) AM_READWRITE(pr8210_pia_r, pr8210_pia_w) - AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READ(pr8210_bus_r) - AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(pr8210_porta_w) - AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(pr8210_portb_w) -ADDRESS_MAP_END - -#endif - - - -/************************************* - * * Machine drivers * *************************************/ @@ -654,11 +467,6 @@ static MACHINE_DRIVER_START( pr8210 ) MDRV_MACHINE_START(pr8210) MDRV_MACHINE_RESET(pr8210) MDRV_LASERDISC_ADD("laserdisc", PIONEER_PR8210) - -#if TEST_PR8210_ROM - MDRV_CPU_ADD("pr8210", I8049, XTAL_4_41MHz) - MDRV_CPU_IO_MAP(pr8210_portmap,0) -#endif MACHINE_DRIVER_END @@ -676,11 +484,6 @@ ROM_END ROM_START( pr8210 ) DISK_REGION( "laserdisc" ) - -#if TEST_PR8210_ROM - ROM_REGION( 0x800, "pr8210", 0 ) - ROM_LOAD( "pr-8210_mcu_ud6005a.bin", 0x000, 0x800, CRC(120fa83b) SHA1(b514326ca1f52d6d89056868f9d17eabd4e3f31d) ) -#endif ROM_END |