bsnes/higan/processor/arm/registers.cpp

60 lines
1.4 KiB
C++
Raw Normal View History

auto ARM::Processor::power() -> void {
r0 = r1 = r2 = r3 = r4 = r5 = r6 = r7 = 0;
usr.r8 = usr.r9 = usr.r10 = usr.r11 = usr.r12 = usr.sp = usr.lr = 0;
fiq.r8 = fiq.r9 = fiq.r10 = fiq.r11 = fiq.r12 = fiq.sp = fiq.lr = 0;
irq.sp = irq.lr = 0;
svc.sp = svc.lr = 0;
abt.sp = abt.lr = 0;
und.sp = und.lr = 0;
pc = 0;
carryout = false;
irqline = false;
cpsr = 0;
spsr = nullptr;
fiq.spsr = 0;
irq.spsr = 0;
svc.spsr = 0;
abt.spsr = 0;
und.spsr = 0;
r[0] = &r0;
r[1] = &r1;
r[2] = &r2;
r[3] = &r3;
r[4] = &r4;
r[5] = &r5;
r[6] = &r6;
r[7] = &r7;
r[15] = &pc;
}
auto ARM::Processor::setMode(Mode mode) -> void {
Update to v099r13 release. byuu says: Changelog: - GB core code cleanup completed - GBA core code cleanup completed - some more cleanup on missed processor/arm functions/variables - fixed FC loading icarus bug - "Load ROM File" icarus functionality restored - minor code unification efforts all around (not perfect yet) - MMIO->IO - mmio.cpp->io.cpp - read,write->readIO,writeIO It's been a very long work in progress ... starting all the way back with v094r09, but the major part of the higan code cleanup is now completed! Of course, it's very important to note that this is only for the basic style: - under_score functions and variables are now camelCase - return-type function-name() are now auto function-name() -> return-type - Natural<T>/Integer<T> replace (u)intT_n types where possible - signed/unsigned are now int/uint - most of the x==true,x==false tests changed to x,!x A lot of spot improvements to consistency, simplicity and quality have gone in along the way, of course. But we'll probably never fully finishing beautifying every last line of code in the entire codebase. Still, this is a really great start. Going forward, WIP diffs should start being smaller and of higher quality once again. I know the joke is, "until my coding style changes again", but ... this was way too stressful, way too time consuming, and way too risky. I'm too old and tired now for extreme upheavel like this again. The only major change I'm slowly mulling over would be renaming the using Natural<T>/Integer<T> = (u)intT; shorthand to something that isn't as easily confused with the (u)int_t types ... but we'll see. I'll definitely continue to change small things all the time, but for the larger picture, I need to just accept the style I have and live with it.
2016-06-29 11:10:28 +00:00
cpsr.m = 0x10 | (uint)mode;
if(mode == Mode::FIQ) {
r[ 8] = &fiq.r8;
r[ 9] = &fiq.r9;
r[10] = &fiq.r10;
r[11] = &fiq.r11;
r[12] = &fiq.r12;
} else {
r[ 8] = &usr.r8;
r[ 9] = &usr.r9;
r[10] = &usr.r10;
r[11] = &usr.r11;
r[12] = &usr.r12;
}
switch(mode) {
case Mode::FIQ: r[13] = &fiq.sp; r[14] = &fiq.lr; spsr = &fiq.spsr; break;
case Mode::IRQ: r[13] = &irq.sp; r[14] = &irq.lr; spsr = &irq.spsr; break;
case Mode::SVC: r[13] = &svc.sp; r[14] = &svc.lr; spsr = &svc.spsr; break;
case Mode::ABT: r[13] = &abt.sp; r[14] = &abt.lr; spsr = &abt.spsr; break;
case Mode::UND: r[13] = &und.sp; r[14] = &und.lr; spsr = &und.spsr; break;
default: r[13] = &usr.sp; r[14] = &usr.lr; spsr = nullptr; break;
}
}