Departemen Ilmu Komputer FMIPA IPB 2006. Conditional Jump Instruction A conditional jump instruction transfer control to a destination address when a.

Slides:



Advertisements
Similar presentations
Jump Condition.
Advertisements

Instruction Set of 8086 Engr. M.Zakir Shaikh
CDP ECE Spring 2000 ECE 291 Spring 2000 Lecture 4: The 80x86 Instruction Set Architecture Registers-Instructions Constantine D. Polychronopoulos.
Conditional Jumps Jcond destination  Cond refers to a flag condition  Destination should be a local label  Destination must be within –128 to +127 bytes.
NEG Instruction Change operand content into two’s complement (negative value) and stored back into its operand mov bl, b neg bl; bl = mov.
ACOE2511 Assembly Language Arithmetic and Logic Instructions.
Microprocessor Systems Design I Instructor: Dr. Michael Geiger Fall 2013 Lecture 14 Compare instructions; conditional execution.
Assembly Language :CSC 225 (Lec#4: Flag Register and Conditional Statements) By Dr. Syed Noman.
Gursharan Singh Tatla 21-Nov-20101www.eazynotes.com.
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 6: Conditional Processing (c) Pearson Education, All rights reserved. You may modify.
1 ICS 51 Introductory Computer Organization Fall 2006 updated: Oct. 2, 2006.
Assembly Language for Intel-Based Computers
CS2422 Assembly Language & System Programming October 17, 2006.
Flow Control Instructions
Conditional Processing If … then … else While … do; Repeat … until.
Lecture 3 Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.
Low Level Programming Lecturer: Duncan Smeed Low Level Program Control Structures.
Comparing and Branching ifs and loops part A. JMP instruction Consider the forever loop: for ( ; ; ) { … } How can we accomplish this in Assembler?
Microprocessors Monday, Apr. 13 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#5) By Dr. Syed Noman.
Sahar Mosleh California State University San MarcosPage 1 Review.
Dr. José M. Reyes Álamo 1.  Review: ◦ of Comparisons ◦ of Set on Condition  Statement Labels  Unconditional Jumps  Conditional Jumps.
Assembly Language for Intel-Based Computers, 6 th Edition Chapter 6: Conditional Processing (c) Pearson Education, All rights reserved. You may modify.
(Flow Control Instructions)
Executing and Linking an assembly program. Lesson plan Review Program logic and control Practice exercise Assembling, Linking and Executing Programs Practice.
Decision Structures – Code Generation Lecture 24 Mon, Apr 18, 2005.
Computer Architecture and Operating Systems CS 3230 :Assembly Section Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Assembly Language. Symbol Table Variables.DATA var DW 0 sum DD 0 array TIMES 10 DW 0 message DB ’ Welcome ’,0 char1 DB ? Symbol Table Name Offset var.
Chapter 5 Branching and Looping.
EEL 3801 Part V Conditional Processing. This section explains how to implement conditional processing in Assembly Language for the 8086/8088 processors.
LEA instruction The LEA instruction can be used to get the offset address of a variable Example ORG 100h MOV AL, VAR1 ; check value of VAR1 by moving it.
Conditional Loop Instructions, Conditional Structures
3.4 Addressing modes Specify the operand to be used. To generate an address, a segment register is used also. Immediate addressing: the operand is a number.
Assembly 06. Outline cmp (review) Jump commands test mnemonic bt mnemonic Addressing 1.
2/20/2016CAP 2211 Flow Control Instructions. 2/20/2016CAP 2212 Transfer of Control Flow control instructions are used to control the flow of a program.
Chapter 7 Bit Manipulation. 7.1 Logical Operations.
1 Intel 8086 MICROPROCESSOR ARCHITECTURE. 2 Features It is a 16-bit μp has a 20 bit address bus can access up to 2 20 memory locations (1 MB). It.
Comparison Instructions Test instruction –Performs an implied AND operation between each of the bits in 2 operands. Neither operand is modified. (Flags.
Jumps, Loops and Branching. Unconditional Jumps Transfer the control flow of the program to a specified instruction, other than the next instruction in.
Computer and Information Sciences College / Computer Science Department CS 206 D Computer Organization and Assembly Language.
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics Principles of Computers 18 th Lecture Pavel Ježek, Ph.D.
Selection and Iteration Chapter 8 S. Dandamudi To be used with S. Dandamudi, “Introduction to Assembly Language Programming,” Second Edition, Springer,
K.K. Leung Fall 2008Introductory Pentium Programming1 Pentium Architecture: Introductory Programming Kin K. Leung
CS-401 Computer Architecture & Assembly Language Programming
Data Transfers, Addressing, and Arithmetic
Homework Reading Labs PAL, pp
Microprocessor and Assembly Language
Morgan Kaufmann Publishers Computer Organization and Assembly Language
INSTRUCTION SET.
More on logical instruction and
Assembly Language Programming Part 2
16.317: Microprocessor System Design I
Microprocessor and Assembly Language
CS-401 Assembly Language Programming
Flags Register & Jump Instruction
Machine-Level Programming: Control Flow
Shift & Rotate Instructions)
Program Logic and Control
Program Logic and Control
Homework Reading Machine Projects Labs PAL, pp
Flow Control Instructions
University of Gujrat Department of Computer Science
EECE.3170 Microprocessor Systems Design I
Computer Organization and Assembly Language
Assembly Language for Intel 8086 Jump Condition
CNET 315 Microprocessor & Assembly Language
Chapter 7 –Program Logic and Control
Carnegie Mellon Ithaca College
CS201- Lecture 8 IA32 Flow Control
Chapter 7 –Program Logic and Control
Presentation transcript:

Departemen Ilmu Komputer FMIPA IPB 2006

Conditional Jump Instruction A conditional jump instruction transfer control to a destination address when a flag condition is true Jconddestination Destination address must be -128 to +127 bytes from the current location Cond refer to flag condition, identifying the state of one or more flag

ConditionMeaning CCarry flag set NCCarry flag not set (clear) ZZero flag set NZZero flag not set (clear) flags are set by arithmetic, comparison, and boolean instruction. Each conditional jump instruction checks one or more flags, returning a result true or false. If the result is TRUE, otherwise, the program does nothing and continue to the next instruction.

cmp ax, bx; compare ax, bx je equal not equal :; continue here if ax <> bx. jmp exit equal :; jump here if ax = bx... exit :; always end up here

Case 1 : AX = 5 and BX = 5 Case 2 : AX = 5 and BX = 5

Table of Conditional Jump Instruction MnemonicDescriptionFlag Condition JZJump if zeroZF = 1 JEJump if equal (if op1 = op2) JNZJump if not zeroZF = 0 JNEJump if not equal (if op1 <> op2) JAJump if above (if op1 > op2)CF = 0 and ZF = 0 JAEJump if above or equal (if op1 >= op2) CF = 0 JBJump if below (if op1 < op2)CF = 1 JCJump if carry JBEJump if below or equal (if op1 <= op2 ) CF = 1 and ZF = 1 JCXZjump if CX = 0CX = 0

Example 1 : larger of two number We might want to compare unsigned value in AX and BX and move the larger one to DX

-a A1:0100 mov ax,50 13A1:0103 mov dx,ax 13A1:0105 mov bx,60 13A1:0108 cmp ax,bx 13A1:010A jae 10E 13A1:010C mov dx,bx 13A1:010E int 20 13A1:0110

-a A1:0100 mov ax,50 13A1:0103 mov dx,ax 13A1:0105 mov bx,10 13A1:0108 cmp ax,bx 13A1:010A jae 10e 13A1:010C mov dx,bx 13A1:010E int 20 13A1:0110

Latihan 1 After the following instruction are executed, what will be the values of AL and BL ? -a A1:0100 mov al,6B 13A1:0102 mov bl,3F 13A1:0104 and ax,0FB6 13A1:0107 cmp al,bl 13A1:0109 ja 10F 13A1:010B mov al,bl 13A1:010D jmp A1:010F mov bl,al 13A1:0111 int 20 13A1:0113

Latihan 2 After the following instruction are executed, what will be the values of AL and BL ? -a A1:0100 mov al,3F 13A1:0102 mov bl,6B 13A1:0104 or bl,0F 13A1:0107 sub al,bl 13A1:0109 jb 10F 13A1:010B mov al,1 13A1:010D jmp A1:010F mov bl,1 13A1:0111 int 20 13A1:0113

Tugas Buat Program yang Membendingkan 3 bilangan di register al, bl, cl mana yang merupakan bilangan terkecil. Hasilnya di simpan dalam alamat 150, 151, 152 secara berurut mulai dari yang terkecil Nilai awal dari al, bl, cl secara berurut adalah 27, 3, 11 hasil di print screen berserta nama, nama kelompok dan nrp pada alamat 160(nama), 170(nama kelompok), 180 (nrp) Hint : Gunakan fungsi cmp dan jump