trunk/src/lib/formats/tvc_dsk.c
| r0 | r19157 | |
| 1 | /*************************************************************************** |
| 2 | |
| 3 | Copyright Olivier Galibert |
| 4 | All rights reserved. |
| 5 | |
| 6 | Redistribution and use in source and binary forms, with or without |
| 7 | modification, are permitted provided that the following conditions are |
| 8 | met: |
| 9 | |
| 10 | * Redistributions of source code must retain the above copyright |
| 11 | notice, this list of conditions and the following disclaimer. |
| 12 | * Redistributions in binary form must reproduce the above copyright |
| 13 | notice, this list of conditions and the following disclaimer in |
| 14 | the documentation and/or other materials provided with the |
| 15 | distribution. |
| 16 | * Neither the name 'MAME' nor the names of its contributors may be |
| 17 | used to endorse or promote products derived from this software |
| 18 | without specific prior written permission. |
| 19 | |
| 20 | THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR |
| 21 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 22 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 23 | DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT, |
| 24 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 25 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 27 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 28 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
| 29 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 30 | POSSIBILITY OF SUCH DAMAGE. |
| 31 | |
| 32 | ****************************************************************************/ |
| 33 | |
| 34 | /********************************************************************* |
| 35 | |
| 36 | formats/tvc_dsk.c |
| 37 | |
| 38 | tvc format |
| 39 | |
| 40 | *********************************************************************/ |
| 41 | |
| 42 | #include "emu.h" |
| 43 | #include "formats/tvc_dsk.h" |
| 44 | |
| 45 | tvc_format::tvc_format() : wd177x_format(formats) |
| 46 | { |
| 47 | } |
| 48 | |
| 49 | const char *tvc_format::name() const |
| 50 | { |
| 51 | return "tvc"; |
| 52 | } |
| 53 | |
| 54 | const char *tvc_format::description() const |
| 55 | { |
| 56 | return "Videoton TVC HBF disk image"; |
| 57 | } |
| 58 | |
| 59 | const char *tvc_format::extensions() const |
| 60 | { |
| 61 | return "img,dsk"; |
| 62 | } |
| 63 | |
| 64 | // Unverified gap sizes |
| 65 | const tvc_format::format tvc_format::formats[] = |
| 66 | { |
| 67 | { // 720K 5.25 inch |
| 68 | floppy_image::FF_525, floppy_image::DSQD, |
| 69 | 2000, 9, 80, 2, 512, {}, 1, {}, 100, 22, 20 |
| 70 | }, |
| 71 | { // 360K 5.25 inch |
| 72 | floppy_image::FF_525, floppy_image::SSQD, |
| 73 | 2000, 9, 80, 1, 512, {}, 1, {}, 100, 22, 20 |
| 74 | }, |
| 75 | {} |
| 76 | }; |
| 77 | |
| 78 | const floppy_format_type FLOPPY_TVC_FORMAT = &floppy_image_format_creator<tvc_format>; |
trunk/src/mess/machine/tvc_hbf.c
| r19156 | r19157 | |
| 12 | 12 | IMPLEMENTATION |
| 13 | 13 | ***************************************************************************/ |
| 14 | 14 | |
| 15 | | static LEGACY_FLOPPY_OPTIONS_START(tvc_hbf) |
| 16 | | LEGACY_FLOPPY_OPTION(tvc_hbf, "img,dsk", "TVC DS disk image (720KB)", basicdsk_identify_default, basicdsk_construct_default, NULL, |
| 17 | | HEADS([2]) |
| 18 | | TRACKS([80]) |
| 19 | | SECTORS([9]) |
| 20 | | SECTOR_LENGTH([512]) |
| 21 | | FIRST_SECTOR_ID([1])) |
| 22 | | LEGACY_FLOPPY_OPTION(tvc_hbf, "img,dsk", "TVC SS disk image (360KB)", basicdsk_identify_default, basicdsk_construct_default, NULL, |
| 23 | | HEADS([1]) |
| 24 | | TRACKS([80]) |
| 25 | | SECTORS([9]) |
| 26 | | SECTOR_LENGTH([512]) |
| 27 | | FIRST_SECTOR_ID([1])) |
| 28 | | LEGACY_FLOPPY_OPTIONS_END |
| 15 | FLOPPY_FORMATS_MEMBER( tvc_hbf_device::floppy_formats ) |
| 16 | FLOPPY_TVC_FORMAT |
| 17 | FLOPPY_FORMATS_END |
| 29 | 18 | |
| 30 | | static const floppy_interface tvc_hbf_floppy_interface = |
| 31 | | { |
| 32 | | DEVCB_NULL, |
| 33 | | DEVCB_NULL, |
| 34 | | DEVCB_NULL, |
| 35 | | DEVCB_NULL, |
| 36 | | DEVCB_NULL, |
| 37 | | FLOPPY_STANDARD_5_25_DSDD, |
| 38 | | LEGACY_FLOPPY_OPTIONS_NAME(tvc_hbf), |
| 39 | | "floppy_5_25", |
| 40 | | NULL |
| 41 | | }; |
| 19 | static SLOT_INTERFACE_START( tvc_hbf_floppies ) |
| 20 | SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) |
| 21 | SLOT_INTERFACE_END |
| 42 | 22 | |
| 43 | 23 | static MACHINE_CONFIG_FRAGMENT(tvc_hbf) |
| 44 | | MCFG_FD1793_ADD("fdc", default_wd17xx_interface_2_drives) |
| 45 | | MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(tvc_hbf_floppy_interface) |
| 24 | MCFG_FD1793x_ADD("fdc", XTAL_16MHz / 16 * 8) // real clock is 16MHz / 16 |
| 25 | MCFG_FLOPPY_DRIVE_ADD("fdc:0", tvc_hbf_floppies, "525qd", NULL, tvc_hbf_device::floppy_formats) |
| 26 | MCFG_FLOPPY_DRIVE_ADD("fdc:1", tvc_hbf_floppies, "525qd", NULL, tvc_hbf_device::floppy_formats) |
| 46 | 27 | MACHINE_CONFIG_END |
| 47 | 28 | |
| 48 | | |
| 49 | 29 | ROM_START( tvc_hbf ) |
| 50 | 30 | ROM_REGION(0x4000, "hbf", 0) |
| 51 | 31 | ROM_DEFAULT_BIOS("basic") |
| r19156 | r19157 | |
| 154 | 134 | switch((offset>>2) & 0x03) |
| 155 | 135 | { |
| 156 | 136 | case 0x00: |
| 157 | | return wd17xx_r(m_fdc, space, offset & 3); |
| 137 | return m_fdc->read(space, offset & 3); |
| 158 | 138 | case 0x01: |
| 159 | | return (wd17xx_drq_r(m_fdc)<<7) | wd17xx_intrq_r(m_fdc); |
| 139 | return (m_fdc->drq_r()<<7) | m_fdc->intrq_r(); |
| 160 | 140 | default: |
| 161 | 141 | return 0x00; |
| 162 | 142 | } |
| r19156 | r19157 | |
| 171 | 151 | switch((offset>>2) & 0x03) |
| 172 | 152 | { |
| 173 | 153 | case 0x00: |
| 174 | | wd17xx_w(m_fdc, space, offset & 3, data); |
| 154 | m_fdc->write(space, offset & 3, data); |
| 175 | 155 | break; |
| 176 | 156 | case 0x01: |
| 157 | { |
| 177 | 158 | // bit 0-3 drive select |
| 178 | 159 | // bit 5 DDEN |
| 179 | 160 | // bit 6 floppy motor |
| 180 | 161 | // bit 7 side select |
| 181 | | if (BIT(data, 0)) |
| 182 | | wd17xx_set_drive(m_fdc, 0); |
| 183 | | else if (BIT(data, 1)) |
| 184 | | wd17xx_set_drive(m_fdc, 1); |
| 185 | | wd17xx_dden_w(m_fdc, BIT(data, 5)); |
| 186 | | floppy_mon_w(subdevice(FLOPPY_0), !BIT(data, 6)); |
| 187 | | floppy_mon_w(subdevice(FLOPPY_1), !BIT(data, 6)); |
| 188 | | wd17xx_set_side(m_fdc, BIT(data, 7)); |
| 162 | floppy_image_device *floppy = NULL; |
| 163 | |
| 164 | if (BIT(data, 0)) floppy = subdevice<floppy_connector>("fdc:0")->get_device(); |
| 165 | if (BIT(data, 1)) floppy = subdevice<floppy_connector>("fdc:1")->get_device(); |
| 166 | m_fdc->set_floppy(floppy); |
| 167 | m_fdc->dden_w(BIT(data, 5)); |
| 168 | if (floppy) floppy->mon_w(!BIT(data, 6)); |
| 169 | if (floppy) floppy->ss_w(BIT(data, 7)); |
| 189 | 170 | break; |
| 171 | } |
| 190 | 172 | case 0x02: |
| 191 | 173 | m_rom_bank = (data>>4) & 0x03; |
| 192 | 174 | break; |
trunk/src/mess/machine/tvc_hbf.h
| r19156 | r19157 | |
| 5 | 5 | |
| 6 | 6 | #include "emu.h" |
| 7 | 7 | #include "machine/tvcexp.h" |
| 8 | | #include "machine/wd17xx.h" |
| 9 | | #include "imagedev/flopdrv.h" |
| 10 | | #include "formats/basicdsk.h" |
| 8 | #include "machine/wd1772.h" |
| 9 | #include "formats/tvc_dsk.h" |
| 11 | 10 | |
| 12 | 11 | |
| 13 | 12 | //************************************************************************** |
| r19156 | r19157 | |
| 28 | 27 | virtual machine_config_constructor device_mconfig_additions() const; |
| 29 | 28 | virtual const rom_entry *device_rom_region() const; |
| 30 | 29 | |
| 30 | DECLARE_FLOPPY_FORMATS( floppy_formats ); |
| 31 | |
| 31 | 32 | protected: |
| 32 | 33 | // device-level overrides |
| 33 | 34 | virtual void device_start(); |
| r19156 | r19157 | |
| 43 | 44 | |
| 44 | 45 | private: |
| 45 | 46 | // internal state |
| 46 | | required_device<fd1793_device> m_fdc; |
| 47 | required_device<fd1793_t> m_fdc; |
| 47 | 48 | |
| 48 | 49 | UINT8 * m_rom; |
| 49 | 50 | UINT8 * m_ram; |