Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

Coal

Assignment 3
19F-0285
Imran Shaheer
Question # 1:
include irvine32.inc
.data
var DW 9988h,7051h,1134h,4567h,8815h,7711h,5511h
.code
main proc
mov eax,0
mov ebx,0
mov ecx,0
mov edx,0
mov esi,0
mov edi,0
Mov ecx,6
MOv esi,offset var
mov EAX,6+9
l1:
Add EAX,[ESI]
inc esi
loop l1
main endp
end main

Question # 4:
include Irvine32.inc
.data
var1 byte ?
string byte "Enter Character:",0
string1 byte "This letter is in uper case ",0
string2 byte "This letter is in lower case",0

.code
main proc
mov eax,0
mov ebx,0
mov ecx,0
mov edx,0
mov esi,0
mov edi,0
mov edx,offset string
call Writestring
call readchar
call writechar
call crlf
mov var1,al
.if al>=65 && al<=90
mov edx,offset string1
.else
mov edx,offset string2
.endif
call writestring
exit
main endp

end main

Question # 6:
include Irvine32.inc
.data

.code
main proc
mov al,0D4h
ror al,3 AL=9Ah
mov al,0D4h
rol al,7 Al= 6Ah
stc
mov al,0D4h
rcl al,1 AL= A9h
stc
mov al,0D4h
rcr al,3 AL= 3Ah
exit
main endp
end main

Question #7:
include irvine32.inc
.data
string1 byte "Enter Number: ",0
var1 byte 0
.code

main proc
mov eax,0
mov ebx,0
mov ecx,0
mov edx,0
mov esi,0
mov edi,0

mov edx,offset string1


call writestring
call readhex
mov ecx,16
i:
shr ax,1
jc increment
back:

loop i
jmp printloop
increment:

add var1,1h
jmp back

printloop:
mov al,var1

call writedec
call crlf
call waitmsg
exit
main endp
end main

Question #8
include irvine32.inc
.model small
.stack 100h
.data
a Db 10h
.code
main proc
mov bl,10
mov al,20h
add al,a
jnz lbl1
jp lbl2
jmp EXIT_lbl
lbl1:
xor al,63
jz lbl1
jp lbl3
jnp lbl4
jmp exit_lbl
lbl2:
and bl,0
or al,48
cmp al,30h
jp lbl5
jg exit_lbl
js lbl5
jz lbl1
lbl3:
mov dl,0
jz lbl1
or dl,128
jz lbl1
js lbl5
lbl4:
mov dl,1
and dl,0
jz lbl2
jmp exit_lbl
lbl5:
and dl,0
jnz lbl1
jz exit_lbl
exit_lbl:
main endp
end main

8,9,10,11,15,16,17,29,30,31,32,33,40,41,42

Question # 9:
LINE 9 :

MOV,20 INTO AL ‘AL=20

MOVING 20 INTO AL
LINE 10

ADD AL,10 AL=30

ADDING 10 INTO AL WHICH LEADS TO 30

LINE 15

XOR AL,63 AL=OF=15

CALCULATE XOR OF BINNARY VALUE OF 30 IN AL WITH 63

LINE 29

MOV DL,0 DL=0

MOVING DL,0

LINE 31

OR DL,128

PERFORMING OR OPERATION WITH ZERO VALUE IN DL AND 128

LINE 40

AND DL,0

PERFORMING AND WITH DL

AL=0F DL=0

Question # 10:
include Irvine32.inc
.data
arr word 3456h,45A7h,23C7h,1234h,7AB0h
tmp word ?
string1 Byte "Enter Number to search in the Array: ",0
string2 Byte " The Number is found:",0
string3 Byte " The Number is not found:",0
.code
main proc
mov eax,0
mov ebx,0
mov ecx,0
mov edx,0
mov esi,0
mov edi,0
mov edx,offset string1
call writestring
mov eax,0
call readhex
mov tmp,ax
mov ecx,lengthof arr
mov edi,0
mov esi,0
L1:
mov si,arr[edi]
.if tmp==si
mov edx,offset string2
call WriteString

.endif
add edi,2
loop L1
CALL crlf
call waitmsg
exit
main endp
end main

You might also like