Jump to content

Averages/Arithmetic mean: Difference between revisions

(adding Yorick)
Line 4:
 
=={{header|6502 Assembly}}==
Called as a subroutine (i.e., JSR ArithmeticMean), this calculates the integer average of up to 255 8-bit unsigned integers. The address of the beginning of the list of integers is in the memory location ArrayPtr and the number of integers is in the memory location NumberInts. The arithmetic mean is returned in the memroymemory location ArithMean.
 
<lang 6502asm>ArithmeticMean: PHA
Line 41:
BCS DivideLoop
Done: STY ArithMean ;store result here
Done: PLA ;restore accumulator and Y register from stack
 
Done: PLA ;restore accumulator and Y register from stack
TAY
PLA
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.