McPepic 2022-06-25 19:20
I’m trying to create a background that loops from the ROM, but every time it loops back around, the background is shifted up by a tile and has some garbage data along the bottom of the screen. I think I need to copy some extra data from the opposite side of the ROM data, but I can’t figure out the exact math to do that. If anyone can help, it would be much appreciated! :)
nathanielbabiak 2022-06-25 20:00 (Edited)
Could you post some (minimal) code that contains this issue?
Also, keep in mind there's a four-byte offset from the address of, for example
ROM(3), to the start of the tile data itself. Is that the issue?
McPepic 2022-06-26 00:27
This is the code sample that deals with the background scroll. The add statement is a modulo operation that works with negative numbers.
was8bit 2022-06-26 17:46
You will have to...
1) copy to BG 0,0 to 20,15 (note the extra column on the right)
2) scroll 8 pixels (one cell width amount) to the left
3) quickly CLS, unscroll, and then...
... recopy a new block same size as in step 1, but accounts for the tile shift to the left... continue to step 2
was8bit 2022-06-26 17:50 (Edited)
In other words, you are not going to be able to keep it simple and do this with just one COPY ... it will take some extra juggling to accomplish the desired look
McPepic 2022-06-26 18:56
I really didn’t expect this to be so complicated. What I’m really doing is cycling between four screens, so I think what I’ll do is have a separate copy for each one.
was8bit 2022-06-27 05:55
Have you tried using MCELL ?? Not sure if it will help...
nathanielbabiak 2022-06-27 14:23 (Edited)
BG COPY instruction is not specified to follow this statement about wrapping.
Check out this upload's source code and the tile map file ROM(3) in the Gfx Designer. Note the white column. Then run it.
BG COPY command is where the "shift" is occurring (although I can't reproduce the 'garbage' data).
nathanielbabiak 2022-06-27 14:29
Here's the math you mentioned in your original post, inserted into your code, based on what I noticed in my prior post.
nathanielbabiak 2022-06-27 14:35 (Edited)
And here's the final, fixed version.
was8bit 2022-06-27 15:58
Ah yes, the fancy math... thanks for the help... MOD and bit math sometimes confuses my tired brains ;)
McPepic 2022-06-27 16:01
Thank you! I appreciate all of the help. :)