h6. [[Programmer's Reference Manuals]] h6(. » Introduction to *Commands *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: * Simple to use * Easily typed * May be call within applications/programs * Provides powerful features The disadvantages of *Commands are: * Not as flexible as [[Introduction To SWIs|SWIs]] * Limited scope to return information back to a program (output is normally directed straight to screen) There will be instances when it is more appropriate to use a SWI rather than a *Command, and vice-versa. h3(#issuing). Issuing *Commands *Commands can be used in the following ways: * From within Programming Languages, such as BASIC, C/C++, or Assembler * Typed via the Command Line Interpreter (CLI) * From within applications 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. h4. Calling from BASIC *Commands can be called from within BASIC by issuing them directly (e.g. <code>*Help</code>). Using the OSCLI *Command provides a method of passing variables: <pre> cmd$ = "Time" OSCLI "Help " + cmd$ :REM Issues the *Help Command for Time </pre> The final method available from BASIC is passing the *Command string to the SWI [[OS_CLI]]. <pre> SYS "OS_CLI", "*Help" </pre> h4. Calling from Assembler *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. h4. Calling from C [TO DO] Calling from C h3(#modular). Modular nature of *Commands Because RISC OS is a modular Operating System, *Commands can be altered, added and even replaced. This can be done by claiming [[Software Vectors|vectors]], replacing [[Modules|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. h3. Changing and adding *Commands By using [[System Variables|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 <code>*Mode</code> which changes to the screen mode to the number given after the command. <pre> *Set Alias$Mode echo |<22>|<%0> </pre> h4. See also [[*Commands|Index of *Commands]] [[Modules]] [[Software Vectors]] [[System Variables]]