Rewrite of the Motorola DSP56k CPU core. (Andrew Gardner)

* Partially implemented tfr op.
* Polygonet now allows test mode to be run for a few seconds.  Most IO is now known, though coin2 is still a mystery.
This commit is contained in:
Andrew Gardner 2008-10-28 14:44:07 +00:00
parent 8c317b186b
commit 5b5edd9eb9
2 changed files with 63 additions and 33 deletions

View File

@ -169,27 +169,29 @@ static void execute_x_memory_data_move (const UINT16 op, typed_pointer* d_regist
static void execute_x_memory_data_move2(const UINT16 op, typed_pointer* d_register);
static UINT16 decode_BBB_bitmask(UINT16 BBB, UINT16 *iVal);
static int decode_cccc_table(UINT16 cccc);
static void decode_DDDDD_table(UINT16 DDDDD, typed_pointer* ret);
static void decode_DD_table(UINT16 DD, typed_pointer* ret);
static void decode_F_table(UINT16 F, typed_pointer* ret);
static void decode_h0hF_table(UINT16 h0h, UINT16 F, typed_pointer* src_ret, typed_pointer* dst_ret);
static void decode_HH_table(UINT16 HH, typed_pointer* ret);
static void decode_HHH_table(UINT16 HHH, typed_pointer* ret);
static void decode_IIII_table(UINT16 IIII, typed_pointer* src_ret, typed_pointer* dst_ret, void *working);
static void decode_JJJF_table(UINT16 JJJ, UINT16 F, typed_pointer* src_ret, typed_pointer* dst_ret);
static void decode_JJF_table(UINT16 JJ, UINT16 F, typed_pointer* src_ret, typed_pointer* dst_ret);
static void decode_QQF_special_table(UINT16 QQ, UINT16 F, void **S1, void **S2, void **D);
static void decode_RR_table(UINT16 RR, typed_pointer* ret);
static void decode_Z_table(UINT16 Z, typed_pointer* ret);
static void execute_m_table(int x, UINT16 m);
static void execute_MM_table(UINT16 rnum, UINT16 MM);
static UINT16 execute_q_table(int RR, UINT16 q);
static void execute_z_table(int RR, UINT16 z);
static UINT16 assemble_address_from_Pppppp_table(UINT16 P, UINT16 ppppp);
static UINT16 assemble_address_from_IO_short_address(UINT16 pp);
static UINT16 assemble_address_from_6bit_signed_relative_short_address(UINT16 srs);
static UINT16 decode_BBB_bitmask(UINT16 BBB, UINT16 *iVal);
static int decode_cccc_table(UINT16 cccc);
static void decode_DDDDD_table(UINT16 DDDDD, typed_pointer* ret);
static void decode_DD_table(UINT16 DD, typed_pointer* ret);
static void decode_F_table(UINT16 F, typed_pointer* ret);
static void decode_h0hF_table(UINT16 h0h, UINT16 F, typed_pointer* src_ret, typed_pointer* dst_ret);
static void decode_HH_table(UINT16 HH, typed_pointer* ret);
static void decode_HHH_table(UINT16 HHH, typed_pointer* ret);
static void decode_IIII_table(UINT16 IIII, typed_pointer* src_ret, typed_pointer* dst_ret, void *working);
static void decode_JJJF_table(UINT16 JJJ, UINT16 F, typed_pointer* src_ret, typed_pointer* dst_ret);
static void decode_JJF_table(UINT16 JJ, UINT16 F, typed_pointer* src_ret, typed_pointer* dst_ret);
static void decode_QQF_special_table(UINT16 QQ, UINT16 F, void **S1, void **S2, void **D);
static void decode_RR_table(UINT16 RR, typed_pointer* ret);
static void decode_Z_table(UINT16 Z, typed_pointer* ret);
static void execute_m_table(int x, UINT16 m);
static void execute_MM_table(UINT16 rnum, UINT16 MM);
static UINT16 execute_q_table(int RR, UINT16 q);
static void execute_z_table(int RR, UINT16 z);
static UINT16 assemble_address_from_Pppppp_table(UINT16 P, UINT16 ppppp);
static UINT16 assemble_address_from_IO_short_address(UINT16 pp);
static UINT16 assemble_address_from_6bit_signed_relative_short_address(UINT16 srs);
static void dsp56k_process_loop(void);
static void dsp56k_process_rep(size_t repSize);
@ -279,6 +281,7 @@ static void execute_one(void)
/* Now evaluate the parallel data move */
// TODO // decode_dual_x_memory_data_read(op, parallel_move_str, parallel_move_str2);
logerror("DSP56k: Unemulated Dual X Memory Data Move @ 0x%x\n", PC);
}
/* X Memory Data Write and Register Data Move : 0001 011k RRDD ---- : A-140 */
else if ((op & 0xfe00) == 0x1600)
@ -299,6 +302,7 @@ static void execute_one(void)
/* Now evaluate the parallel data move */
// TODO // decode_x_memory_data_write_and_register_data_move(op, parallel_move_str, parallel_move_str2);
logerror("DSP56k: Unemulated Dual X Memory Data And Register Data Move @ 0x%x\n", PC);
}
/* Handle Other parallel types */
@ -1240,9 +1244,23 @@ static size_t dsp56k_op_move(const UINT16 op_byte, typed_pointer* d_register, UI
/* TFR : .... .... 0001 FJJJ : A-212 */
static size_t dsp56k_op_tfr(const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles)
{
typed_pointer S = {NULL, DT_BYTE};
typed_pointer D = {NULL, DT_BYTE};
decode_JJJF_table(BITS(op_byte,0x0007),BITS(op_byte,0x0008), &S, &D);
*p_accum = *((UINT64*)D.addr);
SetDestinationValue(S, D);
d_register->addr = D.addr;
d_register->data_type = D.data_type;
/* S L E U N Z V C */
/* - - - - - - - - */
return 0;
/* * * - - - - - - */
/* TODO: S, L */
cycles += 2; /* TODO: + mv oscillator cycles */
return 1;
}
/* RND : .... .... 0010 F000 : A-188 */
@ -3678,7 +3696,7 @@ static void execute_register_to_register_data_move(const UINT16 op, typed_pointe
/* Address Register Update : 0011 0zRR ---- ---- : A-135 */
static void execute_address_register_update(const UINT16 op, typed_pointer* d_register, UINT64* prev_accum_value)
{
execute_z_table(BITS(op, 0x0300), BITS(op, 0x0400));
execute_z_table(BITS(op,0x0300), BITS(op,0x0400));
}
/* X Memory Data Move : 1mRR HHHW ---- ---- : A-137 */

View File

@ -108,7 +108,9 @@ static READ32_HANDLER( polygonet_eeprom_r )
}
else
{
return (input_port_read(machine, "IN0")<<24);
UINT8 lowInputBits = input_port_read(machine, "IN1");
UINT8 highInputBits = input_port_read(machine, "IN0");
return ((highInputBits << 24) | (lowInputBits << 16));
}
logerror("unk access to eeprom port (mask %x)\n", mem_mask);
@ -630,14 +632,24 @@ MACHINE_DRIVER_END
static INPUT_PORTS_START( polygonet )
PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN)
PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN)
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN)
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) /* Service */
PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW ) /* Test Switch */
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) /* Coin Mech Switch 1 */
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON3 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) /* SW1 */
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON5 ) /* SW2 */
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON6 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON7 )
PORT_START("IN1")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON8 ) /* Joy2 Up */
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON9 ) /* Joy2 Down */
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON10 ) /* Joy1 Up */
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON11 ) /* Joy1 Down */
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON12 ) /* Joy1 Fire */
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON13 ) /* Joy2 Fire */
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON14 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON15 )
INPUT_PORTS_END
static DRIVER_INIT(polygonet)