Question: Im trying to display the values of the array by using the call function. So far this is my code. I dont want to use

Im trying to display the values of the array by using the call function. So far this is my code. I dont want to use dump regs but display values by labels. The Irvine library is used in this. Help
INCLUDE Irvine32.inc
.data
applesSold SDWORD 8, 6, 7, 5, 3 ; your comment
orangesSold SDWORD 1, 9, 4, 2 ; your comment
totalApplesSold SDWORD ? ; your comment
totalOrangesSold SDWORD ? ; your comment
totalFruits SDWORD ? ; your comment
.code
main PROC
mov eax,0
mov ebx,0
mov ecx,0
mov edi, OFFSET applesSold ; address of intarray
mov ecx, LENGTHOF applesSold ; loop counter
mov eax,0 ; zero the accumulator
SUM_L1:
add eax, [edi] ; add an integer
add edi, TYPE applesSold ; point to next integer
loop SUM_L1 ; repeat until ECX = 0
mov totalApplesSold, edi
endloop:
mov edi, OFFSET orangesSold ; address of intarray
mov ecx, LENGTHOF orangesSold ; loop counter
mov eax,0
loopOrange:
add eax, [edi] ; add an integer
add edi, TYPE OrangesSold ; point to next integer
loop loopOrange ; repeat until ECX = 0
mov totalOrangesSold, edi
mov eax, totalApplesSold
mov ebx, totalOrangesSold
mov totalFruits,0
add totalFruits, eax
add totalFruits, ebx
exit
main ENDP
displayTotals PROC uses eax edx
mov eax, totalApplesSold ; load eax with total apples to display
mov edx, offset totalApplesString ; load edx with address of total apple string
call writeString ; display "label"
call writeInt ; display total apples (showing sign)
call crlf ;
mov eax, totalOrangesSold ; load eax with total oranges to display
mov edx, offset totalOrangesString ; load edx with address of total orange string
call writeString ; display "label"
call writeInt ; display total oranges (showing sign)
call crlf
mov eax, totalFruitSold ; load eax with total fruit to display
mov edx, offset totalFruitString ; load edx with address of total fruit string
call writeString ; display "label"
call writeInt ; display total fruit (showing sign)
call crlf
ret
displayTotals ENDP
;)
END main

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!