src/mess/machine/osborne1.c
| r8360 | r8361 | |
| 495 | 495 | Osborne1 specific daisy chain code |
| 496 | 496 | ****************************************************************/ |
| 497 | 497 | |
| 498 | // ======================> osborne1_daisy_device_config |
| 498 | 499 | |
| 499 | | //static int osborne1_daisy_irq_state(running_device *device) |
| 500 | | //{ |
| 501 | | // return ( osborne1.pia_1_irq_state ? Z80_DAISY_INT : 0 ); |
| 502 | | //} |
| 503 | | // |
| 504 | | // |
| 505 | | //static int osborne1_daisy_irq_ack(running_device *device) |
| 506 | | //{ |
| 507 | | // /* Enable ROM and I/O when IRQ is acknowledged */ |
| 508 | | // UINT8 old_bankswitch = osborne1.bankswitch; |
| 509 | | // const address_space* space = cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 510 | | // |
| 511 | | // osborne1_bankswitch_w( space, 0, 0 ); |
| 512 | | // osborne1.bankswitch = old_bankswitch; |
| 513 | | // osborne1.in_irq_handler = 1; |
| 514 | | // return 0xF8; |
| 515 | | //} |
| 516 | | // |
| 517 | | //static void osborne1_daisy_irq_reti(running_device *device) |
| 518 | | //{ |
| 519 | | //} |
| 520 | | // |
| 521 | | // |
| 522 | | //static DEVICE_START( osborne1_daisy ) |
| 523 | | //{ |
| 524 | | //} |
| 525 | | // |
| 526 | | // |
| 527 | | //static DEVICE_RESET( osborne1_daisy ) |
| 528 | | //{ |
| 529 | | //} |
| 530 | | // |
| 531 | | // |
| 532 | | //DEVICE_GET_INFO( osborne1_daisy ) |
| 533 | | //{ |
| 534 | | // switch (state) |
| 535 | | // { |
| 536 | | // /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 537 | | // case DEVINFO_INT_TOKEN_BYTES: info->i = 4; break; |
| 538 | | // case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break; |
| 539 | | // |
| 540 | | // /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 541 | | // case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(osborne1_daisy); break; |
| 542 | | // case DEVINFO_FCT_STOP: /* Nothing */ break; |
| 543 | | // case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(osborne1_daisy); break; |
| 544 | | // case DEVINFO_FCT_IRQ_STATE: info->f = (genf *)osborne1_daisy_irq_state; break; |
| 545 | | // case DEVINFO_FCT_IRQ_ACK: info->f = (genf *)osborne1_daisy_irq_ack; break; |
| 546 | | // case DEVINFO_FCT_IRQ_RETI: info->f = (genf *)osborne1_daisy_irq_reti; break; |
| 547 | | // |
| 548 | | // /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 549 | | // case DEVINFO_STR_NAME: strcpy(info->s, "Osborne1 daisy"); break; |
| 550 | | // case DEVINFO_STR_FAMILY: strcpy(info->s, "Z80"); break; |
| 551 | | // case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; |
| 552 | | // case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 553 | | // case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright the MESS Team"); break; |
| 554 | | // } |
| 555 | | //} |
| 556 | | // |
| 557 | | //DEFINE_LEGACY_DEVICE(OSBORNE1_DAISY, osborne1_daisy); |
| 500 | class osborne1_daisy_device_config : public device_config, |
| 501 | public device_config_z80daisy_interface |
| 502 | { |
| 503 | friend class osborne1_daisy_device; |
| 558 | 504 | |
| 505 | // construction/destruction |
| 506 | osborne1_daisy_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); |
| 507 | |
| 508 | public: |
| 509 | // allocators |
| 510 | static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); |
| 511 | virtual device_t *alloc_device(running_machine &machine) const; |
| 512 | |
| 513 | // basic information getters |
| 514 | virtual const char *name() const { return "Osborne 1 daisy"; } |
| 515 | }; |
| 516 | |
| 517 | |
| 518 | |
| 519 | // ======================> osborne1_daisy_device |
| 520 | |
| 521 | class osborne1_daisy_device : public device_t, |
| 522 | public device_z80daisy_interface |
| 523 | { |
| 524 | friend class osborne1_daisy_device_config; |
| 525 | |
| 526 | // construction/destruction |
| 527 | osborne1_daisy_device(running_machine &_machine, const osborne1_daisy_device_config &_config); |
| 528 | |
| 529 | private: |
| 530 | virtual void device_start(); |
| 531 | // z80daisy_interface overrides |
| 532 | virtual int z80daisy_irq_state(); |
| 533 | virtual int z80daisy_irq_ack(); |
| 534 | virtual void z80daisy_irq_reti(); |
| 535 | |
| 536 | // internal state |
| 537 | const osborne1_daisy_device_config &m_config; |
| 538 | }; |
| 539 | |
| 540 | //************************************************************************** |
| 541 | // DEVICE CONFIGURATION |
| 542 | //************************************************************************** |
| 543 | |
| 544 | //------------------------------------------------- |
| 545 | // osborne1_daisy_device_config - constructor |
| 546 | //------------------------------------------------- |
| 547 | |
| 548 | osborne1_daisy_device_config::osborne1_daisy_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 549 | : device_config(mconfig, static_alloc_device_config, tag, owner, clock), |
| 550 | device_config_z80daisy_interface(mconfig, *this) |
| 551 | { |
| 552 | } |
| 553 | |
| 554 | |
| 555 | //------------------------------------------------- |
| 556 | // static_alloc_device_config - allocate a new |
| 557 | // configuration object |
| 558 | //------------------------------------------------- |
| 559 | |
| 560 | device_config *osborne1_daisy_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 561 | { |
| 562 | return global_alloc(osborne1_daisy_device_config(mconfig, tag, owner, clock)); |
| 563 | } |
| 564 | |
| 565 | |
| 566 | //------------------------------------------------- |
| 567 | // alloc_device - allocate a new device object |
| 568 | //------------------------------------------------- |
| 569 | |
| 570 | device_t *osborne1_daisy_device_config::alloc_device(running_machine &machine) const |
| 571 | { |
| 572 | return auto_alloc(&machine, osborne1_daisy_device(machine, *this)); |
| 573 | } |
| 574 | |
| 575 | //************************************************************************** |
| 576 | // LIVE DEVICE |
| 577 | //************************************************************************** |
| 578 | |
| 579 | //------------------------------------------------- |
| 580 | // z80ctc_device - constructor |
| 581 | //------------------------------------------------- |
| 582 | |
| 583 | osborne1_daisy_device::osborne1_daisy_device(running_machine &_machine, const osborne1_daisy_device_config &_config) |
| 584 | : device_t(_machine, _config), |
| 585 | device_z80daisy_interface(_machine, _config, *this), |
| 586 | m_config(_config) |
| 587 | { |
| 588 | } |
| 589 | |
| 590 | //------------------------------------------------- |
| 591 | // device_start - device-specific startup |
| 592 | //------------------------------------------------- |
| 593 | |
| 594 | void osborne1_daisy_device::device_start() |
| 595 | { |
| 596 | } |
| 597 | |
| 598 | //************************************************************************** |
| 599 | // DAISY CHAIN INTERFACE |
| 600 | //************************************************************************** |
| 601 | |
| 602 | //------------------------------------------------- |
| 603 | // z80daisy_irq_state - return the overall IRQ |
| 604 | // state for this device |
| 605 | //------------------------------------------------- |
| 606 | |
| 607 | int osborne1_daisy_device::z80daisy_irq_state() |
| 608 | { |
| 609 | return ( osborne1.pia_1_irq_state ? Z80_DAISY_INT : 0 ); |
| 610 | } |
| 611 | |
| 612 | |
| 613 | //------------------------------------------------- |
| 614 | // z80daisy_irq_ack - acknowledge an IRQ and |
| 615 | // return the appropriate vector |
| 616 | //------------------------------------------------- |
| 617 | |
| 618 | int osborne1_daisy_device::z80daisy_irq_ack() |
| 619 | { |
| 620 | /* Enable ROM and I/O when IRQ is acknowledged */ |
| 621 | UINT8 old_bankswitch = osborne1.bankswitch; |
| 622 | const address_space* space = cputag_get_address_space(device().machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 623 | |
| 624 | osborne1_bankswitch_w( space, 0, 0 ); |
| 625 | osborne1.bankswitch = old_bankswitch; |
| 626 | osborne1.in_irq_handler = 1; |
| 627 | return 0xF8; |
| 628 | } |
| 629 | |
| 630 | //------------------------------------------------- |
| 631 | // z80daisy_irq_reti - clear the interrupt |
| 632 | // pending state to allow other interrupts through |
| 633 | //------------------------------------------------- |
| 634 | |
| 635 | void osborne1_daisy_device::z80daisy_irq_reti() |
| 636 | { |
| 637 | } |
| 638 | |
| 639 | const device_type OSBORNE1_DAISY = osborne1_daisy_device_config::static_alloc_device_config; |
src/mess/drivers/x1.c
| r8360 | r8361 | |
| 855 | 855 | logerror("SUB: Command byte 0x%02x\n",data); |
| 856 | 856 | } |
| 857 | 857 | |
| 858 | | //static int x1_keyboard_irq_state(running_device* device) |
| 859 | | //{ |
| 860 | | // if(key_irq_flag != 0) |
| 861 | | // return Z80_DAISY_INT; |
| 862 | | // |
| 863 | | // return 0; |
| 864 | | //} |
| 865 | | // |
| 866 | | //static int x1_keyboard_irq_ack(running_device* device) |
| 867 | | //{ |
| 868 | | // key_irq_flag = 0; |
| 869 | | // cputag_set_input_line(device->machine,"maincpu",INPUT_LINE_IRQ0,CLEAR_LINE); |
| 870 | | // return key_irq_vector; |
| 871 | | //} |
| 872 | | // |
| 873 | | //static DEVICE_GET_INFO( x1_keyboard_getinfo ) |
| 874 | | //{ |
| 875 | | // switch (state) |
| 876 | | // { |
| 877 | | // /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 878 | | // case DEVINFO_INT_TOKEN_BYTES: info->i = 4; break; |
| 879 | | // case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break; |
| 880 | | // |
| 881 | | // /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 882 | | // case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(x1_daisy); break; |
| 883 | | // case DEVINFO_FCT_IRQ_STATE: info->f = (genf *)x1_keyboard_irq_state; break; |
| 884 | | // case DEVINFO_FCT_IRQ_ACK: info->f = (genf *)x1_keyboard_irq_ack; break; |
| 885 | | // |
| 886 | | // /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 887 | | // case DEVINFO_STR_NAME: strcpy(info->s, "X1 keyboard"); break; |
| 888 | | // case DEVINFO_STR_FAMILY: strcpy(info->s, "X1 daisy chain"); break; |
| 889 | | // case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; |
| 890 | | // case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 891 | | // case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright the MESS Team"); break; |
| 892 | | // } |
| 893 | | //} |
| 894 | 858 | |
| 859 | // ======================> x1_keyboard_device_config |
| 860 | |
| 861 | class x1_keyboard_device_config : public device_config, |
| 862 | public device_config_z80daisy_interface |
| 863 | { |
| 864 | friend class x1_keyboard_device; |
| 865 | |
| 866 | // construction/destruction |
| 867 | x1_keyboard_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); |
| 868 | |
| 869 | public: |
| 870 | // allocators |
| 871 | static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); |
| 872 | virtual device_t *alloc_device(running_machine &machine) const; |
| 873 | |
| 874 | // basic information getters |
| 875 | virtual const char *name() const { return "X1 Keyboard"; } |
| 876 | }; |
| 877 | |
| 878 | |
| 879 | |
| 880 | // ======================> x1_keyboard_device |
| 881 | |
| 882 | class x1_keyboard_device : public device_t, |
| 883 | public device_z80daisy_interface |
| 884 | { |
| 885 | friend class x1_keyboard_device_config; |
| 886 | |
| 887 | // construction/destruction |
| 888 | x1_keyboard_device(running_machine &_machine, const x1_keyboard_device_config &_config); |
| 889 | |
| 890 | private: |
| 891 | virtual void device_start(); |
| 892 | // z80daisy_interface overrides |
| 893 | virtual int z80daisy_irq_state(); |
| 894 | virtual int z80daisy_irq_ack(); |
| 895 | virtual void z80daisy_irq_reti(); |
| 896 | |
| 897 | // internal state |
| 898 | const x1_keyboard_device_config &m_config; |
| 899 | }; |
| 900 | |
| 901 | //************************************************************************** |
| 902 | // DEVICE CONFIGURATION |
| 903 | //************************************************************************** |
| 904 | |
| 905 | //------------------------------------------------- |
| 906 | // x1_keyboard_device_config - constructor |
| 907 | //------------------------------------------------- |
| 908 | |
| 909 | x1_keyboard_device_config::x1_keyboard_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 910 | : device_config(mconfig, static_alloc_device_config, tag, owner, clock), |
| 911 | device_config_z80daisy_interface(mconfig, *this) |
| 912 | { |
| 913 | } |
| 914 | |
| 915 | |
| 916 | //------------------------------------------------- |
| 917 | // static_alloc_device_config - allocate a new |
| 918 | // configuration object |
| 919 | //------------------------------------------------- |
| 920 | |
| 921 | device_config *x1_keyboard_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 922 | { |
| 923 | return global_alloc(x1_keyboard_device_config(mconfig, tag, owner, clock)); |
| 924 | } |
| 925 | |
| 926 | |
| 927 | //------------------------------------------------- |
| 928 | // alloc_device - allocate a new device object |
| 929 | //------------------------------------------------- |
| 930 | |
| 931 | device_t *x1_keyboard_device_config::alloc_device(running_machine &machine) const |
| 932 | { |
| 933 | return auto_alloc(&machine, x1_keyboard_device(machine, *this)); |
| 934 | } |
| 935 | |
| 936 | //************************************************************************** |
| 937 | // LIVE DEVICE |
| 938 | //************************************************************************** |
| 939 | |
| 940 | //------------------------------------------------- |
| 941 | // z80ctc_device - constructor |
| 942 | //------------------------------------------------- |
| 943 | |
| 944 | x1_keyboard_device::x1_keyboard_device(running_machine &_machine, const x1_keyboard_device_config &_config) |
| 945 | : device_t(_machine, _config), |
| 946 | device_z80daisy_interface(_machine, _config, *this), |
| 947 | m_config(_config) |
| 948 | { |
| 949 | } |
| 950 | |
| 951 | //------------------------------------------------- |
| 952 | // device_start - device-specific startup |
| 953 | //------------------------------------------------- |
| 954 | |
| 955 | void x1_keyboard_device::device_start() |
| 956 | { |
| 957 | } |
| 958 | |
| 959 | //************************************************************************** |
| 960 | // DAISY CHAIN INTERFACE |
| 961 | //************************************************************************** |
| 962 | |
| 963 | //------------------------------------------------- |
| 964 | // z80daisy_irq_state - return the overall IRQ |
| 965 | // state for this device |
| 966 | //------------------------------------------------- |
| 967 | |
| 968 | int x1_keyboard_device::z80daisy_irq_state() |
| 969 | { |
| 970 | if(key_irq_flag != 0) |
| 971 | return Z80_DAISY_INT; |
| 972 | return 0; |
| 973 | } |
| 974 | |
| 975 | |
| 976 | //------------------------------------------------- |
| 977 | // z80daisy_irq_ack - acknowledge an IRQ and |
| 978 | // return the appropriate vector |
| 979 | //------------------------------------------------- |
| 980 | |
| 981 | int x1_keyboard_device::z80daisy_irq_ack() |
| 982 | { |
| 983 | key_irq_flag = 0; |
| 984 | cputag_set_input_line(device().machine,"maincpu",INPUT_LINE_IRQ0,CLEAR_LINE); |
| 985 | return key_irq_vector; |
| 986 | } |
| 987 | |
| 988 | //------------------------------------------------- |
| 989 | // z80daisy_irq_reti - clear the interrupt |
| 990 | // pending state to allow other interrupts through |
| 991 | //------------------------------------------------- |
| 992 | |
| 993 | void x1_keyboard_device::z80daisy_irq_reti() |
| 994 | { |
| 995 | } |
| 996 | |
| 997 | const device_type X1_KEYBOARD = x1_keyboard_device_config::static_alloc_device_config; |
| 998 | |
| 895 | 999 | /************************************* |
| 896 | 1000 | * |
| 897 | 1001 | * ROM Image / Banking Handling |
| r8360 | r8361 | |
| 1978 | 2082 | |
| 1979 | 2083 | static const z80_daisy_config x1_daisy[] = |
| 1980 | 2084 | { |
| 1981 | | // { "x1kb" }, |
| 2085 | { "x1kb" }, |
| 1982 | 2086 | { "ctc" }, |
| 1983 | 2087 | { NULL } |
| 1984 | 2088 | }; |
| 1985 | 2089 | |
| 1986 | 2090 | static const z80_daisy_config x1turbo_daisy[] = |
| 1987 | 2091 | { |
| 1988 | | // { "x1kb" }, |
| 2092 | { "x1kb" }, |
| 1989 | 2093 | { "ctc" }, |
| 1990 | 2094 | { "dma" }, |
| 1991 | 2095 | // { "sio" }, |
| r8360 | r8361 | |
| 2233 | 2337 | |
| 2234 | 2338 | MDRV_Z80CTC_ADD( "ctc", MAIN_CLOCK/4 , ctc_intf ) |
| 2235 | 2339 | |
| 2236 | | //MDRV_DEVICE_ADD("x1kb", DEVICE_GET_INFO_NAME(x1_keyboard_getinfo), 0) |
| 2340 | MDRV_DEVICE_ADD("x1kb", X1_KEYBOARD, 0) |
| 2237 | 2341 | |
| 2238 | 2342 | MDRV_I8255A_ADD( "ppi8255_0", ppi8255_intf ) |
| 2239 | 2343 | |
src/mess/drivers/einstein.c
| r8360 | r8361 | |
| 183 | 183 | EINSTEIN NON-Z80 DEVICES DAISY CHAIN SUPPORT |
| 184 | 184 | ****************************************************************/ |
| 185 | 185 | |
| 186 | | //static DEVICE_START( einstein_daisy ) { } |
| 186 | // ======================> einstein_keyboard_daisy_device_config |
| 187 | 187 | |
| 188 | | //static int einstein_keyboard_daisy_irq_state(running_device *device) |
| 189 | | //{ |
| 190 | | // einstein_state *einstein = (einstein_state *)device->machine->driver_data; |
| 191 | | // |
| 192 | | // if (einstein->interrupt & einstein->interrupt_mask & EINSTEIN_KEY_INT) |
| 193 | | // return Z80_DAISY_INT; |
| 194 | | // |
| 195 | | // return 0; |
| 196 | | //} |
| 197 | | // |
| 198 | | //static int einstein_keyboard_daisy_irq_ack(running_device *device) |
| 199 | | //{ |
| 200 | | // return 0xf7; |
| 201 | | //} |
| 188 | class einstein_keyboard_daisy_device_config : public device_config, |
| 189 | public device_config_z80daisy_interface |
| 190 | { |
| 191 | friend class einstein_keyboard_daisy_device; |
| 202 | 192 | |
| 203 | | //static DEVICE_GET_INFO( einstein_keyboard_daisy ) |
| 204 | | //{ |
| 205 | | // switch (state) |
| 206 | | // { |
| 207 | | // /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 208 | | // case DEVINFO_INT_TOKEN_BYTES: info->i = 4; break; |
| 209 | | // case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break; |
| 210 | | // |
| 211 | | // /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 212 | | // case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(einstein_daisy); break; |
| 213 | | // case DEVINFO_FCT_IRQ_STATE: info->f = (genf *)einstein_keyboard_daisy_irq_state; break; |
| 214 | | // case DEVINFO_FCT_IRQ_ACK: info->f = (genf *)einstein_keyboard_daisy_irq_ack; break; |
| 215 | | // |
| 216 | | // /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 217 | | // case DEVINFO_STR_NAME: strcpy(info->s, "Einstein keyboard daisy chain"); break; |
| 218 | | // case DEVINFO_STR_FAMILY: strcpy(info->s, "Einstein daisy chain"); break; |
| 219 | | // case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; |
| 220 | | // case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 221 | | // case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright the MESS Team"); break; |
| 222 | | // } |
| 223 | | //} |
| 193 | // construction/destruction |
| 194 | einstein_keyboard_daisy_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); |
| 224 | 195 | |
| 225 | | //static int einstein_adc_daisy_irq_state(running_device *device) |
| 226 | | //{ |
| 227 | | // einstein_state *einstein = (einstein_state *)device->machine->driver_data; |
| 228 | | // |
| 229 | | // if (einstein->interrupt & einstein->interrupt_mask & EINSTEIN_ADC_INT) |
| 230 | | // return Z80_DAISY_INT; |
| 231 | | // |
| 232 | | // return 0; |
| 233 | | //} |
| 234 | | // |
| 235 | | //static int einstein_adc_daisy_irq_ack(running_device *device) |
| 236 | | //{ |
| 237 | | // return 0xfb; |
| 238 | | //} |
| 196 | public: |
| 197 | // allocators |
| 198 | static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); |
| 199 | virtual device_t *alloc_device(running_machine &machine) const; |
| 239 | 200 | |
| 240 | | //static DEVICE_GET_INFO( einstein_adc_daisy ) |
| 241 | | //{ |
| 242 | | // switch (state) |
| 243 | | // { |
| 244 | | // /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 245 | | // case DEVINFO_INT_TOKEN_BYTES: info->i = 4; break; |
| 246 | | // case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break; |
| 247 | | // |
| 248 | | // /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 249 | | // case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(einstein_daisy); break; |
| 250 | | // case DEVINFO_FCT_IRQ_STATE: info->f = (genf *)einstein_adc_daisy_irq_state; break; |
| 251 | | // case DEVINFO_FCT_IRQ_ACK: info->f = (genf *)einstein_adc_daisy_irq_ack; break; |
| 252 | | // |
| 253 | | // /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 254 | | // case DEVINFO_STR_NAME: strcpy(info->s, "Einstein ADC daisy chain"); break; |
| 255 | | // case DEVINFO_STR_FAMILY: strcpy(info->s, "Einstein daisy chain"); break; |
| 256 | | // case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; |
| 257 | | // case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 258 | | // case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright the MESS Team"); break; |
| 259 | | // } |
| 260 | | //} |
| 201 | // basic information getters |
| 202 | virtual const char *name() const { return "Einstein keyboard daisy chain"; } |
| 203 | }; |
| 261 | 204 | |
| 262 | | //static int einstein_fire_daisy_irq_state(running_device *device) |
| 263 | | //{ |
| 264 | | // einstein_state *einstein = (einstein_state *)device->machine->driver_data; |
| 265 | | // |
| 266 | | // if (einstein->interrupt & einstein->interrupt_mask & EINSTEIN_FIRE_INT) |
| 267 | | // return Z80_DAISY_INT; |
| 268 | | // |
| 269 | | // return 0; |
| 270 | | //} |
| 271 | | // |
| 272 | | //static int einstein_fire_daisy_irq_ack(running_device *device) |
| 273 | | //{ |
| 274 | | // return 0xfd; |
| 275 | | //} |
| 276 | 205 | |
| 277 | | //static DEVICE_GET_INFO( einstein_fire_daisy ) |
| 278 | | //{ |
| 279 | | // switch (state) |
| 280 | | // { |
| 281 | | // /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 282 | | // case DEVINFO_INT_TOKEN_BYTES: info->i = 4; break; |
| 283 | | // case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break; |
| 284 | | // |
| 285 | | // /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 286 | | // case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(einstein_daisy); break; |
| 287 | | // case DEVINFO_FCT_IRQ_STATE: info->f = (genf *)einstein_fire_daisy_irq_state; break; |
| 288 | | // case DEVINFO_FCT_IRQ_ACK: info->f = (genf *)einstein_fire_daisy_irq_ack; break; |
| 289 | | // |
| 290 | | // /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 291 | | // case DEVINFO_STR_NAME: strcpy(info->s, "Einstein fire button daisy chain"); break; |
| 292 | | // case DEVINFO_STR_FAMILY: strcpy(info->s, "Einstein daisy chain"); break; |
| 293 | | // case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; |
| 294 | | // case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 295 | | // case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright the MESS Team"); break; |
| 296 | | // } |
| 297 | | //} |
| 298 | 206 | |
| 207 | // ======================> einstein_keyboard_daisy_device |
| 208 | |
| 209 | class einstein_keyboard_daisy_device : public device_t, |
| 210 | public device_z80daisy_interface |
| 211 | { |
| 212 | friend class einstein_keyboard_daisy_device_config; |
| 213 | |
| 214 | // construction/destruction |
| 215 | einstein_keyboard_daisy_device(running_machine &_machine, const einstein_keyboard_daisy_device_config &_config); |
| 216 | |
| 217 | private: |
| 218 | virtual void device_start(); |
| 219 | // z80daisy_interface overrides |
| 220 | virtual int z80daisy_irq_state(); |
| 221 | virtual int z80daisy_irq_ack(); |
| 222 | virtual void z80daisy_irq_reti(); |
| 223 | |
| 224 | // internal state |
| 225 | const einstein_keyboard_daisy_device_config &m_config; |
| 226 | }; |
| 227 | |
| 228 | //************************************************************************** |
| 229 | // DEVICE CONFIGURATION |
| 230 | //************************************************************************** |
| 231 | |
| 232 | //------------------------------------------------- |
| 233 | // einstein_keyboard_daisy_device_config - constructor |
| 234 | //------------------------------------------------- |
| 235 | |
| 236 | einstein_keyboard_daisy_device_config::einstein_keyboard_daisy_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 237 | : device_config(mconfig, static_alloc_device_config, tag, owner, clock), |
| 238 | device_config_z80daisy_interface(mconfig, *this) |
| 239 | { |
| 240 | } |
| 241 | |
| 242 | |
| 243 | //------------------------------------------------- |
| 244 | // static_alloc_device_config - allocate a new |
| 245 | // configuration object |
| 246 | //------------------------------------------------- |
| 247 | |
| 248 | device_config *einstein_keyboard_daisy_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 249 | { |
| 250 | return global_alloc(einstein_keyboard_daisy_device_config(mconfig, tag, owner, clock)); |
| 251 | } |
| 252 | |
| 253 | |
| 254 | //------------------------------------------------- |
| 255 | // alloc_device - allocate a new device object |
| 256 | //------------------------------------------------- |
| 257 | |
| 258 | device_t *einstein_keyboard_daisy_device_config::alloc_device(running_machine &machine) const |
| 259 | { |
| 260 | return auto_alloc(&machine, einstein_keyboard_daisy_device(machine, *this)); |
| 261 | } |
| 262 | |
| 263 | //************************************************************************** |
| 264 | // LIVE DEVICE |
| 265 | //************************************************************************** |
| 266 | |
| 267 | //------------------------------------------------- |
| 268 | // z80ctc_device - constructor |
| 269 | //------------------------------------------------- |
| 270 | |
| 271 | einstein_keyboard_daisy_device::einstein_keyboard_daisy_device(running_machine &_machine, const einstein_keyboard_daisy_device_config &_config) |
| 272 | : device_t(_machine, _config), |
| 273 | device_z80daisy_interface(_machine, _config, *this), |
| 274 | m_config(_config) |
| 275 | { |
| 276 | } |
| 277 | |
| 278 | //------------------------------------------------- |
| 279 | // device_start - device-specific startup |
| 280 | //------------------------------------------------- |
| 281 | |
| 282 | void einstein_keyboard_daisy_device::device_start() |
| 283 | { |
| 284 | } |
| 285 | |
| 286 | //************************************************************************** |
| 287 | // DAISY CHAIN INTERFACE |
| 288 | //************************************************************************** |
| 289 | |
| 290 | //------------------------------------------------- |
| 291 | // z80daisy_irq_state - return the overall IRQ |
| 292 | // state for this device |
| 293 | //------------------------------------------------- |
| 294 | |
| 295 | int einstein_keyboard_daisy_device::z80daisy_irq_state() |
| 296 | { |
| 297 | einstein_state *einstein = (einstein_state *)device().machine->driver_data; |
| 298 | |
| 299 | if (einstein->interrupt & einstein->interrupt_mask & EINSTEIN_KEY_INT) |
| 300 | return Z80_DAISY_INT; |
| 301 | |
| 302 | return 0; |
| 303 | } |
| 304 | |
| 305 | |
| 306 | //------------------------------------------------- |
| 307 | // z80daisy_irq_ack - acknowledge an IRQ and |
| 308 | // return the appropriate vector |
| 309 | //------------------------------------------------- |
| 310 | |
| 311 | int einstein_keyboard_daisy_device::z80daisy_irq_ack() |
| 312 | { |
| 313 | return 0xf7; |
| 314 | } |
| 315 | |
| 316 | //------------------------------------------------- |
| 317 | // z80daisy_irq_reti - clear the interrupt |
| 318 | // pending state to allow other interrupts through |
| 319 | //------------------------------------------------- |
| 320 | |
| 321 | void einstein_keyboard_daisy_device::z80daisy_irq_reti() |
| 322 | { |
| 323 | } |
| 324 | |
| 325 | const device_type EINSTEIN_KEYBOARD_DAISY = einstein_keyboard_daisy_device_config::static_alloc_device_config; |
| 326 | |
| 327 | // ======================> einstein_adc_daisy_device_config |
| 328 | |
| 329 | class einstein_adc_daisy_device_config : public device_config, |
| 330 | public device_config_z80daisy_interface |
| 331 | { |
| 332 | friend class einstein_adc_daisy_device; |
| 333 | |
| 334 | // construction/destruction |
| 335 | einstein_adc_daisy_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); |
| 336 | |
| 337 | public: |
| 338 | // allocators |
| 339 | static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); |
| 340 | virtual device_t *alloc_device(running_machine &machine) const; |
| 341 | |
| 342 | // basic information getters |
| 343 | virtual const char *name() const { return "Einstein ADC daisy chain"; } |
| 344 | }; |
| 345 | |
| 346 | |
| 347 | |
| 348 | // ======================> einstein_adc_daisy_device |
| 349 | |
| 350 | class einstein_adc_daisy_device : public device_t, |
| 351 | public device_z80daisy_interface |
| 352 | { |
| 353 | friend class einstein_adc_daisy_device_config; |
| 354 | |
| 355 | // construction/destruction |
| 356 | einstein_adc_daisy_device(running_machine &_machine, const einstein_adc_daisy_device_config &_config); |
| 357 | |
| 358 | private: |
| 359 | virtual void device_start(); |
| 360 | // z80daisy_interface overrides |
| 361 | virtual int z80daisy_irq_state(); |
| 362 | virtual int z80daisy_irq_ack(); |
| 363 | virtual void z80daisy_irq_reti(); |
| 364 | |
| 365 | // internal state |
| 366 | const einstein_adc_daisy_device_config &m_config; |
| 367 | }; |
| 368 | |
| 369 | //************************************************************************** |
| 370 | // DEVICE CONFIGURATION |
| 371 | //************************************************************************** |
| 372 | |
| 373 | //------------------------------------------------- |
| 374 | // einstein_adc_daisy_device_config - constructor |
| 375 | //------------------------------------------------- |
| 376 | |
| 377 | einstein_adc_daisy_device_config::einstein_adc_daisy_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 378 | : device_config(mconfig, static_alloc_device_config, tag, owner, clock), |
| 379 | device_config_z80daisy_interface(mconfig, *this) |
| 380 | { |
| 381 | } |
| 382 | |
| 383 | |
| 384 | //------------------------------------------------- |
| 385 | // static_alloc_device_config - allocate a new |
| 386 | // configuration object |
| 387 | //------------------------------------------------- |
| 388 | |
| 389 | device_config *einstein_adc_daisy_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 390 | { |
| 391 | return global_alloc(einstein_adc_daisy_device_config(mconfig, tag, owner, clock)); |
| 392 | } |
| 393 | |
| 394 | |
| 395 | //------------------------------------------------- |
| 396 | // alloc_device - allocate a new device object |
| 397 | //------------------------------------------------- |
| 398 | |
| 399 | device_t *einstein_adc_daisy_device_config::alloc_device(running_machine &machine) const |
| 400 | { |
| 401 | return auto_alloc(&machine, einstein_adc_daisy_device(machine, *this)); |
| 402 | } |
| 403 | |
| 404 | //************************************************************************** |
| 405 | // LIVE DEVICE |
| 406 | //************************************************************************** |
| 407 | |
| 408 | //------------------------------------------------- |
| 409 | // z80ctc_device - constructor |
| 410 | //------------------------------------------------- |
| 411 | |
| 412 | einstein_adc_daisy_device::einstein_adc_daisy_device(running_machine &_machine, const einstein_adc_daisy_device_config &_config) |
| 413 | : device_t(_machine, _config), |
| 414 | device_z80daisy_interface(_machine, _config, *this), |
| 415 | m_config(_config) |
| 416 | { |
| 417 | } |
| 418 | |
| 419 | //------------------------------------------------- |
| 420 | // device_start - device-specific startup |
| 421 | //------------------------------------------------- |
| 422 | |
| 423 | void einstein_adc_daisy_device::device_start() |
| 424 | { |
| 425 | } |
| 426 | |
| 427 | //************************************************************************** |
| 428 | // DAISY CHAIN INTERFACE |
| 429 | //************************************************************************** |
| 430 | |
| 431 | //------------------------------------------------- |
| 432 | // z80daisy_irq_state - return the overall IRQ |
| 433 | // state for this device |
| 434 | //------------------------------------------------- |
| 435 | |
| 436 | int einstein_adc_daisy_device::z80daisy_irq_state() |
| 437 | { |
| 438 | einstein_state *einstein = (einstein_state *)device().machine->driver_data; |
| 439 | |
| 440 | if (einstein->interrupt & einstein->interrupt_mask & EINSTEIN_ADC_INT) |
| 441 | return Z80_DAISY_INT; |
| 442 | |
| 443 | return 0; |
| 444 | } |
| 445 | |
| 446 | |
| 447 | //------------------------------------------------- |
| 448 | // z80daisy_irq_ack - acknowledge an IRQ and |
| 449 | // return the appropriate vector |
| 450 | //------------------------------------------------- |
| 451 | |
| 452 | int einstein_adc_daisy_device::z80daisy_irq_ack() |
| 453 | { |
| 454 | return 0xfb; |
| 455 | } |
| 456 | |
| 457 | //------------------------------------------------- |
| 458 | // z80daisy_irq_reti - clear the interrupt |
| 459 | // pending state to allow other interrupts through |
| 460 | //------------------------------------------------- |
| 461 | |
| 462 | void einstein_adc_daisy_device::z80daisy_irq_reti() |
| 463 | { |
| 464 | } |
| 465 | |
| 466 | const device_type EINSTEIN_ADC_DAISY = einstein_adc_daisy_device_config::static_alloc_device_config; |
| 467 | |
| 468 | // ======================> einstein_fire_daisy_device_config |
| 469 | |
| 470 | class einstein_fire_daisy_device_config : public device_config, |
| 471 | public device_config_z80daisy_interface |
| 472 | { |
| 473 | friend class einstein_fire_daisy_device; |
| 474 | |
| 475 | // construction/destruction |
| 476 | einstein_fire_daisy_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); |
| 477 | |
| 478 | public: |
| 479 | // allocators |
| 480 | static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); |
| 481 | virtual device_t *alloc_device(running_machine &machine) const; |
| 482 | |
| 483 | // basic information getters |
| 484 | virtual const char *name() const { return "Einstein fire button daisy chain"; } |
| 485 | }; |
| 486 | |
| 487 | |
| 488 | |
| 489 | // ======================> einstein_fire_daisy_device |
| 490 | |
| 491 | class einstein_fire_daisy_device : public device_t, |
| 492 | public device_z80daisy_interface |
| 493 | { |
| 494 | friend class einstein_fire_daisy_device_config; |
| 495 | |
| 496 | // construction/destruction |
| 497 | einstein_fire_daisy_device(running_machine &_machine, const einstein_fire_daisy_device_config &_config); |
| 498 | |
| 499 | private: |
| 500 | virtual void device_start(); |
| 501 | // z80daisy_interface overrides |
| 502 | virtual int z80daisy_irq_state(); |
| 503 | virtual int z80daisy_irq_ack(); |
| 504 | virtual void z80daisy_irq_reti(); |
| 505 | |
| 506 | // internal state |
| 507 | const einstein_fire_daisy_device_config &m_config; |
| 508 | }; |
| 509 | |
| 510 | //************************************************************************** |
| 511 | // DEVICE CONFIGURATION |
| 512 | //************************************************************************** |
| 513 | |
| 514 | //------------------------------------------------- |
| 515 | // einstein_fire_daisy_device_config - constructor |
| 516 | //------------------------------------------------- |
| 517 | |
| 518 | einstein_fire_daisy_device_config::einstein_fire_daisy_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 519 | : device_config(mconfig, static_alloc_device_config, tag, owner, clock), |
| 520 | device_config_z80daisy_interface(mconfig, *this) |
| 521 | { |
| 522 | } |
| 523 | |
| 524 | |
| 525 | //------------------------------------------------- |
| 526 | // static_alloc_device_config - allocate a new |
| 527 | // configuration object |
| 528 | //------------------------------------------------- |
| 529 | |
| 530 | device_config *einstein_fire_daisy_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 531 | { |
| 532 | return global_alloc(einstein_fire_daisy_device_config(mconfig, tag, owner, clock)); |
| 533 | } |
| 534 | |
| 535 | |
| 536 | //------------------------------------------------- |
| 537 | // alloc_device - allocate a new device object |
| 538 | //------------------------------------------------- |
| 539 | |
| 540 | device_t *einstein_fire_daisy_device_config::alloc_device(running_machine &machine) const |
| 541 | { |
| 542 | return auto_alloc(&machine, einstein_fire_daisy_device(machine, *this)); |
| 543 | } |
| 544 | |
| 545 | //************************************************************************** |
| 546 | // LIVE DEVICE |
| 547 | //************************************************************************** |
| 548 | |
| 549 | //------------------------------------------------- |
| 550 | // z80ctc_device - constructor |
| 551 | //------------------------------------------------- |
| 552 | |
| 553 | einstein_fire_daisy_device::einstein_fire_daisy_device(running_machine &_machine, const einstein_fire_daisy_device_config &_config) |
| 554 | : device_t(_machine, _config), |
| 555 | device_z80daisy_interface(_machine, _config, *this), |
| 556 | m_config(_config) |
| 557 | { |
| 558 | } |
| 559 | |
| 560 | //------------------------------------------------- |
| 561 | // device_start - device-specific startup |
| 562 | //------------------------------------------------- |
| 563 | |
| 564 | void einstein_fire_daisy_device::device_start() |
| 565 | { |
| 566 | } |
| 567 | |
| 568 | //************************************************************************** |
| 569 | // DAISY CHAIN INTERFACE |
| 570 | //************************************************************************** |
| 571 | |
| 572 | //------------------------------------------------- |
| 573 | // z80daisy_irq_state - return the overall IRQ |
| 574 | // state for this device |
| 575 | //------------------------------------------------- |
| 576 | |
| 577 | int einstein_fire_daisy_device::z80daisy_irq_state() |
| 578 | { |
| 579 | einstein_state *einstein = (einstein_state *)device().machine->driver_data; |
| 580 | |
| 581 | if (einstein->interrupt & einstein->interrupt_mask & EINSTEIN_FIRE_INT) |
| 582 | return Z80_DAISY_INT; |
| 583 | |
| 584 | return 0; |
| 585 | } |
| 586 | |
| 587 | |
| 588 | //------------------------------------------------- |
| 589 | // z80daisy_irq_ack - acknowledge an IRQ and |
| 590 | // return the appropriate vector |
| 591 | //------------------------------------------------- |
| 592 | |
| 593 | int einstein_fire_daisy_device::z80daisy_irq_ack() |
| 594 | { |
| 595 | return 0xfd; |
| 596 | } |
| 597 | |
| 598 | //------------------------------------------------- |
| 599 | // z80daisy_irq_reti - clear the interrupt |
| 600 | // pending state to allow other interrupts through |
| 601 | //------------------------------------------------- |
| 602 | |
| 603 | void einstein_fire_daisy_device::z80daisy_irq_reti() |
| 604 | { |
| 605 | } |
| 606 | |
| 607 | const device_type EINSTEIN_FIRE_DAISY = einstein_fire_daisy_device_config::static_alloc_device_config; |
| 608 | |
| 299 | 609 | /* int priority */ |
| 300 | 610 | /* keyboard int->ctc/adc->pio */ |
| 301 | 611 | static const z80_daisy_config einstein_daisy_chain[] = |
| 302 | 612 | { |
| 303 | | //{ "keyboard_daisy" }, |
| 613 | { "keyboard_daisy" }, |
| 304 | 614 | { IC_I058 }, |
| 305 | | //{ "adc_daisy" }, |
| 615 | { "adc_daisy" }, |
| 306 | 616 | { IC_I063 }, |
| 307 | | //{ "fire_daisy" }, |
| 617 | { "fire_daisy" }, |
| 308 | 618 | { NULL } |
| 309 | 619 | }; |
| 310 | 620 | |
| r8360 | r8361 | |
| 918 | 1228 | MDRV_TIMER_ADD_PERIODIC("ctc", einstein_ctc_trigger_callback, HZ(XTAL_X002 /4)) |
| 919 | 1229 | |
| 920 | 1230 | /* Einstein daisy chain support for non-Z80 devices */ |
| 921 | | //MDRV_DEVICE_ADD("keyboard_daisy", DEVICE_GET_INFO_NAME(einstein_keyboard_daisy), 0) |
| 922 | | //MDRV_DEVICE_ADD("adc_daisy", DEVICE_GET_INFO_NAME(einstein_adc_daisy), 0) |
| 923 | | //MDRV_DEVICE_ADD("fire_daisy", DEVICE_GET_INFO_NAME(einstein_fire_daisy), 0) |
| 1231 | MDRV_DEVICE_ADD("keyboard_daisy", EINSTEIN_KEYBOARD_DAISY, 0) |
| 1232 | MDRV_DEVICE_ADD("adc_daisy", EINSTEIN_ADC_DAISY, 0) |
| 1233 | MDRV_DEVICE_ADD("fire_daisy", EINSTEIN_FIRE_DAISY, 0) |
| 924 | 1234 | |
| 925 | 1235 | /* video hardware */ |
| 926 | 1236 | MDRV_IMPORT_FROM(tms9928a) |