SM64 Memory Map
|$80278504||264 bytes||Routine||Global||DmaCopy(u32 dst, u32 bottom, u32 top);
dst being the RAM offset! bottom is the beginning ROM offset to copy the bytes and top is the end.
Takes three arguments.
ADDIU SP, SP, $FFE8 ; -24 to stack. Aka, make space.
SW RA, $0014 (SP) ; Push return address to stack.
LUI A0, $8034 ; Upper half address.
ORI A0, A0, $269D ; Lower half address. A0 = $8034269D
LUI A1, $001C ; ROM offset start (bottom)
ORI A1, $0D60 ; Lower part, A1 = $001C0D60
LUI A2, $0020 ; ROM offset end (top)
JAL $80278504 ; Jump to subroutine DmaCopy
ORI A2, $00D1 ; Is executed before JAL. Lower half.
LW RA, $0014 (SP) ; Load back our lost return address.
JR RA ; Jump to return address.
ADDIU SP, SP, $0018 ; Restores stack. (+24)
DmaCopy basically copies data from ROM to RAM. dst is the destination (as RAM offset), bottom is the start (as ROM offset) which is copied to RAM and top is the end. So, in our above example bytes from $001C0D60 (ROM) to $002000D1 (ROM) into $8034269D (RAM).