2018-03-09 21:10:17 +00:00
|
|
|
//
|
|
|
|
// Target.hpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 09/03/2018.
|
2018-05-13 19:19:52 +00:00
|
|
|
// Copyright 2018 Thomas Harte. All rights reserved.
|
2018-03-09 21:10:17 +00:00
|
|
|
//
|
|
|
|
|
2018-04-03 02:42:41 +00:00
|
|
|
#ifndef Analyser_Static_Commodore_Target_h
|
|
|
|
#define Analyser_Static_Commodore_Target_h
|
2018-03-09 21:10:17 +00:00
|
|
|
|
2020-03-20 03:24:06 +00:00
|
|
|
#include "../../../Reflection/Enum.hpp"
|
|
|
|
#include "../../../Reflection/Struct.hpp"
|
2018-03-09 21:10:17 +00:00
|
|
|
#include "../StaticAnalyser.hpp"
|
2018-04-14 16:12:12 +00:00
|
|
|
#include <string>
|
2018-03-09 21:10:17 +00:00
|
|
|
|
|
|
|
namespace Analyser {
|
|
|
|
namespace Static {
|
|
|
|
namespace Commodore {
|
|
|
|
|
2020-03-15 04:13:38 +00:00
|
|
|
struct Target: public Analyser::Static::Target, public Reflection::StructImpl<Target> {
|
2018-03-09 21:10:17 +00:00
|
|
|
enum class MemoryModel {
|
|
|
|
Unexpanded,
|
|
|
|
EightKB,
|
|
|
|
ThirtyTwoKB
|
|
|
|
};
|
|
|
|
|
2020-03-12 03:28:38 +00:00
|
|
|
ReflectableEnum(Region,
|
2018-03-26 23:01:57 +00:00
|
|
|
American,
|
|
|
|
Danish,
|
|
|
|
Japanese,
|
|
|
|
European,
|
|
|
|
Swedish
|
2020-03-12 03:25:29 +00:00
|
|
|
);
|
2018-03-26 23:01:57 +00:00
|
|
|
|
2019-12-27 03:49:48 +00:00
|
|
|
/// Maps from a named memory model to a bank enabled/disabled set.
|
|
|
|
void set_memory_model(MemoryModel memory_model) {
|
|
|
|
// This is correct for unexpanded and 32kb memory models.
|
|
|
|
enabled_ram.bank0 = enabled_ram.bank1 =
|
|
|
|
enabled_ram.bank2 = enabled_ram.bank3 =
|
|
|
|
enabled_ram.bank5 = memory_model == MemoryModel::ThirtyTwoKB;
|
|
|
|
|
|
|
|
// Bank 0 will need to be enabled if this is an 8kb machine.
|
|
|
|
enabled_ram.bank0 |= memory_model == MemoryModel::EightKB;
|
|
|
|
}
|
|
|
|
struct {
|
|
|
|
bool bank0 = false;
|
|
|
|
bool bank1 = false;
|
|
|
|
bool bank2 = false;
|
|
|
|
bool bank3 = false;
|
|
|
|
bool bank5 = false;
|
|
|
|
// Sic. There is no bank 4; this is because the area that logically would be
|
|
|
|
// bank 4 is occupied by the character ROM, colour RAM, hardware registers, etc.
|
|
|
|
} enabled_ram;
|
|
|
|
|
2018-03-26 23:01:57 +00:00
|
|
|
Region region = Region::European;
|
2018-03-23 01:58:42 +00:00
|
|
|
bool has_c1540 = false;
|
2018-04-14 16:12:12 +00:00
|
|
|
std::string loading_command;
|
2020-03-12 03:25:29 +00:00
|
|
|
|
2020-03-15 04:13:38 +00:00
|
|
|
Target() : Analyser::Static::Target(Machine::Vic20) {
|
2020-03-12 03:25:29 +00:00
|
|
|
if(needs_declare()) {
|
|
|
|
DeclareField(enabled_ram.bank0);
|
|
|
|
DeclareField(enabled_ram.bank1);
|
|
|
|
DeclareField(enabled_ram.bank2);
|
|
|
|
DeclareField(enabled_ram.bank3);
|
|
|
|
DeclareField(enabled_ram.bank5);
|
|
|
|
DeclareField(region);
|
|
|
|
DeclareField(has_c1540);
|
|
|
|
AnnounceEnum(Region);
|
|
|
|
}
|
|
|
|
}
|
2018-03-09 21:10:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-03 02:42:41 +00:00
|
|
|
#endif /* Analyser_Static_Commodore_Target_h */
|