# Binary coded decimal

From veswiki

**Binary coded decimal** (**BCD**) is a method by which 4-bit numbers are represented in digits 0-9, not 0-F. In the F8, BCD numbers can be added together using **ASD** or from memory using **AMD** (there is, however, no **AID** opcode, BCD Add Immediate). In a single byte, two digits can be stored, and the appropriate carry flags set if the number rolls over 99. Each digit is coded as the number + 6, so 0 should be loaded as 6, 1 as 7, 2 as 8, etc. This table shows the encoding for individual digits:

Digit | 4-bit Value ------------------- 0 | %0110 1 | %0111 2 | %1000 3 | %1001 4 | %1010 5 | %1011 6 | %1100 7 | %1101 8 | %1110 9 | %1111

It is very handy to use BCD when you need to present understandable numbers on screen like a score or similar data for the user/player.