📄 crt0.s
字号:
/* Copyright 2001-2004 Georges Menie (www.menie.org) This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA*/ .title "crt0.S for m68k" .extern main .extern __stack .extern __text_end .extern __data_start .extern __data_end .extern __bss_start .extern __bss_end .text /* the goram command needs the start and stack addresses * at the beginning of the text segment */ .long start .long __stack .global startstart: /* initialize the stack */ move.l #__stack, %a0 move.l %a0, %sp /* initialize the data section */ lea.l __text_end,%a0 lea.l __data_start,%a1 lea.l __data_end,%a21: cmpa.l %a1,%a2 jbeq 1f move.l (%a0)+,(%a1)+ jbra 1b2: /* initialize the bss section */ lea.l __bss_start,%a0 lea.l __bss_end,%a11: cmpa.l %a0,%a1 jbeq 2f move.l #0,(%a0)+ jbra 1b2: /* * call the main routine from the application to get it going. * main (argc, argv, environ) * we pass argv as a pointer to NULL. */ pea 0 pea environ pea %sp@(4) pea 0 jsr main move.l %d0, %sp@-/* * Define exit to a jump to the board monitor */ .global exitexit: move.l #-1,0xfffff304 move.b #0,0xfffff300; movea.l #0x10c00000,%a0; movea.l 0(%a0),%sp; movea.l 4(%a0),%a0; jmp (%a0);/* * Define an empty __main */ .global __main__main: rts/* * Define an empty environment. */ .data .align 2environ: .long 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -