diff options
| author | spv420 <unomilliono@gmail.com> | 2022-04-23 16:31:30 -0400 |
|---|---|---|
| committer | spv420 <unomilliono@gmail.com> | 2022-04-23 16:31:30 -0400 |
| commit | 72f6f9b42f140dd64212135aa7a7682e18261977 (patch) | |
| tree | d369e9cae582667dcb71f7f1eabb9373e442770d /js | |
| parent | fb76ce368a3f50206328e3c5bc4064817fda747d (diff) | |
comment b0i
Diffstat (limited to 'js')
| -rw-r--r-- | js/mem.js | 9 | ||||
| -rw-r--r-- | js/str.js | 12 |
2 files changed, 18 insertions, 3 deletions
@@ -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 @@ -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); |
