Question: i have this code is code in assembly but when I debug its giving me this error in this line: mov r 9 w ,
i have this code is code in assembly but when I debug its giving me this error in this line: mov rwrdx r
here is the code:
averagevolume PROTO
data
code
averagevolume PROC
; RCX is the pointer to the block
; RDX is the size of the block
; Setting rax to for clearer readibility when viewing process
mov rax,
; Exchanging value so that I can use the loop instruction
xchg rdx rcx
; RDX is know the pointer to the block and RCX the size, to begin a loop instruction
; R is an index of the position being modified or used in the traversal of the array
; starts at and ends at n
mov r
; The size of each block is limited to for the purpose of this code it is more
; than enough, since each block is of size or less
mov r rcx
; Summing the absolutes values of the entire block
L:
; Grabbing the value at the rth positon from memory
mov r
; this line is giving an error of access violation!!!!!!
mov rwrdx r
; Checking if the value is negative, we only want positive values
cmp rw
jl abs
endabs:
; R should now have the absolute values of the entire block
add rax, r
inc r
loop L
; Computing average of block, separating the dividend into dx:ax for proper use of division function
; This is done since eax, contains the result of the sum of the absolute values of all values
; in the block, and we need the average
mov cx ax
shr rax,
mov dx ax
mov ax cx
div rw
ret
; If it is negative convert to a positive value
abs:
neg rw
jmp endabs
averagevolume ENDP
END
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
