Question: Complete an ARM assembly program that will copy a block of data from one location to another one word at a time. For this program,

Complete an ARM assembly program that will copy a block of data from one location to another one word at a time. For this program, you must:

  • Use all pointers
    • You will be reading and/or writing each of the variables these pointers point to
  • Copy each word-sized integer, except negative numbers, from the source block array (SBLK) to the destination block array (DBLK)
  • Stop the transfer when SBLKENDPTR (source block end pointer) is reached
    • Note: The placement of the SBLKPTR and SBLKENDPTR is very similar to the placement of iterators for a vector in C++
  • Count the number of negative values in the source array (the number of integers that were not copied)
    • The final count should be stored in the NUMNEG (number negative) variable
  • Count the total number of values (zero and positive values) transferred
    • The final count needs to be stored in the TOTAL variable
  • Use at least one loop using conditional branch command(s)

What the results in memory should look like after correct execution:

Note: The exact address of the variables and arrays may be different, however, they must be RAM addresses (declared in the .data section)

Complete an ARM assembly program that will copy a block of data

I'm working on ARM MSP432 assembly this is my code so far

.thumb

.data NUMNEG .word 0 TOTAL .word 0 SBLK .word 1,126,-8,-63,44,-115,28 ; Source block (initialized) SBLKEND .word -1 ; Source block end DBLK .usect ".bss",2,2 ; Destination block (uninitialized)

.text SBLKPTR .word SBLK ; Pointer to beginning of Source Block SBLKENDPTR .word SBLKEND ; Pointer to ending of Source Block DBLKPTR .word DBLK ; Pointer to beginning of Destination Block NUMNEGPTR .word NUMNEG ; Pointer to NUMNEG TOTALPTR .word TOTAL ; Pointer to TOTAL

.global main .thumbfunc main

main: .asmfunc ; ASM main

ldr r1, SBLKPTR ldr r2, SBLKENDPTR ldr r3, DBLKPTR ldr r4, NUMNEGPTR ldr r4, TOTALPTR mov r6, #0

NUMNEGPTR TOTALPTR + Ox2000.0000 0x2000.0004 4 Copy from the source block array to the destination block array (but do not copy negative numbers-skip these) Source Block (SBLK): SBLKPTR 126 Destination Block (DBLK): DBLKPTR Ox2000.0040 Ox2000.0044 0x2000.0048 0x2000.004C 126 - 44 Ox2000.0008 Ox2000.000C Ox2000.0010 Ox2000.0014 Ox2000.0018 Ox2000.001C Ox2000.0020 0x2000.0024 28 -63 44 -115 28 XX SBLKENDPTR NUMNEGPTR TOTALPTR + Ox2000.0000 0x2000.0004 4 Copy from the source block array to the destination block array (but do not copy negative numbers-skip these) Source Block (SBLK): SBLKPTR 126 Destination Block (DBLK): DBLKPTR Ox2000.0040 Ox2000.0044 0x2000.0048 0x2000.004C 126 - 44 Ox2000.0008 Ox2000.000C Ox2000.0010 Ox2000.0014 Ox2000.0018 Ox2000.001C Ox2000.0020 0x2000.0024 28 -63 44 -115 28 XX SBLKENDPTR

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!