Oh, I forgot to mention: I hadn't been using L
1 in my program, and replacing all references to L
4 with L
1 seemed to fix the problem. It seems like it's not my doing that's causing the problem, which unfortunately means I can't fix it. I really don't think I'm missing anything, but if nobody can think of anything I may just have to do more extreme debugging.
EDIT: I was just browsing around randomly, and found
this regarding tempSwapArea:
If you are using this area for data storage, avoid archiving any variables or using routines such as Regraph.
Maybe something besides archive and unarchive is messing with my data after all? It says "routines
such as Regraph," suggesting that there are multiple routines that could corrupt data in tempSwapArea. Any ideas, anyone?
EDIT 2: I don't want to use L
1 because I plan to use it later, I might use interrupts so I don't want to use L
2, and L
3, L
5, and L
6 are needed for their usual functions. Perhaps I could just use a different area of RAM? Could either appData (8000h) or ramCode (8100h) be a safe alternative?
EDIT 3: After a bit of talking with Iambian, it seems that appData should be safe to use, and the 256 bytes present there should be enough for my purposes. So I guess this issue has been avoided, but it would still be nice to solve it and determine what was corrupting tempSwapArea.