Log In  


Hey, this is my first cart! I was just messing around to figure out how fast can I put pixels on screen. Turns out it's possible at 30% of cpu!

Epilepsy warning!

Cart #fastnoise-0 | 2025-08-19 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1

1


Welcome to PICO-8! This is a great exercise for a first cart!

If you're willing to bend the definition of random a bit (and utterly devour the user-addressable memory space), you can simplify the _draw() loop to be a single call to memcpy():

  1. Populate the user memory space above 0x8000 with random values in the _init() call, and
  2. Use memcpy() to blit a random 0x2000 slice of that user memory space to the graphics memory at 0x6000:
cls()

function _init()
	local i = 0x8000
	while i < 0x0000 do
		poke4(i, rnd(0xffff.ffff))
		i += 0x0004
	end
end

function _update60() end

function stats()
    print(
        "\^j00\^#\f6"
        .."fps: "..stat(7).."\n"
        .."cpu: "..stat(1).."\n"
        .."mem: "..stat(0).."\n"
    )
end

function _draw()
	memcpy(0x6000, 0x8000+rnd(0x6000), 0x2000)
    stats()
end

With this technique, CPU usage drops to 3.1% and memory usage goes to zero!



[Please log in to post a comment]