RISC OS Open
A fast and easily customised operating system for ARM devices
ROOL
Home | News | Software | Bugs | Bounties | Forum | Documents | Photos | Contact us
Account

*Commands Introduction

Programmer's Reference Manuals
» Part 1 - Introduction
» *Commands
» *Commands Introduction

Overview

*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:

  • Simple to use
  • Easily typed
  • Simple to call within applications/programs
  • Provides powerful features

The disadvantages of *Commands are:

  • Not as flexible as 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.

A full list of *Commands, is available.

Issuing *Commands

*Commands can be used in the following ways:

  • From within Programming Languages, such as;
    • BASIC
    • C/C++
    • Assembler
  • Typed via the Command Line Interpreter
  • From within applications

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.

Using *Commands from within BASIC

*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.

Using *Commands from within assembler

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.

Using *Commands from within C

More information required for this heading.

Modular nature of *Commands

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:

  • Claiming vectors
  • Replacing modules
  • Adding new modules

Claiming vectors

When a vector is claimed, it affects how a SWI that uses it works. The same applies for *Commands.

Replacing modules

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.

Adding modules

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.

Changing and adding commands

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>

Revised on January 22, 2010 23:13:11 by Andrew Hodgkinson (6) (127.0.0.1)
Edit | Back in time (1 revision) | See changes | History | Views: Print | Source | Linked from: Introduction To *Commands

Search the Wiki

Commercial use

For commercial enquiries, please contact the owners of RISC OS, Castle Technology Ltd.

ROOL Store

The official C/C++ Development kit and more here.

Donate! Why?

Help ROOL make things happen – please consider donating!

Navigation

  • Home Page
  • All Pages
  • Recently Revised
  • Authors
  • Feeds
Site design © RISC OS Open Limited 2011 except where indicated
The RISC OS Open Instiki theme is based on Insitki's default layout

Valid XHTML 1.0  |  Valid CSS

Instiki 0.19.1(MML+)
This site runs on Rails

Hosted by Arachsys