Previous 15994 Revisions Next

r6007 Wednesday 7th October, 2009 at 23:06:58 UTC by Dirk Best
[WD17XX] More cleanups, add some track stepping info
[src/mess/machine]wd17xx.c

src/mess/machine/wd17xx.c
r6006r6007
251251   int drq;      /* data request */
252252   int intrq;    /* interrupt request */
253253
254   int stepping_rate[4];  /* track stepping rate in ms */
255
254256   DENSITY   density;            /* FM/MFM, single / double density */
255257   wd17xx_type_t type;
256258   UINT8   track_reg;            /* value of track register */
r6006r6007
17391741    MAME DEVICE INTERFACE
17401742***************************************************************************/
17411743
1742static void common_start(const device_config *device, wd17xx_type_t device_type)
1744static DEVICE_START( wd1770 )
17431745{
17441746   wd17xx_t *w = get_safe_token(device);
17451747
r6006r6007
17481750   w->intf = device->static_config;
17491751
17501752   w->status = STA_1_TRACK0;
1751   w->type = device_type;
17521753   w->density = DEN_MFM_LO;
17531754   w->busy_timer = timer_alloc(device->machine, wd17xx_busy_callback, (void*)device);
17541755   w->timer = timer_alloc(device->machine, wd17xx_misc_timer_callback, (void*)device);
r6006r6007
17591760   /* resolve callbacks */
17601761   devcb_resolve_write_line(&w->out_intrq_func, &w->intf->out_intrq_func, device);
17611762   devcb_resolve_write_line(&w->out_drq_func, &w->intf->out_drq_func, device);
1763
1764   /* model specific values */
1765   w->type = WD_TYPE_1770;
1766
1767   w->stepping_rate[0] = 6;
1768   w->stepping_rate[1] = 12;
1769   w->stepping_rate[2] = 20;
1770   w->stepping_rate[3] = 30;
17621771}
17631772
1764static DEVICE_RESET( wd17xx )
1773static DEVICE_START( wd1771 )
17651774{
17661775   wd17xx_t *w = get_safe_token(device);
1767   int i;
17681776
1769   for (i = 0; i < 4; i++)
1770   {
1771      if(w->intf->floppy_drive_tags[i]!=NULL) {
1772         const device_config *img = devtag_get_device(device->machine,w->intf->floppy_drive_tags[i]);
1773         if (img!=NULL) {
1774            floppy_drive_set_controller(img,device);
1775            floppy_drive_set_index_pulse_callback(img, wd17xx_index_pulse_callback);
1776            floppy_drive_set_rpm( img, 300.);
1777         }
1778      }
1779   }
1777   DEVICE_START_CALL(wd1770);
17801778
1781   wd17xx_set_drive(device, 0);
1782
1783   w->hd = 0;
1784   w->hld_count = 0;
1785
1786   wd17xx_restore(device);
1779   w->type = WD_TYPE_1771;
17871780}
17881781
1789void wd17xx_reset(const device_config *device)
1782static DEVICE_START( wd1772 )
17901783{
1791   DEVICE_RESET_CALL( wd17xx );
1792}
1784   wd17xx_t *w = get_safe_token(device);
17931785
1794static DEVICE_START( wd1770 )
1795{
1796   common_start(device, WD_TYPE_1770);
1786   DEVICE_START_CALL(wd1770);
1787
1788   w->type = WD_TYPE_1772;
1789
1790   w->stepping_rate[0] = 6;
1791   w->stepping_rate[1] = 12;
1792   w->stepping_rate[2] = 20;
1793   w->stepping_rate[3] = 30;
17971794}
1798static DEVICE_START( wd1771 )
1799{
1800   common_start(device, WD_TYPE_1771);
1801}
1802static DEVICE_START( wd1772 )
1803{
1804   common_start(device, WD_TYPE_1772);
1805}
1795
18061796static DEVICE_START( wd1773 )
18071797{
1808   common_start(device, WD_TYPE_1773);
1798   wd17xx_t *w = get_safe_token(device);
1799
1800   DEVICE_START_CALL(wd1770);
1801
1802   w->type = WD_TYPE_1773;
1803
1804   w->stepping_rate[0] = 6;
1805   w->stepping_rate[1] = 12;
1806   w->stepping_rate[2] = 2;
1807   w->stepping_rate[3] = 3;
18091808}
1809
18101810static DEVICE_START( wd179x )
18111811{
1812   common_start(device, WD_TYPE_179X);
1812   wd17xx_t *w = get_safe_token(device);
1813
1814   DEVICE_START_CALL(wd1770);
1815
1816   w->type = WD_TYPE_179X;
18131817}
1818
18141819static DEVICE_START( wd1793 )
18151820{
1816   common_start(device, WD_TYPE_1793);
1817}
1818static DEVICE_START( wd2793 )
1819{
1820   common_start(device, WD_TYPE_2793);
1821}
1822static DEVICE_START( wd177x )
1823{
1824   common_start(device, WD_TYPE_177X);
1825}
1826static DEVICE_START( mb8877 )
1827{
1828   common_start(device, WD_TYPE_MB8877);
1829}
1821   wd17xx_t *w = get_safe_token(device);
18301822
1831DEVICE_GET_INFO( wd1770 )
1832{
1833   switch (state)
1834   {
1835      /* --- the following bits of info are returned as 64-bit signed integers --- */
1836      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(wd17xx_t);               break;
1837      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = 0;                        break;
1838      case DEVINFO_INT_CLASS:                     info->i = DEVICE_CLASS_PERIPHERAL;         break;
1823   DEVICE_START_CALL(wd1770);
18391824
1840      /* --- the following bits of info are returned as pointers to data or functions --- */
1841      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(wd1770);      break;
1842      case DEVINFO_FCT_STOP:                     /* Nothing */                        break;
1843      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(wd17xx);      break;
1844
1845      /* --- the following bits of info are returned as NULL-terminated strings --- */
1846      case DEVINFO_STR_NAME:                     strcpy(info->s, "WD1770");                  break;
1847      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "WD17xx");                  break;
1848      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                     break;
1849      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                     break;
1850      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright MESS Team");         break;
1851   }
1825   w->type = WD_TYPE_1793;
18521826}
18531827
1854DEVICE_GET_INFO( wd1771 )
1828static DEVICE_START( wd2793 )
18551829{
1856   switch (state)
1857   {
1858      /* --- the following bits of info are returned as NULL-terminated strings --- */
1859      case DEVINFO_STR_NAME:                     strcpy(info->s, "WD1771");            break;
1830   wd17xx_t *w = get_safe_token(device);
18601831
1861      /* --- the following bits of info are returned as pointers to data or functions --- */
1862      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(wd1771);   break;
1832   DEVICE_START_CALL(wd1770);
18631833
1864      default:                               DEVICE_GET_INFO_CALL(wd1770);            break;
1865   }
1834   w->type = WD_TYPE_2793;
18661835}
18671836
1868DEVICE_GET_INFO( wd1772 )
1837static DEVICE_START( wd177x )
18691838{
1870   switch (state)
1871   {
1872      /* --- the following bits of info are returned as NULL-terminated strings --- */
1873      case DEVINFO_STR_NAME:                     strcpy(info->s, "WD1772");            break;
1839   wd17xx_t *w = get_safe_token(device);
18741840
1875      /* --- the following bits of info are returned as pointers to data or functions --- */
1876      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(wd1772);   break;
1841   DEVICE_START_CALL(wd1770);
18771842
1878      default:                               DEVICE_GET_INFO_CALL(wd1770);            break;
1879   }
1843   w->type = WD_TYPE_177X;
18801844}
18811845
1882DEVICE_GET_INFO( wd1773 )
1846static DEVICE_START( mb8877 )
18831847{
1884   switch (state)
1885   {
1886      /* --- the following bits of info are returned as NULL-terminated strings --- */
1887      case DEVINFO_STR_NAME:                     strcpy(info->s, "WD1773");            break;
1848   wd17xx_t *w = get_safe_token(device);
18881849
1889      /* --- the following bits of info are returned as pointers to data or functions --- */
1890      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(wd1773);   break;
1850   DEVICE_START_CALL(wd1770);
18911851
1892      default:                               DEVICE_GET_INFO_CALL(wd1770);            break;
1893   }
1852   w->type = WD_TYPE_MB8877;
18941853}
18951854
1896DEVICE_GET_INFO( wd179x )
1855static DEVICE_RESET( wd1770 )
18971856{
1898   switch (state)
1857   wd17xx_t *w = get_safe_token(device);
1858   int i;
1859
1860   for (i = 0; i < 4; i++)
18991861   {
1900      /* --- the following bits of info are returned as NULL-terminated strings --- */
1901      case DEVINFO_STR_NAME:                     strcpy(info->s, "WD179x");            break;
1862      if(w->intf->floppy_drive_tags[i]!=NULL) {
1863         const device_config *img = devtag_get_device(device->machine,w->intf->floppy_drive_tags[i]);
1864         if (img!=NULL) {
1865            floppy_drive_set_controller(img,device);
1866            floppy_drive_set_index_pulse_callback(img, wd17xx_index_pulse_callback);
1867            floppy_drive_set_rpm( img, 300.);
1868         }
1869      }
1870   }
19021871
1903      /* --- the following bits of info are returned as pointers to data or functions --- */
1904      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(wd179x);   break;
1872   wd17xx_set_drive(device, 0);
19051873
1906      default:                               DEVICE_GET_INFO_CALL(wd1770);            break;
1907   }
1874   w->hd = 0;
1875   w->hld_count = 0;
1876
1877   wd17xx_restore(device);
19081878}
19091879
1910DEVICE_GET_INFO( wd1793 )
1880void wd17xx_reset(const device_config *device)
19111881{
1912   switch (state)
1913   {
1914      /* --- the following bits of info are returned as NULL-terminated strings --- */
1915      case DEVINFO_STR_NAME:                     strcpy(info->s, "WD1793");            break;
1882   DEVICE_RESET_CALL( wd1770 );
1883}
19161884
1917      /* --- the following bits of info are returned as pointers to data or functions --- */
1918      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(wd1793);   break;
19191885
1920      default:                               DEVICE_GET_INFO_CALL(wd1770);            break;
1921   }
1922}
1886/***************************************************************************
1887    DEVICE GETINFO
1888***************************************************************************/
19231889
1924DEVICE_GET_INFO( wd2793 )
1925{
1926   switch (state)
1927   {
1928      /* --- the following bits of info are returned as NULL-terminated strings --- */
1929      case DEVINFO_STR_NAME:                     strcpy(info->s, "WD2793");            break;
1890static const char DEVTEMPLATE_SOURCE[] = __FILE__;
19301891
1931      /* --- the following bits of info are returned as pointers to data or functions --- */
1932      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(wd2793);   break;
1892#define DEVTEMPLATE_ID(p,s)            p##wd1770##s
1893#define DEVTEMPLATE_STATE            wd17xx_t
1894#define DEVTEMPLATE_FEATURES         DT_HAS_START | DT_HAS_RESET
1895#define DEVTEMPLATE_NAME            "WD1770"
1896#define DEVTEMPLATE_FAMILY            "WD17xx"
1897#define DEVTEMPLATE_VERSION            "1.0"
1898#define DEVTEMPLATE_CREDITS            "Copyright MESS Team"
1899#include "devtempl.h"
19331900
1934      default:                               DEVICE_GET_INFO_CALL(wd1770);            break;
1935   }
1936}
1901#define DEVTEMPLATE_DERIVED_ID(p,s)      p##wd1771##s
1902#define DEVTEMPLATE_DERIVED_FEATURES   DT_HAS_START
1903#define DEVTEMPLATE_DERIVED_NAME      "WD1771"
1904#include "devtempl.h"
19371905
1938DEVICE_GET_INFO( wd177x )
1939{
1940   switch (state)
1941   {
1942      /* --- the following bits of info are returned as NULL-terminated strings --- */
1943      case DEVINFO_STR_NAME:                     strcpy(info->s, "WD177x");            break;
1906#define DEVTEMPLATE_DERIVED_ID(p,s)      p##wd1772##s
1907#define DEVTEMPLATE_DERIVED_FEATURES   DT_HAS_START
1908#define DEVTEMPLATE_DERIVED_NAME      "WD1772"
1909#include "devtempl.h"
19441910
1945      /* --- the following bits of info are returned as pointers to data or functions --- */
1946      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(wd177x);   break;
1911#define DEVTEMPLATE_DERIVED_ID(p,s)      p##wd1773##s
1912#define DEVTEMPLATE_DERIVED_FEATURES   DT_HAS_START
1913#define DEVTEMPLATE_DERIVED_NAME      "WD1773"
1914#include "devtempl.h"
19471915
1948      default:                               DEVICE_GET_INFO_CALL(wd1770);            break;
1949   }
1950}
1916#define DEVTEMPLATE_DERIVED_ID(p,s)      p##wd179x##s
1917#define DEVTEMPLATE_DERIVED_FEATURES   DT_HAS_START
1918#define DEVTEMPLATE_DERIVED_NAME      "WD179x"
1919#include "devtempl.h"
19511920
1952DEVICE_GET_INFO( mb8877 )
1953{
1954   switch (state)
1955   {
1956      /* --- the following bits of info are returned as NULL-terminated strings --- */
1957      case DEVINFO_STR_NAME:                     strcpy(info->s, "MB8877");            break;
1921#define DEVTEMPLATE_DERIVED_ID(p,s)      p##wd1793##s
1922#define DEVTEMPLATE_DERIVED_FEATURES   DT_HAS_START
1923#define DEVTEMPLATE_DERIVED_NAME      "WD1793"
1924#include "devtempl.h"
19581925
1959      /* --- the following bits of info are returned as pointers to data or functions --- */
1960      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(mb8877);   break;
1926#define DEVTEMPLATE_DERIVED_ID(p,s)      p##wd2793##s
1927#define DEVTEMPLATE_DERIVED_FEATURES   DT_HAS_START
1928#define DEVTEMPLATE_DERIVED_NAME      "WD2793"
1929#include "devtempl.h"
19611930
1962      default:                               DEVICE_GET_INFO_CALL(wd1770);            break;
1963   }
1964}
1931#define DEVTEMPLATE_DERIVED_ID(p,s)      p##wd177x##s
1932#define DEVTEMPLATE_DERIVED_FEATURES   DT_HAS_START
1933#define DEVTEMPLATE_DERIVED_NAME      "WD179x"
1934#include "devtempl.h"
1935
1936#define DEVTEMPLATE_DERIVED_ID(p,s)      p##mb8877##s
1937#define DEVTEMPLATE_DERIVED_FEATURES   DT_HAS_START
1938#define DEVTEMPLATE_DERIVED_NAME      "MB8877"
1939#include "devtempl.h"

Previous 15994 Revisions Next


© 1998-2018 The MESS Team