diff --git a/src/processor/mod.rs b/src/processor/mod.rs index 5e92334..41a1061 100644 --- a/src/processor/mod.rs +++ b/src/processor/mod.rs @@ -419,45 +419,11 @@ impl Processor { BP_Disp16(disp) => self.registers.bp().wrapping_add_signed(disp), BX_Disp16(disp) => self.registers.bx().wrapping_add_signed(disp), }; - (match segment { + ((match segment { SegmentOverride::ES => self.registers.es(), SegmentOverride::CS => self.registers.cs(), SegmentOverride::SS => self.registers.ss(), SegmentOverride::DS | SegmentOverride::None => self.registers.ds(), - } as u64) << 4 + offset as u64 + } as u64) << 4) + offset as u64 } - - // fn rm8(&self, memory: &mut Memory, modrm: ModRM, displacement: u16) -> u8 { - // match modrm & ModRM::MOD_MASK { - // ModRM::MOD_DIRECT => self.registers.rm8_gp(modrm), - // ModRM::MOD_0 => memory.read_u8(match modrm & ModRM::RM_REG_MASK { - // ModRM::RM_REG_0 => self.registers.bx() + self.registers.si(), - // ModRM::RM_REG_1 => self.registers.bx() + self.registers.di(), - // ModRM::RM_REG_2 => self.registers.bp() + self.registers.si(), - // ModRM::RM_REG_3 => self.registers.bp() + self.registers.di(), - // ModRM::RM_REG_4 => self.registers.si(), - // ModRM::RM_REG_5 => self.registers.di(), - // ModRM::RM_REG_7 => self.registers.bx(), - // _ => unreachable!(), - // }.into()), - // _ => unimplemented!("register-indirect addressing modes are not implemented"), - // } - // } - - // fn r8(&self, memory: &mut Memory, modrm: ModRM) -> u8 { - // match modrm & ModRM::MOD_MASK { - // ModRM::MOD_DIRECT => self.registers.r8_gp(modrm), - // ModRM::MOD_0 => memory.read_u8(match modrm & ModRM::REG_MASK { - // ModRM::REG_0 => self.registers.bx() + self.registers.si(), - // ModRM::REG_1 => self.registers.bx() + self.registers.di(), - // ModRM::REG_2 => self.registers.bp() + self.registers.si(), - // ModRM::REG_3 => self.registers.bp() + self.registers.di(), - // ModRM::REG_4 => self.registers.si(), - // ModRM::REG_5 => self.registers.di(), - // ModRM::REG_7 => self.registers.bx(), - // _ => unreachable!(), - // }.into()), - // _ => unimplemented!("register-indirect addressing modes are not implemented"), - // } - // } }