Propeller Manual

Table Of Contents
3: Assembly Language Reference – RES
RES
Directive: Reserve next long(s) for symbol.
Symbol RES Count
Symbol is an optional name for the reserved long in Cog RAM.
Count is the optional number of longs to reserve for Symbol. If not specified, RES
reserves one long.
Explanation
The
RES (reserve) directive effectively reserves one or more longs of Cog RAM by
incrementing the compile-time assembly pointer by Count. Normally this is used to reserve
memory for an assembly symbol that does not need initialization to any specific value. For
example:
DAT
ORG 0
AsmCode mov Time, cnt 'Get system counter
add Time, Delay 'Add delay
:Loop waitcnt Time, Delay 'Wait for time window
nop 'Do something useful
jmp #:Loop 'Loop endlessly
Delay long 6_000_000 'Time window size
Time RES 1 'Time window workspace
The last line of the AsmCode example, above, reserves one long of Cog RAM for the symbol
Time without defining an initial value. AsmCode uses Time as a long variable to wait for the
start of a time window of 6 million clock cycles. When
AsmCode is launched into a cog, it is
loaded into Cog RAM as shown below
Propeller Manual v1.1 · Page 339