/* * c64test.h - report a test result to the repository's headless test runner. * * `c64 test` watches for the first store to $D7FF and treats the value as the * result: 0 = pass, anything else = failure code. VICE's debug cartridge uses the * same register, so `x64sc -debugcart` also exits with this code. * * On real hardware $D7FF is an image of an unused SID register ($D41F); the * store does nothing, so these calls can stay in shipped code. * * The runner captures the screen at that moment, so print what you want * checked before reporting. */ #ifndef C64TEST_H #define C64TEST_H #define C64TEST_RESULT (*(volatile unsigned char *)0xD7FF) /* Report success. */ #define c64test_pass() (C64TEST_RESULT = 0) /* Report failure with a code 1-255 (use it to say which check failed). */ #define c64test_fail(code) (C64TEST_RESULT = (unsigned char)(code)) /* Check a condition; on failure report `code` and stop the test. */ #define c64test_check(cond, code) \ do { if (!(cond)) { c64test_fail(code); for (;;) {} } } while (0) #endif