Shift And Rotate Instructions in Assembly Language
Shift And Rotate Instructions in Assembly Language ...
Code by Programming SeekerzZZZ...
Using Commands SHL ,SHR ,SAL ,SAR ,ROR ,ROL ,RCR ,RCL
include irvine32.inc
.data
msg byte " Actual No is: ",0
msg1 byte " No After 2 Arthmatic Right Shift (SAR): ",0,13h,10h
msg2 byte " No After 2 Arthmatic Left Shift (SAL): ",0
msg3 byte " No After 2 Logical Left Shift: (SHL) ",0
msg4 byte " No After 2 Logical Right Shift: (SHR) ",0
msg5 byte " No After 2 Left Rotations: (ROL) ",0
msg6 byte " No After 2 Right Rotations: (ROR) ",0
msg7 byte " No After 2 Left RCL (Rotate Carry Left): ",0
msg8 byte " No After 2 Right RCR (Rotate Carry Right): ",0
num byte 11110001b
.code
main proc
call clrscr
call crlf
;------------------SAR---------------
mov edx,offset msg
call writestring
call crlf
mov al,num
call writebin
SAR al,2
call crlf
mov edx,offset msg1
call writestring
call crlf
call writebin
call crlf
;------------------SAL----------------
call crlf
mov edx,offset msg
call writestring
call crlf
mov al,num
call writebin
SAL al,2
call crlf
mov edx,offset msg2
call writestring
call crlf
call writebin
call crlf
;---------------ROL-----------------
call crlf
mov edx,offset msg
call writestring
call crlf
mov al,num
call writebin
ROL al,2
call crlf
mov edx,offset msg5
call writestring
call crlf
call writebin
call crlf
;-----------------ROR---------------
call crlf
mov edx,offset msg
call writestring
call crlf
mov al,num
call writebin
ROR al,2
call crlf
mov edx,offset msg6
call writestring
call crlf
call writebin
call crlf
;-----------SHR------------------
call crlf
mov edx,offset msg
call writestring
call crlf
mov al,num
call writebin
SHR al,2
call crlf
mov edx,offset msg4
call writestring
call crlf
call writebin
call crlf
;------------SHL------------------
call crlf
mov edx,offset msg
call writestring
call crlf
mov al,num
call writebin
SHL al,2
call crlf
mov edx,offset msg3
call writestring
call crlf
call writebin
call crlf
;----------------RCR----------------
call crlf
mov edx,offset msg
call writestring
call crlf
mov al,num
call writebin
RCR al,2
call crlf
mov edx,offset msg8
call writestring
call crlf
call writebin
call crlf
;-----------------RCL----------------
call crlf
mov edx,offset msg
call writestring
call crlf
mov al,num
call writebin
RCL al,2
call crlf
mov edx,offset msg7
call writestring
call crlf
call writebin
call crlf
exit
main endp
end main
Code by Programming SeekerzZZZ...
Using Commands SHL ,SHR ,SAL ,SAR ,ROR ,ROL ,RCR ,RCL
.data
msg byte " Actual No is: ",0
msg1 byte " No After 2 Arthmatic Right Shift (SAR): ",0,13h,10h
msg2 byte " No After 2 Arthmatic Left Shift (SAL): ",0
msg3 byte " No After 2 Logical Left Shift: (SHL) ",0
msg4 byte " No After 2 Logical Right Shift: (SHR) ",0
msg5 byte " No After 2 Left Rotations: (ROL) ",0
msg6 byte " No After 2 Right Rotations: (ROR) ",0
msg7 byte " No After 2 Left RCL (Rotate Carry Left): ",0
msg8 byte " No After 2 Right RCR (Rotate Carry Right): ",0
num byte 11110001b
.code
main proc
call clrscr
call crlf
;------------------SAR---------------
mov edx,offset msg
call writestring
call crlf
mov al,num
call writebin
SAR al,2
call crlf
mov edx,offset msg1
call writestring
call crlf
call writebin
call crlf
;------------------SAL----------------
call crlf
mov edx,offset msg
call writestring
call crlf
mov al,num
call writebin
SAL al,2
call crlf
mov edx,offset msg2
call writestring
call crlf
call writebin
call crlf
;---------------ROL-----------------
call crlf
mov edx,offset msg
call writestring
call crlf
mov al,num
call writebin
ROL al,2
call crlf
mov edx,offset msg5
call writestring
call crlf
call writebin
call crlf
;-----------------ROR---------------
call crlf
mov edx,offset msg
call writestring
call crlf
mov al,num
call writebin
ROR al,2
call crlf
mov edx,offset msg6
call writestring
call crlf
call writebin
call crlf
;-----------SHR------------------
call crlf
mov edx,offset msg
call writestring
call crlf
mov al,num
call writebin
SHR al,2
call crlf
mov edx,offset msg4
call writestring
call crlf
call writebin
call crlf
;------------SHL------------------
call crlf
mov edx,offset msg
call writestring
call crlf
mov al,num
call writebin
SHL al,2
call crlf
mov edx,offset msg3
call writestring
call crlf
call writebin
call crlf
;----------------RCR----------------
call crlf
mov edx,offset msg
call writestring
call crlf
mov al,num
call writebin
RCR al,2
call crlf
mov edx,offset msg8
call writestring
call crlf
call writebin
call crlf
;-----------------RCL----------------
call crlf
mov edx,offset msg
call writestring
call crlf
mov al,num
call writebin
RCL al,2
call crlf
mov edx,offset msg7
call writestring
call crlf
call writebin
call crlf
exit
main endp
end main
Post a Comment