1
0
dust/dust-lang/src/instruction/load_list.rs

43 lines
992 B
Rust
Raw Normal View History

use crate::{Instruction, Operation};
2024-11-26 07:14:30 -05:00
2024-12-17 07:10:47 -05:00
use super::InstructionData;
2024-11-26 07:14:30 -05:00
pub struct LoadList {
pub destination: u8,
pub start_register: u8,
2024-11-26 07:14:30 -05:00
}
impl From<&Instruction> for LoadList {
fn from(instruction: &Instruction) -> Self {
let destination = instruction.a_field();
let start_register = instruction.b_field();
2024-11-26 07:14:30 -05:00
LoadList {
destination,
2024-12-08 08:01:15 -05:00
start_register,
2024-11-26 07:14:30 -05:00
}
}
}
2024-12-17 07:10:47 -05:00
impl From<InstructionData> for LoadList {
fn from(instruction: InstructionData) -> Self {
let destination = instruction.a_field;
let start_register = instruction.b_field;
LoadList {
destination,
start_register,
}
}
}
2024-11-26 07:14:30 -05:00
impl From<LoadList> for Instruction {
fn from(load_list: LoadList) -> Self {
2024-12-11 09:26:38 -05:00
let operation = Operation::LOAD_LIST;
let a = load_list.destination;
2024-12-08 08:01:15 -05:00
let b = load_list.start_register;
Instruction::new(operation, a, b, 0, false, false, false)
2024-11-26 07:14:30 -05:00
}
}