megadrive_test1

view 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
line source
1 .text
2 .extern main
4 .global start
5 .global halt_cpu
6 start:
7 | copy .data section from ROM to RAM
8 move.l #_data_lma, %a0
9 move.l #_data_start, %a1
10 move.l #_data_end, %a2
11 cmp.l %a1, %a2
12 beq.s 1f | skip data copy if the section is empty
13 0: move.l (%a0)+, (%a1)+
14 cmp.l %a1, %a2
15 bne.s 0b
16 1:
18 | zero the .bss section
19 move.l #_bss_start, %a0
20 move.l #_bss_end, %a1
21 cmp.l %a0, %a1
22 beq.s 1f | skip bss zeroing if the section is empty
23 0: clr.l (%a0)+
24 cmp.l %a0, %a1
25 bne.s 0b
26 1:
27 jsr main
28 halt_cpu:
29 stop #0x2700