#include "chips/MOS6502.h" #include "chips/MMU.h" #include "chips/RAM.h" #define BEGIN_MOS6502_TEST(opsym) \ struct MMU* MMU = MMU_new(); \ int MMUI; \ for(MMUI = 0; MMUI < 256; ++MMUI) \ MMU_addPage(MMU, K_RAM, MMUI, (struct Page*) RAM_new()); \ MMU_enablePageset(MMU, K_RAM); \ for(MMUI = 0; MMUI < 65536; ++MMUI) \ MMU_write(MMU, MMUI, MMUI%20); \ struct MOS6502* MOS6502 = MOS6502_new(MMU); #define COPY_MOS6502_PROG1(destaddr, buf) \ MMU_write(MMU, 0xFFFC, destaddr&0xFF); \ MMU_write(MMU, 0xFFFD, destaddr>>8); \ MOS6502_initPC(MOS6502); \ Word prog[] = buf; \ int progSz = sizeof(prog)/sizeof(prog[0]); \ int progI; \ for(progI = 0; progI < progSz; ++progI) \ MMU_write(MMU, destaddr + progI, prog[progI]); \ MMU_write(MMU, destaddr + progSz, 0); /* BRK */ #define RUN_MOS6502_TEST(cond) \ while(cond) \ MOS6502_step(MOS6502); #define SETUP_MOS6502_TEST_BRK_HANDLER(handleBRK) #define END_MOS6502_TEST(opsym)