Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6733853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:49:09+00:00 2026-05-26T10:49:09+00:00

We are using ARM200 to learn assembly language. I have a portion of memory

  • 0

We are using ARM200 to learn assembly language. I have a portion of memory with 32 integers filling it. I need to be able to print out these 32 integers to the screen. I can print out numbers 0 – 9 easy enough just by adding the ASCII value of the number 0 to what is in the register, but I’m very confused how you print out numbers greater then 9.

Print   LDR     r5, [r2]        ;load whats in that part of memory to r5.
        CMP     r5, #9      ;compare if number is greater or less then 9
       ADDLE    r0, r5, #"0"    ;add value in array to ascii value of 0 to print
       SWI  SWI_WriteC  ;Print Value    
       ADD  r6, r6, #1  ;increment counter
       ADD  r2, r2, #4  ;move portion of memory to the next int.
       CMP  r6, #32     ;check if you are done printing 32 ints
       BNE  Print       ;if not loop back up to print
       MOV  pc, r14     ;return

r0 is the register used for printing and r2 points to the location in memory for all the integers. r5 is what i put the value from memory into and r6 is used for a counter.
Yes i do realize that there is 4 bytes of space in between each number in memory, but this does not matter for this project.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T10:49:09+00:00Added an answer on May 26, 2026 at 10:49 am

    Since you’re learning (ie, possible homework), I’ll give general advice only.

    Let’s say you have the number 247 and you wanted to print out the three digits of it, one by one.

    How can you get the hundreds digit 2 from 247 and leave 47 for the next iteration?

    Put that value into a temporary variable and set a counter to zero. Then, while the temp value is greater than 99, subtract 100 from it and add 1 to the counter.

    This will give you a counter of 2 and a temp value of 47. Use the 2 to output your digit (you state you can already do this).

    Now move on to tens.

    Set the counter back to zero.

    Then, while the temp value is greater than 9, subtract 10 from it and add 1 to the counter.

    This will give you a counter of 4 and a temp value of 7. Use the 4 to output your digit.

    Finally, units.

    Use the final remainder 7 to output the last digit.


    Here’s some assembler-like pseudo-code I used in another answer (slightly modified) to do a similar thing.

        val = 247
    
        units = val
        tens = 0
        hundreds = 0
    loop1:
        if units < 100 goto loop2
        units = units - 100
        hundreds = hundreds + 1
        goto loop1
    loop2:
        if units < 10 goto done
        units = units - 10
        tens = tens + 1
        goto loop2
    done:
        if hundreds > 0:                 # Don't print leading zeroes.
            output hundreds
        if hundreds > 0 or tens > 0:
            output tens
        output units
        ;; hundreds = 2, tens = 4, units = 7.
    

    And one other thing, all this stuff needs to go into subroutines so that you can re-use them. Having thirty-two copies of that algorithm above converted to assembly would be a very tedious piece of code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

using VB.Net2010 I need to call a C# DLL The problem I have is
Using online interfaces to a version control system is a nice way to have
Using C# .NET 3.5 and WCF, I'm trying to write out some of the
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
Using C#, I need a class called User that has a username, password, active
Using android 2.3.3, I have a background Service which has a socket connection. There's
Using jQuery, one can easily find out whether a particular element is visible using
Using MVC2 I have an AJAX form which is posting to a bound model.
using a binary search tree I need to add to a vector all int
Using Core Data, I have a fetch request to fetch the minimum of a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.