Chapter 4 (Section 2) #4 Flashcards

(62 cards)

1
Q

Section 1: Fundamental Concepts & Language Types

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

Why is machine code considered the only language a CPU can “use”?

A

Because it is the only language the hardware is designed to interpret directly as binary, because the hardware is made out of transistors and logic gates that can only process 0s and 1s. Any language that is not machine code needs to be translated before the CPU can understand it.

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

Is machine code machine dependent?

A

Yes, every different type of computer has its own set of machine code instructions.

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

What is an instruction?

A

A single operation preformed by the CPU.

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

How does the “length” of an assembly program compare to a high-level language program?

A

A program in assembly language requires many more instructions than a high-level language to perform the same task.

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

What are opcodes and operands?

A

Opcodes: Short for operation code. The part of the machine code instruction that identifies what action the CPU will do.
Operand: The part of a machine code instruction that identifies the data to be used by the CPU.

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

Define “Mnemonic” in the context of Assembly.

A

A short, abbreviated name (like LDD or STO) used in assembly language to represent a specific machine code opcode.

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

What is source code?

A

A computer program before translation into machine code.

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

Section 2: The Two-Pass Assembler (Pass 1)

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

What is an assembler? What are the different types of assemblers?

A

A computer program that translates programming code written in assembly language into machine code.
Assemblers can be one-pass or two-pass

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

What do single pass assemblers do (one-pass)?

A

It puts the machine code instructions straight into the computer memory to be executed.

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

What is the first thing an assembler does in Pass 1 regarding code formatting (in a two-pass assembler)?

A

It checks the syntax and removes all comments.

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

In Pass 1, what happens when the assembler encounters a symbolic address for the first time (in a two-pass assembler)?

A

It checks the symbol table; if it’s not there, it adds it to the “symbolic address” column with a corresponding “unknown” address in the address column.

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

What is a “Literal Table”?

A

A table created during Pass 1 (in a two-pass assembler) if the programmer has used constants in the program.

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

What are macros?

A

They are a group of instructions given a name (subroutine), can be executed multiple times within a program.
They are written once and called whenever needed.

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

Explain “Macro Expansion” during Pass 1.

A

The assembler replaces the macro call with the actual group of instructions defined in the macro.

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

What are directives?

A

commands that provide instructions to the assembler, but do not result in actual machine code instructions (information for assembler).

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

What happens to “Directives” during the first pass?

A

They are acted upon (e.g., memory is reserved or origin points are set), but they do not generate machine code.

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

Section 3: The Two-Pass Assembler (Pass 2)

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

What is the primary output of Pass 2?

A

The object code (the actual machine code instructions consisting of opcode and operand).

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

What happens in Pass 2?

A
  1. The computer reads the assembly language program one line at a time.
  2. Generate the object code, including the opcode and operand, from the symbol table generated in Pass 1.
  3. Forward references are resolved. This is required as some labels may be refered to before their address is known.
  4. Symbolic adresses are replaced by absolute references.
  5. Save or execute the program.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What is the specific role of a “Loader”?

A

It is a program required to load an object program (produced by a two-pass assembler) into memory so it can be executed.

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

Section 4: Detailed Addressing Modes

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

What is the “formula” for Indexed Addressing?

A

Effective Address = Operand Address + Contents of Index Register (IX).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
How does Relative Addressing calculate the target address?
Effective Address = Current Memory Address + Operand value.
26
In Indirect Addressing, if Address 200 contains 50, and Address 50 contains 10, what does "LDI 200" load?
It loads 10 (the contents of the address found at address 200).
27
Which addressing mode is only used in assembly and uses labels?
Symbolic Addressing.
28
Section 5: Data Movement Instructions
29
What instruction loads a literal number directly into the accumulator?
LDM #n (Immediate addressing).
30
How do you load the contents of the Index Register into the Accumulator?
LDR ACC.
31
What does the "LDX" opcode do?
It performs an indexed load: loading the contents of an address (Operand + IX) into the ACC.
32
What instruction returns control to the operating system?
END.
33
Section 6: Arithmetic & Logical Instructions
34
Does "ADD #20" add the value at address 20 or the number 20?
The number 20 (because of the # symbol indicating immediate data).
35
Which registers can the "INC" (Increment) instruction be used on?
The Accumulator (ACC) or the Index Register (IX).
36
Which registers can the "DEC" (Decrement) instruction be used on?
The Accumulator (ACC) or the Index Register (IX).
37
How do you subtract a value at a specific memory location from the ACC?
SUB
.
38
Section 7: Comparison & Control Flow
39
What is the prerequisite for using JPE or JPN?
A CMP (Compare) instruction must have been executed immediately before.
40
What does "JPN" stand for/do?
Jump if Not equal (jumps if the previous comparison was False).
41
What does "JPE" stand for/do?
Jump if Equal (jumps if the previous comparison was True).
42
What is modified when a "Jump" occurs?
The Program Counter's (PC) contents are changed to the specified address, so the next instruction to be executed is the one at that address.
43
How does "CMI" (Compare Indirect) determine what to compare?
It looks at the address in the operand, finds the address stored there, and compares the contents of that second address with the ACC.
44
Section 8: Input/Output and Notations
45
What data type does the "IN" instruction handle?
A single character (storing its ASCII value).
46
Where must a value be located before it can be "OUT" to the screen?
In the Accumulator (ACC).
47
What does the prefix "&" signify in an operand?
A hexadecimal number (e.g., &7B).
48
What does the prefix "B" signify in an operand?
A binary number (e.g., B01000011).
49
Section 9: Programming & Tracing Logic
50
What is the purpose of the "loop:" label in code?
It provides a symbolic target for JMP, JPN, or JPE instructions to return to.
51
What does the "CIR" column in a trace table represent?
The Current Instruction Register (the address of the instruction being executed).
52
Why is a "Symbol Table" essential for the Assembler?
It maps human-readable labels to actual memory addresses so the CPU can find data and jump targets.
53
Section 10: Adressing modes
54
What is Absolute Addressing?
The contents of the memory loaction specified by the operand are used. Ex. LDD 200 would load the value at address 200 into the ACC,
55
What is Direct Addressing?
The contents of the memory loaction specified by the operand are used. Identical to Absolute Addressing.
56
What is Indirect Addressing?
The contents of the memory location that is stored at the address given by the operand are used as the new address to get the data. Ex. If memory location 200 contains the value 20, and memory location 20 contains the value 5, LDI 200 would load 5 into the ACC.
57
What is Indexed Addressing?
The contents of the memory location, that is found by adding the operand (address of the memory location) to the value of the index register (IR), are used. Ex. If the IR contains 4, and memory location 204 contains 17, LDX 200 would load 17 into the ACC (200 + 4, is the new address).
58
What is Immediate Addressing?
The value of the operand is used directly. Ex. LDM #200 loads 200 into the ACC.
59
What is Relative Addressing?
The memory address used is the current memory address added to the operand. Ex. JMR #5 would transfer control to the instruction 5 locations after the current instruction.
60
What is Symbolic Addressing?
Only used in assembly language, where a label is used instead of a memory address. Ex. If memory location MyStore contains 20, LDD MyStore would load 20 in the ACC.
61
What are the purpose of labels?
Make programs easier to alter, as references to absolute addresses don’t need to be manually edited when changes are made.
62
Explain how the instruction ADD 20 can be interperted as either direct or indirect addressing.
Direct addressing: 20 is the address of the data to be used. Indirect addressing: 20 contains the address that contains the data to be used.