small fix for ucom4 port c/d

This commit is contained in:
hap 2015-07-21 22:54:53 +02:00
parent 965c37c88b
commit 3af30d2514
4 changed files with 26 additions and 9 deletions

View File

@ -12,6 +12,11 @@
TODO:
- what happens with uCOM-43 opcodes on an uCOM-44/45 MCU?
- what's the data after the ROM data for? (eg. 2000-2047, official ROM size is 2000)
- is DPh internally 3-bit or 4-bit? (currently assume 4-bit, it could have effect
on specific uCOM-43 exchange opcodes)
- RAM access from 0x50-0x7f on data_96x4
- invalid port accesses via DPl
- documentation is conflicting if IRQ is level or edge triggered
*/
@ -116,10 +121,10 @@ void ucom4_cpu_device::device_start()
m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ucom4_cpu_device::simple_timer_cb), this));
// resolve callbacks
m_read_a.resolve_safe(0xf);
m_read_b.resolve_safe(0xf);
m_read_c.resolve_safe(0xf);
m_read_d.resolve_safe(0xf);
m_read_a.resolve_safe(0);
m_read_b.resolve_safe(0);
m_read_c.resolve_safe(0);
m_read_d.resolve_safe(0);
m_write_c.resolve_safe();
m_write_d.resolve_safe();

View File

@ -216,8 +216,8 @@ protected:
void ram_w(UINT8 data);
void pop_stack();
void push_stack();
UINT8 input_r(int index);
void output_w(int index, UINT8 data);
virtual UINT8 input_r(int index);
virtual void output_w(int index, UINT8 data);
bool check_op_43();
TIMER_CALLBACK_MEMBER( simple_timer_cb );
@ -322,6 +322,9 @@ class upd650_cpu_device : public ucom4_cpu_device
{
public:
upd650_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
protected:
virtual UINT8 input_r(int index);
};

View File

@ -43,8 +43,8 @@ UINT8 ucom4_cpu_device::input_r(int index)
{
case NEC_UCOM4_PORTA: inp = m_read_a(index, 0xff); break;
case NEC_UCOM4_PORTB: inp = m_read_b(index, 0xff); break;
case NEC_UCOM4_PORTC: inp = m_read_c(index, 0xff); break;
case NEC_UCOM4_PORTD: inp = m_read_d(index, 0xff); break;
case NEC_UCOM4_PORTC: inp = m_read_c(index, 0xff) | m_port_out[index]; break;
case NEC_UCOM4_PORTD: inp = m_read_d(index, 0xff) | m_port_out[index]; break;
default:
logerror("%s read from unknown port %c at $%03X\n", tag(), 'A' + index, m_prev_pc);
@ -54,6 +54,15 @@ UINT8 ucom4_cpu_device::input_r(int index)
return inp & 0xf;
}
UINT8 upd650_cpu_device::input_r(int index)
{
// bidirectional ports are 'push-pull', meaning it will output 0 when it's read
if ((index & 0xf) == NEC_UCOM4_PORTC || (index & 0xf) == NEC_UCOM4_PORTD)
output_w(index, 0);
return ucom4_cpu_device::input_r(index);
}
void ucom4_cpu_device::output_w(int index, UINT8 data)
{
index &= 0xf;

View File

@ -16,7 +16,7 @@
<!-- 21 LEDs: D201-D221 -->
<bezel name="x.0" element="led"><bounds x="10" y="2" width="1" height="1" /></bezel> <!-- d201 -->
<bezel name="x.0" element="led"><bounds x="1" y="10" width="1" height="1" /></bezel> <!-- d201 -->
<bezel name="x.0" element="led"><bounds x="10" y="2" width="1" height="1" /></bezel> <!-- d202 -->
<bezel name="x.0" element="led"><bounds x="14" y="10" width="1" height="1" /></bezel> <!-- d203 -->