Publish VCC Plus OSS source distribution for 3.6.2 build 60

This commit is contained in:
Brian Holman committed 2026-11-13 00:14:03 -07:00
commit c652a5276d
1192 files changed
+272368

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
# SPDX-License-Identifier: GPL-3.0-or-later
"""Measure compiled Orchestra-90 stereo through VCC Plus at both CoCo clock speeds."""
import argparse
from pathlib import Path
import subprocess
import tempfile
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("runtime", type=Path, help="staged Toolchain directory with liborch90.a")
parser.add_argument("core", type=Path, help="current libVCCCore.a")
parser.add_argument("rom", type=Path, help="local 32 KiB CoCo 3 system ROM")
args = parser.parse_args()
fixture = Path(__file__).resolve().parent
with tempfile.TemporaryDirectory(prefix="vcc-orch90-") as work:
subprocess.run([args.runtime.resolve() / "bin/cmoc", "--coco", "-o", "PLAY.BIN",
fixture / "playback.c", "-lorch90"], cwd=work, check=True)
subprocess.run(["xcrun", "clang++", "-std=c++17", "-O2", "-mmacosx-version-min=14.0",
fixture / "measure.cpp", args.core.resolve(), "-o", "measure"], cwd=work, check=True)
subprocess.run(["./measure", args.rom.resolve(), "PLAY.BIN"], cwd=work, check=True)
if __name__ == "__main__":
main()
+81
View File
@@ -0,0 +1,81 @@
// SPDX-License-Identifier: GPL-3.0-or-later
#include "../../../src/core/MachineSession.h"
#include "../../../src/devices/Orchestra90Device.h"
#include <cmath>
#include <cstdio>
#include <fstream>
#include <iterator>
#include <stdexcept>
using namespace VCC::Mac;
static std::vector<std::uint8_t> readFile(const char* path) {
std::ifstream input(path, std::ios::binary);
if (!input) throw std::runtime_error("Cannot open a test input");
return {std::istreambuf_iterator<char>(input), std::istreambuf_iterator<char>()};
}
static void measure(Processor processor, const std::vector<std::uint8_t>& system,
const std::vector<std::uint8_t>& binary) {
MachineSession machine;
auto orchestra = std::make_shared<VCC::Devices::Orchestra90Device>();
machine.cartridges().configure({nullptr, orchestra, nullptr, nullptr, nullptr}, true, 4);
machine.load(system, processor);
machine.resume();
for (unsigned i = 0; i < 150; ++i) machine.advance();
machine.takeAudio();
machine.quickLoad(binary);
std::vector<StereoSample> pcm;
for (unsigned i = 0; i < 120; ++i) {
machine.advance();
auto chunk = machine.takeAudio();
pcm.insert(pcm.end(), chunk.begin(), chunk.end());
}
// Marker 32/96 establishes channel order; each following block must contain
// 32 alternating plateaus on one side, with the other side fully silent.
std::size_t cursor = 0;
for (auto clock : {"normal", "fast"}) {
auto isMarker = [](StereoSample p) { return p.left == 0.125f && p.right == 0.375f; };
while (cursor < pcm.size() && !isMarker(pcm[cursor])) ++cursor;
if (cursor == pcm.size()) throw std::runtime_error("Raw stereo marker missing");
while (cursor < pcm.size() && isMarker(pcm[cursor])) ++cursor;
for (unsigned side = 0; side < 2; ++side) {
const auto start = cursor;
unsigned plateaus = 0;
float previous = -1;
while (cursor < pcm.size()) {
const auto sample = pcm[cursor];
float active = side ? sample.right : sample.left;
float other = side ? sample.left : sample.right;
if (other != 0 || (active != 0.25f && active != 0.5f)) break;
if (active != previous) {
if (active != (plateaus % 2 ? 0.25f : 0.5f))
throw std::runtime_error("Wrong alternating sample amplitude");
++plateaus;
previous = active;
}
++cursor;
}
if (plateaus != 32) throw std::runtime_error("Missing sample transitions or channel bleed");
const double rate = 44100.0 * 256 / (cursor - start);
std::printf("%s %-6s %s: %.1f frames/s\n", processor == Processor::MC6809 ? "6809" : "6309",
clock, side ? "right" : "left", rate);
if (std::abs(rate - 4000.0) > 200.0) throw std::runtime_error("Playback rate outside 5% tolerance");
}
}
if (cursor == pcm.size() || pcm.back().left != 16 / 256.0f || pcm.back().right != 80 / 256.0f)
throw std::runtime_error("Guest fixture did not reach the final stereo marker");
}
int main(int argc, char** argv) {
try {
if (argc != 3) throw std::runtime_error("Usage: measure COCO3_ROM PLAYBACK_BIN");
const auto system = readFile(argv[1]), binary = readFile(argv[2]);
for (auto cpu : {Processor::MC6809, Processor::HD6309}) measure(cpu, system, binary);
} catch (const std::exception& e) {
std::fprintf(stderr, "%s\n", e.what());
return 1;
}
return 0;
}
+51
View File
@@ -0,0 +1,51 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// Compiled by CMOC and executed inside each guest processor by measure.cpp.
#include <coco.h>
#include <vcc/orch90.h>
#define FRAMES 256
static struct orch90_frame leftBlock[FRAMES];
static struct orch90_frame rightBlock[FRAMES];
static void fail(void)
{
orch90_write(9, 17);
for (;;) {}
}
static void playBothSides(unsigned char clock)
{
setHighSpeed(clock == ORCH90_CLOCK_FAST);
// VCC applies a requested clock change at the next video frame boundary.
// The BASIC startup enabled vertical IRQs; wait for two before measuring.
asm {
sync
sync
}
// Non-playing calls must leave the marker on the two DACs.
orch90_write(32, 96);
if (!orch90_play(0, 0, clock) || orch90_play(0, 1, clock) ||
orch90_play(leftBlock, FRAMES, 9) ||
orch90_play((const struct orch90_frame *)0xffff, 1, clock))
fail();
if (!orch90_play(leftBlock, FRAMES, clock) ||
!orch90_play(rightBlock, FRAMES, clock))
fail();
orch90_write(0, 0);
}
int main(void)
{
unsigned i;
for (i = 0; i < FRAMES; ++i) {
unsigned char level = (i & 8) ? 64 : 128;
leftBlock[i].left = level;
rightBlock[i].right = level;
}
playBothSides(ORCH90_CLOCK_NORMAL);
playBothSides(ORCH90_CLOCK_FAST);
orch90_write(16, 80);
for (;;) {} // Leave a stable, distinguishable success marker for the test.
return 0;
}