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

34 lines
774 B
Rust
Raw Normal View History

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