Sunday, January 16, 2022

Write a program that find v4 = v1/2 + v2 *16 (only use only shift instructions).

 INCLUDE C:\IRVINE\IRVINE32.INC

.386

.STACK 4096

EXITPROCESS PROTO,DWEXITCODE:DWORD

.DATA

   val1 word 5

   val2 word 7

   val3 word ?  

   str1 byte "v4 is :  ",0                                        

 

.CODE

MAIN PROC

mov eax,0

mov ax,val2

shl ax,9

mov ebx,0

mov bl,al

mov ax,val1

shr ax,8

add ax,bx

mov val3,ax

mov edx,OFFSET str1

call WriteString

call WriteInt

INVOKE EXITPROCESS,0

MAIN ENDP

END MAIN

No comments:

Post a Comment