|
| 1 | +# Acid-test ROM toolkit |
| 2 | + |
| 3 | +Synthetic Jaguar ROMs that exercise specific hardware corners -- |
| 4 | +blitter modes, GPU/DSP cross-talk, beam chasing, OP scenarios -- and |
| 5 | +report pass/fail to the host via a fixed RAM signature. |
| 6 | + |
| 7 | +The motivation is two-fold: |
| 8 | + |
| 9 | +1. **Reproducible perf benchmarks** that don't depend on commercial ROMs |
| 10 | + (which we can't ship). Each acid test is small (typically <8 KB), |
| 11 | + open-source, and exercises a single feature so we can attribute |
| 12 | + regressions cleanly. |
| 13 | +2. **Bug-finding under stress.** Commercial games hit wide combinations |
| 14 | + of features, but only the combinations *they happen to use*. Acid |
| 15 | + tests exhaustively walk a feature axis (every pixsize, every |
| 16 | + phrase/non-phrase, every Z-mode) and catch divergence between fast |
| 17 | + and accurate blitters, between our implementation and the hardware |
| 18 | + reference, and between successive emulator versions. |
| 19 | + |
| 20 | +Status: **early scaffolding.** Runner + build infrastructure landed, |
| 21 | +first source-form test landed, vasm dependency documented but optional |
| 22 | +(CI builds skip the assemble step when vasm is absent). |
| 23 | + |
| 24 | +## Layout |
| 25 | + |
| 26 | +``` |
| 27 | +test/acid/ |
| 28 | + README.md -- this file |
| 29 | + Makefile -- assembles tests/*.s into .jag ROMs (vasm) |
| 30 | + run.c -- harness: dlopen core, load ROM, read signature |
| 31 | + include/ |
| 32 | + jaguar_header.s -- minimal Jaguar cart header + entry vector |
| 33 | + acid_test.s -- pass/fail signature macros |
| 34 | + tests/ |
| 35 | + blitter/ -- blitter mode matrix |
| 36 | + gpu/ -- GPU coprocessor |
| 37 | + dsp/ -- DSP coprocessor |
| 38 | + op/ -- Object Processor |
| 39 | + timing/ -- VC/VP, halfline, beam chasing |
| 40 | +``` |
| 41 | + |
| 42 | +## How a test reports its result |
| 43 | + |
| 44 | +Tests write a four-word "acid signature" block at fixed RAM offset |
| 45 | +`0x100` (low main-RAM, well below the cart base and any normal use). |
| 46 | + |
| 47 | +``` |
| 48 | +0x100: ACID_RESULT -- 0x12345678 PASS, 0xDEADBEEF FAIL, |
| 49 | + 0x00000000 NOT-RUN-YET |
| 50 | +0x104: ACID_DETAIL -- test-specific error / sub-test code |
| 51 | +0x108: ACID_OBSERVED -- value the test actually got (on FAIL) |
| 52 | +0x10C: ACID_EXPECTED -- value the test was looking for |
| 53 | +``` |
| 54 | + |
| 55 | +The runner reads main-RAM via `retro_get_memory_data(SYSTEM_RAM)` after |
| 56 | +running N frames and prints PASS / FAIL with diagnostics. |
| 57 | + |
| 58 | +## Building |
| 59 | + |
| 60 | +The toolchain is **vasm** (motorola syntax + Jaguar GPU/DSP backends), |
| 61 | +with **vlink** for linking. Both are open source from |
| 62 | +http://sun.hasenbraten.de/vasm/. |
| 63 | + |
| 64 | +```bash |
| 65 | +# macOS (build from source -- not in Homebrew): |
| 66 | +git clone http://sun.hasenbraten.de/vasm/release/vasm.tar.gz # or: curl -O |
| 67 | +cd vasm && make CPU=m68k SYNTAX=mot |
| 68 | +sudo install vasmm68k_mot /usr/local/bin/ |
| 69 | + |
| 70 | +git clone http://sun.hasenbraten.de/vlink/release/vlink.tar.gz |
| 71 | +cd vlink && make |
| 72 | +sudo install vlink /usr/local/bin/ |
| 73 | +``` |
| 74 | + |
| 75 | +Linux: same source build, no package manager wrapper. |
| 76 | + |
| 77 | +Then: |
| 78 | + |
| 79 | +```bash |
| 80 | +cd test/acid && make # assembles all tests/*.s into *.jag |
| 81 | +make acid # from repo root: build core + tests + run |
| 82 | +``` |
| 83 | + |
| 84 | +If `vasmm68k_mot` is not on `$PATH`, the Makefile prints a one-line |
| 85 | +warning and skips the assemble step. Pre-built `.jag` ROMs are checked |
| 86 | +into `tests/<category>/prebuilt/` for the cases where we want CI to |
| 87 | +test against a known-good binary without depending on the assembler. |
| 88 | + |
| 89 | +## Writing a new test |
| 90 | + |
| 91 | +1. Pick a category (`blitter/`, `gpu/`, etc.) or add a new one. |
| 92 | +2. Drop a `<name>.s` file. Start from |
| 93 | + `tests/blitter/copy_simple.s` as a template. |
| 94 | +3. Include the acid header + the signature macros: |
| 95 | + ``` |
| 96 | + include "jaguar_header.s" |
| 97 | + include "acid_test.s" |
| 98 | + ``` |
| 99 | +4. Write your test. End with `ACID_PASS` or `ACID_FAIL detail, |
| 100 | + observed, expected`. |
| 101 | +5. Run `make` in `test/acid/`; the new test's `.jag` appears alongside. |
| 102 | +6. Run `./run <core> <name>.jag` to verify. |
| 103 | + |
| 104 | +## Running |
| 105 | + |
| 106 | +```bash |
| 107 | +# From repo root: |
| 108 | +make acid # build + run all tests |
| 109 | +test/acid/run ./virtualjaguar_libretro.dylib \ |
| 110 | + test/acid/tests/blitter/copy_simple.jag # one test |
| 111 | +``` |
| 112 | + |
| 113 | +The runner exits 0 if all PASS, non-zero if any FAIL or NOT-RUN-YET. |
| 114 | + |
| 115 | +## Future categories (not yet shipped) |
| 116 | + |
| 117 | +- **Blitter mode matrix** -- every (pixsize, phrase_mode, gourd, gourz, |
| 118 | + bcompen, dcompen) combination, fast vs accurate divergence checks. |
| 119 | +- **GPU<->Blitter sync** -- GPU programs that issue a blit, poll BUSY, |
| 120 | + and verify dest data. |
| 121 | +- **DSP<->68K I2S** -- DSP fills SOR/SOL, 68K observes IRQ timing, |
| 122 | + measure jitter. |
| 123 | +- **OP edge cases** -- scaled bitmaps with ZP, branch objects, GPU-int |
| 124 | + objects, OP-list cycles. |
| 125 | +- **Beam chasing** -- VC/VP register reads at known scanline offsets, |
| 126 | + programmatic palette swaps mid-frame. |
| 127 | +- **Cycle stress** -- fixed-iteration GPU/DSP loops with predictable |
| 128 | + cycle counts, used to characterise our event-scheduler timing |
| 129 | + accuracy. |
| 130 | + |
| 131 | +Each will land as its own focused test or test family. |
0 commit comments