summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/cpu
diff options
context:
space:
mode:
author hap <happppp@users.noreply.github.com>2015-07-21 22:54:53 +0200
committer hap <happppp@users.noreply.github.com>2015-07-21 22:54:53 +0200
commit3af30d25142b300421d81a674da3827d4c6f9c14 (patch)
treef79e0ab980f353c73b434eecc3bfc5eacd4214da /src/emu/cpu
parent965c37c88b3850952f834b725b0f1569bce3d4a8 (diff)
small fix for ucom4 port c/d
Diffstat (limited to 'src/emu/cpu')
-rw-r--r--src/emu/cpu/ucom4/ucom4.c13
-rw-r--r--src/emu/cpu/ucom4/ucom4.h7
-rw-r--r--src/emu/cpu/ucom4/ucom4op.c13
3 files changed, 25 insertions, 8 deletions
diff --git a/src/emu/cpu/ucom4/ucom4.c b/src/emu/cpu/ucom4/ucom4.c
index d480b04fce5..569047e9bf0 100644
--- a/src/emu/cpu/ucom4/ucom4.c
+++ b/src/emu/cpu/ucom4/ucom4.c
@@ -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();
diff --git a/src/emu/cpu/ucom4/ucom4.h b/src/emu/cpu/ucom4/ucom4.h
index e6165bcde28..ed317fe9806 100644
--- a/src/emu/cpu/ucom4/ucom4.h
+++ b/src/emu/cpu/ucom4/ucom4.h
@@ -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);
};
diff --git a/src/emu/cpu/ucom4/ucom4op.c b/src/emu/cpu/ucom4/ucom4op.c
index 11475ee254d..c42a2814022 100644
--- a/src/emu/cpu/ucom4/ucom4op.c
+++ b/src/emu/cpu/ucom4/ucom4op.c
@@ -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;