0% found this document useful (0 votes)
1 views

MP ORAL

The document is a comprehensive question bank on microprocessors, covering definitions, features, syntax, and differences between various components and instructions. It includes topics such as the 30386 microprocessor, variable declarations, syscall syntax, assembler directives, and comparisons between microcontrollers and microprocessors. Additionally, it explains various assembly instructions, data types, and conversion methods relevant to microprocessor programming.

Uploaded by

jayesh bachhav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
1 views

MP ORAL

The document is a comprehensive question bank on microprocessors, covering definitions, features, syntax, and differences between various components and instructions. It includes topics such as the 30386 microprocessor, variable declarations, syscall syntax, assembler directives, and comparisons between microcontrollers and microprocessors. Additionally, it explains various assembly instructions, data types, and conversion methods relevant to microprocessor programming.

Uploaded by

jayesh bachhav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 11
Microprocessor Oral Question Bank with Answers |. What is microprocessor? A microprocessor is @ small chip that works as the brain of a computer. It performs arithmetic and logic operations. 2. Features of 30386 Microprocessor: + 32-bit processor + Supports multitasking + Virtual memory support + Paging and protection * Can run in Reel, Protected, and Virtual mode 3, How to declare variable in data and .bss: + data is for initialized data — msg db ‘Hello’, 0 + .bss is for uninitialized data — buffer resh 10 4, Difference between macro and procedure: + Macro: Code is\replaced WiVing-assembly, faster, no call/ret used. + Procedures Code/#8\stofed separately, uses call and ret, saves memory. S. Syntax of macro & procedure definition and call: Macro: macro macroname 0 } statements Bendmacro macroname ; call Procedure: proc_name: } Statements ret Call with: call proc-name 5. Read & Write syscall syntax: Read (From keyboard): mov eax, 3 ; syscall number For read mov ebx, 0 ; stdin mov ecx, buffer ; where to store mov edx, 10 ; how many bytes int 0x80 larite (to screen): mov eax, 4 ; syscall number for wifite mov ebx, |; stdout ‘mov ecx, msg ; what to write mov edx, S ; number of bytes int Ox30 7. Date types example: + db (Define Byte): num db 10 + dw Define Word): nur dw 1000 + dd (Define Double Word): val dd 1234S67%h 8. Assembler directives definition & example: Assembler directives help organize code and data. Examples: + section data —» defines data section + section text — defines code section + global —start —» marks entry point 9. Conditional & Uneonditional jump instructions: + Unconditional Jump: Jumps always — jmp label + Conditional Jump: Based on flag — Je joe, jg J} Exarnple: je label —» jump if equal 10, Command to execute assembly program: nasm -f elf64 program.asm # Assemble Id -0 program program.o # Link Aprogram # Run II. Processor modes difference — Reali Protetted, Virtual (8086): + Real Mode: 20-bit addressing, n0"Protection, max IMB memory. + Protected Mode: 32-bit/64-bit, memory protection, multitasking. + Virtual Mode: Simulates real mad®*tinder protected mode Cused in DOS-based apps). 12. Difference between Mierotontroller & Microprocessor: Microcontroller Microprocessor CPU + RAM +.ROM + 1/0 on chip Only CPU om chip Used for specific tasks Used in general computing Example: 8051 Example: intel 2036 13, Difference between NASM, TASM, MASM: NASM TASM MASM Netwide Assembler Turbo Assembler Microsoft Assembler Open-source DOS/Windows Microsoft product Uses section Uses segment Uses segment 14, What is Assembler, Linker, Loader: + Assembler: Converts assembly code to machine code. + Linker: Combines object files into one executable. + Loader: Loads executable into memory to run. IS, Segment Translation, Page Translation: + Segment Translation: Converts logical to linear address using segments. + Page Translation: Converts linear to physical address using page tables. 18. Working of LOOP, IN2, C72, REP, MOVSB Instructions + LOOP: Repeats code until CX = 0 + IN2: Jump if not zero + €72: (Typo, likely meant 12) Jump if zero + REP: Repeat string instruction + MOVSB: Move byte from source to destination (SI —» Di) 17. What is ASCII of Newline Character, Carriage Return: + Newline (LF): ASCII code = 10 CORA) + Carriage Return (CR); ASCII code 2 13 COx0D) 18, ExplainxMUL:Bl, MUL BX, DIV BL, DIV BX: + MUL BL: Multiplies AL x BL — Result in AX «MUL BX: AX x BX — Result in DK:AX + DIV BL: AX + BL — Quotient in AL, Remainder in AH + DIV BX: DAK + BX —+ Quotient in AX, Remainder in DX 19. Size & Use of GDTR, IDTR, LDTR, MSW, TR, EAX, RAX, AX, AH, AL: Register Size Use GDTR, IDTR, LDTR, TR 16/32/64-bit Store table addresses for segment & interrupts EAX (32-bit), RAX (64-bit) Accumulator Register AX (16-bit) Lower part of EAX AH (8-bit) High byte of AX AL (8-bit) Low byte of AX 20. Difference between Overlapped & Non-Overlapped Blocks: + Overlapped: Memory blocks share some part. * Non-Overlapped: Memory blocks are completely separate. 2h. Use of $ sign and equ directive: + $: Represents current addvess (used in loops or label calculatiaiss).. ~—» Example: jmp $ (infinite loop) + egu: Constant definition —+ Example: size equ 10 22, What is data and .bss sections? + data: Stores initialized global/staticWariables. + .bss: Stores uninitialized global/stite, variables (gets 2ero by default). 23. How are variables declared in déto & bss Csyntox)? section data varl db 10 pjnitiglized variable section bss var2 resb I; reserve | byte for uninitialized variable 24, Explain Read & Write syscall with syntax: + Write syscall (stdout): ‘mov eox, 4 ; syscall number for write mov ebx, | ; file descriptor (1 = stdout) mov eex, msg ; message to write mov eds, len ; message length int 0x30 « Read syscall (stdin): mov eax, 3 ; syscall number for read mov ebx, 0 ; file descriptor (0 = stdin) mov eck, buffer ; buffer to store input mov edx, len ; number of bytes to read int 0x80 25. Conditional jump & Unconditional jump instructions + Conditional jump: Depends on fags (2F, SF, etc.) — JE, INE, 12, IN2, 1G, TL, ete, + Unconditional jump: Always jumps — IMP label 26. How to caleulate length of message ($ - msg method)? ‘mov ede, msg_len msg db "Hello’, 0 msg-len equ $= msg ; length = current address - msg start address 27. What is the meaning of .equ, db, 10,13 in variables? + equ: Defines constant = len equ 5 + db: Define byte — msg db 10,13,"Hello” + 10,13: ASCIF values 10 = Line Feed (LF) » 13 = Carriage Return (CR) — Moves cursor to new line 28. Advantages of macro & procedure: + Macro: Fast, no call overhead + Procedure: Saves memory, reusable code 29. Disadvantages of macro & procedure: + Macro: Increases code size (repeated inline) + Procedure: Slower due to call/return overhead 30. What is macro expansion? + Replacing macro calls with the actual code during cartpilatiom 3), How to declare array with initialized element valties? Array} de Nh, 20h, 7Ah, 9Ch, 21h 32. How to display two-digit numberiCe.gy. 3AH)? Answer: To display a two-digit hexadecimal Wimber like 3AH, we convert each nibble (4-bit part) into its corresponding ASCII character. > Steps: |, Rotate the number. to’bring the high nibble to the lower nibble position. 2. Mask upper nibble using AND to isolate it, 3. If nibble < 9 — Add 30H to convert to ASCH digit CO-'4') 4, If nibble > 4 — Add 37H to convert to ASCII letter CAF) S. Repeat far the second nibble. » Assembly Code: mov CH, 02H ; Loop counter for 2 digits ‘mov AL, 3AH ; Input hex number t3: Rol AL, 04H ; Rotate left to bring high nibble to low mov BL, AL ; Store AL AND AL, OFH ; Mask to keep only low nibble ‘emp AL, 09H Jbe LI ; IF <4, jump to LI add Al, 37H ; For A-F, convert to ASCII jmp 2 ur add AL, 30H ; For 0-49, convert to ASCII 42: 3 Display AL here Cwrite to sereen or memory) mov AL, BL ; Restore AL dec CH ; Decrease counter nz L3 ; Repeat if CH #0 Example: if AL = 3AH, the output will Bes + High nibble 3 + ASCII'3! + Low nibble A (10) 4 ASCII 'A' So the display will be: "3A" 33, Explain ROL, ROR, SHR, SHL with example: + ROL (Rotate Left): Rotates bits to the left. Example: ROL Al, | - Moves MSB to LSB. + ROR (Rotate Right): Rotates bits to the right. Example: ROR AL, 1 - Moves LSB to MSB. + SHL (Shift Left): Shifts bits left, inserts 0 in LSB, MSB goes to carry. Example: SHL AL, } + SHR Shift Right): Shifts bits right, inserts 0 in MSB, LSB goes to cany. Example: SHR AL, | 34, Difference between RET and IRET: + RET (Retum): Used to return from @ procedure. + IRET (interrupt Return): Used to return from an interrupt routine. Also restores flags. 35. Declare byte, word, double word, quad variable with exomple: varl DB OSH ; Byte (8-bit) var2 DW) 1234H ; Word Clé-bit) var3 DD 1234SAB7H ; Double Word (32-bit) vard DQ S7B9ABCDEFIAGTAGH ; Quad Word (64-bit) 36. ASCH to Hex Conversion: + ASCII —» HEX: emp with 39H I less than 34H — subtract 30H Else —» subtract 37H 37, HEX to ASCII Conversion: + HEX — ASCII: emp with 09H o IPs 4» Add 30H Else — Add 37H 38. How following instructions work (brief): + MOV — Data tronsfer + ADD —» Addition + SUB — Subtraction + DEC —+ Decrement by | + INZ — Jump if not zero + IBE — Jump if below or equal + IMP — Unconditional jump + ZEP — Likely a typo} no such instruction + MOVSB — Move string byte “CLD —+ Clear direction flag « SGDT — Store global descriptor table + SLDT —+ Store local descriptor table + SIDT —» Store interrupt descriptor table + STR + Store task register + SMSW) —» Store machine status word + AND — Bitwise AND + ROL — Rotate Left + XOR — Bitwise XOR + BT — Bit test + INC — Jump if no carry + MUL — Unsigned multiplication + IDIV — Signed division 34. Explain logic of block transfer: « Involves overlapping & non-overlapping memory copy using loops or string operations. 40. +ve & -ve No. Conversion: + Convert using 2’s "complement for -ve. + Use BCD conversion for decimal display. GI, HEX to BED & BCD to HEX: + Use division/modulus or lookup table method. 42, Successive addition (Add & Shift method): « Repeatedly add and shift bits to multiply or compute values. 43, Registers in 80386 & their use: + EAX, EBX, ECX, EDX — General purpose + ESP, EBP — Stock pointer/bose pointer + EIP — Instruction pointer + All are 32-bit registers

You might also like