tailieunhanh - Lecture Computer organization and assembly language: Chapter 22 - Dr. Safdar Hussain Bouk

After studying this chapter you will be able to understand: Explain the various functions of a typical web application, explain what is meant by the term "client/server" and how the client/server architecture can be implemented in a number of different ways, discuss the tradeoffs associated with various client/server architecture options,. | CSC 221 Computer Organization and Assembly Language Lecture 22: Arithmetic Instructions: Shift, Rotate, Multi. and Division Lecture 21: Review ASSEMBLY IMPLEMENTATION OF: Bit Test Instruction Copies bit n from an operand into the Carry flag Syntax: BT bitBase, n Conditional LOOP Instructions LOOPZ and LOOPE LOOPZ/LOOPE destination Logic: ECX ECX – 1 if ECX > 0 and ZF=1, jump to destination LOOPNZ and LOOPNE LOOPZ/LOOPE destination Logic: ECX ECX – 1 if ECX > 0 and ZF=0, jump to destination Lecture 21: Review ASSEMBLY IMPLEMENTATION OF: Block Structures Block-Structured IF Statements Compound Expressions with AND Compound Expressions with OR WHILE Loops REPEAT Loops (cont.) Lecture Outline Shift and Rotate Instructions Logical Shifts and Arithmetic Shifts SHL and SHR Instruction SAL and SAR Instructions ROL and ROR Instruction RCL and RCR Instructions Signed Overflow SHLD/SHRD Instructions Shift and Rotate Applications Lecture Outline Multiplication and Division Instructions MUL Instruction IMUL Instruction DIV Instruction Signed Integer Division Implementing Arithmetic Expresisons Logical vs Arithmetic Shifts A logical shift fills the newly created bit position with zero: An arithmetic shift fills the newly created bit position with a copy of the number’s sign bit: SHL Instruction The SHL (shift left) instruction performs a logical left shift on the destination operand, filling the lowest bit with 0. Operand types for SHL: SHL reg,imm8 SHL mem,imm8 SHL reg,CL SHL mem,CL (Same for all shift and rotate instructions) Fast Multiplication mov dl,5 shl dl,1 Shifting left 1 bit multiplies a number by 2 mov dl,5 shl dl,2 ; DL = 20 Shifting left n bits multiplies the operand by 2n For example, 5 * 22 = 20 SHR Instruction The SHR (shift right) instruction performs a logical right shift on the destination operand. The highest bit position is filled with a zero. mov dl,80 shr dl,1 ; DL = 40 shr dl,2 ; DL = 10 Shifting right n bits divides the operand by 2n SAL and SAR . | CSC 221 Computer Organization and Assembly Language Lecture 22: Arithmetic Instructions: Shift, Rotate, Multi. and Division Lecture 21: Review ASSEMBLY IMPLEMENTATION OF: Bit Test Instruction Copies bit n from an operand into the Carry flag Syntax: BT bitBase, n Conditional LOOP Instructions LOOPZ and LOOPE LOOPZ/LOOPE destination Logic: ECX ECX – 1 if ECX > 0 and ZF=1, jump to destination LOOPNZ and LOOPNE LOOPZ/LOOPE destination Logic: ECX ECX – 1 if ECX > 0 and ZF=0, jump to destination Lecture 21: Review ASSEMBLY IMPLEMENTATION OF: Block Structures Block-Structured IF Statements Compound Expressions with AND Compound Expressions with OR WHILE Loops REPEAT Loops (cont.) Lecture Outline Shift and Rotate Instructions Logical Shifts and Arithmetic Shifts SHL and SHR Instruction SAL and SAR Instructions ROL and ROR Instruction RCL and RCR Instructions Signed Overflow SHLD/SHRD Instructions Shift and Rotate Applications Lecture Outline Multiplication and Division Instructions MUL .

TÀI LIỆU LIÊN QUAN