About the Assembler Activity.

The Aeembler Activity allows small programs to be entered with the assembly language based on the assembly language used by AQA n its Computer Science exams. It uses an input mechanism which restricts the entry so that only valid code can be entered as well as the option to enter code using text entry.

The code can then be run using the Session tab. This allows for memory data to be entered and then for the code to be run. There is also the option to run the code line by line that shows the registers and flags being updated at each point.

This activity can be used to give a better understanding of Assembly language and how it works.

The machine code tab simulates how a program is loaded into memory and run. The machine code instruction set is loosely based on the ARM instruction set, using where possible, similar opcode values. Each instruction is stored in three bytes. One for the opcode and two for the operands. (Three 4-bit values for the registers or two 4-bit values for the registers and one 8-bit value for the data).

Note that all values are restricted to a byte and all values and results are therefore taken as the modulo of 256.
Note that this is a testing release. Please contact me is you find any issues.

Code

Select an opcode

Or use text entry


No Description

Select a register number (0-12) for the Rd operand

Select a register number (0-12) for the Rn operand

Select a register or a value for operand 2

Select a location (0-127) for the memory reference

Create a label name

Select a label name

No Description


Program Name:

Note that this is a testing release. Please contact me is you find any issues.

Session - Processing the Assembler in Denary

Register Values

Flag Values

Line Counter:

General Memory

Set Memory Value

Memory Location:
Value:

Last Instruction


Assembly Code

Machine Code Session

Register Values


Current Instruction (Hexadecimal)


Flag Values

Program Counter:

General Memory (Values in denary)


Code Memory (Values in hexadecimal)


Assembly Language and Machine Code

Label Addresses

Example Programs



There are a number of example programs which can be loaded in to illustrate how Assembly-Code can be written and run using this application.

Add

Adds the values in memory locations 0 and 1 together.

Stores the result in memory location 2.

Count to 10

Counts through the numbers from 1 to 10, using register 0 to store the values.

multiply

Multiplies the values in memory locations 0 and 1 together.

Stores the result in memory location 2.

Power of 2

Calculates 2 to the power of the value stored in memory location 0 using the LSL command.

Stores the result in memory location 1.

Divide by 16

Divides the value in memory locations 0 by 16.

Stores the result in memory location 1.

Div and Mod

Does an integer division on the value in memory location 0 by the value in memory location 1.

Stores the integer result of the divide in memory location 2.
Stores the remainder in memory location 3.

Is Even

Does a bitwise logical AND with 1 to find whether the value in memory location 0 is odd or even..

Stores the result in register 0 (1 for odd and 0 for even).

A and B or C

Does a bitwise logical AND between the values in memory locations 0 and 1 and then does a bitwise logical OR between the result and the value in memory location 2.

Stores the result in memory location 3.

NAND

Does a bitwise logical AND between the values in memory locations 0 and 1.

Stores the result in memory location 2.

Triangular Numbers

Calculates the triangular number of the value in memory location 0.

Stores the result in memory location 1.