Microprocessor midterm 4

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/41

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

42 Terms

1
New cards

🔹 Q1: What is Immediate Addressing?

🅰 The operand is part of the instruction.

Example: MOV AL, 12H

2
New cards

🔹 Q2: What is Register Addressing?

🅰 Operand is a register.

Example: MOV AL, BL

3
New cards

🔹 Q3: What is Direct Addressing?

🅰 Operand is a fixed memory address.

Example: MOV AL, [500H]

4
New cards

🔹 Q4: What is Register Indirect Addressing?

🅰 Operand is stored at a memory address held in a register.

Example: MOV CL, [BX]

5
New cards

🔹 Q5: What does LEA do?

🅰 Loads the effective address of a memory operand into a register.

Example: LEA AX, [BX+SI]

6
New cards

🔹 Q6: What are SI and DI used for?

🅰

  • SI (Source Index) → Points to source string in DS

  • DI (Destination Index) → Points to destination string in ES

7
New cards

🔹 Q7: What are the basic String Instructions?

🅰

  • MOVSB/MOVSW: Move bytes/words

  • CMPSB: Compare source & dest

  • LODSB: Load from source

  • STOSB: Store to destination

  • SCASB: Scan compare with AL

8
New cards

🔹 Q8: What does REP do?

🅰 Repeats the following string instruction CX times

Example: MOV CX, 5 REP MOVSB

9
New cards

🔹 Q9: What is the Direction Flag (DF)?

🅰 Controls whether SI/DI increment or decrement after string instructions.

  • CLD: Clear DF → auto increment

  • STD: Set DF → auto decrement

10
New cards

🔹 Q10: What happens in MUL with 16-bit source?

🅰

(DX:AX) = AX * source — Result is stored across DX and AX

11
New cards

🔹 Q11: How does DIV with 16-bit source work?

🅰

  • AX = (DX:AX) / source

  • DX = remainder

12
New cards

🔹 Q12: What’s the difference between CMP and SUB?

🅰

Both subtract, but CMP doesn’t store the result — only updates flags

13
New cards

🔹 Q13: What is a Short Jump?

🅰 Jump to address within ±127 bytes using relative offset.

Example: JMP +50

14
New cards

🔹 Q14: Difference between Near and Far Jump?

🅰

  • Near Jump → New IP only (same segment)

  • Far Jump → New CS + IP (new segment)

15
New cards

Q1:
What are the 64-bit, 32-bit, 16-bit, and 8-bit versions of the accumulator register?

A1:

  • 64-bit: RAX

  • 32-bit: EAX

  • 16-bit: AX

  • 8-bit: AH (high), AL (low)

16
New cards

Q2:
What do A, B, C, and D represent in register names like AX, BX, CX, DX?

A2:

  • A → Accumulator

  • B → Base

  • C → Counter

  • D → Data (or Destination)

17
New cards

Q3:
What is the structure of an Assembly instruction?

A3:
Label | Opcode | Operand(s) | Comment
DATA1 DB 23H ; Define a byte of 23H

MOV AL, BL ; Copy BL into AL

18
New cards

Q4:
In the Tiny model, what is the relationship between the DS and CS segments?

A4:
DS = CS → Code and data are in the same segment.

19
New cards

Q5:
What’s the purpose of .STARTUP, .EXIT, and .END?

A5:

  • .STARTUP → Start of the program

  • .EXIT → Exits to DOS

  • .END → Ends the program

20
New cards

Q6:
What are DB and DW used for in Assembly?

A6:

  • DB (Define Byte): Allocates 8-bit value

  • DW (Define Word): Allocates 16-bit value

21
New cards

Q7:
Define Immediate Addressing and give an example.

A7:
Operand is in the instruction itself.
Example: MOV AL, 12H

22
New cards

Q8:
Define Register Addressing and give an example.

A8:
Data is moved between registers.
Example: MOV AL, BL

23
New cards

Q9:
Define Direct Addressing and give an example.

A9:
Operand is a direct memory address.
Example: MOV AL, [500]

24
New cards

Q10:
Define Register Indirect Addressing and give an example.

A10:
The register holds the memory address.
Example: MOV CL, [BX]

25
New cards

Q11:
What is Base-plus-Index Addressing?

A11:
Address = BX + SI (or any base + index)
Example: MOV BP, [BX+SI]

26
New cards

Q12:
What is Scaled Index Addressing?

A12:
Address = Base + (Index × Scale)
Example: MOV AX, [EBX+2×ESI]

27
New cards

Q13:
What does PTR mean in assembly?

A13:
It stands for "pointer", used to define size like BYTE PTR, WORD PTR

28
New cards

Q14:
Which addressing mode is used in MOV CH, [DOG]?

A14:
Direct addressing using a memory label (symbolic name)

29
New cards

Q15:
In register models, which registers are program-visible?

A15:
General-purpose registers (e.g., AX, BX, CX, DX, SI, DI, BP, SP)
Used directly in instructions.

30
New cards

Q16:
In which model is CS = DS?

A16:
Tiny Model

31
New cards

Q17:
What’s the total memory space used in the Tiny model?

A17:
64 KB (shared between code and data)

32
New cards

Q18:
What’s the total memory space in the Small model?

A18:
128 KB (64 KB code + 64 KB data)

33
New cards

What does CR3 hold?

Page Directory Base Address

34
New cards

How many bits are in the linear address?

32 bits

35
New cards

What are the 3 parts of a linear address in IA-32 paging?

PDE (10 bits), PTE (10 bits), Offset (12 bits)

36
New cards

What is the page size in Intel paging?

4KB

37
New cards

How many entries are in a Page Directory or Page Table?

1024

38
New cards

What does CR0’s 31st bit do?

Enables paging (1 = on)

39
New cards

What does a PDE point to?

A Page Table

40
New cards

What does a PTE point to?

A 4KB memory page

41
New cards

What happens if paging is disabled?

Linear address = Physical address

42
New cards

What is the role of the Offset in paging?

Identifies the exact byte in the 4KB page