Hi, I need help with this problem: Write a short SRC assembly language program t
ID: 3620931 • Letter: H
Question
Hi, I need help with this problem:Write a short SRC assembly language program that will check the occurence of variable called "X" in an array called "Myarray". The number of times X appears in Myarray must be stored in variable called "CNT". All variables here assumed to in memory and are of size 16 bits. Thank you ^^ Write a short SRC assembly language program that will check the occurence of variable called "X" in an array called "Myarray". The number of times X appears in Myarray must be stored in variable called "CNT". All variables here assumed to in memory and are of size 16 bits. Thank you ^^
Explanation / Answer
Dear, Here is the code mov CNT,0 ; CNT := 0 mov eax,x ; moves value of x to eax lea ebx,myArray ; get address of nbrArray mov ecx,nbrElts ; count := nbrElts jecxz quit ; quit if no numbers forCount1: cmp eax,[ebx] ; add number to sum je CNTinc add ebx,4 ; get address of next item of array loop forCount1 ; repeat nbrElts times CNTinc: inc CNT; increment count add ebx,4 loop forCount1 ; repeat nbrElts times Hope this will help you..
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.