sovereignx/asm/gpu_bg.s

3357 lines
52 KiB
ArmAsm
Raw Normal View History

2015-11-30 07:17:50 +00:00
thumb_func_start ResetBgs
; void ResetBgs()
ResetBgs: ; 80012F0
2015-10-06 13:46:30 +01:00
push {lr}
2015-11-30 07:17:50 +00:00
bl ResetWramBgControlStructs
2015-10-06 13:46:30 +01:00
ldr r1, =0x030008e0
movs r0, 0
strh r0, [r1, 0x10]
2015-11-30 07:17:50 +00:00
bl SetTextModeAndHideBgs
2015-10-06 13:46:30 +01:00
pop {r0}
bx r0
.pool
2015-11-30 07:17:50 +00:00
thumb_func_end ResetBgs
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start SetBgModeInternal
; void SetBgModeInternal(u8 bgMode)
SetBgModeInternal: ; 8001308
2015-10-06 13:46:30 +01:00
lsls r0, 24
lsrs r0, 24
ldr r3, =0x030008e0
ldrh r2, [r3, 0x10]
ldr r1, =0x0000fff8
ands r1, r2
orrs r1, r0
strh r1, [r3, 0x10]
bx lr
.pool
2015-11-30 07:17:50 +00:00
thumb_func_end SetBgModeInternal
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start GetBgMode
; u8 GetBgMode()
GetBgMode: ; 8001324
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008e0
ldrb r1, [r0, 0x10]
movs r0, 0x7
ands r0, r1
bx lr
.pool
2015-11-30 07:17:50 +00:00
thumb_func_end GetBgMode
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start ResetWramBgControlStructs
; void ResetWramBgControlStructs()
ResetWramBgControlStructs: ; 8001334
2015-10-06 13:46:30 +01:00
push {lr}
ldr r2, =0x030008e0
2015-10-07 04:41:59 +01:00
ldr r0, =gBgConfigZeroValue
2015-10-06 13:46:30 +01:00
ldr r0, [r0]
adds r1, r2, 0
adds r1, 0xC
2015-10-10 11:12:48 +01:00
@08001340:
2015-10-06 13:46:30 +01:00
str r0, [r1]
subs r1, 0x4
cmp r1, r2
2015-10-10 11:12:48 +01:00
bge @08001340
2015-10-06 13:46:30 +01:00
pop {r0}
bx r0
.pool
2015-11-30 07:17:50 +00:00
thumb_func_end ResetWramBgControlStructs
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start Unused_ResetWramBgControlStruct
; void Unused_ResetWramBgControlStruct(u8 bg)
Unused_ResetWramBgControlStruct: ; 8001354
2015-10-06 13:46:30 +01:00
push {r4,lr}
lsls r0, 24
lsrs r4, r0, 24
adds r0, r4, 0
2015-11-30 07:17:50 +00:00
bl IsInvalidBg
2015-10-06 13:46:30 +01:00
lsls r0, 24
cmp r0, 0
2015-10-10 11:12:48 +01:00
bne @08001372
2015-10-06 13:46:30 +01:00
ldr r1, =0x030008e0
lsls r0, r4, 2
adds r0, r1
2015-10-07 04:41:59 +01:00
ldr r1, =gBgConfigZeroValue
2015-10-06 13:46:30 +01:00
ldr r1, [r1]
str r1, [r0]
2015-10-10 11:12:48 +01:00
@08001372:
2015-10-06 13:46:30 +01:00
pop {r4}
pop {r0}
bx r0
.pool
2015-11-30 07:17:50 +00:00
thumb_func_end Unused_ResetWramBgControlStruct
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start SetBgControlAttributes
; void SetBgControlAttributes(u8 bg, u8 tilesBaseBlock, u8 tileMapBaseBlock, u8 screenSize, u8 paletteMode, u8 priority, u8 mosaic, u8 wraparound)
SetBgControlAttributes: ; 8001380
2015-10-06 13:46:30 +01:00
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x10
ldr r4, [sp, 0x30]
ldr r5, [sp, 0x34]
ldr r6, [sp, 0x38]
mov r12, r6
ldr r6, [sp, 0x3C]
mov r8, r6
lsls r0, 24
lsrs r7, r0, 24
str r7, [sp]
lsls r1, 24
lsrs r1, 24
mov r10, r1
lsls r2, 24
lsrs r6, r2, 24
lsls r3, 24
lsrs r3, 24
mov r9, r3
lsls r4, 24
lsrs r4, 24
str r4, [sp, 0x4]
lsls r5, 24
lsrs r5, 24
mov r0, r12
lsls r0, 24
lsrs r4, r0, 24
mov r1, r8
lsls r1, 24
lsrs r1, 24
str r1, [sp, 0xC]
adds r0, r7, 0
2015-11-30 07:17:50 +00:00
bl IsInvalidBg
2015-10-06 13:46:30 +01:00
lsls r0, 24
lsrs r0, 24
mov r12, r0
cmp r0, 0
2015-10-10 11:12:48 +01:00
bne @08001498
2015-10-06 13:46:30 +01:00
ldr r2, =0x030008e0
mov r8, r2
mov r0, r10
cmp r0, 0xFF
2015-10-10 11:12:48 +01:00
beq @080013F4
2015-10-06 13:46:30 +01:00
lsls r2, r7, 2
add r2, r8
movs r1, 0x3
ands r1, r0
ldrb r3, [r2, 0x1]
movs r0, 0x4
negs r0, r0
ands r0, r3
orrs r0, r1
strb r0, [r2, 0x1]
2015-10-10 11:12:48 +01:00
@080013F4:
2015-10-06 13:46:30 +01:00
cmp r6, 0xFF
2015-10-10 11:12:48 +01:00
beq @0800140C
2015-10-06 13:46:30 +01:00
lsls r1, r7, 2
add r1, r8
movs r0, 0x1F
ands r6, r0
lsls r3, r6, 2
ldrb r2, [r1, 0x1]
subs r0, 0x9C
ands r0, r2
orrs r0, r3
strb r0, [r1, 0x1]
2015-10-10 11:12:48 +01:00
@0800140C:
2015-10-06 13:46:30 +01:00
mov r1, r9
cmp r1, 0xFF
2015-10-10 11:12:48 +01:00
beq @08001428
2015-10-06 13:46:30 +01:00
lsls r1, r7, 2
add r1, r8
movs r0, 0x3
mov r2, r9
ands r2, r0
lsls r3, r2, 2
ldrb r2, [r1]
subs r0, 0x10
ands r0, r2
orrs r0, r3
strb r0, [r1]
2015-10-10 11:12:48 +01:00
@08001428:
2015-10-06 13:46:30 +01:00
ldr r6, [sp, 0x4]
cmp r6, 0xFF
2015-10-10 11:12:48 +01:00
beq @0800143E
2015-10-06 13:46:30 +01:00
lsls r1, r7, 2
add r1, r8
lsls r3, r6, 7
ldrb r2, [r1, 0x1]
movs r0, 0x7F
ands r0, r2
orrs r0, r3
strb r0, [r1, 0x1]
2015-10-10 11:12:48 +01:00
@0800143E:
2015-10-06 13:46:30 +01:00
cmp r5, 0xFF
2015-10-10 11:12:48 +01:00
beq @08001456
2015-10-06 13:46:30 +01:00
lsls r1, r7, 2
add r1, r8
movs r0, 0x3
ands r5, r0
lsls r3, r5, 4
ldrb r2, [r1]
subs r0, 0x34
ands r0, r2
orrs r0, r3
strb r0, [r1]
2015-10-10 11:12:48 +01:00
@08001456:
2015-10-06 13:46:30 +01:00
cmp r4, 0xFF
2015-10-10 11:12:48 +01:00
beq @0800146E
2015-10-06 13:46:30 +01:00
lsls r1, r7, 2
add r1, r8
movs r0, 0x1
ands r4, r0
lsls r3, r4, 6
ldrb r2, [r1]
subs r0, 0x42
ands r0, r2
orrs r0, r3
strb r0, [r1]
2015-10-10 11:12:48 +01:00
@0800146E:
2015-10-06 13:46:30 +01:00
ldr r0, [sp, 0xC]
cmp r0, 0xFF
2015-10-10 11:12:48 +01:00
beq @08001484
2015-10-06 13:46:30 +01:00
lsls r1, r7, 2
add r1, r8
lsls r3, r0, 7
ldrb r2, [r1]
movs r0, 0x7F
ands r0, r2
orrs r0, r3
strb r0, [r1]
2015-10-10 11:12:48 +01:00
@08001484:
2015-10-06 13:46:30 +01:00
ldr r1, [sp]
lsls r0, r1, 2
add r0, r8
mov r2, r12
strb r2, [r0, 0x2]
strb r2, [r0, 0x3]
ldrb r1, [r0]
movs r2, 0x1
orrs r1, r2
strb r1, [r0]
2015-10-10 11:12:48 +01:00
@08001498:
2015-10-06 13:46:30 +01:00
add sp, 0x10
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
2015-11-30 07:17:50 +00:00
thumb_func_end SetBgControlAttributes
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start GetBgControlAttribute
; u8 GetBgControlAttribute(u8 bg, u8 attributeId)
GetBgControlAttribute: ; 80014AC
2015-10-06 13:46:30 +01:00
push {r4,r5,lr}
lsls r0, 24
lsrs r4, r0, 24
lsls r1, 24
lsrs r5, r1, 24
adds r0, r4, 0
2015-11-30 07:17:50 +00:00
bl IsInvalidBg
2015-10-06 13:46:30 +01:00
lsls r0, 24
cmp r0, 0
2015-10-10 11:12:48 +01:00
bne @08001558
2015-10-06 13:46:30 +01:00
ldr r1, =0x030008e0
lsls r2, r4, 2
adds r0, r2, r1
ldrb r0, [r0]
lsls r0, 31
adds r3, r1, 0
cmp r0, 0
2015-10-10 11:12:48 +01:00
beq @08001558
2015-10-06 13:46:30 +01:00
subs r0, r5, 0x1
cmp r0, 0x7
2015-10-10 11:12:48 +01:00
bhi @08001558
2015-10-06 13:46:30 +01:00
lsls r0, 2
2015-10-10 11:12:48 +01:00
ldr r1, =@080014EC
2015-10-06 13:46:30 +01:00
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
2015-10-10 11:12:48 +01:00
@080014EC:
.4byte @0800150C
.4byte @08001516
.4byte @08001520
.4byte @0800152A
.4byte @08001534
.4byte @0800153C
.4byte @08001546
.4byte @08001550
@0800150C:
2015-10-06 13:46:30 +01:00
adds r0, r2, r3
ldrb r0, [r0]
lsls r0, 31
lsrs r0, 31
2015-10-10 11:12:48 +01:00
b @0800155A
@08001516:
2015-10-06 13:46:30 +01:00
adds r0, r2, r3
ldrb r0, [r0, 0x1]
lsls r0, 30
lsrs r0, 30
2015-10-10 11:12:48 +01:00
b @0800155A
@08001520:
2015-10-06 13:46:30 +01:00
adds r0, r2, r3
ldrb r0, [r0, 0x1]
lsls r0, 25
lsrs r0, 27
2015-10-10 11:12:48 +01:00
b @0800155A
@0800152A:
2015-10-06 13:46:30 +01:00
adds r0, r2, r3
ldrb r0, [r0]
lsls r0, 28
lsrs r0, 30
2015-10-10 11:12:48 +01:00
b @0800155A
@08001534:
2015-10-06 13:46:30 +01:00
adds r0, r2, r3
ldrb r0, [r0, 0x1]
lsrs r0, 7
2015-10-10 11:12:48 +01:00
b @0800155A
@0800153C:
2015-10-06 13:46:30 +01:00
adds r0, r2, r3
ldrb r0, [r0]
lsls r0, 26
lsrs r0, 30
2015-10-10 11:12:48 +01:00
b @0800155A
@08001546:
2015-10-06 13:46:30 +01:00
adds r0, r2, r3
ldrb r0, [r0]
lsls r0, 25
lsrs r0, 31
2015-10-10 11:12:48 +01:00
b @0800155A
@08001550:
2015-10-06 13:46:30 +01:00
adds r0, r2, r3
ldrb r0, [r0]
lsrs r0, 7
2015-10-10 11:12:48 +01:00
b @0800155A
@08001558:
2015-10-06 13:46:30 +01:00
movs r0, 0xFF
2015-10-10 11:12:48 +01:00
@0800155A:
2015-10-06 13:46:30 +01:00
pop {r4,r5}
pop {r1}
bx r1
2015-11-30 07:17:50 +00:00
thumb_func_end GetBgControlAttribute
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start LoadBgVram
; u8 LoadBgVram(u8, void *src, u16 size, u16 destOffset, u8 mode)
LoadBgVram: ; 8001560
2015-10-06 13:46:30 +01:00
push {r4-r7,lr}
mov r7, r8
push {r7}
mov r8, r1
ldr r1, [sp, 0x18]
lsls r0, 24
lsrs r4, r0, 24
lsls r2, 16
lsrs r7, r2, 16
lsls r3, 16
lsrs r6, r3, 16
lsls r1, 24
lsrs r5, r1, 24
adds r0, r4, 0
2015-11-30 07:17:50 +00:00
bl IsInvalidBg
2015-10-06 13:46:30 +01:00
lsls r0, 24
cmp r0, 0
2015-10-10 11:12:48 +01:00
bne @080015D8
2015-10-06 13:46:30 +01:00
ldr r1, =0x030008e0
lsls r0, r4, 2
adds r1, r0, r1
ldrb r0, [r1]
lsls r0, 31
cmp r0, 0
2015-10-10 11:12:48 +01:00
beq @080015D8
2015-10-06 13:46:30 +01:00
cmp r5, 0x1
2015-10-10 11:12:48 +01:00
beq @080015A4
2015-10-06 13:46:30 +01:00
cmp r5, 0x2
2015-10-10 11:12:48 +01:00
beq @080015AC
2015-10-06 13:46:30 +01:00
movs r2, 0xFF
2015-10-10 11:12:48 +01:00
b @080015DC
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@080015A4:
2015-10-06 13:46:30 +01:00
ldrb r0, [r1, 0x1]
lsls r0, 30
lsrs r0, 16
2015-10-10 11:12:48 +01:00
b @080015B4
@080015AC:
2015-10-06 13:46:30 +01:00
ldrb r0, [r1, 0x1]
lsls r0, 25
lsrs r0, 27
lsls r0, 11
2015-10-10 11:12:48 +01:00
@080015B4:
2015-10-06 13:46:30 +01:00
adds r0, r6, r0
lsls r0, 16
lsrs r0, 16
movs r1, 0xC0
lsls r1, 19
adds r1, r0, r1
mov r0, r8
adds r2, r7, 0
movs r3, 0
bl RequestDma3Copy
2015-10-06 13:46:30 +01:00
lsls r0, 24
lsrs r2, r0, 24
asrs r0, 24
movs r1, 0x1
negs r1, r1
cmp r0, r1
2015-10-10 11:12:48 +01:00
bne @080015DC
@080015D8:
2015-10-06 13:46:30 +01:00
movs r0, 0xFF
2015-10-10 11:12:48 +01:00
b @080015DE
@080015DC:
2015-10-06 13:46:30 +01:00
adds r0, r2, 0
2015-10-10 11:12:48 +01:00
@080015DE:
2015-10-06 13:46:30 +01:00
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r1}
bx r1
2015-11-30 07:17:50 +00:00
thumb_func_end LoadBgVram
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start ShowBgInternal
; void ShowBgInternal(u8 bg)
ShowBgInternal: ; 80015E8
2015-10-06 13:46:30 +01:00
push {r4,r5,lr}
lsls r0, 24
lsrs r4, r0, 24
adds r0, r4, 0
2015-11-30 07:17:50 +00:00
bl IsInvalidBg
2015-10-06 13:46:30 +01:00
lsls r0, 24
cmp r0, 0
2015-10-10 11:12:48 +01:00
bne @08001656
2015-10-06 13:46:30 +01:00
ldr r5, =0x030008e0
lsls r0, r4, 2
adds r2, r0, r5
ldrb r3, [r2]
lsls r0, r3, 31
cmp r0, 0
2015-10-10 11:12:48 +01:00
beq @08001656
2015-10-06 13:46:30 +01:00
lsls r1, r3, 26
lsrs r1, 30
ldrb r2, [r2, 0x1]
lsls r0, r2, 30
lsrs r0, 28
orrs r1, r0
movs r0, 0x40
ands r0, r3
orrs r1, r0
lsrs r0, r2, 7
lsls r0, 7
orrs r1, r0
lsls r2, 25
lsrs r2, 27
lsls r2, 8
orrs r1, r2
lsrs r0, r3, 7
lsls r0, 13
orrs r1, r0
lsls r0, r3, 28
lsrs r0, 30
lsls r0, 14
orrs r1, r0
lsls r0, r4, 25
movs r2, 0x80
lsls r2, 20
adds r0, r2
lsrs r0, 24
2015-11-30 07:17:50 +00:00
bl SetGpuReg
2015-10-06 13:46:30 +01:00
adds r1, r4, 0
adds r1, 0x8
movs r0, 0x1
lsls r0, r1
ldrh r1, [r5, 0x10]
orrs r0, r1
ldr r1, =0x00000f07
ands r0, r1
strh r0, [r5, 0x10]
2015-10-10 11:12:48 +01:00
@08001656:
2015-10-06 13:46:30 +01:00
pop {r4,r5}
pop {r0}
bx r0
.pool
2015-11-30 07:17:50 +00:00
thumb_func_end ShowBgInternal
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start HideBgInternal
; void HideBgInternal(u8 bg)
HideBgInternal: ; 8001664
2015-10-06 13:46:30 +01:00
push {r4,lr}
lsls r0, 24
lsrs r4, r0, 24
adds r0, r4, 0
2015-11-30 07:17:50 +00:00
bl IsInvalidBg
2015-10-06 13:46:30 +01:00
lsls r0, 24
cmp r0, 0
2015-10-10 11:12:48 +01:00
bne @0800168A
2015-10-06 13:46:30 +01:00
ldr r2, =0x030008e0
adds r0, r4, 0
adds r0, 0x8
movs r1, 0x1
lsls r1, r0
ldrh r0, [r2, 0x10]
bics r0, r1
ldr r1, =0x00000f07
ands r0, r1
strh r0, [r2, 0x10]
2015-10-10 11:12:48 +01:00
@0800168A:
2015-10-06 13:46:30 +01:00
pop {r4}
pop {r0}
bx r0
.pool
2015-11-30 07:17:50 +00:00
thumb_func_end HideBgInternal
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start SyncBgVisibilityAndMode
; void SyncBgVisibilityAndMode()
SyncBgVisibilityAndMode: ; 8001698
2015-10-06 13:46:30 +01:00
push {lr}
movs r0, 0
2015-11-30 07:17:50 +00:00
bl GetGpuReg
2015-10-06 13:46:30 +01:00
ldr r1, =0x0000f0f8
ands r1, r0
ldr r0, =0x030008e0
ldrh r0, [r0, 0x10]
orrs r1, r0
movs r0, 0
2015-11-30 07:17:50 +00:00
bl SetGpuReg
2015-10-06 13:46:30 +01:00
pop {r0}
bx r0
.pool
2015-11-30 07:17:50 +00:00
thumb_func_end SyncBgVisibilityAndMode
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start SetTextModeAndHideBgs
; void SetTextModeAndHideBgs()
SetTextModeAndHideBgs: ; 80016BC
2015-10-06 13:46:30 +01:00
push {lr}
movs r0, 0
2015-11-30 07:17:50 +00:00
bl GetGpuReg
2015-10-06 13:46:30 +01:00
ldr r1, =0x0000f0f8
ands r1, r0
movs r0, 0
2015-11-30 07:17:50 +00:00
bl SetGpuReg
2015-10-06 13:46:30 +01:00
pop {r0}
bx r0
.pool
2015-11-30 07:17:50 +00:00
thumb_func_end SetTextModeAndHideBgs
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start SetBgAffineInternal
; void SetBgAffineInternal(u8 bg, u16 srcCenterX, u16 srcCenterY, u16 dispCenterX, u16 dispCenterY, u16 scaleX, u16 scaleY, u16 rotationAngle)
SetBgAffineInternal: ; 80016D8
2015-10-06 13:46:30 +01:00
push {r4-r7,lr}
mov r7, r8
push {r7}
sub sp, 0x24
mov r12, r1
mov r8, r2
ldr r1, [sp, 0x3C]
ldr r2, [sp, 0x40]
ldr r4, [sp, 0x44]
ldr r5, [sp, 0x48]
lsls r0, 24
lsrs r6, r0, 24
lsls r3, 16
lsrs r3, 16
lsls r1, 16
lsrs r7, r1, 16
lsls r2, 16
lsrs r2, 16
lsls r4, 16
lsrs r4, 16
lsls r5, 16
lsrs r5, 16
ldr r0, =0x030008e0
ldrh r0, [r0, 0x10]
movs r1, 0x7
ands r1, r0
cmp r1, 0x1
2015-10-10 11:12:48 +01:00
beq @08001720
2015-10-06 13:46:30 +01:00
cmp r1, 0x1
2015-10-10 11:12:48 +01:00
ble @08001796
2015-10-06 13:46:30 +01:00
cmp r1, 0x2
2015-10-10 11:12:48 +01:00
beq @08001726
b @08001796
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@08001720:
2015-10-06 13:46:30 +01:00
cmp r6, 0x2
2015-10-10 11:12:48 +01:00
bne @08001796
b @08001730
@08001726:
2015-10-06 13:46:30 +01:00
subs r0, r6, 0x2
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
2015-10-10 11:12:48 +01:00
bhi @08001796
@08001730:
2015-10-06 13:46:30 +01:00
mov r0, r12
str r0, [sp]
mov r0, r8
str r0, [sp, 0x4]
mov r0, sp
strh r3, [r0, 0x8]
strh r7, [r0, 0xA]
strh r2, [r0, 0xC]
strh r4, [r0, 0xE]
strh r5, [r0, 0x10]
add r4, sp, 0x14
adds r1, r4, 0
movs r2, 0x1
bl BgAffineSet
ldrh r1, [r4]
movs r0, 0x20
2015-11-30 07:17:50 +00:00
bl SetGpuReg
2015-10-06 13:46:30 +01:00
ldrh r1, [r4, 0x2]
movs r0, 0x22
2015-11-30 07:17:50 +00:00
bl SetGpuReg
2015-10-06 13:46:30 +01:00
ldrh r1, [r4, 0x4]
movs r0, 0x24
2015-11-30 07:17:50 +00:00
bl SetGpuReg
2015-10-06 13:46:30 +01:00
ldrh r1, [r4, 0x6]
movs r0, 0x26
2015-11-30 07:17:50 +00:00
bl SetGpuReg
2015-10-06 13:46:30 +01:00
ldrh r1, [r4]
movs r0, 0x20
2015-11-30 07:17:50 +00:00
bl SetGpuReg
2015-10-06 13:46:30 +01:00
ldrh r1, [r4, 0x8]
movs r0, 0x28
2015-11-30 07:17:50 +00:00
bl SetGpuReg
2015-10-06 13:46:30 +01:00
ldrh r1, [r4, 0xA]
movs r0, 0x2A
2015-11-30 07:17:50 +00:00
bl SetGpuReg
2015-10-06 13:46:30 +01:00
ldrh r1, [r4, 0xC]
movs r0, 0x2C
2015-11-30 07:17:50 +00:00
bl SetGpuReg
2015-10-06 13:46:30 +01:00
ldrh r1, [r4, 0xE]
movs r0, 0x2E
2015-11-30 07:17:50 +00:00
bl SetGpuReg
2015-10-10 11:12:48 +01:00
@08001796:
2015-10-06 13:46:30 +01:00
add sp, 0x24
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
2015-11-30 07:17:50 +00:00
thumb_func_end SetBgAffineInternal
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start IsInvalidBg
; BOOL IsInvalidBg(u8 bg)
IsInvalidBg: ; 80017A4
2015-10-06 13:46:30 +01:00
push {lr}
lsls r0, 24
lsrs r0, 24
cmp r0, 0x3
2015-10-10 11:12:48 +01:00
bhi @080017B2
2015-10-06 13:46:30 +01:00
movs r0, 0
2015-10-10 11:12:48 +01:00
b @080017B4
@080017B2:
2015-10-06 13:46:30 +01:00
movs r0, 0x1
2015-10-10 11:12:48 +01:00
@080017B4:
2015-10-06 13:46:30 +01:00
pop {r1}
bx r1
2015-11-30 07:17:50 +00:00
thumb_func_end IsInvalidBg
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start DummiedOutFireRedLeafGreenTileAllocFunc
; int DummiedOutFireRedLeafGreenTileAllocFunc()
DummiedOutFireRedLeafGreenTileAllocFunc: ; 80017B8
2015-10-06 13:46:30 +01:00
movs r0, 0
bx lr
2015-11-30 07:17:50 +00:00
thumb_func_end DummiedOutFireRedLeafGreenTileAllocFunc
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start ResetBgsAndClearDma3BusyFlags
; void ResetBgsAndClearDma3BusyFlags(u32 leftoverFireRedLeafGreenVariable)
ResetBgsAndClearDma3BusyFlags: ; 80017BC
2015-10-06 13:46:30 +01:00
push {r4,lr}
adds r4, r0, 0
2015-11-30 07:17:50 +00:00
bl ResetBgs
2015-10-06 13:46:30 +01:00
ldr r1, =0x03000938
movs r2, 0
adds r0, r1, 0
adds r0, 0xC
2015-10-10 11:12:48 +01:00
@080017CC:
2015-10-06 13:46:30 +01:00
str r2, [r0]
subs r0, 0x4
cmp r0, r1
2015-10-10 11:12:48 +01:00
bge @080017CC
2015-10-06 13:46:30 +01:00
ldr r0, =0x03002f54
str r4, [r0]
pop {r4}
pop {r0}
bx r0
.pool
2015-11-30 07:17:50 +00:00
thumb_func_end ResetBgsAndClearDma3BusyFlags
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start InitBgsFromTemplates
; void InitBgsFromTemplates(u8 bgMode, struct BgTemplate *templates, u8 numTemplates)
InitBgsFromTemplates: ; 80017E8
2015-10-06 13:46:30 +01:00
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x10
adds r5, r1, 0
lsls r0, 24
lsrs r0, 24
lsls r2, 24
lsrs r4, r2, 24
2015-11-30 07:17:50 +00:00
bl SetBgModeInternal
bl ResetWramBgControlStructs
2015-10-06 13:46:30 +01:00
cmp r4, 0
2015-10-10 11:12:48 +01:00
beq @08001894
2015-10-06 13:46:30 +01:00
movs r7, 0
ldr r0, =0x030008f8
mov r9, r0
movs r2, 0xC
add r2, r9
mov r10, r2
adds r6, r5, 0
mov r8, r4
2015-10-10 11:12:48 +01:00
@0800181A:
2015-10-06 13:46:30 +01:00
ldr r4, [r6]
lsls r0, r4, 30
lsrs r5, r0, 30
cmp r5, 0x3
2015-10-10 11:12:48 +01:00
bhi @08001886
2015-10-06 13:46:30 +01:00
lsls r1, r4, 28
lsrs r1, 30
lsls r2, r4, 23
lsrs r2, 27
lsls r3, r4, 21
lsrs r3, 30
lsls r0, r4, 20
lsrs r0, 31
str r0, [sp]
lsls r0, r4, 18
lsrs r0, 30
str r0, [sp, 0x4]
str r7, [sp, 0x8]
str r7, [sp, 0xC]
adds r0, r5, 0
2015-11-30 07:17:50 +00:00
bl SetBgControlAttributes
2015-10-06 13:46:30 +01:00
lsls r4, r5, 4
mov r5, r9
adds r3, r4, r5
ldr r2, [r6]
lsls r2, 8
lsrs r2, 22
ldrh r0, [r3]
ldr r5, =0xfffffc00
adds r1, r5, 0
ands r0, r1
orrs r0, r2
strh r0, [r3]
ldrb r0, [r3, 0x1]
movs r2, 0x3D
negs r2, r2
adds r1, r2, 0
ands r0, r1
strb r0, [r3, 0x1]
ldr r0, [r3]
ldr r1, =0x00003fff
ands r0, r1
str r0, [r3]
mov r0, r9
adds r0, 0x4
adds r0, r4, r0
str r7, [r0]
mov r0, r9
adds r0, 0x8
adds r0, r4, r0
str r7, [r0]
add r4, r10
str r7, [r4]
2015-10-10 11:12:48 +01:00
@08001886:
2015-10-06 13:46:30 +01:00
adds r6, 0x4
movs r5, 0x1
negs r5, r5
add r8, r5
mov r0, r8
cmp r0, 0
2015-10-10 11:12:48 +01:00
bne @0800181A
@08001894:
2015-10-06 13:46:30 +01:00
add sp, 0x10
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
2015-11-30 07:17:50 +00:00
thumb_func_end InitBgsFromTemplates
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start InitBgFromTemplate
; void InitBgFromTemplate(struct BgTemplate *templates)
InitBgFromTemplate: ; 80018B0
2015-10-06 13:46:30 +01:00
push {r4-r7,lr}
sub sp, 0x10
adds r7, r0, 0
ldr r4, [r7]
lsls r0, r4, 30
lsrs r5, r0, 30
cmp r5, 0x3
2015-10-10 11:12:48 +01:00
bhi @08001920
2015-10-06 13:46:30 +01:00
lsls r1, r4, 28
lsrs r1, 30
lsls r2, r4, 23
lsrs r2, 27
lsls r3, r4, 21
lsrs r3, 30
lsls r0, r4, 20
lsrs r0, 31
str r0, [sp]
lsls r0, r4, 18
lsrs r0, 30
str r0, [sp, 0x4]
movs r6, 0
str r6, [sp, 0x8]
str r6, [sp, 0xC]
adds r0, r5, 0
2015-11-30 07:17:50 +00:00
bl SetBgControlAttributes
2015-10-06 13:46:30 +01:00
ldr r4, =0x030008f8
lsls r5, 4
adds r3, r5, r4
ldr r1, [r7]
lsls r1, 8
lsrs r1, 22
ldrh r2, [r3]
ldr r0, =0xfffffc00
ands r0, r2
orrs r0, r1
strh r0, [r3]
ldrb r1, [r3, 0x1]
movs r0, 0x3D
negs r0, r0
ands r0, r1
strb r0, [r3, 0x1]
ldr r0, [r3]
ldr r1, =0x00003fff
ands r0, r1
str r0, [r3]
adds r0, r4, 0x4
adds r0, r5, r0
str r6, [r0]
adds r0, r4, 0
adds r0, 0x8
adds r0, r5, r0
str r6, [r0]
adds r4, 0xC
adds r5, r4
str r6, [r5]
2015-10-10 11:12:48 +01:00
@08001920:
2015-10-06 13:46:30 +01:00
add sp, 0x10
pop {r4-r7}
pop {r0}
bx r0
.pool
2015-11-30 07:17:50 +00:00
thumb_func_end InitBgFromTemplate
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start SetBgMode
; void SetBgMode(u8 bgMode)
SetBgMode: ; 8001934
2015-10-06 13:46:30 +01:00
push {lr}
lsls r0, 24
lsrs r0, 24
2015-11-30 07:17:50 +00:00
bl SetBgModeInternal
2015-10-06 13:46:30 +01:00
pop {r0}
bx r0
2015-11-30 07:17:50 +00:00
thumb_func_end SetBgMode
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start LoadBgTiles
; u8 LoadBgTiles(u8 bg, void *src, u16 size, u16 destOffset)
LoadBgTiles: ; 8001944
2015-10-06 13:46:30 +01:00
push {r4-r7,lr}
mov r7, r8
push {r7}
sub sp, 0x4
adds r7, r1, 0
lsls r0, 24
lsrs r5, r0, 24
lsls r2, 16
lsrs r2, 16
mov r8, r2
lsls r3, 16
lsrs r4, r3, 16
adds r0, r5, 0
movs r1, 0x5
2015-11-30 07:17:50 +00:00
bl GetBgControlAttribute
2015-10-06 13:46:30 +01:00
lsls r0, 16
cmp r0, 0
2015-10-10 11:12:48 +01:00
bne @08001980
2015-10-06 13:46:30 +01:00
ldr r1, =0x030008f8
lsls r0, r5, 4
adds r0, r1
ldrh r0, [r0]
lsls r0, 22
lsrs r0, 22
adds r0, r4
lsls r0, 21
2015-10-10 11:12:48 +01:00
b @08001990
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@08001980:
2015-10-06 13:46:30 +01:00
ldr r1, =0x030008f8
lsls r0, r5, 4
adds r0, r1
ldrh r0, [r0]
lsls r0, 22
lsrs r0, 22
adds r0, r4
lsls r0, 22
2015-10-10 11:12:48 +01:00
@08001990:
2015-10-06 13:46:30 +01:00
lsrs r4, r0, 16
movs r6, 0x1
str r6, [sp]
adds r0, r5, 0
adds r1, r7, 0
mov r2, r8
adds r3, r4, 0
2015-11-30 07:17:50 +00:00
bl LoadBgVram
2015-10-06 13:46:30 +01:00
lsls r2, r0, 24
lsrs r1, r2, 24
adds r7, r1, 0
cmp r1, 0xFF
2015-10-10 11:12:48 +01:00
bne @080019B8
2015-10-06 13:46:30 +01:00
ldr r0, =0x0000ffff
2015-10-10 11:12:48 +01:00
b @080019E6
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@080019B8:
2015-10-06 13:46:30 +01:00
ldr r0, =0x03000938
lsrs r2, 29
lsls r2, 2
adds r2, r0
movs r0, 0x1F
ands r0, r1
adds r1, r6, 0
lsls r1, r0
ldr r0, [r2]
orrs r0, r1
str r0, [r2]
ldr r0, =0x03002f54
ldr r0, [r0]
cmp r0, 0x1
2015-10-10 11:12:48 +01:00
bne @080019E4
2015-10-06 13:46:30 +01:00
lsrs r1, r4, 5
mov r0, r8
lsrs r2, r0, 5
adds r0, r5, 0
movs r3, 0x1
2015-11-30 07:17:50 +00:00
bl DummiedOutFireRedLeafGreenTileAllocFunc
2015-10-10 11:12:48 +01:00
@080019E4:
2015-10-06 13:46:30 +01:00
adds r0, r7, 0
2015-10-10 11:12:48 +01:00
@080019E6:
2015-10-06 13:46:30 +01:00
add sp, 0x4
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r1}
bx r1
.pool
2015-11-30 07:17:50 +00:00
thumb_func_end LoadBgTiles
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start LoadBgTileMap
; u8 LoadBgTileMap(u8 bg, void *src, u16 size, u16 destOffset)
LoadBgTileMap: ; 80019FC
2015-10-06 13:46:30 +01:00
push {r4,lr}
sub sp, 0x4
lsls r0, 24
lsrs r0, 24
lsls r2, 16
lsrs r2, 16
lsls r3, 17
lsrs r3, 16
movs r4, 0x2
str r4, [sp]
2015-11-30 07:17:50 +00:00
bl LoadBgVram
2015-10-06 13:46:30 +01:00
lsls r2, r0, 24
lsrs r3, r2, 24
cmp r3, 0xFF
2015-10-10 11:12:48 +01:00
beq @08001A3C
2015-10-06 13:46:30 +01:00
ldr r0, =0x03000938
lsrs r2, 29
lsls r2, 2
adds r2, r0
movs r0, 0x1F
ands r0, r3
movs r1, 0x1
lsls r1, r0
ldr r0, [r2]
orrs r0, r1
str r0, [r2]
adds r0, r3, 0
2015-10-10 11:12:48 +01:00
b @08001A3E
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@08001A3C:
2015-10-06 13:46:30 +01:00
ldr r0, =0x0000ffff
2015-10-10 11:12:48 +01:00
@08001A3E:
2015-10-06 13:46:30 +01:00
add sp, 0x4
pop {r4}
pop {r1}
bx r1
.pool
2015-11-30 07:17:50 +00:00
thumb_func_end LoadBgTileMap
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start Unused_LoadBgPalette
; u8 Unused_LoadBgPalette(u8 bg, void *src, u16 size, u16 destOffset)
Unused_LoadBgPalette: ; 8001A4C
2015-10-06 13:46:30 +01:00
push {r4-r7,lr}
adds r7, r1, 0
lsls r0, 24
lsrs r4, r0, 24
lsls r2, 16
lsrs r6, r2, 16
lsls r3, 16
lsrs r5, r3, 16
adds r0, r4, 0
2015-11-30 07:17:50 +00:00
bl IsInvalidBg_
2015-10-06 13:46:30 +01:00
cmp r0, 0
2015-10-10 11:12:48 +01:00
bne @08001A98
2015-10-06 13:46:30 +01:00
ldr r1, =0x030008f8
lsls r0, r4, 4
adds r0, r1
ldrb r1, [r0, 0x1]
lsls r1, 26
lsrs r1, 28
lsls r1, 5
lsls r0, r5, 1
adds r1, r0
lsls r1, 16
lsrs r1, 16
movs r0, 0xA0
lsls r0, 19
adds r1, r0
adds r0, r7, 0
adds r2, r6, 0
movs r3, 0
bl RequestDma3Copy
2015-10-06 13:46:30 +01:00
lsls r3, r0, 24
asrs r1, r3, 24
movs r0, 0x1
negs r0, r0
cmp r1, r0
2015-10-10 11:12:48 +01:00
bne @08001AA4
@08001A98:
2015-10-06 13:46:30 +01:00
ldr r0, =0x0000ffff
2015-10-10 11:12:48 +01:00
b @08001AC8
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@08001AA4:
2015-10-06 13:46:30 +01:00
ldr r4, =0x03000938
adds r0, r1, 0
cmp r1, 0
2015-10-10 11:12:48 +01:00
bge @08001AAE
2015-10-06 13:46:30 +01:00
adds r0, 0x1F
2015-10-10 11:12:48 +01:00
@08001AAE:
2015-10-06 13:46:30 +01:00
asrs r0, 5
lsls r2, r0, 2
adds r2, r4
lsls r0, 5
subs r0, r1, r0
lsls r0, 24
asrs r0, 24
movs r1, 0x1
lsls r1, r0
ldr r0, [r2]
orrs r0, r1
str r0, [r2]
lsrs r0, r3, 24
2015-10-10 11:12:48 +01:00
@08001AC8:
2015-10-06 13:46:30 +01:00
pop {r4-r7}
pop {r1}
bx r1
.pool
2015-11-30 07:17:50 +00:00
thumb_func_end Unused_LoadBgPalette
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start IsDma3ManagerBusyWithBgCopy
; BOOL IsDma3ManagerBusyWithBgCopy()
IsDma3ManagerBusyWithBgCopy: ; 8001AD4
2015-10-06 13:46:30 +01:00
push {r4-r7,lr}
movs r5, 0
movs r7, 0x1
negs r7, r7
2015-10-10 11:12:48 +01:00
@08001ADC:
2015-10-06 13:46:30 +01:00
adds r0, r5, 0
cmp r5, 0
2015-10-10 11:12:48 +01:00
bge @08001AE4
2015-10-06 13:46:30 +01:00
adds r0, 0x1F
2015-10-10 11:12:48 +01:00
@08001AE4:
2015-10-06 13:46:30 +01:00
asrs r0, 5
lsls r2, r0, 24
lsls r0, 5
subs r0, r5, r0
lsls r0, 24
lsrs r0, 24
ldr r1, =0x03000938
lsrs r2, 22
adds r4, r2, r1
movs r6, 0x1
lsls r6, r0
ldr r0, [r4]
ands r0, r6
cmp r0, 0
2015-10-10 11:12:48 +01:00
beq @08001B22
2015-10-06 13:46:30 +01:00
lsls r0, r5, 16
asrs r0, 16
bl CheckForSpaceForDma3Request
2015-10-06 13:46:30 +01:00
lsls r0, 24
asrs r0, 24
cmp r0, r7
2015-10-10 11:12:48 +01:00
bne @08001B1C
2015-10-06 13:46:30 +01:00
movs r0, 0x1
2015-10-10 11:12:48 +01:00
b @08001B2A
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@08001B1C:
2015-10-06 13:46:30 +01:00
ldr r0, [r4]
bics r0, r6
str r0, [r4]
2015-10-10 11:12:48 +01:00
@08001B22:
2015-10-06 13:46:30 +01:00
adds r5, 0x1
cmp r5, 0x7F
2015-10-10 11:12:48 +01:00
ble @08001ADC
2015-10-06 13:46:30 +01:00
movs r0, 0
2015-10-10 11:12:48 +01:00
@08001B2A:
2015-10-06 13:46:30 +01:00
pop {r4-r7}
pop {r1}
bx r1
2015-11-30 07:17:50 +00:00
thumb_func_end IsDma3ManagerBusyWithBgCopy
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start ShowBg
; void ShowBg(u8 bg)
ShowBg: ; 8001B30
2015-10-06 13:46:30 +01:00
push {lr}
lsls r0, 24
lsrs r0, 24
2015-11-30 07:17:50 +00:00
bl ShowBgInternal
bl SyncBgVisibilityAndMode
2015-10-06 13:46:30 +01:00
pop {r0}
bx r0
2015-11-30 07:17:50 +00:00
thumb_func_end ShowBg
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start HideBg
; void HideBg(u8 bg)
HideBg: ; 8001B44
2015-10-06 13:46:30 +01:00
push {lr}
lsls r0, 24
lsrs r0, 24
2015-11-30 07:17:50 +00:00
bl HideBgInternal
bl SyncBgVisibilityAndMode
2015-10-06 13:46:30 +01:00
pop {r0}
bx r0
2015-11-30 07:17:50 +00:00
thumb_func_end HideBg
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start SetBgAttribute
; void SetBgAttribute(u8 bg, u8 attributeId, u8 value)
SetBgAttribute: ; 8001B58
2015-10-06 13:46:30 +01:00
push {r4,lr}
sub sp, 0x10
lsls r0, 24
lsrs r4, r0, 24
lsls r1, 24
lsrs r1, 24
lsls r2, 24
lsrs r3, r2, 24
subs r0, r1, 0x1
cmp r0, 0x6
2015-10-10 11:12:48 +01:00
bhi @08001C12
2015-10-06 13:46:30 +01:00
lsls r0, 2
2015-10-10 11:12:48 +01:00
ldr r1, =@08001B7C
2015-10-06 13:46:30 +01:00
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
2015-10-10 11:12:48 +01:00
@08001B7C:
.4byte @08001B98
.4byte @08001BA8
.4byte @08001BBA
.4byte @08001BD0
.4byte @08001BE4
.4byte @08001BFC
.4byte @08001BDA
@08001B98:
2015-10-06 13:46:30 +01:00
movs r0, 0xFF
str r0, [sp]
str r0, [sp, 0x4]
str r0, [sp, 0x8]
str r0, [sp, 0xC]
adds r0, r4, 0
adds r1, r3, 0
2015-10-10 11:12:48 +01:00
b @08001BF2
@08001BA8:
2015-10-06 13:46:30 +01:00
movs r0, 0xFF
str r0, [sp]
str r0, [sp, 0x4]
str r0, [sp, 0x8]
str r0, [sp, 0xC]
adds r0, r4, 0
movs r1, 0xFF
adds r2, r3, 0
2015-10-10 11:12:48 +01:00
b @08001BF4
@08001BBA:
2015-10-06 13:46:30 +01:00
movs r0, 0xFF
str r0, [sp]
str r0, [sp, 0x4]
str r0, [sp, 0x8]
str r0, [sp, 0xC]
adds r0, r4, 0
movs r1, 0xFF
movs r2, 0xFF
2015-11-30 07:17:50 +00:00
bl SetBgControlAttributes
2015-10-10 11:12:48 +01:00
b @08001C12
@08001BD0:
2015-10-06 13:46:30 +01:00
str r3, [sp]
movs r0, 0xFF
str r0, [sp, 0x4]
str r0, [sp, 0x8]
2015-10-10 11:12:48 +01:00
b @08001BEC
@08001BDA:
2015-10-06 13:46:30 +01:00
movs r0, 0xFF
str r0, [sp]
str r3, [sp, 0x4]
str r0, [sp, 0x8]
2015-10-10 11:12:48 +01:00
b @08001BEC
@08001BE4:
2015-10-06 13:46:30 +01:00
movs r0, 0xFF
str r0, [sp]
str r0, [sp, 0x4]
str r3, [sp, 0x8]
2015-10-10 11:12:48 +01:00
@08001BEC:
2015-10-06 13:46:30 +01:00
str r0, [sp, 0xC]
adds r0, r4, 0
movs r1, 0xFF
2015-10-10 11:12:48 +01:00
@08001BF2:
2015-10-06 13:46:30 +01:00
movs r2, 0xFF
2015-10-10 11:12:48 +01:00
@08001BF4:
2015-10-06 13:46:30 +01:00
movs r3, 0xFF
2015-11-30 07:17:50 +00:00
bl SetBgControlAttributes
2015-10-10 11:12:48 +01:00
b @08001C12
@08001BFC:
2015-10-06 13:46:30 +01:00
movs r0, 0xFF
str r0, [sp]
str r0, [sp, 0x4]
str r0, [sp, 0x8]
str r3, [sp, 0xC]
adds r0, r4, 0
movs r1, 0xFF
movs r2, 0xFF
movs r3, 0xFF
2015-11-30 07:17:50 +00:00
bl SetBgControlAttributes
2015-10-10 11:12:48 +01:00
@08001C12:
2015-10-06 13:46:30 +01:00
add sp, 0x10
pop {r4}
pop {r0}
bx r0
2015-11-30 07:17:50 +00:00
thumb_func_end SetBgAttribute
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start GetBgAttribute
; u8 GetBgAttribute(u8 bg, u8 attributeId)
GetBgAttribute: ; 8001C1C
2015-10-06 13:46:30 +01:00
push {r4,lr}
lsls r0, 24
lsrs r4, r0, 24
lsls r1, 24
lsrs r1, 24
subs r0, r1, 0x1
cmp r0, 0x9
2015-10-10 11:12:48 +01:00
bhi @08001CF8
2015-10-06 13:46:30 +01:00
lsls r0, 2
2015-10-10 11:12:48 +01:00
ldr r1, =@08001C3C
2015-10-06 13:46:30 +01:00
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
2015-10-10 11:12:48 +01:00
@08001C3C:
.4byte @08001C64
.4byte @08001C6E
.4byte @08001C78
.4byte @08001C82
.4byte @08001C96
.4byte @08001CA0
.4byte @08001C8C
.4byte @08001CAA
.4byte @08001CD8
.4byte @08001CE4
@08001C64:
2015-10-06 13:46:30 +01:00
adds r0, r4, 0
movs r1, 0x2
2015-11-30 07:17:50 +00:00
bl GetBgControlAttribute
2015-10-10 11:12:48 +01:00
b @08001CDE
@08001C6E:
2015-10-06 13:46:30 +01:00
adds r0, r4, 0
movs r1, 0x3
2015-11-30 07:17:50 +00:00
bl GetBgControlAttribute
2015-10-10 11:12:48 +01:00
b @08001CDE
@08001C78:
2015-10-06 13:46:30 +01:00
adds r0, r4, 0
movs r1, 0x4
2015-11-30 07:17:50 +00:00
bl GetBgControlAttribute
2015-10-10 11:12:48 +01:00
b @08001CDE
@08001C82:
2015-10-06 13:46:30 +01:00
adds r0, r4, 0
movs r1, 0x5
2015-11-30 07:17:50 +00:00
bl GetBgControlAttribute
2015-10-10 11:12:48 +01:00
b @08001CDE
@08001C8C:
2015-10-06 13:46:30 +01:00
adds r0, r4, 0
movs r1, 0x6
2015-11-30 07:17:50 +00:00
bl GetBgControlAttribute
2015-10-10 11:12:48 +01:00
b @08001CDE
@08001C96:
2015-10-06 13:46:30 +01:00
adds r0, r4, 0
movs r1, 0x7
2015-11-30 07:17:50 +00:00
bl GetBgControlAttribute
2015-10-10 11:12:48 +01:00
b @08001CDE
@08001CA0:
2015-10-06 13:46:30 +01:00
adds r0, r4, 0
movs r1, 0x8
2015-11-30 07:17:50 +00:00
bl GetBgControlAttribute
2015-10-10 11:12:48 +01:00
b @08001CDE
@08001CAA:
2015-10-06 13:46:30 +01:00
adds r0, r4, 0
2015-11-30 07:17:50 +00:00
bl GetBgType
2015-10-06 13:46:30 +01:00
cmp r0, 0
2015-10-10 11:12:48 +01:00
beq @08001CBC
2015-10-06 13:46:30 +01:00
cmp r0, 0x1
2015-10-10 11:12:48 +01:00
beq @08001CCA
2015-10-06 13:46:30 +01:00
movs r0, 0
2015-10-10 11:12:48 +01:00
b @08001CFA
@08001CBC:
2015-10-06 13:46:30 +01:00
adds r0, r4, 0
movs r1, 0
2015-11-30 07:17:50 +00:00
bl GetBgMetricTextMode
2015-10-06 13:46:30 +01:00
lsls r0, 27
lsrs r0, 16
2015-10-10 11:12:48 +01:00
b @08001CFA
@08001CCA:
2015-10-06 13:46:30 +01:00
adds r0, r4, 0
movs r1, 0
2015-11-30 07:17:50 +00:00
bl GetBgMetricAffineMode
2015-10-06 13:46:30 +01:00
lsls r0, 24
lsrs r0, 16
2015-10-10 11:12:48 +01:00
b @08001CFA
@08001CD8:
2015-10-06 13:46:30 +01:00
adds r0, r4, 0
2015-11-30 07:17:50 +00:00
bl GetBgType
2015-10-10 11:12:48 +01:00
@08001CDE:
2015-10-06 13:46:30 +01:00
lsls r0, 16
lsrs r0, 16
2015-10-10 11:12:48 +01:00
b @08001CFA
@08001CE4:
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
lsls r1, r4, 4
adds r1, r0
ldrh r0, [r1]
lsls r0, 22
lsrs r0, 22
2015-10-10 11:12:48 +01:00
b @08001CFA
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@08001CF8:
2015-10-06 13:46:30 +01:00
ldr r0, =0x0000ffff
2015-10-10 11:12:48 +01:00
@08001CFA:
2015-10-06 13:46:30 +01:00
pop {r4}
pop {r1}
bx r1
.pool
2015-11-30 07:17:50 +00:00
thumb_func_end GetBgAttribute
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start ChangeBgX
; u32 ChangeBgX(u8 bg, u32 value, u8 op)
ChangeBgX: ; 8001D04
2015-10-06 13:46:30 +01:00
push {r4-r6,lr}
adds r6, r1, 0
lsls r0, 24
lsrs r4, r0, 24
lsls r2, 24
lsrs r5, r2, 24
adds r0, r4, 0
2015-11-30 07:17:50 +00:00
bl IsInvalidBg_
2015-10-06 13:46:30 +01:00
cmp r0, 0
2015-10-10 11:12:48 +01:00
bne @08001D28
2015-10-06 13:46:30 +01:00
adds r0, r4, 0
movs r1, 0x1
2015-11-30 07:17:50 +00:00
bl GetBgControlAttribute
2015-10-06 13:46:30 +01:00
lsls r0, 16
cmp r0, 0
2015-10-10 11:12:48 +01:00
bne @08001D2E
@08001D28:
2015-10-06 13:46:30 +01:00
movs r0, 0x1
negs r0, r0
2015-10-10 11:12:48 +01:00
b @08001E34
@08001D2E:
2015-10-06 13:46:30 +01:00
cmp r5, 0x1
2015-10-10 11:12:48 +01:00
beq @08001D4C
2015-10-06 13:46:30 +01:00
cmp r5, 0x1
2015-10-10 11:12:48 +01:00
ble @08001D3A
2015-10-06 13:46:30 +01:00
cmp r5, 0x2
2015-10-10 11:12:48 +01:00
beq @08001D60
@08001D3A:
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
lsls r1, r4, 4
adds r0, 0x8
adds r0, r1, r0
str r6, [r0]
adds r5, r1, 0
2015-10-10 11:12:48 +01:00
b @08001D70
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@08001D4C:
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
lsls r2, r4, 4
adds r0, 0x8
adds r0, r2, r0
ldr r1, [r0]
adds r1, r6
2015-10-10 11:12:48 +01:00
b @08001D6C
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@08001D60:
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
lsls r2, r4, 4
adds r0, 0x8
adds r0, r2, r0
ldr r1, [r0]
subs r1, r6
2015-10-10 11:12:48 +01:00
@08001D6C:
2015-10-06 13:46:30 +01:00
str r1, [r0]
adds r5, r2, 0
2015-10-10 11:12:48 +01:00
@08001D70:
2015-11-30 07:17:50 +00:00
bl GetBgMode
2015-10-06 13:46:30 +01:00
lsls r0, 24
lsrs r0, 24
cmp r4, 0x1
2015-10-10 11:12:48 +01:00
beq @08001DAC
2015-10-06 13:46:30 +01:00
cmp r4, 0x1
2015-10-10 11:12:48 +01:00
bgt @08001D8C
2015-10-06 13:46:30 +01:00
cmp r4, 0
2015-10-10 11:12:48 +01:00
beq @08001D96
b @08001E2C
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@08001D8C:
2015-10-06 13:46:30 +01:00
cmp r4, 0x2
2015-10-10 11:12:48 +01:00
beq @08001DC0
2015-10-06 13:46:30 +01:00
cmp r4, 0x3
2015-10-10 11:12:48 +01:00
beq @08001DF8
b @08001E2C
@08001D96:
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
ldr r0, [r0, 0x8]
lsls r0, 8
lsrs r1, r0, 16
movs r0, 0x10
2015-11-30 07:17:50 +00:00
bl SetGpuReg
2015-10-10 11:12:48 +01:00
b @08001E2C
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@08001DAC:
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
ldr r0, [r0, 0x18]
lsls r0, 8
lsrs r1, r0, 16
movs r0, 0x14
2015-11-30 07:17:50 +00:00
bl SetGpuReg
2015-10-10 11:12:48 +01:00
b @08001E2C
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@08001DC0:
2015-10-06 13:46:30 +01:00
cmp r0, 0
2015-10-10 11:12:48 +01:00
bne @08001DD8
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
ldr r0, [r0, 0x28]
lsls r0, 8
lsrs r1, r0, 16
movs r0, 0x18
2015-11-30 07:17:50 +00:00
bl SetGpuReg
2015-10-10 11:12:48 +01:00
b @08001E2C
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@08001DD8:
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
ldr r0, [r0, 0x28]
lsrs r1, r0, 16
lsls r0, 16
lsrs r4, r0, 16
movs r0, 0x2A
2015-11-30 07:17:50 +00:00
bl SetGpuReg
2015-10-06 13:46:30 +01:00
movs r0, 0x28
adds r1, r4, 0
2015-11-30 07:17:50 +00:00
bl SetGpuReg
2015-10-10 11:12:48 +01:00
b @08001E2C
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@08001DF8:
2015-10-06 13:46:30 +01:00
cmp r0, 0
2015-10-10 11:12:48 +01:00
bne @08001E10
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
ldr r0, [r0, 0x38]
lsls r0, 8
lsrs r1, r0, 16
movs r0, 0x1C
2015-11-30 07:17:50 +00:00
bl SetGpuReg
2015-10-10 11:12:48 +01:00
b @08001E2C
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@08001E10:
2015-10-06 13:46:30 +01:00
cmp r0, 0x2
2015-10-10 11:12:48 +01:00
bne @08001E2C
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
ldr r0, [r0, 0x38]
lsrs r1, r0, 16
lsls r0, 16
lsrs r4, r0, 16
movs r0, 0x3A
2015-11-30 07:17:50 +00:00
bl SetGpuReg
2015-10-06 13:46:30 +01:00
movs r0, 0x38
adds r1, r4, 0
2015-11-30 07:17:50 +00:00
bl SetGpuReg
2015-10-10 11:12:48 +01:00
@08001E2C:
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
adds r0, 0x8
adds r0, r5, r0
ldr r0, [r0]
2015-10-10 11:12:48 +01:00
@08001E34:
2015-10-06 13:46:30 +01:00
pop {r4-r6}
pop {r1}
bx r1
.pool
2015-11-30 07:17:50 +00:00
thumb_func_end ChangeBgX
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start GetBgX
; u32 GetBgX(u8 bg)
GetBgX: ; 8001E40
2015-10-06 13:46:30 +01:00
push {r4,lr}
lsls r0, 24
lsrs r0, 24
adds r4, r0, 0
2015-11-30 07:17:50 +00:00
bl IsInvalidBg_
2015-10-06 13:46:30 +01:00
cmp r0, 0
2015-10-10 11:12:48 +01:00
bne @08001E70
2015-10-06 13:46:30 +01:00
adds r0, r4, 0
movs r1, 0x1
2015-11-30 07:17:50 +00:00
bl GetBgControlAttribute
2015-10-06 13:46:30 +01:00
lsls r0, 16
cmp r0, 0
2015-10-10 11:12:48 +01:00
beq @08001E70
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
lsls r1, r4, 4
adds r0, 0x8
adds r1, r0
ldr r0, [r1]
2015-10-10 11:12:48 +01:00
b @08001E74
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@08001E70:
2015-10-06 13:46:30 +01:00
movs r0, 0x1
negs r0, r0
2015-10-10 11:12:48 +01:00
@08001E74:
2015-10-06 13:46:30 +01:00
pop {r4}
pop {r1}
bx r1
2015-11-30 07:17:50 +00:00
thumb_func_end GetBgX
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start ChangeBgY
; u32 ChangeBgY(u8 bg, u32 value, u8 op)
ChangeBgY: ; 8001E7C
2015-10-06 13:46:30 +01:00
push {r4-r6,lr}
adds r6, r1, 0
lsls r0, 24
lsrs r4, r0, 24
lsls r2, 24
lsrs r5, r2, 24
adds r0, r4, 0
2015-11-30 07:17:50 +00:00
bl IsInvalidBg_
2015-10-06 13:46:30 +01:00
cmp r0, 0
2015-10-10 11:12:48 +01:00
bne @08001EA0
2015-10-06 13:46:30 +01:00
adds r0, r4, 0
movs r1, 0x1
2015-11-30 07:17:50 +00:00
bl GetBgControlAttribute
2015-10-06 13:46:30 +01:00
lsls r0, 16
cmp r0, 0
2015-10-10 11:12:48 +01:00
bne @08001EA6
@08001EA0:
2015-10-06 13:46:30 +01:00
movs r0, 0x1
negs r0, r0
2015-10-10 11:12:48 +01:00
b @08001FAC
@08001EA6:
2015-10-06 13:46:30 +01:00
cmp r5, 0x1
2015-10-10 11:12:48 +01:00
beq @08001EC4
2015-10-06 13:46:30 +01:00
cmp r5, 0x1
2015-10-10 11:12:48 +01:00
ble @08001EB2
2015-10-06 13:46:30 +01:00
cmp r5, 0x2
2015-10-10 11:12:48 +01:00
beq @08001ED8
@08001EB2:
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
lsls r1, r4, 4
adds r0, 0xC
adds r0, r1, r0
str r6, [r0]
adds r5, r1, 0
2015-10-10 11:12:48 +01:00
b @08001EE8
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@08001EC4:
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
lsls r2, r4, 4
adds r0, 0xC
adds r0, r2, r0
ldr r1, [r0]
adds r1, r6
2015-10-10 11:12:48 +01:00
b @08001EE4
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@08001ED8:
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
lsls r2, r4, 4
adds r0, 0xC
adds r0, r2, r0
ldr r1, [r0]
subs r1, r6
2015-10-10 11:12:48 +01:00
@08001EE4:
2015-10-06 13:46:30 +01:00
str r1, [r0]
adds r5, r2, 0
2015-10-10 11:12:48 +01:00
@08001EE8:
2015-11-30 07:17:50 +00:00
bl GetBgMode
2015-10-06 13:46:30 +01:00
lsls r0, 24
lsrs r0, 24
cmp r4, 0x1
2015-10-10 11:12:48 +01:00
beq @08001F24
2015-10-06 13:46:30 +01:00
cmp r4, 0x1
2015-10-10 11:12:48 +01:00
bgt @08001F04
2015-10-06 13:46:30 +01:00
cmp r4, 0
2015-10-10 11:12:48 +01:00
beq @08001F0E
b @08001FA4
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@08001F04:
2015-10-06 13:46:30 +01:00
cmp r4, 0x2
2015-10-10 11:12:48 +01:00
beq @08001F38
2015-10-06 13:46:30 +01:00
cmp r4, 0x3
2015-10-10 11:12:48 +01:00
beq @08001F70
b @08001FA4
@08001F0E:
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
ldr r0, [r0, 0xC]
lsls r0, 8
lsrs r1, r0, 16
movs r0, 0x12
2015-11-30 07:17:50 +00:00
bl SetGpuReg
2015-10-10 11:12:48 +01:00
b @08001FA4
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@08001F24:
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
ldr r0, [r0, 0x1C]
lsls r0, 8
lsrs r1, r0, 16
movs r0, 0x16
2015-11-30 07:17:50 +00:00
bl SetGpuReg
2015-10-10 11:12:48 +01:00
b @08001FA4
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@08001F38:
2015-10-06 13:46:30 +01:00
cmp r0, 0
2015-10-10 11:12:48 +01:00
bne @08001F50
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
ldr r0, [r0, 0x2C]
lsls r0, 8
lsrs r1, r0, 16
movs r0, 0x1A
2015-11-30 07:17:50 +00:00
bl SetGpuReg
2015-10-10 11:12:48 +01:00
b @08001FA4
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@08001F50:
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
ldr r0, [r0, 0x2C]
lsrs r1, r0, 16
lsls r0, 16
lsrs r4, r0, 16
movs r0, 0x2E
2015-11-30 07:17:50 +00:00
bl SetGpuReg
2015-10-06 13:46:30 +01:00
movs r0, 0x2C
adds r1, r4, 0
2015-11-30 07:17:50 +00:00
bl SetGpuReg
2015-10-10 11:12:48 +01:00
b @08001FA4
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@08001F70:
2015-10-06 13:46:30 +01:00
cmp r0, 0
2015-10-10 11:12:48 +01:00
bne @08001F88
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
ldr r0, [r0, 0x3C]
lsls r0, 8
lsrs r1, r0, 16
movs r0, 0x1E
2015-11-30 07:17:50 +00:00
bl SetGpuReg
2015-10-10 11:12:48 +01:00
b @08001FA4
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@08001F88:
2015-10-06 13:46:30 +01:00
cmp r0, 0x2
2015-10-10 11:12:48 +01:00
bne @08001FA4
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
ldr r0, [r0, 0x3C]
lsrs r1, r0, 16
lsls r0, 16
lsrs r4, r0, 16
movs r0, 0x3E
2015-11-30 07:17:50 +00:00
bl SetGpuReg
2015-10-06 13:46:30 +01:00
movs r0, 0x3C
adds r1, r4, 0
2015-11-30 07:17:50 +00:00
bl SetGpuReg
2015-10-10 11:12:48 +01:00
@08001FA4:
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
adds r0, 0xC
adds r0, r5, r0
ldr r0, [r0]
2015-10-10 11:12:48 +01:00
@08001FAC:
2015-10-06 13:46:30 +01:00
pop {r4-r6}
pop {r1}
bx r1
.pool
2015-11-30 07:17:50 +00:00
thumb_func_end ChangeBgY
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start ChangeBgY_ScreenOff
; u32 ChangeBgY_ScreenOff(u8 bg, u32 value, u8 op)
ChangeBgY_ScreenOff: ; 8001FB8
2015-10-06 13:46:30 +01:00
push {r4-r6,lr}
adds r6, r1, 0
lsls r0, 24
lsrs r4, r0, 24
lsls r2, 24
lsrs r5, r2, 24
adds r0, r4, 0
2015-11-30 07:17:50 +00:00
bl IsInvalidBg_
2015-10-06 13:46:30 +01:00
cmp r0, 0
2015-10-10 11:12:48 +01:00
bne @08001FDC
2015-10-06 13:46:30 +01:00
adds r0, r4, 0
movs r1, 0x1
2015-11-30 07:17:50 +00:00
bl GetBgControlAttribute
2015-10-06 13:46:30 +01:00
lsls r0, 16
cmp r0, 0
2015-10-10 11:12:48 +01:00
bne @08001FE2
@08001FDC:
2015-10-06 13:46:30 +01:00
movs r0, 0x1
negs r0, r0
2015-10-10 11:12:48 +01:00
b @080020E8
@08001FE2:
2015-10-06 13:46:30 +01:00
cmp r5, 0x1
2015-10-10 11:12:48 +01:00
beq @08002000
2015-10-06 13:46:30 +01:00
cmp r5, 0x1
2015-10-10 11:12:48 +01:00
ble @08001FEE
2015-10-06 13:46:30 +01:00
cmp r5, 0x2
2015-10-10 11:12:48 +01:00
beq @08002014
@08001FEE:
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
lsls r1, r4, 4
adds r0, 0xC
adds r0, r1, r0
str r6, [r0]
adds r5, r1, 0
2015-10-10 11:12:48 +01:00
b @08002024
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@08002000:
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
lsls r2, r4, 4
adds r0, 0xC
adds r0, r2, r0
ldr r1, [r0]
adds r1, r6
2015-10-10 11:12:48 +01:00
b @08002020
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@08002014:
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
lsls r2, r4, 4
adds r0, 0xC
adds r0, r2, r0
ldr r1, [r0]
subs r1, r6
2015-10-10 11:12:48 +01:00
@08002020:
2015-10-06 13:46:30 +01:00
str r1, [r0]
adds r5, r2, 0
2015-10-10 11:12:48 +01:00
@08002024:
2015-11-30 07:17:50 +00:00
bl GetBgMode
2015-10-06 13:46:30 +01:00
lsls r0, 24
lsrs r0, 24
cmp r4, 0x1
2015-10-10 11:12:48 +01:00
beq @08002060
2015-10-06 13:46:30 +01:00
cmp r4, 0x1
2015-10-10 11:12:48 +01:00
bgt @08002040
2015-10-06 13:46:30 +01:00
cmp r4, 0
2015-10-10 11:12:48 +01:00
beq @0800204A
b @080020E0
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@08002040:
2015-10-06 13:46:30 +01:00
cmp r4, 0x2
2015-10-10 11:12:48 +01:00
beq @08002074
2015-10-06 13:46:30 +01:00
cmp r4, 0x3
2015-10-10 11:12:48 +01:00
beq @080020AC
b @080020E0
@0800204A:
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
ldr r0, [r0, 0xC]
lsls r0, 8
lsrs r1, r0, 16
movs r0, 0x12
2015-11-30 07:17:50 +00:00
bl SetGpuReg_ScreenOff
2015-10-10 11:12:48 +01:00
b @080020E0
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@08002060:
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
ldr r0, [r0, 0x1C]
lsls r0, 8
lsrs r1, r0, 16
movs r0, 0x16
2015-11-30 07:17:50 +00:00
bl SetGpuReg_ScreenOff
2015-10-10 11:12:48 +01:00
b @080020E0
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@08002074:
2015-10-06 13:46:30 +01:00
cmp r0, 0
2015-10-10 11:12:48 +01:00
bne @0800208C
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
ldr r0, [r0, 0x2C]
lsls r0, 8
lsrs r1, r0, 16
movs r0, 0x1A
2015-11-30 07:17:50 +00:00
bl SetGpuReg_ScreenOff
2015-10-10 11:12:48 +01:00
b @080020E0
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@0800208C:
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
ldr r0, [r0, 0x2C]
lsrs r1, r0, 16
lsls r0, 16
lsrs r4, r0, 16
movs r0, 0x2E
2015-11-30 07:17:50 +00:00
bl SetGpuReg_ScreenOff
2015-10-06 13:46:30 +01:00
movs r0, 0x2C
adds r1, r4, 0
2015-11-30 07:17:50 +00:00
bl SetGpuReg_ScreenOff
2015-10-10 11:12:48 +01:00
b @080020E0
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@080020AC:
2015-10-06 13:46:30 +01:00
cmp r0, 0
2015-10-10 11:12:48 +01:00
bne @080020C4
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
ldr r0, [r0, 0x3C]
lsls r0, 8
lsrs r1, r0, 16
movs r0, 0x1E
2015-11-30 07:17:50 +00:00
bl SetGpuReg_ScreenOff
2015-10-10 11:12:48 +01:00
b @080020E0
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@080020C4:
2015-10-06 13:46:30 +01:00
cmp r0, 0x2
2015-10-10 11:12:48 +01:00
bne @080020E0
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
ldr r0, [r0, 0x3C]
lsrs r1, r0, 16
lsls r0, 16
lsrs r4, r0, 16
movs r0, 0x3E
2015-11-30 07:17:50 +00:00
bl SetGpuReg_ScreenOff
2015-10-06 13:46:30 +01:00
movs r0, 0x3C
adds r1, r4, 0
2015-11-30 07:17:50 +00:00
bl SetGpuReg_ScreenOff
2015-10-10 11:12:48 +01:00
@080020E0:
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
adds r0, 0xC
adds r0, r5, r0
ldr r0, [r0]
2015-10-10 11:12:48 +01:00
@080020E8:
2015-10-06 13:46:30 +01:00
pop {r4-r6}
pop {r1}
bx r1
.pool
2015-11-30 07:17:50 +00:00
thumb_func_end ChangeBgY_ScreenOff
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start GetBgY
; u32 GetBgY(u8 bg)
GetBgY: ; 80020F4
2015-10-06 13:46:30 +01:00
push {r4,lr}
lsls r0, 24
lsrs r0, 24
adds r4, r0, 0
2015-11-30 07:17:50 +00:00
bl IsInvalidBg_
2015-10-06 13:46:30 +01:00
cmp r0, 0
2015-10-10 11:12:48 +01:00
bne @08002124
2015-10-06 13:46:30 +01:00
adds r0, r4, 0
movs r1, 0x1
2015-11-30 07:17:50 +00:00
bl GetBgControlAttribute
2015-10-06 13:46:30 +01:00
lsls r0, 16
cmp r0, 0
2015-10-10 11:12:48 +01:00
beq @08002124
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
lsls r1, r4, 4
adds r0, 0xC
adds r1, r0
ldr r0, [r1]
2015-10-10 11:12:48 +01:00
b @08002128
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@08002124:
2015-10-06 13:46:30 +01:00
movs r0, 0x1
negs r0, r0
2015-10-10 11:12:48 +01:00
@08002128:
2015-10-06 13:46:30 +01:00
pop {r4}
pop {r1}
bx r1
2015-11-30 07:17:50 +00:00
thumb_func_end GetBgY
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start SetBgAffine
; void SetBgAffine(u8 bg, u16 srcCenterX, u16 srcCenterY, s16 dispCenterX, s16 dispCenterY, s16 scaleX, s16 scaleY, u16 rotationAngle)
SetBgAffine: ; 8002130
2015-10-06 13:46:30 +01:00
push {r4-r7,lr}
mov r7, r8
push {r7}
sub sp, 0x10
ldr r4, [sp, 0x28]
ldr r5, [sp, 0x2C]
ldr r6, [sp, 0x30]
ldr r7, [sp, 0x34]
lsls r0, 24
lsrs r0, 24
lsls r7, 16
lsrs r7, 16
lsls r3, 16
asrs r3, 16
lsls r4, 16
asrs r4, 16
str r4, [sp]
lsls r5, 16
asrs r5, 16
str r5, [sp, 0x4]
lsls r6, 16
asrs r6, 16
str r6, [sp, 0x8]
str r7, [sp, 0xC]
2015-11-30 07:17:50 +00:00
bl SetBgAffineInternal
2015-10-06 13:46:30 +01:00
add sp, 0x10
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
2015-11-30 07:17:50 +00:00
thumb_func_end SetBgAffine
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start Unused_AdjustBgMosaic
; u8 Unused_AdjustBgMosaic(u8 a1, u8 a2)
Unused_AdjustBgMosaic: ; 8002170
2015-10-06 13:46:30 +01:00
push {r4-r6,lr}
lsls r0, 24
lsrs r4, r0, 24
lsls r1, 24
lsrs r6, r1, 24
movs r0, 0x4C
2015-11-30 07:17:50 +00:00
bl GetGpuReg
2015-10-06 13:46:30 +01:00
lsls r0, 16
lsrs r5, r0, 16
movs r1, 0xF
movs r3, 0xF
ands r3, r5
lsrs r2, r0, 20
ands r2, r1
movs r0, 0xFF
lsls r0, 8
ands r5, r0
cmp r6, 0x6
2015-10-10 11:12:48 +01:00
bhi @080021C4
2015-10-06 13:46:30 +01:00
lsls r0, r6, 2
2015-10-10 11:12:48 +01:00
ldr r1, =@080021A8
2015-10-06 13:46:30 +01:00
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
2015-10-10 11:12:48 +01:00
@080021A8:
.4byte @080021C4
.4byte @080021CC
.4byte @080021D2
.4byte @080021E4
.4byte @080021FA
.4byte @08002200
.4byte @08002212
@080021C4:
2015-10-06 13:46:30 +01:00
movs r3, 0xF
ands r3, r4
lsrs r2, r4, 4
2015-10-10 11:12:48 +01:00
b @08002226
@080021CC:
2015-10-06 13:46:30 +01:00
movs r3, 0xF
ands r3, r4
2015-10-10 11:12:48 +01:00
b @08002226
@080021D2:
2015-10-06 13:46:30 +01:00
lsls r0, r3, 16
asrs r0, 16
adds r0, r4
cmp r0, 0xF
2015-10-10 11:12:48 +01:00
ble @080021E0
2015-10-06 13:46:30 +01:00
movs r3, 0xF
2015-10-10 11:12:48 +01:00
b @08002226
@080021E0:
2015-10-06 13:46:30 +01:00
adds r0, r3, r4
2015-10-10 11:12:48 +01:00
b @080021F4
@080021E4:
2015-10-06 13:46:30 +01:00
lsls r0, r3, 16
asrs r0, 16
subs r0, r4
cmp r0, 0
2015-10-10 11:12:48 +01:00
bge @080021F2
2015-10-06 13:46:30 +01:00
movs r3, 0
2015-10-10 11:12:48 +01:00
b @08002226
@080021F2:
2015-10-06 13:46:30 +01:00
subs r0, r3, r4
2015-10-10 11:12:48 +01:00
@080021F4:
2015-10-06 13:46:30 +01:00
lsls r0, 16
lsrs r3, r0, 16
2015-10-10 11:12:48 +01:00
b @08002226
@080021FA:
2015-10-06 13:46:30 +01:00
movs r2, 0xF
ands r2, r4
2015-10-10 11:12:48 +01:00
b @08002226
@08002200:
2015-10-06 13:46:30 +01:00
lsls r0, r2, 16
asrs r0, 16
adds r0, r4
cmp r0, 0xF
2015-10-10 11:12:48 +01:00
ble @0800220E
2015-10-06 13:46:30 +01:00
movs r2, 0xF
2015-10-10 11:12:48 +01:00
b @08002226
@0800220E:
2015-10-06 13:46:30 +01:00
adds r0, r2, r4
2015-10-10 11:12:48 +01:00
b @08002222
@08002212:
2015-10-06 13:46:30 +01:00
lsls r0, r2, 16
asrs r0, 16
subs r0, r4
cmp r0, 0
2015-10-10 11:12:48 +01:00
bge @08002220
2015-10-06 13:46:30 +01:00
movs r2, 0
2015-10-10 11:12:48 +01:00
b @08002226
@08002220:
2015-10-06 13:46:30 +01:00
subs r0, r2, r4
2015-10-10 11:12:48 +01:00
@08002222:
2015-10-06 13:46:30 +01:00
lsls r0, 16
lsrs r2, r0, 16
2015-10-10 11:12:48 +01:00
@08002226:
2015-10-06 13:46:30 +01:00
lsls r0, r2, 16
asrs r0, 12
movs r1, 0xF0
ands r0, r1
orrs r5, r0
lsls r0, r3, 16
asrs r0, 16
movs r1, 0xF
ands r0, r1
orrs r5, r0
lsls r0, r5, 16
lsrs r5, r0, 16
movs r0, 0x4C
adds r1, r5, 0
2015-11-30 07:17:50 +00:00
bl SetGpuReg
2015-10-06 13:46:30 +01:00
lsls r0, r5, 24
lsrs r0, 24
pop {r4-r6}
pop {r1}
bx r1
2015-11-30 07:17:50 +00:00
thumb_func_end Unused_AdjustBgMosaic
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start SetBgTileMap
; void SetBgTileMap(u8 bg, void *tileMap)
SetBgTileMap: ; 8002250
2015-10-06 13:46:30 +01:00
push {r4,r5,lr}
adds r5, r1, 0
lsls r0, 24
lsrs r4, r0, 24
adds r0, r4, 0
2015-11-30 07:17:50 +00:00
bl IsInvalidBg_
2015-10-06 13:46:30 +01:00
cmp r0, 0
2015-10-10 11:12:48 +01:00
bne @0800227A
2015-10-06 13:46:30 +01:00
adds r0, r4, 0
movs r1, 0x1
2015-11-30 07:17:50 +00:00
bl GetBgControlAttribute
2015-10-06 13:46:30 +01:00
lsls r0, 16
cmp r0, 0
2015-10-10 11:12:48 +01:00
beq @0800227A
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
lsls r1, r4, 4
adds r0, 0x4
adds r1, r0
str r5, [r1]
2015-10-10 11:12:48 +01:00
@0800227A:
2015-10-06 13:46:30 +01:00
pop {r4,r5}
pop {r0}
bx r0
.pool
2015-11-30 07:17:50 +00:00
thumb_func_end SetBgTileMap
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start UnsetBgTileMap
; void UnsetBgTileMap(u8 bg)
UnsetBgTileMap: ; 8002284
2015-10-06 13:46:30 +01:00
push {r4,r5,lr}
lsls r0, 24
lsrs r4, r0, 24
adds r0, r4, 0
2015-11-30 07:17:50 +00:00
bl IsInvalidBg_
2015-10-06 13:46:30 +01:00
adds r5, r0, 0
cmp r5, 0
2015-10-10 11:12:48 +01:00
bne @080022AE
2015-10-06 13:46:30 +01:00
adds r0, r4, 0
movs r1, 0x1
2015-11-30 07:17:50 +00:00
bl GetBgControlAttribute
2015-10-06 13:46:30 +01:00
lsls r0, 16
cmp r0, 0
2015-10-10 11:12:48 +01:00
beq @080022AE
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
lsls r1, r4, 4
adds r0, 0x4
adds r1, r0
str r5, [r1]
2015-10-10 11:12:48 +01:00
@080022AE:
2015-10-06 13:46:30 +01:00
pop {r4,r5}
pop {r0}
bx r0
.pool
2015-11-30 07:17:50 +00:00
thumb_func_end UnsetBgTileMap
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start GetBgTileMap
; void *GetBgTileMap(u8 bg)
GetBgTileMap: ; 80022B8
2015-10-06 13:46:30 +01:00
push {r4,lr}
lsls r0, 24
lsrs r0, 24
adds r4, r0, 0
2015-11-30 07:17:50 +00:00
bl IsInvalidBg_
2015-10-06 13:46:30 +01:00
cmp r0, 0
2015-10-10 11:12:48 +01:00
bne @080022E8
2015-10-06 13:46:30 +01:00
adds r0, r4, 0
movs r1, 0x1
2015-11-30 07:17:50 +00:00
bl GetBgControlAttribute
2015-10-06 13:46:30 +01:00
lsls r0, 16
cmp r0, 0
2015-10-10 11:12:48 +01:00
beq @080022E8
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
lsls r1, r4, 4
adds r0, 0x4
adds r1, r0
ldr r0, [r1]
2015-10-10 11:12:48 +01:00
b @080022EA
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@080022E8:
2015-10-06 13:46:30 +01:00
movs r0, 0
2015-10-10 11:12:48 +01:00
@080022EA:
2015-10-06 13:46:30 +01:00
pop {r4}
pop {r1}
bx r1
2015-11-30 07:17:50 +00:00
thumb_func_end GetBgTileMap
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start CopyToBgTileMapBuffer
; void CopyToBgTileMapBuffer(u8 bg, void *src, u16 mode, u16 destOffset)
CopyToBgTileMapBuffer: ; 80022F0
2015-10-06 13:46:30 +01:00
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
mov r10, r1
lsls r0, 24
lsrs r4, r0, 24
mov r9, r4
lsls r7, r2, 16
lsrs r6, r7, 16
lsls r3, 16
lsrs r5, r3, 16
mov r8, r5
adds r0, r4, 0
2015-11-30 07:17:50 +00:00
bl IsInvalidBg_
2015-10-06 13:46:30 +01:00
cmp r0, 0
2015-10-10 11:12:48 +01:00
bne @08002358
2015-10-06 13:46:30 +01:00
adds r0, r4, 0
bl IsTileMapOutsideWram
cmp r0, 0
2015-10-10 11:12:48 +01:00
bne @08002358
2015-10-06 13:46:30 +01:00
cmp r6, 0
2015-10-10 11:12:48 +01:00
beq @08002340
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
lsls r1, r4, 4
adds r0, 0x4
adds r1, r0
lsls r0, r5, 1
ldr r1, [r1]
adds r1, r0
lsrs r2, r7, 17
mov r0, r10
bl CpuSet
2015-10-10 11:12:48 +01:00
b @08002358
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@08002340:
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
mov r2, r9
lsls r1, r2, 4
adds r0, 0x4
adds r1, r0
mov r2, r8
lsls r0, r2, 1
ldr r1, [r1]
adds r1, r0
mov r0, r10
bl LZ77UnCompWram
2015-10-10 11:12:48 +01:00
@08002358:
2015-10-06 13:46:30 +01:00
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
2015-11-30 07:17:50 +00:00
thumb_func_end CopyToBgTileMapBuffer
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start CopyBgTileMapBufferToVram
; void CopyBgTileMapBufferToVram(u8 bg)
CopyBgTileMapBufferToVram: ; 800236C
2015-10-06 13:46:30 +01:00
push {r4,lr}
sub sp, 0x4
lsls r0, 24
lsrs r4, r0, 24
adds r0, r4, 0
2015-11-30 07:17:50 +00:00
bl IsInvalidBg_
2015-10-06 13:46:30 +01:00
cmp r0, 0
2015-10-10 11:12:48 +01:00
bne @080023C8
2015-10-06 13:46:30 +01:00
adds r0, r4, 0
bl IsTileMapOutsideWram
cmp r0, 0
2015-10-10 11:12:48 +01:00
bne @080023C8
2015-10-06 13:46:30 +01:00
adds r0, r4, 0
2015-11-30 07:17:50 +00:00
bl GetBgType
2015-10-06 13:46:30 +01:00
cmp r0, 0
2015-10-10 11:12:48 +01:00
beq @0800239A
2015-10-06 13:46:30 +01:00
cmp r0, 0x1
2015-10-10 11:12:48 +01:00
beq @080023A6
2015-10-06 13:46:30 +01:00
movs r2, 0
2015-10-10 11:12:48 +01:00
b @080023B2
@0800239A:
2015-10-06 13:46:30 +01:00
adds r0, r4, 0
movs r1, 0
2015-11-30 07:17:50 +00:00
bl GetBgMetricTextMode
2015-10-06 13:46:30 +01:00
lsls r0, 27
2015-10-10 11:12:48 +01:00
b @080023B0
@080023A6:
2015-10-06 13:46:30 +01:00
adds r0, r4, 0
movs r1, 0
2015-11-30 07:17:50 +00:00
bl GetBgMetricAffineMode
2015-10-06 13:46:30 +01:00
lsls r0, 24
2015-10-10 11:12:48 +01:00
@080023B0:
2015-10-06 13:46:30 +01:00
lsrs r2, r0, 16
2015-10-10 11:12:48 +01:00
@080023B2:
2015-10-06 13:46:30 +01:00
ldr r0, =0x030008f8
lsls r1, r4, 4
adds r0, 0x4
adds r1, r0
ldr r1, [r1]
movs r0, 0x2
str r0, [sp]
adds r0, r4, 0
movs r3, 0
2015-11-30 07:17:50 +00:00
bl LoadBgVram
2015-10-10 11:12:48 +01:00
@080023C8:
2015-10-06 13:46:30 +01:00
add sp, 0x4
pop {r4}
pop {r0}
bx r0
.pool
2015-11-30 07:17:50 +00:00
thumb_func_end CopyBgTileMapBufferToVram
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start CopyToBgTileMapBufferRect
; void CopyToBgTileMapBufferRect(u8 bg, void *src, u8 destX, u8 destY, u8 width, u8 height)
CopyToBgTileMapBufferRect: ; 80023D4
2015-10-06 13:46:30 +01:00
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x4
mov r8, r1
ldr r1, [sp, 0x24]
ldr r4, [sp, 0x28]
lsls r0, 24
lsrs r5, r0, 24
lsls r2, 24
lsrs r2, 24
mov r10, r2
lsls r3, 24
lsrs r7, r3, 24
lsls r1, 24
lsrs r1, 24
mov r9, r1
lsls r4, 24
lsrs r6, r4, 24
adds r0, r5, 0
2015-11-30 07:17:50 +00:00
bl IsInvalidBg_
2015-10-06 13:46:30 +01:00
cmp r0, 0
2015-10-10 11:12:48 +01:00
bne @080024C4
2015-10-06 13:46:30 +01:00
adds r0, r5, 0
bl IsTileMapOutsideWram
cmp r0, 0
2015-10-10 11:12:48 +01:00
bne @080024C4
2015-10-06 13:46:30 +01:00
adds r0, r5, 0
2015-11-30 07:17:50 +00:00
bl GetBgType
2015-10-06 13:46:30 +01:00
cmp r0, 0
2015-10-10 11:12:48 +01:00
beq @08002422
2015-10-06 13:46:30 +01:00
cmp r0, 0x1
2015-10-10 11:12:48 +01:00
beq @08002470
b @080024C4
@08002422:
2015-10-06 13:46:30 +01:00
mov r4, r8
adds r3, r7, 0
adds r0, r3, r6
cmp r3, r0
2015-10-10 11:12:48 +01:00
bge @080024C4
2015-10-06 13:46:30 +01:00
mov r12, r0
lsls r1, r5, 4
ldr r0, =0x030008fc
adds r1, r0
mov r8, r1
2015-10-10 11:12:48 +01:00
@08002436:
2015-10-06 13:46:30 +01:00
mov r2, r10
mov r1, r9
adds r0, r2, r1
adds r7, r3, 0x1
cmp r2, r0
2015-10-10 11:12:48 +01:00
bge @08002460
2015-10-06 13:46:30 +01:00
mov r1, r8
ldr r6, [r1]
lsls r5, r3, 5
adds r3, r0, 0
2015-10-10 11:12:48 +01:00
@0800244A:
2015-10-06 13:46:30 +01:00
adds r0, r5, r2
lsls r0, 1
adds r0, r6
ldrh r1, [r4]
strh r1, [r0]
adds r4, 0x2
adds r0, r2, 0x1
lsls r0, 16
lsrs r2, r0, 16
cmp r2, r3
2015-10-10 11:12:48 +01:00
blt @0800244A
@08002460:
2015-10-06 13:46:30 +01:00
lsls r0, r7, 16
lsrs r3, r0, 16
cmp r3, r12
2015-10-10 11:12:48 +01:00
blt @08002436
b @080024C4
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@08002470:
2015-10-06 13:46:30 +01:00
mov r4, r8
adds r0, r5, 0
movs r1, 0x1
2015-11-30 07:17:50 +00:00
bl GetBgMetricAffineMode
2015-10-06 13:46:30 +01:00
lsls r0, 16
lsrs r0, 16
str r0, [sp]
adds r3, r7, 0
adds r0, r3, r6
cmp r3, r0
2015-10-10 11:12:48 +01:00
bge @080024C4
2015-10-06 13:46:30 +01:00
mov r12, r0
lsls r5, 4
mov r8, r5
2015-10-10 11:12:48 +01:00
@0800248E:
2015-10-06 13:46:30 +01:00
mov r2, r10
mov r1, r9
adds r0, r2, r1
adds r7, r3, 0x1
cmp r2, r0
2015-10-10 11:12:48 +01:00
bge @080024BC
2015-10-06 13:46:30 +01:00
ldr r6, =0x030008fc
add r6, r8
ldr r1, [sp]
adds r5, r3, 0
muls r5, r1
adds r3, r0, 0
2015-10-10 11:12:48 +01:00
@080024A6:
2015-10-06 13:46:30 +01:00
ldr r1, [r6]
adds r0, r5, r2
adds r1, r0
ldrb r0, [r4]
strb r0, [r1]
adds r4, 0x1
adds r0, r2, 0x1
lsls r0, 16
lsrs r2, r0, 16
cmp r2, r3
2015-10-10 11:12:48 +01:00
blt @080024A6
@080024BC:
2015-10-06 13:46:30 +01:00
lsls r0, r7, 16
lsrs r3, r0, 16
cmp r3, r12
2015-10-10 11:12:48 +01:00
blt @0800248E
@080024C4:
2015-10-06 13:46:30 +01:00
add sp, 0x4
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
2015-11-30 07:17:50 +00:00
thumb_func_end CopyToBgTileMapBufferRect
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start CopyToBgTileMapBufferRect_ChangePalette
; void CopyToBgTileMapBufferRect_ChangePalette(u8 bg, void *src, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, u8 palette)
CopyToBgTileMapBufferRect_ChangePalette: ; 80024D8
2015-10-06 13:46:30 +01:00
push {r4-r6,lr}
sub sp, 0x24
ldr r4, [sp, 0x34]
ldr r5, [sp, 0x38]
ldr r6, [sp, 0x3C]
lsls r0, 24
lsrs r0, 24
lsls r2, 24
lsrs r2, 24
lsls r3, 24
lsrs r3, 24
lsls r4, 24
lsrs r4, 24
lsls r5, 24
lsrs r5, 24
lsls r6, 24
lsrs r6, 24
str r4, [sp]
str r5, [sp, 0x4]
str r2, [sp, 0x8]
str r3, [sp, 0xC]
str r4, [sp, 0x10]
str r5, [sp, 0x14]
str r6, [sp, 0x18]
movs r2, 0
str r2, [sp, 0x1C]
str r2, [sp, 0x20]
movs r3, 0
2015-11-30 07:17:50 +00:00
bl CopyRectToBgTileMapBufferRect
2015-10-06 13:46:30 +01:00
add sp, 0x24
pop {r4-r6}
pop {r0}
bx r0
2015-11-30 07:17:50 +00:00
thumb_func_end CopyToBgTileMapBufferRect_ChangePalette
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start CopyRectToBgTileMapBufferRect
; void CopyRectToBgTileMapBufferRect(u8 bg, void *src, u8 srcX, u8 srcY, u8 srcWidth, u8 srcHeight, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, u8 palette1, u16 tileOffset, u16 palette2)
CopyRectToBgTileMapBufferRect: ; 800251C
2015-10-06 13:46:30 +01:00
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x40
str r1, [sp, 0x8]
ldr r1, [sp, 0x60]
ldr r4, [sp, 0x68]
ldr r5, [sp, 0x6C]
ldr r6, [sp, 0x70]
ldr r7, [sp, 0x74]
mov r8, r7
ldr r7, [sp, 0x78]
mov r9, r7
ldr r7, [sp, 0x7C]
mov r10, r7
ldr r7, [sp, 0x80]
mov r12, r7
lsls r0, 24
lsrs r0, 24
str r0, [sp, 0x4]
lsls r2, 24
lsrs r2, 24
str r2, [sp, 0xC]
lsls r3, 24
lsrs r3, 24
str r3, [sp, 0x10]
lsls r1, 24
lsrs r7, r1, 24
lsls r4, 24
lsrs r4, 24
str r4, [sp, 0x14]
lsls r5, 24
lsrs r5, 24
lsls r6, 24
lsrs r6, 24
str r6, [sp, 0x18]
mov r0, r8
lsls r0, 24
lsrs r4, r0, 24
mov r1, r9
lsls r1, 24
lsrs r1, 24
str r1, [sp, 0x1C]
mov r2, r10
lsls r2, 16
lsrs r2, 16
str r2, [sp, 0x20]
mov r0, r12
lsls r0, 16
lsrs r0, 16
str r0, [sp, 0x24]
ldr r0, [sp, 0x4]
2015-11-30 07:17:50 +00:00
bl IsInvalidBg_
2015-10-06 13:46:30 +01:00
cmp r0, 0
2015-10-10 11:12:48 +01:00
beq @08002592
b @080026EE
@08002592:
2015-10-06 13:46:30 +01:00
ldr r0, [sp, 0x4]
bl IsTileMapOutsideWram
cmp r0, 0
2015-10-10 11:12:48 +01:00
beq @0800259E
b @080026EE
@0800259E:
2015-10-06 13:46:30 +01:00
ldr r0, [sp, 0x4]
movs r1, 0x4
2015-11-30 07:17:50 +00:00
bl GetBgControlAttribute
2015-10-06 13:46:30 +01:00
lsls r0, 16
lsrs r0, 16
str r0, [sp, 0x30]
ldr r0, [sp, 0x4]
movs r1, 0x1
2015-11-30 07:17:50 +00:00
bl GetBgMetricTextMode
2015-10-06 13:46:30 +01:00
lsls r0, 21
lsrs r0, 16
str r0, [sp, 0x28]
ldr r0, [sp, 0x4]
movs r1, 0x2
2015-11-30 07:17:50 +00:00
bl GetBgMetricTextMode
2015-10-06 13:46:30 +01:00
lsls r0, 21
lsrs r0, 16
str r0, [sp, 0x2C]
ldr r0, [sp, 0x4]
2015-11-30 07:17:50 +00:00
bl GetBgType
2015-10-06 13:46:30 +01:00
cmp r0, 0
2015-10-10 11:12:48 +01:00
beq @080025D8
2015-10-06 13:46:30 +01:00
cmp r0, 0x1
2015-10-10 11:12:48 +01:00
beq @08002674
b @080026EE
@080025D8:
2015-10-06 13:46:30 +01:00
ldr r1, [sp, 0x10]
adds r0, r1, 0
muls r0, r7
ldr r2, [sp, 0xC]
adds r0, r2
lsls r0, 1
ldr r1, [sp, 0x8]
adds r6, r1, r0
adds r0, r5, r4
cmp r5, r0
2015-10-10 11:12:48 +01:00
blt @080025F0
b @080026EE
@080025F0:
2015-10-06 13:46:30 +01:00
ldr r2, [sp, 0x18]
subs r2, r7, r2
str r2, [sp, 0x34]
str r0, [sp, 0x38]
2015-10-10 11:12:48 +01:00
@080025F8:
2015-10-06 13:46:30 +01:00
ldr r4, [sp, 0x14]
ldr r7, [sp, 0x18]
adds r0, r4, r7
adds r1, r5, 0x1
str r1, [sp, 0x3C]
cmp r4, r0
2015-10-10 11:12:48 +01:00
bge @0800265A
2015-10-06 13:46:30 +01:00
ldr r2, [sp, 0x4]
lsls r0, r2, 4
ldr r1, =0x030008fc
adds r0, r1
mov r10, r0
ldr r7, [sp, 0x20]
lsls r7, 16
mov r9, r7
ldr r1, [sp, 0x24]
lsls r0, r1, 16
asrs r0, 16
mov r8, r0
2015-10-10 11:12:48 +01:00
@0800261E:
2015-10-06 13:46:30 +01:00
ldr r2, [sp, 0x2C]
str r2, [sp]
adds r0, r4, 0
adds r1, r5, 0
ldr r2, [sp, 0x30]
ldr r3, [sp, 0x28]
2015-11-30 07:17:50 +00:00
bl GetTileMapIndexFromCoords
2015-10-06 13:46:30 +01:00
lsls r0, 16
lsrs r0, 15
mov r7, r10
ldr r1, [r7]
adds r1, r0
mov r0, r8
str r0, [sp]
adds r0, r6, 0
ldr r2, [sp, 0x1C]
mov r7, r9
asrs r3, r7, 16
2015-11-30 07:17:50 +00:00
bl CopyTileMapEntry
2015-10-06 13:46:30 +01:00
adds r6, 0x2
adds r0, r4, 0x1
lsls r0, 16
lsrs r4, r0, 16
ldr r1, [sp, 0x14]
ldr r2, [sp, 0x18]
adds r0, r1, r2
cmp r4, r0
2015-10-10 11:12:48 +01:00
blt @0800261E
@0800265A:
2015-10-06 13:46:30 +01:00
ldr r5, [sp, 0x34]
lsls r0, r5, 1
adds r6, r0
ldr r7, [sp, 0x3C]
lsls r0, r7, 16
lsrs r5, r0, 16
ldr r0, [sp, 0x38]
cmp r5, r0
2015-10-10 11:12:48 +01:00
blt @080025F8
b @080026EE
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@08002674:
2015-10-06 13:46:30 +01:00
ldr r1, [sp, 0x10]
adds r0, r1, 0
muls r0, r7
ldr r2, [sp, 0xC]
adds r0, r2
ldr r1, [sp, 0x8]
adds r6, r1, r0
ldr r0, [sp, 0x4]
movs r1, 0x1
2015-11-30 07:17:50 +00:00
bl GetBgMetricAffineMode
2015-10-06 13:46:30 +01:00
lsls r0, 16
lsrs r0, 16
mov r9, r0
adds r0, r5, r4
cmp r5, r0
2015-10-10 11:12:48 +01:00
bge @080026EE
2015-10-06 13:46:30 +01:00
ldr r2, [sp, 0x18]
subs r2, r7, r2
str r2, [sp, 0x34]
str r0, [sp, 0x38]
ldr r7, =0x030008fc
mov r10, r7
ldr r0, [sp, 0x4]
lsls r0, 4
mov r8, r0
2015-10-10 11:12:48 +01:00
@080026A8:
2015-10-06 13:46:30 +01:00
ldr r4, [sp, 0x14]
ldr r1, [sp, 0x18]
adds r0, r4, r1
adds r2, r5, 0x1
str r2, [sp, 0x3C]
cmp r4, r0
2015-10-10 11:12:48 +01:00
bge @080026DE
2015-10-06 13:46:30 +01:00
mov r3, r8
add r3, r10
mov r7, r9
muls r7, r5
mov r12, r7
adds r2, r0, 0
2015-10-10 11:12:48 +01:00
@080026C2:
2015-10-06 13:46:30 +01:00
ldr r1, [r3]
mov r5, r12
adds r0, r5, r4
adds r1, r0
ldrb r0, [r6]
ldr r7, [sp, 0x20]
adds r0, r7
strb r0, [r1]
adds r6, 0x1
adds r0, r4, 0x1
lsls r0, 16
lsrs r4, r0, 16
cmp r4, r2
2015-10-10 11:12:48 +01:00
blt @080026C2
@080026DE:
2015-10-06 13:46:30 +01:00
ldr r0, [sp, 0x34]
adds r6, r0
ldr r1, [sp, 0x3C]
lsls r0, r1, 16
lsrs r5, r0, 16
ldr r2, [sp, 0x38]
cmp r5, r2
2015-10-10 11:12:48 +01:00
blt @080026A8
@080026EE:
2015-10-06 13:46:30 +01:00
add sp, 0x40
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
2015-11-30 07:17:50 +00:00
thumb_func_end CopyRectToBgTileMapBufferRect
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start FillBgTileMapBufferRect_Palette0
; void FillBgTileMapBufferRect_Palette0(u8 bg, u16 tileNum, u8 x, u8 y, u8 width, u8 height)
FillBgTileMapBufferRect_Palette0: ; 8002704
2015-10-06 13:46:30 +01:00
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x4
ldr r4, [sp, 0x24]
ldr r5, [sp, 0x28]
lsls r0, 24
lsrs r6, r0, 24
lsls r1, 16
lsrs r1, 16
mov r8, r1
lsls r2, 24
lsrs r2, 24
mov r10, r2
lsls r3, 24
lsrs r7, r3, 24
lsls r4, 24
lsrs r4, 24
mov r9, r4
lsls r5, 24
lsrs r5, 24
adds r0, r6, 0
2015-11-30 07:17:50 +00:00
bl IsInvalidBg_
2015-10-06 13:46:30 +01:00
cmp r0, 0
2015-10-10 11:12:48 +01:00
bne @080027F0
2015-10-06 13:46:30 +01:00
adds r0, r6, 0
bl IsTileMapOutsideWram
cmp r0, 0
2015-10-10 11:12:48 +01:00
bne @080027F0
2015-10-06 13:46:30 +01:00
adds r0, r6, 0
2015-11-30 07:17:50 +00:00
bl GetBgType
2015-10-06 13:46:30 +01:00
cmp r0, 0
2015-10-10 11:12:48 +01:00
beq @08002756
2015-10-06 13:46:30 +01:00
cmp r0, 0x1
2015-10-10 11:12:48 +01:00
beq @080027A0
b @080027F0
@08002756:
2015-10-06 13:46:30 +01:00
adds r3, r7, 0
adds r5, r3, r5
cmp r3, r5
2015-10-10 11:12:48 +01:00
bge @080027F0
2015-10-06 13:46:30 +01:00
adds r7, r5, 0
lsls r1, r6, 4
ldr r0, =0x030008fc
adds r1, r0
mov r12, r1
2015-10-10 11:12:48 +01:00
@08002768:
2015-10-06 13:46:30 +01:00
mov r2, r10
mov r1, r9
adds r0, r2, r1
adds r6, r3, 0x1
cmp r2, r0
2015-10-10 11:12:48 +01:00
bge @08002790
2015-10-06 13:46:30 +01:00
mov r5, r12
ldr r4, [r5]
lsls r3, 5
adds r1, r0, 0
2015-10-10 11:12:48 +01:00
@0800277C:
2015-10-06 13:46:30 +01:00
adds r0, r3, r2
lsls r0, 1
adds r0, r4
mov r5, r8
strh r5, [r0]
adds r0, r2, 0x1
lsls r0, 16
lsrs r2, r0, 16
cmp r2, r1
2015-10-10 11:12:48 +01:00
blt @0800277C
@08002790:
2015-10-06 13:46:30 +01:00
lsls r0, r6, 16
lsrs r3, r0, 16
cmp r3, r7
2015-10-10 11:12:48 +01:00
blt @08002768
b @080027F0
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@080027A0:
2015-10-06 13:46:30 +01:00
adds r0, r6, 0
movs r1, 0x1
2015-11-30 07:17:50 +00:00
bl GetBgMetricAffineMode
2015-10-06 13:46:30 +01:00
lsls r0, 16
lsrs r0, 16
str r0, [sp]
adds r3, r7, 0
adds r5, r3, r5
cmp r3, r5
2015-10-10 11:12:48 +01:00
bge @080027F0
2015-10-06 13:46:30 +01:00
adds r7, r5, 0
lsls r6, 4
mov r12, r6
2015-10-10 11:12:48 +01:00
@080027BC:
2015-10-06 13:46:30 +01:00
mov r2, r10
mov r1, r9
adds r0, r2, r1
adds r6, r3, 0x1
cmp r2, r0
2015-10-10 11:12:48 +01:00
bge @080027E8
2015-10-06 13:46:30 +01:00
ldr r5, =0x030008fc
add r5, r12
ldr r1, [sp]
adds r4, r3, 0
muls r4, r1
adds r3, r0, 0
2015-10-10 11:12:48 +01:00
@080027D4:
2015-10-06 13:46:30 +01:00
ldr r0, [r5]
adds r1, r4, r2
adds r0, r1
mov r1, r8
strb r1, [r0]
adds r0, r2, 0x1
lsls r0, 16
lsrs r2, r0, 16
cmp r2, r3
2015-10-10 11:12:48 +01:00
blt @080027D4
@080027E8:
2015-10-06 13:46:30 +01:00
lsls r0, r6, 16
lsrs r3, r0, 16
cmp r3, r7
2015-10-10 11:12:48 +01:00
blt @080027BC
@080027F0:
2015-10-06 13:46:30 +01:00
add sp, 0x4
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
2015-11-30 07:17:50 +00:00
thumb_func_end FillBgTileMapBufferRect_Palette0
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start FillBgTileMapBufferRect
; void FillBgTileMapBufferRect(u8 bg, u16 tileNum, u8 x, u8 y, u8 width, u8 height, u8 palette)
FillBgTileMapBufferRect: ; 8002804
2015-10-06 13:46:30 +01:00
push {r4-r6,lr}
sub sp, 0x10
ldr r4, [sp, 0x20]
ldr r5, [sp, 0x24]
ldr r6, [sp, 0x28]
lsls r0, 24
lsrs r0, 24
lsls r1, 16
lsrs r1, 16
lsls r2, 24
lsrs r2, 24
lsls r3, 24
lsrs r3, 24
lsls r4, 24
lsrs r4, 24
lsls r5, 24
lsrs r5, 24
lsls r6, 24
lsrs r6, 24
str r4, [sp]
str r5, [sp, 0x4]
str r6, [sp, 0x8]
movs r4, 0
str r4, [sp, 0xC]
2015-11-30 07:17:50 +00:00
bl WriteSequenceToBgTileMapBuffer
2015-10-06 13:46:30 +01:00
add sp, 0x10
pop {r4-r6}
pop {r0}
bx r0
2015-11-30 07:17:50 +00:00
thumb_func_end FillBgTileMapBufferRect
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start WriteSequenceToBgTileMapBuffer
; void WriteSequenceToBgTileMapBuffer(u8 bg, u16 firstTileNum, u8 x, u8 y, u8 width, u8 height, u8 paletteSlot, u16 tileNumDelta)
WriteSequenceToBgTileMapBuffer: ; 8002840
2015-10-06 13:46:30 +01:00
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x2C
ldr r4, [sp, 0x4C]
ldr r5, [sp, 0x50]
ldr r6, [sp, 0x54]
ldr r7, [sp, 0x58]
mov r8, r7
lsls r0, 24
lsrs r0, 24
mov r9, r0
add r0, sp, 0x4
strh r1, [r0]
lsls r2, 24
lsrs r2, 24
str r2, [sp, 0x8]
lsls r3, 24
lsrs r7, r3, 24
lsls r4, 24
lsrs r4, 24
mov r10, r4
lsls r5, 24
lsrs r4, r5, 24
lsls r6, 24
lsrs r6, 24
str r6, [sp, 0xC]
mov r0, r8
lsls r0, 16
lsrs r0, 16
str r0, [sp, 0x10]
mov r0, r9
2015-11-30 07:17:50 +00:00
bl IsInvalidBg_
2015-10-06 13:46:30 +01:00
cmp r0, 0
2015-10-10 11:12:48 +01:00
beq @0800288E
b @080029D4
@0800288E:
2015-10-06 13:46:30 +01:00
mov r0, r9
bl IsTileMapOutsideWram
cmp r0, 0
2015-10-10 11:12:48 +01:00
beq @0800289A
b @080029D4
@0800289A:
2015-10-06 13:46:30 +01:00
mov r0, r9
movs r1, 0x4
2015-11-30 07:17:50 +00:00
bl GetBgControlAttribute
2015-10-06 13:46:30 +01:00
lsls r0, 16
lsrs r0, 16
str r0, [sp, 0x1C]
mov r0, r9
movs r1, 0x1
2015-11-30 07:17:50 +00:00
bl GetBgMetricTextMode
2015-10-06 13:46:30 +01:00
lsls r0, 21
lsrs r0, 16
str r0, [sp, 0x14]
mov r0, r9
movs r1, 0x2
2015-11-30 07:17:50 +00:00
bl GetBgMetricTextMode
2015-10-06 13:46:30 +01:00
lsls r0, 21
lsrs r0, 16
str r0, [sp, 0x18]
mov r0, r9
2015-11-30 07:17:50 +00:00
bl GetBgType
2015-10-06 13:46:30 +01:00
cmp r0, 0
2015-10-10 11:12:48 +01:00
beq @080028D4
2015-10-06 13:46:30 +01:00
cmp r0, 0x1
2015-10-10 11:12:48 +01:00
beq @0800295C
b @080029D4
@080028D4:
2015-10-06 13:46:30 +01:00
adds r5, r7, 0
adds r0, r5, r4
cmp r5, r0
2015-10-10 11:12:48 +01:00
bge @080029D4
2015-10-06 13:46:30 +01:00
str r0, [sp, 0x24]
add r7, sp, 0x4
2015-10-10 11:12:48 +01:00
@080028E0:
2015-10-06 13:46:30 +01:00
ldr r4, [sp, 0x8]
mov r1, r10
adds r0, r4, r1
adds r2, r5, 0x1
mov r8, r2
cmp r4, r0
2015-10-10 11:12:48 +01:00
bge @08002944
2015-10-06 13:46:30 +01:00
mov r3, r9
lsls r1, r3, 4
ldr r0, =0x030008fc
adds r6, r1, r0
2015-10-10 11:12:48 +01:00
@080028F6:
2015-10-06 13:46:30 +01:00
ldr r0, [sp, 0x18]
str r0, [sp]
adds r0, r4, 0
adds r1, r5, 0
ldr r2, [sp, 0x1C]
ldr r3, [sp, 0x14]
2015-11-30 07:17:50 +00:00
bl GetTileMapIndexFromCoords
2015-10-06 13:46:30 +01:00
lsls r0, 16
lsrs r0, 15
ldr r1, [r6]
adds r1, r0
movs r0, 0
str r0, [sp]
add r0, sp, 0x4
ldr r2, [sp, 0xC]
movs r3, 0
2015-11-30 07:17:50 +00:00
bl CopyTileMapEntry
2015-10-06 13:46:30 +01:00
ldrh r0, [r7]
movs r2, 0xFC
lsls r2, 8
adds r1, r2, 0
adds r2, r0, 0
ands r2, r1
ldr r3, [sp, 0x10]
adds r0, r3
ldr r3, =0x000003ff
adds r1, r3, 0
ands r0, r1
adds r2, r0
strh r2, [r7]
adds r0, r4, 0x1
lsls r0, 16
lsrs r4, r0, 16
ldr r0, [sp, 0x8]
add r0, r10
cmp r4, r0
2015-10-10 11:12:48 +01:00
blt @080028F6
@08002944:
2015-10-06 13:46:30 +01:00
mov r1, r8
lsls r0, r1, 16
lsrs r5, r0, 16
ldr r2, [sp, 0x24]
cmp r5, r2
2015-10-10 11:12:48 +01:00
blt @080028E0
b @080029D4
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@0800295C:
2015-10-06 13:46:30 +01:00
mov r0, r9
movs r1, 0x1
2015-11-30 07:17:50 +00:00
bl GetBgMetricAffineMode
2015-10-06 13:46:30 +01:00
lsls r0, 16
lsrs r0, 16
str r0, [sp, 0x20]
adds r5, r7, 0
adds r0, r5, r4
cmp r5, r0
2015-10-10 11:12:48 +01:00
bge @080029D4
2015-10-06 13:46:30 +01:00
str r0, [sp, 0x24]
mov r3, r9
lsls r3, 4
mov r12, r3
2015-10-10 11:12:48 +01:00
@0800297A:
2015-10-06 13:46:30 +01:00
ldr r4, [sp, 0x8]
mov r7, r10
adds r0, r4, r7
adds r1, r5, 0x1
mov r8, r1
cmp r4, r0
2015-10-10 11:12:48 +01:00
bge @080029C8
2015-10-06 13:46:30 +01:00
ldr r2, =0x030008fc
add r2, r12
str r2, [sp, 0x28]
ldr r7, [sp, 0x20]
adds r3, r5, 0
muls r3, r7
add r2, sp, 0x4
movs r1, 0xFC
lsls r1, 8
mov r9, r1
ldr r7, =0x000003ff
adds r5, r7, 0
adds r6, r0, 0
2015-10-10 11:12:48 +01:00
@080029A2:
2015-10-06 13:46:30 +01:00
ldr r0, [sp, 0x28]
ldr r1, [r0]
adds r0, r3, r4
adds r1, r0
ldrh r0, [r2]
strb r0, [r1]
ldrh r0, [r2]
mov r1, r9
ands r1, r0
ldr r7, [sp, 0x10]
adds r0, r7
ands r0, r5
adds r1, r0
strh r1, [r2]
adds r0, r4, 0x1
lsls r0, 16
lsrs r4, r0, 16
cmp r4, r6
2015-10-10 11:12:48 +01:00
blt @080029A2
@080029C8:
2015-10-06 13:46:30 +01:00
mov r1, r8
lsls r0, r1, 16
lsrs r5, r0, 16
ldr r2, [sp, 0x24]
cmp r5, r2
2015-10-10 11:12:48 +01:00
blt @0800297A
@080029D4:
2015-10-06 13:46:30 +01:00
add sp, 0x2C
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
2015-11-30 07:17:50 +00:00
thumb_func_end WriteSequenceToBgTileMapBuffer
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start GetBgMetricTextMode
; u16 GetBgMetricTextMode(u8 bg, u8 whichMetric)
GetBgMetricTextMode: ; 80029EC
2015-10-06 13:46:30 +01:00
push {r4,r5,lr}
lsls r0, 24
lsrs r0, 24
lsls r1, 24
lsrs r4, r1, 24
adds r5, r4, 0
movs r1, 0x4
2015-11-30 07:17:50 +00:00
bl GetBgControlAttribute
2015-10-06 13:46:30 +01:00
lsls r0, 24
lsrs r0, 24
cmp r4, 0x1
2015-10-10 11:12:48 +01:00
beq @08002A2C
2015-10-06 13:46:30 +01:00
cmp r4, 0x1
2015-10-10 11:12:48 +01:00
bgt @08002A10
2015-10-06 13:46:30 +01:00
cmp r4, 0
2015-10-10 11:12:48 +01:00
beq @08002A16
b @08002A52
@08002A10:
2015-10-06 13:46:30 +01:00
cmp r5, 0x2
2015-10-10 11:12:48 +01:00
beq @08002A3E
b @08002A52
@08002A16:
2015-10-06 13:46:30 +01:00
cmp r0, 0x2
2015-10-10 11:12:48 +01:00
bgt @08002A24
2015-10-06 13:46:30 +01:00
cmp r0, 0x1
2015-10-10 11:12:48 +01:00
bge @08002A4E
@08002A1E:
2015-10-06 13:46:30 +01:00
cmp r0, 0
2015-10-10 11:12:48 +01:00
beq @08002A46
b @08002A52
@08002A24:
2015-10-06 13:46:30 +01:00
cmp r0, 0x3
2015-10-10 11:12:48 +01:00
bne @08002A52
2015-10-06 13:46:30 +01:00
movs r0, 0x4
2015-10-10 11:12:48 +01:00
b @08002A54
@08002A2C:
2015-10-06 13:46:30 +01:00
cmp r0, 0x1
2015-10-10 11:12:48 +01:00
beq @08002A4E
2015-10-06 13:46:30 +01:00
cmp r0, 0x1
2015-10-10 11:12:48 +01:00
ble @08002A1E
2015-10-06 13:46:30 +01:00
cmp r0, 0x2
2015-10-10 11:12:48 +01:00
beq @08002A46
2015-10-06 13:46:30 +01:00
cmp r0, 0x3
2015-10-10 11:12:48 +01:00
bne @08002A52
b @08002A4E
@08002A3E:
2015-10-06 13:46:30 +01:00
cmp r0, 0
2015-10-10 11:12:48 +01:00
blt @08002A52
2015-10-06 13:46:30 +01:00
cmp r0, 0x1
2015-10-10 11:12:48 +01:00
bgt @08002A4A
@08002A46:
2015-10-06 13:46:30 +01:00
movs r0, 0x1
2015-10-10 11:12:48 +01:00
b @08002A54
@08002A4A:
2015-10-06 13:46:30 +01:00
cmp r0, 0x3
2015-10-10 11:12:48 +01:00
bgt @08002A52
@08002A4E:
2015-10-06 13:46:30 +01:00
movs r0, 0x2
2015-10-10 11:12:48 +01:00
b @08002A54
@08002A52:
2015-10-06 13:46:30 +01:00
movs r0, 0
2015-10-10 11:12:48 +01:00
@08002A54:
2015-10-06 13:46:30 +01:00
pop {r4,r5}
pop {r1}
bx r1
2015-11-30 07:17:50 +00:00
thumb_func_end GetBgMetricTextMode
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start GetBgMetricAffineMode
; u16 GetBgMetricAffineMode(u8 bg, u8 whichMetric)
GetBgMetricAffineMode: ; 8002A5C
2015-10-06 13:46:30 +01:00
push {r4,lr}
lsls r0, 24
lsrs r0, 24
lsls r1, 24
lsrs r4, r1, 24
movs r1, 0x4
2015-11-30 07:17:50 +00:00
bl GetBgControlAttribute
2015-10-06 13:46:30 +01:00
lsls r0, 24
lsrs r1, r0, 24
adds r0, r1, 0
cmp r4, 0
2015-10-10 11:12:48 +01:00
beq @08002A84
2015-10-06 13:46:30 +01:00
cmp r4, 0
2015-10-10 11:12:48 +01:00
blt @08002AAC
2015-10-06 13:46:30 +01:00
cmp r4, 0x2
2015-10-10 11:12:48 +01:00
bgt @08002AAC
2015-10-06 13:46:30 +01:00
movs r0, 0x10
lsls r0, r1
2015-10-10 11:12:48 +01:00
b @08002AAE
@08002A84:
2015-10-06 13:46:30 +01:00
cmp r1, 0x1
2015-10-10 11:12:48 +01:00
beq @08002AA0
2015-10-06 13:46:30 +01:00
cmp r1, 0x1
2015-10-10 11:12:48 +01:00
bgt @08002A92
2015-10-06 13:46:30 +01:00
cmp r1, 0
2015-10-10 11:12:48 +01:00
beq @08002A9C
b @08002AAC
@08002A92:
2015-10-06 13:46:30 +01:00
cmp r0, 0x2
2015-10-10 11:12:48 +01:00
beq @08002AA4
2015-10-06 13:46:30 +01:00
cmp r0, 0x3
2015-10-10 11:12:48 +01:00
beq @08002AA8
b @08002AAC
@08002A9C:
2015-10-06 13:46:30 +01:00
movs r0, 0x1
2015-10-10 11:12:48 +01:00
b @08002AAE
@08002AA0:
2015-10-06 13:46:30 +01:00
movs r0, 0x4
2015-10-10 11:12:48 +01:00
b @08002AAE
@08002AA4:
2015-10-06 13:46:30 +01:00
movs r0, 0x10
2015-10-10 11:12:48 +01:00
b @08002AAE
@08002AA8:
2015-10-06 13:46:30 +01:00
movs r0, 0x40
2015-10-10 11:12:48 +01:00
b @08002AAE
@08002AAC:
2015-10-06 13:46:30 +01:00
movs r0, 0
2015-10-10 11:12:48 +01:00
@08002AAE:
2015-10-06 13:46:30 +01:00
pop {r4}
pop {r1}
bx r1
2015-11-30 07:17:50 +00:00
thumb_func_end GetBgMetricAffineMode
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start GetTileMapIndexFromCoords
; u32 GetTileMapIndexFromCoords(u32 x, u32 y, u32 screenSize, u32 screenWidth, u32 screenHeight)
GetTileMapIndexFromCoords: ; 8002AB4
2015-10-06 13:46:30 +01:00
push {r4,lr}
adds r4, r0, 0
ldr r0, [sp, 0x8]
subs r3, 0x1
ands r4, r3
subs r0, 0x1
ands r1, r0
cmp r2, 0x1
2015-10-10 11:12:48 +01:00
beq @08002AD8
2015-10-06 13:46:30 +01:00
cmp r2, 0x1
2015-10-10 11:12:48 +01:00
ble @08002AE0
2015-10-06 13:46:30 +01:00
cmp r2, 0x2
2015-10-10 11:12:48 +01:00
beq @08002AE0
2015-10-06 13:46:30 +01:00
cmp r2, 0x3
2015-10-10 11:12:48 +01:00
bne @08002AE0
2015-10-06 13:46:30 +01:00
cmp r1, 0x1F
2015-10-10 11:12:48 +01:00
ble @08002AD8
2015-10-06 13:46:30 +01:00
adds r1, 0x20
2015-10-10 11:12:48 +01:00
@08002AD8:
2015-10-06 13:46:30 +01:00
cmp r4, 0x1F
2015-10-10 11:12:48 +01:00
ble @08002AE0
2015-10-06 13:46:30 +01:00
subs r4, 0x20
adds r1, 0x20
2015-10-10 11:12:48 +01:00
@08002AE0:
2015-10-06 13:46:30 +01:00
lsls r0, r1, 5
adds r0, r4
pop {r4}
pop {r1}
bx r1
2015-11-30 07:17:50 +00:00
thumb_func_end GetTileMapIndexFromCoords
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start CopyTileMapEntry
; void CopyTileMapEntry(u16 *src, u16 *dest, s32 palette1, u16 tileOffset, u32 palette2)
CopyTileMapEntry: ; 8002AEC
2015-10-06 13:46:30 +01:00
push {r4-r6,lr}
adds r4, r0, 0
adds r6, r1, 0
ldr r5, [sp, 0x10]
cmp r2, 0x10
2015-10-10 11:12:48 +01:00
beq @08002B14
2015-10-06 13:46:30 +01:00
cmp r2, 0x10
2015-10-10 11:12:48 +01:00
bgt @08002B34
2015-10-06 13:46:30 +01:00
cmp r2, 0
2015-10-10 11:12:48 +01:00
blt @08002B34
2015-10-06 13:46:30 +01:00
ldrh r0, [r4]
adds r0, r3
ldr r3, =0x00000fff
adds r1, r3, 0
ands r0, r1
adds r1, r2, r5
lsls r1, 12
2015-10-10 11:12:48 +01:00
b @08002B3A
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@08002B14:
2015-10-06 13:46:30 +01:00
ldrh r1, [r6]
movs r0, 0xFC
lsls r0, 8
ands r1, r0
lsls r2, r5, 12
adds r2, r1, r2
ldrh r0, [r4]
adds r0, r3
ldr r3, =0x000003ff
adds r1, r3, 0
ands r0, r1
orrs r0, r2
2015-10-10 11:12:48 +01:00
b @08002B3C
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@08002B34:
2015-10-06 13:46:30 +01:00
ldrh r0, [r4]
adds r0, r3
lsls r1, r5, 12
2015-10-10 11:12:48 +01:00
@08002B3A:
2015-10-06 13:46:30 +01:00
adds r0, r1
2015-10-10 11:12:48 +01:00
@08002B3C:
2015-10-06 13:46:30 +01:00
lsls r0, 16
lsrs r1, r0, 16
strh r1, [r6]
pop {r4-r6}
pop {r0}
bx r0
2015-11-30 07:17:50 +00:00
thumb_func_end CopyTileMapEntry
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start GetBgType
; u16 GetBgType(u8 bg)
GetBgType: ; 8002B48
2015-10-06 13:46:30 +01:00
push {r4,r5,lr}
lsls r0, 24
lsrs r4, r0, 24
adds r5, r4, 0
2015-11-30 07:17:50 +00:00
bl GetBgMode
2015-10-06 13:46:30 +01:00
lsls r0, 24
lsrs r0, 24
cmp r4, 0x2
2015-10-10 11:12:48 +01:00
beq @08002B76
2015-10-06 13:46:30 +01:00
cmp r4, 0x2
2015-10-10 11:12:48 +01:00
ble @08002B66
2015-10-06 13:46:30 +01:00
cmp r4, 0x3
2015-10-10 11:12:48 +01:00
beq @08002B86
b @08002B8E
@08002B66:
2015-10-06 13:46:30 +01:00
cmp r5, 0
2015-10-10 11:12:48 +01:00
blt @08002B8E
2015-10-06 13:46:30 +01:00
cmp r0, 0x1
2015-10-10 11:12:48 +01:00
bgt @08002B8E
2015-10-06 13:46:30 +01:00
cmp r0, 0
2015-10-10 11:12:48 +01:00
blt @08002B8E
@08002B72:
2015-10-06 13:46:30 +01:00
movs r0, 0
2015-10-10 11:12:48 +01:00
b @08002B90
@08002B76:
2015-10-06 13:46:30 +01:00
cmp r0, 0
2015-10-10 11:12:48 +01:00
beq @08002B72
2015-10-06 13:46:30 +01:00
cmp r0, 0
2015-10-10 11:12:48 +01:00
blt @08002B8E
2015-10-06 13:46:30 +01:00
cmp r0, 0x2
2015-10-10 11:12:48 +01:00
bgt @08002B8E
@08002B82:
2015-10-06 13:46:30 +01:00
movs r0, 0x1
2015-10-10 11:12:48 +01:00
b @08002B90
@08002B86:
2015-10-06 13:46:30 +01:00
cmp r0, 0
2015-10-10 11:12:48 +01:00
beq @08002B72
2015-10-06 13:46:30 +01:00
cmp r0, 0x2
2015-10-10 11:12:48 +01:00
beq @08002B82
@08002B8E:
2015-10-06 13:46:30 +01:00
ldr r0, =0x0000ffff
2015-10-10 11:12:48 +01:00
@08002B90:
2015-10-06 13:46:30 +01:00
pop {r4,r5}
pop {r1}
bx r1
.pool
2015-11-30 07:17:50 +00:00
thumb_func_end GetBgType
2015-10-06 13:46:30 +01:00
2015-11-30 07:17:50 +00:00
thumb_func_start IsInvalidBg_
; BOOL IsInvalidBg_(u8 bg)
IsInvalidBg_: ; 8002B9C
2015-10-06 13:46:30 +01:00
push {lr}
lsls r0, 24
lsrs r0, 24
cmp r0, 0x3
2015-10-10 11:12:48 +01:00
bhi @08002BAA
2015-10-06 13:46:30 +01:00
movs r0, 0
2015-10-10 11:12:48 +01:00
b @08002BAC
@08002BAA:
2015-10-06 13:46:30 +01:00
movs r0, 0x1
2015-10-10 11:12:48 +01:00
@08002BAC:
2015-10-06 13:46:30 +01:00
pop {r1}
bx r1
2015-11-30 07:17:50 +00:00
thumb_func_end IsInvalidBg_
2015-10-06 13:46:30 +01:00
thumb_func_start IsTileMapOutsideWram
2015-11-30 07:17:50 +00:00
; BOOL IsTileMapOutsideWram(u8 bg)
2015-10-10 11:12:48 +01:00
IsTileMapOutsideWram: ; 8002BB0
2015-10-06 13:46:30 +01:00
push {lr}
lsls r0, 24
ldr r1, =0x030008f8
lsrs r0, 20
adds r1, 0x4
adds r0, r1
ldr r1, [r0]
ldr r0, =0x03008000
cmp r1, r0
2015-10-10 11:12:48 +01:00
bhi @08002BD4
2015-10-06 13:46:30 +01:00
cmp r1, 0
2015-10-10 11:12:48 +01:00
beq @08002BD4
2015-10-06 13:46:30 +01:00
movs r0, 0
2015-10-10 11:12:48 +01:00
b @08002BD6
2015-10-06 13:46:30 +01:00
.pool
2015-10-10 11:12:48 +01:00
@08002BD4:
2015-10-06 13:46:30 +01:00
movs r0, 0x1
2015-10-10 11:12:48 +01:00
@08002BD6:
2015-10-06 13:46:30 +01:00
pop {r1}
bx r1
thumb_func_end IsTileMapOutsideWram