#include #include #include #include #include #include #include "m68k.h" #include "run.h" #include "sym.h" #include "tests.h" static void test_c9read_end(void) { uint8_t *ctx, *b; ctx = mem+m68k_get_reg(NULL, M68K_REG_A0); assert_ptr_equal(ctx, mem+Ctx); b = mem+Begindst; assert_int_equal(ru32le(b), bufsz); // size assert_int_equal(b[4], EXPR_Tread); // type assert_int_equal(ru16le(b+5), 0); // tag assert_int_equal(ru32le(b+7), 0x12345678); // fid assert_int_equal(ru64le(b+11), 0x3000000010LL); // offset assert_int_equal(ru32le(b+19), 1000); // count assert_int_equal(b[23], fill); executed |= End; } void test_c9read(void **state) { uint8_t *ctx; uint16_t sr; (void)state; ctx = mem+Ctx; initctx(ctx, Msize); c9begin = generic_begin; c9end = test_c9read_end; executed = 0; m68k_set_reg(M68K_REG_A0, Ctx); m68k_set_reg(M68K_REG_D0, 0x12345678); m68k_set_reg(M68K_REG_D1, 0x30); m68k_set_reg(M68K_REG_D2, 0x10); m68k_set_reg(M68K_REG_D3, 1000); jsr(Progstart+SYM_c9read); sr = m68k_get_reg(NULL, M68K_REG_SR); assert_false(sr & SR_C); // check if the data buffer was used assert_int_equal(executed, Begin|End); }