Categorical Listing of Propeller Assembly Language

Elements marked with a superscript "s" are also available in Propeller Spin.

Directives

ORGAdjust compile-time cog address pointer.
FITValidate that previous instructions/data fit entirely in cog.
RESReserve next long(s) for symbol.

Configuration

CLKSETsSet clock mode at run time.

Cog Control

COGIDsGet current cog's ID.
COGINITsStart, or restart, a cog by ID.
COGSTOPsStop a cog by ID.

Process Control

LOCKNEWsCheck out a new lock.
LOCKRETsReturn a lock.
LOCKCLRsClear a lock by ID.
LOCKSETsClear a lock by ID.
WAITCNTsPause execution temporarily.
WAITPEQsPause execution until pin(s) match designated state(s).
WAITPNEsPause execution until pin(s) do not match designated state(s).
WAITVIDsPause execution until Video Generator is available for pixel data.

Conditions

Refer to IF_x (Conditions) for the following:

IF_ALWAYSAlways.
IF_NEVERNever.
IF_EIf equal (Z = 1).
IF_NEIf not equal (Z = 0).
IF_AIf above (!C & !Z = 1).
IF_BIf below (C = 1).
IF_AEIf above or equal (C = 0).
IF_BEIf below or equal (C | Z = 1).
IF_CIf C set.
IF_NCIf C clear.
IF_ZIf Z set.
IF_NZIf Z clear.
IF_C_EQ_ZIf C equal to Z.
IF_C_NE_ZIf C not equal to Z.
IF_C_AND_ZIf C set and Z set.
IF_C_AND_NZIf C set and Z clear.
IF_NC_AND_ZIf C clear and Z set.
IF_NC_AND_NZIf C clear and Z clear.
IF_C_OR_ZIf C set or Z set.
IF_C_OR_NZIf C set or Z clear.
IF_NC_OR_ZIf C clear or Z set.
IF_NC_OR_NZIf C clear or Z clear.
IF_Z_EQ_CIf Z equal to C.
IF_Z_NE_CIf Z not equal to C.
IF_Z_AND_CIf Z set and C set.
IF_Z_AND_NCIf Z set and C clear.
IF_NZ_AND_CIf Z clear and C set.
IF_NZ_AND_NCIf Z clear and C clear.
IF_Z_OR_CIf Z set or C set.
IF_Z_OR_NCIf Z set or C clear.
IF_NZ_OR_CIf Z clear or C set.
IF_NZ_OR_NCIf Z clear or C clear.

Flow Control

CALLJump to address with intention to return to next instruction.
DJNZDecrement value and jump to address if not zero.
JMPJump to address unconditionally.
JMPRETJump to address with intention to "return" to another address.
TJNZTest value and jump to address if not zero.
TJZTest value and jump to address if zero.
RETReturn to stored address.

Effects

Refer to Effects (WC, WZ, WR, NR) for the following:

NRNo result (don't write result).
WRWrite result.
WCWrite C status.
WZWrite Z status.

Main Memory Access

RDBYTERead byte of main memory.
RDWORDRead word of main memory.
RDLONGRead long of main memory.
WRBYTEWrite a byte to main memory.
WRWORDWrite a word to main memory.
WRLONGWrite a long to main memory.

Common Operations

ABSGet absolute value of a number.
ABSNEGGet negative of number's absolute value.
NEGGet negative of a number.
NEGCGet a value, or its additive inverse, based on C.
NEGNCGet a value or its additive inverse, based on !C.
NEGZGet a value, or its additive inverse, based on Z.
NEGNZGet a value, or its additive inverse, based on !Z.
MINLimit minimum of unsigned value to another unsigned value.
MINSLimit minimum of signed value to another signed value.
MAXLimit maximum of unsigned value to another unsigned value.
MAXSLimit maximum of signed value to another signed value.
ADDAdd two unsigned values.
ADDABSAdd absolute value to another value.
ADDSAdd two signed values.
ADDXAdd two unsigned values plus C.
ADDSXAdd two signed values plus C.
SUBSubtract two unsigned values.
SUBABSSubtract an absolute value from another value.
SUBSSubtract two signed values.
SUBXSubtract unsigned value plus C from another unsigned value.
SUBSXSubtract signed value plus C from another signed value.
SUMCSum signed value with another of C-affected sign.
SUMNCSum signed value with another of !C-affected sign.
SUMZSum signed value with another Z-affected sign.
SUMNZSum signed value with another of !Z-affected sign.
MUL<reserved for future use>
MULS<reserved for future use>
ANDBitwise AND two values.
ANDNBitwise AND value with NOT of another.
ORBitwise OR two values.
XORBitwise XOR two values.
ONES<reserved for future use>
ENC<reserved for future use>
RCLRotate C left into value by specified number of bits.
RCRRotate C right into value by specified number of bits.
REVReverse LSBs of value and zero-extend.
ROLRotate value left by specified number of bits.
RORRotate value right by specified number of bits.
SHLShift value left by specified number of bits.
SHRShift value right by specified number of bits.
SARShift value arithmetically right by specified number of bits.
CMPCompare two unsigned values.
CMPSCompare two signed values.
CMPXCompare two unsigned values plus C.
CMPSXCompare two signed values plus C.
CMPSUBCompare unsigned values, subtract second if lesser or equal.
TESTBitwise AND two values to affect flags only.
TESTNBitwise AND a value with NOT of another to affect flags only.
MOVSet a register to a value.
MOVSSet a register's source field to a value.
MOVDSet a register's destination field to a value.
MOVISet a register's instruction field to a value.
MUXCSet discrete bits of a value to the state of C.
MUXNCSet discrete bits of a value to the state of !C.
MUXZSet discrete bits of a value to the state of Z.
MUXNZSet discrete bits of a value to the state of !Z.
HUBOPPerform a hub operation.
NOPNo operation, just elapse four cycles.

Constants

NOTE: Refer to Constants (pre-defined) in Chapter 2: Spin Language Reference.

TRUEsLogical true: -1 ($FFFFFFFF).
FALSEsLogical false: 0 ($00000000).
POSXsMaximum positive integer: 2,147,483,647 ($7FFFFFFF).
NEGXsMaximum negative integer: -2,147,483,648 ($80000000).
PIsFloating-point value for PI: ~3.141593 ($40490FDB).

Registers

DIRAsDirection Register for 32-bit port A.
DIRBsDirection Register for 32-bit port B (future use).
INAsInput Register for 32-bit port A (read only).
INBsInput Register for 32-bit port B (read only) (future use).
OUTAsOutput Register for 32-bit port A.
OUTBsOutput Register for 32-bit port B (future use).
CNTs32-bit System Counter Register (read only).
CTRAsCounter A Control Register.
CTRBsCounter B Control Register.
FRQAsCounter A Frequency Register.
FRQBsCounter B Frequency Register.
PHSAsCounter A Phase Lock Loop (PLL) Register.
PHSBsCounter B Phase Lock Loop (PLL) Register.
VCFGsVideo Configuration Register.
VSCLsVideo Scale Register.
PARsCog 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.
ANDBoolean: AND (promotes non-0 to -1).
ORBoolean: 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).

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