Assignment

You might also like

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

include irvine32.

inc
.data
msg1 byte 'Enter 1st term ',0
msg2 byte 'Enter common difference ',0
msg3 byte 'Enter no. of terms ',0
tr1 dd ?
commo dd ?
nummb dd ?
.code
main proc
mov edx,offset msg1
call writestring
call readdec
mov tr1,eax
mov edx,offset msg2
call writestring
call readdec
mov commo,eax
mov edx,offset msg3
call writestring
call readdec
mov nummb,eax
mov eax,tr1
call writedec
call crlf
mov ecx,nummb
dec ecx
mov ebx,tr1
L1:
add ebx,commo
mov eax,ebx
call writedec
call crlf
loop L1
exit
main endp
end main

include irvine32.inc
.data
msg1 byte 'Enter 1st term ',0
msg2 byte 'Enter common ratio ',0
msg3 byte 'Enter no of terms ',0
tr1 dd ?
commo dd ?
nummb dd ?
.code
main proc
mov edx,offset msg1
call writestring
call readdec
mov tr1,eax
mov edx,offset msg2
call writestring
call readdec
mov commo,eax
mov edx,offset msg3
call writestring
call readdec
mov nummb,eax
mov ecx,eax
mov eax,tr1
L1:
call writedec
call crlf
mov ebx,eax
mov eax,commo
mul ebx
loop L1
exit
main endp
end main

Include Irvine32.inc
.data
var1 byte 2
choice byte 'Do you want to run again ',0
Yes byte 10h dup(0)
.code
main proc
abc:
mov eax,1
mov ecx,8
L1:
mov ebx,type byte
call writebinb
call crlf
mul var1
loop L1
mov edx,offset choice
call writestring
mov edx,offset Yes
mov ecx,sizeof Yes
call readstring
cmp Yes,'y'
je abc
exit
main endp
end main

include irvine32.inc
.data
var1 db ?
var2 db ?
operator db 10h dup(0)
msg1 byte 'Number 1 ',0
msg2 byte 'Number 2 ',0
msg3 byte 'Operation ',0
msg4 byte 'Result ',0
choice byte 'Do you want to run again ',0
yes db 10h dup(0)
.code
main proc
again:
mov edx,offset msg1
call writestring
call readdec
mov var1,al
mov edx,offset msg2
call writestring
call readdec
mov var2,al
mov edx,offset msg3
call writestring
mov edx,offset operator
mov ecx,sizeof operator
call readstring
cmp operator,'+'
je abc
cmp operator,'-'
je def
cmp operator,'*'
je ghi
cmp operator,'/'
je jkl
abc:
mov bl,var1
add bl,var2
mov al,bl
mov edx,offset msg4
call writestring
call writedec
jmp xyz
def:
mov bl,var1
sub bl,var2
mov eax,0
mov al,bl
mov edx,offset msg4
call writestring
call writedec
jmp xyz
ghi:
mov eax,0
mov al,var1
mul var2
mov edx,offset msg4
call writestring
call writedec
jmp xyz
jkl:
mov eax,0
mov al,var1
div var2
mov edx,offset msg4
call writestring
call writedec
jmp xyz
xyz:
call crlf
mov edx,offset choice
call writestring
mov edx,offset yes
mov ecx,sizeof yes
call readstring
cmp yes,'y'
jz again
exit
main endp
end main
include irvine32.inc
.data
array byte 21h,22h,23h
.code
main proc
mov ah,array
mov al,array+1
mov bl,array+2
call dumpregs
exit
main endp
end main

include irvine32.inc
.data
array word 1234h,9999h
.code
main proc
mov ax,array
mov bx,array+2
call dumpregs
exit
main endp
end main

include irvine32.inc
.data
arr dword 12345678h,555h
.code
main proc
mov eax,arr
mov edx,arr+4
call dumpregs
exit
main endp
end main
include irvine32.inc
.data
array1 byte 5h dup(0)
array2 byte 5h dup(0)
msg1 byte 'Enter name ',0
msg2 byte 'You entered ',0
msg3 byte 'Copy ',0
.code
main proc
mov edx,offset msg1
call writestring
mov edx, offset array1
mov ecx,sizeof array1
call readstring
mov edx,offset msg2
call writestring
mov edx, offset array1
call writestring
call crlf
mov edx,offset msg3
call writestring
mov esi,0
mov edi,0
mov al,array1[esi]
mov array2[edi],al
inc edi
inc esi
mov al,array1[esi]
mov array2[edi],al
inc edi
inc esi
mov al,array1[esi]
mov array2[edi],al
mov edx, offset array2
call writestring
call crlf
exit
main endp
end main

include irvine32.inc
.data
msg1 byte 'Name ',0
msg2 byte 'Age ',0
msg3 byte 'Grade ',0
array1 byte 10h dup(0)
array2 byte 10h dup(0)
var1 db ?
msg4 byte ' is ',0
msg5 byte ' Years old. The student secured ',0
msg6 byte ' Grade ',0
.code
main proc
mov edx,offset msg1
call writestring
mov edx,offset array1
mov ecx,sizeof array1
call readstring
mov edx,offset msg2
call writestring
call readdec
mov var1,al
mov edx,offset msg3
call writestring
mov edx,offset array2
call readstring
call crlf
mov edx,offset array1
call writestring
mov edx,offset msg4
call writestring
mov eax,0
mov al,var1
call writedec
mov edx,offset msg5
call writestring
mov edx,offset array2
call writestring
mov edx,offset msg6
call writestring
call crlf
exit
main endp
end main

include irvine32.inc
.data
var1 db ?
msg1 byte 'Enter ',0
X byte 'x',0
eql byte '=',0
.code
main proc
mov edx,offset msg1
call writestring
call readdec
mov var1,al
mov ecx,0Ah
mov bh,1
L:
mov eax,0
mov al,var1
call writedec
mov edx,offset X
call writestring
mov eax,0
mov al,bh
call writedec
mov edx,offset eql
call writestring
mov eax,0
mov al,bh
mul var1
call writedec
call crlf
inc bh
Loop L
exit
main endp
end main

include irvine32.inc
.data
msg1 byte 'Hello World!',0
.code
main proc
mov ecx,5h
L:
mov edx,offset msg1
call writestring
call crlf
loop L
exit
main endp
end main

include irvine32.inc
.data
var1 dd ?
term1 db 1
term2 db 1
space byte ' ',0
.code
main proc
mov ecx,5
Outerloop:
mov var1 ,ecx
mov ebx,0
mov bl,term1
mov ecx,5
Innerloop:
mov eax,0
mov al,bl
mul term2
call writedec
mov edx,offset space
call writestring
inc ebx
loop Innerloop
call crlf
mov ecx,var1
inc term2
loop Outerloop
exit
main endp
end main

You might also like