1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-07 07:29:33 +00:00
This commit is contained in:
Wayne Parham 2022-02-07 17:12:43 -06:00
commit 10b8920ecc
92 changed files with 1499 additions and 235 deletions

View File

@ -0,0 +1,191 @@
name: Build Pull Request
on: [pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_linux:
name: Build and Test (Linux)
runs-on: ubuntu-latest
steps:
- name: Install Dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install linuxdoc-tools-info gcc-mingw-w64-x86-64
- shell: bash
run: git config --global core.autocrlf input
- name: Checkout Source
uses: actions/checkout@v2
- name: Build the tools.
shell: bash
run: |
make -j2 bin USER_CFLAGS=-Werror
make -j2 util
- name: Build the platform libraries.
shell: bash
run: make -j2 lib QUIET=1
- name: Run the regression tests.
shell: bash
run: make test QUIET=1
- name: Test that the samples can be built.
shell: bash
run: |
make SYS=apple2 -C samples
make SYS=apple2 -C samples clean
make SYS=apple2enh -C samples
make SYS=apple2enh -C samples clean
make SYS=atari -C samples
make SYS=atari -C samples clean
make SYS=atarixl -C samples
make SYS=atarixl -C samples clean
make SYS=atari2600 -C samples
make SYS=atari2600 -C samples clean
make SYS=atari5200 -C samples
make SYS=atari5200 -C samples clean
make SYS=atmos -C samples
make SYS=atmos -C samples clean
make SYS=bbc -C samples
make SYS=bbc -C samples clean
make SYS=c128 -C samples
make SYS=c128 -C samples clean
make SYS=c16 -C samples
make SYS=c16 -C samples clean
make SYS=c64 -C samples
make SYS=c64 -C samples clean
make SYS=cbm510 -C samples
make SYS=cbm510 -C samples clean
make SYS=cbm610 -C samples
make SYS=cbm610 -C samples clean
make SYS=creativision -C samples
make SYS=creativision -C samples clean
make SYS=cx16 -C samples
make SYS=cx16 -C samples clean
make SYS=gamate -C samples
make SYS=gamate -C samples clean
make SYS=geos-apple -C samples
make SYS=geos-apple -C samples clean
make SYS=geos-cbm -C samples
make SYS=geos-cbm -C samples clean
make SYS=lunix -C samples
make SYS=lunix -C samples clean
make SYS=lynx -C samples
make SYS=lynx -C samples clean
make SYS=nes -C samples
make SYS=nes -C samples clean
make SYS=osic1p -C samples
make SYS=osic1p -C samples clean
make SYS=pce -C samples
make SYS=pce -C samples clean
make SYS=pet -C samples
make SYS=pet -C samples clean
make SYS=plus4 -C samples
make SYS=plus4 -C samples clean
make SYS=sim6502 -C samples
make SYS=sim6502 -C samples clean
make SYS=sim65c02 -C samples
make SYS=sim65c02 -C samples clean
make SYS=supervision -C samples
make SYS=supervision -C samples clean
make SYS=sym1 -C samples
make SYS=sym1 -C samples clean
make SYS=telestrat -C samples
make SYS=telestrat -C samples clean
make SYS=vic20 -C samples
make SYS=vic20 -C samples clean
- name: Test that the targettest programs can be built.
shell: bash
run: |
make SYS=apple2 -C targettest
make SYS=apple2 -C targettest clean
make SYS=apple2enh -C targettest
make SYS=apple2enh -C targettest clean
make SYS=atari -C targettest
make SYS=atari -C targettest clean
make SYS=atarixl -C targettest
make SYS=atarixl -C targettest clean
make SYS=atari2600 -C targettest
make SYS=atari2600 -C targettest clean
make SYS=atari5200 -C targettest
make SYS=atari5200 -C targettest clean
make SYS=atmos -C targettest
make SYS=atmos -C targettest clean
make SYS=bbc -C targettest
make SYS=bbc -C targettest clean
make SYS=c128 -C targettest
make SYS=c128 -C targettest clean
make SYS=c16 -C targettest
make SYS=c16 -C targettest clean
make SYS=c64 -C targettest
make SYS=c64 -C targettest clean
make SYS=cbm510 -C targettest
make SYS=cbm510 -C targettest clean
make SYS=cbm610 -C targettest
make SYS=cbm610 -C targettest clean
make SYS=creativision -C targettest
make SYS=creativision -C targettest clean
make SYS=cx16 -C targettest
make SYS=cx16 -C targettest clean
make SYS=gamate -C targettest
make SYS=gamate -C targettest clean
make SYS=geos-apple -C targettest
make SYS=geos-apple -C targettest clean
make SYS=geos-cbm -C targettest
make SYS=geos-cbm -C targettest clean
make SYS=lunix -C targettest
make SYS=lunix -C targettest clean
make SYS=lynx -C targettest
make SYS=lynx -C targettest clean
make SYS=nes -C targettest
make SYS=nes -C targettest clean
make SYS=osic1p -C targettest
make SYS=osic1p -C targettest clean
make SYS=pce -C targettest
make SYS=pce -C targettest clean
make SYS=pet -C targettest
make SYS=pet -C targettest clean
make SYS=plus4 -C targettest
make SYS=plus4 -C targettest clean
make SYS=sim6502 -C targettest
make SYS=sim6502 -C targettest clean
make SYS=sim65c02 -C targettest
make SYS=sim65c02 -C targettest clean
make SYS=supervision -C targettest
make SYS=supervision -C targettest clean
make SYS=sym1 -C targettest
make SYS=sym1 -C targettest clean
make SYS=telestrat -C targettest
make SYS=telestrat -C targettest clean
make SYS=vic20 -C targettest
make SYS=vic20 -C targettest clean
- name: Build the document files.
shell: bash
run: make -j2 doc
- name: Build 64-bit Windows versions of the tools.
run: |
make -C src clean
make -j2 bin USER_CFLAGS=-Werror CROSS_COMPILE=x86_64-w64-mingw32-
build_windows:
name: Build (Windows)
runs-on: windows-latest
steps:
- shell: bash
run: git config --global core.autocrlf input
- name: Checkout Source
uses: actions/checkout@v2
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.1
- name: Build app (debug)
run: msbuild src\cc65.sln -t:rebuild -property:Configuration=Debug
- name: Build app (release)
run: msbuild src\cc65.sln -t:rebuild -property:Configuration=Release

View File

@ -0,0 +1,107 @@
name: Snapshot Build
on:
push:
branches:
master
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_windows:
name: Build (Windows)
runs-on: windows-latest
steps:
- shell: bash
run: git config --global core.autocrlf input
- name: Checkout Source
uses: actions/checkout@v2
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.1
- name: Build app (debug)
run: msbuild src\cc65.sln -t:rebuild -property:Configuration=Debug
- name: Build app (release)
run: msbuild src\cc65.sln -t:rebuild -property:Configuration=Release
build_linux:
name: Build, Test and Snaphot (Linux)
runs-on: ubuntu-latest
needs: build_windows
steps:
- name: Install Dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install linuxdoc-tools-info gcc-mingw-w64-x86-64 gcc-mingw-w64-i686
- shell: bash
run: git config --global core.autocrlf input
- name: Checkout Source
uses: actions/checkout@v2
- name: Build the tools.
shell: bash
run: |
make -j2 bin USER_CFLAGS=-Werror
make -j2 util
- name: Build the platform libraries.
shell: bash
run: make -j2 lib QUIET=1
- name: Run the regression tests.
shell: bash
run: make test QUIET=1
- name: Test that the samples can be built.
shell: bash
run: make -j2 samples
- name: Remove the output from the samples tests.
shell: bash
run: make -C samples clean
- name: Remove programs in util directory
shell: bash
run: make -C util clean
- name: Build the document files.
shell: bash
run: make -j2 doc
- name: Build and package 64-bit Windows versions of the tools.
run: |
make -C src clean
make -j2 bin USER_CFLAGS=-Werror CROSS_COMPILE=x86_64-w64-mingw32-
make zip
mv cc65.zip cc65-snapshot-win64.zip
- name: Build and package 32-bit Windows versions of the tools.
run: |
make -C src clean
make -j2 bin USER_CFLAGS=-Werror CROSS_COMPILE=i686-w64-mingw32-
make zip
mv cc65.zip cc65-snapshot-win32.zip
- name: Upload a 32-bit Snapshot Zip
uses: actions/upload-artifact@v2
with:
name: cc65-snapshot-win32.zip
path: cc65-snapshot-win32.zip
- name: Upload a 64-bit Snapshot Zip
uses: actions/upload-artifact@v2
with:
name: cc65-snapshot-win64.zip
path: cc65-snapshot-win64.zip
# enter secrets under "repository secrets"
- name: Upload snapshot to sourceforge
uses: nogsantos/scp-deploy@master
with:
src: cc65-snapshot-win32.zip
host: ${{ secrets.SSH_HOST }}
remote: ${{ secrets.SSH_DIR }}
port: ${{ secrets.SSH_PORT }}
user: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
# TODO: Update docs at https://github.com/cc65/doc
# TODO: Publish snapshot zip at https://github.com/cc65/cc65.github.io

View File

@ -1,4 +1,4 @@
.PHONY: all mostlyclean clean install zip avail unavail bin lib doc html info samples test
.PHONY: all mostlyclean clean install zip avail unavail bin lib doc html info samples test util
.SUFFIXES:
@ -6,6 +6,7 @@ all mostlyclean clean install zip:
@$(MAKE) -C src --no-print-directory $@
@$(MAKE) -C libsrc --no-print-directory $@
@$(MAKE) -C doc --no-print-directory $@
@$(MAKE) -C util --no-print-directory $@
@$(MAKE) -C samples --no-print-directory $@
avail unavail bin:
@ -23,6 +24,9 @@ samples:
test:
@$(MAKE) -C test --no-print-directory $@
util:
@$(MAKE) -C util --no-print-directory $@
%65:
@$(MAKE) -C src --no-print-directory $@

View File

@ -4,7 +4,7 @@
[Wiki](https://github.com/cc65/wiki/wiki)
[![Build Status](https://app.travis-ci.com/cc65/cc65.svg?branch=master)](https://app.travis-ci.com/cc65/cc65)
[![Snapshot Build](https://github.com/cc65/cc65/actions/workflows/snapshot-on-push-master.yml/badge.svg?branch=master)](https://github.com/cc65/cc65/actions/workflows/snapshot-on-push-master.yml)
cc65 is a complete cross development package for 65(C)02 systems, including
a powerful macro assembler, a C compiler, linker, librarian and several

View File

@ -50,7 +50,6 @@ PET_2000 = $CA
PET_3000 = $FC
PET_4000 = $FD
;----------------------------------------------------------------------------
; Vector and other locations
@ -59,7 +58,25 @@ BRKVec := $0092
NMIVec := $0094
; ---------------------------------------------------------------------------
; I/O: 6522 VIA2
; I/O: 6520 PIA1
PIA1 := $E810 ; PIA1 base address
PIA1_PORTA := PIA1+$0 ; Port A (PA) and data direction register A (DDRA)
PIA1_PACTL := PIA1+$1 ; Port A control register (CRA)
PIA1_PORTB := PIA1+$2 ; Port B (PB) and data direction register B (DDRB)
PIA1_PBCTL := PIA1+$3 ; Port B control register (CRB)
; ---------------------------------------------------------------------------
; I/O: 6520 PIA2
PIA2 := $E820 ; PIA2 base address
PIA2_PORTA := PIA2+$0 ; Port A (PA) and data direction register A (DDRA)
PIA2_PACTL := PIA2+$1 ; Port A control register (CRA)
PIA2_PORTB := PIA2+$2 ; Port B (PB) and data direction register B (DDRB)
PIA2_PBCTL := PIA2+$3 ; Port B control register (CRB)
; ---------------------------------------------------------------------------
; I/O: 6522 VIA
VIA := $E840 ; VIA base address
VIA_PB := VIA+$0 ; Port register B

View File

@ -33,7 +33,7 @@ more information.
The standard binary file format generated by the linker for the
Apple&nbsp;&rsqb;&lsqb; target is an <url name="AppleSingle"
url="http://kaiser-edv.de/documents/AppleSingle_AppleDouble.pdf"> file.
url="https://nulib.com/library/AppleSingle_AppleDouble.pdf"> file.
The default load address is &dollar;803.
<bf/AppleCommander 1.4.0/ or later (available at <url
@ -73,7 +73,7 @@ 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 <ref id="link-configs" name="linker configuration"> parameters. There are
several usefull settings:
several useful settings:
<descrip>
@ -281,7 +281,7 @@ AppleCommander option to put LOADER.SYSTEM on a ProDOS 8 disk image is <tt/-p/.
If the cc65 program can be successfully linked as system program using the linker
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 &dollar;800 to &dollar;2000 can be added to the heap by calling
the memory from &dollar;800 to &dollar;1FFF can be added to the heap by calling
<tt/_heapadd ((void *) 0x0800, 0x1800);/ at the beginning of <tt/main()/.

View File

@ -33,7 +33,7 @@ more information.
The standard binary file format generated by the linker for the
enhanced&nbsp;Apple&nbsp;//e target is an <url name="AppleSingle"
url="http://kaiser-edv.de/documents/AppleSingle_AppleDouble.pdf"> file.
url="https://nulib.com/library/AppleSingle_AppleDouble.pdf"> file.
The default load address is &dollar;803.
<bf/AppleCommander 1.4.0/ or later (available at <url
@ -73,7 +73,7 @@ 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 <ref id="link-configs" name="linker configuration"> parameters. There are
several usefull settings:
several useful settings:
<descrip>
@ -281,7 +281,7 @@ AppleCommander option to put LOADER.SYSTEM on a ProDOS 8 disk image is <tt/-p/.
If the cc65 program can be successfully linked as system program using the linker
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 &dollar;800 to &dollar;2000 can be added to the heap by calling
the memory from &dollar;800 to &dollar;1FFF can be added to the heap by calling
<tt/_heapadd ((void *) 0x0800, 0x1800);/ at the beginning of <tt/main()/.

View File

@ -117,7 +117,7 @@ Special locations:
The startup code rearranges the memory as follows:
<enum>
<item>Sceen memory and display list are moved below the program start address.
<item>Screen memory and display list are moved below the program start address.
<item>The ROM is disabled, making the memory in the areas &lsqb;&dollar;C000-&dollar;CFFF&rsqb;
and &lsqb;&dollar;D800-&dollar;FFF9&rsqb; available.
<item>Character generator data is copied from ROM to the CHARGEN location specified in the
@ -131,7 +131,7 @@ With the default load address of &dollar;2400 this gives a usable memory range o
&lsqb;&dollar;2400-&dollar;CFFF&rsqb;.
Please note that the first load chunk (which checks the system
compatibilty and available memory) will always be loaded at
compatibility and available memory) will always be loaded at
&dollar;2E00, regardless of the specified start address. This address
can only be changed by a custom linker config file.
@ -305,7 +305,7 @@ The names are the usual ones you can find in system reference manuals. Example:
...
</verb></tscreen>
Please note that memory location 762/$2FA is called "<tt/char_/" while the orignal name "<tt/char/" conflicts with the C keyword.
Please note that memory location 762/$2FA is called "<tt/char_/" while the original name "<tt/char/" conflicts with the C keyword.
If you like to use the OS names and locations for the original Atari 800 operating system, please "<tt/#define OSA/" before including the
<tt/atari.h/ header file.
@ -401,7 +401,7 @@ OS.sdlst = &amp;DisplayList;
...
</verb></tscreen>
Please inspect the <tt/_antic.h/ header file to detemine the supported
Please inspect the <tt/_antic.h/ header file to determine the supported
instruction names. Modifiers on instructions can be nested without need
for an order:
@ -410,7 +410,7 @@ for an order:
Please mind that ANTIC has memory alignment requirements for "player
missile graphics"-data, font data, display lists and screen memory. Creation
of a special linker configuration with appropriate aligned segments and
switching to that segment in the c-code is usually neccessary. A more memory
switching to that segment in the c-code is usually necessary. A more memory
hungry solution consists in using the "<tt/posix_memalign()/" function in
conjunction with copying your data to the allocated memory.
@ -726,6 +726,11 @@ for sectors 1 to 3, regardless of the type of diskette.
The console I/O is speed optimized therefore support for XEP80 hardware
or f80.com software is missing. Of course you may use stdio.h functions.
<tt/cprintf/ targets a 40 character line. On a 20-column display this has
the unexpected effect of a blank line after your text. On such displays you can either
use for example <tt/gotoxy(20,0)/ to target the "next" line, or you can switch to <tt/write()/
function which does not have this side effect.
<sect>Technical details<label id="techdetail"><p>
@ -1141,8 +1146,8 @@ ld65: Error: Missing memory area assignment for segment 'MAINHDR'
</verb></tscreen>
The old "HEADER" memory description contained six bytes: &dollar;FFFF
and the first and last memory addess of the program. For the "system
check" load chunk this had to be split into two memory assigments. The
and the first and last memory address of the program. For the "system
check" load chunk this had to be split into two memory assignments The
"HEADER" now only contains the &dollar;FFFF. The main program's first
and last memory address were moved to a new segment, called "MAINHDR",
which in the new linker config file goes into its own memory area (also

View File

@ -237,7 +237,7 @@ The runtime library provides a default game name which is "cc65
compiled". To change that, one has to link a file which puts data into
the "<tt/CARTNAME/" segment.
For reference, here's the default version used by the cc65 libary:
For reference, here's the default version used by the cc65 library:
<tscreen><verb>
.export __CART_NAME__: absolute = 1
.macpack atari

View File

@ -301,7 +301,7 @@ Here is a description of all the command line options:
compiler, see there for a list.
Depending on the target, the default CPU type is also set. This can be
overriden by using the <tt/<ref id="option--cpu" name="--cpu">/ option.
overridden by using the <tt/<ref id="option--cpu" name="--cpu">/ option.
<label id="option-v">
@ -3724,7 +3724,7 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".BYTE" name=".BYTE"
<tt/.PUSHCHARMAP/ allows together with <tt><ref id=".POPCHARMAP"
name=".POPCHARMAP"></tt> to switch to another character mapping and to restore the old
characther mapping later, without knowledge of the current mapping.
character mapping later, without knowledge of the current mapping.
The assembler will print an error message if the character mapping stack is already full,
when this command is issued.

View File

@ -395,7 +395,7 @@ Here is a description of all the command line options:
This option is used to set the target system. The target system determines
the character set that is used for strings and character constants and the
default CPU. The CPU setting can be overriden by use of the <tt/<ref
default CPU. The CPU setting can be overridden by use of the <tt/<ref
id="option--cpu" name="--cpu">/ option.
The following target systems are supported:
@ -1250,7 +1250,7 @@ parameter with the <tt/#pragma/.
This pragma is used to display informational messages at compile-time.
The message intented to be displayed must be a string literal.
The message intended to be displayed must be a string literal.
Example:
<tscreen><verb>
@ -1369,7 +1369,7 @@ parameter with the <tt/#pragma/.
Switch compiler warnings on or off. "name" is the name of a warning (see the
<tt/<ref name="-W" id="option-W">/ compiler option for a list). The name is
followed either by "pop", which restores the last pushed state, or by "on" or
"off", optionally preceeded by "push" to push the current state before
"off", optionally preceded by "push" to push the current state before
changing it.
Example:
@ -1673,7 +1673,7 @@ This is the original compiler copyright:
Anyone may copy or redistribute these programs, provided that:
1: You don't charge anything for the copy. It is permissable to
1: You don't charge anything for the copy. It is permissible to
charge a nominal fee for media, etc.
2: All source code and documentation for the programs is made

View File

@ -57,11 +57,11 @@ Short options:
-O Optimize code
-Oi Optimize code, inline more code
-Or Optimize code, honour the register keyword
-Os Optimize code, inline standard funtions
-Os Optimize code, inline standard functions
-S Compile but don't assemble and link
-T Include source as comment
-V Print the version number
-W name[,...] Supress compiler warnings
-W name[,...] Suppress compiler warnings
-Wa options Pass options to the assembler
-Wc options Pass options to the compiler
-Wl options Pass options to the linker

View File

@ -235,12 +235,12 @@ things to be different from runtime loading:
<item> Without changing the segment names, all segments take the default
names used by the standard linker configurations. This means that the
driver code is no longer contingous in memory, instead the code
driver code is no longer contiguous in memory, instead the code
segment is placed somewhere in between all other code segments, the
data segment is placed with all other data segments and so on. If the
driver doesn't do strange things this shouldn't be a problem.
<item> With statically linked code, data and bss segments will get intialized
<item> With statically linked code, data and bss segments will get initialized
once (when the application is loaded), while a loadable driver will
get its initialization each time the driver is loaded into memory
(which may be more than once in the lifetime of a program). It depends

View File

@ -59,7 +59,7 @@ slower than the same code for unsigned types.
<sect>Use chars instead of ints if possible<p>
While in arithmetic operations, chars are immidiately promoted to ints, they
While in arithmetic operations, chars are immediately promoted to ints, they
are passed as chars in parameter lists and are accessed as chars in variables.
The code generated is usually not much smaller, but it is faster, since
accessing chars is faster. For several operations, the generated code may be

View File

@ -156,7 +156,7 @@ Here is a description of all the command line options:
<tag><tt>-i name, --info name</tt></tag>
Specify an info file. The info file contains global options that may
override or replace command line options plus informations about the code
override or replace command line options plus information about the code
that has to be disassembled. See the separate section <ref id="infofile"
name="Info File Format">.

View File

@ -39,7 +39,7 @@ transfer the program to the real machine until it is done.
<item>An emulator allows many things that are almost impossible one of the
original machines. You may set watchpoints (detect read or write access to
arbitary addresses), debug interrupt handlers and even debug routines that run
arbitrary addresses), debug interrupt handlers and even debug routines that run
inside the 1541 floppy.
<item>You may use the label file generated by the linker to make much more use
@ -117,7 +117,7 @@ these warnings and errors as long as they reference any problems VICE thinks
it has with the labels.
After loading the labels, they are used by VICE in the disassembler listing,
and you may use them whereever you need to specify an address. Try
and you may use them wherever you need to specify an address. Try
<tscreen><verb>
d ._main
@ -138,7 +138,7 @@ load your label file like this:
</verb></tscreen>
After loading the labels, they are used by Oricutron in the disassembler listing,
and you may use them whereever you need to specify an address. Try
and you may use them wherever you need to specify an address. Try
<tscreen><verb>
d ._main

View File

@ -3513,7 +3513,7 @@ extended memory that should be supported. There is no autodetect capability.
<tag/Declaration/<tt/void* __fastcall__ em_map (unsigned page);/
<tag/Description/The function maps one page of extended memory into linear
memory and returns a pointer to the page frame. Depending on the hardware
and driver, the data is either mapped into the address space or transfered
and driver, the data is either mapped into the address space or transferred
into a buffer. If you don't need the actual contents of the page (for example
because you're going to overwrite it completely), it is better to call
<tt/<ref id="em_use" name="em_use">/ instead. <tt/em_use/ will not transfer the
@ -3728,7 +3728,7 @@ switching the CPU into double clock mode.
<tag/Function/Return the end-of-file indicator of a stream.
<tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
<tag/Declaration/<tt/int __fastcall__ feof (FILE* f);/
<tag/Description/<tt/feof/ tests the end-of-file indicator ofthe stream
<tag/Description/<tt/feof/ tests the end-of-file indicator of the stream
<tt/f/, and returns a non zero value if it is set.
<tag/Notes/<itemize>
<item>The indicator is set only after a read past the end of a file is
@ -4172,7 +4172,7 @@ const char* optstring);/
is a string that contains command line option characters. If a character in
<tt/optstring/ is followed by a colon, the option requires an argument. An
option on the command line is recognized if it is one of the option characters
preceeded by a '-'.
preceded by a '-'.
<tt/getopt/ must be called repeatedly. It will return each option character
found on the command line and <tt/EOF/ (-1) if there is no other option. An
option argument is placed in <tt/optarg/, the index of the next element on the
@ -5020,7 +5020,7 @@ always be the same.
<tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
<tag/Declaration/<tt/void __fastcall__ longjmp (jmp_buf buf, int retval);/
<tag/Description/The <tt/longjmp/ function restores a program context from the
data in <tt/buf/, which must have been set by a preceeding call to
data in <tt/buf/, which must have been set by a preceding call to
<tt/<ref id="setjmp" name="setjmp">/. Program execution continues as if the
call to <tt/<ref id="setjmp" name="setjmp">/ has just returned the value
<tt/retval/.
@ -5664,7 +5664,7 @@ cc65 allows to pass this argument, it is ignored.
<tag/Function/Open a directory.
<tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
<tag/Declaration/<tt/DIR* __fastcall__ opendir (const char* name);/
<tag/Description/<tt/opendir/ opens a directory and returns the direcory
<tag/Description/<tt/opendir/ opens a directory and returns the directory
descriptor associated with it. On error, NULL is returned and an error code is
stored in <tt/errno/.
<tag/Notes/<itemize>
@ -6863,7 +6863,7 @@ be used in presence of a prototype.
<quote>
<descrip>
<tag/Function/Concatentate two strings.
<tag/Function/Concatenate two strings.
<tag/Header/<tt/<ref id="string.h" name="string.h">/
<tag/Declaration/<tt/char* __fastcall__ strcat (char* s1, const char* s2);/
<tag/Description/The <tt/strcat/ function appends a copy of the string
@ -7189,7 +7189,7 @@ be used in presence of a prototype.
<quote>
<descrip>
<tag/Function/Concatentate two strings.
<tag/Function/Concatenate two strings.
<tag/Header/<tt/<ref id="string.h" name="string.h">/
<tag/Declaration/<tt/char* __fastcall__ strncat (char* s1, const char* s2, size_t n);/
<tag/Description/The <tt/strncat/ function appends not more than n characters
@ -7314,7 +7314,7 @@ be used in presence of a prototype.
<tag/Header/<tt/<ref id="string.h" name="string.h">/
<tag/Declaration/<tt/char* __fastcall__ strpbrk (const char* str, const char* set);/
<tag/Description/<tt/strpbrk()/ searches within <tt/str/ for the first
occurance of any character from <tt/set/. It returns a pointer to that
occurrence of any character from <tt/set/. It returns a pointer to that
character if found; otherwise, it returns <tt/NULL/.
<tag/Notes/<itemize>
<item>The function is available only as a fastcall function;
@ -7418,7 +7418,7 @@ be used in presence of a prototype.
<tag/Function/Find a substring.
<tag/Header/<tt/<ref id="string.h" name="string.h">/
<tag/Declaration/<tt/char* __fastcall__ strstr (const char* str, const char* substr);/
<tag/Description/<tt/strstr/ searches for the first occurance of the string
<tag/Description/<tt/strstr/ searches for the first occurrence of the string
<tt/substr/ within <tt/str/. If found, it returns a pointer to the copy,
otherwise it returns <tt/NULL/.
<tag/Notes/<itemize>
@ -7485,7 +7485,7 @@ the behaviour is undefined.
<item>If <tt/n/ is zero, <tt/s1/ may be a NULL pointer.
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
<item>Since cc65 doesn't support different charcter sets, <tt/strxfrm/ will
<item>Since cc65 doesn't support different character sets, <tt/strxfrm/ will
just copy s2 to s1 using <tt><ref id="strncpy" name="strncpy"></tt>.
</itemize>
<tag/Availability/ISO 9899

View File

@ -207,7 +207,7 @@ see them together in the filling box in GeoPaint.
<p>
<tt/void GraphicsString (const void *myGString)/
<p>
One of the more powerfull routines of GEOS. This function calls other graphic functions depending
One of the more powerful routines of GEOS. This function calls other graphic functions depending
on the given command string. See the structures chapter for a more detailed description.
<sect2>Rectangle functions
@ -652,7 +652,7 @@ For some purposes you might consider using the <tt/dio.h/ interface to disk acce
<p>
All GEOS disk functions return an error code in the X register. In some cases this is returned by the
GEOSLib function (if its type is <tt/char/), but in all cases the last error is saved in the <tt/__oserror/
location. If it is nonzero - an error occured. See <tt/gdisk.h/ for the list of possible errorcodes.
location. If it is nonzero - an error occurred. See <tt/gdisk.h/ for the list of possible errorcodes.
You need to include <tt/errno.h/ to get <tt/__oserror/, together with the standard <tt/errno/. The
latter gives less verbose, but still usable information and can be used with <tt/strerror/.
Probably you will get more information using <tt/_stroserror/ in a similar way.

View File

@ -7,7 +7,7 @@
<url url="mailto:greg.king5@verizon.net" name="Greg King">
<abstract>
This document describes a compiler that can create GEOS headers and menues for
This document describes a compiler that can create GEOS headers and menus for
cc65-compiled programs.
</abstract>
@ -24,7 +24,7 @@ Optional resources might be menu definitions, other headers (e.g., for data
files of an app.), dialog definitions, etc. Without an application's header,
GEOS is unable to load and start it.
Currently, <bf/grc65/ supports only menues and the required header definition,
Currently, <bf/grc65/ supports only menus and the required header definition,
along with support for building applications with VLIR-structured overlays.
<bf/grc65/ generates output in two formats: C header and <bf/ca65/ source (.s).
@ -345,7 +345,7 @@ for addresses.
<!-- <appendix> -->
<sect>Appendix A -- example.grc<label id="example-grc">
<p><tscreen><verb>
; Note that MENU can define both menues and submenues.
; Note that MENU can define both menus and submenus.
; If you want to use any C operators (such as "|", "&", etc.), do it WITHOUT
; any spaces between the arguments (the parser is simple and weak).

View File

@ -555,7 +555,7 @@ feature on.
</quote>
<quote>
In VICE, got to <bf/Settings/ -> <bf/Settings/, then <bf/Peripherial devices/ ->
In VICE, got to <bf/Settings/ -> <bf/Settings/, then <bf/Peripheral devices/ ->
<bf/Drive/. Then, you must enable the <bf/True drive emulation/ checkbox.
</quote>

View File

@ -886,7 +886,7 @@ also for a segment. The value must be an integer between 0 and 255. It is used
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.
space that precedes 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 an additional

View File

@ -85,7 +85,7 @@ Please note:
<item> The macro '<tt>SMC_StoreValue</tt>' takes care, that the store
operation will occur on the value-position of a SMC-instruction. As
you will see, other macros influence other instruction part positions.
There is no consistency check, if the targeted SMC instruction acually
There is no consistency check, if the targeted SMC instruction actually
contains a value. Storing a 'value' on an immplied SMC instruction
would corrupt the following memory cell!
</enum>
@ -257,7 +257,7 @@ SMC LoadDefault, { LDX #25 }
<label id="Load value">
<tag><tt>SMC_LoadValue label (, register)</tt></tag>
Retreives the value of a SMC line.
Retrieves the value of a SMC line.
Example:
<tscreen><verb>
@ -582,7 +582,7 @@ into a single instruction line. These can be changed of course too.
Line 10,11: These lines construct a branch operation for line 8: The
X-register will be used to change it from 'inc StoreAccuFirstSection+2'
(high-byte operation) to 'beq restoreCode'. Please note: To calculate the
relaive branch offset, we introduced a second label
relative branch offset, we introduced a second label
('RestoreCodeBranchBaseAdr') for to calculate it. Some could also use the
internal name of the SMC label, but you should abstain to do so - it may be
changed in the future...

View File

@ -79,7 +79,7 @@ in Telemon, there is no way to load a binary easily.
Stratsed (the Telestrat operating system) handles files management. Stratsed
is loaded to memory from floppy disk. Stratsed vector are declared in asminc/telestrat.inc.
But, reverse engineering is required to find how theses vectors works. Please, note that
But, reverse engineering is required to find how these vectors works. Please, note that
Stratsed is located in overlay memory (bank 0)
There is no tool to insert a binary in a Stratsed floppy disk.
@ -194,7 +194,7 @@ if you get input from keyboard by conio cgetc function, you will get direction f
Anyway, if you don't want to use ROM, you can use joysticks standard drivers in your code.
The standard driver manages two joysticks. Only one button is managed for theses joysticks.
The standard driver manages two joysticks. Only one button is managed for these joysticks.
Telestrat can handle one button for the left port, and three buttons for the right port (but this port was designed for a mouse).

View File

@ -78,6 +78,7 @@ int __fastcall__ stricmp (const char* s1, const char* s2); /* DOS/Windows */
int __fastcall__ strcasecmp (const char* s1, const char* s2); /* Same for Unix */
int __fastcall__ strnicmp (const char* s1, const char* s2, size_t count); /* DOS/Windows */
int __fastcall__ strncasecmp (const char* s1, const char* s2, size_t count); /* Same for Unix */
size_t __fastcall__ strnlen (const char* s, size_t maxlen); /* POSIX.1-2008 */
char* __fastcall__ strlwr (char* s);
char* __fastcall__ strlower (char* s);
char* __fastcall__ strupr (char* s);

View File

@ -102,6 +102,8 @@ extern struct _timezone {
# define CLOCKS_PER_SEC 135 /* FIXME */
#elif defined(__GEOS__)
# define CLOCKS_PER_SEC 1
#elif defined(__TELESTRAT__)
# define CLOCKS_PER_SEC 10
#elif defined(__ATARI__) || defined (__LYNX__)
/* Read the clock rate at runtime */
clock_t _clocks_per_sec (void);

View File

@ -1,5 +1,6 @@
;
; Ullrich von Bassewitz, 22.06.2002
; 2002-06-22, Ullrich von Bassewitz
; 2021-12-23, Greg King
;
; Original C code by Marc 'BlackJack' Rintsch, 18.03.2001
;
@ -19,26 +20,17 @@
;
.export _cbm_open
.import popa
.import _cbm_k_setlfs, _cbm_k_setnam, _cbm_k_open
.import __oserror
_cbm_open:
pha
txa
pha ; Save name
jsr _cbm_k_setnam
jsr popa ; Get sec_addr
jsr _cbm_k_setlfs ; Call SETLFS, pop all args
pla
tax
pla ; Get name
jsr _cbm_k_setnam
jsr _cbm_k_open
sta __oserror
rts

View File

@ -135,7 +135,7 @@ eof: lda #0
devnotpresent:
lda #ENODEV
jmp __directerrno ; Sets _errno, clears _oserror, returns -1
.byte $2C ; Skip next opcode via BIT <abs>
; Error entry: The given file descriptor is not valid or not open

View File

@ -106,7 +106,7 @@ devnotpresent2:
pla
devnotpresent:
lda #ENODEV
jmp __directerrno ; Sets _errno, clears _oserror, returns -1
.byte $2C ; Skip next opcode via BIT <abs>
; Error entry: The given file descriptor is not valid or not open

View File

@ -75,7 +75,7 @@ int __fastcall__ posix_memalign (void** memptr, size_t alignment, size_t size)
}
/* Test alignment: is it a power of two? There must be only one bit set. */
if (alignment == 0 || (alignment & --alignment) != 0) {
if (alignment == 0 || (alignment & (alignment - 1)) != 0) {
*memptr = NULL;
return EINVAL;
}
@ -86,7 +86,7 @@ int __fastcall__ posix_memalign (void** memptr, size_t alignment, size_t size)
** overhead added one time; and, the worst thing that might happen is that
** we cannot free the upper and lower blocks.
*/
b = malloc (size + alignment);
b = malloc (--alignment + size);
/* Handle out-of-memory */
if (b == NULL) {
@ -169,6 +169,3 @@ int __fastcall__ posix_memalign (void** memptr, size_t alignment, size_t size)
return EOK;
}

54
libsrc/common/strnlen.s Normal file
View File

@ -0,0 +1,54 @@
; size_t __fastcall__ strnlen (const char* s, size_t maxlen);
.export _strnlen
.import popax
.importzp ptr1, tmp1, tmp2, tmp3, tmp4
.proc _strnlen
; Get maximum length.
tay
iny
sty tmp3
inx
stx tmp4
; Fetch string pointer.
jsr popax
sta ptr1
stx ptr1+1
; Clear return value.
ldy #0
sty tmp1
sty tmp2
;;; Loop over string.
; Decrement maximum length.
next: dec tmp3
bne l2
dec tmp4
beq done
l2:
lda (ptr1),y
beq done
; Step to next character.
iny
bne l1
inc ptr1+1
l1:
; Increment return value.
inc tmp1
bne next
inc tmp2
bne next ; (jmp)
done: lda tmp1
ldx tmp2
rts
.endproc

View File

@ -6,8 +6,7 @@
.include "lynx.inc"
.import __STARTOFDIRECTORY__
.import __MAIN_START__
.import __CODE_SIZE__, __DATA_SIZE__, __RODATA_SIZE__
.import __STARTUP_SIZE__, __ONCE_SIZE__, __LOWCODE_SIZE__
.import __STARTUP_LOAD__, __BSS_LOAD__
.import __BANK0BLOCKSIZE__
.export __DEFDIR__: absolute = 1
@ -21,7 +20,7 @@ off0 = __STARTOFDIRECTORY__ + (__DIRECTORY_END__ - __DIRECTORY_START__)
blocka = off0 / __BANK0BLOCKSIZE__
; Entry 0 - first executable
block0 = off0 / __BANK0BLOCKSIZE__
len0 = __STARTUP_SIZE__ + __ONCE_SIZE__ + __CODE_SIZE__ + __DATA_SIZE__ + __RODATA_SIZE__ + __LOWCODE_SIZE__
len0 = __BSS_LOAD__ - __STARTUP_LOAD__
.byte <block0
.word off0 & (__BANK0BLOCKSIZE__ - 1)
.byte $88

View File

@ -12,7 +12,6 @@
.proc _beep: near
jsr BEEP ; Beep
rts
jmp BEEP ; Beep
.endproc

View File

@ -53,5 +53,5 @@ _exit: jsr donelib ; Run destructors
lda TECHO
ora #$80 ; Re-enable console echo
sta TECHO
jsr NACCES ; Lock System RAM
rts ; Re-enter Sym-1 monitor
jmp NACCES ; Lock System RAM
; Re-enter Sym-1 monitor

View File

@ -12,7 +12,6 @@
.proc _fdisp: near
jsr SCAND ; Flash Display
rts
jmp SCAND ; Flash Display
.endproc

View File

@ -0,0 +1,13 @@
;
; Name of the standard TGI driver
;
; 2022-02-02, Greg King
;
; const char tgi_stddrv[];
;
.export _tgi_stddrv
.rodata
_tgi_stddrv: .asciiz "telestrat-240-200-2.tgi"

View File

@ -154,7 +154,7 @@ endif
# Lists of subdirectories
# disasm depends on cpp
DIRLIST = tutorial geos atari2600 supervision cbm
DIRLIST = tutorial geos atari2600 atari5200 apple2 gamate supervision sym1 cbm
# --------------------------------------------------------------------------
# Lists of executables
@ -170,6 +170,7 @@ EXELIST_apple2 = \
multdemo \
ovrldemo \
sieve \
tinyshell \
tgidemo
EXELIST_apple2enh = $(EXELIST_apple2)
@ -183,12 +184,13 @@ EXELIST_atari = \
multdemo \
ovrldemo \
sieve \
tinyshell \
tgidemo
EXELIST_atarixl = $(EXELIST_atari)
EXELIST_atari2600 = \
atari2600hello
notavailable
EXELIST_atari5200 = \
notavailable
@ -212,6 +214,7 @@ EXELIST_c64 = \
multdemo \
ovrldemo \
sieve \
tinyshell \
tgidemo
EXELIST_c128 = \
@ -222,11 +225,13 @@ EXELIST_c128 = \
mandelbrot \
mousedemo \
sieve \
tinyshell \
tgidemo
EXELIST_c16 = \
ascii \
enumdevdir \
tinyshell \
hello
EXELIST_cbm510 = \
@ -234,12 +239,14 @@ EXELIST_cbm510 = \
gunzip65 \
hello \
mousedemo \
tinyshell \
sieve
EXELIST_cbm610 = \
ascii \
gunzip65 \
hello \
tinyshell \
sieve
EXELIST_creativision = \
@ -254,6 +261,7 @@ EXELIST_cx16 = \
mandelbrot \
mousedemo \
sieve \
tinyshell \
tgidemo
EXELIST_gamate = \
@ -285,6 +293,7 @@ EXELIST_pet = \
ascii \
enumdevdir \
hello \
tinyshell \
sieve
EXELIST_plus4 = \
@ -292,6 +301,7 @@ EXELIST_plus4 = \
enumdevdir \
gunzip65 \
hello \
tinyshell \
sieve
EXELIST_sim6502 = \
@ -308,7 +318,10 @@ EXELIST_sym1 = \
EXELIST_telestrat = \
ascii \
gunzip65 \
hello
hello \
mandelbrot \
sieve \
# tgidemo
EXELIST_vic20 = \
ascii \
@ -373,6 +386,23 @@ tgidemo: tgidemo.o
$(LD) -D __HIMEM__=0x6000 $(LDFLAGS) -o $@ -C vic20-tgi.cfg -m $@.map $^ $(SYS).lib
endif
# --------------------------------------------------------------------------
# some programs link against getsp.o
getsp.o: getsp.s
$(AS) $(ASFLAGS) -t $(SYS) $<
ifneq ($(SYS),vic20)
tinyshell: tinyshell.o getsp.o
$(LD) $(LDFLAGS) -t $(SYS) -o $@ $^ $(SYS).lib
endif
# some programs need more memory on the vic20
ifeq ($(SYS),vic20)
tinyshell: tinyshell.o getsp.o
$(LD) $(LDFLAGS) -o $@ -C vic20-32k.cfg -m $@.map $^ $(SYS).lib
endif
# --------------------------------------------------------------------------
# Rule to make a CBM disk with all samples. Needs the c1541 program that comes
# with the VICE emulator.
@ -453,7 +483,10 @@ install:
$(INSTALL) -d $(DESTDIR)$(samplesdir)/geos
$(INSTALL) -d $(DESTDIR)$(samplesdir)/tutorial
$(INSTALL) -d $(DESTDIR)$(samplesdir)/atari2600
$(INSTALL) -d $(DESTDIR)$(samplesdir)/atari5200
$(INSTALL) -d $(DESTDIR)$(samplesdir)/apple2
$(INSTALL) -d $(DESTDIR)$(samplesdir)/cbm
$(INSTALL) -d $(DESTDIR)$(samplesdir)/gamate
$(INSTALL) -d $(DESTDIR)$(samplesdir)/supervision
$(INSTALL) -m0644 *.* $(DESTDIR)$(samplesdir)
$(INSTALL) -m0644 readme.txt $(DESTDIR)$(samplesdir)
@ -461,7 +494,10 @@ install:
$(INSTALL) -m0644 geos/*.* $(DESTDIR)$(samplesdir)/geos
$(INSTALL) -m0644 tutorial/*.* $(DESTDIR)$(samplesdir)/tutorial
$(INSTALL) -m0644 atari2600/*.* $(DESTDIR)$(samplesdir)/atari2600
$(INSTALL) -m0644 atari5200/*.* $(DESTDIR)$(samplesdir)/atari5200
$(INSTALL) -m0644 apple2/*.* $(DESTDIR)$(samplesdir)/apple2
$(INSTALL) -m0644 cbm/*.* $(DESTDIR)$(samplesdir)/cbm
$(INSTALL) -m0644 gamate/*.* $(DESTDIR)$(samplesdir)/gamate
$(INSTALL) -m0644 supervision/*.* $(DESTDIR)$(samplesdir)/supervision
# --------------------------------------------------------------------------
@ -474,7 +510,9 @@ zip:
# Clean-up rules
mostlyclean:
@$(DEL) *.lbl *.map *.o *.s 2>$(NULLDEV)
@$(DEL) *.lbl *.map *.o 2>$(NULLDEV)
# we cant use .s since we have asm files in the directory that we want to keep
@$(DEL) ${patsubst %.c,%.s,$(wildcard *.c)} 2>$(NULLDEV)
clean: mostlyclean
@$(DEL) $(EXELIST_$(SYS)) $(DISK_$(SYS)) 2>$(NULLDEV)

View File

@ -1,3 +1,8 @@
# Run 'make SYS=<target>'; or, set a SYS env.
# var. to build for another target system.
SYS ?= apple2
# For this one see https://applecommander.github.io/
AC ?= ac.jar
@ -23,13 +28,31 @@ ifdef CC65_HOME
CL = $(CC65_HOME)/bin/cl65
LD = $(CC65_HOME)/bin/ld65
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)
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)
endif
all: hgrshow hgrtest dhgrshow
EXELIST_apple2 = \
hgrshow \
hgrtest \
dhgrshow
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: apple2 tests not available for" $(SYS)
else
# suppress the "nothing to be done for 'samples' message
@echo > $(NULLDEV)
endif
disk: hgr.dsk dhgr.dsk

View File

@ -40,6 +40,7 @@ void main (void)
}
closedir (dir);
POKE (0xC05F, 0);
tgi_uninstall ();
videomode (old);
}

View File

@ -0,0 +1,56 @@
# Run 'make SYS=<target>'; or, set a SYS env.
# var. to build for another target system.
SYS ?= atari5200
# 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
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)
endif
EXELIST_atari5200 = \
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 5200 tests not available for" $(SYS)
else
# suppress the "nothing to be done for 'samples' message
@echo > $(NULLDEV)
endif
hello: hello.c
$(CL) -t atari5200 -o hello hello.c
clean:
@$(DEL) hello 2>$(NULLDEV)

57
samples/gamate/Makefile Normal file
View File

@ -0,0 +1,57 @@
# Run 'make SYS=<target>'; or, set a SYS env.
# var. to build for another target system.
SYS ?= gamate
# 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
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)
endif
EXELIST_gamate = \
nachtm.bin
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: gamate tests not available for" $(SYS)
else
# suppress the "nothing to be done for 'samples' message
@echo > $(NULLDEV)
endif
nachtm.bin: nachtm.c
$(CL) -Os -l nachtm.lst -t gamate -o nachtm.bin nachtm.c
../../util/gamate/gamate-fixcart nachtm.bin
clean:
@$(DEL) nachtm.bin nachtm.lst 2>$(NULLDEV)

12
samples/getsp.s Normal file
View File

@ -0,0 +1,12 @@
.export _getsp
.importzp sp
.proc _getsp
ldx sp+1
lda sp
rts
.endproc

View File

@ -1,6 +1,14 @@
This directory contains sample programs for the cc65 compiler.
The programs contained here are
- used as samples and referenced from within the documentation (this is their
main purpose)
- installed into the filesystem
- compiled (but NOT run) by the CI test
-----------------------------------------------------------------------------
Below is a short description for each of the programs, together with a list
of the supported platforms.
@ -68,10 +76,10 @@ 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, and converted to cc65 using TGI graphics
by Stephan Haubenthal.
by Stefan Haubenthal.
Platforms: Runs on all platforms that have TGI support:
Apple ][, Atari, C64, C128, Oric Atmos and Telestrat, GEOS,
NES, and Lynx.
and NES.
-----------------------------------------------------------------------------
Name: mousedemo
@ -105,6 +113,11 @@ Platforms: All systems with conio and clock support:
Commander X16, Apple ][ (without timing due to missing clock
support).
-----------------------------------------------------------------------------
Name: tinyshell
Description: Simple ("tiny") shell to test filename and directory functions.
Platforms: Runs on all platforms that have stdio support
-----------------------------------------------------------------------------
Name: tgidemo
Description: Shows some of the graphics capabilities of the "Tiny Graphics
@ -125,6 +138,37 @@ Description: A "Hello world" type program.
Platforms: Runs on only the Atari 2600 Video Console System.
-----------------------------------------------------------------------------
atari 5200:
-----------
Name: hello
Description: A "Hello world" type program.
Platforms: Runs on only the Atari 5200 Video Console System.
-----------------------------------------------------------------------------
apple2:
-------
Name: hgrtest
Description: shows how to incorporate a hires screen right into the binary,
thus allowing to place content both below and above the hires
video ram without multiple files nor copying stuff around (plus
having a nice splash screen as bonus). It basically demos how to
make use of apple2-hgr.cfg.
Name: hgrshow
Description: is a (single) hires program showing how to load (single) hires
screens from files without support from TGI. TGI could be used
to "paint" on the loaded screens.
Name: dhgrshow
Description: is a double hires program showing how to load double hires
screens from files. TGI is used for most of the I/O address
manipulation, but (in contrast to hgrshow) is not actually
functional.
-----------------------------------------------------------------------------
cbm:
----
@ -147,6 +191,32 @@ Platforms: The program needs a VIC-II or a TED, so it runs on the following
C64, C128, CBM510, Plus/4.
-----------------------------------------------------------------------------
gamate:
-------
Name: nachtm
Description: Plays "Eine kleine Nachtmusik" by Wolfgang Amadeus Mozart.
-----------------------------------------------------------------------------
sym1:
-----
Name: symHello
Description: Hello World for Sym-1
Name: symTiny
Description: Hello World for Sym-1 (tiny version without printf)
Name: symDisplay
Description: Sym-1 front panel display example
Name: symIO
Description: Sym-1 digital I/O interface example
Name: symNotepad
Description: Sym-1 Notepad
-----------------------------------------------------------------------------
supervision:
------------

View File

@ -1,3 +1,8 @@
# Run 'make SYS=<target>'; or, set a SYS env.
# var. to build for another target system.
SYS ?= sym1
# Just the usual way to find out if we're
# using cmd.exe to execute make rules.
ifneq ($(shell echo),)
@ -20,13 +25,29 @@ ifdef CC65_HOME
CL = $(CC65_HOME)/bin/cl65
LD = $(CC65_HOME)/bin/ld65
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)
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)
endif
all: symHello.bin symTiny.bin symDisplay.bin symIO.bin symNotepad.bin
EXELIST_sym1 = \
symHello.bin symTiny.bin symDisplay.bin symIO.bin symNotepad.bin
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: sym1 tests not available for" $(SYS)
else
# suppress the "nothing to be done for 'samples' message
@echo > $(NULLDEV)
endif
symHello.bin: symHello.c
$(CL) -t sym1 -O -o symHello.bin symHello.c

View File

@ -60,13 +60,13 @@ extern unsigned int getsp(void); /* comes from getsp.s */
static unsigned char verbose;
static unsigned char terminate;
static unsigned char cmd;
static unsigned char *cmd_asc, *arg1, *arg2, *arg3, *args; /* 'args': everything after command */
static unsigned char keyb_buf[KEYB_BUFSZ + 1];
static unsigned char keyb_buf2[KEYB_BUFSZ + 1];
static char *cmd_asc, *arg1, *arg2, *arg3, *args; /* 'args': everything after command */
static char keyb_buf[KEYB_BUFSZ + 1];
static char keyb_buf2[KEYB_BUFSZ + 1];
static size_t cpbuf_sz = 4096;
struct cmd_table {
unsigned char *name;
char *name;
unsigned char code;
} cmd_table[] = {
{ "help", CMD_HELP },
@ -196,7 +196,7 @@ static void cmd_help(void)
static void cmd_ls(void)
{
DIR *dir;
unsigned char *arg;
char *arg;
struct dirent *dirent;
#ifdef __ATARI__
char need_free = 0;
@ -356,7 +356,7 @@ static void cmd_rename(void)
static void cmd_exec(void)
{
unsigned char *progname, *arguments;
char *progname, *arguments;
progname = strtok(args, " \t\n");
if (! progname) {
@ -373,7 +373,7 @@ static void cmd_exec(void)
static void cmd_copy(void)
{
int srcfd = -1, dstfd = -1;
unsigned char *buf;
char *buf;
int readsz, writesz;
if (!arg2 || arg3) {

View File

@ -34,6 +34,9 @@ endif
EXELIST_atari2600 = \
notavailable
EXELIST_atari5200 = \
notavailable
EXELIST_bbc = \
notavailable

View File

@ -286,7 +286,7 @@ static void ParseAutoDecl (Declaration* Decl)
** We abuse the Collection somewhat by using it to store line
** numbers.
*/
CollReplace (&CurrentFunc->LocalsBlockStack, (void *)(long)GetCurrentLine (),
CollReplace (&CurrentFunc->LocalsBlockStack, (void *)(size_t)GetCurrentLine (),
CollCount (&CurrentFunc->LocalsBlockStack) - 1);
} else {

View File

@ -955,10 +955,6 @@ int main (int argc, char* argv[])
OptTarget (Arg, GetArg (&I, 2));
break;
case 'u':
OptCreateDep (Arg, 0);
break;
case 'v':
OptVerbose (Arg, 0);
break;

View File

@ -115,7 +115,7 @@ struct CodeEntry;
typedef struct DefOrRef DefOrRef;
struct DefOrRef {
unsigned Line;
long LocalsBlockId;
size_t LocalsBlockId;
unsigned Flags;
int StackPtr;
unsigned Depth;

View File

@ -951,7 +951,7 @@ DefOrRef* AddDefOrRef (SymEntry* E, unsigned Flags)
DOR = xmalloc (sizeof (DefOrRef));
CollAppend (E->V.L.DefsOrRefs, DOR);
DOR->Line = GetCurrentLine ();
DOR->LocalsBlockId = (long)CollLast (&CurrentFunc->LocalsBlockStack);
DOR->LocalsBlockId = (size_t)CollLast (&CurrentFunc->LocalsBlockStack);
DOR->Flags = Flags;
DOR->StackPtr = StackPtr;
DOR->Depth = CollCount (&CurrentFunc->LocalsBlockStack);
@ -1013,9 +1013,9 @@ SymEntry* AddLabelSym (const char* Name, unsigned Flags)
/* Are we jumping into a block with initalization of an object that
** has automatic storage duration? Let's emit a warning.
*/
if ((long)CollLast (AIC) != DOR->LocalsBlockId &&
if ((size_t)CollLast (AIC) != DOR->LocalsBlockId &&
(CollCount (AIC) < DOR->Depth ||
(long)CollAt (AIC, DOR->Depth - 1) != DOR->LocalsBlockId)) {
(size_t)CollAt (AIC, DOR->Depth - 1) != DOR->LocalsBlockId)) {
Warning ("Goto at line %d to label %s jumps into a block with "
"initialization of an object that has automatic storage duration",
GetCurrentLine (), Name);
@ -1044,9 +1044,9 @@ SymEntry* AddLabelSym (const char* Name, unsigned Flags)
/* Are we jumping into a block with initalization of an object that
** has automatic storage duration? Let's emit a warning.
*/
if ((long)CollLast (AIC) != DOR->LocalsBlockId &&
if ((size_t)CollLast (AIC) != DOR->LocalsBlockId &&
(CollCount (AIC) >= DOR->Depth ||
(long)CollLast (AIC) >= (long)DOR->Line))
(size_t)CollLast (AIC) >= (size_t)DOR->Line))
Warning ("Goto at line %d to label %s jumps into a block with "
"initialization of an object that has automatic storage duration",
DOR->Line, Name);

View File

@ -183,7 +183,7 @@ typedef struct DbgInfo DbgInfo;
struct DbgInfo {
/* First we have all items in collections sorted by id. The ids are
** continous, so an access by id is almost as cheap as an array access.
** continuous, so an access by id is almost as cheap as an array access.
** The collections are also used when the objects are deleted, so they're
** actually the ones that "own" the items.
*/
@ -680,7 +680,7 @@ static char* SB_StrDup (const StrBuf* B)
static Collection* CollInit (Collection* C)
/* Initialize a collection and return it. */
{
/* Intialize the fields. */
/* Initialize the fields. */
C->Count = 0;
C->Size = 0;
C->Items = 0;
@ -1349,7 +1349,7 @@ static int CompareFileInfoByName (const void* L, const void* R)
static LibInfo* NewLibInfo (const StrBuf* Name)
/* Create a new LibInfo struct, intialize and return it */
/* Create a new LibInfo struct, initialize and return it */
{
/* Allocate memory */
LibInfo* L = xmalloc (sizeof (LibInfo) + SB_GetLen (Name));
@ -1463,7 +1463,7 @@ static int CompareLineInfoByLine (const void* L, const void* R)
static ModInfo* NewModInfo (const StrBuf* Name)
/* Create a new ModInfo struct, intialize and return it */
/* Create a new ModInfo struct, initialize and return it */
{
/* Allocate memory */
ModInfo* M = xmalloc (sizeof (ModInfo) + SB_GetLen (Name));
@ -1536,7 +1536,7 @@ static int CompareModInfoByName (const void* L, const void* R)
static ScopeInfo* NewScopeInfo (const StrBuf* Name)
/* Create a new ScopeInfo struct, intialize and return it */
/* Create a new ScopeInfo struct, initialize and return it */
{
/* Allocate memory */
ScopeInfo* S = xmalloc (sizeof (ScopeInfo) + SB_GetLen (Name));
@ -1697,7 +1697,7 @@ static int CompareSegInfoByName (const void* L, const void* R)
static SpanInfo* NewSpanInfo (void)
/* Create a new SpanInfo struct, intialize and return it */
/* Create a new SpanInfo struct, initialize and return it */
{
/* Allocate memory */
SpanInfo* S = xmalloc (sizeof (SpanInfo));
@ -1779,7 +1779,7 @@ static int CompareSpanInfoByAddr (const void* L, const void* R)
static SymInfo* NewSymInfo (const StrBuf* Name)
/* Create a new SymInfo struct, intialize and return it */
/* Create a new SymInfo struct, initialize and return it */
{
/* Allocate memory */
SymInfo* S = xmalloc (sizeof (SymInfo) + SB_GetLen (Name));
@ -2147,7 +2147,7 @@ static TypeInfo* ParseTypeString (InputData* D, StrBuf* Type)
I += GT_GET_SIZE (A[I]) + 1;
} else {
/* Unknown type in type string */
ParseError (D, CC65_ERROR, "Unkown type in type value");
ParseError (D, CC65_ERROR, "Unknown type in type value");
return 0;
}
break;
@ -2733,7 +2733,7 @@ static int StrConstFollows (InputData* D)
static int Consume (InputData* D, Token Tok, const char* Name)
/* Check for a token and consume it. Return true if the token was comsumed,
/* Check for a token and consume it. Return true if the token was consumed,
** return false otherwise.
*/
{
@ -6936,7 +6936,7 @@ const cc65_scopeinfo* cc65_scope_byspan (cc65_dbginfo Handle, unsigned SpanId)
const cc65_scopeinfo* cc65_childscopes_byid (cc65_dbginfo Handle, unsigned Id)
/* Return the direct child scopes of a scope with a given id. The function
** returns NULL if no scope with this id was found, otherwise a list of the
** direct childs.
** direct children.
*/
{
const DbgInfo* Info;

View File

@ -196,7 +196,7 @@ static void StrVal (void)
default:
CfgWarning (&CfgErrorPos,
"Unkown escape sequence '%%%c'", C);
"Unknown escape sequence '%%%c'", C);
SB_AppendChar (&CfgSVal, '%');
SB_AppendChar (&CfgSVal, C);
NextChar ();

View File

@ -105,7 +105,7 @@ static void SetAX (CPURegs* Regs, unsigned Val)
static unsigned char Pop (CPURegs* Regs)
{
return MemReadByte (0x0100 + ++Regs->SP);
return MemReadByte (0x0100 + (++Regs->SP & 0xFF));
}
@ -317,6 +317,8 @@ void ParaVirtInit (unsigned aArgStart, unsigned char aSPAddr)
void ParaVirtHooks (CPURegs* Regs)
/* Potentially execute paravirtualization hooks */
{
unsigned lo;
/* Check for paravirtualization address range */
if (Regs->PC < PARAVIRT_BASE ||
Regs->PC >= PARAVIRT_BASE + sizeof (Hooks) / sizeof (Hooks[0])) {
@ -327,5 +329,6 @@ void ParaVirtHooks (CPURegs* Regs)
Hooks[Regs->PC - PARAVIRT_BASE] (Regs);
/* Simulate RTS */
Regs->PC = Pop(Regs) + (Pop(Regs) << 8) + 1;
lo = Pop (Regs);
Regs->PC = lo + (Pop (Regs) << 8) + 1;
}

View File

@ -122,6 +122,48 @@ DISK_atarixl = testcode.atr
.PRECIOUS: %.o
LDFLAGS=
ifeq ($(SYS),c64)
LDFLAGS+=-Ln $@.lbl
endif
ifeq ($(SYS),c128)
LDFLAGS+=-Ln $@.lbl
endif
ifeq ($(SYS),c16)
LDFLAGS+=-Ln $@.lbl
endif
ifeq ($(SYS),cbm510)
LDFLAGS+=-Ln $@.lbl
endif
ifeq ($(SYS),cbm610)
LDFLAGS+=-Ln $@.lbl
endif
ifeq ($(SYS),cx16)
LDFLAGS+=-Ln $@.lbl
endif
ifeq ($(SYS),geos-cbm)
LDFLAGS+=-Ln $@.lbl
endif
ifeq ($(SYS),lunix)
LDFLAGS+=-Ln $@.lbl
endif
ifeq ($(SYS),pet)
LDFLAGS+=-Ln $@.lbl
endif
ifeq ($(SYS),pet-overlay)
LDFLAGS+=-Ln $@.lbl
endif
ifeq ($(SYS),plus4)
LDFLAGS+=-Ln $@.lbl
endif
ifeq ($(SYS),vic20)
LDFLAGS+=-Ln $@.lbl
endif
ifeq ($(SYS),pce)
LDFLAGS+=-D__CARTSIZE__=0x8000
endif
.o:
ifeq ($(SYS),vic20)
$(LD) $(LDFLAGS_$(@F)_$(SYS)) $(LDFLAGS) -o $@ -C vic20-32k.cfg -m $@.map $^ $(SYS).lib
@ -129,11 +171,17 @@ else
$(LD) $(LDFLAGS_$(@F)_$(SYS)) $(LDFLAGS) -o $@ -t $(SYS) -m $@.map $^ $(SYS).lib
endif
# --------------------------------------------------------------------------
# Lists of subdirectories
DIRLIST = accelerator atari cbm gamate pce
# --------------------------------------------------------------------------
# Lists of executables
# omitted: seek
EXELIST_c64 = \
minimal \
arg-test \
clock \
clock-test \
@ -160,13 +208,205 @@ EXELIST_c64 = \
scanf-test \
ser-test \
strdup-test \
strnlen \
stroserror-test \
strqtok-test \
uname-test
# omitted: seek
EXELIST_c128 = \
minimal \
arg-test \
clock \
clock-test \
conio \
cpeek-test \
cprintf \
cursor \
deb \
dir-test \
div-test \
em-test \
exec-test1 \
exec-test2 \
fileio-test \
ft \
getopt-test \
heaptest \
joy-test \
moddiv-test \
mouse-test \
mul-test \
posixio-test \
rename-test \
scanf-test \
ser-test \
strdup-test \
strnlen \
stroserror-test \
strqtok-test \
uname-test
# omitted: seek clock clock-test mouse-test ser-test
EXELIST_c16 = \
minimal \
arg-test \
conio \
cpeek-test \
cprintf \
cursor \
deb \
dir-test \
div-test \
em-test \
exec-test1 \
exec-test2 \
fileio-test \
ft \
getopt-test \
heaptest \
joy-test \
moddiv-test \
mul-test \
posixio-test \
rename-test \
scanf-test \
strdup-test \
strnlen \
stroserror-test \
strqtok-test \
uname-test
# omitted: seek ser-test
EXELIST_cbm510 = \
minimal \
arg-test \
clock \
clock-test \
conio \
cpeek-test \
cprintf \
cursor \
deb \
dir-test \
div-test \
em-test \
exec-test1 \
exec-test2 \
fileio-test \
ft \
getopt-test \
heaptest \
joy-test \
moddiv-test \
mouse-test \
mul-test \
posixio-test \
rename-test \
scanf-test \
strdup-test \
strnlen \
stroserror-test \
strqtok-test \
uname-test
# omitted: joy-test mouse-test seek
EXELIST_cbm610 = \
minimal \
arg-test \
clock \
clock-test \
conio \
cpeek-test \
cprintf \
cursor \
deb \
dir-test \
div-test \
em-test \
exec-test1 \
exec-test2 \
fileio-test \
ft \
getopt-test \
heaptest \
moddiv-test \
mul-test \
posixio-test \
rename-test \
scanf-test \
ser-test \
strdup-test \
strnlen \
stroserror-test \
strqtok-test \
uname-test
# omitted: clock-test em-test mouse-test seek ser-test
EXELIST_pet = \
minimal \
arg-test \
clock \
conio \
cpeek-test \
cprintf \
cursor \
deb \
dir-test \
div-test \
exec-test1 \
exec-test2 \
fileio-test \
ft \
getopt-test \
heaptest \
joy-test \
moddiv-test \
mul-test \
posixio-test \
rename-test \
scanf-test \
strdup-test \
strnlen \
stroserror-test \
strqtok-test \
uname-test
# omitted: clock-test em-test mouse-test seek
EXELIST_plus4 = \
minimal \
arg-test \
clock \
conio \
cpeek-test \
cprintf \
cursor \
deb \
dir-test \
div-test \
exec-test1 \
exec-test2 \
fileio-test \
ft \
getopt-test \
heaptest \
joy-test \
moddiv-test \
mul-test \
posixio-test \
rename-test \
scanf-test \
ser-test \
strdup-test \
strnlen \
stroserror-test \
strqtok-test \
tinyshell \
uname-test
# omitted: seek clock-test mouse-test ser-test
EXELIST_vic20 = \
minimal \
arg-test \
clock \
conio \
@ -190,13 +430,14 @@ EXELIST_vic20 = \
rename-test \
scanf-test \
strdup-test \
strnlen \
stroserror-test \
strqtok-test \
tinyshell \
uname-test
# omitted: cpeek-test, clock
EXELIST_apple2 = \
minimal \
arg-test \
clock-test \
conio \
@ -222,15 +463,16 @@ EXELIST_apple2 = \
seek \
ser-test \
strdup-test \
strnlen \
stroserror-test \
strqtok-test \
tinyshell \
uname-test
EXELIST_apple2enh = $(EXELIST_apple2)
# omitted: cpeek-test
EXELIST_atari = \
minimal \
arg-test \
clock-test \
clock \
@ -257,18 +499,196 @@ EXELIST_atari = \
seek \
ser-test \
strdup-test \
strnlen \
stroserror-test \
strqtok-test \
tinyshell \
uname-test
EXELIST_atarixl = $(EXELIST_atari)
# none of the testcode can work on the 2600
# EXELIST_atari2600 =
# omitted: clock-test cpeek-test deb dir-test em-test exec-test1 exec-test2
# joy-test mouse-test rename-test seek ser-test stroserror-test
EXELIST_telestrat = \
minimal \
arg-test \
clock \
conio \
cprintf \
cursor \
div-test \
fileio-test \
ft \
getopt-test \
heaptest \
moddiv-test \
mul-test \
posixio-test \
scanf-test \
strdup-test \
strnlen \
strqtok-test \
uname-test
# none of the testcode can work on supervision
# EXELIST_supervision =
# omitted: arg-test clock-test clock cpeek-test conio cprintf cursor deb dir-test
# em-test exec-test1 exec-test2 fileio-test ft getopt-test heaptest joy-test
# mouse-test mul-test posixio-test rename-test scanf-test seek ser-test strdup-test
# stroserror-test uname-test
EXELIST_sym1 = \
minimal \
div-test \
moddiv-test \
strnlen \
strqtok-test
# omitted: clock-test cpeek-test conio deb dir-test em-test exec-test1 exec-test2
# fileio-test ft mouse-test posixio-test rename-test seek ser-test
EXELIST_atmos = \
minimal \
arg-test \
clock \
cprintf \
cursor \
div-test \
getopt-test \
heaptest \
joy-test \
moddiv-test \
mul-test \
scanf-test \
strdup-test \
strnlen \
stroserror-test \
strqtok-test \
uname-test
# omitted: arg-test clock-test clock cpeek-test conio cprintf deb dir-test div-test
# em-test exec-test1 exec-test2 fileio-test ft getopt-test heaptest joy-test moddiv-test
# mouse-test mul-test posixio-test rename-test scanf-test seek ser-test strdup-test
# strnlen stroserror-test strqtok-test uname-test
EXELIST_creativision = \
minimal \
cursor
# omitted: cpeek-test seek ser-test
EXELIST_cx16 = \
minimal \
arg-test \
clock-test \
clock \
conio \
cprintf \
cursor \
deb \
dir-test \
div-test \
em-test \
exec-test1 \
exec-test2 \
fileio-test \
ft \
getopt-test \
heaptest \
joy-test \
moddiv-test \
mouse-test \
mul-test \
posixio-test \
rename-test \
scanf-test \
strdup-test \
strnlen \
stroserror-test \
strqtok-test \
uname-test
# omitted: arg-test clock-test clock cpeek-test cprintf cursor deb dir-test div-test
# em-test exec-test1 exec-test2 fileio-test ft getopt-test heaptest joy-test moddiv-test
# mouse-test mul-test posixio-test rename-test scanf-test seek ser-test strdup-test
# strnlen stroserror-test strqtok-test uname-test
EXELIST_nes = \
minimal \
conio
# omitted: arg-test clock-test clock cpeek-test cprintf cursor deb dir-test div-test
# em-test exec-test1 exec-test2 fileio-test ft getopt-test heaptest joy-test moddiv-test
# mouse-test mul-test posixio-test rename-test scanf-test seek ser-test strdup-test
# strnlen stroserror-test strqtok-test uname-test
EXELIST_pce = \
minimal \
conio
# omitted: arg-test clock-test clock cpeek-test conio cprintf deb dir-test div-test
# em-test exec-test1 exec-test2 fileio-test ft getopt-test heaptest joy-test moddiv-test
# mouse-test posixio-test rename-test scanf-test seek ser-test strdup-test strnlen
# stroserror-test strqtok-test uname-test
EXELIST_osic1p = \
minimal \
cursor \
mul-test
# omitted: arg-test clock-test clock cpeek-test conio cprintf deb dir-test div-test
# em-test exec-test1 exec-test2 fileio-test ft getopt-test heaptest joy-test moddiv-test
# mouse-test posixio-test rename-test scanf-test seek ser-test strdup-test strnlen
# stroserror-test strqtok-test uname-test
EXELIST_geos-apple = \
minimal \
cursor \
mul-test
# omitted: arg-test clock-test clock cpeek-test conio cprintf deb dir-test div-test
# em-test exec-test1 exec-test2 fileio-test ft getopt-test heaptest joy-test moddiv-test
# mouse-test posixio-test rename-test scanf-test seek ser-test strdup-test strnlen
# stroserror-test strqtok-test uname-test
EXELIST_geos-cbm = \
minimal \
cursor \
mul-test
# omitted: clock clock-test conio cpeek-test cprintf cursor deb dir-test em-test
# exec-test1 exec-test2 ft heaptest joy-test mouse-test mul-test rename-test seek
# ser-test strdup-test stroserror-test uname-test
EXELIST_sim6502 = \
minimal \
arg-test \
div-test \
fileio-test \
getopt-test \
moddiv-test \
posixio-test \
scanf-test \
strnlen \
strqtok-test
EXELIST_sim65c02 = $(EXELIST_sim6502)
# omitted: arg-test clock clock-test conio cpeek-test cprintf cursor deb dir-test
# div-test em-test exec-test1 exec-test2 fileio-test ft getopt-test heaptest
# joy-test moddiv-test mouse-test mul-test posixio-test rename-test scanf-test
# ser-test seek strdup-test strnlen stroserror-test strqtok-test tinyshell uname-test
EXELIST_atari2600 = \
minimal
EXELIST_atari5200 = \
minimal
EXELIST_gamate = \
minimal
EXELIST_lynx = \
minimal
EXELIST_supervision = \
minimal
# none of the testcode can work on the bbc (no library support)
EXELIST_bbc = \
notavailable
# none of the testcode can work on lunix (no library support)
EXELIST_lunix = \
notavailable
# Unlisted targets will try to build everything.
# That lets us learn what they cannot build, and what settings
@ -277,21 +697,27 @@ ifndef EXELIST_$(SYS)
EXELIST_$(SYS) := ${patsubst %.c,%,$(wildcard *.c)}
endif
define SUBDIR_recipe
@$(MAKE) -C $(dir) --no-print-directory $@
endef # SUBDIR_recipe
# --------------------------------------------------------------------------
# Rules to make the binaries and the disk
testcode: $(EXELIST_$(SYS))
$(foreach dir,$(DIRLIST),$(SUBDIR_recipe))
# empty target used to skip systems that will not work with any program in this dir
notavailable:
ifeq ($(MAKELEVEL),0)
@echo "info: generic targettest programs not available for" $(SYS)
endif
disk: $(DISK_$(SYS))
all: testcode
make -C accelerator
make -C apple2
make -C atari
make -C atari5200
make -C cbm SYS=$(SYS)
make -C gamate
make -C pce
all:
# --------------------------------------------------------------------------
# some programs link against getsp.o
@ -302,9 +728,6 @@ mouse-test: mouse-test.o getsp.o
ifneq ($(SYS),vic20)
ft: ft.o getsp.o
$(LD) $(LDFLAGS) -t $(SYS) -o $@ $^ $(SYS).lib
tinyshell: tinyshell.o getsp.o
$(LD) $(LDFLAGS) -t $(SYS) -o $@ $^ $(SYS).lib
endif
# some programs need more memory on the vic20
@ -312,9 +735,6 @@ endif
ifeq ($(SYS),vic20)
ft: ft.o getsp.o
$(LD) $(LDFLAGS) -o $@ -C vic20-32k.cfg -m $@.map $^ $(SYS).lib
tinyshell: tinyshell.o getsp.o
$(LD) $(LDFLAGS) -o $@ -C vic20-32k.cfg -m $@.map $^ $(SYS).lib
endif
# --------------------------------------------------------------------------
@ -392,10 +812,4 @@ mostlyclean:
clean: mostlyclean
@$(DEL) $(EXELIST_$(SYS)) $(DISK_$(SYS)) 2>$(NULLDEV)
make -C accelerator clean
make -C apple2 clean
make -C atari clean
make -C atari5200 clean
make -C cbm SYS=$(SYS) clean
make -C gamate clean
make -C pce clean
$(foreach dir,$(DIRLIST),$(SUBDIR_recipe))

View File

@ -20,15 +20,38 @@ ifdef CC65_HOME
CL = $(CC65_HOME)/bin/cl65
LD = $(CC65_HOME)/bin/ld65
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)
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)
endif
all: c64-scpu-test.prg c128-scpu-test.prg c64dtv-test.prg \
c64-c128-test.prg c128-test.prg chameleon-test.prg \
c65-test.prg turbomaster-test.prg
EXELIST_c64 = \
c64-scpu-test.prg \
c128-scpu-test.prg \
c64dtv-test.prg \
c64-c128-test.prg \
chameleon-test.prg \
c65-test.prg \
turbomaster-test.prg
EXELIST_c128 = \
c128-test.prg
ifneq ($(EXELIST_$(SYS)),)
testcode: $(EXELIST_$(SYS))
else
testcode: notavailable
endif
# empty target used to skip systems that will not work with any program in this dir
notavailable:
ifeq ($(MAKELEVEL),0)
@echo "info: accelerator tests not available for" $(SYS)
else
# suppress the "nothing to be done for 'testcode' message
@echo > $(NULLDEV)
endif
c64-scpu-test.prg: c64-c128-scpu-test.c
$(CL) -t c64 c64-c128-scpu-test.c -o c64-scpu-test.prg

View File

@ -1,4 +1,8 @@
# Run 'make SYS=<target>'; or, set a SYS env.
# var. to build for another target system.
SYS ?= atari
# Just the usual way to find out if we're
# using cmd.exe to execute make rules.
ifneq ($(shell echo),)
@ -21,14 +25,36 @@ ifdef CC65_HOME
CL = $(CC65_HOME)/bin/cl65
LD = $(CC65_HOME)/bin/ld65
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)
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)
endif
all: charmapping.xex defdev.xex displaylist.xex mem.xex multi.xex ostype.xex \
scrcode.com sys.xex
EXELIST_atari = \
charmapping.xex \
defdev.xex \
displaylist.xex \
mem.xex \
multi.xex \
ostype.xex \
scrcode.com \
sys.xex
ifneq ($(EXELIST_$(SYS)),)
testcode: $(EXELIST_$(SYS))
else
testcode: 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 tests not available for" $(SYS)
else
# suppress the "nothing to be done for 'testcode' message
@echo > $(NULLDEV)
endif
charmapping.xex: charmapping.c
$(CL) -t atari -o charmapping.xex charmapping.c

View File

@ -1,36 +0,0 @@
# 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
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)
endif
all: hello
hello: hello.c
$(CL) -t atari5200 -o hello hello.c
clean:
@$(DEL) hello 2>$(NULLDEV)

View File

@ -24,19 +24,47 @@ ifdef CC65_HOME
CL = $(CC65_HOME)/bin/cl65
LD = $(CC65_HOME)/bin/ld65
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)
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)
endif
all: petscii.prg cbmdir-test.prg
EXELIST_c64 = \
petscii.prg \
cbmdir-test.prg
EXELIST_vic20 = \
cbmdir-test.prg
ifneq ($(EXELIST_$(SYS)),)
testcode: $(EXELIST_$(SYS))
else
testcode: notavailable
endif
# empty target used to skip systems that will not work with any program in this dir
notavailable:
ifeq ($(MAKELEVEL),0)
@echo "info: cbm tests not available for" $(SYS)
else
# suppress the "nothing to be done for 'testcode' message
@echo > $(NULLDEV)
endif
ifeq ($(SYS),c64)
petscii.prg: petscii.c
$(CL) -t $(SYS) -O -o petscii.prg petscii.c
else
petscii.prg:
endif
cbmdir-test.prg: cbmdir-test.c
ifeq ($(SYS),vic20)
$(CL) -t $(SYS) -C vic20-32k.cfg -Oris -o $@ $<
else
$(CL) -t $(SYS) -Oris -o $@ $<
endif
clean:
@$(DEL) petscii.prg cbmdir-test.prg 2>$(NULLDEV)
@$(DEL) *.lbl petscii.prg cbmdir-test.prg 2>$(NULLDEV)

View File

@ -1,4 +1,8 @@
# Run 'make SYS=<target>'; or, set a SYS env.
# var. to build for another target system.
SYS ?= gamate
# Just the usual way to find out if we're
# using cmd.exe to execute make rules.
ifneq ($(shell echo),)
@ -21,13 +25,29 @@ ifdef CC65_HOME
CL = $(CC65_HOME)/bin/cl65
LD = $(CC65_HOME)/bin/ld65
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)
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)
endif
all: audiotest.bin lcdtest.bin ctest.bin
EXELIST_gamate = \
audiotest.bin lcdtest.bin ctest.bin
ifneq ($(EXELIST_$(SYS)),)
testcode: $(EXELIST_$(SYS))
else
testcode: notavailable
endif
# empty target used to skip systems that will not work with any program in this dir
notavailable:
ifeq ($(MAKELEVEL),0)
@echo "info: gamate tests not available for" $(SYS)
else
# suppress the "nothing to be done for 'testcode' message
@echo > $(NULLDEV)
endif
audiotest.bin: audiotest.s
$(CL) -l audiotest.lst -t gamate -o audiotest.bin audiotest.s
@ -35,9 +55,6 @@ lcdtest.bin: lcdtest.s
$(CL) -l lcdtest.lst -t gamate -o lcdtest.bin lcdtest.s
ctest.bin: ctest.c
$(CL) -l ctest.lst -t gamate -o ctest.bin ctest.c
nachtm.bin: nachtm.c
$(CL) -Os -l nachtm.lst -t gamate -o nachtm.bin nachtm.c
gamate-fixcart nachtm.bin
clean:
@$(DEL) lcdtest.o audiotest.o ctest.o 2>$(NULLDEV)

View File

@ -7,7 +7,7 @@ unsigned char y = 0;
unsigned char x = 0;
unsigned short n;
int main(int argc, char *argv[])
void main(void)
{
clrscr();
gotoxy(0,0);cputs("Gamate C-Test");
@ -47,6 +47,4 @@ int main(int argc, char *argv[])
(*((unsigned char*)LCD_YPOS)) = y;
}
return 0;
}

View File

@ -10,7 +10,7 @@ static unsigned char* V[256];
static char* Alloc (void)
static unsigned char* Alloc (void)
/* Allocate a random sized chunk of memory */
{
/* Determine the size */
@ -234,6 +234,3 @@ int main (void)
/* Done */
return EXIT_SUCCESS;
}

13
targettest/minimal.c Normal file
View File

@ -0,0 +1,13 @@
/* this is a minimal / empty c program, any supported target that has some
* sort of C support should be able to link this. Failure indicates a problem
* with the crt0 or the linker config of the respective target */
char bss_variable;
char data_variable = 42;
const char rodata_variable = 23;
void main(void)
{
/* nothing here */
}

View File

@ -1,4 +1,8 @@
# Run 'make SYS=<target>'; or, set a SYS env.
# var. to build for another target system.
SYS ?= pce
# Just the usual way to find out if we're
# using cmd.exe to execute make rules.
ifneq ($(shell echo),)
@ -21,10 +25,10 @@ ifdef CC65_HOME
CL = $(CC65_HOME)/bin/cl65
LD = $(CC65_HOME)/bin/ld65
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)
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)
endif
.PHONY: all clean test
@ -42,7 +46,23 @@ else
COUNT := 1
endif
all: conio.bin
EXELIST_pce = \
conio.bin
ifneq ($(EXELIST_$(SYS)),)
testcode: $(EXELIST_$(SYS))
else
testcode: notavailable
endif
# empty target used to skip systems that will not work with any program in this dir
notavailable:
ifeq ($(MAKELEVEL),0)
@echo "info: pce tests not available for" $(SYS)
else
# suppress the "nothing to be done for 'testcode' message
@echo > $(NULLDEV)
endif
%.bin: %.c
$(CL) -t pce $< -Wl -D__CARTSIZE__=${CARTSIZE} -m $*.map -o $@

9
targettest/readme.txt Normal file
View File

@ -0,0 +1,9 @@
This directory contains test programs for the cc65 compiler.
The programs contained here are
- NOT to be referenced in the documentation
- compiled (but NOT run) by the CI test (this is their main purpose)
- some programs can be used interactively to check certain library features
Sample programs ment for endusers should be placed in the samples directory.

View File

@ -5,7 +5,7 @@
#include <_heap.h>
static unsigned char* V[256];
static char* V[256];
static void ShowInfo (void)
/* Show heap info */

32
targettest/strnlen.c Normal file
View File

@ -0,0 +1,32 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
const char * str = "0123456789";
void
check (size_t result, size_t expected)
{
if (result != expected) {
printf ("Expected strnlen() to return %u, got %u.\n",
expected, result);
exit (EXIT_FAILURE);
}
}
int
main (void)
{
size_t maxlen = strlen (str);
size_t result;
size_t expected;
for (expected = 0; expected < maxlen; expected++)
check (strnlen (str, expected), expected);
check (strnlen (str, maxlen << 1), maxlen);
printf ("strnlen() OK.\n");
return EXIT_SUCCESS;
}

22
util/Makefile Normal file
View File

@ -0,0 +1,22 @@
.PHONY: atari gamate zlib
util: atari gamate zlib
all: util
atari:
@$(MAKE) -C atari --no-print-directory $@
gamate:
@$(MAKE) -C gamate --no-print-directory $@
zlib:
@$(MAKE) -C zlib --no-print-directory $@
mostlyclean clean:
@$(MAKE) -C atari --no-print-directory $@
@$(MAKE) -C gamate --no-print-directory $@
@$(MAKE) -C zlib --no-print-directory $@
install zip:

12
util/atari/Makefile Normal file
View File

@ -0,0 +1,12 @@
.PHONY: mostlyclean clean
atari: ataricvt
ataricvt: ataricvt.c
$(CC) $(CFLAGS) -o ataricvt ataricvt.c
mostlyclean clean:
$(RM) ataricvt
install zip:

12
util/gamate/Makefile Normal file
View File

@ -0,0 +1,12 @@
.PHONY: mostlyclean clean
gamate: gamate-fixcart
gamate-fixcart: gamate-fixcart.c
$(CC) $(CFLAGS) -o gamate-fixcart gamate-fixcart.c
mostlyclean clean:
$(RM) gamate-fixcart
install zip:

17
util/zlib/Makefile Normal file
View File

@ -0,0 +1,17 @@
.PHONY: mostlyclean clean
zlib: warning
#zlib: deflater
warning:
@echo "deflater needs zlib installed, use 'make deflater' to build"
deflater: deflater.c
$(CC) $(CFLAGS) -o deflater deflater.c -lz
mostlyclean clean:
$(RM) deflater
install zip: