mirror of
https://git.sr.ht/~asya/copycat
synced 2024-11-16 04:28:42 -06:00
Fix effective address calculation
Signed-off-by: AsyaTheAbove <asya@waifu.club>
This commit is contained in:
parent
03055b819d
commit
54c6892527
|
@ -419,45 +419,11 @@ impl Processor {
|
||||||
BP_Disp16(disp) => self.registers.bp().wrapping_add_signed(disp),
|
BP_Disp16(disp) => self.registers.bp().wrapping_add_signed(disp),
|
||||||
BX_Disp16(disp) => self.registers.bx().wrapping_add_signed(disp),
|
BX_Disp16(disp) => self.registers.bx().wrapping_add_signed(disp),
|
||||||
};
|
};
|
||||||
(match segment {
|
((match segment {
|
||||||
SegmentOverride::ES => self.registers.es(),
|
SegmentOverride::ES => self.registers.es(),
|
||||||
SegmentOverride::CS => self.registers.cs(),
|
SegmentOverride::CS => self.registers.cs(),
|
||||||
SegmentOverride::SS => self.registers.ss(),
|
SegmentOverride::SS => self.registers.ss(),
|
||||||
SegmentOverride::DS | SegmentOverride::None => self.registers.ds(),
|
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"),
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue