mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-18 01:07:58 +00:00
Ensures prefixes are MFM encoded and decoded.
This commit is contained in:
parent
2b4c924399
commit
f81a7f0faf
@ -67,7 +67,7 @@
|
|||||||
</Testables>
|
</Testables>
|
||||||
</TestAction>
|
</TestAction>
|
||||||
<LaunchAction
|
<LaunchAction
|
||||||
buildConfiguration = "Debug"
|
buildConfiguration = "Release"
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
enableASanStackUseAfterReturn = "YES"
|
enableASanStackUseAfterReturn = "YES"
|
||||||
|
@ -56,9 +56,15 @@ class TrackConstructor {
|
|||||||
std::vector<uint8_t> result;
|
std::vector<uint8_t> result;
|
||||||
result.reserve(size_t(end - begin) + prefix.size());
|
result.reserve(size_t(end - begin) + prefix.size());
|
||||||
|
|
||||||
// Encode as MFM.
|
|
||||||
PCMSegment segment;
|
PCMSegment segment;
|
||||||
std::unique_ptr<Storage::Encodings::MFM::Encoder> encoder = Storage::Encodings::MFM::GetMFMEncoder(segment.data);
|
std::unique_ptr<Storage::Encodings::MFM::Encoder> encoder = Storage::Encodings::MFM::GetMFMEncoder(segment.data);
|
||||||
|
|
||||||
|
// Encode prefix.
|
||||||
|
for(auto c: prefix) {
|
||||||
|
encoder->add_byte(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Encode body.
|
||||||
while(begin != end) {
|
while(begin != end) {
|
||||||
encoder->add_byte(*begin);
|
encoder->add_byte(*begin);
|
||||||
++begin;
|
++begin;
|
||||||
@ -69,9 +75,6 @@ class TrackConstructor {
|
|||||||
Shifter shifter;
|
Shifter shifter;
|
||||||
shifter.set_should_obey_syncs(true);
|
shifter.set_should_obey_syncs(true);
|
||||||
|
|
||||||
// Add the prefix.
|
|
||||||
std::copy(prefix.begin(), prefix.end(), std::back_inserter(result));
|
|
||||||
|
|
||||||
// Add whatever comes from the track.
|
// Add whatever comes from the track.
|
||||||
for(auto bit: segment.data) {
|
for(auto bit: segment.data) {
|
||||||
shifter.add_input_bit(int(bit));
|
shifter.add_input_bit(int(bit));
|
||||||
@ -243,6 +246,10 @@ std::shared_ptr<::Storage::Disk::Track> STX::get_track_at_position(::Storage::Di
|
|||||||
const int track_index = (address.head * 0x80) + address.position.as_int();
|
const int track_index = (address.head * 0x80) + address.position.as_int();
|
||||||
if(!offset_by_track_[track_index]) return nullptr;
|
if(!offset_by_track_[track_index]) return nullptr;
|
||||||
|
|
||||||
|
if(track_index == 41) {
|
||||||
|
printf("Y\n");
|
||||||
|
} else printf("N\n");
|
||||||
|
|
||||||
// Seek to the track (skipping the record size field).
|
// Seek to the track (skipping the record size field).
|
||||||
file_.seek(offset_by_track_[track_index] + 4, SEEK_SET);
|
file_.seek(offset_by_track_[track_index] + 4, SEEK_SET);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user