Implement CoCo 3 Quadrapassel and deliver build 01

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.
This commit is contained in:
Brian Holman committed 2026-11-11 03:14:14 -07:00
1 parent 8a4b44bc73
commit d412e35c4e
79 files changed
+4187 -16

No files matched your search

+97
View File
@@ -0,0 +1,97 @@
/* SPDX-License-Identifier: GPL-3.0-or-later */
/* Brian-approved C graphics exception: docs/DECISIONS.md, 2026-11-10.
* Hardware reference: Chris Lomont, CoCo Hardware v0.82, pp. 11-13, 67-69.
* The four BASIC graphics banks $30-$33 exist in the 128 KB machine.
* Only Disk BASIC task 0's $8000-$9FFF mapping changes. SAM ROM/RAM selection,
* video registers, BASIC system RAM, code and stack are never changed here.
*/
#include "coco3_video.h"
#define REG(address) (*(byte *)(address))
word c3_mapping_errors;
byte c3_video_ready(void)
{
/* Stock Disk BASIC uses MMU task 0 and HSCREEN 2 page $60000.
* GIME control registers are not a dependable readback contract. The
* caller has already initialized standard CoCo support and HSCREEN 2;
* this renderer neither detects nor supports arbitrary custom mappings.
*/
return isCoCo3;
}
/* CMOC does not implement volatile. A separate C call is an optimization
* boundary for MMU readback; audit the emitted reads/stores for each candidate.
*/
static byte read_bank(void)
{
return REG(0xFFA4) & 63;
}
static void copy_chunk(word offset, const byte *source, byte count)
{
byte *bank_register;
byte *destination;
byte original, bank, i;
bank = (byte)(0x30 + (offset >> 13));
destination = (byte *)(0x8000 + (offset & 0x1FFF));
/* These are unmodified public coco.h interrupt APIs, not authored assembly.
* Limit each interval to at most 32 copied bytes. No standard API that
* needs BASIC/ROM is called until the prior mapping has been restored.
*/
disableInterrupts();
bank_register = (byte *)0xFFA4;
original = read_bank();
*bank_register = bank;
for (i = 0; i < count; ++i) destination[i] = source[i];
*bank_register = original;
if (read_bank() != original) ++c3_mapping_errors;
enableInterrupts();
}
byte c3_blit(word x, byte y, word width, byte height, const byte *packed)
{
word row_bytes, offset, remaining, until_boundary, source_address;
byte row, chunk;
if (!width || !height || x >= 320 || width > 320-x || y >= 192 || height > 192-y)
return FALSE;
if ((x | width) & 1) return FALSE;
row_bytes = width / 2;
source_address = (word)packed;
if (source_address >= 0x8000 || (word)(row_bytes * height) > 0x8000-source_address)
return FALSE;
for (row = 0; row < height; ++row)
{
offset = (word)(y+row) * 160 + x/2;
remaining = row_bytes;
while (remaining)
{
until_boundary = 8192 - (offset & 8191);
chunk = remaining > 32 ? 32 : (byte)remaining;
if (until_boundary < chunk) chunk = (byte)until_boundary;
copy_chunk(offset,packed,chunk);
packed += chunk; offset += chunk; remaining -= chunk;
}
}
return TRUE;
}
byte c3_fill(word x, byte y, word width, byte height, byte color)
{
byte fill[160], row;
if (!width || !height || color > 15 || x >= 320 || width > 320-x || y >= 192 || height > 192-y)
return FALSE;
/* Keep uncommon odd edges on the public API, outside every mapped interval. */
if (x & 1) {
for (row = 0; row < height; ++row) hset(x,y+row,color);
++x; --width;
}
if (width & 1) {
for (row = 0; row < height; ++row) hset(x+width-1,y+row,color);
--width;
}
if (!width) return TRUE;
memset(fill,(color<<4)|color,sizeof(fill));
for(row=0;row<height;++row)
if(!c3_blit(x,y+row,width,1,fill))return FALSE;
return TRUE;
}