PICO-8 on MiSTer Linux

https://github.com/MiSTer-devel/Main_MiSTer/wiki

Moderators: Mug UK, Zorro 2, Greenious, spiny, Sorgelig, Moderator Team

coinfeeder
Atarian
Atarian
Posts: 1
Joined: Tue May 07, 2019 1:49 am

PICO-8 on MiSTer Linux

Postby coinfeeder » Tue May 07, 2019 2:11 am

Hi there,

I'm currently working on getting PICO-8 work nicely on the MiSTer.

I'm approaching the current order of making this happen right now:

1. (Just make it work) Make the arm version of PICO-8 work on the MiSTer-optimized LXDE using X
2. Switch from X11 to directfb (working on it, biggest challenge is that the latest SDL is not compiling with directfb that comes with the distro and the SDL that comes with it only supports X and Mir)
3. Run PICO-8 wasm targets work in a headless fashion on the arm while rendering via framebuffer -> FPGA
4. Optional, depending on interest: Develop a hardware implementation (core) of PICO-8 (would come with the drawback of always needing to keep this up2date with latest PICO-8). Alternatively we could try to get something like https://github.com/lastmjs/wasm-metal run on the DE10 :mrgreen:

While my use-case might be specific, my current challenges are not .. hence I'm reaching out here for advice.

Here's my current challenges:

Audio doesn't work

I'm using the latest MiSTER patched LXDE + update. I can't get audio to work with alsa or libsndio. I can see the MiSTer FPGA audio device in alsamixer and it's not muted and volume is up. You should ideally be able to reproduce this by playing any audio file using aplay, it just hangs forever instead of playing anything.

240p @ 15khz with C-Sync on VGA output

- I'd like to disable the vga_scaler and enable composite_sync on the vga output. Or to say it the other way around, I'd like 720p@60hz on the big screen + boxed 240p at 15khz with csync on the vga.

Is this possible at the moment, maybe by defining a custom video mode?

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5788
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: PICO-8 on MiSTer Linux

Postby Sorgelig » Tue May 07, 2019 11:51 am

LXDE is pretty much limited and not really good for multimedia. Although you can watch youtube in firefox with sound.
Both audio and video are implemented in very basic form so it may fail when using in some performance applications.

I suggest to move to original MiSTer setup, alsa works there too as MIDI soft synthesizers play fine. And for video you will need to make a special core where you can control the resolution and synchronization.

peepsalot
Atari User
Atari User
Posts: 34
Joined: Wed Jan 01, 2020 6:45 pm

Re: PICO-8 on MiSTer Linux

Postby peepsalot » Thu Jan 09, 2020 10:52 pm

I think this idea of fantasy console is pretty neat and turning them into "real" FPGA hardware would be amazingly cool to me!

I know this is a somewhat old post, so maybe the idea is long abandoned, but coinfeeder I wonder if you have seen this project: https://github.com/picolove/picolove
That would maybe be usable for the Linux side of things. It claims to run PICO-8 files but I don't think they have implemented any of the "IDE" etc.

Aside from a Linux implementation, I'm guessing a true FPGA port would be much larger endeavor though.
I have zero experience so far with FPGA design, but am interested in trying to learn. Since Lua runs bytecode in a VM, maybe it would not be too unreasonable to design some hardware around that.
I did a little bit of research on Lua VM and PICO-8 "machine" details and found a few resources which could be useful references:


If a sort of general Lua VM core could be made, then maybe those "Lua Assembly Tools" could be run on the core as a sort of "OS firmware" to help compile text based carts to bytecode "ROMs".
Or, probably an easier option, the bytecode compilation could be done with external tools outside of the FPGA and the core would just require to provide those pre-compiled ROMs in its own format.

Also I guess the editor UI, command line, etc could be written in Lua as well, (not sure but maybe PICO-8 software does this also?)

It looks like the PICO-8 system calls graphics/sound are all memory-mapped registers, so at least that one aspect would hopefully be straightforward to describe as hardware.

Of course there is the issue of PICO-8 being closed-source/commercial, so I don't know if there would be any copyright/trademark type legal concerns in duplicating the full editor interface etc.
The default palette and font at least are CC-0, see bottom of page here.

There were also a few other similar open source fantasy consoles listed here. As far as I understand from a brief glance, all of the others (besides picolove) are not meant to be PICO-8 compatible, and define their own variation of language API etc.
So the others could be interesting on their own, but it seems like PICO-8 has by far the larger community of developers writing games and demos.

Anyways, just some of my thoughts on that. If nothing else, I had some fun researching and daydreaming about this sort of stuff.

trashuncle
Atari nerd
Atari nerd
Posts: 46
Joined: Fri Jul 05, 2019 9:34 pm

Re: PICO-8 on MiSTer Linux

Postby trashuncle » Sun Jan 12, 2020 9:05 am

The more games accessible on the MiSTer platform, the better! Please more stuff like this. I've known about the Pico-8 community for a while and the game library is pretty massive at this point now. Have a real hardware solution for these games would be amazing (and possibly even lead to it showing up for other fpga projects, like a portable pico-8 that isn't just another pi device or playing in a browser window or full screen.

Mills
Atari User
Atari User
Posts: 30
Joined: Sun Oct 13, 2019 10:57 am

Re: PICO-8 on MiSTer Linux

Postby Mills » Sun Jan 12, 2020 5:46 pm

I have never heard about PICO-8 until now. A hardware implementation of this "fantasy console" would be awesome. But it just checked and it is not free, so I don't know if someone could port it, or release it as an fpga core.

peepsalot
Atari User
Atari User
Posts: 34
Joined: Wed Jan 01, 2020 6:45 pm

Re: PICO-8 on MiSTer Linux

Postby peepsalot » Sun Jan 12, 2020 10:35 pm

Yeah I mentioned the closed-source aspect in my previous post. I don't think there's any legal claim that could be made over a totally independently developed re-implementation of the API, but I'm not a lawyer so who knows for sure. Apparently it hasn't been an issue for picolove so far at least.

Mills
Atari User
Atari User
Posts: 30
Joined: Sun Oct 13, 2019 10:57 am

Re: PICO-8 on MiSTer Linux

Postby Mills » Tue Jan 14, 2020 12:40 pm

I have been reading about these fantasy consoles/computers, and all of them have a kind of disappointing thing. They don't have a tile based VRAM, you have to draw and clear the maps every frame in your simulated software code, which uses the map just like a big image and draws it to a framebuffer. A "real" retro console, generates the image on screen by reading the contents of the cells according to the map etc etc...

So with these consoles you can draw a lot of layers and things on top of others, not like a "real" console they want to simulate.

If a fantasy console is ported to fpga, I'd be awesome if it really uses tile/maps and not a framebuffer. I'd like to create one, similar to a game boy, but with two map layers, 16 colours per tile, and coded in lua. But I lack the programming skils to do so.

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5788
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: PICO-8 on MiSTer Linux

Postby Sorgelig » Tue Jan 14, 2020 2:20 pm

There is gameduino (first one, not the current one) FPGA project with exactly tiles and sprites. Just need to be ported to MiSTer with addition of some CPU. I suggest to use ZPU as CPU - it has gcc toolchain.

softtest1
Atari User
Atari User
Posts: 32
Joined: Tue Apr 30, 2019 6:37 pm

Re: PICO-8 on MiSTer Linux

Postby softtest1 » Tue Jan 14, 2020 3:30 pm

A core that is made to run love2d software (including picolove) would be very cool.

Another option for a game dev could be the original PlayStation (a core is being developed). It has everything the SNES has and more, with a saner architecture and the option to use C/C++.


Return to “MiSTer”

Who is online

Users browsing this forum: funkheld, Kintaro, l0max and 11 guests