diff options
| author | 2009-06-23 16:36:28 +0000 | |
|---|---|---|
| committer | 2009-06-23 16:36:28 +0000 | |
| commit | dc3b29f1b78882b8376a8cdedec585c92f5e87d4 (patch) | |
| tree | 36f06d13b8855b1a0f51ca9231360f47f947a5ea | |
| parent | 30f95d2ce255c27e4df8b7b435cfbdd05cd3861d (diff) | |
mc68hc11: added user-selectable configs, and hooked up in both drivers
| -rw-r--r-- | src/emu/cpu/mc68hc11/mc68hc11.c | 21 | ||||
| -rw-r--r-- | src/emu/cpu/mc68hc11/mc68hc11.h | 7 | ||||
| -rw-r--r-- | src/mame/drivers/hitpoker.c | 37 | ||||
| -rw-r--r-- | src/mame/drivers/taitojc.c | 10 |
4 files changed, 52 insertions, 23 deletions
diff --git a/src/emu/cpu/mc68hc11/mc68hc11.c b/src/emu/cpu/mc68hc11/mc68hc11.c index 7de84c434b6..35b0ecbdcca 100644 --- a/src/emu/cpu/mc68hc11/mc68hc11.c +++ b/src/emu/cpu/mc68hc11/mc68hc11.c @@ -6,7 +6,6 @@ TODO: - Interrupts handling is really bare-bones, just to make Hit Poker happy; - Complete opcodes hook-up; -- Add config-selectable I/O / internal RAM and the ability to enable/disable it; - Emulate the MC68HC12 (same as HC11 with a bunch of new opcodes); */ @@ -68,6 +67,7 @@ struct _hc11_state int ram_position; int reg_position; UINT8 *internal_ram; + int has_io; // I/O enable flag int internal_ram_size; UINT8 wait_state,stop_state; }; @@ -288,7 +288,7 @@ INLINE UINT16 FETCH16(hc11_state *cpustate) INLINE UINT8 READ8(hc11_state *cpustate, UINT32 address) { - if(address >= cpustate->reg_position && address < cpustate->reg_position+0x100) + if(address >= cpustate->reg_position && address < cpustate->reg_position+0x100 && cpustate->has_io) { return hc11_regs_r(cpustate, address); } @@ -301,7 +301,7 @@ INLINE UINT8 READ8(hc11_state *cpustate, UINT32 address) INLINE void WRITE8(hc11_state *cpustate, UINT32 address, UINT8 value) { - if(address >= cpustate->reg_position && address < cpustate->reg_position+0x100) + if(address >= cpustate->reg_position && address < cpustate->reg_position+0x100 && cpustate->has_io) { hc11_regs_w(cpustate, address, value); return; @@ -340,6 +340,8 @@ static CPU_INIT( hc11 ) hc11_state *cpustate = get_safe_token(device); int i; + const hc11_config *conf = (const hc11_config *)device->static_config; + /* clear the opcode tables */ for(i=0; i < 256; i++) { hc11_optable[i] = HC11OP(invalid); @@ -367,7 +369,18 @@ static CPU_INIT( hc11 ) } } - cpustate->internal_ram_size = 1280; /* FIXME: this is for MC68HC11M0 */ + if(conf) + { + cpustate->has_io = conf->has_io; + cpustate->internal_ram_size = conf->internal_ram_size; + } + else + { + /* defaults it to the HC11M0 version for now (I might strip this down on a later date) */ + cpustate->has_io = 1; + cpustate->internal_ram_size = 1280; + } + cpustate->internal_ram = auto_alloc_array(device->machine, UINT8, cpustate->internal_ram_size); cpustate->reg_position = 0; diff --git a/src/emu/cpu/mc68hc11/mc68hc11.h b/src/emu/cpu/mc68hc11/mc68hc11.h index 91b0ca02a81..583b4c1808b 100644 --- a/src/emu/cpu/mc68hc11/mc68hc11.h +++ b/src/emu/cpu/mc68hc11/mc68hc11.h @@ -32,5 +32,12 @@ CPU_GET_INFO( mc68hc11 ); #define MC68HC11_IRQ_LINE 0 +typedef struct _hc11_config hc11_config; +struct _hc11_config +{ + int has_io; // I/O enable flag + int internal_ram_size; +}; + #endif /* __MC68HC11_H__ */ diff --git a/src/mame/drivers/hitpoker.c b/src/mame/drivers/hitpoker.c index 812346d5639..977a2e91786 100644 --- a/src/mame/drivers/hitpoker.c +++ b/src/mame/drivers/hitpoker.c @@ -6,10 +6,10 @@ preliminary driver by Angelo Salese & David Haywood Many thanks to Olivier Galibert for the CPU identify effort ;-) TODO: -- Fix the remaining CPU core bugs (for example the i/o & internal RAM disable to - avoid the soft reset thing) -- Protection controls inputs +- CPU core bugs? +- Protection controls inputs; - Understand & fix EEPROM emulation; +- Hangs during attract mode, eeprom or protection? - complete video HW (unknown bits and hblank); - 24Khz monitor isn't supported, it changes the resolution to 648 x 480 and changes the register 9 (raster lines x character lines) from 7 to 0xf. @@ -34,15 +34,10 @@ DIP 1X4 ============================================================================ Some debug tricks (let's test this CPU as more as possible): -- let it run then soft reset (it wants that ram at 0-0xff is equal to 0xff); * -- set a bp at 10c5 then pc=10c8, it currently fails the rom checksum * -- set a bp at 1185, the "bad crc 000" msg is caused by this routine. (DONE) +- set a bp at 1185, the "bad crc 000" msg is caused by this routine. + (kludged to work) - set a bp at 121f then pc=1223 - set a bp at 3a50 then pc+=2, it should now enter into attract mode - (at last!) - -* If you disable the MC68HC11 internal ram / I/O regs it'll pass the ROM - checksum, maybe it isn't a MC68HC11 but something without the I/O stuff? ***************************************************************************/ @@ -452,10 +447,18 @@ static const ay8910_interface ay8910_config = DEVCB_NULL }; +/* For whatever reason the MCU capabilities are disabled, might be a version without it or the engineers programmed the MCU to not have it. */ +static const hc11_config hitpoker_config = +{ + 0, //has internal I/O + 0 //internal RAM size +}; + static MACHINE_DRIVER_START( hitpoker ) MDRV_CPU_ADD("maincpu", MC68HC11,1000000) MDRV_CPU_PROGRAM_MAP(hitpoker_map) MDRV_CPU_IO_MAP(hitpoker_io) + MDRV_CPU_CONFIG(hitpoker_config) MDRV_CPU_VBLANK_INT("screen", irq0_line_hold) /* video hardware */ @@ -463,8 +466,8 @@ static MACHINE_DRIVER_START( hitpoker ) MDRV_SCREEN_REFRESH_RATE(60) MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) // not accurate MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) - MDRV_SCREEN_SIZE(648, 480) //setted with - MDRV_SCREEN_VISIBLE_AREA(0, 648-1, 0, 480-1) + MDRV_SCREEN_SIZE(648, 480) //setted by the CRTC + MDRV_SCREEN_VISIBLE_AREA(0, 648-1, 0, 240-1) MDRV_MC6845_ADD("crtc", H46505, CRTC_CLOCK/2, mc6845_intf) /* hand tuned to get ~60 fps */ @@ -485,15 +488,13 @@ DRIVER_INIT(hitpoker) { UINT8 *ROM = memory_region(machine, "maincpu"); - ROM[0x10c6] = 0x01; - ROM[0x10c7] = 0x01; //patch the checksum routine for now... - #if 1 - ROM[0x1220] = 0x01; + ROM[0x1220] = 0x01; //patch eeprom write? ROM[0x1221] = 0x01; ROM[0x1222] = 0x01; - ROM[0x3a50] = 0x01; - ROM[0x3a51] = 0x01; + + ROM[0x10c6] = 0x01; + ROM[0x10c7] = 0x01; //patch the checksum routine #endif } diff --git a/src/mame/drivers/taitojc.c b/src/mame/drivers/taitojc.c index e6df0575119..ba1c62272cd 100644 --- a/src/mame/drivers/taitojc.c +++ b/src/mame/drivers/taitojc.c @@ -1293,6 +1293,13 @@ static INTERRUPT_GEN( taitojc_int6 ) cpu_set_input_line(device, 6, HOLD_LINE); } +static const hc11_config taitojc_config = +{ + 1, //has internal I/O + 1280 //internal RAM size +}; + + static MACHINE_DRIVER_START( taitojc ) MDRV_CPU_ADD("maincpu", M68040, 25000000) MDRV_CPU_PROGRAM_MAP(taitojc_map) @@ -1301,9 +1308,10 @@ static MACHINE_DRIVER_START( taitojc ) TAITO_F3_SOUND_SYSTEM_CPU(16000000) - MDRV_CPU_ADD("sub", MC68HC11, 4000000) + MDRV_CPU_ADD("sub", MC68HC11, 4000000) //MC68HC11M0 MDRV_CPU_PROGRAM_MAP(hc11_pgm_map) MDRV_CPU_IO_MAP(hc11_io_map) + MDRV_CPU_CONFIG(taitojc_config) MDRV_CPU_ADD("dsp", TMS32051, 50000000) MDRV_CPU_PROGRAM_MAP(tms_program_map) |
