Publish VCC Plus OSS source distribution for 3.6.2 build 60

This commit is contained in:
Brian Holman committed 2026-11-13 00:14:03 -07:00
commit c652a5276d
1192 files changed
+272368

No files matched your search

+57
View File
@@ -0,0 +1,57 @@
# Generated by VCC Plus — edit Project Settings to regenerate.
# Ordinary GNU Make; no VCC Plus project parser is required to build it.
CMOC ?= cmoc
PERL ?= perl
WRITECOCOFILE ?= writecocofile
INSTALL_LOADER ?= install-coco-boot-loader
VCC_CONFIGURATION ?= Debug
ifeq ($(VCC_CONFIGURATION),Release)
OPTIM ?= -O2
else
OPTIM ?= -O0
DEBUG_FRAME ?= -fno-omit-frame-pointer
endif
define VCC_DEFINES
endef
define VCC_COMPILER_OPTIONS
endef
define VCC_LINKER_OPTIONS
endef
export VCC_CMOC_COMPAT = 1
CPPFLAGS += $(VCC_DEFINES)
CFLAGS += --coco --intermediate --deps --stack-space=2048 $(OPTIM) $(DEBUG_FRAME) $(VCC_COMPILER_OPTIONS)
LDFLAGS += --coco --intermediate --org=2000 --limit=7800 $(VCC_LINKER_OPTIONS)
LDLIBS += -lbank -lgime -linput -lbcontrol -lssc -lorch90 -lhirestxt -lvcccompat -ldecbfile
OBJECTS := obj/main.o obj/flight.o obj/report.o
.PHONY: all build clean disk libraries
all: build
build: RECORDER.bin
RECORDER.bin: $(OBJECTS) Makefile
@mkdir -p $(dir $@)
"$(CMOC)" $(LDFLAGS) -o $@ $(OBJECTS) $(LDLIBS)
obj/main.o: main.c Makefile
@mkdir -p $(dir $@)
"$(CMOC)" $(CPPFLAGS) $(CFLAGS) --intdir=$(dir $@) -c -o $@ $<
obj/flight.o: flight.c Makefile
@mkdir -p $(dir $@)
"$(CMOC)" $(CPPFLAGS) $(CFLAGS) --intdir=$(dir $@) -c -o $@ $<
obj/report.o: report.c Makefile
@mkdir -p $(dir $@)
"$(CMOC)" $(CPPFLAGS) $(CFLAGS) --intdir=$(dir $@) -c -o $@ $<
disk: RECORDER.dsk
RECORDER.dsk: RECORDER.bin Makefile
@mkdir -p $(dir $@)
$(PERL) -e 'print chr(255) x (35*18*256)' > $@
$(WRITECOCOFILE) $@ RECORDER.bin
clean:
rm -rf obj
rm -f RECORDER.bin RECORDER.map RECORDER.link RECORDER.dsk
-include $(OBJECTS:.o=.d)
+182
View File
@@ -0,0 +1,182 @@
// SPDX-License-Identifier: GPL-3.0-or-later
#include <coco.h>
#include <font5x8.h>
#include <vcc/bank.h>
#include <vcc/gime.h>
#include <vcc/input.h>
#include <vcc/orch90.h>
#include <vcc/ssc.h>
#include "mission.h"
enum { SKY, WHITE, ICE, GOLD, BASALT, RIDGE, TEAL };
#define NO_MARK 255
/* The steady beacon plays from resident, read-only data during the flight. */
static const struct orch90_frame beacon[] = {
{128,128}, {142,128}, {148,128}, {142,128}, {128,128}, {114,128}, {108,128}, {114,128},
{128,128}, {142,128}, {148,128}, {142,128}, {128,128}, {128,128}, {128,128}, {128,128},
{128,128}, {128,128}, {128,142}, {128,142}, {128,148}, {128,148}, {128,142}, {128,142},
{128,128}, {128,128}, {128,114}, {128,114}, {128,128}, {128,128}, {128,128}, {128,128}
};
static byte previousShip[2], previousMark[2], hidden;
static void label(unsigned x, byte y, const char *text, byte color)
{
while (*text) {
const byte *glyph = font5x8 + ((unsigned)*text++ - ' ') * 8;
byte row, col;
for (row = 0; row < 8; ++row)
for (col = 0; col < 5; ++col)
if (!(glyph[row] & (0x80 >> col)))
gime_plot(x + col, y + row, color);
x += 6;
}
}
/* Paint the permanent landscape once on each page before switching on sound. */
static void landscape(void)
{
unsigned i;
gime_clear(SKY);
label(8, 7, "MISSION RECORDER", ICE);
label(240, 7, "SURVEY / 01", WHITE);
gime_fill_rect(8, 20, 304, 1, TEAL);
for (i = 0; i < 16; ++i) {
unsigned x = i * 20, y = 106 + ((i * 7) % 19);
gime_plot(x + 4, 28 + ((i * 11) % 17), WHITE);
gime_fill_rect(x, y, 20, 141 - y, BASALT);
gime_fill_rect(x, y, 20, 2, RIDGE);
gime_fill_rect(x + 9, 139, 2, 4, ICE);
}
label(8, 149, "SECTOR 07 MARK --", WHITE);
label(8, 164, "A/D OR RIGHT STICK: STEER SPACE/FIRE: MARK", WHITE);
label(8, 178, "S: SAVE AND PRINT Q: DISCARD", ICE);
}
static void digits(unsigned x, byte value)
{
char pair[3];
pair[0] = '0' + value / 10;
pair[1] = '0' + value % 10;
pair[2] = 0;
gime_fill_rect(x, 149, 11, 8, SKY);
label(x, 149, pair, WHITE);
}
/* Each hidden page remembers where its own ship was painted. Erase just
that footprint. A mark stays put for the rest of this flight. */
static byte draw(byte sector, byte mark)
{
byte old = previousShip[hidden];
unsigned x = (unsigned)sector * 20;
if (old != sector) {
if (old != NO_MARK)
gime_fill_rect((unsigned)old * 20 + 2, 53, 16, 12, SKY);
gime_fill_rect(x + 7, 53, 6, 3, ICE);
gime_fill_rect(x + 4, 56, 12, 3, WHITE);
gime_fill_rect(x + 2, 59, 16, 3, TEAL);
gime_fill_rect(x + 5, 62, 2, 3, GOLD);
gime_fill_rect(x + 13, 62, 2, 3, GOLD);
digits(50, sector);
previousShip[hidden] = sector;
}
if (mark != NO_MARK && previousMark[hidden] != mark) {
gime_fill_rect((unsigned)mark * 20 + 8, 68, 4, 4, GOLD);
digits(110, mark);
previousMark[hidden] = mark;
}
hidden ^= 1;
return gime_present();
}
static byte flightLoop(byte speech, byte *mark, byte *speechError)
{
VccInput stick;
byte sector = 7, recorded = NO_MARK;
ssc_phrase words;
byte exit = 0;
unsigned started = 0, lastSample = getTimer();
words.remaining = 0;
input_init(&stick, INPUT_RIGHT);
for (;;) {
byte key = inkey(), fire = 0, previous = sector;
unsigned now = getTimer();
if (key >= 'a' && key <= 'z') key -= 'a' - 'A';
if (key == 'Q') exit = DISCARDED;
if (key == 'S' && recorded != NO_MARK) exit = RECORDED;
/* Service one cartridge byte per turn. Remember Save or Quit even
when there is no ready signal. Two seconds bounds the whole phrase. */
if (words.remaining) {
if ((unsigned)(now - started) < 120) ssc_service(&words);
else { words.remaining = 0; *speechError = SSC_TIMEOUT; }
}
if (exit) {
if (words.remaining) continue;
if (exit == RECORDED && !bank_read(0, mark, 1)) return FLIGHT_ERROR;
return exit;
}
if ((unsigned)(now - lastSample) >= 5) {
lastSample = now;
input_sample(&stick);
fire = stick.pressed & INPUT_PRIMARY;
if (stick.dx < 0 && sector > 0) --sector;
if (stick.dx > 0 && sector < 15) ++sector;
}
if (key == 'A' && sector > 0) --sector;
if (key == 'D' && sector < 15) ++sector;
if ((key == ' ' || fire) && recorded == NO_MARK) {
if (!bank_write(0, &sector, 1)) return FLIGHT_ERROR;
recorded = sector;
if (speech) {
started = now;
ssc_begin_phrase(&words, "MARK RECORDED");
}
} else if (previous == sector) {
continue;
}
if (!draw(sector, recorded)) {
if (words.remaining) *speechError = SSC_TIMEOUT;
return FLIGHT_ERROR;
}
}
}
unsigned char fly(unsigned char audio, unsigned char *mark)
{
static const byte colors[] = {0x01, 0x3f, 0x1f, 0x36, 0x20, 0x34, 0x0f};
byte i, result = FLIGHT_ERROR, stereo = 0, speechError = SSC_OK;
unsigned route = 0;
if (!bank_open()) {
printf("USE STANDARD COCO 3 BASIC WITH\n512K OR MORE\n");
return FLIGHT_ERROR;
}
if (!gime_open()) {
bank_close();
printf("GRAPHICS UNAVAILABLE\n");
return FLIGHT_ERROR;
}
for (i = 0; i < sizeof(colors); ++i) gime_set_palette(i, colors[i]);
previousShip[0] = previousShip[1] = NO_MARK;
previousMark[0] = previousMark[1] = NO_MARK;
hidden = 0;
landscape();
if (gime_present()) {
/* Show the ship only when the second page and controls are ready. */
landscape();
if (audio & AUDIO_SPEECH) route = ssc_route_audio();
if (audio & AUDIO_STEREO)
stereo = orch90_start(beacon, sizeof(beacon) / sizeof(beacon[0]), 1, ORCH90_CLOCK_NORMAL);
if (draw(7, NO_MARK))
result = flightLoop(audio & AUDIO_SPEECH, mark, &speechError);
if (stereo) orch90_stop();
if (audio & AUDIO_SPEECH) {
if (speechError == SSC_TIMEOUT) ssc_reset();
ssc_restore_audio(route);
}
}
gime_close();
bank_close();
if (speechError != SSC_OK) printf("SPEECH UNAVAILABLE\n");
if ((audio & AUDIO_STEREO) && !stereo) printf("STEREO PLAYER UNAVAILABLE\n");
if (result == FLIGHT_ERROR) printf("FLIGHT TRANSFER OR DISPLAY ERROR\n");
return result;
}
+20
View File
@@ -0,0 +1,20 @@
// SPDX-License-Identifier: GPL-3.0-or-later
#include <coco.h>
#include "mission.h"
int main(void)
{
byte key, sector, result;
cls(1);
printf("MISSION RECORDER\n\n1 SILENT 2 SPEECH\n3 STEREO 4 BOTH\nQ QUIT\nSELECT AUDIO\n");
do {
key = waitkey(0);
if (key == 'Q' || key == 'q') return 0;
} while (key < '1' || key > '4');
result = fly(key - '1', &sector);
if (result == DISCARDED) printf("FLIGHT DISCARDED\n");
if (result == FLIGHT_ERROR) return 1;
if (result == RECORDED) return saveReport(sector);
return 0;
}
+13
View File
@@ -0,0 +1,13 @@
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef MISSION_H
#define MISSION_H
#define AUDIO_SPEECH 1
#define AUDIO_STEREO 2
enum FlightResult { FLIGHT_ERROR, DISCARDED, RECORDED };
unsigned char fly(unsigned char audio, unsigned char *mark);
int saveReport(unsigned char sector);
#endif
+72
View File
@@ -0,0 +1,72 @@
// SPDX-License-Identifier: GPL-3.0-or-later
#include <coco.h>
#include <stdio.h>
#include <decbfile.h>
#include <vcc/printer.h>
#include "mission.h"
enum { IO_ERROR, MISSING, OCCUPIED };
static int inspect(const char *name)
{
FILE *f = fopen(name, "rb");
if (!f) return vcc_file_error() == DECB_ERR_NOT_FOUND ? MISSING : IO_ERROR;
return fclose(f) == 0 ? OCCUPIED : IO_ERROR;
}
/* Verify every byte, the exact EOF, and the close before publishing the name. */
static int matches(const char *name, const char *report)
{
FILE *f = fopen(name, "rb");
if (!f) return 0;
while (*report && fgetc(f) == *report) ++report;
int exact = !*report && fgetc(f) == EOF && !ferror(f);
return fclose(f) == 0 && exact;
}
static int publish(const char *report, char *name)
{
char draft[] = "LOG00.TMP:0";
unsigned i;
for (i = 1; i <= 99; ++i) {
name[3] = draft[3] = (char)('0' + i / 10);
name[4] = draft[4] = (char)('0' + i % 10);
int live = inspect(name), temp = inspect(draft);
if (live == IO_ERROR || temp == IO_ERROR) return 0;
if (live == OCCUPIED || temp == OCCUPIED) continue;
/* Old reports and interrupted drafts belong to the disk owner.
Only an unused pair is eligible. rename also refuses collisions. */
FILE *f = fopen(draft, "w");
if (!f) return 0;
int written = fputs(report, f) != EOF;
if (fclose(f) != 0 || !written || !matches(draft, report)) return 0;
return rename(draft, name) == 0;
}
printf("ALL REPORT NAMES IN USE\n");
return 0;
}
int saveReport(unsigned char sector)
{
/* One byte string, including the CoCo's CR line endings, goes to both
devices. A paper copy is requested only after publication succeeds. */
char report[sizeof("MISSION RECORDER\rSECTOR 00\r")];
char name[] = "LOG00.TXT:0";
snprintf(report, sizeof(report), "MISSION RECORDER\rSECTOR %02u\r", (unsigned)sector);
while (!publish(report, name)) {
byte key;
printf("SAVE FAILED\nCHECK DRIVE 0; R RETRY OR Q QUIT\n");
do { key = waitkey(0); } while (key != 'R' && key != 'r' &&
key != 'Q' && key != 'q');
if (key == 'Q' || key == 'q') return 1;
}
name[9] = '\0';
printf("SAVED %s\n", name);
if (vcc_printer_printf("%s", report) < 0) {
printf("REPORT DELIVERY INCOMPLETE\n");
return 1;
}
printf("REPORT SENT TO PRINTER PORT\n");
return 0;
}
@@ -0,0 +1,57 @@
{
"binary": "RECORDER.bin",
"buildTarget": "build",
"cleanTarget": "clean",
"configurations": [
{
"makeArguments": [],
"name": "Debug"
},
{
"makeArguments": [
"VCC_CONFIGURATION=Release"
],
"name": "Release"
}
],
"diskImage": "RECORDER.dsk",
"diskTarget": "disk",
"entrySource": "main.c",
"jobs": 4,
"launchCommands": [],
"launchMode": "quickload",
"makefile": "Makefile",
"makefileSettings": {
"compilerOptions": [],
"defines": [],
"diskBootMode": "none",
"diskFiles": [],
"diskImage": "RECORDER.dsk",
"executable": "RECORDER.bin",
"generatedResources": [],
"includePaths": [],
"libraries": [
"bank",
"gime",
"input",
"bcontrol",
"ssc",
"orch90",
"hirestxt",
"vcccompat",
"decbfile"
],
"libraryPaths": [],
"libraryProjects": [],
"linkerOptions": [],
"origin": "2000",
"releaseOptimization": "-O2",
"sources": [
"main.c",
"flight.c",
"report.c"
],
"stackSpace": 2048,
"limit": "7800"
}
}