Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- INCLUDE Irvine32.inc
- .data
- myValue SDWORD ?
- prompt BYTE "Please enter a value:",0
- prompt2 BYTE "Please enter a value to search for:",0
- prompt3 BYTE "Error number not found",0
- prompt4 BYTE "Found the number: ",0
- prompt5 BYTE " at position: ",0
- prompt6 BYTE " ",0
- myarray DWORD 20 DUP(?)
- .code
- main PROC
- mov ebx, 0
- mov ecx, 0
- begPrompt: lea edx,prompt
- call WriteString
- call ReadInt
- mov [myarray+ecx], eax
- add ecx, 4
- add ebx, 1
- cmp ebx, 20
- jl begPrompt
- mov eax, 0
- mov ebx, 0
- begloop: mov eax, [myarray+ebx]
- call WriteDec
- lea edx,prompt6
- call WriteString
- add ebx,4
- mov eax,0
- cmp ebx,40
- jl begloop
- call Crlf
- mov eax, 0
- beg2loop: mov eax, [myarray+ebx]
- call WriteDec
- lea edx,prompt6
- call WriteString
- add ebx,4
- mov eax,0
- cmp ebx,80
- jl beg2loop
- mov eax, 0
- mov ebx, 0
- mov ecx, 0
- call Crlf
- lea edx,prompt2
- call WriteString
- call ReadInt
- mov ecx, eax
- mov eax, 0
- cmp ecx, 0
- jl negative
- beg3loop: mov eax, [myarray+ebx]
- cmp eax, ecx
- je exitloops
- add ebx,4
- cmp ebx,80
- jg error
- jmp beg3loop
- call Crlf
- error: lea edx,prompt3
- call WriteString
- negative:
- exitloops: lea edx,prompt4
- call WriteString
- call WriteDec
- lea edx,prompt5
- call WriteString
- mov eax,ebx
- mov ebx,4
- mov edx, 0
- div ebx
- add eax, 1
- call WriteDec
- call Crlf
- exit
- main ENDP
- END main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement