2024-11-28 01:10:49 -05:00
|
|
|
use crate::{Destination, Instruction, Operation};
|
2024-11-26 07:14:30 -05:00
|
|
|
|
|
|
|
pub struct LoadSelf {
|
2024-11-28 01:10:49 -05:00
|
|
|
pub destination: Destination,
|
2024-11-26 07:14:30 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
impl From<&Instruction> for LoadSelf {
|
|
|
|
fn from(instruction: &Instruction) -> Self {
|
2024-12-08 08:01:15 -05:00
|
|
|
let destination = instruction.a_as_destination();
|
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-08 08:01:15 -05:00
|
|
|
let (a, options) = load_self.destination.as_index_and_a_options();
|
2024-11-28 01:10:49 -05:00
|
|
|
|
2024-12-08 08:01:15 -05:00
|
|
|
Instruction {
|
|
|
|
operation: Operation::LOAD_SELF,
|
|
|
|
options,
|
|
|
|
a,
|
|
|
|
b: 0,
|
|
|
|
c: 0,
|
|
|
|
}
|
2024-11-26 07:14:30 -05:00
|
|
|
}
|
|
|
|
}
|