Parsing a string in MIPS

I am writing a program in Mips that gives this asciiz: .asciiz "7A23232" line. Each character in a line corresponds to a card from a deck of cards. I need to check two kinds and three kinds. How to check every single character in String. I am looking for something similar to Java charAt ().

+4
source share
1 answer

I will not give the code here because I do not have the MIPS compiler, and you do not want to mislead you, but the nuts and bolts of what you need to do is read each character from line to register 1 at a time, then scroll through the remaining characters by checking / comparing them to see if they match the current character value. If so, add another register, which is a pair counter. Depending on what you need to return, you can either immediately return to the match or set up a different register to save the best character and the best match. Honestly, for something like this, you might need to write it in a low-level language such as C to start by understanding where the loops and locals are, and then transform it.

+3
source

Source: https://habr.com/ru/post/1380264/


All Articles