This article needs additional citations for verification .(January 2012) |
Developer | Acorn Computers |
---|---|
Written in | 8-bit 6502 machine code (v0, v1) 65C02 machine code (v2–v5) |
Working state | Discontinued |
Source model | Closed source |
Initial release | Late 1981 |
Final release | 5 / Early 1986 |
Marketing target | Personal computers |
Available in | English |
Update method | Replacement ROMs |
Platforms | BBC Micro, Acorn Electron, BBC Master series |
Kernel type | Monolithic |
Default user interface | Command-line interface (v3, v4, v5) |
Succeeded by | ARX (discontinued) Arthur, renamed RISC OS |
The Machine Operating System (MOS) [2] or OS is a discontinued computer operating system (OS) used in Acorn Computers' BBC computer range. It included support for four-channel sound, graphics, file system abstraction, and digital and analogue input/output (I/O) including a daisy-chained expansion bus. The system was single-tasking, monolithic and non-reentrant.
Versions 0.10 to 1.20 were used on the BBC Micro, version 1.00 on the Electron, version 2 was used on the B+, and versions 3 to 5 were used in the BBC Master series.
The final BBC computer, the BBC A3000, was 32-bit and ran RISC OS, which kept on portions of the Acorn MOS architecture and shared a number of characteristics (e.g. "star commands" CLI, "VDU" video control codes and screen modes) with the earlier 8-bit MOS.
Versions 0 to 2 of the MOS were 16 KiB in size, written in 6502 machine code, and held in read-only memory (ROM) on the motherboard. The upper quarter of the 16-bit address space (0xC000 to 0xFFFF) is reserved for its ROM code and I/O space.
Versions 3 to 5 were still restricted to a 16 KiB address space, but managed to hold more code and hence more complex routines, partly because of the alternative 65C102 central processing unit (CPU) with its denser instruction set plus the careful use of paging.
The original MOS versions, from 0 to 2, did not have a user interface per se: applications were expected to forward operating system command lines to the OS on its behalf, and the programming language BBC BASIC ROM, with 6502 assembler built in, supplied with the BBC Micro is the default application used for this purpose. The BBC Micro would halt with a Language?
error if no ROM is present that advertises to the OS an ability to provide a user interface (called language ROMs). MOS version 3 onwards did feature a simple command-line interface, normally only seen when the CMOS memory did not contain a setting for the default language ROM.
Application programs on ROM, and some cassette and disc-based software also, typically provide a command line, useful for working with file storage such as browsing the currently inserted disc. The OS provides the line entry facility and obeys the commands entered, but the application oversees running the command prompt.
Cassette and disc based software typically relies on BBC BASIC's own user interface in order to be loaded, although it is possible to configure a floppy disk to boot up without needing to have BASIC commands executed, this was rarely used in practice.
In BBC BASIC, OS commands may be preceded with an asterisk to instruct BASIC to forward that command directly to the OS. This led to the asterisk being the prompt symbol for any software providing an OS command line; MOS version 3 onwards officially uses the asterisk as the command prompt symbol. When referring to an OS command, they generally include the asterisk as part of the name, for example *RUN
, *CAT
, *SPOOL
etc., although only the part after the asterisk is the command. The asterisk was called a "star" and the commands were called "star commands". [3]
From BBC BASIC 2 onwards, commands can also be issued using the OSCLI
keyword in conjunction with a command string. [4] Alternatively, the OSCLI routine may be invoked directly using the CALL
keyword after initialising the relevant BASIC variables. [3]
Unrecognised commands are offered to any service (extension) ROMs; filing system ROMs will often check to see if a file on disc matches that name, the same most other command-line interfaces do. The operating system call OSWORD with accumulator = 0 does however offer programs single line input (with ctrl-U for clear line and the cursor copying keys enabled) with basic character filtering and line length limit.
The MOS command line interpreter features a rather unusual idea: abbreviation of commands. To save typing a dot could be used after the first few characters, such as *L.
for *LOAD
and *SA.
for *SAVE
. *RUN
was abbreviated to */
alone. *CAT
, the command to catalogue (list) a cassette or disc, can be abbreviated down to *.
.
3rd party ROMs generally also support command abbreviation, leading to ambiguity where two service ROMs provide commands which are very similar in name but possibly different in function. In this case, the MOS would prioritise the command from the ROM in the higher numbered ROM slot, e.g., 7 has precedence over 6.
Some 3rd party suppliers would get around this by prefixing their star commands with other letters. For example, Watford Electronics ROMS would have their star commands prefixed with W
thus making them unique.
The lower 16 KiB of the ROM map (0x8000 to 0xBFFF) is reserved for the active Sideways address space paged bank. The Sideways system on the BBC Micro allows for one ROM at a time from sockets on the motherboard (or expansion boards) to be switched into the main memory map. Software can be run from ROM this way (leaving the RAM free of user program code, for more workspace) and the OS can be extended by way of such ROMs. The most prevalent sideways ROM after BASIC is the Acorn Disc Filing System used to provide floppy disc support to the machine.
During a reset, every paged ROM is switched in and asked how much public and private workspace it needs. Each ROM is allocated a chunk of private workspace that remains allocated at all times, and a single block of public workspace, equal to the size of the largest request, is made available to the active ROM. During operation, the paged area is rapidly switched between ROMs when file system commands are issued and unrecognised commands are put to the OS.
MOS allocates a 3.5 KiB block of memory (0x0000 to 0x0DFF) from the bottom of the memory map for operating system and language ROM workspace:
Address | Use |
---|---|
0x0000-0x00FF | Current language workspace, misc system workspace |
0x0100-0x01FF | CPU stack |
0x0200-0x02FF | OS vectors, system variables, other workspace |
0x0300-0x03FF | VDU driver workspace, cassette system workspace, keyboard input buffer |
0x0400-0x07FF | Allocated to the current language ROM, or to the Tube. BASIC uses 0x0400-0x046B for the single-letter integer variables @% through Z% (4 bytes per letter), which are thus accessed faster than are variables on the heap. |
0x0800-0x08FF | Sound system (stores ADSR envelopes and the tone buffer; if sound is not in use then a small amount of user data can be stored here), printer buffer, ENVELOPE definitions |
0x0900-0x09FF | Cassette and serial input buffers (user data can be placed here if cassette is not in use, so many small machine code utilities were assembled into page 9) |
0x0A00-0x0AFF | Cassette and serial output buffers, also used for small machine code utilities. |
0x0B00-0x0BFF | User-defined keys (strings that are inserted when function keys are pressed, set by the *KEY command) |
0x0C00-0x0CFF | User-defined characters for non-teletext modes (user data can be placed here if the display is in teletext mode) |
0x0D00-0x0DFF | Non-maskable interrupt service routine, networking workspace, mouse/trackball workspace, indirect vectors to paged ROMs and page ROM workspace pointers |
On a cassette-only machine, 0x0E00 is the start of user program memory. With OS extension ROMs fitted such as the a filing system ROM, more memory is allocated above this point; DFS ROMs generally use another 2.75 KiB to cache the disc catalogue and manage random access buffers. A network filing system ROM (for Econet) allocates another 0.5 KiB on top of this. This is a serious problem because MOS does not support relocation of machine code, which must be run from the address at which it was assembled, so some programs which assumed a fixed start of user program memory could overwrite MOS workspace. The problem was alleviated in versions 3 to 5 by allowing ROMs to allocate workspace in an alternative RAM bank at 0xC000 to 0xDFFF which was present in Master series computers, though old ROMs could continue to allocate blocks of main memory.
The OS also maintains a vector table of all its calls which can be updated to hook any OS calls for user extension. By altering or 'hooking' these vectors, developers could substitute their own routines for those provided as defaults by the MOS.
The MOS permits textual output intended for the screen to be directed instead to the printer, or both at once, allowing for very trivial printing support for plain text. Graphics printing is not supported and has to be written separately.
Graphics and in general all screen output is handled in a very unusual way. The ASCII control characters are almost entirely given new significance under MOS: known as the "VDU drivers", because the documentation described them in relation to the VDU statement in BBC BASIC, they are interpreted as video control characters. VDU 30
(i.e. ASCII 30) moves the cursor to (0, 0), VDU 4 and 5 select whether text should be drawn at the graphics or text cursor, VDU 12 clears the screen and VDU 14 and 15 turn scroll lock on and off. Thus, pressing ctrl-L will clear the screen and ctrl-N will enable scroll lock. VDU 2 and 3 toggle whether screen output is echoed to the printer. The BBC BASIC VDU statement VDU x [, y[, z...]]
is equivalent to the conventional BASIC PRINTCHR$(x)[;CHR$(y)[;CHR$(z)...]]
and many of the control codes (such as 12 for "clear screen" and 7 for "beep") have the same functions as on other contemporary machines.
Many more control characters take parameters: one or more characters that follow are used solely for their bit value as a parameter and not as a control code. VDU 19 handles palette remap; the following five bytes represent the palette entry, the desired colour and three reserve bytes. VDU 31 locates the text cursor to the location held in the following two bytes. VDU 17 sets the text colour and 18 the graphics colour. VDU 25 uses the succeeding five bytes to move the graphics cursor and plot solid and dashed lines, dots and filled triangles, the documented extent of graphics in MOS 0 and 1. The first byte is the command code, followed by the x and y co-ordinates as two byte pairs. Other graphic functions – such as horizontal line fill bounded by a given colour – were available by use of undocumented or poorly documented command codes. [ citation needed ]
BBC BASIC contained aliases for the commonly used VDU codes (such as GCOL for VDU 18 or PLOT for VDU 25). Some statements were direct equivalents to VDU codes, such as CLS for VDU 12. Some statements were less exact equivalents as they incorporated functionality specific to BASIC as well as calling the OS routines; for example the statement MODE x would set screen mode x and adjust the BASIC system variable HIMEM according to the amount of memory the new mode left available for BASIC, while VDU 22, x would set the screen mode only, without altering HIMEM. This allowed a programmer to allocate a block of memory from BASIC – for example to load machine code routines into – by lowering the value of HIMEM at the start of a program, and still be free to switch screen modes without deallocating it as a side effect.
There is one operating system command to write a character, OSWRCH, which is responsible for all text and graphics. For example, to move the cursor to (10, 15), needed, in 6502 assembler:
LDA #31: JSR OSWRCH \ move text cursor LDA #10: JSR OSWRCH \ x-coordinate LDA #15: JSR OSWRCH \ y-coordinate
(LDA loads a value into the accumulator; JSR is "jump to subroutine".) On the third OS call, the cursor will move. The following code would draw a line from (0, 0) to (0, +100):
LDA #25: JSR OSWRCH \ begin "PLOT" (ASCII 25) command LDA #4: JSR OSWRCH \ command k=4, or move absolute LDA #0: JSR OSWRCH: JSR OSWRCH: JSR OSWRCH: JSR OSWRCH \ send (0, 0) as low, high byte pairs
LDA #25: JSR OSWRCH \ begin PLOT LDA #1: JSR OSWRCH \ k=1 - draw relative LDA #0: JSR OSWRCH: JSR OSWRCH \ x = 0 LDA #100: JSR OSWRCH \ y = 100 (low byte) LDA #0: JSR OSWRCH \ high byte
BBC BASIC allows performing the above as any of the following:
VDU25,4,0;0;25,4,100;0;PRINTCHR$(25);CHR$(4);CHR$(0);...etc.PLOT4,0,0:PLOT1,0,100MOVE0,0:DRAW0,100:REM absolute co-ords only!OSWRCH=&FFEE:A%=25:CALLOSWRCH:A%=4:CALLOSWRCH:A%=0:CALLOSWRCH...etc.
Graphics in the Acorn MOS use a virtual graphics resolution of 1280×1024, with pixel positions mapped to the nearest equivalent pixel in the current graphics mode. Switching video resolution will not affect the shape, size or position of graphics drawn even with completely different pixel metrics in the new mode, because this is all accounted for by the OS.
MOS does provide two other OS calls that handle text output: OSNEWL
and OSASCI
. OSNEWL writes a line feed and carriage return to the current output stream. OSASCI forwards all characters directly to OSWRCH except for carriage return, which triggers a call to OSNEWL instead. The precise code for OSASCI and OSNEWL – five lines of 6502 assembler – is documented in the BBC Micro User Guide.
MOS implements character recognition so that text printed on screen in the system font can be selected with the arrow keys and input with the COPY key as though it was being typed. To activate screen editing the user moves the hardware cursor to the text to be read and the OS displays a second cursor in software at the original position. Pressing COPY copies one character from the hardware cursor to the software cursor and advances both, so that holding the key down copies a section of the text, the cursors wrapping around the vertical edges of the screen as necessary. If the screen scrolls during editing, the hardware cursor's position is adjusted to follow the text. The user can make changes to the text during the copy, and user-defined characters are recognised in graphics modes. Screen editing is terminated when RETURN or ESCAPE are pressed, which have their usual effects. Character recognition is made available to users in the API with a call to read the character at the current cursor position. [ citation needed ]
Sound generation is carried out through another OS call, OSWORD, which handles a variety of tasks enumerated via a task code placed into the accumulator. All OSWORD calls bear a parameter block used to send and receive multiple data; the address of this block is passed in the X and Y registers, with the low byte in X and the high byte in Y. There are four buffered sound channels – three melodic and one noise-based on the sound chip found in the BBC Micro. There is only one waveform for melodic channels; the supported note parameters are pitch, duration, amplitude, envelope selection and various control options. For the amplitude parameter, a zero or negative sets a static amplitude, and a positive value select an amplitude and pitch envelope (a predefined temporal variation) to apply to the note.
Control parameters was passed through the channel parameter, and include flush (the buffer is cleared and the channel silenced before the note is played), synchronise count (as soon as the same sync count is received for that many channels, all the synchronised notes are played together), and control over the Speech system upgrade where fitted.
OSWORD handles many functions other than sound, many of which do not have direct support in BASIC. They may be accessed from BASIC by setting up the parameter block, loading its address into X% and Y% and the task code into A%, and then calling the routine.
The BBC Micro had support for a second processor connected via the Tube , which allowed direct access to the system bus. The driver code for the Tube interface is not held in the MOS, usually being supplied by an external service ROM.
The OS has calls to handle reading and writing to all I/O (ports and screen memory) and programmers are strongly advised to use these by the Acorn documentation. The reason for this is that when a second processor is installed, user software is run from the separate memory map on the far side of the Tube processor bus, and direct access to memory-mapped I/O registers and video memory is impossible. However, for the sake of performance, many apps including many games, write directly to main address space for I/O, and hence crash or give a blank screen if a 6502 second processor is attached. One such performance-critical area is sprite support: BBC Micro hardware does not support sprites, and games must implement sprites in software. In practice, the widespread use of direct access in place of the OS calls very rarely caused problems. Second processor units were expensive and very little software was written to make use of them, so few people bought them, and those who did have them could simply switch them off or unplug the cable if a problem arose.
The MOS contains two built-in file systems: cassette and ROM. These are quite similar (try *ROM
, *OPT 1 2
, *CAT
with a suitable ROM installed) and share a great deal of code. They feature a rudimentary copy protection mechanism where a file with a certain flag set cannot be loaded except to execute it. [7] (Before Amstrad's launch of a mass-market twin cassette recorder in 1987, [8] most home users did not have facilities to dub cassettes without loading the files into the computer for re-saving.) The Advanced Disc Filing System (ADFS), installed as standard in the Master series, has a similar mechanism. [9]
Versions for the BBC Micro family, starting at 0.10 and finishing at 1.20. Confusingly the Electron shipped with version 1.00 despite being released after the BBC Micro's version 1.20, because it was the first release of a ROM for the Electron. The MOS version number was not intended as an API definition: the Electron ROM was not "based on" the BBC Micro ROM version 1.0 in any sense.
This version is for the BBC Model B+, essentially the same as MOS 1.20 except with the addition of support for the sideways and shadow RAM present on the B+.
MOS 3 to MOS 5 shipped with the BBC Master Series systems, in the Master 128, Master ET, and Master Compact models respectively.
The initial release of MOS 3 expanded upon the facilities provided in MOS 2 on the B+ to support additional hardware, provide a command line facility and extend the VDU driver code with enhanced graphics plotting abilities. Two notable versions were made public: version 3.20 being the most common, and version 3.50 (although this had more functionality and bug fixes [10] it was not 100% compatible with some popular applications software [11] so was offered as an optional upgrade only).
MOS 4 was a stripped-down version of MOS 3 intended for the similarly minimised Master ET, and a few minor bugs fixed.
MOS 5 shipped with the Master Compact, and was much altered with some functions removed or highly amended.
With the exception of MOS 3.50 where the space was reclaimed for more code, the area normally hidden by the input/output memory locations (the 768 bytes from 0xFC00-0xFEFF inclusive) in the MOS ROM contained a list of names of contributors to the system. This could be recovered by extracting the ROM and reading its contents in an EPROM programmer. Those who did not have such a device could access the ROM on a Master by setting a test bit of an access control register, then using a machine-code program to copy the ROM directly to text-mode screen memory. [12]
The full text of the ASCII credits string in MOS 1.20 is as follows; no spaces occur after the commas to save memory:
(C) 1981 Acorn Computers Ltd.Thanks are due to the following contributors to the development of the BBC Computer (among others too numerous to mention):- David Allen,Bob Austin,Ram Banerjee,Paul Bond,Allen Boothroyd,Cambridge,Cleartone,John Coll,John Cox,Andy Cripps,Chris Curry,6502 designers,Jeremy Dion,Tim Dobson,Joe Dunn,Paul Farrell,Ferranti,Steve Furber,Jon Gibbons,Andrew Gordon,Lawrence Hardwick,Dylan Harris,Hermann Hauser,Hitachi,Andy Hopper,ICL,Martin Jackson,Brian Jones,Chris Jordan,David King,David Kitson,Paul Kriwaczek,Computer Laboratory,Peter Miller,Arthur Norman,Glyn Phillips,Mike Prees,John Radcliffe,Wilberforce Road,Peter Robinson,Richard Russell,Kim Spence-Jones,Graham Tebby,Jon Thackray,Chris Turner,Adrian Warner,Roger Wilson,Alan Wright.
In interviews in 1993 and 2001, Acorn cofounder Hermann Hauser recounted that Microsoft's Bill Gates had tried to sell MS-DOS to Acorn, but Hauser considered that adopting MS-DOS would have been a "retrograde step" compared to retaining Acorn's system. [13] [14]
The Acorn Electron was a lower-cost alternative to the BBC Micro educational/home computer, also developed by Acorn Computers, to provide many of the features of that more expensive machine at a price more competitive with that of the ZX Spectrum. It had 32 kilobytes of RAM, and its ROM included BBC BASIC II together with the operating system. Announced in 1982 for a possible release the same year, it was eventually introduced on 25 August 1983 priced at £199.
BBC BASIC is an interpreted version of the BASIC programming language. It was developed by Acorn Computers Ltd when they were selected by the BBC to supply the computer for their BBC Literacy Project in 1981.
Atari BASIC is an interpreter for the BASIC programming language that shipped with Atari 8-bit computers. Unlike most American BASICs of the home computer era, Atari BASIC is not a derivative of Microsoft BASIC and differs in significant ways. It includes keywords for Atari-specific features and lacks support for string arrays.
The Acorn Atom is a home computer made by Acorn Computers Ltd from 1980 to 1982, when it was replaced by the BBC Micro. The BBC Micro began life as an upgrade to the Atom, originally known as the Proton.
The Commodore Plus/4 is a home computer released by Commodore International in 1984. The "Plus/4" name refers to the four-application ROM-resident office suite ; it was billed as "the productivity computer with software built in".
Commodore BASIC, also known as PET BASIC or CBM-BASIC, is the dialect of the BASIC programming language used in Commodore International's 8-bit home computer line, stretching from the PET (1977) to the Commodore 128 (1985).
The Enterprise is a Zilog Z80-based home computer announced in 1983, but due to a series of delays, was not commercially available until 1985. It was developed by British company Intelligent Software and marketed by Enterprise Computers.
The Grundy NewBrain was a line of microcomputers launched in 1982 by Grundy Business Systems Ltd of Teddington and Cambridge, England. A contemporary of the ZX80 and BBC Micro, the NewBrain was mostly used in business settings. It is notable for its chicklet keyboard and models that featured a one-line display, allowing them to be used as a portable computer, in addition to television output. Another unique feature of the system was NewBrain BASIC, a BASIC programming language that featured an on-the-fly compiler.
The BBC Master is a home computer released by Acorn Computers in early 1986. It was designed and built for the British Broadcasting Corporation (BBC) and was the successor to the BBC Micro Model B. The Master 128 remained in production until 1993.
The Disc Filing System (DFS) is a computer file system developed by Acorn Computers, initially as an add-on to the Eurocard-based Acorn System 2.
The Acorn System was a series of modular microcomputer systems based on rack-mounted Eurocards developed by Acorn Computers from 1979 to 1982, aimed primarily at industrial and laboratory use, but also home enthusiasts.
Shadow RAM, on the Acorn BBC Micro, Master-series and Acorn Electron microcomputers is the name given to a special framebuffer implementation to free up main memory for use by program code and data. Some implementations of shadow RAM also permit double-buffered graphics.
The sideways address space on the Acorn BBC Microcomputer, Electron and Master-series microcomputer was Acorn's bank switching implementation, providing for permanent system expansion in the days before hard disk drives or even floppy disk drives were commonplace. Filing systems, application and utility software, and drivers were made available as sideways ROMs, and extra RAM could be fitted via the sideways address space.
In the BBC Microcomputer System, the Tube is the expansion interface and architecture which allows the BBC Micro to communicate with a second processor, or coprocessor.
The BBC Microcomputer System, or BBC Micro, is a series of microcomputers designed and built by Acorn Computers Limited in the 1980s for the Computer Literacy Project of the BBC. The machine was the focus of a number of educational BBC TV programmes on computer literacy, starting with The Computer Programme in 1982, followed by Making the Most of the Micro, Computers in Control in 1983, and finally Micro Live in 1985.
Acornsoft LISP is a dialect and commercial implementation of the Lisp programming language, released in the early 1980s for the 8-bit Acorn Atom, BBC Micro and Acorn Electron computers.
The ZX Spectrum character set is the variant of ASCII used in the ZX Spectrum family computers. It is based on ASCII-1967 but the characters ^, ` and DEL
are replaced with ↑, £ and ©. It also differs in its use of the C0 control codes other than the common BS
and CR
, and it makes use of the 128 high-bit characters beyond the ASCII range. The ZX Spectrum's main set of printable characters and system font are also used by the Jupiter Ace computer.
The Advanced Disc Filing System (ADFS) is a computing file system unique to the Acorn computer range and RISC OS-based successors. Initially based on the rare Acorn Winchester Filing System, it was renamed to the Advanced Disc Filing System when support for floppy discs was added and on later 32-bit systems a variant of a PC-style floppy controller.
RISC OS, the computer operating system developed by Acorn Computers for their ARM-based Acorn Archimedes range, was originally released in 1987 as Arthur 0.20, and soon followed by Arthur 0.30, and Arthur 1.20. The next version, Arthur 2, became RISC OS 2 and was completed and made available in April 1989. RISC OS 3 was released with the very earliest version of the A5000 in 1991 and contained a series of new features. By 1996 RISC OS had been shipped on over 500,000 systems.
Acorn System BASIC and Atom BASIC are two closely related dialects of the BASIC programming language developed by Acorn Computers for their early microcomputers like the Acorn System 3 and Acorn Atom. Developed in-house, they have a number of significant idiosyncrasies compared to most BASIC dialects of the home computer era.
fix bugs in the original MOS, such as the infamous CLOSE #0 bug in the DFS...ADFS has been speeded up by a factor of at least two...Format, Verify and Backup utilities are now included in the ROM...speed increases in programs that perform a lot of floating point...allows international characters to be entered from the keyboard...Acorn have decided not to include the alternative ROM as standard in new Masters. The reason, they say, is that while the new ROM is highly compatible, there will be some existing programs that don't work with it. In particular, the new 8-bit key handling may confuse some programs, and any program which directly accesses routines within the ROM will almost certainly fail. I feel that Acorn have made a wise decision, considering the amount of software already available for the Master, but I don't think that you should be put off by incompatibility - in practice most programs will work.
*FX225,2 highlights another problem area...because the action of this command has now been changed from that originally documented, such programs no longer work
setting bit 6 of the access control register ACCON (&FE34) will select this part of the ROM and the names may be read ... On page F.2-3 of the Master Reference Manual (Part 1), where each bit of ACCON is given a separate name, bit 6 is called TST