Log In  
Follow
thisismypassword

Cart #zxspectrum-0 | 2023-10-13 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
5

How?

  • It's recommended to run it in Pico-8 with "-displays_x 2 -displays_y 2".
  • If you don't (say, if you run it in the BBS), you'd have to move the mouse around to see the whole window
  • In particular, move the mouse to the bottom-left corner to see the Spectrum prompt

  • You can use the keyboard to type stuff
  • The symbol key is Tab.
  • ZX Spectrum keyboard layout: http://slady.net/Sinclair-ZX-Spectrum-keyboard/layout/
  • ZX Spectrum user manual: https://worldofspectrum.org/ZXBasicManual/
  • Non-spectrum keys like punctuation/backspace automatically press the right shift/symbol combination

  • To load a tape:
  • First type 'j' for load.
  • Then type double-quotes (") twice. On the BBS or on non-standard keyboard layouts, you're better off pressing Tab+P to get double-quotes. (On BBS, '~' might also work - looks like an emscripten bug).

[ Continue Reading.. ]

5
0 comments



Currently, there are two ways to access pico8 memory: peek/poke[2/4] and @/%/$

The @/%/$ operators look a bit weird but are faster and better overall.
However, I think their main drawback is that they don't replace the need for poke, causing code that uses them to necessarily be quite inconsistent, imbalanced and weird whenever it needs to combine peeks with pokes.

I wanted to check how hard it would be to add the ability to poke into @/%/$, so I created the following fork of z8lua that implements it:
https://github.com/thisismypassport/z8lua

Here's how it works:


-- simple poke
@0x1000 = 0x1

?@0x1000 -- outputs 1

-- use of $ as both peek and poke (copying 4 bytes of memory)
$0x8000 = $0

-- multiple assignment
@1,%2,$4 = 1,2,4

?@1 -- outputs 1
?%2 -- outputs 2
?$4 -- outputs 4

-- compound assignment - worked automatically
@1 += 0x80

?@1 -- outputs 129 (since previously was 1)

-- poke metatables
meta = setmetatable({}, {

[ [size=16][color=#ffaabb] [ Continue Reading.. ] [/color][/size] ](/bbs/?pid=134944#p)
4
1 comment



Cart #resolution-1 | 2023-09-26 | Code ▽ | Embed ▽ | No License
3

Repuzzle hint & solution cart

("Resolution")

What's Repuzzle?

Sounds like you're here by mistake.

Head over to Repuzzle's page in the BBS and don't come back unless and until you're well and truly stuck.

What does this cart contain?

All hints and solutions for Repuzzle - revealable in gradual order.

Whether you need a small pointer for a level or five you're stuck on, or whether you want to see all the solutions - this cart has you covered.

Though it won't make getting to the solutions too pleasant!

Controls?

You can use the standard pico8 controls, or you can use the mouse (Mouse wheel and buttons only. The mouse wheel also works inside popups)

[ Continue Reading.. ]

3
1 comment



I found some confusing behavior when trying to put multiple if/while shorthands on the same line, e.g.:

if (x1) if(x2) print('true')
print('anyway')

This prints 'anyway' only if x1 is true - whereas I would've expected it to print 'anyway', well - anyway.

It looks like line breaks only terminate a single if/while shorthand, causing the next line to be inside the other shorthand.

It used to be that this code was generating a runtime error, but now it just silently does something really unexpected instead.

2
1 comment



Hi @zep, I found today that >><= and <<>= don't work in 0.2.5g (a regression, as they worked in the past for sure - didn't check which version broke them)

E.g:

a=3
a<<>=5
print(a) -- 3 now
5
2 comments



There seems to have been a change in the virtual cpu cost of +=

Previously, in 0.2.4b, both x=x+y and x+=y cost 1 cycles.
Now, in 0.2.5g, x=x+y costs 1 cycle while x+=y costs 2 cycles.
(Where x and y are locals)

The same happens with other operators that cost 1 cycle, e.g. -=/- and &=/&

This feels like a bug since I wouldn't except x+=y to be costlier than x=x+y

Below code shows the perf. difference.

function testme_calib(name, func, calibrate_func, ...)
  -- based on https://www.lexaloffle.com/bbs/?pid=60198#p
  local n = 1024

  -- calibrate
  flip()
  local unused -- i am not sure why this helps give better results, but it does, so.

  local x,t=stat(1),stat(2)
  for i=1,n do
    calibrate_func(...)
  end
  local y,u=stat(1),stat(2)

  -- measure
  for i=1,n do
    func(...)
  end
  local z,v=stat(1),stat(2)

  -- report
  local function c(t0,t1,t2) return(t0+t2-2*t1)*128/n*256/60*256*2 end -- *2 for 0.2.x

  local s=name.." :"
  local lc=c(x-t,y-u,z-v)
  if (lc != 0) s..=" lua="..lc
  local sc=c(t,u,v)
  if (sc != 0) s..=" sys="..sc

  printh(s)
  print(s)
end

function testme(name, func, ...)
  return testme_calib(name, func, function() end, ...)
end

testme("+", function(x,y) x=x+y end, 1, 2)
testme("+=", function(x,y) x+=y end, 1, 2)

10
5 comments



Previously, gonengazit found some infinite token exploits here and zep fixed them, but looks like they're not all gone yet - I stumbled upon one that still happens:

x=[[[[]]
 put your infinite tokens here...
--]]

Seems like it happens because pico8 supports recursive block comments, and uses the same code to also parse long strings recursively.

But lua then parses the long string non-recursively and executes the code that pico8 thought was part of the string.

Pico8 probably should only parse block comments recursively, not long strings.

5
1 comment



I've created a cart minification & linting tool in python - Shrinko8:

https://github.com/thisismypassport/shrinko8

If you don't want to download anything, or want to use a UI - you can use the webapp here:
https://thisismypassport.github.io/shrinko8/

Otherwise, see the github link for details on how to download & use the tool.

Features

  • It can do aggressive minification to reduce the token count, the character count, and the compressed size of a cart, giving meaningfully better results than other known tools like p8tool or GEM.

  • (E.g. in one example, a 81,416 char cart went to 31,213 chars with shrinko8, 35,563 chars with p8tool (though p8tool didn't run on it without having to do some hacks), and 40,813 chars with GEM.)

  • It can do linting, aka reporting of issues that may indicate bugs in your code, such as undefined, unused and duplicate local variables.

  • It supports all pico8 syntax and globals, including modern ones (as of the time of writing, but I do plan to update it when needed).

[ Continue Reading.. ]

34
21 comments



While pico8-lua itself can handle even 0x7fff arguments being passed to a function (easy to see via unpack, for example), peek and poke seem to only handle up to 0x2000.

E.g. peek(0x8000, 0x2001) returns 0x2000 values instead of 0x2001
And poke(0x8000, <0x2001 values>) only pokes addresses up to 0x9fff

3
6 comments



Ever since 0.2.4c came to the BBS, copy/paste seems to cause a crash/hang:

  • stat(4) when there is something in the clipboard hangs
  • printh(<..>, "@clip") hangs
1
3 comments



There used to be an issue where coroutines would yield unexpectedly if they took to long to execute.
This was fixed a while back, but I see that for coroutines that themselves run inside coroutines - this still happens.

In the below code, in the 'coroincoro' case, nil is yielded instead of 1, showing that the yield happened sometimes before the "real" yield call.

sleep=function() for i=0,100,0.00002 do end yield(1) end

function test(name, func, ...)
    local coro=cocreate(func, ...)
    local ok,result=coresume(coro)
    print(name..": "..tostr(ok)..", "..tostr(result))
end

test("coroutine", sleep)

local cc = cocreate(function()
    test("coroincoro", sleep)
end)
coresume(cc)
1
2 comments



I noticed some nits about the way tokens are computed:

  • A few assignment operators ( ..= ^= >><= >><= ) seem to cost 2 tokens instead of 1 (all other assignment operators cost 1)

  • There seems to be logic that checks the token before '-' to determine if the '-' is a unary operator or not, but it doesn't seem to check newer operators (like &, |, etc.) and thus -1 is considered 2 tokens in things like "a & -1". (Even though it's 1 token in "a + -1")
1
1 comment



Cart #repuzzle-13 | 2023-08-26 | Code ▽ | Embed ▽ | No License
26

Repuzzle - a Pico-8 Coding Puzzle Game

Insert, replace, delete, and move characters to win over 22 levels, ranging from the simple to the tricky.

Explanation of the basic controls is provided in the game.

Tips:

  • The pico-8 manual and pico-8 wiki can be useful. (both for this game and in general)
  • If you're stuck on one level, try another. The different "sections" each go roughly from easy to hard, with a lot of variance in-between.
  • If you're really really stuck, the hints can help.

Full list of controls:

Browsing:

  • Arrow keys to move between characters
  • Ctrl + Arrow keys to move between words
  • Page Up/Down to move between pages

[ Continue Reading.. ]

26
25 comments



This issue reproduces for me on multiple browsers (including chrome), and for luchak (on chrome 98).

Warning: this bug deletes all BBS saves - not just the ones of the carts used to reproduce it.

Steps to reproduce:

  1. Load some cart with a save in it, verify that the save works. I used https://www.lexaloffle.com/bbs/?pid=94408#p (you can save/restore via menu)
  2. Open new tab with some other cart. I used https://www.lexaloffle.com/bbs/?pid=108109#p
  3. In this new tab, press play and immediately switch to the old tab
  4. Refresh the old tab and check if your saves are still there. They will not be.
  5. If you want to see your saves again, switch to the new tab and let it load. If you don't care, delete the new tab - your saves are now gone forever.

It looks like when a game is first loading, it deletes the local storage (well, indexed db). Then, a bit later, it restores it.

4
1 comment



It seems when the index parameters are out of bounds, sub now returns the last character in the string, instead of "", which breaks string parsing code.

As an example of incorrect result, sub("a",2,2) returns "a", whereas it's supposed to (and used to) return "".

4
3 comments



New API pack() returns a table with an "n" field of always 0?

?pack(1,2).n -- 0 (expected: 2)
?pack(1,2,nil,3,nil).n -- 0 (expected: 5)

table.pack works as expected in lua.

2
2 comments



I've just seen from the Pico 8 wiki that there's a new while shorthand:
while (cond) actions

And yeah - it works.
But it's not documented anywhere in the manual - not in the shorthand section and not even in the changelog!

1
1 comment



(Applies to verison 0.1.12d rcsd)

  1. Lua's 'tostring' function is exposed now. It converts things to strings differently than tostr, including printing a table's address in memory.

  2. After doing "install_demos()" or "install_games()", something seems to go majorly wrong with pico-8. All nils become... nulls?!
    You can see this by trying to print a non-existing global/table value which would normally print [nil], but now prints [(null)].
    What is the type of a null? It's a null, too! (No, not the string "null" - but a null object itself)
    (It's clearly not a legal lua value)

You can see the above oddities via my https://www.lexaloffle.com/bbs/?tid=36381 cart, if you'd like.

1
0 comments



Cart #pico_repl-35 | 2023-08-25 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
45

What's this?

A REPL (Read-Eval-Print Loop) for pico-8, in pico-8!

Supports executing all lua & pico-8 statements. (if statements, for loops, functions - you name it)

While my code does its own parsing and execution of the statements, any functions you call are the real pico-8 functions.

Code can be typed in, pasted in, or dropped in from .lua files.

Alternatively, carts saved in .p8.rom format (save mycart.p8.rom in pico-8) can be dropped to the REPL to automatically run them.

What can I do with it?

Type expressions like 1+3/5 or sqrt(-2) to see the expected results. (Well - perhaps unexpected to some in the case of the sqrt)

Type statements or programs like the one below to do whatever you wish. (That one prints all global functions)

[ Continue Reading.. ]

45
32 comments



Cart #fairchild001-11 | 2022-02-23 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
26

Update 1 - full speed & better sound.
Update 2 - fix missing mouse cursor.
Update 3 - fix speed decrease in Pico8 0.2.0
Update 4 - support cart/bios drag&drop and function keys.

What is this?

An emulator for the Fairchild Channel F, the first console to use programmable ROMs and a microprocessor.
The console was released in 1975, so don't expect much in the way of graphics, gameplay, or usability.
See Wikipedia for more info.

And what's that game running?

That's a homebrewed (i.e. - NOT original) game made by Blackbird and e5frog. You can find it here.

[ Continue Reading.. ]

26
10 comments





Top    Load More Posts ->