Previous 15994 Revisions Next

r6041 Sunday 11th October, 2009 at 17:43:56 UTC by Miodrag Milanović
[SPECIAL] Fixed floppy for Special MX, regression since 0.124
[src/mess]mess.mak
[src/mess/drivers]special.c
[src/mess/formats]smx_dsk.c* smx_dsk.h*
[src/mess/machine]special.c

src/mess/machine/special.c
r6040r6041
270270   specimx_set_bank(machine, 2,0x00); // Initiali load ROM disk
271271   specimx_color = 0x70;
272272   timer_set(machine,  attotime_zero, NULL, 0, setup_pit8253_gates );
273   wd17xx_set_pause_time(devtag_get_device(machine, "wd1793"),12);
273274}
274275
275276READ8_HANDLER ( specimx_disk_ctrl_r )
src/mess/mess.mak
r6040r6041
12921292$(MESSOBJ)/special.a:         \
12931293   $(MESS_AUDIO)/special.o      \
12941294   $(MESS_DRIVERS)/special.o   \
1295   $(MESS_FORMATS)/smx_dsk.o   \
12951296   $(MESS_MACHINE)/special.o   \
12961297   $(MESS_VIDEO)/special.o      \
12971298
src/mess/formats/smx_dsk.c
r0r6041
1/*********************************************************************
2
3   formats/smx_dsk.c
4
5   Specialist MX disk images
6
7*********************************************************************/
8
9#include <string.h>
10
11#include "formats/smx_dsk.h"
12#include "formats/basicdsk.h"
13#include "driver.h"
14
15static FLOPPY_IDENTIFY(smx_dsk_identify)
16{
17   *vote = (floppy_image_size(floppy) == 819200) ? 100 : 0;
18   return FLOPPY_ERROR_SUCCESS;
19}
20
21static int smx_get_heads_per_disk(floppy_image *floppy)
22{
23   return 2;
24}
25
26static int smx_get_tracks_per_disk(floppy_image *floppy)
27{
28   return 80;
29}
30
31static UINT64 smx_translate_offset(floppy_image *floppy,
32    int track, int head, int sector)
33{     
34   return (track * 1024 * 5 * 2) + (head * 1024 * 5) + 1024 * sector;
35}
36
37static floperr_t get_offset(floppy_image *floppy, int head, int track, int sector, int sector_is_index, UINT64 *offset)
38{
39   UINT64 offs;
40   /* translate the sector to a raw sector */
41   if (!sector_is_index)
42   {
43      sector -= 1;
44   }
45   /* check to see if we are out of range */
46   if ((head < 0) || (head >= 2) || (track < 0) || (track >= 80)
47         || (sector < 0) || (sector >= 6))
48      return FLOPPY_ERROR_SEEKERROR;
49
50   offs = smx_translate_offset(floppy, track, head, sector);
51   if (offset)
52      *offset = offs;
53   return FLOPPY_ERROR_SUCCESS;
54}
55
56
57
58static floperr_t internal_smx_read_sector(floppy_image *floppy, int head, int track, int sector, int sector_is_index, void *buffer, size_t buflen)
59{
60   UINT64 offset;
61   floperr_t err;
62   err = get_offset(floppy, head, track, sector, sector_is_index, &offset);
63   if (err)
64      return err;
65
66   floppy_image_read(floppy, buffer, offset, buflen);
67   return FLOPPY_ERROR_SUCCESS;
68}
69
70
71
72static floperr_t internal_smx_write_sector(floppy_image *floppy, int head, int track, int sector, int sector_is_index, const void *buffer, size_t buflen, int ddam)
73{
74   UINT64 offset;
75   floperr_t err;
76
77   err = get_offset(floppy, head, track, sector, sector_is_index, &offset);
78   if (err)
79      return err;
80
81   floppy_image_write(floppy, buffer, offset, buflen);
82   return FLOPPY_ERROR_SUCCESS;
83}
84
85
86
87static floperr_t smx_read_sector(floppy_image *floppy, int head, int track, int sector, void *buffer, size_t buflen)
88{
89   return internal_smx_read_sector(floppy, head, track, sector, FALSE, buffer, buflen);
90}
91
92static floperr_t smx_write_sector(floppy_image *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam)
93{
94   return internal_smx_write_sector(floppy, head, track, sector, FALSE, buffer, buflen, ddam);
95}
96
97static floperr_t smx_read_indexed_sector(floppy_image *floppy, int head, int track, int sector, void *buffer, size_t buflen)
98{
99   return internal_smx_read_sector(floppy, head, track, sector, TRUE, buffer, buflen);
100}
101
102static floperr_t smx_write_indexed_sector(floppy_image *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam)
103{
104   return internal_smx_write_sector(floppy, head, track, sector, TRUE, buffer, buflen, ddam);
105}
106
107static floperr_t smx_get_sector_length(floppy_image *floppy, int head, int track, int sector, UINT32 *sector_length)
108{
109   floperr_t err;
110   err = get_offset(floppy, head, track, sector, FALSE, NULL);
111   if (err)
112      return err;
113
114   if (sector_length) {
115      *sector_length = 1024;
116   }
117   return FLOPPY_ERROR_SUCCESS;
118}
119
120
121
122static floperr_t smx_get_indexed_sector_info(floppy_image *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags)
123{
124   sector_index += 1;
125   if (cylinder)
126      *cylinder = track;
127   if (side)
128      *side = head;
129   if (sector)
130      *sector = sector_index;
131   if (flags)
132      /* TODO: read DAM or DDAM and determine flags */
133      *flags = 0;
134   return smx_get_sector_length(floppy, head, track, sector_index, sector_length);
135}
136
137
138static FLOPPY_CONSTRUCT(smx_dsk_construct)
139{
140   struct FloppyCallbacks *callbacks;
141   callbacks = floppy_callbacks(floppy);
142   callbacks->read_sector = smx_read_sector;
143   callbacks->write_sector = smx_write_sector;
144   callbacks->read_indexed_sector = smx_read_indexed_sector;
145   callbacks->write_indexed_sector = smx_write_indexed_sector;
146   callbacks->get_sector_length = smx_get_sector_length;
147   callbacks->get_heads_per_disk = smx_get_heads_per_disk;
148   callbacks->get_tracks_per_disk = smx_get_tracks_per_disk;
149   callbacks->get_indexed_sector_info = smx_get_indexed_sector_info;
150   
151   return FLOPPY_ERROR_SUCCESS;   
152}
153
154
155
156/* ----------------------------------------------------------------------- */
157
158FLOPPY_OPTIONS_START( specimx )
159   FLOPPY_OPTION( smx_dsk, "odi", "Specialist MX floppy disk image",   smx_dsk_identify, smx_dsk_construct, NULL)
160FLOPPY_OPTIONS_END
src/mess/formats/smx_dsk.h
r0r6041
1/*********************************************************************
2
3   formats/smx_dsk.h
4
5   SVI318 disk images
6
7*********************************************************************/
8
9#ifndef SMX_DSK_H
10#define SMX_DSK_H
11
12#include "formats/flopimg.h"
13
14/**************************************************************************/
15
16FLOPPY_OPTIONS_EXTERN(specimx);
17
18#endif /* SVI_DSK_H */
src/mess/drivers/special.c
r6040r6041
2020#include "devices/flopdrv.h"
2121#include "formats/basicdsk.h"
2222#include "formats/rk_cas.h"
23#include "formats/smx_dsk.h"
2324#include "machine/wd17xx.h"
2425
2526/* Address maps */
r6040r6041
394395   CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED
395396};
396397
397
398static FLOPPY_OPTIONS_START(specimx)
399   FLOPPY_OPTION(specimx, "odi,img", "Specialist MX disk image", basicdsk_identify_default, basicdsk_construct_default,
400      HEADS([2])
401      TRACKS([80])
402      SECTORS([5])
403      SECTOR_LENGTH([1024])
404      FIRST_SECTOR_ID([1]))
405FLOPPY_OPTIONS_END
406
407398static const floppy_config specimx_floppy_config =
408399{
409400   DEVCB_NULL,

Previous 15994 Revisions Next


© 1998-2018 The MESS Team