NQC Overview Counters Contents | Master Index
 RCX2   Scout 

FUNCTIONS / COMMANDS
 
          ClearCounter()  Reset counter n to 0.
          IncCounter()  Increment counter n by 1.
          DecCounter()  Decrement counter n by 1.

VALUES / QUERIES
 
          Counter()  Return the current value of counter n.

OVERVIEW
 
          Counters are like very simple variables that can be incremented, decremented, and cleared.
 
          The Scout provides two counters (0 and 1).
 
          The RCX2 provides three counters (0, 1, and 2). In the case of RCX2, these counters are overlapped with global storage locations 0-2, so if they are going to be used as counters, a #pragma reserve should be used to prevent NQC from using the storage location for a regular variable. For example, to use counter 1:
  #pragma reserve 1

 
FUNCTIONS / COMMANDS
 RCX2   Scout 

         ClearCounter(n) Overview | Top
         
Reset counter n to 0. N must be 0 or 1 for Scout, 0-2 for RCX2.
ClearCounter(1);


         IncCounter(n) Overview | Top
         
Increment counter n by 1. N must be 0 or 1 for Scout, 0-2 for RCX2.
IncCounter(1);


         DecCounter(n) Overview | Top
         
Decrement counter n by 1. N must be 0 or 1 for Scout, 0-2 for RCX2.
DecCounter(1);



 
VALUES / QUERIES
 RCX2   Scout 

         Counter(n) Overview | Top
         
Return the current value of counter n. N must be 0 or 1 for Scout, 0-3 for RCX2.
x = Counter(1);


Comments