Enum strontium::machine::instruction::Instruction
source · pub enum Instruction {
Show 14 variants
HALT,
LOAD {
value: RegisterValue,
register: String,
},
MOVE {
source: String,
destination: String,
},
COPY {
source: String,
destination: String,
},
PUSH {
value: RegisterValue,
destination: String,
},
APPEND {
value: Vec<RegisterValue>,
destination: String,
},
CALCULATE {
method: CalculationMethod,
operand1: String,
operand2: String,
destination: String,
},
COMPARE {
method: ComparisonMethod,
operand1: String,
operand2: String,
destination: String,
},
BITWISE {
method: BitwiseMethod,
},
JUMP {
destination: usize,
},
JUMPC {
destination: usize,
conditional_address: String,
},
INTERRUPT {
interrupt: Interrupt,
},
CALL {},
RETURN {},
}
Expand description
Represents a callable machine instruction
Variants§
HALT
Stop all further execution
LOAD
Load a numeric value into a register
MOVE
Move a value from one register address to another
COPY
Copy a value from a register to memory or vice versa
PUSH
Fields
§
value: RegisterValue
The value to be pushed
Add a value to an array in a register
APPEND
Fields
§
value: Vec<RegisterValue>
The values to append
Add a list of values to an array in a register
CALCULATE
Perform a calculation on two registers and write the result to a third
COMPARE
BITWISE
Fields
§
method: BitwiseMethod
JUMP
Set the program counter to the given value
JUMPC
Set the program counter to a value if the given byte has the value of 1
INTERRUPT
Set off an interrupt, for example to print a character to standard output
CALL
Fields
RETURN
Fields
Trait Implementations§
source§impl Clone for Instruction
impl Clone for Instruction
source§fn clone(&self) -> Instruction
fn clone(&self) -> Instruction
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for Instruction
impl Debug for Instruction
source§impl<'de> Deserialize<'de> for Instruction
impl<'de> Deserialize<'de> for Instruction
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Into<Opcode> for Instruction
impl Into<Opcode> for Instruction
source§impl PartialEq for Instruction
impl PartialEq for Instruction
source§fn eq(&self, other: &Instruction) -> bool
fn eq(&self, other: &Instruction) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for Instruction
impl Serialize for Instruction
impl StructuralPartialEq for Instruction
Auto Trait Implementations§
impl RefUnwindSafe for Instruction
impl Send for Instruction
impl Sync for Instruction
impl Unpin for Instruction
impl UnwindSafe for Instruction
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more