src/mess/machine/conkort.c
| r3555 | r3556 | |
| 89 | 89 | #include "machine/wd17xx.h"
|
| 90 | 90 | #include "machine/abcbus.h"
|
| 91 | 91 | |
| 92 | | typedef struct _conkort_t conkort_t;
|
| 93 | | struct _conkort_t
|
| 92 | typedef struct _slow_t slow_t;
|
| 93 | struct _slow_t
|
| 94 | 94 | {
|
| 95 | 95 | int cpunum; /* CPU index of the Z80 */
|
| 96 | 96 | |
| r3555 | r3556 | |
| 98 | 98 | UINT8 data;
|
| 99 | 99 | int pio_ardy;
|
| 100 | 100 | int fdc_irq;
|
| 101 | |
| 102 | const device_config *z80pio;
|
| 101 | 103 | };
|
| 102 | 104 | |
| 103 | | INLINE conkort_t *get_safe_token(const device_config *device)
|
| 105 | typedef struct _fast_t fast_t;
|
| 106 | struct _fast_t
|
| 104 | 107 | {
|
| 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 | |
| 117 | INLINE slow_t *get_safe_token_slow(const device_config *device)
|
| 118 | {
|
| 105 | 119 | assert(device != NULL);
|
| 106 | 120 | assert(device->token != NULL);
|
| 107 | 121 | |
| 108 | | return (conkort_t *)device->token;
|
| 122 | return (slow_t *)device->token;
|
| 109 | 123 | }
|
| 110 | 124 | |
| 125 | INLINE 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 | |
| 111 | 133 | /* Slow Controller */
|
| 112 | 134 | |
| 113 | 135 | static READ8_HANDLER( slow_bus_data_r )
|
| 114 | 136 | {
|
| 115 | 137 | 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);
|
| 117 | 139 | |
| 118 | | conkort_t *conkort = get_safe_token(device);
|
| 140 | slow_t *conkort = get_safe_token_slow(device);
|
| 119 | 141 | |
| 120 | 142 | UINT8 data = 0xff;
|
| 121 | 143 | |
| r3555 | r3556 | |
| 134 | 156 | static WRITE8_HANDLER( slow_bus_data_w )
|
| 135 | 157 | {
|
| 136 | 158 | 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);
|
| 138 | 160 | |
| 139 | | conkort_t *conkort = get_safe_token(device);
|
| 161 | slow_t *conkort = get_safe_token_slow(device);
|
| 140 | 162 | |
| 141 | 163 | z80pio_astb_w(z80pio, 0);
|
| 142 | 164 | |
| r3555 | r3556 | |
| 151 | 173 | static READ8_HANDLER( slow_bus_stat_r )
|
| 152 | 174 | {
|
| 153 | 175 | 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);
|
| 155 | 177 | |
| 156 | 178 | return (conkort->pio_ardy << 7) | conkort->status;
|
| 157 | 179 | }
|
| r3555 | r3556 | |
| 208 | 230 | WRITE8_HANDLER( slow_status_w )
|
| 209 | 231 | {
|
| 210 | 232 | 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);
|
| 212 | 234 | |
| 213 | 235 | conkort->status = data & 0x7f;
|
| 214 | 236 | |
| r3555 | r3556 | |
| 319 | 341 | */
|
| 320 | 342 | |
| 321 | 343 | 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);
|
| 323 | 345 | |
| 324 | 346 | return conkort->data;
|
| 325 | 347 | }
|
| r3555 | r3556 | |
| 327 | 349 | static WRITE8_DEVICE_HANDLER( pio_port_a_w )
|
| 328 | 350 | {
|
| 329 | 351 | 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);
|
| 331 | 353 | |
| 332 | 354 | conkort->data = data;
|
| 333 | 355 | }
|
| r3555 | r3556 | |
| 350 | 372 | */
|
| 351 | 373 | |
| 352 | 374 | 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);
|
| 354 | 376 | |
| 355 | 377 | return conkort->fdc_irq << 7;
|
| 356 | 378 | }
|
| r3555 | r3556 | |
| 377 | 399 | static Z80PIO_ON_ARDY_CHANGED( pio_ardy_w )
|
| 378 | 400 | {
|
| 379 | 401 | 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);
|
| 381 | 403 | |
| 382 | 404 | conkort->pio_ardy = state;
|
| 383 | 405 | }
|
| r3555 | r3556 | |
| 407 | 429 | {
|
| 408 | 430 | UINT8 data;
|
| 409 | 431 | |
| 410 | | cpuintrf_push_context(0);
|
| 432 | cpuintrf_push_context(1);
|
| 411 | 433 | data = program_read_byte(offset);
|
| 412 | 434 | cpuintrf_pop_context();
|
| 413 | 435 | |
| r3555 | r3556 | |
| 416 | 438 | |
| 417 | 439 | static WRITE8_DEVICE_HANDLER( dma_write_byte )
|
| 418 | 440 | {
|
| 419 | | cpuintrf_push_context(0);
|
| 441 | cpuintrf_push_context(1);
|
| 420 | 442 | program_write_byte(offset, data);
|
| 421 | 443 | cpuintrf_pop_context();
|
| 422 | 444 | }
|
| r3555 | r3556 | |
| 454 | 476 | static void slow_wd1791_callback(running_machine *machine, wd17xx_state_t state, void *param)
|
| 455 | 477 | {
|
| 456 | 478 | 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);
|
| 458 | 480 | |
| 459 | 481 | switch(state)
|
| 460 | 482 | {
|
| r3555 | r3556 | |
| 549 | 571 | |
| 550 | 572 | static DEVICE_START( luxor_55_10828 )
|
| 551 | 573 | {
|
| 552 | | conkort_t *conkort = device->token;
|
| 574 | slow_t *conkort = device->token;
|
| 553 | 575 | char unique_tag[30];
|
| 554 | 576 | astring *tempstring = astring_alloc();
|
| 555 | 577 | |
| r3555 | r3556 | |
| 586 | 608 | |
| 587 | 609 | static DEVICE_RESET( luxor_55_10828 )
|
| 588 | 610 | {
|
| 611 | wd17xx_reset(device->machine);
|
| 589 | 612 | }
|
| 590 | 613 | |
| 591 | 614 | DEVICE_GET_INFO( luxor_55_10828 )
|
| r3555 | r3556 | |
| 595 | 618 | /* --- the following bits of info are returned as 64-bit signed integers --- */
|
| 596 | 619 | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break;
|
| 597 | 620 | 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;
|
| 599 | 622 | |
| 600 | 623 | /* --- the following bits of info are returned as pointers --- */
|
| 601 | 624 | case DEVINFO_PTR_ROM_REGION: info->romregion = rom_l5510828; break;
|
| r3555 | r3556 | |
| 619 | 642 | |
| 620 | 643 | static DEVICE_START( luxor_55_21046 )
|
| 621 | 644 | {
|
| 622 | | conkort_t *conkort = device->token;
|
| 645 | fast_t *conkort = device->token;
|
| 623 | 646 | char unique_tag[30];
|
| 624 | 647 | astring *tempstring = astring_alloc();
|
| 625 | 648 | |
| r3555 | r3556 | |
| 656 | 679 | |
| 657 | 680 | static DEVICE_RESET( luxor_55_21046 )
|
| 658 | 681 | {
|
| 682 | wd17xx_reset(device->machine);
|
| 659 | 683 | }
|
| 660 | 684 | |
| 661 | 685 | DEVICE_GET_INFO( luxor_55_21046 )
|
| r3555 | r3556 | |
| 665 | 689 | /* --- the following bits of info are returned as 64-bit signed integers --- */
|
| 666 | 690 | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break;
|
| 667 | 691 | 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;
|
| 669 | 693 | |
| 670 | 694 | /* --- the following bits of info are returned as pointers --- */
|
| 671 | 695 | case DEVINFO_PTR_ROM_REGION: info->romregion = rom_l5521046; break;
|
src/mess/machine/abcbus.c
| r3555 | r3556 | |
| 5 | 5 | typedef struct _abcbus_daisy_state abcbus_daisy_state; |
| 6 | 6 | struct _abcbus_daisy_state |
| 7 | 7 | { |
| 8 | | abcbus_daisy_state * next; /* next device */ |
| 8 | abcbus_daisy_state * next; /* next device */ |
| 9 | 9 | const device_config * device; /* associated device */ |
| 10 | 10 | abcbus_card_select card_select; /* card select callback */ |
| 11 | 11 | }; |
| 12 | 12 | |
| 13 | | static abcbus_daisy_state *daisy; |
| 13 | static abcbus_daisy_state *daisy_state; |
| 14 | 14 | |
| 15 | | void *abcbus_init(running_machine *machine, const char *cputag, const abcbus_daisy_chain *daisy) |
| 15 | void abcbus_init(running_machine *machine, const char *cputag, const abcbus_daisy_chain *daisy) |
| 16 | 16 | { |
| 17 | 17 | astring *tempstring = astring_alloc(); |
| 18 | 18 | abcbus_daisy_state *head = NULL; |
| r3555 | r3556 | |
| 29 | 29 | (*tailptr)->card_select = (abcbus_card_select)device_get_info_fct((*tailptr)->device, DEVINFO_FCT_CARD_SELECT); |
| 30 | 30 | tailptr = &(*tailptr)->next; |
| 31 | 31 | } |
| 32 | |
| 33 | astring_free(tempstring); |
| 32 | 34 | |
| 33 | | astring_free(tempstring); |
| 34 | | return head; |
| 35 | daisy_state = head; |
| 35 | 36 | } |
| 36 | 37 | |
| 37 | 38 | WRITE8_HANDLER( abcbus_channel_w ) |
| 38 | 39 | { |
| 40 | abcbus_daisy_state *daisy = daisy_state; |
| 41 | |
| 39 | 42 | /* 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) |
| 41 | 44 | (*daisy->card_select)(daisy->device, data); |
| 42 | 45 | } |
| 43 | 46 | |
| 44 | 47 | READ8_HANDLER( abcbus_reset_r ) |
| 45 | 48 | { |
| 49 | abcbus_daisy_state *daisy = daisy_state; |
| 50 | |
| 46 | 51 | /* loop over all devices and call their reset function */ |
| 47 | 52 | for ( ; daisy != NULL; daisy = daisy->next) |
| 48 | 53 | device_reset(daisy->device); |