well, adding shit. laying out the base for the interpreter. really dirty code.

This commit is contained in:
StapleButter
2016-11-24 18:31:49 +01:00
parent 3505ec993b
commit f74fb2dd27
11 changed files with 2143 additions and 17 deletions

28
ARM.cpp
View File

@ -1,19 +1,13 @@
#include "ARM.h"
#include <stdio.h>
#include "NDS.h"
#include "ARM.h"
#include "ARMInterpreter.h"
ARM::ARM(u32 num)
{
// well uh
Num = num;
for (int i = 0; i < 16; i++)
R[i] = 0;
ExceptionBase = num ? 0x00000000 : 0xFFFF0000;
// zorp
JumpTo(ExceptionBase);
}
ARM::~ARM()
@ -21,11 +15,23 @@ ARM::~ARM()
// dorp
}
void ARM::Reset()
{
for (int i = 0; i < 16; i++)
R[i] = 0;
ExceptionBase = Num ? 0x00000000 : 0xFFFF0000;
// zorp
JumpTo(ExceptionBase);
}
void ARM::JumpTo(u32 addr)
{
// pipeline shit
// TODO: THUMB!!
if (addr&1) printf("!!! THUMB JUMP\n");
NextInstr = Read32(addr);
R[15] = addr+4;
@ -43,7 +49,9 @@ s32 ARM::Execute(s32 cycles)
R[15] += 4;
// actually execute
// er...
if ((CurInstr & 0xF0000000) != 0xE0000000) printf("well shit\n");
u32 icode = ((CurInstr >> 4) & 0xF) | ((CurInstr >> 16) & 0xFF0);
cycles -= ARMInterpreter::ARMInstrTable[icode](this);
}
return cycles;