Log In  


Keep in mind this isn't the pico-8 "crashing" like it's supposed to. This is a full-blown crash crash. Like, "pico-8.exe has stopped working" windows level crash.

It's happening when I call the reload() function with the optional filename argument, regardless of what it is. I tested it with an existing extra cartridge, a non-existing one (as in the filename didn't correspond to anything), and the same cartridge the code was loaded from, which would presumably act exactly like not using the extra argument at all. All crashes.

I even tried using nil instead of a filename, which in lua is the same as not using the argument at all afaik. Still crashed. Despite not using the extra argument in the first place not crashing and working just fine. What?

Here's the code in question:

function load_sprite(rom, ram, cart)
  local rom_x = rom % 16
  local rom_y = flr(rom/16)
  local ram_x = ram % 16
  local ram_y = flr(ram/16)

  local rom_address = 0x0200*rom_y + 0x0004*rom_x
  local ram_address = 0x0200*ram_y + 0x0004*ram_x

  for i=0, 7 do
    reload(ram_address+0x0040*i, rom_address+0x0040*i, 0x0004, cart)
  end
end

function _init()
  load_sprite(1, 2)
  load_sprite(1, 3, "extra_data")
end

function _draw()
  cls()

  print("this is a test", 0, 0)
  spr(1, 0, 32)
  spr(2, 0, 40)
  spr(3, 0, 48)
end

I know copying the sprites over one at a time instead of copying a whole row or the entire sprite section of the ram is way inefficient. Not that you'd really need to because I hear you generally max out on code or map space long before sprite space anyway. This is just a test for something far more sinister ;)

Here it is running with the offending code changed/removed just in case it's useful somehow:

That's sprites 1 and 2 drawn there btw. Only the first is defined in the rom cartridge, and the second is copied from sprite 1's data in rom to sprite 2's in ram. So it works, just not in any "useful" way due to the crash.

TLDR: Is borked, plz help!




[Please log in to post a comment]