Minor changes
This commit is contained in:
parent
3b9170b54b
commit
8d56e4a953
1 changed files with 29 additions and 2 deletions
31
src/vcpu.c
31
src/vcpu.c
|
@ -35,14 +35,41 @@ void VCPUDecode(){
|
|||
void VCPUExecute(){
|
||||
// VCPUDump();
|
||||
switch(State.opcode >> 12){
|
||||
case 0x0: // Clear screen
|
||||
ScreenClear();
|
||||
case 0x0: // Clear screen or return from subroutine
|
||||
if(State.N == 0){ // Clear screen
|
||||
ScreenClear();
|
||||
}
|
||||
else { // Return from subroutine
|
||||
State.PC=State.stack[State.S];
|
||||
State.S--;
|
||||
}
|
||||
break
|
||||
;;
|
||||
case 0x1: // Jump
|
||||
State.PC=State.NNN;
|
||||
break
|
||||
;;
|
||||
case 0x2: // Call
|
||||
State.S++;
|
||||
State.stack[State.S]=State.PC;
|
||||
State.PC=State.NNN;
|
||||
break
|
||||
;;
|
||||
case 0x3: // SE: VX, byte
|
||||
if(State.V[State.X]==State.NN)
|
||||
State.PC+=2;
|
||||
break;
|
||||
;;
|
||||
case 0x4: // SNE: VX, byte
|
||||
if(State.V[State.X]!=State.NN)
|
||||
State.PC+=2;
|
||||
break;
|
||||
;;
|
||||
case 0x5: // SNE: VX, VY
|
||||
if(State.V[State.X]==State.V[State.Y])
|
||||
State.PC+=2;
|
||||
break;
|
||||
;;
|
||||
case 0x6:
|
||||
State.V[State.X]=State.NN;
|
||||
break
|
||||
|
|
Loading…
Add table
Reference in a new issue