]> Joshua Wise's Git repositories - fpgaboy.git/blob - daa.txt
Fix some carry-related bugs and a typo in insn_alu_a.
[fpgaboy.git] / daa.txt
1
2 --------------------------------------------------------------------------------
3 |           | C Flag | HEX value in | H Flag | HEX value in | Number  | C flag |
4 | Operation | Before | upper digit  | Before | lower digit  | added   | After  |
5 |           | DAA    | (bit 7-4)    | DAA    | (bit 3-0)    | to byte | DAA    |
6 |------------------------------------------------------------------------------|
7 |           |   0    |     0-9      |   0    |     0-9      |   00    |   0    |
8 |   ADD     |   0    |     0-8      |   0    |     A-F      |   06    |   0    |
9 |           |   0    |     0-9      |   1    |     0-3      |   06    |   0    |
10 |   ADC     |   0    |     A-F      |   0    |     0-9      |   60    |   1    |
11 |           |   0    |     9-F      |   0    |     A-F      |   66    |   1    |
12 |   INC     |   0    |     A-F      |   1    |     0-3      |   66    |   1    |
13 |           |   1    |     0-2      |   0    |     0-9      |   60    |   1    |
14 |           |   1    |     0-2      |   0    |     A-F      |   66    |   1    |
15 |           |   1    |     0-3      |   1    |     0-3      |   66    |   1    |
16 |------------------------------------------------------------------------------|
17 |       SUB |   0    |     0-9      |   0    |     0-9      |   00    |   0    |
18 |       SBC |   0    |     0-8      |   1    |     6-F      |   FA    |   0    |
19 |       DEC |   1    |     7-F      |   0    |     0-9      |   A0    |   1    |
20 |       NEG |   1    |     6-F      |   1    |     6-F      |   9A    |   1    |
21 |------------------------------------------------------------------------------|
22
23 Flags:
24 C: See instruction.
25 N: Unaffected.
26 P/V: Set if Acc. is even parity after operation, reset otherwise.
27 H: See instruction.
28 Z: Set if Acc. is Zero after operation, reset otherwise.
29 S: Set if most significant bit of Acc. is 1 after operation, reset otherwise.
This page took 0.031342 seconds and 4 git commands to generate.