// SPDX-License-Identifier: GPL-3.0-or-later // Compiled by CMOC and executed inside each guest processor by measure.cpp. #include #include #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; }