some questions about the using of the arrays with RS08

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

some questions about the using of the arrays with RS08

2,073 次查看
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 )
标签 (1)
0 项奖励
回复
2 回复数

626 次查看
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 项奖励
回复

626 次查看
muskut
Contributor I
thank you so much. Its a good point for me now.
0 项奖励
回复