mirror of
https://github.com/FireEmblemUniverse/fireemblem8u.git
synced 2024-11-27 07:00:21 +00:00
Add arm functions, and rom header
This commit is contained in:
parent
bbcfda2884
commit
286a095794
480
asm/arm.s
Normal file
480
asm/arm.s
Normal file
@ -0,0 +1,480 @@
|
||||
Start_IRAMCodeToCopy:
|
||||
_08000228: .4byte 0x020228A8 @ pool
|
||||
_0800022C: .4byte 0x020222A8 @ pool
|
||||
_08000230: .4byte 0x02022288 @ pool
|
||||
|
||||
@ sub_8000234
|
||||
sub_8000234: @ 0x08000234
|
||||
push {r4, r5, r6, r7}
|
||||
mov r7, #0x3e0
|
||||
_0800023C:
|
||||
ldr r0, _08000230
|
||||
add r0, r0, r7, lsr #5
|
||||
ldrsb r5, [r0]
|
||||
tst r5, r5
|
||||
beq _080002F4
|
||||
ldr r4, _0800022C
|
||||
lsr r0, r7, #1
|
||||
add r0, r0, r0, lsl #1
|
||||
add r0, r0, #0x30
|
||||
add r4, r4, r0
|
||||
mov r6, #0x1e
|
||||
_08000268:
|
||||
sub r4, r4, #3
|
||||
ldrb r0, [r4]
|
||||
add r0, r0, r5
|
||||
strb r0, [r4]
|
||||
subs r0, r0, #0x20
|
||||
bpl _08000284
|
||||
mov r0, #0
|
||||
_08000284:
|
||||
cmp r0, #0x20
|
||||
blo _08000290
|
||||
mov r0, #0x1f
|
||||
_08000290:
|
||||
ldrb r1, [r4, #1]
|
||||
add r1, r1, r5
|
||||
strb r1, [r4, #1]
|
||||
subs r1, r1, #0x20
|
||||
bpl _080002A8
|
||||
mov r1, #0
|
||||
_080002A8:
|
||||
cmp r1, #0x20
|
||||
blo _080002B4
|
||||
mov r1, #0x1f
|
||||
_080002B4:
|
||||
ldrb r2, [r4, #2]
|
||||
add r2, r2, r5
|
||||
strb r2, [r4, #2]
|
||||
subs r2, r2, #0x20
|
||||
bpl _080002CC
|
||||
mov r2, #0
|
||||
_080002CC:
|
||||
cmp r2, #0x20
|
||||
blo _080002D8
|
||||
mov r2, #0x1f
|
||||
_080002D8:
|
||||
add r0, r0, r1, lsl #5
|
||||
add r0, r0, r2, lsl #10
|
||||
ldr r1, _08000228
|
||||
add r1, r1, r6
|
||||
strh r0, [r1, r7]
|
||||
subs r6, r6, #2
|
||||
bpl _08000268
|
||||
_080002F4:
|
||||
subs r7, r7, #0x20
|
||||
bpl _0800023C
|
||||
pop {r4, r5, r6, r7}
|
||||
bx lr
|
||||
|
||||
@ Store160To80Structs
|
||||
Store160To80Structs: @ 0x08000304
|
||||
lsr r1, r1, #4
|
||||
sub r1, r1, #1
|
||||
mov r2, #0xa0
|
||||
_08000310:
|
||||
str r2, [r0]
|
||||
str r2, [r0, #8]
|
||||
str r2, [r0, #0x10]
|
||||
str r2, [r0, #0x18]
|
||||
str r2, [r0, #0x20]
|
||||
str r2, [r0, #0x28]
|
||||
str r2, [r0, #0x30]
|
||||
str r2, [r0, #0x38]
|
||||
str r2, [r0, #0x40]
|
||||
str r2, [r0, #0x48]
|
||||
str r2, [r0, #0x50]
|
||||
str r2, [r0, #0x58]
|
||||
str r2, [r0, #0x60]
|
||||
str r2, [r0, #0x68]
|
||||
str r2, [r0, #0x70]
|
||||
str r2, [r0, #0x78]
|
||||
add r0, r0, #0x80
|
||||
subs r1, r1, #1
|
||||
bpl _08000310
|
||||
bx lr
|
||||
|
||||
@ sub_8000360
|
||||
sub_8000360: @ 0x08000360
|
||||
push {r4, r5, r6, r7}
|
||||
sub r1, r1, #2
|
||||
mov r2, #0
|
||||
mov r3, #0
|
||||
_08000370:
|
||||
ldrh r4, [r0]
|
||||
add r2, r2, r4
|
||||
eor r3, r3, r4
|
||||
add r0, r0, #2
|
||||
subs r1, r1, #2
|
||||
bpl _08000370
|
||||
mov r0, #0x10000
|
||||
sub r0, r0, #1
|
||||
and r2, r2, r0
|
||||
lsl r3, r3, #0x10
|
||||
mov r0, r2
|
||||
add r0, r0, r3
|
||||
pop {r4, r5, r6, r7}
|
||||
bx lr
|
||||
|
||||
@ ARM_FillRect
|
||||
ARM_FillRect: @ 0x080003A8
|
||||
push {r4, r5, r6, r7}
|
||||
mov r4, r0
|
||||
sub r6, r2, #0
|
||||
_080003B4:
|
||||
sub r5, r1, #0
|
||||
_080003B8:
|
||||
strh r3, [r4]
|
||||
add r4, r4, #2
|
||||
subs r5, r5, #1
|
||||
bpl _080003B8
|
||||
add r0, r0, #0x40
|
||||
mov r4, r0
|
||||
subs r6, r6, #1
|
||||
bpl _080003B4
|
||||
pop {r4, r5, r6, r7}
|
||||
bx lr
|
||||
|
||||
@ sub_80003E0
|
||||
sub_80003E0: @ 0x080003E0
|
||||
push {r4, r5, r6, r7}
|
||||
tst r2, r2
|
||||
beq _08000434
|
||||
bmi _08000434
|
||||
tst r3, r3
|
||||
beq _08000434
|
||||
bmi _08000434
|
||||
mov r4, #0x40
|
||||
sub r4, r4, r2, lsl #1
|
||||
sub r6, r3, #1
|
||||
_08000408:
|
||||
sub r5, r2, #1
|
||||
_0800040C:
|
||||
ldrh r7, [r0]
|
||||
strh r7, [r1]
|
||||
add r0, r0, #2
|
||||
add r1, r1, #2
|
||||
subs r5, r5, #1
|
||||
bpl _0800040C
|
||||
add r0, r0, r4
|
||||
add r1, r1, r4
|
||||
subs r6, r6, #1
|
||||
bpl _08000408
|
||||
_08000434:
|
||||
pop {r4, r5, r6, r7}
|
||||
bx lr
|
||||
|
||||
@ sub_800043C
|
||||
sub_800043C: @ 0x0800043C
|
||||
push {r4, r5, r6, r7}
|
||||
ldrb r3, [r1]
|
||||
ldrb r4, [r1, #1]
|
||||
add r1, r1, #2
|
||||
lsl r7, r4, #6
|
||||
add r0, r0, r7
|
||||
mov r6, r4
|
||||
_08000458:
|
||||
mov r5, r3
|
||||
_0800045C:
|
||||
ldrh r7, [r1]
|
||||
add r7, r7, r2
|
||||
strh r7, [r0]
|
||||
add r0, r0, #2
|
||||
add r1, r1, #2
|
||||
subs r5, r5, #1
|
||||
bpl _0800045C
|
||||
sub r0, r0, r3, lsl #1
|
||||
sub r0, r0, #0x42
|
||||
subs r6, r6, #1
|
||||
bpl _08000458
|
||||
pop {r4, r5, r6, r7}
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_08000490: .4byte 0x03003744 @ pool
|
||||
|
||||
@ IRAMARM_CopyToSecondaryOAM
|
||||
IRAMARM_CopyToSecondaryOAM: @ 0x08000494
|
||||
push {r4, r5, r6, r7}
|
||||
ldr r7, _08000490
|
||||
_0800049C:
|
||||
ldr r5, [r7]
|
||||
ldrh r4, [r2]
|
||||
tst r4, r4
|
||||
beq _08000528
|
||||
bmi _08000528
|
||||
add r2, r2, #2
|
||||
add r6, r5, r4, lsl #3
|
||||
str r6, [r7]
|
||||
mov r7, #0x10000
|
||||
sub r7, r7, #1
|
||||
and r0, r0, r7
|
||||
and r1, r1, r7
|
||||
orr r0, r0, r1, lsl #16
|
||||
_080004D0:
|
||||
ldrh r1, [r2]
|
||||
orr r6, r1, r0, lsr #16
|
||||
and r6, r6, #0xff00
|
||||
add r7, r1, r0, lsr #16
|
||||
and r7, r7, #0xff
|
||||
orr r6, r6, r7
|
||||
strh r6, [r5]
|
||||
ldrh r1, [r2, #2]
|
||||
orr r6, r1, r0
|
||||
and r6, r6, #0xfe00
|
||||
add r7, r1, r0
|
||||
lsl r7, r7, #0x17
|
||||
lsr r7, r7, #0x17
|
||||
orr r6, r6, r7
|
||||
strh r6, [r5, #2]
|
||||
ldrh r1, [r2, #4]
|
||||
add r6, r1, r3
|
||||
strh r6, [r5, #4]
|
||||
add r2, r2, #6
|
||||
add r5, r5, #8
|
||||
subs r4, r4, #1
|
||||
bne _080004D0
|
||||
_08000528:
|
||||
pop {r4, r5, r6, r7}
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_08000530: .4byte 0x03003070 @ pool
|
||||
|
||||
@ IRAMARM_CopyToPrimaryOAM
|
||||
IRAMARM_CopyToPrimaryOAM: @ 0x08000534
|
||||
push {r4, r5, r6, r7}
|
||||
ldr r7, _08000530
|
||||
b _0800049C
|
||||
.byte 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00
|
||||
.byte 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00
|
||||
_08000560: .4byte 0x08000540 @ pool
|
||||
|
||||
@ IRAMARM_Func3_DrawGlyph
|
||||
IRAMARM_Func3_DrawGlyph: @ 0x08000564
|
||||
push {r4, r5, r6, r7, r8, sb, sl}
|
||||
mov sb, #0xf
|
||||
mov sl, #0x10000
|
||||
sub sl, sl, #1
|
||||
_08000574:
|
||||
ldr r4, _08000560
|
||||
ldr r5, [r4, r3, lsl #2]
|
||||
ldr r4, [r2]
|
||||
umull r5, r6, r4, r5
|
||||
mov r7, r5
|
||||
and r7, r7, #0xff
|
||||
ldr r7, [r0, r7, lsl #1]
|
||||
lsr r8, r5, #8
|
||||
and r8, r8, #0xff
|
||||
ldr r8, [r0, r8, lsl #1]
|
||||
and r7, r7, sl
|
||||
orr r7, r7, r8, lsl #16
|
||||
ldr r4, [r1]
|
||||
orr r4, r4, r7
|
||||
str r4, [r1]
|
||||
lsr r7, r5, #0x10
|
||||
and r7, r7, #0xff
|
||||
ldr r7, [r0, r7, lsl #1]
|
||||
lsr r8, r5, #0x18
|
||||
and r8, r8, #0xff
|
||||
ldr r8, [r0, r8, lsl #1]
|
||||
and r7, r7, sl
|
||||
orr r7, r7, r8, lsl #16
|
||||
ldr r4, [r1, #0x40]
|
||||
orr r4, r4, r7
|
||||
str r4, [r1, #0x40]
|
||||
mov r7, r6
|
||||
and r7, r7, #0xff
|
||||
ldr r7, [r0, r7, lsl #1]
|
||||
lsr r8, r6, #8
|
||||
and r8, r8, #0xff
|
||||
ldr r8, [r0, r8, lsl #1]
|
||||
and r7, r7, sl
|
||||
orr r7, r7, r8, lsl #16
|
||||
ldr r4, [r1, #0x80]
|
||||
orr r4, r4, r7
|
||||
str r4, [r1, #0x80]
|
||||
add r1, r1, #4
|
||||
add r2, r2, #4
|
||||
subs sb, sb, #1
|
||||
bpl _08000574
|
||||
pop {r4, r5, r6, r7, r8, sb, sl}
|
||||
bx lr
|
||||
.byte 0xF0, 0x07, 0x2D, 0xE9, 0x07, 0x90, 0xA0, 0xE3, 0x01, 0xA8, 0xA0, 0xE3, 0x01, 0xA0, 0x4A, 0xE2
|
||||
.byte 0xD8, 0x40, 0x1F, 0xE5, 0x03, 0x51, 0x94, 0xE7, 0x00, 0x40, 0x92, 0xE5, 0x94, 0x55, 0x86, 0xE0
|
||||
.byte 0x05, 0x70, 0xA0, 0xE1, 0xFF, 0x70, 0x07, 0xE2, 0x87, 0x70, 0x90, 0xE7, 0x25, 0x84, 0xA0, 0xE1
|
||||
.byte 0xFF, 0x80, 0x08, 0xE2, 0x88, 0x80, 0x90, 0xE7, 0x0A, 0x70, 0x07, 0xE0, 0x08, 0x78, 0x87, 0xE1
|
||||
.byte 0x00, 0x40, 0x91, 0xE5, 0x07, 0x40, 0x84, 0xE1, 0x00, 0x40, 0x81, 0xE5, 0x25, 0x78, 0xA0, 0xE1
|
||||
.byte 0xFF, 0x70, 0x07, 0xE2, 0x87, 0x70, 0x90, 0xE7, 0x25, 0x8C, 0xA0, 0xE1, 0xFF, 0x80, 0x08, 0xE2
|
||||
.byte 0x88, 0x80, 0x90, 0xE7, 0x0A, 0x70, 0x07, 0xE0, 0x08, 0x78, 0x87, 0xE1, 0x40, 0x40, 0x91, 0xE5
|
||||
.byte 0x07, 0x40, 0x84, 0xE1, 0x20, 0x40, 0x81, 0xE5, 0x06, 0x70, 0xA0, 0xE1, 0xFF, 0x70, 0x07, 0xE2
|
||||
.byte 0x87, 0x70, 0x90, 0xE7, 0x26, 0x84, 0xA0, 0xE1, 0xFF, 0x80, 0x08, 0xE2, 0x88, 0x80, 0x90, 0xE7
|
||||
.byte 0x0A, 0x70, 0x07, 0xE0, 0x08, 0x78, 0x87, 0xE1, 0x80, 0x40, 0x91, 0xE5, 0x07, 0x40, 0x84, 0xE1
|
||||
.byte 0x40, 0x40, 0x81, 0xE5, 0x04, 0x10, 0x81, 0xE2, 0x04, 0x20, 0x82, 0xE2, 0x01, 0x90, 0x59, 0xE2
|
||||
.byte 0xD6, 0xFF, 0xFF, 0x5A, 0xF0, 0x07, 0xBD, 0xE8, 0x1E, 0xFF, 0x2F, 0xE1
|
||||
_080006DC: .4byte 0x0815D488 @ BeforeTextTablePtr
|
||||
_080006E0: .4byte 0x0815A72C @ TextHuffmanTreeStart
|
||||
|
||||
@ IRAMARM_DecompText
|
||||
IRAMARM_DecompText: @ 0x080006E4
|
||||
push {r4, r5, r6, r7}
|
||||
sub r3, r3, r3
|
||||
ldr r5, _080006E0
|
||||
ldr r7, _080006DC
|
||||
ldr r7, [r7]
|
||||
_080006F8:
|
||||
mov r4, r7
|
||||
_080006FC:
|
||||
subs r3, r3, #1
|
||||
bpl _08000710
|
||||
ldrb r2, [r0]
|
||||
add r0, r0, #1
|
||||
mov r3, #7
|
||||
_08000710:
|
||||
tst r2, #1
|
||||
beq _08000720
|
||||
ldrh r6, [r4, #2]
|
||||
b _08000724
|
||||
_08000720:
|
||||
ldrh r6, [r4]
|
||||
_08000724:
|
||||
add r4, r5, r6, lsl #2
|
||||
lsr r2, r2, #1
|
||||
ldr r6, [r4]
|
||||
tst r6, r6
|
||||
bpl _080006FC
|
||||
tst r6, #0xff00
|
||||
beq _08000754
|
||||
strb r6, [r1]
|
||||
lsr r6, r6, #8
|
||||
strb r6, [r1, #1]
|
||||
add r1, r1, #2
|
||||
b _080006F8
|
||||
_08000754:
|
||||
strb r6, [r1]
|
||||
tst r6, #0xff
|
||||
beq _08000768
|
||||
add r1, r1, #1
|
||||
b _080006F8
|
||||
_08000768:
|
||||
pop {r4, r5, r6, r7}
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_08000770: .4byte 0x03004BB0 @ pool
|
||||
_08000774: .4byte 0x03004E60 @ pool
|
||||
_08000778: .4byte 0x030049A0 @ pool
|
||||
_0800077C: .4byte 0x0202E4DC @ pool
|
||||
_08000780: .4byte 0x0202E4D8 @ pool
|
||||
|
||||
@ IRAMARM_Func5
|
||||
IRAMARM_Func5: @ 0x08000784
|
||||
push {r4, r5, r6, r7, r8, sb, sl}
|
||||
ldr r3, _08000774
|
||||
ldr r4, [r3]
|
||||
ldrb r5, [r4]
|
||||
add r1, r1, r5
|
||||
ldrb r6, [r4, #1]
|
||||
add r2, r2, r6
|
||||
ldr r7, _0800077C
|
||||
ldr r7, [r7]
|
||||
ldr r7, [r7, r2, lsl #2]
|
||||
ldrb r7, [r7, r1]
|
||||
ldr r8, _08000770
|
||||
ldrb sl, [r8, r7]
|
||||
ldr r7, _08000778
|
||||
ldr r7, [r7]
|
||||
ldr sb, [r7, r6, lsl #2]
|
||||
ldrb sb, [sb, r5]
|
||||
add sl, sl, sb
|
||||
ldr sb, [r7, r2, lsl #2]
|
||||
ldrb sb, [sb, r1]
|
||||
cmp sl, sb
|
||||
bhs _08000848
|
||||
ldrb r4, [r3, #8]
|
||||
tst r4, r4
|
||||
beq _08000810
|
||||
ldr r7, _08000780
|
||||
ldr r7, [r7]
|
||||
ldr r7, [r7, r2, lsl #2]
|
||||
ldrb r7, [r7, r1]
|
||||
tst r7, r7
|
||||
beq _08000810
|
||||
ldrb r4, [r3, #0xa]
|
||||
eor r4, r4, r7
|
||||
ands r4, r4, #0x80
|
||||
bne _08000848
|
||||
_08000810:
|
||||
ldrb r4, [r3, #9]
|
||||
cmp sl, r4
|
||||
bhi _08000848
|
||||
ldr r4, [r3, #4]
|
||||
strb r1, [r4]
|
||||
strb r2, [r4, #1]
|
||||
strb r0, [r4, #2]
|
||||
strb sl, [r4, #3]
|
||||
add r4, r4, #4
|
||||
str r4, [r3, #4]
|
||||
ldr r7, _08000778
|
||||
ldr r7, [r7]
|
||||
ldr r7, [r7, r2, lsl #2]
|
||||
strb sl, [r7, r1]
|
||||
_08000848:
|
||||
pop {r4, r5, r6, r7, r8, sb, sl}
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_08000850: .4byte 0x030049B0 @ pool
|
||||
_08000854: .4byte 0x03004C50 @ pool
|
||||
.byte 0x4D, 0x00, 0x00, 0xEA, 0x59, 0x00, 0x00, 0xEA
|
||||
.byte 0x3E, 0x00, 0x00, 0xEA, 0x30, 0x00, 0x00, 0xEA, 0x69, 0x00, 0x00, 0xEA, 0x1D, 0x00, 0x00, 0xEA
|
||||
.byte 0x58, 0x08, 0x00, 0x08
|
||||
|
||||
@ IRAMARM_FillMovementMap
|
||||
IRAMARM_FillMovementMap: @ 0x08000874
|
||||
push {r4, r5, r6, lr}
|
||||
mov r4, #0
|
||||
ldr r5, _08000774
|
||||
eors r4, r4, #1
|
||||
beq _0800089C
|
||||
ldr r0, _08000850
|
||||
str r0, [r5]
|
||||
ldr r0, _08000854
|
||||
str r0, [r5, #4]
|
||||
b _080008AC
|
||||
_0800089C:
|
||||
ldr r0, _08000854
|
||||
str r0, [r5]
|
||||
ldr r0, _08000850
|
||||
str r0, [r5, #4]
|
||||
_080008AC:
|
||||
ldr r6, [r5]
|
||||
ldrb r6, [r6, #2]
|
||||
cmp r6, #4
|
||||
beq _08000A18
|
||||
ldr r6, [r5]
|
||||
ldrb r6, [r6, #2]
|
||||
mov r0, pc
|
||||
add r0, r0, #8
|
||||
add r0, r0, r6, lsl #2
|
||||
bx r0
|
||||
.byte 0x2E, 0x00, 0x00, 0xEA, 0x3A, 0x00, 0x00, 0xEA, 0x1F, 0x00, 0x00, 0xEA
|
||||
.byte 0x11, 0x00, 0x00, 0xEA, 0x4A, 0x00, 0x00, 0xEA, 0x03, 0x00, 0xA0, 0xE3, 0x00, 0x10, 0xA0, 0xE3
|
||||
.byte 0x00, 0x20, 0xE0, 0xE3, 0xA2, 0xFF, 0xFF, 0xEB, 0x02, 0x00, 0xA0, 0xE3, 0x00, 0x10, 0xA0, 0xE3
|
||||
.byte 0x01, 0x20, 0xA0, 0xE3, 0x9E, 0xFF, 0xFF, 0xEB, 0x00, 0x00, 0xA0, 0xE3, 0x00, 0x10, 0xE0, 0xE3
|
||||
.byte 0x00, 0x20, 0xA0, 0xE3, 0x9A, 0xFF, 0xFF, 0xEB, 0x01, 0x00, 0xA0, 0xE3, 0x01, 0x10, 0xA0, 0xE3
|
||||
.byte 0x00, 0x20, 0xA0, 0xE3, 0x96, 0xFF, 0xFF, 0xEB, 0x32, 0x00, 0x00, 0xEA, 0x03, 0x00, 0xA0, 0xE3
|
||||
.byte 0x00, 0x10, 0xA0, 0xE3, 0x00, 0x20, 0xE0, 0xE3, 0x91, 0xFF, 0xFF, 0xEB, 0x00, 0x00, 0xA0, 0xE3
|
||||
.byte 0x00, 0x10, 0xE0, 0xE3, 0x00, 0x20, 0xA0, 0xE3, 0x8D, 0xFF, 0xFF, 0xEB, 0x01, 0x00, 0xA0, 0xE3
|
||||
.byte 0x01, 0x10, 0xA0, 0xE3, 0x00, 0x20, 0xA0, 0xE3, 0x89, 0xFF, 0xFF, 0xEB, 0x25, 0x00, 0x00, 0xEA
|
||||
.byte 0x02, 0x00, 0xA0, 0xE3, 0x00, 0x10, 0xA0, 0xE3, 0x01, 0x20, 0xA0, 0xE3, 0x84, 0xFF, 0xFF, 0xEB
|
||||
.byte 0x00, 0x00, 0xA0, 0xE3, 0x00, 0x10, 0xE0, 0xE3, 0x00, 0x20, 0xA0, 0xE3, 0x80, 0xFF, 0xFF, 0xEB
|
||||
.byte 0x01, 0x00, 0xA0, 0xE3, 0x01, 0x10, 0xA0, 0xE3, 0x00, 0x20, 0xA0, 0xE3, 0x7C, 0xFF, 0xFF, 0xEB
|
||||
.byte 0x18, 0x00, 0x00, 0xEA, 0x03, 0x00, 0xA0, 0xE3, 0x00, 0x10, 0xA0, 0xE3, 0x00, 0x20, 0xE0, 0xE3
|
||||
.byte 0x77, 0xFF, 0xFF, 0xEB, 0x02, 0x00, 0xA0, 0xE3, 0x00, 0x10, 0xA0, 0xE3, 0x01, 0x20, 0xA0, 0xE3
|
||||
.byte 0x73, 0xFF, 0xFF, 0xEB, 0x00, 0x00, 0xA0, 0xE3, 0x00, 0x10, 0xE0, 0xE3, 0x00, 0x20, 0xA0, 0xE3
|
||||
.byte 0x6F, 0xFF, 0xFF, 0xEB, 0x0B, 0x00, 0x00, 0xEA, 0x03, 0x00, 0xA0, 0xE3, 0x00, 0x10, 0xA0, 0xE3
|
||||
.byte 0x00, 0x20, 0xE0, 0xE3, 0x6A, 0xFF, 0xFF, 0xEB, 0x02, 0x00, 0xA0, 0xE3, 0x00, 0x10, 0xA0, 0xE3
|
||||
.byte 0x01, 0x20, 0xA0, 0xE3, 0x66, 0xFF, 0xFF, 0xEB, 0x01, 0x00, 0xA0, 0xE3, 0x01, 0x10, 0xA0, 0xE3
|
||||
.byte 0x00, 0x20, 0xA0, 0xE3, 0x62, 0xFF, 0xFF, 0xEB, 0x04, 0x60, 0x95, 0xE5, 0x04, 0x00, 0xA0, 0xE3
|
||||
.byte 0x02, 0x00, 0xC6, 0xE5, 0x00, 0x60, 0x95, 0xE5, 0x04, 0x60, 0x86, 0xE2, 0x00, 0x60, 0x85, 0xE5
|
||||
.byte 0xA9, 0xFF, 0xFF, 0xEA, 0x99, 0xFF, 0xFF, 0xEA
|
||||
_08000A18:
|
||||
pop {r4, r5, r6, lr}
|
||||
bx lr
|
96
asm/crt0.s
Normal file
96
asm/crt0.s
Normal file
@ -0,0 +1,96 @@
|
||||
Init:
|
||||
b crt0
|
||||
.include "asm/rom_header.inc"
|
||||
|
||||
.global crt0
|
||||
crt0:
|
||||
mov r0, #0x12
|
||||
msr cpsr_fc, r0
|
||||
ldr sp, IRQStackBottom
|
||||
mov r0, #0x1f
|
||||
msr cpsr_fc, r0
|
||||
ldr sp, unk_3007E00
|
||||
ldr r1, =0x03007FFC
|
||||
adr r0, GlobalIRQHandler
|
||||
str r0, [r1]
|
||||
ldr r1, =0x08000A20+1
|
||||
mov lr, pc
|
||||
bx r1 @AgbMain
|
||||
b crt0
|
||||
unk_3007E00:
|
||||
.4byte 0x03007E00 @ pool
|
||||
IRQStackBottom:
|
||||
.4byte 0x03007FA0 @ pool
|
||||
|
||||
.global GlobalIRQHandler
|
||||
GlobalIRQHandler:
|
||||
mov r3, #0x4000000
|
||||
add r3, r3, #0x200
|
||||
ldr r2, [r3]
|
||||
lsl r1, r2, #0x10
|
||||
lsr r1, r1, #0x10
|
||||
mrs r0, spsr
|
||||
push {r0, r1, r3, lr}
|
||||
and r1, r2, r2, lsr #16
|
||||
ands r0, r1, #0x2000
|
||||
$loop:
|
||||
bne $loop
|
||||
mov r2, #0
|
||||
ands r0, r1, #1
|
||||
bne $foundInterrupt
|
||||
add r2, r2, #4
|
||||
ands r0, r1, #2
|
||||
bne $foundInterrupt
|
||||
add r2, r2, #4
|
||||
ands r0, r1, #4
|
||||
bne $foundInterrupt
|
||||
add r2, r2, #4
|
||||
ands r0, r1, #8
|
||||
bne $foundInterrupt
|
||||
add r2, r2, #4
|
||||
ands r0, r1, #0x10
|
||||
bne $foundInterrupt
|
||||
add r2, r2, #4
|
||||
ands r0, r1, #0x20
|
||||
bne $foundInterrupt
|
||||
add r2, r2, #4
|
||||
ands r0, r1, #0x40
|
||||
bne $foundInterrupt
|
||||
add r2, r2, #4
|
||||
ands r0, r1, #0x80
|
||||
bne $foundInterrupt
|
||||
add r2, r2, #4
|
||||
ands r0, r1, #0x100
|
||||
bne $foundInterrupt
|
||||
add r2, r2, #4
|
||||
ands r0, r1, #0x200
|
||||
bne $foundInterrupt
|
||||
add r2, r2, #4
|
||||
ands r0, r1, #0x400
|
||||
bne $foundInterrupt
|
||||
add r2, r2, #4
|
||||
ands r0, r1, #0x800
|
||||
bne $foundInterrupt
|
||||
add r2, r2, #4
|
||||
ands r0, r1, #0x1000
|
||||
bne $foundInterrupt
|
||||
add r2, r2, #4
|
||||
ands r0, r1, #0x2000
|
||||
$loop1:
|
||||
bne $loop1
|
||||
$foundInterrupt:
|
||||
strh r0, [r3, #2]
|
||||
mrs r3, apsr
|
||||
bic r3, r3, #0xdf
|
||||
orr r3, r3, #0x1f
|
||||
msr cpsr_fc, r3
|
||||
ldr r1, =0x030030F0
|
||||
add r1, r1, r2
|
||||
ldr r0, [r1]
|
||||
stmdb sp!, {lr}
|
||||
add lr, pc, #0
|
||||
bx r0
|
||||
.byte 0x00, 0x40, 0xBD, 0xE8, 0x00, 0x30, 0x0F, 0xE1
|
||||
.byte 0xDF, 0x30, 0xC3, 0xE3, 0x92, 0x30, 0x83, 0xE3, 0x03, 0xF0, 0x29, 0xE1, 0x0B, 0x40, 0xBD, 0xE8
|
||||
.byte 0xB0, 0x10, 0xC3, 0xE1, 0x00, 0xF0, 0x69, 0xE1, 0x1E, 0xFF, 0x2F, 0xE1
|
||||
.pool
|
@ -1,3 +1,3 @@
|
||||
.global start
|
||||
start:
|
||||
.incbin "baserom.gba"
|
||||
.incbin "baserom.gba", 0xA20
|
||||
|
52
asm/rom_header.inc
Normal file
52
asm/rom_header.inc
Normal file
@ -0,0 +1,52 @@
|
||||
.global RomHeaderNintendoLogo
|
||||
RomHeaderNintendoLogo:
|
||||
.byte 0x24,0xff,0xae,0x51,0x69,0x9a,0xa2,0x21
|
||||
.byte 0x3d,0x84,0x82,0x0a,0x84,0xe4,0x09,0xad
|
||||
.byte 0x11,0x24,0x8b,0x98,0xc0,0x81,0x7f,0x21
|
||||
.byte 0xa3,0x52,0xbe,0x19,0x93,0x09,0xce,0x20
|
||||
.byte 0x10,0x46,0x4a,0x4a,0xf8,0x27,0x31,0xec
|
||||
.byte 0x58,0xc7,0xe8,0x33,0x82,0xe3,0xce,0xbf
|
||||
.byte 0x85,0xf4,0xdf,0x94,0xce,0x4b,0x09,0xc1
|
||||
.byte 0x94,0x56,0x8a,0xc0,0x13,0x72,0xa7,0xfc
|
||||
.byte 0x9f,0x84,0x4d,0x73,0xa3,0xca,0x9a,0x61
|
||||
.byte 0x58,0x97,0xa3,0x27,0xfc,0x03,0x98,0x76
|
||||
.byte 0x23,0x1d,0xc7,0x61,0x03,0x04,0xae,0x56
|
||||
.byte 0xbf,0x38,0x84,0x00,0x40,0xa7,0x0e,0xfd
|
||||
.byte 0xff,0x52,0xfe,0x03,0x6f,0x95,0x30,0xf1
|
||||
.byte 0x97,0xfb,0xc0,0x85,0x60,0xd6,0x80,0x25
|
||||
.byte 0xa9,0x63,0xbe,0x03,0x01,0x4e,0x38,0xe2
|
||||
.byte 0xf9,0xa2,0x34,0xff,0xbb,0x3e,0x03,0x44
|
||||
.byte 0x78,0x00,0x90,0xcb,0x88,0x11,0x3a,0x94
|
||||
.byte 0x65,0xc0,0x7c,0x63,0x87,0xf0,0x3c,0xaf
|
||||
.byte 0xd6,0x25,0xe4,0x8b,0x38,0x0a,0xac,0x72
|
||||
.byte 0x21,0xd4,0xf8,0x07
|
||||
|
||||
RomHeaderGameTitle:
|
||||
.ascii "FIREEMBLEM2E"
|
||||
|
||||
RomHeaderGameCode:
|
||||
.ascii "BE8E"
|
||||
|
||||
RomHeaderMakerCode:
|
||||
.ascii "01"
|
||||
|
||||
RomHeaderMagic:
|
||||
.byte 0x96
|
||||
|
||||
RomHeaderMainUnitCode:
|
||||
.byte 0
|
||||
|
||||
RomHeaderDeviceType:
|
||||
.byte 0
|
||||
|
||||
RomHeaderReserved1:
|
||||
.space 7
|
||||
|
||||
RomHeaderSoftwareVersion:
|
||||
.byte 0
|
||||
|
||||
RomHeaderChecksum:
|
||||
.byte 0x9D
|
||||
|
||||
RomHeaderReserved2:
|
||||
.space 2
|
@ -5,6 +5,8 @@ SECTIONS
|
||||
.text :
|
||||
ALIGN(4)
|
||||
{
|
||||
asm/crt0.o(.text);
|
||||
asm/arm.o(.text);
|
||||
asm/rom.o(.text);
|
||||
} = 0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user