; Write a program that swaps 5th~11th bits in data_a with 25th~31th bits in data_b
; Your program must work for any data given, not just the example below
; In this question, we assmue that the positions of bits count from right to left.
; That is, the first bit is the least significant bit.
Copyright By PowCoder代写 加微信 powcoder
; **** The first bit is 0th bit (lest significant bit) ****
data_a DCD 0x77FFD1D1
data_b DCD 0x12345678
; Write a program that finds the minimum value stored in my_numbers
; Each number occupies 1 word in the memory.
; Assume there are always 5 elements in my_numbers
; The result must be stored in R8
my_numbers DCD 0x77, 0x6, 0x5A, 0xFFFFFFFF, 0xF000001A
; *** Numbers are signed ***
; given two arrays of 5 numbers stored in data_a and data_b.
; write a program that zips these two arrays and store the result in data_c.
; Zip means the first element of data_a is appended to data_c first,
; then followed by the first element of data_b,
; then followed by the second element of data_a,
; then followed by the second element of data_b
; … until all numbers are added into data_c
; In the example below, the result in data_c should be
; 11, 21, 12, 22, 13, 23, 14, 24, 15, 25
data_a DCD 11, 12, 13, 14, 15
data_b DCD 21, 22, 23, 24, 25
data_c FILL ??? ; please determine the size needed for data_c
; implement a small program that parses a string stored in “my_number” into an integer (decimal number):
; “555” -> 555;
; The integer result should be stored in R8
; ‘5’ in ASCII code is represented by 0x35, the example below is “555”
my_number DCD 0x00353535
; *** No negative numbers, my_number will be limited to 1 word long. ***
; In this task, we will implement the repeated subtraction method of square roots
; The method relies on the following sequence of steps:
; Step 1: Subtract consecutive odd numbers from the number for which we are finding the square root.
; Step 2: Repeat step 1 until a value of 0 is attained.
; Step 3: The number of times step 1 is repeated is the required square root of the given number.
; For instance, for the number 16, the method works as follows:
; 16 – 1 = 15
; 15 – 3 = 12
; 12 – 5 = 7
; 7 – 7 = 0
; The process is repeated 4 times. Thus,√16 = 4.
; Note that this method can be used only for perfect squares. (like 9, 16, 25 etc.)
; As a result, your work will be evaluated based on perfect squares only.
; The register r7 stores a number that we want to find the square root of.
; The result of the square root should be stored in r8.
mov r7, #16
; We consider an array of strings stored in my_data.
; Each string ends with a “line feed” character (please search for it in the ASCII table online)
; The end of the whole array is signified by the “NULL” character (also mentioned in the ASCII table)
; Your task: replace all occurrences of “mug” that appear in the middle of a string with “cup”.
; For example, “My beloved mug” and “Mug falls on the ground” should not be replaced,
; but “There’s a mug on my desk” or “abcmugcba” should be replaced.
; The search should be case insensitive, meaning that “Mug”, “mUg” and “MUG” should all be replaced with “cup” (lower case)
; The final result must be written back to my_data.
; You should also indicate how many strings does my_data contain in R8
; Failing to do so results in mark deduction
; In this current “my_data”, it stores the two strings:
; M y b e l o v e d m u g LF a b c m u g c b a LF NULL
; 4d 79 20 62 65 6c 6f 76 65 64 20 6d 75 67 0A 61 62 63 6d 75 67 63 62 61 0A 00
; you program must work for any valid data created
my_data DCD 0x4d792062, 0x656c6f76, 0x6564206d, 0x75670A61, 0x62636d75, 0x67636261, 0x0A000000
; Assume that there are two IEEE-754 single precision floating point numbers stored in my_data.
; Calculate the sum of these two numbers and store it in R8
; Your program’s results should be same as/similar to what happens in real C/Java programs.
; Suggestion: write functions that can extract the sign bit, mantissa and exponent
; numbers will not lead to overflow. Your program does not need to consider overflow..
my_data DCD 0xC0350000, 0x40310000
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com