some questions about the using of the arrays with RS08

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

some questions about the using of the arrays with RS08

2,074 Views
muskut
Contributor I
Hi,

When I use an array in my code how can I can assign default value to all items of the array. Like this;

MyArray : DS.B 20

when I want to assing default value as $AA for all items of MyArray what should I do?

and the other question about the arrays that How can I use the items of the array in the following code? How can I assign a value to first item of the array, or second item or especial item. Or how can I read the value of the a especial item of the array?

( I am using RS08 MCU )
Labels (1)
0 Kudos
Reply
2 Replies

627 Views
peg
Senior Contributor IV

Hi Mustafa,

Firstly, you don't really have an array, just 20 contiguous bytes the first of which is labelled "MyArray".

DS.B is the same as RMB. (No not Chinese currency but Reserve Memory Bytes)

To load them all with $AA:

    LDA $AA
    LDX #20
loop:    STA MyArray-1,X
    DBNZX loop

To assign the value $BB to a particular array element (say the fifth one)

    LDA #$BB
    STA MyArray+4

or

    MOV #$BB,MyArray+4

Now, the array initialise example is for HC08 and I believe it needs to be modified for the RS08 as it does not have a real index register. Going off now to read AN3266 but this might give you a start.

Regards David

 

 

0 Kudos
Reply

627 Views
muskut
Contributor I
thank you so much. Its a good point for me now.
0 Kudos
Reply