Previous 15994 Revisions Next

r15337 Monday 28th May, 2012 at 18:17:36 UTC by Curt Coder
[WANGPC] Keyboard WIP. (nw)
[src/emu]diserial.c diserial.h emu.mak
[src/emu/cpu/mcs51]mcs51.c
[src/emu/machine]im6402.c im6402.h scn2661.c* scn2661.h*
[src/mess/drivers]wangpc.c
[src/mess/includes]wangpc.h
[src/mess/machine]wangpc_lvc.c wangpckb.c

src/emu/cpu/mcs51/mcs51.c
r15336r15337
952952            SET_SBUF(data);
953953            //Flag the IRQ
954954            SET_RI(1);
955            SET_RB8(1); // HACK force 2nd stop bit
955956         }
956957      }
957958   }
r15336r15337
12211222
12221223   //Flag that we're sending data
12231224   mcs51_state->uart.data_out = data;
1224   LOG(("serial_tansmit: %x %x\n", mode, data));
1225   LOG(("serial_transmit: %x %x\n", mode, data));
12251226   switch(mode) {
12261227      //8 bit shifter ( + start,stop bit ) - baud set by clock freq / 12
12271228      case 0:
r15336r15337
12341235      //9 bit uart
12351236      case 2:
12361237      case 3:
1237         LOG(("Serial mode %d not supported in mcs51!\n", mode));
1238         mcs51_state->uart.bits_to_send = 8+3;
12381239         break;
12391240   }
12401241}
r15336r15337
12561257         //9 bit uart
12571258         case 2:
12581259         case 3:
1259            LOG(("Serial mode %d not supported in mcs51!\n", mode));
1260            mcs51_state->uart.delay_cycles = 8+3;
12601261            break;
12611262      }
12621263   }
r15336r15337
17271728   LOG(("Request: %d\n", priority_request));
17281729   if (mcs51_state->irq_active && (priority_request <= mcs51_state->cur_irq_prio))
17291730   {
1730      LOG(("higher or equal priority irq in progress already, skipping ...\n"));
1731      LOG(("higher or equal priority irq (%u) in progress already, skipping ...\n", mcs51_state->cur_irq_prio));
17311732      return;
17321733   }
17331734
r15336r15337
21912192      mcs51_state->ds5002fp.range = (GET_RG1 << 1) | GET_RG0;
21922193   }
21932194
2195   mcs51_state->uart.rx_clk = 0;
2196   mcs51_state->uart.tx_clk = 0;
2197   mcs51_state->uart.bits_to_send = 0;
2198   mcs51_state->uart.delay_cycles = 0;
21942199}
21952200
21962201/* Shut down CPU core */
src/emu/diserial.c
r15336r15337
340340   return bit;
341341}
342342
343void device_serial_interface::transmit_register_send_bit()
343UINT8 device_serial_interface::transmit_register_send_bit()
344344{
345   int data;
345   UINT8 data = transmit_register_get_data_bit();
346346
347   data = transmit_register_get_data_bit();
348
349347   /* set tx data bit */
350348   m_connection_state &=~SERIAL_STATE_TX_DATA;
351349   m_connection_state|=(data<<5);
352350
353351   /* state out through connection */
354352   serial_connection_out();
353
354   return data;
355355}
356356
357357
src/emu/diserial.h
r15336r15337
9898   void transmit_register_add_bit(int bit);
9999   void transmit_register_setup(UINT8 data_byte);
100100   UINT8 transmit_register_get_data_bit();
101   void transmit_register_send_bit();
101   UINT8 transmit_register_send_bit();
102102
103103   UINT8 serial_helper_get_parity(UINT8 data) { return m_serial_parity_table[data]; }
104104
src/emu/emu.mak
r15336r15337
239239   $(EMUMACHINE)/s3c2400.o      \
240240   $(EMUMACHINE)/s3c2410.o      \
241241   $(EMUMACHINE)/s3c2440.o      \
242   $(EMUMACHINE)/scn2661.o      \
242243   $(EMUMACHINE)/scsi.o      \
243244   $(EMUMACHINE)/scsicd.o      \
244245   $(EMUMACHINE)/scsidev.o      \
src/emu/machine/scn2661.c
r0r15337
1/***************************************************************************
2
3    Philips SCN2661 Enhanced Programmable Communications Interface emulation
4
5    Copyright the MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8***************************************************************************/
9
10#include "scn2661.h"
11
12
13
14//**************************************************************************
15//  DEVICE DEFINITIONS
16//**************************************************************************
17
18const device_type SCN2661 = &device_creator<scn2661_device>;
19
20
21
22//**************************************************************************
23//  MACROS / CONSTANTS
24//**************************************************************************
25
26#define LOG 1
27
28enum
29{
30   REGISTER_HOLDING = 0,
31   REGISTER_STATUS,
32   REGISTER_SYNC = REGISTER_STATUS,
33   REGISTER_MODE,
34   REGISTER_COMMAND
35};
36
37
38//**************************************************************************
39//  INLINE HELPERS
40//**************************************************************************
41
42//-------------------------------------------------
43//  receive -
44//-------------------------------------------------
45
46inline void scn2661_device::receive()
47{
48}
49
50
51//-------------------------------------------------
52//  transmit -
53//-------------------------------------------------
54
55inline void scn2661_device::transmit()
56{
57}
58
59
60
61//**************************************************************************
62//  LIVE DEVICE
63//**************************************************************************
64
65//-------------------------------------------------
66//  scn2661_device - constructor
67//-------------------------------------------------
68
69scn2661_device::scn2661_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
70    : device_t(mconfig, SCN2661, "SCN2661", tag, owner, clock),
71     device_serial_interface(mconfig, *this)
72{
73}
74
75
76//-------------------------------------------------
77//  device_config_complete - perform any
78//  operations now that the configuration is
79//  complete
80//-------------------------------------------------
81
82void scn2661_device::device_config_complete()
83{
84   // inherit a copy of the static data
85   const scn2661_interface *intf = reinterpret_cast<const scn2661_interface *>(static_config());
86   if (intf != NULL)
87      *static_cast<scn2661_interface *>(this) = *intf;
88
89   // or initialize to defaults if none provided
90   else
91   {
92      memset(&m_in_rxd_cb, 0, sizeof(m_in_rxd_cb));
93      memset(&m_out_txd_cb, 0, sizeof(m_out_txd_cb));
94      memset(&m_out_rxrdy_cb, 0, sizeof(m_out_rxrdy_cb));
95      memset(&m_out_txrdy_cb, 0, sizeof(m_out_txrdy_cb));
96      memset(&m_out_rts_cb, 0, sizeof(m_out_rts_cb));
97      memset(&m_out_dtr_cb, 0, sizeof(m_out_dtr_cb));
98      memset(&m_out_txemt_dschg_cb, 0, sizeof(m_out_txemt_dschg_cb));
99      memset(&m_out_bkdet_cb, 0, sizeof(m_out_bkdet_cb));
100      memset(&m_out_xsync_cb, 0, sizeof(m_out_xsync_cb));
101   }
102}
103
104
105//-------------------------------------------------
106//  device_start - device-specific startup
107//-------------------------------------------------
108
109void scn2661_device::device_start()
110{
111   // resolve callbacks
112   m_in_rxd_func.resolve(m_in_rxd_cb, *this);
113   m_out_txd_func.resolve(m_out_txd_cb, *this);
114   m_out_rxrdy_func.resolve(m_out_rxrdy_cb, *this);
115   m_out_txrdy_func.resolve(m_out_txrdy_cb, *this);
116   m_out_rts_func.resolve(m_out_rts_cb, *this);
117   m_out_dtr_func.resolve(m_out_dtr_cb, *this);
118   m_out_txemt_dschg_func.resolve(m_out_txemt_dschg_cb, *this);
119   m_out_bkdet_func.resolve(m_out_bkdet_cb, *this);
120   m_out_xsync_func.resolve(m_out_xsync_cb, *this);
121
122   // create the timers
123   if (m_rxc > 0)
124   {
125      m_rx_timer = timer_alloc(TIMER_RX);
126      m_rx_timer->adjust(attotime::zero, 0, attotime::from_hz(m_rxc));
127   }
128
129   if (m_txc > 0)
130   {
131      m_tx_timer = timer_alloc(TIMER_TX);
132      m_tx_timer->adjust(attotime::zero, 0, attotime::from_hz(m_txc));
133   }
134}
135
136
137//-------------------------------------------------
138//  device_reset - device-specific reset
139//-------------------------------------------------
140
141void scn2661_device::device_reset()
142{
143   transmit_register_reset();
144   receive_register_reset();
145}
146
147
148//-------------------------------------------------
149//  device_timer - handler timer events
150//-------------------------------------------------
151
152void scn2661_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
153{
154   switch (id)
155   {
156   case TIMER_RX:
157      rxc_w(1);
158      break;
159
160   case TIMER_TX:
161      txc_w(1);
162      break;
163   }
164}
165
166
167//-------------------------------------------------
168//  input_callback -
169//-------------------------------------------------
170
171void scn2661_device::input_callback(UINT8 state)
172{
173}
174
175
176//-------------------------------------------------
177//  read -
178//-------------------------------------------------
179
180READ8_MEMBER( scn2661_device::read )
181{
182   UINT8 data = 0;
183
184   switch (offset & 0x03)
185   {
186   case REGISTER_HOLDING:
187      data = m_rhr;
188      break;
189
190   case REGISTER_STATUS:
191      data = m_sr;
192      break;
193
194   case REGISTER_MODE:
195      break;
196
197   case REGISTER_COMMAND:
198      data = m_cr;
199      break;
200   }
201
202   return data;
203}
204
205
206//-------------------------------------------------
207//  write - transmitter buffer register write
208//-------------------------------------------------
209
210WRITE8_MEMBER( scn2661_device::write )
211{
212   switch (offset & 0x03)
213   {
214   case REGISTER_HOLDING:
215      m_thr = data;
216      break;
217
218   case REGISTER_SYNC:
219      break;
220
221   case REGISTER_MODE:
222      break;
223
224   case REGISTER_COMMAND:
225      m_cr = data;
226      break;
227   }
228}
229
230
231//-------------------------------------------------
232//  rxc_w - receiver clock
233//-------------------------------------------------
234
235WRITE_LINE_MEMBER( scn2661_device::rxc_w )
236{
237}
238
239
240//-------------------------------------------------
241//  txc_w - transmitter clock
242//-------------------------------------------------
243
244WRITE_LINE_MEMBER( scn2661_device::txc_w )
245{
246}
247
248
249//-------------------------------------------------
250//  dsr_w - data set ready
251//-------------------------------------------------
252
253WRITE_LINE_MEMBER( scn2661_device::dsr_w )
254{
255}
256
257
258//-------------------------------------------------
259//  dcd_w - data carrier detect
260//-------------------------------------------------
261
262WRITE_LINE_MEMBER( scn2661_device::dcd_w )
263{
264}
265
266
267//-------------------------------------------------
268//  cts_w - clear to send
269//-------------------------------------------------
270
271WRITE_LINE_MEMBER( scn2661_device::cts_w )
272{
273}
274
275
276//-------------------------------------------------
277//  rxrdy_r - receiver ready
278//-------------------------------------------------
279
280READ_LINE_MEMBER( scn2661_device::rxrdy_r )
281{
282   return CLEAR_LINE;
283}
284
285
286//-------------------------------------------------
287//  txemt_r - transmitter empty
288//-------------------------------------------------
289
290READ_LINE_MEMBER( scn2661_device::txemt_r )
291{
292   return CLEAR_LINE;
293}
src/emu/machine/scn2661.h
r0r15337
1/***************************************************************************
2
3    Philips SCN2661 Enhanced Programmable Communications Interface emulation
4
5    Copyright the MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8****************************************************************************
9                            _____   _____
10                    D2   1 |*    \_/     | 28  D1
11                    D3   2 |             | 27  D0
12                   RxD   3 |             | 26  Vcc
13                   GND   4 |             | 25  _RxC/BKDET
14                    D4   5 |             | 24  _DTR
15                    D5   6 |             | 23  _RTS
16                    D6   7 |   SCN2661   | 22  _DSR
17                    D7   8 |             | 21  RESET
18            _TxC/XSYNC   9 |             | 20  BRCLK
19                    A1  10 |             | 19  TxD
20                   _CE  11 |             | 18  _TxEMT/DSCHG
21                    A0  12 |             | 17  _CTS
22                  _R/W  13 |             | 16  _DCD
23                _RxRDY  14 |_____________| 15  _TxRDY
24
25***************************************************************************/
26
27#pragma once
28
29#ifndef __SCN2661__
30#define __SCN2661__
31
32#include "emu.h"
33
34
35
36/***************************************************************************
37    DEVICE CONFIGURATION MACROS
38***************************************************************************/
39
40#define MCFG_SCN2661_ADD(_tag, _clock, _config) \
41   MCFG_DEVICE_ADD(_tag, SCN2661, _clock) \
42   MCFG_DEVICE_CONFIG(_config)
43
44
45#define SCN2661_INTERFACE(_name) \
46   const scn2661_interface (_name) =
47
48
49
50/***************************************************************************
51    TYPE DEFINITIONS
52***************************************************************************/
53
54// ======================> scn2661_interface
55
56struct scn2661_interface
57{
58   int m_rxc;
59   int m_txc;
60
61   devcb_read_line      m_in_rxd_cb;
62   devcb_write_line   m_out_txd_cb;
63
64   devcb_write_line   m_out_rxrdy_cb;
65   devcb_write_line   m_out_txrdy_cb;
66   devcb_write_line   m_out_rts_cb;
67   devcb_write_line   m_out_dtr_cb;
68   devcb_write_line   m_out_txemt_dschg_cb;
69   devcb_write_line   m_out_bkdet_cb;
70   devcb_write_line   m_out_xsync_cb;
71};
72
73
74// ======================> scn2661_device
75
76class scn2661_device :  public device_t,
77                   public device_serial_interface,
78                   public scn2661_interface
79{
80public:
81   // construction/destruction
82   scn2661_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
83
84   DECLARE_READ8_MEMBER( read );
85   DECLARE_WRITE8_MEMBER( write );
86
87   DECLARE_WRITE_LINE_MEMBER( rxc_w );
88   DECLARE_WRITE_LINE_MEMBER( txc_w );
89
90   DECLARE_WRITE_LINE_MEMBER( dsr_w );
91   DECLARE_WRITE_LINE_MEMBER( dcd_w );
92   DECLARE_WRITE_LINE_MEMBER( cts_w );
93
94   DECLARE_READ_LINE_MEMBER( rxrdy_r );
95   DECLARE_READ_LINE_MEMBER( txemt_r );
96
97protected:
98   // device-level overrides
99   virtual void device_config_complete();
100   virtual void device_start();
101   virtual void device_reset();
102   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
103
104   // device_serial_interface overrides
105   virtual void input_callback(UINT8 state);
106
107private:
108   inline void receive();
109   inline void transmit();
110
111   enum
112   {
113      TIMER_RX,
114      TIMER_TX
115   };
116
117   devcb_resolved_read_line   m_in_rxd_func;
118   devcb_resolved_write_line   m_out_txd_func;
119
120   devcb_resolved_write_line   m_out_rxrdy_func;
121   devcb_resolved_write_line   m_out_txrdy_func;
122   devcb_resolved_write_line   m_out_rts_func;
123   devcb_resolved_write_line   m_out_dtr_func;
124   devcb_resolved_write_line   m_out_txemt_dschg_func;
125   devcb_resolved_write_line   m_out_bkdet_func;
126   devcb_resolved_write_line   m_out_xsync_func;
127
128   UINT8 m_rhr;
129   UINT8 m_thr;
130   UINT8 m_cr;
131   UINT8 m_sr;
132   UINT8 m_mr1;
133   UINT8 m_mr2;
134   UINT8 m_syn1;
135   UINT8 m_syn2;
136   UINT8 m_dle;
137
138   int m_mr_index;
139   int m_sync_index;
140
141   // timers
142   emu_timer *m_rx_timer;
143   emu_timer *m_tx_timer;
144};
145
146
147// device type definition
148extern const device_type SCN2661;
149
150
151
152#endif
src/emu/machine/im6402.c
r15336r15337
2323//  MACROS / CONSTANTS
2424//**************************************************************************
2525 
26#define LOG 0
26#define LOG 1
2727 
2828 
2929 
r15336r15337
7373 
7474inline void im6402_device::receive()
7575{
76   int bit = 1;
77 
7678   if (m_in_rri_func.isnull())
7779   {
78      receive_register_update_bit(get_in_data_bit());
80      bit = get_in_data_bit();
7981   }
8082   else
8183   {
82      receive_register_update_bit(m_in_rri_func());
84      bit = m_in_rri_func();
8385   }
8486 
87//   if (LOG) logerror("IM6402 '%s' Receive Bit %u\n", tag(), bit);
88   
89   receive_register_update_bit(bit);
90 
8591   if (is_receive_register_full())
8692   {
8793      receive_register_extract();
8894      m_rbr = get_received_char();
95       
96      if (LOG) logerror("IM6402 '%s' Receive Data %02x\n", tag(), m_rbr);
8997 
9098      if (m_dr)
9199      {
r15336r15337
105113{
106114   if (is_transmit_register_empty() && !m_tbre)
107115   {
116      if (LOG) logerror("IM6402 '%s' Transmit Data %02x\n", tag(), m_tbr);
117 
108118      transmit_register_setup(m_tbr);
109119 
110120      set_tbre(ASSERT_LINE);
r15336r15337
113123 
114124   if (!is_transmit_register_empty())
115125   {
116      int bit = transmit_register_get_data_bit();
126      int bit = transmit_register_send_bit();
117127 
128      if (LOG) logerror("IM6402 '%s' Transmit Bit %u\n", tag(), bit);
129 
118130      m_out_tro_func(bit);
119      serial_connection_out();
120131 
121132      if (is_transmit_register_empty())
122133      {
r15336r15337
219230 
220231void im6402_device::device_reset()
221232{
233   transmit_register_reset();
234   receive_register_reset();
235 
222236   m_rrc_count = 0;
223237   m_trc_count = 0;
224238 
r15336r15337
277291 
278292WRITE8_MEMBER( im6402_device::write )
279293{
294   if (LOG) logerror("IM6402 '%s' Transmit Buffer Register %02x\n", tag(), data);
295 
280296   m_tbr = data;
281297 
282298   set_tbre(CLEAR_LINE);
r15336r15337
433449{
434450   if (state)
435451   {
452      if (LOG) logerror("IM6402 '%s' Control Register Load\n", tag());
453 
436454      int word_length = 5 + ((m_cls2 << 1) | m_cls1);
437      int stop_bits = 1 + m_sbs ? ((word_length == 5) ? 0.5 : 1) : 0;
455      int stop_bits = 1 + (m_sbs ? ((word_length == 5) ? 0.5 : 1) : 0);
438456      int parity_code;
439457 
440458      if (m_pi) parity_code = SERIAL_PARITY_NONE;
r15336r15337
452470 
453471WRITE_LINE_MEMBER( im6402_device::pi_w )
454472{
473   if (LOG) logerror("IM6402 '%s' Parity Inhibit %u\n", tag(), state);
474 
455475   m_pi = state;
456476}
457477 
r15336r15337
462482 
463483WRITE_LINE_MEMBER( im6402_device::sbs_w )
464484{
485   if (LOG) logerror("IM6402 '%s' Stop Bit Select %u\n", tag(), state);
486   
465487   m_sbs = state;
466488}
467489 
r15336r15337
472494 
473495WRITE_LINE_MEMBER( im6402_device::cls1_w )
474496{
497   if (LOG) logerror("IM6402 '%s' Character Length Select 1 %u\n", tag(), state);
498 
475499   m_cls1 = state;
476500}
477501 
r15336r15337
482506 
483507WRITE_LINE_MEMBER( im6402_device::cls2_w )
484508{
509   if (LOG) logerror("IM6402 '%s' Character Length Select 2 %u\n", tag(), state);
510   
485511   m_cls2 = state;
486512}
487513 
r15336r15337
492518 
493519WRITE_LINE_MEMBER( im6402_device::epe_w )
494520{
521   if (LOG) logerror("IM6402 '%s' Even Parity Enable %u\n", tag(), state);
522 
495523   m_epe = state;
496524}
src/emu/machine/im6402.h
r15336r15337
129129   inline void receive();
130130   inline void transmit();
131131 
132   static const device_timer_id TIMER_RX = 0;
133   static const device_timer_id TIMER_TX = 1;
132   enum 
133   {
134      TIMER_RX,
135      TIMER_TX
136   };
134137 
135138   devcb_resolved_read_line   m_in_rri_func;
136139   devcb_resolved_write_line   m_out_tro_func;
src/mess/machine/wangpc_lvc.c
r15336r15337
285285{
286286   if (sad(offset))
287287   {
288      logerror("Lores write %06x: %04x\n", offset, data);
289
290288      switch (offset & 0x7f)
291289      {
292290      case 0x00/2:
src/mess/machine/wangpckb.c
r15336r15337
9595//-------------------------------------------------
9696 
9797static ADDRESS_MAP_START( wangpc_keyboard_io, AS_IO, 8, wangpc_keyboard_device )
98    AM_RANGE(0x4800, 0x4800) AM_DEVWRITE_LEGACY(SN76496_TAG, sn76496_w)
9899   AM_RANGE(MCS51_PORT_P1, MCS51_PORT_P1) AM_READ(kb_p1_r) AM_WRITENOP
99100   AM_RANGE(MCS51_PORT_P2, MCS51_PORT_P2) AM_WRITE(kb_p2_w)
100101   AM_RANGE(MCS51_PORT_P3, MCS51_PORT_P3) AM_WRITE(kb_p3_w)
101   AM_RANGE(0x0000, 0xfeff) AM_NOP
102   //AM_RANGE(0x0000, 0xfeff) AM_READNOP
102103ADDRESS_MAP_END
103104 
104105 
r15336r15337
393394 
394395void wangpc_keyboard_device::device_reset()
395396{
397    transmit_register_reset();
398    receive_register_reset();
396399}
397400 
398401 
r15336r15337
402405 
403406void wangpc_keyboard_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
404407{
405   // receive
406   int bit = get_in_data_bit();
407   receive_register_update_bit(bit);
408   /*
409    if (start bit)
410    {
411        m_maincpu->set_input_line(MCS51_RX_LINE, ASSERT_LINE);
412    }
413    */
414   if (is_receive_register_full())
415   {
416      receive_register_extract();
417   }
418 
419   // transmit
420   if (!is_transmit_register_empty())
421   {
422      transmit_register_get_data_bit();
423      serial_connection_out();
424   }
425408}
426409 
427410 
r15336r15337
431414 
432415void wangpc_keyboard_device::input_callback(UINT8 state)
433416{
417    //logerror("input %02x\n", state);
418 
419    // receive
420    int bit = (state & SERIAL_STATE_RX_DATA) ? 1 : 0;
421 
422    //logerror("inbit %u \n", bit);
423    receive_register_update_bit(bit);
424 
425    if (is_receive_register_full())
426    {
427        m_maincpu->set_input_line(MCS51_RX_LINE, ASSERT_LINE);
428        receive_register_extract();
429        logerror("Wang PC keyboard receive data %02x\n", get_received_char());
430    }
431 
432    // transmit
433    if (!is_transmit_register_empty())
434    {
435        transmit_register_get_data_bit();
436        serial_connection_out();
437    }
434438}
435439 
436440 
r15336r15337
454458{
455459   wangpc_keyboard_device *kb = static_cast<wangpc_keyboard_device *>(device->owner());
456460 
461    logerror("Wang PC keyboard transmit data %02x\n", data);
462 
457463   kb->transmit_register_setup(data);
458464}
459465 
r15336r15337
510516        P2.7
511517 
512518    */
513
519//logerror("P2 %02x\n", data);
514520   m_y = data;
515521}
516522 
r15336r15337
535541        P3.7
536542 
537543    */
544//logerror("P3 %02x\n", data);
538545}
src/mess/includes/wangpc.h
r15336r15337
1313#include "machine/pic8259.h"
1414#include "machine/pit8253.h"
1515#include "machine/ram.h"
16#include "machine/scn2661.h"
1617#include "machine/upd765.h"
1718#include "machine/wangpcbus.h"
1819#include "machine/wangpckb.h"
r15336r15337
4344        m_ppi(*this, I8255A_TAG),
4445        m_pit(*this, I8253_TAG),
4546        m_uart(*this, IM6402_TAG),
47        m_epci(*this, SCN2661_TAG),
4648        m_fdc(*this, UPD765_TAG),
4749        m_ram(*this, RAM_TAG),
4850        m_floppy0(*this, FLOPPY_0),
r15336r15337
5153        m_kb(*this, WANGPC_KEYBOARD_TAG),
5254        m_bus(*this, WANGPC_BUS_TAG),
5355        m_timer2_irq(1),
54        m_ecpi_irq(1),
5556        m_acknlg(1),
5657        m_dav(1),
5758        m_busy(1),
r15336r15337
7374   required_device<i8255_device> m_ppi;
7475   required_device<device_t> m_pit;
7576   required_device<im6402_device> m_uart;
77   required_device<scn2661_device> m_epci;
7678   required_device<device_t> m_fdc;
7779   required_device<ram_device> m_ram;
7880   required_device<device_t> m_floppy0;
r15336r15337
154156   DECLARE_WRITE_LINE_MEMBER( pit2_w );
155157   DECLARE_WRITE_LINE_MEMBER( uart_dr_w );
156158   DECLARE_WRITE_LINE_MEMBER( uart_tbre_w );
159   DECLARE_WRITE_LINE_MEMBER( epci_irq_w );
157160   DECLARE_WRITE_LINE_MEMBER( fdc_int_w );
158161   DECLARE_WRITE_LINE_MEMBER( fdc_drq_w );
159162   DECLARE_WRITE_LINE_MEMBER( ack_w );
r15336r15337
164167   int m_dma_channel;
165168 
166169   int m_timer2_irq;
167   int m_ecpi_irq;
168170   int m_acknlg;
169171   int m_dav;
170172   int m_busy;
src/mess/drivers/wangpc.c
r15336r15337
572572   AM_RANGE(0x1020, 0x1027) AM_DEVREADWRITE8(I8255A_TAG, i8255_device, read, write, 0x00ff)
573573   AM_RANGE(0x1040, 0x1047) AM_DEVREADWRITE8_LEGACY(I8253_TAG, pit8253_r, pit8253_w, 0x00ff)
574574   AM_RANGE(0x1060, 0x1063) AM_DEVREADWRITE8_LEGACY(I8259A_TAG, pic8259_r, pic8259_w, 0x00ff)
575//  AM_RANGE(0x1080, 0x1087) AM_DEVREAD8(SCN2661_TAG, scn2661_device, read, 0x00ff)
576//  AM_RANGE(0x1088, 0x108f) AM_DEVWRITE8(SCN2661_TAG, scn2661_device, write, 0x00ff)
575   AM_RANGE(0x1080, 0x1087) AM_DEVREAD8(SCN2661_TAG, scn2661_device, read, 0x00ff)
576   AM_RANGE(0x1088, 0x108f) AM_DEVWRITE8(SCN2661_TAG, scn2661_device, write, 0x00ff)
577577   AM_RANGE(0x10a0, 0x10bf) AM_DEVREADWRITE8_LEGACY(AM9517A_TAG, i8237_r, i8237_w, 0x00ff)
578578   AM_RANGE(0x10c2, 0x10c7) AM_WRITE8(dma_page_w, 0x00ff)
579579   AM_RANGE(0x10e0, 0x10e1) AM_READWRITE8(status_r, timer0_irq_clr_w, 0x00ff)
r15336r15337
753753 
754754void wangpc_state::check_level1_interrupts()
755755{
756   int state = !m_timer2_irq | !m_ecpi_irq | !m_acknlg | !m_dav | !m_busy;
756   int state = !m_timer2_irq | m_epci->rxrdy_r() | m_epci->txemt_r() | !m_acknlg | !m_dav | !m_busy;
757757 
758758   pic8259_ir1_w(m_pic, state);
759759}
r15336r15337
835835   data |= m_timer2_irq;
836836 
837837   // serial interrupt
838   data |= m_ecpi_irq << 1;
838   data |= (m_epci->rxrdy_r() | m_epci->txemt_r()) << 1;
839839 
840840   // parallel port interrupt
841841   data |= m_acknlg << 2;
r15336r15337
980980 
981981 
982982//-------------------------------------------------
983//  SCN2661_INTERFACE( epci_intf )
984//-------------------------------------------------
985 
986WRITE_LINE_MEMBER( wangpc_state::epci_irq_w )
987{
988   check_level1_interrupts();
989}
990 
991static SCN2661_INTERFACE( epci_intf )
992{
993   0,
994   0,
995   DEVCB_NULL,
996   DEVCB_NULL,
997   DEVCB_DRIVER_LINE_MEMBER(wangpc_state, epci_irq_w),
998   DEVCB_NULL,
999   DEVCB_NULL,
1000   DEVCB_NULL,
1001   DEVCB_DRIVER_LINE_MEMBER(wangpc_state, epci_irq_w),
1002   DEVCB_NULL,
1003   DEVCB_NULL
1004};
1005 
1006 
1007//-------------------------------------------------
9831008//  upd765_interface fdc_intf
9841009//-------------------------------------------------
9851010 
r15336r15337
11361161   save_item(NAME(m_dma_page));
11371162   save_item(NAME(m_dma_channel));
11381163   save_item(NAME(m_timer2_irq));
1139   save_item(NAME(m_ecpi_irq));
11401164   save_item(NAME(m_acknlg));
11411165   save_item(NAME(m_dav));
11421166   save_item(NAME(m_busy));
r15336r15337
11881212   MCFG_I8255A_ADD(I8255A_TAG, ppi_intf)
11891213   MCFG_PIT8253_ADD(I8253_TAG, pit_intf)
11901214   MCFG_IM6402_ADD(IM6402_TAG, uart_intf)
1191   // SCN2661 for RS-232
1215   MCFG_SCN2661_ADD(SCN2661_TAG, 0, epci_intf)
11921216   MCFG_UPD765A_ADD(UPD765_TAG, fdc_intf)
11931217   MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(floppy_intf)
11941218   MCFG_CENTRONICS_PRINTER_ADD(CENTRONICS_TAG, centronics_intf)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team