Section 9.5: Subroutines (Frame 9)                     [prev][home][next]

Here's the wrong way to encode the C:

SOMEFUNC:
             ; start computing!
             RET
SUM:         NUM  0
COUNT:       NUM  0

The reason is that SUM and COUNT will be changed by every call to SOMEFUNC. It is only upon the first load that they are correctly set to 0. They must be set to 0 every time SOMEFUNC is called.