Added JumpTo
This commit is contained in:
10
machine.hpp
10
machine.hpp
@@ -35,6 +35,7 @@ enum : int {
|
|||||||
DivideBy,
|
DivideBy,
|
||||||
ModulusBy,
|
ModulusBy,
|
||||||
SetTo,
|
SetTo,
|
||||||
|
JumpTo,
|
||||||
Print,
|
Print,
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
@@ -63,7 +64,7 @@ private:
|
|||||||
processCommand(command);
|
processCommand(command);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Arithmatic
|
// Arithmetic
|
||||||
case SetTo:
|
case SetTo:
|
||||||
memory[currentPosition] = command;
|
memory[currentPosition] = command;
|
||||||
break;
|
break;
|
||||||
@@ -83,10 +84,12 @@ private:
|
|||||||
memory[currentPosition] %= command;
|
memory[currentPosition] %= command;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case JumpTo:
|
||||||
|
currentPosition = command;
|
||||||
|
break;
|
||||||
case Print:
|
case Print:
|
||||||
handlePrint(command);
|
handlePrint(command);
|
||||||
State = NoCommand;
|
break;
|
||||||
return;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
std::terminate();
|
std::terminate();
|
||||||
@@ -124,6 +127,7 @@ private:
|
|||||||
|
|
||||||
// Double Argument Commands
|
// Double Argument Commands
|
||||||
case Print:
|
case Print:
|
||||||
|
case JumpTo:
|
||||||
case SetTo:
|
case SetTo:
|
||||||
case IncrementBy:
|
case IncrementBy:
|
||||||
case DecrementBy:
|
case DecrementBy:
|
||||||
|
|||||||
Reference in New Issue
Block a user