All Questions
3,325
questions
2
votes
0
answers
23
views
Printing 2D array in MIPS
I have been using a few other posts on here to try and figure out what I am doing wrong but I am stuck and could use some help. I am making a game that has an 8x8 "board" (2d array) similar ...
0
votes
1
answer
37
views
Why LI becomes LBU opcode after MIPS assembler
I'm trying to assemble code for MIPS R2000 (MIPS I ISA).
I'm using LI pseudo instruction to initiate a register. After running the assembler on the following code:
li $v1, 1
The binary .text ends up ...
0
votes
1
answer
58
views
Converting ARM assembly to RISC-V assembly
I am trying to rewrite this code. It works perfectly for ARM assembly, but I am trying to rewrite it in RISC-V assembly. Here is the ARM code:
.text
.global main
.equ ADD1, 0x40000000
.set ADD2, ...
2
votes
0
answers
29
views
How to work with multiple assembly code source files in SPIM
I'm learning to write assembly code at the moment using SPIM to simulate a MIPS32 environment. Reading some other posts here and elsewhere, it appears that some MIPS environments support an .include ...
0
votes
0
answers
20
views
Qtspim does not respond during new line
I was making a program for Qtspim that prints from 1 to 10 using a while statement.
It worked fine but the console output was 12345678910, so I wanted to add new lines to be fancier.
This is my code.
#...
2
votes
1
answer
57
views
Usage of recursion with array in MIPS
.data
A: .word 21 16 -12 25 -25 12 -32 -56 19 -11
.text
main:
la $a0, A #argument 1 : array address
li $a1, 10 #argument 2 : number of elements in array
jal print
...
0
votes
0
answers
30
views
MARS MIPS Assembly Code for Tree Search Algorithms
I'm working on a project, and I need help with my MIPS assembly code. The project requires implementing depth-first search (DFS) and breadth-first search (BFS) algorithms for binary trees represented ...
0
votes
0
answers
60
views
PCSpim MIPS simulator keeps telling me there is an error in the code and after I remove that line it finds new errors
.data
string: .asciiz "put the string here"
.text
main:
li $s0, 0 # initializing the register to hold the string's length
li $s1, 0 # initializing the register to ...
0
votes
0
answers
20
views
Sorting an Array from Depth first sort to breadth first order MIPS
For this project, i am tasked with switching an array from depth first sort into breadth first and vice versa in mars4_5, I had already did the depth first to breadth first as below.
.data
# Initial ...
0
votes
0
answers
34
views
Clarification Needed on Data Hazard in MIPS Assembly Code
I'm working through a problem involving data hazards in MIPS assembly code and need some clarification. Here is the code I'm analyzing:
addi $t0, $s0, 1
lw $t0, -8($s0)
sw $t1, -4($t0)
or $t0, $...
0
votes
0
answers
27
views
Why is my PSP VFPU assembly function for getting the quaternion of a set of Euler values incorrect?
I'm trying to make a function that takes a 3 long array of Euler values in π/2 radians, and have it give back the a quaternion for rotation. The VFPU assembly is as follows:
.globl ...
1
vote
1
answer
74
views
In shift left instruction, why is rt used as source register instead of rs?
In a shift left / shift right instruction, the rt is used as source register. Is there any reason why rt is used as source register, instead of rs ?
I saw some similar question answered "It is to ...
0
votes
1
answer
34
views
MIPS Assembly Printing wrong value, but cant change 41 to 42
I'm working on a project right now, which should be written in MIPS using the Mars4_5 Assembler.
Here's the following code. I suppose it has something to do with the choice to use 41 in li $v0 41 ...
0
votes
0
answers
19
views
How to declare a function to make an array of N integers as argument in MIPS assembly
This code will read integers from the user and store them sequentially in memory starting from the address pointed to by $a0 (the array address). It will read exactly $a1 integers, as specified by the ...
0
votes
0
answers
37
views
MIPS not transferring values properly between registers (adding 28 for no reason)
I'm writing a program in assembly that simulates multiplication via iterative addition. I have the algorithm done, and for my first test case, I set my multiplicand to 50. Upon transferring this value,...