Previous 199869 Revisions Next

r32457 Monday 29th September, 2014 at 03:07:47 UTC by R. Belmont
(MESS) concept: Add 5.25" DSDD raw image support and preliminary pseudo-DMA to buffered controller. [R. Belmont]
[src/emu/bus/a2bus]corvfdc02.c corvfdc02.h
[src/lib]lib.mak
[src/lib/formats]concept_dsk.c* concept_dsk.h*

trunk/src/emu/bus/a2bus/corvfdc02.c
r32456r32457
55    Implemention of the Corvus Systems CORVUS02 floppy controller
66    aka the "Buffered Floppy Controller"
77 
8    Boot PROM 0.8 says 8" DSDD or 5.25" DSDD
8    Boot PROM 0.8 says 8" SSDD or 5.25" DSDD; we stick with 5.25" here
9    and let the FDC01 handle 8".
910 
1011*********************************************************************/
1112
1213#include "corvfdc02.h"
14#include "formats/concept_dsk.h"
1315
1416/***************************************************************************
1517    PARAMETERS
r32456r32457
2527#define FDC02_FDC_TAG      "fdc02_fdc"
2628
2729FLOPPY_FORMATS_MEMBER( a2bus_corvfdc02_device::corv_floppy_formats )
30   FLOPPY_CONCEPT_525DSDD_FORMAT,
2831   FLOPPY_IMD_FORMAT
2932FLOPPY_FORMATS_END
3033
3134static SLOT_INTERFACE_START( corv_floppies )
32   SLOT_INTERFACE( "8dsdd", FLOPPY_8_DSDD )
3335   SLOT_INTERFACE( "525dsqd", FLOPPY_525_QD )
3436SLOT_INTERFACE_END
3537
r32456r32457
121123   m_fdc_local_status = 2;
122124   m_fdc_local_command = 0;
123125   m_curfloppy = NULL;
126   m_in_drq = false;
124127}
125128
126129/*-------------------------------------------------
r32456r32457
142145
143146      case 3:
144147//         printf("Read buffer @ %x = %02x\n", m_bufptr, m_buffer[m_bufptr]);
145         return m_buffer[m_bufptr];
148         return m_buffer[m_bufptr--];
146149
147150      case 4:   // local status
148151         if (m_curfloppy)
r32456r32457
182185         break;
183186
184187      case 3:   // buffer write
185//         printf("%02x to buffer @ %x\n", data, m_bufptr);
188//         printf("%02x to buffer[%x]\n", data, m_bufptr);
186189         m_buffer[m_bufptr--] = data;
187190         break;
188191
r32456r32457
261264
262265WRITE_LINE_MEMBER(a2bus_corvfdc02_device::drq_w)
263266{
264//   printf("DRQ: %d\n", state);
267   if (state)
268   {
269      // pseudo-DMA direction?
270      if (m_fdc_local_command & 0x40)
271      {
272         m_buffer[m_bufptr] = m_fdc->dma_r();
273//         printf("DMA %02x to buffer[%x]\n", m_buffer[m_bufptr], m_bufptr);
274         m_bufptr--;
275         m_bufptr &= 0x1ff;
276      }
277      else
278      {
279         m_fdc->dma_w(m_buffer[m_bufptr++]);
280         m_bufptr &= 0x1ff;
281      }
282   }
265283}
266284
trunk/src/emu/bus/a2bus/corvfdc02.h
r32456r32457
5757   UINT16 m_bufptr;
5858   UINT8 m_buffer[2048];   // 1x6116 SRAM
5959   floppy_image_device *m_curfloppy;
60   bool m_in_drq;
6061};
6162
6263// device type definition
trunk/src/lib/formats/concept_dsk.c
r0r32457
1// license:BSD-3-Clause
2// copyright-holders:Olivier Galibert, R. Belmont
3/*********************************************************************
4
5    formats/concept_dsk.c
6
7    Formats for Corvus Concept
8
9    5.25" DSDD is PC MFM, 77 tracks, double-sided, with 9 sectors per track
10
11*********************************************************************/
12
13#include "emu.h"
14#include "flopimg.h"
15#include "formats/concept_dsk.h"
16
17/* 9 sectors / track, 512 bytes per sector */
18const floppy_image_format_t::desc_e cc525dsdd_format::cc_9_desc[] = {
19   { MFM, 0x4e, 80 },
20   { MFM, 0x00, 12 },
21   { RAW, 0x5224, 3 },
22   { MFM, 0xfc, 1 },
23   { MFM, 0x4e, 50 },
24   { MFM, 0x00, 12 },
25   { SECTOR_LOOP_START, 1, 9 },
26   {   CRC_CCITT_START, 1 },
27   {     RAW, 0x4489, 3 },
28   {     MFM, 0xfe, 1 },
29   {     TRACK_ID },
30   {     HEAD_ID },
31   {     SECTOR_ID },
32   {     SIZE_ID },
33   {   CRC_END, 1 },
34   {   CRC, 1 },
35   {   MFM, 0x4e, 22 },
36   {   MFM, 0x00, 12 },
37   {   CRC_CCITT_START, 2 },
38   {     RAW, 0x4489, 3 },
39   {     MFM, 0xfb, 1 },
40   {     SECTOR_DATA, -1 },
41   {   CRC_END, 2 },
42   {   CRC, 2 },
43   {   MFM, 0x4e, 84 },
44   {   MFM, 0x00, 12 },
45   { SECTOR_LOOP_END },
46   { MFM, 0x4e, 170 },
47   { END }
48};
49
50cc525dsdd_format::cc525dsdd_format()
51{
52}
53
54const char *cc525dsdd_format::name() const
55{
56   return "img";
57}
58
59const char *cc525dsdd_format::description() const
60{
61   return "Corvus Concept 5.25\" DSDD floppy disk image";
62}
63
64const char *cc525dsdd_format::extensions() const
65{
66   return "img";
67}
68
69bool cc525dsdd_format::supports_save() const
70{
71   return true;
72}
73
74void cc525dsdd_format::find_size(io_generic *io, UINT8 &track_count, UINT8 &head_count, UINT8 &sector_count)
75{
76   UINT64 size = io_generic_size(io);
77
78   track_count = 77;
79   head_count = 2;
80   sector_count = 9;
81
82   UINT32 expected_size = 512 * track_count*head_count*sector_count;
83   if (size == expected_size)
84   {
85      return;
86   }
87
88   track_count = head_count = sector_count = 0;
89}
90
91int cc525dsdd_format::identify(io_generic *io, UINT32 form_factor)
92{
93   UINT8 track_count, head_count, sector_count;
94   find_size(io, track_count, head_count, sector_count);
95
96   if(track_count)
97      return 50;
98   return 0;
99}
100
101bool cc525dsdd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
102{
103   UINT8 track_count, head_count, sector_count;
104   find_size(io, track_count, head_count, sector_count);
105
106   UINT8 sectdata[10*512];
107   desc_s sectors[10];
108   for(int i=0; i<sector_count; i++) {
109      sectors[i+1].data = sectdata + 512*i;
110      sectors[i+1].size = 512;
111      sectors[i+1].sector_id = i+1;
112   }
113
114   int track_size = sector_count*512;
115   for(int track=0; track < track_count; track++) {
116      for(int head=0; head < head_count; head++) {
117         io_generic_read(io, sectdata, (track*head_count + head)*track_size, track_size);
118         generate_track(cc_9_desc, track, head, sectors, sector_count, 100000, image);
119      }
120   }
121
122   image->set_variant(floppy_image::DSDD);
123
124   return true;
125}
126
127bool cc525dsdd_format::save(io_generic *io, floppy_image *image)
128{
129   int track_count, head_count, sector_count;
130   get_geometry_mfm_pc(image, 2000, track_count, head_count, sector_count);
131
132   if(track_count != 77)
133      track_count = 77;
134
135   // Happens for a fully unformatted floppy
136   if(!head_count)
137      head_count = 2;
138
139   if(sector_count != 9)
140      sector_count = 9;
141
142   UINT8 sectdata[9*512];
143   int track_size = sector_count*512;
144
145   for(int track=0; track < track_count; track++) {
146      for(int head=0; head < head_count; head++) {
147         get_track_data_mfm_pc(track, head, image, 2000, 512, sector_count, sectdata);
148         io_generic_write(io, sectdata, (track*head_count + head)*track_size, track_size);
149      }
150   }
151
152   return true;
153}
154
155const floppy_format_type FLOPPY_CONCEPT_525DSDD_FORMAT = &floppy_image_format_creator<cc525dsdd_format>;
Property changes on: trunk/src/lib/formats/concept_dsk.c
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/lib/formats/concept_dsk.h
r0r32457
1/*********************************************************************
2
3    formats/concept_dsk.h
4
5    Formats for Corvus Concept
6
7*********************************************************************/
8
9#ifndef CONCEPT_DSK_H_
10#define CONCEPT_DSK_H_
11
12#include "flopimg.h"
13
14class cc525dsdd_format : public floppy_image_format_t
15{
16public:
17   cc525dsdd_format();
18
19   virtual int identify(io_generic *io, UINT32 form_factor);
20   virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
21   virtual bool save(io_generic *io, 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   static const desc_e cc_9_desc[];
29
30private:
31   void find_size(io_generic *io, UINT8 &track_count, UINT8 &head_count, UINT8 &sector_count);
32};
33
34extern const floppy_format_type FLOPPY_CONCEPT_525DSDD_FORMAT;
35
36#endif /* CONCEPT_DSK_H_ */
Property changes on: trunk/src/lib/formats/concept_dsk.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/lib/lib.mak
r32456r32457
126126   $(LIBOBJ)/formats/coco_cas.o    \
127127   $(LIBOBJ)/formats/coco_dsk.o    \
128128   $(LIBOBJ)/formats/comx35_dsk.o  \
129   $(LIBOBJ)/formats/concept_dsk.o \
129130   $(LIBOBJ)/formats/coupedsk.o    \
130131   $(LIBOBJ)/formats/cpis_dsk.o    \
131132   $(LIBOBJ)/formats/cqm_dsk.o     \

Previous 199869 Revisions Next


© 1997-2024 The MAME Team