From 72f6f9b42f140dd64212135aa7a7682e18261977 Mon Sep 17 00:00:00 2001 From: spv420 Date: Sat, 23 Apr 2022 16:31:30 -0400 Subject: comment b0i --- js/mem.js | 9 ++++++++- js/str.js | 12 ++++++++++-- 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); -- cgit v1.2.3