Added clarifying curly braces.

This commit is contained in:
Seth Morabito committed 2012-10-12 14:34:18 -07:00
1 parent 365809459c
commit e012d97bb3
1 file changed
+11 -5
+11 -5
View File
@@ -1289,26 +1289,32 @@ public class Cpu implements InstructionTable {
/** /**
* Push an item onto the stack, and decrement the stack counter. * Push an item onto the stack, and decrement the stack counter.
* Silently fails to push onto the stack if SP is * Will wrap-around if already at the bottom of the stack (This
* is the same behavior as the real 6502)
*/ */
void stackPush(int data) throws MemoryAccessException { void stackPush(int data) throws MemoryAccessException {
bus.write(0x100 + sp, data); bus.write(0x100 + sp, data);
if (sp == 0) if (sp == 0) {
sp = 0xff; sp = 0xff;
else } else {
--sp; --sp;
}
} }
/** /**
* Pre-increment the stack pointer, and return the top of the stack. * Pre-increment the stack pointer, and return the top of the stack.
* Will wrap-around if already at the top of the stack (This
* is the same behavior as the real 6502)
*/ */
int stackPop() throws MemoryAccessException { int stackPop() throws MemoryAccessException {
if (sp == 0xff) if (sp == 0xff) {
sp = 0x00; sp = 0x00;
else } else {
++sp; ++sp;
}
return bus.read(0x100 + sp); return bus.read(0x100 + sp);
} }