mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-23 06:10:03 -06:00
more shit! some start of ALU emulation
This commit is contained in:
36
ARM.h
36
ARM.h
@ -9,6 +9,9 @@
|
||||
// lame
|
||||
#define C_S(x) x
|
||||
#define C_N(x) x
|
||||
#define C_I(x) x
|
||||
|
||||
#define ROR(x, n) (((x) >> (n)) | ((x) << (32-(n))))
|
||||
|
||||
class ARM
|
||||
{
|
||||
@ -19,8 +22,39 @@ public:
|
||||
void Reset();
|
||||
|
||||
void JumpTo(u32 addr);
|
||||
void RestoreCPSR();
|
||||
|
||||
s32 Execute(s32 cycles);
|
||||
|
||||
bool CheckCondition(u32 code)
|
||||
{
|
||||
if (code == 0xE) return true;
|
||||
if (ConditionTable[code] & (1 << (CPSR>>28))) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void SetC(bool c)
|
||||
{
|
||||
if (c) CPSR |= 0x20000000;
|
||||
else CPSR &= ~0x20000000;
|
||||
}
|
||||
|
||||
void SetNZ(bool n, bool z)
|
||||
{
|
||||
CPSR &= ~0xC0000000;
|
||||
if (n) CPSR |= 0x80000000;
|
||||
if (z) CPSR |= 0x40000000;
|
||||
}
|
||||
|
||||
void SetNZCV(bool n, bool z, bool c, bool v)
|
||||
{
|
||||
CPSR &= ~0xF0000000;
|
||||
if (n) CPSR |= 0x80000000;
|
||||
if (z) CPSR |= 0x40000000;
|
||||
if (c) CPSR |= 0x20000000;
|
||||
if (v) CPSR |= 0x10000000;
|
||||
}
|
||||
|
||||
u32 Read32(u32 addr)
|
||||
{
|
||||
if (Num) return NDS::ARM7Read32(addr);
|
||||
@ -41,6 +75,8 @@ public:
|
||||
u32 NextInstr;
|
||||
|
||||
u32 ExceptionBase;
|
||||
|
||||
static u32 ConditionTable[16];
|
||||
};
|
||||
|
||||
#endif // ARM_H
|
||||
|
Reference in New Issue
Block a user