1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-25 18:30:07 +00:00

Starts building out some tests for Apple GCR encoding.

This commit is contained in:
Thomas Harte 2019-06-15 22:48:24 -04:00
parent 33f2664fe9
commit fe0dc4df88
4 changed files with 57 additions and 8 deletions

View File

@ -662,6 +662,8 @@
4BEE0A6F1D72496600532C7B /* Cartridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BEE0A6A1D72496600532C7B /* Cartridge.cpp */; };
4BEE0A701D72496600532C7B /* PRG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BEE0A6D1D72496600532C7B /* PRG.cpp */; };
4BEE149A227FC0EA00133682 /* IWM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BEE1498227FC0EA00133682 /* IWM.cpp */; };
4BEE1EC022B5E236000A26A6 /* MacGCRTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BEE1EBF22B5E236000A26A6 /* MacGCRTests.mm */; };
4BEE1EC122B5E2FD000A26A6 /* Encoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BD67DCE209BF27B00AB2146 /* Encoder.cpp */; };
4BEEE6BD20DC72EB003723BF /* CompositeOptions.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4BEEE6BB20DC72EA003723BF /* CompositeOptions.xib */; };
4BEF6AAA1D35CE9E00E73575 /* DigitalPhaseLockedLoopBridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BEF6AA91D35CE9E00E73575 /* DigitalPhaseLockedLoopBridge.mm */; };
4BEF6AAC1D35D1C400E73575 /* DPLLTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BEF6AAB1D35D1C400E73575 /* DPLLTests.swift */; };
@ -1488,6 +1490,7 @@
4BEE0A6E1D72496600532C7B /* PRG.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = PRG.hpp; sourceTree = "<group>"; };
4BEE1498227FC0EA00133682 /* IWM.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = IWM.cpp; sourceTree = "<group>"; };
4BEE1499227FC0EA00133682 /* IWM.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = IWM.hpp; sourceTree = "<group>"; };
4BEE1EBF22B5E236000A26A6 /* MacGCRTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MacGCRTests.mm; sourceTree = "<group>"; };
4BEEE6BC20DC72EA003723BF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = "Clock Signal/Base.lproj/CompositeOptions.xib"; sourceTree = SOURCE_ROOT; };
4BEF6AA81D35CE9E00E73575 /* DigitalPhaseLockedLoopBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DigitalPhaseLockedLoopBridge.h; sourceTree = "<group>"; };
4BEF6AA91D35CE9E00E73575 /* DigitalPhaseLockedLoopBridge.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DigitalPhaseLockedLoopBridge.mm; sourceTree = "<group>"; };
@ -2921,6 +2924,7 @@
4B924E981E74D22700B76AF1 /* AtariStaticAnalyserTests.mm */,
4BB2A9AE1E13367E001A5C23 /* CRCTests.mm */,
4BFF1D3C2235C3C100838EA1 /* EmuTOSTests.mm */,
4BEE1EBF22B5E236000A26A6 /* MacGCRTests.mm */,
4BA91E1C216D85BA00F79557 /* MasterSystemVDPTests.mm */,
4B98A0601FFADCDE00ADF63B /* MSXStaticAnalyserTests.mm */,
4B121F9A1E06293F00BFDA12 /* PCMSegmentEventSourceTests.mm */,
@ -4177,6 +4181,7 @@
4B92EACA1B7C112B00246143 /* 6502TimingTests.swift in Sources */,
4BB73EB71B587A5100552FC2 /* AllSuiteATests.swift in Sources */,
4B01A6881F22F0DB001FD6E3 /* Z80MemptrTests.swift in Sources */,
4BEE1EC122B5E2FD000A26A6 /* Encoder.cpp in Sources */,
4B121F9B1E06293F00BFDA12 /* PCMSegmentEventSourceTests.mm in Sources */,
4BD388882239E198002D14B5 /* 68000Tests.mm in Sources */,
4BA91E1D216D85BA00F79557 /* MasterSystemVDPTests.mm in Sources */,
@ -4194,6 +4199,7 @@
4BD4A8D01E077FD20020D856 /* PCMTrackTests.mm in Sources */,
4B049CDD1DA3C82F00322067 /* BCDTest.swift in Sources */,
4B1D08061E0F7A1100763741 /* TimeTests.mm in Sources */,
4BEE1EC022B5E236000A26A6 /* MacGCRTests.mm in Sources */,
4B08A2781EE39306008B7065 /* TestMachine.mm in Sources */,
4BFCA1271ECBE33200AC40C1 /* TestMachineZ80.mm in Sources */,
4B322E011F5A2990004EB04C /* Z80AllRAM.cpp in Sources */,

View File

@ -0,0 +1,43 @@
//
// MacGCRTests.mm
// Clock SignalTests
//
// Created by Thomas Harte on 15/06/2019.
// Copyright © 2019 Thomas Harte. All rights reserved.
//
#import <XCTest/XCTest.h>
#include "../../../Storage/Disk/Encodings/AppleGCR/Encoder.hpp"
@interface MacGCRTests : XCTestCase
@end
@implementation MacGCRTests {
}
- (void)testSector0Track0Side0 {
const auto header = Storage::Encodings::AppleGCR::Macintosh::header(0x22, 0, 0, false);
const std::vector<uint8_t> expected_mark = {
0xd5, 0xaa, 0x96,
0x96, 0x96, 0x96, 0xd9, 0xd9,
0xde, 0xaa, 0xeb
};
const auto mark_segment = Storage::Disk::PCMSegment(expected_mark);
XCTAssertEqual(mark_segment.data, header.data);
}
- (void)testSector9Track11Side1 {
const auto header = Storage::Encodings::AppleGCR::Macintosh::header(0x22, 11, 9, true);
const std::vector<uint8_t> expected_mark = {
0xd5, 0xaa, 0x96,
0xad, 0xab, 0xd6, 0xd9, 0x96,
0xde, 0xaa, 0xeb
};
const auto mark_segment = Storage::Disk::PCMSegment(expected_mark);
XCTAssertEqual(mark_segment.data, header.data);
}
@end

View File

@ -232,7 +232,7 @@ Storage::Disk::PCMSegment AppleGCR::Macintosh::header(uint8_t type, uint8_t trac
return Storage::Disk::PCMSegment(data);
}
Storage::Disk::PCMSegment AppleGCR::Macintosh::six_and_two_data(const uint8_t *source) {
Storage::Disk::PCMSegment AppleGCR::Macintosh::data(const uint8_t *source) {
std::vector<uint8_t> output(710);
int checksum[3] = {0, 0, 0};

View File

@ -42,13 +42,6 @@ Storage::Disk::PCMSegment header(uint8_t volume, uint8_t track, uint8_t sector);
namespace Macintosh {
/*!
Produces the data section of a Macintosh-style six-and-two format sector;
the segment returned will be 5680 bits long, encoding the first 524 bytes
from @c source.
*/
Storage::Disk::PCMSegment six_and_two_data(const uint8_t *source);
struct SectorSpan {
int start, length;
};
@ -59,6 +52,13 @@ struct SectorSpan {
*/
SectorSpan sectors_in_track(int track);
/*!
Produces the data section of a Macintosh-format sector;
the segment returned will be 5680 bits long, encoding the first 524 bytes
from @c source.
*/
Storage::Disk::PCMSegment data(const uint8_t *source);
/*!
Produces the Mac-standard header. This is the same
for both the 13- and 16-sector formats, and is 88 bits long.