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

Thông tin cơ bản

Định dạng
Số trang 10
Dung lượng 75,41 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

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

Trang 1

CSC 221

Computer Organization and Assembly

Language

Lecture 17:

Boolean and Comparison

Instructions

Trang 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

• The RET instruction returns from a procedure

Trang 3

Lecture 16: Review

(cont.)

• Nested Procedure Calls

• Local and Global Labels

• Flowchart Symbols

• USES Operator

Trang 4

Lecture Outline

Boolean and Comparison Instructions

– CPU Status Flags

– AND Instruction

– OR Instruction

– XOR Instruction

– NOT Instruction

– Applications

– TEST Instruction

– CMP Instruction

Trang 5

Status Flags - Review

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

equals zero

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

operand

• The Sign flag is set if the destination operand is negative, and it is clear if the destination operand is positive

Trang 6

Status Flags - Review

invalid signed result (bit 7 carry is XORed with bit 6

Carry)

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

produces a carry out from bit 3 to bit 4

Trang 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 0 1 1 1 0 1 1

0 0 0 0 1 1 1 1

0 0 0 0 1 0 1 1

AND

unchanged cleared

AND

Trang 8

OR Instruction

• Performs a Boolean OR operation between each pair

of matching bits in two operands

• Syntax:

OR destination, source

OR

0 0 1 1 1 0 1 1

0 0 0 0 1 1 1 1

0 0 1 1 1 1 1 1

OR

set unchanged

Trang 9

XOR Instruction

• Performs a Boolean exclusive-OR operation between each pair of matching bits in two operands

• Syntax:

XOR destination, source

XOR

0 0 1 1 1 0 1 1

0 0 0 0 1 1 1 1

0 0 1 1 0 1 0 0

XOR

inverted unchanged

XOR is a useful way to toggle (invert) the bits in an

operand

Trang 10

NOT Instruction

• Performs a Boolean NOT operation on a single destination operand

• Syntax:

NOT destination

NOT

0 0 1 1 1 0 1 1

1 1 0 0 0 1 0 0

NOT

inverted

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

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

TÀI LIỆU LIÊN QUAN

🧩 Sản phẩm bạn có thể quan tâm

w