Previous 15994 Revisions Next

r15474 Sunday 17th June, 2012 at 22:12:58 UTC by R. Belmont
Ensoniq Mirage: Preliminary hookup of floppy format and WD1772 FDC [R. Belmont]
[src/lib]lib.mak
[src/lib/formats]esq8_dsk.c* esq8_dsk.h*
[src/mess/drivers]mirage.c

src/lib/formats/esq8_dsk.c
r0r15474
1/*********************************************************************
2
3    formats/esq8_dsk.c
4
5    Formats for 8-bit Ensoniq synthesizers and samplers
6 
7    Disk is PC MFM, 40 tracks, single (Mirage) or double (SQ-80) sided,
8    with 6 sectors per track.
9    Sectors 0-4 are 1024 bytes, sector 5 is 512 bytes
10
11*********************************************************************/
12
13#include "emu.h"
14#include "flopimg.h"
15#include "formats/esq8_dsk.h"
16
17const floppy_image_format_t::desc_e esq8img_format::esq_6_desc[] = {
18   { MFM, 0x4e, 80 },
19   { MFM, 0x00, 12 },
20   { RAW, 0x5224, 3 },
21   { MFM, 0xfc, 1 },
22   { MFM, 0x4e, 50 },
23   { MFM, 0x00, 12 },
24   { SECTOR_LOOP_START, 0, 5 },
25   {   CRC_CCITT_START, 1 },
26   {     RAW, 0x4489, 3 },
27   {     MFM, 0xfe, 1 },
28   {     TRACK_ID },
29   {     HEAD_ID },
30   {     SECTOR_ID },
31   {     SIZE_ID },
32   {   CRC_END, 1 },
33   {   CRC, 1 },
34   {   MFM, 0x4e, 22 },
35   {   MFM, 0x00, 12 },
36   {   CRC_CCITT_START, 2 },
37   {     RAW, 0x4489, 3 },
38   {     MFM, 0xfb, 1 },
39   {     SECTOR_DATA, -1 },
40   {   CRC_END, 2 },
41   {   CRC, 2 },
42   {   MFM, 0x4e, 84 },
43   {   MFM, 0x00, 12 },
44   { SECTOR_LOOP_END },
45   { MFM, 0x4e, 170 },
46   { END }
47};
48
49esq8img_format::esq8img_format()
50{
51}
52
53const char *esq8img_format::name() const
54{
55   return "img";
56}
57
58const char *esq8img_format::description() const
59{
60   return "Ensoniq Mirage/SQ-80 floppy disk image";
61}
62
63const char *esq8img_format::extensions() const
64{
65   return "img";
66}
67
68bool esq8img_format::supports_save() const
69{
70   return true;
71}
72
73void esq8img_format::find_size(io_generic *io, int &track_count, int &head_count, int &sector_count)
74{
75   int size = io_generic_size(io);
76   track_count = 80;
77    head_count = 1;
78   sector_count = 6;
79
80    if (size == 5632 * 80)
81    {
82        return;
83    }
84
85    track_count = head_count = sector_count = 0;
86}
87
88int esq8img_format::identify(io_generic *io, UINT32 form_factor)
89{
90   int track_count, head_count, sector_count;
91   find_size(io, track_count, head_count, sector_count);
92
93   if(track_count)
94      return 50;
95   return 0;
96}
97
98bool esq8img_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
99{
100   int track_count, head_count, sector_count;
101   find_size(io, track_count, head_count, sector_count);
102
103   UINT8 sectdata[(5*1024) + 512];
104   desc_s sectors[6];
105   for(int i=0; i<sector_count; i++) {
106        if (i < 5)
107        {
108            sectors[i].data = sectdata + (1024*i);  // 5 1024 byte sectors
109            sectors[i].size = 1024;
110            sectors[i].sector_id = i;
111        }
112        else
113        {
114            sectors[i].data = sectdata + (5*1024);  // 1 512 byte sector
115            sectors[i].size = 512;
116            sectors[i].sector_id = i;
117        }
118   }
119
120   int track_size = (5*1024) + 512;
121
122   for(int track=0; track < track_count; track++)
123    {
124      for(int head=0; head < head_count; head++)
125        {
126         io_generic_read(io, sectdata, (track*head_count + head)*track_size, track_size);
127         generate_track(esq_6_desc, track, head, sectors, sector_count, 109376, image);
128      }
129   }
130
131   image->set_variant(floppy_image::DSDD);
132
133   return true;
134}
135
136bool esq8img_format::save(io_generic *io, floppy_image *image)
137{
138   int track_count, head_count, sector_count;
139   get_geometry_mfm_pc(image, 2000, track_count, head_count, sector_count);
140
141   if(track_count != 80)
142      track_count = 80;
143
144   // Happens for a fully unformatted floppy
145   if(!head_count)
146      head_count = 1;
147
148   if(sector_count != 6)
149      sector_count = 6;
150
151   UINT8 sectdata[10*512];
152   int track_size = (5*1024) + 512;
153
154   for(int track=0; track < track_count; track++) {
155      for(int head=0; head < head_count; head++) {
156         get_track_data_mfm_pc(track, head, image, 2000, 512, sector_count, sectdata);
157         io_generic_write(io, sectdata, (track*head_count + head)*track_size, track_size);
158      }
159   }
160
161   return true;
162}
163
164const floppy_format_type FLOPPY_ESQ8IMG_FORMAT = &floppy_image_format_creator<esq8img_format>;
src/lib/formats/esq8_dsk.h
r0r15474
1/*********************************************************************
2
3    formats/esq8_dsk.h
4
5    Formats for 8-bit Ensoniq synthesizers and samplers
6 
7    Disk is PC MFM, 40 tracks, single (Mirage) or double (SQ-80) sided,
8    with 6 sectors per track.
9    Sectors 0-4 are 1024 bytes, sector 5 is 512 bytes
10
11*********************************************************************/
12
13#ifndef ESQ8_DSK_H_
14#define ESQ8_DSK_H_
15
16#include "flopimg.h"
17
18class esq8img_format : public floppy_image_format_t
19{
20public:
21   esq8img_format();
22
23   virtual int identify(io_generic *io, UINT32 form_factor);
24   virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
25   virtual bool save(io_generic *io, floppy_image *image);
26
27   virtual const char *name() const;
28   virtual const char *description() const;
29   virtual const char *extensions() const;
30   virtual bool supports_save() const;
31
32   static const desc_e esq_6_desc[];
33
34private:
35   void find_size(io_generic *io, int &track_count, int &head_count, int &sector_count);
36};
37
38extern const floppy_format_type FLOPPY_ESQ8IMG_FORMAT;
39
40#endif /* ESQ8_DSK_H_ */
src/lib/lib.mak
r15473r15474
117117   $(LIBOBJ)/formats/dfi_dsk.o      \
118118   $(LIBOBJ)/formats/dim_dsk.o      \
119119   $(LIBOBJ)/formats/dsk_dsk.o      \
120   $(LIBOBJ)/formats/esq8_dsk.o   \
120121   $(LIBOBJ)/formats/esq16_dsk.o   \
121122   $(LIBOBJ)/formats/fdi_dsk.o      \
122123   $(LIBOBJ)/formats/fm7_cas.o      \
src/mess/drivers/mirage.c
r15473r15474
292908 |     |
3030    _____
3131     10
32
32        76543210
3333PORT A: 111xyzzz
34 
35PA4/PA5 are the "enable" for the two LEDs
36 
377seg Display    Bits
38'0'  %11111100 $FC
39'1'  %01100000 $60
40'2'  %11011010 $DA
41'3'  %11110010 $F2
42'4'  %01100110 $66
43'5'  %10110110 $B6
44'6'  %10111110 $BE
45'7'  %11100000 $E0
46'8'  %11111110 $FE
47'9'  %11100110 $E6
48'A'  %11101110 $EE
49'b'  %00111110 $3E
50'C'  %10011100 $9C
51'd'  %01111010 $7A
52'E'  %10011110 $9E
53'F'  %10001110 $8E
54'L'  %00011100 $1C
55'n'  %00101010 $2A
56'o'  %00111010 $3A
57'P'  %11001110 $CE
58'r'  %00001010 $0A
59'U' %01111100 $7C
60'c' %00011010 $1A
61'u' %01111000 $38
3462
35
3663***************************************************************************/
3764
3865
r15473r15474
4067#include "cpu/m6809/m6809.h"
4168#include "machine/6850acia.h"
4269#include "machine/6522via.h"
43#include "machine/wd17xx.h"
44#include "imagedev/flopdrv.h"
45#include "formats/basicdsk.h"
70#include "machine/wd1772.h"
71#include "formats/esq8_dsk.h"
72#include "formats/mfi_dsk.h"
73#include "formats/dfi_dsk.h"
74#include "formats/ipf_dsk.h"
4675#include "sound/es5503.h"
4776
4877class mirage_state : public driver_device
4978{
5079public:
5180    mirage_state(const machine_config &mconfig, device_type type, const char *tag)
52    : driver_device(mconfig, type, tag) { }
81    : driver_device(mconfig, type, tag),
82    m_maincpu(*this, "maincpu"),
83    m_fdc(*this, "wd1772")
84    { }
5385
86    required_device<device_t> m_maincpu;
87    required_device<wd1772_t> m_fdc;
88
5489   virtual void machine_reset();
5590
5691    int last_sndram_bank;
92
93   static const floppy_format_type floppy_formats[];
94
95    void fdc_intrq_w(bool state);
5796};
5897
98const floppy_format_type mirage_state::floppy_formats[] = {
99   FLOPPY_ESQ8IMG_FORMAT, FLOPPY_IPF_FORMAT, FLOPPY_MFI_FORMAT, FLOPPY_DFI_FORMAT,
100   NULL
101};
59102
103static SLOT_INTERFACE_START( ensoniq_floppies )
104   SLOT_INTERFACE( "35dd", FLOPPY_35_DD )
105SLOT_INTERFACE_END
106
107void mirage_state::fdc_intrq_w(bool state)
108{
109    device_set_input_line(m_maincpu, INPUT_LINE_NMI, state);
110}
111
60112static void mirage_doc_irq(device_t *device, int state)
61113{
62114}
r15473r15474
84136static ADDRESS_MAP_START( mirage_map, AS_PROGRAM, 8, mirage_state )
85137   AM_RANGE(0x0000, 0x7fff) AM_ROMBANK("sndbank")   // 32k window on 128k of wave RAM
86138   AM_RANGE(0x8000, 0xbfff) AM_RAM         // main RAM
139    AM_RANGE(0xc000, 0xdfff) AM_RAM         // expansion RAM
87140   AM_RANGE(0xe100, 0xe100) AM_DEVREADWRITE("acia6850", acia6850_device, status_read, control_write)
88141   AM_RANGE(0xe101, 0xe101) AM_DEVREADWRITE("acia6850", acia6850_device, data_read, data_write)
89142   AM_RANGE(0xe200, 0xe2ff) AM_DEVREADWRITE("via6522", via6522_device, read, write)
90   AM_RANGE(0xe800, 0xe800) AM_DEVREADWRITE_LEGACY("wd177x", wd17xx_status_r,wd17xx_command_w)
91   AM_RANGE(0xe801, 0xe801) AM_DEVREADWRITE_LEGACY("wd177x", wd17xx_track_r,wd17xx_track_w)
92   AM_RANGE(0xe802, 0xe802) AM_DEVREADWRITE_LEGACY("wd177x", wd17xx_sector_r,wd17xx_sector_w)
93   AM_RANGE(0xe803, 0xe803) AM_DEVREADWRITE_LEGACY("wd177x", wd17xx_data_r,wd17xx_data_w)
94//  AM_RANGE(0xec00, 0xecef) AM_DEVREADWRITE("es5503", es5503_device, read, write)
143   AM_RANGE(0xe800, 0xe803) AM_DEVREADWRITE("wd1772", wd1772_t, read, write)
144    AM_RANGE(0xec00, 0xecef) AM_DEVREADWRITE("es5503", es5503_device, read, write)
95145   AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION("osrom", 0)
96146ADDRESS_MAP_END
97147
r15473r15474
192242   DEVCB_CPU_INPUT_LINE("maincpu", M6809_FIRQ_LINE)
193243};
194244
195static LEGACY_FLOPPY_OPTIONS_START(mirage)
196   LEGACY_FLOPPY_OPTION(mirage, "img", "Mirage disk image", basicdsk_identify_default, basicdsk_construct_default, NULL,
197      HEADS([1])
198      TRACKS([80])
199      SECTORS([5])
200      SECTOR_LENGTH([512])
201      FIRST_SECTOR_ID([0]))
202LEGACY_FLOPPY_OPTIONS_END
203
204static const floppy_interface mirage_floppy_interface =
205{
206   DEVCB_NULL,
207   DEVCB_NULL,
208   DEVCB_NULL,
209   DEVCB_NULL,
210   DEVCB_NULL,
211   FLOPPY_STANDARD_3_5_DSDD,
212   LEGACY_FLOPPY_OPTIONS_NAME(mirage),
213   NULL,
214   NULL
215};
216
217const wd17xx_interface mirage_wd17xx_interface =
218{
219   DEVCB_NULL,         // dden
220   DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_NMI),   // intrq
221   DEVCB_NULL,         // drq
222   {FLOPPY_0, NULL, NULL, NULL}
223};
224
225245static MACHINE_CONFIG_START( mirage, mirage_state )
226246   MCFG_CPU_ADD("maincpu", M6809E, 4000000)
227247   MCFG_CPU_PROGRAM_MAP(mirage_map)
r15473r15474
242262
243263   MCFG_ACIA6850_ADD("acia6850", mirage_acia6850_interface)
244264
245   MCFG_WD1770_ADD("wd177x", mirage_wd17xx_interface )
246   MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(mirage_floppy_interface)
265    MCFG_WD1772x_ADD("wd1772", 8000000)
266   MCFG_FLOPPY_DRIVE_ADD("fd0", ensoniq_floppies, "35dd", 0, mirage_state::floppy_formats)
247267MACHINE_CONFIG_END
248268
249269static INPUT_PORTS_START( mirage )
r15473r15474
256276   ROM_REGION(0x20000, "es5503", ROMREGION_ERASE)
257277ROM_END
258278
259CONS( 1984, enmirage, 0, 0, mirage, mirage, 0, "Ensoniq", "Ensoniq Mirage", GAME_NOT_WORKING )
279static DRIVER_INIT(mirage)
280{
281    mirage_state *state = machine.driver_data<mirage_state>();
260282
283    floppy_connector *con = machine.device<floppy_connector>("fd0");
284   floppy_image_device *floppy = con ? con->get_device() : 0;
285    if (floppy)
286    {
287        state->m_fdc->set_floppy(floppy);
288        state->m_fdc->setup_intrq_cb(wd1772_t::line_cb(FUNC(mirage_state::fdc_intrq_w), state));
289
290        floppy->ss_w(0);
291    }
292}
293
294CONS( 1984, enmirage, 0, 0, mirage, mirage, mirage, "Ensoniq", "Ensoniq Mirage", GAME_NOT_WORKING )
295

Previous 15994 Revisions Next


© 1998-2018 The MESS Team