Tuesday, March 24, 2015

2 more bytes!

I just trimmed down 2 bytes of my ram usage in Atari Anguna. Just saying.

For anyone crazy enough to care how.... I was using 2 bytes of ram to set up an indirect jmp instruction to jump to the subroutine I use to update enemies:

    LDY #6                      ;load the address from the enemy 
                                ;definition into the EnemyUpdateFunc
    LDA (EnemyDef),Y
    STA EnemyUpdateFunc
    LDY #7
    LDA (EnemyDef),Y
    STA EnemyUpdateFunc+1

    JMP (EnemyUpdateFunc)       ;then jump to it

Which means that the 2 bytes for the EnemyUpdateFunc address were only used in this one particular spot. I also found another place where 2 consecutive bytes were only used for a small limited time (temporary variables used to set up the playfield while drawing the health/status header). Combining these 2 to use the same memory knocked TWO WHOLE BYTES off my ram usage. Hooray!

No comments:

Batari Basic and Fixed Point

When I'm too tired/frustrated to work on my NES game, I've been playing around with ideas for another hobby project that I've he...