Question: Write an assembly program to multiply a given 8-bit integer in the AL register by 16 using the SHL instruction. Display the result in Decimal format using Kip Irvine's library. Hint: Understand how shifting bits left by 4 positions corresponds to multiplying by 16. Consider the effects of overflow.
2. SHR Instruction (Shift Right)
Question: Write an assembly program that divides a given unsigned 16-bit integer in AX by 2 using the SHR instruction. Store the quotient in BX and display it in decimal format. Hint: Observe how SHR shifts bits and performs unsigned division. Handle any remainder separately if needed.
3. SAL and SAR Instructions (Shift Arithmetic Left/Right)
Question: Create a Indicate the hexadecimal value of AL after each shift: a. Load AL with 7Dh and perform a right shift by 1 bit using SHR. b. Load AL with 7Dh and perform a left shift by 3 bits using SHL. c. Load AL with 92h and perform a right arithmetic shift by 1 bit using SAR. d. Load AL with 92h and perform a left arithmetic shift by 3 bits using SAL. Provide the final value of AL for each operation. And display it
4. ROL Instruction (Rotate Left)
Question: Write an assembly program that rotates the bits of an 8-bit value in AL left by 3 positions. Display the result before and after the rotation in binary format. Hint: Use Kip Irvine's procedures for converting numbers to binary strings for display.
5. ROR Instruction (Rotate Right)
Question: Create a program to rotate the bits of a 16-bit value in AX right by 5 positions. Use ROR instruction and display both the original and the modified value in hexadecimal format. 6. RCL and RCR Instructions (Rotate Through Carry Left/Right) Question: Write a program to rotate the contents of a 16-bit register DX through the carry flag left by 1 position. Demonstrate the role of the carry flag by printing its value before and after the operation.
Question: Design a program to combine two 16-bit numbers in AX and BX into a 32-bit result using SHLD and SHRD. Store the final result in EAX and display it in hexadecimal format. Hint: Use SHLD to shift bits from one register to another while preserving alignment.
8. ADC Instruction (Add with Carry)
Question: Write an assembly program to add two 32-bit numbers stored in EAX and EBX, considering a carry from a previous operation. Use ADC and display the final sum in decimal format. Hint: Ensure the carry flag is appropriately set or cleared before the addition.
9. SBB Instruction (Subtract with Borrow)
Question: Create a program to subtract two 16-bit signed integers in AX and BX, considering a borrow. Use SBB and display the final result in signed decimal format. Hint: Pay attention to the borrow flag and how it affects subtraction.
10. MUL and DIV
Solve this Equation with any Dummy values yourselves. var4 = (var1 * var2) / (var2 – var3)