From db42af3f20b49e5c63d66a6c8630e5bcc1f0b094 Mon Sep 17 00:00:00 2001 From: Silver Dream ! Date: Thu, 20 Mar 2014 00:07:59 +0100 Subject: [PATCH 01/32] - fixed an old #include guard typo --- src/cc65/shiftexpr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cc65/shiftexpr.h b/src/cc65/shiftexpr.h index 281710ff8..2a000fd58 100644 --- a/src/cc65/shiftexpr.h +++ b/src/cc65/shiftexpr.h @@ -34,7 +34,7 @@ #ifndef SHIFTEXPR_H -#define SHIFTEXPT_H +#define SHIFTEXPR_H From d72e62cae20954d0b7ce23bc8e908a61e4f2e634 Mon Sep 17 00:00:00 2001 From: Christian Groessler Date: Thu, 20 Mar 2014 02:01:21 +0100 Subject: [PATCH 02/32] Extend the map file to include a table of exports sorted by value. --- src/ld65/exports.c | 59 ++++++++++++++++++++++++++++++++++++++++++++-- src/ld65/exports.h | 7 ++++-- src/ld65/mapfile.c | 14 +++++++---- 3 files changed, 72 insertions(+), 8 deletions(-) diff --git a/src/ld65/exports.c b/src/ld65/exports.c index 9caa2ba57..937883d0d 100644 --- a/src/ld65/exports.c +++ b/src/ld65/exports.c @@ -870,8 +870,8 @@ static char GetAddrSizeCode (unsigned char AddrSize) -void PrintExportMap (FILE* F) -/* Print an export map to the given file */ +void PrintExportMapByName (FILE* F) +/* Print an export map, sorted by symbol name, to the given file */ { unsigned I; unsigned Count; @@ -902,6 +902,61 @@ void PrintExportMap (FILE* F) +static int CmpExpValue (const void* I1, const void* I2) +/* Compare function for qsort */ +{ + long V1 = GetExportVal (ExpPool [*(unsigned *)I1]); + long V2 = GetExportVal (ExpPool [*(unsigned *)I2]); + + return V1 < V2 ? -1 : V1 == V2 ? 0 : 1; +} + + + +void PrintExportMapByValue (FILE* F) +/* Print an export map, sorted by symbol value, to the given file */ +{ + unsigned I; + unsigned Count; + unsigned *ExpValXlat; + + /* Create a translation table where the symbols are sorted by value. */ + ExpValXlat = xmalloc (ExpCount * sizeof (unsigned)); + for (I = 0; I < ExpCount; ++I) { + /* Initialize table with current sort order. */ + ExpValXlat [I] = I; + } + + /* Sort them by value */ + qsort (ExpValXlat, ExpCount, sizeof (unsigned), CmpExpValue); + + /* Print all exports */ + Count = 0; + for (I = 0; I < ExpCount; ++I) { + const Export* E = ExpPool [ExpValXlat [I]]; + + /* Print unreferenced symbols only if explictly requested */ + if (VerboseMap || E->ImpCount > 0 || SYM_IS_CONDES (E->Type)) { + fprintf (F, + "%-25s %06lX %c%c%c%c ", + GetString (E->Name), + GetExportVal (E), + E->ImpCount? 'R' : ' ', + SYM_IS_LABEL (E->Type)? 'L' : 'E', + GetAddrSizeCode ((unsigned char) E->AddrSize), + SYM_IS_CONDES (E->Type)? 'I' : ' '); + if (++Count == 2) { + Count = 0; + fprintf (F, "\n"); + } + } + } + fprintf (F, "\n"); + xfree (ExpValXlat); +} + + + void PrintImportMap (FILE* F) /* Print an import map to the given file */ { diff --git a/src/ld65/exports.h b/src/ld65/exports.h index 2b7c55bed..2c0bbca95 100644 --- a/src/ld65/exports.h +++ b/src/ld65/exports.h @@ -186,8 +186,11 @@ void CheckUnresolvedImports (ExpCheckFunc F, void* Data); * called (see the comments on ExpCheckFunc in the data section). */ -void PrintExportMap (FILE* F); -/* Print an export map to the given file */ +void PrintExportMapByName (FILE* F); +/* Print an export map to the given file (sorted by symbol name) */ + +void PrintExportMapByValue (FILE* F); +/* Print an export map to the given file (sorted by export value) */ void PrintImportMap (FILE* F); /* Print an import map to the given file */ diff --git a/src/ld65/mapfile.c b/src/ld65/mapfile.c index 6b13e46ec..e1d0e8098 100644 --- a/src/ld65/mapfile.c +++ b/src/ld65/mapfile.c @@ -111,11 +111,17 @@ void CreateMapFile (int ShortMap) /* The remainder is not written for short map files */ if (!ShortMap) { - /* Write the exports list */ + /* Write the exports list by name */ fprintf (F, "\n\n" - "Exports list:\n" - "-------------\n"); - PrintExportMap (F); + "Exports list by name:\n" + "---------------------\n"); + PrintExportMapByName (F); + + /* Write the exports list by value */ + fprintf (F, "\n\n" + "Exports list by value\n" + "---------------------\n"); + PrintExportMapByValue (F); /* Write the imports list */ fprintf (F, "\n\n" From bdc60b21d471bfad7c8d63ca4fed5574b6488f4d Mon Sep 17 00:00:00 2001 From: Christian Groessler Date: Thu, 20 Mar 2014 02:22:43 +0100 Subject: [PATCH 03/32] add a missing ":" --- src/ld65/mapfile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ld65/mapfile.c b/src/ld65/mapfile.c index e1d0e8098..8ca1a388f 100644 --- a/src/ld65/mapfile.c +++ b/src/ld65/mapfile.c @@ -119,8 +119,8 @@ void CreateMapFile (int ShortMap) /* Write the exports list by value */ fprintf (F, "\n\n" - "Exports list by value\n" - "---------------------\n"); + "Exports list by value:\n" + "----------------------\n"); PrintExportMapByValue (F); /* Write the imports list */ From 508e2ba9c8bc87b99f7524e054bc334b4a477939 Mon Sep 17 00:00:00 2001 From: Christian Groessler Date: Sat, 22 Mar 2014 10:40:50 +0100 Subject: [PATCH 04/32] Add information about which drivers are the default drivers. --- doc/atari.sgml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/atari.sgml b/doc/atari.sgml index 51e24a239..0bdeac364 100644 --- a/doc/atari.sgml +++ b/doc/atari.sgml @@ -412,6 +412,8 @@ The values of "1" are needed because the graphics command crashes if it doesn't have at least one byte available. This seems to be a bug of the Atari ROM code. +Default drivers: Extended memory drivers

Currently there is only one extended memory driver. It manages the second 64K of a 130XE. @@ -436,6 +438,7 @@ Currently there are two joystick drivers available: +Default drivers: Mouse drivers

@@ -455,6 +458,7 @@ Currently there are five mouse drivers available: All mouse devices connect to joystick port #0. +Default drivers: RS232 device drivers

From d97a46c3974b5e21d17fce2f7621a454b6631eb2 Mon Sep 17 00:00:00 2001 From: Christian Groessler Date: Sat, 22 Mar 2014 12:04:16 +0100 Subject: [PATCH 05/32] Simplify to use less 'if's. Add missing link options for Atari TGI programs. Put '--start-addr' at beginning of ld65 command line. --- samples/Makefile | 80 +++++++++++++----------------------------------- 1 file changed, 22 insertions(+), 58 deletions(-) diff --git a/samples/Makefile b/samples/Makefile index a17288ced..5f3b8687e 100644 --- a/samples/Makefile +++ b/samples/Makefile @@ -43,6 +43,25 @@ endif # This one comes with VICE C1541 = c1541 +# -------------------------------------------------------------------------- +# System dependent settings + +# The Apple machines need the start address adjusted when using TGI +LDFLAGS_mandelbrot_apple2 = --start-addr 0x4000 +LDFLAGS_tgidemo_apple2 = --start-addr 0x4000 +LDFLAGS_mandelbrot_apple2enh = --start-addr 0x4000 +LDFLAGS_tgidemo_apple2enh = --start-addr 0x4000 + +# The Apple ][ needs the start address adjusted for the mousetest +LDFLAGS_mousetest_apple2 = --start-addr 0x4000 + +# The atarixl target needs the start address adjusted when using TGI +LDFLAGS_mandelbrot_atarixl = --start-addr 0x4000 +LDFLAGS_tgidemo_atarixl = --start-addr 0x4000 + +# The atari target needs to reserve some memory when using TGI +LDFLAGS_mandelbrot_atari = -D __RESERVED_MEMORY__=0x2000 +LDFLAGS_tgidemo_atari = -D __RESERVED_MEMORY__=0x2000 # -------------------------------------------------------------------------- # Generic rules @@ -59,9 +78,10 @@ C1541 = c1541 @echo $< @$(AS) $(AFLAGS) -t $(SYS) $< -.o: - @$(LD) -o $@ -t $(SYS) -m $@.map $^ $(CLIB) +.PRECIOUS: %.o +.o: + $(LD) $(LDFLAGS_$(basename $@)_$(SYS)) -o $@ -t $(SYS) -m $@.map $^ $(CLIB) # -------------------------------------------------------------------------- # List of executables. This list could be made target dependent by checking @@ -88,62 +108,6 @@ EXELIST = ascii \ .PHONY: all all: $(EXELIST) -ascii: ascii.o - -diodemo: diodemo.o - -fire: fire.o - -gunzip65: gunzip65.o - -hello: hello.o - -# The Apple machines need the start address adjusted for the mandelbrot demo -ifeq "$(SYS)" "apple2" -mandelbrot: mandelbrot.o - @$(LD) -o $@ -t $(SYS) -m $@.map --start-addr 0x4000 $^ $(CLIB) -else -ifeq "$(SYS)" "apple2enh" -mandelbrot: mandelbrot.o - @$(LD) -o $@ -t $(SYS) -m $@.map --start-addr 0x4000 $^ $(CLIB) -else -mandelbrot: mandelbrot.o -endif -endif - -# The Apple ][ needs the start address adjusted for the mousetest -ifeq "$(SYS)" "apple2" -mousetest: mousetest.o - @$(LD) -o $@ -t $(SYS) -m $@.map --start-addr 0x4000 $^ $(CLIB) -else -mousetest: mousetest.o -endif - -multdemo: multidemo.o - @$(LD) -o $@ -m $@.map -C $(SYS)-overlay.cfg $^ $(CLIB) - -nachtm: nachtm.o - -ovrldemo: overlaydemo.o - @$(LD) -o $@ -m $@.map -C $(SYS)-overlay.cfg $^ $(CLIB) - -plasma: plasma.o - -sieve: sieve.o - -# The Apple machines need the start address adjusted for the tgidemo -ifeq "$(SYS)" "apple2" -tgidemo: tgidemo.o - @$(LD) -o $@ -t $(SYS) -m $@.map --start-addr 0x4000 $^ $(CLIB) -else -ifeq "$(SYS)" "apple2enh" -tgidemo: tgidemo.o - @$(LD) -o $@ -t $(SYS) -m $@.map --start-addr 0x4000 $^ $(CLIB) -else -tgidemo: tgidemo.o -endif -endif - # -------------------------------------------------------------------------- # Rule to make a disk with all samples. Needs the c1541 program that comes # with the VICE emulator. From 329aaea549783dffe0358cc198da08b08e1dde38 Mon Sep 17 00:00:00 2001 From: Christian Groessler Date: Mon, 24 Mar 2014 12:23:24 +0100 Subject: [PATCH 06/32] make ld65 invocation silent again --- samples/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/Makefile b/samples/Makefile index 5f3b8687e..79988ea70 100644 --- a/samples/Makefile +++ b/samples/Makefile @@ -81,7 +81,7 @@ LDFLAGS_tgidemo_atari = -D __RESERVED_MEMORY__=0x2000 .PRECIOUS: %.o .o: - $(LD) $(LDFLAGS_$(basename $@)_$(SYS)) -o $@ -t $(SYS) -m $@.map $^ $(CLIB) + @$(LD) $(LDFLAGS_$(basename $@)_$(SYS)) -o $@ -t $(SYS) -m $@.map $^ $(CLIB) # -------------------------------------------------------------------------- # List of executables. This list could be made target dependent by checking From 2a9cdf915222a7a4b370f016da59841cdcd184bd Mon Sep 17 00:00:00 2001 From: Christian Groessler Date: Mon, 24 Mar 2014 13:57:45 +0100 Subject: [PATCH 07/32] Make ld65 command line arguments position independent. --- src/ld65/main.c | 128 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 106 insertions(+), 22 deletions(-) diff --git a/src/ld65/main.c b/src/ld65/main.c index b47831c39..f0b544b94 100644 --- a/src/ld65/main.c +++ b/src/ld65/main.c @@ -520,9 +520,21 @@ static void OptVersion (const char* Opt attribute ((unused)), -int main (int argc, char* argv []) -/* Assembler main program */ +static void ParseCommandLine(void) { +/* struct InputFile.Flag definitions */ +#define INPUT_FILES_FILE 0 /* Entry is a file */ +#define INPUT_FILES_SGROUP 1 /* Entry is 'StartGroup' */ +#define INPUT_FILES_EGROUP 2 /* Entry is 'EndGroup' */ + +#define MAX_INPUTFILES 256 + + struct InputFile { + const char *FileName; + unsigned Flag; + } *InputFiles; + unsigned InputFilesCount = 0; + /* Program long options */ static const LongOpt OptTab[] = { { "--cfg-path", 1, OptCfgPath }, @@ -545,21 +557,14 @@ int main (int argc, char* argv []) }; unsigned I; - unsigned MemoryAreaOverflows; + unsigned OutNameGiven = 0, CfgFileGiven = 0, TargetGiven = 0, StartAddressGiven = 0, + MapFileGiven = 0; + const char *CfgFile = NULL, *Target = NULL; - /* Initialize the cmdline module */ - InitCmdLine (&argc, &argv, "ld65"); + /* Allocate memory for input file array */ + InputFiles = xmalloc (MAX_INPUTFILES * sizeof (struct InputFile)); - /* Initialize the input file search paths */ - InitSearchPaths (); - - /* Initialize the string pool */ - InitStrPool (); - - /* Initialize the type pool */ - InitTypePool (); - - /* Check the parameters */ + /* Defer setting of config/target and input files until all options are parsed */ I = 1; while (I < ArgCount) { @@ -577,11 +582,17 @@ int main (int argc, char* argv []) break; case '(': - OptStartGroup (Arg, 0); + InputFiles[InputFilesCount].Flag = INPUT_FILES_SGROUP; + InputFiles[InputFilesCount].FileName = Arg; /* Unused */ + if (++InputFilesCount >= MAX_INPUTFILES) + Error ("Too many input files"); break; case ')': - OptEndGroup (Arg, 0); + InputFiles[InputFilesCount].Flag = INPUT_FILES_EGROUP; + InputFiles[InputFilesCount].FileName = Arg; /* Unused */ + if (++InputFilesCount >= MAX_INPUTFILES) + Error ("Too many input files"); break; case 'h': @@ -590,18 +601,27 @@ int main (int argc, char* argv []) break; case 'm': + if (MapFileGiven) { + Error ("Cannot use -m twice"); + } + MapFileGiven = 1; OptMapFile (Arg, GetArg (&I, 2)); break; case 'o': - OptOutputName (Arg, GetArg (&I, 2)); + if (OutNameGiven) { + Error ("Cannot use -o twice"); + } + OutNameGiven = 1; + OptOutputName (NULL, GetArg (&I, 2)); break; case 't': - if (CfgAvail ()) { + if (TargetGiven || CfgFileGiven) { Error ("Cannot use -C/-t twice"); } - OptTarget (Arg, GetArg (&I, 2)); + TargetGiven = 1; + Target = GetArg (&I, 2); break; case 'u': @@ -617,7 +637,11 @@ int main (int argc, char* argv []) break; case 'C': - OptConfig (Arg, GetArg (&I, 2)); + if (TargetGiven || CfgFileGiven) { + Error ("Cannot use -C/-t twice"); + } + CfgFileGiven = 1; + CfgFile = GetArg (&I, 2); break; case 'D': @@ -633,6 +657,10 @@ int main (int argc, char* argv []) break; case 'S': + if (StartAddressGiven) { + Error ("Cannot use -S twice"); + } + StartAddressGiven = 1; OptStartAddr (Arg, GetArg (&I, 2)); break; @@ -648,7 +676,10 @@ int main (int argc, char* argv []) } else { /* A filename */ - LinkFile (Arg, FILETYPE_UNKNOWN); + InputFiles[InputFilesCount].Flag = INPUT_FILES_FILE; + InputFiles[InputFilesCount].FileName = Arg; + if (++InputFilesCount >= MAX_INPUTFILES) + Error ("Too many input files"); } @@ -656,6 +687,59 @@ int main (int argc, char* argv []) ++I; } + if (OutNameGiven == 0) { + Error ("No output file specified"); + } + + if (TargetGiven) { + OptTarget (NULL, Target); + } else if (CfgFileGiven) { + OptConfig (NULL, CfgFile); + } + + /* Process input files */ + for (I = 0; I < InputFilesCount; ++I) { + switch (InputFiles[I].Flag) { + case INPUT_FILES_FILE: + LinkFile (InputFiles[I].FileName, FILETYPE_UNKNOWN); + break; + case INPUT_FILES_SGROUP: + OptStartGroup (NULL, 0); + break; + case INPUT_FILES_EGROUP: + OptEndGroup (NULL, 0); + break; + default: + abort (); + } + } + + /* Free memory used for input file array */ + xfree (InputFiles); +} + + + +int main (int argc, char* argv []) +/* Linker main program */ +{ + unsigned MemoryAreaOverflows; + + /* Initialize the cmdline module */ + InitCmdLine (&argc, &argv, "ld65"); + + /* Initialize the input file search paths */ + InitSearchPaths (); + + /* Initialize the string pool */ + InitStrPool (); + + /* Initialize the type pool */ + InitTypePool (); + + /* Parse the command line */ + ParseCommandLine (); + /* Check if we had any object files */ if (ObjFiles == 0) { Error ("No object files to link"); From eaf4c8ce6bbb7df451a2955b24bb63c164bd2eeb Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Mon, 24 Mar 2014 15:25:12 +0200 Subject: [PATCH 08/32] Added info directory. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 3e65003e4..1d5928af7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ /bin/ /emd/ /html/ +/info/ /joy/ /lib/ /libwrk/ From 18c228978463abad9f80ba3ca7095bb59c850ce1 Mon Sep 17 00:00:00 2001 From: Christian Groessler Date: Tue, 25 Mar 2014 15:36:38 +0100 Subject: [PATCH 09/32] Make ld65 -L command line option position dependent again. --- src/ld65/main.c | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/src/ld65/main.c b/src/ld65/main.c index f0b544b94..ec054d28b 100644 --- a/src/ld65/main.c +++ b/src/ld65/main.c @@ -522,18 +522,19 @@ static void OptVersion (const char* Opt attribute ((unused)), static void ParseCommandLine(void) { -/* struct InputFile.Flag definitions */ +/* struct InputFile.Type definitions */ #define INPUT_FILES_FILE 0 /* Entry is a file */ #define INPUT_FILES_SGROUP 1 /* Entry is 'StartGroup' */ #define INPUT_FILES_EGROUP 2 /* Entry is 'EndGroup' */ +#define INPUT_FILES_LIBPATH 3 /* Entry is a library search path */ #define MAX_INPUTFILES 256 struct InputFile { const char *FileName; - unsigned Flag; - } *InputFiles; - unsigned InputFilesCount = 0; + unsigned Type; + } *InputFiles; + unsigned InputFilesCount = 0; /* Program long options */ static const LongOpt OptTab[] = { @@ -558,7 +559,7 @@ static void ParseCommandLine(void) unsigned I; unsigned OutNameGiven = 0, CfgFileGiven = 0, TargetGiven = 0, StartAddressGiven = 0, - MapFileGiven = 0; + MapFileGiven = 0, LabelFileGiven = 0; const char *CfgFile = NULL, *Target = NULL; /* Allocate memory for input file array */ @@ -582,14 +583,14 @@ static void ParseCommandLine(void) break; case '(': - InputFiles[InputFilesCount].Flag = INPUT_FILES_SGROUP; + InputFiles[InputFilesCount].Type = INPUT_FILES_SGROUP; InputFiles[InputFilesCount].FileName = Arg; /* Unused */ if (++InputFilesCount >= MAX_INPUTFILES) Error ("Too many input files"); break; case ')': - InputFiles[InputFilesCount].Flag = INPUT_FILES_EGROUP; + InputFiles[InputFilesCount].Type = INPUT_FILES_EGROUP; InputFiles[InputFilesCount].FileName = Arg; /* Unused */ if (++InputFilesCount >= MAX_INPUTFILES) Error ("Too many input files"); @@ -650,9 +651,20 @@ static void ParseCommandLine(void) case 'L': switch (Arg [2]) { - /* ## The first one is obsolete and will go */ - case 'n': LabelFileName = GetArg (&I, 3); break; - default: OptLibPath (Arg, GetArg (&I, 2)); break; + case 'n': + /* ## This one is obsolete and will go */ + if (LabelFileGiven) { + Error ("Cannot use -Ln twice"); + } + LabelFileGiven = 1; + LabelFileName = GetArg (&I, 3); + break; + default: + InputFiles[InputFilesCount].Type = INPUT_FILES_LIBPATH; + InputFiles[InputFilesCount].FileName = GetArg (&I, 2); + if (++InputFilesCount >= MAX_INPUTFILES) + Error ("Too many input files"); + break; } break; @@ -676,7 +688,7 @@ static void ParseCommandLine(void) } else { /* A filename */ - InputFiles[InputFilesCount].Flag = INPUT_FILES_FILE; + InputFiles[InputFilesCount].Type = INPUT_FILES_FILE; InputFiles[InputFilesCount].FileName = Arg; if (++InputFilesCount >= MAX_INPUTFILES) Error ("Too many input files"); @@ -699,7 +711,7 @@ static void ParseCommandLine(void) /* Process input files */ for (I = 0; I < InputFilesCount; ++I) { - switch (InputFiles[I].Flag) { + switch (InputFiles[I].Type) { case INPUT_FILES_FILE: LinkFile (InputFiles[I].FileName, FILETYPE_UNKNOWN); break; @@ -709,6 +721,9 @@ static void ParseCommandLine(void) case INPUT_FILES_EGROUP: OptEndGroup (NULL, 0); break; + case INPUT_FILES_LIBPATH: + OptLibPath (NULL, InputFiles[I].FileName); + break; default: abort (); } From c6ee9ac0340f25d92a3c22459dedf9f3186a2591 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Thu, 27 Mar 2014 19:28:31 +0100 Subject: [PATCH 10/32] Classified tgi_imulround() as part of TGI API. --- include/tgi.h | 5 +++++ include/tgi/tgi-kernel.h | 13 ------------- samples/tgidemo.c | 1 - 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/include/tgi.h b/include/tgi.h index a43eb0cc3..51d0eaebc 100644 --- a/include/tgi.h +++ b/include/tgi.h @@ -275,6 +275,11 @@ unsigned __fastcall__ tgi_ioctl (unsigned char code, void* data); * for unknown codes or values. */ +int __fastcall__ tgi_imulround (int rhs, int lhs); +/* Helper function for functions using sine/cosine: Multiply two values, one + * being an 8.8 fixed point one, and return the rounded and scaled result. + */ + /* End of tgi.h */ diff --git a/include/tgi/tgi-kernel.h b/include/tgi/tgi-kernel.h index 8367e4453..bc5fdc3c6 100644 --- a/include/tgi/tgi-kernel.h +++ b/include/tgi/tgi-kernel.h @@ -67,19 +67,6 @@ extern unsigned tgi_charheight; /* Height of scaled bitmap font */ -/*****************************************************************************/ -/* Code */ -/*****************************************************************************/ - - - -int __fastcall__ tgi_imulround (int rhs, int lhs); -/* Helper function for functions using sine/cosine: Multiply two values, one - * being an 8.8 fixed point one, and return the rounded and scaled result. - */ - - - /* End of tgi-kernel.h */ #endif diff --git a/samples/tgidemo.c b/samples/tgidemo.c index a7e3b10f6..a08020640 100644 --- a/samples/tgidemo.c +++ b/samples/tgidemo.c @@ -5,7 +5,6 @@ #include #include #include -#include From 986c2248e29c264857385eaecc2577909284b0d0 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Thu, 27 Mar 2014 21:22:02 +0100 Subject: [PATCH 11/32] Added cc65_umul8x8r16() based on umul8x8r16. --- libsrc/common/cc65_umul8x8r16.s | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 libsrc/common/cc65_umul8x8r16.s diff --git a/libsrc/common/cc65_umul8x8r16.s b/libsrc/common/cc65_umul8x8r16.s new file mode 100644 index 000000000..5cbb4f8b0 --- /dev/null +++ b/libsrc/common/cc65_umul8x8r16.s @@ -0,0 +1,23 @@ +; +; Oliver Schmidt, 2014-03-27 +; +; CC65 library: 8x8 => 16 unsigned multiplication +; + + .export _cc65_umul8x8r16 + .import umul8x8r16, popa + + .include "zeropage.inc" + + +;--------------------------------------------------------------------------- +; 8x8 => 16 unsigned multiplication routine. + + +.proc _cc65_umul8x8r16 + + sta ptr1 + jsr popa + jmp umul8x8r16 + +.endproc From c9438ae1a74c7564f98b5c995ccc1a8f212053fd Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Thu, 27 Mar 2014 21:40:28 +0100 Subject: [PATCH 12/32] Finetuned Git commit hash retrieval. - Force usage of shell wrapper in order to allow to suppress potential message about git not found (thanks to Greg King). - Do $(info GIT_SHA ...) only if there's something special - as done with the other $(info ...). --- src/Makefile | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/Makefile b/src/Makefile index 2c2267ae7..cf25e198b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -27,6 +27,17 @@ LD65_LIB = $(datadir)/lib LD65_OBJ = $(datadir)/lib LD65_CFG = $(datadir)/cfg +ifdef CMD_EXE + NULLDEV = nul: + DIRLIST = $(strip $(foreach dir,$1,$(wildcard $(dir)))) + MKDIR = mkdir $(subst /,\,$1) + RMDIR = $(if $(DIRLIST),rmdir /s /q $(subst /,\,$(DIRLIST))) +else + NULLDEV = /dev/nul + MKDIR = mkdir -p $1 + RMDIR = $(RM) -r $1 +endif + CC = $(CROSS_COMPILE)gcc AR = $(CROSS_COMPILE)ar @@ -39,13 +50,15 @@ ifdef USER_CFLAGS $(info USER_CFLAGS: $(USER_CFLAGS)) endif -ifndef GIT_SHA - GIT_SHA := $(if $(wildcard ../.git),$(shell git rev-parse --short HEAD)) +ifdef GIT_SHA + $(info GIT_SHA: $(GIT_SHA)) +else + GIT_SHA := $(shell git rev-parse --short HEAD 2>$(NULLDEV)) ifneq ($(words $(GIT_SHA)),1) GIT_SHA := N/A + $(info GIT_SHA: N/A) endif endif -$(info GIT_SHA: $(GIT_SHA)) CFLAGS += -MMD -MP -O -I common \ -Wall -Wextra -Wno-char-subscripts $(USER_CFLAGS) \ @@ -62,15 +75,6 @@ ifdef CROSS_COMPILE EXE_SUFFIX=.exe endif -ifdef CMD_EXE - DIRLIST = $(strip $(foreach dir,$1,$(wildcard $(dir)))) - MKDIR = mkdir $(subst /,\,$1) - RMDIR = $(if $(DIRLIST),rmdir /s /q $(subst /,\,$(DIRLIST))) -else - MKDIR = mkdir -p $1 - RMDIR = $(RM) -r $1 -endif - all bin: $(PROGS) mostlyclean: From 276a836d7dfc65fa62f3442920b42a60a0344756 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Thu, 27 Mar 2014 22:07:08 +0100 Subject: [PATCH 13/32] Fixed typo. --- src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index cf25e198b..5aafc4bb8 100644 --- a/src/Makefile +++ b/src/Makefile @@ -33,7 +33,7 @@ ifdef CMD_EXE MKDIR = mkdir $(subst /,\,$1) RMDIR = $(if $(DIRLIST),rmdir /s /q $(subst /,\,$(DIRLIST))) else - NULLDEV = /dev/nul + NULLDEV = /dev/null MKDIR = mkdir -p $1 RMDIR = $(RM) -r $1 endif From bdfefb5b5f47e93a3081c1e0ecf25d0fe8dfc031 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Thu, 27 Mar 2014 22:53:06 +0100 Subject: [PATCH 14/32] Added explicit wiki link. --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 33101548b..39e4ef54c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ [documentation](http://cc65.github.io/cc65/doc) +[wiki](https://github.com/cc65/wiki/wiki) + [![build status](https://travis-ci.org/cc65/cc65.png)](https://travis-ci.org/cc65/cc65/builds) cc65 is a complete cross development package for 65(C)02 systems, including From 5114a3b8615ed2ff86e9d33467346a6b6e80a560 Mon Sep 17 00:00:00 2001 From: Christian Groessler Date: Thu, 27 Mar 2014 23:47:59 +0100 Subject: [PATCH 15/32] Make ld65 -L command line option position independent again. Handle long versions of command line arguments correctly. --- src/ld65/main.c | 178 ++++++++++++++++++++++++++++-------------------- 1 file changed, 103 insertions(+), 75 deletions(-) diff --git a/src/ld65/main.c b/src/ld65/main.c index ec054d28b..eb9cc5af1 100644 --- a/src/ld65/main.c +++ b/src/ld65/main.c @@ -80,6 +80,24 @@ static unsigned ObjFiles = 0; /* Count of object files linked */ static unsigned LibFiles = 0; /* Count of library files linked */ +/* struct InputFile.Type definitions */ +#define INPUT_FILES_FILE 0 /* Entry is a file (unknown type) */ +#define INPUT_FILES_FILE_OBJ 1 /* Entry is a object file */ +#define INPUT_FILES_FILE_LIB 2 /* Entry is a library file */ +#define INPUT_FILES_SGROUP 3 /* Entry is 'StartGroup' */ +#define INPUT_FILES_EGROUP 4 /* Entry is 'EndGroup' */ + +#define MAX_INPUTFILES 256 + +/* Array of inputs (libraries and object files) */ +static struct InputFile { + const char *FileName; + unsigned Type; +} *InputFiles; +static unsigned InputFilesCount = 0; +static const char *CmdlineCfgFile = NULL, + *CmdlineTarget = NULL; + /*****************************************************************************/ @@ -390,7 +408,10 @@ static void OptHelp (const char* Opt attribute ((unused)), static void OptLib (const char* Opt attribute ((unused)), const char* Arg) /* Link a library */ { - LinkFile (Arg, FILETYPE_LIB); + InputFiles[InputFilesCount].Type = INPUT_FILES_FILE_LIB; + InputFiles[InputFilesCount].FileName = Arg; + if (++InputFilesCount >= MAX_INPUTFILES) + Error ("Too many input files"); } @@ -406,6 +427,9 @@ static void OptLibPath (const char* Opt attribute ((unused)), const char* Arg) static void OptMapFile (const char* Opt attribute ((unused)), const char* Arg) /* Give the name of the map file */ { + if (MapFileName) { + Error ("Cannot use -m twice"); + } MapFileName = Arg; } @@ -426,7 +450,10 @@ static void OptModuleId (const char* Opt, const char* Arg) static void OptObj (const char* Opt attribute ((unused)), const char* Arg) /* Link an object file */ { - LinkFile (Arg, FILETYPE_OBJ); + InputFiles[InputFilesCount].Type = INPUT_FILES_FILE_OBJ; + InputFiles[InputFilesCount].FileName = Arg; + if (++InputFilesCount >= MAX_INPUTFILES) + Error ("Too many input files"); } @@ -439,16 +466,14 @@ static void OptObjPath (const char* Opt attribute ((unused)), const char* Arg) -static void OptOutputName (const char* Opt, const char* Arg) +static void OptOutputName (const char* Opt attribute ((unused)), const char* Arg) /* Give the name of the output file */ { - /* If the name of the output file has been used in the config before - * (by using %O) we're actually changing it later, which - in most cases - - * gives unexpected results, so emit a warning in this case. - */ - if (OutputNameUsed) { - Warning ("Option `%s' should precede options `-t' or `-C'", Opt); + static int OutputNameSeen = 0; + if (OutputNameSeen) { + Error ("Cannot use -o twice"); } + OutputNameSeen = 1; OutputName = Arg; } @@ -457,6 +482,9 @@ static void OptOutputName (const char* Opt, const char* Arg) static void OptStartAddr (const char* Opt, const char* Arg) /* Set the default start address */ { + if (HaveStartAddr) { + Error ("Cannot use -S twice"); + } StartAddr = CvtNumber (Opt, Arg); HaveStartAddr = 1; } @@ -520,29 +548,61 @@ static void OptVersion (const char* Opt attribute ((unused)), +static void CmdlOptStartGroup (const char* Opt attribute ((unused)), + const char* Arg attribute ((unused))) +/* Remember 'start group' occurrence in input files array */ +{ + InputFiles[InputFilesCount].Type = INPUT_FILES_SGROUP; + InputFiles[InputFilesCount].FileName = Arg; /* Unused */ + if (++InputFilesCount >= MAX_INPUTFILES) + Error ("Too many input files"); +} + + + +static void CmdlOptEndGroup (const char* Opt attribute ((unused)), + const char* Arg attribute ((unused))) +/* Remember 'end group' occurrence in input files array */ +{ + InputFiles[InputFilesCount].Type = INPUT_FILES_EGROUP; + InputFiles[InputFilesCount].FileName = Arg; /* Unused */ + if (++InputFilesCount >= MAX_INPUTFILES) + Error ("Too many input files"); +} + + + +static void CmdlOptConfig (const char* Opt attribute ((unused)), const char* Arg) +/* Set 'config file' command line parameter */ +{ + if (CmdlineCfgFile || CmdlineTarget) { + Error ("Cannot use -C/-t twice"); + } + CmdlineCfgFile = Arg; +} + + + +static void CmdlOptTarget (const char* Opt attribute ((unused)), const char* Arg) +/* Set 'target' command line parameter */ +{ + if (CmdlineCfgFile || CmdlineTarget) { + Error ("Cannot use -C/-t twice"); + } + CmdlineTarget = Arg; +} + + + static void ParseCommandLine(void) { -/* struct InputFile.Type definitions */ -#define INPUT_FILES_FILE 0 /* Entry is a file */ -#define INPUT_FILES_SGROUP 1 /* Entry is 'StartGroup' */ -#define INPUT_FILES_EGROUP 2 /* Entry is 'EndGroup' */ -#define INPUT_FILES_LIBPATH 3 /* Entry is a library search path */ - -#define MAX_INPUTFILES 256 - - struct InputFile { - const char *FileName; - unsigned Type; - } *InputFiles; - unsigned InputFilesCount = 0; - /* Program long options */ static const LongOpt OptTab[] = { { "--cfg-path", 1, OptCfgPath }, - { "--config", 1, OptConfig }, + { "--config", 1, CmdlOptConfig }, { "--dbgfile", 1, OptDbgFile }, { "--define", 1, OptDefine }, - { "--end-group", 0, OptEndGroup }, + { "--end-group", 0, CmdlOptEndGroup }, { "--force-import", 1, OptForceImport }, { "--help", 0, OptHelp }, { "--lib", 1, OptLib }, @@ -552,15 +612,13 @@ static void ParseCommandLine(void) { "--obj", 1, OptObj }, { "--obj-path", 1, OptObjPath }, { "--start-addr", 1, OptStartAddr }, - { "--start-group", 0, OptStartGroup }, - { "--target", 1, OptTarget }, + { "--start-group", 0, CmdlOptStartGroup }, + { "--target", 1, CmdlOptTarget }, { "--version", 0, OptVersion }, }; unsigned I; - unsigned OutNameGiven = 0, CfgFileGiven = 0, TargetGiven = 0, StartAddressGiven = 0, - MapFileGiven = 0, LabelFileGiven = 0; - const char *CfgFile = NULL, *Target = NULL; + unsigned LabelFileGiven = 0; /* Allocate memory for input file array */ InputFiles = xmalloc (MAX_INPUTFILES * sizeof (struct InputFile)); @@ -583,17 +641,11 @@ static void ParseCommandLine(void) break; case '(': - InputFiles[InputFilesCount].Type = INPUT_FILES_SGROUP; - InputFiles[InputFilesCount].FileName = Arg; /* Unused */ - if (++InputFilesCount >= MAX_INPUTFILES) - Error ("Too many input files"); + CmdlOptStartGroup (Arg, 0); break; case ')': - InputFiles[InputFilesCount].Type = INPUT_FILES_EGROUP; - InputFiles[InputFilesCount].FileName = Arg; /* Unused */ - if (++InputFilesCount >= MAX_INPUTFILES) - Error ("Too many input files"); + CmdlOptEndGroup (Arg, 0); break; case 'h': @@ -602,27 +654,15 @@ static void ParseCommandLine(void) break; case 'm': - if (MapFileGiven) { - Error ("Cannot use -m twice"); - } - MapFileGiven = 1; OptMapFile (Arg, GetArg (&I, 2)); break; case 'o': - if (OutNameGiven) { - Error ("Cannot use -o twice"); - } - OutNameGiven = 1; OptOutputName (NULL, GetArg (&I, 2)); break; case 't': - if (TargetGiven || CfgFileGiven) { - Error ("Cannot use -C/-t twice"); - } - TargetGiven = 1; - Target = GetArg (&I, 2); + CmdlOptTarget (Arg, GetArg (&I, 2)); break; case 'u': @@ -638,11 +678,7 @@ static void ParseCommandLine(void) break; case 'C': - if (TargetGiven || CfgFileGiven) { - Error ("Cannot use -C/-t twice"); - } - CfgFileGiven = 1; - CfgFile = GetArg (&I, 2); + CmdlOptConfig (Arg, GetArg (&I, 2)); break; case 'D': @@ -660,19 +696,12 @@ static void ParseCommandLine(void) LabelFileName = GetArg (&I, 3); break; default: - InputFiles[InputFilesCount].Type = INPUT_FILES_LIBPATH; - InputFiles[InputFilesCount].FileName = GetArg (&I, 2); - if (++InputFilesCount >= MAX_INPUTFILES) - Error ("Too many input files"); + OptLibPath (Arg, InputFiles[I].FileName); break; } break; case 'S': - if (StartAddressGiven) { - Error ("Cannot use -S twice"); - } - StartAddressGiven = 1; OptStartAddr (Arg, GetArg (&I, 2)); break; @@ -699,14 +728,10 @@ static void ParseCommandLine(void) ++I; } - if (OutNameGiven == 0) { - Error ("No output file specified"); - } - - if (TargetGiven) { - OptTarget (NULL, Target); - } else if (CfgFileGiven) { - OptConfig (NULL, CfgFile); + if (CmdlineTarget) { + OptTarget (NULL, CmdlineTarget); + } else if (CmdlineCfgFile) { + OptConfig (NULL, CmdlineCfgFile); } /* Process input files */ @@ -715,15 +740,18 @@ static void ParseCommandLine(void) case INPUT_FILES_FILE: LinkFile (InputFiles[I].FileName, FILETYPE_UNKNOWN); break; + case INPUT_FILES_FILE_LIB: + LinkFile (InputFiles[I].FileName, FILETYPE_LIB); + break; + case INPUT_FILES_FILE_OBJ: + LinkFile (InputFiles[I].FileName, FILETYPE_OBJ); + break; case INPUT_FILES_SGROUP: OptStartGroup (NULL, 0); break; case INPUT_FILES_EGROUP: OptEndGroup (NULL, 0); break; - case INPUT_FILES_LIBPATH: - OptLibPath (NULL, InputFiles[I].FileName); - break; default: abort (); } From cb838a43fa536af5d962a3fe230ca36737c3a32b Mon Sep 17 00:00:00 2001 From: Greg King Date: Thu, 27 Mar 2014 12:47:00 -0400 Subject: [PATCH 16/32] Added document lines that name the default device drivers. Also: - Changed some tags to . Now, those links will show their URL addresses (in addition to their names) in info and text pages. - Added some Atmos-specific function names to its document. - Fixed some punctuation syntax. --- doc/atari.sgml | 8 ++--- doc/atmos.sgml | 55 ++++++++++++++++++++--------------- doc/c128.sgml | 77 +++++++++++++++++++++++++++---------------------- doc/c64.sgml | 52 ++++++++++++++++++--------------- doc/cbm510.sgml | 43 +++++++++++++++------------ doc/pet.sgml | 34 ++++++++++++---------- doc/vic20.sgml | 36 +++++++++++++---------- 7 files changed, 170 insertions(+), 135 deletions(-) diff --git a/doc/atari.sgml b/doc/atari.sgml index 0bdeac364..007a95039 100644 --- a/doc/atari.sgml +++ b/doc/atari.sgml @@ -7,7 +7,7 @@ url="mailto:shawnjefferson@24fightingchickens.com" name="shawnjefferson@24fightingchickens.com"> and Christian Groessler, -03-Jan-2006 +2014-03-27 An overview over the Atari runtime system as it is implemented for the cc65 C @@ -412,7 +412,7 @@ The values of "1" are needed because the graphics command crashes if it doesn't have at least one byte available. This seems to be a bug of the Atari ROM code. -Default drivers: Extended memory drivers

@@ -657,7 +657,7 @@ Command line arguments can be passed to Leading and trailing spaces around an argument are ignored. The first argument passed to A maximum number of 16 arguments (including the program name) are - supported. + supported. @@ -700,7 +700,7 @@ segments should go above $7FFF.

The main problem is that the EXE header generated by the cc65 runtime lib is wrong. It defines a single load chunk with the sizes/addresses -of the STARTUP, LOWCODE, INIT, CODE, RODATA, and DATA segments, in +of the STARTUP, LOWCODE, INIT, CODE, RODATA, and DATA segments, in fact, the whole user program (we're disregarding the "system check" load chunk here).

diff --git a/doc/atmos.sgml b/doc/atmos.sgml index 82aef6c31..921b11645 100644 --- a/doc/atmos.sgml +++ b/doc/atmos.sgml @@ -2,11 +2,11 @@

-Oric Atmos specific information for cc65 +<title>Oric Atmos-specific information for CC65 <author>Ullrich von Bassewitz <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"><newline> Stefan A. Haubenthal <htmlurl url="mailto:polluks@sdf.lonestar.org" name="polluks@sdf.lonestar.org"><newline> <url url="mailto:greg.king5@verizon.net" name="Greg King"> -<date>2013-01-08 +<date>2014-03-27 <abstract> An overview over the Atmos runtime system as it is implemented for the cc65 C @@ -21,11 +21,11 @@ compiler. <sect>Overview<p> This file contains an overview of the Atmos runtime system as it comes with the -cc65 C compiler. It describes the memory layout, Atmos specific header files, +cc65 C compiler. It describes the memory layout, Atmos-specific header files, available drivers, and any pitfalls specific to that platform. -Please note that Atmos specific functions are just mentioned here, they are -described in detail in the separate <htmlurl url="funcref.html" name="function +Please note that Atmos-specific functions are just mentioned here, they are +described in detail in the separate <url url="funcref.html" name="function reference">. Even functions marked as "platform dependent" may be available on more than one platform. Please see the function reference for more information. @@ -58,19 +58,25 @@ Special locations: -<sect>Platform specific header files<p> +<sect>Platform-specific header files<p> -Programs containing Atmos specific code may use the <tt/atmos.h/ header file. +Programs containing Atmos-specific code may use the <tt/atmos.h/ header file. -<sect1>Atmos specific functions<p> +<sect1>Atmos-specific functions<p> -The functions listed below are special for the Atmos. See the <htmlurl +The functions listed below are special for the Atmos. See the <url url="funcref.html" name="function reference"> for declaration and usage. <itemize> <item>atmos_load <item>atmos_save +<item>atmos_explode +<item>atmos_ping +<item>atmos_shoot +<item>atmos_tick +<item>atmos_tock +<item>atmos_zap </itemize> @@ -78,7 +84,7 @@ url="funcref.html" name="function reference"> for declaration and usage. The following pseudo variables declared in the <tt/atmos.h/ header file do allow access to hardware located in the address space. Some variables are -structures, accessing the struct fields will access the chip registers. +structures; accessing the struct fields will access the chip registers. <descrip> @@ -110,6 +116,8 @@ The names in the parentheses denote the symbols to be used for static linking of <sect1>Graphics drivers<p> +The default drivers, <tt/tgi_stddrv (tgi_static_stddrv)/, point to <tt/atmos-240-200-2.tgi (atmos_240_200_2_tgi)/. + <descrip> <tag><tt/atmos-228-200-3.tgi (atmos_228_200_3_tgi)/</tag> @@ -154,8 +162,8 @@ No mouse drivers are currently available for the Atmos. <tag><tt/atmos-acia.ser (atmos_acia_ser)/</tag> Driver for the Telestrat integrated serial controller and the Atmos with a serial add-on. - Note that because of the peculiarities of the 6551 chip together with the - use of the NMI, transmits are not interrupt driven, and the transceiver + Note that, because of the peculiarities of the 6551 chip, together with the + use of the NMI, transmits are not interrupt driven; and, the transceiver blocks if the receiver asserts flow control because of a full buffer. </descrip><p> @@ -167,12 +175,12 @@ No mouse drivers are currently available for the Atmos. <sect1>Disk I/O<p> The existing library for the Atmos doesn't implement C file -I/O. There is one hack for the <tt/write()/ routine in -place, which will make functions work that write to <tt/stdout/ -(like <tt/printf()/). However, this function has some shortcomings which -won't be fixed, because it's going to be replaced anyway. +I/O. There are hacks for the <tt/read()/ and <tt/write()/ routines in +place, which will make functions work that read from and write to <tt/stdout/ +(like <tt/printf()/). However, those functions have some shortcomings which +won't be fixed, because they're going to be replaced anyway. -To be more concrete, this limitation means that you cannot use any of the +To be more concrete, the limitation means that you cannot use any of the following functions (and a few others): <itemize> @@ -190,14 +198,16 @@ following functions (and a few others): <sect>Other hints<p> + <sect1>Function keys<p> These are defined to be FUNCT + number key. + <sect1>Passing arguments to the program<p> -Command line arguments can be passed to <tt/main()/. Since this is not -supported by BASIC, the following syntax was chosen: +Command-line arguments can be passed to <tt/main()/. Since that is not +supported directly by BASIC, the following syntax was chosen: <tscreen><verb> CALL#500:REM ARG1 " ARG2 IS QUOTED" ARG3 "" ARG5 @@ -208,7 +218,7 @@ supported by BASIC, the following syntax was chosen: <item>Arguments may be quoted. <item>Leading and trailing spaces around an argument are ignored. Spaces within a quoted argument are allowed. -<item>The first argument passed to <tt/main/ is the program name. +<item>The first argument passed to <tt/main()/ is the program name. <item>A maximum number of 10 arguments (including the program name) are supported. </enum> @@ -220,7 +230,7 @@ The runtime for the Atmos uses routines marked as <tt/.INTERRUPTOR/ for interrupt handlers. Such routines must be written as simple machine language subroutines and will be called automatically by the interrupt handler code when they are linked into a program. See the discussion of the <tt/.CONDES/ -feature in the <htmlurl url="ca65.html" name="assembler manual">. +feature in the <url url="ca65.html" name="assembler manual">. @@ -246,6 +256,3 @@ freely, subject to the following restrictions: </enum> </article> - - - diff --git a/doc/c128.sgml b/doc/c128.sgml index 5ea44b970..ae48ea514 100644 --- a/doc/c128.sgml +++ b/doc/c128.sgml @@ -2,9 +2,9 @@ <article> -<title>Commodore 128 specific information for cc65 +<title>Commodore 128-specific information for CC65 <author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"> -<date>2003-12-14 +<date>2014-03-24 <abstract> An overview over the C128 runtime system as it is implemented for the cc65 C @@ -19,11 +19,11 @@ compiler. <sect>Overview<p> This file contains an overview of the C128 runtime system as it comes with the -cc65 C compiler. It describes the memory layout, C128 specific header files, +cc65 C compiler. It describes the memory layout, C128-specific header files, available drivers, and any pitfalls specific to that platform. -Please note that C128 specific functions are just mentioned here, they are -described in detail in the separate <htmlurl url="funcref.html" name="function +Please note that C128-specific functions are just mentioned here, they are +described in detail in the separate <url url="funcref.html" name="function reference">. Even functions marked as "platform dependent" may be available on more than one platform. Please see the function reference for more information. @@ -59,27 +59,27 @@ Special locations: The text screen is located at $400 (as in the standard setup). <tag/Stack/ - The C runtime stack is located at $BFFF and growing downwards. + The C runtime stack is located at $BFFF, and growing downwards. <tag/Heap/ - The C heap is located at the end of the program and grows towards the C + The C heap is located at the end of the program, and grows towards the C runtime stack. </descrip><p> -<sect>Platform specific header files<p> +<sect>Platform-specific header files<p> -Programs containing C128 specific code may use the <tt/c128.h/ or <tt/cbm.h/ +Programs containing C128-specific code may use the <tt/c128.h/ or <tt/cbm.h/ header files. Using the later may be an option when writing code for more than one CBM platform, since it includes <tt/c128.h/ and declares several functions common to all CBM platforms. -<sect1>C128 specific functions<p> +<sect1>C128-specific functions<p> -The functions listed below are special for the C128. See the <htmlurl +The functions listed below are special for the C128. See the <url url="funcref.html" name="function reference"> for declaration and usage. <itemize> @@ -90,10 +90,10 @@ url="funcref.html" name="function reference"> for declaration and usage. </itemize> -<sect1>CBM specific functions<p> +<sect1>CBM-specific functions<p> Some functions are available for all (or at least most) of the Commodore -machines. See the <htmlurl url="funcref.html" name="function reference"> for +machines. See the <url url="funcref.html" name="function reference"> for declaration and usage. <itemize> @@ -164,26 +164,28 @@ The names in the parentheses denote the symbols to be used for static linking of <sect1>Graphics drivers<p> +The default drivers, <tt/tgi_stddrv (tgi_static_stddrv)/, point to <tt/c128-vdc.tgi (c128_vdc_tgi)/. + Note: The graphics drivers for the VDC are incompatible with the extended memory drivers using the VDC memory! <descrip> <tag><tt/c128-vdc.tgi (c128_vdc_tgi)/</tag> - This driver was written by Maciej Witkowiak. It uses the 80 column display + This driver was written by Maciej Witkowiak. It uses the 80-column display, and features a resolution of 640*200 with two colors and an adjustable palette (that means that the two colors can be chosen out of the 16 VDC colors). <tag><tt/c128-vdc2.tgi (c128_vdc2_tgi)/</tag> - This driver was written by Maciej Witkowiak. This driver uses the 80 column - display and features a resolution of 640*480 with two colors and an + This driver was written by Maciej Witkowiak. This driver uses the 80-column + display, and features a resolution of 640*480 with two colors and an adjustable palette (that means that the two colors can be chosen out of the - 16 VDC colors). The driver requires 64KB VDC RAM. + 16 VDC colors). The driver requires 64KiB VDC RAM. </descrip><p> -Note: The colors are translated from definitions in headers to correct VDC values -so please use definitions or VIC color numbers only. Colors <tt/GRAY3/ and <tt/BROWN/ are -missing on VDC and are translated to the two colors missing from VIC palette. +Note: The colors are translated from definitions in headers to correct VDC values; +so, please use definitions or VIC color numbers only. Colors <tt/GRAY3/ and <tt/BROWN/ are +missing on VDC, and are translated to the two colors missing from the VIC palette. <sect1>Extended memory drivers<p> @@ -212,13 +214,13 @@ missing on VDC and are translated to the two colors missing from VIC palette. <tag><tt/c128-reu.emd (c128_reu_emd)/</tag> A driver for the CBM REUs. The driver will determine from the connected REU - if it supports 128KB of RAM or more. In the latter case, 256KB are assumed, + if it supports 128KiB of RAM or more. In the latter case, 256KiB are assumed, but since there are no range checks, the application can use more memory if it has better knowledge about the hardware than the driver. <tag><tt/c128-vdc.emd (c128_vdc_emd)/</tag> - A driver for the VDC memory of the C128 written and contributed by Maciej - Witkowiak. Autodetects the amount of memory available (16 or 64K) and offers + A driver for the VDC memory of the C128, written and contributed by Maciej + Witkowiak. Autodetects the amount of memory available (16 or 64Ki), and offers 64 or 256 pages of 256 bytes each. Note: This driver is incompatible with any of the graphics drivers using the VDC! @@ -227,17 +229,19 @@ missing on VDC and are translated to the two colors missing from VIC palette. <sect1>Joystick drivers<p> +The default drivers, <tt/joy_stddrv (joy_static_stddrv)/, point to <tt/c128-stdjoy.joy (c128_stdjoy_joy)/. + <descrip> <tag><tt/c128-ptvjoy.joy (c128_ptvjoy_joy)/</tag> Driver for the Protovision 4-player adapter originally written by Groepaz - for the C64 and converted for the C128 by me. See <htmlurl + for the C64, and converted for the C128 by me. See <htmlurl url="http://www.protovision-online.de/hardw/hardwstart.htm" name="http://www.protovision-online.de/hardw/hardwstart.htm"> for prices and building instructions. Up to four joysticks are supported. <tag><tt/c128-stdjoy.joy (c128_stdjoy_joy)/</tag> - Supports up to two joysticks connected to the standard joysticks port of + Supports up to two joysticks connected to the standard joysticks ports of the C128. </descrip><p> @@ -246,6 +250,8 @@ missing on VDC and are translated to the two colors missing from VIC palette. <sect1>Mouse drivers<p> +The default drivers, <tt/mouse_stddrv (mouse_static_stddrv)/, point to <tt/c128-1351.mou (c128_1351_mou)/. + <descrip> <tag><tt/c128-1351.mou (c128_1351_mou)/</tag> @@ -259,11 +265,11 @@ missing on VDC and are translated to the two colors missing from VIC palette. only the 40-column screen. <tag><tt/c128-joy.mou (c128_joy_mou)/</tag> - Supports a mouse emulated by a standard joystick e.g. 1350 mouse in port + Supports a mouse emulated by a standard joystick, e.g. 1350 mouse, in port #1 of the C128. <tag><tt/c128-pot.mou (c128_pot_mou)/</tag> - Supports a potentiometer device e.g. Koala Pad connected to port #1 of + Supports a potentiometer device, e.g. Koala Pad, connected to port #1 of the C128. </descrip><p> @@ -274,10 +280,10 @@ missing on VDC and are translated to the two colors missing from VIC palette. <descrip> <tag><tt/c128-swlink.ser (c128_swlink_ser)/</tag> - Driver for the SwiftLink cartridge. Supports up to 38400 baud, hardware flow - control (RTS/CTS) and interrupt driven receives. Note that because of the - peculiarities of the 6551 chip together with the use of the NMI, transmits - are not interrupt driven, and the transceiver blocks if the receiver asserts + Driver for the SwiftLink cartridge. Supports up to 38400 BPS, hardware flow + control (RTS/CTS), and interrupt-driven receives. Note that, because of the + peculiarities of the 6551 chip, together with the use of the NMI, transmits + are not interrupt driven; and, the transceiver blocks if the receiver asserts flow control because of a full buffer. The driver uses the RS232 variables and buffers of the kernal (buffers at @@ -293,10 +299,11 @@ missing on VDC and are translated to the two colors missing from VIC palette. <sect>Other hints<p> + <sect1>Passing arguments to the program<p> -Command line arguments can be passed to <tt/main()/. Since this is not -supported by BASIC, the following syntax was chosen: +Command-line arguments can be passed to <tt/main()/. Since this is not +supported directly by BASIC, the following syntax was chosen: <tscreen><verb> RUN:REM ARG1 " ARG2 IS QUOTED" ARG3 "" ARG5 @@ -307,7 +314,7 @@ supported by BASIC, the following syntax was chosen: <item>Arguments may be quoted. <item>Leading and trailing spaces around an argument are ignored. Spaces within a quoted argument are allowed. -<item>The first argument passed to <tt/main/ is the program name. +<item>The first argument passed to <tt/main()/ is the program name. <item>A maximum number of 10 arguments (including the program name) are supported. </enum> @@ -325,7 +332,7 @@ The runtime for the C128 uses routines marked as <tt/.INTERRUPTOR/ for interrupt handlers. Such routines must be written as simple machine language subroutines and will be called automatically by the interrupt handler code when they are linked into a program. See the discussion of the <tt/.CONDES/ -feature in the <htmlurl url="ca65.html" name="assembler manual">. +feature in the <url url="ca65.html" name="assembler manual">. diff --git a/doc/c64.sgml b/doc/c64.sgml index a5014414c..c324fbea0 100644 --- a/doc/c64.sgml +++ b/doc/c64.sgml @@ -2,9 +2,9 @@ <article> -<title>Commodore 64 specific information for cc65 +<title>Commodore 64-specific information for CC65 <author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"> -<date>2003-09-23 +<date>2014-03-24 <abstract> An overview over the C64 runtime system as it is implemented for the cc65 C @@ -19,11 +19,11 @@ compiler. <sect>Overview<p> This file contains an overview of the C64 runtime system as it comes with the -cc65 C compiler. It describes the memory layout, C64 specific header files, +cc65 C compiler. It describes the memory layout, C64-specific header files, available drivers, and any pitfalls specific to that platform. -Please note that C64 specific functions are just mentioned here, they are -described in detail in the separate <htmlurl url="funcref.html" name="function +Please note that C64-specific functions are just mentioned here, they are +described in detail in the separate <url url="funcref.html" name="function reference">. Even functions marked as "platform dependent" may be available on more than one platform. Please see the function reference for more information. @@ -117,17 +117,17 @@ Please note that in this case a changed start address doesn't make sense, since the program must be loaded to the BASIC start address. -<sect>Platform specific header files<p> +<sect>Platform-specific header files<p> -Programs containing C64 specific code may use the <tt/c64.h/ or <tt/cbm.h/ +Programs containing C64-specific code may use the <tt/c64.h/ or <tt/cbm.h/ header files. Using the later may be an option when writing code for more than one CBM platform, since it includes <tt/c64.h/ and declares several functions common to all CBM platforms. -<sect1>C64 specific functions<p> +<sect1>C64-specific functions<p> -The functions listed below are special for the C64. See the <htmlurl +The functions listed below are special for the C64. See the <url url="funcref.html" name="function reference"> for declaration and usage. <itemize> @@ -135,10 +135,10 @@ url="funcref.html" name="function reference"> for declaration and usage. </itemize> -<sect1>CBM specific functions<p> +<sect1>CBM-specific functions<p> Some functions are available for all (or at least most) of the Commodore -machines. See the <htmlurl url="funcref.html" name="function reference"> for +machines. See the <url url="funcref.html" name="function reference"> for declaration and usage. <itemize> @@ -268,10 +268,12 @@ configuration. <sect1>Joystick drivers<p> +The default drivers, <tt/joy_stddrv (joy_static_stddrv)/, point to <tt/c64-stdjoy.joy (c64_stdjoy_joy)/. + <descrip> <tag><tt/c64-hitjoy.joy (c64_hitjoy_joy)/</tag> - Driver for the Digital Excess & Hitmen adapter contributed by Groepaz. See + Driver for the Digital Excess & Hitmen adapter contributed by Groepaz. See <htmlurl url="http://www.digitalexcess.de/downloads/productions.php" name="http://www.digitalexcess.de/downloads/productions.php"> on instructions how to build one. Up to four joysticks are supported. @@ -295,6 +297,8 @@ configuration. <sect1>Mouse drivers<p> +The default drivers, <tt/mouse_stddrv (mouse_static_stddrv)/, point to <tt/c64-1351.mou (c64_1351_mou)/. + <descrip> <tag><tt/c64-1351.mou (c64_1351_mou)/</tag> @@ -307,11 +311,11 @@ configuration. joystick left-button pin or the paddle Y [up/down] pin.) <tag><tt/c64-joy.mou (c64_joy_mou)/</tag> - Supports a mouse emulated by a standard joystick e.g. 1350 mouse in port + Supports a mouse emulated by a standard joystick, e.g. 1350 mouse, in port #1 of the C64. <tag><tt/c64-pot.mou (c64_pot_mou)/</tag> - Supports a potentiometer device e.g. Koala Pad connected to port #1 of + Supports a potentiometer device, e.g. Koala Pad, connected to port #1 of the C64. </descrip><p> @@ -322,10 +326,10 @@ configuration. <descrip> <tag><tt/c64-swlink.ser (c64_swlink_ser)/</tag> - Driver for the SwiftLink cartridge. Supports up to 38400 baud, hardware flow - control (RTS/CTS) and interrupt driven receives. Note that because of the - peculiarities of the 6551 chip together with the use of the NMI, transmits - are not interrupt driven, and the transceiver blocks if the receiver asserts + Driver for the SwiftLink cartridge. Supports up to 38400 BPS, hardware flow + control (RTS/CTS), and interrupt-driven receives. Note that, because of the + peculiarities of the 6551 chip, together with the use of the NMI, transmits + are not interrupt driven; and, the transceiver blocks if the receiver asserts flow control because of a full buffer. </descrip><p> @@ -338,14 +342,16 @@ configuration. <sect>Other hints<p> + <sect1>Escape code<p> -For an Esc press CTRL and [ key. +For an Esc, press CTRL and the <tt/[/ key. + <sect1>Passing arguments to the program<p> -Command line arguments can be passed to <tt/main()/. Since this is not -supported by BASIC, the following syntax was chosen: +Command-line arguments can be passed to <tt/main()/. Since this is not +supported directly by BASIC, the following syntax was chosen: <tscreen><verb> RUN:REM ARG1 " ARG2 IS QUOTED" ARG3 "" ARG5 @@ -356,7 +362,7 @@ supported by BASIC, the following syntax was chosen: <item>Arguments may be quoted. <item>Leading and trailing spaces around an argument are ignored. Spaces within a quoted argument are allowed. -<item>The first argument passed to <tt/main/ is the program name. +<item>The first argument passed to <tt/main()/ is the program name. <item>A maximum number of 10 arguments (including the program name) are supported. </enum> @@ -374,7 +380,7 @@ The runtime for the C64 uses routines marked as <tt/.INTERRUPTOR/ for interrupt handlers. Such routines must be written as simple machine language subroutines and will be called automatically by the interrupt handler code when they are linked into a program. See the discussion of the <tt/.CONDES/ -feature in the <htmlurl url="ca65.html" name="assembler manual">. +feature in the <url url="ca65.html" name="assembler manual">. diff --git a/doc/cbm510.sgml b/doc/cbm510.sgml index 75497d977..e70571135 100644 --- a/doc/cbm510.sgml +++ b/doc/cbm510.sgml @@ -2,11 +2,11 @@ <article> -<title>Commodore 510 (aka P500) specific information for cc65 -<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">&nl; -Stefan A. Haubenthal, <htmlurl url="mailto:polluks@sdf.lonestar.org" name="polluks@sdf.lonestar.org">&nl; -<htmlurl url="mailto:greg.king5@verizon.net" name="Greg King"> -<date>2013-08-23 +<title>Commodore 510 (aka P500) specific information for CC65 +<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"><newline> +Stefan A. Haubenthal, <htmlurl url="mailto:polluks@sdf.lonestar.org" name="polluks@sdf.lonestar.org"><newline> +<url url="mailto:greg.king5@verizon.net" name="Greg King"> +<date>2014-03-26 <abstract> An overview over the Commodore 510 runtime system as it is implemented for the @@ -21,11 +21,11 @@ cc65 C compiler. <sect>Overview<p> This file contains an overview of the CBM 510 runtime system as it comes with -the cc65 C compiler. It describes the memory layout, CBM 510 specific header +the cc65 C compiler. It describes the memory layout, CBM 510-specific header files, available drivers, and any pitfalls specific to that platform. -Please note that CBM 510 specific functions are just mentioned here, they are -described in detail in the separate <htmlurl url="funcref.html" name="function +Please note that CBM 510-specific functions are just mentioned here, they are +described in detail in the separate <url url="funcref.html" name="function reference">. Even functions marked as "platform dependent" may be available on more than one platform. Please see the function reference for more information. @@ -75,16 +75,16 @@ Special locations: -<sect>Platform specific header files<p> +<sect>Platform-specific header files<p> -Programs containing CBM 510 specific code may use the <tt/cbm510.h/ or +Programs containing CBM 510-specific code may use the <tt/cbm510.h/ or <tt/cbm.h/ header files. Using the later may be an option when writing code for more than one CBM platform, since it includes <tt/cbm510.h/ and declares several functions common to all CBM platforms. -<sect1>CBM 510 specific functions<p> +<sect1>CBM 510-specific functions<p> -The functions listed below are special for the CBM 510. See the <htmlurl +The functions listed below are special for the CBM 510. See the <url url="funcref.html" name="function reference"> for declaration and usage. <itemize> @@ -95,10 +95,10 @@ url="funcref.html" name="function reference"> for declaration and usage. </itemize> -<sect1>CBM specific functions<p> +<sect1>CBM-specific functions<p> Some functions are available for all (or at least most) of the Commodore -machines. See the <htmlurl url="funcref.html" name="function reference"> for +machines. See the <url url="funcref.html" name="function reference"> for declaration and usage. @@ -204,6 +204,8 @@ No graphics drivers are currently available for the Commodore 510. <sect1>Mouse drivers<p> +The default drivers, <tt/mouse_stddrv (mouse_static_stddrv)/, point to <tt/cbm510-joy.mou (cbm510_joy_mou)/. + <descrip> <tag><tt/cbm510-joy.mou (cbm510_joy_mou)/</tag> @@ -220,20 +222,22 @@ No graphics drivers are currently available for the Commodore 510. </descrip><p> + <sect1>RS232 device drivers<p> <descrip> <tag><tt/cbm510-std.ser (cbm510_std_ser)/</tag> Driver for the 6551 ACIA chip built into the Commodore 510. Supports up to - 19200 baud, hardware flow control (RTS/CTS) and interrupt driven receives. - Note that because of the peculiarities of the 6551 chip transmits are not - interrupt driven, and the transceiver blocks if the receiver asserts flow + 19200 BPS, hardware flow control (RTS/CTS), and interrupt-driven receives. + Note that, because of the peculiarities of the 6551 chip, transmits are not + interrupt driven; and, the transceiver blocks if the receiver asserts flow control because of a full buffer. </descrip><p> + <sect>Limitations<label id="limitations"><p> @@ -246,6 +250,7 @@ While this simplifies things, it should be noted that the wrappers do have quite an impact on performance: A cross bank call has an extra 300µs penalty added by the wrapper. + <sect1>Interrupts<p> Compiled programs contain an interrupt handler that runs in the program bank. @@ -258,8 +263,10 @@ Since the cc65 runtime does only call the kernal for disk I/O, this means that a program should not do file I/O while it depends on interrupts. + <sect>Other hints<p> + <sect1>Passing arguments to the program<p> Command line argument passing is currently not supported for the Commodore @@ -278,7 +285,7 @@ The runtime for the Commodore 510 uses routines marked as <tt/.INTERRUPTOR/ for interrupt handlers. Such routines must be written as simple machine language subroutines and will be called automatically by the interrupt handler code when they are linked into a program. See the discussion of the -<tt/.CONDES/ feature in the <htmlurl url="ca65.html" name="assembler manual">. +<tt/.CONDES/ feature in the <url url="ca65.html" name="assembler manual">. diff --git a/doc/pet.sgml b/doc/pet.sgml index 6d816ad77..3c282a413 100644 --- a/doc/pet.sgml +++ b/doc/pet.sgml @@ -2,10 +2,10 @@ <article> -<title>Commodore PET specific information for cc65 -<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"> +<title>Commodore PET-specific information for CC65 +<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"><newline> Stefan A. Haubenthal, <htmlurl url="mailto:polluks@sdf.lonestar.org" name="polluks@sdf.lonestar.org"> -<date>2005-05-24 +<date>2014-03-26 <abstract> An overview over the PET runtime system as it is implemented for the cc65 C @@ -20,11 +20,11 @@ compiler. <sect>Overview<p> This file contains an overview of the PET runtime system as it comes with the -cc65 C compiler. It describes the memory layout, PET specific header files, +cc65 C compiler. It describes the memory layout, PET-specific header files, available drivers, and any pitfalls specific to that platform. -Please note that PET specific functions are just mentioned here, they are -described in detail in the separate <htmlurl url="funcref.html" name="function +Please note that PET-specific functions are just mentioned here, they are +described in detail in the separate <url url="funcref.html" name="function reference">. Even functions marked as "platform dependent" may be available on more than one platform. Please see the function reference for more information. @@ -63,24 +63,24 @@ Special locations: -<sect>Platform specific header files<p> +<sect>Platform-specific header files<p> -Programs containing PET specific code may use the <tt/pet.h/ or <tt/cbm.h/ +Programs containing PET-specific code may use the <tt/pet.h/ or <tt/cbm.h/ header files. Using the later may be an option when writing code for more than one CBM platform, since it includes <tt/pet.h/ and declares several functions common to all CBM platforms. -<sect1>PET specific functions<p> +<sect1>PET-specific functions<p> There are currently no special PET functions. -<sect1>CBM specific functions<p> +<sect1>CBM-specific functions<p> Some functions are available for all (or at least most) of the Commodore -machines. See the <htmlurl url="funcref.html" name="function reference"> for +machines. See the <url url="funcref.html" name="function reference"> for declaration and usage. <itemize> @@ -148,6 +148,8 @@ No extended memory drivers are currently available for the PET. <sect1>Joystick drivers<p> +The default drivers, <tt/joy_stddrv (joy_static_stddrv)/, point to <tt/pet-stdjoy.joy (pet_stdjoy_joy)/. + <descrip> <tag><tt/pet-ptvjoy.joy (pet_ptvjoy_joy)/</tag> @@ -179,10 +181,11 @@ No serial drivers are currently available for the PET. <sect>Other hints<p> + <sect1>Passing arguments to the program<p> -Command line arguments can be passed to <tt/main()/. Since this is not -supported by BASIC, the following syntax was chosen: +Command-line arguments can be passed to <tt/main()/. Since that is not +supported directly by BASIC, the following syntax was chosen: <tscreen><verb> RUN:REM ARG1 " ARG2 IS QUOTED" ARG3 "" ARG5 @@ -193,7 +196,7 @@ supported by BASIC, the following syntax was chosen: <item>Arguments may be quoted. <item>Leading and trailing spaces around an argument are ignored. Spaces within a quoted argument are allowed. -<item>The first argument passed to <tt/main/ is the program name. +<item>The first argument passed to <tt/main()/ is the program name. <item>A maximum number of 10 arguments (including the program name) are supported. </enum> @@ -211,7 +214,7 @@ The runtime for the PET uses routines marked as <tt/.INTERRUPTOR/ for interrupt handlers. Such routines must be written as simple machine language subroutines and will be called automatically by the interrupt handler code when they are linked into a program. See the discussion of the <tt/.CONDES/ -feature in the <htmlurl url="ca65.html" name="assembler manual">. +feature in the <url url="ca65.html" name="assembler manual">. <sect1>Using extended memory<p> @@ -228,6 +231,7 @@ the following code: </verb></tscreen> + <sect>License<p> This software is provided 'as-is', without any expressed or implied diff --git a/doc/vic20.sgml b/doc/vic20.sgml index 562ea002a..1044b7b23 100644 --- a/doc/vic20.sgml +++ b/doc/vic20.sgml @@ -2,10 +2,10 @@ <article> -<title>Commodore VIC20 (aka VC20) specific information for cc65 -<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"> +<title>Commodore VIC20 (aka VC20) specific information for CC65 +<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"><newline> Stefan A. Haubenthal, <htmlurl url="mailto:polluks@sdf.lonestar.org" name="polluks@sdf.lonestar.org"> -<date>2004-09-13 +<date>2014-03-26 <abstract> An overview over the VIC20 runtime system as it is implemented for the cc65 C @@ -20,11 +20,11 @@ compiler. <sect>Overview<p> This file contains an overview of the VIC20 runtime system as it comes with the -cc65 C compiler. It describes the memory layout, VIC20 specific header files, +cc65 C compiler. It describes the memory layout, VIC20-specific header files, available drivers, and any pitfalls specific to that platform. -Please note that VIC20 specific functions are just mentioned here, they are -described in detail in the separate <htmlurl url="funcref.html" name="function +Please note that VIC20-specific functions are just mentioned here, they are +described in detail in the separate <url url="funcref.html" name="function reference">. Even functions marked as "platform dependent" may be available on more than one platform. Please see the function reference for more information. @@ -63,24 +63,24 @@ Special locations: -<sect>Platform specific header files<p> +<sect>Platform-specific header files<p> -Programs containing VIC20 specific code may use the <tt/vic20.h/ or <tt/cbm.h/ +Programs containing VIC20-specific code may use the <tt/vic20.h/ or <tt/cbm.h/ header files. Using the later may be an option when writing code for more than one CBM platform, since it includes <tt/vic20.h/ and declares several functions common to all CBM platforms. -<sect1>VIC20 specific functions<p> +<sect1>VIC20-specific functions<p> There are currently no special VIC20 functions. -<sect1>CBM specific functions<p> +<sect1>CBM-specific functions<p> Some functions are available for all (or at least most) of the Commodore -machines. See the <htmlurl url="funcref.html" name="function reference"> for +machines. See the <url url="funcref.html" name="function reference"> for declaration and usage. <itemize> @@ -151,6 +151,8 @@ No extended memory drivers are currently available for the VIC20. <sect1>Joystick drivers<p> +The default drivers, <tt/joy_stddrv (joy_static_stddrv)/, point to <tt/vic20-stdjoy.joy (vic20_stdjoy_joy)/. + <descrip> <tag><tt/vic20-stdjoy.joy (vic20_stdjoy_joy)/</tag> @@ -182,14 +184,16 @@ No VIC1011 drivers are currently available for the VIC20. <sect>Other hints<p> + <sect1>Escape code<p> -For an Esc press CTRL and [ key. +For an Esc, press CTRL and the <tt/[/ key. + <sect1>Passing arguments to the program<p> -Command line arguments can be passed to <tt/main()/. Since this is not -supported by BASIC, the following syntax was chosen: +Command-line arguments can be passed to <tt/main()/. Since that is not +supported directly by BASIC, the following syntax was chosen: <tscreen><verb> RUN:REM ARG1 " ARG2 IS QUOTED" ARG3 "" ARG5 @@ -200,7 +204,7 @@ supported by BASIC, the following syntax was chosen: <item>Arguments may be quoted. <item>Leading and trailing spaces around an argument are ignored. Spaces within a quoted argument are allowed. -<item>The first argument passed to <tt/main/ is the program name. +<item>The first argument passed to <tt/main()/ is the program name. <item>A maximum number of 10 arguments (including the program name) are supported. </enum> @@ -232,7 +236,7 @@ The runtime for the VIC20 uses routines marked as <tt/.INTERRUPTOR/ for interrupt handlers. Such routines must be written as simple machine language subroutines and will be called automatically by the interrupt handler code when they are linked into a program. See the discussion of the <tt/.CONDES/ -feature in the <htmlurl url="ca65.html" name="assembler manual">. +feature in the <url url="ca65.html" name="assembler manual">. From 1a348ab73f3cc47d22fe2bc56f62b72f462556cb Mon Sep 17 00:00:00 2001 From: Christian Groessler <chris@groessler.org> Date: Fri, 28 Mar 2014 22:40:32 +0100 Subject: [PATCH 17/32] Fix error which slipped in in '-L' command line parameter handling. --- src/ld65/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ld65/main.c b/src/ld65/main.c index eb9cc5af1..e68ebc9f7 100644 --- a/src/ld65/main.c +++ b/src/ld65/main.c @@ -696,7 +696,7 @@ static void ParseCommandLine(void) LabelFileName = GetArg (&I, 3); break; default: - OptLibPath (Arg, InputFiles[I].FileName); + OptLibPath (Arg, GetArg (&I, 2)); break; } break; From 180caeba0a954020879c2e3f1c2cb9bf848a6d6f Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Sat, 29 Mar 2014 23:23:33 +0100 Subject: [PATCH 18/32] Added doc install target. --- doc/Makefile | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/doc/Makefile b/doc/Makefile index 159c30021..02ed6b1d3 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -6,11 +6,14 @@ endif .SUFFIXES: -all mostlyclean install: +htmldir = $(prefix)/share/doc/cc65$(DESTPACKAGE_SUFFIX)/html +infodir = $(prefix)/share/info + +all mostlyclean: ifdef CMD_EXE -clean zip doc: +clean install zip doc: else # CMD_EXE @@ -21,9 +24,22 @@ TOC_LEVEL = 0 TOC_LEVEL = 2 +INSTALL = install + clean: $(RM) -r ../html ../info +install: + $(if $(prefix),,$(error variable `prefix' must be set)) +ifeq ($(wildcard ../html),../html) + $(INSTALL) -d $(DESTDIR)$(htmldir) + $(INSTALL) -m644 ../html/*.* $(DESTDIR)$(htmldir) +endif +ifeq ($(wildcard ../info),../info) + $(INSTALL) -d $(DESTDIR)$(infodir) + $(INSTALL) -m644 ../info/*.* $(DESTDIR)$(infodir) +endif + zip: @cd .. && zip cc65 html/*.* From b92630142fbbbedd6588f44f8653585dc1e3d19c Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Sun, 30 Mar 2014 22:10:37 +0200 Subject: [PATCH 19/32] Harmonized usage of "KB" and "cc65". --- doc/atmos.sgml | 2 +- doc/c128.sgml | 8 ++++---- doc/c64.sgml | 2 +- doc/cbm510.sgml | 2 +- doc/pet.sgml | 2 +- doc/vic20.sgml | 2 +- testcode/lib/exec-test1.c | 2 +- testcode/lib/exec-test2.c | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/doc/atmos.sgml b/doc/atmos.sgml index 921b11645..86f6b1154 100644 --- a/doc/atmos.sgml +++ b/doc/atmos.sgml @@ -2,7 +2,7 @@ <article> -<title>Oric Atmos-specific information for CC65 +<title>Oric Atmos-specific information for cc65 <author>Ullrich von Bassewitz <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"><newline> Stefan A. Haubenthal <htmlurl url="mailto:polluks@sdf.lonestar.org" name="polluks@sdf.lonestar.org"><newline> <url url="mailto:greg.king5@verizon.net" name="Greg King"> diff --git a/doc/c128.sgml b/doc/c128.sgml index ae48ea514..a51767e69 100644 --- a/doc/c128.sgml +++ b/doc/c128.sgml @@ -2,7 +2,7 @@ <article> -<title>Commodore 128-specific information for CC65 +<title>Commodore 128-specific information for cc65 <author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"> <date>2014-03-24 @@ -180,7 +180,7 @@ memory drivers using the VDC memory! This driver was written by Maciej Witkowiak. This driver uses the 80-column display, and features a resolution of 640*480 with two colors and an adjustable palette (that means that the two colors can be chosen out of the - 16 VDC colors). The driver requires 64KiB VDC RAM. + 16 VDC colors). The driver requires 64KB VDC RAM. </descrip><p> Note: The colors are translated from definitions in headers to correct VDC values; @@ -214,13 +214,13 @@ missing on VDC, and are translated to the two colors missing from the VIC palett <tag><tt/c128-reu.emd (c128_reu_emd)/</tag> A driver for the CBM REUs. The driver will determine from the connected REU - if it supports 128KiB of RAM or more. In the latter case, 256KiB are assumed, + if it supports 128KB of RAM or more. In the latter case, 256KB are assumed, but since there are no range checks, the application can use more memory if it has better knowledge about the hardware than the driver. <tag><tt/c128-vdc.emd (c128_vdc_emd)/</tag> A driver for the VDC memory of the C128, written and contributed by Maciej - Witkowiak. Autodetects the amount of memory available (16 or 64Ki), and offers + Witkowiak. Autodetects the amount of memory available (16 or 64K), and offers 64 or 256 pages of 256 bytes each. Note: This driver is incompatible with any of the graphics drivers using the VDC! diff --git a/doc/c64.sgml b/doc/c64.sgml index c324fbea0..2883ce79e 100644 --- a/doc/c64.sgml +++ b/doc/c64.sgml @@ -2,7 +2,7 @@ <article> -<title>Commodore 64-specific information for CC65 +<title>Commodore 64-specific information for cc65 <author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"> <date>2014-03-24 diff --git a/doc/cbm510.sgml b/doc/cbm510.sgml index e70571135..f0e03c28b 100644 --- a/doc/cbm510.sgml +++ b/doc/cbm510.sgml @@ -2,7 +2,7 @@ <article> -<title>Commodore 510 (aka P500) specific information for CC65 +<title>Commodore 510 (aka P500) specific information for cc65 <author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"><newline> Stefan A. Haubenthal, <htmlurl url="mailto:polluks@sdf.lonestar.org" name="polluks@sdf.lonestar.org"><newline> <url url="mailto:greg.king5@verizon.net" name="Greg King"> diff --git a/doc/pet.sgml b/doc/pet.sgml index 3c282a413..b0fa0e1e8 100644 --- a/doc/pet.sgml +++ b/doc/pet.sgml @@ -2,7 +2,7 @@ <article> -<title>Commodore PET-specific information for CC65 +<title>Commodore PET-specific information for cc65 <author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"><newline> Stefan A. Haubenthal, <htmlurl url="mailto:polluks@sdf.lonestar.org" name="polluks@sdf.lonestar.org"> <date>2014-03-26 diff --git a/doc/vic20.sgml b/doc/vic20.sgml index 1044b7b23..f02bd63d9 100644 --- a/doc/vic20.sgml +++ b/doc/vic20.sgml @@ -2,7 +2,7 @@ <article> -<title>Commodore VIC20 (aka VC20) specific information for CC65 +<title>Commodore VIC20 (aka VC20) specific information for cc65 <author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"><newline> Stefan A. Haubenthal, <htmlurl url="mailto:polluks@sdf.lonestar.org" name="polluks@sdf.lonestar.org"> <date>2014-03-26 diff --git a/testcode/lib/exec-test1.c b/testcode/lib/exec-test1.c index e2548fb0a..ea74ee60a 100644 --- a/testcode/lib/exec-test1.c +++ b/testcode/lib/exec-test1.c @@ -1,5 +1,5 @@ /* -** These programs test CC65's exec() program-chaining function. +** These programs test cc65's exec() program-chaining function. ** exec-test1 runs exec-test2 -- that tests the loading and starting of another ** program. Then, exec-test2 runs arg-test -- that tests command-line argument ** passing. diff --git a/testcode/lib/exec-test2.c b/testcode/lib/exec-test2.c index e6c844a8e..a0aa82a3f 100644 --- a/testcode/lib/exec-test2.c +++ b/testcode/lib/exec-test2.c @@ -1,5 +1,5 @@ /* -** These programs test CC65's exec() program-chaining function. +** These programs test cc65's exec() program-chaining function. ** exec-test1 runs exec-test2 -- that tests the loading and starting of another ** program. Then, exec-test2 runs arg-test -- that tests command-line argument ** passing. From 42595fbf134ab12c3ea2872397fd94888826bcf5 Mon Sep 17 00:00:00 2001 From: Greg King <gregdk@users.sf.net> Date: Thu, 3 Apr 2014 08:23:28 -0400 Subject: [PATCH 20/32] Added command-line argument parsing to the CBM510 and CBM610 targets. --- asminc/cbm510.inc | 4 +- asminc/cbm610.inc | 4 +- doc/cbm510.sgml | 52 +++++++++----- doc/cbm610.sgml | 101 +++++++++++++++----------- libsrc/cbm510/mainargs.s | 150 ++++++++++++++++++++++++++++++++++++--- libsrc/cbm610/mainargs.s | 150 ++++++++++++++++++++++++++++++++++++--- 6 files changed, 381 insertions(+), 80 deletions(-) diff --git a/asminc/cbm510.inc b/asminc/cbm510.inc index abc363728..e1a86c487 100644 --- a/asminc/cbm510.inc +++ b/asminc/cbm510.inc @@ -4,7 +4,7 @@ ; Taken from a kernal disassembly done by myself in 2000/2001. ; ; 2001-09-13, Ullrich von Bassewitz -; 2013-08-26, Greg King +; 2014-04-02, Greg King ;----------------------------------------------------------------------------- @@ -14,6 +14,8 @@ ExecReg := $00 ; Controls execution memory bank IndReg := $01 ; Controls indirect indexed load-store bank TXTPTR := $85 ; Far pointer into BASIC source code +FNAM := $90 ; Far pointer to LOAD/SAVE file-name +FNAM_LEN := $9D ; Holds length of file-name ; --------------------------------------------------------------------------- ; Screen size diff --git a/asminc/cbm610.inc b/asminc/cbm610.inc index f442f5da8..b1b03eb1d 100644 --- a/asminc/cbm610.inc +++ b/asminc/cbm610.inc @@ -4,7 +4,7 @@ ; Taken from a kernal disassembly done by myself in 1987. ; ; 1998-09-28, Ullrich von Bassewitz -; 2013-08-26, Greg King +; 2014-04-02, Greg King ; --------------------------------------------------------------------------- @@ -14,6 +14,8 @@ ExecReg := $00 ; Controls execution memory bank IndReg := $01 ; Controls indirect indexed load-store bank TXTPTR := $85 ; Far pointer into BASIC source code +FNAM := $90 ; Far pointer to LOAD/SAVE file-name +FNAM_LEN := $9D ; Holds length of file-name ; --------------------------------------------------------------------------- ; Screen size diff --git a/doc/cbm510.sgml b/doc/cbm510.sgml index f0e03c28b..3389bd4e1 100644 --- a/doc/cbm510.sgml +++ b/doc/cbm510.sgml @@ -6,7 +6,7 @@ <author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"><newline> Stefan A. Haubenthal, <htmlurl url="mailto:polluks@sdf.lonestar.org" name="polluks@sdf.lonestar.org"><newline> <url url="mailto:greg.king5@verizon.net" name="Greg King"> -<date>2014-03-26 +<date>2014-04-02 <abstract> An overview over the Commodore 510 runtime system as it is implemented for the @@ -38,10 +38,10 @@ machines are supported by this cc65 target. <sect>Binary format<p> The standard binary output format generated by the linker for the Commodore -510 target is a machine language program with a one line BASIC stub, which -transfers control to the machine language running in bank 0. This means that a -program can be loaded as BASIC program and started with RUN. It is of course -possible to change this behaviour by using a modified startup file and linker +510 target is a machine language program with a one-line BASIC stub, which +transfers control to the machine language running in bank 0. That means that a +program can be loaded as a BASIC program, and started with RUN. It is, of course, +possible to change that behaviour by using a modified startup file and linker config. @@ -58,7 +58,7 @@ The default memory configuration for the CBM 510 allocates all memory between in low memory is lost, because a separate hardware stack is set up in page 1, and the kernal replacement functions need some more memory locations. A few more pages are lost in high memory, because the runtime sets up a copy of the -character ROM, a text screen and a CBM compatible jump table at $FF81. +character ROM, a text screen, and a CBM-compatible jump table at $FF81. The main startup code is located at $0400, so about 54K of the complete bank are actually usable for applications. @@ -66,10 +66,10 @@ Special locations: <descrip> <tag/Stack/ - The C runtime stack is located at $FF81 and growing downwards. + The C runtime stack is located at $FF81, and grows downwards. <tag/Heap/ - The C heap is located at the end of the program and grows towards the C + The C heap is located at the end of the program, and grows towards the C runtime stack. </descrip><p> @@ -79,7 +79,7 @@ Special locations: Programs containing CBM 510-specific code may use the <tt/cbm510.h/ or <tt/cbm.h/ header files. Using the later may be an option when writing code -for more than one CBM platform, since it includes <tt/cbm510.h/ and declares +for more than one CBM platform, since it includes <tt/cbm510.h/, and declares several functions common to all CBM platforms. <sect1>CBM 510-specific functions<p> @@ -133,11 +133,11 @@ declaration and usage. The following pseudo variables declared in the <tt/cbm510.h/ header file do allow access to hardware located in the address space. Some variables are -structures, accessing the struct fields will access the chip registers. +structures; accessing the struct fields will access the chip registers. -<bf>Note:</bf> All I/O chips are located in the system bank (bank 15) and can +<bf>Note:</bf> All I/O chips are located in the system bank (bank 15); and can therefore not be accessed like on other platforms. Please use one of the -<tt/peekbsys/, <tt/peekwsys/, <tt/pokebsys/ and <tt/pokewsys/ functions to +<tt/peekbsys/, <tt/peekwsys/, <tt/pokebsys/, and <tt/pokewsys/ functions to access the I/O chips. Direct reads and writes to the structures named below will <em>not</em> work! @@ -164,7 +164,7 @@ will <em>not</em> work! declaration of the structure. <tag><tt/TPI1, TPI2/</tag> - The two 6525 triport chips may be accessed by using this variable. See the + The two 6525 triport chips may be accessed by using these variables. See the <tt/_6525.h/ header file located in the include directory for the declaration of the structure. @@ -196,7 +196,7 @@ No graphics drivers are currently available for the Commodore 510. <descrip> <tag><tt/cbm510-std.joy (cbm510_std_joy)/</tag> - Supports up to two standard joysticks connected to the joysticks port of + Supports up to two standard joysticks connected to the joysticks ports of the Commodore 510. </descrip><p> @@ -247,17 +247,17 @@ Since the program runs in bank 0, and the kernal and all I/O chips are located in bank 15, calling ROM routines or accessing hardware needs special code. The cc65 runtime implements wrappers for all functions in the kernal jump table. While this simplifies things, it should be noted that the wrappers do have -quite an impact on performance: A cross bank call has an extra 300µs +quite an impact on performance: A cross-bank call has an extra 300µs penalty added by the wrapper. <sect1>Interrupts<p> Compiled programs contain an interrupt handler that runs in the program bank. -This has several advantages, one of them being performance (see cross bank +This has several advantages, one of them being performance (see cross-bank call overhead mentioned above). However, this introduces one problem: Interrupts are lost while the CPU executes code in the kernal bank. As a -result, the clock may go wrong and (worse) serial interrupts may get lost. +result, the clock may go wrong; and (worse), serial interrupts may get lost. Since the cc65 runtime does only call the kernal for disk I/O, this means that a program should not do file I/O while it depends on interrupts. @@ -269,8 +269,22 @@ a program should not do file I/O while it depends on interrupts. <sect1>Passing arguments to the program<p> -Command line argument passing is currently not supported for the Commodore -510. +Command-line arguments can be passed to <tt/main()/. Since that is not +supported directly by BASIC, the following syntax was chosen: + +<tscreen><verb> + RUN:REM ARG1 " ARG2 IS QUOTED" ARG3 "" ARG5 +</verb></tscreen> + +<enum> +<item>Arguments are separated by spaces. +<item>Arguments may be quoted. +<item>Leading and trailing spaces around an argument are ignored. Spaces within + a quoted argument are allowed. +<item>The first argument passed to <tt/main()/ is the program name. +<item>A maximum number of 10 arguments (including the program name) are + supported. +</enum> <sect1>Program return code<p> diff --git a/doc/cbm610.sgml b/doc/cbm610.sgml index a6ec4650b..df44f1d76 100644 --- a/doc/cbm610.sgml +++ b/doc/cbm610.sgml @@ -2,9 +2,10 @@ <article> -<title>Commodore 610 specific information for cc65 -<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"> -<date>2003-12-16 +<title>Commodore 610-specific information for cc65 +<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"><newline> +<url url="mailto:greg.king5@verizon.net" name="Greg King"> +<date>2004-04-02 <abstract> An overview over the Commodore 610 runtime system as it is implemented for the @@ -19,11 +20,11 @@ cc65 C compiler. <sect>Overview<p> This file contains an overview of the CBM 610 runtime system as it comes with -the cc65 C compiler. It describes the memory layout, CBM 610 specific header +the cc65 C compiler. It describes the memory layout, CBM 610-specific header files, available drivers, and any pitfalls specific to that platform. -Please note that CBM 610 specific functions are just mentioned here, they are -described in detail in the separate <htmlurl url="funcref.html" name="function +Please note that CBM 610-specific functions are just mentioned here, they are +described in detail in the separate <url url="funcref.html" name="function reference">. Even functions marked as "platform dependent" may be available on more than one platform. Please see the function reference for more information. @@ -31,21 +32,22 @@ information. In addition to the Commodore 610 (named B40 in the U.S.), several other machines are supported by this cc65 target, since they have identical hardware: The Commodore 620 and 630 (more memory, additional coprocessor -card), and the Commodore 710, 720 and 730 (same hardware in another case with -a builtin monitor). +card), and the Commodore 710, 720, and 730 (same hardware in another case with +a built-in monitor). <sect>Binary format<p> The standard binary output format generated by the linker for the Commodore -610 target is a machine language program with a one line BASIC stub, which -transfers control to the machine language running in bank 1. This means that a -program can be loaded as BASIC program and started with RUN. It is of course -possible to change this behaviour by using a modified startup file and linker +610 target is a machine language program with a one-line BASIC stub, which +transfers control to the machine language running in bank 1. That means that a +program can be loaded as a BASIC program, and started with RUN. It is, of course, +possible to change that behaviour by using a modified startup file and linker config. + <sect>Memory layout<p> cc65 generated programs for the Commodore 610 run in bank 1, the memory bank @@ -57,8 +59,8 @@ The default memory configuration for the CBM 610 allocates all memory between $0002 and $FFF0 in bank 1 for the compiled program. Some space in low memory is lost, because a separate hardware stack is set up in page 1, and the kernal replacement functions need some more memory locations. A few -more bytes are lost in high memory, because the runtime sets up a CBM -compatible jump table at $FF81. The main startup code is located at +more bytes are lost in high memory, because the runtime sets up a CBM-compatible +jump table at $FF81. The main startup code is located at $0400, so about 63K of the complete bank are actually usable for applications. @@ -66,25 +68,26 @@ Special locations: <descrip> <tag/Stack/ - The C runtime stack is located at $FF81 and growing downwards. + The C runtime stack is located at $FF81, and grows downwards. <tag/Heap/ - The C heap is located at the end of the program and grows towards the C + The C heap is located at the end of the program, and grows towards the C runtime stack. </descrip><p> -<sect>Platform specific header files<p> +<sect>Platform-specific header files<p> -Programs containing CBM 610 specific code may use the <tt/cbm610.h/ or +Programs containing CBM 610-specific code may use the <tt/cbm610.h/ or <tt/cbm.h/ header files. Using the later may be an option when writing code -for more than one CBM platform, since it includes <tt/cbm610.h/ and declares +for more than one CBM platform, since it includes <tt/cbm610.h/, and declares several functions common to all CBM platforms. -<sect1>CBM 610 specific functions<p> -The functions listed below are special for the CBM 610. See the <htmlurl +<sect1>CBM 610-specific functions<p> + +The functions listed below are special for the CBM 610. See the <url url="funcref.html" name="function reference"> for declaration and usage. <itemize> @@ -95,10 +98,10 @@ url="funcref.html" name="function reference"> for declaration and usage. </itemize> -<sect1>CBM specific functions<p> +<sect1>CBM-specific functions<p> Some functions are available for all (or at least most) of the Commodore -machines. See the <htmlurl url="funcref.html" name="function reference"> for +machines. See the <url url="funcref.html" name="function reference"> for declaration and usage. @@ -128,16 +131,15 @@ declaration and usage. </itemize> - <sect1>Hardware access<p> The following pseudo variables declared in the <tt/cbm610.h/ header file do allow access to hardware located in the address space. Some variables are -structures, accessing the struct fields will access the chip registers. +structures; accessing the struct fields will access the chip registers. -<bf>Note:</bf> All I/O chips are located in the system bank (bank 15) and can +<bf>Note:</bf> All I/O chips are located in the system bank (bank 15); and can therefore not be accessed like on other platforms. Please use one of the -<tt/peekbsys/, <tt/peekwsys/, <tt/pokebsys/ and <tt/pokewsys/ functions to +<tt/peekbsys/, <tt/peekwsys/, <tt/pokebsys/, and <tt/pokewsys/ functions to access the I/O chips. Direct reads and writes to the structures named below will <em>not</em> work! @@ -163,7 +165,7 @@ will <em>not</em> work! declaration of the structure. <tag><tt/TPI1, TPI2/</tag> - The two 6525 triport chips may be accessed by using this variable. See the + The two 6525 triport chips may be accessed by using these variables. See the <tt/_6525.h/ header file located in the include directory for the declaration of the structure. @@ -180,7 +182,7 @@ The names in the parentheses denote the symbols to be used for static linking of No graphics drivers are currently available for the Commodore 610 (and since the machine has no graphics capabilities, chances for a graphics driver aren't -really good:-). +really good :-). <sect1>Extended memory drivers<p> @@ -194,9 +196,8 @@ really good:-). <sect1>Joystick drivers<p> -The Commodore 610 is a business machine and doesn't have joystick ports. There -are no drivers for the non existing ports available. - +The Commodore 610 is a business machine, and doesn't have joystick ports. There +are no drivers for the non-existing ports available. <sect1>Mouse drivers<p> @@ -210,14 +211,15 @@ No mouse drivers are currently available for the Commodore 610. <tag><tt/cbm610-std.ser (cbm610_std_ser)/</tag> Driver for the 6551 ACIA chip built into the Commodore 610. Supports up to - 19200 baud, hardware flow control (RTS/CTS) and interrupt driven receives. - Note that because of the peculiarities of the 6551 chip transmits are not - interrupt driven, and the transceiver blocks if the receiver asserts flow + 19200 BPS, hardware flow control (RTS/CTS), and interrupt-driven receives. + Note that, because of the peculiarities of the 6551 chip, transmits are not + interrupt driven; and, the transceiver blocks if the receiver asserts flow control because of a full buffer. </descrip><p> + <sect>Limitations<label id="limitations"><p> @@ -227,27 +229,44 @@ Since the program runs in bank 1, and the kernal and all I/O chips are located in bank 15, calling ROM routines or accessing hardware needs special code. The cc65 runtime implements wrappers for all functions in the kernal jump table. While this simplifies things, it should be noted that the wrappers do have -quite an impact on performance: A cross bank call has an extra 300µs +quite an impact on performance: A cross-bank call has an extra 300µs penalty added by the wrapper. + <sect1>Interrupts<p> Compiled programs contain an interrupt handler that runs in the program bank. -This has several advantages, one of them being performance (see cross bank +This has several advantages, one of them being performance (see cross-bank call overhead mentioned above). However, this introduces one problem: Interrupts are lost while the CPU executes code in the kernal bank. As a -result, the clock may go wrong and (worse) serial interrupts may get lost. +result, the clock may go wrong; and (worse), serial interrupts may get lost. Since the cc65 runtime does only call the kernal for disk I/O, this means that a program should not do file I/O while it depends on interrupts. + <sect>Other hints<p> + <sect1>Passing arguments to the program<p> -Command line argument passing is currently not supported for the Commodore -610. +Command-line arguments can be passed to <tt/main()/. Since that is not +supported directly by BASIC, the following syntax was chosen: + +<tscreen><verb> + RUN:REM ARG1 " ARG2 IS QUOTED" ARG3 "" ARG5 +</verb></tscreen> + +<enum> +<item>Arguments are separated by spaces. +<item>Arguments may be quoted. +<item>Leading and trailing spaces around an argument are ignored. Spaces within + a quoted argument are allowed. +<item>The first argument passed to <tt/main()/ is the program name. +<item>A maximum number of 10 arguments (including the program name) are + supported. +</enum> <sect1>Program return code<p> @@ -262,7 +281,7 @@ The runtime for the Commodore 610 uses routines marked as <tt/.INTERRUPTOR/ for interrupt handlers. Such routines must be written as simple machine language subroutines and will be called automatically by the interrupt handler code when they are linked into a program. See the discussion of the -<tt/.CONDES/ feature in the <htmlurl url="ca65.html" name="assembler manual">. +<tt/.CONDES/ feature in the <url url="ca65.html" name="assembler manual">. diff --git a/libsrc/cbm510/mainargs.s b/libsrc/cbm510/mainargs.s index 7ed8d46f4..542b1ec65 100644 --- a/libsrc/cbm510/mainargs.s +++ b/libsrc/cbm510/mainargs.s @@ -1,24 +1,156 @@ +; mainargs.s ; -; Ullrich von Bassewitz, 2003-03-07 +; 2003-03-07, Ullrich von Bassewitz, +; based on code from Stefan A. Haubenthal, <polluks@web.de> +; 2005-02-26, Ullrich von Bassewitz +; 2014-04-02, Greg King ; -; Setup arguments for main +; Scan a group of arguments that are in BASIC's input-buffer. +; Build an array that points to the beginning of each argument. +; Send, to main(), that array and the count of the arguments. ; - +; Command-lines look like these lines: +; +; run +; run : rem +; run:rem arg1 " arg 2 is quoted " arg3 "" arg5 +; +; "run" and "rem" are entokenned; the args. are not. Leading and trailing +; spaces outside of quotes are ignored. +; +; TO-DO: +; - The "file-name" might be a path-name; don't copy the directory-components. +; - Add a control-character quoting mechanism. .constructor initmainargs, 24 .import __argc, __argv + .import sys_bank, restore_bank + .import sysp0:zp, ptr1:zp + + .include "cbm510.inc" + .macpack generic -;--------------------------------------------------------------------------- + +MAXARGS = 10 ; Maximum number of arguments allowed +REM = $8f ; BASIC token-code +NAME_LEN = 16 ; maximum length of command-name + ; Get possible command-line arguments. Goes into the special INIT segment, -; which may be reused after the startup code is run - +; which may be reused after the startup code is run. +; .segment "INIT" -.proc initmainargs +initmainargs: +; Assume that the program was loaded, a moment ago, by the traditional LOAD +; statement. Save the "most-recent filename" as argument #0. +; Because the buffer, that we're copying into, was zeroed out, +; we don't need to add a NUL character. +; + jsr sys_bank + ldy #FNAM + lda (sysp0),y ; Get file-name pointer from system bank + sta ptr1 + iny + lda (sysp0),y + sta ptr1+1 + iny ; FNAM_BANK + lda (sysp0),y + tax + ldy #FNAM_LEN + lda (sysp0),y + tay + stx IndReg ; Look for name in correct bank + cpy #NAME_LEN + 1 + blt L1 + ldy #NAME_LEN - 1 ; limit the length +L0: lda (ptr1),y + sta name,y +L1: dey + bpl L0 + jsr restore_bank + inc __argc ; argc always is equal to at least 1 + +; Find a "rem" token. +; + ldx #0 +L2: lda BASIC_BUF,x + bze done ; no "rem," no args. + inx + cmp #REM + bne L2 + ldy #1 * 2 + +; Find the next argument. +; +next: lda BASIC_BUF,x + bze done ; End of line reached + inx + cmp #' ' ; Skip leading spaces + beq next ; + +; Found start of next argument. We've incremented the pointer in X already, so +; it points to the second character of the argument. That is useful because we +; will check now for a quoted argument; in which case, we will have to skip that +; first character. +; +found: cmp #'"' ; Is the argument quoted? + beq setterm ; Jump if so + dex ; Reset pointer to first argument character + lda #' ' ; A space ends the argument +setterm:sta term ; Set end-of-argument marker + +; Now, store a pointer to the argument into the next slot. +; + txa ; Get low byte + add #<BASIC_BUF + sta argv,y ; argv[y]= &arg + lda #>0 + adc #>BASIC_BUF + sta argv+1,y + iny + iny + inc __argc ; Found another arg + +; Search for the end of the argument. +; +argloop:lda BASIC_BUF,x + bze done + inx + cmp term + bne argloop + +; We've found the end of the argument. X points one character behind it, and +; A contains the terminating character. To make the argument a valid C string, +; replace the terminating character by a zero. +; + lda #0 + sta BASIC_BUF-1,x + +; Check if the maximum number of command-line arguments is reached. If not, +; parse the next one. +; + lda __argc ; Get low byte of argument count + cmp #MAXARGS ; Maximum number of arguments reached? + blt next ; Parse next one if not + +; (The last vector in argv[] already is NULL.) +; +done: lda #<argv + ldx #>argv + sta __argv + stx __argv + 1 rts -.endproc - +; These arrays are zeroed before initmainargs is called. +; char name[16+1]; +; char* argv[MAXARGS+1]={name}; +; +.bss +term: .res 1 +name: .res NAME_LEN + 1 +.data +argv: .addr name + .res MAXARGS * 2, 0 diff --git a/libsrc/cbm610/mainargs.s b/libsrc/cbm610/mainargs.s index 7ed8d46f4..9b9aea650 100644 --- a/libsrc/cbm610/mainargs.s +++ b/libsrc/cbm610/mainargs.s @@ -1,24 +1,156 @@ +; mainargs.s ; -; Ullrich von Bassewitz, 2003-03-07 +; 2003-03-07, Ullrich von Bassewitz, +; based on code from Stefan A. Haubenthal, <polluks@web.de> +; 2005-02-26, Ullrich von Bassewitz +; 2014-04-02, Greg King ; -; Setup arguments for main +; Scan a group of arguments that are in BASIC's input-buffer. +; Build an array that points to the beginning of each argument. +; Send, to main(), that array and the count of the arguments. ; - +; Command-lines look like these lines: +; +; run +; run : rem +; run:rem arg1 " arg 2 is quoted " arg3 "" arg5 +; +; "run" and "rem" are entokenned; the args. are not. Leading and trailing +; spaces outside of quotes are ignored. +; +; TO-DO: +; - The "file-name" might be a path-name; don't copy the directory-components. +; - Add a control-character quoting mechanism. .constructor initmainargs, 24 .import __argc, __argv + .import sys_bank, restore_bank + .import sysp0:zp, ptr1:zp + + .include "cbm610.inc" + .macpack generic -;--------------------------------------------------------------------------- + +MAXARGS = 10 ; Maximum number of arguments allowed +REM = $8f ; BASIC token-code +NAME_LEN = 16 ; maximum length of command-name + ; Get possible command-line arguments. Goes into the special INIT segment, -; which may be reused after the startup code is run - +; which may be reused after the startup code is run. +; .segment "INIT" -.proc initmainargs +initmainargs: +; Assume that the program was loaded, a moment ago, by the traditional LOAD +; statement. Save the "most-recent filename" as argument #0. +; Because the buffer, that we're copying into, was zeroed out, +; we don't need to add a NUL character. +; + jsr sys_bank + ldy #FNAM + lda (sysp0),y ; Get file-name pointer from system bank + sta ptr1 + iny + lda (sysp0),y + sta ptr1+1 + iny ; FNAM_BANK + lda (sysp0),y + tax + ldy #FNAM_LEN + lda (sysp0),y + tay + stx IndReg ; Look for name in correct bank + cpy #NAME_LEN + 1 + blt L1 + ldy #NAME_LEN - 1 ; limit the length +L0: lda (ptr1),y + sta name,y +L1: dey + bpl L0 + jsr restore_bank + inc __argc ; argc always is equal to at least 1 + +; Find a "rem" token. +; + ldx #0 +L2: lda BASIC_BUF,x + bze done ; no "rem," no args. + inx + cmp #REM + bne L2 + ldy #1 * 2 + +; Find the next argument. +; +next: lda BASIC_BUF,x + bze done ; End of line reached + inx + cmp #' ' ; Skip leading spaces + beq next ; + +; Found start of next argument. We've incremented the pointer in X already, so +; it points to the second character of the argument. That is useful because we +; will check now for a quoted argument; in which case, we will have to skip that +; first character. +; +found: cmp #'"' ; Is the argument quoted? + beq setterm ; Jump if so + dex ; Reset pointer to first argument character + lda #' ' ; A space ends the argument +setterm:sta term ; Set end-of-argument marker + +; Now, store a pointer to the argument into the next slot. +; + txa ; Get low byte + add #<BASIC_BUF + sta argv,y ; argv[y]= &arg + lda #>0 + adc #>BASIC_BUF + sta argv+1,y + iny + iny + inc __argc ; Found another arg + +; Search for the end of the argument. +; +argloop:lda BASIC_BUF,x + bze done + inx + cmp term + bne argloop + +; We've found the end of the argument. X points one character behind it, and +; A contains the terminating character. To make the argument a valid C string, +; replace the terminating character by a zero. +; + lda #0 + sta BASIC_BUF-1,x + +; Check if the maximum number of command-line arguments is reached. If not, +; parse the next one. +; + lda __argc ; Get low byte of argument count + cmp #MAXARGS ; Maximum number of arguments reached? + blt next ; Parse next one if not + +; (The last vector in argv[] already is NULL.) +; +done: lda #<argv + ldx #>argv + sta __argv + stx __argv + 1 rts -.endproc - +; These arrays are zeroed before initmainargs is called. +; char name[16+1]; +; char* argv[MAXARGS+1]={name}; +; +.bss +term: .res 1 +name: .res NAME_LEN + 1 +.data +argv: .addr name + .res MAXARGS * 2, 0 From 449fceebddc8501a34f9c93c350956c6c3154042 Mon Sep 17 00:00:00 2001 From: Greg King <gregdk@users.sf.net> Date: Thu, 3 Apr 2014 17:28:36 -0400 Subject: [PATCH 21/32] Fixed typo (Ilegal). --- libsrc/cbm/diskinit.s | 2 +- libsrc/cbm/oserrlist.s | 2 +- libsrc/cbm/oserror.s | 2 +- libsrc/cbm/syschdir.s | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libsrc/cbm/diskinit.s b/libsrc/cbm/diskinit.s index d84123a06..8a83a0212 100644 --- a/libsrc/cbm/diskinit.s +++ b/libsrc/cbm/diskinit.s @@ -21,7 +21,7 @@ tax jsr isdisk bcc open - lda #9 ; "Ilegal device" + lda #9 ; "Illegal device" rts ; Open channel diff --git a/libsrc/cbm/oserrlist.s b/libsrc/cbm/oserrlist.s index c85723910..b856ed0a8 100644 --- a/libsrc/cbm/oserrlist.s +++ b/libsrc/cbm/oserrlist.s @@ -48,7 +48,7 @@ __sys_oserrlist: sys_oserr_entry 6, "File not input" sys_oserr_entry 7, "File not output" sys_oserr_entry 8, "Filename missing" - sys_oserr_entry 9, "Ilegal device" + sys_oserr_entry 9, "Illegal device" sys_oserr_entry 20, "Read error" sys_oserr_entry 21, "Read error" sys_oserr_entry 22, "Read error" diff --git a/libsrc/cbm/oserror.s b/libsrc/cbm/oserror.s index 29980548a..6df0d6711 100644 --- a/libsrc/cbm/oserror.s +++ b/libsrc/cbm/oserror.s @@ -40,7 +40,7 @@ ErrTab: .byte 6, EINVAL ; File not input .byte 7, EINVAL ; File not output .byte 8, EINVAL ; Filename missing - .byte 9, ENODEV ; Ilegal device + .byte 9, ENODEV ; Illegal device ; .byte 20, ; Read error ; .byte 21, ; Read error ; .byte 22, ; Read error diff --git a/libsrc/cbm/syschdir.s b/libsrc/cbm/syschdir.s index 78b2df82d..9361d56f0 100644 --- a/libsrc/cbm/syschdir.s +++ b/libsrc/cbm/syschdir.s @@ -74,7 +74,7 @@ init: txa ; Return with error in A -err: lda #9 ; "Ilegal device" +err: lda #9 ; "Illegal device" done: rts .endproc @@ -92,4 +92,4 @@ done: rts @L0: cmp #10 rts -.endproc \ No newline at end of file +.endproc From 79d8a0d857ffafb30170729e201d034d5a329c8a Mon Sep 17 00:00:00 2001 From: Greg King <gregdk@users.sf.net> Date: Tue, 8 Apr 2014 15:36:39 -0400 Subject: [PATCH 22/32] Streamlined the document author credits. --- doc/apple2.sgml | 2 +- doc/apple2enh.sgml | 2 +- doc/ar65.sgml | 2 +- doc/atari.sgml | 7 +++---- doc/atmos.sgml | 5 +++-- doc/c128.sgml | 2 +- doc/c16.sgml | 2 +- doc/c64.sgml | 2 +- doc/ca65.sgml | 2 +- doc/cbm510.sgml | 5 +++-- doc/cbm610.sgml | 5 +++-- doc/cc65.sgml | 2 +- doc/cl65.sgml | 2 +- doc/co65.sgml | 2 +- doc/coding.sgml | 2 +- doc/da65.sgml | 2 +- doc/debugging.sgml | 2 +- doc/dio.sgml | 2 +- doc/funcref.sgml | 2 +- doc/geos.sgml | 2 +- doc/grc65.sgml | 5 +++-- doc/index.sgml | 2 +- doc/intro.sgml | 11 ++++++----- doc/ld65.sgml | 2 +- doc/library.sgml | 2 +- doc/lynx.sgml | 5 +++-- doc/nes.sgml | 5 +++-- doc/od65.sgml | 2 +- doc/pet.sgml | 5 +++-- doc/plus4.sgml | 2 +- doc/sp65.sgml | 2 +- doc/supervision.sgml | 2 +- doc/using-make.sgml | 2 +- doc/vic20.sgml | 5 +++-- 34 files changed, 57 insertions(+), 49 deletions(-) diff --git a/doc/apple2.sgml b/doc/apple2.sgml index 940496a41..036f37207 100644 --- a/doc/apple2.sgml +++ b/doc/apple2.sgml @@ -3,7 +3,7 @@ <article> <title>Apple ][ specific information for cc65 -<author>Oliver Schmidt, <htmlurl url="mailto:ol.sc@web.de" name="ol.sc@web.de"> +<author><url url="mailto:ol.sc@web.de" name="Oliver Schmidt"> <date>2009-10-07 <abstract> diff --git a/doc/apple2enh.sgml b/doc/apple2enh.sgml index 87f993927..95a8c084c 100644 --- a/doc/apple2enh.sgml +++ b/doc/apple2enh.sgml @@ -3,7 +3,7 @@ <article> <title>Enhanced Apple //e specific information for cc65 -<author>Oliver Schmidt, <htmlurl url="mailto:ol.sc@web.de" name="ol.sc@web.de"> +<author><url url="mailto:ol.sc@web.de" name="Oliver Schmidt"> <date>2009-10-07 <abstract> diff --git a/doc/ar65.sgml b/doc/ar65.sgml index d35bc9987..136defd40 100644 --- a/doc/ar65.sgml +++ b/doc/ar65.sgml @@ -3,7 +3,7 @@ <article> <title>ar65 Users Guide -<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"> +<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> <date>19.07.2000 <abstract> diff --git a/doc/atari.sgml b/doc/atari.sgml index 007a95039..4b848575d 100644 --- a/doc/atari.sgml +++ b/doc/atari.sgml @@ -3,10 +3,9 @@ <article> <title>Atari specific information for cc65 -<author>Shawn Jefferson, <htmlurl -url="mailto:shawnjefferson@24fightingchickens.com" -name="shawnjefferson@24fightingchickens.com"> and -Christian Groessler, <htmlurl url="mailto:chris@groessler.org" name="chris@groessler.org"> +<author> +<url url="mailto:shawnjefferson@24fightingchickens.com" name="Shawn Jefferson"> and<newline> +<url url="mailto:chris@groessler.org" name="Christian Groessler"> <date>2014-03-27 <abstract> diff --git a/doc/atmos.sgml b/doc/atmos.sgml index 86f6b1154..805fc7a03 100644 --- a/doc/atmos.sgml +++ b/doc/atmos.sgml @@ -3,8 +3,9 @@ <article> <title>Oric Atmos-specific information for cc65 -<author>Ullrich von Bassewitz <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"><newline> -Stefan A. Haubenthal <htmlurl url="mailto:polluks@sdf.lonestar.org" name="polluks@sdf.lonestar.org"><newline> +<author> +<url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline> +<url url="mailto:polluks@sdf.lonestar.org" name="Stefan A. Haubenthal">,<newline> <url url="mailto:greg.king5@verizon.net" name="Greg King"> <date>2014-03-27 diff --git a/doc/c128.sgml b/doc/c128.sgml index a51767e69..3309d68af 100644 --- a/doc/c128.sgml +++ b/doc/c128.sgml @@ -3,7 +3,7 @@ <article> <title>Commodore 128-specific information for cc65 -<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"> +<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> <date>2014-03-24 <abstract> diff --git a/doc/c16.sgml b/doc/c16.sgml index 5d4a5d372..a1317a0b5 100644 --- a/doc/c16.sgml +++ b/doc/c16.sgml @@ -3,7 +3,7 @@ <article> <title>Commodore 16/116 specific information for cc65 -<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"> +<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> <date>2003-12-15 <abstract> diff --git a/doc/c64.sgml b/doc/c64.sgml index 2883ce79e..cef7f6467 100644 --- a/doc/c64.sgml +++ b/doc/c64.sgml @@ -3,7 +3,7 @@ <article> <title>Commodore 64-specific information for cc65 -<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"> +<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> <date>2014-03-24 <abstract> diff --git a/doc/ca65.sgml b/doc/ca65.sgml index 364790b52..46c1f4457 100644 --- a/doc/ca65.sgml +++ b/doc/ca65.sgml @@ -2,7 +2,7 @@ <article> <title>ca65 Users Guide -<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"> +<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> <date>2000-07-19, 2000-11-29, 2001-10-02, 2005-09-08 <abstract> diff --git a/doc/cbm510.sgml b/doc/cbm510.sgml index 3389bd4e1..3d01ab5bb 100644 --- a/doc/cbm510.sgml +++ b/doc/cbm510.sgml @@ -3,8 +3,9 @@ <article> <title>Commodore 510 (aka P500) specific information for cc65 -<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"><newline> -Stefan A. Haubenthal, <htmlurl url="mailto:polluks@sdf.lonestar.org" name="polluks@sdf.lonestar.org"><newline> +<author> +<url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline> +<url url="mailto:polluks@sdf.lonestar.org" name="Stefan A. Haubenthal">,<newline> <url url="mailto:greg.king5@verizon.net" name="Greg King"> <date>2014-04-02 diff --git a/doc/cbm610.sgml b/doc/cbm610.sgml index df44f1d76..2025c0792 100644 --- a/doc/cbm610.sgml +++ b/doc/cbm610.sgml @@ -3,9 +3,10 @@ <article> <title>Commodore 610-specific information for cc65 -<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"><newline> +<author> +<url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline> <url url="mailto:greg.king5@verizon.net" name="Greg King"> -<date>2004-04-02 +<date>2014-04-02 <abstract> An overview over the Commodore 610 runtime system as it is implemented for the diff --git a/doc/cc65.sgml b/doc/cc65.sgml index 1079782bb..275a73168 100644 --- a/doc/cc65.sgml +++ b/doc/cc65.sgml @@ -2,7 +2,7 @@ <article> <title>cc65 Users Guide -<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"> +<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> <date>2000-09-03, 2001-10-02, 2005-08-01 <abstract> diff --git a/doc/cl65.sgml b/doc/cl65.sgml index 2667ab555..6e044b8d5 100644 --- a/doc/cl65.sgml +++ b/doc/cl65.sgml @@ -2,7 +2,7 @@ <article> <title>cl65 Users Guide -<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"> +<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> <date>01.08.2000, 27.11.2000, 02.10.2001 <abstract> diff --git a/doc/co65.sgml b/doc/co65.sgml index ea75dcf7c..9d70ffe6a 100644 --- a/doc/co65.sgml +++ b/doc/co65.sgml @@ -2,7 +2,7 @@ <article> <title>co65 Users Guide -<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"> +<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> <date>12.02.2003 <abstract> diff --git a/doc/coding.sgml b/doc/coding.sgml index 1aa454f12..f6dfc3a35 100644 --- a/doc/coding.sgml +++ b/doc/coding.sgml @@ -2,7 +2,7 @@ <article> <title>cc65 coding hints -<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"> +<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> <date>2000-12-03, 2009-09-01 <abstract> diff --git a/doc/da65.sgml b/doc/da65.sgml index 4dd6800d5..2b8cdb2a3 100644 --- a/doc/da65.sgml +++ b/doc/da65.sgml @@ -2,7 +2,7 @@ <article> <title>da65 Users Guide -<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"> +<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> <date>2003-08-08 <abstract> diff --git a/doc/debugging.sgml b/doc/debugging.sgml index 7566370b9..320aa0359 100644 --- a/doc/debugging.sgml +++ b/doc/debugging.sgml @@ -3,7 +3,7 @@ <article> <title>Using emulators with cc65 -<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"> +<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> <date>03.12.2000 <abstract> diff --git a/doc/dio.sgml b/doc/dio.sgml index f340fa254..fe0a89983 100644 --- a/doc/dio.sgml +++ b/doc/dio.sgml @@ -2,7 +2,7 @@ <article> <title>Diskette Sector I/O Routines -<author>Christian Groessler, <htmlurl url="mailto:chris@groessler.org" name="chris@groessler.org"> +<author><url url="mailto:chris@groessler.org" name="Christian Groessler"> <date>20-Feb-2005 <abstract> diff --git a/doc/funcref.sgml b/doc/funcref.sgml index ba8fb8abc..85b4c266e 100644 --- a/doc/funcref.sgml +++ b/doc/funcref.sgml @@ -2,7 +2,7 @@ <article> <title>cc65 function reference -<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"> +<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> <date>07.11.2002 <abstract> diff --git a/doc/geos.sgml b/doc/geos.sgml index 8a5a948a1..d1604bc9c 100644 --- a/doc/geos.sgml +++ b/doc/geos.sgml @@ -5,7 +5,7 @@ <!-- Title information --> <title>GEOSLib docs -<author>Maciej Witkowiak, <htmlurl url="mailto:ytm@elysium.pl" name="ytm@elysium.pl"> +<author><url url="mailto:ytm@elysium.pl" name="Maciej Witkowiak"> <date>v1.5, 26.12.1999, 2000, 2001, 2002, 2003, 2005 <abstract> This is the documentation of cc65's GEOSLib, but information contained here may be also diff --git a/doc/grc65.sgml b/doc/grc65.sgml index d2433f65a..49d3f6798 100644 --- a/doc/grc65.sgml +++ b/doc/grc65.sgml @@ -4,8 +4,9 @@ <!-- Title information --> <title>grc65 -- GEOS Resource Compiler -<author><url name="Maciej 'YTM/Elysium' Witkowiak" url="mailto:ytm@elysium.pl"> -<and><url name="Greg King" url="mailto:gngking@erols.com"> +<author> +<url url="mailto:ytm@elysium.pl" name="Maciej 'YTM/Elysium' Witkowiak">,<newline> +<url url="mailto:greg.king5@verizon.net" name="Greg King"> <date>VII 2000; VI,VII 2002; 2005-8-3 <abstract> This document describes a compiler that can create GEOS headers and menues for diff --git a/doc/index.sgml b/doc/index.sgml index 1e78a2cdc..f9eed769d 100644 --- a/doc/index.sgml +++ b/doc/index.sgml @@ -2,7 +2,7 @@ <article> <title>cc65 Documentation Overview -<author><htmlurl url="https://github.com/oliverschmidt/cc65" name=""> +<author><url url="https://github.com/cc65/cc65/"> <date> <sect>Program documentation<p> diff --git a/doc/intro.sgml b/doc/intro.sgml index 1db4c0c04..d9f6c863a 100644 --- a/doc/intro.sgml +++ b/doc/intro.sgml @@ -3,9 +3,10 @@ <article> <title>cc65 Compiler Intro -<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">, -<and>CbmNut, <htmlurl url="mailto:cbmnut@hushmail.com" name="cbmnut@hushmail.com">, -<and><url name="Greg King" url="mailto:gngking@erols.com"> +<author> +<url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline> +<url url="mailto:cbmnut@hushmail.com" name="CbmNut">,<newline> +<url url="mailto:greg.king5@verizon.net" name="Greg King"> <date>2005-7-22 <abstract> @@ -285,8 +286,8 @@ Apple: BRUN TEST </verb></tscreen> -You will see the "Hello, World!" appear on the same line. Thanks to Oliver -Schmidt, <htmlurl url="mailto:ol.sc@web.de" name="ol.sc@web.de"> for his help +You will see "Hello, World!" appear on the same line. Thanks to +<url url="mailto:ol.sc@web.de" name="Oliver Schmidt"> for his help in completing this section. diff --git a/doc/ld65.sgml b/doc/ld65.sgml index 4f74b04c1..c92761c0a 100644 --- a/doc/ld65.sgml +++ b/doc/ld65.sgml @@ -2,7 +2,7 @@ <article> <title>ld65 Users Guide -<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"> +<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> <date>02.12.2000, 02.10.2001 <abstract> diff --git a/doc/library.sgml b/doc/library.sgml index 6c2ced433..16bd2dc5e 100644 --- a/doc/library.sgml +++ b/doc/library.sgml @@ -3,7 +3,7 @@ <article> <title>cc65 Library Overview -<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"> +<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> <date>2000-12-02, 2002-11-26 <abstract> diff --git a/doc/lynx.sgml b/doc/lynx.sgml index f83552e50..720c68af6 100644 --- a/doc/lynx.sgml +++ b/doc/lynx.sgml @@ -3,8 +3,9 @@ <article> <title>Atari Lynx specific information for cc65 -<author>Karri Kaksonen, <htmlurl url="mailto:karri@sipo.fi" name="karri@sipo.fi"> -Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"> +<author> +<url url="mailto:karri@sipo.fi" name="Karri Kaksonen">,<newline> +<url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> <date>2011-04-01 <abstract> diff --git a/doc/nes.sgml b/doc/nes.sgml index 5d465c813..b40a0d30d 100644 --- a/doc/nes.sgml +++ b/doc/nes.sgml @@ -3,8 +3,9 @@ <article> <title>Nintendo Entertainment System specific information for cc65 -<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"> -Stefan A. Haubenthal, <htmlurl url="mailto:polluks@sdf.lonestar.org" name="polluks@sdf.lonestar.org"> +<author> +<url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline> +<url url="mailto:polluks@sdf.lonestar.org" name="Stefan A. Haubenthal"> <date>2005-07-17 <abstract> diff --git a/doc/od65.sgml b/doc/od65.sgml index a1960109d..1f237b006 100644 --- a/doc/od65.sgml +++ b/doc/od65.sgml @@ -2,7 +2,7 @@ <article> <title>od65 Users Guide -<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"> +<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> <date>2010-07-30 <abstract> diff --git a/doc/pet.sgml b/doc/pet.sgml index b0fa0e1e8..01a88c67c 100644 --- a/doc/pet.sgml +++ b/doc/pet.sgml @@ -3,8 +3,9 @@ <article> <title>Commodore PET-specific information for cc65 -<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"><newline> -Stefan A. Haubenthal, <htmlurl url="mailto:polluks@sdf.lonestar.org" name="polluks@sdf.lonestar.org"> +<author> +<url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline> +<url url="mailto:polluks@sdf.lonestar.org" name="Stefan A. Haubenthal"> <date>2014-03-26 <abstract> diff --git a/doc/plus4.sgml b/doc/plus4.sgml index a16eef9d3..3a3da728a 100644 --- a/doc/plus4.sgml +++ b/doc/plus4.sgml @@ -3,7 +3,7 @@ <article> <title>Commodore Plus/4 specific information for cc65 -<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"> +<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> <date>2003-12-14 <abstract> diff --git a/doc/sp65.sgml b/doc/sp65.sgml index 3cf749e20..909ac6d25 100644 --- a/doc/sp65.sgml +++ b/doc/sp65.sgml @@ -2,7 +2,7 @@ <article> <title>sp65 Users Guide -<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"> +<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> <date>2012-03-11 <abstract> diff --git a/doc/supervision.sgml b/doc/supervision.sgml index 0aa990ac5..fcf05878e 100644 --- a/doc/supervision.sgml +++ b/doc/supervision.sgml @@ -3,7 +3,7 @@ <article> <title>Watara Supervision specific information for cc65 -<author>Stefan A. Haubenthal, <htmlurl url="mailto:polluks@sdf.lonestar.org" name="polluks@sdf.lonestar.org"> +<author><url url="mailto:polluks@sdf.lonestar.org" name="Stefan A. Haubenthal"> <date>2005-07-17 <abstract> diff --git a/doc/using-make.sgml b/doc/using-make.sgml index 5affe3b9f..f104379f0 100644 --- a/doc/using-make.sgml +++ b/doc/using-make.sgml @@ -3,7 +3,7 @@ <article> <title>Using GNU Make with cc65 -<author>Oliver Schmidt, <htmlurl url="mailto:ol.sc@web.de" name="ol.sc@web.de"> +<author><url url="mailto:ol.sc@web.de" name="Oliver Schmidt"> <date>2009-06-26 <abstract> diff --git a/doc/vic20.sgml b/doc/vic20.sgml index f02bd63d9..ce58dad50 100644 --- a/doc/vic20.sgml +++ b/doc/vic20.sgml @@ -3,8 +3,9 @@ <article> <title>Commodore VIC20 (aka VC20) specific information for cc65 -<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"><newline> -Stefan A. Haubenthal, <htmlurl url="mailto:polluks@sdf.lonestar.org" name="polluks@sdf.lonestar.org"> +<author> +<url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline> +<url url="mailto:polluks@sdf.lonestar.org" name="Stefan A. Haubenthal"> <date>2014-03-26 <abstract> From 661203a89abbbe0c3e6b7fc13e3b1d28d6707a8a Mon Sep 17 00:00:00 2001 From: Christian Groessler <chris@groessler.org> Date: Thu, 10 Apr 2014 02:31:28 +0200 Subject: [PATCH 23/32] initial version of a P/M mouse callback --- libsrc/atari/mcbpm.s | 204 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 204 insertions(+) create mode 100644 libsrc/atari/mcbpm.s diff --git a/libsrc/atari/mcbpm.s b/libsrc/atari/mcbpm.s new file mode 100644 index 000000000..c7a350d05 --- /dev/null +++ b/libsrc/atari/mcbpm.s @@ -0,0 +1,204 @@ +; +; P/M mouse callbacks for the Ataris +; +; Christian Groessler, 07.04.2014 +; +; All functions in this module should be interrupt safe, because they may +; be called from an interrupt handler +; + + .include "atari.inc" + .importzp sp + .constructor pm_init,27 + .destructor pm_down,7 + .export _mouse_pm_callbacks + + +; P/M definitions. The first value can be changed to adjust the number +; of the P/M used for the mouse. All others depend on this value. +; Valid P/M numbers are 0 to 4. When 4 is used, the missiles are used +; as a player. +MOUSE_PM_NUM = 4 ; P/M used for the mouse +MOUSE_PM_BASE = pm_base + +.if MOUSE_PM_NUM = 4 +MOUSE_PM_RAW = 0 +.macro set_mouse_x + ; assume CF = 0 + sta HPOSM3 + adc #2 + sta HPOSM2 + adc #2 + sta HPOSM1 + adc #2 + sta HPOSM0 +.endmacro +.else +MOUSE_PM_RAW = MOUSE_PM_NUM + 1 +.macro set_mouse_x + sta HPOSP0 + MOUSE_PM_NUM +.endmacro +.endif + +; ------------------------------------------------------------------------ + + .rodata + + ; Callback structure +_mouse_pm_callbacks: + .addr hide + .addr show + .addr prep + .addr draw + .addr movex + .addr movey + +; ------------------------------------------------------------------------ + + .bss + +omy: .res 1 ; Old Mouse Y position + +; ------------------------------------------------------------------------ + + .segment "EXTZP" : zeropage + +pm_base:.res 2 + +; ------------------------------------------------------------------------ + + .code + +; Hide the mouse cursor. +hide: lda #0 + sta GRACTL + rts + +; Show the mouse cursor. +show: +.if MOUSE_PM_NUM < 4 + lda #2 +.else + lda #1 +.endif + sta GRACTL + ;rts + +prep: +draw: + rts + +; Move the mouse cursor x position to the value in A/X. +movex: cpx #1 + ror a + clc + adc #48 + set_mouse_x + rts + +; Move the mouse cursor y position to the value in A/X. +movey: clc + adc #32 + pha + lda omy + jsr clr_pm ; remove player at old position + pla + sta omy + ;jmp set_pm ; put player to new position + +; Set P/M data from 'mouse_bits' +set_pm: tay + ldx #0 +set_l: lda mouse_bits,x + sta (MOUSE_PM_BASE),y + inx + iny + cpx #mouse_height + bcc set_l + rts + +; Clear (zero) P/M data +clr_pm: ldx #mouse_height + tay + lda #0 +clr_l: sta (MOUSE_PM_BASE),y + iny + dex + bne clr_l + rts + + +pm_down = hide + + +; ------------------------------------------------------------------------ + + .segment "INIT" + +pm_init:lda #0 + sta sp + sta MOUSE_PM_BASE + lda sp+1 + and #7 ; offset within 2K + cmp #3 + MOUSE_PM_RAW + 1 ; can we use it? + bcc @decr ; no + + lda sp+1 + and #$F8 +@set: adc #3 + MOUSE_PM_RAW - 1 ; CF is set, so adding MOUSE_PM_RAW + 3 + sta MOUSE_PM_BASE+1 + sta sp+1 + bne @cont + +@decr: lda sp+1 + and #$F8 + sbc #8 - 1 ; CF is clear, subtracts 8 + bcs @set ; jump always + +@cont: lda #0 + tay +@iniloo:sta (MOUSE_PM_BASE),y + iny + bne @iniloo + + lda MOUSE_PM_BASE+1 + and #$F8 + sta PMBASE + + lda #62 + sta SDMCTL + + lda #1 + 16 + sta GPRIOR + + lda #0 + +.if MOUSE_PM_NUM = 4 + sta PCOLR0 + sta PCOLR1 + sta PCOLR2 + sta PCOLR3 + sta SIZEM +.else + sta PCOLR0 + MOUSE_PM_NUM + sta SIZEP0 + MOUSE_PM_NUM +.endif + rts + + +; ------------------------------------------------------------------------ + + .data + +mouse_bits: + .byte %11110000 + .byte %11000000 + .byte %10100000 + .byte %10010000 + .byte %10001000 + .byte %00000100 + .byte %00000010 +; .byte %00000000 + +mouse_height = * - mouse_bits + From 526b440b2493629a36b3499fc51ea0df8ecf4ee2 Mon Sep 17 00:00:00 2001 From: Christian Groessler <chris@groessler.org> Date: Fri, 11 Apr 2014 23:46:53 +0200 Subject: [PATCH 24/32] - always use page 6 for P/M mouse cursor - make cursor character of text mode callback configurable - change default cursor character of text mode callback from 'plus' to 'diamond' - set P/M callback as default --- libsrc/atari/mcbdefault.s | 126 +--------------------- libsrc/atari/mcbpm-shape.s | 32 ++++++ libsrc/atari/mcbpm.s | 185 ++++++++++++++++----------------- libsrc/atari/mcbtxtchar-char.s | 9 ++ libsrc/atari/mcbtxtchar.s | 125 ++++++++++++++++++++++ 5 files changed, 257 insertions(+), 220 deletions(-) create mode 100644 libsrc/atari/mcbpm-shape.s create mode 100644 libsrc/atari/mcbtxtchar-char.s create mode 100644 libsrc/atari/mcbtxtchar.s diff --git a/libsrc/atari/mcbdefault.s b/libsrc/atari/mcbdefault.s index ac5056cf9..75a7c74bc 100644 --- a/libsrc/atari/mcbdefault.s +++ b/libsrc/atari/mcbdefault.s @@ -1,126 +1,8 @@ ; -; Default mouse callbacks for the Ataris -; -; Christian Groessler, 03.01.2014 -; -; derived from Apple2 version by -; Oliver Schmidt, 22.09.2005 -; -; All functions in this module should be interrupt safe, because they may -; be called from an interrupt handler +; This file defines the default mouse callback ; - .export _mouse_def_callbacks - .importzp tmp4 - .import mul40,loc_tmp +.import _mouse_pm_callbacks +.export _mouse_def_callbacks - .include "atari.inc" - -; ------------------------------------------------------------------------ - - .bss - -backup: .res 1 -visible:.res 1 - -; ------------------------------------------------------------------------ - - .segment "EXTZP" : zeropage -scrptr: .res 2 - -; ------------------------------------------------------------------------ - - - .rodata - - ; Callback structure -_mouse_def_callbacks: - .addr hide - .addr show - .addr prep - .addr draw - .addr movex - .addr movey - -; ------------------------------------------------------------------------ - - .data - -cursor = 11 ; '+' screen code' - -; setcursor - -getcursor: -column: ldy #$00 ; Patched at runtime - lda (scrptr),y - rts - -setcursor: -column2:ldy #$00 ; Patched at runtime - sta (scrptr),y - rts - -; ------------------------------------------------------------------------ - - .code - -done: - rts - -; Hide the mouse cursor. -hide: - dec visible - -prep: - jsr getcursor ; Get character at cursor position - cmp #cursor ; "mouse" character - bne overwr ; no, probably program has overwritten it - lda backup ; - jmp setcursor ; Draw character -overwr: sta backup - rts - -; Show the mouse cursor. -show: - inc visible - -draw: - lda visible - beq done - jsr getcursor ; Cursor visible at current position? - sta backup ; Save character at cursor position - lda #cursor - jmp setcursor ; Draw cursor - - -; Move the mouse cursor x position to the value in A/X. -movex: - cpx #1 - ror a - lsr a ; convert to character position - lsr a - sta column+1 - sta column2+1 - rts - -; Move the mouse cursor y position to the value in A/X. -movey: - tax - ldy tmp4 ; mul40 uses tmp4 - lda loc_tmp ; and this local variable - pha - txa ; get parameter back - lsr a ; convert y position to character line - lsr a - lsr a - jsr mul40 - clc - adc SAVMSC - sta scrptr - txa - adc SAVMSC+1 - sta scrptr+1 - pla - sta loc_tmp - sty tmp4 - rts +_mouse_def_callbacks := _mouse_pm_callbacks diff --git a/libsrc/atari/mcbpm-shape.s b/libsrc/atari/mcbpm-shape.s new file mode 100644 index 000000000..baf8c0020 --- /dev/null +++ b/libsrc/atari/mcbpm-shape.s @@ -0,0 +1,32 @@ +; +; P/M mouse shape default definition +; +; Christian Groessler, 11.04.2014 +; +; Note that the height of the mouse cursor must not exceed 32 +; lines, otherwise the display routines won't do The Right +; Thing(tm). +; + + .export mouse_pm_bits + .export mouse_pm_height : absolute + .export mouse_pm_hotspot_x : absolute + .export mouse_pm_hotspot_y : absolute + + + .data + +mouse_pm_bits: + .byte %11110000 + .byte %11000000 + .byte %10100000 + .byte %10010000 + .byte %10001000 + .byte %00000100 + .byte %00000010 + +mouse_pm_height = * - mouse_pm_bits + +; hot spot is upper left corner +mouse_pm_hotspot_x = 0 +mouse_pm_hotspot_y = 0 diff --git a/libsrc/atari/mcbpm.s b/libsrc/atari/mcbpm.s index c7a350d05..b431ac414 100644 --- a/libsrc/atari/mcbpm.s +++ b/libsrc/atari/mcbpm.s @@ -1,42 +1,48 @@ ; ; P/M mouse callbacks for the Ataris ; -; Christian Groessler, 07.04.2014 +; Christian Groessler, 11.04.2014 ; ; All functions in this module should be interrupt safe, because they may ; be called from an interrupt handler ; .include "atari.inc" - .importzp sp + .importzp sp + .export _mouse_pm_callbacks .constructor pm_init,27 .destructor pm_down,7 - .export _mouse_pm_callbacks + +; get mouse shape data + .import mouse_pm_bits + .import mouse_pm_height + .import mouse_pm_hotspot_x + .import mouse_pm_hotspot_y ; P/M definitions. The first value can be changed to adjust the number ; of the P/M used for the mouse. All others depend on this value. ; Valid P/M numbers are 0 to 4. When 4 is used, the missiles are used ; as a player. -MOUSE_PM_NUM = 4 ; P/M used for the mouse -MOUSE_PM_BASE = pm_base +MOUSE_PM_NUM = 2 ; P/M used for the mouse +MOUSE_PM_BASE = pm_base ; ZP location pointing to the hw area used by the selected P/M .if MOUSE_PM_NUM = 4 -MOUSE_PM_RAW = 0 -.macro set_mouse_x - ; assume CF = 0 - sta HPOSM3 - adc #2 - sta HPOSM2 - adc #2 - sta HPOSM1 - adc #2 - sta HPOSM0 +MOUSE_PM_RAW = 0 ; MOUSE_PM_RAW is the hardware P/M number for MOUSE_PM_NUM +.macro set_mouse_x + ; assume CF = 0 + sta HPOSM3 + adc #2 + sta HPOSM2 + adc #2 + sta HPOSM1 + adc #2 + sta HPOSM0 .endmacro .else -MOUSE_PM_RAW = MOUSE_PM_NUM + 1 -.macro set_mouse_x - sta HPOSP0 + MOUSE_PM_NUM +MOUSE_PM_RAW = MOUSE_PM_NUM + 1 +.macro set_mouse_x + sta HPOSP0 + MOUSE_PM_NUM .endmacro .endif @@ -57,7 +63,8 @@ _mouse_pm_callbacks: .bss -omy: .res 1 ; Old Mouse Y position +omy: .res 1 ; old Mouse Y position +colhlp: .res 1 ; helper variable to set P/M color ; ------------------------------------------------------------------------ @@ -72,7 +79,7 @@ pm_base:.res 2 ; Hide the mouse cursor. hide: lda #0 sta GRACTL - rts + rts ; Show the mouse cursor. show: @@ -82,88 +89,100 @@ show: lda #1 .endif sta GRACTL - ;rts + ;rts ; optimized out prep: draw: rts ; Move the mouse cursor x position to the value in A/X. -movex: cpx #1 - ror a - clc - adc #48 - set_mouse_x - rts +movex: cpx #1 + ror a + clc + adc #48 + sbc #<(mouse_pm_hotspot_x - 1) + set_mouse_x + jmp update_colors ; Move the mouse cursor y position to the value in A/X. movey: clc - adc #32 - pha + adc #32 + sbc #<(mouse_pm_hotspot_y - 1) + pha lda omy jsr clr_pm ; remove player at old position + jsr update_colors pla sta omy ;jmp set_pm ; put player to new position + ; fall thru -; Set P/M data from 'mouse_bits' +; Set P/M data from 'mouse_pm_bits' set_pm: tay ldx #0 -set_l: lda mouse_bits,x +set_l: lda mouse_pm_bits,x sta (MOUSE_PM_BASE),y inx iny - cpx #mouse_height + beq set_end + cpx #<mouse_pm_height bcc set_l - rts +set_end:rts ; Clear (zero) P/M data -clr_pm: ldx #mouse_height +clr_pm: ldx #<mouse_pm_height tay lda #0 clr_l: sta (MOUSE_PM_BASE),y iny + beq clr_end dex bne clr_l +clr_end:rts + + +pm_down = hide + + +; this assumes a GRAPHICS 0 screen +update_colors: + lda COLOR2 ; get background color + and #$F0 + sta colhlp + lda COLOR1 + and #$0F + ora colhlp + +.if MOUSE_PM_NUM = 4 + sta PCOLR0 + sta PCOLR1 + sta PCOLR2 + sta PCOLR3 + sta SIZEM +.else + sta PCOLR0 + MOUSE_PM_NUM + sta SIZEP0 + MOUSE_PM_NUM +.endif rts - -pm_down = hide - - ; ------------------------------------------------------------------------ - .segment "INIT" + .segment "INIT" -pm_init:lda #0 - sta sp - sta MOUSE_PM_BASE - lda sp+1 - and #7 ; offset within 2K - cmp #3 + MOUSE_PM_RAW + 1 ; can we use it? - bcc @decr ; no +pm_init:lda #0 + sta MOUSE_PM_BASE + ldx #6 ; page 6 + stx MOUSE_PM_BASE+1 + tay +@iniloo:sta (MOUSE_PM_BASE),y + iny + bne @iniloo - lda sp+1 - and #$F8 -@set: adc #3 + MOUSE_PM_RAW - 1 ; CF is set, so adding MOUSE_PM_RAW + 3 - sta MOUSE_PM_BASE+1 - sta sp+1 - bne @cont - -@decr: lda sp+1 - and #$F8 - sbc #8 - 1 ; CF is clear, subtracts 8 - bcs @set ; jump always - -@cont: lda #0 - tay -@iniloo:sta (MOUSE_PM_BASE),y - iny - bne @iniloo - - lda MOUSE_PM_BASE+1 - and #$F8 - sta PMBASE +.if 0 ; enable if not using page 6 for P/M data + lda MOUSE_PM_BASE+1 + and #$F8 +.endif + sta PMBASE lda #62 sta SDMCTL @@ -171,34 +190,4 @@ pm_init:lda #0 lda #1 + 16 sta GPRIOR - lda #0 - -.if MOUSE_PM_NUM = 4 - sta PCOLR0 - sta PCOLR1 - sta PCOLR2 - sta PCOLR3 - sta SIZEM -.else - sta PCOLR0 + MOUSE_PM_NUM - sta SIZEP0 + MOUSE_PM_NUM -.endif - rts - - -; ------------------------------------------------------------------------ - - .data - -mouse_bits: - .byte %11110000 - .byte %11000000 - .byte %10100000 - .byte %10010000 - .byte %10001000 - .byte %00000100 - .byte %00000010 -; .byte %00000000 - -mouse_height = * - mouse_bits - + jmp update_colors diff --git a/libsrc/atari/mcbtxtchar-char.s b/libsrc/atari/mcbtxtchar-char.s new file mode 100644 index 000000000..46462c11a --- /dev/null +++ b/libsrc/atari/mcbtxtchar-char.s @@ -0,0 +1,9 @@ +; +; Default text mode mouse cursor character +; +; Christian Groessler, 11.04.2014 +; + + .export mouse_txt_char : absolute + +mouse_txt_char = 96 ; 'diamond' screen code diff --git a/libsrc/atari/mcbtxtchar.s b/libsrc/atari/mcbtxtchar.s new file mode 100644 index 000000000..a80fe8f43 --- /dev/null +++ b/libsrc/atari/mcbtxtchar.s @@ -0,0 +1,125 @@ +; +; Text mode character mouse callbacks for the Ataris +; +; Christian Groessler, 03.01.2014 +; +; derived from Apple2 version by +; Oliver Schmidt, 22.09.2005 +; +; All functions in this module should be interrupt safe, because they may +; be called from an interrupt handler +; + + .export _mouse_txt_callbacks + .importzp tmp4 + .import mul40,loc_tmp + .import mouse_txt_char ; screen code of mouse cursor + + .include "atari.inc" + +; ------------------------------------------------------------------------ + + .bss + +backup: .res 1 +visible:.res 1 + +; ------------------------------------------------------------------------ + + .segment "EXTZP" : zeropage +scrptr: .res 2 + +; ------------------------------------------------------------------------ + + + .rodata + + ; Callback structure +_mouse_txt_callbacks: + .addr hide + .addr show + .addr prep + .addr draw + .addr movex + .addr movey + +; ------------------------------------------------------------------------ + + .data + +; setcursor + +getcursor: +column: ldy #$00 ; Patched at runtime + lda (scrptr),y + rts + +setcursor: +column2:ldy #$00 ; Patched at runtime + sta (scrptr),y + rts + +; ------------------------------------------------------------------------ + + .code + +done: + rts + +; Hide the mouse cursor. +hide: + dec visible + +prep: + jsr getcursor ; Get character at cursor position + cmp #<mouse_txt_char; "mouse" character + bne overwr ; no, probably program has overwritten it + lda backup ; + jmp setcursor ; Draw character +overwr: sta backup + rts + +; Show the mouse cursor. +show: + inc visible + +draw: + lda visible + beq done + jsr getcursor ; Cursor visible at current position? + sta backup ; Save character at cursor position + lda #<mouse_txt_char + jmp setcursor ; Draw cursor + + +; Move the mouse cursor x position to the value in A/X. +movex: + cpx #1 + ror a + lsr a ; convert to character position + lsr a + sta column+1 + sta column2+1 + rts + +; Move the mouse cursor y position to the value in A/X. +movey: + tax + ldy tmp4 ; mul40 uses tmp4 + lda loc_tmp ; and this local variable + pha + txa ; get parameter back + lsr a ; convert y position to character line + lsr a + lsr a + jsr mul40 + clc + adc SAVMSC + sta scrptr + txa + adc SAVMSC+1 + sta scrptr+1 + pla + sta loc_tmp + sty tmp4 + rts From bb9aa7558f724445217afd7042cb3c3e9e248970 Mon Sep 17 00:00:00 2001 From: Greg King <gregdk@users.sf.net> Date: Mon, 14 Apr 2014 05:54:13 -0400 Subject: [PATCH 25/32] Fixed the SGML <htmlurl> and <url> tags. Those tags have two attributes: "url=" and "name=". In the non-HTML output formats, <url> shows both fields, while <htmlurl> shows only the name field (as the HTML format always does.) Thus, the general rules are 1. If the two attributes are different, then use <url>. 2. If they are similar, then use <htmlurl>. 3. If they are the same, then consider using <url> without the "name=" attribute. (The reason for rules 2 and 3 is that the same text shouldn't be shown twice.) There can be exceptions. Example: "od65.sgml" has <htmlurl> because the URL would disturb the flow of a sentence. --- doc/apple2.sgml | 34 +++++++++++++++++----------------- doc/apple2enh.sgml | 26 +++++++++++++------------- doc/atari.sgml | 8 ++++---- doc/c128.sgml | 7 +++---- doc/c16.sgml | 10 +++++----- doc/c64.sgml | 10 ++++------ doc/ca65.sgml | 10 ++++------ doc/debugging.sgml | 4 ++-- doc/dio.sgml | 6 +++--- doc/funcref.sgml | 11 +++++------ doc/geos.sgml | 19 ++++++++----------- doc/ld65.sgml | 8 ++++---- doc/library.sgml | 4 ++-- doc/lynx.sgml | 4 ++-- doc/nes.sgml | 4 ++-- doc/od65.sgml | 6 +++--- doc/pet.sgml | 5 ++--- doc/plus4.sgml | 10 +++++----- doc/supervision.sgml | 8 ++++---- doc/using-make.sgml | 14 +++++++------- doc/vic20.sgml | 5 ++--- 21 files changed, 101 insertions(+), 112 deletions(-) diff --git a/doc/apple2.sgml b/doc/apple2.sgml index 036f37207..e58565359 100644 --- a/doc/apple2.sgml +++ b/doc/apple2.sgml @@ -4,7 +4,7 @@ <title>Apple ][ specific information for cc65 <author><url url="mailto:ol.sc@web.de" name="Oliver Schmidt"> -<date>2009-10-07 +<date>2014-04-10 <abstract> An overview over the Apple ][ runtime system as it is @@ -24,7 +24,7 @@ Apple ][ specific header files, available drivers, and any pitfalls specific to that platform. Please note that Apple ][ specific functions are just mentioned -here, they are described in detail in the separate <htmlurl url="funcref.html" +here, they are described in detail in the separate <url url="funcref.html" name="function reference">. Even functions marked as "platform dependent" may be available on more than one platform. Please see the function reference for more information. @@ -45,7 +45,7 @@ containing DOS 3.3 as well as ProDOS 8. For ProDOS 8 system programs the load address is fixed to $2000 so there is no need for a header. Thus the linker configuration -<htmlurl url="apple2.html#ss4.3" name="apple2-system.cfg"> for those programs +<ref id="apple-sys-cfg" name="apple2-system.cfg"> for those programs omits the DOS 3.3 header. The right AppleCommander option to put system files without a header on a ProDOS 8 disk image is <tt/-p/. @@ -81,11 +81,11 @@ cc65 runtime system takes care of actually moving the code into the Language Card. The amount of memory available in the Language Card for generated code depends -on the chosen <htmlurl url="apple2.html#s4" name="linker configuration">. +on the chosen <ref id="link-configs" name="linker configuration">. -<sect>Linker configurations<p> +<sect>Linker configurations<label id="link-configs"><p> The ld65 linker comes with a default config file for the Apple ][, which is used via <tt/-t apple2/. @@ -138,7 +138,7 @@ vanilla DOS 3.3 doesn't make use of the Language Card at all. </descrip><p> -<sect1><tt/apple2-system.cfg/<p> +<sect1><tt/apple2-system.cfg/<label id="apple-sys-cfg"><p> Configuration for a system program running on ProDOS 8. @@ -159,7 +159,7 @@ Configuration for a system program running on ProDOS 8. </descrip><p> -<sect1><tt/apple2-loader.cfg/<p> +<sect1><tt/apple2-loader.cfg/<label id="apple-load-cfg"><p> Configuration optimized for a binary program running on ProDOS 8 without BASIC.SYSTEM. Intended to be used with <bf/LOADER.SYSTEM - an @@ -231,7 +231,7 @@ range. The easiest (and for really large programs in fact the only) way to have a cc65 program use the memory from $800 to $2000 is to link it as binary (as opposed to system) program using the linker configuration -<htmlurl url="apple2.html#ss4.4" name="apple2-loader.cfg"> with start address +<ref id="apple-load-cfg" name="apple2-loader.cfg"> with start address $803 and load it with the targetutil LOADER.SYSTEM. The program then works like a system program (i.e. quits to the ProDOS dispatcher). @@ -243,7 +243,7 @@ example the program <tt/MYPROG/ is loaded by <tt/MYPROG.SYSTEM/. <sect1>Heap<p> If the cc65 program can be successfully linked as system program using the linker -configuration <htmlurl url="apple2.html#ss4.3" name="apple2-system.cfg"> but +configuration <ref id="apple-sys-cfg" name="apple2-system.cfg">, but uses the heap either explicitly or implicitly (i.e. by loading a driver) then the memory from $800 to $2000 can be added to the heap by calling <tt/_heapadd ((void *) 0x0800, 0x1800);/ at the beginning of <tt/main()/. @@ -268,7 +268,7 @@ default I/O buffer allocation basically yields the same placement of I/O buffers in memory the primary benefit of <tt/apple2-iobuf-0800.o/ is a reduction in code size - and thus program file size - of more than 1400 bytes. -Using <tt/apple2-iobuf-0800.o/ is as simple as placing it on the linker command +Using <tt/apple2-iobuf-0800.o/ is as simple as placing it on the linker command line like this: <tscreen><verb> @@ -286,7 +286,7 @@ Programs containing Apple ][ specific code may use the <sect1>Apple ][ specific functions<p> The functions listed below are special for the Apple ][. See -the <htmlurl url="funcref.html" name="function reference"> for declaration and +the <url url="funcref.html" name="function reference"> for declaration and usage. <itemize> @@ -347,7 +347,7 @@ The names in the parentheses denote the symbols to be used for static linking of <tag><tt/a2.auxmem.emd (a2_auxmem_emd)/</tag> Gives access to 47.5 KB RAM (190 pages of 256 bytes each) on an Extended 80-Column Text Card. - + Note that this driver doesn't check for the actual existence of the memory and that it doesn't check for ProDOS 8 RAM disk content! @@ -373,7 +373,7 @@ The names in the parentheses denote the symbols to be used for static linking of Driver for the AppleMouse II Card. Searches all Apple II slots for an AppleMouse II Card compatible firmware. The default bounding box is [0..279,0..191]. - + Programs using this driver will have to be linked with <tt/--start-addr $4000/ to reserve the first hires page if they are intended to run on an Apple ][ (in contrast to an Apple //e) because the @@ -428,7 +428,7 @@ BASIC.SYSTEM) there are some limitations for DOS 3.3: 'FAILED TO ALLOC INTERRUPT' on program startup. This implicitly means that <tt/a2.stdmou.mou/ and <tt/a2.ssc.ser/ are not functional as they depend on interrupts. - + </descrip><p> @@ -477,7 +477,7 @@ The runtime for the Apple ][ uses routines marked as <tt/.INTERRUPTOR/ for ProDOS 8 interrupt handlers. Such routines must be written as simple machine language subroutines and will be called automatically by the interrupt handler code when they are linked into a -program. See the discussion of the <tt/.CONDES/ feature in the <htmlurl +program. See the discussion of the <tt/.CONDES/ feature in the <url url="ca65.html" name="assembler manual">. @@ -486,7 +486,7 @@ url="ca65.html" name="assembler manual">. <descrip> <tag/Drive ID/ - The function <htmlurl url="dio.html#s1" name="dio_open()"> has the single + The function <url url="dio.html#s1" name="dio_open()"> has the single parameter <tt/device/ to identify the device to be opened. Therefore an Apple II slot and drive pair is mapped to that <tt/device/ according to the formula @@ -498,7 +498,7 @@ url="ca65.html" name="assembler manual">. so that for example slot 6 drive 2 is mapped to <tt/device/ 14. <tag/Sector count/ - The function <htmlurl url="dio.html#s3" name="dio_query_sectcount()"> returns + The function <url url="dio.html#s3" name="dio_query_sectcount()"> returns the correct sector count for all ProDOS 8 disks. However for any non-ProDOS 8 disk it simply always returns 280 (which is only correct for a 140 KB disk). This condition is indicated by the <tt/_oserror/ value 82. diff --git a/doc/apple2enh.sgml b/doc/apple2enh.sgml index 95a8c084c..215c6d384 100644 --- a/doc/apple2enh.sgml +++ b/doc/apple2enh.sgml @@ -4,7 +4,7 @@ <title>Enhanced Apple //e specific information for cc65 <author><url url="mailto:ol.sc@web.de" name="Oliver Schmidt"> -<date>2009-10-07 +<date>2014-04-10 <abstract> An overview over the enhanced Apple //e runtime system as it is @@ -24,7 +24,7 @@ enhanced Apple //e specific header files, available drivers, and any pitfalls specific to that platform. Please note that enhanced Apple //e specific functions are just mentioned -here, they are described in detail in the separate <htmlurl url="funcref.html" +here, they are described in detail in the separate <url url="funcref.html" name="function reference">. Even functions marked as "platform dependent" may be available on more than one platform. Please see the function reference for more information. @@ -45,7 +45,7 @@ containing DOS 3.3 as well as ProDOS 8. For ProDOS 8 system programs the load address is fixed to $2000 so there is no need for a header. Thus the linker configuration -<htmlurl url="apple2enh.html#ss4.3" name="apple2enh-system.cfg"> for those programs +<ref id="apple-sys-cfg" name="apple2enh-system.cfg"> for those programs omits the DOS 3.3 header. The right AppleCommander option to put system files without a header on a ProDOS 8 disk image is <tt/-p/. @@ -81,11 +81,11 @@ cc65 runtime system takes care of actually moving the code into the Language Card. The amount of memory available in the Language Card for generated code depends -on the chosen <htmlurl url="apple2enh.html#s4" name="linker configuration">. +on the chosen <ref id="link-configs" name="linker configuration">. -<sect>Linker configurations<p> +<sect>Linker configurations<label id="link-configs"><p> The ld65 linker comes with a default config file for the enhanced Apple //e, which is used via <tt/-t apple2enh/. @@ -138,7 +138,7 @@ vanilla DOS 3.3 doesn't make use of the Language Card at all. </descrip><p> -<sect1><tt/apple2enh-system.cfg/<p> +<sect1><tt/apple2enh-system.cfg/<label id="apple-sys-cfg"><p> Configuration for a system program running on ProDOS 8. @@ -159,7 +159,7 @@ Configuration for a system program running on ProDOS 8. </descrip><p> -<sect1><tt/apple2enh-loader.cfg/<p> +<sect1><tt/apple2enh-loader.cfg/<label id="apple-load-cfg"><p> Configuration optimized for a binary program running on ProDOS 8 without BASIC.SYSTEM. Intended to be used with <bf/LOADER.SYSTEM - an @@ -231,7 +231,7 @@ range. The easiest (and for really large programs in fact the only) way to have a cc65 program use the memory from $800 to $2000 is to link it as binary (as opposed to system) program using the linker configuration -<htmlurl url="apple2enh.html#ss4.4" name="apple2enh-loader.cfg"> with start address +<ref id="apple-load-cfg" name="apple2enh-loader.cfg"> with start address $803 and load it with the targetutil LOADER.SYSTEM. The program then works like a system program (i.e. quits to the ProDOS dispatcher). @@ -243,7 +243,7 @@ example the program <tt/MYPROG/ is loaded by <tt/MYPROG.SYSTEM/. <sect1>Heap<p> If the cc65 program can be successfully linked as system program using the linker -configuration <htmlurl url="apple2enh.html#ss4.3" name="apple2enh-system.cfg"> but +configuration <ref id="apple-sys-cfg" name="apple2enh-system.cfg">, but uses the heap either explicitly or implicitly (i.e. by loading a driver) then the memory from $800 to $2000 can be added to the heap by calling <tt/_heapadd ((void *) 0x0800, 0x1800);/ at the beginning of <tt/main()/. @@ -286,7 +286,7 @@ Programs containing enhanced Apple //e specific code may use the <sect1>Enhanced Apple //e specific functions<p> The functions listed below are special for the enhanced Apple //e. See -the <htmlurl url="funcref.html" name="function reference"> for declaration and +the <url url="funcref.html" name="function reference"> for declaration and usage. <itemize> @@ -483,7 +483,7 @@ The runtime for the enhanced Apple //e uses routines marked as <tt/.INTERRUPTOR/ for ProDOS 8 interrupt handlers. Such routines must be written as simple machine language subroutines and will be called automatically by the interrupt handler code when they are linked into a -program. See the discussion of the <tt/.CONDES/ feature in the <htmlurl +program. See the discussion of the <tt/.CONDES/ feature in the <url url="ca65.html" name="assembler manual">. @@ -492,7 +492,7 @@ url="ca65.html" name="assembler manual">. <descrip> <tag/Drive ID/ - The function <htmlurl url="dio.html#s1" name="dio_open()"> has the single + The function <url url="dio.html#s1" name="dio_open()"> has the single parameter <tt/device/ to identify the device to be opened. Therefore an Apple II slot and drive pair is mapped to that <tt/drive_id/ according to the formula @@ -504,7 +504,7 @@ url="ca65.html" name="assembler manual">. so that for example slot 6 drive 2 is mapped to <tt/device/ 14. <tag/Sector count/ - The function <htmlurl url="dio.html#s3" name="dio_query_sectcount()"> returns + The function <url url="dio.html#s3" name="dio_query_sectcount()"> returns the correct sector count for all ProDOS 8 disks. However for any non-ProDOS 8 disk it simply always returns 280 (which is only correct for a 140 KB disk). This condition is indicated by the <tt/_oserror/ value 82. diff --git a/doc/atari.sgml b/doc/atari.sgml index 4b848575d..2b164ce35 100644 --- a/doc/atari.sgml +++ b/doc/atari.sgml @@ -6,7 +6,7 @@ <author> <url url="mailto:shawnjefferson@24fightingchickens.com" name="Shawn Jefferson"> and<newline> <url url="mailto:chris@groessler.org" name="Christian Groessler"> -<date>2014-03-27 +<date>2014-04-10 <abstract> An overview over the Atari runtime system as it is implemented for the cc65 C @@ -36,7 +36,7 @@ recommended to use the <tt/atari/ target unless lack of memory dictates the use of the <tt/atarixl/ target. Please note that Atari specific functions are just mentioned here, they are -described in detail in the separate <htmlurl url="funcref.html" name="function +described in detail in the separate <url url="funcref.html" name="function reference">. Even functions marked as "platform dependent" may be available on more than one platform. Please see the function reference for more information. @@ -264,7 +264,7 @@ header file. <sect1>Atari specific functions<p> The functions and global variable listed below are special for the Atari. -See the <htmlurl url="funcref.html" name="function reference"> for declaration and usage. +See the <url url="funcref.html" name="function reference"> for declaration and usage. <itemize> <item>get_ostype @@ -666,7 +666,7 @@ The runtime for the Atari uses routines marked as <tt/.INTERRUPTOR/ for interrupt handlers. Such routines must be written as simple machine language subroutines and will be called automatically by the VBI handler code when they are linked into a program. See the discussion of the <tt/.CONDES/ -feature in the <htmlurl url="ca65.html" name="assembler manual">. +feature in the <url url="ca65.html" name="assembler manual">. <sect1>Reserving a memory area inside a program<label id="memhole"><p> diff --git a/doc/c128.sgml b/doc/c128.sgml index 3309d68af..4154c0a8d 100644 --- a/doc/c128.sgml +++ b/doc/c128.sgml @@ -4,7 +4,7 @@ <title>Commodore 128-specific information for cc65 <author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> -<date>2014-03-24 +<date>2014-04-12 <abstract> An overview over the C128 runtime system as it is implemented for the cc65 C @@ -235,9 +235,8 @@ The default drivers, <tt/joy_stddrv (joy_static_stddrv)/, point to <tt/c128-stdj <tag><tt/c128-ptvjoy.joy (c128_ptvjoy_joy)/</tag> Driver for the Protovision 4-player adapter originally written by Groepaz - for the C64, and converted for the C128 by me. See <htmlurl - url="http://www.protovision-online.de/hardw/hardwstart.htm" - name="http://www.protovision-online.de/hardw/hardwstart.htm"> for prices and + for the C64, and converted for the C128 by Uz. See <url + url="http://www.protovision-online.de/hardw/hardwstart.htm"> for prices and building instructions. Up to four joysticks are supported. <tag><tt/c128-stdjoy.joy (c128_stdjoy_joy)/</tag> diff --git a/doc/c16.sgml b/doc/c16.sgml index a1317a0b5..1614516b7 100644 --- a/doc/c16.sgml +++ b/doc/c16.sgml @@ -4,7 +4,7 @@ <title>Commodore 16/116 specific information for cc65 <author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> -<date>2003-12-15 +<date>2014-04-10 <abstract> An overview over the C16 runtime system as it is implemented for the cc65 C @@ -23,13 +23,13 @@ cc65 C compiler. It describes the memory layout, C16/116 specific header files, available drivers, and any pitfalls specific to that platform. Please note that C16 specific functions are just mentioned here, they are -described in detail in the separate <htmlurl url="funcref.html" name="function +described in detail in the separate <url url="funcref.html" name="function reference">. Even functions marked as "platform dependent" may be available on more than one platform. Please see the function reference for more information. Since the C16/C116 and the Commodore Plus/4 are almost identical (the former -don't have the 6551 ACIA and only 16KB of memory), the <htmlurl +don't have the 6551 ACIA and only 16KB of memory), the <url url="plus4.html" name="Plus/4 documentation"> is also worth a look. The difference between both cc65 targets is that the Plus/4 runtime uses banking to support full 64K RAM, while the C16 does not use banking and supports up to @@ -97,7 +97,7 @@ There are currently no special C16/C116 functions. <sect1>CBM specific functions<p> Some functions are available for all (or at least most) of the Commodore -machines. See the <htmlurl url="funcref.html" name="function reference"> for +machines. See the <url url="funcref.html" name="function reference"> for declaration and usage. <itemize> @@ -232,7 +232,7 @@ The runtime for the C16 uses routines marked as <tt/.INTERRUPTOR/ for interrupt handlers. Such routines must be written as simple machine language subroutines and will be called automatically by the interrupt handler code when they are linked into a program. See the discussion of the <tt/.CONDES/ -feature in the <htmlurl url="ca65.html" name="assembler manual">. +feature in the <url url="ca65.html" name="assembler manual">. diff --git a/doc/c64.sgml b/doc/c64.sgml index cef7f6467..ca99e0061 100644 --- a/doc/c64.sgml +++ b/doc/c64.sgml @@ -4,7 +4,7 @@ <title>Commodore 64-specific information for cc65 <author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> -<date>2014-03-24 +<date>2014-04-14 <abstract> An overview over the C64 runtime system as it is implemented for the cc65 C @@ -273,15 +273,13 @@ The default drivers, <tt/joy_stddrv (joy_static_stddrv)/, point to <tt/c64-stdjo <descrip> <tag><tt/c64-hitjoy.joy (c64_hitjoy_joy)/</tag> - Driver for the Digital Excess & Hitmen adapter contributed by Groepaz. See - <htmlurl url="http://www.digitalexcess.de/downloads/productions.php" - name="http://www.digitalexcess.de/downloads/productions.php"> on + Driver for the Digital Excess & Hitmen adapter contributed by Groepaz. + See <url url="http://www.digitalexcess.de/downloads/productions.php"> on instructions how to build one. Up to four joysticks are supported. <tag><tt/c64-ptvjoy.joy (c64_ptvjoy_joy)/</tag> Driver for the Protovision 4-player adapter contributed by Groepaz. See - <htmlurl url="http://www.protovision-online.de/hardw/hardwstart.htm" - name="http://www.protovision-online.de/hardw/hardwstart.htm"> for prices and + <url url="http://www.protovision-online.de/hardw/hardwstart.htm"> for prices and building instructions. Up to four joysticks are supported. <tag><tt/c64-stdjoy.joy (c64_stdjoy_joy)/</tag> diff --git a/doc/ca65.sgml b/doc/ca65.sgml index 46c1f4457..caf022c16 100644 --- a/doc/ca65.sgml +++ b/doc/ca65.sgml @@ -3,7 +3,7 @@ <article> <title>ca65 Users Guide <author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> -<date>2000-07-19, 2000-11-29, 2001-10-02, 2005-09-08 +<date>2014-04-10 <abstract> ca65 is a powerful macro assembler for the 6502, 65C02 and 65816 CPUs. It is @@ -453,9 +453,8 @@ mnemonics: 6502X mode is an extension to the normal 6502 mode. In this mode, several mnemonics for illegal instructions of the NMOS 6502 CPUs are accepted. Since these instructions are illegal, there are no official mnemonics for them. The -unofficial ones are taken from <htmlurl -url="http://www.oxyron.de/html/opcodes02.html" -name="http://www.oxyron.de/html/opcodes02.html">. Please note that only the +unofficial ones are taken from <url +url="http://www.oxyron.de/html/opcodes02.html">. Please note that only the ones marked as "stable" are supported. The following table uses information from the mentioned web page, for more information, see there. @@ -502,8 +501,7 @@ nor does it call the interpreter. All this must be done by your program. Apple ][ programmers do probably know how to use sweet16 mode. For more information about SWEET 16, see -<htmlurl url="http://www.6502.org/source/interpreters/sweet16.htm" -name="http://www.6502.org/source/interpreters/sweet16.htm">. +<url url="http://www.6502.org/source/interpreters/sweet16.htm">. <sect1>Number format<p> diff --git a/doc/debugging.sgml b/doc/debugging.sgml index 320aa0359..c7c7792db 100644 --- a/doc/debugging.sgml +++ b/doc/debugging.sgml @@ -4,7 +4,7 @@ <title>Using emulators with cc65 <author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> -<date>03.12.2000 +<date>2014-04-11 <abstract> How to debug your code using the VICE and Oricutron emulators. @@ -29,7 +29,7 @@ Win32, OS/2, Acorn RISC OS, BeOS, QNX 6.x, Amiga, GP2X and Mac OS X. It emulates the Commodore 64, 128, VIC20, PET and the 600/700 machines. For more information see the VICE home page: -<htmlurl url="http://www.viceteam.org/"> +<url url="http://vice-emu.sourceforge.net/">. VICE has a builtin machine language monitor that may be used for debugging your programs. Using an emulator for debugging has some advantages: diff --git a/doc/dio.sgml b/doc/dio.sgml index fe0a89983..c85992a4a 100644 --- a/doc/dio.sgml +++ b/doc/dio.sgml @@ -3,7 +3,7 @@ <article> <title>Diskette Sector I/O Routines <author><url url="mailto:chris@groessler.org" name="Christian Groessler"> -<date>20-Feb-2005 +<date>2014-04-10 <abstract> The cc65 library provides functions to read and write raw disk sectors. @@ -89,8 +89,8 @@ The following function returns the sector size of the currently inserted disk: </verb></tscreen> On the Atari platform, the sector size is handled specially. Please refer -to the DIO section in the <htmlurl url="atari.html" name="Atari"> -specific platform documentation. +to the DIO section in the <url url="atari.html" name="Atari-specific +platform documentation">. <p> The following function returns the sector count of the currently inserted disk: diff --git a/doc/funcref.sgml b/doc/funcref.sgml index 85b4c266e..adfeaf4b2 100644 --- a/doc/funcref.sgml +++ b/doc/funcref.sgml @@ -3,7 +3,7 @@ <article> <title>cc65 function reference <author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> -<date>07.11.2002 +<date>2014-04-10 <abstract> cc65 is a C compiler for 6502 based systems. This function reference describes @@ -23,7 +23,7 @@ just some of the supported machines. This function refrence describes the available functions together with any limitations. For an overview about the available libraries, their purpose, and any -differences to the ISO standard, please have a look at the <htmlurl +differences to the ISO standard, please have a look at the <url url="library.html" name="cc65 Library Overview">. <bf/Note:/ Standard C functions are listed here, but not described in detail. @@ -276,8 +276,7 @@ function. <sect1><tt/dio.h/<label id="dio.h"><p> -<htmlurl url="dio.html" name="dio.html"> -Low-level disk I/O API. +<url url="dio.html" name="Low-level disk I/O API">. <sect1><tt/dirent.h/<label id="dirent.h"><p> @@ -416,8 +415,8 @@ Low-level disk I/O API. <sect1><tt/o65.h/<label id="o65.h"><p> The <tt/o65.h/ header file contains structure and constant definitions that -may be used when dealing with files in <htmlurl -url="http://www.6502.org/users/andre/o65/fileformat.html" name="o65 format">. +may be used when dealing with files in <url +url="http://www.6502.org/users/andre/o65/fileformat.html" name="the o65 format">. It does not declare any functions. diff --git a/doc/geos.sgml b/doc/geos.sgml index d1604bc9c..aa3725bdf 100644 --- a/doc/geos.sgml +++ b/doc/geos.sgml @@ -6,7 +6,7 @@ <title>GEOSLib docs <author><url url="mailto:ytm@elysium.pl" name="Maciej Witkowiak"> -<date>v1.5, 26.12.1999, 2000, 2001, 2002, 2003, 2005 +<date>2014-04-11 <abstract> This is the documentation of cc65's GEOSLib, but information contained here may be also useful for writing GEOS applications in general. @@ -71,22 +71,19 @@ programs. The software needed: <itemize> <item><em/cc65/ Excellent package containing a C crosscompiler, a crossassembler and a linker, you - can get it from: <htmlurl url="http://www.cc65.org/" - name="http://www.cc65.org/"> + can get it from: <url url="http://cc65.github.io/cc65/">. <item><em/VICE/ This is a portable C64, C128 and few other Commodore computers emulator, you - can obtain it from: <htmlurl url="http://www.viceteam.org/" - name="http://www.viceteam.org/">. The VICE package contains the - c1541 program that is able to convert/unconvert GEOS files to disk images. + can obtain it from: <url url="http://vice-emu.sourceforge.net/">. + The VICE package contains the <em/c1541/ program that is able + to convert/unconvert GEOS files to disk images. <item><em/The Star Commander/ This tool is only for DOS. You will need it for transferring object files from a PC to a 1541. There's also one important ability of this tool - it automatically un-converts .cvt files into GEOS native format on - disk image files. Check out: <htmlurl url="http://sta.c64.org/sc.html" - name="http://sta.c64.org/sc.html"> - <item><em/cbm4linux/ A Linux kernel module that allows for communication with a 1541 and + disk image files. Check out: <url url="http://sta.c64.org/sc.html">. + <item><em/opencbm/ A package that allows for communication directly with a 1541 and other Commodore IEC bus drives. It can be a replacement for Star Commander if you only want to transfer files to a disk and unconvert using GEOS program for - this purpose. Check out: <htmlurl url="http://www.lb.shuttle.de/puffin/cbm4linux/" - name="http://www.lb.shuttle.de/puffin/cbm4linux"> + this purpose. Check out: <url url="http://opencbm.sourceforge.net/">. </itemize> <p> VICE and cc65 are portable - they run on variety of platforms - DOS, Win32 and UNIX. GEOSLib only diff --git a/doc/ld65.sgml b/doc/ld65.sgml index c92761c0a..f3a3930b2 100644 --- a/doc/ld65.sgml +++ b/doc/ld65.sgml @@ -3,7 +3,7 @@ <article> <title>ld65 Users Guide <author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> -<date>02.12.2000, 02.10.2001 +<date>2014-04-13 <abstract> The ld65 linker combines object files into an executable file. ld65 is highly @@ -840,7 +840,7 @@ look like this: </verb></tscreen> The only other available output format is the o65 format specified by Andre -Fachat (see the <htmlurl url="http://www.6502.org/users/andre/o65/fileformat.html" +Fachat (see the <url url="http://www.6502.org/users/andre/o65/fileformat.html" name="6502 binary relocation format specification">). It is defined like this: <tscreen><verb> @@ -859,7 +859,7 @@ The necessary o65 attributes are defined in a special section labeled The <tt/FORMAT/ section is used to describe file formats. The default (binary) format has currently no attributes, so, while it may be listed in this section, the attribute list is empty. The second supported format, -<htmlurl url="http://www.6502.org/users/andre/o65/fileformat.html" name="o65">, +<url url="http://www.6502.org/users/andre/o65/fileformat.html" name="o65">, has several attributes that may be defined here. <tscreen><verb> @@ -949,7 +949,7 @@ The <tt/CONDES/ feature has several attributes: Without specifying the <tt/CONDES/ feature, the linker will not create any tables, even if there are <tt/condes/ entries in the object files. -For more information see the <tt/.CONDES/ command in the <htmlurl +For more information see the <tt/.CONDES/ command in the <url url="ca65.html" name="ca65 manual">. diff --git a/doc/library.sgml b/doc/library.sgml index 16bd2dc5e..9b923c308 100644 --- a/doc/library.sgml +++ b/doc/library.sgml @@ -4,7 +4,7 @@ <title>cc65 Library Overview <author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> -<date>2000-12-02, 2002-11-26 +<date>2014-04-12 <abstract> An overview over the runtime and C libraries that come with the cc65 compiler, @@ -19,7 +19,7 @@ including a discussion of the differences to the ISO standard. <sect>Overview<p> This file contains a short overview of the libraries available for the cc65 C -compiler. Please have a look at the <htmlurl url="funcref.html" name="function +compiler. Please have a look at the <url url="funcref.html" name="function reference"> for a list function by function. Since the function reference is not complete (I'm working on that) it may happen that you don't find a specific function. In this case, have a look into the header files. All diff --git a/doc/lynx.sgml b/doc/lynx.sgml index 720c68af6..73763f1dd 100644 --- a/doc/lynx.sgml +++ b/doc/lynx.sgml @@ -6,7 +6,7 @@ <author> <url url="mailto:karri@sipo.fi" name="Karri Kaksonen">,<newline> <url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> -<date>2011-04-01 +<date>2014-04-12 <abstract> An overview over the Atari Lynx runtime system as it is implemented for the @@ -25,7 +25,7 @@ with the cc65 C compiler. It describes the memory layout, Lynx specific header files, available drivers, and any pitfalls specific to that platform. Please note that Lynx specific functions are just mentioned here, they are -described in detail in the separate <htmlurl url="funcref.html" name="function +described in detail in the separate <url url="funcref.html" name="function reference">. Even functions marked as "platform dependent" may be available on more than one platform. Please see the function reference for more information. diff --git a/doc/nes.sgml b/doc/nes.sgml index b40a0d30d..ca9ce72b3 100644 --- a/doc/nes.sgml +++ b/doc/nes.sgml @@ -6,7 +6,7 @@ <author> <url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline> <url url="mailto:polluks@sdf.lonestar.org" name="Stefan A. Haubenthal"> -<date>2005-07-17 +<date>2014-04-12 <abstract> An overview over the NES runtime system as it is implemented for the @@ -25,7 +25,7 @@ with the cc65 C compiler. It describes the memory layout, NES specific header files, available drivers, and any pitfalls specific to that platform. Please note that NES specific functions are just mentioned here, they are -described in detail in the separate <htmlurl url="funcref.html" name="function +described in detail in the separate <url url="funcref.html" name="function reference">. Even functions marked as "platform dependent" may be available on more than one platform. Please see the function reference for more information. diff --git a/doc/od65.sgml b/doc/od65.sgml index 1f237b006..f5611a889 100644 --- a/doc/od65.sgml +++ b/doc/od65.sgml @@ -3,11 +3,11 @@ <article> <title>od65 Users Guide <author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> -<date>2010-07-30 +<date>2014-04-14 <abstract> od65 is the object file dump utility. It is able to output most parts of -<htmlurl url="ca65.html" name="ca65"> generated object files in readable form. +<htmlurl url="ca65.html" name="ca65-generated"> object files in readable form. </abstract> <!-- Table of contents --> @@ -19,7 +19,7 @@ od65 is the object file dump utility. It is able to output most parts of <sect>Overview<p> od65 is an object file dump utility. It is able to output most parts of -<htmlurl url="ca65.html" name="ca65"> generated object files in readable form. +<htmlurl url="ca65.html" name="ca65-generated"> object files in readable form. Since the contents and format of the object files are not documented elsewhere and may change at any time, this tool is a portable way to look at the contents. diff --git a/doc/pet.sgml b/doc/pet.sgml index 01a88c67c..7c5bd71ea 100644 --- a/doc/pet.sgml +++ b/doc/pet.sgml @@ -6,7 +6,7 @@ <author> <url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline> <url url="mailto:polluks@sdf.lonestar.org" name="Stefan A. Haubenthal"> -<date>2014-03-26 +<date>2014-04-12 <abstract> An overview over the PET runtime system as it is implemented for the cc65 C @@ -155,8 +155,7 @@ The default drivers, <tt/joy_stddrv (joy_static_stddrv)/, point to <tt/pet-stdjo <tag><tt/pet-ptvjoy.joy (pet_ptvjoy_joy)/</tag> Driver for the Protovision 4-player adapter contributed by Groepaz. See - <htmlurl url="http://www.protovision-online.de/hardw/hardwstart.htm" - name="http://www.protovision-online.de/hardw/hardwstart.htm"> for prices and + <url url="http://www.protovision-online.de/hardw/hardwstart.htm"> for prices and building instructions. Up to two joysticks are supported. <tag><tt/pet-stdjoy.joy (pet_stdjoy_joy)/</tag> diff --git a/doc/plus4.sgml b/doc/plus4.sgml index 3a3da728a..36d53e753 100644 --- a/doc/plus4.sgml +++ b/doc/plus4.sgml @@ -4,7 +4,7 @@ <title>Commodore Plus/4 specific information for cc65 <author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> -<date>2003-12-14 +<date>2014-04-12 <abstract> An overview over the Plus/4 runtime system as it is implemented for the cc65 C @@ -23,13 +23,13 @@ cc65 C compiler. It describes the memory layout, Plus/4 specific header files, available drivers, and any pitfalls specific to that platform. Please note that Plus/4 specific functions are just mentioned here, they are -described in detail in the separate <htmlurl url="funcref.html" name="function +described in detail in the separate <url url="funcref.html" name="function reference">. Even functions marked as "platform dependent" may be available on more than one platform. Please see the function reference for more information. Since the Plus/4 and the Commodore 16/116 are almost identical (the latter are -missing the 6551 ACIA and do only have 16KB of memory), the <htmlurl +missing the 6551 ACIA and do only have 16KB of memory), the <url url="c16.html" name="C16 documentation"> is also worth a look. The difference between both cc65 targets is that the Plus/4 runtime uses banking to support full 64K RAM, while the C16 does not use banking and supports up to 32K RAM. @@ -95,7 +95,7 @@ There are currently no special Plus/4 functions. <sect1>CBM specific functions<p> Some functions are available for all (or at least most) of the Commodore -machines. See the <htmlurl url="funcref.html" name="function reference"> for +machines. See the <url url="funcref.html" name="function reference"> for declaration and usage. <itemize> @@ -232,7 +232,7 @@ The runtime for the Plus/4 uses routines marked as <tt/.INTERRUPTOR/ for interrupt handlers. Such routines must be written as simple machine language subroutines and will be called automatically by the interrupt handler code when they are linked into a program. See the discussion of the <tt/.CONDES/ -feature in the <htmlurl url="ca65.html" name="assembler manual">. +feature in the <url url="ca65.html" name="assembler manual">. diff --git a/doc/supervision.sgml b/doc/supervision.sgml index fcf05878e..97495dea5 100644 --- a/doc/supervision.sgml +++ b/doc/supervision.sgml @@ -4,7 +4,7 @@ <title>Watara Supervision specific information for cc65 <author><url url="mailto:polluks@sdf.lonestar.org" name="Stefan A. Haubenthal"> -<date>2005-07-17 +<date>2014-04-12 <abstract> An overview over the Supervision runtime system as it is implemented for the @@ -23,7 +23,7 @@ with the cc65 C compiler. It describes the memory layout, Supervision specific h files, available drivers, and any pitfalls specific to that platform. Please note that Supervision specific functions are just mentioned here, they are -described in detail in the separate <htmlurl url="funcref.html" name="function +described in detail in the separate <url url="funcref.html" name="function reference">. Even functions marked as "platform dependent" may be available on more than one platform. Please see the function reference for more information. @@ -92,7 +92,7 @@ allow access to hardware located in the address space. No graphics drivers are currently available for the Supervision. <!--A TGI driver for the standard graphics mode (160×160 in 4 colors) is available, but must be statically linked, because no file I/O is available. -See the documentation for the <htmlurl url="co65.html" name="co65 utility"> +See the documentation for the <url url="co65.html" name="co65 utility"> for information on how to do that.--> <sect1>Extended memory drivers<p> @@ -105,7 +105,7 @@ No extended memory drivers are currently available for the Supervision. No joystick drivers are currently available for the Supervision. <!--A joystick driver for the standard buttons is available, but must be statically linked, because no file I/O is available. See the documentation for -the <htmlurl url="co65.html" name="co65 utility"> for information on how to do +the <url url="co65.html" name="co65 utility"> for information on how to do that.--> <sect1>Mouse drivers<p> diff --git a/doc/using-make.sgml b/doc/using-make.sgml index f104379f0..0c3c13a6e 100644 --- a/doc/using-make.sgml +++ b/doc/using-make.sgml @@ -4,7 +4,7 @@ <title>Using GNU Make with cc65 <author><url url="mailto:ol.sc@web.de" name="Oliver Schmidt"> -<date>2009-06-26 +<date>2014-04-12 <abstract> How to build your program using the GNU Make utility. @@ -114,10 +114,10 @@ of creating a <tt/CC65_HOME/ environment variable. <sect1>Understanding the sample Makefile<p> Most parts of the sample Makefile follow the guidelines in the -<htmlurl url="http://www.gnu.org/software/make/manual/make.html" name="GNU Make Manual"> +<url url="http://www.gnu.org/software/make/manual/make.html" name="GNU Make Manual"> that can be searched online for background information. The automatic generation of dependency however rather works as described by the GNU Make maintainer Paul D. Smith in -<htmlurl url="http://make.paulandlesley.org/autodep.html#advanced" name="Advanced Auto-Dependencies">. +<url url="http://make.paulandlesley.org/autodep.html#advanced" name="&dquot;Advanced Auto-Dependencies&dquot;">. Fortunately both GCC and cc65 directly support this method in the meantime. @@ -133,8 +133,8 @@ then the sample Makefile may be invoked from the Windows Command Prompt (cmd.exe by downloading the following programs: <itemize> -<item>make.exe: <url url="http://gnuwin32.sourceforge.net/packages/make.htm"> -<item>rm.exe: <url url="http://gnuwin32.sourceforge.net/packages/coreutils.htm"> +<item><url name="make.exe" url="http://gnuwin32.sourceforge.net/packages/make.htm"> +<item><url name="rm.exe" url="http://gnuwin32.sourceforge.net/packages/coreutils.htm"> </itemize> @@ -144,9 +144,9 @@ by downloading the following programs: The very limited resources of the cc65 target machines now and then require manual optimization of the build process by compiling individual source files with different compiler options. GNU Make offers -<htmlurl url="http://www.gnu.org/software/make/manual/html_node/Target_002dspecific.html" name="Target-specific Variable Values"> +<url url="http://www.gnu.org/software/make/manual/html_node/Target_002dspecific.html" name="Target-specific Variable Values"> perfectly suited for doing so. For example placing the code of the two modules -<tt/foo/ and <tt/bar/ in the segment <tt/FOOBAR/ can be archived with this +<tt/foo/ and <tt/bar/ in the segment <tt/FOOBAR/ can be achieved with this target-specific variable definition: <tscreen><verb> diff --git a/doc/vic20.sgml b/doc/vic20.sgml index ce58dad50..5fba59a13 100644 --- a/doc/vic20.sgml +++ b/doc/vic20.sgml @@ -6,7 +6,7 @@ <author> <url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline> <url url="mailto:polluks@sdf.lonestar.org" name="Stefan A. Haubenthal"> -<date>2014-03-26 +<date>2014-04-12 <abstract> An overview over the VIC20 runtime system as it is implemented for the cc65 C @@ -161,8 +161,7 @@ The default drivers, <tt/joy_stddrv (joy_static_stddrv)/, point to <tt/vic20-std <tag><tt/vic20-ptvjoy.joy (vic20_ptvjoy_joy)/</tag> Driver for the Protovision 4-player adapter contributed by Groepaz. See - <htmlurl url="http://www.protovision-online.de/hardw/hardwstart.htm" - name="http://www.protovision-online.de/hardw/hardwstart.htm"> for prices and + <url url="http://www.protovision-online.de/hardw/hardwstart.htm"> for prices and building instructions. Up to three joysticks are supported. </descrip><p> From 88e3e60550c47bee0c070d0aee74a88f6eee123e Mon Sep 17 00:00:00 2001 From: Christian Groessler <chris@groessler.org> Date: Tue, 15 Apr 2014 11:36:27 +0200 Subject: [PATCH 26/32] address issue raised in the pull request; add support to not use page 6 again --- libsrc/atari/mcbpm-shape.s | 6 +-- libsrc/atari/mcbpm.s | 72 ++++++++++++++++++++++++++++------ libsrc/atari/mcbtxtchar-char.s | 4 +- libsrc/atari/mcbtxtchar.s | 6 +-- 4 files changed, 66 insertions(+), 22 deletions(-) diff --git a/libsrc/atari/mcbpm-shape.s b/libsrc/atari/mcbpm-shape.s index baf8c0020..3a001b561 100644 --- a/libsrc/atari/mcbpm-shape.s +++ b/libsrc/atari/mcbpm-shape.s @@ -9,9 +9,9 @@ ; .export mouse_pm_bits - .export mouse_pm_height : absolute - .export mouse_pm_hotspot_x : absolute - .export mouse_pm_hotspot_y : absolute + .export mouse_pm_height : zeropage + .export mouse_pm_hotspot_x : zeropage + .export mouse_pm_hotspot_y : zeropage .data diff --git a/libsrc/atari/mcbpm.s b/libsrc/atari/mcbpm.s index b431ac414..52a396d9e 100644 --- a/libsrc/atari/mcbpm.s +++ b/libsrc/atari/mcbpm.s @@ -7,6 +7,8 @@ ; be called from an interrupt handler ; +USE_PAGE6 = 1 + .include "atari.inc" .importzp sp .export _mouse_pm_callbacks @@ -14,17 +16,28 @@ .destructor pm_down,7 ; get mouse shape data - .import mouse_pm_bits - .import mouse_pm_height - .import mouse_pm_hotspot_x - .import mouse_pm_hotspot_y + .import mouse_pm_bits + .importzp mouse_pm_height + .importzp mouse_pm_hotspot_x + .importzp mouse_pm_hotspot_y -; P/M definitions. The first value can be changed to adjust the number -; of the P/M used for the mouse. All others depend on this value. +; P/M definitions. The MOUSE_PM_NUM value can be changed to adjust the +; number of the P/M used for the mouse. All others depend on this value. ; Valid P/M numbers are 0 to 4. When 4 is used, the missiles are used ; as a player. +.if USE_PAGE6 MOUSE_PM_NUM = 2 ; P/M used for the mouse + ; This cannot be changed since only player #2 uses the memory at $600. +.else +MOUSE_PM_NUM = 4 ; P/M used for the mouse + ; Using player #4 (missiles) wastes the least amount of memory on the + ; atari target, since top of memory is typically at $xC20, and the + ; missiles use the space at $xB00-$xBFF. + ; On the atarixl target this configuration (not using page 6) is not + ; really satisfying since the top of memory typically lies beneath + ; the ROM and there is flickering visible while the ROM is banked in. +.endif MOUSE_PM_BASE = pm_base ; ZP location pointing to the hw area used by the selected P/M .if MOUSE_PM_NUM = 4 @@ -100,14 +113,14 @@ movex: cpx #1 ror a clc adc #48 - sbc #<(mouse_pm_hotspot_x - 1) + sbc #(mouse_pm_hotspot_x - 1) & $FF set_mouse_x jmp update_colors ; Move the mouse cursor y position to the value in A/X. movey: clc adc #32 - sbc #<(mouse_pm_hotspot_y - 1) + sbc #(mouse_pm_hotspot_y - 1) & $FF pha lda omy jsr clr_pm ; remove player at old position @@ -125,12 +138,12 @@ set_l: lda mouse_pm_bits,x inx iny beq set_end - cpx #<mouse_pm_height + cpx #mouse_pm_height bcc set_l set_end:rts ; Clear (zero) P/M data -clr_pm: ldx #<mouse_pm_height +clr_pm: ldx #mouse_pm_height tay lda #0 clr_l: sta (MOUSE_PM_BASE),y @@ -158,9 +171,11 @@ update_colors: sta PCOLR1 sta PCOLR2 sta PCOLR3 + lda #0 sta SIZEM .else sta PCOLR0 + MOUSE_PM_NUM + lda #0 sta SIZEP0 + MOUSE_PM_NUM .endif rts @@ -169,16 +184,47 @@ update_colors: .segment "INIT" -pm_init:lda #0 +pm_init: + lda #0 + +.if USE_PAGE6 + sta MOUSE_PM_BASE ldx #6 ; page 6 stx MOUSE_PM_BASE+1 + +.else + +; use top of memory and lower sp accordingly + sta sp + sta MOUSE_PM_BASE + lda sp+1 + and #7 ; offset within 2K + cmp #3 + MOUSE_PM_RAW + 1 ; can we use it? + bcc @decr ; no + + lda sp+1 + and #$F8 +@set: adc #3 + MOUSE_PM_RAW - 1 ; CF is set, so adding MOUSE_PM_RAW + 3 + sta MOUSE_PM_BASE+1 + sta sp+1 + bne @cont ; jump always + +@decr: lda sp+1 + and #$F8 + sbc #8 - 1 ; CF is clear, subtracts 8 + bcs @set ; jump always + +@cont: lda #0 + +.endif + tay @iniloo:sta (MOUSE_PM_BASE),y iny bne @iniloo -.if 0 ; enable if not using page 6 for P/M data +.if ! USE_PAGE6 lda MOUSE_PM_BASE+1 and #$F8 .endif @@ -187,7 +233,7 @@ pm_init:lda #0 lda #62 sta SDMCTL - lda #1 + 16 + lda #1 sta GPRIOR jmp update_colors diff --git a/libsrc/atari/mcbtxtchar-char.s b/libsrc/atari/mcbtxtchar-char.s index 46462c11a..1f0862129 100644 --- a/libsrc/atari/mcbtxtchar-char.s +++ b/libsrc/atari/mcbtxtchar-char.s @@ -4,6 +4,4 @@ ; Christian Groessler, 11.04.2014 ; - .export mouse_txt_char : absolute - -mouse_txt_char = 96 ; 'diamond' screen code + .export mouse_txt_char : zp = 96 ; 'diamond' screen code diff --git a/libsrc/atari/mcbtxtchar.s b/libsrc/atari/mcbtxtchar.s index a80fe8f43..90a25f673 100644 --- a/libsrc/atari/mcbtxtchar.s +++ b/libsrc/atari/mcbtxtchar.s @@ -13,7 +13,7 @@ .export _mouse_txt_callbacks .importzp tmp4 .import mul40,loc_tmp - .import mouse_txt_char ; screen code of mouse cursor + .importzp mouse_txt_char ; screen code of mouse cursor .include "atari.inc" @@ -72,7 +72,7 @@ hide: prep: jsr getcursor ; Get character at cursor position - cmp #<mouse_txt_char; "mouse" character + cmp #mouse_txt_char ; "mouse" character bne overwr ; no, probably program has overwritten it lda backup ; jmp setcursor ; Draw character @@ -88,7 +88,7 @@ draw: beq done jsr getcursor ; Cursor visible at current position? sta backup ; Save character at cursor position - lda #<mouse_txt_char + lda #mouse_txt_char jmp setcursor ; Draw cursor From bf2e79f30c2ac2df1d8f42863c87956d07d497d6 Mon Sep 17 00:00:00 2001 From: Greg King <gregdk@users.sf.net> Date: Sun, 20 Apr 2014 11:30:47 -0400 Subject: [PATCH 27/32] Fixed typos. And, fixed descriptions of where ld65 looks for files. --- doc/atari.sgml | 2 +- doc/ld65.sgml | 338 +++++++++++++++++++++++++------------------------ 2 files changed, 171 insertions(+), 169 deletions(-) diff --git a/doc/atari.sgml b/doc/atari.sgml index 2b164ce35..1bdfd8ba2 100644 --- a/doc/atari.sgml +++ b/doc/atari.sgml @@ -30,7 +30,7 @@ The <tt/atari/ target supports all Atari 8-bit computers, the <tt/atarixl/ only supports XL type or newer machines (excluding the 600XL). The <tt/atarixl/ runtime makes the whole 64K of memory available, with the -exception of the I/O area at $D000 - $D7FFF. Since the +exception of the I/O area at $D000 - $D7FF. Since the <tt/atarixl/ runtime has some <ref name="limitations" id="limitations">, it is recommended to use the <tt/atari/ target unless lack of memory dictates the use of the <tt/atarixl/ target. diff --git a/doc/ld65.sgml b/doc/ld65.sgml index f3a3930b2..329f975e1 100644 --- a/doc/ld65.sgml +++ b/doc/ld65.sgml @@ -3,7 +3,7 @@ <article> <title>ld65 Users Guide <author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> -<date>2014-04-13 +<date>2014-04-20 <abstract> The ld65 linker combines object files into an executable file. ld65 is highly @@ -36,7 +36,7 @@ It complements the features that are built into the ca65 macroassembler: the symbol was referenced. <item> Flexible output. The output of ld65 is highly configurable by a config - file. More common platforms are supported by builtin configurations + file. Some more-common platforms are supported by default configurations that may be activated by naming the target system. The output generation was designed with different output formats in mind, so adding other formats shouldn't be a great problem. @@ -47,7 +47,7 @@ It complements the features that are built into the ca65 macroassembler: <sect>Usage<p> -<sect1>Command line option overview<p> +<sect1>Command-line option overview<p> The linker is called as follows: @@ -93,9 +93,9 @@ Long options: </verb></tscreen> -<sect1>Command line options in detail<p> +<sect1>Command-line options in detail<p> -Here is a description of all the command line options: +Here is a description of all of the command-line options: <descrip> @@ -104,7 +104,7 @@ Here is a description of all the command line options: Start a library group. The libraries specified within a group are searched multiple times to resolve crossreferences within the libraries. Normally, - crossreferences are only resolved within a library, that is the library is + crossreferences are resolved only within a library, that is the library is searched multiple times. Libraries specified later on the command line cannot reference otherwise unreferenced symbols in libraries specified earlier, because the linker has already handled them. Library groups are @@ -138,7 +138,7 @@ Here is a description of all the command line options: <tag><tt>-o name</tt></tag> The -o switch is used to give the name of the default output file. - Depending on your output configuration, this name may NOT be used as + Depending on your output configuration, this name <em/might not/ be used as the name for the output file. However, for the default configurations, this name is used for the output file name. @@ -162,8 +162,8 @@ Here is a description of all the command line options: <item>c16 (works also for the c116 with memory up to 32K) <item>c64 <item>c128 - <item>cbm510 (CBM-II series with 40 column video) - <item>cbm610 (all CBM series-II computers with 80 column video) + <item>cbm510 (CBM-II series with 40-column video) + <item>cbm610 (all CBM series-II computers with 80-column video) <item>geos-apple <item>geos-cbm <item>lunix @@ -186,15 +186,15 @@ Here is a description of all the command line options: Force an import of a symbol. While object files are always linked to the output file, regardless if there are any references, object modules from libraries get only linked in if an import can be satisfied by this module. - The <tt/--fore-import/ option may be used to add a reference to a symbol and + The <tt/--force-import/ option may be used to add a reference to a symbol and as a result force linkage of the module that exports the identifier. - The name of the symbol may optionally be followed by a colon and an address - size specifier. If no address size is specified, the default address size + The name of the symbol may optionally be followed by a colon and an address-size + specifier. If no address size is specified, the default address size for the target machine is used. Please note that the symbol name needs to have the internal representation, - meaning you have to prepend an underline for C identifiers. + meaning you have to prepend an underscore for C identifiers. <label id="option-v"> @@ -211,7 +211,9 @@ Here is a description of all the command line options: Must be used in conjunction with <tt><ref id="option-m" name="-m"></tt> (generate map file). Normally the map file will not include empty segments and sections, or unreferenced symbols. Using this option, you can force the - linker to include all this information into the map file. + linker to include all that information into the map file. Also, it will + include a second <tt/Exports/ list. The first list is sorted by name; + the second one is sorted by value. <label id="option-C"> @@ -227,8 +229,8 @@ Here is a description of all the command line options: This option allows to define an external symbol on the command line. Value may start with a '$' sign or with <tt/0x/ for hexadecimal values, - otherwise a leading zero denotes octal values. See also the <ref - id="SYMBOLS" name="SYMBOLS section"> in the configuration file. + otherwise a leading zero denotes octal values. See also <ref + id="SYMBOLS" name="the SYMBOLS section"> in the configuration file. <label id="option--lib-path"> @@ -236,18 +238,18 @@ Here is a description of all the command line options: Specify a library search path. This option may be used more than once. It adds a directory to the search path for library files. Libraries specified - without a path are searched in current directory, in the directory given in - the <tt/LD65_LIB/ environment variable, and in the list of directories - specified using <tt/--lib-path/. + without a path are searched in the current directory, in the list of + directories specified using <tt/--lib-path/, in directories given by + environment variables, and in a built-in default directory. <tag><tt>-Ln</tt></tag> This option allows you to create a file that contains all global labels and - may be loaded into VICE emulator using the <tt/ll/ (load label) command. You + may be loaded into the VICE emulator using the <tt/ll/ (load label) command. You may use this to debug your code with VICE. Note: Older versions had some - bugs in the label code. If you have problems, please get the latest VICE - version. + bugs in the label code. If you have problems, please get the latest <url + url="http://vice-emu.sourceforge.net/" name="VICE"> version. <label id="option-S"> @@ -261,7 +263,7 @@ Here is a description of all the command line options: <tag><tt>-V, --version</tt></tag> - This option print the version number of the linker. If you send any + This option prints the version number of the linker. If you send any suggestions or bugfixes, please include this number. @@ -271,9 +273,9 @@ Here is a description of all the command line options: Specify a config file search path. This option may be used more than once. It adds a directory to the search path for config files. A config file given with the <tt><ref id="option-C" name="-C"></tt> option that has no path in - its name is searched in the current directory, in the directory given in the - <tt/LD65_CFG/ environment variable, and in the list of directories specified - using <tt/--cfg-path/. + its name is searched in the current directory, in the list of directories + specified using <tt/--cfg-path/, in directories given by environment variables, + and in a built-in default directory. <label id="option--dbgfile"> @@ -288,14 +290,14 @@ Here is a description of all the command line options: <tag><tt>--lib file</tt></tag> - Links a library to the output. Use this command line option instead of just + Links a library to the output. Use this command-line option instead of just naming the library file, if the linker is not able to determine the file type because of an unusual extension. <tag><tt>--obj file</tt></tag> - Links an object file to the output. Use this command line option instead + Links an object file to the output. Use this command-line option instead of just naming the object file, if the linker is not able to determine the file type because of an unusual extension. @@ -305,9 +307,9 @@ Here is a description of all the command line options: Specify an object file search path. This option may be used more than once. It adds a directory to the search path for object files. An object file - passed to the linker that has no path in its name is searched in current - directory, in the directory given in the <tt/LD65_OBJ/ environment variable, - and in the list of directories specified using <tt/--obj-path/. + passed to the linker that has no path in its name is searched in the current + directory, in the list of directories specified using <tt/--obj-path/, in + directories given by environment variables, and in a built-in default directory. </descrip> @@ -378,22 +380,22 @@ name is given (libraries are also recognized by a magic word, there are no special naming conventions), all modules in the library are checked if an export from this module would satisfy an import from other modules. All modules where this is the case are marked. If duplicate identifiers are -found, the linker issues a warning. +found, the linker issues warnings. -This procedure (parsing and reading from left to right) does mean, that a +That procedure (parsing and reading from left to right) does mean that a library may only satisfy references for object modules (given directly or from a library) named <em/before/ that library. With the command line <tscreen><verb> - ld65 crt0.o clib.lib test.o + ld65 crt0.o clib.lib test.o </verb></tscreen> -the module test.o may not contain references to modules in the library -clib.lib. If this is the case, you have to change the order of the modules +the module <tt/test.o/ must not contain references to modules in the library +<tt/clib.lib/. But, if it does, you have to change the order of the modules on the command line: <tscreen><verb> - ld65 crt0.o test.o clib.lib + ld65 crt0.o test.o clib.lib </verb></tscreen> Step two is, to read the configuration file, and assign start addresses @@ -403,7 +405,7 @@ name="Configuration files">). After that, the linker is ready to produce an output file. Before doing that, it checks its data for consistency. That is, it checks for unresolved externals (if the output format is not relocatable) and for symbol type -mismatches (for example a zero page symbol is imported by a module as absolute +mismatches (for example a zero-page symbol is imported by a module as an absolute symbol). Step four is, to write the actual target files. In this step, the linker will @@ -416,7 +418,7 @@ segments and symbols encountered. And, last step, if you give the <tt><ref id="option-v" name="-v"></tt> switch twice, you get a dump of the segment data. However, this may be quite -unreadable if you're not a developer:-) +unreadable if you're not a developer. :-) @@ -434,23 +436,23 @@ Case is ignored for keywords, that is, section or attribute names, but it is <sect1>Memory areas<p> -Memory areas are specified in a <tt/MEMORY/ section. Lets have a look at an +Memory areas are specified in a <tt/MEMORY/ section. Let's have a look at an example (this one describes the usable memory layout of the C64): <tscreen><verb> - MEMORY { - RAM1: start = $0800, size = $9800; - ROM1: start = $A000, size = $2000; - RAM2: start = $C000, size = $1000; - ROM2: start = $E000, size = $2000; - } + MEMORY { + RAM1: start = $0800, size = $9800; + ROM1: start = $A000, size = $2000; + RAM2: start = $C000, size = $1000; + ROM2: start = $E000, size = $2000; + } </verb></tscreen> -As you can see, there are two ram areas and two rom areas. The names +As you can see, there are two RAM areas and two ROM areas. The names (before the colon) are arbitrary names that must start with a letter, with the remaining characters being letters or digits. The names of the memory areas are used when assigning segments. As mentioned above, case is -significant for these names. +significant for those names. The syntax above is used in all sections of the config file. The name (<tt/ROM1/ etc.) is said to be an identifier, the remaining tokens up to the @@ -461,22 +463,22 @@ mark the end of the attributes for one identifier. The section above may also have looked like this: <tscreen><verb> - # Start of memory section - MEMORY - { - RAM1: - start $0800 - size $9800; - ROM1: - start $A000 - size $2000; - RAM2: - start $C000 - size $1000; - ROM2: - start $E000 - size $2000; - } + # Start of memory section + MEMORY + { + RAM1: + start $0800 + size $9800; + ROM1: + start $A000 + size $2000; + RAM2: + start $C000 + size $1000; + ROM2: + start $E000 + size $2000; + } </verb></tscreen> There are of course more attributes for a memory section than just start and @@ -495,26 +497,26 @@ we will start to assign segments to memory sections in the <tt/SEGMENTS/ section: <tscreen><verb> - SEGMENTS { - CODE: load = RAM1, type = ro; - RODATA: load = RAM1, type = ro; - DATA: load = RAM1, type = rw; - BSS: load = RAM1, type = bss, define = yes; - } + SEGMENTS { + CODE: load = RAM1, type = ro; + RODATA: load = RAM1, type = ro; + DATA: load = RAM1, type = rw; + BSS: load = RAM1, type = bss, define = yes; + } </verb></tscreen> What we are doing here is telling the linker, that all segments go into the <tt/RAM1/ memory area in the order specified in the <tt/SEGMENTS/ section. So the linker will first write the <tt/CODE/ segment, then the <tt/RODATA/ segment, then the <tt/DATA/ segment - but it will not write the <tt/BSS/ -segment. Why? Enter the segment type: For each segment specified, you may also +segment. Why? Here enters the segment type: For each segment specified, you may also specify a segment attribute. There are four possible segment attributes: <tscreen><verb> - ro means readonly - rw means read/write - bss means that this is an uninitialized segment - zp a zeropage segment + ro means readonly + rw means read/write + bss means that this is an uninitialized segment + zp a zeropage segment </verb></tscreen> So, because we specified that the segment with the name BSS is of type bss, @@ -531,19 +533,19 @@ a warning if this is not the case. For a <tt/bss/ type segment to be useful, it must be cleared somehow by your program (this happens usually in the startup code - for example the startup -code for cc65 generated programs takes care about that). But how does your +code for cc65-generated programs takes care about that). But how does your code know, where the segment starts, and how big it is? The linker is able to give that information, but you must request it. This is, what we're doing with the "<tt/define = yes/" attribute in the <tt/BSS/ definitions. For each segment, where this attribute is true, the linker will export three symbols. <tscreen><verb> - __NAME_LOAD__ This is set to the address where the - segment is loaded. - __NAME_RUN__ This is set to the run address of the - segment. We will cover run addresses - later. - __NAME_SIZE__ This is set to the segment size. + __NAME_LOAD__ This is set to the address where the + segment is loaded. + __NAME_RUN__ This is set to the run address of the + segment. We will cover run addresses + later. + __NAME_SIZE__ This is set to the segment size. </verb></tscreen> Replace <tt/NAME/ by the name of the segment, in the example above, this would @@ -562,23 +564,23 @@ simple configuration like the one above. There is an additional attribute write the area data into. If there is no file name given, the linker will assign the default file name. This is "a.out" or the one given with the <tt><ref id="option-o" name="-o"></tt> option on the command line. Since the -default behaviour is ok for our purposes, I did not use the attribute in the +default behaviour is OK for our purposes, I did not use the attribute in the example above. Let's have a look at it now. The "file" attribute (the keyword may also be written as "FILE" if you like -that better) takes a string enclosed in double quotes (`"') that specifies the +that better) takes a string enclosed in double quotes (`&dquot;') that specifies the file, where the data is written. You may specify the same file several times, in that case the data for all memory areas having this file name is written into this file, in the order of the memory areas defined in the <tt/MEMORY/ section. Let's specify some file names in the <tt/MEMORY/ section used above: <tscreen><verb> - MEMORY { - RAM1: start = $0800, size = $9800, file = %O; - ROM1: start = $A000, size = $2000, file = "rom1.bin"; - RAM2: start = $C000, size = $1000, file = %O; - ROM2: start = $E000, size = $2000, file = "rom2.bin"; - } + MEMORY { + RAM1: start = $0800, size = $9800, file = %O; + ROM1: start = $A000, size = $2000, file = "rom1.bin"; + RAM2: start = $C000, size = $1000, file = %O; + ROM2: start = $E000, size = $2000, file = "rom2.bin"; + } </verb></tscreen> The <tt/%O/ used here is a way to specify the default behaviour explicitly: @@ -603,10 +605,10 @@ name to that memory area. The <tt/%O/ sequence is also allowed inside a string. So using <tscreen><verb> - MEMORY { - ROM1: start = $A000, size = $2000, file = "%O-1.bin"; - ROM2: start = $E000, size = $2000, file = "%O-2.bin"; - } + MEMORY { + ROM1: start = $A000, size = $2000, file = "%O-1.bin"; + ROM2: start = $E000, size = $2000, file = "%O-2.bin"; + } </verb></tscreen> would write two files that start with the name of the output file specified on @@ -624,17 +626,17 @@ read/write data. But now, if the code is in ROM, we must care about it. Remember the default segments (you may of course specify your own): <tscreen><verb> - CODE read only code - RODATA read only data - DATA read/write data - BSS uninitialized data, read/write + CODE read-only code + RODATA read-only data + DATA read/write data + BSS uninitialized data, read/write </verb></tscreen> Since <tt/BSS/ is not initialized, we must not care about it now, but what about <tt/DATA/? <tt/DATA/ contains initialized data, that is, data that was explicitly assigned a value. And your program will rely on these values on -startup. Since there's no other way to remember the contents of the data -segment, than storing it into one of the ROMs, we have to put it there. But +startup. Since there's no way to remember the contents of the data segment, +other than storing it into one of the ROMs, we have to put it there. But unfortunately, ROM is not writable, so we have to copy it into RAM before running the actual code. @@ -648,12 +650,12 @@ you don't specify a "<tt/run/" attribute, the linker assumes that load area and run area are the same. We will use this feature for our data area: <tscreen><verb> - SEGMENTS { - CODE: load = ROM1, type = ro; - RODATA: load = ROM2, type = ro; - DATA: load = ROM2, run = RAM2, type = rw, define = yes; - BSS: load = RAM2, type = bss, define = yes; - } + SEGMENTS { + CODE: load = ROM1, type = ro; + RODATA: load = ROM2, type = ro; + DATA: load = ROM2, run = RAM2, type = rw, define = yes; + BSS: load = RAM2, type = bss, define = yes; + } </verb></tscreen> Let's have a closer look at this <tt/SEGMENTS/ section. We specify that the @@ -670,12 +672,12 @@ Since we have set this attribute to true, the linker will define three external symbols for the data segment that may be accessed from your code: <tscreen><verb> - __DATA_LOAD__ This is set to the address where the segment - is loaded, in this case, it is an address in - ROM2. - __DATA_RUN__ This is set to the run address of the segment, - in this case, it is an address in RAM2. - __DATA_SIZE__ This is set to the segment size. + __DATA_LOAD__ This is set to the address where the segment + is loaded, in this case, it is an address in + ROM2. + __DATA_RUN__ This is set to the run address of the segment, + in this case, it is an address in RAM2. + __DATA_SIZE__ This is set to the segment size. </verb></tscreen> So, what your startup code must do, is to copy <tt/__DATA_SIZE__/ bytes from @@ -694,25 +696,25 @@ There are some other attributes not covered above. Before starting the reference section, I will discuss the remaining things here. You may request symbols definitions also for memory areas. This may be -useful for things like a software stack, or an i/o area. +useful for things like a software stack, or an I/O area. <tscreen><verb> - MEMORY { - STACK: start = $C000, size = $1000, define = yes; - } + MEMORY { + STACK: start = $C000, size = $1000, define = yes; + } </verb></tscreen> This will define some external symbols that may be used in your code: <tscreen><verb> - __STACK_START__ This is set to the start of the memory - area, $C000 in this example. - __STACK_SIZE__ The size of the area, here $1000. - __STACK_LAST__ This is NOT the same as START+SIZE. - Instead, it it defined as the first - address that is not used by data. If we - don't define any segments for this area, - the value will be the same as START. + __STACK_START__ This is set to the start of the memory + area, $C000 in this example. + __STACK_SIZE__ The size of the area, here $1000. + __STACK_LAST__ This is NOT the same as START+SIZE. + Instead, it is defined as the first + address that is not used by data. If we + don't define any segments for this area, + the value will be the same as START. __STACK_FILEOFFS__ The binary offset in the output file. This is not defined for relocatable output file formats (o65). @@ -721,8 +723,8 @@ This will define some external symbols that may be used in your code: A memory section may also have a type. Valid types are <tscreen><verb> - ro for readonly memory - rw for read/write memory. + ro for readonly memory + rw for read/write memory. </verb></tscreen> The linker will assure, that no segment marked as read/write or bss is put @@ -734,16 +736,16 @@ you don't like this, you may specify a byte value that is used to fill these areas with the "<tt/fillval/" attribute. If there is no "<tt/fillval/" attribute for the segment, the "<tt/fillval/" attribute of the memory area (or its default) is used instead. This means that the value may also be used to -fill unfilled areas generated by the assemblers <tt/.ALIGN/ and <tt/.RES/ +fill unfilled areas generated by the assembler's <tt/.ALIGN/ and <tt/.RES/ directives. The symbol <tt/%S/ may be used to access the default start address (that is, -the one defined in the <ref id="FEATURES" name="FEATURES"> section, or the +the one defined in <ref id="FEATURES" name="the FEATURES section">, or the value given on the command line with the <tt><ref id="option-S" name="-S"></tt> option). To support systems with banked memory, a special attribute named <tt/bank/ is -available. The attribute value is an arbitrary 32 bit integer. The assembler +available. The attribute value is an arbitrary 32-bit integer. The assembler has a builtin function named <tt/.BANK/ which may be used with an argument that has a segment reference (for example a symbol). The result of this function is the value of the bank attribute for the run memory area of the @@ -757,13 +759,13 @@ request this feature. Num must be a power of two. To align all segments on a page boundary, use <tscreen><verb> - SEGMENTS { - CODE: load = ROM1, type = ro, align = $100; - RODATA: load = ROM2, type = ro, align = $100; - DATA: load = ROM2, run = RAM2, type = rw, define = yes, - align = $100; - BSS: load = RAM2, type = bss, define = yes, align = $100; - } + SEGMENTS { + CODE: load = ROM1, type = ro, align = $100; + RODATA: load = ROM2, type = ro, align = $100; + DATA: load = ROM2, run = RAM2, type = rw, define = yes, + align = $100; + BSS: load = RAM2, type = bss, define = yes, align = $100; + } </verb></tscreen> If an alignment is requested, the linker will add enough space to the output @@ -788,17 +790,17 @@ specified offset (this may happen if other segments in this area are too large). Here's an example: <tscreen><verb> - SEGMENTS { - VECTORS: load = ROM2, type = ro, start = $FFFA; - } + SEGMENTS { + VECTORS: load = ROM2, type = ro, start = $FFFA; + } </verb></tscreen> or (for the segment definitions from above) <tscreen><verb> - SEGMENTS { - VECTORS: load = ROM2, type = ro, offset = $1FFA; - } + SEGMENTS { + VECTORS: load = ROM2, type = ro, offset = $1FFA; + } </verb></tscreen> The "<tt/align/", "<tt/start/" and "<tt/offset/" attributes change placement @@ -812,13 +814,13 @@ just the load memory area. A "<tt/fillval/" attribute may not only be specified for a memory area, but also for a segment. The value must be an integer between 0 and 255. It is used -as fill value for space reserved by the assemblers <tt/.ALIGN/ and <tt/.RES/ -commands. It is also used as fill value for space between sections (part of a +as the fill value for space reserved by the assembler's <tt/.ALIGN/ and <tt/.RES/ +commands. It is also used as the fill value for space between sections (part of a segment that comes from one object file) caused by alignment, but not for space that preceeds the first section. To suppress the warning, the linker issues if it encounters a segment that is -not found in any of the input files, use "<tt/optional=yes/" as additional +not found in any of the input files, use "<tt/optional=yes/" as an additional segment attribute. Be careful when using this attribute, because a missing segment may be a sign of a problem, and if you're suppressing the warning, there is no one left to tell you about it. @@ -834,9 +836,9 @@ each output file. Assigning binary format to the default output file would look like this: <tscreen><verb> - FILES { - %O: format = bin; - } + FILES { + %O: format = bin; + } </verb></tscreen> The only other available output format is the o65 format specified by Andre @@ -844,17 +846,17 @@ Fachat (see the <url url="http://www.6502.org/users/andre/o65/fileformat.html" name="6502 binary relocation format specification">). It is defined like this: <tscreen><verb> - FILES { - %O: format = o65; - } + FILES { + %O: format = o65; + } </verb></tscreen> The necessary o65 attributes are defined in a special section labeled -<tt/FORMAT/. +<ref id="FORMAT" name="FORMAT">. -<sect1>The FORMAT section<p> +<sect1>The FORMAT section<label id="FORMAT"><p> The <tt/FORMAT/ section is used to describe file formats. The default (binary) format has currently no attributes, so, while it may be listed in this @@ -885,12 +887,12 @@ linker has features that may be enabled by an additional section labeled tables. <tscreen><verb> - FEATURES { - CONDES: segment = RODATA, - type = constructor, - label = __CONSTRUCTOR_TABLE__, - count = __CONSTRUCTOR_COUNT__; - } + FEATURES { + CONDES: segment = RODATA, + type = constructor, + label = __CONSTRUCTOR_TABLE__, + count = __CONSTRUCTOR_COUNT__; + } </verb></tscreen> The <tt/CONDES/ feature has several attributes: @@ -913,7 +915,7 @@ The <tt/CONDES/ feature has several attributes: <tag><tt>label</tt></tag> This specifies the label to use for the table. The label points to the start - of the table in memory and may be used from within user written code. + of the table in memory and may be used from within user-written code. <tag><tt>count</tt></tag> @@ -926,7 +928,7 @@ The <tt/CONDES/ feature has several attributes: <tag><tt>order</tt></tag> - Optional attribute that takes one of the keywords <tt/increasing/ or + An optional attribute that takes one of the keywords <tt/increasing/ or <tt/decreasing/ as an argument. Specifies the sorting order of the entries within the table. The default is <tt/increasing/, which means that the entries are sorted with increasing priority (the first entry has the lowest @@ -940,7 +942,7 @@ The <tt/CONDES/ feature has several attributes: <tag><tt>import</tt></tag> This attribute defines a valid symbol name, that is added as an import - to the modules defining a constructor/desctructor of the given type. + to the modules defining a constructor/destructor of the given type. This can be used to force linkage of a module if this module exports the requested symbol. @@ -960,10 +962,10 @@ which can be referenced by the <tt/%S/ symbol. The builtin default for the linker is $200. <tscreen><verb> - FEATURES { + FEATURES { # Default start address is $1000 - STARTADDRESS: default = $1000; - } + STARTADDRESS: default = $1000; + } </verb></tscreen> Please note that order is important: The default start address must be defined @@ -1016,10 +1018,10 @@ the programmer to override the value by specifying <tt/--define __STACKSIZE__=xxx/ on the command line. <tscreen><verb> - SYMBOLS { + SYMBOLS { # Define the stack size for the application - __STACKSIZE__: type = weak, value = $800; - } + __STACKSIZE__: type = weak, value = $800; + } </verb></tscreen> From 7eaf721e7c57413b1b2dbe87ca307d19a1ee7ab1 Mon Sep 17 00:00:00 2001 From: Christian Groessler <chris@groessler.org> Date: Mon, 21 Apr 2014 11:39:46 +0200 Subject: [PATCH 28/32] Selection whether to use page 6 for mouse P/M data is not done in Makefile.inc, like the other compile-time options. Small fix in the P/M mouse "show" routine: adapt mouse cursor colors to current screen colors. --- libsrc/atari/Makefile.inc | 4 ++++ libsrc/atari/mcbpm.s | 10 ++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/libsrc/atari/Makefile.inc b/libsrc/atari/Makefile.inc index af5a17e59..4488ddf22 100644 --- a/libsrc/atari/Makefile.inc +++ b/libsrc/atari/Makefile.inc @@ -31,3 +31,7 @@ CA65FLAGS += -D NUMDRVS=4 -D LINEBUF=80 -D UCASE_FILENAME=1 -D DEFAULT_DEVICE=1 # Disabled by default, you should enable it if the linker script relocates the # character generator (like atarixl-largehimem.cfg). #CA65FLAGS += -D CHARGEN_RELOC -D USEWSYNC + +# Disable if you don't want to use page 6 for mouse P/M data. +# If disabled, top of the RAM is used for P/M data. +CA65FLAGS += -D USE_PAGE6 diff --git a/libsrc/atari/mcbpm.s b/libsrc/atari/mcbpm.s index 52a396d9e..b546faced 100644 --- a/libsrc/atari/mcbpm.s +++ b/libsrc/atari/mcbpm.s @@ -7,8 +7,6 @@ ; be called from an interrupt handler ; -USE_PAGE6 = 1 - .include "atari.inc" .importzp sp .export _mouse_pm_callbacks @@ -26,7 +24,7 @@ USE_PAGE6 = 1 ; number of the P/M used for the mouse. All others depend on this value. ; Valid P/M numbers are 0 to 4. When 4 is used, the missiles are used ; as a player. -.if USE_PAGE6 +.ifdef USE_PAGE6 MOUSE_PM_NUM = 2 ; P/M used for the mouse ; This cannot be changed since only player #2 uses the memory at $600. .else @@ -102,7 +100,7 @@ show: lda #1 .endif sta GRACTL - ;rts ; optimized out + jmp update_colors prep: draw: @@ -187,7 +185,7 @@ update_colors: pm_init: lda #0 -.if USE_PAGE6 +.ifdef USE_PAGE6 sta MOUSE_PM_BASE ldx #6 ; page 6 @@ -224,7 +222,7 @@ pm_init: iny bne @iniloo -.if ! USE_PAGE6 +.ifndef USE_PAGE6 lda MOUSE_PM_BASE+1 and #$F8 .endif From eefd33d3093f24dbe4ca1115308702d3d706ab15 Mon Sep 17 00:00:00 2001 From: Christian Groessler <chris@groessler.org> Date: Tue, 22 Apr 2014 12:48:36 +0200 Subject: [PATCH 29/32] Split libref.s into multiple files to prevent inclusion of unnecessary code. --- libsrc/atari/libref.s | 7 +------ libsrc/atari/mouseref.s | 13 +++++++++++++ libsrc/atari/ser_libref.s | 21 +++++++++++++-------- 3 files changed, 27 insertions(+), 14 deletions(-) create mode 100644 libsrc/atari/mouseref.s diff --git a/libsrc/atari/libref.s b/libsrc/atari/libref.s index 4f7cbbef6..171bd6de6 100644 --- a/libsrc/atari/libref.s +++ b/libsrc/atari/libref.s @@ -2,19 +2,14 @@ ; Oliver Schmidt, 2013-05-31 ; - .export em_libref, joy_libref, tgi_libref, ser_libref, mouse_libref + .export em_libref, joy_libref, tgi_libref .import _exit - .import atari_ser_libref em_libref := _exit joy_libref := _exit -ser_libref := atari_ser_libref .ifdef __ATARIXL__ .import CIO_handler tgi_libref := CIO_handler - .import set_VTIMR1_handler -mouse_libref := set_VTIMR1_handler .else -mouse_libref := _exit tgi_libref := _exit .endif diff --git a/libsrc/atari/mouseref.s b/libsrc/atari/mouseref.s new file mode 100644 index 000000000..b75df93d1 --- /dev/null +++ b/libsrc/atari/mouseref.s @@ -0,0 +1,13 @@ +; +; Christian Groessler, 2014-04-22 +; + + .export mouse_libref + +.ifdef __ATARIXL__ + .import set_VTIMR1_handler +mouse_libref := set_VTIMR1_handler +.else + .import _exit +mouse_libref := _exit +.endif diff --git a/libsrc/atari/ser_libref.s b/libsrc/atari/ser_libref.s index 4b5c58508..89ef1e519 100644 --- a/libsrc/atari/ser_libref.s +++ b/libsrc/atari/ser_libref.s @@ -1,7 +1,12 @@ +; +; Christian Groessler, 2014-04-22 +; - .include "atari.inc" + .include "atari.inc" - .import _close, pushax, popax + .export ser_libref + + .import _close, pushax, popax .import findfreeiocb .import __do_oserror .import fddecusage @@ -10,19 +15,19 @@ .import clriocb .import newfd - .export atari_ser_libref +ser_libref := atari_ser_libref .rodata atari_ser_libref: - .word newfd - .word _close - .word pushax - .word popax + .word newfd + .word _close + .word pushax + .word popax .word findfreeiocb .word __do_oserror .word fddecusage .word fdtoiocb .word __inviocb .word clriocb - .word CIOV + .word CIOV From 2059e34114b5423d7be7f758c7fe2a3c8e580b72 Mon Sep 17 00:00:00 2001 From: Christian Groessler <chris@groessler.org> Date: Tue, 22 Apr 2014 13:41:57 +0200 Subject: [PATCH 30/32] rename ser_libref.s to serref.s in order to be consistent with other targets --- libsrc/atari/{ser_libref.s => serref.s} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename libsrc/atari/{ser_libref.s => serref.s} (100%) diff --git a/libsrc/atari/ser_libref.s b/libsrc/atari/serref.s similarity index 100% rename from libsrc/atari/ser_libref.s rename to libsrc/atari/serref.s From 401e18d9828c4b45a9682c660e819975cefc85e6 Mon Sep 17 00:00:00 2001 From: Christian Groessler <chris@groessler.org> Date: Thu, 24 Apr 2014 02:01:30 +0200 Subject: [PATCH 31/32] Put mouse cursor shape definition into .rodata. --- libsrc/atari/mcbpm-shape.s | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libsrc/atari/mcbpm-shape.s b/libsrc/atari/mcbpm-shape.s index 3a001b561..bb754f48a 100644 --- a/libsrc/atari/mcbpm-shape.s +++ b/libsrc/atari/mcbpm-shape.s @@ -13,8 +13,7 @@ .export mouse_pm_hotspot_x : zeropage .export mouse_pm_hotspot_y : zeropage - - .data + .rodata mouse_pm_bits: .byte %11110000 From 4a1eff1d8427cc25196cfb164cf21761047ec591 Mon Sep 17 00:00:00 2001 From: Christian Groessler <chris@groessler.org> Date: Thu, 24 Apr 2014 02:02:02 +0200 Subject: [PATCH 32/32] Document mouse callbacks and some other small changes. --- doc/atari.sgml | 58 ++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 52 insertions(+), 6 deletions(-) diff --git a/doc/atari.sgml b/doc/atari.sgml index 1bdfd8ba2..64a28c7b5 100644 --- a/doc/atari.sgml +++ b/doc/atari.sgml @@ -63,7 +63,7 @@ detailed information about the load chunks see the chapter sufficient to know that the first load chunk(s) do preparation work and the main part of the program is in the last load chunk. -The values determining the size of the main part of the program (the only load +The values determining the size of the main part of the program (the second load chunk for <tt/atari/, the third load chunk for <tt/atarixl/) are calculated in the crt0.s file from the __STARTUP_LOAD__ and __BSS_LOAD__ values. Be aware of that if you create a custom linker config file and start moving segments around (see section @@ -130,11 +130,12 @@ areas available, [$D800-$DFFF] and [$E400-&d </enum> With the default load address of $2400 this gives a usable memory range of -[$2400-$CFFF]. Note that the default load address for <tt/atarixl/ is -different (and lower) that the default load address for <tt/atari/. This is no problem since -on the <tt/atarixl/ target the first load chunk makes sure that the loaded prgram won't overwrite -memory below MEMLO. See <ref name="atarixl load chunks" id="xlchunks">. +[$2400-$CFFF]. +Please note that the first load chunk (which checks the system +compatibilty and available memory) will always be loaded at +$2E00, regardless of the specified start address. This address +can only be changed by a custom linker config file. Special locations: @@ -459,6 +460,49 @@ All mouse devices connect to joystick port #0. Default drivers: <tt/atrst.mou (atrst_mou)/ and <tt/atrxst.mou (atrxst_mou)/. +<sect2>Mouse callbacks<p> + +There are two mouse callbacks available. +<p> +The "text mode" callbacks (<tt/mouse_txt_callbacks/) display the mouse cursor as a "diamond" character +on the standard "GRAPHICS 0" text mode screen. The mouse cursor character can be changed by an +assembly file defining the character by exporting the zeropage symbol <tt/mouse_txt_char/. +The default file looks like this: +<tscreen><verb> + .export mouse_txt_char : zp = 96 ; 'diamond' screen code +</verb></tscreen> +<p> +The "P/M" callbacks (<tt/mouse_pm_callbacks/) use Player-Missile graphics for the mouse cursor. +The cursor shape can be changed, too, by an assembly file. Here's the default shape definition: +<tscreen><verb> + .export mouse_pm_bits + .export mouse_pm_height : zeropage + .export mouse_pm_hotspot_x : zeropage + .export mouse_pm_hotspot_y : zeropage + .rodata +mouse_pm_bits: + .byte %11110000 + .byte %11000000 + .byte %10100000 + .byte %10010000 + .byte %10001000 + .byte %00000100 + .byte %00000010 +mouse_pm_height = * - mouse_pm_bits +; hot spot is upper left corner +mouse_pm_hotspot_x = 0 +mouse_pm_hotspot_y = 0 +</verb></tscreen> +<p> +<tt/mouse_pm_bits/ defines the shape of the cursor, <tt/mouse_pm_height/ defines the number of +bytes in <tt/mouse_pm_bits/. <tt/mouse_pm_hotspot_x/ and <tt/mouse_pm_hotspot_y/ define the +position in the shape where "the mouse points to". When using this callback page #6 ($600 + - $6FF) is used for the P/M graphics data and no P/M graphics can otherwise be used +by the program. The height of the shape (<tt/mouse_pm_height/) +must not exceed 32 lines since the callback routines cannot handle more than 32 lines. +<p> +The default callbacks definition (<tt/mouse_def_callbacks/) is an alias for the "P/M" callbacks. + <sect1>RS232 device drivers<p> Currently there is one RS232 driver. It uses the R: device (therefore @@ -649,7 +693,7 @@ Function keys are mapped to Atari + number key. <sect1>Passing arguments to the program<p> -Command line arguments can be passed to <tt/main()/ when DOS supports it. +Command line arguments can be passed to <tt/main()/ when the used DOS supports it. <enum> <item>Arguments are separated by spaces. @@ -668,6 +712,8 @@ subroutines and will be called automatically by the VBI handler code when they are linked into a program. See the discussion of the <tt/.CONDES/ feature in the <url url="ca65.html" name="assembler manual">. +Please note that on the Atari targets the <tt/.INTERRUPTOR/s are being +run in NMI context. The other targets run them in IRQ context. <sect1>Reserving a memory area inside a program<label id="memhole"><p>