AOA - chapter 二: Data Representation

AOA - chapter 2: Data Representation
1.Decimal -> Binary:
1) Power of 2 down to 2**0
2) even/odd - divided by two algorithm
- first step:  even - 0, odd -1
- second step:  * / 2:  quotient even: prefix 0
                        quotient odd:  prefix 1
                        go back to second step
2. Low order -> least significant bit
    High order -> most significant bit
3.
-Bit
-Nibble represents: 4 bits
a) Binary coded decimal numbers
    b) Hexadecimal numbers
-Byte: 8bits
a)smallest addressable datum
b)byte values require two hexadecimal digits
c)usage:
- signed or unsigned numbers (-128..127, 0..255)
- ASCII character codes: 128 for ASCII characters, remaining 128 for European characters, graphic symbols, Greek letters, math symbols.
-Word:
a)Usage:
- unsigned and signed integer values
- unicode characters
-Double Word
a)Usage:
- unsigned and signed integer values
- pointer variable

4.Hexadecimal numbering system:
a)Advantage:
- compact
- simple to convert to binary and vice versa

5.Logical operation
a)Truth table
b)AND  -> used to force a zero result
c)OR   -> used to force a one result
b)XOR  -> more closer to the english meaning of 'or'
-> used to invert a bit.

c) OPERATION (source, dest)
=>  dest = dest OPERATION src

6. Two's complement notation
- High order bit is a sign bit: 0 - positive,  1-negative

7. Positive number - stored as standard binary value
8. Negative number - stored in the two's complement form
a)