Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -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`.
2 changes: 1 addition & 1 deletion bootstrapping Steps.org
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions functions/require.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion test/SHA256SUMS
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
695698ebc7ed1d3acbcded1bd832a6b49b9a7c2a37c216a9fccdc0e89e976e99 roms/CAT
1b44b454b8e7beab41ecc4fb81220ef0a396bfeb954a3589861b6807dea0c313 roms/cc_x86
20bb83238f4692f6062e5b47530fdbd1f60dcf94f9d62b724176941931127a9f roms/cc_x86
662b14485df5da61c3f5ad63151932985914b2fe074c21798e20ba2d83b45ecc roms/DEHEX
f4bbf9e9c4828170d0c153ac265382dc705643f95efd2a029243326d426be5a4 roms/forth
96ade767f30e3d9037a6c597cefb103942c8ec104264a3551017f091b10646e1 roms/lisp
Expand Down