How do I place data at a specific HUB location ?
Bean
Posts: 8,129
I tried
Bean
DAT ORG $7000 LONG $5555_AAAABut it says "Origin Exceed $1F0 limit"
Bean
Comments
except in code ... long[$7000] := $5555_AAAA
ORG does just work for PASM and even there it will not do what you think it does.
It will change the instruction coding as if the code is at ORG xxx. But will leave it where it is. So you have complete garbage.
P2 SPIN/PASM has ORGH for HUB. possible doing what you think ORG does.
Enjoy!
Mike
But who knows what that might trample upon. What is your ultimate objective?
-Phil
Bean
So I am using...
When the pointer reaches $7400 the "and" instruction moves it back to $7000.
Bean
The prop uses only 16 bits for the address, ignoring the upper 16 bits. This lets you cheat by having an augmented address and delta address, i.e. an address where adding adr += del will wrap the number negative. Once the number is negative, a signed mins statement will restore the augmented pointer to the initial value. And all the rd/wr-long/word/byte commands will kindly ignore the upper 16 bits for you.
Here is some test code in Spin: So, all you need are 2 instructions: add, then mins.
Jonathan
It's inelegant and wasteful, but if you have the extra space, just create a DAT or VAR array that's 5120 ($1000 + $400) bytes long. Then you can dynamically redefine the beginning of the array as:
and be assured that there are still 1024 bytes in the array after that, inclusive.
-Phil
EDIT: The "-16" is used to adjust for the object offset, so this technique will only work in the top object.
I thought I was missing something because I could have sworn you could specify a HUB location, but I guess I was wrong.
Thanks anyways,
Bean
Actually, a $800 alignment will work if you AND with $FBFF. So in my suggestion above, you'd be wasting a lot less RAM by making the size of the array $800 + $400 bytes long.
-Phil
Until the code reaches 30K in size I would Spin copy array to the upper locations (but the total Hub used will be 3Kb so pretty much similar to Phil above, unless you can find use for the upper 1Kb)
When completely done programming could write the table to eeprom at this location as a final step, as the Prop will always read the full 32K of the eeprom
So your pasm code will look like this
rdlong mydata,pointer
add pointer,#4
and pointer,_7BFF
pointer long $7800
_7BFF long $7BFF