![Samsung S3F80P5X User Manual Download Page 156](http://html.mh-extra.com/html/samsung/s3f80p5x/s3f80p5x_user-manual_349401156.webp)
INSTRUCTION SET
S3F80P5_UM_ REV1.00
DA
— Decimal Adjust
DA
(Continued)
Example:
Given: Working register R0 contains the value 15 (BCD), working register R1 contains
27 (BCD), and address 27H contains 46 (BCD):
ADD R1,R0 ;
C
←
"0", H
←
"0", Bits 4–7 = 3, bits 0–3 = C, R1
←
3CH
DA R1
;
R1
←
3CH + 06
If addition is performed using the BCD values 15 and 27, the result should be 42. The sum is
incorrect, however, when the binary representations are added in the destination location using
standard binary arithmetic:
0 0 0 1 0 1 0 1
15
+
0 0 1 0 0 1 1 1 27
0 0 1 1 1 1 0 0 = 3CH
The DA instruction adjusts this result so that the correct BCD representation is obtained:
0 0 1 1 1 1 0 0
+
0 0 0 0 0 1 1 0
0 1 0 0 0 0 1 0 = 42
Assuming the same values given above, the statements
SUB 27H,R0
; C
←
"0", H
←
"0", Bits 4–7 = 3, bits 0–3 = 1
DA
@R1
; @R1
←
31–0
leave the value 31 (BCD) in address 27H (@R1).
6-34
Summary of Contents for S3F80P5X
Page 10: ......
Page 14: ......
Page 48: ...ADDRESS SPACE S3F80P5_UM_ REV1 00 NOTES 2 22 ...
Page 122: ...INTERRUPT STRUCTURE S3F80P5_UM_ REV1 00 NOTES 5 18 ...
Page 210: ...INSTRUCTION SET S3F80P5_UM_ REV1 00 NOTES 6 88 ...
Page 216: ...CLOCK AND POWER CIRCUITS S3F80P5_UM_ REV1 00 NOTES 7 6 ...
Page 266: ...COUNTER A S3F80P5_UM_ REV1 00 NOTES 12 8 ...
Page 290: ...EMBEDDED FLASH MEMORY INTERFACE S3F80P5_UM_ REV1 00 NOTES 14 18 ...
Page 321: ...DEVELOPMENT TOOLS S3F80P5_UM_ REV1 00 NOTES 19 10 ...