2BitBitmapDemo
BTX
Posts: 674
I was playing arround the Rayman 2BitBitmapDemo.
My intention is to load the bitmap data from a software variable, instead using a "DAT" declaration and follow the "filename.dat" who contains the data.
I've no luck with this, does anybody get it work ?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Regards.
Alberto.
My intention is to load the bitmap data from a software variable, instead using a "DAT" declaration and follow the "filename.dat" who contains the data.
I've no luck with this, does anybody get it work ?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Regards.
Alberto.
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Visit some of my articles at Propeller Wiki:
MATH on the propeller propeller.wikispaces.com/MATH
pPropQL: propeller.wikispaces.com/pPropQL
pPropQL020: propeller.wikispaces.com/pPropQL020
OMU for the pPropQL/020 propeller.wikispaces.com/OMU
In the Rayman 2BitBitmapDemo he catch the bitmap data like this:
I want to do this: (from a variable)
Then I will fill the variable with the bitmap data, getting it from another eeprom or SD card.
To show the bitmap, he uses something like the TV driver explain, this is:
It should work for me, but he add some type of correction in the data address that I can't finish to understand, I tried something like this above, but wont work correctly.
All examples I found are done in this way, How to do what I'm looking for
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Regards.
Alberto.
If I understand correctly, this has to do with the fact that the video drivers require the bitmap or tile data to be long aligned.· As you cannot specify or otherwise guarentee the address your source data compiles to will be 64 byte long aligned, he includes a buffer variable (PADDING) imediately before the bitmap data that accounts for the worst case addressing scenario.· Then early in the code he moves the data from where it compiled to the nearest 64 byte aligned address (AND'ing with $FFC0) using a longmove:
Having moved the bitmap data, you then need to use the new location (user_charbase) as the array pointer.
So you need to do something similar.· It is important that the number of longs to move are exactly how large your bitmap data is.
edit -
Here is something to try...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Post Edited (Agent420) : 9/24/2009 7:27:44 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm
I'm thinking that declaring the array as the first variable in VAR should result in it being long aligned, but you may have to use the PADDING variable as described above.
Alternatively, I guess that there's not much difference between reserving your data memory space in VAR as opposed to having it in DAT, other than you would have to use placeholder data such as
DAT
PropUpper· LONG 0[noparse][[/noparse]1280] ' reserves 1280 longs filled with 0
Either way, you just insert the data from the SD card to the appropriate pointer address, which would be the new calculated long aliogned address, not the original location.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
@Agent420
Yes !, it is the same as declare how you suggest, I found that about a few minutes ago, just I did it and works fine.
The point that is not still clear for me, is that I've to adjust the padding value, in the Ray's code he uses padding 7(16), and for some reason I should use padding 7(11) to get the code working fine.
Using data in this way, I could have many differents screens of about 16x12 tiles each, reading them from a SD card, and showing them one by one. While having enough memory space for more code. As in your below example, "PropUpper" will be my image buffer for SD read data.
Here I've attached my simple example with small variables.
PS I've declared the array variable at the top of all, but wont work correctly, seems to be non aligned in that way. also using a padding.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Regards.
Alberto.
So, you can either borrow from that shift calculation, or guess at the required shift and don't change the code after you guess right...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm
Ah ok Ray, I did it before, but i thought that was my bad programming technics. (I had to adjust the padding each after insert more code)
Thank you !!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Regards.
Alberto.