Initial PicoCalc port of lua

After struggling quite a bit with display and keyboard drivers, here is an initial lua interpreter:

Nothing fancy, you can type in a program and run it. It’s based on GitHub - JeremyGrosser/picolua: A minimal example of Lua with Raspberry Pi pico-sdk
The terminal supports a subset of ansi commands; the LCD driver supports hardware scrolling.

Ctrl-C  Clear buffer
Ctrl-D  Execute buffer
Ctrl-L  Clear screen
Ctrl-Alt-Del  Reboot
Ctrl-Alt-F1  Reboot to bootsel for flashing

Next steps will be to have a proper REPL, a code editor and a way to save programs to flash/sd.

8 Likes

Hey thanks Ben I’ll definitely be looking to make use of this I have a few projects in mind for this device in Lua so great you made a start.

New release with a proper REPL, and a small API to access the SD card, draw graphics, read keyboard.

Tested only on pico2, but uf2 available for pico1 as well.
You can put a file named main.lua in the root of your SD card, it will get executed at startup.

Next, I’ll work on an editor.

7 Likes

Nice job and continued progress on this!

It would probably be a major project to implement, but have you considered adapting it to support the subset of commands, special features, and new commands that Pico-8 supports? I wondered if anyone else had done anything like that and found this:

Since it looks like an older project, it would probably only support older Pico-8 stuff, but it could be an alternative to the other old/unfinished Pico-8 port to Pico.

This would require porting the functionality of Love2D, as well, so probably a massive project. But it could bring a sort of standard lua platform to the PicoCalc.

Emulating pico-8 to the point of being able to run unmodified carts is a lot of work. The closest I find is GitHub - yocto-8/yocto-8: A (WIP) PICO-8 cartridge runner for the Raspberry Pi Pico and GitHub - DavidVentura/PicoPico: Pico-8 Player. This is indeed a big endeavour, and main limitation I can see is the requirement for 2MB of lua ram. I have not played with PSRAM yet, but it seems to be complex and slow.

1 Like

I created some custom lua functions in c and have them working in lua replicating some of the PICO-8 apis. I was wanting to try out this mini games framework on an actual device but i dont have a device yet. Also is something ive never done before writing to an actual screen off a device like this so have no idea if it will work.

1 Like