Skip to content

Commit

Permalink
wip of property rework
Browse files Browse the repository at this point in the history
  • Loading branch information
gulrak committed Jul 4, 2024
1 parent 3019cd8 commit edebc0d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/emulation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ set(CHIP8_EMU_SOURCE
utility.cpp
properties.cpp
properties.hpp
#octocartridge.cpp
coreregistry.cpp
coreregistry.h
#octocartridge.cpp
#octocartridge.hpp
)

Expand Down
9 changes: 9 additions & 0 deletions src/emulation/chip8vip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,13 @@ static const RealCoreSetupInfo defaultSetups[] = {
{"CHIP8E", R"("cpu": "CDP1802", "clockRate": 1760640, "ram": "4096", "cleanRam": true, "video": "CDP1861", "audio": "CA555 Buzzer", "keyboard": "VIP Hex", "romName": "COSMAC-VIP", "interpreter": "CHIP8E")"}
};

bool registeredVIP = CoreRegistry::registerFactory("COSMAC VIP", Chip8VIP::create);

enum VIPVideoType { VVT_CDP1861, VVT_CDP1861_C10_HIRES, VVT_VP_590 };
enum VIPAudioType { VAT_CA555_BUZZER, VAT_VP_595_SIMPLE_SB, VAT_VP_551_2_SUPER_SB };
enum VIPKeyboard { VIPK_HEX, VIPK_VP_580_2_HEX };


struct Chip8VIPOptions
{
Properties asProperties() const
Expand Down Expand Up @@ -125,6 +128,12 @@ static CosmacVipSetupInfo presets[] = {
};
// clang-format on

CoreRegistry::EmulatorInstance Chip8VIP::create(const std::string& variant, Properties& props)
{
auto options = Chip8VIPOptions::fromProperties(props);
return std::make_unique<Chip8VIP>();
}

class Chip8VIP::Private {
public:
static constexpr uint64_t CPU_CLOCK_FREQUENCY = 1760640;
Expand Down
2 changes: 2 additions & 0 deletions src/emulation/chip8vip.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#include <emulation/chip8emulatorhost.hpp>
#include <emulation/chip8realcorebase.hpp>
#include <emulation/coreregistry.h>
#include <emulation/hardware/cdp1802.hpp>

#include <memory>
Expand Down Expand Up @@ -84,6 +85,7 @@ class Chip8VIP : public Chip8RealCoreBase, public Cdp1802Bus
Properties& getProperties() override;
void updateProperties(Property& changedProp) override;

static CoreRegistry::EmulatorInstance create(const std::string& variant, Properties& props);
static std::vector<uint8_t> getInterpreterCode(const std::string& name);

private:
Expand Down

0 comments on commit edebc0d

Please sign in to comment.