mirror of
https://github.com/holub/mame
synced 2025-06-03 19:36:26 +03:00
tms1000: added tp0320 microinstructions decode
This commit is contained in:
parent
27f49aed74
commit
3f86b60153
@ -98,10 +98,24 @@ offs_t tms0980_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UIN
|
||||
|
||||
|
||||
// device_reset
|
||||
UINT32 tms0980_cpu_device::decode_fixed(UINT16 op)
|
||||
{
|
||||
UINT32 decode = 0;
|
||||
UINT32 mask = m_ipla->read(op);
|
||||
|
||||
// 1 line per PLA row, no OR-mask
|
||||
const UINT32 id[15] = { F_LDP, F_SBL, F_OFF, F_RBIT, F_SAL, F_XDA, F_REAC, F_SETR, F_RETN, F_SBIT, F_TDO, F_COMX8, F_COMX, F_LDX, F_SEAC };
|
||||
|
||||
for (int bit = 0; bit < 15; bit++)
|
||||
if (mask & (0x80 << bit))
|
||||
decode |= id[bit];
|
||||
|
||||
return decode;
|
||||
}
|
||||
|
||||
UINT32 tms0980_cpu_device::decode_micro(UINT8 sel)
|
||||
{
|
||||
UINT32 decode = 0;
|
||||
|
||||
sel = BITSWAP8(sel,7,6,0,1,2,3,4,5); // lines are reversed
|
||||
UINT32 mask = m_mpla->read(sel);
|
||||
mask ^= 0x43fc3; // invert active-negative
|
||||
@ -129,23 +143,17 @@ void tms0980_cpu_device::device_reset()
|
||||
m_micro_decode.resize(0x200);
|
||||
memset(&m_micro_decode[0], 0, 0x200*sizeof(UINT32));
|
||||
|
||||
for (int op = 0; op < 0x200; op++)
|
||||
for (UINT16 op = 0; op < 0x200; op++)
|
||||
{
|
||||
// upper half of the opcodes is always branch/call
|
||||
if (op & 0x100)
|
||||
m_fixed_decode[op] = (op & 0x80) ? F_CALL: F_BR;
|
||||
|
||||
UINT32 imask = m_ipla->read(op);
|
||||
|
||||
// 6 output bits select a microinstruction index
|
||||
m_micro_decode[op] = decode_micro(imask & 0x3f);
|
||||
m_micro_decode[op] = decode_micro(m_ipla->read(op) & 0x3f);
|
||||
|
||||
// the other ipla terms each select a fixed instruction
|
||||
const UINT32 id[15] = { F_LDP, F_SBL, F_OFF, F_RBIT, F_SAL, F_XDA, F_REAC, F_SETR, F_RETN, F_SBIT, F_TDO, F_COMX8, F_COMX, F_LDX, F_SEAC };
|
||||
|
||||
for (int bit = 0; bit < 15; bit++)
|
||||
if (imask & (0x80 << bit))
|
||||
m_fixed_decode[op] |= id[bit];
|
||||
m_fixed_decode[op] |= decode_fixed(op);
|
||||
}
|
||||
|
||||
// like on TMS0970, one of the terms directly select a microinstruction index (via R4-R8),
|
||||
@ -159,6 +167,16 @@ void tms0980_cpu_device::device_reset()
|
||||
|
||||
|
||||
// program counter/opcode decode
|
||||
UINT32 tms0980_cpu_device::read_micro()
|
||||
{
|
||||
// if ipla term 0 is active, R4-R8 directly select a microinstruction index when R0 or R0^BL is 0
|
||||
int r0 = m_opcode >> 8 & 1;
|
||||
if (m_ipla->read(m_opcode) & 0x40 && !((r0 & m_bl) ^ r0))
|
||||
return m_micro_direct[m_opcode & 0x3f];
|
||||
else
|
||||
return m_micro_decode[m_opcode];
|
||||
}
|
||||
|
||||
void tms0980_cpu_device::read_opcode()
|
||||
{
|
||||
debugger_instruction_hook(this, m_rom_address << 1);
|
||||
@ -166,13 +184,7 @@ void tms0980_cpu_device::read_opcode()
|
||||
m_c4 = BITSWAP8(m_opcode,7,6,5,4,0,1,2,3) & 0xf; // opcode operand is bitswapped for most opcodes
|
||||
|
||||
m_fixed = m_fixed_decode[m_opcode];
|
||||
|
||||
// if ipla term 0 is active, R4-R8 directly select a microinstruction index when R0 or R0^BL is 0
|
||||
int r0 = m_opcode >> 8 & 1;
|
||||
if (m_ipla->read(m_opcode) & 0x40 && !((r0 & m_bl) ^ r0))
|
||||
m_micro = m_micro_direct[m_opcode & 0x3f];
|
||||
else
|
||||
m_micro = m_micro_decode[m_opcode];
|
||||
m_micro = read_micro();
|
||||
|
||||
// redirect mpla fixed instructions
|
||||
if (m_micro & M_RSTR) m_fixed |= F_RSTR;
|
||||
|
@ -20,6 +20,8 @@ public:
|
||||
|
||||
protected:
|
||||
// overrides
|
||||
virtual UINT32 decode_fixed(UINT16 op);
|
||||
virtual UINT32 decode_micro(UINT8 sel);
|
||||
virtual void device_reset() override;
|
||||
|
||||
virtual machine_config_constructor device_mconfig_additions() const override;
|
||||
@ -30,11 +32,10 @@ protected:
|
||||
|
||||
virtual UINT8 read_k_input() override;
|
||||
virtual void set_cki_bus() override;
|
||||
virtual UINT32 read_micro();
|
||||
virtual void read_opcode() override;
|
||||
|
||||
virtual void op_comx() override;
|
||||
|
||||
UINT32 decode_micro(UINT8 sel);
|
||||
};
|
||||
|
||||
class tms1980_cpu_device : public tms0980_cpu_device
|
||||
|
@ -81,10 +81,7 @@ offs_t tms1000_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UIN
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_reset - device-specific reset
|
||||
//-------------------------------------------------
|
||||
|
||||
// device_reset
|
||||
void tms1000_cpu_device::device_reset()
|
||||
{
|
||||
// common reset
|
||||
|
@ -3,6 +3,9 @@
|
||||
/*
|
||||
|
||||
TMS1000 family - TP0320
|
||||
|
||||
TODO:
|
||||
- lots
|
||||
|
||||
*/
|
||||
|
||||
@ -38,9 +41,67 @@ tp0320_cpu_device::tp0320_cpu_device(const machine_config &mconfig, const char *
|
||||
{ }
|
||||
|
||||
|
||||
// machine configs
|
||||
static MACHINE_CONFIG_FRAGMENT(tp0320)
|
||||
|
||||
// main opcodes PLA(partial), microinstructions PLA
|
||||
MCFG_PLA_ADD("ipla", 9, 6, 8)
|
||||
MCFG_PLA_FILEFORMAT(PLA_FMT_BERKELEY)
|
||||
MCFG_PLA_ADD("mpla", 6, 22, 64)
|
||||
MCFG_PLA_FILEFORMAT(PLA_FMT_BERKELEY)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
machine_config_constructor tp0320_cpu_device::device_mconfig_additions() const
|
||||
{
|
||||
return MACHINE_CONFIG_NAME(tp0320);
|
||||
}
|
||||
|
||||
|
||||
// disasm
|
||||
offs_t tp0320_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options)
|
||||
{
|
||||
extern CPU_DISASSEMBLE(tp0320);
|
||||
return CPU_DISASSEMBLE_NAME(tp0320)(this, buffer, pc, oprom, opram, options);
|
||||
}
|
||||
|
||||
|
||||
// device_reset
|
||||
UINT32 tp0320_cpu_device::decode_micro(UINT8 sel)
|
||||
{
|
||||
UINT32 decode = 0;
|
||||
|
||||
sel = BITSWAP8(sel,7,6,0,1,2,3,4,5); // lines are reversed
|
||||
UINT32 mask = m_mpla->read(sel);
|
||||
mask ^= 0x0bff0; // invert active-negative
|
||||
|
||||
// _____ _______ ______ _____ _____ ______ _____ _____ ______ _____ _____
|
||||
const UINT32 md[22] = { M_AUTA, M_AUTY, M_SSS, M_STO, M_YTP, M_NDMTP, M_DMTP, M_MTP, M_CKP, M_15TN, M_CKN, M_MTN, M_NATN, M_ATN, M_CME, M_CIN, M_SSE, M_CKM, M_NE, M_C8, M_SETR, M_RSTR };
|
||||
|
||||
for (int bit = 0; bit < 22 && bit < m_mpla->outputs(); bit++)
|
||||
if (mask & (1 << bit))
|
||||
decode |= md[bit];
|
||||
|
||||
return decode;
|
||||
}
|
||||
|
||||
void tp0320_cpu_device::device_reset()
|
||||
{
|
||||
// common reset
|
||||
tms0980_cpu_device::device_reset();
|
||||
|
||||
// fixed instructionset isn't fully understood yet
|
||||
m_fixed_decode[0x19] = F_XDA;
|
||||
m_fixed_decode[0xb0] = F_TDO;
|
||||
m_fixed_decode[0xb1] = F_SAL;
|
||||
m_fixed_decode[0xb2] = F_COMX8;
|
||||
m_fixed_decode[0xb3] = F_SBL;
|
||||
m_fixed_decode[0xb4] = F_REAC;
|
||||
m_fixed_decode[0xb5] = F_SEAC;
|
||||
m_fixed_decode[0xb6] = F_OFF;
|
||||
m_fixed_decode[0xbf] = F_RETN;
|
||||
|
||||
for (int i = 0x80; i < 0x90; i++) m_fixed_decode[i] = F_LDP;
|
||||
for (int i = 0x90; i < 0xa0; i++) m_fixed_decode[i] = F_LDX;
|
||||
for (int i = 0xa0; i < 0xa4; i++) m_fixed_decode[i] = F_SBIT;
|
||||
for (int i = 0xa4; i < 0xa8; i++) m_fixed_decode[i] = F_RBIT;
|
||||
}
|
||||
|
@ -20,10 +20,13 @@ public:
|
||||
protected:
|
||||
// overrides
|
||||
//virtual void device_start() override;
|
||||
//virtual void device_reset() override;
|
||||
|
||||
virtual UINT32 decode_fixed(UINT16 op) override { return 0; } // not yet
|
||||
virtual UINT32 decode_micro(UINT8 sel) override;
|
||||
virtual void device_reset() override;
|
||||
virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) override;
|
||||
|
||||
//virtual machine_config_constructor device_mconfig_additions() const override;
|
||||
virtual machine_config_constructor device_mconfig_additions() const override;
|
||||
};
|
||||
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
*MP0168 TMS1000 1979, Conic Basketball
|
||||
@MP0170 TMS1000 1979, Conic Football
|
||||
@MP0914 TMS1000 1979, Entex Baseball 1
|
||||
*MP0919 TMS1000 1979, Tiger Copy Cat
|
||||
*MP0919 TMS1000 1979, Tiger Copy Cat (model 7-520)
|
||||
@MP0923 TMS1000 1979, Entex Baseball 2
|
||||
@MP1030 TMS1100 1980, APF Mathemagician
|
||||
@MP1133 TMS1470 1979, Kosmos Astro
|
||||
@ -45,6 +45,7 @@
|
||||
*MP2139 TMS1370? 1982, Gakken Galaxy Invader 1000
|
||||
@MP2726 TMS1040 1979, Tomy Break Up
|
||||
*MP2788 TMS1040? 1980, Bandai Flight Time (? note: VFD-capable)
|
||||
*MP3005 TMS1000? 1989, Tiger Copy Cat (model 7-522)
|
||||
*MP3208 TMS1000 1977, Milton Bradley Electronic Battleship (1977, model 4750A or B)
|
||||
@MP3226 TMS1000 1978, Milton Bradley Simon (model 4850)
|
||||
*MP3232 TMS1000 1979, Fonas 2-Player Baseball (no "MP" on chip label)
|
||||
|
Loading…
Reference in New Issue
Block a user