Closed derekfountain closed 5 years ago
The teleporter sound effect causes it to happen too.
This was because the background music player started by setting A to zero, which it then wrote out of port 0xfe, toggling the speaker bit every so often. The bottom 3 bits of the value are the border colour, so priming it with 0 meant the border went black.
z88dk keeps track of the port 0xfe status in a global called _GLOBAL_ZX_PORT_FE. All the library code which writes to that port updates that value, including the border setting code. My music player was setting the bottom 3 bits to zero without updating z88dk's global, so things got confused.
The fix was for the music player to prime the code which writes to that port from the _GLOBAL_ZX_PORT_FE location, thus picking up the currrent border colour and the speaker bit value. That stops the border changing and wierd things happening.
I also now write back the last value written to the the port into _GLOBAL_ZX_PORT_FE before exiting the music player function. It probably doesn't matter a great deal, but that's the correct thing to do.
Like everyone else, I'd play this game with the music off. But if I leave it on, the border colour changes when he bounces off a wall.
I quite like the effect, actually, so if I can work out what's causing it I might leave it doing it consistently. :)