UMBC | CMSC 391 -- Programming Microcontrollers |
Type | Instruction |
---|---|
Add | ADD A, direct |
ADD A, @Ri | |
ADD A, #data | |
ADD A, Rn | |
ADDC A, direct | |
ADDC A, @Ri | |
ADDC A, #data | |
ADDC A, Rn | |
Decimal Adjust | DA A |
Decrement | DEC A |
DEC direct | |
DEC @Ri | |
DEC Rn | |
Division | DIV A/B |
Increment | INC A |
INC direct | |
INC DPTR | |
INC @Ri | |
INC Rn | |
Multiplication | MUL AB |
Subtraction | SUBB A,@Ri |
SUBB A, #data | |
SUBB A, Rn |
Instruction | Carry | Axillary Carry | Overflow |
---|---|---|---|
ADD | C | AC | OV |
ADDC | C | AC | OV |
ANL C, direct | C | ||
CJNE | C | ||
CLR C | C = 0 | ||
CPL | C = not C | ||
DA A | C | ||
DIV | C = 0 | OV | |
MOV C, direct | C | ||
MUL | C = 0 | OV | |
ORL C, direct | C | ||
RLC | C | ||
RRC | C | ||
SETB C | C = 1 | ||
SBBC | C | AC | OV |
Suppose we want to add -50 to -50. 5010 is 3216. Two's complement makes it CE16. Converting that binary and adding looks like:
1 1 11 <-- Carry 1100 1110 1100 1110 ----------- 1 0001 1100
2000: .org 2000h start: 2000: 74 39 mov A, #39h ; ASCII '9' 2002: 54 0F ANL A, #0Fh ; convert to BCD - 2004: 24 09 ADD A, #09h ; Now it holds 0001 ; We want it to be 18h (Pac 2006: D4 DA A ; Add 6 to the value, giving ; 00011000b or 18h
QUOTEDescription: MUL AB multiplies the unsigned eight-bit integers in the Accumulator and register B. The low-order byte of the sixteen-bit product is left in the Accumulator, and the high-order byte in B. If the product is greater than 255 (0FFH) the overflow flag is set; otherwise it is cleared. The carry flag is always cleared. Example: Originally the Accumulator holds the value 80 (50H). Register B holds the value 160 (0A0H). The instruction, MUL AB will give the product 12,800 (3200H), so B is changed to 32H (00110010B) and the Accumulator is cleared. The overflow flag is set, carry is cleared.
UNQUOTE
QUOTEDescription: DIV AB divides the unsigned eight-big integer in the Accumulator by the unsigned eight-bit integer in register B. The Accumulator receives the integer part of the quotient; register B the integer remainder. The carry and OV flags will cleared. Exception: if B had originally contained 00H, the values returned in the Accumulator and B-register will be undefined and the overflow flag will be set. The carry flag is cleared in any case. Example: The Accumulator contains 251 (0FBH or 11111011B) and B contains 18 (12H or 00010010B). The instruction, DIV AB will leave 13 in the Accumulator (0DH or 00001101B) and the value 17 (11H or 00010001B) in B, since 251 = (13 x 18) + 17. Carry and OV both be cleared.
UNQUOTE