ALP to exchange two numbers - Code

Latest

programs

Sunday, October 30, 2011

ALP to exchange two numbers


ALP to exchange two numbers
          
            DATA SEGMENT
            NO1 DB 01H
            NO2 DB 07H
            DATA ENDS
            CODE SEGMENT
            ASSUME CS:CODE,DS:DATA
            START:MOV AX,DATA
                          MOV DS,AX
                          MOV AL,NO1
                          MOV BL,NO2
                          XCHG AL,BL
                          MOV DS:[2000H],AL
                          MOV DS:[2001H],BL
                          HLT
            CODE ENDS
            END START

RESULT 1:
            I/P: ALß01H                         O/P : ALß07H      [2000H]ß07H
                   BLß07H                                   BLß01H      [2001H]ß01H



No comments:

Post a Comment