Signed Decimal to Hex conversion (cont)
Step 3 (negative decimal number): Need to do more if decimal number was negative. To get the final representation, we will use the trick that:
- (+N) = -Ni.e., if you take the negative of a positive number, get Negative number. If converting to SM format, set Sign bit to One: 20 = % 00010100 => % 10010100 = $94If converting to 1s complement, complement each bit. 20 = % 00010100 => % 11101011 = $EBIf converting to 2s complement, complement and add one. 20 = % 00010100 => %11101011 + 1 = %11101100 = $EC