FIT

Directive: Validate that previous instructions/data fit entirely below a specific address.

FIT < Address >
Result: Compile-time error if previous instructions/data exceed Address-1.

  • Address is an optional Cog RAM address (0-$1F0) for which prior assembly code should not reach. If Address is not given, the value $1F0 is used (the address of the first special purpose register).

Explanation

The FIT directive checks the current compile-time cog address pointer and generates an error if it is beyond Address-1 or if it is beyond $1EF (the end of general purpose Cog RAM). This directive can be used to ensure that the previous instructions and data fit within Cog RAM, or a limited region of Cog RAM. Note: any instructions that do not fit in Cog RAM will be left out when the assembly code is launched into the cog. Consider the following example:

DAT
               ORG    492
Toggle         mov    dira,    Pin
:Loop          mov    outa,    Pin
               mov    outa,    #0
               jmp    #:Loop 

Pin    long    $1000 
               FIT 

This code was artificially pushed into upper Cog RAM space by the ORG statement, causing the code to overlap the first special purpose register ($1F0) and causing the FIT directive to cause a compile-time error when the code is compiled.

Unless otherwise noted, content on this site is licensed under the
Creative Commons Attribution-ShareAlike 4.0 International License.