Actions

EmSys

ARM ASM Program Template

From EdWiki

  1. /************************************************************************
  2.   *									*
  3.   *            Template File for Assembly Language Programs             *
  4.   *									*
  5.   ***********************************************************************
  6. */
  7.  
  8. /*
  9.   This file is meant to be used as a template (in other words, a starting
  10.   point) for any ARM assembly language programs that you write.  Modify it
  11.   to suit your needs.
  12.  
  13.   Ideally, every assembly language program module should be well-documented,
  14.   preferably with a high-level (pseudo-code) version included in the initial
  15.   comments.
  16. */
  17.  
  18. # -----------------------------------------------------------------------
  19. # Constant values
  20.  
  21.  
  22. # -----------------------------------------------------------------------
  23. # Global pre-initialised variables and string constants
  24.  
  25. 	.data				@ Data segment follows
  26.  
  27.  
  28. # -----------------------------------------------------------------------
  29. # Assembly-language preamble for the main module
  30.  
  31. 	.text				@ Executable code follows
  32.  
  33. _start:	.global	_start			@ "_start" is required by the linker
  34. 	.global	main			@ "main" is our main program
  35.  
  36. 	b	main			@ Start running the main program
  37.  
  38.  
  39. # -----------------------------------------------------------------------
  40. # Start of the main program
  41.  
  42. main:					@ Entry to the function "main"
  43.  
  44.  
  45. # Insert your code here
  46.  
  47.  
  48. 	mov	pc,lr			@ Return to caller (end of "main")
  49.  
  50. # -----------------------------------------------------------------------
  51.  
  52. 	.end

ARM ASM Examples

  1. You can download sample ARM Assembly language programs here