I have to write two programs in assembly for class and I was just wondering whether you guys could help me understand what's being asked of me / any general tips on how to go about it.
The first problem reads:
Write your own routine to convert an integer into a hexadecimal ascii string placing the result into a sequence of eight characters in a buffer. When your routine is called, $a0 will contain the number to format, $a1 will contain a pointer to the location in memory where the ASCII representation is to be placed, because hexadecimals digits correspond to groups of four binary digits, you can generate the digits from left to right. Don't worry about negative values. You can convert individual decimal digits to the corresponding ASCII charcter by adding the value of an ASCII zero character (0x30 or '0) to the integer digit.
I bolded the sections I'm confused on. Can anyone explain to me how a point works exactly & how I would go about utilizing it in this situation? And is the second bolded part literally just telling me how to convert decimals to hex? Meaning to convert, my code would look something like:
add $a1,$a0, '0
Write a general purpose routine to format integers into a string buffer in any number base between 2 and 36. $a0 should contain the number to format, $a1 a pointer to the string buffer, $a2 the base between 2 and 36 to use for this conversion and $a3 the size of the buffer including the terminal nul. You will need to generate the digits from right to left, using division by the base with the remainder giving the next digit, while the quotient holds the balance of the number. When the quotient returns zero, it will signal the end of the loop. Space fill any remaining locations in the buffer. Negative numbers should be handled by placing a minus sign to the left of the most significant digit. To handle negative numbers, you will need to take the absolute value of the remainders, while retaining a copy of the original number to hold the sign. Should the number not fit into the supplied buffer, fill the buffer with # character.
This one I'm honestly confused about the overall question and what it's asking of from me. Again the bolded parts here emphasize the parts I'm especially stuck on.
Thanks in advance for any help you can offer! I'm using MIPSym btw, if that's necessary info.