Publish VCC Plus OSS source distribution for 3.6.2 build 60
This commit is contained in:
commit
c652a5276d
1192 files changed
+272368
No files matched your search
@@ -0,0 +1,102 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#include "../basic-disk-session.h"
|
||||
|
||||
using namespace BasicDiskTests;
|
||||
|
||||
static std::uint32_t pixel(const Frame& frame, unsigned x, unsigned y)
|
||||
{
|
||||
const auto area = frame.activeArea;
|
||||
return frame.pixels[(area.y + y * area.height / 192) * Frame::width + area.x + x * area.width / 320];
|
||||
}
|
||||
|
||||
// The highlighted ridge top and the ship's lower edge both use the header color.
|
||||
static void expectScene(Session& session, unsigned y, unsigned column,
|
||||
std::uint32_t accent, bool initial = false)
|
||||
{
|
||||
for (unsigned n = 0; n < 900; ++n) {
|
||||
session.frames(1);
|
||||
const auto frame = session.machine.snapshot().frame;
|
||||
if (!frame) continue;
|
||||
const auto edge = pixel(*frame, 12, 19);
|
||||
if ((initial || edge == accent) && edge != pixel(*frame, 12, 22) &&
|
||||
pixel(*frame, column * 16 + 2, 59) == edge &&
|
||||
pixel(*frame, column * 16 + 2, y) == edge &&
|
||||
pixel(*frame, column * 16 + 2, y + 3) != edge) {
|
||||
session.frames(3); // Finish the first scan after the vertical-blank flip.
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw std::runtime_error("Expected ridge at y=" + std::to_string(y) +
|
||||
" under probe column " + std::to_string(column) +
|
||||
"\n" + session.machine.copyScreenText());
|
||||
}
|
||||
|
||||
static void savePicture(const Frame& frame, const fs::path& file)
|
||||
{
|
||||
if (file.empty()) return;
|
||||
const auto area = frame.activeArea;
|
||||
std::ofstream out(file, std::ios::binary);
|
||||
out << "P6\n" << area.width << " " << area.height << "\n255\n";
|
||||
for (int y = 0; y < area.height; ++y)
|
||||
for (int x = 0; x < area.width; ++x) {
|
||||
const auto rgb = frame.pixels[(area.y + y) * Frame::width + area.x + x];
|
||||
out.put(char(rgb >> 16)); out.put(char(rgb >> 8)); out.put(char(rgb));
|
||||
}
|
||||
require(out.good(), "Could not save the guest display");
|
||||
}
|
||||
|
||||
static void verify(const fs::path& roms, const fs::path& disk, const fs::path& bin,
|
||||
Processor cpu, bool fromDisk, bool capture)
|
||||
{
|
||||
Session session(roms, disk, cpu, Profile::fd);
|
||||
if (fromDisk) session.type("LOADM\"RIDGE\":EXEC\r");
|
||||
else session.launch(bin);
|
||||
|
||||
expectScene(session, 132, 10, 0, true);
|
||||
auto frame = session.machine.snapshot().frame;
|
||||
const auto earthEdge = pixel(*frame, 12, 19);
|
||||
if (capture) savePicture(*frame, "earth.ppm");
|
||||
session.type("D");
|
||||
expectScene(session, 140, 11, earthEdge);
|
||||
session.type("A");
|
||||
expectScene(session, 132, 10, earthEdge);
|
||||
|
||||
session.type(" ");
|
||||
expectScene(session, 152, 10, 0, true);
|
||||
const auto marsEdge = pixel(*session.machine.snapshot().frame, 12, 19);
|
||||
require(marsEdge != earthEdge, "The two planets have the same terrain color");
|
||||
session.type("R");
|
||||
expectScene(session, 136, 10, marsEdge);
|
||||
|
||||
auto byteAt = [&](unsigned address) {
|
||||
return session.machine.debuggerMemoryRange(address, 1, true).bytes.at(0);
|
||||
};
|
||||
require(byteAt(0x5000A) == 132 && byteAt(0x5200A) == 136,
|
||||
"The screen changed without writing the two documented physical bytes");
|
||||
session.type(" ");
|
||||
expectScene(session, 132, 10, earthEdge);
|
||||
session.type(" ");
|
||||
expectScene(session, 136, 10, marsEdge);
|
||||
if (capture) savePicture(*session.machine.snapshot().frame, "mars.ppm");
|
||||
|
||||
session.type("Q");
|
||||
session.until("SURVEY COMPLETE");
|
||||
session.verifyReturn();
|
||||
session.verifyMedia();
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
try {
|
||||
require(argc == 4 || argc == 5, "Usage: run ROMS DISK BIN [capture]");
|
||||
for (auto cpu : {Processor::MC6809, Processor::HD6309}) {
|
||||
verify(argv[1], argv[2], argv[3], cpu, false, argc == 5 && cpu == Processor::MC6809);
|
||||
verify(argv[1], argv[2], argv[3], cpu, true, false);
|
||||
}
|
||||
std::cout << "PASS MC6809/HD6309 direct Run and disk EXEC: flight, planet switch, "
|
||||
"physical ridge edit, return visit and BASIC return\n";
|
||||
} catch (const std::exception& error) {
|
||||
std::cerr << error.what() << '\n';
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user