mirror of
https://github.com/TomHarte/CLK.git
synced 2026-03-15 17:16:33 +00:00
Merge pull request #1722 from TomHarte/OtherOricROMs
Accept either of the alternate forms of Oric colour ROM.
This commit is contained in:
@@ -308,29 +308,36 @@ public:
|
||||
c |= 0x40;
|
||||
}
|
||||
|
||||
::ROM::Request request = ::ROM::Request(::ROM::Name::OricColourROM, true);
|
||||
::ROM::Name basic;
|
||||
switch(target.rom) {
|
||||
case Analyser::Static::Oric::Target::ROM::BASIC10: basic = ::ROM::Name::OricBASIC10; break;
|
||||
default:
|
||||
case Analyser::Static::Oric::Target::ROM::BASIC11: basic = ::ROM::Name::OricBASIC11; break;
|
||||
case Analyser::Static::Oric::Target::ROM::Pravetz: basic = ::ROM::Name::OricPravetzBASIC; break;
|
||||
}
|
||||
request = request && ::ROM::Request(basic);
|
||||
using Request = ::ROM::Request;
|
||||
using Name = ::ROM::Name;
|
||||
auto request = (
|
||||
Request(Name::OricColourROM128, true) ||
|
||||
Request(Name::OricColourROM256, true) ||
|
||||
Request(Name::OricPravetzColourROM, true)
|
||||
);
|
||||
const auto basic = [&]() {
|
||||
switch(target.rom) {
|
||||
case Analyser::Static::Oric::Target::ROM::BASIC10: return Name::OricBASIC10;
|
||||
default:
|
||||
case Analyser::Static::Oric::Target::ROM::BASIC11: return Name::OricBASIC11;
|
||||
case Analyser::Static::Oric::Target::ROM::Pravetz: return Name::OricPravetzBASIC;
|
||||
}
|
||||
} ();
|
||||
request = request && Request(basic);
|
||||
|
||||
switch(disk_interface) {
|
||||
default: break;
|
||||
case DiskInterface::BD500:
|
||||
request = request && ::ROM::Request(::ROM::Name::OricByteDrive500);
|
||||
request = request && Request(Name::OricByteDrive500);
|
||||
break;
|
||||
case DiskInterface::Jasmin:
|
||||
request = request && ::ROM::Request(::ROM::Name::OricJasmin);
|
||||
request = request && Request(Name::OricJasmin);
|
||||
break;
|
||||
case DiskInterface::Microdisc:
|
||||
request = request && ::ROM::Request(::ROM::Name::OricMicrodisc);
|
||||
request = request && Request(Name::OricMicrodisc);
|
||||
break;
|
||||
case DiskInterface::Pravetz:
|
||||
request = request && ::ROM::Request(::ROM::Name::Oric8DOSBoot) && ::ROM::Request(::ROM::Name::DiskIIStateMachine16Sector);
|
||||
request = request && Request(Name::Oric8DOSBoot) && Request(Name::DiskIIStateMachine16Sector);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -341,7 +348,11 @@ public:
|
||||
|
||||
// The colour ROM is optional; an alternative composite encoding can be used if
|
||||
// it is absent.
|
||||
const auto colour_rom = roms.find(::ROM::Name::OricColourROM);
|
||||
const auto colour_rom = [&] {
|
||||
if(const auto rom = roms.find(Name::OricColourROM128); rom != roms.end()) return rom;
|
||||
if(const auto rom = roms.find(Name::OricColourROM256); rom != roms.end()) return rom;
|
||||
return roms.find(Name::OricPravetzColourROM);
|
||||
} ();
|
||||
if(colour_rom != roms.end()) {
|
||||
video_->set_colour_rom(colour_rom->second);
|
||||
}
|
||||
@@ -350,19 +361,19 @@ public:
|
||||
switch(disk_interface) {
|
||||
default: break;
|
||||
case DiskInterface::BD500:
|
||||
disk_rom_ = std::move(roms.find(::ROM::Name::OricByteDrive500)->second);
|
||||
disk_rom_ = std::move(roms.find(Name::OricByteDrive500)->second);
|
||||
break;
|
||||
case DiskInterface::Jasmin:
|
||||
disk_rom_ = std::move(roms.find(::ROM::Name::OricJasmin)->second);
|
||||
disk_rom_ = std::move(roms.find(Name::OricJasmin)->second);
|
||||
break;
|
||||
case DiskInterface::Microdisc:
|
||||
disk_rom_ = std::move(roms.find(::ROM::Name::OricMicrodisc)->second);
|
||||
disk_rom_ = std::move(roms.find(Name::OricMicrodisc)->second);
|
||||
break;
|
||||
case DiskInterface::Pravetz: {
|
||||
pravetz_rom_ = std::move(roms.find(::ROM::Name::Oric8DOSBoot)->second);
|
||||
pravetz_rom_ = std::move(roms.find(Name::Oric8DOSBoot)->second);
|
||||
pravetz_rom_.resize(512);
|
||||
|
||||
diskii_->set_state_machine(roms.find(::ROM::Name::DiskIIStateMachine16Sector)->second);
|
||||
diskii_->set_state_machine(roms.find(Name::DiskIIStateMachine16Sector)->second);
|
||||
} break;
|
||||
}
|
||||
|
||||
|
||||
@@ -79,25 +79,36 @@ Outputs::Display::ScanStatus VideoOutput::get_scaled_scan_status() const {
|
||||
|
||||
void VideoOutput::set_colour_rom(const std::vector<uint8_t> &rom) {
|
||||
has_colour_rom_ = true;
|
||||
|
||||
const uint8_t xor_mask = 0x4 ^ rom[0];
|
||||
|
||||
for(std::size_t c = 0; c < 8; c++) {
|
||||
colour_forms_[c] = 0;
|
||||
|
||||
uint8_t *const colour = reinterpret_cast<uint8_t *>(&colour_forms_[c]);
|
||||
const std::size_t index = (c << 2);
|
||||
|
||||
// Values in the ROM are encoded for indexing by two square waves
|
||||
// in quadrature, which means that they're indexed in the order
|
||||
// 0, 1, 3, 2.
|
||||
colour[0] = uint8_t((rom[index] & 0x0f) << 4);
|
||||
colour[1] = uint8_t(rom[index] & 0xf0);
|
||||
colour[2] = uint8_t(rom[index+1] & 0xf0);
|
||||
colour[3] = uint8_t((rom[index+1] & 0x0f) << 4);
|
||||
// 0, 1, 3, 2. Each four meaningful values are followed by
|
||||
// four unused values.
|
||||
uint8_t colour[4];
|
||||
if(rom.size() == 128) {
|
||||
const std::size_t index = c << 2;
|
||||
colour[0] = uint8_t((rom[index] & 0x0f) << 4);
|
||||
colour[1] = uint8_t(rom[index] & 0xf0);
|
||||
colour[2] = uint8_t(rom[index+1] & 0xf0);
|
||||
colour[3] = uint8_t((rom[index+1] & 0x0f) << 4);
|
||||
} else {
|
||||
const std::size_t index = c << 3;
|
||||
colour[0] = uint8_t((rom[index+0] ^ xor_mask) << 4);
|
||||
colour[1] = uint8_t((rom[index+1] ^ xor_mask) << 4);
|
||||
colour[2] = uint8_t((rom[index+3] ^ xor_mask) << 4);
|
||||
colour[3] = uint8_t((rom[index+2] ^ xor_mask) << 4);
|
||||
}
|
||||
|
||||
// Extracting just the visible part of the stored range of values
|
||||
// means extracting the range 0x40 to 0xe0.
|
||||
for(int sub = 0; sub < 4; ++sub) {
|
||||
colour[sub] = ((colour[sub] - 0x40) * 255) / 0xa0;
|
||||
}
|
||||
|
||||
colour_forms_[c] = std::bit_cast<uint32_t>(colour);
|
||||
}
|
||||
|
||||
// Check for big endianness and byte swap if required.
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "Outputs/CRT/CRT.hpp"
|
||||
#include "Outputs/CRT/MismatchWarner.hpp"
|
||||
#include "ClockReceiver/ClockReceiver.hpp"
|
||||
#include "Machines/Utility/ROMCatalogue.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
@@ -797,13 +797,29 @@ const std::vector<Description> &Description::all_roms() {
|
||||
// Oric.
|
||||
//
|
||||
{
|
||||
OricColourROM,
|
||||
OricColourROM128,
|
||||
"Oric",
|
||||
"the Oric colour ROM",
|
||||
"the Oric colour ROM (128-byte version)",
|
||||
"colour.rom",
|
||||
128,
|
||||
0xd50fca65u
|
||||
},
|
||||
{
|
||||
OricColourROM256,
|
||||
"Oric",
|
||||
"the Oric colour ROM (256-byte version)",
|
||||
"ORIC.PAL-PROM-TBP24S10-1ab9b572.bin",
|
||||
256,
|
||||
0x1ab9b572u
|
||||
},
|
||||
{
|
||||
OricPravetzColourROM,
|
||||
"Oric",
|
||||
"the Pravetz 8D colour ROM",
|
||||
"PRAVETZ-8D.PAL-PROM-82S129-1576a69b.bin",
|
||||
256,
|
||||
0x1576a69bu
|
||||
},
|
||||
{
|
||||
OricBASIC10,
|
||||
"Oric",
|
||||
|
||||
@@ -139,7 +139,9 @@ enum Name {
|
||||
MSXMusic,
|
||||
|
||||
// Oric.
|
||||
OricColourROM,
|
||||
OricColourROM128,
|
||||
OricColourROM256,
|
||||
OricPravetzColourROM,
|
||||
OricBASIC10,
|
||||
OricBASIC11,
|
||||
OricPravetzBASIC,
|
||||
|
||||
Reference in New Issue
Block a user