Question: ARM ASSEMBLY- This program uses ideas from modules 4 and 5. You are going to write a program that converts a single byte value (an

ARM ASSEMBLY-

This program uses ideas from modules 4 and 5. You are going to write a program that converts a single byte value (an 8-bit integer) into a string of 8 0s and 1s which correspond to the binary for that integer. You are given some code in PA4-1.s to get you started. This code sets up your string result and the input value. Let the integer you are converting to a binary string be called n. Some guidance:You will write a loop that loops 8 times. Each time through the loop you will do the following:

Mask off (convert to 0s) all but the rightmost bit of n. This can be done by using an AND instruction with 0x00000001. Be careful not to destroy the other bits in n.

If the remaining bit is a 1 you need to store the value #49 (ASCII value for the 1 character) at your current position in the string. Otherwise, a 0, store #48 (ASCII 0) at the current string position. Be sure to store this value using STRB, which will store a single byte!

Subtract one from your string pointer register. Shift n to the right by 1

ARM ASSEMBLY- This program uses ideas from modules 4 and 5. You

1 Starter code for PA 4-1 our header commen er e 4 result DCB DCB 131 in va 6 7 code R0, -inval Re, [Re] L DR L DRB L DR ADD ; Address of inval in Re ; value of inval in Re ; address of result in R1 ; address of last char in R1 R1, R1, #7 12 Your code begins here

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!