ARM GAS  if2.s 			page 1


   1              	/* --------------------------------------------------
   2              	   Define required labels for EGTAPI
   3              	   -------------------------------------------------- */
   4              	        .global main, Stop, CodeEnd, DataStart, DataEnd
   5              	
   6              	/* --------------------------------------------------
   7              	   Begin of the program instructions
   8              	   -------------------------------------------------- */
   9              		.text
  10              	main:
  11              	
  12 0000 000000E3 		movw	r0, #:lower16:x
  13 0004 000040E3 		movt	r0, #:upper16:x		// r0 = addr(x)
  14 0008 001090E5 		ldr	r1, [r0]		// r1 = x
  15              	
  16 000c 002000E3 		movw	r2, #:lower16:y
  17 0010 002040E3 		movt	r2, #:upper16:y		// r2 = addr(y)
  18 0014 003092E5 		ldr	r3, [r2]		// r3 = y
  19              	
  20 0018 030051E1 		cmp	r1, r3			// Compare x ? y
  21 001c 010000DA 		ble	ifEnd			// Branch if  x <= y to ifEnd
  22              	
  23              		// Swap x and y because x > y
  24              	
  25 0020 001082E5 		str	r1, [r2]		// Store the x-copy in y (in memory)
  26 0024 003080E5 		str	r3, [r0]		// Store the y-copy in x (in memory)
  27              	
  28              	ifEnd:
  29              	
  30              	Stop:
  31              	CodeEnd:
  32 0028 0000A0E1 	    	nop
  33              	
  34              	/* --------------------------------------------------
  35              	   Begin of the permanent program variables
  36              	   -------------------------------------------------- */
  37              		.data
  38              	DataStart:
  39              	
  40 0000 09000000 	x:    .4byte   9	// x = 9   -- try a value smaller that 4
  41 0004 04000000 	y:    .4byte   4	// y = 4
  42              	
  43              	DataEnd:
  44              	
  45              		.end
ARM GAS  if2.s 			page 2


DEFINED SYMBOLS
               if2.s:10     .text:0000000000000000 main
               if2.s:30     .text:0000000000000028 Stop
               if2.s:31     .text:0000000000000028 CodeEnd
               if2.s:38     .data:0000000000000000 DataStart
               if2.s:43     .data:0000000000000008 DataEnd
               if2.s:40     .data:0000000000000000 x
               if2.s:12     .text:0000000000000000 $a
               if2.s:41     .data:0000000000000004 y
               if2.s:28     .text:0000000000000028 ifEnd

NO UNDEFINED SYMBOLS
