Question

In: Computer Science

Two integer numbers a=10 and b=20 are stored in the data segment of the memory. The...

  1. Two integer numbers a=10 and b=20 are stored in the data segment of the memory. The number a is stored in Mem[0x10010000] and b is stored in Mem[0x10010004]. Write MIPS assembly code to swap the two numbers, load a to a register, b to another register and store a at Mem[0x10010004], store b at Mem[0x10010000].

Solutions

Expert Solution

code:

.text
li $a,0x10010000 //loading a value into memory location
li $b,0x10010004 //loading b value into memory location

move $t,$a //moving a value to new register

move $a,,$b       //swapping a and b value

move $b,$t //swapping a to b

syscall

code screenshot:

output:


Related Solutions

1.) What type of data is stored in a pointer? a. an integer b. a character...
1.) What type of data is stored in a pointer? a. an integer b. a character c. A memory address d. None of the above 2.) A stack in used to implement method calls in a program. True or Flase?
Write an Intel 8085 assembly program to find the largest of N numbers stored in memory...
Write an Intel 8085 assembly program to find the largest of N numbers stored in memory using the algorithm below. Hand trace (execute) the program showing the changes made to all affected registers and memory locations. Max = a(1) For i = n to N If max < a(i) then max = a(i) Next i
There will be 10 numbers stored contiguously in the computer at location x7000 . Write a...
There will be 10 numbers stored contiguously in the computer at location x7000 . Write a complete LC-3 program, starting at location x3000, that will find the location of the smallest number and swap its location with the number in location x7000. For example, Suppose the following numbers are stored at location x7000: x7000 123F                                                                            x7000 0042 x7001 6534                                                                            x7001 6534 x7002 300F                                                                            x7002 300F x7003 4005                after the program is run, memory       x7003 4005 x7004 3F19                would look like----à                         ...
The unsigned decimal value (1,036)10 is to be stored as a 16-bit word in memory. Show...
The unsigned decimal value (1,036)10 is to be stored as a 16-bit word in memory. Show the 16-bit unsigned binary representation of (1,036)10. Show the 4-digit unsigned hexadecimal representation of (1,036)10. The unsigned binary value of part (a) should be stored using two bytes of a byte-addressable memory at locations 400 and 401. Specify the hexadecimal value in each byte for a “big endian” instruction set architecture. Give your answer by showing a table like the one below.                                                                                               ...
for python 3 a. Ask the user to enter 10 numbers. Each number is stored in...
for python 3 a. Ask the user to enter 10 numbers. Each number is stored in a list called myList. Compute and print out the sum and average of the items in the list. Print the numbers that are divisible by 2 from myList. b. Instead of using a list to store the numbers, create a loop to accept the numbers from the user, and find the average of all the numbers. Hint: use an accumulator to store the numbers...
Write a program in Easy68K: a) Define an array of numbers in the memory. b) Read...
Write a program in Easy68K: a) Define an array of numbers in the memory. b) Read two numbers from keyboard. The first number is the size of the array and the second number is what index of the array you want to access. The index you entered can be larger than the array. c) Display the element indexed by (index % size) in the array.
how multiplication of two numbers (50 & 25) stored in RAM is carried out on the...
how multiplication of two numbers (50 & 25) stored in RAM is carried out on the Cortex-M4 processor using the MUL instruction.
Assume that 20 bytes of Packed BCD data is present in a data memory at location...
Assume that 20 bytes of Packed BCD data is present in a data memory at location 0x300 to 0x313. You have to write an assembly program that will display data on a two seven segment displays one connected to Port A and other connected to Port B using loops. You also have to analyze data if the data is equal to 0x22 then start storing data bytes at corresponding memory address 0x400 to 0x413 in reverse order i.e. if the...
Task 1 Write a program that adds the three numbers stored in data registers at 0x20,...
Task 1 Write a program that adds the three numbers stored in data registers at 0x20, 0x30, and 0x40 and places the sum in data register at 0x50 task 4 Modify the program in Task1, so the program will run in infinite loop by using these following functions: GOTO function BRA function CALL function Simulate your program in PIC18 IDE Simulator and attach a screenshot of your simulation while the program is running.
.data A: .space 80 # create integer array with 20 elements ( A[20] ) size_prompt: .asciiz...
.data A: .space 80 # create integer array with 20 elements ( A[20] ) size_prompt: .asciiz "Enter array size [between 1 and 20]: " array_prompt: .asciiz "A[" sorted_array_prompt: .asciiz "Sorted A[" close_bracket: .asciiz "] = " search_prompt: .asciiz "Enter search value: " not_found: .asciiz " not in sorted A" newline: .asciiz "\n" .text main: # ---------------------------------------------------------------------------------- # Do not modify la $s0, A # store address of array A in $s0 add $s1, $0, $0 # create variable "size" ($s1)...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT