Previous 15994 Revisions Next

r3556 Sunday 23rd November, 2008 at 11:34:24 UTC by Curt Coder
[CONKORT] Fixed ABC bus, separate fast/slow states.
[src/mess/machine]abcbus.c abcbus.h conkort.c

src/mess/machine/conkort.c
r3555r3556
8989#include "machine/wd17xx.h"
9090#include "machine/abcbus.h"
9191 
92typedef struct _conkort_t conkort_t;
93struct _conkort_t
92typedef struct _slow_t slow_t;
93struct _slow_t
9494{
9595   int cpunum;                  /* CPU index of the Z80 */
9696 
r3555r3556
9898   UINT8 data;
9999   int pio_ardy;
100100   int fdc_irq;
101 
102   const device_config *z80pio;
101103};
102104 
103INLINE conkort_t *get_safe_token(const device_config *device)
105typedef struct _fast_t fast_t;
106struct _fast_t
104107{
108   int cpunum;                  /* CPU index of the Z80 */
109 
110   UINT8 status;
111   UINT8 data;
112   int fdc_irq;
113 
114   const device_config *z80dma;
115};
116 
117INLINE slow_t *get_safe_token_slow(const device_config *device)
118{
105119   assert(device != NULL);
106120   assert(device->token != NULL);
107121 
108   return (conkort_t *)device->token;
122   return (slow_t *)device->token;
109123}
110124 
125INLINE fast_t *get_safe_token_fast(const device_config *device)
126{
127   assert(device != NULL);
128   assert(device->token != NULL);
129 
130   return (fast_t *)device->token;
131}
132 
111133/* Slow Controller */
112134 
113135static READ8_HANDLER( slow_bus_data_r )
114136{
115137   const device_config *device = devtag_get_device(machine, LUXOR_55_10828, CONKORT_TAG);
116   const device_config *z80pio = devtag_get_device(machine, Z80PIO, CONKORT_Z80PIO_TAG);
138   const device_config *z80pio = devtag_get_device(device->machine, Z80PIO, CONKORT_Z80PIO_TAG);
117139 
118   conkort_t *conkort = get_safe_token(device);
140   slow_t *conkort = get_safe_token_slow(device);
119141 
120142   UINT8 data = 0xff;
121143 
r3555r3556
134156static WRITE8_HANDLER( slow_bus_data_w )
135157{
136158   const device_config *device = devtag_get_device(machine, LUXOR_55_10828, CONKORT_TAG);
137   const device_config *z80pio = devtag_get_device(machine, Z80PIO, CONKORT_Z80PIO_TAG);
159   const device_config *z80pio = devtag_get_device(device->machine, Z80PIO, CONKORT_Z80PIO_TAG);
138160 
139   conkort_t *conkort = get_safe_token(device);
161   slow_t *conkort = get_safe_token_slow(device);
140162 
141163   z80pio_astb_w(z80pio, 0);
142164 
r3555r3556
151173static READ8_HANDLER( slow_bus_stat_r )
152174{
153175   const device_config *device = devtag_get_device(machine, LUXOR_55_10828, CONKORT_TAG);
154   conkort_t *conkort = get_safe_token(device);
176   slow_t *conkort = get_safe_token_slow(device);
155177 
156178   return (conkort->pio_ardy << 7) | conkort->status;
157179}
r3555r3556
208230WRITE8_HANDLER( slow_status_w )
209231{
210232   const device_config *device = devtag_get_device(machine, LUXOR_55_10828, CONKORT_TAG);
211   conkort_t *conkort = get_safe_token(device);
233   slow_t *conkort = get_safe_token_slow(device);
212234 
213235   conkort->status = data & 0x7f;
214236 
r3555r3556
319341   */
320342 
321343   const device_config *conkort_device = devtag_get_device(device->machine, LUXOR_55_10828, CONKORT_TAG);
322   conkort_t *conkort = get_safe_token(conkort_device);
344   slow_t *conkort = get_safe_token_slow(conkort_device);
323345 
324346   return conkort->data;
325347}
r3555r3556
327349static WRITE8_DEVICE_HANDLER( pio_port_a_w )
328350{
329351   const device_config *conkort_device = devtag_get_device(device->machine, LUXOR_55_10828, CONKORT_TAG);
330   conkort_t *conkort = get_safe_token(conkort_device);
352   slow_t *conkort = get_safe_token_slow(conkort_device);
331353 
332354   conkort->data = data;
333355}
r3555r3556
350372   */
351373 
352374   const device_config *conkort_device = devtag_get_device(device->machine, LUXOR_55_10828, CONKORT_TAG);
353   conkort_t *conkort = get_safe_token(conkort_device);
375   slow_t *conkort = get_safe_token_slow(conkort_device);
354376 
355377   return conkort->fdc_irq << 7;
356378}
r3555r3556
377399static Z80PIO_ON_ARDY_CHANGED( pio_ardy_w )
378400{
379401   const device_config *conkort_device = devtag_get_device(device->machine, LUXOR_55_10828, CONKORT_TAG);
380   conkort_t *conkort = get_safe_token(conkort_device);
402   slow_t *conkort = get_safe_token_slow(conkort_device);
381403 
382404   conkort->pio_ardy = state;
383405}
r3555r3556
407429{
408430   UINT8 data;
409431 
410   cpuintrf_push_context(0);
432   cpuintrf_push_context(1);
411433   data = program_read_byte(offset);
412434   cpuintrf_pop_context();
413435 
r3555r3556
416438 
417439static WRITE8_DEVICE_HANDLER( dma_write_byte )
418440{
419   cpuintrf_push_context(0);
441   cpuintrf_push_context(1);
420442   program_write_byte(offset, data);
421443   cpuintrf_pop_context();
422444}
r3555r3556
454476static void slow_wd1791_callback(running_machine *machine, wd17xx_state_t state, void *param)
455477{
456478   const device_config *device = devtag_get_device(machine, LUXOR_55_10828, CONKORT_TAG);
457   conkort_t *conkort = get_safe_token(device);
479   slow_t *conkort = get_safe_token_slow(device);
458480 
459481   switch(state)
460482   {
r3555r3556
549571 
550572static DEVICE_START( luxor_55_10828 )
551573{
552   conkort_t *conkort = device->token;
574   slow_t *conkort = device->token;
553575   char unique_tag[30];
554576   astring *tempstring = astring_alloc();
555577 
r3555r3556
586608 
587609static DEVICE_RESET( luxor_55_10828 )
588610{
611   wd17xx_reset(device->machine);
589612}
590613 
591614DEVICE_GET_INFO( luxor_55_10828 )
r3555r3556
595618      /* --- the following bits of info are returned as 64-bit signed integers --- */
596619      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = 0;                        break;
597620      case DEVINFO_INT_CLASS:                     info->i = DEVICE_CLASS_PERIPHERAL;         break;
598      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(conkort_t);            break;
621      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(slow_t);            break;
599622 
600623      /* --- the following bits of info are returned as pointers --- */
601624      case DEVINFO_PTR_ROM_REGION:               info->romregion = rom_l5510828;            break;
r3555r3556
619642 
620643static DEVICE_START( luxor_55_21046 )
621644{
622   conkort_t *conkort = device->token;
645   fast_t *conkort = device->token;
623646   char unique_tag[30];
624647   astring *tempstring = astring_alloc();
625648 
r3555r3556
656679 
657680static DEVICE_RESET( luxor_55_21046 )
658681{
682   wd17xx_reset(device->machine);
659683}
660684 
661685DEVICE_GET_INFO( luxor_55_21046 )
r3555r3556
665689      /* --- the following bits of info are returned as 64-bit signed integers --- */
666690      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = 0;                        break;
667691      case DEVINFO_INT_CLASS:                     info->i = DEVICE_CLASS_PERIPHERAL;         break;
668      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(conkort_t);            break;
692      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(slow_t);            break;
669693 
670694      /* --- the following bits of info are returned as pointers --- */
671695      case DEVINFO_PTR_ROM_REGION:               info->romregion = rom_l5521046;            break;
src/mess/machine/abcbus.c
r3555r3556
55typedef struct _abcbus_daisy_state abcbus_daisy_state;
66struct _abcbus_daisy_state
77{
8   abcbus_daisy_state *      next;         /* next device */
8   abcbus_daisy_state *   next;         /* next device */
99   const device_config *   device;         /* associated device */
1010   abcbus_card_select      card_select;   /* card select callback */
1111};
1212
13static abcbus_daisy_state *daisy;
13static abcbus_daisy_state *daisy_state;
1414
15void *abcbus_init(running_machine *machine, const char *cputag, const abcbus_daisy_chain *daisy)
15void abcbus_init(running_machine *machine, const char *cputag, const abcbus_daisy_chain *daisy)
1616{
1717   astring *tempstring = astring_alloc();
1818   abcbus_daisy_state *head = NULL;
r3555r3556
2929      (*tailptr)->card_select = (abcbus_card_select)device_get_info_fct((*tailptr)->device, DEVINFO_FCT_CARD_SELECT);
3030      tailptr = &(*tailptr)->next;
3131   }
32   
33   astring_free(tempstring);
3234
33   astring_free(tempstring);
34   return head;
35   daisy_state = head;
3536}
3637
3738WRITE8_HANDLER( abcbus_channel_w )
3839{
40   abcbus_daisy_state *daisy = daisy_state;
41
3942   /* loop over all devices and call their card select function */
40   for ( ; daisy != NULL; daisy = daisy->next)
43   for ( ; daisy != NULL; daisy = daisy_state->next)
4144      (*daisy->card_select)(daisy->device, data);
4245}
4346
4447READ8_HANDLER( abcbus_reset_r )
4548{
49   abcbus_daisy_state *daisy = daisy_state;
50
4651   /* loop over all devices and call their reset function */
4752   for ( ; daisy != NULL; daisy = daisy->next)
4853      device_reset(daisy->device);
src/mess/machine/abcbus.h
r3555r3556
103103/* per-device callback functions */
104104typedef void (*abcbus_card_select)(const device_config *device, UINT8 data);
105105
106/* opaque internal daisy chain state */
107
108106/* daisy chain structure */
109107typedef struct _abcbus_daisy_chain abcbus_daisy_chain;
110108struct _abcbus_daisy_chain
r3555r3556
114112};
115113#define ABCBUS_CONFIG(name) const abcbus_daisy_chain (name)[] =
116114
117void *abcbus_init(running_machine *machine, const char *cputag, const abcbus_daisy_chain *daisy);
115void abcbus_init(running_machine *machine, const char *cputag, const abcbus_daisy_chain *daisy);
118116
119117WRITE8_HANDLER( abcbus_channel_w );
120118READ8_HANDLER( abcbus_reset_r );

Previous 15994 Revisions Next


© 1998-2018 The MESS Team