Stacks Flashcards

1
Q

How can stacks be imaged

A
As a stack of paper
You can on,y out new things on the top
You cannot put new things in the middle
You can only take things off the top
You can see the top without taking off the top
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does it mean to push an item on a stack

A

To place an item on the top of the stack

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

What does it mean to push an item off the stack

A

To remove an item from the top of the stack

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

What does SP stand for

A

Stack pointer

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

In what register is the system stack SP

A

R13

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

What are the four types of stack growth conventions

A

Full ascending
Full descending
Empty ascending
Empty descending

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

In a full ascending stack:

  1. Where does the SP point
  2. What direction does it grow in memory
A
  1. SP points at last item pushed onto the stack

2. Grows from low to high address in memory

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

In a full descending stack:

  1. Where does the SP point
  2. What direction does it grow in memory
A
  1. SP points to last item pushed onto stack

2. Grows from high to low address in memory

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

In a empty ascending stack:

  1. Where does the SP point
  2. What direction does it grow in memory
A
  1. Sp posts to the next free space in the stack

2. Grows from low to high addresses in memory

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

In a empty descending stack:

  1. Where does the SP point
  2. What direction does it grow in memory
A
  1. Sp points to next free space on the stack

2. Grows from low to high addresses in memory

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

What is it called when we reach stack size limit

A

Stack overflow

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

Does popping off get done on its own

A

No it’s the programmers responsibility

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

What does LDM do

A

Load multiple

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

What does STM so

A

Store multiple

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

Eg store contents of registers r1, r2, r3 to memory at the address in r12

A

STMDB R12, {r1-r3}

DB = decrement before

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

Load r1, r2, r3 with contents of memory at the address in r12

A

LDMIA R12, {R1 - R3}

17
Q

What do the two letters after LDRM and STRM mean

A

Mode of operation
Ie IA = increment after
DB = decrement before

18
Q

Does LDM/STM support byte sized memory transfers

A

No only word sized

19
Q

Is the order that the registers are specified in the Curley brcakets important

A

No

20
Q

In what order will registers be pushed onto stack

A

The lowest register is always put at the lowest address and the highest register t the highest

21
Q

Why would you use ! With the sp

A

To make sure that it gets updated each time

22
Q

Eg push r3, updating sp

A

STMDB SP! {R3}

23
Q

Pop r3 and update SP

A

LDMIA SP! {r3}

24
Q

What mode of order is assumed if not specified otherwise

A

Full descending

25
Q

Instead of specifying increment after and decrement before, what could you use

A

FD for full descending eg
STMFD
LDMFD