foot/emulator/tests/modu-instruction.cpp
shylie f3773fc82b
All checks were successful
Test / build (push) Successful in 12s
Add more tests, fix division and modulus
2025-07-08 15:54:54 -04:00

76 lines
1.4 KiB
C++

#include "test-common.h"
int main(int argc, char** argv)
{
// CNST
// dst - 0, Direct
// imm - 0x0005
//
// DIVI
// dst - 0, Direct
// a - 0, Direct
// b - 2, Immediate
{
foot::Emulator emu = run_instructions({ 0x00200005, 0x0F200220 });
if (!check(0x1, emu.register_at(0))) { return 1; }
}
// CNST
// dst - 0, Direct
// imm - 0x0005
//
// CNST
// dst - 1, Direct
// imm = 0xFFFE (-2)
//
// DIVI
// dst - 0, Direct
// a - 0, Direct
// b - 1, Direct
{
foot::Emulator emu = run_instructions({ 0x00200005, 0x0021FFFE, 0x0F202120 });
if (!check(0x1, emu.register_at(0))) { return 1; }
}
// CNST
// dst - 0, Direct
// imm - 0xFFFE (-2)
//
// CNST
// dst - 1, Direct
// imm = 0x0005
//
// DIVI
// dst - 0, Direct
// a - 0, Direct
// b - 1, Direct
{
foot::Emulator emu = run_instructions({ 0x0020FFFE, 0x00210005, 0x0F202120 });
if (!check(0xFFFE, emu.register_at(0))) { return 1; }
}
// CNST
// dst - 0, Direct
// imm - 0x0005 (2.5)
//
// CNST
// dst - 1, Direct
// imm = 0x0003 (1.5)
//
// CONF
// dst - X, Immediate
// a - 1, Immediate
//
// MULT
// dst - 0, Direct
// a - 0, Direct
// b - 1, Direct
{
foot::Emulator emu = run_instructions({ 0x00200005, 0x00210003, 0x01000401, 0x0F202120 });
if (!check(0x2, emu.register_at(0))) { return 1; }
}
return 0;
}