1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 08:49:37 +00:00
CLK/Storage/Automation/CSL.hpp

94 lines
1.3 KiB
C++
Raw Normal View History

2024-06-16 18:27:48 +00:00
//
// CSL.hpp
// Clock Signal
//
// Created by Thomas Harte on 12/06/2024.
// Copyright © 2024 Thomas Harte. All rights reserved.
//
#pragma once
2024-06-19 02:16:23 +00:00
#include <cstdint>
2024-06-16 18:27:48 +00:00
#include <optional>
#include <string>
2024-07-07 22:17:39 +00:00
#include <variant>
2024-06-16 18:27:48 +00:00
#include <vector>
2024-06-19 02:16:23 +00:00
namespace Storage::Automation::CSL {
2024-06-16 18:27:48 +00:00
2024-06-19 02:16:23 +00:00
enum Reset {
Hard, Soft
};
struct DiskInsert {
int drive = 0;
std::string file;
};
enum ScreenshotOrSnapshot {
WaitForVSync, Now,
};
struct KeyDelay {
uint64_t press_delay;
uint64_t interpress_delay;
std::optional<uint64_t> carriage_return_delay;
};
struct KeyEvent {
bool down;
uint16_t key;
};
2024-06-16 18:27:48 +00:00
2024-06-19 02:16:23 +00:00
struct Instruction {
enum class Type {
Version,
Reset,
CRTCSelect,
LoadCSL,
DiskInsert,
SetDiskDir,
TapeInsert,
SetTapeDir,
TapePlay,
TapeStop,
TapeRewind,
SetSnapshotDir,
LoadSnapshot,
SetSnapshotName,
Snapshot,
KeyDelay,
KeyOutput,
KeyFromFile,
Wait,
WaitDriveOnOff,
WaitVsyncOnOff,
WaitSSM0000,
SetScreenshotName,
SetScreenshotDir,
Screenshot,
} type;
std::variant<
std::monostate,
DiskInsert,
Reset,
ScreenshotOrSnapshot,
KeyDelay,
std::string,
std::vector<KeyEvent>,
uint64_t
> argument;
};
2024-06-16 18:27:48 +00:00
2024-06-19 02:16:23 +00:00
enum Errors {
InvalidKeyword,
InvalidArgument,
2024-06-16 18:27:48 +00:00
};
2024-06-19 02:16:23 +00:00
std::vector<Instruction> parse(const std::string &file_name);
2024-06-16 18:27:48 +00:00
}