summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorspv420 <unomilliono@gmail.com>2022-04-23 16:31:30 -0400
committerspv420 <unomilliono@gmail.com>2022-04-23 16:31:30 -0400
commit72f6f9b42f140dd64212135aa7a7682e18261977 (patch)
treed369e9cae582667dcb71f7f1eabb9373e442770d /js
parentfb76ce368a3f50206328e3c5bc4064817fda747d (diff)
comment b0i
Diffstat (limited to 'js')
-rw-r--r--js/mem.js9
-rw-r--r--js/str.js12
2 files changed, 18 insertions, 3 deletions
diff --git a/js/mem.js b/js/mem.js
index e10841e..243eaeb 100644
--- a/js/mem.js
+++ b/js/mem.js
@@ -139,6 +139,9 @@ function get_our_slide() {
}
}
+/*
+ * write str to addy
+ */
function write_str(addy, s) {
for (cur_addy = addy; cur_addy < (addy + s.length); cur_addy++) {
write_u8(cur_addy, s.charCodeAt(cur_addy - addy));
@@ -147,8 +150,12 @@ function write_str(addy, s) {
return s;
}
+/*
+ * sptr is meant to give you a pointer to a specified string
+ * remember your nul's!
+ */
function sptr(s) {
write_str(global_sptr_addy, s);
global_sptr_addy += s.length;
return global_sptr_addy - s.length;
-}
+} \ No newline at end of file
diff --git a/js/str.js b/js/str.js
index b7d9d28..31621bf 100644
--- a/js/str.js
+++ b/js/str.js
@@ -1,5 +1,7 @@
-
-
+/*
+ * currently unused (iirc) garbage
+ * basically just prints an address than the uint32_t there, and then +4, etc
+ */
function prim_dump_u32(buf) {
s = "";
@@ -29,6 +31,9 @@ function prim_dump_u32(buf) {
return s;
}
+/*
+ * pad str to n chars with c chars to the left
+*/
function pad_left(s, c, n) {
s_ = s;
@@ -39,6 +44,9 @@ function pad_left(s, c, n) {
return s_;
}
+/*
+ * convert ASCII str to uint8array (unicode be damned)
+ */
function str_to_uint8_buf(s) {
buf = new Uint8Array(s.length);