1 /*****************************************************************************/
3 /* Atari VCS 2600 sample C program */
5 /* Florent Flament (contact@florentflament.com), 2017 */
7 /*****************************************************************************/
12 // Roughly computed based on Stella Programmer's guide (Steve Wright)
13 // scanlines count per section.
14 #define VBLANK_TIM64 51 // 45 lines * 76 cycles/line / 64 cycles/tick
15 #define KERNAL_T1024 17 // 228 lines * 76 cycles/line / 1024 cycles/tick
16 #define OVERSCAN_TIM64 42 // 36 lines * 76 cycles/line / 64 cycles/tick
18 // Testing memory zones
19 const unsigned char rodata_v[] = "Hello!";
20 unsigned char data_v = 0x77;
24 unsigned char color = 0x79; // Stack variable
25 bss_v = 0x88; // Testing BSS variable
28 // Vertical Sync signal
35 // Vertical Blank timer setting
36 RIOT.tim64t = VBLANK_TIM64;
38 // Doing frame computation during blank
39 TIA.colubk = color++; // Update color
41 // Wait for end of Vertical Blank
42 while (RIOT.timint == 0) {}
44 TIA.vblank = 0x00; // Turn on beam
47 RIOT.t1024t = KERNAL_T1024;
48 while (RIOT.timint == 0) {}
50 TIA.vblank = 0x02; // Turn off beam
53 RIOT.tim64t = OVERSCAN_TIM64;
54 while (RIOT.timint == 0) {}