
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!



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()
:
- Populate the user memory space above 0x8000 with random values in the
_init()
call, and - 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]