A82: Concentration released


[Prev][Next][Index][Thread]

A82: Concentration released




Hi!  I just finished up Concentration--you can download it from my webpage 
at http://pubweb.nwu.edu/~dat927/zoomlabs, and ticalc.org should have it up 
soon.

With some help from Sam, I was able to optimize it by 140 bytes!  One little 
trick I figured out is whenever possible, try to avoid loading 0 into a 
register, because there's often a register that's already equal to 0 and 
it's one byte smaller to load one register into another than to load a 
value.  Often b is equal to zero from a recent djnz, so you can save a byte 
by doing:
ld d,b
instead of
ld d,0
Also, using sub instead of cp can help:
sub 5
jr z,Label
...
Label:
ld d,a
instead of
cp 5
jr z,Label
...
Label
ld d,0
And here's one other handy one:
xor a
ld (Label),a
instead of
ld hl,Label
ld (hl),0

A lot of you probably already know these tricks, but it's amazing how all 
these little bytes here and there add up to making your program a lot 
smaller!

Doug


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com