megadrive_test1

view src/startup.s @ 3:54739a11be66

- .data copy and .bss clearing - also made sure .data and .bss start and end markers are dword-aligned to make sure I can copy 4bytes at a time
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 31 Jan 2017 07:11:17 +0200
parents 909c22dc18d2
children 862f8a034cae
line source
1 .text
2 .extern main
4 .global start
5 start:
6 | copy .data section from ROM to RAM
7 move.l #_data_lma, %a0
8 move.l #_data_start, %a1
9 move.l #_data_end, %a2
10 cmp.l %a1, %a2
11 beq.s 1f | skip data copy if the section is empty
12 0: move.l (%a0)+, (%a1)+
13 cmp.l %a1, %a2
14 bne.s 0b
15 1:
17 | zero the .bss section
18 move.l #_bss_start, %a0
19 move.l #_bss_end, %a1
20 cmp.l %a0, %a1
21 beq.s 1f | skip bss zeroing if the section is empty
22 0: clr.l (%a0)+
23 cmp.l %a0, %a1
24 bne.s 0b
25 1:
26 jsr main
27 stop #0x2700