Title: Microprocessors
1Microprocessors
2ANL dest, source
- Logical AND for bytes.
- ANDs the bytes bit-by-bit.
- Binary zeros are used to MASK bits.
- Dest is usually A but may be direct address
- No effect on any flag.
A AND 0 0 A AND 1 A
0010 11010000 1011 mask 0000 1001
The mask.
3ANL C, source bit
- Logical AND for bits
- The CY flag is also called the Boolean
Accumulator.
Sweet code because the jump happens if either
bit is low!
4ORL dest, source
- Logical OR for bytes
- ORs the bytes bit-by-bit.
- Dest is usually A but may be direct address
- No effect on any flag.
0000 01000110 1000 0110 1100
5ORL C
- Logical OR for bits
- The CY flag is also called the Boolean
Accumulator.
6XRL dest, source
- Logical XOR for bytes
- XORs the bytes bit-by-bit.
- Dest is usually A but may be direct address
- No effect on any flag.
- Often used to clear a register (XRL A,A)
- Can be used with JZ to see if two registers have
same value
0101 01000111 1000 0010 1100
7CPL A
- Complements each bit in a byte.
- Only works on accumulator.
- Used to produce 1s complement.
8CJNE A, source, dest
- Jump while A not equal to source
- Also CJNE Rn, source, dest
- Also CJNE _at_Ri, source, dest
- Source can be data or direct address.
9CLR A
- Clears accumulator with a one byte instruction.
To clear registers CLR A (one byte)MOV R0,
A (one byte)MOV R1, A (one byte)
Compare to MOV R0, 0 (two bytes)MOV R1,
0 (two bytes)
10RR A and RL A
- Adjusts the position of bit values in the
accumulator.
11RRC A and RLC A
- Adjust the position of bit values in the
accumulator and CY flag.
12SWAP A
- Exchange the upper nibble with the lower nibble.
- Works only on accumulator.
13Convert packed BCD to ASCII
- First it will be converted to unpacked BCD.
- Then the unpacked BCD is ORed to 30H.
- The following program converts packed BCD to
ASCII.
14Start out with packed BCD.
15Save it for later.
16Mask the upper nibble.
17Stick on a 3 to make it ASCII.
18Stash the ASCII in R6
19Recall the original ASCII code.
20Mask the lower nibble.
21Rotate the upper nibble into the lower nibble.
22One SWAP instruction would to the same thing!
23Keep rotating.
24Keep rotating.
25Smack on the 3.
26Save it in R2. Done!
ASCII for 2 and for 9
27That's all folks!