Language Elements

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

Configuration

CHIPVERPropeller chip version number.
CLKMODECurrent clock mode setting.
_CLKMODEApplication-defined clock mode (read-only).
CLKFREQCurrent clock frequency.
_CLKFREQApplication-defined clock frequency (read-only).
CLKSETaSet clock mode and clock frequency.
_XINFREQApplication-defined external clock frequency (read-only).
_STACKApplication-defined stack space to reserve (read-only).
_FREEApplication-defined free space to reserve (read-only).

Process Control

WAITCNTaWait for System Counter to reach a value.
WAITPEQaWait for pin(s) to be equal to value.
WAITPNEaWait for pin(s) to be not equal to value.
WAITVIDaWait for video sync and deliver next color/pixel group.

Flow Control

IF

...ELSEIF
...ELSEIFNOT
...ELSEIF 

Conditionally execute one or more blocks of code.

IFNOT

...ELSEIF
...ELSEIFNOT
...ELSE

Conditionally execute one or more blocks of code.

CASE

...OTHER

Evaluate expression and execute block of code that satisfies a condition.

REPEAT

...FROM
...TO
...STEP
...UNTIL
...WHILE 

Execute block of code repetitively an infinite or finite number of times with optional loop counter, intervals, exit and continue conditions.
NEXTSkip rest of REPEAT block and jump to next loop iteration.
QUITExit from REPEAT loop.
RETURNExit PUB/PRI with normal status and optional return value.
ABORTExit PUB/PRI with abort status and optional return value.

Memory

BYTEDeclare byte-sized symbol or access byte of main memory.
WORDDeclare word-sized symbol or access word of main memory.
LONGDeclare long-sized symbol or access long of main memory.
BYTEFILLFill bytes of main memory with a value.
WORDFILLFill words of main memory with a value.
LONGFILLFill longs of main memory with a value.
BYTEMOVECopy bytes from one region to another in main memory.
WORDMOVECopy words from one region to another in main memory.
LONGMOVECopy longs from one region to another in main memory.
LOOKUPGet value at index (1..N) from a list.
LOOKUPZGet value at zero-based index (0..N−1) from a list.
LOOKDOWNGet index (1..N) of a matching value from a list.
LOOKDOWNZ Get zero-based index (0..N−1) of a matching value from a list.
STRSIZEGet size of string in bytes.
STRCOMPCompare a string of bytes against another string of bytes.

Directives

STRINGDeclare in-line string expression; resolved at compile time.
CONSTANTDeclare in-line constant expression; resolved at compile time.
FLOATDeclare floating-point expression; resolved at compile time.
ROUNDRound compile-time floating-point expression to integer.
TRUNCTruncate compile-time floating-point expression at decimal.
FILEImport data from an external file.

Registers

DIRAaDirection Register for 32-bit port A.
DIRBaDirection Register for 32-bit port B (future use).
INAaInput Register for 32-bit port A (read only).
INBaInput Register for 32-bit port B (read only) (future use).
OUTAaOutput Register for 32-bit port A.
OUTBaOutput Register for 32-bit port B (future use).
CNTa32-bit System Counter Register (read only).
CTRAaCounter A Control Register.
CTRBaCounter B Control Register.
FRQAaCounter A Frequency Register.
FRQBaCounter B Frequency Register.
PHSAaCounter A Phase-Locked Loop (PLL) Register.
PHSBaCounter B Phase-Locked Loop (PLL) Register.
VCFGaVideo Configuration Register.
VSCLaVideo Scale Register.
PARaCog Boot Parameter Register (read only).
SPRSpecial-Purpose Register array; indirect cog register access.

Constants

TRUEaLogical true: -1 ($FFFFFFFF).
FALSEaLogical false: 0 ($00000000).
POSXaMaximum positive integer: 2,147,483,647 ($7FFFFFFF).
NEGXaMaximum negative integer: -2,147,483,648 ($80000000).
PIaFloating-point value for PI: ~3.141593 ($40490FDB).

Variable

RESULTDefault result variable for PUB/PRI methods.

Unary Operators

+Positive (+X); unary form of Add.
-Negate (-X); unary form of Subtract.
--Pre-decrement (X) or post-decrement (X-) and assign.
++Pre-increment (+X) or post-increment (X+) and assign.
^^Square root.
||Absolute Value.
~Sign-extend from bit 7 (~X) or post-clear to 0 (X).
~~Sign-extend from bit 15 (X) or post-set to -1(X~).
?Random number forward (?X) or reverse (X?).
|<Decode value (modulus of 32; 0-31) into single-high-bit long.
>|Encode long into magnitude (0 - 32) as high-bit priority.
!Bitwise: NOT.
NOTBoolean: NOT (promotes non-0 to -1).
@Symbol address.
@@Object address plus symbol value.

Binary Operators

NOTE: All right-column operators are assignment operators.

= --or-- =Constant assignment (CON blocks).
:= -and- :=Variable assignment (PUB/PRI blocks).
+ --or-- =Add.
- --or-- -=Subtract.
* --or-- *=Multiply and return lower 32 bits (signed).
** --or-- **=Multiply and return upper 32 bits (signed).
/ --or-- /=Divide (signed).
// --or-- //=Modulus (signed).
#> --or-- #>=Limit minimum (signed).
<# --or-- <#=Limit maximum (signed).
> --or-- >=Bitwise: Shift arithmetic right.
<< --or-- <<=Bitwise: Shift left.
>> --or-- >>=Bitwise: Shift right.
< --or- <-=Bitwise: Rotate left.
> --or- ->=Bitwise: Rotate right.
>< --or-- ><=Bitwise: Reverse.
& --or-- &=Bitwise: AND.
| --or-- |=Bitwise: OR.
^ --or-- ^=Bitwise: XOR.
AND --or-- AND=Boolean: AND (promotes non-0 to -1).
OR --or-- OR=Boolean: OR (promotes non-0 to -1).
== --or-- ===Boolean: Is equal.
<> --or-- <>=Boolean: Is not equal.
< --or-- <=Boolean: Is less than (signed).
> --or-- >=Boolean: Is greater than (signed).
=< --or-- =<=Boolean: Is equal or less (signed).
=> --or-- =>=Boolean: Is equal or greater (signed).

Syntax Symbols

%Binary number indicator, as in %1010.
%%Quaternary number indicator, as in %%2130.
$Hexadecimal indicator, as in $1AF or assembly 'here' indicator.
" String designator "Hello".
_Group delimiter in constant values, or underscore in symbols.
#Object-Constant reference: obj#constant.
.Object-Method reference: obj.method(param) or decimal point.
..Range indicator, as in 0..7.
:Return separator: PUB method : sym, or object assignment, etc..
|Local variable separator: PUB method | temp, str.
\Abort trap, as in \method(parameters).
,List delimiter, as in method(param1, param2, param3).
( )Parameter list designators, as in method(parameters).
[ ]Array index designators, as in INA[2].
{ }In-line/multi-line code comment designators.
{{ }}In-line/multi-line document comment designators.
'Code comment designator.
''Document comment designator.

 

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