
Here the number is based on 16, and is represented in a single character:
Decimal
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Hex
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
The hexadecimal system can break the eight bits of a byte into two blocks of four bits, since 15 is a
four bit number: 1111 binary. The first block indicates the number of complete units of ‘15’, and the
second indicates the ‘remainder’ - and this is where the elegance of binary begins to emerge.
Reconsidering the table that introduced binary notation
Decimal
Binary CPC464-ese
Hexadecimal
0
0
fl
0
1
1
*
1
2
10
*fl
2
3
11
**
3
4
100
*flfl
4
5
101
*fl*
5
6
110
**fl
6
7
111
***
7
8
1000
*flflfl
8
9
1001
*flfl*
9
10
1010
*fl*fl
A
11
1011
*fl**
B
12
1100
**flfl
C
13
1101
**fl*
D
14
1110
***fl
E
15
1111
****
F
16
10000
*flflflfl
10
An 8-bit number 11010110 can be subdivided, and then considered as two 4-bit numbers known as
nibbles , Hex D6. Throughout this guide a hex based number will be introduced by the ‘&’ symbol eg
&D6, and this is the number base most commonly used by programmers using assembly language
techniques. An assembly language program is the nearest most programmers get to programming
directly in machine code, since the assembly language program allows the program to use simple
letter ‘mnemonics’ to specify the actual machine code ‘numbers’.
When using HEX, you must first work out the value of the first digit to obtain the number of 16’s in
the final number, and then add the remainder designated by the second ‘half of the hex notation to
obtain the total decimal equivalent. There’s a powerful temptation to regard a number like &D6 as
13+6, or 136. But it’s (13x16)+(6) = 214.
Summary of Contents for CPC464
Page 1: ......
Page 102: ...PRINT 10 AND 12 Results in 8 PRINT 10 AND 1000 Results in 8 again ...
Page 118: ...TO DO DRAW THIS PAGE ...
Page 219: ...actual value may be made to vary during the execution of a program ...
Page 240: ...Text and WINDOW planner Mode 2 80 Columns ...
Page 241: ......