Something went wrong. Try again.
An assembler for the 6502 and 65SC02 written in Zig, in the dialect of Frank Kingswood's as65.
Something went wrong. Try again.
aigrette65 build.zig
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667// SPDX-FileCopyrightText: © 2026 Jeffrey C. Ollie <jeff@ocjtech.us>// SPDX-License-Identifier: MIT
const std = @import("std");const package = @import("build.zig.zon");
pub fn build(b: *std.Build) void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{});
// The version lives in build.zig.zon and reaches the banner from there, // so there is only one place to change it. const build_info = b.addOptions(); build_info.addOption([]const u8, "version", package.version);
const mod = b.addModule("aigrette65", .{ .root_source_file = b.path("src/root.zig"), .target = target, .optimize = optimize, .imports = &.{.{ .name = "build_info", .module = build_info.createModule() }}, });
const exe = b.addExecutable(.{ .name = "aigrette65", .root_module = b.createModule(.{ .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize, .imports = &.{.{ .name = "aigrette65", .module = mod }}, }), }); b.installArtifact(exe);
const run_cmd = b.addRunArtifact(exe); run_cmd.step.dependOn(b.getInstallStep()); run_cmd.addPassthruArgs(); const run_step = b.step("run", "Run the assembler"); run_step.dependOn(&run_cmd.step);
const mod_tests = b.addTest(.{ .root_module = mod }); const exe_tests = b.addTest(.{ .root_module = exe.root_module });
// The golden tests assemble the sources under tests/cases and compare the // result with what as65 produced for them, so they need to know // where both live. const test_paths = b.addOptions(); test_paths.addOptionPathDirectory("cases_dir", b.path("tests/cases")); test_paths.addOptionPathDirectory("golden_dir", b.path("tests/golden"));
const golden_tests = b.addTest(.{ .root_module = b.createModule(.{ .root_source_file = b.path("tests/golden_test.zig"), .target = target, .optimize = optimize, .imports = &.{ .{ .name = "aigrette65", .module = mod }, .{ .name = "test_paths", .module = test_paths.createModule() }, }, }), });
const test_step = b.step("test", "Run tests"); test_step.dependOn(&b.addRunArtifact(mod_tests).step); test_step.dependOn(&b.addRunArtifact(exe_tests).step); test_step.dependOn(&b.addRunArtifact(golden_tests).step);}