Previous 15994 Revisions Next

r5203 Friday 10th July, 2009 at 12:45:39 UTC by Curt Coder
[V1050] Added some initial interrupt support, and skeletons for I8214 and MSM58321 devices.
[src/mess]mess.mak
[src/mess/drivers]v1050.c
[src/mess/includes]v1050.h
[src/mess/machine]i8214.c* i8214.h* i8255a.c msm58321.c* msm58321.h*
[src/mess/video]v1050.c

src/mess/video/v1050.c
r5202r5203
77   TODO:
88
99   - row update
10   - vsync interrupt to Z80
1110
1211*/
1312
r5202r5203
7776
7877static WRITE_LINE_DEVICE_HANDLER( v1050_vsync_changed )
7978{
80   //v1050_state *driver_state = device->machine->driver_data;
81
8279   if (state)
8380   {
8481      cputag_set_input_line(device->machine, M6502_TAG, INPUT_LINE_IRQ0, ASSERT_LINE);
82      v1050_set_int(device->machine, INT_VSYNC, 1);
8583   }
86
87   //upb8214_r3_w(driver_state->upb8214, state);
8884}
8985
9086static const mc6845_interface v1050_mc6845_intf =
src/mess/includes/v1050.h
r5202r5203
77#define I8255_RTC_TAG         "u36"
88#define UPB8214_TAG            "u38"
99#define I8251_KB_TAG         "u85"
10#define RTC58321_TAG         "u26"
10#define MSM58321_TAG         "u26"
1111#define I8251_SIO_TAG         "u8"
1212#define I8255_MISC_TAG         "u10"
1313#define MB8877_TAG            "u13"
r5202r5203
2222#define V1050_VIDEORAM_SIZE      0x6000
2323#define V1050_VIDEORAM_MASK      0x5fff
2424
25#define INT_RS_232         0x01
26#define INT_WINCHESTER      0x02
27#define INT_KEYBOARD      0x04
28#define INT_FLOPPY         0x08
29#define INT_VSYNC         0x10
30#define INT_DISPLAY         0x20
31#define INT_EXPANSION_B      0x40
32#define INT_EXPANSION_A      0x80
33
2534typedef struct _v1050_state v1050_state;
2635struct _v1050_state
2736{
2837   /* memory state */
2938   UINT8 bank;
3039   UINT8 int_mask;
40   UINT8 int_state;
41   int rtc_busy;
3142
3243   /* floppy state */
3344   int f_int_enb;
r5202r5203
4051   int ppi8255_m6502_pc;
4152
4253   /* devices */
43   const device_config *upb8214;
54   const device_config *i8214;
55   const device_config *msm58321;
4456   const device_config *i8255a_crt_z80;
4557   const device_config *i8255a_crt_m6502;
4658   const device_config *mb8877;
r5202r5203
4860   const device_config *centronics;
4961};
5062
63/*----------- defined in drivers/v1050.c -----------*/
64
65void v1050_set_int(running_machine *machine, UINT8 mask, int state);
66
5167/*----------- defined in video/v1050.c -----------*/
5268
5369READ8_HANDLER( v1050_attr_r );
src/mess/machine/msm58321.c
r0r5203
1/**********************************************************************
2
3    OKI MSM58321 Real Time Clock emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10/*
11
12   TODO:
13
14   - count
15   - stop
16   - reset
17   - reference registers
18
19*/
20
21#include "driver.h"
22#include "msm58321.h"
23
24/***************************************************************************
25    PARAMETERS
26***************************************************************************/
27
28#define LOG 1
29
30enum
31{
32   REGISTER_S1 = 0,
33   REGISTER_S0,
34   REGISTER_MI1,
35   REGISTER_MI10,
36   REGISTER_H1,
37   REGISTER_H10,
38   REGISTER_W,
39   REGISTER_D1,
40   REGISTER_D10,
41   REGISTER_MO1,
42   REGISTER_MO10,
43   REGISTER_Y1,
44   REGISTER_Y10,
45   REGISTER_RESET,
46   REGISTER_REF0,
47   REGISTER_REF1
48};
49
50/***************************************************************************
51    TYPE DEFINITIONS
52***************************************************************************/
53
54typedef struct _msm58321_t msm58321_t;
55struct _msm58321_t
56{
57   devcb_resolved_write_line   out_busy_func;
58
59   UINT8 reg[13];            /* registers */
60   int busy;               /* busy flag */
61
62   /* timers */
63   emu_timer *busy_timer;
64};
65
66/***************************************************************************
67    INLINE FUNCTIONS
68***************************************************************************/
69
70INLINE msm58321_t *get_safe_token(const device_config *device)
71{
72   assert(device != NULL);
73   assert(device->token != NULL);
74
75   return (msm58321_t *)device->token;
76}
77
78INLINE const msm58321_interface *get_interface(const device_config *device)
79{
80   assert(device != NULL);
81   assert(device->type == MSM58321);
82   return (const msm58321_interface *) device->static_config;
83}
84
85/***************************************************************************
86    IMPLEMENTATION
87***************************************************************************/
88
89READ8_DEVICE_HANDLER( msm58321_r )
90{
91   msm58321_t *msm58321 = get_safe_token(device);
92
93   UINT8 data = 0;
94
95   switch(offset & 0x0f)
96   {
97   case REGISTER_RESET:
98      break;
99
100   case REGISTER_REF0:
101   case REGISTER_REF1:
102      break;
103
104   default:
105      data = msm58321->reg[offset];
106      break;
107   }
108
109   return data;
110}
111
112WRITE8_DEVICE_HANDLER( msm58321_w )
113{
114   msm58321_t *msm58321 = get_safe_token(device);
115
116   switch(offset & 0x0f)
117   {
118   case REGISTER_RESET:
119      if (LOG) logerror("MSM58321 '%s' Reset\n", device->tag);
120      break;
121
122   case REGISTER_REF0:
123   case REGISTER_REF1:
124      if (LOG) logerror("MSM58321 '%s' Reference Signal\n", device->tag);
125      break;
126
127   default:
128      if (LOG) logerror("MSM58321 '%s' Register %01x = %01x\n", device->tag, offset, data & 0x0f);
129      msm58321->reg[offset] = data & 0x0f;
130      break;
131   }
132}
133
134WRITE_LINE_DEVICE_HANDLER( msm58321_stop_w )
135{
136//   msm58321_t *msm58321 = get_safe_token(device);
137
138   if (LOG) logerror("MSM58321 '%s' STOP: %u\n", device->tag, state);
139}
140
141WRITE_LINE_DEVICE_HANDLER( msm58321_test_w )
142{
143//   msm58321_t *msm58321 = get_safe_token(device);
144
145   if (LOG) logerror("MSM58321 '%s' TEST: %u\n", device->tag, state);
146}
147
148/*-------------------------------------------------
149    TIMER_CALLBACK( busy_tick )
150-------------------------------------------------*/
151
152static TIMER_CALLBACK( busy_tick )
153{
154   const device_config *device = ptr;
155   msm58321_t *msm58321 = get_safe_token(device);
156
157   devcb_call_write_line(&msm58321->out_busy_func, msm58321->busy);
158
159   msm58321->busy = !msm58321->busy;
160}
161
162/*-------------------------------------------------
163    DEVICE_START( msm58321 )
164-------------------------------------------------*/
165
166static DEVICE_START( msm58321 )
167{
168   msm58321_t *msm58321 = get_safe_token(device);
169   const msm58321_interface *intf = get_interface(device);
170
171   /* resolve callbacks */
172   devcb_resolve_write_line(&msm58321->out_busy_func, &intf->out_busy_func, device);
173
174   /* create busy timer */
175   msm58321->busy_timer = timer_alloc(device->machine, busy_tick, (void *)device);
176   timer_adjust_periodic(msm58321->busy_timer, attotime_zero, 0, ATTOTIME_IN_HZ(2));
177
178   /* register for state saving */
179//   state_save_register_device_item(device, 0, msm58321->);
180}
181
182/*-------------------------------------------------
183    DEVICE_GET_INFO( msm58321 )
184-------------------------------------------------*/
185
186DEVICE_GET_INFO( msm58321 )
187{
188   switch (state)
189   {
190      /* --- the following bits of info are returned as 64-bit signed integers --- */
191      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(msm58321_t);            break;
192      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = 0;                        break;
193      case DEVINFO_INT_CLASS:                     info->i = DEVICE_CLASS_PERIPHERAL;         break;
194
195      /* --- the following bits of info are returned as pointers to data or functions --- */
196      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(msm58321);   break;
197      case DEVINFO_FCT_STOP:                     /* Nothing */                        break;
198      case DEVINFO_FCT_RESET:                     /* Nothing */                        break;
199
200      /* --- the following bits of info are returned as NULL-terminated strings --- */
201      case DEVINFO_STR_NAME:                     strcpy(info->s, "OKI MSM58321");         break;
202      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "OKI MSM58321");         break;
203      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                  break;
204      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);               break;
205      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright MESS Team");      break;
206   }
207}
src/mess/machine/msm58321.h
r0r5203
1/**********************************************************************
2
3    OKI MSM58321 Real Time Clock/Calendar emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************
9                     _____   _____
10               CS2    1 |*    \_/     | 16  Vdd
11             WRITE    2 |          | 15  XT
12              READ    3 |          | 14  _XT
13               D0    4 |   MSM58321    | 13  CS1
14               D1    5 |          | 12  TEST
15               D2    6 |          | 11  STOP
16               D3    7 |          | 10  _BUSY
17               GND   8 |_____________| 9   ADDRESS WRITE
18
19**********************************************************************/
20
21#ifndef __MSM58321__
22#define __MSM58321__
23
24#include "devcb.h"
25
26/***************************************************************************
27    MACROS / CONSTANTS
28***************************************************************************/
29
30#define MSM58321      DEVICE_GET_INFO_NAME(msm58321)
31
32#define MDRV_MSM58321_ADD(_tag, _clock, _intrf) \
33   MDRV_DEVICE_ADD(_tag, MSM58321, _clock) \
34   MDRV_DEVICE_CONFIG(_intrf)
35
36#define MSM58321_INTERFACE(name) \
37   const msm58321_interface (name)=
38
39/***************************************************************************
40    TYPE DEFINITIONS
41***************************************************************************/
42
43typedef struct _msm58321_interface msm58321_interface;
44struct _msm58321_interface
45{
46   devcb_write_line   out_busy_func;
47};
48
49/***************************************************************************
50    PROTOTYPES
51***************************************************************************/
52
53/* device interface */
54DEVICE_GET_INFO( msm58321 );
55
56/* register access */
57READ8_DEVICE_HANDLER( msm58321_a_r );
58WRITE8_DEVICE_HANDLER( msm58321_b_w );
59
60/* stop */
61WRITE_LINE_DEVICE_HANDLER( msm58321_stop_w );
62
63/* test */
64WRITE_LINE_DEVICE_HANDLER( msm58321_test_w );
65
66#endif
src/mess/machine/i8214.c
r0r5203
1/**********************************************************************
2
3    Intel 8214 Priority Interrupt Controller emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10/*
11
12   TODO:
13
14   - cascading
15
16*/
17
18#include "driver.h"
19#include "i8214.h"
20
21/***************************************************************************
22    PARAMETERS
23***************************************************************************/
24
25#define LOG 0
26
27/***************************************************************************
28    TYPE DEFINITIONS
29***************************************************************************/
30
31typedef struct _i8214_t i8214_t;
32struct _i8214_t
33{
34   devcb_resolved_write_line   out_int_func;
35   devcb_resolved_write_line   out_enlg_func;
36
37   int inte;               /* interrupt enable */
38   int int_dis;            /* interrupt disable flip-flop */
39   int latch;               /* interrupt latch */
40   int a;                  /* request level */
41   int b;                  /* current status register */
42   UINT8 r;               /* interrupt requests */
43   int sgs;               /* status group select */
44   int etlg;               /* enable this level group */
45};
46
47/***************************************************************************
48    INLINE FUNCTIONS
49***************************************************************************/
50
51INLINE i8214_t *get_safe_token(const device_config *device)
52{
53   assert(device != NULL);
54   assert(device->token != NULL);
55
56   return (i8214_t *)device->token;
57}
58
59INLINE const i8214_interface *get_interface(const device_config *device)
60{
61   assert(device != NULL);
62   assert((device->type == I8214));
63   return (const i8214_interface *) device->static_config;
64}
65
66INLINE void trigger_interrupt(i8214_t *i8214)
67{
68   devcb_call_write_line(&i8214->out_int_func, ASSERT_LINE);
69   devcb_call_write_line(&i8214->out_int_func, CLEAR_LINE);
70}
71
72INLINE void check_interrupt(const device_config *device)
73{
74   i8214_t *i8214 = get_safe_token(device);
75   int level;
76
77   if (i8214->int_dis) return;
78
79   for (level = 7; level >= 0; level--)
80   {
81      if (!BIT(i8214->r, level))
82      {
83         /* latch interrupt level */
84         i8214->latch = level;
85
86         if (i8214->sgs)
87         {
88            if (level > i8214->b)
89            {
90               if (LOG) logerror("I8214 '%s' Interrupt Level %u\n", device->tag, level);
91               i8214->a = level;
92               trigger_interrupt(i8214);
93            }
94         }
95         else
96         {
97            if (LOG) logerror("I8214 '%s' Interrupt Level %u\n", device->tag, level);
98            i8214->a = level;
99            trigger_interrupt(i8214);
100         }
101      }
102   }
103}
104
105/***************************************************************************
106    IMPLEMENTATION
107***************************************************************************/
108
109READ8_DEVICE_HANDLER( i8214_a_r )
110{
111   i8214_t *i8214 = get_safe_token(device);
112
113   UINT8 a = ~i8214->a & 0x07;
114
115   i8214->int_dis = 0;
116   check_interrupt(device);
117
118   if (LOG) logerror("I8214 '%s' A: %01x\n", device->tag, a);
119
120   return a;
121}
122
123WRITE8_DEVICE_HANDLER( i8214_b_w )
124{
125   i8214_t *i8214 = get_safe_token(device);
126
127   i8214->b = ~data & 0x07;
128
129   if (LOG) logerror("I8214 '%s' B: %01x\n", device->tag, i8214->b);
130
131   check_interrupt(device);
132}
133
134WRITE_LINE_DEVICE_HANDLER( i8214_elr_w )
135{
136   i8214_t *i8214 = get_safe_token(device);
137
138   if (LOG) logerror("I8214 '%s' ELR: %u\n", device->tag, state);
139
140   if (state)
141   {
142      i8214->a = 0;
143      i8214->b = 0;
144      i8214->sgs = 0;
145
146      check_interrupt(device);
147   }
148}
149
150WRITE_LINE_DEVICE_HANDLER( i8214_etlg_w )
151{
152   i8214_t *i8214 = get_safe_token(device);
153
154   if (LOG) logerror("I8214 '%s' ETLG: %u\n", device->tag, state);
155
156   i8214->etlg = state;
157}
158
159WRITE_LINE_DEVICE_HANDLER( i8214_sgs_w )
160{
161   i8214_t *i8214 = get_safe_token(device);
162
163   if (LOG) logerror("I8214 '%s' SGS: %u\n", device->tag, state);
164
165   i8214->sgs = state;
166
167   check_interrupt(device);
168}
169
170WRITE_LINE_DEVICE_HANDLER( i8214_inte_w )
171{
172   i8214_t *i8214 = get_safe_token(device);
173
174   if (LOG) logerror("I8214 '%s' INTE: %u\n", device->tag, state);
175
176   i8214->inte = state;
177}
178
179WRITE8_DEVICE_HANDLER( i8214_r_w )
180{
181   i8214_t *i8214 = get_safe_token(device);
182
183   if (LOG) logerror("I8214 '%s' R: %02x\n", device->tag, data);
184
185   i8214->r = data;
186
187   check_interrupt(device);
188}
189
190/*-------------------------------------------------
191    DEVICE_START( i8214 )
192-------------------------------------------------*/
193
194static DEVICE_START( i8214 )
195{
196   i8214_t *i8214 = get_safe_token(device);
197   const i8214_interface *intf = get_interface(device);
198
199   /* resolve callbacks */
200   devcb_resolve_write_line(&i8214->out_int_func, &intf->out_int_func, device);
201   devcb_resolve_write_line(&i8214->out_enlg_func, &intf->out_enlg_func, device);
202
203   /* register for state saving */
204   state_save_register_device_item(device, 0, i8214->inte);
205   state_save_register_device_item(device, 0, i8214->int_dis);
206   state_save_register_device_item(device, 0, i8214->latch);
207   state_save_register_device_item(device, 0, i8214->a);
208   state_save_register_device_item(device, 0, i8214->b);
209   state_save_register_device_item(device, 0, i8214->r);
210   state_save_register_device_item(device, 0, i8214->sgs);
211   state_save_register_device_item(device, 0, i8214->etlg);
212}
213
214/*-------------------------------------------------
215    DEVICE_GET_INFO( i8214 )
216-------------------------------------------------*/
217
218DEVICE_GET_INFO( i8214 )
219{
220   switch (state)
221   {
222      /* --- the following bits of info are returned as 64-bit signed integers --- */
223      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(i8214_t);               break;
224      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = 0;                        break;
225      case DEVINFO_INT_CLASS:                     info->i = DEVICE_CLASS_PERIPHERAL;         break;
226
227      /* --- the following bits of info are returned as pointers to data or functions --- */
228      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(i8214);      break;
229      case DEVINFO_FCT_STOP:                     /* Nothing */                        break;
230      case DEVINFO_FCT_RESET:                     /* Nothing */                        break;
231
232      /* --- the following bits of info are returned as NULL-terminated strings --- */
233      case DEVINFO_STR_NAME:                     strcpy(info->s, "Intel 8214");            break;
234      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Intel 8080");            break;
235      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                  break;
236      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);               break;
237      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright MESS Team");      break;
238   }
239}
src/mess/machine/i8214.h
r0r5203
1/**********************************************************************
2
3    Intel 8214 Priority Interrupt Controller emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************
9                     _____   _____
10               _B0    1 |*    \_/     | 24  Vcc
11               _B1    2 |          | 23  _ECS
12               _B2    3 |          | 22  _R7
13              _SGS    4 |          | 21  _R6
14              _INT    5 |          | 20  _R5
15              _CLK    6 |   8214    | 19  _R4
16              INTE    7 |          | 18  _R3
17               _A0    8 |          | 17  _R2
18               _A1    9 |          | 16  _R1
19               _A2   10 |          | 15  _R0
20              _ELR   11 |          | 14  ENLG
21               GND  12 |_____________| 13  ETLG
22
23**********************************************************************/
24
25#ifndef __I8214__
26#define __I8214__
27
28#include "devcb.h"
29
30/***************************************************************************
31    MACROS / CONSTANTS
32***************************************************************************/
33
34#define I8214      DEVICE_GET_INFO_NAME(i8214)
35
36#define MDRV_I8214_ADD(_tag, _clock, _intrf) \
37   MDRV_DEVICE_ADD(_tag, I8214, _clock) \
38   MDRV_DEVICE_CONFIG(_intrf)
39
40#define I8214_INTERFACE(name) \
41   const i8214_interface (name)=
42
43/***************************************************************************
44    TYPE DEFINITIONS
45***************************************************************************/
46
47typedef struct _i8214_interface i8214_interface;
48struct _i8214_interface
49{
50   devcb_write_line   out_int_func;
51   devcb_write_line   out_enlg_func;
52};
53
54/***************************************************************************
55    PROTOTYPES
56***************************************************************************/
57
58/* device interface */
59DEVICE_GET_INFO( i8214 );
60
61/* register access */
62READ8_DEVICE_HANDLER( i8214_a_r );
63WRITE8_DEVICE_HANDLER( i8214_b_w );
64
65/* enable level read */
66WRITE_LINE_DEVICE_HANDLER( i8214_elr_w );
67
68/* enable this level group */
69WRITE_LINE_DEVICE_HANDLER( i8214_etlg_w );
70
71/* status group select */
72WRITE_LINE_DEVICE_HANDLER( i8214_sgs_w );
73
74/* interrupt enable */
75WRITE_LINE_DEVICE_HANDLER( i8214_inte_w );
76
77/* interrupt requests */
78WRITE8_DEVICE_HANDLER( i8214_r_w );
79
80#endif
src/mess/machine/i8255a.c
r5202r5203
850850
851851      /* --- the following bits of info are returned as NULL-terminated strings --- */
852852      case DEVINFO_STR_NAME:                     strcpy(info->s, "Intel 8255A");            break;
853      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Intel 8085");            break;
853      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Intel 8080");            break;
854854      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                  break;
855855      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);               break;
856856      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright MESS Team");      break;
src/mess/mess.mak
r5202r5203
425425   $(MESS_MACHINE)/e0516.o      \
426426   $(MESS_MACHINE)/hd63450.o   \
427427   $(MESS_MACHINE)/i8155.o      \
428   $(MESS_MACHINE)/i8214.o      \
428429   $(MESS_MACHINE)/i82439tx.o   \
429430   $(MESS_MACHINE)/i8271.o      \
430431   $(MESS_MACHINE)/ins8154.o   \
r5202r5203
436437   $(MESS_MACHINE)/mc6854.o   \
437438   $(MESS_MACHINE)/mm58274c.o   \
438439   $(MESS_MACHINE)/mpc105.o   \
440   $(MESS_MACHINE)/msm58321.o   \
439441   $(MESS_MACHINE)/msm8251.o   \
440442   $(MESS_MACHINE)/nec765.o   \
441443   $(MESS_MACHINE)/ncr5380.o   \
src/mess/drivers/v1050.c
r5202r5203
1111   TODO:
1212
1313   - video
14   - µPB8214 chip
14   - interrupts
15   - keyboard
1516   - RTC58321 chip
16   - keyboard
1717   - winchester
1818
1919*/
r5202r5203
2525#include "cpu/mcs48/mcs48.h"
2626#include "devices/basicdsk.h"
2727#include "machine/ctronics.h"
28#include "machine/i8214.h"
2829#include "machine/i8255a.h"
30#include "machine/msm58321.h"
2931#include "machine/msm8251.h"
3032#include "machine/wd17xx.h"
3133#include "video/mc6845.h"
r5202r5203
3537   return image_from_devtype_and_index(machine, IO_FLOPPY, drive);
3638}
3739
40void v1050_set_int(running_machine *machine, UINT8 mask, int state)
41{
42   v1050_state *driver_state = machine->driver_data;
43
44   if (state)
45   {
46      driver_state->int_state |= mask;
47   }
48   else
49   {
50      driver_state->int_state &= ~mask;
51   }
52
53   i8214_r_w(driver_state->i8214, 0, ~(driver_state->int_state & driver_state->int_mask));
54}
55
3856static void v1050_bankswitch(running_machine *machine)
3957{
4058   v1050_state *state = machine->driver_data;
r5202r5203
7290
7391/* Read/Write Handlers */
7492
93static READ8_HANDLER( v1050_i8214_r )
94{
95   v1050_state *state = space->machine->driver_data;
96
97   return i8214_a_r(state->i8214, 0) << 1;
98}
99
100static WRITE8_HANDLER( v1050_i8214_w )
101{
102   v1050_state *state = space->machine->driver_data;
103
104   i8214_b_w(state->i8214, 0, (data >> 1) & 0x07);
105   i8214_sgs_w(state->i8214, BIT(data, 4));
106}
107
108static READ8_HANDLER( vint_clr_r )
109{
110   v1050_set_int(space->machine, INT_VSYNC, 0);
111
112   return 0xff;
113}
114
115static WRITE8_HANDLER( vint_clr_w )
116{
117   v1050_set_int(space->machine, INT_VSYNC, 0);
118}
119
120static READ8_HANDLER( dint_clr_r )
121{
122   v1050_set_int(space->machine, INT_DISPLAY, 0);
123
124   return 0xff;
125}
126
127static WRITE8_HANDLER( dint_clr_w )
128{
129   v1050_set_int(space->machine, INT_DISPLAY, 0);
130}
131
75132static WRITE8_HANDLER( dvint_clr_w )
76133{
77134   cputag_set_input_line(space->machine, M6502_TAG, INPUT_LINE_IRQ0, CLEAR_LINE);
78135}
79136
137static WRITE8_HANDLER( dint_w )
138{
139   v1050_set_int(space->machine, INT_DISPLAY, 1);
140}
141
80142static WRITE8_HANDLER( bank_w )
81143{
82144   v1050_state *state = space->machine->driver_data;
r5202r5203
108170   AM_RANGE(0x90, 0x93) AM_DEVREADWRITE(I8255_MISC_TAG, i8255a_r, i8255a_w)
109171   AM_RANGE(0x94, 0x97) AM_DEVREADWRITE(MB8877_TAG, wd17xx_r, wd17xx_w)
110172   AM_RANGE(0x9c, 0x9f) AM_DEVREADWRITE(I8255_RTC_TAG, i8255a_r, i8255a_w)
111//   AM_RANGE(0xa0, 0xa0) AM_READWRITE(vint_clr_r, vint_clr_w)
112//   AM_RANGE(0xb0, 0xb0) AM_READWRITE(dint_clr_r, dint_clr_w)
113//   AM_RANGE(0xc0, 0xc0) AM_DEVREADWRITE(UPB8214_TAG, pic8214_r, pic8214_w)
173   AM_RANGE(0xa0, 0xa0) AM_READWRITE(vint_clr_r, vint_clr_w)
174   AM_RANGE(0xb0, 0xb0) AM_READWRITE(dint_clr_r, dint_clr_w)
175   AM_RANGE(0xc0, 0xc0) AM_READWRITE(v1050_i8214_r, v1050_i8214_w)
114176   AM_RANGE(0xd0, 0xd0) AM_WRITE(bank_w)
115177//   AM_RANGE(0xe0, 0xe1) AM_READWRITE(sasi_r, sasi_w)
116178ADDRESS_MAP_END
r5202r5203
122184   AM_RANGE(0x8001, 0x8001) AM_DEVREADWRITE(HD6845_TAG, mc6845_register_r, mc6845_register_w)
123185   AM_RANGE(0x9000, 0x9003) AM_DEVREADWRITE(I8255_M6502_TAG, i8255a_r, i8255a_w)
124186   AM_RANGE(0xa000, 0xa000) AM_READWRITE(v1050_attr_r, v1050_attr_w)
125//   AM_RANGE(0xb000, 0xb000) AM_WRITE(z80int_w)
187   AM_RANGE(0xb000, 0xb000) AM_WRITE(dint_w)
126188   AM_RANGE(0xc000, 0xc000) AM_WRITE(dvint_clr_w)
127189   AM_RANGE(0xe000, 0xffff) AM_ROM
128190ADDRESS_MAP_END
r5202r5203
257319   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD )
258320INPUT_PORTS_END
259321
322/* 8214 Interface */
323
324static WRITE_LINE_DEVICE_HANDLER( v1050_8214_int_w )
325{
326   if (state)
327   {
328      cputag_set_input_line(device->machine, Z80_TAG, INPUT_LINE_IRQ0, ASSERT_LINE);
329   }
330}
331
332static I8214_INTERFACE( v1050_8214_intf )
333{
334   DEVCB_LINE(v1050_8214_int_w),
335   DEVCB_NULL
336};
337
338/* MSM58321 Interface */
339
340static WRITE_LINE_DEVICE_HANDLER( msm58321_busy_w )
341{
342   v1050_state *driver_state = device->machine->driver_data;
343
344   driver_state->rtc_busy = state;
345}
346
347static MSM58321_INTERFACE( msm58321_intf )
348{
349   DEVCB_LINE(msm58321_busy_w)
350};
351
260352/* Display 8255A Interface */
261353
262354static WRITE8_DEVICE_HANDLER( crt_z80_ppi8255_c_w )
r5202r5203
402494
403495/* Real Time Clock 8255A Interface */
404496
497static READ8_DEVICE_HANDLER( rtc_8255_a_r )
498{
499   /*
500
501        bit      signal      description
502
503      PA0     D0         RTC data bit 0
504        PA1     D1         RTC data bit 1
505        PA2     D2         RTC data bit 2
506        PA3      D3         RTC data bit 3
507        PA4               
508        PA5               
509        PA6               
510        PA7               
511   
512   */
513
514   logerror("RTC data read\n");
515
516   return 0;
517}
518
519static WRITE8_DEVICE_HANDLER( rtc_8255_a_w )
520{
521   /*
522
523        bit      signal      description
524
525      PA0     D0         RTC data bit 0
526        PA1     D1         RTC data bit 1
527        PA2     D2         RTC data bit 2
528        PA3      D3         RTC data bit 3
529        PA4               
530        PA5               
531        PA6               
532        PA7               
533   
534   */
535
536   logerror("RTC data write %01x\n", data & 0x0f);
537}
538
405539static WRITE8_DEVICE_HANDLER( rtc_8255_b_w )
406540{
407541   /*
r5202r5203
422556   v1050_state *state = device->machine->driver_data;
423557
424558   state->int_mask = data;
559
560   logerror("Interrupt Mask: %02x\n", data);
425561}
426562
427563static READ8_DEVICE_HANDLER( rtc_8255_c_r )
r5202r5203
441577   
442578   */
443579
444   return 0xff;
580   v1050_state *state = device->machine->driver_data;
581
582   return state->rtc_busy << 3;
445583}
446584
447585static WRITE8_DEVICE_HANDLER( rtc_8255_c_w )
r5202r5203
460598        PC7               clock device select
461599   
462600   */
601
602//   v1050_state *state = device->machine->driver_data;
603   logerror("Clock Address Write: %u\n", BIT(data, 4));
604   logerror("Clock Data Write: %u\n", BIT(data, 5));
605   logerror("Clock Data Read: %u\n", BIT(data, 6));
606   logerror("Clock Device Select: %u\n", BIT(data, 7));
463607}
464608
465609static I8255A_INTERFACE( rtc_8255_intf )
466610{
467   DEVCB_NULL,                     // Port A read (RTC data)
611   DEVCB_HANDLER(rtc_8255_a_r),      // Port A read
468612   DEVCB_NULL,                     // Port B read
469613   DEVCB_HANDLER(rtc_8255_c_r),      // Port C read
470   DEVCB_NULL,                     // Port A write (RTC data)
614   DEVCB_HANDLER(rtc_8255_a_w),      // Port A read
471615   DEVCB_HANDLER(rtc_8255_b_w),      // Port B write
472616   DEVCB_HANDLER(rtc_8255_c_w)         // Port C write
473617};
r5202r5203
476620
477621static WD17XX_CALLBACK( v1050_mb8877_callback )
478622{
479//   v1050_state *driver_state = device->machine->driver_data;
480
481623   switch (state)
482624   {
483625   case WD17XX_IRQ_CLR:
484//      if (driver_state->f_int_enb) upb8214_r2_w(driver_state->upb8214, 0);
626      v1050_set_int(device->machine, INT_FLOPPY, 0);
485627      break;
486628
487629   case WD17XX_IRQ_SET:
488//      if (driver_state->f_int_enb) upb8214_r2_w(driver_state->upb8214, 1);
630      v1050_set_int(device->machine, INT_FLOPPY, 1);
489631      break;
490632
491633   case WD17XX_DRQ_CLR:
r5202r5203
511653   const address_space *program = cputag_get_address_space(machine, Z80_TAG, ADDRESS_SPACE_PROGRAM);
512654
513655   /* find devices */
514   state->upb8214 = devtag_get_device(machine, UPB8214_TAG);
656   state->i8214 = devtag_get_device(machine, UPB8214_TAG);
657   state->msm58321 = devtag_get_device(machine, MSM58321_TAG);
515658   state->i8255a_crt_z80 = devtag_get_device(machine, I8255_DISP_TAG);
516659   state->i8255a_crt_m6502 = devtag_get_device(machine, I8255_M6502_TAG);
517660   state->mb8877 = devtag_get_device(machine, MB8877_TAG);
518661   state->centronics = devtag_get_device(machine, CENTRONICS_TAG);
519662
663   /* initialize I8214 */
664   i8214_etlg_w(state->i8214, 1);
665   i8214_inte_w(state->i8214, 1);
666
520667   /* setup memory banking */
521668   memory_configure_bank(machine, 1, 0, 2, mess_ram, 0x10000);
522669   memory_configure_bank(machine, 1, 2, 1, mess_ram + 0x1c000, 0);
r5202r5203
563710   MDRV_IMPORT_FROM(v1050_video)
564711
565712   /* devices */
566   MDRV_I8255A_ADD(I8255_DISP_TAG, disp_8255_intf)
713   MDRV_I8214_ADD(UPB8214_TAG, XTAL_16MHz/4, v1050_8214_intf) // NEC µPB8214C
714   MDRV_MSM58321_ADD(MSM58321_TAG, XTAL_32_768kHz, msm58321_intf) // OKI MSM58321RS
715   MDRV_I8255A_ADD(I8255_DISP_TAG, disp_8255_intf) // NEC D8255AC-5
567716   MDRV_I8255A_ADD(I8255_MISC_TAG, misc_8255_intf)
568717   MDRV_I8255A_ADD(I8255_RTC_TAG, rtc_8255_intf)
569718   MDRV_WD1793_ADD(MB8877_TAG, v1050_wd17xx_intf )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team