Two SX questions. E2Flash and DS
PLJack
Posts: 398
I've read all three manuals, Honest. [noparse]:)[/noparse]
But I can not nail down these two questions.
1)
2k of E2Flash.
Since it has a Read/Write of 10,000 I assume this is regular flash ram.
In other words I can save data to this area and it will be retained during
power off. And can be accessed again when the SX is powered up.
Is this true?
If so could you please provide a short ASM snippet on how to write and read from this ram.
2)
DS and arrays.
To allocate a Byte for a var I can do:
AVar DS 1
Now, this will also compile:
AVar DS 8
I assume I just allocated 8 bytes of ram there.
What I need is a bank of bytes that I can access via an index.
Like so:
mov Avar(Idx), AValue
Now I know this syntax is wrong, but that is the jest of what I am trying to do.
Again, a small ASM snippet would be greatly appreciated.
thanks.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jack
But I can not nail down these two questions.
1)
2k of E2Flash.
Since it has a Read/Write of 10,000 I assume this is regular flash ram.
In other words I can save data to this area and it will be retained during
power off. And can be accessed again when the SX is powered up.
Is this true?
If so could you please provide a short ASM snippet on how to write and read from this ram.
2)
DS and arrays.
To allocate a Byte for a var I can do:
AVar DS 1
Now, this will also compile:
AVar DS 8
I assume I just allocated 8 bytes of ram there.
What I need is a bank of bytes that I can access via an index.
Like so:
mov Avar(Idx), AValue
Now I know this syntax is wrong, but that is the jest of what I am trying to do.
Again, a small ASM snippet would be greatly appreciated.
thanks.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jack
Comments
Indexing in the SX is accomplished using the FSR and IND registers (FSR points to the memory location, IND used in an instruction tells the SX to use the address in FSR). I have code for stack operations that treats all the banks as one large bank using the indirection method. I can post it when I return home this evening.
Thanks for the info.
I would like to see that.
thanks again.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jack
You can write some simple SX/B code and see how it handles data and arrays.
For data see the "DATA" and "READ" commands, for arrays just delare "MyArray VAR BYTE(8)"
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video·Module" Now available from Parallax for only $28.95 http://www.parallax.com/detail.asp?product_id=30012
Product web site: www.sxvm.com
"It's not getting what you want, it's wanting what you've got."
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jack
http://www.sxlist.com/lib/mem/sstack_sx.htm
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
---
James Newton, Host of SXList.com
james@sxlist.com 1-619-652-0593 fax:1-208-279-8767
SX FAQ / Code / Tutorials / Documentation:
http://www.sxlist.com Pick faster!