diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 000000000..1a6397284
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,15 @@
+root = true
+
+[*]
+charset = utf-8
+indent_style = space
+indent_size = 4
+trim_trailing_whitespace = true
+insert_final_newline = true
+guidelines = 80, 120
+
+[*.{c,h}]
+cpp_new_line_before_open_brace_block=same_line
+cpp_new_line_before_open_brace_function=new_line
+cpp_space_before_function_open_parenthesis=insert
+cpp_new_line_before_else=false
diff --git a/.github/checks/lastline.sh b/.github/checks/lastline.sh
index d80d2fb57..d243a01e1 100755
--- a/.github/checks/lastline.sh
+++ b/.github/checks/lastline.sh
@@ -9,7 +9,7 @@ nl='
'
nl=$'\n'
r1="${nl}$"
-FILES=`find $CHECK_PATH -type f \( -name \*.inc -o -name Makefile -o -name \*.cfg -o -name \*.\[chs\] -o -name \*.mac -o -name \*.asm -o -name \*.sgml \) -print | while read f; do
+FILES=`find $CHECK_PATH -type f -size +0 \( -name \*.inc -o -name Makefile -o -name \*.cfg -o -name \*.\[chs\] -o -name \*.mac -o -name \*.asm -o -name \*.sgml \) -print | while read f; do
t=$(tail -c2 $f; printf x)
[[ ${t%x} =~ $r1 ]] || echo "$f"
done`
diff --git a/.github/checks/spaces.sh b/.github/checks/spaces.sh
index 945e9acc3..e231f6c2d 100755
--- a/.github/checks/spaces.sh
+++ b/.github/checks/spaces.sh
@@ -5,7 +5,7 @@ CHECK_PATH=.
cd $SCRIPT_PATH/../../
-FILES=`find $CHECK_PATH -type f \( -name \*.inc -o -name Makefile -o -name \*.cfg -o -name \*.\[chs\] -o -name \*.mac -o -name \*.asm -o -name \*.sgml \) -print | grep -v "libwrk/" | grep -v "testwrk/" | xargs grep -l ' $'`
+FILES=`find $CHECK_PATH -type f \( -name \*.inc -o -name Makefile -o -name \*.cfg -o -name \*.\[chs\] -o -name \*.mac -o -name \*.asm -o -name \*.sgml \) -print | grep -v "test/" | grep -v "libwrk/" | grep -v "testwrk/" | xargs grep -l ' $'`
cd $OLDCWD
diff --git a/.github/checks/tabs.sh b/.github/checks/tabs.sh
index 1c32def17..80dac3f2d 100755
--- a/.github/checks/tabs.sh
+++ b/.github/checks/tabs.sh
@@ -5,7 +5,7 @@ CHECK_PATH=.
cd $SCRIPT_PATH/../../
-FILES=`find $CHECK_PATH -type f \( \( -name \*.inc -a \! -name Makefile.inc \) -o -name \*.cfg -o -name \*.\[chs\] -o -name \*.mac -o -name \*.asm -o -name \*.sgml \) -print | grep -v "libwrk/" | grep -v "testwrk/" | xargs grep -l $'\t'`
+FILES=`find $CHECK_PATH -type f \( \( -name \*.inc -a \! -name Makefile.inc \) -o -name \*.cfg -o -name \*.\[chs\] -o -name \*.mac -o -name \*.asm -o -name \*.sgml \) -print | grep -v "test/" | grep -v "libwrk/" | grep -v "testwrk/" | xargs grep -l $'\t'`
cd $OLDCWD
diff --git a/.github/workflows/build-on-pull-request.yml b/.github/workflows/build-on-pull-request.yml
index 55be5db1e..7b762844b 100644
--- a/.github/workflows/build-on-pull-request.yml
+++ b/.github/workflows/build-on-pull-request.yml
@@ -19,7 +19,7 @@ jobs:
- shell: bash
run: git config --global core.autocrlf input
- name: Checkout Source
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Do some simple style checks
shell: bash
@@ -35,7 +35,7 @@ jobs:
run: make -j2 lib QUIET=1
- name: Run the regression tests.
shell: bash
- run: make test QUIET=1
+ run: make -j2 test QUIET=1
- name: Test that the samples can be built.
run: make -C samples platforms
- name: Test that the targettest programs can be built.
@@ -44,7 +44,7 @@ jobs:
shell: bash
run: make -j2 doc
- name: Upload a documents snapshot.
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
with:
name: docs
path: ./html
@@ -54,7 +54,7 @@ jobs:
make -j2 bin USER_CFLAGS=-Werror CROSS_COMPILE=x86_64-w64-mingw32-
build_windows:
- name: Build (Windows)
+ name: Build and Test (Windows)
runs-on: windows-latest
steps:
@@ -62,13 +62,31 @@ jobs:
run: git config --global core.autocrlf input
- name: Checkout Source
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Add msbuild to PATH
- uses: microsoft/setup-msbuild@v1.1
+ uses: microsoft/setup-msbuild@v2
- - name: Build app (debug)
- run: msbuild src\cc65.sln -t:rebuild -property:Configuration=Debug
+ - name: Build app (x86 debug)
+ run: msbuild src\cc65.sln -t:rebuild -property:Configuration=Debug -property:Platform=Win32
- - name: Build app (release)
- run: msbuild src\cc65.sln -t:rebuild -property:Configuration=Release
+ - name: Build app (x86 release)
+ run: msbuild src\cc65.sln -t:rebuild -property:Configuration=Release -property:Platform=Win32
+
+ - name: Build app (x64 release)
+ run: msbuild src\cc65.sln -t:rebuild -property:Configuration=Debug -property:Platform=x64
+
+ - name: Build app (x64 release)
+ run: msbuild src\cc65.sln -t:rebuild -property:Configuration=Release -property:Platform=x64
+
+ - name: Build utils (MinGW)
+ shell: cmd
+ run: make -j2 util SHELL=cmd
+
+ - name: Build the platform libraries (make lib)
+ shell: cmd
+ run: make -j2 lib QUIET=1 SHELL=cmd
+
+ - name: Run the regression tests (make test)
+ shell: cmd
+ run: make -j2 test QUIET=1 SHELL=cmd
diff --git a/.github/workflows/snapshot-on-push-master.yml b/.github/workflows/snapshot-on-push-master.yml
index 2aedb0e25..42794f10b 100644
--- a/.github/workflows/snapshot-on-push-master.yml
+++ b/.github/workflows/snapshot-on-push-master.yml
@@ -18,10 +18,10 @@ jobs:
run: git config --global core.autocrlf input
- name: Checkout Source
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Add msbuild to PATH
- uses: microsoft/setup-msbuild@v1.1
+ uses: microsoft/setup-msbuild@v2
- name: Build app (debug)
run: msbuild src\cc65.sln -t:rebuild -property:Configuration=Debug
@@ -44,7 +44,7 @@ jobs:
- shell: bash
run: git config --global core.autocrlf input
- name: Checkout Source
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Do some simple style checks
shell: bash
@@ -59,7 +59,7 @@ jobs:
run: make -j2 lib QUIET=1
- name: Run the regression tests.
shell: bash
- run: make test QUIET=1
+ run: make -j2 test QUIET=1
- name: Test that the samples can be built.
shell: bash
run: make -j2 samples
@@ -86,18 +86,18 @@ jobs:
mv cc65.zip cc65-snapshot-win32.zip
- name: Upload a 32-bit Snapshot Zip
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
with:
name: cc65-snapshot-win32
path: cc65-snapshot-win32.zip
- name: Upload a 64-bit Snapshot Zip
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
with:
name: cc65-snapshot-win64
path: cc65-snapshot-win64.zip
- name: Get the online documents repo.
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
with:
repository: cc65/doc
# this token will expire, if it does, generate a new one as decribed in https://github.com/cc65/cc65/issues/2065
@@ -120,7 +120,7 @@ jobs:
- name: Package offline documents.
run: 7z a cc65-snapshot-docs.zip ./html/*.*
- name: Upload a Documents Snapshot Zip
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
with:
name: cc65-snapshot-docs
path: cc65-snapshot-docs.zip
@@ -135,6 +135,15 @@ jobs:
port: ${{ secrets.SSH_PORT }}
user: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
+ - name: Upload 64-bit Windows snapshot to sourceforge
+ uses: nogsantos/scp-deploy@master
+ with:
+ src: cc65-snapshot-win64.zip
+ host: ${{ secrets.SSH_HOST }}
+ remote: ${{ secrets.SSH_DIR }}
+ port: ${{ secrets.SSH_PORT }}
+ user: ${{ secrets.SSH_USER }}
+ key: ${{ secrets.SSH_KEY }}
- name: Upload documents snapshot to sourceforge
uses: nogsantos/scp-deploy@master
with:
diff --git a/.github/workflows/windows-test-scheduled.yml b/.github/workflows/windows-test-scheduled.yml
index 451b37f79..fa22473f4 100644
--- a/.github/workflows/windows-test-scheduled.yml
+++ b/.github/workflows/windows-test-scheduled.yml
@@ -30,7 +30,7 @@ jobs:
run: mkdir ~/.cache-sha
- name: Cache SHA
- uses: actions/cache@v3
+ uses: actions/cache@v4
id: check-sha
with:
path: ~/.cache-sha
@@ -43,11 +43,11 @@ jobs:
- name: Checkout source
if: steps.check-sha.outputs.cache-hit != 'true'
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Add msbuild to PATH
if: steps.check-sha.outputs.cache-hit != 'true'
- uses: microsoft/setup-msbuild@v1.1
+ uses: microsoft/setup-msbuild@v2
- name: Build app (MSVC debug)
if: steps.check-sha.outputs.cache-hit != 'true'
@@ -70,7 +70,7 @@ jobs:
- name: Run the regression tests (make test)
if: steps.check-sha.outputs.cache-hit != 'true'
shell: cmd
- run: make test QUIET=1 SHELL=cmd
+ run: make -j2 test QUIET=1 SHELL=cmd
- name: Test that the samples can be built (make samples)
if: steps.check-sha.outputs.cache-hit != 'true'
diff --git a/Contributing.md b/Contributing.md
index 3b355373c..10d687424 100644
--- a/Contributing.md
+++ b/Contributing.md
@@ -1,186 +1,321 @@
-This document contains all kinds of information that you should know if you want to contribute to the cc65 project. Before you start, please read all of it. If something is not clear to you, please ask - this document is an ongoing effort and may well be incomplete.
+Contributing to cc65
+====================
-(''Note:'' The word "must" indicates a requirement. The word "should" indicates a recomendation.)
+This document contains all kinds of information that you
+should know if you want to contribute to the cc65 project.
+Before you start, please read all of it. If something is not
+clear to you, please ask - this document is an ongoing effort
+and may well be incomplete.
-*this is work in progress and is constantly updated - if in doubt, please ask*
+Also, before you put a lot of work into implementing
+something you want to contribute, please get in touch with
+one of the developers and ask if what you are going to do is
+actually wanted and has a chance of being merged. Perhaps
+someone else is already working on it, or perhaps what you
+have in mind is not how we'd expect it to be - talking to us
+before you start might save you a lot of work in those cases.
-# generally
+(''Note:'' The word "must" indicates a requirement. The word
+ "should" indicates a recomendation.)
-* You must obey these rules when contributing new code or documentation to cc65. We are well aware that not all existing code may respect all rules outlined here - but this is no reason for you not to respect them.
-* One commit/patch/PR per issue. Do not mix several things unless they are very closely related.
-* Sometimes when you make a PR, it may break completely unrelated tests. However, any PR is expected to merge cleanly with no failures. That means in practise that you are expected to fix/update the failing tests if required - for example this might be needed if you make changes to the compiler that changes the format of error- or warning messages. In that case you might have to update some reference files in the testbench. Obviously still check if that is actually the right thing to do ;)
+*this is work in progress and is constantly updated - if in
+doubt, please ask*
+
+# Generally
+
+* You must obey these rules when contributing new code or
+ documentation to cc65. We are well aware that not all
+ existing code may respect all rules outlined here - but this
+ is no reason for you not to respect them.
+* One commit/patch/PR per issue. Do not mix several things
+ unless they are very closely related.
+* Sometimes when you make a PR, it may break completely
+ unrelated tests. However, any PR is expected to merge
+ cleanly with no failures. That means in practise that you
+ are expected to fix/update the failing tests if required -
+ for example this might be needed if you make changes to the
+ compiler that changes the format of error- or warning
+ messages. In that case you might have to update some
+ reference files in the testbench. Obviously still check if
+ that is actually the right thing to do. ;)
# Codestyle rules
-## All Sources
+## All sources
### Line endings
-All files must only contain Unix style 'LF' line endings. Please configure your editors accordingly.
+All files must only contain Unix style 'LF' line endings.
+Please configure your editors accordingly.
### TABs and spaces
-This is an ongoing controversial topic - everyone knows that. However, the following is how we do it :)
+This is an ongoing controversial topic - everyone knows
+that. However, the following is how we do it :)
* TAB characters must be expanded to spaces.
-* 4 spaces per indention level (rather than 8) are preferred, especially if there are many different levels.
+* 4 spaces per indention level (rather than 8) are
+ preferred, especially if there are many different levels.
* No extra spaces at the end of lines.
-* All text files must end with new-line characters. Don't leave the last line "dangling".
+* All text files must end with new-line characters. Don't
+ leave the last line "dangling".
-The (bash) scripts used to check the above rules can be found in ```.github/check```. You can also run all checks using ```make check```.
+The (bash) scripts used to check the above rules can be
+found in ```.github/check```. You can also run all checks
+using ```make check```.
-### Identifiers and Symbol names
+### Identifiers and symbol names
-The C Standard defines certain identifiers and symbol names, which we can not use
-in our code. Since it is not always obvious which parts of the library code will
-actually end up in a linked program, the following applies to ALL of the library.
+The C Standard defines certain identifiers and symbol names,
+which we can not use in our code. Since it is not always
+obvious which parts of the library code will actually end up
+in a linked program, the following applies to ALL of the
+library.
-Any non standard identifier/symbol/function that is exported from source files,
-or appears in header files:
+Any non standard identifier/symbol/function that is exported
+from source files, or appears in header files:
-* must not be in the "_symbol" form in C, or "__symbol" form in assembly.
-* must start with (at least) two (C Code) or three (assembly code) underscores, unless the symbol appears in a non standard header file.
+* must not be in the "_symbol" form in C, or "__symbol" form
+ in assembly,
+* must start with (at least) two (C Code) or three (assembly
+ code) underscores, unless the symbol appears in a non
+ standard header file.
-This is likely more than the standard dictates us to do - but it is certainly
-standard compliant - and easy to remember.
+This is likely more than the standard dictates us to do -
+but it is certainly standard compliant - and easy to
+remember.
-Also see the discussion in https://github.com/cc65/cc65/issues/1796
+Also see the discussion in
+https://github.com/cc65/cc65/issues/1796
-### misc
+### Miscellaneous
-* 80 characters is the desired maximum width of files. But, it isn't a "strong" rule; sometimes, you will want to type longer lines, in order to keep the parts of expressions or comments together on the same line.
+* 80 characters is the desired maximum width of files. But,
+ it isn't a "strong" rule; sometimes, you will want to type
+ longer lines, in order to keep the parts of expressions or
+ comments together on the same line.
* You should avoid typing non-ASCII characters.
-* If you change "normal" source code into comments, then you must add a comment about why that code is a comment.
-* When you want to create a comment from several lines of code, you should use preprocessor lines, instead of ```/* */``` or "```;```". Example:
-
+* If you change "normal" source code into comments, then you
+ must add a comment about why that code is a comment.
+* When you want to create a comment from several lines of
+ code, you should use preprocessor lines, instead of ```/*
+ */``` or "```;```". Example:
+
+~~~C
#if 0
- one ();
- two ();
- three = two () + one ();
+ one (); two ();
+ three = two () + one ();
#endif
-
+~~~
+
* You should type upper case characters for hex values.
-* When you type zero-page addresses in hexadecimal, you should type two hex characters (after the hex prefix). When you type non-zero-page addresses in hex, you should type four hex characters.
-* When you type lists of addresses, it is a good idea to sort them in ascending numerical order. That makes it easier for readers to build mental pictures of where things are in an address space. And, it is easier to see how big the variables and buffers are. Example:
-
+* When you type zero-page addresses in hexadecimal, you
+ should type two hex characters (after the hex prefix).
+ When you type non-zero-page addresses in hex, you should
+ type four hex characters.
+* When you type lists of addresses, it is a good idea to
+ sort them in ascending numerical order. That makes it
+ easier for readers to build mental pictures of where things
+ are in an address space. And, it is easier to see how big
+ the variables and buffers are. Example:
+
+~~~asm
xCoord := $0703
-yCoord := $0705 ; (this address implies that xCoord is 16 bits)
-cmdbuf := $0706 ; (this address implies that yCoord is 8 bits)
-cmdlen := $0786 ; (this address implies that cmdbuf is 128 bytes)
+yCoord := $0705 ; (this address implies that xCoord is 16 bits)
+cmdbuf := $0706 ; (this address implies that yCoord is 8 bits)
+cmdlen := $0786 ; (this address implies that cmdbuf is 128 bytes)
color := $0787
-
+~~~
-## C Sources
+## C sources
-The following is still very incomplete - if in doubt please look at existing sourcefiles and adapt to the existing style
+The following is still very incomplete - if in doubt please
+look at existing sourcefiles and adapt to the existing style.
-* Your files should generally obey the C89 standard, with a few C99 things (this is a bit similar to what cc65 itself supports). The exceptions are:
- * use stdint.h for variables that require a certain bit size
- * In printf-style functions use the PRIX64 (and similar) macros to deal with 64bit values (from inttypes.h)
-This list is not necessarily complete - if in doubt, please ask.
+Your files should generally obey the C89 standard, with a
+few C99 things (this is a bit similar to what cc65 itself
+supports). The exceptions are:
+
+* Use stdint.h for variables that require a certain bit size
+* In printf-style functions use the PRIX64 (and similar)
+ macros to deal with 64bit values (from inttypes.h) This
+ list is not necessarily complete - if in doubt, please ask.
* We generally have a "no warnings" policy
- * Warnings must not be hidden by using typecasts - fix the code instead
+* Warnings must not be hidden by using typecasts - fix the
+ code instead
* The normal indentation width should be four spaces.
-* You must use ANSI C comments (```/* */```); you must not use C++ comments (```//```).
-* When you add functions to an existing file, you should separate them by the same number of blank lines that separate the functions that already are in that file.
-* All function declarations must be followed by a comment block that tells at least briefly what the function does, what the parameters are, and what is returned. This comment must sit between the declaration and the function body, like this:
-
+* You must use ANSI C comments (```/* */```); you must not
+ use C++ comments (```//```).
+* When you add functions to an existing file, you should
+ separate them by the same number of blank lines that
+ separate the functions that already are in that file.
+* All function declarations must be followed by a comment
+ block that tells at least briefly what the function does,
+ what the parameters are, and what is returned. This comment
+ must sit between the declaration and the function body, like
+ this:
+
+~~~C
int foo(int bar)
/* Add 1 to bar, takes bar and returns the result */
{
return bar + 1;
}
-
-* When a function's argument list wraps around to a next line, you should indent that next line by either the normal width or enough spaces to align it with the arguments on the previous line.
-* All declarations in a block must be at the beginning of that block.
-* You should put a blank line between a list of local variable declarations and the first line of code.
-* Always use curly braces even for single statements after ```if```, and the single statement should go into a new line.
-* Use "cuddling" braces, ie the opening brace goes in the same line as the ```if```:
-
+~~~
+
+* When a function's argument list wraps around to a next
+ line, you should indent that next line by either the
+ normal width or enough spaces to align it with the arguments
+ on the previous line.
+* All declarations in a block must be at the beginning of
+ that block.
+* You should put a blank line between a list of local
+ variable declarations and the first line of code.
+* Always use curly braces even for single statements after
+ ```if```, and the single statement should go into a new
+ line.
+* Use "cuddling" braces, ie the opening brace goes in the
+ same line as the ```if```:
+
+~~~C
if (foo > 42) {
bar = 23;
}
-
-* Should the ```if``` statement be followed by an empty conditional block, there should be a comment telling why this is the case
-
-* You must separate function names and parameter/argument lists by one space.
-* When declaring/defining pointers, you must put the asterisk (```*```) next to the data type, with a space between it and the variable's name. Examples:
-
- int* namedPtr[5];
- char* nextLine (FILE* f);
-
+~~~
+
+* Should the ```if``` statement be followed by an empty
+ conditional block, there should be a comment telling why
+ this is the case:
+
+~~~C
+if (check()) { /* nothing happened, do nothing */ }
+~~~
+
+* You must separate function names and parameter/argument
+ lists by one space.
+* When declaring/defining pointers, you must put the
+ asterisk (```*```) next to the data type, with a space
+ between it and the variable's name. Examples:
+
+~~~C
+int* namedPtr[5];
+char* nextLine (FILE* f);
+~~~
### Header files
-Headers that belong to the standard library (libc) must conform with the C standard. That means:
-* all non standard functions, or functions that only exist in a certain standard, should be in #ifdefs
- * the same is true for macros or typedefs
-
-#if __CC65_STD__ == __CC65_STD_C99__
-/* stuff that only exists in C99 here */
-#endif
-#if __CC65_STD__ == __CC65_STD_CC65__
-/* non standard stuff here */
-#endif
-
-You can refer to Annex B of the ISO C99 standard ([here](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf) is the draft).
+* All Headers should start with a copyright/license banner
+* Function prototypes must be a single line, not contain the redundant
+ "extern" keyword, and followed by a brief comment that explains what
+ the function does, and separated from the next prototype by a blank
+ line:
-## Assembly Sources
+~~~C
+void __fastcall__ cclear (unsigned char length);
+/* Clear part of a line (write length spaces). */
-* Op-code mnemonics must have lower-case letters. The names of instruction macroes may have upper-case letters.
-* Op-codes must use their official and commonly used mnemonics, ie bcc and bcs and not bgt and blt
-* Hexadecimal number constants should be used except where decimal or binary numbers make much more sense in that constant's context.
+~~~
+
+Headers that belong to the standard library (libc) must
+conform with the C standard. That means:
+
+* All non standard functions, or functions that only exist
+ in a certain standard, should be in #ifdefs
+* The same is true for macros or typedefs.
+ You can refer to Annex B of the ISO C99 standard
+ ([here](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf)
+ is the draft). Example:
+
+~~~C
+#if __CC65_STD__ == __CC65_STD_C99__ /* stuff that only exists in C99 here */
+#endif
+#if __CC65_STD__ == __CC65_STD_CC65__ /* non standard stuff here */
+#endif
+~~~
+
+## Assembly sources
+
+* Opcode mnemonics must have lower-case letters. The names
+ of instruction macroes may have upper-case letters.
+* Opcodes must use their official and commonly used
+ mnemonics, ie 'bcc' and 'bcs' and not 'bgt' and 'blt'.
+* Hexadecimal number constants should be used except where
+ decimal or binary numbers make much more sense in that
+ constant's context.
* Hexadecimal letters should be upper-case.
-* When you set two registers or two memory locations to an immediate 16-bit zero, you should use the expressions ```#<$0000``` and ```#>$0000``` (they make it obvious where you are putting the lower and upper bytes).
-* If a function is declared to return a char-sized value, it actually must return an integer-sized value. (When cc65 promotes a returned value, it sometimes assumes that the value already is an integer.) This must be done in one of the following ways:
-
+* When you set two registers or two memory locations to an
+ immediate 16-bit zero, you should use the expressions
+ ```#<$0000``` and ```#>$0000``` (they make it obvious where
+ you are putting the lower and upper bytes).
+* If a function is declared to return a char-sized value, it
+ actually must return an integer-sized value. (When cc65
+ promotes a returned value, it sometimes assumes that the value
+ already is an integer.)
+ This must be done in one of the following ways:
+
+~~~asm
lda #RETURN_VALUE
- ldx #0 ; return value is char
-
-or, if the value is 0, you can use:
-
+ ldx #0 ; Promote char return value
+
+ ; If the value is 0, you can use:
lda #RETURN_VALUE
.assert RETURN_VALUE = 0
tax
-
-sometimes jumping to return0 could save a byte:
-
+
+ ; Sometimes jumping to 'return 0' could save a byte:
.assert RETURN_VALUE = 0
jmp return 0
-
-* Functions, that are intended for a platform's system library, should be optimized as much as possible.
-* Sometimes, there must be a trade-off between size and speed. If you think that a library function won't be used often, then you should make it small. Otherwise, you should make it fast.
-* Comments that are put on the right side of instructions must be aligned (start in the same character columns).
-* Assembly source fields (label, operation, operand, comment) should start ''after'' character columns that are multiples of eight (such as 1, 9, 17, 33, and 41).
+~~~
+
+* Functions, that are intended for a platform's system
+ library, should be optimized as much as possible.
+* Sometimes, there must be a trade-off between size and
+ speed. If you think that a library function won't be used
+ often, then you should make it small. Otherwise, you should
+ make it fast.
+* Comments that are put on the right side of instructions
+ must be aligned (start in the same character columns).
+* Assembly source fields (label, operation, operand,
+ comment) should start ''after'' character columns that are
+ multiples of eight (such as 1, 9, 17, 33, and 41).
-## LinuxDoc Sources
+## LinuxDoc sources
* TAB characters must be expanded to spaces.
-* All text files must end with new-line characters. Don't leave the last line "dangling".
+* All text files must end with new-line characters. Don't
+ leave the last line "dangling".
* 80 characters is the desired maximum width of files.
* You should avoid typing non-ASCII characters.
* You should put blank lines between LinuxDoc sections:
- * Three blank lines between `````` sections.
- * Two blank lines between `````` sections.
- * One blank line between other sections.
+* Three blank lines between `````` sections.
+* Two blank lines between `````` sections.
+* One blank line between other sections.
# Library implementation rules
-* By default the toolchain must output a "standard" binary for the platform, no emulator formats, no extra headers used by tools. If the resulting binaries can not be run as is on emulators or eg flash cartridges, the process of converting them to something that can be used with these should be documented in the user manual.
-* Generally every function should live in a seperate source file - unless the functions are so closely related that splitting makes no sense.
-* Source files should not contain commented out code - if they do, there should be a comment that explains why that commented out code exists.
+* By default the toolchain must output a "standard" binary
+ for the platform, no emulator formats, no extra headers
+ used by tools. If the resulting binaries can not be run as
+ is on emulators or eg flash cartridges, the process of
+ converting them to something that can be used with these
+ should be documented in the user manual.
+* Generally every function should live in a seperate source
+ file - unless the functions are so closely related that
+ splitting makes no sense.
+* Source files should not contain commented out code - if
+ they do, there should be a comment that explains why that
+ commented out code exists.
# Makefile rules
-* Makefiles must generally work on both *nix (ba)sh and windows cmd.exe.
-* Makefiles must not use external tools that are not provided by the cc65 toolchain itself.
+* Makefiles must generally work on both *nix (ba)sh and
+ windows cmd.exe.
+* Makefiles must not use external tools that are not
+ provided by the cc65 toolchain itself.
-The only exception to the above are actions that are exclusive to the github actions - those may rely on bash and/or linux tools.
+The only exception to the above are actions that are exclusive
+to the github actions - those may rely on bash and/or linux tools.
# Documentation rules
@@ -190,107 +325,42 @@ The only exception to the above are actions that are exclusive to the github act
## Wiki
-* The Wiki is strictly for additional information that does not fit into the regular user manual (LinuxDoc). The wiki must not duplicate any information that is present in the user manual
+* The Wiki is strictly for additional information that does
+ not fit into the regular user manual (LinuxDoc). The wiki
+ must not duplicate any information that is present in the
+ user manual.
-# Roadmap / TODOs / open Ends
+# Roadmap / TODOs / open ends
## Documentation
-* the printf family of function does not completely implement all printf modifiers and does not behave as expected in some cases - all this should be documented in detail
+* The printf() family of functions does not completely
+ implement all printf() modifiers and does not behave as
+ expected in some cases - all this should be documented in
+ detail.
## Compiler
-* We need a way that makes it possible to feed arbitrary assembler code into the optimzer, so we can have proper tests for it
+* We need a way that makes it possible to feed arbitrary
+ assembler code into the optimzer, so we can have proper
+ tests for it.
### Floating point support
-The first step is implementing the datatype "float" as IEEE 754 floats. Help welcomed!
+The first step is implementing the datatype "float" as IEEE
+754 floats. Help welcomed!
-* WIP compiler/library changes are here: https://github.com/cc65/cc65/pull/1777
+* WIP compiler/library changes are here:
+ https://github.com/cc65/cc65/pull/1777
## Library
-### name clashes in the library
-
-see "Identifiers and Symbol names" above - not all identifiers have been checked
-and renamed yet. The following is a list of those that still might need to be
-fixed:
-
-```
-common
-
-__argc libsrc/runtime/callmain.s libsrc/cbm610/mainargs.s libsrc/cx16/mainargs.s libsrc/plus4/mainargs.s libsrc/lynx/mainargs.s libsrc/c16/mainargs.s libsrc/geos-common/system/mainargs.s libsrc/sim6502/mainargs.s libsrc/c128/mainargs.s libsrc/vic20/mainargs.s libsrc/nes/mainargs.s libsrc/atari/getargs.s libsrc/apple2/mainargs.s libsrc/cbm510/mainargs.s libsrc/telestrat/mainargs.s libsrc/c64/mainargs.s libsrc/pet/mainargs.s libsrc/atmos/mainargs.s
-__argv libsrc/runtime/callmain.s libsrc/cbm610/mainargs.s libsrc/cx16/mainargs.s libsrc/plus4/mainargs.s libsrc/lynx/mainargs.s libsrc/c16/mainargs.s libsrc/geos-common/system/mainargs.s libsrc/sim6502/mainargs.s libsrc/c128/mainargs.s libsrc/vic20/mainargs.s libsrc/nes/mainargs.s libsrc/atari/getargs.s libsrc/apple2/mainargs.s libsrc/cbm510/mainargs.s libsrc/telestrat/mainargs.s libsrc/c64/mainargs.s libsrc/pet/mainargs.s libsrc/atmos/mainargs.s
-__cos libsrc/common/sincos.s
-__ctypeidx libsrc/common/ctype.s libsrc/common/ctypemask.s libsrc/geos-common/system/ctype.s libsrc/atari/ctype.s libsrc/cbm/ctype.s libsrc/atmos/ctype.s asminc/ctype_common.inc
-__cwd libsrc/common/getcwd.s libsrc/common/_cwd.s libsrc/atari/initcwd.s libsrc/apple2/initcwd.s libsrc/apple2/initcwd.s libsrc/telestrat/initcwd.s libsrc/cbm/initcwd.s
-__cwd_buf_size libsrc/common/_cwd.s
-__envcount libsrc/common/searchenv.s libsrc/common/_environ.s libsrc/common/putenv.s libsrc/common/getenv.s
-__environ libsrc/common/searchenv.s libsrc/common/_environ.s libsrc/common/putenv.s libsrc/common/getenv.s
-__envsize libsrc/common/_environ.s libsrc/common/putenv.s
-__fdesc libsrc/common/_fdesc.s libsrc/common/fopen.s
-__filetab libsrc/common/_fdesc.s libsrc/common/_file.s asminc/_file.inc
-__fopen libsrc/common/fopen.s libsrc/common/_fopen.s
-__printf libsrc/common/vsnprintf.s libsrc/common/_printf.s libsrc/common/vfprintf.s libsrc/conio/vcprintf.s libsrc/pce/_printf.s
-__scanf libsrc/common/_scanf.inc libsrc/common/vsscanf.s libsrc/conio/vcscanf.s
-__sin libsrc/common/sincos.s
-__sys libsrc/common/_sys.s libsrc/apple2/_sys.s
-__sys_oserrlist libsrc/common/stroserr.s libsrc/geos-common/system/oserrlist.s libsrc/atari/oserrlist.s libsrc/apple2/oserrlist.s libsrc/cbm/oserrlist.s libsrc/atmos/oserrlist.s
-__syschdir libsrc/common/chdir.s libsrc/atari/syschdir.s libsrc/apple2/syschdir.s libsrc/telestrat/syschdir.s libsrc/cbm/syschdir.s
-__sysmkdir libsrc/common/mkdir.s libsrc/atari/sysmkdir.s libsrc/apple2/sysmkdir.s libsrc/telestrat/sysmkdir.s
-__sysremove libsrc/common/remove.s libsrc/geos-common/file/sysremove.s libsrc/atari/sysremove.s libsrc/atari/sysrmdir.s libsrc/apple2/sysremove.s libsrc/apple2/sysrmdir.s libsrc/telestrat/sysremove.s libsrc/cbm/sysremove.s
-__sysrename libsrc/common/rename.s libsrc/geos-common/file/sysrename.s libsrc/atari/sysrename.s libsrc/apple2/sysrename.s libsrc/cbm/sysrename.s
-__sysrmdir libsrc/common/rmdir.s libsrc/atari/sysrmdir.s libsrc/apple2/sysrmdir.s
-__sysuname libsrc/common/uname.s libsrc/cbm610/sysuname.s libsrc/cx16/sysuname.s libsrc/plus4/sysuname.s libsrc/lynx/sysuname.s libsrc/c16/sysuname.s libsrc/geos-common/system/sysuname.s libsrc/c128/sysuname.s libsrc/creativision/sysuname.s libsrc/vic20/sysuname.s libsrc/nes/sysuname.s libsrc/atari/sysuname.s libsrc/apple2/sysuname.s libsrc/cbm510/sysuname.s libsrc/telestrat/sysuname.s libsrc/c64/sysuname.s libsrc/pet/sysuname.s libsrc/atari5200/sysuname.s libsrc/atmos/sysuname.s
-
-apple2
-
-__auxtype libsrc/apple2/open.s
-__datetime libsrc/apple2/open.s
-__dos_type libsrc/apple2/dioopen.s libsrc/apple2/curdevice.s libsrc/apple2/mainargs.s libsrc/apple2/settime.s libsrc/apple2/getdevice.s libsrc/apple2/dosdetect.s libsrc/apple2/irq.s libsrc/apple2/open.s libsrc/apple2/mli.s libsrc/apple2/getres.s
-__filetype libsrc/apple2/open.s libsrc/apple2/exehdr.s
-
-
-atari
-
-__defdev libsrc/atari/posixdirent.s libsrc/atari/ucase_fn.s libsrc/atari/getdefdev.s
-__dos_type libsrc/atari/getargs.s libsrc/atari/exec.s libsrc/atari/settime.s libsrc/atari/syschdir.s libsrc/atari/dosdetect.s libsrc/atari/is_cmdline_dos.s libsrc/atari/sysrmdir.s libsrc/atari/gettime.s libsrc/atari/lseek.s libsrc/atari/getres.s libsrc/atari/getdefdev.s
-__do_oserror libsrc/atari/posixdirent.s libsrc/atari/do_oserr.s libsrc/atari/serref.s libsrc/atari/read.s libsrc/atari/write.s libsrc/atari/close.s
-__getcolor libsrc/atari/setcolor.s
-__getdefdev libsrc/atari/getdefdev.s
-__graphics libsrc/atari/graphics.s
-__inviocb libsrc/atari/serref.s libsrc/atari/ser/atrrdev.s libsrc/atari/inviocb.s libsrc/atari/read.s libsrc/atari/write.s libsrc/atari/lseek.s libsrc/atari/close.s
-__is_cmdline_dos libsrc/atari/is_cmdline_dos.s libsrc/atari/doesclrscr.s
-__rest_vecs libsrc/atari/savevec.s
-__rwsetup libsrc/atari/rwcommon.s libsrc/atari/read.s libsrc/atari/write.s
-__save_vecs libsrc/atari/savevec.s
-__scroll libsrc/atari/scroll.s
-__setcolor libsrc/atari/setcolor.s
-__setcolor_low libsrc/atari/setcolor.s
-__sio_call libsrc/atari/diowritev.s libsrc/atari/diopncls.s libsrc/atari/siocall.s libsrc/atari/diowrite.s libsrc/atari/dioread.s
-
-
-cbm
-
-__cbm_filetype libsrc/cbm/cbm_filetype.s asminc/cbm_filetype.in
-__dirread libsrc/cbm/dir.inc libsrc/cbm/dir.s
-__dirread1 libsrc/cbm/dir.inc libsrc/cbm/dir.s
-
-
-lynx
-
-__iodat libsrc/lynx/lynx-cart.s libsrc/lynx/bootldr.s libsrc/lynx/extzp.s libsrc/lynx/crt0.s libsrc/lynx/extzp.inc
-__iodir libsrc/lynx/extzp.s libsrc/lynx/crt0.s libsrc/lynx/extzp.inc
-__sprsys libsrc/lynx/tgi/lynx-160-102-16.s libsrc/lynx/extzp.s libsrc/lynx/crt0.s libsrc/lynx/extzp.inc
-__viddma libsrc/lynx/tgi/lynx-160-102-16.s libsrc/lynx/extzp.s libsrc/lynx/crt0.s libsrc/lynx/extzp.inc
-
-
-pce
-
-__nmi libsrc/pce/irq.s libsrc/pce/crt0.s
-```
+Some name clashes need to be resolved. Please see the
+[detailed list of name clashes](libsrc/NameClashes.md).
## Test suite
-* specific tests to check the optimizer (rather than the codegenerator) are needed.
-* we need more specific tests to check standard conformance of the library headers
+* Specific tests to check the optimizer (rather than the code
+ generator) are needed.
+* We need more specific tests to check standard conformance
+ of the library headers.
diff --git a/README.md b/README.md
index e0e2c24e7..e3f1ab30f 100644
--- a/README.md
+++ b/README.md
@@ -1,13 +1,62 @@
-# About cc65
+The cc65 cross-compiler suite
+=============================
-cc65 is a complete cross development package for 65(C)02 systems, including
-a powerful macro assembler, a C compiler, linker, archiver and several
-other tools. cc65 has C and runtime library support for many of the old 6502 machines.
-For details look at the [Website](https://cc65.github.io).
+cc65 is a complete cross-development package for 65(C)02 systems,
+including a powerful macro assembler, a C compiler, linker, archiver,
+simulator and several other tools. cc65 has C and runtime library
+support for many of the old 6502 machines. For details look at
+the [cc65 web site](https://cc65.github.io):
+
+| Company / People | Machine / Environment |
+|-------------------------|-------------------------------------|
+| Apple | Apple II |
+| | Apple IIe enhanced |
+| Atari | Atari 400/800 |
+| | Atari 2600 |
+| | Atari 5200 |
+| | Atari 7800 |
+| | Atari XL |
+| | Lynx |
+| Tangerine | Oric Atmos |
+| Eureka | Oric Telestrat |
+| Acorn | BBC series |
+| Commodore | C128 |
+| | C16 |
+| | C64 |
+| | CBM 510/610 |
+| | PET |
+| | Plus/4 |
+| | VIC-20 |
+| VTech | CreatiVision |
+| Commander X16 Community | Commander X16 |
+| Bit Corporation | Gamate |
+| Berkeley Softworks | GEOS (Apple/CBM) |
+| LUnix Team | LUnix (C64) |
+| Nintendo | Nintendo Entertainment System (NES) |
+| Ohio Scientific | OSI C1P |
+| MOS Technology, Inc. | KIM-1 |
+| NEC | PC Engine (PCE) |
+| Dr. Jozo Dujmović | Picocomputer (RP6502) |
+| Watara | Watura/QuickShot Supervision |
+| Synertek | SYM-1 |
+
+A generic configuration to adapt cc65 to new targets is also around.
## People
-Core team members:
+cc65 is originally based on the "Small C" compiler by Ron Cain and
+enhanced by James E. Hendrix.
+
+### Project founders
+
+* John R. Dunning: [original implementation](https://public.websites.umich.edu/~archive/atari/8bit/Languages/Cc65/)
+ of the C compiler and runtime library, Atari hosted.
+* Ullrich von Bassewitz:
+ * moved Dunning's code to modern systems,
+ * rewrote most parts of the compiler,
+ * rewrote all of the runtime library.
+
+### Core team members
* [Christian Groessler](https://github.com/groessler): Atari, Atari5200, and CreatiVision library Maintainer
* [dqh](https://github.com/dqh-au): GHA help
@@ -15,7 +64,7 @@ Core team members:
* [groepaz](https://github.com/mrdudz): CBM library, Project Maintainer
* [Oliver Schmidt](https://github.com/oliverschmidt): Apple II library Maintainer
-External contributors:
+### External contributors
* [acqn](https://github.com/acqn): various compiler fixes
* [jedeoric](https://github.com/jedeoric): Telestrat target
@@ -24,29 +73,35 @@ External contributors:
* [Stephan Mühlstrasser](https://github.com/smuehlst): osic1p target
* [Wayne Parham](https://github.com/WayneParham): Sym-1 target
* [Dave Plummer](https://github.com/davepl): KIM-1 target
+* [rumbledethumps](https://github.com/rumbledethumps): Picocomputer target
*(The above list is incomplete, if you feel left out - please speak up or add yourself in a PR)*
-For a complete list look at the [full team list](https://github.com/orgs/cc65/teams) or the list of [all contributors](https://github.com/cc65/cc65/graphs/contributors)
+For a complete list look at the [full team list](https://github.com/orgs/cc65/teams)
+or the list of [all contributors](https://github.com/cc65/cc65/graphs/contributors).
# Contact
-For general discussion, questions, etc subscribe to the [mailing list](https://cc65.github.io/mailing-lists.html) or use the [github discussions](https://github.com/cc65/cc65/discussions).
+For general discussion, questions, etc subscribe to the
+[mailing list](https://cc65.github.io/mailing-lists.html)
+or use the [github discussions](https://github.com/cc65/cc65/discussions).
-Some of us may also be around on IRC [#cc65](https://web.libera.chat/#cc65) on libera.chat
+Some of us may also be around on IRC [#cc65](https://web.libera.chat/#cc65) on libera.chat.
# Documentation
-* The main [Documentation](https://cc65.github.io/doc) for users and developers
-
-* Info on [Contributing](Contributing.md) to the CC65 project. Please read this before working on something you want to contribute, and before reporting bugs.
-
-* The [Wiki](https://github.com/cc65/wiki/wiki) contains some extra info that does not fit into the regular documentation.
+* The main [Documentation](https://cc65.github.io/doc) for users and
+ developers.
+* Info on [Contributing](Contributing.md) to the CC65 project. Please
+ read this before working on something you want to contribute, and
+ before reporting bugs.
+* The [Wiki](https://github.com/cc65/wiki/wiki) contains some extra info
+ that does not fit into the regular documentation.
# Downloads
-* [Windows Snapshot](https://sourceforge.net/projects/cc65/files/cc65-snapshot-win32.zip)
-
-* [Linux Snapshot DEB and RPM](https://software.opensuse.org//download.html?project=home%3Astrik&package=cc65)
+* [Windows 64bit Snapshot](https://sourceforge.net/projects/cc65/files/cc65-snapshot-win64.zip)
+* [Windows 32bit Snapshot](https://sourceforge.net/projects/cc65/files/cc65-snapshot-win32.zip)
+* [Linux Snapshot DEB and RPM](https://software.opensuse.org/download.html?project=home%3Astrik&package=cc65)
[](https://github.com/cc65/cc65/actions/workflows/snapshot-on-push-master.yml)
diff --git a/asminc/apple2.inc b/asminc/apple2.inc
index 528c463a1..fb4a1b2f0 100644
--- a/asminc/apple2.inc
+++ b/asminc/apple2.inc
@@ -25,6 +25,12 @@ BRKVec := $03F0 ; Break vector
SOFTEV := $03F2 ; Vector for warm start
PWREDUP := $03F4 ; This must be = EOR #$A5 of SOFTEV+1
+;-----------------------------------------------------------------------------
+; 80 column firmware
+
+OURCH := $057B ; Cursor horizontal position
+OURCV := $05FB ; Cursor vertical position
+
;-----------------------------------------------------------------------------
; Hardware
diff --git a/asminc/cpu.mac b/asminc/cpu.mac
index 31170fbed..084a42119 100644
--- a/asminc/cpu.mac
+++ b/asminc/cpu.mac
@@ -15,7 +15,7 @@ CPU_ISET_4510 = $0400
CPU_NONE = CPU_ISET_NONE
CPU_6502 = CPU_ISET_6502
CPU_6502X = CPU_ISET_6502|CPU_ISET_6502X
-CPU_6502DTV = CPU_ISET_6502|CPU_ISET_6502X|CPU_ISET_6502DTV
+CPU_6502DTV = CPU_ISET_6502|CPU_ISET_6502DTV
CPU_65SC02 = CPU_ISET_6502|CPU_ISET_65SC02
CPU_65C02 = CPU_ISET_6502|CPU_ISET_65SC02|CPU_ISET_65C02
CPU_65816 = CPU_ISET_6502|CPU_ISET_65SC02|CPU_ISET_65816
diff --git a/asminc/generic.mac b/asminc/generic.mac
index bc6f5924e..5e5b210f5 100644
--- a/asminc/generic.mac
+++ b/asminc/generic.mac
@@ -31,10 +31,8 @@
; bgt - jump if unsigned greater
.macro bgt Arg
- .local L
- beq L
+ beq *+4
bcs Arg
-L:
.endmacro
; ble - jump if unsigned less or equal
diff --git a/asminc/lynx.inc b/asminc/lynx.inc
index 403d15d07..150bee6d1 100644
--- a/asminc/lynx.inc
+++ b/asminc/lynx.inc
@@ -79,19 +79,91 @@ MATHL = $FC6D
MATHK = $FC6E
MATHJ = $FC6F
-; Suzy Misc
+; Suzy sprite engine
+
+SPRCTL0 = $FC80
+; Sprite bits-per-pixel definitions
+BPP_MASK = %11000000 ; Mask for settings bits per pixel
+BPP_1 = %00000000
+BPP_2 = %01000000
+BPP_3 = %10000000
+BPP_4 = %11000000
+; More sprite control 0 bit definitions
+HFLIP = %00100000
+VFLIP = %00010000
+; Sprite types - redefined to reflect the reality caused by the shadow error
+TYPE_SHADOW = %00000111
+TYPE_XOR = %00000110
+TYPE_NONCOLL = %00000101 ; Non-colliding
+TYPE_NORMAL = %00000100
+TYPE_BOUNDARY = %00000011
+TYPE_BSHADOW = %00000010 ; Background shadow
+TYPE_BACKNONCOLL = %00000001 ; Background non-colliding
+TYPE_BACKGROUND = %00000000
-SPRCTL0 = $FC80
SPRCTL1 = $FC81
-SPRCOLL = $FC82
-SPRINIT = $FC83
-SUZYHREV = $FC88
-SUZYSREV = $FC89
-SUZYBUSEN = $FC90
-SPRGO = $FC91
-SPRSYS = $FC92
-JOYSTICK = $FCB0
+LITERAL = %10000000
+PACKED = %00000000
+ALGO3 = %01000000 ; Broken, do not set this bit!
+; Sprite reload mask definitions
+RELOAD_MASK = %00110000
+RENONE = %00000000 ; Reload nothing
+REHV = %00010000 ; Reload hsize, vsize
+REHVS = %00100000 ; Reload hsize, vsize, stretch
+REHVST = %00110000 ; Reload hsize, vsize, stretch, tilt
+; More sprite control 1 bit definitions
+REUSEPAL = %00001000
+SKIP = %00000100
+DRAWUP = %00000010
+DRAWLEFT = %00000001
+
+SPRCOLL = $FC82
+SPRINIT = $FC83
+SUZYHREV = $FC88
+SUZYSREV = $FC89
+SUZYBUSEN = $FC90
+
+SPRGO = $FC91
+; SPRGO bit definitions
+SPRITE_GO = %00000001 ; sprite process start bit
+EVER_ON = %00000100 ; everon detector enable
+
+SPRSYS = $FC92
+; SPRSYS bit definitions for write operations
+SIGNMATH = %10000000 ; signed math
+ACCUMULATE = %01000000 ; accumulate multiplication results
+NO_COLLIDE = %00100000 ; do not collide with any sprites (also SPRCOLL bit definition)
+VSTRETCH = %00010000 ; stretch v
+LEFTHAND = %00001000
+CLR_UNSAFE = %00000100 ; unsafe access reset
+SPRITESTOP = %00000010 ; request to stop sprite process
+; SPRSYS bit definitions for read operations
+MATHWORKING = %10000000 ; math operation in progress
+MATHWARNING = %01000000 ; accumulator overflow on multiple or divide by zero
+MATHCARRY = %00100000 ; last carry bit
+VSTRETCHING = %00010000
+LEFTHANDED = %00001000
+UNSAFE_ACCESS = %00000100 ; unsafe access performed
+SPRITETOSTOP = %00000010 ; requested to stop
+SPRITEWORKING = %00000001 ; sprite process is active
+
+JOYSTICK = $FCB0
+; JOYSTICK bit definitions
+JOYPAD_UP = %10000000
+JOYPAD_DOWN = %01000000
+JOYPAD_LEFT = %00100000
+JOYPAD_RIGHT = %00010000
+BUTTON_OPTION1 = %00001000
+BUTTON_OPTION2 = %00000100
+BUTTON_INNER = %00000010
+BUTTON_OUTER = %00000001
+
SWITCHES = $FCB1
+; SWITCHES bit definitions
+CART1_IO_INACTIVE = %00000100
+CART0_IO_INACTIVE = %00000010
+BUTTON_PAUSE = %00000001
+
RCART0 = $FCB2
RCART1 = $FCB3
LEDS = $FCC0
@@ -99,181 +171,290 @@ PARSTATUS = $FCC2
PARDATA = $FCC3
HOWIE = $FCC4
-
-; ***
+;
; *** Mikey Addresses
; ***
-; Mikey Timers
+; Mikey timers
-TIMER0 = $FD00
-TIMER1 = $FD04
-TIMER2 = $FD08
-TIMER3 = $FD0C
-TIMER4 = $FD10
-TIMER5 = $FD14
-TIMER6 = $FD18
-TIMER7 = $FD1C
-HTIMER = $FD00 ; horizontal line timer (timer 0)
-VTIMER = $FD08 ; vertical blank timer (timer 2)
-STIMER = $FD1C ; sound timer (timer 7)
+; Logical timer names
+TIMER0 = $FD00
+TIMER1 = $FD04
+TIMER2 = $FD08
+TIMER3 = $FD0C
+TIMER4 = $FD10
+TIMER5 = $FD14
+TIMER6 = $FD18
+TIMER7 = $FD1C
+HTIMER = TIMER0 ; horizontal line timer (timer 0)
+VTIMER = TIMER2 ; vertical blank timer (timer 2)
+STIMER = TIMER7 ; sound timer (timer 7)
-HTIMBKUP = $FD00 ; horizontal line timer (timer 0)
-HTIMCTLA = $FD01
-HTIMCNT = $FD02
-HTIMCTLB = $FD03
-VTIMBKUP = $FD08 ; vertical blank timer (timer 2)
-VTIMCTLA = $FD09
-VTIMCNT = $FD0A
-VTIMCTLB = $FD0B
-BAUDBKUP = $FD10 ; serial timer (timer 4)
-STIMBKUP = $FD1C ; sound timer (timer 7)
-STIMCTLA = $FD1D
-STIMCNT = $FD1E
-STIMCTLB = $FD1F
+HTIMBKUP = $FD00 ; horizontal line timer (timer 0)
+HTIMCTLA = $FD01
+HTIMCNT = $FD02
+HTIMCTLB = $FD03
+VTIMBKUP = $FD08 ; vertical blank timer (timer 2)
+VTIMCTLA = $FD09
+VTIMCNT = $FD0A
+VTIMCTLB = $FD0B
+BAUDBKUP = $FD10 ; serial timer (timer 4)
+STIMBKUP = $FD1C ; sound timer (timer 7)
+STIMCTLA = $FD1D
+STIMCNT = $FD1E
+STIMCTLB = $FD1F
-TIM0BKUP = $FD00
-TIM0CTLA = $FD01
-TIM0CNT = $FD02
-TIM0CTLB = $FD03
-TIM1BKUP = $FD04
-TIM1CTLA = $FD05
-TIM1CNT = $FD06
-TIM1CTLB = $FD07
-TIM2BKUP = $FD08
-TIM2CTLA = $FD09
-TIM2CNT = $FD0A
-TIM2CTLB = $FD0B
-TIM3BKUP = $FD0C
-TIM3CTLA = $FD0D
-TIM3CNT = $FD0E
-TIM3CTLB = $FD0F
-TIM4BKUP = $FD10
-TIM4CTLA = $FD11
-TIM4CNT = $FD12
-TIM4CTLB = $FD13
-TIM5BKUP = $FD14
-TIM5CTLA = $FD15
-TIM5CNT = $FD16
-TIM5CTLB = $FD17
-TIM6BKUP = $FD18
-TIM6CTLA = $FD19
-TIM6CNT = $FD1A
-TIM6CTLB = $FD1B
-TIM7BKUP = $FD1C
-TIM7CTLA = $FD1D
-TIM7CNT = $FD1E
-TIM7CTLB = $FD1F
+TIM0BKUP = $FD00
+TIM0CTLA = $FD01
+TIM0CNT = $FD02
+TIM0CTLB = $FD03
+TIM1BKUP = $FD04
+TIM1CTLA = $FD05
+TIM1CNT = $FD06
+TIM1CTLB = $FD07
+TIM2BKUP = $FD08
+TIM2CTLA = $FD09
+TIM2CNT = $FD0A
+TIM2CTLB = $FD0B
+TIM3BKUP = $FD0C
+TIM3CTLA = $FD0D
+TIM3CNT = $FD0E
+TIM3CTLB = $FD0F
+TIM4BKUP = $FD10
+TIM4CTLA = $FD11
+TIM4CNT = $FD12
+TIM4CTLB = $FD13
+TIM5BKUP = $FD14
+TIM5CTLA = $FD15
+TIM5CNT = $FD16
+TIM5CTLB = $FD17
+TIM6BKUP = $FD18
+TIM6CTLA = $FD19
+TIM6CNT = $FD1A
+TIM6CTLB = $FD1B
+TIM7BKUP = $FD1C
+TIM7CTLA = $FD1D
+TIM7CNT = $FD1E
+TIM7CTLB = $FD1F
+
+; Timer offsets
+TIM_BACKUP = 0
+TIM_CONTROLA = 1
+TIM_COUNT = 2
+TIM_CONTROLB = 3
+
+; TIM_CONTROLA control bits
+ENABLE_INT = %10000000
+RESET_DONE = %01000000
+ENABLE_RELOAD = %00010000
+ENABLE_COUNT = %00001000
+AUD_CLOCK_MASK = %00000111
+; Clock settings
+AUD_LINKING = %00000111
+AUD_64 = %00000110
+AUD_32 = %00000101
+AUD_16 = %00000100
+AUD_8 = %00000011
+AUD_4 = %00000010
+AUD_2 = %00000001
+AUD_1 = %00000000
+
+; TIM_CONTROLB control bits
+TIMER_DONE = %00001000
+LAST_CLOCK = %00000100
+BORROW_IN = %00000010
+BORROW_OUT = %00000001
; Mikey Audio
-AUDIO0 = $FD20 ; audio channel 0
-AUDIO1 = $FD28 ; audio channel 1
-AUDIO2 = $FD30 ; audio channel 2
-AUDIO3 = $FD38 ; audio channel 3
+AUDIO0 = $FD20 ; audio channel 0
+AUDIO1 = $FD28 ; audio channel 1
+AUDIO2 = $FD30 ; audio channel 2
+AUDIO3 = $FD38 ; audio channel 3
-AUD0VOL = $FD20
-AUD0FEED = $FD21
-AUD0OUT = $FD22
-AUD0SHIFT = $FD23
-AUD0BKUP = $FD24
-AUD0CTLA = $FD25
-AUD0CNT = $FD26
-AUD0CTLB = $FD27
-AUD1VOL = $FD28
-AUD1FEED = $FD29
-AUD1OUT = $FD2A
-AUD1SHIFT = $FD2B
-AUD1BKUP = $FD2C
-AUD1CTLA = $FD2D
-AUD1CNT = $FD2E
-AUD1CTLB = $FD2F
-AUD2VOL = $FD30
-AUD2FEED = $FD31
-AUD2OUT = $FD32
-AUD2SHIFT = $FD33
-AUD2BKUP = $FD34
-AUD2CTLA = $FD35
-AUD2CNT = $FD36
-AUD2CTLB = $FD37
-AUD3VOL = $FD38
-AUD3FEED = $FD39
-AUD3OUT = $FD3A
-AUD3SHIFT = $FD3B
-AUD3BKUP = $FD3C
-AUD3CTLA = $FD3D
-AUD3CNT = $FD3E
-AUD3CTLB = $FD3F
-MSTEREO = $FD50
+AUD0VOL = $FD20
+AUD0FEED = $FD21
+AUD0OUT = $FD22
+AUD0SHIFT = $FD23
+AUD0BKUP = $FD24
+AUD0CTLA = $FD25
+AUD0CNT = $FD26
+AUD0CTLB = $FD27
+AUD1VOL = $FD28
+AUD1FEED = $FD29
+AUD1OUT = $FD2A
+AUD1SHIFT = $FD2B
+AUD1BKUP = $FD2C
+AUD1CTLA = $FD2D
+AUD1CNT = $FD2E
+AUD1CTLB = $FD2F
+AUD2VOL = $FD30
+AUD2FEED = $FD31
+AUD2OUT = $FD32
+AUD2SHIFT = $FD33
+AUD2BKUP = $FD34
+AUD2CTLA = $FD35
+AUD2CNT = $FD36
+AUD2CTLB = $FD37
+AUD3VOL = $FD38
+AUD3FEED = $FD39
+AUD3OUT = $FD3A
+AUD3SHIFT = $FD3B
+AUD3BKUP = $FD3C
+AUD3CTLA = $FD3D
+AUD3CNT = $FD3E
+AUD3CTLB = $FD3F
-; Mikey Misc
+; AUD_CONTROL bits are almost identical to TIM_CONTROLA bits.
+; See TIM_CONTROLA above for the other definitions
+FEEDBACK_7 = %10000000
+ENABLE_INTEGRATE = %00100000
+
+; Stereo control registers follow
+; Stereo capability does not exist in all Lynxes
+; Left and right may be reversed, and if so will be corrected in a later
+; release
+ATTENREG0 = $FD40 ; Stereo attenuation registers
+ATTENREG1 = $FD41
+ATTENREG2 = $FD42
+ATTENREG3 = $FD43
+
+MPAN = $FD44
+MSTEREO = $FD50
+; Bit definitions for MPAN and MSTEREO registers
+LEFT_ATTENMASK = %11110000
+RIGHT_ATTENMASK = %00001111
+LEFT3_SELECT = %10000000
+LEFT2_SELECT = %01000000
+LEFT1_SELECT = %00100000
+LEFT0_SELECT = %00010000
+RIGHT3_SELECT = %00001000
+RIGHT2_SELECT = %00000100
+RIGHT1_SELECT = %00000010
+RIGHT0_SELECT = %00000001
+
+; Mikey interrupts
+
+INTRST = $FD80
+INTSET = $FD81
; Interrupt bits in INTRST and INTSET
-TIMER0_INTERRUPT = $01
-TIMER1_INTERRUPT = $02
-TIMER2_INTERRUPT = $04
-TIMER3_INTERRUPT = $08
-TIMER4_INTERRUPT = $10
-TIMER5_INTERRUPT = $20
-TIMER6_INTERRUPT = $40
-TIMER7_INTERRUPT = $80
+TIMER0_INTERRUPT = %00000001
+TIMER1_INTERRUPT = %00000010
+TIMER2_INTERRUPT = %00000100
+TIMER3_INTERRUPT = %00001000
+TIMER4_INTERRUPT = %00010000
+TIMER5_INTERRUPT = %00100000
+TIMER6_INTERRUPT = %01000000
+TIMER7_INTERRUPT = %10000000
-HBL_INTERRUPT = TIMER0_INTERRUPT
-VBL_INTERRUPT = TIMER2_INTERRUPT
+HBL_INTERRUPT = TIMER0_INTERRUPT
+VBL_INTERRUPT = TIMER2_INTERRUPT
SERIAL_INTERRUPT = TIMER4_INTERRUPT
-SND_INTERRUPT = TIMER7_INTERRUPT
+SND_INTERRUPT = TIMER7_INTERRUPT
-INTRST = $FD80
-INTSET = $FD81
-MAGRDY0 = $FD84
-MAGRDY1 = $FD85
-AUDIN = $FD86
-SYSCTL1 = $FD87
-MIKEYHREV = $FD88
-MIKEYSREV = $FD89
-IODIR = $FD8A
-IODAT = $FD8B
-TxIntEnable = %10000000
-RxIntEnable = %01000000
-TxParEnable = %00010000
-ResetErr = %00001000
-TxOpenColl = %00000100
-TxBreak = %00000010
-ParEven = %00000001
-TxReady = %10000000
-RxReady = %01000000
-TxEmpty = %00100000
-RxParityErr = %00010000
-RxOverrun = %00001000
-RxFrameErr = %00000100
-RxBreak = %00000010
-ParityBit = %00000001
-SERCTL = $FD8C
-SERDAT = $FD8D
-SDONEACK = $FD90
-CPUSLEEP = $FD91
-DISPCTL = $FD92
-PBKUP = $FD93
-DISPADRL = $FD94
-DISPADRH = $FD95
-MTEST0 = $FD9C
-MTEST1 = $FD9D
-MTEST2 = $FD9E
-PALETTE = $FDA0 ; hardware rgb palette
-GCOLMAP = $FDA0 ; hardware rgb palette (green)
-RBCOLMAP = $FDB0 ; hardware rgb palette (red-blue)
+MAGRDY0 = $FD84
+MAGRDY1 = $FD85
+AUDIN = $FD86
+SYSCTL1 = $FD87
+; SYSCTL1 bit definitions
+POWERON = %00000010
+CART_ADDR_STROBE = %00000001
+MIKEYHREV = $FD88
+MIKEYSREV = $FD89
-; ***
-; *** Misc Hardware + 6502 vectors
-; ***
+IODIR = $FD8A
+IODAT = $FD8B
+; IODIR and IODAT bit definitions
+AUDIN_BIT = %00010000 ; Note that there is also the address AUDIN
+READ_ENABLE = %00010000 ; Same bit for AUDIN_BIT
+RESTLESS = %00001000
+NOEXP = %00000100 ; If set, redeye is not connected
+CART_ADDR_DATA = %00000010
+CART_POWER_OFF = %00000010 ; Same bit for CART_ADDR_DATA
+EXTERNAL_POWER = %00000001
-MAPCTL = $FFF9
-VECTORS = $FFFB
-INTVECTL = $FFFE
-INTVECTH = $FFFF
-RSTVECTL = $FFFC
-RSTVECTH = $FFFD
-NMIVECTL = $FFFA
-NMIVECTH = $FFFB
+SERCTL = $FD8C
+; SERCTL bit definitions for write operations
+TXINTEN = %10000000
+RXINTEN = %01000000
+PAREN = %00010000
+RESETERR = %00001000
+TXOPEN = %00000100
+TXBRK = %00000010
+PAREVEN = %00000001
+; SERCTL bit definitions for read operations
+TXRDY = %10000000
+RXRDY = %01000000
+TXEMPTY = %00100000
+PARERR = %00010000
+OVERRUN = %00001000
+FRAMERR = %00000100
+RXBRK = %00000010
+PARBIT = %00000001
+SERDAT = $FD8D
+SDONEACK = $FD90
+CPUSLEEP = $FD91
+DISPCTL = $FD92
+; DISPCTL bit definitions
+DISP_COLOR = %10000000 ; must be set to 1
+DISP_FOURBIT = %01000000 ; must be set to 1
+DISP_FLIP = %00100000
+DMA_ENABLE = %00010000 ; must be set to 1
+
+PBKUP = $FD93
+DISPADRL = $FD94
+DISPADRH = $FD95
+
+MTEST0 = $FD9C
+; MTEST0 bit definitions
+AT_CNT16 = %10000000
+AT_TEST = %01000000
+XCLKEN = %00100000
+UART_TURBO = %00010000
+ROM_SEL = %00001000
+ROM_TEST = %00000100
+M_TEST = %00000010
+CPU_TEST = %00000001
+
+MTEST1 = $FD9D
+; MTEST1 bit definitions
+P_CNT16 = %01000000
+REF_CNT16 = %00100000
+VID_TRIG = %00010000
+REF_TRIG = %00001000
+VID_DMA_DIS = %00000100
+REF_FAST = %00000010
+REF_DIS = %00000001
+
+MTEST2 = $FD9E
+; MTEST2 bit definitions
+V_STROBE = %00010000
+V_ZERO = %00001000
+H_120 = %00000100
+H_ZERO = %00000010
+V_BLANKEF = %00000001
+
+PALETTE = $FDA0 ; hardware rgb palette
+GCOLMAP = $FDA0 ; hardware rgb palette (green)
+RBCOLMAP = $FDB0 ; hardware rgb palette (red-blue)
+
+; Memory mapping control and 6502 vectors
+
+MAPCTL = $FFF9
+; MAPCTL bit definitions
+TURBO_DISABLE = %10000000
+VECTOR_SPACE = %00001000 ; 1 maps RAM into specified space
+ROM_SPACE = %00000100
+MIKEY_SPACE = %00000010
+SUZY_SPACE = %00000001
+
+VECTORS = $FFFB
+INTVECTL = $FFFE
+INTVECTH = $FFFF
+RSTVECTL = $FFFC
+RSTVECTH = $FFFD
+NMIVECTL = $FFFA
+NMIVECTH = $FFFB
diff --git a/asminc/rp6502.inc b/asminc/rp6502.inc
new file mode 100644
index 000000000..816712abb
--- /dev/null
+++ b/asminc/rp6502.inc
@@ -0,0 +1,98 @@
+; Picocomputer 6502 general defines
+
+; RIA UART
+RIA_READY := $FFE0 ; TX=$80 RX=$40
+RIA_TX := $FFE1
+RIA_RX := $FFE2
+
+; VSYNC from PIX VGA
+RIA_VSYNC := $FFE3
+
+; RIA XRAM portal 0
+RIA_RW0 := $FFE4
+RIA_STEP0 := $FFE5
+RIA_ADDR0 := $FFE6
+
+; RIA XRAM portal 1
+RIA_RW1 := $FFE8
+RIA_STEP1 := $FFE9
+RIA_ADDR1 := $FFEA
+
+; RIA OS fastcall
+RIA_XSTACK := $FFEC
+RIA_ERRNO := $FFED
+RIA_OP := $FFEF
+RIA_IRQ := $FFF0
+RIA_SPIN := $FFF1
+RIA_BUSY := $FFF2 ; Bit $80
+RIA_A := $FFF4
+RIA_X := $FFF6
+RIA_SREG := $FFF8
+
+; RIA OS operation numbers
+RIA_OP_EXIT := $FF
+RIA_OP_ZXSTACK := $00
+RIA_OP_XREG := $01
+RIA_OP_PHI2 := $02
+RIA_OP_CODEPAGE := $03
+RIA_OP_LRAND := $04
+RIA_OP_STDIN_OPT := $05
+RIA_OP_CLOCK := $0F
+RIA_OP_CLOCK_GETRES := $10
+RIA_OP_CLOCK_GETTIME := $11
+RIA_OP_CLOCK_SETTIME := $12
+RIA_OP_CLOCK_GETTIMEZONE := $13
+RIA_OP_OPEN := $14
+RIA_OP_CLOSE := $15
+RIA_OP_READ_XSTACK := $16
+RIA_OP_READ_XRAM := $17
+RIA_OP_WRITE_XSTACK := $18
+RIA_OP_WRITE_XRAM := $19
+RIA_OP_LSEEK := $1A
+RIA_OP_UNLINK := $1B
+RIA_OP_RENAME := $1C
+
+; 6522 VIA
+VIA := $FFD0 ; VIA base address
+VIA_PB := VIA+$0 ; Port register B
+VIA_PA1 := VIA+$1 ; Port register A
+VIA_PRB := VIA+$0 ; *** Deprecated ***
+VIA_PRA := VIA+$1 ; *** Deprecated ***
+VIA_DDRB := VIA+$2 ; Data direction register B
+VIA_DDRA := VIA+$3 ; Data direction register A
+VIA_T1CL := VIA+$4 ; Timer 1, low byte
+VIA_T1CH := VIA+$5 ; Timer 1, high byte
+VIA_T1LL := VIA+$6 ; Timer 1 latch, low byte
+VIA_T1LH := VIA+$7 ; Timer 1 latch, high byte
+VIA_T2CL := VIA+$8 ; Timer 2, low byte
+VIA_T2CH := VIA+$9 ; Timer 2, high byte
+VIA_SR := VIA+$A ; Shift register
+VIA_CR := VIA+$B ; Auxiliary control register
+VIA_PCR := VIA+$C ; Peripheral control register
+VIA_IFR := VIA+$D ; Interrupt flag register
+VIA_IER := VIA+$E ; Interrupt enable register
+VIA_PA2 := VIA+$F ; Port register A w/o handshake
+
+; Values in ___oserror are the union of these FatFs errors and errno.inc
+.enum
+ FR_OK = 32 ; Succeeded
+ FR_DISK_ERR ; A hard error occurred in the low level disk I/O layer
+ FR_INT_ERR ; Assertion failed
+ FR_NOT_READY ; The physical drive cannot work
+ FR_NO_FILE ; Could not find the file
+ FR_NO_PATH ; Could not find the path
+ FR_INVALID_NAME ; The path name format is invalid
+ FR_DENIED ; Access denied due to prohibited access or directory full
+ FR_EXIST ; Access denied due to prohibited access
+ FR_INVALID_OBJECT ; The file/directory object is invalid
+ FR_WRITE_PROTECTED ; The physical drive is write protected
+ FR_INVALID_DRIVE ; The logical drive number is invalid
+ FR_NOT_ENABLED ; The volume has no work area
+ FR_NO_FILESYSTEM ; There is no valid FAT volume
+ FR_MKFS_ABORTED ; The f_mkfs() aborted due to any problem
+ FR_TIMEOUT ; Could not get a grant to access the volume within defined period
+ FR_LOCKED ; The operation is rejected according to the file sharing policy
+ FR_NOT_ENOUGH_CORE ; LFN working buffer could not be allocated
+ FR_TOO_MANY_OPEN_FILES ; Number of open files > FF_FS_LOCK
+ FR_INVALID_PARAMETER ; Given parameter is invalid
+.endenum
diff --git a/asminc/sim65.inc b/asminc/sim65.inc
new file mode 100644
index 000000000..b8ea264b7
--- /dev/null
+++ b/asminc/sim65.inc
@@ -0,0 +1,75 @@
+
+; *******************************************************************************
+; ** **
+; ** sim65.inc : assembler definitions for the sim6502 and sim65c02 targets. **
+; ** **
+; ** Sidney Cadot, January 2025 **
+; ** **
+; *******************************************************************************
+
+ ; The '_peripherals' symbol is defined in the linker configuration
+ ; file to correspond to the first address in the periperal memory
+ ; aparture.
+ ;
+ ; We use it here as a base address for all peripheral addresses.
+
+ .import _peripherals
+
+; **************************************************************
+; ** **
+; ** Define assembler symbols for the "counter" peripheral. **
+; ** **
+; **************************************************************
+
+peripheral_counter_base := _peripherals + 0
+
+peripheral_counter_latch := peripheral_counter_base + 0
+peripheral_counter_select := peripheral_counter_base + 1
+peripheral_counter_value := peripheral_counter_base + 2
+
+; Values for the peripheral_counter_select register.
+
+COUNTER_SELECT_CLOCKCYCLE_COUNTER = $00
+COUNTER_SELECT_INSTRUCTION_COUNTER = $01
+COUNTER_SELECT_IRQ_COUNTER = $02
+COUNTER_SELECT_NMI_COUNTER = $03
+COUNTER_SELECT_WALLCLOCK_TIME = $80
+COUNTER_SELECT_WALLCLOCK_TIME_SPLIT = $81
+
+; ********************************************************************
+; ** **
+; ** Define assembler symbols for the "sim65 control" peripheral. **
+; ** **
+; ********************************************************************
+
+peripheral_sim65_base := _peripherals + 10
+
+peripheral_sim65_cpu_mode := peripheral_sim65_base + 0
+peripheral_sim65_trace_mode := peripheral_sim65_base + 1
+
+; Values for the peripheral_sim65_cpu_mode register.
+
+SIM65_CPU_MODE_6502 = $00
+SIM65_CPU_MODE_65C02 = $01
+SIM65_CPU_MODE_6502X = $02
+
+; Bitfield values for the peripheral_sim65_trace_mode field.
+
+SIM65_TRACE_MODE_FIELD_INSTR_COUNTER = $40
+SIM65_TRACE_MODE_FIELD_CLOCK_COUNTER = $20
+SIM65_TRACE_MODE_FIELD_PC = $10
+SIM65_TRACE_MODE_FIELD_INSTR_BYTES = $08
+SIM65_TRACE_MODE_FIELD_INSTR_ASSEMBLY = $04
+SIM65_TRACE_MODE_FIELD_CPU_REGISTERS = $02
+SIM65_TRACE_MODE_FIELD_CC65_SP = $01
+
+; Values for the peripheral_sim65_trace_mode field that fully disable / enable tracing.
+
+SIM65_TRACE_MODE_DISABLE = $00
+SIM65_TRACE_MODE_ENABLE_FULL = $7F
+
+; ************************
+; ** **
+; ** End of sim65.inc **
+; ** **
+; ************************
diff --git a/asminc/stat.inc b/asminc/stat.inc
new file mode 100644
index 000000000..e5248f06d
--- /dev/null
+++ b/asminc/stat.inc
@@ -0,0 +1,64 @@
+;****************************************************************************
+;* *
+;* stat.inc *
+;* *
+;* Stat struct *
+;* *
+;* *
+;* *
+;*(C) 2023 Colin Leroy-Mira *
+;* *
+;* *
+;*This software is provided 'as-is', without any expressed or implied *
+;*warranty. In no event will the authors be held liable for any damages *
+;*arising from the use of this software. *
+;* *
+;*Permission is granted to anyone to use this software for any purpose, *
+;*including commercial applications, and to alter it and redistribute it *
+;*freely, subject to the following restrictions: *
+;* *
+;*1. The origin of this software must not be misrepresented; you must not *
+;* claim that you wrote the original software. If you use this software *
+;* in a product, an acknowledgment in the product documentation would be *
+;* appreciated but is not required. *
+;*2. Altered source versions must be plainly marked as such, and must not *
+;* be misrepresented as being the original software. *
+;*3. This notice may not be removed or altered from any source *
+;* distribution. *
+;* *
+;****************************************************************************
+
+ .include "time.inc"
+
+;------------------------------------------------------------------------------
+; st_mode values
+
+S_IFDIR = $01
+S_IFREG = $02
+
+;------------------------------------------------------------------------------
+; struct stat
+
+.struct stat
+ st_dev .dword
+ st_ino .dword
+ st_mode .byte
+ st_nlink .dword
+ st_uid .byte
+ st_gid .byte
+ st_size .dword
+ st_atim .tag timespec
+ st_ctim .tag timespec
+ st_mtim .tag timespec
+ .ifdef __APPLE2__
+ st_access .byte
+ st_type .byte
+ st_auxtype .word
+ st_storagetype .byte
+ st_blocks .word
+ st_mod_date .word
+ st_mod_time .word
+ st_create_date .word
+ st_create_time .word
+ .endif
+.endstruct
diff --git a/asminc/statvfs.inc b/asminc/statvfs.inc
new file mode 100644
index 000000000..8674b045d
--- /dev/null
+++ b/asminc/statvfs.inc
@@ -0,0 +1,46 @@
+;****************************************************************************
+;* *
+;* statvfs.inc *
+;* *
+;* Statvfs struct *
+;* *
+;* *
+;* *
+;*(C) 2023 Colin Leroy-Mira *
+;* *
+;* *
+;*This software is provided 'as-is', without any expressed or implied *
+;*warranty. In no event will the authors be held liable for any damages *
+;*arising from the use of this software. *
+;* *
+;*Permission is granted to anyone to use this software for any purpose, *
+;*including commercial applications, and to alter it and redistribute it *
+;*freely, subject to the following restrictions: *
+;* *
+;*1. The origin of this software must not be misrepresented; you must not *
+;* claim that you wrote the original software. If you use this software *
+;* in a product, an acknowledgment in the product documentation would be *
+;* appreciated but is not required. *
+;*2. Altered source versions must be plainly marked as such, and must not *
+;* be misrepresented as being the original software. *
+;*3. This notice may not be removed or altered from any source *
+;* distribution. *
+;* *
+;****************************************************************************
+
+;------------------------------------------------------------------------------
+; struct statvfs
+
+.struct statvfs
+ f_bsize .dword
+ f_frsize .dword
+ f_blocks .dword
+ f_bfree .dword
+ f_bavail .dword
+ f_files .dword
+ f_ffree .dword
+ f_favail .dword
+ f_fsid .dword
+ f_flag .dword
+ f_namemax .dword
+.endstruct
diff --git a/asminc/telestrat.inc b/asminc/telestrat.inc
index c57bd3de8..bbfabdf40 100644
--- a/asminc/telestrat.inc
+++ b/asminc/telestrat.inc
@@ -257,8 +257,11 @@ XBINDX = $28 ; Convert a number into hex and displays on chan
XDECIM = $29
XHEXA = $2A ; Convert a number into hex
+XMAINARGS = $2C ; Only available for Orix
+
XEDT = $2D ; Launch editor
XINSER = $2E
+XGETARGV = $2E ; Only available for Orix
XSCELG = $2F ; Search a line in editor mode
XOPEN = $30 ; Only in Orix
diff --git a/asminc/time.inc b/asminc/time.inc
index 6064b4ba3..7c1ab3177 100644
--- a/asminc/time.inc
+++ b/asminc/time.inc
@@ -66,3 +66,9 @@
.global _clock_settime
.global _localtime
.global _mktime
+
+
+;------------------------------------------------------------------------------
+; Constants
+
+CLOCK_REALTIME = 0
diff --git a/cfg/apple2-hgr.cfg b/cfg/apple2-hgr.cfg
index cfe577e00..402e53b34 100644
--- a/cfg/apple2-hgr.cfg
+++ b/cfg/apple2-hgr.cfg
@@ -17,6 +17,7 @@ MEMORY {
MAIN: file = %O, define = yes, start = %S, size = __HIMEM__ - %S;
BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__;
LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__;
+ LOW: file = "", define = yes, start = $0800, size = %S - $0800;
}
SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
@@ -27,10 +28,11 @@ SEGMENTS {
CODE: load = MAIN, type = ro start = $4000;
RODATA: load = MAIN, type = ro;
DATA: load = MAIN, type = rw;
- INIT: load = MAIN, type = rw;
+ INIT: load = MAIN, type = rw; # uninitialized, but reserves output space
ONCE: load = MAIN, type = ro, define = yes;
LC: load = MAIN, run = LC, type = ro, optional = yes;
BSS: load = BSS, type = bss, define = yes;
+ LOWBSS: load = LOW, type = bss, optional = yes;
}
FEATURES {
CONDES: type = constructor,
diff --git a/cfg/apple2-overlay.cfg b/cfg/apple2-overlay.cfg
index a0b7678c1..512b19c16 100644
--- a/cfg/apple2-overlay.cfg
+++ b/cfg/apple2-overlay.cfg
@@ -25,6 +25,7 @@ MEMORY {
MAIN: file = %O, define = yes, start = %S + __OVERLAYSIZE__, size = __HIMEM__ - __OVERLAYSIZE__ - %S;
BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__;
LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__;
+ LOW: file = "", define = yes, start = $0800, size = %S - $0800;
OVL1: file = "%O.1", start = %S, size = __OVERLAYSIZE__;
OVL2: file = "%O.2", start = %S, size = __OVERLAYSIZE__;
OVL3: file = "%O.3", start = %S, size = __OVERLAYSIZE__;
@@ -43,10 +44,11 @@ SEGMENTS {
CODE: load = MAIN, type = ro;
RODATA: load = MAIN, type = ro;
DATA: load = MAIN, type = rw;
- INIT: load = MAIN, type = rw;
+ INIT: load = MAIN, type = rw; # uninitialized, but reserves output space
ONCE: load = MAIN, type = ro, define = yes;
LC: load = MAIN, run = LC, type = ro, optional = yes;
BSS: load = BSS, type = bss, define = yes;
+ LOWBSS: load = LOW, type = bss, optional = yes;
OVERLAY1: load = OVL1, type = ro, define = yes, optional = yes;
OVERLAY2: load = OVL2, type = ro, define = yes, optional = yes;
OVERLAY3: load = OVL3, type = ro, define = yes, optional = yes;
diff --git a/cfg/apple2-system.cfg b/cfg/apple2-system.cfg
index 0170feb93..8720ae800 100644
--- a/cfg/apple2-system.cfg
+++ b/cfg/apple2-system.cfg
@@ -13,6 +13,7 @@ MEMORY {
MAIN: file = %O, define = yes, start = $2000, size = $BF00 - $2000;
BSS: file = "", start = __ONCE_RUN__, size = $BF00 - __STACKSIZE__ - __ONCE_RUN__;
LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__;
+ LOW: file = "", define = yes, start = $0800, size = $2000 - $0800;
}
SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
@@ -22,10 +23,11 @@ SEGMENTS {
CODE: load = MAIN, type = ro;
RODATA: load = MAIN, type = ro;
DATA: load = MAIN, type = rw;
- INIT: load = MAIN, type = rw;
+ INIT: load = MAIN, type = rw; # uninitialized, but reserves output space
ONCE: load = MAIN, type = ro, define = yes;
LC: load = MAIN, run = LC, type = ro, optional = yes;
BSS: load = BSS, type = bss, define = yes;
+ LOWBSS: load = LOW, type = bss, optional = yes;
}
FEATURES {
CONDES: type = constructor,
diff --git a/cfg/apple2.cfg b/cfg/apple2.cfg
index a6809cf89..c33bdee2d 100644
--- a/cfg/apple2.cfg
+++ b/cfg/apple2.cfg
@@ -17,6 +17,7 @@ MEMORY {
MAIN: file = %O, define = yes, start = %S, size = __HIMEM__ - %S;
BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__;
LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__;
+ LOW: file = "", define = yes, start = $0800, size = %S - $0800;
}
SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
@@ -26,10 +27,11 @@ SEGMENTS {
CODE: load = MAIN, type = ro;
RODATA: load = MAIN, type = ro;
DATA: load = MAIN, type = rw;
- INIT: load = MAIN, type = rw;
+ INIT: load = MAIN, type = rw; # uninitialized, but reserves output space
ONCE: load = MAIN, type = ro, define = yes;
LC: load = MAIN, run = LC, type = ro, optional = yes;
BSS: load = BSS, type = bss, define = yes;
+ LOWBSS: load = LOW, type = bss, optional = yes;
}
FEATURES {
CONDES: type = constructor,
diff --git a/cfg/apple2enh-hgr.cfg b/cfg/apple2enh-hgr.cfg
index cfe577e00..402e53b34 100644
--- a/cfg/apple2enh-hgr.cfg
+++ b/cfg/apple2enh-hgr.cfg
@@ -17,6 +17,7 @@ MEMORY {
MAIN: file = %O, define = yes, start = %S, size = __HIMEM__ - %S;
BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__;
LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__;
+ LOW: file = "", define = yes, start = $0800, size = %S - $0800;
}
SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
@@ -27,10 +28,11 @@ SEGMENTS {
CODE: load = MAIN, type = ro start = $4000;
RODATA: load = MAIN, type = ro;
DATA: load = MAIN, type = rw;
- INIT: load = MAIN, type = rw;
+ INIT: load = MAIN, type = rw; # uninitialized, but reserves output space
ONCE: load = MAIN, type = ro, define = yes;
LC: load = MAIN, run = LC, type = ro, optional = yes;
BSS: load = BSS, type = bss, define = yes;
+ LOWBSS: load = LOW, type = bss, optional = yes;
}
FEATURES {
CONDES: type = constructor,
diff --git a/cfg/apple2enh-overlay.cfg b/cfg/apple2enh-overlay.cfg
index a0b7678c1..512b19c16 100644
--- a/cfg/apple2enh-overlay.cfg
+++ b/cfg/apple2enh-overlay.cfg
@@ -25,6 +25,7 @@ MEMORY {
MAIN: file = %O, define = yes, start = %S + __OVERLAYSIZE__, size = __HIMEM__ - __OVERLAYSIZE__ - %S;
BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__;
LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__;
+ LOW: file = "", define = yes, start = $0800, size = %S - $0800;
OVL1: file = "%O.1", start = %S, size = __OVERLAYSIZE__;
OVL2: file = "%O.2", start = %S, size = __OVERLAYSIZE__;
OVL3: file = "%O.3", start = %S, size = __OVERLAYSIZE__;
@@ -43,10 +44,11 @@ SEGMENTS {
CODE: load = MAIN, type = ro;
RODATA: load = MAIN, type = ro;
DATA: load = MAIN, type = rw;
- INIT: load = MAIN, type = rw;
+ INIT: load = MAIN, type = rw; # uninitialized, but reserves output space
ONCE: load = MAIN, type = ro, define = yes;
LC: load = MAIN, run = LC, type = ro, optional = yes;
BSS: load = BSS, type = bss, define = yes;
+ LOWBSS: load = LOW, type = bss, optional = yes;
OVERLAY1: load = OVL1, type = ro, define = yes, optional = yes;
OVERLAY2: load = OVL2, type = ro, define = yes, optional = yes;
OVERLAY3: load = OVL3, type = ro, define = yes, optional = yes;
diff --git a/cfg/apple2enh-system.cfg b/cfg/apple2enh-system.cfg
index 0170feb93..8720ae800 100644
--- a/cfg/apple2enh-system.cfg
+++ b/cfg/apple2enh-system.cfg
@@ -13,6 +13,7 @@ MEMORY {
MAIN: file = %O, define = yes, start = $2000, size = $BF00 - $2000;
BSS: file = "", start = __ONCE_RUN__, size = $BF00 - __STACKSIZE__ - __ONCE_RUN__;
LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__;
+ LOW: file = "", define = yes, start = $0800, size = $2000 - $0800;
}
SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
@@ -22,10 +23,11 @@ SEGMENTS {
CODE: load = MAIN, type = ro;
RODATA: load = MAIN, type = ro;
DATA: load = MAIN, type = rw;
- INIT: load = MAIN, type = rw;
+ INIT: load = MAIN, type = rw; # uninitialized, but reserves output space
ONCE: load = MAIN, type = ro, define = yes;
LC: load = MAIN, run = LC, type = ro, optional = yes;
BSS: load = BSS, type = bss, define = yes;
+ LOWBSS: load = LOW, type = bss, optional = yes;
}
FEATURES {
CONDES: type = constructor,
diff --git a/cfg/apple2enh.cfg b/cfg/apple2enh.cfg
index a6809cf89..c33bdee2d 100644
--- a/cfg/apple2enh.cfg
+++ b/cfg/apple2enh.cfg
@@ -17,6 +17,7 @@ MEMORY {
MAIN: file = %O, define = yes, start = %S, size = __HIMEM__ - %S;
BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__;
LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__;
+ LOW: file = "", define = yes, start = $0800, size = %S - $0800;
}
SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
@@ -26,10 +27,11 @@ SEGMENTS {
CODE: load = MAIN, type = ro;
RODATA: load = MAIN, type = ro;
DATA: load = MAIN, type = rw;
- INIT: load = MAIN, type = rw;
+ INIT: load = MAIN, type = rw; # uninitialized, but reserves output space
ONCE: load = MAIN, type = ro, define = yes;
LC: load = MAIN, run = LC, type = ro, optional = yes;
BSS: load = BSS, type = bss, define = yes;
+ LOWBSS: load = LOW, type = bss, optional = yes;
}
FEATURES {
CONDES: type = constructor,
diff --git a/cfg/atari-asm-xex.cfg b/cfg/atari-asm-xex.cfg
index f0a6291db..fddf95dd4 100644
--- a/cfg/atari-asm-xex.cfg
+++ b/cfg/atari-asm-xex.cfg
@@ -20,5 +20,6 @@ SEGMENTS {
CODE: load = MAIN, type = rw, define = yes;
RODATA: load = MAIN, type = ro optional = yes;
DATA: load = MAIN, type = rw optional = yes;
+ INIT: load = MAIN, type = bss, optional = yes, define = yes;
BSS: load = MAIN, type = bss, optional = yes, define = yes;
}
diff --git a/cfg/atari-asm.cfg b/cfg/atari-asm.cfg
index 6fc1c2caa..f824eb264 100644
--- a/cfg/atari-asm.cfg
+++ b/cfg/atari-asm.cfg
@@ -25,6 +25,7 @@ SEGMENTS {
CODE: load = MAIN, type = rw, define = yes;
RODATA: load = MAIN, type = ro optional = yes;
DATA: load = MAIN, type = rw optional = yes;
+ INIT: load = MAIN, type = bss, optional = yes, define = yes;
BSS: load = MAIN, type = bss, optional = yes, define = yes;
AUTOSTRT: load = TRAILER, type = ro, optional = yes;
}
diff --git a/cfg/atari-cassette.cfg b/cfg/atari-cassette.cfg
index 13b34cc73..1d7d02f93 100644
--- a/cfg/atari-cassette.cfg
+++ b/cfg/atari-cassette.cfg
@@ -22,8 +22,8 @@ SEGMENTS {
CODE: load = MAIN, type = ro, define = yes;
RODATA: load = MAIN, type = ro, optional = yes;
DATA: load = MAIN, type = rw, optional = yes;
+ INIT: load = MAIN, type = bss, define = yes, optional = yes;
BSS: load = MAIN, type = bss, define = yes, optional = yes;
- INIT: load = MAIN, type = bss, optional = yes;
}
FEATURES {
CONDES: type = constructor,
diff --git a/cfg/atari-overlay.cfg b/cfg/atari-overlay.cfg
index 9311a1b22..1dde26331 100644
--- a/cfg/atari-overlay.cfg
+++ b/cfg/atari-overlay.cfg
@@ -52,7 +52,7 @@ SEGMENTS {
CODE: load = MAIN, type = ro, define = yes;
RODATA: load = MAIN, type = ro;
DATA: load = MAIN, type = rw;
- INIT: load = MAIN, type = rw, optional = yes;
+ INIT: load = MAIN, type = bss, define = yes, optional = yes;
BSS: load = MAIN, type = bss, define = yes;
AUTOSTRT: load = TRAILER, type = ro;
OVERLAY1: load = OVL1, type = ro, define = yes, optional = yes;
diff --git a/cfg/atari-xex.cfg b/cfg/atari-xex.cfg
index cabde3708..1ab60af2e 100644
--- a/cfg/atari-xex.cfg
+++ b/cfg/atari-xex.cfg
@@ -36,7 +36,7 @@ SEGMENTS {
CODE: load = MAIN, type = ro, define = yes;
RODATA: load = MAIN, type = ro;
DATA: load = MAIN, type = rw;
- INIT: load = MAIN, type = rw, optional = yes;
+ INIT: load = MAIN, type = bss, define = yes, optional = yes;
BSS: load = MAIN, type = bss, define = yes;
}
FEATURES {
diff --git a/cfg/atari.cfg b/cfg/atari.cfg
index 106c75e63..0af121de3 100644
--- a/cfg/atari.cfg
+++ b/cfg/atari.cfg
@@ -40,7 +40,7 @@ SEGMENTS {
CODE: load = MAIN, type = ro, define = yes;
RODATA: load = MAIN, type = ro;
DATA: load = MAIN, type = rw;
- INIT: load = MAIN, type = rw, optional = yes;
+ INIT: load = MAIN, type = bss, define = yes, optional = yes;
BSS: load = MAIN, type = bss, define = yes;
AUTOSTRT: load = TRAILER, type = ro;
}
diff --git a/cfg/atari5200.cfg b/cfg/atari5200.cfg
index e8f6d44a5..a487bdcab 100644
--- a/cfg/atari5200.cfg
+++ b/cfg/atari5200.cfg
@@ -15,7 +15,7 @@ MEMORY {
SEGMENTS {
ZEROPAGE: load = ZP, type = zp, optional = yes;
EXTZP: load = ZP, type = zp, optional = yes;
- DLIST: load = ROM , type = ro, define = yes, optional = yes;
+ DLIST: load = ROM, type = ro, define = yes, optional = yes;
STARTUP: load = ROM, type = ro, define = yes, optional = yes;
LOWCODE: load = ROM, type = ro, define = yes, optional = yes;
ONCE: load = ROM, type = ro, optional = yes;
diff --git a/cfg/atarixl-largehimem.cfg b/cfg/atarixl-largehimem.cfg
index 38fb68db9..6df9b3f80 100644
--- a/cfg/atarixl-largehimem.cfg
+++ b/cfg/atarixl-largehimem.cfg
@@ -67,7 +67,7 @@ SEGMENTS {
CODE: load = MAIN, type = ro, define = yes;
RODATA: load = MAIN, type = ro;
DATA: load = MAIN, type = rw;
- INIT: load = MAIN, type = rw, optional = yes;
+ INIT: load = MAIN, type = bss, define = yes, optional = yes;
BSS: load = MAIN, type = bss, define = yes;
AUTOSTRT: load = TRAILER, type = ro;
}
diff --git a/cfg/atarixl-overlay.cfg b/cfg/atarixl-overlay.cfg
index 339228ea0..5cfdcdbc5 100644
--- a/cfg/atarixl-overlay.cfg
+++ b/cfg/atarixl-overlay.cfg
@@ -78,7 +78,7 @@ SEGMENTS {
CODE: load = MAIN, type = ro, define = yes;
RODATA: load = MAIN, type = ro;
DATA: load = MAIN, type = rw;
- INIT: load = MAIN, type = rw, optional = yes;
+ INIT: load = MAIN, type = bss, define = yes, optional = yes;
BSS: load = MAIN, type = bss, define = yes;
AUTOSTRT: load = TRAILER, type = ro;
diff --git a/cfg/atarixl-xex.cfg b/cfg/atarixl-xex.cfg
index 1b76855d0..a0a4a971d 100644
--- a/cfg/atarixl-xex.cfg
+++ b/cfg/atarixl-xex.cfg
@@ -58,7 +58,7 @@ SEGMENTS {
CODE: load = MAIN, type = ro, define = yes;
RODATA: load = MAIN, type = ro;
DATA: load = MAIN, type = rw;
- INIT: load = MAIN, type = rw, optional = yes;
+ INIT: load = MAIN, type = bss, define = yes, optional = yes;
BSS: load = MAIN, type = bss, define = yes;
SRPREPHDR: load = UNUSED, type = ro;
SRPREPTRL: load = UNUSED, type = ro;
diff --git a/cfg/atarixl.cfg b/cfg/atarixl.cfg
index cece23555..5e7199cd3 100644
--- a/cfg/atarixl.cfg
+++ b/cfg/atarixl.cfg
@@ -65,7 +65,7 @@ SEGMENTS {
CODE: load = MAIN, type = ro, define = yes;
RODATA: load = MAIN, type = ro;
DATA: load = MAIN, type = rw;
- INIT: load = MAIN, type = rw, optional = yes;
+ INIT: load = MAIN, type = bss, define = yes, optional = yes;
BSS: load = MAIN, type = bss, define = yes;
AUTOSTRT: load = TRAILER, type = ro;
}
diff --git a/cfg/atmos.cfg b/cfg/atmos.cfg
index 35f184f4f..4c370903a 100644
--- a/cfg/atmos.cfg
+++ b/cfg/atmos.cfg
@@ -23,7 +23,7 @@ SEGMENTS {
CODE: load = MAIN, type = ro;
RODATA: load = MAIN, type = ro;
DATA: load = MAIN, type = rw;
- INIT: load = MAIN, type = rw;
+ INIT: load = MAIN, type = rw; # uninitialized, but reserves output space
ONCE: load = MAIN, type = ro, define = yes;
BASTAIL: load = MAIN, type = ro, optional = yes;
BSS: load = BSS, type = bss, define = yes;
diff --git a/cfg/c16-asm.cfg b/cfg/c16-asm.cfg
new file mode 100644
index 000000000..8cb839304
--- /dev/null
+++ b/cfg/c16-asm.cfg
@@ -0,0 +1,20 @@
+FEATURES {
+ STARTADDRESS: default = $1001;
+}
+SYMBOLS {
+ __LOADADDR__: type = import;
+}
+MEMORY {
+ ZP: file = "", start = $0002, size = $001A;
+ LOADADDR: file = %O, start = %S - 2, size = $0002;
+ MAIN: file = %O, start = %S, size = $3000 - %S;
+}
+SEGMENTS {
+ ZEROPAGE: load = ZP, type = zp, optional = yes;
+ LOADADDR: load = LOADADDR, type = ro;
+ EXEHDR: load = MAIN, type = ro, optional = yes;
+ CODE: load = MAIN, type = ro;
+ RODATA: load = MAIN, type = ro, optional = yes;
+ DATA: load = MAIN, type = rw, optional = yes;
+ BSS: load = MAIN, type = bss, define = yes;
+}
diff --git a/cfg/c64-overlay.cfg b/cfg/c64-overlay.cfg
index 0f42434ad..ae760b30c 100644
--- a/cfg/c64-overlay.cfg
+++ b/cfg/c64-overlay.cfg
@@ -44,7 +44,7 @@ SEGMENTS {
CODE: load = MAIN, type = ro;
RODATA: load = MAIN, type = ro;
DATA: load = MAIN, type = rw;
- INIT: load = MAIN, type = rw;
+ INIT: load = MAIN, type = rw; # uninitialized, but reserves output space
ONCE: load = MAIN, type = ro, define = yes;
BSS: load = BSS, type = bss, define = yes;
OVL1ADDR: load = OVL1ADDR, type = ro;
diff --git a/cfg/c64.cfg b/cfg/c64.cfg
index 5bd8d8240..59cadd46b 100644
--- a/cfg/c64.cfg
+++ b/cfg/c64.cfg
@@ -23,7 +23,7 @@ SEGMENTS {
CODE: load = MAIN, type = ro;
RODATA: load = MAIN, type = ro;
DATA: load = MAIN, type = rw;
- INIT: load = MAIN, type = rw;
+ INIT: load = MAIN, type = rw; # uninitialized, but reserves output space
ONCE: load = MAIN, type = ro, define = yes;
BSS: load = BSS, type = bss, define = yes;
}
diff --git a/cfg/creativision.cfg b/cfg/creativision.cfg
index 2eb9ac427..f3b7ac0f4 100644
--- a/cfg/creativision.cfg
+++ b/cfg/creativision.cfg
@@ -11,10 +11,10 @@ SEGMENTS {
ZP: load = ZP, type = zp, optional = yes;
VECTORS: load = ROM, run = RAM, type = rw, define = yes;
DATA: load = ROM, run = RAM, type = rw, define = yes, start = $0204;
+ INIT: load = RAM, type = bss, optional = yes;
BSS: load = RAM, type = bss, define = yes;
ONCE: load = ROM, type = ro, optional = yes;
CODE: load = ROM, type = ro;
- INIT: load = ROM, type = ro;
RODATA: load = ROM, type = ro;
AUDIO: load = ROM, type = ro, optional = yes, start = $BF00;
SETUP: load = ROM, type = ro, start = $BFE8;
diff --git a/cfg/cx16-bank.cfg b/cfg/cx16-bank.cfg
index d3c2c02ae..264b6fcba 100644
--- a/cfg/cx16-bank.cfg
+++ b/cfg/cx16-bank.cfg
@@ -57,7 +57,7 @@ SEGMENTS {
CODE: load = MAIN, type = ro;
RODATA: load = MAIN, type = ro;
DATA: load = MAIN, type = rw;
- INIT: load = MAIN, type = rw, optional = yes;
+ INIT: load = MAIN, type = rw, optional = yes; # uninitialized, but reserves output space
ONCE: load = MAIN, type = ro, define = yes;
BSS: load = BSS, type = bss, define = yes;
BRAM01ADDR: load = BRAM01ADDR, type = ro, optional = yes;
diff --git a/cfg/cx16.cfg b/cfg/cx16.cfg
index 4b6025fb6..a160a6718 100644
--- a/cfg/cx16.cfg
+++ b/cfg/cx16.cfg
@@ -24,7 +24,7 @@ SEGMENTS {
CODE: load = MAIN, type = ro;
RODATA: load = MAIN, type = ro;
DATA: load = MAIN, type = rw;
- INIT: load = MAIN, type = rw, optional = yes;
+ INIT: load = MAIN, type = rw, optional = yes; # uninitialized, but reserves output space
ONCE: load = MAIN, type = ro, define = yes;
BSS: load = BSS, type = bss, define = yes;
}
diff --git a/cfg/kim1-mtu60k.cfg b/cfg/kim1-mtu60k.cfg
new file mode 100644
index 000000000..4f24a4bf4
--- /dev/null
+++ b/cfg/kim1-mtu60k.cfg
@@ -0,0 +1,41 @@
+# kim1-mtu60k.cfg (4k)
+#
+# for expanded KIM-1 w/ K-1008 Graphics and 60K RAM
+#
+# ld65 --config kim1-mtu60k.cfg -o .bin .o
+
+FEATURES {
+ STARTADDRESS: default = $2000;
+ CONDES: segment = STARTUP,
+ type = constructor,
+ label = __CONSTRUCTOR_TABLE__,
+ count = __CONSTRUCTOR_COUNT__;
+ CONDES: segment = STARTUP,
+ type = destructor,
+ label = __DESTRUCTOR_TABLE__,
+ count = __DESTRUCTOR_COUNT__;
+}
+
+SYMBOLS {
+ __STACKSIZE__: type = weak, value = $0080; # 128 byte program stack
+ __STARTADDRESS__: type = export, value = %S;
+}
+
+MEMORY {
+ ZP: file = %O, define = yes, start = $0000, size = $00EE;
+ CPUSTACK: file = "", define = yes, start = $0100, size = $0100;
+ RAM: file = %O, define = yes, start = %S, size = $E000 - %S - __STACKSIZE__;
+ MAINROM: file = "", define = yes, start = $E000, size = $1000;
+ TOP: file = "", define = yes, start = $F000, size = $1000;
+}
+
+SEGMENTS {
+ ZEROPAGE: load = ZP, type = zp, define = yes;
+ STARTUP: load = RAM, type = ro, define = yes;
+ CODE: load = RAM, type = ro, define = yes;
+ RODATA: load = RAM, type = ro, define = yes;
+ ONCE: load = RAM, type = ro, define = yes;
+ DATA: load = RAM, type = rw, define = yes;
+ BSS: load = RAM, type = bss, define = yes;
+}
+
diff --git a/cfg/kim1-mtuE000.cfg b/cfg/kim1-mtuE000.cfg
new file mode 100644
index 000000000..5f93cc13f
--- /dev/null
+++ b/cfg/kim1-mtuE000.cfg
@@ -0,0 +1,41 @@
+# kim1-mtu60k.cfg (4k)
+#
+# for expanded KIM-1 w/ K-1008 Graphics and 60K RAM
+#
+# ld65 --config kim1-mtu60k.cfg -o .bin .o
+
+FEATURES {
+ STARTADDRESS: default = $E000;
+ CONDES: segment = STARTUP,
+ type = constructor,
+ label = __CONSTRUCTOR_TABLE__,
+ count = __CONSTRUCTOR_COUNT__;
+ CONDES: segment = STARTUP,
+ type = destructor,
+ label = __DESTRUCTOR_TABLE__,
+ count = __DESTRUCTOR_COUNT__;
+}
+
+SYMBOLS {
+ __STACKSIZE__: type = weak, value = $0080; # 128 byte program stack
+ __STARTADDRESS__: type = export, value = %S;
+}
+
+MEMORY {
+ ZP: file = %O, define = yes, start = $0000, size = $00EE;
+ CPUSTACK: file = "", define = yes, start = $0100, size = $0100;
+ RAM: file = %O, define = yes, start = $2000, size = $E000 - $2000 - __STACKSIZE__;
+ MAINROM: file = "", define = yes, start = $E000, size = $1000;
+ TOP: file = "", define = yes, start = $F000, size = $1000;
+}
+
+SEGMENTS {
+ ZEROPAGE: load = ZP, type = zp, define = yes;
+ STARTUP: load = RAM, type = ro, define = yes;
+ CODE: load = RAM, type = ro, define = yes;
+ RODATA: load = RAM, type = ro, define = yes;
+ ONCE: load = RAM, type = ro, define = yes;
+ DATA: load = RAM, type = rw, define = yes;
+ BSS: load = RAM, type = bss, define = yes;
+}
+
diff --git a/cfg/lynx-uploader.cfg b/cfg/lynx-uploader.cfg
index 476b3c5de..62269de90 100644
--- a/cfg/lynx-uploader.cfg
+++ b/cfg/lynx-uploader.cfg
@@ -5,16 +5,17 @@ SYMBOLS {
__BANK1BLOCKSIZE__: type = weak, value = $0000; # bank 1 block size
__EXEHDR__: type = import;
__BOOTLDR__: type = import;
- __DEFDIR__: type = import;
__UPLOADER__: type = import;
+ __UPLOADERSIZE__: type = export, value = $61;
+ __HEADERSIZE__: type = export, value = 64;
}
MEMORY {
ZP: file = "", define = yes, start = $0000, size = $0100;
- HEADER: file = %O, start = $0000, size = $0040;
+ HEADER: file = %O, start = $0000, size = __HEADERSIZE__;
BOOT: file = %O, start = $0200, size = __STARTOFDIRECTORY__;
- DIR: file = %O, start = $0000, size = 8;
- MAIN: file = %O, define = yes, start = $0200, size = $BD38 - __STACKSIZE__;
- UPLDR: file = %O, define = yes, start = $BFDC, size = $005C;
+ DIR: file = %O, start = $0000, size = 16;
+ MAIN: file = %O, define = yes, start = $0200, size = $C038 - __UPLOADERSIZE__ - $200 - __STACKSIZE__;
+ UPLOAD: file = %O, define = yes, start = $C038 - __UPLOADERSIZE__, size = $0061;
}
SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
@@ -30,8 +31,8 @@ SEGMENTS {
RODATA: load = MAIN, type = ro, define = yes;
DATA: load = MAIN, type = rw, define = yes;
BSS: load = MAIN, type = bss, define = yes;
- UPCODE: load = UPLDR, type = ro, define = yes;
- UPDATA: load = UPLDR, type = rw, define = yes;
+ UPCODE: load = UPLOAD, type = ro, define = yes;
+ UPDATA: load = UPLOAD, type = rw, define = yes;
}
FEATURES {
CONDES: type = constructor,
diff --git a/cfg/plus4-asm.cfg b/cfg/plus4-asm.cfg
new file mode 100644
index 000000000..df47ba06e
--- /dev/null
+++ b/cfg/plus4-asm.cfg
@@ -0,0 +1,20 @@
+FEATURES {
+ STARTADDRESS: default = $1001;
+}
+SYMBOLS {
+ __LOADADDR__: type = import;
+}
+MEMORY {
+ ZP: file = "", start = $0002, size = $001A;
+ LOADADDR: file = %O, start = %S - 2, size = $0002;
+ MAIN: file = %O, start = %S, size = $FD00 - %S;
+}
+SEGMENTS {
+ ZEROPAGE: load = ZP, type = zp, optional = yes;
+ LOADADDR: load = LOADADDR, type = ro;
+ EXEHDR: load = MAIN, type = ro, optional = yes;
+ CODE: load = MAIN, type = ro;
+ RODATA: load = MAIN, type = ro, optional = yes;
+ DATA: load = MAIN, type = rw, optional = yes;
+ BSS: load = MAIN, type = bss, define = yes;
+}
diff --git a/cfg/rp6502.cfg b/cfg/rp6502.cfg
new file mode 100644
index 000000000..ed40e467d
--- /dev/null
+++ b/cfg/rp6502.cfg
@@ -0,0 +1,34 @@
+SYMBOLS {
+ __STARTUP__: type = import;
+ __STACKSIZE__: type = weak, value = $0800;
+}
+MEMORY {
+ ZP: file = "", define = yes, start = $0000, size = $0100;
+ CPUSTACK: file = "", start = $0100, size = $0100;
+ RAM: file = %O, define = yes, start = $0200, size = $FD00 - __STACKSIZE__;
+}
+SEGMENTS {
+ ZEROPAGE: load = ZP, type = zp;
+ STARTUP: load = RAM, type = ro;
+ LOWCODE: load = RAM, type = ro, optional = yes;
+ ONCE: load = RAM, type = ro, optional = yes;
+ CODE: load = RAM, type = ro;
+ RODATA: load = RAM, type = ro;
+ DATA: load = RAM, type = rw, define = yes;
+ BSS: load = RAM, type = bss, define = yes;
+}
+FEATURES {
+ CONDES: type = constructor,
+ label = __CONSTRUCTOR_TABLE__,
+ count = __CONSTRUCTOR_COUNT__,
+ segment = ONCE;
+ CONDES: type = destructor,
+ label = __DESTRUCTOR_TABLE__,
+ count = __DESTRUCTOR_COUNT__,
+ segment = RODATA;
+ CONDES: type = interruptor,
+ label = __INTERRUPTOR_TABLE__,
+ count = __INTERRUPTOR_COUNT__,
+ segment = RODATA,
+ import = __CALLIRQ__;
+}
diff --git a/cfg/sim6502.cfg b/cfg/sim6502.cfg
index 39c33581c..72098f750 100644
--- a/cfg/sim6502.cfg
+++ b/cfg/sim6502.cfg
@@ -1,12 +1,15 @@
SYMBOLS {
__EXEHDR__: type = import;
__STACKSIZE__: type = weak, value = $0800; # 2k stack
+ _peripherals: type = export, value = $FFC0;
}
+
MEMORY {
ZP: file = "", start = $0000, size = $0100;
HEADER: file = %O, start = $0000, size = $000C;
- MAIN: file = %O, define = yes, start = $0200, size = $FDF0 - __STACKSIZE__;
+ MAIN: file = %O, define = yes, start = $0200, size = $FFC0 - $0200 - __STACKSIZE__;
}
+
SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
EXEHDR: load = HEADER, type = ro;
@@ -18,6 +21,7 @@ SEGMENTS {
DATA: load = MAIN, type = rw;
BSS: load = MAIN, type = bss, define = yes;
}
+
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
diff --git a/cfg/sim65c02.cfg b/cfg/sim65c02.cfg
index 39c33581c..72098f750 100644
--- a/cfg/sim65c02.cfg
+++ b/cfg/sim65c02.cfg
@@ -1,12 +1,15 @@
SYMBOLS {
__EXEHDR__: type = import;
__STACKSIZE__: type = weak, value = $0800; # 2k stack
+ _peripherals: type = export, value = $FFC0;
}
+
MEMORY {
ZP: file = "", start = $0000, size = $0100;
HEADER: file = %O, start = $0000, size = $000C;
- MAIN: file = %O, define = yes, start = $0200, size = $FDF0 - __STACKSIZE__;
+ MAIN: file = %O, define = yes, start = $0200, size = $FFC0 - $0200 - __STACKSIZE__;
}
+
SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
EXEHDR: load = HEADER, type = ro;
@@ -18,6 +21,7 @@ SEGMENTS {
DATA: load = MAIN, type = rw;
BSS: load = MAIN, type = bss, define = yes;
}
+
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
diff --git a/cfg/telestrat.cfg b/cfg/telestrat.cfg
index bd720fb8d..52b982eef 100644
--- a/cfg/telestrat.cfg
+++ b/cfg/telestrat.cfg
@@ -22,7 +22,7 @@ SEGMENTS {
CODE: load = MAIN, type = ro;
RODATA: load = MAIN, type = ro;
DATA: load = MAIN, type = rw;
- INIT: load = MAIN, type = rw;
+ INIT: load = MAIN, type = rw; # uninitialized, but reserves output space
ONCE: load = MAIN, type = ro, define = yes;
BASTAIL: load = MAIN, type = ro, optional = yes;
BSS: load = BSS, type = bss, define = yes;
diff --git a/cfg/vic20-asm-32k.cfg b/cfg/vic20-asm-32k.cfg
new file mode 100644
index 000000000..3d0341e71
--- /dev/null
+++ b/cfg/vic20-asm-32k.cfg
@@ -0,0 +1,22 @@
+# Assembly program configuration for expanded VICs (>= +8K).
+
+FEATURES {
+ STARTADDRESS: default = $1201;
+}
+SYMBOLS {
+ __LOADADDR__: type = import;
+}
+MEMORY {
+ ZP: file = "", start = $0002, size = $001A, define = yes;
+ LOADADDR: file = %O, start = %S - 2, size = $0002;
+ MAIN: file = %O, start = %S, size = $8000 - %S;
+}
+SEGMENTS {
+ ZEROPAGE: load = ZP, type = zp, optional = yes;
+ LOADADDR: load = LOADADDR, type = ro;
+ EXEHDR: load = MAIN, type = ro, optional = yes;
+ CODE: load = MAIN, type = ro;
+ RODATA: load = MAIN, type = ro;
+ DATA: load = MAIN, type = rw;
+ BSS: load = MAIN, type = bss, optional = yes, define = yes;
+}
diff --git a/cfg/vic20-asm-3k.cfg b/cfg/vic20-asm-3k.cfg
new file mode 100644
index 000000000..6ef06957e
--- /dev/null
+++ b/cfg/vic20-asm-3k.cfg
@@ -0,0 +1,22 @@
+# Assembly program configuration for expanded VICs (+3K only).
+
+FEATURES {
+ STARTADDRESS: default = $0401;
+}
+SYMBOLS {
+ __LOADADDR__: type = import;
+}
+MEMORY {
+ ZP: file = "", start = $0002, size = $001A, define = yes;
+ LOADADDR: file = %O, start = %S - 2, size = $0002;
+ MAIN: file = %O, start = %S, size = $1E00 - %S;
+}
+SEGMENTS {
+ ZEROPAGE: load = ZP, type = zp, optional = yes;
+ LOADADDR: load = LOADADDR, type = ro;
+ EXEHDR: load = MAIN, type = ro, optional = yes;
+ CODE: load = MAIN, type = ro;
+ RODATA: load = MAIN, type = ro;
+ DATA: load = MAIN, type = rw;
+ BSS: load = MAIN, type = bss, optional = yes, define = yes;
+}
diff --git a/cfg/vic20-asm.cfg b/cfg/vic20-asm.cfg
index 286a7f95c..531d3f010 100644
--- a/cfg/vic20-asm.cfg
+++ b/cfg/vic20-asm.cfg
@@ -1,3 +1,5 @@
+# Assembly program configuration for unexpanded VICs.
+
FEATURES {
STARTADDRESS: default = $1001;
}
@@ -7,11 +9,12 @@ SYMBOLS {
MEMORY {
ZP: file = "", start = $0002, size = $001A, define = yes;
LOADADDR: file = %O, start = %S - 2, size = $0002;
- MAIN: file = %O, start = %S, size = $0DF3 - %S;
+ MAIN: file = %O, start = %S, size = $1E00 - %S;
}
SEGMENTS {
ZEROPAGE: load = ZP, type = zp, optional = yes;
LOADADDR: load = LOADADDR, type = ro;
+ EXEHDR: load = MAIN, type = ro, optional = yes;
CODE: load = MAIN, type = ro;
RODATA: load = MAIN, type = ro;
DATA: load = MAIN, type = rw;
diff --git a/doc/apple2.sgml b/doc/apple2.sgml
index 63b40c6f8..9cff996b7 100644
--- a/doc/apple2.sgml
+++ b/doc/apple2.sgml
@@ -62,7 +62,7 @@ Special locations: