src/mess/machine/conkort.c
| r4243 | r4244 | |
| 94 | 94 | #include "machine/wd17xx.h" |
| 95 | 95 | #include "machine/abcbus.h" |
| 96 | 96 | |
| 97 | /*************************************************************************** |
| 98 | PARAMETERS |
| 99 | ***************************************************************************/ |
| 100 | |
| 101 | #define Z80_TAG "5a" |
| 102 | #define Z80PIO_TAG "3a" |
| 103 | #define Z80DMA_TAG "z80dma" |
| 104 | #define WD1791_TAG "wd1791" |
| 105 | #define SAB1793_TAG "sab1793" |
| 106 | |
| 107 | /*************************************************************************** |
| 108 | TYPE DEFINITIONS |
| 109 | ***************************************************************************/ |
| 110 | |
| 97 | 111 | typedef struct _slow_t slow_t; |
| 98 | 112 | struct _slow_t |
| 99 | 113 | { |
| r4243 | r4244 | |
| 105 | 119 | /* devices */ |
| 106 | 120 | const device_config *cpu; |
| 107 | 121 | const device_config *z80pio; |
| 122 | const device_config *wd1791; |
| 108 | 123 | }; |
| 109 | 124 | |
| 110 | 125 | typedef struct _fast_t fast_t; |
| r4243 | r4244 | |
| 117 | 132 | /* devices */ |
| 118 | 133 | const device_config *cpu; |
| 119 | 134 | const device_config *z80dma; |
| 135 | const device_config *wd1793; |
| 120 | 136 | }; |
| 121 | 137 | |
| 138 | /*************************************************************************** |
| 139 | INLINE FUNCTIONS |
| 140 | ***************************************************************************/ |
| 141 | |
| 122 | 142 | INLINE slow_t *get_safe_token_slow(const device_config *device) |
| 123 | 143 | { |
| 124 | 144 | assert(device != NULL); |
| 125 | 145 | assert(device->token != NULL); |
| 126 | | |
| 127 | 146 | return (slow_t *)device->token; |
| 128 | 147 | } |
| 129 | 148 | |
| r4243 | r4244 | |
| 131 | 150 | { |
| 132 | 151 | assert(device != NULL); |
| 133 | 152 | assert(device->token != NULL); |
| 134 | | |
| 135 | 153 | return (fast_t *)device->token; |
| 136 | 154 | } |
| 137 | 155 | |
| r4243 | r4244 | |
| 147 | 165 | return get_safe_token_fast(device); |
| 148 | 166 | } |
| 149 | 167 | |
| 150 | | static const device_config *get_floppy_image(running_machine *machine, int drive) |
| 168 | INLINE const device_config *get_floppy_image(running_machine *machine, int drive) |
| 151 | 169 | { |
| 152 | 170 | return image_from_devtype_and_index(machine, IO_FLOPPY, drive); |
| 153 | 171 | } |
| 154 | 172 | |
| 173 | /*************************************************************************** |
| 174 | IMPLEMENTATION |
| 175 | ***************************************************************************/ |
| 155 | 176 | |
| 156 | 177 | /* Slow Controller */ |
| 157 | 178 | |
| r4243 | r4244 | |
| 229 | 250 | |
| 230 | 251 | static WRITE8_HANDLER( slow_ctrl_w ) |
| 231 | 252 | { |
| 232 | | device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x"); |
| 233 | 253 | /* |
| 234 | 254 | |
| 235 | 255 | bit description |
| r4243 | r4244 | |
| 245 | 265 | |
| 246 | 266 | */ |
| 247 | 267 | |
| 268 | slow_t *conkort = get_safe_token_machine_slow(space->machine); |
| 269 | |
| 248 | 270 | /* drive selection */ |
| 249 | | if (!BIT(data, 0)) wd17xx_set_drive(fdc,0); |
| 250 | | if (!BIT(data, 1)) wd17xx_set_drive(fdc,1); |
| 251 | | // if (!BIT(data, 2)) wd17xx_set_drive(fdc,2); |
| 271 | if (!BIT(data, 0)) wd17xx_set_drive(conkort->wd1791, 0); |
| 272 | if (!BIT(data, 1)) wd17xx_set_drive(conkort->wd1791, 1); |
| 273 | // if (!BIT(data, 2)) wd17xx_set_drive(conkort->wd1791, 2); |
| 252 | 274 | |
| 253 | 275 | /* motor enable */ |
| 254 | 276 | floppy_drive_set_motor_state(get_floppy_image(space->machine, 0), !BIT(data, 3)); |
| r4243 | r4244 | |
| 257 | 279 | floppy_drive_set_ready_state(get_floppy_image(space->machine, 1), 1, 1); |
| 258 | 280 | |
| 259 | 281 | /* disk side selection */ |
| 260 | | wd17xx_set_side(fdc,!BIT(data, 4)); |
| 282 | wd17xx_set_side(conkort->wd1791,!BIT(data, 4)); |
| 261 | 283 | |
| 262 | 284 | if (!BIT(data, 7)) |
| 263 | 285 | { |
| 264 | 286 | /* FDC master reset */ |
| 265 | | wd17xx_reset(fdc); |
| 287 | wd17xx_reset(conkort->wd1791); |
| 266 | 288 | } |
| 267 | 289 | } |
| 268 | 290 | |
| r4243 | r4244 | |
| 411 | 433 | |
| 412 | 434 | static ADDRESS_MAP_START( slow_io_map, ADDRESS_SPACE_IO, 8 ) |
| 413 | 435 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 414 | | AM_RANGE(0x7c, 0x7f) AM_DEVREADWRITE(Z80PIO, CONKORT_Z80PIO_TAG, z80pio_alt_r, z80pio_alt_w) |
| 415 | | AM_RANGE(0xbc, 0xbf) AM_DEVREADWRITE(WD179X, "wd179x", wd17xx_r, wd17xx_w) |
| 436 | AM_RANGE(0x7c, 0x7f) AM_DEVREADWRITE(Z80PIO, Z80PIO_TAG, z80pio_alt_r, z80pio_alt_w) |
| 437 | AM_RANGE(0xbc, 0xbf) AM_DEVREADWRITE(WD179X, WD1791_TAG, wd17xx_r, wd17xx_w) |
| 416 | 438 | AM_RANGE(0xdf, 0xdf) AM_WRITE(slow_status_w) |
| 417 | 439 | AM_RANGE(0xef, 0xef) AM_WRITE(slow_ctrl_w) |
| 418 | 440 | ADDRESS_MAP_END |
| r4243 | r4244 | |
| 432 | 454 | // AM_RANGE(0x3f, 0x3f) AM_WRITE() |
| 433 | 455 | // AM_RANGE(0x4f, 0x4f) AM_WRITE() |
| 434 | 456 | AM_RANGE(0x5d, 0x5d) AM_READ(fast_ctrl_r) |
| 435 | | AM_RANGE(0x68, 0x6b) AM_DEVREAD(WD1793, "wd1793", wd17xx_r) |
| 436 | | AM_RANGE(0x78, 0x7b) AM_DEVWRITE(WD1793, "wd1793", wd17xx_w) |
| 437 | | AM_RANGE(0x87, 0x87) AM_DEVREADWRITE(Z80DMA, CONKORT_Z80DMA_TAG, z80dma_r, z80dma_w) |
| 457 | AM_RANGE(0x68, 0x6b) AM_DEVREAD(WD1793, SAB1793_TAG, wd17xx_r) |
| 458 | AM_RANGE(0x78, 0x7b) AM_DEVWRITE(WD1793, SAB1793_TAG, wd17xx_w) |
| 459 | AM_RANGE(0x87, 0x87) AM_DEVREADWRITE(Z80DMA, Z80DMA_TAG, z80dma_r, z80dma_w) |
| 438 | 460 | ADDRESS_MAP_END |
| 439 | 461 | |
| 440 | 462 | /* Input Ports */ |
| r4243 | r4244 | |
| 572 | 594 | |
| 573 | 595 | static const z80_daisy_chain slow_daisy_chain[] = |
| 574 | 596 | { |
| 575 | | { Z80PIO, CONKORT_Z80PIO_TAG }, |
| 597 | { Z80PIO, Z80PIO_TAG }, |
| 576 | 598 | { NULL } |
| 577 | 599 | }; |
| 578 | 600 | |
| r4243 | r4244 | |
| 684 | 706 | |
| 685 | 707 | static const z80_daisy_chain fast_daisy_chain[] = |
| 686 | 708 | { |
| 687 | | { Z80DMA, CONKORT_Z80DMA_TAG }, |
| 709 | { Z80DMA, Z80DMA_TAG }, |
| 688 | 710 | { NULL } |
| 689 | 711 | }; |
| 690 | 712 | |
| r4243 | r4244 | |
| 709 | 731 | } |
| 710 | 732 | } |
| 711 | 733 | |
| 712 | | static const wd17xx_interface slow_wd17xx_interface = { slow_wd1791_callback, NULL }; |
| 734 | static const wd17xx_interface slow_wd17xx_interface = |
| 735 | { |
| 736 | slow_wd1791_callback, |
| 737 | NULL |
| 738 | }; |
| 713 | 739 | |
| 714 | 740 | /* FD1793 */ |
| 715 | 741 | |
| r4243 | r4244 | |
| 732 | 758 | } |
| 733 | 759 | } |
| 734 | 760 | |
| 735 | | static const wd17xx_interface fast_wd17xx_interface = { fast_wd1793_callback }; |
| 761 | static const wd17xx_interface fast_wd17xx_interface = |
| 762 | { |
| 763 | fast_wd1793_callback |
| 764 | }; |
| 736 | 765 | |
| 737 | 766 | /* Machine Driver */ |
| 738 | 767 | |
| 739 | 768 | static MACHINE_DRIVER_START( luxor_55_10828 ) |
| 740 | | MDRV_CPU_ADD(CONKORT_Z80_TAG, Z80, XTAL_4MHz/2) |
| 769 | MDRV_CPU_ADD(Z80_TAG, Z80, XTAL_4MHz/2) |
| 741 | 770 | MDRV_CPU_PROGRAM_MAP(slow_map, 0) |
| 742 | 771 | MDRV_CPU_IO_MAP(slow_io_map, 0) |
| 743 | 772 | MDRV_CPU_CONFIG(slow_daisy_chain) |
| 744 | 773 | |
| 745 | | MDRV_Z80PIO_ADD(CONKORT_Z80PIO_TAG, conkort_pio_intf) |
| 746 | | MDRV_WD179X_ADD("wd179x", slow_wd17xx_interface ) |
| 774 | MDRV_Z80PIO_ADD(Z80PIO_TAG, conkort_pio_intf) |
| 775 | MDRV_WD179X_ADD(WD1791_TAG, slow_wd17xx_interface ) |
| 747 | 776 | MACHINE_DRIVER_END |
| 748 | 777 | |
| 749 | 778 | static MACHINE_DRIVER_START( luxor_55_21046 ) |
| 750 | | MDRV_CPU_ADD(CONKORT_Z80_TAG, Z80, XTAL_16MHz/4) |
| 779 | MDRV_CPU_ADD(Z80_TAG, Z80, XTAL_16MHz/4) |
| 751 | 780 | MDRV_CPU_PROGRAM_MAP(fast_map, 0) |
| 752 | 781 | MDRV_CPU_IO_MAP(fast_io_map, 0) |
| 753 | 782 | MDRV_CPU_CONFIG(fast_daisy_chain) |
| 754 | 783 | |
| 755 | | MDRV_Z80DMA_ADD(CONKORT_Z80DMA_TAG, XTAL_16MHz/4, dma_intf) |
| 756 | | |
| 757 | | MDRV_WD1793_ADD("wd1793", fast_wd17xx_interface ) |
| 784 | MDRV_Z80DMA_ADD(Z80DMA_TAG, XTAL_16MHz/4, dma_intf) |
| 785 | MDRV_WD1793_ADD(SAB1793_TAG, fast_wd17xx_interface ) |
| 758 | 786 | MACHINE_DRIVER_END |
| 759 | 787 | |
| 760 | 788 | /* ROMs */ |
| r4243 | r4244 | |
| 804 | 832 | ROM_LOAD( "st225.bin", 0x0800, 0x0800, CRC(c9f68f81) SHA1(7ff8b2a19f71fe0279ab3e5a0a5fffcb6030360c) ) // Seagate ST225 |
| 805 | 833 | ROM_END |
| 806 | 834 | |
| 807 | | /* Device Interface */ |
| 835 | /*------------------------------------------------- |
| 836 | DEVICE_START( luxor_55_10828 ) |
| 837 | -------------------------------------------------*/ |
| 808 | 838 | |
| 809 | 839 | static DEVICE_START( luxor_55_10828 ) |
| 810 | 840 | { |
| r4243 | r4244 | |
| 815 | 845 | assert(device->tag != NULL); |
| 816 | 846 | |
| 817 | 847 | /* find our CPU */ |
| 818 | | astring_printf(tempstring, "%s:%s", device->tag, CONKORT_Z80_TAG); |
| 848 | astring_printf(tempstring, "%s:%s", device->tag, Z80_TAG); |
| 819 | 849 | conkort->cpu = cputag_get_cpu(device->machine, astring_c(tempstring)); |
| 820 | 850 | |
| 821 | 851 | /* find devices */ |
| 822 | | astring_printf(tempstring, "%s:%s", device->tag, CONKORT_Z80PIO_TAG); |
| 852 | astring_printf(tempstring, "%s:%s", device->tag, Z80PIO_TAG); |
| 823 | 853 | conkort->z80pio = devtag_get_device(device->machine, Z80PIO, astring_c(tempstring)); |
| 854 | astring_printf(tempstring, "%s:%s", device->tag, WD1791_TAG); |
| 855 | conkort->wd1791 = devtag_get_device(device->machine, Z80DMA, astring_c(tempstring)); |
| 824 | 856 | |
| 825 | 857 | /* register for state saving */ |
| 826 | 858 | state_save_register_device_item(device, 0, conkort->status); |
| r4243 | r4244 | |
| 831 | 863 | astring_free(tempstring); |
| 832 | 864 | } |
| 833 | 865 | |
| 866 | /*------------------------------------------------- |
| 867 | DEVICE_RESET( luxor_55_10828 ) |
| 868 | -------------------------------------------------*/ |
| 869 | |
| 834 | 870 | static DEVICE_RESET( luxor_55_10828 ) |
| 835 | 871 | { |
| 836 | 872 | |
| 837 | 873 | } |
| 838 | 874 | |
| 875 | /*------------------------------------------------- |
| 876 | DEVICE_SET_INFO( luxor_55_10828 ) |
| 877 | -------------------------------------------------*/ |
| 878 | |
| 839 | 879 | static DEVICE_SET_INFO( luxor_55_10828 ) |
| 840 | 880 | { |
| 841 | 881 | switch (state) |
| r4243 | r4244 | |
| 844 | 884 | } |
| 845 | 885 | } |
| 846 | 886 | |
| 887 | /*------------------------------------------------- |
| 888 | DEVICE_GET_INFO( luxor_55_10828 ) |
| 889 | -------------------------------------------------*/ |
| 890 | |
| 847 | 891 | DEVICE_GET_INFO( luxor_55_10828 ) |
| 848 | 892 | { |
| 849 | 893 | switch (state) |
| r4243 | r4244 | |
| 865 | 909 | case DEVINFO_FCT_ABCBUS_CARD_SELECT: info->f = (genf *)ABCBUS_CARD_SELECT_NAME(luxor_55_10828); break; |
| 866 | 910 | |
| 867 | 911 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 868 | | case DEVINFO_STR_NAME: strcpy(info->s, "Luxor 55 10828-01"); break; |
| 869 | | case DEVINFO_STR_FAMILY: strcpy(info->s, "Luxor ABC"); break; |
| 870 | | case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; |
| 871 | | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 872 | | case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright the MESS Team"); break; |
| 912 | case DEVINFO_STR_NAME: strcpy(info->s, "Luxor 55 10828-01"); break; |
| 913 | case DEVINFO_STR_FAMILY: strcpy(info->s, "Luxor ABC"); break; |
| 914 | case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; |
| 915 | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 916 | case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright the MESS Team"); break; |
| 873 | 917 | } |
| 874 | 918 | } |
| 875 | 919 | |
| 920 | /*------------------------------------------------- |
| 921 | DEVICE_START( luxor_55_21046 ) |
| 922 | -------------------------------------------------*/ |
| 923 | |
| 876 | 924 | static DEVICE_START( luxor_55_21046 ) |
| 877 | 925 | { |
| 878 | 926 | fast_t *conkort = device->token; |
| r4243 | r4244 | |
| 882 | 930 | assert(device->tag != NULL); |
| 883 | 931 | |
| 884 | 932 | /* find our CPU */ |
| 885 | | astring_printf(tempstring, "%s:%s", device->tag, CONKORT_Z80_TAG); |
| 933 | astring_printf(tempstring, "%s:%s", device->tag, Z80_TAG); |
| 886 | 934 | conkort->cpu = cputag_get_cpu(device->machine, astring_c(tempstring)); |
| 887 | 935 | |
| 888 | 936 | /* find devices */ |
| 889 | | astring_printf(tempstring, "%s:%s", device->tag, CONKORT_Z80DMA_TAG); |
| 937 | astring_printf(tempstring, "%s:%s", device->tag, Z80DMA_TAG); |
| 890 | 938 | conkort->z80dma = devtag_get_device(device->machine, Z80DMA, astring_c(tempstring)); |
| 939 | astring_printf(tempstring, "%s:%s", device->tag, SAB1793_TAG); |
| 940 | conkort->wd1793 = devtag_get_device(device->machine, Z80DMA, astring_c(tempstring)); |
| 891 | 941 | |
| 892 | 942 | /* register for state saving */ |
| 893 | 943 | state_save_register_device_item(device, 0, conkort->status); |
| r4243 | r4244 | |
| 897 | 947 | astring_free(tempstring); |
| 898 | 948 | } |
| 899 | 949 | |
| 950 | /*------------------------------------------------- |
| 951 | DEVICE_RESET( luxor_55_21046 ) |
| 952 | -------------------------------------------------*/ |
| 953 | |
| 900 | 954 | static DEVICE_RESET( luxor_55_21046 ) |
| 901 | 955 | { |
| 902 | 956 | } |
| 903 | 957 | |
| 958 | /*------------------------------------------------- |
| 959 | DEVICE_SET_INFO( luxor_55_21046 ) |
| 960 | -------------------------------------------------*/ |
| 961 | |
| 904 | 962 | static DEVICE_SET_INFO( luxor_55_21046 ) |
| 905 | 963 | { |
| 906 | 964 | switch (state) |
| r4243 | r4244 | |
| 909 | 967 | } |
| 910 | 968 | } |
| 911 | 969 | |
| 970 | /*------------------------------------------------- |
| 971 | DEVICE_GET_INFO( luxor_55_21046 ) |
| 972 | -------------------------------------------------*/ |
| 973 | |
| 912 | 974 | DEVICE_GET_INFO( luxor_55_21046 ) |
| 913 | 975 | { |
| 914 | 976 | switch (state) |
| r4243 | r4244 | |
| 930 | 992 | case DEVINFO_FCT_ABCBUS_CARD_SELECT: info->f = (genf *)ABCBUS_CARD_SELECT_NAME(luxor_55_21046); break; |
| 931 | 993 | |
| 932 | 994 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 933 | | case DEVINFO_STR_NAME: strcpy(info->s, "Luxor Conkort 55 21046-xx"); break; |
| 934 | | case DEVINFO_STR_FAMILY: strcpy(info->s, "Luxor ABC"); break; |
| 935 | | case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; |
| 936 | | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 937 | | case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright the MESS Team"); break; |
| 995 | case DEVINFO_STR_NAME: strcpy(info->s, "Luxor Conkort 55 21046-xx"); break; |
| 996 | case DEVINFO_STR_FAMILY: strcpy(info->s, "Luxor ABC"); break; |
| 997 | case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; |
| 998 | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 999 | case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright the MESS Team"); break; |
| 938 | 1000 | } |
| 939 | 1001 | } |
src/mess/machine/z80dart.c
| r4243 | r4244 | |
| 11 | 11 | |
| 12 | 12 | TODO: |
| 13 | 13 | |
| 14 | | - save state support |
| 15 | 14 | - break detection |
| 16 | 15 | - wr0 reset tx interrupt pending |
| 17 | 16 | - wait/ready |
| r4243 | r4244 | |
| 25 | 24 | #include "cpu/z80/z80daisy.h" |
| 26 | 25 | |
| 27 | 26 | /*************************************************************************** |
| 28 | | DEBUGGING |
| 27 | PARAMETERS |
| 29 | 28 | ***************************************************************************/ |
| 30 | 29 | |
| 31 | 30 | #define VERBOSE 0 |
| 32 | 31 | |
| 33 | 32 | #define LOG(x) do { if (VERBOSE) logerror x; } while (0) |
| 34 | 33 | |
| 35 | | /*************************************************************************** |
| 36 | | CONSTANTS |
| 37 | | ***************************************************************************/ |
| 38 | | |
| 39 | 34 | enum |
| 40 | 35 | { |
| 41 | 36 | STATE_START = 0, |
| r4243 | r4244 | |
| 125 | 120 | typedef struct _dart_channel dart_channel; |
| 126 | 121 | struct _dart_channel |
| 127 | 122 | { |
| 123 | devcb_resolved_read_line in_rxd_func; |
| 124 | devcb_resolved_write_line out_txd_func; |
| 125 | devcb_resolved_write_line out_dtr_func; |
| 126 | devcb_resolved_write_line out_rts_func; |
| 127 | devcb_resolved_write_line out_wrdy_func; |
| 128 | |
| 128 | 129 | /* register state */ |
| 129 | 130 | UINT8 rr[3]; /* read register */ |
| 130 | 131 | UINT8 wr[6]; /* write register */ |
| r4243 | r4244 | |
| 142 | 143 | int rx_first; /* first character received */ |
| 143 | 144 | int rx_parity; /* received data parity */ |
| 144 | 145 | int rx_break; /* receive break condition */ |
| 145 | | int rx_rr0_latch; /* read register 0 latched */ |
| 146 | UINT8 rx_rr0_latch; /* read register 0 latched */ |
| 146 | 147 | |
| 147 | 148 | int ri; /* ring indicator latch */ |
| 148 | 149 | int cts; /* clear to send latch */ |
| r4243 | r4244 | |
| 164 | 165 | typedef struct _z80dart_t z80dart_t; |
| 165 | 166 | struct _z80dart_t |
| 166 | 167 | { |
| 167 | | const z80dart_interface *intf; /* interface */ |
| 168 | | |
| 168 | devcb_resolved_write_line out_int_func; |
| 169 | |
| 169 | 170 | dart_channel channel[2]; /* channels */ |
| 170 | 171 | |
| 171 | | int clock; /* base clock */ |
| 172 | 172 | int int_state[8]; /* interrupt state */ |
| 173 | 173 | |
| 174 | 174 | /* timers */ |
| r4243 | r4244 | |
| 193 | 193 | assert(device != NULL); |
| 194 | 194 | assert(device->token != NULL); |
| 195 | 195 | assert(device->type == Z80DART); |
| 196 | | |
| 197 | 196 | return (z80dart_t *)device->token; |
| 198 | 197 | } |
| 199 | 198 | |
| 200 | | /*************************************************************************** |
| 201 | | CALLBACK INTERFACE MANAGEMENT |
| 202 | | ***************************************************************************/ |
| 203 | | |
| 204 | | static int z80dart_rxd_r(const device_config *device, int channel) |
| 199 | INLINE const z80dart_interface *get_interface(const device_config *device) |
| 205 | 200 | { |
| 206 | | z80dart_t *z80dart = get_safe_token(device); |
| 207 | | |
| 208 | | int data = 1; |
| 209 | | |
| 210 | | if (z80dart->intf->rxd_r) |
| 211 | | { |
| 212 | | data = z80dart->intf->rxd_r(device, channel); |
| 213 | | } |
| 214 | | |
| 215 | | return data; |
| 201 | assert(device != NULL); |
| 202 | assert((device->type == Z80DART)); |
| 203 | return (const z80dart_interface *) device->static_config; |
| 216 | 204 | } |
| 217 | 205 | |
| 218 | | static void z80dart_txd_w(const device_config *device, int channel, int state) |
| 219 | | { |
| 220 | | z80dart_t *z80dart = get_safe_token(device); |
| 206 | /*************************************************************************** |
| 207 | IMPLEMENTATION |
| 208 | ***************************************************************************/ |
| 221 | 209 | |
| 222 | | if (z80dart->intf->on_txd_changed) |
| 223 | | { |
| 224 | | z80dart->intf->on_txd_changed(device, channel, state); |
| 225 | | } |
| 226 | | } |
| 210 | #define RXD \ |
| 211 | devcb_call_read_line(&ch->in_rxd_func) |
| 227 | 212 | |
| 228 | | static void z80dart_rts_w(const device_config *device, int channel, int state) |
| 229 | | { |
| 230 | | z80dart_t *z80dart = get_safe_token(device); |
| 213 | #define TXD(_state) \ |
| 214 | devcb_call_write_line(&ch->out_txd_func, _state) |
| 231 | 215 | |
| 232 | | if (z80dart->intf->on_rts_changed) |
| 233 | | { |
| 234 | | z80dart->intf->on_rts_changed(device, channel, state); |
| 235 | | } |
| 216 | #define RTS(_state) \ |
| 217 | devcb_call_write_line(&ch->out_rts_func, _state) |
| 236 | 218 | |
| 237 | | LOG(("Z80DART \"%s\" Channel %c : RTS %u\n", device->tag, 'A' + channel, state)); |
| 238 | | } |
| 219 | #define DTR(_state) \ |
| 220 | devcb_call_write_line(&ch->out_dtr_func, _state) |
| 239 | 221 | |
| 240 | | static void z80dart_dtr_w(const device_config *device, int channel, int state) |
| 241 | | { |
| 242 | | z80dart_t *z80dart = get_safe_token(device); |
| 222 | /*------------------------------------------------- |
| 223 | check_interrupts - control interrupt line |
| 224 | -------------------------------------------------*/ |
| 243 | 225 | |
| 244 | | if (z80dart->intf->on_dtr_changed) |
| 245 | | { |
| 246 | | z80dart->intf->on_dtr_changed(device, channel, state); |
| 247 | | } |
| 248 | | |
| 249 | | LOG(("Z80DART \"%s\" Channel %c : DTR %u\n", device->tag, 'A' + channel, state)); |
| 250 | | } |
| 251 | | |
| 252 | | /*************************************************************************** |
| 253 | | INTERNAL STATE MANAGEMENT |
| 254 | | ***************************************************************************/ |
| 255 | | |
| 256 | | static void z80dart_check_interrupt(const device_config *device) |
| 226 | static void check_interrupts(const device_config *device) |
| 257 | 227 | { |
| 258 | 228 | z80dart_t *z80dart = get_safe_token(device); |
| 259 | 229 | int state = (z80dart_irq_state(device) & Z80_DAISY_INT) ? ASSERT_LINE : CLEAR_LINE; |
| 260 | 230 | |
| 261 | | if (z80dart->intf->on_int_changed) |
| 262 | | { |
| 263 | | z80dart->intf->on_int_changed(device, state); |
| 264 | | } |
| 231 | devcb_call_write_line(&z80dart->out_int_func, state); |
| 265 | 232 | } |
| 266 | 233 | |
| 267 | | static void z80dart_trigger_interrupt(const device_config *device, int channel, int level) |
| 234 | /*------------------------------------------------- |
| 235 | take_interrupt - trigger interrupt |
| 236 | -------------------------------------------------*/ |
| 237 | |
| 238 | static void take_interrupt(const device_config *device, int channel, int level) |
| 268 | 239 | { |
| 269 | 240 | z80dart_t *z80dart = get_safe_token(device); |
| 270 | 241 | dart_channel *ch = &z80dart->channel[channel]; |
| r4243 | r4244 | |
| 287 | 258 | z80dart->channel[Z80DART_CH_A].rr[0] |= Z80DART_RR0_INTERRUPT_PENDING; |
| 288 | 259 | |
| 289 | 260 | /* check for interrupt */ |
| 290 | | z80dart_check_interrupt(device); |
| 261 | check_interrupts(device); |
| 291 | 262 | } |
| 292 | 263 | |
| 293 | | static int z80dart_get_clock_mode(const device_config *device, int channel) |
| 264 | /*------------------------------------------------- |
| 265 | get_clock_mode - get clock divisor |
| 266 | -------------------------------------------------*/ |
| 267 | |
| 268 | static int get_clock_mode(dart_channel *ch) |
| 294 | 269 | { |
| 295 | | z80dart_t *z80dart = get_safe_token(device); |
| 296 | | dart_channel *ch = &z80dart->channel[channel]; |
| 297 | | |
| 298 | 270 | int clocks = 1; |
| 299 | 271 | |
| 300 | 272 | switch (ch->wr[4] & Z80DART_WR4_CLOCK_MODE_MASK) |
| 301 | 273 | { |
| 302 | | case Z80DART_WR4_CLOCK_MODE_X1: |
| 303 | | clocks = 1; |
| 304 | | |
| 305 | | case Z80DART_WR4_CLOCK_MODE_X16: |
| 306 | | clocks = 16; |
| 307 | | |
| 308 | | case Z80DART_WR4_CLOCK_MODE_X32: |
| 309 | | clocks = 32; |
| 310 | | |
| 311 | | case Z80DART_WR4_CLOCK_MODE_X64: |
| 312 | | clocks = 64; |
| 274 | case Z80DART_WR4_CLOCK_MODE_X1: clocks = 1; break; |
| 275 | case Z80DART_WR4_CLOCK_MODE_X16: clocks = 16; break; |
| 276 | case Z80DART_WR4_CLOCK_MODE_X32: clocks = 32; break; |
| 277 | case Z80DART_WR4_CLOCK_MODE_X64: clocks = 64; break; |
| 313 | 278 | } |
| 314 | 279 | |
| 315 | 280 | return clocks; |
| 316 | 281 | } |
| 317 | 282 | |
| 318 | | static float z80dart_get_stop_bits(const device_config *device, int channel) |
| 283 | /*------------------------------------------------- |
| 284 | get_stop_bits - get number of stop bits |
| 285 | -------------------------------------------------*/ |
| 286 | |
| 287 | static float get_stop_bits(dart_channel *ch) |
| 319 | 288 | { |
| 320 | | z80dart_t *z80dart = get_safe_token(device); |
| 321 | | dart_channel *ch = &z80dart->channel[channel]; |
| 322 | | |
| 323 | 289 | float bits = 1; |
| 324 | 290 | |
| 325 | 291 | switch (ch->wr[4] & Z80DART_WR4_STOP_BITS_MASK) |
| 326 | 292 | { |
| 327 | | case Z80DART_WR4_STOP_BITS_1: |
| 328 | | bits = 1; |
| 329 | | |
| 330 | | case Z80DART_WR4_STOP_BITS_1_5: |
| 331 | | bits = 1.5; |
| 332 | | |
| 333 | | case Z80DART_WR4_STOP_BITS_2: |
| 334 | | bits = 2; |
| 293 | case Z80DART_WR4_STOP_BITS_1: bits = 1; break; |
| 294 | case Z80DART_WR4_STOP_BITS_1_5: bits = 1.5; break; |
| 295 | case Z80DART_WR4_STOP_BITS_2: bits = 2; break; |
| 335 | 296 | } |
| 336 | 297 | |
| 337 | 298 | return bits; |
| 338 | 299 | } |
| 339 | 300 | |
| 340 | | static int z80dart_get_rx_word_length(const device_config *device, int channel) |
| 301 | /*------------------------------------------------- |
| 302 | get_rx_word_length - get receive word length |
| 303 | -------------------------------------------------*/ |
| 304 | |
| 305 | static int get_rx_word_length(dart_channel *ch) |
| 341 | 306 | { |
| 342 | | z80dart_t *z80dart = get_safe_token(device); |
| 343 | | dart_channel *ch = &z80dart->channel[channel]; |
| 344 | | |
| 345 | 307 | int bits = 5; |
| 346 | 308 | |
| 347 | 309 | switch (ch->wr[3] & Z80DART_WR3_RX_WORD_LENGTH_MASK) |
| 348 | 310 | { |
| 349 | | case Z80DART_WR3_RX_WORD_LENGTH_5: |
| 350 | | bits = 5; |
| 351 | | |
| 352 | | case Z80DART_WR3_RX_WORD_LENGTH_6: |
| 353 | | bits = 6; |
| 354 | | |
| 355 | | case Z80DART_WR3_RX_WORD_LENGTH_7: |
| 356 | | bits = 7; |
| 357 | | |
| 358 | | case Z80DART_WR3_RX_WORD_LENGTH_8: |
| 359 | | bits = 8; |
| 311 | case Z80DART_WR3_RX_WORD_LENGTH_5: bits = 5; break; |
| 312 | case Z80DART_WR3_RX_WORD_LENGTH_6: bits = 6; break; |
| 313 | case Z80DART_WR3_RX_WORD_LENGTH_7: bits = 7; break; |
| 314 | case Z80DART_WR3_RX_WORD_LENGTH_8: bits = 8; break; |
| 360 | 315 | } |
| 361 | 316 | |
| 362 | 317 | return bits; |
| 363 | 318 | } |
| 364 | 319 | |
| 365 | | static int z80dart_get_tx_word_length(const device_config *device, int channel) |
| 320 | /*------------------------------------------------- |
| 321 | get_rx_word_length - get transmit word length |
| 322 | -------------------------------------------------*/ |
| 323 | |
| 324 | static int get_tx_word_length(dart_channel *ch) |
| 366 | 325 | { |
| 367 | | z80dart_t *z80dart = get_safe_token(device); |
| 368 | | dart_channel *ch = &z80dart->channel[channel]; |
| 369 | | |
| 370 | 326 | int bits = 5; |
| 371 | 327 | |
| 372 | 328 | switch (ch->wr[5] & Z80DART_WR5_TX_WORD_LENGTH_MASK) |
| 373 | 329 | { |
| 374 | | case Z80DART_WR5_TX_WORD_LENGTH_5: |
| 375 | | bits = 5; |
| 376 | | |
| 377 | | case Z80DART_WR5_TX_WORD_LENGTH_6: |
| 378 | | bits = 6; |
| 379 | | |
| 380 | | case Z80DART_WR5_TX_WORD_LENGTH_7: |
| 381 | | bits = 7; |
| 382 | | |
| 383 | | case Z80DART_WR5_TX_WORD_LENGTH_8: |
| 384 | | bits = 8; |
| 330 | case Z80DART_WR5_TX_WORD_LENGTH_5: bits = 5; break; |
| 331 | case Z80DART_WR5_TX_WORD_LENGTH_6: bits = 6; break; |
| 332 | case Z80DART_WR5_TX_WORD_LENGTH_7: bits = 7; break; |
| 333 | case Z80DART_WR5_TX_WORD_LENGTH_8: bits = 8; break; |
| 385 | 334 | } |
| 386 | 335 | |
| 387 | 336 | return bits; |
| 388 | 337 | } |
| 389 | 338 | |
| 390 | | static void z80dart_reset_channel(const device_config *device, int channel) |
| 339 | /*------------------------------------------------- |
| 340 | reset_channel - reset channel status |
| 341 | -------------------------------------------------*/ |
| 342 | |
| 343 | static void reset_channel(const device_config *device, int channel) |
| 391 | 344 | { |
| 392 | 345 | z80dart_t *z80dart = get_safe_token(device); |
| 393 | 346 | dart_channel *ch = &z80dart->channel[channel]; |
| r4243 | r4244 | |
| 401 | 354 | ch->tx_state = STATE_START; |
| 402 | 355 | |
| 403 | 356 | /* reset external lines */ |
| 404 | | z80dart_rts_w(device, channel, 1); |
| 405 | | z80dart_dtr_w(device, channel, 1); |
| 357 | RTS(1); |
| 358 | DTR(1); |
| 406 | 359 | |
| 407 | 360 | if (channel == Z80DART_CH_A) |
| 408 | 361 | { |
| r4243 | r4244 | |
| 414 | 367 | z80dart->int_state[i] = 0; |
| 415 | 368 | } |
| 416 | 369 | |
| 417 | | z80dart_check_interrupt(device); |
| 370 | check_interrupts(device); |
| 418 | 371 | } |
| 419 | 372 | } |
| 420 | 373 | |
| 421 | | /*************************************************************************** |
| 422 | | SERIAL RECEIVE |
| 423 | | ***************************************************************************/ |
| 374 | /*------------------------------------------------- |
| 375 | detect_start_bit - detect start bit |
| 376 | -------------------------------------------------*/ |
| 424 | 377 | |
| 425 | | static int detect_start_bit(const device_config *device, int channel) |
| 378 | static int detect_start_bit(dart_channel *ch) |
| 426 | 379 | { |
| 427 | | z80dart_t *z80dart = get_safe_token(device); |
| 428 | | dart_channel *ch = &z80dart->channel[channel]; |
| 429 | | |
| 430 | | if (!(ch->wr[3] & Z80DART_WR3_RX_ENABLE)) |
| 431 | | return 0; |
| 380 | if (!(ch->wr[3] & Z80DART_WR3_RX_ENABLE)) return 0; |
| 432 | 381 | |
| 433 | | return !z80dart_rxd_r(device, channel); |
| 382 | return !RXD; |
| 434 | 383 | } |
| 435 | 384 | |
| 436 | | static void shift_data_in(const device_config *device, int channel) |
| 385 | /*------------------------------------------------- |
| 386 | shift_data_in - shift in serial data |
| 387 | -------------------------------------------------*/ |
| 388 | |
| 389 | static void shift_data_in(dart_channel *ch) |
| 437 | 390 | { |
| 438 | | z80dart_t *z80dart = get_safe_token(device); |
| 439 | | dart_channel *ch = &z80dart->channel[channel]; |
| 440 | | |
| 441 | 391 | if (ch->rx_bits < 8) |
| 442 | 392 | { |
| 443 | | int rxd = z80dart_rxd_r(device, channel); |
| 393 | int rxd = RXD; |
| 444 | 394 | |
| 445 | 395 | ch->rx_shift >>= 1; |
| 446 | 396 | ch->rx_shift = (rxd << 7) | (ch->rx_shift & 0x7f); |
| r4243 | r4244 | |
| 449 | 399 | } |
| 450 | 400 | } |
| 451 | 401 | |
| 452 | | static int character_completed(const device_config *device, int channel) |
| 402 | /*------------------------------------------------- |
| 403 | character_completed - check if complete |
| 404 | data word has been transferred |
| 405 | -------------------------------------------------*/ |
| 406 | |
| 407 | static int character_completed(dart_channel *ch) |
| 453 | 408 | { |
| 454 | | z80dart_t *z80dart = get_safe_token(device); |
| 455 | | dart_channel *ch = &z80dart->channel[channel]; |
| 456 | | |
| 457 | | return ch->rx_bits == z80dart_get_rx_word_length(device, channel); |
| 409 | return ch->rx_bits == get_rx_word_length(ch); |
| 458 | 410 | } |
| 459 | 411 | |
| 412 | /*------------------------------------------------- |
| 413 | detect_parity_error - detect parity error |
| 414 | -------------------------------------------------*/ |
| 415 | |
| 460 | 416 | static void detect_parity_error(const device_config *device, int channel) |
| 461 | 417 | { |
| 462 | 418 | z80dart_t *z80dart = get_safe_token(device); |
| 463 | 419 | dart_channel *ch = &z80dart->channel[channel]; |
| 464 | 420 | |
| 465 | | int rxd = z80dart_rxd_r(device, channel); |
| 466 | 421 | int parity = (ch->wr[1] & Z80DART_WR4_PARITY_EVEN) ? 1 : 0; |
| 467 | 422 | |
| 468 | | if (rxd != (ch->rx_parity ^ parity)) |
| 423 | if (RXD != (ch->rx_parity ^ parity)) |
| 469 | 424 | { |
| 470 | 425 | /* parity error detected */ |
| 471 | 426 | ch->rx_error |= Z80DART_RR1_PARITY_ERROR; |
| r4243 | r4244 | |
| 475 | 430 | case Z80DART_WR1_RX_INT_FIRST: |
| 476 | 431 | if (!ch->rx_first) |
| 477 | 432 | { |
| 478 | | z80dart_trigger_interrupt(device, channel, INT_SPECIAL); |
| 433 | take_interrupt(device, channel, INT_SPECIAL); |
| 479 | 434 | } |
| 480 | 435 | break; |
| 481 | 436 | |
| 482 | 437 | case Z80DART_WR1_RX_INT_ALL_PARITY: |
| 483 | | z80dart_trigger_interrupt(device, channel, INT_SPECIAL); |
| 438 | take_interrupt(device, channel, INT_SPECIAL); |
| 484 | 439 | break; |
| 485 | 440 | |
| 486 | 441 | case Z80DART_WR1_RX_INT_ALL: |
| 487 | | z80dart_trigger_interrupt(device, channel, INT_RECEIVE); |
| 442 | take_interrupt(device, channel, INT_RECEIVE); |
| 488 | 443 | break; |
| 489 | 444 | } |
| 490 | 445 | } |
| 491 | 446 | } |
| 492 | 447 | |
| 448 | /*------------------------------------------------- |
| 449 | detect_framing_error - detect framing error |
| 450 | -------------------------------------------------*/ |
| 451 | |
| 493 | 452 | static void detect_framing_error(const device_config *device, int channel) |
| 494 | 453 | { |
| 495 | 454 | z80dart_t *z80dart = get_safe_token(device); |
| 496 | 455 | dart_channel *ch = &z80dart->channel[channel]; |
| 497 | 456 | |
| 498 | | int rxd = z80dart_rxd_r(device, channel); |
| 499 | | |
| 500 | | if (!rxd) |
| 457 | if (!RXD) |
| 501 | 458 | { |
| 502 | 459 | /* framing error detected */ |
| 503 | 460 | ch->rx_error |= Z80DART_RR1_FRAMING_ERROR; |
| r4243 | r4244 | |
| 507 | 464 | case Z80DART_WR1_RX_INT_FIRST: |
| 508 | 465 | if (!ch->rx_first) |
| 509 | 466 | { |
| 510 | | z80dart_trigger_interrupt(device, channel, INT_SPECIAL); |
| 467 | take_interrupt(device, channel, INT_SPECIAL); |
| 511 | 468 | } |
| 512 | 469 | break; |
| 513 | 470 | |
| 514 | 471 | case Z80DART_WR1_RX_INT_ALL_PARITY: |
| 515 | 472 | case Z80DART_WR1_RX_INT_ALL: |
| 516 | | z80dart_trigger_interrupt(device, channel, INT_SPECIAL); |
| 473 | take_interrupt(device, channel, INT_SPECIAL); |
| 517 | 474 | break; |
| 518 | 475 | } |
| 519 | 476 | } |
| 520 | 477 | } |
| 521 | 478 | |
| 479 | /*------------------------------------------------- |
| 480 | receive - receive serial data |
| 481 | -------------------------------------------------*/ |
| 482 | |
| 522 | 483 | static void receive(const device_config *device, int channel) |
| 523 | 484 | { |
| 524 | 485 | z80dart_t *z80dart = get_safe_token(device); |
| 525 | 486 | dart_channel *ch = &z80dart->channel[channel]; |
| 526 | 487 | |
| 527 | | float stop_bits = z80dart_get_stop_bits(device, channel); |
| 488 | float stop_bits = get_stop_bits(ch); |
| 528 | 489 | |
| 529 | 490 | switch (ch->rx_state) |
| 530 | 491 | { |
| 531 | 492 | case STATE_START: |
| 532 | 493 | /* check for start bit */ |
| 533 | | if (detect_start_bit(device, channel)) |
| 494 | if (detect_start_bit(ch)) |
| 534 | 495 | { |
| 535 | 496 | /* start bit detected */ |
| 536 | 497 | ch->rx_shift = 0; |
| r4243 | r4244 | |
| 545 | 506 | |
| 546 | 507 | case STATE_DATA: |
| 547 | 508 | /* shift bit into shift register */ |
| 548 | | shift_data_in(device, channel); |
| 509 | shift_data_in(ch); |
| 549 | 510 | |
| 550 | | if (character_completed(device, channel)) |
| 511 | if (character_completed(ch)) |
| 551 | 512 | { |
| 552 | 513 | /* all data bits received */ |
| 553 | 514 | if (ch->wr[4] & Z80DART_WR4_PARITY_ENABLE) |
| r4243 | r4244 | |
| 568 | 529 | |
| 569 | 530 | case STATE_PARITY: |
| 570 | 531 | /* shift bit into shift register */ |
| 571 | | shift_data_in(device, channel); |
| 532 | shift_data_in(ch); |
| 572 | 533 | |
| 573 | 534 | /* check for parity error */ |
| 574 | 535 | detect_parity_error(device, channel); |
| r4243 | r4244 | |
| 582 | 543 | |
| 583 | 544 | case STATE_STOP: |
| 584 | 545 | /* shift bit into shift register */ |
| 585 | | shift_data_in(device, channel); |
| 546 | shift_data_in(ch); |
| 586 | 547 | |
| 587 | 548 | /* check for framing error */ |
| 588 | 549 | detect_framing_error(device, channel); |
| r4243 | r4244 | |
| 593 | 554 | |
| 594 | 555 | case STATE_STOP2: |
| 595 | 556 | /* shift bit into shift register */ |
| 596 | | shift_data_in(device, channel); |
| 557 | shift_data_in(ch); |
| 597 | 558 | |
| 598 | 559 | /* check for framing error */ |
| 599 | 560 | detect_framing_error(device, channel); |
| r4243 | r4244 | |
| 607 | 568 | } |
| 608 | 569 | } |
| 609 | 570 | |
| 610 | | /*************************************************************************** |
| 611 | | SERIAL TRANSMIT |
| 612 | | ***************************************************************************/ |
| 571 | /*------------------------------------------------- |
| 572 | transmit - transmit serial data |
| 573 | -------------------------------------------------*/ |
| 613 | 574 | |
| 614 | | #define TXD(state) z80dart_txd_w(device, channel, 1); |
| 615 | | |
| 616 | 575 | static void transmit(const device_config *device, int channel) |
| 617 | 576 | { |
| 618 | 577 | z80dart_t *z80dart = get_safe_token(device); |
| 619 | 578 | dart_channel *ch = &z80dart->channel[channel]; |
| 620 | 579 | |
| 621 | | int word_length = z80dart_get_tx_word_length(device, channel); |
| 622 | | float stop_bits = z80dart_get_stop_bits(device, channel); |
| 580 | int word_length = get_tx_word_length(ch); |
| 581 | float stop_bits = get_stop_bits(ch); |
| 623 | 582 | |
| 624 | 583 | switch (ch->tx_state) |
| 625 | 584 | { |
| r4243 | r4244 | |
| 636 | 595 | ch->rr[0] |= Z80DART_RR0_TX_BUFFER_EMPTY; |
| 637 | 596 | |
| 638 | 597 | if (ch->wr[1] & Z80DART_WR1_TX_INT_ENABLE) |
| 639 | | z80dart_trigger_interrupt(device, channel, INT_TRANSMIT); |
| 598 | take_interrupt(device, channel, INT_TRANSMIT); |
| 640 | 599 | |
| 641 | 600 | ch->tx_state = STATE_DATA; |
| 642 | 601 | } |
| r4243 | r4244 | |
| 702 | 661 | |
| 703 | 662 | /* when the RTS bit is reset, the _RTS output goes high after the transmitter empties */ |
| 704 | 663 | if (!ch->rts) |
| 705 | | z80dart_rts_w(device, channel, 1); |
| 664 | RTS(1); |
| 706 | 665 | } |
| 707 | 666 | |
| 708 | 667 | ch->tx_state = STATE_START; |
| r4243 | r4244 | |
| 710 | 669 | } |
| 711 | 670 | } |
| 712 | 671 | |
| 713 | | /*************************************************************************** |
| 714 | | CONTROL REGISTER READ/WRITE |
| 715 | | ***************************************************************************/ |
| 672 | /*------------------------------------------------- |
| 673 | z80dart_c_r - read control register |
| 674 | -------------------------------------------------*/ |
| 716 | 675 | |
| 717 | 676 | READ8_DEVICE_HANDLER( z80dart_c_r ) |
| 718 | 677 | { |
| r4243 | r4244 | |
| 742 | 701 | return data; |
| 743 | 702 | } |
| 744 | 703 | |
| 704 | /*------------------------------------------------- |
| 705 | z80dart_c_w - write control register |
| 706 | -------------------------------------------------*/ |
| 707 | |
| 745 | 708 | WRITE8_DEVICE_HANDLER( z80dart_c_w ) |
| 746 | 709 | { |
| 747 | 710 | z80dart_t *z80dart = get_safe_token(device); |
| r4243 | r4244 | |
| 782 | 745 | case Z80DART_WR0_CHANNEL_RESET: |
| 783 | 746 | /* channel reset */ |
| 784 | 747 | LOG(("Z80DART \"%s\" Channel %c : Channel Reset\n", device->tag, 'A' + channel)); |
| 785 | | z80dart_reset_channel(device, channel); |
| 748 | reset_channel(device, channel); |
| 786 | 749 | break; |
| 787 | 750 | |
| 788 | 751 | case Z80DART_WR0_ENABLE_INT_NEXT_RX: |
| r4243 | r4244 | |
| 835 | 798 | break; |
| 836 | 799 | } |
| 837 | 800 | |
| 838 | | z80dart_check_interrupt(device); |
| 801 | check_interrupts(device); |
| 839 | 802 | break; |
| 840 | 803 | |
| 841 | 804 | case 2: |
| 842 | 805 | /* interrupt vector */ |
| 843 | | z80dart_check_interrupt(device); |
| 806 | check_interrupts(device); |
| 844 | 807 | LOG(("Z80DART \"%s\" Channel %c : Interrupt Vector %02x\n", device->tag, 'A' + channel, data)); |
| 845 | 808 | break; |
| 846 | 809 | |
| 847 | 810 | case 3: |
| 848 | 811 | LOG(("Z80DART \"%s\" Channel %c : Receiver Enable %u\n", device->tag, 'A' + channel, (data & Z80DART_WR3_RX_ENABLE) ? 1 : 0)); |
| 849 | 812 | LOG(("Z80DART \"%s\" Channel %c : Auto Enables %u\n", device->tag, 'A' + channel, (data & Z80DART_WR3_AUTO_ENABLES) ? 1 : 0)); |
| 850 | | LOG(("Z80DART \"%s\" Channel %c : Receiver Bits/Character %u\n", device->tag, 'A' + channel, z80dart_get_rx_word_length(device, channel))); |
| 813 | LOG(("Z80DART \"%s\" Channel %c : Receiver Bits/Character %u\n", device->tag, 'A' + channel, get_rx_word_length(ch))); |
| 851 | 814 | break; |
| 852 | 815 | |
| 853 | 816 | case 4: |
| 854 | 817 | LOG(("Z80DART \"%s\" Channel %c : Parity Enable %u\n", device->tag, 'A' + channel, (data & Z80DART_WR4_PARITY_ENABLE) ? 1 : 0)); |
| 855 | 818 | LOG(("Z80DART \"%s\" Channel %c : Parity %s\n", device->tag, 'A' + channel, (data & Z80DART_WR4_PARITY_EVEN) ? "Even" : "Odd")); |
| 856 | | LOG(("Z80DART \"%s\" Channel %c : Stop Bits %f\n", device->tag, 'A' + channel, z80dart_get_stop_bits(device, channel))); |
| 857 | | LOG(("Z80DART \"%s\" Channel %c : Clock Mode %uX\n", device->tag, 'A' + channel, z80dart_get_clock_mode(device, channel))); |
| 819 | LOG(("Z80DART \"%s\" Channel %c : Stop Bits %f\n", device->tag, 'A' + channel, get_stop_bits(ch))); |
| 820 | LOG(("Z80DART \"%s\" Channel %c : Clock Mode %uX\n", device->tag, 'A' + channel, get_clock_mode(ch))); |
| 858 | 821 | break; |
| 859 | 822 | |
| 860 | 823 | case 5: |
| 861 | 824 | LOG(("Z80DART \"%s\" Channel %c : Transmitter Enable %u\n", device->tag, 'A' + channel, (data & Z80DART_WR5_TX_ENABLE) ? 1 : 0)); |
| 862 | | LOG(("Z80DART \"%s\" Channel %c : Transmitter Bits/Character %u\n", device->tag, 'A' + channel, z80dart_get_tx_word_length(device, channel))); |
| 825 | LOG(("Z80DART \"%s\" Channel %c : Transmitter Bits/Character %u\n", device->tag, 'A' + channel, get_tx_word_length(ch))); |
| 863 | 826 | LOG(("Z80DART \"%s\" Channel %c : Send Break %u\n", device->tag, 'A' + channel, (data & Z80DART_WR5_SEND_BREAK) ? 1 : 0)); |
| 864 | 827 | LOG(("Z80DART \"%s\" Channel %c : Request to Send %u\n", device->tag, 'A' + channel, (data & Z80DART_WR5_RTS) ? 1 : 0)); |
| 865 | 828 | LOG(("Z80DART \"%s\" Channel %c : Data Terminal Ready %u\n", device->tag, 'A' + channel, (data & Z80DART_WR5_DTR) ? 1 : 0)); |
| r4243 | r4244 | |
| 867 | 830 | if (data & Z80DART_WR5_RTS) |
| 868 | 831 | { |
| 869 | 832 | /* when the RTS bit is set, the _RTS output goes low */ |
| 870 | | z80dart_rts_w(device, channel, 0); |
| 833 | RTS(0); |
| 871 | 834 | |
| 872 | 835 | ch->rts = 1; |
| 873 | 836 | } |
| r4243 | r4244 | |
| 879 | 842 | |
| 880 | 843 | /* data terminal ready output follows the state programmed into the DTR bit*/ |
| 881 | 844 | ch->dtr = (data & Z80DART_WR5_DTR) ? 0 : 1; |
| 882 | | z80dart_dtr_w(device, channel, ch->dtr); |
| 845 | DTR(ch->dtr); |
| 883 | 846 | break; |
| 884 | 847 | } |
| 885 | 848 | } |
| 886 | 849 | |
| 887 | | /*************************************************************************** |
| 888 | | DATA REGISTER READ/WRITE |
| 889 | | ***************************************************************************/ |
| 850 | /*------------------------------------------------- |
| 851 | z80dart_d_r - read data register |
| 852 | -------------------------------------------------*/ |
| 890 | 853 | |
| 891 | 854 | READ8_DEVICE_HANDLER( z80dart_d_r ) |
| 892 | 855 | { |
| r4243 | r4244 | |
| 918 | 881 | return data; |
| 919 | 882 | } |
| 920 | 883 | |
| 884 | /*------------------------------------------------- |
| 885 | z80dart_d_w - write data register |
| 886 | -------------------------------------------------*/ |
| 887 | |
| 921 | 888 | WRITE8_DEVICE_HANDLER( z80dart_d_w ) |
| 922 | 889 | { |
| 923 | 890 | z80dart_t *z80dart = get_safe_token(device); |
| r4243 | r4244 | |
| 932 | 899 | LOG(("Z80DART \"%s\" Channel %c : Data Register Write '%02x'\n", device->tag, 'A' + channel, data)); |
| 933 | 900 | } |
| 934 | 901 | |
| 935 | | /*************************************************************************** |
| 936 | | CONTROL LINE READ/WRITE |
| 937 | | ***************************************************************************/ |
| 902 | /*------------------------------------------------- |
| 903 | z80dart_receive_data - receive data word |
| 904 | -------------------------------------------------*/ |
| 938 | 905 | |
| 939 | 906 | void z80dart_receive_data(const device_config *device, int channel, UINT8 data) |
| 940 | 907 | { |
| r4243 | r4244 | |
| 953 | 920 | case Z80DART_WR1_RX_INT_FIRST: |
| 954 | 921 | if (!ch->rx_first) |
| 955 | 922 | { |
| 956 | | z80dart_trigger_interrupt(device, channel, INT_SPECIAL); |
| 923 | take_interrupt(device, channel, INT_SPECIAL); |
| 957 | 924 | } |
| 958 | 925 | break; |
| 959 | 926 | |
| 960 | 927 | case Z80DART_WR1_RX_INT_ALL_PARITY: |
| 961 | 928 | case Z80DART_WR1_RX_INT_ALL: |
| 962 | | z80dart_trigger_interrupt(device, channel, INT_SPECIAL); |
| 929 | take_interrupt(device, channel, INT_SPECIAL); |
| 963 | 930 | break; |
| 964 | 931 | } |
| 965 | 932 | } |
| r4243 | r4244 | |
| 980 | 947 | case Z80DART_WR1_RX_INT_FIRST: |
| 981 | 948 | if (ch->rx_first) |
| 982 | 949 | { |
| 983 | | z80dart_trigger_interrupt(device, channel, INT_RECEIVE); |
| 950 | take_interrupt(device, channel, INT_RECEIVE); |
| 984 | 951 | |
| 985 | 952 | ch->rx_first = 0; |
| 986 | 953 | } |
| r4243 | r4244 | |
| 988 | 955 | |
| 989 | 956 | case Z80DART_WR1_RX_INT_ALL_PARITY: |
| 990 | 957 | case Z80DART_WR1_RX_INT_ALL: |
| 991 | | z80dart_trigger_interrupt(device, channel, INT_RECEIVE); |
| 958 | take_interrupt(device, channel, INT_RECEIVE); |
| 992 | 959 | break; |
| 993 | 960 | } |
| 994 | 961 | } |
| 995 | 962 | |
| 996 | | void z80dart_cts_w(const device_config *device, int channel, int state) |
| 963 | /*------------------------------------------------- |
| 964 | cts_w - clear to send handler |
| 965 | -------------------------------------------------*/ |
| 966 | |
| 967 | static void cts_w(const device_config *device, int channel, int state) |
| 997 | 968 | { |
| 998 | 969 | z80dart_t *z80dart = get_safe_token(device); |
| 999 | 970 | dart_channel *ch = &z80dart->channel[channel]; |
| r4243 | r4244 | |
| 1021 | 992 | if (ch->wr[1] & Z80DART_WR1_EXT_INT_ENABLE) |
| 1022 | 993 | { |
| 1023 | 994 | /* trigger interrupt */ |
| 1024 | | z80dart_trigger_interrupt(device, channel, INT_EXTERNAL); |
| 995 | take_interrupt(device, channel, INT_EXTERNAL); |
| 1025 | 996 | |
| 1026 | 997 | /* latch read register 0 */ |
| 1027 | 998 | ch->rx_rr0_latch = 1; |
| r4243 | r4244 | |
| 1030 | 1001 | } |
| 1031 | 1002 | } |
| 1032 | 1003 | |
| 1033 | | void z80dart_dcd_w(const device_config *device, int channel, int state) |
| 1004 | /*------------------------------------------------- |
| 1005 | z80dart_ctsa_w - clear to send (channel A) |
| 1006 | -------------------------------------------------*/ |
| 1007 | |
| 1008 | void z80dart_ctsa_w(const device_config *device, int state) |
| 1034 | 1009 | { |
| 1010 | cts_w(device, Z80DART_CH_A, state); |
| 1011 | } |
| 1012 | |
| 1013 | /*------------------------------------------------- |
| 1014 | z80dart_ctsb_w - clear to send (channel B) |
| 1015 | -------------------------------------------------*/ |
| 1016 | |
| 1017 | void z80dart_ctsb_w(const device_config *device, int state) |
| 1018 | { |
| 1019 | cts_w(device, Z80DART_CH_B, state); |
| 1020 | } |
| 1021 | |
| 1022 | /*------------------------------------------------- |
| 1023 | dcd_w - data carrier detected handler |
| 1024 | -------------------------------------------------*/ |
| 1025 | |
| 1026 | void dcd_w(const device_config *device, int channel, int state) |
| 1027 | { |
| 1035 | 1028 | z80dart_t *z80dart = get_safe_token(device); |
| 1036 | 1029 | dart_channel *ch = &z80dart->channel[channel]; |
| 1037 | 1030 | |
| r4243 | r4244 | |
| 1057 | 1050 | if (ch->wr[1] & Z80DART_WR1_EXT_INT_ENABLE) |
| 1058 | 1051 | { |
| 1059 | 1052 | /* trigger interrupt */ |
| 1060 | | z80dart_trigger_interrupt(device, channel, INT_EXTERNAL); |
| 1053 | take_interrupt(device, channel, INT_EXTERNAL); |
| 1061 | 1054 | |
| 1062 | 1055 | /* latch read register 0 */ |
| 1063 | 1056 | ch->rx_rr0_latch = 1; |
| r4243 | r4244 | |
| 1066 | 1059 | } |
| 1067 | 1060 | } |
| 1068 | 1061 | |
| 1069 | | void z80dart_ri_w(const device_config *device, int channel, int state) |
| 1062 | /*------------------------------------------------- |
| 1063 | z80dart_dcda_w - data carrier detected |
| 1064 | (channel A) |
| 1065 | -------------------------------------------------*/ |
| 1066 | |
| 1067 | void z80dart_dcda_w(const device_config *device, int state) |
| 1070 | 1068 | { |
| 1069 | dcd_w(device, Z80DART_CH_A, state); |
| 1070 | } |
| 1071 | |
| 1072 | /*------------------------------------------------- |
| 1073 | z80dart_dcdb_w - data carrier detected |
| 1074 | (channel B) |
| 1075 | -------------------------------------------------*/ |
| 1076 | |
| 1077 | void z80dart_dcdb_w(const device_config *device, int state) |
| 1078 | { |
| 1079 | dcd_w(device, Z80DART_CH_B, state); |
| 1080 | } |
| 1081 | |
| 1082 | /*------------------------------------------------- |
| 1083 | ri_w - ring indicator handler |
| 1084 | -------------------------------------------------*/ |
| 1085 | |
| 1086 | static void ri_w(const device_config *device, int channel, int state) |
| 1087 | { |
| 1071 | 1088 | z80dart_t *z80dart = get_safe_token(device); |
| 1072 | 1089 | dart_channel *ch = &z80dart->channel[channel]; |
| 1073 | 1090 | |
| r4243 | r4244 | |
| 1088 | 1105 | if (ch->wr[1] & Z80DART_WR1_EXT_INT_ENABLE) |
| 1089 | 1106 | { |
| 1090 | 1107 | /* trigger interrupt */ |
| 1091 | | z80dart_trigger_interrupt(device, channel, INT_EXTERNAL); |
| 1108 | take_interrupt(device, channel, INT_EXTERNAL); |
| 1092 | 1109 | |
| 1093 | 1110 | /* latch read register 0 */ |
| 1094 | 1111 | ch->rx_rr0_latch = 1; |
| r4243 | r4244 | |
| 1097 | 1114 | } |
| 1098 | 1115 | } |
| 1099 | 1116 | |
| 1100 | | /*************************************************************************** |
| 1101 | | CLOCK MANAGEMENT |
| 1102 | | ***************************************************************************/ |
| 1117 | /*------------------------------------------------- |
| 1118 | z80dart_ria_w - ring indicator (channel A) |
| 1119 | -------------------------------------------------*/ |
| 1103 | 1120 | |
| 1104 | | void z80dart_rxca_w(const device_config *device) |
| 1121 | void z80dart_ria_w(const device_config *device, int state) |
| 1105 | 1122 | { |
| 1123 | ri_w(device, Z80DART_CH_A, state); |
| 1124 | } |
| 1125 | |
| 1126 | /*------------------------------------------------- |
| 1127 | z80dart_rib_w - ring indicator (channel B) |
| 1128 | -------------------------------------------------*/ |
| 1129 | |
| 1130 | void z80dart_rib_w(const device_config *device, int state) |
| 1131 | { |
| 1132 | ri_w(device, Z80DART_CH_B, state); |
| 1133 | } |
| 1134 | |
| 1135 | /*------------------------------------------------- |
| 1136 | z80dart_rxca_w - receive clock (channel A) |
| 1137 | -------------------------------------------------*/ |
| 1138 | |
| 1139 | void z80dart_rxca_w(const device_config *device, int state) |
| 1140 | { |
| 1106 | 1141 | z80dart_t *z80dart = get_safe_token(device); |
| 1107 | 1142 | dart_channel *ch = &z80dart->channel[Z80DART_CH_A]; |
| 1108 | 1143 | |
| 1109 | | int clocks = z80dart_get_clock_mode(device, Z80DART_CH_A); |
| 1144 | int clocks = get_clock_mode(ch); |
| 1110 | 1145 | |
| 1146 | if (!state) return; |
| 1147 | |
| 1111 | 1148 | LOG(("Z80DART \"%s\" Channel A : Receiver Clock Pulse\n", device->tag)); |
| 1112 | 1149 | |
| 1113 | 1150 | ch->rx_clock++; |
| r4243 | r4244 | |
| 1121 | 1158 | } |
| 1122 | 1159 | } |
| 1123 | 1160 | |
| 1124 | | void z80dart_txca_w(const device_config *device) |
| 1161 | /*------------------------------------------------- |
| 1162 | z80dart_txca_w - transmit clock (channel A) |
| 1163 | -------------------------------------------------*/ |
| 1164 | |
| 1165 | void z80dart_txca_w(const device_config *device, int state) |
| 1125 | 1166 | { |
| 1126 | 1167 | z80dart_t *z80dart = get_safe_token(device); |
| 1127 | 1168 | dart_channel *ch = &z80dart->channel[Z80DART_CH_A]; |
| 1128 | 1169 | |
| 1129 | | int clocks = z80dart_get_clock_mode(device, Z80DART_CH_A); |
| 1170 | int clocks = get_clock_mode(ch); |
| 1130 | 1171 | |
| 1172 | if (!state) return; |
| 1173 | |
| 1131 | 1174 | LOG(("Z80DART \"%s\" Channel A : Transmitter Clock Pulse\n", device->tag)); |
| 1132 | 1175 | |
| 1133 | 1176 | ch->tx_clock++; |
| r4243 | r4244 | |
| 1141 | 1184 | } |
| 1142 | 1185 | } |
| 1143 | 1186 | |
| 1144 | | void z80dart_rxtxcb_w(const device_config *device) |
| 1187 | /*------------------------------------------------- |
| 1188 | z80dart_rxtxcb_w - receive/transmit clock |
| 1189 | (channel B) |
| 1190 | -------------------------------------------------*/ |
| 1191 | |
| 1192 | void z80dart_rxtxcb_w(const device_config *device, int state) |
| 1145 | 1193 | { |
| 1146 | 1194 | z80dart_t *z80dart = get_safe_token(device); |
| 1147 | 1195 | dart_channel *ch = &z80dart->channel[Z80DART_CH_B]; |
| 1148 | 1196 | |
| 1149 | | int clocks = z80dart_get_clock_mode(device, Z80DART_CH_B); |
| 1197 | int clocks = get_clock_mode(ch); |
| 1150 | 1198 | |
| 1199 | if (!state) return; |
| 1200 | |
| 1151 | 1201 | LOG(("Z80DART \"%s\" Channel A : Receiver/Transmitter Clock Pulse\n", device->tag)); |
| 1152 | 1202 | |
| 1153 | 1203 | ch->rx_clock++; |
| r4243 | r4244 | |
| 1164 | 1214 | } |
| 1165 | 1215 | } |
| 1166 | 1216 | |
| 1217 | /*------------------------------------------------- |
| 1218 | TIMER_CALLBACK( rxca_tick ) |
| 1219 | -------------------------------------------------*/ |
| 1220 | |
| 1167 | 1221 | static TIMER_CALLBACK( rxca_tick ) |
| 1168 | 1222 | { |
| 1169 | | z80dart_rxca_w(ptr); |
| 1223 | z80dart_rxca_w(ptr, 1); |
| 1170 | 1224 | } |
| 1171 | 1225 | |
| 1226 | /*------------------------------------------------- |
| 1227 | TIMER_CALLBACK( txca_tick ) |
| 1228 | -------------------------------------------------*/ |
| 1229 | |
| 1172 | 1230 | static TIMER_CALLBACK( txca_tick ) |
| 1173 | 1231 | { |
| 1174 | | z80dart_txca_w(ptr); |
| 1232 | z80dart_txca_w(ptr, 1); |
| 1175 | 1233 | } |
| 1176 | 1234 | |
| 1235 | /*------------------------------------------------- |
| 1236 | TIMER_CALLBACK( rxtxcb_tick ) |
| 1237 | -------------------------------------------------*/ |
| 1238 | |
| 1177 | 1239 | static TIMER_CALLBACK( rxtxcb_tick ) |
| 1178 | 1240 | { |
| 1179 | | z80dart_rxtxcb_w(ptr); |
| 1241 | z80dart_rxtxcb_w(ptr, 1); |
| 1180 | 1242 | } |
| 1181 | 1243 | |
| 1182 | | /*************************************************************************** |
| 1183 | | DAISY CHAIN INTERFACE |
| 1184 | | ***************************************************************************/ |
| 1244 | /*------------------------------------------------- |
| 1245 | z80dart_irq_state - get interrupt status |
| 1246 | -------------------------------------------------*/ |
| 1185 | 1247 | |
| 1186 | 1248 | static int z80dart_irq_state(const device_config *device) |
| 1187 | 1249 | { |
| r4243 | r4244 | |
| 1210 | 1272 | return state; |
| 1211 | 1273 | } |
| 1212 | 1274 | |
| 1275 | /*------------------------------------------------- |
| 1276 | z80dart_irq_ack - interrupt acknowledge |
| 1277 | -------------------------------------------------*/ |
| 1278 | |
| 1213 | 1279 | static int z80dart_irq_ack(const device_config *device) |
| 1214 | 1280 | { |
| 1215 | 1281 | z80dart_t *z80dart = get_safe_token( device ); |
| r4243 | r4244 | |
| 1226 | 1292 | /* clear interrupt, switch to the IEO state, and update the IRQs */ |
| 1227 | 1293 | z80dart->int_state[i] = Z80_DAISY_IEO; |
| 1228 | 1294 | z80dart->channel[Z80DART_CH_A].rr[0] &= ~Z80DART_RR0_INTERRUPT_PENDING; |
| 1229 | | z80dart_check_interrupt(device); |
| 1295 | check_interrupts(device); |
| 1230 | 1296 | |
| 1231 | 1297 | LOG(("Z80DART \"%s\" : Interrupt Acknowledge Vector %02x\n", device->tag, z80dart->channel[Z80DART_CH_B].rr[2])); |
| 1232 | 1298 | |
| r4243 | r4244 | |
| 1239 | 1305 | return z80dart->channel[Z80DART_CH_B].rr[2]; |
| 1240 | 1306 | } |
| 1241 | 1307 | |
| 1308 | /*------------------------------------------------- |
| 1309 | z80dart_irq_reti - return from interrupt |
| 1310 | -------------------------------------------------*/ |
| 1311 | |
| 1242 | 1312 | static void z80dart_irq_reti(const device_config *device) |
| 1243 | 1313 | { |
| 1244 | 1314 | z80dart_t *z80dart = get_safe_token( device ); |
| r4243 | r4244 | |
| 1254 | 1324 | { |
| 1255 | 1325 | /* clear the IEO state and update the IRQs */ |
| 1256 | 1326 | z80dart->int_state[i] &= ~Z80_DAISY_IEO; |
| 1257 | | z80dart_check_interrupt(device); |
| 1327 | check_interrupts(device); |
| 1258 | 1328 | return; |
| 1259 | 1329 | } |
| 1260 | 1330 | } |
| r4243 | r4244 | |
| 1262 | 1332 | logerror("z80dart_irq_reti: failed to find an interrupt to clear IEO on!\n"); |
| 1263 | 1333 | } |
| 1264 | 1334 | |
| 1265 | | /*************************************************************************** |
| 1266 | | READ/WRITE HANDLERS |
| 1267 | | ***************************************************************************/ |
| 1335 | /*------------------------------------------------- |
| 1336 | z80dart_r - register read |
| 1337 | -------------------------------------------------*/ |
| 1268 | 1338 | |
| 1269 | 1339 | READ8_DEVICE_HANDLER( z80dart_r ) |
| 1270 | 1340 | { |
| 1271 | 1341 | return (offset & 2) ? z80dart_c_r(device, offset & 1) : z80dart_d_r(device, offset & 1); |
| 1272 | 1342 | } |
| 1273 | 1343 | |
| 1344 | /*------------------------------------------------- |
| 1345 | z80dart_w - register write |
| 1346 | -------------------------------------------------*/ |
| 1347 | |
| 1274 | 1348 | WRITE8_DEVICE_HANDLER( z80dart_w ) |
| 1275 | 1349 | { |
| 1276 | 1350 | if (offset & 2) |
| r4243 | r4244 | |
| 1279 | 1353 | z80dart_d_w(device, offset & 1, data); |
| 1280 | 1354 | } |
| 1281 | 1355 | |
| 1356 | /*------------------------------------------------- |
| 1357 | z80dart_alt_r - alternate register read |
| 1358 | -------------------------------------------------*/ |
| 1359 | |
| 1282 | 1360 | READ8_DEVICE_HANDLER( z80dart_alt_r ) |
| 1283 | 1361 | { |
| 1284 | 1362 | int channel = BIT(offset, 1); |
| r4243 | r4244 | |
| 1286 | 1364 | return (offset & 1) ? z80dart_c_r(device, channel) : z80dart_d_r(device, channel); |
| 1287 | 1365 | } |
| 1288 | 1366 | |
| 1367 | /*------------------------------------------------- |
| 1368 | z80dart_alt_w - alternate register write |
| 1369 | -------------------------------------------------*/ |
| 1370 | |
| 1289 | 1371 | WRITE8_DEVICE_HANDLER( z80dart_alt_w ) |
| 1290 | 1372 | { |
| 1291 | 1373 | int channel = BIT(offset, 1); |
| r4243 | r4244 | |
| 1296 | 1378 | z80dart_d_w(device, channel, data); |
| 1297 | 1379 | } |
| 1298 | 1380 | |
| 1299 | | /*************************************************************************** |
| 1300 | | DEVICE INTERFACE |
| 1301 | | ***************************************************************************/ |
| 1381 | /*------------------------------------------------- |
| 1382 | DEVICE_START( z80dart ) |
| 1383 | -------------------------------------------------*/ |
| 1302 | 1384 | |
| 1303 | 1385 | static DEVICE_START( z80dart ) |
| 1304 | 1386 | { |
| 1387 | z80dart_t *z80dart = get_safe_token(device); |
| 1305 | 1388 | const z80dart_interface *intf = device->static_config; |
| 1306 | | z80dart_t *z80dart = get_safe_token(device); |
| 1307 | | const device_config *cpu = NULL; |
| 1389 | int channel; |
| 1308 | 1390 | |
| 1309 | | assert(intf != NULL); |
| 1310 | | z80dart->intf = intf; |
| 1391 | /* resolve callbacks */ |
| 1392 | devcb_resolve_read_line(&z80dart->channel[Z80DART_CH_A].in_rxd_func, &intf->in_rxda_func, device); |
| 1393 | devcb_resolve_write_line(&z80dart->channel[Z80DART_CH_A].out_txd_func, &intf->out_txda_func, device); |
| 1394 | devcb_resolve_write_line(&z80dart->channel[Z80DART_CH_A].out_dtr_func, &intf->out_dtra_func, device); |
| 1395 | devcb_resolve_write_line(&z80dart->channel[Z80DART_CH_A].out_rts_func, &intf->out_rtsa_func, device); |
| 1396 | devcb_resolve_write_line(&z80dart->channel[Z80DART_CH_A].out_wrdy_func, &intf->out_wrdya_func, device); |
| 1397 | devcb_resolve_read_line(&z80dart->channel[Z80DART_CH_B].in_rxd_func, &intf->in_rxdb_func, device); |
| 1398 | devcb_resolve_write_line(&z80dart->channel[Z80DART_CH_B].out_txd_func, &intf->out_txdb_func, device); |
| 1399 | devcb_resolve_write_line(&z80dart->channel[Z80DART_CH_B].out_dtr_func, &intf->out_dtrb_func, device); |
| 1400 | devcb_resolve_write_line(&z80dart->channel[Z80DART_CH_B].out_rts_func, &intf->out_rtsb_func, device); |
| 1401 | devcb_resolve_write_line(&z80dart->channel[Z80DART_CH_B].out_wrdy_func, &intf->out_wrdyb_func, device); |
| 1402 | devcb_resolve_write_line(&z80dart->out_int_func, &intf->out_int_func, device); |
| 1311 | 1403 | |
| 1312 | | /* get clock */ |
| 1404 | if (intf->rx_clock_a) |
| 1405 | { |
| 1406 | /* allocate channel A receive timer */ |
| 1407 | z80dart->rxca_timer = timer_alloc(device->machine, rxca_tick, (void *)device); |
| 1408 | timer_adjust_periodic(z80dart->rxca_timer, attotime_zero, 0, ATTOTIME_IN_HZ(intf->rx_clock_a)); |
| 1409 | } |
| 1313 | 1410 | |
| 1314 | | if (intf->cpu != NULL) |
| 1411 | if (intf->tx_clock_a) |
| 1315 | 1412 | { |
| 1316 | | cpu = cputag_get_cpu(device->machine, intf->cpu); |
| 1413 | /* allocate channel A transmit timer */ |
| 1414 | z80dart->txca_timer = timer_alloc(device->machine, txca_tick, (void *)device); |
| 1415 | timer_adjust_periodic(z80dart->txca_timer, attotime_zero, 0, ATTOTIME_IN_HZ(intf->tx_clock_a)); |
| 1317 | 1416 | } |
| 1318 | 1417 | |
| 1319 | | if (cpu != NULL) |
| 1418 | if (intf->rx_tx_clock_b) |
| 1320 | 1419 | { |
| 1321 | | z80dart->clock = cpu_get_clock(cpu); |
| 1420 | /* allocate channel B receive/transmit timer */ |
| 1421 | z80dart->rxtxcb_timer = timer_alloc(device->machine, rxtxcb_tick, (void *)device); |
| 1422 | timer_adjust_periodic(z80dart->rxtxcb_timer, attotime_zero, 0, ATTOTIME_IN_HZ(intf->rx_tx_clock_b)); |
| 1322 | 1423 | } |
| 1323 | | else |
| 1424 | |
| 1425 | /* register for state saving */ |
| 1426 | for (channel = Z80DART_CH_A; channel <= Z80DART_CH_B; channel++) |
| 1324 | 1427 | { |
| 1325 | | assert(intf->clock > 0); |
| 1326 | | z80dart->clock = intf->clock; |
| 1428 | state_save_register_device_item_array(device, channel, z80dart->channel[channel].rr); |
| 1429 | state_save_register_device_item_array(device, channel, z80dart->channel[channel].wr); |
| 1430 | state_save_register_device_item_array(device, channel, z80dart->channel[channel].rx_data_fifo); |
| 1431 | state_save_register_device_item_array(device, channel, z80dart->channel[channel].rx_error_fifo); |
| 1432 | state_save_register_device_item(device, channel, z80dart->channel[channel].rx_shift); |
| 1433 | state_save_register_device_item(device, channel, z80dart->channel[channel].rx_error); |
| 1434 | state_save_register_device_item(device, channel, z80dart->channel[channel].rx_fifo); |
| 1435 | state_save_register_device_item(device, channel, z80dart->channel[channel].rx_clock); |
| 1436 | state_save_register_device_item(device, channel, z80dart->channel[channel].rx_state); |
| 1437 | state_save_register_device_item(device, channel, z80dart->channel[channel].rx_bits); |
| 1438 | state_save_register_device_item(device, channel, z80dart->channel[channel].rx_first); |
| 1439 | state_save_register_device_item(device, channel, z80dart->channel[channel].rx_parity); |
| 1440 | state_save_register_device_item(device, channel, z80dart->channel[channel].rx_break); |
| 1441 | state_save_register_device_item(device, channel, z80dart->channel[channel].rx_rr0_latch); |
| 1442 | state_save_register_device_item(device, channel, z80dart->channel[channel].ri); |
| 1443 | state_save_register_device_item(device, channel, z80dart->channel[channel].cts); |
| 1444 | state_save_register_device_item(device, channel, z80dart->channel[channel].dcd); |
| 1445 | state_save_register_device_item(device, channel, z80dart->channel[channel].tx_data); |
| 1446 | state_save_register_device_item(device, channel, z80dart->channel[channel].tx_shift); |
| 1447 | state_save_register_device_item(device, channel, z80dart->channel[channel].tx_clock); |
| 1448 | state_save_register_device_item(device, channel, z80dart->channel[channel].tx_state); |
| 1449 | state_save_register_device_item(device, channel, z80dart->channel[channel].tx_bits); |
| 1450 | state_save_register_device_item(device, channel, z80dart->channel[channel].tx_parity); |
| 1451 | state_save_register_device_item(device, channel, z80dart->channel[channel].dtr); |
| 1452 | state_save_register_device_item(device, channel, z80dart->channel[channel].rts); |
| 1327 | 1453 | } |
| 1328 | 1454 | |
| 1329 | | /* allocate channel A receive timer */ |
| 1455 | state_save_register_device_item_array(device, 0, z80dart->int_state); |
| 1456 | } |
| 1330 | 1457 | |
| 1331 | | z80dart->rxca_timer = timer_alloc(device->machine, rxca_tick, (void *)device); |
| 1458 | /*------------------------------------------------- |
| 1459 | DEVICE_RESET( z80dart ) |
| 1460 | -------------------------------------------------*/ |
| 1332 | 1461 | |
| 1333 | | if (z80dart->intf->rx_clock_a) |
| 1334 | | timer_adjust_periodic(z80dart->rxca_timer, attotime_zero, 0, ATTOTIME_IN_HZ(z80dart->intf->rx_clock_a)); |
| 1335 | | |
| 1336 | | /* allocate channel A transmit timer */ |
| 1337 | | |
| 1338 | | z80dart->txca_timer = timer_alloc(device->machine, txca_tick, (void *)device); |
| 1339 | | |
| 1340 | | if (z80dart->intf->tx_clock_a) |
| 1341 | | timer_adjust_periodic(z80dart->txca_timer, attotime_zero, 0, ATTOTIME_IN_HZ(z80dart->intf->tx_clock_a)); |
| 1342 | | |
| 1343 | | /* allocate channel B receive/transmit timer */ |
| 1344 | | |
| 1345 | | z80dart->rxtxcb_timer = timer_alloc(device->machine, rxtxcb_tick, (void *)device); |
| 1346 | | |
| 1347 | | if (z80dart->intf->rx_tx_clock_b) |
| 1348 | | timer_adjust_periodic(z80dart->rxtxcb_timer, attotime_zero, 0, ATTOTIME_IN_HZ(z80dart->intf->rx_tx_clock_b)); |
| 1349 | | |
| 1350 | | /* register for state saving */ |
| 1351 | | //state_save_register_item_array(machine, "z80dart", device->tag, 0, z80dart->); |
| 1352 | | } |
| 1353 | | |
| 1354 | 1462 | static DEVICE_RESET( z80dart ) |
| 1355 | 1463 | { |
| 1356 | 1464 | int channel; |
| r4243 | r4244 | |
| 1359 | 1467 | |
| 1360 | 1468 | for (channel = Z80DART_CH_A; channel <= Z80DART_CH_B; channel++) |
| 1361 | 1469 | { |
| 1362 | | z80dart_reset_channel(device, channel); |
| 1470 | reset_channel(device, channel); |
| 1363 | 1471 | } |
| 1364 | 1472 | |
| 1365 | | z80dart_check_interrupt(device); |
| 1473 | check_interrupts(device); |
| 1366 | 1474 | } |
| 1367 | 1475 | |
| 1476 | /*------------------------------------------------- |
| 1477 | DEVICE_SET_INFO( z80dart ) |
| 1478 | -------------------------------------------------*/ |
| 1479 | |
| 1368 | 1480 | static DEVICE_SET_INFO( z80dart ) |
| 1369 | 1481 | { |
| 1370 | 1482 | switch (state) |
| r4243 | r4244 | |
| 1373 | 1485 | } |
| 1374 | 1486 | } |
| 1375 | 1487 | |
| 1488 | /*------------------------------------------------- |
| 1489 | DEVICE_GET_INFO( z80dart ) |
| 1490 | -------------------------------------------------*/ |
| 1491 | |
| 1376 | 1492 | DEVICE_GET_INFO( z80dart ) |
| 1377 | 1493 | { |
| 1378 | 1494 | switch (state) |
| r4243 | r4244 | |
| 1392 | 1508 | case DEVINFO_FCT_IRQ_RETI: info->f = (genf *)z80dart_irq_reti; break; |
| 1393 | 1509 | |
| 1394 | 1510 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 1395 | | case DEVINFO_STR_NAME: strcpy(info->s, "Zilog Z80 DART"); break; |
| 1396 | | case DEVINFO_STR_FAMILY: strcpy(info->s, "Z80"); break; |
| 1397 | | case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; |
| 1398 | | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 1399 | | case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright the MESS Team"); break; |
| 1511 | case DEVINFO_STR_NAME: strcpy(info->s, "Zilog Z80 DART"); break; |
| 1512 | case DEVINFO_STR_FAMILY: strcpy(info->s, "Z80"); break; |
| 1513 | case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; |
| 1514 | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 1515 | case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright the MESS Team"); break; |
| 1400 | 1516 | } |
| 1401 | 1517 | } |
src/mess/machine/abc77.c
| r4243 | r4244 | |
| 3 | 3 | #include "cpu/mcs48/mcs48.h" |
| 4 | 4 | #include "sound/discrete.h" |
| 5 | 5 | |
| 6 | /*************************************************************************** |
| 7 | PARAMETERS |
| 8 | ***************************************************************************/ |
| 9 | |
| 10 | #define I8035_TAG "z16" |
| 11 | |
| 12 | /*************************************************************************** |
| 13 | TYPE DEFINITIONS |
| 14 | ***************************************************************************/ |
| 15 | |
| 6 | 16 | typedef struct _abc77_t abc77_t; |
| 7 | 17 | struct _abc77_t |
| 8 | 18 | { |
| 9 | | const abc77_interface *intf; /* interface */ |
| 19 | devcb_resolved_write_line out_txd_func; |
| 20 | devcb_resolved_write_line out_clock_func; |
| 21 | devcb_resolved_write_line out_keydown_func; |
| 10 | 22 | |
| 11 | 23 | const device_config *cpu; /* CPU of the 8035 */ |
| 12 | 24 | |
| r4243 | r4244 | |
| 19 | 31 | emu_timer *reset_timer; /* reset timer */ |
| 20 | 32 | }; |
| 21 | 33 | |
| 34 | /*************************************************************************** |
| 35 | INLINE FUNCTIONS |
| 36 | ***************************************************************************/ |
| 37 | |
| 22 | 38 | INLINE abc77_t *get_safe_token(const device_config *device) |
| 23 | 39 | { |
| 24 | 40 | assert(device != NULL); |
| 25 | 41 | assert(device->token != NULL); |
| 26 | | |
| 27 | 42 | return (abc77_t *)device->token; |
| 28 | 43 | } |
| 29 | 44 | |
| 30 | | /* Discrete Sound */ |
| 45 | INLINE const abc77_interface *get_interface(const device_config *device) |
| 46 | { |
| 47 | assert(device != NULL); |
| 48 | assert((device->type == ABC77)); |
| 49 | return (const abc77_interface *) device->static_config; |
| 50 | } |
| 31 | 51 | |
| 52 | /*************************************************************************** |
| 53 | IMPLEMENTATION |
| 54 | ***************************************************************************/ |
| 55 | |
| 56 | /*------------------------------------------------- |
| 57 | DISCRETE_SOUND( abc77 ) |
| 58 | -------------------------------------------------*/ |
| 59 | |
| 32 | 60 | static const discrete_555_desc abc77_ne556_a = |
| 33 | 61 | { |
| 34 | 62 | DISC_555_OUT_SQW | DISC_555_OUT_DC, |
| r4243 | r4244 | |
| 42 | 70 | DISCRETE_OUTPUT(NODE_02, 5000) |
| 43 | 71 | DISCRETE_SOUND_END |
| 44 | 72 | |
| 45 | | /* Read/Write Handlers */ |
| 73 | /*------------------------------------------------- |
| 74 | TIMER_DEVICE_CALLBACK( clock_tick ) |
| 75 | -------------------------------------------------*/ |
| 46 | 76 | |
| 47 | | void abc77_rxd_w(const device_config *device, int level) |
| 48 | | { |
| 49 | | abc77_t *abc77 = get_safe_token(device); |
| 50 | | |
| 51 | | cpu_set_input_line(abc77->cpu, MCS48_INPUT_IRQ, level ? CLEAR_LINE : ASSERT_LINE); |
| 52 | | } |
| 53 | | |
| 54 | 77 | static TIMER_DEVICE_CALLBACK( clock_tick ) |
| 55 | 78 | { |
| 56 | 79 | const device_config *device = devtag_get_device(timer->machine, ABC77, ABC77_TAG); |
| 57 | 80 | abc77_t *abc77 = get_safe_token(device); |
| 58 | 81 | |
| 59 | 82 | abc77->clock = !abc77->clock; |
| 83 | |
| 84 | devcb_call_write_line(&abc77->out_clock_func, abc77->clock); |
| 60 | 85 | } |
| 61 | 86 | |
| 87 | /*------------------------------------------------- |
| 88 | TIMER_CALLBACK( reset_tick ) |
| 89 | -------------------------------------------------*/ |
| 90 | |
| 62 | 91 | static TIMER_CALLBACK( reset_tick ) |
| 63 | 92 | { |
| 64 | 93 | const device_config *device = ptr; |
| r4243 | r4244 | |
| 67 | 96 | cpu_set_input_line(abc77->cpu, INPUT_LINE_RESET, CLEAR_LINE); |
| 68 | 97 | } |
| 69 | 98 | |
| 70 | | void abc77_reset_w(const device_config *device, int level) |
| 71 | | { |
| 72 | | abc77_t *abc77 = get_safe_token(device); |
| 99 | /*------------------------------------------------- |
| 100 | abc77_clock_r - read serial clock |
| 101 | -------------------------------------------------*/ |
| 73 | 102 | |
| 74 | | if (abc77->reset && !level) |
| 75 | | { |
| 76 | | /* trigger reset */ |
| 77 | | int t = 1.1 * RES_K(100) * CAP_N(100) * 1000; // t = 1.1 * R1 * C1 |
| 78 | | int ea = BIT(input_port_read(device->machine, "ABC77_DSW"), 7); |
| 79 | | |
| 80 | | cpu_set_input_line(abc77->cpu, INPUT_LINE_RESET, ASSERT_LINE); |
| 81 | | timer_adjust_oneshot(abc77->reset_timer, ATTOTIME_IN_MSEC(t), 0); |
| 82 | | |
| 83 | | cpu_set_input_line(abc77->cpu, MCS48_INPUT_EA, ea ? CLEAR_LINE : ASSERT_LINE); |
| 84 | | } |
| 85 | | |
| 86 | | abc77->reset = level; |
| 87 | | } |
| 88 | | |
| 89 | 103 | static READ8_HANDLER( abc77_clock_r ) |
| 90 | 104 | { |
| 91 | 105 | const device_config *device = devtag_get_device(space->machine, ABC77, ABC77_TAG); |
| r4243 | r4244 | |
| 94 | 108 | return abc77->clock; |
| 95 | 109 | } |
| 96 | 110 | |
| 111 | /*------------------------------------------------- |
| 112 | abc77_data_r - read keyboard matrix |
| 113 | -------------------------------------------------*/ |
| 114 | |
| 97 | 115 | static READ8_HANDLER( abc77_data_r ) |
| 98 | 116 | { |
| 99 | 117 | const device_config *device = devtag_get_device(space->machine, ABC77, ABC77_TAG); |
| r4243 | r4244 | |
| 104 | 122 | return input_port_read(device->machine, keynames[abc77->keylatch]); |
| 105 | 123 | } |
| 106 | 124 | |
| 125 | /*------------------------------------------------- |
| 126 | abc77_data_w - keyboard control |
| 127 | -------------------------------------------------*/ |
| 128 | |
| 107 | 129 | static WRITE8_HANDLER( abc77_data_w ) |
| 108 | 130 | { |
| 109 | 131 | const device_config *device = devtag_get_device(space->machine, ABC77, ABC77_TAG); |
| r4243 | r4244 | |
| 120 | 142 | discrete_sound_w(space, NODE_01, BIT(data, 4)); |
| 121 | 143 | |
| 122 | 144 | /* transmit data */ |
| 123 | | abc77->intf->txd_w(device, BIT(data, 5)); |
| 145 | devcb_call_write_line(&abc77->out_txd_func, BIT(data, 5)); |
| 124 | 146 | |
| 125 | 147 | /* key down */ |
| 126 | | abc77->intf->keydown_w(device, BIT(data, 6)); |
| 148 | devcb_call_write_line(&abc77->out_keydown_func, BIT(data, 6)); |
| 127 | 149 | |
| 128 | 150 | /* hysteresis */ |
| 129 | 151 | abc77->hys = BIT(data, 7); |
| 130 | 152 | } |
| 131 | 153 | |
| 132 | | /* Memory Maps */ |
| 154 | /*------------------------------------------------- |
| 155 | ADDRESS_MAP( abc77_map ) |
| 156 | -------------------------------------------------*/ |
| 133 | 157 | |
| 134 | 158 | static ADDRESS_MAP_START( abc77_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 135 | 159 | AM_RANGE(0x000, 0xfff) AM_ROM |
| 136 | 160 | ADDRESS_MAP_END |
| 137 | 161 | |
| 162 | /*------------------------------------------------- |
| 163 | ADDRESS_MAP( abc77_io_map ) |
| 164 | -------------------------------------------------*/ |
| 165 | |
| 138 | 166 | static ADDRESS_MAP_START( abc77_io_map, ADDRESS_SPACE_IO, 8 ) |
| 139 | 167 | AM_RANGE(0x00, 0x3f) AM_RAM |
| 140 | 168 | AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READ(abc77_data_r) |
| r4243 | r4244 | |
| 143 | 171 | AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READ_PORT("ABC77_DSW") |
| 144 | 172 | ADDRESS_MAP_END |
| 145 | 173 | |
| 146 | | /* Input Ports */ |
| 174 | /*------------------------------------------------- |
| 175 | INPUT_PORTS( abc77 ) |
| 176 | -------------------------------------------------*/ |
| 147 | 177 | |
| 148 | 178 | INPUT_PORTS_START( abc77 ) |
| 149 | 179 | PORT_START("ABC77_X0") |
| r4243 | r4244 | |
| 284 | 314 | PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED) |
| 285 | 315 | INPUT_PORTS_END |
| 286 | 316 | |
| 287 | | /* Machine Driver */ |
| 317 | /*------------------------------------------------- |
| 318 | MACHINE_DRIVER( abc77 ) |
| 319 | -------------------------------------------------*/ |
| 288 | 320 | |
| 289 | 321 | static MACHINE_DRIVER_START( abc77 ) |
| 290 | 322 | /* keyboard cpu */ |
| r4243 | r4244 | |
| 304 | 336 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) |
| 305 | 337 | MACHINE_DRIVER_END |
| 306 | 338 | |
| 307 | | /* ROMs */ |
| 339 | /*------------------------------------------------- |
| 340 | ROM( abc77 ) |
| 341 | -------------------------------------------------*/ |
| 308 | 342 | |
| 309 | 343 | ROM_START( abc77 ) |
| 310 | 344 | ROM_REGION( 0x1000, I8035_TAG, 0 ) |
| r4243 | r4244 | |
| 313 | 347 | ROM_FILL( 0, 0x1000, 0 ) |
| 314 | 348 | ROM_END |
| 315 | 349 | |
| 316 | | /* Device Interface */ |
| 350 | /*------------------------------------------------- |
| 351 | abc77_rxd_w - keyboard serial data in |
| 352 | -------------------------------------------------*/ |
| 317 | 353 | |
| 354 | void abc77_rxd_w(const device_config *device, int level) |
| 355 | { |
| 356 | abc77_t *abc77 = get_safe_token(device); |
| 357 | |
| 358 | cpu_set_input_line(abc77->cpu, MCS48_INPUT_IRQ, level ? CLEAR_LINE : ASSERT_LINE); |
| 359 | } |
| 360 | |
| 361 | /*------------------------------------------------- |
| 362 | abc77_reset_w - keyboard reset |
| 363 | -------------------------------------------------*/ |
| 364 | |
| 365 | void abc77_reset_w(const device_config *device, int level) |
| 366 | { |
| 367 | abc77_t *abc77 = get_safe_token(device); |
| 368 | |
| 369 | if (abc77->reset && !level) |
| 370 | { |
| 371 | int t = 1.1 * RES_K(100) * CAP_N(100) * 1000; // t = 1.1 * R1 * C1 |
| 372 | int ea = BIT(input_port_read(device->machine, "ABC77_DSW"), 7); |
| 373 | |
| 374 | /* trigger reset */ |
| 375 | cpu_set_input_line(abc77->cpu, INPUT_LINE_RESET, ASSERT_LINE); |
| 376 | timer_adjust_oneshot(abc77->reset_timer, ATTOTIME_IN_MSEC(t), 0); |
| 377 | |
| 378 | cpu_set_input_line(abc77->cpu, MCS48_INPUT_EA, ea ? CLEAR_LINE : ASSERT_LINE); |
| 379 | } |
| 380 | |
| 381 | abc77->reset = level; |
| 382 | } |
| 383 | |
| 384 | /*------------------------------------------------- |
| 385 | DEVICE_START( abc77 ) |
| 386 | -------------------------------------------------*/ |
| 387 | |
| 318 | 388 | static DEVICE_START( abc77 ) |
| 319 | 389 | { |
| 320 | 390 | abc77_t *abc77 = device->token; |
| 391 | const abc77_interface *intf = get_interface(device); |
| 392 | |
| 321 | 393 | astring *tempstring = astring_alloc(); |
| 322 | 394 | |
| 323 | | /* validate arguments */ |
| 395 | /* resolve callbacks */ |
| 396 | devcb_resolve_write_line(&abc77->out_txd_func, &intf->out_txd_func, device); |
| 397 | devcb_resolve_write_line(&abc77->out_clock_func, &intf->out_clock_func, device); |
| 398 | devcb_resolve_write_line(&abc77->out_keydown_func, &intf->out_keydown_func, device); |
| 324 | 399 | |
| 325 | | assert(device->tag != NULL); |
| 326 | | |
| 327 | | abc77->intf = device->static_config; |
| 328 | | assert(abc77->intf != NULL); |
| 329 | | assert(abc77->intf->txd_w != NULL); |
| 330 | | assert(abc77->intf->keydown_w != NULL); |
| 331 | | |
| 332 | 400 | /* find our CPU */ |
| 333 | | |
| 334 | 401 | astring_printf(tempstring, "%s:%s", device->tag, I8035_TAG); |
| 335 | 402 | abc77->cpu = cputag_get_cpu(device->machine, astring_c(tempstring)); |
| 336 | 403 | astring_free(tempstring); |
| 337 | 404 | |
| 338 | 405 | /* allocate reset timer */ |
| 339 | | |
| 340 | 406 | abc77->reset_timer = timer_alloc(device->machine, reset_tick, (FPTR *) device); |
| 341 | 407 | |
| 342 | 408 | /* register for state saving */ |
| 343 | | |
| 344 | | state_save_register_item(device->machine, "abc77", device->tag, 0, abc77->keylatch); |
| 345 | | state_save_register_item(device->machine, "abc77", device->tag, 0, abc77->clock); |
| 346 | | state_save_register_item(device->machine, "abc77", device->tag, 0, abc77->hys); |
| 347 | | state_save_register_item(device->machine, "abc77", device->tag, 0, abc77->reset); |
| 409 | state_save_register_device_item(device, 0, abc77->keylatch); |
| 410 | state_save_register_device_item(device, 0, abc77->clock); |
| 411 | state_save_register_device_item(device, 0, abc77->hys); |
| 412 | state_save_register_device_item(device, 0, abc77->reset); |
| 348 | 413 | } |
| 349 | 414 | |
| 415 | /*------------------------------------------------- |
| 416 | DEVICE_SET_INFO( abc77 ) |
| 417 | -------------------------------------------------*/ |
| 418 | |
| 350 | 419 | static DEVICE_SET_INFO( abc77 ) |
| 351 | 420 | { |
| 352 | 421 | switch (state) |
| r4243 | r4244 | |
| 355 | 424 | } |
| 356 | 425 | } |
| 357 | 426 | |
| 427 | /*------------------------------------------------- |
| 428 | DEVICE_GET_INFO( abc77 ) |
| 429 | -------------------------------------------------*/ |
| 430 | |
| 358 | 431 | DEVICE_GET_INFO( abc77 ) |
| 359 | 432 | { |
| 360 | 433 | switch (state) |
src/mess/drivers/abc80x.c
| r4243 | r4244 | |
| 181 | 181 | { |
| 182 | 182 | const device_config *z80dart = devtag_get_device(machine, Z80DART, Z80DART_TAG); |
| 183 | 183 | |
| 184 | | z80dart_dcd_w(z80dart, Z80DART_CH_B, 0); |
| 184 | z80dart_dcdb_w(z80dart, 0); |
| 185 | 185 | z80dart_receive_data(z80dart, Z80DART_CH_B, keycode); |
| 186 | 186 | |
| 187 | 187 | keylatch = keycode; |
| r4243 | r4244 | |
| 193 | 193 | { |
| 194 | 194 | const device_config *z80dart = devtag_get_device(machine, Z80DART, Z80DART_TAG); |
| 195 | 195 | |
| 196 | | z80dart_dcd_w(z80dart, Z80DART_CH_B, 1); |
| 196 | z80dart_dcdb_w(z80dart, 1); |
| 197 | 197 | z80dart_receive_data(z80dart, Z80DART_CH_B, 0); |
| 198 | 198 | |
| 199 | 199 | keylatch = 0; |
| r4243 | r4244 | |
| 211 | 211 | static void abc800_bankswitch(running_machine *machine) |
| 212 | 212 | { |
| 213 | 213 | abc800_state *state = machine->driver_data; |
| 214 | const address_space *program = cputag_get_address_space(machine, Z80_TAG, ADDRESS_SPACE_PROGRAM); |
| 214 | 215 | |
| 215 | 216 | if (state->fetch_charram) |
| 216 | 217 | { |
| 217 | 218 | /* HR video RAM selected */ |
| 218 | | memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0x3fff, 0, 0, SMH_BANK1, SMH_BANK1); |
| 219 | memory_install_readwrite8_handler(program, 0x0000, 0x3fff, 0, 0, SMH_BANK1, SMH_BANK1); |
| 219 | 220 | } |
| 220 | 221 | else |
| 221 | 222 | { |
| 222 | 223 | /* BASIC ROM selected */ |
| 223 | | memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0x3fff, 0, 0, SMH_BANK1, SMH_UNMAP); |
| 224 | memory_install_readwrite8_handler(program, 0x0000, 0x3fff, 0, 0, SMH_BANK1, SMH_UNMAP); |
| 224 | 225 | } |
| 225 | 226 | |
| 226 | 227 | memory_set_bank(machine, 1, state->fetch_charram); |
| r4243 | r4244 | |
| 229 | 230 | static void abc802_bankswitch(running_machine *machine) |
| 230 | 231 | { |
| 231 | 232 | abc802_state *state = machine->driver_data; |
| 233 | const address_space *program = cputag_get_address_space(machine, Z80_TAG, ADDRESS_SPACE_PROGRAM); |
| 232 | 234 | |
| 233 | 235 | if (state->lrs) |
| 234 | 236 | { |
| 235 | 237 | /* ROM and video RAM selected */ |
| 236 | | memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0x77ff, 0, 0, SMH_BANK1, SMH_BANK1); |
| 237 | | memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x7800, 0x7fff, 0, 0, abc802_charram_r, abc802_charram_w); |
| 238 | memory_install_readwrite8_handler(program, 0x0000, 0x77ff, 0, 0, SMH_BANK1, SMH_BANK1); |
| 239 | memory_install_readwrite8_handler(program, 0x7800, 0x7fff, 0, 0, abc802_charram_r, abc802_charram_w); |
| 238 | 240 | } |
| 239 | 241 | else |
| 240 | 242 | { |
| 241 | 243 | /* low RAM selected */ |
| 242 | | memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1); |
| 244 | memory_install_readwrite8_handler(program, 0x0000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1); |
| 243 | 245 | } |
| 244 | 246 | |
| 245 | 247 | memory_set_bank(machine, 1, state->lrs); |
| r4243 | r4244 | |
| 248 | 250 | static void abc806_bankswitch(running_machine *machine) |
| 249 | 251 | { |
| 250 | 252 | abc806_state *state = machine->driver_data; |
| 253 | const address_space *program = cputag_get_address_space(machine, Z80_TAG, ADDRESS_SPACE_PROGRAM); |
| 251 | 254 | UINT32 videoram_mask = mess_ram_size - (32 * 1024) - 1; |
| 252 | 255 | FPTR bank; |
| 253 | 256 | |
| r4243 | r4244 | |
| 267 | 270 | |
| 268 | 271 | //logerror("%04x-%04x: Video RAM %04x (32K)\n", start_addr, end_addr, videoram_offset); |
| 269 | 272 | |
| 270 | | memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), start_addr, end_addr, 0, 0, SMH_BANK(bank), SMH_BANK(bank)); |
| 273 | memory_install_readwrite8_handler(program, start_addr, end_addr, 0, 0, SMH_BANK(bank), SMH_BANK(bank)); |
| 271 | 274 | memory_configure_bank(machine, bank, 1, 1, state->videoram + videoram_offset, 0); |
| 272 | 275 | memory_set_bank(machine, bank, 1); |
| 273 | 276 | } |
| r4243 | r4244 | |
| 281 | 284 | |
| 282 | 285 | //logerror("%04x-%04x: Work RAM (32K)\n", start_addr, end_addr); |
| 283 | 286 | |
| 284 | | memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), start_addr, end_addr, 0, 0, SMH_BANK(bank), SMH_BANK(bank)); |
| 287 | memory_install_readwrite8_handler(program, start_addr, end_addr, 0, 0, SMH_BANK(bank), SMH_BANK(bank)); |
| 285 | 288 | memory_set_bank(machine, bank, 0); |
| 286 | 289 | } |
| 287 | 290 | } |
| r4243 | r4244 | |
| 301 | 304 | /* map to video RAM */ |
| 302 | 305 | //logerror("%04x-%04x: Video RAM %04x (4K)\n", start_addr, end_addr, videoram_offset); |
| 303 | 306 | |
| 304 | | memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), start_addr, end_addr, 0, 0, SMH_BANK(bank), SMH_BANK(bank)); |
| 307 | memory_install_readwrite8_handler(program, start_addr, end_addr, 0, 0, SMH_BANK(bank), SMH_BANK(bank)); |
| 305 | 308 | memory_configure_bank(machine, bank, 1, 1, state->videoram + videoram_offset, 0); |
| 306 | 309 | memory_set_bank(machine, bank, 1); |
| 307 | 310 | } |
| r4243 | r4244 | |
| 315 | 318 | /* ROM */ |
| 316 | 319 | //logerror("%04x-%04x: ROM (4K)\n", start_addr, end_addr); |
| 317 | 320 | |
| 318 | | memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), start_addr, end_addr, 0, 0, SMH_BANK(bank), SMH_UNMAP); |
| 321 | memory_install_readwrite8_handler(program, start_addr, end_addr, 0, 0, SMH_BANK(bank), SMH_UNMAP); |
| 319 | 322 | memory_set_bank(machine, bank, 0); |
| 320 | 323 | break; |
| 321 | 324 | |
| r4243 | r4244 | |
| 323 | 326 | /* ROM/char RAM */ |
| 324 | 327 | //logerror("%04x-%04x: ROM (4K)\n", start_addr, end_addr); |
| 325 | 328 | |
| 326 | | memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x7000, 0x77ff, 0, 0, SMH_BANK(bank), SMH_UNMAP); |
| 327 | | memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x7800, 0x7fff, 0, 0, abc806_charram_r, abc806_charram_w); |
| 329 | memory_install_readwrite8_handler(program, 0x7000, 0x77ff, 0, 0, SMH_BANK(bank), SMH_UNMAP); |
| 330 | memory_install_readwrite8_handler(program, 0x7800, 0x7fff, 0, 0, abc806_charram_r, abc806_charram_w); |
| 328 | 331 | memory_set_bank(machine, bank, 0); |
| 329 | 332 | break; |
| 330 | 333 | |
| r4243 | r4244 | |
| 332 | 335 | /* work RAM */ |
| 333 | 336 | //logerror("%04x-%04x: Work RAM (4K)\n", start_addr, end_addr); |
| 334 | 337 | |
| 335 | | memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), start_addr, end_addr, 0, 0, SMH_BANK(bank), SMH_BANK(bank)); |
| 338 | memory_install_readwrite8_handler(program, start_addr, end_addr, 0, 0, SMH_BANK(bank), SMH_BANK(bank)); |
| 336 | 339 | memory_set_bank(machine, bank, 0); |
| 337 | 340 | break; |
| 338 | 341 | } |
| r4243 | r4244 | |
| 358 | 361 | |
| 359 | 362 | if (start_addr == 0x7000) |
| 360 | 363 | { |
| 361 | | memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x7000, 0x77ff, 0, 0, SMH_BANK(bank), SMH_BANK(bank)); |
| 362 | | memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x7800, 0x7fff, 0, 0, abc806_charram_r, abc806_charram_w); |
| 364 | memory_install_readwrite8_handler(program, 0x7000, 0x77ff, 0, 0, SMH_BANK(bank), SMH_BANK(bank)); |
| 365 | memory_install_readwrite8_handler(program, 0x7800, 0x7fff, 0, 0, abc806_charram_r, abc806_charram_w); |
| 363 | 366 | } |
| 364 | 367 | else |
| 365 | 368 | { |
| 366 | | memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), start_addr, end_addr, 0, 0, SMH_BANK(bank), SMH_BANK(bank)); |
| 369 | memory_install_readwrite8_handler(program, start_addr, end_addr, 0, 0, SMH_BANK(bank), SMH_BANK(bank)); |
| 367 | 370 | } |
| 368 | 371 | |
| 369 | 372 | memory_configure_bank(machine, bank, 1, 1, state->videoram + videoram_offset, 0); |
| r4243 | r4244 | |
| 710 | 713 | |
| 711 | 714 | /* ABC 77 */ |
| 712 | 715 | |
| 713 | | static ABC77_ON_TXD_CHANGED( abc800_abc77_txd_changed ) |
| 716 | static WRITE_LINE_DEVICE_HANDLER( abc800_abc77_txd_w ) |
| 714 | 717 | { |
| 715 | | abc800_state *state = device->machine->driver_data; |
| 718 | abc800_state *driver_state = device->machine->driver_data; |
| 716 | 719 | |
| 717 | | state->abc77_txd = level; |
| 720 | driver_state->abc77_txd = state; |
| 718 | 721 | } |
| 719 | 722 | |
| 720 | | static ABC77_ON_CLOCK_CHANGED( abc77_clock_changed ) |
| 723 | static WRITE_LINE_DEVICE_HANDLER( abc77_clock_w ) |
| 721 | 724 | { |
| 722 | 725 | const device_config *z80dart = devtag_get_device(device->machine, Z80DART, Z80DART_TAG); |
| 723 | 726 | |
| 724 | 727 | /* connected to DART channel B clock */ |
| 725 | | z80dart_rxtxcb_w(z80dart); |
| 728 | z80dart_rxtxcb_w(z80dart, state); |
| 726 | 729 | } |
| 727 | 730 | |
| 728 | | static ABC77_ON_KEYDOWN_CHANGED( abc77_keydown_changed ) |
| 731 | static WRITE_LINE_DEVICE_HANDLER( abc77_keydown_w ) |
| 729 | 732 | { |
| 730 | 733 | const device_config *z80dart = devtag_get_device(device->machine, Z80DART, Z80DART_TAG); |
| 731 | 734 | |
| 732 | | /* connected to DART channel B DCD (pin ) */ |
| 733 | | z80dart_dcd_w(z80dart, 1, level); |
| 735 | /* connected to DART channel B DCD */ |
| 736 | z80dart_dcdb_w(z80dart, state); |
| 734 | 737 | } |
| 735 | 738 | |
| 736 | 739 | static ABC77_INTERFACE( abc800_abc77_intf ) |
| 737 | 740 | { |
| 738 | | abc800_abc77_txd_changed, |
| 739 | | abc77_clock_changed, |
| 740 | | abc77_keydown_changed |
| 741 | DEVCB_LINE(abc800_abc77_txd_w), |
| 742 | DEVCB_LINE(abc77_clock_w), |
| 743 | DEVCB_LINE(abc77_keydown_w) |
| 741 | 744 | }; |
| 742 | 745 | |
| 743 | | static ABC77_ON_TXD_CHANGED( abc802_abc77_txd_changed ) |
| 746 | static WRITE_LINE_DEVICE_HANDLER( abc802_abc77_txd_w ) |
| 744 | 747 | { |
| 745 | | abc802_state *state = device->machine->driver_data; |
| 748 | abc802_state *driver_state = device->machine->driver_data; |
| 746 | 749 | |
| 747 | | state->abc77_txd = level; |
| 750 | driver_state->abc77_txd = state; |
| 748 | 751 | } |
| 749 | 752 | |
| 750 | 753 | static ABC77_INTERFACE( abc802_abc77_intf ) |
| 751 | 754 | { |
| 752 | | abc802_abc77_txd_changed, |
| 753 | | abc77_clock_changed, |
| 754 | | abc77_keydown_changed |
| 755 | DEVCB_LINE(abc802_abc77_txd_w), |
| 756 | DEVCB_LINE(abc77_clock_w), |
| 757 | DEVCB_LINE(abc77_keydown_w) |
| 755 | 758 | }; |
| 756 | 759 | |
| 757 | | static ABC77_ON_TXD_CHANGED( abc806_abc77_txd_changed ) |
| 760 | static WRITE_LINE_DEVICE_HANDLER( abc806_abc77_txd_w ) |
| 758 | 761 | { |
| 759 | | abc806_state *state = device->machine->driver_data; |
| 762 | abc806_state *driver_state = device->machine->driver_data; |
| 760 | 763 | |
| 761 | | state->abc77_txd = level; |
| 764 | driver_state->abc77_txd = state; |
| 762 | 765 | } |
| 763 | 766 | |
| 764 | 767 | static ABC77_INTERFACE( abc806_abc77_intf ) |
| 765 | 768 | { |
| 766 | | abc806_abc77_txd_changed, |
| 767 | | abc77_clock_changed, |
| 768 | | abc77_keydown_changed |
| 769 | DEVCB_LINE(abc806_abc77_txd_w), |
| 770 | DEVCB_LINE(abc77_clock_w), |
| 771 | DEVCB_LINE(abc77_keydown_w) |
| 769 | 772 | }; |
| 770 | 773 | |
| 771 | 774 | /* Z80 CTC */ |
| r4243 | r4244 | |
| 836 | 839 | const device_config *z80dart = devtag_get_device(device->machine, Z80DART, Z80DART_TAG); |
| 837 | 840 | |
| 838 | 841 | /* connected to DART channel A clock inputs */ |
| 839 | | z80dart_rxca_w(z80dart); |
| 840 | | z80dart_txca_w(z80dart); |
| 842 | z80dart_rxca_w(z80dart, data); |
| 843 | z80dart_txca_w(z80dart, data); |
| 841 | 844 | } |
| 842 | 845 | |
| 843 | 846 | static const z80ctc_interface ctc_intf = |
| r4243 | r4244 | |
| 895 | 898 | |
| 896 | 899 | /* Z80 DART */ |
| 897 | 900 | |
| 898 | | static Z80DART_ON_INT_CHANGED( dart_interrupt ) |
| 901 | static READ_LINE_DEVICE_HANDLER( abc800_dart_rxdb_r ) |
| 899 | 902 | { |
| 900 | | cpu_set_input_line(device->machine->cpu[0], INPUT_LINE_IRQ0, state); |
| 901 | | } |
| 902 | | |
| 903 | | static Z80DART_RXD_READ( abc800_dart_rxd_r ) |
| 904 | | { |
| 905 | 903 | abc800_state *state = device->machine->driver_data; |
| 906 | 904 | |
| 907 | | if (channel == Z80DART_CH_B) |
| 908 | | { |
| 909 | | /* receive bit from keyboard */ |
| 910 | | return state->abc77_txd; |
| 911 | | } |
| 912 | | |
| 913 | | return 1; |
| 905 | /* receive bit from keyboard */ |
| 906 | return state->abc77_txd; |
| 914 | 907 | } |
| 915 | 908 | |
| 916 | | static Z80DART_ON_TXD_CHANGED( abc800_dart_txd_w ) |
| 917 | | { |
| 918 | | abc800_state *state = device->machine->driver_data; |
| 919 | | |
| 920 | | if (channel == Z80DART_CH_B) |
| 921 | | { |
| 922 | | /* transmit bit to keyboard */ |
| 923 | | abc77_rxd_w(state->abc77, level); |
| 924 | | } |
| 925 | | } |
| 926 | | |
| 927 | 909 | static Z80DART_INTERFACE( abc800_dart_intf ) |
| 928 | 910 | { |
| 929 | | Z80_TAG, /* cpu */ |
| 930 | | ABC800_X01/2/2, /* clock */ |
| 931 | | 0, /* channel A receive clock */ |
| 932 | | 0, /* channel A transmit clock */ |
| 933 | | 0, /* channel B clock */ |
| 934 | | dart_interrupt, /* interrupt handler */ |
| 935 | | abc800_dart_rxd_r, /* receive handler */ |
| 936 | | abc800_dart_txd_w, /* transmit handler */ |
| 937 | | NULL, /* DTR changed handler */ |
| 938 | | NULL, /* RTS changed handler */ |
| 939 | | NULL /* W/RDY changed handler */ |
| 940 | | }; |
| 911 | 0, |
| 912 | 0, |
| 913 | 0, |
| 941 | 914 | |
| 942 | | static Z80DART_RXD_READ( abc802_dart_rxd_r ) |
| 943 | | { |
| 944 | | abc802_state *state = device->machine->driver_data; |
| 915 | DEVCB_NULL, |
| 916 | DEVCB_NULL, |
| 917 | DEVCB_NULL, |
| 918 | DEVCB_NULL, |
| 919 | DEVCB_NULL, |
| 945 | 920 | |
| 946 | | if (channel == Z80DART_CH_B) |
| 947 | | { |
| 948 | | /* receive bit from keyboard */ |
| 949 | | return state->abc77_txd; |
| 950 | | } |
| 921 | DEVCB_LINE(abc800_dart_rxdb_r), |
| 922 | DEVCB_NULL, /* DEVCB_DEVICE_LINE(ABC77, ABC77_TAG, abc77_rxd_w), */ |
| 923 | DEVCB_NULL, |
| 924 | DEVCB_NULL, |
| 925 | DEVCB_NULL, |
| 951 | 926 | |
| 952 | | return 1; |
| 953 | | } |
| 927 | DEVCB_CPU_INPUT_LINE(Z80_TAG, INPUT_LINE_IRQ0) |
| 928 | }; |
| 954 | 929 | |
| 955 | | static Z80DART_ON_TXD_CHANGED( abc802_dart_txd_w ) |
| 930 | static READ_LINE_DEVICE_HANDLER( abc802_dart_rxdb_r ) |
| 956 | 931 | { |
| 957 | 932 | abc802_state *state = device->machine->driver_data; |
| 958 | 933 | |
| 959 | | if (channel == Z80DART_CH_B) |
| 960 | | { |
| 961 | | /* transmit bit to keyboard */ |
| 962 | | abc77_rxd_w(state->abc77, level); |
| 963 | | } |
| 934 | /* receive bit from keyboard */ |
| 935 | return state->abc77_txd; |
| 964 | 936 | } |
| 965 | 937 | |
| 966 | | static Z80DART_ON_DTR_CHANGED( abc802_dart_dtr_w ) |
| 938 | static WRITE_LINE_DEVICE_HANDLER( abc802_dart_dtrb_r ) |
| 967 | 939 | { |
| 968 | | abc802_state *state = device->machine->driver_data; |
| 940 | abc802_state *driver_state = device->machine->driver_data; |
| 969 | 941 | |
| 970 | | if (channel == Z80DART_CH_B) |
| 971 | | { |
| 972 | | /* low RAM select */ |
| 973 | | state->lrs = level; |
| 942 | /* low RAM select */ |
| 943 | driver_state->lrs = state; |
| 974 | 944 | |
| 975 | | abc802_bankswitch(device->machine); |
| 976 | | } |
| 945 | abc802_bankswitch(device->machine); |
| 977 | 946 | } |
| 978 | 947 | |
| 979 | | static Z80DART_ON_RTS_CHANGED( abc802_dart_rts_w ) |
| 948 | static WRITE_LINE_DEVICE_HANDLER( abc802_dart_rtsb_r ) |
| 980 | 949 | { |
| 981 | | abc802_state *state = device->machine->driver_data; |
| 950 | abc802_state *driver_state = device->machine->driver_data; |
| 982 | 951 | |
| 983 | | if (channel == Z80DART_CH_B) |
| 984 | | { |
| 985 | | /* _MUX 80/40 */ |
| 986 | | state->mux80_40 = level; |
| 987 | | } |
| 952 | /* _MUX 80/40 */ |
| 953 | driver_state->mux80_40 = state; |
| 988 | 954 | } |
| 989 | 955 | |
| 990 | 956 | static Z80DART_INTERFACE( abc802_dart_intf ) |
| 991 | 957 | { |
| 992 | | Z80_TAG, /* cpu */ |
| 993 | | ABC800_X01/2/2, /* clock */ |
| 994 | | 0, /* channel A receive clock */ |
| 995 | | 0, /* channel A transmit clock */ |
| 996 | | 0, /* channel B clock */ |
| 997 | | dart_interrupt, /* interrupt handler */ |
| 998 | | abc802_dart_rxd_r, /* receive handler */ |
| 999 | | abc802_dart_txd_w, /* transmit handler */ |
| 1000 | | abc802_dart_dtr_w, /* DTR changed handler */ |
| 1001 | | abc802_dart_rts_w, /* RTS changed handler */ |
| 1002 | | NULL /* W/RDY changed handler */ |
| 1003 | | }; |
| 958 | 0, |
| 959 | 0, |
| 960 | 0, |
| 1004 | 961 | |
| 1005 | | static Z80DART_RXD_READ( abc806_dart_rxd_r ) |
| 1006 | | { |
| 1007 | | abc806_state *state = device->machine->driver_data; |
| 962 | DEVCB_NULL, |
| 963 | DEVCB_NULL, |
| 964 | DEVCB_NULL, |
| 965 | DEVCB_NULL, |
| 966 | DEVCB_NULL, |
| 1008 | 967 | |
| 1009 | | if (channel == Z80DART_CH_B) |
| 1010 | | { |
| 1011 | | /* receive bit from keyboard */ |
| 1012 | | return state->abc77_txd; |
| 1013 | | } |
| 968 | DEVCB_LINE(abc802_dart_rxdb_r), |
| 969 | DEVCB_NULL, /* DEVCB_DEVICE_LINE(ABC77, ABC77_TAG, abc77_rxd_w), */ |
| 970 | DEVCB_LINE(abc802_dart_dtrb_r), |
| 971 | DEVCB_LINE(abc802_dart_rtsb_r), |
| 972 | DEVCB_NULL, |
| 1014 | 973 | |
| 1015 | | return 1; |
| 1016 | | } |
| 974 | DEVCB_CPU_INPUT_LINE(Z80_TAG, INPUT_LINE_IRQ0) |
| 975 | }; |
| 1017 | 976 | |
| 1018 | | static Z80DART_ON_TXD_CHANGED( abc806_dart_txd_w ) |
| 977 | static READ_LINE_DEVICE_HANDLER( abc806_dart_rxdb_r ) |
| 1019 | 978 | { |
| 1020 | 979 | abc806_state *state = device->machine->driver_data; |
| 1021 | 980 | |
| 1022 | | if (channel == Z80DART_CH_B) |
| 1023 | | { |
| 1024 | | /* transmit bit to keyboard */ |
| 1025 | | abc77_rxd_w(state->abc77, level); |
| 1026 | | } |
| 981 | /* receive bit from keyboard */ |
| 982 | return state->abc77_txd; |
| 1027 | 983 | } |
| 1028 | 984 | |
| 1029 | | static Z80DART_ON_DTR_CHANGED( abc806_dart_dtr_w ) |
| 985 | static WRITE_LINE_DEVICE_HANDLER( abc806_dart_dtrb_w ) |
| 1030 | 986 | { |
| 1031 | | abc806_state *state = device->machine->driver_data; |
| 987 | abc806_state *driver_state = device->machine->driver_data; |
| 1032 | 988 | |
| 1033 | | if (channel == Z80DART_CH_B) |
| 1034 | | { |
| 1035 | | state->keydtr = level; |
| 989 | driver_state->keydtr = state; |
| 1036 | 990 | |
| 1037 | | abc806_bankswitch(device->machine); |
| 1038 | | } |
| 991 | abc806_bankswitch(device->machine); |
| 1039 | 992 | } |
| 1040 | 993 | |
| 1041 | 994 | static Z80DART_INTERFACE( abc806_dart_intf ) |
| 1042 | 995 | { |
| 1043 | | Z80_TAG, /* cpu */ |
| 1044 | | ABC800_X01/2/2, /* clock */ |
| 1045 | | 0, /* channel A receive clock */ |
| 1046 | | 0, /* channel A transmit clock */ |
| 1047 | | 0, /* channel B clock */ |
| 1048 | | dart_interrupt, /* interrupt handler */ |
| 1049 | | abc806_dart_rxd_r, /* receive handler */ |
| 1050 | | abc806_dart_txd_w, /* transmit handler */ |
| 1051 | | abc806_dart_dtr_w, /* DTR changed handler */ |
| 1052 | | NULL, /* RTS changed handler */ |
| 1053 | | NULL /* W/RDY changed handler */ |
| 1054 | | }; |
| 996 | 0, |
| 997 | 0, |
| 998 | 0, |
| 1055 | 999 | |
| 1056 | | /* E05-16 */ |
| 1000 | DEVCB_NULL, |
| 1001 | DEVCB_NULL, |
| 1002 | DEVCB_NULL, |
| 1003 | DEVCB_NULL, |
| 1004 | DEVCB_NULL, |
| 1057 | 1005 | |
| 1058 | | static const e0516_interface abc806_e0516_intf = |
| 1059 | | { |
| 1060 | | ABC806_X02 |
| 1006 | DEVCB_LINE(abc806_dart_rxdb_r), |
| 1007 | DEVCB_NULL, /* DEVCB_DEVICE_LINE(ABC77, ABC77_TAG, abc77_rxd_w), */ |
| 1008 | DEVCB_LINE(abc806_dart_dtrb_w), |
| 1009 | DEVCB_NULL, |
| 1010 | DEVCB_NULL, |
| 1011 | |
| 1012 | DEVCB_CPU_INPUT_LINE(Z80_TAG, INPUT_LINE_IRQ0) |
| 1061 | 1013 | }; |
| 1062 | 1014 | |
| 1063 | 1015 | /* Z80 Daisy Chain */ |
| r4243 | r4244 | |
| 1158 | 1110 | z80sio_set_cts(state->z80sio, 1, BIT(config, 1)); |
| 1159 | 1111 | |
| 1160 | 1112 | /* 40/80 char (S3) */ |
| 1161 | | z80dart_ri_w(state->z80dart, Z80DART_CH_A, BIT(config, 2)); // 0 = 40, 1 = 80 |
| 1113 | z80dart_ria_w(state->z80dart, BIT(config, 2)); // 0 = 40, 1 = 80 |
| 1162 | 1114 | |
| 1163 | 1115 | /* 50/60 Hz */ |
| 1164 | | z80dart_cts_w(state->z80dart, Z80DART_CH_B, BIT(config, 3)); // 0 = 50Hz, 1 = 60Hz |
| 1116 | z80dart_ctsb_w(state->z80dart, BIT(config, 3)); // 0 = 50Hz, 1 = 60Hz |
| 1165 | 1117 | } |
| 1166 | 1118 | |
| 1167 | 1119 | static MACHINE_START( abc806 ) |
| r4243 | r4244 | |
| 1229 | 1181 | e0516_dio_w(state->e0516, 1); |
| 1230 | 1182 | |
| 1231 | 1183 | /* 40/80 char */ |
| 1232 | | z80dart_ri_w(state->z80dart, Z80DART_CH_A, 1); // 0 = 40, 1 = 80 |
| 1184 | z80dart_ria_w(state->z80dart, 1); // 0 = 40, 1 = 80 |
| 1233 | 1185 | |
| 1234 | 1186 | /* 50/60 Hz */ |
| 1235 | | z80dart_cts_w(state->z80dart, Z80DART_CH_B, 0); // 0 = 50Hz, 1 = 60Hz |
| 1187 | z80dart_ctsb_w(state->z80dart, 0); // 0 = 50Hz, 1 = 60Hz |
| 1236 | 1188 | } |
| 1237 | 1189 | |
| 1238 | 1190 | /* Machine Drivers */ |
| r4243 | r4244 | |
| 1249 | 1201 | MDRV_MACHINE_START(abc800) |
| 1250 | 1202 | MDRV_MACHINE_RESET(abc800) |
| 1251 | 1203 | |
| 1252 | | /* fake keyboard */ |
| 1253 | | MDRV_TIMER_ADD_PERIODIC("keyboard", keyboard_tick, USEC(2500)) |
| 1254 | | |
| 1255 | | /* ABC-77 keyboard */ |
| 1256 | | // MDRV_ABC77_ADD(abc800_abc77_intf) |
| 1257 | | |
| 1258 | | /* Luxor Conkort 55-21046 */ |
| 1259 | | // MDRV_DEVICE_ADD(CONKORT_TAG, LUXOR_55_21046) |
| 1260 | | |
| 1261 | 1204 | /* video hardware */ |
| 1262 | 1205 | MDRV_IMPORT_FROM(abc800m_video) |
| 1263 | | |
| 1264 | | /* Z80 CTC */ |
| 1265 | | MDRV_Z80CTC_ADD(Z80CTC_TAG, ABC800_X01/2/2, ctc_intf) |
| 1266 | | MDRV_TIMER_ADD_PERIODIC("ctc", ctc_tick, HZ(ABC800_X01/2/2/2)) |
| 1267 | 1206 | |
| 1268 | | /* Z80 SIO/2 */ |
| 1269 | | MDRV_Z80SIO_ADD(Z80SIO_TAG, ABC800_X01/2/2, sio_intf) |
| 1270 | | |
| 1271 | | /* Z80 DART */ |
| 1272 | | MDRV_Z80DART_ADD(Z80DART_TAG, abc800_dart_intf) |
| 1273 | | |
| 1274 | | /* discrete sound */ |
| 1207 | /* sound hardware */ |
| 1275 | 1208 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 1276 | 1209 | MDRV_SOUND_ADD("discrete", DISCRETE, 0) |
| 1277 | 1210 | MDRV_SOUND_CONFIG_DISCRETE(abc800) |
| 1278 | 1211 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) |
| 1279 | | |
| 1280 | | /* printer */ |
| 1212 | |
| 1213 | /* peripheral hardware */ |
| 1214 | MDRV_Z80CTC_ADD(Z80CTC_TAG, ABC800_X01/2/2, ctc_intf) |
| 1215 | MDRV_TIMER_ADD_PERIODIC("ctc", ctc_tick, HZ(ABC800_X01/2/2/2)) |
| 1216 | MDRV_Z80SIO_ADD(Z80SIO_TAG, ABC800_X01/2/2, sio_intf) |
| 1217 | MDRV_Z80DART_ADD(Z80DART_TAG, ABC800_X01/2/2, abc800_dart_intf) |
| 1218 | // MDRV_ABC77_ADD(abc800_abc77_intf) |
| 1219 | // MDRV_LUXOR_55_21046_ADD |
| 1281 | 1220 | MDRV_PRINTER_ADD("printer") |
| 1282 | | |
| 1283 | | /* cassette */ |
| 1284 | 1221 | MDRV_CASSETTE_ADD( "cassette", default_cassette_config ) |
| 1222 | |
| 1223 | /* fake keyboard */ |
| 1224 | MDRV_TIMER_ADD_PERIODIC("keyboard", keyboard_tick, USEC(2500)) |
| 1285 | 1225 | MACHINE_DRIVER_END |
| 1286 | 1226 | |
| 1287 | 1227 | static MACHINE_DRIVER_START( abc800c ) |
| r4243 | r4244 | |
| 1296 | 1236 | MDRV_MACHINE_START(abc800) |
| 1297 | 1237 | MDRV_MACHINE_RESET(abc800) |
| 1298 | 1238 | |
| 1299 | | /* fake keyboard */ |
| 1300 | | MDRV_TIMER_ADD_PERIODIC("keyboard", keyboard_tick, USEC(2500)) |
| 1301 | | |
| 1302 | | /* ABC-77 keyboard */ |
| 1303 | | // MDRV_ABC77_ADD(abc800_abc77_intf) |
| 1304 | | |
| 1305 | | /* Luxor Conkort 55-21046 */ |
| 1306 | | // MDRV_DEVICE_ADD(CONKORT_TAG, LUXOR_55_21046) |
| 1307 | | |
| 1308 | 1239 | /* video hardware */ |
| 1309 | 1240 | MDRV_IMPORT_FROM(abc800c_video) |
| 1310 | 1241 | |
| 1311 | | /* Z80 CTC */ |
| 1312 | | MDRV_Z80CTC_ADD(Z80CTC_TAG, ABC800_X01/2/2, ctc_intf) |
| 1313 | | MDRV_TIMER_ADD_PERIODIC("ctc", ctc_tick, HZ(ABC800_X01/2/2/2)) |
| 1314 | | |
| 1315 | | /* Z80 SIO/2 */ |
| 1316 | | MDRV_Z80SIO_ADD(Z80SIO_TAG, ABC800_X01/2/2, sio_intf) |
| 1317 | | |
| 1318 | | /* Z80 DART */ |
| 1319 | | MDRV_Z80DART_ADD(Z80DART_TAG, abc800_dart_intf) |
| 1320 | | |
| 1321 | | /* discrete sound */ |
| 1242 | /* sound hardware */ |
| 1322 | 1243 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 1323 | 1244 | MDRV_SOUND_ADD("discrete", DISCRETE, 0) |
| 1324 | 1245 | MDRV_SOUND_CONFIG_DISCRETE(abc800) |
| 1325 | 1246 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) |
| 1326 | | |
| 1327 | | /* printer */ |
| 1247 | |
| 1248 | /* peripheral hardware */ |
| 1249 | MDRV_Z80CTC_ADD(Z80CTC_TAG, ABC800_X01/2/2, ctc_intf) |
| 1250 | MDRV_TIMER_ADD_PERIODIC("ctc", ctc_tick, HZ(ABC800_X01/2/2/2)) |
| 1251 | MDRV_Z80SIO_ADD(Z80SIO_TAG, ABC800_X01/2/2, sio_intf) |
| 1252 | MDRV_Z80DART_ADD(Z80DART_TAG, ABC800_X01/2/2, abc800_dart_intf) |
| 1253 | // MDRV_ABC77_ADD(abc800_abc77_intf) |
| 1254 | // MDRV_LUXOR_55_21046_ADD |
| 1328 | 1255 | MDRV_PRINTER_ADD("printer") |
| 1329 | | |
| 1330 | | /* cassette */ |
| 1331 | 1256 | MDRV_CASSETTE_ADD( "cassette", default_cassette_config ) |
| 1257 | |
| 1258 | /* fake keyboard */ |
| 1259 | MDRV_TIMER_ADD_PERIODIC("keyboard", keyboard_tick, USEC(2500)) |
| 1332 | 1260 | MACHINE_DRIVER_END |
| 1333 | 1261 | |
| 1334 | 1262 | static MACHINE_DRIVER_START( abc802 ) |
| r4243 | r4244 | |
| 1343 | 1271 | MDRV_MACHINE_START(abc802) |
| 1344 | 1272 | MDRV_MACHINE_RESET(abc802) |
| 1345 | 1273 | |
| 1346 | | /* fake keyboard */ |
| 1347 | | MDRV_TIMER_ADD_PERIODIC("keyboard", keyboard_tick, USEC(2500)) |
| 1348 | | |
| 1349 | | /* ABC-77 keyboard */ |
| 1350 | | // MDRV_ABC77_ADD(abc802_abc77_intf) |
| 1351 | | |
| 1352 | | /* Luxor Conkort 55-21046 */ |
| 1353 | | // MDRV_DEVICE_ADD(CONKORT_TAG, LUXOR_55_21046) |
| 1354 | | |
| 1355 | 1274 | /* video hardware */ |
| 1356 | 1275 | MDRV_IMPORT_FROM(abc802_video) |
| 1357 | 1276 | |
| 1358 | | /* Z80 CTC */ |
| 1359 | | MDRV_Z80CTC_ADD(Z80CTC_TAG, ABC800_X01/2/2, ctc_intf) |
| 1360 | | MDRV_TIMER_ADD_PERIODIC("ctc", ctc_tick, HZ(ABC800_X01/2/2/2)) |
| 1361 | | |
| 1362 | | /* Z80 SIO/2 */ |
| 1363 | | MDRV_Z80SIO_ADD(Z80SIO_TAG, ABC800_X01/2/2, sio_intf) |
| 1364 | | |
| 1365 | | /* Z80 DART */ |
| 1366 | | MDRV_Z80DART_ADD(Z80DART_TAG, abc802_dart_intf) |
| 1367 | | |
| 1368 | | /* discrete sound */ |
| 1277 | /* sound hardware */ |
| 1369 | 1278 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 1370 | 1279 | MDRV_SOUND_ADD("discrete", DISCRETE, 0) |
| 1371 | 1280 | MDRV_SOUND_CONFIG_DISCRETE(abc800) |
| 1372 | 1281 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) |
| 1373 | 1282 | |
| 1374 | | /* printer */ |
| 1283 | /* peripheral hardware */ |
| 1284 | MDRV_Z80CTC_ADD(Z80CTC_TAG, ABC800_X01/2/2, ctc_intf) |
| 1285 | MDRV_TIMER_ADD_PERIODIC("ctc", ctc_tick, HZ(ABC800_X01/2/2/2)) |
| 1286 | MDRV_Z80SIO_ADD(Z80SIO_TAG, ABC800_X01/2/2, sio_intf) |
| 1287 | MDRV_Z80DART_ADD(Z80DART_TAG, ABC800_X01/2/2, abc802_dart_intf) |
| 1288 | // MDRV_ABC77_ADD(abc802_abc77_intf) |
| 1289 | // MDRV_LUXOR_55_21046_ADD |
| 1375 | 1290 | MDRV_PRINTER_ADD("printer") |
| 1376 | | |
| 1377 | | /* cassette */ |
| 1378 | 1291 | MDRV_CASSETTE_ADD( "cassette", default_cassette_config ) |
| 1292 | |
| 1293 | /* fake keyboard */ |
| 1294 | MDRV_TIMER_ADD_PERIODIC("keyboard", keyboard_tick, USEC(2500)) |
| 1379 | 1295 | MACHINE_DRIVER_END |
| 1380 | 1296 | |
| 1381 | 1297 | static MACHINE_DRIVER_START( abc806 ) |
| r4243 | r4244 | |
| 1390 | 1306 | MDRV_MACHINE_START(abc806) |
| 1391 | 1307 | MDRV_MACHINE_RESET(abc806) |
| 1392 | 1308 | |
| 1393 | | /* fake keyboard */ |
| 1394 | | MDRV_TIMER_ADD_PERIODIC("keyboard", keyboard_tick, USEC(2500)) |
| 1395 | | |
| 1396 | | /* ABC-77 keyboard */ |
| 1397 | | //MDRV_ABC77_ADD(abc806_abc77_intf) |
| 1398 | | |
| 1399 | | /* Luxor Conkort 55-21046 */ |
| 1400 | | // MDRV_DEVICE_ADD(CONKORT_TAG, LUXOR_55_21046) |
| 1401 | | |
| 1402 | 1309 | /* video hardware */ |
| 1403 | 1310 | MDRV_IMPORT_FROM(abc806_video) |
| 1404 | 1311 | |
| 1405 | | /* Z80 CTC */ |
| 1312 | /* sound hardware */ |
| 1313 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 1314 | |
| 1315 | /* peripheral hardware */ |
| 1316 | MDRV_E0516_ADD(E0516_TAG, ABC806_X02) |
| 1406 | 1317 | MDRV_Z80CTC_ADD(Z80CTC_TAG, ABC800_X01/2/2, ctc_intf) |
| 1407 | 1318 | MDRV_TIMER_ADD_PERIODIC("ctc", ctc_tick, HZ(ABC800_X01/2/2/2)) |
| 1408 | | |
| 1409 | | /* Z80 SIO/2 */ |
| 1410 | 1319 | MDRV_Z80SIO_ADD(Z80SIO_TAG, ABC800_X01/2/2, sio_intf) |
| 1411 | | |
| 1412 | | /* Z80 DART */ |
| 1413 | | MDRV_Z80DART_ADD(Z80DART_TAG, abc806_dart_intf) |
| 1414 | | |
| 1415 | | /* real time clock */ |
| 1416 | | MDRV_E0516_ADD(E0516_TAG, abc806_e0516_intf) |
| 1417 | | |
| 1418 | | /* printer */ |
| 1320 | MDRV_Z80DART_ADD(Z80DART_TAG, ABC800_X01/2/2, abc806_dart_intf) |
| 1321 | // MDRV_ABC77_ADD(abc806_abc77_intf) |
| 1322 | // MDRV_LUXOR_55_21046_ADD |
| 1419 | 1323 | MDRV_PRINTER_ADD("printer") |
| 1420 | | |
| 1421 | | /* cassette */ |
| 1422 | 1324 | MDRV_CASSETTE_ADD( "cassette", default_cassette_config ) |
| 1325 | |
| 1326 | /* fake keyboard */ |
| 1327 | MDRV_TIMER_ADD_PERIODIC("keyboard", keyboard_tick, USEC(2500)) |
| 1423 | 1328 | MACHINE_DRIVER_END |
| 1424 | 1329 | |
| 1425 | 1330 | /* ROMs */ |
| r4243 | r4244 | |
| 1702 | 1607 | |
| 1703 | 1608 | static DRIVER_INIT( abc800 ) |
| 1704 | 1609 | { |
| 1705 | | memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), abc800_direct_update_handler); |
| 1610 | memory_set_direct_update_handler(cputag_get_address_space(machine, Z80_TAG, ADDRESS_SPACE_PROGRAM), abc800_direct_update_handler); |
| 1706 | 1611 | } |
| 1707 | 1612 | |
| 1708 | 1613 | static DRIVER_INIT( abc802 ) |
| 1709 | 1614 | { |
| 1710 | | memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), abc802_direct_update_handler); |
| 1615 | memory_set_direct_update_handler(cputag_get_address_space(machine, Z80_TAG, ADDRESS_SPACE_PROGRAM), abc802_direct_update_handler); |
| 1711 | 1616 | } |
| 1712 | 1617 | |
| 1713 | 1618 | static DRIVER_INIT( abc806 ) |
| 1714 | 1619 | { |
| 1715 | | memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), abc806_direct_update_handler); |
| 1620 | memory_set_direct_update_handler(cputag_get_address_space(machine, Z80_TAG, ADDRESS_SPACE_PROGRAM), abc806_direct_update_handler); |
| 1716 | 1621 | } |
| 1717 | 1622 | |
| 1718 | 1623 | /* System Drivers */ |