Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6670191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:14:22+00:00 2026-05-26T03:14:22+00:00

Say I got EDX = 0xA28 EAX = 0x0A280105 I run this ASM code

  • 0

Say I got

EDX = 0xA28

EAX = 0x0A280105

I run this ASM code

IMUL EDX

which to my understand only uses EAX.. if one oprand is specified

So in C code it should be like

EAX *= EDX;

correct?

After looking in debugger.. I found out EDX got altered too.

0x0A280105 * 0xA28 = 0x67264A5AC8

in debugger

EAX = 264A5AC8
EDX = 00000067

now if you take the answer 0x67264A5AC8 and split off first hex pair, 0x67 264A5AC8
you can clearly see why the EDX and EAX are the way they are.

Okay so a overflow happens.. as it cannot store such a huge number into 32 bits. so it starts using extra 8 bits in EDX

But my question is how would I do this in C code now to get same results?

I’m guessing it would be like

EAX *= EDX;
EDX = 0xFFFFFFFF - EAX; //blah not good with math manipulation like this.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:14:22+00:00Added an answer on May 26, 2026 at 3:14 am

    The IMUL instruction actually produces a result twice the size of the operand (unless you use one of the newer versions that can specify a destination). So:

    imul 8bit -> result = ax, 16bits
    imul 16bit -> result = dx:ax, 32bits
    imul 32bit -> result = edx:eax, 64bits
    

    To do this in C will be dependent on the compiler, but some will work doing this:

    long result = (long) eax * (long) edx;
    eax = result & 0xffffffff;
    edx = result >> 32;
    

    This assumes a long is 64 bits. If the compiler has no 64 bit data type then calculating the result becomes much harder, you need to do long multiplication.

    You could always inline the imul instruction.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I understand how to code this all. My question is: say I got a
Say I've got this array: MyArray(0)=aaa MyArray(1)=bbb MyArray(2)=aaa Is there a .net function which
Let's say I got a collection (simple grid) of invaders: In this image, only
Say I got this C++ code: class class1{ class2 *x; } class class2{ class1
Say I've got a class like this: class Test { int x; SomeClass s;
Say I got something like this.. bool isPatched; I have a few other GUI's
Say I got two Controllers like this Table1sController , and Table2sController . With corresponding
Let say I got the following code in my SqlUserRepository : var user =
Let's say i got this ContextMenu: <Style x:Key={x:Type ContextMenu} TargetType={x:Type ContextMenu}> <Setter Property=VerticalOffset Value=-10/>
Let say I got this function : void int Calculate(double[] array) {} And in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.