trunk/src/mess/machine/fd2000.c
| r19382 | r19383 | |
| 1 | 1 | /********************************************************************** |
| 2 | 2 | |
| 3 | | CMD FD2000 disk drive emulation |
| 3 | CMD FD-2000/FD-4000 disk drive emulation |
| 4 | 4 | |
| 5 | 5 | Copyright MESS Team. |
| 6 | 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | 7 | |
| 8 | 8 | **********************************************************************/ |
| 9 | 9 | |
| 10 | /* |
| 11 | |
| 12 | TODO: |
| 13 | |
| 14 | - IEC |
| 15 | - VIA |
| 16 | - D1M/D2M/D4M image format (http://ist.uwaterloo.ca/~schepers/formats/D2M-DNP.TXT) |
| 17 | |
| 18 | */ |
| 19 | |
| 10 | 20 | #include "fd2000.h" |
| 11 | 21 | |
| 12 | 22 | |
| r19382 | r19383 | |
| 27 | 37 | //************************************************************************** |
| 28 | 38 | |
| 29 | 39 | const device_type FD2000 = &device_creator<fd2000_device>; |
| 40 | const device_type FD4000 = &device_creator<fd4000_device>; |
| 30 | 41 | |
| 31 | 42 | |
| 32 | 43 | //------------------------------------------------- |
| r19382 | r19383 | |
| 35 | 46 | |
| 36 | 47 | ROM_START( fd2000 ) |
| 37 | 48 | ROM_REGION( 0x8000, M6502_TAG, 0 ) |
| 38 | | ROM_LOAD( "cmd_fd-2000_dos_v1.40_cs_33cc6f.bin", 0x0000, 0x8000, CRC(4e6ca15c) SHA1(0c61ba58269baf2b8aadf3bbc4648c7a5a6d2128) ) |
| 49 | ROM_DEFAULT_BIOS( "v140" ) |
| 50 | ROM_SYSTEM_BIOS( 0, "v134", "Version 1.34" ) |
| 51 | ROMX_LOAD( "cmd fd-2000 dos v1.34 fd-350026.bin", 0x0000, 0x8000, CRC(859a5edc) SHA1(487fa82a7977e5208d5088f3580f34e8c89560d1), ROM_BIOS(1) ) |
| 52 | ROM_SYSTEM_BIOS( 1, "v140", "Version 1.40" ) |
| 53 | ROMX_LOAD( "cmd fd-2000 dos v1.40 cs 33cc6f.bin", 0x0000, 0x8000, CRC(4e6ca15c) SHA1(0c61ba58269baf2b8aadf3bbc4648c7a5a6d2128), ROM_BIOS(2) ) |
| 39 | 54 | ROM_END |
| 40 | 55 | |
| 41 | 56 | |
| 42 | 57 | //------------------------------------------------- |
| 58 | // ROM( fd4000 ) |
| 59 | //------------------------------------------------- |
| 60 | |
| 61 | ROM_START( fd4000 ) |
| 62 | ROM_REGION( 0x8000, M6502_TAG, 0 ) |
| 63 | ROM_DEFAULT_BIOS( "v140" ) |
| 64 | ROM_SYSTEM_BIOS( 0, "v134", "Version 1.34" ) |
| 65 | ROMX_LOAD( "cmd fd-4000 dos v1.34 fd-350022.bin", 0x0000, 0x8000, CRC(1f4820c1) SHA1(7a2966662e7840fd9377549727ccba62e4349c6f), ROM_BIOS(1) ) |
| 66 | ROM_SYSTEM_BIOS( 1, "v140", "Version 1.40" ) |
| 67 | ROMX_LOAD( "cmd fd-4000 dos v1.40 fd-350022.bin", 0x0000, 0x8000, CRC(b563ef10) SHA1(d936d76fd8b50ce4c65f885703653d7c1bd7d3c9), ROM_BIOS(2) ) |
| 68 | ROM_END |
| 69 | |
| 70 | |
| 71 | //------------------------------------------------- |
| 43 | 72 | // rom_region - device-specific ROM region |
| 44 | 73 | //------------------------------------------------- |
| 45 | 74 | |
| 46 | 75 | const rom_entry *fd2000_device::device_rom_region() const |
| 47 | 76 | { |
| 48 | | return ROM_NAME( fd2000 ); |
| 77 | switch (m_variant) |
| 78 | { |
| 79 | default: |
| 80 | return ROM_NAME( fd2000 ); |
| 81 | |
| 82 | case TYPE_FD4000: |
| 83 | return ROM_NAME( fd4000 ); |
| 84 | } |
| 49 | 85 | } |
| 50 | 86 | |
| 51 | 87 | |
| r19382 | r19383 | |
| 54 | 90 | //------------------------------------------------- |
| 55 | 91 | |
| 56 | 92 | static ADDRESS_MAP_START( fd2000_mem, AS_PROGRAM, 8, fd2000_device ) |
| 57 | | AM_RANGE(0x0000, 0x7fff) AM_RAM |
| 93 | AM_RANGE(0x0000, 0x3fff) AM_RAM |
| 94 | AM_RANGE(0x4000, 0x400f) AM_MIRROR(0xbf0) AM_DEVREADWRITE(M6522_TAG, via6522_device, read, write) |
| 95 | AM_RANGE(0x4e00, 0x4e07) AM_MIRROR(0x1f8) AM_DEVICE(DP8473_TAG, upd765a_device, map) |
| 96 | AM_RANGE(0x5000, 0x7fff) AM_RAM |
| 58 | 97 | AM_RANGE(0x8000, 0xffff) AM_ROM AM_REGION(M6502_TAG, 0) |
| 59 | | //AM_RANGE() AM_DEVREADWRITE(M6522_TAG, via6522_device, read, write) |
| 60 | | //AM_RANGE() AM_DEVREAD_LEGACY(DP8473_TAG, upd765_status_r) |
| 61 | | //AM_RANGE() AM_DEVREADWRITE_LEGACY(DP8473_TAG, upd765_data_r, upd765_data_w) |
| 62 | 98 | ADDRESS_MAP_END |
| 63 | 99 | |
| 64 | 100 | |
| r19382 | r19383 | |
| 86 | 122 | }; |
| 87 | 123 | |
| 88 | 124 | static SLOT_INTERFACE_START( fd2000_floppies ) |
| 89 | | SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) |
| 125 | SLOT_INTERFACE( "35hd", FLOPPY_35_HD ) |
| 90 | 126 | SLOT_INTERFACE_END |
| 91 | 127 | |
| 128 | static SLOT_INTERFACE_START( fd4000_floppies ) |
| 129 | SLOT_INTERFACE( "35ed", FLOPPY_35_ED ) |
| 130 | SLOT_INTERFACE_END |
| 131 | /* |
| 132 | FLOPPY_FORMATS_MEMBER( fd2000_device::floppy_formats ) |
| 133 | FLOPPY_D81_FORMAT |
| 134 | FLOPPY_D2M_FORMAT |
| 135 | FLOPPY_FORMATS_END |
| 136 | */ |
| 92 | 137 | |
| 93 | 138 | //------------------------------------------------- |
| 94 | 139 | // MACHINE_DRIVER( fd2000 ) |
| r19382 | r19383 | |
| 101 | 146 | MCFG_VIA6522_ADD(M6522_TAG, 2000000, via_intf) |
| 102 | 147 | MCFG_UPD765A_ADD(DP8473_TAG, true, true) |
| 103 | 148 | |
| 104 | | MCFG_FLOPPY_DRIVE_ADD(DP8473_TAG ":0", fd2000_floppies, "525dd", 0, floppy_image_device::default_floppy_formats) |
| 149 | MCFG_FLOPPY_DRIVE_ADD(DP8473_TAG":0", fd2000_floppies, "35hd", 0, floppy_image_device::default_floppy_formats)//fd2000_device::floppy_formats) |
| 105 | 150 | MACHINE_CONFIG_END |
| 106 | 151 | |
| 107 | 152 | |
| 108 | 153 | //------------------------------------------------- |
| 154 | // MACHINE_DRIVER( fd4000 ) |
| 155 | //------------------------------------------------- |
| 156 | |
| 157 | static MACHINE_CONFIG_FRAGMENT( fd4000 ) |
| 158 | MCFG_CPU_ADD(M6502_TAG, M65C02, 2000000) |
| 159 | MCFG_CPU_PROGRAM_MAP(fd2000_mem) |
| 160 | |
| 161 | MCFG_VIA6522_ADD(M6522_TAG, 2000000, via_intf) |
| 162 | MCFG_UPD765A_ADD(DP8473_TAG, true, true) |
| 163 | |
| 164 | MCFG_FLOPPY_DRIVE_ADD(DP8473_TAG":0", fd4000_floppies, "35ed", 0, floppy_image_device::default_floppy_formats)//fd2000_device::floppy_formats) |
| 165 | MACHINE_CONFIG_END |
| 166 | |
| 167 | |
| 168 | //------------------------------------------------- |
| 109 | 169 | // machine_config_additions - device-specific |
| 110 | 170 | // machine configurations |
| 111 | 171 | //------------------------------------------------- |
| 112 | 172 | |
| 113 | 173 | machine_config_constructor fd2000_device::device_mconfig_additions() const |
| 114 | 174 | { |
| 115 | | return MACHINE_CONFIG_NAME( fd2000 ); |
| 175 | switch (m_variant) |
| 176 | { |
| 177 | default: |
| 178 | return MACHINE_CONFIG_NAME( fd2000 ); |
| 179 | |
| 180 | case TYPE_FD4000: |
| 181 | return MACHINE_CONFIG_NAME( fd4000 ); |
| 182 | } |
| 116 | 183 | } |
| 117 | 184 | |
| 118 | 185 | |
| 186 | //------------------------------------------------- |
| 187 | // device_config_complete - perform any |
| 188 | // operations now that the configuration is |
| 189 | // complete |
| 190 | //------------------------------------------------- |
| 119 | 191 | |
| 192 | void fd2000_device::device_config_complete() |
| 193 | { |
| 194 | switch (m_variant) |
| 195 | { |
| 196 | default: |
| 197 | m_shortname = "fd2000"; |
| 198 | break; |
| 199 | |
| 200 | case TYPE_FD4000: |
| 201 | m_shortname = "fd4000"; |
| 202 | break; |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | |
| 207 | |
| 120 | 208 | //************************************************************************** |
| 121 | 209 | // LIVE DEVICE |
| 122 | 210 | //************************************************************************** |
| r19382 | r19383 | |
| 128 | 216 | fd2000_device::fd2000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 129 | 217 | : device_t(mconfig, FD2000, "FD-2000", tag, owner, clock), |
| 130 | 218 | device_cbm_iec_interface(mconfig, *this), |
| 131 | | m_maincpu(*this, M6502_TAG) |
| 219 | m_maincpu(*this, M6502_TAG), |
| 220 | m_floppy0(*this, DP8473_TAG":0"), |
| 221 | m_variant(TYPE_FD2000) |
| 132 | 222 | { |
| 133 | 223 | } |
| 134 | 224 | |
| 225 | fd2000_device::fd2000_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant) |
| 226 | : device_t(mconfig, type, name, tag, owner, clock), |
| 227 | device_cbm_iec_interface(mconfig, *this), |
| 228 | m_maincpu(*this, M6502_TAG), |
| 229 | m_floppy0(*this, DP8473_TAG":0") |
| 230 | { |
| 231 | } |
| 135 | 232 | |
| 233 | |
| 136 | 234 | //------------------------------------------------- |
| 235 | // fd4000_device - constructor |
| 236 | //------------------------------------------------- |
| 237 | |
| 238 | fd4000_device::fd4000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 239 | : fd2000_device(mconfig, FD4000, "FD-4000", tag, owner, clock, TYPE_FD4000) { } |
| 240 | |
| 241 | |
| 242 | //------------------------------------------------- |
| 137 | 243 | // device_start - device-specific startup |
| 138 | 244 | //------------------------------------------------- |
| 139 | 245 | |
trunk/src/mess/machine/fd2000.h
| r19382 | r19383 | |
| 1 | 1 | /********************************************************************** |
| 2 | 2 | |
| 3 | | CMD FD2000 disk drive emulation |
| 3 | CMD FD-2000/FD-4000 disk drive emulation |
| 4 | 4 | |
| 5 | 5 | Copyright MESS Team. |
| 6 | 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| r19382 | r19383 | |
| 12 | 12 | #ifndef __FD2000__ |
| 13 | 13 | #define __FD2000__ |
| 14 | 14 | |
| 15 | | #define ADDRESS_MAP_MODERN |
| 16 | | |
| 17 | 15 | #include "emu.h" |
| 18 | 16 | #include "cpu/m6502/m65c02.h" |
| 19 | | #include "imagedev/flopdrv.h" |
| 20 | | #include "formats/mfi_dsk.h" |
| 17 | #include "formats/d81_dsk.h" |
| 21 | 18 | #include "machine/6522via.h" |
| 22 | 19 | #include "machine/cbmiec.h" |
| 23 | 20 | #include "machine/upd765.h" |
| r19382 | r19383 | |
| 39 | 36 | // ======================> fd2000_device |
| 40 | 37 | |
| 41 | 38 | class fd2000_device : public device_t, |
| 42 | | public device_cbm_iec_interface |
| 39 | public device_cbm_iec_interface |
| 43 | 40 | { |
| 44 | | |
| 45 | 41 | public: |
| 46 | | // construction/destruction |
| 47 | | fd2000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 42 | // construction/destruction |
| 43 | fd2000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 44 | fd2000_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant); |
| 48 | 45 | |
| 46 | enum |
| 47 | { |
| 48 | TYPE_FD2000, |
| 49 | TYPE_FD4000 |
| 50 | }; |
| 51 | |
| 49 | 52 | // optional information overrides |
| 50 | 53 | virtual const rom_entry *device_rom_region() const; |
| 51 | 54 | virtual machine_config_constructor device_mconfig_additions() const; |
| 52 | 55 | |
| 56 | //DECLARE_FLOPPY_FORMATS( floppy_formats ); |
| 57 | |
| 53 | 58 | protected: |
| 54 | | // device-level overrides |
| 55 | | virtual void device_start(); |
| 59 | // device-level overrides |
| 60 | virtual void device_config_complete(); |
| 61 | virtual void device_start(); |
| 56 | 62 | virtual void device_reset(); |
| 57 | | virtual void device_config_complete() { m_shortname = "fd2000"; } |
| 58 | 63 | |
| 59 | 64 | // device_cbm_iec_interface overrides |
| 60 | 65 | void cbm_iec_srq(int state); |
| r19382 | r19383 | |
| 63 | 68 | void cbm_iec_reset(int state); |
| 64 | 69 | |
| 65 | 70 | required_device<m65c02_device> m_maincpu; |
| 71 | required_device<floppy_connector> m_floppy0; |
| 72 | |
| 73 | int m_variant; |
| 66 | 74 | }; |
| 67 | 75 | |
| 68 | 76 | |
| 77 | // ======================> fd4000_device |
| 78 | |
| 79 | class fd4000_device : public fd2000_device |
| 80 | { |
| 81 | public: |
| 82 | // construction/destruction |
| 83 | fd4000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 84 | }; |
| 85 | |
| 86 | |
| 69 | 87 | // device type definition |
| 70 | 88 | extern const device_type FD2000; |
| 89 | extern const device_type FD4000; |
| 71 | 90 | |
| 72 | 91 | |
| 73 | 92 | |