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,34 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Execute CMOC byte-subtraction regression cases on both emulated CPUs."""
|
||||
import argparse
|
||||
import subprocess
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("runtime", type=Path, help="staged CMOC toolchain")
|
||||
parser.add_argument("core", type=Path, help="libVCCCore.a")
|
||||
parser.add_argument("rom", type=Path, help="locally supplied CoCo 3 ROM")
|
||||
args = parser.parse_args()
|
||||
fixture = Path(__file__).resolve().parent
|
||||
compiler = args.runtime.resolve(strict=True) / "bin/cmoc"
|
||||
with tempfile.TemporaryDirectory(prefix="vcc-indexed-subtraction-") as work:
|
||||
runner = Path(work) / "run-compiled"
|
||||
subprocess.run(["xcrun", "clang++", "-std=c++17", "-O2", "-mmacosx-version-min=14.0",
|
||||
fixture.parent / "run-compiled.cpp", args.core.resolve(strict=True), "-o", runner],
|
||||
check=True)
|
||||
for optimization in ("-O0", "-O2"):
|
||||
print("Checking indexed subtraction", optimization, flush=True)
|
||||
subprocess.run([compiler, "--coco", "--org=2800", optimization, "-Werror", "-o", "TEST.BIN",
|
||||
fixture / "qualification.c"], cwd=work, check=True)
|
||||
# Terrain, equal/unequal pairs, pointer indexing, byte index, reversed subtraction and two reads.
|
||||
expected = [172, 150, 128, 106, 0, 1, 169, 240, 0, 128, 0, 234, 66, 190]
|
||||
marker = "HX " + "".join(f"{value:02X}" for value in expected)
|
||||
subprocess.run([runner, args.rom.resolve(strict=True), "TEST.BIN", marker],
|
||||
cwd=work, check=True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,69 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#include <cmoc.h>
|
||||
|
||||
static const unsigned char heights[] = { 12, 34, 56, 78 };
|
||||
static unsigned char samples[258];
|
||||
|
||||
static unsigned char terrain(unsigned i)
|
||||
{
|
||||
return 184 - heights[i];
|
||||
}
|
||||
|
||||
static unsigned char fromPointer(const unsigned char *array, unsigned i, unsigned char base)
|
||||
{
|
||||
return base - array[i];
|
||||
}
|
||||
|
||||
static unsigned char differs(unsigned char actual, unsigned i)
|
||||
{
|
||||
return actual != heights[i];
|
||||
}
|
||||
|
||||
static unsigned char byteIndex(unsigned char i)
|
||||
{
|
||||
return 184 - heights[i];
|
||||
}
|
||||
|
||||
static unsigned char reversed(unsigned i)
|
||||
{
|
||||
return heights[i] - 34;
|
||||
}
|
||||
|
||||
static unsigned char twoReads(unsigned left, unsigned right)
|
||||
{
|
||||
return heights[left] - heights[right];
|
||||
}
|
||||
|
||||
// Print result bytes so that the host can check them independently of any
|
||||
// equality or subtraction code emitted by the compiler under test.
|
||||
static void emit(unsigned char value)
|
||||
{
|
||||
printf("%02x", (unsigned)value);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
unsigned i;
|
||||
printf("HX ");
|
||||
for (i = 0; i < sizeof(heights); ++i)
|
||||
emit(terrain(i));
|
||||
|
||||
// The comparison must see the same index regardless of the other operand.
|
||||
emit(differs(34, 1));
|
||||
emit(differs(12, 1));
|
||||
|
||||
// These indices have equal low bytes. Subtracting 200 from 184 must
|
||||
// wrap to 240 when the result is converted to unsigned char.
|
||||
samples[1] = 15;
|
||||
samples[257] = 200;
|
||||
emit(fromPointer(samples, 1, 184));
|
||||
emit(fromPointer(samples, 257, 184));
|
||||
emit(fromPointer(samples, 257, 200));
|
||||
emit(byteIndex(2));
|
||||
emit(reversed(1));
|
||||
emit(reversed(0));
|
||||
emit(twoReads(3, 0));
|
||||
emit(twoReads(0, 3));
|
||||
printf("\n");
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user