Open joolin1 opened 5 years ago
@joolin1 I suppose by "returning to the kernal", you mean back to BASIC, right ? So if you do a SYS to call your program, you wish the BASIC will set the VERA_CTRL to the one needed for itself, that's right ?
Yes, I mean back to BASIC. If I call the included code with a SYS, everything should work fine, at least that is my supposition. But it does not. I have to make sure VERA_CTRL is set to 0, otherwise the system/BASIC starts to print characters to the screen after returning to BASIC. If I am not making myself clear you can test the code and see what happens.
I can see how this is a problem. We should probably fix it, and add a stz veractl
to all KERNAL code that accesses VERA. This is a little tricky to audit though.
The code I've been writing assumes that any Kernal calls will return veractl to a safe value, so this behavior is definitely preferred.
Run the following code:
After returning the system goes bananas and starts printing random characters to the screen. The problem is that the address selection of VERA_CTRL has the value 1 when returning. If we add the line "stz VERA_CTRL" before returning everything works fine. But should this really be necessary? This can cause a lot of confusion if left as it is.