Jerome Grimbert wrote:
> Also, if you do not mind, another (tricker ?) question:
>
> harpo equ $160
> chico equ $140
> elem_size equ $0c
>
>         clr.l a1     ; (just to fixe a1 to 0 for the question,
>                      ; irrelevant "how to" if illegal)
>                      ; but once a1 has been modified, we cannot have it back
>                      ; to THIS value
>
>         moveq.l #4,d2
>         lea harpo(a1),a1
> myloop:
>         ...            ; use a1 but keep it
>         adda.w elem_size,a1

This is probably not the code you wanted. It adds the word at memory
address $000000c to a1, i.e. a # is missing.

>         ...            ; use a1 but keep it
>         dbra d2,myloop
>         lea chico-4*elem_size(a1),a1
>
> Question: what is the value of a1 at the end ?
> (I also have my idea, but I do not want to influence yet!)

Disregarding the bug it's $160 + 5 * $0c + $140 - 4 * $0c
= $160 + $120 + $0c = $28c.

Marcel

Reply via email to