initial commit
[retrocrawl] / src / amiga / startup.s
1 | vi:filetype=gas68k:
2         .global halt_cpu
3         .extern main
4
5         .section .startup,"a"
6
7         | enter supervisor mode (assumes VBR=0)
8         move.l #super, 0x80
9         trap #0
10 super:
11         ori.w #0x0300, %sr      | disable interrupts
12
13         | zero the .bss section
14         move.l #_bss_start, %a0
15         move.l #_bss_end, %a1
16         cmp.l %a0, %a1
17         beq.s 1f        | skip zeroing if the section is empty
18 0:      clr.b (%a0)+
19         cmp.l %a0, %a1
20         bne.s 0b
21 1:
22         | setup the stack
23         move.l #_stacktop, %sp
24         andi.w #0xf8ff, %sr     | enable interrupts
25
26         jsr main
27 0:      bra.b 0b
28
29 halt_cpu:
30         stop #0x2700