RISCOS.com

www.riscos.com Technical Support:
Programmer's Reference Manual

 

An introduction to RISC OS


Introduction

RISC OS is an operating system written by Acorn for its computers. Like any operating system, it is designed to provide the facilities that you, the programmer, need to control your computer and to get the most out of the programs you write for it.

Structure

RISC OS has a kernel which contains the main functions that the operating system needs. To this are added various modules that extend the system, adding such facilities as filing systems, a window manager, a font manager, and so on. These are called system extension modules:


The structure of RISC OS

The modules and the kernel provide their facilities very similarly, and there are few occasions when you will be able to distinguish whether the facilities you are using are provided by the kernel or by a system extension module. You are most likely to notice the difference if you wish to alter or replace part of the operating system.

Facilities

You can view RISC OS as a collection of routines that provide you with a wide range of facilities. You can get a good overview of the range that is covered from the earlier contents pages of this manual.

This collection of routines can be broadly divided into three levels:

  • those that RISC OS itself uses to automatically perform low-level tasks, such as interrupt handling
  • those that provide sophisticated and powerful interfaces for you to use from programs, which are known as Software Interrupts, or SWIs for short
  • those that provide simpler calls that can be used from the command line as well as from programs - these are the * Commands that you are probably already familiar with.

There are chapters later in this part of the manual that cover the above topics in more detail. They are entitled:

Altering and extending RISC OS

You can easily alter or extend RISC OS, because so much of it is written as modules.

Modules

Each of these modules conforms to a standard, which means that the facilities provided by the module are integrated into the system as if they were 'built-in'. You too can write modules that conform to this standard, so you can add things to RISC OS as you please.

You can also rewrite any of the standard RISC OS modules. Your replacement must provide the same entry points, and return values in the same way - but its internal workings can be functionally different. See the See Modules for further details.

Vectors

Because the kernel is so large, it would not be easy for you to change it in the same way. You can instead make changes by using vectors.

A vector is a chain of entries that RISC OS uses to decide where to pass control to so it can perform a given function. Most vectors are used by SWIs. You can claim a vector, and redirect those SWIs to code of your own. Your code must accept the same input and provide similar output to the original SWI, but it can behave in a totally different manner - just as if you are replacing a module.

Some vectors are used by just one SWI, but others are used by several SWIs that perform similar functions. You can change how a whole group of SWIs behave by claiming just one vector - for example, SWIs that output characters.

A few vectors are not used by SWIs at all, but instead by other parts of RISC OS, to perform functions for which SWIs do not provide an interface.

For more information, see the See Software vectors.

How RISC OS is written

Much of RISC OS - including the kernel - is written in ARM assembler. Some other parts - such as the Filer_Action system extension module - are written in C, and so need the Shared C Library to work.

Of course, RISC OS can only be used on ARM-based computers.

To use RISC OS effectively, it helps to have a working knowledge of the ARM processor and of ARM assembler yourself. The See ARM Hardware provides a brief introduction to the ARM processor and the set of chips that support it. The See Appendix A: ARM assembler will give you a more detailed introduction to the ARM's assembly language.

How RISC OS is supplied

Because RISC OS is relatively compact, it is cost-effective to supply it in ROM chips. This also has advantages:

  • it is much faster to start, as it does not need to be loaded into memory
  • it cannot be easily lost or damaged, unlike disc-based operating systems.

There is an attendant disadvantage:

  • it is harder to upgrade ROMs than a disc.

In practice, upgrades are done by patches that claim vectors or replace modules, as outlined above.

The history of RISC OS

This manual describes RISC OS 3, which was developed from RISC OS 2. This in turn derives from the Arthur operating system, which was the original operating system written for the Archimedes computer.

RISC OS is designed to be as compatible as possible with Arthur. Consequently, it supports some features of Arthur which have now been superseded. One example is the interrupt handling system, which has been much improved under RISC OS. However, old-style interrupt handlers written to run under Arthur will still work.

Two different versions of RISC OS 2 were released:

  • RISC OS 2.00 was the original release
  • RISC OS 2.01 was a later release which added support for the Archimedes 500 series machines; it was not fitted to other machines.

The differences between these two versions are so few, that unless we need to differentiate between them we shall refer to them both as 'RISC OS 2'.

There are currently three different versions of RISC OS 3:

  • Version 3.00 was the initial release, made for the A5000 computer.
  • Version 3.10 was a considerably improved release that added support for other Acorn computers, including both older RISC OS computers, and the new A4, A3010, A3020 and A4000 computers.
  • Version 3.11 has very minor differences from 3.10, but its programmer's interfaces are exactly the same, and you can treat it as identical.

Again, unless we need to differentiate between versions, we shall refer to them all as 'RISC OS 3'.

Arthur

There are very few remaining users of Arthur, and we consider it to be obsolete. You should not worry about making your programs compatible with Arthur.

In view of this, we do not distinguish features and facilities that are available under RISC OS but not under Arthur. However, you will find most of the facilities of Arthur described in this manual, because they have been subsumed into RISC OS. If you need full details of how Arthur did things, so you can maintain old programs, you'll have to refer to the Programmers Reference Manual that was released with Arthur. Don't throw your old manuals away - keep them!

Some minor parts of the Arthur operating system, which were in the Programmers Reference Manual released with Arthur, are not in this manual. This is because we now consider them to be obsolete, even though they're generally still supported. Instead, we've documented the preferred way of getting the same results under RISC OS. Likewise, some other parts of Arthur are only referred to in passing.

RISC OS 2 documentation

Because some users may prefer not to upgrade from RISC OS 2 to RISC OS 3, we advise you to write applications so that they will still run under both versions. This will maximise your potential market with very little extra effort. To help you in this, we say explicitly whenever a facility or feature is specific to a version of RISC OS.

We've derived this manual directly from the RISC OS Programmer's Reference Manual written for RISC OS 2. Any changes or additions you notice have been made for one of these reasons:

  • To cover a change or addition to RISC OS.

    In such cases this is explicitly stated, together with information on the versions of RISC OS to which the change or addition are applicable.

  • To improve the clarity and accuracy of the original RISC OS Programmer's Reference Manual, or to correct an error.

    Such improvements and corrections are not explicitly identified. You may assume that, where this manual differs from the previous edition, it is this later edition that is correct.

This edition Copyright © 3QD Developments Ltd 2015
Last Edit: Tue,03 Nov 2015