76 lines
1.5 KiB
C++
76 lines
1.5 KiB
C++
#include "test-common.h"
|
|
|
|
int main(int argc, char** argv)
|
|
{
|
|
// CNST
|
|
// dst - 0, Direct
|
|
// imm - 0x0003
|
|
//
|
|
// MULT
|
|
// dst - 0, Direct
|
|
// a - 0, Direct
|
|
// b - 2, Immediate
|
|
{
|
|
foot::Emulator emu = run_instructions({ 0x00200003, 0x0B200220 });
|
|
if (!check(0x0006, emu.register_at(0))) { return 1; }
|
|
}
|
|
|
|
// CNST
|
|
// dst - 0, Direct
|
|
// imm - 0x0007
|
|
//
|
|
// ARNG
|
|
// dst - 1, Direct
|
|
// a - 7, Immediate
|
|
//
|
|
// MULT
|
|
// dst - 0, Direct
|
|
// a - 0, Direct
|
|
// b - 1, Direct
|
|
{
|
|
foot::Emulator emu = run_instructions({ 0x00200007, 0x01210207, 0x0B202120 });
|
|
if (!check(0xFFFFFFCF, emu.register_at(0))) { return 1; }
|
|
}
|
|
|
|
// ARNG
|
|
// dst - 0, Direct
|
|
// a - 7, Immediate
|
|
//
|
|
// ARNG
|
|
// dst - 1, Direct
|
|
// a - 7, Immediate
|
|
//
|
|
// MULT
|
|
// dst - 0, Direct
|
|
// a - 0, Direct
|
|
// b - 1, Direct
|
|
{
|
|
foot::Emulator emu = run_instructions({ 0x01200207, 0x01210207, 0x0B202120 });
|
|
if (!check(0x31, emu.register_at(0))) { return 1; }
|
|
}
|
|
|
|
// CNST
|
|
// dst - 0, Direct
|
|
// imm - 0x0007 (3.5)
|
|
//
|
|
// CNST
|
|
// dst - 1, Direct
|
|
// imm - 0x0007 (3.5)
|
|
//
|
|
// CONF
|
|
// dst - X, Immediate
|
|
// a - 1, Immediate
|
|
//
|
|
// MULT
|
|
// dst - 0, Direct
|
|
// a - 0, Direct
|
|
// b - 1, Direct
|
|
{
|
|
foot::Emulator emu = run_instructions({ 0x00200007, 0x00210007, 0x01000401, 0x0B202120 });
|
|
// 3.5 * 3.5 = 12.25 -- truncated to 12 with 31.1 fixed-point format
|
|
if (!check(12 << 1 /* shift 1 for 31.1 fixed-point format */, emu.register_at(0))) { return 1; }
|
|
}
|
|
|
|
return 0;
|
|
}
|