Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

.data enterMove: .asciiz Enter a board position (0-8) to make move: youChose: .asciiz You chose: invalidMove: .asciiz Invalid move -

 .data enterMove: .asciiz " Enter a board position (0-8) to make move: " youChose: .asciiz " You chose: " invalidMove: .asciiz " Invalid move - try again. " CR: .byte ' # enable each one (turning off the other) to confirm your code works in both cases # gameBoard: .byte -1,0,-1,0,1,0,-1,1,-1 # pos 1, 3 and 5 are valid moves .code .globl main ########################################################################## # requestMove # # ToDo: # return $v0 = player's choice to move to that is valid # ########################################################################## requestMove: la $t0,gameBoard li $t1,0x00 # reset to starting index on game board li $v0,0xFF # convenience to say - hey not implemented # prompt player # read their choice (in $v0) # be sure it is less than 9 check: # your check logic here # You'll need to calcuate the address belonging # to the position the user entered. Then load # byte of that position. Then check that it is # currently empty - hence allowing the user to # choose it. If valid, return the position. # If invalid, do not return. Instead, tell the # user and have them try choosing again. done: jr $ra # return from function call ########################################################################## # MAIN ########################################################################## main: jal requestMove la $a0,youChose syscall $print_string move $a0,$v0 syscall $print_int lb $a0,CR syscall $print_char syscall $exit 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Current Trends In Database Technology Edbt 2004 Workshops Edbt 2004 Workshops Phd Datax Pim P2panddb And Clustweb Heraklion Crete Greece March 2004 Revised Selected Papers Lncs 3268

Authors: Wolfgang Lindner ,Marco Mesiti ,Can Turker ,Yannis Tzitzikas ,Athena Vakali

2005th Edition

3540233059, 978-3540233053

More Books

Students also viewed these Databases questions

Question

6. Have you used solid reasoning in your argument?

Answered: 1 week ago