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 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.
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.
In C++ Write a program that will convert a string of binary digits to their decimal...
In C++ Write a program that will convert a string of binary digits to their decimal equivalent. For convenience limit the binary number to 16 bits. Write the decimal equivalent to the screen. For this program you must read in the binary number as a string type. If you were to enter a large binary number like 110110001100111 as a decimal value it would be too large to fit in an int type.
Determine the number of digits needed to write the decimal number 289,259,165 in binary.
Determine the number of digits needed to write the decimal number 289,259,165 in binary.
Write a MIPS Assembly Language program which runs interactively to convert between decimal, binary, and hexadecimal....
Write a MIPS Assembly Language program which runs interactively to convert between decimal, binary, and hexadecimal. 1. Request input data type. 2. Request input data. 3. Request output data type. 4. Output the data. The suggested approach was to take the input data as a string. But I am really lost as to how to process the string and then converting it to another data type. Thanks for the help!
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT