summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorProjectRevoTPP <projectrevotpp@hotmail.com>2020-04-20 13:11:51 -0400
committerProjectRevoTPP <projectrevotpp@hotmail.com>2020-04-20 13:11:51 -0400
commit84e6fbb44f67343e587b8b5758bca0671f01bf8c (patch)
treede28abd681fca08ac1e66f817b369a25acab933b
parent388dbcaef64532c14fb94b9e649f297ffe08e221 (diff)
migrate data symbols to string_util.c
-rw-r--r--asm/rom2.s2
-rw-r--r--asm/rom2_2.s7
-rw-r--r--pokediamond.lcf2
-rw-r--r--src/string_util.c35
-rw-r--r--undefined_syms.txt2
5 files changed, 42 insertions, 6 deletions
diff --git a/asm/rom2.s b/asm/rom2.s
index e3c5dfc9..6b80f56e 100644
--- a/asm/rom2.s
+++ b/asm/rom2.s
@@ -140,4 +140,4 @@ FUN_020EC5CC:
.global FUN_020EC694
FUN_020EC694:
-.incbin "baserom.nds", 0xF0694, 0x1b090
+.incbin "baserom.nds", 0xF0694, 0x474
diff --git a/asm/rom2_2.s b/asm/rom2_2.s
new file mode 100644
index 00000000..3f97d6a6
--- /dev/null
+++ b/asm/rom2_2.s
@@ -0,0 +1,7 @@
+.include "asm/macros.inc"
+
+/* rom2.s TODO: Disassemble */
+
+.section .text
+
+.incbin "baserom.nds", 0xF0B50, 0x1ABD4
diff --git a/pokediamond.lcf b/pokediamond.lcf
index 1c149b5d..cb717309 100644
--- a/pokediamond.lcf
+++ b/pokediamond.lcf
@@ -384,6 +384,8 @@ SECTIONS {
rom1.5.o (.text)
FUN_020C9C0C.o (.text)
rom2.o (.text)
+ string_util.o (.data)
+ rom2_2.o (.text)
} > arm9
.arm9overlay : AT (0x10B800) {
diff --git a/src/string_util.c b/src/string_util.c
index 2159210d..7d755cb9 100644
--- a/src/string_util.c
+++ b/src/string_util.c
@@ -1,7 +1,36 @@
#include "nitro.h"
-extern u32 gPowersOfTen[]; // at 0x20ECB24
-extern u16 gDigitTable[]; // at 0x20ECB08
+u16 gDigitTable[] = {
+ 0xA2,
+ 0xA3,
+ 0xA4,
+ 0xA5,
+ 0xA6,
+ 0xA7,
+ 0xA8,
+ 0xA9,
+ 0xAA,
+ 0xAB,
+ 0xAC,
+ 0xAD,
+ 0xAE,
+ 0xAF,
+ 0xB0,
+ 0xB1
+};
+
+s32 gPowersOfTen[] = {
+ 1,
+ 10,
+ 100,
+ 1000,
+ 10000,
+ 100000,
+ 1000000,
+ 10000000,
+ 100000000,
+ 1000000000,
+};
static const u16 EOS = 0xFFFF;
@@ -104,7 +133,7 @@ const u16 NON_DIGIT = 0xE2;
u16 *ConvertUIntToDecimalString(u16 *dest, u32 value, enum PrintingMode mode, u32 n)
{
- for (u32 x = gPowersOfTen[n]; x != 0; x = x / 10) {
+ for (u32 x = gPowersOfTen[n - 1]; x != 0; x = x / 10) {
u16 res = value / x;
value = value - x * res;
if (mode == PAD_ZEROES) {
diff --git a/undefined_syms.txt b/undefined_syms.txt
index 82478d71..3dc1de91 100644
--- a/undefined_syms.txt
+++ b/undefined_syms.txt
@@ -851,5 +851,3 @@ gUnk021C4918 = 0x21C4918;
gUnk021D76C8 = 0x21D76C8;
gUnk021DBE18 = 0x21DBE18;
gUnk027FFC20 = 0x27FFC20;
-gPowersOfTen = 0x20ECB24;
-gDigitTable = 0x20ECB08;