Propeller Manual

Table Of Contents
COGNEW – Spin Language Reference
Page 82 · Propeller Manual v1.1
Loop waitcnt Time, Delay 'Wait for 1/4 second
xor outa, #1 'toggle pin
jmp #Loop 'loop back
Delay res 1
Time res 1
The COGNEW instruction, in the Main method above, tells the Propeller chip to launch the
Toggle assembly code into a new cog. The Propeller then finds an available cog and copies
496 longs of the
DAT block’s content, starting at Toggle, into the cog’s RAM. Then the cog’s
PAR register is initialized, the remaining special purpose registers are cleared, and the cog
starts executing the assembly code starting at Cog RAM location 0.
The Parameter Field
It’s important to note that the Parameter field is intended to pass a long address, so only
14 bits (bits 2 through 15) are passed into the cog’s
PAR register; the lower two bits are always
cleared to zero to ensure it’s a long-aligned address. A value other than a long address can
still be passed via the Parameter field, but will have to be limited to 14 bits, must be shifted
left by two bits (for the
COGNEW/COGINIT command), and will have to be shifted right by two
bits by the assembly program that receives it.