Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to have 9 sprites in rasterline

Tags:

c64

commodore

Is it possible to have more than 8 sprites in a rasterline on a real Commodore 64 (not on an emulator)? the sprites don't need to be different.

like image 403
qwasyx Avatar asked Dec 11 '22 11:12

qwasyx


2 Answers

Short answer: yes. Long answer: yes, but there are some caveats:

VICII (the video chip) reads in 3 bytes of sprite data per rasterfor each of the maximum 8 hardware sprite, and the buffered data is meant to be displayed on the next raster.

If you display a hardware sprite a second time on a given raster that buffer will be empty the next raster, so on the following raster you'll end up with a transparent stripe in the sprite.

Also the sprite data fetches happen at around the end of the current raster/start of the next one, so you are pretty much limited to duplicate sprite #0 (because its data is fetched first), and even then the CRT-beam is so far on the right of the screen that you'd have to remove the sideborder to able to see the duplicate sprite visible.

like image 162
wurst Avatar answered Mar 17 '23 04:03

wurst


Yes it is possible using assembly in interrupts. The interrupt would be aligned to the raster of the video chip. After the first sprite has been rendered by the video chip (using NOP to wait for the necessary time), its position and shape are changed further to the right. Then the interrupt waits again until the sprite has been rendered to reset it to its original place because the nest raster needs to "see" it there.

Using this technique you can have more than 8 sprites in one raster line. The technique is similar to showing sprites in the border for the case of For sprites in the left/right borders. Instead of changing the register to make the screen less width, you need to change the x-position of the sprite.

like image 37
Peter Kofler Avatar answered Mar 17 '23 03:03

Peter Kofler