P2 T2 L11 - Assembly Language Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Computers can only process instructions that are written in ________ ______.

A

machine code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

A machine code instruction has an ______ and an ______.

A

opcode (operation code)

operand

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Assembly language uses ___________ to represent operation codes and addresses.

A

mnemonics

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

All the instructions for a given CPU form its ___________ ___.

A

instruction set

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

The assembly code instructions are unique to a given __________ __________.

A

computer architecture

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

LDR Rd, < memory ref >

What does it mean?
1 point

A
  1. Load the value stored in < memory ref > into register d
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

STR Rd, < memory ref >

What does it mean?
1 point

A
  1. Store the value in register d into memory location specified by < memory ref >
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

ADD Rd, Rn, < operand >

What does it mean?
1 point

A
  1. Add the value specified in < operand > to the value in register n and store the result in register d
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

SUB Rd, Rn, < operand >

What does it mean?
1 point

A
  1. Subtract the value specified by < operand > from the value in register n and store the result in register d
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

MOV Rd, < operand >

What does it mean?
1 point

A
  1. Copy the value specified by < operand > into register d
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What could < operand > be?

2 things

A
  1. an actual value, specified by #

OR

  1. a value stored in another register specified by R
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

In the instruction SUB R3, R2, #5 what type of addressing does it use?
(1 point)

A
  1. uses immediate addressing, i.e. the instruction uses the actual value 5 as the operand
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

In the instruction LDR R1, 300 what type of addressing does it use?
(1 point)

A
  1. uses direct addressing, i.e. the instruction uses the memory address (300) holding the value as the operand
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

In assembly language, there are no IF statements. What do they use instead?
(2 things)

A
  1. Compare instruction

2. Branch instruction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

CMP Rn, < operand >

What does it mean?
1 point

A
  1. Compare the value stored in register n with the value specified by < operand >
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

B < label >

What does it mean?
1 point

A
  1. Always branch to the instruction at position < label> in the program
17
Q

B< condition >
< label >

What does it mean?
(2 points)

A
  1. Conditionally branch to if the last comparison met the conditions specified by :
2. < condition > can be:
EQ: equal to 0
NE: not equal to 0
GT: greater than
LT: less than

e.g. BEQ, BNE, BGT, BLT

18
Q

How are while loops done in assembly language?

2 points

A
  1. The equivalent of a WHILE loop can be written using Compare and Branch instructions
  2. A CMP is followed by a branch
    e. g

MOV R1, #0 ;initialise R1 to hold total
LOOP
INPUT R0 ;input a number
ADD R1, R1, R0 ;add number to R1
CMP R0, #0 ; compare number with 0
BNE LOOP ; branch if not zero
STT R1, 100 ; store total in location 100

19
Q

List the logical bitwise operations in assembly language

6 of them

A
  1. AND
  2. ORR also known as OR
  3. EOR also known as XOR
  4. MVN also known as NOT
  5. LSL
  6. LSR
20
Q

what does AND do

1 point

A
  1. returns 1 if both bits are 1 - result stored in Rd
    e. g.

Rd 1 0 1 0 1 0 1 0
Rn 1 1 1 1 0 0 1 1
AND Rd, Rn 1 0 1 0 0 0 1 0

21
Q

what does ORR do

1 point

A
  1. returns 1 if one or both bits are 1 - result stored in Rd
    e. g.

Rd 1 0 1 0 1 0 1 0
Rn 1 1 1 1 0 0 1 1
ORR Rd, Rn 1 1 1 1 1 0 1 1

22
Q

What does EOR do

1 point

A
  1. returns 1 if one (but not both) bit is 1 - result stored in Rd

Rd 1 0 1 0 1 0 1 0
Rn 1 1 1 1 0 0 1 1
EOR Rd, Rn 0 1 0 1 1 0 0 1

23
Q

What does MVN do?

1 point

A
  1. change 1 to 0 and 0 to 1

Rd 1 0 1 0 1 0 1 0
MVN Rd 0 1 0 1 0 1 0 1

24
Q

What does LSL do?

1 point

A
  1. Logical Shift Left - shifts all the bits left a specified number of spaces
    e. g.

Rn 1 0 1 0 1 0 1 0
LSL Rd, Rn, #2 1 0 1 0 1 0 0 0

Vacated spaces filled with 0

Nb Rn is the starting point in this example - look at instruction format

25
Q

What does LSR do?

1 point

A
  1. Logical shift right - shifts all the bits right a specified number of places

Rn 1 0 1 0 1 0 1 0
LSR Rd, Rn, #2 0 0 1 0 1 0 1 0

vacated spaces filled with 0
Nb Rn is the starting point in this example

26
Q

Define operator (1 point)

A
  1. an operator is a character or characters that determine the action that is to be performed or considered
27
Q

Define operand (1 point)

A
  1. the operand is the data or memory location used to execute a certain instruction
28
Q

Define opcode (1 point)

A
  1. The opcode is the instruction that is executed by the CPU
29
Q

Define direct addressing (1 point)

A
  1. A way of addressing memory, it means that the operand of an instruction refers directly to a location in memory
30
Q

Define immediate addressing (1 point)

A
  1. Immediate addressing means that the data to be used is hard-coded into the instruction itself.

For instance: ADD 7. Nothing needs to be fetched from memory.

31
Q

What is HLT

1 point

A
  1. HLT (halt) is an assembly language instruction which halts the central processing unit (CPU) until the next external interrupt is fired.