Q. Program for interchanging the values of two Memory locations?
Program for interchanging the values of two Memory locations
; input: Two memory variables of same size: 8-bit for this program
DATA SEGMENT
VALUE1 DB 0Ah ;Variables
VALUE2 DB 14h
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
MOV AX, DATA ; Initialise data segments
MOV DS, AX ; using AX
MOV AL, VALUE1 ; Load Value1 into AL
XCHG VALUE2,AL ; exchange AL with Value2.
MOV VALUE1,AL ; Store A1 in Value1
INT 21h ; Return to Operating system
CODE ENDS
END