2024-12-09 07:01:07 -05:00
|
|
|
use crate::{Instruction, Operation};
|
2024-11-26 07:14:30 -05:00
|
|
|
|
|
|
|
pub struct LoadSelf {
|
2024-12-09 07:01:07 -05:00
|
|
|
pub destination: u8,
|
2024-11-26 07:14:30 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
impl From<&Instruction> for LoadSelf {
|
|
|
|
fn from(instruction: &Instruction) -> Self {
|
2024-12-09 07:01:07 -05:00
|
|
|
let destination = instruction.a;
|
2024-11-28 01:10:49 -05:00
|
|
|
|
|
|
|
LoadSelf { destination }
|
2024-11-26 07:14:30 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl From<LoadSelf> for Instruction {
|
|
|
|
fn from(load_self: LoadSelf) -> Self {
|
2024-12-09 07:01:07 -05:00
|
|
|
let metadata = Operation::LoadSelf as u8;
|
|
|
|
let a = load_self.destination;
|
|
|
|
let b = 0;
|
|
|
|
let c = 0;
|
2024-11-28 01:10:49 -05:00
|
|
|
|
2024-12-09 07:01:07 -05:00
|
|
|
Instruction { metadata, a, b, c }
|
2024-11-26 07:14:30 -05:00
|
|
|
}
|
|
|
|
}
|