1 / 6

CEN 226 : Computer Organization & Assembly Language : CSC 225 (Lec#9)

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.

manon
Télécharger la présentation

CEN 226 : Computer Organization & Assembly Language : CSC 225 (Lec#9)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. 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.

  3. 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

  4. 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 xordx,dx ; movdx, 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

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

  6. 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.

More Related