mdm373 / blinks-overtake

Mozilla Public License 2.0
2 stars 3 forks source link

Free up 110 bytes using brutalization #13

Closed bigjosh closed 4 years ago

bigjosh commented 4 years ago

An example of freeing up flash space by favoring compiler-friendly patterns.

In this case, I ....

  1. replaced a series of if statements with a switch
  2. reworked parts of Action to favor register usage rather than memory usage

It is not pretty, but when space is tight this technique can be useful.

I might have messed up somewhere, so please double check my work and also test that functionality is the same!

FLASH SIZE: 
BEFORE:5864
AFTER :5674

NB: Ignore the does not work comments, I misinterpreted how the game was supposed to work so I thought I broke something. I do think (hope?) it works now!

mdm373 commented 4 years ago

NB: Ignore the does not work comments, I misinterpreted how the game was supposed to work so I thought I broke something. I do think (hope?) it works now!

no worries, I'll give it a test after I merge to master (totally a best practice). If the broadcast caching was broken it should be pretty catastrophic 💥 so your probably good but I'll play it safe.