Pointer-ified the PIC16C5x core.

This commit is contained in:
Quench 2008-12-11 06:52:59 +00:00
parent 51ea0b3e29
commit 922ea8052f
4 changed files with 550 additions and 554 deletions

File diff suppressed because it is too large Load Diff

View File

@ -42,7 +42,7 @@ enum
* the value if known (available in HEX dumps of the ROM).
*/
void pic16c5x_config(int data);
void pic16c5x_set_config(const device_config *cpu, int data);
/****************************************************************************
@ -50,21 +50,21 @@ void pic16c5x_config(int data);
*/
#define PIC16C5x_T0 0x10
#define PIC16C5x_T0_In (memory_read_byte_8le(R.io, PIC16C5x_T0))
#define PIC16C5x_T0_In (memory_read_byte_8le(cpustate->io, PIC16C5x_T0))
/****************************************************************************
* Input a word from given I/O port
*/
#define PIC16C5x_In(Port) ((UINT8)memory_read_byte_8le(R.io, (Port)))
#define PIC16C5x_In(Port) ((UINT8)memory_read_byte_8le(cpustate->io, (Port)))
/****************************************************************************
* Output a word to given I/O port
*/
#define PIC16C5x_Out(Port,Value) (memory_write_byte_8le(R.io, (Port),Value))
#define PIC16C5x_Out(Port,Value) (memory_write_byte_8le(cpustate->io, (Port),Value))
@ -72,14 +72,14 @@ void pic16c5x_config(int data);
* Read a word from given RAM memory location
*/
#define PIC16C5x_RAM_RDMEM(A) ((UINT8)memory_read_byte_8le(R.data, A))
#define PIC16C5x_RAM_RDMEM(A) ((UINT8)memory_read_byte_8le(cpustate->data, A))
/****************************************************************************
* Write a word to given RAM memory location
*/
#define PIC16C5x_RAM_WRMEM(A,V) (memory_write_byte_8le(R.data, A,V))
#define PIC16C5x_RAM_WRMEM(A,V) (memory_write_byte_8le(cpustate->data, A,V))
@ -89,7 +89,7 @@ void pic16c5x_config(int data);
* can be used to greatly speed up emulation
*/
#define PIC16C5x_RDOP(A) (memory_decrypted_read_word(R.program, (A)<<1))
#define PIC16C5x_RDOP(A) (memory_decrypted_read_word(cpustate->program, (A)<<1))
/****************************************************************************
@ -98,7 +98,7 @@ void pic16c5x_config(int data);
* that use different encoding mechanisms for opcodes and opcode arguments
*/
#define PIC16C5x_RDOP_ARG(A) (memory_raw_read_word(R.program, (A)<<1))
#define PIC16C5x_RDOP_ARG(A) (memory_raw_read_word(cpustate->program, (A)<<1))

View File

@ -539,7 +539,8 @@ static DRIVER_INIT( drgnmst )
data_lo = drgnmst_asciitohex((drgnmst_PICROM_HEX[src_pos + 3]));
data |= (data_hi << 12) | (data_lo << 8);
pic16c5x_config(data);
pic16c5x_set_config(cputag_get_cpu(machine, "audio"), data);
src_pos = 0x7fff; /* Force Exit */
}
src_pos += 1;

View File

@ -922,7 +922,7 @@ static MACHINE_DRIVER_START( bigtwin )
MDRV_CPU_PROGRAM_MAP(bigtwin_main_map, 0)
MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
MDRV_CPU_ADD("mcu", PIC16C57, 12000000) /* 3MHz */
MDRV_CPU_ADD("audio", PIC16C57, 12000000) /* 3MHz */
/* Program and Data Maps are internal to the MCU */
MDRV_CPU_IO_MAP(playmark_sound_io_map, 0)
@ -956,7 +956,7 @@ static MACHINE_DRIVER_START( wbeachvl )
MDRV_CPU_PROGRAM_MAP(wbeachvl_main_map, 0)
MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
// MDRV_CPU_ADD("mcu", PIC16C57, 12000000) /* 3MHz */
// MDRV_CPU_ADD("audio", PIC16C57, 12000000) /* 3MHz */
/* Program and Data Maps are internal to the MCU */
// MDRV_CPU_IO_MAP(playmark_sound_io_map, 0)
@ -991,7 +991,7 @@ static MACHINE_DRIVER_START( excelsr )
MDRV_CPU_PROGRAM_MAP(excelsr_main_map, 0)
MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
MDRV_CPU_ADD("mcu", PIC16C57, 12000000) /* 3MHz */
MDRV_CPU_ADD("audio", PIC16C57, 12000000) /* 3MHz */
/* Program and Data Maps are internal to the MCU */
MDRV_CPU_IO_MAP(playmark_sound_io_map, 0)
@ -1024,7 +1024,7 @@ static MACHINE_DRIVER_START( hotmind )
MDRV_CPU_PROGRAM_MAP(hotmind_main_map, 0)
MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
MDRV_CPU_ADD("mcu", PIC16C57, XTAL_24MHz/2) /* verified on pcb */
MDRV_CPU_ADD("audio", PIC16C57, XTAL_24MHz/2) /* verified on pcb */
/* Program and Data Maps are internal to the MCU */
MDRV_CPU_IO_MAP(playmark_sound_io_map, 0)
@ -1059,7 +1059,7 @@ static MACHINE_DRIVER_START( hrdtimes )
MDRV_CPU_PROGRAM_MAP(hrdtimes_main_map, 0)
MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
// MDRV_CPU_ADD("mcu", PIC16C57, XTAL_24MHz/2) /* verified on pcb */
// MDRV_CPU_ADD("audio", PIC16C57, XTAL_24MHz/2) /* verified on pcb */
/* Program and Data Maps are internal to the MCU */
// MDRV_CPU_IO_MAP(playmark_sound_io_map, 0)
@ -1096,7 +1096,7 @@ ROM_START( bigtwin )
ROM_LOAD16_BYTE( "2.302", 0x000000, 0x80000, CRC(e6767f60) SHA1(ec0ba1c786e6fde04601c2f3f619e3c6545f9239) )
ROM_LOAD16_BYTE( "3.301", 0x000001, 0x80000, CRC(5aba6990) SHA1(4f664a91819fdd27821fa607425701d83fcbd8ce) )
ROM_REGION( 0x1000, "mcu", ROMREGION_ERASE00 ) /* sound (PIC16C57) */
ROM_REGION( 0x1000, "audio", ROMREGION_ERASE00 ) /* sound (PIC16C57) */
// ROM_LOAD( "16c57hs.bin", 0x0000, 0x1000, CRC(b4c95cc3) SHA1(7fc9b141e7782aa5c17310ee06db99d884537c30) )
/* ROM will be copied here by the init code from "user1" */
@ -1124,7 +1124,7 @@ ROM_START( wbeachvl )
ROM_LOAD16_BYTE( "wbv_02.bin", 0x000000, 0x40000, CRC(c7cca29e) SHA1(03af361081d688c4204a95f7f5babcc598b72c23) )
ROM_LOAD16_BYTE( "wbv_03.bin", 0x000001, 0x40000, CRC(db4e69d5) SHA1(119bf35a463d279ddde67ab08f6f1bab9f05cf0c) )
ROM_REGION( 0x1000, "cpu1", ROMREGION_ERASE00 ) /* sound (missing) */
ROM_REGION( 0x1000, "audio", ROMREGION_ERASE00 ) /* sound (missing) */
ROM_LOAD( "pic16c57", 0x0000, 0x1000, NO_DUMP )
ROM_REGION( 0x600000, "gfx1", ROMREGION_DISPOSE )
@ -1169,7 +1169,7 @@ ROM_START( wbeachv2 )
ROM_LOAD16_BYTE( "2.bin", 0x000000, 0x40000, CRC(8993487e) SHA1(c927ae655807f9046f66ff96a30bd2c6fa671566) )
ROM_LOAD16_BYTE( "3.bin", 0x000001, 0x40000, CRC(15904789) SHA1(640c80bbf7302529e1a39c2ae60e018ecb176478) )
ROM_REGION( 0x1000, "cpu1", ROMREGION_ERASE00 ) /* sound (missing) */
ROM_REGION( 0x1000, "audio", ROMREGION_ERASE00 ) /* sound (missing) */
ROM_LOAD( "pic16c57", 0x0000, 0x1000, NO_DUMP )
ROM_REGION( 0x600000, "gfx1", ROMREGION_DISPOSE )
@ -1218,7 +1218,7 @@ ROM_START( excelsr )
ROM_LOAD16_BYTE( "20.u305", 0x200001, 0x80000, CRC(8692afe9) SHA1(b4411bad64a9a6efd8eb13dcf7c5eebfb5681f3d) )
ROM_LOAD16_BYTE( "17.u306", 0x200000, 0x80000, CRC(978f9a6b) SHA1(9514b97f071fd20740218a58af877765beffedad) )
ROM_REGION( 0x1000, "mcu", ROMREGION_ERASE00 ) /* sound (PIC16C57) */
ROM_REGION( 0x1000, "audio", ROMREGION_ERASE00 ) /* sound (PIC16C57) */
/* ROM will be copied here by the init code from "user1" */
ROM_REGION( 0x3000, "user1", ROMREGION_DISPOSE )
@ -1296,7 +1296,7 @@ ROM_START( hotmind )
ROM_LOAD16_BYTE( "21.u87", 0x00000, 0x20000, CRC(e9000f7f) SHA1(c19fee7b774d3f30f4d4025a63ec396ec119c855) )
ROM_LOAD16_BYTE( "22.u68", 0x00001, 0x20000, CRC(2c518ec5) SHA1(6d9e81ddb5793d64e22dc0254519b947f6ec6954) )
ROM_REGION( 0x1000, "mcu", ROMREGION_ERASE00 ) /* sound (PIC16C57) */
ROM_REGION( 0x1000, "audio", ROMREGION_ERASE00 ) /* sound (PIC16C57) */
/* ROM will be copied here by the init code from "user1" */
/* original PIC (which is the one from Hard Times) was protected, but it works with the Excelsior one
@ -1329,7 +1329,7 @@ ROM_START( hrdtimes )
ROM_LOAD16_BYTE( "31.u67", 0x00000, 0x80000, CRC(53eb041b) SHA1(7437da1ceb26e9518a3085560b8a42f37e77ace9) )
ROM_LOAD16_BYTE( "32.u66", 0x00001, 0x80000, CRC(f2c6b382) SHA1(d73affed091a261c4bfe17f409657e0a46b6c163) )
ROM_REGION( 0x1000, "cpu1", ROMREGION_ERASE00 ) /* sound (PIC16C57) */
ROM_REGION( 0x1000, "audio", ROMREGION_ERASE00 ) /* sound (PIC16C57) */
ROM_LOAD( "pic16c57", 0x0000, 0x1000, NO_DUMP )
ROM_REGION( 0x200000, "gfx1", ROMREGION_DISPOSE )
@ -1365,7 +1365,7 @@ ROM_START( hrdtimea )
ROM_LOAD16_BYTE( "u67.bin", 0x00000, 0x80000, CRC(3e1334cb) SHA1(9523c04f92371a35c297280b42b1604e23790a1e) )
ROM_LOAD16_BYTE( "u66.bin", 0x00001, 0x80000, CRC(041ec30a) SHA1(00476ebd0a64cbd027be159cae7666d2df6d11ba) )
ROM_REGION( 0x1000, "cpu1", ROMREGION_ERASE00 ) /* sound (PIC16C57) */
ROM_REGION( 0x1000, "audio", ROMREGION_ERASE00 ) /* sound (PIC16C57) */
ROM_LOAD( "pic16c57", 0x0000, 0x1000, NO_DUMP )
ROM_REGION( 0x200000, "gfx1", ROMREGION_DISPOSE )
@ -1406,7 +1406,7 @@ static UINT8 playmark_asciitohex(UINT8 data)
static DRIVER_INIT( bigtwin )
{
UINT8 *playmark_PICROM_HEX = memory_region(machine, "user1");
UINT16 *playmark_PICROM = (UINT16 *)memory_region(machine, "mcu");
UINT16 *playmark_PICROM = (UINT16 *)memory_region(machine, "audio");
INT32 offs, data;
UINT16 src_pos = 0;
UINT16 dst_pos = 0;
@ -1459,7 +1459,8 @@ static DRIVER_INIT( bigtwin )
data_lo = playmark_asciitohex((playmark_PICROM_HEX[src_pos + 3]));
data |= (data_hi << 12) | (data_lo << 8);
pic16c5x_config(data);
pic16c5x_set_config(cputag_get_cpu(machine, "audio"), data);
src_pos = 0x7fff; /* Force Exit */
}
src_pos += 1;