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

82 lines
2.2 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
#include <sticks.h02> //Joystick Functions
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 clrskp; //Color Skip Flag
zeropage char cntdwn; //Timer Countdown
zeropage char temp; //Scratch Variable
char colors = {$86, $C6, $46, $00, $0E, $06, $0A, $00}; //Color Table
/* Setup Code */
void setup() {
NUSIZ1 = $07;
}
/* Vertical Blank Code */
void vrtblk() {
setclr(&colors); //Set Color Table
scrprp(); //Prepare Score for Display
GRP0 = 0; GRP1 = A; //Clear Player Graphics
posobj(score1,0); //Set Player 0 Position
posobj(score2,1); //Set Player 0 Position
WSYNC;HMOVE; //Move Players
}
/* Execute Kernel Code */
void kernel() {
CTRLPF = 2; //Set Score Mode
scrdsp(); //Display Scores (12 Scanlines)
GRP0 = $FF; GRP1 = A; //Set Player Graphics
X=179; //Draw 180 Scanlines
do {
clrbkg = X;
if (clrskp) 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;
clrskp = (!SWCHB & 128) ? $FF : $0F;
if (clrmov) {
if (SWCHB & 64) clrofs--; else clrofs++;
}
temp = getstk(0);
if (temp & 4) score1--;
if (temp & 8) score1++;
if (INPT4:-) {
cntdwn++;
if (cntdwn == 10) {
cntdwn = 0;
score2++;
//addbcd(1,&score2); //Increment Player 2 Score
//if (!score2) score1++; //Increment Player 1 Score
//if (!score2) addbcd(1, &score1); //Increment Player 1 Score
}
}
}
#include <digits.h02> //Digit Graphics
#include <vcsfoot.h02> //Finalization Code