Propeller Manual

Table Of Contents
3: Assembly Language Reference – COGINIT
Propeller Manual v1.1 · Page 285
Table 3-1: Destination Register Fields
31:18 17:4 3 2:0
14-bit Long address for PAR Register 14-bit Long address of code to load New Cog ID
The first field, bits 31:18, will be written to the started cog’s
PAR register bits 15:2. This is 14
bits total that are intended to be the upper bits of a 16-bit long address. Similar to the
Parameter field of Spin’s version of
COGINIT, this first field of Destination is used to pass the
14-bit address of an agreed-upon memory location or structure to the started cog.
T
The second field, bits 17:4, holds the upper 14-bits of a 16-bit long address pointing to the
desired assembly program to load into the cog. Cog registers $000 through $1EF will be
loaded sequentially starting at this address, the special purpose registers will be cleared to
zero (0), and the cog will start executing the code at register $000.
The third field, bit 3, should be set (1) if a new cog should be started, or cleared (0) if a
specific cog should be started or restarted.
If the third field bit is set (1), the Hub will start the next available (lowest-numbered inactive)
cog and return that cog’s ID in Destination (if the
WR effect is specified).
If the third field bit is clear (0), the Hub will start or restart the cog identified by Destination’s
fourth field, bits 2:0.
If the
WZ effect is specified, the Z flag will be set (1) if the cog ID returned is 0. If the WC
effect is specified, the C flag will be set (1) if no cog was available. If the
WR effect is
specified, Destination is written with the ID of the cog that the Hub started, or would have
started, if you let it pick one.
It is not practical to launch Spin code from a user’s Propeller Assembly code; we recommend
launching only assembly code with this instruction.
COGINIT is a hub instruction. Hub instructions require 7 to 22 clock cycles to execute
depending on the relation between the cog’s hub access window and the instruction’s moment
of execution. See on page for more information.
T
Hub 24