Previous 199869 Revisions Next

r19157 Monday 26th November, 2012 at 19:55:41 UTC by Sandro Ronco
(MESS) Updated TVC HBF to use new floppy system. (nw)
[src/lib]lib.mak
[src/lib/formats]tvc_dsk.c* tvc_dsk.h*
[src/mess/machine]tvc_hbf.c tvc_hbf.h

trunk/src/lib/formats/tvc_dsk.c
r0r19157
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
45tvc_format::tvc_format() : wd177x_format(formats)
46{
47}
48
49const char *tvc_format::name() const
50{
51   return "tvc";
52}
53
54const char *tvc_format::description() const
55{
56   return "Videoton TVC HBF disk image";
57}
58
59const char *tvc_format::extensions() const
60{
61   return "img,dsk";
62}
63
64// Unverified gap sizes
65const 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
78const floppy_format_type FLOPPY_TVC_FORMAT = &floppy_image_format_creator<tvc_format>;
trunk/src/lib/formats/tvc_dsk.h
r0r19157
1/*********************************************************************
2
3    formats/tvc_dsk.h
4
5    Videoton TVC HBF format
6
7*********************************************************************/
8
9#ifndef TVC_DSK_H_
10#define TVC_DSK_H_
11
12#include "wd177x_dsk.h"
13
14class tvc_format : public wd177x_format {
15public:
16   tvc_format();
17
18   virtual const char *name() const;
19   virtual const char *description() const;
20   virtual const char *extensions() const;
21
22private:
23   static const format formats[];
24};
25
26extern const floppy_format_type FLOPPY_TVC_FORMAT;
27
28#endif
trunk/src/lib/lib.mak
r19156r19157
173173   $(LIBOBJ)/formats/trs_cas.o      \
174174   $(LIBOBJ)/formats/trs_dsk.o      \
175175   $(LIBOBJ)/formats/tvc_cas.o      \
176   $(LIBOBJ)/formats/tvc_dsk.o      \
176177   $(LIBOBJ)/formats/tzx_cas.o      \
177178   $(LIBOBJ)/formats/uef_cas.o      \
178179   $(LIBOBJ)/formats/upd765_dsk.o   \
trunk/src/mess/machine/tvc_hbf.c
r19156r19157
1212    IMPLEMENTATION
1313***************************************************************************/
1414
15static 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]))
28LEGACY_FLOPPY_OPTIONS_END
15FLOPPY_FORMATS_MEMBER( tvc_hbf_device::floppy_formats )
16   FLOPPY_TVC_FORMAT
17FLOPPY_FORMATS_END
2918
30static 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};
19static SLOT_INTERFACE_START( tvc_hbf_floppies )
20   SLOT_INTERFACE( "525qd", FLOPPY_525_QD )
21SLOT_INTERFACE_END
4222
4323static 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)
4627MACHINE_CONFIG_END
4728
48
4929ROM_START( tvc_hbf )
5030   ROM_REGION(0x4000, "hbf", 0)
5131    ROM_DEFAULT_BIOS("basic")
r19156r19157
154134   switch((offset>>2) & 0x03)
155135   {
156136      case 0x00:
157         return wd17xx_r(m_fdc, space, offset & 3);
137         return m_fdc->read(space, offset & 3);
158138      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();
160140      default:
161141         return 0x00;
162142   }
r19156r19157
171151   switch((offset>>2) & 0x03)
172152   {
173153      case 0x00:
174         wd17xx_w(m_fdc, space, offset & 3, data);
154         m_fdc->write(space, offset & 3, data);
175155         break;
176156      case 0x01:
157      {
177158         // bit 0-3   drive select
178159         // bit 5     DDEN
179160         // bit 6     floppy motor
180161         // 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));
189170         break;
171      }
190172      case 0x02:
191173         m_rom_bank = (data>>4) & 0x03;
192174         break;
trunk/src/mess/machine/tvc_hbf.h
r19156r19157
55
66#include "emu.h"
77#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"
1110
1211
1312//**************************************************************************
r19156r19157
2827   virtual machine_config_constructor device_mconfig_additions() const;
2928   virtual const rom_entry *device_rom_region() const;
3029
30   DECLARE_FLOPPY_FORMATS( floppy_formats );
31
3132protected:
3233   // device-level overrides
3334   virtual void device_start();
r19156r19157
4344
4445private:
4546   // internal state
46   required_device<fd1793_device>   m_fdc;
47   required_device<fd1793_t>   m_fdc;
4748
4849   UINT8 *      m_rom;
4950   UINT8 *      m_ram;

Previous 199869 Revisions Next


© 1997-2024 The MAME Team