UNIT-II Assembly Language Programs Involving Logical

Slides:



Advertisements
Similar presentations
Defining and processing tables
Advertisements

Instruction Set of 8086 Engr. M.Zakir Shaikh
Flow of Control Instruction/Control structure Looping structure Looping structure Branching structure Branching structure For assembly language program.
COMP 2003: Assembly Language and Digital Logic
Writing and reading files. Creating a file on a disk Get a file handle from system Use INT 21H function 3C to create a directory entry for the file Use.
ACOE2511 Assembly Language Arithmetic and Logic Instructions.
80x86 Instruction Set Dr. Qiang Lin.
The 8086 Assembly Programming Data Allocation & Addressing Modes
Gursharan Singh Tatla 21-Nov-20101www.eazynotes.com.
8086 : INSTRUCTION SET By, Pramod Sunagar Assistant Professor
Flow Control Instructions
9-1 ECE 424 Design of Microprocessor-Based Systems Haibo Wang ECE Department Southern Illinois University Carbondale, IL x86 Instructions Part.
Review Questions Chapters What TUTOR command is used to enter a string of ASCII bytes into memory? /MA 2.What are the names of the 8086 index.
Microcomputer & Interfacing Lecture 3
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.
Strings, Procedures and Macros
5. Assembly Language. Basics of AL Program data Pseudo-ops Array Program structures Data, stack, code segments.
Arithmetic Flags and Instructions
Processing String Data and Binary Data (continue)
Click to add Title Comunicación y Gerencia Click To add Subtitle Click to add Text Fundamentals of Assembly Language.
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.
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.
Review of Assembly language. Recalling main concepts.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
I NTEL 8086 M icroprocessor بسم الله الرحمن الرحيم 1.
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#7) By Dr. Syed Noman.
Microprocessors CSE- 341 Dr. Jia Uddin Assistant Professor, CSE, BRAC University Dr. Jia Uddin, CSE, BRAC University.
Introduction to assembly programmıng language
Format of Assembly language
Chapter Nov-2010
Presentation on Real Mode Memory Addressing
Data Transfers, Addressing, and Arithmetic
Today we are going to discuss about,
Instruction Set of 8086 Microprocessor
Lecture 4 Control Flow Structures (LOOPS)
EE3541 Introduction to Microprocessors
Morgan Kaufmann Publishers Computer Organization and Assembly Language
INSTRUCTION SET.
Assembly IA-32.
INSTRUCTION SET.
Assembly Language Programming Part 2
Microprocessor and Assembly Language
Microprocessor & Interfacing
INSTRUCTION SET OF 8086 PAWAN KUMAR SINGH.
اصول اساسی برنامه نویسی به زبان اسمبلی
Arithmetic Instructions
Defining Types of data expression Dn [name] expression Dn [name]
Symbolic Instruction and Addressing
X86’s instruction sets.
ارايه دهنده : حسن عسكرزاده
8086 Registers Module M14.2 Sections 9.2, 10.1.
اصول اساسی برنامه نویسی به زبان اسمبلی
Microprocessor Lab CSL1543 0:0:2
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Symbolic Instruction and Addressing
Shift & Rotate Instructions)
Program Logic and Control
Microprocessor Lab CSL1543 0:0:2
Program Logic and Control
Symbolic Instruction and Addressing
ADDITION Register Addition. ADD AX,BX AX=AX+BX 2. Immediate Addition.
University of Gujrat Department of Computer Science
X86 Assembly Review.
High-level language structures
Chapter 6 –Symbolic Instruction and Addressing
CNET 315 Microprocessor & Assembly Language
Chapter 7 –Program Logic and Control
Chapter 8: Instruction Set 8086 CPU Architecture
Chapter 7 –Program Logic and Control
UNIT-II ADDRESSING MODES & Instruction set
Presentation transcript:

UNIT-II Assembly Language Programs Involving Logical Branch & Call Instructions Sorting, Evaluation Of Arithmetic operations. String Manipulation.

Assembly Language Programming ASCII TO BCD CONVERSION START: MOV AX, DATA   MOV DS, AX; data segment initialization MOV CL, 04H   MOV AL, ASCII1  MOV BL, ASCII2  AND AL, 0FH  AND BL, 0FH  ROR AL, CL  OR AL, BL  MOV BCD, AL  MOV AH, 4CH  INT 21H

Branch & Call instructions POSITIVE AND NEGATIVE COUNT IN AN ARRAY START: MOV AX, DATA   MOV DS, AX   LEA SI, LIST ; SI is initialized to offset of LIST MOV CX, 0005H MOV DX, 0000H BACK: MOV AL, [SI] ROL AL, 01H   JC NEGATIVE ;if CF is set,control is transferred to label NEGATIVE   INC DL INC SI   LOOP BACK   JMP EXIT  NEGATIVE:INC DH   INC SI  EXIT: MOV [RESULT], DX   MOV AH, 4CH INT 21H

SORTING AN ARRAY START: MOV AX, DATA   MOV DS, AX   MOV CX, COUNT  MOV DX, CX  AGAIN: MOV SI, OFFSET LIST;SI is initialized to offset of LIST   MOV CX, DX  BACK: MOV AL, [SI]   INC SI   CMP AL, [SI]   JC NEXT   XCHG [SI], AL;content of AL is copied to [SI] and vice versa   DEC SI   MOV [SI], AL NEXT: LOOP BACK;decrement cx,jump to label BACK if CX!=0,else go to next instruction after LOOP   DEC DX   JNZ AGAIN   MOV AH, 4CH   INT 21H

Evaluation Of Arithmetic Operations START: MOV AX, DATA MOV DS, AX MOV AL, N1 MOV BL,N2 ADD AL,BL MOV [RESULT], AL MOV AL, N1 SUB AL, BL MOV [RESULT+1], AL MUL BL MOV [RESULT+2], AL MOV [RESULT+3], AH MOV AL, N1 MOV AH, 00H DIV BL MOV [RESULT+4], AL MOV [RESULT+5], AH MOV AH, 4CH INT 21H

String Manipulation LENGTH OF GIVEN STRING START: MOV AX, DATA MOV DS, AX MOV ES, AX MOV AL,’$’ LEA DI, LIST MOV DX, 0000H CLD BACK: SCASB; scans the string bytes for content of AL JE EXIT INC DX JMP BACK EXIT: MOV LEN, DX MOV AH, 4CH INT 21H

Comparision of two strings START: MOV AX, DATA MOV DS, AX MOV ES, AX MOV AX.LEN1 MOV BX, LEN2 CMP AX, BX JNE EXIT MOV CX, AX MOV SI, OFFSET LIST1 MOV DI, OFFSET LIST2 REP CMPSB JNE EXIT MOV RESULT, 5555H JMP NEXT EXIT: MOV RESULT, 0FFFFH NEXT: MOV AH, 4CH INT 21H