added some i/o opcodes

This commit is contained in:
hap 2015-01-30 22:11:55 +01:00
parent fcb2d59e4e
commit b1ac74aa02
3 changed files with 73 additions and 7 deletions

View File

@ -5,7 +5,9 @@
American Microsystems, Inc.(AMI) S2000-family 4-bit MCU cores, introduced late 1970s American Microsystems, Inc.(AMI) S2000-family 4-bit MCU cores, introduced late 1970s
TODO: TODO:
- x - unemulated opcodes (need more testing material)
- support external program map
- add 50/60hz timer
- add S2200/S2400 - add S2200/S2400
*/ */
@ -147,6 +149,8 @@ void amis2000_device::device_start()
m_e = 0; m_e = 0;
m_i = 0; m_i = 0;
m_k = 0; m_k = 0;
m_d = 0;
m_a = 0;
// register for savestates // register for savestates
save_item(NAME(m_callstack)); save_item(NAME(m_callstack));
@ -164,6 +168,8 @@ void amis2000_device::device_start()
save_item(NAME(m_e)); save_item(NAME(m_e));
save_item(NAME(m_i)); save_item(NAME(m_i));
save_item(NAME(m_k)); save_item(NAME(m_k));
save_item(NAME(m_d));
save_item(NAME(m_a));
// register state for debugger // register state for debugger
state_add(S2000_PC, "PC", m_pc ).formatstr("%04X"); state_add(S2000_PC, "PC", m_pc ).formatstr("%04X");
@ -190,6 +196,12 @@ void amis2000_device::device_reset()
m_pc = 0; m_pc = 0;
m_skip = false; m_skip = false;
m_op = 0; m_op = 0;
// clear i/o
m_i = 0;
m_k = 0;
m_d = 0; m_write_d(0, 0, 0xff);
m_a = 0; m_write_a(0, 0, 0xffff);
} }

View File

@ -91,6 +91,8 @@ protected:
UINT8 m_e; // 4-bit generic register UINT8 m_e; // 4-bit generic register
UINT8 m_i; // 4-bit i-pins latch UINT8 m_i; // 4-bit i-pins latch
UINT8 m_k; // 4-bit k-pins latch UINT8 m_k; // 4-bit k-pins latch
UINT8 m_d; // 8-bit d-pins latch
UINT16 m_a; // 13-bit a-pins latch (master strobe latch)
devcb_read8 m_read_k; devcb_read8 m_read_k;
devcb_read8 m_read_i; devcb_read8 m_read_i;

View File

@ -187,31 +187,83 @@ void amis2000_device::op_out()
void amis2000_device::op_disb() void amis2000_device::op_disb()
{ {
// DISB: set D-latch to ACC and RAM directly // DISB: set D-latch to ACC and RAM directly
op_illegal(); m_d = m_acc | ram_r() << 4;
m_write_d(0, m_d, 0xff);
// TODO: exit from floating mode on D-pins
} }
void amis2000_device::op_disn() void amis2000_device::op_disn()
{ {
// DISN: set D-latch to ACC+carry via segment decoder // DISN: set D-latch to ACC+carry via on-die segment decoder
op_illegal(); static const UINT8 lut_segment_decoder[0x10] =
{
// 0-F digits in bit order [DP]abcdefg
0x7e, 0x30, 0x6d, 0x79, 0x33, 0x5b, 0x5f, 0x70, 0x7f, 0x7b, 0x77, 0x1f, 0x4e, 0x3d, 0x4f, 0x47
};
m_d = lut_segment_decoder[m_acc] | (m_carry ? 0x80 : 0x00);
m_write_d(0, m_d, 0xff);
// TODO: exit from floating mode on D-pins
} }
void amis2000_device::op_mvs() void amis2000_device::op_mvs()
{ {
// MVS: output master strobe latch to A-pins // MVS: output master strobe latch to A-pins
op_illegal(); m_write_a(0, m_a, 0xffff);
// TODO: enter floating mode on D-pins
} }
void amis2000_device::op_psh() void amis2000_device::op_psh()
{ {
// PSH: preset high(BL) master strobe latch // PSH: preset high(BL) master strobe latch
op_illegal(); switch (m_bl)
{
case 0xd:
// set multiplex operation
// ?
break;
case 0xe:
// exit from floating mode on D-pins
// ?
break;
case 0xf:
// set all latch bits high
m_a = 0x1fff;
break;
default:
// set selected latch bit high
m_a |= (1 << m_bl);
break;
}
} }
void amis2000_device::op_psl() void amis2000_device::op_psl()
{ {
// PSL: preset low(BL) master strobe latch // PSL: preset low(BL) master strobe latch
op_illegal(); switch (m_bl)
{
case 0xd:
// set static operation
// ?
break;
case 0xe:
// enter floating mode on D-pins
// ?
break;
case 0xf:
// set all latch bits low
m_a = 0;
break;
default:
// set selected latch bit low
m_a &= ~(1 << m_bl);
break;
}
} }
void amis2000_device::op_eur() void amis2000_device::op_eur()