Assembly Lab Assignment
Assembly Lab Assignment
Roll No: 29
Submitted to: Sir Hammad
Section: BSCS 7A
Lab Work
Practical # 1
INCLUDE Irvine32.inc
INCLUDE Macros.inc
.data
COMMENT Pra_1
SUM is a variable name and DWORD (32 bit) is a Data type and
initial value is zero.
Pra_1
SUM DWORD 0
.code
Practical_1 PROC
mov EAX, 5
add EAX, 6 mov
SUM, EAX
exit
Practical_1 ENDP
END Practical_1
Practical # 2
INCLUDE Irvine32.inc
INCLUDE Macros.inc
.code
Practical_2 PROC
exit
Practical_2 ENDP
END Practical_2
Practical # 3
INCLUDE Irvine32.inc
INCLUDE Macros.inc
.code
Practical_3 PROC
exit
Practical_3 ENDP
END Practical_3
Practical # 4
INCLUDE Irvine32.inc
INCLUDE Macros.inc
.data
S1 BYTE “A” ,0 S2
BYTE „L‟ ,0 S3
BYTE „I‟ ,0
.code
Practical_4 PROC
call crlf
exit
Practical_4 ENDP
END Practical_4
Practical # 5
INCLUDE Irvine32.inc
.data
S1 BYTE “ALI” ,0
S2 BYTE „ADP-CS‟ ,0
.code
Practical_5 PROC
exit
Practical_5 ENDP
END Practical_5
Practical # 6
Write a program that input numbers and stored in different variables and perform
this expression: (A + B) – (C + D)
TITLE: Expression (A+B) – (C+D)
INCLUDE Irvine32.inc
INCLUDE Macros.inc
.data
A1 dword ?
B1 dword ?
C1 dword ?
D1 dword ?
.code
Practical_6 PROC
call crlf
mWrite “The Answer of (A+B) – (C+D) is: “ call
Answer ; User defined procedure
call crlf
exit
Practical_6 ENDP
Answer PROC
mov EAX , A1
mov EBX , B1
mov ECX , C1
mov EDX , D1
ret
Answer ENDP
END Practical_6
Practical # 7
Write a program that defines symbolic constant names for several string literals.
Use each symbolic constant name in a variable definition.
TITLE: Symbolic Text Constant
INCLUDE Irvine32.inc
.code
Practical_7 PROC
exit
Practical_7 ENDP
END Practical_7
Practical # 8
INCLUDE Irvine32.inc
A1 EQU 58
B1 = 61
.code
Practical_8 PROC
exit
Practical_8 ENDP
END Practical_8
Practical # 9
Write a program that input the length and width of rectangle and calculate the
Area of rectangle.
TITLE: Area of Rectangle
INCLUDE Irvine32.inc
INCLUDE Macros.inc
.code
Practical_9 PROC
exit
Practical_9 ENDP
areaofrectangle PROC
areaofrectangle ENDP
END Practical_9
Practical # 10
Irvine32.inc
.data
myarray dword 10, 20, 30, 40, 50
.code
Practical_10 PROC
exit Practical_10
ENDP
END Practical_10
Practical # 11
Write a program to perform a direct offset operand (pick value) in assembly language.
TITLE: Direct OFFSET operand (pick value) INCLUDE
Irvine32.inc
.data
myarray dword 10, 20, 30, 40, 50
.code
Practical_11 PROC
exit
Practical_11 ENDP
END Practical_11
Practical # 12
Write a program to calculate the sum of every third value from the list of 10 values
of array in assembly language.
INCLUDE Irvine32.inc
INCLUDE Macros.inc
.data
myarray dword 10, 20, 30, 40, 50, 60, 70, 80, 90, 100
.code
Practical_12 PROC
exit Practical_12
ENDP
END Practical_12
Practical # 13
.code
Practical_13 PROC
exit Practical_13
ENDP
END Practical_13
Practical # 14
.data
X dword 5
Y dword 7
.code
Practical_14 PROC
call crlf
exit
Practical_14 ENDP
END Practical_14
Practical # 15
Write a program to perform increment operator in assembly language
INCLUDE Irvine32.inc
INCLUDE Macros.inc
.code
Practical_15 PROC
inc AL
mWrite “After inc the value of AL (Register) is Zero (00).”
Call DumpRegs
exit Practical_15
ENDP
END Practical_15
Practical # 16
INCLUDE Irvine32.inc
INCLUDE Macros.inc
.code
Practical_16 PROC
dec AL
mWrite “After dec the value of AL (Register) is 255 (FF).”
Call DumpRegs
exit Practical_16
ENDP
END Practical_16
Practical # 17
INCLUDE Irvine32.inc
.data
m DWORD ?
n WORD ? z
BYTE ?
t DWORD ?
.code
Practical_17 PROC
exit Practical_17
ENDP
END Practical_17
Practical # 18
INCLUDE Irvine32.inc
INCLUDE Macros.inc
.code
Practical_18 PROC
exit
Practical_18 ENDP
END Practical_18
Practical # 19
INCLUDE Irvine32.inc
INCLUDE Macros.inc
.data
Array_1 dword 10, 20, 30, 40, 50, 60, 70, 80
Msg byte “Hello”,0
.code
Practical_19 PROC
exit
Practical_19 ENDP
END Practical_19
Practical # 20
INCLUDE Irvine32.inc
INCLUDE Macros.inc
.data
m dword ?
n word ?
z byte ? t
tbyte ?
.code
Practical_20 PROC
mWrite “The Type of m(dword data type) is: ” mov EAX ,
type m
call Writedec
mWrite “ bytes”
call crlf
call crlf
.data
A DWORD 10
B DWORD 20
Result DWORD ?
.code
Main PROC
.data
A QWORD 1234567890ABCDEFh
B QWORD 1122334455667788h
Result QWORD ?
.code
Main PROC
Mov rax, A ; Load A into RAX (64-bit register) Add rax, B ; Add B to
RAX