Previous 15994 Revisions Next

r7788 Sunday 11th April, 2010 at 20:19:00 UTC by Nathan Woods
Inserts a check whether the get_track_size function is defined in the disk
format before calling it. (bug #1934) [Michael Zapf]
[docs]messnew.txt
[src/mess/formats]flopimg.c
[src/mess/machine]wd17xx.c

src/mess/machine/wd17xx.c
r7787r7788
534534}
535535
536536/*
537        Gets the size in bytes of the current track. For real hardware this
538    may vary per system in small degree, and there even for each track
539    and head, so we should not assume a fixed value here.
540    As we are using a buffered track writing, we have to find out how long
541    the track will become. The only object which can tell us is the
542    selected format.
543*/
544static int get_track_size(wd1770_state *w)
545{
546        int size = 0;
547        floppy_image *floppy = flopimg_get_image(w->drive);
548        if (floppy != NULL)
549        {
550                const struct FloppyCallbacks *fmt = floppy_callbacks(floppy);
551                if (fmt != NULL)
552                {
553                        size = fmt->get_track_size(floppy, w->hd, w->track);
554                }
555        }
556        return size;
557}
558
559/*
560537    Write an entire track. Formats which do not define a write_track
561538    function pointer will cause a silent return.
562539    What is written to the image depends on the selected format. Sector
r7787r7788
567544static void write_track(running_device *device)
568545{
569546   wd1770_state *w = get_safe_token(device);
547   floppy_image *floppy;
570548#if 0
571549   int i;
572550   for (i=0;i+4<w->data_offset;)
r7787r7788
589567   }
590568#endif
591569
592   /* Determine the track size. We cannot allow different sizes in this
593       design. */
594        w->data_count = get_track_size(w);
570   /* Get the size in bytes of the current track. For real hardware this
571   may vary per system in small degree, and there even for each track
572   and head, so we should not assume a fixed value here.
573   As we are using a buffered track writing, we have to find out how long
574   the track will become. The only object which can tell us is the
575   selected format.
576   */
577   w->data_count = 0;
578   floppy = flopimg_get_image(w->drive);
579   if (floppy != NULL)
580      w->data_count = floppy_get_track_size(floppy, w->hd, w->track);
595581
596582        if (w->data_count==0)
597583        {
r7787r7788
619605static void read_track(running_device *device)
620606{
621607   wd1770_state *w = get_safe_token(device);
608   floppy_image *floppy;
622609#if 0
623610   UINT8 *psrc;      /* pointer to track format structure */
624611   UINT8 *pdst;      /* pointer to track buffer */
r7787r7788
738725   }
739726#endif
740727   /* Determine the track size. We cannot allow different sizes in this
741       design. */
742        w->data_count = get_track_size(w);
728   design (see above, write_track). */
729   w->data_count = 0;
730   floppy = flopimg_get_image(w->drive);
731   if (floppy != NULL)
732      w->data_count = floppy_get_track_size(floppy, w->hd, w->track);
743733
744734        if (w->data_count==0)
745735        {
src/mess/formats/flopimg.c
r7787r7788
739739
740740UINT32 floppy_get_track_size(floppy_image *floppy, int head, int track)
741741{
742   return floppy_callbacks(floppy)->get_track_size(floppy, head, track);
742   const struct FloppyCallbacks *fmt;
743
744   fmt = floppy_callbacks(floppy);
745   if (!fmt->get_track_size)
746      return 0;
747   
748   return fmt->get_track_size(floppy, head, track);
743749}
744750
745751
docs/messnew.txt
r7787r7788
109109
110110- Refactored the Luxor ABC bus into a device. [Curt Coder]
111111
112- Inserts a check whether the get_track_size function is defined in the disk
113  format before calling it. (bug #1934) [Michael Zapf]
112114
113115
116
1141170.137
115118
116119New System Drivers Supported:

Previous 15994 Revisions Next


© 1998-2018 The MESS Team