Reads characters from the input string one at a time. Valid characters are (0-9), (a-f), and (A-F). All other characters are invalid. For each valid character, use its position in the ASCII table to calculate a sutiable offset, such that the character code can be used to obtain the true numberic value of the digit.
Uses an efficient fast-divide alrogithm to get positional values of powers of 10. Since all input characters are hexedecimal, the aggregrate result can be found by multiplying each result by 4 and then adding the next result. Negative values are detected when (numberOf(symbols) == 8) $$ (MSB(symbol) >= 8). A flag is set if this occurs
The core assembly code is location in ascii_hex_to_signed_decimal.s
. main.s
contains scafolding generated by Keil uVision, which is the envionment the code was tested in.
Set the hexidecimal string in the data section near the end of the source file. The string is entered under the label hex_string
and must be null-terminated.