1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-02 20:30:00 +00:00

Increases the Mac Plus too 4mb.

This commit is contained in:
Thomas Harte 2019-08-11 21:41:12 -04:00
parent a90a74a512
commit 895c315fa5
5 changed files with 19 additions and 20 deletions

View File

@ -66,7 +66,7 @@ template <Analyser::Static::Macintosh::Target::Model model> class ConcreteMachin
ConcreteMachine(const Target &target, const ROMMachine::ROMFetcher &rom_fetcher) :
mc68000_(*this),
iwm_(CLOCK_RATE),
video_(ram_, audio_, drive_speed_accumulator_),
video_(audio_, drive_speed_accumulator_),
via_(via_port_handler_),
via_port_handler_(*this, clock_, keyboard_, video_, audio_, iwm_, mouse_),
drives_{
@ -95,7 +95,7 @@ template <Analyser::Static::Macintosh::Target::Model model> class ConcreteMachin
break;
case Model::Mac512ke:
case Model::MacPlus: {
ram_size = 512*1024;
ram_size = ((model == Model::MacPlus) ? 4096 : 512)*1024;
rom_size = 128*1024;
const std::initializer_list<uint32_t> crc32s = { 0x4fa5b399, 0x7cacd18f, 0xb2102e8e };
rom_descriptions.emplace_back(machine_name, "the Macintosh Plus ROM", "macplus.rom", 128*1024, crc32s);
@ -103,7 +103,8 @@ template <Analyser::Static::Macintosh::Target::Model model> class ConcreteMachin
}
ram_mask_ = (ram_size >> 1) - 1;
rom_mask_ = (rom_size >> 1) - 1;
video_.set_ram_mask(ram_mask_);
ram_.resize(ram_size >> 1);
video_.set_ram(ram_.data(), ram_mask_);
// Grab a copy of the ROM and convert it into big-endian data.
const auto roms = rom_fetcher(rom_descriptions);
@ -114,7 +115,7 @@ template <Analyser::Static::Macintosh::Target::Model model> class ConcreteMachin
Memory::PackBigEndian16(*roms[0], rom_);
// Randomise memory contents.
Memory::Fuzz(ram_, sizeof(ram_) / sizeof(*ram_));
Memory::Fuzz(ram_);
// Attach the drives to the IWM.
iwm_->set_drive(0, &drives_[0]);
@ -254,7 +255,7 @@ template <Analyser::Static::Macintosh::Target::Model model> class ConcreteMachin
const auto result = scsi_.read(register_address);
if(cycle.operation & Microcycle::SelectWord) {
// Data is loaded on the top part of the bus only.
cycle.value->full = (result << 8) | 0xff;
cycle.value->full = uint16_t((result << 8) | 0xff);
} else {
cycle.value->halves.low = result;
}
@ -310,7 +311,7 @@ template <Analyser::Static::Macintosh::Target::Model model> class ConcreteMachin
if(word_address > ram_mask_ - 0x6c80)
update_video();
memory_base = ram_;
memory_base = ram_.data();
word_address &= ram_mask_;
// Apply a delay due to video contention if applicable; technically this is
@ -766,8 +767,8 @@ template <Analyser::Static::Macintosh::Target::Model model> class ConcreteMachin
uint32_t ram_mask_ = 0;
uint32_t rom_mask_ = 0;
uint16_t rom_[64*1024];
uint16_t ram_[256*1024];
uint16_t rom_[64*1024]; // i.e. up to 128kb in size.
std::vector<uint16_t> ram_;
};
}

View File

@ -33,11 +33,10 @@ const int sync_end = 38;
// "The visible portion of a full-screen display consists of 342 horizontal scan lines...
// During the vertical blanking interval, the turned-off beam ... traces out an additional 28 scan lines,"
//
Video::Video(uint16_t *ram, DeferredAudio &audio, DriveSpeedAccumulator &drive_speed_accumulator) :
Video::Video(DeferredAudio &audio, DriveSpeedAccumulator &drive_speed_accumulator) :
audio_(audio),
drive_speed_accumulator_(drive_speed_accumulator),
crt_(704, 1, 370, Outputs::Display::ColourSpace::YIQ, 1, 1, 6, false, Outputs::Display::InputDataType::Luminance1),
ram_(ram) {
crt_(704, 1, 370, Outputs::Display::ColourSpace::YIQ, 1, 1, 6, false, Outputs::Display::InputDataType::Luminance1) {
crt_.set_display_type(Outputs::Display::DisplayType::RGB);
crt_.set_visible_area(Outputs::Display::Rect(0.08f, -0.025f, 0.82f, 0.82f));
@ -196,6 +195,7 @@ void Video::set_use_alternate_buffers(bool use_alternate_screen_buffer, bool use
use_alternate_audio_buffer_ = use_alternate_audio_buffer;
}
void Video::set_ram_mask(uint32_t mask) {
void Video::set_ram(uint16_t *ram, uint32_t mask) {
ram_ = ram;
ram_mask_ = mask;
}

View File

@ -29,7 +29,7 @@ class Video {
Constructs an instance of @c Video sourcing its pixel data from @c ram and
providing audio and drive-speed bytes to @c audio and @c drive_speed_accumulator.
*/
Video(uint16_t *ram, DeferredAudio &audio, DriveSpeedAccumulator &drive_speed_accumulator);
Video(DeferredAudio &audio, DriveSpeedAccumulator &drive_speed_accumulator);
/*!
Sets the target device for video data.
@ -47,10 +47,10 @@ class Video {
void set_use_alternate_buffers(bool use_alternate_screen_buffer, bool use_alternate_audio_buffer);
/*!
Provides a mask indicating which parts of the generated video and audio/drive addresses are
Provides a base address and a mask indicating which parts of the generated video and audio/drive addresses are
actually decoded, accessing *word-sized memory*; e.g. for a 128kb Macintosh this should be (1 << 16) - 1 = 0xffff.
*/
void set_ram_mask(uint32_t);
void set_ram(uint16_t *ram, uint32_t mask);
/*!
@returns @c true if the video is currently outputting a vertical sync, @c false otherwise.

View File

@ -26,7 +26,3 @@ void Memory::Fuzz(uint8_t *buffer, std::size_t size) {
void Memory::Fuzz(uint16_t *buffer, std::size_t size) {
Fuzz(reinterpret_cast<uint8_t *>(buffer), size * sizeof(uint16_t));
}
void Memory::Fuzz(std::vector<uint8_t> &buffer) {
Fuzz(buffer.data(), buffer.size());
}

View File

@ -22,7 +22,9 @@ void Fuzz(uint8_t *buffer, std::size_t size);
void Fuzz(uint16_t *buffer, std::size_t size);
/// Replaces all existing vector contents with random bytes.
void Fuzz(std::vector<uint8_t> &buffer);
template <typename T> void Fuzz(std::vector<T> &buffer) {
Fuzz(reinterpret_cast<uint8_t *>(buffer.data()), buffer.size() * sizeof(buffer[0]));
}
}