MEGA65 / mega65-core

MEGA65 FPGA core
Other
241 stars 88 forks source link

Sprite over bitplane graphics mode is offset by 1 up, 1 right #810

Open dansanderson opened 2 months ago

dansanderson commented 2 months ago

When a sprite is over bitplane graphics, the sprite is rendered one pixel too high and one pixel too far right. The sprite is overlapping the top or right borders by one pixel, and not reaching the bottom or left borders by one pixel.

Here's a simple joystick-controlled drawing program that illustrates the issue:

10 screen 0,320,200,5
15 sprite 0,1
20 x=100:y=100
30 pen 1
40 j=joy(2)
45 movspr 0,x+24,y+50
50 if j and 128 then dot x,y:j=j and 127
55 sleep 0.01
60 if (j=4 or j=5 or j=6) and y<199 then y=y+1
70 if (j=2 or j=3 or j=4) and x<319 then x=x+1
80 if (j=8 or j=1 or j=2) and y>0 then y=y-1
90 if (j=8 or j=7 or j=6) and x>0 then x=x-1
100 goto 40

Notice that the same program in text mode does not exhibit this issue:

15 sprite 0,1
20 x=100:y=100
40 j=joy(2)
45 movspr 0,x+24,y+50
55 sleep 0.01
60 if (j=4 or j=5 or j=6) and y<199 then y=y+1
70 if (j=2 or j=3 or j=4) and x<319 then x=x+1
80 if (j=8 or j=1 or j=2) and y>0 then y=y-1
90 if (j=8 or j=7 or j=6) and x>0 then x=x-1
100 goto 40

This nominally sounds similar to https://github.com/MEGA65/mega65-core/issues/132 or https://github.com/MEGA65/mega65-core/issues/289 but those issues are very old and I can't tell if they're actually the same, just related, or unrelated.