6502Host Family and the BBC MOS

This article contains instructions on how to build the 65Host family of emulators for the RISC OS platform, including the previously unreleased 65Turbo emulator which is used to build the BBC MOS sources. Instructions are also included on how to use this emulator to build the BBC MOS.

This article builds version 1.20 of the BBC MOS, which was the final version shipped on the original BBC Micro.

This article builds version 1.00 of 65Host, which is between RISC OS 2's 0.97 and RISC OS 3's 1.20.

Source code to the following is included in the archives here:

  • 65Host, 65Tube, 65Turbo 1.00 for RISC OS
  • ARFS filing system for 65Host
  • BBC MOS 1.20
  • Acorn DNFS ROM (DFS and NFS)
  • Acorn Tube OS and ROM
  • MASM sources, the 6502 assembler used internally at Acorn that many of the above are written in


Contents



Requirements and Links

These sources were originally built on machines that would have been running versions of Arthur or pre-production versions of RISC OS 2. But they can be built on more modern versions of RISC OS.

You will need:



Building 65Host, 65Tube and 65Turbo

Preparation

Unzip and drop a copy of AASM into the Library directory in the root of the filesystem, this will add the assembler to the path.

Unzip the copy of the RO2 headers to the root of the filesystem, in the directory Hdr These files can have their type set to Text to read them, but it is not required for building.

Unzip the 6502Goodies bundle to the root of the filesystem in the directories BBCWini and Emu6502

Modifications for building

The sources as distributed are setup for builing on a specific machine, network and assembler inside of Acorn. The following changes allow us to build it locally.

  • Set the filetype of Emu6502.NewEmulate.MakeHost, Emu6502.NewEmulate.MakeTube and Emu6502.NewEmulate.MakeTurbo to obey
  • Inside the directory Emu6502.NewEmulate create empty directories called Image and rm.
  • Copy the file Emu6502.HostEmuOS.os1_20 to Emu6502.NewEmulate.os1_20
  • Copy the file Emu6502.TubeEmuOS.TubeOS to Emu6502.NewEmulate.TubeOS
  • Modify the file Emu6502.NewEmulate.Glue.Host change the line net#arf:$.SSwales.OS120_e to os1_20
  • Modify the file Emu6502.NewEmulate.Glue.Tube change the line net#arf:$.SSwales.TubeOS to TubeOS
  • Modify the file Emu6502.NewEmulate.Glue.Turbo change the line net#arf:$.SSwales.TubeOS to TubeOS
  • Some small source tweaks to make 65Tube and 65Turbo build
    • Modify Emu6502.NewEmulate.EmuBody Move line 302 that starts adcChannel to outside the conditional compilation section, e.g to line 310
    • Modify Emu6502.NewEmulate.EmuTube Modify line 26 change wheretoexecuteit to whereToExecuteIt, case sensitive.
    • Modify Emu6502.NewEmulate.EmuTube Modify line 221 change wheretoexecuteit to whereToExecuteIt, case sensitive.
    • Modify Emu6502.NewEmulate.EmuTube Modify line 222 change lastwheretoexecuteit to lastWhereToExecuteIt, case sensitive.
Building

Open a RISC OS task window

*dir Emu6502.NewEmulate
*MakeHost
*MakeTube
*MakeTurbo

If everything built correctly you should have three modules in Emu6502.NewEmulate.rm called 65Host, 65Tube and 65Turbo.

Double clicking these modules runs them and should look like this; NOTE 65Host does not have a working keyboard at this point, we will return to this later, nor can you quit it yet (ARFS below adds *quit), use alt-break to exit.

65host 65tube 65turbo


Building the BBC Micro MOS 1.2

Preamble

It may seem odd that to build the BBC OS the first thing was to compile up a set of 6502 emulators for another platform, but it does make sense. The OS was so large it could only be assembled on special, and mostly Acorn internal, second processors which was a 6502 with 256KB of RAM (rather than the 32KB of the standard 'B' or the 64KB of the regular 6502 second processor).

Referred to as the 'Turbo' second processor (unrelated to the BBC Master Turbo), finding a physical one would be very tricky. Luckily we built an emulator of one in the section above, 65turbo.

The source to the MOS here is written in MASM format, and needs the TurMASM assembler.

Preparation
  • Copy the file BBCWini.Library.TurMasm to Emu6502.HostEmuOS.TurMasm
  • Inside the directory Emu6502.HostEmuOS create the empty directory x
  • Modify the file Emu6502.HostEmuOS.MOSHdr change GBLL Tutu to GBLL $Tutu
  • Modify the file Emu6502.HostEmuOS.MakeMOS change the line 74 to 76
Building

Open a RISC OS task window

*rmload Emu6502.NewEmulate.rm.65Turbo
*EmulateTurbo

We are now inside the 6502Turbo emulator but with access to the RISC OS filesystem.

*dir Emu6502.HostEmuOS

At this point we have a choice: build the original OS 1.20 ROM or build the slight variation for use with 65Host. These are build options in the source code. We shall build both.

Original OS 1.20 ROM
*exec MakeMOS

This should generate the file MOS1_20 in the Emu6502.HostEmuOS directory. This is identical to the ROM shipped on the BBC Model B.

OS ROM for 65Host
*exec MakeHost

This should generate the file HostOS in the Emu6502.HostEmuOS directory. This version cleverly uses undefined 6502 instructions to talk the the host OS to allow the keyboard messages to be passed.



Combining Generated OS 1.20 with 65host to fix the keyboard

Preparation
  • Copy the file generated with MakeHost; Emu6502.HostEmuOS.HostOS to Emu6502.NewEmulate.HostOS
  • Modify the file Emu6502.NewEmulate.Glue.Host change the line os1_20 to HostOS
Building

Open a RISC OS task window

*dir Emu6502.NewEmulate
*MakeHost

This should generate an updated module 65Host in Emu6502.NewEmulate.rm

65host with keyboard


Building ARFS

ARFS is the filing system for !65Host that lets the user access the RISC OS filesystem as if it were a BBC filing system.

Preparation
  • Copy the file BBCWini.Library.TurMasm to Emu6502.arfs.TurMasm
  • Inside the directory Emu6502.arfs create the empty directory x
Building

Open a RISC OS task window

*rmload Emu6502.NewEmulate.rm.65Turbo
*EmulateTurbo
*dir Emu6502.arfs
*exec asmbbc

Note: During this building you will see many spurious characters output, the 'ofla' message if on RISC OS 3.7 for example, however the build does succeed.

This should generate the file arfs in the Emu6502.arfs directory.



Creating the Application !65Host

To create a more 'finished' product version of 65Host we will roughly follow the instructions of Emu6502.NewEmulate.!Release to combine our built files with a copy of !65Host off the Apps disc.

  • Copy !65Host from the RISC OS 2 App2 Disc Archive to the root of your filesystem
  • Copy Emu6502.NewEmulate.rm.65Host to !65Host.!RunImage
  • Copy Emu6502.arfs.arfs to !65Host.arfs
  • Set the type of !65Host.arfs to BBC ROM
!65Host CAVEATS:
  • The backspace key appears to not work correctly on the Risc PC. The delete key does work.
  • Unlike the release version 0.97, it boots to DFS not ARFS, use *ARFS to access the RISC OS filesystem,
  • Changing MODE causes the emulator to crash out, possible Risc PC issue.
65host with arfs