2024-12-09 07:01:07 -05:00
|
|
|
use crate::{Instruction, Operation};
|
2024-11-26 07:14:30 -05:00
|
|
|
|
|
|
|
pub struct GetLocal {
|
2024-12-09 07:01:07 -05:00
|
|
|
pub destination: u8,
|
|
|
|
pub local_index: u8,
|
2024-11-26 07:14:30 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
impl From<&Instruction> for GetLocal {
|
|
|
|
fn from(instruction: &Instruction) -> Self {
|
2024-12-11 06:49:43 -05:00
|
|
|
let destination = instruction.a_field();
|
|
|
|
let local_index = instruction.b_field();
|
2024-11-28 01:10:49 -05:00
|
|
|
|
2024-11-26 07:14:30 -05:00
|
|
|
GetLocal {
|
2024-11-28 01:10:49 -05:00
|
|
|
destination,
|
2024-12-09 07:01:07 -05:00
|
|
|
local_index,
|
2024-11-26 07:14:30 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl From<GetLocal> for Instruction {
|
|
|
|
fn from(get_local: GetLocal) -> Self {
|
2024-12-11 06:49:43 -05:00
|
|
|
let operation = Operation::GetLocal;
|
2024-12-09 07:01:07 -05:00
|
|
|
let a = get_local.destination;
|
|
|
|
let b = get_local.local_index;
|
2024-11-28 01:10:49 -05:00
|
|
|
|
2024-12-11 06:49:43 -05:00
|
|
|
Instruction::new(operation, a, b, 0, false, false, false)
|
2024-11-26 07:14:30 -05:00
|
|
|
}
|
|
|
|
}
|