mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-24 12:30:17 +00:00
Adds superficial support for MSX .DSK.
In the sense that the file format itself is properly parsed, but the MSX doesn't actually yet have disk hardware.
This commit is contained in:
parent
5d0832613f
commit
999a0c22d4
@ -591,6 +591,8 @@
|
|||||||
4BEA525E1DF33323007E74F2 /* Tape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BEA525D1DF33323007E74F2 /* Tape.cpp */; };
|
4BEA525E1DF33323007E74F2 /* Tape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BEA525D1DF33323007E74F2 /* Tape.cpp */; };
|
||||||
4BEA52631DF339D7007E74F2 /* SoundGenerator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BEA52611DF339D7007E74F2 /* SoundGenerator.cpp */; };
|
4BEA52631DF339D7007E74F2 /* SoundGenerator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BEA52611DF339D7007E74F2 /* SoundGenerator.cpp */; };
|
||||||
4BEA52661DF3472B007E74F2 /* TIASound.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BEA52641DF3472B007E74F2 /* TIASound.cpp */; };
|
4BEA52661DF3472B007E74F2 /* TIASound.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BEA52641DF3472B007E74F2 /* TIASound.cpp */; };
|
||||||
|
4BEBFB4D2002C4BF000708CC /* MSXDSK.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BEBFB4B2002C4BF000708CC /* MSXDSK.cpp */; };
|
||||||
|
4BEBFB4E2002C4BF000708CC /* MSXDSK.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BEBFB4B2002C4BF000708CC /* MSXDSK.cpp */; };
|
||||||
4BEE0A6F1D72496600532C7B /* Cartridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BEE0A6A1D72496600532C7B /* Cartridge.cpp */; };
|
4BEE0A6F1D72496600532C7B /* Cartridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BEE0A6A1D72496600532C7B /* Cartridge.cpp */; };
|
||||||
4BEE0A701D72496600532C7B /* PRG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BEE0A6D1D72496600532C7B /* PRG.cpp */; };
|
4BEE0A701D72496600532C7B /* PRG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BEE0A6D1D72496600532C7B /* PRG.cpp */; };
|
||||||
4BEF6AAA1D35CE9E00E73575 /* DigitalPhaseLockedLoopBridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BEF6AA91D35CE9E00E73575 /* DigitalPhaseLockedLoopBridge.mm */; };
|
4BEF6AAA1D35CE9E00E73575 /* DigitalPhaseLockedLoopBridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BEF6AA91D35CE9E00E73575 /* DigitalPhaseLockedLoopBridge.mm */; };
|
||||||
@ -1308,6 +1310,8 @@
|
|||||||
4BEAC08C1E7E0DF800EE56B2 /* Unpaged.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Unpaged.hpp; sourceTree = "<group>"; };
|
4BEAC08C1E7E0DF800EE56B2 /* Unpaged.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Unpaged.hpp; sourceTree = "<group>"; };
|
||||||
4BEAC08D1E7E0E1A00EE56B2 /* Bus.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Bus.hpp; sourceTree = "<group>"; };
|
4BEAC08D1E7E0E1A00EE56B2 /* Bus.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Bus.hpp; sourceTree = "<group>"; };
|
||||||
4BEAC08E1E7E110500EE56B2 /* Pitfall2.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Pitfall2.hpp; sourceTree = "<group>"; };
|
4BEAC08E1E7E110500EE56B2 /* Pitfall2.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Pitfall2.hpp; sourceTree = "<group>"; };
|
||||||
|
4BEBFB4B2002C4BF000708CC /* MSXDSK.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MSXDSK.cpp; sourceTree = "<group>"; };
|
||||||
|
4BEBFB4C2002C4BF000708CC /* MSXDSK.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = MSXDSK.hpp; sourceTree = "<group>"; };
|
||||||
4BEE0A6A1D72496600532C7B /* Cartridge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Cartridge.cpp; sourceTree = "<group>"; };
|
4BEE0A6A1D72496600532C7B /* Cartridge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Cartridge.cpp; sourceTree = "<group>"; };
|
||||||
4BEE0A6B1D72496600532C7B /* Cartridge.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Cartridge.hpp; sourceTree = "<group>"; };
|
4BEE0A6B1D72496600532C7B /* Cartridge.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Cartridge.hpp; sourceTree = "<group>"; };
|
||||||
4BEE0A6D1D72496600532C7B /* PRG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PRG.cpp; sourceTree = "<group>"; };
|
4BEE0A6D1D72496600532C7B /* PRG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PRG.cpp; sourceTree = "<group>"; };
|
||||||
@ -1776,20 +1780,22 @@
|
|||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
4B45188D1F75FD1B00926311 /* AcornADF.cpp */,
|
4B45188D1F75FD1B00926311 /* AcornADF.cpp */,
|
||||||
4B45188E1F75FD1B00926311 /* AcornADF.hpp */,
|
|
||||||
4B45188F1F75FD1B00926311 /* CPCDSK.cpp */,
|
4B45188F1F75FD1B00926311 /* CPCDSK.cpp */,
|
||||||
4B4518901F75FD1B00926311 /* CPCDSK.hpp */,
|
|
||||||
4B4518911F75FD1B00926311 /* D64.cpp */,
|
4B4518911F75FD1B00926311 /* D64.cpp */,
|
||||||
4B4518921F75FD1B00926311 /* D64.hpp */,
|
|
||||||
4B4518931F75FD1B00926311 /* G64.cpp */,
|
4B4518931F75FD1B00926311 /* G64.cpp */,
|
||||||
4B4518941F75FD1B00926311 /* G64.hpp */,
|
|
||||||
4B4518951F75FD1B00926311 /* HFE.cpp */,
|
4B4518951F75FD1B00926311 /* HFE.cpp */,
|
||||||
4B4518961F75FD1B00926311 /* HFE.hpp */,
|
|
||||||
4B58601C1F806AB200AEE2E3 /* MFMSectorDump.cpp */,
|
4B58601C1F806AB200AEE2E3 /* MFMSectorDump.cpp */,
|
||||||
4B58601D1F806AB200AEE2E3 /* MFMSectorDump.hpp */,
|
4BEBFB4B2002C4BF000708CC /* MSXDSK.cpp */,
|
||||||
4B4518971F75FD1B00926311 /* OricMFMDSK.cpp */,
|
4B4518971F75FD1B00926311 /* OricMFMDSK.cpp */,
|
||||||
4B4518981F75FD1B00926311 /* OricMFMDSK.hpp */,
|
|
||||||
4B4518991F75FD1B00926311 /* SSD.cpp */,
|
4B4518991F75FD1B00926311 /* SSD.cpp */,
|
||||||
|
4B45188E1F75FD1B00926311 /* AcornADF.hpp */,
|
||||||
|
4B4518901F75FD1B00926311 /* CPCDSK.hpp */,
|
||||||
|
4B4518921F75FD1B00926311 /* D64.hpp */,
|
||||||
|
4B4518941F75FD1B00926311 /* G64.hpp */,
|
||||||
|
4B4518961F75FD1B00926311 /* HFE.hpp */,
|
||||||
|
4B58601D1F806AB200AEE2E3 /* MFMSectorDump.hpp */,
|
||||||
|
4BEBFB4C2002C4BF000708CC /* MSXDSK.hpp */,
|
||||||
|
4B4518981F75FD1B00926311 /* OricMFMDSK.hpp */,
|
||||||
4B45189A1F75FD1B00926311 /* SSD.hpp */,
|
4B45189A1F75FD1B00926311 /* SSD.hpp */,
|
||||||
4BFDD7891F7F2DB4008579B9 /* Utility */,
|
4BFDD7891F7F2DB4008579B9 /* Utility */,
|
||||||
);
|
);
|
||||||
@ -3349,6 +3355,7 @@
|
|||||||
4B055AED1FAE9BA20060FFFF /* Z80Storage.cpp in Sources */,
|
4B055AED1FAE9BA20060FFFF /* Z80Storage.cpp in Sources */,
|
||||||
4B055AD11FAE9B030060FFFF /* Video.cpp in Sources */,
|
4B055AD11FAE9B030060FFFF /* Video.cpp in Sources */,
|
||||||
4B055AA21FAE85DA0060FFFF /* SSD.cpp in Sources */,
|
4B055AA21FAE85DA0060FFFF /* SSD.cpp in Sources */,
|
||||||
|
4BEBFB4E2002C4BF000708CC /* MSXDSK.cpp in Sources */,
|
||||||
4B055ADD1FAE9B460060FFFF /* i8272.cpp in Sources */,
|
4B055ADD1FAE9B460060FFFF /* i8272.cpp in Sources */,
|
||||||
4B055AC51FAE9AEE0060FFFF /* Atari2600.cpp in Sources */,
|
4B055AC51FAE9AEE0060FFFF /* Atari2600.cpp in Sources */,
|
||||||
4B055A9C1FAE85DA0060FFFF /* CPCDSK.cpp in Sources */,
|
4B055A9C1FAE85DA0060FFFF /* CPCDSK.cpp in Sources */,
|
||||||
@ -3542,6 +3549,7 @@
|
|||||||
4BCA6CC81D9DD9F000C2D7B2 /* CommodoreROM.cpp in Sources */,
|
4BCA6CC81D9DD9F000C2D7B2 /* CommodoreROM.cpp in Sources */,
|
||||||
4BA22B071D8817CE0008C640 /* Disk.cpp in Sources */,
|
4BA22B071D8817CE0008C640 /* Disk.cpp in Sources */,
|
||||||
4BEA52661DF3472B007E74F2 /* TIASound.cpp in Sources */,
|
4BEA52661DF3472B007E74F2 /* TIASound.cpp in Sources */,
|
||||||
|
4BEBFB4D2002C4BF000708CC /* MSXDSK.cpp in Sources */,
|
||||||
4BBFBB6C1EE8401E00C01E7A /* ZX8081.cpp in Sources */,
|
4BBFBB6C1EE8401E00C01E7A /* ZX8081.cpp in Sources */,
|
||||||
4B83348A1F5DB94B0097E338 /* IRQDelegatePortHandler.cpp in Sources */,
|
4B83348A1F5DB94B0097E338 /* IRQDelegatePortHandler.cpp in Sources */,
|
||||||
4B7136891F78725F008B8ED9 /* Shifter.cpp in Sources */,
|
4B7136891F78725F008B8ED9 /* Shifter.cpp in Sources */,
|
||||||
|
@ -3,5 +3,6 @@ ROMs for the MSX go here; the copyright status of these is uncertain so they hav
|
|||||||
Expected files:
|
Expected files:
|
||||||
|
|
||||||
msx.rom
|
msx.rom
|
||||||
|
disk.rom
|
||||||
|
|
||||||
These names match those offered for download at http://fms.komkon.org/fMSX/ (albeit in lowercase), and the emulator has been tested against those images.
|
These names match those offered for download at http://fms.komkon.org/fMSX/ (albeit in lowercase), and the emulator has been tested against those images.
|
@ -213,6 +213,9 @@ void StaticAnalyser::MSX::AddTargets(const Media &media, std::list<Target> &dest
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Blindly accept disks for now.
|
||||||
|
target.media.disks = media.disks;
|
||||||
|
|
||||||
if(!target.media.empty()) {
|
if(!target.media.empty()) {
|
||||||
target.machine = Target::MSX;
|
target.machine = Target::MSX;
|
||||||
target.probability = 1.0;
|
target.probability = 1.0;
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include "../Storage/Disk/DiskImage/Formats/D64.hpp"
|
#include "../Storage/Disk/DiskImage/Formats/D64.hpp"
|
||||||
#include "../Storage/Disk/DiskImage/Formats/G64.hpp"
|
#include "../Storage/Disk/DiskImage/Formats/G64.hpp"
|
||||||
#include "../Storage/Disk/DiskImage/Formats/HFE.hpp"
|
#include "../Storage/Disk/DiskImage/Formats/HFE.hpp"
|
||||||
|
#include "../Storage/Disk/DiskImage/Formats/MSXDSK.hpp"
|
||||||
#include "../Storage/Disk/DiskImage/Formats/OricMFMDSK.hpp"
|
#include "../Storage/Disk/DiskImage/Formats/OricMFMDSK.hpp"
|
||||||
#include "../Storage/Disk/DiskImage/Formats/SSD.hpp"
|
#include "../Storage/Disk/DiskImage/Formats/SSD.hpp"
|
||||||
|
|
||||||
@ -91,6 +92,7 @@ static Media GetMediaAndPlatforms(const char *file_name, TargetPlatform::IntType
|
|||||||
Format("d64", result.disks, Disk::DiskImageHolder<Storage::Disk::D64>, TargetPlatform::Commodore) // D64
|
Format("d64", result.disks, Disk::DiskImageHolder<Storage::Disk::D64>, TargetPlatform::Commodore) // D64
|
||||||
Format("dsd", result.disks, Disk::DiskImageHolder<Storage::Disk::SSD>, TargetPlatform::Acorn) // DSD
|
Format("dsd", result.disks, Disk::DiskImageHolder<Storage::Disk::SSD>, TargetPlatform::Acorn) // DSD
|
||||||
Format("dsk", result.disks, Disk::DiskImageHolder<Storage::Disk::CPCDSK>, TargetPlatform::AmstradCPC) // DSK (Amstrad CPC)
|
Format("dsk", result.disks, Disk::DiskImageHolder<Storage::Disk::CPCDSK>, TargetPlatform::AmstradCPC) // DSK (Amstrad CPC)
|
||||||
|
Format("dsk", result.disks, Disk::DiskImageHolder<Storage::Disk::MSXDSK>, TargetPlatform::MSX) // DSK (MSX)
|
||||||
Format("dsk", result.disks, Disk::DiskImageHolder<Storage::Disk::OricMFMDSK>, TargetPlatform::Oric) // DSK (Oric)
|
Format("dsk", result.disks, Disk::DiskImageHolder<Storage::Disk::OricMFMDSK>, TargetPlatform::Oric) // DSK (Oric)
|
||||||
Format("g64", result.disks, Disk::DiskImageHolder<Storage::Disk::G64>, TargetPlatform::Commodore) // G64
|
Format("g64", result.disks, Disk::DiskImageHolder<Storage::Disk::G64>, TargetPlatform::Commodore) // G64
|
||||||
Format("hfe", result.disks, Disk::DiskImageHolder<Storage::Disk::HFE>, TargetPlatform::AmstradCPC) // HFE (TODO: plus other target platforms)
|
Format("hfe", result.disks, Disk::DiskImageHolder<Storage::Disk::HFE>, TargetPlatform::AmstradCPC) // HFE (TODO: plus other target platforms)
|
||||||
|
59
Storage/Disk/DiskImage/Formats/MSXDSK.cpp
Normal file
59
Storage/Disk/DiskImage/Formats/MSXDSK.cpp
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
//
|
||||||
|
// MSXDSK.cpp
|
||||||
|
// Clock Signal
|
||||||
|
//
|
||||||
|
// Created by Thomas Harte on 07/01/2018.
|
||||||
|
// Copyright © 2018 Thomas Harte. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "MSXDSK.hpp"
|
||||||
|
|
||||||
|
#include "Utility/ImplicitSectors.hpp"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
static const int sectors_per_track = 9;
|
||||||
|
static const int sector_size = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
using namespace Storage::Disk;
|
||||||
|
|
||||||
|
MSXDSK::MSXDSK(const char *file_name) :
|
||||||
|
MFMSectorDump(file_name) {
|
||||||
|
// The only sanity check here is whether a sensible
|
||||||
|
// geometry can be guessed.
|
||||||
|
off_t file_size = file_.stats().st_size;
|
||||||
|
const off_t track_size = 512*9;
|
||||||
|
|
||||||
|
// Throw if there would seemingly be an incomplete track.
|
||||||
|
if(file_size % track_size) throw ErrorNotMSXDSK;
|
||||||
|
|
||||||
|
track_count_ = static_cast<int>(file_size / track_size);
|
||||||
|
head_count_ = 1;
|
||||||
|
|
||||||
|
// Throw if too large or too small or too large for single sided and
|
||||||
|
// clearly not double sided.
|
||||||
|
if(track_count_ < 40) throw ErrorNotMSXDSK;
|
||||||
|
if(track_count_ > 82*2) throw ErrorNotMSXDSK;
|
||||||
|
if(track_count_ > 82 && track_count_&1) throw ErrorNotMSXDSK;
|
||||||
|
|
||||||
|
// The below effectively prefers the idea of a single-sided 80-track disk
|
||||||
|
// to a double-sided 40-track disk. Emulators have to guess.
|
||||||
|
if(track_count_ > 82) {
|
||||||
|
track_count_ /= 2;
|
||||||
|
head_count_ = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
set_geometry(sectors_per_track, sector_size, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
int MSXDSK::get_head_position_count() {
|
||||||
|
return track_count_;
|
||||||
|
}
|
||||||
|
|
||||||
|
int MSXDSK::get_head_count() {
|
||||||
|
return head_count_;
|
||||||
|
}
|
||||||
|
|
||||||
|
long MSXDSK::get_file_offset_for_position(Track::Address address) {
|
||||||
|
return (address.position + address.head*track_count_) * 512 * 9;
|
||||||
|
}
|
42
Storage/Disk/DiskImage/Formats/MSXDSK.hpp
Normal file
42
Storage/Disk/DiskImage/Formats/MSXDSK.hpp
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
//
|
||||||
|
// MSXDSK.hpp
|
||||||
|
// Clock Signal
|
||||||
|
//
|
||||||
|
// Created by Thomas Harte on 07/01/2018.
|
||||||
|
// Copyright © 2018 Thomas Harte. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef MSXDSK_hpp
|
||||||
|
#define MSXDSK_hpp
|
||||||
|
|
||||||
|
#include "MFMSectorDump.hpp"
|
||||||
|
|
||||||
|
namespace Storage {
|
||||||
|
namespace Disk {
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Provides a @c Disk containing an MSX-style disk image:
|
||||||
|
a sector dump of appropriate proportions.
|
||||||
|
*/
|
||||||
|
class MSXDSK: public MFMSectorDump {
|
||||||
|
public:
|
||||||
|
MSXDSK(const char *file_name);
|
||||||
|
|
||||||
|
enum {
|
||||||
|
ErrorNotMSXDSK,
|
||||||
|
};
|
||||||
|
|
||||||
|
int get_head_position_count() override;
|
||||||
|
int get_head_count() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
long get_file_offset_for_position(Track::Address address) override;
|
||||||
|
|
||||||
|
int head_count_;
|
||||||
|
int track_count_;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* MSXDSK_hpp */
|
@ -16,7 +16,7 @@ namespace Storage {
|
|||||||
namespace Disk {
|
namespace Disk {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Provies a @c Disk containing an Oric MFM-stype disk image — a stream of the MFM data bits with clocks omitted.
|
Provides a @c Disk containing an Oric MFM-stype disk image — a stream of the MFM data bits with clocks omitted.
|
||||||
*/
|
*/
|
||||||
class OricMFMDSK: public DiskImage {
|
class OricMFMDSK: public DiskImage {
|
||||||
public:
|
public:
|
||||||
@ -31,7 +31,7 @@ class OricMFMDSK: public DiskImage {
|
|||||||
ErrorNotOricMFMDSK,
|
ErrorNotOricMFMDSK,
|
||||||
};
|
};
|
||||||
|
|
||||||
// implemented to satisfy @c Disk
|
// implemented to satisfy @c DiskImage
|
||||||
int get_head_position_count() override;
|
int get_head_position_count() override;
|
||||||
int get_head_count() override;
|
int get_head_count() override;
|
||||||
bool get_is_read_only() override;
|
bool get_is_read_only() override;
|
||||||
|
Loading…
Reference in New Issue
Block a user