diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..84587c4 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,46 @@ +# Repository Guidelines + +## Project Structure & Module Organization +- Core VM and tooling live at the repo root (e.g., `vm*.c`, `vm.h`, `tty.c`, + `wrapper.c`, `functions/`). +- Bootstrap artifacts are organized by stage: `stage0/`, `stage1/`, `stage2/`, + `stage3/`. Sources commonly use `.hex0`, `.hex1`, `.hex2`, and `.s`. +- Ports and platform work live in their own directories (e.g., `POSIX/`, `x86/`, + `UEFI/`). +- Generated outputs: `bin/` (tools), `roms/` (built ROM images), + `prototypes/` (prototype tools), and scratch under `test/`. + +## Build, Test, and Development Commands +- `make all`: build the VM (`bin/vm`), `libvm.so`, ROM images, and prototypes. +- `make development` / `make production`: convenience targets for dev vs + production-oriented builds. +- `make clean` / `make clean-hard`: remove generated artifacts (`bin/`, `roms/`, + `prototypes/`, and test scratch). +- `make test`: verify ROM outputs against `test/SHA256SUMS`. +- `make test-all`: run the full verification suite (checksum + assembly and + disassembly round-trips). +- `python3` is required for `make test-all` (runs `High_level_prototypes/disasm.py`). + +## Coding Style & Naming Conventions +- C code uses tabs for indentation and braces on their own line; match nearby + style and keep diffs small. +- Prefer descriptive names over abbreviations (e.g., `load_program`). +- Put new bootstrap-stage sources in the appropriate `stageN/` directory; put + port-specific work under the relevant port directory. + +## Testing Guidelines +- Keep tests deterministic: ROMs and round-trip checks must be bit-for-bit + stable. +- Update `test/SHA256SUMS` only when a ROM change is intentional: + `make Generate-rom-test` (then run `make test-all`). + +## Commit & Pull Request Guidelines +- Commit messages in this repo are short, imperative, and specific (e.g., `Fix + broken builds`, `Add support for anonymous enums`). +- PRs should include: what changed, why, how to reproduce, and the exact command + run (typically `make test-all`). If a ROM changes, call it out explicitly and + explain the checksum update. + +## Submodules & Setup +- Clone with submodules: `git clone --recursive`. +- After pulling: `git submodule update --init --recursive`. diff --git a/bootstrapping Steps.org b/bootstrapping Steps.org index 308333d..4b2ea7a 100644 --- a/bootstrapping Steps.org +++ b/bootstrapping Steps.org @@ -194,7 +194,7 @@ Then we use our M0 Line macro assembler to convert our assembly into hex2 format Then we need to assemble that hex into our desired program: ./bin/vm --rom roms/stage1_assembler-2 --tape_01 cc_TEMP2 --tape_02 roms/cc_x86 --memory 48K -roms/cc_x86 should with the sha256sum of 1b44b454b8e7beab41ecc4fb81220ef0a396bfeb954a3589861b6807dea0c313 +roms/cc_x86 should with the sha256sum of 20bb83238f4692f6062e5b47530fdbd1f60dcf94f9d62b724176941931127a9f Our C compiler will read any code in tape_01 and output the compiled output to tape_02. The compiled output is macro assembly (allowing for easy inspection) which then must go through the appropriate macro assembler and hex2 steps to become a working binary. diff --git a/functions/require.c b/functions/require.c index 16dfc7e..7388e1e 100644 --- a/functions/require.c +++ b/functions/require.c @@ -21,9 +21,9 @@ void file_print(char* s, FILE* f); -void require(int bool, char* error) +void require(int condition, char* error) { - if(!bool) + if(!condition) { file_print(error, stderr); exit(EXIT_FAILURE); diff --git a/test/SHA256SUMS b/test/SHA256SUMS index 7a2e14f..c4502ab 100644 --- a/test/SHA256SUMS +++ b/test/SHA256SUMS @@ -1,5 +1,5 @@ 695698ebc7ed1d3acbcded1bd832a6b49b9a7c2a37c216a9fccdc0e89e976e99 roms/CAT -1b44b454b8e7beab41ecc4fb81220ef0a396bfeb954a3589861b6807dea0c313 roms/cc_x86 +20bb83238f4692f6062e5b47530fdbd1f60dcf94f9d62b724176941931127a9f roms/cc_x86 662b14485df5da61c3f5ad63151932985914b2fe074c21798e20ba2d83b45ecc roms/DEHEX f4bbf9e9c4828170d0c153ac265382dc705643f95efd2a029243326d426be5a4 roms/forth 96ade767f30e3d9037a6c597cefb103942c8ec104264a3551017f091b10646e1 roms/lisp