You're not setting up stuff before running the code in question... A doesn't hold the level index, it holds whatever the loop above got from bg_lvl_top_corner. You're also not setting a vram address via $2006, so it's whatever the code above left it as.kikutano wrote:The sourcecode complete is here: https://pastebin.com/689fHti0
Also, with this method, tables aren't limited to 256 bytes anymore, so the table of pointers only needs to point to the beginning of each NT:
Code: Select all
LevelPointers:
.dw bg_lvl_1_0, bg_lvl_2_0
Another thing to consider is that my example code copies 1024 bytes to vram, because I assumed you'd be copying an NT and an AT together in one chunk, which doesn't seem to be the case. Well, there's nothing wrong with copying invalid AT data if you'll overwrite it with the correct data afterward, so I don't think you have to worry about it for now.