1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-26 09:29:45 +00:00

Added a test call, further mutated result structure.

This commit is contained in:
Thomas Harte 2016-08-27 14:25:16 -04:00
parent e68ff64045
commit 55ada536ac
3 changed files with 40 additions and 22 deletions

View File

@ -10,6 +10,7 @@
#include <algorithm>
#include "../../../Storage/Tape/Formats/TapePRG.hpp"
#include "../../../StaticAnalyser/StaticAnalyser.hpp"
using namespace Commodore::Vic20;
@ -244,6 +245,9 @@ void Machine::set_rom(ROMSlot slot, size_t length, const uint8_t *data)
void Machine::set_prg(const char *file_name, size_t length, const uint8_t *data)
{
// TEST!
StaticAnalyser::GetTargets(file_name);
if(length > 2)
{
_rom_address = (uint16_t)(data[0] | (data[1] << 8));

View File

@ -7,24 +7,38 @@
//
#include "StaticAnalyser.hpp"
#include <cstdlib>
using namespace StaticAnalyser;
std::list<Target> GetTargets(std::shared_ptr<Storage::Disk> disk, std::shared_ptr<Storage::Tape> tape, std::shared_ptr<std::vector<uint8_t>> rom)
std::list<Target> StaticAnalyser::GetTargets(const char *file_name)
{
std::list<Target> targets;
if(disk)
// Get the extension, if any; it will be assumed that extensions are reliable, so an extension is a broad-phase
// test as to file format.
const char *mixed_case_extension = strrchr(file_name, '.');
char *lowercase_extension = nullptr;
if(mixed_case_extension)
{
lowercase_extension = strdup(mixed_case_extension);
char *parser = lowercase_extension;
while(*parser)
{
*parser = (char)tolower(*parser);
parser++;
}
}
if(tape)
{
}
// Collect all disks, tapes and ROMs as can be extrapolated from this file, forming the
// union of all platforms this file might be a target for.
std::list<std::shared_ptr<Storage::Disk>> disks;
std::list<std::shared_ptr<Storage::Tape>> tapes;
if(rom)
{
}
// Obtain the union of all platforms that
printf("Lowercase extension: %s", lowercase_extension);
free(lowercase_extension);
return targets;
}

View File

@ -32,25 +32,25 @@ struct Target {
Unexpanded,
EightKB,
ThirtyTwoKB
} Vic20;
} MemoryModel;
} vic20;
} memoryModel;
union {
enum class Electron {
ADFS,
DFS
} Electron;
enum class Vic20 {
C1540
} Vic20;
} ExternalHardware;
struct {
bool adfs;
bool dfs;
} acorn;
struct {
bool c1540;
} vic20;
} externalHardware;
std::string loadingCommand;
union {
enum class BBCElectron {
HoldShift
} BBCElectron;
} LoadingMethod;
struct {
bool holdShift;
} acorn;
} loadingMethod;
std::list<std::shared_ptr<Storage::Disk>> disks;
std::list<std::shared_ptr<Storage::Tape>> tapes;