Question

Write LEGv8 "shift assembly instruction" to achieve the multiplication of a binary number by 16

Write LEGv8 "shift assembly instruction" to achieve the multiplication of a binary number by 16

Homework Answers

Answer #1

Solution:

to_binary    PROC
  push   BX ; save registers
push   CX
push    DX
xor AX,AX    ; result := 0
mov    CX,4    ; max. number of octal digits
repeat1:
; loop itarates a maximum of 3 times;
; but a NULL can terminates it early
mov    DL,[BX]      ; read the octal digit
cmp    DL,0 ; is it NULL?
je    finished ; if so, terminate loop
and    DL,0FH ; else, convert char. to numeric
shl AL,4 ; multiply by 16 and add to binary
add    AL,DL
inc BX ; move to next octal digit
loop    repeat1 ; and repeat
finished:
pop    DX ; restore registers
pop    CX
pop    BX
ret
to_binary    ENDP
END    main

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
5 – What is the binary encoding of the following RISC-V assembly instruction? Please write your...
5 – What is the binary encoding of the following RISC-V assembly instruction? Please write your answer as an 8-digit hexadecimal number. and x8, x6, x7
Please add some explanation if possible 1.The machine code of LEGv8 instruction SUB X15,X16,X17 in hexadecimal...
Please add some explanation if possible 1.The machine code of LEGv8 instruction SUB X15,X16,X17 in hexadecimal is? 2.The LEGv8 assembly instruction assembled into the hexadecimal machine code D1001695 is? 3.What does the LEGv8 instruction below do? LSL X12,X12,#8 4. Which LEGv8 instruction set X12 to be X10's one's complement? (Assume X9 contains hexadecimal FFFFFFFF.) 5. What is the minimum number of LEGv8 assembly instructions needed to perform the following task? A[20] = A[10] + b + c - 8
Write a MIPS assembly language procedure that simulates/implements the multiplication of two unsigned integers. The procedure...
Write a MIPS assembly language procedure that simulates/implements the multiplication of two unsigned integers. The procedure receives the mulitiplicand and the multiplier and returns the product. IT CANNOT USE A MULTIPLY INSTRUCTION! Write a MIPS assembly language program that demonstrates your multiplication procedure. Your program should ask the user for two integers to multiply. You can assume that the input integers are positive. Adhere to the procedure call convention.
What is the machine code that corresponds to the AVR Assembly Language Instruction and r31, r0...
What is the machine code that corresponds to the AVR Assembly Language Instruction and r31, r0 (Enter your answer as a 16 bit binary number. There must be no spaces or punctuation marks - just enter sixteen 1's or 0's.)
Write a possible assembly language instruction or set of instructions to accomplish the following: Compare the...
Write a possible assembly language instruction or set of instructions to accomplish the following: Compare the byte stored at the memory location pointed to by register R4 to the upper (higher) byte stored in register R5 b) Branch to instruction at label ‘ZERO’ if the lower byte of register R6 is zero c) Jump to the instruction at label ‘EVEN’ if the value in register R7 is an even number
Write an assembly program to count the binary ones in register R1.   
Write an assembly program to count the binary ones in register R1.   
Write an assembly language program that reverses all the bits of a 32-bit number. (Without using...
Write an assembly language program that reverses all the bits of a 32-bit number. (Without using RBIT instruction) Write an assembly language program that checks whether an unsigned number is perfect square or not.
Write the LEGv8 assembly program for following c program. Assume array1, array2 and array3 are stored...
Write the LEGv8 assembly program for following c program. Assume array1, array2 and array3 are stored in memory with base addresses at 1000, 2000 and 3000 respectively. int absoluteDifference(int x, int y) { int r; if (x > y) r = x - y; else r = y - x; return r; } int main() { for (int i=0; i < 10; i++) { int a = array1[i]; int b = array2[i]; int c = absoluteDifference(a, b); array3[i] = c;...
For the MIPS instruction sw $s3,18820($t5), show the immediate number, opcode, rs, and rt in binary...
For the MIPS instruction sw $s3,18820($t5), show the immediate number, opcode, rs, and rt in binary in the given order, separated by comma.
Write an assembly language instruction to program the 82C55 to get data from port A and...
Write an assembly language instruction to program the 82C55 to get data from port A and send it to port B, if PA=IN, PB=OUT, PC0-PC3=IN, and PC4- PC7=OUT and operating in Mode 0. Use port addresses of 300H-303H for the 82C55 chip.
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT