3 welcome: .asciiz "Bienvenue dans le jeu de Mastermind.\nUne sequence de quatre chiffres de 1 à 8 a ete générée.\nA vous de la deviner !"
4 play: .asciiz "Commencer à jouer:"
5 lost_msg: .asciiz "Vous avez perdu !"
6 win_msg: .asciiz "Vous avez gagné !"
7 temp_msg: .asciiz " bien placé"
8 exclamation_point: .asciiz "! "
9 interrogation_point: .asciiz "? "
16 compare_buffer: .space 5
17 input_value: .byte 0:5
18 guess_value: .byte 0:5
24 # show intro and rules
48 addi $a0, $a0, 1 # Put the integer into the [1-8] range
55 addi $a0, $a0, 1 # Put the integer into the [1-8] range
62 addi $a0, $a0, 1 # Put the integer into the [1-8] range
69 addi $a0, $a0, 1 # Put the integer into the [1-8] range
73 generate_sequence_loop_end:
75 la $s0, ($zero) # Initialize loop counter to zero
76 la $s1, compare_buffer
79 # ask user for the next input
88 la $a0, interrogation_point
92 la $a0, input_value # Store the answer
94 li $v0, 8 # Load syscall read_string
95 syscall # Make the syscall
97 # check that each input values are in the right range
102 andi $t5, $t5, 0x0F # ASCII code to integer
103 beq $t5, $zero, input
108 andi $t5, $t5, 0x0F # ASCII code to integer
109 beq $t5, $zero, input
114 andi $t5, $t5, 0x0F # ASCII code to integer
115 beq $t5, $zero, input
120 andi $t5, $t5, 0x0F # ASCII code to integer
121 beq $t5, $zero, input
125 la $s2, ($zero) # Same counter
135 andi $t0, $t0, 0x0F # ASCII code to integer
145 andi $t0, $t0, 0x0F # ASCII code to integer
155 andi $t0, $t0, 0x0F # ASCII code to integer
165 andi $t0, $t0, 0x0F # ASCII code to integer
184 la $a0, exclamation_point