You are on page 1of 2

CODE SEGMENT

ASSUME CS: CODE , DS: CODE

ORG 100H

MOV AX , DS
MOV ES , AX
XOR AX,AX

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rotating number..1335 to 5331 begins here


MOV CX,4

MOV AX,1335D ;;;;;;;;;;;;if number is dec BX Mst also be dec. if number was hex,BX
would also have to be hex....as shown in block before HLT

SWAP:

XOR DX,DX
MOV BX,10D
DIV BX

SHL TEMP,4
OR TEMP,DX

LOOP SWAP
;;;;;;;;;;;;;;;;;; NOW AX = 5331

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rotating number..1335 to 5331 endss here

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rotating number..5331 to 1335 begins here

MOV AX,TEMP
MOV CX,4
MOV TEMP,0
ROT:

XOR DX,DX
MOV BX,10H;;;;;;;;;;;;;;;CANNOT BE DEC
DIV BX

SHL TEMP,4
OR TEMP,DX

LOOP ROT

HLT

TEMP DW 0
T2 DW 0
CODE ENDS
END

You might also like