33 Program to swap two numbers in 8086 Microprocessor

Code:

; Program to swap two number
.MODEL SMALL
.STACK 100H
.DATA
  NUM1 DB 05H
  NUM2 DB 02H
.CODE
  MOV AX , @DATA ; Initializing Data Segment
  MOV DS , AX

  ; Storing Data
  MOV BL , NUM1
  MOV CL , NUM2

  ; Swapping
  MOV NUM2 , BL 
  MOV NUM1 , CL

  MOV AH , 4CH  ; Intrupt to exit
  INT 21H
END


Ouput:


Previous
Next Post »