{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

eee410_lecture11 - EEE 410 Microprocessors I Fall 04/05...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
EEE 410 – Microprocessors I Fall 04/05 – Lecture Notes # 11 Outline of the Lecture BCD Addition and correction ASCII addition and subtraction Rotate Instructions BCD A DDITION AND CORRECTION Ex1: MOV AL,17H Ex2: MOV AL,52H ADD AL,28H ADD AL,87H result=3FH result=D9H (not a BCD) (not a BCD) To solve these problems add 6 to the lower nibble of 3FH and upper nibble of D9H. 3F + 6 = 45H D9 + 60 = 139H Now the results are BCD. There is a special instruction to do this correction. DAA ;Decimal Adjust for Addition DAA will add 6 to the lower or upper nibble if needed. Ex: DATA1 DB 47H DATA2 DB 25H DATA3 DB ? MOV AL,DATA1 ;AL holds the first BCD operand MOV BL,DATA2 ;BL holds the second BCD ADD AL,BL ;BCD addition DAA ;adjust for BCD addition MOV DATA3,AL ;store result in correct BCD form DAA works only after the ADD and ADC instruction. (E.g. it doesn’t work with INC instruction) In addition the destination operand must be AL in order for DAA to work. Note that in BCD addition the operands can never have any digit greater than 9. Summary of DAA action 1. If after an ADD or ADC instruction the lower nibble (4 bits) is greater than 9, or if AF=1, add 0110 to the lower 4 bits. 2. If the upper nibble is greater than 9, or CF =1, add 0110 to the upper nibble.
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern