Q. What is the main difference between 16 bit and 32 bit versions of C/C++ while using in line assembler.
Ans The 32-bit applications are written using Microsoft Visual C/C++ for windows and the 16-bit applications are written using Microsoft C/C++ for DOS. The main difference is that Visual C/C++ for windows is more common today, but does not easily call DOS functions such as INT21H.
Q. Explain data addressing modes (with examples) available in microprocessors.
Ans, Direct Mode:
ΓÇó Instruction includes memory access.
ΓÇó CPU accesses that location in memory.
Example:
LDAC 5
Reads the data from memory location 5, and stores the data in the CPUΓÇÖs accumulator.
Indirect Mode:
ΓÇó Address specified in instruction contains address where the operand resides.
Example:
LDAC @5 or LDAC (5)
Retrieves contents of location 5, uses it to access memory address.
Register Direct and Register Indirect Modes
ΓÇó Does not specify a memory address. Instead specifies a register.
Example:
LDAC R
Where R is a register containing the value 5.The instruction copies the value 5 from register and into the CPUΓÇÖs accumulator.
Immediate Mode
ΓÇó The operand specified in this mode is the actual data it self.
Example:
LDAC #5
Moves the value 5 into the accumulator.
Implicit Mode
ΓÇó Does not exactly specify an operand. Instruction implicitly specifies the operand because it always applies to a specific register.
Example:
CLAC
Clears the accumulator, and sets value to zero. No operands needed.
Relative Mode
ΓÇó Operand supplied is an offset, not the actual address. Added to the contents of the CPUΓÇÖs program counter register to generate the required address.
Example:
LDAC $5 is located at memory location 10, and it takes up two blocks of memory.
Thus the value retrieved for this instruction will be 12 + 5, and will be stored in the accumulator
Index Mode and Base Address Mode
ΓÇó Address supplied by the instruction is added to the contents of an index register.
ΓÇó Base address mode is similar except, the index register is replaced by a base address register.
Example:
LDAC 5(X) where X = 10
Reads data from location (5 + 10) = 15 and stores it in the accumulator.
Q. (i) Convert binary number in two's compliment form 0100 1000
(ii) Convert hexadecimal BCH to decimal
Ans. 01001000 => 10111000
BCH =>1011 1100 => 188.
Q. Write a Program in assembly language to find the largest of n numbers stored in the memory.
Ans
MOV AX, 0000
MOV SI, 0200
MOV CX, [SI]
BACK : INC SI
INC SI
CMP AX, [SI]
JAE GO
MOV AX, [SI]
GO: LOOP BACK
MOV [0251], AX
INT 3.
Q. Write an assembly language program to find oneΓÇÖs complement and twoΓÇÖs complement of an 8-bit number
Ans OneΓÇÖs complement of an 8-bit number
LDA 2501H
CMA
STA 2502H
HLT.
TwoΓÇÖs complement of an 8-bit number
LDA 2501H
CMA
INR A
STA 2502H
HLT.
Computer Architecture-3
- Details
- Category: Computer Architecture and Organization
- Hits: 1944