use static inline function rather than macro for easier debugging

This commit is contained in:
Aaron Culliney 2015-09-06 15:18:22 -07:00
parent f557941d07
commit 2cf119b5e9

View File

@ -32,23 +32,6 @@
#define BOOT_SCREEN "F8D6C781E0BB7B3DDBECD69B25E429D845506594"
extern char mdstr[(SHA_DIGEST_LENGTH*2)+1];
#define ASSERT_SHA(SHA_STR) \
do { \
uint8_t md[SHA_DIGEST_LENGTH]; \
const uint8_t * const fb = video_current_framebuffer(); \
SHA1(fb, SCANWIDTH*SCANHEIGHT, md); \
sha1_to_str(md, mdstr); \
ASSERT(strcmp(mdstr, SHA_STR) == 0); \
} while(0);
#define BOOT_TO_DOS() \
if (test_do_reboot) { \
ASSERT(apple_ii_64k[0][WATCHPOINT_ADDR] != TEST_FINISHED); \
c_debugger_go(); \
ASSERT(apple_ii_64k[0][WATCHPOINT_ADDR] == TEST_FINISHED); \
ASSERT_SHA(BOOT_SCREEN); \
apple_ii_64k[0][WATCHPOINT_ADDR] = 0x00; \
}
extern bool test_do_reboot;
void test_breakpoint(void *arg);
@ -58,4 +41,24 @@ void test_type_input(const char *input);
int test_setup_boot_disk(const char *fileName, int readonly);
void sha1_to_str(const uint8_t * const md, char *buf);
static inline int ASSERT_SHA(const char *SHA_STR) {
uint8_t md[SHA_DIGEST_LENGTH];
const uint8_t * const fb = video_current_framebuffer();
SHA1(fb, SCANWIDTH*SCANHEIGHT, md);
sha1_to_str(md, mdstr);
ASSERT(strcmp(mdstr, SHA_STR) == 0);
return 0;
}
static inline int BOOT_TO_DOS(void) {
if (test_do_reboot) {
ASSERT(apple_ii_64k[0][WATCHPOINT_ADDR] != TEST_FINISHED);
c_debugger_go();
ASSERT(apple_ii_64k[0][WATCHPOINT_ADDR] == TEST_FINISHED);
ASSERT_SHA(BOOT_SCREEN);
apple_ii_64k[0][WATCHPOINT_ADDR] = 0x00;
}
return 0;
}
#endif // whole file