megadrive_test1
view src/startup.s @ 7:8253942b0a1a
in the middle of something
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 19 Feb 2017 14:00:26 +0200 |
parents | 862f8a034cae |
children |
line source
1 .text
2 .extern main
4 .global start
5 .global halt_cpu
6 start:
7 | copy the string 'SEGA' to appease the TMSS
8 move.l 100, 0xa14000 | SEGA is always at address 100
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
34 jsr main
35 halt_cpu:
36 stop #0x2700