*Commands provide a simple method of accessing key functionality provided by RISC OS. A wide range of *Commands is provided by RISC OS for a range of tasks such as file manipulation, updating date and time, using sound and graphics, networking and system configuration.
The advantages of *Commands are:
The disadvantages of *Commands are:
There will be instances when it is more appropriate to use a SWI rather than a *Command, and vice-versa.
*Commands can be used in the following ways:
When a *Command is used, RISC OS passes the text to OS_CLI. This determines which routine(s) should be called to perform the required action.
*Commands can be called from within BASIC by issuing them directly (e.g. *Help
). Using the OSCLI *Command provides a method of passing variables:
cmd$ = "Time" OSCLI "Help " + cmd$ :REM Issues the *Help Command for Time
The final method available from BASIC is passing the *Command string to the SWI OS_CLI.
SYS "OS_CLI", "*Help"
*Commands can be called from Assembler by passing the *Command string to the SWI OS_CLI. A null byte terminating the command string is required.
[TO DO] Calling from C
Because RISC OS is a modular Operating System, *Commands can be altered, added and even replaced. This can be done by claiming vectors, replacing modules, or adding new modules.
When a vector is claimed, it affects how a SWI that uses it works. The same applies for *Commands.
As well as providing a number of SWIs, modules may also provide *Commands. If a module is to be replaced, the replacement must provide the same commands with the same syntax and accept the same parameters (if any). A replacement module may also provide extra *Commands.
New modules can be added to RISC OS to provide new functionality. There is no limit to how many *Commands can be added to the system.
By using system variables, it is possible to create new *Commands from existing ones, or to rename existing *Commands. This can be achieved by using an Alias$command variable, where command is the name of the existing command. The example below defines a new command *Mode
which changes to the screen mode to the number given after the command.
*Set Alias$Mode echo |<22>|<%0>
Index of *Commands
Modules
Software Vectors
System Variables