PDA

View Full Version : 32b address for plugamem


ddlawrence
01-26-10, 07:18 PM
Hi. I am working thru my new PlugaMem256. The sample program you posted works well. Now I am trying to pass a 32 bit address to the routine in the sample program called SDCOPY

: SDCOPY ( addr32 --- )
SD-CSLO.....

Now they use the data format

0.01AA

in the routine SDRESET. This works, though I do not understand this representation.
But I need to increment this value, so I need to pass a variable, not a fixed number.
Please help.

thanks.............don

RMDumse
01-27-10, 09:12 AM
[QUOTE=ddlawrence]Now they use the data format

0.01AA
/QUOTE]

I think what you are looking at there is a 32 bit value in hex. The upper 16-bits is 0, and the lower 16-bits is 01AA.

In Forth, when you have a decimal point in a number (anywhere in the number) without an exponent, it means the number is to be entered into the stack as a double integer number (32bits) where if it doesn't have the decimal it is entered as a 16-bit integer, and if it has an exponent as a 32-bit float.

So entered as a 32-bit integer, you can use your D or 2 words to deal with it. 2@ and 2! to fetch and store. D+ and D- to add. And so on.

So to increment this 32-bit address, you'd add a 1. to it. Or you could enter the one in the same format, 0.0001, and get the same result. If you're just working with a double number and not a scaled fraction so you don't care where the decimal point was, any decimal point even with leading zeros will make it a double.

0.01AA 0.0001 D+ D. 1AB Ok

ddlawrence
01-28-10, 10:52 AM
OK great, it works. I guess I should read the Isomax pdf at some point in my career....

Another thing; I recall seeing a code example that reads instructions from the plugamem and executes them. This would facilitate the ability to have huge programs, which I may have use for later. Do you recall this example?

thanks......don

RMDumse
01-28-10, 01:39 PM
I don't recall such an example, although I have thought of doing just that, executing out of an external flash. But I don't remember seeing it written up, although I can imagine LC might have worked on such an example.