Class 3 Flashcards

1
Q

What are the general-purpose registers in the CPU as described in the transcript?

A

AX, BX, CX, and DX.

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

How is the AX register divided?

A

Into AH (high-order 8 bits) and AL (low-order 8 bits).

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

What do AH and AL combine to form?

A

The 16-bit AX register.

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

What is the primary use of the AX register?

A

For arithmetic operations like addition and subtraction as the destination register.

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

Which registers are formed when combining BH and BL?

A

The 16-bit BX register.

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

What is the BX register used for?

A

Data movement and has some addressing capabilities.

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

What is the special purpose of the CX register?

A

Counting iterations of loops and shift/rotate operations.

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

Which register is called the data register?

A

The DX register.

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

What operations utilize the DX register?

A

Multiplying and dividing operations.

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

What does the DX register hold during multiplication?

A

The high-order 16 bits of the product.

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

What does the ‘E’ in EAX, EBX, etc., stand for?

A

Extended 32-bit version of the register.

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

Name the high-order and low-order parts of the BX register.

A

BH (high-order) and BL (low-order).

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

How are the general-purpose registers used in the ALU?

A

They store operands and results of ALU operations.

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

What characterizes the AX register compared to others?

A

Some operations are faster when using AX.

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

Name the segment registers in the CPU.

A

Code Segment (CS), Data Segment (DS), Stack Segment (SS), Extra Segment (ES).

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

What is the function of the Code Segment (CS) register?

A

Holds the base location of all executable code.

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

What does the Data Segment (DS) register hold?

A

The default location for variables and data blocks.

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

What is the purpose of the Stack Segment (SS) register?

A

Holds the starting address of the stack segment.

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

What is the Extra Segment (ES) register used for?

A

To create a user-defined segment.

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

Where does the Code Segment (CS) register point in memory?

A

The starting address (bottom) of the code segment.

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

What segment does the Data Segment (DS) register point to?

A

The bottom (starting address) of the data segment.

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

Where does the Stack Segment (SS) register point to?

A

The top of the stack segment.

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

Why must the stack grow downward in memory?

A

To prevent overlapping with the data segment.

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

What does the Instruction Pointer (IP) register do?

A

Holds the address of the next instruction to be executed.

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

What is the Stack Pointer (SP)?

A

Points to the last value placed on the stack.

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

What is the Base Pointer (BP) used for?

A

Works with SP; it’s a user-accessible stack pointer.

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

Should you frequently change the Stack Pointer (SP) in programming?

A

No, incorrect changes can cause program crashes.

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

Which registers are involved in moving blocks of data?

A

Source Index (SI) and Destination Index (DI) registers.

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

What is the function of the Source Index (SI) register?

A

Holds the starting address of data to be moved.

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

What does the Destination Index (DI) register hold?

A

The starting address where data is to be moved to.

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

How do the SI and DI registers work together?

A

For string operations, moving data from source to destination.

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

What register always points to the most recent value on the stack?

A

The Stack Pointer (SP).

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

What is the role of the Instruction Pointer (IP) during program execution?

A

It increments to point to the next instruction after each execution.

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

What are the two types of flags in the Flags Register?

A

Control flags and status flags.

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

What do control flags do?

A

Control how the CPU executes instructions.

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

What are status flags used for?

A

Show the results of operations (e.g., positive/negative).

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

Name a status flag that indicates if a result is zero.

A

Zero Flag (ZF)

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

What does the Sign Flag (SF) indicate?

A

Whether the result is positive or negative.

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

What is the Auxiliary Carry Flag (AF) used for?

A

Indicates a carry from one nibble to another.

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

Explain what a nibble is.

A

Four bits; half of a byte.

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

What is the Parity Flag (PF) used for?

A

To check if the number of set bits is odd or even.

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

What does the Carry Flag (CF) indicate?

A

A carry out from the most significant bit.

43
Q

What is the Overflow Flag (OF)?

A

Indicates arithmetic overflow in signed operations.

44
Q

When is the Direction Flag (DF) used?

A

Controls string processing direction (increment/decrement).

45
Q

What happens when the Interrupt Flag (IF) is set?

A

The CPU responds to hardware interrupts.

46
Q

What is the purpose of the Trap Flag (TF)?

A

Enables single-step debugging by generating an interrupt after each instruction.

47
Q

What do the status flags CF, PF, AF, ZF, SF, TF, IF, DF, and OF represent?

A

Individual bits in the Flags Register indicating specific statuses and controls.

48
Q

How are flags affected by arithmetic operations?

A

They are set or cleared based on the operation’s result.

49
Q

What is the default state of the Direction Flag (DF)?

A

Cleared (0), processing data in increasing memory addresses.

50
Q

What does setting the Direction Flag (DF) to 1 do?

A

Processes data operations in a decreasing memory address order.

51
Q

What is the role of the Zero Flag (ZF) after a comparison?

A

Indicates if the compared values are equal (ZF set) or not (ZF clear).

52
Q

What does the Sign Flag (SF) reflect in results?

A

The most significant bit of the result, indicating positive or negative.

53
Q

Why is the Parity Flag (PF) important in data transmission?

A

It helps detect errors by maintaining parity consistency.

54
Q

What does the Overflow Flag (OF) indicate in signed arithmetic?

A

That the signed result is too large to fit in the destination operand.

55
Q

How does the Carry Flag (CF) differ in signed vs. unsigned operations?

A

In unsigned operations, CF indicates an overflow; in signed, it’s not used for overflow.

56
Q

What is indicated by the Auxiliary Carry Flag (AF)?

A

A carry out from bit 3 to bit 4 in binary operations.

57
Q

When is the Interrupt Flag (IF) typically enabled?

A

When the system is ready to handle hardware interrupts.

58
Q

What is the effect of the Trap Flag (TF) during execution?

A

Causes the CPU to operate in single-step mode for debugging.

59
Q

What is the stack, and what is its function in CPU operations?

A

The stack is a dedicated area of memory used for temporary storage during program execution. It stores temporary values, function parameters, return addresses, and local variables. The stack operates on a Last-In-First-Out (LIFO) principle, growing downward in memory. It is essential for managing function calls, handling interrupts, and controlling program flow.

60
Q

How does the stack grow in memory?

A

The stack grows downward towards lower memory addresses.

61
Q

What segment register points to the stack segment?

A

The Stack Segment (SS) register.

62
Q

Where does the Stack Segment (SS) register point in memory?

A

The starting address (top) of the stack segment.

63
Q

What register points to the last value pushed onto the stack?

A

The Stack Pointer (SP).

64
Q

Why is it important to prevent the stack and data segments from overlapping?

A

Overlapping can cause buffer overflows, program vulnerabilities, or crashes.

65
Q

What is a buffer overflow in the context of stack management?

A

When data overwrites the stack due to incorrect memory management, leading to potential crashes or security breaches.

66
Q

What happens if the Stack Pointer (SP) is set incorrectly?

A

The program or system can crash due to stack corruption and unpredictable behavior.

67
Q

What register works in conjunction with the Stack Pointer (SP)?

A

The Base Pointer (BP).

68
Q

Is the Base Pointer (BP) user-programmable?

A

Yes, BP is user-definable and works with the stack.

69
Q

Why should you avoid frequently modifying the Stack Pointer (SP)?

A

Incorrect changes can cause crashes and stack corruption.

70
Q

Which register is like a user-accessible Stack Pointer?

A

The Base Pointer (BP).

71
Q

What is the consequence of overlapping the stack and data segments?

A

It can lead to buffer overflow attacks and security vulnerabilities.

72
Q

How does the CPU use the stack during function calls?

A

Stores return addresses and local variables on the stack for proper function execution.

73
Q

What is the role of the Stack Pointer (SP) during interrupts?

A

Ensures the correct return address is available after handling an interrupt.

74
Q

What is meant by the stack growing “downward”?

A

As data is pushed onto the stack, the SP decreases, moving towards lower memory addresses.

75
Q

What is the role of the Stack Pointer (SP) during interrupts?

A

Ensures the correct return address is available after handling an interrupt.

76
Q

What is meant by the stack growing “downward”?

A

As data is pushed onto the stack, the SP decreases, moving towards lower memory addresses.

77
Q

How is the Stack Segment (SS) utilized in program execution?

A

Defines the area in memory designated for stack operations and management.

78
Q

What is the default starting point of the stack in memory?

A

The address pointed to by the Stack Segment (SS) register.

79
Q

Why is careful stack management crucial in assembly programming?

A

Mismanagement can cause crashes or make the system vulnerable to attacks.

80
Q

What operation can lead to the stack and data segments overlapping?

A

Sloppy programming or not properly managing memory allocation.

81
Q

Can manipulating the Base Pointer (BP) affect the stack?

A

Yes, it allows access to different parts of the stack safely without altering SP.

82
Q

What is the typical use of the Base Pointer (BP) in functions?

A

To access function parameters and local variables on the stack frame.

83
Q

How can a buffer overflow affect a program?

A

It can cause unexpected behavior or allow exploitation by attackers.

84
Q

What is the importance of maintaining the stack’s integrity?

A

To ensure program stability, proper execution, and system security.

85
Q

What does the stack hold besides temporary values?

A

Return addresses, function parameters, and local variables essential for program flow.

86
Q

What are the two main sections of the CPU as described?

A

The Execution Unit (EU) and the Bus Interface Unit (BIU).

87
Q

Does the control bus carry data?

A

No, it carries control signals (read/write operations).

88
Q

Is the data bus unidirectional or bidirectional?

A

Bidirectional; it can read into or write from the CPU.

89
Q

What is the purpose of the address bus?

A

To address devices or memory locations on the motherboard.

90
Q

What is little endian notation?

A

A method where data is stored with the least significant byte first.

91
Q

Why is understanding little endian important?

A

It affects how data is read from memory, preventing errors in data interpretation.

92
Q

What is a ‘word’ in the context of register sizes?

A

A group of 16 bits.

93
Q

How many bits are in a byte?

A

Eight bits.

94
Q

What is the size of a nibble?

A

Four bits.

95
Q

What is the purpose of the Bus Interface Unit?

A

Addresses hardware and programs, communicating with the outside world.

96
Q

What is the execution unit’s interaction with memory?

A

It uses internal registers; processing occurs within the EU, not directly with memory.

97
Q

How does the Bus Interface Unit (BIU) interact with memory?

A

Through the address, data, and control buses, managing communication with memory and devices.

98
Q

What is the role of the instruction queue in the BIU?

A

Stores pre-fetched instructions to increase execution efficiency.

99
Q

How do the segment registers and Instruction Pointer (IP) work together?

A

They help locate and execute instructions in memory by combining segment and offset addresses.

100
Q

How does the CPU benefit from the instruction queue?

A

It allows for read-ahead operations, minimizing delays in instruction fetching.

101
Q

What is the relationship between the EU and BIU?

A

EU executes instructions; BIU handles data transfer and address calculations.

102
Q

What are the three buses connected to the CPU?

A

Control bus, data bus, and address bus.

103
Q

What does the term VLSI stand for?

A

Very Large Scale Integration.

104
Q

Describe the typical memory map hierarchy as outlined in the transcript.

A

From top to bottom: ROM BIOS, hardware addresses, video memory, and user memory.