Previous 199869 Revisions Next

r37124 Saturday 11th April, 2015 at 22:35:56 UTC by Couriersud
Add the ability to mcs51 family processors to use port bits as inputs
which actually are used as outputs because a "0" has been written to
them. The CMOS chips in the family may be misused in this way when a
low impedance source is connected to them. [Couriersud]
[src/emu/cpu/mcs51]mcs51.c mcs51.h

trunk/src/emu/cpu/mcs51/mcs51.c
r245635r245636
286286   m_ds5002fp.mcon = 0;
287287   m_ds5002fp.rpctl = 0;
288288   m_ds5002fp.crc = 0;
289
290   /* default to standard cmos interfacing */
291
292   for (int i=0; i < ARRAY_LENGTH(m_forced_inputs); i++)
293      m_forced_inputs[i] = 0;
289294}
290295
291296
r245635r245636
20792084   {
20802085      /* Read/Write/Modify operations read the port latch ! */
20812086      /* Move to memory map */
2082      case ADDR_P0:   return RWM ? P0 : P0 & IN(MCS51_PORT_P0);
2083      case ADDR_P1:   return RWM ? P1 : P1 & IN(MCS51_PORT_P1);
2084      case ADDR_P2:   return RWM ? P2 : P2 & IN(MCS51_PORT_P2);
2085      case ADDR_P3:   return RWM ? P3 : P3 & IN(MCS51_PORT_P3);
2087      case ADDR_P0:   return RWM ? P0 : (P0 | m_forced_inputs[0]) & IN(MCS51_PORT_P0);
2088      case ADDR_P1:   return RWM ? P1 : (P1 | m_forced_inputs[1]) & IN(MCS51_PORT_P1);
2089      case ADDR_P2:   return RWM ? P2 : (P2 | m_forced_inputs[2]) & IN(MCS51_PORT_P2);
2090      case ADDR_P3:   return RWM ? P3 : (P3 | m_forced_inputs[3]) & IN(MCS51_PORT_P3);
20862091
20872092      case ADDR_PSW:
20882093      case ADDR_ACC:
trunk/src/emu/cpu/mcs51/mcs51.h
r245635r245636
7272   MCS51_PORT_TX   = 0x20004,  /* P3.1 */
7373};
7474
75/* At least CMOS devices may be forced to read from ports configured as output.
76 * All you need is a low impedance output connect to the port.
77 */
7578
79#define MCFG_MCS51_PORT1_CONFIG(_forced_inputs) \
80   mcs51_cpu_device::set_port_forced_input(*device, 1, _forced_inputs);
81#define MCFG_MCS51_PORT2_CONFIG(_forced_inputs) \
82   mcs51_cpu_device::set_port_forced_input(*device, 2, _forced_inputs);
83#define MCFG_MCS51_PORT3_CONFIG(_forced_inputs) \
84   mcs51_cpu_device::set_port_forced_input(*device, 3, _forced_inputs);
85
7686class mcs51_cpu_device : public cpu_device
7787{
7888public:
r245635r245636
8292   void i8051_set_serial_tx_callback(write8_delegate tx_func);
8393   void i8051_set_serial_rx_callback(read8_delegate rx_func);
8494
95   // configuration helpers
96   static void set_port_forced_input(device_t &device, UINT8 port, UINT8 forced_input) { downcast<mcs51_cpu_device &>(device).m_forced_inputs[port] = forced_input; }
97
8598protected:
8699   // device-level overrides
87100   virtual void device_start();
r245635r245636
137150   UINT8   m_irq_active;         /* mask which irq levels are serviced */
138151   UINT8   m_irq_prio[8];        /* interrupt priority */
139152
153   UINT8   m_forced_inputs[4];     /* allow read even if configured as output */
154
140155   int     m_icount;
141156
142157   struct mcs51_uart


Previous 199869 Revisions Next


© 1997-2024 The MAME Team