Microprocessor · Unit 4 · 10 hrs
Assembly Language Programming
Exam-focused notes for Assembly Language Programming (Microprocessor, CSC167): what the TU syllabus asks and how it has actually been tested, with 28 solved past questions from this unit.
What this unit covers
- Assembly instruction format
- Instruction Types
- Mnemonics
- Operands
- Macro assemblers
- Linking
- Assembler directives
- Addressing Modes
- Simple sequence programs
- Flags
- Branch
- Jumps
- While-Do
- Repeat-Until
- If-Then-Else and Multiple If-then Programs
- Debugging
Simple sequence programs
Explain LHLD and SHLD instruction. Ten 8-bit data are stored at memory location starting from 6000H. Write an assembly program for 8085 microprocessor to calculate the sum of this data array and store the sum and carry starting from 9500H.[10]
- Number of data values: 10 (0AH) - Data type: 8-bit each - Data starting address: 6000H (so 6000H to 6009H) - Sum storage address: 9500H - Carry storage address: implied 9501H (next location) All required data is present. --- A 3-byte instruction that load...
Full solved answer →Write an ALP to convert the string 'computer science' to upper case using 16 bit microprocessor. [5]
In ASCII, lowercase letters range from 61H ('a') to 7AH ('z') and uppercase letters range from 41H ('A') to 5AH ('Z'). To convert lowercase to uppercase, we subtract 20H from the ASCII value of each lowercase character. Spaces and other non-alphabetic chara...
Full solved answer →Explain the working of LHLD and DAA instruction of 8085. An array containing 5 elements is stored from memory location 4000h to 4004h; write an assembly language program for 8085 microprocessor to find largest element of array and store in memory location 4005h.[10]
--- Syntax: LHLD address Size: 3 bytes (1 opcode + 2 address bytes) Operation: - LHLD loads the contents of two consecutive memory locations into the H-L register pair - The lower byte (from the specified address) is loaded into register L - The higher byte...
Full solved answer →Write an assembly language program for 16 bit microprocessor to count and display number of occurrence of letter 'o' in string 'Microprocessor organization'. [5]
Count and display the number of times letter 'o' appears in the string 'Microprocessor organization'. --- --- Step Instruction Purpose ---------------------------- 1 MOV AX, @DATA / MOV DS, AX Initialize the Data Segment register 2 MOV SI, OFFSET STRING Poi...
Full solved answer →Write an assembly language program to find the largest number of an array using 8 bit microprocessor. (Assume appropriate array data and address where minimum array size of 15 should be considered)[10]
The question specifies no fixed numeric values, so standard exam assumptions are made: Item Assumed Value ------ Array length stored at 2200H Array data starts at 2201H Array size (minimum required) 15 elements (0FH) Result location 2300H Data type Unsigned...
Full solved answer →Write an assembly language program for 8086 to read two strings and check whether they are same or not. [5]
This is a programming problem, not a numeric one. No numeric matrices, burst times, or reference strings are provided. - Task: Read two strings from the keyboard and check whether they are the same or not. - Processor: 8086 - Environment (implied): MS-DOS /...
Full solved answer →Explain LXI and CMP instruction. Write an assembly language program for 8-bit microprocessor to divide 8 bit data stored in memory location 8050 by 8 bit data stored in 8051 and store the quotient in 8052 and remainder in 8053.[10]
LXI (Load Register Pair Immediate) is a 3-byte instruction that loads 16-bit immediate data into a register pair (BC, DE, HL) or the Stack Pointer (SP). Syntax: LXI rp, 16-bit data Operation: - The low-order byte (byte 2 of the instruction) goes to the low ...
Full solved answer →Write an assembly language program for 16 bit microprocessor to reverse the string 'This is Microprocessor' [5]
- Target processor: 16-bit microprocessor (8086) - String to reverse: This is Microprocessor - Character count: Let me count precisely: - This = 4 - space = 1 - is = 2 - space = 1 - Microprocessor = 14 - Total = 4 + 1 + 2 + 1 + 14 = 22 characters - Number o...
Full solved answer →Write an assembly language program to find the greatest number in an array in using 8 bit microprocessor. (Assume appropriate array data and address where minimum array size of 20 should be considered.)[10]
--- Find the greatest (maximum) number in an array of 8-bit numbers using the 8085 (8-bit) microprocessor. The array has a minimum size of 20 elements. --- Item Value / Description ------ Array length 20 (14H) stored at memory location 2200H Array data Star...
Full solved answer →Write an ALP for 8086 to read a string and print it in the reverse order. [5]
The program reads characters one by one from the keyboard and pushes each character onto the stack. After the Enter key (carriage return) is detected, the characters are popped from the stack (LIFO order) and printed, which produces the reverse order. --- -...
Full solved answer →Write an assembly language program to find the smallest number in an array using 8 bit microprocessor, (assume appropriate array data and address where minimum array size of 15 should be considered.)[10]
--- - We need to find the smallest (minimum) number in an array of 8-bit data. - Array size: minimum 15 elements - We assume: - Memory location 2200H stores the length of the array (count = 15 = 0FH) - Memory locations 2201H onwards store the array elements...
Full solved answer →Write an ALP for 8086 to read a string and display the string in uppercase. [5]
- Read characters one by one using INT 21H, AH=01H - Convert lowercase letters (a-z) to uppercase by subtracting 20H (since ASCII difference between lowercase and uppercase is 32 = 20H) - Display each character using INT 21H, AH=02H - Stop reading when Ente...
Full solved answer →Write an Assembly program for calculating the factorial of a number using 8085 microprocessor.[10]
The factorial of a number N is calculated as: N! = N × (N-1) × (N-2) × ... × 2 × 1 For example: 5! = 5 × 4 × 3 × 2 × 1 = 120 --- 1. Load the number N from memory 2. Initialize a result register to 1 (since 0! = 1 and 1! = 1) 3. Multiply result by N, then de...
Full solved answer →Write an Assembly program to reverse the given string. [5]
The strategy uses the stack as a temporary storage structure (LIFO - Last In, First Out): 1. Read characters one by one from input and PUSH each onto the stack, counting them in CX. 2. When end of input is detected, POP characters one by one and display the...
Full solved answer →Addressing Modes
Explain different addressing modes in 8085 microprocessor. [5]
An addressing mode refers to the way in which the operand (data) of an instruction is specified. The 8085 microprocessor supports 5 types of addressing modes. --- - In this mode, the data (operand) is directly specified in the instruction itself. - The data...
Full solved answer →What is mean by addressing mode? Explain different addressing modes in 8085 microprocessor. [5]
An addressing mode refers to the way in which the operand (data) of an instruction is specified or accessed. In other words, it defines the method used by the CPU to identify the location of data to be operated upon. The 8085 microprocessor supports 5 types...
Full solved answer →What is mean by addressing mode? Explain all the addressing mode available in 8085 microprocessor. [5]
An addressing mode refers to the way in which the operand (data) of an instruction is specified or accessed. It defines the method used by the microprocessor to identify the location of the data to be operated upon. Different addressing modes provide flexib...
Full solved answer →Explain the addressing modes of 8085 microprocessor with examples. [5]
An addressing mode refers to the way in which the operand (data) of an instruction is specified. The 8085 microprocessor has 5 types of addressing modes. --- In this mode, the source operand is the data itself (a constant value directly given in the instruc...
Full solved answer →Flags
Write short notes on :a. Flags in 8085 MPU b. DMA [5]
--- Flags are special flip-flop circuits within the Flag Register (also called the Program Status Word) of the 8085 microprocessor. They are set (1) or reset (0) automatically based on the result of arithmetic and logical operations performed by the ALU. Th...
Full solved answer →What is flag? Explain all the flags present in 8085 microprocessor. [5]
A flag is a single-bit flip-flop (1-bit register) that indicates the status of the accumulator or other registers after the completion of an arithmetic or logical operation. These flip-flops are set (1) or reset (0) according to the data condition of the re...
Full solved answer →What is flag? Explain the flags that are present in 8085 microprocessor. [5]
A flag is a single-bit flip-flop (1-bit register) that indicates the status or condition of the result stored in the accumulator after the completion of an arithmetic or logical operation. Flags are part of the Flag Register (also called the Program Status ...
Full solved answer →Instruction Types
Explain different types of instruction group of 8085. [5]
An instruction is a binary pattern designed inside a microprocessor to perform a specific function. The entire group of instructions that a microprocessor supports is called the Instruction Set. The 8085 has 246 instructions, each represented by an 8-bit bi...
Full solved answer →Differentiate between PUSH and POP instruction with example illustrating the use of these instruction. [5]
PUSH and POP are stack-related data transfer instructions in the 8085 microprocessor. They are used to store and retrieve data from the stack (a special region of memory that operates on the Last In First Out - LIFO principle). The Stack Pointer (SP) regist...
Full solved answer →Differentiate between PUSH and POP instruction with example illustrating the use of these instructions. [5]
PUSH is a data transfer instruction that copies the contents of a specified register pair onto the stack (a reserved area in memory). The Stack Pointer (SP) is decremented by 2 (since a register pair holds 16 bits = 2 bytes) before storing the data. Syntax:...
Full solved answer →What is CALL operation? How does it differ with JUMP operation? [5]
The CALL instruction is used in assembly language (8085 microprocessor) to transfer program control to a subroutine (a separate block of code) located at a specified memory address. When a CALL instruction is executed, the following steps occur: 1. The curr...
Full solved answer →What is instruction set? Explain various kinds of instructions of 8086 microprocessor. [5]
An instruction is a binary pattern designed inside a microprocessor to perform a specific function. The entire group of instructions that a microprocessor supports is called the Instruction Set. Each instruction is represented by a binary value called an Op...
Full solved answer →What is instruction set? Explain various kinds of instructions of 8085 microprocessor. [5]
An instruction is a binary pattern designed inside a microprocessor to perform a specific function. The entire group of instructions that a microprocessor supports is called the Instruction Set. - The 8085 microprocessor supports 246 instructions. - Each in...
Full solved answer →Jumps
Write short notes on: a. Jumps b. Accumulator [5]
--- A jump instruction in 8085 microprocessor assembly language is used to transfer program control (the program counter) to a specified memory address, either unconditionally or based on the status of certain flags (condition codes). 1. Unconditional Jump ...
Full solved answer →Make Unit 4 stick
Practice CSC167 with flashcards & quizzes