added sm510 lfsr pc

This commit is contained in:
hap 2015-07-01 21:20:14 +02:00
parent 49471a2cf4
commit 857be8d170
4 changed files with 27 additions and 8 deletions

View File

@ -82,7 +82,7 @@ static const UINT32 s_flags[] =
}; };
// next program counter in sequence (relative) // next program counter in sequence (relative)
static const INT16 s_next_pc[0x40] = static const INT8 s_next_pc[0x40] =
{ {
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 32+0x40, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 32+0x40,

View File

@ -6,6 +6,9 @@
References: References:
- 1990 Sharp Microcomputers Data Book - 1990 Sharp Microcomputers Data Book
TODO:
- proper support for LFSR program counter in debugger
*/ */
@ -130,6 +133,7 @@ void sm510_base_device::device_start()
void sm510_base_device::device_reset() void sm510_base_device::device_reset()
{ {
m_pc = 0x37 << 6;
} }
@ -143,7 +147,10 @@ void sm510_base_device::device_reset()
inline void sm510_base_device::increment_pc() inline void sm510_base_device::increment_pc()
{ {
m_pc = (m_pc + 1) & m_prgmask; // PL(program counter low 6 bits) is a simple LFSR: newbit = (bit0==bit1)
// PU,PM(high bits) specify page, PL specifies steps within page
int feed = ((m_pc >> 1 ^ m_pc) & 1) ? 0 : 0x20;
m_pc = feed | (m_pc >> 1 & 0x1f) | (m_pc & ~0x3f);
} }
void sm510_base_device::get_opcode_param() void sm510_base_device::get_opcode_param()

View File

@ -63,6 +63,16 @@ static const UINT32 s_flags[] =
0, 0, 0, _OVER, 0 0, 0, 0, _OVER, 0
}; };
// next program counter in sequence (relative)
static const INT8 s_next_pc[0x40] =
{
32, -1 /* rollback */, -1, 30, 30, -3, -3, 28, 28, -5, -5, 26, 26, -7, -7, 24,
24, -9, -9, 22, 22, -11, -11, 20, 20, -13, -13, 18, 18, -15, -15, 16,
16, -17, -17, 14, 14, -19, -19, 12, 12, -21, -21, 10, 10, -23, -23, 8,
8, -25, -25, 6, 6, -27, -27, 4, 4, -29, -29, 2, 2, -31, -31, 0 /* gets stuck here */
};
static const UINT8 sm510_mnemonic[0x100] = static const UINT8 sm510_mnemonic[0x100] =
{ {
/* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
@ -92,18 +102,19 @@ static const UINT8 sm510_mnemonic[0x100] =
CPU_DISASSEMBLE(sm510) CPU_DISASSEMBLE(sm510)
{ {
// get raw opcode // get raw opcode
int pos = 0; UINT8 op = oprom[0];
UINT8 op = oprom[pos];
pos++;
UINT8 instr = sm510_mnemonic[op]; UINT8 instr = sm510_mnemonic[op];
int len = 1;
int bits = s_bits[instr]; int bits = s_bits[instr];
UINT8 mask = op & ((1 << (bits & 7)) - 1); UINT8 mask = op & ((1 << (bits & 7)) - 1);
UINT16 param = mask; UINT16 param = mask;
if (bits >= 8) if (bits >= 8)
{ {
param = oprom[pos]; // note: disasm view shows correct parameter, but raw view does not
pos++; // note2: oprom array negative index access is intentional
param = oprom[s_next_pc[pc & 0x3f]];
len++;
} }
// disassemble it // disassemble it
@ -133,5 +144,5 @@ CPU_DISASSEMBLE(sm510)
} }
} }
return (pos & DASMFLAG_LENGTHMASK) | s_flags[instr] | DASMFLAG_SUPPORTED; return len | s_flags[instr] | DASMFLAG_SUPPORTED;
} }

View File

@ -24,6 +24,7 @@
@MP1221 TMS1100 1980, Entex Raise The Devil @MP1221 TMS1100 1980, Entex Raise The Devil
*MP1296 TMS1100? 1982, Entex Black Knight *MP1296 TMS1100? 1982, Entex Black Knight
*MP1312 TMS1100 198?, Tandy/RadioShack Science Fair Microcomputer Trainer *MP1312 TMS1100 198?, Tandy/RadioShack Science Fair Microcomputer Trainer
*MP1359 TMS1100? 1985, Capsela CRC2000
@MP1525 TMS1170 1980, Coleco Head to Head Baseball @MP1525 TMS1170 1980, Coleco Head to Head Baseball
*MP1604 ? 1981, Hanzawa Twinvader III/Tandy Cosmic Fire Away 3000 (? note: VFD-capable) *MP1604 ? 1981, Hanzawa Twinvader III/Tandy Cosmic Fire Away 3000 (? note: VFD-capable)
@MP2105 TMS1370 1979, Gakken Poker @MP2105 TMS1370 1979, Gakken Poker