• 沒有找到結果。

# Kip R. Irvine

N/A
N/A
Protected

Share "Kip R. Irvine"

Copied!
32
0
0

(1)

## Chapter 6: Conditional Processing

### Kip R. Irvine

(2)

Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003.

(3)

## Boolean and Comparison Instructions Boolean and Comparison Instructions

### • CMP Instruction

(4)

Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003.

(5)

## AND Instruction AND Instruction

### AND

(6)

Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003.

(7)

## XOR Instruction XOR Instruction

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

(8)

Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003.

(9)

## Applications (1 of 5) (1 of 5)

### • Solution: Use the AND instruction to clear bit 5.

(10)

Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003.

(11)

## Applications (3 of 5) (3 of 5)

### work under Windows NT, 2000, or XP.

(12)

Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003.

(13)

## Applications (5 of 5) (5 of 5)

### ORing any number with itself does not change its value.

(14)

Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003.

(15)

## CMP Instruction (1 of 3) (1 of 3)

### cmp al,5; Carry flag set

(16)

Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003.

(17)

## CMP Instruction (3 of 3) (3 of 3)

### cmp al,5; Sign flag != Overflow flag

(18)

Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003.

(19)

## J J condcond Instruction Instruction

### • JECXZ jumps to a label if ECX equals 0

(20)

Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003.

(21)

## Jumps Based on Equality

(22)

Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003.

(23)

## Jumps Based on Signed Comparisons

(24)

Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003.

(25)

## Applications (2 of 5) (2 of 5)

### • Jump to label L1 if signed EAX is less than or equal to Val1

(26)

Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003.

(27)

## Applications (4 of 5) (4 of 5)

### EDI is even

(28)

Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003.

## Applications (5 of 5) (5 of 5)

(29)

### (EBX – ECX) is greater than zero.

(30)

Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003.

(31)

## String Encryption Program String Encryption Program

### Cipher text: «¢¢Äîä-Ä¢-ïÄÿü-Gs

(32)

Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003.

## BT (Bit Test) Instruction BT (Bit Test) Instruction

### jc L1; jump if Carry

First, in the Intel documentation, the encoding of the MOV instruction that moves an immediate word into a register is B8 +rw dw, where +rw indicates that a register code (0-7) is to

Second, a conditional jump instruction tests the flags and change the execution flow accordingly...

– The Parity flag is set when an instruction generates an even number of 1 bits in the low byte of the destination operand.. – The Auxiliary Carry flag is set when an

• A conditional jump instruction branches to a label when specific register or flag conditions are met.

 Calling program stores return address in a specific register.

In a nonparametric setting, we discuss identifiability of the conditional and un- conditional survival and hazard functions when the survival times are subject to dependent

Recycling Techniques are Available to Address Specific Pavement Distress and/or Pavement Structural Requirement.. Introduction to Asphalt Introduction

request even if the header is absent), O (optional), T (the header should be included in the request if a stream-based transport is used), C (the presence of the header depends on