Department of Electrical and Electronic Engineering
Chittagong University of Engineering and Technology
Course Code: EEE-364
Course Title: Microprocessor and Interfacing Sessional
Lab Report No: 04
Experiment Name: Logical, Shift and Rotate Operations
Lab Report Problem Set
Instructions: For each problem, write the assembly language program to solve the task.
Then, write the corresponding machine code for each instruction. Assume all programs start
at address ‘0100h‘.
Problem 1: Bit Masking
The ‘AL‘ register contains the value ‘55h‘.
1. First, clear bits 2 and 3.
2. Then, set bits 6 and 7.
What is the final value in ‘AL‘?
Final Value in AL:
Code:
Table 1: Code for Problem 1
Address Assembly Code Machine Code (Hex)
(Mnemonic)
0100 MOV AL, 55h B0 55
0102
0105
0107 INT 3 CC
1
Problem 2: Multiplication by 5
The ‘BL‘ register contains the value ‘12h‘. Multiply this value by 5 using only ‘MOV‘, ‘ADD‘,
and ‘SHL‘ instructions. Store the final result in the ‘AX‘ register (clear ‘AH‘ first to be safe).
Final Value in AX:
Code:
Table 2: Code for Problem 2
Address Assembly Code Machine Code (Hex)
(Mnemonic)
0100
0102
0104
0106
0108
010A INT 3 CC
Problem 3: Data Packing
You have two 4-bit numbers (nibbles). The upper nibble, ‘07h‘, is in the ‘AH‘ register. The
lower nibble, ‘09h‘, is in the ‘AL‘ register. Combine these two nibbles into a single byte in the
‘AL‘ register, so that ‘AL‘ contains the value ‘79h‘.
Final Value in AL:
Code:
Table 3: Code for Problem 3
Address Assembly Code Machine Code (Hex)
(Mnemonic)
0100
0102
0104
0106
0108
010A INT 3 CC
Problem 4: Data Unpacking (Isolation)
The ‘AL‘ register contains the value ‘C5h‘ (binary ‘1100 0101b‘). Isolate the middle four bits
(bits 5, 4, 3, 2) and store this 4-bit value, normalized (shifted to the right so it’s a value between
0 and 15), in the ‘BL‘ register.
Final Value in BL:
Code:
2
Table 4: Code for Problem 4
Address Assembly Code Machine Code (Hex)
(Mnemonic)
0100
0102
0104
0106
0108
010A INT 3 CC