diff --git a/.gitignore b/.gitignore index 93d45a5..88a9cc7 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,10 @@ */*.lst */*.prg */*.sym + +#Converted Object Files +*.asc +*.out +*.s9 +*.wav + diff --git a/c02 b/c02 new file mode 100644 index 0000000..800b607 Binary files /dev/null and b/c02 differ diff --git a/c02.c b/c02.c index 8143a29..d55fb52 100644 --- a/c02.c +++ b/c02.c @@ -36,7 +36,7 @@ void init() curlin = 0; inpfil = srcfil; strcpy(inpnam, srcnam); - strcpy(incdir, "../include/"); + strcpy(incdir, "include/"); alcvar = TRUE; inblck = FALSE; xstmnt[0] = 0; diff --git a/c02.exe b/c02.exe index 1d79bbf..97715df 100644 Binary files a/c02.exe and b/c02.exe differ diff --git a/c02.tag b/c02.tag index 8b02ab8..8c845f1 100644 Binary files a/c02.tag and b/c02.tag differ diff --git a/c02prg b/c02prg new file mode 100644 index 0000000..288cf0d --- /dev/null +++ b/c02prg @@ -0,0 +1,37 @@ +#!/bin/bash +#Compile and Assemble C02 Program + +#Split Script Into Directory and File Name +SDIR=${0%/*}; #Script Path +SNAM=${0##*/}; #Script Name + +#Check for Command Line Argument +if [[ "$1" = "" ]]; then + echo "Usage: $SNAM file[.c02]" + exit +fi + + +#Split File Name Parts +FSPC=$1; #File Spec +FNAM=${FSPC%.*}; #File Name without Extension +FEXT=${FSPC##*.}; #File Extension + +#Compile C02 FILE +$SDIR/c02 $FSPC +ESTS=$?; #Exit Status +if [[ $ESTS -ne 0 ]]; then + echo "Error compiling file $FSPC" + exit $ESTS +fi + +#Assemble ASM File +dasm $FNAM.asm -f1 -o$FNAM.prg -l$FNAM.lst +ESTS=$?; #Exit Status +if [[ $ESTS -ne 0 ]]; then + echo "Error compiling file $FNAM.asm" + exit $ESTS +fi + +#Report Successful Completion +echo "Successfully compiled and assembled file $FSPC" diff --git a/clean02.bat b/clean02.bat index b78d33b..30c53f4 100644 --- a/clean02.bat +++ b/clean02.bat @@ -2,3 +2,4 @@ del *.log del *.lst del *.sym +del *.out diff --git a/common.h.gch b/common.h.gch new file mode 100644 index 0000000..0b3e12b Binary files /dev/null and b/common.h.gch differ diff --git a/vcs/c02.bat b/vcs/c02.bat new file mode 100644 index 0000000..a3db3b5 --- /dev/null +++ b/vcs/c02.bat @@ -0,0 +1,5 @@ +ECHO Compiling File %1.c02 +..\c02.exe %1 + +ECHO Assembling File %1.asm +C:\Programs\dasm %1.asm -f3 -o%1.bin -l%1.lst -s%1.sym diff --git a/vcs/colors4.c02 b/vcs/colors4.c02 deleted file mode 100644 index 4b23772..0000000 --- a/vcs/colors4.c02 +++ /dev/null @@ -1,156 +0,0 @@ -/* Atari VCS Color Bars Program */ - -#pragma origin $F800 //2k Cartridge -#include //TIA and RIOT Registers -#include //Initialize VCS - -zeropage char clrbkg; //Color Background -zeropage char clrofs; //Color Offset -zeropage char clrmsk; //Color/B&W Mask - -zeropage char score; //Two Digit BCD Score -zeropage char timer; //Two Digit BDC Timer -zeropage char scrone; //Offset into Ones Digit -zeropage char tmrone; -zeropage char scrten; //Offset into Tens Digit -zeropage char tmrten; -zeropage char scrgfx; //Score Graphics Data -zeropage char tmrgfx; //Score Timer Graphics - -zeropage char temp; //Scratch Variable - -/* Generate Ones Digit Offset */ -char ofsone() { - temp = A & $0F; - temp++; - A<<; A<<; - return A + temp; -} - -/* Generate Tens Digit Offset */ -char ofsten() { - A = A & $F0; - A>>; A>>; - temp = A; - temp++; - A>>; A>>; - return A + temp; -} - -/* Prepare Score and Timer for Display */ -void prepst() { - scrone = ofsone(score); - scrten = ofsten(score); - tmrone = ofsone(timer); - tmrten = ofsten(timer); -} - -/* Display Score and Timer */ -void dispst() { - X = 5; //5 lines in digit - -} - -ScoreLoop: ; 43 - cycle after bpl ScoreLoop - ldy DigitTens ; 3 46 - get the tens digit offset for the Score - lda DigitGfx,y ; 5 51 - use it to load the digit graphics - and #$F0 ; 2 53 - remove the graphics for the ones digit - sta ScoreGfx ; 3 56 - and save it - ldy DigitOnes ; 3 59 - get the ones digit offset for the Score - lda DigitGfx,y ; 5 64 - use it to load the digit graphics - and #$0F ; 2 66 - remove the graphics for the tens digit - ora ScoreGfx ; 3 69 - merge with the tens digit graphics - sta ScoreGfx ; 3 72 - and save it - sta WSYNC ; 3 75 - wait for end of scanline -;--------------------------------------- - sta PF1 ; 3 3 - @66-28, update playfield for Score dislay - ldy DigitTens+1 ; 3 6 - get the left digit offset for the Timer - lda DigitGfx,y ; 5 11 - use it to load the digit graphics - and #$F0 ; 2 13 - remove the graphics for the ones digit - sta TimerGfx ; 3 16 - and save it - ldy DigitOnes+1 ; 3 19 - get the ones digit offset for the Timer - lda DigitGfx,y ; 5 24 - use it to load the digit graphics - and #$0F ; 2 26 - remove the graphics for the tens digit - ora TimerGfx ; 3 29 - merge with the tens digit graphics - sta TimerGfx ; 3 32 - and save it - jsr Sleep12 ;12 44 - waste some cycles - sta PF1 ; 3 47 - @39-54, update playfield for Timer display - ldy ScoreGfx ; 3 50 - preload for next scanline - sta WSYNC ; 3 53 - wait for end of scanline -;--------------------------------------- - sty PF1 ; 3 3 - @66-28, update playfield for the Score display - inc DigitTens ; 5 8 - advance for the next line of graphic data - inc DigitTens+1 ; 5 13 - advance for the next line of graphic data - inc DigitOnes ; 5 18 - advance for the next line of graphic data - inc DigitOnes+1 ; 5 23 - advance for the next line of graphic data - jsr Sleep12 ;12 35 - waste some cycles - dex ; 2 37 - decrease the loop counter - sta PF1 ; 3 40 - @39-54, update playfield for the Timer display - bne ScoreLoop ; 2 42 - (3 43) if dex != 0 then branch to ScoreLoop - sta WSYNC ; 3 45 - wait for end of scanline -;--------------------------------------- - stx PF1 ; 3 3 - x = 0, so this blanks out playfield - sta WSYNC ; 3 6 - wait for end of scanline - -/* Generate Vertical Sync Signal */ -void vtsync() { - X=49; //49*64 Cycles (37 Scanlines) - A=2; //Set Bit 2 (D1) - WSYNC=A; //Wait for end of Scanline - VSYNC=A; //Turn On Vertical Sync - TIM64T=X; //Set Timer - WSYNC=A; //Wait 2 More Scanlines - WSYNC=A; - A=0; //Clear Bit 2 (D1) - WSYNC=A; //Wait for End of 3rd Scanline - VSYNC=A; //Turn Off Vertical Sync - return; -} - -/* Execute Vertical Blank Code */ -void vtblnk() { - clrmsk = (SWCHB & 8) ? $FF : $0F; - if (SWCHB & 64) clrofs--; else clrofs++; - A=0; //Clear All Bits - return; -} - -/* Execute Kernel Code */ -void kernel() { - do WSYNC=A; while(INTIM); - VBLANK=0; //Turn Off Vertical Blank - X=192; //Draw 192 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() { - WSYNC=A; //Wait for end of Scanline - A=2; //Set Bit 2 (D1) - VBLANK=A; //Turn On Vertical Blank - TIM64T = 32; //Delay 32*64 Cycles (27 Scanlines) - do { - WSYNC=A; //Wait for end of Scanline - } while(INTIM); - return; -} - -irqbrk: //Code to Execute when BRK Instruction is Encountered -main: //Start of Program Code - vtsync(); //Generate Vertical Sync Signal - vtblnk(); //Generate Vertical Blank Signal - kernel(); //Execute Kernal Code - ovrscn(); //Execute Overscan Code - goto main; - -#include //Finalization Code - - diff --git a/vcs/colors6.c02 b/vcs/colors6.c02 deleted file mode 100644 index b44cfc8..0000000 --- a/vcs/colors6.c02 +++ /dev/null @@ -1,81 +0,0 @@ -/* Atari VCS Color Bars Program */ - -#pragma origin $F800 //4k Cartridge -#include //TIA and RIOT Registers -#include //Initialize VCS -#include //VCS Library Routines -#include //Two Player Score Kernel -#include //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 //Digit Graphics -#include //Finalization Code - diff --git a/vcs/colorscr.c02 b/vcs/colorscr.c02 deleted file mode 100644 index 9ea7161..0000000 --- a/vcs/colorscr.c02 +++ /dev/null @@ -1,65 +0,0 @@ -/* Atari VCS Color Bars Program */ - -#pragma origin $F800 //4k Cartridge -#include //TIA and RIOT Registers -#include //Initialize VCS -#include //VCS Library Routines -#include //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 //Digit Graphics -#include //Finalization Code - - diff --git a/vcs/humans.c02 b/vcs/humans.c02 deleted file mode 100644 index 0b718e0..0000000 --- a/vcs/humans.c02 +++ /dev/null @@ -1,66 +0,0 @@ -/* Atari VCS 2 Line Kernel Test` */ - -#pragma origin $F800 //4k Cartridge -#include //TIA and RIOT Registers -#include //VCS Program Stub -#include //VCS Library Routines -#include //Two Player Score Kernel -#include //Two Player Score Kernel -#include //Two Line Game Kernel - -//TIA Register Bit Masks -#define CLEAR = 0 -#define SET = $0B - -//Console Switch Bit Masks -#define P1DIFF = $80 //Player 1 Difficulty -#define P0DIFF = $40 //Player 0 Difficulty - -//Constants Required by timerbar.h02 -#define TMRCLR = $64 - -//Constants Required by k2line.h02 -#define P0HGHT = 10 //Player 0 Height -#define P1HGHT = 10 //Player 1 Height - -//Color Table -char colors = {$86, $C6, $46, $00, $0E, $06, $0A, $00}; - -//Human Shaped Player Graphics -char human = {%00011100, %00011000, %00011000, %00011000, %01011010, - %01011010, %00111100, %00000000, %00011000, %00011000}; - -zeropage char frame; //Frame Counter - -/* Setup Code */ -void setup() { - setclr(&colors); //Set Color Table - initmr(); //Initialize Timer Bar -} - -/* Vertical Blank Code */ -void vrtblk() { - scrprp(); //Prepare Score For Display - posobj(0,0); //Set P0 X-Position - p0prep(175, &human); //Set P0 Y-Position & Graphics Pointer - posobj(8,1); //Set P1 X-Position - p1prep(175, &human); //Set P1 Y-Position & Graphics Pointer -} - -/* Execute Kernel Code */ -void kernel() { - scrdsp(); //Display Scores - dsptmr(); //Display Timer Bar - dsplns(); //Display Playfield and Objects -} - -/* Execute Overscan Code */ -void ovrscn() { - frame++; - if (!frame & 7) { //Decrement Timer Every X Frames - if (!dectmr()) initmr(); //Reset Timer if It Runs Out - } -} - -#include //Digit Graphics -#include //Finalization Code diff --git a/vcs/humans0.c02 b/vcs/humans0.c02 deleted file mode 100644 index e7442d1..0000000 --- a/vcs/humans0.c02 +++ /dev/null @@ -1,50 +0,0 @@ -/* Atari VCS Color Bars Program */ - -#pragma origin $F800 //4k Cartridge -#include //TIA and RIOT Registers -#include //Initialize VCS -#include //VCS Library Routines -#include //Two Player Score Kernel -#include //Two Line Game Kernel - -//Color Table -char colors = {$86, $C6, $46, $00, $0E, $06, $0A, $00}; - -//Human Shaped Player Graphics -char human = {%00011100, %00011000, %00011000, %00011000, %01011010, - %01011010, %00111100, %00000000, %00011000, %00011000}; - -/* Setup Code */ -void setup() { - setclr(&colors); //Set Color Table - scrprp(); //Prepare Score for Display - scnlns = 96; //Set Number of Scanlines - setpl0(10, &human); - setpl1(10, &human); - //VDELP0 = 1; -} - -/* Vertical Blank Code */ -void vrtblk() { - posobj(0,0); //Set Player 0 X Position - prppl0(190); //Set Player 0 Y Position - posobj(8,1); //Set Player 0 X Position - prppl1(190); //Set Player 1 Y Position - prpdsp(); //Prepare Display -} - -/* Execute Kernel Code */ -void kernel() { - //CTRLPF = 2; //Set Score Mode - //scrdsp(); //Display Scores (12 Scanlines) - //CTRLPF = 0; //Clear Score Mode - dsplns(); //Display Playfield and Objects -} - -/* Execute Overscan Code */ -void ovrscn() { -} - -#include //Digit Graphics -#include //Finalization Code - diff --git a/vcs/stella.bat b/vcs/stella.bat new file mode 100644 index 0000000..74df49a --- /dev/null +++ b/vcs/stella.bat @@ -0,0 +1 @@ +"C:\Program Files\Stella\stella" %1.bin