CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#9) By Dr. Syed Noman.

Slides:



Advertisements
Similar presentations
Array : To store multiple value in one variable, “but value must be homogenous or similar type” is called array. We can say in other word Arrangement of.
Advertisements

Flow of Control Instruction/Control structure Looping structure Looping structure Branching structure Branching structure For assembly language program.
Program.(08) Write a program Divide 5 by 2 and display answer value and remainder value. 1 Store 5 into AL 2 Store BL into 2 3Divide AL Into BL 4Store.
There are two types of addressing schemes:
1 Assembly Instructions Assembly language instructions may involve mnemonics, labels, variables, constants, and directives. Examples are as follows. here.
Subroutines: Passing Arguments Using the Stack. Passing Arguments via the Stack Arguments to a subroutine are pushed onto the stack. The subroutine accesses.
Computer Organization & Assembly Language
Video systems (continue). Practice Modify the program to get a string from a keyboard to display the input string on the middle of the screen with reverse.
Assembly Language :CSC 225 (Lec#4: Flag Register and Conditional Statements) By Dr. Syed Noman.
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#4)
Assembly Language for Intel-Based Computers Chapter 5: Procedures Kip R. Irvine.
Irvine: Assembly Language for Intel-Based Computers (1999) Symbolic Constants Equal-sign Directive EQU Directive TEXTEQU Directive.
Practical Session 3. The Stack The stack is an area in memory that its purpose is to provide a space for temporary storage of addresses and data items.
Kip Irvine: Assembly Language for Intel-Based Computers Overview Stack Operations (PUSH and POP) Procedures Procedure Parameters Software Interrupts MS-DOS.
Kip Irvine: Assembly Language for Intel-Based Computers
Irvine, Kip R. Assembly Language For Intel-Based Computers.data string db "This is a string." COUNT = ($–string) ; calculate string length.code mov cx,COUNT.
8.4 Instruction Execution Times TOBIN PROC FAR SUB AX,AX MOV DX,AX MOV CX,4 NEXTD: PUSH CX SUB BP,BP MOV CX,4 GETNUM: RCL BX,1 RCL BP,1 LOOP GETNUM.
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#8) By Dr. Syed Noman.
Assembly Language – Lab 5
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#6)
Procedures and the Stack Chapter 5 S. Dandamudi To be used with S. Dandamudi, “Introduction to Assembly Language Programming,” Second Edition, Springer,
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#7)
Introduction to Subroutines. All the combinations in which a subroutine can be written 1. The subroutine may be: a. Internal or b. External 2. The type.
Stack Operations LIFO structure (last-in,first-out) –The last value put into the stack is the first value taken out Runtime stack –A memory array that.
COSC 456 Lesson 8 Cool Codes ADD AL,SIAL AL + SI ADD AL,[SI]AL AL + [SI] INC BXBX BX + 1 INC [BX]Ambiguity error INC BYTE PTR [BX][BX] [BX] + 1 INC WORD.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
BIOS and DOS Programming in DOS INT 10 and 21H. Interrupts There are some extremely useful subroutines within BIOS or DOS that are available to the user.
Lecture 4 Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.
The Stack and Introduction to Procedures Dr. Konstantinos Tatas and Dr. Haris Haralambous.
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#5) By Dr. Syed Noman.
5. Assembly Language. Basics of AL Program data Pseudo-ops Array Program structures Data, stack, code segments.
Arithmetic Flags and Instructions
L AB 2. P ROGRAM STRUCTURE The assembly language program consist of code, data and stack. Data segment: contains all the variable definition..Data Code.
Chapter 8 Advanced Programming Applications Objectives: Linking separate object files together Creating and using an object code library Predicting the.
Lab 6 Stack.
Irvine, Kip R. Assembly Language for Intel-Based Computers. Chapter 7: Integer Arithmetic Slides to Accompany Assembly Language for Intel-Based Computers,
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
ICS312 Set 12 Subroutines: Passing Arguments Using the Stack.
Assembly Language Lecture 2. Lecture Outline Program Structure Memory models Data Segment Stack Segment Code Segment Input and Output Instructions INT.
Microprocessors CSE- 341 Dr. Jia Uddin Assistant Professor, CSE, BRAC University Dr. Jia Uddin, CSE, BRAC University.
I NTEL 8086 M icroprocessor بسم الله الرحمن الرحيم 1.
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#7) By Dr. Syed Noman.
Procedures Dr. Hadi Al Saadi Large problems can be divided into smaller tasks to make them more manageable A procedure is the ASM equivalent of a Java.
Stack Operations Dr. Hadi AL Saadi.
Computer Architecture and Assembly Language
Computer Architecture CST 250
Format of Assembly language
COURSE OUTCOMES OF Microprocessor and programming
Lecture 4 Control Flow Structures (LOOPS)
Assembly Language Programming Part 2
CS-401 Computer Architecture & Assembly Language Programming
(The Stack and Procedures)
Arithmetic Instructions
Chapter 4: Instructions
BIC 10503: COMPUTER ARCHITECTURE
Stack and Subroutines Module M17.1 Section 11.2.
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Microprocessor and Assembly Language
Practical Session 4.
(The Stack and Procedures)
Microprocessor Lab CSL1543 0:0:2
Morgan Kaufmann Publishers Computer Organization and Assembly Language
University of Gujrat Department of Computer Science
X86 Assembly Review.
CS-401 Computer Architecture & Assembly Language Programming
UNIT-II Assembly Language Programs Involving Logical
Process.
(The Stack and Procedures)
ICS51 Introductory Computer Organization
Computer Architecture and System Programming Laboratory
Presentation transcript:

CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#9) By Dr. Syed Noman

Push and Pop instructions The stack is typically used to save and restore the values of registers used in subprograms. The stack is an area of memory (RAM) where we can temporarily store items. We say that we "push the item onto the stack" to save it. To get the item back from the stack, we "pop the item from the stack". The 8086 provides push and pop instructions for storing and retrieving items from the stack. 2

Number display program logic 1234 / 10 : quotient = 123, remainder = 4 (push 4) 123 / 10: quotient = 12, remainder = 3 (push 3) 12 / 10: quotient = 1, remainder = 2 (push 2) 1 / 10: quotient = 0, remainder = 1 (push 1) Top of Stack

Number display program.model small.stack 100h.code my proc mov ax,1234 mov dx,0 mov bx,10 mov cx,0 again: div bx push dx xor dx,dx ; mov dx, 0 inc cx cmp ax,0 jne again mov ah,2 next: pop dx add dl,30h int 21h loop next mov ax,4c00h int 21h my endp end my 4

Assignment 3a Write an assembly language program that print the numbers from an array of length 5. 5

Assignment 3b Write an assembly language program that prints after reversing the case of the letters only, in an string inputted by the user in the buffer. 6