Previous 15994 Revisions Next

r4946 Friday 5th June, 2009 at 21:56:30 UTC by Curt Coder
[PROF80] Added Z80-STI skeleton.
[src/mess]mess.mak
[src/mess/drivers]prof80.c
[src/mess/includes]prof80.h
[src/mess/machine]z80sti.c* z80sti.h*

src/mess/includes/prof80.h
r4945r4946
2222
2323   /* video state */
2424   UINT8 *video_ram;      /* video RAM */
25   int vsync;            /* vertical sync */
2625   int lps;            /* light pen sense */
2726   int page;            /* video page */
2827
r4945r4946
4140   const device_config *upd1990a;
4241   const device_config *mc6845;
4342   const device_config *ppi8255;
43   const device_config *z80sti;
4444   const device_config *centronics;
4545};
4646
src/mess/machine/z80sti.c
r0r4946
1/***************************************************************************
2
3    Mostek Z80STI Serial Timer Interrupt Controller emulation
4
5    Copyright (c) 2008, The MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8***************************************************************************/
9
10/*
11
12   TODO:
13
14   - everything
15
16*/
17
18#include "driver.h"
19#include "z80sti.h"
20#include "cpu/z80/z80.h"
21#include "cpu/z80/z80daisy.h"
22
23/***************************************************************************
24    PARAMETERS
25***************************************************************************/
26
27#define VERBOSE 1
28
29#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
30
31enum
32{
33   Z80STI_REGISTER_IR = 0,
34   Z80STI_REGISTER_GPIP,
35   Z80STI_REGISTER_IPRB,
36   Z80STI_REGISTER_IPRA,
37   Z80STI_REGISTER_ISRB,
38   Z80STI_REGISTER_ISRA,
39   Z80STI_REGISTER_IMRB,
40   Z80STI_REGISTER_IMRA,
41   Z80STI_REGISTER_PVR,
42   Z80STI_REGISTER_TABC,
43   Z80STI_REGISTER_TBDR,
44   Z80STI_REGISTER_TADR,
45   Z80STI_REGISTER_UCR,
46   Z80STI_REGISTER_RSR,
47   Z80STI_REGISTER_TSR,
48   Z80STI_REGISTER_UDR
49};
50
51/***************************************************************************
52    TYPE DEFINITIONS
53***************************************************************************/
54
55typedef struct _z80sti_t z80sti_t;
56struct _z80sti_t
57{
58   devcb_resolved_read8      in_gpio_func;
59   devcb_resolved_write8      out_gpio_func;
60   devcb_resolved_read_line   in_si_func;
61   devcb_resolved_write_line   out_so_func;
62   devcb_resolved_write_line   out_tao_func;
63   devcb_resolved_write_line   out_tbo_func;
64   devcb_resolved_write_line   out_tco_func;
65   devcb_resolved_write_line   out_tdo_func;
66   devcb_resolved_write_line   out_irq_func;
67};
68
69/***************************************************************************
70    FUNCTION PROTOTYPES
71***************************************************************************/
72
73static int z80sti_irq_state(const device_config *device);
74static void z80sti_irq_reti(const device_config *device);
75
76/***************************************************************************
77    INLINE FUNCTIONS
78***************************************************************************/
79
80INLINE z80sti_t *get_safe_token(const device_config *device)
81{
82   assert(device != NULL);
83   assert(device->token != NULL);
84   assert(device->type == Z80STI);
85   return (z80sti_t *)device->token;
86}
87
88INLINE const z80sti_interface *get_interface(const device_config *device)
89{
90   assert(device != NULL);
91   assert((device->type == Z80STI));
92   return (const z80sti_interface *) device->static_config;
93}
94
95/***************************************************************************
96    IMPLEMENTATION
97***************************************************************************/
98
99/*-------------------------------------------------
100    z80sti_r - register read
101-------------------------------------------------*/
102
103READ8_DEVICE_HANDLER( z80sti_r )
104{
105   return 0;
106}
107
108/*-------------------------------------------------
109    z80sti_w - register write
110-------------------------------------------------*/
111
112WRITE8_DEVICE_HANDLER( z80sti_w )
113{
114}
115
116/*-------------------------------------------------
117    z80sti_rc_w - receiver clock write
118-------------------------------------------------*/
119
120WRITE_LINE_DEVICE_HANDLER( z80sti_rc_w )
121{
122}
123
124/*-------------------------------------------------
125    z80sti_tc_w - transmitter clock write
126-------------------------------------------------*/
127
128WRITE_LINE_DEVICE_HANDLER( z80sti_tc_w )
129{
130}
131
132/*-------------------------------------------------
133    z80sti_i0_w - input 0 write
134-------------------------------------------------*/
135
136WRITE_LINE_DEVICE_HANDLER( z80sti_i0_w )
137{
138}
139
140/*-------------------------------------------------
141    z80sti_i1_w - input 1 write
142-------------------------------------------------*/
143
144WRITE_LINE_DEVICE_HANDLER( z80sti_i1_w )
145{
146}
147
148/*-------------------------------------------------
149    z80sti_i2_w - input 2 write
150-------------------------------------------------*/
151
152WRITE_LINE_DEVICE_HANDLER( z80sti_i2_w )
153{
154}
155
156/*-------------------------------------------------
157    z80sti_i3_w - input 3 write
158-------------------------------------------------*/
159
160WRITE_LINE_DEVICE_HANDLER( z80sti_i3_w )
161{
162}
163
164/*-------------------------------------------------
165    z80sti_i4_w - input 4 write
166-------------------------------------------------*/
167
168WRITE_LINE_DEVICE_HANDLER( z80sti_i4_w )
169{
170}
171
172/*-------------------------------------------------
173    z80sti_i5_w - input 5 write
174-------------------------------------------------*/
175
176WRITE_LINE_DEVICE_HANDLER( z80sti_i5_w )
177{
178}
179
180/*-------------------------------------------------
181    z80sti_i6_w - input 6 write
182-------------------------------------------------*/
183
184WRITE_LINE_DEVICE_HANDLER( z80sti_i6_w )
185{
186}
187
188/*-------------------------------------------------
189    z80sti_i7_w - input 7 write
190-------------------------------------------------*/
191
192WRITE_LINE_DEVICE_HANDLER( z80sti_i7_w )
193{
194}
195
196/*-------------------------------------------------
197    z80sti_irq_state - get interrupt status
198-------------------------------------------------*/
199
200static int z80sti_irq_state(const device_config *device)
201{
202   return 0;
203}
204
205/*-------------------------------------------------
206    z80sti_irq_ack - interrupt acknowledge
207-------------------------------------------------*/
208
209static int z80sti_irq_ack(const device_config *device)
210{
211   return 0;
212}
213
214/*-------------------------------------------------
215    z80sti_irq_reti - return from interrupt
216-------------------------------------------------*/
217
218static void z80sti_irq_reti(const device_config *device)
219{
220}
221
222/*-------------------------------------------------
223    DEVICE_START( z80sti )
224-------------------------------------------------*/
225
226static DEVICE_START( z80sti )
227{
228   z80sti_t *z80sti = get_safe_token(device);
229   const z80sti_interface *intf = device->static_config;
230
231   /* resolve callbacks */
232   devcb_resolve_read8(&z80sti->in_gpio_func, &intf->in_gpio_func, device);
233   devcb_resolve_write8(&z80sti->out_gpio_func, &intf->out_gpio_func, device);
234   devcb_resolve_read_line(&z80sti->in_si_func, &intf->in_si_func, device);
235   devcb_resolve_write_line(&z80sti->out_so_func, &intf->out_so_func, device);
236   devcb_resolve_write_line(&z80sti->out_tao_func, &intf->out_tao_func, device);
237   devcb_resolve_write_line(&z80sti->out_tbo_func, &intf->out_tbo_func, device);
238   devcb_resolve_write_line(&z80sti->out_tco_func, &intf->out_tco_func, device);
239   devcb_resolve_write_line(&z80sti->out_tdo_func, &intf->out_tdo_func, device);
240   devcb_resolve_write_line(&z80sti->out_irq_func, &intf->out_irq_func, device);
241}
242
243/*-------------------------------------------------
244    DEVICE_RESET( z80sti )
245-------------------------------------------------*/
246
247static DEVICE_RESET( z80sti )
248{
249}
250
251/*-------------------------------------------------
252    DEVICE_GET_INFO( z80sti )
253-------------------------------------------------*/
254
255DEVICE_GET_INFO( z80sti )
256{
257   switch (state)
258   {
259      /* --- the following bits of info are returned as 64-bit signed integers --- */
260      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(z80sti_t);                  break;
261      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = 0;                           break;
262      case DEVINFO_INT_CLASS:                     info->i = DEVICE_CLASS_PERIPHERAL;            break;
263
264      /* --- the following bits of info are returned as pointers to data or functions --- */
265      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(z80sti);      break;
266      case DEVINFO_FCT_STOP:                     /* Nothing */                           break;
267      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(z80sti);      break;
268      case DEVINFO_FCT_IRQ_STATE:                  info->f = (genf *)z80sti_irq_state;            break;
269      case DEVINFO_FCT_IRQ_ACK:                  info->f = (genf *)z80sti_irq_ack;            break;
270      case DEVINFO_FCT_IRQ_RETI:                  info->f = (genf *)z80sti_irq_reti;            break;
271
272      /* --- the following bits of info are returned as NULL-terminated strings --- */
273      case DEVINFO_STR_NAME:                     strcpy(info->s, "Mostek MK3801");            break;
274      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Z80 STI");                  break;
275      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                     break;
276      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                  break;
277      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright the MESS Team");      break;
278   }
279}
src/mess/machine/z80sti.h
r0r4946
1/**********************************************************************
2
3    Mostek MK3801 Serial Timer Interrupt Controller emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************
9                     _____   _____
10               TAO   1 |*    \_/     | 40  Vcc
11               TBO   2 |          | 39  RC
12               TCO   3 |          | 38  SI
13               TDO   4 |          | 37  SO
14               TCK   5 |          | 36  TC
15               _M1   6 |          | 35  A0
16              _RES   7 |          | 34  A1
17               I0   8 |          | 33  A2
18               I1   9 |          | 32  A3
19               I2  10 |   MK3801    | 31  _WR
20                I3  11 |   Z80 STI    | 30  _CS
21               I4  12 |          | 29  _RD
22                I5  13 |          | 28  D7
23                I6  14 |          | 27  D6
24                I7  15 |          | 26  D5
25               IEI  16 |          | 25  D4
26              _INT  17 |          | 24  D3
27               IEO  18 |          | 23  D2
28             _IORQ  19 |          | 22  D1
29               GND  20 |_____________| 21  D0
30
31**********************************************************************/
32
33#ifndef __Z80STI__
34#define __Z80STI__
35
36#include "driver.h"
37#include "devcb.h"
38
39/***************************************************************************
40    MACROS / CONSTANTS
41***************************************************************************/
42
43#define Z80STI DEVICE_GET_INFO_NAME( z80sti )
44
45#define MDRV_Z80STI_ADD(_tag, _clock, _config) \
46   MDRV_DEVICE_ADD((_tag), Z80STI, _clock)   \
47   MDRV_DEVICE_CONFIG(_config)
48
49#define MDRV_MK68901_ADD(_tag, _clock, _config) \
50   MDRV_DEVICE_ADD((_tag), MK68901, _clock)   \
51   MDRV_DEVICE_CONFIG(_config)
52
53#define Z80STI_INTERFACE(name) const z80sti_interface (name) =
54
55/***************************************************************************
56    TYPE DEFINITIONS
57***************************************************************************/
58
59typedef struct _z80sti_interface z80sti_interface;
60struct _z80sti_interface
61{
62   int   rx_clock;         /* serial receive clock */
63   int   tx_clock;         /* serial transmit clock */
64
65   /* this is called on each read of the I/O pins */
66   devcb_read8            in_gpio_func;
67
68   /* this is called on each write of the I/O pins */
69   devcb_write8         out_gpio_func;
70
71   /* this gets called for each read of the SI pin (pin 38) */
72   devcb_read_line         in_si_func;
73   
74   /* this gets called for each change of the SO pin (pin 37) */
75   devcb_write_line      out_so_func;
76
77   /* this gets called for each change of the TAO pin (pin 1) */
78   devcb_write_line      out_tao_func;
79   
80   /* this gets called for each change of the TBO pin (pin 2) */
81   devcb_write_line      out_tbo_func;
82   
83   /* this gets called for each change of the TCO pin (pin 3) */
84   devcb_write_line      out_tco_func;
85   
86   /* this gets called for each change of the TDO pin (pin 4) */
87   devcb_write_line      out_tdo_func;
88
89   /* this gets called on each change of the interrupt line (pin 17) */
90   devcb_write_line      out_irq_func;
91};
92
93/***************************************************************************
94    PROTOTYPES
95***************************************************************************/
96
97/* device interface */
98DEVICE_GET_INFO( z80sti );
99
100/* register access */
101READ8_DEVICE_HANDLER( z80sti_r );
102WRITE8_DEVICE_HANDLER( z80sti_w );
103
104/* receive clock */
105WRITE_LINE_DEVICE_HANDLER( z80sti_rc_w );
106
107/* transmit clock */
108WRITE_LINE_DEVICE_HANDLER( z80sti_tc_w );
109
110/* input write */
111WRITE_LINE_DEVICE_HANDLER( z80sti_i0_w );
112WRITE_LINE_DEVICE_HANDLER( z80sti_i1_w );
113WRITE_LINE_DEVICE_HANDLER( z80sti_i2_w );
114WRITE_LINE_DEVICE_HANDLER( z80sti_i3_w );
115WRITE_LINE_DEVICE_HANDLER( z80sti_i4_w );
116WRITE_LINE_DEVICE_HANDLER( z80sti_i5_w );
117WRITE_LINE_DEVICE_HANDLER( z80sti_i6_w );
118WRITE_LINE_DEVICE_HANDLER( z80sti_i7_w );
119
120#endif
src/mess/mess.mak
r4945r4946
266266   $(MESSOBJ)/compis.a \
267267   $(MESSOBJ)/comx.a \
268268   $(MESSOBJ)/concept.a \
269   $(MESSOBJ)/conitec.a \
269270   $(MESSOBJ)/cpschngr.a \
270271   $(MESSOBJ)/cybiko.a \
271272   $(MESSOBJ)/dai.a \
r4945r4946
13831384   $(MESS_DRIVERS)/xerox820.o \
13841385   $(MESS_MACHINE)/com8116.o
13851386
1387$(MESSOBJ)/conitec.a: \
1388   $(MESS_DRIVERS)/prof80.o \
1389   $(MESS_MACHINE)/z80sti.o
1390
13861391$(MESSOBJ)/skeleton.a: \
13871392   $(MESS_DRIVERS)/a6809.o \
13881393   $(MESS_DRIVERS)/a5105.o \
r4945r4946
14321437   $(MESS_DRIVERS)/x07.o \
14331438   $(MESS_DRIVERS)/pk8000.o \
14341439   $(MESS_DRIVERS)/unior.o \
1435   $(MESS_DRIVERS)/prof80.o \
14361440   $(MESS_DRIVERS)/tvc.o \
14371441   
14381442#-------------------------------------------------
src/mess/drivers/prof80.c
r4945r4946
1212
1313   TODO:
1414
15   - Z80 STI
15   - Z80 STI (Mostek MK3801) push-model
1616   - PROF-GRIP communications
1717   - UNIO card (Z80-STI, Z80-SIO, 2x centronics)
1818   - GRIP-COLOR (192kB color RAM)
r4945r4946
2828#include "machine/8255ppi.h"
2929#include "machine/nec765.h"
3030#include "machine/upd1990a.h"
31#include "machine/z80sti.h"
3132#include "machine/ctronics.h"
3233
3334/* PROF-80 */
r4945r4946
407408//   AM_RANGE(0x15, 0x15) AM_WRITE(cc2_w)
408409//   AM_RANGE(0x16, 0x16) AM_WRITE(flash_w)
409410//   AM_RANGE(0x17, 0x17) AM_WRITE(vol1_w)
410//   AM_RANGE(0x20, 0x2f) AM_DEVREADWRITE(Z80STI_TAG, z80sti_r, z80sti_w)
411   AM_RANGE(0x20, 0x2f) AM_DEVREADWRITE(Z80STI_TAG, z80sti_r, z80sti_w)
411412   AM_RANGE(0x30, 0x30) AM_READWRITE(lrs_r, lrs_w)
412413   AM_RANGE(0x40, 0x40) AM_READ(grip_status_r)
413414   AM_RANGE(0x50, 0x50) AM_DEVWRITE(MC6845_TAG, mc6845_address_w)
r4945r4946
443444   }
444445}
445446
446static MC6845_ON_VSYNC_CHANGED( grip_vsync_changed )
447static MC6845_ON_DE_CHANGED( grip_on_de_changed )
447448{
448449   prof80_state *state = device->machine->driver_data;
449450
450   state->vsync = vsync;
451   z80sti_i1_w(state->z80sti, display_enabled);
451452}
452453
453454static const mc6845_interface grip_mc6845_interface =
r4945r4946
457458   NULL,
458459   grip_update_row,
459460   NULL,
461   grip_on_de_changed,
460462   NULL,
461463   NULL,
462   grip_vsync_changed
464   NULL
463465};
464466
465467static VIDEO_START( prof80 )
r4945r4946
625627   DEVCB_HANDLER(grip_ppi8255_c_w)      // Port C write
626628};
627629
630/* Z80-STI Interface */
631
632static WRITE_LINE_DEVICE_HANDLER( grip_z80sti_irq_w )
633{
634   cputag_set_input_line(device->machine, "grip", INPUT_LINE_IRQ0, state);
635}
636
637static Z80STI_INTERFACE( grip_z80sti_interface )
638{
639   0,
640   0,
641   DEVCB_NULL,
642   DEVCB_NULL,
643   DEVCB_NULL,
644   DEVCB_NULL,
645   DEVCB_NULL,
646   DEVCB_NULL,
647   DEVCB_NULL,
648   DEVCB_NULL,
649   DEVCB_LINE(grip_z80sti_irq_w)
650};
651
628652/* Machine Initialization */
629653
630654static MACHINE_START( prof80 )
r4945r4946
637661   state->upd1990a = devtag_get_device(machine, UPD1990A_TAG);
638662   state->mc6845 = devtag_get_device(machine, MC6845_TAG);
639663   state->ppi8255 = devtag_get_device(machine, PPI8255_TAG);
664   state->z80sti = devtag_get_device(machine, Z80STI_TAG);
640665   state->centronics = devtag_get_device(machine, "centronics");
641666
642667   /* initialize RTC */
r4945r4946
667692   state_save_register_global_array(machine, state->mmu);
668693   state_save_register_global(machine, state->mme);
669694   state_save_register_global_pointer(machine, state->video_ram, GRIP_VIDEORAM_SIZE);
670   state_save_register_global(machine, state->vsync);
671695   state_save_register_global(machine, state->rtc_data);
672696   state_save_register_global(machine, state->fdc_index);
673697}
r4945r4946
719743   MDRV_UPD1990A_ADD(UPD1990A_TAG, XTAL_32_768kHz, prof80_upd1990a_intf)
720744   MDRV_NEC765A_ADD(NEC765_TAG, prof80_nec765_interface)
721745   MDRV_PPI8255_ADD(PPI8255_TAG, grip_ppi8255_interface)
746   MDRV_Z80STI_ADD(Z80STI_TAG, XTAL_16MHz/4, grip_z80sti_interface)
722747
723748   /* printer */
724749   MDRV_CENTRONICS_ADD("centronics", standard_centronics)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team