src/mess/machine/wd17xx.c
| r6718 | r6719 | |
| 202 | 202 | /* Type IV commands */ |
| 203 | 203 | #define FDC_FORCE_INT 0xd0 /* force interrupt */ |
| 204 | 204 | |
| 205 | | /* enumeration to specify the type of FDC; there are subtle differences */ |
| 206 | | typedef enum |
| 207 | | { |
| 208 | | WD_TYPE_1770, |
| 209 | | WD_TYPE_1771, |
| 210 | | WD_TYPE_1772, |
| 211 | | WD_TYPE_1773, |
| 212 | | WD_TYPE_179X, |
| 213 | | WD_TYPE_1793, |
| 214 | | WD_TYPE_2793, |
| 215 | | |
| 216 | | /* duplicate constants */ |
| 217 | | WD_TYPE_177X = WD_TYPE_1770, |
| 218 | | WD_TYPE_MB8877 = WD_TYPE_179X |
| 219 | | } wd17xx_type_t; |
| 220 | | |
| 221 | 205 | /* structure describing a double density track */ |
| 222 | 206 | #define TRKSIZE_DD 6144 |
| 223 | 207 | #if 0 |
| r6718 | r6719 | |
| 307 | 291 | |
| 308 | 292 | |
| 309 | 293 | DENSITY density; /* FM/MFM, single / double density */ |
| 310 | | wd17xx_type_t type; |
| 294 | |
| 311 | 295 | UINT8 track_reg; /* value of track register */ |
| 312 | 296 | UINT8 command_type; /* last command type */ |
| 313 | 297 | UINT8 head; /* current head # */ |
| r6718 | r6719 | |
| 422 | 406 | |
| 423 | 407 | static int wd17xx_has_side_select(const device_config *device) |
| 424 | 408 | { |
| 425 | | wd1770_state *w = get_safe_token(device); |
| 426 | | return (w->type == WD_TYPE_1773) || (w->type == WD_TYPE_1793) || (w->type == WD_TYPE_2793); |
| 409 | return (device->type == WD1773 || device->type == WD1793 || device->type == WD2793); |
| 427 | 410 | } |
| 428 | 411 | |
| 429 | 412 | static int wd17xx_get_datarate_in_us(DENSITY density) |
| r6718 | r6719 | |
| 588 | 571 | } |
| 589 | 572 | #endif |
| 590 | 573 | |
| 591 | | if (w->type == WD_TYPE_1771) |
| 574 | if (device->type == WD1771) |
| 592 | 575 | w->data_count = TRKSIZE_SD; |
| 593 | 576 | else |
| 594 | 577 | w->data_count = (w->density) ? TRKSIZE_DD : TRKSIZE_SD; |
| r6718 | r6719 | |
| 726 | 709 | } |
| 727 | 710 | #endif |
| 728 | 711 | |
| 729 | | if (w->type == WD_TYPE_1771) |
| 712 | if (device->type == WD1771) |
| 730 | 713 | w->data_count = TRKSIZE_SD; |
| 731 | 714 | else |
| 732 | 715 | w->data_count = (w->density) ? TRKSIZE_DD : TRKSIZE_SD; |
| r6718 | r6719 | |
| 1570 | 1553 | { |
| 1571 | 1554 | w->command = data & ~FDC_MASK_TYPE_III; |
| 1572 | 1555 | w->data_offset = 0; |
| 1573 | | if (w->type == WD_TYPE_1771) |
| 1556 | if (device->type == WD1771) |
| 1574 | 1557 | w->data_count = TRKSIZE_SD; |
| 1575 | 1558 | else |
| 1576 | 1559 | w->data_count = (w->density) ? TRKSIZE_DD : TRKSIZE_SD; |
| r6718 | r6719 | |
| 1867 | 1850 | devcb_resolve_write_line(&w->out_intrq_func, &w->intf->out_intrq_func, device); |
| 1868 | 1851 | devcb_resolve_write_line(&w->out_drq_func, &w->intf->out_drq_func, device); |
| 1869 | 1852 | |
| 1870 | | /* model specific values */ |
| 1871 | | w->type = WD_TYPE_1770; |
| 1872 | | |
| 1873 | 1853 | /* stepping rate depends on the clock */ |
| 1874 | 1854 | w->stepping_rate[0] = 6; |
| 1875 | 1855 | w->stepping_rate[1] = 12; |
| r6718 | r6719 | |
| 1877 | 1857 | w->stepping_rate[3] = 30; |
| 1878 | 1858 | } |
| 1879 | 1859 | |
| 1880 | | static DEVICE_START( wd1771 ) |
| 1881 | | { |
| 1882 | | wd1770_state *w = get_safe_token(device); |
| 1883 | | |
| 1884 | | DEVICE_START_CALL(wd1770); |
| 1885 | | |
| 1886 | | w->type = WD_TYPE_1771; |
| 1887 | | } |
| 1888 | | |
| 1889 | 1860 | static DEVICE_START( wd1772 ) |
| 1890 | 1861 | { |
| 1891 | 1862 | wd1770_state *w = get_safe_token(device); |
| 1892 | 1863 | |
| 1893 | 1864 | DEVICE_START_CALL(wd1770); |
| 1894 | 1865 | |
| 1895 | | w->type = WD_TYPE_1772; |
| 1896 | | |
| 1897 | 1866 | /* the 1772 has faster track stepping rates */ |
| 1898 | 1867 | w->stepping_rate[0] = 6; |
| 1899 | 1868 | w->stepping_rate[1] = 12; |
| r6718 | r6719 | |
| 1901 | 1870 | w->stepping_rate[3] = 3; |
| 1902 | 1871 | } |
| 1903 | 1872 | |
| 1904 | | static DEVICE_START( wd1773 ) |
| 1905 | | { |
| 1906 | | wd1770_state *w = get_safe_token(device); |
| 1907 | | |
| 1908 | | DEVICE_START_CALL(wd1770); |
| 1909 | | |
| 1910 | | w->type = WD_TYPE_1773; |
| 1911 | | } |
| 1912 | | |
| 1913 | | static DEVICE_START( wd179x ) |
| 1914 | | { |
| 1915 | | wd1770_state *w = get_safe_token(device); |
| 1916 | | |
| 1917 | | DEVICE_START_CALL(wd1770); |
| 1918 | | |
| 1919 | | w->type = WD_TYPE_179X; |
| 1920 | | } |
| 1921 | | |
| 1922 | | static DEVICE_START( wd1793 ) |
| 1923 | | { |
| 1924 | | wd1770_state *w = get_safe_token(device); |
| 1925 | | |
| 1926 | | DEVICE_START_CALL(wd1770); |
| 1927 | | |
| 1928 | | w->type = WD_TYPE_1793; |
| 1929 | | } |
| 1930 | | |
| 1931 | | static DEVICE_START( wd2793 ) |
| 1932 | | { |
| 1933 | | wd1770_state *w = get_safe_token(device); |
| 1934 | | |
| 1935 | | DEVICE_START_CALL(wd1770); |
| 1936 | | |
| 1937 | | w->type = WD_TYPE_2793; |
| 1938 | | } |
| 1939 | | |
| 1940 | | static DEVICE_START( wd177x ) |
| 1941 | | { |
| 1942 | | wd1770_state *w = get_safe_token(device); |
| 1943 | | |
| 1944 | | DEVICE_START_CALL(wd1770); |
| 1945 | | |
| 1946 | | w->type = WD_TYPE_177X; |
| 1947 | | } |
| 1948 | | |
| 1949 | | static DEVICE_START( mb8877 ) |
| 1950 | | { |
| 1951 | | wd1770_state *w = get_safe_token(device); |
| 1952 | | |
| 1953 | | DEVICE_START_CALL(wd1770); |
| 1954 | | |
| 1955 | | w->type = WD_TYPE_MB8877; |
| 1956 | | } |
| 1957 | | |
| 1958 | 1873 | static DEVICE_RESET( wd1770 ) |
| 1959 | 1874 | { |
| 1960 | 1875 | wd1770_state *w = get_safe_token(device); |
| r6718 | r6719 | |
| 2012 | 1927 | #include "devtempl.h" |
| 2013 | 1928 | |
| 2014 | 1929 | #define DEVTEMPLATE_DERIVED_ID(p,s) p##wd1771##s |
| 2015 | | #define DEVTEMPLATE_DERIVED_FEATURES DT_HAS_START |
| 1930 | #define DEVTEMPLATE_DERIVED_FEATURES 0 |
| 2016 | 1931 | #define DEVTEMPLATE_DERIVED_NAME "WD1771" |
| 2017 | 1932 | #include "devtempl.h" |
| 2018 | 1933 | |
| r6718 | r6719 | |
| 2022 | 1937 | #include "devtempl.h" |
| 2023 | 1938 | |
| 2024 | 1939 | #define DEVTEMPLATE_DERIVED_ID(p,s) p##wd1773##s |
| 2025 | | #define DEVTEMPLATE_DERIVED_FEATURES DT_HAS_START |
| 1940 | #define DEVTEMPLATE_DERIVED_FEATURES 0 |
| 2026 | 1941 | #define DEVTEMPLATE_DERIVED_NAME "WD1773" |
| 2027 | 1942 | #include "devtempl.h" |
| 2028 | 1943 | |
| 2029 | 1944 | #define DEVTEMPLATE_DERIVED_ID(p,s) p##wd179x##s |
| 2030 | | #define DEVTEMPLATE_DERIVED_FEATURES DT_HAS_START |
| 1945 | #define DEVTEMPLATE_DERIVED_FEATURES 0 |
| 2031 | 1946 | #define DEVTEMPLATE_DERIVED_NAME "WD179x" |
| 2032 | 1947 | #include "devtempl.h" |
| 2033 | 1948 | |
| 2034 | 1949 | #define DEVTEMPLATE_DERIVED_ID(p,s) p##wd1793##s |
| 2035 | | #define DEVTEMPLATE_DERIVED_FEATURES DT_HAS_START |
| 1950 | #define DEVTEMPLATE_DERIVED_FEATURES 0 |
| 2036 | 1951 | #define DEVTEMPLATE_DERIVED_NAME "WD1793" |
| 2037 | 1952 | #include "devtempl.h" |
| 2038 | 1953 | |
| 2039 | 1954 | #define DEVTEMPLATE_DERIVED_ID(p,s) p##wd2793##s |
| 2040 | | #define DEVTEMPLATE_DERIVED_FEATURES DT_HAS_START |
| 1955 | #define DEVTEMPLATE_DERIVED_FEATURES 0 |
| 2041 | 1956 | #define DEVTEMPLATE_DERIVED_NAME "WD2793" |
| 2042 | 1957 | #include "devtempl.h" |
| 2043 | 1958 | |
| 2044 | 1959 | #define DEVTEMPLATE_DERIVED_ID(p,s) p##wd177x##s |
| 2045 | | #define DEVTEMPLATE_DERIVED_FEATURES DT_HAS_START |
| 1960 | #define DEVTEMPLATE_DERIVED_FEATURES 0 |
| 2046 | 1961 | #define DEVTEMPLATE_DERIVED_NAME "WD179x" |
| 2047 | 1962 | #include "devtempl.h" |
| 2048 | 1963 | |
| 2049 | 1964 | #define DEVTEMPLATE_DERIVED_ID(p,s) p##mb8877##s |
| 2050 | | #define DEVTEMPLATE_DERIVED_FEATURES DT_HAS_START |
| 1965 | #define DEVTEMPLATE_DERIVED_FEATURES 0 |
| 2051 | 1966 | #define DEVTEMPLATE_DERIVED_NAME "MB8877" |
| 2052 | 1967 | #include "devtempl.h" |