diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/emu/bus/a2bus/corvfdc02.c | 28 | ||||
-rw-r--r-- | src/emu/bus/a2bus/corvfdc02.h | 1 | ||||
-rw-r--r-- | src/lib/formats/concept_dsk.c | 155 | ||||
-rw-r--r-- | src/lib/formats/concept_dsk.h | 36 | ||||
-rw-r--r-- | src/lib/lib.mak | 1 |
5 files changed, 216 insertions, 5 deletions
diff --git a/src/emu/bus/a2bus/corvfdc02.c b/src/emu/bus/a2bus/corvfdc02.c index ae698e149a9..46bca9d8f23 100644 --- a/src/emu/bus/a2bus/corvfdc02.c +++ b/src/emu/bus/a2bus/corvfdc02.c @@ -5,11 +5,13 @@ Implemention of the Corvus Systems CORVUS02 floppy controller aka the "Buffered Floppy Controller" - Boot PROM 0.8 says 8" DSDD or 5.25" DSDD + Boot PROM 0.8 says 8" SSDD or 5.25" DSDD; we stick with 5.25" here + and let the FDC01 handle 8". *********************************************************************/ #include "corvfdc02.h" +#include "formats/concept_dsk.h" /*************************************************************************** PARAMETERS @@ -25,11 +27,11 @@ const device_type A2BUS_CORVFDC02 = &device_creator<a2bus_corvfdc02_device>; #define FDC02_FDC_TAG "fdc02_fdc" FLOPPY_FORMATS_MEMBER( a2bus_corvfdc02_device::corv_floppy_formats ) + FLOPPY_CONCEPT_525DSDD_FORMAT, FLOPPY_IMD_FORMAT FLOPPY_FORMATS_END static SLOT_INTERFACE_START( corv_floppies ) - SLOT_INTERFACE( "8dsdd", FLOPPY_8_DSDD ) SLOT_INTERFACE( "525dsqd", FLOPPY_525_QD ) SLOT_INTERFACE_END @@ -121,6 +123,7 @@ void a2bus_corvfdc02_device::device_reset() m_fdc_local_status = 2; m_fdc_local_command = 0; m_curfloppy = NULL; + m_in_drq = false; } /*------------------------------------------------- @@ -142,7 +145,7 @@ UINT8 a2bus_corvfdc02_device::read_c0nx(address_space &space, UINT8 offset) case 3: // printf("Read buffer @ %x = %02x\n", m_bufptr, m_buffer[m_bufptr]); - return m_buffer[m_bufptr]; + return m_buffer[m_bufptr--]; case 4: // local status if (m_curfloppy) @@ -182,7 +185,7 @@ void a2bus_corvfdc02_device::write_c0nx(address_space &space, UINT8 offset, UINT break; case 3: // buffer write -// printf("%02x to buffer @ %x\n", data, m_bufptr); +// printf("%02x to buffer[%x]\n", data, m_bufptr); m_buffer[m_bufptr--] = data; break; @@ -261,6 +264,21 @@ WRITE_LINE_MEMBER(a2bus_corvfdc02_device::intrq_w) WRITE_LINE_MEMBER(a2bus_corvfdc02_device::drq_w) { -// printf("DRQ: %d\n", state); + if (state) + { + // pseudo-DMA direction? + if (m_fdc_local_command & 0x40) + { + m_buffer[m_bufptr] = m_fdc->dma_r(); +// printf("DMA %02x to buffer[%x]\n", m_buffer[m_bufptr], m_bufptr); + m_bufptr--; + m_bufptr &= 0x1ff; + } + else + { + m_fdc->dma_w(m_buffer[m_bufptr++]); + m_bufptr &= 0x1ff; + } + } } diff --git a/src/emu/bus/a2bus/corvfdc02.h b/src/emu/bus/a2bus/corvfdc02.h index 40988d6ac1f..2aa375fdf46 100644 --- a/src/emu/bus/a2bus/corvfdc02.h +++ b/src/emu/bus/a2bus/corvfdc02.h @@ -57,6 +57,7 @@ private: UINT16 m_bufptr; UINT8 m_buffer[2048]; // 1x6116 SRAM floppy_image_device *m_curfloppy; + bool m_in_drq; }; // device type definition diff --git a/src/lib/formats/concept_dsk.c b/src/lib/formats/concept_dsk.c new file mode 100644 index 00000000000..3c742248043 --- /dev/null +++ b/src/lib/formats/concept_dsk.c @@ -0,0 +1,155 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert, R. Belmont +/********************************************************************* + + formats/concept_dsk.c + + Formats for Corvus Concept + + 5.25" DSDD is PC MFM, 77 tracks, double-sided, with 9 sectors per track + +*********************************************************************/ + +#include "emu.h" +#include "flopimg.h" +#include "formats/concept_dsk.h" + +/* 9 sectors / track, 512 bytes per sector */ +const floppy_image_format_t::desc_e cc525dsdd_format::cc_9_desc[] = { + { MFM, 0x4e, 80 }, + { MFM, 0x00, 12 }, + { RAW, 0x5224, 3 }, + { MFM, 0xfc, 1 }, + { MFM, 0x4e, 50 }, + { MFM, 0x00, 12 }, + { SECTOR_LOOP_START, 1, 9 }, + { CRC_CCITT_START, 1 }, + { RAW, 0x4489, 3 }, + { MFM, 0xfe, 1 }, + { TRACK_ID }, + { HEAD_ID }, + { SECTOR_ID }, + { SIZE_ID }, + { CRC_END, 1 }, + { CRC, 1 }, + { MFM, 0x4e, 22 }, + { MFM, 0x00, 12 }, + { CRC_CCITT_START, 2 }, + { RAW, 0x4489, 3 }, + { MFM, 0xfb, 1 }, + { SECTOR_DATA, -1 }, + { CRC_END, 2 }, + { CRC, 2 }, + { MFM, 0x4e, 84 }, + { MFM, 0x00, 12 }, + { SECTOR_LOOP_END }, + { MFM, 0x4e, 170 }, + { END } +}; + +cc525dsdd_format::cc525dsdd_format() +{ +} + +const char *cc525dsdd_format::name() const +{ + return "img"; +} + +const char *cc525dsdd_format::description() const +{ + return "Corvus Concept 5.25\" DSDD floppy disk image"; +} + +const char *cc525dsdd_format::extensions() const +{ + return "img"; +} + +bool cc525dsdd_format::supports_save() const +{ + return true; +} + +void cc525dsdd_format::find_size(io_generic *io, UINT8 &track_count, UINT8 &head_count, UINT8 §or_count) +{ + UINT64 size = io_generic_size(io); + + track_count = 77; + head_count = 2; + sector_count = 9; + + UINT32 expected_size = 512 * track_count*head_count*sector_count; + if (size == expected_size) + { + return; + } + + track_count = head_count = sector_count = 0; +} + +int cc525dsdd_format::identify(io_generic *io, UINT32 form_factor) +{ + UINT8 track_count, head_count, sector_count; + find_size(io, track_count, head_count, sector_count); + + if(track_count) + return 50; + return 0; +} + +bool cc525dsdd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image) +{ + UINT8 track_count, head_count, sector_count; + find_size(io, track_count, head_count, sector_count); + + UINT8 sectdata[10*512]; + desc_s sectors[10]; + for(int i=0; i<sector_count; i++) { + sectors[i+1].data = sectdata + 512*i; + sectors[i+1].size = 512; + sectors[i+1].sector_id = i+1; + } + + int track_size = sector_count*512; + for(int track=0; track < track_count; track++) { + for(int head=0; head < head_count; head++) { + io_generic_read(io, sectdata, (track*head_count + head)*track_size, track_size); + generate_track(cc_9_desc, track, head, sectors, sector_count, 100000, image); + } + } + + image->set_variant(floppy_image::DSDD); + + return true; +} + +bool cc525dsdd_format::save(io_generic *io, floppy_image *image) +{ + int track_count, head_count, sector_count; + get_geometry_mfm_pc(image, 2000, track_count, head_count, sector_count); + + if(track_count != 77) + track_count = 77; + + // Happens for a fully unformatted floppy + if(!head_count) + head_count = 2; + + if(sector_count != 9) + sector_count = 9; + + UINT8 sectdata[9*512]; + int track_size = sector_count*512; + + for(int track=0; track < track_count; track++) { + for(int head=0; head < head_count; head++) { + get_track_data_mfm_pc(track, head, image, 2000, 512, sector_count, sectdata); + io_generic_write(io, sectdata, (track*head_count + head)*track_size, track_size); + } + } + + return true; +} + +const floppy_format_type FLOPPY_CONCEPT_525DSDD_FORMAT = &floppy_image_format_creator<cc525dsdd_format>; diff --git a/src/lib/formats/concept_dsk.h b/src/lib/formats/concept_dsk.h new file mode 100644 index 00000000000..012d01cc7d1 --- /dev/null +++ b/src/lib/formats/concept_dsk.h @@ -0,0 +1,36 @@ +/********************************************************************* + + formats/concept_dsk.h + + Formats for Corvus Concept + +*********************************************************************/ + +#ifndef CONCEPT_DSK_H_ +#define CONCEPT_DSK_H_ + +#include "flopimg.h" + +class cc525dsdd_format : public floppy_image_format_t +{ +public: + cc525dsdd_format(); + + virtual int identify(io_generic *io, UINT32 form_factor); + virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image); + virtual bool save(io_generic *io, floppy_image *image); + + virtual const char *name() const; + virtual const char *description() const; + virtual const char *extensions() const; + virtual bool supports_save() const; + + static const desc_e cc_9_desc[]; + +private: + void find_size(io_generic *io, UINT8 &track_count, UINT8 &head_count, UINT8 §or_count); +}; + +extern const floppy_format_type FLOPPY_CONCEPT_525DSDD_FORMAT; + +#endif /* CONCEPT_DSK_H_ */ diff --git a/src/lib/lib.mak b/src/lib/lib.mak index e4eea928272..23d1b848334 100644 --- a/src/lib/lib.mak +++ b/src/lib/lib.mak @@ -126,6 +126,7 @@ FORMATSOBJS = \ $(LIBOBJ)/formats/coco_cas.o \ $(LIBOBJ)/formats/coco_dsk.o \ $(LIBOBJ)/formats/comx35_dsk.o \ + $(LIBOBJ)/formats/concept_dsk.o \ $(LIBOBJ)/formats/coupedsk.o \ $(LIBOBJ)/formats/cpis_dsk.o \ $(LIBOBJ)/formats/cqm_dsk.o \ |