diff --git a/LICENSE b/LICENSE
index 3e56fb4..ec32d94 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
MIT License
-Copyright (c) 2022-2024 sup39
+Copyright (c) 2021-2024 sup39
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
diff --git a/drawText/@code.xml b/drawText/@code.xml
new file mode 100644
index 0000000..a30d2b6
--- /dev/null
+++ b/drawText/@code.xml
@@ -0,0 +1,140 @@
+
+ drawText
+ lib
+ drawText
+ sup39(サポミク)
+ 0.3
+ Jan 02, 2023
+
+ ```c
+ typedef struct {
+ int16_t x;
+ int16_t y;
+ uint32_t fontSize;
+ uint32_t colorTop;
+ uint32_t colorBot;
+ } DrawTextOpt;
+ void drawText(DrawTextOpt *opt, const char *fmt, ...);
+ ```
+
+
+
+
+
+
diff --git a/drawText/info.xml b/drawText/info.xml
new file mode 100644
index 0000000..1a3b6ff
--- /dev/null
+++ b/drawText/info.xml
@@ -0,0 +1,20 @@
+
+ drawText
+ lib
+ drawText
+ sup39(サポミク)
+ 0.3
+ Jan 02, 2023
+
+ ```c
+ typedef struct {
+ int16_t x;
+ int16_t y;
+ uint32_t fontSize;
+ uint32_t colorTop;
+ uint32_t colorBot;
+ } DrawTextOpt;
+ void drawText(DrawTextOpt *opt, const char *fmt, ...);
+ ```
+
+
diff --git a/drawText/make.py b/drawText/make.py
new file mode 100644
index 0000000..eac1136
--- /dev/null
+++ b/drawText/make.py
@@ -0,0 +1,11 @@
+from supSMSGecko import make_xml, symbols, Button as B
+
+'''
+Note: drawText.s is modified from compiled drawText.c file
+'''
+
+def main(g, ver):
+ S = symbols[ver]
+ g.c_kit(addr_code=0x817f0238, input_path='src/drawText.s', entries=[])
+
+make_xml(main)
diff --git a/drawText/src/drawText.c b/drawText/src/drawText.c
new file mode 100644
index 0000000..6cd69d9
--- /dev/null
+++ b/drawText/src/drawText.c
@@ -0,0 +1,58 @@
+#include "drawText.h"
+#include
+
+/* built-in functions */
+extern struct {} *gpSystemFont;
+typedef float Mtx[3][4];
+typedef struct {
+ void* __vt__;
+ char unk[0x1c-4];
+ int xInt;
+ int yInt;
+ float xFloat;
+ float yFloat;
+ float zFloat;
+ char unk1[12];
+ uint32_t bgMask;
+ uint32_t fgMask;
+ uint32_t colorTop;
+ uint32_t colorBot;
+ int x4c;
+ int lineHeight;
+ int x54;
+ int fontWidth;
+ int fontHeight;
+ char unk3[8];
+} J2DPrint;
+
+void J2DPrint_print_1(void *this, void *font, int x4c, int lineHeight, uint32_t *colorTop, uint32_t *colorBot);
+// color.alpha = printer->color.alpha * alphaMask/0xff
+void J2DPrint_print_alpha_va(void *printer, uint8_t alphaMask, const char *fmt, va_list args);
+/**********************/
+
+
+void drawText(DrawTextOpt *opt, const char *fmt, ...) {
+ Mtx mtx;
+ J2DPrint printer;
+
+ va_list args;
+ va_start(args, fmt);
+
+ // new J2DPrinter
+ J2DPrint_new_1(&printer, gpSystemFont, 0, opt->fontSize, &opt->colorTop, &opt->colorBot);
+ printer.fontWidth = printer.fontHeight = opt->fontSize;
+
+ // set coordinate
+ printer.xInt = opt->x;
+ // printer.yInt = opt->y; // (actually unused)
+ printer.xFloat = opt->x;
+ printer.yFloat = opt->y;
+ printer.zFloat = 0;
+
+ // print text
+ J2DPrint_print_alpha_va(&printer, 0xff, fmt, args);
+ va_end(args);
+
+ // no need to delete if not allocating memory from heap
+ // delete_J2DPrint(&printer, -1);
+}
diff --git a/drawText/src/drawText.h b/drawText/src/drawText.h
new file mode 100644
index 0000000..0413f9d
--- /dev/null
+++ b/drawText/src/drawText.h
@@ -0,0 +1,14 @@
+#ifndef DRAW_H
+#define DRAW_H
+#include
+
+typedef struct {
+ int16_t x;
+ int16_t y;
+ uint32_t fontSize;
+ uint32_t colorTop;
+ uint32_t colorBot;
+} DrawTextOpt;
+void drawText(DrawTextOpt *opt, const char *fmt, ...);
+
+#endif
diff --git a/drawText/src/drawText.s b/drawText/src/drawText.s
new file mode 100644
index 0000000..050898b
--- /dev/null
+++ b/drawText/src/drawText.s
@@ -0,0 +1,71 @@
+ .globl drawText
+ .type drawText, @function
+drawText:
+.LFB0:
+ stwu 1,-248(1)
+ mflr 0
+ stmw 30,240(1)
+ mr 31,3 # r31 = opt
+ stw 0,252(1)
+ mr 30,4 # r30 = fmt
+ stw 5,136(1)
+ stw 6,140(1)
+ stw 7,144(1)
+ stw 8,148(1)
+ stw 9,152(1)
+ stw 10,156(1)
+#bne- 1,.L3
+ stfd 1,160(1)
+ stfd 2,168(1)
+ stfd 3,176(1)
+ stfd 4,184(1)
+ stfd 5,192(1)
+ stfd 6,200(1)
+ stfd 7,208(1)
+ stfd 8,216(1)
+.L3:
+ li 9,0x200
+ lwz 6,4(31) # opt->fontSize
+ sth 9,112(1)
+ li 9,0
+ addi 9,1,256
+ stw 9,116(1)
+ addi 9,1,128
+ stw 9,120(1)
+ lwz 4,gpSystemFont$r13(13)
+ addi 8,31,12 # opt->colorBot
+ addi 7,31,8 # opt->colorTop
+ li 5,0
+ addi 3,1,8 # &printer
+ bl J2DPrint_new_1
+################################
+ lwz 9,4(31) # fontSize
+addi 3,1,8 # &printer
+ stw 9,100(1) # printer.fontHeight =
+ stw 9,96(1) # printer.fontWidth =
+
+ lha 10,0(31) # x
+li 4,255 # 0xff
+ stw 10,36(1) # printer.xInt =
+
+# lha 9,2(31) # y
+mr 5,30 # fmt
+# stw 9,40(1) # printer.yInt =
+
+### xFloat, yFloat
+### GQR5 = 0x70007 (s16)
+ psq_l f0, 0(r31), 0, gqr5
+addi 6,1,112 # ...
+ psq_st f0, 44(r1), 0, gqr0
+
+### zFloat
+ li r0, 0
+ stw r0, 52(r1)
+
+ bl J2DPrint_print_alpha_va
+################################
+ lmw 30,240(1)
+ addi 1,1,248
+ lwz 0, 4(1)
+ mtlr 0
+ blr
diff --git a/drawText/test/@code.xml b/drawText/test/@code.xml
new file mode 100644
index 0000000..2d2a0ca
--- /dev/null
+++ b/drawText/test/@code.xml
@@ -0,0 +1,154 @@
+
+
+
+
+
+
diff --git a/drawText/test/make.py b/drawText/test/make.py
new file mode 100644
index 0000000..ade13f0
--- /dev/null
+++ b/drawText/test/make.py
@@ -0,0 +1,15 @@
+from supSMSGecko import make_xml, symbols, Button as B
+
+'''
+Note: drawText.s is modified from compiled drawText.c file
+'''
+
+def main(g, ver):
+ S = symbols[ver]
+ g.C2(
+ addr = S['drawWater'] - 0x30,
+ input_path = 'test.s',
+ extra_ld_input = ['drawText = 0x817f0238;'],
+ )
+
+make_xml(main)
diff --git a/drawText/test/test.s b/drawText/test/test.s
new file mode 100644
index 0000000..4318f9c
--- /dev/null
+++ b/drawText/test/test.s
@@ -0,0 +1,74 @@
+/** drawText(option, fmt, ...)
+ * r3 = option
+ * r4 = fmt
+ */
+
+.macro .opt x y size top bot
+ bl 16
+ .short \x
+ .short \y
+ .long \size
+ .long \top
+ .long \bot
+ mflr 3
+.endm
+
+.test:
+
+.test.qft:
+ lwz r12, gpMarDirector$r13(r13)
+ lwz r12, 0x5C(r12)
+ mulli r12, r12, 1001
+ li r0, 120
+ divwu r12, r12, r0
+### r7 = ms
+ li r0, 1000
+ divwu r11, r12, r0
+ mulli r10, r11, 1000
+ sub r7, r12, r10
+### r6 = s
+### r5 = m
+ li r0, 60
+ divwu r5, r11, r0
+ mulli r10, r5, 60
+ sub r6, r11, r10
+## option
+ .opt 16 327 30 0xf43464ff 0xf6f6f6ff
+## fmt
+ bl .qft.fmt.bl
+ .asciz "%d:%02d.%03d"
+ .align 2; .qft.fmt.bl: mflr r4
+## call
+ lis r12, drawText@h
+ ori r12, r12, drawText@l
+ mtlr r12
+ blrl
+
+.test.display:
+ lwz r12, gpMarioOriginal$r13(r13)
+ lfs f1, 0x10(r12)
+ lfs f2, 0x14(r12)
+ lfs f3, 0x18(r12)
+ lfs f4, 0xB0(r12)
+ lfs f5, 0xA8(r12)
+### r5 = A
+ lhz r5, 0x96(r12)
+### r6 = C
+ lwz r12, gpCamera$r13(r13)
+ lhz r6, 0xA6(r12)
+ addi r6, r6, -0x8000
+### r7 = QF
+ lwz r12, gpMarDirector$r13(r13)
+ lwz r7, 0x58(r12)
+ rlwinm. r7, r7, 0, 0x3
+## option
+ .opt 16 188 15 0xffffffff 0xffffffff
+## fmt
+ bl .display.bl
+ .asciz "X %.0f\nY %.0f\nZ %.0f\nA %hu\nC %hu\nH %.2f\nV %.2f\nQF %d"
+ .align 2; .display.bl: mflr r4
+## call
+ lis r12, drawText@h
+ ori r12, r12, drawText@l
+ mtlr r12
+ blrl