unregistered wrote:
Is there a possible way to make the 6 labels a part of the machine? Like, well, make them local labels that I could use. Would I have to make each label different in every file? I'd like to make an assembly object... something like
jmp bg0.@MetatileCollision. Is that possible?

I didn't really understand the question... Why would you JMP to a data table? That would most likely crash the program!
Do you want to use different data for each level or something like that? If that's the case, then the answer is the indirect indexed addressing mode (i.e.
LDA ($XX), Y). With that addressing mode you use pointers to define the tables that will be read, and you can alter the pointers as much as you want.
For example, you could have a different name for each collision table (or whatever table you want), and then make a table with all the addresses:
Code:
MetatileCollisionAdresses:
.dw MetatileCollisionLevel1, MetatileCollisionLevel2, MetatileCollisionLevel3
Then you can read the address for the current level and put it in a pointer using the level's index:
Code:
lda LevelIndex ;get the level's index
asl ;multiply by 2 because each address is 2 bytes
tax ;use that as an index into the table of addresses
lda MetatileCollisionAdresses+0, x ;copy the low byte
sta MetatileCollision+0
lda MetatileCollisionAdresses+1, x ;copy the high byte
sta MetatileCollision+1
Then you can use indirect indexed addressing to read the data, instead of what we had before. The only real difference is that now you'll have to use Y as your index register, because this addressing mode doesn't work with X:
Code:
;get collision information
lda (MetatileCollision), y
Quote:
thank you for explaining to me how to use 4bit numbers.
There are lots of ways to use 4-bit numbers. In this case it was convenient to use 4-bit values because 4 bits are enough to represent the metatile coordinates inside a single screen.