Averages/Arithmetic mean: Difference between revisions
Content added Content deleted
(adding Yorick) |
|||
Line 4: | Line 4: | ||
=={{header|6502 Assembly}}== |
=={{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 |
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 memory location ArithMean. |
||
<lang 6502asm>ArithmeticMean: PHA |
<lang 6502asm>ArithmeticMean: PHA |
||
Line 41: | Line 41: | ||
BCS DivideLoop |
BCS DivideLoop |
||
STY ArithMean ;store result here |
Done: STY ArithMean ;store result here |
||
⚫ | |||
⚫ | |||
TAY |
TAY |
||
PLA |
PLA |