chore: remove Immediate from Immediate::{Word, Byte, Operand}

It's already clear that its an Immediate value
without the prefix.
This commit is contained in:
2025-05-14 10:40:52 +09:00
parent a61b82fe22
commit b5c178ea61
4 changed files with 84 additions and 86 deletions

View File

@@ -1,6 +1,6 @@
use core::fmt;
use crate::instructions::ImmediateOperand;
use crate::instructions::Operand;
#[derive(Debug, Clone)]
#[allow(dead_code)]
@@ -35,9 +35,9 @@ pub type RegisterId = u8;
#[allow(dead_code)]
impl Register {
/// Find the register corresponding to the 8086 bytecode ID
pub fn by_id(id: ImmediateOperand) -> Self {
pub fn by_id(id: Operand) -> Self {
match id {
ImmediateOperand::Byte(b) => match b {
Operand::Byte(b) => match b {
0b000 => Self::AL,
0b001 => Self::CL,
0b010 => Self::DL,
@@ -48,7 +48,7 @@ impl Register {
0b111 => Self::BH,
_ => panic!("Invalid 8bit register ID encountered"),
},
ImmediateOperand::Word(w) => match w {
Operand::Word(w) => match w {
0b000 => Self::AX,
0b001 => Self::CX,
0b010 => Self::DX,