[444] | 1 | ##============================================================================== |
---|
| 2 | ## |
---|
| 3 | ## crt0.S |
---|
| 4 | ## |
---|
| 5 | ## MN10200 startup code |
---|
| 6 | ## |
---|
| 7 | ##============================================================================== |
---|
| 8 | ## |
---|
| 9 | ## Copyright (c) 1995, 1996, 1997, 1998 Cygnus Solutions |
---|
| 10 | ## |
---|
| 11 | ## The authors hereby grant permission to use, copy, modify, distribute, |
---|
| 12 | ## and license this software and its documentation for any purpose, provided |
---|
| 13 | ## that existing copyright notices are retained in all copies and that this |
---|
| 14 | ## notice is included verbatim in any distributions. No written agreement, |
---|
| 15 | ## license, or royalty fee is required for any of the authorized uses. |
---|
| 16 | ## Modifications to this software may be copyrighted by their authors |
---|
| 17 | ## and need not follow the licensing terms described here, provided that |
---|
| 18 | ## the new terms are clearly indicated on the first page of each file where |
---|
| 19 | ## they apply. |
---|
| 20 | ## |
---|
| 21 | |
---|
| 22 | ##------------------------------------------------------------------------------ |
---|
| 23 | |
---|
| 24 | .file "crt0.S" |
---|
| 25 | |
---|
| 26 | ##------------------------------------------------------------------------------ |
---|
| 27 | ## Startup code |
---|
| 28 | .section .text |
---|
| 29 | .global _start |
---|
| 30 | _start: |
---|
| 31 | mov _stack,a3 # Load up the stack pointer and allocate |
---|
| 32 | # our current frame. |
---|
| 33 | |
---|
| 34 | mov _edata,a0 # Get the start/end of bss |
---|
| 35 | mov _end,a1 |
---|
| 36 | |
---|
| 37 | cmp a0,a1 # If no bss, then do nothing |
---|
| 38 | beqx .L0 |
---|
| 39 | |
---|
| 40 | sub d0,d0 # clear d0 |
---|
| 41 | |
---|
| 42 | .L1: |
---|
| 43 | movb d0,(a0) # Clear a byte and bump pointer |
---|
| 44 | add 1,a0 |
---|
| 45 | cmp a0,a1 |
---|
| 46 | bnex .L1 |
---|
| 47 | |
---|
| 48 | .L0: |
---|
| 49 | jsr ___main |
---|
| 50 | sub d0,d0 |
---|
| 51 | mov d0,d1 |
---|
| 52 | mov d0,(a3) |
---|
| 53 | jsr _main # Call main program |
---|
| 54 | jmp _exit # All done, no need to return or |
---|
| 55 | # deallocate our stack. |
---|
| 56 | |
---|
| 57 | .section .stack |
---|
| 58 | _stack: .long 1 |
---|