Picotron Playground -- an experimental web-based edition of my WIP Fantasy Workstation -- is OUT NOW! It includes a code editor and terminal program for poking around some demos of the #picotron API and runtime.

https://lexaloffle.com/bbs/?tid=50923

Picotron Playground

@zep oooh what a treat to end the year!
@zep Seems like I finally have something interesting to do tonight and a great way to start 2023 ๐Ÿ˜€

@zep I need to find how to properly use the 64 colors but meanwhile, looks like I made something work on Picotron! :P

EDIT : nevermind, instead of *16, just use *256. Got to port it and make it look as good as the original now!

@zep probably too early for such reports? But ctrl+A ctrl+C doesn't seem to work nothing get pasted with further cmd+V in another app) on Safari on macOS. It works OK on Chrome though. Similar for in-app selection > ctrl+C > ctrl+V, working strangely on Safari.
@beetrootpaul Thanks, I've buglisted it. Picotron needs to use some of the newer clipboard browser features (it can't get away with the cheap tricks PICO-8 uses), so I guess I'm doing something not universally supported there.
@zep Played around with the code in spiral, I divided by 0 and crashed it! It was GLORIOUS!!!
Woot! Thanks @zep - cannot wait to play with this! ๐Ÿฅณ๐ŸŽ‰
@zep Santa came late this year, but boy did he deliver...

@zep Hey, are you be fine with us also peeking around in the system folder.

Was able to write a small crappy script that show the content of "/system/tools/code.lua" for example. Mind if I would share this.

Or is there even a build in tool like less or cat to inspect those files. ... vim on picotron... oh the possibilities ... I'm a bit excited... :D

@ztiromoritz sure, np! Note that there is a lot of placeholder stuff in there though.

There isn't cat etc. yet but of course there will be :)

@ztiromoritz I just realised.. you can use /system/tools/code.lua for that too:

$ /system/tools/code /system/util/mkdir.lua

@zep haha, I missed this combination, after $ load system/api.lua
did not work.

The scripts that are directly in system/ seemed to be on the PATH. But not code.lua So I stopped there. And took a hard look at the js bundle which includes the files and learned some api from there to write my script.

@zep This is great! Iโ€™ve been waiting to play around with Picotron for a while.
@zep So incredibly excited to try this out! Thanks for all your hard work Zep, a ton of amazing programs will be developed with this. :)
@zep Iโ€™m really excited to play with this! Thank you!
@zep ooh, that audio api sounds very curious!

@zep tline3d documentation is incorrect!
doc:
tline3d(src, x0, y0, x1, y1, u0, v0, u1, v1, [w0, w1])

code (works):
tline3d(src, x0, y0, x1, y1, u0, u1, v0, v1, [w0, w1])

this is inconsistent with x/y parameters ordering!

@fsouchu @zep
Oof. I smell a code bug, not a docu bug.

@fsouchu The documented order is indeed the intended one (u0, v0, u1, v1) but I might have a blind spot for why the behavior is wrong. e.g. why does this work in highway.p64?

tline3d(ss, sx, 270, sx, 50, (x+vx*z0)/z0, (y+vy*z0)/z0, (x+vx*z1)/z1, (y+vy*z1)/z1, 1.0/z0, 1.0/z1)

@zep don't get either, coords look ok - also I don't get why my version is totally broken regarding sub-pixel precision vs. "manual" texturing
@zep jscript error when dragging on Picotron surface:

@zep crash drawing long lines (educated guess - will do repro later)

Uncaught RuntimeError: memory access out of bounds
at 001f2e56:0x27e90
at 001f2e56:0x147a0
at 001f2e56:0x77e4f
at Module.dynCall_vii (p64_playground_5.js:1:1181814)
at invoke_vii (p64_playground_5.js:1:1177064)
at 001f2e56:0x1342e
at 001f2e56:0x144d5
at 001f2e56:0x43139
at 001f2e56:0x4276b
at 001f2e56:0x1434b

@zep I'm really excited about this. I've been using pico-8 with my six year old and it's just a ton of fun. But it'll be really neat to work with fewer limitations. These fantasy machines are such a cool idea.
@zep how do you want to collect feedback & bugs? BBS posts? Mastodon?
@fsouchu The Playground BBS thread is preferable but Fedi works fine too. I'll make a placeholder sub-forum if it gets too messy.

@zep Picotron v7 raises an error on nil table iterator. Expected?

for i,v in pairs(nil) do
end
>>bad argument #1...

@fsouchu @zep Dunno what zep thinks but I would expect an error on trying to iterate nil.
@Felice @zep pico took a different approach so far - hence asking if intentional
(and no I very much like it doesnโ€™t raise an error - iterating on a nil table = nop)
@fsouchu @zep
Mm, no. Iterating on a nil table should be an error, not a nop. In most cases passing nil to an iterator suggests that the input variable was not derived correctly or that the code that was supposed to create a table in it failed, and the author needs to debug the code that created it. Doing a nop on nil just makes it harder for people to track down bugs.

@fsouchu @zep
BTW if you do want that behavior, just write something like maybe_pairs(t) that wraps pairs(t) with a test that returns a nop iterator if t is nil.

That'd do what you want and make the expected behavior explicit in your code.

@Felice @zep sure, just that this was supported on pico8, hence the question
@fsouchu Thanks, I've bug-listed it for v.8. Picotron is going to match PICO-8 behaviour where possible, but it might be worth introducing a 'strict mode' poke for those wanting to keep gremlins out of larger / more complex projects. cc: @Felice
@zep @fsouchu Yes, please, let us have a poke to rival gcc's "-werror -wall". Or several, maybe. After all, processors of this virtual era were starting to have hardware interrupts for non-critical stuff like divide-by-zero, which you could enable or disable.
@zep @fsouchu Speaking of which... a virtual hardware interrupt system might be fun... consider something like the HDMA interrupts on the SNES, for example.
@zep @fsouchu Glad you CC'ed me yet? ๐Ÿ˜œ
@zep Copy/paste from an external source appears to badly broken in 0.7+

@fsouchu Which browser / OS are you using? I tried v7 under [Win10 | Lubuntu] x [Chrome | Firefox | Edge] but couldn't reproduce yet. Note that you might need to grant permission depending on the browser.

I have no doubt that the clipboard doesn't work across all browsers though! (am using the newish browser API as I can't get away with the same tricks that PICO-8 uses).

@zep could not reproduce tbh - was reporting on behalf of some discord reports
@zep I've been having problems with clipboard- using Firefox on MacOS 10.15.
ctrl-v either doesn't paste anything or it enters "zxc" regardless of clipboard contents.
@GunTurtle Oh, I might have messed up by not supporting option-v there. Thanks, I'll try to get that fixed in the next update.
@zep what are the plans for optimized vector maths? I see that vec is largely missing or in plain lua (0.7)

@fsouchu There will be built-in cross-multiply, dot product etc. for f64 userdata, but I'm not sure of the basic syntax yet. I like:

v = userdata("f64", 3)
?v.x -- means get(v,0) or v[0]
v += v2 -- add v2 to v

But on trying some toy programs, it just feels too weird without being allowed components on the LHS, which is difficult (and maybe ill-advised?) to wrangle in Lua's implementation:

v.x = 3 -- surely!
v[0] = 3

@zep a โ€˜closedโ€™ set of operations would work ok I guess?
du = vec(3,0,0)
โ€” native C
u+=du
โ€” not supported
โ€” u.x+=3