1. Trang chủ
  2. » Giáo Dục - Đào Tạo

Lecture Computer organization and assembly language - Lecture 17: Boolean and Comparison Instructions - TRƯỜNG CÁN BỘ QUẢN LÝ GIÁO DỤC THÀNH PHỐ HỒ CHÍ MINH

10 6 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

• Documenting Procedures • Example: SumOf Procedure • CALL and RET Instructions.. • The CALL instruction calls a procedure.[r]

(1)

CSC 221

Computer Organization and Assembly Language

Lecture 17:

(2)

Lecture 16: Review • Creating Procedures

• Documenting Procedures • Example: SumOf Procedure • CALL and RET Instructions

• The CALL instruction calls a procedure

– pushes offset of next instruction on the stack and

copies the address of the called procedure into EIP

(3)

Lecture 16: Review

(cont.)

• Nested Procedure Calls

• Local and Global Labels

• Flowchart Symbols

(4)

Lecture Outline

Boolean and Comparison Instructions

– CPU Status Flags – AND Instruction – OR Instruction – XOR Instruction – NOT Instruction – Applications

(5)

Status Flags - Review

• The Zero flag is set when the result of an operation

equals zero

• The Carry flag is set when an instruction generates a

result that is too large (or too small) for the destination operand

• The Sign flag is set if the destination operand is negative,

(6)

Status Flags - Review

• The Overflow flag is set when an instruction generates an

invalid signed result (bit carry is XORed with bit Carry)

• The Parity flag is set when an instruction generates an

even number of bits in the low byte of the destination operand

• The Auxiliary Carry flag is set when an operation

(7)

AND Instruction

• Performs a Boolean AND operation between each

pair of matching bits in two operands

• Syntax:

AND destination, source

(same operand types as MOV)

0 1 1 0 0 1 1 0 0 1 AND

unchanged cleared

(8)

OR Instruction

• Performs a Boolean OR operation between each pair

of matching bits in two operands

• Syntax:

OR destination, source

OR

0 1 1 1 0 0 1 1 0 1 1 1

OR

(9)

XOR Instruction

• Performs a Boolean exclusive-OR operation between

each pair of matching bits in two operands

• Syntax:

XOR destination, source

XOR

0 1 1 1 0 0 1 1 0 1 0

XOR

inverted unchanged

(10)

NOT Instruction

• Performs a Boolean NOT operation on a single

destination operand

• Syntax:

NOT destination

NOT

0 1 1 1 1 0 0

NOT

Ngày đăng: 01/04/2021, 17:53

Xem thêm:

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w