Log In  

BBS > Superblog
Posts: All | Following    GIFs: All | Postcarts    Off-site: Accounts

Hello all!

Just grabbed Picotron in the last few days and have been experimenting with it - what a fun environment and vibe the community is putting forth as we all explore!

The main thing I am currently wondering about is if anyone has been able to discover a way to read arbitray files, either as strings or as binary? I know there's a fetch function that can be used to fetch data from urls or some types of files (text, pngs, etc). What I am not seeing is a way to read files as binary or otherwise non-explicitly supported file types?

The project I was working on was an image viewer that could pull in images from external urls, but they often come in a format that is not exactly what Picotron likes to use, so I was expecting to have to do some parsing of the files themselves - but that doesn't seem possible if I'm unable to look at a file as a blob of data.

I am perhaps just missing a built-in or some other obvious option here, but I'd love to hear from you all if you have any ideas here!

[ Continue Reading.. ]

1 comment


When windows or process lose visibility, the window manager sends the "lost_visibility" event to the process. This unsets the "running" bit (controls whether a process is running or suspended):

-- /system/lib/events.lua - lines 275-277
if (msg.event == "lost_visibility") then
  if (pid() > 3) poke(0x547f, peek(0x547f) & ~0x1) -- safety: only userland processes can lose visibility
end

The way we can get around this is having our process define a custom implementation of poke that avoids setting that bit. Copy and paste the following into any process that you'd like to keep running, even when it loses visibility:

-- get a reference to the system-defined poke()
local _sys_poke = poke
local is_visible = true
-- define a custom version of the function
poke = function(loc, val)
    -- if we see incoming parameters that would suspend our process...
    if loc == 0x547f and val == peek(0x547f) & ~0x1 then

[ [size=16][color=#ffaabb] [ Continue Reading.. ] [/color][/size] ](/bbs/?pid=144309#p)
4
0 comments


Cart #foraruyum-8 | 2024-04-26 | Embed ▽ | License: CC4-BY-NC-SA
11

My first arcade game on #picotron!
controls: left, right O(z) to fly)

instruction-gameplay: see the attract mode.

Enjoy!

rev 2: Since update on #picotron 0.1.0C the MAP() function stopped working and draw nothing. Hopefully the MGET() is back! So I fixed it with custom MGET() to SPR(MGET(x,y)...) to temporary solve it! @zep got another fix to do for 0.1.0d.

rev 3: added demo to attract mode and improved egg's sprite and enemys flying move.
rev 4: fixed some graphics et level map changes.
rev 5: Nice background obsession drive me to apply this. :)
rev 6: redefined the screen display (thanks to camera() and clip() functions!)
player's birdhead now starts levels at bothom (not get random killed/stomped by others on level's starts!)

[ Continue Reading.. ]

11
2 comments


Cart #magic8ball-0 | 2024-03-24 | Embed ▽ | License: CC4-BY-NC-SA
8

This Picotron cartridge can predict the future! Simply ask it any yes or no question, shake the window, and you'll get your answer!

(I hear you can also press z to get an answer, but that seems less fun than shaking the window.)


This was a fun little project to make. I finally figured out how to edit the cartridge's metadata! (Though I'm still not sure how to do it on a fullscreen cartridge).

I wanted to put a sound effect when shaking the window, but I have no idea how to work the instrument editor lol.

8
3 comments


I did not find a global "feature request" thread, so I've made this one, sorry if I've missed one.
I'm really enjoying picotron, and it feels like a breath of fresh air after all the modern software we've gotten so used to!
The animations, customization and everything else is so awesome! And the community has jumped on the train to create so many useful commands already, like the yotta package manager, etc. It is great to see how expandable the system is.
Yet I feel like there are a few things, that would be very nice to have, that we can't really implement ourselves right now, as far as I'm, aware. I will list them here, and please feel free to add in the comments. Hopefully this will be a helpful thread for @zep

  • I don't think there is a way to implement the reboot command without system-level code right now, yet it can be very useful at times
  • I think adding sound effects to some actions would greatly increase the system charm!
  • Maybe I'm missing something, but I do not think there is a way to change the system apps permanently, aka make them survive the system reset. I was playing around with trying to modify the file explorer to have a right click menu (delete, rename, info, etc), but the .p64 files seems to be reset every time. Same applies for the desktop, for example, if not modify it completely out right, maybe we could have some system-level right-click menu functionality? Would be amazing

[ Continue Reading.. ]

6
17 comments


The Evolution of Sunflower Biomorphs

Cart #sunflowerbiomoprh-0 | 2024-03-24 | Embed ▽ | License: CC4-BY-NC-SA
3

This cartridge implements a model of directed evolution, with the player providing the selection pressure. Using the mouse, we may choose one flower from a grid of randomly generated flowers. The chosen flower becomes the "parent" for the following generation.

Each simulated sunflower contains a unique set of "genes" that code for the size and number of petals, as well as their color. When the user picks the parent of the next generation, the screen is cleared, and the flowers are repopulated with mutant genes derived from the parent's genes. The user can put selection pressure on specific flowers, for example, by choosing the one with the largest petals.

[ Continue Reading.. ]

3
0 comments


How to reproduce:

  • use tline3d with "w" parameters
  • draw a tline where the starting point crosses the screen border
  • notice that result gets skewed

demo cart:

  • arrows to move square
  • see what happens when moving left :)

unrelated: tline3d doc needs some carriage returns!

Cart #wowogomewe-0 | 2024-03-24 | Embed ▽ | No License
3

3
1 comment


Cart #string-0 | 2024-03-24 | Embed ▽ | License: CC4-BY-NC-SA

String

Picotron is currently missing many basic string handling functions. I've created this library to fill in some of the functions that I've come across. If you want to contribute please comment below your code and I'll add it.

Installing

Use load #string and then press ctrl+R to install.

Functions

string.upper(str)

Converts a-z characters to their A-Z counter parts.

string.lower(str)

Converts A-Z characters to their a-z counter parts.

string.explode(str, delimiter)

Converts a string into an array, splitting it at the delimiter.

0 comments


Cart #dyninclude-3 | 2024-03-28 | Embed ▽ | License: CC4-BY-NC-SA
3

Script to dynamically include libraries, use dynInclude() instead of include()
You only need to specify the library name and it will be auto downloaded and installed if not currently installed then included automatically.

A simple and easy way to include libraries in your cart without the hassle.

Will try to load libaries from the following locations in this order:
1 - ./lib
2 - /appdata/system/lib
3 - /system/lib
4 - The BBS system (Will attempt to download and install the library to /appdata/system/lib

Usage:
The below code will include the basexx library, automatically downloading and installing it if necessary

include("./dynInclude.lua")

[ [size=16][color=#ffaabb] [ Continue Reading.. ] [/color][/size] ](/bbs/?pid=144273#p)
3
0 comments


The bug this cart fixes was patched in v0.1.0c, no longer needed unless you still use an old version

Use?
load #patch_load and press ctrl+r
This only needs to be done once and is persistent over reboots

Why?
There is currently a bug where you can only load #<cart> once per reboot
This is because of a typo on line 27 that doesn't properly delete the current cart
Patching isn't as simple as fixing the line as /system will refresh itself on every reboot
Run this cart to permanently fix this bug (Persistent over reboots)

How?
When run, store a patched load.lua in /appdata/system/util and append some lines to startup.lua
that will copy this patched load.lua to the /system/util folder on each reboot

Will it overwrite my startup.lua?
This cart will append to /appdata/system/startup.lua, so your current startup config will still work.

Src?
https://github.com/PyroChiliarch/picoPatchLoad

Versions:

version 1: main.lua was empty, fixed it.

[ Continue Reading.. ]

2
0 comments


Cart #newcarts-3 | 2024-03-24 | Embed ▽ | License: CC4-BY-NC-SA
15

A program that displays all new Picotron cartridges on the BBS and downloads them into RAM with a click. An easy way to find new programs from within Picotron itself.

15
6 comments


Cart #new-1 | 2024-03-25 | Embed ▽ | License: CC4-BY-NC-SA
5

What are you doing to clear /ram/cart at the moment?
Deleting files manually?
Rebooting Picotron?

Try using the brand new fancy empty cart!
Simply type load #new to clear out /ram/cart

That's it!

5
2 comments


Hi, I was experimenting with a way of making a multiplayer game on Pico-8 (on different cartriges to have more screen space).
So I was looking for a way to communicate from the cart to the host OS, I know it's possible to inject and retreive data on the web exports with javascript but I'm trying to find a way to do it localy .

I have tried that code:

cls()
i_channel=0x804
o_channel=0x805
input=''
output=''

function _update()
	local nb=0
	repeat
		nb=serial(i_channel,0x8000,0x1000)
		for i=0,nb do
			input..=chr(peek(0x8000+i))
		end
	until nb==0

	if (btnp(⬅️)) output..='⬅️' stdout('left ')
	if (btnp(➡️)) output..='➡️'	stdout('right ')
	if (btnp(⬆️)) output..='⬆️'	stdout('up ')
	if (btnp(⬇️)) output..='⬇️'	stdout('down ')
	if (btnp(🅾️)) output..='🅾️'	stdout('𝘰 ')
	if (btnp(❎)) output..='❎'	stdout('𝘹 ')
end

function _draw()
	print('\^rf'..output,2,2,7)
	print('\^rw'..input,66,2,13)
end

function stdout(str)
	for i,c in pairs(split(str,'')) do
		poke(0x9000+i-1,ord(c))
	end
	serial(o_channel,0x9000,#str) 
end

it uses the stdin and stdout of the cart to read and write into files when called like this:
> pico8 < input_file.txt > output_file.txt -run mycart.p8
The problem I ran into is that I can't use the same file for the input and output.

My best attempt was to use a pipeline to redirect the stdout of a cart to the stdin of another one like this:
> pico8 -run mycart.p8 | pico8 -run mycart.p8
The problem here is that a strange thing is happening, the first cart boots and works fine but the second one freezes until the first one is shutdown. Then it works as intended, I get the output from the first cart. But I am not able to make the to instances of the cart run at the same time and communicate.

Any idea how to pull it of ?

1
8 comments


Cart #basexx-1 | 2024-03-25 | Embed ▽ | No License
1


basexx.lua library for use with Picotron, (very) slightly modified version of https://github.com/aiq/basexx/blob/master/lib/basexx.lua

Install from BBS with load load #basexx and run it with crtl+r

A file will be created at /appdata/system/lib/basexx.lua

Usage:

include("/appdata/system/lib/basexx.lua")

string = "hello world"
print("Raw: " .. string)
print("Bit (Base2)" .. basexx.to_bit(string))
print("Hex (Base16) " .. basexx.to_hex(string))
print("Base32 " .. basexx.to_base32(string))
print("Base64 " .. basexx.to_base64(string))
print("Crockford " .. basexx.to_crockford(string))

[ [size=16][color=#ffaabb] [ Continue Reading.. ] [/color][/size] ](/bbs/?pid=144252#p)
1
0 comments


If you use the command line to set the value of a variable and then attempt to select a pause menu option where menuitem's callback function returns true (that is, an option that's supposed to keep the menu open after selecting), the game crashes with the message "attempt to call upvalue '_superyield' (a nil value)"

1
0 comments


Cart #calcifer-2 | 2024-03-27 | Embed ▽ | License: CC4-BY-NC-SA
14

Just a calculator, but with a fiery twist. My wife came up with the name, so I had to add a little mascot :) It's a fully functional calculator. At least I hope it is. Better not do your homework or taxes with it ^^;

Update: Fixed some odd behaviour and added a button to make numbers negative or positive.
Update 2: Fixed the behaviour of the % key, added partial keyboard support (at least the numbers are working), a custom icon and meta date.

Things to do:

  • Button feedback
14
6 comments


I cannot edit after ID8 in the instrument edit.


https://www.lexaloffle.com/dl/docs/picotron_synth.html#Instruments

There are 128 global instruments defined at 0x40000 by default, each 512 bytes.

Are the 128 instruments mentioned in the specifications scheduled to be available in the editor? Currently there are up to 25.

Also, when multiple envelopes are set to "DATA" mode, the window extends outside of the screen.
Scrolling is required in the same way as for the waveform configuration windows.

The picotron version at the time of this posting is at least 0.1.0d or earlier.

1
3 comments


Cart #base64-2 | 2024-03-25 | Embed ▽ | No License
6

base64.lua library for use with Picotron, (very) slightly modified version of https://github.com/iskolbin/lbase64

Install with load #base64 and run it with crtl+r
A new file will be created /appdata/system/lib/base64.lua

Basic usage:

include("/appdata/system/lib/base64.lua")
print("Plain: abcdefg")
print("Base64: " .. base64.encode("abcdefg"))

Basic functions:

base64.encode(string)
base64.decode(string)

Visit https://github.com/iskolbin/lbase64 for advanced usage

Source: https://github.com/PyroChiliarch/picoBase64

dynInclude compatible: https://www.lexaloffle.com/bbs/?tid=141042

6
0 comments


Cart #cmtn-0 | 2024-03-23 | Code ▽ | Embed ▽ | No License
6

This is a retexturing of Captain Neat-O in the Time Nexus by @paranoidcactus, done by my little brother. He wanted to show it off. Get to the final boss to see who it is! :)

6
1 comment


A tool to help with print debugging based on the Python package IceCream. There's already a Lua version of IceCream but it won't work with Pico-8/Picotron as far as I know. I've called it db for debug rather than ic but it's very similar in concept.

You can download the code here or copy/paste below:

db.lua [hidden]

----------------------------------------------------------------------------
-- print debugging based on IceCream for python
-- pico-8 lua version by jason delaat
do
   local ignore = {}
   local lookup = _ENV
   for k,_ in pairs(_ENV) do
      ignore[k] = true
   end
   local function format_arg(value, env)
      for k,v in pairs(lookup) do
         if v == value and not ignore[k] then
            return 'db: '..k..'='..tostr(v)
         end
      end
      return 'db: '..tostr(value)
   end

   local db_meta = {
      __call=function(self, value, log)
         if db.display and log then
            print(log)
         elseif db.display then
            print(format_arg(value))
         end
         return value
      end
   }
   db = {
      display = true,
      local_env = function(t)
         lookup = setmetatable(t or {}, {__index=_ENV})
         return lookup
      end,
      reset_env = function()
         lookup = _ENV
      end,
      wrap = function(f)
         local fn = sub(split(format_arg(f), '=')[1], 5)
         _ENV[fn] = function(...)
            local log = 'db: '..fn..'('
            local result = f(...)
            for a in all({...}) do
               log ..= tostr(a)..','
            end
            log = sub(log, 1, -2)
            log ..= ') --> '..tostr(result)
            return result, log
         end
      end
   }
   setmetatable(db, db_meta)
end
----------------------------------------------------------------------------

\

[ Continue Reading.. ]

1
0 comments




Top    Load More Posts ->