src/mess/machine/dgn_beta.c
| r5984 | r5985 | |
| 67 | 67 | #include "machine/6551.h" |
| 68 | 68 | #include "image.h" |
| 69 | 69 | #include "machine/wd17xx.h" |
| 70 | #include "devices/flopdrv.h" |
| 70 | 71 | |
| 71 | 72 | #include "debug/debugcpu.h" |
| 72 | 73 | #include "debug/debugcon.h" |
| r5984 | r5985 | |
| 923 | 924 | /* Dragon Beta onboard FDC */ |
| 924 | 925 | /********************************************************************************************/ |
| 925 | 926 | |
| 926 | | static WD17XX_CALLBACK( dgnbeta_fdc_callback ) |
| 927 | /* The INTRQ line goes through pia2 ca1, in exactly the same way as DRQ from DragonDos does */ |
| 928 | static WRITE_LINE_DEVICE_HANDLER( dgnbeta_fdc_intrq_w ) |
| 927 | 929 | { |
| 928 | | /* The INTRQ line goes through pia2 ca1, in exactly the same way as DRQ from DragonDos does */ |
| 929 | | /* DRQ is routed through various logic to the FIRQ inturrupt line on *BOTH* CPUs */ |
| 930 | | const device_config *pia_2 = devtag_get_device( device->machine, "pia_2" ); |
| 930 | LOG_DISK(("dgnbeta_fdc_intrq_w(%d)\n", state)); |
| 931 | pia6821_ca1_w(device, 0, state); |
| 932 | } |
| 931 | 933 | |
| 932 | | switch(state) |
| 933 | | { |
| 934 | | case WD17XX_IRQ_CLR: |
| 935 | | pia6821_ca1_w(pia_2, 0, CLEAR_LINE); |
| 936 | | break; |
| 937 | | case WD17XX_IRQ_SET: |
| 938 | | pia6821_ca1_w(pia_2, 0, ASSERT_LINE); |
| 939 | | break; |
| 940 | | case WD17XX_DRQ_CLR: |
| 941 | | /*wd2797_drq=CLEAR_LINE;*/ |
| 942 | | cpu1_recalc_firq(device->machine, CLEAR_LINE); |
| 943 | | break; |
| 944 | | case WD17XX_DRQ_SET: |
| 945 | | /*wd2797_drq=ASSERT_LINE;*/ |
| 946 | | cpu1_recalc_firq(device->machine, ASSERT_LINE); |
| 947 | | break; |
| 948 | | } |
| 949 | | |
| 950 | | LOG_DISK(("dgnbeta_fdc_callback(%d)\n",state)); |
| 934 | /* DRQ is routed through various logic to the FIRQ inturrupt line on *BOTH* CPUs */ |
| 935 | static WRITE_LINE_DEVICE_HANDLER( dgnbeta_fdc_drq_w ) |
| 936 | { |
| 937 | LOG_DISK(("dgnbeta_fdc_drq_w(%d)\n", state)); |
| 938 | cpu1_recalc_firq(device->machine, state); |
| 951 | 939 | } |
| 952 | 940 | |
| 953 | | const wd17xx_interface dgnbeta_wd17xx_interface = { dgnbeta_fdc_callback, NULL, {FLOPPY_0,FLOPPY_1,FLOPPY_2,FLOPPY_3}}; |
| 941 | const wd17xx_interface dgnbeta_wd17xx_interface = |
| 942 | { |
| 943 | DEVCB_DEVICE_LINE("pia_2", dgnbeta_fdc_intrq_w), |
| 944 | DEVCB_LINE(dgnbeta_fdc_drq_w), |
| 945 | NULL, |
| 946 | {FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3} |
| 947 | }; |
| 954 | 948 | |
| 955 | | READ8_HANDLER(dgnbeta_wd2797_r) |
| 949 | READ8_HANDLER(dgnbeta_wd2797_r) |
| 956 | 950 | { |
| 957 | 951 | int result = 0; |
| 958 | 952 | const device_config *fdc = devtag_get_device(space->machine, "wd179x"); |
src/mess/machine/conkort.c
| r5984 | r5985 | |
| 93 | 93 | #include "cpu/z80/z80daisy.h" |
| 94 | 94 | #include "machine/wd17xx.h" |
| 95 | 95 | #include "machine/abcbus.h" |
| 96 | #include "devices/flopdrv.h" |
| 96 | 97 | |
| 98 | |
| 97 | 99 | /*************************************************************************** |
| 98 | 100 | PARAMETERS |
| 99 | 101 | ***************************************************************************/ |
| r5984 | r5985 | |
| 695 | 697 | |
| 696 | 698 | /* FD1791 */ |
| 697 | 699 | |
| 698 | | static WD17XX_CALLBACK( slow_wd1791_callback ) |
| 700 | static WRITE_LINE_DEVICE_HANDLER( slow_wd1791_intrq_w ) |
| 699 | 701 | { |
| 700 | 702 | slow_t *conkort = get_safe_token_machine_slow(device->machine); |
| 701 | | |
| 702 | | switch(state) |
| 703 | | { |
| 704 | | case WD17XX_IRQ_CLR: |
| 705 | | conkort->fdc_irq = 0; |
| 706 | | break; |
| 707 | | case WD17XX_IRQ_SET: |
| 708 | | conkort->fdc_irq = 1; |
| 709 | | break; |
| 710 | | case WD17XX_DRQ_CLR: |
| 711 | | break; |
| 712 | | case WD17XX_DRQ_SET: |
| 713 | | break; |
| 714 | | } |
| 703 | conkort->fdc_irq = state; |
| 715 | 704 | } |
| 716 | 705 | |
| 717 | 706 | static const wd17xx_interface slow_wd17xx_interface = |
| 718 | 707 | { |
| 719 | | slow_wd1791_callback, |
| 708 | DEVCB_LINE(slow_wd1791_intrq_w), |
| 709 | DEVCB_NULL, |
| 720 | 710 | NULL, |
| 721 | | {FLOPPY_0,FLOPPY_1,FLOPPY_2,FLOPPY_3} |
| 711 | {FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3} |
| 722 | 712 | }; |
| 723 | 713 | |
| 724 | 714 | /* FD1793 */ |
| 725 | 715 | |
| 726 | | static WD17XX_CALLBACK( fast_wd1793_callback ) |
| 716 | static WRITE_LINE_DEVICE_HANDLER( fast_wd1793_drq_w ) |
| 727 | 717 | { |
| 728 | 718 | fast_t *conkort = get_safe_token_machine_fast(device->machine); |
| 729 | | |
| 730 | | switch(state) |
| 731 | | { |
| 732 | | case WD17XX_IRQ_CLR: |
| 733 | | break; |
| 734 | | case WD17XX_IRQ_SET: |
| 735 | | break; |
| 736 | | case WD17XX_DRQ_CLR: |
| 737 | | z80dma_rdy_w(conkort->z80dma, 0, 0); |
| 738 | | break; |
| 739 | | case WD17XX_DRQ_SET: |
| 740 | | z80dma_rdy_w(conkort->z80dma, 0, 1); |
| 741 | | break; |
| 742 | | } |
| 719 | z80dma_rdy_w(conkort->z80dma, 0, state); |
| 743 | 720 | } |
| 744 | 721 | |
| 745 | 722 | static const wd17xx_interface fast_wd17xx_interface = |
| 746 | 723 | { |
| 747 | | fast_wd1793_callback, |
| 724 | DEVCB_NULL, |
| 725 | DEVCB_LINE(fast_wd1793_drq_w), |
| 748 | 726 | NULL, |
| 749 | | {FLOPPY_0,FLOPPY_1,FLOPPY_2,FLOPPY_3} |
| 727 | {FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3} |
| 750 | 728 | }; |
| 751 | 729 | |
| 752 | 730 | /* Machine Driver */ |
src/mess/machine/coco.c
| r5984 | r5985 | |
| 99 | 99 | #include "sound/ay8910.h" |
| 100 | 100 | #include "devices/cococart.h" |
| 101 | 101 | #include "devices/cartslot.h" |
| 102 | #include "devices/flopdrv.h" |
| 102 | 103 | |
| 103 | 104 | |
| 104 | 105 | /*************************************************************************** |
| r5984 | r5985 | |
| 1748 | 1749 | /* Dragon Alpha onboard FDC */ |
| 1749 | 1750 | /********************************************************************************************/ |
| 1750 | 1751 | |
| 1751 | | static WD17XX_CALLBACK( dgnalpha_fdc_callback ) |
| 1752 | /* The NMI line on the alphaAlpha is gated through IC16 (early PLD), and is gated by pia2 CA2 */ |
| 1753 | static WRITE_LINE_DEVICE_HANDLER( dgnalpha_fdc_intrq_w ) |
| 1752 | 1754 | { |
| 1753 | | /* The NMI line on the alphaAlpha is gated through IC16 (early PLD), and is gated by pia2 CA2 */ |
| 1754 | | /* The DRQ line goes through pia2 cb1, in exactly the same way as DRQ from DragonDos does */ |
| 1755 | | /* for pia1 cb1 */ |
| 1756 | 1755 | coco_state *cstate = device->machine->driver_data; |
| 1757 | 1756 | |
| 1758 | | switch(state) |
| 1757 | if (state) |
| 1759 | 1758 | { |
| 1760 | | case WD17XX_IRQ_CLR: |
| 1761 | | cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_NMI, CLEAR_LINE); |
| 1762 | | break; |
| 1763 | | case WD17XX_IRQ_SET: |
| 1764 | | if(dgnalpha_just_reset) |
| 1765 | | { |
| 1766 | | dgnalpha_just_reset = 0; |
| 1767 | | } |
| 1768 | | else |
| 1769 | | { |
| 1770 | | if (pia6821_get_output_ca2_z(cstate->pia_2)) |
| 1771 | | cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_NMI, ASSERT_LINE); |
| 1772 | | } |
| 1773 | | break; |
| 1774 | | case WD17XX_DRQ_CLR: |
| 1775 | | pia6821_cb1_w(cstate->pia_2, 0, CARTLINE_CLEAR); |
| 1776 | | break; |
| 1777 | | case WD17XX_DRQ_SET: |
| 1778 | | pia6821_cb1_w(cstate->pia_2, 0, CARTLINE_ASSERTED); |
| 1779 | | break; |
| 1759 | if(dgnalpha_just_reset) |
| 1760 | { |
| 1761 | dgnalpha_just_reset = 0; |
| 1762 | } |
| 1763 | else |
| 1764 | { |
| 1765 | if (pia6821_get_output_ca2_z(cstate->pia_2)) |
| 1766 | cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_NMI, ASSERT_LINE); |
| 1767 | } |
| 1780 | 1768 | } |
| 1769 | else |
| 1770 | { |
| 1771 | cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_NMI, CLEAR_LINE); |
| 1772 | } |
| 1781 | 1773 | } |
| 1782 | 1774 | |
| 1775 | /* The DRQ line goes through pia2 cb1, in exactly the same way as DRQ from DragonDos does */ |
| 1776 | /* for pia1 cb1 */ |
| 1777 | static WRITE_LINE_DEVICE_HANDLER( dgnalpha_fdc_drq_w ) |
| 1778 | { |
| 1779 | coco_state *cstate = device->machine->driver_data; |
| 1780 | pia6821_cb1_w(cstate->pia_2, 0, state ? CARTLINE_ASSERTED : CARTLINE_CLEAR); |
| 1781 | } |
| 1782 | |
| 1783 | 1783 | /* The Dragon Alpha hardware reverses the order of the WD2797 registers */ |
| 1784 | 1784 | READ8_HANDLER(wd2797_r) |
| 1785 | 1785 | { |
| r5984 | r5985 | |
| 2919 | 2919 | dgnalpha_just_reset=1; |
| 2920 | 2920 | } |
| 2921 | 2921 | |
| 2922 | | const wd17xx_interface dgnalpha_wd17xx_interface = { |
| 2923 | | dgnalpha_fdc_callback, |
| 2922 | const wd17xx_interface dgnalpha_wd17xx_interface = |
| 2923 | { |
| 2924 | DEVCB_LINE(dgnalpha_fdc_intrq_w), |
| 2925 | DEVCB_LINE(dgnalpha_fdc_drq_w), |
| 2924 | 2926 | NULL, |
| 2925 | | {FLOPPY_0,FLOPPY_1,FLOPPY_2,FLOPPY_3} |
| 2927 | {FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3} |
| 2926 | 2928 | }; |
| 2929 | |
| 2927 | 2930 | /******* Machine Setups CoCos **********/ |
| 2928 | 2931 | |
| 2929 | 2932 | MACHINE_START( coco ) |
src/mess/machine/99_dsk.c
| r5984 | r5985 | |
| 367 | 367 | /* |
| 368 | 368 | callback called whenever DRQ/IRQ state change |
| 369 | 369 | */ |
| 370 | | static WD17XX_CALLBACK( fdc_callback ) |
| 370 | static WRITE_LINE_DEVICE_HANDLER( ti99_fdc_intrq_w ) |
| 371 | 371 | { |
| 372 | | switch (state) |
| 372 | if (state) |
| 373 | 373 | { |
| 374 | | case WD17XX_IRQ_CLR: |
| 375 | | DRQ_IRQ_status &= ~fdc_IRQ; |
| 376 | | ti99_peb_set_ilb_bit(device->machine, intb_fdc_bit, 0); |
| 377 | | break; |
| 378 | | case WD17XX_IRQ_SET: |
| 379 | 374 | DRQ_IRQ_status |= fdc_IRQ; |
| 380 | 375 | ti99_peb_set_ilb_bit(device->machine, intb_fdc_bit, 1); |
| 381 | | break; |
| 382 | | case WD17XX_DRQ_CLR: |
| 383 | | DRQ_IRQ_status &= ~fdc_DRQ; |
| 384 | | break; |
| 385 | | case WD17XX_DRQ_SET: |
| 386 | | DRQ_IRQ_status |= fdc_DRQ; |
| 387 | | break; |
| 388 | 376 | } |
| 377 | else |
| 378 | { |
| 379 | DRQ_IRQ_status &= ~fdc_IRQ; |
| 380 | ti99_peb_set_ilb_bit(device->machine, intb_fdc_bit, 0); |
| 381 | } |
| 389 | 382 | |
| 390 | 383 | fdc_handle_hold(device->machine); |
| 391 | 384 | } |
| 392 | 385 | |
| 393 | | const wd17xx_interface ti99_wd17xx_interface = { fdc_callback, NULL, {FLOPPY_0,FLOPPY_1,FLOPPY_2,FLOPPY_3} }; |
| 386 | static WRITE_LINE_DEVICE_HANDLER( ti99_fdc_drq_w ) |
| 387 | { |
| 388 | if (state) |
| 389 | DRQ_IRQ_status |= fdc_DRQ; |
| 390 | else |
| 391 | DRQ_IRQ_status &= ~fdc_DRQ; |
| 394 | 392 | |
| 393 | fdc_handle_hold(device->machine); |
| 394 | } |
| 395 | 395 | |
| 396 | const wd17xx_interface ti99_wd17xx_interface = |
| 397 | { |
| 398 | DEVCB_LINE(ti99_fdc_intrq_w), |
| 399 | DEVCB_LINE(ti99_fdc_drq_w), |
| 400 | NULL, |
| 401 | {FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3} |
| 402 | }; |
| 403 | |
| 404 | |
| 396 | 405 | /* |
| 397 | 406 | Initializes all available controllers. This routine is only used in the |
| 398 | 407 | init state of the emulator. During the normal operation, only the |
src/mess/machine/oric.c
| r5984 | r5985 | |
| 27 | 27 | #include "machine/ctronics.h" |
| 28 | 28 | #include "devices/cassette.h" |
| 29 | 29 | #include "sound/ay8910.h" |
| 30 | #include "devices/flopdrv.h" |
| 30 | 31 | |
| 31 | 32 | |
| 32 | 33 | UINT8 *oric_ram; |
| r5984 | r5985 | |
| 661 | 662 | } |
| 662 | 663 | } |
| 663 | 664 | |
| 664 | | static WD17XX_CALLBACK( oric_jasmin_wd179x_callback ) |
| 665 | /* DRQ is connected to interrupt */ |
| 666 | static WRITE_LINE_DEVICE_HANDLER( oric_jasmin_wd179x_drq_w ) |
| 665 | 667 | { |
| 666 | | switch (state) |
| 667 | | { |
| 668 | | /* DRQ is connected to interrupt */ |
| 669 | | case WD17XX_DRQ_CLR: |
| 670 | | { |
| 671 | | oric_irqs &=~(1<<1); |
| 668 | if (state) |
| 669 | oric_irqs |= (1<<1); |
| 670 | else |
| 671 | oric_irqs &=~(1<<1); |
| 672 | 672 | |
| 673 | | oric_refresh_ints(device->machine); |
| 674 | | } |
| 675 | | break; |
| 676 | | |
| 677 | | case WD17XX_DRQ_SET: |
| 678 | | { |
| 679 | | oric_irqs |= (1<<1); |
| 680 | | |
| 681 | | oric_refresh_ints(device->machine); |
| 682 | | } |
| 683 | | break; |
| 684 | | |
| 685 | | default: |
| 686 | | break; |
| 687 | | } |
| 673 | oric_refresh_ints(device->machine); |
| 688 | 674 | } |
| 689 | 675 | |
| 690 | 676 | static READ8_HANDLER (oric_jasmin_r) |
| r5984 | r5985 | |
| 815 | 801 | oric_refresh_ints(machine); |
| 816 | 802 | } |
| 817 | 803 | |
| 818 | | static WD17XX_CALLBACK( oric_microdisc_wd179x_callback ) |
| 804 | static WRITE_LINE_DEVICE_HANDLER( oric_microdisc_wd179x_intrq_w ) |
| 819 | 805 | { |
| 820 | | switch (state) |
| 821 | | { |
| 822 | | case WD17XX_IRQ_CLR: |
| 823 | | { |
| 824 | | port_314_r |=(1<<7); |
| 806 | oric_wd179x_int_state = state; |
| 825 | 807 | |
| 826 | | oric_wd179x_int_state = 0; |
| 808 | if (state) |
| 809 | port_314_r &= ~(1<<7); |
| 810 | else |
| 811 | port_314_r |=(1<<7); |
| 827 | 812 | |
| 828 | | oric_microdisc_refresh_wd179x_ints(device->machine); |
| 829 | | } |
| 830 | | break; |
| 813 | oric_microdisc_refresh_wd179x_ints(device->machine); |
| 814 | } |
| 831 | 815 | |
| 832 | | case WD17XX_IRQ_SET: |
| 833 | | { |
| 834 | | port_314_r &= ~(1<<7); |
| 835 | | |
| 836 | | oric_wd179x_int_state = 1; |
| 837 | | |
| 838 | | oric_microdisc_refresh_wd179x_ints(device->machine); |
| 839 | | } |
| 840 | | break; |
| 841 | | |
| 842 | | case WD17XX_DRQ_CLR: |
| 843 | | { |
| 844 | | port_318_r |= (1<<7); |
| 845 | | } |
| 846 | | break; |
| 847 | | |
| 848 | | case WD17XX_DRQ_SET: |
| 849 | | { |
| 850 | | port_318_r &=~(1<<7); |
| 851 | | } |
| 852 | | break; |
| 853 | | } |
| 816 | static WRITE_LINE_DEVICE_HANDLER( oric_microdisc_wd179x_drq_w ) |
| 817 | { |
| 818 | if (state) |
| 819 | port_318_r &=~(1<<7); |
| 820 | else |
| 821 | port_318_r |= (1<<7); |
| 854 | 822 | } |
| 855 | 823 | |
| 856 | | |
| 857 | 824 | static void oric_microdisc_set_mem_0x0c000(running_machine *machine) |
| 858 | 825 | { |
| 859 | 826 | if (oric_is_telestrat) |
| r5984 | r5985 | |
| 1045 | 1012 | |
| 1046 | 1013 | /*********************************************************/ |
| 1047 | 1014 | |
| 1015 | static WRITE_LINE_DEVICE_HANDLER( oric_wd179x_intrq_w ) |
| 1016 | { |
| 1017 | if ((input_port_read(device->machine, "FLOPPY") & 0x07) == ORIC_FLOPPY_INTERFACE_MICRODISC) |
| 1018 | oric_microdisc_wd179x_intrq_w(device, state); |
| 1019 | } |
| 1048 | 1020 | |
| 1049 | | static WD17XX_CALLBACK(oric_wd179x_callback) |
| 1021 | static WRITE_LINE_DEVICE_HANDLER( oric_wd179x_drq_w ) |
| 1050 | 1022 | { |
| 1051 | 1023 | switch (input_port_read(device->machine, "FLOPPY") & 0x07) |
| 1052 | 1024 | { |
| r5984 | r5985 | |
| 1055 | 1027 | case ORIC_FLOPPY_INTERFACE_APPLE2: |
| 1056 | 1028 | return; |
| 1057 | 1029 | case ORIC_FLOPPY_INTERFACE_MICRODISC: |
| 1058 | | oric_microdisc_wd179x_callback(device, state, param); |
| 1030 | oric_microdisc_wd179x_drq_w(device, state); |
| 1059 | 1031 | return; |
| 1060 | 1032 | case ORIC_FLOPPY_INTERFACE_JASMIN: |
| 1061 | | oric_jasmin_wd179x_callback(device, state, param); |
| 1033 | oric_jasmin_wd179x_drq_w(device, state); |
| 1062 | 1034 | return; |
| 1063 | 1035 | } |
| 1064 | 1036 | } |
| 1065 | 1037 | |
| 1066 | | const wd17xx_interface oric_wd17xx_interface = { oric_wd179x_callback, NULL, {FLOPPY_0,FLOPPY_1,FLOPPY_2,FLOPPY_3} }; |
| 1038 | const wd17xx_interface oric_wd17xx_interface = |
| 1039 | { |
| 1040 | DEVCB_LINE(oric_wd179x_intrq_w), |
| 1041 | DEVCB_LINE(oric_wd179x_drq_w), |
| 1042 | NULL, |
| 1043 | {FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3} |
| 1044 | }; |
| 1067 | 1045 | |
| 1068 | 1046 | static void oric_common_init_machine(running_machine *machine) |
| 1069 | 1047 | { |
src/mess/machine/wd17xx.c
| r5984 | r5985 | |
| 197 | 197 | typedef struct _wd17xx_t wd17xx_t; |
| 198 | 198 | struct _wd17xx_t |
| 199 | 199 | { |
| 200 | /* callbacks */ |
| 201 | devcb_resolved_write_line out_intrq_func; |
| 202 | devcb_resolved_write_line out_drq_func; |
| 203 | |
| 200 | 204 | DENSITY density; /* FM/MFM, single / double density */ |
| 201 | 205 | wd17xx_type_t type; |
| 202 | 206 | UINT8 track_reg; /* value of track register */ |
| r5984 | r5985 | |
| 816 | 820 | |
| 817 | 821 | |
| 818 | 822 | |
| 819 | | static void wd17xx_callback(const device_config *device, wd17xx_state_t state) |
| 820 | | { |
| 821 | | wd17xx_t *w = get_safe_token(device); |
| 822 | | void *param = NULL; |
| 823 | | if (w->intf->callback_param) |
| 824 | | param = (*w->intf->callback_param)(device); |
| 825 | | if (w->intf->callback) |
| 826 | | (*w->intf->callback)(device, state, param); |
| 827 | | } |
| 828 | | |
| 829 | | |
| 830 | | |
| 831 | 823 | static void wd17xx_set_irq(const device_config *device) |
| 832 | 824 | { |
| 833 | 825 | wd17xx_t *w = get_safe_token(device); |
| 826 | |
| 834 | 827 | w->status &= ~STA_2_BUSY; |
| 835 | | /* generate an IRQ */ |
| 836 | | wd17xx_callback(device, WD17XX_IRQ_SET); |
| 828 | devcb_call_write_line(&w->out_intrq_func, ASSERT_LINE); |
| 837 | 829 | } |
| 838 | 830 | |
| 839 | 831 | |
| r5984 | r5985 | |
| 1015 | 1007 | wd17xx_t *w = get_safe_token(device); |
| 1016 | 1008 | |
| 1017 | 1009 | // w->status_drq = 0; |
| 1018 | | wd17xx_callback(device, WD17XX_DRQ_CLR); |
| 1019 | 1010 | w->status &= ~STA_2_DRQ; |
| 1011 | devcb_call_write_line(&w->out_drq_func, CLEAR_LINE); |
| 1020 | 1012 | } |
| 1021 | 1013 | |
| 1022 | 1014 | |
| r5984 | r5985 | |
| 1034 | 1026 | |
| 1035 | 1027 | /* set drq */ |
| 1036 | 1028 | // w->status_drq = STA_2_DRQ; |
| 1037 | | wd17xx_callback(device, WD17XX_DRQ_SET); |
| 1038 | 1029 | w->status |= STA_2_DRQ; |
| 1030 | devcb_call_write_line(&w->out_drq_func, ASSERT_LINE); |
| 1039 | 1031 | } |
| 1040 | 1032 | |
| 1041 | 1033 | |
| r5984 | r5985 | |
| 1166 | 1158 | wd17xx_t *w = get_safe_token(device); |
| 1167 | 1159 | int result = w->status; |
| 1168 | 1160 | |
| 1169 | | wd17xx_callback(device, WD17XX_IRQ_CLR); |
| 1161 | devcb_call_write_line(&w->out_intrq_func, CLEAR_LINE); |
| 1170 | 1162 | |
| 1171 | 1163 | /* type 1 command or force int command? */ |
| 1172 | 1164 | if ((w->command_type==TYPE_I) || (w->command_type==TYPE_IV)) |
| r5984 | r5985 | |
| 1332 | 1324 | floppy_drive_set_motor_state(wd17xx_current_image(device), 1); |
| 1333 | 1325 | floppy_drive_set_ready_state(wd17xx_current_image(device), 1,0); |
| 1334 | 1326 | /* also cleared by writing command */ |
| 1335 | | wd17xx_callback(device, WD17XX_IRQ_CLR); |
| 1327 | devcb_call_write_line(&w->out_intrq_func, CLEAR_LINE); |
| 1336 | 1328 | |
| 1337 | 1329 | /* clear write protected. On read sector, read track and read dam, write protected bit is clear */ |
| 1338 | 1330 | w->status &= ~((1<<6) | (1<<5) | (1<<4)); |
| r5984 | r5985 | |
| 1743 | 1735 | } |
| 1744 | 1736 | } |
| 1745 | 1737 | |
| 1746 | | const wd17xx_interface default_wd17xx_interface = { NULL, NULL, { FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3} }; |
| 1747 | | const wd17xx_interface default_wd17xx_interface_2_drives = { NULL, NULL, { FLOPPY_0, FLOPPY_1, NULL, NULL} }; |
| 1738 | const wd17xx_interface default_wd17xx_interface = { DEVCB_NULL, DEVCB_NULL, NULL, { FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3} }; |
| 1739 | const wd17xx_interface default_wd17xx_interface_2_drives = { DEVCB_NULL, DEVCB_NULL, NULL, { FLOPPY_0, FLOPPY_1, NULL, NULL} }; |
| 1748 | 1740 | |
| 1749 | 1741 | /* device interface */ |
| 1750 | 1742 | static void common_start(const device_config *device, wd17xx_type_t device_type) |
| r5984 | r5985 | |
| 1765 | 1757 | w->timer_rs = timer_alloc(device->machine, wd17xx_read_sector_callback, (void*)device); |
| 1766 | 1758 | w->timer_ws = timer_alloc(device->machine, wd17xx_write_sector_callback, (void*)device); |
| 1767 | 1759 | w->pause_time = 40; |
| 1760 | |
| 1761 | /* resolve callbacks */ |
| 1762 | devcb_resolve_write_line(&w->out_intrq_func, &w->intf->out_intrq_func, device); |
| 1763 | devcb_resolve_write_line(&w->out_drq_func, &w->intf->out_drq_func, device); |
| 1768 | 1764 | } |
| 1769 | 1765 | |
| 1770 | 1766 | static DEVICE_RESET( wd17xx ) |
src/mess/machine/wd17xx.h
| r5984 | r5985 | |
| 7 | 7 | |
| 8 | 8 | *********************************************************************/ |
| 9 | 9 | |
| 10 | | #ifndef WD179X_H |
| 11 | | #define WD179X_H |
| 10 | #ifndef __WD17XX_H__ |
| 11 | #define __WD17XX_H__ |
| 12 | 12 | |
| 13 | | #include "devices/flopdrv.h" |
| 13 | #include "devcb.h" |
| 14 | 14 | |
| 15 | |
| 15 | 16 | /*************************************************************************** |
| 16 | 17 | MACROS |
| 17 | 18 | ***************************************************************************/ |
| r5984 | r5985 | |
| 26 | 27 | #define WD177X DEVICE_GET_INFO_NAME(wd177x) |
| 27 | 28 | #define MB8877 DEVICE_GET_INFO_NAME(mb8877) |
| 28 | 29 | |
| 30 | |
| 29 | 31 | /*************************************************************************** |
| 30 | 32 | TYPE DEFINITIONS |
| 31 | 33 | ***************************************************************************/ |
| 32 | 34 | |
| 33 | 35 | typedef enum |
| 34 | 36 | { |
| 35 | | WD17XX_IRQ_CLR, |
| 36 | | WD17XX_IRQ_SET, |
| 37 | | WD17XX_DRQ_CLR, |
| 38 | | WD17XX_DRQ_SET |
| 39 | | } wd17xx_state_t; |
| 40 | | |
| 41 | | typedef enum |
| 42 | | { |
| 43 | 37 | DEN_FM_LO = 0, |
| 44 | 38 | DEN_FM_HI, |
| 45 | 39 | DEN_MFM_LO, |
| 46 | 40 | DEN_MFM_HI |
| 47 | 41 | } DENSITY; |
| 48 | 42 | |
| 49 | | typedef void (*wd17xx_callback_func)(const device_config *device, wd17xx_state_t state, void *param); |
| 50 | | #define WD17XX_CALLBACK(name) void name(const device_config *device, wd17xx_state_t state, void *param ) |
| 51 | | |
| 52 | 43 | typedef void* (*wd17xx_param_callback_func)(const device_config *device); |
| 53 | 44 | #define WD17XX_PARAM_CALLBACK(name) void* name(const device_config *device) |
| 54 | 45 | |
| r5984 | r5985 | |
| 56 | 47 | typedef struct _wd17xx_interface wd17xx_interface; |
| 57 | 48 | struct _wd17xx_interface |
| 58 | 49 | { |
| 59 | | wd17xx_callback_func callback; |
| 50 | devcb_write_line out_intrq_func; |
| 51 | devcb_write_line out_drq_func; |
| 60 | 52 | wd17xx_param_callback_func callback_param; |
| 61 | 53 | const char *floppy_drive_tags[4]; |
| 62 | 54 | }; |
| r5984 | r5985 | |
| 101 | 93 | |
| 102 | 94 | extern const wd17xx_interface default_wd17xx_interface; |
| 103 | 95 | extern const wd17xx_interface default_wd17xx_interface_2_drives; |
| 96 | |
| 97 | |
| 104 | 98 | /*************************************************************************** |
| 105 | 99 | DEVICE CONFIGURATION MACROS |
| 106 | 100 | ***************************************************************************/ |
| r5984 | r5985 | |
| 142 | 136 | MDRV_DEVICE_CONFIG(_intrf) |
| 143 | 137 | |
| 144 | 138 | |
| 145 | | #endif /* WD179X_H */ |
| 146 | | |
| 147 | | |
| 148 | | |
| 139 | #endif /* __WD17XX_H__ */ |
src/mess/machine/comx35.c
| r5984 | r5985 | |
| 123 | 123 | #include "video/mc6845.h" |
| 124 | 124 | #include "includes/comx35.h" |
| 125 | 125 | #include "machine/rescap.h" |
| 126 | #include "devices/flopdrv.h" |
| 126 | 127 | |
| 128 | |
| 127 | 129 | enum |
| 128 | 130 | { |
| 129 | 131 | PRINTER_PARALLEL = 0, |
| r5984 | r5985 | |
| 183 | 185 | } |
| 184 | 186 | |
| 185 | 187 | /* Floppy Disc Controller */ |
| 186 | | static WD17XX_CALLBACK( comx35_fdc_callback ) |
| 188 | static WRITE_LINE_DEVICE_HANDLER( comx35_fdc_intrq_w ) |
| 187 | 189 | { |
| 188 | 190 | comx35_state *driver_state = device->machine->driver_data; |
| 191 | driver_state->fdc_irq = state; |
| 192 | } |
| 189 | 193 | |
| 190 | | switch (state) |
| 191 | | { |
| 192 | | case WD17XX_IRQ_SET: |
| 193 | | driver_state->fdc_irq = 1; |
| 194 | | break; |
| 194 | static WRITE_LINE_DEVICE_HANDLER( comx35_fdc_drq_w ) |
| 195 | { |
| 196 | comx35_state *driver_state = device->machine->driver_data; |
| 195 | 197 | |
| 196 | | case WD17XX_IRQ_CLR: |
| 197 | | driver_state->fdc_irq = 0; |
| 198 | | break; |
| 199 | | |
| 200 | | case WD17XX_DRQ_SET: |
| 201 | | if (driver_state->fdc_drq_enable) |
| 202 | | { |
| 203 | | driver_state->cdp1802_ef4 = 1; |
| 204 | | } |
| 205 | | break; |
| 206 | | |
| 207 | | case WD17XX_DRQ_CLR: |
| 208 | | if (driver_state->fdc_drq_enable) |
| 209 | | { |
| 210 | | driver_state->cdp1802_ef4 = 0; |
| 211 | | } |
| 212 | | break; |
| 213 | | } |
| 198 | if (driver_state->fdc_drq_enable) |
| 199 | driver_state->cdp1802_ef4 = state; |
| 214 | 200 | } |
| 215 | 201 | |
| 216 | | const wd17xx_interface comx35_wd17xx_interface = { comx35_fdc_callback, NULL, {FLOPPY_0,FLOPPY_1,FLOPPY_2,FLOPPY_3} }; |
| 202 | const wd17xx_interface comx35_wd17xx_interface = |
| 203 | { |
| 204 | DEVCB_LINE(comx35_fdc_intrq_w), |
| 205 | DEVCB_LINE(comx35_fdc_drq_w), |
| 206 | NULL, |
| 207 | {FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3} |
| 208 | }; |
| 217 | 209 | |
| 218 | 210 | static UINT8 fdc_r(const address_space *space) |
| 219 | 211 | { |
src/mess/machine/svi318.c
| r5984 | r5985 | |
| 305 | 305 | typedef struct |
| 306 | 306 | { |
| 307 | 307 | UINT8 driveselect; |
| 308 | | UINT8 irq_drq; |
| 308 | int drq; |
| 309 | int irq; |
| 309 | 310 | UINT8 heads[2]; |
| 310 | 311 | } SVI318_FDC_STRUCT; |
| 311 | 312 | |
| 312 | 313 | static SVI318_FDC_STRUCT svi318_fdc; |
| 313 | 314 | |
| 314 | | static WD17XX_CALLBACK( svi_fdc_callback ) |
| 315 | static WRITE_LINE_DEVICE_HANDLER( svi_fdc_intrq_w ) |
| 315 | 316 | { |
| 316 | | switch( state ) |
| 317 | | { |
| 318 | | case WD17XX_IRQ_CLR: |
| 319 | | svi318_fdc.irq_drq &= ~0x80; |
| 320 | | break; |
| 321 | | case WD17XX_IRQ_SET: |
| 322 | | svi318_fdc.irq_drq |= 0x80; |
| 323 | | break; |
| 324 | | case WD17XX_DRQ_CLR: |
| 325 | | svi318_fdc.irq_drq &= ~0x40; |
| 326 | | break; |
| 327 | | case WD17XX_DRQ_SET: |
| 328 | | svi318_fdc.irq_drq |= 0x40; |
| 329 | | break; |
| 330 | | } |
| 317 | svi318_fdc.irq = state; |
| 331 | 318 | } |
| 332 | 319 | |
| 333 | | const wd17xx_interface svi_wd17xx_interface = { svi_fdc_callback, NULL, {FLOPPY_0,FLOPPY_1,NULL,NULL} }; |
| 320 | static WRITE_LINE_DEVICE_HANDLER( svi_fdc_drq_w ) |
| 321 | { |
| 322 | svi318_fdc.drq = state; |
| 323 | } |
| 334 | 324 | |
| 325 | const wd17xx_interface svi_wd17xx_interface = |
| 326 | { |
| 327 | DEVCB_LINE(svi_fdc_intrq_w), |
| 328 | DEVCB_LINE(svi_fdc_drq_w), |
| 329 | NULL, |
| 330 | {FLOPPY_0, FLOPPY_1, NULL, NULL} |
| 331 | }; |
| 332 | |
| 335 | 333 | static WRITE8_HANDLER( svi318_fdc_drive_motor_w ) |
| 336 | 334 | { |
| 337 | 335 | const device_config *fdc = devtag_get_device(space->machine, "wd179x"); |
| r5984 | r5985 | |
| 360 | 358 | |
| 361 | 359 | static READ8_HANDLER( svi318_fdc_irqdrq_r ) |
| 362 | 360 | { |
| 363 | | return svi318_fdc.irq_drq; |
| 361 | UINT8 result = 0; |
| 362 | |
| 363 | result |= svi318_fdc.drq << 6; |
| 364 | result |= svi318_fdc.irq << 7; |
| 365 | |
| 366 | return result; |
| 364 | 367 | } |
| 365 | 368 | |
| 366 | 369 | MC6845_UPDATE_ROW( svi806_crtc6845_update_row ) |
src/mess/machine/concept.c
| r5984 | r5985 | |
| 12 | 12 | #include "machine/wd17xx.h" |
| 13 | 13 | #include "cpu/m68000/m68000.h" |
| 14 | 14 | #include "includes/corvushd.h" |
| 15 | #include "devices/flopdrv.h" |
| 15 | 16 | |
| 17 | |
| 16 | 18 | #define VERBOSE 1 |
| 17 | 19 | |
| 18 | 20 | #define LOG(x) do { if (VERBOSE > 0) logerror x; } while (0) |
| r5984 | r5985 | |
| 578 | 580 | install_expansion_slot(slot, concept_fdc_reg_r, concept_fdc_reg_w, concept_fdc_rom_r, NULL); |
| 579 | 581 | } |
| 580 | 582 | |
| 581 | | static WD17XX_CALLBACK( fdc_callback ) |
| 583 | static WRITE_LINE_DEVICE_HANDLER( concept_fdc_intrq_w ) |
| 582 | 584 | { |
| 583 | | switch (state) |
| 584 | | { |
| 585 | | case WD17XX_IRQ_CLR: |
| 586 | | fdc_local_status &= ~LS_INT_mask; |
| 587 | | break; |
| 588 | | case WD17XX_IRQ_SET: |
| 589 | | fdc_local_status |= LS_INT_mask; |
| 590 | | break; |
| 591 | | case WD17XX_DRQ_CLR: |
| 592 | | fdc_local_status &= ~LS_DRQ_mask; |
| 593 | | break; |
| 594 | | case WD17XX_DRQ_SET: |
| 595 | | fdc_local_status |= LS_DRQ_mask; |
| 596 | | break; |
| 597 | | } |
| 585 | if (state) |
| 586 | fdc_local_status |= LS_INT_mask; |
| 587 | else |
| 588 | fdc_local_status &= ~LS_INT_mask; |
| 598 | 589 | } |
| 599 | 590 | |
| 600 | | const wd17xx_interface concept_wd17xx_interface = { fdc_callback, NULL, {FLOPPY_0,FLOPPY_1,FLOPPY_2,FLOPPY_3}}; |
| 591 | static WRITE_LINE_DEVICE_HANDLER( concept_fdc_drq_w ) |
| 592 | { |
| 593 | if (state) |
| 594 | fdc_local_status |= LS_DRQ_mask; |
| 595 | else |
| 596 | fdc_local_status &= ~LS_DRQ_mask; |
| 597 | } |
| 601 | 598 | |
| 599 | const wd17xx_interface concept_wd17xx_interface = |
| 600 | { |
| 601 | DEVCB_LINE(concept_fdc_intrq_w), |
| 602 | DEVCB_LINE(concept_fdc_drq_w), |
| 603 | NULL, |
| 604 | {FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3} |
| 605 | }; |
| 606 | |
| 602 | 607 | static READ8_HANDLER(concept_fdc_reg_r) |
| 603 | 608 | { |
| 604 | 609 | const device_config *fdc = devtag_get_device(space->machine, "wd179x"); |
src/mess/machine/cgenie.c
| r5984 | r5985 | |
| 15 | 15 | #include "devices/cassette.h" |
| 16 | 16 | #include "sound/ay8910.h" |
| 17 | 17 | #include "sound/dac.h" |
| 18 | #include "devices/flopdrv.h" |
| 18 | 19 | |
| 19 | 20 | |
| 20 | 21 | #define AYWriteReg(chip,port,value) \ |
| r5984 | r5985 | |
| 425 | 426 | } |
| 426 | 427 | } |
| 427 | 428 | |
| 428 | | static WD17XX_CALLBACK( cgenie_fdc_callback ) |
| 429 | static WRITE_LINE_DEVICE_HANDLER( cgenie_fdc_intrq_w ) |
| 429 | 430 | { |
| 430 | 431 | /* if disc hardware is not enabled, do not cause an int */ |
| 431 | 432 | if (!( input_port_read(device->machine, "DSW0") & 0x80 )) |
| 432 | 433 | return; |
| 433 | 434 | |
| 434 | | switch( state ) |
| 435 | if (state) |
| 435 | 436 | { |
| 436 | | case WD17XX_IRQ_CLR: |
| 437 | | irq_status &= ~IRQ_FDC; |
| 438 | | break; |
| 439 | | case WD17XX_IRQ_SET: |
| 440 | | if( (irq_status & IRQ_FDC) == 0 ) |
| 441 | | { |
| 442 | | irq_status |= IRQ_FDC; |
| 443 | | cputag_set_input_line(device->machine, "maincpu", 0, HOLD_LINE); |
| 444 | | } |
| 445 | | break; |
| 446 | | case WD17XX_DRQ_CLR: |
| 447 | | case WD17XX_DRQ_SET: |
| 448 | | /* do nothing */ |
| 449 | | break; |
| 437 | if( (irq_status & IRQ_FDC) == 0 ) |
| 438 | { |
| 439 | irq_status |= IRQ_FDC; |
| 440 | cputag_set_input_line(device->machine, "maincpu", 0, HOLD_LINE); |
| 441 | } |
| 450 | 442 | } |
| 443 | else |
| 444 | { |
| 445 | irq_status &= ~IRQ_FDC; |
| 446 | } |
| 451 | 447 | } |
| 452 | 448 | |
| 453 | | const wd17xx_interface cgenie_wd17xx_interface = { cgenie_fdc_callback, NULL, {FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3} }; |
| 449 | const wd17xx_interface cgenie_wd17xx_interface = |
| 450 | { |
| 451 | DEVCB_LINE(cgenie_fdc_intrq_w), |
| 452 | DEVCB_NULL, |
| 453 | NULL, |
| 454 | {FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3} |
| 455 | }; |
| 454 | 456 | |
| 455 | 457 | WRITE8_HANDLER( cgenie_motor_w ) |
| 456 | 458 | { |
src/mess/machine/kaypro.c
| r5984 | r5985 | |
| 5 | 5 | #include "machine/kay_kbd.h" |
| 6 | 6 | #include "devices/snapquik.h" |
| 7 | 7 | #include "includes/kaypro.h" |
| 8 | #include "devices/flopdrv.h" |
| 8 | 9 | |
| 9 | 10 | |
| 10 | 11 | static const device_config *kayproii_z80pio_g; |
| r5984 | r5985 | |
| 329 | 330 | static TIMER_CALLBACK( kaypro_timer_callback ) |
| 330 | 331 | { |
| 331 | 332 | if (cpu_get_reg(cputag_get_cpu(machine, "maincpu"), Z80_HALT)) |
| 332 | | cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, 1); |
| 333 | cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, ASSERT_LINE); |
| 333 | 334 | } |
| 334 | 335 | |
| 336 | static WRITE_LINE_DEVICE_HANDLER( kaypro_fdc_intrq_w ) |
| 337 | { |
| 338 | if (state) |
| 339 | timer_set(device->machine, ATTOTIME_IN_USEC(25), NULL, 0, kaypro_timer_callback); |
| 340 | else |
| 341 | cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_NMI, CLEAR_LINE); |
| 342 | } |
| 335 | 343 | |
| 336 | | static WD17XX_CALLBACK( kaypro_fdc_callback ) |
| 344 | static WRITE_LINE_DEVICE_HANDLER( kaypro_fdc_drq_w ) |
| 337 | 345 | { |
| 338 | | if ((state == WD17XX_DRQ_SET) || (state == WD17XX_IRQ_SET)) |
| 339 | | { |
| 346 | if (state) |
| 340 | 347 | timer_set(device->machine, ATTOTIME_IN_USEC(25), NULL, 0, kaypro_timer_callback); |
| 341 | | } |
| 342 | 348 | else |
| 343 | | { |
| 344 | | cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_NMI, 0); |
| 345 | | } |
| 349 | cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_NMI, CLEAR_LINE); |
| 350 | |
| 346 | 351 | } |
| 347 | 352 | |
| 348 | | const wd17xx_interface kaypro_wd1793_interface = { kaypro_fdc_callback, NULL, {FLOPPY_0,FLOPPY_1,NULL,NULL} }; |
| 353 | const wd17xx_interface kaypro_wd1793_interface = |
| 354 | { |
| 355 | DEVCB_LINE(kaypro_fdc_intrq_w), |
| 356 | DEVCB_LINE(kaypro_fdc_drq_w), |
| 357 | NULL, |
| 358 | {FLOPPY_0, FLOPPY_1, NULL, NULL} |
| 359 | }; |
| 349 | 360 | |
| 361 | |
| 350 | 362 | /*********************************************************** |
| 351 | 363 | |
| 352 | 364 | Machine |
src/mess/machine/beta.c
| r5984 | r5985 | |
| 67 | 67 | beta->betadisk_status = 0; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | | static WD17XX_CALLBACK( betadisk_wd179x_callback ) |
| 70 | static WRITE_LINE_DEVICE_HANDLER( betadisk_wd179x_intrq_w ) |
| 71 | 71 | { |
| 72 | | const device_config *wd_device = devtag_get_device(device->machine, BETA_DISK_TAG); |
| 73 | | beta_disk_state *beta = get_safe_token(wd_device); |
| 74 | | if (wd_device->started) { |
| 75 | | switch (state) |
| 76 | | { |
| 77 | | case WD17XX_DRQ_SET: |
| 78 | | { |
| 79 | | beta->betadisk_status |= (1<<6); |
| 80 | | } |
| 81 | | break; |
| 72 | beta_disk_state *beta = get_safe_token(device->owner); |
| 82 | 73 | |
| 83 | | case WD17XX_DRQ_CLR: |
| 84 | | { |
| 85 | | beta->betadisk_status &=~(1<<6); |
| 86 | | } |
| 87 | | break; |
| 74 | if (state) |
| 75 | beta->betadisk_status |= (1<<7); |
| 76 | else |
| 77 | beta->betadisk_status &=~(1<<7); |
| 78 | } |
| 88 | 79 | |
| 89 | | case WD17XX_IRQ_SET: |
| 90 | | { |
| 91 | | beta->betadisk_status |= (1<<7); |
| 92 | | } |
| 93 | | break; |
| 80 | static WRITE_LINE_DEVICE_HANDLER( betadisk_wd179x_drq_w ) |
| 81 | { |
| 82 | beta_disk_state *beta = get_safe_token(device->owner); |
| 94 | 83 | |
| 95 | | case WD17XX_IRQ_CLR: |
| 96 | | { |
| 97 | | beta->betadisk_status &=~(1<<7); |
| 98 | | } |
| 99 | | break; |
| 100 | | } |
| 101 | | } |
| 84 | if (state) |
| 85 | beta->betadisk_status |= (1<<6); |
| 86 | else |
| 87 | beta->betadisk_status &=~(1<<6); |
| 102 | 88 | } |
| 103 | 89 | |
| 104 | | static const wd17xx_interface beta_wd17xx_interface = { betadisk_wd179x_callback, NULL, {FLOPPY_0,FLOPPY_1,FLOPPY_2,FLOPPY_3} }; |
| 90 | static const wd17xx_interface beta_wd17xx_interface = |
| 91 | { |
| 92 | DEVCB_LINE(betadisk_wd179x_intrq_w), |
| 93 | DEVCB_LINE(betadisk_wd179x_drq_w), |
| 94 | NULL, |
| 95 | {FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3} |
| 96 | }; |
| 105 | 97 | |
| 106 | 98 | READ8_DEVICE_HANDLER(betadisk_status_r) |
| 107 | 99 | { |
src/mess/machine/bbc.c
| r5984 | r5985 | |
| 15 | 15 | #include "sound/tms5220.h" |
| 16 | 16 | #include "machine/6522via.h" |
| 17 | 17 | #include "machine/wd17xx.h" |
| 18 | #include "devices/flopdrv.h" |
| 18 | 19 | #include "includes/bbc.h" |
| 19 | 20 | #include "machine/upd7002.h" |
| 20 | 21 | #include "machine/i8271.h" |
| r5984 | r5985 | |
| 1550 | 1551 | ***************************************/ |
| 1551 | 1552 | |
| 1552 | 1553 | static int drive_control; |
| 1553 | | /* bit 0: 1 = drq set, bit 1: 1 = irq set */ |
| 1554 | | static int bbc_wd177x_drq_irq_state; |
| 1554 | static int bbc_wd177x_irq_state; |
| 1555 | static int bbc_wd177x_drq_state; |
| 1555 | 1556 | |
| 1557 | |
| 1556 | 1558 | static int previous_wd177x_int_state; |
| 1557 | 1559 | |
| 1558 | 1560 | /* |
| r5984 | r5985 | |
| 1580 | 1582 | |
| 1581 | 1583 | static int bbc_1770_IntEnabled; |
| 1582 | 1584 | |
| 1583 | | static WD17XX_CALLBACK( bbc_wd177x_callback) |
| 1585 | /* wd177x_IRQ_SET and latch bit 4 (nmi_enable) are NAND'ED together |
| 1586 | wd177x_DRQ_SET and latch bit 4 (nmi_enable) are NAND'ED together |
| 1587 | the output of the above two NAND gates are then OR'ED together and sent to the 6502 NMI line. |
| 1588 | DRQ and IRQ are active low outputs from wd177x. We use wd177x_DRQ_SET for DRQ = 0, |
| 1589 | and wd177x_DRQ_CLR for DRQ = 1. Similarly wd177x_IRQ_SET for IRQ = 0 and wd177x_IRQ_CLR |
| 1590 | for IRQ = 1. |
| 1591 | |
| 1592 | The above means that if IRQ or DRQ are set, a interrupt should be generated. |
| 1593 | The nmi_enable decides if interrupts are actually triggered. |
| 1594 | The nmi is edge triggered, and triggers on a +ve edge. |
| 1595 | */ |
| 1596 | |
| 1597 | static void bbc_update_fdq_int(running_machine *machine, int state) |
| 1584 | 1598 | { |
| 1585 | 1599 | int bbc_state; |
| 1586 | | /* wd177x_IRQ_SET and latch bit 4 (nmi_enable) are NAND'ED together |
| 1587 | | wd177x_DRQ_SET and latch bit 4 (nmi_enable) are NAND'ED together |
| 1588 | | the output of the above two NAND gates are then OR'ED together and sent to the 6502 NMI line. |
| 1589 | | DRQ and IRQ are active low outputs from wd177x. We use wd177x_DRQ_SET for DRQ = 0, |
| 1590 | | and wd177x_DRQ_CLR for DRQ = 1. Similarly wd177x_IRQ_SET for IRQ = 0 and wd177x_IRQ_CLR |
| 1591 | | for IRQ = 1. |
| 1592 | 1600 | |
| 1593 | | The above means that if IRQ or DRQ are set, a interrupt should be generated. |
| 1594 | | The nmi_enable decides if interrupts are actually triggered. |
| 1595 | | The nmi is edge triggered, and triggers on a +ve edge. |
| 1596 | | */ |
| 1597 | | |
| 1598 | | logerror("callback $%02X\n", state); |
| 1599 | | |
| 1600 | | |
| 1601 | | /* update bbc_wd177x_drq_irq_state depending on event */ |
| 1602 | | switch (state) |
| 1603 | | { |
| 1604 | | case WD17XX_DRQ_SET: |
| 1605 | | { |
| 1606 | | bbc_wd177x_drq_irq_state |= 1; |
| 1607 | | } |
| 1608 | | break; |
| 1609 | | |
| 1610 | | case WD17XX_DRQ_CLR: |
| 1611 | | { |
| 1612 | | bbc_wd177x_drq_irq_state &= ~1; |
| 1613 | | } |
| 1614 | | break; |
| 1615 | | |
| 1616 | | case WD17XX_IRQ_SET: |
| 1617 | | { |
| 1618 | | bbc_wd177x_drq_irq_state |= (1<<1); |
| 1619 | | } |
| 1620 | | break; |
| 1621 | | |
| 1622 | | case WD17XX_IRQ_CLR: |
| 1623 | | { |
| 1624 | | bbc_wd177x_drq_irq_state &= ~(1<<1); |
| 1625 | | } |
| 1626 | | break; |
| 1627 | | } |
| 1628 | | |
| 1629 | 1601 | /* if drq or irq is set, and interrupt is enabled */ |
| 1630 | | if (((bbc_wd177x_drq_irq_state & 3)!=0) && (bbc_1770_IntEnabled)) |
| 1602 | if ((bbc_wd177x_irq_state || bbc_wd177x_drq_state) && (bbc_1770_IntEnabled)) |
| 1631 | 1603 | { |
| 1632 | 1604 | /* int trigger */ |
| 1633 | 1605 | bbc_state = 1; |
| r5984 | r5985 | |
| 1646 | 1618 | { |
| 1647 | 1619 | /* I'll pulse it because if I used hold-line I'm not sure |
| 1648 | 1620 | it would clear - to be checked */ |
| 1649 | | cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_NMI,PULSE_LINE); |
| 1621 | cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI,PULSE_LINE); |
| 1650 | 1622 | } |
| 1651 | 1623 | } |
| 1652 | 1624 | |
| 1653 | 1625 | previous_wd177x_int_state = bbc_state; |
| 1626 | } |
| 1654 | 1627 | |
| 1628 | static WRITE_LINE_DEVICE_HANDLER( bbc_wd177x_intrq_w ) |
| 1629 | { |
| 1630 | bbc_wd177x_irq_state = state; |
| 1631 | bbc_update_fdq_int(device->machine, state); |
| 1655 | 1632 | } |
| 1656 | 1633 | |
| 1657 | | const wd17xx_interface bbc_wd17xx_interface = { |
| 1658 | | bbc_wd177x_callback, |
| 1634 | static WRITE_LINE_DEVICE_HANDLER( bbc_wd177x_drq_w ) |
| 1635 | { |
| 1636 | bbc_wd177x_drq_state = state; |
| 1637 | bbc_update_fdq_int(device->machine, state); |
| 1638 | } |
| 1639 | |
| 1640 | const wd17xx_interface bbc_wd17xx_interface = |
| 1641 | { |
| 1642 | DEVCB_LINE(bbc_wd177x_intrq_w), |
| 1643 | DEVCB_LINE(bbc_wd177x_drq_w), |
| 1659 | 1644 | NULL, |
| 1660 | | {FLOPPY_0,FLOPPY_1,NULL,NULL} |
| 1645 | {FLOPPY_0, FLOPPY_1, NULL, NULL} |
| 1661 | 1646 | }; |
| 1662 | 1647 | |
| 1663 | 1648 | static WRITE8_HANDLER(bbc_wd177x_status_w) |
src/mess/devices/coco_fdc.c
| r5984 | r5985 | |
| 68 | 68 | |
| 69 | 69 | #include "driver.h" |
| 70 | 70 | #include "cococart.h" |
| 71 | #include "flopdrv.h" |
| 71 | 72 | #include "includes/coco.h" |
| 72 | 73 | #include "machine/wd17xx.h" |
| 73 | 74 | #include "machine/ds1315.h" |
| r5984 | r5985 | |
| 135 | 136 | PROTOTYPES |
| 136 | 137 | ***************************************************************************/ |
| 137 | 138 | |
| 138 | | static WD17XX_CALLBACK( fdc_callback ); |
| 139 | static WRITE_LINE_DEVICE_HANDLER( fdc_intrq_w ); |
| 140 | static WRITE_LINE_DEVICE_HANDLER( fdc_drq_w ); |
| 139 | 141 | |
| 140 | 142 | |
| 141 | 143 | /*************************************************************************** |
| r5984 | r5985 | |
| 144 | 146 | |
| 145 | 147 | static const wd17xx_interface coco_wd17xx_interface = |
| 146 | 148 | { |
| 147 | | fdc_callback, |
| 149 | DEVCB_LINE(fdc_intrq_w), |
| 150 | DEVCB_LINE(fdc_drq_w), |
| 148 | 151 | NULL, |
| 149 | 152 | {FLOPPY_0,FLOPPY_1,FLOPPY_2,FLOPPY_3} |
| 150 | 153 | }; |
| r5984 | r5985 | |
| 193 | 196 | |
| 194 | 197 | |
| 195 | 198 | /*------------------------------------------------- |
| 196 | | fdc_callback - callback from the FDC |
| 199 | fdc_intrq_w - callback from the FDC |
| 197 | 200 | -------------------------------------------------*/ |
| 198 | 201 | |
| 199 | | static WD17XX_CALLBACK( fdc_callback ) |
| 202 | static WRITE_LINE_DEVICE_HANDLER( fdc_intrq_w ) |
| 200 | 203 | { |
| 201 | | const device_config *fdc_device = device->owner; |
| 202 | | fdc_t *fdc = get_token(fdc_device); |
| 204 | fdc_t *fdc = get_token(device->owner); |
| 205 | fdc->intrq = state; |
| 206 | (*fdc->hwtype->update_lines)(device->owner); |
| 207 | } |
| 203 | 208 | |
| 204 | | switch(state) |
| 205 | | { |
| 206 | | case WD17XX_IRQ_CLR: |
| 207 | | fdc->intrq = 0; |
| 208 | | break; |
| 209 | 209 | |
| 210 | | case WD17XX_IRQ_SET: |
| 211 | | fdc->intrq = 1; |
| 212 | | break; |
| 210 | /*------------------------------------------------- |
| 211 | fdc_drq_w - callback from the FDC |
| 212 | -------------------------------------------------*/ |
| 213 | 213 | |
| 214 | | case WD17XX_DRQ_CLR: |
| 215 | | fdc->drq = 0; |
| 216 | | break; |
| 217 | | |
| 218 | | case WD17XX_DRQ_SET: |
| 219 | | fdc->drq = 1; |
| 220 | | break; |
| 221 | | } |
| 222 | | |
| 223 | | (*fdc->hwtype->update_lines)(fdc_device); |
| 214 | static WRITE_LINE_DEVICE_HANDLER( fdc_drq_w ) |
| 215 | { |
| 216 | fdc_t *fdc = get_token(device->owner); |
| 217 | fdc->drq = state; |
| 218 | (*fdc->hwtype->update_lines)(device->owner); |
| 224 | 219 | } |
| 225 | 220 | |
| 226 | 221 | |
src/mess/drivers/v1050.c
| r5984 | r5985 | |
| 1048 | 1048 | |
| 1049 | 1049 | /* MB8877 Interface */ |
| 1050 | 1050 | |
| 1051 | | static WD17XX_CALLBACK( v1050_mb8877_callback ) |
| 1051 | static WRITE_LINE_DEVICE_HANDLER( v1050_mb8877_intrq_w ) |
| 1052 | 1052 | { |
| 1053 | 1053 | v1050_state *driver_state = device->machine->driver_data; |
| 1054 | 1054 | |
| 1055 | 1055 | if (driver_state->f_int_enb) |
| 1056 | v1050_set_int(device->machine, INT_FLOPPY, state); |
| 1056 | 1057 | { |
| 1057 | | switch (state) |
| 1058 | | { |
| 1059 | | case WD17XX_IRQ_CLR: |
| 1060 | | v1050_set_int(device->machine, INT_FLOPPY, 0); |
| 1061 | | break; |
| 1058 | v1050_set_int(device->machine, INT_FLOPPY, 0); |
| 1059 | cputag_set_input_line(device->machine, Z80_TAG, INPUT_LINE_NMI, CLEAR_LINE); |
| 1060 | } |
| 1061 | } |
| 1062 | 1062 | |
| 1063 | | case WD17XX_IRQ_SET: |
| 1064 | | v1050_set_int(device->machine, INT_FLOPPY, 1); |
| 1065 | | break; |
| 1063 | static WRITE_LINE_DEVICE_HANDLER( v1050_mb8877_drq_w ) |
| 1064 | { |
| 1065 | v1050_state *driver_state = device->machine->driver_data; |
| 1066 | 1066 | |
| 1067 | | case WD17XX_DRQ_CLR: |
| 1068 | | cputag_set_input_line(device->machine, Z80_TAG, INPUT_LINE_NMI, CLEAR_LINE); |
| 1069 | | break; |
| 1070 | | |
| 1071 | | case WD17XX_DRQ_SET: |
| 1072 | | cputag_set_input_line(device->machine, Z80_TAG, INPUT_LINE_NMI, ASSERT_LINE); |
| 1073 | | break; |
| 1074 | | } |
| 1075 | | } |
| 1067 | if (driver_state->f_int_enb) |
| 1068 | cputag_set_input_line(device->machine, Z80_TAG, INPUT_LINE_NMI, state); |
| 1076 | 1069 | else |
| 1077 | 1070 | { |
| 1078 | 1071 | v1050_set_int(device->machine, INT_FLOPPY, 0); |
| r5984 | r5985 | |
| 1082 | 1075 | |
| 1083 | 1076 | static const wd17xx_interface v1050_wd17xx_intf = |
| 1084 | 1077 | { |
| 1085 | | v1050_mb8877_callback, |
| 1078 | DEVCB_LINE(v1050_mb8877_intrq_w), |
| 1079 | DEVCB_LINE(v1050_mb8877_drq_w), |
| 1086 | 1080 | NULL, |
| 1087 | 1081 | {FLOPPY_0,FLOPPY_1,NULL,NULL} |
| 1088 | 1082 | }; |
src/mess/drivers/fmtowns.c
| r5984 | r5985 | |
| 118 | 118 | int x,y; |
| 119 | 119 | char code[7] = "USTIJUF"; |
| 120 | 120 | memset(towns_serial_rom,0,256/8); |
| 121 | | |
| 121 | |
| 122 | 122 | for(x=72;x<=194;x++) // set these bits to 1 |
| 123 | 123 | towns_serial_rom[x/8] |= (1 << (x%8)); |
| 124 | | |
| 124 | |
| 125 | 125 | y=0; |
| 126 | 126 | for(x=195;x<=251;x++) |
| 127 | 127 | { |
| 128 | 128 | if(code[y/8] & (1 << (y % 8))) |
| 129 | 129 | towns_serial_rom[x/8] |= (1 << (x%8)); |
| 130 | 130 | } |
| 131 | | |
| 131 | |
| 132 | 132 | // add Machine ID |
| 133 | 133 | towns_serial_rom[7] = 0x01; |
| 134 | 134 | towns_serial_rom[8] = 0x01; |
| 135 | | |
| 135 | |
| 136 | 136 | // serial number? |
| 137 | 137 | towns_serial_rom[2] = 0x10; |
| 138 | 138 | towns_serial_rom[3] = 0x6e; |
| r5984 | r5985 | |
| 144 | 144 | static READ8_HANDLER(towns_system_r) |
| 145 | 145 | { |
| 146 | 146 | UINT8 ret = 0; |
| 147 | | |
| 147 | |
| 148 | 148 | switch(offset) |
| 149 | 149 | { |
| 150 | 150 | case 0x00: |
| r5984 | r5985 | |
| 170 | 170 | /* Bit 0 = data, bit 6 = CLK, bit 7 = RESET, bit 5 is always 1? */ |
| 171 | 171 | ret = (towns_serial_rom[towns_srom_position/8] & (1 << (towns_srom_position%8))) ? 1 : 0; |
| 172 | 172 | ret |= towns_srom_clk; |
| 173 | | ret |= towns_srom_reset; |
| 173 | ret |= towns_srom_reset; |
| 174 | 174 | //logerror("SYS: (0x32) Serial ROM read [0x%02x, pos=%i]\n",ret,towns_srom_position); |
| 175 | 175 | return ret; |
| 176 | 176 | default: |
| r5984 | r5985 | |
| 203 | 203 | if((data & 0x80) && towns_srom_reset == 0) // reset |
| 204 | 204 | { // reset to beginning |
| 205 | 205 | towns_srom_position = 0; |
| 206 | | } |
| 206 | } |
| 207 | 207 | towns_srom_clk = data & 0x40; |
| 208 | 208 | towns_srom_reset = data & 0x80; |
| 209 | 209 | break; |
| r5984 | r5985 | |
| 259 | 259 | /* |
| 260 | 260 | * Floppy Disc Controller (MB8877A) |
| 261 | 261 | */ |
| 262 | | |
| 263 | | static WD17XX_CALLBACK(towns_fdc_irq) |
| 262 | |
| 263 | static WRITE_LINE_DEVICE_HANDLER( towns_mb8877a_drq_w ) |
| 264 | 264 | { |
| 265 | | const device_config* dev = devtag_get_device(device->machine,"dma_1"); |
| 266 | | |
| 267 | | switch(state) |
| 268 | | { |
| 269 | | case WD17XX_IRQ_CLR: |
| 270 | | break; |
| 271 | | case WD17XX_IRQ_SET: |
| 272 | | break; |
| 273 | | case WD17XX_DRQ_CLR: |
| 274 | | upd71071_dmarq(dev,0,0); |
| 275 | | break; |
| 276 | | case WD17XX_DRQ_SET: |
| 277 | | upd71071_dmarq(dev,1,0); |
| 278 | | break; |
| 279 | | } |
| 265 | upd71071_dmarq(device, state, 0); |
| 280 | 266 | } |
| 281 | | |
| 267 | |
| 282 | 268 | static READ8_HANDLER(towns_floppy_r) |
| 283 | 269 | { |
| 284 | 270 | const device_config* fdc = devtag_get_device(space->machine,"fdc"); |
| r5984 | r5985 | |
| 344 | 330 | // bit 2 - HDISEL |
| 345 | 331 | // bit 1 - DDEN |
| 346 | 332 | // bit 0 - IRQMSK |
| 347 | | logerror("FDC: write %02x to offset 0x08\n",data); |
| 333 | logerror("FDC: write %02x to offset 0x08\n",data); |
| 348 | 334 | break; |
| 349 | 335 | case 0x0c: // drive select |
| 350 | 336 | switch(data & 0x0f) |
| r5984 | r5985 | |
| 381 | 367 | void towns_fdc_dma_w(running_machine* machine, UINT16 data) |
| 382 | 368 | { |
| 383 | 369 | const device_config* fdc = devtag_get_device(machine,"fdc"); |
| 384 | | wd17xx_data_w(fdc,0,data); |
| 370 | wd17xx_data_w(fdc,0,data); |
| 385 | 371 | } |
| 386 | 372 | |
| 387 | 373 | static READ8_HANDLER(towns_video_440_r) |
| r5984 | r5985 | |
| 407 | 393 | } |
| 408 | 394 | |
| 409 | 395 | /* Video/CRTC |
| 410 | | * |
| 396 | * |
| 411 | 397 | * 0xfd90 - palette colour select |
| 412 | 398 | * 0xfd92/4/6 - BRG value |
| 413 | 399 | * 0xfd98-9f - degipal(?) |
| r5984 | r5985 | |
| 567 | 553 | |
| 568 | 554 | if(towns_mainmem_enable != 0) |
| 569 | 555 | return mess_ram[offset + 0xd8000]; |
| 570 | | |
| 556 | |
| 571 | 557 | return cmos[offset]; |
| 572 | 558 | } |
| 573 | 559 | |
| r5984 | r5985 | |
| 613 | 599 | UINT8* ROM = memory_region(space->machine,"user"); |
| 614 | 600 | if(towns_mainmem_enable != 0) |
| 615 | 601 | return mess_ram[offset+0xcff80]; |
| 616 | | |
| 602 | |
| 617 | 603 | switch(offset) |
| 618 | 604 | { |
| 619 | 605 | case 0x01: // read/write plane select (bit 0-3 write, bit 6-7 read) |
| r5984 | r5985 | |
| 630 | 616 | default: |
| 631 | 617 | logerror("VGA: read from invalid or unimplemented memory-mapped port %05x\n",0xcff80+offset*4); |
| 632 | 618 | } |
| 633 | | |
| 619 | |
| 634 | 620 | return 0; |
| 635 | 621 | } |
| 636 | 622 | |
| r5984 | r5985 | |
| 692 | 678 | static void towns_update_video_banks(const address_space* space) |
| 693 | 679 | { |
| 694 | 680 | UINT8* ROM; |
| 695 | | |
| 681 | |
| 696 | 682 | if(towns_mainmem_enable != 0) // first MB is RAM |
| 697 | 683 | { |
| 698 | 684 | memory_set_bankptr(space->machine,1,mess_ram+0xc0000); |
| r5984 | r5985 | |
| 761 | 747 | { |
| 762 | 748 | if(towns_mainmem_enable != 0) |
| 763 | 749 | return 0x00000080; |
| 764 | | |
| 750 | |
| 765 | 751 | return 0; |
| 766 | 752 | } |
| 767 | 753 | |
| r5984 | r5985 | |
| 813 | 799 | // may not be (and probably is not) correct |
| 814 | 800 | AM_RANGE(0x00000000, 0x000bffff) AM_RAM |
| 815 | 801 | AM_RANGE(0x000c0000, 0x000c7fff) AM_READ(SMH_BANK(1)) |
| 816 | | AM_RANGE(0x000c0000, 0x000c7fff) AM_WRITE8(towns_gfx_w,0xffffffff) |
| 802 | AM_RANGE(0x000c0000, 0x000c7fff) AM_WRITE8(towns_gfx_w,0xffffffff) |
| 817 | 803 | AM_RANGE(0x000c8000, 0x000c8fff) AM_READWRITE(SMH_BANK(2),SMH_BANK(2)) |
| 818 | 804 | AM_RANGE(0x000c9000, 0x000c9fff) AM_READWRITE(SMH_BANK(3),SMH_BANK(3)) |
| 819 | 805 | AM_RANGE(0x000ca000, 0x000ca7ff) AM_READWRITE(SMH_BANK(4),SMH_BANK(5)) |
| 820 | 806 | AM_RANGE(0x000ca800, 0x000cafff) AM_READWRITE(SMH_BANK(10),SMH_BANK(10)) |
| 821 | | AM_RANGE(0x000cb000, 0x000cbfff) AM_READWRITE(SMH_BANK(6),SMH_BANK(7)) |
| 807 | AM_RANGE(0x000cb000, 0x000cbfff) AM_READWRITE(SMH_BANK(6),SMH_BANK(7)) |
| 822 | 808 | AM_RANGE(0x000cc000, 0x000cff7f) AM_READWRITE(SMH_BANK(8),SMH_BANK(8)) |
| 823 | | AM_RANGE(0x000cff80, 0x000cffff) AM_READWRITE8(towns_video_cff80_r,towns_video_cff80_w,0xffffffff) |
| 809 | AM_RANGE(0x000cff80, 0x000cffff) AM_READWRITE8(towns_video_cff80_r,towns_video_cff80_w,0xffffffff) |
| 824 | 810 | AM_RANGE(0x000d0000, 0x000d7fff) AM_RAM |
| 825 | 811 | AM_RANGE(0x000d8000, 0x000d9fff) AM_READWRITE8(towns_cmos_low_r,towns_cmos_low_w,0xffffffff) // CMOS? RAM |
| 826 | 812 | AM_RANGE(0x000da000, 0x000effff) AM_RAM //READWRITE(SMH_BANK(11),SMH_BANK(11)) |
| r5984 | r5985 | |
| 878 | 864 | // Keyboard (8042 MCU) |
| 879 | 865 | AM_RANGE(0x0600,0x0607) AM_READWRITE8(towns_keyboard_r, towns_keyboard_w,0x00ff00ff) |
| 880 | 866 | // No idea what this is currently... |
| 881 | | AM_RANGE(0x0c30,0x0c33) AM_READ8(towns_unknown_r,0x00ff0000) |
| 867 | AM_RANGE(0x0c30,0x0c33) AM_READ8(towns_unknown_r,0x00ff0000) |
| 882 | 868 | // CMOS |
| 883 | 869 | AM_RANGE(0x3000,0x3fff) AM_READWRITE8(towns_cmos8_r, towns_cmos8_w,0x00ff00ff) |
| 884 | 870 | // CRTC / Video (again) |
| r5984 | r5985 | |
| 933 | 919 | dat2 = towns_gfxvram[(x/8) + (y*0x50) + 0x8000]; |
| 934 | 920 | dat3 = towns_gfxvram[(x/8) + (y*0x50) + 0x10000]; |
| 935 | 921 | dat4 = towns_gfxvram[(x/8) + (y*0x50) + 0x18000]; |
| 936 | | colour = (dat1 & (1 << bit) ? 1 : 0) |
| 922 | colour = (dat1 & (1 << bit) ? 1 : 0) |
| 937 | 923 | | (dat2 & (1 << bit) ? 2 : 0) |
| 938 | 924 | | (dat3 & (1 << bit) ? 4 : 0) |
| 939 | 925 | | (dat4 & (1 << bit) ? 8 : 0); |
| 940 | | *BITMAP_ADDR32(bitmap,y,x) = |
| 926 | *BITMAP_ADDR32(bitmap,y,x) = |
| 941 | 927 | (towns_palette_r[colour] << 16) |
| 942 | 928 | | (towns_palette_g[colour] << 8) |
| 943 | | | (towns_palette_b[colour]); |
| 929 | | (towns_palette_b[colour]); |
| 944 | 930 | } |
| 945 | 931 | } |
| 946 | 932 | |
| r5984 | r5985 | |
| 978 | 964 | |
| 979 | 965 | static const wd17xx_interface towns_mb8877a_interface = |
| 980 | 966 | { |
| 981 | | towns_fdc_irq, |
| 967 | DEVCB_NULL, |
| 968 | DEVCB_DEVICE_LINE("dma_1", towns_mb8877a_drq_w), |
| 982 | 969 | NULL, |
| 983 | 970 | {FLOPPY_0,FLOPPY_1,FLOPPY_2,FLOPPY_3} |
| 984 | 971 | }; |
src/mess/drivers/bw2.c
| r5984 | r5985 | |
| 260 | 260 | |
| 261 | 261 | |
| 262 | 262 | /* Floppy */ |
| 263 | | static WD17XX_CALLBACK( bw2_wd17xx_callback ) |
| 263 | static WRITE_LINE_DEVICE_HANDLER( bw2_wd17xx_drq_w ) |
| 264 | 264 | { |
| 265 | | switch(state) |
| 265 | if (state) |
| 266 | 266 | { |
| 267 | | case WD17XX_IRQ_CLR: |
| 268 | | cputag_set_input_line(device->machine, Z80_TAG, INPUT_LINE_IRQ0, CLEAR_LINE); |
| 269 | | break; |
| 270 | | |
| 271 | | case WD17XX_IRQ_SET: |
| 272 | | cputag_set_input_line(device->machine, Z80_TAG, INPUT_LINE_IRQ0, HOLD_LINE); |
| 273 | | break; |
| 274 | | |
| 275 | | case WD17XX_DRQ_CLR: |
| 276 | | cputag_set_input_line(device->machine, Z80_TAG, INPUT_LINE_NMI, CLEAR_LINE); |
| 277 | | break; |
| 278 | | |
| 279 | | case WD17XX_DRQ_SET: |
| 280 | | if (cpu_get_reg(cputag_get_cpu(device->machine, Z80_TAG), Z80_HALT)) |
| 281 | | { |
| 282 | | cputag_set_input_line(device->machine, Z80_TAG, INPUT_LINE_NMI, HOLD_LINE); |
| 283 | | } |
| 284 | | break; |
| 267 | if (cpu_get_reg(cputag_get_cpu(device->machine, Z80_TAG), Z80_HALT)) |
| 268 | cputag_set_input_line(device->machine, Z80_TAG, INPUT_LINE_NMI, HOLD_LINE); |
| 285 | 269 | } |
| 270 | else |
| 271 | { |
| 272 | cputag_set_input_line(device->machine, Z80_TAG, INPUT_LINE_NMI, CLEAR_LINE); |
| 273 | } |
| 286 | 274 | } |
| 287 | 275 | |
| 288 | 276 | static READ8_HANDLER( bw2_wd2797_r ) |
| r5984 | r5985 | |
| 803 | 791 | FLOPPY_OPTIONS_NAME(bw2), |
| 804 | 792 | DO_NOT_KEEP_GEOMETRY |
| 805 | 793 | }; |
| 806 | | static const wd17xx_interface bw2_wd17xx_interface = { bw2_wd17xx_callback, NULL, {FLOPPY_0, FLOPPY_1, NULL, NULL}}; |
| 807 | 794 | |
| 795 | static const wd17xx_interface bw2_wd17xx_interface = |
| 796 | { |
| 797 | DEVCB_CPU_INPUT_LINE(Z80_TAG, INPUT_LINE_IRQ0), |
| 798 | DEVCB_LINE(bw2_wd17xx_drq_w), |
| 799 | NULL, |
| 800 | {FLOPPY_0, FLOPPY_1, NULL, NULL} |
| 801 | }; |
| 802 | |
| 808 | 803 | static MACHINE_DRIVER_START( bw2 ) |
| 809 | 804 | MDRV_DRIVER_DATA(bw2_state) |
| 810 | 805 | |
src/mess/drivers/enterp.c
| r5984 | r5985 | |
| 184 | 184 | FLOPPY/EXDOS |
| 185 | 185 | ***************************************************************************/ |
| 186 | 186 | |
| 187 | | static WD17XX_CALLBACK( enterp_wd1770_callback ) |
| 187 | static WRITE_LINE_DEVICE_HANDLER( enterp_wd1770_intrq_w ) |
| 188 | 188 | { |
| 189 | 189 | ep_state *ep = device->machine->driver_data; |
| 190 | 190 | |
| 191 | | switch (state) |
| 192 | | { |
| 193 | | case WD17XX_IRQ_CLR: ep->exdos_card_value &= ~0x02; break; |
| 194 | | case WD17XX_IRQ_SET: ep->exdos_card_value |= 0x02; break; |
| 195 | | case WD17XX_DRQ_CLR: ep->exdos_card_value &= ~0x80; break; |
| 196 | | case WD17XX_DRQ_SET: ep->exdos_card_value |= 0x80; break; |
| 197 | | } |
| 191 | if (state) |
| 192 | ep->exdos_card_value |= 0x02; |
| 193 | else |
| 194 | ep->exdos_card_value &= ~0x02; |
| 198 | 195 | } |
| 199 | 196 | |
| 197 | static WRITE_LINE_DEVICE_HANDLER( enterp_wd1770_drq_w ) |
| 198 | { |
| 199 | ep_state *ep = device->machine->driver_data; |
| 200 | 200 | |
| 201 | if (state) |
| 202 | ep->exdos_card_value |= 0x80; |
| 203 | else |
| 204 | ep->exdos_card_value &= ~0x80; |
| 205 | } |
| 206 | |
| 207 | |
| 201 | 208 | /* bit 0 - ?? |
| 202 | 209 | bit 1 - IRQ from WD1770 |
| 203 | 210 | bit 2 - ?? |
| r5984 | r5985 | |
| 412 | 419 | MACHINE DRIVERS |
| 413 | 420 | ***************************************************************************/ |
| 414 | 421 | |
| 415 | | static const wd17xx_interface enterp_wd1770_interface = { enterp_wd1770_callback, NULL, {FLOPPY_0,FLOPPY_1,FLOPPY_2,FLOPPY_3} }; |
| 422 | static const wd17xx_interface enterp_wd1770_interface = |
| 423 | { |
| 424 | DEVCB_LINE(enterp_wd1770_intrq_w), |
| 425 | DEVCB_LINE(enterp_wd1770_drq_w), |
| 426 | NULL, |
| 427 | {FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3} |
| 428 | }; |
| 416 | 429 | |
| 417 | 430 | static FLOPPY_OPTIONS_START(enterprise) |
| 418 | 431 | FLOPPY_OPTION(enterprise, "dsk,img", "Enterprise disk image", basicdsk_identify_default, basicdsk_construct_default, |
src/mess/drivers/a310.c
| r5984 | r5985 | |
| 31 | 31 | |
| 32 | 32 | #include "driver.h" |
| 33 | 33 | #include "machine/wd17xx.h" |
| 34 | #include "devices/flopdrv.h" |
| 34 | 35 | #include "cpu/arm/arm.h" |
| 35 | 36 | #include "sound/dac.h" |
| 36 | 37 | #include "includes/archimds.h" |
| r5984 | r5985 | |
| 44 | 45 | return 0; |
| 45 | 46 | } |
| 46 | 47 | |
| 47 | | static WD17XX_CALLBACK ( a310_wd177x_callback ) |
| 48 | static WRITE_LINE_DEVICE_HANDLER( a310_wd177x_intrq_w ) |
| 48 | 49 | { |
| 49 | | switch (state) |
| 50 | | { |
| 51 | | case WD17XX_IRQ_CLR: |
| 52 | | archimedes_clear_fiq(device->machine, ARCHIMEDES_FIQ_FLOPPY); |
| 53 | | break; |
| 50 | if (state) |
| 51 | archimedes_request_fiq(device->machine, ARCHIMEDES_FIQ_FLOPPY); |
| 52 | else |
| 53 | archimedes_clear_fiq(device->machine, ARCHIMEDES_FIQ_FLOPPY); |
| 54 | } |
| 54 | 55 | |
| 55 | | case WD17XX_IRQ_SET: |
| 56 | | archimedes_request_fiq(device->machine, ARCHIMEDES_FIQ_FLOPPY); |
| 57 | | break; |
| 58 | | |
| 59 | | case WD17XX_DRQ_CLR: |
| 60 | | archimedes_clear_fiq(device->machine, ARCHIMEDES_FIQ_FLOPPY_DRQ); |
| 61 | | break; |
| 62 | | |
| 63 | | case WD17XX_DRQ_SET: |
| 64 | | archimedes_request_fiq(device->machine, ARCHIMEDES_FIQ_FLOPPY_DRQ); |
| 65 | | break; |
| 66 | | } |
| 56 | static WRITE_LINE_DEVICE_HANDLER( a310_wd177x_drq_w ) |
| 57 | { |
| 58 | if (state) |
| 59 | archimedes_request_fiq(device->machine, ARCHIMEDES_FIQ_FLOPPY_DRQ); |
| 60 | else |
| 61 | archimedes_clear_fiq(device->machine, ARCHIMEDES_FIQ_FLOPPY_DRQ); |
| 67 | 62 | } |
| 68 | 63 | |
| 69 | 64 | static DRIVER_INIT(a310) |
| r5984 | r5985 | |
| 205 | 200 | PORT_BIT (0xf8, 0x80, IPT_UNUSED) |
| 206 | 201 | INPUT_PORTS_END |
| 207 | 202 | |
| 208 | | static const wd17xx_interface a310_wd17xx_interface = { |
| 209 | | a310_wd177x_callback, |
| 203 | static const wd17xx_interface a310_wd17xx_interface = |
| 204 | { |
| 205 | DEVCB_LINE(a310_wd177x_intrq_w), |
| 206 | DEVCB_LINE(a310_wd177x_drq_w), |
| 210 | 207 | NULL, |
| 211 | | {FLOPPY_0,FLOPPY_1,FLOPPY_2,FLOPPY_3} |
| 208 | {FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3} |
| 212 | 209 | }; |
| 213 | 210 | |
| 214 | 211 | static MACHINE_DRIVER_START( a310 ) |
src/mess/drivers/xerox820.c
| r5984 | r5985 | |
| 492 | 492 | |
| 493 | 493 | /* WD1771 Interface */ |
| 494 | 494 | |
| 495 | | static WD17XX_CALLBACK( wd1771_callback ) |
| 495 | static WRITE_LINE_DEVICE_HANDLER( xerox820_wd1771_intrq_w ) |
| 496 | 496 | { |
| 497 | 497 | xerox820_state *driver_state = device->machine->driver_data; |
| 498 | int halt = cpu_get_reg(cputag_get_cpu(device->machine, Z80_TAG), Z80_HALT); |
| 498 | 499 | |
| 500 | driver_state->fdc_irq = state; |
| 501 | |
| 502 | if (halt && state) |
| 503 | cputag_set_input_line(device->machine, Z80_TAG, INPUT_LINE_NMI, ASSERT_LINE); |
| 504 | else |
| 505 | cputag_set_input_line(device->machine, Z80_TAG, INPUT_LINE_NMI, CLEAR_LINE); |
| 506 | } |
| 507 | |
| 508 | static WRITE_LINE_DEVICE_HANDLER( xerox820_wd1771_drq_w ) |
| 509 | { |
| 510 | xerox820_state *driver_state = device->machine->driver_data; |
| 499 | 511 | int halt = cpu_get_reg(cputag_get_cpu(device->machine, Z80_TAG), Z80_HALT); |
| 500 | 512 | |
| 501 | | switch (state) |
| 502 | | { |
| 503 | | case WD17XX_IRQ_CLR: driver_state->fdc_irq = 0; break; |
| 504 | | case WD17XX_IRQ_SET: driver_state->fdc_irq = 1; break; |
| 505 | | case WD17XX_DRQ_CLR: driver_state->fdc_drq = 0; break; |
| 506 | | case WD17XX_DRQ_SET: driver_state->fdc_drq = 1; break; |
| 507 | | } |
| 513 | driver_state->fdc_drq = state; |
| 508 | 514 | |
| 509 | | if (halt && (driver_state->fdc_irq | driver_state->fdc_drq)) |
| 510 | | { |
| 515 | if (halt && state) |
| 511 | 516 | cputag_set_input_line(device->machine, Z80_TAG, INPUT_LINE_NMI, ASSERT_LINE); |
| 512 | | } |
| 513 | 517 | else |
| 514 | | { |
| 515 | 518 | cputag_set_input_line(device->machine, Z80_TAG, INPUT_LINE_NMI, CLEAR_LINE); |
| 516 | | } |
| 517 | 519 | } |
| 518 | 520 | |
| 519 | 521 | static const wd17xx_interface wd1771_intf = |
| 520 | 522 | { |
| 521 | | wd1771_callback, |
| 523 | DEVCB_LINE(xerox820_wd1771_intrq_w), |
| 524 | DEVCB_LINE(xerox820_wd1771_drq_w), |
| 522 | 525 | NULL, |
| 523 | | {FLOPPY_0,FLOPPY_1,NULL,NULL} |
| 526 | {FLOPPY_0, FLOPPY_1, NULL, NULL} |
| 524 | 527 | }; |
| 525 | 528 | |
| 526 | 529 | /* COM8116 Interface */ |