First page Back Continue Last page Overview Graphics
cnt: equ 4
data1: dc.b $32,$84,$4c,$9a
data2: dc.b $5a,$a2,$2a,$8f
clc ; clear carry to avoid
again: ldaa data1,x ; erroneous carry into
adca data2,x ; first byte
staa data2,x ; store result over 2nd
dex ; addend
Why is the clc instruction needed in the above program? _______
Where is the result stored when this program executes? _______
In this program, accumulator B performs the function of a loop counter and register X contains the index into the data. Alternatively, register X could be used as the loop counter by including a check that would fall out of the loop when the value in X is -1 ($ffff).
The program structure is do-while.