nuclear@0: .text nuclear@0: .extern main nuclear@0: nuclear@0: .global start nuclear@6: .global halt_cpu nuclear@0: start: nuclear@7: | copy the string 'SEGA' to appease the TMSS nuclear@7: move.l 100, 0xa14000 | SEGA is always at address 100 nuclear@7: nuclear@3: | copy .data section from ROM to RAM nuclear@3: move.l #_data_lma, %a0 nuclear@3: move.l #_data_start, %a1 nuclear@3: move.l #_data_end, %a2 nuclear@3: cmp.l %a1, %a2 nuclear@3: beq.s 1f | skip data copy if the section is empty nuclear@3: 0: move.l (%a0)+, (%a1)+ nuclear@3: cmp.l %a1, %a2 nuclear@3: bne.s 0b nuclear@3: 1: nuclear@3: nuclear@3: | zero the .bss section nuclear@3: move.l #_bss_start, %a0 nuclear@3: move.l #_bss_end, %a1 nuclear@3: cmp.l %a0, %a1 nuclear@3: beq.s 1f | skip bss zeroing if the section is empty nuclear@3: 0: clr.l (%a0)+ nuclear@3: cmp.l %a0, %a1 nuclear@3: bne.s 0b nuclear@3: 1: nuclear@7: nuclear@7: | setup the stack pointer stack nuclear@7: move.l #_stacktop, %sp nuclear@7: nuclear@0: jsr main nuclear@6: halt_cpu: nuclear@0: stop #0x2700