summaryrefslogtreecommitdiff
path: root/asm/emerald.s
diff options
context:
space:
mode:
authorYamaArashi <shadow962@live.com>2015-10-05 06:03:59 -0700
committerYamaArashi <shadow962@live.com>2015-10-05 06:03:59 -0700
commit9024595c93acf6b1ee7aa63b9b2d04ee701058c3 (patch)
tree8bbe44a67d7eb6092722e67a09e5ab7d3d7c7b22 /asm/emerald.s
parent7f3c790d09b2736c5470535fbed5e06784821669 (diff)
split out files and add build batch file
Diffstat (limited to 'asm/emerald.s')
-rw-r--r--asm/emerald.s218
1 files changed, 12 insertions, 206 deletions
diff --git a/asm/emerald.s b/asm/emerald.s
index 91f75383e..96f032a55 100644
--- a/asm/emerald.s
+++ b/asm/emerald.s
@@ -1,214 +1,20 @@
- .macro arm_func_start name
- .align 2, 0
- .global \name
- .arm
- .type \name, %function
- .endm
-
- .macro arm_func_end name
- .size \name, .-\name
- .endm
-
- .macro thumb_func_start name
- .align 2, 0
- .global \name
- .thumb
- .thumb_func
- .type \name, %function
- .endm
-
- .macro non_word_aligned_thumb_func_start name
- .global \name
- .thumb
- .thumb_func
- .type \name, %function
- .endm
-
- .macro thumb_func_end name
- .size \name, .-\name
- .endm
+ .include "defines.s"
+ .include "macros.s"
.syntax unified
- .global RomBase
+ .global Start
.text
.arm
-RomBase:
- b start_loop
-
-CartridgeHeaderNintendoLogo:
- .incbin "base_emerald.gba", 0x4, 0xA0 - 0x4
-
-CartridgeHeaderGameTitle:
- .ascii "POKEMON EMER"
-
-CartridgeHeaderGameCode:
- .ascii "BPEE"
-
-CartridgeHeaderMakerCode:
- .ascii "01"
-
-CartridgeHeaderMagic:
- .byte 0x96
-
-CartridgeHeaderMainUnitCode:
- .byte 0
-
-CartridgeHeaderDeviceType:
- .byte 0
-
-CartridgeHeaderReserved1:
- .rept 7
- .byte 0
- .endr
-
-CartridgeHeaderSoftwareVersion:
- .byte 0
-
-CartridgeHeaderChecksum:
- .byte 0x72
-
-CartridgeHeaderReserved2:
- .rept 2
- .byte 0
- .endr
-
-_080000C0:
- .long 0
-
-_080000C4:
- .short 0
-
-_080000C6:
- .short 0
-
-_080000C8:
- .long 0
-
- .incbin "base_emerald.gba", 0xCC, 0x204 - 0xCC
-
- arm_func_start start_loop
-start_loop: @ 8000204
- mov r0, 0x12
- msr cpsr_cf, r0
- ldr sp, _0800023C
- mov r0, 0x1F
- msr cpsr_cf, r0
- ldr sp, _08000238
- ldr r1, _08000240
- add r0, pc, 0x20
- str r0, [r1]
- ldr r1, _08000244
- mov lr, pc
- bx r1
- b start_loop
- .align 2, 0
-_08000238: .4byte 0x03007e40
-_0800023C: .4byte 0x03007fa0
-_08000240: .4byte 0x03007ffc
-_08000244: .4byte main_loop + 1
- arm_func_end start_loop
-
- arm_func_start irq_handler
-irq_handler: @ 8000248
- mov r3, 0x4000000
- add r3, r3, 0x200
- ldr r2, [r3]
- ldrh r1, [r3, 0x8]
- mrs r0, spsr
- stmdb sp!, {r0-r3,lr}
- mov r0, 0
- strh r0, [r3, 0x8]
- and r1, r2, r2, lsr 16
- mov r12, 0
- ands r0, r1, 0x4
- bne _08000320
- add r12, r12, 0x4
- mov r0, 0x1
- strh r0, [r3, 0x8]
- ands r0, r1, 0x80
- bne _08000320
- add r12, r12, 0x4
- ands r0, r1, 0x40
- bne _08000320
- add r12, r12, 0x4
- ands r0, r1, 0x2
- bne _08000320
- add r12, r12, 0x4
- ands r0, r1, 0x1
- bne _08000320
- add r12, r12, 0x4
- ands r0, r1, 0x8
- bne _08000320
- add r12, r12, 0x4
- ands r0, r1, 0x10
- bne _08000320
- add r12, r12, 0x4
- ands r0, r1, 0x20
- bne _08000320
- add r12, r12, 0x4
- ands r0, r1, 0x100
- bne _08000320
- add r12, r12, 0x4
- ands r0, r1, 0x200
- bne _08000320
- add r12, r12, 0x4
- ands r0, r1, 0x400
- bne _08000320
- add r12, r12, 0x4
- ands r0, r1, 0x800
- bne _08000320
- add r12, r12, 0x4
- ands r0, r1, 0x1000
- bne _08000320
- add r12, r12, 0x4
- ands r0, r1, 0x2000
- strbne r0, [r3, -0x17C]
-_0800031C:
- bne _0800031C
-_08000320:
- strh r0, [r3, 0x2]
- bic r2, r2, r0
- ldr r0, _0800039C
- ldr r0, [r0]
- ldrb r0, [r0, 0xA]
- mov r1, 0x8
- mov r0, r1, lsl r0
- orr r0, r0, 0x2000
- orr r1, r0, 0xC6
- and r1, r1, r2
- strh r1, [r3]
- mrs r3, cpsr
- bic r3, r3, 0xDF
- orr r3, r3, 0x1F
- msr cpsr_cf, r3
- ldr r1, _080003A0
- add r1, r1, r12
- ldr r0, [r1]
- stmdb sp!, {lr}
- add lr, pc, 0
- bx r0
- ldmia sp!, {lr}
- mrs r3, cpsr
- bic r3, r3, 0xDF
- orr r3, r3, 0x92
- msr cpsr_cf, r3
- ldmia sp!, {r0-r3,lr}
- strh r2, [r3]
- strh r1, [r3, 0x8]
- msr spsr_cf, r0
- bx lr
- .align 2, 0
-_0800039C: .4byte 0x03007868
-_080003A0: .4byte 0x03002710
- arm_func_end irq_handler
+Start:
+ .include "crt0.s"
.thumb
- thumb_func_start main_loop
-main_loop: @ 80003A4
+ thumb_func_start Main
+Main:
push {r4-r7,lr}
mov r7, r8
push {r7}
@@ -321,7 +127,7 @@ _080004B2:
b _0800042A
.align 2, 0
_080004C0: .4byte 0x030022b4
- thumb_func_end main_loop
+ thumb_func_end Main
thumb_func_start call_callbacks_wrapper
call_callbacks_wrapper: @ 80004C4
@@ -605,7 +411,7 @@ _08000690:
pop {r0}
bx r0
.align 2, 0
-_080006D0: .4byte irq_handler
+_080006D0: .4byte InterruptMain
_080006D4: .4byte 0x03002750
_080006D8: .4byte 0x082e9548
_080006DC: .4byte 0x03002710
@@ -56771,8 +56577,8 @@ _0801B688: .4byte 0x03005d90
_0801B68C: .4byte 0x03005d8c
_0801B690: .4byte 0x00003564
_0801B694: .4byte 0x00002bb0
-_0801B698: .4byte CartridgeHeaderGameCode
-_0801B69C: .4byte CartridgeHeaderSoftwareVersion
+_0801B698: .4byte RomHeaderGameCode
+_0801B69C: .4byte RomHeaderSoftwareVersion
thumb_func_end sub_801B580
thumb_func_start sub_801B6A0
@@ -972091,7 +971897,7 @@ _082DEE76:
.align 2, 0
_082DEE78: .4byte 0x0000a1c1
_082DEE7C: .4byte 0x6177614b
-_082DEE80: .4byte CartridgeHeaderNintendoLogo
+_082DEE80: .4byte RomHeaderNintendoLogo
thumb_func_end sub_82DED84
thumb_func_start sub_82DEE84