mirror of
https://github.com/italicsjenga/agb.git
synced 2025-01-22 23:26:33 +11:00
copy iwram section to iwram
This commit is contained in:
parent
3905c3e13a
commit
c315aab113
2 changed files with 26 additions and 4 deletions
12
crt0.s
12
crt0.s
|
@ -12,6 +12,18 @@ __start:
|
||||||
ldr r1, =0x03007FFC
|
ldr r1, =0x03007FFC
|
||||||
str r0, [r1]
|
str r0, [r1]
|
||||||
|
|
||||||
|
|
||||||
|
@ copies iwram section in rom to iwram in ram
|
||||||
|
ldr r0, =__iwram_rom_start @ load memory address storing start of data for iwram in rom
|
||||||
|
ldr r1, =__iwram_data_start @ load memory address storing location of iwram in ram
|
||||||
|
ldr r2, =__iwram_rom_length_halfwords @ load number of 16 bit values to copy
|
||||||
|
swi 0x000B0000 @ call interrupt CpuSet.
|
||||||
|
@ r0: source
|
||||||
|
@ r1: destination
|
||||||
|
@ r2: length + size information
|
||||||
|
@
|
||||||
|
@ see: https://mgba-emu.github.io/gbatek/#swi-0bh-gbands7nds9dsi7dsi9---cpuset
|
||||||
|
|
||||||
@ load main and branch
|
@ load main and branch
|
||||||
ldr r0, =main
|
ldr r0, =main
|
||||||
bx r0
|
bx r0
|
||||||
|
|
18
gba.ld
18
gba.ld
|
@ -30,18 +30,28 @@ SECTIONS {
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
} > rom
|
} > rom
|
||||||
|
|
||||||
__data_start = .;
|
__iwram_rom_start = .;
|
||||||
.data : {
|
.iwram : {
|
||||||
|
__iwram_data_start = ABSOLUTE(.);
|
||||||
|
|
||||||
*(.data .data.*);
|
*(.data .data.*);
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
} > iwram
|
|
||||||
__data_end = .;
|
*(.text_iwram .text_iwram.*);
|
||||||
|
. = ALIGN(4);
|
||||||
|
|
||||||
|
__iwram_data_end = ABSOLUTE(.);
|
||||||
|
} > iwram AT>rom
|
||||||
|
|
||||||
|
|
||||||
.bss : {
|
.bss : {
|
||||||
*(.bss .bss.*);
|
*(.bss .bss.*);
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
} > iwram
|
} > iwram
|
||||||
|
|
||||||
|
__iwram_rom_length_bytes = __iwram_data_end - __iwram_data_start;
|
||||||
|
__iwram_rom_length_halfwords = (__iwram_rom_length_bytes + 1) / 2;
|
||||||
|
|
||||||
/* discard anything not already mentioned */
|
/* discard anything not already mentioned */
|
||||||
/DISCARD/ : { *(*) }
|
/DISCARD/ : { *(*) }
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue