0
.data        # variable declarations follow this line
    maze:  .space  144     # 9x9 stored in a 16x9 buffer 
    robot_x: .word 0
    robot_y: .word 0
    robot_m_x: .word 0
    robot_m_y: .word 0

    robot_instructions: .space 244


    MsgRS1: .asciiz "Robot is at a safe place"  
    MsgRS2: .asciiz "Robot falls into Chasm"
    MsgRS3: .asciiz "Robot falls into the trap"
    MsgRS4: .asciiz "Robot reaches Destination"
    MsgRS5: .asciiz "Robot fails to reach Destination"

    .text # CODE SECTION OF ASM FILE
    #main:
    li $v0,30       # Get time
    syscall         # CMD: Get Time
        # $a0 = lower 32-bits,  $a1=upper 32-bits

        # Seed RNG (Random Number Generator)
    move $a1,$a0        # get lower 32-bit time as seed
    li $a0,0        # Rng#0
    syscall         # CMD: Seed the RNG


# Clear Maze Array

    la $t0, maze        # load address of maze
    li $t3, 0
    li $t1, 144
clr:        # repeat if not finished yet.

 la $t0, maze        # base address

     li  $t3, 2                #    maze[1][2] = 2;
     sb  $t3, 18($t0)    #        1 x16 + 2

    iSAFE: 1
    iCHASM: 2
    iTRAP: 3
    iDESTINATION: 4



    la $t0, maze        # base address

     li  $t3, iSAFE      #  maze[1][1] = 1;
     sb  $t3, 0x12($t0)    #        1 x 16 + 1


   la $t0, maze        # base address

     li  $t3, iCHASM       #    maze[1][2] = 2; #maze[2][4];
     sb  $t3, 0x12($t0)    #        1 x 16 + 2

 la $t0, maze        # base address

     li  $t3, iTRAP      #  maze[2][3] = 3; # maze[3][4];
     sb  $t3, 0x12($t0)    #        1 x 16 + 3
   la $t0, maze        # base address

     li  $t3, iDESTINATION      #   maze[3][2] = 4;
     sb  $t3, 0x12($t0)    #        1 x 16 + 4

r = (rand() % 3) + 1;     1...4

// $a0 has your random number 1...4
If you subtract 1, then it will set your zero flag
a0 = a0 - 1
if (a0 is not zero)

addi $a0, $a0, -1              // 
bnez  Try2
#      if (r == 1) then                 // move
          robot_x = robot_m_x;
            robot_y = robot_m_y + 1;
        endif
  jr  nxt

Try2:
addi $a0, $a0, -1              // 
#           if (r == 2)      // jump
   robot_x = robot_m_x;
   robot_y = robot_m_y + 2 ; 
#     endif
   jr  nxt
addi $a0, $a0, -1 
#    if (r == 3)                       // left
   robot_x = robot_m_x - 1;
#   endif
    jr nxt
addi $a0, $a0, -1 
#   if (r == 4)                  // Right
   robot_x = robot_m_x + 1; 
#`endif
    jr nxt

nxt:
    # Get a Random #

    li $a0, 0       # Rng#0
    li $a1, 4       # rand() %4   {0...3}
    li $v0, 41
    syscall         # Get RNG
        # $a0 = {0...3}
                addi $a0, $a0, 1          # $a0 = {1...4}

# Get a Random # li $a0, 0 # Rng#0 li $a1, 4 # rand() %4 {0...3} li $v0, 41 syscall # Get RNG # $a0 = {0...3} addi $a0, $a0, 1 # $a0 = {1...4}


    sb  $t3, 0($t0)     # Set value from array
    addi $t0, $t0, 1    # increment Maze address
    addi $t1, $t1, -1   # decrement loop counter
    bgtz $t1, clr       # repeat if not finished yet.


    la $a0, MsgRS1          # load address of print heading
    li $v0, 4               # specify Print String service
    syscall                 # print heading


# Get a Random #

    li $a0, 0               # Rng#
    li $a1, 4               # rand() %4   {0...3}
    li $v0, 42
    syscall                 # Get RNG
                            # $a0 = {0...3}

    li $v0, 1               # specify Print Integer service
    syscall                 # print number

    la $a0, MsgRS2          # load address of print heading
    li $v0, 4               # specify Print String service
    syscall                 # print heading

    la $a0, MsgRS3          # load address of print heading
    li $v0, 4               # specify Print String service
    syscall                 # print heading

    la $a0, MsgRS4 # load address of print heading
    li $v0, 4               # specify Print String service
    syscall                 # print heading

    la $a0, MsgRS5          # load address of print heading
    li $v0, 4               # specify Print String service
    syscall                 # print heading

li $v0,30       # Get time
    syscall         # CMD: Get Time
        # $a0 = lower 32-bits,  $a1=upper 32-bits

        # Seed RNG (Random Number Generator)
    move $a1,$a0        # get lower 32-bit time as seed
    li $a0,0        # Rng#0
    syscall         # CMD: Seed the RNG

      jr   $ra              # return

Edited by mike_2000_17: Fixed formatting

0

I've cleaned your code, but you need to finish cleaning it!

iSAFE = 1
iCHASM = 2
iTRAP = 3
iDESTINATION = 4


	.data # variable declarations follow this line

maze:	 	.space 144 # 9x9 stored in a 16x9 buffer 
robot_x: 	.word 0
robot_y: 	.word 0
robot_m_x:	.word 0
robot_m_y:	.word 0

robot_instructions: .space 244


MsgRS1: .asciiz "Robot is at a safe place" 
MsgRS2: .asciiz "Robot falls into Chasm"
MsgRS3: .asciiz "Robot falls into the trap"
MsgRS4: .asciiz "Robot reaches Destination"
MsgRS5: .asciiz "Robot fails to reach Destination"


	.text # CODE SECTION OF ASM FILE

#main:
	li	$v0,30 # Get time
	syscall # CMD: Get Time
		# $a0 = lower 32-bits, $a1=upper 32-bits

		# Seed RNG (Random Number Generator)
	move	$a1,$a0 # get lower 32-bit time as seed
	li		$a0,0 # Rng#0
	syscall 		# CMD: Seed the RNG


		# Clear Entire Maze Array

	la $t0, maze # load address of maze
	li $t3, 0
	li $t1, 144

clr: # repeat if not finished yet.
	la $t0, maze 		# base address
	li $t3, 2			# maze[i] = 0
	sb $t3, 0($t0)	 	
	add	$t0, $t0, 1     # address++
	add	$t1, $t1, -1	# count--
	bgtz	$t1, clr


		# Setup variables

	la $t0, maze 		# base address

	li $t3, iSAFE 		
	sb $t3, 0x11($t0) 	# maze[1][1] = 1;

	li $t3, iCHASM
	sb $t3, 0x12($t0) 	# maze[1][2] = 2
	sb $t3, 0x24($t0)	# maze[2][4] = 2

	li $t3, iTRAP		
	sb $t3, 0x23($t0)	# maze[2][3]
	sb	$t3, 0x34($t0)	# maze[3][4]

<---- Set the last one like I did in cleanup above

la $t0, maze # base address

li $t3, iDESTINATION # maze[3][2] = 4;
sb $t3, 0x12($t0) # 1 x 16 + 4





sb $t3, 0($t0) # Set value from array
addi $t0, $t0, 1 # increment Maze address
addi $t1, $t1, -1 # decrement loop counter
bgtz $t1, clr # repeat if not finished yet.


la $a0, MsgRS1 # load address of print heading
li $v0, 4 # specify Print String service
syscall # print heading


	# Get a Random #

	li $a0, 0 		# Rng#
	li $a1, 4 		# rand() %4 {0...3}
	li $v0, 42
	syscall # Get RNG
		# $a0 = {0...3}
	add	$a0, $a0, 1	# {1...4}
0

Error in assembly line 1 position 7: iSAFE = 1
Invalid language element: =
Error in assembly line 2 position 8: iCHASM = 2
Invalid language element: =
Error in assembly line 3 position 7: iTRAP = 3
Invalid language element: =
Error in assembly line 4 position 14: iDESTINATION = 4
Invalid language element: =
Error in assembly line 68 position 1: <---- Set the last one like I did in cleanup above
Invalid language element: <
Assemble: operation completed with errors.

would it be <:> instead of =?

0

no its saying the same thing. when i did it I think i had to change it to iSAFE:

0

yeah it worked..

<---- Set the last one like I did in cleanup above
Is this referring to the conditions?

0

No finish the initializations.

Then after the randomization of 1...4

Look at the snippet I did and see if you can finish them! Your four memovement states!
Also save that random value in your robot states array.

Remember, you'll have to get the address of each variable, then store the value at that variable.
Get address
load value into register from register referrenced memory,
do register increment/decrement math
store new value back into memory.

0

No need to past all the code again.
Paste from # Setup variables

to where you leave off editting your code for the four movement states.

For breadcrumbs you may want to insert a system-integer print to print out the random number that's generated for those 1...4

0
.data # variable declarations follow this line
    iSAFE: 1
    iCHASM: 2
    iTRAP: 3
    iDESTINATION: 4
maze:       .space 144 # 9x9 stored in a 16x9 buffer 
robot_x:    .word 0
robot_y:    .word 0
robot_m_x:  .word 0
robot_m_y:  .word 0

robot_instructions: .space 244


MsgRS1: .asciiz "Robot is at a safe place" 
MsgRS2: .asciiz "Robot falls into Chasm"
MsgRS3: .asciiz "Robot falls into the trap"
MsgRS4: .asciiz "Robot reaches Destination"
MsgRS5: .asciiz "Robot fails to reach Destination"


    .text # CODE SECTION OF ASM FILE

#main:
    li  $v0,30 # Get time
    syscall # CMD: Get Time
        # $a0 = lower 32-bits, $a1=upper 32-bits

        # Seed RNG (Random Number Generator)
    move    $a1,$a0 # get lower 32-bit time as seed
    li      $a0,0 # Rng#0
    syscall         # CMD: Seed the RNG


        # Clear Entire Maze Array

    la $t0, maze # load address of maze
    li $t3, 0
    li $t1, 144

clr: # repeat if not finished yet.
    la $t0, maze        # base address
    li $t3, 2           # maze[i] = 0
    sb $t3, 0($t0)      
    add $t0, $t0, 1     # address++
    add $t1, $t1, -1    # count--
    bgtz    $t1, clr


        # Setup variables

    la $t0, maze        # base address

    li $t3, iSAFE       # maze[1][1] = 1;
    sb $t3, 0x12($t0)   # 1 x 16 + 1

    li $t3, iCHASM
    sb $t3, 0x12($t0)   # maze[1][2] = 2
    sb $t3, 0x24($t0)   # maze[2][4] = 2

    li $t3, iTRAP       
    sb $t3, 0x23($t0)   # maze[2][3]
    sb  $t3, 0x34($t0)  # maze[3][4]



<---- Set the last one like I did in cleanup above

r = (rand() % 3) + 1;     #1...4

addi $a0, $a0, -1              
bnez  Try2
#      if (r == 1) then                 // move
          robot_x = robot_m_x;
            robot_y = robot_m_y + 1;
        endif
  jr  nxt

Try2:
addi $a0, $a0, -1              // was (2)?
#           if (r == 2)      // jump
   robot_x = robot_m_x;
   robot_y = robot_m_y + 2 ; 
#     endif
   jr  nxt
Try2:
addi $a0, $a0, -1 //
# if (r == 2) // jump
robot_x = robot_m_x;
robot_y = robot_m_y + 2 ;
# endif
jr nxt
addi $a0, $a0, -1
# if (r == 3) // left
robot_x = robot_m_x - 1;
# endif
jr nxt
addi $a0, $a0, -1
# if (r == 4) // Right
robot_x = robot_m_x + 1;
#`endif
jr nxt

nxt:


la $t0, maze # base address

li $t3, iDESTINATION # maze[3][2] = 4;
sb $t3, 0x12($t0) # 1 x 16 + 4





sb $t3, 0($t0) # Set value from array
addi $t0, $t0, 1 # increment Maze address
addi $t1, $t1, -1 # decrement loop counter
bgtz $t1, clr # repeat if not finished yet.


la $a0, MsgRS1 # load address of print heading
li $v0, 4 # specify Print String service
syscall # print heading


    # Get a Random #

    li $a0, 0       # Rng#
    li $a1, 4       # rand() %4 {0...3}
    li $v0, 42
    syscall # Get RNG
        # $a0 = {0...3}
    add $a0, $a0, 1 # {1...4}

Edited by mike_2000_17: Fixed formatting

0

What timezone are you in?
You may want to bring what you have into your teacher tomorrow and ask for the weekend to finish it.

Use what you told me that you've never programmed MIPS assembly before and you're learning as you go on this project, and you need a bit more time!

0

You're missing the variable setup for destination.
robot_x
robot_y
robot_state

Where I had r = (rand %3)
you should have replaced it with the random 1..4 that was written already.

the robot_x
and Y assignments upon conditionals bnez need to be programmed.
I only roughed in pseudo code.

0

no. At the this rate probably about 2 hours, and I haven't been able to work on my own work this evening as I've been focusing on your code.

0

He won't let me turn it in later.. Tomorrow is the final day of class..we have this due and our exam. Thank you for taking your time with me tho

0

You have everything you need!
Look at code that we've written and the original Fibonacci code to see how to do things!

You robot_m_x and _y would be easier with a structure or array then its the same address plus an offset but individually...

la $t0,robot_m_x
lw $t1,0($t0)              ; Get value in robot_m_x
add $t1, $t1, 1           ; increment
sw $t1,0($t0)            ; Store the value

You can use this same mechanism for +2, -1 +1 of your various robot arguments.

0

#setup variables
r = (rand() % 3) + 1; #1...4
addi $a0, $a0,
la $t0,robot_m_x
lw $t1,0($t0) ; Get value in robot_x
add $t1, $t1, 1 ; increment
sw $t1,0($t0) ; Store the value

la $t0,robot_m_x
lw $t1,0($t0) ; Get value in robot_y
add $t1, $t1, 2 ; increment
sw $t1,0($t0) ; Store the value


la $t0,robot_m_x
lw $t1,0($t0) ; Get value in robot_m_x
add $t1, $t1, 3 ; decrement
sw $t1,0($t0) ; Store the value


la $t0,robot_m_x
lw $t1,0($t0) ; Get value in robot_m_y
add $t1, $t1, 4 ; increment
sw $t1,0($t0) ; Store the value


la $t0, maze # base address

li $t3, iDESTINATION # maze[3][2] = 4;
sb $t3, 0x12($t0) # 1 x 16 + 4

0

Looking at your code you're on the home stretch!

System.out.println("Robot final location X: " + robot_x + " Y: " + robot_y);

More ASCII text
MsgFinal .asciiz "Robot final location X: "
System - print string

robot_x
get address of robot_x, then get value, then system-print integer

MsgY .asciiz " Y: "
print MsgY

robot_y print integer

You also need a "\n" message
print it to force a new line for strings that print an integer last.

On regular text strings stick a \n at the end of string like you would in Java.

I'll be focusing on my stuff, but try to finish this, and then I'll review!

0

Error in assembly line 68 position 3: r = (rand() % 3) + 1; #1...4
Invalid language element: =
Error in assembly line 68 position 13: r = (rand() % 3) + 1; #1...4
Invalid language element: %
Error in assembly line 68 position 20: r = (rand() % 3) + 1; #1...4
Invalid language element: 1;
Error in assembly line 71 position 28: lw $t1,0($t0) ; Get value in robot_m_x
Invalid language element: ;
Error in assembly line 72 position 27: add $t1, $t1, 1 ; increment robot
Invalid language element: ;
Error in assembly line 73 position 26: sw $t1,0($t0) ; Store the value
Invalid language element: ;
Error in assembly line 76 position 28: lw $t1,0($t0) ; Get value in robot_y+2
Invalid language element: ;
Error in assembly line 77 position 27: add $t1, $t1, 2 ; increment
Invalid language element: ;
Error in assembly line 78 position 26: sw $t1,0($t0) ; Store the value
Invalid language element: ;
Error in assembly line 82 position 28: lw $t1,0($t0) ; Get value in robot_m_x-1
Invalid language element: ;
Error in assembly line 83 position 27: add $t1, $t1, 3 ; decrement
Invalid language element: ;
Error in assembly line 84 position 26: sw $t1,0($t0) ; Store the value
Invalid language element: ;
Error in assembly line 88 position 28: lw $t1,0($t0) ; Get value in robot_m_x+1
Invalid language element: ;
Error in assembly line 89 position 27: add $t1, $t1, 4 ; increment
Invalid language element: ;
Error in assembly line 90 position 26: sw $t1,0($t0) ; Store the value
Invalid language element: ;
Assemble: operation completed with errors.

0

Things like (rand %3) are comments for reference for you!

; is habit. Should be # to mean comment.
Other assemblers use <;> not <#> for comments!

0

Error in assembly line 51 position 10: "iSAFE": operand is of incorrect type
Error in assembly line 54 position 10: "iCHASM": operand is of incorrect type
Error in assembly line 58 position 10: "iTRAP": operand is of incorrect type
Error in assembly line 64 position 10: "iDESTINATION": operand is of incorrect type
Error in assembly line 70 position 1: "addi": Too few or incorrectly formatted operands. Expected: addi $1,$2,-100
Error in assembly line 116 position 1: "MsgFinal.asciiz" directive cannot appear in text segment
Error in assembly line 118 position 1: "robot_x" directive cannot appear in text segment
Error in assembly line 120 position 1: "MsgY." directive cannot appear in text segment
Error in assembly line 121 position 1: "print" directive cannot appear in text segment
Error in assembly line 123 position 1: "robot_y" directive cannot appear in text segment
Error in assembly line 124 position 1: ""\n"" directive cannot appear in text segment
Assemble: operation completed with errors.

0

i fixed the iSafe by adding :


Error in assembly line 51 position 2: "li": Too many or incorrectly formatted operands. Expected: li $1,-100
Error in assembly line 54 position 2: "li": Too many or incorrectly formatted operands. Expected: li $1,-100
Error in assembly line 58 position 2: "li": Too many or incorrectly formatted operands. Expected: li $1,-100
Error in assembly line 64 position 2: "li": Too many or incorrectly formatted operands. Expected: li $1,-100
Error in assembly line 70 position 1: "addi": Too few or incorrectly formatted operands. Expected: addi $1,$2,-100
Error in assembly line 116 position 1: "MsgFinal.asciiz" directive cannot appear in text segment
Error in assembly line 118 position 1: "robot_x" directive cannot appear in text segment
Error in assembly line 120 position 1: "MsgY." directive cannot appear in text segment
Error in assembly line 121 position 1: "print" directive cannot appear in text segment
Error in assembly line 123 position 1: "robot_y" directive cannot appear in text segment
Error in assembly line 124 position 1: ""\n"" directive cannot appear in text segment
Assemble: operation completed with errors.

0

Don't forget you need to define those asciiz strings in the top of the file in the .data section.
Make sure there's a space or tab between label: and .asciiz
MsgFinal.asciiz is probably that and missing <:> colon

li $a1, 4
li $t1, 0

NOT li $1,-100 Load Immediate $register, immediate value

addi has same problem!

0
Error in assembly line 51 position 2: "li": Too many or incorrectly formatted operands. Expected: li $1,-100
Error in assembly line 52 position 2: "sb": Too many or incorrectly formatted operands. Expected: sb $1,-100($2)
Error in assembly line 54 position 2: "li": Too many or incorrectly formatted operands. Expected: li $1,-100
Error in assembly line 55 position 2: "sb": Too many or incorrectly formatted operands. Expected: sb $1,-100($2)
Error in assembly line 56 position 2: "sb": Too many or incorrectly formatted operands. Expected: sb $1,-100($2)
Error in assembly line 58 position 2: "li": Too many or incorrectly formatted operands. Expected: li $1,-100
Error in assembly line 64 position 2: "li": Too many or incorrectly formatted operands. Expected: li $1,-100
Error in assembly line 70 position 1: "addi" is an instruction name and cannot be used as a label
Error in assembly line 70 position 1: "addi": Too few or incorrectly formatted operands. Expected: addi $1,$2,-100
Error in assembly line 72 position 1: "li$t1" directive cannot appear in text segment
Error in assembly line 118 position 18: ""Robot final location X: "" directive cannot appear in text segment
Error in assembly line 120 position 1: "robot_x" directive cannot appear in text segment
Error in assembly line 122 position 1: "MsgY." directive cannot appear in text segment
Error in assembly line 123 position 1: "print" directive cannot appear in text segment
Error in assembly line 125 position 1: "robot_y" directive cannot appear in text segment
Error in assembly line 126 position 1: ""\n"" directive cannot appear in text segment
Assemble: operation completed with errors.



        # Setup variables
    la $t0, maze        # base address

    li $a1,4 iSAFE:         
    sb $t1,0 0x11($t0)  # maze[1][1] = 1;

    li $a1,4 iCHASM:
    sb $t1,0, 0x12($t0)     # maze[1][2] = 2
    sb $t1,0 0x24($t0)  # maze[2][4] = 2

    li $a1, iTRAP:      
    sb $t1, 0x23($t0)   # maze[2][3]
    sb  $t1, 0x34($t0)  # maze[3][4]

    la $t0, maze # base address

    li $a1, iDESTINATION: # maze[3][2] = 4;
    sb $t1, 0x12($t0) # 1 x 16 + 4


#setup variables
 #1...4
addi:
li $a1,4 
li$t1, 0
la $t0,robot_x
lw $t1,0($t0)              # Get value in robot_m_x
add $t1, $t1, 1           # increment robot 
sw $t1,0($t0)            #Store the value

la $t0,robot_y
lw $t1,0($t0)              # Get value in robot_y+2
add $t1, $t1, 2           #increment 
sw $t1,0($t0)            #Store the value


la $t0,robot_m_x
lw $t1,0($t0)              # Get value in robot_m_x-1
add $t1, $t1, 3           # decrement
sw $t1,0($t0)            # Store the value


la $t0,robot_m_y
lw $t1,0($t0)              # Get value in robot_m_x+1
add $t1, $t1, 4           #increment
sw $t1,0($t0)            #Store the value




sb $t3, 0($t0) # Set value from array
addi $t0, $t0, 1 # increment Maze address
addi $t1, $t1, -1 # decrement loop counter
bgtz $t1, clr # repeat if not finished yet.


la $a0, MsgRS1 # load address of print heading
li $v0, 4 # specify Print String service
syscall # print heading


    # Get a Random #

    li $a0, 0       # Rng#
    li $a1, 4       # rand() %4 {0...3}
    li $v0, 42
    syscall # Get RNG
        # $a0 = {0...3}
    add $a0, $a0, 1 # {1...4}

MsgFinal.asciiz: "Robot final location X: "

robot_x

MsgY. asciiz "Y:"
print Msgy

robot_y print integer
"\n"

Edited by mike_2000_17: Fixed formatting

0
.data # variable declarations follow this line
    iSAFE: 1
    iCHASM: 2
    iTRAP: 3
    iDESTINATION: 4
maze:       .space 144 # 9x9 stored in a 16x9 buffer 
robot_x:    .word 0
robot_y:    .word 0
robot_m_x:  .word 0
robot_m_y:  .word 0

robot_instructions: .space 244


MsgRS1: .asciiz "Robot is at a safe place" 
MsgRS2: .asciiz "Robot falls into Chasm"
MsgRS3: .asciiz "Robot falls into the trap"
MsgRS4: .asciiz "Robot reaches Destination"
MsgRS5: .asciiz "Robot fails to reach Destination"


    .text # CODE SECTION OF ASM FILE

#main:
    li  $v0,30 # Get time
    syscall # CMD: Get Time
        # $a0 = lower 32-bits, $a1=upper 32-bits

        # Seed RNG (Random Number Generator)
    move    $a1,$a0 # get lower 32-bit time as seed
    li      $a0,0 # Rng#0
    syscall         # CMD: Seed the RNG


        # Clear Entire Maze Array

    la $t0, maze # load address of maze
    li $t3, 0
    li $t1, 144

clr: # repeat if not finished yet.
    la $t0, maze        # base address
    li $t3, 2           # maze[i] = 0
    sb $t3, 0($t0)      
    add $t0, $t0, 1     # address++
    add $t1, $t1, -1    # count--
    bgtz    $t1, clr
            # Setup variables
    la $t0, maze        # base address

    li $a1,4 iSAFE:         
    sb $t1,0 0x11($t0)  # maze[1][1] = 1;

    li $a1,4 iCHASM:
    sb $t1,0, 0x12($t0)     # maze[1][2] = 2
    sb $t1,0 0x24($t0)  # maze[2][4] = 2

    li $a1, iTRAP:      
    sb $t1, 0x23($t0)   # maze[2][3]
    sb  $t1, 0x34($t0)  # maze[3][4]

    la $t0, maze # base address

    li $a1, iDESTINATION: # maze[3][2] = 4;
    sb $t1, 0x12($t0) # 1 x 16 + 4


#setup variables
 #1...4
addi:
li $a1,4 
li$t1, 0
la $t0,robot_x
lw $t1,0($t0)              # Get value in robot_m_x
add $t1, $t1, 1           # increment robot 
sw $t1,0($t0)            #Store the value

la $t0,robot_y
lw $t1,0($t0)              # Get value in robot_y+2
add $t1, $t1, 2           #increment 
sw $t1,0($t0)            #Store the value


la $t0,robot_m_x
lw $t1,0($t0)              # Get value in robot_m_x-1
add $t1, $t1, 3           # decrement
sw $t1,0($t0)            # Store the value


la $t0,robot_m_y
lw $t1,0($t0)              # Get value in robot_m_x+1
add $t1, $t1, 4           #increment
sw $t1,0($t0)            #Store the value




sb $t3, 0($t0) # Set value from array
addi $t0, $t0, 1 # increment Maze address
addi $t1, $t1, -1 # decrement loop counter
bgtz $t1, clr # repeat if not finished yet.


la $a0, MsgRS1 # load address of print heading
li $v0, 4 # specify Print String service
syscall # print heading


    # Get a Random #

    li $a0, 0       # Rng#
    li $a1, 4       # rand() %4 {0...3}
    li $v0, 42
    syscall # Get RNG
        # $a0 = {0...3}
    add $a0, $a0, 1 # {1...4}

MsgFinal.asciiz: "Robot final location X: "

robot_x

MsgY. asciiz "Y:"
print Msgy

robot_y print integer
"\n"

Edited by mike_2000_17: Fixed formatting

0

Mars has no errors with it. Yes iSafe is 1


Error in assembly line 51 position 2: "li": Too many or incorrectly formatted operands. Expected: li $1,-100
Error in assembly line 52 position 2: "sb": Too many or incorrectly formatted operands. Expected: sb $1,-100($2)
Error in assembly line 54 position 2: "li": Too many or incorrectly formatted operands. Expected: li $1,-100
Error in assembly line 55 position 2: "sb": Too many or incorrectly formatted operands. Expected: sb $1,-100($2)
Error in assembly line 56 position 2: "sb": Too many or incorrectly formatted operands. Expected: sb $1,-100($2)
Error in assembly line 58 position 2: "li": Too many or incorrectly formatted operands. Expected: li $1,-100
Error in assembly line 64 position 2: "li": Too many or incorrectly formatted operands. Expected: li $1,-100
Error in assembly line 70 position 1: "addi" is an instruction name and cannot be used as a label
Error in assembly line 70 position 1: "addi": Too few or incorrectly formatted operands. Expected: addi $1,$2,-100
Error in assembly line 72 position 1: "li$t1" directive cannot appear in text segment
Error in assembly line 118 position 18: ""Robot final location X: "" directive cannot appear in text segment
Error in assembly line 120 position 1: "robot_x" directive cannot appear in text segment
Error in assembly line 122 position 1: "MsgY." directive cannot appear in text segment
Error in assembly line 123 position 1: "print" directive cannot appear in text segment
Error in assembly line 125 position 1: "robot_y" directive cannot appear in text segment
Error in assembly line 126 position 1: ""\n"" directive cannot appear in text segment
Assemble: operation completed with errors.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.