Screenshot
-----------------------------------------------------------------------
Program
#Create a word
.data
Word: .byte -10 4 -5 12 7 2 45 32
putWord: .byte 100 0 0 0 0 0 0 0
#Program starts here
.text
#Get word in s0
la $s0,Word
#Move to a0
add $a0,$0,$s0
#Get index in a1
addi $a1,$0,6
#Call function, return value at index 6
jal getNibble
#Display nibble
add $a0,$0,$v0
addi $v0,$0,1
syscall
#Get line feed
li $v0,11
addi $a0,$0,10
syscall
#Check to put nibble
#Get s0 into a0
add $a0,$0,$s0
#Get put nibble word in a1
la $a1,putWord
#nibble index in a2
addi $a2,$0,4
#Call function, return word in v0
jal putNibble
#Display word
move $t0,$v0
addi $t1,$0,0
loop:
beq $t1,8,next
li $v0,1
lb $a0,7($t0)
syscall
li $v0,11
addi $a0,$0,32
syscall
addi $t1,$t1,1
addi $t0,$t0,-1
j loop
next:
#Get line feed
li $v0,11
addi $a0,$0,10
syscall
#Move word to a0 for swap
add $a0,$0,$s0
#Swap indexes
addi $a1,$0,2
addi $a2,$0,6
#Call method
jal swap
#Display word
move $t0,$v0
addi $t1,$0,0
#After swap
after:
beq $t1,8,end
li $v0,1
lb $a0,7($t0)
syscall
li $v0,11
addi $a0,$0,32
syscall
addi $t1,$t1,1
addi $t0,$t0,-1
j after
#End of the program
end:
li $v0,10
syscall
#Function to get specified nibble value
getNibble:
#Get specified nibble index
add $a0,$a0,$a1
#Get nibble
lb $v0,($a0)
#Return
jr $ra
#function to put value into specified nibble
putNibble:
#Store word in t1
move $t1,$a0
#Get specified nibble index
add $a0,$a0,$a2
#Get value to put
lb $a1,0($a1)
#Put value
sb $a1,($a0)
#get word in v0
add $v0,$0,$t1
#Return
jr $ra
#Function to swap nobbles
swap:
#Store word
add $t1,$0,$a0
#Get first index value
add $a0,$a0,$a1
lb $t0,($a0)
#Get second index nibble
add $a0,$0,$t1
add $a0,$a0,$a2
lb $t2,($a0)
#Store first nibble into second index
sb $t0,($a0)
#Store second nibble into first index
add $a0,$0,$t1
add $a0,$a0,$a1
sb $t2,($a0)
add $v0,$0,$t1
#Return
jr $ra
----------------------------------------
Output
45
32 45 2 100 12 -5 4 -10
32 -5 2 100 12 45 4 -10
-- program is finished running --
Mars Assignment Procedures Consider the ordering of the nibbles in a word as shown below Write pr...
For this lab you will write a Java program that plays a simple Guess The Word game. The program will prompt the user to enter the name of a file containing a list of words. These words mustbe stored in an ArrayList, and the program will not know how many words are in the file before it starts putting them in the list. When all of the words have been read from the file, the program randomly chooses one word...
== Programming Assignment == For this assignment you will write a program that controls a set of rovers and sends them commands to navigate on the Martian surface where they take samples. Each rover performs several missions and each mission follows the same sequence: deploy, perform one or more moves and scans, then return to base and report the results. While on a mission each rover needs to remember the scan results, in the same order as they were taken,...
Instructions: Below are both crater images (some of the work is already done for you on the Southern image). At the bottom left you will see scale bars and a set of circles to help you do the actual counting. We have already identified craters that are 8 km across with red dots, so you only need to worry about craters greater than the outlined ones. Do not recount those craters that have already been marked with red dots. To...
Need help with C++ assignment
Assignment 1 and .txt files are provided at the
bottom.
PART A
PART B
Assignment
1
#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <algorithm>
using namespace std;
/**
This structure is to store the date and it has three integer
fields
**/
struct Date{
int day;
int month;
int year;
};
/**
This structure is to store the size of the box and it...
Assignment Predator / Prey Objectives Reading from and writing to text files Implementing mathematical formulas in C++ Implementing classes Using vectors Using command line arguments Modifying previously written code Tasks For this project, you will implement a simulation for predicting the future populations for a group of animals that we’ll call prey and their predators. Given the rate at which prey births exceed natural deaths, the rate of predation, the rate at which predator deaths exceeds births without a food...
Part B. Gross Income Inclusions & Exclusions For each Q-6 through Q-19 below, determine whether the item described should be INCLUDED IN or EXCLUDED FROM the Gross Income of the taxpayer who receives the item. • Darken Box A on the Scantron sheet if the item should be INCLUDED IN gross income • Darken Box B on the Scantron sheet if the item should be EXCLUDED FROM gross income 6. $25,000 scholarship for tuition and books received by a full-time...