


ARM Macro Assembler    Page 1 


    1 00000000         ;ex4_2400 exercises for chapter 4 of  CENG2400. It is fo
                       r your own revision purpose,no need to submit answers to
                        tutors.
    2 00000000         ;1) create a project based on this .s code
    3 00000000         ;2) In keil-ide, use project/rebuild all target files to
                        build the project
    4 00000000         ;3) use Debug/run_to_cursor_line to run the top line of 
                       the program, 
    5 00000000         ;4)  use the single step mode to view the memory locatio
                       ns (in DEbug mode/view/memory_wndows)from 0x4000000 to 0
                       x40000013, registers and cpsr after the execution of eac
                       h statement.
    6 00000000         ;5) Explain the observations and results.
    7 00000000         
    8 00000000         
    9 00000000         ; declare variables   New test12D
   10 00000000                 AREA             |.data|, DATA, READWRITE
   11 00000000 00000001 
              00000001 
              00000001 
              00000001 
              00000001 
              00000001 
              00000001 
              00000001 
              00000001 
              00000001 Table1  DCD              0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0
x1, 0x1 ,0x1, 0x1
   12 00000028 00000001 
              00000001 
              00000001 
              00000001 
              00000001 
              00000001 
              00000001 
              00000001 
              00000001 
              00000001 Table2  DCD              0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0
x1, 0x1 ,0x1, 0x1
   13 00000050                 align
   14 00000050         ;-------------------------------------------------------
                       ------
   15 00000050         
   16 00000050         ; User Initial Stack & Heap
   17 00000050         
   18 00000050                 AREA             |.text|, CODE, READONLY
   19 00000000         
   20 00000000                 EXPORT           __main
   21 00000000         __main
   22 00000000         ;clear flags
   23 00000000         
   24 00000000         memory_init                          ; set the memory co
                                                            ntent in table1
   25 00000000 E59F10E4        LDR              r1, =Table1
   26 00000004 E59F20E4        LDR              r2, =Table2
   27 00000008 E3A03000        MOV              r3,#0
   28 0000000C E3A00000        MOV              r0,#0x00
   29 00000010 E2800011 
                       loop    ADD              r0,r0,#0x11



ARM Macro Assembler    Page 2 


   30 00000014 E5810000        STR              r0,[r1]
   31 00000018 E2811004        ADD              r1,r1,#4
   32 0000001C E2833001        ADD              r3,r3,#1
   33 00000020 E353000A        CMP              r3,#10
   34 00000024 1AFFFFF9        BNE              loop
   35 00000028 E1A00000        NOP
   36 0000002C E1A00000        NOP
   37 00000030         
   38 00000030         
   39 00000030         
   40 00000030         ex4_1                                ;;;;;;;;;;;;;;;;;;;
                                                            ;;;;;;;;;;;;;;;
   41 00000030 EB000024        BL               memory_reset
   42 00000034 E59F10B0        LDR              r1,=Table1
   43 00000038 E59F20B0        LDR              r2,=Table2
   44 0000003C E5910000        LDR              r0, [r1]
   45 00000040 E5820000        STR              r0, [r2]
   46 00000044 E1A00000        NOP
   47 00000048 E1A00000        NOP
   48 0000004C         
   49 0000004C         
   50 0000004C         ex4_2                                ;;;;;;;;;;;;;;;;;;;
                                                            ;;;;;;;;;;;;;;;
   51 0000004C EB00001D        BL               memory_reset
   52 00000050 E59F1094        LDR              r1,=Table1
   53 00000054 E59F2094        LDR              r2,=Table2
   54 00000058 E3A03000        MOV              r3, #0
   55 0000005C E5910000 
                       loop1   LDR              r0,[r1]
   56 00000060 E5820000        STR              r0,[r2]
   57 00000064 E2811004        ADD              r1,r1,#4
   58 00000068 E2822004        ADD              r2,r2,#4
   59 0000006C E2833001        ADD              r3,r3,#1
   60 00000070 E3530005        CMP              r3,#5
   61 00000074 1AFFFFF8        BNE              loop1
   62 00000078 E1A00000        NOP
   63 0000007C E1A00000        NOP
   64 00000080         
   65 00000080         ex4_3                                ;;;;;;;;
   66 00000080 EB000010        BL               memory_reset
   67 00000084 E59F1060        LDR              r1,=Table1
   68 00000088 E59F2060        LDR              r2,=Table2
   69 0000008C E5910000        LDR              r0,[r1]
   70 00000090 E5820000        STR              r0,[r2]
   71 00000094 E5910004        LDR              r0,[r1,#4]
   72 00000098 E5820004        STR              r0,[r2,#4]
   73 0000009C E1A00000        NOP
   74 000000A0 E1A00000        NOP
   75 000000A4         
   76 000000A4         ex4_4                                ;;;;;;;;
   77 000000A4 EB000007        BL               memory_reset
   78 000000A8 E59F103C        LDR              r1,=Table1
   79 000000AC E59F203C        LDR              r2,=Table2
   80 000000B0 E5910000        LDR              r0,[r1]
   81 000000B4 E5820000        STR              r0,[r2]
   82 000000B8 E5B10004        LDR              r0,[r1,#4]!
   83 000000BC E5A20004        STR              r0,[r2,#4]!
   84 000000C0 E1A00000        NOP
   85 000000C4 E1A00000        NOP



ARM Macro Assembler    Page 3 


   86 000000C8         
   87 000000C8         memory_reset                         ; reset the content
                                                             in table2 to be al
                                                            l 0
   88 000000C8 E59F5020        LDR              r5,=Table2
   89 000000CC E3A06000        MOV              r6,#0
   90 000000D0 E3A07000        MOV              r7,#0
   91 000000D4 E5856000 
                       loop2   STR              r6,[r5]
   92 000000D8 E2855004        ADD              r5,r5,#4
   93 000000DC E2877001        ADD              r7,r7,#1
   94 000000E0 E357000A        CMP              r7,#10
   95 000000E4 1AFFFFFA        BNE              loop2
   96 000000E8 E12FFF1E        BX               LR
   97 000000EC         
   98 000000EC                 END
              00000000 
              00000000 
Command Line: --debug --xref --diag_suppress=9931 --apcs=interwork --depend=.\o
bjects\ex4_2400s.d -o.\objects\ex4_2400s.o -IC:\Keil_v5\ARM\RV31\INC -IC:\Keil_
v5\ARM\CMSIS\Include -IC:\Keil_v5\ARM\Inc\Philips --predefine="__EVAL SETA 1" -
-predefine="__UVISION_VERSION SETA 520" --list=.\listings\ex4_2400s.lst ex4_240
0s.s



ARM Macro Assembler    Page 1 Alphabetic symbol ordering
Relocatable symbols

.data 00000000

Symbol: .data
   Definitions
      At line 10 in file ex4_2400s.s
   Uses
      None
Comment: .data unused
Table1 00000000

Symbol: Table1
   Definitions
      At line 11 in file ex4_2400s.s
   Uses
      At line 25 in file ex4_2400s.s
      At line 42 in file ex4_2400s.s
      At line 52 in file ex4_2400s.s
      At line 67 in file ex4_2400s.s
      At line 78 in file ex4_2400s.s

Table2 00000028

Symbol: Table2
   Definitions
      At line 12 in file ex4_2400s.s
   Uses
      At line 26 in file ex4_2400s.s
      At line 43 in file ex4_2400s.s
      At line 53 in file ex4_2400s.s
      At line 68 in file ex4_2400s.s
      At line 79 in file ex4_2400s.s
      At line 88 in file ex4_2400s.s

3 symbols



ARM Macro Assembler    Page 1 Alphabetic symbol ordering
Relocatable symbols

.text 00000000

Symbol: .text
   Definitions
      At line 18 in file ex4_2400s.s
   Uses
      None
Comment: .text unused
__main 00000000

Symbol: __main
   Definitions
      At line 21 in file ex4_2400s.s
   Uses
      At line 20 in file ex4_2400s.s
Comment: __main used once
ex4_1 00000030

Symbol: ex4_1
   Definitions
      At line 40 in file ex4_2400s.s
   Uses
      None
Comment: ex4_1 unused
ex4_2 0000004C

Symbol: ex4_2
   Definitions
      At line 50 in file ex4_2400s.s
   Uses
      None
Comment: ex4_2 unused
ex4_3 00000080

Symbol: ex4_3
   Definitions
      At line 65 in file ex4_2400s.s
   Uses
      None
Comment: ex4_3 unused
ex4_4 000000A4

Symbol: ex4_4
   Definitions
      At line 76 in file ex4_2400s.s
   Uses
      None
Comment: ex4_4 unused
loop 00000010

Symbol: loop
   Definitions
      At line 29 in file ex4_2400s.s
   Uses
      At line 34 in file ex4_2400s.s
Comment: loop used once
loop1 0000005C

Symbol: loop1



ARM Macro Assembler    Page 2 Alphabetic symbol ordering
Relocatable symbols

   Definitions
      At line 55 in file ex4_2400s.s
   Uses
      At line 61 in file ex4_2400s.s
Comment: loop1 used once
loop2 000000D4

Symbol: loop2
   Definitions
      At line 91 in file ex4_2400s.s
   Uses
      At line 95 in file ex4_2400s.s
Comment: loop2 used once
memory_init 00000000

Symbol: memory_init
   Definitions
      At line 24 in file ex4_2400s.s
   Uses
      None
Comment: memory_init unused
memory_reset 000000C8

Symbol: memory_reset
   Definitions
      At line 87 in file ex4_2400s.s
   Uses
      At line 41 in file ex4_2400s.s
      At line 51 in file ex4_2400s.s
      At line 66 in file ex4_2400s.s
      At line 77 in file ex4_2400s.s

11 symbols
348 symbols in table
