diff options
author | 2015-08-05 17:54:26 +0200 | |
---|---|---|
committer | 2015-08-05 17:54:26 +0200 | |
commit | b6e1d3d986cdceaabcfae73250c49e617dfb32eb (patch) | |
tree | 7217f1aef8b6c1288bec5fb2bd03713851533736 /src/emu/cpu | |
parent | 195ff0fd7ba1c701f8dce15e6e2d6b50310ca55c (diff) |
New game added
-----------------
Castle Toy Tactix [hap, Sean Riddle, Kevin Horton]
Diffstat (limited to 'src/emu/cpu')
-rw-r--r-- | src/emu/cpu/ucom4/ucom4.c | 89 | ||||
-rw-r--r-- | src/emu/cpu/ucom4/ucom4.h | 17 | ||||
-rw-r--r-- | src/emu/cpu/ucom4/ucom4op.c | 44 |
3 files changed, 105 insertions, 45 deletions
diff --git a/src/emu/cpu/ucom4/ucom4.c b/src/emu/cpu/ucom4/ucom4.c index 569047e9bf0..1d3da737b77 100644 --- a/src/emu/cpu/ucom4/ucom4.c +++ b/src/emu/cpu/ucom4/ucom4.c @@ -26,6 +26,7 @@ // uCOM-43 products: 2000x8 ROM, RAM size custom, supports full instruction set const device_type NEC_D553 = &device_creator<upd553_cpu_device>; // 42-pin PMOS, 35 pins for I/O, Open Drain output, 96x4 RAM +const device_type NEC_D557L = &device_creator<upd557l_cpu_device>; // 28-pin PMOS, 21 pins for I/O, Open Drain output, 96x4 RAM const device_type NEC_D650 = &device_creator<upd650_cpu_device>; // 42-pin CMOS, 35 pins for I/O, push-pull output, 96x4 RAM // uCOM-44 products: 1000x8 ROM, 64x4 RAM, does not support external interrupt @@ -61,6 +62,10 @@ upd553_cpu_device::upd553_cpu_device(const machine_config &mconfig, const char * : ucom4_cpu_device(mconfig, NEC_D553, "uPD553", tag, owner, clock, NEC_UCOM43, 3 /* stack levels */, 11 /* prg width */, ADDRESS_MAP_NAME(program_2k), 7 /* data width */, ADDRESS_MAP_NAME(data_96x4), "upd553", __FILE__) { } +upd557l_cpu_device::upd557l_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : ucom4_cpu_device(mconfig, NEC_D557L, "uPD557L", tag, owner, clock, NEC_UCOM43, 3, 11, ADDRESS_MAP_NAME(program_2k), 7, ADDRESS_MAP_NAME(data_96x4), "upd557l", __FILE__) +{ } + upd650_cpu_device::upd650_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : ucom4_cpu_device(mconfig, NEC_D650, "uPD650", tag, owner, clock, NEC_UCOM43, 3, 11, ADDRESS_MAP_NAME(program_2k), 7, ADDRESS_MAP_NAME(data_96x4), "upd650", __FILE__) { } @@ -208,6 +213,90 @@ void ucom4_cpu_device::device_reset() //------------------------------------------------- +// i/o handling +//------------------------------------------------- + +// default: +// A,B are inputs, C,D are input/output, E,F,G,H,I are output + +UINT8 ucom4_cpu_device::input_r(int index) +{ + index &= 0xf; + UINT8 inp = 0; + + switch (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) | 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); + break; + } + + return inp & 0xf; +} + +void ucom4_cpu_device::output_w(int index, UINT8 data) +{ + index &= 0xf; + data &= 0xf; + + switch (index) + { + case NEC_UCOM4_PORTC: m_write_c(index, data, 0xff); break; + case NEC_UCOM4_PORTD: m_write_d(index, data, 0xff); break; + case NEC_UCOM4_PORTE: m_write_e(index, data, 0xff); break; + case NEC_UCOM4_PORTF: m_write_f(index, data, 0xff); break; + case NEC_UCOM4_PORTG: m_write_g(index, data, 0xff); break; + case NEC_UCOM4_PORTH: m_write_h(index, data, 0xff); break; + case NEC_UCOM4_PORTI: m_write_i(index, data & 7, 0xff); break; + + default: + logerror("%s write to unknown port %c = $%X at $%03X\n", tag(), 'A' + index, data, m_prev_pc); + break; + } + + m_port_out[index] = data; +} + +// uPD557L: +// ports B,H,I are stripped, port G is reduced to 1 pin + +UINT8 upd557l_cpu_device::input_r(int index) +{ + index &= 0xf; + + if (index == NEC_UCOM4_PORTB) + logerror("%s read from unknown port %c at $%03X\n", tag(), 'A' + index, m_prev_pc); + else + return ucom4_cpu_device::input_r(index); + + return 0; +} + +void upd557l_cpu_device::output_w(int index, UINT8 data) +{ + index &= 0xf; + data &= 0xf; + + if (index == NEC_UCOM4_PORTH || index == NEC_UCOM4_PORTI) + logerror("%s write to unknown port %c = $%X at $%03X\n", tag(), 'A' + index, data, m_prev_pc); + else + { + // only G0 for port G + if (index == NEC_UCOM4_PORTG) + data &= 1; + + ucom4_cpu_device::output_w(index, data); + } +} + + + +//------------------------------------------------- // interrupt //------------------------------------------------- diff --git a/src/emu/cpu/ucom4/ucom4.h b/src/emu/cpu/ucom4/ucom4.h index 5a2105bd4bc..9b0651b6703 100644 --- a/src/emu/cpu/ucom4/ucom4.h +++ b/src/emu/cpu/ucom4/ucom4.h @@ -207,6 +207,9 @@ protected: devcb_write8 m_write_h; devcb_write8 m_write_i; + virtual UINT8 input_r(int index); + virtual void output_w(int index, UINT8 data); + // misc internal helpers void increment_pc(); void fetch_arg(); @@ -216,8 +219,6 @@ protected: void ram_w(UINT8 data); void pop_stack(); void push_stack(); - virtual UINT8 input_r(int index); - virtual void output_w(int index, UINT8 data); bool check_op_43(); TIMER_CALLBACK_MEMBER( simple_timer_cb ); @@ -318,6 +319,17 @@ public: }; +class upd557l_cpu_device : public ucom4_cpu_device +{ +public: + upd557l_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + +protected: + virtual UINT8 input_r(int index); + virtual void output_w(int index, UINT8 data); +}; + + class upd650_cpu_device : public ucom4_cpu_device { public: @@ -334,6 +346,7 @@ public: extern const device_type NEC_D553; +extern const device_type NEC_D557L; extern const device_type NEC_D650; extern const device_type NEC_D552; diff --git a/src/emu/cpu/ucom4/ucom4op.c b/src/emu/cpu/ucom4/ucom4op.c index 6fad00fe20b..a9c5c0fe892 100644 --- a/src/emu/cpu/ucom4/ucom4op.c +++ b/src/emu/cpu/ucom4/ucom4op.c @@ -34,48 +34,9 @@ void ucom4_cpu_device::push_stack() m_stack[0] = m_pc; } -UINT8 ucom4_cpu_device::input_r(int index) -{ - index &= 0xf; - UINT8 inp = 0xf; - - switch (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) | 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); - break; - } - - return inp & 0xf; -} - -void ucom4_cpu_device::output_w(int index, UINT8 data) -{ - index &= 0xf; - data &= 0xf; - switch (index) - { - case NEC_UCOM4_PORTC: m_write_c(index, data, 0xff); break; - case NEC_UCOM4_PORTD: m_write_d(index, data, 0xff); break; - case NEC_UCOM4_PORTE: m_write_e(index, data, 0xff); break; - case NEC_UCOM4_PORTF: m_write_f(index, data, 0xff); break; - case NEC_UCOM4_PORTG: m_write_g(index, data, 0xff); break; - case NEC_UCOM4_PORTH: m_write_h(index, data, 0xff); break; - case NEC_UCOM4_PORTI: m_write_i(index, data & 7, 0xff); break; - default: - logerror("%s write to unknown port %c = $%X at $%03X\n", tag(), 'A' + index, data & 0xf, m_prev_pc); - break; - } - - m_port_out[index] = data; -} +// basic instruction set void ucom4_cpu_device::op_illegal() { @@ -83,9 +44,6 @@ void ucom4_cpu_device::op_illegal() } - -// basic instruction set - // Load void ucom4_cpu_device::op_li() |