Title: Decimal to Hexadecinmal
1Decimal to Hexadecinmal
Integer Remainder quotient 20085/16 1255
5/16 -gt 5 1255/16 78 7/16
-gt 7 78/16 4 14/16 -gt E
4/16 0 4/16 -gt 4 4E75
4E75 5 x 160 5 7 x 161
112 E x 162 3584 4
x 163 16384 20085
Read this direction
2Hex and Assembly Language
- Hex is the most useful numbering system when
writing assemblylanguage - Memory addresses usally specified in Hex form
- PC is 32 bits wide.
- -gt How much memory can the PC address?
- Answer 232 4294967296 bytes (4096 Mb)
- Only 24 of the 32 bits are used by the MC68000.
- -gt How much memory can the MC68000 address?
- Answer 224 16777216 bytes (16 Mb)
3Largest PC Number
- What is the largest Hex number that can be stored
in the PC? - Answer
- 16777215 converted to HEX -gt FFFFFF
4Binary to Hex
Binary Hex 0000 -gt 0 0001 -gt 1 0010 -gt 2 00
11 -gt 3 0100 -gt 4 0101 -gt 5 0110 -gt 6 0111 -gt 7 10
00 -gt 8 1001 -gt 9 1010 -gt A 1011 -gt B 1100 -gt C 11
01 -gt D 1110 -gt E 1111 -gt F
- Each Hex digit 4 Binary Digits
- Example
- 1100 0010 1001 0011 C293
5Binary Arithmetic
Arithmetic operations (, -, x, ) apply to all
number systems.
6Binary Arithmetic - Addition
Binary Decimal 00110 6 01011 11
10001 17 10110 22 01011 11
100001 33
7What happens when we run out of digits?
If we use 1 byte to represent each number what
restrictions does this impose on our system?
e.g. 10011100 156 10100111 167
101000011 323
Using 8 bits to represent a number -gt 156 167
is 71!
The largest number we can represent is 255
8The extra 1 left over is known as a Carry
To indicate that an operation requires more bits,
a bit in the CCR called the Carry Bit (C) is
set. CCR Condition Code Register lower 5
bits of the SR
9Binary Arithmetic - Subtraction
- There are special conditions that must be handled
when subtracting binary values. Fundamental to
subtraction is representing negative numbers. - Two Commen Methods
- Sign-Mantissa Method
- 2s Complement Encoding