Microprocessors - PowerPoint PPT Presentation

1 / 27
About This Presentation
Title:

Microprocessors

Description:

The CY flag is also called the Boolean Accumulator. XRL dest, source. Logical XOR for bytes ... Only works on accumulator. Used to produce 1's complement. CJNE ... – PowerPoint PPT presentation

Number of Views:25
Avg rating:3.0/5.0
Slides: 28
Provided by: davidlk2
Category:

less

Transcript and Presenter's Notes

Title: Microprocessors


1
Microprocessors
  • Logical Operations Ch7

2
ANL 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.
3
ANL 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!
4
ORL 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
5
ORL C
  • Logical OR for bits
  • The CY flag is also called the Boolean
    Accumulator.

6
XRL 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
7
CPL A
  • Complements each bit in a byte.
  • Only works on accumulator.
  • Used to produce 1s complement.

8
CJNE 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.

9
CLR 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)
10
RR A and RL A
  • Adjusts the position of bit values in the
    accumulator.

11
RRC A and RLC A
  • Adjust the position of bit values in the
    accumulator and CY flag.

12
SWAP A
  • Exchange the upper nibble with the lower nibble.
  • Works only on accumulator.

13
Convert 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.

14
Start out with packed BCD.
15
Save it for later.
16
Mask the upper nibble.
17
Stick on a 3 to make it ASCII.
18
Stash the ASCII in R6
19
Recall the original ASCII code.
20
Mask the lower nibble.
21
Rotate the upper nibble into the lower nibble.
22
One SWAP instruction would to the same thing!
23
Keep rotating.
24
Keep rotating.
25
Smack on the 3.
26
Save it in R2. Done!
ASCII for 2 and for 9
27
That's all folks!
Write a Comment
User Comments (0)
About PowerShow.com