Working...

This commit is contained in:
Werner
2021-12-11 17:32:54 -03:00
parent 222d90004c
commit c14a20391f
12 changed files with 1895 additions and 10 deletions

24
Source/Instruction.rs Normal file
View File

@ -0,0 +1,24 @@
use crate::Machine;
use crate::Payload::PayloadType;
use crate::Types::Byte;
pub struct Instruction {
pub code: Byte,
pub name: String,
pub payload: PayloadType,
pub function: InstructionFunction,
}
pub type InstructionFunction = fn(machine: &mut Machine) -> bool;
impl Instruction {
#[inline]
pub fn New(code: Byte, name: &str, payload: PayloadType, function: InstructionFunction) -> Self {
Self {
code,
name: name.to_string(),
payload,
function,
}
}
}