Skip to content

Converts a hexadecimal string to a decimal value in ARM Assembly.

Notifications You must be signed in to change notification settings

GrimzEcho/assembly_hex_to_decimal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Ascii Hexedecimal to Signed Decimal - ARM Cortex M5 - Assembly

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

Usage

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.

About

Converts a hexadecimal string to a decimal value in ARM Assembly.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published