Previous 199869 Revisions Next

r19312 Tuesday 4th December, 2012 at 19:18:15 UTC by O. Galibert
pc98: Add its specific almost raw fdi disk format [O. Galibert]
[src/lib]lib.mak
[src/lib/formats]pc98fdi_dsk.c pc98fdi_dsk.h
[src/mess/drivers]pc9801.c

trunk/src/lib/formats/pc98fdi_dsk.c
r19311r19312
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/pc98fdi_dsk.h
37
38    PC98FDI disk images
39
40*********************************************************************/
41
42#include "emu.h"
43#include "pc98fdi_dsk.h"
44
45pc98fdi_format::pc98fdi_format()
46{
47}
48
49const char *pc98fdi_format::name() const
50{
51   return "pc98-fdi";
52}
53
54const char *pc98fdi_format::description() const
55{
56   return "PC98 FDI disk image";
57}
58
59const char *pc98fdi_format::extensions() const
60{
61   return "fdi";
62}
63
64int pc98fdi_format::identify(io_generic *io, UINT32 form_factor)
65{
66   int size = io_generic_size(io);
67   UINT8 h[32];
68
69   io_generic_read(io, h, 0, 32);
70   int hsize = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x8));
71   int psize = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0xc));
72   int ssize = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x10));
73   int scnt  = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x14));
74   int sides = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x18));
75   int ntrk  = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x1c));
76   if(size == hsize + psize && psize == ssize*scnt*sides*ntrk)
77      return 100;
78
79   return 0;
80}
81
82bool pc98fdi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
83{
84   UINT8 h[32];
85
86   io_generic_read(io, h, 0, 32);
87
88   int hsize         = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x8));
89   int sector_size   = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x10));
90   int sector_count  = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x14));
91   int head_count    = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x18));
92   int track_count   = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x1c));
93
94   int cell_count = form_factor == floppy_image::FF_35 ? 200000 : 166666;
95
96   int ssize;
97   for(ssize=0; (128 << ssize) < sector_size; ssize++);
98
99   desc_pc_sector sects[256];
100   UINT8 sect_data[65536];
101
102   for(int track=0; track < track_count; track++)
103      for(int head=0; head < head_count; head++) {
104         io_generic_read(io, sect_data, hsize + sector_size*sector_count*(track*head_count + head), sector_size*sector_count);
105
106         for(int i=0; i<sector_count; i++) {
107            sects[i].track       = track;
108            sects[i].head        = head;
109            sects[i].sector      = i+1;
110            sects[i].size        = ssize;
111            sects[i].actual_size = sector_size;
112            sects[i].deleted     = false;
113            sects[i].bad_crc     = false;
114            sects[i].data        = sect_data + i*sector_size;
115         }
116
117         build_pc_track_mfm(track, head, image, cell_count, sector_count, sects, calc_default_pc_gap3_size(form_factor, sector_size));
118      }
119
120   return true;
121}
122
123bool pc98fdi_format::supports_save() const
124{
125   return false;
126}
127
128const floppy_format_type FLOPPY_PC98FDI_FORMAT = &floppy_image_format_creator<pc98fdi_format>;
trunk/src/lib/formats/pc98fdi_dsk.h
r19311r19312
1/*********************************************************************
2
3    formats/pc98fdi_dsk.h
4
5    PC98FDI disk images
6
7*********************************************************************/
8
9#ifndef PC98FDI_DSK_H
10#define PC98FDI_DSK_H
11
12#include "flopimg.h"
13
14
15class pc98fdi_format : public floppy_image_format_t
16{
17public:
18   pc98fdi_format();
19
20   virtual int identify(io_generic *io, UINT32 form_factor);
21   virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
22
23   virtual const char *name() const;
24   virtual const char *description() const;
25   virtual const char *extensions() const;
26   virtual bool supports_save() const;
27};
28
29extern const floppy_format_type FLOPPY_PC98FDI_FORMAT;
30
31#endif /* PC98FDI_DSK_H */
trunk/src/lib/lib.mak
r19311r19312
153153   $(LIBOBJ)/formats/p6001_cas.o   \
154154   $(LIBOBJ)/formats/pasti_dsk.o   \
155155   $(LIBOBJ)/formats/pc_dsk.o      \
156   $(LIBOBJ)/formats/pc98fdi_dsk.o   \
156157   $(LIBOBJ)/formats/pmd_cas.o      \
157158   $(LIBOBJ)/formats/primoptp.o   \
158159   $(LIBOBJ)/formats/pyldin_dsk.o   \
trunk/src/mess/drivers/pc9801.c
r19311r19312
271271#include "machine/ram.h"
272272#include "formats/mfi_dsk.h"
273273#include "formats/d88_dsk.h"
274#include "formats/pc98fdi_dsk.h"
274275
275276#define UPD1990A_TAG "upd1990a"
276277#define UPD8251_TAG  "upd8251"
r19311r19312
470471   DECLARE_WRITE8_MEMBER(pc9821_window_bank_w);
471472   DECLARE_READ32_MEMBER(pc9821_timestamp_r);
472473
474   DECLARE_FLOPPY_FORMATS( floppy_formats );
475
473476   void fdc_2hd_irq(bool state);
474477   void fdc_2hd_drq(bool state);
475478   void fdc_2dd_irq(bool state);
r19311r19312
30893092   DEVCB_LINE(pc9801_sound_irq)
30903093};
30913094
3095FLOPPY_FORMATS_MEMBER( pc9801_state::floppy_formats )
3096   FLOPPY_PC98FDI_FORMAT
3097FLOPPY_FORMATS_END
3098
30923099static MACHINE_CONFIG_START( pc9801, pc9801_state )
30933100   MCFG_CPU_ADD("maincpu", I8086, 5000000) //unknown clock
30943101   MCFG_CPU_PROGRAM_MAP(pc9801_map)
r19311r19312
31113118
31123119   MCFG_UPD765A_ADD("upd765_2hd", false, true)
31133120   MCFG_UPD765A_ADD("upd765_2dd", false, true)
3114   MCFG_FLOPPY_DRIVE_ADD("upd765_2hd:0", pc9801_floppies, "525hd", 0, floppy_image_device::default_floppy_formats)
3115   MCFG_FLOPPY_DRIVE_ADD("upd765_2hd:1", pc9801_floppies, "525hd", 0, floppy_image_device::default_floppy_formats)
3116   MCFG_FLOPPY_DRIVE_ADD("upd765_2dd:0", pc9801_floppies, "525hd", 0, floppy_image_device::default_floppy_formats)
3117   MCFG_FLOPPY_DRIVE_ADD("upd765_2dd:1", pc9801_floppies, "525hd", 0, floppy_image_device::default_floppy_formats)
3121   MCFG_FLOPPY_DRIVE_ADD("upd765_2hd:0", pc9801_floppies, "525hd", 0, pc9801_state::floppy_formats)
3122   MCFG_FLOPPY_DRIVE_ADD("upd765_2hd:1", pc9801_floppies, "525hd", 0, pc9801_state::floppy_formats)
3123   MCFG_FLOPPY_DRIVE_ADD("upd765_2dd:0", pc9801_floppies, "525hd", 0, pc9801_state::floppy_formats)
3124   MCFG_FLOPPY_DRIVE_ADD("upd765_2dd:1", pc9801_floppies, "525hd", 0, pc9801_state::floppy_formats)
31183125
31193126   MCFG_SOFTWARE_LIST_ADD("disk_list","pc98")
31203127

Previous 199869 Revisions Next


© 1997-2024 The MAME Team