LS-3 ASM Flashcards

1
Q

Create a simple program that loads data into register one, perform a bit-wise not operation and store that in result.

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

Each non blank line in lc-3 is what?

A
  • An instruction (ld r1, data)
  • An assembler directive (.orig x3000)
  • A comment
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the typical form an instruction has in LC-3?

A

Label OpCode Operands ;Comments

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

What does an instruction consis of?

A

An opcode and one or more operands

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

What are opcodes?

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

What does Operands do? And what are typical operands?

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

Line by line, what does the following code do?

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

How would you load data into register 1?

A

ld R1, data

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

How do you store the contents of register 3 into result?

A

st R3, result

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

What can you think of labels as?

A

They are a symbolis name for a memory location (the line is usually denoted by a hex value)

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

How do Assembler Directives work?

What are the Assembler Directives/What do they do

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

In general what are traps?

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

What are the traps and what do they do?

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

In general how does the Assembly process work?

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

What happens during the first pass of the assembly process

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

What happens during the second pass of the assembly process

A

Each line scanned again

Everything translated into machine languge

Does using the symbol tables, fillng in labels like a macro.

Fill memory loctions as directed by assembly directives

17
Q

In general what is Linking and Loading?

A
18
Q

What are the output files the Assembler generates?

A
19
Q

How do you read in a character and how do you print that character to console?

A
20
Q

How do you print a string to console?

A
21
Q

In general, what is a condition code?

A

There is a process to determine based on the last arithmatic/logic expression if the result was zero, poisitive or negative.

22
Q

What are the instructions that affect the condition code?

A
23
Q

What is the condition code after each line of code?

A
24
Q

How does conditional branching work?

A
25
Q

Create a simple loop that loops 10 times

A
26
Q

What are the 7 forms of branching and when do they work?

A
27
Q

Provide the code for a simple if statement that checks if R1 is positive after an add instruction, If it is, it executes code starting from label if. Otherewise it branches to label skip

A
28
Q

Provide an example of an If-Else Statement

A
29
Q

Create a while loop that reads a chracter and prints it 10 times using a loop

A
30
Q

Create a while loop that iterates through the numbers from 1 to 100 and summ all the odd numbers and store result in register r2

A
31
Q

When branching what is the limitation for distance from PC counter?

A

Must be within -255 and 256 words of the BR instruction (because we only have 9 bits to hold the offset)

32
Q

What is the symtax for an unconditional branch?

A
33
Q

How do you overcome the limitation of distance from pc relative?

A

Using LEA, one can store in the register the address (pointer) of the next instruction.

Example:

br loop (loop label needs to be -255 to 256 of the br intruction

loop

LEA r4, EXIT

jmp (or br) r4

can jump anywhere in memory space