Wow. Um...the fact you are ALREADY trying to use textboxes? You are a madman! In the best possible way. I have not even mentioned how to do this yet anywhere, so that's fairly impressive!
Here's the deal. Textboxes are backgrounds. There are no "layers" proper for the NES. So nothing is being drawn "over the top" of the player like in modern game engines. The textbox engine is one of those miracles of coding that it even works somewhat dependably as it is, considering how I had to bash it around all of the other things.
If you look at where you are using the macro to invoke the box drawing, the very last byte is to show or hide sprites. The problem is, currently, it disables screen updates when drawing the box...and the screen update is the thing that hides the sprites! So...that's why the sprites don't disappear until after the box is drawn, even if you have that ticked. I'm aware of this and will get back to it soon.
Other issues with textboxes:
- if they don't line up to attributes table (a 32x32 pixel grid, rather than 16x16 of the tiles), the colors of the screen on its edges will be screwed up when the hide box routine is called.
- If you have invoked any tiles that have changed (like a door that has unlocked after defeating all the monsters), and then a text box covers that area, and then restores, it will restore the original graphics of the locked door. The collision will still be right, but the graphics are calling from the original screen that loaded.
- Overlapping the HUD area is not set to restore properly yet.
- it's slow. And it might be for a while.
- You're limited to 256 characters, and that includes next, end, etc. Eventually you'll be able to link additional text strings at the end.
Hope this helps for now! I'll be working on solutions. But I'll say it again....I'm super proud to see that it's at least intuitive enough to get this far without me even discussing it!!!!!