Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement imul_r16_rm16 #55

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

implement imul_r16_rm16 #55

wants to merge 1 commit into from

Conversation

LinusU
Copy link
Contributor

@LinusU LinusU commented Sep 15, 2024

This probably needs some extra scrutiny because I have no idea what I'm doing here 😅

@LinusU LinusU mentioned this pull request Sep 15, 2024
27 tasks
@@ -808,32 +808,44 @@ pub fn imul_rm8(cpu: &mut CPU, mem: Mem, instr: &Instruction) {
cpu.regs.set16(Register::AX, res);
}

fn imul_trunc(x: i32, y: i32, _flags: &mut Flags) -> i32 {
fn imul_trunc_32(x: i32, y: i32, _flags: &mut Flags) -> i32 {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take a look at functions like this, which are generic over the types of integers:

pub(crate) fn and<I: Int>(x: I, y: I, flags: &mut Flags) -> I {

In particular that will let the 16-bit and 32-bit versions will share the (TODO) flag-setting code.

...Also, if your program is calling imul, it might need those flags set, so I filed #57 with some notes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants