*Commands provide a simple method of accessing key functionality provided by RISC OS. A wide range of *Commands are provided by RISC OS for a range of tasks such as file manipulation, date and time, sound, 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.
A full list of *Commands, is available.
*Commands can be used in the following ways:
When a *Command is used, RISC OS actually passes the text to a SWI named OS_CLI. This SWI determines which SWI should then be called to perform the necessary action, and then calls it.
*Commands can of course be called from within BASIC by simply issuing them directly from within the BASIC program. e.g. *Help.
It is also possible to use the OSCLI command from within BASIC, as this provides a method of passing variables to the *Command itself. An example is shown below:
cmd$ = "Time" OSCLI "Help " + cmd$ ;Issues the *Help Command for Time
The final method available from BASIC is passing the *Command string to the SWI OS_CLI.
Like BASIC, it is possible to issue *commands from assembler. This is achieved by passing the *Command string to the SWI OS_CLI. A null byte terminating the command string is required.
More information required for this heading.
Because RISC OS is a flexible and modular Operating System it will come as no surprise to learn that *Commands can be altered, added and even replaced. The methods of achieving this are:
When a vector is claimed, it affects how a SWI that uses it works. The same applies for *Commands.
RISC OS modules are extensions of the Operating System that provide specific functionality. As well as providing a number of SWIs, modules also provides *Commands.
If a module is to be replaced, it must provide the same commands with the same syntax and accept the same parameters (if any).
In addition, there is no reason why a replacement module could not provide extra *Commands.
New modules can also be added to RISC OS to provide new functionality. There is no limit to how many *Commands can be added to the system.
Please see the Modules? section on how to write a module.
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 changes how the *Mode? command works.
*Set Alias$Mode echo |<22>|<%0>