2024-12-17 18:11:06 -05:00
|
|
|
use crate::{Instruction, Operation};
|
2024-11-26 07:14:30 -05:00
|
|
|
|
|
|
|
pub struct Test {
|
2024-12-17 18:11:06 -05:00
|
|
|
pub operand_register: u8,
|
2024-11-28 05:36:10 -05:00
|
|
|
pub test_value: bool,
|
2024-11-26 07:14:30 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
impl From<&Instruction> for Test {
|
|
|
|
fn from(instruction: &Instruction) -> Self {
|
2024-12-17 18:11:06 -05:00
|
|
|
let operand_register = instruction.b_field();
|
2024-12-11 06:49:43 -05:00
|
|
|
let test_value = instruction.c_field() != 0;
|
2024-12-08 08:01:15 -05:00
|
|
|
|
2024-11-26 07:14:30 -05:00
|
|
|
Test {
|
2024-12-17 18:11:06 -05:00
|
|
|
operand_register,
|
2024-12-08 08:01:15 -05:00
|
|
|
test_value,
|
2024-11-26 07:14:30 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl From<Test> for Instruction {
|
|
|
|
fn from(test: Test) -> Self {
|
2024-12-17 18:11:06 -05:00
|
|
|
Instruction::new(
|
|
|
|
Operation::TEST,
|
|
|
|
0,
|
|
|
|
test.operand_register,
|
|
|
|
test.test_value as u8,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
)
|
2024-11-26 07:14:30 -05:00
|
|
|
}
|
|
|
|
}
|