Page 1 of 1

CPU Loop VBLANK/Raster Timing Synchronization

Posted: Sat Jan 14, 2023 12:40 pm
by siudym
What are good methods to synchronize cpu loop with vblank timing?
Any examples?

Re: CPU Loop VBLANK/Raster Timing Synchronization

Posted: Sat Jan 14, 2023 1:10 pm
by akuyou
Interrupts occur on the Amstrad CPC 6 times per frame, so if you want to do a mode/color switch for part of the screen that's your best option.

If you want to do things with line level precision, then you need to calculate the time the beam is taking, I believe one 'NOP' takes the time of one Mode 1 8 pixel wide block...

Here's the tutorials I have on CPC interrupts and raster tricks:

Lesson M6 - Advanced Interrupt handler template
https://www.chibiakumas.com/z80/multipl ... p#LessonM6

Lesson P40 - Syncronized mode switches for 320x200 @ 16 color EGX graphics on the Amstrad CPC
https://www.chibiakumas.com/z80/platform4.php#LessonP40

Lesson P41 - CRTC Rupture for Interrupt based splitscreen on the CPC
https://www.chibiakumas.com/z80/platform5.php#LessonP41

Lesson P42 - Advanced CRTC Rupture
https://www.chibiakumas.com/z80/platform5.php#LessonP42