MICROPROCESSORS

The microprocessor contains all, or most of, the central processing unit (CPU) functions and is the "engine" that goes into motion when you turn your computer on. A microprocessor is designed to perform arithmetic and logic operations that make use of small number-holding areas called registers.

Friday 20 May 2016

String Manipulation Instructions of an processor

A series of data bytes or words available in memory at consecutive locations, to be referred to collectively or individually, are called as byte strings or word strings. For referring to a string, two parameters are required, starting or end address of the string and  length of the string. The length of a string is usually stored as count in CX register. The pointers and counters may be modified at each iteration, till the required condition for proceeding further is satisfied. The incrementing or decrementing of the pointer, in case of 8086 string instructions, depends upon the direction flag (DF) status. If it is a byte string operation, the index registers are updated (incrementing if DF is 0 or decrementing if DF is  by one. On the other hand, if it is a word string operation, the index registers are updated by two. The counter in both the cases is decremented by one. REP (Repeat Instruction Prefix): This instruction is used as a prefix to other instructions. The instruction to which the REP prefix is provided, is executed repeatedly until the CX register becomes zero (at each iteration CX is automatically decremented by one). When CX becomes zero, the execution proceeds to the next instruction in sequence. There are two more options of the REP instruction. The first is REPE/REPZ, i.e. repeat operation while equal/zero. The second is REPNE/REPNZ allows for repeating the operation while not equal/not zero. These options are used for CMPS, SCAS instructions only, as instruction prefixes.MOVSB/MOVSW (Move String Byte or String Word): The MOVSB/MOVSW instruction moves a string of bytes/ words pointed to by DS: SI pair (source) to the memory location pointed to by ES: DI pair (destination). The REP instruction prefix is used with MOVS instruction to repeat it by a value given in the counter CX). The length of the byte string or word string must be stored in CX register. No flags are affected by this instruction.



 ==> Education is the most powerful weapon which you can use to change the world. 
@ Nelson Mandela

No comments:

Post a Comment