Operating System Interface

Introduction

As with the BBC micro computer, the star (*) commands provide access to the operating system.

For the most part, the MOS is transparent to BASIC; most of the operations via the MOS and VDP are accessed via normal BBC BASIC statements, with the following exceptions:

#accessing-the-mos-system-variablesAccessing the MOS system variables

MOS has a small system variables area which is in an area of RAM outside of its 64K segment. To access these, you will need to do an OSBYTE call

Example: Print the least significant byte of the internal clock counter

10 L%=&00 : REM The system variable to fetch
20 A%=&A0 : REM The OSBYTE number
30 PRINT USR(&FFF4)

For a full list of system variables, please refer to mos_api.inc.


Accessing Star Commands

The star commands may be accessed directly or via the OSCLI statement. The two examples below both access the BYE command.

*BYE

OSCLI("BYE")

Syntax

A star command must be the last (or only) command on a program line and its argument may not be a variable. If you need to use one of these commands with a variable as the argument, use the OSCLI statement. Examples of the use of the OSCLI statement are given below in the Resident Star Commands sub-section.

Case Conversion

Star commands and their associated qualifiers are converted from lower-case to upper-case if necessary. For example, \*era wombat is converted to \*ERA WOMBAT.

Special Characters

Control characters, lower-case characters, DEL and quotation marks may be incorporated in filenames by using the 'escape' character '|'.

|A

gives ^A.

|a

gives lower-case A.

|?

gives Del.

|"

gives the quote marks ".

||

gives the escape character |.

|!

sets bit 7 of the following character.

#running-star-commands-with-variablesRunning star commands with variables

The star command parser does not use the same evaluator as BBC BASIC, so whilst commands can be run in BASIC, variable names are treated as literals.

Example: This will not work

10 INPUT "Filename";f$
20 INPUT "Load Address";addr%
30 *LOAD f$ addr%

To do this correctly, you must call the star command indirectly using the OSCLI command

Example: This will work

30 OSCLI("LOAD " + f$ + " " + STR$(addr%))