need asm mavens' wisdom
There are often more than one way of doing the same thing in assembly
language. What's the best way to choose between them. Two examples:
I recently added the following somehow unprofessional looking bit of code
to a program I am working on:
move.b #0,(a5)+
move.b #0,(a5)+
move.b #0,(a5)+
move.b #0,(a5)+
move.b #0,(a4)+
move.b #0,(a4)+
move.b #0,(a4)+
move.b #0,(a4)+
Theoretically I might pad the memory at A4 and A5, and use move.w or
move.l, but I would rather not. Another possibility would be something
like the following (which I haven't actually tried, so there may be a bug
in it)
moveq #3,d0 loop: move.b #0,(a5)+
move.b #0,(a4)+
dbra.s d0,loop
That looks more like "programming," but I am afraid it would take maybe
three times as long, and I'm in a bit of a hurry at this point in the
program.
Another case in point is the following two statements. It seems to me they
will both have the same effect (lets asuume that status flags are
irrelevant). How does one figure out which is faster (or otherwise
preferable) in a case like this?
andi.b #$7f,d2 vs.
bclr.b #7,d2 (I started with the andi, but I'm inclined to switch
to the bclr…?)
– via Whap!