2024-12-09 07:01:07 -05:00
|
|
|
use crate::{Instruction, Operation};
|
2024-11-26 07:14:30 -05:00
|
|
|
|
|
|
|
pub struct LoadList {
|
2024-12-09 07:01:07 -05:00
|
|
|
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 {
|
2024-12-09 07:01:07 -05:00
|
|
|
let destination = instruction.a;
|
2024-12-08 08:01:15 -05:00
|
|
|
let start_register = instruction.b;
|
2024-11-28 01:10:49 -05:00
|
|
|
|
2024-11-26 07:14:30 -05:00
|
|
|
LoadList {
|
2024-11-28 01:10:49 -05:00
|
|
|
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-09 07:01:07 -05:00
|
|
|
let metadata = Operation::LoadList as u8;
|
|
|
|
let a = load_list.destination;
|
2024-12-08 08:01:15 -05:00
|
|
|
let b = load_list.start_register;
|
2024-12-09 07:01:07 -05:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|