TIC-80 icon indicating copy to clipboard operation
TIC-80 copied to clipboard

Request: an equivalent to stat(6) on the Pico-8

Open aebrer opened this issue 4 years ago • 5 comments
trafficstars

the stat() function on the Pico-8 allows you to view a lot of system information, like memory or cpu usage, in real time, from within your cart. In particular, stat(6) simply returns a string that can be passed in via the command-line argument -p. This can be incredibly useful for defining a unique random seed from the javascript that runs the emulator.

I've been reading through the issues, so I can understand if this isn't something that you want to implement, but I wanted to mention it anyway, as I would greatly enjoy it if I could use it.

Related: Would it be possible to emulate this somehow using memory banks? Maybe save a txt file, load it, store any variables it saves in a memory bank, then load the "real" cart and have access to the data that was written in the other cart?

thanks :)

aebrer avatar Nov 18 '21 16:11 aebrer

First we'd need to track memory and CPU usage. :)

joshgoebel avatar Nov 18 '21 17:11 joshgoebel

Well... those are definitely useful features, but not really what I'm asking about here.

Not trying to replicate the entire stat() function, just the stat(6)

aebrer avatar Nov 18 '21 17:11 aebrer

Would it be possible to emulate this somehow using memory banks? Maybe save a txt file, load it, store any variables it saves in a memory bank, then load the "real" cart and have access to the data that was written in the other cart?

No, carts can't read the filesystem (or other carts)... but outside of tic you could do all this with scripting, just open up the cart, write to it's own actual persistent memory block... then access that data inside TIC either with peek or pmem...

joshgoebel avatar Jan 07 '22 17:01 joshgoebel

from the javascript that runs the emulator.

If all you care about is the browser environ you could probably look into hacking it's pmem directly, assuming it's just stored in LocalStorage of some such, etc...

joshgoebel avatar Jan 07 '22 17:01 joshgoebel

thanks :) that's awesome! I will poke around with that when I get some time!

aebrer avatar Jan 07 '22 17:01 aebrer