megadrive_test2
view src/startup.s @ 7:108ecc582a11
defined all the I/O register addresses in io.h
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Wed, 21 Jun 2017 06:49:50 +0300 |
parents | b22bc95f0cc0 |
children | 54caa2b214ca |
line source
1 | vi:filetype=gas68k:
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