A bike counter needs to add one. Would you rather write INC or sixteen bits?
A bike counter on a Bristol cycle path needs to add one when a cyclist passes. If you were writing that instruction, would you rather type a string of sixteen bits or a short name you could recognise at a glance?
You already know that a processor runs machine code. Its instruction set tells you which bit patterns it recognises as instructions. Here we'll use one specific chip, the AVR ATmega328P, as the controller in our example bike counter.
Watch the sixteen bits give way to INC R sixteen. INC is short for increment, which means add one. R sixteen tells the chip which register to change. A register is a small storage location inside the processor. That short instruction name, INC, is a mnemonic.
Look at INC R sixteen and the pattern of bits it stands for on this chip. Which part is the short name for the operation? Pick the mnemonic from the options.
Start with the assembly instruction INC R sixteen. Feed it into a program called an assembler. The assembler uses the target processor's instruction set to turn this one assembly instruction into one machine instruction. Those are the bits the chip can execute.
First, INC R sixteen becomes the bits for adding one. Next, DEC R sixteen uses the subtract-one pattern. The five slots marked d hold the register number. Sixteen is one zero zero zero zero in binary. Fill the slots to get the second machine instruction.
For DEC R seventeen, use the subtract-one pattern from the example. Seventeen is one zero zero zero one in binary. Which machine instruction do you get when you fill the five slots? Pick one.
Assembly is low-level. INC names the operation and R sixteen selects the register. The chip can't run those letters. It executes the binary machine instruction, which is also low-level. In a high-level language like Python, you can use a named variable without choosing a register, making code easier to write and maintain.
If an exam question asks you to identify the mnemonic in INC R sixteen, write INC. If it asks you to describe the purpose of an assembler, explain that it translates the assembly instruction into the binary machine instruction the bike counter’s processor can execute.