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 8754037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:32:31+00:00 2026-06-13T13:32:31+00:00

I am making a virtual machine and a C compiler for it. Something I

  • 0

I am making a virtual machine and a C compiler for it. Something I do not get though is how most instruction sets have a IMUL and IDIV but not a ISUB and an IADD. Since sub is usually unsigned sub how could I do something like in x86

MOV EAX,1
MOV EDX,3
SUB EAX,EDX,EAX

and get -2?

  • 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-06-13T13:32:32+00:00Added an answer on June 13, 2026 at 1:32 pm

    Signed addition always produces the same bit patterns as output as unsigned addition — only the interpretation of them is different — so there is no need to have separate instructions for the two cases. It’s the same for subtraction.

    The general ADD and SUB instructions set two groups of condition flags such that you can later check for the outcome of a SUB-based comparison using ja/jb for unsigned comparisions or jg/jl for signed ones.

    (More precisely: If you already have instructions that do unsigned addition/subtraction modulo 2^wordlen, then the bit patterns they produce will be correct for every 2’s complement signed addition/subtraction whose true result is representable. Mathematically this is because unsigned integers and 2’s complement signed integers are just different choices of canonical representatives of residue classes modulo 2^wordlength).

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

Sidebar

Related Questions

Making a new site but something is happening to it in IE8. The social
Making a new site but something is happening to it in IE. I've purchased
I'm writing a virtual machine in C just for fun. Lame, I know, but
I'm making a stack based pseudo-assembler virtual machine. Here are some custom types used
Is it possible delay making a virtual machine role available untill startup tasks complete?
I'm tracking a Virtual PC virtual machine file (*.vmc) in git, and after making
I'm making something similar to Polyworld, which means I will be simulating virtual worlds
I am making a Virtual Machine and I just ran into a BIG problem.
I'm using virtualbox and trying to get my centos6 virtual machine onto the network.
I am making a virtual speedometer in android. I use the RotateAnimation() to rotate

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.