Bits | Meaning |
---|---|
0-15 | DragASprite Drag Location Flags |
16 | Rendering is done by: |
0 = SWI | |
1 = C/assembler function | |
17 | If rendering is a function, it is called in: |
0 = User Mode | |
1 = SVC mode | |
18 | Actually use “user mode” |
19-31 | Reserved, should be zero |
When calling DragAnObject with a SWI as the renderer, the block pointed to by R2 should be 10 words long. These words are loaded into R0-R9, and the SWI is called from SVC mode.
When calling DragAnObject with a C/assembler function as the renderer, the function is called in an APCS-conformant manner. The block pointed to by R2 should be 4 words long. These words are loaded into R0-R3 (a1-a4) and passed as parameters to the function. sl, sp and lr are all set correctly.
If the renderer function is in a module, also set bit 17 of the flags word, as this allows access to statics.
Prior to version 0.09 (Castle), DragAnObject would call client functions in SVC mode even when asked to call them in user mode. On 32 bit systems, this leads to an incorrect stack limit which leads to aborts.
Rather than fix the module, which may cause further faults in existing clients, a new bit (b18) indicates that the function should actually be called in user mode. If bit 18 is set, bit 17 should be clear.
The calling environment should be set up sufficiently to allow access to user and C library statics, provided that DragAnObject_Start was called via a veneer that preserves R10 and R11 (sl and fp). OSLib and _kernel_swi veneers are fine, and _swi is fine except on an unpatched RISC OS 3.70/3.71.