h6. [[OS SWI Calls]] h6(. » OS_CallASWI h2. OS_CallASWI h5. (SWI &6F) |_<^{width:4em}. Entry | | |<^. R0–R9 |<^. As required for target SWI | |<^. R10 |<^. Target SWI number | |_<^{width:4em}. Exit | | |<^. R0–R9 |<^. As defined for target SWI | |<^. R10 |<^. Preserved | h4. Use The purpose of this call, is to call a run-time determined SWI. h4. Notes This SWI allows a target SWI number to be determined at run time, and passed in a register. This removes the need for a common idiom of dynamic code, in language library SWI veneers for example. In an APCS-R library, use [[OS_CallASWIR12]]. Note that this call is merely an alias for calling the target SWI. It has no entry/exit conditions of its own, except for the special use of R10. To call a target SWI with X bit set, use the X form of the SWI number in R10; there is no distinction between OS_CallASWI and XOS_CallASWI. You cannot use this SWI to call itself, that is OS_CallASWI or [[OS_CallASWIR12]], since there is no defined final target SWI in this case. You cannot usefully call [[OS_BreakPt]] or [[OS_CallAVector]], as it will corrupt the processor flags before entering the target SWI. For future compatibility, you should always use this SWI in preference to any local construction for calling a SWI by number. For compatibility with older versions of RISC OS, a new CallASWI module will be made available. Note that this SWI calling mechanism is almost certainly faster than any other alternative implementation, including the original _kernel_swi and _swix code contained in older versions of the SharedCLibrary. The new SharedCLibrary now simply uses [[OS_CallASWIR12]] for _kernel_swi and _swix. OS_CallASWI cannot be called from BASIC as BASIC only passes registers R0-R7 via its SYS instruction. It would not be useful anyway. The [[CallASWI|CallASWI module]] provides this functionality for versions of RISC OS 3.70 or earlier. h4. See also * [[OS_BreakPt]] * [[OS_CallASWIR12]] * [[OS_CallAVector]]