Publish VCC Plus OSS source distribution for 3.6.2 build 60
This commit is contained in:
commit
c652a5276d
1192 files changed
+272368
No files matched your search
@@ -0,0 +1,38 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# Build with GNU Make and the VCC Plus CMOC toolchain on PATH.
|
||||
CMOC ?= cmoc
|
||||
WRITECOCOFILE ?= writecocofile
|
||||
PERL ?= perl
|
||||
VCC_CONFIGURATION ?= Debug
|
||||
ifeq ($(VCC_CONFIGURATION),Release)
|
||||
OPTIM ?= -O2
|
||||
else
|
||||
OPTIM ?= -O0 -fno-omit-frame-pointer
|
||||
endif
|
||||
export VCC_CMOC_COMPAT = 1
|
||||
# The IDE supplies its selected library bindings. At the command line the
|
||||
# same archives are available by name from the bundled toolchain.
|
||||
LIBRARIES = $(if $(strip $(GUEST_LIBS)),$(GUEST_LIBS),-lsdc -lvcccompat -ldecbfile)
|
||||
DISKS := EXPED/EXPLORE.DSK EXPED/EARTH.DSK EXPED/MARS.DSK
|
||||
.PHONY: all build disk clean
|
||||
.DELETE_ON_ERROR:
|
||||
all build disk: $(DISKS)
|
||||
|
||||
EXPLORE.BIN: expedition.c Makefile
|
||||
"$(CMOC)" --coco --intermediate --org=2800 --stack-space=2048 $(OPTIM) -Werror -o $@ $< $(LIBRARIES)
|
||||
|
||||
generated/%/LANDING.TXT: assets/%.txt Makefile
|
||||
@mkdir -p $(dir $@)
|
||||
"$(PERL)" -pe 's/\r?\n/\r/' $< > $@
|
||||
|
||||
EXPED/EXPLORE.DSK: EXPLORE.BIN
|
||||
EXPED/EARTH.DSK: generated/earth/LANDING.TXT
|
||||
EXPED/MARS.DSK: generated/mars/LANDING.TXT
|
||||
$(DISKS): Makefile
|
||||
@mkdir -p $(dir $@)
|
||||
"$(PERL)" -e 'print chr(255) x (35*18*256)' > $@
|
||||
"$(WRITECOCOFILE)" $@ $(filter-out Makefile,$^)
|
||||
|
||||
clean:
|
||||
rm -f $(DISKS) EXPLORE.BIN expedition.o expedition.s expedition.lst EXPLORE.map EXPLORE.link
|
||||
rm -f generated/earth/LANDING.TXT generated/mars/LANDING.TXT
|
||||
@@ -0,0 +1,2 @@
|
||||
EARTH: BLUE OCEAN
|
||||
SPLASH DOWN BESIDE THE BUOY.
|
||||
@@ -0,0 +1,2 @@
|
||||
MARS: RED RIDGE
|
||||
LAND BEYOND THE DUST FIELD.
|
||||
@@ -0,0 +1,93 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// The card holds disk images. Each planet disk holds its own LANDING.TXT.
|
||||
#include <coco.h>
|
||||
#include <stdio.h>
|
||||
#include <vcc/sdc.h>
|
||||
|
||||
// Browse the card once. A directory entry describes the image file itself.
|
||||
static void showChart(void)
|
||||
{
|
||||
SdcEntry entry;
|
||||
unsigned char result = sdc_list_begin("/*.DSK");
|
||||
printf("DISKS ON THE PRACTICE CARD\n");
|
||||
if (result == SDC_OK)
|
||||
while ((result = sdc_list_next(&entry)) == SDC_OK)
|
||||
if (!(entry.attributes & SDC_DIRECTORY))
|
||||
printf(" %s\n", entry.name);
|
||||
if (result != SDC_END)
|
||||
printf("CHART UNAVAILABLE (%u)\n", (unsigned)result);
|
||||
}
|
||||
|
||||
// The controller reports the actual filename, even after a failed mount.
|
||||
static void showDrive(unsigned char drive)
|
||||
{
|
||||
SdcEntry entry;
|
||||
unsigned char result = sdc_mounted(drive, &entry);
|
||||
printf("SDC%u: ", (unsigned)drive);
|
||||
if (result == SDC_OK)
|
||||
printf("%s\n", entry.name);
|
||||
else if (result == SDC_NOT_FOUND)
|
||||
printf("EMPTY\n");
|
||||
else
|
||||
printf("CANNOT QUERY (%u)\n", (unsigned)result);
|
||||
}
|
||||
|
||||
static void landingReport(void)
|
||||
{
|
||||
// :1 asks the Disk BASIC ROM for a file inside the mounted planet.
|
||||
FILE *file = fopen("LANDING.TXT:1", "r");
|
||||
char line[40];
|
||||
int ok;
|
||||
if (!file)
|
||||
{
|
||||
printf("NO LANDING REPORT ON DRIVE 1\n");
|
||||
return;
|
||||
}
|
||||
while (fgets(line, sizeof(line), file))
|
||||
printf("%s", line);
|
||||
ok = !ferror(file);
|
||||
if (fclose(file) == EOF || !ok)
|
||||
printf("ERROR READING LANDING REPORT\n");
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int key;
|
||||
unsigned char result;
|
||||
const char *path;
|
||||
width(40);
|
||||
cls(1);
|
||||
printf("PLANET EXPEDITION\n\n");
|
||||
if (sdc_probe() != SDC_OK)
|
||||
{
|
||||
printf("CHOOSE THE COCO SDC PROFILE\n");
|
||||
return 1;
|
||||
}
|
||||
showChart();
|
||||
for (;;)
|
||||
{
|
||||
printf("\n");
|
||||
showDrive(0);
|
||||
showDrive(1);
|
||||
printf("\n1 EARTH 2 MARS\n3 TRY MISSING DISK Q QUIT\n");
|
||||
do {
|
||||
key = waitkey(0);
|
||||
} while (key != '1' && key != '2' && key != '3' && key != 'Q' && key != 'q');
|
||||
if (key == 'Q' || key == 'q')
|
||||
break;
|
||||
|
||||
// No file is open here. Leave drive 0 alone and change only drive 1.
|
||||
path = key == '1' ? "/EARTH.DSK" : key == '2' ? "/MARS.DSK" : "/MISSING.DSK";
|
||||
result = sdc_mount(1, path);
|
||||
cls(1);
|
||||
printf("PLANET EXPEDITION\n\n");
|
||||
if (result == SDC_OK)
|
||||
printf("LANDED\n");
|
||||
else
|
||||
printf("COULD NOT MOUNT %s (%u)\n", path, (unsigned)result);
|
||||
// Read what is actually mounted, including after a rejected change.
|
||||
landingReport();
|
||||
}
|
||||
printf("EXPEDITION COMPLETE\n");
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"entrySource": "expedition.c",
|
||||
"makefile": "Makefile",
|
||||
"buildTarget": "build",
|
||||
"cleanTarget": "clean",
|
||||
"diskTarget": "disk",
|
||||
"binary": "EXPLORE.BIN",
|
||||
"diskImage": "EXPED/EXPLORE.DSK",
|
||||
"launchMode": "quickload",
|
||||
"jobs": 3,
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Debug",
|
||||
"makeArguments": []
|
||||
},
|
||||
{
|
||||
"name": "Release",
|
||||
"makeArguments": [
|
||||
"VCC_CONFIGURATION=Release"
|
||||
]
|
||||
}
|
||||
],
|
||||
"bundledLibraries": [
|
||||
{
|
||||
"library": "sdc",
|
||||
"linkVariable": "GUEST_LIBS"
|
||||
},
|
||||
{
|
||||
"library": "vcccompat",
|
||||
"linkVariable": "GUEST_LIBS"
|
||||
},
|
||||
{
|
||||
"library": "decbfile",
|
||||
"linkVariable": "GUEST_LIBS"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user