assembly negtive number | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

assembly negtive number

In assembly if i create a variable a a DB 200 a stores 200 which is 1100 1000 in binary which is 200 or - 56 in decimal. Can someone explain how do i get -56

3rd Apr 2020, 7:49 PM
tibi
tibi - avatar
1 Answer
+ 2
There are different ways to deal with negative numbers. One way is the so called 2's complement. You have -56. 56 in binary is 00111000 Now invert the digits (0 gets 1 and 1 gets 0): 11000111 Add 1 to the number: 11001000 So -56 = 1100 1000 I think this page explains it very good: https://ryanstutorials.net/binary-tutorial/binary-negative-numbers.php
3rd Apr 2020, 8:10 PM
Denise Roßberg
Denise Roßberg - avatar