From f02cb667bbddf4f4a1152c86cbf9616468e7f0d2 Mon Sep 17 00:00:00 2001 From: garak Date: Tue, 20 Nov 2018 09:51:54 -0500 Subject: [PATCH] first 4 functions in fldeff --- asm/fldeff_80F9BCC.s | 109 ++----------------------------------------- ld_script.txt | 1 + src/fldeff_80F9BCC.c | 89 +++++++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+), 104 deletions(-) create mode 100644 src/fldeff_80F9BCC.c diff --git a/asm/fldeff_80F9BCC.s b/asm/fldeff_80F9BCC.s index a361faa32..8398387f5 100644 --- a/asm/fldeff_80F9BCC.s +++ b/asm/fldeff_80F9BCC.s @@ -5,114 +5,15 @@ .text - thumb_func_start sub_80F9BCC -sub_80F9BCC: @ 80F9BCC - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - adds r3, r2, 0 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 16 - lsrs r5, 16 - lsls r3, 24 - lsrs r3, 24 - ldr r0, =sub_80F9C90 - adds r1, r4, 0 - adds r2, r5, 0 - bl sub_80F9C44 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F9BCC - thumb_func_start sub_80F9BF4 -sub_80F9BF4: @ 80F9BF4 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - adds r3, r2, 0 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 16 - lsrs r5, 16 - lsls r3, 24 - lsrs r3, 24 - ldr r0, =sub_80F9DFC - adds r1, r4, 0 - adds r2, r5, 0 - bl sub_80F9C44 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F9BF4 - thumb_func_start sub_80F9C1C -sub_80F9C1C: @ 80F9C1C - push {lr} - ldr r0, =sub_80F9C90 - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80F9C1C - thumb_func_start sub_80F9C30 -sub_80F9C30: @ 80F9C30 - push {lr} - ldr r0, =sub_80F9DFC - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80F9C30 - thumb_func_start sub_80F9C44 -sub_80F9C44: @ 80F9C44 - push {r4,r5,lr} - lsls r1, 16 - lsrs r4, r1, 16 - adds r5, r4, 0 - lsls r3, 24 - lsrs r3, 24 - adds r1, r3, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - adds r2, r0, 0 - ldr r1, =gTasks - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r1, r0, r1 - movs r0, 0 - strh r0, [r1, 0x8] - movs r0, 0x10 - cmp r4, 0 - beq _080F9C72 - adds r0, r4, 0 -_080F9C72: - strh r0, [r1, 0xA] - movs r0, 0x14 - cmp r5, 0 - beq _080F9C7C - adds r0, r5, 0 -_080F9C7C: - strh r0, [r1, 0xC] - ldr r1, [r1] - adds r0, r2, 0 - bl _call_via_r1 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F9C44 + + + + + thumb_func_start sub_80F9C90 sub_80F9C90: @ 80F9C90 diff --git a/ld_script.txt b/ld_script.txt index 0454dc86b..982b476cc 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -150,6 +150,7 @@ SECTIONS { asm/script_pokemon_util_80F87D8.o(.text); src/field_poison.o(.text); src/pokemon_size_record.o(.text); + src/fldeff_80F9BCC.o(.text); asm/fldeff_80F9BCC.o(.text); src/field_special_scene.o(.text); src/rotating_gate.o(.text); diff --git a/src/fldeff_80F9BCC.c b/src/fldeff_80F9BCC.c new file mode 100644 index 000000000..4eddba5e4 --- /dev/null +++ b/src/fldeff_80F9BCC.c @@ -0,0 +1,89 @@ +#include "global.h" +#include "task.h" + +// +void sub_80F9C90(u8); +void sub_80F9DFC(u8); +void sub_80F9C44(TaskFunc, u16, u16, u8); + + + +// TODO: name these functions and arguments +void sub_80F9BCC(u16 a0, u16 a1, u8 a2) +{ + sub_80F9C44(sub_80F9C90, a0, a1, a2); +} + +void sub_80F9BF4(u16 a0, u16 a1, u8 a2) +{ + sub_80F9C44(sub_80F9DFC, a0, a1, a2); +} + +bool8 sub_80F9C1C(void) +{ + return FuncIsActiveTask(sub_80F9C90); +} + +bool8 sub_80F9C30(void) +{ + return FuncIsActiveTask(sub_80F9DFC); +} + +void sub_80F9C44(void (*a0) (u8), u16 a1, u16 a2, u8 a3) +{ + // + u8 tempA, tempB; + + u8 taskId = CreateTask(a1, a3); + struct Task *task = &gTasks[taskId]; + task->data[0] = 0; + + tempA = 16; + if (a1 != 0) + { + tempA = a1; + } + task->data[1] = tempA; + + tempB = 20; + if (a1 != 0) + { + tempB = a1; + } + task->data[2] = tempB; +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +