Good work. You will need some code to be included that will reset the flag (to 0) if the conditions are NOT met.
Some notes:
Code:
#Default instruction, load item value
lwz r31, 0x008C (r3)
#Set EVA Upper
lis r12, 0x8000
#Check for Star
cmpwi r31, 9
bne+ reset_flag
#Load Slot code is hooked on
lwz r3, 0x0 (r27)
lwz r3, 0x0 (r3)
lbz r3, 0x10 (r3)
#Check if slot is P1 thru P4 (0 thru 3)
cmplwi r3, 3
bgt+ reset_flag
#All conditions met, set flag
li r11, 1
b write_flag_value
#Reset flag
reset_flag:
li r11, 0
#Write Flag Value
write_flag_value:
stb r11, 0x165F (r12)
Some notes:
- The bne has a plus appended because it's more likely the item will NOT be a star
- The bgt has a plus appended because it's more likely the loaded slot value will be higher than 3
- The comparison for the slot value is done logically because slot values are never negative values. And whenever you are doing a comparison with a later bge/bgt/ble/blt branch, you should choose a logical comparison unless you know negative numbers are possible.