Mnemonics in assembly language

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Mnemonics in assembly language

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. What is a mnemonic in assembly language?
A A long English sentence that describes a whole program
B A short, memorable code such as ADD that stands for one machine code instruction
2. Which of these is an assembly language mnemonic?
A 10110011
B STO
3. Why do programmers use mnemonics instead of writing binary?
A Mnemonics are easier for humans to remember and read
B Mnemonics run faster because the CPU understands them directly
4. In the instruction ADD 5, what is ADD?
A The mnemonic
B The operand
5. In the instruction LDA 20, what is 20?
A The operand
B The mnemonic

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1LDA 20 ALDA 7 (written for one processor type)
2STO 35 BMnemonics are machine dependent. They only work on processors that use the same instruction set.
3A mnemonic is easier for a programmer to remember than the binary instruction it stands for CA mnemonic with an operand: it stores the accumulator value into memory address 35
4Assembly language is machine dependent, so mnemonics only work on the type of processor they were written for DA mnemonic stands for exactly one machine code instruction, not a group of them.
5Each mnemonic such as ADD stands for a whole group of 10 machine code instructions EADD 12
6Mnemonics like LDA and STO will run on any computer because they are not binary FA mnemonic with an operand: it loads the value stored at address 20 into the accumulator

Definitions

mnemonic

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
___ 20 ADD 21 STO 22
2.
LDA 20 ___ 21 STO 22
3.
LDA 20 ADD 21 ___ 22
4.
LDA 20 ; load from address 20 ADD __ ; add value at address 21 STO 22 ; store in address 22
5.
LDA 20 ; LDA is a ________ for one instruction STO 22

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A LDA 20 ; load value
B ADD 21 ; add value
C STO 22 ; load result
D END
Question 2
A LDA 10
B ADD
C STO 12
D END
Question 3
A LDA 40
B ADD 41
C STO 42 43
D END
Question 4
A LDA 50
B 51 ADD
C STO 52
D END
Question 5
A LDA 70 ; get number
B SUB 70 ; double it
C STO 71

Answer Key

Mnemonics in assembly language
Section A: Quick Questions
Q1
B — A short, memorable code such as ADD that stands for one machine code instruction
Q2
B — STO
Q3
A — Mnemonics are easier for humans to remember and read
Q4
A — The mnemonic
Q5
A — The operand
Section B: Match the Pairs
Q1
LDA 20 → A mnemonic with an operand: it loads the value stored at address 20 into the accumulator
Q2
STO 35 → A mnemonic with an operand: it stores the accumulator value into memory address 35
Q3
A mnemonic is easier for a programmer to remember than the binary instruction it stands for → ADD 12
Q4
Assembly language is machine dependent, so mnemonics only work on the type of processor they were written for → LDA 7 (written for one processor type)
Q5
Each mnemonic such as ADD stands for a whole group of 10 machine code instructions → A mnemonic stands for exactly one machine code instruction, not a group of them.
Q6
Mnemonics like LDA and STO will run on any computer because they are not binary → Mnemonics are machine dependent. They only work on processors that use the same instruction set.
Section C: Definitions
Q1
mnemonic — A short, memorable code in assembly language, such as LDA, ADD or STO, that stands for one machine code instruction and is easier to remember than binary.
Section D: Fill in the Blanks
Q1
LDA 20 ADD 21 STO 22
Q2
LDA 20 ADD 21 STO 22
Q3
LDA 20 ADD 21 STO 22
Q4
LDA 20 ; load from address 20 ADD 21 ; add value at address 21 STO 22 ; store in address 22
Q5
LDA 20 ; LDA is a mnemonic for one instruction STO 22
Section E: Spot the Error
Q1
C — STO is the mnemonic for the store instruction. It copies the accumulator into memory, so the comment should say 'store result', not 'load result'.
Q2
B — A mnemonic like ADD needs an operand to say which address to use. The line should be ADD 11.
Q3
C — Each mnemonic stands for one machine code instruction and takes one operand here. STO 42 43 has two operands. It should be STO 42.
Q4
B — An assembly instruction is written mnemonic first, then the operand. It should be ADD 51, not 51 ADD.
Q5
B — To double a number you add it to itself using ADD. SUB 70 would take the number away from itself and give 0. It should be ADD 70.