76 lines
1.4 KiB
C++
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, 0x0C200220 });
|
|
if (!check(0x00000002, emu.register_at(0))) { return 1; }
|
|
}
|
|
|
|
// CNST
|
|
// dst - 0, Direct
|
|
// imm - 0x0007
|
|
//
|
|
// ARNG
|
|
// dst - 1, Direct
|
|
// a - 7, Immediate
|
|
//
|
|
// DIVI
|
|
// dst - 0, Direct
|
|
// a - 0, Direct
|
|
// b - 1, Direct
|
|
{
|
|
foot::Emulator emu = run_instructions({ 0x00200007, 0x01210207, 0x0C202120 });
|
|
if (!check(0xFFFFFFFF, emu.register_at(0))) { return 1; }
|
|
}
|
|
|
|
// ARNG
|
|
// dst - 0, Direct
|
|
// a - 7, Immediate
|
|
//
|
|
// ARNG
|
|
// dst - 1, Direct
|
|
// a - 7, Immediate
|
|
//
|
|
// DIVI
|
|
// dst - 0, Direct
|
|
// a - 0, Direct
|
|
// b - 1, Direct
|
|
{
|
|
foot::Emulator emu = run_instructions({0x01200207, 0x01210207, 0x0C202120 });
|
|
if (!check(0x1, emu.register_at(0))) { return 1; }
|
|
}
|
|
|
|
// CNST
|
|
// dst - 0, Direct
|
|
// imm - 0x0002 (1)
|
|
//
|
|
// CNST
|
|
// dst - 1, Direct
|
|
// imm - 0x0001 (0.5)
|
|
//
|
|
// CONF
|
|
// dst - X, Immediate
|
|
// a - 1, Immediate
|
|
//
|
|
// MULT
|
|
// dst - 0, Direct
|
|
// a - 0, Direct
|
|
// b - 1, Direct
|
|
{
|
|
foot::Emulator emu = run_instructions({ 0x00200002, 0x00210001, 0x01000401, 0x0C202120 });
|
|
// 1 / 0.5 = 2
|
|
if (!check(2 << 1 /* shift 1 for 31.1 fixed-point format */, emu.register_at(0))) { return 1; }
|
|
}
|
|
|
|
return 0;
|
|
}
|