You are currently viewing [PRACTICAL] Implement a program to calculate the length of a string given starting and ending location
Microprocessor 8085 programming

[PRACTICAL] Implement a program to calculate the length of a string given starting and ending location

[PRACTICAL] IMPLEMENT A PROGRAM TO CALCULATE THE LENGTH OF A STRING GIVEN STARTING AND ENDING LOCATION

Are you looking for a step-by-step guide to Implement a program to calculate the length of a string given starting and ending location? here are the steps to implement a program to calculate the length of a string given starting and ending location.

Theory:

This program used to calculate the length of a string, starting and ending location is given in the program. Here starting location of string is C1FFh and ending location is C20Fh, total length of string is calculating in register c. Loop is increment location each time from C1FFh to C20F and register c count total location.

Program:

LXI H,C1FFH
LXI D,C20FH
MVI C,00H
NEXT: INR C
MOV A,H
CMP D
JNZ SKIP
MOV A,L
CMP E
JNZ SKIP
HLT
SKIP: INX H
JMP NEXT
HLT

OUTPUT:

C=11

For more practical related to 885 Programming please visit the 8085 Programming link