Previous 15994 Revisions Next

r4175 Wednesday 21st January, 2009 at 13:14:38 UTC by Dirk Best
[ENTERPRISE] Moved global variables to driver state
[src/mess/drivers]enterp.c

src/mess/drivers/enterp.c
r4174r4175
2626#define ENTERPRISE_XTAL_X1   XTAL_8MHz
2727
2828
29/* state of the wd1770 irq/drq lines */
30static UINT8 exdos_card_value = 0;
29typedef struct _ep_state ep_state;
30struct _ep_state
31{
32   UINT8 exdos_card_value;  /* state of the wd1770 irq/drq lines */
33   UINT8 keyboard_line;     /* index of keyboard line to read */
34};
3135
32/* index of keyboard line to read */
33static int Enterprise_KeyboardLine = 0;
3436
35
3637/***************************************************************************
3738    MEMORY / I/O
3839***************************************************************************/
r4174r4175
100101/* EP specific handling of dave register write */
101102static void enterprise_dave_reg_write(running_machine *machine, offs_t RegIndex, int Data)
102103{
104   ep_state *ep = machine->driver_data;
105
103106   switch (RegIndex)
104107   {
105108   case 0x10:
r4174r4175
110113      break;
111114
112115   case 0x15:
113      Enterprise_KeyboardLine = Data & 15;
116      ep->keyboard_line = Data & 15;
114117      break;
115118   }
116119}
r4174r4175
118121
119122static void enterprise_dave_reg_read(running_machine *machine, offs_t RegIndex)
120123{
121   static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4",
122                              "LINE5", "LINE6", "LINE7", "LINE8", "LINE9" };
124   static const char *const keynames[] =
125   {
126      "LINE0", "LINE1", "LINE2", "LINE3", "LINE4",
127      "LINE5", "LINE6", "LINE7", "LINE8", "LINE9"
128   };
129
130   ep_state *ep = machine->driver_data;
131
123132   switch (RegIndex)
124133   {
125134   case 0x015:
126135      {
127136      /* read keyboard line */
128         Dave_setreg(machine, 0x015, input_port_read(machine, keynames[Enterprise_KeyboardLine]));
137         Dave_setreg(machine, 0x015, input_port_read(machine, keynames[ep->keyboard_line]));
129138      }
130139      break;
131140
r4174r4175
134143      int ExternalJoystickInputs;
135144      int ExternalJoystickPortInput = input_port_read(machine, "JOY1");
136145
137      if (Enterprise_KeyboardLine<=4)
146      if (ep->keyboard_line <= 4)
138147      {
139            ExternalJoystickInputs = ExternalJoystickPortInput>>(4-Enterprise_KeyboardLine);
148            ExternalJoystickInputs = ExternalJoystickPortInput>>(4-(ep->keyboard_line));
140149      }
141150      else
142151      {
r4174r4175
197206
198207static WD17XX_CALLBACK( enterp_wd1770_callback )
199208{
209   ep_state *ep = device->machine->driver_data;
210
200211   switch (state)
201212   {
202   case WD17XX_IRQ_CLR: exdos_card_value &= ~0x02; break;
203   case WD17XX_IRQ_SET: exdos_card_value |= 0x02; break;
204   case WD17XX_DRQ_CLR: exdos_card_value &= ~0x80; break;
205   case WD17XX_DRQ_SET: exdos_card_value |= 0x80; break;
213   case WD17XX_IRQ_CLR: ep->exdos_card_value &= ~0x02; break;
214   case WD17XX_IRQ_SET: ep->exdos_card_value |= 0x02; break;
215   case WD17XX_DRQ_CLR: ep->exdos_card_value &= ~0x80; break;
216   case WD17XX_DRQ_SET: ep->exdos_card_value |= 0x80; break;
206217   }
207218}
208219
r4174r4175
218229*/
219230static READ8_HANDLER( exdos_card_r )
220231{
221   return exdos_card_value;
232   ep_state *ep = space->machine->driver_data;
233   return ep->exdos_card_value;
222234}
223235
224236
r4174r4175
449461   MDRV_CPU_IO_MAP(enterprise_io, 0)
450462
451463   MDRV_MACHINE_RESET(enterprise)
464   MDRV_DRIVER_DATA(ep_state)
452465
453466    /* video hardware */
454467   MDRV_SCREEN_ADD("main", RASTER)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team