• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 186
  • Last Modified:

help on assembly language

   Hi there,

        I need ur answer for these questions.

         Why does -32,768 an issue? and
           why does it work anyway?
1 Solution
I don't really understand what your question is.

-32,768 is 8000H. This is the largest negative number. CPUs generally represent signed integers in "two's complement" notation. The MSB represents the sign and the remaining bits represent the value.

Two's complement is acheived by negating the value and adding 1. This helps in doing binary math.

0000H = 0
0001H = 1
7FFFH = 32,767
8000H = -32,768
8001H = -32,767
FFFFH = -1

If you want the absolute value of the negative number simply complement and add 1. Thus
FFFFH = -1

Complement of FFFFH = 0000H
0000H + 1 = 0001H

To make a positive number negative we repeat the process:

Complement of 0001H = FFFEH

Makes life simple at the electrical level inside the CPU.

This is much less obvious when you're dealing with the decimal equivalents, makes perfect sense at the hex/binary level.


Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now