Hello~~
I have just found about PICO-8 recently and I must say this is a neat little platform to play around :D
So after scrolling the manual a few times, I realize that PICO-8 got the 128 bytes of GPIO, which begs to be used for all sort of external communication. However, I haven't found someone who has made a wrapper library for this, all of the examples I found are simply examples of how someone use the GPIO for their specific communication requirements.
I tinkered for a while in my free time and thought that I might as well just create my own. The requirements that I had in mind is simply:
- able use the GPIO without race condition between the Host and PICO-8
- able to send a message of arbitrary length, even more than 128 bytes
- is configurable, doesn't take all of the GPIO space
- enable user to create their own protocol on top for their own usage
- reliable
A little bit of details:
If anyone is interested, you can check the code here
I have added a few simple examples on how you can use it. Simply copy paste the picoipc.p8 and the example script to your cart directory, create the input/output file, and run
pico8 -i input -o output -p picoweb |
(the flag is necessary to indicate that you're using the library)
Please note that this code is still POC quality, the naming is not consistent yet, and a lot of features are missing such as:
- sequence number checks and wrap around
- randomized sequence number start
- packet buffer update (for progress bar purposes)
- context switching
- javascript library
- nice GUI for the adapter
- reduce token usage
Later on, as the repository name suggest, I will build a protocol on top of this IPC to support:
- HTTP calls
- Websocket connections
Let me know what you think, I'll continue working on this on the next weekend. Happy tinkering!