Propeller Manual

Table Of Contents
Assembly Language Reference
Page 240 · Propeller Manual v1.1
application data after that, whether or not it is required by the code. See the sections
discussing
ORG (page 328), RES (page 339), and DAT 99T (page ) for more information.
Cog Memory
Cog RAM is similar to Main RAM in the following ways:
Each can contain program instruction(s) and/or data.
Each can be modified at run-time (example: variables occupy RAM locations).
Cog RAM is different from Main RAM in the following ways:
Cog RAM is smaller and faster than Main RAM.
Cog RAM is a set of “registers” addressable only as longs (four bytes) while Main
RAM is a set of “locations” addressable as bytes, words, or longs.
Propeller Assembly executes right from Cog RAM while Spin code is fetched and
executed from Main RAM.
Cog RAM is available only to its own cog while Main RAM is shared by all cogs.
Once assembly code is loaded into Cog RAM, the cog executes it by reading a long (32-bit)
opcode from a register (starting with register 0), resolving its destination and source data,
executing the instruction (possibly writing the result to another register) and then moving on
to the next register address to repeat the process. Cog RAM registers may contain
instructions or pure data, and each may be modified as the result of the execution of another
instruction.
Where Does an Instruction Get Its Data?
Most instructions have two data operands; a destination value and a source value. For
example, the format for an
ADD instruction is:
add destination, #source
The destination operand is the 9-bit address of a register containing the desired value to
operate on. The source operand is either a 9-bit literal value (constant) or a 9-bit address of a
register containing the desired value. The meaning of the source operand depends on whether
or not the literal indicator “
#” was specified. For example: