document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. /*
  2.  * Sample crt0.S startup file.
  3.  *
  4.  * IMPORTANT: THIS FILE NEEDS A LINKER SCRIPT WHICH DEFINES THE NEEDED
  5.  *            SYMBOLS __s_bss, __e_bss, __s_data, __e_data, __e_text
  6.  */
  7.  
  8.         .text
  9.        
  10.  
  11. /*
  12.  *  This is the reset code.
  13.  *  It copies the startup data into the RAM (.data section)
  14.  *  and clears the bss.
  15.  */
  16.         .globl  ___main
  17. startup:
  18. ___main:    lea.l   __s_bss,%a0 /* Clear bss */
  19.         move.l  #__e_bss,%d0
  20. 1:      cmp.l   %d0,%a0
  21.         beq.s   2f
  22.         clr.b   (%a0)+
  23.         bra.s   1b
  24. 2:
  25.         lea.l   __e_text,%a0    /* Move data to ram */
  26.         lea.l   __s_data,%a1
  27.         move.l  #__e_data,%d0
  28. 1:      cmp.l   %a1,%d0
  29.         beq.s   2f
  30.         move.b  (%a0)+,(%a1)+
  31.         bra.s   1b
  32. 2:
  33.         clr.l   -(%sp)      /* **envp is null     */
  34.         clr.l   -(%sp)      /* **argv is null     */
  35.         clr.l   -(%sp)      /* argc is zero, too  */
  36.         jsr _main       /* Call the C-program */
  37.         lea 12(%sp),%sp /* Clean up the stack 3*4 */
  38. /*
  39.  * main usually should not return. If it does anyway, halt the system.
  40.  */
  41. halt:       bra halt
');