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,7 @@
|
||||
obj/
|
||||
generated/
|
||||
HELLO.bin
|
||||
HELLO.dsk
|
||||
HELLO.map
|
||||
HELLO.link
|
||||
.vccplus-build/
|
||||
@@ -0,0 +1,74 @@
|
||||
# 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
|
||||
CPPFLAGS += -Iinclude $(VCC_DEFINES)
|
||||
CFLAGS += --coco --intermediate --deps --stack-space=2048 $(OPTIM) $(DEBUG_FRAME) $(VCC_COMPILER_OPTIONS)
|
||||
LDFLAGS += --coco --intermediate --org=2800 $(VCC_LINKER_OPTIONS)
|
||||
LDLIBS += -ldecbfile
|
||||
OBJECTS := obj/main.o obj/src/display.o obj/src/disk.o obj/generated/word-count.o
|
||||
.PHONY: all build clean disk libraries
|
||||
all: build
|
||||
build: HELLO.bin
|
||||
HELLO.bin: $(OBJECTS) Makefile
|
||||
@mkdir -p $(dir $@)
|
||||
"$(CMOC)" $(LDFLAGS) -o $@ $(OBJECTS) $(LDLIBS)
|
||||
obj/main.o: main.c Makefile generated/word-count.c generated/WORDS.DAT
|
||||
@mkdir -p $(dir $@)
|
||||
"$(CMOC)" $(CPPFLAGS) $(CFLAGS) --intdir=$(dir $@) -c -o $@ $<
|
||||
|
||||
obj/src/display.o: src/display.c Makefile generated/word-count.c generated/WORDS.DAT
|
||||
@mkdir -p $(dir $@)
|
||||
"$(CMOC)" $(CPPFLAGS) $(CFLAGS) --intdir=$(dir $@) -c -o $@ $<
|
||||
|
||||
obj/src/disk.o: src/disk.c Makefile generated/word-count.c generated/WORDS.DAT
|
||||
@mkdir -p $(dir $@)
|
||||
"$(CMOC)" $(CPPFLAGS) $(CFLAGS) --intdir=$(dir $@) -c -o $@ $<
|
||||
|
||||
obj/generated/word-count.o: generated/word-count.c Makefile generated/word-count.c generated/WORDS.DAT
|
||||
@mkdir -p $(dir $@)
|
||||
"$(CMOC)" $(CPPFLAGS) $(CFLAGS) --intdir=$(dir $@) -c -o $@ $<
|
||||
|
||||
generated/word-count.c generated/WORDS.DAT &: tools/build-data.pl assets/words.txt Makefile
|
||||
@mkdir -p generated
|
||||
$(PERL) tools/build-data.pl assets/words.txt generated/word-count.c generated/WORDS.DAT
|
||||
test -f generated/word-count.c
|
||||
test -f generated/WORDS.DAT
|
||||
|
||||
# DOS helper: Pierre Sarrazin, autostart.c 0.1.2, public domain.
|
||||
obj/vcc-dos-boot/loader.bin: Makefile
|
||||
@mkdir -p $(dir $@)
|
||||
@printf '%s\n' '// autostart.c - Program to be run by the Disk Basic DOS command.' '// By Pierre Sarrazin <http://sarrazip.com/>' '// This file is in the public domain.' '//' '// Reference: Roger Schrag, "A Special Use For The DOS Command",' '// The Rainbow, November 1984, p.140.' '//' '// To compile: cmoc --dos autostart.c' '// To install on CoCo disk image: install-coco-boot-loader some-image.dsk autostart.bin' '// To run on CoCo: type DOS and <Enter> to automatically run *.BAS.' '//' '// Version history:' '// 0.1.0 2016-01-16 Use of legacy.h discontinued.' '// 0.1.1 2018-04-03 Adapted to CMOC 0.1.51 (const).' '// 0.1.2 2018-08-04 Basic line now forced to be uppercase.' '' '#include <coco.h>' '' '#define ENDFLG 0x00 // STOP/END FLAG: POSITIVE=STOP, NEG=END' '#define CINBFL 0x70 // CONSOLE IN BUFFER FLAG: 00=NOT EMPTY, $$FF=EMPTY' '#define RVEC4 0x016a // RAM hook: CONSOLE IN' '' '' 'byte oldHookInstr;' 'word oldHookAddr;' 'const char *basicLineReader;' '' '' 'void feedKeyboard()' '{' ' word preservedX;' ' asm("stx", preservedX);' '' ' * (byte *) CINBFL = 0; // console in buffer now not empty' '' ' char nextBasicByte = (char) toupper(*basicLineReader);' ' ++basicLineReader;' ' if (nextBasicByte == 0) // if finished returning Basic line' ' {' ' * (byte *) RVEC4 = oldHookInstr;' ' * (word *) (RVEC4 + 1) = oldHookAddr;' ' nextBasicByte = '"'"'\r'"'"'; // return "Enter" to cause execution of Basic line' ' }' '' ' asm {' ' lda nextBasicByte' ' ldx preservedX' ' tfr u,s // discard stack frame' ' leas 4,s // discard previous stack frame ptr and return addr' ' rts // return to caller of CONSOLE IN' ' }' '}' '' '' 'int main()' '{' ' * (byte *) ENDFLG = - * (byte *) ENDFLG; // why?' '' ' basicLineReader =' ' #ifndef COMMAND' ' "RUN\"*.BAS\""' ' #else' ' COMMAND' ' #endif' ' ;' '' ' // Install function feedKeyboard() as CONSOLE IN routine.' ' //' ' oldHookInstr = * (byte *) RVEC4;' ' oldHookAddr = * (word *) (RVEC4 + 1);' '' ' * (byte *) RVEC4 = 0x7e; // JMP instruction' ' * (void **) (RVEC4 + 1) = (void *) feedKeyboard;' '' ' * (word *) 0x2600 = 0; // overwrite "OS" marker with two null bytes' '' ' asm("jmp", "$$ac7c"); // go interpret a Basic line (which is read from console)' '' ' return 0; // avoids compiler error' '}' > obj/vcc-dos-boot/loader.c
|
||||
"$(CMOC)" --dos -O0 --limit=2800 -o $@ '-DCOMMAND="LOADM\"HELLO.BIN\":EXEC"' obj/vcc-dos-boot/loader.c
|
||||
|
||||
disk: HELLO.dsk
|
||||
HELLO.dsk: HELLO.bin generated/WORDS.DAT obj/vcc-dos-boot/loader.bin Makefile
|
||||
@mkdir -p $(dir $@)
|
||||
$(PERL) -e 'print chr(255) x (35*18*256)' > $@
|
||||
$(INSTALL_LOADER) $@ obj/vcc-dos-boot/loader.bin
|
||||
$(WRITECOCOFILE) $@ HELLO.bin
|
||||
$(WRITECOCOFILE) $@ generated/WORDS.DAT
|
||||
|
||||
clean:
|
||||
rm -rf obj
|
||||
rm -f HELLO.bin HELLO.map HELLO.link HELLO.dsk generated/word-count.c generated/WORDS.DAT
|
||||
|
||||
-include $(OBJECTS:.o=.d)
|
||||
@@ -0,0 +1,45 @@
|
||||
# Hello Disk — CMOC project example
|
||||
|
||||
An authored VCC Plus example under GPL-3.0-or-later, using the public-domain,
|
||||
ROM-backed decbfile library included in the development runtime. No game source,
|
||||
ROM, third-party standalone disk driver, generated executable, or disk image is
|
||||
included in this example.
|
||||
|
||||
1. In VCC Plus choose **Develop → C Development → New** and select **Hello Disk — multi-file disk example** (the default). Choose a new writable folder.
|
||||
2. Alternatively, copy this repository folder and **Open** it. Both approaches create your own editable source; the installed template stays unchanged.
|
||||
3. **Project Settings** shows the source files, include directory, disk library,
|
||||
generated resource recipe and disk launch command. Its Makefile is generated
|
||||
using the same settings available in that window.
|
||||
4. Boot the **Disk BASIC** machine profile. **Build** creates `HELLO.bin` and a
|
||||
`HELLO.dsk` containing the executable and `WORDS.DAT`, entirely in the isolated
|
||||
build workspace. It does not alter your source folder or mounted disks.
|
||||
5. Use the disk launch control to mount the development disk in FD0 and run the
|
||||
configured `DOS` command. You can also type `LOADM"HELLO":EXEC` at BASIC.
|
||||
Confirm the media replacement when
|
||||
prompted; retain any existing unsaved disk changes first.
|
||||
6. The program reads its words from the emulated floppy through the Disk BASIC
|
||||
ROM, prints them, then reports disk result `0` and generated word count `5`.
|
||||
|
||||
`main.c` calls functions in `src/display.c` and `src/disk.c`. Their shared header
|
||||
is `include/hello.h`. A short Perl build recipe turns `assets/words.txt` into a C
|
||||
translation unit and disk data together. Change the word list, build again and
|
||||
observe the regenerated outputs. Add a breakpoint on an executable C line to
|
||||
inspect the program using the existing debugger. Generated C can be inspected
|
||||
from the frozen build snapshot; the editable input is the word list and recipe.
|
||||
|
||||
**Project Settings → Disk & Run → DOS boot** defaults to **Run this program**
|
||||
for new Hello Disk copies. The build creates a small public-domain loader from
|
||||
Pierre Sarrazin’s `autostart.c` under `obj/vcc-dos-boot` and reserves track 34
|
||||
before adding files. It does not add a C source file to your editable project.
|
||||
Choose **None** to build a disk without DOS boot. Existing project copies are
|
||||
not changed automatically. Building or mounting alone does not run the program.
|
||||
|
||||
For command-line builds, put VCC Plus's `Contents/Resources/Toolchain/bin` on
|
||||
`PATH` and run its bundled `make disk`. `make VCC_CONFIGURATION=Release disk`
|
||||
uses the optimized configuration. Source changes are tracked through CMOC `.d`
|
||||
header dependencies. `make clean` removes generated objects, data and disks.
|
||||
Unlike the native app's isolated build, command-line Make writes these outputs
|
||||
in this folder.
|
||||
|
||||
This example needs a functioning CoCo/Disk BASIC ROM configuration and keeps
|
||||
those ROM services mapped. It is not a standalone-ROM-free disk implementation.
|
||||
@@ -0,0 +1,5 @@
|
||||
HELLO
|
||||
WORLD
|
||||
CMOC
|
||||
VCC
|
||||
PLUS
|
||||
@@ -0,0 +1,8 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
#ifndef HELLO_DISK_H
|
||||
#define HELLO_DISK_H
|
||||
#include <cmoc.h>
|
||||
extern const unsigned char generatedWordCount;
|
||||
void showHeading(void);
|
||||
unsigned char showDiskWords(void);
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
#include <cmoc.h>
|
||||
#include <coco.h>
|
||||
#include "hello.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
unsigned char status;
|
||||
initCoCoSupport();
|
||||
setHighSpeed(FALSE);
|
||||
showHeading();
|
||||
status = showDiskWords();
|
||||
printf("DISK RESULT: %u\n", status);
|
||||
printf("GENERATED WORD COUNT: %u\n", generatedWordCount);
|
||||
return status;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
#include <cmoc.h>
|
||||
#include <decbfile.h>
|
||||
#include "hello.h"
|
||||
|
||||
static DECBDrive drives[1];
|
||||
static DECBFile file;
|
||||
static byte words[256];
|
||||
|
||||
byte showDiskWords(void)
|
||||
{
|
||||
byte status = decb_init(drives, 1);
|
||||
if (status != DECB_OK)
|
||||
return status;
|
||||
status = decb_registerDrive(0);
|
||||
if (status == DECB_OK)
|
||||
status = decb_openSectorFile(&file, 0, "WORDS.DAT");
|
||||
if (status == DECB_OK)
|
||||
{
|
||||
status = decb_readSector(&file, words, 0);
|
||||
words[255] = 0;
|
||||
if (status == DECB_OK)
|
||||
printf("%s\n", words);
|
||||
decb_closeSectorFile(&file);
|
||||
}
|
||||
decb_shutdown();
|
||||
return status;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
#include <cmoc.h>
|
||||
#include "hello.h"
|
||||
void showHeading(void)
|
||||
{
|
||||
printf("HELLO FROM A MULTI-FILE PROJECT\n");
|
||||
printf("WORDS READ FROM THE FLOPPY:\n");
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env perl
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
use strict;
|
||||
use warnings;
|
||||
@ARGV == 3 or die "Usage: build-data.pl words.txt generated.c WORDS.DAT\n";
|
||||
my ($input, $source, $disk_data) = @ARGV;
|
||||
open my $in, '<', $input or die "$input: $!\n";
|
||||
my @words;
|
||||
while (<$in>) {
|
||||
s/\r?\n\z//;
|
||||
next if $_ eq '';
|
||||
/\A[A-Z]+\z/ or die "Words must contain uppercase A-Z only\n";
|
||||
push @words, $_;
|
||||
}
|
||||
close $in;
|
||||
@words <= 255 or die "Too many words\n";
|
||||
my $bytes = join("\r", @words) . "\r\0";
|
||||
length($bytes) <= 256 or die "Example data must fit one disk sector\n";
|
||||
open my $c, '>', $source or die "$source: $!\n";
|
||||
print {$c} "/* Generated from assets/words.txt. */\n#include <cmoc.h>\nconst unsigned char generatedWordCount = " . scalar(@words) . ";\n";
|
||||
close $c or die "$source: $!\n";
|
||||
open my $data, '>:raw', $disk_data or die "$disk_data: $!\n";
|
||||
print {$data} $bytes . ("\0" x (256 - length($bytes)));
|
||||
close $data or die "$disk_data: $!\n";
|
||||
@@ -0,0 +1,79 @@
|
||||
{
|
||||
"binary" : "HELLO.bin",
|
||||
"buildTarget" : "disk",
|
||||
"cleanTarget" : "clean",
|
||||
"configurations" : [
|
||||
{
|
||||
"makeArguments" : [
|
||||
|
||||
],
|
||||
"name" : "Debug"
|
||||
},
|
||||
{
|
||||
"makeArguments" : [
|
||||
"VCC_CONFIGURATION=Release"
|
||||
],
|
||||
"name" : "Release"
|
||||
}
|
||||
],
|
||||
"diskImage" : "HELLO.dsk",
|
||||
"diskTarget" : "disk",
|
||||
"entrySource" : "main.c",
|
||||
"jobs" : 4,
|
||||
"launchCommands" : [
|
||||
"DOS"
|
||||
],
|
||||
"launchMode" : "disk",
|
||||
"makefile" : "Makefile",
|
||||
"makefileSettings" : {
|
||||
"compilerOptions" : [
|
||||
|
||||
],
|
||||
"defines" : [
|
||||
|
||||
],
|
||||
"diskBootMode" : "program",
|
||||
"diskFiles" : [
|
||||
"generated/WORDS.DAT"
|
||||
],
|
||||
"diskImage" : "HELLO.dsk",
|
||||
"executable" : "HELLO.bin",
|
||||
"generatedResources" : [
|
||||
{
|
||||
"command" : "$(PERL) tools/build-data.pl assets/words.txt generated/word-count.c generated/WORDS.DAT",
|
||||
"inputs" : [
|
||||
"tools/build-data.pl",
|
||||
"assets/words.txt"
|
||||
],
|
||||
"outputs" : [
|
||||
"generated/word-count.c",
|
||||
"generated/WORDS.DAT"
|
||||
]
|
||||
}
|
||||
],
|
||||
"includePaths" : [
|
||||
"include"
|
||||
],
|
||||
"libraries" : [
|
||||
"decbfile"
|
||||
],
|
||||
"libraryPaths" : [
|
||||
|
||||
],
|
||||
"libraryProjects" : [
|
||||
|
||||
],
|
||||
"linkerOptions" : [
|
||||
|
||||
],
|
||||
"origin" : "2800",
|
||||
"releaseOptimization" : "-O2",
|
||||
"sources" : [
|
||||
"main.c",
|
||||
"src/display.c",
|
||||
"src/disk.c",
|
||||
"generated/word-count.c"
|
||||
],
|
||||
"stackSpace" : 2048
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user