Header Ads

Header ADS

Program for Searching a Byte from Array of ten Numbers

Introduction

Hello friends, In this post, we will learn how to write a simple program in Assembly language for searching a byte from array of ten numbers.
Assembly language is a low level programming language.With the invention of many high level languages, the use of assembly language has become rare these days. However, it is true that every high level language must be compiled into assembly language before it can be linked into an executable program. For the high level language programmer, understanding how the compiler generates the assembly language code can be a great benefit, both for directly writing routines in assembly language and for understanding how the high-level language routines are converted to assembly language by the compiler.

One of the first hurdles to learning assembly language programming is understanding just what
assembly language is. Unlike other programming languages, there is no one standard format that
all assemblers use. Different assemblers use different syntax for writing program statements.
Many beginning assembly language programmers get caught up in trying to figure out the myriad
of different possibilities in assembly language programming.

The first step is to deciding what type of assembly language programming one want. Once you decided then it is easy to start learning. Each family of processors has its own set of instructions for handling various operations like getting input from keyboard, displaying information on screen and performing various other jobs. These set of instructions are called 'machine language instruction'.Processor understands only machine language instructions which are strings of 1s and 0s. However machine language is too obscure and complex for using in software development. So the low level assembly language is designed for a specific family of processors that represents various instructions in symbolic code and a more understandable form.

Program


;PROGRAM FOR SEARCHING A BYTE FROM ARRAY OF TEN NUMBERS

ORG 00H
SJMP MAIN
ORG 30H

MAIN :
MOV DPTR,#3000H
MOV R0,#10

AGAIN :
MOVX A,@DPTR
CJNE A,#50H,BACK
SJMP LAST

BACK :
INC DPTR
DJNZ R0,AGAIN

LAST :
MOV R1,DPH
MOV R2,DPL
MOV DPTR,#4000H
MOV A,R1
MOVX @DPTR,A
INC DPTR
MOV A,R2
MOVX @DPTR,A
END



No comments

Powered by Blogger.