megadrive_test2

view src/startup.s @ 1:2560a8be8cb8

hblank interrupt test
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 14 Mar 2017 09:02:43 +0200
parents ce1b05082ac4
children b22bc95f0cc0
line source
1 .text
2 .extern main
4 .global start
5 .global halt_cpu
6 start:
7 jsr disable_intr
9 | copy .data section from ROM to RAM
10 move.l #_data_lma, %a0
11 move.l #_data_start, %a1
12 move.l #_data_end, %a2
13 cmp.l %a1, %a2
14 beq.s 1f | skip data copy if the section is empty
15 0: move.l (%a0)+, (%a1)+
16 cmp.l %a1, %a2
17 bne.s 0b
18 1:
20 | zero the .bss section
21 move.l #_bss_start, %a0
22 move.l #_bss_end, %a1
23 cmp.l %a0, %a1
24 beq.s 1f | skip bss zeroing if the section is empty
25 0: clr.l (%a0)+
26 cmp.l %a0, %a1
27 bne.s 0b
28 1:
30 | setup the stack pointer stack
31 move.l #_stacktop, %sp
32 | now that we have a stack, we can enable interrupts
33 jsr enable_intr
35 jsr main
36 halt_cpu:
37 stop #0x2700