COAL Lab 7 (22k-4136)
COAL Lab 7 (22k-4136)
COAL Lab 7 (22k-4136)
Task 1
INCLUDE Irvine32.inc
.data
PUSH arr[esi]
POP ax
mov duplicate[esi],ax
add esi,2
Loop L1
INCLUDE Irvine32.inc
.data
number1 DWORD 23
number2 DWORD 90
number3 DWORD 44
var DWORD ?
.code
main PROC
PUSH number1
PUSH number2
PUSH number3
mov ecx,3
L1:
POP eax
add var,eax
Loop L1
mov eax,var
.data
.code
main PROC
call SumOfArr1
call SumOfArr2
call SumOfArr3
exit
main ENDP
SumOfArr1 PROC
SumOfArr2 PROC
mov esi,OFFSET arr2
mov eax, 0
mov ecx, LENGTHOF arr2
L1:
add ax,[esi]
add esi,2
Loop L1
mov sum2,ax
ret
SumOfArr2 ENDP
SumOfArr3 PROC
mov eax,0
add ax,sum1
add ax,sum2
mov edx,OFFSET prompt
call WriteString
call writeDec
call Crlf
ret
SumOfArr3 ENDP
END main
Task 4
INCLUDE Irvine32.inc
.data
.code
main PROC
PrintStar PROC
mov ecx,number
mov temp,1
L1:
mov count,ecx
mov ecx,number
L2:
Loop L2
sub number,1
mov ecx,temp
L3:
Loop L3
add temp,1
call Crlf
mov ecx,count
Loop L1
ret
PrintStar ENDP
END main
Task 5
INCLUDE Irvine32.inc
.data
.code
main PROC
PrintAlphabets PROC
mov ecx,number
mov temp,1
mov char, 'A'
mov eax ,char
L1:
mov count,ecx
mov ecx,number
L2:
sub number,1
mov ecx,temp
mov temp2,ecx
L3:
call WriteChar
add eax,1
mov edx,OFFSET gap
call WriteString
Loop L3
add temp,1
call Crlf
mov ecx,count
Loop L1
ret
PrintAlphabets ENDP
END main
Task 6
INCLUDE Irvine32.inc
.data
SumNumbers PROC
mov ecx,number
mov eax,0
L1:
add eax,ecx
Loop L1
ret
SumNumbers ENDP
END main