annotate src/startup.s @ 6:862f8a034cae
expanding the megadrive code
author |
John Tsiombikas <nuclear@member.fsf.org> |
date |
Sat, 11 Feb 2017 08:56:42 +0200 |
parents |
54739a11be66 |
children |
8253942b0a1a |
rev |
line source |
nuclear@0
|
1 .text
|
nuclear@0
|
2 .extern main
|
nuclear@0
|
3
|
nuclear@0
|
4 .global start
|
nuclear@6
|
5 .global halt_cpu
|
nuclear@0
|
6 start:
|
nuclear@3
|
7 | copy .data section from ROM to RAM
|
nuclear@3
|
8 move.l #_data_lma, %a0
|
nuclear@3
|
9 move.l #_data_start, %a1
|
nuclear@3
|
10 move.l #_data_end, %a2
|
nuclear@3
|
11 cmp.l %a1, %a2
|
nuclear@3
|
12 beq.s 1f | skip data copy if the section is empty
|
nuclear@3
|
13 0: move.l (%a0)+, (%a1)+
|
nuclear@3
|
14 cmp.l %a1, %a2
|
nuclear@3
|
15 bne.s 0b
|
nuclear@3
|
16 1:
|
nuclear@3
|
17
|
nuclear@3
|
18 | zero the .bss section
|
nuclear@3
|
19 move.l #_bss_start, %a0
|
nuclear@3
|
20 move.l #_bss_end, %a1
|
nuclear@3
|
21 cmp.l %a0, %a1
|
nuclear@3
|
22 beq.s 1f | skip bss zeroing if the section is empty
|
nuclear@3
|
23 0: clr.l (%a0)+
|
nuclear@3
|
24 cmp.l %a0, %a1
|
nuclear@3
|
25 bne.s 0b
|
nuclear@3
|
26 1:
|
nuclear@0
|
27 jsr main
|
nuclear@6
|
28 halt_cpu:
|
nuclear@0
|
29 stop #0x2700
|