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

The objectives of this chapter are to introduce the notion of a process a program in execution, which forms the basis of all computation; to describe the various features of processes, including scheduling, creation, and termination; to explore interprocess communication using shared memory and mes- sage passing. | CSC 221 Computer Organization and Assembly Language Lecture 14: Flow Control Instructions in Assembly Language Lecture 13: Review top: . . jmp top JMP Instruction JMP is an unconditional jump to a label that is usually within the same procedure. Syntax: JMP target Logic: EIP target Example: Clock Cycle Instruction Cycle Lecture 13: Review (cont.) LOOP Instruction The LOOP instruction creates a counting loop Syntax: LOOP target Logic: ECX ECX – 1 if ECX != 0, jump to target 00000000 66 B8 0000 mov ax,0 00000004 B9 00000005 mov ecx,5 00000009 66 03 C1 L1: add ax,cx 0000000C E2 FB loop L1 0000000E offset machine code source code Lecture 13: Review (cont.) Nested Loops .data count DWORD ? .code mov ecx,100 ; set outer loop count L1: mov count,ecx ; save outer loop count mov ecx,20 ; set inner loop count L2: . . loop L2 ; repeat the inner loop mov ecx,count ; restore outer loop count loop L1 ; repeat the outer loop Lecture Outline Assembly Language Examples: Control Flow JMP Instruction LOOP Instruction LOOP Example Summing an Integer Array Let’s Enjoy ASSEMBLY LANGUAGE Instruction Execution FLOW CONTROL Instruction Examples JMP Instruction LOOP Instruction Summary 7 Reference Most of the Slides are taken from Presentation: Chapter 4 and 5 Assembly Language for Intel-Based Computers, 4th Edition Kip R. Irvine (c) Pearson Education, 2002. All rights reserved. You may modify and copy this slide show for your personal use, or for use in the classroom, as long as this copyright statement, the author's name, and the title are not . | CSC 221 Computer Organization and Assembly Language Lecture 14: Flow Control Instructions in Assembly Language Lecture 13: Review top: . . jmp top JMP Instruction JMP is an unconditional jump to a label that is usually within the same procedure. Syntax: JMP target Logic: EIP target Example: Clock Cycle Instruction Cycle Lecture 13: Review (cont.) LOOP Instruction The LOOP instruction creates a counting loop Syntax: LOOP target Logic: ECX ECX – 1 if ECX != 0, jump to target 00000000 66 B8 0000 mov ax,0 00000004 B9 00000005 mov ecx,5 00000009 66 03 C1 L1: add ax,cx 0000000C E2 FB loop L1 0000000E offset machine code source code Lecture 13: Review (cont.) Nested Loops .data count DWORD ? .code mov ecx,100 ; set outer loop count L1: mov count,ecx ; save outer loop count mov ecx,20 ; set inner loop count L2: . . loop L2 ; repeat the inner loop mov ecx,count ; restore outer loop count loop L1 ; repeat the outer loop Lecture Outline Assembly Language Examples: Control Flow JMP Instruction LOOP Instruction LOOP Example Summing an Integer Array Let’s Enjoy ASSEMBLY LANGUAGE Instruction Execution FLOW CONTROL Instruction Examples JMP Instruction LOOP Instruction Summary 7 Reference Most of the Slides are taken from Presentation: Chapter 4 and 5 Assembly Language for Intel-Based Computers, 4th Edition Kip R. Irvine (c) Pearson Education, 2002. All rights reserved. You may modify and copy this slide show for your personal use, or for use in the classroom, as long as this copyright statement, the author's name, and the title are not changed.

TÀI LIỆU LIÊN QUAN