Microprocessor: HCS12 - What is the difference between LSLA and ASLA? Explain wi
ID: 3349400 • Letter: M
Question
Microprocessor: HCS12
- What is the difference between LSLA and ASLA? Explain with example.
- Write a program which prompts user to enter a character, if the user presses "Z, the program asks user to enter a number. In this case the program implements 5-input majority voting logic which is explained as follows.The value of the number represented by the five leftmost bits of Register-B is tested. If the number of logic '1' bits (in the 5 leftmost bits) is greater than the number of logic '0' bits, the program should output: “The number of 1’s in the 5 left most bits is greater than the number of 0’s”. If the number of logic '0' bits (in the 5 leftmost bits) is greater than the number of logic '1' bits, the program should output: “The number of 0’s in the 5 left most bits is greater than the number of 1’s”.
Explanation / Answer
Answer 1:
* LSL Stands for Logical Shift Left and LSLA stands for Logical Shift Left Accumulator.
LSLA instruction shifts the accumulator A left by one bit.
* ASL stands for Arithmetic Shift Left and ASLA stands for Arithmetic Shift Left Accumulator.
ASLA instruction shifts the accumulator A left by one place. Note that Left Shifts is an efficient way to multiply by powers of two.
For example, %0000 0010 = 2. After one arithmetic shift left: %0000 0100 = 4
The instructions "LSL" and "ASL" are identical in operation and use the same Opcode. The instruction "ASL" shifts all the bits in the accumulator one place to the left.