summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Winwood <twwinwood@gmail.com>2018-06-22 13:53:44 +0100
committerThomas Winwood <twwinwood@gmail.com>2018-06-22 13:53:44 +0100
commitd291ac9053837459191a55a8a48d4537d831648b (patch)
tree634a7ad3c693d5871a68e7d54de4086cf05d869b
parent413b8dbd46d992cd50a267fcac3767ce16e9bd3b (diff)
Nonmatch sub_80DE114
-rw-r--r--asm/ghost.s89
-rw-r--r--src/ghost.c95
2 files changed, 94 insertions, 90 deletions
diff --git a/asm/ghost.s b/asm/ghost.s
index 046a2fb53..3042f48d3 100644
--- a/asm/ghost.s
+++ b/asm/ghost.s
@@ -7,95 +7,6 @@
@ ghost
- thumb_func_start sub_80DE114
-sub_80DE114: @ 80DE114
- push {r4-r6,lr}
- adds r3, r0, 0
- movs r5, 0
- movs r6, 0
- adds r0, 0x3F
- ldrb r1, [r0]
- movs r0, 0x10
- ands r0, r1
- cmp r0, 0
- beq _080DE1AA
- adds r1, r3, 0
- adds r1, 0x3E
- ldrb r2, [r1]
- movs r0, 0x4
- ands r0, r2
- adds r4, r1, 0
- cmp r0, 0
- bne _080DE13E
- movs r0, 0x4
- orrs r0, r2
- strb r0, [r4]
-_080DE13E:
- movs r1, 0x2E
- ldrsh r0, [r3, r1]
- cmp r0, 0
- beq _080DE14E
- cmp r0, 0x1
- beq _080DE158
- movs r6, 0x1
- b _080DE162
-_080DE14E:
- movs r1, 0x30
- ldrsh r0, [r3, r1]
- cmp r0, 0x2
- bne _080DE162
- b _080DE166
-_080DE158:
- movs r1, 0x30
- ldrsh r0, [r3, r1]
- cmp r0, 0x4
- bne _080DE162
- movs r5, 0x1
-_080DE162:
- cmp r5, 0
- beq _080DE198
-_080DE166:
- ldrb r2, [r4]
- lsls r0, r2, 29
- lsrs r0, 31
- movs r1, 0x1
- eors r1, r0
- lsls r1, 2
- movs r0, 0x5
- negs r0, r0
- ands r0, r2
- orrs r0, r1
- strb r0, [r4]
- ldrh r0, [r3, 0x32]
- adds r0, 0x1
- movs r1, 0
- strh r0, [r3, 0x32]
- strh r1, [r3, 0x30]
- lsls r0, 16
- asrs r0, 16
- cmp r0, 0x5
- bne _080DE1AA
- strh r1, [r3, 0x32]
- ldrh r0, [r3, 0x2E]
- adds r0, 0x1
- strh r0, [r3, 0x2E]
- b _080DE1AA
-_080DE198:
- cmp r6, 0
- beq _080DE1A4
- adds r0, r3, 0
- bl DestroyAnimSprite
- b _080DE1AA
-_080DE1A4:
- ldrh r0, [r3, 0x30]
- adds r0, 0x1
- strh r0, [r3, 0x30]
-_080DE1AA:
- pop {r4-r6}
- pop {r0}
- bx r0
- thumb_func_end sub_80DE114
-
thumb_func_start sub_80DE1B0
sub_80DE1B0: @ 80DE1B0
push {r4-r6,lr}
diff --git a/src/ghost.c b/src/ghost.c
index fdb2e52fa..16f4241c0 100644
--- a/src/ghost.c
+++ b/src/ghost.c
@@ -249,4 +249,97 @@ void sub_80DDFE8(struct Sprite *sprite) {
void sub_80DE0FC(struct Sprite *sprite) {
sub_8078764(sprite, 1);
sprite->callback = &sub_80DE114;
-} \ No newline at end of file
+}
+
+#ifdef NONMATCHING /* I couldn't do this one. */
+void sub_80DE114(struct Sprite *sprite) {}
+#else
+NAKED
+void sub_80DE114(struct Sprite *sprite) {
+ asm_unified("\tpush {r4-r6,lr}\n"
+ "\tadds r3, r0, 0\n"
+ "\tmovs r5, 0\n"
+ "\tmovs r6, 0\n"
+ "\tadds r0, 0x3F\n"
+ "\tldrb r1, [r0]\n"
+ "\tmovs r0, 0x10\n"
+ "\tands r0, r1\n"
+ "\tcmp r0, 0\n"
+ "\tbeq _080DE1AA\n"
+ "\tadds r1, r3, 0\n"
+ "\tadds r1, 0x3E\n"
+ "\tldrb r2, [r1]\n"
+ "\tmovs r0, 0x4\n"
+ "\tands r0, r2\n"
+ "\tadds r4, r1, 0\n"
+ "\tcmp r0, 0\n"
+ "\tbne _080DE13E\n"
+ "\tmovs r0, 0x4\n"
+ "\torrs r0, r2\n"
+ "\tstrb r0, [r4]\n"
+ "_080DE13E:\n"
+ "\tmovs r1, 0x2E\n"
+ "\tldrsh r0, [r3, r1]\n"
+ "\tcmp r0, 0\n"
+ "\tbeq _080DE14E\n"
+ "\tcmp r0, 0x1\n"
+ "\tbeq _080DE158\n"
+ "\tmovs r6, 0x1\n"
+ "\tb _080DE162\n"
+ "_080DE14E:\n"
+ "\tmovs r1, 0x30\n"
+ "\tldrsh r0, [r3, r1]\n"
+ "\tcmp r0, 0x2\n"
+ "\tbne _080DE162\n"
+ "\tb _080DE166\n"
+ "_080DE158:\n"
+ "\tmovs r1, 0x30\n"
+ "\tldrsh r0, [r3, r1]\n"
+ "\tcmp r0, 0x4\n"
+ "\tbne _080DE162\n"
+ "\tmovs r5, 0x1\n"
+ "_080DE162:\n"
+ "\tcmp r5, 0\n"
+ "\tbeq _080DE198\n"
+ "_080DE166:\n"
+ "\tldrb r2, [r4]\n"
+ "\tlsls r0, r2, 29\n"
+ "\tlsrs r0, 31\n"
+ "\tmovs r1, 0x1\n"
+ "\teors r1, r0\n"
+ "\tlsls r1, 2\n"
+ "\tmovs r0, 0x5\n"
+ "\tnegs r0, r0\n"
+ "\tands r0, r2\n"
+ "\torrs r0, r1\n"
+ "\tstrb r0, [r4]\n"
+ "\tldrh r0, [r3, 0x32]\n"
+ "\tadds r0, 0x1\n"
+ "\tmovs r1, 0\n"
+ "\tstrh r0, [r3, 0x32]\n"
+ "\tstrh r1, [r3, 0x30]\n"
+ "\tlsls r0, 16\n"
+ "\tasrs r0, 16\n"
+ "\tcmp r0, 0x5\n"
+ "\tbne _080DE1AA\n"
+ "\tstrh r1, [r3, 0x32]\n"
+ "\tldrh r0, [r3, 0x2E]\n"
+ "\tadds r0, 0x1\n"
+ "\tstrh r0, [r3, 0x2E]\n"
+ "\tb _080DE1AA\n"
+ "_080DE198:\n"
+ "\tcmp r6, 0\n"
+ "\tbeq _080DE1A4\n"
+ "\tadds r0, r3, 0\n"
+ "\tbl DestroyAnimSprite\n"
+ "\tb _080DE1AA\n"
+ "_080DE1A4:\n"
+ "\tldrh r0, [r3, 0x30]\n"
+ "\tadds r0, 0x1\n"
+ "\tstrh r0, [r3, 0x30]\n"
+ "_080DE1AA:\n"
+ "\tpop {r4-r6}\n"
+ "\tpop {r0}\n"
+ "\tbx r0\n");
+}
+#endif \ No newline at end of file