Saturday 6 June 2015

Raster IRQ & collision working

The last things from my to-do-list are now realized:

- sprite-sprite-collision detection
- sprite-background-collision detection
- collision-interrupt enable / flag setting
- raster-interrupt enable / rasterline setting

 
I coded a simple routine to test the raster-interrupt. It changes the background (38 column-mode to see the frame at the sides) and framecolor at rasterline 00, 6f and fb. This works but some times the screen flickers a little bit - it's not perfect ;-)
 

The collision-detection works perfect. After a whole screen the bits of the involved sprites were set in the colliosion registers. Also the source-bits in the IRQ-flag register were set. If one of the irq-mask bits are set, an interrupt will be outputted for only 15 us because clearing the IRQ is not possible.
My Atxmega don't recognise a write to the flag-register!
I clear the raster-irq-flag and the collision-flags after one rasterline.

Now PAC-MAN can eat ghosts:

 
Soccer now runs with players  on the field. The game uses sprite-multiplexing.
This doesn't work properly because I update the sprite-data only 3 times on a screen.
I tried to update the spritedata everytime a sprite starts in a rsterline but this reduces the refreshrate too much (10-12 Hz).
 
 
Donkey Kong now works, but some colors are wrong - I don't know why?
The game has some sprite-errors (Kong) and runs very slow.
I think the speed of many games like Donkey Kong, GORF or int. Soccer depends from the VIC-rastercounter. The VIC draws the screen 50 times per second (PAL) - but the xmega only do it about 20 times / second.