Newbie Questions
Parallel Universe
Posts: 46
I have a couple of newbie questions about addresses. I know they're 16 bit words for each·main memory byte, but I don't understand a couple of things.
Thanks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·</Parallel Universe>
- If the par register cuts off the lower two bits of an address, how do you pass the address of a word with cognew to an assembly program?
- In TV.spin, how do you get the tile address into 10 bits? What bits do you cut off?
Thanks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·</Parallel Universe>
Comments
2) The tile address is the upper 10 bits of a 16 bit address. It's always on a 64 byte boundary. Since all tiles are 16 longs or 64 bytes, this makes sense. In the ROM, the tiles for the characters are on 64 byte boundaries. If you're supplying the tiles, they do have to be allocated on a 64 byte boundary. Since Spin has no provision for doing this for you, you have to do it yourself by allocating an area dynamically on a 64 byte boundary.
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller Wiki: Share the coolness!
Chat in real time with other Propellerheads on IRC #propeller @ freenode.net
I should have clarified that I'm trying to pass a variable. After a little experimentation I discovered that the compiler aligns the first variable of an object to a long boundry. Mystery 1 solved!
But how do you make sure that your tile is· on a 64 byte boundry? Do you define it in a DAT block and then move it to a set address so that you know it's on a 64 byte/16 long boundry?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·</Parallel Universe>
Coupla options presented, including overallocate.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller Wiki: Share the coolness!
Chat in real time with other Propellerheads on IRC #propeller @ freenode.net
I assume that longmove can overwright the data·as·it's copying for this to work, otherwise I'd just have to put it beyond the stack.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·</Parallel Universe>
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Sorry about the black box in my last post, the forum messed up.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·</Parallel Universe>
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·</Parallel Universe>