neilsf / xc-basic3

A BASIC cross compiler for MOS 6502-based machines
MIT License
44 stars 5 forks source link

[alpha 3.1 build] [c128 only] sprites don't stay on #197

Closed locodarwin closed 2 years ago

locodarwin commented 2 years ago

When issuing a sprite command that includes the ON parameter, the sprite will show up for a split second and then disappear. The same command parameter compiled to the c64 target shows the sprite until intentionally turned OFF by a subsequent command.

A single line example that work as expected on -t c64 but not on -t c128:

SPRITE 1 SHAPE 128 ON AT 100, 100 COLOR 1

neilsf commented 2 years ago

The reason why it happened was that the C128 has an IRQ routine that periodically overwrites VIC-II registers. This is now turned off when the XC=BASIC runtime is started and this solves the problem. However, when the program exits, the C128 IRQ gains back control and hides the sprite again. So to permanently see the sprite, just prevent the program from exiting:

 SPRITE 1 SHAPE 128 ON AT 100, 100 COLOR 1
 DO WHILE 1 : LOOP
neilsf commented 2 years ago

Fixed in release/v3.1