[A89] Re: arrays question


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

[A89] Re: arrays question




-------------------
> 
> Ok, I'm now a forced user of GNU as, so a few questions:
> is it ok to define a 5-word array like this:
> 
> MyArray:
>    .word         5

No, this will reserve a single word with value 5. To declare a 5-word,
array, zero-filled even.

MyArray:
  .space  10,0

> 
> ... and this is the way I'm accesing the items in the "array":
> 
>    lea        MyArray,%a4
>    addi       #1,0(%a4) | for item 0
>    addi       #1,6(%a4) | for item 3
> 

That looks fine.

> ...
> 
>    move.w     0(%a3),-(%sp)
>    move.w     2(%a3),-(%sp)
> 

Do you mean a4 here? I don't know what a3 is pointing to. the code is
valid though.

> and more like that... is this ok?
> onther question, if the above is ok, I assume the data is not
zeroed, so I should clear it before working with it, right?, something
like this:
> 
>    clr.l      (%a4)
>    clr.l      4(%a4)
>    clr.w      8(%a4)
> 
> should clear the 5 words, right?...

That would clear 5 words, yes.

> tia,
> ra.-
> 
> 
> 

Hope this helps,

If you really hate GNU as, you can download the TIGCC for Linux
precompiled, if you think yours is broken. You don't have to put it in
/usr/local, just put the bin directory in your path. Then you can use
a68k with little fear that your binaries are broken.

John David Ratliff
jdratlif@cs.indiana.edu



Follow-Ups: References: