Question: The code displayed in Figure 1 implements a program that sets the content of a memory array with a sequence of values. This program is

The code displayed in Figure 1 implements a program that sets the content of a memory array with a sequence of values. This program is useful for initializing the memory with specific values. Figure 2 shows the assembled program in the ARMSim simulator. Try to simulate the program in your mind instruction by instruction and answer the questions below. You can also download the program at

iLearn -> References -> ARMSim -> A2.s and simulate it in ARMSim to verify your answer.

11 12 13 14 15 22288285855 21 16 17 18 19 20

loop: 23 24 8------Assembler Directives-- Data Variables 26 .DATA Values: .WORD 0x11,

11 12 13 14 15 22288285855 21 16 17 18 19 20 loop: 23 24 8------Assembler Directives-- Data Variables 26 .DATA Values: .WORD 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 8 the values to be stored in the memory array .EQU M, 0x00002000 M is the beginning address of the memory array 8 Code .TEXT ------End of Assembler Directives-- Start: LDR R1, -M LDR RO, Values MOV R3, #6 8R3 is a parameter which holds the value of the number of entries in the memory array BL men set @branch to subroutine mem_set to set the content of the memory array SWI 0x11 @stop program execution 8 set the content of the memory array @clear R4 MOV RA, #0 LDR R2, [RO], #4 STR R2, [R1], # ADDS R4, R1, #1 CMP R4, R3 BMI loop BX LR A2. 00001034: 00001014: Assembler Directives Data Variables .DATA Values: WORD 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 EQU M, 0x00002000 00001000:E3A01A02 Start: LDR R1, M 00001004:E59F0024 LDR 00001008:E3A03006 MOV 0000100C:EB000000 00001010:EF000011 00001024:E1540003 00001028:4AFFFFFA 0000102C:E12FFF1E Code .TEXT End of Assembler Directives-- BL SWI mem_set: 00001014:E3A04000 MOV 00001018:E4902004 loop: LDR 0000101C:E4812004 00001020:2944001 STR ADDS CMP BMI BX RO, -Values R3, #6 mem_set 0x11 R4, #0 R2, [RO], #4 R2, [R1], #4 R4, R4, #1 R4, R3 loop LR the values to be stored in the memory array M is the beginning address of the memory array @R3 is a parameter which holds the value of the number of entries in the memory array branch to subroutine mem_set to set the content of the memory array stop program execution @set the content of the memory array @clear R4

Step by Step Solution

3.34 Rating (148 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To simulate the program instruction by instruction lets go through the code stepbystep Setup 1 LDR R... View full answer

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

Document Format (2 attachments)

PDF file Icon

609474f86157c_24865.pdf

180 KBs PDF File

Word file Icon

609474f86157c_24865.docx

120 KBs Word File

Students Have Also Explored These Related Programming Questions!