1
0
mirror of https://github.com/RevCurtisP/C02.git synced 2024-11-28 10:51:14 +00:00
C02/vcs/colorscr.c02
2018-01-28 14:44:10 -05:00

66 lines
1.6 KiB
Plaintext

/* Atari VCS Color Bars Program */
#pragma origin $F800 //4k Cartridge
#include <vcshead.h02> //TIA and RIOT Registers
#include <vcsstub.h02> //Initialize VCS
#include <vcslib.h02> //VCS Library Routines
#include <score2.h02> //Two Player Score Kernel
zeropage char clrbkg; //Background Color
zeropage char clrmov; //Color Movement Flag
zeropage char clrofs; //Color Offset
zeropage char clrmsk; //Color/B&W Mask
zeropage char cntdwn; //Timer Countdown
char colors = {$86, $C6, $46, $00, $0E, $06, $0A, $00}; //Color Table
/* Setup Code */
void setup() {
}
/* Vertical Blank Code */
void vrtblk() {
setclr(&colors); //Set Color Table
scrprp(); //Prepare Score for Display
}
/* Execute Kernel Code */
void kernel() {
CTRLPF = 2; //Set Score Mode
scrdsp(); //Display Scores (12 Scanlines)
X=180; //Draw 180 Scanlines
do {
clrbkg = X;
if (!SWCHB & 128) clrbkg<<;
A = clrbkg + clrofs & clrmsk; //Set Background Color
WSYNC = A; //Wait for end of Scanline
COLUBK = A; //Set Background Color
X--;
} while (X);
return;
}
/* Execute Overscan Code */
void ovrscn() {
if (!SWCHB & 1) //Game Reset
clrmov = $FF; //Turn On Scrolling
if (!SWCHB & 2) //Game Select
clrmov = 0; //Turn Off Scrolling
clrmsk = (SWCHB & 8) ? $FF : $0F;
if (clrmov) {
if (SWCHB & 64) clrofs--; else clrofs++;
}
cntdwn++;
if (cntdwn == 10) {
cntdwn = 0;
addbcd(1,&score2); //Increment Player 2 Score
if (!score2) addbcd(1, &score1); //Increment Player 1 Score
}
}
#include <digits.h02> //Digit Graphics
#include <vcsfoot.h02> //Finalization Code