Background
                    
                    
                    Tarmac is an incomplete dynamically recompiling emulator of an ARM microprocessor. It aims
                    to emulate ARM architecture version 2a (an ARM3 processor) by decomposing sequences of ARM instructions to many
                    sub-instructions known as armlets. These armlets are then more easily recompiled to x86 code with specialised
                    optimisations being applied throughout the conversion. The x86 code is then executed to emulate the ARM instructions.
                    By caching the generated x86 code and reusing it when the same sequence of ARM instructions is executed again, a
                    significant speed up of the emulation can be achieved. The project was always intended to be used in the emulation
                    of a full computer system meaning that real world problems such as synchronisation with subsystems, interrupts and
                    exceptions have all been taken into account.
                    
                 
            
                
            
                
                    Red Squirrel
                    
                    
                    Part of the project was to develop an interpreting ARM emulator which is accurate enough to emulate the RISC OS
                    Operating System. This was done in conjunction with Graeme Barnes' Red Squirrel, an
                    Acorn computer emulator for Windows which provides the Memory map, IO and video emulation needed to emulate complex
                    programs.
                    
   
                
                    
                    
                    
                    
                    
                    
                    
                    
                    Screenshots of Tarmac's interpreting ARM emulator and Red Squirrel running RISC OS
                    
                    
                 
                
                
            
                
                BeebEm
                
                    
                    Jon Welch borrowed the interpreting emulator and disassembler from Tarmac for use in
                    BeebEm emulating the Acorn ARM Second
                    processor board of a BBC Micro. Jon's made the original ARM Evaluation
                    disk images and manual available to download which is well worth getting if you intend playing with this.
                    
                    
                    Strictly speaking, Tarmac doesn't emulate the ARM1 processor
                    used in that board but the ARM3 emulation implemented is almost identical (only adding the MUL and SWP instructions). The second screenshot
                    that follows shows the ARM BASIC assembler failing to recognise the MUL instruction.
                    
                
                    
                    
                    
                    
                    
                    
                    
                    
                    Screenshots of Tarmac's interpreting ARM emulator and BeebEm running ARM BASIC on a BBC Micro
                    
                    
                    
                    
                    To use the ARM emulation on BeebEm:
                    
                    
    
                    Select menu item: Hardware / BBC Model / BBC Master 128
                    Select menu item: Hardware / ARM Second Processor
                    
                    Now you're ready to use the machine:
                    Type 'CON. TUBE' to use the ARM co-processor by default
                    Type 'CON. FILE 13' to make ADFS the default filing system (so you can read the disc image).
                    Type 'CON. MODE 0' to switch to a screen mode with smaller font.
                    Press Ctrl + F12 to reset the machine so configuration changes take effect (presses Ctrl+Break in the emulator).
                    
                    To make sure all your settings are saved for next time so you don't have to repeat the process:
                    Select menu item: Options / Save Preferences
                    
                    Select menu item: File / Load Disc 0
                    Then browse and select armdisc3.adl supplied.
                    
                    Now you're ready to run some software:
                    Type 'MOUNT 4' to mount disc.
                    Type '*.' to list files on disc.
                    Type 'AB' to start ARM BASIC
                    Type 'HELP .' to list all BASIC commands
                    
                    
                 
                
                
                
            
                
                    Current Status
                    
                    
                    The interpreting emulator and disassembler are both usable in their current state though may contain a couple of bugs.
                    
                    
                    
                    The actual dynamic recompiler was not completed in the time available for the project, though nearly all the
                    framework is in place. Code is generated for many ARM instructions and several optimisations are performed. A
                    comprehensive report of the background to the project with an explanation of the techniques used and examples
                    of recompilation, as well as full C++ source code is available. This software was developed for my final year
                    project as part of my degree in Computer Science at the University of Warwick.
                    
                 
                     
                    
                
                
            
                
                
                
                
          
                
               
                    Links
                    
                    
                    
Dynarmic
                	
                	
                	As of early 2019, this promising open source dynamic recompiler for ARMv8 to x86-64 on github is in use in Nintendo 3DS and Nintendo Switch emulators. The developers cite Tarmac's intermediate representation as inspiring their approach.
                	
                    
                    
RPCemu
                    
                    
                    In 2007 Sarah Walker added a dynamically recompiling StrongARM emulator to RPCemu which emulates
                    an Acorn RISC PC. In the same way as Red Squirrel, Sarah took a more direct approach, generating x86 or x64 machine code directly
                    and getting very good performance as a result. Full source code is available from the subversion repository.
                    
                    
                    
                    
Armphetamine
                    
                    
                    The year before Tarmac was developed, Julian Brown wrote a dynamically recompiling ARM emulator called
                    ARMphetamine. Although more complete than Tarmac since
                    it recompiles all ARM instructions to x86 code which does actually execute, at the time of writing it too
                    is buggy and incomplete in terms of support for the nastier side of emulating a real machine.
                    
                    
                    
                    
Red Squirrel
                    
                    
                    Following the collaboration on Tarmac, Graeme Barnes went on to develop his own JIT recompiler from ARM
                    to x86 code for Red Squirrel. It takes a simpler approach, not
                    performing many optimisations, but in doing so is far more successful and can run real world code for various
                    versions of ARM processor.