Question

Can someone write a method in MIPS assembly language that asks the user for a hexadecimal...

Can someone write a method in MIPS assembly language that asks the user for a hexadecimal value and converts it into a decimal?

Homework Answers

Answer #1
  • .data
  • x: .word 0x8456
  • .text
  • lw $s0,x #s0 = x
  • addiu $t0,$zero,31 #(t0) i == 31 (the counter)
  • li $t1,1 #(t1) mask
  • sll $t1,$t1,31
  • li $v0,1 #prepare system call for printing values
  • loop: beq $t0,-1,end_loop #if t0 == -1 exit loop
  • and $t3,$s0,$t1 #isolate the bit
  • beq $t0,$0,after_shift #shift is needed only if t0 > 0
  • srlv $t3,$t3,$t0 #right shift before display
  • after_shift:
  • move $a0,$t3 #prepare bit for print
  • syscall #print bit
  • subi $t0, $t0, 1 #decrease the counter
  • srl $t1,$t1, 1 #right shift the mask
  • j loop
  • end_loop:
  • #the above will print:
  • #00000000000000001000010001010110
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
Write a program in Mars MIPS Assembly Language that asks the user for an 8-digit hexadecimal...
Write a program in Mars MIPS Assembly Language that asks the user for an 8-digit hexadecimal and then prints out its 32-bit binary representation, the operation of the function, the format (I, R, or J), the fields associated with the format (op, rs, rt, imm, shamt, funct), and the instruction associated with the hexadecimal. All five parts must be written as functions.
Write a mips assembly language program that asks the user to enter and integer number and...
Write a mips assembly language program that asks the user to enter and integer number and read it. Then ask him to enter a bit position (between 0 and 31) and display the value of that bit.
0x36710018 Convert the above MIPS machine word (given in hexadecimal) into a MIPS assembly language instruction....
0x36710018 Convert the above MIPS machine word (given in hexadecimal) into a MIPS assembly language instruction. Give registers using register numbers (ex. $5) NOT register names. Give immediate operands (if any) in decimal. ------- -------- ------- ------ fill in blank
Write a program in MIPS ASSEMBLY LANGUAGE.. Take no of students as input from the user,...
Write a program in MIPS ASSEMBLY LANGUAGE.. Take no of students as input from the user, then take marks of 5 subjects for each student from the user. Then find Minimun, Maximum and Median of all the subjects. and comment each line in code also make flow chart
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!
Create a MIPS program that takes an ASCII string of hexadecimal digits inputted by the user...
Create a MIPS program that takes an ASCII string of hexadecimal digits inputted by the user and converts it into an integer.
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.
Write a MIPS Assembly Language program to request a name and reflect it back to the...
Write a MIPS Assembly Language program to request a name and reflect it back to the user. The request must be "Please enter your full name:" And it should be output following "The name you entered was: '
Write and test code in MIPS assembly language program to implement algorithms "The Non-Restoring Algorithm "of...
Write and test code in MIPS assembly language program to implement algorithms "The Non-Restoring Algorithm "of an 8-bit integer the user shoud insert the number then by the algo well find the square root
(MIPS Assembly language) Ask user for two decimal numbers and save to memory (not registers). Multiply...
(MIPS Assembly language) Ask user for two decimal numbers and save to memory (not registers). Multiply these two numbers using adding and shifting only, not the "mul" instruction and print the product to the user as both a base-10 and base-32 (again, no using div/mul/rem). Save the output to a txt file. The program should run 5 times, with no user input needed to continue the program.    
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT