CS370-signed 2's complement integers

130 days ago by trentonknight

x = 0FFF4A348h

y = 00076540h

z = ?

Most significant (highest) digit (F) ≥ (8).

Hexadecimal integer is negative so 

create the two’s complement of 0FFF4A348h.

H1 = 15 - 15; H2 = 15 - 15; H3 = 15 - 15; H4 = 15 - 4; H5 = 15 - 10; H6 = 15 - 3; H7 = 15 - 4; H8 = 15 - 8; print H1,H2,H3,H4,H5,H6,H7,H8; 
       
0 0 0 11 5 12 11 7
0 0 0 11 5 12 11 7
FFF4A348 => B5CB7 + 1 = B5CB8 
 
col4 = 11 * (16^4); col3 = 5 * (16^3); col2 = 12 * (16^2); col1 = 11 * (16^1); col0 = 8 * (16^0); A = (col0 + col1 + col2 + col3 + col4); -A; 
       
-744632
-744632

The Variable x loaded into EBX = -744632

-744632 loaded into EAX from EBX

ECX = y 00076540

col7 = 0 * (16^7); col6 = 0 * (16^6); col5 = 0 * (16^5); col4 = 7 * (16^4); col3 = 6 * (16^3); col2 = 5 * (16^2); col1 = 4 * (16^1); col0 = 0 * (16^0); A = (col0 + col1 + col2 + col3 + col4 + col5 + col6 + col7); A; 
       
484672
484672

ECX = y = -484672

EAX = y + x;

The sum is EAX = -259960

The Variable z is passed = -259960

EAX = (484672) + (-744632); EAX; D1 = -259960%16; D2 = -16248%16; D3 = -1016%16; D4 = -64%16; D5 = -4%16; D6 = -0.25%16; D7 = -0.015625%16; D8 = -0.0009765625%16; print D1, D2, D3, D4, D5, D6, D7, D8; 
       
8 8 8 0 12 15.75 15.984375 15.9990234375
8 8 8 0 12 15.75 15.984375 15.9990234375

Therefore EAX shows as FFFC0888