Pages

Search in This Blog

Sunday 15 January 2012

GENERAL – PURPOSE BYTE OR WORD TRANSFER INSTRUCTIONS


GENERAL – PURPOSE BYTE OR WORD TRANSFER INSTRUCTIONS
  •  MOV Instruction - MOV destination, source
The MOV instruction copies a word or a byte of data from a specified source to a specified destination . MOV op1, op2
Example:
MOV CX, 037AH             ; MOV 037AH into the CX.
MOV AX, BX                   ;Copy the contents of register BX to AX
MOV DL,[BX]                  ;Copy byte from memory at BX to DL , BX contains the offset of byte in DS.
  • PUSH Instruction - PUSH source
PUSH instruction decrements the stack pointer by 2 and copies a word from a specified source to the location in the stack segment where the stack pointer pointes.
Example:
PUSH BX                     ;Decrement SP by 2 and copy BX to stack
PUSH DS                     ;Decrement SP by 2 and copy DS to stack
PUSH TABLE[BX]        ;Decrement SP by 2 and copy word from memory in DS at EA = TABLE + [BX] to stack .
  • POP Instruction - POP destination
POP instruction copies the word at the current top of the stack to the operand specified by op then increments the stack pointer to point to the next stack.
Example:
POP DX                   ;Copy a word from top of the stack to DX and increments SP by 2.
POP DS                   ; Copy a word from top of the stack to DS and increments SP by 2.
POP TABLE [BX]     ;Copy a word from top of stack to memory in DS with EA = TABLE + [BX].
  • XCHG Instruction - Exchange XCHG destination, source
The Exchange instruction exchanges the contents of the register with the contents of another register (or) the contents of the register with the contents of the memory location. Direct memory to memory exchange are not supported.
Syntax: XCHG op1, op2 - The both operands must be the same size and one of the operand must always be a register .
Example:
XCHG AX, DX                      ;Exchange word in AX with word in DX
XCHG BL, CH                      ;Exchange byte in BL with byte in CH
XCHG AL, Money [BX]        ;Exchange byte in AL with byte in memory at EA.
  • XLAT/XLATB Instruction - Translate a byte in AL
XLAT exchanges the byte in AL register from the user table index to the table entry, addressed by BX.  It transfers 16 bit information at a time. The no-operands form (XLATB) provides a "short form" of the XLAT instructions.
Example:MOV AL, [BX+AL]

No comments:

Post a Comment