Roll No: 190803 Subject: COAL Lab Class: BSCYS-F-19-B-556: Name: Muhammad Adnan Haider

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Name: Muhammad Adnan Haider

Roll no: 190803


Subject: COAL lab
Class: BSCYS-F-19-B-556

Lab task
Lab task no 01:
Source code:
include irvine32.inc
.data

var1 byte 255


var3 sbyte +127
var sbyte -128
.code
main proc
mov eax,0
mov ebx,0
mov ecx,0

movzx eax,var1
movsx ecx,var3
movsx ebx,var

call dumpregs
call waitmsg
exit
main endp
end main

Output:
Lab task no 02:
Source Code:
include irvine32.inc

.data
var1 byte 15h
var2 byte 18h
.code
main proc
mov a1,0
mov b1,0
mov a1, var1
mov b1, var2
call dumpregs
xchg a1,b1
call dumpregs
call waitmsg
exit
main endp
and main
Output:

Lab task no 03:


Source Code:
include irvine32.inc
.data

array byte 20h,30h

.code
main proc
mov eax,0
mov ebx,0

mov al,array
mov bl,array+1

call dumpregs
add al,bl
call dumpregs
call waitmsg
exit
main endp
end main

Output:

Lab task no 04:


include irvine32.inc
.data
Rval DWORD ?
Xval DWORD 56
Yval DWORD 90
Zval DWORD 54

.code
main proc
mov eax,0
mov ebx,0
mov edx,0
mov ecx,0

mov ebx,Yval
neg ebx
add ebx,Zval
mov eax,Xval
sub eax,ebx
mov Rval,eax
call dumpregs
call waitmsg

exit
main endp
end main
Output:

Task no 05;
Source code:

include irvine32.inc

.data

X byte 9h
Y byte 2h
Z byte 3h

.code
main PROC

mov eax, 0
mov ebx, 0
mov ecx, 0
mov edx, 0

mov bl, X
mov cl, Y
mov dl, Z
call dumpregs
neg cl ; -Y
call dumpregs

add cl, dl ;-Y+Z


call dumpregs

sub bl, cl ;X-(-Y+Z)


call dumpregs

call waitmsg
exit
main endp
end main

Output:

Task no 06:
Source code:
include irvine32.inc
.data
result dword ?
num dword ?
msg byte "Enter number You Want To Print Table",0,13h,10h
msg1 byte " * ",0
msg2 byte " = ",0
.code
main proc
call clrscr
call crlf
mov edx,offset msg
call writestring
call crlf
call readint
mov num,eax
mov ecx,10
mov ebx,1
;1
mov eax,num
call writeint
mul ebx
mov edx,offset msg1
call writestring
mov result,eax
mov eax,ebx
call writeint
mov edx,offset msg2
call writestring
mov eax,result
call writeint
call crlf
inc ebx
;2
mov eax,num

call writeint
mul ebx
mov edx,offset msg1
call writestring
mov result,eax
mov eax,ebx
call writeint
mov edx,offset msg2
call writestring
mov eax,result
call writeint
call crlf
inc ebx
;3
mov eax,num
call writeint
mul ebx
mov edx,offset msg1
call writestring
mov result,eax
mov eax,ebx
call writeint
mov edx,offset msg2
call writestring
mov eax,result
call writeint
call crlf
inc ebx
;4
mov eax,num
call writeint
mul ebx
mov edx,offset msg1
call writestring
mov result,eax
mov eax,ebx
call writeint
mov edx,offset msg2
call writestring
mov eax,result
call writeint
call crlf
inc ebx
;5
mov eax,num
call writeint
mul ebx
mov edx,offset msg1
call writestring
mov result,eax
mov eax,ebx
call writeint
mov edx,offset msg2
call writestring
mov eax,result
call writeint
call crlf
inc ebx
;6
mov eax,num
call writeint
mul ebx
mov edx,offset msg1
call writestring
mov result,eax
mov eax,ebx
call writeint
mov edx,offset msg2
call writestring
mov eax,result
call writeint
call crlf
inc ebx
;7
mov eax,num
call writeint
mul ebx
mov edx,offset msg1
call writestring
mov result,eax
mov eax,ebx
call writeint
mov edx,offset msg2
call writestring
mov eax,result
call writeint
call crlf
inc ebx
;8
mov eax,num
call writeint
mul ebx
mov edx,offset msg1
call writestring
mov result,eax
mov eax,ebx
call writeint
mov edx,offset msg2
call writestring
mov eax,result
call writeint
call crlf
inc ebx
;9
mov eax,num
call writeint
mul ebx
mov edx,offset msg1
call writestring
mov result,eax
mov eax,ebx
call writeint
mov edx,offset msg2
call writestring
mov eax,result
call writeint
call crlf
inc ebx
;10
mov eax,num
call writeint
mul ebx
mov edx,offset msg1
call writestring
mov result,eax
mov eax,ebx
call writeint
mov edx,offset msg2
call writestring
mov eax,result
call writeint
call crlf
call waitmsg
inc ebx

exit
main endp
end main

Output:

You might also like