In this lab, you will be converting an ASCII string found in memory into its decimal equivalent. If the ASCII string contains values that do not correspond to hex ‘0’ through ‘F’, they should be skipped over. For example, if the string is “42s3t9”, 0x04020309 should be stored in memory as the final result. Your program should load the first byte of the ASCII code (corresponding to the first character in the string) into a register for analysis and store the binary equivalent in memory if it is valid. When analysis is complete, the program should load the next byte from memory. The ASCII string will be null terminated, and the program should end when it is reached. (Hint: use the simple relationship between the ASCII code and the hex equivalent to your advantage)Code Given:AREA asciiCode, DATA, READONLYASCII_STRING DCB "49b132",0 ;ASCII code stringAREA binary_form, DATA, READWRITEBINARY_FORM SPACE 20 ;area to store converted binary stringEND

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

EXPORT __main

LDR R1, =ASCII_STRING ;load starting address of the ascii string to R1
LDR R2, =BINARY_FORM ;load starting address of the binary form to R2

LDRB R3, [R1] ;load next character to R3
CMP R3, #0 ;check if the character is null (0 terminator)
BEQ STOP ;if 0 terminator found, branch to stop
CMP R3, #0x30 ;check if it is less than 0x30 (ascii '0')
BLT CONT ;if yes, skip it
CMP R3, #0x39 ;check if it is greater than 0x39 (ascii '9')
BGT CHECK_UP ;if yes, check further for uppercase letters...

By purchasing this solution you'll be able to access the following files:

for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Assembly Language Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats