Learn

The generated Assembly from the last exercise follows much of the same semantics as the machine code we learned in the ISA lesson. This is because Assembly language and binary code have almost a direct translation between their outputs.

Assembly was created as a mnemonic language to make machine code easier to read and write, one instruction translating to one instruction. In fact, most ISAs will have both the binary code and Assembly language breakdown on the same page when talking about specific instructions.

Just like in binary, Assembly begins with an opcode. Luckily for us, the opcodes are much more readable than a bunch of 0’s and 1’s. Let’s take a look at the multiply function:

Assembly:

MULT $3, $2

Binary:

00000000111001100000000000011000

It’s easy to see how much easier it is to write a program in Assembly than to write it in binary. In most Assembly instructions, what follows the opcodes are the memory locations to be operated on. These memory locations are referred to as operands. Generally, these are direct register addresses but can also be memory references to values stored in other types of memory such as the cache or RAM.

In MIPS, direct register addresses begin with the $ symbol, so in our MULT example, we are multiplying the value stored in register $2 by the value in register $3. You can learn more about MULT and other MIPS functions in the official MIPS32 Documentation.

Instructions

1.

Create a new variable, answer_1, and set it equal to the term used for the first part of an Assembly instruction.

Your answer should be all lowercase.

2.

Create another variable, answer_2, and set it equal to the symbol used in MIPs to address registers.

3.

Create a final variable, answer_3, and set it equal to the part of the Assembly instruction that gets operated on.

Sign up to start coding

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?