1 / 20

ECE 265 – Lecture 7

ECE 265 – Lecture 7. The M68HC11 Basic Instruction Set Logical, Shift and Rotate, Data Testing. Lecture Overview. The M68HC11 Basic Instruction Set The Logical instructions to perform Boolean operations The Data Testing The Shift and Rotate instructions

Download Presentation

ECE 265 – Lecture 7

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ECE265 ECE 265 – Lecture 7 The M68HC11 Basic Instruction Set Logical, Shift and Rotate, Data Testing

  2. Lecture Overview • The M68HC11 Basic Instruction Set • The Logical instructions to perform Boolean operations • The Data Testing • The Shift and Rotate instructions • REF: Chapter 3 and the appendix that details the instructions. ECE265

  3. The Logical Instructions • Instructions to perform Boolean operations on data • Instructions for AND NOT and OR operation ECE265

  4. AND operation • Description: AND the A (or B) accumulator with the operand of the instruction • CC effects: N Z set per result • Forms: ANDA (opr) ANDB(opr) • And can be immediate mode or a memory location • ANDA #$FF What does this do? • ANDB #$00 What does this do? ECE265

  5. AND operation and masking • Masking is keeping only those bits you are interested in. The reaming bits are “masked” out. • Example • ANDA #$0F Keep the lower 4 bits of accum A • If the A accumulator contains a value of $34 • Then this operation is A 0011 0100 • AND-ed with 0000 1111 • giving 0000 0100 ECE265

  6. OR operation • Description: OR the A (or B) accumulator with the operand of the instruction • CC effects: N Z set per result • Forms: ORA (opr) ORB(opr) • And can be immediate mode or a memory location • ORAA #$FF What does this do? • ORAB #$00 What does this do? ECE265

  7. Exclusive OR operation • Description: Exclusive OR the A (or B) accumulator with the operand of the instruction • CC effects: N Z set per result • Forms: EORA (opr) EORB(opr) • And can be immediate mode or a memory location • EORA #$FF What does this do? • EORB #$00 What does this do? ECE265

  8. The NOT or invert operation • Description: Can complement a complete byte in an accumulator or memory. This is a bitwise complement. • CC effect: N V set per data, V cleared, C set • Forms: COMA COMB COM (opr) ECE265

  9. Examples • Example instructions Accum A has val $1C Memory $D330 val $2F • (a) ANDA $D330 • (b) EORA $D330 • (c) ORAA $D330 ECE265

  10. Data Testing Instructions • Will cover the Bit Test and Setting and Clearing of bits. • The branch will be covered with branches. ECE265

  11. Bit test • Description: Compare the operand with the accumulator contents and set the CC bits. Performs a bitwise logical AND. • CC effects: N Z eval V cleared • Forms: BITA (opr) BITB (opr) • If operand is equal to accumulator Z is set • See Appendix A of text for a complete description ECE265

  12. Clear and set bits in memory • Description: Set or Clear bits in memory according to a mask given in the instruciton. • CC effects: N Z V cleared • Forms: BSET (opr) (mask) BCLR (opr) (mask) • Example BSET $0035 $09 • Performs a logical OR of the contents of location $35 • With $09 and puts the result back in the location. • This example will set bits 0 and 3 of the data byte. ECE265

  13. Shift and Rotate Instructions • The instructions perform arithmetic and logical shifts and also rotate the data. ECE265

  14. The effect of shift and rotates • What do the instructions do? ECE265

  15. What is the real effect of • Arithmetic shifts? • Do arithmetic shifts have the effect of multiplicaiton? • Unique aspects of logical shifts • Can also do double shifts ECE265

  16. The instructions • Arithmetic Shifts • ASL (opr) ASLA ASLB ASLD • ASR (opr) ASRA ASRB • Logical Shifts • LSL (opr) LSLA LSLB LSLD • LSR (opr) LSRA LSRB LSRD • Rotates • ROL (opr) ROR (opr) • ROLA ROLB RORA RORB • There is no rotate of D ECE265

  17. Example of use • Interesting data manipulation ECE265

  18. Example of use • Exchange the upper and lower nibbles of a byte in memory. ECE265

  19. Lecture summary • Have covered • The Logical instructions to perform Boolean operations • The Data Testing • The Shift and Rotate instructions ECE265

  20. Assignment • Problems Chapter 3 page 87 • Problem 19 • Problem 21 ECE265

More Related