Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

16-bit MCU and DSC Programmer’s Reference Manual
DS70157F-page 216 © 2005-2011 Microchip Technology Inc.
DAW.B
Decimal Adjust Wn
Implemented in: PIC24F PIC24H PIC24E dsPIC30F dsPIC33F dsPIC33E
X X X X X X
Syntax: {label:} DAW.B Wn
Operands: Wn [W0 ... W15]
Operation: If (Wn<3:0> > 9) or (DC = 1)
(Wn<3:0>) + 6 Wn<3:0>
Else
(Wn<3:0>) Wn<3:0>
If (Wn<7:4> > 9) or (C = 1)
(Wn<7:4>) + 6 Wn<7:4>
Else
(Wn<7:4>) Wn<7:4>
Status Affected: C
Encoding: 1111 1101 0100 0000 0000 ssss
Description: Adjust the Least Significant Byte in Wn to produce a binary coded decimal
(BCD) result. The Most Significant Byte of Wn is not changed, and the
Carry flag is used to indicate any decimal rollover. Register direct
addressing must be used for Wn.
The ‘s’ bits select the source/destination register.
Note 1: This instruction is used to correct the data format after two
packed BCD bytes have been added.
2: This instruction operates in Byte mode only and the .B
extension must be included with the opcode.
Words: 1
Cycles: 1
Example 1:
DAW.B W0 ; Decimal adjust W0
Before
Instruction
After
Instruction
W0 771A W0 7720
SR 0002 (DC = 1) SR 0002 (DC = 1)
Example 2:
DAW.B W3 ; Decimal adjust W3
Before
Instruction
After
Instruction
W3 77AA W3 7710
SR 0000 SR 0001 (C = 1)

e-Highlighter

Click to send permalink to address bar, or right-click to copy permalink.

Un-highlight all Un-highlight selectionu Highlight selectionh