MIPS assignment question for arrays

Working with MIPS in college, never seen this before. Last assignment worked out well, this one is a tic tac toe game with arrays. I used my previous working code to start this one, and pseudocode to frame what I need. First question, is this how to initialize the array? Second, can I split up the elements and read them as 3 rows of 3 for all of my win condition flagging?

Thanks in advance.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
  .data

array1:	.space 36 	# 9 integer possible * 4 bytes
msg1: 	.asciiz "X player: Please enter row/col, one per line:\n"
msg2:	.asciiz "O player: Please enter row/col, one per line:\n"
msg3:	.asciiz "X is already in row "
msg4:	.asciiz "O is already in row "
msg5: 	.asciiz "col "
msg6: 	.asciiz "_"
msg7:	.asciiz "X"
msg8: 	.asciiz "O"
msg9:   .asciiz "X won the game, exiting."
msg10:  .asciiz "O won the game, exiting."
newline:.asciiz "\n"

	.text
	.globl main
main:
	
# FUNCTION Initialize board of 3 arrays
	addiu	$sp,$sp,-8
	sw		$ra,4($sp)
	sw 		$s0,($sp)
	li 		$v0,5		# outputs command to player, X goes first
	la 		$a0,_msg1
	syscall
	la 		$t0,array1 		# put address of array1 into $t0
	li 		$s0,0   		# init counter to zero
	syscall
	la 		$t0,array2 		# put address of array1 into $t0
	li 		$s1,0   		# init counter to zero
	syscall
	la 		$t0,array3 		# put address of array1 into $t0
	li 		$s2,0   		# init counter to zero

# FUNCTION 



	# read the value
	li 		$


	# exit 
	lw 		$ra,4($sp)
	lw 		$s0,($sp)
	addiu 	$sp,$p,8
	jr 		$ra 
Topic archived. No new replies allowed.