ARM Assembler Emulator

A while ago I wanted to learn ARM assembly and after some search for existing tools to execute and debug instructions, finally decided that the best way to learn an assembly would be to write an emulator for it.
C seemed a good choice, as being a middle-level language, it provides high-level constructs while still providing low-level details that are closer to assembly language.

If you need more information about ARM assembly Pete Cockerell’s ARM Assembly Language Programming has almost all the information one may need.

This application emulates the following behaviours of an ARM assembler.

  1. Pipeline: Size 4
  2. Reserves memory locations for; Interrupt instructions and user instructions.
  3. Counts the cycles for each instruction and total cycles.
  4. Data processing instructions: Sets the overflow and carry flags.
  5. Branch instructions: Uses a stack to store the link data if need.
  6. Data transfer instructions
  7. Interrupts instructions: Executes the interrupt instruction in the input instructions set or accepts hardware instruction before fetching a new instruction.
  8. Prints out the registers, user accessible memory, stack memory and the status flags. “debugEnabled” and “instructionLogEnabled” variables can be switched on for farther information in the output.

The source code is on GitHub. Feel free to use/edit it as you may.
The ‘ArmEmulator.c’ file in the ‘src’ folder includes all the required code. I used gcc to compile the C code, after installing it, you may just edit the folder path in the ‘Compile_ArmEmulator.bat’ and use it to compile the code.

One Response

Comments are closed.

Back to Top