mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-23 03:32:32 +00:00
Started sketching out a tape parser for ZX80 and '81 files. I think this'll help me to verify whether the .O input is working.
This commit is contained in:
parent
58312ea2b7
commit
60300851ea
@ -384,6 +384,7 @@
|
|||||||
4BBF99141C8FBA6F0075DAFB /* TextureBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBF99081C8FBA6F0075DAFB /* TextureBuilder.cpp */; };
|
4BBF99141C8FBA6F0075DAFB /* TextureBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBF99081C8FBA6F0075DAFB /* TextureBuilder.cpp */; };
|
||||||
4BBF99151C8FBA6F0075DAFB /* CRTOpenGL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBF990A1C8FBA6F0075DAFB /* CRTOpenGL.cpp */; };
|
4BBF99151C8FBA6F0075DAFB /* CRTOpenGL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBF990A1C8FBA6F0075DAFB /* CRTOpenGL.cpp */; };
|
||||||
4BBF99181C8FBA6F0075DAFB /* TextureTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBF99121C8FBA6F0075DAFB /* TextureTarget.cpp */; };
|
4BBF99181C8FBA6F0075DAFB /* TextureTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBF99121C8FBA6F0075DAFB /* TextureTarget.cpp */; };
|
||||||
|
4BBFBB6C1EE8401E00C01E7A /* ZX8081.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBFBB6A1EE8401E00C01E7A /* ZX8081.cpp */; };
|
||||||
4BC3B74F1CD194CC00F86E85 /* Shader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B74D1CD194CC00F86E85 /* Shader.cpp */; };
|
4BC3B74F1CD194CC00F86E85 /* Shader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B74D1CD194CC00F86E85 /* Shader.cpp */; };
|
||||||
4BC3B7521CD1956900F86E85 /* OutputShader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B7501CD1956900F86E85 /* OutputShader.cpp */; };
|
4BC3B7521CD1956900F86E85 /* OutputShader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B7501CD1956900F86E85 /* OutputShader.cpp */; };
|
||||||
4BC5E4921D7ED365008CF980 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC5E4901D7ED365008CF980 /* StaticAnalyser.cpp */; };
|
4BC5E4921D7ED365008CF980 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC5E4901D7ED365008CF980 /* StaticAnalyser.cpp */; };
|
||||||
@ -922,6 +923,8 @@
|
|||||||
4BBF99121C8FBA6F0075DAFB /* TextureTarget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextureTarget.cpp; sourceTree = "<group>"; };
|
4BBF99121C8FBA6F0075DAFB /* TextureTarget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextureTarget.cpp; sourceTree = "<group>"; };
|
||||||
4BBF99131C8FBA6F0075DAFB /* TextureTarget.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = TextureTarget.hpp; sourceTree = "<group>"; };
|
4BBF99131C8FBA6F0075DAFB /* TextureTarget.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = TextureTarget.hpp; sourceTree = "<group>"; };
|
||||||
4BBF99191C8FC2750075DAFB /* CRTTypes.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = CRTTypes.hpp; sourceTree = "<group>"; };
|
4BBF99191C8FC2750075DAFB /* CRTTypes.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = CRTTypes.hpp; sourceTree = "<group>"; };
|
||||||
|
4BBFBB6A1EE8401E00C01E7A /* ZX8081.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ZX8081.cpp; path = Parsers/ZX8081.cpp; sourceTree = "<group>"; };
|
||||||
|
4BBFBB6B1EE8401E00C01E7A /* ZX8081.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = ZX8081.hpp; path = Parsers/ZX8081.hpp; sourceTree = "<group>"; };
|
||||||
4BC3B74D1CD194CC00F86E85 /* Shader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Shader.cpp; sourceTree = "<group>"; };
|
4BC3B74D1CD194CC00F86E85 /* Shader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Shader.cpp; sourceTree = "<group>"; };
|
||||||
4BC3B74E1CD194CC00F86E85 /* Shader.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Shader.hpp; sourceTree = "<group>"; };
|
4BC3B74E1CD194CC00F86E85 /* Shader.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Shader.hpp; sourceTree = "<group>"; };
|
||||||
4BC3B7501CD1956900F86E85 /* OutputShader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OutputShader.cpp; sourceTree = "<group>"; };
|
4BC3B7501CD1956900F86E85 /* OutputShader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OutputShader.cpp; sourceTree = "<group>"; };
|
||||||
@ -1415,6 +1418,8 @@
|
|||||||
4B8805F31DCFD22A003085B1 /* Commodore.hpp */,
|
4B8805F31DCFD22A003085B1 /* Commodore.hpp */,
|
||||||
4B8805F91DCFF807003085B1 /* Oric.cpp */,
|
4B8805F91DCFF807003085B1 /* Oric.cpp */,
|
||||||
4B8805FA1DCFF807003085B1 /* Oric.hpp */,
|
4B8805FA1DCFF807003085B1 /* Oric.hpp */,
|
||||||
|
4BBFBB6A1EE8401E00C01E7A /* ZX8081.cpp */,
|
||||||
|
4BBFBB6B1EE8401E00C01E7A /* ZX8081.hpp */,
|
||||||
);
|
);
|
||||||
name = Parsers;
|
name = Parsers;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -2627,6 +2632,7 @@
|
|||||||
4BCA6CC81D9DD9F000C2D7B2 /* CommodoreROM.cpp in Sources */,
|
4BCA6CC81D9DD9F000C2D7B2 /* CommodoreROM.cpp in Sources */,
|
||||||
4BA22B071D8817CE0008C640 /* Disk.cpp in Sources */,
|
4BA22B071D8817CE0008C640 /* Disk.cpp in Sources */,
|
||||||
4BEA52661DF3472B007E74F2 /* Speaker.cpp in Sources */,
|
4BEA52661DF3472B007E74F2 /* Speaker.cpp in Sources */,
|
||||||
|
4BBFBB6C1EE8401E00C01E7A /* ZX8081.cpp in Sources */,
|
||||||
4BC3B7521CD1956900F86E85 /* OutputShader.cpp in Sources */,
|
4BC3B7521CD1956900F86E85 /* OutputShader.cpp in Sources */,
|
||||||
4B4C83701D4F623200CD541F /* D64.cpp in Sources */,
|
4B4C83701D4F623200CD541F /* D64.cpp in Sources */,
|
||||||
4B5073071DDD3B9400C48FBD /* ArrayBuilder.cpp in Sources */,
|
4B5073071DDD3B9400C48FBD /* ArrayBuilder.cpp in Sources */,
|
||||||
|
9
Storage/Tape/Parsers/ZX8081.cpp
Normal file
9
Storage/Tape/Parsers/ZX8081.cpp
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
//
|
||||||
|
// ZX8081.cpp
|
||||||
|
// Clock Signal
|
||||||
|
//
|
||||||
|
// Created by Thomas Harte on 07/06/2017.
|
||||||
|
// Copyright © 2017 Thomas Harte. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "ZX8081.hpp"
|
62
Storage/Tape/Parsers/ZX8081.hpp
Normal file
62
Storage/Tape/Parsers/ZX8081.hpp
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
//
|
||||||
|
// ZX8081.hpp
|
||||||
|
// Clock Signal
|
||||||
|
//
|
||||||
|
// Created by Thomas Harte on 07/06/2017.
|
||||||
|
// Copyright © 2017 Thomas Harte. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef Storage_Tape_Parsers_ZX8081_hpp
|
||||||
|
#define Storage_Tape_Parsers_ZX8081_hpp
|
||||||
|
|
||||||
|
#include "TapeParser.hpp"
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
namespace Storage {
|
||||||
|
namespace Tape {
|
||||||
|
namespace ZX8081 {
|
||||||
|
|
||||||
|
struct File {
|
||||||
|
std::vector<uint8_t> data;
|
||||||
|
std::string name;
|
||||||
|
bool isZX81;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class WaveType {
|
||||||
|
Pulse, Gap, LongGap
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class SymbolType {
|
||||||
|
One, Zero, Gap
|
||||||
|
};
|
||||||
|
|
||||||
|
class Parser: public Storage::Tape::Parser<WaveType, SymbolType> {
|
||||||
|
public:
|
||||||
|
Parser();
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Reads and combines the next eight bits.
|
||||||
|
*/
|
||||||
|
uint8_t get_next_byte(const std::shared_ptr<Storage::Tape::Tape> &tape);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Waits for a long gap, reads all the bytes between that and the next long gap, then
|
||||||
|
attempts to parse those as a valid ZX80 or ZX81 file. If no file is found,
|
||||||
|
returns nullptr.
|
||||||
|
*/
|
||||||
|
std::shared_ptr<File> get_next_file();
|
||||||
|
|
||||||
|
private:
|
||||||
|
/*!
|
||||||
|
Proceeds beyond the current or next gap then counts pulses until the gap afterwards, and returns the resulting bit.
|
||||||
|
*/
|
||||||
|
uint8_t get_next_bit(const std::shared_ptr<Storage::Tape::Tape> &tape);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* ZX8081_hpp */
|
Loading…
Reference in New Issue
Block a user