diff --git a/asm/dma3_manager.s b/asm/dma3_manager.s new file mode 100644 index 000000000..edd7e2cf1 --- /dev/null +++ b/asm/dma3_manager.s @@ -0,0 +1,553 @@ + thumb_func_start dma3_transfer_queue_clear +dma3_transfer_queue_clear: @ 8000BB8 + push {lr} + ldr r2, =0x03000810 + movs r0, 0x1 + strb r0, [r2] + ldr r1, =0x03000811 + movs r0, 0 + strb r0, [r1] + movs r3, 0 + ldr r0, =0x03000010 + movs r1, 0x7F +_08000BCC: + strh r3, [r0, 0x8] + str r3, [r0] + str r3, [r0, 0x4] + adds r0, 0x10 + subs r1, 0x1 + cmp r1, 0 + bge _08000BCC + movs r0, 0 + strb r0, [r2] + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end dma3_transfer_queue_clear + + thumb_func_start dma_transfer_queue_process +dma_transfer_queue_process: @ 8000BF0 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0xC + ldr r0, =0x03000810 + ldrb r0, [r0] + cmp r0, 0 + beq _08000C06 + b _08000E46 +_08000C06: + movs r0, 0 + str r0, [sp, 0x8] + ldr r1, =0x03000010 + ldr r2, =0x03000811 + ldrb r0, [r2] + lsls r0, 4 + adds r0, r1 + ldrh r0, [r0, 0x8] + mov r12, r2 + cmp r0, 0 + bne _08000C1E + b _08000E46 +_08000C1E: + mov r8, r1 + adds r1, 0x4 + mov r10, r1 + movs r6, 0x80 + lsls r6, 5 + ldr r7, =0x040000d4 + movs r2, 0 + mov r9, r2 +_08000C2E: + mov r3, r12 + ldrb r0, [r3] + lsls r5, r0, 4 + mov r0, r8 + adds r1, r5, r0 + ldrh r0, [r1, 0x8] + ldr r2, [sp, 0x8] + adds r0, r2, r0 + lsls r0, 16 + lsrs r0, 16 + str r0, [sp, 0x8] + movs r0, 0xA0 + lsls r0, 8 + ldr r3, [sp, 0x8] + cmp r3, r0 + bls _08000C50 + b _08000E46 +_08000C50: + ldr r0, =0x04000006 + ldrb r0, [r0] + cmp r0, 0xE0 + bls _08000C5A + b _08000E46 +_08000C5A: + ldrh r0, [r1, 0xA] + cmp r0, 0x2 + beq _08000CD0 + cmp r0, 0x2 + bgt _08000C80 + cmp r0, 0x1 + beq _08000C8C + b _08000DF0 + .align 2, 0 + .pool +_08000C80: + cmp r0, 0x3 + beq _08000D3C + cmp r0, 0x4 + bne _08000C8A + b _08000D88 +_08000C8A: + b _08000DF0 +_08000C8C: + ldr r3, [r1] + mov r2, r10 + adds r0, r5, r2 + ldr r2, [r0] + ldrh r1, [r1, 0x8] + cmp r1, r6 + bhi _08000CA6 + str r3, [r7] + str r2, [r7, 0x4] + lsrs r0, r1, 2 + movs r1, 0x84 + lsls r1, 24 + b _08000DAA +_08000CA6: + ldr r4, =0x040000d4 + str r3, [r4] + str r2, [r4, 0x4] + ldr r0, =0x84000400 + str r0, [r4, 0x8] + ldr r0, [r4, 0x8] + adds r3, r6 + adds r2, r6 + subs r1, r6 + cmp r1, r6 + bhi _08000CA6 + str r3, [r4] + str r2, [r4, 0x4] + lsrs r0, r1, 2 + movs r1, 0x84 + lsls r1, 24 + b _08000D76 + .align 2, 0 + .pool +_08000CD0: + mov r3, r10 + adds r0, r5, r3 + ldr r4, [r0] + ldrh r1, [r1, 0x8] + cmp r1, r6 + bhi _08000CF4 + mov r0, r8 + adds r0, 0xC + adds r0, r5, r0 + ldr r0, [r0] + str r0, [sp] + mov r5, sp + str r5, [r7] + str r4, [r7, 0x4] + lsrs r0, r1, 2 + movs r1, 0x85 + lsls r1, 24 + b _08000DAA +_08000CF4: + mov r2, r12 + ldrb r0, [r2] + lsls r0, 4 + mov r5, r8 + adds r5, 0xC + adds r0, r5 + ldr r0, [r0] + str r0, [sp] + ldr r3, =0x040000d4 + mov r0, sp + str r0, [r3] + str r4, [r3, 0x4] + ldr r0, =0x85000400 + str r0, [r3, 0x8] + ldr r0, [r3, 0x8] + adds r4, r6 + subs r1, r6 + cmp r1, r6 + bhi _08000CF4 + ldrb r0, [r2] + lsls r0, 4 + adds r0, r5 + ldr r0, [r0] + str r0, [sp] + mov r2, sp + str r2, [r3] + str r4, [r3, 0x4] + lsrs r0, r1, 2 + movs r1, 0x85 + lsls r1, 24 + b _08000DEA + .align 2, 0 + .pool +_08000D3C: + ldr r3, [r1] + mov r2, r10 + adds r0, r5, r2 + ldr r2, [r0] + ldrh r1, [r1, 0x8] + cmp r1, r6 + bhi _08000D56 + str r3, [r7] + str r2, [r7, 0x4] + lsrs r0, r1, 1 + movs r1, 0x80 + lsls r1, 24 + b _08000DAA +_08000D56: + ldr r4, =0x040000d4 + str r3, [r4] + str r2, [r4, 0x4] + ldr r0, =0x80000800 + str r0, [r4, 0x8] + ldr r0, [r4, 0x8] + adds r3, r6 + adds r2, r6 + subs r1, r6 + cmp r1, r6 + bhi _08000D56 + str r3, [r4] + str r2, [r4, 0x4] + lsrs r0, r1, 1 + movs r1, 0x80 + lsls r1, 24 +_08000D76: + orrs r0, r1 + str r0, [r4, 0x8] + ldr r0, [r4, 0x8] + b _08000DF0 + .align 2, 0 + .pool +_08000D88: + mov r3, r10 + adds r0, r5, r3 + ldr r2, [r0] + ldrh r4, [r1, 0x8] + add r1, sp, 0x4 + cmp r4, r6 + bhi _08000DB2 + mov r0, r8 + adds r0, 0xC + adds r0, r5, r0 + ldr r0, [r0] + strh r0, [r1] + str r1, [r7] + str r2, [r7, 0x4] + lsrs r0, r4, 1 + movs r1, 0x81 + lsls r1, 24 +_08000DAA: + orrs r0, r1 + str r0, [r7, 0x8] + ldr r0, [r7, 0x8] + b _08000DF0 +_08000DB2: + mov r5, r12 + ldrb r0, [r5] + lsls r0, 4 + ldr r3, =0x0300001c + adds r0, r3 + ldr r0, [r0] + strh r0, [r1] + ldr r3, =0x040000d4 + str r1, [r3] + str r2, [r3, 0x4] + ldr r0, =0x81000800 + str r0, [r3, 0x8] + ldr r0, [r3, 0x8] + adds r2, r6 + subs r4, r6 + cmp r4, r6 + bhi _08000DB2 + ldrb r0, [r5] + lsls r0, 4 + ldr r5, =0x0300001c + adds r0, r5 + ldr r0, [r0] + strh r0, [r1] + str r1, [r3] + str r2, [r3, 0x4] + lsrs r0, r4, 1 + movs r1, 0x81 + lsls r1, 24 +_08000DEA: + orrs r0, r1 + str r0, [r3, 0x8] + ldr r0, [r3, 0x8] +_08000DF0: + ldr r1, =0x03000010 + mov r3, r12 + ldrb r0, [r3] + lsls r0, 4 + adds r0, r1 + mov r2, r9 + str r2, [r0] + ldrb r0, [r3] + lsls r0, 4 + add r0, r10 + str r2, [r0] + ldrb r0, [r3] + lsls r0, 4 + adds r0, r1 + movs r4, 0 + strh r2, [r0, 0x8] + ldrb r0, [r3] + lsls r0, 4 + adds r0, r1 + mov r5, r9 + strh r5, [r0, 0xA] + ldrb r0, [r3] + lsls r0, 4 + adds r1, 0xC + adds r0, r1 + mov r1, r9 + str r1, [r0] + ldrb r0, [r3] + adds r0, 0x1 + strb r0, [r3] + lsls r0, 24 + cmp r0, 0 + bge _08000E34 + strb r4, [r3] +_08000E34: + mov r2, r12 + ldrb r0, [r2] + lsls r0, 4 + ldr r3, =0x03000010 + adds r0, r3 + ldrh r0, [r0, 0x8] + cmp r0, 0 + beq _08000E46 + b _08000C2E +_08000E46: + add sp, 0xC + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end dma_transfer_queue_process + + thumb_func_start dma3_transfer_queue_add_copy +dma3_transfer_queue_add_copy: @ 8000E68 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + mov r12, r0 + mov r8, r1 + lsls r2, 16 + lsrs r7, r2, 16 + lsls r3, 24 + lsrs r4, r3, 24 + movs r5, 0 + ldr r1, =0x03000810 + movs r0, 0x1 + strb r0, [r1] + ldr r0, =0x03000811 + ldrb r2, [r0] + mov r10, r1 + ldr r6, =0x03000010 + mov r9, r6 + lsls r0, r2, 4 + adds r1, r0, r6 +_08000E94: + lsls r3, r2, 4 + ldrh r0, [r1, 0x8] + cmp r0, 0 + bne _08000ED4 + mov r0, r12 + str r0, [r1] + mov r0, r9 + adds r0, 0x4 + adds r0, r3, r0 + mov r3, r8 + str r3, [r0] + strh r7, [r1, 0x8] + cmp r4, 0x1 + bne _08000EC0 + strh r4, [r1, 0xA] + b _08000EC4 + .align 2, 0 + .pool +_08000EC0: + movs r0, 0x3 + strh r0, [r1, 0xA] +_08000EC4: + movs r0, 0 + ldr r1, =0x03000810 + strb r0, [r1] + lsls r0, r2, 16 + asrs r0, 16 + b _08000EF0 + .align 2, 0 + .pool +_08000ED4: + adds r1, 0x10 + adds r2, 0x1 + cmp r2, 0x7F + ble _08000EE0 + adds r1, r6, 0 + movs r2, 0 +_08000EE0: + adds r5, 0x1 + cmp r5, 0x7F + ble _08000E94 + movs r0, 0 + mov r3, r10 + strb r0, [r3] + movs r0, 0x1 + negs r0, r0 +_08000EF0: + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end dma3_transfer_queue_add_copy + + thumb_func_start dma3_transfer_queue_add_fill +dma3_transfer_queue_add_fill: @ 8000F00 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + mov r9, r0 + mov r8, r1 + lsls r2, 16 + lsrs r7, r2, 16 + lsls r3, 24 + lsrs r5, r3, 24 + movs r6, 0 + ldr r0, =0x03000811 + ldrb r2, [r0] + ldr r1, =0x03000810 + movs r0, 0x1 + strb r0, [r1] + mov r10, r1 + ldr r0, =0x03000010 + mov r12, r0 + mov r4, r12 + lsls r0, r2, 4 + adds r0, 0x8 + adds r1, r0, r4 +_08000F30: + lsls r3, r2, 4 + ldrh r0, [r1] + cmp r0, 0 + bne _08000F78 + adds r0, r4, 0x4 + adds r0, r3, r0 + mov r6, r8 + str r6, [r0] + strh r7, [r1] + strh r5, [r1, 0x2] + adds r0, r4, 0 + adds r0, 0xC + adds r0, r3, r0 + mov r3, r9 + str r3, [r0] + cmp r5, 0x1 + bne _08000F64 + movs r0, 0x2 + b _08000F66 + .align 2, 0 + .pool +_08000F64: + movs r0, 0x4 +_08000F66: + strh r0, [r1, 0x2] + movs r0, 0 + ldr r6, =0x03000810 + strb r0, [r6] + lsls r0, r2, 16 + asrs r0, 16 + b _08000F96 + .align 2, 0 + .pool +_08000F78: + adds r1, 0x10 + adds r2, 0x1 + cmp r2, 0x7F + ble _08000F86 + mov r1, r12 + adds r1, 0x8 + movs r2, 0 +_08000F86: + adds r6, 0x1 + cmp r6, 0x7F + ble _08000F30 + movs r0, 0 + mov r1, r10 + strb r0, [r1] + movs r0, 0x1 + negs r0, r0 +_08000F96: + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end dma3_transfer_queue_add_fill + + thumb_func_start dma3_transfer_queue_check_for_space +dma3_transfer_queue_check_for_space: @ 8000FA4 + push {lr} + movs r2, 0 + lsls r0, 16 + asrs r1, r0, 16 + movs r3, 0x1 + negs r3, r3 + cmp r1, r3 + bne _08000FCC + ldr r1, =0x03000010 +_08000FB6: + ldrh r0, [r1, 0x8] + cmp r0, 0 + bne _08000FD8 + adds r1, 0x10 + adds r2, 0x1 + cmp r2, 0x7F + ble _08000FB6 +_08000FC4: + movs r0, 0 + b _08000FDC + .align 2, 0 + .pool +_08000FCC: + ldr r0, =0x03000010 + lsls r1, 4 + adds r1, r0 + ldrh r0, [r1, 0x8] + cmp r0, 0 + beq _08000FC4 +_08000FD8: + movs r0, 0x1 + negs r0, r0 +_08000FDC: + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end dma3_transfer_queue_check_for_space diff --git a/asm/emerald.s b/asm/emerald.s index 889109ead..6d189ab2d 100644 --- a/asm/emerald.s +++ b/asm/emerald.s @@ -13,18050 +13,16 @@ Start: .include "crt0.s" .thumb - thumb_func_start Main -Main: - push {r4-r7,lr} - mov r7, r8 - push {r7} - movs r0, 0xFF - bl RegisterRamReset - movs r1, 0xA0 - lsls r1, 19 - ldr r2, =0x00007fff - adds r0, r2, 0 - strh r0, [r1] - bl lcd_io_copy_queue_clean - ldr r1, =0x04000204 - ldr r3, =0x00004014 - adds r0, r3, 0 - strh r0, [r1] - bl init_keypad_data - bl init_irq_handler - bl m4aSoundInit - bl lcd_enable_vcount_irq_at_150px - bl sub_800E6D0 - bl sub_802F21C - bl flash_timeout_start_on_timer_2_when_flash_present - bl init_saveblock_ptrs_and_set_copyright_callback2 - bl sound_sources_off - bl dma3_transfer_queue_clear - bl gpu_init_bgs - bl fboxes_set_default_ptr - ldr r0, =0x02000000 - movs r1, 0xE0 - lsls r1, 9 - bl init_malloc - ldr r0, =0x03002700 - movs r4, 0 - strb r4, [r0] - ldr r0, =0x03005d88 - ldr r0, [r0] - cmp r0, 0x1 - beq _08000414 - movs r0, 0 - bl set_callback2 -_08000414: - ldr r2, =0x030022b4 - strb r4, [r2] - ldr r1, =0x03000000 - movs r3, 0xFC - lsls r3, 4 - adds r0, r3, 0 - strh r0, [r1] - ldr r7, =0x030022c0 - movs r0, 0 - mov r8, r0 - adds r6, r2, 0 -_0800042A: - bl load_keys - ldr r0, =0x03002700 - ldrb r0, [r0] - cmp r0, 0 - bne _08000454 - ldrh r1, [r7, 0x28] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08000454 - movs r0, 0xE - ands r0, r1 - cmp r0, 0xE - bne _08000454 - bl rfu_REQ_stopMode - bl rfu_waitREQComplete - bl do_reset -_08000454: - bl sub_8087634 - cmp r0, 0x1 - bne _0800048C - strb r0, [r6] - bl call_callbacks_wrapper - movs r0, 0 - strb r0, [r6] - b _080004B2 - .align 2, 0 - .pool -_0800048C: - ldr r5, =0x030022b4 - movs r0, 0 - strb r0, [r5] - bl call_callbacks_wrapper - bl sub_80875C8 - adds r4, r0, 0 - cmp r4, 0x1 - bne _080004B2 - movs r0, 0 - strh r0, [r7, 0x2E] - bl copy_queue_clear - strb r4, [r5] - bl call_callbacks_wrapper - mov r2, r8 - strb r2, [r5] -_080004B2: - bl gametime_increment - bl sound_something - bl wait_for_vblank - b _0800042A - .align 2, 0 - .pool - thumb_func_end Main - thumb_func_start call_callbacks_wrapper -call_callbacks_wrapper: @ 80004C4 - push {lr} - bl sub_800B40C - lsls r0, 24 - cmp r0, 0 - bne _080004D4 - bl call_callbacks -_080004D4: - pop {r0} - bx r0 - thumb_func_end call_callbacks_wrapper - - thumb_func_start init_saveblock_ptrs_and_set_copyright_callback2 -init_saveblock_ptrs_and_set_copyright_callback2: @ 80004D8 - push {lr} - ldr r2, =0x030022c0 - movs r0, 0 - str r0, [r2, 0x20] - ldr r1, =0x0203cf5c - str r0, [r1] - str r0, [r2, 0x24] - str r0, [r2] - ldr r0, =c2_copyright_1 + 1 - bl set_callback2 - ldr r1, =0x03005d90 - ldr r0, =0x02024a54 - str r0, [r1] - ldr r1, =0x03005d94 - ldr r0, =0x02029808 - str r0, [r1] - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end init_saveblock_ptrs_and_set_copyright_callback2 - - thumb_func_start call_callbacks -call_callbacks: @ 800051C - push {r4,lr} - ldr r4, =0x030022c0 - ldr r0, [r4] - cmp r0, 0 - beq _0800052A - bl _call_via_r0 -_0800052A: - ldr r0, [r4, 0x4] - cmp r0, 0 - beq _08000534 - bl _call_via_r0 -_08000534: - pop {r4} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end call_callbacks - - thumb_func_start set_callback2 -set_callback2: @ 8000540 - ldr r1, =0x030022c0 - str r0, [r1, 0x4] - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - movs r0, 0 - strb r0, [r1] - bx lr - .align 2, 0 - .pool - thumb_func_end set_callback2 - - thumb_func_start start_timer1 -start_timer1: @ 8000554 - ldr r1, =0x04000106 - movs r0, 0x80 - strh r0, [r1] - bx lr - .align 2, 0 - .pool - thumb_func_end start_timer1 - - thumb_func_start set_rand_seed_and_trainer_id_hi -set_rand_seed_and_trainer_id_hi: @ 8000560 - push {r4,lr} - ldr r0, =0x04000104 - ldrh r4, [r0] - adds r0, r4, 0 - bl SeedRng - ldr r1, =0x04000106 - movs r0, 0 - strh r0, [r1] - ldr r0, =0x02020000 - strh r4, [r0] - pop {r4} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end set_rand_seed_and_trainer_id_hi - - thumb_func_start get_trainer_id_hi -get_trainer_id_hi: @ 8000588 - ldr r0, =0x02020000 - ldrh r0, [r0] - bx lr - .align 2, 0 - .pool - thumb_func_end get_trainer_id_hi - - thumb_func_start lcd_enable_vcount_irq_at_150px -lcd_enable_vcount_irq_at_150px: @ 8000594 - push {lr} - movs r0, 0x4 - bl lcd_io_get - movs r1, 0xFF - ands r1, r0 - movs r2, 0x96 - lsls r2, 8 - adds r0, r2, 0 - orrs r1, r0 - movs r0, 0x20 - orrs r1, r0 - movs r0, 0x4 - bl lcd_io_set - movs r0, 0x4 - bl enable_irqs - pop {r0} - bx r0 - thumb_func_end lcd_enable_vcount_irq_at_150px - - thumb_func_start init_keypad_data -init_keypad_data: @ 80005BC - ldr r1, =0x030026fc - movs r0, 0x5 - strh r0, [r1] - ldr r1, =0x030022b0 - movs r0, 0x28 - strh r0, [r1] - ldr r1, =0x030022c0 - movs r0, 0 - strh r0, [r1, 0x2C] - strh r0, [r1, 0x2E] - strh r0, [r1, 0x30] - strh r0, [r1, 0x28] - strh r0, [r1, 0x2A] - bx lr - .align 2, 0 - .pool - thumb_func_end init_keypad_data - - thumb_func_start load_keys -load_keys: @ 80005E4 - push {lr} - ldr r0, =0x04000130 - ldrh r1, [r0] - ldr r2, =0x000003ff - adds r0, r2, 0 - adds r3, r0, 0 - eors r3, r1 - ldr r1, =0x030022c0 - ldrh r2, [r1, 0x28] - adds r0, r3, 0 - bics r0, r2 - strh r0, [r1, 0x2A] - strh r0, [r1, 0x2E] - strh r0, [r1, 0x30] - adds r2, r1, 0 - cmp r3, 0 - beq _08000630 - ldrh r0, [r2, 0x2C] - cmp r0, r3 - bne _08000630 - ldrh r0, [r2, 0x32] - subs r0, 0x1 - strh r0, [r2, 0x32] - lsls r0, 16 - cmp r0, 0 - bne _08000636 - strh r3, [r2, 0x30] - ldr r0, =0x030026fc - b _08000632 - .align 2, 0 - .pool -_08000630: - ldr r0, =0x030022b0 -_08000632: - ldrh r0, [r0] - strh r0, [r2, 0x32] -_08000636: - strh r3, [r2, 0x28] - strh r3, [r2, 0x2C] - ldr r0, =0x03005d90 - ldr r0, [r0] - ldrb r0, [r0, 0x13] - cmp r0, 0x2 - bne _08000668 - ldrh r1, [r2, 0x2E] - movs r3, 0x80 - lsls r3, 2 - adds r0, r3, 0 - ands r0, r1 - cmp r0, 0 - beq _08000658 - movs r0, 0x1 - orrs r0, r1 - strh r0, [r2, 0x2E] -_08000658: - ldrh r1, [r2, 0x2C] - adds r0, r3, 0 - ands r0, r1 - cmp r0, 0 - beq _08000668 - movs r0, 0x1 - orrs r0, r1 - strh r0, [r2, 0x2C] -_08000668: - ldrh r1, [r2, 0x2E] - ldrh r0, [r2, 0x36] - ands r0, r1 - cmp r0, 0 - beq _08000676 - movs r0, 0x1 - strh r0, [r2, 0x34] -_08000676: - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end load_keys - - thumb_func_start init_irq_handler -init_irq_handler: @ 8000684 - push {r4,r5,lr} - ldr r5, =InterruptMain - ldr r4, =0x03002750 - ldr r3, =0x082e9548 - ldr r2, =0x03002710 - movs r1, 0xD -_08000690: - ldm r3!, {r0} - stm r2!, {r0} - subs r1, 0x1 - cmp r1, 0 - bge _08000690 - ldr r0, =0x040000d4 - str r5, [r0] - str r4, [r0, 0x4] - ldr r1, =0x84000200 - str r1, [r0, 0x8] - ldr r0, [r0, 0x8] - ldr r0, =0x03007ffc - str r4, [r0] - movs r0, 0 - bl SetVBlankCallback - movs r0, 0 - bl SetHBlankCallback - movs r0, 0 - bl set_serial_callback - ldr r1, =0x04000208 - movs r0, 0x1 - strh r0, [r1] - movs r0, 0x1 - bl enable_irqs - pop {r4,r5} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end init_irq_handler - - thumb_func_start SetVBlankCallback -SetVBlankCallback: @ 80006F0 - ldr r1, =0x030022c0 - str r0, [r1, 0xC] - bx lr - .align 2, 0 - .pool - thumb_func_end SetVBlankCallback - - thumb_func_start SetHBlankCallback -SetHBlankCallback: @ 80006FC - ldr r1, =0x030022c0 - str r0, [r1, 0x10] - bx lr - .align 2, 0 - .pool - thumb_func_end SetHBlankCallback - - thumb_func_start SetVCountCallback -SetVCountCallback: @ 8000708 - ldr r1, =0x030022c0 - str r0, [r1, 0x14] - bx lr - .align 2, 0 - .pool - thumb_func_end SetVCountCallback - - thumb_func_start restore_serial_timer3_irq_handlers -restore_serial_timer3_irq_handlers: @ 8000714 - ldr r0, =0x03002710 - ldr r1, =irq_serial + 1 - str r1, [r0, 0x4] - ldr r1, =irq_timer3 + 1 - str r1, [r0, 0x8] - bx lr - .align 2, 0 - .pool - thumb_func_end restore_serial_timer3_irq_handlers - - thumb_func_start set_serial_callback -set_serial_callback: @ 800072C - ldr r1, =0x030022c0 - str r0, [r1, 0x18] - bx lr - .align 2, 0 - .pool - thumb_func_end set_serial_callback - - thumb_func_start irq_vblank -irq_vblank: @ 8000738 - push {r4,lr} - ldr r0, =0x030030fc - ldrb r0, [r0] - cmp r0, 0 - beq _0800074C - bl rfu_syncVBlank__ - b _08000758 - .align 2, 0 - .pool -_0800074C: - ldr r0, =0x03002748 - ldrb r0, [r0] - cmp r0, 0 - bne _08000758 - bl sub_800B9B8 -_08000758: - ldr r0, =0x030022c0 - ldr r1, [r0, 0x20] - adds r1, 0x1 - str r1, [r0, 0x20] - ldr r1, =0x0203cf5c - ldr r1, [r1] - adds r4, r0, 0 - cmp r1, 0 - beq _08000778 - ldr r2, [r1] - movs r0, 0x2 - negs r0, r0 - cmp r2, r0 - bhi _08000778 - adds r0, r2, 0x1 - str r0, [r1] -_08000778: - ldr r0, [r4, 0xC] - cmp r0, 0 - beq _08000782 - bl _call_via_r0 -_08000782: - ldr r0, [r4, 0x24] - adds r0, 0x1 - str r0, [r4, 0x24] - bl lcd_io_copy_queue_process - bl dma_transfer_queue_process - ldr r1, =0x03002f50 - ldr r0, =0x03006380 - ldrb r0, [r0, 0x4] - strb r0, [r1] - bl m4aSoundMain - bl sub_8033648 - ldr r1, =0x00000439 - adds r0, r4, r1 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _080007BA - ldr r0, =0x02022fec - ldr r0, [r0] - ldr r1, =0x013f0102 - ands r0, r1 - cmp r0, 0 - bne _080007BE -_080007BA: - bl GenerateRandomNumber -_080007BE: - bl sub_800E174 - ldr r2, =0x03007ff8 - ldrh r0, [r2] - movs r1, 0x1 - orrs r0, r1 - strh r0, [r2] - ldr r0, =0x030022c0 - ldrh r2, [r0, 0x1C] - ldrh r3, [r0, 0x1C] - orrs r1, r2 - strh r1, [r0, 0x1C] - pop {r4} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end irq_vblank - - thumb_func_start flash_timeout_start_on_timer_2 -flash_timeout_start_on_timer_2: @ 8000800 - push {lr} - ldr r1, =0x0300272c - movs r0, 0x2 - bl SetFlashTimerIntr - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end flash_timeout_start_on_timer_2 - - thumb_func_start irq_hblank -irq_hblank: @ 8000814 - push {r4,lr} - ldr r4, =0x030022c0 - ldr r0, [r4, 0x10] - cmp r0, 0 - beq _08000822 - bl _call_via_r0 -_08000822: - ldr r2, =0x03007ff8 - ldrh r0, [r2] - movs r1, 0x2 - orrs r0, r1 - strh r0, [r2] - ldrh r0, [r4, 0x1C] - ldrh r2, [r4, 0x1C] - orrs r1, r0 - strh r1, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end irq_hblank - - thumb_func_start irq_vcount -irq_vcount: @ 8000844 - push {r4,lr} - ldr r4, =0x030022c0 - ldr r0, [r4, 0x14] - cmp r0, 0 - beq _08000852 - bl _call_via_r0 -_08000852: - bl SoundVSync_rev01 - ldr r2, =0x03007ff8 - ldrh r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strh r0, [r2] - ldrh r0, [r4, 0x1C] - ldrh r2, [r4, 0x1C] - orrs r1, r0 - strh r1, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end irq_vcount - - thumb_func_start irq_serial -irq_serial: @ 8000878 - push {r4,lr} - ldr r4, =0x030022c0 - ldr r0, [r4, 0x18] - cmp r0, 0 - beq _08000886 - bl _call_via_r0 -_08000886: - ldr r2, =0x03007ff8 - ldrh r0, [r2] - movs r1, 0x80 - orrs r0, r1 - strh r0, [r2] - ldrh r0, [r4, 0x1C] - ldrh r2, [r4, 0x1C] - orrs r1, r0 - strh r1, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end irq_serial - - thumb_func_start irq_other -irq_other: @ 80008A8 - bx lr - thumb_func_end irq_other - - thumb_func_start wait_for_vblank -wait_for_vblank: @ 80008AC - push {lr} - ldr r2, =0x030022c0 - ldrh r1, [r2, 0x1C] - ldr r0, =0x0000fffe - ands r0, r1 - ldrh r1, [r2, 0x1C] - strh r0, [r2, 0x1C] - ldrh r1, [r2, 0x1C] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _080008D0 - movs r3, 0x1 -_080008C6: - ldrh r1, [r2, 0x1C] - adds r0, r3, 0 - ands r0, r1 - cmp r0, 0 - beq _080008C6 -_080008D0: - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end wait_for_vblank - - thumb_func_start sub_80008DC -sub_80008DC: @ 80008DC - ldr r1, =0x0203cf5c - str r0, [r1] - bx lr - .align 2, 0 - .pool - thumb_func_end sub_80008DC - - thumb_func_start sub_80008E8 -sub_80008E8: @ 80008E8 - ldr r1, =0x0203cf5c - movs r0, 0 - str r0, [r1] - bx lr - .align 2, 0 - .pool - thumb_func_end sub_80008E8 - - thumb_func_start do_reset -do_reset: @ 80008F4 - push {r4,lr} - ldr r1, =0x04000208 - movs r0, 0 - strh r0, [r1] - bl SoundVSyncOff_rev01 - bl remove_some_task - ldr r1, =0x040000bc - ldrh r2, [r1, 0xA] - ldr r3, =0x0000c5ff - adds r0, r3, 0 - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r4, [r1, 0xA] - ldr r2, =0x00007fff - adds r0, r2, 0 - ands r0, r4 - strh r0, [r1, 0xA] - ldrh r0, [r1, 0xA] - adds r1, 0xC - ldrh r4, [r1, 0xA] - adds r0, r3, 0 - ands r0, r4 - strh r0, [r1, 0xA] - ldrh r4, [r1, 0xA] - adds r0, r2, 0 - ands r0, r4 - strh r0, [r1, 0xA] - ldrh r0, [r1, 0xA] - ldr r0, =0x040000d4 - ldrh r1, [r0, 0xA] - ands r3, r1 - strh r3, [r0, 0xA] - ldrh r1, [r0, 0xA] - ands r2, r1 - strh r2, [r0, 0xA] - ldrh r0, [r0, 0xA] - bl sub_82E2168 - movs r0, 0xFF - bl SoftReset - pop {r4} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end do_reset - - thumb_func_start sub_8000964 -sub_8000964: @ 8000964 - push {lr} - sub sp, 0x4 - mov r1, sp - movs r0, 0 - strh r0, [r1] - ldr r1, =0x03007330 - ldr r2, =0x01000034 - mov r0, sp - bl CpuSet - add sp, 0x4 - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end sub_8000964 - - thumb_func_start malloc_header -malloc_header: @ 8000988 - push {r4,lr} - movs r4, 0 - strh r4, [r0] - ldr r4, =0x0000a3a3 - strh r4, [r0, 0x2] - str r3, [r0, 0x4] - str r1, [r0, 0x8] - str r2, [r0, 0xC] - pop {r4} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end malloc_header - - thumb_func_start malloc_unlinked_header -malloc_unlinked_header: @ 80009A4 - push {lr} - adds r2, r0, 0 - adds r3, r1, 0 - subs r3, 0x10 - adds r1, r2, 0 - bl malloc_header - pop {r0} - bx r0 - thumb_func_end malloc_unlinked_header - - thumb_func_start malloc_core -malloc_core: @ 80009B8 - push {r4-r6,lr} - adds r4, r0, 0 - adds r6, r4, 0 - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _080009CC - lsrs r0, r1, 2 - adds r0, 0x1 - lsls r1, r0, 2 -_080009CC: - movs r2, 0x1 -_080009CE: - ldrh r0, [r4] - cmp r0, 0 - bne _08000A0C - ldr r3, [r4, 0x4] - cmp r3, r1 - bcc _08000A0C - subs r0, r3, r1 - cmp r0, 0x1F - bhi _080009E4 - strh r2, [r4] - b _08000A06 -_080009E4: - subs r3, 0x10 - subs r3, r1 - adds r0, r1, 0 - adds r0, 0x10 - adds r5, r4, r0 - strh r2, [r4] - str r1, [r4, 0x4] - ldr r2, [r4, 0xC] - adds r0, r5, 0 - adds r1, r4, 0 - bl malloc_header - str r5, [r4, 0xC] - ldr r0, [r5, 0xC] - cmp r0, r6 - beq _08000A06 - str r5, [r0, 0x8] -_08000A06: - adds r0, r4, 0 - adds r0, 0x10 - b _08000A18 -_08000A0C: - ldr r0, [r4, 0xC] - cmp r0, r6 - beq _08000A16 - adds r4, r0, 0 - b _080009CE -_08000A16: - movs r0, 0 -_08000A18: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end malloc_core - - thumb_func_start free_core -free_core: @ 8000A20 - push {r4,r5,lr} - cmp r1, 0 - beq _08000A7C - adds r5, r0, 0 - adds r2, r1, 0 - subs r2, 0x10 - movs r0, 0 - strh r0, [r2] - ldr r3, [r2, 0xC] - cmp r3, r5 - beq _08000A54 - ldrh r4, [r3] - cmp r4, 0 - bne _08000A54 - ldr r0, [r2, 0x4] - adds r0, 0x10 - ldr r1, [r3, 0x4] - adds r0, r1 - str r0, [r2, 0x4] - strh r4, [r3, 0x2] - ldr r0, [r2, 0xC] - ldr r0, [r0, 0xC] - str r0, [r2, 0xC] - cmp r0, r5 - beq _08000A54 - str r2, [r0, 0x8] -_08000A54: - cmp r2, r5 - beq _08000A7C - ldr r1, [r2, 0x8] - ldrh r3, [r1] - cmp r3, 0 - bne _08000A7C - ldr r0, [r2, 0xC] - str r0, [r1, 0xC] - ldr r1, [r2, 0xC] - cmp r1, r5 - beq _08000A6E - ldr r0, [r2, 0x8] - str r0, [r1, 0x8] -_08000A6E: - strh r3, [r2, 0x2] - ldr r0, [r2, 0x8] - ldr r1, [r0, 0x4] - adds r1, 0x10 - ldr r2, [r2, 0x4] - adds r1, r2 - str r1, [r0, 0x4] -_08000A7C: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end free_core - - thumb_func_start malloc_core_and_clear -malloc_core_and_clear: @ 8000A84 - push {r4,r5,lr} - sub sp, 0x4 - adds r4, r1, 0 - bl malloc_core - adds r5, r0, 0 - cmp r5, 0 - beq _08000AB8 - movs r0, 0x3 - ands r0, r4 - cmp r0, 0 - beq _08000AA2 - lsrs r0, r4, 2 - adds r0, 0x1 - lsls r4, r0, 2 -_08000AA2: - movs r0, 0 - str r0, [sp] - lsls r2, r4, 9 - lsrs r2, 11 - movs r0, 0xA0 - lsls r0, 19 - orrs r2, r0 - mov r0, sp - adds r1, r5, 0 - bl CpuSet -_08000AB8: - adds r0, r5, 0 - add sp, 0x4 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end malloc_core_and_clear - - thumb_func_start check_memblk_core -check_memblk_core: @ 8000AC4 - push {r4,r5,lr} - adds r5, r0, 0 - adds r3, r1, 0 - subs r3, 0x10 - ldrh r2, [r3, 0x2] - ldr r0, =0x0000a3a3 - cmp r2, r0 - bne _08000B0A - ldr r0, [r3, 0xC] - ldrh r1, [r0, 0x2] - adds r4, r0, 0 - cmp r1, r2 - bne _08000B0A - cmp r4, r5 - beq _08000AE8 - ldr r0, [r4, 0x8] - cmp r0, r3 - bne _08000B0A -_08000AE8: - ldr r2, [r3, 0x8] - ldrh r1, [r2, 0x2] - ldr r0, =0x0000a3a3 - cmp r1, r0 - bne _08000B0A - cmp r2, r5 - beq _08000AFC - ldr r0, [r2, 0xC] - cmp r0, r3 - bne _08000B0A -_08000AFC: - cmp r4, r5 - beq _08000B14 - ldr r0, [r3, 0x4] - adds r0, 0x10 - adds r0, r3, r0 - cmp r4, r0 - beq _08000B14 -_08000B0A: - movs r0, 0 - b _08000B16 - .align 2, 0 - .pool -_08000B14: - movs r0, 0x1 -_08000B16: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end check_memblk_core - - thumb_func_start init_malloc -init_malloc: @ 8000B1C - push {lr} - ldr r2, =0x03000004 - str r0, [r2] - ldr r2, =0x03000008 - str r1, [r2] - bl malloc_unlinked_header - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end init_malloc - - thumb_func_start malloc -malloc: @ 8000B38 - push {lr} - adds r1, r0, 0 - ldr r0, =0x03000004 - ldr r0, [r0] - bl malloc_core - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end malloc - - thumb_func_start malloc_and_clear -malloc_and_clear: @ 8000B4C - push {lr} - adds r1, r0, 0 - ldr r0, =0x03000004 - ldr r0, [r0] - bl malloc_core_and_clear - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end malloc_and_clear - - thumb_func_start free -free: @ 8000B60 - push {lr} - adds r1, r0, 0 - ldr r0, =0x03000004 - ldr r0, [r0] - bl free_core - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end free - - thumb_func_start check_memblk -check_memblk: @ 8000B74 - push {lr} - adds r1, r0, 0 - ldr r0, =0x03000004 - ldr r0, [r0] - bl check_memblk_core - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end check_memblk - - thumb_func_start check_all_memblks -check_all_memblks: @ 8000B88 - push {r4,r5,lr} - ldr r0, =0x03000004 - ldr r4, [r0] - adds r5, r0, 0 -_08000B90: - ldr r0, [r5] - adds r1, r4, 0 - adds r1, 0x10 - bl check_memblk_core - cmp r0, 0 - beq _08000BB0 - ldr r4, [r4, 0xC] - ldr r0, [r5] - cmp r4, r0 - bne _08000B90 - movs r0, 0x1 - b _08000BB2 - .align 2, 0 - .pool -_08000BB0: - movs r0, 0 -_08000BB2: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end check_all_memblks - - thumb_func_start dma3_transfer_queue_clear -dma3_transfer_queue_clear: @ 8000BB8 - push {lr} - ldr r2, =0x03000810 - movs r0, 0x1 - strb r0, [r2] - ldr r1, =0x03000811 - movs r0, 0 - strb r0, [r1] - movs r3, 0 - ldr r0, =0x03000010 - movs r1, 0x7F -_08000BCC: - strh r3, [r0, 0x8] - str r3, [r0] - str r3, [r0, 0x4] - adds r0, 0x10 - subs r1, 0x1 - cmp r1, 0 - bge _08000BCC - movs r0, 0 - strb r0, [r2] - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end dma3_transfer_queue_clear - - thumb_func_start dma_transfer_queue_process -dma_transfer_queue_process: @ 8000BF0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - ldr r0, =0x03000810 - ldrb r0, [r0] - cmp r0, 0 - beq _08000C06 - b _08000E46 -_08000C06: - movs r0, 0 - str r0, [sp, 0x8] - ldr r1, =0x03000010 - ldr r2, =0x03000811 - ldrb r0, [r2] - lsls r0, 4 - adds r0, r1 - ldrh r0, [r0, 0x8] - mov r12, r2 - cmp r0, 0 - bne _08000C1E - b _08000E46 -_08000C1E: - mov r8, r1 - adds r1, 0x4 - mov r10, r1 - movs r6, 0x80 - lsls r6, 5 - ldr r7, =0x040000d4 - movs r2, 0 - mov r9, r2 -_08000C2E: - mov r3, r12 - ldrb r0, [r3] - lsls r5, r0, 4 - mov r0, r8 - adds r1, r5, r0 - ldrh r0, [r1, 0x8] - ldr r2, [sp, 0x8] - adds r0, r2, r0 - lsls r0, 16 - lsrs r0, 16 - str r0, [sp, 0x8] - movs r0, 0xA0 - lsls r0, 8 - ldr r3, [sp, 0x8] - cmp r3, r0 - bls _08000C50 - b _08000E46 -_08000C50: - ldr r0, =0x04000006 - ldrb r0, [r0] - cmp r0, 0xE0 - bls _08000C5A - b _08000E46 -_08000C5A: - ldrh r0, [r1, 0xA] - cmp r0, 0x2 - beq _08000CD0 - cmp r0, 0x2 - bgt _08000C80 - cmp r0, 0x1 - beq _08000C8C - b _08000DF0 - .align 2, 0 - .pool -_08000C80: - cmp r0, 0x3 - beq _08000D3C - cmp r0, 0x4 - bne _08000C8A - b _08000D88 -_08000C8A: - b _08000DF0 -_08000C8C: - ldr r3, [r1] - mov r2, r10 - adds r0, r5, r2 - ldr r2, [r0] - ldrh r1, [r1, 0x8] - cmp r1, r6 - bhi _08000CA6 - str r3, [r7] - str r2, [r7, 0x4] - lsrs r0, r1, 2 - movs r1, 0x84 - lsls r1, 24 - b _08000DAA -_08000CA6: - ldr r4, =0x040000d4 - str r3, [r4] - str r2, [r4, 0x4] - ldr r0, =0x84000400 - str r0, [r4, 0x8] - ldr r0, [r4, 0x8] - adds r3, r6 - adds r2, r6 - subs r1, r6 - cmp r1, r6 - bhi _08000CA6 - str r3, [r4] - str r2, [r4, 0x4] - lsrs r0, r1, 2 - movs r1, 0x84 - lsls r1, 24 - b _08000D76 - .align 2, 0 - .pool -_08000CD0: - mov r3, r10 - adds r0, r5, r3 - ldr r4, [r0] - ldrh r1, [r1, 0x8] - cmp r1, r6 - bhi _08000CF4 - mov r0, r8 - adds r0, 0xC - adds r0, r5, r0 - ldr r0, [r0] - str r0, [sp] - mov r5, sp - str r5, [r7] - str r4, [r7, 0x4] - lsrs r0, r1, 2 - movs r1, 0x85 - lsls r1, 24 - b _08000DAA -_08000CF4: - mov r2, r12 - ldrb r0, [r2] - lsls r0, 4 - mov r5, r8 - adds r5, 0xC - adds r0, r5 - ldr r0, [r0] - str r0, [sp] - ldr r3, =0x040000d4 - mov r0, sp - str r0, [r3] - str r4, [r3, 0x4] - ldr r0, =0x85000400 - str r0, [r3, 0x8] - ldr r0, [r3, 0x8] - adds r4, r6 - subs r1, r6 - cmp r1, r6 - bhi _08000CF4 - ldrb r0, [r2] - lsls r0, 4 - adds r0, r5 - ldr r0, [r0] - str r0, [sp] - mov r2, sp - str r2, [r3] - str r4, [r3, 0x4] - lsrs r0, r1, 2 - movs r1, 0x85 - lsls r1, 24 - b _08000DEA - .align 2, 0 - .pool -_08000D3C: - ldr r3, [r1] - mov r2, r10 - adds r0, r5, r2 - ldr r2, [r0] - ldrh r1, [r1, 0x8] - cmp r1, r6 - bhi _08000D56 - str r3, [r7] - str r2, [r7, 0x4] - lsrs r0, r1, 1 - movs r1, 0x80 - lsls r1, 24 - b _08000DAA -_08000D56: - ldr r4, =0x040000d4 - str r3, [r4] - str r2, [r4, 0x4] - ldr r0, =0x80000800 - str r0, [r4, 0x8] - ldr r0, [r4, 0x8] - adds r3, r6 - adds r2, r6 - subs r1, r6 - cmp r1, r6 - bhi _08000D56 - str r3, [r4] - str r2, [r4, 0x4] - lsrs r0, r1, 1 - movs r1, 0x80 - lsls r1, 24 -_08000D76: - orrs r0, r1 - str r0, [r4, 0x8] - ldr r0, [r4, 0x8] - b _08000DF0 - .align 2, 0 - .pool -_08000D88: - mov r3, r10 - adds r0, r5, r3 - ldr r2, [r0] - ldrh r4, [r1, 0x8] - add r1, sp, 0x4 - cmp r4, r6 - bhi _08000DB2 - mov r0, r8 - adds r0, 0xC - adds r0, r5, r0 - ldr r0, [r0] - strh r0, [r1] - str r1, [r7] - str r2, [r7, 0x4] - lsrs r0, r4, 1 - movs r1, 0x81 - lsls r1, 24 -_08000DAA: - orrs r0, r1 - str r0, [r7, 0x8] - ldr r0, [r7, 0x8] - b _08000DF0 -_08000DB2: - mov r5, r12 - ldrb r0, [r5] - lsls r0, 4 - ldr r3, =0x0300001c - adds r0, r3 - ldr r0, [r0] - strh r0, [r1] - ldr r3, =0x040000d4 - str r1, [r3] - str r2, [r3, 0x4] - ldr r0, =0x81000800 - str r0, [r3, 0x8] - ldr r0, [r3, 0x8] - adds r2, r6 - subs r4, r6 - cmp r4, r6 - bhi _08000DB2 - ldrb r0, [r5] - lsls r0, 4 - ldr r5, =0x0300001c - adds r0, r5 - ldr r0, [r0] - strh r0, [r1] - str r1, [r3] - str r2, [r3, 0x4] - lsrs r0, r4, 1 - movs r1, 0x81 - lsls r1, 24 -_08000DEA: - orrs r0, r1 - str r0, [r3, 0x8] - ldr r0, [r3, 0x8] -_08000DF0: - ldr r1, =0x03000010 - mov r3, r12 - ldrb r0, [r3] - lsls r0, 4 - adds r0, r1 - mov r2, r9 - str r2, [r0] - ldrb r0, [r3] - lsls r0, 4 - add r0, r10 - str r2, [r0] - ldrb r0, [r3] - lsls r0, 4 - adds r0, r1 - movs r4, 0 - strh r2, [r0, 0x8] - ldrb r0, [r3] - lsls r0, 4 - adds r0, r1 - mov r5, r9 - strh r5, [r0, 0xA] - ldrb r0, [r3] - lsls r0, 4 - adds r1, 0xC - adds r0, r1 - mov r1, r9 - str r1, [r0] - ldrb r0, [r3] - adds r0, 0x1 - strb r0, [r3] - lsls r0, 24 - cmp r0, 0 - bge _08000E34 - strb r4, [r3] -_08000E34: - mov r2, r12 - ldrb r0, [r2] - lsls r0, 4 - ldr r3, =0x03000010 - adds r0, r3 - ldrh r0, [r0, 0x8] - cmp r0, 0 - beq _08000E46 - b _08000C2E -_08000E46: - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end dma_transfer_queue_process - - thumb_func_start dma3_transfer_queue_add_copy -dma3_transfer_queue_add_copy: @ 8000E68 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - mov r12, r0 - mov r8, r1 - lsls r2, 16 - lsrs r7, r2, 16 - lsls r3, 24 - lsrs r4, r3, 24 - movs r5, 0 - ldr r1, =0x03000810 - movs r0, 0x1 - strb r0, [r1] - ldr r0, =0x03000811 - ldrb r2, [r0] - mov r10, r1 - ldr r6, =0x03000010 - mov r9, r6 - lsls r0, r2, 4 - adds r1, r0, r6 -_08000E94: - lsls r3, r2, 4 - ldrh r0, [r1, 0x8] - cmp r0, 0 - bne _08000ED4 - mov r0, r12 - str r0, [r1] - mov r0, r9 - adds r0, 0x4 - adds r0, r3, r0 - mov r3, r8 - str r3, [r0] - strh r7, [r1, 0x8] - cmp r4, 0x1 - bne _08000EC0 - strh r4, [r1, 0xA] - b _08000EC4 - .align 2, 0 - .pool -_08000EC0: - movs r0, 0x3 - strh r0, [r1, 0xA] -_08000EC4: - movs r0, 0 - ldr r1, =0x03000810 - strb r0, [r1] - lsls r0, r2, 16 - asrs r0, 16 - b _08000EF0 - .align 2, 0 - .pool -_08000ED4: - adds r1, 0x10 - adds r2, 0x1 - cmp r2, 0x7F - ble _08000EE0 - adds r1, r6, 0 - movs r2, 0 -_08000EE0: - adds r5, 0x1 - cmp r5, 0x7F - ble _08000E94 - movs r0, 0 - mov r3, r10 - strb r0, [r3] - movs r0, 0x1 - negs r0, r0 -_08000EF0: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end dma3_transfer_queue_add_copy - - thumb_func_start dma3_transfer_queue_add_fill -dma3_transfer_queue_add_fill: @ 8000F00 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - mov r9, r0 - mov r8, r1 - lsls r2, 16 - lsrs r7, r2, 16 - lsls r3, 24 - lsrs r5, r3, 24 - movs r6, 0 - ldr r0, =0x03000811 - ldrb r2, [r0] - ldr r1, =0x03000810 - movs r0, 0x1 - strb r0, [r1] - mov r10, r1 - ldr r0, =0x03000010 - mov r12, r0 - mov r4, r12 - lsls r0, r2, 4 - adds r0, 0x8 - adds r1, r0, r4 -_08000F30: - lsls r3, r2, 4 - ldrh r0, [r1] - cmp r0, 0 - bne _08000F78 - adds r0, r4, 0x4 - adds r0, r3, r0 - mov r6, r8 - str r6, [r0] - strh r7, [r1] - strh r5, [r1, 0x2] - adds r0, r4, 0 - adds r0, 0xC - adds r0, r3, r0 - mov r3, r9 - str r3, [r0] - cmp r5, 0x1 - bne _08000F64 - movs r0, 0x2 - b _08000F66 - .align 2, 0 - .pool -_08000F64: - movs r0, 0x4 -_08000F66: - strh r0, [r1, 0x2] - movs r0, 0 - ldr r6, =0x03000810 - strb r0, [r6] - lsls r0, r2, 16 - asrs r0, 16 - b _08000F96 - .align 2, 0 - .pool -_08000F78: - adds r1, 0x10 - adds r2, 0x1 - cmp r2, 0x7F - ble _08000F86 - mov r1, r12 - adds r1, 0x8 - movs r2, 0 -_08000F86: - adds r6, 0x1 - cmp r6, 0x7F - ble _08000F30 - movs r0, 0 - mov r1, r10 - strb r0, [r1] - movs r0, 0x1 - negs r0, r0 -_08000F96: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end dma3_transfer_queue_add_fill - - thumb_func_start dma3_transfer_queue_check_for_space -dma3_transfer_queue_check_for_space: @ 8000FA4 - push {lr} - movs r2, 0 - lsls r0, 16 - asrs r1, r0, 16 - movs r3, 0x1 - negs r3, r3 - cmp r1, r3 - bne _08000FCC - ldr r1, =0x03000010 -_08000FB6: - ldrh r0, [r1, 0x8] - cmp r0, 0 - bne _08000FD8 - adds r1, 0x10 - adds r2, 0x1 - cmp r2, 0x7F - ble _08000FB6 -_08000FC4: - movs r0, 0 - b _08000FDC - .align 2, 0 - .pool -_08000FCC: - ldr r0, =0x03000010 - lsls r1, 4 - adds r1, r0 - ldrh r0, [r1, 0x8] - cmp r0, 0 - beq _08000FC4 -_08000FD8: - movs r0, 0x1 - negs r0, r0 -_08000FDC: - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end dma3_transfer_queue_check_for_space - - thumb_func_start lcd_io_copy_queue_clean -lcd_io_copy_queue_clean: @ 8000FE4 - push {r4-r7,lr} - mov r7, r8 - push {r7} - movs r2, 0 - ldr r7, =0x030008d8 - ldr r0, =0x030008d9 - mov r12, r0 - ldr r1, =0x030008da - mov r8, r1 - ldr r6, =0x03000818 - movs r5, 0 - ldr r4, =0x03000878 - movs r3, 0xFF -_08000FFE: - adds r0, r2, r6 - strb r5, [r0] - adds r1, r2, r4 - ldrb r0, [r1] - orrs r0, r3 - strb r0, [r1] - adds r2, 0x1 - cmp r2, 0x5F - ble _08000FFE - movs r0, 0 - strb r0, [r7] - mov r1, r12 - strb r0, [r1] - movs r0, 0 - mov r1, r8 - strh r0, [r1] - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end lcd_io_copy_queue_clean - - thumb_func_start lcd_io_buffer_to_hardware -lcd_io_buffer_to_hardware: @ 800103C - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x4 - bne _08001068 - ldr r2, =0x04000004 - ldrh r1, [r2] - ldr r0, =0x0000ffe7 - ands r0, r1 - strh r0, [r2] - ldr r1, =0x0300081c - ldrh r0, [r2] - ldrh r1, [r1] - orrs r0, r1 - strh r0, [r2] - b _08001076 - .align 2, 0 - .pool -_08001068: - movs r0, 0x80 - lsls r0, 19 - adds r0, r2, r0 - ldr r1, =0x03000818 - adds r1, r2, r1 - ldrh r1, [r1] - strh r1, [r0] -_08001076: - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end lcd_io_buffer_to_hardware - - thumb_func_start lcd_io_copy_queue_process -lcd_io_copy_queue_process: @ 8001080 - push {r4,r5,lr} - ldr r0, =0x030008d8 - ldrb r0, [r0] - cmp r0, 0 - bne _080010A4 - movs r5, 0 -_0800108C: - ldr r0, =0x03000878 - adds r4, r5, r0 - ldrb r0, [r4] - cmp r0, 0xFF - beq _080010A4 - bl lcd_io_buffer_to_hardware - movs r0, 0xFF - strb r0, [r4] - adds r5, 0x1 - cmp r5, 0x5F - ble _0800108C -_080010A4: - pop {r4,r5} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end lcd_io_copy_queue_process - - thumb_func_start lcd_io_set -lcd_io_set: @ 80010B4 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 16 - lsrs r1, 16 - cmp r4, 0x5F - bhi _08001130 - ldr r0, =0x03000818 - adds r0, r4, r0 - strh r1, [r0] - ldr r0, =0x04000006 - ldrh r1, [r0] - movs r0, 0xFF - ands r0, r1 - subs r0, 0xA1 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x40 - bls _080010E8 - movs r0, 0x80 - lsls r0, 19 - ldrh r1, [r0] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _080010FE -_080010E8: - adds r0, r4, 0 - bl lcd_io_buffer_to_hardware - b _08001130 - .align 2, 0 - .pool -_080010F8: - movs r0, 0 - strb r0, [r5] - b _08001130 -_080010FE: - ldr r2, =0x030008d8 - movs r0, 0x1 - strb r0, [r2] - movs r3, 0 - ldr r0, =0x03000878 - ldrb r1, [r0] - adds r5, r2, 0 - adds r2, r0, 0 - cmp r1, 0xFF - beq _08001128 - adds r1, r2, 0 -_08001114: - ldrb r0, [r1] - cmp r0, r4 - beq _080010F8 - adds r1, 0x1 - adds r3, 0x1 - cmp r3, 0x5F - bgt _08001128 - ldrb r0, [r1] - cmp r0, 0xFF - bne _08001114 -_08001128: - adds r0, r3, r2 - movs r1, 0 - strb r4, [r0] - strb r1, [r5] -_08001130: - pop {r4,r5} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end lcd_io_set - - thumb_func_start lcd_io_set_forced_blank -lcd_io_set_forced_blank: @ 8001140 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 16 - lsrs r1, 16 - cmp r4, 0x5F - bhi _080011A8 - ldr r0, =0x03000818 - adds r0, r4, r0 - strh r1, [r0] - movs r0, 0x80 - lsls r0, 19 - ldrh r1, [r0] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _08001176 - adds r0, r4, 0 - bl lcd_io_buffer_to_hardware - b _080011A8 - .align 2, 0 - .pool -_08001170: - movs r0, 0 - strb r0, [r5] - b _080011A8 -_08001176: - ldr r2, =0x030008d8 - movs r0, 0x1 - strb r0, [r2] - movs r3, 0 - ldr r0, =0x03000878 - ldrb r1, [r0] - adds r5, r2, 0 - adds r2, r0, 0 - cmp r1, 0xFF - beq _080011A0 - adds r1, r2, 0 -_0800118C: - ldrb r0, [r1] - cmp r0, r4 - beq _08001170 - adds r1, 0x1 - adds r3, 0x1 - cmp r3, 0x5F - bgt _080011A0 - ldrb r0, [r1] - cmp r0, 0xFF - bne _0800118C -_080011A0: - adds r0, r3, r2 - movs r1, 0 - strb r4, [r0] - strb r1, [r5] -_080011A8: - pop {r4,r5} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end lcd_io_set_forced_blank - - thumb_func_start lcd_io_get -lcd_io_get: @ 80011B8 - push {lr} - lsls r0, 24 - lsrs r0, 24 - adds r1, r0, 0 - cmp r1, 0x4 - bne _080011CC - ldr r0, =0x04000004 - b _080011DE - .align 2, 0 - .pool -_080011CC: - cmp r1, 0x6 - beq _080011DC - ldr r0, =0x03000818 - adds r0, r1, r0 - ldrh r0, [r0] - b _080011E0 - .align 2, 0 - .pool -_080011DC: - ldr r0, =0x04000006 -_080011DE: - ldrh r0, [r0] -_080011E0: - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end lcd_io_get - - thumb_func_start lcd_io_set_bits -lcd_io_set_bits: @ 80011E8 - push {lr} - adds r2, r1, 0 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =0x03000818 - adds r1, r0, r1 - ldrh r1, [r1] - orrs r1, r2 - lsls r1, 16 - lsrs r1, 16 - bl lcd_io_set - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end lcd_io_set_bits - - thumb_func_start lcd_io_clear_bits -lcd_io_clear_bits: @ 8001208 - push {lr} - adds r2, r1, 0 - lsls r0, 24 - lsrs r0, 24 - lsls r2, 16 - ldr r1, =0x03000818 - adds r1, r0, r1 - ldrh r1, [r1] - lsrs r2, 16 - bics r1, r2 - bl lcd_io_set - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end lcd_io_clear_bits - - thumb_func_start update_hardware_IE -update_hardware_IE: @ 8001228 - push {r4,r5,lr} - ldr r5, =0x030008d9 - ldrb r0, [r5] - cmp r0, 0 - beq _08001246 - ldr r2, =0x04000208 - ldrh r1, [r2] - movs r4, 0 - strh r4, [r2] - ldr r3, =0x04000200 - ldr r0, =0x030008da - ldrh r0, [r0] - strh r0, [r3] - strh r1, [r2] - strb r4, [r5] -_08001246: - pop {r4,r5} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end update_hardware_IE - - thumb_func_start enable_irqs -enable_irqs: @ 800125C - push {r4,lr} - lsls r0, 16 - lsrs r0, 16 - ldr r4, =0x030008da - ldrh r1, [r4] - orrs r0, r1 - strh r0, [r4] - ldr r1, =0x030008d9 - movs r0, 0x1 - strb r0, [r1] - bl update_hardware_IE - ldrh r0, [r4] - bl dispstat_set_vblank_hblank_irqs - pop {r4} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end enable_irqs - - thumb_func_start disable_irqs -disable_irqs: @ 8001288 - push {r4,lr} - lsls r0, 16 - lsrs r0, 16 - ldr r4, =0x030008da - ldrh r1, [r4] - bics r1, r0 - strh r1, [r4] - ldr r1, =0x030008d9 - movs r0, 0x1 - strb r0, [r1] - bl update_hardware_IE - ldrh r0, [r4] - bl dispstat_set_vblank_hblank_irqs - pop {r4} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end disable_irqs - - thumb_func_start dispstat_set_vblank_hblank_irqs -dispstat_set_vblank_hblank_irqs: @ 80012B4 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - movs r0, 0x4 - bl lcd_io_get - movs r2, 0x18 - ands r2, r0 - movs r1, 0x1 - ands r1, r4 - negs r0, r1 - orrs r0, r1 - asrs r1, r0, 31 - movs r0, 0x8 - ands r1, r0 - movs r0, 0x2 - ands r0, r4 - cmp r0, 0 - beq _080012E0 - movs r0, 0x10 - orrs r1, r0 -_080012E0: - cmp r2, r1 - beq _080012EA - movs r0, 0x4 - bl lcd_io_set -_080012EA: - pop {r4} - pop {r0} - bx r0 - thumb_func_end dispstat_set_vblank_hblank_irqs - - thumb_func_start gpu_init_bgs -gpu_init_bgs: @ 80012F0 - push {lr} - bl gpu_reset_bg_configs - ldr r1, =0x030008e0 - movs r0, 0 - strh r0, [r1, 0x10] - bl gpu_sync_text_mode_and_hide_bgs - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end gpu_init_bgs - - thumb_func_start gpu_set_bg_mode -gpu_set_bg_mode: @ 8001308 - 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 - .align 2, 0 - .pool - thumb_func_end gpu_set_bg_mode - - thumb_func_start gpu_get_bg_mode -gpu_get_bg_mode: @ 8001324 - ldr r0, =0x030008e0 - ldrb r1, [r0, 0x10] - movs r0, 0x7 - ands r0, r1 - bx lr - .align 2, 0 - .pool - thumb_func_end gpu_get_bg_mode - - thumb_func_start gpu_reset_bg_configs -gpu_reset_bg_configs: @ 8001334 - push {lr} - ldr r2, =0x030008e0 - ldr r0, =0x082e9580 - ldr r0, [r0] - adds r1, r2, 0 - adds r1, 0xC -_08001340: - str r0, [r1] - subs r1, 0x4 - cmp r1, r2 - bge _08001340 - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end gpu_reset_bg_configs - - thumb_func_start sub_8001354 -sub_8001354: @ 8001354 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r0, r4, 0 - bl is_invalid_bg_id - lsls r0, 24 - cmp r0, 0 - bne _08001372 - ldr r1, =0x030008e0 - lsls r0, r4, 2 - adds r0, r1 - ldr r1, =0x082e9580 - ldr r1, [r1] - str r1, [r0] -_08001372: - pop {r4} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end sub_8001354 - - thumb_func_start gpu_bg_config_set_fields -gpu_bg_config_set_fields: @ 8001380 - 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 - bl is_invalid_bg_id - lsls r0, 24 - lsrs r0, 24 - mov r12, r0 - cmp r0, 0 - bne _08001498 - ldr r2, =0x030008e0 - mov r8, r2 - mov r0, r10 - cmp r0, 0xFF - beq _080013F4 - 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] -_080013F4: - cmp r6, 0xFF - beq _0800140C - 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] -_0800140C: - mov r1, r9 - cmp r1, 0xFF - beq _08001428 - 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] -_08001428: - ldr r6, [sp, 0x4] - cmp r6, 0xFF - beq _0800143E - 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] -_0800143E: - cmp r5, 0xFF - beq _08001456 - 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] -_08001456: - cmp r4, 0xFF - beq _0800146E - 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] -_0800146E: - ldr r0, [sp, 0xC] - cmp r0, 0xFF - beq _08001484 - 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] -_08001484: - 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] -_08001498: - add sp, 0x10 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end gpu_bg_config_set_fields - - thumb_func_start gpu_bg_config_get_field -gpu_bg_config_get_field: @ 80014AC - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - lsrs r5, r1, 24 - adds r0, r4, 0 - bl is_invalid_bg_id - lsls r0, 24 - cmp r0, 0 - bne _08001558 - ldr r1, =0x030008e0 - lsls r2, r4, 2 - adds r0, r2, r1 - ldrb r0, [r0] - lsls r0, 31 - adds r3, r1, 0 - cmp r0, 0 - beq _08001558 - subs r0, r5, 0x1 - cmp r0, 0x7 - bhi _08001558 - lsls r0, 2 - ldr r1, =_080014EC - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 - .pool - .align 2, 0 -_080014EC: - .4byte _0800150C - .4byte _08001516 - .4byte _08001520 - .4byte _0800152A - .4byte _08001534 - .4byte _0800153C - .4byte _08001546 - .4byte _08001550 -_0800150C: - adds r0, r2, r3 - ldrb r0, [r0] - lsls r0, 31 - lsrs r0, 31 - b _0800155A -_08001516: - adds r0, r2, r3 - ldrb r0, [r0, 0x1] - lsls r0, 30 - lsrs r0, 30 - b _0800155A -_08001520: - adds r0, r2, r3 - ldrb r0, [r0, 0x1] - lsls r0, 25 - lsrs r0, 27 - b _0800155A -_0800152A: - adds r0, r2, r3 - ldrb r0, [r0] - lsls r0, 28 - lsrs r0, 30 - b _0800155A -_08001534: - adds r0, r2, r3 - ldrb r0, [r0, 0x1] - lsrs r0, 7 - b _0800155A -_0800153C: - adds r0, r2, r3 - ldrb r0, [r0] - lsls r0, 26 - lsrs r0, 30 - b _0800155A -_08001546: - adds r0, r2, r3 - ldrb r0, [r0] - lsls r0, 25 - lsrs r0, 31 - b _0800155A -_08001550: - adds r0, r2, r3 - ldrb r0, [r0] - lsrs r0, 7 - b _0800155A -_08001558: - movs r0, 0xFF -_0800155A: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end gpu_bg_config_get_field - - thumb_func_start gpu_copy_to_vram_by_bg_id -gpu_copy_to_vram_by_bg_id: @ 8001560 - 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 - bl is_invalid_bg_id - lsls r0, 24 - cmp r0, 0 - bne _080015D8 - ldr r1, =0x030008e0 - lsls r0, r4, 2 - adds r1, r0, r1 - ldrb r0, [r1] - lsls r0, 31 - cmp r0, 0 - beq _080015D8 - cmp r5, 0x1 - beq _080015A4 - cmp r5, 0x2 - beq _080015AC - movs r2, 0xFF - b _080015DC - .align 2, 0 - .pool -_080015A4: - ldrb r0, [r1, 0x1] - lsls r0, 30 - lsrs r0, 16 - b _080015B4 -_080015AC: - ldrb r0, [r1, 0x1] - lsls r0, 25 - lsrs r0, 27 - lsls r0, 11 -_080015B4: - 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 dma3_transfer_queue_add_copy - lsls r0, 24 - lsrs r2, r0, 24 - asrs r0, 24 - movs r1, 0x1 - negs r1, r1 - cmp r0, r1 - bne _080015DC -_080015D8: - movs r0, 0xFF - b _080015DE -_080015DC: - adds r0, r2, 0 -_080015DE: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end gpu_copy_to_vram_by_bg_id - - thumb_func_start gpu_bg_show -gpu_bg_show: @ 80015E8 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r0, r4, 0 - bl is_invalid_bg_id - lsls r0, 24 - cmp r0, 0 - bne _08001656 - ldr r5, =0x030008e0 - lsls r0, r4, 2 - adds r2, r0, r5 - ldrb r3, [r2] - lsls r0, r3, 31 - cmp r0, 0 - beq _08001656 - 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 - bl lcd_io_set - 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] -_08001656: - pop {r4,r5} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end gpu_bg_show - - thumb_func_start gpu_bg_hide -gpu_bg_hide: @ 8001664 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r0, r4, 0 - bl is_invalid_bg_id - lsls r0, 24 - cmp r0, 0 - bne _0800168A - 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] -_0800168A: - pop {r4} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end gpu_bg_hide - - thumb_func_start gpu_sync_bg_visibility_and_mode -gpu_sync_bg_visibility_and_mode: @ 8001698 - push {lr} - movs r0, 0 - bl lcd_io_get - ldr r1, =0x0000f0f8 - ands r1, r0 - ldr r0, =0x030008e0 - ldrh r0, [r0, 0x10] - orrs r1, r0 - movs r0, 0 - bl lcd_io_set - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end gpu_sync_bg_visibility_and_mode - - thumb_func_start gpu_sync_text_mode_and_hide_bgs -gpu_sync_text_mode_and_hide_bgs: @ 80016BC - push {lr} - movs r0, 0 - bl lcd_io_get - ldr r1, =0x0000f0f8 - ands r1, r0 - movs r0, 0 - bl lcd_io_set - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end gpu_sync_text_mode_and_hide_bgs - - thumb_func_start gpu_bg_affine_set -gpu_bg_affine_set: @ 80016D8 - 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 - beq _08001720 - cmp r1, 0x1 - ble _08001796 - cmp r1, 0x2 - beq _08001726 - b _08001796 - .align 2, 0 - .pool -_08001720: - cmp r6, 0x2 - bne _08001796 - b _08001730 -_08001726: - subs r0, r6, 0x2 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bhi _08001796 -_08001730: - 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 - bl lcd_io_set - ldrh r1, [r4, 0x2] - movs r0, 0x22 - bl lcd_io_set - ldrh r1, [r4, 0x4] - movs r0, 0x24 - bl lcd_io_set - ldrh r1, [r4, 0x6] - movs r0, 0x26 - bl lcd_io_set - ldrh r1, [r4] - movs r0, 0x20 - bl lcd_io_set - ldrh r1, [r4, 0x8] - movs r0, 0x28 - bl lcd_io_set - ldrh r1, [r4, 0xA] - movs r0, 0x2A - bl lcd_io_set - ldrh r1, [r4, 0xC] - movs r0, 0x2C - bl lcd_io_set - ldrh r1, [r4, 0xE] - movs r0, 0x2E - bl lcd_io_set -_08001796: - add sp, 0x24 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end gpu_bg_affine_set - - thumb_func_start is_invalid_bg_id -is_invalid_bg_id: @ 80017A4 - push {lr} - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3 - bhi _080017B2 - movs r0, 0 - b _080017B4 -_080017B2: - movs r0, 0x1 -_080017B4: - pop {r1} - bx r1 - thumb_func_end is_invalid_bg_id - - thumb_func_start do_nothing -do_nothing: @ 80017B8 - movs r0, 0 - bx lr - thumb_func_end do_nothing - - thumb_func_start gpu_reset_bgs_and_dma3_busy_flags -gpu_reset_bgs_and_dma3_busy_flags: @ 80017BC - push {r4,lr} - adds r4, r0, 0 - bl gpu_init_bgs - ldr r1, =0x03000938 - movs r2, 0 - adds r0, r1, 0 - adds r0, 0xC -_080017CC: - str r2, [r0] - subs r0, 0x4 - cmp r0, r1 - bge _080017CC - ldr r0, =0x03002f54 - str r4, [r0] - pop {r4} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end gpu_reset_bgs_and_dma3_busy_flags - - thumb_func_start bg_vram_setup -bg_vram_setup: @ 80017E8 - 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 - bl gpu_set_bg_mode - bl gpu_reset_bg_configs - cmp r4, 0 - beq _08001894 - 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 -_0800181A: - ldr r4, [r6] - lsls r0, r4, 30 - lsrs r5, r0, 30 - cmp r5, 0x3 - bhi _08001886 - 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 - bl gpu_bg_config_set_fields - 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] -_08001886: - adds r6, 0x4 - movs r5, 0x1 - negs r5, r5 - add r8, r5 - mov r0, r8 - cmp r0, 0 - bne _0800181A -_08001894: - add sp, 0x10 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end bg_vram_setup - - thumb_func_start bg_init_bg_config_2_from_bg_config_3 -bg_init_bg_config_2_from_bg_config_3: @ 80018B0 - 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 - bhi _08001920 - 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 - bl gpu_bg_config_set_fields - 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] -_08001920: - add sp, 0x10 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end bg_init_bg_config_2_from_bg_config_3 - - thumb_func_start call_gpu_set_bg_mode -call_gpu_set_bg_mode: @ 8001934 - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl gpu_set_bg_mode - pop {r0} - bx r0 - thumb_func_end call_gpu_set_bg_mode - - thumb_func_start gpu_copy_bg_tile_pattern_data_to_vram -gpu_copy_bg_tile_pattern_data_to_vram: @ 8001944 - 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 - bl gpu_bg_config_get_field - lsls r0, 16 - cmp r0, 0 - bne _08001980 - 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 - b _08001990 - .align 2, 0 - .pool -_08001980: - 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 -_08001990: - 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 - bl gpu_copy_to_vram_by_bg_id - lsls r2, r0, 24 - lsrs r1, r2, 24 - adds r7, r1, 0 - cmp r1, 0xFF - bne _080019B8 - ldr r0, =0x0000ffff - b _080019E6 - .align 2, 0 - .pool -_080019B8: - 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 - bne _080019E4 - lsrs r1, r4, 5 - mov r0, r8 - lsrs r2, r0, 5 - adds r0, r5, 0 - movs r3, 0x1 - bl do_nothing -_080019E4: - adds r0, r7, 0 -_080019E6: - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end gpu_copy_bg_tile_pattern_data_to_vram - - thumb_func_start gpu_copy_bg_tile_map_to_vram -gpu_copy_bg_tile_map_to_vram: @ 80019FC - 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] - bl gpu_copy_to_vram_by_bg_id - lsls r2, r0, 24 - lsrs r3, r2, 24 - cmp r3, 0xFF - beq _08001A3C - 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 - b _08001A3E - .align 2, 0 - .pool -_08001A3C: - ldr r0, =0x0000ffff -_08001A3E: - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end gpu_copy_bg_tile_map_to_vram - - thumb_func_start unused_copy_palette -unused_copy_palette: @ 8001A4C - 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 - bl is_invalid_bg_id_2 - cmp r0, 0 - bne _08001A98 - 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 dma3_transfer_queue_add_copy - lsls r3, r0, 24 - asrs r1, r3, 24 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - bne _08001AA4 -_08001A98: - ldr r0, =0x0000ffff - b _08001AC8 - .align 2, 0 - .pool -_08001AA4: - ldr r4, =0x03000938 - adds r0, r1, 0 - cmp r1, 0 - bge _08001AAE - adds r0, 0x1F -_08001AAE: - 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 -_08001AC8: - pop {r4-r7} - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end unused_copy_palette - - thumb_func_start is_dma3_queue_busy_with_gpu_copy -is_dma3_queue_busy_with_gpu_copy: @ 8001AD4 - push {r4-r7,lr} - movs r5, 0 - movs r7, 0x1 - negs r7, r7 -_08001ADC: - adds r0, r5, 0 - cmp r5, 0 - bge _08001AE4 - adds r0, 0x1F -_08001AE4: - 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 - beq _08001B22 - lsls r0, r5, 16 - asrs r0, 16 - bl dma3_transfer_queue_check_for_space - lsls r0, 24 - asrs r0, 24 - cmp r0, r7 - bne _08001B1C - movs r0, 0x1 - b _08001B2A - .align 2, 0 - .pool -_08001B1C: - ldr r0, [r4] - bics r0, r6 - str r0, [r4] -_08001B22: - adds r5, 0x1 - cmp r5, 0x7F - ble _08001ADC - movs r0, 0 -_08001B2A: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end is_dma3_queue_busy_with_gpu_copy - - thumb_func_start gpu_sync_bg_show -gpu_sync_bg_show: @ 8001B30 - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl gpu_bg_show - bl gpu_sync_bg_visibility_and_mode - pop {r0} - bx r0 - thumb_func_end gpu_sync_bg_show - - thumb_func_start gpu_sync_bg_hide -gpu_sync_bg_hide: @ 8001B44 - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl gpu_bg_hide - bl gpu_sync_bg_visibility_and_mode - pop {r0} - bx r0 - thumb_func_end gpu_sync_bg_hide - - thumb_func_start gpu_bg_config_set_field -gpu_bg_config_set_field: @ 8001B58 - 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 - bhi _08001C12 - lsls r0, 2 - ldr r1, =_08001B7C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 - .pool - .align 2, 0 -_08001B7C: - .4byte _08001B98 - .4byte _08001BA8 - .4byte _08001BBA - .4byte _08001BD0 - .4byte _08001BE4 - .4byte _08001BFC - .4byte _08001BDA -_08001B98: - 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 - b _08001BF2 -_08001BA8: - 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 - b _08001BF4 -_08001BBA: - 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 - bl gpu_bg_config_set_fields - b _08001C12 -_08001BD0: - str r3, [sp] - movs r0, 0xFF - str r0, [sp, 0x4] - str r0, [sp, 0x8] - b _08001BEC -_08001BDA: - movs r0, 0xFF - str r0, [sp] - str r3, [sp, 0x4] - str r0, [sp, 0x8] - b _08001BEC -_08001BE4: - movs r0, 0xFF - str r0, [sp] - str r0, [sp, 0x4] - str r3, [sp, 0x8] -_08001BEC: - str r0, [sp, 0xC] - adds r0, r4, 0 - movs r1, 0xFF -_08001BF2: - movs r2, 0xFF -_08001BF4: - movs r3, 0xFF - bl gpu_bg_config_set_fields - b _08001C12 -_08001BFC: - 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 - bl gpu_bg_config_set_fields -_08001C12: - add sp, 0x10 - pop {r4} - pop {r0} - bx r0 - thumb_func_end gpu_bg_config_set_field - - thumb_func_start bg_get_field -bg_get_field: @ 8001C1C - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - lsrs r1, 24 - subs r0, r1, 0x1 - cmp r0, 0x9 - bhi _08001CF8 - lsls r0, 2 - ldr r1, =_08001C3C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 - .pool - .align 2, 0 -_08001C3C: - .4byte _08001C64 - .4byte _08001C6E - .4byte _08001C78 - .4byte _08001C82 - .4byte _08001C96 - .4byte _08001CA0 - .4byte _08001C8C - .4byte _08001CAA - .4byte _08001CD8 - .4byte _08001CE4 -_08001C64: - adds r0, r4, 0 - movs r1, 0x2 - bl gpu_bg_config_get_field - b _08001CDE -_08001C6E: - adds r0, r4, 0 - movs r1, 0x3 - bl gpu_bg_config_get_field - b _08001CDE -_08001C78: - adds r0, r4, 0 - movs r1, 0x4 - bl gpu_bg_config_get_field - b _08001CDE -_08001C82: - adds r0, r4, 0 - movs r1, 0x5 - bl gpu_bg_config_get_field - b _08001CDE -_08001C8C: - adds r0, r4, 0 - movs r1, 0x6 - bl gpu_bg_config_get_field - b _08001CDE -_08001C96: - adds r0, r4, 0 - movs r1, 0x7 - bl gpu_bg_config_get_field - b _08001CDE -_08001CA0: - adds r0, r4, 0 - movs r1, 0x8 - bl gpu_bg_config_get_field - b _08001CDE -_08001CAA: - adds r0, r4, 0 - bl bg_get_type_by_bg_id - cmp r0, 0 - beq _08001CBC - cmp r0, 0x1 - beq _08001CCA - movs r0, 0 - b _08001CFA -_08001CBC: - adds r0, r4, 0 - movs r1, 0 - bl bg_get_screen_size_in_regular_mode - lsls r0, 27 - lsrs r0, 16 - b _08001CFA -_08001CCA: - adds r0, r4, 0 - movs r1, 0 - bl bg_get_screen_size_in_affine_mode - lsls r0, 24 - lsrs r0, 16 - b _08001CFA -_08001CD8: - adds r0, r4, 0 - bl bg_get_type_by_bg_id -_08001CDE: - lsls r0, 16 - lsrs r0, 16 - b _08001CFA -_08001CE4: - ldr r0, =0x030008f8 - lsls r1, r4, 4 - adds r1, r0 - ldrh r0, [r1] - lsls r0, 22 - lsrs r0, 22 - b _08001CFA - .align 2, 0 - .pool -_08001CF8: - ldr r0, =0x0000ffff -_08001CFA: - pop {r4} - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end bg_get_field - - thumb_func_start bg_change_x_offset -bg_change_x_offset: @ 8001D04 - 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 - bl is_invalid_bg_id_2 - cmp r0, 0 - bne _08001D28 - adds r0, r4, 0 - movs r1, 0x1 - bl gpu_bg_config_get_field - lsls r0, 16 - cmp r0, 0 - bne _08001D2E -_08001D28: - movs r0, 0x1 - negs r0, r0 - b _08001E34 -_08001D2E: - cmp r5, 0x1 - beq _08001D4C - cmp r5, 0x1 - ble _08001D3A - cmp r5, 0x2 - beq _08001D60 -_08001D3A: - ldr r0, =0x030008f8 - lsls r1, r4, 4 - adds r0, 0x8 - adds r0, r1, r0 - str r6, [r0] - adds r5, r1, 0 - b _08001D70 - .align 2, 0 - .pool -_08001D4C: - ldr r0, =0x030008f8 - lsls r2, r4, 4 - adds r0, 0x8 - adds r0, r2, r0 - ldr r1, [r0] - adds r1, r6 - b _08001D6C - .align 2, 0 - .pool -_08001D60: - ldr r0, =0x030008f8 - lsls r2, r4, 4 - adds r0, 0x8 - adds r0, r2, r0 - ldr r1, [r0] - subs r1, r6 -_08001D6C: - str r1, [r0] - adds r5, r2, 0 -_08001D70: - bl gpu_get_bg_mode - lsls r0, 24 - lsrs r0, 24 - cmp r4, 0x1 - beq _08001DAC - cmp r4, 0x1 - bgt _08001D8C - cmp r4, 0 - beq _08001D96 - b _08001E2C - .align 2, 0 - .pool -_08001D8C: - cmp r4, 0x2 - beq _08001DC0 - cmp r4, 0x3 - beq _08001DF8 - b _08001E2C -_08001D96: - ldr r0, =0x030008f8 - ldr r0, [r0, 0x8] - lsls r0, 8 - lsrs r1, r0, 16 - movs r0, 0x10 - bl lcd_io_set - b _08001E2C - .align 2, 0 - .pool -_08001DAC: - ldr r0, =0x030008f8 - ldr r0, [r0, 0x18] - lsls r0, 8 - lsrs r1, r0, 16 - movs r0, 0x14 - bl lcd_io_set - b _08001E2C - .align 2, 0 - .pool -_08001DC0: - cmp r0, 0 - bne _08001DD8 - ldr r0, =0x030008f8 - ldr r0, [r0, 0x28] - lsls r0, 8 - lsrs r1, r0, 16 - movs r0, 0x18 - bl lcd_io_set - b _08001E2C - .align 2, 0 - .pool -_08001DD8: - ldr r0, =0x030008f8 - ldr r0, [r0, 0x28] - lsrs r1, r0, 16 - lsls r0, 16 - lsrs r4, r0, 16 - movs r0, 0x2A - bl lcd_io_set - movs r0, 0x28 - adds r1, r4, 0 - bl lcd_io_set - b _08001E2C - .align 2, 0 - .pool -_08001DF8: - cmp r0, 0 - bne _08001E10 - ldr r0, =0x030008f8 - ldr r0, [r0, 0x38] - lsls r0, 8 - lsrs r1, r0, 16 - movs r0, 0x1C - bl lcd_io_set - b _08001E2C - .align 2, 0 - .pool -_08001E10: - cmp r0, 0x2 - bne _08001E2C - ldr r0, =0x030008f8 - ldr r0, [r0, 0x38] - lsrs r1, r0, 16 - lsls r0, 16 - lsrs r4, r0, 16 - movs r0, 0x3A - bl lcd_io_set - movs r0, 0x38 - adds r1, r4, 0 - bl lcd_io_set -_08001E2C: - ldr r0, =0x030008f8 - adds r0, 0x8 - adds r0, r5, r0 - ldr r0, [r0] -_08001E34: - pop {r4-r6} - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end bg_change_x_offset - - thumb_func_start bg_get_x_offset -bg_get_x_offset: @ 8001E40 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - adds r4, r0, 0 - bl is_invalid_bg_id_2 - cmp r0, 0 - bne _08001E70 - adds r0, r4, 0 - movs r1, 0x1 - bl gpu_bg_config_get_field - lsls r0, 16 - cmp r0, 0 - beq _08001E70 - ldr r0, =0x030008f8 - lsls r1, r4, 4 - adds r0, 0x8 - adds r1, r0 - ldr r0, [r1] - b _08001E74 - .align 2, 0 - .pool -_08001E70: - movs r0, 0x1 - negs r0, r0 -_08001E74: - pop {r4} - pop {r1} - bx r1 - thumb_func_end bg_get_x_offset - - thumb_func_start bg_change_y_offset -bg_change_y_offset: @ 8001E7C - 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 - bl is_invalid_bg_id_2 - cmp r0, 0 - bne _08001EA0 - adds r0, r4, 0 - movs r1, 0x1 - bl gpu_bg_config_get_field - lsls r0, 16 - cmp r0, 0 - bne _08001EA6 -_08001EA0: - movs r0, 0x1 - negs r0, r0 - b _08001FAC -_08001EA6: - cmp r5, 0x1 - beq _08001EC4 - cmp r5, 0x1 - ble _08001EB2 - cmp r5, 0x2 - beq _08001ED8 -_08001EB2: - ldr r0, =0x030008f8 - lsls r1, r4, 4 - adds r0, 0xC - adds r0, r1, r0 - str r6, [r0] - adds r5, r1, 0 - b _08001EE8 - .align 2, 0 - .pool -_08001EC4: - ldr r0, =0x030008f8 - lsls r2, r4, 4 - adds r0, 0xC - adds r0, r2, r0 - ldr r1, [r0] - adds r1, r6 - b _08001EE4 - .align 2, 0 - .pool -_08001ED8: - ldr r0, =0x030008f8 - lsls r2, r4, 4 - adds r0, 0xC - adds r0, r2, r0 - ldr r1, [r0] - subs r1, r6 -_08001EE4: - str r1, [r0] - adds r5, r2, 0 -_08001EE8: - bl gpu_get_bg_mode - lsls r0, 24 - lsrs r0, 24 - cmp r4, 0x1 - beq _08001F24 - cmp r4, 0x1 - bgt _08001F04 - cmp r4, 0 - beq _08001F0E - b _08001FA4 - .align 2, 0 - .pool -_08001F04: - cmp r4, 0x2 - beq _08001F38 - cmp r4, 0x3 - beq _08001F70 - b _08001FA4 -_08001F0E: - ldr r0, =0x030008f8 - ldr r0, [r0, 0xC] - lsls r0, 8 - lsrs r1, r0, 16 - movs r0, 0x12 - bl lcd_io_set - b _08001FA4 - .align 2, 0 - .pool -_08001F24: - ldr r0, =0x030008f8 - ldr r0, [r0, 0x1C] - lsls r0, 8 - lsrs r1, r0, 16 - movs r0, 0x16 - bl lcd_io_set - b _08001FA4 - .align 2, 0 - .pool -_08001F38: - cmp r0, 0 - bne _08001F50 - ldr r0, =0x030008f8 - ldr r0, [r0, 0x2C] - lsls r0, 8 - lsrs r1, r0, 16 - movs r0, 0x1A - bl lcd_io_set - b _08001FA4 - .align 2, 0 - .pool -_08001F50: - ldr r0, =0x030008f8 - ldr r0, [r0, 0x2C] - lsrs r1, r0, 16 - lsls r0, 16 - lsrs r4, r0, 16 - movs r0, 0x2E - bl lcd_io_set - movs r0, 0x2C - adds r1, r4, 0 - bl lcd_io_set - b _08001FA4 - .align 2, 0 - .pool -_08001F70: - cmp r0, 0 - bne _08001F88 - ldr r0, =0x030008f8 - ldr r0, [r0, 0x3C] - lsls r0, 8 - lsrs r1, r0, 16 - movs r0, 0x1E - bl lcd_io_set - b _08001FA4 - .align 2, 0 - .pool -_08001F88: - cmp r0, 0x2 - bne _08001FA4 - ldr r0, =0x030008f8 - ldr r0, [r0, 0x3C] - lsrs r1, r0, 16 - lsls r0, 16 - lsrs r4, r0, 16 - movs r0, 0x3E - bl lcd_io_set - movs r0, 0x3C - adds r1, r4, 0 - bl lcd_io_set -_08001FA4: - ldr r0, =0x030008f8 - adds r0, 0xC - adds r0, r5, r0 - ldr r0, [r0] -_08001FAC: - pop {r4-r6} - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end bg_change_y_offset - - thumb_func_start bg_change_y_offset_to_copy_queue -bg_change_y_offset_to_copy_queue: @ 8001FB8 - 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 - bl is_invalid_bg_id_2 - cmp r0, 0 - bne _08001FDC - adds r0, r4, 0 - movs r1, 0x1 - bl gpu_bg_config_get_field - lsls r0, 16 - cmp r0, 0 - bne _08001FE2 -_08001FDC: - movs r0, 0x1 - negs r0, r0 - b _080020E8 -_08001FE2: - cmp r5, 0x1 - beq _08002000 - cmp r5, 0x1 - ble _08001FEE - cmp r5, 0x2 - beq _08002014 -_08001FEE: - ldr r0, =0x030008f8 - lsls r1, r4, 4 - adds r0, 0xC - adds r0, r1, r0 - str r6, [r0] - adds r5, r1, 0 - b _08002024 - .align 2, 0 - .pool -_08002000: - ldr r0, =0x030008f8 - lsls r2, r4, 4 - adds r0, 0xC - adds r0, r2, r0 - ldr r1, [r0] - adds r1, r6 - b _08002020 - .align 2, 0 - .pool -_08002014: - ldr r0, =0x030008f8 - lsls r2, r4, 4 - adds r0, 0xC - adds r0, r2, r0 - ldr r1, [r0] - subs r1, r6 -_08002020: - str r1, [r0] - adds r5, r2, 0 -_08002024: - bl gpu_get_bg_mode - lsls r0, 24 - lsrs r0, 24 - cmp r4, 0x1 - beq _08002060 - cmp r4, 0x1 - bgt _08002040 - cmp r4, 0 - beq _0800204A - b _080020E0 - .align 2, 0 - .pool -_08002040: - cmp r4, 0x2 - beq _08002074 - cmp r4, 0x3 - beq _080020AC - b _080020E0 -_0800204A: - ldr r0, =0x030008f8 - ldr r0, [r0, 0xC] - lsls r0, 8 - lsrs r1, r0, 16 - movs r0, 0x12 - bl lcd_io_set_forced_blank - b _080020E0 - .align 2, 0 - .pool -_08002060: - ldr r0, =0x030008f8 - ldr r0, [r0, 0x1C] - lsls r0, 8 - lsrs r1, r0, 16 - movs r0, 0x16 - bl lcd_io_set_forced_blank - b _080020E0 - .align 2, 0 - .pool -_08002074: - cmp r0, 0 - bne _0800208C - ldr r0, =0x030008f8 - ldr r0, [r0, 0x2C] - lsls r0, 8 - lsrs r1, r0, 16 - movs r0, 0x1A - bl lcd_io_set_forced_blank - b _080020E0 - .align 2, 0 - .pool -_0800208C: - ldr r0, =0x030008f8 - ldr r0, [r0, 0x2C] - lsrs r1, r0, 16 - lsls r0, 16 - lsrs r4, r0, 16 - movs r0, 0x2E - bl lcd_io_set_forced_blank - movs r0, 0x2C - adds r1, r4, 0 - bl lcd_io_set_forced_blank - b _080020E0 - .align 2, 0 - .pool -_080020AC: - cmp r0, 0 - bne _080020C4 - ldr r0, =0x030008f8 - ldr r0, [r0, 0x3C] - lsls r0, 8 - lsrs r1, r0, 16 - movs r0, 0x1E - bl lcd_io_set_forced_blank - b _080020E0 - .align 2, 0 - .pool -_080020C4: - cmp r0, 0x2 - bne _080020E0 - ldr r0, =0x030008f8 - ldr r0, [r0, 0x3C] - lsrs r1, r0, 16 - lsls r0, 16 - lsrs r4, r0, 16 - movs r0, 0x3E - bl lcd_io_set_forced_blank - movs r0, 0x3C - adds r1, r4, 0 - bl lcd_io_set_forced_blank -_080020E0: - ldr r0, =0x030008f8 - adds r0, 0xC - adds r0, r5, r0 - ldr r0, [r0] -_080020E8: - pop {r4-r6} - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end bg_change_y_offset_to_copy_queue - - thumb_func_start bg_get_y_offset -bg_get_y_offset: @ 80020F4 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - adds r4, r0, 0 - bl is_invalid_bg_id_2 - cmp r0, 0 - bne _08002124 - adds r0, r4, 0 - movs r1, 0x1 - bl gpu_bg_config_get_field - lsls r0, 16 - cmp r0, 0 - beq _08002124 - ldr r0, =0x030008f8 - lsls r1, r4, 4 - adds r0, 0xC - adds r1, r0 - ldr r0, [r1] - b _08002128 - .align 2, 0 - .pool -_08002124: - movs r0, 0x1 - negs r0, r0 -_08002128: - pop {r4} - pop {r1} - bx r1 - thumb_func_end bg_get_y_offset - - thumb_func_start call_gpu_bg_affine_set -call_gpu_bg_affine_set: @ 8002130 - 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] - bl gpu_bg_affine_set - add sp, 0x10 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end call_gpu_bg_affine_set - - thumb_func_start mosaic_something -mosaic_something: @ 8002170 - push {r4-r6,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - lsrs r6, r1, 24 - movs r0, 0x4C - bl lcd_io_get - 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 - bhi _080021C4 - lsls r0, r6, 2 - ldr r1, =_080021A8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 - .pool - .align 2, 0 -_080021A8: - .4byte _080021C4 - .4byte _080021CC - .4byte _080021D2 - .4byte _080021E4 - .4byte _080021FA - .4byte _08002200 - .4byte _08002212 -_080021C4: - movs r3, 0xF - ands r3, r4 - lsrs r2, r4, 4 - b _08002226 -_080021CC: - movs r3, 0xF - ands r3, r4 - b _08002226 -_080021D2: - lsls r0, r3, 16 - asrs r0, 16 - adds r0, r4 - cmp r0, 0xF - ble _080021E0 - movs r3, 0xF - b _08002226 -_080021E0: - adds r0, r3, r4 - b _080021F4 -_080021E4: - lsls r0, r3, 16 - asrs r0, 16 - subs r0, r4 - cmp r0, 0 - bge _080021F2 - movs r3, 0 - b _08002226 -_080021F2: - subs r0, r3, r4 -_080021F4: - lsls r0, 16 - lsrs r3, r0, 16 - b _08002226 -_080021FA: - movs r2, 0xF - ands r2, r4 - b _08002226 -_08002200: - lsls r0, r2, 16 - asrs r0, 16 - adds r0, r4 - cmp r0, 0xF - ble _0800220E - movs r2, 0xF - b _08002226 -_0800220E: - adds r0, r2, r4 - b _08002222 -_08002212: - lsls r0, r2, 16 - asrs r0, 16 - subs r0, r4 - cmp r0, 0 - bge _08002220 - movs r2, 0 - b _08002226 -_08002220: - subs r0, r2, r4 -_08002222: - lsls r0, 16 - lsrs r2, r0, 16 -_08002226: - 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 - bl lcd_io_set - lsls r0, r5, 24 - lsrs r0, 24 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end mosaic_something - - thumb_func_start bg_set_tilemap -bg_set_tilemap: @ 8002250 - push {r4,r5,lr} - adds r5, r1, 0 - lsls r0, 24 - lsrs r4, r0, 24 - adds r0, r4, 0 - bl is_invalid_bg_id_2 - cmp r0, 0 - bne _0800227A - adds r0, r4, 0 - movs r1, 0x1 - bl gpu_bg_config_get_field - lsls r0, 16 - cmp r0, 0 - beq _0800227A - ldr r0, =0x030008f8 - lsls r1, r4, 4 - adds r0, 0x4 - adds r1, r0 - str r5, [r1] -_0800227A: - pop {r4,r5} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end bg_set_tilemap - - thumb_func_start bg_unset_tilemap -bg_unset_tilemap: @ 8002284 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r0, r4, 0 - bl is_invalid_bg_id_2 - adds r5, r0, 0 - cmp r5, 0 - bne _080022AE - adds r0, r4, 0 - movs r1, 0x1 - bl gpu_bg_config_get_field - lsls r0, 16 - cmp r0, 0 - beq _080022AE - ldr r0, =0x030008f8 - lsls r1, r4, 4 - adds r0, 0x4 - adds r1, r0 - str r5, [r1] -_080022AE: - pop {r4,r5} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end bg_unset_tilemap - - thumb_func_start bg_get_tilemap -bg_get_tilemap: @ 80022B8 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - adds r4, r0, 0 - bl is_invalid_bg_id_2 - cmp r0, 0 - bne _080022E8 - adds r0, r4, 0 - movs r1, 0x1 - bl gpu_bg_config_get_field - lsls r0, 16 - cmp r0, 0 - beq _080022E8 - ldr r0, =0x030008f8 - lsls r1, r4, 4 - adds r0, 0x4 - adds r1, r0 - ldr r0, [r1] - b _080022EA - .align 2, 0 - .pool -_080022E8: - movs r0, 0 -_080022EA: - pop {r4} - pop {r1} - bx r1 - thumb_func_end bg_get_tilemap - - thumb_func_start gpu_copy_to_wram_bg_tile_map -gpu_copy_to_wram_bg_tile_map: @ 80022F0 - 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 - bl is_invalid_bg_id_2 - cmp r0, 0 - bne _08002358 - adds r0, r4, 0 - bl IsTileMapOutsideWram - cmp r0, 0 - bne _08002358 - cmp r6, 0 - beq _08002340 - 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 - b _08002358 - .align 2, 0 - .pool -_08002340: - 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 -_08002358: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end gpu_copy_to_wram_bg_tile_map - - thumb_func_start gpu_copy_wram_bg_tilemap_to_vram -gpu_copy_wram_bg_tilemap_to_vram: @ 800236C - push {r4,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r4, r0, 24 - adds r0, r4, 0 - bl is_invalid_bg_id_2 - cmp r0, 0 - bne _080023C8 - adds r0, r4, 0 - bl IsTileMapOutsideWram - cmp r0, 0 - bne _080023C8 - adds r0, r4, 0 - bl bg_get_type_by_bg_id - cmp r0, 0 - beq _0800239A - cmp r0, 0x1 - beq _080023A6 - movs r2, 0 - b _080023B2 -_0800239A: - adds r0, r4, 0 - movs r1, 0 - bl bg_get_screen_size_in_regular_mode - lsls r0, 27 - b _080023B0 -_080023A6: - adds r0, r4, 0 - movs r1, 0 - bl bg_get_screen_size_in_affine_mode - lsls r0, 24 -_080023B0: - lsrs r2, r0, 16 -_080023B2: - 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 - bl gpu_copy_to_vram_by_bg_id -_080023C8: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end gpu_copy_wram_bg_tilemap_to_vram - - thumb_func_start gpu_copy_to_iwram_tile_map_rect -gpu_copy_to_iwram_tile_map_rect: @ 80023D4 - 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 - bl is_invalid_bg_id_2 - cmp r0, 0 - bne _080024C4 - adds r0, r5, 0 - bl IsTileMapOutsideWram - cmp r0, 0 - bne _080024C4 - adds r0, r5, 0 - bl bg_get_type_by_bg_id - cmp r0, 0 - beq _08002422 - cmp r0, 0x1 - beq _08002470 - b _080024C4 -_08002422: - mov r4, r8 - adds r3, r7, 0 - adds r0, r3, r6 - cmp r3, r0 - bge _080024C4 - mov r12, r0 - lsls r1, r5, 4 - ldr r0, =0x030008fc - adds r1, r0 - mov r8, r1 -_08002436: - mov r2, r10 - mov r1, r9 - adds r0, r2, r1 - adds r7, r3, 0x1 - cmp r2, r0 - bge _08002460 - mov r1, r8 - ldr r6, [r1] - lsls r5, r3, 5 - adds r3, r0, 0 -_0800244A: - 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 - blt _0800244A -_08002460: - lsls r0, r7, 16 - lsrs r3, r0, 16 - cmp r3, r12 - blt _08002436 - b _080024C4 - .align 2, 0 - .pool -_08002470: - mov r4, r8 - adds r0, r5, 0 - movs r1, 0x1 - bl bg_get_screen_size_in_affine_mode - lsls r0, 16 - lsrs r0, 16 - str r0, [sp] - adds r3, r7, 0 - adds r0, r3, r6 - cmp r3, r0 - bge _080024C4 - mov r12, r0 - lsls r5, 4 - mov r8, r5 -_0800248E: - mov r2, r10 - mov r1, r9 - adds r0, r2, r1 - adds r7, r3, 0x1 - cmp r2, r0 - bge _080024BC - ldr r6, =0x030008fc - add r6, r8 - ldr r1, [sp] - adds r5, r3, 0 - muls r5, r1 - adds r3, r0, 0 -_080024A6: - 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 - blt _080024A6 -_080024BC: - lsls r0, r7, 16 - lsrs r3, r0, 16 - cmp r3, r12 - blt _0800248E -_080024C4: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end gpu_copy_to_iwram_tile_map_rect - - thumb_func_start bg_copy_tilemap_rect_simple -bg_copy_tilemap_rect_simple: @ 80024D8 - 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 - bl bg_copy_tilemap_rect - add sp, 0x24 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end bg_copy_tilemap_rect_simple - - thumb_func_start bg_copy_tilemap_rect -bg_copy_tilemap_rect: @ 800251C - 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] - bl is_invalid_bg_id_2 - cmp r0, 0 - beq _08002592 - b _080026EE -_08002592: - ldr r0, [sp, 0x4] - bl IsTileMapOutsideWram - cmp r0, 0 - beq _0800259E - b _080026EE -_0800259E: - ldr r0, [sp, 0x4] - movs r1, 0x4 - bl gpu_bg_config_get_field - lsls r0, 16 - lsrs r0, 16 - str r0, [sp, 0x30] - ldr r0, [sp, 0x4] - movs r1, 0x1 - bl bg_get_screen_size_in_regular_mode - lsls r0, 21 - lsrs r0, 16 - str r0, [sp, 0x28] - ldr r0, [sp, 0x4] - movs r1, 0x2 - bl bg_get_screen_size_in_regular_mode - lsls r0, 21 - lsrs r0, 16 - str r0, [sp, 0x2C] - ldr r0, [sp, 0x4] - bl bg_get_type_by_bg_id - cmp r0, 0 - beq _080025D8 - cmp r0, 0x1 - beq _08002674 - b _080026EE -_080025D8: - 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 - blt _080025F0 - b _080026EE -_080025F0: - ldr r2, [sp, 0x18] - subs r2, r7, r2 - str r2, [sp, 0x34] - str r0, [sp, 0x38] -_080025F8: - ldr r4, [sp, 0x14] - ldr r7, [sp, 0x18] - adds r0, r4, r7 - adds r1, r5, 0x1 - str r1, [sp, 0x3C] - cmp r4, r0 - bge _0800265A - 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 -_0800261E: - ldr r2, [sp, 0x2C] - str r2, [sp] - adds r0, r4, 0 - adds r1, r5, 0 - ldr r2, [sp, 0x30] - ldr r3, [sp, 0x28] - bl bg_get_index_from_tile_coords - 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 - bl bg_copy_tilemap_entry_not_rotscale_mode - 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 - blt _0800261E -_0800265A: - 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 - blt _080025F8 - b _080026EE - .align 2, 0 - .pool -_08002674: - 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 - bl bg_get_screen_size_in_affine_mode - lsls r0, 16 - lsrs r0, 16 - mov r9, r0 - adds r0, r5, r4 - cmp r5, r0 - bge _080026EE - 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 -_080026A8: - ldr r4, [sp, 0x14] - ldr r1, [sp, 0x18] - adds r0, r4, r1 - adds r2, r5, 0x1 - str r2, [sp, 0x3C] - cmp r4, r0 - bge _080026DE - mov r3, r8 - add r3, r10 - mov r7, r9 - muls r7, r5 - mov r12, r7 - adds r2, r0, 0 -_080026C2: - 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 - blt _080026C2 -_080026DE: - 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 - blt _080026A8 -_080026EE: - add sp, 0x40 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end bg_copy_tilemap_rect - - thumb_func_start bg_fill_tilemap_rect -bg_fill_tilemap_rect: @ 8002704 - 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 - bl is_invalid_bg_id_2 - cmp r0, 0 - bne _080027F0 - adds r0, r6, 0 - bl IsTileMapOutsideWram - cmp r0, 0 - bne _080027F0 - adds r0, r6, 0 - bl bg_get_type_by_bg_id - cmp r0, 0 - beq _08002756 - cmp r0, 0x1 - beq _080027A0 - b _080027F0 -_08002756: - adds r3, r7, 0 - adds r5, r3, r5 - cmp r3, r5 - bge _080027F0 - adds r7, r5, 0 - lsls r1, r6, 4 - ldr r0, =0x030008fc - adds r1, r0 - mov r12, r1 -_08002768: - mov r2, r10 - mov r1, r9 - adds r0, r2, r1 - adds r6, r3, 0x1 - cmp r2, r0 - bge _08002790 - mov r5, r12 - ldr r4, [r5] - lsls r3, 5 - adds r1, r0, 0 -_0800277C: - 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 - blt _0800277C -_08002790: - lsls r0, r6, 16 - lsrs r3, r0, 16 - cmp r3, r7 - blt _08002768 - b _080027F0 - .align 2, 0 - .pool -_080027A0: - adds r0, r6, 0 - movs r1, 0x1 - bl bg_get_screen_size_in_affine_mode - lsls r0, 16 - lsrs r0, 16 - str r0, [sp] - adds r3, r7, 0 - adds r5, r3, r5 - cmp r3, r5 - bge _080027F0 - adds r7, r5, 0 - lsls r6, 4 - mov r12, r6 -_080027BC: - mov r2, r10 - mov r1, r9 - adds r0, r2, r1 - adds r6, r3, 0x1 - cmp r2, r0 - bge _080027E8 - ldr r5, =0x030008fc - add r5, r12 - ldr r1, [sp] - adds r4, r3, 0 - muls r4, r1 - adds r3, r0, 0 -_080027D4: - 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 - blt _080027D4 -_080027E8: - lsls r0, r6, 16 - lsrs r3, r0, 16 - cmp r3, r7 - blt _080027BC -_080027F0: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end bg_fill_tilemap_rect - - thumb_func_start Bg_FillWramTileMapRectWithTileAndPalette -Bg_FillWramTileMapRectWithTileAndPalette: @ 8002804 - 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] - bl bg_write_sequence_to_wram_tile_map_rect - add sp, 0x10 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end Bg_FillWramTileMapRectWithTileAndPalette - - thumb_func_start bg_write_sequence_to_wram_tile_map_rect -bg_write_sequence_to_wram_tile_map_rect: @ 8002840 - 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 - bl is_invalid_bg_id_2 - cmp r0, 0 - beq _0800288E - b _080029D4 -_0800288E: - mov r0, r9 - bl IsTileMapOutsideWram - cmp r0, 0 - beq _0800289A - b _080029D4 -_0800289A: - mov r0, r9 - movs r1, 0x4 - bl gpu_bg_config_get_field - lsls r0, 16 - lsrs r0, 16 - str r0, [sp, 0x1C] - mov r0, r9 - movs r1, 0x1 - bl bg_get_screen_size_in_regular_mode - lsls r0, 21 - lsrs r0, 16 - str r0, [sp, 0x14] - mov r0, r9 - movs r1, 0x2 - bl bg_get_screen_size_in_regular_mode - lsls r0, 21 - lsrs r0, 16 - str r0, [sp, 0x18] - mov r0, r9 - bl bg_get_type_by_bg_id - cmp r0, 0 - beq _080028D4 - cmp r0, 0x1 - beq _0800295C - b _080029D4 -_080028D4: - adds r5, r7, 0 - adds r0, r5, r4 - cmp r5, r0 - bge _080029D4 - str r0, [sp, 0x24] - add r7, sp, 0x4 -_080028E0: - ldr r4, [sp, 0x8] - mov r1, r10 - adds r0, r4, r1 - adds r2, r5, 0x1 - mov r8, r2 - cmp r4, r0 - bge _08002944 - mov r3, r9 - lsls r1, r3, 4 - ldr r0, =0x030008fc - adds r6, r1, r0 -_080028F6: - ldr r0, [sp, 0x18] - str r0, [sp] - adds r0, r4, 0 - adds r1, r5, 0 - ldr r2, [sp, 0x1C] - ldr r3, [sp, 0x14] - bl bg_get_index_from_tile_coords - 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 - bl bg_copy_tilemap_entry_not_rotscale_mode - 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 - blt _080028F6 -_08002944: - mov r1, r8 - lsls r0, r1, 16 - lsrs r5, r0, 16 - ldr r2, [sp, 0x24] - cmp r5, r2 - blt _080028E0 - b _080029D4 - .align 2, 0 - .pool -_0800295C: - mov r0, r9 - movs r1, 0x1 - bl bg_get_screen_size_in_affine_mode - lsls r0, 16 - lsrs r0, 16 - str r0, [sp, 0x20] - adds r5, r7, 0 - adds r0, r5, r4 - cmp r5, r0 - bge _080029D4 - str r0, [sp, 0x24] - mov r3, r9 - lsls r3, 4 - mov r12, r3 -_0800297A: - ldr r4, [sp, 0x8] - mov r7, r10 - adds r0, r4, r7 - adds r1, r5, 0x1 - mov r8, r1 - cmp r4, r0 - bge _080029C8 - 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 -_080029A2: - 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 - blt _080029A2 -_080029C8: - mov r1, r8 - lsls r0, r1, 16 - lsrs r5, r0, 16 - ldr r2, [sp, 0x24] - cmp r5, r2 - blt _0800297A -_080029D4: - add sp, 0x2C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end bg_write_sequence_to_wram_tile_map_rect - - thumb_func_start bg_get_screen_size_in_regular_mode -bg_get_screen_size_in_regular_mode: @ 80029EC - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r4, r1, 24 - adds r5, r4, 0 - movs r1, 0x4 - bl gpu_bg_config_get_field - lsls r0, 24 - lsrs r0, 24 - cmp r4, 0x1 - beq _08002A2C - cmp r4, 0x1 - bgt _08002A10 - cmp r4, 0 - beq _08002A16 - b _08002A52 -_08002A10: - cmp r5, 0x2 - beq _08002A3E - b _08002A52 -_08002A16: - cmp r0, 0x2 - bgt _08002A24 - cmp r0, 0x1 - bge _08002A4E -_08002A1E: - cmp r0, 0 - beq _08002A46 - b _08002A52 -_08002A24: - cmp r0, 0x3 - bne _08002A52 - movs r0, 0x4 - b _08002A54 -_08002A2C: - cmp r0, 0x1 - beq _08002A4E - cmp r0, 0x1 - ble _08002A1E - cmp r0, 0x2 - beq _08002A46 - cmp r0, 0x3 - bne _08002A52 - b _08002A4E -_08002A3E: - cmp r0, 0 - blt _08002A52 - cmp r0, 0x1 - bgt _08002A4A -_08002A46: - movs r0, 0x1 - b _08002A54 -_08002A4A: - cmp r0, 0x3 - bgt _08002A52 -_08002A4E: - movs r0, 0x2 - b _08002A54 -_08002A52: - movs r0, 0 -_08002A54: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end bg_get_screen_size_in_regular_mode - - thumb_func_start bg_get_screen_size_in_affine_mode -bg_get_screen_size_in_affine_mode: @ 8002A5C - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r4, r1, 24 - movs r1, 0x4 - bl gpu_bg_config_get_field - lsls r0, 24 - lsrs r1, r0, 24 - adds r0, r1, 0 - cmp r4, 0 - beq _08002A84 - cmp r4, 0 - blt _08002AAC - cmp r4, 0x2 - bgt _08002AAC - movs r0, 0x10 - lsls r0, r1 - b _08002AAE -_08002A84: - cmp r1, 0x1 - beq _08002AA0 - cmp r1, 0x1 - bgt _08002A92 - cmp r1, 0 - beq _08002A9C - b _08002AAC -_08002A92: - cmp r0, 0x2 - beq _08002AA4 - cmp r0, 0x3 - beq _08002AA8 - b _08002AAC -_08002A9C: - movs r0, 0x1 - b _08002AAE -_08002AA0: - movs r0, 0x4 - b _08002AAE -_08002AA4: - movs r0, 0x10 - b _08002AAE -_08002AA8: - movs r0, 0x40 - b _08002AAE -_08002AAC: - movs r0, 0 -_08002AAE: - pop {r4} - pop {r1} - bx r1 - thumb_func_end bg_get_screen_size_in_affine_mode - - thumb_func_start bg_get_index_from_tile_coords -bg_get_index_from_tile_coords: @ 8002AB4 - 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 - beq _08002AD8 - cmp r2, 0x1 - ble _08002AE0 - cmp r2, 0x2 - beq _08002AE0 - cmp r2, 0x3 - bne _08002AE0 - cmp r1, 0x1F - ble _08002AD8 - adds r1, 0x20 -_08002AD8: - cmp r4, 0x1F - ble _08002AE0 - subs r4, 0x20 - adds r1, 0x20 -_08002AE0: - lsls r0, r1, 5 - adds r0, r4 - pop {r4} - pop {r1} - bx r1 - thumb_func_end bg_get_index_from_tile_coords - - thumb_func_start bg_copy_tilemap_entry_not_rotscale_mode -bg_copy_tilemap_entry_not_rotscale_mode: @ 8002AEC - push {r4-r6,lr} - adds r4, r0, 0 - adds r6, r1, 0 - ldr r5, [sp, 0x10] - cmp r2, 0x10 - beq _08002B14 - cmp r2, 0x10 - bgt _08002B34 - cmp r2, 0 - blt _08002B34 - ldrh r0, [r4] - adds r0, r3 - ldr r3, =0x00000fff - adds r1, r3, 0 - ands r0, r1 - adds r1, r2, r5 - lsls r1, 12 - b _08002B3A - .align 2, 0 - .pool -_08002B14: - 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 - b _08002B3C - .align 2, 0 - .pool -_08002B34: - ldrh r0, [r4] - adds r0, r3 - lsls r1, r5, 12 -_08002B3A: - adds r0, r1 -_08002B3C: - lsls r0, 16 - lsrs r1, r0, 16 - strh r1, [r6] - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end bg_copy_tilemap_entry_not_rotscale_mode - - thumb_func_start bg_get_type_by_bg_id -bg_get_type_by_bg_id: @ 8002B48 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r5, r4, 0 - bl gpu_get_bg_mode - lsls r0, 24 - lsrs r0, 24 - cmp r4, 0x2 - beq _08002B76 - cmp r4, 0x2 - ble _08002B66 - cmp r4, 0x3 - beq _08002B86 - b _08002B8E -_08002B66: - cmp r5, 0 - blt _08002B8E - cmp r0, 0x1 - bgt _08002B8E - cmp r0, 0 - blt _08002B8E -_08002B72: - movs r0, 0 - b _08002B90 -_08002B76: - cmp r0, 0 - beq _08002B72 - cmp r0, 0 - blt _08002B8E - cmp r0, 0x2 - bgt _08002B8E -_08002B82: - movs r0, 0x1 - b _08002B90 -_08002B86: - cmp r0, 0 - beq _08002B72 - cmp r0, 0x2 - beq _08002B82 -_08002B8E: - ldr r0, =0x0000ffff -_08002B90: - pop {r4,r5} - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end bg_get_type_by_bg_id - - thumb_func_start is_invalid_bg_id_2 -is_invalid_bg_id_2: @ 8002B9C - push {lr} - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3 - bhi _08002BAA - movs r0, 0 - b _08002BAC -_08002BAA: - movs r0, 0x1 -_08002BAC: - pop {r1} - bx r1 - thumb_func_end is_invalid_bg_id_2 - - thumb_func_start IsTileMapOutsideWram -IsTileMapOutsideWram: @ 8002BB0 - 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 - bhi _08002BD4 - cmp r1, 0 - beq _08002BD4 - movs r0, 0 - b _08002BD6 - .align 2, 0 - .pool -_08002BD4: - movs r0, 0x1 -_08002BD6: - pop {r1} - bx r1 - thumb_func_end IsTileMapOutsideWram - - thumb_func_start sub_8002BDC -sub_8002BDC: @ 8002BDC - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x14 - ldr r4, [sp, 0x2C] - ldr r5, [sp, 0x30] - ldr r6, [sp, 0x34] - ldr r7, [sp, 0x38] - lsls r2, 16 - lsrs r2, 16 - lsls r3, 16 - lsrs r3, 16 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 16 - lsrs r5, 16 - lsls r6, 16 - lsrs r6, 16 - lsls r7, 16 - lsrs r7, 16 - str r4, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - str r7, [sp, 0xC] - movs r4, 0xFF - str r4, [sp, 0x10] - bl PixelBlock_CopyRect4Bpp - add sp, 0x14 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8002BDC - - thumb_func_start PixelBlock_CopyRect4Bpp -PixelBlock_CopyRect4Bpp: @ 8002C20 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x2C - str r0, [sp] - str r1, [sp, 0x4] - ldr r0, [sp, 0x4C] - ldr r1, [sp, 0x50] - ldr r4, [sp, 0x54] - ldr r5, [sp, 0x58] - ldr r6, [sp, 0x5C] - lsls r2, 16 - lsrs r2, 16 - str r2, [sp, 0x8] - lsls r3, 16 - lsrs r7, r3, 16 - lsls r0, 16 - lsrs r0, 16 - str r0, [sp, 0xC] - lsls r1, 16 - lsrs r1, 16 - mov r9, r1 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 16 - lsrs r5, 16 - lsls r6, 24 - lsrs r6, 24 - str r6, [sp, 0x10] - ldr r0, [sp, 0x4] - ldrh r3, [r0, 0x4] - ldr r1, [sp, 0xC] - subs r0, r3, r1 - adds r2, r4 - mov r8, r2 - cmp r0, r4 - bge _08002C74 - ldr r2, [sp, 0x8] - adds r0, r2 - mov r8, r0 -_08002C74: - ldr r4, [sp, 0x4] - ldrh r0, [r4, 0x6] - mov r1, r9 - subs r0, r1 - adds r2, r5, r7 - str r2, [sp, 0x14] - cmp r0, r5 - bge _08002C88 - adds r0, r7 - str r0, [sp, 0x14] -_08002C88: - ldr r4, [sp] - ldrh r1, [r4, 0x4] - movs r2, 0x7 - adds r0, r1, 0 - ands r0, r2 - adds r1, r0 - asrs r1, 3 - str r1, [sp, 0x18] - adds r0, r3, 0 - ands r0, r2 - adds r0, r3, r0 - asrs r0, 3 - str r0, [sp, 0x1C] - ldr r0, [sp, 0x10] - cmp r0, 0xFF - bne _08002D46 - adds r3, r7, 0 - mov r1, r9 - ldr r2, [sp, 0x14] - cmp r3, r2 - blt _08002CB4 - b _08002DEE -_08002CB4: - ldr r5, [sp, 0x8] - ldr r6, [sp, 0xC] - adds r4, r3, 0x1 - str r4, [sp, 0x24] - adds r0, r1, 0x1 - str r0, [sp, 0x28] - cmp r5, r8 - bge _08002D3A - movs r7, 0x3 - asrs r0, r3, 3 - ldr r2, [sp, 0x18] - muls r0, r2 - lsls r0, 5 - mov r10, r0 - lsls r0, r3, 29 - lsrs r0, 27 - mov r9, r0 - asrs r0, r1, 3 - ldr r4, [sp, 0x1C] - muls r0, r4 - lsls r0, 5 - mov r12, r0 - lsls r0, r1, 29 - lsrs r3, r0, 27 -_08002CE4: - asrs r0, r5, 1 - ands r0, r7 - ldr r2, [sp] - ldr r1, [r2] - adds r1, r0 - asrs r0, r5, 3 - lsls r0, 5 - adds r1, r0 - add r1, r10 - mov r4, r9 - adds r2, r1, r4 - asrs r0, r6, 1 - ands r0, r7 - ldr r4, [sp, 0x4] - ldr r1, [r4] - adds r1, r0 - asrs r0, r6, 3 - lsls r0, 5 - adds r1, r0 - add r1, r12 - adds r4, r1, r3 - ldrb r2, [r2] - adds r0, r5, 0 - movs r1, 0x1 - ands r0, r1 - lsls r0, 2 - asrs r2, r0 - movs r0, 0xF - ands r2, r0 - adds r0, r6, 0 - ands r0, r1 - lsls r1, r0, 2 - lsls r2, r1 - movs r0, 0xF0 - asrs r0, r1 - ldrb r1, [r4] - ands r0, r1 - orrs r2, r0 - strb r2, [r4] - adds r5, 0x1 - adds r6, 0x1 - cmp r5, r8 - blt _08002CE4 -_08002D3A: - ldr r3, [sp, 0x24] - ldr r1, [sp, 0x28] - ldr r2, [sp, 0x14] - cmp r3, r2 - blt _08002CB4 - b _08002DEE -_08002D46: - adds r3, r7, 0 - mov r1, r9 - ldr r4, [sp, 0x14] - cmp r3, r4 - bge _08002DEE -_08002D50: - ldr r5, [sp, 0x8] - ldr r6, [sp, 0xC] - adds r0, r3, 0x1 - str r0, [sp, 0x24] - adds r2, r1, 0x1 - str r2, [sp, 0x28] - cmp r5, r8 - bge _08002DE4 - movs r4, 0x3 - mov r9, r4 - asrs r0, r3, 3 - ldr r2, [sp, 0x18] - muls r0, r2 - lsls r0, 5 - str r0, [sp, 0x20] - lsls r0, r3, 29 - lsrs r0, 27 - mov r10, r0 - movs r3, 0x1 - asrs r0, r1, 3 - ldr r4, [sp, 0x1C] - muls r0, r4 - lsls r0, 5 - mov r12, r0 - lsls r0, r1, 29 - lsrs r7, r0, 27 -_08002D84: - asrs r0, r5, 1 - mov r1, r9 - ands r0, r1 - ldr r2, [sp] - ldr r1, [r2] - adds r1, r0 - asrs r0, r5, 3 - lsls r0, 5 - adds r1, r0 - ldr r4, [sp, 0x20] - adds r1, r4 - mov r0, r10 - adds r2, r1, r0 - asrs r0, r6, 1 - mov r1, r9 - ands r0, r1 - ldr r4, [sp, 0x4] - ldr r1, [r4] - adds r1, r0 - asrs r0, r6, 3 - lsls r0, 5 - adds r1, r0 - add r1, r12 - adds r4, r1, r7 - ldrb r2, [r2] - adds r0, r5, 0 - ands r0, r3 - lsls r0, 2 - asrs r2, r0 - movs r0, 0xF - ands r2, r0 - ldr r0, [sp, 0x10] - cmp r2, r0 - beq _08002DDC - adds r0, r6, 0 - ands r0, r3 - lsls r1, r0, 2 - lsls r2, r1 - movs r0, 0xF0 - asrs r0, r1 - ldrb r1, [r4] - ands r0, r1 - orrs r2, r0 - strb r2, [r4] -_08002DDC: - adds r5, 0x1 - adds r6, 0x1 - cmp r5, r8 - blt _08002D84 -_08002DE4: - ldr r3, [sp, 0x24] - ldr r1, [sp, 0x28] - ldr r2, [sp, 0x14] - cmp r3, r2 - blt _08002D50 -_08002DEE: - add sp, 0x2C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end PixelBlock_CopyRect4Bpp - - thumb_func_start PixelBlock_FillRect4Bpp -PixelBlock_FillRect4Bpp: @ 8002E00 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - mov r9, r0 - ldr r0, [sp, 0x28] - ldr r4, [sp, 0x2C] - lsls r1, 16 - lsrs r1, 16 - str r1, [sp] - lsls r2, 16 - lsrs r2, 16 - adds r6, r2, 0 - lsls r3, 16 - lsrs r3, 16 - lsls r0, 16 - lsrs r0, 16 - lsls r4, 24 - lsrs r5, r4, 24 - adds r4, r1, r3 - mov r3, r9 - ldrh r1, [r3, 0x4] - cmp r4, r1 - ble _08002E36 - adds r4, r1, 0 -_08002E36: - adds r2, r0 - mov r12, r2 - mov r2, r9 - ldrh r0, [r2, 0x6] - cmp r12, r0 - ble _08002E44 - mov r12, r0 -_08002E44: - movs r0, 0x7 - ands r0, r1 - adds r0, r1, r0 - asrs r0, 3 - str r0, [sp, 0x4] - lsls r0, r5, 28 - lsrs r0, 24 - mov r8, r0 - movs r3, 0xF - mov r10, r3 - mov r0, r10 - ands r0, r5 - mov r10, r0 - adds r1, r6, 0 - cmp r1, r12 - bge _08002EB6 -_08002E64: - ldr r3, [sp] - adds r7, r1, 0x1 - cmp r3, r4 - bge _08002EB0 - asrs r0, r1, 3 - ldr r2, [sp, 0x4] - muls r0, r2 - lsls r6, r0, 5 - lsls r0, r1, 29 - lsrs r5, r0, 27 -_08002E78: - asrs r2, r3, 1 - movs r0, 0x3 - ands r2, r0 - mov r0, r9 - ldr r1, [r0] - adds r1, r2 - asrs r0, r3, 3 - lsls r0, 5 - adds r1, r0 - adds r1, r6 - adds r2, r1, r5 - lsls r0, r3, 31 - cmp r0, 0 - beq _08002E9E - ldrb r1, [r2] - movs r0, 0xF - ands r0, r1 - mov r1, r8 - b _08002EA6 -_08002E9E: - ldrb r1, [r2] - movs r0, 0xF0 - ands r0, r1 - mov r1, r10 -_08002EA6: - orrs r0, r1 - strb r0, [r2] - adds r3, 0x1 - cmp r3, r4 - blt _08002E78 -_08002EB0: - adds r1, r7, 0 - cmp r1, r12 - blt _08002E64 -_08002EB6: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end PixelBlock_FillRect4Bpp - - thumb_func_start PixelBlock_CopyRect4BppTo8Bpp -PixelBlock_CopyRect4BppTo8Bpp: @ 8002EC8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x3C - str r0, [sp] - str r1, [sp, 0x4] - ldr r0, [sp, 0x5C] - ldr r1, [sp, 0x60] - ldr r5, [sp, 0x64] - ldr r4, [sp, 0x68] - ldr r6, [sp, 0x6C] - ldr r7, [sp, 0x70] - mov r8, r7 - lsls r2, 16 - lsrs r2, 16 - str r2, [sp, 0x8] - lsls r3, 16 - lsrs r3, 16 - lsls r0, 16 - lsrs r0, 16 - str r0, [sp, 0xC] - lsls r1, 16 - lsrs r7, r1, 16 - lsls r5, 16 - lsrs r5, 16 - lsls r4, 16 - lsrs r4, 16 - lsls r6, 24 - lsrs r6, 24 - str r6, [sp, 0x10] - mov r0, r8 - lsls r0, 28 - lsrs r0, 24 - str r0, [sp, 0x14] - lsls r0, r6, 28 - lsrs r0, 24 - str r0, [sp, 0x28] - ldr r1, [sp, 0x4] - ldrh r0, [r1, 0x4] - ldr r2, [sp, 0xC] - subs r0, r2 - ldr r1, [sp, 0x8] - adds r1, r5, r1 - str r1, [sp, 0x18] - cmp r0, r5 - bge _08002F2E - ldr r2, [sp, 0x8] - adds r0, r2 - str r0, [sp, 0x18] -_08002F2E: - ldr r5, [sp, 0x4] - ldrh r1, [r5, 0x6] - subs r0, r1, r7 - cmp r0, r4 - bge _08002F40 - adds r0, r3, r1 - subs r0, r7 - str r0, [sp, 0x1C] - b _08002F44 -_08002F40: - adds r4, r3, r4 - str r4, [sp, 0x1C] -_08002F44: - ldr r0, [sp] - ldrh r1, [r0, 0x4] - movs r2, 0x7 - adds r0, r1, 0 - ands r0, r2 - adds r1, r0 - asrs r1, 3 - str r1, [sp, 0x20] - ldr r5, [sp, 0x4] - ldrh r1, [r5, 0x4] - adds r0, r1, 0 - ands r0, r2 - adds r1, r0 - asrs r1, 3 - str r1, [sp, 0x24] - ldr r0, [sp, 0x10] - cmp r0, 0xFF - bne _08003024 - adds r2, r3, 0 - adds r5, r7, 0 - ldr r1, [sp, 0x1C] - cmp r2, r1 - blt _08002F74 - b _08003106 -_08002F74: - ldr r3, [sp, 0x8] - lsrs r3, 1 - str r3, [sp, 0x2C] - movs r0, 0x3 - ands r3, r0 - str r3, [sp, 0x2C] - ldr r7, [sp, 0x8] - lsrs r0, r7, 3 - lsls r0, 5 - str r0, [sp, 0x30] -_08002F88: - ldr r0, [sp] - ldr r1, [r0] - ldr r3, [sp, 0x2C] - adds r1, r3 - ldr r7, [sp, 0x30] - adds r1, r7 - asrs r0, r2, 3 - ldr r3, [sp, 0x20] - muls r0, r3 - lsls r0, 5 - mov r8, r0 - add r1, r8 - lsls r0, r2, 29 - lsrs r7, r0, 27 - adds r6, r1, r7 - ldr r3, [sp, 0x8] - ldr r4, [sp, 0xC] - adds r2, 0x1 - mov r10, r2 - adds r0, r5, 0x1 - str r0, [sp, 0x38] - ldr r1, [sp, 0x18] - cmp r3, r1 - bge _08003018 - asrs r0, r5, 3 - ldr r2, [sp, 0x24] - muls r0, r2 - lsls r0, 6 - mov r12, r0 - lsls r0, r5, 29 - lsrs r0, 26 - mov r9, r0 -_08002FC8: - movs r0, 0x7 - ands r0, r4 - ldr r5, [sp, 0x4] - ldr r1, [r5] - adds r1, r0 - asrs r0, r4, 3 - lsls r0, 6 - adds r1, r0 - add r1, r12 - mov r0, r9 - adds r5, r1, r0 - movs r0, 0x1 - ands r0, r3 - cmp r0, 0 - beq _08002FEC - ldrb r0, [r6] - lsrs r0, 4 - b _08003008 -_08002FEC: - asrs r2, r3, 1 - movs r0, 0x3 - ands r2, r0 - ldr r0, [sp] - ldr r1, [r0] - adds r1, r2 - asrs r0, r3, 3 - lsls r0, 5 - adds r1, r0 - add r1, r8 - adds r6, r1, r7 - ldrb r1, [r6] - movs r0, 0xF - ands r0, r1 -_08003008: - ldr r1, [sp, 0x14] - adds r0, r1, r0 - strb r0, [r5] - adds r3, 0x1 - adds r4, 0x1 - ldr r2, [sp, 0x18] - cmp r3, r2 - blt _08002FC8 -_08003018: - mov r2, r10 - ldr r5, [sp, 0x38] - ldr r3, [sp, 0x1C] - cmp r2, r3 - blt _08002F88 - b _08003106 -_08003024: - adds r2, r3, 0 - adds r5, r7, 0 - ldr r7, [sp, 0x1C] - cmp r2, r7 - bge _08003106 - ldr r0, [sp, 0x8] - lsrs r0, 1 - str r0, [sp, 0x34] - movs r0, 0x3 - ldr r1, [sp, 0x34] - ands r1, r0 - str r1, [sp, 0x34] -_0800303C: - ldr r3, [sp] - ldr r1, [r3] - ldr r7, [sp, 0x34] - adds r1, r7 - ldr r3, [sp, 0x8] - lsrs r0, r3, 3 - lsls r0, 5 - adds r1, r0 - asrs r0, r2, 3 - ldr r7, [sp, 0x20] - muls r0, r7 - lsls r0, 5 - mov r8, r0 - add r1, r8 - lsls r0, r2, 29 - lsrs r7, r0, 27 - adds r6, r1, r7 - ldr r4, [sp, 0xC] - adds r2, 0x1 - mov r10, r2 - adds r0, r5, 0x1 - str r0, [sp, 0x38] - ldr r1, [sp, 0x18] - cmp r3, r1 - bge _080030FC - asrs r0, r5, 3 - ldr r2, [sp, 0x24] - muls r0, r2 - lsls r0, 6 - mov r9, r0 - lsls r0, r5, 29 - lsrs r0, 26 - mov r12, r0 -_0800307E: - movs r0, 0x1 - ands r0, r3 - cmp r0, 0 - beq _080030B2 - ldrb r2, [r6] - movs r0, 0xF0 - ands r0, r2 - ldr r5, [sp, 0x28] - cmp r0, r5 - beq _080030F2 - adds r0, r4, 0 - movs r1, 0x7 - ands r0, r1 - ldr r5, [sp, 0x4] - ldr r1, [r5] - adds r1, r0 - asrs r0, r4, 3 - lsls r0, 6 - adds r1, r0 - add r1, r9 - mov r0, r12 - adds r5, r1, r0 - lsrs r0, r2, 4 - ldr r1, [sp, 0x14] - adds r0, r1, r0 - b _080030F0 -_080030B2: - asrs r2, r3, 1 - movs r0, 0x3 - ands r2, r0 - ldr r5, [sp] - ldr r1, [r5] - adds r1, r2 - asrs r0, r3, 3 - lsls r0, 5 - adds r1, r0 - add r1, r8 - adds r6, r1, r7 - ldrb r0, [r6] - movs r2, 0xF - ands r2, r0 - ldr r0, [sp, 0x10] - cmp r2, r0 - beq _080030F2 - adds r0, r4, 0 - movs r1, 0x7 - ands r0, r1 - ldr r5, [sp, 0x4] - ldr r1, [r5] - adds r1, r0 - asrs r0, r4, 3 - lsls r0, 6 - adds r1, r0 - add r1, r9 - mov r0, r12 - adds r5, r1, r0 - ldr r1, [sp, 0x14] - adds r0, r1, r2 -_080030F0: - strb r0, [r5] -_080030F2: - adds r3, 0x1 - adds r4, 0x1 - ldr r2, [sp, 0x18] - cmp r3, r2 - blt _0800307E -_080030FC: - mov r2, r10 - ldr r5, [sp, 0x38] - ldr r3, [sp, 0x1C] - cmp r2, r3 - blt _0800303C -_08003106: - add sp, 0x3C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end PixelBlock_CopyRect4BppTo8Bpp - - thumb_func_start PixelBlock_FillRect8Bpp -PixelBlock_FillRect8Bpp: @ 8003118 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - mov r8, r0 - ldr r0, [sp, 0x28] - ldr r4, [sp, 0x2C] - lsls r1, 16 - lsrs r1, 16 - mov r10, r1 - lsls r2, 16 - lsrs r2, 16 - adds r6, r2, 0 - lsls r3, 16 - lsrs r3, 16 - lsls r0, 16 - lsrs r0, 16 - lsls r4, 24 - lsrs r4, 24 - mov r9, r4 - adds r5, r1, r3 - mov r3, r8 - ldrh r1, [r3, 0x4] - cmp r5, r1 - ble _08003150 - adds r5, r1, 0 -_08003150: - adds r7, r2, r0 - mov r2, r8 - ldrh r0, [r2, 0x6] - cmp r7, r0 - ble _0800315C - adds r7, r0, 0 -_0800315C: - movs r0, 0x7 - ands r0, r1 - adds r0, r1, r0 - asrs r0, 3 - str r0, [sp] - adds r1, r6, 0 - cmp r1, r7 - bge _080031AC -_0800316C: - mov r3, r10 - adds r6, r1, 0x1 - str r6, [sp, 0x4] - cmp r3, r5 - bge _080031A6 - movs r0, 0x7 - mov r12, r0 - asrs r0, r1, 3 - ldr r2, [sp] - muls r0, r2 - lsls r4, r0, 6 - lsls r0, r1, 29 - lsrs r2, r0, 26 -_08003186: - adds r0, r3, 0 - mov r6, r12 - ands r0, r6 - mov r6, r8 - ldr r1, [r6] - adds r1, r0 - asrs r0, r3, 3 - lsls r0, 6 - adds r1, r0 - adds r1, r4 - adds r1, r2 - mov r0, r9 - strb r0, [r1] - adds r3, 0x1 - cmp r3, r5 - blt _08003186 -_080031A6: - ldr r1, [sp, 0x4] - cmp r1, r7 - blt _0800316C -_080031AC: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end PixelBlock_FillRect8Bpp - - thumb_func_start nullsub_8 -nullsub_8: @ 80031BC - bx lr - thumb_func_end nullsub_8 - - thumb_func_start Window_InitFromTemplates -Window_InitFromTemplates: @ 80031C0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - adds r5, r0, 0 - movs r0, 0 - mov r8, r0 - ldr r4, =0x03002f70 -_080031D4: - mov r1, r8 - lsls r0, r1, 24 - lsrs r0, 24 - bl bg_get_tilemap - cmp r0, 0 - beq _080031E4 - ldr r0, =nullsub_8 + 1 -_080031E4: - str r0, [r4] - adds r4, 0x4 - movs r2, 0x1 - add r8, r2 - mov r0, r8 - cmp r0, 0x3 - ble _080031D4 - ldr r0, =0x082e9584 - ldr r2, [r0] - ldr r3, [r0, 0x4] - ldr r1, =0x02020004 - movs r0, 0 - movs r4, 0x1F - mov r8, r4 -_08003200: - str r2, [r1] - str r3, [r1, 0x4] - str r0, [r1, 0x8] - adds r1, 0xC - movs r4, 0x1 - negs r4, r4 - add r8, r4 - mov r4, r8 - cmp r4, 0 - bge _08003200 - movs r0, 0 - mov r8, r0 - movs r1, 0 - str r1, [sp] - ldrb r7, [r5] - cmp r7, 0xFF - bne _08003224 - b _0800335C -_08003224: - adds r6, r5, 0 - movs r2, 0 - str r2, [sp, 0x4] -_0800322A: - ldr r0, =0x03002f54 - ldr r0, [r0] - cmp r0, 0x1 - bne _08003268 - ldrb r1, [r6, 0x3] - ldrb r0, [r6, 0x4] - adds r2, r1, 0 - muls r2, r0 - adds r0, r7, 0 - movs r1, 0 - movs r3, 0 - bl do_nothing - str r0, [sp] - movs r0, 0x1 - negs r0, r0 - ldr r4, [sp] - cmp r4, r0 - bne _08003268 -_08003250: - movs r0, 0 - b _08003364 - .align 2, 0 - .pool -_08003268: - ldr r0, =0x03002f70 - mov r9, r0 - lsls r0, r7, 2 - mov r2, r9 - adds r1, r0, r2 - ldr r1, [r1] - mov r10, r0 - cmp r1, 0 - bne _080032CA - adds r0, r7, 0 - movs r1, 0x8 - bl bg_get_field - lsls r0, 16 - lsrs r5, r0, 16 - ldr r0, =0x0000ffff - cmp r5, r0 - beq _080032CA - adds r0, r5, 0 - bl malloc_and_clear - adds r4, r0, 0 - cmp r4, 0 - bne _080032A8 - bl Window_FreeMemory - b _08003250 - .align 2, 0 - .pool -_080032A8: - movs r1, 0 - mov r3, r9 - cmp r1, r5 - bge _080032BC - movs r2, 0 -_080032B2: - adds r0, r4, r1 - strb r2, [r0] - adds r1, 0x1 - cmp r1, r5 - blt _080032B2 -_080032BC: - mov r1, r10 - adds r0, r1, r3 - str r4, [r0] - adds r0, r7, 0 - adds r1, r4, 0 - bl bg_set_tilemap -_080032CA: - ldrb r1, [r6, 0x3] - ldrb r0, [r6, 0x4] - muls r0, r1 - lsls r0, 21 - lsrs r0, 16 - bl malloc_and_clear - adds r4, r0, 0 - cmp r4, 0 - bne _0800330C - adds r0, r7, 0 - bl GetNumActiveWindowsOnBg - lsls r0, 24 - cmp r0, 0 - bne _08003250 - ldr r0, =0x03002f70 - mov r2, r10 - adds r5, r2, r0 - ldr r1, [r5] - ldr r0, =nullsub_8 + 1 - cmp r1, r0 - beq _08003250 - adds r0, r1, 0 - bl free - str r4, [r5] - b _08003250 - .align 2, 0 - .pool -_0800330C: - ldr r1, =0x02020004 - adds r0, r1, 0 - adds r0, 0x8 - ldr r2, [sp, 0x4] - adds r0, r2, r0 - str r4, [r0] - adds r2, r1 - ldr r0, [r6] - ldr r1, [r6, 0x4] - str r0, [r2] - str r1, [r2, 0x4] - ldr r0, =0x03002f54 - ldr r0, [r0] - cmp r0, 0x1 - bne _08003342 - mov r4, sp - ldrh r4, [r4] - strh r4, [r2, 0x6] - ldrb r0, [r6, 0x3] - ldrb r1, [r6, 0x4] - adds r2, r0, 0 - muls r2, r1 - adds r0, r7, 0 - ldr r1, [sp] - movs r3, 0x1 - bl do_nothing -_08003342: - adds r6, 0x8 - ldr r0, [sp, 0x4] - adds r0, 0xC - str r0, [sp, 0x4] - movs r1, 0x1 - add r8, r1 - ldrb r7, [r6] - cmp r7, 0xFF - beq _0800335C - mov r2, r8 - cmp r2, 0x1F - bgt _0800335C - b _0800322A -_0800335C: - ldr r1, =0x03002f60 - movs r0, 0 - strb r0, [r1] - movs r0, 0x1 -_08003364: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end Window_InitFromTemplates - - thumb_func_start Window_AddFromTemplate -Window_AddFromTemplate: @ 8003380 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - mov r8, r0 - movs r6, 0 - ldr r1, =0x02020004 - ldrb r0, [r1] - cmp r0, 0xFF - beq _080033B0 -_08003398: - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0x1F - bhi _080033B0 - lsls r0, r6, 1 - adds r0, r6 - lsls r0, 2 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0xFF - bne _08003398 -_080033B0: - cmp r6, 0x20 - beq _0800346A - mov r0, r8 - ldrb r7, [r0] - movs r1, 0 - mov r9, r1 - ldr r0, =0x03002f54 - ldr r0, [r0] - cmp r0, 0x1 - bne _080033E2 - mov r2, r8 - ldrb r1, [r2, 0x3] - ldrb r0, [r2, 0x4] - adds r2, r1, 0 - muls r2, r0 - adds r0, r7, 0 - movs r1, 0 - movs r3, 0 - bl do_nothing - mov r9, r0 - movs r0, 0x1 - negs r0, r0 - cmp r9, r0 - beq _0800346A -_080033E2: - ldr r3, =0x03002f70 - mov r10, r3 - lsls r0, r7, 2 - adds r1, r0, r3 - ldr r1, [r1] - str r0, [sp] - cmp r1, 0 - bne _08003432 - adds r0, r7, 0 - movs r1, 0x8 - bl bg_get_field - lsls r0, 16 - lsrs r5, r0, 16 - ldr r0, =0x0000ffff - cmp r5, r0 - beq _08003432 - adds r0, r5, 0 - bl malloc_and_clear - adds r4, r0, 0 - cmp r4, 0 - beq _0800346A - movs r1, 0 - mov r3, r10 - cmp r1, r5 - bge _08003424 - movs r2, 0 -_0800341A: - adds r0, r4, r1 - strb r2, [r0] - adds r1, 0x1 - cmp r1, r5 - blt _0800341A -_08003424: - ldr r1, [sp] - adds r0, r1, r3 - str r4, [r0] - adds r0, r7, 0 - adds r1, r4, 0 - bl bg_set_tilemap -_08003432: - mov r2, r8 - ldrb r1, [r2, 0x3] - ldrb r0, [r2, 0x4] - muls r0, r1 - lsls r0, 21 - lsrs r0, 16 - bl malloc_and_clear - adds r4, r0, 0 - cmp r4, 0 - bne _08003484 - adds r0, r7, 0 - bl GetNumActiveWindowsOnBg - lsls r0, 24 - cmp r0, 0 - bne _0800346A - ldr r0, =0x03002f70 - ldr r3, [sp] - adds r5, r3, r0 - ldr r1, [r5] - ldr r0, =nullsub_8 + 1 - cmp r1, r0 - beq _0800346A - adds r0, r1, 0 - bl free - str r4, [r5] -_0800346A: - movs r0, 0xFF - b _080034C0 - .align 2, 0 - .pool -_08003484: - ldr r2, =0x02020004 - lsls r1, r6, 1 - adds r1, r6 - lsls r1, 2 - adds r0, r2, 0 - adds r0, 0x8 - adds r0, r1, r0 - str r4, [r0] - adds r2, r1, r2 - mov r3, r8 - ldr r0, [r3] - ldr r1, [r3, 0x4] - str r0, [r2] - str r1, [r2, 0x4] - ldr r0, =0x03002f54 - ldr r0, [r0] - cmp r0, 0x1 - bne _080034BE - mov r0, r9 - strh r0, [r2, 0x6] - ldrb r0, [r2, 0x3] - ldrb r1, [r2, 0x4] - adds r2, r0, 0 - muls r2, r1 - adds r0, r7, 0 - mov r1, r9 - movs r3, 0x1 - bl do_nothing -_080034BE: - adds r0, r6, 0 -_080034C0: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end Window_AddFromTemplate - - thumb_func_start Window_AddFromTemplateWithoutAllocatingMemory -Window_AddFromTemplateWithoutAllocatingMemory: @ 80034D8 - push {r4-r6,lr} - adds r5, r0, 0 - movs r4, 0 - ldr r1, =0x02020004 - ldrb r0, [r1] - cmp r0, 0xFF - beq _080034FE -_080034E6: - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0x1F - bhi _080034FE - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 2 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0xFF - bne _080034E6 -_080034FE: - cmp r4, 0x20 - beq _08003528 - ldrb r6, [r5] - movs r3, 0 - ldr r0, =0x03002f54 - ldr r0, [r0] - cmp r0, 0x1 - bne _08003534 - ldrb r1, [r5, 0x3] - ldrb r0, [r5, 0x4] - adds r2, r1, 0 - muls r2, r0 - adds r0, r6, 0 - movs r1, 0 - bl do_nothing - adds r3, r0, 0 - movs r0, 0x1 - negs r0, r0 - cmp r3, r0 - bne _08003534 -_08003528: - movs r0, 0xFF - b _08003564 - .align 2, 0 - .pool -_08003534: - ldr r1, =0x02020004 - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 2 - adds r2, r0, r1 - ldr r0, [r5] - ldr r1, [r5, 0x4] - str r0, [r2] - str r1, [r2, 0x4] - ldr r0, =0x03002f54 - ldr r0, [r0] - cmp r0, 0x1 - bne _08003562 - strh r3, [r2, 0x6] - ldrb r0, [r2, 0x3] - ldrb r1, [r2, 0x4] - adds r2, r0, 0 - muls r2, r1 - adds r0, r6, 0 - adds r1, r3, 0 - movs r3, 0x1 - bl do_nothing -_08003562: - adds r0, r4, 0 -_08003564: - pop {r4-r6} - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end Window_AddFromTemplateWithoutAllocatingMemory - - thumb_func_start Window_Remove -Window_Remove: @ 8003574 - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r1, =0x02020004 - lsls r0, r6, 1 - adds r0, r6 - lsls r0, 2 - adds r4, r0, r1 - ldrb r3, [r4] - adds r7, r3, 0 - ldr r0, =0x03002f54 - ldr r0, [r0] - cmp r0, 0x1 - bne _080035A0 - ldrh r1, [r4, 0x6] - ldrb r2, [r4, 0x3] - ldrb r0, [r4, 0x4] - muls r2, r0 - adds r0, r3, 0 - movs r3, 0x2 - bl do_nothing -_080035A0: - ldr r0, =0x082e9584 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [r4] - str r1, [r4, 0x4] - adds r0, r7, 0 - bl GetNumActiveWindowsOnBg - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0 - bne _080035CE - ldr r0, =0x03002f70 - lsls r1, r7, 2 - adds r4, r1, r0 - ldr r1, [r4] - ldr r0, =nullsub_8 + 1 - cmp r1, r0 - beq _080035CE - adds r0, r1, 0 - bl free - str r5, [r4] -_080035CE: - ldr r1, =0x02020004 - lsls r0, r6, 1 - adds r0, r6 - lsls r0, 2 - adds r1, 0x8 - adds r4, r0, r1 - ldr r0, [r4] - cmp r0, 0 - beq _080035E8 - bl free - movs r0, 0 - str r0, [r4] -_080035E8: - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end Window_Remove - - thumb_func_start Window_FreeMemory -Window_FreeMemory: @ 8003604 - push {r4-r6,lr} - ldr r4, =0x03002f70 - movs r5, 0x3 -_0800360A: - ldr r1, [r4] - cmp r1, 0 - beq _08003620 - ldr r0, =nullsub_8 + 1 - cmp r1, r0 - beq _08003620 - adds r0, r1, 0 - bl free - movs r0, 0 - str r0, [r4] -_08003620: - adds r4, 0x4 - subs r5, 0x1 - cmp r5, 0 - bge _0800360A - ldr r0, =0x02020004 - adds r4, r0, 0 - adds r4, 0x8 - movs r6, 0 - movs r5, 0x1F -_08003632: - ldr r0, [r4] - cmp r0, 0 - beq _0800363E - bl free - str r6, [r4] -_0800363E: - adds r4, 0xC - subs r5, 0x1 - cmp r5, 0 - bge _08003632 - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end Window_FreeMemory - - thumb_func_start Window_CopyToVram -Window_CopyToVram: @ 8003658 - push {r4-r6,lr} - sub sp, 0xC - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r3, r1, 24 - adds r5, r3, 0 - ldr r2, =0x02020004 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - mov r0, sp - adds r1, r2 - ldm r1!, {r2,r4,r6} - stm r0!, {r2,r4,r6} - mov r0, sp - ldrb r1, [r0, 0x3] - ldrb r0, [r0, 0x4] - muls r0, r1 - lsls r0, 21 - lsrs r4, r0, 16 - cmp r3, 0x2 - beq _080036A4 - cmp r3, 0x2 - bgt _08003694 - cmp r3, 0x1 - beq _0800369A - b _080036CE - .align 2, 0 - .pool -_08003694: - cmp r5, 0x3 - beq _080036B6 - b _080036CE -_0800369A: - mov r0, sp - ldrb r0, [r0] - bl gpu_copy_wram_bg_tilemap_to_vram - b _080036CE -_080036A4: - mov r0, sp - ldrb r0, [r0] - ldr r1, [sp, 0x8] - mov r2, sp - ldrh r3, [r2, 0x6] - adds r2, r4, 0 - bl gpu_copy_bg_tile_pattern_data_to_vram - b _080036CE -_080036B6: - mov r0, sp - ldrb r0, [r0] - ldr r1, [sp, 0x8] - mov r2, sp - ldrh r3, [r2, 0x6] - adds r2, r4, 0 - bl gpu_copy_bg_tile_pattern_data_to_vram - mov r0, sp - ldrb r0, [r0] - bl gpu_copy_wram_bg_tilemap_to_vram -_080036CE: - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end Window_CopyToVram - - thumb_func_start Window_CopyRectToVram -Window_CopyRectToVram: @ 80036D8 - push {r4-r7,lr} - sub sp, 0xC - adds r6, r0, 0 - adds r5, r1, 0 - adds r4, r2, 0 - mov r12, r3 - ldr r3, [sp, 0x24] - ldr r0, [sp, 0x20] - cmp r0, 0 - beq _08003782 - cmp r3, 0 - beq _08003782 - ldr r2, =0x02020004 - lsls r0, r6, 1 - adds r0, r6 - lsls r0, 2 - mov r1, sp - adds r0, r2 - ldm r0!, {r2,r6,r7} - stm r1!, {r2,r6,r7} - subs r2, r3, 0x1 - mov r0, sp - ldrb r1, [r0, 0x3] - adds r3, r2, 0 - muls r3, r1 - subs r0, r1, r4 - adds r3, r0 - ldr r2, [sp, 0x20] - adds r0, r4, r2 - subs r0, r1, r0 - subs r3, r0 - lsls r3, 5 - mov r0, r12 - muls r0, r1 - adds r4, r0, r4 - cmp r5, 0x2 - beq _08003740 - cmp r5, 0x2 - bhi _08003730 - cmp r5, 0x1 - beq _08003736 - b _08003782 - .align 2, 0 - .pool -_08003730: - cmp r5, 0x3 - beq _0800375E - b _08003782 -_08003736: - mov r0, sp - ldrb r0, [r0] - bl gpu_copy_wram_bg_tilemap_to_vram - b _08003782 -_08003740: - mov r0, sp - ldrb r0, [r0] - lsls r2, r4, 5 - ldr r1, [sp, 0x8] - adds r1, r2 - lsls r2, r3, 16 - lsrs r2, 16 - mov r3, sp - ldrh r3, [r3, 0x6] - adds r3, r4 - lsls r3, 16 - lsrs r3, 16 - bl gpu_copy_bg_tile_pattern_data_to_vram - b _08003782 -_0800375E: - mov r0, sp - ldrb r0, [r0] - lsls r2, r4, 5 - ldr r1, [sp, 0x8] - adds r1, r2 - lsls r2, r3, 16 - lsrs r2, 16 - mov r3, sp - ldrh r3, [r3, 0x6] - adds r3, r4 - lsls r3, 16 - lsrs r3, 16 - bl gpu_copy_bg_tile_pattern_data_to_vram - mov r0, sp - ldrb r0, [r0] - bl gpu_copy_wram_bg_tilemap_to_vram -_08003782: - add sp, 0xC - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end Window_CopyRectToVram - - thumb_func_start Window_WriteStandardTileMap -Window_WriteStandardTileMap: @ 800378C - push {r4,lr} - sub sp, 0x1C - lsls r0, 24 - lsrs r0, 24 - ldr r2, =0x02020004 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - add r0, sp, 0x10 - adds r1, r2 - ldm r1!, {r2-r4} - stm r0!, {r2-r4} - add r0, sp, 0x10 - ldrb r0, [r0] - movs r1, 0xA - bl bg_get_field - adds r1, r0, 0 - add r0, sp, 0x10 - ldrh r0, [r0, 0x6] - adds r1, r0 - lsls r1, 16 - lsrs r1, 16 - add r0, sp, 0x10 - ldrb r0, [r0] - add r2, sp, 0x10 - ldrb r2, [r2, 0x1] - add r3, sp, 0x10 - ldrb r3, [r3, 0x2] - add r4, sp, 0x10 - ldrb r4, [r4, 0x3] - str r4, [sp] - add r4, sp, 0x10 - ldrb r4, [r4, 0x4] - str r4, [sp, 0x4] - add r4, sp, 0x10 - ldrb r4, [r4, 0x5] - str r4, [sp, 0x8] - movs r4, 0x1 - str r4, [sp, 0xC] - bl bg_write_sequence_to_wram_tile_map_rect - add sp, 0x1C - pop {r4} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end Window_WriteStandardTileMap - - thumb_func_start Window_WriteStandardTileMapRectOverridePalette -Window_WriteStandardTileMapRectOverridePalette: @ 80037EC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x24 - ldr r4, [sp, 0x44] - ldr r5, [sp, 0x48] - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - mov r10, r1 - lsls r2, 24 - lsrs r2, 24 - mov r9, r2 - lsls r3, 24 - lsrs r3, 24 - str r3, [sp, 0x1C] - lsls r4, 24 - lsrs r4, 24 - mov r8, r4 - lsls r5, 24 - lsrs r5, 24 - str r5, [sp, 0x20] - ldr r2, =0x02020004 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - add r0, sp, 0x10 - adds r1, r2 - ldm r1!, {r2-r4} - stm r0!, {r2-r4} - add r0, sp, 0x10 - ldrb r0, [r0] - movs r1, 0xA - bl bg_get_field - add r2, sp, 0x10 - adds r1, r2, 0 - ldrb r1, [r1, 0x3] - mov r3, r9 - muls r3, r1 - adds r1, r3, 0 - ldrh r2, [r2, 0x6] - adds r1, r2 - add r1, r10 - adds r0, r1 - lsls r0, 16 - lsrs r6, r0, 16 - movs r5, 0 - cmp r5, r8 - bge _0800388E - add r4, sp, 0x10 - movs r7, 0x1 -_0800385A: - ldrb r0, [r4] - ldrb r2, [r4, 0x1] - add r2, r10 - lsls r2, 24 - lsrs r2, 24 - ldrb r3, [r4, 0x2] - add r3, r9 - adds r3, r5 - lsls r3, 24 - lsrs r3, 24 - ldr r1, [sp, 0x1C] - str r1, [sp] - str r7, [sp, 0x4] - ldr r1, [sp, 0x20] - str r1, [sp, 0x8] - str r7, [sp, 0xC] - adds r1, r6, 0 - bl bg_write_sequence_to_wram_tile_map_rect - ldrb r0, [r4, 0x3] - adds r0, r6, r0 - lsls r0, 16 - lsrs r6, r0, 16 - adds r5, 0x1 - cmp r5, r8 - blt _0800385A -_0800388E: - add sp, 0x24 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end Window_WriteStandardTileMapRectOverridePalette - - thumb_func_start Window_FillTileMap -Window_FillTileMap: @ 80038A4 - push {r4,lr} - sub sp, 0x18 - lsls r0, 24 - lsrs r0, 24 - ldr r2, =0x02020004 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - add r0, sp, 0xC - adds r1, r2 - ldm r1!, {r2-r4} - stm r0!, {r2-r4} - add r0, sp, 0xC - ldrb r0, [r0] - ldr r1, =0x03002f60 - ldrb r1, [r1] - add r2, sp, 0xC - ldrb r2, [r2, 0x1] - add r3, sp, 0xC - ldrb r3, [r3, 0x2] - add r4, sp, 0xC - ldrb r4, [r4, 0x3] - str r4, [sp] - add r4, sp, 0xC - ldrb r4, [r4, 0x4] - str r4, [sp, 0x4] - add r4, sp, 0xC - ldrb r4, [r4, 0x5] - str r4, [sp, 0x8] - bl Bg_FillWramTileMapRectWithTileAndPalette - add sp, 0x18 - pop {r4} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end Window_FillTileMap - - thumb_func_start Window_WriteStandardTileMapRect -Window_WriteStandardTileMapRect: @ 80038F4 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x20 - ldr r4, [sp, 0x40] - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - mov r10, r1 - lsls r2, 24 - lsrs r2, 24 - mov r9, r2 - lsls r3, 24 - lsrs r3, 24 - str r3, [sp, 0x1C] - lsls r4, 24 - lsrs r4, 24 - mov r8, r4 - ldr r2, =0x02020004 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - add r0, sp, 0x10 - adds r1, r2 - ldm r1!, {r2-r4} - stm r0!, {r2-r4} - add r0, sp, 0x10 - ldrb r0, [r0] - movs r1, 0xA - bl bg_get_field - add r2, sp, 0x10 - adds r1, r2, 0 - ldrb r1, [r1, 0x3] - mov r3, r9 - muls r3, r1 - adds r1, r3, 0 - ldrh r2, [r2, 0x6] - adds r1, r2 - add r1, r10 - adds r0, r1 - lsls r0, 16 - lsrs r6, r0, 16 - movs r5, 0 - cmp r5, r8 - bge _0800398E - add r4, sp, 0x10 - movs r7, 0x1 -_0800395A: - ldrb r0, [r4] - ldrb r2, [r4, 0x1] - add r2, r10 - lsls r2, 24 - lsrs r2, 24 - ldrb r3, [r4, 0x2] - add r3, r9 - adds r3, r5 - lsls r3, 24 - lsrs r3, 24 - ldr r1, [sp, 0x1C] - str r1, [sp] - str r7, [sp, 0x4] - ldrb r1, [r4, 0x5] - str r1, [sp, 0x8] - str r7, [sp, 0xC] - adds r1, r6, 0 - bl bg_write_sequence_to_wram_tile_map_rect - ldrb r0, [r4, 0x3] - adds r0, r6, r0 - lsls r0, 16 - lsrs r6, r0, 16 - adds r5, 0x1 - cmp r5, r8 - blt _0800395A -_0800398E: - add sp, 0x20 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end Window_WriteStandardTileMapRect - - thumb_func_start Window_CopyWholePixelBlockToWindow -Window_CopyWholePixelBlockToWindow: @ 80039A4 - push {r4,r5,lr} - sub sp, 0x18 - ldr r4, [sp, 0x24] - ldr r5, [sp, 0x28] - lsls r0, 24 - lsrs r0, 24 - lsls r2, 16 - lsrs r2, 16 - lsls r3, 16 - lsrs r3, 16 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 16 - lsrs r5, 16 - str r4, [sp] - str r5, [sp, 0x4] - str r2, [sp, 0x8] - str r3, [sp, 0xC] - str r4, [sp, 0x10] - str r5, [sp, 0x14] - movs r2, 0 - movs r3, 0 - bl Window_CopyPixelRectToWindow - add sp, 0x18 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end Window_CopyWholePixelBlockToWindow - - thumb_func_start Window_CopyPixelRectToWindow -Window_CopyPixelRectToWindow: @ 80039DC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x24 - ldr r4, [sp, 0x44] - ldr r5, [sp, 0x48] - ldr r6, [sp, 0x4C] - mov r8, r6 - ldr r6, [sp, 0x50] - mov r9, r6 - ldr r6, [sp, 0x54] - mov r10, r6 - ldr r6, [sp, 0x58] - mov r12, r6 - lsls r0, 24 - lsrs r0, 24 - lsls r2, 16 - lsrs r2, 16 - lsls r3, 16 - lsrs r3, 16 - lsls r4, 16 - mov r6, r8 - lsls r6, 16 - lsrs r6, 16 - mov r8, r6 - mov r6, r9 - lsls r6, 16 - lsrs r6, 16 - mov r9, r6 - mov r6, r10 - lsls r6, 16 - lsrs r6, 16 - mov r10, r6 - mov r6, r12 - lsls r6, 16 - lsrs r6, 16 - mov r12, r6 - str r1, [sp, 0x14] - ldr r7, =0xffff0000 - lsls r5, 16 - ldr r6, =0x0000ffff - lsrs r4, 16 - orrs r4, r5 - str r4, [sp, 0x18] - ldr r1, =0x02020004 - lsls r5, r0, 1 - adds r5, r0 - lsls r5, 2 - adds r0, r1, 0 - adds r0, 0x8 - adds r0, r5, r0 - ldr r0, [r0] - str r0, [sp, 0x1C] - adds r5, r1 - ldrb r0, [r5, 0x3] - lsls r0, 3 - add r1, sp, 0x1C - ldr r4, [r1, 0x4] - ands r4, r7 - orrs r4, r0 - str r4, [r1, 0x4] - ldrb r0, [r5, 0x4] - lsls r0, 19 - ands r6, r4 - orrs r6, r0 - str r6, [r1, 0x4] - mov r0, r8 - str r0, [sp] - mov r6, r9 - str r6, [sp, 0x4] - mov r0, r10 - str r0, [sp, 0x8] - mov r6, r12 - str r6, [sp, 0xC] - movs r0, 0 - str r0, [sp, 0x10] - add r0, sp, 0x14 - bl PixelBlock_CopyRect4Bpp - add sp, 0x24 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end Window_CopyPixelRectToWindow - - thumb_func_start Window_copy_pixels_rect_3 -Window_copy_pixels_rect_3: @ 8003A9C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x28 - ldr r4, [sp, 0x48] - ldr r5, [sp, 0x4C] - ldr r6, [sp, 0x50] - mov r8, r6 - ldr r7, [sp, 0x54] - mov r9, r7 - ldr r6, [sp, 0x58] - mov r10, r6 - ldr r7, [sp, 0x5C] - mov r12, r7 - ldr r6, [sp, 0x60] - lsls r0, 24 - lsrs r0, 24 - lsls r2, 16 - lsrs r2, 16 - lsls r3, 16 - lsrs r3, 16 - lsls r4, 16 - mov r7, r8 - lsls r7, 16 - lsrs r7, 16 - mov r8, r7 - mov r7, r9 - lsls r7, 16 - lsrs r7, 16 - mov r9, r7 - mov r7, r10 - lsls r7, 16 - lsrs r7, 16 - mov r10, r7 - mov r7, r12 - lsls r7, 16 - lsrs r7, 16 - mov r12, r7 - lsls r6, 24 - lsrs r6, 24 - str r6, [sp, 0x24] - str r1, [sp, 0x14] - lsls r5, 16 - ldr r6, =0x0000ffff - lsrs r4, 16 - orrs r4, r5 - str r4, [sp, 0x18] - ldr r1, =0x02020004 - lsls r5, r0, 1 - adds r5, r0 - lsls r5, 2 - adds r0, r1, 0 - adds r0, 0x8 - adds r0, r5, r0 - ldr r0, [r0] - str r0, [sp, 0x1C] - adds r5, r1 - ldrb r0, [r5, 0x3] - lsls r0, 3 - add r1, sp, 0x1C - ldr r4, [r1, 0x4] - ldr r7, =0xffff0000 - ands r4, r7 - orrs r4, r0 - str r4, [r1, 0x4] - ldrb r0, [r5, 0x4] - lsls r0, 19 - ands r6, r4 - orrs r6, r0 - str r6, [r1, 0x4] - mov r0, r8 - str r0, [sp] - mov r6, r9 - str r6, [sp, 0x4] - mov r7, r10 - str r7, [sp, 0x8] - mov r0, r12 - str r0, [sp, 0xC] - ldr r6, [sp, 0x24] - str r6, [sp, 0x10] - add r0, sp, 0x14 - bl PixelBlock_CopyRect4Bpp - add sp, 0x28 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end Window_copy_pixels_rect_3 - - thumb_func_start Window_FillPixelRect -Window_FillPixelRect: @ 8003B64 - push {r4-r6,lr} - mov r6, r9 - mov r5, r8 - push {r5,r6} - sub sp, 0x10 - mov r9, r3 - ldr r3, [sp, 0x28] - ldr r4, [sp, 0x2C] - mov r8, r4 - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - lsls r2, 16 - lsrs r2, 16 - mov r4, r9 - lsls r4, 16 - lsrs r4, 16 - mov r9, r4 - lsls r3, 16 - lsrs r3, 16 - mov r4, r8 - lsls r4, 16 - lsrs r4, 16 - mov r8, r4 - ldr r5, =0x02020004 - lsls r4, r0, 1 - adds r4, r0 - lsls r4, 2 - adds r0, r5, 0 - adds r0, 0x8 - adds r0, r4, r0 - ldr r0, [r0] - str r0, [sp, 0x8] - adds r4, r5 - ldrb r0, [r4, 0x3] - lsls r0, 3 - ldr r6, =0xffff0000 - ldr r5, [sp, 0xC] - ands r5, r6 - orrs r5, r0 - str r5, [sp, 0xC] - ldrb r4, [r4, 0x4] - lsls r4, 19 - ldr r0, =0x0000ffff - ands r0, r5 - orrs r0, r4 - str r0, [sp, 0xC] - mov r0, r8 - str r0, [sp] - str r1, [sp, 0x4] - add r0, sp, 0x8 - adds r1, r2, 0 - mov r2, r9 - bl PixelBlock_FillRect4Bpp - add sp, 0x10 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end Window_FillPixelRect - - thumb_func_start Window_CopyToPixels -Window_CopyToPixels: @ 8003BF0 - push {r4-r6,lr} - adds r6, r1, 0 - lsls r0, 24 - lsrs r4, r0, 24 - lsls r5, r2, 16 - lsls r3, 16 - lsrs r2, r3, 16 - cmp r5, 0 - beq _08003C24 - ldr r1, =0x02020004 - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 2 - adds r1, 0x8 - adds r0, r1 - lsls r2, 5 - ldr r1, [r0] - adds r1, r2 - lsrs r2, r5, 17 - adds r0, r6, 0 - bl CpuSet - b _08003C3C - .align 2, 0 - .pool -_08003C24: - ldr r1, =0x02020004 - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 2 - adds r1, 0x8 - adds r0, r1 - lsls r2, 5 - ldr r1, [r0] - adds r1, r2 - adds r0, r6, 0 - bl LZ77UnCompWram -_08003C3C: - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end Window_CopyToPixels - - thumb_func_start Window_FastFillPixels -Window_FastFillPixels: @ 8003C48 - push {r4,r5,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - ldr r5, =0x02020004 - lsls r4, r0, 1 - adds r4, r0 - lsls r4, 2 - adds r0, r4, r5 - ldrb r2, [r0, 0x3] - ldrb r0, [r0, 0x4] - muls r2, r0 - lsls r0, r1, 24 - lsls r3, r1, 16 - orrs r0, r3 - lsls r3, r1, 8 - orrs r0, r3 - orrs r0, r1 - str r0, [sp] - adds r5, 0x8 - adds r4, r5 - ldr r1, [r4] - lsls r2, 3 - movs r0, 0x80 - lsls r0, 17 - orrs r2, r0 - mov r0, sp - bl CpuFastSet - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end Window_FastFillPixels - - thumb_func_start Window_ScrollVertically -Window_ScrollVertically: @ 8003C94 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - mov r8, r1 - lsls r2, 24 - lsrs r2, 24 - str r2, [sp] - lsls r3, 24 - lsrs r3, 24 - ldr r2, =0x02020004 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r4, r1, r2 - adds r2, 0x8 - adds r1, r2 - ldr r5, [r1] - lsls r7, r3, 24 - lsls r0, r3, 16 - orrs r7, r0 - lsls r0, r3, 8 - orrs r7, r0 - orrs r7, r3 - ldr r1, [r4] - ldr r2, [r4, 0x4] - ldrb r3, [r4, 0x4] - lsrs r0, r1, 24 - muls r0, r3 - lsls r6, r0, 5 - lsrs r1, 24 - mov r12, r1 - mov r0, r8 - cmp r0, 0x1 - bne _08003CE8 - b _08003E9E -_08003CE8: - cmp r0, 0x1 - ble _08003CEE - b _08004046 -_08003CEE: - cmp r0, 0 - beq _08003CF4 - b _08004046 -_08003CF4: - movs r4, 0 - cmp r4, r6 - blt _08003CFC - b _08004046 -_08003CFC: - movs r1, 0x8 - negs r1, r1 - mov r9, r1 - movs r2, 0x7 - mov r8, r2 - mov r10, r5 -_08003D08: - ldr r3, [sp] - adds r0, r3, 0 - mov r1, r9 - ands r0, r1 - mov r1, r12 - muls r1, r0 - adds r0, r3, 0 - mov r2, r8 - ands r0, r2 - orrs r1, r0 - lsls r1, 2 - adds r1, r4, r1 - cmp r1, r6 - bge _08003D34 - adds r0, r5, r1 - ldr r0, [r0] - mov r1, r10 - str r0, [r1] - b _08003D38 - .align 2, 0 - .pool -_08003D34: - mov r2, r10 - str r7, [r2] -_08003D38: - adds r3, 0x1 - adds r2, r4, 0x4 - adds r0, r3, 0 - mov r1, r9 - ands r0, r1 - mov r1, r12 - muls r1, r0 - str r1, [sp, 0x4] - adds r0, r3, 0 - mov r1, r8 - ands r0, r1 - ldr r1, [sp, 0x4] - orrs r1, r0 - lsls r1, 2 - adds r1, r4, r1 - cmp r1, r6 - bge _08003D64 - adds r0, r5, r2 - adds r1, r5, r1 - ldr r1, [r1] - str r1, [r0] - b _08003D68 -_08003D64: - adds r0, r5, r2 - str r7, [r0] -_08003D68: - adds r3, 0x1 - adds r2, r4, 0 - adds r2, 0x8 - adds r0, r3, 0 - mov r1, r9 - ands r0, r1 - mov r1, r12 - muls r1, r0 - str r1, [sp, 0x4] - adds r0, r3, 0 - mov r1, r8 - ands r0, r1 - ldr r1, [sp, 0x4] - orrs r1, r0 - lsls r1, 2 - adds r1, r4, r1 - cmp r1, r6 - bge _08003D96 - adds r0, r5, r2 - adds r1, r5, r1 - ldr r1, [r1] - str r1, [r0] - b _08003D9A -_08003D96: - adds r0, r5, r2 - str r7, [r0] -_08003D9A: - adds r3, 0x1 - adds r2, r4, 0 - adds r2, 0xC - adds r0, r3, 0 - mov r1, r9 - ands r0, r1 - mov r1, r12 - muls r1, r0 - str r1, [sp, 0x4] - adds r0, r3, 0 - mov r1, r8 - ands r0, r1 - ldr r1, [sp, 0x4] - orrs r1, r0 - lsls r1, 2 - adds r1, r4, r1 - cmp r1, r6 - bge _08003DC8 - adds r0, r5, r2 - adds r1, r5, r1 - ldr r1, [r1] - str r1, [r0] - b _08003DCC -_08003DC8: - adds r0, r5, r2 - str r7, [r0] -_08003DCC: - adds r3, 0x1 - adds r2, r4, 0 - adds r2, 0x10 - adds r0, r3, 0 - mov r1, r9 - ands r0, r1 - mov r1, r12 - muls r1, r0 - str r1, [sp, 0x4] - adds r0, r3, 0 - mov r1, r8 - ands r0, r1 - ldr r1, [sp, 0x4] - orrs r1, r0 - lsls r1, 2 - adds r1, r4, r1 - cmp r1, r6 - bge _08003DFA - adds r0, r5, r2 - adds r1, r5, r1 - ldr r1, [r1] - str r1, [r0] - b _08003DFE -_08003DFA: - adds r0, r5, r2 - str r7, [r0] -_08003DFE: - adds r3, 0x1 - adds r2, r4, 0 - adds r2, 0x14 - adds r0, r3, 0 - mov r1, r9 - ands r0, r1 - mov r1, r12 - muls r1, r0 - str r1, [sp, 0x4] - adds r0, r3, 0 - mov r1, r8 - ands r0, r1 - ldr r1, [sp, 0x4] - orrs r1, r0 - lsls r1, 2 - adds r1, r4, r1 - cmp r1, r6 - bge _08003E2C - adds r0, r5, r2 - adds r1, r5, r1 - ldr r1, [r1] - str r1, [r0] - b _08003E30 -_08003E2C: - adds r0, r5, r2 - str r7, [r0] -_08003E30: - adds r3, 0x1 - adds r2, r4, 0 - adds r2, 0x18 - adds r0, r3, 0 - mov r1, r9 - ands r0, r1 - mov r1, r12 - muls r1, r0 - str r1, [sp, 0x4] - adds r0, r3, 0 - mov r1, r8 - ands r0, r1 - ldr r1, [sp, 0x4] - orrs r1, r0 - lsls r1, 2 - adds r1, r4, r1 - cmp r1, r6 - bge _08003E5E - adds r0, r5, r2 - adds r1, r5, r1 - ldr r1, [r1] - str r1, [r0] - b _08003E62 -_08003E5E: - adds r0, r5, r2 - str r7, [r0] -_08003E62: - adds r3, 0x1 - adds r2, r4, 0 - adds r2, 0x1C - adds r0, r3, 0 - mov r1, r9 - ands r0, r1 - mov r1, r12 - muls r1, r0 - adds r0, r1, 0 - mov r1, r8 - ands r3, r1 - orrs r0, r3 - lsls r0, 2 - adds r1, r4, r0 - cmp r1, r6 - bge _08003E8C - adds r0, r5, r2 - adds r1, r5, r1 - ldr r1, [r1] - str r1, [r0] - b _08003E90 -_08003E8C: - adds r0, r5, r2 - str r7, [r0] -_08003E90: - movs r2, 0x20 - add r10, r2 - adds r4, 0x20 - cmp r4, r6 - bge _08003E9C - b _08003D08 -_08003E9C: - b _08004046 -_08003E9E: - subs r0, r6, 0x4 - adds r5, r0 - movs r4, 0 - cmp r4, r6 - blt _08003EAA - b _08004046 -_08003EAA: - movs r0, 0x8 - negs r0, r0 - mov r9, r0 - movs r1, 0x7 - mov r8, r1 - mov r10, r5 -_08003EB6: - ldr r3, [sp] - adds r0, r3, 0 - mov r2, r9 - ands r0, r2 - mov r1, r12 - muls r1, r0 - adds r0, r3, 0 - mov r2, r8 - ands r0, r2 - orrs r1, r0 - lsls r1, 2 - adds r1, r4, r1 - cmp r1, r6 - bge _08003EDC - subs r0, r5, r1 - ldr r0, [r0] - mov r1, r10 - str r0, [r1] - b _08003EE0 -_08003EDC: - mov r2, r10 - str r7, [r2] -_08003EE0: - adds r3, 0x1 - adds r2, r4, 0x4 - adds r0, r3, 0 - mov r1, r9 - ands r0, r1 - mov r1, r12 - muls r1, r0 - str r1, [sp, 0x4] - adds r0, r3, 0 - mov r1, r8 - ands r0, r1 - ldr r1, [sp, 0x4] - orrs r1, r0 - lsls r1, 2 - adds r1, r4, r1 - cmp r1, r6 - bge _08003F0C - subs r0, r5, r2 - subs r1, r5, r1 - ldr r1, [r1] - str r1, [r0] - b _08003F10 -_08003F0C: - subs r0, r5, r2 - str r7, [r0] -_08003F10: - adds r3, 0x1 - adds r2, r4, 0 - adds r2, 0x8 - adds r0, r3, 0 - mov r1, r9 - ands r0, r1 - mov r1, r12 - muls r1, r0 - str r1, [sp, 0x4] - adds r0, r3, 0 - mov r1, r8 - ands r0, r1 - ldr r1, [sp, 0x4] - orrs r1, r0 - lsls r1, 2 - adds r1, r4, r1 - cmp r1, r6 - bge _08003F3E - subs r0, r5, r2 - subs r1, r5, r1 - ldr r1, [r1] - str r1, [r0] - b _08003F42 -_08003F3E: - subs r0, r5, r2 - str r7, [r0] -_08003F42: - adds r3, 0x1 - adds r2, r4, 0 - adds r2, 0xC - adds r0, r3, 0 - mov r1, r9 - ands r0, r1 - mov r1, r12 - muls r1, r0 - str r1, [sp, 0x4] - adds r0, r3, 0 - mov r1, r8 - ands r0, r1 - ldr r1, [sp, 0x4] - orrs r1, r0 - lsls r1, 2 - adds r1, r4, r1 - cmp r1, r6 - bge _08003F70 - subs r0, r5, r2 - subs r1, r5, r1 - ldr r1, [r1] - str r1, [r0] - b _08003F74 -_08003F70: - subs r0, r5, r2 - str r7, [r0] -_08003F74: - adds r3, 0x1 - adds r2, r4, 0 - adds r2, 0x10 - adds r0, r3, 0 - mov r1, r9 - ands r0, r1 - mov r1, r12 - muls r1, r0 - str r1, [sp, 0x4] - adds r0, r3, 0 - mov r1, r8 - ands r0, r1 - ldr r1, [sp, 0x4] - orrs r1, r0 - lsls r1, 2 - adds r1, r4, r1 - cmp r1, r6 - bge _08003FA2 - subs r0, r5, r2 - subs r1, r5, r1 - ldr r1, [r1] - str r1, [r0] - b _08003FA6 -_08003FA2: - subs r0, r5, r2 - str r7, [r0] -_08003FA6: - adds r3, 0x1 - adds r2, r4, 0 - adds r2, 0x14 - adds r0, r3, 0 - mov r1, r9 - ands r0, r1 - mov r1, r12 - muls r1, r0 - str r1, [sp, 0x4] - adds r0, r3, 0 - mov r1, r8 - ands r0, r1 - ldr r1, [sp, 0x4] - orrs r1, r0 - lsls r1, 2 - adds r1, r4, r1 - cmp r1, r6 - bge _08003FD4 - subs r0, r5, r2 - subs r1, r5, r1 - ldr r1, [r1] - str r1, [r0] - b _08003FD8 -_08003FD4: - subs r0, r5, r2 - str r7, [r0] -_08003FD8: - adds r3, 0x1 - adds r2, r4, 0 - adds r2, 0x18 - adds r0, r3, 0 - mov r1, r9 - ands r0, r1 - mov r1, r12 - muls r1, r0 - str r1, [sp, 0x4] - adds r0, r3, 0 - mov r1, r8 - ands r0, r1 - ldr r1, [sp, 0x4] - orrs r1, r0 - lsls r1, 2 - adds r1, r4, r1 - cmp r1, r6 - bge _08004006 - subs r0, r5, r2 - subs r1, r5, r1 - ldr r1, [r1] - str r1, [r0] - b _0800400A -_08004006: - subs r0, r5, r2 - str r7, [r0] -_0800400A: - adds r3, 0x1 - adds r2, r4, 0 - adds r2, 0x1C - adds r0, r3, 0 - mov r1, r9 - ands r0, r1 - mov r1, r12 - muls r1, r0 - adds r0, r1, 0 - mov r1, r8 - ands r3, r1 - orrs r0, r3 - lsls r0, 2 - adds r1, r4, r0 - cmp r1, r6 - bge _08004034 - subs r0, r5, r2 - subs r1, r5, r1 - ldr r1, [r1] - str r1, [r0] - b _08004038 -_08004034: - subs r0, r5, r2 - str r7, [r0] -_08004038: - movs r2, 0x20 - negs r2, r2 - add r10, r2 - adds r4, 0x20 - cmp r4, r6 - bge _08004046 - b _08003EB6 -_08004046: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end Window_ScrollVertically - - thumb_func_start CallWindowFunction -CallWindowFunction: @ 8004058 - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0x8 - mov r8, r1 - lsls r0, 24 - lsrs r0, 24 - ldr r2, =0x02020004 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldr r5, [r1] - ldr r6, [r1, 0x4] - ldrb r0, [r1] - lsrs r1, r5, 8 - lsls r1, 24 - lsrs r1, 24 - lsrs r2, r5, 16 - lsls r2, 24 - lsrs r2, 24 - lsrs r3, r5, 24 - lsls r4, r6, 24 - lsrs r4, 24 - str r4, [sp] - lsrs r4, r6, 8 - lsls r4, 24 - lsrs r4, 24 - str r4, [sp, 0x4] - bl _call_via_r8 - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end CallWindowFunction - - thumb_func_start Window_SetField -Window_SetField: @ 80040A8 - push {lr} - lsls r0, 24 - lsrs r3, r0, 24 - lsls r1, 24 - lsrs r0, r1, 24 - cmp r0, 0x7 - bhi _08004142 - lsls r0, 2 - ldr r1, =_080040C4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 - .pool - .align 2, 0 -_080040C4: - .4byte _08004142 - .4byte _080040E4 - .4byte _080040F8 - .4byte _08004142 - .4byte _08004142 - .4byte _0800410C - .4byte _08004120 - .4byte _08004134 -_080040E4: - ldr r1, =0x02020004 - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - strb r2, [r0, 0x1] - movs r0, 0 - b _08004144 - .align 2, 0 - .pool -_080040F8: - ldr r1, =0x02020004 - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - strb r2, [r0, 0x2] - movs r0, 0 - b _08004144 - .align 2, 0 - .pool -_0800410C: - ldr r1, =0x02020004 - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - strb r2, [r0, 0x5] - movs r0, 0 - b _08004144 - .align 2, 0 - .pool -_08004120: - ldr r1, =0x02020004 - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - strh r2, [r0, 0x6] - movs r0, 0 - b _08004144 - .align 2, 0 - .pool -_08004134: - ldr r1, =0x02020004 - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r1, 0x8 - adds r0, r1 - str r2, [r0] -_08004142: - movs r0, 0x1 -_08004144: - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end Window_SetField - - thumb_func_start Window_GetField -Window_GetField: @ 800414C - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - lsls r1, 24 - lsrs r0, r1, 24 - cmp r0, 0x7 - bhi _08004228 - lsls r0, 2 - ldr r1, =_08004168 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 - .pool - .align 2, 0 -_08004168: - .4byte _08004188 - .4byte _0800419C - .4byte _080041B0 - .4byte _080041C4 - .4byte _080041D8 - .4byte _080041EC - .4byte _08004200 - .4byte _08004214 -_08004188: - ldr r0, =0x02020004 - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1] - b _0800422A - .align 2, 0 - .pool -_0800419C: - ldr r0, =0x02020004 - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1, 0x1] - b _0800422A - .align 2, 0 - .pool -_080041B0: - ldr r0, =0x02020004 - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1, 0x2] - b _0800422A - .align 2, 0 - .pool -_080041C4: - ldr r0, =0x02020004 - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1, 0x3] - b _0800422A - .align 2, 0 - .pool -_080041D8: - ldr r0, =0x02020004 - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1, 0x4] - b _0800422A - .align 2, 0 - .pool -_080041EC: - ldr r0, =0x02020004 - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1, 0x5] - b _0800422A - .align 2, 0 - .pool -_08004200: - ldr r0, =0x02020004 - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrh r0, [r1, 0x6] - b _0800422A - .align 2, 0 - .pool -_08004214: - ldr r0, =0x02020004 - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r0, 0x8 - adds r1, r0 - ldr r0, [r1] - b _0800422A - .align 2, 0 - .pool -_08004228: - movs r0, 0 -_0800422A: - pop {r1} - bx r1 - thumb_func_end Window_GetField - - thumb_func_start GetNumActiveWindowsOnBg -GetNumActiveWindowsOnBg: @ 8004230 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - movs r3, 0 - ldr r2, =0x02020004 - movs r1, 0x1F -_0800423C: - ldrb r0, [r2] - cmp r0, r4 - bne _08004248 - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 -_08004248: - adds r2, 0xC - subs r1, 0x1 - cmp r1, 0 - bge _0800423C - adds r0, r3, 0 - pop {r4} - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end GetNumActiveWindowsOnBg - - thumb_func_start nullsub_9 -nullsub_9: @ 800425C - bx lr - thumb_func_end nullsub_9 - - thumb_func_start Window_AddFromTemplate8Bpp -Window_AddFromTemplate8Bpp: @ 8004260 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - mov r9, r0 - movs r6, 0 - ldr r1, =0x02020004 - ldrb r0, [r1] - cmp r0, 0xFF - beq _0800428E -_08004276: - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0x1F - bhi _0800428E - lsls r0, r6, 1 - adds r0, r6 - lsls r0, 2 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0xFF - bne _08004276 -_0800428E: - cmp r6, 0x20 - beq _08004322 - mov r0, r9 - ldrb r7, [r0] - ldr r1, =0x03002f70 - mov r10, r1 - lsls r2, r7, 2 - mov r8, r2 - mov r0, r8 - add r0, r10 - ldr r0, [r0] - cmp r0, 0 - bne _080042EA - adds r0, r7, 0 - movs r1, 0x8 - bl bg_get_field - lsls r0, 16 - lsrs r5, r0, 16 - ldr r0, =0x0000ffff - cmp r5, r0 - beq _080042EA - adds r0, r5, 0 - bl malloc - adds r4, r0, 0 - cmp r4, 0 - beq _08004322 - movs r1, 0 - mov r12, r10 - mov r3, r8 - cmp r1, r5 - bge _080042DC - movs r2, 0 -_080042D2: - adds r0, r4, r1 - strb r2, [r0] - adds r1, 0x1 - cmp r1, r5 - blt _080042D2 -_080042DC: - mov r1, r12 - adds r0, r3, r1 - str r4, [r0] - adds r0, r7, 0 - adds r1, r4, 0 - bl bg_set_tilemap -_080042EA: - mov r2, r9 - ldrb r1, [r2, 0x3] - ldrb r0, [r2, 0x4] - muls r0, r1 - lsls r0, 22 - lsrs r0, 16 - bl malloc - adds r4, r0, 0 - cmp r4, 0 - bne _08004338 - adds r0, r7, 0 - bl GetNumActiveWindowsOnBgDuplicate - lsls r0, 24 - cmp r0, 0 - bne _08004322 - ldr r0, =0x03002f70 - lsls r1, r7, 2 - adds r5, r1, r0 - ldr r1, [r5] - ldr r0, =nullsub_9 + 1 - cmp r1, r0 - beq _08004322 - adds r0, r1, 0 - bl free - str r4, [r5] -_08004322: - movs r0, 0xFF - b _08004356 - .align 2, 0 - .pool -_08004338: - ldr r1, =0x02020004 - lsls r2, r6, 1 - adds r2, r6 - lsls r2, 2 - adds r0, r1, 0 - adds r0, 0x8 - adds r0, r2, r0 - str r4, [r0] - adds r2, r1 - mov r3, r9 - ldr r0, [r3] - ldr r1, [r3, 0x4] - str r0, [r2] - str r1, [r2, 0x4] - adds r0, r6, 0 -_08004356: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end Window_AddFromTemplate8Bpp - - thumb_func_start Window_FillPixels8Bpp -Window_FillPixels8Bpp: @ 8004368 - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r5, r1, 24 - ldr r6, =0x02020004 - lsls r1, r0, 1 - adds r1, r0 - lsls r4, r1, 2 - adds r0, r4, r6 - ldrb r1, [r0, 0x3] - ldrb r0, [r0, 0x4] - muls r0, r1 - lsls r0, 22 - lsrs r3, r0, 16 - movs r2, 0 - cmp r2, r3 - bge _0800439E - adds r0, r6, 0 - adds r0, 0x8 - adds r1, r4, r0 -_08004392: - ldr r0, [r1] - adds r0, r2 - strb r5, [r0] - adds r2, 0x1 - cmp r2, r3 - blt _08004392 -_0800439E: - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end Window_FillPixels8Bpp - - thumb_func_start Window_FillPixelRect8Bpp -Window_FillPixelRect8Bpp: @ 80043A8 - push {r4-r6,lr} - mov r6, r9 - mov r5, r8 - push {r5,r6} - sub sp, 0x10 - mov r9, r3 - ldr r3, [sp, 0x28] - ldr r4, [sp, 0x2C] - mov r8, r4 - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - lsls r2, 16 - lsrs r2, 16 - mov r4, r9 - lsls r4, 16 - lsrs r4, 16 - mov r9, r4 - lsls r3, 16 - lsrs r3, 16 - mov r4, r8 - lsls r4, 16 - lsrs r4, 16 - mov r8, r4 - ldr r5, =0x02020004 - lsls r4, r0, 1 - adds r4, r0 - lsls r4, 2 - adds r0, r5, 0 - adds r0, 0x8 - adds r0, r4, r0 - ldr r0, [r0] - str r0, [sp, 0x8] - adds r4, r5 - ldrb r0, [r4, 0x3] - lsls r0, 3 - ldr r6, =0xffff0000 - ldr r5, [sp, 0xC] - ands r5, r6 - orrs r5, r0 - str r5, [sp, 0xC] - ldrb r4, [r4, 0x4] - lsls r4, 19 - ldr r0, =0x0000ffff - ands r0, r5 - orrs r0, r4 - str r0, [sp, 0xC] - mov r0, r8 - str r0, [sp] - str r1, [sp, 0x4] - add r0, sp, 0x8 - adds r1, r2, 0 - mov r2, r9 - bl PixelBlock_FillRect8Bpp - add sp, 0x10 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end Window_FillPixelRect8Bpp - - thumb_func_start Window_CopyPixelRectToWindow4BppTo8Bpp -Window_CopyPixelRectToWindow4BppTo8Bpp: @ 8004434 - 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] - mov r8, r6 - ldr r7, [sp, 0x58] - mov r9, r7 - ldr r6, [sp, 0x5C] - mov r10, r6 - ldr r7, [sp, 0x60] - mov r12, r7 - ldr r6, [sp, 0x64] - lsls r0, 24 - lsrs r0, 24 - lsls r2, 16 - lsrs r2, 16 - lsls r3, 16 - lsrs r3, 16 - lsls r4, 16 - mov r7, r8 - lsls r7, 16 - lsrs r7, 16 - mov r8, r7 - mov r7, r9 - lsls r7, 16 - lsrs r7, 16 - mov r9, r7 - mov r7, r10 - lsls r7, 16 - lsrs r7, 16 - mov r10, r7 - mov r7, r12 - lsls r7, 16 - lsrs r7, 16 - mov r12, r7 - lsls r6, 24 - lsrs r6, 24 - str r6, [sp, 0x28] - str r1, [sp, 0x18] - lsls r5, 16 - ldr r6, =0x0000ffff - lsrs r4, 16 - orrs r4, r5 - str r4, [sp, 0x1C] - ldr r1, =0x02020004 - lsls r5, r0, 1 - adds r5, r0 - lsls r5, 2 - adds r0, r1, 0 - adds r0, 0x8 - adds r0, r5, r0 - ldr r0, [r0] - str r0, [sp, 0x20] - adds r5, r1 - ldrb r0, [r5, 0x3] - lsls r0, 3 - add r1, sp, 0x20 - ldr r4, [r1, 0x4] - ldr r7, =0xffff0000 - ands r4, r7 - orrs r4, r0 - str r4, [r1, 0x4] - ldrb r0, [r5, 0x4] - lsls r0, 19 - ands r6, r4 - orrs r6, r0 - str r6, [r1, 0x4] - mov r0, r8 - str r0, [sp] - mov r6, r9 - str r6, [sp, 0x4] - mov r7, r10 - str r7, [sp, 0x8] - mov r0, r12 - str r0, [sp, 0xC] - movs r0, 0 - str r0, [sp, 0x10] - ldr r6, [sp, 0x28] - str r6, [sp, 0x14] - add r0, sp, 0x18 - bl PixelBlock_CopyRect4BppTo8Bpp - add sp, 0x2C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end Window_CopyPixelRectToWindow4BppTo8Bpp - - thumb_func_start Window_CopyToVram8Bpp -Window_CopyToVram8Bpp: @ 8004500 - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r2, r1, 24 - adds r5, r2, 0 - ldr r6, =0x02020184 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - ldr r0, =0x02020004 - adds r3, r1, r0 - str r3, [r6] - ldr r4, =0x02020188 - ldrb r1, [r3, 0x3] - ldrb r0, [r3, 0x4] - muls r0, r1 - lsls r0, 6 - strh r0, [r4] - cmp r2, 0x2 - beq _0800454E - cmp r2, 0x2 - bgt _08004540 - cmp r2, 0x1 - beq _08004546 - b _08004570 - .align 2, 0 - .pool -_08004540: - cmp r5, 0x3 - beq _0800455C - b _08004570 -_08004546: - ldrb r0, [r3] - bl gpu_copy_wram_bg_tilemap_to_vram - b _08004570 -_0800454E: - ldrb r0, [r3] - ldr r1, [r3, 0x8] - ldrh r2, [r4] - ldrh r3, [r3, 0x6] - bl gpu_copy_bg_tile_pattern_data_to_vram - b _08004570 -_0800455C: - ldrb r0, [r3] - ldr r1, [r3, 0x8] - ldrh r2, [r4] - ldrh r3, [r3, 0x6] - bl gpu_copy_bg_tile_pattern_data_to_vram - ldr r0, [r6] - ldrb r0, [r0] - bl gpu_copy_wram_bg_tilemap_to_vram -_08004570: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end Window_CopyToVram8Bpp - - thumb_func_start GetNumActiveWindowsOnBgDuplicate -GetNumActiveWindowsOnBgDuplicate: @ 8004578 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - movs r3, 0 - ldr r2, =0x02020004 - movs r1, 0x1F -_08004584: - ldrb r0, [r2] - cmp r0, r4 - bne _08004590 - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 -_08004590: - adds r2, 0xC - subs r1, 0x1 - cmp r1, 0 - bge _08004584 - adds r0, r3, 0 - pop {r4} - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end GetNumActiveWindowsOnBgDuplicate - - thumb_func_start fboxes_set_ptr -fboxes_set_ptr: @ 80045A4 - ldr r1, =0x03002f80 - str r0, [r1] - bx lr - .align 2, 0 - .pool - thumb_func_end fboxes_set_ptr - - thumb_func_start TextBox_ResetSomeField -TextBox_ResetSomeField: @ 80045B0 - push {lr} - ldr r1, =0x020201b0 - movs r2, 0 - ldr r3, =0x0000045c - adds r0, r1, r3 -_080045BA: - strb r2, [r0, 0x1B] - subs r0, 0x24 - cmp r0, r1 - bge _080045BA - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end TextBox_ResetSomeField - - thumb_func_start Print -Print: @ 80045D0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x10 - ldr r4, [sp, 0x28] - ldr r5, [sp, 0x2C] - ldr r7, [sp, 0x30] - lsls r1, 24 - lsrs r1, 24 - lsls r3, 24 - lsrs r3, 24 - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - mov r8, r5 - str r2, [sp] - mov r2, sp - strb r0, [r2, 0x4] - mov r0, sp - strb r1, [r0, 0x5] - strb r3, [r0, 0x6] - strb r4, [r0, 0x7] - strb r3, [r0, 0x8] - strb r4, [r0, 0x9] - ldr r0, =0x03002f80 - ldr r0, [r0] - lsls r3, r1, 1 - adds r3, r1 - lsls r3, 2 - adds r3, r0 - ldrb r0, [r3, 0x6] - strb r0, [r2, 0xA] - mov r1, sp - ldrb r0, [r3, 0x7] - strb r0, [r1, 0xB] - mov r5, sp - ldrb r1, [r3, 0x8] - lsls r1, 28 - movs r6, 0xF - lsrs r1, 28 - ldrb r4, [r5, 0xC] - movs r2, 0x10 - negs r2, r2 - adds r0, r2, 0 - ands r0, r4 - orrs r0, r1 - strb r0, [r5, 0xC] - mov r4, sp - ldrb r1, [r3, 0x8] - lsrs r1, 4 - lsls r1, 4 - ands r0, r6 - orrs r0, r1 - strb r0, [r4, 0xC] - ldrb r0, [r3, 0x9] - lsls r0, 28 - lsrs r0, 28 - adds r1, r6, 0 - ands r1, r0 - ldrb r0, [r4, 0xD] - ands r2, r0 - orrs r2, r1 - strb r2, [r4, 0xD] - mov r1, sp - ldrb r0, [r3, 0x9] - lsrs r0, 4 - lsls r0, 4 - ands r2, r6 - orrs r2, r0 - strb r2, [r1, 0xD] - mov r0, sp - mov r1, r8 - adds r2, r7, 0 - bl remo_copy - lsls r0, 16 - lsrs r0, 16 - add sp, 0x10 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end Print - - thumb_func_start remo_copy -remo_copy: @ 800467C - push {r4-r7,lr} - adds r6, r0, 0 - mov r12, r2 - lsls r1, 24 - lsrs r5, r1, 24 - ldr r0, =0x03002f80 - ldr r0, [r0] - cmp r0, 0 - bne _08004698 - movs r0, 0 - b _08004766 - .align 2, 0 - .pool -_08004698: - ldr r0, =0x0202018c - movs r2, 0 - movs r1, 0x1 - strb r1, [r0, 0x1B] - strb r2, [r0, 0x1C] - strb r5, [r0, 0x1D] - strb r2, [r0, 0x1E] - strb r2, [r0, 0x1F] - adds r4, r0, 0 - movs r1, 0x6 - adds r0, 0x1A -_080046AE: - strb r2, [r0] - subs r0, 0x1 - subs r1, 0x1 - cmp r1, 0 - bge _080046AE - adds r1, r4, 0 - adds r0, r6, 0 - ldm r0!, {r2,r3,r7} - stm r1!, {r2,r3,r7} - ldr r0, [r0] - str r0, [r1] - mov r0, r12 - str r0, [r4, 0x10] - adds r0, r4, 0 - adds r0, 0x20 - movs r1, 0 - strb r1, [r0] - adds r0, 0x1 - strb r1, [r0] - ldrb r0, [r6, 0xC] - lsrs r0, 4 - ldrb r2, [r6, 0xD] - lsls r1, r2, 28 - lsrs r1, 28 - lsrs r2, 4 - bl GenerateFontHalfRowLut - cmp r5, 0xFF - beq _08004718 - cmp r5, 0 - beq _08004718 - ldrb r0, [r4, 0x1D] - subs r0, 0x1 - strb r0, [r4, 0x1D] - ldr r2, =0x020201b0 - ldrb r0, [r6, 0x4] - lsls r1, r0, 3 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - adds r0, r4, 0 - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - ldm r0!, {r2,r3,r7} - stm r1!, {r2,r3,r7} - ldm r0!, {r2,r4,r7} - stm r1!, {r2,r4,r7} - b _0800475E - .align 2, 0 - .pool -_08004718: - ldr r1, =0x0202018c - movs r0, 0 - strb r0, [r1, 0x1D] - movs r4, 0 - ldr r7, =0x000003ff - b _08004732 - .align 2, 0 - .pool -_0800472C: - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 -_08004732: - cmp r4, r7 - bhi _08004740 - ldr r0, =0x0202018c - bl fbox_exec - cmp r0, 0x1 - bne _0800472C -_08004740: - cmp r5, 0xFF - beq _0800474E - ldr r0, =0x0202018c - ldrb r0, [r0, 0x4] - movs r1, 0x2 - bl Window_CopyToVram -_0800474E: - ldr r2, =0x020201b0 - ldrb r1, [r6, 0x4] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0 - strb r1, [r0, 0x1B] -_0800475E: - ldr r1, =0x03002f84 - movs r0, 0 - strb r0, [r1] - movs r0, 0x1 -_08004766: - pop {r4-r7} - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end remo_copy - - thumb_func_start run_remoboxes -run_remoboxes: @ 8004778 - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r0, =0x03002f84 - ldrb r0, [r0] - cmp r0, 0 - bne _080047F6 - ldr r0, =0x020201b0 - movs r6, 0 - adds r5, r0, 0x4 - mov r8, r0 - movs r7, 0x1F -_08004790: - ldrb r0, [r5, 0x17] - cmp r0, 0 - beq _080047E8 - mov r0, r8 - bl fbox_exec - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0x1 - beq _080047E4 - cmp r4, 0x1 - bgt _080047B8 - cmp r4, 0 - beq _080047BE - b _080047E8 - .align 2, 0 - .pool -_080047B8: - cmp r4, 0x3 - beq _080047C6 - b _080047E8 -_080047BE: - ldrb r0, [r5] - movs r1, 0x2 - bl Window_CopyToVram -_080047C6: - ldr r1, =0x020201b0 - adds r0, r1, 0 - adds r0, 0x10 - adds r0, r6, r0 - ldr r2, [r0] - cmp r2, 0 - beq _080047E8 - adds r0, r6, r1 - adds r1, r4, 0 - bl _call_via_r2 - b _080047E8 - .align 2, 0 - .pool -_080047E4: - movs r0, 0 - strb r0, [r5, 0x17] -_080047E8: - adds r6, 0x24 - adds r5, 0x24 - movs r0, 0x24 - add r8, r0 - subs r7, 0x1 - cmp r7, 0 - bge _08004790 -_080047F6: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end run_remoboxes - - thumb_func_start a_pressed_maybe -a_pressed_maybe: @ 8004800 - lsls r0, 24 - lsrs r0, 24 - ldr r2, =0x020201b0 - lsls r1, r0, 3 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r0, [r1, 0x1B] - bx lr - .align 2, 0 - .pool - thumb_func_end a_pressed_maybe - - thumb_func_start fbox_exec -fbox_exec: @ 8004818 - push {r4,lr} - adds r4, r0, 0 -_0800481C: - ldrb r1, [r4, 0x5] - ldr r0, =0x03002f80 - ldr r2, [r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x2 - beq _0800481C - pop {r4} - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end fbox_exec - - thumb_func_start GenerateFontHalfRowLut -GenerateFontHalfRowLut: @ 8004844 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x24 - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - lsls r2, 24 - lsrs r2, 24 - ldr r3, =0x03000948 - ldr r4, =0x030009ea - strh r1, [r4] - ldr r4, =0x030009ec - strh r0, [r4] - ldr r4, =0x030009ee - strh r2, [r4] - lsls r5, r1, 12 - lsls r6, r0, 12 - lsls r4, r2, 12 - mov r8, r4 - lsls r7, r1, 8 - str r7, [sp] - lsls r4, r1, 4 - mov r9, r4 - orrs r7, r4 - str r7, [sp, 0x4] - orrs r7, r1 - adds r4, r5, 0 - orrs r4, r7 - strh r4, [r3] - adds r3, 0x2 - adds r4, r6, 0 - orrs r4, r7 - strh r4, [r3] - adds r3, 0x2 - mov r4, r8 - orrs r7, r4 - strh r7, [r3] - adds r3, 0x2 - lsls r7, r0, 8 - mov r10, r7 - mov r4, r10 - mov r7, r9 - orrs r4, r7 - str r4, [sp, 0x8] - adds r7, r4, 0 - orrs r7, r1 - adds r4, r5, 0 - orrs r4, r7 - strh r4, [r3] - adds r3, 0x2 - adds r4, r6, 0 - orrs r4, r7 - strh r4, [r3] - adds r3, 0x2 - mov r4, r8 - orrs r7, r4 - strh r7, [r3] - adds r3, 0x2 - lsls r7, r2, 8 - mov r12, r7 - mov r4, r12 - mov r7, r9 - orrs r4, r7 - str r4, [sp, 0xC] - adds r7, r4, 0 - orrs r7, r1 - adds r4, r5, 0 - orrs r4, r7 - strh r4, [r3] - adds r3, 0x2 - adds r4, r6, 0 - orrs r4, r7 - strh r4, [r3] - adds r3, 0x2 - mov r4, r8 - orrs r7, r4 - strh r7, [r3] - adds r3, 0x2 - lsls r7, r0, 4 - mov r9, r7 - ldr r4, [sp] - orrs r4, r7 - str r4, [sp, 0x10] - adds r7, r4, 0 - orrs r7, r1 - adds r4, r5, 0 - orrs r4, r7 - strh r4, [r3] - adds r3, 0x2 - adds r4, r6, 0 - orrs r4, r7 - strh r4, [r3] - adds r3, 0x2 - mov r4, r8 - orrs r7, r4 - strh r7, [r3] - adds r3, 0x2 - mov r7, r10 - adds r4, r7, 0 - mov r7, r9 - orrs r4, r7 - str r4, [sp, 0x14] - adds r7, r4, 0 - orrs r7, r1 - adds r4, r5, 0 - orrs r4, r7 - strh r4, [r3] - adds r3, 0x2 - adds r4, r6, 0 - orrs r4, r7 - strh r4, [r3] - adds r3, 0x2 - mov r4, r8 - orrs r7, r4 - strh r7, [r3] - adds r3, 0x2 - mov r7, r12 - adds r4, r7, 0 - mov r7, r9 - orrs r4, r7 - str r4, [sp, 0x18] - adds r7, r4, 0 - orrs r7, r1 - adds r4, r5, 0 - orrs r4, r7 - strh r4, [r3] - adds r3, 0x2 - adds r4, r6, 0 - orrs r4, r7 - strh r4, [r3] - adds r3, 0x2 - mov r4, r8 - orrs r7, r4 - strh r7, [r3] - adds r3, 0x2 - lsls r7, r2, 4 - mov r9, r7 - mov r4, r9 - ldr r7, [sp] - orrs r7, r4 - str r7, [sp, 0x1C] - orrs r7, r1 - adds r4, r5, 0 - orrs r4, r7 - strh r4, [r3] - adds r3, 0x2 - adds r4, r6, 0 - orrs r4, r7 - strh r4, [r3] - adds r3, 0x2 - mov r4, r8 - orrs r7, r4 - strh r7, [r3] - adds r3, 0x2 - mov r7, r9 - mov r4, r10 - orrs r4, r7 - str r4, [sp, 0x20] - adds r7, r4, 0 - orrs r7, r1 - adds r4, r5, 0 - orrs r4, r7 - strh r4, [r3] - adds r3, 0x2 - adds r4, r6, 0 - orrs r4, r7 - strh r4, [r3] - adds r3, 0x2 - mov r4, r8 - orrs r7, r4 - strh r7, [r3] - adds r3, 0x2 - mov r4, r12 - mov r7, r9 - orrs r4, r7 - adds r7, r4, 0 - orrs r7, r1 - adds r1, r5, 0 - orrs r1, r7 - strh r1, [r3] - adds r3, 0x2 - adds r1, r6, 0 - orrs r1, r7 - strh r1, [r3] - adds r3, 0x2 - mov r1, r8 - orrs r7, r1 - strh r7, [r3] - adds r3, 0x2 - ldr r7, [sp, 0x4] - orrs r7, r0 - adds r1, r5, 0 - orrs r1, r7 - strh r1, [r3] - adds r3, 0x2 - adds r1, r6, 0 - orrs r1, r7 - strh r1, [r3] - adds r3, 0x2 - mov r1, r8 - orrs r7, r1 - strh r7, [r3] - adds r3, 0x2 - ldr r7, [sp, 0x8] - orrs r7, r0 - adds r1, r5, 0 - orrs r1, r7 - strh r1, [r3] - adds r3, 0x2 - adds r1, r6, 0 - orrs r1, r7 - strh r1, [r3] - adds r3, 0x2 - mov r1, r8 - orrs r7, r1 - strh r7, [r3] - adds r3, 0x2 - ldr r7, [sp, 0xC] - orrs r7, r0 - adds r1, r5, 0 - orrs r1, r7 - strh r1, [r3] - adds r3, 0x2 - adds r1, r6, 0 - orrs r1, r7 - strh r1, [r3] - adds r3, 0x2 - mov r1, r8 - orrs r7, r1 - strh r7, [r3] - adds r3, 0x2 - ldr r7, [sp, 0x10] - orrs r7, r0 - adds r1, r5, 0 - orrs r1, r7 - strh r1, [r3] - adds r3, 0x2 - adds r1, r6, 0 - orrs r1, r7 - strh r1, [r3] - adds r3, 0x2 - mov r1, r8 - orrs r7, r1 - strh r7, [r3] - adds r3, 0x2 - ldr r7, [sp, 0x14] - orrs r7, r0 - adds r1, r5, 0 - orrs r1, r7 - strh r1, [r3] - adds r3, 0x2 - adds r1, r6, 0 - orrs r1, r7 - strh r1, [r3] - adds r3, 0x2 - mov r1, r8 - orrs r7, r1 - strh r7, [r3] - adds r3, 0x2 - ldr r7, [sp, 0x18] - orrs r7, r0 - adds r1, r5, 0 - orrs r1, r7 - strh r1, [r3] - adds r3, 0x2 - adds r1, r6, 0 - orrs r1, r7 - strh r1, [r3] - adds r3, 0x2 - mov r1, r8 - orrs r7, r1 - strh r7, [r3] - adds r3, 0x2 - ldr r7, [sp, 0x1C] - orrs r7, r0 - adds r1, r5, 0 - orrs r1, r7 - strh r1, [r3] - adds r3, 0x2 - adds r1, r6, 0 - orrs r1, r7 - strh r1, [r3] - adds r3, 0x2 - mov r1, r8 - orrs r7, r1 - strh r7, [r3] - adds r3, 0x2 - ldr r7, [sp, 0x20] - orrs r7, r0 - adds r1, r5, 0 - orrs r1, r7 - strh r1, [r3] - adds r3, 0x2 - adds r1, r6, 0 - orrs r1, r7 - strh r1, [r3] - adds r3, 0x2 - mov r1, r8 - orrs r7, r1 - strh r7, [r3] - adds r3, 0x2 - adds r7, r4, 0 - orrs r7, r0 - adds r0, r5, 0 - orrs r0, r7 - strh r0, [r3] - adds r3, 0x2 - adds r0, r6, 0 - orrs r0, r7 - strh r0, [r3] - adds r3, 0x2 - orrs r7, r1 - strh r7, [r3] - adds r3, 0x2 - adds r7, r2, 0 - ldr r0, [sp, 0x4] - orrs r7, r0 - adds r0, r5, 0 - orrs r0, r7 - strh r0, [r3] - adds r3, 0x2 - adds r0, r6, 0 - orrs r0, r7 - strh r0, [r3] - adds r3, 0x2 - orrs r7, r1 - strh r7, [r3] - adds r3, 0x2 - adds r7, r2, 0 - ldr r1, [sp, 0x8] - orrs r7, r1 - adds r0, r5, 0 - orrs r0, r7 - strh r0, [r3] - adds r3, 0x2 - adds r0, r6, 0 - orrs r0, r7 - strh r0, [r3] - adds r3, 0x2 - mov r0, r8 - orrs r7, r0 - strh r7, [r3] - adds r3, 0x2 - adds r7, r2, 0 - ldr r1, [sp, 0xC] - orrs r7, r1 - adds r0, r5, 0 - orrs r0, r7 - strh r0, [r3] - adds r3, 0x2 - adds r0, r6, 0 - orrs r0, r7 - strh r0, [r3] - adds r3, 0x2 - mov r0, r8 - orrs r7, r0 - strh r7, [r3] - adds r3, 0x2 - adds r7, r2, 0 - ldr r1, [sp, 0x10] - orrs r7, r1 - adds r0, r5, 0 - orrs r0, r7 - strh r0, [r3] - adds r3, 0x2 - adds r0, r6, 0 - orrs r0, r7 - strh r0, [r3] - adds r3, 0x2 - mov r0, r8 - orrs r7, r0 - strh r7, [r3] - adds r3, 0x2 - adds r7, r2, 0 - ldr r1, [sp, 0x14] - orrs r7, r1 - adds r0, r5, 0 - orrs r0, r7 - strh r0, [r3] - adds r3, 0x2 - adds r0, r6, 0 - orrs r0, r7 - strh r0, [r3] - adds r3, 0x2 - mov r0, r8 - orrs r7, r0 - strh r7, [r3] - adds r3, 0x2 - adds r7, r2, 0 - ldr r1, [sp, 0x18] - orrs r7, r1 - adds r0, r5, 0 - orrs r0, r7 - strh r0, [r3] - adds r3, 0x2 - adds r0, r6, 0 - orrs r0, r7 - strh r0, [r3] - adds r3, 0x2 - mov r0, r8 - orrs r7, r0 - strh r7, [r3] - adds r3, 0x2 - adds r7, r2, 0 - ldr r1, [sp, 0x1C] - orrs r7, r1 - adds r0, r5, 0 - orrs r0, r7 - strh r0, [r3] - adds r3, 0x2 - adds r0, r6, 0 - orrs r0, r7 - strh r0, [r3] - adds r3, 0x2 - mov r0, r8 - orrs r7, r0 - strh r7, [r3] - adds r3, 0x2 - adds r7, r2, 0 - ldr r1, [sp, 0x20] - orrs r7, r1 - adds r0, r5, 0 - orrs r0, r7 - strh r0, [r3] - adds r3, 0x2 - adds r0, r6, 0 - orrs r0, r7 - strh r0, [r3] - adds r3, 0x2 - mov r0, r8 - orrs r7, r0 - strh r7, [r3] - adds r3, 0x2 - adds r7, r2, 0 - orrs r7, r4 - orrs r5, r7 - strh r5, [r3] - adds r3, 0x2 - orrs r6, r7 - strh r6, [r3] - orrs r0, r7 - strh r0, [r3, 0x2] - add sp, 0x24 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end GenerateFontHalfRowLut - - thumb_func_start save_remo_colors -save_remo_colors: @ 8004BE0 - ldr r3, =0x030009ea - ldrh r3, [r3] - strb r3, [r1] - ldr r1, =0x030009ec - ldrh r1, [r1] - strb r1, [r0] - ldr r0, =0x030009ee - ldrh r0, [r0] - strb r0, [r2] - bx lr - .align 2, 0 - .pool - thumb_func_end save_remo_colors - - thumb_func_start restore_remo_colors -restore_remo_colors: @ 8004C00 - push {lr} - ldrb r0, [r0] - ldrb r1, [r1] - ldrb r2, [r2] - bl GenerateFontHalfRowLut - pop {r0} - bx r0 - thumb_func_end restore_remo_colors - - thumb_func_start font_render_sub -font_render_sub: @ 8004C10 - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldrh r7, [r0] - ldr r5, =0x03000948 - ldr r4, =0x082e958c - movs r2, 0xFF - mov r8, r2 - adds r2, r7, 0 - mov r3, r8 - ands r2, r3 - adds r2, r4 - ldrb r2, [r2] - lsls r2, 1 - adds r2, r5 - ldrh r3, [r2] - lsls r3, 16 - lsrs r2, r7, 8 - adds r2, r4 - ldrb r2, [r2] - lsls r2, 1 - adds r2, r5 - ldrh r2, [r2] - orrs r3, r2 - adds r6, r1, 0 - stm r6!, {r3} - ldrh r7, [r0, 0x2] - adds r0, 0x4 - adds r2, r7, 0 - mov r3, r8 - ands r2, r3 - adds r2, r4 - ldrb r2, [r2] - lsls r2, 1 - adds r2, r5 - ldrh r3, [r2] - lsls r3, 16 - lsrs r2, r7, 8 - adds r2, r4 - ldrb r2, [r2] - lsls r2, 1 - adds r2, r5 - ldrh r2, [r2] - orrs r3, r2 - str r3, [r1, 0x4] - adds r6, 0x4 - ldrh r7, [r0] - adds r0, 0x2 - adds r1, r7, 0 - mov r2, r8 - ands r1, r2 - adds r1, r4 - ldrb r1, [r1] - lsls r1, 1 - adds r1, r5 - ldrh r2, [r1] - lsls r2, 16 - lsrs r1, r7, 8 - adds r1, r4 - ldrb r1, [r1] - lsls r1, 1 - adds r1, r5 - ldrh r1, [r1] - orrs r2, r1 - stm r6!, {r2} - ldrh r7, [r0] - adds r0, 0x2 - adds r1, r7, 0 - mov r3, r8 - ands r1, r3 - adds r1, r4 - ldrb r1, [r1] - lsls r1, 1 - adds r1, r5 - ldrh r2, [r1] - lsls r2, 16 - lsrs r1, r7, 8 - adds r1, r4 - ldrb r1, [r1] - lsls r1, 1 - adds r1, r5 - ldrh r1, [r1] - orrs r2, r1 - stm r6!, {r2} - ldrh r7, [r0] - adds r0, 0x2 - adds r1, r7, 0 - ands r1, r3 - adds r1, r4 - ldrb r1, [r1] - lsls r1, 1 - adds r1, r5 - ldrh r2, [r1] - lsls r2, 16 - lsrs r1, r7, 8 - adds r1, r4 - ldrb r1, [r1] - lsls r1, 1 - adds r1, r5 - ldrh r1, [r1] - orrs r2, r1 - stm r6!, {r2} - ldrh r7, [r0] - adds r0, 0x2 - adds r1, r7, 0 - ands r1, r3 - adds r1, r4 - ldrb r1, [r1] - lsls r1, 1 - adds r1, r5 - ldrh r2, [r1] - lsls r2, 16 - lsrs r1, r7, 8 - adds r1, r4 - ldrb r1, [r1] - lsls r1, 1 - adds r1, r5 - ldrh r1, [r1] - orrs r2, r1 - stm r6!, {r2} - ldrh r7, [r0] - adds r1, r7, 0 - ands r1, r3 - adds r1, r4 - ldrb r1, [r1] - lsls r1, 1 - adds r1, r5 - ldrh r2, [r1] - lsls r2, 16 - lsrs r1, r7, 8 - adds r1, r4 - ldrb r1, [r1] - lsls r1, 1 - adds r1, r5 - ldrh r1, [r1] - orrs r2, r1 - stm r6!, {r2} - ldrh r7, [r0, 0x2] - adds r0, r7, 0 - ands r0, r3 - adds r0, r4 - ldrb r0, [r0] - lsls r0, 1 - adds r0, r5 - ldrh r1, [r0] - lsls r1, 16 - lsrs r0, r7, 8 - adds r0, r4 - ldrb r0, [r0] - lsls r0, 1 - adds r0, r5 - ldrh r0, [r0] - orrs r1, r0 - str r1, [r6] - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end font_render_sub - - thumb_func_start sub_8004D58 -sub_8004D58: @ 8004D58 - push {lr} - lsls r0, 24 - lsrs r0, 24 - adds r1, r0, 0 - cmp r0, 0x1 - beq _08004D8C - cmp r0, 0x1 - bgt _08004D6E - cmp r0, 0 - beq _08004D74 - b _08004D98 -_08004D6E: - cmp r1, 0x2 - beq _08004D80 - b _08004D98 -_08004D74: - ldr r0, =0x030009ec - ldrb r0, [r0] - b _08004D9A - .align 2, 0 - .pool -_08004D80: - ldr r0, =0x030009ea - ldrb r0, [r0] - b _08004D9A - .align 2, 0 - .pool -_08004D8C: - ldr r0, =0x030009ee - ldrb r0, [r0] - b _08004D9A - .align 2, 0 - .pool -_08004D98: - movs r0, 0 -_08004D9A: - pop {r1} - bx r1 - thumb_func_end sub_8004D58 - - thumb_func_start CopyGlyphToWindow -CopyGlyphToWindow: @ 8004DA0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8C - adds r3, r0, 0 - ldrb r1, [r3, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - ldr r1, =0x02020004 - adds r1, r0, r1 - adds r2, r1, 0 - ldrb r7, [r1, 0x3] - lsls r0, r7, 3 - ldrb r6, [r3, 0x8] - subs r4, r0, r6 - ldr r5, =0x03002f90 - adds r0, r5, 0 - adds r0, 0x80 - ldrb r0, [r0] - cmp r4, r0 - ble _08004DD2 - adds r4, r0, 0 -_08004DD2: - ldrb r0, [r1, 0x4] - lsls r0, 3 - ldrb r3, [r3, 0x9] - subs r0, r3 - adds r1, r5, 0 - adds r1, 0x81 - ldrb r1, [r1] - cmp r0, r1 - ble _08004DE6 - adds r0, r1, 0 -_08004DE6: - str r6, [sp] - mov r8, r3 - adds r3, r5, 0 - ldr r2, [r2, 0x8] - mov r9, r2 - lsls r1, r7, 5 - str r1, [sp, 0x4] - cmp r4, 0x8 - ble _08004DFA - b _08004F94 -_08004DFA: - cmp r0, 0x8 - bgt _08004E84 - mov r1, r8 - str r3, [sp, 0x8] - adds r2, r6, 0 - adds r2, r4 - mov r8, r2 - adds r0, r1, r0 - str r0, [sp, 0xC] - str r6, [sp, 0x10] - cmp r1, r0 - bcc _08004E14 - b _080052AA -_08004E14: - ldr r3, [sp, 0x8] - ldm r3!, {r5} - str r3, [sp, 0x8] - ldr r4, [sp, 0x10] - adds r0, r1, 0x1 - mov r10, r0 - cmp r4, r8 - bcs _08004E72 - movs r2, 0x7 - mov r12, r2 - lsrs r0, r1, 3 - ldr r2, [sp, 0x4] - adds r3, r0, 0 - muls r3, r2 - adds r7, r3, 0 - mov r3, r12 - ands r1, r3 - lsls r6, r1, 2 -_08004E38: - adds r3, r5, 0 - movs r0, 0xF - ands r3, r0 - cmp r3, 0 - beq _08004E6A - lsrs r2, r4, 3 - lsls r2, 5 - add r2, r9 - adds r0, r4, 0 - mov r1, r12 - ands r0, r1 - lsrs r0, 1 - adds r2, r0 - adds r2, r7 - adds r2, r6 - movs r1, 0x1 - ands r1, r4 - lsls r1, 2 - lsls r3, r1 - movs r0, 0xF0 - asrs r0, r1 - ldrb r1, [r2] - ands r0, r1 - orrs r3, r0 - strb r3, [r2] -_08004E6A: - lsrs r5, 4 - adds r4, 0x1 - cmp r4, r8 - bcc _08004E38 -_08004E72: - mov r1, r10 - ldr r2, [sp, 0xC] - cmp r1, r2 - bcc _08004E14 - b _080052AA - .align 2, 0 - .pool -_08004E84: - mov r1, r8 - str r3, [sp, 0x14] - ldr r3, [sp] - adds r3, r4 - mov r12, r3 - adds r2, r1, 0 - adds r2, 0x8 - str r2, [sp, 0x18] - ldr r3, [sp] - str r3, [sp, 0x1C] - mov r2, r12 - str r2, [sp, 0x74] - ldr r3, [sp, 0x18] - str r3, [sp, 0x88] - subs r0, 0x8 - str r0, [sp, 0x80] - cmp r1, r3 - bcs _08004F0E -_08004EA8: - ldr r0, [sp, 0x14] - ldm r0!, {r5} - str r0, [sp, 0x14] - ldr r4, [sp, 0x1C] - adds r2, r1, 0x1 - mov r8, r2 - cmp r4, r12 - bcs _08004F06 - movs r3, 0x7 - mov r10, r3 - lsrs r0, r1, 3 - ldr r3, [sp, 0x4] - adds r2, r0, 0 - muls r2, r3 - adds r7, r2, 0 - mov r0, r10 - ands r1, r0 - lsls r6, r1, 2 -_08004ECC: - adds r3, r5, 0 - movs r1, 0xF - ands r3, r1 - cmp r3, 0 - beq _08004EFE - lsrs r2, r4, 3 - lsls r2, 5 - add r2, r9 - adds r0, r4, 0 - mov r1, r10 - ands r0, r1 - lsrs r0, 1 - adds r2, r0 - adds r2, r7 - adds r2, r6 - movs r1, 0x1 - ands r1, r4 - lsls r1, 2 - lsls r3, r1 - movs r0, 0xF0 - asrs r0, r1 - ldrb r1, [r2] - ands r0, r1 - orrs r3, r0 - strb r3, [r2] -_08004EFE: - lsrs r5, 4 - adds r4, 0x1 - cmp r4, r12 - bcc _08004ECC -_08004F06: - mov r1, r8 - ldr r2, [sp, 0x18] - cmp r1, r2 - bcc _08004EA8 -_08004F0E: - ldr r1, [sp, 0x88] - ldr r3, =0x03002fd0 - str r3, [sp, 0x20] - ldr r0, [sp, 0x74] - mov r8, r0 - ldr r2, [sp, 0x80] - adds r2, r1, r2 - str r2, [sp, 0x24] - ldr r3, [sp] - str r3, [sp, 0x28] - cmp r1, r2 - bcc _08004F28 - b _080052AA -_08004F28: - ldr r0, [sp, 0x20] - ldm r0!, {r5} - str r0, [sp, 0x20] - ldr r4, [sp, 0x28] - adds r2, r1, 0x1 - mov r10, r2 - cmp r4, r8 - bcs _08004F86 - movs r3, 0x7 - mov r12, r3 - lsrs r0, r1, 3 - ldr r3, [sp, 0x4] - adds r2, r0, 0 - muls r2, r3 - adds r7, r2, 0 - mov r0, r12 - ands r1, r0 - lsls r6, r1, 2 -_08004F4C: - adds r3, r5, 0 - movs r1, 0xF - ands r3, r1 - cmp r3, 0 - beq _08004F7E - lsrs r2, r4, 3 - lsls r2, 5 - add r2, r9 - adds r0, r4, 0 - mov r1, r12 - ands r0, r1 - lsrs r0, 1 - adds r2, r0 - adds r2, r7 - adds r2, r6 - movs r1, 0x1 - ands r1, r4 - lsls r1, 2 - lsls r3, r1 - movs r0, 0xF0 - asrs r0, r1 - ldrb r1, [r2] - ands r0, r1 - orrs r3, r0 - strb r3, [r2] -_08004F7E: - lsrs r5, 4 - adds r4, 0x1 - cmp r4, r8 - bcc _08004F4C -_08004F86: - mov r1, r10 - ldr r2, [sp, 0x24] - cmp r1, r2 - bcc _08004F28 - b _080052AA - .align 2, 0 - .pool -_08004F94: - cmp r0, 0x8 - ble _08004F9A - b _080050A4 -_08004F9A: - mov r1, r8 - str r3, [sp, 0x2C] - ldr r3, [sp] - adds r3, 0x8 - mov r12, r3 - add r0, r8 - str r0, [sp, 0x30] - ldr r0, [sp] - str r0, [sp, 0x34] - ldr r2, [sp, 0x30] - str r2, [sp, 0x78] - str r3, [sp, 0x84] - subs r4, 0x8 - str r4, [sp, 0x7C] - cmp r8, r2 - bcs _0800501C -_08004FBA: - ldr r0, [sp, 0x2C] - ldm r0!, {r5} - str r0, [sp, 0x2C] - ldr r4, [sp, 0x34] - adds r2, r1, 0x1 - mov r10, r2 - cmp r4, r12 - bcs _08005014 - lsrs r0, r1, 3 - ldr r2, [sp, 0x4] - adds r3, r0, 0 - muls r3, r2 - adds r7, r3, 0 - movs r3, 0x7 - ands r1, r3 - lsls r6, r1, 2 -_08004FDA: - adds r3, r5, 0 - movs r0, 0xF - ands r3, r0 - cmp r3, 0 - beq _0800500C - lsrs r2, r4, 3 - lsls r2, 5 - add r2, r9 - adds r0, r4, 0 - movs r1, 0x7 - ands r0, r1 - lsrs r0, 1 - adds r2, r0 - adds r2, r7 - adds r2, r6 - movs r1, 0x1 - ands r1, r4 - lsls r1, 2 - lsls r3, r1 - movs r0, 0xF0 - asrs r0, r1 - ldrb r1, [r2] - ands r0, r1 - orrs r3, r0 - strb r3, [r2] -_0800500C: - lsrs r5, 4 - adds r4, 0x1 - cmp r4, r12 - bcc _08004FDA -_08005014: - mov r1, r10 - ldr r2, [sp, 0x30] - cmp r1, r2 - bcc _08004FBA -_0800501C: - mov r1, r8 - ldr r3, =0x03002fb0 - str r3, [sp, 0x38] - ldr r0, [sp, 0x84] - ldr r2, [sp, 0x7C] - adds r0, r2 - mov r8, r0 - ldr r3, [sp, 0x78] - str r3, [sp, 0x3C] - ldr r0, [sp, 0x84] - str r0, [sp, 0x40] - cmp r1, r3 - bcc _08005038 - b _080052AA -_08005038: - ldr r2, [sp, 0x38] - ldm r2!, {r5} - str r2, [sp, 0x38] - ldr r4, [sp, 0x40] - adds r3, r1, 0x1 - mov r10, r3 - cmp r4, r8 - bcs _08005096 - movs r0, 0x7 - mov r12, r0 - lsrs r0, r1, 3 - ldr r3, [sp, 0x4] - adds r2, r0, 0 - muls r2, r3 - adds r7, r2, 0 - mov r0, r12 - ands r1, r0 - lsls r6, r1, 2 -_0800505C: - adds r3, r5, 0 - movs r1, 0xF - ands r3, r1 - cmp r3, 0 - beq _0800508E - lsrs r2, r4, 3 - lsls r2, 5 - add r2, r9 - adds r0, r4, 0 - mov r1, r12 - ands r0, r1 - lsrs r0, 1 - adds r2, r0 - adds r2, r7 - adds r2, r6 - movs r1, 0x1 - ands r1, r4 - lsls r1, 2 - lsls r3, r1 - movs r0, 0xF0 - asrs r0, r1 - ldrb r1, [r2] - ands r0, r1 - orrs r3, r0 - strb r3, [r2] -_0800508E: - lsrs r5, 4 - adds r4, 0x1 - cmp r4, r8 - bcc _0800505C -_08005096: - mov r1, r10 - ldr r2, [sp, 0x3C] - cmp r1, r2 - bcc _08005038 - b _080052AA - .align 2, 0 - .pool -_080050A4: - mov r1, r8 - str r5, [sp, 0x44] - ldr r3, [sp] - adds r3, 0x8 - mov r12, r3 - mov r2, r8 - adds r2, 0x8 - str r2, [sp, 0x48] - ldr r3, [sp] - str r3, [sp, 0x4C] - str r2, [sp, 0x88] - subs r0, 0x8 - str r0, [sp, 0x80] - mov r0, r12 - str r0, [sp, 0x84] - subs r4, 0x8 - str r4, [sp, 0x7C] - cmp r8, r2 - bcs _0800512C -_080050CA: - ldr r2, [sp, 0x44] - ldm r2!, {r5} - str r2, [sp, 0x44] - ldr r4, [sp, 0x4C] - adds r3, r1, 0x1 - mov r10, r3 - cmp r4, r12 - bcs _08005124 - lsrs r0, r1, 3 - ldr r3, [sp, 0x4] - adds r2, r0, 0 - muls r2, r3 - adds r7, r2, 0 - movs r0, 0x7 - ands r1, r0 - lsls r6, r1, 2 -_080050EA: - adds r3, r5, 0 - movs r1, 0xF - ands r3, r1 - cmp r3, 0 - beq _0800511C - lsrs r2, r4, 3 - lsls r2, 5 - add r2, r9 - adds r0, r4, 0 - movs r1, 0x7 - ands r0, r1 - lsrs r0, 1 - adds r2, r0 - adds r2, r7 - adds r2, r6 - movs r1, 0x1 - ands r1, r4 - lsls r1, 2 - lsls r3, r1 - movs r0, 0xF0 - asrs r0, r1 - ldrb r1, [r2] - ands r0, r1 - orrs r3, r0 - strb r3, [r2] -_0800511C: - lsrs r5, 4 - adds r4, 0x1 - cmp r4, r12 - bcc _080050EA -_08005124: - mov r1, r10 - ldr r2, [sp, 0x48] - cmp r1, r2 - bcc _080050CA -_0800512C: - mov r1, r8 - ldr r3, =0x03002fb0 - str r3, [sp, 0x50] - ldr r0, [sp, 0x84] - ldr r2, [sp, 0x7C] - adds r0, r2 - mov r8, r0 - ldr r3, [sp, 0x88] - str r3, [sp, 0x54] - ldr r0, [sp, 0x84] - str r0, [sp, 0x58] - cmp r1, r3 - bcs _080051AC -_08005146: - ldr r2, [sp, 0x50] - ldm r2!, {r5} - str r2, [sp, 0x50] - ldr r4, [sp, 0x58] - adds r3, r1, 0x1 - mov r10, r3 - cmp r4, r8 - bcs _080051A4 - movs r0, 0x7 - mov r12, r0 - lsrs r0, r1, 3 - ldr r3, [sp, 0x4] - adds r2, r0, 0 - muls r2, r3 - adds r7, r2, 0 - mov r0, r12 - ands r1, r0 - lsls r6, r1, 2 -_0800516A: - adds r3, r5, 0 - movs r1, 0xF - ands r3, r1 - cmp r3, 0 - beq _0800519C - lsrs r2, r4, 3 - lsls r2, 5 - add r2, r9 - adds r0, r4, 0 - mov r1, r12 - ands r0, r1 - lsrs r0, 1 - adds r2, r0 - adds r2, r7 - adds r2, r6 - movs r1, 0x1 - ands r1, r4 - lsls r1, 2 - lsls r3, r1 - movs r0, 0xF0 - asrs r0, r1 - ldrb r1, [r2] - ands r0, r1 - orrs r3, r0 - strb r3, [r2] -_0800519C: - lsrs r5, 4 - adds r4, 0x1 - cmp r4, r8 - bcc _0800516A -_080051A4: - mov r1, r10 - ldr r2, [sp, 0x54] - cmp r1, r2 - bcc _08005146 -_080051AC: - ldr r1, [sp, 0x88] - ldr r3, =0x03002fd0 - str r3, [sp, 0x5C] - ldr r0, [sp, 0x84] - mov r8, r0 - ldr r2, [sp, 0x80] - adds r2, r1, r2 - str r2, [sp, 0x60] - ldr r3, [sp] - str r3, [sp, 0x64] - cmp r1, r2 - bcs _0800522A -_080051C4: - ldr r0, [sp, 0x5C] - ldm r0!, {r5} - str r0, [sp, 0x5C] - ldr r4, [sp, 0x64] - adds r2, r1, 0x1 - mov r10, r2 - cmp r4, r8 - bcs _08005222 - movs r3, 0x7 - mov r12, r3 - lsrs r0, r1, 3 - ldr r3, [sp, 0x4] - adds r2, r0, 0 - muls r2, r3 - adds r7, r2, 0 - mov r0, r12 - ands r1, r0 - lsls r6, r1, 2 -_080051E8: - adds r3, r5, 0 - movs r1, 0xF - ands r3, r1 - cmp r3, 0 - beq _0800521A - lsrs r2, r4, 3 - lsls r2, 5 - add r2, r9 - adds r0, r4, 0 - mov r1, r12 - ands r0, r1 - lsrs r0, 1 - adds r2, r0 - adds r2, r7 - adds r2, r6 - movs r1, 0x1 - ands r1, r4 - lsls r1, 2 - lsls r3, r1 - movs r0, 0xF0 - asrs r0, r1 - ldrb r1, [r2] - ands r0, r1 - orrs r3, r0 - strb r3, [r2] -_0800521A: - lsrs r5, 4 - adds r4, 0x1 - cmp r4, r8 - bcc _080051E8 -_08005222: - mov r1, r10 - ldr r2, [sp, 0x60] - cmp r1, r2 - bcc _080051C4 -_0800522A: - ldr r4, [sp, 0x84] - ldr r1, [sp, 0x88] - ldr r3, =0x03002ff0 - str r3, [sp, 0x68] - ldr r0, [sp, 0x7C] - adds r0, r4 - mov r8, r0 - ldr r2, [sp, 0x80] - adds r2, r1, r2 - str r2, [sp, 0x6C] - str r4, [sp, 0x70] - cmp r1, r2 - bcs _080052AA -_08005244: - ldr r3, [sp, 0x68] - ldm r3!, {r5} - str r3, [sp, 0x68] - ldr r4, [sp, 0x70] - adds r0, r1, 0x1 - mov r10, r0 - cmp r4, r8 - bcs _080052A2 - movs r2, 0x7 - mov r12, r2 - lsrs r0, r1, 3 - ldr r2, [sp, 0x4] - adds r3, r0, 0 - muls r3, r2 - adds r7, r3, 0 - mov r3, r12 - ands r1, r3 - lsls r6, r1, 2 -_08005268: - adds r3, r5, 0 - movs r0, 0xF - ands r3, r0 - cmp r3, 0 - beq _0800529A - lsrs r2, r4, 3 - lsls r2, 5 - add r2, r9 - adds r0, r4, 0 - mov r1, r12 - ands r0, r1 - lsrs r0, 1 - adds r2, r0 - adds r2, r7 - adds r2, r6 - movs r1, 0x1 - ands r1, r4 - lsls r1, 2 - lsls r3, r1 - movs r0, 0xF0 - asrs r0, r1 - ldrb r1, [r2] - ands r0, r1 - orrs r3, r0 - strb r3, [r2] -_0800529A: - lsrs r5, 4 - adds r4, 0x1 - cmp r4, r8 - bcc _08005268 -_080052A2: - mov r1, r10 - ldr r2, [sp, 0x6C] - cmp r1, r2 - bcc _08005244 -_080052AA: - add sp, 0x8C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end CopyGlyphToWindow - - thumb_func_start Text_ClearHorizontalSpan -Text_ClearHorizontalSpan: @ 80052C8 - push {r4-r6,lr} - sub sp, 0x10 - adds r4, r0, 0 - adds r6, r1, 0 - ldr r0, =0x030009ea - ldrh r5, [r0] - cmp r5, 0 - beq _0800531E - ldrb r1, [r4, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - ldr r1, =0x02020004 - adds r0, r1 - ldr r1, [r0, 0x8] - str r1, [sp, 0x8] - ldrb r2, [r0, 0x3] - lsls r2, 3 - ldr r3, =0xffff0000 - ldr r1, [sp, 0xC] - ands r1, r3 - orrs r1, r2 - str r1, [sp, 0xC] - ldrb r2, [r0, 0x4] - lsls r2, 19 - ldr r0, =0x0000ffff - ands r0, r1 - orrs r0, r2 - str r0, [sp, 0xC] - ldr r0, =0x03002f90 - adds r0, 0x81 - ldrb r1, [r4, 0x8] - ldrb r2, [r4, 0x9] - lsls r3, r6, 16 - lsrs r3, 16 - ldrb r0, [r0] - str r0, [sp] - lsls r0, r5, 24 - lsrs r0, 24 - str r0, [sp, 0x4] - add r0, sp, 0x8 - bl PixelBlock_FillRect4Bpp -_0800531E: - add sp, 0x10 - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end Text_ClearHorizontalSpan - - thumb_func_start fbox0_func -fbox0_func: @ 800533C - push {lr} - adds r2, r0, 0 - adds r3, r2, 0 - adds r3, 0x14 - ldrb r1, [r3, 0x1] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08005360 - ldrb r1, [r2, 0x14] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x14] - ldrb r0, [r3, 0x1] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r3, 0x1] -_08005360: - adds r0, r2, 0 - bl font_render_b - lsls r0, 16 - lsrs r0, 16 - pop {r1} - bx r1 - thumb_func_end fbox0_func - - thumb_func_start fbox1_func -fbox1_func: @ 8005370 - push {lr} - adds r2, r0, 0 - adds r3, r2, 0 - adds r3, 0x14 - ldrb r1, [r3, 0x1] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08005398 - ldrb r1, [r2, 0x14] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x14] - ldrb r0, [r3, 0x1] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r3, 0x1] -_08005398: - adds r0, r2, 0 - bl font_render_b - lsls r0, 16 - lsrs r0, 16 - pop {r1} - bx r1 - thumb_func_end fbox1_func - - thumb_func_start fbox2_func -fbox2_func: @ 80053A8 - push {lr} - adds r2, r0, 0 - adds r3, r2, 0 - adds r3, 0x14 - ldrb r1, [r3, 0x1] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _080053D0 - ldrb r1, [r2, 0x14] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - movs r1, 0x2 - orrs r0, r1 - strb r0, [r2, 0x14] - ldrb r0, [r3, 0x1] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r3, 0x1] -_080053D0: - adds r0, r2, 0 - bl font_render_b - lsls r0, 16 - lsrs r0, 16 - pop {r1} - bx r1 - thumb_func_end fbox2_func - - thumb_func_start fbox3_func -fbox3_func: @ 80053E0 - push {lr} - adds r2, r0, 0 - adds r3, r2, 0 - adds r3, 0x14 - ldrb r1, [r3, 0x1] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08005408 - ldrb r1, [r2, 0x14] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - movs r1, 0x3 - orrs r0, r1 - strb r0, [r2, 0x14] - ldrb r0, [r3, 0x1] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r3, 0x1] -_08005408: - adds r0, r2, 0 - bl font_render_b - lsls r0, 16 - lsrs r0, 16 - pop {r1} - bx r1 - thumb_func_end fbox3_func - - thumb_func_start fbox4_func -fbox4_func: @ 8005418 - push {lr} - adds r2, r0, 0 - adds r3, r2, 0 - adds r3, 0x14 - ldrb r1, [r3, 0x1] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08005440 - ldrb r1, [r2, 0x14] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2, 0x14] - ldrb r0, [r3, 0x1] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r3, 0x1] -_08005440: - adds r0, r2, 0 - bl font_render_b - lsls r0, 16 - lsrs r0, 16 - pop {r1} - bx r1 - thumb_func_end fbox4_func - - thumb_func_start fbox5_func -fbox5_func: @ 8005450 - push {lr} - adds r2, r0, 0 - adds r3, r2, 0 - adds r3, 0x14 - ldrb r1, [r3, 0x1] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08005478 - ldrb r1, [r2, 0x14] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - movs r1, 0x5 - orrs r0, r1 - strb r0, [r2, 0x14] - ldrb r0, [r3, 0x1] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r3, 0x1] -_08005478: - adds r0, r2, 0 - bl font_render_b - lsls r0, 16 - lsrs r0, 16 - pop {r1} - bx r1 - thumb_func_end fbox5_func - - thumb_func_start fbox7_func -fbox7_func: @ 8005488 - push {lr} - adds r2, r0, 0 - adds r3, r2, 0 - adds r3, 0x14 - ldrb r1, [r3, 0x1] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _080054B0 - ldrb r1, [r2, 0x14] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - movs r1, 0x7 - orrs r0, r1 - strb r0, [r2, 0x14] - ldrb r0, [r3, 0x1] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r3, 0x1] -_080054B0: - adds r0, r2, 0 - bl font_render_b - lsls r0, 16 - lsrs r0, 16 - pop {r1} - bx r1 - thumb_func_end fbox7_func - - thumb_func_start fbox8_func -fbox8_func: @ 80054C0 - push {lr} - adds r2, r0, 0 - adds r3, r2, 0 - adds r3, 0x14 - ldrb r1, [r3, 0x1] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _080054E8 - ldrb r1, [r2, 0x14] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - movs r1, 0x8 - orrs r0, r1 - strb r0, [r2, 0x14] - ldrb r0, [r3, 0x1] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r3, 0x1] -_080054E8: - adds r0, r2, 0 - bl font_render_b - lsls r0, 16 - lsrs r0, 16 - pop {r1} - bx r1 - thumb_func_end fbox8_func - - thumb_func_start sub_80054F8 -sub_80054F8: @ 80054F8 - push {lr} - adds r2, r0, 0 - adds r2, 0x14 - ldr r0, =0x03003014 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _08005514 - movs r0, 0 - strb r0, [r2, 0x2] - b _08005524 - .align 2, 0 - .pool -_08005514: - ldrb r0, [r2, 0x1] - movs r1, 0x61 - negs r1, r1 - ands r1, r0 - movs r0, 0x20 - negs r0, r0 - ands r1, r0 - strb r1, [r2, 0x1] -_08005524: - pop {r0} - bx r0 - thumb_func_end sub_80054F8 - - thumb_func_start remo_draw_bouncing_down_arrow -remo_draw_bouncing_down_arrow: @ 8005528 - push {r4-r7,lr} - sub sp, 0x18 - adds r5, r0, 0 - adds r6, r5, 0 - adds r6, 0x14 - ldr r7, =0x03003014 - ldrb r1, [r7] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - bne _080055EE - ldrb r2, [r6, 0x1] - movs r0, 0x1F - ands r0, r2 - cmp r0, 0 - beq _08005560 - ldr r0, [r5, 0x14] - lsls r0, 19 - lsrs r0, 27 - subs r0, 0x1 - movs r1, 0x1F - ands r0, r1 - movs r1, 0x20 - negs r1, r1 - b _080055E8 - .align 2, 0 - .pool -_08005560: - ldrb r0, [r5, 0x4] - ldrb r2, [r5, 0xD] - lsls r2, 28 - lsrs r1, r2, 4 - orrs r1, r2 - lsrs r1, 24 - ldrb r2, [r5, 0x8] - ldrb r3, [r5, 0x9] - movs r4, 0x8 - str r4, [sp] - movs r4, 0x10 - str r4, [sp, 0x4] - bl Window_FillPixelRect - ldr r0, [r7] - lsls r0, 30 - lsrs r0, 31 - cmp r0, 0 - beq _0800558A - cmp r0, 0x1 - beq _08005594 -_0800558A: - ldr r7, =0x082e968c - b _08005596 - .align 2, 0 - .pool -_08005594: - ldr r7, =0x082e974c -_08005596: - ldrb r0, [r5, 0x4] - ldr r2, =0x082e9d0c - ldr r1, [r6] - lsls r1, 17 - lsrs r1, 30 - adds r1, r2 - ldrb r3, [r1] - movs r4, 0x8 - str r4, [sp] - movs r2, 0x10 - str r2, [sp, 0x4] - ldrb r1, [r5, 0x8] - str r1, [sp, 0x8] - ldrb r1, [r5, 0x9] - str r1, [sp, 0xC] - str r4, [sp, 0x10] - str r2, [sp, 0x14] - adds r1, r7, 0 - movs r2, 0 - bl Window_CopyPixelRectToWindow - ldrb r0, [r5, 0x4] - movs r1, 0x2 - bl Window_CopyToVram - ldrb r0, [r6, 0x1] - movs r1, 0x20 - negs r1, r1 - ands r1, r0 - movs r0, 0x8 - orrs r1, r0 - strb r1, [r6, 0x1] - ldr r0, [r6] - lsls r0, 17 - lsrs r0, 30 - adds r0, 0x1 - movs r2, 0x3 - ands r0, r2 - lsls r0, 5 - movs r2, 0x61 - negs r2, r2 -_080055E8: - ands r1, r2 - orrs r1, r0 - strb r1, [r6, 0x1] -_080055EE: - add sp, 0x18 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end remo_draw_bouncing_down_arrow - - thumb_func_start remo_clear_down_arrow -remo_clear_down_arrow: @ 8005600 - push {r4,r5,lr} - sub sp, 0x8 - adds r5, r0, 0 - ldrb r0, [r5, 0x4] - ldrb r2, [r5, 0xD] - lsls r2, 28 - lsrs r1, r2, 4 - orrs r1, r2 - lsrs r1, 24 - ldrb r2, [r5, 0x8] - ldrb r3, [r5, 0x9] - movs r4, 0x8 - str r4, [sp] - movs r4, 0x10 - str r4, [sp, 0x4] - bl Window_FillPixelRect - ldrb r0, [r5, 0x4] - movs r1, 0x2 - bl Window_CopyToVram - add sp, 0x8 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end remo_clear_down_arrow - - thumb_func_start remo_is_it_time_to_continue_autopilot -remo_is_it_time_to_continue_autopilot: @ 8005634 - push {lr} - adds r1, r0, 0 - adds r1, 0x14 - ldrb r0, [r1, 0x2] - cmp r0, 0x31 - beq _08005648 - adds r0, 0x1 - strb r0, [r1, 0x2] - movs r0, 0 - b _0800564A -_08005648: - movs r0, 0x1 -_0800564A: - pop {r1} - bx r1 - thumb_func_end remo_is_it_time_to_continue_autopilot - - thumb_func_start remo_is_it_time_to_continue_plus_down_arrow -remo_is_it_time_to_continue_plus_down_arrow: @ 8005650 - push {r4,lr} - adds r2, r0, 0 - movs r4, 0 - ldr r0, =0x03003014 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _08005674 - adds r0, r2, 0 - bl remo_is_it_time_to_continue_autopilot - lsls r0, 24 - lsrs r4, r0, 24 - b _0800568E - .align 2, 0 - .pool -_08005674: - adds r0, r2, 0 - bl remo_draw_bouncing_down_arrow - ldr r0, =0x030022c0 - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _0800568E - movs r4, 0x1 - movs r0, 0x5 - bl audio_play -_0800568E: - adds r0, r4, 0 - pop {r4} - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end remo_is_it_time_to_continue_plus_down_arrow - - thumb_func_start remo_is_it_time_to_continue -remo_is_it_time_to_continue: @ 800569C - push {r4,lr} - adds r2, r0, 0 - movs r4, 0 - ldr r0, =0x03003014 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _080056C0 - adds r0, r2, 0 - bl remo_is_it_time_to_continue_autopilot - lsls r0, 24 - lsrs r4, r0, 24 - b _080056D4 - .align 2, 0 - .pool -_080056C0: - ldr r0, =0x030022c0 - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _080056D4 - movs r4, 0x1 - movs r0, 0x5 - bl audio_play -_080056D4: - adds r0, r4, 0 - pop {r4} - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end remo_is_it_time_to_continue - - thumb_func_start draw_bouncing_down_arrow_2 -draw_bouncing_down_arrow_2: @ 80056E0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x18 - ldr r4, [sp, 0x38] - ldr r5, [sp, 0x3C] - mov r9, r5 - ldr r5, [sp, 0x40] - mov r10, r5 - lsls r0, 24 - lsrs r5, r0, 24 - lsls r1, 16 - lsrs r1, 16 - mov r8, r1 - lsls r2, 16 - lsrs r7, r2, 16 - lsls r3, 24 - lsrs r3, 24 - lsls r4, 24 - lsrs r4, 24 - mov r1, r9 - ldrb r0, [r1] - cmp r0, 0 - beq _0800571A - subs r0, 0x1 - strb r0, [r1] - b _0800579A -_0800571A: - lsls r1, r3, 4 - orrs r1, r3 - lsls r1, 24 - lsrs r1, 24 - movs r0, 0x8 - str r0, [sp] - movs r0, 0x10 - str r0, [sp, 0x4] - adds r0, r5, 0 - mov r2, r8 - adds r3, r7, 0 - bl Window_FillPixelRect - cmp r4, 0 - bne _0800579A - ldr r0, =0x03003014 - ldr r0, [r0] - lsls r0, 30 - lsrs r0, 31 - cmp r0, 0 - beq _08005748 - cmp r0, 0x1 - beq _08005754 -_08005748: - ldr r6, =0x082e968c - b _08005756 - .align 2, 0 - .pool -_08005754: - ldr r6, =0x082e974c -_08005756: - ldr r2, =0x082e9d0c - mov r0, r10 - ldrb r1, [r0] - movs r0, 0x3 - ands r0, r1 - adds r0, r2 - ldrb r3, [r0] - movs r4, 0x8 - str r4, [sp] - movs r1, 0x10 - str r1, [sp, 0x4] - mov r0, r8 - str r0, [sp, 0x8] - subs r0, r7, 0x2 - lsls r0, 16 - lsrs r0, 16 - str r0, [sp, 0xC] - str r4, [sp, 0x10] - str r1, [sp, 0x14] - adds r0, r5, 0 - adds r1, r6, 0 - movs r2, 0 - bl Window_CopyPixelRectToWindow - adds r0, r5, 0 - movs r1, 0x2 - bl Window_CopyToVram - mov r1, r9 - strb r4, [r1] - mov r5, r10 - ldrb r0, [r5] - adds r0, 0x1 - strb r0, [r5] -_0800579A: - add sp, 0x18 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end draw_bouncing_down_arrow_2 - - thumb_func_start font_render_b -font_render_b: @ 80057B4 - push {r4-r6,lr} - adds r6, r0, 0 - adds r4, r6, 0 - adds r4, 0x14 - ldrb r0, [r6, 0x1C] - cmp r0, 0x6 - bls _080057C4 - b _08005D6C -_080057C4: - lsls r0, 2 - ldr r1, =_080057D4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 - .pool - .align 2, 0 -_080057D4: - .4byte _080057F0 - .4byte _08005C78 - .4byte _08005C8C - .4byte _08005CB8 - .4byte _08005CF0 - .4byte _08005D48 - .4byte _08005D5A -_080057F0: - ldr r2, =0x030022c0 - ldrh r1, [r2, 0x2C] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _0800580A - ldrb r1, [r4] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _0800580A - movs r0, 0 - strb r0, [r6, 0x1E] -_0800580A: - ldrb r1, [r6, 0x1E] - cmp r1, 0 - beq _0800584C - ldrb r0, [r6, 0x1D] - cmp r0, 0 - beq _0800584C - subs r0, r1, 0x1 - strb r0, [r6, 0x1E] - ldr r0, =0x03003014 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08005828 - b _08005B56 -_08005828: - ldrh r1, [r2, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - bne _08005834 - b _08005B56 -_08005834: - ldrb r0, [r4] - movs r1, 0x10 - orrs r0, r1 - strb r0, [r4] - movs r0, 0 - strb r0, [r6, 0x1E] - b _08005B56 - .align 2, 0 - .pool -_0800584C: - ldr r0, =0x02022fec - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 17 - ands r0, r1 - cmp r0, 0 - bne _08005874 - ldr r0, =0x03003014 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _08005874 - movs r0, 0x3 - b _08005876 - .align 2, 0 - .pool -_08005874: - ldrb r0, [r6, 0x1D] -_08005876: - strb r0, [r6, 0x1E] - ldr r0, [r6] - ldrb r3, [r0] - adds r0, 0x1 - str r0, [r6] - adds r0, r3, 0 - subs r0, 0xF8 - cmp r0, 0x7 - bls _0800588A - b _08005B90 -_0800588A: - lsls r0, 2 - ldr r1, =_08005898 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 - .pool - .align 2, 0 -_08005898: - .4byte _08005B6C - .4byte _08005B5A - .4byte _08005B4C - .4byte _08005B48 - .4byte _080058E0 - .4byte _080058DC - .4byte _080058B8 - .4byte _08005D6C -_080058B8: - ldrb r0, [r6, 0x6] - strb r0, [r6, 0x8] - ldrb r1, [r6, 0x5] - ldr r0, =0x03002f80 - ldr r2, [r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r6, 0xB] - ldrb r0, [r0, 0x5] - adds r1, r0 - ldrb r0, [r6, 0x9] - adds r0, r1 - b _08005ABA - .align 2, 0 - .pool -_080058DC: - ldr r0, [r6] - b _08005B30 -_080058E0: - ldr r0, [r6] - ldrb r3, [r0] - adds r0, 0x1 - str r0, [r6] - subs r0, r3, 0x1 - cmp r0, 0x17 - bls _080058F0 - b _08005B90 -_080058F0: - lsls r0, 2 - ldr r1, =_08005900 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 - .pool - .align 2, 0 -_08005900: - .4byte _08005960 - .4byte _08005982 - .4byte _080059A6 - .4byte _080059C0 - .4byte _08005A0E - .4byte _08005A12 - .4byte _08005A0A - .4byte _08005A2A - .4byte _08005A3A - .4byte _08005A58 - .4byte _08005A5C - .4byte _08005B5A - .4byte _08005A90 - .4byte _08005A98 - .4byte _08005AA4 - .4byte _08005A76 - .4byte _08005AD8 - .4byte _08005AF2 - .4byte _08005B02 - .4byte _08005B26 - .4byte _08005B36 - .4byte _08005B3E - .4byte _08005ABE - .4byte _08005ACC -_08005960: - ldr r2, [r6] - ldrb r1, [r2] - lsls r1, 4 - ldrb r3, [r6, 0xC] - movs r0, 0xF - ands r0, r3 - orrs r0, r1 - strb r0, [r6, 0xC] - adds r2, 0x1 - str r2, [r6] - lsls r0, 24 - lsrs r0, 28 - ldrb r2, [r6, 0xD] - lsls r1, r2, 28 - lsrs r1, 28 - lsrs r2, 4 - b _08005A06 -_08005982: - ldr r1, [r6] - ldrb r2, [r1] - movs r0, 0xF - ands r0, r2 - ldrb r3, [r6, 0xD] - movs r2, 0x10 - negs r2, r2 - ands r2, r3 - orrs r2, r0 - strb r2, [r6, 0xD] - adds r1, 0x1 - str r1, [r6] - ldrb r0, [r6, 0xC] - lsrs r0, 4 - lsls r1, r2, 28 - lsrs r1, 28 - lsrs r2, 4 - b _08005A06 -_080059A6: - ldr r1, [r6] - ldrb r0, [r1] - lsls r0, 4 - ldrb r3, [r6, 0xD] - movs r2, 0xF - ands r2, r3 - orrs r2, r0 - strb r2, [r6, 0xD] - adds r1, 0x1 - str r1, [r6] - ldrb r0, [r6, 0xC] - lsrs r0, 4 - b _080059FE -_080059C0: - ldr r3, [r6] - ldrb r1, [r3] - lsls r1, 4 - ldrb r4, [r6, 0xC] - movs r2, 0xF - adds r0, r2, 0 - ands r0, r4 - orrs r0, r1 - strb r0, [r6, 0xC] - adds r5, r3, 0x1 - str r5, [r6] - ldrb r3, [r3, 0x1] - adds r1, r2, 0 - ands r1, r3 - ldrb r4, [r6, 0xD] - movs r3, 0x10 - negs r3, r3 - ands r3, r4 - orrs r3, r1 - strb r3, [r6, 0xD] - adds r4, r5, 0x1 - str r4, [r6] - ldrb r1, [r5, 0x1] - lsls r1, 4 - ands r2, r3 - orrs r2, r1 - strb r2, [r6, 0xD] - adds r4, 0x1 - str r4, [r6] - lsls r0, 24 - lsrs r0, 28 -_080059FE: - lsls r1, r2, 28 - lsrs r1, 28 - lsls r2, 24 - lsrs r2, 28 -_08005A06: - bl GenerateFontHalfRowLut -_08005A0A: - movs r0, 0x2 - b _08005D6E -_08005A0E: - ldr r0, [r6] - b _08005B30 -_08005A12: - ldr r0, [r6] - ldrb r0, [r0] - movs r1, 0xF - ands r1, r0 - ldrb r2, [r4] - movs r0, 0x10 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r4] - ldr r0, [r6] - b _08005B30 -_08005A2A: - ldr r0, [r6] - ldrb r1, [r0] - strb r1, [r6, 0x1E] - adds r0, 0x1 - str r0, [r6] - movs r0, 0x6 - strb r0, [r6, 0x1C] - b _08005A0A -_08005A3A: - movs r0, 0x1 - strb r0, [r6, 0x1C] - ldr r0, =0x03003014 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - bne _08005A4C - b _08005B56 -_08005A4C: - movs r0, 0 - strb r0, [r4, 0x2] - b _08005B56 - .align 2, 0 - .pool -_08005A58: - movs r0, 0x5 - b _08005D56 -_08005A5C: - ldr r0, [r6] - ldrb r3, [r0] - adds r1, r0, 0x1 - str r1, [r6] - ldrb r0, [r0, 0x1] - lsls r0, 8 - orrs r3, r0 - adds r1, 0x1 - str r1, [r6] - adds r0, r3, 0 - bl song_play_for_text - b _08005A0A -_08005A76: - ldr r0, [r6] - ldrb r3, [r0] - adds r1, r0, 0x1 - str r1, [r6] - ldrb r0, [r0, 0x1] - lsls r0, 8 - orrs r3, r0 - adds r1, 0x1 - str r1, [r6] - adds r0, r3, 0 - bl audio_play - b _08005A0A -_08005A90: - ldr r1, [r6] - ldrb r0, [r1] - ldrb r3, [r6, 0x6] - b _08005AF8 -_08005A98: - ldr r1, [r6] - ldrb r0, [r1] - ldrb r2, [r6, 0x7] - adds r0, r2 - strb r0, [r6, 0x9] - b _08005AFC -_08005AA4: - ldrb r0, [r6, 0x4] - ldrb r2, [r6, 0xD] - lsls r2, 28 - lsrs r1, r2, 4 - orrs r1, r2 - lsrs r1, 24 - bl Window_FastFillPixels - ldrb r0, [r6, 0x6] - strb r0, [r6, 0x8] - ldrb r0, [r6, 0x7] -_08005ABA: - strb r0, [r6, 0x9] - b _08005A0A -_08005ABE: - ldr r0, =0x03007420 - bl MPlayStop_rev01 - b _08005A0A - .align 2, 0 - .pool -_08005ACC: - ldr r0, =0x03007420 - bl m4aMPlayContinue - b _08005A0A - .align 2, 0 - .pool -_08005AD8: - ldr r0, [r6] - ldrb r4, [r0] - adds r0, 0x1 - str r0, [r6] - cmp r4, 0 - ble _08005A0A - adds r0, r6, 0 - adds r1, r4, 0 - bl Text_ClearHorizontalSpan - ldrb r0, [r6, 0x8] - adds r0, r4 - b _08005C6E -_08005AF2: - ldr r1, [r6] - ldrb r0, [r6, 0x6] - ldrb r3, [r1] -_08005AF8: - adds r0, r3 - strb r0, [r6, 0x8] -_08005AFC: - adds r1, 0x1 - str r1, [r6] - b _08005A0A -_08005B02: - ldr r0, [r6] - ldrb r2, [r0] - ldrb r1, [r6, 0x6] - adds r2, r1 - adds r0, 0x1 - str r0, [r6] - ldrb r0, [r6, 0x8] - subs r4, r2, r0 - cmp r4, 0 - bgt _08005B18 - b _08005A0A -_08005B18: - adds r0, r6, 0 - adds r1, r4, 0 - bl Text_ClearHorizontalSpan - ldrb r0, [r6, 0x8] - adds r0, r4 - b _08005C6E -_08005B26: - ldr r0, [r6] - ldrb r2, [r0] - adds r1, r6, 0 - adds r1, 0x20 - strb r2, [r1] -_08005B30: - adds r0, 0x1 - str r0, [r6] - b _08005A0A -_08005B36: - adds r1, r6, 0 - adds r1, 0x21 - movs r0, 0x1 - b _08005B44 -_08005B3E: - adds r1, r6, 0 - adds r1, 0x21 - movs r0, 0 -_08005B44: - strb r0, [r1] - b _08005A0A -_08005B48: - movs r0, 0x2 - b _08005B4E -_08005B4C: - movs r0, 0x3 -_08005B4E: - strb r0, [r6, 0x1C] - adds r0, r6, 0 - bl sub_80054F8 -_08005B56: - movs r0, 0x3 - b _08005D6E -_08005B5A: - ldr r0, [r6] - ldrb r3, [r0] - movs r2, 0x80 - lsls r2, 1 - adds r1, r2, 0 - orrs r3, r1 - adds r0, 0x1 - str r0, [r6] - b _08005B90 -_08005B6C: - ldr r0, [r6] - ldrb r3, [r0] - adds r0, 0x1 - str r0, [r6] - ldrb r0, [r6, 0x4] - adds r1, r3, 0 - ldrb r2, [r6, 0x8] - ldrb r3, [r6, 0x9] - bl TextBox_DrawKeypadIcon - ldr r1, =0x03002f90 - adds r1, 0x80 - strb r0, [r1] - ldrb r3, [r6, 0xA] - adds r0, r3 - b _08005C6A - .align 2, 0 - .pool -_08005B90: - ldr r0, [r4] - lsls r0, 28 - lsrs r0, 28 - cmp r0, 0x8 - bhi _08005C10 - lsls r0, 2 - ldr r1, =_08005BA8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 - .pool - .align 2, 0 -_08005BA8: - .4byte _08005BCC - .4byte _08005BDA - .4byte _08005BE8 - .4byte _08005BE8 - .4byte _08005BE8 - .4byte _08005BE8 - .4byte _08005C10 - .4byte _08005BF6 - .4byte _08005C04 -_08005BCC: - adds r0, r6, 0 - adds r0, 0x21 - ldrb r1, [r0] - adds r0, r3, 0 - bl Text_DecompressGlyphFont0 - b _08005C10 -_08005BDA: - adds r0, r6, 0 - adds r0, 0x21 - ldrb r1, [r0] - adds r0, r3, 0 - bl Text_DecompressGlyphFont1 - b _08005C10 -_08005BE8: - adds r0, r6, 0 - adds r0, 0x21 - ldrb r1, [r0] - adds r0, r3, 0 - bl Text_DecompressGlyphFont2 - b _08005C10 -_08005BF6: - adds r0, r6, 0 - adds r0, 0x21 - ldrb r1, [r0] - adds r0, r3, 0 - bl Text_DecompressGlyphFont7 - b _08005C10 -_08005C04: - adds r0, r6, 0 - adds r0, 0x21 - ldrb r1, [r0] - adds r0, r3, 0 - bl Text_DecompressGlyphFont8 -_08005C10: - adds r0, r6, 0 - bl CopyGlyphToWindow - adds r2, r6, 0 - adds r2, 0x20 - ldrb r0, [r2] - cmp r0, 0 - beq _08005C48 - ldr r1, =0x03002f90 - adds r1, 0x80 - ldrb r0, [r1] - ldrb r3, [r6, 0x8] - adds r0, r3 - strb r0, [r6, 0x8] - ldrb r2, [r2] - ldrb r0, [r1] - subs r4, r2, r0 - cmp r4, 0 - ble _08005C70 - adds r0, r6, 0 - adds r1, r4, 0 - bl Text_ClearHorizontalSpan - ldrb r0, [r6, 0x8] - adds r0, r4 - b _08005C6E - .align 2, 0 - .pool -_08005C48: - adds r0, r6, 0 - adds r0, 0x21 - ldrb r0, [r0] - cmp r0, 0 - beq _08005C64 - ldr r0, =0x03002f90 - adds r0, 0x80 - ldrb r1, [r6, 0xA] - ldrb r0, [r0] - adds r1, r0 - ldrb r0, [r6, 0x8] - b _08005C6C - .align 2, 0 - .pool -_08005C64: - ldr r0, =0x03002f90 - adds r0, 0x80 - ldrb r0, [r0] -_08005C6A: - ldrb r1, [r6, 0x8] -_08005C6C: - adds r0, r1 -_08005C6E: - strb r0, [r6, 0x8] -_08005C70: - movs r0, 0 - b _08005D6E - .align 2, 0 - .pool -_08005C78: - adds r0, r6, 0 - bl remo_is_it_time_to_continue - lsls r0, 16 - cmp r0, 0 - bne _08005C86 - b _08005B56 -_08005C86: - movs r0, 0 - strb r0, [r6, 0x1C] - b _08005B56 -_08005C8C: - adds r0, r6, 0 - bl remo_is_it_time_to_continue_plus_down_arrow - lsls r0, 16 - cmp r0, 0 - bne _08005C9A - b _08005B56 -_08005C9A: - ldrb r0, [r6, 0x4] - ldrb r2, [r6, 0xD] - lsls r2, 28 - lsrs r1, r2, 4 - orrs r1, r2 - lsrs r1, 24 - bl Window_FastFillPixels - ldrb r0, [r6, 0x6] - movs r1, 0 - strb r0, [r6, 0x8] - ldrb r0, [r6, 0x7] - strb r0, [r6, 0x9] - strb r1, [r6, 0x1C] - b _08005B56 -_08005CB8: - adds r0, r6, 0 - bl remo_is_it_time_to_continue_plus_down_arrow - lsls r0, 16 - cmp r0, 0 - bne _08005CC6 - b _08005B56 -_08005CC6: - adds r0, r6, 0 - bl remo_clear_down_arrow - ldrb r1, [r6, 0x5] - ldr r0, =0x03002f80 - ldr r2, [r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r6, 0xB] - ldrb r0, [r0, 0x5] - adds r1, r0 - strb r1, [r6, 0x1F] - ldrb r0, [r6, 0x6] - strb r0, [r6, 0x8] - movs r0, 0x4 - strb r0, [r6, 0x1C] - b _08005B56 - .align 2, 0 - .pool -_08005CF0: - ldrb r0, [r6, 0x1F] - cmp r0, 0 - beq _08005D44 - bl sub_8197964 - ldr r1, =0x082e9d10 - adds r0, r1 - ldrb r4, [r0] - ldrb r2, [r6, 0x1F] - cmp r2, r4 - bge _08005D20 - ldrb r0, [r6, 0x4] - ldrb r1, [r6, 0xD] - lsls r1, 28 - lsrs r3, r1, 4 - orrs r3, r1 - lsrs r3, 24 - movs r1, 0 - bl Window_ScrollVertically - movs r0, 0 - b _08005D38 - .align 2, 0 - .pool -_08005D20: - ldrb r0, [r6, 0x4] - ldrb r1, [r6, 0xD] - lsls r1, 28 - lsrs r3, r1, 4 - orrs r3, r1 - lsrs r3, 24 - movs r1, 0 - adds r2, r4, 0 - bl Window_ScrollVertically - ldrb r0, [r6, 0x1F] - subs r0, r4 -_08005D38: - strb r0, [r6, 0x1F] - ldrb r0, [r6, 0x4] - movs r1, 0x2 - bl Window_CopyToVram - b _08005B56 -_08005D44: - strb r0, [r6, 0x1C] - b _08005B56 -_08005D48: - bl mplay_has_finished_maybe - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - beq _08005D56 - b _08005B56 -_08005D56: - strb r0, [r6, 0x1C] - b _08005B56 -_08005D5A: - ldrb r0, [r6, 0x1E] - adds r1, r0, 0 - cmp r1, 0 - beq _08005D68 - subs r0, 0x1 - strb r0, [r6, 0x1E] - b _08005B56 -_08005D68: - strb r1, [r6, 0x1C] - b _08005B56 -_08005D6C: - movs r0, 0x1 -_08005D6E: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end font_render_b - - thumb_func_start sub_8005D74 -sub_8005D74: @ 8005D74 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - lsls r1, 24 - lsrs r7, r1, 24 - lsls r2, 24 - lsrs r2, 24 - mov r8, r2 - movs r2, 0 - mov r1, sp - adds r1, 0x7 -_08005D8C: - strb r2, [r1] - subs r1, 0x1 - cmp r1, sp - bge _08005D8C - movs r5, 0 - movs r6, 0 - adds r4, r0, 0 - movs r2, 0 -_08005D9C: - adds r0, r4, r2 - ldrb r3, [r0] - adds r2, 0x1 - adds r0, r3, 0 - subs r0, 0xF7 - cmp r0, 0x8 - bhi _08005E6A - lsls r0, 2 - ldr r1, =_08005DB8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 - .pool - .align 2, 0 -_08005DB8: - .4byte _08005E64 - .4byte _08005E68 - .4byte _08005E68 - .4byte _08005E70 - .4byte _08005E70 - .4byte _08005DEC - .4byte _08005E64 - .4byte _08005DDC - .4byte _08005DDC -_08005DDC: - mov r1, sp - adds r0, r1, r6 - strb r5, [r0] - movs r5, 0 - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - b _08005E70 -_08005DEC: - adds r0, r4, r2 - ldrb r0, [r0] - adds r2, 0x1 - subs r0, 0x1 - cmp r0, 0x15 - bhi _08005E70 - lsls r0, 2 - ldr r1, =_08005E08 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 - .pool - .align 2, 0 -_08005E08: - .4byte _08005E64 - .4byte _08005E64 - .4byte _08005E64 - .4byte _08005E60 - .4byte _08005E64 - .4byte _08005E64 - .4byte _08005E70 - .4byte _08005E64 - .4byte _08005E70 - .4byte _08005E70 - .4byte _08005E62 - .4byte _08005E64 - .4byte _08005E64 - .4byte _08005E64 - .4byte _08005E70 - .4byte _08005E62 - .4byte _08005E64 - .4byte _08005E64 - .4byte _08005E64 - .4byte _08005E64 - .4byte _08005E70 - .4byte _08005E70 -_08005E60: - adds r2, 0x1 -_08005E62: - adds r2, 0x1 -_08005E64: - adds r2, 0x1 - b _08005E70 -_08005E68: - adds r2, 0x1 -_08005E6A: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 -_08005E70: - cmp r3, 0xFF - bne _08005D9C - movs r5, 0 - movs r2, 0 -_08005E78: - mov r1, sp - adds r0, r1, r2 - ldrb r1, [r0] - cmp r5, r1 - bcs _08005E84 - ldrb r5, [r0] -_08005E84: - adds r2, 0x1 - cmp r2, 0x7 - ble _08005E78 - adds r0, r7, 0 - movs r1, 0 - bl fbox_get_field - add r0, r8 - lsls r0, 24 - lsrs r0, 24 - muls r0, r5 - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8005D74 - - thumb_func_start font_get_get_width_func -font_get_get_width_func: @ 8005EA8 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - movs r3, 0 - ldr r0, =0x082e9d14 - adds r2, r0, 0x4 - adds r1, r0, 0 -_08005EB6: - ldr r0, [r1] - cmp r4, r0 - bne _08005EC4 - ldr r0, [r2] - b _08005ED0 - .align 2, 0 - .pool -_08005EC4: - adds r2, 0x8 - adds r1, 0x8 - adds r3, 0x1 - cmp r3, 0x8 - bls _08005EB6 - movs r0, 0 -_08005ED0: - pop {r4} - pop {r1} - bx r1 - thumb_func_end font_get_get_width_func - - thumb_func_start font_get_width_of_string -font_get_width_of_string: @ 8005ED8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - adds r4, r1, 0 - lsls r0, 24 - lsrs r0, 24 - adds r6, r0, 0 - lsls r2, 16 - lsrs r5, r2, 16 - movs r0, 0 - mov r9, r0 - movs r7, 0 - adds r0, r6, 0 - bl font_get_get_width_func - mov r8, r0 - cmp r0, 0 - bne _08005F06 -_08005F02: - movs r0, 0 - b _0800612E -_08005F06: - lsls r0, r5, 16 - asrs r2, r0, 16 - movs r1, 0x1 - negs r1, r1 - str r0, [sp, 0x4] - cmp r2, r1 - bne _08005F24 - adds r0, r6, 0 - movs r1, 0x2 - bl fbox_get_field - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - b _08005F26 -_08005F24: - mov r10, r2 -_08005F26: - movs r2, 0 - str r2, [sp] - movs r5, 0 - movs r6, 0 - b _0800611E -_08005F30: - ldrb r1, [r4] - adds r0, r1, 0 - subs r0, 0xF7 - cmp r0, 0x7 - bls _08005F3C - b _080060F8 -_08005F3C: - lsls r0, 2 - ldr r1, =_08005F4C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 - .pool - .align 2, 0 -_08005F4C: - .4byte _08005FA2 - .4byte _080060BC - .4byte _080060BC - .4byte _0800611C - .4byte _0800611C - .4byte _08005FEA - .4byte _08005F78 - .4byte _08005F6C -_08005F6C: - ldr r0, [sp] - cmp r5, r0 - bls _08005F74 - str r5, [sp] -_08005F74: - movs r5, 0 - b _0800611C -_08005F78: - adds r4, 0x1 - ldrb r0, [r4] - cmp r0, 0x3 - beq _08005F98 - cmp r0, 0x3 - bgt _08005F8A - cmp r0, 0x2 - beq _08005F90 - b _08005F02 -_08005F8A: - cmp r0, 0x4 - beq _08005FA0 - b _08005F02 -_08005F90: - ldr r6, =0x02021cc4 - b _08005FA2 - .align 2, 0 - .pool -_08005F98: - ldr r6, =0x02021dc4 - b _08005FA2 - .align 2, 0 - .pool -_08005FA0: - ldr r6, =0x02021ec4 -_08005FA2: - cmp r6, 0 - bne _08005FE0 - adds r4, 0x1 - ldrb r0, [r4] - bl sub_81AFC74 - adds r6, r0, 0 - b _08005FE0 - .align 2, 0 - .pool -_08005FB8: - ldrb r0, [r6] - adds r6, 0x1 - mov r1, r9 - bl _call_via_r8 - cmp r7, 0 - ble _08005FD0 - cmp r0, r7 - bge _08005FCC - adds r0, r7, 0 -_08005FCC: - adds r5, r0 - b _08005FE0 -_08005FD0: - adds r5, r0 - mov r2, r9 - cmp r2, 0 - beq _08005FE0 - ldrb r0, [r4, 0x1] - cmp r0, 0xFF - beq _08005FE0 - add r5, r10 -_08005FE0: - ldrb r0, [r6] - cmp r0, 0xFF - bne _08005FB8 - movs r6, 0 - b _0800611C -_08005FEA: - adds r4, 0x1 - ldrb r0, [r4] - subs r0, 0x1 - cmp r0, 0x15 - bls _08005FF6 - b _0800611C -_08005FF6: - lsls r0, 2 - ldr r1, =_08006004 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 - .pool - .align 2, 0 -_08006004: - .4byte _08006060 - .4byte _08006060 - .4byte _08006060 - .4byte _0800605C - .4byte _08006060 - .4byte _08006064 - .4byte _0800611C - .4byte _08006060 - .4byte _0800611C - .4byte _0800611C - .4byte _0800605E - .4byte _08006060 - .4byte _08006060 - .4byte _08006060 - .4byte _0800611C - .4byte _0800605E - .4byte _08006090 - .4byte _08006098 - .4byte _0800609E - .4byte _080060AA - .4byte _080060B0 - .4byte _080060B6 -_0800605C: - adds r4, 0x1 -_0800605E: - adds r4, 0x1 -_08006060: - adds r4, 0x1 - b _0800611C -_08006064: - adds r4, 0x1 - ldrb r0, [r4] - bl font_get_get_width_func - mov r8, r0 - cmp r0, 0 - bne _08006074 - b _08005F02 -_08006074: - ldr r0, [sp, 0x4] - asrs r1, r0, 16 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - bne _0800611C - ldrb r0, [r4] - movs r1, 0x2 - bl fbox_get_field - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - b _0800611C -_08006090: - adds r4, 0x1 - ldrb r0, [r4] -_08006094: - adds r5, r0 - b _0800611C -_08006098: - adds r4, 0x1 - ldrb r5, [r4] - b _0800611C -_0800609E: - adds r4, 0x1 - ldrb r0, [r4] - cmp r0, r5 - bls _0800611C - adds r5, r0, 0 - b _0800611C -_080060AA: - adds r4, 0x1 - ldrb r7, [r4] - b _0800611C -_080060B0: - movs r2, 0x1 - mov r9, r2 - b _0800611C -_080060B6: - movs r0, 0 - mov r9, r0 - b _0800611C -_080060BC: - ldrb r0, [r4] - cmp r0, 0xF9 - bne _080060D6 - adds r4, 0x1 - ldrb r0, [r4] - movs r2, 0x80 - lsls r2, 1 - adds r1, r2, 0 - orrs r0, r1 - mov r1, r9 - bl _call_via_r8 - b _080060E2 -_080060D6: - adds r4, 0x1 - ldrb r0, [r4] - bl Font_ReturnsValueFromLUT - lsls r0, 24 - lsrs r0, 24 -_080060E2: - cmp r7, 0 - ble _080060EE - cmp r0, r7 - bge _08006094 - adds r0, r7, 0 - b _08006094 -_080060EE: - adds r5, r0 - mov r0, r9 - cmp r0, 0 - beq _0800611C - b _08006114 -_080060F8: - adds r0, r1, 0 - mov r1, r9 - bl _call_via_r8 - cmp r7, 0 - ble _0800610C - cmp r0, r7 - bge _08006094 - adds r0, r7, 0 - b _08006094 -_0800610C: - adds r5, r0 - mov r2, r9 - cmp r2, 0 - beq _0800611C -_08006114: - ldrb r0, [r4, 0x1] - cmp r0, 0xFF - beq _0800611C - add r5, r10 -_0800611C: - adds r4, 0x1 -_0800611E: - ldrb r0, [r4] - cmp r0, 0xFF - beq _08006126 - b _08005F30 -_08006126: - ldr r0, [sp] - cmp r5, r0 - bls _0800612E - adds r0, r5, 0 -_0800612E: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end font_get_width_of_string - - thumb_func_start font_render_some -font_render_some: @ 8006140 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - mov r9, r0 - adds r6, r2, 0 - lsls r1, 24 - lsrs r1, 24 - str r1, [sp, 0x4] - mov r4, sp - adds r4, 0x1 - mov r5, sp - adds r5, 0x2 - mov r0, sp - adds r1, r4, 0 - adds r2, r5, 0 - bl save_remo_colors - movs r0, 0x1 - str r0, [sp, 0x8] - movs r0, 0 - str r0, [sp, 0xC] - movs r0, 0x3 - mov r10, r0 - movs r0, 0x1 - movs r1, 0 - movs r2, 0x3 - bl GenerateFontHalfRowLut - adds r7, r6, 0 - movs r6, 0 -_08006182: - adds r0, r7, r6 - ldrb r0, [r0] - mov r8, r0 - adds r6, 0x1 - subs r0, 0xF7 - cmp r0, 0x8 - bhi _0800627E - lsls r0, 2 - ldr r1, =_080061A0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 - .pool - .align 2, 0 -_080061A0: - .4byte _08006276 - .4byte _08006276 - .4byte _08006276 - .4byte _080062B8 - .4byte _080062B8 - .4byte _080061C4 - .4byte _08006276 - .4byte _080062B8 - .4byte _080062B8 -_080061C4: - adds r0, r7, r6 - ldrb r0, [r0] - adds r6, 0x1 - subs r0, 0x1 - cmp r0, 0x15 - bhi _080062B8 - lsls r0, 2 - ldr r1, =_080061E0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 - .pool - .align 2, 0 -_080061E0: - .4byte _0800624A - .4byte _08006254 - .4byte _0800625C - .4byte _08006238 - .4byte _08006276 - .4byte _08006270 - .4byte _080062B8 - .4byte _08006276 - .4byte _080062B8 - .4byte _080062B8 - .4byte _0800627A - .4byte _08006276 - .4byte _08006276 - .4byte _08006276 - .4byte _080062B8 - .4byte _0800627A - .4byte _08006276 - .4byte _08006276 - .4byte _08006276 - .4byte _08006276 - .4byte _080062B8 - .4byte _080062B8 -_08006238: - adds r0, r7, r6 - ldrb r0, [r0] - str r0, [sp, 0x8] - adds r6, 0x1 - adds r0, r7, r6 - ldrb r0, [r0] - str r0, [sp, 0xC] - adds r6, 0x1 - b _0800625C -_0800624A: - adds r0, r7, r6 - ldrb r0, [r0] - str r0, [sp, 0x8] - adds r6, 0x1 - b _08006266 -_08006254: - adds r0, r7, r6 - ldrb r0, [r0] - str r0, [sp, 0xC] - b _08006262 -_0800625C: - adds r0, r7, r6 - ldrb r0, [r0] - mov r10, r0 -_08006262: - adds r6, 0x1 - ldr r0, [sp, 0x8] -_08006266: - ldr r1, [sp, 0xC] - mov r2, r10 - bl GenerateFontHalfRowLut - b _080062B8 -_08006270: - adds r0, r7, r6 - ldrb r0, [r0] - str r0, [sp, 0x4] -_08006276: - adds r6, 0x1 - b _080062B8 -_0800627A: - adds r6, 0x1 - b _08006276 -_0800627E: - ldr r0, [sp, 0x4] - cmp r0, 0x1 - beq _08006290 - cmp r0, 0x9 - bne _08006290 - mov r0, r8 - bl Text_DecompressGlyphFont9 - b _08006298 -_08006290: - mov r0, r8 - movs r1, 0x1 - bl Text_DecompressGlyphFont1 -_08006298: - ldr r4, =0x03002f90 - ldr r5, =0x04000008 - adds r0, r4, 0 - mov r1, r9 - adds r2, r5, 0 - bl CpuSet - adds r4, 0x40 - mov r1, r9 - adds r1, 0x20 - adds r0, r4, 0 - adds r2, r5, 0 - bl CpuSet - movs r0, 0x40 - add r9, r0 -_080062B8: - mov r0, r8 - cmp r0, 0xFF - beq _080062C0 - b _08006182 -_080062C0: - mov r0, sp - mov r1, sp - adds r1, 0x1 - mov r2, sp - adds r2, 0x2 - bl restore_remo_colors - movs r0, 0x1 - add sp, 0x10 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end font_render_some - - thumb_func_start TextBox_DrawKeypadIcon -TextBox_DrawKeypadIcon: @ 80062E8 - push {r4,r5,lr} - sub sp, 0x18 - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsls r2, 16 - lsrs r2, 16 - lsls r3, 16 - lsrs r3, 16 - ldr r4, =0x082e9d5c - lsrs r1, 22 - adds r1, r4 - ldrh r5, [r1] - lsls r5, 5 - ldr r4, =0x082e9d90 - adds r5, r4 - movs r4, 0x80 - str r4, [sp] - str r4, [sp, 0x4] - str r2, [sp, 0x8] - str r3, [sp, 0xC] - ldrb r4, [r1, 0x2] - str r4, [sp, 0x10] - ldrb r1, [r1, 0x3] - str r1, [sp, 0x14] - adds r1, r5, 0 - movs r2, 0 - movs r3, 0 - bl Window_CopyPixelRectToWindow - adds r0, r4, 0 - add sp, 0x18 - pop {r4,r5} - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end TextBox_DrawKeypadIcon - - thumb_func_start sub_8006338 -sub_8006338: @ 8006338 - lsls r0, 24 - ldr r1, =0x082e9d5c - lsrs r0, 22 - adds r0, r1 - ldrb r0, [r0] - bx lr - .align 2, 0 - .pool - thumb_func_end sub_8006338 - - thumb_func_start Font_ReturnsValueFromLUT -Font_ReturnsValueFromLUT: @ 8006348 - lsls r0, 24 - ldr r1, =0x082e9d5c - lsrs r0, 22 - adds r0, r1 - ldrb r0, [r0, 0x2] - bx lr - .align 2, 0 - .pool - thumb_func_end Font_ReturnsValueFromLUT - - thumb_func_start sub_8006358 -sub_8006358: @ 8006358 - lsls r0, 24 - ldr r1, =0x082e9d5c - lsrs r0, 22 - adds r0, r1 - ldrb r0, [r0, 0x3] - bx lr - .align 2, 0 - .pool - thumb_func_end sub_8006358 - - thumb_func_start fboxes_set_default_ptr -fboxes_set_default_ptr: @ 8006368 - push {lr} - ldr r0, =0x082ea590 - bl fboxes_set_ptr - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end fboxes_set_default_ptr - - thumb_func_start fbox_get_field -fbox_get_field: @ 8006378 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - lsls r1, 24 - lsrs r1, 24 - movs r0, 0 - cmp r1, 0x7 - bhi _08006456 - lsls r0, r1, 2 - ldr r1, =_08006398 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 - .pool - .align 2, 0 -_08006398: - .4byte _080063B8 - .4byte _080063CC - .4byte _080063E0 - .4byte _080063F4 - .4byte _08006408 - .4byte _0800641C - .4byte _08006430 - .4byte _08006448 -_080063B8: - ldr r1, =0x082ea590 - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r0, [r0, 0x4] - b _08006456 - .align 2, 0 - .pool -_080063CC: - ldr r1, =0x082ea590 - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r0, [r0, 0x5] - b _08006456 - .align 2, 0 - .pool -_080063E0: - ldr r1, =0x082ea590 - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r0, [r0, 0x6] - b _08006456 - .align 2, 0 - .pool -_080063F4: - ldr r1, =0x082ea590 - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r0, [r0, 0x7] - b _08006456 - .align 2, 0 - .pool -_08006408: - ldr r0, =0x082ea590 - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1, 0x8] - b _0800643C - .align 2, 0 - .pool -_0800641C: - ldr r0, =0x082ea590 - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1, 0x8] - b _08006454 - .align 2, 0 - .pool -_08006430: - ldr r0, =0x082ea590 - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1, 0x9] -_0800643C: - lsls r0, 28 - lsrs r0, 28 - b _08006456 - .align 2, 0 - .pool -_08006448: - ldr r0, =0x082ea590 - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1, 0x9] -_08006454: - lsrs r0, 4 -_08006456: - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end fbox_get_field - - thumb_func_start sub_8006460 -sub_8006460: @ 8006460 - lsls r0, 24 - lsls r1, 24 - lsrs r1, 24 - ldr r2, =0x082ea608 - lsrs r0, 23 - adds r1, r0 - adds r1, r2 - ldrb r0, [r1] - bx lr - .align 2, 0 - .pool - thumb_func_end sub_8006460 - - thumb_func_start Text_DecompressGlyphFont0 -Text_DecompressGlyphFont0: @ 8006478 - push {r4,r5,lr} - lsls r0, 16 - lsrs r3, r0, 16 - cmp r1, 0x1 - bne _080064C4 - lsrs r2, r0, 20 - lsls r2, 9 - movs r0, 0xF - ands r0, r3 - lsls r0, 4 - ldr r1, =0x086544e4 - adds r0, r1 - adds r5, r2, r0 - ldr r4, =0x03002f90 - adds r0, r5, 0 - adds r1, r4, 0 - bl font_render_sub - movs r1, 0x80 - lsls r1, 1 - adds r0, r5, r1 - adds r1, r4, 0 - adds r1, 0x40 - bl font_render_sub - adds r1, r4, 0 - adds r1, 0x80 - movs r0, 0x8 - strb r0, [r1] - adds r4, 0x81 - movs r0, 0xC - strb r0, [r4] - b _08006534 - .align 2, 0 - .pool -_080064C4: - lsls r1, r3, 6 - ldr r0, =0x08633ce4 - adds r5, r1, r0 - ldr r4, =0x03002f90 - ldr r0, =0x0863bce4 - adds r0, r3, r0 - ldrb r1, [r0] - adds r0, r4, 0 - adds r0, 0x80 - strb r1, [r0] - cmp r1, 0x8 - bhi _08006500 - adds r0, r5, 0 - adds r1, r4, 0 - bl font_render_sub - adds r0, r5, 0 - adds r0, 0x20 - adds r1, r4, 0 - adds r1, 0x40 - bl font_render_sub - b _0800652C - .align 2, 0 - .pool -_08006500: - adds r0, r5, 0 - adds r1, r4, 0 - bl font_render_sub - adds r0, r5, 0 - adds r0, 0x10 - adds r1, r4, 0 - adds r1, 0x20 - bl font_render_sub - adds r0, r5, 0 - adds r0, 0x20 - adds r1, r4, 0 - adds r1, 0x40 - bl font_render_sub - adds r0, r5, 0 - adds r0, 0x30 - adds r1, r4, 0 - adds r1, 0x60 - bl font_render_sub -_0800652C: - ldr r0, =0x03002f90 - adds r0, 0x81 - movs r1, 0xD - strb r1, [r0] -_08006534: - pop {r4,r5} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end Text_DecompressGlyphFont0 - - thumb_func_start get_font_width_unk3 -get_font_width_unk3: @ 8006540 - push {lr} - lsls r0, 16 - lsrs r2, r0, 16 - cmp r1, 0x1 - beq _08006558 - ldr r0, =0x0863bce4 - adds r0, r2, r0 - ldrb r0, [r0] - b _0800655A - .align 2, 0 - .pool -_08006558: - movs r0, 0x8 -_0800655A: - pop {r1} - bx r1 - thumb_func_end get_font_width_unk3 - - thumb_func_start Text_DecompressGlyphFont7 -Text_DecompressGlyphFont7: @ 8006560 - push {r4-r6,lr} - lsls r0, 16 - lsrs r3, r0, 16 - cmp r1, 0x1 - bne _080065AC - lsrs r2, r0, 20 - lsls r2, 9 - movs r5, 0xF - adds r0, r3, 0 - ands r0, r5 - lsls r0, 4 - ldr r1, =0x086584e4 - adds r0, r1 - adds r6, r2, r0 - ldr r4, =0x03002f90 - adds r0, r6, 0 - adds r1, r4, 0 - bl font_render_sub - movs r1, 0x80 - lsls r1, 1 - adds r0, r6, r1 - adds r1, r4, 0 - adds r1, 0x40 - bl font_render_sub - adds r1, r4, 0 - adds r1, 0x80 - movs r0, 0x8 - strb r0, [r1] - adds r4, 0x81 - strb r5, [r4] - b _0800661C - .align 2, 0 - .pool -_080065AC: - lsls r1, r3, 6 - ldr r0, =0x0863bee4 - adds r6, r1, r0 - ldr r4, =0x03002f90 - ldr r0, =0x08643ee4 - adds r0, r3, r0 - ldrb r1, [r0] - adds r0, r4, 0 - adds r0, 0x80 - strb r1, [r0] - cmp r1, 0x8 - bhi _080065E8 - adds r0, r6, 0 - adds r1, r4, 0 - bl font_render_sub - adds r0, r6, 0 - adds r0, 0x20 - adds r1, r4, 0 - adds r1, 0x40 - bl font_render_sub - b _08006614 - .align 2, 0 - .pool -_080065E8: - adds r0, r6, 0 - adds r1, r4, 0 - bl font_render_sub - adds r0, r6, 0 - adds r0, 0x10 - adds r1, r4, 0 - adds r1, 0x20 - bl font_render_sub - adds r0, r6, 0 - adds r0, 0x20 - adds r1, r4, 0 - adds r1, 0x40 - bl font_render_sub - adds r0, r6, 0 - adds r0, 0x30 - adds r1, r4, 0 - adds r1, 0x60 - bl font_render_sub -_08006614: - ldr r0, =0x03002f90 - adds r0, 0x81 - movs r1, 0xF - strb r1, [r0] -_0800661C: - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end Text_DecompressGlyphFont7 - - thumb_func_start get_font_width_black_en -get_font_width_black_en: @ 8006628 - push {lr} - lsls r0, 16 - lsrs r2, r0, 16 - cmp r1, 0x1 - beq _08006640 - ldr r0, =0x08643ee4 - adds r0, r2, r0 - ldrb r0, [r0] - b _08006642 - .align 2, 0 - .pool -_08006640: - movs r0, 0x8 -_08006642: - pop {r1} - bx r1 - thumb_func_end get_font_width_black_en - - thumb_func_start Text_DecompressGlyphFont8 -Text_DecompressGlyphFont8: @ 8006648 - push {r4,r5,lr} - lsls r0, 16 - lsrs r3, r0, 16 - cmp r1, 0x1 - bne _08006694 - lsrs r2, r0, 20 - lsls r2, 9 - movs r0, 0xF - ands r0, r3 - lsls r0, 4 - ldr r1, =0x086544e4 - adds r0, r1 - adds r5, r2, r0 - ldr r4, =0x03002f90 - adds r0, r5, 0 - adds r1, r4, 0 - bl font_render_sub - movs r1, 0x80 - lsls r1, 1 - adds r0, r5, r1 - adds r1, r4, 0 - adds r1, 0x40 - bl font_render_sub - adds r1, r4, 0 - adds r1, 0x80 - movs r0, 0x8 - strb r0, [r1] - adds r4, 0x81 - movs r0, 0xC - strb r0, [r4] - b _08006704 - .align 2, 0 - .pool -_08006694: - lsls r1, r3, 6 - ldr r0, =0x0862bae4 - adds r5, r1, r0 - ldr r4, =0x03002f90 - ldr r0, =0x08633ae4 - adds r0, r3, r0 - ldrb r1, [r0] - adds r0, r4, 0 - adds r0, 0x80 - strb r1, [r0] - cmp r1, 0x8 - bhi _080066D0 - adds r0, r5, 0 - adds r1, r4, 0 - bl font_render_sub - adds r0, r5, 0 - adds r0, 0x20 - adds r1, r4, 0 - adds r1, 0x40 - bl font_render_sub - b _080066FC - .align 2, 0 - .pool -_080066D0: - adds r0, r5, 0 - adds r1, r4, 0 - bl font_render_sub - adds r0, r5, 0 - adds r0, 0x10 - adds r1, r4, 0 - adds r1, 0x20 - bl font_render_sub - adds r0, r5, 0 - adds r0, 0x20 - adds r1, r4, 0 - adds r1, 0x40 - bl font_render_sub - adds r0, r5, 0 - adds r0, 0x30 - adds r1, r4, 0 - adds r1, 0x60 - bl font_render_sub -_080066FC: - ldr r0, =0x03002f90 - adds r0, 0x81 - movs r1, 0xC - strb r1, [r0] -_08006704: - pop {r4,r5} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end Text_DecompressGlyphFont8 - - thumb_func_start get_font_width_unk2 -get_font_width_unk2: @ 8006710 - push {lr} - lsls r0, 16 - lsrs r2, r0, 16 - cmp r1, 0x1 - beq _08006728 - ldr r0, =0x08633ae4 - adds r0, r2, r0 - ldrb r0, [r0] - b _0800672A - .align 2, 0 - .pool -_08006728: - movs r0, 0x8 -_0800672A: - pop {r1} - bx r1 - thumb_func_end get_font_width_unk2 - - thumb_func_start Text_DecompressGlyphFont2 -Text_DecompressGlyphFont2: @ 8006730 - push {r4-r6,lr} - lsls r0, 16 - lsrs r6, r0, 16 - cmp r1, 0x1 - bne _080067A0 - lsrs r2, r0, 19 - lsls r2, 9 - movs r0, 0x7 - ands r0, r6 - lsls r0, 5 - ldr r1, =0x0866c8e4 - adds r0, r1 - adds r4, r2, r0 - ldr r5, =0x03002f90 - adds r0, r4, 0 - adds r1, r5, 0 - bl font_render_sub - adds r0, r4, 0 - adds r0, 0x10 - adds r1, r5, 0 - adds r1, 0x20 - bl font_render_sub - movs r1, 0x80 - lsls r1, 1 - adds r0, r4, r1 - adds r1, r5, 0 - adds r1, 0x40 - bl font_render_sub - movs r1, 0x88 - lsls r1, 1 - adds r0, r4, r1 - adds r1, r5, 0 - adds r1, 0x60 - bl font_render_sub - ldr r0, =0x086748e4 - adds r0, r6, r0 - ldrb r1, [r0] - adds r0, r5, 0 - adds r0, 0x80 - strb r1, [r0] - adds r1, r5, 0 - adds r1, 0x81 - movs r0, 0xE - strb r0, [r1] - b _08006810 - .align 2, 0 - .pool -_080067A0: - lsls r1, r6, 6 - ldr r0, =0x086440e4 - adds r4, r1, r0 - ldr r5, =0x03002f90 - ldr r0, =0x0864c0e4 - adds r0, r6, r0 - ldrb r1, [r0] - adds r0, r5, 0 - adds r0, 0x80 - strb r1, [r0] - cmp r1, 0x8 - bhi _080067DC - adds r0, r4, 0 - adds r1, r5, 0 - bl font_render_sub - adds r0, r4, 0 - adds r0, 0x20 - adds r1, r5, 0 - adds r1, 0x40 - bl font_render_sub - b _08006808 - .align 2, 0 - .pool -_080067DC: - adds r0, r4, 0 - adds r1, r5, 0 - bl font_render_sub - adds r0, r4, 0 - adds r0, 0x10 - adds r1, r5, 0 - adds r1, 0x20 - bl font_render_sub - adds r0, r4, 0 - adds r0, 0x20 - adds r1, r5, 0 - adds r1, 0x40 - bl font_render_sub - adds r0, r4, 0 - adds r0, 0x30 - adds r1, r5, 0 - adds r1, 0x60 - bl font_render_sub -_08006808: - ldr r0, =0x03002f90 - adds r0, 0x81 - movs r1, 0xE - strb r1, [r0] -_08006810: - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end Text_DecompressGlyphFont2 - - thumb_func_start get_font_width_unk -get_font_width_unk: @ 800681C - push {lr} - lsls r0, 16 - lsrs r2, r0, 16 - cmp r1, 0x1 - beq _08006830 - ldr r0, =0x0864c0e4 - b _08006832 - .align 2, 0 - .pool -_08006830: - ldr r0, =0x086748e4 -_08006832: - adds r0, r2, r0 - ldrb r0, [r0] - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end get_font_width_unk - - thumb_func_start Text_DecompressGlyphFont1 -Text_DecompressGlyphFont1: @ 8006840 - push {r4-r6,lr} - lsls r0, 16 - lsrs r3, r0, 16 - cmp r1, 0x1 - bne _0800688C - lsrs r2, r0, 20 - lsls r2, 9 - movs r5, 0xF - adds r0, r3, 0 - ands r0, r5 - lsls r0, 4 - ldr r1, =0x086584e4 - adds r0, r1 - adds r6, r2, r0 - ldr r4, =0x03002f90 - adds r0, r6, 0 - adds r1, r4, 0 - bl font_render_sub - movs r1, 0x80 - lsls r1, 1 - adds r0, r6, r1 - adds r1, r4, 0 - adds r1, 0x40 - bl font_render_sub - adds r1, r4, 0 - adds r1, 0x80 - movs r0, 0x8 - strb r0, [r1] - adds r4, 0x81 - strb r5, [r4] - b _080068FC - .align 2, 0 - .pool -_0800688C: - lsls r1, r3, 6 - ldr r0, =0x0864c2e4 - adds r6, r1, r0 - ldr r4, =0x03002f90 - ldr r0, =0x086542e4 - adds r0, r3, r0 - ldrb r1, [r0] - adds r0, r4, 0 - adds r0, 0x80 - strb r1, [r0] - cmp r1, 0x8 - bhi _080068C8 - adds r0, r6, 0 - adds r1, r4, 0 - bl font_render_sub - adds r0, r6, 0 - adds r0, 0x20 - adds r1, r4, 0 - adds r1, 0x40 - bl font_render_sub - b _080068F4 - .align 2, 0 - .pool -_080068C8: - adds r0, r6, 0 - adds r1, r4, 0 - bl font_render_sub - adds r0, r6, 0 - adds r0, 0x10 - adds r1, r4, 0 - adds r1, 0x20 - bl font_render_sub - adds r0, r6, 0 - adds r0, 0x20 - adds r1, r4, 0 - adds r1, 0x40 - bl font_render_sub - adds r0, r6, 0 - adds r0, 0x30 - adds r1, r4, 0 - adds r1, 0x60 - bl font_render_sub -_080068F4: - ldr r0, =0x03002f90 - adds r0, 0x81 - movs r1, 0xF - strb r1, [r0] -_080068FC: - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end Text_DecompressGlyphFont1 - - thumb_func_start get_font_width_red_en_jp -get_font_width_red_en_jp: @ 8006908 - push {lr} - lsls r0, 16 - lsrs r2, r0, 16 - cmp r1, 0x1 - beq _08006920 - ldr r0, =0x086542e4 - adds r0, r2, r0 - ldrb r0, [r0] - b _08006922 - .align 2, 0 - .pool -_08006920: - movs r0, 0x8 -_08006922: - pop {r1} - bx r1 - thumb_func_end get_font_width_red_en_jp - - thumb_func_start Text_DecompressGlyphFont9 -Text_DecompressGlyphFont9: @ 8006928 - push {r4,r5,lr} - lsls r0, 16 - lsrs r4, r0, 20 - lsls r4, 9 - movs r1, 0xF0 - lsls r1, 12 - ands r1, r0 - lsrs r1, 12 - ldr r0, =0x082ea61c - adds r1, r0 - adds r4, r1 - ldr r5, =0x03002f90 - adds r0, r4, 0 - adds r1, r5, 0 - bl font_render_sub - movs r0, 0x80 - lsls r0, 1 - adds r4, r0 - adds r1, r5, 0 - adds r1, 0x40 - adds r0, r4, 0 - bl font_render_sub - adds r1, r5, 0 - adds r1, 0x80 - movs r0, 0x8 - strb r0, [r1] - adds r5, 0x81 - movs r0, 0xC - strb r0, [r5] - pop {r4,r5} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end Text_DecompressGlyphFont9 - - thumb_func_start reset_all_obj_data -reset_all_obj_data: @ 8006974 - push {r4,lr} - movs r0, 0 - movs r1, 0x80 - bl reset_super_sprites - bl obj_delete_all - bl copy_queue_clear - bl rotscale_reset_all - bl gpu_tile_obj_tags_reset - ldr r1, =0x02021b38 - movs r0, 0x40 - strb r0, [r1] - ldr r0, =0x02021b3a - movs r4, 0 - strh r4, [r0] - movs r0, 0 - bl gpu_tile_obj_alloc - ldr r0, =0x02021bbc - strh r4, [r0] - ldr r0, =0x02021bbe - strh r4, [r0] - pop {r4} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end reset_all_obj_data - - thumb_func_start call_obj_callbacks -call_obj_callbacks: @ 80069C0 - push {r4-r7,lr} - movs r6, 0 - movs r7, 0x1 -_080069C6: - lsls r0, r6, 4 - adds r0, r6 - lsls r0, 2 - ldr r1, =0x02020630 - adds r4, r0, r1 - adds r5, r4, 0 - adds r5, 0x3E - ldrb r1, [r5] - adds r0, r7, 0 - ands r0, r1 - cmp r0, 0 - beq _080069F6 - ldr r1, [r4, 0x1C] - adds r0, r4, 0 - bl _call_via_r1 - ldrb r1, [r5] - adds r0, r7, 0 - ands r0, r1 - cmp r0, 0 - beq _080069F6 - adds r0, r4, 0 - bl obj_anim_step -_080069F6: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x3F - bls _080069C6 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end call_obj_callbacks - - thumb_func_start obj_sync_something -obj_sync_something: @ 8006A0C - push {r4,r5,lr} - bl update_obj_oam_coords - bl do_something_with_obj_priorites - bl determine_visible_sprites_maybe - ldr r5, =0x030022c0 - ldr r0, =0x00000439 - adds r5, r0 - ldrb r0, [r5] - lsls r4, r0, 31 - lsrs r4, 31 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r5] - bl super_sprites_fill - bl copy_rotscale_coeffs_to_super_sprites - movs r2, 0x1 - ldrb r1, [r5] - movs r0, 0x2 - negs r0, r0 - ands r0, r1 - orrs r4, r0 - strb r4, [r5] - ldr r0, =0x02021834 - strb r2, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end obj_sync_something - - thumb_func_start update_obj_oam_coords -update_obj_oam_coords: @ 8006A58 - push {r4-r7,lr} - movs r4, 0 - ldr r7, =0x02020630 - ldr r0, =0x000001ff - adds r5, r0, 0 - ldr r6, =0xfffffe00 -_08006A64: - lsls r0, r4, 4 - adds r0, r4 - lsls r0, 2 - adds r3, r0, r7 - adds r0, r3, 0 - adds r0, 0x3E - ldrb r1, [r0] - movs r0, 0x5 - ands r0, r1 - cmp r0, 0x1 - bne _08006B0A - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08006AD8 - movs r2, 0x20 - ldrsh r1, [r3, r2] - movs r2, 0x24 - ldrsh r0, [r3, r2] - adds r1, r0 - adds r0, r3, 0 - adds r0, 0x28 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - adds r1, r0 - ldr r0, =0x02021bbc - movs r2, 0 - ldrsh r0, [r0, r2] - adds r1, r0 - ands r1, r5 - ldrh r2, [r3, 0x2] - adds r0, r6, 0 - ands r0, r2 - orrs r0, r1 - strh r0, [r3, 0x2] - ldrh r1, [r3, 0x26] - ldrh r0, [r3, 0x22] - adds r1, r0 - adds r0, r3, 0 - adds r0, 0x29 - ldrb r0, [r0] - ldr r2, =0x02021bbe - adds r0, r1 - ldrb r2, [r2] - adds r0, r2 - b _08006B08 - .align 2, 0 - .pool -_08006AD8: - movs r2, 0x20 - ldrsh r1, [r3, r2] - movs r2, 0x24 - ldrsh r0, [r3, r2] - adds r1, r0 - adds r0, r3, 0 - adds r0, 0x28 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - adds r1, r0 - ands r1, r5 - ldrh r2, [r3, 0x2] - adds r0, r6, 0 - ands r0, r2 - orrs r0, r1 - strh r0, [r3, 0x2] - ldrh r1, [r3, 0x26] - ldrh r0, [r3, 0x22] - adds r1, r0 - adds r0, r3, 0 - adds r0, 0x29 - ldrb r0, [r0] - adds r0, r1 -_08006B08: - strb r0, [r3] -_08006B0A: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3F - bls _08006A64 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end update_obj_oam_coords - - thumb_func_start do_something_with_obj_priorites -do_something_with_obj_priorites: @ 8006B1C - push {r4,lr} - movs r2, 0 - ldr r4, =0x02020630 - ldr r3, =0x02021774 -_08006B24: - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - adds r0, r4 - adds r1, r0, 0 - adds r1, 0x43 - ldrb r1, [r1] - ldrb r0, [r0, 0x5] - lsls r0, 28 - lsrs r0, 30 - lsls r0, 8 - orrs r1, r0 - lsls r0, r2, 1 - adds r0, r3 - strh r1, [r0] - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0x3F - bls _08006B24 - pop {r4} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end do_something_with_obj_priorites - - thumb_func_start determine_visible_sprites_maybe -determine_visible_sprites_maybe: @ 8006B5C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - movs r0, 0x1 - mov r12, r0 - ldr r1, =0x020217f4 - mov r10, r1 - ldr r3, =0xffffff00 - mov r9, r3 - ldr r6, =0xc0000300 - mov r8, r6 -_08006B78: - mov r5, r12 - mov r0, r12 - subs r0, 0x1 - add r0, r10 - ldrb r2, [r0] - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - ldr r7, =0x02020630 - adds r3, r0, r7 - mov r0, r12 - add r0, r10 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, r0, r7 - lsls r2, 1 - ldr r0, =0x02021774 - adds r2, r0 - ldrh r2, [r2] - str r2, [sp] - lsls r1, 1 - adds r1, r0 - ldrh r6, [r1] - ldrb r1, [r3] - ldrb r2, [r4] - adds r0, r1, 0 - cmp r0, 0x9F - ble _08006BBA - add r0, r9 - lsls r0, 16 - lsrs r1, r0, 16 -_08006BBA: - lsls r0, r2, 16 - asrs r0, 16 - cmp r0, 0x9F - ble _08006BC8 - add r0, r9 - lsls r0, 16 - lsrs r2, r0, 16 -_08006BC8: - ldr r0, [r3] - mov r7, r8 - ands r0, r7 - cmp r0, r8 - bne _08006BEC - ldrb r0, [r3, 0x1] - lsrs r0, 6 - cmp r0, 0 - beq _08006BDE - cmp r0, 0x2 - bne _08006BEC -_08006BDE: - lsls r0, r1, 16 - asrs r0, 16 - cmp r0, 0x80 - ble _08006BEC - add r0, r9 - lsls r0, 16 - lsrs r1, r0, 16 -_08006BEC: - ldr r0, [r4] - mov r3, r8 - ands r0, r3 - cmp r0, r8 - bne _08006C10 - ldrb r0, [r4, 0x1] - lsrs r0, 6 - cmp r0, 0 - beq _08006C02 - cmp r0, 0x2 - bne _08006C10 -_08006C02: - lsls r0, r2, 16 - asrs r0, 16 - cmp r0, 0x80 - ble _08006C10 - add r0, r9 - lsls r0, 16 - lsrs r2, r0, 16 -_08006C10: - movs r7, 0x1 - add r12, r7 - cmp r5, 0 - beq _08006CF6 - ldr r0, [sp] - cmp r0, r6 - bhi _08006C38 - cmp r0, r6 - bne _08006CF6 - b _08006CEE - .align 2, 0 - .pool -_08006C38: - mov r1, r10 - adds r3, r5, r1 - ldrb r4, [r3] - subs r2, r5, 0x1 - adds r1, r2, r1 - ldrb r0, [r1] - strb r0, [r3] - strb r4, [r1] - lsls r2, 24 - lsrs r5, r2, 24 - subs r0, r5, 0x1 - add r0, r10 - ldrb r2, [r0] - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - ldr r6, =0x02020630 - adds r3, r0, r6 - mov r7, r10 - adds r0, r5, r7 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, r0, r6 - lsls r2, 1 - ldr r0, =0x02021774 - adds r2, r0 - ldrh r2, [r2] - str r2, [sp] - lsls r1, 1 - adds r1, r0 - ldrh r6, [r1] - ldrb r1, [r3] - ldrb r2, [r4] - adds r0, r1, 0 - cmp r0, 0x9F - ble _08006C8A - add r0, r9 - lsls r0, 16 - lsrs r1, r0, 16 -_08006C8A: - lsls r0, r2, 16 - asrs r0, 16 - cmp r0, 0x9F - ble _08006C98 - add r0, r9 - lsls r0, 16 - lsrs r2, r0, 16 -_08006C98: - ldr r0, [r3] - mov r7, r8 - ands r0, r7 - cmp r0, r8 - bne _08006CBC - ldrb r0, [r3, 0x1] - lsrs r0, 6 - cmp r0, 0 - beq _08006CAE - cmp r0, 0x2 - bne _08006CBC -_08006CAE: - lsls r0, r1, 16 - asrs r0, 16 - cmp r0, 0x80 - ble _08006CBC - add r0, r9 - lsls r0, 16 - lsrs r1, r0, 16 -_08006CBC: - ldr r0, [r4] - mov r3, r8 - ands r0, r3 - cmp r0, r8 - bne _08006CE0 - ldrb r0, [r4, 0x1] - lsrs r0, 6 - cmp r0, 0 - beq _08006CD2 - cmp r0, 0x2 - bne _08006CE0 -_08006CD2: - lsls r0, r2, 16 - asrs r0, 16 - cmp r0, 0x80 - ble _08006CE0 - add r0, r9 - lsls r0, 16 - lsrs r2, r0, 16 -_08006CE0: - cmp r5, 0 - beq _08006CF6 - ldr r7, [sp] - cmp r7, r6 - bhi _08006C38 - cmp r7, r6 - bne _08006CF6 -_08006CEE: - lsls r1, 16 - lsls r0, r2, 16 - cmp r1, r0 - blt _08006C38 -_08006CF6: - mov r1, r12 - lsls r0, r1, 24 - lsrs r0, 24 - mov r12, r0 - cmp r0, 0x3F - bhi _08006D04 - b _08006B78 -_08006D04: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end determine_visible_sprites_maybe - - thumb_func_start copy_rotscale_coeffs_to_super_sprites -copy_rotscale_coeffs_to_super_sprites: @ 8006D1C - push {r4-r6,lr} - movs r4, 0 - ldr r5, =0x030022c0 - ldr r6, =0x02021bc0 -_08006D24: - lsls r2, r4, 2 - lsls r1, r4, 5 - adds r1, r5 - lsls r3, r4, 3 - adds r3, r6 - ldrh r0, [r3] - strh r0, [r1, 0x3E] - adds r0, r2, 0x1 - lsls r0, 3 - adds r0, r5 - ldrh r1, [r3, 0x2] - strh r1, [r0, 0x3E] - adds r0, r2, 0x2 - lsls r0, 3 - adds r0, r5 - ldrh r1, [r3, 0x4] - strh r1, [r0, 0x3E] - adds r2, 0x3 - lsls r2, 3 - adds r2, r5 - ldrh r0, [r3, 0x6] - strh r0, [r2, 0x3E] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x1F - bls _08006D24 - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end copy_rotscale_coeffs_to_super_sprites - - thumb_func_start super_sprites_fill -super_sprites_fill: @ 8006D68 - push {r4-r6,lr} - sub sp, 0x4 - movs r4, 0 - mov r0, sp - strb r4, [r0] -_08006D72: - ldr r0, =0x020217f4 - adds r0, r4, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =0x02020630 - adds r2, r0, r1 - adds r0, r2, 0 - adds r0, 0x3E - ldrb r1, [r0] - movs r0, 0x5 - ands r0, r1 - cmp r0, 0x1 - bne _08006D9E - adds r0, r2, 0 - mov r1, sp - bl super_sprite_add - lsls r0, 24 - cmp r0, 0 - bne _08006DD8 -_08006D9E: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3F - bls _08006D72 - mov r0, sp - ldr r4, =0x02021b38 - ldrb r0, [r0] - ldrb r1, [r4] - cmp r0, r1 - bcs _08006DD8 - mov r1, sp - ldr r5, =0x030022f8 - ldr r0, =0x082ec690 - ldr r2, [r0] - ldr r3, [r0, 0x4] -_08006DBE: - ldrb r0, [r1] - lsls r0, 3 - adds r0, r5 - str r2, [r0] - str r3, [r0, 0x4] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - lsls r0, 24 - lsrs r0, 24 - ldrb r6, [r4] - cmp r0, r6 - bcc _08006DBE -_08006DD8: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end super_sprites_fill - - thumb_func_start obj_add_from_template_forward_search -obj_add_from_template_forward_search: @ 8006DF4 - push {r4-r7,lr} - sub sp, 0x4 - adds r7, r0, 0 - lsls r3, 24 - lsrs r4, r3, 24 - movs r3, 0 - ldr r0, =0x02020630 - mov r12, r0 - lsls r5, r1, 16 - lsls r6, r2, 16 -_08006E08: - lsls r0, r3, 4 - adds r0, r3 - lsls r0, 2 - add r0, r12 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 31 - cmp r0, 0 - bne _08006E34 - str r4, [sp] - adds r0, r3, 0 - adds r1, r7, 0 - asrs r2, r5, 16 - asrs r3, r6, 16 - bl template_read - lsls r0, 24 - lsrs r0, 24 - b _08006E40 - .align 2, 0 - .pool -_08006E34: - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x3F - bls _08006E08 - movs r0, 0x40 -_08006E40: - add sp, 0x4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end obj_add_from_template_forward_search - - thumb_func_start obj_add_from_template_backward_search -obj_add_from_template_backward_search: @ 8006E48 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x4 - adds r7, r0, 0 - lsls r3, 24 - lsrs r6, r3, 24 - movs r3, 0x3F - ldr r0, =0x02020630 - mov r8, r0 - movs r0, 0x1 - negs r0, r0 - mov r12, r0 - lsls r4, r1, 16 - lsls r5, r2, 16 -_08006E66: - lsls r0, r3, 16 - asrs r1, r0, 16 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - add r0, r8 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 31 - cmp r0, 0 - bne _08006E98 - lsls r0, r3, 24 - lsrs r0, 24 - str r6, [sp] - adds r1, r7, 0 - asrs r2, r4, 16 - asrs r3, r5, 16 - bl template_read - lsls r0, 24 - lsrs r0, 24 - b _08006EA6 - .align 2, 0 - .pool -_08006E98: - subs r0, r1, 0x1 - lsls r0, 16 - lsrs r3, r0, 16 - asrs r0, 16 - cmp r0, r12 - bgt _08006E66 - movs r0, 0x40 -_08006EA6: - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end obj_add_from_template_backward_search - - thumb_func_start obj_add_empty_with_callback -obj_add_empty_with_callback: @ 8006EB4 - push {r4-r6,lr} - adds r6, r0, 0 - ldr r0, =0x082ec6ac - movs r1, 0 - movs r2, 0 - movs r3, 0x1F - bl obj_add_from_template_forward_search - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x40 - beq _08006EF4 - ldr r4, =0x02020630 - lsls r1, r5, 4 - adds r1, r5 - lsls r1, 2 - adds r2, r1, r4 - adds r2, 0x3E - ldrb r0, [r2] - movs r3, 0x4 - orrs r0, r3 - strb r0, [r2] - adds r4, 0x1C - adds r1, r4 - str r6, [r1] - adds r0, r5, 0 - b _08006EF6 - .align 2, 0 - .pool -_08006EF4: - movs r0, 0x40 -_08006EF6: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end obj_add_empty_with_callback - - thumb_func_start template_read -template_read: @ 8006EFC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - mov r8, r1 - adds r5, r2, 0 - adds r6, r3, 0 - ldr r4, [sp, 0x20] - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - lsls r5, 16 - lsrs r5, 16 - lsls r6, 16 - lsrs r6, 16 - lsls r4, 24 - lsrs r4, 24 - lsls r0, 4 - add r0, r10 - lsls r0, 2 - ldr r1, =0x02020630 - adds r7, r0, r1 - adds r0, r7, 0 - bl obj_delete - adds r2, r7, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2] - movs r0, 0x3F - adds r0, r7 - mov r9, r0 - ldrb r0, [r0] - movs r1, 0x4 - orrs r0, r1 - movs r1, 0x8 - orrs r0, r1 - movs r1, 0x40 - orrs r0, r1 - mov r1, r9 - strb r0, [r1] - adds r0, r7, 0 - adds r0, 0x43 - strb r4, [r0] - mov r1, r8 - ldr r0, [r1, 0x4] - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [r7] - str r1, [r7, 0x4] - mov r1, r8 - ldr r0, [r1, 0x8] - str r0, [r7, 0x8] - ldr r0, [r1, 0x10] - str r0, [r7, 0x10] - str r1, [r7, 0x14] - ldr r0, [r1, 0x14] - str r0, [r7, 0x1C] - strh r5, [r7, 0x20] - strh r6, [r7, 0x22] - ldrb r3, [r7, 0x1] - lsrs r1, r3, 6 - ldrb r2, [r7, 0x3] - lsrs r2, 6 - lsls r3, 30 - lsrs r3, 30 - adds r0, r7, 0 - bl oam_center - mov r0, r8 - ldrh r1, [r0] - ldr r4, =0xffff0000 - lsrs r0, r4, 16 - cmp r1, r0 - bne _08006FF8 - mov r1, r8 - ldr r0, [r1, 0xC] - str r0, [r7, 0xC] - ldrh r0, [r0, 0x4] - lsrs r0, 5 - lsls r0, 24 - lsrs r0, 24 - bl gpu_tile_obj_alloc - lsls r0, 16 - lsrs r2, r0, 16 - asrs r0, 16 - asrs r1, r4, 16 - cmp r0, r1 - bne _08006FC8 - adds r0, r7, 0 - bl obj_delete - movs r0, 0x40 - b _08007040 - .align 2, 0 - .pool -_08006FC8: - ldr r1, =0x000003ff - adds r0, r1, 0 - ands r2, r0 - ldrh r1, [r7, 0x4] - ldr r0, =0xfffffc00 - ands r0, r1 - orrs r0, r2 - strh r0, [r7, 0x4] - mov r0, r9 - ldrb r1, [r0] - movs r0, 0x41 - negs r0, r0 - ands r0, r1 - mov r1, r9 - strb r0, [r1] - adds r1, r7, 0 - adds r1, 0x40 - movs r0, 0 - strh r0, [r1] - b _0800700C - .align 2, 0 - .pool -_08006FF8: - mov r1, r8 - ldrh r0, [r1] - bl gpu_tile_obj_tag_get_range_start - adds r1, r7, 0 - adds r1, 0x40 - strh r0, [r1] - adds r0, r7, 0 - bl sub_8008324 -_0800700C: - ldrb r0, [r7, 0x1] - lsls r0, 30 - lsrs r0, 30 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08007020 - adds r0, r7, 0 - bl obj_alloc_rotscale_entry -_08007020: - mov r0, r8 - ldrh r1, [r0, 0x2] - ldr r0, =0x0000ffff - cmp r1, r0 - beq _0800703E - mov r1, r8 - ldrh r0, [r1, 0x2] - bl gpu_pal_tags_index_of - lsls r0, 4 - ldrb r2, [r7, 0x5] - movs r1, 0xF - ands r1, r2 - orrs r1, r0 - strb r1, [r7, 0x5] -_0800703E: - mov r0, r10 -_08007040: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end template_read - - thumb_func_start obj_add_from_template_call_callback_once -obj_add_from_template_call_callback_once: @ 8007054 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - mov r10, r0 - lsls r3, 24 - lsrs r3, 24 - mov r9, r3 - movs r3, 0 - ldr r5, =0x02020630 - lsls r1, 16 - mov r12, r1 - lsls r2, 16 - mov r8, r2 -_08007074: - lsls r0, r3, 4 - adds r0, r3 - lsls r6, r0, 2 - adds r4, r6, r5 - adds r7, r4, 0 - adds r7, 0x3E - ldrb r0, [r7] - lsls r0, 31 - cmp r0, 0 - bne _080070CC - mov r0, r9 - str r0, [sp] - adds r0, r3, 0 - mov r1, r10 - mov r3, r12 - asrs r2, r3, 16 - mov r5, r8 - asrs r3, r5, 16 - bl template_read - lsls r0, 24 - lsrs r0, 24 - adds r5, r0, 0 - cmp r5, 0x40 - beq _080070D6 - ldr r1, =0x0202064c - adds r0, r6, r1 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - ldrb r0, [r7] - lsls r0, 31 - cmp r0, 0 - beq _080070C0 - adds r0, r4, 0 - bl obj_anim_step -_080070C0: - adds r0, r5, 0 - b _080070D8 - .align 2, 0 - .pool -_080070CC: - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x3F - bls _08007074 -_080070D6: - movs r0, 0x40 -_080070D8: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end obj_add_from_template_call_callback_once - - thumb_func_start obj_delete_and_free_tiles -obj_delete_and_free_tiles: @ 80070E8 - push {r4-r7,lr} - adds r5, r0, 0 - adds r0, 0x3E - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08007144 - adds r0, r5, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0800713E - ldr r0, [r5, 0xC] - ldrh r2, [r0, 0x4] - lsrs r2, 5 - ldrh r0, [r5, 0x4] - lsls r0, 22 - lsrs r1, r0, 22 - adds r4, r1, r2 - adds r3, r1, 0 - cmp r3, r4 - bcs _0800713E - ldr r0, =0x02021b3c - mov r12, r0 - movs r6, 0x7 - movs r7, 0x1 -_08007122: - lsrs r2, r3, 3 - add r2, r12 - adds r0, r3, 0 - ands r0, r6 - adds r1, r7, 0 - lsls r1, r0 - ldrb r0, [r2] - bics r0, r1 - strb r0, [r2] - adds r0, r3, 0x1 - lsls r0, 16 - lsrs r3, r0, 16 - cmp r3, r4 - bcc _08007122 -_0800713E: - adds r0, r5, 0 - bl obj_delete -_08007144: - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end obj_delete_and_free_tiles - - thumb_func_start reset_super_sprites -reset_super_sprites: @ 8007150 - push {r4-r6,lr} - lsls r0, 24 - lsls r1, 24 - lsrs r4, r1, 24 - lsrs r3, r0, 24 - cmp r3, r4 - bcs _08007178 - ldr r6, =0x030022f8 - ldr r5, =0x082ec690 -_08007162: - lsls r0, r3, 3 - adds r0, r6 - ldr r1, [r5] - ldr r2, [r5, 0x4] - str r1, [r0] - str r2, [r0, 0x4] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, r4 - bcc _08007162 -_08007178: - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end reset_super_sprites - - thumb_func_start copy_super_sprites_to_oam -copy_super_sprites_to_oam: @ 8007188 - push {lr} - ldr r2, =0x030022c0 - ldr r1, =0x00000439 - adds r0, r2, r1 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _080071A8 - adds r0, r2, 0 - adds r0, 0x38 - movs r1, 0xE0 - lsls r1, 19 - ldr r2, =0x04000100 - bl CpuSet -_080071A8: - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end copy_super_sprites_to_oam - - thumb_func_start copy_queue_clear -copy_queue_clear: @ 80071B8 - push {r4,r5,lr} - ldr r0, =0x02021834 - movs r1, 0 - strb r1, [r0] - ldr r0, =0x02021835 - strb r1, [r0] - movs r2, 0 - ldr r4, =0x02021838 - movs r3, 0 - adds r5, r4, 0x4 -_080071CC: - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r1, r0, r4 - str r3, [r1] - adds r0, r5 - str r3, [r0] - strh r3, [r1, 0x8] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x3F - bls _080071CC - pop {r4,r5} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end copy_queue_clear - - thumb_func_start reset_rotscale_coeffs -reset_rotscale_coeffs: @ 80071F8 - push {r4,lr} - movs r1, 0 - ldr r4, =0x02021bc0 - movs r3, 0 - movs r2, 0x80 - lsls r2, 1 -_08007204: - lsls r0, r1, 3 - adds r0, r4 - strh r2, [r0] - strh r3, [r0, 0x2] - strh r3, [r0, 0x4] - strh r2, [r0, 0x6] - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x1F - bls _08007204 - pop {r4} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end reset_rotscale_coeffs - - thumb_func_start rotscale_set_direct -rotscale_set_direct: @ 8007224 - push {r4,r5,lr} - ldr r5, [sp, 0xC] - lsls r0, 24 - ldr r4, =0x02021bc0 - lsrs r0, 21 - adds r0, r4 - strh r1, [r0] - strh r2, [r0, 0x2] - strh r3, [r0, 0x4] - strh r5, [r0, 0x6] - pop {r4,r5} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end rotscale_set_direct - - thumb_func_start obj_delete -obj_delete: @ 8007244 - push {lr} - ldr r1, =0x082ec64c - movs r2, 0x44 - bl memcpy - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end obj_delete - - thumb_func_start oam_center -oam_center: @ 8007258 - push {r4-r6,lr} - adds r6, r0, 0 - lsls r1, 24 - lsls r2, 24 - lsls r3, 24 - lsrs r3, 24 - ldr r4, =0x082ec634 - lsrs r2, 23 - lsrs r1, 21 - adds r2, r1 - adds r0, r2, r4 - ldrb r5, [r0] - adds r4, 0x1 - adds r2, r4 - ldrb r1, [r2] - movs r0, 0x2 - ands r3, r0 - cmp r3, 0 - beq _08007286 - lsls r0, r5, 25 - lsrs r5, r0, 24 - lsls r0, r1, 25 - lsrs r1, r0, 24 -_08007286: - adds r0, r6, 0 - adds r0, 0x28 - strb r5, [r0] - adds r0, 0x1 - strb r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end oam_center - - thumb_func_start gpu_tile_obj_alloc -gpu_tile_obj_alloc: @ 800729C - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0 - bne _080072F2 - ldr r0, =0x02021b3a - ldrh r3, [r0] - ldr r0, =0x000003ff - cmp r3, r0 - bhi _080072DA - ldr r7, =0x02021b3c - movs r6, 0x7 - adds r4, r0, 0 - movs r5, 0x1 -_080072BE: - lsrs r2, r3, 3 - adds r2, r7 - adds r0, r3, 0 - ands r0, r6 - adds r1, r5, 0 - lsls r1, r0 - ldrb r0, [r2] - bics r0, r1 - strb r0, [r2] - adds r0, r3, 0x1 - lsls r0, 16 - lsrs r3, r0, 16 - cmp r3, r4 - bls _080072BE -_080072DA: - movs r0, 0 - b _080073A4 - .align 2, 0 - .pool -_080072EC: - movs r0, 0x1 - negs r0, r0 - b _080073A4 -_080072F2: - ldr r0, =0x02021b3a - ldrh r3, [r0] - ldr r0, =0x02021b3c - mov r9, r0 - movs r7, 0x7 - movs r6, 0x1 -_080072FE: - lsrs r0, r3, 3 - add r0, r9 - ldrb r1, [r0] - adds r0, r3, 0 - ands r0, r7 - asrs r1, r0 - ands r1, r6 - cmp r1, 0 - beq _08007332 - movs r5, 0x80 - lsls r5, 3 - ldr r2, =0x02021b3c -_08007316: - adds r0, r3, 0x1 - lsls r0, 16 - lsrs r3, r0, 16 - cmp r3, r5 - beq _080072EC - lsrs r0, 19 - adds r0, r2 - ldrb r1, [r0] - adds r0, r3, 0 - ands r0, r7 - asrs r1, r0 - ands r1, r6 - cmp r1, 0 - bne _08007316 -_08007332: - mov r8, r3 - movs r2, 0x1 - cmp r2, r4 - beq _0800736C - movs r1, 0x80 - lsls r1, 3 - mov r12, r1 - ldr r5, =0x02021b3c -_08007342: - adds r0, r3, 0x1 - lsls r0, 16 - lsrs r3, r0, 16 - cmp r3, r12 - beq _080072EC - lsrs r0, 19 - adds r0, r5 - ldrb r1, [r0] - adds r0, r3, 0 - ands r0, r7 - asrs r1, r0 - ands r1, r6 - cmp r1, 0 - bne _08007368 - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, r4 - bne _08007342 -_08007368: - cmp r2, r4 - bne _080072FE -_0800736C: - mov r1, r8 - lsls r0, r1, 16 - lsrs r3, r0, 16 - asrs r1, r0, 16 - adds r1, r4, r1 - adds r6, r0, 0 - cmp r3, r1 - bge _080073A2 - ldr r0, =0x02021b3c - mov r8, r0 - movs r7, 0x7 - adds r4, r1, 0 - movs r5, 0x1 -_08007386: - lsrs r2, r3, 3 - add r2, r8 - adds r1, r3, 0 - ands r1, r7 - adds r0, r5, 0 - lsls r0, r1 - ldrb r1, [r2] - orrs r0, r1 - strb r0, [r2] - adds r0, r3, 0x1 - lsls r0, 16 - lsrs r3, r0, 16 - cmp r3, r4 - blt _08007386 -_080073A2: - asrs r0, r6, 16 -_080073A4: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end gpu_tile_obj_alloc - - thumb_func_start gpu_tile_obj_alloc_map_bit_op -gpu_tile_obj_alloc_map_bit_op: @ 80073B8 - push {r4-r6,lr} - lsls r0, 16 - lsrs r2, r0, 16 - lsls r1, 24 - lsrs r1, 24 - lsrs r0, 19 - lsls r0, 24 - lsrs r3, r0, 24 - adds r6, r3, 0 - movs r0, 0x7 - ands r2, r0 - adds r4, r2, 0 - movs r5, 0 - cmp r1, 0 - bne _080073F0 - movs r0, 0x1 - lsls r0, r2 - mvns r0, r0 - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =0x02021b3c - adds r0, r3, r0 - ldrb r1, [r0] - ands r2, r1 - strb r2, [r0] - b _0800741C - .align 2, 0 - .pool -_080073F0: - cmp r1, 0x1 - bne _0800740C - lsls r1, r2 - lsls r0, r1, 24 - lsrs r2, r0, 24 - ldr r0, =0x02021b3c - adds r0, r3, r0 - ldrb r1, [r0] - orrs r2, r1 - strb r2, [r0] - b _0800741C - .align 2, 0 - .pool -_0800740C: - movs r0, 0x80 - lsls r0, 17 - lsls r0, r4 - lsrs r5, r0, 24 - ldr r0, =0x02021b3c - adds r0, r6, r0 - ldrb r0, [r0] - ands r5, r0 -_0800741C: - adds r0, r5, 0 - pop {r4-r6} - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end gpu_tile_obj_alloc_map_bit_op - - thumb_func_start nullsub_12 -nullsub_12: @ 8007428 - bx lr - thumb_func_end nullsub_12 - - thumb_func_start copy_queue_process -copy_queue_process: @ 800742C - push {r4-r7,lr} - ldr r0, =0x02021834 - ldrb r0, [r0] - cmp r0, 0 - beq _08007474 - movs r4, 0 - ldr r1, =0x02021835 - ldrb r0, [r1] - cmp r0, 0 - beq _0800746E - ldr r6, =0x02021838 - adds r7, r6, 0x4 - adds r5, r1, 0 -_08007446: - lsls r1, r4, 1 - adds r1, r4 - lsls r1, 2 - adds r2, r1, r6 - ldr r0, [r2] - adds r1, r7 - ldr r1, [r1] - ldrh r2, [r2, 0x8] - lsrs r2, 1 - bl CpuSet - ldrb r1, [r5] - subs r1, 0x1 - strb r1, [r5] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - cmp r1, 0 - bne _08007446 -_0800746E: - ldr r1, =0x02021834 - movs r0, 0 - strb r0, [r1] -_08007474: - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end copy_queue_process - - thumb_func_start copy_queue_add_oam_frame -copy_queue_add_oam_frame: @ 8007488 - push {r4-r6,lr} - adds r5, r2, 0 - lsls r0, 16 - lsrs r2, r0, 16 - lsls r1, 16 - lsrs r6, r1, 16 - ldr r4, =0x02021835 - ldrb r0, [r4] - cmp r0, 0x3F - bhi _080074D8 - ldr r3, =0x02021838 - adds r1, r0, 0 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - lsls r2, 3 - adds r2, r5 - ldr r1, [r2] - str r1, [r0] - ldrb r0, [r4] - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r0, r3, 0x4 - adds r1, r0 - lsls r0, r6, 5 - ldr r5, =0x06010000 - adds r0, r5 - str r0, [r1] - ldrb r1, [r4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrh r1, [r2, 0x4] - strh r1, [r0, 0x8] - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] -_080074D8: - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end copy_queue_add_oam_frame - - thumb_func_start copy_queue_add -copy_queue_add: @ 80074EC - push {r4-r6,lr} - adds r4, r0, 0 - adds r5, r1, 0 - lsls r2, 16 - lsrs r6, r2, 16 - ldr r3, =0x02021835 - ldrb r0, [r3] - cmp r0, 0x3F - bhi _0800752C - ldr r2, =0x02021838 - adds r1, r0, 0 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - str r4, [r0] - ldrb r1, [r3] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r1, r2, 0x4 - adds r0, r1 - str r5, [r0] - ldrb r1, [r3] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strh r6, [r0, 0x8] - ldrb r0, [r3] - adds r0, 0x1 - strb r0, [r3] -_0800752C: - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end copy_queue_add - - thumb_func_start copy_all_from_objects -copy_all_from_objects: @ 800753C - push {r4,lr} - adds r1, r0, 0 - ldr r3, =0x02020630 - movs r2, 0 - ldr r4, =0x000010ff -_08007546: - ldrb r0, [r3] - strb r0, [r1] - adds r1, 0x1 - adds r3, 0x1 - adds r2, 0x1 - cmp r2, r4 - bls _08007546 - pop {r4} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end copy_all_from_objects - - thumb_func_start copy_all_to_objects -copy_all_to_objects: @ 8007564 - push {r4,lr} - adds r1, r0, 0 - ldr r3, =0x02020630 - movs r2, 0 - ldr r4, =0x000010ff -_0800756E: - ldrb r0, [r1] - strb r0, [r3] - adds r1, 0x1 - adds r3, 0x1 - adds r2, 0x1 - cmp r2, r4 - bls _0800756E - pop {r4} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end copy_all_to_objects - - thumb_func_start obj_delete_all -obj_delete_all: @ 800758C - push {r4,r5,lr} - movs r4, 0 -_08007590: - lsls r0, r4, 4 - adds r0, r4 - lsls r0, 2 - ldr r5, =0x02020630 - adds r0, r5 - bl obj_delete - ldr r0, =0x020217f4 - adds r0, r4, r0 - strb r4, [r0] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3F - bls _08007590 - lsls r0, r4, 4 - adds r0, r4 - lsls r0, 2 - adds r0, r5 - bl obj_delete - pop {r4,r5} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end obj_delete_all - - thumb_func_start obj_free_tiles -obj_free_tiles: @ 80075C8 - push {lr} - ldr r2, [r0, 0x14] - ldrh r1, [r2] - ldr r0, =0x0000ffff - cmp r1, r0 - beq _080075DA - adds r0, r1, 0 - bl gpu_tile_obj_free_by_tag -_080075DA: - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end obj_free_tiles - - thumb_func_start obj_free_pal -obj_free_pal: @ 80075E4 - push {lr} - ldr r0, [r0, 0x14] - ldrh r0, [r0, 0x2] - bl gpu_pal_free_tag - pop {r0} - bx r0 - thumb_func_end obj_free_pal - - thumb_func_start obj_free_rotscale_entry -obj_free_rotscale_entry: @ 80075F4 - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4, 0x1] - lsls r0, 30 - lsrs r0, 30 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0800761A - ldrb r0, [r4, 0x3] - lsls r0, 26 - lsrs r0, 27 - bl rotscale_free_entry - ldrb r1, [r4, 0x1] - movs r0, 0x4 - negs r0, r0 - ands r0, r1 - strb r0, [r4, 0x1] -_0800761A: - pop {r4} - pop {r0} - bx r0 - thumb_func_end obj_free_rotscale_entry - - thumb_func_start obj_delete_and_free_resources -obj_delete_and_free_resources: @ 8007620 - push {r4,lr} - adds r4, r0, 0 - bl obj_free_tiles - adds r0, r4, 0 - bl obj_free_pal - adds r0, r4, 0 - bl obj_free_rotscale_entry - adds r0, r4, 0 - bl obj_delete_and_free_tiles - pop {r4} - pop {r0} - bx r0 - thumb_func_end obj_delete_and_free_resources - - thumb_func_start obj_anim_step -obj_anim_step: @ 8007640 - push {r4,r5,lr} - adds r4, r0, 0 - ldr r2, =0x082ec6c4 - adds r5, r4, 0 - adds r5, 0x3F - ldrb r1, [r5] - movs r0, 0x4 - ands r0, r1 - adds r0, r2 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - ldr r0, =0x02021cc0 - ldrb r0, [r0] - cmp r0, 0 - bne _08007676 - ldr r0, =0x082ec6cc - ldrb r1, [r5] - lsls r1, 28 - lsrs r1, 31 - lsls r1, 2 - adds r1, r0 - ldr r1, [r1] - adds r0, r4, 0 - bl _call_via_r1 -_08007676: - pop {r4,r5} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end obj_anim_step - - thumb_func_start obj_anim_image_begin -obj_anim_image_begin: @ 8007688 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - adds r4, r0, 0 - adds r3, r4, 0 - adds r3, 0x2B - movs r2, 0 - strb r2, [r3] - adds r5, r4, 0 - adds r5, 0x3F - ldrb r1, [r5] - movs r0, 0x11 - negs r0, r0 - ands r0, r1 - strb r0, [r5] - adds r0, r4, 0 - adds r0, 0x2D - strb r2, [r0] - adds r2, r4, 0 - adds r2, 0x2A - ldrb r1, [r2] - ldr r0, [r4, 0x8] - lsls r1, 2 - adds r1, r0 - ldrb r0, [r3] - ldr r1, [r1] - lsls r0, 2 - adds r0, r1 - ldrh r0, [r0] - mov r9, r0 - lsls r0, 16 - mov r8, r0 - asrs r1, r0, 16 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _0800776C - ldrb r1, [r5] - subs r0, 0x4 - ands r0, r1 - strb r0, [r5] - ldrb r1, [r2] - ldr r0, [r4, 0x8] - lsls r1, 2 - adds r1, r0 - ldrb r0, [r3] - ldr r1, [r1] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - lsls r1, r0, 10 - lsrs r3, r1, 26 - lsls r1, r0, 9 - lsrs r7, r1, 31 - lsls r0, 8 - lsrs r6, r0, 31 - cmp r3, 0 - beq _08007704 - subs r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 -_08007704: - adds r2, r4, 0 - adds r2, 0x2C - movs r0, 0x3F - ands r3, r0 - ldrb r1, [r2] - subs r0, 0x7F - ands r0, r1 - orrs r0, r3 - strb r0, [r2] - ldrb r0, [r4, 0x1] - lsls r0, 30 - lsrs r0, 30 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _0800772E - adds r0, r4, 0 - adds r1, r7, 0 - adds r2, r6, 0 - bl obj_set_horizonal_and_vertical_flip -_0800772E: - ldrb r1, [r5] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _0800775C - adds r0, r4, 0 - adds r0, 0x40 - ldrh r1, [r0] - add r1, r9 - ldr r2, =0x000003ff - adds r0, r2, 0 - ands r1, r0 - ldrh r2, [r4, 0x4] - ldr r0, =0xfffffc00 - ands r0, r2 - orrs r0, r1 - strh r0, [r4, 0x4] - b _0800776C - .align 2, 0 - .pool -_0800775C: - mov r1, r8 - lsrs r0, r1, 16 - ldrh r1, [r4, 0x4] - lsls r1, 22 - lsrs r1, 22 - ldr r2, [r4, 0xC] - bl copy_queue_add_oam_frame -_0800776C: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end obj_anim_image_begin - - thumb_func_start obj_anim_image_continue -obj_anim_image_continue: @ 8007778 - push {r4,lr} - adds r4, r0, 0 - adds r0, 0x2C - ldrb r1, [r0] - movs r0, 0x3F - ands r0, r1 - cmp r0, 0 - beq _080077C8 - adds r0, r4, 0 - bl obj_anim_image_delay_progress - adds r0, r4, 0 - adds r0, 0x2A - ldrb r1, [r0] - ldr r0, [r4, 0x8] - lsls r1, 2 - adds r1, r0 - adds r0, r4, 0 - adds r0, 0x2B - ldrb r0, [r0] - ldr r1, [r1] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - lsls r1, r0, 9 - lsrs r3, r1, 31 - lsls r0, 8 - lsrs r2, r0, 31 - ldrb r0, [r4, 0x1] - lsls r0, 30 - lsrs r0, 30 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _0800780E - adds r0, r4, 0 - adds r1, r3, 0 - bl obj_set_horizonal_and_vertical_flip - b _0800780E -_080077C8: - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0800780E - adds r2, r4, 0 - adds r2, 0x2B - ldrb r0, [r2] - adds r0, 0x1 - strb r0, [r2] - adds r0, r4, 0 - adds r0, 0x2A - ldrb r0, [r0] - ldr r1, [r4, 0x8] - lsls r0, 2 - adds r0, r1 - ldrb r1, [r2] - ldr r0, [r0] - lsls r1, 2 - adds r1, r0 - movs r2, 0x3 - movs r3, 0 - ldrsh r0, [r1, r3] - cmp r0, 0 - bge _080077FE - adds r0, 0x3 - lsls r0, 16 - lsrs r2, r0, 16 -_080077FE: - ldr r0, =0x082ec6d4 - lsls r1, r2, 16 - asrs r1, 14 - adds r1, r0 - ldr r1, [r1] - adds r0, r4, 0 - bl _call_via_r1 -_0800780E: - pop {r4} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end obj_anim_image_continue - - thumb_func_start anim_image_3 -anim_image_3: @ 8007818 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r4, r0, 0 - adds r0, 0x2A - ldrb r1, [r0] - ldr r0, [r4, 0x8] - lsls r1, 2 - adds r1, r0 - adds r0, r4, 0 - adds r0, 0x2B - ldrb r0, [r0] - ldr r1, [r1] - lsls r0, 2 - adds r0, r1 - ldrh r7, [r0] - mov r8, r7 - ldr r0, [r0] - lsls r1, r0, 10 - lsrs r3, r1, 26 - lsls r1, r0, 9 - lsrs r6, r1, 31 - lsls r0, 8 - lsrs r5, r0, 31 - cmp r3, 0 - beq _08007852 - subs r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 -_08007852: - adds r2, r4, 0 - adds r2, 0x2C - movs r0, 0x3F - ands r3, r0 - ldrb r1, [r2] - subs r0, 0x7F - ands r0, r1 - orrs r0, r3 - strb r0, [r2] - ldrb r0, [r4, 0x1] - lsls r0, 30 - lsrs r0, 30 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _0800787C - adds r0, r4, 0 - adds r1, r6, 0 - adds r2, r5, 0 - bl obj_set_horizonal_and_vertical_flip -_0800787C: - adds r0, r4, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _080078AC - adds r0, r4, 0 - adds r0, 0x40 - ldrh r1, [r0] - adds r1, r7 - ldr r2, =0x000003ff - adds r0, r2, 0 - ands r1, r0 - ldrh r2, [r4, 0x4] - ldr r0, =0xfffffc00 - ands r0, r2 - orrs r0, r1 - strh r0, [r4, 0x4] - b _080078BA - .align 2, 0 - .pool -_080078AC: - mov r0, r8 - ldrh r1, [r4, 0x4] - lsls r1, 22 - lsrs r1, 22 - ldr r2, [r4, 0xC] - bl copy_queue_add_oam_frame -_080078BA: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end anim_image_3 - - thumb_func_start anim_image_2 -anim_image_2: @ 80078C4 - adds r2, r0, 0 - adds r2, 0x2B - ldrb r1, [r2] - subs r1, 0x1 - strb r1, [r2] - adds r0, 0x3F - ldrb r1, [r0] - movs r2, 0x10 - orrs r1, r2 - strb r1, [r0] - bx lr - thumb_func_end anim_image_2 - - thumb_func_start anim_image_1 -anim_image_1: @ 80078DC - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r4, r0, 0 - adds r3, r4, 0 - adds r3, 0x2A - ldrb r1, [r3] - ldr r0, [r4, 0x8] - lsls r1, 2 - adds r1, r0 - adds r2, r4, 0 - adds r2, 0x2B - ldrb r0, [r2] - ldr r1, [r1] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - lsls r0, 10 - lsrs r0, 26 - strb r0, [r2] - ldrb r0, [r3] - ldr r1, [r4, 0x8] - lsls r0, 2 - adds r0, r1 - ldrb r1, [r2] - ldr r0, [r0] - lsls r1, 2 - adds r1, r0 - ldrh r7, [r1] - mov r8, r7 - ldr r0, [r1] - lsls r1, r0, 10 - lsrs r3, r1, 26 - lsls r1, r0, 9 - lsrs r6, r1, 31 - lsls r0, 8 - lsrs r5, r0, 31 - cmp r3, 0 - beq _08007930 - subs r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 -_08007930: - adds r2, r4, 0 - adds r2, 0x2C - movs r0, 0x3F - ands r3, r0 - ldrb r1, [r2] - subs r0, 0x7F - ands r0, r1 - orrs r0, r3 - strb r0, [r2] - ldrb r0, [r4, 0x1] - lsls r0, 30 - lsrs r0, 30 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _0800795A - adds r0, r4, 0 - adds r1, r6, 0 - adds r2, r5, 0 - bl obj_set_horizonal_and_vertical_flip -_0800795A: - adds r0, r4, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _0800798C - adds r0, r4, 0 - adds r0, 0x40 - ldrh r1, [r0] - adds r1, r7 - ldr r2, =0x000003ff - adds r0, r2, 0 - ands r1, r0 - ldrh r2, [r4, 0x4] - ldr r0, =0xfffffc00 - ands r0, r2 - orrs r0, r1 - strh r0, [r4, 0x4] - b _0800799A - .align 2, 0 - .pool -_0800798C: - mov r0, r8 - ldrh r1, [r4, 0x4] - lsls r1, 22 - lsrs r1, 22 - ldr r2, [r4, 0xC] - bl copy_queue_add_oam_frame -_0800799A: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end anim_image_1 - - thumb_func_start anim_image_0 -anim_image_0: @ 80079A4 - push {lr} - adds r1, r0, 0 - adds r0, 0x2D - ldrb r0, [r0] - cmp r0, 0 - beq _080079B8 - adds r0, r1, 0 - bl sub_80079FC - b _080079BE -_080079B8: - adds r0, r1, 0 - bl sub_80079C4 -_080079BE: - pop {r0} - bx r0 - thumb_func_end anim_image_0 - - thumb_func_start sub_80079C4 -sub_80079C4: @ 80079C4 - push {r4,lr} - adds r4, r0, 0 - adds r0, 0x2A - ldrb r1, [r0] - ldr r0, [r4, 0x8] - lsls r1, 2 - adds r1, r0 - adds r0, r4, 0 - adds r0, 0x2B - ldrb r0, [r0] - ldr r1, [r1] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - lsls r0, 10 - lsrs r0, 26 - adds r1, r4, 0 - adds r1, 0x2D - strb r0, [r1] - adds r0, r4, 0 - bl obj_anim_rewind_to_cmd00 - adds r0, r4, 0 - bl obj_anim_image_continue - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80079C4 - - thumb_func_start sub_80079FC -sub_80079FC: @ 80079FC - push {r4,lr} - adds r4, r0, 0 - adds r1, r4, 0 - adds r1, 0x2D - ldrb r0, [r1] - subs r0, 0x1 - strb r0, [r1] - adds r0, r4, 0 - bl obj_anim_rewind_to_cmd00 - adds r0, r4, 0 - bl obj_anim_image_continue - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80079FC - - thumb_func_start obj_anim_rewind_to_cmd00 -obj_anim_rewind_to_cmd00: @ 8007A1C - push {r4-r7,lr} - mov r12, r0 - adds r0, 0x2D - ldrb r0, [r0] - cmp r0, 0 - beq _08007A88 - mov r3, r12 - adds r3, 0x2B - ldrb r0, [r3] - subs r0, 0x1 - strb r0, [r3] - mov r5, r12 - adds r5, 0x2A - ldrb r1, [r5] - mov r2, r12 - ldr r0, [r2, 0x8] - lsls r1, 2 - adds r1, r0 - ldrb r0, [r3] - ldr r1, [r1] - lsls r0, 2 - adds r0, r1 - subs r0, 0x4 - movs r7, 0 - ldrsh r0, [r0, r7] - movs r1, 0x3 - negs r1, r1 - adds r4, r3, 0 - cmp r0, r1 - beq _08007A82 - adds r6, r1, 0 - adds r2, r4, 0 -_08007A5C: - ldrb r0, [r2] - cmp r0, 0 - beq _08007A82 - subs r0, 0x1 - strb r0, [r3] - ldrb r1, [r5] - mov r7, r12 - ldr r0, [r7, 0x8] - lsls r1, 2 - adds r1, r0 - ldrb r0, [r2] - ldr r1, [r1] - lsls r0, 2 - adds r0, r1 - subs r0, 0x4 - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, r6 - bne _08007A5C -_08007A82: - ldrb r0, [r4] - subs r0, 0x1 - strb r0, [r4] -_08007A88: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end obj_anim_rewind_to_cmd00 - - thumb_func_start obj_anim_rotscale_begin -obj_anim_rotscale_begin: @ 8007A90 - push {r4-r7,lr} - sub sp, 0x8 - adds r6, r0, 0 - ldrb r0, [r6, 0x1] - lsls r0, 30 - lsrs r0, 30 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08007B12 - ldr r0, [r6, 0x10] - ldr r0, [r0] - movs r2, 0 - ldrsh r1, [r0, r2] - ldr r0, =0x00007fff - cmp r1, r0 - beq _08007B12 - adds r0, r6, 0 - bl obj_get_rotscale_entry_index - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - bl rotscale_reset_half - mov r5, sp - adds r0, r4, 0 - adds r1, r6, 0 - mov r2, sp - bl rotscale_load_frame - adds r7, r6, 0 - adds r7, 0x3F - ldrb r1, [r7] - movs r0, 0x9 - negs r0, r0 - ands r0, r1 - movs r1, 0x21 - negs r1, r1 - ands r0, r1 - strb r0, [r7] - adds r0, r4, 0 - mov r1, sp - bl sub_8008168 - ldr r1, =0x03000b70 - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r5, 0x5] - strb r1, [r0, 0x2] - ldrb r1, [r7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _08007B12 - movs r0, 0x3A - ldrsh r1, [r6, r0] - movs r0, 0x3C - ldrsh r2, [r6, r0] - adds r0, r6, 0 - bl obj_update_pos2 -_08007B12: - add sp, 0x8 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end obj_anim_rotscale_begin - - thumb_func_start obj_anim_rotscale_continue -obj_anim_rotscale_continue: @ 8007B24 - push {r4,r5,lr} - adds r4, r0, 0 - ldrb r0, [r4, 0x1] - lsls r0, 30 - lsrs r0, 30 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08007BC6 - adds r0, r4, 0 - bl obj_get_rotscale_entry_index - lsls r0, 24 - lsrs r2, r0, 24 - adds r5, r2, 0 - ldr r1, =0x03000b70 - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r3, r0, r1 - ldrb r0, [r3, 0x2] - cmp r0, 0 - beq _08007B60 - adds r0, r2, 0 - adds r1, r4, 0 - bl sub_8007BD8 - b _08007BAA - .align 2, 0 - .pool -_08007B60: - adds r0, r4, 0 - adds r0, 0x2C - ldrb r1, [r0] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08007BC6 - ldrb r0, [r3, 0x1] - adds r0, 0x1 - strb r0, [r3, 0x1] - ldrb r0, [r3] - ldr r1, [r4, 0x10] - lsls r0, 2 - adds r0, r1 - ldrb r1, [r3, 0x1] - ldr r0, [r0] - lsls r1, 3 - adds r1, r0 - movs r2, 0x3 - movs r0, 0 - ldrsh r1, [r1, r0] - ldr r0, =0x00007ffc - cmp r1, r0 - ble _08007B98 - ldr r2, =0xffff8003 - adds r0, r1, r2 - lsls r0, 16 - lsrs r2, r0, 16 -_08007B98: - ldr r0, =0x082ec6e4 - lsls r1, r2, 16 - asrs r1, 14 - adds r1, r0 - ldr r2, [r1] - adds r0, r5, 0 - adds r1, r4, 0 - bl _call_via_r2 -_08007BAA: - adds r0, r4, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _08007BC6 - movs r0, 0x3A - ldrsh r1, [r4, r0] - movs r0, 0x3C - ldrsh r2, [r4, r0] - adds r0, r4, 0 - bl obj_update_pos2 -_08007BC6: - pop {r4,r5} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end obj_anim_rotscale_continue - - thumb_func_start sub_8007BD8 -sub_8007BD8: @ 8007BD8 - push {r4,r5,lr} - sub sp, 0x8 - adds r5, r1, 0 - lsls r0, 24 - lsrs r4, r0, 24 - adds r0, r5, 0 - adds r1, r4, 0 - bl obj_anim_rotscale_delay_progress - lsls r0, 24 - cmp r0, 0 - bne _08007C02 - adds r0, r4, 0 - adds r1, r5, 0 - mov r2, sp - bl rotscale_load_frame - adds r0, r4, 0 - mov r1, sp - bl rotscale_frame_apply_relative_and_sync -_08007C02: - add sp, 0x8 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8007BD8 - - thumb_func_start anim_rotscale_0 -anim_rotscale_0: @ 8007C0C - push {lr} - adds r3, r1, 0 - lsls r0, 24 - lsrs r2, r0, 24 - ldr r1, =0x03000b70 - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r0, [r0, 0x3] - cmp r0, 0 - beq _08007C34 - adds r0, r2, 0 - adds r1, r3, 0 - bl sub_8007C7C - b _08007C3C - .align 2, 0 - .pool -_08007C34: - adds r0, r2, 0 - adds r1, r3, 0 - bl sub_8007C40 -_08007C3C: - pop {r0} - bx r0 - thumb_func_end anim_rotscale_0 - - thumb_func_start sub_8007C40 -sub_8007C40: @ 8007C40 - push {r4,lr} - adds r4, r1, 0 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =0x03000b70 - lsls r3, r0, 1 - adds r3, r0 - lsls r3, 2 - adds r3, r1 - ldrb r2, [r3] - ldr r1, [r4, 0x10] - lsls r2, 2 - adds r2, r1 - ldrb r1, [r3, 0x1] - ldr r2, [r2] - lsls r1, 3 - adds r1, r2 - ldrh r1, [r1, 0x2] - strb r1, [r3, 0x3] - adds r1, r4, 0 - bl obj_anim_rotscale_rewind_to_cmd00_maybe - adds r0, r4, 0 - bl obj_anim_rotscale_continue - pop {r4} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end sub_8007C40 - - thumb_func_start sub_8007C7C -sub_8007C7C: @ 8007C7C - push {r4,lr} - adds r4, r1, 0 - lsls r0, 24 - lsrs r0, 24 - ldr r2, =0x03000b70 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r2, [r1, 0x3] - subs r2, 0x1 - strb r2, [r1, 0x3] - adds r1, r4, 0 - bl obj_anim_rotscale_rewind_to_cmd00_maybe - adds r0, r4, 0 - bl obj_anim_rotscale_continue - pop {r4} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end sub_8007C7C - - thumb_func_start obj_anim_rotscale_rewind_to_cmd00_maybe -obj_anim_rotscale_rewind_to_cmd00_maybe: @ 8007CAC - push {r4-r7,lr} - mov r12, r1 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, =0x03000b70 - lsls r3, r5, 1 - adds r0, r3, r5 - lsls r0, 2 - adds r2, r0, r1 - ldrb r0, [r2, 0x3] - adds r6, r1, 0 - cmp r0, 0 - beq _08007D0C - ldrb r0, [r2, 0x1] - subs r0, 0x1 - strb r0, [r2, 0x1] - adds r4, r3, 0 - b _08007CDC - .align 2, 0 - .pool -_08007CD4: - cmp r2, 0 - beq _08007D00 - subs r0, r2, 0x1 - strb r0, [r3, 0x1] -_08007CDC: - adds r0, r4, r5 - lsls r0, 2 - adds r3, r0, r6 - ldrb r0, [r3] - mov r2, r12 - ldr r1, [r2, 0x10] - lsls r0, 2 - adds r0, r1 - ldrb r2, [r3, 0x1] - ldr r1, [r0] - lsls r0, r2, 3 - adds r0, r1 - subs r0, 0x8 - movs r7, 0 - ldrsh r1, [r0, r7] - ldr r0, =0x00007ffd - cmp r1, r0 - bne _08007CD4 -_08007D00: - adds r1, r4, r5 - lsls r1, 2 - adds r1, r6 - ldrb r0, [r1, 0x1] - subs r0, 0x1 - strb r0, [r1, 0x1] -_08007D0C: - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end obj_anim_rotscale_rewind_to_cmd00_maybe - - thumb_func_start anim_rotscale_1 -anim_rotscale_1: @ 8007D18 - push {r4-r6,lr} - sub sp, 0x8 - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldr r0, =0x03000b70 - lsls r4, r5, 1 - adds r4, r5 - lsls r4, 2 - adds r4, r0 - ldrb r2, [r4] - ldr r0, [r1, 0x10] - lsls r2, 2 - adds r2, r0 - ldrb r0, [r4, 0x1] - ldr r2, [r2] - lsls r0, 3 - adds r0, r2 - ldrh r0, [r0, 0x2] - strb r0, [r4, 0x1] - mov r6, sp - adds r0, r5, 0 - mov r2, sp - bl rotscale_load_frame - adds r0, r5, 0 - mov r1, sp - bl sub_8008168 - ldrb r0, [r6, 0x5] - strb r0, [r4, 0x2] - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end anim_rotscale_1 - - thumb_func_start anim_rotscale_2 -anim_rotscale_2: @ 8007D64 - push {lr} - sub sp, 0x8 - lsls r0, 24 - lsrs r0, 24 - movs r2, 0 - movs r3, 0 - str r2, [sp] - str r3, [sp, 0x4] - adds r1, 0x3F - ldrb r2, [r1] - movs r3, 0x20 - orrs r2, r3 - strb r2, [r1] - ldr r2, =0x03000b70 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r2, [r1, 0x1] - subs r2, 0x1 - strb r2, [r1, 0x1] - mov r1, sp - bl rotscale_frame_apply_relative_and_sync - add sp, 0x8 - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end anim_rotscale_2 - - thumb_func_start anim_rotscale_3 -anim_rotscale_3: @ 8007DA0 - push {r4,r5,lr} - sub sp, 0x8 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - mov r5, sp - adds r0, r4, 0 - mov r2, sp - bl rotscale_load_frame - adds r0, r4, 0 - mov r1, sp - bl sub_8008168 - ldr r1, =0x03000b70 - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r5, 0x5] - strb r1, [r0, 0x2] - add sp, 0x8 - pop {r4,r5} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end anim_rotscale_3 - - thumb_func_start rotscale_set_indirect -rotscale_set_indirect: @ 8007DD8 - lsls r0, 24 - ldr r2, =0x02021bc0 - lsrs r0, 21 - adds r0, r2 - ldrh r2, [r1] - strh r2, [r0] - ldrh r2, [r1, 0x2] - strh r2, [r0, 0x2] - ldrh r2, [r1, 0x4] - strh r2, [r0, 0x4] - ldrh r1, [r1, 0x6] - strh r1, [r0, 0x6] - bx lr - .align 2, 0 - .pool - thumb_func_end rotscale_set_indirect - - thumb_func_start obj_get_rotscale_entry_index -obj_get_rotscale_entry_index: @ 8007DF8 - push {lr} - adds r2, r0, 0 - movs r3, 0 - ldrb r0, [r2, 0x1] - lsls r0, 30 - lsrs r0, 30 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08007E12 - ldrb r0, [r2, 0x3] - lsls r0, 26 - lsrs r3, r0, 27 -_08007E12: - adds r0, r3, 0 - pop {r1} - bx r1 - thumb_func_end obj_get_rotscale_entry_index - - thumb_func_start sub_8007E18 -sub_8007E18: @ 8007E18 - strh r1, [r0, 0x3A] - strh r2, [r0, 0x3C] - adds r0, 0x3F - ldrb r1, [r0] - movs r2, 0x80 - orrs r1, r2 - strb r1, [r0] - bx lr - thumb_func_end sub_8007E18 - - thumb_func_start sub_8007E28 -sub_8007E28: @ 8007E28 - push {r4,r5,lr} - adds r3, r0, 0 - adds r5, r2, 0 - subs r0, r1, r3 - cmp r0, 0 - bge _08007E3A - negs r0, r0 - asrs r4, r0, 9 - b _08007E3E -_08007E3A: - asrs r0, 9 - negs r4, r0 -_08007E3E: - adds r0, r5, 0 - muls r0, r1 - adds r1, r3, 0 - bl __udivsi3 - adds r0, r4 - subs r0, r5, r0 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8007E28 - - thumb_func_start obj_update_pos2 -obj_update_pos2: @ 8007E54 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - adds r5, r0, 0 - adds r6, r1, 0 - mov r8, r2 - ldrb r1, [r5, 0x3] - lsls r0, r1, 26 - lsrs r7, r0, 27 - movs r0, 0x80 - lsls r0, 4 - mov r9, r0 - cmp r6, r9 - beq _08007EA2 - ldr r2, =0x082ec6f4 - lsrs r1, 6 - lsls r1, 3 - ldrb r0, [r5, 0x1] - lsrs r0, 6 - lsls r0, 5 - adds r1, r0 - adds r1, r2 - ldr r0, [r1] - lsls r4, r0, 8 - lsls r0, 16 - ldr r2, =0x02021bc0 - lsls r1, r7, 3 - adds r1, r2 - movs r2, 0 - ldrsh r1, [r1, r2] - bl __divsi3 - adds r1, r0, 0 - adds r0, r4, 0 - adds r2, r6, 0 - bl sub_8007E28 - strh r0, [r5, 0x24] -_08007EA2: - cmp r8, r9 - beq _08007EDA - ldr r2, =0x082ec6f4 - ldrb r1, [r5, 0x3] - lsrs r1, 6 - lsls r1, 3 - ldrb r0, [r5, 0x1] - lsrs r0, 6 - lsls r0, 5 - adds r1, r0 - adds r2, 0x4 - adds r1, r2 - ldr r0, [r1] - lsls r4, r0, 8 - lsls r0, 16 - ldr r2, =0x02021bc0 - lsls r1, r7, 3 - adds r1, r2 - movs r2, 0x6 - ldrsh r1, [r1, r2] - bl __divsi3 - adds r1, r0, 0 - adds r0, r4, 0 - mov r2, r8 - bl sub_8007E28 - strh r0, [r5, 0x26] -_08007EDA: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end obj_update_pos2 - - thumb_func_start obj_set_horizonal_and_vertical_flip -obj_set_horizonal_and_vertical_flip: @ 8007EF0 - push {r4-r6,lr} - mov r6, r8 - push {r6} - lsls r1, 24 - lsrs r1, 24 - lsls r2, 24 - lsrs r2, 24 - ldrb r6, [r0, 0x3] - lsls r3, r6, 26 - lsrs r3, 27 - movs r4, 0x7 - ands r3, r4 - lsls r3, 1 - subs r4, 0x46 - mov r8, r4 - mov r5, r8 - ands r5, r6 - orrs r5, r3 - strb r5, [r0, 0x3] - lsls r4, r5, 26 - lsrs r4, 27 - movs r6, 0x3F - adds r6, r0 - mov r12, r6 - ldrb r3, [r6] - lsls r3, 31 - lsrs r3, 31 - eors r1, r3 - movs r6, 0x1 - ands r1, r6 - lsls r1, 3 - orrs r4, r1 - lsls r4, 1 - mov r3, r8 - ands r3, r5 - orrs r3, r4 - strb r3, [r0, 0x3] - lsls r4, r3, 26 - lsrs r4, 27 - mov r5, r12 - ldrb r1, [r5] - lsls r1, 30 - lsrs r1, 31 - eors r2, r1 - ands r2, r6 - lsls r2, 4 - orrs r4, r2 - lsls r4, 1 - mov r6, r8 - ands r3, r6 - orrs r3, r4 - strb r3, [r0, 0x3] - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end obj_set_horizonal_and_vertical_flip - - thumb_func_start rotscale_reset_half -rotscale_reset_half: @ 8007F64 - lsls r0, 24 - lsrs r0, 24 - ldr r2, =0x03000b70 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0 - strb r0, [r1, 0x1] - strb r0, [r1, 0x2] - strb r0, [r1, 0x3] - bx lr - .align 2, 0 - .pool - thumb_func_end rotscale_reset_half - - thumb_func_start rotscale_reset_full_1 -rotscale_reset_full_1: @ 8007F80 - lsls r0, 24 - lsrs r0, 24 - ldr r3, =0x03000b70 - lsls r2, r0, 1 - adds r2, r0 - lsls r2, 2 - adds r2, r3 - movs r3, 0 - strb r1, [r2] - strb r3, [r2, 0x1] - strb r3, [r2, 0x2] - strb r3, [r2, 0x3] - movs r0, 0x80 - lsls r0, 1 - strh r0, [r2, 0x4] - strh r0, [r2, 0x6] - strh r3, [r2, 0x8] - bx lr - .align 2, 0 - .pool - thumb_func_end rotscale_reset_full_1 - - thumb_func_start rotscale_reset_full_2 -rotscale_reset_full_2: @ 8007FA8 - lsls r0, 24 - lsrs r0, 24 - ldr r2, =0x03000b70 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0 - strb r0, [r1] - strb r0, [r1, 0x1] - strb r0, [r1, 0x2] - strb r0, [r1, 0x3] - movs r2, 0x80 - lsls r2, 1 - strh r2, [r1, 0x4] - strh r2, [r1, 0x6] - strh r0, [r1, 0x8] - bx lr - .align 2, 0 - .pool - thumb_func_end rotscale_reset_full_2 - - thumb_func_start rotscale_frame_apply_absolute -rotscale_frame_apply_absolute: @ 8007FD0 - lsls r0, 24 - lsrs r0, 24 - ldr r3, =0x03000b70 - lsls r2, r0, 1 - adds r2, r0 - lsls r2, 2 - adds r2, r3 - ldrh r0, [r1] - strh r0, [r2, 0x4] - ldrh r0, [r1, 0x2] - strh r0, [r2, 0x6] - ldrb r0, [r1, 0x4] - lsls r0, 8 - strh r0, [r2, 0x8] - bx lr - .align 2, 0 - .pool - thumb_func_end rotscale_frame_apply_absolute - - thumb_func_start obj_anim_image_delay_progress -obj_anim_image_delay_progress: @ 8007FF4 - push {lr} - adds r3, r0, 0 - adds r3, 0x2C - ldrb r2, [r3] - movs r0, 0x40 - ands r0, r2 - cmp r0, 0 - bne _08008018 - lsls r0, r2, 26 - lsrs r0, 26 - subs r0, 0x1 - movs r1, 0x3F - ands r0, r1 - movs r1, 0x40 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3] -_08008018: - pop {r0} - bx r0 - thumb_func_end obj_anim_image_delay_progress - - thumb_func_start obj_anim_rotscale_delay_progress -obj_anim_rotscale_delay_progress: @ 800801C - push {lr} - lsls r1, 24 - lsrs r2, r1, 24 - adds r3, r0, 0 - adds r3, 0x2C - ldrb r1, [r3] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08008040 - ldr r0, =0x03000b70 - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1, 0x2] - subs r0, 0x1 - strb r0, [r1, 0x2] -_08008040: - ldrb r0, [r3] - lsrs r0, 7 - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end obj_anim_rotscale_delay_progress - - thumb_func_start rotscale_frame_apply_relative_and_sync -rotscale_frame_apply_relative_and_sync: @ 800804C - push {r4-r6,lr} - sub sp, 0x10 - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldr r0, =0x03000b70 - lsls r4, r5, 1 - adds r4, r5 - lsls r4, 2 - adds r4, r0 - ldrh r0, [r1] - ldrh r2, [r4, 0x4] - adds r0, r2 - strh r0, [r4, 0x4] - ldrh r0, [r1, 0x2] - ldrh r2, [r4, 0x6] - adds r0, r2 - strh r0, [r4, 0x6] - ldrb r0, [r1, 0x4] - lsls r0, 8 - ldrh r1, [r4, 0x8] - adds r0, r1 - ldr r2, =0xffffff00 - adds r1, r2, 0 - ands r0, r1 - strh r0, [r4, 0x8] - movs r1, 0x4 - ldrsh r0, [r4, r1] - bl divide_0x10000_by - lsls r0, 16 - lsrs r0, 16 - ldr r6, =0xffff0000 - ldr r1, [sp] - ands r1, r6 - orrs r1, r0 - str r1, [sp] - movs r2, 0x6 - ldrsh r0, [r4, r2] - bl divide_0x10000_by - lsls r0, 16 - ldr r2, =0x0000ffff - ldr r1, [sp] - ands r1, r2 - orrs r1, r0 - str r1, [sp] - ldrh r1, [r4, 0x8] - ldr r0, [sp, 0x4] - ands r0, r6 - orrs r0, r1 - str r0, [sp, 0x4] - add r4, sp, 0x8 - mov r0, sp - adds r1, r4, 0 - movs r2, 0x1 - movs r3, 0x2 - bl _082E709C - adds r0, r5, 0 - adds r1, r4, 0 - bl rotscale_set_indirect - add sp, 0x10 - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end rotscale_frame_apply_relative_and_sync - - thumb_func_start divide_0x10000_by -divide_0x10000_by: @ 80080E4 - push {lr} - adds r1, r0, 0 - movs r0, 0x80 - lsls r0, 9 - lsls r1, 16 - asrs r1, 16 - bl __divsi3 - lsls r0, 16 - asrs r0, 16 - pop {r1} - bx r1 - thumb_func_end divide_0x10000_by - - thumb_func_start rotscale_load_frame -rotscale_load_frame: @ 80080FC - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r3, =0x03000b70 - lsls r4, r0, 1 - adds r4, r0 - lsls r4, 2 - adds r4, r3 - ldrb r3, [r4] - ldr r0, [r1, 0x10] - lsls r3, 2 - adds r3, r0 - ldrb r0, [r4, 0x1] - ldr r3, [r3] - lsls r0, 3 - adds r0, r3 - ldrh r0, [r0] - strh r0, [r2] - ldrb r3, [r4] - ldr r0, [r1, 0x10] - lsls r3, 2 - adds r3, r0 - ldrb r0, [r4, 0x1] - ldr r3, [r3] - lsls r0, 3 - adds r0, r3 - ldrh r0, [r0, 0x2] - strh r0, [r2, 0x2] - ldrb r3, [r4] - ldr r0, [r1, 0x10] - lsls r3, 2 - adds r3, r0 - ldrb r0, [r4, 0x1] - ldr r3, [r3] - lsls r0, 3 - adds r0, r3 - ldrb r0, [r0, 0x4] - strb r0, [r2, 0x4] - ldrb r3, [r4] - ldr r0, [r1, 0x10] - lsls r3, 2 - adds r3, r0 - ldrb r0, [r4, 0x1] - ldr r1, [r3] - lsls r0, 3 - adds r0, r1 - ldrb r0, [r0, 0x5] - strb r0, [r2, 0x5] - pop {r4} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end rotscale_load_frame - - thumb_func_start sub_8008168 -sub_8008168: @ 8008168 - push {r4,lr} - sub sp, 0x8 - adds r2, r1, 0 - lsls r0, 24 - lsrs r4, r0, 24 - movs r0, 0 - movs r1, 0 - str r0, [sp] - str r1, [sp, 0x4] - ldrb r0, [r2, 0x5] - cmp r0, 0 - beq _0800818E - subs r0, 0x1 - strb r0, [r2, 0x5] - adds r0, r4, 0 - adds r1, r2, 0 - bl rotscale_frame_apply_relative_and_sync - b _0800819E -_0800818E: - adds r0, r4, 0 - adds r1, r2, 0 - bl rotscale_frame_apply_absolute - adds r0, r4, 0 - mov r1, sp - bl rotscale_frame_apply_relative_and_sync -_0800819E: - add sp, 0x8 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8008168 - - thumb_func_start obj_anim_image_start -obj_anim_image_start: @ 80081A8 - adds r2, r0, 0 - adds r2, 0x2A - strb r1, [r2] - adds r0, 0x3F - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - movs r2, 0x11 - negs r2, r2 - ands r1, r2 - strb r1, [r0] - bx lr - thumb_func_end obj_anim_image_start - - thumb_func_start obj_anim_image_start_if_different -obj_anim_image_start_if_different: @ 80081C0 - push {lr} - adds r2, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, 0x2A - ldrb r0, [r0] - cmp r0, r1 - beq _080081D6 - adds r0, r2, 0 - bl obj_anim_image_start -_080081D6: - pop {r0} - bx r0 - thumb_func_end obj_anim_image_start_if_different - - thumb_func_start obj_anim_image_seek -obj_anim_image_seek: @ 80081DC - push {r4-r7,lr} - adds r3, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r4, r3, 0 - adds r4, 0x2C - ldrb r0, [r4] - lsls r0, 25 - lsrs r6, r0, 31 - subs r1, 0x1 - adds r0, r3, 0 - adds r0, 0x2B - strb r1, [r0] - ldrb r1, [r4] - movs r7, 0x40 - negs r7, r7 - adds r0, r7, 0 - ands r0, r1 - strb r0, [r4] - adds r2, r3, 0 - adds r2, 0x3F - ldrb r1, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - movs r1, 0x11 - negs r1, r1 - ands r0, r1 - strb r0, [r2] - ldrb r1, [r4] - movs r5, 0x41 - negs r5, r5 - adds r0, r5, 0 - ands r0, r1 - strb r0, [r4] - adds r0, r3, 0 - bl obj_anim_image_continue - ldrb r2, [r4] - movs r0, 0x3F - ands r0, r2 - cmp r0, 0 - beq _08008244 - lsls r0, r2, 26 - lsrs r0, 26 - adds r0, 0x1 - movs r1, 0x3F - ands r0, r1 - adds r1, r7, 0 - ands r1, r2 - orrs r1, r0 - strb r1, [r4] -_08008244: - lsls r2, r6, 6 - ldrb r1, [r4] - adds r0, r5, 0 - ands r0, r1 - orrs r0, r2 - strb r0, [r4] - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end obj_anim_image_seek - - thumb_func_start sub_8008258 -sub_8008258: @ 8008258 - push {r4,r5,lr} - adds r5, r0, 0 - lsls r4, r1, 24 - lsrs r4, 24 - bl obj_get_rotscale_entry_index - lsls r0, 24 - lsrs r0, 24 - adds r1, r4, 0 - bl rotscale_reset_full_1 - adds r5, 0x3F - ldrb r0, [r5] - movs r1, 0x8 - orrs r0, r1 - movs r1, 0x21 - negs r1, r1 - ands r0, r1 - strb r0, [r5] - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8008258 - - thumb_func_start sub_8008284 -sub_8008284: @ 8008284 - push {r4,r5,lr} - adds r5, r0, 0 - lsls r1, 24 - lsrs r4, r1, 24 - bl obj_get_rotscale_entry_index - lsls r0, 24 - lsrs r0, 24 - ldr r2, =0x03000b70 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r0, [r1] - cmp r0, r4 - beq _080082AC - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_8008258 -_080082AC: - pop {r4,r5} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end sub_8008284 - - thumb_func_start sub_80082B8 -sub_80082B8: @ 80082B8 - push {r4,r5,lr} - adds r5, r0, 0 - lsls r4, r1, 24 - lsrs r4, 24 - bl obj_get_rotscale_entry_index - lsls r0, 24 - lsrs r0, 24 - ldr r2, =0x03000b70 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - strb r4, [r1] - adds r5, 0x3F - ldrb r0, [r5] - movs r1, 0x8 - orrs r0, r1 - movs r1, 0x21 - negs r1, r1 - ands r0, r1 - strb r0, [r5] - pop {r4,r5} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end sub_80082B8 - - thumb_func_start sub_80082F0 -sub_80082F0: @ 80082F0 - push {r4,r5,lr} - adds r5, r0, 0 - lsls r1, 24 - lsrs r4, r1, 24 - bl obj_get_rotscale_entry_index - lsls r0, 24 - lsrs r0, 24 - ldr r2, =0x03000b70 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r0, [r1] - cmp r0, r4 - beq _08008318 - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_80082B8 -_08008318: - pop {r4,r5} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end sub_80082F0 - - thumb_func_start sub_8008324 -sub_8008324: @ 8008324 - push {lr} - adds r3, r0, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _08008370 - adds r0, r3, 0 - adds r0, 0x2A - ldrb r1, [r0] - ldr r0, [r3, 0x8] - lsls r1, 2 - adds r1, r0 - adds r0, r3, 0 - adds r0, 0x2B - ldrb r0, [r0] - ldr r1, [r1] - lsls r0, 2 - adds r0, r1 - ldrh r2, [r0] - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0 - bge _08008358 - movs r2, 0 -_08008358: - adds r0, r3, 0 - adds r0, 0x40 - ldrh r1, [r0] - adds r1, r2 - ldr r2, =0x000003ff - adds r0, r2, 0 - ands r1, r0 - ldrh r2, [r3, 0x4] - ldr r0, =0xfffffc00 - ands r0, r2 - orrs r0, r1 - strh r0, [r3, 0x4] -_08008370: - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end sub_8008324 - - thumb_func_start rotscale_reset_all -rotscale_reset_all: @ 800837C - push {r4,lr} - ldr r1, =0x02021cc0 - movs r0, 0 - strb r0, [r1] - ldr r1, =0x03003018 - movs r0, 0 - str r0, [r1] - bl reset_rotscale_coeffs - movs r4, 0 -_08008390: - adds r0, r4, 0 - bl rotscale_reset_full_2 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x1F - bls _08008390 - pop {r4} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end rotscale_reset_all - - thumb_func_start rotscale_alloc_entry -rotscale_alloc_entry: @ 80083B0 - push {r4,lr} - movs r2, 0 - movs r1, 0x1 - ldr r0, =0x03003018 - ldr r4, [r0] - adds r3, r0, 0 -_080083BC: - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0 - bne _080083D4 - ldr r0, [r3] - orrs r0, r1 - str r0, [r3] - adds r0, r2, 0 - b _080083E2 - .align 2, 0 - .pool -_080083D4: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - lsls r1, 1 - cmp r2, 0x1F - bls _080083BC - movs r0, 0xFF -_080083E2: - pop {r4} - pop {r1} - bx r1 - thumb_func_end rotscale_alloc_entry - - thumb_func_start rotscale_free_entry -rotscale_free_entry: @ 80083E8 - push {lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r2, r0, 24 - movs r0, 0 - movs r1, 0x1 - ldr r3, =0x03003018 - cmp r0, r2 - bcs _08008406 -_080083FA: - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - lsls r1, 1 - cmp r0, r2 - bcc _080083FA -_08008406: - ldr r0, [r3] - bics r0, r1 - str r0, [r3] - movs r1, 0x80 - lsls r1, 1 - str r1, [sp] - adds r0, r2, 0 - movs r2, 0 - movs r3, 0 - bl rotscale_set_direct - add sp, 0x4 - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end rotscale_free_entry - - thumb_func_start obj_alloc_rotscale_entry -obj_alloc_rotscale_entry: @ 8008428 - push {r4,r5,lr} - adds r4, r0, 0 - bl rotscale_alloc_entry - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0xFF - beq _08008470 - ldrb r3, [r4, 0x1] - lsrs r1, r3, 6 - ldrb r2, [r4, 0x3] - lsrs r2, 6 - lsls r3, 30 - lsrs r3, 30 - adds r0, r4, 0 - bl oam_center - movs r0, 0x1F - adds r1, r5, 0 - ands r1, r0 - lsls r1, 1 - ldrb r2, [r4, 0x3] - movs r0, 0x3F - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r4, 0x3] - adds r2, r4, 0 - adds r2, 0x3F - ldrb r0, [r2] - movs r1, 0x8 - orrs r0, r1 - strb r0, [r2] - adds r0, r5, 0 - bl rotscale_reset_full_2 -_08008470: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end obj_alloc_rotscale_entry - - thumb_func_start sub_8008478 -sub_8008478: @ 8008478 - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0x10 - adds r6, r0, 0 - adds r0, r1, 0 - adds r4, r2, 0 - adds r5, r3, 0 - lsls r6, 24 - lsrs r6, 24 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 16 - lsrs r5, 16 - lsls r0, 16 - asrs r0, 16 - bl divide_0x10000_by - lsls r0, 16 - lsrs r0, 16 - ldr r1, =0xffff0000 - mov r8, r1 - ldr r1, [sp] - mov r2, r8 - ands r1, r2 - orrs r1, r0 - str r1, [sp] - lsls r4, 16 - asrs r4, 16 - adds r0, r4, 0 - bl divide_0x10000_by - lsls r0, 16 - ldr r2, =0x0000ffff - ldr r1, [sp] - ands r1, r2 - orrs r1, r0 - str r1, [sp] - ldr r0, [sp, 0x4] - mov r1, r8 - ands r0, r1 - orrs r0, r5 - str r0, [sp, 0x4] - add r4, sp, 0x8 - mov r0, sp - adds r1, r4, 0 - movs r2, 0x1 - movs r3, 0x2 - bl _082E709C - adds r0, r6, 0 - adds r1, r4, 0 - bl rotscale_set_indirect - add sp, 0x10 - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end sub_8008478 - - thumb_func_start gpu_tile_obj_alloc_tag_and_copy_to_vram -gpu_tile_obj_alloc_tag_and_copy_to_vram: @ 80084F8 - push {r4-r6,lr} - adds r5, r0, 0 - ldrh r0, [r5, 0x4] - lsrs r0, 5 - bl gpu_tile_obj_alloc - lsls r4, r0, 16 - asrs r6, r4, 16 - cmp r6, 0 - blt _08008534 - ldrh r0, [r5, 0x6] - lsrs r4, 16 - ldrh r2, [r5, 0x4] - lsrs r2, 5 - adds r1, r4, 0 - bl gpu_tile_obj_tag_add - ldr r0, [r5] - lsls r1, r6, 5 - ldr r2, =0x06010000 - adds r1, r2 - ldrh r2, [r5, 0x4] - lsrs r2, 1 - bl CpuSet - adds r0, r4, 0 - b _08008536 - .align 2, 0 - .pool -_08008534: - movs r0, 0 -_08008536: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end gpu_tile_obj_alloc_tag_and_copy_to_vram - - thumb_func_start gpu_tile_obj_alloc_and_load_multiple -gpu_tile_obj_alloc_and_load_multiple: @ 800853C - push {r4,r5,lr} - adds r5, r0, 0 - movs r4, 0 - ldr r0, [r5] - cmp r0, 0 - beq _08008560 -_08008548: - lsls r0, r4, 3 - adds r0, r5, r0 - bl gpu_tile_obj_alloc_tag_and_copy_to_vram - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - lsls r0, r4, 3 - adds r0, r5 - ldr r0, [r0] - cmp r0, 0 - bne _08008548 -_08008560: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end gpu_tile_obj_alloc_and_load_multiple - - thumb_func_start gpu_tile_obj_free_by_tag -gpu_tile_obj_free_by_tag: @ 8008568 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 16 - lsrs r0, 16 - bl gpu_tile_obj_tag_index_of - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0xFF - beq _080085C6 - ldr r0, =0x03000a70 - lsls r1, r4, 2 - adds r2, r1, r0 - adds r0, 0x2 - adds r1, r0 - ldrh r0, [r1] - ldrh r3, [r2] - adds r0, r3, r0 - ldr r1, =0x030009f0 - mov r8, r1 - lsls r5, r4, 1 - cmp r3, r0 - bge _080085BE - ldr r1, =0x02021b3c - mov r12, r1 - movs r6, 0x7 - movs r7, 0x1 - adds r4, r0, 0 -_080085A2: - lsrs r2, r3, 3 - add r2, r12 - adds r0, r3, 0 - ands r0, r6 - adds r1, r7, 0 - lsls r1, r0 - ldrb r0, [r2] - bics r0, r1 - strb r0, [r2] - adds r0, r3, 0x1 - lsls r0, 16 - lsrs r3, r0, 16 - cmp r3, r4 - blt _080085A2 -_080085BE: - mov r0, r8 - adds r1, r5, r0 - ldr r0, =0x0000ffff - strh r0, [r1] -_080085C6: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end gpu_tile_obj_free_by_tag - - thumb_func_start gpu_tile_obj_tags_reset -gpu_tile_obj_tags_reset: @ 80085E0 - push {r4-r7,lr} - movs r2, 0 - ldr r7, =0x030009f0 - ldr r0, =0x0000ffff - adds r6, r0, 0 - ldr r4, =0x03000a70 - movs r3, 0 - adds r5, r4, 0x2 -_080085F0: - lsls r1, r2, 1 - adds r1, r7 - ldrh r0, [r1] - orrs r0, r6 - strh r0, [r1] - lsls r1, r2, 2 - adds r0, r1, r4 - strh r3, [r0] - adds r1, r5 - strh r3, [r1] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x3F - bls _080085F0 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end gpu_tile_obj_tags_reset - - thumb_func_start gpu_tile_obj_tag_get_range_start -gpu_tile_obj_tag_get_range_start: @ 8008620 - push {lr} - lsls r0, 16 - lsrs r0, 16 - bl gpu_tile_obj_tag_index_of - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0xFF - beq _08008640 - ldr r0, =0x03000a70 - lsls r1, 2 - adds r1, r0 - ldrh r0, [r1] - b _08008642 - .align 2, 0 - .pool -_08008640: - ldr r0, =0x0000ffff -_08008642: - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end gpu_tile_obj_tag_get_range_start - - thumb_func_start gpu_tile_obj_tag_index_of -gpu_tile_obj_tag_index_of: @ 800864C - push {lr} - lsls r0, 16 - lsrs r2, r0, 16 - movs r1, 0 - ldr r3, =0x030009f0 -_08008656: - lsls r0, r1, 1 - adds r0, r3 - ldrh r0, [r0] - cmp r0, r2 - bne _08008668 - adds r0, r1, 0 - b _08008674 - .align 2, 0 - .pool -_08008668: - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x3F - bls _08008656 - movs r0, 0xFF -_08008674: - pop {r1} - bx r1 - thumb_func_end gpu_tile_obj_tag_index_of - - thumb_func_start gpu_tile_obj_tag_get_by_range_start -gpu_tile_obj_tag_get_by_range_start: @ 8008678 - push {r4-r6,lr} - lsls r0, 16 - lsrs r3, r0, 16 - movs r2, 0 - ldr r6, =0x030009f0 - ldr r5, =0x0000ffff - ldr r4, =0x03000a70 -_08008686: - lsls r0, r2, 1 - adds r1, r0, r6 - ldrh r0, [r1] - cmp r0, r5 - beq _080086AC - lsls r0, r2, 2 - adds r0, r4 - ldrh r0, [r0] - cmp r0, r3 - bne _080086AC - ldrh r0, [r1] - b _080086B8 - .align 2, 0 - .pool -_080086AC: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x3F - bls _08008686 - ldr r0, =0x0000ffff -_080086B8: - pop {r4-r6} - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end gpu_tile_obj_tag_get_by_range_start - - thumb_func_start gpu_tile_obj_tag_add -gpu_tile_obj_tag_add: @ 80086C4 - push {r4-r6,lr} - adds r4, r0, 0 - adds r5, r1, 0 - adds r6, r2, 0 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 16 - lsrs r5, 16 - lsls r6, 16 - lsrs r6, 16 - ldr r0, =0x0000ffff - bl gpu_tile_obj_tag_index_of - lsls r0, 24 - lsrs r0, 24 - ldr r2, =0x030009f0 - lsls r1, r0, 1 - adds r1, r2 - strh r4, [r1] - ldr r1, =0x03000a70 - lsls r0, 2 - adds r2, r0, r1 - strh r5, [r2] - adds r1, 0x2 - adds r0, r1 - strh r6, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end gpu_tile_obj_tag_add - - thumb_func_start gpu_pal_allocator_reset -gpu_pal_allocator_reset: @ 800870C - push {r4,lr} - ldr r1, =0x0300301c - movs r0, 0 - strb r0, [r1] - movs r2, 0 - ldr r4, =0x03000cf0 - ldr r0, =0x0000ffff - adds r3, r0, 0 -_0800871C: - lsls r0, r2, 1 - adds r0, r4 - ldrh r1, [r0] - orrs r1, r3 - strh r1, [r0] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0xF - bls _0800871C - pop {r4} - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end gpu_pal_allocator_reset - - thumb_func_start gpu_pal_obj_alloc_tag_and_apply -gpu_pal_obj_alloc_tag_and_apply: @ 8008744 - push {r4,r5,lr} - adds r5, r0, 0 - ldrh r0, [r5, 0x4] - bl gpu_pal_tags_index_of - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0xFF - beq _0800875A - adds r0, r4, 0 - b _0800878A -_0800875A: - ldr r0, =0x0000ffff - bl gpu_pal_tags_index_of - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0xFF - beq _08008788 - ldr r1, =0x03000cf0 - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r5, 0x4] - strh r1, [r0] - ldr r0, [r5] - lsls r1, r4, 4 - bl gpu_pal_obj_load - adds r0, r4, 0 - b _0800878A - .align 2, 0 - .pool -_08008788: - movs r0, 0xFF -_0800878A: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end gpu_pal_obj_alloc_tag_and_apply - - thumb_func_start gpu_pal_obj_alloc_and_load_multiple -gpu_pal_obj_alloc_and_load_multiple: @ 8008790 - push {r4,r5,lr} - adds r5, r0, 0 - movs r4, 0 - b _0800879E -_08008798: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 -_0800879E: - lsls r0, r4, 3 - adds r1, r0, r5 - ldr r0, [r1] - cmp r0, 0 - beq _080087B6 - adds r0, r1, 0 - bl gpu_pal_obj_alloc_tag_and_apply - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - bne _08008798 -_080087B6: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end gpu_pal_obj_alloc_and_load_multiple - - thumb_func_start gpu_pal_obj_load -gpu_pal_obj_load: @ 80087BC - push {lr} - lsls r1, 16 - movs r2, 0x80 - lsls r2, 17 - adds r1, r2 - lsrs r1, 16 - movs r2, 0x20 - bl gpu_pal_apply - pop {r0} - bx r0 - thumb_func_end gpu_pal_obj_load - - thumb_func_start gpu_pal_alloc_new -gpu_pal_alloc_new: @ 80087D4 - push {r4,lr} - lsls r0, 16 - lsrs r4, r0, 16 - ldr r0, =0x0000ffff - bl gpu_pal_tags_index_of - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0xFF - beq _080087FC - ldr r1, =0x03000cf0 - lsls r0, r2, 1 - adds r0, r1 - strh r4, [r0] - adds r0, r2, 0 - b _080087FE - .align 2, 0 - .pool -_080087FC: - movs r0, 0xFF -_080087FE: - pop {r4} - pop {r1} - bx r1 - thumb_func_end gpu_pal_alloc_new - - thumb_func_start gpu_pal_tags_index_of -gpu_pal_tags_index_of: @ 8008804 - push {lr} - lsls r0, 16 - lsrs r2, r0, 16 - ldr r0, =0x0300301c - ldrb r1, [r0] - cmp r1, 0xF - bhi _08008836 - ldr r3, =0x03000cf0 -_08008814: - lsls r0, r1, 1 - adds r0, r3 - ldrh r0, [r0] - cmp r0, r2 - bne _0800882C - adds r0, r1, 0 - b _08008838 - .align 2, 0 - .pool -_0800882C: - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0xF - bls _08008814 -_08008836: - movs r0, 0xFF -_08008838: - pop {r1} - bx r1 - thumb_func_end gpu_pal_tags_index_of - - thumb_func_start gpu_pal_tag_by_index -gpu_pal_tag_by_index: @ 800883C - lsls r0, 24 - ldr r1, =0x03000cf0 - lsrs r0, 23 - adds r0, r1 - ldrh r0, [r0] - bx lr - .align 2, 0 - .pool - thumb_func_end gpu_pal_tag_by_index - - thumb_func_start gpu_pal_free_tag -gpu_pal_free_tag: @ 800884C - push {lr} - lsls r0, 16 - lsrs r0, 16 - bl gpu_pal_tags_index_of - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0xFF - beq _08008868 - ldr r0, =0x03000cf0 - lsls r1, 1 - adds r1, r0 - ldr r0, =0x0000ffff - strh r0, [r1] -_08008868: - pop {r0} - bx r0 - .align 2, 0 - .pool - thumb_func_end gpu_pal_free_tag - - thumb_func_start obj_set_f18_to_r0_f42_to_40 -obj_set_f18_to_r0_f42_to_40: @ 8008874 - str r1, [r0, 0x18] - adds r0, 0x42 - movs r1, 0x40 - strb r1, [r0] - bx lr - thumb_func_end obj_set_f18_to_r0_f42_to_40 - - thumb_func_start super_sprite_add -super_sprite_add: @ 8008880 - push {r4,lr} - adds r4, r0, 0 - adds r3, r1, 0 - ldr r1, =0x02021b38 - ldrb r0, [r3] - ldrb r1, [r1] - cmp r0, r1 - bcc _08008898 - movs r0, 0x1 - b _080088E0 - .align 2, 0 - .pool -_08008898: - ldr r0, [r4, 0x18] - cmp r0, 0 - beq _080088AC - adds r0, r4, 0 - adds r0, 0x42 - ldrb r1, [r0] - movs r0, 0xC0 - ands r0, r1 - cmp r0, 0 - bne _080088CC -_080088AC: - ldr r0, =0x030022c0 - ldrb r2, [r3] - lsls r2, 3 - adds r0, 0x38 - adds r2, r0 - ldr r0, [r4] - ldr r1, [r4, 0x4] - str r0, [r2] - str r1, [r2, 0x4] - ldrb r0, [r3] - adds r0, 0x1 - strb r0, [r3] - movs r0, 0 - b _080088E0 - .align 2, 0 - .pool -_080088CC: - ldrb r1, [r3] - lsls r1, 3 - ldr r0, =0x030022f8 - adds r1, r0 - adds r0, r4, 0 - adds r2, r3, 0 - bl sub_80088EC - lsls r0, 24 - lsrs r0, 24 -_080088E0: - pop {r4} - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end super_sprite_add - - thumb_func_start sub_80088EC -sub_80088EC: @ 80088EC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x1C - adds r3, r0, 0 - str r1, [sp] - mov r8, r2 - ldr r0, =0x02021b38 - ldrb r1, [r2] - ldrb r0, [r0] - cmp r1, r0 - bcc _08008910 -_08008908: - movs r0, 0x1 - b _08008AE6 - .align 2, 0 - .pool -_08008910: - adds r0, r3, 0 - adds r0, 0x42 - ldrb r1, [r0] - lsls r1, 26 - lsrs r1, 23 - ldr r2, [r3, 0x18] - adds r7, r2, r1 - mov r12, r3 - str r0, [sp, 0x18] - cmp r7, 0 - beq _0800892C - ldr r0, [r7, 0x4] - cmp r0, 0 - bne _08008942 -_0800892C: - mov r2, r12 - ldr r0, [r2] - ldr r1, [r2, 0x4] - ldr r2, [sp] - str r0, [r2] - str r1, [r2, 0x4] - mov r1, r8 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _08008AE4 -_08008942: - mov r2, r12 - ldrh r0, [r2, 0x4] - lsls r0, 22 - lsrs r0, 22 - str r0, [sp, 0x4] - ldrb r0, [r7] - str r0, [sp, 0xC] - ldrb r0, [r2, 0x3] - lsls r0, 26 - lsrs r0, 27 - asrs r1, r0, 3 - str r1, [sp, 0x10] - movs r1, 0x1 - ldr r2, [sp, 0x10] - ands r2, r1 - str r2, [sp, 0x10] - asrs r0, 4 - mov r10, r0 - ands r0, r1 - mov r10, r0 - mov r1, r12 - ldrh r0, [r1, 0x2] - lsls r0, 23 - lsrs r0, 23 - adds r1, 0x28 - ldrb r1, [r1] - lsls r1, 24 - asrs r1, 24 - subs r0, r1 - lsls r0, 16 - lsrs r2, r0, 16 - mov r1, r12 - ldrb r0, [r1] - adds r1, 0x29 - ldrb r1, [r1] - lsls r1, 24 - asrs r1, 24 - subs r0, r1 - lsls r0, 16 - lsrs r0, 16 - str r0, [sp, 0x8] - movs r0, 0 - mov r9, r0 - ldr r1, [sp, 0xC] - cmp r9, r1 - bcc _080089A0 - b _08008AE4 -_080089A0: - lsls r0, r2, 16 - asrs r0, 16 - str r0, [sp, 0x14] -_080089A6: - mov r2, r8 - ldrb r0, [r2] - ldr r1, =0x02021b38 - ldrb r1, [r1] - cmp r0, r1 - bcs _08008908 - ldr r0, [r7, 0x4] - mov r2, r9 - lsls r6, r2, 2 - adds r2, r6, r0 - movs r0, 0 - ldrsb r0, [r2, r0] - lsls r0, 16 - lsrs r4, r0, 16 - movs r0, 0x1 - ldrsb r0, [r2, r0] - lsls r0, 16 - lsrs r5, r0, 16 - ldr r0, [sp, 0x10] - cmp r0, 0 - beq _080089FC - ldr r0, [r2] - lsls r1, r0, 12 - lsrs r1, 30 - lsls r1, 2 - lsls r0, 14 - lsrs r0, 30 - lsls r0, 4 - adds r1, r0 - ldr r0, =0x082ec754 - adds r1, r0 - ldrb r1, [r1] - lsls r1, 24 - asrs r1, 24 - lsls r0, r4, 16 - asrs r0, 16 - adds r0, r1 - lsls r0, 16 - lsrs r4, r0, 16 - mvns r0, r4 - adds r0, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 -_080089FC: - mov r1, r10 - cmp r1, 0 - beq _08008A2E - ldr r0, [r2] - lsls r1, r0, 12 - lsrs r1, 30 - lsls r1, 2 - lsls r0, 14 - lsrs r0, 30 - lsls r0, 4 - adds r1, r0 - ldr r2, =0x082ec754 - adds r1, r2 - ldrb r1, [r1, 0x1] - lsls r1, 24 - asrs r1, 24 - lsls r0, r5, 16 - asrs r0, 16 - adds r0, r1 - lsls r0, 16 - lsrs r5, r0, 16 - mvns r0, r5 - adds r0, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 -_08008A2E: - mov r1, r9 - lsls r0, r1, 3 - ldr r2, [sp] - adds r3, r0, r2 - mov r2, r12 - ldr r0, [r2] - ldr r1, [r2, 0x4] - str r0, [r3] - str r1, [r3, 0x4] - ldr r0, [r7, 0x4] - adds r0, r6, r0 - ldr r1, [r0] - lsls r1, 14 - lsrs r1, 30 - lsls r1, 6 - ldrb r2, [r3, 0x1] - movs r0, 0x3F - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0x1] - ldr r0, [r7, 0x4] - adds r0, r6, r0 - ldr r1, [r0] - lsls r1, 12 - lsrs r1, 30 - lsls r1, 6 - ldrb r2, [r3, 0x3] - movs r0, 0x3F - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0x3] - lsls r1, r4, 16 - asrs r1, 16 - ldr r0, [sp, 0x14] - adds r1, r0, r1 - ldr r2, =0x000001ff - adds r0, r2, 0 - ands r1, r0 - ldrh r2, [r3, 0x2] - ldr r0, =0xfffffe00 - ands r0, r2 - orrs r0, r1 - strh r0, [r3, 0x2] - ldr r1, [sp, 0x8] - adds r0, r1, r5 - strb r0, [r3] - ldr r0, [r7, 0x4] - adds r0, r6, r0 - ldr r1, [r0] - lsls r1, 2 - lsrs r1, 22 - ldr r2, [sp, 0x4] - adds r1, r2, r1 - ldr r2, =0x000003ff - adds r0, r2, 0 - ands r1, r0 - ldrh r2, [r3, 0x4] - ldr r0, =0xfffffc00 - ands r0, r2 - orrs r0, r1 - strh r0, [r3, 0x4] - ldr r0, [sp, 0x18] - ldrb r1, [r0] - movs r0, 0xC0 - ands r0, r1 - cmp r0, 0x80 - beq _08008ACA - ldr r0, [r7, 0x4] - adds r0, r6, r0 - ldr r1, [r0] - lsrs r1, 30 - lsls r1, 2 - ldrb r2, [r3, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0x5] -_08008ACA: - mov r0, r9 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - mov r1, r8 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldr r2, [sp, 0xC] - cmp r9, r2 - bcs _08008AE4 - b _080089A6 -_08008AE4: - movs r0, 0 -_08008AE6: - add sp, 0x1C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .align 2, 0 - .pool - thumb_func_end sub_80088EC + .include "main.s" + .include "malloc.s" + .include "dma3_manager.s" + .include "gpu_reg_manager.s" + .include "gpu_bg.s" + .include "pixel_buffer.s" + .include "window.s" + .include "text_renderer.s" + .include "gpu_obj.s" thumb_func_start strcpy_limit_10_chars strcpy_limit_10_chars: @ 8008B10 diff --git a/asm/gpu_bg.s b/asm/gpu_bg.s new file mode 100644 index 000000000..16416062a --- /dev/null +++ b/asm/gpu_bg.s @@ -0,0 +1,3380 @@ + thumb_func_start gpu_init_bgs +gpu_init_bgs: @ 80012F0 + push {lr} + bl gpu_reset_bg_configs + ldr r1, =0x030008e0 + movs r0, 0 + strh r0, [r1, 0x10] + bl gpu_sync_text_mode_and_hide_bgs + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end gpu_init_bgs + + thumb_func_start gpu_set_bg_mode +gpu_set_bg_mode: @ 8001308 + 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 + .align 2, 0 + .pool + thumb_func_end gpu_set_bg_mode + + thumb_func_start gpu_get_bg_mode +gpu_get_bg_mode: @ 8001324 + ldr r0, =0x030008e0 + ldrb r1, [r0, 0x10] + movs r0, 0x7 + ands r0, r1 + bx lr + .align 2, 0 + .pool + thumb_func_end gpu_get_bg_mode + + thumb_func_start gpu_reset_bg_configs +gpu_reset_bg_configs: @ 8001334 + push {lr} + ldr r2, =0x030008e0 + ldr r0, =0x082e9580 + ldr r0, [r0] + adds r1, r2, 0 + adds r1, 0xC +_08001340: + str r0, [r1] + subs r1, 0x4 + cmp r1, r2 + bge _08001340 + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end gpu_reset_bg_configs + + thumb_func_start sub_8001354 +sub_8001354: @ 8001354 + push {r4,lr} + lsls r0, 24 + lsrs r4, r0, 24 + adds r0, r4, 0 + bl is_invalid_bg_id + lsls r0, 24 + cmp r0, 0 + bne _08001372 + ldr r1, =0x030008e0 + lsls r0, r4, 2 + adds r0, r1 + ldr r1, =0x082e9580 + ldr r1, [r1] + str r1, [r0] +_08001372: + pop {r4} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end sub_8001354 + + thumb_func_start gpu_bg_config_set_fields +gpu_bg_config_set_fields: @ 8001380 + 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 + bl is_invalid_bg_id + lsls r0, 24 + lsrs r0, 24 + mov r12, r0 + cmp r0, 0 + bne _08001498 + ldr r2, =0x030008e0 + mov r8, r2 + mov r0, r10 + cmp r0, 0xFF + beq _080013F4 + 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] +_080013F4: + cmp r6, 0xFF + beq _0800140C + 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] +_0800140C: + mov r1, r9 + cmp r1, 0xFF + beq _08001428 + 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] +_08001428: + ldr r6, [sp, 0x4] + cmp r6, 0xFF + beq _0800143E + 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] +_0800143E: + cmp r5, 0xFF + beq _08001456 + 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] +_08001456: + cmp r4, 0xFF + beq _0800146E + 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] +_0800146E: + ldr r0, [sp, 0xC] + cmp r0, 0xFF + beq _08001484 + 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] +_08001484: + 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] +_08001498: + add sp, 0x10 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end gpu_bg_config_set_fields + + thumb_func_start gpu_bg_config_get_field +gpu_bg_config_get_field: @ 80014AC + push {r4,r5,lr} + lsls r0, 24 + lsrs r4, r0, 24 + lsls r1, 24 + lsrs r5, r1, 24 + adds r0, r4, 0 + bl is_invalid_bg_id + lsls r0, 24 + cmp r0, 0 + bne _08001558 + ldr r1, =0x030008e0 + lsls r2, r4, 2 + adds r0, r2, r1 + ldrb r0, [r0] + lsls r0, 31 + adds r3, r1, 0 + cmp r0, 0 + beq _08001558 + subs r0, r5, 0x1 + cmp r0, 0x7 + bhi _08001558 + lsls r0, 2 + ldr r1, =_080014EC + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .align 2, 0 + .pool + .align 2, 0 +_080014EC: + .4byte _0800150C + .4byte _08001516 + .4byte _08001520 + .4byte _0800152A + .4byte _08001534 + .4byte _0800153C + .4byte _08001546 + .4byte _08001550 +_0800150C: + adds r0, r2, r3 + ldrb r0, [r0] + lsls r0, 31 + lsrs r0, 31 + b _0800155A +_08001516: + adds r0, r2, r3 + ldrb r0, [r0, 0x1] + lsls r0, 30 + lsrs r0, 30 + b _0800155A +_08001520: + adds r0, r2, r3 + ldrb r0, [r0, 0x1] + lsls r0, 25 + lsrs r0, 27 + b _0800155A +_0800152A: + adds r0, r2, r3 + ldrb r0, [r0] + lsls r0, 28 + lsrs r0, 30 + b _0800155A +_08001534: + adds r0, r2, r3 + ldrb r0, [r0, 0x1] + lsrs r0, 7 + b _0800155A +_0800153C: + adds r0, r2, r3 + ldrb r0, [r0] + lsls r0, 26 + lsrs r0, 30 + b _0800155A +_08001546: + adds r0, r2, r3 + ldrb r0, [r0] + lsls r0, 25 + lsrs r0, 31 + b _0800155A +_08001550: + adds r0, r2, r3 + ldrb r0, [r0] + lsrs r0, 7 + b _0800155A +_08001558: + movs r0, 0xFF +_0800155A: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end gpu_bg_config_get_field + + thumb_func_start gpu_copy_to_vram_by_bg_id +gpu_copy_to_vram_by_bg_id: @ 8001560 + 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 + bl is_invalid_bg_id + lsls r0, 24 + cmp r0, 0 + bne _080015D8 + ldr r1, =0x030008e0 + lsls r0, r4, 2 + adds r1, r0, r1 + ldrb r0, [r1] + lsls r0, 31 + cmp r0, 0 + beq _080015D8 + cmp r5, 0x1 + beq _080015A4 + cmp r5, 0x2 + beq _080015AC + movs r2, 0xFF + b _080015DC + .align 2, 0 + .pool +_080015A4: + ldrb r0, [r1, 0x1] + lsls r0, 30 + lsrs r0, 16 + b _080015B4 +_080015AC: + ldrb r0, [r1, 0x1] + lsls r0, 25 + lsrs r0, 27 + lsls r0, 11 +_080015B4: + 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 dma3_transfer_queue_add_copy + lsls r0, 24 + lsrs r2, r0, 24 + asrs r0, 24 + movs r1, 0x1 + negs r1, r1 + cmp r0, r1 + bne _080015DC +_080015D8: + movs r0, 0xFF + b _080015DE +_080015DC: + adds r0, r2, 0 +_080015DE: + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end gpu_copy_to_vram_by_bg_id + + thumb_func_start gpu_bg_show +gpu_bg_show: @ 80015E8 + push {r4,r5,lr} + lsls r0, 24 + lsrs r4, r0, 24 + adds r0, r4, 0 + bl is_invalid_bg_id + lsls r0, 24 + cmp r0, 0 + bne _08001656 + ldr r5, =0x030008e0 + lsls r0, r4, 2 + adds r2, r0, r5 + ldrb r3, [r2] + lsls r0, r3, 31 + cmp r0, 0 + beq _08001656 + 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 + bl lcd_io_set + 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] +_08001656: + pop {r4,r5} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end gpu_bg_show + + thumb_func_start gpu_bg_hide +gpu_bg_hide: @ 8001664 + push {r4,lr} + lsls r0, 24 + lsrs r4, r0, 24 + adds r0, r4, 0 + bl is_invalid_bg_id + lsls r0, 24 + cmp r0, 0 + bne _0800168A + 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] +_0800168A: + pop {r4} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end gpu_bg_hide + + thumb_func_start gpu_sync_bg_visibility_and_mode +gpu_sync_bg_visibility_and_mode: @ 8001698 + push {lr} + movs r0, 0 + bl lcd_io_get + ldr r1, =0x0000f0f8 + ands r1, r0 + ldr r0, =0x030008e0 + ldrh r0, [r0, 0x10] + orrs r1, r0 + movs r0, 0 + bl lcd_io_set + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end gpu_sync_bg_visibility_and_mode + + thumb_func_start gpu_sync_text_mode_and_hide_bgs +gpu_sync_text_mode_and_hide_bgs: @ 80016BC + push {lr} + movs r0, 0 + bl lcd_io_get + ldr r1, =0x0000f0f8 + ands r1, r0 + movs r0, 0 + bl lcd_io_set + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end gpu_sync_text_mode_and_hide_bgs + + thumb_func_start gpu_bg_affine_set +gpu_bg_affine_set: @ 80016D8 + 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 + beq _08001720 + cmp r1, 0x1 + ble _08001796 + cmp r1, 0x2 + beq _08001726 + b _08001796 + .align 2, 0 + .pool +_08001720: + cmp r6, 0x2 + bne _08001796 + b _08001730 +_08001726: + subs r0, r6, 0x2 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bhi _08001796 +_08001730: + 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 + bl lcd_io_set + ldrh r1, [r4, 0x2] + movs r0, 0x22 + bl lcd_io_set + ldrh r1, [r4, 0x4] + movs r0, 0x24 + bl lcd_io_set + ldrh r1, [r4, 0x6] + movs r0, 0x26 + bl lcd_io_set + ldrh r1, [r4] + movs r0, 0x20 + bl lcd_io_set + ldrh r1, [r4, 0x8] + movs r0, 0x28 + bl lcd_io_set + ldrh r1, [r4, 0xA] + movs r0, 0x2A + bl lcd_io_set + ldrh r1, [r4, 0xC] + movs r0, 0x2C + bl lcd_io_set + ldrh r1, [r4, 0xE] + movs r0, 0x2E + bl lcd_io_set +_08001796: + add sp, 0x24 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end gpu_bg_affine_set + + thumb_func_start is_invalid_bg_id +is_invalid_bg_id: @ 80017A4 + push {lr} + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x3 + bhi _080017B2 + movs r0, 0 + b _080017B4 +_080017B2: + movs r0, 0x1 +_080017B4: + pop {r1} + bx r1 + thumb_func_end is_invalid_bg_id + + thumb_func_start do_nothing +do_nothing: @ 80017B8 + movs r0, 0 + bx lr + thumb_func_end do_nothing + + thumb_func_start gpu_reset_bgs_and_dma3_busy_flags +gpu_reset_bgs_and_dma3_busy_flags: @ 80017BC + push {r4,lr} + adds r4, r0, 0 + bl gpu_init_bgs + ldr r1, =0x03000938 + movs r2, 0 + adds r0, r1, 0 + adds r0, 0xC +_080017CC: + str r2, [r0] + subs r0, 0x4 + cmp r0, r1 + bge _080017CC + ldr r0, =0x03002f54 + str r4, [r0] + pop {r4} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end gpu_reset_bgs_and_dma3_busy_flags + + thumb_func_start bg_vram_setup +bg_vram_setup: @ 80017E8 + 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 + bl gpu_set_bg_mode + bl gpu_reset_bg_configs + cmp r4, 0 + beq _08001894 + 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 +_0800181A: + ldr r4, [r6] + lsls r0, r4, 30 + lsrs r5, r0, 30 + cmp r5, 0x3 + bhi _08001886 + 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 + bl gpu_bg_config_set_fields + 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] +_08001886: + adds r6, 0x4 + movs r5, 0x1 + negs r5, r5 + add r8, r5 + mov r0, r8 + cmp r0, 0 + bne _0800181A +_08001894: + add sp, 0x10 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end bg_vram_setup + + thumb_func_start bg_init_bg_config_2_from_bg_config_3 +bg_init_bg_config_2_from_bg_config_3: @ 80018B0 + 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 + bhi _08001920 + 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 + bl gpu_bg_config_set_fields + 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] +_08001920: + add sp, 0x10 + pop {r4-r7} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end bg_init_bg_config_2_from_bg_config_3 + + thumb_func_start call_gpu_set_bg_mode +call_gpu_set_bg_mode: @ 8001934 + push {lr} + lsls r0, 24 + lsrs r0, 24 + bl gpu_set_bg_mode + pop {r0} + bx r0 + thumb_func_end call_gpu_set_bg_mode + + thumb_func_start gpu_copy_bg_tile_pattern_data_to_vram +gpu_copy_bg_tile_pattern_data_to_vram: @ 8001944 + 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 + bl gpu_bg_config_get_field + lsls r0, 16 + cmp r0, 0 + bne _08001980 + 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 + b _08001990 + .align 2, 0 + .pool +_08001980: + 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 +_08001990: + 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 + bl gpu_copy_to_vram_by_bg_id + lsls r2, r0, 24 + lsrs r1, r2, 24 + adds r7, r1, 0 + cmp r1, 0xFF + bne _080019B8 + ldr r0, =0x0000ffff + b _080019E6 + .align 2, 0 + .pool +_080019B8: + 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 + bne _080019E4 + lsrs r1, r4, 5 + mov r0, r8 + lsrs r2, r0, 5 + adds r0, r5, 0 + movs r3, 0x1 + bl do_nothing +_080019E4: + adds r0, r7, 0 +_080019E6: + add sp, 0x4 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end gpu_copy_bg_tile_pattern_data_to_vram + + thumb_func_start gpu_copy_bg_tile_map_to_vram +gpu_copy_bg_tile_map_to_vram: @ 80019FC + 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] + bl gpu_copy_to_vram_by_bg_id + lsls r2, r0, 24 + lsrs r3, r2, 24 + cmp r3, 0xFF + beq _08001A3C + 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 + b _08001A3E + .align 2, 0 + .pool +_08001A3C: + ldr r0, =0x0000ffff +_08001A3E: + add sp, 0x4 + pop {r4} + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end gpu_copy_bg_tile_map_to_vram + + thumb_func_start unused_copy_palette +unused_copy_palette: @ 8001A4C + 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 + bl is_invalid_bg_id_2 + cmp r0, 0 + bne _08001A98 + 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 dma3_transfer_queue_add_copy + lsls r3, r0, 24 + asrs r1, r3, 24 + movs r0, 0x1 + negs r0, r0 + cmp r1, r0 + bne _08001AA4 +_08001A98: + ldr r0, =0x0000ffff + b _08001AC8 + .align 2, 0 + .pool +_08001AA4: + ldr r4, =0x03000938 + adds r0, r1, 0 + cmp r1, 0 + bge _08001AAE + adds r0, 0x1F +_08001AAE: + 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 +_08001AC8: + pop {r4-r7} + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end unused_copy_palette + + thumb_func_start is_dma3_queue_busy_with_gpu_copy +is_dma3_queue_busy_with_gpu_copy: @ 8001AD4 + push {r4-r7,lr} + movs r5, 0 + movs r7, 0x1 + negs r7, r7 +_08001ADC: + adds r0, r5, 0 + cmp r5, 0 + bge _08001AE4 + adds r0, 0x1F +_08001AE4: + 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 + beq _08001B22 + lsls r0, r5, 16 + asrs r0, 16 + bl dma3_transfer_queue_check_for_space + lsls r0, 24 + asrs r0, 24 + cmp r0, r7 + bne _08001B1C + movs r0, 0x1 + b _08001B2A + .align 2, 0 + .pool +_08001B1C: + ldr r0, [r4] + bics r0, r6 + str r0, [r4] +_08001B22: + adds r5, 0x1 + cmp r5, 0x7F + ble _08001ADC + movs r0, 0 +_08001B2A: + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end is_dma3_queue_busy_with_gpu_copy + + thumb_func_start gpu_sync_bg_show +gpu_sync_bg_show: @ 8001B30 + push {lr} + lsls r0, 24 + lsrs r0, 24 + bl gpu_bg_show + bl gpu_sync_bg_visibility_and_mode + pop {r0} + bx r0 + thumb_func_end gpu_sync_bg_show + + thumb_func_start gpu_sync_bg_hide +gpu_sync_bg_hide: @ 8001B44 + push {lr} + lsls r0, 24 + lsrs r0, 24 + bl gpu_bg_hide + bl gpu_sync_bg_visibility_and_mode + pop {r0} + bx r0 + thumb_func_end gpu_sync_bg_hide + + thumb_func_start gpu_bg_config_set_field +gpu_bg_config_set_field: @ 8001B58 + 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 + bhi _08001C12 + lsls r0, 2 + ldr r1, =_08001B7C + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .align 2, 0 + .pool + .align 2, 0 +_08001B7C: + .4byte _08001B98 + .4byte _08001BA8 + .4byte _08001BBA + .4byte _08001BD0 + .4byte _08001BE4 + .4byte _08001BFC + .4byte _08001BDA +_08001B98: + 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 + b _08001BF2 +_08001BA8: + 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 + b _08001BF4 +_08001BBA: + 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 + bl gpu_bg_config_set_fields + b _08001C12 +_08001BD0: + str r3, [sp] + movs r0, 0xFF + str r0, [sp, 0x4] + str r0, [sp, 0x8] + b _08001BEC +_08001BDA: + movs r0, 0xFF + str r0, [sp] + str r3, [sp, 0x4] + str r0, [sp, 0x8] + b _08001BEC +_08001BE4: + movs r0, 0xFF + str r0, [sp] + str r0, [sp, 0x4] + str r3, [sp, 0x8] +_08001BEC: + str r0, [sp, 0xC] + adds r0, r4, 0 + movs r1, 0xFF +_08001BF2: + movs r2, 0xFF +_08001BF4: + movs r3, 0xFF + bl gpu_bg_config_set_fields + b _08001C12 +_08001BFC: + 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 + bl gpu_bg_config_set_fields +_08001C12: + add sp, 0x10 + pop {r4} + pop {r0} + bx r0 + thumb_func_end gpu_bg_config_set_field + + thumb_func_start bg_get_field +bg_get_field: @ 8001C1C + push {r4,lr} + lsls r0, 24 + lsrs r4, r0, 24 + lsls r1, 24 + lsrs r1, 24 + subs r0, r1, 0x1 + cmp r0, 0x9 + bhi _08001CF8 + lsls r0, 2 + ldr r1, =_08001C3C + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .align 2, 0 + .pool + .align 2, 0 +_08001C3C: + .4byte _08001C64 + .4byte _08001C6E + .4byte _08001C78 + .4byte _08001C82 + .4byte _08001C96 + .4byte _08001CA0 + .4byte _08001C8C + .4byte _08001CAA + .4byte _08001CD8 + .4byte _08001CE4 +_08001C64: + adds r0, r4, 0 + movs r1, 0x2 + bl gpu_bg_config_get_field + b _08001CDE +_08001C6E: + adds r0, r4, 0 + movs r1, 0x3 + bl gpu_bg_config_get_field + b _08001CDE +_08001C78: + adds r0, r4, 0 + movs r1, 0x4 + bl gpu_bg_config_get_field + b _08001CDE +_08001C82: + adds r0, r4, 0 + movs r1, 0x5 + bl gpu_bg_config_get_field + b _08001CDE +_08001C8C: + adds r0, r4, 0 + movs r1, 0x6 + bl gpu_bg_config_get_field + b _08001CDE +_08001C96: + adds r0, r4, 0 + movs r1, 0x7 + bl gpu_bg_config_get_field + b _08001CDE +_08001CA0: + adds r0, r4, 0 + movs r1, 0x8 + bl gpu_bg_config_get_field + b _08001CDE +_08001CAA: + adds r0, r4, 0 + bl bg_get_type_by_bg_id + cmp r0, 0 + beq _08001CBC + cmp r0, 0x1 + beq _08001CCA + movs r0, 0 + b _08001CFA +_08001CBC: + adds r0, r4, 0 + movs r1, 0 + bl bg_get_screen_size_in_regular_mode + lsls r0, 27 + lsrs r0, 16 + b _08001CFA +_08001CCA: + adds r0, r4, 0 + movs r1, 0 + bl bg_get_screen_size_in_affine_mode + lsls r0, 24 + lsrs r0, 16 + b _08001CFA +_08001CD8: + adds r0, r4, 0 + bl bg_get_type_by_bg_id +_08001CDE: + lsls r0, 16 + lsrs r0, 16 + b _08001CFA +_08001CE4: + ldr r0, =0x030008f8 + lsls r1, r4, 4 + adds r1, r0 + ldrh r0, [r1] + lsls r0, 22 + lsrs r0, 22 + b _08001CFA + .align 2, 0 + .pool +_08001CF8: + ldr r0, =0x0000ffff +_08001CFA: + pop {r4} + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end bg_get_field + + thumb_func_start bg_change_x_offset +bg_change_x_offset: @ 8001D04 + 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 + bl is_invalid_bg_id_2 + cmp r0, 0 + bne _08001D28 + adds r0, r4, 0 + movs r1, 0x1 + bl gpu_bg_config_get_field + lsls r0, 16 + cmp r0, 0 + bne _08001D2E +_08001D28: + movs r0, 0x1 + negs r0, r0 + b _08001E34 +_08001D2E: + cmp r5, 0x1 + beq _08001D4C + cmp r5, 0x1 + ble _08001D3A + cmp r5, 0x2 + beq _08001D60 +_08001D3A: + ldr r0, =0x030008f8 + lsls r1, r4, 4 + adds r0, 0x8 + adds r0, r1, r0 + str r6, [r0] + adds r5, r1, 0 + b _08001D70 + .align 2, 0 + .pool +_08001D4C: + ldr r0, =0x030008f8 + lsls r2, r4, 4 + adds r0, 0x8 + adds r0, r2, r0 + ldr r1, [r0] + adds r1, r6 + b _08001D6C + .align 2, 0 + .pool +_08001D60: + ldr r0, =0x030008f8 + lsls r2, r4, 4 + adds r0, 0x8 + adds r0, r2, r0 + ldr r1, [r0] + subs r1, r6 +_08001D6C: + str r1, [r0] + adds r5, r2, 0 +_08001D70: + bl gpu_get_bg_mode + lsls r0, 24 + lsrs r0, 24 + cmp r4, 0x1 + beq _08001DAC + cmp r4, 0x1 + bgt _08001D8C + cmp r4, 0 + beq _08001D96 + b _08001E2C + .align 2, 0 + .pool +_08001D8C: + cmp r4, 0x2 + beq _08001DC0 + cmp r4, 0x3 + beq _08001DF8 + b _08001E2C +_08001D96: + ldr r0, =0x030008f8 + ldr r0, [r0, 0x8] + lsls r0, 8 + lsrs r1, r0, 16 + movs r0, 0x10 + bl lcd_io_set + b _08001E2C + .align 2, 0 + .pool +_08001DAC: + ldr r0, =0x030008f8 + ldr r0, [r0, 0x18] + lsls r0, 8 + lsrs r1, r0, 16 + movs r0, 0x14 + bl lcd_io_set + b _08001E2C + .align 2, 0 + .pool +_08001DC0: + cmp r0, 0 + bne _08001DD8 + ldr r0, =0x030008f8 + ldr r0, [r0, 0x28] + lsls r0, 8 + lsrs r1, r0, 16 + movs r0, 0x18 + bl lcd_io_set + b _08001E2C + .align 2, 0 + .pool +_08001DD8: + ldr r0, =0x030008f8 + ldr r0, [r0, 0x28] + lsrs r1, r0, 16 + lsls r0, 16 + lsrs r4, r0, 16 + movs r0, 0x2A + bl lcd_io_set + movs r0, 0x28 + adds r1, r4, 0 + bl lcd_io_set + b _08001E2C + .align 2, 0 + .pool +_08001DF8: + cmp r0, 0 + bne _08001E10 + ldr r0, =0x030008f8 + ldr r0, [r0, 0x38] + lsls r0, 8 + lsrs r1, r0, 16 + movs r0, 0x1C + bl lcd_io_set + b _08001E2C + .align 2, 0 + .pool +_08001E10: + cmp r0, 0x2 + bne _08001E2C + ldr r0, =0x030008f8 + ldr r0, [r0, 0x38] + lsrs r1, r0, 16 + lsls r0, 16 + lsrs r4, r0, 16 + movs r0, 0x3A + bl lcd_io_set + movs r0, 0x38 + adds r1, r4, 0 + bl lcd_io_set +_08001E2C: + ldr r0, =0x030008f8 + adds r0, 0x8 + adds r0, r5, r0 + ldr r0, [r0] +_08001E34: + pop {r4-r6} + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end bg_change_x_offset + + thumb_func_start bg_get_x_offset +bg_get_x_offset: @ 8001E40 + push {r4,lr} + lsls r0, 24 + lsrs r0, 24 + adds r4, r0, 0 + bl is_invalid_bg_id_2 + cmp r0, 0 + bne _08001E70 + adds r0, r4, 0 + movs r1, 0x1 + bl gpu_bg_config_get_field + lsls r0, 16 + cmp r0, 0 + beq _08001E70 + ldr r0, =0x030008f8 + lsls r1, r4, 4 + adds r0, 0x8 + adds r1, r0 + ldr r0, [r1] + b _08001E74 + .align 2, 0 + .pool +_08001E70: + movs r0, 0x1 + negs r0, r0 +_08001E74: + pop {r4} + pop {r1} + bx r1 + thumb_func_end bg_get_x_offset + + thumb_func_start bg_change_y_offset +bg_change_y_offset: @ 8001E7C + 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 + bl is_invalid_bg_id_2 + cmp r0, 0 + bne _08001EA0 + adds r0, r4, 0 + movs r1, 0x1 + bl gpu_bg_config_get_field + lsls r0, 16 + cmp r0, 0 + bne _08001EA6 +_08001EA0: + movs r0, 0x1 + negs r0, r0 + b _08001FAC +_08001EA6: + cmp r5, 0x1 + beq _08001EC4 + cmp r5, 0x1 + ble _08001EB2 + cmp r5, 0x2 + beq _08001ED8 +_08001EB2: + ldr r0, =0x030008f8 + lsls r1, r4, 4 + adds r0, 0xC + adds r0, r1, r0 + str r6, [r0] + adds r5, r1, 0 + b _08001EE8 + .align 2, 0 + .pool +_08001EC4: + ldr r0, =0x030008f8 + lsls r2, r4, 4 + adds r0, 0xC + adds r0, r2, r0 + ldr r1, [r0] + adds r1, r6 + b _08001EE4 + .align 2, 0 + .pool +_08001ED8: + ldr r0, =0x030008f8 + lsls r2, r4, 4 + adds r0, 0xC + adds r0, r2, r0 + ldr r1, [r0] + subs r1, r6 +_08001EE4: + str r1, [r0] + adds r5, r2, 0 +_08001EE8: + bl gpu_get_bg_mode + lsls r0, 24 + lsrs r0, 24 + cmp r4, 0x1 + beq _08001F24 + cmp r4, 0x1 + bgt _08001F04 + cmp r4, 0 + beq _08001F0E + b _08001FA4 + .align 2, 0 + .pool +_08001F04: + cmp r4, 0x2 + beq _08001F38 + cmp r4, 0x3 + beq _08001F70 + b _08001FA4 +_08001F0E: + ldr r0, =0x030008f8 + ldr r0, [r0, 0xC] + lsls r0, 8 + lsrs r1, r0, 16 + movs r0, 0x12 + bl lcd_io_set + b _08001FA4 + .align 2, 0 + .pool +_08001F24: + ldr r0, =0x030008f8 + ldr r0, [r0, 0x1C] + lsls r0, 8 + lsrs r1, r0, 16 + movs r0, 0x16 + bl lcd_io_set + b _08001FA4 + .align 2, 0 + .pool +_08001F38: + cmp r0, 0 + bne _08001F50 + ldr r0, =0x030008f8 + ldr r0, [r0, 0x2C] + lsls r0, 8 + lsrs r1, r0, 16 + movs r0, 0x1A + bl lcd_io_set + b _08001FA4 + .align 2, 0 + .pool +_08001F50: + ldr r0, =0x030008f8 + ldr r0, [r0, 0x2C] + lsrs r1, r0, 16 + lsls r0, 16 + lsrs r4, r0, 16 + movs r0, 0x2E + bl lcd_io_set + movs r0, 0x2C + adds r1, r4, 0 + bl lcd_io_set + b _08001FA4 + .align 2, 0 + .pool +_08001F70: + cmp r0, 0 + bne _08001F88 + ldr r0, =0x030008f8 + ldr r0, [r0, 0x3C] + lsls r0, 8 + lsrs r1, r0, 16 + movs r0, 0x1E + bl lcd_io_set + b _08001FA4 + .align 2, 0 + .pool +_08001F88: + cmp r0, 0x2 + bne _08001FA4 + ldr r0, =0x030008f8 + ldr r0, [r0, 0x3C] + lsrs r1, r0, 16 + lsls r0, 16 + lsrs r4, r0, 16 + movs r0, 0x3E + bl lcd_io_set + movs r0, 0x3C + adds r1, r4, 0 + bl lcd_io_set +_08001FA4: + ldr r0, =0x030008f8 + adds r0, 0xC + adds r0, r5, r0 + ldr r0, [r0] +_08001FAC: + pop {r4-r6} + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end bg_change_y_offset + + thumb_func_start bg_change_y_offset_to_copy_queue +bg_change_y_offset_to_copy_queue: @ 8001FB8 + 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 + bl is_invalid_bg_id_2 + cmp r0, 0 + bne _08001FDC + adds r0, r4, 0 + movs r1, 0x1 + bl gpu_bg_config_get_field + lsls r0, 16 + cmp r0, 0 + bne _08001FE2 +_08001FDC: + movs r0, 0x1 + negs r0, r0 + b _080020E8 +_08001FE2: + cmp r5, 0x1 + beq _08002000 + cmp r5, 0x1 + ble _08001FEE + cmp r5, 0x2 + beq _08002014 +_08001FEE: + ldr r0, =0x030008f8 + lsls r1, r4, 4 + adds r0, 0xC + adds r0, r1, r0 + str r6, [r0] + adds r5, r1, 0 + b _08002024 + .align 2, 0 + .pool +_08002000: + ldr r0, =0x030008f8 + lsls r2, r4, 4 + adds r0, 0xC + adds r0, r2, r0 + ldr r1, [r0] + adds r1, r6 + b _08002020 + .align 2, 0 + .pool +_08002014: + ldr r0, =0x030008f8 + lsls r2, r4, 4 + adds r0, 0xC + adds r0, r2, r0 + ldr r1, [r0] + subs r1, r6 +_08002020: + str r1, [r0] + adds r5, r2, 0 +_08002024: + bl gpu_get_bg_mode + lsls r0, 24 + lsrs r0, 24 + cmp r4, 0x1 + beq _08002060 + cmp r4, 0x1 + bgt _08002040 + cmp r4, 0 + beq _0800204A + b _080020E0 + .align 2, 0 + .pool +_08002040: + cmp r4, 0x2 + beq _08002074 + cmp r4, 0x3 + beq _080020AC + b _080020E0 +_0800204A: + ldr r0, =0x030008f8 + ldr r0, [r0, 0xC] + lsls r0, 8 + lsrs r1, r0, 16 + movs r0, 0x12 + bl lcd_io_set_forced_blank + b _080020E0 + .align 2, 0 + .pool +_08002060: + ldr r0, =0x030008f8 + ldr r0, [r0, 0x1C] + lsls r0, 8 + lsrs r1, r0, 16 + movs r0, 0x16 + bl lcd_io_set_forced_blank + b _080020E0 + .align 2, 0 + .pool +_08002074: + cmp r0, 0 + bne _0800208C + ldr r0, =0x030008f8 + ldr r0, [r0, 0x2C] + lsls r0, 8 + lsrs r1, r0, 16 + movs r0, 0x1A + bl lcd_io_set_forced_blank + b _080020E0 + .align 2, 0 + .pool +_0800208C: + ldr r0, =0x030008f8 + ldr r0, [r0, 0x2C] + lsrs r1, r0, 16 + lsls r0, 16 + lsrs r4, r0, 16 + movs r0, 0x2E + bl lcd_io_set_forced_blank + movs r0, 0x2C + adds r1, r4, 0 + bl lcd_io_set_forced_blank + b _080020E0 + .align 2, 0 + .pool +_080020AC: + cmp r0, 0 + bne _080020C4 + ldr r0, =0x030008f8 + ldr r0, [r0, 0x3C] + lsls r0, 8 + lsrs r1, r0, 16 + movs r0, 0x1E + bl lcd_io_set_forced_blank + b _080020E0 + .align 2, 0 + .pool +_080020C4: + cmp r0, 0x2 + bne _080020E0 + ldr r0, =0x030008f8 + ldr r0, [r0, 0x3C] + lsrs r1, r0, 16 + lsls r0, 16 + lsrs r4, r0, 16 + movs r0, 0x3E + bl lcd_io_set_forced_blank + movs r0, 0x3C + adds r1, r4, 0 + bl lcd_io_set_forced_blank +_080020E0: + ldr r0, =0x030008f8 + adds r0, 0xC + adds r0, r5, r0 + ldr r0, [r0] +_080020E8: + pop {r4-r6} + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end bg_change_y_offset_to_copy_queue + + thumb_func_start bg_get_y_offset +bg_get_y_offset: @ 80020F4 + push {r4,lr} + lsls r0, 24 + lsrs r0, 24 + adds r4, r0, 0 + bl is_invalid_bg_id_2 + cmp r0, 0 + bne _08002124 + adds r0, r4, 0 + movs r1, 0x1 + bl gpu_bg_config_get_field + lsls r0, 16 + cmp r0, 0 + beq _08002124 + ldr r0, =0x030008f8 + lsls r1, r4, 4 + adds r0, 0xC + adds r1, r0 + ldr r0, [r1] + b _08002128 + .align 2, 0 + .pool +_08002124: + movs r0, 0x1 + negs r0, r0 +_08002128: + pop {r4} + pop {r1} + bx r1 + thumb_func_end bg_get_y_offset + + thumb_func_start call_gpu_bg_affine_set +call_gpu_bg_affine_set: @ 8002130 + 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] + bl gpu_bg_affine_set + add sp, 0x10 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end call_gpu_bg_affine_set + + thumb_func_start mosaic_something +mosaic_something: @ 8002170 + push {r4-r6,lr} + lsls r0, 24 + lsrs r4, r0, 24 + lsls r1, 24 + lsrs r6, r1, 24 + movs r0, 0x4C + bl lcd_io_get + 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 + bhi _080021C4 + lsls r0, r6, 2 + ldr r1, =_080021A8 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .align 2, 0 + .pool + .align 2, 0 +_080021A8: + .4byte _080021C4 + .4byte _080021CC + .4byte _080021D2 + .4byte _080021E4 + .4byte _080021FA + .4byte _08002200 + .4byte _08002212 +_080021C4: + movs r3, 0xF + ands r3, r4 + lsrs r2, r4, 4 + b _08002226 +_080021CC: + movs r3, 0xF + ands r3, r4 + b _08002226 +_080021D2: + lsls r0, r3, 16 + asrs r0, 16 + adds r0, r4 + cmp r0, 0xF + ble _080021E0 + movs r3, 0xF + b _08002226 +_080021E0: + adds r0, r3, r4 + b _080021F4 +_080021E4: + lsls r0, r3, 16 + asrs r0, 16 + subs r0, r4 + cmp r0, 0 + bge _080021F2 + movs r3, 0 + b _08002226 +_080021F2: + subs r0, r3, r4 +_080021F4: + lsls r0, 16 + lsrs r3, r0, 16 + b _08002226 +_080021FA: + movs r2, 0xF + ands r2, r4 + b _08002226 +_08002200: + lsls r0, r2, 16 + asrs r0, 16 + adds r0, r4 + cmp r0, 0xF + ble _0800220E + movs r2, 0xF + b _08002226 +_0800220E: + adds r0, r2, r4 + b _08002222 +_08002212: + lsls r0, r2, 16 + asrs r0, 16 + subs r0, r4 + cmp r0, 0 + bge _08002220 + movs r2, 0 + b _08002226 +_08002220: + subs r0, r2, r4 +_08002222: + lsls r0, 16 + lsrs r2, r0, 16 +_08002226: + 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 + bl lcd_io_set + lsls r0, r5, 24 + lsrs r0, 24 + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end mosaic_something + + thumb_func_start bg_set_tilemap +bg_set_tilemap: @ 8002250 + push {r4,r5,lr} + adds r5, r1, 0 + lsls r0, 24 + lsrs r4, r0, 24 + adds r0, r4, 0 + bl is_invalid_bg_id_2 + cmp r0, 0 + bne _0800227A + adds r0, r4, 0 + movs r1, 0x1 + bl gpu_bg_config_get_field + lsls r0, 16 + cmp r0, 0 + beq _0800227A + ldr r0, =0x030008f8 + lsls r1, r4, 4 + adds r0, 0x4 + adds r1, r0 + str r5, [r1] +_0800227A: + pop {r4,r5} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end bg_set_tilemap + + thumb_func_start bg_unset_tilemap +bg_unset_tilemap: @ 8002284 + push {r4,r5,lr} + lsls r0, 24 + lsrs r4, r0, 24 + adds r0, r4, 0 + bl is_invalid_bg_id_2 + adds r5, r0, 0 + cmp r5, 0 + bne _080022AE + adds r0, r4, 0 + movs r1, 0x1 + bl gpu_bg_config_get_field + lsls r0, 16 + cmp r0, 0 + beq _080022AE + ldr r0, =0x030008f8 + lsls r1, r4, 4 + adds r0, 0x4 + adds r1, r0 + str r5, [r1] +_080022AE: + pop {r4,r5} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end bg_unset_tilemap + + thumb_func_start bg_get_tilemap +bg_get_tilemap: @ 80022B8 + push {r4,lr} + lsls r0, 24 + lsrs r0, 24 + adds r4, r0, 0 + bl is_invalid_bg_id_2 + cmp r0, 0 + bne _080022E8 + adds r0, r4, 0 + movs r1, 0x1 + bl gpu_bg_config_get_field + lsls r0, 16 + cmp r0, 0 + beq _080022E8 + ldr r0, =0x030008f8 + lsls r1, r4, 4 + adds r0, 0x4 + adds r1, r0 + ldr r0, [r1] + b _080022EA + .align 2, 0 + .pool +_080022E8: + movs r0, 0 +_080022EA: + pop {r4} + pop {r1} + bx r1 + thumb_func_end bg_get_tilemap + + thumb_func_start gpu_copy_to_wram_bg_tile_map +gpu_copy_to_wram_bg_tile_map: @ 80022F0 + 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 + bl is_invalid_bg_id_2 + cmp r0, 0 + bne _08002358 + adds r0, r4, 0 + bl IsTileMapOutsideWram + cmp r0, 0 + bne _08002358 + cmp r6, 0 + beq _08002340 + 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 + b _08002358 + .align 2, 0 + .pool +_08002340: + 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 +_08002358: + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end gpu_copy_to_wram_bg_tile_map + + thumb_func_start gpu_copy_wram_bg_tilemap_to_vram +gpu_copy_wram_bg_tilemap_to_vram: @ 800236C + push {r4,lr} + sub sp, 0x4 + lsls r0, 24 + lsrs r4, r0, 24 + adds r0, r4, 0 + bl is_invalid_bg_id_2 + cmp r0, 0 + bne _080023C8 + adds r0, r4, 0 + bl IsTileMapOutsideWram + cmp r0, 0 + bne _080023C8 + adds r0, r4, 0 + bl bg_get_type_by_bg_id + cmp r0, 0 + beq _0800239A + cmp r0, 0x1 + beq _080023A6 + movs r2, 0 + b _080023B2 +_0800239A: + adds r0, r4, 0 + movs r1, 0 + bl bg_get_screen_size_in_regular_mode + lsls r0, 27 + b _080023B0 +_080023A6: + adds r0, r4, 0 + movs r1, 0 + bl bg_get_screen_size_in_affine_mode + lsls r0, 24 +_080023B0: + lsrs r2, r0, 16 +_080023B2: + 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 + bl gpu_copy_to_vram_by_bg_id +_080023C8: + add sp, 0x4 + pop {r4} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end gpu_copy_wram_bg_tilemap_to_vram + + thumb_func_start gpu_copy_to_iwram_tile_map_rect +gpu_copy_to_iwram_tile_map_rect: @ 80023D4 + 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 + bl is_invalid_bg_id_2 + cmp r0, 0 + bne _080024C4 + adds r0, r5, 0 + bl IsTileMapOutsideWram + cmp r0, 0 + bne _080024C4 + adds r0, r5, 0 + bl bg_get_type_by_bg_id + cmp r0, 0 + beq _08002422 + cmp r0, 0x1 + beq _08002470 + b _080024C4 +_08002422: + mov r4, r8 + adds r3, r7, 0 + adds r0, r3, r6 + cmp r3, r0 + bge _080024C4 + mov r12, r0 + lsls r1, r5, 4 + ldr r0, =0x030008fc + adds r1, r0 + mov r8, r1 +_08002436: + mov r2, r10 + mov r1, r9 + adds r0, r2, r1 + adds r7, r3, 0x1 + cmp r2, r0 + bge _08002460 + mov r1, r8 + ldr r6, [r1] + lsls r5, r3, 5 + adds r3, r0, 0 +_0800244A: + 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 + blt _0800244A +_08002460: + lsls r0, r7, 16 + lsrs r3, r0, 16 + cmp r3, r12 + blt _08002436 + b _080024C4 + .align 2, 0 + .pool +_08002470: + mov r4, r8 + adds r0, r5, 0 + movs r1, 0x1 + bl bg_get_screen_size_in_affine_mode + lsls r0, 16 + lsrs r0, 16 + str r0, [sp] + adds r3, r7, 0 + adds r0, r3, r6 + cmp r3, r0 + bge _080024C4 + mov r12, r0 + lsls r5, 4 + mov r8, r5 +_0800248E: + mov r2, r10 + mov r1, r9 + adds r0, r2, r1 + adds r7, r3, 0x1 + cmp r2, r0 + bge _080024BC + ldr r6, =0x030008fc + add r6, r8 + ldr r1, [sp] + adds r5, r3, 0 + muls r5, r1 + adds r3, r0, 0 +_080024A6: + 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 + blt _080024A6 +_080024BC: + lsls r0, r7, 16 + lsrs r3, r0, 16 + cmp r3, r12 + blt _0800248E +_080024C4: + add sp, 0x4 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end gpu_copy_to_iwram_tile_map_rect + + thumb_func_start bg_copy_tilemap_rect_simple +bg_copy_tilemap_rect_simple: @ 80024D8 + 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 + bl bg_copy_tilemap_rect + add sp, 0x24 + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end bg_copy_tilemap_rect_simple + + thumb_func_start bg_copy_tilemap_rect +bg_copy_tilemap_rect: @ 800251C + 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] + bl is_invalid_bg_id_2 + cmp r0, 0 + beq _08002592 + b _080026EE +_08002592: + ldr r0, [sp, 0x4] + bl IsTileMapOutsideWram + cmp r0, 0 + beq _0800259E + b _080026EE +_0800259E: + ldr r0, [sp, 0x4] + movs r1, 0x4 + bl gpu_bg_config_get_field + lsls r0, 16 + lsrs r0, 16 + str r0, [sp, 0x30] + ldr r0, [sp, 0x4] + movs r1, 0x1 + bl bg_get_screen_size_in_regular_mode + lsls r0, 21 + lsrs r0, 16 + str r0, [sp, 0x28] + ldr r0, [sp, 0x4] + movs r1, 0x2 + bl bg_get_screen_size_in_regular_mode + lsls r0, 21 + lsrs r0, 16 + str r0, [sp, 0x2C] + ldr r0, [sp, 0x4] + bl bg_get_type_by_bg_id + cmp r0, 0 + beq _080025D8 + cmp r0, 0x1 + beq _08002674 + b _080026EE +_080025D8: + 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 + blt _080025F0 + b _080026EE +_080025F0: + ldr r2, [sp, 0x18] + subs r2, r7, r2 + str r2, [sp, 0x34] + str r0, [sp, 0x38] +_080025F8: + ldr r4, [sp, 0x14] + ldr r7, [sp, 0x18] + adds r0, r4, r7 + adds r1, r5, 0x1 + str r1, [sp, 0x3C] + cmp r4, r0 + bge _0800265A + 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 +_0800261E: + ldr r2, [sp, 0x2C] + str r2, [sp] + adds r0, r4, 0 + adds r1, r5, 0 + ldr r2, [sp, 0x30] + ldr r3, [sp, 0x28] + bl bg_get_index_from_tile_coords + 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 + bl bg_copy_tilemap_entry_not_rotscale_mode + 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 + blt _0800261E +_0800265A: + 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 + blt _080025F8 + b _080026EE + .align 2, 0 + .pool +_08002674: + 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 + bl bg_get_screen_size_in_affine_mode + lsls r0, 16 + lsrs r0, 16 + mov r9, r0 + adds r0, r5, r4 + cmp r5, r0 + bge _080026EE + 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 +_080026A8: + ldr r4, [sp, 0x14] + ldr r1, [sp, 0x18] + adds r0, r4, r1 + adds r2, r5, 0x1 + str r2, [sp, 0x3C] + cmp r4, r0 + bge _080026DE + mov r3, r8 + add r3, r10 + mov r7, r9 + muls r7, r5 + mov r12, r7 + adds r2, r0, 0 +_080026C2: + 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 + blt _080026C2 +_080026DE: + 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 + blt _080026A8 +_080026EE: + add sp, 0x40 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end bg_copy_tilemap_rect + + thumb_func_start bg_fill_tilemap_rect +bg_fill_tilemap_rect: @ 8002704 + 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 + bl is_invalid_bg_id_2 + cmp r0, 0 + bne _080027F0 + adds r0, r6, 0 + bl IsTileMapOutsideWram + cmp r0, 0 + bne _080027F0 + adds r0, r6, 0 + bl bg_get_type_by_bg_id + cmp r0, 0 + beq _08002756 + cmp r0, 0x1 + beq _080027A0 + b _080027F0 +_08002756: + adds r3, r7, 0 + adds r5, r3, r5 + cmp r3, r5 + bge _080027F0 + adds r7, r5, 0 + lsls r1, r6, 4 + ldr r0, =0x030008fc + adds r1, r0 + mov r12, r1 +_08002768: + mov r2, r10 + mov r1, r9 + adds r0, r2, r1 + adds r6, r3, 0x1 + cmp r2, r0 + bge _08002790 + mov r5, r12 + ldr r4, [r5] + lsls r3, 5 + adds r1, r0, 0 +_0800277C: + 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 + blt _0800277C +_08002790: + lsls r0, r6, 16 + lsrs r3, r0, 16 + cmp r3, r7 + blt _08002768 + b _080027F0 + .align 2, 0 + .pool +_080027A0: + adds r0, r6, 0 + movs r1, 0x1 + bl bg_get_screen_size_in_affine_mode + lsls r0, 16 + lsrs r0, 16 + str r0, [sp] + adds r3, r7, 0 + adds r5, r3, r5 + cmp r3, r5 + bge _080027F0 + adds r7, r5, 0 + lsls r6, 4 + mov r12, r6 +_080027BC: + mov r2, r10 + mov r1, r9 + adds r0, r2, r1 + adds r6, r3, 0x1 + cmp r2, r0 + bge _080027E8 + ldr r5, =0x030008fc + add r5, r12 + ldr r1, [sp] + adds r4, r3, 0 + muls r4, r1 + adds r3, r0, 0 +_080027D4: + 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 + blt _080027D4 +_080027E8: + lsls r0, r6, 16 + lsrs r3, r0, 16 + cmp r3, r7 + blt _080027BC +_080027F0: + add sp, 0x4 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end bg_fill_tilemap_rect + + thumb_func_start Bg_FillWramTileMapRectWithTileAndPalette +Bg_FillWramTileMapRectWithTileAndPalette: @ 8002804 + 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] + bl bg_write_sequence_to_wram_tile_map_rect + add sp, 0x10 + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end Bg_FillWramTileMapRectWithTileAndPalette + + thumb_func_start bg_write_sequence_to_wram_tile_map_rect +bg_write_sequence_to_wram_tile_map_rect: @ 8002840 + 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 + bl is_invalid_bg_id_2 + cmp r0, 0 + beq _0800288E + b _080029D4 +_0800288E: + mov r0, r9 + bl IsTileMapOutsideWram + cmp r0, 0 + beq _0800289A + b _080029D4 +_0800289A: + mov r0, r9 + movs r1, 0x4 + bl gpu_bg_config_get_field + lsls r0, 16 + lsrs r0, 16 + str r0, [sp, 0x1C] + mov r0, r9 + movs r1, 0x1 + bl bg_get_screen_size_in_regular_mode + lsls r0, 21 + lsrs r0, 16 + str r0, [sp, 0x14] + mov r0, r9 + movs r1, 0x2 + bl bg_get_screen_size_in_regular_mode + lsls r0, 21 + lsrs r0, 16 + str r0, [sp, 0x18] + mov r0, r9 + bl bg_get_type_by_bg_id + cmp r0, 0 + beq _080028D4 + cmp r0, 0x1 + beq _0800295C + b _080029D4 +_080028D4: + adds r5, r7, 0 + adds r0, r5, r4 + cmp r5, r0 + bge _080029D4 + str r0, [sp, 0x24] + add r7, sp, 0x4 +_080028E0: + ldr r4, [sp, 0x8] + mov r1, r10 + adds r0, r4, r1 + adds r2, r5, 0x1 + mov r8, r2 + cmp r4, r0 + bge _08002944 + mov r3, r9 + lsls r1, r3, 4 + ldr r0, =0x030008fc + adds r6, r1, r0 +_080028F6: + ldr r0, [sp, 0x18] + str r0, [sp] + adds r0, r4, 0 + adds r1, r5, 0 + ldr r2, [sp, 0x1C] + ldr r3, [sp, 0x14] + bl bg_get_index_from_tile_coords + 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 + bl bg_copy_tilemap_entry_not_rotscale_mode + 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 + blt _080028F6 +_08002944: + mov r1, r8 + lsls r0, r1, 16 + lsrs r5, r0, 16 + ldr r2, [sp, 0x24] + cmp r5, r2 + blt _080028E0 + b _080029D4 + .align 2, 0 + .pool +_0800295C: + mov r0, r9 + movs r1, 0x1 + bl bg_get_screen_size_in_affine_mode + lsls r0, 16 + lsrs r0, 16 + str r0, [sp, 0x20] + adds r5, r7, 0 + adds r0, r5, r4 + cmp r5, r0 + bge _080029D4 + str r0, [sp, 0x24] + mov r3, r9 + lsls r3, 4 + mov r12, r3 +_0800297A: + ldr r4, [sp, 0x8] + mov r7, r10 + adds r0, r4, r7 + adds r1, r5, 0x1 + mov r8, r1 + cmp r4, r0 + bge _080029C8 + 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 +_080029A2: + 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 + blt _080029A2 +_080029C8: + mov r1, r8 + lsls r0, r1, 16 + lsrs r5, r0, 16 + ldr r2, [sp, 0x24] + cmp r5, r2 + blt _0800297A +_080029D4: + add sp, 0x2C + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end bg_write_sequence_to_wram_tile_map_rect + + thumb_func_start bg_get_screen_size_in_regular_mode +bg_get_screen_size_in_regular_mode: @ 80029EC + push {r4,r5,lr} + lsls r0, 24 + lsrs r0, 24 + lsls r1, 24 + lsrs r4, r1, 24 + adds r5, r4, 0 + movs r1, 0x4 + bl gpu_bg_config_get_field + lsls r0, 24 + lsrs r0, 24 + cmp r4, 0x1 + beq _08002A2C + cmp r4, 0x1 + bgt _08002A10 + cmp r4, 0 + beq _08002A16 + b _08002A52 +_08002A10: + cmp r5, 0x2 + beq _08002A3E + b _08002A52 +_08002A16: + cmp r0, 0x2 + bgt _08002A24 + cmp r0, 0x1 + bge _08002A4E +_08002A1E: + cmp r0, 0 + beq _08002A46 + b _08002A52 +_08002A24: + cmp r0, 0x3 + bne _08002A52 + movs r0, 0x4 + b _08002A54 +_08002A2C: + cmp r0, 0x1 + beq _08002A4E + cmp r0, 0x1 + ble _08002A1E + cmp r0, 0x2 + beq _08002A46 + cmp r0, 0x3 + bne _08002A52 + b _08002A4E +_08002A3E: + cmp r0, 0 + blt _08002A52 + cmp r0, 0x1 + bgt _08002A4A +_08002A46: + movs r0, 0x1 + b _08002A54 +_08002A4A: + cmp r0, 0x3 + bgt _08002A52 +_08002A4E: + movs r0, 0x2 + b _08002A54 +_08002A52: + movs r0, 0 +_08002A54: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end bg_get_screen_size_in_regular_mode + + thumb_func_start bg_get_screen_size_in_affine_mode +bg_get_screen_size_in_affine_mode: @ 8002A5C + push {r4,lr} + lsls r0, 24 + lsrs r0, 24 + lsls r1, 24 + lsrs r4, r1, 24 + movs r1, 0x4 + bl gpu_bg_config_get_field + lsls r0, 24 + lsrs r1, r0, 24 + adds r0, r1, 0 + cmp r4, 0 + beq _08002A84 + cmp r4, 0 + blt _08002AAC + cmp r4, 0x2 + bgt _08002AAC + movs r0, 0x10 + lsls r0, r1 + b _08002AAE +_08002A84: + cmp r1, 0x1 + beq _08002AA0 + cmp r1, 0x1 + bgt _08002A92 + cmp r1, 0 + beq _08002A9C + b _08002AAC +_08002A92: + cmp r0, 0x2 + beq _08002AA4 + cmp r0, 0x3 + beq _08002AA8 + b _08002AAC +_08002A9C: + movs r0, 0x1 + b _08002AAE +_08002AA0: + movs r0, 0x4 + b _08002AAE +_08002AA4: + movs r0, 0x10 + b _08002AAE +_08002AA8: + movs r0, 0x40 + b _08002AAE +_08002AAC: + movs r0, 0 +_08002AAE: + pop {r4} + pop {r1} + bx r1 + thumb_func_end bg_get_screen_size_in_affine_mode + + thumb_func_start bg_get_index_from_tile_coords +bg_get_index_from_tile_coords: @ 8002AB4 + 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 + beq _08002AD8 + cmp r2, 0x1 + ble _08002AE0 + cmp r2, 0x2 + beq _08002AE0 + cmp r2, 0x3 + bne _08002AE0 + cmp r1, 0x1F + ble _08002AD8 + adds r1, 0x20 +_08002AD8: + cmp r4, 0x1F + ble _08002AE0 + subs r4, 0x20 + adds r1, 0x20 +_08002AE0: + lsls r0, r1, 5 + adds r0, r4 + pop {r4} + pop {r1} + bx r1 + thumb_func_end bg_get_index_from_tile_coords + + thumb_func_start bg_copy_tilemap_entry_not_rotscale_mode +bg_copy_tilemap_entry_not_rotscale_mode: @ 8002AEC + push {r4-r6,lr} + adds r4, r0, 0 + adds r6, r1, 0 + ldr r5, [sp, 0x10] + cmp r2, 0x10 + beq _08002B14 + cmp r2, 0x10 + bgt _08002B34 + cmp r2, 0 + blt _08002B34 + ldrh r0, [r4] + adds r0, r3 + ldr r3, =0x00000fff + adds r1, r3, 0 + ands r0, r1 + adds r1, r2, r5 + lsls r1, 12 + b _08002B3A + .align 2, 0 + .pool +_08002B14: + 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 + b _08002B3C + .align 2, 0 + .pool +_08002B34: + ldrh r0, [r4] + adds r0, r3 + lsls r1, r5, 12 +_08002B3A: + adds r0, r1 +_08002B3C: + lsls r0, 16 + lsrs r1, r0, 16 + strh r1, [r6] + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end bg_copy_tilemap_entry_not_rotscale_mode + + thumb_func_start bg_get_type_by_bg_id +bg_get_type_by_bg_id: @ 8002B48 + push {r4,r5,lr} + lsls r0, 24 + lsrs r4, r0, 24 + adds r5, r4, 0 + bl gpu_get_bg_mode + lsls r0, 24 + lsrs r0, 24 + cmp r4, 0x2 + beq _08002B76 + cmp r4, 0x2 + ble _08002B66 + cmp r4, 0x3 + beq _08002B86 + b _08002B8E +_08002B66: + cmp r5, 0 + blt _08002B8E + cmp r0, 0x1 + bgt _08002B8E + cmp r0, 0 + blt _08002B8E +_08002B72: + movs r0, 0 + b _08002B90 +_08002B76: + cmp r0, 0 + beq _08002B72 + cmp r0, 0 + blt _08002B8E + cmp r0, 0x2 + bgt _08002B8E +_08002B82: + movs r0, 0x1 + b _08002B90 +_08002B86: + cmp r0, 0 + beq _08002B72 + cmp r0, 0x2 + beq _08002B82 +_08002B8E: + ldr r0, =0x0000ffff +_08002B90: + pop {r4,r5} + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end bg_get_type_by_bg_id + + thumb_func_start is_invalid_bg_id_2 +is_invalid_bg_id_2: @ 8002B9C + push {lr} + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x3 + bhi _08002BAA + movs r0, 0 + b _08002BAC +_08002BAA: + movs r0, 0x1 +_08002BAC: + pop {r1} + bx r1 + thumb_func_end is_invalid_bg_id_2 + + thumb_func_start IsTileMapOutsideWram +IsTileMapOutsideWram: @ 8002BB0 + 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 + bhi _08002BD4 + cmp r1, 0 + beq _08002BD4 + movs r0, 0 + b _08002BD6 + .align 2, 0 + .pool +_08002BD4: + movs r0, 0x1 +_08002BD6: + pop {r1} + bx r1 + thumb_func_end IsTileMapOutsideWram diff --git a/asm/gpu_obj.s b/asm/gpu_obj.s new file mode 100644 index 000000000..eaa19f3cf --- /dev/null +++ b/asm/gpu_obj.s @@ -0,0 +1,4546 @@ + thumb_func_start reset_all_obj_data +reset_all_obj_data: @ 8006974 + push {r4,lr} + movs r0, 0 + movs r1, 0x80 + bl reset_super_sprites + bl obj_delete_all + bl copy_queue_clear + bl rotscale_reset_all + bl gpu_tile_obj_tags_reset + ldr r1, =0x02021b38 + movs r0, 0x40 + strb r0, [r1] + ldr r0, =0x02021b3a + movs r4, 0 + strh r4, [r0] + movs r0, 0 + bl gpu_tile_obj_alloc + ldr r0, =0x02021bbc + strh r4, [r0] + ldr r0, =0x02021bbe + strh r4, [r0] + pop {r4} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end reset_all_obj_data + + thumb_func_start call_obj_callbacks +call_obj_callbacks: @ 80069C0 + push {r4-r7,lr} + movs r6, 0 + movs r7, 0x1 +_080069C6: + lsls r0, r6, 4 + adds r0, r6 + lsls r0, 2 + ldr r1, =0x02020630 + adds r4, r0, r1 + adds r5, r4, 0 + adds r5, 0x3E + ldrb r1, [r5] + adds r0, r7, 0 + ands r0, r1 + cmp r0, 0 + beq _080069F6 + ldr r1, [r4, 0x1C] + adds r0, r4, 0 + bl _call_via_r1 + ldrb r1, [r5] + adds r0, r7, 0 + ands r0, r1 + cmp r0, 0 + beq _080069F6 + adds r0, r4, 0 + bl obj_anim_step +_080069F6: + adds r0, r6, 0x1 + lsls r0, 24 + lsrs r6, r0, 24 + cmp r6, 0x3F + bls _080069C6 + pop {r4-r7} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end call_obj_callbacks + + thumb_func_start obj_sync_something +obj_sync_something: @ 8006A0C + push {r4,r5,lr} + bl update_obj_oam_coords + bl do_something_with_obj_priorites + bl determine_visible_sprites_maybe + ldr r5, =0x030022c0 + ldr r0, =0x00000439 + adds r5, r0 + ldrb r0, [r5] + lsls r4, r0, 31 + lsrs r4, 31 + movs r1, 0x1 + orrs r0, r1 + strb r0, [r5] + bl super_sprites_fill + bl copy_rotscale_coeffs_to_super_sprites + movs r2, 0x1 + ldrb r1, [r5] + movs r0, 0x2 + negs r0, r0 + ands r0, r1 + orrs r4, r0 + strb r4, [r5] + ldr r0, =0x02021834 + strb r2, [r0] + pop {r4,r5} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end obj_sync_something + + thumb_func_start update_obj_oam_coords +update_obj_oam_coords: @ 8006A58 + push {r4-r7,lr} + movs r4, 0 + ldr r7, =0x02020630 + ldr r0, =0x000001ff + adds r5, r0, 0 + ldr r6, =0xfffffe00 +_08006A64: + lsls r0, r4, 4 + adds r0, r4 + lsls r0, 2 + adds r3, r0, r7 + adds r0, r3, 0 + adds r0, 0x3E + ldrb r1, [r0] + movs r0, 0x5 + ands r0, r1 + cmp r0, 0x1 + bne _08006B0A + movs r0, 0x2 + ands r0, r1 + cmp r0, 0 + beq _08006AD8 + movs r2, 0x20 + ldrsh r1, [r3, r2] + movs r2, 0x24 + ldrsh r0, [r3, r2] + adds r1, r0 + adds r0, r3, 0 + adds r0, 0x28 + ldrb r0, [r0] + lsls r0, 24 + asrs r0, 24 + adds r1, r0 + ldr r0, =0x02021bbc + movs r2, 0 + ldrsh r0, [r0, r2] + adds r1, r0 + ands r1, r5 + ldrh r2, [r3, 0x2] + adds r0, r6, 0 + ands r0, r2 + orrs r0, r1 + strh r0, [r3, 0x2] + ldrh r1, [r3, 0x26] + ldrh r0, [r3, 0x22] + adds r1, r0 + adds r0, r3, 0 + adds r0, 0x29 + ldrb r0, [r0] + ldr r2, =0x02021bbe + adds r0, r1 + ldrb r2, [r2] + adds r0, r2 + b _08006B08 + .align 2, 0 + .pool +_08006AD8: + movs r2, 0x20 + ldrsh r1, [r3, r2] + movs r2, 0x24 + ldrsh r0, [r3, r2] + adds r1, r0 + adds r0, r3, 0 + adds r0, 0x28 + ldrb r0, [r0] + lsls r0, 24 + asrs r0, 24 + adds r1, r0 + ands r1, r5 + ldrh r2, [r3, 0x2] + adds r0, r6, 0 + ands r0, r2 + orrs r0, r1 + strh r0, [r3, 0x2] + ldrh r1, [r3, 0x26] + ldrh r0, [r3, 0x22] + adds r1, r0 + adds r0, r3, 0 + adds r0, 0x29 + ldrb r0, [r0] + adds r0, r1 +_08006B08: + strb r0, [r3] +_08006B0A: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x3F + bls _08006A64 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end update_obj_oam_coords + + thumb_func_start do_something_with_obj_priorites +do_something_with_obj_priorites: @ 8006B1C + push {r4,lr} + movs r2, 0 + ldr r4, =0x02020630 + ldr r3, =0x02021774 +_08006B24: + lsls r0, r2, 4 + adds r0, r2 + lsls r0, 2 + adds r0, r4 + adds r1, r0, 0 + adds r1, 0x43 + ldrb r1, [r1] + ldrb r0, [r0, 0x5] + lsls r0, 28 + lsrs r0, 30 + lsls r0, 8 + orrs r1, r0 + lsls r0, r2, 1 + adds r0, r3 + strh r1, [r0] + adds r0, r2, 0x1 + lsls r0, 16 + lsrs r2, r0, 16 + cmp r2, 0x3F + bls _08006B24 + pop {r4} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end do_something_with_obj_priorites + + thumb_func_start determine_visible_sprites_maybe +determine_visible_sprites_maybe: @ 8006B5C + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x4 + movs r0, 0x1 + mov r12, r0 + ldr r1, =0x020217f4 + mov r10, r1 + ldr r3, =0xffffff00 + mov r9, r3 + ldr r6, =0xc0000300 + mov r8, r6 +_08006B78: + mov r5, r12 + mov r0, r12 + subs r0, 0x1 + add r0, r10 + ldrb r2, [r0] + lsls r0, r2, 4 + adds r0, r2 + lsls r0, 2 + ldr r7, =0x02020630 + adds r3, r0, r7 + mov r0, r12 + add r0, r10 + ldrb r1, [r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r4, r0, r7 + lsls r2, 1 + ldr r0, =0x02021774 + adds r2, r0 + ldrh r2, [r2] + str r2, [sp] + lsls r1, 1 + adds r1, r0 + ldrh r6, [r1] + ldrb r1, [r3] + ldrb r2, [r4] + adds r0, r1, 0 + cmp r0, 0x9F + ble _08006BBA + add r0, r9 + lsls r0, 16 + lsrs r1, r0, 16 +_08006BBA: + lsls r0, r2, 16 + asrs r0, 16 + cmp r0, 0x9F + ble _08006BC8 + add r0, r9 + lsls r0, 16 + lsrs r2, r0, 16 +_08006BC8: + ldr r0, [r3] + mov r7, r8 + ands r0, r7 + cmp r0, r8 + bne _08006BEC + ldrb r0, [r3, 0x1] + lsrs r0, 6 + cmp r0, 0 + beq _08006BDE + cmp r0, 0x2 + bne _08006BEC +_08006BDE: + lsls r0, r1, 16 + asrs r0, 16 + cmp r0, 0x80 + ble _08006BEC + add r0, r9 + lsls r0, 16 + lsrs r1, r0, 16 +_08006BEC: + ldr r0, [r4] + mov r3, r8 + ands r0, r3 + cmp r0, r8 + bne _08006C10 + ldrb r0, [r4, 0x1] + lsrs r0, 6 + cmp r0, 0 + beq _08006C02 + cmp r0, 0x2 + bne _08006C10 +_08006C02: + lsls r0, r2, 16 + asrs r0, 16 + cmp r0, 0x80 + ble _08006C10 + add r0, r9 + lsls r0, 16 + lsrs r2, r0, 16 +_08006C10: + movs r7, 0x1 + add r12, r7 + cmp r5, 0 + beq _08006CF6 + ldr r0, [sp] + cmp r0, r6 + bhi _08006C38 + cmp r0, r6 + bne _08006CF6 + b _08006CEE + .align 2, 0 + .pool +_08006C38: + mov r1, r10 + adds r3, r5, r1 + ldrb r4, [r3] + subs r2, r5, 0x1 + adds r1, r2, r1 + ldrb r0, [r1] + strb r0, [r3] + strb r4, [r1] + lsls r2, 24 + lsrs r5, r2, 24 + subs r0, r5, 0x1 + add r0, r10 + ldrb r2, [r0] + lsls r0, r2, 4 + adds r0, r2 + lsls r0, 2 + ldr r6, =0x02020630 + adds r3, r0, r6 + mov r7, r10 + adds r0, r5, r7 + ldrb r1, [r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r4, r0, r6 + lsls r2, 1 + ldr r0, =0x02021774 + adds r2, r0 + ldrh r2, [r2] + str r2, [sp] + lsls r1, 1 + adds r1, r0 + ldrh r6, [r1] + ldrb r1, [r3] + ldrb r2, [r4] + adds r0, r1, 0 + cmp r0, 0x9F + ble _08006C8A + add r0, r9 + lsls r0, 16 + lsrs r1, r0, 16 +_08006C8A: + lsls r0, r2, 16 + asrs r0, 16 + cmp r0, 0x9F + ble _08006C98 + add r0, r9 + lsls r0, 16 + lsrs r2, r0, 16 +_08006C98: + ldr r0, [r3] + mov r7, r8 + ands r0, r7 + cmp r0, r8 + bne _08006CBC + ldrb r0, [r3, 0x1] + lsrs r0, 6 + cmp r0, 0 + beq _08006CAE + cmp r0, 0x2 + bne _08006CBC +_08006CAE: + lsls r0, r1, 16 + asrs r0, 16 + cmp r0, 0x80 + ble _08006CBC + add r0, r9 + lsls r0, 16 + lsrs r1, r0, 16 +_08006CBC: + ldr r0, [r4] + mov r3, r8 + ands r0, r3 + cmp r0, r8 + bne _08006CE0 + ldrb r0, [r4, 0x1] + lsrs r0, 6 + cmp r0, 0 + beq _08006CD2 + cmp r0, 0x2 + bne _08006CE0 +_08006CD2: + lsls r0, r2, 16 + asrs r0, 16 + cmp r0, 0x80 + ble _08006CE0 + add r0, r9 + lsls r0, 16 + lsrs r2, r0, 16 +_08006CE0: + cmp r5, 0 + beq _08006CF6 + ldr r7, [sp] + cmp r7, r6 + bhi _08006C38 + cmp r7, r6 + bne _08006CF6 +_08006CEE: + lsls r1, 16 + lsls r0, r2, 16 + cmp r1, r0 + blt _08006C38 +_08006CF6: + mov r1, r12 + lsls r0, r1, 24 + lsrs r0, 24 + mov r12, r0 + cmp r0, 0x3F + bhi _08006D04 + b _08006B78 +_08006D04: + add sp, 0x4 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end determine_visible_sprites_maybe + + thumb_func_start copy_rotscale_coeffs_to_super_sprites +copy_rotscale_coeffs_to_super_sprites: @ 8006D1C + push {r4-r6,lr} + movs r4, 0 + ldr r5, =0x030022c0 + ldr r6, =0x02021bc0 +_08006D24: + lsls r2, r4, 2 + lsls r1, r4, 5 + adds r1, r5 + lsls r3, r4, 3 + adds r3, r6 + ldrh r0, [r3] + strh r0, [r1, 0x3E] + adds r0, r2, 0x1 + lsls r0, 3 + adds r0, r5 + ldrh r1, [r3, 0x2] + strh r1, [r0, 0x3E] + adds r0, r2, 0x2 + lsls r0, 3 + adds r0, r5 + ldrh r1, [r3, 0x4] + strh r1, [r0, 0x3E] + adds r2, 0x3 + lsls r2, 3 + adds r2, r5 + ldrh r0, [r3, 0x6] + strh r0, [r2, 0x3E] + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x1F + bls _08006D24 + pop {r4-r6} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end copy_rotscale_coeffs_to_super_sprites + + thumb_func_start super_sprites_fill +super_sprites_fill: @ 8006D68 + push {r4-r6,lr} + sub sp, 0x4 + movs r4, 0 + mov r0, sp + strb r4, [r0] +_08006D72: + ldr r0, =0x020217f4 + adds r0, r4, r0 + ldrb r1, [r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + ldr r1, =0x02020630 + adds r2, r0, r1 + adds r0, r2, 0 + adds r0, 0x3E + ldrb r1, [r0] + movs r0, 0x5 + ands r0, r1 + cmp r0, 0x1 + bne _08006D9E + adds r0, r2, 0 + mov r1, sp + bl super_sprite_add + lsls r0, 24 + cmp r0, 0 + bne _08006DD8 +_08006D9E: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x3F + bls _08006D72 + mov r0, sp + ldr r4, =0x02021b38 + ldrb r0, [r0] + ldrb r1, [r4] + cmp r0, r1 + bcs _08006DD8 + mov r1, sp + ldr r5, =0x030022f8 + ldr r0, =0x082ec690 + ldr r2, [r0] + ldr r3, [r0, 0x4] +_08006DBE: + ldrb r0, [r1] + lsls r0, 3 + adds r0, r5 + str r2, [r0] + str r3, [r0, 0x4] + ldrb r0, [r1] + adds r0, 0x1 + strb r0, [r1] + lsls r0, 24 + lsrs r0, 24 + ldrb r6, [r4] + cmp r0, r6 + bcc _08006DBE +_08006DD8: + add sp, 0x4 + pop {r4-r6} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end super_sprites_fill + + thumb_func_start obj_add_from_template_forward_search +obj_add_from_template_forward_search: @ 8006DF4 + push {r4-r7,lr} + sub sp, 0x4 + adds r7, r0, 0 + lsls r3, 24 + lsrs r4, r3, 24 + movs r3, 0 + ldr r0, =0x02020630 + mov r12, r0 + lsls r5, r1, 16 + lsls r6, r2, 16 +_08006E08: + lsls r0, r3, 4 + adds r0, r3 + lsls r0, 2 + add r0, r12 + adds r0, 0x3E + ldrb r0, [r0] + lsls r0, 31 + cmp r0, 0 + bne _08006E34 + str r4, [sp] + adds r0, r3, 0 + adds r1, r7, 0 + asrs r2, r5, 16 + asrs r3, r6, 16 + bl template_read + lsls r0, 24 + lsrs r0, 24 + b _08006E40 + .align 2, 0 + .pool +_08006E34: + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + cmp r3, 0x3F + bls _08006E08 + movs r0, 0x40 +_08006E40: + add sp, 0x4 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end obj_add_from_template_forward_search + + thumb_func_start obj_add_from_template_backward_search +obj_add_from_template_backward_search: @ 8006E48 + push {r4-r7,lr} + mov r7, r8 + push {r7} + sub sp, 0x4 + adds r7, r0, 0 + lsls r3, 24 + lsrs r6, r3, 24 + movs r3, 0x3F + ldr r0, =0x02020630 + mov r8, r0 + movs r0, 0x1 + negs r0, r0 + mov r12, r0 + lsls r4, r1, 16 + lsls r5, r2, 16 +_08006E66: + lsls r0, r3, 16 + asrs r1, r0, 16 + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + add r0, r8 + adds r0, 0x3E + ldrb r0, [r0] + lsls r0, 31 + cmp r0, 0 + bne _08006E98 + lsls r0, r3, 24 + lsrs r0, 24 + str r6, [sp] + adds r1, r7, 0 + asrs r2, r4, 16 + asrs r3, r5, 16 + bl template_read + lsls r0, 24 + lsrs r0, 24 + b _08006EA6 + .align 2, 0 + .pool +_08006E98: + subs r0, r1, 0x1 + lsls r0, 16 + lsrs r3, r0, 16 + asrs r0, 16 + cmp r0, r12 + bgt _08006E66 + movs r0, 0x40 +_08006EA6: + add sp, 0x4 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end obj_add_from_template_backward_search + + thumb_func_start obj_add_empty_with_callback +obj_add_empty_with_callback: @ 8006EB4 + push {r4-r6,lr} + adds r6, r0, 0 + ldr r0, =0x082ec6ac + movs r1, 0 + movs r2, 0 + movs r3, 0x1F + bl obj_add_from_template_forward_search + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, 0x40 + beq _08006EF4 + ldr r4, =0x02020630 + lsls r1, r5, 4 + adds r1, r5 + lsls r1, 2 + adds r2, r1, r4 + adds r2, 0x3E + ldrb r0, [r2] + movs r3, 0x4 + orrs r0, r3 + strb r0, [r2] + adds r4, 0x1C + adds r1, r4 + str r6, [r1] + adds r0, r5, 0 + b _08006EF6 + .align 2, 0 + .pool +_08006EF4: + movs r0, 0x40 +_08006EF6: + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end obj_add_empty_with_callback + + thumb_func_start template_read +template_read: @ 8006EFC + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + mov r8, r1 + adds r5, r2, 0 + adds r6, r3, 0 + ldr r4, [sp, 0x20] + lsls r0, 24 + lsrs r0, 24 + mov r10, r0 + lsls r5, 16 + lsrs r5, 16 + lsls r6, 16 + lsrs r6, 16 + lsls r4, 24 + lsrs r4, 24 + lsls r0, 4 + add r0, r10 + lsls r0, 2 + ldr r1, =0x02020630 + adds r7, r0, r1 + adds r0, r7, 0 + bl obj_delete + adds r2, r7, 0 + adds r2, 0x3E + ldrb r0, [r2] + movs r1, 0x1 + orrs r0, r1 + strb r0, [r2] + movs r0, 0x3F + adds r0, r7 + mov r9, r0 + ldrb r0, [r0] + movs r1, 0x4 + orrs r0, r1 + movs r1, 0x8 + orrs r0, r1 + movs r1, 0x40 + orrs r0, r1 + mov r1, r9 + strb r0, [r1] + adds r0, r7, 0 + adds r0, 0x43 + strb r4, [r0] + mov r1, r8 + ldr r0, [r1, 0x4] + ldr r1, [r0, 0x4] + ldr r0, [r0] + str r0, [r7] + str r1, [r7, 0x4] + mov r1, r8 + ldr r0, [r1, 0x8] + str r0, [r7, 0x8] + ldr r0, [r1, 0x10] + str r0, [r7, 0x10] + str r1, [r7, 0x14] + ldr r0, [r1, 0x14] + str r0, [r7, 0x1C] + strh r5, [r7, 0x20] + strh r6, [r7, 0x22] + ldrb r3, [r7, 0x1] + lsrs r1, r3, 6 + ldrb r2, [r7, 0x3] + lsrs r2, 6 + lsls r3, 30 + lsrs r3, 30 + adds r0, r7, 0 + bl oam_center + mov r0, r8 + ldrh r1, [r0] + ldr r4, =0xffff0000 + lsrs r0, r4, 16 + cmp r1, r0 + bne _08006FF8 + mov r1, r8 + ldr r0, [r1, 0xC] + str r0, [r7, 0xC] + ldrh r0, [r0, 0x4] + lsrs r0, 5 + lsls r0, 24 + lsrs r0, 24 + bl gpu_tile_obj_alloc + lsls r0, 16 + lsrs r2, r0, 16 + asrs r0, 16 + asrs r1, r4, 16 + cmp r0, r1 + bne _08006FC8 + adds r0, r7, 0 + bl obj_delete + movs r0, 0x40 + b _08007040 + .align 2, 0 + .pool +_08006FC8: + ldr r1, =0x000003ff + adds r0, r1, 0 + ands r2, r0 + ldrh r1, [r7, 0x4] + ldr r0, =0xfffffc00 + ands r0, r1 + orrs r0, r2 + strh r0, [r7, 0x4] + mov r0, r9 + ldrb r1, [r0] + movs r0, 0x41 + negs r0, r0 + ands r0, r1 + mov r1, r9 + strb r0, [r1] + adds r1, r7, 0 + adds r1, 0x40 + movs r0, 0 + strh r0, [r1] + b _0800700C + .align 2, 0 + .pool +_08006FF8: + mov r1, r8 + ldrh r0, [r1] + bl gpu_tile_obj_tag_get_range_start + adds r1, r7, 0 + adds r1, 0x40 + strh r0, [r1] + adds r0, r7, 0 + bl sub_8008324 +_0800700C: + ldrb r0, [r7, 0x1] + lsls r0, 30 + lsrs r0, 30 + movs r1, 0x1 + ands r0, r1 + cmp r0, 0 + beq _08007020 + adds r0, r7, 0 + bl obj_alloc_rotscale_entry +_08007020: + mov r0, r8 + ldrh r1, [r0, 0x2] + ldr r0, =0x0000ffff + cmp r1, r0 + beq _0800703E + mov r1, r8 + ldrh r0, [r1, 0x2] + bl gpu_pal_tags_index_of + lsls r0, 4 + ldrb r2, [r7, 0x5] + movs r1, 0xF + ands r1, r2 + orrs r1, r0 + strb r1, [r7, 0x5] +_0800703E: + mov r0, r10 +_08007040: + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end template_read + + thumb_func_start obj_add_from_template_call_callback_once +obj_add_from_template_call_callback_once: @ 8007054 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x4 + mov r10, r0 + lsls r3, 24 + lsrs r3, 24 + mov r9, r3 + movs r3, 0 + ldr r5, =0x02020630 + lsls r1, 16 + mov r12, r1 + lsls r2, 16 + mov r8, r2 +_08007074: + lsls r0, r3, 4 + adds r0, r3 + lsls r6, r0, 2 + adds r4, r6, r5 + adds r7, r4, 0 + adds r7, 0x3E + ldrb r0, [r7] + lsls r0, 31 + cmp r0, 0 + bne _080070CC + mov r0, r9 + str r0, [sp] + adds r0, r3, 0 + mov r1, r10 + mov r3, r12 + asrs r2, r3, 16 + mov r5, r8 + asrs r3, r5, 16 + bl template_read + lsls r0, 24 + lsrs r0, 24 + adds r5, r0, 0 + cmp r5, 0x40 + beq _080070D6 + ldr r1, =0x0202064c + adds r0, r6, r1 + ldr r1, [r0] + adds r0, r4, 0 + bl _call_via_r1 + ldrb r0, [r7] + lsls r0, 31 + cmp r0, 0 + beq _080070C0 + adds r0, r4, 0 + bl obj_anim_step +_080070C0: + adds r0, r5, 0 + b _080070D8 + .align 2, 0 + .pool +_080070CC: + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + cmp r3, 0x3F + bls _08007074 +_080070D6: + movs r0, 0x40 +_080070D8: + add sp, 0x4 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end obj_add_from_template_call_callback_once + + thumb_func_start obj_delete_and_free_tiles +obj_delete_and_free_tiles: @ 80070E8 + push {r4-r7,lr} + adds r5, r0, 0 + adds r0, 0x3E + ldrb r1, [r0] + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + beq _08007144 + adds r0, r5, 0 + adds r0, 0x3F + ldrb r1, [r0] + movs r0, 0x40 + ands r0, r1 + cmp r0, 0 + bne _0800713E + ldr r0, [r5, 0xC] + ldrh r2, [r0, 0x4] + lsrs r2, 5 + ldrh r0, [r5, 0x4] + lsls r0, 22 + lsrs r1, r0, 22 + adds r4, r1, r2 + adds r3, r1, 0 + cmp r3, r4 + bcs _0800713E + ldr r0, =0x02021b3c + mov r12, r0 + movs r6, 0x7 + movs r7, 0x1 +_08007122: + lsrs r2, r3, 3 + add r2, r12 + adds r0, r3, 0 + ands r0, r6 + adds r1, r7, 0 + lsls r1, r0 + ldrb r0, [r2] + bics r0, r1 + strb r0, [r2] + adds r0, r3, 0x1 + lsls r0, 16 + lsrs r3, r0, 16 + cmp r3, r4 + bcc _08007122 +_0800713E: + adds r0, r5, 0 + bl obj_delete +_08007144: + pop {r4-r7} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end obj_delete_and_free_tiles + + thumb_func_start reset_super_sprites +reset_super_sprites: @ 8007150 + push {r4-r6,lr} + lsls r0, 24 + lsls r1, 24 + lsrs r4, r1, 24 + lsrs r3, r0, 24 + cmp r3, r4 + bcs _08007178 + ldr r6, =0x030022f8 + ldr r5, =0x082ec690 +_08007162: + lsls r0, r3, 3 + adds r0, r6 + ldr r1, [r5] + ldr r2, [r5, 0x4] + str r1, [r0] + str r2, [r0, 0x4] + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + cmp r3, r4 + bcc _08007162 +_08007178: + pop {r4-r6} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end reset_super_sprites + + thumb_func_start copy_super_sprites_to_oam +copy_super_sprites_to_oam: @ 8007188 + push {lr} + ldr r2, =0x030022c0 + ldr r1, =0x00000439 + adds r0, r2, r1 + ldrb r1, [r0] + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + bne _080071A8 + adds r0, r2, 0 + adds r0, 0x38 + movs r1, 0xE0 + lsls r1, 19 + ldr r2, =0x04000100 + bl CpuSet +_080071A8: + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end copy_super_sprites_to_oam + + thumb_func_start copy_queue_clear +copy_queue_clear: @ 80071B8 + push {r4,r5,lr} + ldr r0, =0x02021834 + movs r1, 0 + strb r1, [r0] + ldr r0, =0x02021835 + strb r1, [r0] + movs r2, 0 + ldr r4, =0x02021838 + movs r3, 0 + adds r5, r4, 0x4 +_080071CC: + lsls r0, r2, 1 + adds r0, r2 + lsls r0, 2 + adds r1, r0, r4 + str r3, [r1] + adds r0, r5 + str r3, [r0] + strh r3, [r1, 0x8] + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0x3F + bls _080071CC + pop {r4,r5} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end copy_queue_clear + + thumb_func_start reset_rotscale_coeffs +reset_rotscale_coeffs: @ 80071F8 + push {r4,lr} + movs r1, 0 + ldr r4, =0x02021bc0 + movs r3, 0 + movs r2, 0x80 + lsls r2, 1 +_08007204: + lsls r0, r1, 3 + adds r0, r4 + strh r2, [r0] + strh r3, [r0, 0x2] + strh r3, [r0, 0x4] + strh r2, [r0, 0x6] + adds r0, r1, 0x1 + lsls r0, 24 + lsrs r1, r0, 24 + cmp r1, 0x1F + bls _08007204 + pop {r4} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end reset_rotscale_coeffs + + thumb_func_start rotscale_set_direct +rotscale_set_direct: @ 8007224 + push {r4,r5,lr} + ldr r5, [sp, 0xC] + lsls r0, 24 + ldr r4, =0x02021bc0 + lsrs r0, 21 + adds r0, r4 + strh r1, [r0] + strh r2, [r0, 0x2] + strh r3, [r0, 0x4] + strh r5, [r0, 0x6] + pop {r4,r5} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end rotscale_set_direct + + thumb_func_start obj_delete +obj_delete: @ 8007244 + push {lr} + ldr r1, =0x082ec64c + movs r2, 0x44 + bl memcpy + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end obj_delete + + thumb_func_start oam_center +oam_center: @ 8007258 + push {r4-r6,lr} + adds r6, r0, 0 + lsls r1, 24 + lsls r2, 24 + lsls r3, 24 + lsrs r3, 24 + ldr r4, =0x082ec634 + lsrs r2, 23 + lsrs r1, 21 + adds r2, r1 + adds r0, r2, r4 + ldrb r5, [r0] + adds r4, 0x1 + adds r2, r4 + ldrb r1, [r2] + movs r0, 0x2 + ands r3, r0 + cmp r3, 0 + beq _08007286 + lsls r0, r5, 25 + lsrs r5, r0, 24 + lsls r0, r1, 25 + lsrs r1, r0, 24 +_08007286: + adds r0, r6, 0 + adds r0, 0x28 + strb r5, [r0] + adds r0, 0x1 + strb r1, [r0] + pop {r4-r6} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end oam_center + + thumb_func_start gpu_tile_obj_alloc +gpu_tile_obj_alloc: @ 800729C + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + lsls r0, 16 + lsrs r4, r0, 16 + cmp r4, 0 + bne _080072F2 + ldr r0, =0x02021b3a + ldrh r3, [r0] + ldr r0, =0x000003ff + cmp r3, r0 + bhi _080072DA + ldr r7, =0x02021b3c + movs r6, 0x7 + adds r4, r0, 0 + movs r5, 0x1 +_080072BE: + lsrs r2, r3, 3 + adds r2, r7 + adds r0, r3, 0 + ands r0, r6 + adds r1, r5, 0 + lsls r1, r0 + ldrb r0, [r2] + bics r0, r1 + strb r0, [r2] + adds r0, r3, 0x1 + lsls r0, 16 + lsrs r3, r0, 16 + cmp r3, r4 + bls _080072BE +_080072DA: + movs r0, 0 + b _080073A4 + .align 2, 0 + .pool +_080072EC: + movs r0, 0x1 + negs r0, r0 + b _080073A4 +_080072F2: + ldr r0, =0x02021b3a + ldrh r3, [r0] + ldr r0, =0x02021b3c + mov r9, r0 + movs r7, 0x7 + movs r6, 0x1 +_080072FE: + lsrs r0, r3, 3 + add r0, r9 + ldrb r1, [r0] + adds r0, r3, 0 + ands r0, r7 + asrs r1, r0 + ands r1, r6 + cmp r1, 0 + beq _08007332 + movs r5, 0x80 + lsls r5, 3 + ldr r2, =0x02021b3c +_08007316: + adds r0, r3, 0x1 + lsls r0, 16 + lsrs r3, r0, 16 + cmp r3, r5 + beq _080072EC + lsrs r0, 19 + adds r0, r2 + ldrb r1, [r0] + adds r0, r3, 0 + ands r0, r7 + asrs r1, r0 + ands r1, r6 + cmp r1, 0 + bne _08007316 +_08007332: + mov r8, r3 + movs r2, 0x1 + cmp r2, r4 + beq _0800736C + movs r1, 0x80 + lsls r1, 3 + mov r12, r1 + ldr r5, =0x02021b3c +_08007342: + adds r0, r3, 0x1 + lsls r0, 16 + lsrs r3, r0, 16 + cmp r3, r12 + beq _080072EC + lsrs r0, 19 + adds r0, r5 + ldrb r1, [r0] + adds r0, r3, 0 + ands r0, r7 + asrs r1, r0 + ands r1, r6 + cmp r1, 0 + bne _08007368 + adds r0, r2, 0x1 + lsls r0, 16 + lsrs r2, r0, 16 + cmp r2, r4 + bne _08007342 +_08007368: + cmp r2, r4 + bne _080072FE +_0800736C: + mov r1, r8 + lsls r0, r1, 16 + lsrs r3, r0, 16 + asrs r1, r0, 16 + adds r1, r4, r1 + adds r6, r0, 0 + cmp r3, r1 + bge _080073A2 + ldr r0, =0x02021b3c + mov r8, r0 + movs r7, 0x7 + adds r4, r1, 0 + movs r5, 0x1 +_08007386: + lsrs r2, r3, 3 + add r2, r8 + adds r1, r3, 0 + ands r1, r7 + adds r0, r5, 0 + lsls r0, r1 + ldrb r1, [r2] + orrs r0, r1 + strb r0, [r2] + adds r0, r3, 0x1 + lsls r0, 16 + lsrs r3, r0, 16 + cmp r3, r4 + blt _08007386 +_080073A2: + asrs r0, r6, 16 +_080073A4: + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end gpu_tile_obj_alloc + + thumb_func_start gpu_tile_obj_alloc_map_bit_op +gpu_tile_obj_alloc_map_bit_op: @ 80073B8 + push {r4-r6,lr} + lsls r0, 16 + lsrs r2, r0, 16 + lsls r1, 24 + lsrs r1, 24 + lsrs r0, 19 + lsls r0, 24 + lsrs r3, r0, 24 + adds r6, r3, 0 + movs r0, 0x7 + ands r2, r0 + adds r4, r2, 0 + movs r5, 0 + cmp r1, 0 + bne _080073F0 + movs r0, 0x1 + lsls r0, r2 + mvns r0, r0 + lsls r0, 24 + lsrs r2, r0, 24 + ldr r0, =0x02021b3c + adds r0, r3, r0 + ldrb r1, [r0] + ands r2, r1 + strb r2, [r0] + b _0800741C + .align 2, 0 + .pool +_080073F0: + cmp r1, 0x1 + bne _0800740C + lsls r1, r2 + lsls r0, r1, 24 + lsrs r2, r0, 24 + ldr r0, =0x02021b3c + adds r0, r3, r0 + ldrb r1, [r0] + orrs r2, r1 + strb r2, [r0] + b _0800741C + .align 2, 0 + .pool +_0800740C: + movs r0, 0x80 + lsls r0, 17 + lsls r0, r4 + lsrs r5, r0, 24 + ldr r0, =0x02021b3c + adds r0, r6, r0 + ldrb r0, [r0] + ands r5, r0 +_0800741C: + adds r0, r5, 0 + pop {r4-r6} + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end gpu_tile_obj_alloc_map_bit_op + + thumb_func_start nullsub_12 +nullsub_12: @ 8007428 + bx lr + thumb_func_end nullsub_12 + + thumb_func_start copy_queue_process +copy_queue_process: @ 800742C + push {r4-r7,lr} + ldr r0, =0x02021834 + ldrb r0, [r0] + cmp r0, 0 + beq _08007474 + movs r4, 0 + ldr r1, =0x02021835 + ldrb r0, [r1] + cmp r0, 0 + beq _0800746E + ldr r6, =0x02021838 + adds r7, r6, 0x4 + adds r5, r1, 0 +_08007446: + lsls r1, r4, 1 + adds r1, r4 + lsls r1, 2 + adds r2, r1, r6 + ldr r0, [r2] + adds r1, r7 + ldr r1, [r1] + ldrh r2, [r2, 0x8] + lsrs r2, 1 + bl CpuSet + ldrb r1, [r5] + subs r1, 0x1 + strb r1, [r5] + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + lsls r1, 24 + cmp r1, 0 + bne _08007446 +_0800746E: + ldr r1, =0x02021834 + movs r0, 0 + strb r0, [r1] +_08007474: + pop {r4-r7} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end copy_queue_process + + thumb_func_start copy_queue_add_oam_frame +copy_queue_add_oam_frame: @ 8007488 + push {r4-r6,lr} + adds r5, r2, 0 + lsls r0, 16 + lsrs r2, r0, 16 + lsls r1, 16 + lsrs r6, r1, 16 + ldr r4, =0x02021835 + ldrb r0, [r4] + cmp r0, 0x3F + bhi _080074D8 + ldr r3, =0x02021838 + adds r1, r0, 0 + lsls r0, r1, 1 + adds r0, r1 + lsls r0, 2 + adds r0, r3 + lsls r2, 3 + adds r2, r5 + ldr r1, [r2] + str r1, [r0] + ldrb r0, [r4] + lsls r1, r0, 1 + adds r1, r0 + lsls r1, 2 + adds r0, r3, 0x4 + adds r1, r0 + lsls r0, r6, 5 + ldr r5, =0x06010000 + adds r0, r5 + str r0, [r1] + ldrb r1, [r4] + lsls r0, r1, 1 + adds r0, r1 + lsls r0, 2 + adds r0, r3 + ldrh r1, [r2, 0x4] + strh r1, [r0, 0x8] + ldrb r0, [r4] + adds r0, 0x1 + strb r0, [r4] +_080074D8: + pop {r4-r6} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end copy_queue_add_oam_frame + + thumb_func_start copy_queue_add +copy_queue_add: @ 80074EC + push {r4-r6,lr} + adds r4, r0, 0 + adds r5, r1, 0 + lsls r2, 16 + lsrs r6, r2, 16 + ldr r3, =0x02021835 + ldrb r0, [r3] + cmp r0, 0x3F + bhi _0800752C + ldr r2, =0x02021838 + adds r1, r0, 0 + lsls r0, r1, 1 + adds r0, r1 + lsls r0, 2 + adds r0, r2 + str r4, [r0] + ldrb r1, [r3] + lsls r0, r1, 1 + adds r0, r1 + lsls r0, 2 + adds r1, r2, 0x4 + adds r0, r1 + str r5, [r0] + ldrb r1, [r3] + lsls r0, r1, 1 + adds r0, r1 + lsls r0, 2 + adds r0, r2 + strh r6, [r0, 0x8] + ldrb r0, [r3] + adds r0, 0x1 + strb r0, [r3] +_0800752C: + pop {r4-r6} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end copy_queue_add + + thumb_func_start copy_all_from_objects +copy_all_from_objects: @ 800753C + push {r4,lr} + adds r1, r0, 0 + ldr r3, =0x02020630 + movs r2, 0 + ldr r4, =0x000010ff +_08007546: + ldrb r0, [r3] + strb r0, [r1] + adds r1, 0x1 + adds r3, 0x1 + adds r2, 0x1 + cmp r2, r4 + bls _08007546 + pop {r4} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end copy_all_from_objects + + thumb_func_start copy_all_to_objects +copy_all_to_objects: @ 8007564 + push {r4,lr} + adds r1, r0, 0 + ldr r3, =0x02020630 + movs r2, 0 + ldr r4, =0x000010ff +_0800756E: + ldrb r0, [r1] + strb r0, [r3] + adds r1, 0x1 + adds r3, 0x1 + adds r2, 0x1 + cmp r2, r4 + bls _0800756E + pop {r4} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end copy_all_to_objects + + thumb_func_start obj_delete_all +obj_delete_all: @ 800758C + push {r4,r5,lr} + movs r4, 0 +_08007590: + lsls r0, r4, 4 + adds r0, r4 + lsls r0, 2 + ldr r5, =0x02020630 + adds r0, r5 + bl obj_delete + ldr r0, =0x020217f4 + adds r0, r4, r0 + strb r4, [r0] + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x3F + bls _08007590 + lsls r0, r4, 4 + adds r0, r4 + lsls r0, 2 + adds r0, r5 + bl obj_delete + pop {r4,r5} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end obj_delete_all + + thumb_func_start obj_free_tiles +obj_free_tiles: @ 80075C8 + push {lr} + ldr r2, [r0, 0x14] + ldrh r1, [r2] + ldr r0, =0x0000ffff + cmp r1, r0 + beq _080075DA + adds r0, r1, 0 + bl gpu_tile_obj_free_by_tag +_080075DA: + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end obj_free_tiles + + thumb_func_start obj_free_pal +obj_free_pal: @ 80075E4 + push {lr} + ldr r0, [r0, 0x14] + ldrh r0, [r0, 0x2] + bl gpu_pal_free_tag + pop {r0} + bx r0 + thumb_func_end obj_free_pal + + thumb_func_start obj_free_rotscale_entry +obj_free_rotscale_entry: @ 80075F4 + push {r4,lr} + adds r4, r0, 0 + ldrb r0, [r4, 0x1] + lsls r0, 30 + lsrs r0, 30 + movs r1, 0x1 + ands r0, r1 + cmp r0, 0 + beq _0800761A + ldrb r0, [r4, 0x3] + lsls r0, 26 + lsrs r0, 27 + bl rotscale_free_entry + ldrb r1, [r4, 0x1] + movs r0, 0x4 + negs r0, r0 + ands r0, r1 + strb r0, [r4, 0x1] +_0800761A: + pop {r4} + pop {r0} + bx r0 + thumb_func_end obj_free_rotscale_entry + + thumb_func_start obj_delete_and_free_resources +obj_delete_and_free_resources: @ 8007620 + push {r4,lr} + adds r4, r0, 0 + bl obj_free_tiles + adds r0, r4, 0 + bl obj_free_pal + adds r0, r4, 0 + bl obj_free_rotscale_entry + adds r0, r4, 0 + bl obj_delete_and_free_tiles + pop {r4} + pop {r0} + bx r0 + thumb_func_end obj_delete_and_free_resources + + thumb_func_start obj_anim_step +obj_anim_step: @ 8007640 + push {r4,r5,lr} + adds r4, r0, 0 + ldr r2, =0x082ec6c4 + adds r5, r4, 0 + adds r5, 0x3F + ldrb r1, [r5] + movs r0, 0x4 + ands r0, r1 + adds r0, r2 + ldr r1, [r0] + adds r0, r4, 0 + bl _call_via_r1 + ldr r0, =0x02021cc0 + ldrb r0, [r0] + cmp r0, 0 + bne _08007676 + ldr r0, =0x082ec6cc + ldrb r1, [r5] + lsls r1, 28 + lsrs r1, 31 + lsls r1, 2 + adds r1, r0 + ldr r1, [r1] + adds r0, r4, 0 + bl _call_via_r1 +_08007676: + pop {r4,r5} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end obj_anim_step + + thumb_func_start obj_anim_image_begin +obj_anim_image_begin: @ 8007688 + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + adds r4, r0, 0 + adds r3, r4, 0 + adds r3, 0x2B + movs r2, 0 + strb r2, [r3] + adds r5, r4, 0 + adds r5, 0x3F + ldrb r1, [r5] + movs r0, 0x11 + negs r0, r0 + ands r0, r1 + strb r0, [r5] + adds r0, r4, 0 + adds r0, 0x2D + strb r2, [r0] + adds r2, r4, 0 + adds r2, 0x2A + ldrb r1, [r2] + ldr r0, [r4, 0x8] + lsls r1, 2 + adds r1, r0 + ldrb r0, [r3] + ldr r1, [r1] + lsls r0, 2 + adds r0, r1 + ldrh r0, [r0] + mov r9, r0 + lsls r0, 16 + mov r8, r0 + asrs r1, r0, 16 + movs r0, 0x1 + negs r0, r0 + cmp r1, r0 + beq _0800776C + ldrb r1, [r5] + subs r0, 0x4 + ands r0, r1 + strb r0, [r5] + ldrb r1, [r2] + ldr r0, [r4, 0x8] + lsls r1, 2 + adds r1, r0 + ldrb r0, [r3] + ldr r1, [r1] + lsls r0, 2 + adds r0, r1 + ldr r0, [r0] + lsls r1, r0, 10 + lsrs r3, r1, 26 + lsls r1, r0, 9 + lsrs r7, r1, 31 + lsls r0, 8 + lsrs r6, r0, 31 + cmp r3, 0 + beq _08007704 + subs r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 +_08007704: + adds r2, r4, 0 + adds r2, 0x2C + movs r0, 0x3F + ands r3, r0 + ldrb r1, [r2] + subs r0, 0x7F + ands r0, r1 + orrs r0, r3 + strb r0, [r2] + ldrb r0, [r4, 0x1] + lsls r0, 30 + lsrs r0, 30 + movs r1, 0x1 + ands r0, r1 + cmp r0, 0 + bne _0800772E + adds r0, r4, 0 + adds r1, r7, 0 + adds r2, r6, 0 + bl obj_set_horizonal_and_vertical_flip +_0800772E: + ldrb r1, [r5] + movs r0, 0x40 + ands r0, r1 + cmp r0, 0 + beq _0800775C + adds r0, r4, 0 + adds r0, 0x40 + ldrh r1, [r0] + add r1, r9 + ldr r2, =0x000003ff + adds r0, r2, 0 + ands r1, r0 + ldrh r2, [r4, 0x4] + ldr r0, =0xfffffc00 + ands r0, r2 + orrs r0, r1 + strh r0, [r4, 0x4] + b _0800776C + .align 2, 0 + .pool +_0800775C: + mov r1, r8 + lsrs r0, r1, 16 + ldrh r1, [r4, 0x4] + lsls r1, 22 + lsrs r1, 22 + ldr r2, [r4, 0xC] + bl copy_queue_add_oam_frame +_0800776C: + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end obj_anim_image_begin + + thumb_func_start obj_anim_image_continue +obj_anim_image_continue: @ 8007778 + push {r4,lr} + adds r4, r0, 0 + adds r0, 0x2C + ldrb r1, [r0] + movs r0, 0x3F + ands r0, r1 + cmp r0, 0 + beq _080077C8 + adds r0, r4, 0 + bl obj_anim_image_delay_progress + adds r0, r4, 0 + adds r0, 0x2A + ldrb r1, [r0] + ldr r0, [r4, 0x8] + lsls r1, 2 + adds r1, r0 + adds r0, r4, 0 + adds r0, 0x2B + ldrb r0, [r0] + ldr r1, [r1] + lsls r0, 2 + adds r0, r1 + ldr r0, [r0] + lsls r1, r0, 9 + lsrs r3, r1, 31 + lsls r0, 8 + lsrs r2, r0, 31 + ldrb r0, [r4, 0x1] + lsls r0, 30 + lsrs r0, 30 + movs r1, 0x1 + ands r0, r1 + cmp r0, 0 + bne _0800780E + adds r0, r4, 0 + adds r1, r3, 0 + bl obj_set_horizonal_and_vertical_flip + b _0800780E +_080077C8: + movs r0, 0x40 + ands r0, r1 + cmp r0, 0 + bne _0800780E + adds r2, r4, 0 + adds r2, 0x2B + ldrb r0, [r2] + adds r0, 0x1 + strb r0, [r2] + adds r0, r4, 0 + adds r0, 0x2A + ldrb r0, [r0] + ldr r1, [r4, 0x8] + lsls r0, 2 + adds r0, r1 + ldrb r1, [r2] + ldr r0, [r0] + lsls r1, 2 + adds r1, r0 + movs r2, 0x3 + movs r3, 0 + ldrsh r0, [r1, r3] + cmp r0, 0 + bge _080077FE + adds r0, 0x3 + lsls r0, 16 + lsrs r2, r0, 16 +_080077FE: + ldr r0, =0x082ec6d4 + lsls r1, r2, 16 + asrs r1, 14 + adds r1, r0 + ldr r1, [r1] + adds r0, r4, 0 + bl _call_via_r1 +_0800780E: + pop {r4} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end obj_anim_image_continue + + thumb_func_start anim_image_3 +anim_image_3: @ 8007818 + push {r4-r7,lr} + mov r7, r8 + push {r7} + adds r4, r0, 0 + adds r0, 0x2A + ldrb r1, [r0] + ldr r0, [r4, 0x8] + lsls r1, 2 + adds r1, r0 + adds r0, r4, 0 + adds r0, 0x2B + ldrb r0, [r0] + ldr r1, [r1] + lsls r0, 2 + adds r0, r1 + ldrh r7, [r0] + mov r8, r7 + ldr r0, [r0] + lsls r1, r0, 10 + lsrs r3, r1, 26 + lsls r1, r0, 9 + lsrs r6, r1, 31 + lsls r0, 8 + lsrs r5, r0, 31 + cmp r3, 0 + beq _08007852 + subs r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 +_08007852: + adds r2, r4, 0 + adds r2, 0x2C + movs r0, 0x3F + ands r3, r0 + ldrb r1, [r2] + subs r0, 0x7F + ands r0, r1 + orrs r0, r3 + strb r0, [r2] + ldrb r0, [r4, 0x1] + lsls r0, 30 + lsrs r0, 30 + movs r1, 0x1 + ands r0, r1 + cmp r0, 0 + bne _0800787C + adds r0, r4, 0 + adds r1, r6, 0 + adds r2, r5, 0 + bl obj_set_horizonal_and_vertical_flip +_0800787C: + adds r0, r4, 0 + adds r0, 0x3F + ldrb r1, [r0] + movs r0, 0x40 + ands r0, r1 + cmp r0, 0 + beq _080078AC + adds r0, r4, 0 + adds r0, 0x40 + ldrh r1, [r0] + adds r1, r7 + ldr r2, =0x000003ff + adds r0, r2, 0 + ands r1, r0 + ldrh r2, [r4, 0x4] + ldr r0, =0xfffffc00 + ands r0, r2 + orrs r0, r1 + strh r0, [r4, 0x4] + b _080078BA + .align 2, 0 + .pool +_080078AC: + mov r0, r8 + ldrh r1, [r4, 0x4] + lsls r1, 22 + lsrs r1, 22 + ldr r2, [r4, 0xC] + bl copy_queue_add_oam_frame +_080078BA: + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end anim_image_3 + + thumb_func_start anim_image_2 +anim_image_2: @ 80078C4 + adds r2, r0, 0 + adds r2, 0x2B + ldrb r1, [r2] + subs r1, 0x1 + strb r1, [r2] + adds r0, 0x3F + ldrb r1, [r0] + movs r2, 0x10 + orrs r1, r2 + strb r1, [r0] + bx lr + thumb_func_end anim_image_2 + + thumb_func_start anim_image_1 +anim_image_1: @ 80078DC + push {r4-r7,lr} + mov r7, r8 + push {r7} + adds r4, r0, 0 + adds r3, r4, 0 + adds r3, 0x2A + ldrb r1, [r3] + ldr r0, [r4, 0x8] + lsls r1, 2 + adds r1, r0 + adds r2, r4, 0 + adds r2, 0x2B + ldrb r0, [r2] + ldr r1, [r1] + lsls r0, 2 + adds r0, r1 + ldr r0, [r0] + lsls r0, 10 + lsrs r0, 26 + strb r0, [r2] + ldrb r0, [r3] + ldr r1, [r4, 0x8] + lsls r0, 2 + adds r0, r1 + ldrb r1, [r2] + ldr r0, [r0] + lsls r1, 2 + adds r1, r0 + ldrh r7, [r1] + mov r8, r7 + ldr r0, [r1] + lsls r1, r0, 10 + lsrs r3, r1, 26 + lsls r1, r0, 9 + lsrs r6, r1, 31 + lsls r0, 8 + lsrs r5, r0, 31 + cmp r3, 0 + beq _08007930 + subs r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 +_08007930: + adds r2, r4, 0 + adds r2, 0x2C + movs r0, 0x3F + ands r3, r0 + ldrb r1, [r2] + subs r0, 0x7F + ands r0, r1 + orrs r0, r3 + strb r0, [r2] + ldrb r0, [r4, 0x1] + lsls r0, 30 + lsrs r0, 30 + movs r1, 0x1 + ands r0, r1 + cmp r0, 0 + bne _0800795A + adds r0, r4, 0 + adds r1, r6, 0 + adds r2, r5, 0 + bl obj_set_horizonal_and_vertical_flip +_0800795A: + adds r0, r4, 0 + adds r0, 0x3F + ldrb r1, [r0] + movs r0, 0x40 + ands r0, r1 + cmp r0, 0 + beq _0800798C + adds r0, r4, 0 + adds r0, 0x40 + ldrh r1, [r0] + adds r1, r7 + ldr r2, =0x000003ff + adds r0, r2, 0 + ands r1, r0 + ldrh r2, [r4, 0x4] + ldr r0, =0xfffffc00 + ands r0, r2 + orrs r0, r1 + strh r0, [r4, 0x4] + b _0800799A + .align 2, 0 + .pool +_0800798C: + mov r0, r8 + ldrh r1, [r4, 0x4] + lsls r1, 22 + lsrs r1, 22 + ldr r2, [r4, 0xC] + bl copy_queue_add_oam_frame +_0800799A: + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end anim_image_1 + + thumb_func_start anim_image_0 +anim_image_0: @ 80079A4 + push {lr} + adds r1, r0, 0 + adds r0, 0x2D + ldrb r0, [r0] + cmp r0, 0 + beq _080079B8 + adds r0, r1, 0 + bl sub_80079FC + b _080079BE +_080079B8: + adds r0, r1, 0 + bl sub_80079C4 +_080079BE: + pop {r0} + bx r0 + thumb_func_end anim_image_0 + + thumb_func_start sub_80079C4 +sub_80079C4: @ 80079C4 + push {r4,lr} + adds r4, r0, 0 + adds r0, 0x2A + ldrb r1, [r0] + ldr r0, [r4, 0x8] + lsls r1, 2 + adds r1, r0 + adds r0, r4, 0 + adds r0, 0x2B + ldrb r0, [r0] + ldr r1, [r1] + lsls r0, 2 + adds r0, r1 + ldr r0, [r0] + lsls r0, 10 + lsrs r0, 26 + adds r1, r4, 0 + adds r1, 0x2D + strb r0, [r1] + adds r0, r4, 0 + bl obj_anim_rewind_to_cmd00 + adds r0, r4, 0 + bl obj_anim_image_continue + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_80079C4 + + thumb_func_start sub_80079FC +sub_80079FC: @ 80079FC + push {r4,lr} + adds r4, r0, 0 + adds r1, r4, 0 + adds r1, 0x2D + ldrb r0, [r1] + subs r0, 0x1 + strb r0, [r1] + adds r0, r4, 0 + bl obj_anim_rewind_to_cmd00 + adds r0, r4, 0 + bl obj_anim_image_continue + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_80079FC + + thumb_func_start obj_anim_rewind_to_cmd00 +obj_anim_rewind_to_cmd00: @ 8007A1C + push {r4-r7,lr} + mov r12, r0 + adds r0, 0x2D + ldrb r0, [r0] + cmp r0, 0 + beq _08007A88 + mov r3, r12 + adds r3, 0x2B + ldrb r0, [r3] + subs r0, 0x1 + strb r0, [r3] + mov r5, r12 + adds r5, 0x2A + ldrb r1, [r5] + mov r2, r12 + ldr r0, [r2, 0x8] + lsls r1, 2 + adds r1, r0 + ldrb r0, [r3] + ldr r1, [r1] + lsls r0, 2 + adds r0, r1 + subs r0, 0x4 + movs r7, 0 + ldrsh r0, [r0, r7] + movs r1, 0x3 + negs r1, r1 + adds r4, r3, 0 + cmp r0, r1 + beq _08007A82 + adds r6, r1, 0 + adds r2, r4, 0 +_08007A5C: + ldrb r0, [r2] + cmp r0, 0 + beq _08007A82 + subs r0, 0x1 + strb r0, [r3] + ldrb r1, [r5] + mov r7, r12 + ldr r0, [r7, 0x8] + lsls r1, 2 + adds r1, r0 + ldrb r0, [r2] + ldr r1, [r1] + lsls r0, 2 + adds r0, r1 + subs r0, 0x4 + movs r1, 0 + ldrsh r0, [r0, r1] + cmp r0, r6 + bne _08007A5C +_08007A82: + ldrb r0, [r4] + subs r0, 0x1 + strb r0, [r4] +_08007A88: + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end obj_anim_rewind_to_cmd00 + + thumb_func_start obj_anim_rotscale_begin +obj_anim_rotscale_begin: @ 8007A90 + push {r4-r7,lr} + sub sp, 0x8 + adds r6, r0, 0 + ldrb r0, [r6, 0x1] + lsls r0, 30 + lsrs r0, 30 + movs r1, 0x1 + ands r0, r1 + cmp r0, 0 + beq _08007B12 + ldr r0, [r6, 0x10] + ldr r0, [r0] + movs r2, 0 + ldrsh r1, [r0, r2] + ldr r0, =0x00007fff + cmp r1, r0 + beq _08007B12 + adds r0, r6, 0 + bl obj_get_rotscale_entry_index + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + adds r0, r4, 0 + bl rotscale_reset_half + mov r5, sp + adds r0, r4, 0 + adds r1, r6, 0 + mov r2, sp + bl rotscale_load_frame + adds r7, r6, 0 + adds r7, 0x3F + ldrb r1, [r7] + movs r0, 0x9 + negs r0, r0 + ands r0, r1 + movs r1, 0x21 + negs r1, r1 + ands r0, r1 + strb r0, [r7] + adds r0, r4, 0 + mov r1, sp + bl sub_8008168 + ldr r1, =0x03000b70 + lsls r0, r4, 1 + adds r0, r4 + lsls r0, 2 + adds r0, r1 + ldrb r1, [r5, 0x5] + strb r1, [r0, 0x2] + ldrb r1, [r7] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + beq _08007B12 + movs r0, 0x3A + ldrsh r1, [r6, r0] + movs r0, 0x3C + ldrsh r2, [r6, r0] + adds r0, r6, 0 + bl obj_update_pos2 +_08007B12: + add sp, 0x8 + pop {r4-r7} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end obj_anim_rotscale_begin + + thumb_func_start obj_anim_rotscale_continue +obj_anim_rotscale_continue: @ 8007B24 + push {r4,r5,lr} + adds r4, r0, 0 + ldrb r0, [r4, 0x1] + lsls r0, 30 + lsrs r0, 30 + movs r1, 0x1 + ands r0, r1 + cmp r0, 0 + beq _08007BC6 + adds r0, r4, 0 + bl obj_get_rotscale_entry_index + lsls r0, 24 + lsrs r2, r0, 24 + adds r5, r2, 0 + ldr r1, =0x03000b70 + lsls r0, r2, 1 + adds r0, r2 + lsls r0, 2 + adds r3, r0, r1 + ldrb r0, [r3, 0x2] + cmp r0, 0 + beq _08007B60 + adds r0, r2, 0 + adds r1, r4, 0 + bl sub_8007BD8 + b _08007BAA + .align 2, 0 + .pool +_08007B60: + adds r0, r4, 0 + adds r0, 0x2C + ldrb r1, [r0] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + bne _08007BC6 + ldrb r0, [r3, 0x1] + adds r0, 0x1 + strb r0, [r3, 0x1] + ldrb r0, [r3] + ldr r1, [r4, 0x10] + lsls r0, 2 + adds r0, r1 + ldrb r1, [r3, 0x1] + ldr r0, [r0] + lsls r1, 3 + adds r1, r0 + movs r2, 0x3 + movs r0, 0 + ldrsh r1, [r1, r0] + ldr r0, =0x00007ffc + cmp r1, r0 + ble _08007B98 + ldr r2, =0xffff8003 + adds r0, r1, r2 + lsls r0, 16 + lsrs r2, r0, 16 +_08007B98: + ldr r0, =0x082ec6e4 + lsls r1, r2, 16 + asrs r1, 14 + adds r1, r0 + ldr r2, [r1] + adds r0, r5, 0 + adds r1, r4, 0 + bl _call_via_r2 +_08007BAA: + adds r0, r4, 0 + adds r0, 0x3F + ldrb r1, [r0] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + beq _08007BC6 + movs r0, 0x3A + ldrsh r1, [r4, r0] + movs r0, 0x3C + ldrsh r2, [r4, r0] + adds r0, r4, 0 + bl obj_update_pos2 +_08007BC6: + pop {r4,r5} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end obj_anim_rotscale_continue + + thumb_func_start sub_8007BD8 +sub_8007BD8: @ 8007BD8 + push {r4,r5,lr} + sub sp, 0x8 + adds r5, r1, 0 + lsls r0, 24 + lsrs r4, r0, 24 + adds r0, r5, 0 + adds r1, r4, 0 + bl obj_anim_rotscale_delay_progress + lsls r0, 24 + cmp r0, 0 + bne _08007C02 + adds r0, r4, 0 + adds r1, r5, 0 + mov r2, sp + bl rotscale_load_frame + adds r0, r4, 0 + mov r1, sp + bl rotscale_frame_apply_relative_and_sync +_08007C02: + add sp, 0x8 + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_8007BD8 + + thumb_func_start anim_rotscale_0 +anim_rotscale_0: @ 8007C0C + push {lr} + adds r3, r1, 0 + lsls r0, 24 + lsrs r2, r0, 24 + ldr r1, =0x03000b70 + lsls r0, r2, 1 + adds r0, r2 + lsls r0, 2 + adds r0, r1 + ldrb r0, [r0, 0x3] + cmp r0, 0 + beq _08007C34 + adds r0, r2, 0 + adds r1, r3, 0 + bl sub_8007C7C + b _08007C3C + .align 2, 0 + .pool +_08007C34: + adds r0, r2, 0 + adds r1, r3, 0 + bl sub_8007C40 +_08007C3C: + pop {r0} + bx r0 + thumb_func_end anim_rotscale_0 + + thumb_func_start sub_8007C40 +sub_8007C40: @ 8007C40 + push {r4,lr} + adds r4, r1, 0 + lsls r0, 24 + lsrs r0, 24 + ldr r1, =0x03000b70 + lsls r3, r0, 1 + adds r3, r0 + lsls r3, 2 + adds r3, r1 + ldrb r2, [r3] + ldr r1, [r4, 0x10] + lsls r2, 2 + adds r2, r1 + ldrb r1, [r3, 0x1] + ldr r2, [r2] + lsls r1, 3 + adds r1, r2 + ldrh r1, [r1, 0x2] + strb r1, [r3, 0x3] + adds r1, r4, 0 + bl obj_anim_rotscale_rewind_to_cmd00_maybe + adds r0, r4, 0 + bl obj_anim_rotscale_continue + pop {r4} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end sub_8007C40 + + thumb_func_start sub_8007C7C +sub_8007C7C: @ 8007C7C + push {r4,lr} + adds r4, r1, 0 + lsls r0, 24 + lsrs r0, 24 + ldr r2, =0x03000b70 + lsls r1, r0, 1 + adds r1, r0 + lsls r1, 2 + adds r1, r2 + ldrb r2, [r1, 0x3] + subs r2, 0x1 + strb r2, [r1, 0x3] + adds r1, r4, 0 + bl obj_anim_rotscale_rewind_to_cmd00_maybe + adds r0, r4, 0 + bl obj_anim_rotscale_continue + pop {r4} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end sub_8007C7C + + thumb_func_start obj_anim_rotscale_rewind_to_cmd00_maybe +obj_anim_rotscale_rewind_to_cmd00_maybe: @ 8007CAC + push {r4-r7,lr} + mov r12, r1 + lsls r0, 24 + lsrs r5, r0, 24 + ldr r1, =0x03000b70 + lsls r3, r5, 1 + adds r0, r3, r5 + lsls r0, 2 + adds r2, r0, r1 + ldrb r0, [r2, 0x3] + adds r6, r1, 0 + cmp r0, 0 + beq _08007D0C + ldrb r0, [r2, 0x1] + subs r0, 0x1 + strb r0, [r2, 0x1] + adds r4, r3, 0 + b _08007CDC + .align 2, 0 + .pool +_08007CD4: + cmp r2, 0 + beq _08007D00 + subs r0, r2, 0x1 + strb r0, [r3, 0x1] +_08007CDC: + adds r0, r4, r5 + lsls r0, 2 + adds r3, r0, r6 + ldrb r0, [r3] + mov r2, r12 + ldr r1, [r2, 0x10] + lsls r0, 2 + adds r0, r1 + ldrb r2, [r3, 0x1] + ldr r1, [r0] + lsls r0, r2, 3 + adds r0, r1 + subs r0, 0x8 + movs r7, 0 + ldrsh r1, [r0, r7] + ldr r0, =0x00007ffd + cmp r1, r0 + bne _08007CD4 +_08007D00: + adds r1, r4, r5 + lsls r1, 2 + adds r1, r6 + ldrb r0, [r1, 0x1] + subs r0, 0x1 + strb r0, [r1, 0x1] +_08007D0C: + pop {r4-r7} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end obj_anim_rotscale_rewind_to_cmd00_maybe + + thumb_func_start anim_rotscale_1 +anim_rotscale_1: @ 8007D18 + push {r4-r6,lr} + sub sp, 0x8 + adds r5, r0, 0 + lsls r5, 24 + lsrs r5, 24 + ldr r0, =0x03000b70 + lsls r4, r5, 1 + adds r4, r5 + lsls r4, 2 + adds r4, r0 + ldrb r2, [r4] + ldr r0, [r1, 0x10] + lsls r2, 2 + adds r2, r0 + ldrb r0, [r4, 0x1] + ldr r2, [r2] + lsls r0, 3 + adds r0, r2 + ldrh r0, [r0, 0x2] + strb r0, [r4, 0x1] + mov r6, sp + adds r0, r5, 0 + mov r2, sp + bl rotscale_load_frame + adds r0, r5, 0 + mov r1, sp + bl sub_8008168 + ldrb r0, [r6, 0x5] + strb r0, [r4, 0x2] + add sp, 0x8 + pop {r4-r6} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end anim_rotscale_1 + + thumb_func_start anim_rotscale_2 +anim_rotscale_2: @ 8007D64 + push {lr} + sub sp, 0x8 + lsls r0, 24 + lsrs r0, 24 + movs r2, 0 + movs r3, 0 + str r2, [sp] + str r3, [sp, 0x4] + adds r1, 0x3F + ldrb r2, [r1] + movs r3, 0x20 + orrs r2, r3 + strb r2, [r1] + ldr r2, =0x03000b70 + lsls r1, r0, 1 + adds r1, r0 + lsls r1, 2 + adds r1, r2 + ldrb r2, [r1, 0x1] + subs r2, 0x1 + strb r2, [r1, 0x1] + mov r1, sp + bl rotscale_frame_apply_relative_and_sync + add sp, 0x8 + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end anim_rotscale_2 + + thumb_func_start anim_rotscale_3 +anim_rotscale_3: @ 8007DA0 + push {r4,r5,lr} + sub sp, 0x8 + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + mov r5, sp + adds r0, r4, 0 + mov r2, sp + bl rotscale_load_frame + adds r0, r4, 0 + mov r1, sp + bl sub_8008168 + ldr r1, =0x03000b70 + lsls r0, r4, 1 + adds r0, r4 + lsls r0, 2 + adds r0, r1 + ldrb r1, [r5, 0x5] + strb r1, [r0, 0x2] + add sp, 0x8 + pop {r4,r5} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end anim_rotscale_3 + + thumb_func_start rotscale_set_indirect +rotscale_set_indirect: @ 8007DD8 + lsls r0, 24 + ldr r2, =0x02021bc0 + lsrs r0, 21 + adds r0, r2 + ldrh r2, [r1] + strh r2, [r0] + ldrh r2, [r1, 0x2] + strh r2, [r0, 0x2] + ldrh r2, [r1, 0x4] + strh r2, [r0, 0x4] + ldrh r1, [r1, 0x6] + strh r1, [r0, 0x6] + bx lr + .align 2, 0 + .pool + thumb_func_end rotscale_set_indirect + + thumb_func_start obj_get_rotscale_entry_index +obj_get_rotscale_entry_index: @ 8007DF8 + push {lr} + adds r2, r0, 0 + movs r3, 0 + ldrb r0, [r2, 0x1] + lsls r0, 30 + lsrs r0, 30 + movs r1, 0x1 + ands r0, r1 + cmp r0, 0 + beq _08007E12 + ldrb r0, [r2, 0x3] + lsls r0, 26 + lsrs r3, r0, 27 +_08007E12: + adds r0, r3, 0 + pop {r1} + bx r1 + thumb_func_end obj_get_rotscale_entry_index + + thumb_func_start sub_8007E18 +sub_8007E18: @ 8007E18 + strh r1, [r0, 0x3A] + strh r2, [r0, 0x3C] + adds r0, 0x3F + ldrb r1, [r0] + movs r2, 0x80 + orrs r1, r2 + strb r1, [r0] + bx lr + thumb_func_end sub_8007E18 + + thumb_func_start sub_8007E28 +sub_8007E28: @ 8007E28 + push {r4,r5,lr} + adds r3, r0, 0 + adds r5, r2, 0 + subs r0, r1, r3 + cmp r0, 0 + bge _08007E3A + negs r0, r0 + asrs r4, r0, 9 + b _08007E3E +_08007E3A: + asrs r0, 9 + negs r4, r0 +_08007E3E: + adds r0, r5, 0 + muls r0, r1 + adds r1, r3, 0 + bl __udivsi3 + adds r0, r4 + subs r0, r5, r0 + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_8007E28 + + thumb_func_start obj_update_pos2 +obj_update_pos2: @ 8007E54 + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + adds r5, r0, 0 + adds r6, r1, 0 + mov r8, r2 + ldrb r1, [r5, 0x3] + lsls r0, r1, 26 + lsrs r7, r0, 27 + movs r0, 0x80 + lsls r0, 4 + mov r9, r0 + cmp r6, r9 + beq _08007EA2 + ldr r2, =0x082ec6f4 + lsrs r1, 6 + lsls r1, 3 + ldrb r0, [r5, 0x1] + lsrs r0, 6 + lsls r0, 5 + adds r1, r0 + adds r1, r2 + ldr r0, [r1] + lsls r4, r0, 8 + lsls r0, 16 + ldr r2, =0x02021bc0 + lsls r1, r7, 3 + adds r1, r2 + movs r2, 0 + ldrsh r1, [r1, r2] + bl __divsi3 + adds r1, r0, 0 + adds r0, r4, 0 + adds r2, r6, 0 + bl sub_8007E28 + strh r0, [r5, 0x24] +_08007EA2: + cmp r8, r9 + beq _08007EDA + ldr r2, =0x082ec6f4 + ldrb r1, [r5, 0x3] + lsrs r1, 6 + lsls r1, 3 + ldrb r0, [r5, 0x1] + lsrs r0, 6 + lsls r0, 5 + adds r1, r0 + adds r2, 0x4 + adds r1, r2 + ldr r0, [r1] + lsls r4, r0, 8 + lsls r0, 16 + ldr r2, =0x02021bc0 + lsls r1, r7, 3 + adds r1, r2 + movs r2, 0x6 + ldrsh r1, [r1, r2] + bl __divsi3 + adds r1, r0, 0 + adds r0, r4, 0 + mov r2, r8 + bl sub_8007E28 + strh r0, [r5, 0x26] +_08007EDA: + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end obj_update_pos2 + + thumb_func_start obj_set_horizonal_and_vertical_flip +obj_set_horizonal_and_vertical_flip: @ 8007EF0 + push {r4-r6,lr} + mov r6, r8 + push {r6} + lsls r1, 24 + lsrs r1, 24 + lsls r2, 24 + lsrs r2, 24 + ldrb r6, [r0, 0x3] + lsls r3, r6, 26 + lsrs r3, 27 + movs r4, 0x7 + ands r3, r4 + lsls r3, 1 + subs r4, 0x46 + mov r8, r4 + mov r5, r8 + ands r5, r6 + orrs r5, r3 + strb r5, [r0, 0x3] + lsls r4, r5, 26 + lsrs r4, 27 + movs r6, 0x3F + adds r6, r0 + mov r12, r6 + ldrb r3, [r6] + lsls r3, 31 + lsrs r3, 31 + eors r1, r3 + movs r6, 0x1 + ands r1, r6 + lsls r1, 3 + orrs r4, r1 + lsls r4, 1 + mov r3, r8 + ands r3, r5 + orrs r3, r4 + strb r3, [r0, 0x3] + lsls r4, r3, 26 + lsrs r4, 27 + mov r5, r12 + ldrb r1, [r5] + lsls r1, 30 + lsrs r1, 31 + eors r2, r1 + ands r2, r6 + lsls r2, 4 + orrs r4, r2 + lsls r4, 1 + mov r6, r8 + ands r3, r6 + orrs r3, r4 + strb r3, [r0, 0x3] + pop {r3} + mov r8, r3 + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end obj_set_horizonal_and_vertical_flip + + thumb_func_start rotscale_reset_half +rotscale_reset_half: @ 8007F64 + lsls r0, 24 + lsrs r0, 24 + ldr r2, =0x03000b70 + lsls r1, r0, 1 + adds r1, r0 + lsls r1, 2 + adds r1, r2 + movs r0, 0 + strb r0, [r1, 0x1] + strb r0, [r1, 0x2] + strb r0, [r1, 0x3] + bx lr + .align 2, 0 + .pool + thumb_func_end rotscale_reset_half + + thumb_func_start rotscale_reset_full_1 +rotscale_reset_full_1: @ 8007F80 + lsls r0, 24 + lsrs r0, 24 + ldr r3, =0x03000b70 + lsls r2, r0, 1 + adds r2, r0 + lsls r2, 2 + adds r2, r3 + movs r3, 0 + strb r1, [r2] + strb r3, [r2, 0x1] + strb r3, [r2, 0x2] + strb r3, [r2, 0x3] + movs r0, 0x80 + lsls r0, 1 + strh r0, [r2, 0x4] + strh r0, [r2, 0x6] + strh r3, [r2, 0x8] + bx lr + .align 2, 0 + .pool + thumb_func_end rotscale_reset_full_1 + + thumb_func_start rotscale_reset_full_2 +rotscale_reset_full_2: @ 8007FA8 + lsls r0, 24 + lsrs r0, 24 + ldr r2, =0x03000b70 + lsls r1, r0, 1 + adds r1, r0 + lsls r1, 2 + adds r1, r2 + movs r0, 0 + strb r0, [r1] + strb r0, [r1, 0x1] + strb r0, [r1, 0x2] + strb r0, [r1, 0x3] + movs r2, 0x80 + lsls r2, 1 + strh r2, [r1, 0x4] + strh r2, [r1, 0x6] + strh r0, [r1, 0x8] + bx lr + .align 2, 0 + .pool + thumb_func_end rotscale_reset_full_2 + + thumb_func_start rotscale_frame_apply_absolute +rotscale_frame_apply_absolute: @ 8007FD0 + lsls r0, 24 + lsrs r0, 24 + ldr r3, =0x03000b70 + lsls r2, r0, 1 + adds r2, r0 + lsls r2, 2 + adds r2, r3 + ldrh r0, [r1] + strh r0, [r2, 0x4] + ldrh r0, [r1, 0x2] + strh r0, [r2, 0x6] + ldrb r0, [r1, 0x4] + lsls r0, 8 + strh r0, [r2, 0x8] + bx lr + .align 2, 0 + .pool + thumb_func_end rotscale_frame_apply_absolute + + thumb_func_start obj_anim_image_delay_progress +obj_anim_image_delay_progress: @ 8007FF4 + push {lr} + adds r3, r0, 0 + adds r3, 0x2C + ldrb r2, [r3] + movs r0, 0x40 + ands r0, r2 + cmp r0, 0 + bne _08008018 + lsls r0, r2, 26 + lsrs r0, 26 + subs r0, 0x1 + movs r1, 0x3F + ands r0, r1 + movs r1, 0x40 + negs r1, r1 + ands r1, r2 + orrs r1, r0 + strb r1, [r3] +_08008018: + pop {r0} + bx r0 + thumb_func_end obj_anim_image_delay_progress + + thumb_func_start obj_anim_rotscale_delay_progress +obj_anim_rotscale_delay_progress: @ 800801C + push {lr} + lsls r1, 24 + lsrs r2, r1, 24 + adds r3, r0, 0 + adds r3, 0x2C + ldrb r1, [r3] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + bne _08008040 + ldr r0, =0x03000b70 + lsls r1, r2, 1 + adds r1, r2 + lsls r1, 2 + adds r1, r0 + ldrb r0, [r1, 0x2] + subs r0, 0x1 + strb r0, [r1, 0x2] +_08008040: + ldrb r0, [r3] + lsrs r0, 7 + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end obj_anim_rotscale_delay_progress + + thumb_func_start rotscale_frame_apply_relative_and_sync +rotscale_frame_apply_relative_and_sync: @ 800804C + push {r4-r6,lr} + sub sp, 0x10 + adds r5, r0, 0 + lsls r5, 24 + lsrs r5, 24 + ldr r0, =0x03000b70 + lsls r4, r5, 1 + adds r4, r5 + lsls r4, 2 + adds r4, r0 + ldrh r0, [r1] + ldrh r2, [r4, 0x4] + adds r0, r2 + strh r0, [r4, 0x4] + ldrh r0, [r1, 0x2] + ldrh r2, [r4, 0x6] + adds r0, r2 + strh r0, [r4, 0x6] + ldrb r0, [r1, 0x4] + lsls r0, 8 + ldrh r1, [r4, 0x8] + adds r0, r1 + ldr r2, =0xffffff00 + adds r1, r2, 0 + ands r0, r1 + strh r0, [r4, 0x8] + movs r1, 0x4 + ldrsh r0, [r4, r1] + bl divide_0x10000_by + lsls r0, 16 + lsrs r0, 16 + ldr r6, =0xffff0000 + ldr r1, [sp] + ands r1, r6 + orrs r1, r0 + str r1, [sp] + movs r2, 0x6 + ldrsh r0, [r4, r2] + bl divide_0x10000_by + lsls r0, 16 + ldr r2, =0x0000ffff + ldr r1, [sp] + ands r1, r2 + orrs r1, r0 + str r1, [sp] + ldrh r1, [r4, 0x8] + ldr r0, [sp, 0x4] + ands r0, r6 + orrs r0, r1 + str r0, [sp, 0x4] + add r4, sp, 0x8 + mov r0, sp + adds r1, r4, 0 + movs r2, 0x1 + movs r3, 0x2 + bl _082E709C + adds r0, r5, 0 + adds r1, r4, 0 + bl rotscale_set_indirect + add sp, 0x10 + pop {r4-r6} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end rotscale_frame_apply_relative_and_sync + + thumb_func_start divide_0x10000_by +divide_0x10000_by: @ 80080E4 + push {lr} + adds r1, r0, 0 + movs r0, 0x80 + lsls r0, 9 + lsls r1, 16 + asrs r1, 16 + bl __divsi3 + lsls r0, 16 + asrs r0, 16 + pop {r1} + bx r1 + thumb_func_end divide_0x10000_by + + thumb_func_start rotscale_load_frame +rotscale_load_frame: @ 80080FC + push {r4,lr} + lsls r0, 24 + lsrs r0, 24 + ldr r3, =0x03000b70 + lsls r4, r0, 1 + adds r4, r0 + lsls r4, 2 + adds r4, r3 + ldrb r3, [r4] + ldr r0, [r1, 0x10] + lsls r3, 2 + adds r3, r0 + ldrb r0, [r4, 0x1] + ldr r3, [r3] + lsls r0, 3 + adds r0, r3 + ldrh r0, [r0] + strh r0, [r2] + ldrb r3, [r4] + ldr r0, [r1, 0x10] + lsls r3, 2 + adds r3, r0 + ldrb r0, [r4, 0x1] + ldr r3, [r3] + lsls r0, 3 + adds r0, r3 + ldrh r0, [r0, 0x2] + strh r0, [r2, 0x2] + ldrb r3, [r4] + ldr r0, [r1, 0x10] + lsls r3, 2 + adds r3, r0 + ldrb r0, [r4, 0x1] + ldr r3, [r3] + lsls r0, 3 + adds r0, r3 + ldrb r0, [r0, 0x4] + strb r0, [r2, 0x4] + ldrb r3, [r4] + ldr r0, [r1, 0x10] + lsls r3, 2 + adds r3, r0 + ldrb r0, [r4, 0x1] + ldr r1, [r3] + lsls r0, 3 + adds r0, r1 + ldrb r0, [r0, 0x5] + strb r0, [r2, 0x5] + pop {r4} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end rotscale_load_frame + + thumb_func_start sub_8008168 +sub_8008168: @ 8008168 + push {r4,lr} + sub sp, 0x8 + adds r2, r1, 0 + lsls r0, 24 + lsrs r4, r0, 24 + movs r0, 0 + movs r1, 0 + str r0, [sp] + str r1, [sp, 0x4] + ldrb r0, [r2, 0x5] + cmp r0, 0 + beq _0800818E + subs r0, 0x1 + strb r0, [r2, 0x5] + adds r0, r4, 0 + adds r1, r2, 0 + bl rotscale_frame_apply_relative_and_sync + b _0800819E +_0800818E: + adds r0, r4, 0 + adds r1, r2, 0 + bl rotscale_frame_apply_absolute + adds r0, r4, 0 + mov r1, sp + bl rotscale_frame_apply_relative_and_sync +_0800819E: + add sp, 0x8 + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_8008168 + + thumb_func_start obj_anim_image_start +obj_anim_image_start: @ 80081A8 + adds r2, r0, 0 + adds r2, 0x2A + strb r1, [r2] + adds r0, 0x3F + ldrb r1, [r0] + movs r2, 0x4 + orrs r1, r2 + movs r2, 0x11 + negs r2, r2 + ands r1, r2 + strb r1, [r0] + bx lr + thumb_func_end obj_anim_image_start + + thumb_func_start obj_anim_image_start_if_different +obj_anim_image_start_if_different: @ 80081C0 + push {lr} + adds r2, r0, 0 + lsls r1, 24 + lsrs r1, 24 + adds r0, 0x2A + ldrb r0, [r0] + cmp r0, r1 + beq _080081D6 + adds r0, r2, 0 + bl obj_anim_image_start +_080081D6: + pop {r0} + bx r0 + thumb_func_end obj_anim_image_start_if_different + + thumb_func_start obj_anim_image_seek +obj_anim_image_seek: @ 80081DC + push {r4-r7,lr} + adds r3, r0, 0 + lsls r1, 24 + lsrs r1, 24 + adds r4, r3, 0 + adds r4, 0x2C + ldrb r0, [r4] + lsls r0, 25 + lsrs r6, r0, 31 + subs r1, 0x1 + adds r0, r3, 0 + adds r0, 0x2B + strb r1, [r0] + ldrb r1, [r4] + movs r7, 0x40 + negs r7, r7 + adds r0, r7, 0 + ands r0, r1 + strb r0, [r4] + adds r2, r3, 0 + adds r2, 0x3F + ldrb r1, [r2] + movs r0, 0x5 + negs r0, r0 + ands r0, r1 + movs r1, 0x11 + negs r1, r1 + ands r0, r1 + strb r0, [r2] + ldrb r1, [r4] + movs r5, 0x41 + negs r5, r5 + adds r0, r5, 0 + ands r0, r1 + strb r0, [r4] + adds r0, r3, 0 + bl obj_anim_image_continue + ldrb r2, [r4] + movs r0, 0x3F + ands r0, r2 + cmp r0, 0 + beq _08008244 + lsls r0, r2, 26 + lsrs r0, 26 + adds r0, 0x1 + movs r1, 0x3F + ands r0, r1 + adds r1, r7, 0 + ands r1, r2 + orrs r1, r0 + strb r1, [r4] +_08008244: + lsls r2, r6, 6 + ldrb r1, [r4] + adds r0, r5, 0 + ands r0, r1 + orrs r0, r2 + strb r0, [r4] + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end obj_anim_image_seek + + thumb_func_start sub_8008258 +sub_8008258: @ 8008258 + push {r4,r5,lr} + adds r5, r0, 0 + lsls r4, r1, 24 + lsrs r4, 24 + bl obj_get_rotscale_entry_index + lsls r0, 24 + lsrs r0, 24 + adds r1, r4, 0 + bl rotscale_reset_full_1 + adds r5, 0x3F + ldrb r0, [r5] + movs r1, 0x8 + orrs r0, r1 + movs r1, 0x21 + negs r1, r1 + ands r0, r1 + strb r0, [r5] + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_8008258 + + thumb_func_start sub_8008284 +sub_8008284: @ 8008284 + push {r4,r5,lr} + adds r5, r0, 0 + lsls r1, 24 + lsrs r4, r1, 24 + bl obj_get_rotscale_entry_index + lsls r0, 24 + lsrs r0, 24 + ldr r2, =0x03000b70 + lsls r1, r0, 1 + adds r1, r0 + lsls r1, 2 + adds r1, r2 + ldrb r0, [r1] + cmp r0, r4 + beq _080082AC + adds r0, r5, 0 + adds r1, r4, 0 + bl sub_8008258 +_080082AC: + pop {r4,r5} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end sub_8008284 + + thumb_func_start sub_80082B8 +sub_80082B8: @ 80082B8 + push {r4,r5,lr} + adds r5, r0, 0 + lsls r4, r1, 24 + lsrs r4, 24 + bl obj_get_rotscale_entry_index + lsls r0, 24 + lsrs r0, 24 + ldr r2, =0x03000b70 + lsls r1, r0, 1 + adds r1, r0 + lsls r1, 2 + adds r1, r2 + strb r4, [r1] + adds r5, 0x3F + ldrb r0, [r5] + movs r1, 0x8 + orrs r0, r1 + movs r1, 0x21 + negs r1, r1 + ands r0, r1 + strb r0, [r5] + pop {r4,r5} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end sub_80082B8 + + thumb_func_start sub_80082F0 +sub_80082F0: @ 80082F0 + push {r4,r5,lr} + adds r5, r0, 0 + lsls r1, 24 + lsrs r4, r1, 24 + bl obj_get_rotscale_entry_index + lsls r0, 24 + lsrs r0, 24 + ldr r2, =0x03000b70 + lsls r1, r0, 1 + adds r1, r0 + lsls r1, 2 + adds r1, r2 + ldrb r0, [r1] + cmp r0, r4 + beq _08008318 + adds r0, r5, 0 + adds r1, r4, 0 + bl sub_80082B8 +_08008318: + pop {r4,r5} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end sub_80082F0 + + thumb_func_start sub_8008324 +sub_8008324: @ 8008324 + push {lr} + adds r3, r0, 0 + adds r0, 0x3F + ldrb r1, [r0] + movs r0, 0x40 + ands r0, r1 + cmp r0, 0 + beq _08008370 + adds r0, r3, 0 + adds r0, 0x2A + ldrb r1, [r0] + ldr r0, [r3, 0x8] + lsls r1, 2 + adds r1, r0 + adds r0, r3, 0 + adds r0, 0x2B + ldrb r0, [r0] + ldr r1, [r1] + lsls r0, 2 + adds r0, r1 + ldrh r2, [r0] + movs r1, 0 + ldrsh r0, [r0, r1] + cmp r0, 0 + bge _08008358 + movs r2, 0 +_08008358: + adds r0, r3, 0 + adds r0, 0x40 + ldrh r1, [r0] + adds r1, r2 + ldr r2, =0x000003ff + adds r0, r2, 0 + ands r1, r0 + ldrh r2, [r3, 0x4] + ldr r0, =0xfffffc00 + ands r0, r2 + orrs r0, r1 + strh r0, [r3, 0x4] +_08008370: + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end sub_8008324 + + thumb_func_start rotscale_reset_all +rotscale_reset_all: @ 800837C + push {r4,lr} + ldr r1, =0x02021cc0 + movs r0, 0 + strb r0, [r1] + ldr r1, =0x03003018 + movs r0, 0 + str r0, [r1] + bl reset_rotscale_coeffs + movs r4, 0 +_08008390: + adds r0, r4, 0 + bl rotscale_reset_full_2 + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x1F + bls _08008390 + pop {r4} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end rotscale_reset_all + + thumb_func_start rotscale_alloc_entry +rotscale_alloc_entry: @ 80083B0 + push {r4,lr} + movs r2, 0 + movs r1, 0x1 + ldr r0, =0x03003018 + ldr r4, [r0] + adds r3, r0, 0 +_080083BC: + adds r0, r4, 0 + ands r0, r1 + cmp r0, 0 + bne _080083D4 + ldr r0, [r3] + orrs r0, r1 + str r0, [r3] + adds r0, r2, 0 + b _080083E2 + .align 2, 0 + .pool +_080083D4: + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + lsls r1, 1 + cmp r2, 0x1F + bls _080083BC + movs r0, 0xFF +_080083E2: + pop {r4} + pop {r1} + bx r1 + thumb_func_end rotscale_alloc_entry + + thumb_func_start rotscale_free_entry +rotscale_free_entry: @ 80083E8 + push {lr} + sub sp, 0x4 + lsls r0, 24 + lsrs r2, r0, 24 + movs r0, 0 + movs r1, 0x1 + ldr r3, =0x03003018 + cmp r0, r2 + bcs _08008406 +_080083FA: + adds r0, 0x1 + lsls r0, 24 + lsrs r0, 24 + lsls r1, 1 + cmp r0, r2 + bcc _080083FA +_08008406: + ldr r0, [r3] + bics r0, r1 + str r0, [r3] + movs r1, 0x80 + lsls r1, 1 + str r1, [sp] + adds r0, r2, 0 + movs r2, 0 + movs r3, 0 + bl rotscale_set_direct + add sp, 0x4 + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end rotscale_free_entry + + thumb_func_start obj_alloc_rotscale_entry +obj_alloc_rotscale_entry: @ 8008428 + push {r4,r5,lr} + adds r4, r0, 0 + bl rotscale_alloc_entry + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, 0xFF + beq _08008470 + ldrb r3, [r4, 0x1] + lsrs r1, r3, 6 + ldrb r2, [r4, 0x3] + lsrs r2, 6 + lsls r3, 30 + lsrs r3, 30 + adds r0, r4, 0 + bl oam_center + movs r0, 0x1F + adds r1, r5, 0 + ands r1, r0 + lsls r1, 1 + ldrb r2, [r4, 0x3] + movs r0, 0x3F + negs r0, r0 + ands r0, r2 + orrs r0, r1 + strb r0, [r4, 0x3] + adds r2, r4, 0 + adds r2, 0x3F + ldrb r0, [r2] + movs r1, 0x8 + orrs r0, r1 + strb r0, [r2] + adds r0, r5, 0 + bl rotscale_reset_full_2 +_08008470: + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end obj_alloc_rotscale_entry + + thumb_func_start sub_8008478 +sub_8008478: @ 8008478 + push {r4-r6,lr} + mov r6, r8 + push {r6} + sub sp, 0x10 + adds r6, r0, 0 + adds r0, r1, 0 + adds r4, r2, 0 + adds r5, r3, 0 + lsls r6, 24 + lsrs r6, 24 + lsls r4, 16 + lsrs r4, 16 + lsls r5, 16 + lsrs r5, 16 + lsls r0, 16 + asrs r0, 16 + bl divide_0x10000_by + lsls r0, 16 + lsrs r0, 16 + ldr r1, =0xffff0000 + mov r8, r1 + ldr r1, [sp] + mov r2, r8 + ands r1, r2 + orrs r1, r0 + str r1, [sp] + lsls r4, 16 + asrs r4, 16 + adds r0, r4, 0 + bl divide_0x10000_by + lsls r0, 16 + ldr r2, =0x0000ffff + ldr r1, [sp] + ands r1, r2 + orrs r1, r0 + str r1, [sp] + ldr r0, [sp, 0x4] + mov r1, r8 + ands r0, r1 + orrs r0, r5 + str r0, [sp, 0x4] + add r4, sp, 0x8 + mov r0, sp + adds r1, r4, 0 + movs r2, 0x1 + movs r3, 0x2 + bl _082E709C + adds r0, r6, 0 + adds r1, r4, 0 + bl rotscale_set_indirect + add sp, 0x10 + pop {r3} + mov r8, r3 + pop {r4-r6} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end sub_8008478 + + thumb_func_start gpu_tile_obj_alloc_tag_and_copy_to_vram +gpu_tile_obj_alloc_tag_and_copy_to_vram: @ 80084F8 + push {r4-r6,lr} + adds r5, r0, 0 + ldrh r0, [r5, 0x4] + lsrs r0, 5 + bl gpu_tile_obj_alloc + lsls r4, r0, 16 + asrs r6, r4, 16 + cmp r6, 0 + blt _08008534 + ldrh r0, [r5, 0x6] + lsrs r4, 16 + ldrh r2, [r5, 0x4] + lsrs r2, 5 + adds r1, r4, 0 + bl gpu_tile_obj_tag_add + ldr r0, [r5] + lsls r1, r6, 5 + ldr r2, =0x06010000 + adds r1, r2 + ldrh r2, [r5, 0x4] + lsrs r2, 1 + bl CpuSet + adds r0, r4, 0 + b _08008536 + .align 2, 0 + .pool +_08008534: + movs r0, 0 +_08008536: + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end gpu_tile_obj_alloc_tag_and_copy_to_vram + + thumb_func_start gpu_tile_obj_alloc_and_load_multiple +gpu_tile_obj_alloc_and_load_multiple: @ 800853C + push {r4,r5,lr} + adds r5, r0, 0 + movs r4, 0 + ldr r0, [r5] + cmp r0, 0 + beq _08008560 +_08008548: + lsls r0, r4, 3 + adds r0, r5, r0 + bl gpu_tile_obj_alloc_tag_and_copy_to_vram + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + lsls r0, r4, 3 + adds r0, r5 + ldr r0, [r0] + cmp r0, 0 + bne _08008548 +_08008560: + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end gpu_tile_obj_alloc_and_load_multiple + + thumb_func_start gpu_tile_obj_free_by_tag +gpu_tile_obj_free_by_tag: @ 8008568 + push {r4-r7,lr} + mov r7, r8 + push {r7} + lsls r0, 16 + lsrs r0, 16 + bl gpu_tile_obj_tag_index_of + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0xFF + beq _080085C6 + ldr r0, =0x03000a70 + lsls r1, r4, 2 + adds r2, r1, r0 + adds r0, 0x2 + adds r1, r0 + ldrh r0, [r1] + ldrh r3, [r2] + adds r0, r3, r0 + ldr r1, =0x030009f0 + mov r8, r1 + lsls r5, r4, 1 + cmp r3, r0 + bge _080085BE + ldr r1, =0x02021b3c + mov r12, r1 + movs r6, 0x7 + movs r7, 0x1 + adds r4, r0, 0 +_080085A2: + lsrs r2, r3, 3 + add r2, r12 + adds r0, r3, 0 + ands r0, r6 + adds r1, r7, 0 + lsls r1, r0 + ldrb r0, [r2] + bics r0, r1 + strb r0, [r2] + adds r0, r3, 0x1 + lsls r0, 16 + lsrs r3, r0, 16 + cmp r3, r4 + blt _080085A2 +_080085BE: + mov r0, r8 + adds r1, r5, r0 + ldr r0, =0x0000ffff + strh r0, [r1] +_080085C6: + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end gpu_tile_obj_free_by_tag + + thumb_func_start gpu_tile_obj_tags_reset +gpu_tile_obj_tags_reset: @ 80085E0 + push {r4-r7,lr} + movs r2, 0 + ldr r7, =0x030009f0 + ldr r0, =0x0000ffff + adds r6, r0, 0 + ldr r4, =0x03000a70 + movs r3, 0 + adds r5, r4, 0x2 +_080085F0: + lsls r1, r2, 1 + adds r1, r7 + ldrh r0, [r1] + orrs r0, r6 + strh r0, [r1] + lsls r1, r2, 2 + adds r0, r1, r4 + strh r3, [r0] + adds r1, r5 + strh r3, [r1] + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0x3F + bls _080085F0 + pop {r4-r7} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end gpu_tile_obj_tags_reset + + thumb_func_start gpu_tile_obj_tag_get_range_start +gpu_tile_obj_tag_get_range_start: @ 8008620 + push {lr} + lsls r0, 16 + lsrs r0, 16 + bl gpu_tile_obj_tag_index_of + lsls r0, 24 + lsrs r1, r0, 24 + cmp r1, 0xFF + beq _08008640 + ldr r0, =0x03000a70 + lsls r1, 2 + adds r1, r0 + ldrh r0, [r1] + b _08008642 + .align 2, 0 + .pool +_08008640: + ldr r0, =0x0000ffff +_08008642: + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end gpu_tile_obj_tag_get_range_start + + thumb_func_start gpu_tile_obj_tag_index_of +gpu_tile_obj_tag_index_of: @ 800864C + push {lr} + lsls r0, 16 + lsrs r2, r0, 16 + movs r1, 0 + ldr r3, =0x030009f0 +_08008656: + lsls r0, r1, 1 + adds r0, r3 + ldrh r0, [r0] + cmp r0, r2 + bne _08008668 + adds r0, r1, 0 + b _08008674 + .align 2, 0 + .pool +_08008668: + adds r0, r1, 0x1 + lsls r0, 24 + lsrs r1, r0, 24 + cmp r1, 0x3F + bls _08008656 + movs r0, 0xFF +_08008674: + pop {r1} + bx r1 + thumb_func_end gpu_tile_obj_tag_index_of + + thumb_func_start gpu_tile_obj_tag_get_by_range_start +gpu_tile_obj_tag_get_by_range_start: @ 8008678 + push {r4-r6,lr} + lsls r0, 16 + lsrs r3, r0, 16 + movs r2, 0 + ldr r6, =0x030009f0 + ldr r5, =0x0000ffff + ldr r4, =0x03000a70 +_08008686: + lsls r0, r2, 1 + adds r1, r0, r6 + ldrh r0, [r1] + cmp r0, r5 + beq _080086AC + lsls r0, r2, 2 + adds r0, r4 + ldrh r0, [r0] + cmp r0, r3 + bne _080086AC + ldrh r0, [r1] + b _080086B8 + .align 2, 0 + .pool +_080086AC: + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0x3F + bls _08008686 + ldr r0, =0x0000ffff +_080086B8: + pop {r4-r6} + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end gpu_tile_obj_tag_get_by_range_start + + thumb_func_start gpu_tile_obj_tag_add +gpu_tile_obj_tag_add: @ 80086C4 + push {r4-r6,lr} + adds r4, r0, 0 + adds r5, r1, 0 + adds r6, r2, 0 + lsls r4, 16 + lsrs r4, 16 + lsls r5, 16 + lsrs r5, 16 + lsls r6, 16 + lsrs r6, 16 + ldr r0, =0x0000ffff + bl gpu_tile_obj_tag_index_of + lsls r0, 24 + lsrs r0, 24 + ldr r2, =0x030009f0 + lsls r1, r0, 1 + adds r1, r2 + strh r4, [r1] + ldr r1, =0x03000a70 + lsls r0, 2 + adds r2, r0, r1 + strh r5, [r2] + adds r1, 0x2 + adds r0, r1 + strh r6, [r0] + pop {r4-r6} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end gpu_tile_obj_tag_add + + thumb_func_start gpu_pal_allocator_reset +gpu_pal_allocator_reset: @ 800870C + push {r4,lr} + ldr r1, =0x0300301c + movs r0, 0 + strb r0, [r1] + movs r2, 0 + ldr r4, =0x03000cf0 + ldr r0, =0x0000ffff + adds r3, r0, 0 +_0800871C: + lsls r0, r2, 1 + adds r0, r4 + ldrh r1, [r0] + orrs r1, r3 + strh r1, [r0] + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0xF + bls _0800871C + pop {r4} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end gpu_pal_allocator_reset + + thumb_func_start gpu_pal_obj_alloc_tag_and_apply +gpu_pal_obj_alloc_tag_and_apply: @ 8008744 + push {r4,r5,lr} + adds r5, r0, 0 + ldrh r0, [r5, 0x4] + bl gpu_pal_tags_index_of + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0xFF + beq _0800875A + adds r0, r4, 0 + b _0800878A +_0800875A: + ldr r0, =0x0000ffff + bl gpu_pal_tags_index_of + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0xFF + beq _08008788 + ldr r1, =0x03000cf0 + lsls r0, r4, 1 + adds r0, r1 + ldrh r1, [r5, 0x4] + strh r1, [r0] + ldr r0, [r5] + lsls r1, r4, 4 + bl gpu_pal_obj_load + adds r0, r4, 0 + b _0800878A + .align 2, 0 + .pool +_08008788: + movs r0, 0xFF +_0800878A: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end gpu_pal_obj_alloc_tag_and_apply + + thumb_func_start gpu_pal_obj_alloc_and_load_multiple +gpu_pal_obj_alloc_and_load_multiple: @ 8008790 + push {r4,r5,lr} + adds r5, r0, 0 + movs r4, 0 + b _0800879E +_08008798: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 +_0800879E: + lsls r0, r4, 3 + adds r1, r0, r5 + ldr r0, [r1] + cmp r0, 0 + beq _080087B6 + adds r0, r1, 0 + bl gpu_pal_obj_alloc_tag_and_apply + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0xFF + bne _08008798 +_080087B6: + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end gpu_pal_obj_alloc_and_load_multiple + + thumb_func_start gpu_pal_obj_load +gpu_pal_obj_load: @ 80087BC + push {lr} + lsls r1, 16 + movs r2, 0x80 + lsls r2, 17 + adds r1, r2 + lsrs r1, 16 + movs r2, 0x20 + bl gpu_pal_apply + pop {r0} + bx r0 + thumb_func_end gpu_pal_obj_load + + thumb_func_start gpu_pal_alloc_new +gpu_pal_alloc_new: @ 80087D4 + push {r4,lr} + lsls r0, 16 + lsrs r4, r0, 16 + ldr r0, =0x0000ffff + bl gpu_pal_tags_index_of + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0xFF + beq _080087FC + ldr r1, =0x03000cf0 + lsls r0, r2, 1 + adds r0, r1 + strh r4, [r0] + adds r0, r2, 0 + b _080087FE + .align 2, 0 + .pool +_080087FC: + movs r0, 0xFF +_080087FE: + pop {r4} + pop {r1} + bx r1 + thumb_func_end gpu_pal_alloc_new + + thumb_func_start gpu_pal_tags_index_of +gpu_pal_tags_index_of: @ 8008804 + push {lr} + lsls r0, 16 + lsrs r2, r0, 16 + ldr r0, =0x0300301c + ldrb r1, [r0] + cmp r1, 0xF + bhi _08008836 + ldr r3, =0x03000cf0 +_08008814: + lsls r0, r1, 1 + adds r0, r3 + ldrh r0, [r0] + cmp r0, r2 + bne _0800882C + adds r0, r1, 0 + b _08008838 + .align 2, 0 + .pool +_0800882C: + adds r0, r1, 0x1 + lsls r0, 24 + lsrs r1, r0, 24 + cmp r1, 0xF + bls _08008814 +_08008836: + movs r0, 0xFF +_08008838: + pop {r1} + bx r1 + thumb_func_end gpu_pal_tags_index_of + + thumb_func_start gpu_pal_tag_by_index +gpu_pal_tag_by_index: @ 800883C + lsls r0, 24 + ldr r1, =0x03000cf0 + lsrs r0, 23 + adds r0, r1 + ldrh r0, [r0] + bx lr + .align 2, 0 + .pool + thumb_func_end gpu_pal_tag_by_index + + thumb_func_start gpu_pal_free_tag +gpu_pal_free_tag: @ 800884C + push {lr} + lsls r0, 16 + lsrs r0, 16 + bl gpu_pal_tags_index_of + lsls r0, 24 + lsrs r1, r0, 24 + cmp r1, 0xFF + beq _08008868 + ldr r0, =0x03000cf0 + lsls r1, 1 + adds r1, r0 + ldr r0, =0x0000ffff + strh r0, [r1] +_08008868: + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end gpu_pal_free_tag + + thumb_func_start obj_set_f18_to_r0_f42_to_40 +obj_set_f18_to_r0_f42_to_40: @ 8008874 + str r1, [r0, 0x18] + adds r0, 0x42 + movs r1, 0x40 + strb r1, [r0] + bx lr + thumb_func_end obj_set_f18_to_r0_f42_to_40 + + thumb_func_start super_sprite_add +super_sprite_add: @ 8008880 + push {r4,lr} + adds r4, r0, 0 + adds r3, r1, 0 + ldr r1, =0x02021b38 + ldrb r0, [r3] + ldrb r1, [r1] + cmp r0, r1 + bcc _08008898 + movs r0, 0x1 + b _080088E0 + .align 2, 0 + .pool +_08008898: + ldr r0, [r4, 0x18] + cmp r0, 0 + beq _080088AC + adds r0, r4, 0 + adds r0, 0x42 + ldrb r1, [r0] + movs r0, 0xC0 + ands r0, r1 + cmp r0, 0 + bne _080088CC +_080088AC: + ldr r0, =0x030022c0 + ldrb r2, [r3] + lsls r2, 3 + adds r0, 0x38 + adds r2, r0 + ldr r0, [r4] + ldr r1, [r4, 0x4] + str r0, [r2] + str r1, [r2, 0x4] + ldrb r0, [r3] + adds r0, 0x1 + strb r0, [r3] + movs r0, 0 + b _080088E0 + .align 2, 0 + .pool +_080088CC: + ldrb r1, [r3] + lsls r1, 3 + ldr r0, =0x030022f8 + adds r1, r0 + adds r0, r4, 0 + adds r2, r3, 0 + bl sub_80088EC + lsls r0, 24 + lsrs r0, 24 +_080088E0: + pop {r4} + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end super_sprite_add + + thumb_func_start sub_80088EC +sub_80088EC: @ 80088EC + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x1C + adds r3, r0, 0 + str r1, [sp] + mov r8, r2 + ldr r0, =0x02021b38 + ldrb r1, [r2] + ldrb r0, [r0] + cmp r1, r0 + bcc _08008910 +_08008908: + movs r0, 0x1 + b _08008AE6 + .align 2, 0 + .pool +_08008910: + adds r0, r3, 0 + adds r0, 0x42 + ldrb r1, [r0] + lsls r1, 26 + lsrs r1, 23 + ldr r2, [r3, 0x18] + adds r7, r2, r1 + mov r12, r3 + str r0, [sp, 0x18] + cmp r7, 0 + beq _0800892C + ldr r0, [r7, 0x4] + cmp r0, 0 + bne _08008942 +_0800892C: + mov r2, r12 + ldr r0, [r2] + ldr r1, [r2, 0x4] + ldr r2, [sp] + str r0, [r2] + str r1, [r2, 0x4] + mov r1, r8 + ldrb r0, [r1] + adds r0, 0x1 + strb r0, [r1] + b _08008AE4 +_08008942: + mov r2, r12 + ldrh r0, [r2, 0x4] + lsls r0, 22 + lsrs r0, 22 + str r0, [sp, 0x4] + ldrb r0, [r7] + str r0, [sp, 0xC] + ldrb r0, [r2, 0x3] + lsls r0, 26 + lsrs r0, 27 + asrs r1, r0, 3 + str r1, [sp, 0x10] + movs r1, 0x1 + ldr r2, [sp, 0x10] + ands r2, r1 + str r2, [sp, 0x10] + asrs r0, 4 + mov r10, r0 + ands r0, r1 + mov r10, r0 + mov r1, r12 + ldrh r0, [r1, 0x2] + lsls r0, 23 + lsrs r0, 23 + adds r1, 0x28 + ldrb r1, [r1] + lsls r1, 24 + asrs r1, 24 + subs r0, r1 + lsls r0, 16 + lsrs r2, r0, 16 + mov r1, r12 + ldrb r0, [r1] + adds r1, 0x29 + ldrb r1, [r1] + lsls r1, 24 + asrs r1, 24 + subs r0, r1 + lsls r0, 16 + lsrs r0, 16 + str r0, [sp, 0x8] + movs r0, 0 + mov r9, r0 + ldr r1, [sp, 0xC] + cmp r9, r1 + bcc _080089A0 + b _08008AE4 +_080089A0: + lsls r0, r2, 16 + asrs r0, 16 + str r0, [sp, 0x14] +_080089A6: + mov r2, r8 + ldrb r0, [r2] + ldr r1, =0x02021b38 + ldrb r1, [r1] + cmp r0, r1 + bcs _08008908 + ldr r0, [r7, 0x4] + mov r2, r9 + lsls r6, r2, 2 + adds r2, r6, r0 + movs r0, 0 + ldrsb r0, [r2, r0] + lsls r0, 16 + lsrs r4, r0, 16 + movs r0, 0x1 + ldrsb r0, [r2, r0] + lsls r0, 16 + lsrs r5, r0, 16 + ldr r0, [sp, 0x10] + cmp r0, 0 + beq _080089FC + ldr r0, [r2] + lsls r1, r0, 12 + lsrs r1, 30 + lsls r1, 2 + lsls r0, 14 + lsrs r0, 30 + lsls r0, 4 + adds r1, r0 + ldr r0, =0x082ec754 + adds r1, r0 + ldrb r1, [r1] + lsls r1, 24 + asrs r1, 24 + lsls r0, r4, 16 + asrs r0, 16 + adds r0, r1 + lsls r0, 16 + lsrs r4, r0, 16 + mvns r0, r4 + adds r0, 0x1 + lsls r0, 16 + lsrs r4, r0, 16 +_080089FC: + mov r1, r10 + cmp r1, 0 + beq _08008A2E + ldr r0, [r2] + lsls r1, r0, 12 + lsrs r1, 30 + lsls r1, 2 + lsls r0, 14 + lsrs r0, 30 + lsls r0, 4 + adds r1, r0 + ldr r2, =0x082ec754 + adds r1, r2 + ldrb r1, [r1, 0x1] + lsls r1, 24 + asrs r1, 24 + lsls r0, r5, 16 + asrs r0, 16 + adds r0, r1 + lsls r0, 16 + lsrs r5, r0, 16 + mvns r0, r5 + adds r0, 0x1 + lsls r0, 16 + lsrs r5, r0, 16 +_08008A2E: + mov r1, r9 + lsls r0, r1, 3 + ldr r2, [sp] + adds r3, r0, r2 + mov r2, r12 + ldr r0, [r2] + ldr r1, [r2, 0x4] + str r0, [r3] + str r1, [r3, 0x4] + ldr r0, [r7, 0x4] + adds r0, r6, r0 + ldr r1, [r0] + lsls r1, 14 + lsrs r1, 30 + lsls r1, 6 + ldrb r2, [r3, 0x1] + movs r0, 0x3F + ands r0, r2 + orrs r0, r1 + strb r0, [r3, 0x1] + ldr r0, [r7, 0x4] + adds r0, r6, r0 + ldr r1, [r0] + lsls r1, 12 + lsrs r1, 30 + lsls r1, 6 + ldrb r2, [r3, 0x3] + movs r0, 0x3F + ands r0, r2 + orrs r0, r1 + strb r0, [r3, 0x3] + lsls r1, r4, 16 + asrs r1, 16 + ldr r0, [sp, 0x14] + adds r1, r0, r1 + ldr r2, =0x000001ff + adds r0, r2, 0 + ands r1, r0 + ldrh r2, [r3, 0x2] + ldr r0, =0xfffffe00 + ands r0, r2 + orrs r0, r1 + strh r0, [r3, 0x2] + ldr r1, [sp, 0x8] + adds r0, r1, r5 + strb r0, [r3] + ldr r0, [r7, 0x4] + adds r0, r6, r0 + ldr r1, [r0] + lsls r1, 2 + lsrs r1, 22 + ldr r2, [sp, 0x4] + adds r1, r2, r1 + ldr r2, =0x000003ff + adds r0, r2, 0 + ands r1, r0 + ldrh r2, [r3, 0x4] + ldr r0, =0xfffffc00 + ands r0, r2 + orrs r0, r1 + strh r0, [r3, 0x4] + ldr r0, [sp, 0x18] + ldrb r1, [r0] + movs r0, 0xC0 + ands r0, r1 + cmp r0, 0x80 + beq _08008ACA + ldr r0, [r7, 0x4] + adds r0, r6, r0 + ldr r1, [r0] + lsrs r1, 30 + lsls r1, 2 + ldrb r2, [r3, 0x5] + movs r0, 0xD + negs r0, r0 + ands r0, r2 + orrs r0, r1 + strb r0, [r3, 0x5] +_08008ACA: + mov r0, r9 + adds r0, 0x1 + lsls r0, 24 + lsrs r0, 24 + mov r9, r0 + mov r1, r8 + ldrb r0, [r1] + adds r0, 0x1 + strb r0, [r1] + ldr r2, [sp, 0xC] + cmp r9, r2 + bcs _08008AE4 + b _080089A6 +_08008AE4: + movs r0, 0 +_08008AE6: + add sp, 0x1C + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end sub_80088EC diff --git a/asm/gpu_reg_manager.s b/asm/gpu_reg_manager.s new file mode 100644 index 000000000..13f4bc528 --- /dev/null +++ b/asm/gpu_reg_manager.s @@ -0,0 +1,414 @@ + thumb_func_start lcd_io_copy_queue_clean +lcd_io_copy_queue_clean: @ 8000FE4 + push {r4-r7,lr} + mov r7, r8 + push {r7} + movs r2, 0 + ldr r7, =0x030008d8 + ldr r0, =0x030008d9 + mov r12, r0 + ldr r1, =0x030008da + mov r8, r1 + ldr r6, =0x03000818 + movs r5, 0 + ldr r4, =0x03000878 + movs r3, 0xFF +_08000FFE: + adds r0, r2, r6 + strb r5, [r0] + adds r1, r2, r4 + ldrb r0, [r1] + orrs r0, r3 + strb r0, [r1] + adds r2, 0x1 + cmp r2, 0x5F + ble _08000FFE + movs r0, 0 + strb r0, [r7] + mov r1, r12 + strb r0, [r1] + movs r0, 0 + mov r1, r8 + strh r0, [r1] + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end lcd_io_copy_queue_clean + + thumb_func_start lcd_io_buffer_to_hardware +lcd_io_buffer_to_hardware: @ 800103C + push {lr} + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0x4 + bne _08001068 + ldr r2, =0x04000004 + ldrh r1, [r2] + ldr r0, =0x0000ffe7 + ands r0, r1 + strh r0, [r2] + ldr r1, =0x0300081c + ldrh r0, [r2] + ldrh r1, [r1] + orrs r0, r1 + strh r0, [r2] + b _08001076 + .align 2, 0 + .pool +_08001068: + movs r0, 0x80 + lsls r0, 19 + adds r0, r2, r0 + ldr r1, =0x03000818 + adds r1, r2, r1 + ldrh r1, [r1] + strh r1, [r0] +_08001076: + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end lcd_io_buffer_to_hardware + + thumb_func_start lcd_io_copy_queue_process +lcd_io_copy_queue_process: @ 8001080 + push {r4,r5,lr} + ldr r0, =0x030008d8 + ldrb r0, [r0] + cmp r0, 0 + bne _080010A4 + movs r5, 0 +_0800108C: + ldr r0, =0x03000878 + adds r4, r5, r0 + ldrb r0, [r4] + cmp r0, 0xFF + beq _080010A4 + bl lcd_io_buffer_to_hardware + movs r0, 0xFF + strb r0, [r4] + adds r5, 0x1 + cmp r5, 0x5F + ble _0800108C +_080010A4: + pop {r4,r5} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end lcd_io_copy_queue_process + + thumb_func_start lcd_io_set +lcd_io_set: @ 80010B4 + push {r4,r5,lr} + lsls r0, 24 + lsrs r4, r0, 24 + lsls r1, 16 + lsrs r1, 16 + cmp r4, 0x5F + bhi _08001130 + ldr r0, =0x03000818 + adds r0, r4, r0 + strh r1, [r0] + ldr r0, =0x04000006 + ldrh r1, [r0] + movs r0, 0xFF + ands r0, r1 + subs r0, 0xA1 + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x40 + bls _080010E8 + movs r0, 0x80 + lsls r0, 19 + ldrh r1, [r0] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + beq _080010FE +_080010E8: + adds r0, r4, 0 + bl lcd_io_buffer_to_hardware + b _08001130 + .align 2, 0 + .pool +_080010F8: + movs r0, 0 + strb r0, [r5] + b _08001130 +_080010FE: + ldr r2, =0x030008d8 + movs r0, 0x1 + strb r0, [r2] + movs r3, 0 + ldr r0, =0x03000878 + ldrb r1, [r0] + adds r5, r2, 0 + adds r2, r0, 0 + cmp r1, 0xFF + beq _08001128 + adds r1, r2, 0 +_08001114: + ldrb r0, [r1] + cmp r0, r4 + beq _080010F8 + adds r1, 0x1 + adds r3, 0x1 + cmp r3, 0x5F + bgt _08001128 + ldrb r0, [r1] + cmp r0, 0xFF + bne _08001114 +_08001128: + adds r0, r3, r2 + movs r1, 0 + strb r4, [r0] + strb r1, [r5] +_08001130: + pop {r4,r5} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end lcd_io_set + + thumb_func_start lcd_io_set_forced_blank +lcd_io_set_forced_blank: @ 8001140 + push {r4,r5,lr} + lsls r0, 24 + lsrs r4, r0, 24 + lsls r1, 16 + lsrs r1, 16 + cmp r4, 0x5F + bhi _080011A8 + ldr r0, =0x03000818 + adds r0, r4, r0 + strh r1, [r0] + movs r0, 0x80 + lsls r0, 19 + ldrh r1, [r0] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + beq _08001176 + adds r0, r4, 0 + bl lcd_io_buffer_to_hardware + b _080011A8 + .align 2, 0 + .pool +_08001170: + movs r0, 0 + strb r0, [r5] + b _080011A8 +_08001176: + ldr r2, =0x030008d8 + movs r0, 0x1 + strb r0, [r2] + movs r3, 0 + ldr r0, =0x03000878 + ldrb r1, [r0] + adds r5, r2, 0 + adds r2, r0, 0 + cmp r1, 0xFF + beq _080011A0 + adds r1, r2, 0 +_0800118C: + ldrb r0, [r1] + cmp r0, r4 + beq _08001170 + adds r1, 0x1 + adds r3, 0x1 + cmp r3, 0x5F + bgt _080011A0 + ldrb r0, [r1] + cmp r0, 0xFF + bne _0800118C +_080011A0: + adds r0, r3, r2 + movs r1, 0 + strb r4, [r0] + strb r1, [r5] +_080011A8: + pop {r4,r5} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end lcd_io_set_forced_blank + + thumb_func_start lcd_io_get +lcd_io_get: @ 80011B8 + push {lr} + lsls r0, 24 + lsrs r0, 24 + adds r1, r0, 0 + cmp r1, 0x4 + bne _080011CC + ldr r0, =0x04000004 + b _080011DE + .align 2, 0 + .pool +_080011CC: + cmp r1, 0x6 + beq _080011DC + ldr r0, =0x03000818 + adds r0, r1, r0 + ldrh r0, [r0] + b _080011E0 + .align 2, 0 + .pool +_080011DC: + ldr r0, =0x04000006 +_080011DE: + ldrh r0, [r0] +_080011E0: + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end lcd_io_get + + thumb_func_start lcd_io_set_bits +lcd_io_set_bits: @ 80011E8 + push {lr} + adds r2, r1, 0 + lsls r0, 24 + lsrs r0, 24 + ldr r1, =0x03000818 + adds r1, r0, r1 + ldrh r1, [r1] + orrs r1, r2 + lsls r1, 16 + lsrs r1, 16 + bl lcd_io_set + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end lcd_io_set_bits + + thumb_func_start lcd_io_clear_bits +lcd_io_clear_bits: @ 8001208 + push {lr} + adds r2, r1, 0 + lsls r0, 24 + lsrs r0, 24 + lsls r2, 16 + ldr r1, =0x03000818 + adds r1, r0, r1 + ldrh r1, [r1] + lsrs r2, 16 + bics r1, r2 + bl lcd_io_set + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end lcd_io_clear_bits + + thumb_func_start update_hardware_IE +update_hardware_IE: @ 8001228 + push {r4,r5,lr} + ldr r5, =0x030008d9 + ldrb r0, [r5] + cmp r0, 0 + beq _08001246 + ldr r2, =0x04000208 + ldrh r1, [r2] + movs r4, 0 + strh r4, [r2] + ldr r3, =0x04000200 + ldr r0, =0x030008da + ldrh r0, [r0] + strh r0, [r3] + strh r1, [r2] + strb r4, [r5] +_08001246: + pop {r4,r5} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end update_hardware_IE + + thumb_func_start enable_irqs +enable_irqs: @ 800125C + push {r4,lr} + lsls r0, 16 + lsrs r0, 16 + ldr r4, =0x030008da + ldrh r1, [r4] + orrs r0, r1 + strh r0, [r4] + ldr r1, =0x030008d9 + movs r0, 0x1 + strb r0, [r1] + bl update_hardware_IE + ldrh r0, [r4] + bl dispstat_set_vblank_hblank_irqs + pop {r4} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end enable_irqs + + thumb_func_start disable_irqs +disable_irqs: @ 8001288 + push {r4,lr} + lsls r0, 16 + lsrs r0, 16 + ldr r4, =0x030008da + ldrh r1, [r4] + bics r1, r0 + strh r1, [r4] + ldr r1, =0x030008d9 + movs r0, 0x1 + strb r0, [r1] + bl update_hardware_IE + ldrh r0, [r4] + bl dispstat_set_vblank_hblank_irqs + pop {r4} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end disable_irqs + + thumb_func_start dispstat_set_vblank_hblank_irqs +dispstat_set_vblank_hblank_irqs: @ 80012B4 + push {r4,lr} + adds r4, r0, 0 + lsls r4, 16 + lsrs r4, 16 + movs r0, 0x4 + bl lcd_io_get + movs r2, 0x18 + ands r2, r0 + movs r1, 0x1 + ands r1, r4 + negs r0, r1 + orrs r0, r1 + asrs r1, r0, 31 + movs r0, 0x8 + ands r1, r0 + movs r0, 0x2 + ands r0, r4 + cmp r0, 0 + beq _080012E0 + movs r0, 0x10 + orrs r1, r0 +_080012E0: + cmp r2, r1 + beq _080012EA + movs r0, 0x4 + bl lcd_io_set +_080012EA: + pop {r4} + pop {r0} + bx r0 + thumb_func_end dispstat_set_vblank_hblank_irqs diff --git a/asm/main.s b/asm/main.s new file mode 100644 index 000000000..b16d392ab --- /dev/null +++ b/asm/main.s @@ -0,0 +1,717 @@ + thumb_func_start Main +Main: + push {r4-r7,lr} + mov r7, r8 + push {r7} + movs r0, 0xFF + bl RegisterRamReset + movs r1, 0xA0 + lsls r1, 19 + ldr r2, =0x00007fff + adds r0, r2, 0 + strh r0, [r1] + bl lcd_io_copy_queue_clean + ldr r1, =0x04000204 + ldr r3, =0x00004014 + adds r0, r3, 0 + strh r0, [r1] + bl init_keypad_data + bl init_irq_handler + bl m4aSoundInit + bl lcd_enable_vcount_irq_at_150px + bl sub_800E6D0 + bl sub_802F21C + bl flash_timeout_start_on_timer_2_when_flash_present + bl init_saveblock_ptrs_and_set_copyright_callback2 + bl sound_sources_off + bl dma3_transfer_queue_clear + bl gpu_init_bgs + bl fboxes_set_default_ptr + ldr r0, =0x02000000 + movs r1, 0xE0 + lsls r1, 9 + bl init_malloc + ldr r0, =0x03002700 + movs r4, 0 + strb r4, [r0] + ldr r0, =0x03005d88 + ldr r0, [r0] + cmp r0, 0x1 + beq _08000414 + movs r0, 0 + bl set_callback2 +_08000414: + ldr r2, =0x030022b4 + strb r4, [r2] + ldr r1, =0x03000000 + movs r3, 0xFC + lsls r3, 4 + adds r0, r3, 0 + strh r0, [r1] + ldr r7, =0x030022c0 + movs r0, 0 + mov r8, r0 + adds r6, r2, 0 +_0800042A: + bl load_keys + ldr r0, =0x03002700 + ldrb r0, [r0] + cmp r0, 0 + bne _08000454 + ldrh r1, [r7, 0x28] + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + beq _08000454 + movs r0, 0xE + ands r0, r1 + cmp r0, 0xE + bne _08000454 + bl rfu_REQ_stopMode + bl rfu_waitREQComplete + bl do_reset +_08000454: + bl sub_8087634 + cmp r0, 0x1 + bne _0800048C + strb r0, [r6] + bl call_callbacks_wrapper + movs r0, 0 + strb r0, [r6] + b _080004B2 + .align 2, 0 + .pool +_0800048C: + ldr r5, =0x030022b4 + movs r0, 0 + strb r0, [r5] + bl call_callbacks_wrapper + bl sub_80875C8 + adds r4, r0, 0 + cmp r4, 0x1 + bne _080004B2 + movs r0, 0 + strh r0, [r7, 0x2E] + bl copy_queue_clear + strb r4, [r5] + bl call_callbacks_wrapper + mov r2, r8 + strb r2, [r5] +_080004B2: + bl gametime_increment + bl sound_something + bl wait_for_vblank + b _0800042A + .align 2, 0 + .pool + thumb_func_end Main + + thumb_func_start call_callbacks_wrapper +call_callbacks_wrapper: @ 80004C4 + push {lr} + bl sub_800B40C + lsls r0, 24 + cmp r0, 0 + bne _080004D4 + bl call_callbacks +_080004D4: + pop {r0} + bx r0 + thumb_func_end call_callbacks_wrapper + + thumb_func_start init_saveblock_ptrs_and_set_copyright_callback2 +init_saveblock_ptrs_and_set_copyright_callback2: @ 80004D8 + push {lr} + ldr r2, =0x030022c0 + movs r0, 0 + str r0, [r2, 0x20] + ldr r1, =0x0203cf5c + str r0, [r1] + str r0, [r2, 0x24] + str r0, [r2] + ldr r0, =c2_copyright_1 + 1 + bl set_callback2 + ldr r1, =0x03005d90 + ldr r0, =0x02024a54 + str r0, [r1] + ldr r1, =0x03005d94 + ldr r0, =0x02029808 + str r0, [r1] + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end init_saveblock_ptrs_and_set_copyright_callback2 + + thumb_func_start call_callbacks +call_callbacks: @ 800051C + push {r4,lr} + ldr r4, =0x030022c0 + ldr r0, [r4] + cmp r0, 0 + beq _0800052A + bl _call_via_r0 +_0800052A: + ldr r0, [r4, 0x4] + cmp r0, 0 + beq _08000534 + bl _call_via_r0 +_08000534: + pop {r4} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end call_callbacks + + thumb_func_start set_callback2 +set_callback2: @ 8000540 + ldr r1, =0x030022c0 + str r0, [r1, 0x4] + movs r0, 0x87 + lsls r0, 3 + adds r1, r0 + movs r0, 0 + strb r0, [r1] + bx lr + .align 2, 0 + .pool + thumb_func_end set_callback2 + + thumb_func_start start_timer1 +start_timer1: @ 8000554 + ldr r1, =0x04000106 + movs r0, 0x80 + strh r0, [r1] + bx lr + .align 2, 0 + .pool + thumb_func_end start_timer1 + + thumb_func_start set_rand_seed_and_trainer_id_hi +set_rand_seed_and_trainer_id_hi: @ 8000560 + push {r4,lr} + ldr r0, =0x04000104 + ldrh r4, [r0] + adds r0, r4, 0 + bl SeedRng + ldr r1, =0x04000106 + movs r0, 0 + strh r0, [r1] + ldr r0, =0x02020000 + strh r4, [r0] + pop {r4} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end set_rand_seed_and_trainer_id_hi + + thumb_func_start get_trainer_id_hi +get_trainer_id_hi: @ 8000588 + ldr r0, =0x02020000 + ldrh r0, [r0] + bx lr + .align 2, 0 + .pool + thumb_func_end get_trainer_id_hi + + thumb_func_start lcd_enable_vcount_irq_at_150px +lcd_enable_vcount_irq_at_150px: @ 8000594 + push {lr} + movs r0, 0x4 + bl lcd_io_get + movs r1, 0xFF + ands r1, r0 + movs r2, 0x96 + lsls r2, 8 + adds r0, r2, 0 + orrs r1, r0 + movs r0, 0x20 + orrs r1, r0 + movs r0, 0x4 + bl lcd_io_set + movs r0, 0x4 + bl enable_irqs + pop {r0} + bx r0 + thumb_func_end lcd_enable_vcount_irq_at_150px + + thumb_func_start init_keypad_data +init_keypad_data: @ 80005BC + ldr r1, =0x030026fc + movs r0, 0x5 + strh r0, [r1] + ldr r1, =0x030022b0 + movs r0, 0x28 + strh r0, [r1] + ldr r1, =0x030022c0 + movs r0, 0 + strh r0, [r1, 0x2C] + strh r0, [r1, 0x2E] + strh r0, [r1, 0x30] + strh r0, [r1, 0x28] + strh r0, [r1, 0x2A] + bx lr + .align 2, 0 + .pool + thumb_func_end init_keypad_data + + thumb_func_start load_keys +load_keys: @ 80005E4 + push {lr} + ldr r0, =0x04000130 + ldrh r1, [r0] + ldr r2, =0x000003ff + adds r0, r2, 0 + adds r3, r0, 0 + eors r3, r1 + ldr r1, =0x030022c0 + ldrh r2, [r1, 0x28] + adds r0, r3, 0 + bics r0, r2 + strh r0, [r1, 0x2A] + strh r0, [r1, 0x2E] + strh r0, [r1, 0x30] + adds r2, r1, 0 + cmp r3, 0 + beq _08000630 + ldrh r0, [r2, 0x2C] + cmp r0, r3 + bne _08000630 + ldrh r0, [r2, 0x32] + subs r0, 0x1 + strh r0, [r2, 0x32] + lsls r0, 16 + cmp r0, 0 + bne _08000636 + strh r3, [r2, 0x30] + ldr r0, =0x030026fc + b _08000632 + .align 2, 0 + .pool +_08000630: + ldr r0, =0x030022b0 +_08000632: + ldrh r0, [r0] + strh r0, [r2, 0x32] +_08000636: + strh r3, [r2, 0x28] + strh r3, [r2, 0x2C] + ldr r0, =0x03005d90 + ldr r0, [r0] + ldrb r0, [r0, 0x13] + cmp r0, 0x2 + bne _08000668 + ldrh r1, [r2, 0x2E] + movs r3, 0x80 + lsls r3, 2 + adds r0, r3, 0 + ands r0, r1 + cmp r0, 0 + beq _08000658 + movs r0, 0x1 + orrs r0, r1 + strh r0, [r2, 0x2E] +_08000658: + ldrh r1, [r2, 0x2C] + adds r0, r3, 0 + ands r0, r1 + cmp r0, 0 + beq _08000668 + movs r0, 0x1 + orrs r0, r1 + strh r0, [r2, 0x2C] +_08000668: + ldrh r1, [r2, 0x2E] + ldrh r0, [r2, 0x36] + ands r0, r1 + cmp r0, 0 + beq _08000676 + movs r0, 0x1 + strh r0, [r2, 0x34] +_08000676: + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end load_keys + + thumb_func_start init_irq_handler +init_irq_handler: @ 8000684 + push {r4,r5,lr} + ldr r5, =InterruptMain + ldr r4, =0x03002750 + ldr r3, =0x082e9548 + ldr r2, =0x03002710 + movs r1, 0xD +_08000690: + ldm r3!, {r0} + stm r2!, {r0} + subs r1, 0x1 + cmp r1, 0 + bge _08000690 + ldr r0, =0x040000d4 + str r5, [r0] + str r4, [r0, 0x4] + ldr r1, =0x84000200 + str r1, [r0, 0x8] + ldr r0, [r0, 0x8] + ldr r0, =0x03007ffc + str r4, [r0] + movs r0, 0 + bl SetVBlankCallback + movs r0, 0 + bl SetHBlankCallback + movs r0, 0 + bl set_serial_callback + ldr r1, =0x04000208 + movs r0, 0x1 + strh r0, [r1] + movs r0, 0x1 + bl enable_irqs + pop {r4,r5} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end init_irq_handler + + thumb_func_start SetVBlankCallback +SetVBlankCallback: @ 80006F0 + ldr r1, =0x030022c0 + str r0, [r1, 0xC] + bx lr + .align 2, 0 + .pool + thumb_func_end SetVBlankCallback + + thumb_func_start SetHBlankCallback +SetHBlankCallback: @ 80006FC + ldr r1, =0x030022c0 + str r0, [r1, 0x10] + bx lr + .align 2, 0 + .pool + thumb_func_end SetHBlankCallback + + thumb_func_start SetVCountCallback +SetVCountCallback: @ 8000708 + ldr r1, =0x030022c0 + str r0, [r1, 0x14] + bx lr + .align 2, 0 + .pool + thumb_func_end SetVCountCallback + + thumb_func_start restore_serial_timer3_irq_handlers +restore_serial_timer3_irq_handlers: @ 8000714 + ldr r0, =0x03002710 + ldr r1, =irq_serial + 1 + str r1, [r0, 0x4] + ldr r1, =irq_timer3 + 1 + str r1, [r0, 0x8] + bx lr + .align 2, 0 + .pool + thumb_func_end restore_serial_timer3_irq_handlers + + thumb_func_start set_serial_callback +set_serial_callback: @ 800072C + ldr r1, =0x030022c0 + str r0, [r1, 0x18] + bx lr + .align 2, 0 + .pool + thumb_func_end set_serial_callback + + thumb_func_start irq_vblank +irq_vblank: @ 8000738 + push {r4,lr} + ldr r0, =0x030030fc + ldrb r0, [r0] + cmp r0, 0 + beq _0800074C + bl rfu_syncVBlank__ + b _08000758 + .align 2, 0 + .pool +_0800074C: + ldr r0, =0x03002748 + ldrb r0, [r0] + cmp r0, 0 + bne _08000758 + bl sub_800B9B8 +_08000758: + ldr r0, =0x030022c0 + ldr r1, [r0, 0x20] + adds r1, 0x1 + str r1, [r0, 0x20] + ldr r1, =0x0203cf5c + ldr r1, [r1] + adds r4, r0, 0 + cmp r1, 0 + beq _08000778 + ldr r2, [r1] + movs r0, 0x2 + negs r0, r0 + cmp r2, r0 + bhi _08000778 + adds r0, r2, 0x1 + str r0, [r1] +_08000778: + ldr r0, [r4, 0xC] + cmp r0, 0 + beq _08000782 + bl _call_via_r0 +_08000782: + ldr r0, [r4, 0x24] + adds r0, 0x1 + str r0, [r4, 0x24] + bl lcd_io_copy_queue_process + bl dma_transfer_queue_process + ldr r1, =0x03002f50 + ldr r0, =0x03006380 + ldrb r0, [r0, 0x4] + strb r0, [r1] + bl m4aSoundMain + bl sub_8033648 + ldr r1, =0x00000439 + adds r0, r4, r1 + ldrb r1, [r0] + movs r0, 0x2 + ands r0, r1 + cmp r0, 0 + beq _080007BA + ldr r0, =0x02022fec + ldr r0, [r0] + ldr r1, =0x013f0102 + ands r0, r1 + cmp r0, 0 + bne _080007BE +_080007BA: + bl GenerateRandomNumber +_080007BE: + bl sub_800E174 + ldr r2, =0x03007ff8 + ldrh r0, [r2] + movs r1, 0x1 + orrs r0, r1 + strh r0, [r2] + ldr r0, =0x030022c0 + ldrh r2, [r0, 0x1C] + ldrh r3, [r0, 0x1C] + orrs r1, r2 + strh r1, [r0, 0x1C] + pop {r4} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end irq_vblank + + thumb_func_start flash_timeout_start_on_timer_2 +flash_timeout_start_on_timer_2: @ 8000800 + push {lr} + ldr r1, =0x0300272c + movs r0, 0x2 + bl SetFlashTimerIntr + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end flash_timeout_start_on_timer_2 + + thumb_func_start irq_hblank +irq_hblank: @ 8000814 + push {r4,lr} + ldr r4, =0x030022c0 + ldr r0, [r4, 0x10] + cmp r0, 0 + beq _08000822 + bl _call_via_r0 +_08000822: + ldr r2, =0x03007ff8 + ldrh r0, [r2] + movs r1, 0x2 + orrs r0, r1 + strh r0, [r2] + ldrh r0, [r4, 0x1C] + ldrh r2, [r4, 0x1C] + orrs r1, r0 + strh r1, [r4, 0x1C] + pop {r4} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end irq_hblank + + thumb_func_start irq_vcount +irq_vcount: @ 8000844 + push {r4,lr} + ldr r4, =0x030022c0 + ldr r0, [r4, 0x14] + cmp r0, 0 + beq _08000852 + bl _call_via_r0 +_08000852: + bl SoundVSync_rev01 + ldr r2, =0x03007ff8 + ldrh r0, [r2] + movs r1, 0x4 + orrs r0, r1 + strh r0, [r2] + ldrh r0, [r4, 0x1C] + ldrh r2, [r4, 0x1C] + orrs r1, r0 + strh r1, [r4, 0x1C] + pop {r4} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end irq_vcount + + thumb_func_start irq_serial +irq_serial: @ 8000878 + push {r4,lr} + ldr r4, =0x030022c0 + ldr r0, [r4, 0x18] + cmp r0, 0 + beq _08000886 + bl _call_via_r0 +_08000886: + ldr r2, =0x03007ff8 + ldrh r0, [r2] + movs r1, 0x80 + orrs r0, r1 + strh r0, [r2] + ldrh r0, [r4, 0x1C] + ldrh r2, [r4, 0x1C] + orrs r1, r0 + strh r1, [r4, 0x1C] + pop {r4} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end irq_serial + + thumb_func_start irq_other +irq_other: @ 80008A8 + bx lr + thumb_func_end irq_other + + thumb_func_start wait_for_vblank +wait_for_vblank: @ 80008AC + push {lr} + ldr r2, =0x030022c0 + ldrh r1, [r2, 0x1C] + ldr r0, =0x0000fffe + ands r0, r1 + ldrh r1, [r2, 0x1C] + strh r0, [r2, 0x1C] + ldrh r1, [r2, 0x1C] + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + bne _080008D0 + movs r3, 0x1 +_080008C6: + ldrh r1, [r2, 0x1C] + adds r0, r3, 0 + ands r0, r1 + cmp r0, 0 + beq _080008C6 +_080008D0: + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end wait_for_vblank + + thumb_func_start sub_80008DC +sub_80008DC: @ 80008DC + ldr r1, =0x0203cf5c + str r0, [r1] + bx lr + .align 2, 0 + .pool + thumb_func_end sub_80008DC + + thumb_func_start sub_80008E8 +sub_80008E8: @ 80008E8 + ldr r1, =0x0203cf5c + movs r0, 0 + str r0, [r1] + bx lr + .align 2, 0 + .pool + thumb_func_end sub_80008E8 + + thumb_func_start do_reset +do_reset: @ 80008F4 + push {r4,lr} + ldr r1, =0x04000208 + movs r0, 0 + strh r0, [r1] + bl SoundVSyncOff_rev01 + bl remove_some_task + ldr r1, =0x040000bc + ldrh r2, [r1, 0xA] + ldr r3, =0x0000c5ff + adds r0, r3, 0 + ands r0, r2 + strh r0, [r1, 0xA] + ldrh r4, [r1, 0xA] + ldr r2, =0x00007fff + adds r0, r2, 0 + ands r0, r4 + strh r0, [r1, 0xA] + ldrh r0, [r1, 0xA] + adds r1, 0xC + ldrh r4, [r1, 0xA] + adds r0, r3, 0 + ands r0, r4 + strh r0, [r1, 0xA] + ldrh r4, [r1, 0xA] + adds r0, r2, 0 + ands r0, r4 + strh r0, [r1, 0xA] + ldrh r0, [r1, 0xA] + ldr r0, =0x040000d4 + ldrh r1, [r0, 0xA] + ands r3, r1 + strh r3, [r0, 0xA] + ldrh r1, [r0, 0xA] + ands r2, r1 + strh r2, [r0, 0xA] + ldrh r0, [r0, 0xA] + bl sub_82E2168 + movs r0, 0xFF + bl SoftReset + pop {r4} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end do_reset + + thumb_func_start sub_8000964 +sub_8000964: @ 8000964 + push {lr} + sub sp, 0x4 + mov r1, sp + movs r0, 0 + strh r0, [r1] + ldr r1, =0x03007330 + ldr r2, =0x01000034 + mov r0, sp + bl CpuSet + add sp, 0x4 + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end sub_8000964 diff --git a/asm/malloc.s b/asm/malloc.s new file mode 100644 index 000000000..ceedc291b --- /dev/null +++ b/asm/malloc.s @@ -0,0 +1,327 @@ + thumb_func_start malloc_header +malloc_header: @ 8000988 + push {r4,lr} + movs r4, 0 + strh r4, [r0] + ldr r4, =0x0000a3a3 + strh r4, [r0, 0x2] + str r3, [r0, 0x4] + str r1, [r0, 0x8] + str r2, [r0, 0xC] + pop {r4} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end malloc_header + + thumb_func_start malloc_unlinked_header +malloc_unlinked_header: @ 80009A4 + push {lr} + adds r2, r0, 0 + adds r3, r1, 0 + subs r3, 0x10 + adds r1, r2, 0 + bl malloc_header + pop {r0} + bx r0 + thumb_func_end malloc_unlinked_header + + thumb_func_start malloc_core +malloc_core: @ 80009B8 + push {r4-r6,lr} + adds r4, r0, 0 + adds r6, r4, 0 + movs r0, 0x3 + ands r0, r1 + cmp r0, 0 + beq _080009CC + lsrs r0, r1, 2 + adds r0, 0x1 + lsls r1, r0, 2 +_080009CC: + movs r2, 0x1 +_080009CE: + ldrh r0, [r4] + cmp r0, 0 + bne _08000A0C + ldr r3, [r4, 0x4] + cmp r3, r1 + bcc _08000A0C + subs r0, r3, r1 + cmp r0, 0x1F + bhi _080009E4 + strh r2, [r4] + b _08000A06 +_080009E4: + subs r3, 0x10 + subs r3, r1 + adds r0, r1, 0 + adds r0, 0x10 + adds r5, r4, r0 + strh r2, [r4] + str r1, [r4, 0x4] + ldr r2, [r4, 0xC] + adds r0, r5, 0 + adds r1, r4, 0 + bl malloc_header + str r5, [r4, 0xC] + ldr r0, [r5, 0xC] + cmp r0, r6 + beq _08000A06 + str r5, [r0, 0x8] +_08000A06: + adds r0, r4, 0 + adds r0, 0x10 + b _08000A18 +_08000A0C: + ldr r0, [r4, 0xC] + cmp r0, r6 + beq _08000A16 + adds r4, r0, 0 + b _080009CE +_08000A16: + movs r0, 0 +_08000A18: + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end malloc_core + + thumb_func_start free_core +free_core: @ 8000A20 + push {r4,r5,lr} + cmp r1, 0 + beq _08000A7C + adds r5, r0, 0 + adds r2, r1, 0 + subs r2, 0x10 + movs r0, 0 + strh r0, [r2] + ldr r3, [r2, 0xC] + cmp r3, r5 + beq _08000A54 + ldrh r4, [r3] + cmp r4, 0 + bne _08000A54 + ldr r0, [r2, 0x4] + adds r0, 0x10 + ldr r1, [r3, 0x4] + adds r0, r1 + str r0, [r2, 0x4] + strh r4, [r3, 0x2] + ldr r0, [r2, 0xC] + ldr r0, [r0, 0xC] + str r0, [r2, 0xC] + cmp r0, r5 + beq _08000A54 + str r2, [r0, 0x8] +_08000A54: + cmp r2, r5 + beq _08000A7C + ldr r1, [r2, 0x8] + ldrh r3, [r1] + cmp r3, 0 + bne _08000A7C + ldr r0, [r2, 0xC] + str r0, [r1, 0xC] + ldr r1, [r2, 0xC] + cmp r1, r5 + beq _08000A6E + ldr r0, [r2, 0x8] + str r0, [r1, 0x8] +_08000A6E: + strh r3, [r2, 0x2] + ldr r0, [r2, 0x8] + ldr r1, [r0, 0x4] + adds r1, 0x10 + ldr r2, [r2, 0x4] + adds r1, r2 + str r1, [r0, 0x4] +_08000A7C: + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end free_core + + thumb_func_start malloc_core_and_clear +malloc_core_and_clear: @ 8000A84 + push {r4,r5,lr} + sub sp, 0x4 + adds r4, r1, 0 + bl malloc_core + adds r5, r0, 0 + cmp r5, 0 + beq _08000AB8 + movs r0, 0x3 + ands r0, r4 + cmp r0, 0 + beq _08000AA2 + lsrs r0, r4, 2 + adds r0, 0x1 + lsls r4, r0, 2 +_08000AA2: + movs r0, 0 + str r0, [sp] + lsls r2, r4, 9 + lsrs r2, 11 + movs r0, 0xA0 + lsls r0, 19 + orrs r2, r0 + mov r0, sp + adds r1, r5, 0 + bl CpuSet +_08000AB8: + adds r0, r5, 0 + add sp, 0x4 + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end malloc_core_and_clear + + thumb_func_start check_memblk_core +check_memblk_core: @ 8000AC4 + push {r4,r5,lr} + adds r5, r0, 0 + adds r3, r1, 0 + subs r3, 0x10 + ldrh r2, [r3, 0x2] + ldr r0, =0x0000a3a3 + cmp r2, r0 + bne _08000B0A + ldr r0, [r3, 0xC] + ldrh r1, [r0, 0x2] + adds r4, r0, 0 + cmp r1, r2 + bne _08000B0A + cmp r4, r5 + beq _08000AE8 + ldr r0, [r4, 0x8] + cmp r0, r3 + bne _08000B0A +_08000AE8: + ldr r2, [r3, 0x8] + ldrh r1, [r2, 0x2] + ldr r0, =0x0000a3a3 + cmp r1, r0 + bne _08000B0A + cmp r2, r5 + beq _08000AFC + ldr r0, [r2, 0xC] + cmp r0, r3 + bne _08000B0A +_08000AFC: + cmp r4, r5 + beq _08000B14 + ldr r0, [r3, 0x4] + adds r0, 0x10 + adds r0, r3, r0 + cmp r4, r0 + beq _08000B14 +_08000B0A: + movs r0, 0 + b _08000B16 + .align 2, 0 + .pool +_08000B14: + movs r0, 0x1 +_08000B16: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end check_memblk_core + + thumb_func_start init_malloc +init_malloc: @ 8000B1C + push {lr} + ldr r2, =0x03000004 + str r0, [r2] + ldr r2, =0x03000008 + str r1, [r2] + bl malloc_unlinked_header + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end init_malloc + + thumb_func_start malloc +malloc: @ 8000B38 + push {lr} + adds r1, r0, 0 + ldr r0, =0x03000004 + ldr r0, [r0] + bl malloc_core + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end malloc + + thumb_func_start malloc_and_clear +malloc_and_clear: @ 8000B4C + push {lr} + adds r1, r0, 0 + ldr r0, =0x03000004 + ldr r0, [r0] + bl malloc_core_and_clear + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end malloc_and_clear + + thumb_func_start free +free: @ 8000B60 + push {lr} + adds r1, r0, 0 + ldr r0, =0x03000004 + ldr r0, [r0] + bl free_core + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end free + + thumb_func_start check_memblk +check_memblk: @ 8000B74 + push {lr} + adds r1, r0, 0 + ldr r0, =0x03000004 + ldr r0, [r0] + bl check_memblk_core + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end check_memblk + + thumb_func_start check_all_memblks +check_all_memblks: @ 8000B88 + push {r4,r5,lr} + ldr r0, =0x03000004 + ldr r4, [r0] + adds r5, r0, 0 +_08000B90: + ldr r0, [r5] + adds r1, r4, 0 + adds r1, 0x10 + bl check_memblk_core + cmp r0, 0 + beq _08000BB0 + ldr r4, [r4, 0xC] + ldr r0, [r5] + cmp r4, r0 + bne _08000B90 + movs r0, 0x1 + b _08000BB2 + .align 2, 0 + .pool +_08000BB0: + movs r0, 0 +_08000BB2: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end check_all_memblks diff --git a/asm/pixel_buffer.s b/asm/pixel_buffer.s new file mode 100644 index 000000000..e45102453 --- /dev/null +++ b/asm/pixel_buffer.s @@ -0,0 +1,809 @@ + thumb_func_start sub_8002BDC +sub_8002BDC: @ 8002BDC + push {r4-r7,lr} + mov r7, r8 + push {r7} + sub sp, 0x14 + ldr r4, [sp, 0x2C] + ldr r5, [sp, 0x30] + ldr r6, [sp, 0x34] + ldr r7, [sp, 0x38] + lsls r2, 16 + lsrs r2, 16 + lsls r3, 16 + lsrs r3, 16 + lsls r4, 16 + lsrs r4, 16 + lsls r5, 16 + lsrs r5, 16 + lsls r6, 16 + lsrs r6, 16 + lsls r7, 16 + lsrs r7, 16 + str r4, [sp] + str r5, [sp, 0x4] + str r6, [sp, 0x8] + str r7, [sp, 0xC] + movs r4, 0xFF + str r4, [sp, 0x10] + bl PixelBlock_CopyRect4Bpp + add sp, 0x14 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_8002BDC + + thumb_func_start PixelBlock_CopyRect4Bpp +PixelBlock_CopyRect4Bpp: @ 8002C20 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x2C + str r0, [sp] + str r1, [sp, 0x4] + ldr r0, [sp, 0x4C] + ldr r1, [sp, 0x50] + ldr r4, [sp, 0x54] + ldr r5, [sp, 0x58] + ldr r6, [sp, 0x5C] + lsls r2, 16 + lsrs r2, 16 + str r2, [sp, 0x8] + lsls r3, 16 + lsrs r7, r3, 16 + lsls r0, 16 + lsrs r0, 16 + str r0, [sp, 0xC] + lsls r1, 16 + lsrs r1, 16 + mov r9, r1 + lsls r4, 16 + lsrs r4, 16 + lsls r5, 16 + lsrs r5, 16 + lsls r6, 24 + lsrs r6, 24 + str r6, [sp, 0x10] + ldr r0, [sp, 0x4] + ldrh r3, [r0, 0x4] + ldr r1, [sp, 0xC] + subs r0, r3, r1 + adds r2, r4 + mov r8, r2 + cmp r0, r4 + bge _08002C74 + ldr r2, [sp, 0x8] + adds r0, r2 + mov r8, r0 +_08002C74: + ldr r4, [sp, 0x4] + ldrh r0, [r4, 0x6] + mov r1, r9 + subs r0, r1 + adds r2, r5, r7 + str r2, [sp, 0x14] + cmp r0, r5 + bge _08002C88 + adds r0, r7 + str r0, [sp, 0x14] +_08002C88: + ldr r4, [sp] + ldrh r1, [r4, 0x4] + movs r2, 0x7 + adds r0, r1, 0 + ands r0, r2 + adds r1, r0 + asrs r1, 3 + str r1, [sp, 0x18] + adds r0, r3, 0 + ands r0, r2 + adds r0, r3, r0 + asrs r0, 3 + str r0, [sp, 0x1C] + ldr r0, [sp, 0x10] + cmp r0, 0xFF + bne _08002D46 + adds r3, r7, 0 + mov r1, r9 + ldr r2, [sp, 0x14] + cmp r3, r2 + blt _08002CB4 + b _08002DEE +_08002CB4: + ldr r5, [sp, 0x8] + ldr r6, [sp, 0xC] + adds r4, r3, 0x1 + str r4, [sp, 0x24] + adds r0, r1, 0x1 + str r0, [sp, 0x28] + cmp r5, r8 + bge _08002D3A + movs r7, 0x3 + asrs r0, r3, 3 + ldr r2, [sp, 0x18] + muls r0, r2 + lsls r0, 5 + mov r10, r0 + lsls r0, r3, 29 + lsrs r0, 27 + mov r9, r0 + asrs r0, r1, 3 + ldr r4, [sp, 0x1C] + muls r0, r4 + lsls r0, 5 + mov r12, r0 + lsls r0, r1, 29 + lsrs r3, r0, 27 +_08002CE4: + asrs r0, r5, 1 + ands r0, r7 + ldr r2, [sp] + ldr r1, [r2] + adds r1, r0 + asrs r0, r5, 3 + lsls r0, 5 + adds r1, r0 + add r1, r10 + mov r4, r9 + adds r2, r1, r4 + asrs r0, r6, 1 + ands r0, r7 + ldr r4, [sp, 0x4] + ldr r1, [r4] + adds r1, r0 + asrs r0, r6, 3 + lsls r0, 5 + adds r1, r0 + add r1, r12 + adds r4, r1, r3 + ldrb r2, [r2] + adds r0, r5, 0 + movs r1, 0x1 + ands r0, r1 + lsls r0, 2 + asrs r2, r0 + movs r0, 0xF + ands r2, r0 + adds r0, r6, 0 + ands r0, r1 + lsls r1, r0, 2 + lsls r2, r1 + movs r0, 0xF0 + asrs r0, r1 + ldrb r1, [r4] + ands r0, r1 + orrs r2, r0 + strb r2, [r4] + adds r5, 0x1 + adds r6, 0x1 + cmp r5, r8 + blt _08002CE4 +_08002D3A: + ldr r3, [sp, 0x24] + ldr r1, [sp, 0x28] + ldr r2, [sp, 0x14] + cmp r3, r2 + blt _08002CB4 + b _08002DEE +_08002D46: + adds r3, r7, 0 + mov r1, r9 + ldr r4, [sp, 0x14] + cmp r3, r4 + bge _08002DEE +_08002D50: + ldr r5, [sp, 0x8] + ldr r6, [sp, 0xC] + adds r0, r3, 0x1 + str r0, [sp, 0x24] + adds r2, r1, 0x1 + str r2, [sp, 0x28] + cmp r5, r8 + bge _08002DE4 + movs r4, 0x3 + mov r9, r4 + asrs r0, r3, 3 + ldr r2, [sp, 0x18] + muls r0, r2 + lsls r0, 5 + str r0, [sp, 0x20] + lsls r0, r3, 29 + lsrs r0, 27 + mov r10, r0 + movs r3, 0x1 + asrs r0, r1, 3 + ldr r4, [sp, 0x1C] + muls r0, r4 + lsls r0, 5 + mov r12, r0 + lsls r0, r1, 29 + lsrs r7, r0, 27 +_08002D84: + asrs r0, r5, 1 + mov r1, r9 + ands r0, r1 + ldr r2, [sp] + ldr r1, [r2] + adds r1, r0 + asrs r0, r5, 3 + lsls r0, 5 + adds r1, r0 + ldr r4, [sp, 0x20] + adds r1, r4 + mov r0, r10 + adds r2, r1, r0 + asrs r0, r6, 1 + mov r1, r9 + ands r0, r1 + ldr r4, [sp, 0x4] + ldr r1, [r4] + adds r1, r0 + asrs r0, r6, 3 + lsls r0, 5 + adds r1, r0 + add r1, r12 + adds r4, r1, r7 + ldrb r2, [r2] + adds r0, r5, 0 + ands r0, r3 + lsls r0, 2 + asrs r2, r0 + movs r0, 0xF + ands r2, r0 + ldr r0, [sp, 0x10] + cmp r2, r0 + beq _08002DDC + adds r0, r6, 0 + ands r0, r3 + lsls r1, r0, 2 + lsls r2, r1 + movs r0, 0xF0 + asrs r0, r1 + ldrb r1, [r4] + ands r0, r1 + orrs r2, r0 + strb r2, [r4] +_08002DDC: + adds r5, 0x1 + adds r6, 0x1 + cmp r5, r8 + blt _08002D84 +_08002DE4: + ldr r3, [sp, 0x24] + ldr r1, [sp, 0x28] + ldr r2, [sp, 0x14] + cmp r3, r2 + blt _08002D50 +_08002DEE: + add sp, 0x2C + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end PixelBlock_CopyRect4Bpp + + thumb_func_start PixelBlock_FillRect4Bpp +PixelBlock_FillRect4Bpp: @ 8002E00 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x8 + mov r9, r0 + ldr r0, [sp, 0x28] + ldr r4, [sp, 0x2C] + lsls r1, 16 + lsrs r1, 16 + str r1, [sp] + lsls r2, 16 + lsrs r2, 16 + adds r6, r2, 0 + lsls r3, 16 + lsrs r3, 16 + lsls r0, 16 + lsrs r0, 16 + lsls r4, 24 + lsrs r5, r4, 24 + adds r4, r1, r3 + mov r3, r9 + ldrh r1, [r3, 0x4] + cmp r4, r1 + ble _08002E36 + adds r4, r1, 0 +_08002E36: + adds r2, r0 + mov r12, r2 + mov r2, r9 + ldrh r0, [r2, 0x6] + cmp r12, r0 + ble _08002E44 + mov r12, r0 +_08002E44: + movs r0, 0x7 + ands r0, r1 + adds r0, r1, r0 + asrs r0, 3 + str r0, [sp, 0x4] + lsls r0, r5, 28 + lsrs r0, 24 + mov r8, r0 + movs r3, 0xF + mov r10, r3 + mov r0, r10 + ands r0, r5 + mov r10, r0 + adds r1, r6, 0 + cmp r1, r12 + bge _08002EB6 +_08002E64: + ldr r3, [sp] + adds r7, r1, 0x1 + cmp r3, r4 + bge _08002EB0 + asrs r0, r1, 3 + ldr r2, [sp, 0x4] + muls r0, r2 + lsls r6, r0, 5 + lsls r0, r1, 29 + lsrs r5, r0, 27 +_08002E78: + asrs r2, r3, 1 + movs r0, 0x3 + ands r2, r0 + mov r0, r9 + ldr r1, [r0] + adds r1, r2 + asrs r0, r3, 3 + lsls r0, 5 + adds r1, r0 + adds r1, r6 + adds r2, r1, r5 + lsls r0, r3, 31 + cmp r0, 0 + beq _08002E9E + ldrb r1, [r2] + movs r0, 0xF + ands r0, r1 + mov r1, r8 + b _08002EA6 +_08002E9E: + ldrb r1, [r2] + movs r0, 0xF0 + ands r0, r1 + mov r1, r10 +_08002EA6: + orrs r0, r1 + strb r0, [r2] + adds r3, 0x1 + cmp r3, r4 + blt _08002E78 +_08002EB0: + adds r1, r7, 0 + cmp r1, r12 + blt _08002E64 +_08002EB6: + add sp, 0x8 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end PixelBlock_FillRect4Bpp + + thumb_func_start PixelBlock_CopyRect4BppTo8Bpp +PixelBlock_CopyRect4BppTo8Bpp: @ 8002EC8 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x3C + str r0, [sp] + str r1, [sp, 0x4] + ldr r0, [sp, 0x5C] + ldr r1, [sp, 0x60] + ldr r5, [sp, 0x64] + ldr r4, [sp, 0x68] + ldr r6, [sp, 0x6C] + ldr r7, [sp, 0x70] + mov r8, r7 + lsls r2, 16 + lsrs r2, 16 + str r2, [sp, 0x8] + lsls r3, 16 + lsrs r3, 16 + lsls r0, 16 + lsrs r0, 16 + str r0, [sp, 0xC] + lsls r1, 16 + lsrs r7, r1, 16 + lsls r5, 16 + lsrs r5, 16 + lsls r4, 16 + lsrs r4, 16 + lsls r6, 24 + lsrs r6, 24 + str r6, [sp, 0x10] + mov r0, r8 + lsls r0, 28 + lsrs r0, 24 + str r0, [sp, 0x14] + lsls r0, r6, 28 + lsrs r0, 24 + str r0, [sp, 0x28] + ldr r1, [sp, 0x4] + ldrh r0, [r1, 0x4] + ldr r2, [sp, 0xC] + subs r0, r2 + ldr r1, [sp, 0x8] + adds r1, r5, r1 + str r1, [sp, 0x18] + cmp r0, r5 + bge _08002F2E + ldr r2, [sp, 0x8] + adds r0, r2 + str r0, [sp, 0x18] +_08002F2E: + ldr r5, [sp, 0x4] + ldrh r1, [r5, 0x6] + subs r0, r1, r7 + cmp r0, r4 + bge _08002F40 + adds r0, r3, r1 + subs r0, r7 + str r0, [sp, 0x1C] + b _08002F44 +_08002F40: + adds r4, r3, r4 + str r4, [sp, 0x1C] +_08002F44: + ldr r0, [sp] + ldrh r1, [r0, 0x4] + movs r2, 0x7 + adds r0, r1, 0 + ands r0, r2 + adds r1, r0 + asrs r1, 3 + str r1, [sp, 0x20] + ldr r5, [sp, 0x4] + ldrh r1, [r5, 0x4] + adds r0, r1, 0 + ands r0, r2 + adds r1, r0 + asrs r1, 3 + str r1, [sp, 0x24] + ldr r0, [sp, 0x10] + cmp r0, 0xFF + bne _08003024 + adds r2, r3, 0 + adds r5, r7, 0 + ldr r1, [sp, 0x1C] + cmp r2, r1 + blt _08002F74 + b _08003106 +_08002F74: + ldr r3, [sp, 0x8] + lsrs r3, 1 + str r3, [sp, 0x2C] + movs r0, 0x3 + ands r3, r0 + str r3, [sp, 0x2C] + ldr r7, [sp, 0x8] + lsrs r0, r7, 3 + lsls r0, 5 + str r0, [sp, 0x30] +_08002F88: + ldr r0, [sp] + ldr r1, [r0] + ldr r3, [sp, 0x2C] + adds r1, r3 + ldr r7, [sp, 0x30] + adds r1, r7 + asrs r0, r2, 3 + ldr r3, [sp, 0x20] + muls r0, r3 + lsls r0, 5 + mov r8, r0 + add r1, r8 + lsls r0, r2, 29 + lsrs r7, r0, 27 + adds r6, r1, r7 + ldr r3, [sp, 0x8] + ldr r4, [sp, 0xC] + adds r2, 0x1 + mov r10, r2 + adds r0, r5, 0x1 + str r0, [sp, 0x38] + ldr r1, [sp, 0x18] + cmp r3, r1 + bge _08003018 + asrs r0, r5, 3 + ldr r2, [sp, 0x24] + muls r0, r2 + lsls r0, 6 + mov r12, r0 + lsls r0, r5, 29 + lsrs r0, 26 + mov r9, r0 +_08002FC8: + movs r0, 0x7 + ands r0, r4 + ldr r5, [sp, 0x4] + ldr r1, [r5] + adds r1, r0 + asrs r0, r4, 3 + lsls r0, 6 + adds r1, r0 + add r1, r12 + mov r0, r9 + adds r5, r1, r0 + movs r0, 0x1 + ands r0, r3 + cmp r0, 0 + beq _08002FEC + ldrb r0, [r6] + lsrs r0, 4 + b _08003008 +_08002FEC: + asrs r2, r3, 1 + movs r0, 0x3 + ands r2, r0 + ldr r0, [sp] + ldr r1, [r0] + adds r1, r2 + asrs r0, r3, 3 + lsls r0, 5 + adds r1, r0 + add r1, r8 + adds r6, r1, r7 + ldrb r1, [r6] + movs r0, 0xF + ands r0, r1 +_08003008: + ldr r1, [sp, 0x14] + adds r0, r1, r0 + strb r0, [r5] + adds r3, 0x1 + adds r4, 0x1 + ldr r2, [sp, 0x18] + cmp r3, r2 + blt _08002FC8 +_08003018: + mov r2, r10 + ldr r5, [sp, 0x38] + ldr r3, [sp, 0x1C] + cmp r2, r3 + blt _08002F88 + b _08003106 +_08003024: + adds r2, r3, 0 + adds r5, r7, 0 + ldr r7, [sp, 0x1C] + cmp r2, r7 + bge _08003106 + ldr r0, [sp, 0x8] + lsrs r0, 1 + str r0, [sp, 0x34] + movs r0, 0x3 + ldr r1, [sp, 0x34] + ands r1, r0 + str r1, [sp, 0x34] +_0800303C: + ldr r3, [sp] + ldr r1, [r3] + ldr r7, [sp, 0x34] + adds r1, r7 + ldr r3, [sp, 0x8] + lsrs r0, r3, 3 + lsls r0, 5 + adds r1, r0 + asrs r0, r2, 3 + ldr r7, [sp, 0x20] + muls r0, r7 + lsls r0, 5 + mov r8, r0 + add r1, r8 + lsls r0, r2, 29 + lsrs r7, r0, 27 + adds r6, r1, r7 + ldr r4, [sp, 0xC] + adds r2, 0x1 + mov r10, r2 + adds r0, r5, 0x1 + str r0, [sp, 0x38] + ldr r1, [sp, 0x18] + cmp r3, r1 + bge _080030FC + asrs r0, r5, 3 + ldr r2, [sp, 0x24] + muls r0, r2 + lsls r0, 6 + mov r9, r0 + lsls r0, r5, 29 + lsrs r0, 26 + mov r12, r0 +_0800307E: + movs r0, 0x1 + ands r0, r3 + cmp r0, 0 + beq _080030B2 + ldrb r2, [r6] + movs r0, 0xF0 + ands r0, r2 + ldr r5, [sp, 0x28] + cmp r0, r5 + beq _080030F2 + adds r0, r4, 0 + movs r1, 0x7 + ands r0, r1 + ldr r5, [sp, 0x4] + ldr r1, [r5] + adds r1, r0 + asrs r0, r4, 3 + lsls r0, 6 + adds r1, r0 + add r1, r9 + mov r0, r12 + adds r5, r1, r0 + lsrs r0, r2, 4 + ldr r1, [sp, 0x14] + adds r0, r1, r0 + b _080030F0 +_080030B2: + asrs r2, r3, 1 + movs r0, 0x3 + ands r2, r0 + ldr r5, [sp] + ldr r1, [r5] + adds r1, r2 + asrs r0, r3, 3 + lsls r0, 5 + adds r1, r0 + add r1, r8 + adds r6, r1, r7 + ldrb r0, [r6] + movs r2, 0xF + ands r2, r0 + ldr r0, [sp, 0x10] + cmp r2, r0 + beq _080030F2 + adds r0, r4, 0 + movs r1, 0x7 + ands r0, r1 + ldr r5, [sp, 0x4] + ldr r1, [r5] + adds r1, r0 + asrs r0, r4, 3 + lsls r0, 6 + adds r1, r0 + add r1, r9 + mov r0, r12 + adds r5, r1, r0 + ldr r1, [sp, 0x14] + adds r0, r1, r2 +_080030F0: + strb r0, [r5] +_080030F2: + adds r3, 0x1 + adds r4, 0x1 + ldr r2, [sp, 0x18] + cmp r3, r2 + blt _0800307E +_080030FC: + mov r2, r10 + ldr r5, [sp, 0x38] + ldr r3, [sp, 0x1C] + cmp r2, r3 + blt _0800303C +_08003106: + add sp, 0x3C + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end PixelBlock_CopyRect4BppTo8Bpp + + thumb_func_start PixelBlock_FillRect8Bpp +PixelBlock_FillRect8Bpp: @ 8003118 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x8 + mov r8, r0 + ldr r0, [sp, 0x28] + ldr r4, [sp, 0x2C] + lsls r1, 16 + lsrs r1, 16 + mov r10, r1 + lsls r2, 16 + lsrs r2, 16 + adds r6, r2, 0 + lsls r3, 16 + lsrs r3, 16 + lsls r0, 16 + lsrs r0, 16 + lsls r4, 24 + lsrs r4, 24 + mov r9, r4 + adds r5, r1, r3 + mov r3, r8 + ldrh r1, [r3, 0x4] + cmp r5, r1 + ble _08003150 + adds r5, r1, 0 +_08003150: + adds r7, r2, r0 + mov r2, r8 + ldrh r0, [r2, 0x6] + cmp r7, r0 + ble _0800315C + adds r7, r0, 0 +_0800315C: + movs r0, 0x7 + ands r0, r1 + adds r0, r1, r0 + asrs r0, 3 + str r0, [sp] + adds r1, r6, 0 + cmp r1, r7 + bge _080031AC +_0800316C: + mov r3, r10 + adds r6, r1, 0x1 + str r6, [sp, 0x4] + cmp r3, r5 + bge _080031A6 + movs r0, 0x7 + mov r12, r0 + asrs r0, r1, 3 + ldr r2, [sp] + muls r0, r2 + lsls r4, r0, 6 + lsls r0, r1, 29 + lsrs r2, r0, 26 +_08003186: + adds r0, r3, 0 + mov r6, r12 + ands r0, r6 + mov r6, r8 + ldr r1, [r6] + adds r1, r0 + asrs r0, r3, 3 + lsls r0, 6 + adds r1, r0 + adds r1, r4 + adds r1, r2 + mov r0, r9 + strb r0, [r1] + adds r3, 0x1 + cmp r3, r5 + blt _08003186 +_080031A6: + ldr r1, [sp, 0x4] + cmp r1, r7 + blt _0800316C +_080031AC: + add sp, 0x8 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end PixelBlock_FillRect8Bpp diff --git a/asm/text_renderer.s b/asm/text_renderer.s new file mode 100644 index 000000000..6bde7bf78 --- /dev/null +++ b/asm/text_renderer.s @@ -0,0 +1,4671 @@ + thumb_func_start fboxes_set_ptr +fboxes_set_ptr: @ 80045A4 + ldr r1, =0x03002f80 + str r0, [r1] + bx lr + .align 2, 0 + .pool + thumb_func_end fboxes_set_ptr + + thumb_func_start TextBox_ResetSomeField +TextBox_ResetSomeField: @ 80045B0 + push {lr} + ldr r1, =0x020201b0 + movs r2, 0 + ldr r3, =0x0000045c + adds r0, r1, r3 +_080045BA: + strb r2, [r0, 0x1B] + subs r0, 0x24 + cmp r0, r1 + bge _080045BA + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end TextBox_ResetSomeField + + thumb_func_start Print +Print: @ 80045D0 + push {r4-r7,lr} + mov r7, r8 + push {r7} + sub sp, 0x10 + ldr r4, [sp, 0x28] + ldr r5, [sp, 0x2C] + ldr r7, [sp, 0x30] + lsls r1, 24 + lsrs r1, 24 + lsls r3, 24 + lsrs r3, 24 + lsls r4, 24 + lsrs r4, 24 + lsls r5, 24 + lsrs r5, 24 + mov r8, r5 + str r2, [sp] + mov r2, sp + strb r0, [r2, 0x4] + mov r0, sp + strb r1, [r0, 0x5] + strb r3, [r0, 0x6] + strb r4, [r0, 0x7] + strb r3, [r0, 0x8] + strb r4, [r0, 0x9] + ldr r0, =0x03002f80 + ldr r0, [r0] + lsls r3, r1, 1 + adds r3, r1 + lsls r3, 2 + adds r3, r0 + ldrb r0, [r3, 0x6] + strb r0, [r2, 0xA] + mov r1, sp + ldrb r0, [r3, 0x7] + strb r0, [r1, 0xB] + mov r5, sp + ldrb r1, [r3, 0x8] + lsls r1, 28 + movs r6, 0xF + lsrs r1, 28 + ldrb r4, [r5, 0xC] + movs r2, 0x10 + negs r2, r2 + adds r0, r2, 0 + ands r0, r4 + orrs r0, r1 + strb r0, [r5, 0xC] + mov r4, sp + ldrb r1, [r3, 0x8] + lsrs r1, 4 + lsls r1, 4 + ands r0, r6 + orrs r0, r1 + strb r0, [r4, 0xC] + ldrb r0, [r3, 0x9] + lsls r0, 28 + lsrs r0, 28 + adds r1, r6, 0 + ands r1, r0 + ldrb r0, [r4, 0xD] + ands r2, r0 + orrs r2, r1 + strb r2, [r4, 0xD] + mov r1, sp + ldrb r0, [r3, 0x9] + lsrs r0, 4 + lsls r0, 4 + ands r2, r6 + orrs r2, r0 + strb r2, [r1, 0xD] + mov r0, sp + mov r1, r8 + adds r2, r7, 0 + bl remo_copy + lsls r0, 16 + lsrs r0, 16 + add sp, 0x10 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end Print + + thumb_func_start remo_copy +remo_copy: @ 800467C + push {r4-r7,lr} + adds r6, r0, 0 + mov r12, r2 + lsls r1, 24 + lsrs r5, r1, 24 + ldr r0, =0x03002f80 + ldr r0, [r0] + cmp r0, 0 + bne _08004698 + movs r0, 0 + b _08004766 + .align 2, 0 + .pool +_08004698: + ldr r0, =0x0202018c + movs r2, 0 + movs r1, 0x1 + strb r1, [r0, 0x1B] + strb r2, [r0, 0x1C] + strb r5, [r0, 0x1D] + strb r2, [r0, 0x1E] + strb r2, [r0, 0x1F] + adds r4, r0, 0 + movs r1, 0x6 + adds r0, 0x1A +_080046AE: + strb r2, [r0] + subs r0, 0x1 + subs r1, 0x1 + cmp r1, 0 + bge _080046AE + adds r1, r4, 0 + adds r0, r6, 0 + ldm r0!, {r2,r3,r7} + stm r1!, {r2,r3,r7} + ldr r0, [r0] + str r0, [r1] + mov r0, r12 + str r0, [r4, 0x10] + adds r0, r4, 0 + adds r0, 0x20 + movs r1, 0 + strb r1, [r0] + adds r0, 0x1 + strb r1, [r0] + ldrb r0, [r6, 0xC] + lsrs r0, 4 + ldrb r2, [r6, 0xD] + lsls r1, r2, 28 + lsrs r1, 28 + lsrs r2, 4 + bl GenerateFontHalfRowLut + cmp r5, 0xFF + beq _08004718 + cmp r5, 0 + beq _08004718 + ldrb r0, [r4, 0x1D] + subs r0, 0x1 + strb r0, [r4, 0x1D] + ldr r2, =0x020201b0 + ldrb r0, [r6, 0x4] + lsls r1, r0, 3 + adds r1, r0 + lsls r1, 2 + adds r1, r2 + adds r0, r4, 0 + ldm r0!, {r2-r4} + stm r1!, {r2-r4} + ldm r0!, {r2,r3,r7} + stm r1!, {r2,r3,r7} + ldm r0!, {r2,r4,r7} + stm r1!, {r2,r4,r7} + b _0800475E + .align 2, 0 + .pool +_08004718: + ldr r1, =0x0202018c + movs r0, 0 + strb r0, [r1, 0x1D] + movs r4, 0 + ldr r7, =0x000003ff + b _08004732 + .align 2, 0 + .pool +_0800472C: + adds r0, r4, 0x1 + lsls r0, 16 + lsrs r4, r0, 16 +_08004732: + cmp r4, r7 + bhi _08004740 + ldr r0, =0x0202018c + bl fbox_exec + cmp r0, 0x1 + bne _0800472C +_08004740: + cmp r5, 0xFF + beq _0800474E + ldr r0, =0x0202018c + ldrb r0, [r0, 0x4] + movs r1, 0x2 + bl Window_CopyToVram +_0800474E: + ldr r2, =0x020201b0 + ldrb r1, [r6, 0x4] + lsls r0, r1, 3 + adds r0, r1 + lsls r0, 2 + adds r0, r2 + movs r1, 0 + strb r1, [r0, 0x1B] +_0800475E: + ldr r1, =0x03002f84 + movs r0, 0 + strb r0, [r1] + movs r0, 0x1 +_08004766: + pop {r4-r7} + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end remo_copy + + thumb_func_start run_remoboxes +run_remoboxes: @ 8004778 + push {r4-r7,lr} + mov r7, r8 + push {r7} + ldr r0, =0x03002f84 + ldrb r0, [r0] + cmp r0, 0 + bne _080047F6 + ldr r0, =0x020201b0 + movs r6, 0 + adds r5, r0, 0x4 + mov r8, r0 + movs r7, 0x1F +_08004790: + ldrb r0, [r5, 0x17] + cmp r0, 0 + beq _080047E8 + mov r0, r8 + bl fbox_exec + lsls r0, 16 + lsrs r4, r0, 16 + cmp r4, 0x1 + beq _080047E4 + cmp r4, 0x1 + bgt _080047B8 + cmp r4, 0 + beq _080047BE + b _080047E8 + .align 2, 0 + .pool +_080047B8: + cmp r4, 0x3 + beq _080047C6 + b _080047E8 +_080047BE: + ldrb r0, [r5] + movs r1, 0x2 + bl Window_CopyToVram +_080047C6: + ldr r1, =0x020201b0 + adds r0, r1, 0 + adds r0, 0x10 + adds r0, r6, r0 + ldr r2, [r0] + cmp r2, 0 + beq _080047E8 + adds r0, r6, r1 + adds r1, r4, 0 + bl _call_via_r2 + b _080047E8 + .align 2, 0 + .pool +_080047E4: + movs r0, 0 + strb r0, [r5, 0x17] +_080047E8: + adds r6, 0x24 + adds r5, 0x24 + movs r0, 0x24 + add r8, r0 + subs r7, 0x1 + cmp r7, 0 + bge _08004790 +_080047F6: + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end run_remoboxes + + thumb_func_start a_pressed_maybe +a_pressed_maybe: @ 8004800 + lsls r0, 24 + lsrs r0, 24 + ldr r2, =0x020201b0 + lsls r1, r0, 3 + adds r1, r0 + lsls r1, 2 + adds r1, r2 + ldrb r0, [r1, 0x1B] + bx lr + .align 2, 0 + .pool + thumb_func_end a_pressed_maybe + + thumb_func_start fbox_exec +fbox_exec: @ 8004818 + push {r4,lr} + adds r4, r0, 0 +_0800481C: + ldrb r1, [r4, 0x5] + ldr r0, =0x03002f80 + ldr r2, [r0] + lsls r0, r1, 1 + adds r0, r1 + lsls r0, 2 + adds r0, r2 + ldr r1, [r0] + adds r0, r4, 0 + bl _call_via_r1 + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x2 + beq _0800481C + pop {r4} + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end fbox_exec + + thumb_func_start GenerateFontHalfRowLut +GenerateFontHalfRowLut: @ 8004844 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x24 + lsls r0, 24 + lsrs r0, 24 + lsls r1, 24 + lsrs r1, 24 + lsls r2, 24 + lsrs r2, 24 + ldr r3, =0x03000948 + ldr r4, =0x030009ea + strh r1, [r4] + ldr r4, =0x030009ec + strh r0, [r4] + ldr r4, =0x030009ee + strh r2, [r4] + lsls r5, r1, 12 + lsls r6, r0, 12 + lsls r4, r2, 12 + mov r8, r4 + lsls r7, r1, 8 + str r7, [sp] + lsls r4, r1, 4 + mov r9, r4 + orrs r7, r4 + str r7, [sp, 0x4] + orrs r7, r1 + adds r4, r5, 0 + orrs r4, r7 + strh r4, [r3] + adds r3, 0x2 + adds r4, r6, 0 + orrs r4, r7 + strh r4, [r3] + adds r3, 0x2 + mov r4, r8 + orrs r7, r4 + strh r7, [r3] + adds r3, 0x2 + lsls r7, r0, 8 + mov r10, r7 + mov r4, r10 + mov r7, r9 + orrs r4, r7 + str r4, [sp, 0x8] + adds r7, r4, 0 + orrs r7, r1 + adds r4, r5, 0 + orrs r4, r7 + strh r4, [r3] + adds r3, 0x2 + adds r4, r6, 0 + orrs r4, r7 + strh r4, [r3] + adds r3, 0x2 + mov r4, r8 + orrs r7, r4 + strh r7, [r3] + adds r3, 0x2 + lsls r7, r2, 8 + mov r12, r7 + mov r4, r12 + mov r7, r9 + orrs r4, r7 + str r4, [sp, 0xC] + adds r7, r4, 0 + orrs r7, r1 + adds r4, r5, 0 + orrs r4, r7 + strh r4, [r3] + adds r3, 0x2 + adds r4, r6, 0 + orrs r4, r7 + strh r4, [r3] + adds r3, 0x2 + mov r4, r8 + orrs r7, r4 + strh r7, [r3] + adds r3, 0x2 + lsls r7, r0, 4 + mov r9, r7 + ldr r4, [sp] + orrs r4, r7 + str r4, [sp, 0x10] + adds r7, r4, 0 + orrs r7, r1 + adds r4, r5, 0 + orrs r4, r7 + strh r4, [r3] + adds r3, 0x2 + adds r4, r6, 0 + orrs r4, r7 + strh r4, [r3] + adds r3, 0x2 + mov r4, r8 + orrs r7, r4 + strh r7, [r3] + adds r3, 0x2 + mov r7, r10 + adds r4, r7, 0 + mov r7, r9 + orrs r4, r7 + str r4, [sp, 0x14] + adds r7, r4, 0 + orrs r7, r1 + adds r4, r5, 0 + orrs r4, r7 + strh r4, [r3] + adds r3, 0x2 + adds r4, r6, 0 + orrs r4, r7 + strh r4, [r3] + adds r3, 0x2 + mov r4, r8 + orrs r7, r4 + strh r7, [r3] + adds r3, 0x2 + mov r7, r12 + adds r4, r7, 0 + mov r7, r9 + orrs r4, r7 + str r4, [sp, 0x18] + adds r7, r4, 0 + orrs r7, r1 + adds r4, r5, 0 + orrs r4, r7 + strh r4, [r3] + adds r3, 0x2 + adds r4, r6, 0 + orrs r4, r7 + strh r4, [r3] + adds r3, 0x2 + mov r4, r8 + orrs r7, r4 + strh r7, [r3] + adds r3, 0x2 + lsls r7, r2, 4 + mov r9, r7 + mov r4, r9 + ldr r7, [sp] + orrs r7, r4 + str r7, [sp, 0x1C] + orrs r7, r1 + adds r4, r5, 0 + orrs r4, r7 + strh r4, [r3] + adds r3, 0x2 + adds r4, r6, 0 + orrs r4, r7 + strh r4, [r3] + adds r3, 0x2 + mov r4, r8 + orrs r7, r4 + strh r7, [r3] + adds r3, 0x2 + mov r7, r9 + mov r4, r10 + orrs r4, r7 + str r4, [sp, 0x20] + adds r7, r4, 0 + orrs r7, r1 + adds r4, r5, 0 + orrs r4, r7 + strh r4, [r3] + adds r3, 0x2 + adds r4, r6, 0 + orrs r4, r7 + strh r4, [r3] + adds r3, 0x2 + mov r4, r8 + orrs r7, r4 + strh r7, [r3] + adds r3, 0x2 + mov r4, r12 + mov r7, r9 + orrs r4, r7 + adds r7, r4, 0 + orrs r7, r1 + adds r1, r5, 0 + orrs r1, r7 + strh r1, [r3] + adds r3, 0x2 + adds r1, r6, 0 + orrs r1, r7 + strh r1, [r3] + adds r3, 0x2 + mov r1, r8 + orrs r7, r1 + strh r7, [r3] + adds r3, 0x2 + ldr r7, [sp, 0x4] + orrs r7, r0 + adds r1, r5, 0 + orrs r1, r7 + strh r1, [r3] + adds r3, 0x2 + adds r1, r6, 0 + orrs r1, r7 + strh r1, [r3] + adds r3, 0x2 + mov r1, r8 + orrs r7, r1 + strh r7, [r3] + adds r3, 0x2 + ldr r7, [sp, 0x8] + orrs r7, r0 + adds r1, r5, 0 + orrs r1, r7 + strh r1, [r3] + adds r3, 0x2 + adds r1, r6, 0 + orrs r1, r7 + strh r1, [r3] + adds r3, 0x2 + mov r1, r8 + orrs r7, r1 + strh r7, [r3] + adds r3, 0x2 + ldr r7, [sp, 0xC] + orrs r7, r0 + adds r1, r5, 0 + orrs r1, r7 + strh r1, [r3] + adds r3, 0x2 + adds r1, r6, 0 + orrs r1, r7 + strh r1, [r3] + adds r3, 0x2 + mov r1, r8 + orrs r7, r1 + strh r7, [r3] + adds r3, 0x2 + ldr r7, [sp, 0x10] + orrs r7, r0 + adds r1, r5, 0 + orrs r1, r7 + strh r1, [r3] + adds r3, 0x2 + adds r1, r6, 0 + orrs r1, r7 + strh r1, [r3] + adds r3, 0x2 + mov r1, r8 + orrs r7, r1 + strh r7, [r3] + adds r3, 0x2 + ldr r7, [sp, 0x14] + orrs r7, r0 + adds r1, r5, 0 + orrs r1, r7 + strh r1, [r3] + adds r3, 0x2 + adds r1, r6, 0 + orrs r1, r7 + strh r1, [r3] + adds r3, 0x2 + mov r1, r8 + orrs r7, r1 + strh r7, [r3] + adds r3, 0x2 + ldr r7, [sp, 0x18] + orrs r7, r0 + adds r1, r5, 0 + orrs r1, r7 + strh r1, [r3] + adds r3, 0x2 + adds r1, r6, 0 + orrs r1, r7 + strh r1, [r3] + adds r3, 0x2 + mov r1, r8 + orrs r7, r1 + strh r7, [r3] + adds r3, 0x2 + ldr r7, [sp, 0x1C] + orrs r7, r0 + adds r1, r5, 0 + orrs r1, r7 + strh r1, [r3] + adds r3, 0x2 + adds r1, r6, 0 + orrs r1, r7 + strh r1, [r3] + adds r3, 0x2 + mov r1, r8 + orrs r7, r1 + strh r7, [r3] + adds r3, 0x2 + ldr r7, [sp, 0x20] + orrs r7, r0 + adds r1, r5, 0 + orrs r1, r7 + strh r1, [r3] + adds r3, 0x2 + adds r1, r6, 0 + orrs r1, r7 + strh r1, [r3] + adds r3, 0x2 + mov r1, r8 + orrs r7, r1 + strh r7, [r3] + adds r3, 0x2 + adds r7, r4, 0 + orrs r7, r0 + adds r0, r5, 0 + orrs r0, r7 + strh r0, [r3] + adds r3, 0x2 + adds r0, r6, 0 + orrs r0, r7 + strh r0, [r3] + adds r3, 0x2 + orrs r7, r1 + strh r7, [r3] + adds r3, 0x2 + adds r7, r2, 0 + ldr r0, [sp, 0x4] + orrs r7, r0 + adds r0, r5, 0 + orrs r0, r7 + strh r0, [r3] + adds r3, 0x2 + adds r0, r6, 0 + orrs r0, r7 + strh r0, [r3] + adds r3, 0x2 + orrs r7, r1 + strh r7, [r3] + adds r3, 0x2 + adds r7, r2, 0 + ldr r1, [sp, 0x8] + orrs r7, r1 + adds r0, r5, 0 + orrs r0, r7 + strh r0, [r3] + adds r3, 0x2 + adds r0, r6, 0 + orrs r0, r7 + strh r0, [r3] + adds r3, 0x2 + mov r0, r8 + orrs r7, r0 + strh r7, [r3] + adds r3, 0x2 + adds r7, r2, 0 + ldr r1, [sp, 0xC] + orrs r7, r1 + adds r0, r5, 0 + orrs r0, r7 + strh r0, [r3] + adds r3, 0x2 + adds r0, r6, 0 + orrs r0, r7 + strh r0, [r3] + adds r3, 0x2 + mov r0, r8 + orrs r7, r0 + strh r7, [r3] + adds r3, 0x2 + adds r7, r2, 0 + ldr r1, [sp, 0x10] + orrs r7, r1 + adds r0, r5, 0 + orrs r0, r7 + strh r0, [r3] + adds r3, 0x2 + adds r0, r6, 0 + orrs r0, r7 + strh r0, [r3] + adds r3, 0x2 + mov r0, r8 + orrs r7, r0 + strh r7, [r3] + adds r3, 0x2 + adds r7, r2, 0 + ldr r1, [sp, 0x14] + orrs r7, r1 + adds r0, r5, 0 + orrs r0, r7 + strh r0, [r3] + adds r3, 0x2 + adds r0, r6, 0 + orrs r0, r7 + strh r0, [r3] + adds r3, 0x2 + mov r0, r8 + orrs r7, r0 + strh r7, [r3] + adds r3, 0x2 + adds r7, r2, 0 + ldr r1, [sp, 0x18] + orrs r7, r1 + adds r0, r5, 0 + orrs r0, r7 + strh r0, [r3] + adds r3, 0x2 + adds r0, r6, 0 + orrs r0, r7 + strh r0, [r3] + adds r3, 0x2 + mov r0, r8 + orrs r7, r0 + strh r7, [r3] + adds r3, 0x2 + adds r7, r2, 0 + ldr r1, [sp, 0x1C] + orrs r7, r1 + adds r0, r5, 0 + orrs r0, r7 + strh r0, [r3] + adds r3, 0x2 + adds r0, r6, 0 + orrs r0, r7 + strh r0, [r3] + adds r3, 0x2 + mov r0, r8 + orrs r7, r0 + strh r7, [r3] + adds r3, 0x2 + adds r7, r2, 0 + ldr r1, [sp, 0x20] + orrs r7, r1 + adds r0, r5, 0 + orrs r0, r7 + strh r0, [r3] + adds r3, 0x2 + adds r0, r6, 0 + orrs r0, r7 + strh r0, [r3] + adds r3, 0x2 + mov r0, r8 + orrs r7, r0 + strh r7, [r3] + adds r3, 0x2 + adds r7, r2, 0 + orrs r7, r4 + orrs r5, r7 + strh r5, [r3] + adds r3, 0x2 + orrs r6, r7 + strh r6, [r3] + orrs r0, r7 + strh r0, [r3, 0x2] + add sp, 0x24 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end GenerateFontHalfRowLut + + thumb_func_start save_remo_colors +save_remo_colors: @ 8004BE0 + ldr r3, =0x030009ea + ldrh r3, [r3] + strb r3, [r1] + ldr r1, =0x030009ec + ldrh r1, [r1] + strb r1, [r0] + ldr r0, =0x030009ee + ldrh r0, [r0] + strb r0, [r2] + bx lr + .align 2, 0 + .pool + thumb_func_end save_remo_colors + + thumb_func_start restore_remo_colors +restore_remo_colors: @ 8004C00 + push {lr} + ldrb r0, [r0] + ldrb r1, [r1] + ldrb r2, [r2] + bl GenerateFontHalfRowLut + pop {r0} + bx r0 + thumb_func_end restore_remo_colors + + thumb_func_start font_render_sub +font_render_sub: @ 8004C10 + push {r4-r7,lr} + mov r7, r8 + push {r7} + ldrh r7, [r0] + ldr r5, =0x03000948 + ldr r4, =0x082e958c + movs r2, 0xFF + mov r8, r2 + adds r2, r7, 0 + mov r3, r8 + ands r2, r3 + adds r2, r4 + ldrb r2, [r2] + lsls r2, 1 + adds r2, r5 + ldrh r3, [r2] + lsls r3, 16 + lsrs r2, r7, 8 + adds r2, r4 + ldrb r2, [r2] + lsls r2, 1 + adds r2, r5 + ldrh r2, [r2] + orrs r3, r2 + adds r6, r1, 0 + stm r6!, {r3} + ldrh r7, [r0, 0x2] + adds r0, 0x4 + adds r2, r7, 0 + mov r3, r8 + ands r2, r3 + adds r2, r4 + ldrb r2, [r2] + lsls r2, 1 + adds r2, r5 + ldrh r3, [r2] + lsls r3, 16 + lsrs r2, r7, 8 + adds r2, r4 + ldrb r2, [r2] + lsls r2, 1 + adds r2, r5 + ldrh r2, [r2] + orrs r3, r2 + str r3, [r1, 0x4] + adds r6, 0x4 + ldrh r7, [r0] + adds r0, 0x2 + adds r1, r7, 0 + mov r2, r8 + ands r1, r2 + adds r1, r4 + ldrb r1, [r1] + lsls r1, 1 + adds r1, r5 + ldrh r2, [r1] + lsls r2, 16 + lsrs r1, r7, 8 + adds r1, r4 + ldrb r1, [r1] + lsls r1, 1 + adds r1, r5 + ldrh r1, [r1] + orrs r2, r1 + stm r6!, {r2} + ldrh r7, [r0] + adds r0, 0x2 + adds r1, r7, 0 + mov r3, r8 + ands r1, r3 + adds r1, r4 + ldrb r1, [r1] + lsls r1, 1 + adds r1, r5 + ldrh r2, [r1] + lsls r2, 16 + lsrs r1, r7, 8 + adds r1, r4 + ldrb r1, [r1] + lsls r1, 1 + adds r1, r5 + ldrh r1, [r1] + orrs r2, r1 + stm r6!, {r2} + ldrh r7, [r0] + adds r0, 0x2 + adds r1, r7, 0 + ands r1, r3 + adds r1, r4 + ldrb r1, [r1] + lsls r1, 1 + adds r1, r5 + ldrh r2, [r1] + lsls r2, 16 + lsrs r1, r7, 8 + adds r1, r4 + ldrb r1, [r1] + lsls r1, 1 + adds r1, r5 + ldrh r1, [r1] + orrs r2, r1 + stm r6!, {r2} + ldrh r7, [r0] + adds r0, 0x2 + adds r1, r7, 0 + ands r1, r3 + adds r1, r4 + ldrb r1, [r1] + lsls r1, 1 + adds r1, r5 + ldrh r2, [r1] + lsls r2, 16 + lsrs r1, r7, 8 + adds r1, r4 + ldrb r1, [r1] + lsls r1, 1 + adds r1, r5 + ldrh r1, [r1] + orrs r2, r1 + stm r6!, {r2} + ldrh r7, [r0] + adds r1, r7, 0 + ands r1, r3 + adds r1, r4 + ldrb r1, [r1] + lsls r1, 1 + adds r1, r5 + ldrh r2, [r1] + lsls r2, 16 + lsrs r1, r7, 8 + adds r1, r4 + ldrb r1, [r1] + lsls r1, 1 + adds r1, r5 + ldrh r1, [r1] + orrs r2, r1 + stm r6!, {r2} + ldrh r7, [r0, 0x2] + adds r0, r7, 0 + ands r0, r3 + adds r0, r4 + ldrb r0, [r0] + lsls r0, 1 + adds r0, r5 + ldrh r1, [r0] + lsls r1, 16 + lsrs r0, r7, 8 + adds r0, r4 + ldrb r0, [r0] + lsls r0, 1 + adds r0, r5 + ldrh r0, [r0] + orrs r1, r0 + str r1, [r6] + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end font_render_sub + + thumb_func_start sub_8004D58 +sub_8004D58: @ 8004D58 + push {lr} + lsls r0, 24 + lsrs r0, 24 + adds r1, r0, 0 + cmp r0, 0x1 + beq _08004D8C + cmp r0, 0x1 + bgt _08004D6E + cmp r0, 0 + beq _08004D74 + b _08004D98 +_08004D6E: + cmp r1, 0x2 + beq _08004D80 + b _08004D98 +_08004D74: + ldr r0, =0x030009ec + ldrb r0, [r0] + b _08004D9A + .align 2, 0 + .pool +_08004D80: + ldr r0, =0x030009ea + ldrb r0, [r0] + b _08004D9A + .align 2, 0 + .pool +_08004D8C: + ldr r0, =0x030009ee + ldrb r0, [r0] + b _08004D9A + .align 2, 0 + .pool +_08004D98: + movs r0, 0 +_08004D9A: + pop {r1} + bx r1 + thumb_func_end sub_8004D58 + + thumb_func_start CopyGlyphToWindow +CopyGlyphToWindow: @ 8004DA0 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x8C + adds r3, r0, 0 + ldrb r1, [r3, 0x4] + lsls r0, r1, 1 + adds r0, r1 + lsls r0, 2 + ldr r1, =0x02020004 + adds r1, r0, r1 + adds r2, r1, 0 + ldrb r7, [r1, 0x3] + lsls r0, r7, 3 + ldrb r6, [r3, 0x8] + subs r4, r0, r6 + ldr r5, =0x03002f90 + adds r0, r5, 0 + adds r0, 0x80 + ldrb r0, [r0] + cmp r4, r0 + ble _08004DD2 + adds r4, r0, 0 +_08004DD2: + ldrb r0, [r1, 0x4] + lsls r0, 3 + ldrb r3, [r3, 0x9] + subs r0, r3 + adds r1, r5, 0 + adds r1, 0x81 + ldrb r1, [r1] + cmp r0, r1 + ble _08004DE6 + adds r0, r1, 0 +_08004DE6: + str r6, [sp] + mov r8, r3 + adds r3, r5, 0 + ldr r2, [r2, 0x8] + mov r9, r2 + lsls r1, r7, 5 + str r1, [sp, 0x4] + cmp r4, 0x8 + ble _08004DFA + b _08004F94 +_08004DFA: + cmp r0, 0x8 + bgt _08004E84 + mov r1, r8 + str r3, [sp, 0x8] + adds r2, r6, 0 + adds r2, r4 + mov r8, r2 + adds r0, r1, r0 + str r0, [sp, 0xC] + str r6, [sp, 0x10] + cmp r1, r0 + bcc _08004E14 + b _080052AA +_08004E14: + ldr r3, [sp, 0x8] + ldm r3!, {r5} + str r3, [sp, 0x8] + ldr r4, [sp, 0x10] + adds r0, r1, 0x1 + mov r10, r0 + cmp r4, r8 + bcs _08004E72 + movs r2, 0x7 + mov r12, r2 + lsrs r0, r1, 3 + ldr r2, [sp, 0x4] + adds r3, r0, 0 + muls r3, r2 + adds r7, r3, 0 + mov r3, r12 + ands r1, r3 + lsls r6, r1, 2 +_08004E38: + adds r3, r5, 0 + movs r0, 0xF + ands r3, r0 + cmp r3, 0 + beq _08004E6A + lsrs r2, r4, 3 + lsls r2, 5 + add r2, r9 + adds r0, r4, 0 + mov r1, r12 + ands r0, r1 + lsrs r0, 1 + adds r2, r0 + adds r2, r7 + adds r2, r6 + movs r1, 0x1 + ands r1, r4 + lsls r1, 2 + lsls r3, r1 + movs r0, 0xF0 + asrs r0, r1 + ldrb r1, [r2] + ands r0, r1 + orrs r3, r0 + strb r3, [r2] +_08004E6A: + lsrs r5, 4 + adds r4, 0x1 + cmp r4, r8 + bcc _08004E38 +_08004E72: + mov r1, r10 + ldr r2, [sp, 0xC] + cmp r1, r2 + bcc _08004E14 + b _080052AA + .align 2, 0 + .pool +_08004E84: + mov r1, r8 + str r3, [sp, 0x14] + ldr r3, [sp] + adds r3, r4 + mov r12, r3 + adds r2, r1, 0 + adds r2, 0x8 + str r2, [sp, 0x18] + ldr r3, [sp] + str r3, [sp, 0x1C] + mov r2, r12 + str r2, [sp, 0x74] + ldr r3, [sp, 0x18] + str r3, [sp, 0x88] + subs r0, 0x8 + str r0, [sp, 0x80] + cmp r1, r3 + bcs _08004F0E +_08004EA8: + ldr r0, [sp, 0x14] + ldm r0!, {r5} + str r0, [sp, 0x14] + ldr r4, [sp, 0x1C] + adds r2, r1, 0x1 + mov r8, r2 + cmp r4, r12 + bcs _08004F06 + movs r3, 0x7 + mov r10, r3 + lsrs r0, r1, 3 + ldr r3, [sp, 0x4] + adds r2, r0, 0 + muls r2, r3 + adds r7, r2, 0 + mov r0, r10 + ands r1, r0 + lsls r6, r1, 2 +_08004ECC: + adds r3, r5, 0 + movs r1, 0xF + ands r3, r1 + cmp r3, 0 + beq _08004EFE + lsrs r2, r4, 3 + lsls r2, 5 + add r2, r9 + adds r0, r4, 0 + mov r1, r10 + ands r0, r1 + lsrs r0, 1 + adds r2, r0 + adds r2, r7 + adds r2, r6 + movs r1, 0x1 + ands r1, r4 + lsls r1, 2 + lsls r3, r1 + movs r0, 0xF0 + asrs r0, r1 + ldrb r1, [r2] + ands r0, r1 + orrs r3, r0 + strb r3, [r2] +_08004EFE: + lsrs r5, 4 + adds r4, 0x1 + cmp r4, r12 + bcc _08004ECC +_08004F06: + mov r1, r8 + ldr r2, [sp, 0x18] + cmp r1, r2 + bcc _08004EA8 +_08004F0E: + ldr r1, [sp, 0x88] + ldr r3, =0x03002fd0 + str r3, [sp, 0x20] + ldr r0, [sp, 0x74] + mov r8, r0 + ldr r2, [sp, 0x80] + adds r2, r1, r2 + str r2, [sp, 0x24] + ldr r3, [sp] + str r3, [sp, 0x28] + cmp r1, r2 + bcc _08004F28 + b _080052AA +_08004F28: + ldr r0, [sp, 0x20] + ldm r0!, {r5} + str r0, [sp, 0x20] + ldr r4, [sp, 0x28] + adds r2, r1, 0x1 + mov r10, r2 + cmp r4, r8 + bcs _08004F86 + movs r3, 0x7 + mov r12, r3 + lsrs r0, r1, 3 + ldr r3, [sp, 0x4] + adds r2, r0, 0 + muls r2, r3 + adds r7, r2, 0 + mov r0, r12 + ands r1, r0 + lsls r6, r1, 2 +_08004F4C: + adds r3, r5, 0 + movs r1, 0xF + ands r3, r1 + cmp r3, 0 + beq _08004F7E + lsrs r2, r4, 3 + lsls r2, 5 + add r2, r9 + adds r0, r4, 0 + mov r1, r12 + ands r0, r1 + lsrs r0, 1 + adds r2, r0 + adds r2, r7 + adds r2, r6 + movs r1, 0x1 + ands r1, r4 + lsls r1, 2 + lsls r3, r1 + movs r0, 0xF0 + asrs r0, r1 + ldrb r1, [r2] + ands r0, r1 + orrs r3, r0 + strb r3, [r2] +_08004F7E: + lsrs r5, 4 + adds r4, 0x1 + cmp r4, r8 + bcc _08004F4C +_08004F86: + mov r1, r10 + ldr r2, [sp, 0x24] + cmp r1, r2 + bcc _08004F28 + b _080052AA + .align 2, 0 + .pool +_08004F94: + cmp r0, 0x8 + ble _08004F9A + b _080050A4 +_08004F9A: + mov r1, r8 + str r3, [sp, 0x2C] + ldr r3, [sp] + adds r3, 0x8 + mov r12, r3 + add r0, r8 + str r0, [sp, 0x30] + ldr r0, [sp] + str r0, [sp, 0x34] + ldr r2, [sp, 0x30] + str r2, [sp, 0x78] + str r3, [sp, 0x84] + subs r4, 0x8 + str r4, [sp, 0x7C] + cmp r8, r2 + bcs _0800501C +_08004FBA: + ldr r0, [sp, 0x2C] + ldm r0!, {r5} + str r0, [sp, 0x2C] + ldr r4, [sp, 0x34] + adds r2, r1, 0x1 + mov r10, r2 + cmp r4, r12 + bcs _08005014 + lsrs r0, r1, 3 + ldr r2, [sp, 0x4] + adds r3, r0, 0 + muls r3, r2 + adds r7, r3, 0 + movs r3, 0x7 + ands r1, r3 + lsls r6, r1, 2 +_08004FDA: + adds r3, r5, 0 + movs r0, 0xF + ands r3, r0 + cmp r3, 0 + beq _0800500C + lsrs r2, r4, 3 + lsls r2, 5 + add r2, r9 + adds r0, r4, 0 + movs r1, 0x7 + ands r0, r1 + lsrs r0, 1 + adds r2, r0 + adds r2, r7 + adds r2, r6 + movs r1, 0x1 + ands r1, r4 + lsls r1, 2 + lsls r3, r1 + movs r0, 0xF0 + asrs r0, r1 + ldrb r1, [r2] + ands r0, r1 + orrs r3, r0 + strb r3, [r2] +_0800500C: + lsrs r5, 4 + adds r4, 0x1 + cmp r4, r12 + bcc _08004FDA +_08005014: + mov r1, r10 + ldr r2, [sp, 0x30] + cmp r1, r2 + bcc _08004FBA +_0800501C: + mov r1, r8 + ldr r3, =0x03002fb0 + str r3, [sp, 0x38] + ldr r0, [sp, 0x84] + ldr r2, [sp, 0x7C] + adds r0, r2 + mov r8, r0 + ldr r3, [sp, 0x78] + str r3, [sp, 0x3C] + ldr r0, [sp, 0x84] + str r0, [sp, 0x40] + cmp r1, r3 + bcc _08005038 + b _080052AA +_08005038: + ldr r2, [sp, 0x38] + ldm r2!, {r5} + str r2, [sp, 0x38] + ldr r4, [sp, 0x40] + adds r3, r1, 0x1 + mov r10, r3 + cmp r4, r8 + bcs _08005096 + movs r0, 0x7 + mov r12, r0 + lsrs r0, r1, 3 + ldr r3, [sp, 0x4] + adds r2, r0, 0 + muls r2, r3 + adds r7, r2, 0 + mov r0, r12 + ands r1, r0 + lsls r6, r1, 2 +_0800505C: + adds r3, r5, 0 + movs r1, 0xF + ands r3, r1 + cmp r3, 0 + beq _0800508E + lsrs r2, r4, 3 + lsls r2, 5 + add r2, r9 + adds r0, r4, 0 + mov r1, r12 + ands r0, r1 + lsrs r0, 1 + adds r2, r0 + adds r2, r7 + adds r2, r6 + movs r1, 0x1 + ands r1, r4 + lsls r1, 2 + lsls r3, r1 + movs r0, 0xF0 + asrs r0, r1 + ldrb r1, [r2] + ands r0, r1 + orrs r3, r0 + strb r3, [r2] +_0800508E: + lsrs r5, 4 + adds r4, 0x1 + cmp r4, r8 + bcc _0800505C +_08005096: + mov r1, r10 + ldr r2, [sp, 0x3C] + cmp r1, r2 + bcc _08005038 + b _080052AA + .align 2, 0 + .pool +_080050A4: + mov r1, r8 + str r5, [sp, 0x44] + ldr r3, [sp] + adds r3, 0x8 + mov r12, r3 + mov r2, r8 + adds r2, 0x8 + str r2, [sp, 0x48] + ldr r3, [sp] + str r3, [sp, 0x4C] + str r2, [sp, 0x88] + subs r0, 0x8 + str r0, [sp, 0x80] + mov r0, r12 + str r0, [sp, 0x84] + subs r4, 0x8 + str r4, [sp, 0x7C] + cmp r8, r2 + bcs _0800512C +_080050CA: + ldr r2, [sp, 0x44] + ldm r2!, {r5} + str r2, [sp, 0x44] + ldr r4, [sp, 0x4C] + adds r3, r1, 0x1 + mov r10, r3 + cmp r4, r12 + bcs _08005124 + lsrs r0, r1, 3 + ldr r3, [sp, 0x4] + adds r2, r0, 0 + muls r2, r3 + adds r7, r2, 0 + movs r0, 0x7 + ands r1, r0 + lsls r6, r1, 2 +_080050EA: + adds r3, r5, 0 + movs r1, 0xF + ands r3, r1 + cmp r3, 0 + beq _0800511C + lsrs r2, r4, 3 + lsls r2, 5 + add r2, r9 + adds r0, r4, 0 + movs r1, 0x7 + ands r0, r1 + lsrs r0, 1 + adds r2, r0 + adds r2, r7 + adds r2, r6 + movs r1, 0x1 + ands r1, r4 + lsls r1, 2 + lsls r3, r1 + movs r0, 0xF0 + asrs r0, r1 + ldrb r1, [r2] + ands r0, r1 + orrs r3, r0 + strb r3, [r2] +_0800511C: + lsrs r5, 4 + adds r4, 0x1 + cmp r4, r12 + bcc _080050EA +_08005124: + mov r1, r10 + ldr r2, [sp, 0x48] + cmp r1, r2 + bcc _080050CA +_0800512C: + mov r1, r8 + ldr r3, =0x03002fb0 + str r3, [sp, 0x50] + ldr r0, [sp, 0x84] + ldr r2, [sp, 0x7C] + adds r0, r2 + mov r8, r0 + ldr r3, [sp, 0x88] + str r3, [sp, 0x54] + ldr r0, [sp, 0x84] + str r0, [sp, 0x58] + cmp r1, r3 + bcs _080051AC +_08005146: + ldr r2, [sp, 0x50] + ldm r2!, {r5} + str r2, [sp, 0x50] + ldr r4, [sp, 0x58] + adds r3, r1, 0x1 + mov r10, r3 + cmp r4, r8 + bcs _080051A4 + movs r0, 0x7 + mov r12, r0 + lsrs r0, r1, 3 + ldr r3, [sp, 0x4] + adds r2, r0, 0 + muls r2, r3 + adds r7, r2, 0 + mov r0, r12 + ands r1, r0 + lsls r6, r1, 2 +_0800516A: + adds r3, r5, 0 + movs r1, 0xF + ands r3, r1 + cmp r3, 0 + beq _0800519C + lsrs r2, r4, 3 + lsls r2, 5 + add r2, r9 + adds r0, r4, 0 + mov r1, r12 + ands r0, r1 + lsrs r0, 1 + adds r2, r0 + adds r2, r7 + adds r2, r6 + movs r1, 0x1 + ands r1, r4 + lsls r1, 2 + lsls r3, r1 + movs r0, 0xF0 + asrs r0, r1 + ldrb r1, [r2] + ands r0, r1 + orrs r3, r0 + strb r3, [r2] +_0800519C: + lsrs r5, 4 + adds r4, 0x1 + cmp r4, r8 + bcc _0800516A +_080051A4: + mov r1, r10 + ldr r2, [sp, 0x54] + cmp r1, r2 + bcc _08005146 +_080051AC: + ldr r1, [sp, 0x88] + ldr r3, =0x03002fd0 + str r3, [sp, 0x5C] + ldr r0, [sp, 0x84] + mov r8, r0 + ldr r2, [sp, 0x80] + adds r2, r1, r2 + str r2, [sp, 0x60] + ldr r3, [sp] + str r3, [sp, 0x64] + cmp r1, r2 + bcs _0800522A +_080051C4: + ldr r0, [sp, 0x5C] + ldm r0!, {r5} + str r0, [sp, 0x5C] + ldr r4, [sp, 0x64] + adds r2, r1, 0x1 + mov r10, r2 + cmp r4, r8 + bcs _08005222 + movs r3, 0x7 + mov r12, r3 + lsrs r0, r1, 3 + ldr r3, [sp, 0x4] + adds r2, r0, 0 + muls r2, r3 + adds r7, r2, 0 + mov r0, r12 + ands r1, r0 + lsls r6, r1, 2 +_080051E8: + adds r3, r5, 0 + movs r1, 0xF + ands r3, r1 + cmp r3, 0 + beq _0800521A + lsrs r2, r4, 3 + lsls r2, 5 + add r2, r9 + adds r0, r4, 0 + mov r1, r12 + ands r0, r1 + lsrs r0, 1 + adds r2, r0 + adds r2, r7 + adds r2, r6 + movs r1, 0x1 + ands r1, r4 + lsls r1, 2 + lsls r3, r1 + movs r0, 0xF0 + asrs r0, r1 + ldrb r1, [r2] + ands r0, r1 + orrs r3, r0 + strb r3, [r2] +_0800521A: + lsrs r5, 4 + adds r4, 0x1 + cmp r4, r8 + bcc _080051E8 +_08005222: + mov r1, r10 + ldr r2, [sp, 0x60] + cmp r1, r2 + bcc _080051C4 +_0800522A: + ldr r4, [sp, 0x84] + ldr r1, [sp, 0x88] + ldr r3, =0x03002ff0 + str r3, [sp, 0x68] + ldr r0, [sp, 0x7C] + adds r0, r4 + mov r8, r0 + ldr r2, [sp, 0x80] + adds r2, r1, r2 + str r2, [sp, 0x6C] + str r4, [sp, 0x70] + cmp r1, r2 + bcs _080052AA +_08005244: + ldr r3, [sp, 0x68] + ldm r3!, {r5} + str r3, [sp, 0x68] + ldr r4, [sp, 0x70] + adds r0, r1, 0x1 + mov r10, r0 + cmp r4, r8 + bcs _080052A2 + movs r2, 0x7 + mov r12, r2 + lsrs r0, r1, 3 + ldr r2, [sp, 0x4] + adds r3, r0, 0 + muls r3, r2 + adds r7, r3, 0 + mov r3, r12 + ands r1, r3 + lsls r6, r1, 2 +_08005268: + adds r3, r5, 0 + movs r0, 0xF + ands r3, r0 + cmp r3, 0 + beq _0800529A + lsrs r2, r4, 3 + lsls r2, 5 + add r2, r9 + adds r0, r4, 0 + mov r1, r12 + ands r0, r1 + lsrs r0, 1 + adds r2, r0 + adds r2, r7 + adds r2, r6 + movs r1, 0x1 + ands r1, r4 + lsls r1, 2 + lsls r3, r1 + movs r0, 0xF0 + asrs r0, r1 + ldrb r1, [r2] + ands r0, r1 + orrs r3, r0 + strb r3, [r2] +_0800529A: + lsrs r5, 4 + adds r4, 0x1 + cmp r4, r8 + bcc _08005268 +_080052A2: + mov r1, r10 + ldr r2, [sp, 0x6C] + cmp r1, r2 + bcc _08005244 +_080052AA: + add sp, 0x8C + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end CopyGlyphToWindow + + thumb_func_start Text_ClearHorizontalSpan +Text_ClearHorizontalSpan: @ 80052C8 + push {r4-r6,lr} + sub sp, 0x10 + adds r4, r0, 0 + adds r6, r1, 0 + ldr r0, =0x030009ea + ldrh r5, [r0] + cmp r5, 0 + beq _0800531E + ldrb r1, [r4, 0x4] + lsls r0, r1, 1 + adds r0, r1 + lsls r0, 2 + ldr r1, =0x02020004 + adds r0, r1 + ldr r1, [r0, 0x8] + str r1, [sp, 0x8] + ldrb r2, [r0, 0x3] + lsls r2, 3 + ldr r3, =0xffff0000 + ldr r1, [sp, 0xC] + ands r1, r3 + orrs r1, r2 + str r1, [sp, 0xC] + ldrb r2, [r0, 0x4] + lsls r2, 19 + ldr r0, =0x0000ffff + ands r0, r1 + orrs r0, r2 + str r0, [sp, 0xC] + ldr r0, =0x03002f90 + adds r0, 0x81 + ldrb r1, [r4, 0x8] + ldrb r2, [r4, 0x9] + lsls r3, r6, 16 + lsrs r3, 16 + ldrb r0, [r0] + str r0, [sp] + lsls r0, r5, 24 + lsrs r0, 24 + str r0, [sp, 0x4] + add r0, sp, 0x8 + bl PixelBlock_FillRect4Bpp +_0800531E: + add sp, 0x10 + pop {r4-r6} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end Text_ClearHorizontalSpan + + thumb_func_start fbox0_func +fbox0_func: @ 800533C + push {lr} + adds r2, r0, 0 + adds r3, r2, 0 + adds r3, 0x14 + ldrb r1, [r3, 0x1] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + bne _08005360 + ldrb r1, [r2, 0x14] + movs r0, 0x10 + negs r0, r0 + ands r0, r1 + strb r0, [r2, 0x14] + ldrb r0, [r3, 0x1] + movs r1, 0x80 + orrs r0, r1 + strb r0, [r3, 0x1] +_08005360: + adds r0, r2, 0 + bl font_render_b + lsls r0, 16 + lsrs r0, 16 + pop {r1} + bx r1 + thumb_func_end fbox0_func + + thumb_func_start fbox1_func +fbox1_func: @ 8005370 + push {lr} + adds r2, r0, 0 + adds r3, r2, 0 + adds r3, 0x14 + ldrb r1, [r3, 0x1] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + bne _08005398 + ldrb r1, [r2, 0x14] + movs r0, 0x10 + negs r0, r0 + ands r0, r1 + movs r1, 0x1 + orrs r0, r1 + strb r0, [r2, 0x14] + ldrb r0, [r3, 0x1] + movs r1, 0x80 + orrs r0, r1 + strb r0, [r3, 0x1] +_08005398: + adds r0, r2, 0 + bl font_render_b + lsls r0, 16 + lsrs r0, 16 + pop {r1} + bx r1 + thumb_func_end fbox1_func + + thumb_func_start fbox2_func +fbox2_func: @ 80053A8 + push {lr} + adds r2, r0, 0 + adds r3, r2, 0 + adds r3, 0x14 + ldrb r1, [r3, 0x1] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + bne _080053D0 + ldrb r1, [r2, 0x14] + movs r0, 0x10 + negs r0, r0 + ands r0, r1 + movs r1, 0x2 + orrs r0, r1 + strb r0, [r2, 0x14] + ldrb r0, [r3, 0x1] + movs r1, 0x80 + orrs r0, r1 + strb r0, [r3, 0x1] +_080053D0: + adds r0, r2, 0 + bl font_render_b + lsls r0, 16 + lsrs r0, 16 + pop {r1} + bx r1 + thumb_func_end fbox2_func + + thumb_func_start fbox3_func +fbox3_func: @ 80053E0 + push {lr} + adds r2, r0, 0 + adds r3, r2, 0 + adds r3, 0x14 + ldrb r1, [r3, 0x1] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + bne _08005408 + ldrb r1, [r2, 0x14] + movs r0, 0x10 + negs r0, r0 + ands r0, r1 + movs r1, 0x3 + orrs r0, r1 + strb r0, [r2, 0x14] + ldrb r0, [r3, 0x1] + movs r1, 0x80 + orrs r0, r1 + strb r0, [r3, 0x1] +_08005408: + adds r0, r2, 0 + bl font_render_b + lsls r0, 16 + lsrs r0, 16 + pop {r1} + bx r1 + thumb_func_end fbox3_func + + thumb_func_start fbox4_func +fbox4_func: @ 8005418 + push {lr} + adds r2, r0, 0 + adds r3, r2, 0 + adds r3, 0x14 + ldrb r1, [r3, 0x1] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + bne _08005440 + ldrb r1, [r2, 0x14] + movs r0, 0x10 + negs r0, r0 + ands r0, r1 + movs r1, 0x4 + orrs r0, r1 + strb r0, [r2, 0x14] + ldrb r0, [r3, 0x1] + movs r1, 0x80 + orrs r0, r1 + strb r0, [r3, 0x1] +_08005440: + adds r0, r2, 0 + bl font_render_b + lsls r0, 16 + lsrs r0, 16 + pop {r1} + bx r1 + thumb_func_end fbox4_func + + thumb_func_start fbox5_func +fbox5_func: @ 8005450 + push {lr} + adds r2, r0, 0 + adds r3, r2, 0 + adds r3, 0x14 + ldrb r1, [r3, 0x1] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + bne _08005478 + ldrb r1, [r2, 0x14] + movs r0, 0x10 + negs r0, r0 + ands r0, r1 + movs r1, 0x5 + orrs r0, r1 + strb r0, [r2, 0x14] + ldrb r0, [r3, 0x1] + movs r1, 0x80 + orrs r0, r1 + strb r0, [r3, 0x1] +_08005478: + adds r0, r2, 0 + bl font_render_b + lsls r0, 16 + lsrs r0, 16 + pop {r1} + bx r1 + thumb_func_end fbox5_func + + thumb_func_start fbox7_func +fbox7_func: @ 8005488 + push {lr} + adds r2, r0, 0 + adds r3, r2, 0 + adds r3, 0x14 + ldrb r1, [r3, 0x1] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + bne _080054B0 + ldrb r1, [r2, 0x14] + movs r0, 0x10 + negs r0, r0 + ands r0, r1 + movs r1, 0x7 + orrs r0, r1 + strb r0, [r2, 0x14] + ldrb r0, [r3, 0x1] + movs r1, 0x80 + orrs r0, r1 + strb r0, [r3, 0x1] +_080054B0: + adds r0, r2, 0 + bl font_render_b + lsls r0, 16 + lsrs r0, 16 + pop {r1} + bx r1 + thumb_func_end fbox7_func + + thumb_func_start fbox8_func +fbox8_func: @ 80054C0 + push {lr} + adds r2, r0, 0 + adds r3, r2, 0 + adds r3, 0x14 + ldrb r1, [r3, 0x1] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + bne _080054E8 + ldrb r1, [r2, 0x14] + movs r0, 0x10 + negs r0, r0 + ands r0, r1 + movs r1, 0x8 + orrs r0, r1 + strb r0, [r2, 0x14] + ldrb r0, [r3, 0x1] + movs r1, 0x80 + orrs r0, r1 + strb r0, [r3, 0x1] +_080054E8: + adds r0, r2, 0 + bl font_render_b + lsls r0, 16 + lsrs r0, 16 + pop {r1} + bx r1 + thumb_func_end fbox8_func + + thumb_func_start sub_80054F8 +sub_80054F8: @ 80054F8 + push {lr} + adds r2, r0, 0 + adds r2, 0x14 + ldr r0, =0x03003014 + ldrb r1, [r0] + movs r0, 0x4 + ands r0, r1 + cmp r0, 0 + beq _08005514 + movs r0, 0 + strb r0, [r2, 0x2] + b _08005524 + .align 2, 0 + .pool +_08005514: + ldrb r0, [r2, 0x1] + movs r1, 0x61 + negs r1, r1 + ands r1, r0 + movs r0, 0x20 + negs r0, r0 + ands r1, r0 + strb r1, [r2, 0x1] +_08005524: + pop {r0} + bx r0 + thumb_func_end sub_80054F8 + + thumb_func_start remo_draw_bouncing_down_arrow +remo_draw_bouncing_down_arrow: @ 8005528 + push {r4-r7,lr} + sub sp, 0x18 + adds r5, r0, 0 + adds r6, r5, 0 + adds r6, 0x14 + ldr r7, =0x03003014 + ldrb r1, [r7] + movs r0, 0x4 + ands r0, r1 + cmp r0, 0 + bne _080055EE + ldrb r2, [r6, 0x1] + movs r0, 0x1F + ands r0, r2 + cmp r0, 0 + beq _08005560 + ldr r0, [r5, 0x14] + lsls r0, 19 + lsrs r0, 27 + subs r0, 0x1 + movs r1, 0x1F + ands r0, r1 + movs r1, 0x20 + negs r1, r1 + b _080055E8 + .align 2, 0 + .pool +_08005560: + ldrb r0, [r5, 0x4] + ldrb r2, [r5, 0xD] + lsls r2, 28 + lsrs r1, r2, 4 + orrs r1, r2 + lsrs r1, 24 + ldrb r2, [r5, 0x8] + ldrb r3, [r5, 0x9] + movs r4, 0x8 + str r4, [sp] + movs r4, 0x10 + str r4, [sp, 0x4] + bl Window_FillPixelRect + ldr r0, [r7] + lsls r0, 30 + lsrs r0, 31 + cmp r0, 0 + beq _0800558A + cmp r0, 0x1 + beq _08005594 +_0800558A: + ldr r7, =0x082e968c + b _08005596 + .align 2, 0 + .pool +_08005594: + ldr r7, =0x082e974c +_08005596: + ldrb r0, [r5, 0x4] + ldr r2, =0x082e9d0c + ldr r1, [r6] + lsls r1, 17 + lsrs r1, 30 + adds r1, r2 + ldrb r3, [r1] + movs r4, 0x8 + str r4, [sp] + movs r2, 0x10 + str r2, [sp, 0x4] + ldrb r1, [r5, 0x8] + str r1, [sp, 0x8] + ldrb r1, [r5, 0x9] + str r1, [sp, 0xC] + str r4, [sp, 0x10] + str r2, [sp, 0x14] + adds r1, r7, 0 + movs r2, 0 + bl Window_CopyPixelRectToWindow + ldrb r0, [r5, 0x4] + movs r1, 0x2 + bl Window_CopyToVram + ldrb r0, [r6, 0x1] + movs r1, 0x20 + negs r1, r1 + ands r1, r0 + movs r0, 0x8 + orrs r1, r0 + strb r1, [r6, 0x1] + ldr r0, [r6] + lsls r0, 17 + lsrs r0, 30 + adds r0, 0x1 + movs r2, 0x3 + ands r0, r2 + lsls r0, 5 + movs r2, 0x61 + negs r2, r2 +_080055E8: + ands r1, r2 + orrs r1, r0 + strb r1, [r6, 0x1] +_080055EE: + add sp, 0x18 + pop {r4-r7} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end remo_draw_bouncing_down_arrow + + thumb_func_start remo_clear_down_arrow +remo_clear_down_arrow: @ 8005600 + push {r4,r5,lr} + sub sp, 0x8 + adds r5, r0, 0 + ldrb r0, [r5, 0x4] + ldrb r2, [r5, 0xD] + lsls r2, 28 + lsrs r1, r2, 4 + orrs r1, r2 + lsrs r1, 24 + ldrb r2, [r5, 0x8] + ldrb r3, [r5, 0x9] + movs r4, 0x8 + str r4, [sp] + movs r4, 0x10 + str r4, [sp, 0x4] + bl Window_FillPixelRect + ldrb r0, [r5, 0x4] + movs r1, 0x2 + bl Window_CopyToVram + add sp, 0x8 + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end remo_clear_down_arrow + + thumb_func_start remo_is_it_time_to_continue_autopilot +remo_is_it_time_to_continue_autopilot: @ 8005634 + push {lr} + adds r1, r0, 0 + adds r1, 0x14 + ldrb r0, [r1, 0x2] + cmp r0, 0x31 + beq _08005648 + adds r0, 0x1 + strb r0, [r1, 0x2] + movs r0, 0 + b _0800564A +_08005648: + movs r0, 0x1 +_0800564A: + pop {r1} + bx r1 + thumb_func_end remo_is_it_time_to_continue_autopilot + + thumb_func_start remo_is_it_time_to_continue_plus_down_arrow +remo_is_it_time_to_continue_plus_down_arrow: @ 8005650 + push {r4,lr} + adds r2, r0, 0 + movs r4, 0 + ldr r0, =0x03003014 + ldrb r1, [r0] + movs r0, 0x4 + ands r0, r1 + cmp r0, 0 + beq _08005674 + adds r0, r2, 0 + bl remo_is_it_time_to_continue_autopilot + lsls r0, 24 + lsrs r4, r0, 24 + b _0800568E + .align 2, 0 + .pool +_08005674: + adds r0, r2, 0 + bl remo_draw_bouncing_down_arrow + ldr r0, =0x030022c0 + ldrh r1, [r0, 0x2E] + movs r0, 0x3 + ands r0, r1 + cmp r0, 0 + beq _0800568E + movs r4, 0x1 + movs r0, 0x5 + bl audio_play +_0800568E: + adds r0, r4, 0 + pop {r4} + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end remo_is_it_time_to_continue_plus_down_arrow + + thumb_func_start remo_is_it_time_to_continue +remo_is_it_time_to_continue: @ 800569C + push {r4,lr} + adds r2, r0, 0 + movs r4, 0 + ldr r0, =0x03003014 + ldrb r1, [r0] + movs r0, 0x4 + ands r0, r1 + cmp r0, 0 + beq _080056C0 + adds r0, r2, 0 + bl remo_is_it_time_to_continue_autopilot + lsls r0, 24 + lsrs r4, r0, 24 + b _080056D4 + .align 2, 0 + .pool +_080056C0: + ldr r0, =0x030022c0 + ldrh r1, [r0, 0x2E] + movs r0, 0x3 + ands r0, r1 + cmp r0, 0 + beq _080056D4 + movs r4, 0x1 + movs r0, 0x5 + bl audio_play +_080056D4: + adds r0, r4, 0 + pop {r4} + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end remo_is_it_time_to_continue + + thumb_func_start draw_bouncing_down_arrow_2 +draw_bouncing_down_arrow_2: @ 80056E0 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x18 + ldr r4, [sp, 0x38] + ldr r5, [sp, 0x3C] + mov r9, r5 + ldr r5, [sp, 0x40] + mov r10, r5 + lsls r0, 24 + lsrs r5, r0, 24 + lsls r1, 16 + lsrs r1, 16 + mov r8, r1 + lsls r2, 16 + lsrs r7, r2, 16 + lsls r3, 24 + lsrs r3, 24 + lsls r4, 24 + lsrs r4, 24 + mov r1, r9 + ldrb r0, [r1] + cmp r0, 0 + beq _0800571A + subs r0, 0x1 + strb r0, [r1] + b _0800579A +_0800571A: + lsls r1, r3, 4 + orrs r1, r3 + lsls r1, 24 + lsrs r1, 24 + movs r0, 0x8 + str r0, [sp] + movs r0, 0x10 + str r0, [sp, 0x4] + adds r0, r5, 0 + mov r2, r8 + adds r3, r7, 0 + bl Window_FillPixelRect + cmp r4, 0 + bne _0800579A + ldr r0, =0x03003014 + ldr r0, [r0] + lsls r0, 30 + lsrs r0, 31 + cmp r0, 0 + beq _08005748 + cmp r0, 0x1 + beq _08005754 +_08005748: + ldr r6, =0x082e968c + b _08005756 + .align 2, 0 + .pool +_08005754: + ldr r6, =0x082e974c +_08005756: + ldr r2, =0x082e9d0c + mov r0, r10 + ldrb r1, [r0] + movs r0, 0x3 + ands r0, r1 + adds r0, r2 + ldrb r3, [r0] + movs r4, 0x8 + str r4, [sp] + movs r1, 0x10 + str r1, [sp, 0x4] + mov r0, r8 + str r0, [sp, 0x8] + subs r0, r7, 0x2 + lsls r0, 16 + lsrs r0, 16 + str r0, [sp, 0xC] + str r4, [sp, 0x10] + str r1, [sp, 0x14] + adds r0, r5, 0 + adds r1, r6, 0 + movs r2, 0 + bl Window_CopyPixelRectToWindow + adds r0, r5, 0 + movs r1, 0x2 + bl Window_CopyToVram + mov r1, r9 + strb r4, [r1] + mov r5, r10 + ldrb r0, [r5] + adds r0, 0x1 + strb r0, [r5] +_0800579A: + add sp, 0x18 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end draw_bouncing_down_arrow_2 + + thumb_func_start font_render_b +font_render_b: @ 80057B4 + push {r4-r6,lr} + adds r6, r0, 0 + adds r4, r6, 0 + adds r4, 0x14 + ldrb r0, [r6, 0x1C] + cmp r0, 0x6 + bls _080057C4 + b _08005D6C +_080057C4: + lsls r0, 2 + ldr r1, =_080057D4 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .align 2, 0 + .pool + .align 2, 0 +_080057D4: + .4byte _080057F0 + .4byte _08005C78 + .4byte _08005C8C + .4byte _08005CB8 + .4byte _08005CF0 + .4byte _08005D48 + .4byte _08005D5A +_080057F0: + ldr r2, =0x030022c0 + ldrh r1, [r2, 0x2C] + movs r0, 0x3 + ands r0, r1 + cmp r0, 0 + beq _0800580A + ldrb r1, [r4] + movs r0, 0x10 + ands r0, r1 + cmp r0, 0 + beq _0800580A + movs r0, 0 + strb r0, [r6, 0x1E] +_0800580A: + ldrb r1, [r6, 0x1E] + cmp r1, 0 + beq _0800584C + ldrb r0, [r6, 0x1D] + cmp r0, 0 + beq _0800584C + subs r0, r1, 0x1 + strb r0, [r6, 0x1E] + ldr r0, =0x03003014 + ldrb r1, [r0] + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + bne _08005828 + b _08005B56 +_08005828: + ldrh r1, [r2, 0x2E] + movs r0, 0x3 + ands r0, r1 + cmp r0, 0 + bne _08005834 + b _08005B56 +_08005834: + ldrb r0, [r4] + movs r1, 0x10 + orrs r0, r1 + strb r0, [r4] + movs r0, 0 + strb r0, [r6, 0x1E] + b _08005B56 + .align 2, 0 + .pool +_0800584C: + ldr r0, =0x02022fec + ldr r0, [r0] + movs r1, 0x80 + lsls r1, 17 + ands r0, r1 + cmp r0, 0 + bne _08005874 + ldr r0, =0x03003014 + ldrb r1, [r0] + movs r0, 0x4 + ands r0, r1 + cmp r0, 0 + beq _08005874 + movs r0, 0x3 + b _08005876 + .align 2, 0 + .pool +_08005874: + ldrb r0, [r6, 0x1D] +_08005876: + strb r0, [r6, 0x1E] + ldr r0, [r6] + ldrb r3, [r0] + adds r0, 0x1 + str r0, [r6] + adds r0, r3, 0 + subs r0, 0xF8 + cmp r0, 0x7 + bls _0800588A + b _08005B90 +_0800588A: + lsls r0, 2 + ldr r1, =_08005898 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .align 2, 0 + .pool + .align 2, 0 +_08005898: + .4byte _08005B6C + .4byte _08005B5A + .4byte _08005B4C + .4byte _08005B48 + .4byte _080058E0 + .4byte _080058DC + .4byte _080058B8 + .4byte _08005D6C +_080058B8: + ldrb r0, [r6, 0x6] + strb r0, [r6, 0x8] + ldrb r1, [r6, 0x5] + ldr r0, =0x03002f80 + ldr r2, [r0] + lsls r0, r1, 1 + adds r0, r1 + lsls r0, 2 + adds r0, r2 + ldrb r1, [r6, 0xB] + ldrb r0, [r0, 0x5] + adds r1, r0 + ldrb r0, [r6, 0x9] + adds r0, r1 + b _08005ABA + .align 2, 0 + .pool +_080058DC: + ldr r0, [r6] + b _08005B30 +_080058E0: + ldr r0, [r6] + ldrb r3, [r0] + adds r0, 0x1 + str r0, [r6] + subs r0, r3, 0x1 + cmp r0, 0x17 + bls _080058F0 + b _08005B90 +_080058F0: + lsls r0, 2 + ldr r1, =_08005900 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .align 2, 0 + .pool + .align 2, 0 +_08005900: + .4byte _08005960 + .4byte _08005982 + .4byte _080059A6 + .4byte _080059C0 + .4byte _08005A0E + .4byte _08005A12 + .4byte _08005A0A + .4byte _08005A2A + .4byte _08005A3A + .4byte _08005A58 + .4byte _08005A5C + .4byte _08005B5A + .4byte _08005A90 + .4byte _08005A98 + .4byte _08005AA4 + .4byte _08005A76 + .4byte _08005AD8 + .4byte _08005AF2 + .4byte _08005B02 + .4byte _08005B26 + .4byte _08005B36 + .4byte _08005B3E + .4byte _08005ABE + .4byte _08005ACC +_08005960: + ldr r2, [r6] + ldrb r1, [r2] + lsls r1, 4 + ldrb r3, [r6, 0xC] + movs r0, 0xF + ands r0, r3 + orrs r0, r1 + strb r0, [r6, 0xC] + adds r2, 0x1 + str r2, [r6] + lsls r0, 24 + lsrs r0, 28 + ldrb r2, [r6, 0xD] + lsls r1, r2, 28 + lsrs r1, 28 + lsrs r2, 4 + b _08005A06 +_08005982: + ldr r1, [r6] + ldrb r2, [r1] + movs r0, 0xF + ands r0, r2 + ldrb r3, [r6, 0xD] + movs r2, 0x10 + negs r2, r2 + ands r2, r3 + orrs r2, r0 + strb r2, [r6, 0xD] + adds r1, 0x1 + str r1, [r6] + ldrb r0, [r6, 0xC] + lsrs r0, 4 + lsls r1, r2, 28 + lsrs r1, 28 + lsrs r2, 4 + b _08005A06 +_080059A6: + ldr r1, [r6] + ldrb r0, [r1] + lsls r0, 4 + ldrb r3, [r6, 0xD] + movs r2, 0xF + ands r2, r3 + orrs r2, r0 + strb r2, [r6, 0xD] + adds r1, 0x1 + str r1, [r6] + ldrb r0, [r6, 0xC] + lsrs r0, 4 + b _080059FE +_080059C0: + ldr r3, [r6] + ldrb r1, [r3] + lsls r1, 4 + ldrb r4, [r6, 0xC] + movs r2, 0xF + adds r0, r2, 0 + ands r0, r4 + orrs r0, r1 + strb r0, [r6, 0xC] + adds r5, r3, 0x1 + str r5, [r6] + ldrb r3, [r3, 0x1] + adds r1, r2, 0 + ands r1, r3 + ldrb r4, [r6, 0xD] + movs r3, 0x10 + negs r3, r3 + ands r3, r4 + orrs r3, r1 + strb r3, [r6, 0xD] + adds r4, r5, 0x1 + str r4, [r6] + ldrb r1, [r5, 0x1] + lsls r1, 4 + ands r2, r3 + orrs r2, r1 + strb r2, [r6, 0xD] + adds r4, 0x1 + str r4, [r6] + lsls r0, 24 + lsrs r0, 28 +_080059FE: + lsls r1, r2, 28 + lsrs r1, 28 + lsls r2, 24 + lsrs r2, 28 +_08005A06: + bl GenerateFontHalfRowLut +_08005A0A: + movs r0, 0x2 + b _08005D6E +_08005A0E: + ldr r0, [r6] + b _08005B30 +_08005A12: + ldr r0, [r6] + ldrb r0, [r0] + movs r1, 0xF + ands r1, r0 + ldrb r2, [r4] + movs r0, 0x10 + negs r0, r0 + ands r0, r2 + orrs r0, r1 + strb r0, [r4] + ldr r0, [r6] + b _08005B30 +_08005A2A: + ldr r0, [r6] + ldrb r1, [r0] + strb r1, [r6, 0x1E] + adds r0, 0x1 + str r0, [r6] + movs r0, 0x6 + strb r0, [r6, 0x1C] + b _08005A0A +_08005A3A: + movs r0, 0x1 + strb r0, [r6, 0x1C] + ldr r0, =0x03003014 + ldrb r1, [r0] + movs r0, 0x4 + ands r0, r1 + cmp r0, 0 + bne _08005A4C + b _08005B56 +_08005A4C: + movs r0, 0 + strb r0, [r4, 0x2] + b _08005B56 + .align 2, 0 + .pool +_08005A58: + movs r0, 0x5 + b _08005D56 +_08005A5C: + ldr r0, [r6] + ldrb r3, [r0] + adds r1, r0, 0x1 + str r1, [r6] + ldrb r0, [r0, 0x1] + lsls r0, 8 + orrs r3, r0 + adds r1, 0x1 + str r1, [r6] + adds r0, r3, 0 + bl song_play_for_text + b _08005A0A +_08005A76: + ldr r0, [r6] + ldrb r3, [r0] + adds r1, r0, 0x1 + str r1, [r6] + ldrb r0, [r0, 0x1] + lsls r0, 8 + orrs r3, r0 + adds r1, 0x1 + str r1, [r6] + adds r0, r3, 0 + bl audio_play + b _08005A0A +_08005A90: + ldr r1, [r6] + ldrb r0, [r1] + ldrb r3, [r6, 0x6] + b _08005AF8 +_08005A98: + ldr r1, [r6] + ldrb r0, [r1] + ldrb r2, [r6, 0x7] + adds r0, r2 + strb r0, [r6, 0x9] + b _08005AFC +_08005AA4: + ldrb r0, [r6, 0x4] + ldrb r2, [r6, 0xD] + lsls r2, 28 + lsrs r1, r2, 4 + orrs r1, r2 + lsrs r1, 24 + bl Window_FastFillPixels + ldrb r0, [r6, 0x6] + strb r0, [r6, 0x8] + ldrb r0, [r6, 0x7] +_08005ABA: + strb r0, [r6, 0x9] + b _08005A0A +_08005ABE: + ldr r0, =0x03007420 + bl MPlayStop_rev01 + b _08005A0A + .align 2, 0 + .pool +_08005ACC: + ldr r0, =0x03007420 + bl m4aMPlayContinue + b _08005A0A + .align 2, 0 + .pool +_08005AD8: + ldr r0, [r6] + ldrb r4, [r0] + adds r0, 0x1 + str r0, [r6] + cmp r4, 0 + ble _08005A0A + adds r0, r6, 0 + adds r1, r4, 0 + bl Text_ClearHorizontalSpan + ldrb r0, [r6, 0x8] + adds r0, r4 + b _08005C6E +_08005AF2: + ldr r1, [r6] + ldrb r0, [r6, 0x6] + ldrb r3, [r1] +_08005AF8: + adds r0, r3 + strb r0, [r6, 0x8] +_08005AFC: + adds r1, 0x1 + str r1, [r6] + b _08005A0A +_08005B02: + ldr r0, [r6] + ldrb r2, [r0] + ldrb r1, [r6, 0x6] + adds r2, r1 + adds r0, 0x1 + str r0, [r6] + ldrb r0, [r6, 0x8] + subs r4, r2, r0 + cmp r4, 0 + bgt _08005B18 + b _08005A0A +_08005B18: + adds r0, r6, 0 + adds r1, r4, 0 + bl Text_ClearHorizontalSpan + ldrb r0, [r6, 0x8] + adds r0, r4 + b _08005C6E +_08005B26: + ldr r0, [r6] + ldrb r2, [r0] + adds r1, r6, 0 + adds r1, 0x20 + strb r2, [r1] +_08005B30: + adds r0, 0x1 + str r0, [r6] + b _08005A0A +_08005B36: + adds r1, r6, 0 + adds r1, 0x21 + movs r0, 0x1 + b _08005B44 +_08005B3E: + adds r1, r6, 0 + adds r1, 0x21 + movs r0, 0 +_08005B44: + strb r0, [r1] + b _08005A0A +_08005B48: + movs r0, 0x2 + b _08005B4E +_08005B4C: + movs r0, 0x3 +_08005B4E: + strb r0, [r6, 0x1C] + adds r0, r6, 0 + bl sub_80054F8 +_08005B56: + movs r0, 0x3 + b _08005D6E +_08005B5A: + ldr r0, [r6] + ldrb r3, [r0] + movs r2, 0x80 + lsls r2, 1 + adds r1, r2, 0 + orrs r3, r1 + adds r0, 0x1 + str r0, [r6] + b _08005B90 +_08005B6C: + ldr r0, [r6] + ldrb r3, [r0] + adds r0, 0x1 + str r0, [r6] + ldrb r0, [r6, 0x4] + adds r1, r3, 0 + ldrb r2, [r6, 0x8] + ldrb r3, [r6, 0x9] + bl TextBox_DrawKeypadIcon + ldr r1, =0x03002f90 + adds r1, 0x80 + strb r0, [r1] + ldrb r3, [r6, 0xA] + adds r0, r3 + b _08005C6A + .align 2, 0 + .pool +_08005B90: + ldr r0, [r4] + lsls r0, 28 + lsrs r0, 28 + cmp r0, 0x8 + bhi _08005C10 + lsls r0, 2 + ldr r1, =_08005BA8 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .align 2, 0 + .pool + .align 2, 0 +_08005BA8: + .4byte _08005BCC + .4byte _08005BDA + .4byte _08005BE8 + .4byte _08005BE8 + .4byte _08005BE8 + .4byte _08005BE8 + .4byte _08005C10 + .4byte _08005BF6 + .4byte _08005C04 +_08005BCC: + adds r0, r6, 0 + adds r0, 0x21 + ldrb r1, [r0] + adds r0, r3, 0 + bl Text_DecompressGlyphFont0 + b _08005C10 +_08005BDA: + adds r0, r6, 0 + adds r0, 0x21 + ldrb r1, [r0] + adds r0, r3, 0 + bl Text_DecompressGlyphFont1 + b _08005C10 +_08005BE8: + adds r0, r6, 0 + adds r0, 0x21 + ldrb r1, [r0] + adds r0, r3, 0 + bl Text_DecompressGlyphFont2 + b _08005C10 +_08005BF6: + adds r0, r6, 0 + adds r0, 0x21 + ldrb r1, [r0] + adds r0, r3, 0 + bl Text_DecompressGlyphFont7 + b _08005C10 +_08005C04: + adds r0, r6, 0 + adds r0, 0x21 + ldrb r1, [r0] + adds r0, r3, 0 + bl Text_DecompressGlyphFont8 +_08005C10: + adds r0, r6, 0 + bl CopyGlyphToWindow + adds r2, r6, 0 + adds r2, 0x20 + ldrb r0, [r2] + cmp r0, 0 + beq _08005C48 + ldr r1, =0x03002f90 + adds r1, 0x80 + ldrb r0, [r1] + ldrb r3, [r6, 0x8] + adds r0, r3 + strb r0, [r6, 0x8] + ldrb r2, [r2] + ldrb r0, [r1] + subs r4, r2, r0 + cmp r4, 0 + ble _08005C70 + adds r0, r6, 0 + adds r1, r4, 0 + bl Text_ClearHorizontalSpan + ldrb r0, [r6, 0x8] + adds r0, r4 + b _08005C6E + .align 2, 0 + .pool +_08005C48: + adds r0, r6, 0 + adds r0, 0x21 + ldrb r0, [r0] + cmp r0, 0 + beq _08005C64 + ldr r0, =0x03002f90 + adds r0, 0x80 + ldrb r1, [r6, 0xA] + ldrb r0, [r0] + adds r1, r0 + ldrb r0, [r6, 0x8] + b _08005C6C + .align 2, 0 + .pool +_08005C64: + ldr r0, =0x03002f90 + adds r0, 0x80 + ldrb r0, [r0] +_08005C6A: + ldrb r1, [r6, 0x8] +_08005C6C: + adds r0, r1 +_08005C6E: + strb r0, [r6, 0x8] +_08005C70: + movs r0, 0 + b _08005D6E + .align 2, 0 + .pool +_08005C78: + adds r0, r6, 0 + bl remo_is_it_time_to_continue + lsls r0, 16 + cmp r0, 0 + bne _08005C86 + b _08005B56 +_08005C86: + movs r0, 0 + strb r0, [r6, 0x1C] + b _08005B56 +_08005C8C: + adds r0, r6, 0 + bl remo_is_it_time_to_continue_plus_down_arrow + lsls r0, 16 + cmp r0, 0 + bne _08005C9A + b _08005B56 +_08005C9A: + ldrb r0, [r6, 0x4] + ldrb r2, [r6, 0xD] + lsls r2, 28 + lsrs r1, r2, 4 + orrs r1, r2 + lsrs r1, 24 + bl Window_FastFillPixels + ldrb r0, [r6, 0x6] + movs r1, 0 + strb r0, [r6, 0x8] + ldrb r0, [r6, 0x7] + strb r0, [r6, 0x9] + strb r1, [r6, 0x1C] + b _08005B56 +_08005CB8: + adds r0, r6, 0 + bl remo_is_it_time_to_continue_plus_down_arrow + lsls r0, 16 + cmp r0, 0 + bne _08005CC6 + b _08005B56 +_08005CC6: + adds r0, r6, 0 + bl remo_clear_down_arrow + ldrb r1, [r6, 0x5] + ldr r0, =0x03002f80 + ldr r2, [r0] + lsls r0, r1, 1 + adds r0, r1 + lsls r0, 2 + adds r0, r2 + ldrb r1, [r6, 0xB] + ldrb r0, [r0, 0x5] + adds r1, r0 + strb r1, [r6, 0x1F] + ldrb r0, [r6, 0x6] + strb r0, [r6, 0x8] + movs r0, 0x4 + strb r0, [r6, 0x1C] + b _08005B56 + .align 2, 0 + .pool +_08005CF0: + ldrb r0, [r6, 0x1F] + cmp r0, 0 + beq _08005D44 + bl sub_8197964 + ldr r1, =0x082e9d10 + adds r0, r1 + ldrb r4, [r0] + ldrb r2, [r6, 0x1F] + cmp r2, r4 + bge _08005D20 + ldrb r0, [r6, 0x4] + ldrb r1, [r6, 0xD] + lsls r1, 28 + lsrs r3, r1, 4 + orrs r3, r1 + lsrs r3, 24 + movs r1, 0 + bl Window_ScrollVertically + movs r0, 0 + b _08005D38 + .align 2, 0 + .pool +_08005D20: + ldrb r0, [r6, 0x4] + ldrb r1, [r6, 0xD] + lsls r1, 28 + lsrs r3, r1, 4 + orrs r3, r1 + lsrs r3, 24 + movs r1, 0 + adds r2, r4, 0 + bl Window_ScrollVertically + ldrb r0, [r6, 0x1F] + subs r0, r4 +_08005D38: + strb r0, [r6, 0x1F] + ldrb r0, [r6, 0x4] + movs r1, 0x2 + bl Window_CopyToVram + b _08005B56 +_08005D44: + strb r0, [r6, 0x1C] + b _08005B56 +_08005D48: + bl mplay_has_finished_maybe + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0 + beq _08005D56 + b _08005B56 +_08005D56: + strb r0, [r6, 0x1C] + b _08005B56 +_08005D5A: + ldrb r0, [r6, 0x1E] + adds r1, r0, 0 + cmp r1, 0 + beq _08005D68 + subs r0, 0x1 + strb r0, [r6, 0x1E] + b _08005B56 +_08005D68: + strb r1, [r6, 0x1C] + b _08005B56 +_08005D6C: + movs r0, 0x1 +_08005D6E: + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end font_render_b + + thumb_func_start sub_8005D74 +sub_8005D74: @ 8005D74 + push {r4-r7,lr} + mov r7, r8 + push {r7} + sub sp, 0x8 + lsls r1, 24 + lsrs r7, r1, 24 + lsls r2, 24 + lsrs r2, 24 + mov r8, r2 + movs r2, 0 + mov r1, sp + adds r1, 0x7 +_08005D8C: + strb r2, [r1] + subs r1, 0x1 + cmp r1, sp + bge _08005D8C + movs r5, 0 + movs r6, 0 + adds r4, r0, 0 + movs r2, 0 +_08005D9C: + adds r0, r4, r2 + ldrb r3, [r0] + adds r2, 0x1 + adds r0, r3, 0 + subs r0, 0xF7 + cmp r0, 0x8 + bhi _08005E6A + lsls r0, 2 + ldr r1, =_08005DB8 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .align 2, 0 + .pool + .align 2, 0 +_08005DB8: + .4byte _08005E64 + .4byte _08005E68 + .4byte _08005E68 + .4byte _08005E70 + .4byte _08005E70 + .4byte _08005DEC + .4byte _08005E64 + .4byte _08005DDC + .4byte _08005DDC +_08005DDC: + mov r1, sp + adds r0, r1, r6 + strb r5, [r0] + movs r5, 0 + adds r0, r6, 0x1 + lsls r0, 24 + lsrs r6, r0, 24 + b _08005E70 +_08005DEC: + adds r0, r4, r2 + ldrb r0, [r0] + adds r2, 0x1 + subs r0, 0x1 + cmp r0, 0x15 + bhi _08005E70 + lsls r0, 2 + ldr r1, =_08005E08 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .align 2, 0 + .pool + .align 2, 0 +_08005E08: + .4byte _08005E64 + .4byte _08005E64 + .4byte _08005E64 + .4byte _08005E60 + .4byte _08005E64 + .4byte _08005E64 + .4byte _08005E70 + .4byte _08005E64 + .4byte _08005E70 + .4byte _08005E70 + .4byte _08005E62 + .4byte _08005E64 + .4byte _08005E64 + .4byte _08005E64 + .4byte _08005E70 + .4byte _08005E62 + .4byte _08005E64 + .4byte _08005E64 + .4byte _08005E64 + .4byte _08005E64 + .4byte _08005E70 + .4byte _08005E70 +_08005E60: + adds r2, 0x1 +_08005E62: + adds r2, 0x1 +_08005E64: + adds r2, 0x1 + b _08005E70 +_08005E68: + adds r2, 0x1 +_08005E6A: + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 +_08005E70: + cmp r3, 0xFF + bne _08005D9C + movs r5, 0 + movs r2, 0 +_08005E78: + mov r1, sp + adds r0, r1, r2 + ldrb r1, [r0] + cmp r5, r1 + bcs _08005E84 + ldrb r5, [r0] +_08005E84: + adds r2, 0x1 + cmp r2, 0x7 + ble _08005E78 + adds r0, r7, 0 + movs r1, 0 + bl fbox_get_field + add r0, r8 + lsls r0, 24 + lsrs r0, 24 + muls r0, r5 + add sp, 0x8 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_8005D74 + + thumb_func_start font_get_get_width_func +font_get_get_width_func: @ 8005EA8 + push {r4,lr} + lsls r0, 24 + lsrs r4, r0, 24 + movs r3, 0 + ldr r0, =0x082e9d14 + adds r2, r0, 0x4 + adds r1, r0, 0 +_08005EB6: + ldr r0, [r1] + cmp r4, r0 + bne _08005EC4 + ldr r0, [r2] + b _08005ED0 + .align 2, 0 + .pool +_08005EC4: + adds r2, 0x8 + adds r1, 0x8 + adds r3, 0x1 + cmp r3, 0x8 + bls _08005EB6 + movs r0, 0 +_08005ED0: + pop {r4} + pop {r1} + bx r1 + thumb_func_end font_get_get_width_func + + thumb_func_start font_get_width_of_string +font_get_width_of_string: @ 8005ED8 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x8 + adds r4, r1, 0 + lsls r0, 24 + lsrs r0, 24 + adds r6, r0, 0 + lsls r2, 16 + lsrs r5, r2, 16 + movs r0, 0 + mov r9, r0 + movs r7, 0 + adds r0, r6, 0 + bl font_get_get_width_func + mov r8, r0 + cmp r0, 0 + bne _08005F06 +_08005F02: + movs r0, 0 + b _0800612E +_08005F06: + lsls r0, r5, 16 + asrs r2, r0, 16 + movs r1, 0x1 + negs r1, r1 + str r0, [sp, 0x4] + cmp r2, r1 + bne _08005F24 + adds r0, r6, 0 + movs r1, 0x2 + bl fbox_get_field + lsls r0, 24 + lsrs r0, 24 + mov r10, r0 + b _08005F26 +_08005F24: + mov r10, r2 +_08005F26: + movs r2, 0 + str r2, [sp] + movs r5, 0 + movs r6, 0 + b _0800611E +_08005F30: + ldrb r1, [r4] + adds r0, r1, 0 + subs r0, 0xF7 + cmp r0, 0x7 + bls _08005F3C + b _080060F8 +_08005F3C: + lsls r0, 2 + ldr r1, =_08005F4C + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .align 2, 0 + .pool + .align 2, 0 +_08005F4C: + .4byte _08005FA2 + .4byte _080060BC + .4byte _080060BC + .4byte _0800611C + .4byte _0800611C + .4byte _08005FEA + .4byte _08005F78 + .4byte _08005F6C +_08005F6C: + ldr r0, [sp] + cmp r5, r0 + bls _08005F74 + str r5, [sp] +_08005F74: + movs r5, 0 + b _0800611C +_08005F78: + adds r4, 0x1 + ldrb r0, [r4] + cmp r0, 0x3 + beq _08005F98 + cmp r0, 0x3 + bgt _08005F8A + cmp r0, 0x2 + beq _08005F90 + b _08005F02 +_08005F8A: + cmp r0, 0x4 + beq _08005FA0 + b _08005F02 +_08005F90: + ldr r6, =0x02021cc4 + b _08005FA2 + .align 2, 0 + .pool +_08005F98: + ldr r6, =0x02021dc4 + b _08005FA2 + .align 2, 0 + .pool +_08005FA0: + ldr r6, =0x02021ec4 +_08005FA2: + cmp r6, 0 + bne _08005FE0 + adds r4, 0x1 + ldrb r0, [r4] + bl sub_81AFC74 + adds r6, r0, 0 + b _08005FE0 + .align 2, 0 + .pool +_08005FB8: + ldrb r0, [r6] + adds r6, 0x1 + mov r1, r9 + bl _call_via_r8 + cmp r7, 0 + ble _08005FD0 + cmp r0, r7 + bge _08005FCC + adds r0, r7, 0 +_08005FCC: + adds r5, r0 + b _08005FE0 +_08005FD0: + adds r5, r0 + mov r2, r9 + cmp r2, 0 + beq _08005FE0 + ldrb r0, [r4, 0x1] + cmp r0, 0xFF + beq _08005FE0 + add r5, r10 +_08005FE0: + ldrb r0, [r6] + cmp r0, 0xFF + bne _08005FB8 + movs r6, 0 + b _0800611C +_08005FEA: + adds r4, 0x1 + ldrb r0, [r4] + subs r0, 0x1 + cmp r0, 0x15 + bls _08005FF6 + b _0800611C +_08005FF6: + lsls r0, 2 + ldr r1, =_08006004 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .align 2, 0 + .pool + .align 2, 0 +_08006004: + .4byte _08006060 + .4byte _08006060 + .4byte _08006060 + .4byte _0800605C + .4byte _08006060 + .4byte _08006064 + .4byte _0800611C + .4byte _08006060 + .4byte _0800611C + .4byte _0800611C + .4byte _0800605E + .4byte _08006060 + .4byte _08006060 + .4byte _08006060 + .4byte _0800611C + .4byte _0800605E + .4byte _08006090 + .4byte _08006098 + .4byte _0800609E + .4byte _080060AA + .4byte _080060B0 + .4byte _080060B6 +_0800605C: + adds r4, 0x1 +_0800605E: + adds r4, 0x1 +_08006060: + adds r4, 0x1 + b _0800611C +_08006064: + adds r4, 0x1 + ldrb r0, [r4] + bl font_get_get_width_func + mov r8, r0 + cmp r0, 0 + bne _08006074 + b _08005F02 +_08006074: + ldr r0, [sp, 0x4] + asrs r1, r0, 16 + movs r0, 0x1 + negs r0, r0 + cmp r1, r0 + bne _0800611C + ldrb r0, [r4] + movs r1, 0x2 + bl fbox_get_field + lsls r0, 24 + lsrs r0, 24 + mov r10, r0 + b _0800611C +_08006090: + adds r4, 0x1 + ldrb r0, [r4] +_08006094: + adds r5, r0 + b _0800611C +_08006098: + adds r4, 0x1 + ldrb r5, [r4] + b _0800611C +_0800609E: + adds r4, 0x1 + ldrb r0, [r4] + cmp r0, r5 + bls _0800611C + adds r5, r0, 0 + b _0800611C +_080060AA: + adds r4, 0x1 + ldrb r7, [r4] + b _0800611C +_080060B0: + movs r2, 0x1 + mov r9, r2 + b _0800611C +_080060B6: + movs r0, 0 + mov r9, r0 + b _0800611C +_080060BC: + ldrb r0, [r4] + cmp r0, 0xF9 + bne _080060D6 + adds r4, 0x1 + ldrb r0, [r4] + movs r2, 0x80 + lsls r2, 1 + adds r1, r2, 0 + orrs r0, r1 + mov r1, r9 + bl _call_via_r8 + b _080060E2 +_080060D6: + adds r4, 0x1 + ldrb r0, [r4] + bl Font_ReturnsValueFromLUT + lsls r0, 24 + lsrs r0, 24 +_080060E2: + cmp r7, 0 + ble _080060EE + cmp r0, r7 + bge _08006094 + adds r0, r7, 0 + b _08006094 +_080060EE: + adds r5, r0 + mov r0, r9 + cmp r0, 0 + beq _0800611C + b _08006114 +_080060F8: + adds r0, r1, 0 + mov r1, r9 + bl _call_via_r8 + cmp r7, 0 + ble _0800610C + cmp r0, r7 + bge _08006094 + adds r0, r7, 0 + b _08006094 +_0800610C: + adds r5, r0 + mov r2, r9 + cmp r2, 0 + beq _0800611C +_08006114: + ldrb r0, [r4, 0x1] + cmp r0, 0xFF + beq _0800611C + add r5, r10 +_0800611C: + adds r4, 0x1 +_0800611E: + ldrb r0, [r4] + cmp r0, 0xFF + beq _08006126 + b _08005F30 +_08006126: + ldr r0, [sp] + cmp r5, r0 + bls _0800612E + adds r0, r5, 0 +_0800612E: + add sp, 0x8 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end font_get_width_of_string + + thumb_func_start font_render_some +font_render_some: @ 8006140 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x10 + mov r9, r0 + adds r6, r2, 0 + lsls r1, 24 + lsrs r1, 24 + str r1, [sp, 0x4] + mov r4, sp + adds r4, 0x1 + mov r5, sp + adds r5, 0x2 + mov r0, sp + adds r1, r4, 0 + adds r2, r5, 0 + bl save_remo_colors + movs r0, 0x1 + str r0, [sp, 0x8] + movs r0, 0 + str r0, [sp, 0xC] + movs r0, 0x3 + mov r10, r0 + movs r0, 0x1 + movs r1, 0 + movs r2, 0x3 + bl GenerateFontHalfRowLut + adds r7, r6, 0 + movs r6, 0 +_08006182: + adds r0, r7, r6 + ldrb r0, [r0] + mov r8, r0 + adds r6, 0x1 + subs r0, 0xF7 + cmp r0, 0x8 + bhi _0800627E + lsls r0, 2 + ldr r1, =_080061A0 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .align 2, 0 + .pool + .align 2, 0 +_080061A0: + .4byte _08006276 + .4byte _08006276 + .4byte _08006276 + .4byte _080062B8 + .4byte _080062B8 + .4byte _080061C4 + .4byte _08006276 + .4byte _080062B8 + .4byte _080062B8 +_080061C4: + adds r0, r7, r6 + ldrb r0, [r0] + adds r6, 0x1 + subs r0, 0x1 + cmp r0, 0x15 + bhi _080062B8 + lsls r0, 2 + ldr r1, =_080061E0 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .align 2, 0 + .pool + .align 2, 0 +_080061E0: + .4byte _0800624A + .4byte _08006254 + .4byte _0800625C + .4byte _08006238 + .4byte _08006276 + .4byte _08006270 + .4byte _080062B8 + .4byte _08006276 + .4byte _080062B8 + .4byte _080062B8 + .4byte _0800627A + .4byte _08006276 + .4byte _08006276 + .4byte _08006276 + .4byte _080062B8 + .4byte _0800627A + .4byte _08006276 + .4byte _08006276 + .4byte _08006276 + .4byte _08006276 + .4byte _080062B8 + .4byte _080062B8 +_08006238: + adds r0, r7, r6 + ldrb r0, [r0] + str r0, [sp, 0x8] + adds r6, 0x1 + adds r0, r7, r6 + ldrb r0, [r0] + str r0, [sp, 0xC] + adds r6, 0x1 + b _0800625C +_0800624A: + adds r0, r7, r6 + ldrb r0, [r0] + str r0, [sp, 0x8] + adds r6, 0x1 + b _08006266 +_08006254: + adds r0, r7, r6 + ldrb r0, [r0] + str r0, [sp, 0xC] + b _08006262 +_0800625C: + adds r0, r7, r6 + ldrb r0, [r0] + mov r10, r0 +_08006262: + adds r6, 0x1 + ldr r0, [sp, 0x8] +_08006266: + ldr r1, [sp, 0xC] + mov r2, r10 + bl GenerateFontHalfRowLut + b _080062B8 +_08006270: + adds r0, r7, r6 + ldrb r0, [r0] + str r0, [sp, 0x4] +_08006276: + adds r6, 0x1 + b _080062B8 +_0800627A: + adds r6, 0x1 + b _08006276 +_0800627E: + ldr r0, [sp, 0x4] + cmp r0, 0x1 + beq _08006290 + cmp r0, 0x9 + bne _08006290 + mov r0, r8 + bl Text_DecompressGlyphFont9 + b _08006298 +_08006290: + mov r0, r8 + movs r1, 0x1 + bl Text_DecompressGlyphFont1 +_08006298: + ldr r4, =0x03002f90 + ldr r5, =0x04000008 + adds r0, r4, 0 + mov r1, r9 + adds r2, r5, 0 + bl CpuSet + adds r4, 0x40 + mov r1, r9 + adds r1, 0x20 + adds r0, r4, 0 + adds r2, r5, 0 + bl CpuSet + movs r0, 0x40 + add r9, r0 +_080062B8: + mov r0, r8 + cmp r0, 0xFF + beq _080062C0 + b _08006182 +_080062C0: + mov r0, sp + mov r1, sp + adds r1, 0x1 + mov r2, sp + adds r2, 0x2 + bl restore_remo_colors + movs r0, 0x1 + add sp, 0x10 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end font_render_some + + thumb_func_start TextBox_DrawKeypadIcon +TextBox_DrawKeypadIcon: @ 80062E8 + push {r4,r5,lr} + sub sp, 0x18 + lsls r0, 24 + lsrs r0, 24 + lsls r1, 24 + lsls r2, 16 + lsrs r2, 16 + lsls r3, 16 + lsrs r3, 16 + ldr r4, =0x082e9d5c + lsrs r1, 22 + adds r1, r4 + ldrh r5, [r1] + lsls r5, 5 + ldr r4, =0x082e9d90 + adds r5, r4 + movs r4, 0x80 + str r4, [sp] + str r4, [sp, 0x4] + str r2, [sp, 0x8] + str r3, [sp, 0xC] + ldrb r4, [r1, 0x2] + str r4, [sp, 0x10] + ldrb r1, [r1, 0x3] + str r1, [sp, 0x14] + adds r1, r5, 0 + movs r2, 0 + movs r3, 0 + bl Window_CopyPixelRectToWindow + adds r0, r4, 0 + add sp, 0x18 + pop {r4,r5} + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end TextBox_DrawKeypadIcon + + thumb_func_start sub_8006338 +sub_8006338: @ 8006338 + lsls r0, 24 + ldr r1, =0x082e9d5c + lsrs r0, 22 + adds r0, r1 + ldrb r0, [r0] + bx lr + .align 2, 0 + .pool + thumb_func_end sub_8006338 + + thumb_func_start Font_ReturnsValueFromLUT +Font_ReturnsValueFromLUT: @ 8006348 + lsls r0, 24 + ldr r1, =0x082e9d5c + lsrs r0, 22 + adds r0, r1 + ldrb r0, [r0, 0x2] + bx lr + .align 2, 0 + .pool + thumb_func_end Font_ReturnsValueFromLUT + + thumb_func_start sub_8006358 +sub_8006358: @ 8006358 + lsls r0, 24 + ldr r1, =0x082e9d5c + lsrs r0, 22 + adds r0, r1 + ldrb r0, [r0, 0x3] + bx lr + .align 2, 0 + .pool + thumb_func_end sub_8006358 + + thumb_func_start fboxes_set_default_ptr +fboxes_set_default_ptr: @ 8006368 + push {lr} + ldr r0, =0x082ea590 + bl fboxes_set_ptr + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end fboxes_set_default_ptr + + thumb_func_start fbox_get_field +fbox_get_field: @ 8006378 + push {lr} + lsls r0, 24 + lsrs r2, r0, 24 + lsls r1, 24 + lsrs r1, 24 + movs r0, 0 + cmp r1, 0x7 + bhi _08006456 + lsls r0, r1, 2 + ldr r1, =_08006398 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .align 2, 0 + .pool + .align 2, 0 +_08006398: + .4byte _080063B8 + .4byte _080063CC + .4byte _080063E0 + .4byte _080063F4 + .4byte _08006408 + .4byte _0800641C + .4byte _08006430 + .4byte _08006448 +_080063B8: + ldr r1, =0x082ea590 + lsls r0, r2, 1 + adds r0, r2 + lsls r0, 2 + adds r0, r1 + ldrb r0, [r0, 0x4] + b _08006456 + .align 2, 0 + .pool +_080063CC: + ldr r1, =0x082ea590 + lsls r0, r2, 1 + adds r0, r2 + lsls r0, 2 + adds r0, r1 + ldrb r0, [r0, 0x5] + b _08006456 + .align 2, 0 + .pool +_080063E0: + ldr r1, =0x082ea590 + lsls r0, r2, 1 + adds r0, r2 + lsls r0, 2 + adds r0, r1 + ldrb r0, [r0, 0x6] + b _08006456 + .align 2, 0 + .pool +_080063F4: + ldr r1, =0x082ea590 + lsls r0, r2, 1 + adds r0, r2 + lsls r0, 2 + adds r0, r1 + ldrb r0, [r0, 0x7] + b _08006456 + .align 2, 0 + .pool +_08006408: + ldr r0, =0x082ea590 + lsls r1, r2, 1 + adds r1, r2 + lsls r1, 2 + adds r1, r0 + ldrb r0, [r1, 0x8] + b _0800643C + .align 2, 0 + .pool +_0800641C: + ldr r0, =0x082ea590 + lsls r1, r2, 1 + adds r1, r2 + lsls r1, 2 + adds r1, r0 + ldrb r0, [r1, 0x8] + b _08006454 + .align 2, 0 + .pool +_08006430: + ldr r0, =0x082ea590 + lsls r1, r2, 1 + adds r1, r2 + lsls r1, 2 + adds r1, r0 + ldrb r0, [r1, 0x9] +_0800643C: + lsls r0, 28 + lsrs r0, 28 + b _08006456 + .align 2, 0 + .pool +_08006448: + ldr r0, =0x082ea590 + lsls r1, r2, 1 + adds r1, r2 + lsls r1, 2 + adds r1, r0 + ldrb r0, [r1, 0x9] +_08006454: + lsrs r0, 4 +_08006456: + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end fbox_get_field + + thumb_func_start sub_8006460 +sub_8006460: @ 8006460 + lsls r0, 24 + lsls r1, 24 + lsrs r1, 24 + ldr r2, =0x082ea608 + lsrs r0, 23 + adds r1, r0 + adds r1, r2 + ldrb r0, [r1] + bx lr + .align 2, 0 + .pool + thumb_func_end sub_8006460 + + thumb_func_start Text_DecompressGlyphFont0 +Text_DecompressGlyphFont0: @ 8006478 + push {r4,r5,lr} + lsls r0, 16 + lsrs r3, r0, 16 + cmp r1, 0x1 + bne _080064C4 + lsrs r2, r0, 20 + lsls r2, 9 + movs r0, 0xF + ands r0, r3 + lsls r0, 4 + ldr r1, =0x086544e4 + adds r0, r1 + adds r5, r2, r0 + ldr r4, =0x03002f90 + adds r0, r5, 0 + adds r1, r4, 0 + bl font_render_sub + movs r1, 0x80 + lsls r1, 1 + adds r0, r5, r1 + adds r1, r4, 0 + adds r1, 0x40 + bl font_render_sub + adds r1, r4, 0 + adds r1, 0x80 + movs r0, 0x8 + strb r0, [r1] + adds r4, 0x81 + movs r0, 0xC + strb r0, [r4] + b _08006534 + .align 2, 0 + .pool +_080064C4: + lsls r1, r3, 6 + ldr r0, =0x08633ce4 + adds r5, r1, r0 + ldr r4, =0x03002f90 + ldr r0, =0x0863bce4 + adds r0, r3, r0 + ldrb r1, [r0] + adds r0, r4, 0 + adds r0, 0x80 + strb r1, [r0] + cmp r1, 0x8 + bhi _08006500 + adds r0, r5, 0 + adds r1, r4, 0 + bl font_render_sub + adds r0, r5, 0 + adds r0, 0x20 + adds r1, r4, 0 + adds r1, 0x40 + bl font_render_sub + b _0800652C + .align 2, 0 + .pool +_08006500: + adds r0, r5, 0 + adds r1, r4, 0 + bl font_render_sub + adds r0, r5, 0 + adds r0, 0x10 + adds r1, r4, 0 + adds r1, 0x20 + bl font_render_sub + adds r0, r5, 0 + adds r0, 0x20 + adds r1, r4, 0 + adds r1, 0x40 + bl font_render_sub + adds r0, r5, 0 + adds r0, 0x30 + adds r1, r4, 0 + adds r1, 0x60 + bl font_render_sub +_0800652C: + ldr r0, =0x03002f90 + adds r0, 0x81 + movs r1, 0xD + strb r1, [r0] +_08006534: + pop {r4,r5} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end Text_DecompressGlyphFont0 + + thumb_func_start get_font_width_unk3 +get_font_width_unk3: @ 8006540 + push {lr} + lsls r0, 16 + lsrs r2, r0, 16 + cmp r1, 0x1 + beq _08006558 + ldr r0, =0x0863bce4 + adds r0, r2, r0 + ldrb r0, [r0] + b _0800655A + .align 2, 0 + .pool +_08006558: + movs r0, 0x8 +_0800655A: + pop {r1} + bx r1 + thumb_func_end get_font_width_unk3 + + thumb_func_start Text_DecompressGlyphFont7 +Text_DecompressGlyphFont7: @ 8006560 + push {r4-r6,lr} + lsls r0, 16 + lsrs r3, r0, 16 + cmp r1, 0x1 + bne _080065AC + lsrs r2, r0, 20 + lsls r2, 9 + movs r5, 0xF + adds r0, r3, 0 + ands r0, r5 + lsls r0, 4 + ldr r1, =0x086584e4 + adds r0, r1 + adds r6, r2, r0 + ldr r4, =0x03002f90 + adds r0, r6, 0 + adds r1, r4, 0 + bl font_render_sub + movs r1, 0x80 + lsls r1, 1 + adds r0, r6, r1 + adds r1, r4, 0 + adds r1, 0x40 + bl font_render_sub + adds r1, r4, 0 + adds r1, 0x80 + movs r0, 0x8 + strb r0, [r1] + adds r4, 0x81 + strb r5, [r4] + b _0800661C + .align 2, 0 + .pool +_080065AC: + lsls r1, r3, 6 + ldr r0, =0x0863bee4 + adds r6, r1, r0 + ldr r4, =0x03002f90 + ldr r0, =0x08643ee4 + adds r0, r3, r0 + ldrb r1, [r0] + adds r0, r4, 0 + adds r0, 0x80 + strb r1, [r0] + cmp r1, 0x8 + bhi _080065E8 + adds r0, r6, 0 + adds r1, r4, 0 + bl font_render_sub + adds r0, r6, 0 + adds r0, 0x20 + adds r1, r4, 0 + adds r1, 0x40 + bl font_render_sub + b _08006614 + .align 2, 0 + .pool +_080065E8: + adds r0, r6, 0 + adds r1, r4, 0 + bl font_render_sub + adds r0, r6, 0 + adds r0, 0x10 + adds r1, r4, 0 + adds r1, 0x20 + bl font_render_sub + adds r0, r6, 0 + adds r0, 0x20 + adds r1, r4, 0 + adds r1, 0x40 + bl font_render_sub + adds r0, r6, 0 + adds r0, 0x30 + adds r1, r4, 0 + adds r1, 0x60 + bl font_render_sub +_08006614: + ldr r0, =0x03002f90 + adds r0, 0x81 + movs r1, 0xF + strb r1, [r0] +_0800661C: + pop {r4-r6} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end Text_DecompressGlyphFont7 + + thumb_func_start get_font_width_black_en +get_font_width_black_en: @ 8006628 + push {lr} + lsls r0, 16 + lsrs r2, r0, 16 + cmp r1, 0x1 + beq _08006640 + ldr r0, =0x08643ee4 + adds r0, r2, r0 + ldrb r0, [r0] + b _08006642 + .align 2, 0 + .pool +_08006640: + movs r0, 0x8 +_08006642: + pop {r1} + bx r1 + thumb_func_end get_font_width_black_en + + thumb_func_start Text_DecompressGlyphFont8 +Text_DecompressGlyphFont8: @ 8006648 + push {r4,r5,lr} + lsls r0, 16 + lsrs r3, r0, 16 + cmp r1, 0x1 + bne _08006694 + lsrs r2, r0, 20 + lsls r2, 9 + movs r0, 0xF + ands r0, r3 + lsls r0, 4 + ldr r1, =0x086544e4 + adds r0, r1 + adds r5, r2, r0 + ldr r4, =0x03002f90 + adds r0, r5, 0 + adds r1, r4, 0 + bl font_render_sub + movs r1, 0x80 + lsls r1, 1 + adds r0, r5, r1 + adds r1, r4, 0 + adds r1, 0x40 + bl font_render_sub + adds r1, r4, 0 + adds r1, 0x80 + movs r0, 0x8 + strb r0, [r1] + adds r4, 0x81 + movs r0, 0xC + strb r0, [r4] + b _08006704 + .align 2, 0 + .pool +_08006694: + lsls r1, r3, 6 + ldr r0, =0x0862bae4 + adds r5, r1, r0 + ldr r4, =0x03002f90 + ldr r0, =0x08633ae4 + adds r0, r3, r0 + ldrb r1, [r0] + adds r0, r4, 0 + adds r0, 0x80 + strb r1, [r0] + cmp r1, 0x8 + bhi _080066D0 + adds r0, r5, 0 + adds r1, r4, 0 + bl font_render_sub + adds r0, r5, 0 + adds r0, 0x20 + adds r1, r4, 0 + adds r1, 0x40 + bl font_render_sub + b _080066FC + .align 2, 0 + .pool +_080066D0: + adds r0, r5, 0 + adds r1, r4, 0 + bl font_render_sub + adds r0, r5, 0 + adds r0, 0x10 + adds r1, r4, 0 + adds r1, 0x20 + bl font_render_sub + adds r0, r5, 0 + adds r0, 0x20 + adds r1, r4, 0 + adds r1, 0x40 + bl font_render_sub + adds r0, r5, 0 + adds r0, 0x30 + adds r1, r4, 0 + adds r1, 0x60 + bl font_render_sub +_080066FC: + ldr r0, =0x03002f90 + adds r0, 0x81 + movs r1, 0xC + strb r1, [r0] +_08006704: + pop {r4,r5} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end Text_DecompressGlyphFont8 + + thumb_func_start get_font_width_unk2 +get_font_width_unk2: @ 8006710 + push {lr} + lsls r0, 16 + lsrs r2, r0, 16 + cmp r1, 0x1 + beq _08006728 + ldr r0, =0x08633ae4 + adds r0, r2, r0 + ldrb r0, [r0] + b _0800672A + .align 2, 0 + .pool +_08006728: + movs r0, 0x8 +_0800672A: + pop {r1} + bx r1 + thumb_func_end get_font_width_unk2 + + thumb_func_start Text_DecompressGlyphFont2 +Text_DecompressGlyphFont2: @ 8006730 + push {r4-r6,lr} + lsls r0, 16 + lsrs r6, r0, 16 + cmp r1, 0x1 + bne _080067A0 + lsrs r2, r0, 19 + lsls r2, 9 + movs r0, 0x7 + ands r0, r6 + lsls r0, 5 + ldr r1, =0x0866c8e4 + adds r0, r1 + adds r4, r2, r0 + ldr r5, =0x03002f90 + adds r0, r4, 0 + adds r1, r5, 0 + bl font_render_sub + adds r0, r4, 0 + adds r0, 0x10 + adds r1, r5, 0 + adds r1, 0x20 + bl font_render_sub + movs r1, 0x80 + lsls r1, 1 + adds r0, r4, r1 + adds r1, r5, 0 + adds r1, 0x40 + bl font_render_sub + movs r1, 0x88 + lsls r1, 1 + adds r0, r4, r1 + adds r1, r5, 0 + adds r1, 0x60 + bl font_render_sub + ldr r0, =0x086748e4 + adds r0, r6, r0 + ldrb r1, [r0] + adds r0, r5, 0 + adds r0, 0x80 + strb r1, [r0] + adds r1, r5, 0 + adds r1, 0x81 + movs r0, 0xE + strb r0, [r1] + b _08006810 + .align 2, 0 + .pool +_080067A0: + lsls r1, r6, 6 + ldr r0, =0x086440e4 + adds r4, r1, r0 + ldr r5, =0x03002f90 + ldr r0, =0x0864c0e4 + adds r0, r6, r0 + ldrb r1, [r0] + adds r0, r5, 0 + adds r0, 0x80 + strb r1, [r0] + cmp r1, 0x8 + bhi _080067DC + adds r0, r4, 0 + adds r1, r5, 0 + bl font_render_sub + adds r0, r4, 0 + adds r0, 0x20 + adds r1, r5, 0 + adds r1, 0x40 + bl font_render_sub + b _08006808 + .align 2, 0 + .pool +_080067DC: + adds r0, r4, 0 + adds r1, r5, 0 + bl font_render_sub + adds r0, r4, 0 + adds r0, 0x10 + adds r1, r5, 0 + adds r1, 0x20 + bl font_render_sub + adds r0, r4, 0 + adds r0, 0x20 + adds r1, r5, 0 + adds r1, 0x40 + bl font_render_sub + adds r0, r4, 0 + adds r0, 0x30 + adds r1, r5, 0 + adds r1, 0x60 + bl font_render_sub +_08006808: + ldr r0, =0x03002f90 + adds r0, 0x81 + movs r1, 0xE + strb r1, [r0] +_08006810: + pop {r4-r6} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end Text_DecompressGlyphFont2 + + thumb_func_start get_font_width_unk +get_font_width_unk: @ 800681C + push {lr} + lsls r0, 16 + lsrs r2, r0, 16 + cmp r1, 0x1 + beq _08006830 + ldr r0, =0x0864c0e4 + b _08006832 + .align 2, 0 + .pool +_08006830: + ldr r0, =0x086748e4 +_08006832: + adds r0, r2, r0 + ldrb r0, [r0] + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end get_font_width_unk + + thumb_func_start Text_DecompressGlyphFont1 +Text_DecompressGlyphFont1: @ 8006840 + push {r4-r6,lr} + lsls r0, 16 + lsrs r3, r0, 16 + cmp r1, 0x1 + bne _0800688C + lsrs r2, r0, 20 + lsls r2, 9 + movs r5, 0xF + adds r0, r3, 0 + ands r0, r5 + lsls r0, 4 + ldr r1, =0x086584e4 + adds r0, r1 + adds r6, r2, r0 + ldr r4, =0x03002f90 + adds r0, r6, 0 + adds r1, r4, 0 + bl font_render_sub + movs r1, 0x80 + lsls r1, 1 + adds r0, r6, r1 + adds r1, r4, 0 + adds r1, 0x40 + bl font_render_sub + adds r1, r4, 0 + adds r1, 0x80 + movs r0, 0x8 + strb r0, [r1] + adds r4, 0x81 + strb r5, [r4] + b _080068FC + .align 2, 0 + .pool +_0800688C: + lsls r1, r3, 6 + ldr r0, =0x0864c2e4 + adds r6, r1, r0 + ldr r4, =0x03002f90 + ldr r0, =0x086542e4 + adds r0, r3, r0 + ldrb r1, [r0] + adds r0, r4, 0 + adds r0, 0x80 + strb r1, [r0] + cmp r1, 0x8 + bhi _080068C8 + adds r0, r6, 0 + adds r1, r4, 0 + bl font_render_sub + adds r0, r6, 0 + adds r0, 0x20 + adds r1, r4, 0 + adds r1, 0x40 + bl font_render_sub + b _080068F4 + .align 2, 0 + .pool +_080068C8: + adds r0, r6, 0 + adds r1, r4, 0 + bl font_render_sub + adds r0, r6, 0 + adds r0, 0x10 + adds r1, r4, 0 + adds r1, 0x20 + bl font_render_sub + adds r0, r6, 0 + adds r0, 0x20 + adds r1, r4, 0 + adds r1, 0x40 + bl font_render_sub + adds r0, r6, 0 + adds r0, 0x30 + adds r1, r4, 0 + adds r1, 0x60 + bl font_render_sub +_080068F4: + ldr r0, =0x03002f90 + adds r0, 0x81 + movs r1, 0xF + strb r1, [r0] +_080068FC: + pop {r4-r6} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end Text_DecompressGlyphFont1 + + thumb_func_start get_font_width_red_en_jp +get_font_width_red_en_jp: @ 8006908 + push {lr} + lsls r0, 16 + lsrs r2, r0, 16 + cmp r1, 0x1 + beq _08006920 + ldr r0, =0x086542e4 + adds r0, r2, r0 + ldrb r0, [r0] + b _08006922 + .align 2, 0 + .pool +_08006920: + movs r0, 0x8 +_08006922: + pop {r1} + bx r1 + thumb_func_end get_font_width_red_en_jp + + thumb_func_start Text_DecompressGlyphFont9 +Text_DecompressGlyphFont9: @ 8006928 + push {r4,r5,lr} + lsls r0, 16 + lsrs r4, r0, 20 + lsls r4, 9 + movs r1, 0xF0 + lsls r1, 12 + ands r1, r0 + lsrs r1, 12 + ldr r0, =0x082ea61c + adds r1, r0 + adds r4, r1 + ldr r5, =0x03002f90 + adds r0, r4, 0 + adds r1, r5, 0 + bl font_render_sub + movs r0, 0x80 + lsls r0, 1 + adds r4, r0 + adds r1, r5, 0 + adds r1, 0x40 + adds r0, r4, 0 + bl font_render_sub + adds r1, r5, 0 + adds r1, 0x80 + movs r0, 0x8 + strb r0, [r1] + adds r5, 0x81 + movs r0, 0xC + strb r0, [r5] + pop {r4,r5} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end Text_DecompressGlyphFont9 diff --git a/asm/window.s b/asm/window.s new file mode 100644 index 000000000..867a95f21 --- /dev/null +++ b/asm/window.s @@ -0,0 +1,2619 @@ + thumb_func_start nullsub_8 +nullsub_8: @ 80031BC + bx lr + thumb_func_end nullsub_8 + + thumb_func_start Window_InitFromTemplates +Window_InitFromTemplates: @ 80031C0 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x8 + adds r5, r0, 0 + movs r0, 0 + mov r8, r0 + ldr r4, =0x03002f70 +_080031D4: + mov r1, r8 + lsls r0, r1, 24 + lsrs r0, 24 + bl bg_get_tilemap + cmp r0, 0 + beq _080031E4 + ldr r0, =nullsub_8 + 1 +_080031E4: + str r0, [r4] + adds r4, 0x4 + movs r2, 0x1 + add r8, r2 + mov r0, r8 + cmp r0, 0x3 + ble _080031D4 + ldr r0, =0x082e9584 + ldr r2, [r0] + ldr r3, [r0, 0x4] + ldr r1, =0x02020004 + movs r0, 0 + movs r4, 0x1F + mov r8, r4 +_08003200: + str r2, [r1] + str r3, [r1, 0x4] + str r0, [r1, 0x8] + adds r1, 0xC + movs r4, 0x1 + negs r4, r4 + add r8, r4 + mov r4, r8 + cmp r4, 0 + bge _08003200 + movs r0, 0 + mov r8, r0 + movs r1, 0 + str r1, [sp] + ldrb r7, [r5] + cmp r7, 0xFF + bne _08003224 + b _0800335C +_08003224: + adds r6, r5, 0 + movs r2, 0 + str r2, [sp, 0x4] +_0800322A: + ldr r0, =0x03002f54 + ldr r0, [r0] + cmp r0, 0x1 + bne _08003268 + ldrb r1, [r6, 0x3] + ldrb r0, [r6, 0x4] + adds r2, r1, 0 + muls r2, r0 + adds r0, r7, 0 + movs r1, 0 + movs r3, 0 + bl do_nothing + str r0, [sp] + movs r0, 0x1 + negs r0, r0 + ldr r4, [sp] + cmp r4, r0 + bne _08003268 +_08003250: + movs r0, 0 + b _08003364 + .align 2, 0 + .pool +_08003268: + ldr r0, =0x03002f70 + mov r9, r0 + lsls r0, r7, 2 + mov r2, r9 + adds r1, r0, r2 + ldr r1, [r1] + mov r10, r0 + cmp r1, 0 + bne _080032CA + adds r0, r7, 0 + movs r1, 0x8 + bl bg_get_field + lsls r0, 16 + lsrs r5, r0, 16 + ldr r0, =0x0000ffff + cmp r5, r0 + beq _080032CA + adds r0, r5, 0 + bl malloc_and_clear + adds r4, r0, 0 + cmp r4, 0 + bne _080032A8 + bl Window_FreeMemory + b _08003250 + .align 2, 0 + .pool +_080032A8: + movs r1, 0 + mov r3, r9 + cmp r1, r5 + bge _080032BC + movs r2, 0 +_080032B2: + adds r0, r4, r1 + strb r2, [r0] + adds r1, 0x1 + cmp r1, r5 + blt _080032B2 +_080032BC: + mov r1, r10 + adds r0, r1, r3 + str r4, [r0] + adds r0, r7, 0 + adds r1, r4, 0 + bl bg_set_tilemap +_080032CA: + ldrb r1, [r6, 0x3] + ldrb r0, [r6, 0x4] + muls r0, r1 + lsls r0, 21 + lsrs r0, 16 + bl malloc_and_clear + adds r4, r0, 0 + cmp r4, 0 + bne _0800330C + adds r0, r7, 0 + bl GetNumActiveWindowsOnBg + lsls r0, 24 + cmp r0, 0 + bne _08003250 + ldr r0, =0x03002f70 + mov r2, r10 + adds r5, r2, r0 + ldr r1, [r5] + ldr r0, =nullsub_8 + 1 + cmp r1, r0 + beq _08003250 + adds r0, r1, 0 + bl free + str r4, [r5] + b _08003250 + .align 2, 0 + .pool +_0800330C: + ldr r1, =0x02020004 + adds r0, r1, 0 + adds r0, 0x8 + ldr r2, [sp, 0x4] + adds r0, r2, r0 + str r4, [r0] + adds r2, r1 + ldr r0, [r6] + ldr r1, [r6, 0x4] + str r0, [r2] + str r1, [r2, 0x4] + ldr r0, =0x03002f54 + ldr r0, [r0] + cmp r0, 0x1 + bne _08003342 + mov r4, sp + ldrh r4, [r4] + strh r4, [r2, 0x6] + ldrb r0, [r6, 0x3] + ldrb r1, [r6, 0x4] + adds r2, r0, 0 + muls r2, r1 + adds r0, r7, 0 + ldr r1, [sp] + movs r3, 0x1 + bl do_nothing +_08003342: + adds r6, 0x8 + ldr r0, [sp, 0x4] + adds r0, 0xC + str r0, [sp, 0x4] + movs r1, 0x1 + add r8, r1 + ldrb r7, [r6] + cmp r7, 0xFF + beq _0800335C + mov r2, r8 + cmp r2, 0x1F + bgt _0800335C + b _0800322A +_0800335C: + ldr r1, =0x03002f60 + movs r0, 0 + strb r0, [r1] + movs r0, 0x1 +_08003364: + add sp, 0x8 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end Window_InitFromTemplates + + thumb_func_start Window_AddFromTemplate +Window_AddFromTemplate: @ 8003380 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x4 + mov r8, r0 + movs r6, 0 + ldr r1, =0x02020004 + ldrb r0, [r1] + cmp r0, 0xFF + beq _080033B0 +_08003398: + adds r0, r6, 0x1 + lsls r0, 16 + lsrs r6, r0, 16 + cmp r6, 0x1F + bhi _080033B0 + lsls r0, r6, 1 + adds r0, r6 + lsls r0, 2 + adds r0, r1 + ldrb r0, [r0] + cmp r0, 0xFF + bne _08003398 +_080033B0: + cmp r6, 0x20 + beq _0800346A + mov r0, r8 + ldrb r7, [r0] + movs r1, 0 + mov r9, r1 + ldr r0, =0x03002f54 + ldr r0, [r0] + cmp r0, 0x1 + bne _080033E2 + mov r2, r8 + ldrb r1, [r2, 0x3] + ldrb r0, [r2, 0x4] + adds r2, r1, 0 + muls r2, r0 + adds r0, r7, 0 + movs r1, 0 + movs r3, 0 + bl do_nothing + mov r9, r0 + movs r0, 0x1 + negs r0, r0 + cmp r9, r0 + beq _0800346A +_080033E2: + ldr r3, =0x03002f70 + mov r10, r3 + lsls r0, r7, 2 + adds r1, r0, r3 + ldr r1, [r1] + str r0, [sp] + cmp r1, 0 + bne _08003432 + adds r0, r7, 0 + movs r1, 0x8 + bl bg_get_field + lsls r0, 16 + lsrs r5, r0, 16 + ldr r0, =0x0000ffff + cmp r5, r0 + beq _08003432 + adds r0, r5, 0 + bl malloc_and_clear + adds r4, r0, 0 + cmp r4, 0 + beq _0800346A + movs r1, 0 + mov r3, r10 + cmp r1, r5 + bge _08003424 + movs r2, 0 +_0800341A: + adds r0, r4, r1 + strb r2, [r0] + adds r1, 0x1 + cmp r1, r5 + blt _0800341A +_08003424: + ldr r1, [sp] + adds r0, r1, r3 + str r4, [r0] + adds r0, r7, 0 + adds r1, r4, 0 + bl bg_set_tilemap +_08003432: + mov r2, r8 + ldrb r1, [r2, 0x3] + ldrb r0, [r2, 0x4] + muls r0, r1 + lsls r0, 21 + lsrs r0, 16 + bl malloc_and_clear + adds r4, r0, 0 + cmp r4, 0 + bne _08003484 + adds r0, r7, 0 + bl GetNumActiveWindowsOnBg + lsls r0, 24 + cmp r0, 0 + bne _0800346A + ldr r0, =0x03002f70 + ldr r3, [sp] + adds r5, r3, r0 + ldr r1, [r5] + ldr r0, =nullsub_8 + 1 + cmp r1, r0 + beq _0800346A + adds r0, r1, 0 + bl free + str r4, [r5] +_0800346A: + movs r0, 0xFF + b _080034C0 + .align 2, 0 + .pool +_08003484: + ldr r2, =0x02020004 + lsls r1, r6, 1 + adds r1, r6 + lsls r1, 2 + adds r0, r2, 0 + adds r0, 0x8 + adds r0, r1, r0 + str r4, [r0] + adds r2, r1, r2 + mov r3, r8 + ldr r0, [r3] + ldr r1, [r3, 0x4] + str r0, [r2] + str r1, [r2, 0x4] + ldr r0, =0x03002f54 + ldr r0, [r0] + cmp r0, 0x1 + bne _080034BE + mov r0, r9 + strh r0, [r2, 0x6] + ldrb r0, [r2, 0x3] + ldrb r1, [r2, 0x4] + adds r2, r0, 0 + muls r2, r1 + adds r0, r7, 0 + mov r1, r9 + movs r3, 0x1 + bl do_nothing +_080034BE: + adds r0, r6, 0 +_080034C0: + add sp, 0x4 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end Window_AddFromTemplate + + thumb_func_start Window_AddFromTemplateWithoutAllocatingMemory +Window_AddFromTemplateWithoutAllocatingMemory: @ 80034D8 + push {r4-r6,lr} + adds r5, r0, 0 + movs r4, 0 + ldr r1, =0x02020004 + ldrb r0, [r1] + cmp r0, 0xFF + beq _080034FE +_080034E6: + adds r0, r4, 0x1 + lsls r0, 16 + lsrs r4, r0, 16 + cmp r4, 0x1F + bhi _080034FE + lsls r0, r4, 1 + adds r0, r4 + lsls r0, 2 + adds r0, r1 + ldrb r0, [r0] + cmp r0, 0xFF + bne _080034E6 +_080034FE: + cmp r4, 0x20 + beq _08003528 + ldrb r6, [r5] + movs r3, 0 + ldr r0, =0x03002f54 + ldr r0, [r0] + cmp r0, 0x1 + bne _08003534 + ldrb r1, [r5, 0x3] + ldrb r0, [r5, 0x4] + adds r2, r1, 0 + muls r2, r0 + adds r0, r6, 0 + movs r1, 0 + bl do_nothing + adds r3, r0, 0 + movs r0, 0x1 + negs r0, r0 + cmp r3, r0 + bne _08003534 +_08003528: + movs r0, 0xFF + b _08003564 + .align 2, 0 + .pool +_08003534: + ldr r1, =0x02020004 + lsls r0, r4, 1 + adds r0, r4 + lsls r0, 2 + adds r2, r0, r1 + ldr r0, [r5] + ldr r1, [r5, 0x4] + str r0, [r2] + str r1, [r2, 0x4] + ldr r0, =0x03002f54 + ldr r0, [r0] + cmp r0, 0x1 + bne _08003562 + strh r3, [r2, 0x6] + ldrb r0, [r2, 0x3] + ldrb r1, [r2, 0x4] + adds r2, r0, 0 + muls r2, r1 + adds r0, r6, 0 + adds r1, r3, 0 + movs r3, 0x1 + bl do_nothing +_08003562: + adds r0, r4, 0 +_08003564: + pop {r4-r6} + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end Window_AddFromTemplateWithoutAllocatingMemory + + thumb_func_start Window_Remove +Window_Remove: @ 8003574 + push {r4-r7,lr} + lsls r0, 24 + lsrs r6, r0, 24 + ldr r1, =0x02020004 + lsls r0, r6, 1 + adds r0, r6 + lsls r0, 2 + adds r4, r0, r1 + ldrb r3, [r4] + adds r7, r3, 0 + ldr r0, =0x03002f54 + ldr r0, [r0] + cmp r0, 0x1 + bne _080035A0 + ldrh r1, [r4, 0x6] + ldrb r2, [r4, 0x3] + ldrb r0, [r4, 0x4] + muls r2, r0 + adds r0, r3, 0 + movs r3, 0x2 + bl do_nothing +_080035A0: + ldr r0, =0x082e9584 + ldr r1, [r0, 0x4] + ldr r0, [r0] + str r0, [r4] + str r1, [r4, 0x4] + adds r0, r7, 0 + bl GetNumActiveWindowsOnBg + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, 0 + bne _080035CE + ldr r0, =0x03002f70 + lsls r1, r7, 2 + adds r4, r1, r0 + ldr r1, [r4] + ldr r0, =nullsub_8 + 1 + cmp r1, r0 + beq _080035CE + adds r0, r1, 0 + bl free + str r5, [r4] +_080035CE: + ldr r1, =0x02020004 + lsls r0, r6, 1 + adds r0, r6 + lsls r0, 2 + adds r1, 0x8 + adds r4, r0, r1 + ldr r0, [r4] + cmp r0, 0 + beq _080035E8 + bl free + movs r0, 0 + str r0, [r4] +_080035E8: + pop {r4-r7} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end Window_Remove + + thumb_func_start Window_FreeMemory +Window_FreeMemory: @ 8003604 + push {r4-r6,lr} + ldr r4, =0x03002f70 + movs r5, 0x3 +_0800360A: + ldr r1, [r4] + cmp r1, 0 + beq _08003620 + ldr r0, =nullsub_8 + 1 + cmp r1, r0 + beq _08003620 + adds r0, r1, 0 + bl free + movs r0, 0 + str r0, [r4] +_08003620: + adds r4, 0x4 + subs r5, 0x1 + cmp r5, 0 + bge _0800360A + ldr r0, =0x02020004 + adds r4, r0, 0 + adds r4, 0x8 + movs r6, 0 + movs r5, 0x1F +_08003632: + ldr r0, [r4] + cmp r0, 0 + beq _0800363E + bl free + str r6, [r4] +_0800363E: + adds r4, 0xC + subs r5, 0x1 + cmp r5, 0 + bge _08003632 + pop {r4-r6} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end Window_FreeMemory + + thumb_func_start Window_CopyToVram +Window_CopyToVram: @ 8003658 + push {r4-r6,lr} + sub sp, 0xC + lsls r0, 24 + lsrs r0, 24 + lsls r1, 24 + lsrs r3, r1, 24 + adds r5, r3, 0 + ldr r2, =0x02020004 + lsls r1, r0, 1 + adds r1, r0 + lsls r1, 2 + mov r0, sp + adds r1, r2 + ldm r1!, {r2,r4,r6} + stm r0!, {r2,r4,r6} + mov r0, sp + ldrb r1, [r0, 0x3] + ldrb r0, [r0, 0x4] + muls r0, r1 + lsls r0, 21 + lsrs r4, r0, 16 + cmp r3, 0x2 + beq _080036A4 + cmp r3, 0x2 + bgt _08003694 + cmp r3, 0x1 + beq _0800369A + b _080036CE + .align 2, 0 + .pool +_08003694: + cmp r5, 0x3 + beq _080036B6 + b _080036CE +_0800369A: + mov r0, sp + ldrb r0, [r0] + bl gpu_copy_wram_bg_tilemap_to_vram + b _080036CE +_080036A4: + mov r0, sp + ldrb r0, [r0] + ldr r1, [sp, 0x8] + mov r2, sp + ldrh r3, [r2, 0x6] + adds r2, r4, 0 + bl gpu_copy_bg_tile_pattern_data_to_vram + b _080036CE +_080036B6: + mov r0, sp + ldrb r0, [r0] + ldr r1, [sp, 0x8] + mov r2, sp + ldrh r3, [r2, 0x6] + adds r2, r4, 0 + bl gpu_copy_bg_tile_pattern_data_to_vram + mov r0, sp + ldrb r0, [r0] + bl gpu_copy_wram_bg_tilemap_to_vram +_080036CE: + add sp, 0xC + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end Window_CopyToVram + + thumb_func_start Window_CopyRectToVram +Window_CopyRectToVram: @ 80036D8 + push {r4-r7,lr} + sub sp, 0xC + adds r6, r0, 0 + adds r5, r1, 0 + adds r4, r2, 0 + mov r12, r3 + ldr r3, [sp, 0x24] + ldr r0, [sp, 0x20] + cmp r0, 0 + beq _08003782 + cmp r3, 0 + beq _08003782 + ldr r2, =0x02020004 + lsls r0, r6, 1 + adds r0, r6 + lsls r0, 2 + mov r1, sp + adds r0, r2 + ldm r0!, {r2,r6,r7} + stm r1!, {r2,r6,r7} + subs r2, r3, 0x1 + mov r0, sp + ldrb r1, [r0, 0x3] + adds r3, r2, 0 + muls r3, r1 + subs r0, r1, r4 + adds r3, r0 + ldr r2, [sp, 0x20] + adds r0, r4, r2 + subs r0, r1, r0 + subs r3, r0 + lsls r3, 5 + mov r0, r12 + muls r0, r1 + adds r4, r0, r4 + cmp r5, 0x2 + beq _08003740 + cmp r5, 0x2 + bhi _08003730 + cmp r5, 0x1 + beq _08003736 + b _08003782 + .align 2, 0 + .pool +_08003730: + cmp r5, 0x3 + beq _0800375E + b _08003782 +_08003736: + mov r0, sp + ldrb r0, [r0] + bl gpu_copy_wram_bg_tilemap_to_vram + b _08003782 +_08003740: + mov r0, sp + ldrb r0, [r0] + lsls r2, r4, 5 + ldr r1, [sp, 0x8] + adds r1, r2 + lsls r2, r3, 16 + lsrs r2, 16 + mov r3, sp + ldrh r3, [r3, 0x6] + adds r3, r4 + lsls r3, 16 + lsrs r3, 16 + bl gpu_copy_bg_tile_pattern_data_to_vram + b _08003782 +_0800375E: + mov r0, sp + ldrb r0, [r0] + lsls r2, r4, 5 + ldr r1, [sp, 0x8] + adds r1, r2 + lsls r2, r3, 16 + lsrs r2, 16 + mov r3, sp + ldrh r3, [r3, 0x6] + adds r3, r4 + lsls r3, 16 + lsrs r3, 16 + bl gpu_copy_bg_tile_pattern_data_to_vram + mov r0, sp + ldrb r0, [r0] + bl gpu_copy_wram_bg_tilemap_to_vram +_08003782: + add sp, 0xC + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end Window_CopyRectToVram + + thumb_func_start Window_WriteStandardTileMap +Window_WriteStandardTileMap: @ 800378C + push {r4,lr} + sub sp, 0x1C + lsls r0, 24 + lsrs r0, 24 + ldr r2, =0x02020004 + lsls r1, r0, 1 + adds r1, r0 + lsls r1, 2 + add r0, sp, 0x10 + adds r1, r2 + ldm r1!, {r2-r4} + stm r0!, {r2-r4} + add r0, sp, 0x10 + ldrb r0, [r0] + movs r1, 0xA + bl bg_get_field + adds r1, r0, 0 + add r0, sp, 0x10 + ldrh r0, [r0, 0x6] + adds r1, r0 + lsls r1, 16 + lsrs r1, 16 + add r0, sp, 0x10 + ldrb r0, [r0] + add r2, sp, 0x10 + ldrb r2, [r2, 0x1] + add r3, sp, 0x10 + ldrb r3, [r3, 0x2] + add r4, sp, 0x10 + ldrb r4, [r4, 0x3] + str r4, [sp] + add r4, sp, 0x10 + ldrb r4, [r4, 0x4] + str r4, [sp, 0x4] + add r4, sp, 0x10 + ldrb r4, [r4, 0x5] + str r4, [sp, 0x8] + movs r4, 0x1 + str r4, [sp, 0xC] + bl bg_write_sequence_to_wram_tile_map_rect + add sp, 0x1C + pop {r4} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end Window_WriteStandardTileMap + + thumb_func_start Window_WriteStandardTileMapRectOverridePalette +Window_WriteStandardTileMapRectOverridePalette: @ 80037EC + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x24 + ldr r4, [sp, 0x44] + ldr r5, [sp, 0x48] + lsls r0, 24 + lsrs r0, 24 + lsls r1, 24 + lsrs r1, 24 + mov r10, r1 + lsls r2, 24 + lsrs r2, 24 + mov r9, r2 + lsls r3, 24 + lsrs r3, 24 + str r3, [sp, 0x1C] + lsls r4, 24 + lsrs r4, 24 + mov r8, r4 + lsls r5, 24 + lsrs r5, 24 + str r5, [sp, 0x20] + ldr r2, =0x02020004 + lsls r1, r0, 1 + adds r1, r0 + lsls r1, 2 + add r0, sp, 0x10 + adds r1, r2 + ldm r1!, {r2-r4} + stm r0!, {r2-r4} + add r0, sp, 0x10 + ldrb r0, [r0] + movs r1, 0xA + bl bg_get_field + add r2, sp, 0x10 + adds r1, r2, 0 + ldrb r1, [r1, 0x3] + mov r3, r9 + muls r3, r1 + adds r1, r3, 0 + ldrh r2, [r2, 0x6] + adds r1, r2 + add r1, r10 + adds r0, r1 + lsls r0, 16 + lsrs r6, r0, 16 + movs r5, 0 + cmp r5, r8 + bge _0800388E + add r4, sp, 0x10 + movs r7, 0x1 +_0800385A: + ldrb r0, [r4] + ldrb r2, [r4, 0x1] + add r2, r10 + lsls r2, 24 + lsrs r2, 24 + ldrb r3, [r4, 0x2] + add r3, r9 + adds r3, r5 + lsls r3, 24 + lsrs r3, 24 + ldr r1, [sp, 0x1C] + str r1, [sp] + str r7, [sp, 0x4] + ldr r1, [sp, 0x20] + str r1, [sp, 0x8] + str r7, [sp, 0xC] + adds r1, r6, 0 + bl bg_write_sequence_to_wram_tile_map_rect + ldrb r0, [r4, 0x3] + adds r0, r6, r0 + lsls r0, 16 + lsrs r6, r0, 16 + adds r5, 0x1 + cmp r5, r8 + blt _0800385A +_0800388E: + add sp, 0x24 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end Window_WriteStandardTileMapRectOverridePalette + + thumb_func_start Window_FillTileMap +Window_FillTileMap: @ 80038A4 + push {r4,lr} + sub sp, 0x18 + lsls r0, 24 + lsrs r0, 24 + ldr r2, =0x02020004 + lsls r1, r0, 1 + adds r1, r0 + lsls r1, 2 + add r0, sp, 0xC + adds r1, r2 + ldm r1!, {r2-r4} + stm r0!, {r2-r4} + add r0, sp, 0xC + ldrb r0, [r0] + ldr r1, =0x03002f60 + ldrb r1, [r1] + add r2, sp, 0xC + ldrb r2, [r2, 0x1] + add r3, sp, 0xC + ldrb r3, [r3, 0x2] + add r4, sp, 0xC + ldrb r4, [r4, 0x3] + str r4, [sp] + add r4, sp, 0xC + ldrb r4, [r4, 0x4] + str r4, [sp, 0x4] + add r4, sp, 0xC + ldrb r4, [r4, 0x5] + str r4, [sp, 0x8] + bl Bg_FillWramTileMapRectWithTileAndPalette + add sp, 0x18 + pop {r4} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end Window_FillTileMap + + thumb_func_start Window_WriteStandardTileMapRect +Window_WriteStandardTileMapRect: @ 80038F4 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x20 + ldr r4, [sp, 0x40] + lsls r0, 24 + lsrs r0, 24 + lsls r1, 24 + lsrs r1, 24 + mov r10, r1 + lsls r2, 24 + lsrs r2, 24 + mov r9, r2 + lsls r3, 24 + lsrs r3, 24 + str r3, [sp, 0x1C] + lsls r4, 24 + lsrs r4, 24 + mov r8, r4 + ldr r2, =0x02020004 + lsls r1, r0, 1 + adds r1, r0 + lsls r1, 2 + add r0, sp, 0x10 + adds r1, r2 + ldm r1!, {r2-r4} + stm r0!, {r2-r4} + add r0, sp, 0x10 + ldrb r0, [r0] + movs r1, 0xA + bl bg_get_field + add r2, sp, 0x10 + adds r1, r2, 0 + ldrb r1, [r1, 0x3] + mov r3, r9 + muls r3, r1 + adds r1, r3, 0 + ldrh r2, [r2, 0x6] + adds r1, r2 + add r1, r10 + adds r0, r1 + lsls r0, 16 + lsrs r6, r0, 16 + movs r5, 0 + cmp r5, r8 + bge _0800398E + add r4, sp, 0x10 + movs r7, 0x1 +_0800395A: + ldrb r0, [r4] + ldrb r2, [r4, 0x1] + add r2, r10 + lsls r2, 24 + lsrs r2, 24 + ldrb r3, [r4, 0x2] + add r3, r9 + adds r3, r5 + lsls r3, 24 + lsrs r3, 24 + ldr r1, [sp, 0x1C] + str r1, [sp] + str r7, [sp, 0x4] + ldrb r1, [r4, 0x5] + str r1, [sp, 0x8] + str r7, [sp, 0xC] + adds r1, r6, 0 + bl bg_write_sequence_to_wram_tile_map_rect + ldrb r0, [r4, 0x3] + adds r0, r6, r0 + lsls r0, 16 + lsrs r6, r0, 16 + adds r5, 0x1 + cmp r5, r8 + blt _0800395A +_0800398E: + add sp, 0x20 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end Window_WriteStandardTileMapRect + + thumb_func_start Window_CopyWholePixelBlockToWindow +Window_CopyWholePixelBlockToWindow: @ 80039A4 + push {r4,r5,lr} + sub sp, 0x18 + ldr r4, [sp, 0x24] + ldr r5, [sp, 0x28] + lsls r0, 24 + lsrs r0, 24 + lsls r2, 16 + lsrs r2, 16 + lsls r3, 16 + lsrs r3, 16 + lsls r4, 16 + lsrs r4, 16 + lsls r5, 16 + lsrs r5, 16 + str r4, [sp] + str r5, [sp, 0x4] + str r2, [sp, 0x8] + str r3, [sp, 0xC] + str r4, [sp, 0x10] + str r5, [sp, 0x14] + movs r2, 0 + movs r3, 0 + bl Window_CopyPixelRectToWindow + add sp, 0x18 + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end Window_CopyWholePixelBlockToWindow + + thumb_func_start Window_CopyPixelRectToWindow +Window_CopyPixelRectToWindow: @ 80039DC + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x24 + ldr r4, [sp, 0x44] + ldr r5, [sp, 0x48] + ldr r6, [sp, 0x4C] + mov r8, r6 + ldr r6, [sp, 0x50] + mov r9, r6 + ldr r6, [sp, 0x54] + mov r10, r6 + ldr r6, [sp, 0x58] + mov r12, r6 + lsls r0, 24 + lsrs r0, 24 + lsls r2, 16 + lsrs r2, 16 + lsls r3, 16 + lsrs r3, 16 + lsls r4, 16 + mov r6, r8 + lsls r6, 16 + lsrs r6, 16 + mov r8, r6 + mov r6, r9 + lsls r6, 16 + lsrs r6, 16 + mov r9, r6 + mov r6, r10 + lsls r6, 16 + lsrs r6, 16 + mov r10, r6 + mov r6, r12 + lsls r6, 16 + lsrs r6, 16 + mov r12, r6 + str r1, [sp, 0x14] + ldr r7, =0xffff0000 + lsls r5, 16 + ldr r6, =0x0000ffff + lsrs r4, 16 + orrs r4, r5 + str r4, [sp, 0x18] + ldr r1, =0x02020004 + lsls r5, r0, 1 + adds r5, r0 + lsls r5, 2 + adds r0, r1, 0 + adds r0, 0x8 + adds r0, r5, r0 + ldr r0, [r0] + str r0, [sp, 0x1C] + adds r5, r1 + ldrb r0, [r5, 0x3] + lsls r0, 3 + add r1, sp, 0x1C + ldr r4, [r1, 0x4] + ands r4, r7 + orrs r4, r0 + str r4, [r1, 0x4] + ldrb r0, [r5, 0x4] + lsls r0, 19 + ands r6, r4 + orrs r6, r0 + str r6, [r1, 0x4] + mov r0, r8 + str r0, [sp] + mov r6, r9 + str r6, [sp, 0x4] + mov r0, r10 + str r0, [sp, 0x8] + mov r6, r12 + str r6, [sp, 0xC] + movs r0, 0 + str r0, [sp, 0x10] + add r0, sp, 0x14 + bl PixelBlock_CopyRect4Bpp + add sp, 0x24 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end Window_CopyPixelRectToWindow + + thumb_func_start Window_copy_pixels_rect_3 +Window_copy_pixels_rect_3: @ 8003A9C + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x28 + ldr r4, [sp, 0x48] + ldr r5, [sp, 0x4C] + ldr r6, [sp, 0x50] + mov r8, r6 + ldr r7, [sp, 0x54] + mov r9, r7 + ldr r6, [sp, 0x58] + mov r10, r6 + ldr r7, [sp, 0x5C] + mov r12, r7 + ldr r6, [sp, 0x60] + lsls r0, 24 + lsrs r0, 24 + lsls r2, 16 + lsrs r2, 16 + lsls r3, 16 + lsrs r3, 16 + lsls r4, 16 + mov r7, r8 + lsls r7, 16 + lsrs r7, 16 + mov r8, r7 + mov r7, r9 + lsls r7, 16 + lsrs r7, 16 + mov r9, r7 + mov r7, r10 + lsls r7, 16 + lsrs r7, 16 + mov r10, r7 + mov r7, r12 + lsls r7, 16 + lsrs r7, 16 + mov r12, r7 + lsls r6, 24 + lsrs r6, 24 + str r6, [sp, 0x24] + str r1, [sp, 0x14] + lsls r5, 16 + ldr r6, =0x0000ffff + lsrs r4, 16 + orrs r4, r5 + str r4, [sp, 0x18] + ldr r1, =0x02020004 + lsls r5, r0, 1 + adds r5, r0 + lsls r5, 2 + adds r0, r1, 0 + adds r0, 0x8 + adds r0, r5, r0 + ldr r0, [r0] + str r0, [sp, 0x1C] + adds r5, r1 + ldrb r0, [r5, 0x3] + lsls r0, 3 + add r1, sp, 0x1C + ldr r4, [r1, 0x4] + ldr r7, =0xffff0000 + ands r4, r7 + orrs r4, r0 + str r4, [r1, 0x4] + ldrb r0, [r5, 0x4] + lsls r0, 19 + ands r6, r4 + orrs r6, r0 + str r6, [r1, 0x4] + mov r0, r8 + str r0, [sp] + mov r6, r9 + str r6, [sp, 0x4] + mov r7, r10 + str r7, [sp, 0x8] + mov r0, r12 + str r0, [sp, 0xC] + ldr r6, [sp, 0x24] + str r6, [sp, 0x10] + add r0, sp, 0x14 + bl PixelBlock_CopyRect4Bpp + add sp, 0x28 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end Window_copy_pixels_rect_3 + + thumb_func_start Window_FillPixelRect +Window_FillPixelRect: @ 8003B64 + push {r4-r6,lr} + mov r6, r9 + mov r5, r8 + push {r5,r6} + sub sp, 0x10 + mov r9, r3 + ldr r3, [sp, 0x28] + ldr r4, [sp, 0x2C] + mov r8, r4 + lsls r0, 24 + lsrs r0, 24 + lsls r1, 24 + lsrs r1, 24 + lsls r2, 16 + lsrs r2, 16 + mov r4, r9 + lsls r4, 16 + lsrs r4, 16 + mov r9, r4 + lsls r3, 16 + lsrs r3, 16 + mov r4, r8 + lsls r4, 16 + lsrs r4, 16 + mov r8, r4 + ldr r5, =0x02020004 + lsls r4, r0, 1 + adds r4, r0 + lsls r4, 2 + adds r0, r5, 0 + adds r0, 0x8 + adds r0, r4, r0 + ldr r0, [r0] + str r0, [sp, 0x8] + adds r4, r5 + ldrb r0, [r4, 0x3] + lsls r0, 3 + ldr r6, =0xffff0000 + ldr r5, [sp, 0xC] + ands r5, r6 + orrs r5, r0 + str r5, [sp, 0xC] + ldrb r4, [r4, 0x4] + lsls r4, 19 + ldr r0, =0x0000ffff + ands r0, r5 + orrs r0, r4 + str r0, [sp, 0xC] + mov r0, r8 + str r0, [sp] + str r1, [sp, 0x4] + add r0, sp, 0x8 + adds r1, r2, 0 + mov r2, r9 + bl PixelBlock_FillRect4Bpp + add sp, 0x10 + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r6} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end Window_FillPixelRect + + thumb_func_start Window_CopyToPixels +Window_CopyToPixels: @ 8003BF0 + push {r4-r6,lr} + adds r6, r1, 0 + lsls r0, 24 + lsrs r4, r0, 24 + lsls r5, r2, 16 + lsls r3, 16 + lsrs r2, r3, 16 + cmp r5, 0 + beq _08003C24 + ldr r1, =0x02020004 + lsls r0, r4, 1 + adds r0, r4 + lsls r0, 2 + adds r1, 0x8 + adds r0, r1 + lsls r2, 5 + ldr r1, [r0] + adds r1, r2 + lsrs r2, r5, 17 + adds r0, r6, 0 + bl CpuSet + b _08003C3C + .align 2, 0 + .pool +_08003C24: + ldr r1, =0x02020004 + lsls r0, r4, 1 + adds r0, r4 + lsls r0, 2 + adds r1, 0x8 + adds r0, r1 + lsls r2, 5 + ldr r1, [r0] + adds r1, r2 + adds r0, r6, 0 + bl LZ77UnCompWram +_08003C3C: + pop {r4-r6} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end Window_CopyToPixels + + thumb_func_start Window_FastFillPixels +Window_FastFillPixels: @ 8003C48 + push {r4,r5,lr} + sub sp, 0x4 + lsls r0, 24 + lsrs r0, 24 + lsls r1, 24 + lsrs r1, 24 + ldr r5, =0x02020004 + lsls r4, r0, 1 + adds r4, r0 + lsls r4, 2 + adds r0, r4, r5 + ldrb r2, [r0, 0x3] + ldrb r0, [r0, 0x4] + muls r2, r0 + lsls r0, r1, 24 + lsls r3, r1, 16 + orrs r0, r3 + lsls r3, r1, 8 + orrs r0, r3 + orrs r0, r1 + str r0, [sp] + adds r5, 0x8 + adds r4, r5 + ldr r1, [r4] + lsls r2, 3 + movs r0, 0x80 + lsls r0, 17 + orrs r2, r0 + mov r0, sp + bl CpuFastSet + add sp, 0x4 + pop {r4,r5} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end Window_FastFillPixels + + thumb_func_start Window_ScrollVertically +Window_ScrollVertically: @ 8003C94 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x8 + lsls r0, 24 + lsrs r0, 24 + lsls r1, 24 + lsrs r1, 24 + mov r8, r1 + lsls r2, 24 + lsrs r2, 24 + str r2, [sp] + lsls r3, 24 + lsrs r3, 24 + ldr r2, =0x02020004 + lsls r1, r0, 1 + adds r1, r0 + lsls r1, 2 + adds r4, r1, r2 + adds r2, 0x8 + adds r1, r2 + ldr r5, [r1] + lsls r7, r3, 24 + lsls r0, r3, 16 + orrs r7, r0 + lsls r0, r3, 8 + orrs r7, r0 + orrs r7, r3 + ldr r1, [r4] + ldr r2, [r4, 0x4] + ldrb r3, [r4, 0x4] + lsrs r0, r1, 24 + muls r0, r3 + lsls r6, r0, 5 + lsrs r1, 24 + mov r12, r1 + mov r0, r8 + cmp r0, 0x1 + bne _08003CE8 + b _08003E9E +_08003CE8: + cmp r0, 0x1 + ble _08003CEE + b _08004046 +_08003CEE: + cmp r0, 0 + beq _08003CF4 + b _08004046 +_08003CF4: + movs r4, 0 + cmp r4, r6 + blt _08003CFC + b _08004046 +_08003CFC: + movs r1, 0x8 + negs r1, r1 + mov r9, r1 + movs r2, 0x7 + mov r8, r2 + mov r10, r5 +_08003D08: + ldr r3, [sp] + adds r0, r3, 0 + mov r1, r9 + ands r0, r1 + mov r1, r12 + muls r1, r0 + adds r0, r3, 0 + mov r2, r8 + ands r0, r2 + orrs r1, r0 + lsls r1, 2 + adds r1, r4, r1 + cmp r1, r6 + bge _08003D34 + adds r0, r5, r1 + ldr r0, [r0] + mov r1, r10 + str r0, [r1] + b _08003D38 + .align 2, 0 + .pool +_08003D34: + mov r2, r10 + str r7, [r2] +_08003D38: + adds r3, 0x1 + adds r2, r4, 0x4 + adds r0, r3, 0 + mov r1, r9 + ands r0, r1 + mov r1, r12 + muls r1, r0 + str r1, [sp, 0x4] + adds r0, r3, 0 + mov r1, r8 + ands r0, r1 + ldr r1, [sp, 0x4] + orrs r1, r0 + lsls r1, 2 + adds r1, r4, r1 + cmp r1, r6 + bge _08003D64 + adds r0, r5, r2 + adds r1, r5, r1 + ldr r1, [r1] + str r1, [r0] + b _08003D68 +_08003D64: + adds r0, r5, r2 + str r7, [r0] +_08003D68: + adds r3, 0x1 + adds r2, r4, 0 + adds r2, 0x8 + adds r0, r3, 0 + mov r1, r9 + ands r0, r1 + mov r1, r12 + muls r1, r0 + str r1, [sp, 0x4] + adds r0, r3, 0 + mov r1, r8 + ands r0, r1 + ldr r1, [sp, 0x4] + orrs r1, r0 + lsls r1, 2 + adds r1, r4, r1 + cmp r1, r6 + bge _08003D96 + adds r0, r5, r2 + adds r1, r5, r1 + ldr r1, [r1] + str r1, [r0] + b _08003D9A +_08003D96: + adds r0, r5, r2 + str r7, [r0] +_08003D9A: + adds r3, 0x1 + adds r2, r4, 0 + adds r2, 0xC + adds r0, r3, 0 + mov r1, r9 + ands r0, r1 + mov r1, r12 + muls r1, r0 + str r1, [sp, 0x4] + adds r0, r3, 0 + mov r1, r8 + ands r0, r1 + ldr r1, [sp, 0x4] + orrs r1, r0 + lsls r1, 2 + adds r1, r4, r1 + cmp r1, r6 + bge _08003DC8 + adds r0, r5, r2 + adds r1, r5, r1 + ldr r1, [r1] + str r1, [r0] + b _08003DCC +_08003DC8: + adds r0, r5, r2 + str r7, [r0] +_08003DCC: + adds r3, 0x1 + adds r2, r4, 0 + adds r2, 0x10 + adds r0, r3, 0 + mov r1, r9 + ands r0, r1 + mov r1, r12 + muls r1, r0 + str r1, [sp, 0x4] + adds r0, r3, 0 + mov r1, r8 + ands r0, r1 + ldr r1, [sp, 0x4] + orrs r1, r0 + lsls r1, 2 + adds r1, r4, r1 + cmp r1, r6 + bge _08003DFA + adds r0, r5, r2 + adds r1, r5, r1 + ldr r1, [r1] + str r1, [r0] + b _08003DFE +_08003DFA: + adds r0, r5, r2 + str r7, [r0] +_08003DFE: + adds r3, 0x1 + adds r2, r4, 0 + adds r2, 0x14 + adds r0, r3, 0 + mov r1, r9 + ands r0, r1 + mov r1, r12 + muls r1, r0 + str r1, [sp, 0x4] + adds r0, r3, 0 + mov r1, r8 + ands r0, r1 + ldr r1, [sp, 0x4] + orrs r1, r0 + lsls r1, 2 + adds r1, r4, r1 + cmp r1, r6 + bge _08003E2C + adds r0, r5, r2 + adds r1, r5, r1 + ldr r1, [r1] + str r1, [r0] + b _08003E30 +_08003E2C: + adds r0, r5, r2 + str r7, [r0] +_08003E30: + adds r3, 0x1 + adds r2, r4, 0 + adds r2, 0x18 + adds r0, r3, 0 + mov r1, r9 + ands r0, r1 + mov r1, r12 + muls r1, r0 + str r1, [sp, 0x4] + adds r0, r3, 0 + mov r1, r8 + ands r0, r1 + ldr r1, [sp, 0x4] + orrs r1, r0 + lsls r1, 2 + adds r1, r4, r1 + cmp r1, r6 + bge _08003E5E + adds r0, r5, r2 + adds r1, r5, r1 + ldr r1, [r1] + str r1, [r0] + b _08003E62 +_08003E5E: + adds r0, r5, r2 + str r7, [r0] +_08003E62: + adds r3, 0x1 + adds r2, r4, 0 + adds r2, 0x1C + adds r0, r3, 0 + mov r1, r9 + ands r0, r1 + mov r1, r12 + muls r1, r0 + adds r0, r1, 0 + mov r1, r8 + ands r3, r1 + orrs r0, r3 + lsls r0, 2 + adds r1, r4, r0 + cmp r1, r6 + bge _08003E8C + adds r0, r5, r2 + adds r1, r5, r1 + ldr r1, [r1] + str r1, [r0] + b _08003E90 +_08003E8C: + adds r0, r5, r2 + str r7, [r0] +_08003E90: + movs r2, 0x20 + add r10, r2 + adds r4, 0x20 + cmp r4, r6 + bge _08003E9C + b _08003D08 +_08003E9C: + b _08004046 +_08003E9E: + subs r0, r6, 0x4 + adds r5, r0 + movs r4, 0 + cmp r4, r6 + blt _08003EAA + b _08004046 +_08003EAA: + movs r0, 0x8 + negs r0, r0 + mov r9, r0 + movs r1, 0x7 + mov r8, r1 + mov r10, r5 +_08003EB6: + ldr r3, [sp] + adds r0, r3, 0 + mov r2, r9 + ands r0, r2 + mov r1, r12 + muls r1, r0 + adds r0, r3, 0 + mov r2, r8 + ands r0, r2 + orrs r1, r0 + lsls r1, 2 + adds r1, r4, r1 + cmp r1, r6 + bge _08003EDC + subs r0, r5, r1 + ldr r0, [r0] + mov r1, r10 + str r0, [r1] + b _08003EE0 +_08003EDC: + mov r2, r10 + str r7, [r2] +_08003EE0: + adds r3, 0x1 + adds r2, r4, 0x4 + adds r0, r3, 0 + mov r1, r9 + ands r0, r1 + mov r1, r12 + muls r1, r0 + str r1, [sp, 0x4] + adds r0, r3, 0 + mov r1, r8 + ands r0, r1 + ldr r1, [sp, 0x4] + orrs r1, r0 + lsls r1, 2 + adds r1, r4, r1 + cmp r1, r6 + bge _08003F0C + subs r0, r5, r2 + subs r1, r5, r1 + ldr r1, [r1] + str r1, [r0] + b _08003F10 +_08003F0C: + subs r0, r5, r2 + str r7, [r0] +_08003F10: + adds r3, 0x1 + adds r2, r4, 0 + adds r2, 0x8 + adds r0, r3, 0 + mov r1, r9 + ands r0, r1 + mov r1, r12 + muls r1, r0 + str r1, [sp, 0x4] + adds r0, r3, 0 + mov r1, r8 + ands r0, r1 + ldr r1, [sp, 0x4] + orrs r1, r0 + lsls r1, 2 + adds r1, r4, r1 + cmp r1, r6 + bge _08003F3E + subs r0, r5, r2 + subs r1, r5, r1 + ldr r1, [r1] + str r1, [r0] + b _08003F42 +_08003F3E: + subs r0, r5, r2 + str r7, [r0] +_08003F42: + adds r3, 0x1 + adds r2, r4, 0 + adds r2, 0xC + adds r0, r3, 0 + mov r1, r9 + ands r0, r1 + mov r1, r12 + muls r1, r0 + str r1, [sp, 0x4] + adds r0, r3, 0 + mov r1, r8 + ands r0, r1 + ldr r1, [sp, 0x4] + orrs r1, r0 + lsls r1, 2 + adds r1, r4, r1 + cmp r1, r6 + bge _08003F70 + subs r0, r5, r2 + subs r1, r5, r1 + ldr r1, [r1] + str r1, [r0] + b _08003F74 +_08003F70: + subs r0, r5, r2 + str r7, [r0] +_08003F74: + adds r3, 0x1 + adds r2, r4, 0 + adds r2, 0x10 + adds r0, r3, 0 + mov r1, r9 + ands r0, r1 + mov r1, r12 + muls r1, r0 + str r1, [sp, 0x4] + adds r0, r3, 0 + mov r1, r8 + ands r0, r1 + ldr r1, [sp, 0x4] + orrs r1, r0 + lsls r1, 2 + adds r1, r4, r1 + cmp r1, r6 + bge _08003FA2 + subs r0, r5, r2 + subs r1, r5, r1 + ldr r1, [r1] + str r1, [r0] + b _08003FA6 +_08003FA2: + subs r0, r5, r2 + str r7, [r0] +_08003FA6: + adds r3, 0x1 + adds r2, r4, 0 + adds r2, 0x14 + adds r0, r3, 0 + mov r1, r9 + ands r0, r1 + mov r1, r12 + muls r1, r0 + str r1, [sp, 0x4] + adds r0, r3, 0 + mov r1, r8 + ands r0, r1 + ldr r1, [sp, 0x4] + orrs r1, r0 + lsls r1, 2 + adds r1, r4, r1 + cmp r1, r6 + bge _08003FD4 + subs r0, r5, r2 + subs r1, r5, r1 + ldr r1, [r1] + str r1, [r0] + b _08003FD8 +_08003FD4: + subs r0, r5, r2 + str r7, [r0] +_08003FD8: + adds r3, 0x1 + adds r2, r4, 0 + adds r2, 0x18 + adds r0, r3, 0 + mov r1, r9 + ands r0, r1 + mov r1, r12 + muls r1, r0 + str r1, [sp, 0x4] + adds r0, r3, 0 + mov r1, r8 + ands r0, r1 + ldr r1, [sp, 0x4] + orrs r1, r0 + lsls r1, 2 + adds r1, r4, r1 + cmp r1, r6 + bge _08004006 + subs r0, r5, r2 + subs r1, r5, r1 + ldr r1, [r1] + str r1, [r0] + b _0800400A +_08004006: + subs r0, r5, r2 + str r7, [r0] +_0800400A: + adds r3, 0x1 + adds r2, r4, 0 + adds r2, 0x1C + adds r0, r3, 0 + mov r1, r9 + ands r0, r1 + mov r1, r12 + muls r1, r0 + adds r0, r1, 0 + mov r1, r8 + ands r3, r1 + orrs r0, r3 + lsls r0, 2 + adds r1, r4, r0 + cmp r1, r6 + bge _08004034 + subs r0, r5, r2 + subs r1, r5, r1 + ldr r1, [r1] + str r1, [r0] + b _08004038 +_08004034: + subs r0, r5, r2 + str r7, [r0] +_08004038: + movs r2, 0x20 + negs r2, r2 + add r10, r2 + adds r4, 0x20 + cmp r4, r6 + bge _08004046 + b _08003EB6 +_08004046: + add sp, 0x8 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end Window_ScrollVertically + + thumb_func_start CallWindowFunction +CallWindowFunction: @ 8004058 + push {r4-r6,lr} + mov r6, r8 + push {r6} + sub sp, 0x8 + mov r8, r1 + lsls r0, 24 + lsrs r0, 24 + ldr r2, =0x02020004 + lsls r1, r0, 1 + adds r1, r0 + lsls r1, 2 + adds r1, r2 + ldr r5, [r1] + ldr r6, [r1, 0x4] + ldrb r0, [r1] + lsrs r1, r5, 8 + lsls r1, 24 + lsrs r1, 24 + lsrs r2, r5, 16 + lsls r2, 24 + lsrs r2, 24 + lsrs r3, r5, 24 + lsls r4, r6, 24 + lsrs r4, 24 + str r4, [sp] + lsrs r4, r6, 8 + lsls r4, 24 + lsrs r4, 24 + str r4, [sp, 0x4] + bl _call_via_r8 + add sp, 0x8 + pop {r3} + mov r8, r3 + pop {r4-r6} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end CallWindowFunction + + thumb_func_start Window_SetField +Window_SetField: @ 80040A8 + push {lr} + lsls r0, 24 + lsrs r3, r0, 24 + lsls r1, 24 + lsrs r0, r1, 24 + cmp r0, 0x7 + bhi _08004142 + lsls r0, 2 + ldr r1, =_080040C4 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .align 2, 0 + .pool + .align 2, 0 +_080040C4: + .4byte _08004142 + .4byte _080040E4 + .4byte _080040F8 + .4byte _08004142 + .4byte _08004142 + .4byte _0800410C + .4byte _08004120 + .4byte _08004134 +_080040E4: + ldr r1, =0x02020004 + lsls r0, r3, 1 + adds r0, r3 + lsls r0, 2 + adds r0, r1 + strb r2, [r0, 0x1] + movs r0, 0 + b _08004144 + .align 2, 0 + .pool +_080040F8: + ldr r1, =0x02020004 + lsls r0, r3, 1 + adds r0, r3 + lsls r0, 2 + adds r0, r1 + strb r2, [r0, 0x2] + movs r0, 0 + b _08004144 + .align 2, 0 + .pool +_0800410C: + ldr r1, =0x02020004 + lsls r0, r3, 1 + adds r0, r3 + lsls r0, 2 + adds r0, r1 + strb r2, [r0, 0x5] + movs r0, 0 + b _08004144 + .align 2, 0 + .pool +_08004120: + ldr r1, =0x02020004 + lsls r0, r3, 1 + adds r0, r3 + lsls r0, 2 + adds r0, r1 + strh r2, [r0, 0x6] + movs r0, 0 + b _08004144 + .align 2, 0 + .pool +_08004134: + ldr r1, =0x02020004 + lsls r0, r3, 1 + adds r0, r3 + lsls r0, 2 + adds r1, 0x8 + adds r0, r1 + str r2, [r0] +_08004142: + movs r0, 0x1 +_08004144: + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end Window_SetField + + thumb_func_start Window_GetField +Window_GetField: @ 800414C + push {lr} + lsls r0, 24 + lsrs r2, r0, 24 + lsls r1, 24 + lsrs r0, r1, 24 + cmp r0, 0x7 + bhi _08004228 + lsls r0, 2 + ldr r1, =_08004168 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .align 2, 0 + .pool + .align 2, 0 +_08004168: + .4byte _08004188 + .4byte _0800419C + .4byte _080041B0 + .4byte _080041C4 + .4byte _080041D8 + .4byte _080041EC + .4byte _08004200 + .4byte _08004214 +_08004188: + ldr r0, =0x02020004 + lsls r1, r2, 1 + adds r1, r2 + lsls r1, 2 + adds r1, r0 + ldrb r0, [r1] + b _0800422A + .align 2, 0 + .pool +_0800419C: + ldr r0, =0x02020004 + lsls r1, r2, 1 + adds r1, r2 + lsls r1, 2 + adds r1, r0 + ldrb r0, [r1, 0x1] + b _0800422A + .align 2, 0 + .pool +_080041B0: + ldr r0, =0x02020004 + lsls r1, r2, 1 + adds r1, r2 + lsls r1, 2 + adds r1, r0 + ldrb r0, [r1, 0x2] + b _0800422A + .align 2, 0 + .pool +_080041C4: + ldr r0, =0x02020004 + lsls r1, r2, 1 + adds r1, r2 + lsls r1, 2 + adds r1, r0 + ldrb r0, [r1, 0x3] + b _0800422A + .align 2, 0 + .pool +_080041D8: + ldr r0, =0x02020004 + lsls r1, r2, 1 + adds r1, r2 + lsls r1, 2 + adds r1, r0 + ldrb r0, [r1, 0x4] + b _0800422A + .align 2, 0 + .pool +_080041EC: + ldr r0, =0x02020004 + lsls r1, r2, 1 + adds r1, r2 + lsls r1, 2 + adds r1, r0 + ldrb r0, [r1, 0x5] + b _0800422A + .align 2, 0 + .pool +_08004200: + ldr r0, =0x02020004 + lsls r1, r2, 1 + adds r1, r2 + lsls r1, 2 + adds r1, r0 + ldrh r0, [r1, 0x6] + b _0800422A + .align 2, 0 + .pool +_08004214: + ldr r0, =0x02020004 + lsls r1, r2, 1 + adds r1, r2 + lsls r1, 2 + adds r0, 0x8 + adds r1, r0 + ldr r0, [r1] + b _0800422A + .align 2, 0 + .pool +_08004228: + movs r0, 0 +_0800422A: + pop {r1} + bx r1 + thumb_func_end Window_GetField + + thumb_func_start GetNumActiveWindowsOnBg +GetNumActiveWindowsOnBg: @ 8004230 + push {r4,lr} + lsls r0, 24 + lsrs r4, r0, 24 + movs r3, 0 + ldr r2, =0x02020004 + movs r1, 0x1F +_0800423C: + ldrb r0, [r2] + cmp r0, r4 + bne _08004248 + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 +_08004248: + adds r2, 0xC + subs r1, 0x1 + cmp r1, 0 + bge _0800423C + adds r0, r3, 0 + pop {r4} + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end GetNumActiveWindowsOnBg + + thumb_func_start nullsub_9 +nullsub_9: @ 800425C + bx lr + thumb_func_end nullsub_9 + + thumb_func_start Window_AddFromTemplate8Bpp +Window_AddFromTemplate8Bpp: @ 8004260 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + mov r9, r0 + movs r6, 0 + ldr r1, =0x02020004 + ldrb r0, [r1] + cmp r0, 0xFF + beq _0800428E +_08004276: + adds r0, r6, 0x1 + lsls r0, 16 + lsrs r6, r0, 16 + cmp r6, 0x1F + bhi _0800428E + lsls r0, r6, 1 + adds r0, r6 + lsls r0, 2 + adds r0, r1 + ldrb r0, [r0] + cmp r0, 0xFF + bne _08004276 +_0800428E: + cmp r6, 0x20 + beq _08004322 + mov r0, r9 + ldrb r7, [r0] + ldr r1, =0x03002f70 + mov r10, r1 + lsls r2, r7, 2 + mov r8, r2 + mov r0, r8 + add r0, r10 + ldr r0, [r0] + cmp r0, 0 + bne _080042EA + adds r0, r7, 0 + movs r1, 0x8 + bl bg_get_field + lsls r0, 16 + lsrs r5, r0, 16 + ldr r0, =0x0000ffff + cmp r5, r0 + beq _080042EA + adds r0, r5, 0 + bl malloc + adds r4, r0, 0 + cmp r4, 0 + beq _08004322 + movs r1, 0 + mov r12, r10 + mov r3, r8 + cmp r1, r5 + bge _080042DC + movs r2, 0 +_080042D2: + adds r0, r4, r1 + strb r2, [r0] + adds r1, 0x1 + cmp r1, r5 + blt _080042D2 +_080042DC: + mov r1, r12 + adds r0, r3, r1 + str r4, [r0] + adds r0, r7, 0 + adds r1, r4, 0 + bl bg_set_tilemap +_080042EA: + mov r2, r9 + ldrb r1, [r2, 0x3] + ldrb r0, [r2, 0x4] + muls r0, r1 + lsls r0, 22 + lsrs r0, 16 + bl malloc + adds r4, r0, 0 + cmp r4, 0 + bne _08004338 + adds r0, r7, 0 + bl GetNumActiveWindowsOnBgDuplicate + lsls r0, 24 + cmp r0, 0 + bne _08004322 + ldr r0, =0x03002f70 + lsls r1, r7, 2 + adds r5, r1, r0 + ldr r1, [r5] + ldr r0, =nullsub_9 + 1 + cmp r1, r0 + beq _08004322 + adds r0, r1, 0 + bl free + str r4, [r5] +_08004322: + movs r0, 0xFF + b _08004356 + .align 2, 0 + .pool +_08004338: + ldr r1, =0x02020004 + lsls r2, r6, 1 + adds r2, r6 + lsls r2, 2 + adds r0, r1, 0 + adds r0, 0x8 + adds r0, r2, r0 + str r4, [r0] + adds r2, r1 + mov r3, r9 + ldr r0, [r3] + ldr r1, [r3, 0x4] + str r0, [r2] + str r1, [r2, 0x4] + adds r0, r6, 0 +_08004356: + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end Window_AddFromTemplate8Bpp + + thumb_func_start Window_FillPixels8Bpp +Window_FillPixels8Bpp: @ 8004368 + push {r4-r6,lr} + lsls r0, 24 + lsrs r0, 24 + lsls r1, 24 + lsrs r5, r1, 24 + ldr r6, =0x02020004 + lsls r1, r0, 1 + adds r1, r0 + lsls r4, r1, 2 + adds r0, r4, r6 + ldrb r1, [r0, 0x3] + ldrb r0, [r0, 0x4] + muls r0, r1 + lsls r0, 22 + lsrs r3, r0, 16 + movs r2, 0 + cmp r2, r3 + bge _0800439E + adds r0, r6, 0 + adds r0, 0x8 + adds r1, r4, r0 +_08004392: + ldr r0, [r1] + adds r0, r2 + strb r5, [r0] + adds r2, 0x1 + cmp r2, r3 + blt _08004392 +_0800439E: + pop {r4-r6} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end Window_FillPixels8Bpp + + thumb_func_start Window_FillPixelRect8Bpp +Window_FillPixelRect8Bpp: @ 80043A8 + push {r4-r6,lr} + mov r6, r9 + mov r5, r8 + push {r5,r6} + sub sp, 0x10 + mov r9, r3 + ldr r3, [sp, 0x28] + ldr r4, [sp, 0x2C] + mov r8, r4 + lsls r0, 24 + lsrs r0, 24 + lsls r1, 24 + lsrs r1, 24 + lsls r2, 16 + lsrs r2, 16 + mov r4, r9 + lsls r4, 16 + lsrs r4, 16 + mov r9, r4 + lsls r3, 16 + lsrs r3, 16 + mov r4, r8 + lsls r4, 16 + lsrs r4, 16 + mov r8, r4 + ldr r5, =0x02020004 + lsls r4, r0, 1 + adds r4, r0 + lsls r4, 2 + adds r0, r5, 0 + adds r0, 0x8 + adds r0, r4, r0 + ldr r0, [r0] + str r0, [sp, 0x8] + adds r4, r5 + ldrb r0, [r4, 0x3] + lsls r0, 3 + ldr r6, =0xffff0000 + ldr r5, [sp, 0xC] + ands r5, r6 + orrs r5, r0 + str r5, [sp, 0xC] + ldrb r4, [r4, 0x4] + lsls r4, 19 + ldr r0, =0x0000ffff + ands r0, r5 + orrs r0, r4 + str r0, [sp, 0xC] + mov r0, r8 + str r0, [sp] + str r1, [sp, 0x4] + add r0, sp, 0x8 + adds r1, r2, 0 + mov r2, r9 + bl PixelBlock_FillRect8Bpp + add sp, 0x10 + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r6} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end Window_FillPixelRect8Bpp + + thumb_func_start Window_CopyPixelRectToWindow4BppTo8Bpp +Window_CopyPixelRectToWindow4BppTo8Bpp: @ 8004434 + 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] + mov r8, r6 + ldr r7, [sp, 0x58] + mov r9, r7 + ldr r6, [sp, 0x5C] + mov r10, r6 + ldr r7, [sp, 0x60] + mov r12, r7 + ldr r6, [sp, 0x64] + lsls r0, 24 + lsrs r0, 24 + lsls r2, 16 + lsrs r2, 16 + lsls r3, 16 + lsrs r3, 16 + lsls r4, 16 + mov r7, r8 + lsls r7, 16 + lsrs r7, 16 + mov r8, r7 + mov r7, r9 + lsls r7, 16 + lsrs r7, 16 + mov r9, r7 + mov r7, r10 + lsls r7, 16 + lsrs r7, 16 + mov r10, r7 + mov r7, r12 + lsls r7, 16 + lsrs r7, 16 + mov r12, r7 + lsls r6, 24 + lsrs r6, 24 + str r6, [sp, 0x28] + str r1, [sp, 0x18] + lsls r5, 16 + ldr r6, =0x0000ffff + lsrs r4, 16 + orrs r4, r5 + str r4, [sp, 0x1C] + ldr r1, =0x02020004 + lsls r5, r0, 1 + adds r5, r0 + lsls r5, 2 + adds r0, r1, 0 + adds r0, 0x8 + adds r0, r5, r0 + ldr r0, [r0] + str r0, [sp, 0x20] + adds r5, r1 + ldrb r0, [r5, 0x3] + lsls r0, 3 + add r1, sp, 0x20 + ldr r4, [r1, 0x4] + ldr r7, =0xffff0000 + ands r4, r7 + orrs r4, r0 + str r4, [r1, 0x4] + ldrb r0, [r5, 0x4] + lsls r0, 19 + ands r6, r4 + orrs r6, r0 + str r6, [r1, 0x4] + mov r0, r8 + str r0, [sp] + mov r6, r9 + str r6, [sp, 0x4] + mov r7, r10 + str r7, [sp, 0x8] + mov r0, r12 + str r0, [sp, 0xC] + movs r0, 0 + str r0, [sp, 0x10] + ldr r6, [sp, 0x28] + str r6, [sp, 0x14] + add r0, sp, 0x18 + bl PixelBlock_CopyRect4BppTo8Bpp + add sp, 0x2C + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .align 2, 0 + .pool + thumb_func_end Window_CopyPixelRectToWindow4BppTo8Bpp + + thumb_func_start Window_CopyToVram8Bpp +Window_CopyToVram8Bpp: @ 8004500 + push {r4-r6,lr} + lsls r0, 24 + lsrs r0, 24 + lsls r1, 24 + lsrs r2, r1, 24 + adds r5, r2, 0 + ldr r6, =0x02020184 + lsls r1, r0, 1 + adds r1, r0 + lsls r1, 2 + ldr r0, =0x02020004 + adds r3, r1, r0 + str r3, [r6] + ldr r4, =0x02020188 + ldrb r1, [r3, 0x3] + ldrb r0, [r3, 0x4] + muls r0, r1 + lsls r0, 6 + strh r0, [r4] + cmp r2, 0x2 + beq _0800454E + cmp r2, 0x2 + bgt _08004540 + cmp r2, 0x1 + beq _08004546 + b _08004570 + .align 2, 0 + .pool +_08004540: + cmp r5, 0x3 + beq _0800455C + b _08004570 +_08004546: + ldrb r0, [r3] + bl gpu_copy_wram_bg_tilemap_to_vram + b _08004570 +_0800454E: + ldrb r0, [r3] + ldr r1, [r3, 0x8] + ldrh r2, [r4] + ldrh r3, [r3, 0x6] + bl gpu_copy_bg_tile_pattern_data_to_vram + b _08004570 +_0800455C: + ldrb r0, [r3] + ldr r1, [r3, 0x8] + ldrh r2, [r4] + ldrh r3, [r3, 0x6] + bl gpu_copy_bg_tile_pattern_data_to_vram + ldr r0, [r6] + ldrb r0, [r0] + bl gpu_copy_wram_bg_tilemap_to_vram +_08004570: + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end Window_CopyToVram8Bpp + + thumb_func_start GetNumActiveWindowsOnBgDuplicate +GetNumActiveWindowsOnBgDuplicate: @ 8004578 + push {r4,lr} + lsls r0, 24 + lsrs r4, r0, 24 + movs r3, 0 + ldr r2, =0x02020004 + movs r1, 0x1F +_08004584: + ldrb r0, [r2] + cmp r0, r4 + bne _08004590 + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 +_08004590: + adds r2, 0xC + subs r1, 0x1 + cmp r1, 0 + bge _08004584 + adds r0, r3, 0 + pop {r4} + pop {r1} + bx r1 + .align 2, 0 + .pool + thumb_func_end GetNumActiveWindowsOnBgDuplicate