Logo 
Search:

Assembly Language Articles

Submit Article
Home » Articles » Assembly Language » Homework HelpRSS Feeds

PROGRAM TO EXCHANGE TWO MEMORY LOCATION WITH OUT USING XCHG ; INSTRUCTION

Posted By: Henry Evans     Category: Assembly Language     Views: 4179

WRITE A PROGRAM TO EXCHANGE TWO MEMORY LOCATION WITH OUT USING XCHG; INSTRUCTION.

Code for PROGRAM TO EXCHANGE TWO MEMORY LOCATION WITH OUT USING XCHG ; INSTRUCTION in Assembly Language

DATA SEGMENT
A DB 10
B DB 20
DATA ENDS
CODE SEGMENT
         ASSUME DS:DATA,CS:CODE
START:
        MOV AX,DATA
        MOV DS,AX
        MOV AL,A
        MOV AH,B
        MOV A,AH
        MOV B,AL
        MOV BL,A
        MOV BH,B
        MOV AH,4CH
        INT 21
CODE ENDS
END START

;OUTPUT:->
; R
;AX=0000  BX=0000  CX=0032  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BE4  ES=0BE4  SS=0BF4  CS=0BF5  IP=0000   NV UP EI PL NZ NA PO NC
;0BF5:0000 B8F40B        MOV     AX,0BF4
;-T
;
;AX=0BF4  BX=0000  CX=0032  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BE4  ES=0BE4  SS=0BF4  CS=0BF5  IP=0003   NV UP EI PL NZ NA PO NC
;0BF5:0003 8ED8          MOV     DS,AX
;-T
;
;AX=0BF4  BX=0000  CX=0032  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BF4  ES=0BE4  SS=0BF4  CS=0BF5  IP=0005   NV UP EI PL NZ NA PO NC
;0BF5:0005 8A1E0100      MOV     BL,[0001]                          DS:0001=0A
;-T
;
;AX=0BF4  BX=000A  CX=0032  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BF4  ES=0BE4  SS=0BF4  CS=0BF5  IP=0009   NV UP EI PL NZ NA PO NC
;0BF5:0009 3A1E0000      CMP     BL,[0000]                          DS:0000=0A
;-T
;
;AX=0BF4  BX=000A  CX=0032  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BF4  ES=0BE4  SS=0BF4  CS=0BF5  IP=000D   NV UP EI PL ZR NA PE NC
;0BF5:000D 7508          JNZ     0017
;-T
;
;AX=0BF4  BX=000A  CX=0032  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BF4  ES=0BE4  SS=0BF4  CS=0BF5  IP=000F   NV UP EI PL ZR NA PE NC
;0BF5:000F B400          MOV     AH,00
;-T
;
;AX=00F4  BX=000A  CX=0032  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BF4  ES=0BE4  SS=0BF4  CS=0BF5  IP=0011   NV UP EI PL ZR NA PE NC
;0BF5:0011 A00000        MOV     AL,[0000]                          DS:0000=0A
;-T
;
;AX=000A  BX=000A  CX=0032  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BF4  ES=0BE4  SS=0BF4  CS=0BF5  IP=0014   NV UP EI PL ZR NA PE NC
;0BF5:0014 EB08          JMP     001E
;-T
;
;AX=000A  BX=000A  CX=0032  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BF4  ES=0BE4  SS=0BF4  CS=0BF5  IP=001E   NV UP EI PL ZR NA PE NC
;0BF5:001E B44C          MOV     AH,4C
;-T
;
;AX=4C0A  BX=000A  CX=0032  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BF4  ES=0BE4  SS=0BF4  CS=0BF5  IP=0020   NV UP EI PL ZR NA PE NC
;0BF5:0020 CD15          INT     15
;-T
;
;AX=0BF4  BX=0000  CX=002F  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BE4  ES=0BE4  SS=0BF4  CS=0BF5  IP=0003   NV UP EI PL NZ NA PO NC
;0BF5:0003 8ED8          MOV     DS,AX
;-T
;
;AX=0BF4  BX=0000  CX=002F  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BF4  ES=0BE4  SS=0BF4  CS=0BF5  IP=0005   NV UP EI PL NZ NA PO NC
;0BF5:0005 A00000        MOV     AL,[0000]                          DS:0000=0A
;-T
;
;AX=0B0A  BX=0000  CX=002F  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BF4  ES=0BE4  SS=0BF4  CS=0BF5  IP=0008   NV UP EI PL NZ NA PO NC
;0BF5:0008 8A260100      MOV     AH,[0001]                          DS:0001=14
;-T
;
;AX=140A  BX=0000  CX=002F  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BF4  ES=0BE4  SS=0BF4  CS=0BF5  IP=000C   NV UP EI PL NZ NA PO NC
;0BF5:000C 88260000      MOV     [0000],AH                          DS:0000=0A
;-T
;
;AX=140A  BX=0000  CX=002F  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BF4  ES=0BE4  SS=0BF4  CS=0BF5  IP=0010   NV UP EI PL NZ NA PO NC
;0BF5:0010 A20100        MOV     [0001],AL                          DS:0001=14
;-T
;
;AX=140A  BX=0000  CX=002F  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BF4  ES=0BE4  SS=0BF4  CS=0BF5  IP=0013   NV UP EI PL NZ NA PO NC
;0BF5:0013 8A1E0000      MOV     BL,[0000]                          DS:0000=14
;-T
;
;AX=140A  BX=0014  CX=002F  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BF4  ES=0BE4  SS=0BF4  CS=0BF5  IP=0017   NV UP EI PL NZ NA PO NC
;0BF5:0017 8A3E0100      MOV     BH,[0001]                          DS:0001=0A
;-T
;
;AX=140A  BX=0A14  CX=002F  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BF4  ES=0BE4  SS=0BF4  CS=0BF5  IP=001B   NV UP EI PL NZ NA PO NC
;0BF5:001B B44C          MOV     AH,4C
;-T
;
;AX=4C0A  BX=0A14  CX=002F  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BF4  ES=0BE4  SS=0BF4  CS=0BF5  IP=001D   NV UP EI PL NZ NA PO NC
;0BF5:001D CD15          INT     15
  
Share: 



Henry Evans
Henry Evans author of PROGRAM TO EXCHANGE TWO MEMORY LOCATION WITH OUT USING XCHG ; INSTRUCTION is from London, United Kingdom.
 
View All Articles

 

Other Interesting Articles in Assembly Language:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!