Re: A86: Optimization...
[Prev][Next][Index][Thread]
Re: A86: Optimization...
Chris Magill wrote:
> ld hl,57*256+59 ;penrow=57,pencol=58
> ld (_penCol),hl ;set those coords
>
> Is there any optimization difference between this and...
> ld hl,393Bh
> ld (_penCol),hl
These two 'forms' are exactlly the same. The assembler computes
the value for "57*256+59" and assembles the instruction, which is
a "load hl with constant". "ld hl,393Bh" is also the instruction
which loads hl with a constant. Assemblers compute the value of
constant expressions before actually assembling the instruction.
57*256+59 simply is more readable then 393Bh. Just by looking at
the first form you will know that it's position (57,59). By
looking at the second form you will have to convert from hex to
dec first.
NSJ aka Viriato
References: