Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

30 lines
1.0KB

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

Powered by TurnKey Linux.