megadrive_test2

view src/startup.s @ 3:b22bc95f0cc0

added vim modelines
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 14 Mar 2017 09:11:18 +0200
parents 2560a8be8cb8
children 72ab63f262bf
line source
1 | vi:filetype=asm68k:
2 .text
3 .extern main
5 .global start
6 .global halt_cpu
7 start:
8 jsr disable_intr
10 | copy .data section from ROM to RAM
11 move.l #_data_lma, %a0
12 move.l #_data_start, %a1
13 move.l #_data_end, %a2
14 cmp.l %a1, %a2
15 beq.s 1f | skip data copy if the section is empty
16 0: move.l (%a0)+, (%a1)+
17 cmp.l %a1, %a2
18 bne.s 0b
19 1:
21 | zero the .bss section
22 move.l #_bss_start, %a0
23 move.l #_bss_end, %a1
24 cmp.l %a0, %a1
25 beq.s 1f | skip bss zeroing if the section is empty
26 0: clr.l (%a0)+
27 cmp.l %a0, %a1
28 bne.s 0b
29 1:
31 | setup the stack pointer stack
32 move.l #_stacktop, %sp
33 | now that we have a stack, we can enable interrupts
34 jsr enable_intr
36 jsr main
37 halt_cpu:
38 stop #0x2700