Add gameplay, keyboard/joystick controls, disk-backed high scores and settings, standard CMOC effects, and the approved C graphics renderer. Include the clearer attributed font, title/credits updates, source-verified Modern and Classic (40.2) scoring, meaningful regression fixtures, and recorded guest validation. Deliver QUADPSL01.DSK with fresh high scores. Retain source, licenses and selected guest evidence; exclude personal disks, private connections and build scratch. Host rules/input/persistence/video checks and memory guards pass. Official 512 KB playtests pass the recorded checks; actual 128 KB/physical joystick qualification and the normal-window buzzing retest remain pending.
69 lines
3.4 KiB
C
69 lines
3.4 KiB
C
/* SPDX-License-Identifier: GPL-3.0-or-later */
|
|
#include <assert.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include "video.h"
|
|
#include "coco3_video.h"
|
|
#include "8-bit-wide-font.h"
|
|
static Q8 screen[192][320],colors[16][3];
|
|
byte isCoCo3=1;
|
|
void rgb(void){}
|
|
void paletteRGB(byte i,byte r,byte g,byte b){assert(i<16);colors[i][0]=r;colors[i][1]=g;colors[i][2]=b;}
|
|
byte hscreen(byte mode){assert(mode<=2);memset(screen,0,sizeof(screen));return 1;}
|
|
void enableInterrupts(void){}
|
|
void resetPalette(byte reset){(void)reset;}
|
|
void width(byte cols){(void)cols;}
|
|
void setHighSpeed(byte speed){(void)speed;}
|
|
word getTimer(void){return 0;}
|
|
byte hset(word x,word y,byte color){assert(x<320&&y<192);screen[y][x]=color;return 1;}
|
|
byte c3_fill(word x,byte y,word w,byte h,byte color){word col;byte row;assert(x+w<=320&&y+h<=192);for(row=0;row<h;++row)for(col=0;col<w;++col)screen[y+row][x+col]=color;return 1;}
|
|
byte c3_blit(word x,byte y,word w,byte h,const byte *packed){word col;byte row;assert(!(w&1)&&x+w<=320&&y+h<=192);for(row=0;row<h;++row)for(col=0;col<w;++col)screen[y+row][x+col]=(packed[row*(w/2)+col/2]>>((col&1)?0:4))&15;return 1;}
|
|
static void check_letter(char c)
|
|
{
|
|
char s[2];Q8 row,col,expected;int code=c;
|
|
s[0]=c;s[1]=0;
|
|
/* Render at the last legal cell to cover both screen boundaries. */
|
|
memset(screen,11,sizeof(screen));video_text(31,23,s);
|
|
if(code>='a'&&code<='z')code-=32;
|
|
for(row=0;row<8;++row)for(col=0;col<8;++col){
|
|
expected=0;
|
|
if(code!=32&&row<7&&(eightBitWideFont[code-32][row]&(0x80>>col)))expected=8;
|
|
assert(screen[184+row][280+col]==expected);
|
|
}
|
|
assert(screen[183][280]==11&&screen[191][288]==11);
|
|
}
|
|
static void write_ppm(const char *path)
|
|
{
|
|
FILE *f=fopen(path,"wb");Q16 x,y;Q8 c,channel;
|
|
assert(f);fprintf(f,"P6\n320 192\n255\n");
|
|
for(y=0;y<192;++y)for(x=0;x<320;++x){c=screen[y][x];for(channel=0;channel<3;++channel)fputc(colors[c][channel]*85,f);}
|
|
assert(!fclose(f));
|
|
}
|
|
int main(int argc,char **argv)
|
|
{
|
|
const char *p;Q8 x,y,expected,c;
|
|
static const Q8 expected_palette[11][3]={
|
|
{0,0,0},{3,0,0},{0,3,0},{0,1,3},{2,2,2},{3,3,0},
|
|
{2,0,3},{3,1,0},{3,3,3},{0,0,1},{1,1,1}
|
|
};
|
|
assert(video_open(1));
|
|
assert(!memcmp(colors,expected_palette,sizeof(expected_palette)));
|
|
for(p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+.:/>< ?^()&";*p;++p)check_letter(*p);
|
|
video_style(1,0);memset(screen,0,sizeof(screen));
|
|
for(c=1;c<=7;++c){
|
|
video_cell(0,0,c);
|
|
for(y=0;y<8;++y)for(x=0;x<8;++x){expected=(x==0||x==7||y==0||y==7)?10:c;assert(screen[y][32+x]==expected);}
|
|
}
|
|
assert(colors[10][0]==1&&colors[10][1]==1&&colors[10][2]==1);
|
|
assert(colors[0][0]==0&&colors[0][1]==0&&colors[0][2]==0);
|
|
video_style(0,0);video_cell(0,0,1);assert(screen[0][32]==1);
|
|
video_style(2,0);video_cell(0,0,1);assert(screen[0][32]==8&&screen[7][39]==1);
|
|
video_style(1,0);video_clear();
|
|
video_text(1,1,"QUADRAPASSEL FOR COCO");video_text(1,4,"SCORE 0123456789");
|
|
video_text(1,7,"LEVEL 1 LINES 0");video_text(1,10,"HOLD NEXT SETTINGS");
|
|
video_text(1,13,"MW O0 I1 BRH CCW");video_text(5,21,"(c) 2026 Brian Holman");
|
|
for(x=0;x<7;++x)video_cell(x*32,136,x+1);
|
|
if(argc>1)write_ppm(argv[1]);
|
|
puts("PASS: font matches Pierre's original row bytes, lowercase mapping, cell boundaries, dark-gray Modern borders, Plain/Clean styles and black background");return 0;
|
|
}
|