1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-09 17:29:36 +00:00

Allow chip RAM size selection, while I'm here.

This commit is contained in:
Thomas Harte 2021-12-22 15:30:19 -05:00
parent 1916a9b99c
commit a17c192a9e
3 changed files with 29 additions and 5 deletions

View File

@ -17,6 +17,10 @@ namespace Static {
namespace Amiga {
struct Target: public Analyser::Static::Target, public Reflection::StructImpl<Target> {
ReflectableEnum(ChipRAM,
FiveHundredAndTwelveKilobytes,
OneMegabyte,
TwoMegabytes);
ReflectableEnum(FastRAM,
None,
OneMegabyte,
@ -24,12 +28,15 @@ struct Target: public Analyser::Static::Target, public Reflection::StructImpl<Ta
FourMegabytes,
EightMegabytes);
FastRAM fast_ram = FastRAM::TwoMegabytes;
ChipRAM chip_ram = ChipRAM::FiveHundredAndTwelveKilobytes;
FastRAM fast_ram = FastRAM::EightMegabytes;
Target() : Analyser::Static::Target(Machine::Amiga) {
if(needs_declare()) {
DeclareField(fast_ram);
DeclareField(chip_ram);
AnnounceEnum(FastRAM);
AnnounceEnum(ChipRAM);
}
}
};

View File

@ -53,7 +53,7 @@ class ConcreteMachine:
public:
ConcreteMachine(const Analyser::Static::Amiga::Target &target, const ROMMachine::ROMFetcher &rom_fetcher) :
mc68000_(*this),
memory_(target.fast_ram),
memory_(target.chip_ram, target.fast_ram),
chipset_(memory_, PALClockRate)
{
// Temporary: use a hard-coded Kickstart selection.

View File

@ -11,6 +11,10 @@
#include "../../Analyser/Static/Amiga/Target.hpp"
#include <array>
#include <cassert>
#include <vector>
namespace Amiga {
class MemoryMap {
@ -20,9 +24,8 @@ class MemoryMap {
static constexpr auto PermitReadWrite = PermitRead | PermitWrite;
public:
// TODO: decide what of the below I want to be dynamic.
std::array<uint8_t, 512*1024> kickstart{0xff};
std::array<uint8_t, 1024*1024> chip_ram{};
std::vector<uint8_t> chip_ram{};
struct MemoryRegion {
uint8_t *contents = nullptr;
@ -30,7 +33,8 @@ class MemoryMap {
} regions[64]; // i.e. top six bits are used as an index.
using FastRAM = Analyser::Static::Amiga::Target::FastRAM;
MemoryMap(FastRAM fast_ram_size) {
using ChipRAM = Analyser::Static::Amiga::Target::ChipRAM;
MemoryMap(ChipRAM chip_ram_size, FastRAM fast_ram_size) {
// Address spaces that matter:
//
// 00'0000 08'0000: chip RAM. [or overlayed KickStart]
@ -49,6 +53,19 @@ class MemoryMap {
// fc'0000 : 256kb Kickstart otherwise.
set_region(0xfc'0000, 0x1'00'0000, kickstart.data(), PermitRead);
switch(chip_ram_size) {
default:
case ChipRAM::FiveHundredAndTwelveKilobytes:
chip_ram.resize(512 * 1024);
break;
case ChipRAM::OneMegabyte:
chip_ram.resize(1 * 1024 * 1024);
break;
case ChipRAM::TwoMegabytes:
chip_ram.resize(2 * 1024 * 1024);
break;
}
switch(fast_ram_size) {
default:
fast_autoconf_visible_ = false;