


ARM Macro Assembler    Page 1 


    1 00000000         ;ex5b_2400
    2 00000000         ***********************
                               version          1.6***********************
    3 00000000         ;remember to set /flash/linker/use memory layout from ta
                       rget dialog, otherwise it will not run
    4 00000000         ;and stack_pointer SP (r13) will not be set correctly.
    5 00000000         ;*******************************************************
                       ************
    6 00000000         ;test5b.s
    7 00000000         ;This programs shows how stack can be used to save regis
                       ter 
    8 00000000         ;values during nested subroutine calls
    9 00000000         ;each subroutine-call lowers the  stack pointer one leve
                       l (16 bytes in this is example)
   10 00000000         ;Exercise: Run the program using single step, observe th
                       e changes of the stack pointer (r13)
   11 00000000         ; and contents of the stack (RAM memory locations from a
                       ddress 0x0000 0408)
   12 00000000         
   13 00000000         ; declare variables   New test12D
   14 00000000                 AREA             |.data|, DATA, READWRITE
   15 00000000 00000000 
              00000000 
              00000000 
              00000000 
              00000000 
              00000000 
              00000000 
              00000000 
              00000000 
              00000000 Data1p  DCD              0, 0, 0, 0, 0, 0, 0, 0, 0, 0
   16 00000028                 align
   17 00000028         ;-------------------------------------------------------
                       ------
   18 00000028         
   19 00000028         ; User Initial Stack & Heap
   20 00000028                 AREA             |.text|, CODE, READONLY
   21 00000000         
   22 00000000                 EXPORT           __main
   23 00000000 E59F0068 
                       __main  LDR              R0, =Data1p
   24 00000004 E3A03000        mov              r3,#0
   25 00000008 E3A04000        mov              r4,#0
   26 0000000C E3A05000        mov              r5,#0
   27 00000010         
   28 00000010 E3A000A1 
                       loop    MOV              r0, #0xa1
   29 00000014 E3A010A2        MOV              r1, #0xa2
   30 00000018 E3A020A1        MOV              r2, #0xa1
   31 0000001C EB000000        BL               subroutine1
   32 00000020 EAFFFFFA        B                loop
   33 00000024         
   34 00000024         
   35 00000024         
   36 00000024 E82D4007 
                       subroutine1
                               STMED            r13!, {r0-r2,r14}
   37 00000028 E2833001        add              r3,#1
   38 0000002C E2844002        add              r4,#2



ARM Macro Assembler    Page 2 


   39 00000030 E2855003        add              r5,#3
   40 00000034 E1A00003        MOV              r0,r3
   41 00000038 E1A01004        MOV              r1,r4
   42 0000003C E1A02005        MOV              r2,r5
   43 00000040 EB000001        BL               subroutine2
   44 00000044 E9BD4007        LDMED            r13!,{r0-r2,r14}
   45 00000048         
   46 00000048 E12FFF1E        BX               LR
   47 0000004C         
   48 0000004C E82D4007 
                       subroutine2
                               STMED            r13!, {r0-r2,r14}
   49 00000050 E2833001        add              r3,#1
   50 00000054 E2844002        add              r4,#2
   51 00000058 E2855003        add              r5,#3
   52 0000005C E1A00003        MOV              r0,r3
   53 00000060 E1A01004        MOV              r1,r4
   54 00000064 E1A02005        MOV              r2,r5
   55 00000068 E9BD4007        LDMED            r13!,{r0-r2,r14}
   56 0000006C E12FFF1E        BX               LR
   57 00000070         
   58 00000070                 END
              00000000 
Command Line: --debug --xref --diag_suppress=9931 --apcs=interwork --depend=.\o
bjects\ex5b_2400s.d -o.\objects\ex5b_2400s.o -IC:\Keil_v5\ARM\RV31\INC -IC:\Kei
l_v5\ARM\CMSIS\Include -IC:\Keil_v5\ARM\Inc\Philips --predefine="__EVAL SETA 1"
 --predefine="__UVISION_VERSION SETA 520" --list=.\listings\ex5b_2400s.lst ex5b
_2400s.s



ARM Macro Assembler    Page 1 Alphabetic symbol ordering
Relocatable symbols

.data 00000000

Symbol: .data
   Definitions
      At line 14 in file ex5b_2400s.s
   Uses
      None
Comment: .data unused
Data1p 00000000

Symbol: Data1p
   Definitions
      At line 15 in file ex5b_2400s.s
   Uses
      At line 23 in file ex5b_2400s.s
Comment: Data1p used once
2 symbols



ARM Macro Assembler    Page 1 Alphabetic symbol ordering
Relocatable symbols

.text 00000000

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

Symbol: __main
   Definitions
      At line 23 in file ex5b_2400s.s
   Uses
      At line 22 in file ex5b_2400s.s
Comment: __main used once
loop 00000010

Symbol: loop
   Definitions
      At line 28 in file ex5b_2400s.s
   Uses
      At line 32 in file ex5b_2400s.s
Comment: loop used once
subroutine1 00000024

Symbol: subroutine1
   Definitions
      At line 36 in file ex5b_2400s.s
   Uses
      At line 31 in file ex5b_2400s.s
Comment: subroutine1 used once
subroutine2 0000004C

Symbol: subroutine2
   Definitions
      At line 48 in file ex5b_2400s.s
   Uses
      At line 43 in file ex5b_2400s.s
Comment: subroutine2 used once
5 symbols
341 symbols in table
