Elements marked with a superscript "s" are also available in Propeller Spin.
Directives
ORG | Adjust compile-time cog address pointer. |
FIT | Validate that previous instructions/data fit entirely in cog. |
RES | Reserve next long(s) for symbol. |
Configuration
CLKSETs | Set clock mode at run time. |
Cog Control
Process Control
LOCKNEWs | Check out a new lock. |
LOCKRETs | Return a lock. |
LOCKCLRs | Clear a lock by ID. |
LOCKSETs | Clear a lock by ID. |
WAITCNTs | Pause execution temporarily. |
WAITPEQs | Pause execution until pin(s) match designated state(s). |
WAITPNEs | Pause execution until pin(s) do not match designated state(s). |
WAITVIDs | Pause execution until Video Generator is available for pixel data. |
Conditions
Refer to IF_x (Conditions) for the following:
IF_ALWAYS | Always. |
IF_NEVER | Never. |
IF_E | If equal (Z = 1). |
IF_NE | If not equal (Z = 0). |
IF_A | If above (!C & !Z = 1). |
IF_B | If below (C = 1). |
IF_AE | If above or equal (C = 0). |
IF_BE | If below or equal (C | Z = 1). |
IF_C | If C set. |
IF_NC | If C clear. |
IF_Z | If Z set. |
IF_NZ | If Z clear. |
IF_C_EQ_Z | If C equal to Z. |
IF_C_NE_Z | If C not equal to Z. |
IF_C_AND_Z | If C set and Z set. |
IF_C_AND_NZ | If C set and Z clear. |
IF_NC_AND_Z | If C clear and Z set. |
IF_NC_AND_NZ | If C clear and Z clear. |
IF_C_OR_Z | If C set or Z set. |
IF_C_OR_NZ | If C set or Z clear. |
IF_NC_OR_Z | If C clear or Z set. |
IF_NC_OR_NZ | If C clear or Z clear. |
IF_Z_EQ_C | If Z equal to C. |
IF_Z_NE_C | If Z not equal to C. |
IF_Z_AND_C | If Z set and C set. |
IF_Z_AND_NC | If Z set and C clear. |
IF_NZ_AND_C | If Z clear and C set. |
IF_NZ_AND_NC | If Z clear and C clear. |
IF_Z_OR_C | If Z set or C set. |
IF_Z_OR_NC | If Z set or C clear. |
IF_NZ_OR_C | If Z clear or C set. |
IF_NZ_OR_NC | If Z clear or C clear. |
Flow Control
CALL | Jump to address with intention to return to next instruction. |
DJNZ | Decrement value and jump to address if not zero. |
JMP | Jump to address unconditionally. |
JMPRET | Jump to address with intention to "return" to another address. |
TJNZ | Test value and jump to address if not zero. |
TJZ | Test value and jump to address if zero. |
RET | Return to stored address. |
Effects
Refer to Effects (WC, WZ, WR, NR) for the following:
NR | No result (don't write result). |
WR | Write result. |
WC | Write C status. |
WZ | Write Z status. |
Main Memory Access
RDBYTE | Read byte of main memory. |
RDWORD | Read word of main memory. |
RDLONG | Read long of main memory. |
WRBYTE | Write a byte to main memory. |
WRWORD | Write a word to main memory. |
WRLONG | Write a long to main memory. |
Common Operations
ABS | Get absolute value of a number. |
ABSNEG | Get negative of number's absolute value. |
NEG | Get negative of a number. |
NEGC | Get a value, or its additive inverse, based on C. |
NEGNC | Get a value or its additive inverse, based on !C. |
NEGZ | Get a value, or its additive inverse, based on Z. |
NEGNZ | Get a value, or its additive inverse, based on !Z. |
MIN | Limit minimum of unsigned value to another unsigned value. |
MINS | Limit minimum of signed value to another signed value. |
MAX | Limit maximum of unsigned value to another unsigned value. |
MAXS | Limit maximum of signed value to another signed value. |
ADD | Add two unsigned values. |
ADDABS | Add absolute value to another value. |
ADDS | Add two signed values. |
ADDX | Add two unsigned values plus C. |
ADDSX | Add two signed values plus C. |
SUB | Subtract two unsigned values. |
SUBABS | Subtract an absolute value from another value. |
SUBS | Subtract two signed values. |
SUBX | Subtract unsigned value plus C from another unsigned value. |
SUBSX | Subtract signed value plus C from another signed value. |
SUMC | Sum signed value with another of C-affected sign. |
SUMNC | Sum signed value with another of !C-affected sign. |
SUMZ | Sum signed value with another Z-affected sign. |
SUMNZ | Sum signed value with another of !Z-affected sign. |
MUL | <reserved for future use> |
MULS | <reserved for future use> |
AND | Bitwise AND two values. |
ANDN | Bitwise AND value with NOT of another. |
OR | Bitwise OR two values. |
XOR | Bitwise XOR two values. |
ONES | <reserved for future use> |
ENC | <reserved for future use> |
RCL | Rotate C left into value by specified number of bits. |
RCR | Rotate C right into value by specified number of bits. |
REV | Reverse LSBs of value and zero-extend. |
ROL | Rotate value left by specified number of bits. |
ROR | Rotate value right by specified number of bits. |
SHL | Shift value left by specified number of bits. |
SHR | Shift value right by specified number of bits. |
SAR | Shift value arithmetically right by specified number of bits. |
CMP | Compare two unsigned values. |
CMPS | Compare two signed values. |
CMPX | Compare two unsigned values plus C. |
CMPSX | Compare two signed values plus C. |
CMPSUB | Compare unsigned values, subtract second if lesser or equal. |
TEST | Bitwise AND two values to affect flags only. |
TESTN | Bitwise AND a value with NOT of another to affect flags only. |
MOV | Set a register to a value. |
MOVS | Set a register's source field to a value. |
MOVD | Set a register's destination field to a value. |
MOVI | Set a register's instruction field to a value. |
MUXC | Set discrete bits of a value to the state of C. |
MUXNC | Set discrete bits of a value to the state of !C. |
MUXZ | Set discrete bits of a value to the state of Z. |
MUXNZ | Set discrete bits of a value to the state of !Z. |
HUBOP | Perform a hub operation. |
NOP | No operation, just elapse four cycles. |
Constants
NOTE: Refer to Constants (pre-defined) in Chapter 2: Spin Language Reference.
TRUEs | Logical true: -1 ($FFFFFFFF). |
FALSEs | Logical false: 0 ($00000000). |
POSXs | Maximum positive integer: 2,147,483,647 ($7FFFFFFF). |
NEGXs | Maximum negative integer: -2,147,483,648 ($80000000). |
PIs | Floating-point value for PI: ~3.141593 ($40490FDB). |
Registers
DIRAs | Direction Register for 32-bit port A. |
DIRBs | Direction Register for 32-bit port B (future use). |
INAs | Input Register for 32-bit port A (read only). |
INBs | Input Register for 32-bit port B (read only) (future use). |
OUTAs | Output Register for 32-bit port A. |
OUTBs | Output Register for 32-bit port B (future use). |
CNTs | 32-bit System Counter Register (read only). |
CTRAs | Counter A Control Register. |
CTRBs | Counter B Control Register. |
FRQAs | Counter A Frequency Register. |
FRQBs | Counter B Frequency Register. |
PHSAs | Counter A Phase Lock Loop (PLL) Register. |
PHSBs | Counter B Phase Lock Loop (PLL) Register. |
VCFGs | Video Configuration Register. |
VSCLs | Video Scale Register. |
PARs | Cog Boot Parameter Register (read only). |
Unary Operators
NOTE: All operators shown are constant-expression operators.
Please refer to Operators for the following:
+ | Positive (+X) unary form of Add. |
- | Negate (−X); unary form of Subtract. |
^^ | Square root. |
| | | Absolute Value. |
|< | Decode value (0-31) into single-high-bit long. |
>| | Encode long into value (0 - 32) as high-bit priority. |
! | Bitwise: NOT. |
@ | Address of symbol. |
+ | Add. |
- | Subtract. |
* | Multiply and return lower 32 bits (signed). |
** | Multiply and return upper 32 bits (signed). |
/ | Divide and return quotient (signed). |
// | Divide and return remainder (signed). |
#> | Limit minimum (signed). |
<# | Limit maximum (signed). |
~> | Bitwise: Shift arithmetic right. |
<< | Bitwise: Shift left. |
>> | Bitwise: Shift right. |
<- | Bitwise: Rotate left. |
-> | Bitwise: Rotate right. |
>< | Bitwise: Reverse. |
& | Bitwise: AND. |
| | Bitwise: OR. |
^ | Bitwise: XOR. |
AND | Boolean: AND (promotes non-0 to -1). |
OR | Boolean: OR (promotes non-0 to -1). |
= = | Boolean: Is equal. |
<> | Boolean: Is not equal. |
< | Boolean: Is less than (signed). |
> | Boolean: Is greater than (signed). |
=< | Boolean: Is equal or less (signed). |
=> | Boolean: Is equal or greater (signed). |