dumb optimization trick

Discussion of hardware and software development for Super NES and Super Famicom. See the SNESdev wiki for more information.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
Post Reply
psycopathicteen
Posts: 3140
Joined: Wed May 19, 2010 6:12 pm

dumb optimization trick

Post by psycopathicteen »

I was looking at ways to save memory for object slots and I got it down to 84 bytes. What I found special about this number is that it's slightly less than 256/3. If I page align every 3rd object slot, direct page instruction will be 1 cycle faster for every 3rd object.
Last edited by psycopathicteen on Sat May 12, 2018 9:08 am, edited 2 times in total.
User avatar
Drew Sebastino
Formerly Espozo
Posts: 3496
Joined: Mon Sep 15, 2014 4:35 pm
Location: Richmond, Virginia

Re: dumb optimization trick

Post by Drew Sebastino »

I was thinking of the same thing, actually... :lol: Another little trick is that I like to have it to where the end of a loop is when an index register is 0, so I don't need a cmp instruction.
psycopathicteen
Posts: 3140
Joined: Wed May 19, 2010 6:12 pm

Re: dumb optimization trick

Post by psycopathicteen »

Now I need to find a way to always have objects spawn into the page-aligned slots first so they have a higher chance of being in a page-aligned slot. Using a linked-list object slot system makes this more difficult.

I could probably take this one step further and have slow slot objects move into fast slots when a free fast slot becomes available.
Post Reply