Detailed reference for the DAW instruction in PIC18 ISA.
Adjust the contents of WREG after a BCD addition or subtraction, converting the result to a valid Binary‑Coded‑Decimal (BCD) value.
; After successfull ADDWF, WREG harbours BCD result needing adjustment
DAW ; adjust WREG to BCD format; After successfull ADDWF, WREG harbours BCD result needing adjustment
DAW ; adjust WREG to BCD format; After SUBWF, WREG contains BCD difference requiring correction
DAW ; adjust the subtraction result in WREG; After SUBWF, WREG contains BCD difference requiring correction
DAW ; adjust the subtraction result in WREG; When WREG holds a correctly‑formatted BCD value already
DAW ; no change, but flags updated; When WREG holds a correctly‑formatted BCD value already
DAW ; no change, but flags updated; Preloading WREG with a literal and then adjusting
MOVLW 0x09
DAW ; literal is already BCD, no adjustment needed; Preloading WREG with a literal and then adjusting
MOVLW 0x09
DAW ; literal is already BCD, no adjustment needed; Following an addition that set carry, WREG is adjusted and carry cleared
ADDWF 0x12, 1, 0
DAW ; adjust resulting BCD and update carry; Following an addition that set carry, WREG is adjusted and carry cleared
ADDWF 0x12, 1, 0
DAW ; adjust resulting BCD and update carry