Modernized tms1xxx cpu cores. (nw)

This commit is contained in:
Wilbert Pol 2013-06-11 21:16:05 +00:00
parent 6e5ee7b19e
commit ddacededb5
5 changed files with 526 additions and 563 deletions

File diff suppressed because it is too large Load Diff

View File

@ -9,28 +9,203 @@ enum {
};
struct tms0980_config {
/* O-output PLA configuration 5bit -> 8/11bit translation */
UINT16 o_pla[0x20];
devcb_read8 read_k;
devcb_write16 write_o; /* tms1270 has 10 O-outputs */
devcb_write16 write_r;
#define MCFG_TMS1XXX_OUTPUT_PLA(_pla) \
tms1xxx_cpu_device::set_output_pla(*device, _pla);
#define MCFG_TMS1XXX_READ_K(_devcb) \
tms1xxx_cpu_device::set_read_k(*device, DEVCB2_##_devcb);
#define MCFG_TMS1XXX_WRITE_O(_devcb) \
tms1xxx_cpu_device::set_write_o(*device, DEVCB2_##_devcb);
#define MCFG_TMS1XXX_WRITE_R(_devcb) \
tms1xxx_cpu_device::set_write_r(*device, DEVCB2_##_devcb);
class tms1xxx_cpu_device : public cpu_device
{
public:
// construction/destruction
tms1xxx_cpu_device( const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock
, const UINT32* decode_table, UINT16 o_mask, UINT16 r_mask, UINT8 pc_size, UINT8 byte_size, UINT8 x_bits
, int program_addrbus_width, address_map_constructor program, int data_addrbus_width, address_map_constructor data)
: cpu_device( mconfig, type, name, tag, owner, clock )
, m_program_config("program", ENDIANNESS_BIG, byte_size > 8 ? 16 : 8, program_addrbus_width, 0, program )
, m_data_config("data", ENDIANNESS_BIG, 8, data_addrbus_width, 0, data )
, m_o_mask( o_mask )
, m_r_mask( r_mask )
, m_pc_size( pc_size )
, m_byte_size( byte_size )
, m_x_bits( x_bits )
, m_decode_table( decode_table )
, c_output_pla( NULL )
, m_read_k( *this )
, m_write_o( *this )
, m_write_r( *this )
{ }
// static configuration helpers
template<class _Object> static devcb2_base &set_read_k(device_t &device, _Object object) { return downcast<tms1xxx_cpu_device &>(device).m_read_k.set_callback(object); }
template<class _Object> static devcb2_base &set_write_o(device_t &device, _Object object) { return downcast<tms1xxx_cpu_device &>(device).m_write_o.set_callback(object); }
template<class _Object> static devcb2_base &set_write_r(device_t &device, _Object object) { return downcast<tms1xxx_cpu_device &>(device).m_write_r.set_callback(object); }
static void set_output_pla(device_t &device, const UINT16 *output_pla) { downcast<tms1xxx_cpu_device &>(device).c_output_pla = output_pla; }
protected:
// device-level overrides
virtual void device_start();
virtual void device_reset();
// device_execute_interface overrides
virtual UINT32 execute_min_cycles() const { return 1; }
virtual UINT32 execute_max_cycles() const { return 6; }
virtual UINT32 execute_input_lines() const { return 1; }
virtual void execute_run();
// device_memory_interface overrides
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_DATA ) ? &m_data_config : NULL ); }
// device_disasm_interface overrides
virtual UINT32 disasm_min_opcode_bytes() const { return 1; }
virtual UINT32 disasm_max_opcode_bytes() const { return 1; }
void next_pc();
void set_cki_bus();
address_space_config m_program_config;
address_space_config m_data_config;
UINT8 m_prev_pc; /* previous program counter */
UINT8 m_prev_pa; /* previous page address register */
UINT8 m_pc; /* program counter is a 7 bit register on tms0980, 6 bit register on tms1000/1070/1200/1270/1100/1300 */
UINT8 m_pa; /* page address register is a 4 bit register */
UINT8 m_sr; /* subroutine return register is a 7 bit register */
UINT8 m_pb; /* page buffer register is a 4 bit register */
UINT8 m_a; /* Accumulator is a 4 bit register (?) */
UINT8 m_x; /* X-register is a 2, 3, or 4 bit register */
UINT8 m_y; /* Y-register is a 4 bit register */
UINT8 m_dam; /* DAM register is a 4 bit register */
UINT8 m_ca; /* Chapter address bit */
UINT8 m_cb; /* Chapter buffer bit */
UINT8 m_cs; /* Chapter subroutine bit */
UINT16 m_r;
UINT8 m_o;
UINT8 m_cki_bus; /* CKI bus */
UINT8 m_p; /* adder p-input */
UINT8 m_n; /* adder n-input */
UINT8 m_adder_result; /* adder result */
UINT8 m_carry_in; /* carry in */
UINT8 m_status;
UINT8 m_status_latch;
UINT8 m_special_status;
UINT8 m_call_latch;
UINT8 m_add_latch;
UINT8 m_branch_latch;
int m_subcycle;
UINT8 m_ram_address;
UINT16 m_ram_data;
UINT16 m_rom_address;
UINT16 m_opcode;
UINT32 m_decode;
int m_icount;
UINT16 m_o_mask; /* mask to determine the number of O outputs */
UINT16 m_r_mask; /* mask to determine the number of R outputs */
UINT8 m_pc_size; /* how bits in the PC register */
UINT8 m_byte_size; /* 8 or 9 bit bytes */
UINT8 m_x_bits; /* determine the number of bits in the X register */
const UINT32 *m_decode_table;
address_space *m_program;
address_space *m_data;
const UINT16 *c_output_pla;
devcb2_read8 m_read_k;
devcb2_write16 m_write_o;
devcb2_write16 m_write_r;
};
class tms0980_cpu_device : public tms1xxx_cpu_device
{
public:
tms0980_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
protected:
// device_state_interface overrides
void state_string_export(const device_state_entry &entry, astring &string);
// device_disasm_interface overrides
virtual UINT32 disasm_min_opcode_bytes() const { return 2; }
virtual UINT32 disasm_max_opcode_bytes() const { return 2; }
virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
};
class tms1000_cpu_device : public tms1xxx_cpu_device
{
public:
tms1000_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
tms1000_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT16 o_mask, UINT16 r_mask);
protected:
// device_state_interface overrides
void state_string_export(const device_state_entry &entry, astring &string);
virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
};
class tms1070_cpu_device : public tms1000_cpu_device
{
public:
tms1070_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
};
class tms1200_cpu_device : public tms1000_cpu_device
{
public:
tms1200_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
};
class tms1270_cpu_device : public tms1000_cpu_device
{
public:
tms1270_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
};
class tms1100_cpu_device : public tms1xxx_cpu_device
{
public:
tms1100_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
tms1100_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT16 o_mask, UINT16 r_mask);
protected:
// device_state_interface overrides
void state_string_export(const device_state_entry &entry, astring &string);
virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
};
class tms1300_cpu_device : public tms1100_cpu_device
{
public:
tms1300_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
};
/* 9-bit family */
DECLARE_LEGACY_CPU_DEVICE(TMS0980, tms0980);
extern const device_type TMS0980;
/* 8-bit family */
DECLARE_LEGACY_CPU_DEVICE(TMS1000, tms1000);
DECLARE_LEGACY_CPU_DEVICE(TMS1070, tms1070);
DECLARE_LEGACY_CPU_DEVICE(TMS1100, tms1100);
DECLARE_LEGACY_CPU_DEVICE(TMS1200, tms1200);
DECLARE_LEGACY_CPU_DEVICE(TMS1270, tms1270);
DECLARE_LEGACY_CPU_DEVICE(TMS1300, tms1300);
extern const device_type TMS1000;
extern const device_type TMS1070;
extern const device_type TMS1200;
extern const device_type TMS1270;
extern const device_type TMS1100;
extern const device_type TMS1300;
extern CPU_DISASSEMBLE( tms0980 );
extern CPU_DISASSEMBLE( tms1000 );
extern CPU_DISASSEMBLE( tms1100 );
#endif /* _TMS0980_H_ */

View File

@ -182,24 +182,22 @@ void merlin_state::machine_start()
}
static const tms0980_config merlin_tms0980_config =
static const UINT16 merlin_output_pla[0x20] =
{
{
/* O output PLA configuration currently unknown */
0x01, 0x10, 0x30, 0x70, 0x02, 0x12, 0x32, 0x72,
0x04, 0x14, 0x34, 0x74, 0x08, 0x18, 0x38, 0x78,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
},
DEVCB_DRIVER_MEMBER(merlin_state, read_k),
DEVCB_DRIVER_MEMBER16(merlin_state, write_o),
DEVCB_DRIVER_MEMBER16(merlin_state, write_r)
/* O output PLA configuration currently unknown */
0x01, 0x10, 0x30, 0x70, 0x02, 0x12, 0x32, 0x72,
0x04, 0x14, 0x34, 0x74, 0x08, 0x18, 0x38, 0x78,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static MACHINE_CONFIG_START( merlin, merlin_state )
MCFG_CPU_ADD( "maincpu", TMS1100, 500000 ) /* Clock may be wrong */
MCFG_CPU_CONFIG( merlin_tms0980_config )
MCFG_TMS1XXX_OUTPUT_PLA( merlin_output_pla )
MCFG_TMS1XXX_READ_K( READ8( merlin_state, read_k ) )
MCFG_TMS1XXX_WRITE_O( WRITE16( merlin_state, write_o ) )
MCFG_TMS1XXX_WRITE_R( WRITE16( merlin_state, write_r ) )
MCFG_DEFAULT_LAYOUT(layout_merlin)

View File

@ -591,18 +591,13 @@ static ADDRESS_MAP_START( microvision_8021_io, AS_IO, 8, microvision_state )
ADDRESS_MAP_END
static const tms0980_config microvision_tms0980_config =
static const UINT16 microvision_output_pla[0x20] =
{
{
/* O output PLA configuration currently unknown */
0x00, 0x08, 0x04, 0x0C, 0x02, 0x0A, 0x06, 0x0E,
0x01, 0x09, 0x05, 0x0D, 0x03, 0x0B, 0x07, 0x0F,
0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00,
0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00
},
DEVCB_DRIVER_MEMBER(microvision_state, tms1100_read_k),
DEVCB_DRIVER_MEMBER16(microvision_state, tms1100_write_o),
DEVCB_DRIVER_MEMBER16(microvision_state, tms1100_write_r)
/* O output PLA configuration currently unknown */
0x00, 0x08, 0x04, 0x0C, 0x02, 0x0A, 0x06, 0x0E,
0x01, 0x09, 0x05, 0x0D, 0x03, 0x0B, 0x07, 0x0F,
0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00,
0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00
};
@ -610,7 +605,10 @@ static MACHINE_CONFIG_START( microvision, microvision_state )
MCFG_CPU_ADD("maincpu1", I8021, 2000000) // approximately
MCFG_CPU_IO_MAP( microvision_8021_io )
MCFG_CPU_ADD("maincpu2", TMS1100, 500000) // most games seem to be running at approximately this speed
MCFG_CPU_CONFIG( microvision_tms0980_config )
MCFG_TMS1XXX_OUTPUT_PLA( microvision_output_pla )
MCFG_TMS1XXX_READ_K( READ8( microvision_state, tms1100_read_k ) )
MCFG_TMS1XXX_WRITE_O( WRITE16( microvision_state, tms1100_write_o ) )
MCFG_TMS1XXX_WRITE_R( WRITE16( microvision_state, tms1100_write_r ) )
MCFG_SCREEN_ADD("screen", LCD)
MCFG_SCREEN_REFRESH_RATE(60)

View File

@ -51,24 +51,22 @@ WRITE16_MEMBER(stopthie_state::stopthie_write_r)
}
static const tms0980_config stopthie_tms0980_config =
static const UINT16 stopthie_output_pla[0x20] =
{
{
/* O output PLA configuration currently unknown */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
DEVCB_DRIVER_MEMBER(stopthie_state, stopthie_read_k),
DEVCB_DRIVER_MEMBER16(stopthie_state, stopthie_write_o),
DEVCB_DRIVER_MEMBER16(stopthie_state, stopthie_write_r)
/* O output PLA configuration currently unknown */
0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00,
0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00,
0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00,
0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00,
};
static MACHINE_CONFIG_START( stopthie, stopthie_state )
MCFG_CPU_ADD( "maincpu", TMS0980, 5000000 ) /* Clock is wrong */
MCFG_CPU_CONFIG( stopthie_tms0980_config )
MCFG_TMS1XXX_OUTPUT_PLA( stopthie_output_pla )
MCFG_TMS1XXX_READ_K( READ8( stopthie_state, stopthie_read_k ) )
MCFG_TMS1XXX_WRITE_O( WRITE16( stopthie_state, stopthie_write_o ) )
MCFG_TMS1XXX_WRITE_R( WRITE16( stopthie_state, stopthie_write_r ) )
MCFG_DEFAULT_LAYOUT(layout_stopthie)
MACHINE_CONFIG_END