Question
- Uses MIPS - Must look like the output displayed below ----------- Code: .data myNum: .word 0xA9876543 value: .word 100 endl: .asciiz #
- Uses MIPS
- Must look like the output displayed below
-----------
Code:
.data myNum: .word 0xA9876543 value: .word 100 endl: .asciiz " " # a string
.globl main .text main: # 1. loads the address for the label myNum into a temporary register (referred as Reg A) la $a0, myNum # 2. prints the value in Reg A to the screen as a hexadecimal value (syscall 34) on its own line (use a syscall and the label endl) li $v0, 34 syscall
# 3. load the value stored in memory at the label myNum (lw using Reg A) into a temporary register (referred as Reg B) # 4. print the value in Reg B to the screen as an integer (use syscall) on its own line # 5. bitwise AND the value in Reg B with the value 0x0FFFFFFF. # print the resultant value to the screen as an integer on its own line # 6. Reg A should still hold the address of myNum. Using Reg A, load a byte of data(lb) at the # address myNum + 2 into a different register (referred to as Reg C). Print the obtained value # to the screen as an integer on its own line # 7. use Reg A again to load a byte of data as an unsigned value (lbu) at the address myNum + 3 into a # different register (referred as Reg D). print the resultant value as an integer on its own line # 8. load word from the label value into any temporary register, Reg B (you can overwrite the previous one). # shift the value to the left by 1 bit, placing the result into another temporary register, Reg C (you # can overwrite the previous one). print the resultant value as an integer on its own line # 9. shift the value in Reg C to the right arithmetic by 2 bits. print the resultant value to the screen as an # integer on its own line # 10. load the integer value 8 into any register (referred to as Reg A) using load immediate (li). # rotate the value in Reg A to the right by 4 bits, placing the result into Reg A. check the value in # Reg A using the debugger. use the Mars data segment checkboxes to examine the value as an integer and # hexadecimal value. print the value to the screen in binary (syscall 35) on its own line. # 11. perform a 1 bit right shift arithmetic on the value in Reg A, placing the result in another temporary # register. print the resultant value to the screen in binary (syscall 35) on its own line. # 12. perform a 1 bit right shift logical on the value in Reg A. print the resultant value to the screen in binary # on its own line
Example of expected MARS output [1/5/21 @ 10am - Labels added to help see which step produces which output] Ox10010000 -1450744509 159868227 -121 169 Step 2 Step 4 Step 5 Step 6 Step 7 Step 8 Step 9 Step 10 Step 11 Step 12 200 50 10000000000000000000000000000000 11000000000000000000000000000000 01000000000000000000000000000000 program is finished runningStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started