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

@@ -0,0 +1,130 @@
/* SPDX-License-Identifier: GPL-3.0-or-later */
/* Two landscapes, one working array. Link bank, gime and hirestxt. */
#include <coco.h>
#include <font5x8.h>
#include <vcc/bank.h>
#include <vcc/gime.h>
enum { COLUMNS = 20, FIRST_COLUMN = 10, FLOOR = 169 };
enum { NIGHT, INK, WHITE, GOLD, WINDOW, EARTH_FAR, EARTH_SOIL, EARTH_EDGE,
MARS_FAR, MARS_SOIL, MARS_EDGE };
static const byte earth[COLUMNS] = {
128, 122, 116, 120, 132, 140, 136, 128, 122, 126,
132, 140, 146, 138, 134, 122, 112, 120, 132, 140
};
static const byte mars[COLUMNS] = {
156, 146, 132, 128, 140, 154, 150, 140, 142, 148,
152, 146, 136, 126, 118, 130, 142, 154, 146, 138
};
/* Pierre Sarrazin's HiresText font has five ink columns, encoded as zero bits. */
static void label(unsigned x, byte y, const char *text)
{
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, WHITE);
x += 6;
}
}
static byte draw(const byte *ridge, byte onMars, byte column)
{
char reading[10]; /* "RIDGE $FF" and its terminator. */
unsigned i, x = column * 16;
byte farRock = onMars ? MARS_FAR : EARTH_FAR;
byte soil = onMars ? MARS_SOIL : EARTH_SOIL;
byte edge = onMars ? MARS_EDGE : EARTH_EDGE;
gime_clear(NIGHT);
for (i = 0; i < COLUMNS; ++i) {
unsigned left = i * 16;
unsigned farY = 101 + ((i * 7 + (onMars ? 19 : 5)) % 27);
gime_plot(left + 3, 31 + i * 11 % 43, WHITE);
gime_fill_rect(left, farY, 16, FLOOR - farY, farRock);
gime_fill_rect(left, ridge[i], 16, FLOOR - ridge[i], soil);
gime_fill_rect(left, ridge[i], 16, 2, edge);
if ((i & 1) == 0 && ridge[i] + 9 < FLOOR)
gime_fill_rect(left + 3, ridge[i] + 8, 6, 1, farRock);
}
/* A crescent hangs above the distant range. */
gime_fill_rect(259, 28, 8, 2, edge);
gime_fill_rect(256, 30, 4, 8, edge);
gime_fill_rect(259, 38, 8, 2, edge);
/* A small survey craft and the sounding line beneath it. */
for (i = 67; i < ridge[column]; i += 6)
gime_plot(x + 8, i, GOLD);
gime_fill_rect(x + 5, 51, 8, 5, WINDOW);
gime_fill_rect(x + 2, 56, 13, 3, WHITE);
gime_fill_rect(x, 59, 16, 3, edge);
gime_fill_rect(x + 4, 62, 2, 3, GOLD);
gime_fill_rect(x + 11, 62, 2, 3, GOLD);
label(8, 8, onMars ? "MARS SURVEY" : "EARTH SURVEY");
sprintf(reading, "RIDGE $%02X", (unsigned)ridge[column]);
label(131, 8, reading);
label(258, 8, onMars ? "BANK $29" : "BANK $28");
gime_fill_rect(8, 19, 304, 1, edge);
gime_fill_rect(0, FLOOR, 320, 192 - FLOOR, INK);
label(8, 176, "A/D FLY SPACE SWAP R RAISE ON MARS Q QUIT");
return gime_present();
}
static byte survey(void)
{
byte ridge[COLUMNS], column = FIRST_COLUMN, onMars = 0;
unsigned offset;
/* Seed once. Changing planets must read the saved map, not reseed it. */
if (!bank_write(0, earth, COLUMNS) ||
!bank_write(BANK_PAGE_SIZE, mars, COLUMNS))
return 0;
for (;;) {
byte key;
offset = onMars ? BANK_PAGE_SIZE : 0u;
if (!bank_read(offset, ridge, COLUMNS) || !draw(ridge, onMars, column))
return 0;
do {
key = waitkey(0);
if (key >= 'a' && key <= 'z') key -= 'a' - 'A';
if (key == 'Q') return 1;
if (key == ' ') { onMars ^= 1; break; }
if (key == 'A' && column > 0) { --column; break; }
if (key == 'D' && column + 1 < COLUMNS) { ++column; break; }
if (key == 'R' && onMars && ridge[column] >= 96) {
/* Screen y grows downward. Save just the changed byte. */
ridge[column] -= 16;
if (!bank_write(offset + column, &ridge[column], 1))
return 0;
break;
}
} while (1);
}
}
int main(void)
{
static const byte colors[] = {
0x01, 0x00, 0x3f, 0x36, 0x1b, 0x0a, 0x15, 0x1e, 0x21, 0x26, 0x37
};
byte i, ok;
if (!bank_open()) {
printf("USE STANDARD COCO 3 BASIC WITH 512K OR MORE\n");
return 1;
}
if (!gime_open()) {
bank_close();
printf("GRAPHICS UNAVAILABLE\n");
return 1;
}
for (i = 0; i < sizeof(colors); ++i) gime_set_palette(i, colors[i]);
ok = survey();
gime_close();
bank_close();
printf("%s\n", ok ? "SURVEY COMPLETE" : "SURVEY TRANSFER OR DISPLAY FAILED");
return ok ? 0 : 1;
}