Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WASM runtime memory methods cannot access all RAM #1956

Open
joshgoebel opened this issue Jun 14, 2022 · 0 comments
Open

WASM runtime memory methods cannot access all RAM #1956

joshgoebel opened this issue Jun 14, 2022 · 0 comments
Labels
bug lang: wasm WASM runtime related

Comments

@joshgoebel
Copy link
Collaborator

joshgoebel commented Jun 14, 2022

That does raise another question though, why do any of the templates use TIC-80's memcpy and memset? Implementing them natively in the source language should allow them to access the full 256 KB of memory used in WASM mode, but the TIC-80 versions appear to be limited to the 96 KB in tic_ram. The only reason I can see is possibly performance, since I would guess that the native C versions are faster than anything that runs in the WASM interpreter.

Originally posted by @soxfox42 in #1784 (comment)


I've confirmed from reading source that this seems to be correct. The memory size can't be assumed to be 96kb anymore. It's 96kb on scripting runtimes and 256kb on the WASM runtime.

Right now source seems to be using sizeof(tic_ram) which is only going to count the 96kb of built-in RAM I think...

This is probably something that needs to be setup once (at runtime startup - or perhaps it's a static value inside each config) so that it's fast to access... anyways we need a way to access it when all we're given is a *tic_mem pointer, like in most API calls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug lang: wasm WASM runtime related
Projects
None yet
Development

No branches or pull requests

1 participant