foot/emulator/tests/cnst-instruction.cpp
shylie 060ca1d3cd
All checks were successful
Test / build (push) Successful in 8s
Add more tests, prep for graphical output
2025-07-08 11:53:56 -04:00

45 lines
860 B
C++

#include "test-common.h"
int main(int argc, char** argv)
{
// CNST
// dst - 0, Direct
// imm - 0xFFFF
{
foot::Emulator emu = run_instruction(0x0020FFFF);
if (!check(0xFFFF, emu.register_at(0))) { return 1; }
}
// CNST
// dst - 0, Direct
// imm - 0xFFFF
//
// CNST
// dst - 0, Indirect
// imm = 0x7777
{
foot::Emulator emu = run_instructions({ 0x0020FFFF, 0x00807777 });
if (!check(0x7777, emu.memory_at(0xFFFF))) { return 1; }
}
// CNST
// dst - 30, Direct
// imm = 0x0010
//
// CNST
// dst 0, Indirect with Auto-Increment
// imm = 0x1234
{
bool failed = false;
foot::Emulator emu = run_instructions({ 0x003E0010, 0x10401234 });
for (int i = 0; i < 0x10; i++)
{
if (!check(0x1234, emu.memory_at(i))) { failed = true; }
}
if (failed) { return 1; }
}
return 0;
}