From 28b1687aafc4c124cbb6664d20d4b0759125d350 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Sun, 26 Sep 2021 12:09:50 +0200 Subject: [PATCH 01/12] Be explicit about hardware flow control (RTS/CTS) being the only supported option. --- doc/apple2.sgml | 4 ++-- doc/apple2enh.sgml | 4 ++-- doc/atari.sgml | 6 +++--- doc/atmos.sgml | 9 +++++---- doc/c128.sgml | 6 +++--- doc/c64.sgml | 6 +++--- doc/cbm510.sgml | 8 ++++---- doc/cbm610.sgml | 8 ++++---- doc/plus4.sgml | 8 ++++---- 9 files changed, 30 insertions(+), 29 deletions(-) diff --git a/doc/apple2.sgml b/doc/apple2.sgml index f957e1247..bd01b68dc 100644 --- a/doc/apple2.sgml +++ b/doc/apple2.sgml @@ -428,8 +428,8 @@ The names in the parentheses denote the symbols to be used for static linking of Driver for the Apple II Super Serial Card. 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 + requires hardware flow control (RTS/CTS) and does 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. diff --git a/doc/apple2enh.sgml b/doc/apple2enh.sgml index 4aafbc256..56fc05e31 100644 --- a/doc/apple2enh.sgml +++ b/doc/apple2enh.sgml @@ -428,8 +428,8 @@ The names in the parentheses denote the symbols to be used for static linking of Driver for the Apple II Super Serial Card. 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 + requires hardware flow control (RTS/CTS) and does 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. diff --git a/doc/atari.sgml b/doc/atari.sgml index f2ced13e1..903895d17 100644 --- a/doc/atari.sgml +++ b/doc/atari.sgml @@ -675,9 +675,9 @@ The default callbacks definition (RS232 device drivers

-Currently there is one RS232 driver. It uses the R: device (therefore -an R: driver needs to be installed) and was tested with the 850 -interface module. +Currently there is one RS232 driver. It supports up to 9600 baud, requires hardware flow control +(RTS/CTS) and uses the R: device (therefore an R: driver needs to be installed). It was tested +with the 850 interface module. diff --git a/doc/atmos.sgml b/doc/atmos.sgml index 3fd61abcf..cef7770e4 100644 --- a/doc/atmos.sgml +++ b/doc/atmos.sgml @@ -176,10 +176,11 @@ No mouse drivers are currently available for the Atmos. 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 - blocks if the receiver asserts flow control because of a full buffer. + serial add-on. Supports up to 19200 baud, requires hardware flow control + (RTS/CTS) and does 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.

diff --git a/doc/c128.sgml b/doc/c128.sgml index 8c62b6ad1..60306814c 100644 --- a/doc/c128.sgml +++ b/doc/c128.sgml @@ -324,9 +324,9 @@ The default drivers, - 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 + Driver for the SwiftLink cartridge. Supports up to 38400 baud, requires hardware + flow control (RTS/CTS) and does 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. diff --git a/doc/c64.sgml b/doc/c64.sgml index 7e00f3b93..de37ed4b7 100644 --- a/doc/c64.sgml +++ b/doc/c64.sgml @@ -410,9 +410,9 @@ The default drivers, - 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 + Driver for the SwiftLink cartridge. Supports up to 38400 baud, requires hardware + flow control (RTS/CTS) and does 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. diff --git a/doc/cbm510.sgml b/doc/cbm510.sgml index c208f3ead..86bed7607 100644 --- a/doc/cbm510.sgml +++ b/doc/cbm510.sgml @@ -231,10 +231,10 @@ The default drivers, Driver for the 6551 ACIA chip built into the Commodore 510. Supports up to - 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. + 19200 baud, requires hardware flow control (RTS/CTS) and does 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.

diff --git a/doc/cbm610.sgml b/doc/cbm610.sgml index 37a445dd1..d86950abc 100644 --- a/doc/cbm610.sgml +++ b/doc/cbm610.sgml @@ -212,10 +212,10 @@ No mouse drivers are currently available for the Commodore 610. Driver for the 6551 ACIA chip built into the Commodore 610. Supports up to - 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. + 19200 baud, requires hardware flow control (RTS/CTS) and does 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.

diff --git a/doc/plus4.sgml b/doc/plus4.sgml index 645de5161..79a2597d0 100644 --- a/doc/plus4.sgml +++ b/doc/plus4.sgml @@ -195,10 +195,10 @@ No mouse drivers are currently available for the Plus/4. Driver for the 6551 ACIA chip built into the Plus/4. 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 - control because of a full buffer. + baud, requires hardware flow control (RTS/CTS) and does 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. You need an adapter to use the builtin port, since the output levels available at the user port don't follow the RS232 standard. From eeaa111835d5c82cc821e120a4eba2d548bd2c32 Mon Sep 17 00:00:00 2001 From: acqn Date: Tue, 28 Sep 2021 17:30:10 +0800 Subject: [PATCH 02/12] Fixed crash in Opt_a_toscmpbool caused by wrong order of condition checks. --- src/cc65/coptstop.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cc65/coptstop.c b/src/cc65/coptstop.c index 23636e533..08f6c820e 100644 --- a/src/cc65/coptstop.c +++ b/src/cc65/coptstop.c @@ -1113,9 +1113,9 @@ static unsigned Opt_a_toscmpbool (StackOpData* D, const char* BoolTransformer) D->IP = D->OpIndex + 1; - if (!D->RhsMultiChg && - (D->Rhs.A.LoadEntry->Flags & CEF_DONT_REMOVE) == 0 && - (D->Rhs.A.Flags & LI_DIRECT) != 0) { + if (!D->RhsMultiChg && + (D->Rhs.A.Flags & LI_DIRECT) != 0 && + (D->Rhs.A.LoadEntry->Flags & CEF_DONT_REMOVE) == 0) { /* cmp */ AddOpLow (D, OP65_CMP, &D->Rhs); From 6ba8a385a0b81af5388f47d18ce45c3753cde6ba Mon Sep 17 00:00:00 2001 From: mrdudz Date: Tue, 28 Sep 2021 15:59:54 +0200 Subject: [PATCH 03/12] add test related tu issue #1562 --- test/val/bug1562.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 test/val/bug1562.c diff --git a/test/val/bug1562.c b/test/val/bug1562.c new file mode 100644 index 000000000..7e6c1751e --- /dev/null +++ b/test/val/bug1562.c @@ -0,0 +1,30 @@ + +/* bug 1562: cc65 generates incorrect code for logical expression with -O */ + +#include +#include + +int failures = 0; + +char input[256]; + +#define DEBUGTRUE(x) printf("%s=%d\n", #x, (x)); failures += (x) ? 0 : 1 + +#define DEBUGFALSE(x) printf("%s=%d\n", #x, (x)); failures += (x) ? 1 : 0 + +int main(void) { + char* r; + strcpy(input, "\"XYZ\""); + r = input+4; + DEBUGFALSE(*r != '"'); // = false + DEBUGTRUE(*r == '"'); // = true + DEBUGFALSE(*(r+1) == '"'); // = false + // Next answer should be false because + // (false || true && false) is false, but it is true with -O. + DEBUGFALSE(*r != '"' || *r == '"' && *(r+1) == '"'); + // Adding parens fixes it even with -O. + DEBUGFALSE(*r != '"' || (*r == '"' && *(r+1) == '"')); + + printf("failures: %d\n", failures); + return failures; +} From 86f19652022ed7c6cc5152c219ee9e8976f78d9e Mon Sep 17 00:00:00 2001 From: mrdudz Date: Tue, 28 Sep 2021 18:55:23 +0200 Subject: [PATCH 04/12] added test related to issue #1552 fixed in pr #1571 --- test/val/bug1552.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 test/val/bug1552.c diff --git a/test/val/bug1552.c b/test/val/bug1552.c new file mode 100644 index 000000000..42f39eec6 --- /dev/null +++ b/test/val/bug1552.c @@ -0,0 +1,42 @@ + +/* + bug #1552 - crash in fuzix xec.c + + cc65 -t none -O bug1552.c +*/ + +#include + +typedef struct trenod *TREPTR; +typedef struct whnod *WHPTR; + +struct trenod { + int tretyp; +}; + +struct whnod { + int whtyp; + TREPTR whtre; +}; + +int execute(TREPTR argt, int execflg, int *pf1, int *pf2) +{ + register TREPTR t; + int type; + switch (type) + { + case 6: + { + while ((execute(((WHPTR) t)->whtre, 0, NULL, NULL) == 0) == (type == 5)) { + + } + break; + } + } + return 0; +} + +int main(void) +{ + return execute((TREPTR)42, 2, (int *)3, (int *)4); +} From cf1c0b67747be04a6a0b9aabff4c1aae2f761214 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Tue, 28 Sep 2021 22:18:49 +0200 Subject: [PATCH 05/12] move hints on how to run binaries from the target specific pages to the intro page, where they should be. --- doc/gamate.sgml | 11 ++---- doc/intro.sgml | 94 ++++++++++++++++++++++++++++++++++++++++--------- doc/pce.sgml | 7 +--- 3 files changed, 80 insertions(+), 32 deletions(-) diff --git a/doc/gamate.sgml b/doc/gamate.sgml index 8e18ab76d..b61053ce8 100644 --- a/doc/gamate.sgml +++ b/doc/gamate.sgml @@ -3,7 +3,7 @@

Gamate System specific information for cc65 <author> -<url url="mailto:groepaz@gmx.net" name="Groepaz/Hitmen"> +<url url="mailto:groepaz@gmx.net" name="Groepaz"> <abstract> An overview over the Gamate runtime system as it is implemented for the @@ -117,14 +117,7 @@ following functions (and a few others): <sect>Other hints<p> <itemize> -<item>The Gamate is emulated by MESS (<url url="http://www.mess.org/">), -run like this: <tt>mess gamate -debug -window -skip_gameinfo -cart test.bin</tt> -</itemize> - -some resources on the Gamate: - -<itemize> -<item><url url="http://en.wikipedia.org/wiki/Gamate"> +<item>some resources on the Gamate: <url url="http://en.wikipedia.org/wiki/Gamate"> </itemize> <sect>License<p> diff --git a/doc/intro.sgml b/doc/intro.sgml index b2b141d10..0617b0ab3 100644 --- a/doc/intro.sgml +++ b/doc/intro.sgml @@ -6,6 +6,7 @@ <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">,<newline> +<url url="mailto:groepaz@gmx.net" name="Groepaz">,<newline> <url url="mailto:stephan.muehlstrasser@web.de" name="Stephan Mühlstrasser"> <abstract> @@ -458,12 +459,8 @@ Substitute the name of a Commodore computer for that <tt/<sys>/: Start the desired version of the emulator (CBM610 programs run on the CBM II [<tt/xcbm2/] emulator). -In the Windows versions of VICE, choose <bf>File>Autoboot disk/tape -image...</bf>, choose your executable, and click <bf/OK/. - -In the Unix versions, hold down the mouse's first button. Move the pointer to -<bf>Smart-attach disk/tape...</bf>, and release the button. Choose your -executable, and click <bf/Autostart/. +Choose <bf>File>Autostart disk/tape image...</bf>, choose your executable, +and click <bf/OK/. The file has a 14-byte header which corresponds to a PRG-format BASIC program, consisting of a single line, similar to this: @@ -499,6 +496,29 @@ The output will appear on a separate line, and you will be returned to a BASIC prompt. +<sect1>Gamate<p> + +Before you can run the cartridge image produced by the linker, the binary has to +be patched using the <bf/gamate-fixcart/ tool that is included in the cc65 +package in the util/gamata directory. + +<tscreen><verb> +gamate-fixcart <image.bin> +</verb></tscreen> + +<sect2>MESS<p> +Available at <url +url="https://www.mamedev.org">: + +MESS (Multiple Emulator Super System) is a multi system emulator that emulates +various cc65 targets. It once started as a MAME fork, but was marged into MAME +again at some point. + +<tscreen><verb> +mess gamate -debug -window -skip_gameinfo -cart <image.bin> +</verb></tscreen> + + <sect1>GEOS<p> Available at <it/Click Here Software's/ <url url="http://cbmfiles.com/geos/index.html" name="GEOS download section">: @@ -535,17 +555,8 @@ feature on. </quote> <quote> -VICE even has different ways that depend on which operating system is running -the emulator. -<itemize> -<item>In Windows, you must click on <bf/Options/ (in an always visible menu). - Then, you must click on <bf/True drive emulation/. -<item>In Unix, you must <em/hold down/ the second button on your mouse. Move - the pointer down to <bf/Drive settings/. Then, move the pointer over to - <bf/Enable true drive emulation/. (If there is a check-mark in front of - those words, that feature already is turned on -- then, move the pointer - off of that menu.) Release the mouse button. -</itemize> +In VICE, got to <bf/Settings/ -> <bf/Settings/, then <bf/Peripherial devices/ -> +<bf/Drive/. Then, you must enable the <bf/True drive emulation/ checkbox. </quote> Find the <bf/CONVERT/ program on the boot disk [tap the 6-key; then, you @@ -572,6 +583,29 @@ directory notePad. Look at the eight file-positions on each page until you see The output is shown in a GEOS dialog box; click <bf/OK/ when you have finished reading it. +Alternatively you can use the <bf/c1541/ program that comes with VICE to write the +file to a disk image directly in GEOS format, so it can be used in GEOS directly +without having to use the <bf/CONVERT/ program. + +<tscreen><verb> +c1541 -attach geos.d64 -geoswrite hello1 +</verb></tscreen> + + +<sect1>Nintendo Entertainment System<p> + +<sect2>Mednafen (NES)<p> +Available at <url +url="https://mednafen.github.io/releases/">: + +Mednafen is a multi system emulator that emulates a couple of the supported +targets of cc65: Apple II/II+, Atari Lynx, Nintendo Entertainment System and +PC Engine/TurboGrafx 16. + +<tscreen><verb> +mednafen -force_module nes <image.bin> +</verb></tscreen> + <sect1>Ohio Scientific Challenger 1P<p> The <tt/osic1p/ runtime library returns to the boot prompt when the main() @@ -694,6 +728,32 @@ Press <RETURN>. After hitting the RETURN key, you should see the boot prompt again. +<sect1>PC Engine/TurboGrafx 16<p> + +For the cartridge image produced by the linker to work in emulators and on real +hardware, its content must be rearranged so the first 8k block becomes the last +8k block in the image. + +For example, for a 32k image this can be done using <bf/dd/ as follows: + +<tscreen><verb> +dd if=infile.bin bs=8K skip=3 > outfile.pce +dd if=infile.bin bs=8K count=3 >> outfile.pce +</verb></tscreen> + +<sect2>Mednafen<p> +Available at <url +url="https://mednafen.github.io/releases/">: + +Mednafen is a multi system emulator that emulates a couple of the supported +targets of cc65: Apple II/II+, Atari Lynx, Nintendo Entertainment System and +PC Engine/TurboGrafx 16. + +<tscreen><verb> +mednafen -force_module pce <image.pce> +</verb></tscreen> + + <sect1>Contributions wanted<p> We need your help! Recommended emulators and instructions for other targets diff --git a/doc/pce.sgml b/doc/pce.sgml index 42a1ca9d3..47eeabcfd 100644 --- a/doc/pce.sgml +++ b/doc/pce.sgml @@ -2,7 +2,7 @@ <article> <title>PC-Engine (TurboGrafx 16) System-specific information for cc65 -<author><url url="mailto:groepaz@gmx.net" name="Groepaz/Hitmen">,<newline> +<author><url url="mailto:groepaz@gmx.net" name="Groepaz">,<newline> <url url="mailto:greg.king5@verizon.net" name="Greg King"> <abstract> @@ -206,11 +206,6 @@ following functions (and a few others): <sect>Other hints<p> -<itemize> -<item><url url="https://mednafen.github.io/" name= "Mednafen"> is a good -emulator to use for the PC-Engine. -</itemize> - Some useful resources on PCE coding: <itemize> From 94445cd16ffdcd245e1c0d1a1f23a2375fac2ca9 Mon Sep 17 00:00:00 2001 From: mrdudz <mrdudz@users.noreply.github.com> Date: Tue, 28 Sep 2021 22:37:34 +0200 Subject: [PATCH 06/12] remove conio.pce from the default target and print a message instead --- targettest/pce/Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/targettest/pce/Makefile b/targettest/pce/Makefile index 1ecc0566f..f91f0eed8 100644 --- a/targettest/pce/Makefile +++ b/targettest/pce/Makefile @@ -42,14 +42,15 @@ else COUNT := 1 endif -all: conio.pce +all: conio.bin + +%.bin: %.c + $(CL) -t pce $< -Wl -D__CARTSIZE__=${CARTSIZE} -m $*.map -o $@ + @echo "use 'make conio.pce' to produce a .pce file using dd" %.pce: %.bin dd if=$< bs=8K skip=${COUNT} > $@ dd if=$< bs=8K count=${COUNT} >> $@ -%.bin: %.c - $(CL) -t pce $< -Wl -D__CARTSIZE__=${CARTSIZE} -m $*.map -o $@ - clean: @$(DEL) conio.o conio.??? 2>$(NULLDEV) From 2338e70709294a93d69d1f8bdc50d51509566b24 Mon Sep 17 00:00:00 2001 From: cc65 Owner <41281059+cc65-github@users.noreply.github.com> Date: Wed, 29 Sep 2021 10:37:44 +0200 Subject: [PATCH 07/12] travis-ci.org -> travis-ci.com --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2c84b7430..36a4b56cd 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [Wiki](https://github.com/cc65/wiki/wiki) -[![Build Status](https://api.travis-ci.org/cc65/cc65.svg?branch=master)](https://travis-ci.org/cc65/cc65/builds) +[![Build Status](https://app.travis-ci.com/cc65/cc65.svg?branch=master)](https://app.travis-ci.com/cc65/cc65) cc65 is a complete cross development package for 65(C)02 systems, including a powerful macro assembler, a C compiler, linker, librarian and several From 674a5439096b6bb16a3622e45b8a5f0c5218c998 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Wed, 29 Sep 2021 12:33:51 +0200 Subject: [PATCH 08/12] Parallelize build Travis CI defaults to 2 core environments. --- .travis.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0b25e5d16..c9068193a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,14 +9,14 @@ jobs: - sudo apt-get update - sudo apt-get install linuxdoc-tools linuxdoc-tools-info binutils-mingw-w64-i686 gcc-mingw-w64-i686 sshpass script: - - make bin USER_CFLAGS=-Werror - - make lib QUIET=1 - - make test QUIET=1 - - make samples + - make -j2 bin USER_CFLAGS=-Werror + - make -j2 lib QUIET=1 + - make -j2 test QUIET=1 + - make -j2 samples - make -C src clean - - make bin USER_CFLAGS=-Werror CROSS_COMPILE=i686-w64-mingw32- + - make -j2 bin USER_CFLAGS=-Werror CROSS_COMPILE=i686-w64-mingw32- - make -C samples clean - - make doc zip + - make -j2 doc zip after_success: - make -f Makefile.travis From c48e821c4bfe9d4bd178a742261808c79bd65e1a Mon Sep 17 00:00:00 2001 From: Oliver Schmidt <ol.sc@web.de> Date: Wed, 29 Sep 2021 14:48:09 +0200 Subject: [PATCH 09/12] Don --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c9068193a..4b0919a10 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ jobs: script: - make -j2 bin USER_CFLAGS=-Werror - make -j2 lib QUIET=1 - - make -j2 test QUIET=1 + - make test QUIET=1 - make -j2 samples - make -C src clean - make -j2 bin USER_CFLAGS=-Werror CROSS_COMPILE=i686-w64-mingw32- From f6636635fae4ed40bb687ed13eff5f8e91e56883 Mon Sep 17 00:00:00 2001 From: Christian Groessler <chris@groessler.org> Date: Tue, 5 Oct 2021 19:17:16 +0200 Subject: [PATCH 10/12] targettest/atari/multi-xex.cfg: fix comments --- targettest/atari/multi-xex.cfg | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/targettest/atari/multi-xex.cfg b/targettest/atari/multi-xex.cfg index 7558aa895..f13a9eabe 100644 --- a/targettest/atari/multi-xex.cfg +++ b/targettest/atari/multi-xex.cfg @@ -5,13 +5,13 @@ MEMORY { ZP: file = "", define = yes, start = $0082, size = $007E; # First memory segment in file, show message LOADER: file = %O, start = $680, size = 128; - # First memory segment in file, load over COLOR registers: + # Second memory segment in file, load over COLOR registers: COLOR: file = %O, start = $2C4, size = 5; - # Second memory segment, load at page 6: + # Third memory segment, load at page 6: PAGE6: file = %O, start = $600, size = 128; - # Third memory segment in file, load over SDLST register: + # Fourth memory segment in file, load over SDLST register: SDLST: file = %O, start = $230, size = 2; - # Main segment, load at "STARTADDRESS" + # Fifth/Main segment, load at "STARTADDRESS" MAIN: file = %O, start = %S, size = $BC20 - %S; } FILES { From c3d7a900844673cc4a85f0c132a2faa00886f711 Mon Sep 17 00:00:00 2001 From: Christian Groessler <chris@groessler.org> Date: Tue, 5 Oct 2021 19:19:54 +0200 Subject: [PATCH 11/12] targettest/atari/ostype.c: remove warnings --- targettest/atari/ostype.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/targettest/atari/ostype.c b/targettest/atari/ostype.c index 552735ac8..5561f64fd 100644 --- a/targettest/atari/ostype.c +++ b/targettest/atari/ostype.c @@ -9,9 +9,9 @@ int main(void) { + char *rev; unsigned int t, v; unsigned char palntsc; - unsigned char *rev; unsigned char minor; unsigned char c; From 4f87c7cc645c72903f99c78abcf52124b1e14623 Mon Sep 17 00:00:00 2001 From: mrdudz <mrdudz@users.noreply.github.com> Date: Sat, 23 Oct 2021 01:18:17 +0200 Subject: [PATCH 12/12] move samples that only work for a specific target into subdirs named the same as the target --- samples/Makefile | 23 +-- samples/atari2600/Makefile | 59 +++++++ .../{atari2600hello.c => atari2600/hello.c} | 0 samples/cbm/Makefile | 164 ++++++++++++++++++ samples/{ => cbm}/fire.c | 0 samples/{ => cbm}/nachtm.c | 0 samples/{ => cbm}/plasma.c | 0 samples/readme.txt | 89 ++++++---- samples/supervision/Makefile | 59 +++++++ .../hello.c} | 0 10 files changed, 343 insertions(+), 51 deletions(-) create mode 100644 samples/atari2600/Makefile rename samples/{atari2600hello.c => atari2600/hello.c} (100%) create mode 100644 samples/cbm/Makefile rename samples/{ => cbm}/fire.c (100%) rename samples/{ => cbm}/nachtm.c (100%) rename samples/{ => cbm}/plasma.c (100%) create mode 100644 samples/supervision/Makefile rename samples/{supervisionhello.c => supervision/hello.c} (100%) diff --git a/samples/Makefile b/samples/Makefile index 7e5c1934d..db7bb0d84 100644 --- a/samples/Makefile +++ b/samples/Makefile @@ -154,7 +154,7 @@ endif # Lists of subdirectories # disasm depends on cpp -DIRLIST = tutorial geos +DIRLIST = tutorial geos atari2600 supervision cbm # -------------------------------------------------------------------------- # Lists of executables @@ -205,28 +205,22 @@ EXELIST_bbc = \ EXELIST_c64 = \ ascii \ enumdevdir \ - fire \ gunzip65 \ hello \ mandelbrot \ mousedemo \ multdemo \ - nachtm \ ovrldemo \ - plasma \ sieve \ tgidemo EXELIST_c128 = \ ascii \ enumdevdir \ - fire \ gunzip65 \ hello \ mandelbrot \ mousedemo \ - nachtm \ - plasma \ sieve \ tgidemo @@ -237,19 +231,15 @@ EXELIST_c16 = \ EXELIST_cbm510 = \ ascii \ - fire \ gunzip65 \ hello \ mousedemo \ - nachtm \ - plasma \ sieve EXELIST_cbm610 = \ ascii \ gunzip65 \ hello \ - nachtm \ sieve EXELIST_creativision = \ @@ -302,7 +292,6 @@ EXELIST_plus4 = \ enumdevdir \ gunzip65 \ hello \ - plasma \ sieve EXELIST_sim6502 = \ @@ -311,7 +300,7 @@ EXELIST_sim6502 = \ EXELIST_sim65c02 = $(EXELIST_sim6502) EXELIST_supervision = \ - supervisionhello + notavailable EXELIST_telestrat = \ ascii \ @@ -398,7 +387,7 @@ $(C1541) -attach $@ -write "$(subst ?,$(SPACE),$(file))" $(notdir $(file)),s >$( endef # D64_WRITE_SEQ_recipe samples.d64: samples - @$(C1541) -format samples,AA d64 $@ >$(NULLDEV) + @$(C1541) -format "samples,00" d64 $@ >$(NULLDEV) $(foreach file,$(EXELIST_$(SYS)),$(D64_WRITE_PRG_recipe)) $(foreach file,$(OVERLAYLIST),$(D64_WRITE_PRG_recipe)) $(foreach file,$(EMD) $(MOU) $(TGI),$(D64_WRITE_SEQ_recipe)) @@ -460,11 +449,17 @@ install: $(INSTALL) -d $(DESTDIR)$(samplesdir) $(INSTALL) -d $(DESTDIR)$(samplesdir)/geos $(INSTALL) -d $(DESTDIR)$(samplesdir)/tutorial + $(INSTALL) -d $(DESTDIR)$(samplesdir)/atari2600 + $(INSTALL) -d $(DESTDIR)$(samplesdir)/cbm + $(INSTALL) -d $(DESTDIR)$(samplesdir)/supervision $(INSTALL) -m0644 *.* $(DESTDIR)$(samplesdir) $(INSTALL) -m0644 readme.txt $(DESTDIR)$(samplesdir) $(INSTALL) -m0644 Makefile $(DESTDIR)$(samplesdir) $(INSTALL) -m0644 geos/*.* $(DESTDIR)$(samplesdir)/geos $(INSTALL) -m0644 tutorial/*.* $(DESTDIR)$(samplesdir)/tutorial + $(INSTALL) -m0644 atari2600/*.* $(DESTDIR)$(samplesdir)/atari2600 + $(INSTALL) -m0644 cbm/*.* $(DESTDIR)$(samplesdir)/cbm + $(INSTALL) -m0644 supervision/*.* $(DESTDIR)$(samplesdir)/supervision # -------------------------------------------------------------------------- # Packaging rules diff --git a/samples/atari2600/Makefile b/samples/atari2600/Makefile new file mode 100644 index 000000000..a02ec9e80 --- /dev/null +++ b/samples/atari2600/Makefile @@ -0,0 +1,59 @@ + +# Run 'make SYS=<target>'; or, set a SYS env. +# var. to build for another target system. +SYS ?= atari2600 + +# Just the usual way to find out if we're +# using cmd.exe to execute make rules. +ifneq ($(shell echo),) + CMD_EXE = 1 +endif + +ifdef CMD_EXE + NULLDEV = nul: + DEL = -del /f + RMDIR = rmdir /s /q +else + NULLDEV = /dev/null + DEL = $(RM) + RMDIR = $(RM) -r +endif + +ifdef CC65_HOME + AS = $(CC65_HOME)/bin/ca65 + CC = $(CC65_HOME)/bin/cc65 + CL = $(CC65_HOME)/bin/cl65 + LD = $(CC65_HOME)/bin/ld65 + SP = $(CC65_HOME)/bin/sp65 +else + AS := $(if $(wildcard ../../bin/ca65*),../../bin/ca65,ca65) + CC := $(if $(wildcard ../../bin/cc65*),../../bin/cc65,cc65) + CL := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65) + LD := $(if $(wildcard ../../bin/ld65*),../../bin/ld65,ld65) + SP := $(if $(wildcard ../../bin/sp65*),../../bin/sp65,sp65) +endif + +EXELIST_atari2600 = \ + hello + +ifneq ($(EXELIST_$(SYS)),) +samples: $(EXELIST_$(SYS)) +else +samples: notavailable +endif + +# empty target used to skip systems that will not work with any program in this dir +notavailable: +ifeq ($(MAKELEVEL),0) + @echo "info: atari 2600 samples not available for" $(SYS) +else +# suppress the "nothing to be done for 'samples' message + @echo > $(NULLDEV) +endif + +hello: hello.c + $(CL) -t $(SYS) -O -o hello -m hello.map hello.c + +clean: + @$(DEL) $(EXELIST_atari2600) 2>$(NULLDEV) + @$(DEL) *.map 2>$(NULLDEV) diff --git a/samples/atari2600hello.c b/samples/atari2600/hello.c similarity index 100% rename from samples/atari2600hello.c rename to samples/atari2600/hello.c diff --git a/samples/cbm/Makefile b/samples/cbm/Makefile new file mode 100644 index 000000000..989710932 --- /dev/null +++ b/samples/cbm/Makefile @@ -0,0 +1,164 @@ + +# Run 'make SYS=<target>'; or, set a SYS env. +# var. to build for another target system. +SYS ?= c64 + +# Just the usual way to find out if we're +# using cmd.exe to execute make rules. +ifneq ($(shell echo),) + CMD_EXE = 1 +endif + +ifdef CMD_EXE + NULLDEV = nul: + DEL = -del /f + RMDIR = rmdir /s /q +else + NULLDEV = /dev/null + DEL = $(RM) + RMDIR = $(RM) -r +endif + +ifdef CC65_HOME + AS = $(CC65_HOME)/bin/ca65 + CC = $(CC65_HOME)/bin/cc65 + CL = $(CC65_HOME)/bin/cl65 + LD = $(CC65_HOME)/bin/ld65 + SP = $(CC65_HOME)/bin/sp65 +else + AS := $(if $(wildcard ../../bin/ca65*),../../bin/ca65,ca65) + CC := $(if $(wildcard ../../bin/cc65*),../../bin/cc65,cc65) + CL := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65) + LD := $(if $(wildcard ../../bin/ld65*),../../bin/ld65,ld65) + SP := $(if $(wildcard ../../bin/sp65*),../../bin/sp65,sp65) +endif + +ifneq ($(filter disk samples.%,$(MAKECMDGOALS)),) + ifdef CC65_HOME + TARGET_PATH = $(CC65_HOME)/target + else + TARGET_PATH := $(if $(wildcard ../target),../target,$(shell $(CL) --print-target-path)) + endif + + # If TARGET_PATH contains spaces then it is presumed to contain escaped spaces. GNU make + # has very limited support for paths containing spaces. $(wildcard) is the only function + # that is aware of escaped spaces. However, $(wildcard) never returns paths with escaped + # spaces !!! So if it e.g. finds 4 files in a path with 2 spaces then one ends up with a + # return value consisting of 12 plain words :-(( + # + # Fortunately we can work around that behaviour here because we know that the files we + # are looking for have known extensions. So we can $(filter) the in our example above 12 + # words for file extensions so we come up with 4 path fragments. Then we remove those + # path fragments with $(notdir) from the file names. + # + # So far so good. But here we want to process files from different paths in a single + # recipe further down below and therefore want to prepend the paths to the files with + # $(addprefix). However, $(foreach) isn't aware of escaped spaces (only $(wildcard) is). + # Therefore, we need to replace the spaces with some other character temporarily in order + # to have $(foreach) generate one invocation per file. We use the character '?' for that + # purpose here, just because it is known to not be part of file names. + # + # Inside the recipe generated per file we then replace the '?' again with a space. As we + # want to be compatible with cmd.exe for execution we're not using an escaped space but + # rather double-quote the whole path. + # + # Note: The "strange" $(wildcard) further down below just serves the purpose to unescape + # spaces for cmd.exe. This could have as well been done with another $(subst). + + SUBST_TARGET_PATH := $(subst \$(SPACE),?,$(TARGET_PATH)) + + EMD := $(wildcard $(TARGET_PATH)/$(SYS)/drv/emd/*) + MOU := $(wildcard $(TARGET_PATH)/$(SYS)/drv/mou/*) + TGI := $(wildcard $(TARGET_PATH)/$(SYS)/drv/tgi/*) + + EMD := $(addprefix $(SUBST_TARGET_PATH)/$(SYS)/drv/emd/,$(notdir $(filter %.emd,$(EMD)))) + MOU := $(addprefix $(SUBST_TARGET_PATH)/$(SYS)/drv/mou/,$(notdir $(filter %.mou,$(MOU)))) + TGI := $(addprefix $(SUBST_TARGET_PATH)/$(SYS)/drv/tgi/,$(notdir $(filter %.tgi,$(TGI)))) + + # This one comes with the VICE emulator. + # See http://vice-emu.sourceforge.net/ + C1541 ?= c1541 +endif + +DISK_c64 = samples.d64 + +EXELIST_c64 = \ + fire \ + plasma \ + nachtm + +EXELIST_c128 = \ + fire \ + plasma \ + nachtm + +EXELIST_cbm510 = \ + fire \ + plasma \ + nachtm + +EXELIST_cbm610 = \ + nachtm + +EXELIST_plus4 = \ + plasma + +EXELIST_c16 = \ + notavailable + +EXELIST_pet = \ + notavailable + +EXELIST_vic20 = \ + notavailable + +ifneq ($(EXELIST_$(SYS)),) +samples: $(EXELIST_$(SYS)) +else +samples: notavailable +endif + +disk: $(DISK_$(SYS)) + +# empty target used to skip systems that will not work with any program in this dir +notavailable: +ifeq ($(MAKELEVEL),0) + @echo "info: cbm samples not available for" $(SYS) +else +# suppress the "nothing to be done for 'samples' message + @echo > $(NULLDEV) +endif + +fire: fire.c + $(CL) -t $(SYS) -O -o fire -m fire.map fire.c +plasma: plasma.c + $(CL) -t $(SYS) -O -o plasma -m plasma.map plasma.c +nachtm: nachtm.c + $(CL) -t $(SYS) -O -o nachtm -m nachtm.map nachtm.c + +# -------------------------------------------------------------------------- +# Rule to make a CBM disk with all samples. Needs the c1541 program that comes +# with the VICE emulator. + +define D64_WRITE_PRG_recipe + +$(C1541) -attach $@ -write "$(subst ?,$(SPACE),$(file))" $(notdir $(file)),p >$(NULLDEV) + +endef # D64_WRITE_PRG_recipe + +define D64_WRITE_SEQ_recipe + +$(C1541) -attach $@ -write "$(subst ?,$(SPACE),$(file))" $(notdir $(file)),s >$(NULLDEV) + +endef # D64_WRITE_SEQ_recipe + +samples.d64: samples + @$(C1541) -format "samples,00" d64 $@ >$(NULLDEV) + $(foreach file,$(EXELIST_$(SYS)),$(D64_WRITE_PRG_recipe)) +# $(foreach file,$(OVERLAYLIST),$(D64_WRITE_PRG_recipe)) +# $(foreach file,$(EMD) $(MOU) $(TGI),$(D64_WRITE_SEQ_recipe)) + +clean: + @$(DEL) $(EXELIST_$(SYS)) 2>$(NULLDEV) + @$(DEL) *.map 2>$(NULLDEV) + @$(DEL) $(DISK_$(SYS)) 2>$(NULLDEV) diff --git a/samples/fire.c b/samples/cbm/fire.c similarity index 100% rename from samples/fire.c rename to samples/cbm/fire.c diff --git a/samples/nachtm.c b/samples/cbm/nachtm.c similarity index 100% rename from samples/nachtm.c rename to samples/cbm/nachtm.c diff --git a/samples/plasma.c b/samples/cbm/plasma.c similarity index 100% rename from samples/plasma.c rename to samples/cbm/plasma.c diff --git a/samples/readme.txt b/samples/readme.txt index 3c9247c39..56b275764 100644 --- a/samples/readme.txt +++ b/samples/readme.txt @@ -10,11 +10,13 @@ Please note: similar systems. If you're using Windows, then consider installing Cygwin or MSys2. - * The makefile specifies the C64 as the default target system because all - but three of the programs run on that platform. When compiling for another - system, you will have to change the line that specifies the target system - at the top of the makefile, specify the system with SYS=<target> on the - make command line, or set a SYS environment variable. + * The makefile specifies the C64 as the default target system because most + of the programs run on that platform. When compiling for another system, + you will have to change the line that specifies the target system at the + top of the makefile, specify the system with SYS=<target> on the make + command line, or set a SYS environment variable. For example: + + make SYS=apple2 * Use "make disk" to build a disk image with all sample programs. @@ -31,11 +33,6 @@ Description: Shows the ASCII (or ATASCII, PETSCII) codes of typed <greg.king5@verizon.com>. Platforms: All platforms with conio or stdio (compile time configurable). ------------------------------------------------------------------------------ -Name: atari2600hello -Description: A "Hello world" type program. -Platforms: Runs on only the Atari 2600 Video Console System. - ----------------------------------------------------------------------------- Name: diodemo Description: A disc copy program written and contributed by Oliver @@ -52,12 +49,6 @@ Platforms: All systems with device enumeration and directory access (currently the Commodore machines, the Commander X16, and the Apple ][). ------------------------------------------------------------------------------ -Name: fire -Description: Another graphics demo written by groepaz/hitmen. -Platforms: The program currently is running on only the C64, but should - be portable to the C128 and CBM510 (and maybe more machines). - ----------------------------------------------------------------------------- Name: gunzip65 Description: A gunzip utility for 6502-based machines, written by Piotr @@ -76,8 +67,8 @@ Platforms: Runs on all platforms that support conio, which means: ----------------------------------------------------------------------------- Name: mandelbrot Description: A mandelbrot demo using integer arithmetic. The demo was - written by groepaz/hitmen, and converted to cc65 using TGI - graphics by Stephan Haubenthal. + written by groepaz, and converted to cc65 using TGI graphics + by Stephan Haubenthal. Platforms: Runs on all platforms that have TGI support: Apple ][, Atari, C64, C128, Oric Atmos and Telestrat, GEOS, NES, and Lynx. @@ -97,13 +88,6 @@ Platforms: All systems with an overlay linker config., disk directory access, and EMD support (currently the C64, the C128, the Atari, and the Apple ][). ------------------------------------------------------------------------------ -Name: nachtm -Description: Plays "Eine kleine Nachtmusik" by Wolfgang Amadeus Mozart. -Platforms: All systems that have the Commodore SID (Sound Interface - Device): - C64, C128, CBM510, CBM610. - ----------------------------------------------------------------------------- Name: overlaydemo Description: Shows how to load overlay files from disk. Written and @@ -111,13 +95,6 @@ Description: Shows how to load overlay files from disk. Written and Platforms: All systems with an overlay linker config. (currently the C64, the C128, the Atari, and the Apple ][). ------------------------------------------------------------------------------ -Name: plasma -Description: A fancy graphics demo written by groepaz/hitmen. -Platforms: The program needs a VIC-II or a TED, so it runs on the following - systems: - C64, C128, CBM510, Plus/4. - ----------------------------------------------------------------------------- Name: sieve Description: Implements the "Sieve of Eratosthenes" as a way to find all @@ -128,11 +105,6 @@ Platforms: All systems with conio and clock support: Commander X16, Apple ][ (without timing due to missing clock support). ------------------------------------------------------------------------------ -Name: supervisionhello -Description: A "Hello world" type program. -Platforms: Runs on only the Watara Supervision game console. - ----------------------------------------------------------------------------- Name: tgidemo Description: Shows some of the graphics capabilities of the "Tiny Graphics @@ -140,3 +112,46 @@ Description: Shows some of the graphics capabilities of the "Tiny Graphics Platforms: Runs on all platforms that have TGI support: Apple ][, Atari, C64, C128, Oric Atmos and Telestrat, GEOS, NES, and Lynx. + +============================================================================= + +Platform specific samples follow: + +atari 2600: +----------- + +Name: hello +Description: A "Hello world" type program. +Platforms: Runs on only the Atari 2600 Video Console System. +----------------------------------------------------------------------------- + +cbm: +---- + +Name: fire +Description: Another graphics demo written by groepaz. +Platforms: C64, C128, CBM510 + +----------------------------------------------------------------------------- +Name: nachtm +Description: Plays "Eine kleine Nachtmusik" by Wolfgang Amadeus Mozart. +Platforms: All systems that have the Commodore SID (Sound Interface + Device): + C64, C128, CBM510, CBM610. + +----------------------------------------------------------------------------- +Name: plasma +Description: A fancy graphics demo written by groepaz. +Platforms: The program needs a VIC-II or a TED, so it runs on the following + systems: + C64, C128, CBM510, Plus/4. +----------------------------------------------------------------------------- + + +supervision: +------------ + +Name: hello +Description: A "Hello world" type program. +Platforms: Runs on only the Watara Supervision game console. +---------------------------------------------------------------------------- diff --git a/samples/supervision/Makefile b/samples/supervision/Makefile new file mode 100644 index 000000000..5829b3f01 --- /dev/null +++ b/samples/supervision/Makefile @@ -0,0 +1,59 @@ + +# Run 'make SYS=<target>'; or, set a SYS env. +# var. to build for another target system. +SYS ?= supervision + +# Just the usual way to find out if we're +# using cmd.exe to execute make rules. +ifneq ($(shell echo),) + CMD_EXE = 1 +endif + +ifdef CMD_EXE + NULLDEV = nul: + DEL = -del /f + RMDIR = rmdir /s /q +else + NULLDEV = /dev/null + DEL = $(RM) + RMDIR = $(RM) -r +endif + +ifdef CC65_HOME + AS = $(CC65_HOME)/bin/ca65 + CC = $(CC65_HOME)/bin/cc65 + CL = $(CC65_HOME)/bin/cl65 + LD = $(CC65_HOME)/bin/ld65 + SP = $(CC65_HOME)/bin/sp65 +else + AS := $(if $(wildcard ../../bin/ca65*),../../bin/ca65,ca65) + CC := $(if $(wildcard ../../bin/cc65*),../../bin/cc65,cc65) + CL := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65) + LD := $(if $(wildcard ../../bin/ld65*),../../bin/ld65,ld65) + SP := $(if $(wildcard ../../bin/sp65*),../../bin/sp65,sp65) +endif + +EXELIST_supervision = \ + hello + +ifneq ($(EXELIST_$(SYS)),) +samples: $(EXELIST_$(SYS)) +else +samples: notavailable +endif + +# empty target used to skip systems that will not work with any program in this dir +notavailable: +ifeq ($(MAKELEVEL),0) + @echo "info: supervision samples not available for" $(SYS) +else +# suppress the "nothing to be done for 'samples' message + @echo > $(NULLDEV) +endif + +hello: hello.c + $(CL) -t $(SYS) -O -o hello -m hello.map hello.c + +clean: + @$(DEL) $(EXELIST_supervision) 2>$(NULLDEV) + @$(DEL) *.map 2>$(NULLDEV) diff --git a/samples/supervisionhello.c b/samples/supervision/hello.c similarity index 100% rename from samples/supervisionhello.c rename to samples/supervision/hello.c