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.

Slides:



Advertisements
Similar presentations
Registers of the 8086/ /2002 JNM.
Advertisements

Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU
10-1 ECE 424 Design of Microprocessor-Based Systems Haibo Wang ECE Department Southern Illinois University Carbondale, IL Subroutine and Interrupt.
Intel Computer Architecture Presented By Jessica Graziano.
Subroutines: Passing Arguments Using the Stack. Passing Arguments via the Stack Arguments to a subroutine are pushed onto the stack. The subroutine accesses.
More about procedures and Video Processing. Lesson plan Review existing concepts More about procedures and boolean expression Video processing.
Memory model ModelDescription SMALLCode in one segment Data in one segment MEDIUMCode in > 1 segment Data in one segment COMPACTCode in one segment Data.
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)
Irvine: Assembly Language for Intel-Based Computers (1999) Symbolic Constants Equal-sign Directive EQU Directive TEXTEQU Directive.
Outline Learning Assembly by an Example.  Program Formats  Some Simple Instructions  Assemble and Execute Learning Another Example  Data Definition.
1 ICS 51 Introductory Computer Organization Fall 2006 updated: Oct. 2, 2006.
Kip Irvine: Assembly Language for Intel-Based Computers Overview Stack Operations (PUSH and POP) Procedures Procedure Parameters Software Interrupts MS-DOS.
ICS312 Set 11 Introduction to Subroutines. All the combinations in which a subroutine can be written 1. The subroutine may be: a. Internal or b. External.
CS2422 Assembly Language & System Programming September 26, 2006.
INTRODUCTION TO IBM PC ASSEMBLY LANGUAGE
Assembly Language – Lab 5
Assembly Programming Timothy C. Rice Jr., MIT. OUTLINE Basic Structure Exit to Dos Print Character Clear Screen Change BG & FG Color Set Curser Location.
ICS312 Set 4 Program Structure. Outline for a SMALL Model Program Note the quiz at the next lecture will be to reproduce this slide.MODEL SMALL.586 ;
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.
1/2002JNM1 Positional Notation (Hex Digits). 1/2002JNM2 Problem The 8086 has a 20-bit address bus. Therefore, it can access 1,048,576 bytes of memory.
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.
Faculty of Engineering, Electrical Department,
Lecture 4 ( Assembly Language).
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#5) By Dr. Syed Noman.
ICS312 Set 14 MACROS. Macros The program structure is similar to that for procedures. As for procedure names, macro names represent a group of instructions.
Debuggers A program needed when writing any type of code Displays the contents of memory Lets you view registers and variables and see how they change.
Executing and Linking an assembly program. Lesson plan Review Program logic and control Practice exercise Assembling, Linking and Executing Programs Practice.
UHD:CS2401: A. Berrached1 The Intel x86 Hardware Organization.
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#9) By Dr. Syed Noman.
21/11/2005CAP2411 Input & Output Instructions CPU communicates with the peripherals through I/O registers called I/O ports. There are 2 instructions, IN.
Introduction To Computer Architecture Jean-Michel RICHER University of Angers France January 2003.
Subroutines: Passing Arguments Using the Stack. Passing Arguments via the Stack Arguments to a subroutine are pushed onto the stack. The subroutine accesses.
Lecture 9 (The Stack and Procedures). 1 Lecture Outline Introduction The Stack The PUSH Instruction The POP Instruction Terminology of Procedures INDEC.
In Class Program Write, assemble and test a program: –Use the DB directive to define the following list of numbers and name it array: 31h, 32h, 33h, 34h.
Microprocessors used in Personal Computers. The Memory Map of a Personal Computers Transient Program Area (TPA): Holds the operating system (interrupt.
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.
Introduction to Microprocessors Chapter 3. Programming Model (8086)  Shows the various internal registers that are accessible to the programmer.
B ASIC INSTRUCTIONS. I NTRODUCTION There are over a hundred instructions in the instruction set for the 8086 CPU; there are also instructions designed.
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.
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.
Internal Programming Architecture or Model
Preliminary to Assembly Language Programming CE 140 A1/A2 28 June 2003.
Microprocessors CSE- 341 Dr. Jia Uddin Assistant Professor, CSE, BRAC University Dr. Jia Uddin, CSE, BRAC University.
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.
Format of Assembly language
Part of the Assembler Language Programmers Toolbox
Instruction Execution Cycle
Microprocessor and Assembly Language
Microprocessor and Assembly Language
Computer Organization & Assembly Language
Microprocessor Lab CSL1543 0:0:2
(The Stack and Procedures)
Introduction to Assembly Language
Lecture 4 ( Assembly Language).
CS-401 Computer Architecture & Assembly Language Programming
(The Stack and Procedures)
Flow Control Instructions
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Microprocessor and Assembly Language
Flags Carry flag Overflow Parity flag Direction Interrupt enable
8051 ASSEMBLY LANGUAGE PROGRAMMING
(The Stack and Procedures)
Intel 8086.
Procedures & Macros Introduction Syntax Difference.
(The Stack and Procedures)
Procedures and Macros.
Presentation transcript:

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 segment: contains a program’s instructions..code name (name is optional) Stack segment: to set aside a block of memory to store the stack.stack size

P ROGRAM STRUCTURE.MODEL SMALL.STACK 100H.DATA ; data definition go here.CODE MAIN PROC ;instruction go here MAIN ENDP ;other procedures go here END MAIN

P ROGRAMMING S TEPS Editor.ASM File Assembler Linker.OBJ File.EXE File Create source program Assemble source program Link object program

Q4: Complete the following assembly program: This program should load the value 6438h in AX and the value 9BC8h in BX, then add the two registers and store the result in CX. A) Write the assembly program in notepad++ and save it as PGM7.asm

Q4:.MODEL SMALL.STACK 100H.CODE MAIN PROC MOV AX, 6438h ; Store 6438h in AX MOVBX, 9BC8h ; Store 9BC8h in BX ADD AX,BX ; Adding AX and BX MOV CX,AX ; Store the result in CX ;DOS Exit MOV AH,4CH INT 21H MAIN ENDP END MAIN

Q4: Use the usual steps to run the program, then using the DEBUG program, follow and answer the following: How to use DEBUG : C:\ DEBUG PGM7.EXE 1.Display the register by write command –R 2.What are the content of AX, BX, CX and DX registers at the beginning ? 3.Trace Instructions by typing –T. 4.After each instruction, write down the changes in registers and the values of the flags (refer to the table below). 5.When you reach INT 21h, press: P, after that complete tracing using T command. 6.Finally exit the DEBUG by typing -Q

Q4: Display the register by write command –R What are the content of AX, BX, CX and DX registers at the beginning ? Next instruction

Q4: Trace Instructions by typing –T. After each instruction, write down the changes in registers and the values of the flags (refer to the table below). Addition result Addition affects on flags CB9 0000

FLAGSSYMBOLSET (1)SET (0) OVERFLOW FLAG OFOVNV DIRECTION FLAG DFDNUP INTERRUPT FLAG IFEIDI SIGN FLAG SFNGPL ZERO FLAG ZFZRNZ AUXILIARY FLAG AFACNA PARITY FLAG PFPEPO CARRY FLAG CFCYNC TRAP FLAG TF

Q4: When you reach INT 21h, press: P, after that complete tracing using T command. Finally if you want to exit the DEBUG, type :Q