Propeller Manual

Table Of Contents
RES – Assembly Language Reference
Symbol Address Instruction/Data
AsmCode 0 mov Time, cnt
1 add Time, Delay
:Loop 2 waitcnt Time, Delay
3 nop
4 jmp #:Loop
Delay 5 6_000_000
Time 6 ?
RES simply increments the compile-time assembly pointer that affects further symbol
references (Cog RAM); it does not consume space in the object (Main RAM). This
distinction is important in how it impacts the object code, initialized symbols, and affects run-
time operation.
Since it increments the compile-time assembly pointer only, the computed address of
all symbols following a RES statement are affected accordingly.
No space is actually consumed in the object/application (Main RAM). This is an
advantage if defining buffers that should only exist in Cog RAM but not Main RAM.
Caution: Use RES Only After Instructions and Data
It’s important to use
RES only after the final instructions and data in a logical assembly
program. Placing
RES in a prior location could have unintended results as explained below.
Remember that assembly instructions and data are placed in the application memory image in
the exact order entered in source, independent of the assembly pointer. This is because
launched assembly code must be loaded in order, starting with the designated routine label.
However, since
RES does not generate any data (or code), it has absolutely no effect on the
memory image of the application;
RES only adjusts the value of the assembly pointer.
By nature of the
RES directive, any data or code appearing after a RES statement will be placed
immediately after the last non-
RES entity, in the same logical space as the RES entities
themselves. Consider the following example where the code, from above, has the order of
the
Time and Delay declarations reversed.
DAT
ORG 0
AsmCode mov Time, cnt 'Get system counter
add Time, Delay 'Add delay
Page 340 · Propeller Manual v1.1