Saturday, September 12, 2009

Deleting string in a given array of characters(8085)

Statement:Write an 8085 assembly language program to delete a string of 4 characters from the tenth location in the given array of 50 characters.
Solution: Shift bytes from location 14 till the end of array upwards by 4 characters i.e. from location 10 onwards.
Source Program:
LXI H, 2l0DH :Initialize source memory pointer at the 14thlocation of the array.
LXI D, 2l09H : Initialize destn memory pointer at the 10th location of the array.
MOV A, M : Get the character
STAX D : Store character at new location
INX D : Increment destination pointer
INX H : Increment source pointer
MOV A, L : [check whether desired
CPI 32H bytes are shifted or not]
JNZ REPE : if not repeat the process
HLT : stop

No comments:

Post a Comment