foot/emulator/tests/cnst-instruction.cpp
shylie 6007426eb3
Some checks failed
Test / build (push) Failing after 4s
Add vcd waveform tracing
2026-03-25 01:43:20 -04:00

57 lines
922 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, 0x00407777 });
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, 0x10601234 });
for (int i = 0; i < 0x10; i++)
{
if (!check(0x1234, emu.memory_at(i)))
{
failed = true;
}
}
if (failed)
{
return 1;
}
}
return 0;
}