Previous 15994 Revisions Next

r15309 Thursday 24th May, 2012 at 14:44:21 UTC by Curt Coder
[WANGPC] Moved option cards to separate files. (nw)
[src/mess]mess.mak
[src/mess/drivers]wangpc.c
[src/mess/includes]wangpc.h
[src/mess/machine]wangpc_lic.c* wangpc_lic.h* wangpc_lores.c wangpc_lores.h wangpc_lvc.c* wangpc_lvc.h* wangpc_rtc.c* wangpc_rtc.h* wangpc_wdc.c* wangpc_wdc.h* wangpcbus.c wangpcbus.h

src/mess/machine/wangpc_lores.c
r15308r15309
1/**********************************************************************
2
3    Wang PC Low-Resolution Video Controller emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "wangpc_lores.h"
11
12
13
14//**************************************************************************
15//  MACROS/CONSTANTS
16//**************************************************************************
17
18#define OPTION_ID      0x10
19
20#define MC6845_TAG      "mc6845"
21#define SCREEN_TAG      "screen"
22
23#define RAM_SIZE      0x8000
24
25
26
27//**************************************************************************
28//  DEVICE DEFINITIONS
29//**************************************************************************
30
31const device_type WANGPC_LORES_VIDEO = &device_creator<wangpc_lores_video_device>;
32
33
34//-------------------------------------------------
35//  mc6845_interface crtc_intf
36//-------------------------------------------------
37
38void wangpc_lores_video_device::crtc_update_row(mc6845_device *device, bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT16 ma, UINT8 ra, UINT16 y, UINT8 x_count, INT8 cursor_x, void *param)
39{
40/*  const rgb_t *palette = palette_entry_list_raw(bitmap.palette());
41    for (int column = 0; column < x_count; column++)
42    {
43        UINT8 code = m_video_ram[((ma + column) & 0x7ff)];
44        UINT16 addr = (code << 3) | (ra & 0x07);
45        UINT8 data = m_char_rom[addr & 0x7ff];
46
47        if (column == cursor_x)
48        {
49            data = 0xff;
50        }
51
52        for (int bit = 0; bit < 8; bit++)
53        {
54            int x = (column * 8) + bit;
55            int color = BIT(data, 7) ? 7 : 0;
56
57            bitmap.pix32(y, x) = palette[color];
58
59            data <<= 1;
60        }
61    }*/
62}
63
64static MC6845_UPDATE_ROW( wangpc_lores_video_update_row )
65{
66   wangpc_lores_video_device *lores = downcast<wangpc_lores_video_device *>(device->owner());
67   lores->crtc_update_row(device,bitmap,cliprect,ma,ra,y,x_count,cursor_x,param);
68}
69
70WRITE_LINE_MEMBER( wangpc_lores_video_device::vsync_w )
71{
72   if (BIT(m_option, 3) && state)
73   {
74      m_irq3 = ASSERT_LINE;
75      m_bus->irq3_w(m_irq3);
76   }
77}
78
79static const mc6845_interface crtc_intf =
80{
81   SCREEN_TAG,
82   8,
83   NULL,
84   wangpc_lores_video_update_row,
85   NULL,
86   DEVCB_NULL,
87   DEVCB_NULL,
88   DEVCB_NULL,
89   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, wangpc_lores_video_device, vsync_w),
90   NULL
91};
92
93
94//-------------------------------------------------
95//  MACHINE_CONFIG_FRAGMENT( wangpc_lores_video )
96//-------------------------------------------------
97
98static MACHINE_CONFIG_FRAGMENT( wangpc_lores_video )
99   MCFG_SCREEN_ADD(SCREEN_TAG, RASTER)
100   MCFG_SCREEN_UPDATE_DEVICE(MC6845_TAG, mc6845_device, screen_update)
101   MCFG_SCREEN_SIZE(80*8, 25*9)
102   MCFG_SCREEN_VISIBLE_AREA(0, 80*8-1, 0, 25*9-1)
103   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500))
104   MCFG_SCREEN_REFRESH_RATE(60)
105
106   MCFG_MC6845_ADD(MC6845_TAG, MC6845, XTAL_14_31818MHz, crtc_intf)
107MACHINE_CONFIG_END
108
109
110//-------------------------------------------------
111//  machine_config_additions - device-specific
112//  machine configurations
113//-------------------------------------------------
114
115machine_config_constructor wangpc_lores_video_device::device_mconfig_additions() const
116{
117   return MACHINE_CONFIG_NAME( wangpc_lores_video );
118}
119
120
121
122//**************************************************************************
123//  LIVE DEVICE
124//**************************************************************************
125
126//-------------------------------------------------
127//  wangpc_lores_video_device - constructor
128//-------------------------------------------------
129
130wangpc_lores_video_device::wangpc_lores_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
131   device_t(mconfig, WANGPC_LORES_VIDEO, "Wang PC Low Resolution Video Card", tag, owner, clock),
132   device_wangpcbus_card_interface(mconfig, *this),
133   m_crtc(*this, MC6845_TAG),
134   m_option(0),
135   m_irq3(CLEAR_LINE)
136{
137}
138
139
140//-------------------------------------------------
141//  device_start - device-specific startup
142//-------------------------------------------------
143
144void wangpc_lores_video_device::device_start()
145{
146   m_slot = dynamic_cast<wangpcbus_slot_device *>(owner());
147
148   m_video_ram = auto_alloc_array(machine(), UINT16, RAM_SIZE);
149
150   // state saving
151   save_pointer(NAME(m_video_ram), RAM_SIZE);
152}
153
154
155//-------------------------------------------------
156//  device_reset - device-specific reset
157//-------------------------------------------------
158
159void wangpc_lores_video_device::device_reset()
160{
161}
162
163
164//-------------------------------------------------
165//  wangpcbus_mrdc_r - memory read
166//-------------------------------------------------
167
168UINT16 wangpc_lores_video_device::wangpcbus_mrdc_r(address_space &space, offs_t offset, UINT16 mem_mask)
169{
170   UINT16 data = 0xffff;
171
172   if (BIT(m_option, 0) && (offset >= 0xe0000/2) && (offset < 0xf0000/2))
173   {
174      data = m_video_ram[offset];
175   }
176
177   return data;
178}
179
180
181//-------------------------------------------------
182//  wangpcbus_amwc_w - memory write
183//-------------------------------------------------
184
185void wangpc_lores_video_device::wangpcbus_amwc_w(address_space &space, offs_t offset, UINT16 mem_mask, UINT16 data)
186{
187   if (BIT(m_option, 0) && (offset >= 0xe0000/2) && (offset < 0xf0000/2))
188   {
189      m_video_ram[offset] = data;
190   }
191}
192
193
194//-------------------------------------------------
195//  wangpcbus_iorc_r - I/O read
196//-------------------------------------------------
197
198UINT16 wangpc_lores_video_device::wangpcbus_iorc_r(address_space &space, offs_t offset, UINT16 mem_mask)
199{
200   UINT16 data = 0xffff;
201
202   if (sad(offset))
203   {
204      logerror("Lores read %04x %04x\n", offset << 1, mem_mask);
205
206      switch (offset & 0x7f)
207      {
208      case 0x02/2:
209         data = 0xff00 | m_crtc->register_r(space, 0);
210         break;
211
212      case 0x30/2:
213         data = 0xffe3;
214         data |= m_crtc->de_r() << 2;
215         data |= m_crtc->vsync_r() << 3;
216         data |= m_crtc->hsync_r() << 4;
217         break;
218
219      case 0xfe/2:
220         data = 0xff00 | (m_irq3 << 7) | OPTION_ID;
221         break;
222      }
223   }
224
225   return data;
226}
227
228
229//-------------------------------------------------
230//  wangpcbus_aiowc_w - I/O write
231//-------------------------------------------------
232
233void wangpc_lores_video_device::wangpcbus_aiowc_w(address_space &space, offs_t offset, UINT16 data, UINT16 mem_mask)
234{
235   if (sad(offset))
236   {
237      logerror("Lores write %04x %04x\n", offset << 1, mem_mask);
238
239      switch (offset & 0x7f)
240      {
241      case 0x00/2:
242         if (ACCESSING_BITS_0_7)
243            m_crtc->address_w(space, 0, data & 0xff);
244         break;
245
246      case 0x02/2:
247         if (ACCESSING_BITS_0_7)
248            m_crtc->register_w(space, 0, data & 0xff);
249         break;
250
251      case 0x10/2:
252         if (ACCESSING_BITS_0_7)
253            m_option = data & 0xff;
254         break;
255
256      case 0x20/2:
257         m_scroll = data;
258         break;
259
260      case 0x70/2:
261         m_irq3 = CLEAR_LINE;
262         m_bus->irq3_w(m_irq3);
263         break;
264      }
265   }
266}
src/mess/machine/wangpc_lores.h
r15308r15309
1/**********************************************************************
2
3    Wang PC Low-Resolution Video Controller emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __WANGPC_LORES_VIDEO__
13#define __WANGPC_LORES_VIDEO__
14
15
16#include "emu.h"
17#include "machine/wangpcbus.h"
18#include "video/mc6845.h"
19
20
21
22//**************************************************************************
23//  TYPE DEFINITIONS
24//**************************************************************************
25
26// ======================> wangpc_lores_video_device
27
28class wangpc_lores_video_device : public device_t,
29                          public device_wangpcbus_card_interface
30{
31public:
32   // construction/destruction
33   wangpc_lores_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
34
35   // optional information overrides
36   virtual machine_config_constructor device_mconfig_additions() const;
37
38   // not really public
39   void crtc_update_row(mc6845_device *device, bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT16 ma, UINT8 ra, UINT16 y, UINT8 x_count, INT8 cursor_x, void *param);
40   DECLARE_WRITE_LINE_MEMBER( vsync_w );
41
42protected:
43   // device-level overrides
44   virtual void device_start();
45   virtual void device_reset();
46   virtual void device_config_complete() { m_shortname = "wangpc_lores"; }
47
48   // device_wangpcbus_card_interface overrides
49   virtual UINT16 wangpcbus_mrdc_r(address_space &space, offs_t offset, UINT16 mem_mask);
50   virtual void wangpcbus_amwc_w(address_space &space, offs_t offset, UINT16 mem_mask, UINT16 data);
51   virtual UINT16 wangpcbus_iorc_r(address_space &space, offs_t offset, UINT16 mem_mask);
52   virtual void wangpcbus_aiowc_w(address_space &space, offs_t offset, UINT16 mem_mask, UINT16 data);
53
54private:
55   wangpcbus_slot_device *m_slot;
56
57   // internal state
58   required_device<mc6845_device> m_crtc;
59
60   UINT16 *m_video_ram;
61   UINT8 m_attr[16];
62   UINT8 m_option;
63   UINT16 m_scroll;
64   int m_irq3;
65};
66
67
68// device type definition
69extern const device_type WANGPC_LORES_VIDEO;
70
71
72#endif
src/mess/machine/wangpc_lvc.c
r0r15309
1/**********************************************************************
2
3    Wang PC Low-Resolution Video Controller emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "wangpc_lvc.h"
11
12
13
14//**************************************************************************
15//  MACROS/CONSTANTS
16//**************************************************************************
17
18#define OPTION_ID      0x10
19
20#define MC6845_TAG      "mc6845"
21#define SCREEN_TAG      "screen"
22
23#define RAM_SIZE      0x8000
24
25
26
27//**************************************************************************
28//  DEVICE DEFINITIONS
29//**************************************************************************
30
31const device_type WANGPC_LVC = &device_creator<wangpc_lvc_device>;
32
33
34//-------------------------------------------------
35//  mc6845_interface crtc_intf
36//-------------------------------------------------
37
38void wangpc_lvc_device::crtc_update_row(mc6845_device *device, bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT16 ma, UINT8 ra, UINT16 y, UINT8 x_count, INT8 cursor_x, void *param)
39{
40/*  const rgb_t *palette = palette_entry_list_raw(bitmap.palette());
41    for (int column = 0; column < x_count; column++)
42    {
43        UINT8 code = m_video_ram[((ma + column) & 0x7ff)];
44        UINT16 addr = (code << 3) | (ra & 0x07);
45        UINT8 data = m_char_rom[addr & 0x7ff];
46
47        if (column == cursor_x)
48        {
49            data = 0xff;
50        }
51
52        for (int bit = 0; bit < 8; bit++)
53        {
54            int x = (column * 8) + bit;
55            int color = BIT(data, 7) ? 7 : 0;
56
57            bitmap.pix32(y, x) = palette[color];
58
59            data <<= 1;
60        }
61    }*/
62}
63
64static MC6845_UPDATE_ROW( wangpc_lvc_update_row )
65{
66   wangpc_lvc_device *lores = downcast<wangpc_lvc_device *>(device->owner());
67   lores->crtc_update_row(device,bitmap,cliprect,ma,ra,y,x_count,cursor_x,param);
68}
69
70WRITE_LINE_MEMBER( wangpc_lvc_device::vsync_w )
71{
72   if (BIT(m_option, 3) && state)
73   {
74      m_irq3 = ASSERT_LINE;
75      m_bus->irq3_w(m_irq3);
76   }
77}
78
79static const mc6845_interface crtc_intf =
80{
81   SCREEN_TAG,
82   8,
83   NULL,
84   wangpc_lvc_update_row,
85   NULL,
86   DEVCB_NULL,
87   DEVCB_NULL,
88   DEVCB_NULL,
89   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, wangpc_lvc_device, vsync_w),
90   NULL
91};
92
93
94//-------------------------------------------------
95//  MACHINE_CONFIG_FRAGMENT( wangpc_lvc )
96//-------------------------------------------------
97
98static MACHINE_CONFIG_FRAGMENT( wangpc_lvc )
99   MCFG_SCREEN_ADD(SCREEN_TAG, RASTER)
100   MCFG_SCREEN_UPDATE_DEVICE(MC6845_TAG, mc6845_device, screen_update)
101   MCFG_SCREEN_SIZE(80*8, 25*9)
102   MCFG_SCREEN_VISIBLE_AREA(0, 80*8-1, 0, 25*9-1)
103   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500))
104   MCFG_SCREEN_REFRESH_RATE(60)
105
106   MCFG_PALETTE_LENGTH(16)
107
108   MCFG_MC6845_ADD(MC6845_TAG, MC6845, XTAL_14_31818MHz, crtc_intf)
109MACHINE_CONFIG_END
110
111
112//-------------------------------------------------
113//  machine_config_additions - device-specific
114//  machine configurations
115//-------------------------------------------------
116
117machine_config_constructor wangpc_lvc_device::device_mconfig_additions() const
118{
119   return MACHINE_CONFIG_NAME( wangpc_lvc );
120}
121
122
123
124//**************************************************************************
125//  LIVE DEVICE
126//**************************************************************************
127
128//-------------------------------------------------
129//  wangpc_lvc_device - constructor
130//-------------------------------------------------
131
132wangpc_lvc_device::wangpc_lvc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
133   device_t(mconfig, WANGPC_LVC, "Wang PC Low Resolution Video Card", tag, owner, clock),
134   device_wangpcbus_card_interface(mconfig, *this),
135   m_crtc(*this, MC6845_TAG),
136   m_option(0),
137   m_irq3(CLEAR_LINE)
138{
139}
140
141
142//-------------------------------------------------
143//  device_start - device-specific startup
144//-------------------------------------------------
145
146void wangpc_lvc_device::device_start()
147{
148   // allocate memory
149   m_video_ram = auto_alloc_array(machine(), UINT16, RAM_SIZE);
150
151   // state saving
152   save_pointer(NAME(m_video_ram), RAM_SIZE);
153}
154
155
156//-------------------------------------------------
157//  device_reset - device-specific reset
158//-------------------------------------------------
159
160void wangpc_lvc_device::device_reset()
161{
162}
163
164
165//-------------------------------------------------
166//  wangpcbus_mrdc_r - memory read
167//-------------------------------------------------
168
169UINT16 wangpc_lvc_device::wangpcbus_mrdc_r(address_space &space, offs_t offset, UINT16 mem_mask)
170{
171   UINT16 data = 0xffff;
172
173   if (BIT(m_option, 0) && (offset >= 0xe0000/2) && (offset < 0xf0000/2))
174   {
175      data = m_video_ram[offset];
176   }
177
178   return data;
179}
180
181
182//-------------------------------------------------
183//  wangpcbus_amwc_w - memory write
184//-------------------------------------------------
185
186void wangpc_lvc_device::wangpcbus_amwc_w(address_space &space, offs_t offset, UINT16 mem_mask, UINT16 data)
187{
188   if (BIT(m_option, 0) && (offset >= 0xe0000/2) && (offset < 0xf0000/2))
189   {
190      m_video_ram[offset] = data;
191   }
192}
193
194
195//-------------------------------------------------
196//  wangpcbus_iorc_r - I/O read
197//-------------------------------------------------
198
199UINT16 wangpc_lvc_device::wangpcbus_iorc_r(address_space &space, offs_t offset, UINT16 mem_mask)
200{
201   UINT16 data = 0xffff;
202
203   if (sad(offset))
204   {
205      switch (offset & 0x7f)
206      {
207      case 0x02/2:
208         data = 0xff00 | m_crtc->register_r(space, 0);
209         break;
210
211      case 0x30/2:
212         data = 0xffe3;
213         data |= m_crtc->de_r() << 2;
214         data |= m_crtc->vsync_r() << 3;
215         data |= m_crtc->hsync_r() << 4;
216         break;
217
218      case 0xfe/2:
219         data = 0xff00 | (m_irq3 << 7) | OPTION_ID;
220         break;
221      }
222
223      logerror("Lores read %04x %04x %04x\n", offset << 1, mem_mask, data);
224   }
225
226   return data;
227}
228
229
230//-------------------------------------------------
231//  wangpcbus_aiowc_w - I/O write
232//-------------------------------------------------
233
234void wangpc_lvc_device::wangpcbus_aiowc_w(address_space &space, offs_t offset, UINT16 data, UINT16 mem_mask)
235{
236   if (sad(offset))
237   {
238      logerror("Lores write %04x %04x %04x\n", offset << 1, mem_mask, data);
239
240      switch (offset & 0x7f)
241      {
242      case 0x00/2:
243         if (ACCESSING_BITS_0_7)
244            m_crtc->address_w(space, 0, data & 0xff);
245         break;
246
247      case 0x02/2:
248         if (ACCESSING_BITS_0_7)
249            m_crtc->register_w(space, 0, data & 0xff);
250         break;
251
252      case 0x10/2:
253         if (ACCESSING_BITS_0_7)
254            m_option = data & 0xff;
255         break;
256
257      case 0x20/2:
258         m_scroll = data;
259         break;
260
261      case 0x70/2:
262         m_irq3 = CLEAR_LINE;
263         m_bus->irq3_w(m_irq3);
264         break;
265      }
266   }
267}
src/mess/machine/wangpc_lvc.h
r0r15309
1/**********************************************************************
2
3    Wang PC Low-Resolution Video Controller emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __WANGPC_LVC__
13#define __WANGPC_LVC__
14
15
16#include "emu.h"
17#include "machine/wangpcbus.h"
18#include "video/mc6845.h"
19
20
21
22//**************************************************************************
23//  TYPE DEFINITIONS
24//**************************************************************************
25
26// ======================> wangpc_lvc_device
27
28class wangpc_lvc_device : public device_t,
29                    public device_wangpcbus_card_interface
30{
31public:
32   // construction/destruction
33   wangpc_lvc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
34
35   // optional information overrides
36   virtual machine_config_constructor device_mconfig_additions() const;
37
38   // not really public
39   void crtc_update_row(mc6845_device *device, bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT16 ma, UINT8 ra, UINT16 y, UINT8 x_count, INT8 cursor_x, void *param);
40   DECLARE_WRITE_LINE_MEMBER( vsync_w );
41
42protected:
43   // device-level overrides
44   virtual void device_start();
45   virtual void device_reset();
46   virtual void device_config_complete() { m_shortname = "wangpc_lvc"; }
47
48   // device_wangpcbus_card_interface overrides
49   virtual UINT16 wangpcbus_mrdc_r(address_space &space, offs_t offset, UINT16 mem_mask);
50   virtual void wangpcbus_amwc_w(address_space &space, offs_t offset, UINT16 mem_mask, UINT16 data);
51   virtual UINT16 wangpcbus_iorc_r(address_space &space, offs_t offset, UINT16 mem_mask);
52   virtual void wangpcbus_aiowc_w(address_space &space, offs_t offset, UINT16 mem_mask, UINT16 data);
53
54private:
55   // internal state
56   required_device<mc6845_device> m_crtc;
57
58   UINT16 *m_video_ram;
59   UINT8 m_attr[16];
60   UINT8 m_option;
61   UINT16 m_scroll;
62   int m_irq3;
63};
64
65
66// device type definition
67extern const device_type WANGPC_LVC;
68
69
70#endif
src/mess/machine/wangpc_rtc.c
r0r15309
1/**********************************************************************
2
3    Wang PC-PM040-B Remote Telecommunication controller emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "wangpc_rtc.h"
11
12
13
14//**************************************************************************
15//  MACROS/CONSTANTS
16//**************************************************************************
17
18#define OPTION_ID      0x1c
19
20#define Z80_TAG         "z80"
21#define AM9517A_TAG      "am9517"
22#define Z80CTC_0_TAG   "z80ctc_0"
23#define Z80CTC_1_TAG   "z80ctc_1"
24#define Z80SIO_TAG      "z80sio"
25
26
27
28//**************************************************************************
29//  DEVICE DEFINITIONS
30//**************************************************************************
31
32const device_type WANGPC_RTC = &device_creator<wangpc_rtc_device>;
33
34
35//-------------------------------------------------
36//  ROM( wangpc_rtc )
37//-------------------------------------------------
38
39ROM_START( wangpc_rtc )
40   ROM_REGION( 0x1000, Z80_TAG, 0 )
41   ROM_LOAD( "remotecomms-l28.bin", 0x0000, 0x1000, CRC(c05a1bee) SHA1(6b3f0d787d014b1fd3925812c905ddb63c5055f1) )
42ROM_END
43
44
45//-------------------------------------------------
46//  rom_region - device-specific ROM region
47//-------------------------------------------------
48
49const rom_entry *wangpc_rtc_device::device_rom_region() const
50{
51   return ROM_NAME( wangpc_rtc );
52}
53
54
55//-------------------------------------------------
56//  ADDRESS_MAP( wangpc_rtc_mem )
57//-------------------------------------------------
58
59static ADDRESS_MAP_START( wangpc_rtc_mem, AS_PROGRAM, 8, wangpc_rtc_device )
60   AM_RANGE(0x0000, 0x0fff) AM_ROM AM_REGION(Z80_TAG, 0)
61   AM_RANGE(0x1000, 0xffff) AM_RAM
62ADDRESS_MAP_END
63
64
65//-------------------------------------------------
66//  ADDRESS_MAP( wangpc_rtc_io )
67//-------------------------------------------------
68
69static ADDRESS_MAP_START( wangpc_rtc_io, AS_IO, 8, wangpc_rtc_device )
70   ADDRESS_MAP_GLOBAL_MASK(0xff)
71   AM_RANGE(0x00, 0x03) AM_DEVREADWRITE_LEGACY(Z80SIO_TAG, z80dart_cd_ba_r, z80dart_cd_ba_w)
72   AM_RANGE(0x10, 0x1f) AM_DEVREADWRITE_LEGACY(AM9517A_TAG, i8237_r, i8237_w)
73   AM_RANGE(0x20, 0x23) AM_DEVREADWRITE_LEGACY(Z80CTC_0_TAG, z80ctc_r, z80ctc_w)
74   AM_RANGE(0x30, 0x30) //AM_WRITE(clear_char_w)
75   AM_RANGE(0x31, 0x31) //AM_WRITE(set_char_w)
76   AM_RANGE(0x40, 0x40) AM_READ_PORT("SW1") //AM_WRITE(control_w)
77   AM_RANGE(0x44, 0x44) //AM_READ(i8086_status_r) AM_WRITE(reset_w)
78   AM_RANGE(0x48, 0x48) //AM_WRITE(dte_ready_w)
79   AM_RANGE(0x4c, 0x4c) //AM_READWRITE(8232_acu_r, 8232_acu_w)
80   AM_RANGE(0x50, 0x50) //AM_READ(outbound_data_r)
81   AM_RANGE(0x51, 0x52) //AM_WRITE(status_w)
82   AM_RANGE(0x54, 0x54) //AM_WRITE(enable_inbound_data_w)
83   AM_RANGE(0x51, 0x52) //AM_WRITE(inbound_data_w)
84   AM_RANGE(0x60, 0x63) AM_DEVREADWRITE_LEGACY(Z80CTC_1_TAG, z80ctc_r, z80ctc_w)
85   AM_RANGE(0x70, 0x70) //AM_READWRITE(led_toggle_r, odd_parity_w)
86   AM_RANGE(0x71, 0x71) //AM_WRITE(even_parity_w)
87ADDRESS_MAP_END
88
89
90//-------------------------------------------------
91//  z80_daisy_config wangpc_rtc_daisy_chain
92//-------------------------------------------------
93
94static const z80_daisy_config wangpc_rtc_daisy_chain[] =
95{
96   { Z80SIO_TAG },
97   { Z80CTC_0_TAG },
98   { Z80CTC_1_TAG },
99   { NULL }
100};
101
102
103//-------------------------------------------------
104//  I8237_INTERFACE( dmac_intf )
105//-------------------------------------------------
106
107static I8237_INTERFACE( dmac_intf )
108{
109   DEVCB_NULL,
110   DEVCB_NULL,
111   DEVCB_NULL,
112   DEVCB_NULL,
113   { DEVCB_NULL,
114     DEVCB_NULL,
115     DEVCB_NULL,
116     DEVCB_NULL, },
117   { DEVCB_NULL,
118     DEVCB_NULL,
119     DEVCB_NULL,
120     DEVCB_NULL, },
121   { DEVCB_NULL,
122     DEVCB_NULL,
123     DEVCB_NULL,
124     DEVCB_NULL }
125};
126
127
128//-------------------------------------------------
129//  Z80CTC_INTERFACE( ctc0_intf )
130//-------------------------------------------------
131
132static Z80CTC_INTERFACE( ctc0_intf )
133{
134   0,
135   DEVCB_CPU_INPUT_LINE(Z80_TAG, INPUT_LINE_IRQ0),
136   DEVCB_NULL,
137   DEVCB_NULL,
138   DEVCB_NULL
139};
140
141
142//-------------------------------------------------
143//  Z80CTC_INTERFACE( ctc1_intf )
144//-------------------------------------------------
145
146static Z80CTC_INTERFACE( ctc1_intf )
147{
148   0,
149   DEVCB_CPU_INPUT_LINE(Z80_TAG, INPUT_LINE_IRQ0),
150   DEVCB_NULL,
151   DEVCB_NULL,
152   DEVCB_NULL
153};
154
155
156//-------------------------------------------------
157//  Z80DART_INTERFACE( sio_intf )
158//-------------------------------------------------
159
160static Z80DART_INTERFACE( sio_intf )
161{
162   0, 0, 0, 0,
163
164   DEVCB_NULL,
165   DEVCB_NULL,
166   DEVCB_NULL,
167   DEVCB_NULL,
168   DEVCB_NULL,
169   DEVCB_NULL,
170
171   DEVCB_NULL,
172   DEVCB_NULL,
173   DEVCB_NULL,
174   DEVCB_NULL,
175   DEVCB_NULL,
176   DEVCB_NULL,
177
178   DEVCB_CPU_INPUT_LINE(Z80_TAG, INPUT_LINE_IRQ0)
179};
180
181
182//-------------------------------------------------
183//  MACHINE_CONFIG_FRAGMENT( wangpc_rtc )
184//-------------------------------------------------
185
186static MACHINE_CONFIG_FRAGMENT( wangpc_rtc )
187   MCFG_CPU_ADD(Z80_TAG, Z80, 2000000)
188   MCFG_CPU_CONFIG(wangpc_rtc_daisy_chain)
189   MCFG_CPU_PROGRAM_MAP(wangpc_rtc_mem)
190   MCFG_CPU_IO_MAP(wangpc_rtc_io)
191
192   MCFG_I8237_ADD(AM9517A_TAG, 2000000, dmac_intf)
193   MCFG_Z80CTC_ADD(Z80CTC_0_TAG, 2000000, ctc0_intf)
194   MCFG_Z80CTC_ADD(Z80CTC_1_TAG, 2000000, ctc1_intf)
195   MCFG_Z80DART_ADD(Z80SIO_TAG, 2000000, sio_intf)
196MACHINE_CONFIG_END
197
198
199//-------------------------------------------------
200//  machine_config_additions - device-specific
201//  machine configurations
202//-------------------------------------------------
203
204machine_config_constructor wangpc_rtc_device::device_mconfig_additions() const
205{
206   return MACHINE_CONFIG_NAME( wangpc_rtc );
207}
208
209
210//-------------------------------------------------
211//  INPUT_PORTS( wangpc_rtc )
212//-------------------------------------------------
213
214INPUT_PORTS_START( wangpc_rtc )
215   PORT_START("SW1")
216   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:1")
217   PORT_DIPSETTING(    0x01, DEF_STR( On ) )
218   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
219   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:2")
220   PORT_DIPSETTING(    0x02, DEF_STR( On ) )
221   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
222   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:3")
223   PORT_DIPSETTING(    0x04, DEF_STR( On ) )
224   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
225   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:4")
226   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
227   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
228   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:5")
229   PORT_DIPSETTING(    0x10, DEF_STR( On ) )
230   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
231   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:6")
232   PORT_DIPSETTING(    0x20, DEF_STR( On ) )
233   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
234   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:7")
235   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
236   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
237   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:8")
238   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
239   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
240INPUT_PORTS_END
241
242
243//-------------------------------------------------
244//  input_ports - device-specific input ports
245//-------------------------------------------------
246
247ioport_constructor wangpc_rtc_device::device_input_ports() const
248{
249   return INPUT_PORTS_NAME( wangpc_rtc );
250}
251
252
253
254
255//**************************************************************************
256//  LIVE DEVICE
257//**************************************************************************
258
259//-------------------------------------------------
260//  wangpc_rtc_device - constructor
261//-------------------------------------------------
262
263wangpc_rtc_device::wangpc_rtc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
264   device_t(mconfig, WANGPC_RTC, "Wang PC-PM040-B", tag, owner, clock),
265   device_wangpcbus_card_interface(mconfig, *this),
266   m_maincpu(*this, Z80_TAG),
267   m_dmac(*this, AM9517A_TAG),
268   m_ctc0(*this, Z80CTC_0_TAG),
269   m_ctc1(*this, Z80CTC_1_TAG),
270   m_sio(*this, Z80SIO_TAG)
271{
272}
273
274
275//-------------------------------------------------
276//  device_start - device-specific startup
277//-------------------------------------------------
278
279void wangpc_rtc_device::device_start()
280{
281}
282
283
284//-------------------------------------------------
285//  device_reset - device-specific reset
286//-------------------------------------------------
287
288void wangpc_rtc_device::device_reset()
289{
290}
291
292
293//-------------------------------------------------
294//  wangpcbus_mrdc_r - memory read
295//-------------------------------------------------
296
297UINT16 wangpc_rtc_device::wangpcbus_mrdc_r(address_space &space, offs_t offset, UINT16 mem_mask)
298{
299   UINT16 data = 0xffff;
300   
301   return data;
302}
303
304
305//-------------------------------------------------
306//  wangpcbus_amwc_w - memory write
307//-------------------------------------------------
308
309void wangpc_rtc_device::wangpcbus_amwc_w(address_space &space, offs_t offset, UINT16 mem_mask, UINT16 data)
310{
311}
312
313
314//-------------------------------------------------
315//  wangpcbus_iorc_r - I/O read
316//-------------------------------------------------
317
318UINT16 wangpc_rtc_device::wangpcbus_iorc_r(address_space &space, offs_t offset, UINT16 mem_mask)
319{
320   UINT16 data = 0xffff;
321
322   if (sad(offset))
323   {
324      switch (offset & 0x7f)
325      {
326      case 0xfe/2:
327         data = 0xff00 | OPTION_ID;
328         break;
329      }
330   }
331
332   return data;
333}
334
335
336//-------------------------------------------------
337//  wangpcbus_aiowc_w - I/O write
338//-------------------------------------------------
339
340void wangpc_rtc_device::wangpcbus_aiowc_w(address_space &space, offs_t offset, UINT16 data, UINT16 mem_mask)
341{
342   if (sad(offset))
343   {
344      switch (offset & 0x7f)
345      {
346      case 0xfc/2:
347         device_reset();
348         break;
349      }
350   }
351}
src/mess/machine/wangpc_rtc.h
r0r15309
1/**********************************************************************
2
3    Wang PC-PM040-B Remote Telecommunication controller emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __WANGPC_RTC__
13#define __WANGPC_RTC__
14
15
16#include "emu.h"
17#include "cpu/z80/z80.h"
18#include "machine/8237dma.h"
19#include "machine/wangpcbus.h"
20#include "machine/z80ctc.h"
21#include "machine/z80dart.h"
22
23
24
25//**************************************************************************
26//  TYPE DEFINITIONS
27//**************************************************************************
28
29// ======================> wangpc_rtc_device
30
31class wangpc_rtc_device : public device_t,
32                    public device_wangpcbus_card_interface
33{
34public:
35   // construction/destruction
36   wangpc_rtc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
37
38   // optional information overrides
39   virtual const rom_entry *device_rom_region() const;
40   virtual machine_config_constructor device_mconfig_additions() const;
41   virtual ioport_constructor device_input_ports() const;
42
43protected:
44   // device-level overrides
45   virtual void device_start();
46   virtual void device_reset();
47   virtual void device_config_complete() { m_shortname = "wangpc_rtc"; }
48
49   // device_wangpcbus_card_interface overrides
50   virtual UINT16 wangpcbus_mrdc_r(address_space &space, offs_t offset, UINT16 mem_mask);
51   virtual void wangpcbus_amwc_w(address_space &space, offs_t offset, UINT16 mem_mask, UINT16 data);
52   virtual UINT16 wangpcbus_iorc_r(address_space &space, offs_t offset, UINT16 mem_mask);
53   virtual void wangpcbus_aiowc_w(address_space &space, offs_t offset, UINT16 mem_mask, UINT16 data);
54
55private:
56   required_device<cpu_device> m_maincpu;
57   required_device<i8237_device> m_dmac;
58   required_device<z80ctc_device> m_ctc0;
59   required_device<z80ctc_device> m_ctc1;
60   required_device<z80dart_device> m_sio;
61
62   UINT8 m_char_ram[256];
63};
64
65
66// device type definition
67extern const device_type WANGPC_RTC;
68
69
70#endif
src/mess/machine/wangpc_wdc.c
r0r15309
1/**********************************************************************
2
3    Wang PC-PM001 Winchester Disk Controller emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "wangpc_wdc.h"
11
12
13
14//**************************************************************************
15//  MACROS/CONSTANTS
16//**************************************************************************
17
18#define OPTION_ID      0x01
19
20#define Z80_TAG         "z80"
21#define SASIBUS_TAG      "sasi"
22
23
24
25//**************************************************************************
26//  DEVICE DEFINITIONS
27//**************************************************************************
28
29const device_type WANGPC_WDC = &device_creator<wangpc_wdc_device>;
30
31
32//-------------------------------------------------
33//  ROM( wangpc_wdc )
34//-------------------------------------------------
35
36ROM_START( wangpc_wdc )
37   ROM_REGION( 0x1000, Z80_TAG, 0 )
38   ROM_LOAD( "378-9040 r9.l19", 0x0000, 0x1000, CRC(282770d2) SHA1(a0e3bad5041e0dfd6087907015b07a093b576bc0) )
39
40   ROM_REGION( 0x1000, "address", 0 )
41   ROM_LOAD( "378-9041.l54", 0x0000, 0x1000, CRC(94e9a17d) SHA1(060c576d70069ece2d0dbce86ffc448df2b169e7) )
42ROM_END
43
44
45//-------------------------------------------------
46//  rom_region - device-specific ROM region
47//-------------------------------------------------
48
49const rom_entry *wangpc_wdc_device::device_rom_region() const
50{
51   return ROM_NAME( wangpc_wdc );
52}
53
54
55//-------------------------------------------------
56//  ADDRESS_MAP( wangpc_wdc_mem )
57//-------------------------------------------------
58
59static ADDRESS_MAP_START( wangpc_wdc_mem, AS_PROGRAM, 8, wangpc_wdc_device )
60   AM_RANGE(0x0000, 0x0fff) AM_ROM AM_REGION(Z80_TAG, 0)
61ADDRESS_MAP_END
62
63
64//-------------------------------------------------
65//  ADDRESS_MAP( wangpc_wdc_io )
66//-------------------------------------------------
67
68static ADDRESS_MAP_START( wangpc_wdc_io, AS_IO, 8, wangpc_wdc_device )
69ADDRESS_MAP_END
70
71
72//-------------------------------------------------
73//  SCSIBus_interface sasi_intf
74//-------------------------------------------------
75
76static const SCSIConfigTable sasi_dev_table =
77{
78   1,
79   {
80      { SCSI_ID_0, "harddisk0", SCSI_DEVICE_HARDDISK }
81   }
82};
83
84static const SCSIBus_interface sasi_intf =
85{
86    &sasi_dev_table,
87    NULL,
88   DEVCB_NULL,
89   DEVCB_NULL,
90   DEVCB_NULL,
91   DEVCB_NULL,
92   DEVCB_NULL,
93   DEVCB_NULL,
94   DEVCB_NULL
95};
96
97
98//-------------------------------------------------
99//  MACHINE_CONFIG_FRAGMENT( wangpc_wdc )
100//-------------------------------------------------
101
102static MACHINE_CONFIG_FRAGMENT( wangpc_wdc )
103   MCFG_CPU_ADD(Z80_TAG, Z80, 2000000)
104   //MCFG_CPU_CONFIG(wangpc_wdc_daisy_chain)
105   MCFG_CPU_PROGRAM_MAP(wangpc_wdc_mem)
106   MCFG_CPU_IO_MAP(wangpc_wdc_io)
107
108   MCFG_SCSIBUS_ADD(SASIBUS_TAG, sasi_intf)
109   MCFG_HARDDISK_ADD("harddisk0")
110MACHINE_CONFIG_END
111
112
113//-------------------------------------------------
114//  machine_config_additions - device-specific
115//  machine configurations
116//-------------------------------------------------
117
118machine_config_constructor wangpc_wdc_device::device_mconfig_additions() const
119{
120   return MACHINE_CONFIG_NAME( wangpc_wdc );
121}
122
123
124
125//**************************************************************************
126//  LIVE DEVICE
127//**************************************************************************
128
129//-------------------------------------------------
130//  wangpc_wdc_device - constructor
131//-------------------------------------------------
132
133wangpc_wdc_device::wangpc_wdc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
134   device_t(mconfig, WANGPC_WDC, "Wang PC-PM001", tag, owner, clock),
135   device_wangpcbus_card_interface(mconfig, *this),
136   m_maincpu(*this, Z80_TAG),
137   m_sasibus(*this, SASIBUS_TAG)
138{
139}
140
141
142//-------------------------------------------------
143//  device_start - device-specific startup
144//-------------------------------------------------
145
146void wangpc_wdc_device::device_start()
147{
148}
149
150
151//-------------------------------------------------
152//  device_reset - device-specific reset
153//-------------------------------------------------
154
155void wangpc_wdc_device::device_reset()
156{
157}
158
159
160//-------------------------------------------------
161//  wangpcbus_mrdc_r - memory read
162//-------------------------------------------------
163
164UINT16 wangpc_wdc_device::wangpcbus_mrdc_r(address_space &space, offs_t offset, UINT16 mem_mask)
165{
166   UINT16 data = 0xffff;
167   
168   return data;
169}
170
171
172//-------------------------------------------------
173//  wangpcbus_amwc_w - memory write
174//-------------------------------------------------
175
176void wangpc_wdc_device::wangpcbus_amwc_w(address_space &space, offs_t offset, UINT16 mem_mask, UINT16 data)
177{
178}
179
180
181//-------------------------------------------------
182//  wangpcbus_iorc_r - I/O read
183//-------------------------------------------------
184
185UINT16 wangpc_wdc_device::wangpcbus_iorc_r(address_space &space, offs_t offset, UINT16 mem_mask)
186{
187   UINT16 data = 0xffff;
188
189   if (sad(offset))
190   {
191      switch (offset & 0x7f)
192      {
193      case 0xfe/2:
194         data = 0xff00 | OPTION_ID;
195         break;
196      }
197   }
198
199   return data;
200}
201
202
203//-------------------------------------------------
204//  wangpcbus_aiowc_w - I/O write
205//-------------------------------------------------
206
207void wangpc_wdc_device::wangpcbus_aiowc_w(address_space &space, offs_t offset, UINT16 data, UINT16 mem_mask)
208{
209   if (sad(offset))
210   {
211      switch (offset & 0x7f)
212      {
213      case 0xfc/2:
214         device_reset();
215         break;
216      }
217   }
218}
src/mess/machine/wangpc_wdc.h
r0r15309
1/**********************************************************************
2
3    Wang PC-PM001 Winchester Disk Controller emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __WANGPC_WDC__
13#define __WANGPC_WDC__
14
15
16#include "emu.h"
17#include "cpu/z80/z80.h"
18#include "imagedev/harddriv.h"
19#include "machine/scsibus.h"
20#include "machine/wangpcbus.h"
21
22
23
24//**************************************************************************
25//  TYPE DEFINITIONS
26//**************************************************************************
27
28// ======================> wangpc_wdc_device
29
30class wangpc_wdc_device : public device_t,
31                    public device_wangpcbus_card_interface
32{
33public:
34   // construction/destruction
35   wangpc_wdc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
36
37   // optional information overrides
38   virtual const rom_entry *device_rom_region() const;
39   virtual machine_config_constructor device_mconfig_additions() const;
40
41protected:
42   // device-level overrides
43   virtual void device_start();
44   virtual void device_reset();
45   virtual void device_config_complete() { m_shortname = "wangpc_wdc"; }
46
47   // device_wangpcbus_card_interface overrides
48   virtual UINT16 wangpcbus_mrdc_r(address_space &space, offs_t offset, UINT16 mem_mask);
49   virtual void wangpcbus_amwc_w(address_space &space, offs_t offset, UINT16 mem_mask, UINT16 data);
50   virtual UINT16 wangpcbus_iorc_r(address_space &space, offs_t offset, UINT16 mem_mask);
51   virtual void wangpcbus_aiowc_w(address_space &space, offs_t offset, UINT16 mem_mask, UINT16 data);
52
53private:
54   required_device<cpu_device> m_maincpu;
55   required_device<device_t> m_sasibus;
56};
57
58
59// device type definition
60extern const device_type WANGPC_WDC;
61
62
63#endif
src/mess/machine/wangpcbus.c
r15308r15309
305305device_wangpcbus_card_interface::device_wangpcbus_card_interface(const machine_config &mconfig, device_t &device)
306306   : device_slot_card_interface(mconfig, device)
307307{
308   m_slot = dynamic_cast<wangpcbus_slot_device *>(device.owner());
308309}
309310 
310311 
src/mess/machine/wangpcbus.h
r15308r15309
186186   virtual bool wangpcbus_have_dack(int line) { return false; }
187187 
188188   wangpcbus_device  *m_bus;
189   wangpcbus_slot_device *m_slot;
190 
189191   int m_sid;
190192   device_wangpcbus_card_interface *m_next;
191193};
src/mess/machine/wangpc_lic.c
r0r15309
1/**********************************************************************
2
3    Wang PC Network card emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "wangpc_lic.h"
11
12
13
14//**************************************************************************
15//  MACROS/CONSTANTS
16//**************************************************************************
17
18#define OPTION_ID      0x30
19
20
21
22//**************************************************************************
23//  DEVICE DEFINITIONS
24//**************************************************************************
25
26const device_type WANGPC_LIC = &device_creator<wangpc_lic_device>;
27
28
29//-------------------------------------------------
30//  ROM( wangpc_lic )
31//-------------------------------------------------
32
33ROM_START( wangpc_lic )
34   ROM_REGION( 0x1000, "network", 0 )
35   ROM_LOAD( "7025.l22", 0x0000, 0x1000, CRC(487e5f04) SHA1(81e52e70e0c6e34715119b121ec19a7758cd6772) )
36ROM_END
37
38
39//-------------------------------------------------
40//  rom_region - device-specific ROM region
41//-------------------------------------------------
42
43const rom_entry *wangpc_lic_device::device_rom_region() const
44{
45   return ROM_NAME( wangpc_lic );
46}
47
48
49//-------------------------------------------------
50//  MACHINE_CONFIG_FRAGMENT( wangpc_lic )
51//-------------------------------------------------
52
53static MACHINE_CONFIG_FRAGMENT( wangpc_lic )
54MACHINE_CONFIG_END
55
56
57//-------------------------------------------------
58//  machine_config_additions - device-specific
59//  machine configurations
60//-------------------------------------------------
61
62machine_config_constructor wangpc_lic_device::device_mconfig_additions() const
63{
64   return MACHINE_CONFIG_NAME( wangpc_lic );
65}
66
67
68
69//**************************************************************************
70//  LIVE DEVICE
71//**************************************************************************
72
73//-------------------------------------------------
74//  wangpc_lic_device - constructor
75//-------------------------------------------------
76
77wangpc_lic_device::wangpc_lic_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
78   device_t(mconfig, WANGPC_LIC, "Wang PC-PM070", tag, owner, clock),
79   device_wangpcbus_card_interface(mconfig, *this)
80{
81}
82
83
84//-------------------------------------------------
85//  device_start - device-specific startup
86//-------------------------------------------------
87
88void wangpc_lic_device::device_start()
89{
90}
91
92
93//-------------------------------------------------
94//  device_reset - device-specific reset
95//-------------------------------------------------
96
97void wangpc_lic_device::device_reset()
98{
99}
100
101
102//-------------------------------------------------
103//  wangpcbus_mrdc_r - memory read
104//-------------------------------------------------
105
106UINT16 wangpc_lic_device::wangpcbus_mrdc_r(address_space &space, offs_t offset, UINT16 mem_mask)
107{
108   UINT16 data = 0xffff;
109   
110   return data;
111}
112
113
114//-------------------------------------------------
115//  wangpcbus_amwc_w - memory write
116//-------------------------------------------------
117
118void wangpc_lic_device::wangpcbus_amwc_w(address_space &space, offs_t offset, UINT16 mem_mask, UINT16 data)
119{
120}
121
122
123//-------------------------------------------------
124//  wangpcbus_iorc_r - I/O read
125//-------------------------------------------------
126
127UINT16 wangpc_lic_device::wangpcbus_iorc_r(address_space &space, offs_t offset, UINT16 mem_mask)
128{
129   UINT16 data = 0xffff;
130
131   if (sad(offset))
132   {
133      switch (offset & 0x7f)
134      {
135      case 0xfe/2:
136         data = 0xff00 | OPTION_ID;
137         break;
138      }
139   }
140
141   return data;
142}
143
144
145//-------------------------------------------------
146//  wangpcbus_aiowc_w - I/O write
147//-------------------------------------------------
148
149void wangpc_lic_device::wangpcbus_aiowc_w(address_space &space, offs_t offset, UINT16 data, UINT16 mem_mask)
150{
151   if (sad(offset))
152   {
153      switch (offset & 0x7f)
154      {
155      case 0xfc/2:
156         device_reset();
157         break;
158      }
159   }
160}
src/mess/machine/wangpc_lic.h
r0r15309
1/**********************************************************************
2
3    Wang PC-PM070 Local Interconnect option card emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __WANGPC_LIC__
13#define __WANGPC_LIC__
14
15
16#include "emu.h"
17#include "machine/wangpcbus.h"
18
19
20
21//**************************************************************************
22//  TYPE DEFINITIONS
23//**************************************************************************
24
25// ======================> wangpc_lic_device
26
27class wangpc_lic_device : public device_t,
28                      public device_wangpcbus_card_interface
29{
30public:
31   // construction/destruction
32   wangpc_lic_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
33
34   // optional information overrides
35   virtual const rom_entry *device_rom_region() const;
36   virtual machine_config_constructor device_mconfig_additions() const;
37
38protected:
39   // device-level overrides
40   virtual void device_start();
41   virtual void device_reset();
42   virtual void device_config_complete() { m_shortname = "wangpc_lic"; }
43
44   // device_wangpcbus_card_interface overrides
45   virtual UINT16 wangpcbus_mrdc_r(address_space &space, offs_t offset, UINT16 mem_mask);
46   virtual void wangpcbus_amwc_w(address_space &space, offs_t offset, UINT16 mem_mask, UINT16 data);
47   virtual UINT16 wangpcbus_iorc_r(address_space &space, offs_t offset, UINT16 mem_mask);
48   virtual void wangpcbus_aiowc_w(address_space &space, offs_t offset, UINT16 mem_mask, UINT16 data);
49};
50
51
52// device type definition
53extern const device_type WANGPC_LIC;
54
55
56#endif
src/mess/includes/wangpc.h
r15308r15309
1616#include "machine/upd765.h"
1717#include "machine/wangpcbus.h"
1818#include "machine/wangpckb.h"
19#include "machine/wangpc_lores.h"
19#include "machine/wangpc_lic.h"
20#include "machine/wangpc_lvc.h"
21#include "machine/wangpc_rtc.h"
22#include "machine/wangpc_wdc.h"
2023 
2124#define I8086_TAG      "i8086"
2225#define AM9517A_TAG      "am9517a"
r15308r15309
170173   int m_fdc_drq;
171174   int m_ds1;
172175   int m_ds2;
176 
177   int m_led[6];
173178};
174179 
175180 
src/mess/drivers/wangpc.c
r15308r15309
1616//  MACROS/CONSTANTS
1717//**************************************************************************
1818 
19#define LOG 1
20 
1921enum
2022{
2123   LED_DIAGNOSTIC = 0
r15308r15309
4749   m_fdc_tc_enable = BIT(data, 0);
4850   m_fdc_dma_enable = BIT(data, 1);
4951 
52    if (LOG) logerror("Enable /EOP %u\n", m_fdc_tc_enable);
53    if (LOG) logerror("Disable /DREQ2 %u\n", m_fdc_dma_enable);
54 
5055   update_fdc_tc();
5156   update_fdc_drq();
5257}
r15308r15309
5459 
5560READ8_MEMBER( wangpc_state::deselect_drive1_r )
5661{
57   m_ds1 = 1;
62    if (LOG) logerror("Deselect drive 1\n");
5863 
64      m_ds1 = 1;
65 
5966   return 0;
6067}
6168 
6269 
6370WRITE8_MEMBER( wangpc_state::deselect_drive1_w )
6471{
72    if (LOG) logerror("Deselect drive 1\n");
73 
6574   m_ds1 = 1;
6675}
6776 
6877 
6978READ8_MEMBER( wangpc_state::select_drive1_r )
7079{
80    if (LOG) logerror("Select drive 1\n");
81 
7182   m_ds1 = 0;
7283 
7384   return 0;
r15308r15309
7687 
7788WRITE8_MEMBER( wangpc_state::select_drive1_w )
7889{
90    if (LOG) logerror("Select drive 1\n");
91 
7992   m_ds1 = 0;
8093}
8194 
8295 
8396READ8_MEMBER( wangpc_state::deselect_drive2_r )
8497{
98    if (LOG) logerror("Deselect drive 2\n");
99 
85100   m_ds2 = 1;
86101 
87102   return 0;
r15308r15309
90105 
91106WRITE8_MEMBER( wangpc_state::deselect_drive2_w )
92107{
108    if (LOG) logerror("Deselect drive 2\n");
109 
93110   m_ds2 = 1;
94111}
95112 
96113 
97114READ8_MEMBER( wangpc_state::select_drive2_r )
98115{
116    if (LOG) logerror("Select drive 2\n");
117 
99118   m_ds2 = 0;
100119 
101120   return 0;
r15308r15309
104123 
105124WRITE8_MEMBER( wangpc_state::select_drive2_w )
106125{
126    if (LOG) logerror("Select drive 2\n");
127 
107128   m_ds2 = 0;
108129}
109130 
110131 
111132READ8_MEMBER( wangpc_state::motor1_off_r )
112133{
134    if (LOG) logerror("Motor 1 off\n");
135   
113136   floppy_mon_w(m_floppy0, 1);
114137 
115138   return 0;
r15308r15309
118141 
119142WRITE8_MEMBER( wangpc_state::motor1_off_w )
120143{
144    if (LOG) logerror("Motor 1 off\n");
145 
121146   floppy_mon_w(m_floppy0, 1);
122147}
123148 
124149 
125150READ8_MEMBER( wangpc_state::motor1_on_r )
126151{
152    if (LOG) logerror("Motor 1 on\n");
153 
127154   floppy_mon_w(m_floppy0, 0);
128155 
129156   return 0;
r15308r15309
132159 
133160WRITE8_MEMBER( wangpc_state::motor1_on_w )
134161{
162    if (LOG) logerror("Motor 1 on\n");
163 
135164   floppy_mon_w(m_floppy0, 0);
136165}
137166 
138167 
139168READ8_MEMBER( wangpc_state::motor2_off_r )
140169{
170    if (LOG) logerror("Motor 2 off\n");
171 
141172   floppy_mon_w(m_floppy1, 1);
142173 
143174   return 0;
r15308r15309
146177 
147178WRITE8_MEMBER( wangpc_state::motor2_off_w )
148179{
180    if (LOG) logerror("Motor 2 off\n");
181 
149182   floppy_mon_w(m_floppy1, 1);
150183}
151184 
152185 
153186READ8_MEMBER( wangpc_state::motor2_on_r )
154187{
188    if (LOG) logerror("Motor 2 on\n");
189 
155190   floppy_mon_w(m_floppy1, 0);
156191 
157192   return 0;
r15308r15309
160195 
161196WRITE8_MEMBER( wangpc_state::motor2_on_w )
162197{
198    if (LOG) logerror("Motor 2 on\n");
199 
163200   floppy_mon_w(m_floppy1, 0);
164201}
165202 
166203 
167204READ8_MEMBER( wangpc_state::fdc_reset_r )
168205{
206    if (LOG) logerror("FDC reset\n");
207 
169208   upd765_reset_w(m_fdc, 1);
170209   upd765_reset_w(m_fdc, 0);
171210 
r15308r15309
175214 
176215WRITE8_MEMBER( wangpc_state::fdc_reset_w )
177216{
217    if (LOG) logerror("FDC reset\n");
218 
178219   upd765_reset_w(m_fdc, 1);
179220   upd765_reset_w(m_fdc, 0);
180221}
r15308r15309
182223 
183224READ8_MEMBER( wangpc_state::fdc_tc_r )
184225{
226    if (LOG) logerror("FDC TC\n");
227 
185228   upd765_tc_w(m_fdc, 1);
186229   upd765_tc_w(m_fdc, 0);
187230 
r15308r15309
191234 
192235WRITE8_MEMBER( wangpc_state::fdc_tc_w )
193236{
237    if (LOG) logerror("FDC TC\n");
238 
194239   upd765_tc_w(m_fdc, 1);
195240   upd765_tc_w(m_fdc, 0);
196241}
r15308r15309
203248 
204249WRITE8_MEMBER( wangpc_state::dma_page_w )
205250{
251    if (LOG) logerror("DMA page %u: %01x\n", offset, data & 0x0f);
252 
206253   m_dma_page[offset] = data & 0x0f;
207254}
208255 
r15308r15309
243290 
244291WRITE8_MEMBER( wangpc_state::timer0_irq_clr_w )
245292{
293    if (LOG) logerror("Timer 0 IRQ clear\n");
294 
246295   pic8259_ir0_w(m_pic, CLEAR_LINE);
247296}
248297 
r15308r15309
253302 
254303READ8_MEMBER( wangpc_state::timer2_irq_clr_r )
255304{
305    if (LOG) logerror("Timer 2 IRQ clear\n");
306 
256307   m_timer2_irq = 1;
257308   check_level1_interrupts();
258309 
r15308r15309
266317 
267318WRITE8_MEMBER( wangpc_state::nmi_mask_w )
268319{
320    if (LOG) logerror("NMI mask %02x\n", data);
269321}
270322 
271323 
r15308r15309
275327 
276328READ8_MEMBER( wangpc_state::led_on_r )
277329{
330    if (LOG) logerror("LED on\n");
331 
278332   output_set_led_value(LED_DIAGNOSTIC, 1);
279333 
280334   return 0;
r15308r15309
287341 
288342WRITE8_MEMBER( wangpc_state::fpu_mask_w )
289343{
344    if (LOG) logerror("FPU mask %02x\n", data);
290345}
291346 
292347 
r15308r15309
296351 
297352WRITE8_MEMBER( wangpc_state::uart_tbre_clr_w  )
298353{
354    if (LOG) logerror("TBRE clear\n");
355 
299356   m_uart_tbre = 0;
300357   check_level2_interrupts();
301358}
r15308r15309
320377 
321378WRITE8_MEMBER( wangpc_state::uart_w  )
322379{
380    if (LOG) logerror("UART write %02x\n", data);
381 
382    switch (data)
383    {
384    case 0x10: m_led[0] = 1; break;
385    case 0x11: m_led[0] = 0; break;
386    case 0x12: m_led[1] = 1; break;
387    case 0x13: m_led[1] = 0; break;
388    case 0x14: m_led[2] = 1; break;
389    case 0x15: m_led[2] = 0; break;
390    case 0x16: m_led[3] = 1; break;
391    case 0x17: m_led[3] = 0; break;
392    case 0x18: m_led[4] = 1; break;
393    case 0x19: m_led[4] = 0; break;
394    case 0x1a: m_led[5] = 1; break;
395    case 0x1b: m_led[5] = 0; break;
396    case 0x1c: m_led[0] = m_led[1] = m_led[2] = m_led[3] = m_led[4] = m_led[5] = 1; break;
397    case 0x1d: m_led[0] = m_led[1] = m_led[2] = m_led[3] = m_led[4] = m_led[5] = 0; break;
398    }
399 
400    popmessage("%u%u%u%u%u%u", m_led[0], m_led[1], m_led[2], m_led[3], m_led[4], m_led[5]);
401 
323402   m_uart_tbre = 0;
324403   check_level2_interrupts();
325404 
r15308r15309
362441 
363442READ8_MEMBER( wangpc_state::busy_clr_r )
364443{
444    if (LOG) logerror("BUSY clear\n");
445 
365446   m_busy = 1;
366447   check_level1_interrupts();
367448 
r15308r15309
375456 
376457WRITE8_MEMBER( wangpc_state::acknlg_clr_w )
377458{
459    if (LOG) logerror("ACKNLG clear\n");
460 
378461   m_acknlg = 1;
379462   check_level1_interrupts();
380463}
r15308r15309
386469 
387470READ8_MEMBER( wangpc_state::led_off_r )
388471{
472    if (LOG) logerror("LED off\n");
473 
389474   output_set_led_value(LED_DIAGNOSTIC, 0);
390475 
391476   return 0;
r15308r15309
398483 
399484WRITE8_MEMBER( wangpc_state::parity_nmi_clr_w )
400485{
486    if (LOG) logerror("Parity NMI clear\n");
401487}
402488 
403489 
r15308r15309
651737 
652738void wangpc_state::check_level2_interrupts()
653739{
654   int state = !m_dma_eop | m_uart_dr | m_uart_tbre | upd765_int_r(m_fdc) | m_fpu_irq;
740   int state = !m_dma_eop | m_uart_dr /*| m_uart_tbre*/ | upd765_int_r(m_fdc) | m_fpu_irq;
655741 
656742   pic8259_ir2_w(m_pic, state);
657743}
r15308r15309
840926{
841927   if (state)
842928   {
929       if (LOG) logerror("DR set\n");
930 
843931      m_uart_dr = 1;
844932      check_level2_interrupts();
845933   }
r15308r15309
849937{
850938   if (state)
851939   {
940       if (LOG) logerror("TBRE set\n");
941 
852942      m_uart_tbre = 1;
853943      check_level2_interrupts();
854944   }
r15308r15309
885975 
886976WRITE_LINE_MEMBER( wangpc_state::fdc_int_w )
887977{
978    if (LOG) logerror("FDC INT %u\n", state);
979 
888980   check_level2_interrupts();
889981}
890982 
891983WRITE_LINE_MEMBER( wangpc_state::fdc_drq_w )
892984{
985    if (LOG) logerror("FDC DRQ %u\n", state);
986 
893987   m_fdc_drq = state;
894988   update_fdc_drq();
895989}
r15308r15309
9281022 
9291023WRITE_LINE_MEMBER( wangpc_state::ack_w )
9301024{
1025    if (LOG) logerror("ACKNLG %u\n", state);
1026 
9311027   m_acknlg = state;
9321028   check_level1_interrupts();
9331029}
9341030 
9351031WRITE_LINE_MEMBER( wangpc_state::busy_w )
9361032{
1033    if (LOG) logerror("BUSY %u\n", state);
1034 
9371035   m_busy = state;
9381036   check_level1_interrupts();
9391037}
r15308r15309
9621060 
9631061WRITE_LINE_MEMBER( wangpc_state::bus_irq2_w )
9641062{
1063    if (LOG) logerror("Bus IRQ2 %u\n", state);
1064 
9651065   check_level2_interrupts();
9661066}
9671067 
r15308r15309
9801080};
9811081 
9821082static SLOT_INTERFACE_START( wangpc_cards )
983   SLOT_INTERFACE("lores", WANGPC_LORES_VIDEO)
1083   SLOT_INTERFACE("lic", WANGPC_LIC) // local interconnect option card
1084   SLOT_INTERFACE("lvc", WANGPC_LVC) // low-resolution video controller
1085   SLOT_INTERFACE("rtc", WANGPC_RTC) // remote telecommunications controller
1086   SLOT_INTERFACE("wdc", WANGPC_WDC) // Winchester disk controller
1087   //SLOT_INTERFACE("mvc", WANGPC_MVC) // medium-resolution video controller
1088   //SLOT_INTERFACE("mcc", WANGPC_MCC) // multiport communications controller
1089   //SLOT_INTERFACE("tig", WANGPC_TIG) // text/image/graphics controller
9841090SLOT_INTERFACE_END
9851091 
9861092 
r15308r15309
10471153   // bus
10481154   MCFG_WANGPC_BUS_ADD(bus_intf)
10491155   MCFG_WANGPC_BUS_SLOT_ADD("slot1", 1, wangpc_cards, NULL, NULL)
1050   MCFG_WANGPC_BUS_SLOT_ADD("slot2", 2, wangpc_cards, "lores", NULL)
1156   MCFG_WANGPC_BUS_SLOT_ADD("slot2", 2, wangpc_cards, "lvc", NULL)
10511157   MCFG_WANGPC_BUS_SLOT_ADD("slot3", 3, wangpc_cards, NULL, NULL)
10521158   MCFG_WANGPC_BUS_SLOT_ADD("slot4", 4, wangpc_cards, NULL, NULL)
10531159   MCFG_WANGPC_BUS_SLOT_ADD("slot5", 5, wangpc_cards, NULL, NULL)
r15308r15309
10691175 
10701176ROM_START( wangpc )
10711177   ROM_REGION16_LE( 0x4000, I8086_TAG, 0)
1072   ROM_LOAD16_BYTE( "motherboard-l94.bin", 0x0001, 0x2000, CRC(f9f41304) SHA1(1815295809ef11573d724ede47446f9ac7aee713) )
1073   ROM_LOAD16_BYTE( "motherboard-l115.bin", 0x0000, 0x2000, CRC(67b37684) SHA1(70d9f68eb88cc2bc9f53f949cc77411c09a4266e) )
1074 
1075   ROM_REGION( 0x1000, "remotecomms", 0 )
1076   ROM_LOAD( "remotecomms-l28.bin", 0x0000, 0x1000, CRC(c05a1bee) SHA1(6b3f0d787d014b1fd3925812c905ddb63c5055f1) )
1077 
1078   ROM_REGION( 0x1000, "network", 0 )
1079   ROM_LOAD( "network-l22.bin", 0x0000, 0x1000, CRC(487e5f04) SHA1(81e52e70e0c6e34715119b121ec19a7758cd6772) )
1080 
1081   ROM_REGION( 0x1000, "hdc1", 0 )
1082   ROM_LOAD( "hdc-l54.bin", 0x0000, 0x1000, CRC(94e9a17d) SHA1(060c576d70069ece2d0dbce86ffc448df2b169e7) )
1083 
1084   ROM_REGION( 0x1000, "hdc2", 0 )
1085   ROM_LOAD( "hdc-l19.bin", 0x0000, 0x1000, CRC(282770d2) SHA1(a0e3bad5041e0dfd6087907015b07a093b576bc0) )
1178   ROM_LOAD16_BYTE( "0001 r2.l94", 0x0001, 0x2000, CRC(f9f41304) SHA1(1815295809ef11573d724ede47446f9ac7aee713) )
1179   ROM_LOAD16_BYTE( "379-0000 r2.l115", 0x0000, 0x2000, CRC(67b37684) SHA1(70d9f68eb88cc2bc9f53f949cc77411c09a4266e) )
10861180ROM_END
10871181 
10881182 
src/mess/mess.mak
r15308r15309
18481848   $(MESS_DRIVERS)/wangpc.o   \
18491849   $(MESS_MACHINE)/wangpcbus.o   \
18501850   $(MESS_MACHINE)/wangpckb.o   \
1851   $(MESS_MACHINE)/wangpc_lores.o   \
1851   $(MESS_MACHINE)/wangpc_lic.o   \
1852   $(MESS_MACHINE)/wangpc_lvc.o   \
1853   $(MESS_MACHINE)/wangpc_rtc.o   \
1854   $(MESS_MACHINE)/wangpc_wdc.o   \
18521855
18531856$(MESSOBJ)/wavemate.a:         \
18541857   $(MESS_DRIVERS)/bullet.o   \

Previous 15994 Revisions Next


© 1998-2018 The MESS Team