Merge branch 'master' into macexpand
This commit is contained in:
2
.github/checks/lastline.sh
vendored
2
.github/checks/lastline.sh
vendored
@@ -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`
|
||||
|
||||
2
.github/checks/spaces.sh
vendored
2
.github/checks/spaces.sh
vendored
@@ -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
|
||||
|
||||
|
||||
2
.github/checks/tabs.sh
vendored
2
.github/checks/tabs.sh
vendored
@@ -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
|
||||
|
||||
|
||||
41
.github/workflows/build-on-pull-request.yml
vendored
41
.github/workflows/build-on-pull-request.yml
vendored
@@ -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
|
||||
@@ -27,6 +27,9 @@ jobs:
|
||||
- name: Build the tools.
|
||||
shell: bash
|
||||
run: make -j2 bin USER_CFLAGS=-Werror
|
||||
- name: Build the dbginfo example
|
||||
shell: bash
|
||||
run: make -j2 -C src test
|
||||
- name: Build the utilities.
|
||||
shell: bash
|
||||
run: make -j2 util
|
||||
@@ -35,7 +38,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 +47,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 +57,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 +65,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
|
||||
|
||||
16
.github/workflows/snapshot-on-push-master.yml
vendored
16
.github/workflows/snapshot-on-push-master.yml
vendored
@@ -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
|
||||
|
||||
8
.github/workflows/windows-test-scheduled.yml
vendored
8
.github/workflows/windows-test-scheduled.yml
vendored
@@ -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'
|
||||
|
||||
468
Contributing.md
468
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:
|
||||
<pre>
|
||||
* 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
|
||||
</pre>
|
||||
~~~
|
||||
|
||||
* 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:
|
||||
<pre>
|
||||
* 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
|
||||
</pre>
|
||||
~~~
|
||||
|
||||
## 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:
|
||||
<pre>
|
||||
* 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;
|
||||
}
|
||||
</pre>
|
||||
* 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```:
|
||||
<pre>
|
||||
~~~
|
||||
|
||||
* 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;
|
||||
}
|
||||
</pre>
|
||||
* Should the ```if``` statement be followed by an empty conditional block, there should be a comment telling why this is the case
|
||||
<pre>
|
||||
if (check()) {
|
||||
/* nothing happened, do nothing */
|
||||
}
|
||||
</pre>
|
||||
* 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:
|
||||
<pre>
|
||||
int* namedPtr[5];
|
||||
char* nextLine (FILE* f);
|
||||
</pre>
|
||||
~~~
|
||||
|
||||
* 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
|
||||
<pre>
|
||||
#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
|
||||
</pre>
|
||||
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 </pre>
|
||||
~~~
|
||||
|
||||
## 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:
|
||||
<pre>
|
||||
* 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 ; Promote char return value
|
||||
</pre>
|
||||
or, if the value is 0, you can use:
|
||||
<pre>
|
||||
|
||||
; If the value is 0, you can use:
|
||||
lda #RETURN_VALUE
|
||||
.assert RETURN_VALUE = 0
|
||||
tax
|
||||
</pre>
|
||||
sometimes jumping to return0 could save a byte:
|
||||
<pre>
|
||||
|
||||
; Sometimes jumping to 'return 0' could save a byte:
|
||||
.assert RETURN_VALUE = 0
|
||||
jmp return 0
|
||||
</pre>
|
||||
* 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 ```<sect>``` sections.
|
||||
* Two blank lines between ```<sect1>``` sections.
|
||||
* One blank line between other sections.
|
||||
* Three blank lines between ```<sect>``` sections.
|
||||
* Two blank lines between ```<sect1>``` 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.
|
||||
|
||||
1
Makefile
1
Makefile
@@ -50,6 +50,7 @@ test:
|
||||
# GNU "check" target, which runs all tests
|
||||
check:
|
||||
@$(MAKE) -C .github/checks checkstyle --no-print-directory
|
||||
@$(MAKE) -C src test --no-print-directory
|
||||
@$(MAKE) test
|
||||
@$(MAKE) -C targettest platforms --no-print-directory
|
||||
@$(MAKE) -C samples platforms --no-print-directory
|
||||
|
||||
87
README.md
87
README.md
@@ -1,17 +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
|
||||
|
||||
Project founder:
|
||||
cc65 is originally based on the "Small C" compiler by Ron Cain and
|
||||
enhanced by James E. Hendrix.
|
||||
|
||||
* Ullrich von Bassewitz
|
||||
### Project founders
|
||||
|
||||
Core team members:
|
||||
* 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
|
||||
@@ -19,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
|
||||
@@ -28,31 +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 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)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
517
asminc/lynx.inc
517
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
|
||||
|
||||
@@ -37,6 +37,7 @@ 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
|
||||
|
||||
75
asminc/sim65.inc
Normal file
75
asminc/sim65.inc
Normal file
@@ -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 **
|
||||
; ** **
|
||||
; ************************
|
||||
64
asminc/stat.inc
Normal file
64
asminc/stat.inc
Normal file
@@ -0,0 +1,64 @@
|
||||
;****************************************************************************
|
||||
;* *
|
||||
;* stat.inc *
|
||||
;* *
|
||||
;* Stat struct *
|
||||
;* *
|
||||
;* *
|
||||
;* *
|
||||
;*(C) 2023 Colin Leroy-Mira <colin@colino.net> *
|
||||
;* *
|
||||
;* *
|
||||
;*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
|
||||
46
asminc/statvfs.inc
Normal file
46
asminc/statvfs.inc
Normal file
@@ -0,0 +1,46 @@
|
||||
;****************************************************************************
|
||||
;* *
|
||||
;* statvfs.inc *
|
||||
;* *
|
||||
;* Statvfs struct *
|
||||
;* *
|
||||
;* *
|
||||
;* *
|
||||
;*(C) 2023 Colin Leroy-Mira <colin@colino.net> *
|
||||
;* *
|
||||
;* *
|
||||
;*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
|
||||
@@ -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
|
||||
|
||||
@@ -66,3 +66,9 @@
|
||||
.global _clock_settime
|
||||
.global _localtime
|
||||
.global _mktime
|
||||
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; Constants
|
||||
|
||||
CLOCK_REALTIME = 0
|
||||
|
||||
@@ -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;
|
||||
@@ -31,6 +32,7 @@ SEGMENTS {
|
||||
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,
|
||||
|
||||
@@ -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__;
|
||||
@@ -47,6 +48,7 @@ SEGMENTS {
|
||||
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;
|
||||
|
||||
@@ -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;
|
||||
@@ -26,6 +27,7 @@ SEGMENTS {
|
||||
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,
|
||||
|
||||
@@ -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;
|
||||
@@ -30,6 +31,7 @@ SEGMENTS {
|
||||
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,
|
||||
|
||||
@@ -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;
|
||||
@@ -31,6 +32,7 @@ SEGMENTS {
|
||||
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,
|
||||
|
||||
@@ -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__;
|
||||
@@ -47,6 +48,7 @@ SEGMENTS {
|
||||
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;
|
||||
|
||||
@@ -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;
|
||||
@@ -26,6 +27,7 @@ SEGMENTS {
|
||||
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,
|
||||
|
||||
@@ -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;
|
||||
@@ -30,6 +31,7 @@ SEGMENTS {
|
||||
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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 = bss, 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;
|
||||
|
||||
@@ -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 = bss, optional = yes;
|
||||
INIT: load = MAIN, type = bss, define = yes, optional = yes;
|
||||
BSS: load = MAIN, type = bss, define = yes;
|
||||
}
|
||||
FEATURES {
|
||||
|
||||
@@ -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 = bss, optional = yes;
|
||||
INIT: load = MAIN, type = bss, define = yes, optional = yes;
|
||||
BSS: load = MAIN, type = bss, define = yes;
|
||||
AUTOSTRT: load = TRAILER, type = ro;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 = bss, optional = yes;
|
||||
INIT: load = MAIN, type = bss, define = yes, optional = yes;
|
||||
BSS: load = MAIN, type = bss, define = yes;
|
||||
AUTOSTRT: load = TRAILER, type = ro;
|
||||
}
|
||||
|
||||
@@ -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 = bss, optional = yes;
|
||||
INIT: load = MAIN, type = bss, define = yes, optional = yes;
|
||||
BSS: load = MAIN, type = bss, define = yes;
|
||||
AUTOSTRT: load = TRAILER, type = ro;
|
||||
|
||||
|
||||
@@ -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 = bss, 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;
|
||||
|
||||
@@ -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 = bss, optional = yes;
|
||||
INIT: load = MAIN, type = bss, define = yes, optional = yes;
|
||||
BSS: load = MAIN, type = bss, define = yes;
|
||||
AUTOSTRT: load = TRAILER, type = ro;
|
||||
}
|
||||
|
||||
20
cfg/c16-asm.cfg
Normal file
20
cfg/c16-asm.cfg
Normal file
@@ -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;
|
||||
}
|
||||
41
cfg/kim1-mtu60k.cfg
Normal file
41
cfg/kim1-mtu60k.cfg
Normal file
@@ -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 <prog>.bin <prog>.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;
|
||||
}
|
||||
|
||||
41
cfg/kim1-mtuE000.cfg
Normal file
41
cfg/kim1-mtuE000.cfg
Normal file
@@ -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 <prog>.bin <prog>.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;
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
20
cfg/plus4-asm.cfg
Normal file
20
cfg/plus4-asm.cfg
Normal file
@@ -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;
|
||||
}
|
||||
@@ -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__,
|
||||
|
||||
@@ -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__,
|
||||
|
||||
22
cfg/vic20-asm-32k.cfg
Normal file
22
cfg/vic20-asm-32k.cfg
Normal file
@@ -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;
|
||||
}
|
||||
22
cfg/vic20-asm-3k.cfg
Normal file
22
cfg/vic20-asm-3k.cfg
Normal file
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -62,7 +62,7 @@ Special locations:
|
||||
</descrip><p>
|
||||
|
||||
While running <tt/main()/ the Language Card bank 2 is enabled for read access.
|
||||
However while running module constructors/destructors the Language Card is disabled.
|
||||
However while running module constructors the Language Card is disabled.
|
||||
|
||||
Enabling the Language Card allows to use it as additional memory for cc65
|
||||
generated code. However code is never automatically placed there. Rather code
|
||||
@@ -92,7 +92,28 @@ several useful settings:
|
||||
|
||||
</descrip><p>
|
||||
|
||||
<descrip>
|
||||
|
||||
<tag/Installing your code in the Language Card/
|
||||
The code in the LC segment will automatically be copied from the end of the
|
||||
binary into the Language Card at startup, even if the segment is empty (a
|
||||
0-byte copy). This allows for tighter code. This code will be copied using the
|
||||
Applesoft BLTU2 function that is available starting with the Apple ][+,
|
||||
but not in the original Apple ][ with an Integer BASIC ROM. This shows as
|
||||
a "RANGE ERROR. STOPPING AT ..." message on startup.
|
||||
|
||||
If you want to target the Integer BASIC original Apple ][, you can link in an
|
||||
alternative implementation of the LC segment loading, at the cost of linking
|
||||
in memcpy (60 bytes):
|
||||
|
||||
Using <tt/apple2-integer-basic-compat.o/ is as simple as placing it on the linker
|
||||
command line like this:
|
||||
|
||||
<tscreen><verb>
|
||||
cl65 -t apple2 myprog.c apple2-integer-basic-compat.o
|
||||
</verb></tscreen>
|
||||
|
||||
</descrip>
|
||||
|
||||
<sect>Linker configurations<label id="link-configs"><p>
|
||||
|
||||
@@ -289,9 +310,9 @@ the memory from $800 to $1FFF can be added to the heap by calling
|
||||
|
||||
ProDOS 8 requires for every open file a page-aligned 1 KB I/O buffer. By default
|
||||
these buffers are allocated by the cc65 runtime system on the heap using
|
||||
<tt/posix_memalign()/. While this is generally the best solution it means quite
|
||||
some overhead for (especially rather small) cc65 programs which do open files
|
||||
but don't make use of the heap otherwise.
|
||||
<url url="funcref.html#posix_memalign" name="posix_memalign()">. While this is
|
||||
generally the best solution it means quite some overhead for (especially rather
|
||||
small) cc65 programs which do open files but don't make use of the heap otherwise.
|
||||
|
||||
The apple2 package comes with the alternative ProDOS 8 I/O buffer allocation
|
||||
module <tt/apple2-iobuf-0800.o/ which uses the memory between $800 and
|
||||
@@ -321,18 +342,40 @@ Programs containing Apple ][ specific code may use the
|
||||
|
||||
<sect1>Apple ][ specific functions<p>
|
||||
|
||||
The functions listed below are special for the Apple ][. See
|
||||
the <url url="funcref.html" name="function reference"> for declaration and
|
||||
The functions and variables listed below are special for the Apple ][.
|
||||
See the <url url="funcref.html" name="function reference"> for declaration and
|
||||
usage.
|
||||
|
||||
<itemize>
|
||||
<item>_auxtype
|
||||
<item>_dos_type
|
||||
<item>_filetype
|
||||
<item>_datetime
|
||||
<item>allow_lowercase
|
||||
<item>beep
|
||||
<item>dir_entry_count
|
||||
<item>get_tv
|
||||
<item>get_ostype
|
||||
<item>gmtime_dt
|
||||
<item>mktime_dt
|
||||
<item>rebootafterexit
|
||||
<item>ser_apple2_slot
|
||||
<item>tgi_apple2_mix
|
||||
<item>videomode
|
||||
</itemize>
|
||||
|
||||
|
||||
<sect1>Apple IIgs specific functions in accelerator.h<p>
|
||||
|
||||
In addition to those, the <tt/accelerator.h/ header file contains three functions
|
||||
to help determine whether the program is running on a IIgs, and change the IIgs
|
||||
CPU speed. See the <url url="funcref.html" name="function reference"> for declaration and
|
||||
usage.
|
||||
|
||||
<itemize>
|
||||
<item>detect_iigs
|
||||
<item>get_iigs_speed
|
||||
<item>set_iigs_speed
|
||||
</itemize>
|
||||
|
||||
|
||||
@@ -364,6 +407,10 @@ The names in the parentheses denote the symbols to be used for static linking of
|
||||
with <tt/-S $4000/ to reserve the first hires page or with <tt/-S $6000/
|
||||
to reserve both hires pages.
|
||||
|
||||
Note that the second hires page is only available if the text display is not in
|
||||
80 column mode. This can be asserted by calling <tt/videomode (VIDEOMODE_40COL);/
|
||||
before installing the driver.
|
||||
|
||||
The function <tt/tgi_apple2_mix()/ allows to activate 4 lines of text. The
|
||||
function doesn't clear the corresponding area at the bottom of the screen.
|
||||
|
||||
@@ -434,10 +481,15 @@ The names in the parentheses denote the symbols to be used for static linking of
|
||||
(RTS/CTS) and does interrupt driven receives. Speeds faster than 9600 baud
|
||||
aren't reachable because the ROM and ProDOS IRQ handlers are too slow.
|
||||
Software flow control (XON/XOFF) is not supported.
|
||||
|
||||
Note that because of the peculiarities of the 6551 chip transmits are not
|
||||
interrupt driven, and the transceiver blocks if the receiver asserts
|
||||
flow control because of a full buffer.
|
||||
|
||||
Note that using the driver at SER_BAUD_115200 will disable IRQs. It will be up
|
||||
to the users to use the serial port, either by re-enabling IRQs themselves,
|
||||
or by directly poll-reading the ACIA DATA register without the help of ser_get().
|
||||
|
||||
The driver defaults to slot 2. Call <tt/ser_apple2_slot()/ prior to
|
||||
<tt/ser_open()/ in order to select a different slot. <tt/ser_apple2_slot()/
|
||||
succeeds for all Apple II slots, but <tt/ser_open()/ fails with
|
||||
@@ -569,6 +621,28 @@ program. See the discussion of the <tt/.CONDES/ feature in the <url
|
||||
url="ca65.html" name="assembler manual">.
|
||||
|
||||
|
||||
<sect1>ProDOS date/time manipulation<p>
|
||||
|
||||
<descrip>
|
||||
The readdir and stat function return ProDOS timestamps in their file
|
||||
creation/modification time attributes. You can convert them to more portable
|
||||
time representations using either:
|
||||
|
||||
<tag/struct tm/
|
||||
<tt/struct tm* __fastcall__ gmtime_dt (const struct datetime* dt);/
|
||||
|
||||
Converts a <tt/struct datetime/ into a <tt/struct tm/. Returns NULL in case
|
||||
of error and sets errno.
|
||||
|
||||
<tag/time_t/
|
||||
<tt/time_t __fastcall__ mktime_dt (const struct datetime* dt);/
|
||||
|
||||
Parses a <tt/struct datetime/ and returns a UNIX timestamp. Returns 0 on error and
|
||||
sets errno.
|
||||
|
||||
</descrip>
|
||||
|
||||
|
||||
<sect1>DIO<p>
|
||||
|
||||
<descrip>
|
||||
@@ -630,6 +704,16 @@ url="ca65.html" name="assembler manual">.
|
||||
that can be used to set these variables. It is included in
|
||||
<tt/apple2.h/.
|
||||
|
||||
The global variable <tt/_datetime/ allows the file creation date/time
|
||||
to be set before a call to <tt/fopen()/
|
||||
or <tt/open()/ that creates the file. It is defined in <tt/apple2.h/:
|
||||
|
||||
<tscreen>
|
||||
<verb>
|
||||
extern struct datetime _datetime;
|
||||
</verb>
|
||||
</tscreen>
|
||||
|
||||
<tag>Example</tag>
|
||||
|
||||
A text file cannot be created with just the
|
||||
|
||||
@@ -63,7 +63,7 @@ Special locations:
|
||||
</descrip><p>
|
||||
|
||||
While running <tt/main()/ the Language Card bank 2 is enabled for read access.
|
||||
However while running module constructors/destructors the Language Card is disabled.
|
||||
However while running module constructors the Language Card is disabled.
|
||||
|
||||
Enabling the Language Card allows to use it as additional memory for cc65
|
||||
generated code. However code is never automatically placed there. Rather code
|
||||
@@ -290,9 +290,9 @@ the memory from $800 to $1FFF can be added to the heap by calling
|
||||
|
||||
ProDOS 8 requires for every open file a page-aligned 1 KB I/O buffer. By default
|
||||
these buffers are allocated by the cc65 runtime system on the heap using
|
||||
<tt/posix_memalign()/. While this is generally the best solution it means quite
|
||||
some overhead for (especially rather small) cc65 programs which do open files
|
||||
but don't make use of the heap otherwise.
|
||||
<url url="funcref.html#posix_memalign" name="posix_memalign()">. While this is
|
||||
generally the best solution it means quite some overhead for (especially rather
|
||||
small) cc65 programs which do open files but don't make use of the heap otherwise.
|
||||
|
||||
The apple2enh package comes with the alternative ProDOS 8 I/O buffer allocation
|
||||
module <tt/apple2enh-iobuf-0800.o/ which uses the memory between $800 and
|
||||
@@ -322,15 +322,21 @@ Programs containing enhanced Apple //e specific code may use the
|
||||
|
||||
<sect1>Enhanced Apple //e specific functions<p>
|
||||
|
||||
The functions listed below are special for the enhanced Apple //e. See
|
||||
the <url url="funcref.html" name="function reference"> for declaration and
|
||||
The functions and variables listed below are special for the Apple ][.
|
||||
See the <url url="funcref.html" name="function reference"> for declaration and
|
||||
usage.
|
||||
|
||||
<itemize>
|
||||
<item>_auxtype
|
||||
<item>_dos_type
|
||||
<item>_filetype
|
||||
<item>_datetime
|
||||
<item>beep
|
||||
<item>dir_entry_count
|
||||
<item>get_tv
|
||||
<item>get_ostype
|
||||
<item>gmtime_dt
|
||||
<item>mktime_dt
|
||||
<item>rebootafterexit
|
||||
<item>ser_apple2_slot
|
||||
<item>tgi_apple2_mix
|
||||
@@ -339,6 +345,20 @@ usage.
|
||||
</itemize>
|
||||
|
||||
|
||||
<sect1>Apple IIgs specific functions in accelerator.h<p>
|
||||
|
||||
In addition to those, the <tt/accelerator.h/ header file contains three functions
|
||||
to help determine whether the program is running on a IIgs, and change the IIgs
|
||||
CPU speed. See the <url url="funcref.html" name="function reference"> for declaration and
|
||||
usage.
|
||||
|
||||
<itemize>
|
||||
<item>detect_iigs
|
||||
<item>get_iigs_speed
|
||||
<item>set_iigs_speed
|
||||
</itemize>
|
||||
|
||||
|
||||
<sect1>Hardware access<p>
|
||||
|
||||
There's currently no support for direct hardware access. This does not mean
|
||||
@@ -435,10 +455,15 @@ The names in the parentheses denote the symbols to be used for static linking of
|
||||
(RTS/CTS) and does interrupt driven receives. Speeds faster than 9600 baud
|
||||
aren't reachable because the ROM and ProDOS IRQ handlers are too slow.
|
||||
Software flow control (XON/XOFF) is not supported.
|
||||
|
||||
Note that because of the peculiarities of the 6551 chip transmits are not
|
||||
interrupt driven, and the transceiver blocks if the receiver asserts
|
||||
flow control because of a full buffer.
|
||||
|
||||
Note that using the driver at SER_BAUD_115200 will disable IRQs. It will be up
|
||||
to the users to use the serial port, either by re-enabling IRQs themselves,
|
||||
or by directly poll-reading the ACIA DATA register without the help of ser_get().
|
||||
|
||||
The driver defaults to slot 2. Call <tt/ser_apple2_slot()/ prior to
|
||||
<tt/ser_open()/ in order to select a different slot. <tt/ser_apple2_slot()/
|
||||
succeeds for all Apple II slots, but <tt/ser_open()/ fails with
|
||||
@@ -575,6 +600,28 @@ program. See the discussion of the <tt/.CONDES/ feature in the <url
|
||||
url="ca65.html" name="assembler manual">.
|
||||
|
||||
|
||||
<sect1>ProDOS date/time manipulation<p>
|
||||
|
||||
<descrip>
|
||||
The readdir and stat function return ProDOS timestamps in their file
|
||||
creation/modification time attributes. You can convert them to more portable
|
||||
time representations using either:
|
||||
|
||||
<tag/struct tm/
|
||||
<tt/struct tm* __fastcall__ gmtime_dt (const struct datetime* dt);/
|
||||
|
||||
Converts a <tt/struct datetime/ into a <tt/struct tm/. Returns -1 in case
|
||||
of error and sets errno, 0 on success.
|
||||
|
||||
<tag/time_t/
|
||||
<tt/time_t __fastcall__ mktime_dt (const struct datetime* dt);/
|
||||
|
||||
Parses a <tt/struct datetime/ and returns a UNIX timestamp. Returns 0 on error and
|
||||
sets errno.
|
||||
|
||||
</descrip>
|
||||
|
||||
|
||||
<sect1>DIO<p>
|
||||
|
||||
<descrip>
|
||||
@@ -619,7 +666,7 @@ url="ca65.html" name="assembler manual">.
|
||||
auxiliary type. Therefore, some additional mechanism for specifying
|
||||
the file types is needed.
|
||||
|
||||
<tag>Specifying the File Type and Auxiliary Type</tag>
|
||||
<tag>Specifying the File Type, Auxiliary Type and creation date</tag>
|
||||
|
||||
There are two global variables provided that allow the file type
|
||||
and auxiliary type to be specified before a call to <tt/fopen()/
|
||||
@@ -636,6 +683,16 @@ url="ca65.html" name="assembler manual">.
|
||||
that can be used to set these variables. It is included in
|
||||
<tt/apple2.h/, which is in turn included in <tt/apple2enh.h/.
|
||||
|
||||
The global variable <tt/_datetime/ allows the file creation date/time
|
||||
to be set before a call to <tt/fopen()/
|
||||
or <tt/open()/ that creates the file. It is defined in <tt/apple2.h/:
|
||||
|
||||
<tscreen>
|
||||
<verb>
|
||||
extern struct datetime _datetime;
|
||||
</verb>
|
||||
</tscreen>
|
||||
|
||||
<tag>Example</tag>
|
||||
|
||||
A text file cannot be created with just the
|
||||
|
||||
@@ -412,8 +412,9 @@ Please mind that ANTIC has memory alignment requirements for "player
|
||||
missile graphics"-data, font data, display lists and screen memory. Creation
|
||||
of a special linker configuration with appropriate aligned segments and
|
||||
switching to that segment in the c-code is usually necessary. A more memory
|
||||
hungry solution consists in using the "<tt/posix_memalign()/" function in
|
||||
conjunction with copying your data to the allocated memory.
|
||||
hungry solution consists in using the <url url="funcref.html#posix_memalign"
|
||||
name="posix_memalign()"> function in conjunction with copying your data to the
|
||||
allocated memory.
|
||||
|
||||
<sect1>Character mapping<p>
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<!doctype linuxdoc system>
|
||||
|
||||
<article>
|
||||
<title>Oric Atmos-specific information for cc65
|
||||
<title>Tangerine Oric Atmos-specific information for cc65
|
||||
<author>
|
||||
<url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline>
|
||||
<url url="mailto:polluks@sdf.lonestar.org" name="Stefan A. Haubenthal">,<newline>
|
||||
<url url="mailto:polluks@sdf.org" name="Stefan A. Haubenthal">,<newline>
|
||||
<url url="mailto:greg.king5@verizon.net" name="Greg King">
|
||||
|
||||
<abstract>
|
||||
An overview over the Atmos runtime system as it is implemented for the cc65 C
|
||||
compiler.
|
||||
An overview over the Oric Atmos runtime system as it is implemented for the cc65
|
||||
C compiler. This target is not Oric-1 compatible.
|
||||
</abstract>
|
||||
|
||||
<!-- Table of contents -->
|
||||
|
||||
185
doc/ca65.sgml
185
doc/ca65.sgml
@@ -833,49 +833,40 @@ names like "Loop". Here is an example:
|
||||
bne @Loop ; ERROR: Unknown identifier!
|
||||
</verb></tscreen>
|
||||
|
||||
|
||||
<sect1>Unnamed labels<p>
|
||||
|
||||
If you really want to write messy code, there are also unnamed labels. These
|
||||
labels do not have a name (you guessed that already, didn't you?). A colon is
|
||||
used to mark the absence of the name.
|
||||
If you really want to write messy code, there are also unnamed labels. To define
|
||||
an unnamed label, use sole <tt>:</tt>.
|
||||
|
||||
Unnamed labels may be accessed by using the colon plus several minus or plus
|
||||
characters as a label designator. Using the '-' characters will create a back
|
||||
reference (use the n'th label backwards), using '+' will create a forward
|
||||
reference (use the n'th label in forward direction). An example will help to
|
||||
understand this:
|
||||
To reference an unnamed label, use <tt>:</tt> with several <tt>-</tt> or <tt>+</tt> characters.
|
||||
The <tt>-</tt> characters will create a back reference (n'th label backwards),
|
||||
the <tt>+</tt> will create a forward reference (n'th label in forward direction).
|
||||
As an alternative, angle brackets <tt><</tt> and <tt>></tt> may be used
|
||||
instead of <tt>-</tt> and <tt>+</tt> with the same meaning.
|
||||
|
||||
Example:
|
||||
|
||||
<tscreen><verb>
|
||||
: lda (ptr1),y ; #1
|
||||
cmp (ptr2),y
|
||||
bne :+ ; -> #2
|
||||
tax
|
||||
beq :+++ ; -> #4
|
||||
iny
|
||||
bne :- ; -> #1
|
||||
inc ptr1+1
|
||||
inc ptr2+1
|
||||
bne :- ; -> #1
|
||||
|
||||
: bcs :+ ; #2 -> #3
|
||||
ldx #$FF
|
||||
rts
|
||||
|
||||
: ldx #$01 ; #3
|
||||
: rts ; #4
|
||||
cpy #0
|
||||
beq :++
|
||||
:
|
||||
sta $2007
|
||||
dey
|
||||
bne :-
|
||||
:
|
||||
rts
|
||||
</verb></tscreen>
|
||||
|
||||
As you can see from the example, unnamed labels will make even short
|
||||
sections of code hard to understand, because you have to count labels
|
||||
to find branch targets (this is the reason why I for my part do
|
||||
prefer the "cheap" local labels). Nevertheless, unnamed labels are
|
||||
convenient in some situations, so it's your decision.
|
||||
Unnamed labels may make even short sections of code hard to understand, because
|
||||
you have to count labels to find branch targets. It's better to prefer the
|
||||
"cheap" local labels. Nevertheless, unnamed labels are convenient in some
|
||||
situations, so it's up to your discretion.
|
||||
|
||||
<em/Note:/ <ref id="scopes" name="Scopes"> organize named symbols, not
|
||||
unnamed ones, so scopes don't have an effect on unnamed labels.
|
||||
|
||||
|
||||
|
||||
<sect1>Using macros to define labels and constants<p>
|
||||
|
||||
While there are drawbacks with this approach, it may be handy in a few rare
|
||||
@@ -1070,7 +1061,7 @@ The namespace token (<tt/::/) is used to access other scopes:
|
||||
.endscope
|
||||
|
||||
...
|
||||
lda foo::bar ; Access foo in scope bar
|
||||
lda #foo::bar ; Access bar in scope foo
|
||||
</verb></tscreen>
|
||||
|
||||
The only way to deny access to a scope from the outside is to declare a scope
|
||||
@@ -2871,6 +2862,26 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
|
||||
overridden. When using this feature, you may also get into trouble if
|
||||
later versions of the assembler define new keywords starting with a dot.
|
||||
|
||||
<tag><tt>line_continuations</tt><label id="line_continuations"></tag>
|
||||
|
||||
Switch on or off line continuations using the backslash character
|
||||
before a newline. The option is off by default.
|
||||
Note: Line continuations do not work in a comment. A backslash at the
|
||||
end of a comment is treated as part of the comment and does not trigger
|
||||
line continuation.
|
||||
|
||||
Example:
|
||||
|
||||
<tscreen><verb>
|
||||
.feature line_continuations + ; Allow line continuations
|
||||
|
||||
lda \
|
||||
#$20 ; This is legal now
|
||||
</verb></tscreen>
|
||||
|
||||
For backward compatibility reasons, the <tt>.LINECONT +</tt> control command
|
||||
is also supported and enables the same feature.
|
||||
|
||||
<tag><tt>long_jsr_jmp_rts</tt><label id="long_jsr_jmp_rts"></tag>
|
||||
|
||||
Affects 65816 mode only.
|
||||
@@ -3375,26 +3386,6 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
|
||||
the feature in more detail.
|
||||
|
||||
|
||||
<sect1><tt>.LINECONT</tt><label id=".LINECONT"><p>
|
||||
|
||||
Switch on or off line continuations using the backslash character
|
||||
before a newline. The option is off by default.
|
||||
Note: Line continuations do not work in a comment. A backslash at the
|
||||
end of a comment is treated as part of the comment and does not trigger
|
||||
line continuation.
|
||||
The command can be followed by a '+' or '-' character to switch the
|
||||
option on or off respectively.
|
||||
|
||||
Example:
|
||||
|
||||
<tscreen><verb>
|
||||
.linecont + ; Allow line continuations
|
||||
|
||||
lda \
|
||||
#$20 ; This is legal now
|
||||
</verb></tscreen>
|
||||
|
||||
|
||||
<sect1><tt>.LIST</tt><label id=".LIST"><p>
|
||||
|
||||
Enable output to the listing. The command can be followed by a boolean
|
||||
@@ -3908,7 +3899,7 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".BYTE" name=".BYTE"
|
||||
|
||||
Reserve storage. The command is followed by one or two constant
|
||||
expressions. The first one is mandatory and defines, how many bytes of
|
||||
storage should be defined. The second, optional expression must by a
|
||||
storage should be defined. The second, optional expression must be a
|
||||
constant byte value that will be used as value of the data. If there
|
||||
is no fill value given, the linker will use the value defined in the
|
||||
linker configuration file (default: zero).
|
||||
@@ -4090,7 +4081,9 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".BYTE" name=".BYTE"
|
||||
|
||||
<sect1><tt>.TAG</tt><label id=".TAG"><p>
|
||||
|
||||
Allocate space for a struct or union.
|
||||
Allocate space for a struct or union. This is equivalent to
|
||||
<tt><ref id=".RES" name=".RES"></tt> with the
|
||||
<tt><ref id=".SIZEOF" name=".SIZEOF"></tt> of a struct.
|
||||
|
||||
Example:
|
||||
|
||||
@@ -4104,6 +4097,7 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".BYTE" name=".BYTE"
|
||||
.tag Point ; Allocate 4 bytes
|
||||
</verb></tscreen>
|
||||
|
||||
See: <ref id="structs" name=""Structs and unions"">
|
||||
|
||||
<sect1><tt>.UNDEF, .UNDEFINE</tt><label id=".UNDEFINE"><p>
|
||||
|
||||
@@ -4493,9 +4487,9 @@ different:
|
||||
|
||||
<item> Macros defined with <tt><ref id=".DEFINE" name=".DEFINE"></tt> may not
|
||||
span more than a line. You may use line continuation (see <tt><ref
|
||||
id=".LINECONT" name=".LINECONT"></tt>) to spread the definition over
|
||||
more than one line for increased readability, but the macro itself
|
||||
may not contain an end-of-line token.
|
||||
id="line_continuations" name="line_continuations"></tt>) to spread the
|
||||
definition over more than one line for increased readability, but the
|
||||
macro itself may not contain an end-of-line token.
|
||||
|
||||
<item> Macros defined with <tt><ref id=".DEFINE" name=".DEFINE"></tt> share
|
||||
the name space with classic macros, but they are detected and replaced
|
||||
@@ -4869,10 +4863,15 @@ compiler, depending on the target system selected:
|
||||
|
||||
Structs and unions are special forms of <ref id="scopes" name="scopes">. They
|
||||
are, to some degree, comparable to their C counterparts. Both have a list of
|
||||
members. Each member allocates storage, and optionally may have a name whose
|
||||
value, in the case of a struct, usually is the storage offset from the
|
||||
beginning, and in the case of a union, doesn't change, and usually is zero.
|
||||
members. Each member allocates storage, and optionally may have a name.
|
||||
|
||||
Each named member has a constant value equal to the storage offset from the
|
||||
beginning of the structure. In the case of a union, all members are placed at
|
||||
the same offset, typically 0.
|
||||
|
||||
Each named member also has a storage size which can be accessed with the
|
||||
<tt><ref id=".SIZEOF" name=".SIZEOF"></tt> operator. The struct or union itself
|
||||
also has a <tt/.SIZEOF/ indicating its total storage size.
|
||||
|
||||
<sect1>Declaration<p>
|
||||
|
||||
@@ -4899,8 +4898,9 @@ A struct or union may not necessarily have a name. If it is anonymous, no
|
||||
local scope is opened; the identifiers used to name the members are placed
|
||||
into the current scope instead.
|
||||
|
||||
A struct may contain unnamed members and definitions of local structs/unions.
|
||||
The storage allocators may contain a multiplier, as in the example below:
|
||||
Storage allocators may contain a multiplier. A struct may also contain members
|
||||
and definitions of local structs/unions. Example:
|
||||
|
||||
<tscreen><verb>
|
||||
.struct Circle
|
||||
.struct Point
|
||||
@@ -4909,7 +4909,8 @@ The storage allocators may contain a multiplier, as in the example below:
|
||||
Radius .word
|
||||
.endstruct
|
||||
</verb></tscreen>
|
||||
The size of the Circle struct is 6 (three words).
|
||||
|
||||
In this example the size of the Circle struct is 6 (three words).
|
||||
|
||||
|
||||
<sect1>The storage allocator keywords<p>
|
||||
@@ -4919,7 +4920,7 @@ The size of the Circle struct is 6 (three words).
|
||||
<tag/.BYTE, .RES/
|
||||
Allocates multiples of 1 byte. <tt/.RES/ requires an operand.
|
||||
|
||||
<tag/.DBYTE, .WORD, .ADDR/
|
||||
<tag/.DBYT, .WORD, .ADDR/
|
||||
Allocates multiples of 2 bytes.
|
||||
|
||||
<tag/.FARADDR/
|
||||
@@ -4928,6 +4929,15 @@ The size of the Circle struct is 6 (three words).
|
||||
<tag/.DWORD/
|
||||
Allocates multiples of 4 bytes.
|
||||
|
||||
<tag/.TAG/
|
||||
Allocates a previously defined struct.
|
||||
|
||||
<tag/.STRUCT, .UNION/
|
||||
Begins a nested .struct or .union definition, and allocates it.
|
||||
Note that its member offset values will begin at 0, unless this nested
|
||||
structure is anonymous, in which case they will instead become members of
|
||||
the enclosing scope.
|
||||
|
||||
</descrip>
|
||||
|
||||
|
||||
@@ -4972,13 +4982,54 @@ name=".TAG"> directive.
|
||||
C: .tag Circle
|
||||
</verb></tscreen>
|
||||
|
||||
Currently, members are just offsets from the start of the struct or union. To
|
||||
Members are just offsets from the start of the struct or union. To
|
||||
access a field of a struct, the member offset must be added to the address of
|
||||
the struct variable itself:
|
||||
<tscreen><verb>
|
||||
lda C+Circle::Radius ; Load circle radius into A
|
||||
lda C + Circle::Radius ; Load circle radius
|
||||
lda C + Circle::Origin + Point::ycoord ; Load circle origin.ycoord
|
||||
</verb></tscreen>
|
||||
That may change in a future version of the assembler.
|
||||
|
||||
Nested structures or unions are treated differently depending on whether they
|
||||
are anonymous. If named, a new structure definition is created within the
|
||||
enclosing scope, with its offsets beginning at 0. If anonymous, the members of
|
||||
the new structure are added to the enclosing scope instead, with offsets
|
||||
continuing through that scope. Example:
|
||||
|
||||
<tscreen><verb>
|
||||
.struct Object
|
||||
id .byte ; Object::id = 0
|
||||
target .struct Point ; Object::target = 1
|
||||
xcoord .word ; Object::Point::xcoord = 0
|
||||
ycoord .word ; Object::Point::ycoord = 2
|
||||
.endstruct
|
||||
cost .struct ; Object::cost = 5
|
||||
price .word ; Object::price = 5
|
||||
tax .word ; Object::tax = 7
|
||||
.endstruct
|
||||
.struct
|
||||
radius .word ; Object::radius = 9
|
||||
.endstruct
|
||||
.endstruct
|
||||
|
||||
O: .tag Object
|
||||
lda O + Object::target + Object::Point::ycoord ; Named struct
|
||||
lda O + Object::tax ; Anonymous
|
||||
lda O + Object::radius ; Anonymous
|
||||
|
||||
; Be careful not to use a named nested structure without also adding the
|
||||
; offset to the nested structure itself.
|
||||
lda O + Object::Point::ycoord ; Incorrect!
|
||||
lda O + Object::target + Object::Point::ycoord ; Correct
|
||||
</verb></tscreen>
|
||||
|
||||
In this example, the first nested structure is named "Point", and its member
|
||||
offsets begin at 0. On the other hand, the two anonymous structures simply
|
||||
continue to add members to the enclosing "Object" structure.
|
||||
|
||||
Note that an anonymous structure does not need a member name, since all of its
|
||||
members become part of the enclosing structure. The "cost" member in the
|
||||
example is redundantly the same offset as its first member "price".
|
||||
|
||||
|
||||
<sect1>Limitations<p>
|
||||
|
||||
127
doc/cc65.sgml
127
doc/cc65.sgml
@@ -61,7 +61,7 @@ Short options:
|
||||
-Os Inline some standard functions
|
||||
-T Include source as comment
|
||||
-V Print the compiler version number
|
||||
-W warning[,...] Suppress warnings
|
||||
-W [-+]warning[,...] Control warnings ('-' disables, '+' enables)
|
||||
-d Debug mode
|
||||
-g Add debug info to object file
|
||||
-h Help (this text)
|
||||
@@ -84,8 +84,9 @@ Long options:
|
||||
--create-full-dep name Create a full make dependency file
|
||||
--data-name seg Set the name of the DATA segment
|
||||
--debug Debug mode
|
||||
--debug-tables name Write symbol table debug info to a file
|
||||
--debug-info Add debug info to object file
|
||||
--debug-opt name Configure optimizations with a file
|
||||
--debug-opt name Debug optimization steps
|
||||
--debug-opt-output Debug output of each optimization step
|
||||
--dep-target target Use this dependency target
|
||||
--disable-opt name Disable an optimization step
|
||||
@@ -823,6 +824,11 @@ and the one defined by the ISO standard:
|
||||
as it sounds, since the 6502 has so few registers that it isn't
|
||||
possible to keep values in registers anyway.
|
||||
<p>
|
||||
<item> In <tt/cc65/ mode, <tt/main()/ cannot be called recursively. If this
|
||||
is necessary, the program must be compiled in <tt/c89/ or <tt/c99/ mode
|
||||
using the <tt><ref id="option--standard" name="--standard"></tt>
|
||||
command line option.
|
||||
<p>
|
||||
</itemize>
|
||||
|
||||
There may be some more minor differences I'm currently not aware of. The
|
||||
@@ -1047,6 +1053,16 @@ This cc65 version has some extensions to the ISO C standard.
|
||||
unsigned char foo = 0b101; // sets it to 5
|
||||
</verb></tscreen>
|
||||
|
||||
<item> The character escape '\e', a GCC C extension, is accepted.
|
||||
In ASCII this is the escape character 0x1B, which may be
|
||||
remapped in other character sets via a #pragma charmap.
|
||||
It can be disabled with the <tt><ref id="option--standard"
|
||||
name="--standard"></tt> option.
|
||||
|
||||
<tscreen><verb>
|
||||
unsigned char foo = '\e'; // sets it to 0x1B or equivalent
|
||||
</verb></tscreen>
|
||||
|
||||
</itemize>
|
||||
<p>
|
||||
|
||||
@@ -1138,6 +1154,96 @@ The compiler defines several macros at startup:
|
||||
<item><tt/__CC65_STD_CC65__/
|
||||
</itemize>
|
||||
|
||||
<label id="macro-CPU">
|
||||
<tag><tt>__CPU__</tt></tag>
|
||||
|
||||
This macro contains a bitset that allows to check if a specific instruction
|
||||
set is supported. For example, the 65C02 CPU supports all instructions of the
|
||||
65SC02. So testing for the instruction set of the 65SC02 using the following
|
||||
check will succeed for both CPUs (and also for the 65816 and HUC6280).
|
||||
|
||||
<tscreen><verb>
|
||||
#if (__CPU__ & __CPU_ISET_65SC02__)
|
||||
</verb></tscreen>
|
||||
|
||||
This is much simpler and more future proof than checking for specific CPUs.
|
||||
|
||||
The compiler defines a set of constants named <tt/__CPU_ISET_xxx/ to do the
|
||||
checks. The <tt/__CPU__/ variable is usually derived from the target system
|
||||
given, but can be changed using the <tt/<ref id="option--cpu" name="--cpu">/
|
||||
command line option.
|
||||
|
||||
<tag><tt>__CPU_6502__</tt></tag>
|
||||
|
||||
This macro is defined if the code is compiled for a 6502 CPU.
|
||||
|
||||
<tag><tt>__CPU_6502X__</tt></tag>
|
||||
|
||||
This macro is defined if the code is compiled for a 6502 CPU with invalid
|
||||
opcodes.
|
||||
|
||||
<tag><tt>__CPU_6502DTV__</tt></tag>
|
||||
|
||||
This macro is defined if the code is compiled for a DTV CPU.
|
||||
|
||||
<tag><tt>__CPU_65SC02__</tt></tag>
|
||||
|
||||
This macro is defined if the code is compiled for a 65SC02 CPU.
|
||||
|
||||
<tag><tt>__CPU_65C02__</tt></tag>
|
||||
|
||||
This macro is defined if the code is compiled for a 65C02 CPU.
|
||||
|
||||
<tag><tt>__CPU_65816__</tt></tag>
|
||||
|
||||
This macro is defined if the code is compiled for a 65816 CPU.
|
||||
|
||||
<tag><tt>__CPU_HUC6280__</tt></tag>
|
||||
|
||||
This macro is defined if the code is compiled for a HUC6280 CPU.
|
||||
|
||||
<tag><tt>__CPU_ISET_6502__</tt></tag>
|
||||
|
||||
This macro expands to a numeric constant that can be used to check the
|
||||
<tt/<ref id="macro-CPU" name="__CPU__">/ macro for the instruction set
|
||||
of the 6502 CPU.
|
||||
|
||||
<tag><tt>__CPU_ISET_6502X__</tt></tag>
|
||||
|
||||
This macro expands to a numeric constant that can be used to check the
|
||||
<tt/<ref id="macro-CPU" name="__CPU__">/ macro for the instruction set
|
||||
of the 6502X CPU.
|
||||
|
||||
<tag><tt>__CPU_ISET_6502DTV__</tt></tag>
|
||||
|
||||
This macro expands to a numeric constant that can be used to check the
|
||||
<tt/<ref id="macro-CPU" name="__CPU__">/ macro for the instruction set
|
||||
of the 6502DTV CPU.
|
||||
|
||||
<tag><tt>__CPU_ISET_65SC02__</tt></tag>
|
||||
|
||||
This macro expands to a numeric constant that can be used to check the
|
||||
<tt/<ref id="macro-CPU" name="__CPU__">/ macro for the instruction set
|
||||
of the 65SC02 CPU.
|
||||
|
||||
<tag><tt>__CPU_ISET_65C02__</tt></tag>
|
||||
|
||||
This macro expands to a numeric constant that can be used to check the
|
||||
<tt/<ref id="macro-CPU" name="__CPU__">/ macro for the instruction set
|
||||
of the 65C02 CPU.
|
||||
|
||||
<tag><tt>__CPU_ISET_65816__</tt></tag>
|
||||
|
||||
This macro expands to a numeric constant that can be used to check the
|
||||
<tt/<ref id="macro-CPU" name="__CPU__">/ macro for the instruction set
|
||||
of the 65816 CPU.
|
||||
|
||||
<tag><tt>__CPU_ISET_HUC6280__</tt></tag>
|
||||
|
||||
This macro expands to a numeric constant that can be used to check the
|
||||
<tt/<ref id="macro-CPU" name="__CPU__">/ macro for the instruction set
|
||||
of the HUC6280 CPU.
|
||||
|
||||
<tag><tt>__CX16__</tt></tag>
|
||||
|
||||
This macro is defined if the target is the Commander X16 (-t cx16).
|
||||
@@ -1273,6 +1379,12 @@ If the first parameter is <tt/push/, the old value is saved onto a stack
|
||||
before changing it. The value may later be restored by using the <tt/pop/
|
||||
parameter with the <tt/#pragma/.
|
||||
|
||||
For all pragma names that contain hyphens, the same name using underlines
|
||||
instead of the hyphens is available as an alternative. While the former
|
||||
resembles the corresponding command line option and is more orthogonal, the
|
||||
latter may be more compatible with external tools that rewrite the token
|
||||
sequences of the input.
|
||||
|
||||
|
||||
<sect1><tt>#pragma allow-eager-inline ([push,] on|off)</tt><label id="pragma-allow-eager-inline"><p>
|
||||
|
||||
@@ -1358,7 +1470,7 @@ parameter with the <tt/#pragma/.
|
||||
Example:
|
||||
<tscreen><verb>
|
||||
/* Use a space wherever an 'a' occurs in ISO-8859-1 source */
|
||||
#pragma charmap (0x61, 0x20);
|
||||
#pragma charmap (0x61, 0x20)
|
||||
</verb></tscreen>
|
||||
|
||||
|
||||
@@ -1613,13 +1725,13 @@ parameter with the <tt/#pragma/.
|
||||
|
||||
This pragma sets a wrapper for functions, often used for trampolines.
|
||||
|
||||
The name is a function returning <tt/void/, and taking no parameters.
|
||||
The <tt/name/ is a wrapper function returning <tt/void/, and taking no parameters.
|
||||
It must preserve the CPU's <tt/A/ and <tt/X/ registers if it wraps any
|
||||
<tt/__fastcall__/ functions that have parameters. It must preserve
|
||||
the <tt/Y/ register if it wraps any variadic functions (they have "<tt/.../"
|
||||
in their prototypes).
|
||||
|
||||
The identifier is an 8-bit number that's set into <tt/tmp4/. If the identifier
|
||||
The <tt/identifier/ is an 8-bit number that's set into <tt/tmp4/. If the <tt/identifier/
|
||||
is "bank", then ca65's <tt><url url="ca65.html#.BANK" name=".bank"></tt> function will be used
|
||||
to determine the number from the bank attribute defined in the linker config,
|
||||
see <url url="ld65.html#MEMORY" name="Other MEMORY area attributes">. Note that
|
||||
@@ -1629,6 +1741,11 @@ parameter with the <tt/#pragma/.
|
||||
The address of a wrapped function is passed in <tt/ptr4/. The wrapper can
|
||||
call that function by using "<tt/jsr callptr4/".
|
||||
|
||||
All functions ever declared or defined when this pragma is in effect will be wrapped
|
||||
when they are called explicitly by their names later in the same translation unit.
|
||||
Invocation of these functions in any other ways, for example, that via a function
|
||||
pointer or in inline assembly code, will not be wrapped.
|
||||
|
||||
This feature is useful, for example, with banked memory, to switch banks
|
||||
automatically to where a wrapped function resides, and then to restore the
|
||||
previous bank when it returns.
|
||||
|
||||
@@ -19,7 +19,7 @@ the native format.
|
||||
|
||||
chrcvt65 is a vector font converter. It is able to convert a "BGI Stroked
|
||||
Font" to a compact TGI native vector font. See the function <url
|
||||
url="funcref.html#tgi_load_vectorfont" name="tgi_load_vectorfont"> for usage.
|
||||
url="tgi.html#tgi_load_vectorfont" name="tgi_load_vectorfont"> for usage.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -261,6 +261,9 @@ different options for different files on the command line. As an example.
|
||||
translates main.c with full optimization and module.c with less optimization
|
||||
and debug info enabled.
|
||||
|
||||
Note that the target system (-t , --target) must be specified before any file
|
||||
unless using the default target of c64
|
||||
|
||||
The type of an input file is derived from its extension:
|
||||
|
||||
<itemize>
|
||||
|
||||
@@ -140,7 +140,7 @@ FEATURES {
|
||||
|
||||
SYMBOLS {
|
||||
# Define the stack size for the application
|
||||
__STACKSIZE__: value = $0200, weak = yes;
|
||||
__STACKSIZE__: value = $0200, type = weak;
|
||||
}
|
||||
</code></tscreen>
|
||||
|
||||
|
||||
@@ -243,6 +243,12 @@ point to <tt/cx320p1.tgi (cx320p1_tgi)/.
|
||||
a way that's compatible with some of the other color drivers).
|
||||
</descrip><p>
|
||||
|
||||
<descrip>
|
||||
<tag><tt/cx640p1.tgi (cx640p1_tgi)/</tag>
|
||||
This driver features a resolution of 640 across and 480 down with 2 colors,
|
||||
black and white.
|
||||
</descrip><p>
|
||||
|
||||
|
||||
<sect1>Extended memory drivers<p>
|
||||
|
||||
|
||||
@@ -255,7 +255,7 @@ disassembler may be told to recognize either the 65SC02 or 65C02 CPUs. The
|
||||
latter understands the same opcodes as the former, plus 16 additional bit
|
||||
manipulation and bit test-and-branch commands. Using 6502x as CPU the illegal
|
||||
opcodes of 6502 CPU are detected and displayed. 6502dtv setting recognizes the
|
||||
emulated CPU instructons of the C64DTV device.
|
||||
emulated CPU instructions of the C64DTV device.
|
||||
|
||||
|
||||
When disassembling 4510 code, due to handling of 16-bit wide branches, da65
|
||||
|
||||
479
doc/funcref.sgml
479
doc/funcref.sgml
@@ -71,18 +71,21 @@ function.
|
||||
<item><ref id="detect_c64dtv" name="detect_c64dtv">
|
||||
<item><ref id="detect_c65" name="detect_c65">
|
||||
<item><ref id="detect_chameleon" name="detect_chameleon">
|
||||
<item><ref id="detect_iigs" name="detect_iigs">
|
||||
<item><ref id="detect_scpu" name="detect_scpu">
|
||||
<item><ref id="detect_turbomaster" name="detect_turbomaster">
|
||||
<item><ref id="get_c128_speed" name="get_c128_speed">
|
||||
<item><ref id="get_c64dtv_speed" name="get_c64dtv_speed">
|
||||
<item><ref id="get_c65_speed" name="get_c65_speed">
|
||||
<item><ref id="get_chameleon_speed" name="get_chameleon_speed">
|
||||
<item><ref id="get_iigs_speed" name="get_iigs_speed">
|
||||
<item><ref id="get_scpu_speed" name="get_scpu_speed">
|
||||
<item><ref id="get_turbomaster_speed" name="get_turbomaster_speed">
|
||||
<item><ref id="set_c128_speed" name="set_c128_speed">
|
||||
<item><ref id="set_c64dtv_speed" name="set_c64dtv_speed">
|
||||
<item><ref id="set_c65_speed" name="set_c65_speed">
|
||||
<item><ref id="set_chameleon_speed" name="set_chameleon_speed">
|
||||
<item><ref id="set_iigs_speed" name="set_iigs_speed">
|
||||
<item><ref id="set_scpu_speed" name="set_scpu_speed">
|
||||
<item><ref id="set_turbomaster_speed" name="set_turbomaster_speed">
|
||||
</itemize>
|
||||
@@ -92,8 +95,16 @@ function.
|
||||
|
||||
<itemize>
|
||||
<item>_dos_type
|
||||
<item>allow_lowercase
|
||||
<item><ref id="beep" name="beep">
|
||||
<item><ref id="dir_entry_count" name="dir_entry_count">
|
||||
<item><ref id="get_tv" name="get_tv">
|
||||
<item><ref id="get_ostype" name="get_ostype">
|
||||
<item><ref id="gmtime_dt" name="gmtime_dt">
|
||||
<item><ref id="mktime_dt" name="mktime_dt">
|
||||
<item>rebootafterexit
|
||||
<item><ref id="videomode" name="videomode">
|
||||
<item><ref id="waitvsync" name="waitvsync">
|
||||
</itemize>
|
||||
|
||||
|
||||
@@ -101,9 +112,15 @@ function.
|
||||
|
||||
<itemize>
|
||||
<item>_dos_type
|
||||
<item><ref id="beep" name="beep">
|
||||
<item><ref id="dir_entry_count" name="dir_entry_count">
|
||||
<item><ref id="get_tv" name="get_tv">
|
||||
<item><ref id="get_ostype" name="get_ostype">
|
||||
<item><ref id="gmtime_dt" name="gmtime_dt">
|
||||
<item><ref id="mktime_dt" name="mktime_dt">
|
||||
<item>rebootafterexit
|
||||
<item><ref id="videomode" name="videomode">
|
||||
<item><ref id="waitvsync" name="waitvsync">
|
||||
</itemize>
|
||||
|
||||
|
||||
@@ -128,7 +145,7 @@ function.
|
||||
<!-- <item><ref id="_setcolor_low" name="_setcolor_low"> -->
|
||||
<item><ref id="_sound" name="_sound">
|
||||
<item><ref id="get_ostype" name="get_ostype">
|
||||
<!-- <item><ref id="get_tv" name="get_tv"> -->
|
||||
<item><ref id="get_tv" name="get_tv">
|
||||
</itemize>
|
||||
|
||||
(incomplete)
|
||||
@@ -145,6 +162,7 @@ function.
|
||||
<item><ref id="atmos_tick" name="atmos_tick">
|
||||
<item><ref id="atmos_tock" name="atmos_tock">
|
||||
<item><ref id="atmos_zap" name="atmos_zap">
|
||||
<item><ref id="waitvsync" name="waitvsync">
|
||||
</itemize>
|
||||
|
||||
|
||||
@@ -214,7 +232,7 @@ function.
|
||||
<!-- <item><ref id="cbm_readdir" name="cbm_readdir"> -->
|
||||
<!-- <item><ref id="cbm_save" name="cbm_save"> -->
|
||||
<!-- <item><ref id="cbm_write" name="cbm_write"> -->
|
||||
<!-- <item><ref id="get_tv" name="get_tv"> -->
|
||||
<item><ref id="get_tv" name="get_tv">
|
||||
<item><ref id="kbrepeat" name="kbrepeat">
|
||||
<item><ref id="waitvsync" name="waitvsync">
|
||||
</itemize>
|
||||
@@ -335,7 +353,7 @@ function.
|
||||
<itemize>
|
||||
<!-- <item><ref id="get_numbanks" name="get_numbanks"> -->
|
||||
<item><ref id="get_ostype" name="get_ostype">
|
||||
<!-- <item><ref id="get_tv" name="get_tv"> -->
|
||||
<item><ref id="get_tv" name="get_tv">
|
||||
<!-- <item><ref id="set_tv" name="set_tv"> -->
|
||||
<!-- <item><ref id="vera_layer_enable" name="vera_layer_enable"> -->
|
||||
<!-- <item><ref id="vera_sprites_enable" name="vera_sprites_enable"> -->
|
||||
@@ -430,7 +448,7 @@ see also <tt>testcode/lib/em-test.c</tt> and <tt>samples/multidemo.c</tt>.
|
||||
<sect1><tt/gamate.h/<label id="gamate.h"><p>
|
||||
|
||||
<itemize>
|
||||
<!-- <item><ref id="get_tv" name="get_tv"> -->
|
||||
<item><ref id="get_tv" name="get_tv">
|
||||
<item><ref id="waitvsync" name="waitvsync">
|
||||
</itemize>
|
||||
|
||||
@@ -506,6 +524,14 @@ see also <tt>testcode/lib/em-test.c</tt> and <tt>samples/multidemo.c</tt>.
|
||||
</itemize>
|
||||
|
||||
|
||||
<sect1><tt/lzsa.h/<label id="lzsa.h"><p>
|
||||
|
||||
<itemize>
|
||||
<item><ref id="decompress_lzsa1" name="decompress_lzsa1">
|
||||
<item><ref id="decompress_lzsa2" name="decompress_lzsa2">
|
||||
</itemize>
|
||||
|
||||
|
||||
<sect1><tt/modload.h/<label id="modload.h"><p>
|
||||
|
||||
<itemize>
|
||||
@@ -537,7 +563,7 @@ see also <tt>testcode/lib/em-test.c</tt> and <tt>samples/multidemo.c</tt>.
|
||||
<sect1><tt/nes.h/<label id="nes.h"><p>
|
||||
|
||||
<itemize>
|
||||
<!-- <item><ref id="get_tv" name="get_tv"> -->
|
||||
<item><ref id="get_tv" name="get_tv">
|
||||
<item><ref id="waitvsync" name="waitvsync">
|
||||
</itemize>
|
||||
|
||||
@@ -555,7 +581,7 @@ It does not declare any functions.
|
||||
<sect1><tt/pce.h/<label id="pce.h"><p>
|
||||
|
||||
<itemize>
|
||||
<!-- <item><ref id="get_tv" name="get_tv"> -->
|
||||
<item><ref id="get_tv" name="get_tv">
|
||||
<item><ref id="waitvsync" name="waitvsync">
|
||||
</itemize>
|
||||
|
||||
@@ -725,7 +751,7 @@ communication, see also <tt>testcode/lib/ser-test.c</tt>.
|
||||
<item><ref id="ltoa" name="ltoa">
|
||||
<item><ref id="malloc" name="malloc">
|
||||
<item><ref id="perror" name="perror">
|
||||
<!-- <item><ref id="posix_memalign" name="posix_memalign"> -->
|
||||
<item><ref id="posix_memalign" name="posix_memalign">
|
||||
<!-- <item><ref id="putenv" name="putenv"> -->
|
||||
<item><ref id="qsort" name="qsort">
|
||||
<item><ref id="rand" name="rand">
|
||||
@@ -771,6 +797,7 @@ communication, see also <tt>testcode/lib/ser-test.c</tt>.
|
||||
<item><ref id="strqtok" name="strqtok">
|
||||
<item><ref id="strrchr" name="strrchr">
|
||||
<item><ref id="strspn" name="strspn">
|
||||
<item><ref id="strcasestr" name="strcasestr">
|
||||
<item><ref id="strstr" name="strstr">
|
||||
<item><ref id="strtok" name="strtok">
|
||||
<item><ref id="strxfrm" name="strxfrm">
|
||||
@@ -846,6 +873,20 @@ communication, see also <tt>testcode/lib/ser-test.c</tt>.
|
||||
(incomplete)
|
||||
|
||||
|
||||
<sect1><tt/stat.h/<label id="sys/stat.h"><p>
|
||||
|
||||
<itemize>
|
||||
<item><ref id="stat" name="stat">
|
||||
</itemize>
|
||||
|
||||
|
||||
<sect1><tt/statvfs.h/<label id="sys/statvfs.h"><p>
|
||||
|
||||
<itemize>
|
||||
<item><ref id="statvfs" name="statvfs">
|
||||
</itemize>
|
||||
|
||||
|
||||
<sect1><tt/vic20.h/<label id="vic20.h"><p>
|
||||
|
||||
(incomplete)
|
||||
@@ -863,6 +904,13 @@ communication, see also <tt>testcode/lib/ser-test.c</tt>.
|
||||
(incomplete)
|
||||
|
||||
|
||||
<sect1><tt/zx02.h/<label id="zx02.h"><p>
|
||||
|
||||
<itemize>
|
||||
<item><ref id="decompress_zx02" name="decompress_zx02">
|
||||
</itemize>
|
||||
|
||||
|
||||
<sect>Alphabetical function reference<p>
|
||||
|
||||
<sect1>_DE_ISDIR<label id="_DE_ISDIR"><p>
|
||||
@@ -1750,10 +1798,11 @@ used in presence of a prototype.
|
||||
<descrip>
|
||||
<tag/Function/Beep sound.
|
||||
<tag/Header/<tt/<ref id="sym1.h" name="sym1.h">/
|
||||
<tag/Header/<tt/<ref id="apple2.h" name="apple2.h">/
|
||||
<tag/Declaration/<tt/void beep(void);/
|
||||
<tag/Description/<tt/beep/ makes a brief tone.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is specific to the Sym-1.
|
||||
<item>The function is specific to the Sym-1 and Apple2 platforms.
|
||||
</itemize>
|
||||
<tag/Availability/cc65
|
||||
<tag/See also/
|
||||
@@ -2407,7 +2456,7 @@ the address must first be ORed with $60.
|
||||
<tag/Availability/cc65
|
||||
<tag/See also/
|
||||
<ref id="cbm_k_listen" name="cbm_k_listen">
|
||||
<tag/Exampe/None.
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
@@ -2851,6 +2900,79 @@ setting the time may not work. See also the platform-specific information.
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>gmtime_dt<label id="gmtime_dt"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Converts a ProDOS date to a struct tm.
|
||||
<tag/Header/<tt/<ref id="apple2.h" name="apple2.h">/
|
||||
<tag/Declaration/<tt/struct tm* __fastcall__ gmtime_dt (const struct datetime* dt);/
|
||||
<tag/Description/The <tt/gmtime_dt/ function converts the given
|
||||
proDOS date/time to a struct tm. On error, NULL is returned and <tt/errno/ is set
|
||||
to an error code describing the reason for the failure.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is only available as fastcall function, so it may only
|
||||
be used in presence of a prototype.
|
||||
<item>This function is only available on Apple II.
|
||||
<item>On Apple II, you can't stat() an opened file. stat() before opening.
|
||||
</itemize>
|
||||
<tag/Availability/cc65
|
||||
<tag/Example/
|
||||
<verb>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <sys/stat.h>
|
||||
int main(void)
|
||||
{
|
||||
struct stat st;
|
||||
struct tm* tm;
|
||||
if (stat ("/disk/file", &st) == 0) {
|
||||
tm = gmtime_dt (&st.st_ctime);
|
||||
if (tm)
|
||||
printf ("File created on %s\n", asctime(tm));
|
||||
}
|
||||
}
|
||||
</verb>
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>mktime_dt<label id="mktime_dt"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Converts a ProDOS date to a time_t.
|
||||
<tag/Header/<tt/<ref id="apple2.h" name="apple2.h">/
|
||||
<tag/Declaration/<tt/time_t __fastcall__ mktime_dt (const struct datetime* dt);/
|
||||
<tag/Description/The <tt/mktime_dt/ function parses the given
|
||||
proDOS date/time and returns a time_t timestamp. On error, 0 is returned,
|
||||
and errno is set.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is only available as fastcall function, so it may only
|
||||
be used in presence of a prototype.
|
||||
<item>This function is only available on Apple II.
|
||||
</itemize>
|
||||
<tag/Availability/cc65
|
||||
<tag/Example/
|
||||
<verb>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <sys/stat.h>
|
||||
int main(void)
|
||||
{
|
||||
struct stat st;
|
||||
if (stat ("/disk/file", &st) == 0) {
|
||||
printf ("File created on %s\n",
|
||||
localtime (mktime_dt (&st.st_ctime)));
|
||||
}
|
||||
}
|
||||
</verb>
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>clrscr<label id="clrscr"><p>
|
||||
|
||||
<quote>
|
||||
@@ -3277,6 +3399,70 @@ used in presence of a prototype.
|
||||
<tag/Description/<tt/decompress_lz4/ uncompresses a LZ4-compressed buffer.
|
||||
<tag/Notes/<itemize>
|
||||
<item>Use LZ4_compress_HC with compression level 16 for best compression.
|
||||
<item>Your program will need to know the uncompressed size of the buffer as
|
||||
there is no end-of-stream marker.
|
||||
<item>LZ4 is the biggest and second-slowest decompressor shipped in cc65 runtime.
|
||||
It is also the least efficient compression algorithm.
|
||||
</itemize>
|
||||
<tag/Availability/cc65
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>decompress_lzsa1<label id="decompress_lzsa1"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Uncompress a LZSA buffer with format 1.
|
||||
<tag/Header/<tt/<ref id="lzsa.h" name="lzsa.h">/
|
||||
<tag/Declaration/<tt/void decompress_lzsa1 (const unsigned char* src, unsigned char* const dst);/
|
||||
<tag/Description/<tt/decompress_lz4/ uncompresses a LZSA buffer with format 1.
|
||||
<tag/Notes/<itemize>
|
||||
<item>Use <tt/lzsa -f 1 -r input.bin output.lzsa1/ to compress your input.
|
||||
<item>The project and compressor can be found at <url url="https://github.com/emmanuel-marty/lzsa">
|
||||
<item>LZSA1 is the fastest decompressor shipped in cc65 runtime, but data is less
|
||||
compressed than with LZSA2 and ZX02.
|
||||
</itemize>
|
||||
<tag/Availability/cc65
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>decompress_lzsa2<label id="decompress_lzsa2"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Uncompress a LZSA buffer with format 2.
|
||||
<tag/Header/<tt/<ref id="lzsa.h" name="lzsa.h">/
|
||||
<tag/Declaration/<tt/void decompress_lzsa2 (const unsigned char* src, unsigned char* const dst);/
|
||||
<tag/Description/<tt/decompress_lz4/ uncompresses a LZSA buffer with format 2.
|
||||
<tag/Notes/<itemize>
|
||||
<item>Use <tt/lzsa -f 2 -r input.bin output.lzsa2/ to compress your input.
|
||||
<item>The project and compressor can be found at <url url="https://github.com/emmanuel-marty/lzsa">
|
||||
<item>LZSA2 is the second fastest decompressor shipped in cc65 runtime, but data is less
|
||||
compressed than with ZX02.
|
||||
</itemize>
|
||||
<tag/Availability/cc65
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>decompress_zx02<label id="decompress_zx02"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Uncompress a ZX02 buffer.
|
||||
<tag/Header/<tt/<ref id="zx02.h" name="zx02.h">/
|
||||
<tag/Declaration/<tt/void decompress_zx02 (const unsigned char* src, unsigned char* const dst);/
|
||||
<tag/Description/<tt/decompress_zx02/ uncompresses a ZX02 buffer with format 2.
|
||||
<tag/Notes/<itemize>
|
||||
<item>Use <tt/zx02 input.bin output.zx02/ to compress your input.
|
||||
<item>The project and compressor can be found at <url url="https://github.com/dmsc/zx02">
|
||||
<item>ZX02 is the slowest decompressor shipped with cc65 runtime, but is also the
|
||||
smallest and has the best compression ratio.
|
||||
</itemize>
|
||||
<tag/Availability/cc65
|
||||
<tag/Example/None.
|
||||
@@ -3364,6 +3550,26 @@ used in presence of a prototype.
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>detect_iigs<label id="detect_iigs"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Check whether we are running on an Apple IIgs..
|
||||
<tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
|
||||
<tag/Declaration/<tt/unsigned char detect_iigs (void);/
|
||||
<tag/Description/The function returns a 1 if running on an Apple IIgs.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is specific to the Apple2 and Apple2enh platforms.
|
||||
</itemize>
|
||||
<tag/Availability/cc65 (not all platforms)
|
||||
<tag/See also/
|
||||
<ref id="get_iigs_speed" name="get_iigs_speed">,
|
||||
<ref id="set_iigs_speed" name="set_iigs_speed">,
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>detect_scpu<label id="detect_scpu"><p>
|
||||
|
||||
<quote>
|
||||
@@ -3404,6 +3610,25 @@ used in presence of a prototype.
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>dir_entry_count<label id="dir_entry_count"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Returns the number of entries in the directory.
|
||||
<tag/Header/<tt/<ref id="apple2.h" name="apple2.h">/
|
||||
<tag/Declaration/<tt/unsigned int __fastcall__ dir_entry_count(DIR *dir);/
|
||||
<tag/Description/<tt/dir_entry_count/ is machine dependent and does not exist for
|
||||
all supported targets. If it exists, it returns the number of active
|
||||
(non-deleted) files and directories in the directory.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function does not exist on all platforms.
|
||||
</itemize>
|
||||
<tag/Availability/cc65 (not all platforms)
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>div<label id="div"><p>
|
||||
|
||||
<quote>
|
||||
@@ -3967,6 +4192,31 @@ be used in presence of a prototype.
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>get_tv<label id="get_tv"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/The function returns the system's vertical blank frequency.
|
||||
<tag/Header/<tt/<ref id="apple2.h" name="apple2.h">,
|
||||
<ref id="atari.h" name="atari.h">, <ref id="cbm.h" name="cbm.h">,
|
||||
<ref id="cx16.h" name="cx16.h">, <ref id="gamate.h" name="gamate.h">,
|
||||
<ref id="nes.h" name="nes.h">, <ref id="pce.h" name="pce.h">/
|
||||
<tag/Declaration/<tt/unsigned char get_tv (void);/
|
||||
<tag/Description/<tt/get_tv/ is machine dependent and does not exist for
|
||||
all supported targets. If it exists, it returns a number that identifies the
|
||||
frequency at which the screen vertical blank happens (either 50 or 60Hz),
|
||||
if possible.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function does not exist on all platforms.
|
||||
<item>Return TV_NTSC for 60Hz systems, TV_PAL for 50Hz systems, or
|
||||
TV_OTHER if the scan frequency can not be determined.
|
||||
</itemize>
|
||||
<tag/Availability/cc65 (not all platforms)
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>get_ostype<label id="get_ostype"><p>
|
||||
|
||||
<quote>
|
||||
@@ -4078,6 +4328,27 @@ header files define constants that can be used to check the return code.
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>get_iigs_speed<label id="get_iigs_speed"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Get the current speed of the Apple IIgs.
|
||||
<tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
|
||||
<tag/Declaration/<tt/unsigned char get_iigs_speed (void);/
|
||||
<tag/Description/The function returns the current speed of the Apple IIgs.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is specific to the Apple2 and Apple2enh platforms.
|
||||
<item>See the accelerator.h header for the speed definitions.
|
||||
</itemize>
|
||||
<tag/Availability/cc65 (not all platforms)
|
||||
<tag/See also/
|
||||
<ref id="detect_iigs" name="detect_iigs">,
|
||||
<ref id="set_iigs_speed" name="set_iigs_speed">,
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>get_scpu_speed<label id="get_scpu_speed"><p>
|
||||
|
||||
<quote>
|
||||
@@ -6061,6 +6332,32 @@ be used in presence of a prototype.
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>posix_memalign<label id="posix_memalign"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Allocate aligned dynamic memory.
|
||||
<tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
|
||||
<tag/Declaration/<tt/int __fastcall__ posix_memalign (void** memptr, size_t alignment, size_t size);/
|
||||
<tag/Description/Allocate a block of memory with the given "size", which is aligned to a
|
||||
memory address that is a multiple of "alignment". "alignment" <em/must not/ be
|
||||
zero, and <em/must/ be a power of two; otherwise, this function will return
|
||||
EINVAL. The function returns ENOMEM if not enough memory is available
|
||||
to satisfy the request. "memptr" must point to a variable; that variable
|
||||
will return the address of the allocated memory. Use free() to release that
|
||||
allocated block.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is only available as fastcall function, so it may only
|
||||
be used in presence of a prototype.
|
||||
</itemize>
|
||||
<tag/Availability/POSIX 1003.1
|
||||
<tag/See also/
|
||||
<ref id="free" name="free">
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>psg_delay<label id="psg_delay"><p>
|
||||
|
||||
<quote>
|
||||
@@ -6229,6 +6526,9 @@ be used in presence of a prototype.
|
||||
<item>The returned pointer may point to a statically allocated instance of
|
||||
<tt/struct dirent/, so it may get overwritten by subsequent calls to
|
||||
<tt/readdir/.
|
||||
<item>On the Apple II platform, the d_ctime and d_mtime returned are in the
|
||||
ProDOS format. You can convert them to more portable time representations using
|
||||
the ProDOS datetime conversion functions.
|
||||
<item>On several platforms, namely the CBMs and the Atari, the disk drives get
|
||||
confused when opening/closing files between directory reads. So for example a
|
||||
program that reads the list of files on a disk, and after each call to
|
||||
@@ -6893,6 +7193,30 @@ clean-up when exiting the program.
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>set_iigs_speed<label id="set_iigs_speed"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Set the current speed of the Apple IIgs.
|
||||
<tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
|
||||
<tag/Declaration/<tt/unsigned char __fastcall__ set_iigs_speed (unsigned char speed);/
|
||||
<tag/Description/The function sets the speed of the Apple IIgs CPU (and returns
|
||||
the new speed).
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is specific to the Apple2 and Apple2enh platforms.
|
||||
<item>See the accelerator.h header for the speed definitions.
|
||||
<item>Accepted parameters are SPEED_SLOW and SPEED_FAST (all other values are
|
||||
considered SPEED_FAST).
|
||||
</itemize>
|
||||
<tag/Availability/cc65 (not all platforms)
|
||||
<tag/See also/
|
||||
<ref id="detect_iigs" name="detect_iigs">,
|
||||
<ref id="get_iigs_speed" name="get_iigs_speed">,
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>set_scpu_speed<label id="set_scpu_speed"><p>
|
||||
|
||||
<quote>
|
||||
@@ -7075,6 +7399,85 @@ be used in presence of a prototype.
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>stat<label id="stat"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Get file status.
|
||||
<tag/Header/<tt/<ref id="sys/stat.h" name="sys/stat.h">/
|
||||
<tag/Declaration/<tt/int __fastcall__ stat (const char* pathname, struct stat* statbuf);/
|
||||
<tag/Description/<tt/stat/ gets information for the file with the given name. On success,
|
||||
zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
|
||||
code describing the reason for the failure.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is only available as fastcall function, so it may only
|
||||
be used in presence of a prototype.
|
||||
<item>On the Apple II platform, the st_ctim, st_mtim and st_atim members are left
|
||||
to zero, for size and performance reasons. The ProDOS creation and modification dates
|
||||
are returned in the ProDOS format in st_ctime and st_mtime. The access date does
|
||||
not exist. You can convert them to POSIX-style time representations using
|
||||
the <url url="apple2.html#ss9.3" name="ProDOS datetime conversion functions">.
|
||||
</itemize>
|
||||
<tag/Availability/POSIX 1003.1
|
||||
<tag/See also/
|
||||
<ref id="statvfs" name="statvfs">
|
||||
<tag/Example/
|
||||
<verb>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#define FILENAME "helloworld"
|
||||
struct stat stbuf;
|
||||
if (stat (FILENAME, &stbuf) == 0) {
|
||||
printf ("%s size is %lu bytes (created on %s)\n", FILENAME, stbuf.st_size,
|
||||
#ifndef __APPLE2__
|
||||
localtime (&stbuf.st_ctim.tv_sec)
|
||||
#else
|
||||
localtime (mktime_dt (&stbuf.st_ctime))
|
||||
#endif
|
||||
);
|
||||
} else {
|
||||
printf ("There was a problem stat'ing %s: %d\n", FILENAME, errno);
|
||||
}
|
||||
</verb>
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>statvfs<label id="statvfs"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Get filesystem statistics.
|
||||
<tag/Header/<tt/<ref id="sys/statvfs.h" name="sys/statvfs.h">/
|
||||
<tag/Declaration/<tt/int __fastcall__ statvfs (const char* pathname, struct statvfs* buf);/
|
||||
<tag/Description/<tt/statvfs/ gets information for the filesystem on which the given file
|
||||
resides. On success,
|
||||
zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
|
||||
code describing the reason for the failure.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is only available as fastcall function, so it may only
|
||||
be used in presence of a prototype.
|
||||
<item>The function requires an absolute pathname.
|
||||
</itemize>
|
||||
<tag/Availability/POSIX 1003.1
|
||||
<tag/See also/
|
||||
<ref id="stat" name="stat">
|
||||
<tag/Example/
|
||||
<verb>
|
||||
#include <sys/statvfs.h>
|
||||
|
||||
#define FILENAME "/disk/helloworld"
|
||||
struct statvfs stvbuf;
|
||||
if (statvfs (FILENAME, &stvbuf) == 0) {
|
||||
printf ("%s filesystem has %u blocks of %u size, %u of them free.\n", FILENAME, stvbuf.f_blocks, stvbuf.f_bsize, stvbuf.f_bfree);
|
||||
} else {
|
||||
printf ("There was a problem statvfs'ing %s: %d\n", FILENAME, errno);
|
||||
}
|
||||
</verb>
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>strcasecmp<label id="strcasecmp"><p>
|
||||
|
||||
<quote>
|
||||
@@ -7655,22 +8058,47 @@ be used in presence of a prototype.
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>strstr<label id="strstr"><p>
|
||||
<sect1>strcasestr<label id="strcasestr"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Find a substring.
|
||||
<tag/Function/Find a substring, case-insensitive.
|
||||
<tag/Header/<tt/<ref id="string.h" name="string.h">/
|
||||
<tag/Declaration/<tt/char* __fastcall__ strstr (const char* str, const char* substr);/
|
||||
<tag/Description/<tt/strstr/ searches for the first occurrence of the string
|
||||
<tt/substr/ within <tt/str/. If found, it returns a pointer to the copy,
|
||||
otherwise it returns <tt/NULL/.
|
||||
<tag/Declaration/<tt/char* __fastcall__ strcasestr (const char* str, const char* substr);/
|
||||
<tag/Description/<tt/strcasestr/ searches for the first occurrence of the string
|
||||
<tt/substr/ within <tt/str/. If found, it returns a pointer to the start of the
|
||||
match in <tt/str/, otherwise it returns <tt/NULL/.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is only available as fastcall function, so it may only
|
||||
be used in presence of a prototype.
|
||||
</itemize>
|
||||
<tag/Availability/ISO 9899
|
||||
<tag/See also/
|
||||
<ref id="strstr" name="strstr">,
|
||||
<ref id="strcspn" name="strcspn">,
|
||||
<ref id="strspn" name="strspn">
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>strstr<label id="strstr"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Find a substring, case-sensitive.
|
||||
<tag/Header/<tt/<ref id="string.h" name="string.h">/
|
||||
<tag/Declaration/<tt/char* __fastcall__ strstr (const char* str, const char* substr);/
|
||||
<tag/Description/<tt/strstr/ searches for the first occurrence of the string
|
||||
<tt/substr/ within <tt/str/. If found, it returns a pointer to the start of the
|
||||
match in <tt/str/, otherwise it returns <tt/NULL/.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is only available as fastcall function, so it may only
|
||||
be used in presence of a prototype.
|
||||
</itemize>
|
||||
<tag/Availability/ISO 9899
|
||||
<tag/See also/
|
||||
<ref id="strcasestr" name="strcasestr">,
|
||||
<ref id="strcspn" name="strcspn">,
|
||||
<ref id="strspn" name="strspn">
|
||||
<tag/Example/None.
|
||||
@@ -8052,24 +8480,27 @@ used in presence of a prototype.
|
||||
<tag/Function/Switch to either 40- or 80-column text mode, or a standard
|
||||
graphics mode.
|
||||
<tag/Header/<tt/
|
||||
<ref id="apple2.h" name="apple2.h">,
|
||||
<ref id="apple2enh.h" name="apple2enh.h">,
|
||||
<ref id="c128.h" name="c128.h">,
|
||||
<ref id="cx16.h" name="cx16.h">/
|
||||
<tag/Declaration/
|
||||
<tt>unsigned __fastcall__ videomode (unsigned Mode); /* for apple2enh and c128 */</tt><newline>
|
||||
<tt>signed char __fastcall__ videomode (signed char Mode); /* for cx16 */</tt>
|
||||
<tt>unsigned __fastcall__ videomode (unsigned Mode); /* for c128 */</tt><newline>
|
||||
<tt>signed char __fastcall__ videomode (signed char Mode); /* for apple2 and cx16 */</tt>
|
||||
<tag/Description/Switch to a 40- or 80-column text or graphics mode, depending
|
||||
on the argument. If the requested mode is already active, nothing happens. The
|
||||
old mode is returned from the call.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is specific to the Commodore 128, the enhanced Apple //e,
|
||||
<item>The function is specific to the Commodore 128, the Apple II,
|
||||
and the Commander X16.
|
||||
<item>This function replaces <ref id="toggle_videomode"
|
||||
name="toggle_videomode">.
|
||||
<item>The function is available as only a fastcall function, so it may be used
|
||||
only in the presence of a prototype.
|
||||
<item>On Apple II, this functions returns the previously active video mode, or -1
|
||||
if the mode is not supported due to lack of hardware.
|
||||
</itemize>
|
||||
<tag/Availability/C128, enhanced Apple //e, and CX16
|
||||
<tag/Availability/C128, Apple II, and CX16
|
||||
<tag/See also/
|
||||
<ref id="fast" name="fast">,
|
||||
<ref id="isfast" name="isfast">,
|
||||
@@ -8087,13 +8518,21 @@ only in the presence of a prototype.
|
||||
<descrip>
|
||||
<tag/Function/Wait until the start of the next video frame.
|
||||
<tag/Header/<tt/
|
||||
<ref id="apple2.h" name="apple2.h">,
|
||||
<ref id="atmos.h" name="atmos.h">,
|
||||
<ref id="cbm.h" name="cbm.h">,
|
||||
<ref id="gamate.h" name="gamate.h">,
|
||||
<ref id="nes.h" name="nes.h">,
|
||||
<ref id="pce.h" name="pce.h">/
|
||||
<tag/Declaration/<tt/void waitvsync (void);/
|
||||
<tag/Declaration/
|
||||
<tt>void waitvsync (void);</tt><newline>
|
||||
<tag/Description/Wait for vertical sync, to reduce flickering.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function will silently fail when the feature is not
|
||||
supported, like on the Apple ][+.
|
||||
</itemize>
|
||||
<tag/Availability/Platforms served by the headers above
|
||||
(Atmos requires the VSync hack)
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
196
doc/ld65.sgml
196
doc/ld65.sgml
@@ -1180,6 +1180,202 @@ The ZPSAVE segment contains the original values of the zeropage locations used
|
||||
by the ZEROPAGE segment. It is placed in its own segment because it must not be
|
||||
initialized.
|
||||
|
||||
<sect>Debug Info<p>
|
||||
|
||||
The debug info and the API mirrors closely the items available in the sources
|
||||
used to build an executable. To use the API efficiently, it is necessary to
|
||||
understand from which blocks the information is built.
|
||||
|
||||
<itemize>
|
||||
<item> Libraries
|
||||
<item> Lines
|
||||
<item> Modules
|
||||
<item> Scopes
|
||||
<item> Segments
|
||||
<item> Source files
|
||||
<item> Spans
|
||||
<item> Symbols
|
||||
<item> Types
|
||||
</itemize>
|
||||
|
||||
Each item of each type has something like a primary index called an 'id'.
|
||||
The ids can be thought of as array indices, so looking up something by its
|
||||
id is fast. Invalid ids are marked with the special value CC65_INV_ID.
|
||||
Data passed back for an item may contain ids of other objects. A scope for
|
||||
example contains the id of the parent scope (or CC65_INV_ID if there is no
|
||||
parent scope). Most API functions use ids to lookup related objects.
|
||||
|
||||
|
||||
<sect1>Libraries<p>
|
||||
|
||||
This information comes from the linker and is currently used in only one
|
||||
place:To mark the origin of a module. The information available for a library
|
||||
is its name including the path.
|
||||
|
||||
<itemize>
|
||||
<item> Library id
|
||||
<item> Name and path of library
|
||||
</itemize>
|
||||
|
||||
|
||||
<sect1>Lines<p>
|
||||
|
||||
A line is a location in a source file. It is module dependent, which means
|
||||
that if two modules use the same source file, each one has its own line
|
||||
information for this file. While the assembler has also column information,
|
||||
it is dropped early because it would generate much more data. A line may have
|
||||
one or more spans attached if code or data is generated.
|
||||
|
||||
<itemize>
|
||||
<item> Line id
|
||||
<item> Id of the source file, the line is from
|
||||
<item> The line number in the file (starting with 1)
|
||||
<item> The type of the line: Assembler/C source or macro
|
||||
<item> A count for recursive macros if the line comes from a macro
|
||||
</itemize>
|
||||
|
||||
|
||||
<sect1>Modules<p>
|
||||
|
||||
A module is actually an object file. It is generated from one or more source
|
||||
files and may come from a library. The assembler generates a main scope for
|
||||
symbols declared outside user generated scopes. The main scope has an empty name.
|
||||
|
||||
<itemize>
|
||||
<item> Module id
|
||||
<item> The name of the module including the path
|
||||
<item> The id of the main source file (the one specified on the command line)
|
||||
<item> The id of the library the module comes from, or CC65_INV_ID
|
||||
<item> The id of the main scope for this module
|
||||
</itemize>
|
||||
|
||||
|
||||
<sect1>Scopes<p>
|
||||
|
||||
Each module has a main scope where all symbols live, that are specified outside
|
||||
other scopes. Additional nested scopes may be specified in the sources. So scopes
|
||||
have a one to many relation: Each scope (with the exception of the main scope) has
|
||||
exactly one parent and may have several child scopes. Scopes may not cross modules.
|
||||
|
||||
<itemize>
|
||||
<item> Scope id
|
||||
<item> The name of the scope (may be empty)
|
||||
<item> The type of the scope: Module, .SCOPE or .PROC, .STRUCT and .ENUM
|
||||
<item> The size of the scope (the size of the span for the active segment)
|
||||
<item> The id of the parent scope (CC65_INV_ID in case of the main scope)
|
||||
<item> The id of the attached symbol for .PROC scopes
|
||||
<item> The id of the module where the scope comes from
|
||||
</itemize>
|
||||
|
||||
|
||||
<sect1>Segment Info<p>
|
||||
|
||||
<itemize>
|
||||
<item> Segment id
|
||||
<item> The name of the segment
|
||||
<item> The start address of the segment
|
||||
<item> The size of the segment
|
||||
<item> The name of the output file, this segment was written to (may be empty)
|
||||
<item> The offset of the segment in the output file (only if name not empty)
|
||||
<item> The bank number of the segment's memory area
|
||||
</itemize>
|
||||
|
||||
It is also possible to retrieve the spans for sections (a section is the part of a
|
||||
segment that comes from one module). Since the main scope covers a whole module, and
|
||||
the main scope has spans assigned (if not empty), the spans for the main scope of a
|
||||
module are also the spans for the sections in the segments.
|
||||
|
||||
|
||||
<sect1>Source files<p>
|
||||
|
||||
Modules are generated from source files. Since some source files are used several times
|
||||
when generating a list of modules (header files for example), the linker will merge
|
||||
duplicates to reduce redundant information. Source files are considered identical if the
|
||||
full name including the path is identical, and the size and time of last modification
|
||||
matches. Please note that there may be still duplicates if files are accessed using
|
||||
different paths.
|
||||
|
||||
<itemize>
|
||||
<item> Source file id
|
||||
<item> The name of the source file including the path
|
||||
<item> The size of the file at the time when it was read
|
||||
<item> The time of last modification at the time when the file was read
|
||||
</itemize>
|
||||
|
||||
|
||||
<sect1>Spans<p>
|
||||
|
||||
A span is a small part of a segment. It has a start address and a size. Spans are used
|
||||
to record sizes of other objects. Line infos and scopes may have spans attached, so it
|
||||
is possible to lookup which data was generated for these items.
|
||||
|
||||
<itemize>
|
||||
<item> Span id
|
||||
<item> The start address of the span. This is an absolute address
|
||||
<item> The end address of the span. This is inclusive which means if start==end then => size==1
|
||||
<item> The id of the segment were the span is located
|
||||
<item> The type of the data in the span (optional, maybe NULL)
|
||||
<item> The number of line infos available for this span
|
||||
<item> The number of scope infos available for this span
|
||||
</itemize>
|
||||
|
||||
The last two fields will save a call to cc65_line_byspan or cc65_scope_byspan by providing
|
||||
information about the number of items that can be retrieved by these calls.
|
||||
|
||||
|
||||
<sect1>Symbols<p>
|
||||
|
||||
<itemize>
|
||||
<item> Symbol id
|
||||
<item> The name of the symbol
|
||||
<item> The type of the symbol, which may be label, equate or import
|
||||
<item> The size of the symbol (size of attached code or data). Only for labels. Zero if unknown
|
||||
<item> The value of the symbol. For an import, this is taken from the corresponding export
|
||||
<item> The id of the corresponding export. Only valid for imports, CC65_INV_ID for other symbols
|
||||
<item> The segment id if the symbol is segment based. For an import, taken from the export
|
||||
<item> The id of the scope this symbols was defined in
|
||||
<item> The id of the parent symbol. This is only set for cheap locals and CC65_INV_ID otherwise
|
||||
</itemize>
|
||||
|
||||
Beware: Even for an import, the id of the corresponding export may be CC65_INV_ID.
|
||||
This happens if the module with the export has no debug information. So make sure
|
||||
that your application can handle it.
|
||||
|
||||
|
||||
<sect1>Types<p>
|
||||
|
||||
A type is somewhat special. You cannot retrieve data about it in a similar way as with the other
|
||||
items. Instead you have to call a special routine that parses the type data and returns it
|
||||
in a set of data structures that can be processed by a C or C++ program.
|
||||
|
||||
The type information is language independent and doesn't encode things like 'const' or
|
||||
'volatile'. Instead it defines a set of simple data types and a few ways to aggregate
|
||||
them (arrays, structs and unions).
|
||||
|
||||
Type information is currently generated by the assembler for storage allocating commands
|
||||
like .BYTE or .WORD. For example, the assembler code
|
||||
|
||||
<tscreen><verb>
|
||||
foo: .byte $01, $02, $03
|
||||
</verb></tscreen>
|
||||
|
||||
will assign the symbol foo a size of 3, but will also generate a span with a size of 3
|
||||
bytes and a type ARRAY[3] OF BYTE.
|
||||
Evaluating the type of a span allows a debugger to display the data in the same way as it
|
||||
was defined in the assembler source.
|
||||
|
||||
<table>
|
||||
<tabular ca="clc">
|
||||
<bf/Assembler Command/| <bf/Generated Type Information/@<hline>
|
||||
.ADDR| ARRAY OF LITTLE ENDIAN POINTER WITH SIZE 2 TO VOID@
|
||||
.BYTE| ARRAY OF UNSIGNED WITH SIZE 1@
|
||||
.DBYT| ARRAY OF BIG ENDIAN UNSIGNED WITH SIZE 2@
|
||||
.DWORD| ARRAY OF LITTLE ENDIAN UNSIGNED WITH SIZE 4@
|
||||
.FARADDR| ARRAY OF LITTLE ENDIAN POINTER WITH SIZE 3 TO VOID@
|
||||
.WORD| ARRAY OF LITTLE ENDIAN UNSIGNED WITH SIZE 2
|
||||
</tabular>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
<sect>Copyright<p>
|
||||
|
||||
270
doc/sim65.sgml
270
doc/sim65.sgml
@@ -40,6 +40,8 @@ The simulator is called as follows:
|
||||
Long options:
|
||||
--help Help (this text)
|
||||
--cycles Print amount of executed CPU cycles
|
||||
--cpu <type> Override CPU type (6502, 65C02, 6502X)
|
||||
--trace Enable CPU trace
|
||||
--verbose Increase verbosity
|
||||
--version Print the simulator version number
|
||||
</verb></tscreen>
|
||||
@@ -70,6 +72,17 @@ Here is a description of all the command line options:
|
||||
count.
|
||||
|
||||
|
||||
<tag><tt>--cpu <type></tt></tag>
|
||||
|
||||
Specify the CPU type to use while executing the program. This CPU type
|
||||
is normally determined from the program file header, but it can be useful
|
||||
to override it.
|
||||
|
||||
<tag><tt>--trace</tt></tag>
|
||||
|
||||
Print a single line of information for each instruction or interrupt that
|
||||
is executed by the CPU to stdout.
|
||||
|
||||
<tag><tt>-v, --verbose</tt></tag>
|
||||
|
||||
Increase the simulator verbosity.
|
||||
@@ -115,37 +128,78 @@ PVExit ($01)
|
||||
|
||||
<sect>Creating a Test in C<p>
|
||||
|
||||
For a C test compiled and linked with <tt/--target sim6502/ the
|
||||
For a C test linked with <tt/--target sim6502/ and the <tt/sim6502.lib/ library,
|
||||
command line arguments to <tt/sim65/ will be passed to <tt/main/,
|
||||
and the return value from <tt/main/ will become sim65's exit code.
|
||||
The <tt/exit/ function may also be used to terminate with an exit code.
|
||||
The <tt/stdlib.h/ <tt/exit/ function may also be used to terminate with an exit code.
|
||||
|
||||
Exit codes are limited to 8 bits.
|
||||
Exit codes are limited to an unsigned 8 bit value. (E.g. returning -1 will give an exit code of 255.)
|
||||
|
||||
The standard C library high level file input and output is functional.
|
||||
A sim65 application can be written like a command line application,
|
||||
providing arguments to <tt/main/ and using the <tt/stdio.h/ interfaces.
|
||||
providing command line arguments to <tt/main/ and using the <tt/stdio.h/ interfaces
|
||||
to interact with the console or access files.
|
||||
|
||||
Internally, file input and output is provided at a lower level by
|
||||
a set of built-in paravirtualization functions (<ref id="paravirt-internal" name="see below">).
|
||||
a set of built-in paravirtualization functions (see <ref id="paravirt-internal" name="below">).
|
||||
|
||||
Example:
|
||||
|
||||
<tscreen><verb>
|
||||
#include <stdio.h>
|
||||
int main()
|
||||
{
|
||||
printf("Hello!\n");
|
||||
return 5;
|
||||
}
|
||||
|
||||
// Build and run:
|
||||
// cl65 -t sim6502 -o example.prg example.c
|
||||
// sim65 example.prg
|
||||
|
||||
// Build and run, separate steps:
|
||||
// cc65 -t sim6502 -o example.s example.c
|
||||
// ca65 -t sim6502 -o example.o example.s
|
||||
// ld65 -t sim6502 -o example.prg example.o sim6502.lib
|
||||
// sim65 example.prg
|
||||
</verb></tscreen>
|
||||
|
||||
<sect>Creating a Test in Assembly<p>
|
||||
|
||||
Assembly tests may similarly be assembled and linked with
|
||||
<tt/--target sim6502/ or <tt/--target sim65c02/.
|
||||
Define and export <tt/_main/ as an entry point,
|
||||
Though a C test may also link with assembly code,
|
||||
a pure assembly test can also be created.
|
||||
|
||||
Link with <tt/--target sim6502/ or <tt/--target sim65c02/ and the corresponding library,
|
||||
define and export <tt/_main/ as an entry point,
|
||||
and the sim65 library provides two ways to return an 8-bit exit code:
|
||||
|
||||
<itemize>
|
||||
|
||||
<item>Return from <tt/_main/ with the exit code in <tt/A/.
|
||||
|
||||
<item><tt/jmp exit/ with the code in <tt/A/.
|
||||
<item><tt/jmp exit/ with the code in <tt/A/. (<tt/.import exit/ from the sim65 library.)
|
||||
|
||||
</itemize>
|
||||
|
||||
The binary file has a 12 byte header:
|
||||
Example:
|
||||
|
||||
<tscreen><verb>
|
||||
.export _main
|
||||
_main:
|
||||
lda #5
|
||||
rts
|
||||
|
||||
; Build and run:
|
||||
; cl65 -t sim6502 -o example.prg example.s
|
||||
; sim65 example.prg
|
||||
|
||||
; Build and run, separate steps:
|
||||
; ca65 -t sim6502 -o example.o example.s
|
||||
; ld65 -t sim6502 -o example.prg example.o sim6502.lib
|
||||
; sim65 example.prg
|
||||
</verb></tscreen>
|
||||
|
||||
Internally, the binary program file has a 12 byte header provided by the library:
|
||||
|
||||
<itemize>
|
||||
|
||||
@@ -182,8 +236,204 @@ These use cc65 calling conventions, and are intended for use with the sim65 targ
|
||||
<item><tt/IRQ/ and <tt/NMI/ events will not be generated, though <tt/BRK/
|
||||
can be used if the IRQ vector at <tt/$FFFE/ is manually prepared by the test code.
|
||||
|
||||
<item>The <tt/sim6502/ or <tt/sim65c02/ targets provide a default configuration,
|
||||
but if customization is needed <tt/sim6502.cfg/ or <tt/sim65c02.cfg/ might be used as a template.
|
||||
|
||||
</itemize>
|
||||
|
||||
<sect>Counter peripheral
|
||||
|
||||
<p>The sim65 simulator supports a memory-mapped counter peripheral that manages
|
||||
a number of 64-bit counters that are continuously updated as the simulator is
|
||||
running. For each counter, it also provides a 64 bit "latching" register.
|
||||
|
||||
<p>The functionality of the counter peripheral is accessible through 3 registers:
|
||||
|
||||
<itemize>
|
||||
<item><tt>PERIPHERALS_COUNTER_LATCH</tt> ($FFC0, write-only)
|
||||
<item><tt>PERIPHERALS_COUNTER_SELECT</tt> ($FFC1, read/write)
|
||||
<item><tt>PERIPHERALS_COUNTER_VALUE</tt> ($FFC2..$FFC9, read-only)
|
||||
</itemize>
|
||||
|
||||
<p>These three registers are used as follows.
|
||||
|
||||
<p>When a program explicitly requests a "counter latch" operation by writing any value
|
||||
to the <tt>PERIPHERALS_COUNTER_LATCH</tt> address ($FFC0), all live registers are simultaneously
|
||||
copied to the latch registers. They will keep their newly latched values until another latch
|
||||
operation is requested.
|
||||
|
||||
<p>The <tt>PERIPHERALS_COUNTER_SELECT</tt> address ($FFC1) register holds an 8-bit value that
|
||||
specifies which 64-bit latch register is currently readable through the <tt>PERIPHERALS_COUNTER_VALUE</tt>
|
||||
address range. Six values are currently defined:
|
||||
|
||||
<itemize>
|
||||
<item>$00: latched clock cycle counter selected.
|
||||
<item>$01: latched CPU instruction counter selected.
|
||||
<item>$02: latched IRQ interrupt counter selected.
|
||||
<item>$03: latched NMI interrupt counter selected.
|
||||
<item>$80: latched wallclock time (nanoseconds) selected.
|
||||
<item>$81: latched wallclock time (split: seconds, nanoseconds) selected.
|
||||
</itemize>
|
||||
|
||||
<p>Values $00 to $03 provide access to the latched (frozen) value of their respective live
|
||||
counters at the time of the last write to <tt>PERIPHERALS_COUNTER_LATCH</tt>.
|
||||
|
||||
<p>When <tt>PERIPHERALS_COUNTER_SELECT</tt> equals $80, the <tt>PERIPHERALS_COUNTER_VALUE</tt>
|
||||
will be a 64-bit value corresponding to the number of nanoseconds elapsed since the Unix epoch
|
||||
(Midnight, Jan 1st, 1970 UTC), at the time of the last latch operation.
|
||||
|
||||
<p>When <tt>PERIPHERALS_COUNTER_SELECT</tt> equals $81, the high 32 bits of <tt>PERIPHERALS_COUNTER_VALUE</tt>
|
||||
will be a 32-bit value corresponding to the number of seconds elapsed since the Unix epoch (Midnight, Jan 1st,
|
||||
1970 UTC), at the time of the last latch operation. The low 32 bits of
|
||||
<tt>PERIPHERALS_COUNTER_VALUE</tt> will hold the nanoseconds since the start of that second.
|
||||
|
||||
<p>The two different wallclock-time latch registers will always refer to precisely the same time instant.
|
||||
For some applications, the single 64-bit value measured in nanoseconds will be more convenient, while
|
||||
for other applications, the split 32/32 bits representation with separate second and nanosecond
|
||||
values will be more convenient.
|
||||
|
||||
<p>Note that the time elapsed since the Unix epoch is an approximation, as the implementation depends on the
|
||||
way POSIX defines time-since-the-epoch. Unfortunately, POSIX incorrectly assumes that all days are precisely
|
||||
86400 seconds long, which is not true in case of leap seconds. The way this inconsistency is resolved is
|
||||
system dependent.
|
||||
|
||||
<p>On reset, <tt>PERIPHERALS_COUNTER_SELECT</tt> is initialized to zero. If the <tt>PERIPHERALS_COUNTER_SELECT</tt>
|
||||
register holds a value other than one of the six values described above, all <tt>PERIPHERALS_COUNTER_VALUE</tt>
|
||||
bytes will read as zero.
|
||||
|
||||
<p>The <tt>PERIPHERALS_COUNTER_VALUE</tt> addresses ($FFC2..$FFC9) are used to read to currently
|
||||
selected 64-bit latch register value. Address $FFC2 holds the least significant byte (LSB),
|
||||
while address $FFC9 holds the most significant byte (MSB).
|
||||
|
||||
<p>On reset, all latch registers are reset to zero. Reading any of the <tt>PERIPHERALS_COUNTER_VALUE</tt>
|
||||
bytes before the first write to <tt>PERIPHERALS_COUNTER_LATCH</tt> will yield zero.
|
||||
|
||||
Example:
|
||||
|
||||
<tscreen><verb>
|
||||
/* This example uses the peripheral support in sim65.h */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sim65.h>
|
||||
|
||||
static void print_current_counters(void)
|
||||
{
|
||||
peripherals.counter.latch = 0; /* latch values */
|
||||
|
||||
peripherals.counter.select = COUNTER_SELECT_CLOCKCYCLE_COUNTER;
|
||||
printf("clock cycles ............... : %08lx %08lx\n", peripherals.counter.value32[1], peripherals.counter.value32[0]);
|
||||
peripherals.counter.select = COUNTER_SELECT_INSTRUCTION_COUNTER;
|
||||
printf("instructions ............... : %08lx %08lx\n", peripherals.counter.value32[1], peripherals.counter.value32[0]);
|
||||
peripherals.counter.select = COUNTER_SELECT_WALLCLOCK_TIME;
|
||||
printf("wallclock time ............. : %08lx %08lx\n", peripherals.counter.value32[1], peripherals.counter.value32[0]);
|
||||
peripherals.counter.select = COUNTER_SELECT_WALLCLOCK_TIME_SPLIT;
|
||||
printf("wallclock time, split ...... : %08lx %08lx\n", peripherals.counter.value32[1], peripherals.counter.value32[0]);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
print_current_counters();
|
||||
print_current_counters();
|
||||
return 0;
|
||||
}
|
||||
</verb></tscreen>
|
||||
|
||||
<sect>SIM65 control peripheral
|
||||
|
||||
<p>The sim65 simulator supports a memory-mapped peripheral that allows control
|
||||
of the simulator behavior itself.
|
||||
|
||||
<p>The sim65 control peripheral interface consists of 2 registers:
|
||||
|
||||
<itemize>
|
||||
<item><tt>PERIPHERALS_SIMCONTROL_CPUMODE</tt> ($FFCA, read/write)
|
||||
<item><tt>PERIPHERALS_SIMCONTROL_TRACEMODE</tt> ($FFCB, read/write)
|
||||
</itemize>
|
||||
|
||||
<p>Address <tt>PERIPHERALS_SIMCONTROL_CPUMODE</tt> allows access to the currently active CPU mode.
|
||||
|
||||
<p>Possible values are CPU_6502 (0), CPU_65C02 (1), and CPU_6502X (2). For specialized applications,
|
||||
it may be useful to switch CPU models at runtime; this is supported by writing 0, 1, or 2 to this address.
|
||||
Writing any other value will be ignored.
|
||||
|
||||
<p>Address <tt>PERIPHERALS_SIMCONTROL_TRACEMODE</tt> allows inspection and control of the currently active
|
||||
CPU tracing mode.
|
||||
|
||||
<p>A value of 0 means tracing is disabled; a value of $7F fully enables tracing. The 7
|
||||
lower bits of the value actually provide control over which fields are printed; see below
|
||||
for an explanation of the seven fields.
|
||||
|
||||
<p>Having the ability to enable/disable tracing on the fly can be a useful debugging aid. For example,
|
||||
it can be used to enable tracing for short fragments of code. Consider the following example:
|
||||
|
||||
<tscreen><verb>
|
||||
/* This example uses the TRACE_ON and TRACE_OFF macros defined in sim65.h */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sim65.h>
|
||||
|
||||
unsigned x;
|
||||
|
||||
int main(void)
|
||||
{
|
||||
TRACE_ON();
|
||||
|
||||
x = 0x1234; /* We want to see what happens here. */
|
||||
|
||||
TRACE_OFF();
|
||||
|
||||
return 0;
|
||||
}
|
||||
</verb></tscreen>
|
||||
|
||||
<p>This small test program, when compiled with optimizations enabled (-O), produces the output trace below:
|
||||
|
||||
<tscreen><verb>
|
||||
70 232 022E A2 12 ldx #$12 A=7F X=00 Y=04 S=FD Flags=nvdizC SP=FFBC
|
||||
71 234 0230 A9 34 lda #$34 A=7F X=12 Y=04 S=FD Flags=nvdizC SP=FFBC
|
||||
72 236 0232 8D C8 02 sta $02C8 A=34 X=12 Y=04 S=FD Flags=nvdizC SP=FFBC
|
||||
73 240 0235 8E C9 02 stx $02C9 A=34 X=12 Y=04 S=FD Flags=nvdizC SP=FFBC
|
||||
74 244 0238 A9 00 lda #$00 A=34 X=12 Y=04 S=FD Flags=nvdizC SP=FFBC
|
||||
75 246 023A 8D CB FF sta $FFCB A=00 X=12 Y=04 S=FD Flags=nvdiZC SP=FFBC
|
||||
</verb></tscreen>
|
||||
|
||||
<p>The example output shows the full trace format, consisting of the following seven fields:
|
||||
|
||||
<itemize>
|
||||
<item>The first field is an instruction counter. We see here that the assignment '<tt>x = 0x1234;</tt>'
|
||||
starts at the 70th CPU instruction since the start of the simulator, and takes four 6502 instructions.
|
||||
The two instructions that follow correspond to the execution of the <tt>TRACE_OFF</tt>' macro
|
||||
that disables tracing.
|
||||
<item>The second field shows the clock cycles since the start of the program. Here we see that the
|
||||
first four instructions take 12 clock cycles in total (262 - 250 = 12).
|
||||
<item>The third field shows the program counter as a four-digit, i.e., the PC register. Its 16-bit
|
||||
value is displayed as a 4-digit hecadecimal number.
|
||||
<item>The fourth field shows one to three hexadecimal byte values that make up the instruction.
|
||||
<item>The fifth field shows the instruction in human-readable assembly language.
|
||||
<item>The sixth field shows the CPU registers before execution of the instruction. The A, X, Y, and
|
||||
S registers are each shown as a single byte value. The six status bits of the CPU are shown in
|
||||
the order NVDIZC (Negative, Overflow, Decimal, Interrupt, Zero, Carry). They are displayed as
|
||||
a capital letter if the flag is set, or a small letter if the flag is unset.
|
||||
<item>The seventh and last field shows the software stack pointer SP as used by CC65 programs that
|
||||
conform to the CC65 conventions.
|
||||
</itemize>
|
||||
|
||||
<p>Writing a specific value to <tt>PERIPHERALS_SIMCONTROL_TRACEMODE</tt> will control which of these
|
||||
seven fields are displayed. The following values are defined to denote the seven fields:
|
||||
|
||||
<itemize>
|
||||
<item>TRACE_FIELD_INSTR_COUNTER = 0x40
|
||||
<item>TRACE_FIELD_CLOCK_COUNTER = 0x20
|
||||
<item>TRACE_FIELD_PC = 0x10
|
||||
<item>TRACE_FIELD_INSTR_BYTES = 0x08
|
||||
<item>TRACE_FIELD_INSTR_ASSEMBLY = 0x04
|
||||
<item>TRACE_FIELD_CPU_REGISTERS = 0x02
|
||||
<item>TRACE_FIELD_CC65_SP = 0x01
|
||||
</itemize>
|
||||
|
||||
<p>For example, writing the value $16 to <tt>PERIPHERALS_SIMCONTROL_TRACEMODE</tt> will only display
|
||||
the program counter, instruction assembly, and CPU registers fields.
|
||||
|
||||
<sect>Copyright<p>
|
||||
|
||||
|
||||
@@ -477,10 +477,10 @@ be used in presence of a prototype.
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Get number of horisontal pixels on the screen.
|
||||
<tag/Function/Get number of horizontal pixels on the screen.
|
||||
<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
|
||||
<tag/Declaration/<tt/unsigned tgi_getxres (void);/
|
||||
<tag/Description/Get number of horisontal pixels on the screen.
|
||||
<tag/Description/Get number of horizontal pixels on the screen.
|
||||
This is same as tgi_maxx()+1.
|
||||
<tag/Availability/cc65
|
||||
<tag/See also/Other tgi functions.
|
||||
|
||||
256
include/_mikey.h
256
include/_mikey.h
@@ -27,7 +27,7 @@
|
||||
#ifndef __MIKEY_H
|
||||
#define __MIKEY_H
|
||||
|
||||
/* timer structure */
|
||||
/* Timer structure */
|
||||
typedef struct _mikey_timer {
|
||||
unsigned char reload;
|
||||
unsigned char control;
|
||||
@@ -39,7 +39,7 @@ typedef struct _mikey_all_timers {
|
||||
struct _mikey_timer timer[8];
|
||||
} _mikey_all_timers;
|
||||
|
||||
/* audio channel structure */
|
||||
/* Audio channel structure */
|
||||
typedef struct _mikey_audio {
|
||||
unsigned char volume;
|
||||
unsigned char feedback;
|
||||
@@ -53,54 +53,212 @@ typedef struct _mikey_audio {
|
||||
|
||||
/* Define a structure with the mikey register offsets */
|
||||
struct __mikey {
|
||||
struct _mikey_timer timer0; // 0xFD00
|
||||
struct _mikey_timer timer1; // 0xFD04
|
||||
struct _mikey_timer timer2; // 0xFD08
|
||||
struct _mikey_timer timer3; // 0xFD0C
|
||||
struct _mikey_timer timer4; // 0xFD10
|
||||
struct _mikey_timer timer5; // 0xFD14
|
||||
struct _mikey_timer timer6; // 0xFD18
|
||||
struct _mikey_timer timer7; // 0xFD1C
|
||||
struct _mikey_audio channel_a; // 0xFD20
|
||||
struct _mikey_audio channel_b; // 0xFD28
|
||||
struct _mikey_audio channel_c; // 0xFD30
|
||||
struct _mikey_audio channel_d; // 0xFD38
|
||||
unsigned char attena; // 0xFD40 ?? not yet allocated?
|
||||
unsigned char attenb; // 0xFD41 |
|
||||
unsigned char attenc; // 0xFD42 |
|
||||
unsigned char attend; // 0xFD43 |
|
||||
unsigned char panning; // 0xFD44 |
|
||||
unsigned char unused0[11]; // 0xFD45 - 0xFD4F not used
|
||||
unsigned char mstereo; // 0xFD50 stereo control bits
|
||||
unsigned char unused1[47]; // 0xFD51 - 0xFD7F not used
|
||||
unsigned char intrst; // 0xFD80 interrupt poll 0
|
||||
unsigned char intset; // 0xFD81 interrupt poll 1
|
||||
unsigned char unused2[2]; // 0xFD82 - 0xFD83 not used
|
||||
unsigned char magrdy0; // 0xFD84 mag tape channel0 ready bit
|
||||
unsigned char magrdy1; // 0xFD85 mag tape channel1 ready bit
|
||||
unsigned char audin; // 0xFD86 audio in
|
||||
unsigned char sysctl1; // 0xFD87 control bits
|
||||
unsigned char mikeyrev; // 0xFD88 mikey hardware rev
|
||||
unsigned char mikeysrev; // 0xFD89 mikey software rev
|
||||
unsigned char iodir; // 0xFD8A parallel i/o data dir
|
||||
unsigned char iodat; // 0xFD8B parallel data
|
||||
unsigned char serctl; // 0xFD8C serial control register
|
||||
unsigned char serdat; // 0xFD8D serial data
|
||||
unsigned char unused3[2]; // 0xFD8E - 0xFD8F not used
|
||||
unsigned char sdoneack; // 0xFD90 suzy done acknowledge
|
||||
unsigned char cpusleep; // 0xFD91 cpu bus request disable
|
||||
unsigned char dispctl; // 0xFD92 video bus request enable, viddma
|
||||
unsigned char pkbkup; // 0xFD93 magic 'P' count
|
||||
unsigned char *scrbase; // 0xFD94 start address of video display
|
||||
unsigned char unused4[6]; // 0xFD96 - 0xFD9B not used
|
||||
unsigned char mtest0; // 0xFD9C
|
||||
unsigned char mtest1; // 0xFD9D
|
||||
unsigned char mtest2; // 0xFD9E
|
||||
unsigned char unused5; // 0xFD9F not used
|
||||
unsigned char palette[32]; // 0xFDA0 - 0xFDBF palette 32 bytes
|
||||
// 0xFDC0 - 0xFDFF not used
|
||||
struct _mikey_timer timer0; /* 0xFD00 */
|
||||
struct _mikey_timer timer1; /* 0xFD04 */
|
||||
struct _mikey_timer timer2; /* 0xFD08 */
|
||||
struct _mikey_timer timer3; /* 0xFD0C */
|
||||
struct _mikey_timer timer4; /* 0xFD10 */
|
||||
struct _mikey_timer timer5; /* 0xFD14 */
|
||||
struct _mikey_timer timer6; /* 0xFD18 */
|
||||
struct _mikey_timer timer7; /* 0xFD1C */
|
||||
struct _mikey_audio channel_a; /* 0xFD20 */
|
||||
struct _mikey_audio channel_b; /* 0xFD28 */
|
||||
struct _mikey_audio channel_c; /* 0xFD30 */
|
||||
struct _mikey_audio channel_d; /* 0xFD38 */
|
||||
unsigned char attena; /* 0xFD40 ?? not yet allocated? */
|
||||
unsigned char attenb; /* 0xFD41 | */
|
||||
unsigned char attenc; /* 0xFD42 | */
|
||||
unsigned char attend; /* 0xFD43 | */
|
||||
unsigned char panning; /* 0xFD44 | */
|
||||
unsigned char unused0[11]; /* 0xFD45 - 0xFD4F not used */
|
||||
unsigned char mstereo; /* 0xFD50 stereo control bits */
|
||||
unsigned char unused1[47]; /* 0xFD51 - 0xFD7F not used */
|
||||
unsigned char intrst; /* 0xFD80 interrupt poll 0 */
|
||||
unsigned char intset; /* 0xFD81 interrupt poll 1 */
|
||||
unsigned char unused2[2]; /* 0xFD82 - 0xFD83 not used */
|
||||
unsigned char magrdy0; /* 0xFD84 mag tape channel0 ready bit */
|
||||
unsigned char magrdy1; /* 0xFD85 mag tape channel1 ready bit */
|
||||
unsigned char audin; /* 0xFD86 audio in */
|
||||
unsigned char sysctl1; /* 0xFD87 control bits */
|
||||
unsigned char mikeyrev; /* 0xFD88 mikey hardware rev */
|
||||
unsigned char mikeysrev; /* 0xFD89 mikey software rev */
|
||||
unsigned char iodir; /* 0xFD8A parallel i/o data dir */
|
||||
unsigned char iodat; /* 0xFD8B parallel data */
|
||||
unsigned char serctl; /* 0xFD8C serial control register */
|
||||
unsigned char serdat; /* 0xFD8D serial data */
|
||||
unsigned char unused3[2]; /* 0xFD8E - 0xFD8F not used */
|
||||
unsigned char sdoneack; /* 0xFD90 suzy done acknowledge */
|
||||
unsigned char cpusleep; /* 0xFD91 cpu bus request disable */
|
||||
unsigned char dispctl; /* 0xFD92 video bus request enable, viddma */
|
||||
unsigned char pkbkup; /* 0xFD93 magic 'P' count */
|
||||
unsigned char *scrbase; /* 0xFD94 start address of video display */
|
||||
unsigned char unused4[6]; /* 0xFD96 - 0xFD9B not used */
|
||||
unsigned char mtest0; /* 0xFD9C */
|
||||
unsigned char mtest1; /* 0xFD9D */
|
||||
unsigned char mtest2; /* 0xFD9E */
|
||||
unsigned char unused5; /* 0xFD9F not used */
|
||||
unsigned char palette[32]; /* 0xFDA0 - 0xFDBF palette 32 bytes */
|
||||
unsigned char unused6[64]; /* 0xFDC0 - 0xFDFF not used */
|
||||
unsigned char bootrom[504]; /* 0xFE00 - 0xFFD8 boot rom */
|
||||
unsigned char reserved; /* 0xFFD8 reserved for future hardware */
|
||||
unsigned char mapctl; /* 0xFFF9 map control register */
|
||||
struct {
|
||||
unsigned char *nmi; /* 0xFFFA NMI vector */
|
||||
unsigned char *reset; /* 0xFFFB reset vector */
|
||||
unsigned char *irq; /* 0xFFFC IRQ vector */
|
||||
} vectors;
|
||||
};
|
||||
|
||||
/* TIM_CONTROLA control bit definitions */
|
||||
enum {
|
||||
ENABLE_INT = 0x80,
|
||||
RESET_DONE = 0x40,
|
||||
ENABLE_RELOAD = 0x10,
|
||||
ENABLE_COUNT = 0x08
|
||||
};
|
||||
|
||||
/* AUD_CONTROL control bit definitions */
|
||||
enum {
|
||||
FEEDBACK_7 = 0x80,
|
||||
ENABLE_INTEGRATE = 0x20
|
||||
};
|
||||
|
||||
/* Audio and timer clock settings for source period */
|
||||
enum {
|
||||
AUD_LINKING = 0x07,
|
||||
AUD_64 = 0x06,
|
||||
AUD_32 = 0x05,
|
||||
AUD_16 = 0x04,
|
||||
AUD_8 = 0x03,
|
||||
AUD_4 = 0x02,
|
||||
AUD_2 = 0x01,
|
||||
AUD_1 = 0x00
|
||||
};
|
||||
|
||||
/* TIM_CONTROLB control bit definitions */
|
||||
enum {
|
||||
TIMER_DONE = 0x08,
|
||||
LAST_CLOCK = 0x04,
|
||||
BORROW_IN = 0x02,
|
||||
BORROW_OUT = 0x01
|
||||
};
|
||||
|
||||
/* MPAN and MSTEREO registers bit definitions */
|
||||
enum {
|
||||
LEFT3_SELECT = 0x80,
|
||||
LEFT2_SELECT = 0x40,
|
||||
LEFT1_SELECT = 0x20,
|
||||
LEFT0_SELECT = 0x10,
|
||||
RIGHT3_SELECT = 0x08,
|
||||
RIGHT2_SELECT = 0x04,
|
||||
RIGHT1_SELECT = 0x02,
|
||||
RIGHT0_SELECT = 0x01,
|
||||
LEFT_ATTENMASK = 0xF0,
|
||||
RIGHT_ATTENMASK = 0x0F
|
||||
};
|
||||
|
||||
/* Interrupt Reset and Set bit definitions */
|
||||
enum {
|
||||
TIMER7_INT = 0x80,
|
||||
TIMER6_INT = 0x40,
|
||||
TIMER5_INT = 0x20,
|
||||
TIMER4_INT = 0x10,
|
||||
TIMER3_INT = 0x08,
|
||||
TIMER2_INT = 0x04,
|
||||
TIMER1_INT = 0x02,
|
||||
TIMER0_INT = 0x01,
|
||||
SERIAL_INT = TIMER4_INT,
|
||||
VERTICAL_INT = TIMER2_INT,
|
||||
HORIZONTAL_INT = TIMER0_INT
|
||||
};
|
||||
|
||||
/* SYSCTL1 bit definitions */
|
||||
enum {
|
||||
POWERON = 0x02,
|
||||
CART_ADDR_STROBE = 0x01
|
||||
};
|
||||
|
||||
/* IODIR and IODAT bit definitions */
|
||||
enum {
|
||||
AUDIN_BIT = 0x10, /* different from AUDIN address */
|
||||
READ_ENABLE = 0x10, /* same bit for AUDIN_BIT */
|
||||
RESTLESS = 0x08,
|
||||
NOEXP = 0x04, /* if set, redeye is not connected */
|
||||
CART_ADDR_DATA = 0x02,
|
||||
CART_POWER_OFF = 0x02, /* same bit for CART_ADDR_DATA */
|
||||
EXTERNAL_POWER = 0x01
|
||||
};
|
||||
|
||||
/* SERCTL bit definitions for write operations */
|
||||
enum {
|
||||
TXINTEN = 0x80,
|
||||
RXINTEN = 0x40,
|
||||
PAREN = 0x10,
|
||||
RESETERR = 0x08,
|
||||
TXOPEN = 0x04,
|
||||
TXBRK = 0x02,
|
||||
PAREVEN = 0x01
|
||||
};
|
||||
|
||||
/* SERCTL bit definitions for read operations */
|
||||
enum {
|
||||
TXRDY = 0x80,
|
||||
RXRDY = 0x40,
|
||||
TXEMPTY = 0x20,
|
||||
PARERR = 0x10,
|
||||
OVERRUN = 0x08,
|
||||
FRAMERR = 0x04,
|
||||
RXBRK = 0x02,
|
||||
PARBIT = 0x01
|
||||
};
|
||||
|
||||
/* DISPCTL bit definitions */
|
||||
enum {
|
||||
DISP_COLOR = 0x08, /* must be set to 1 */
|
||||
DISP_FOURBIT = 0x04, /* must be set to 1 */
|
||||
DISP_FLIP = 0x02,
|
||||
DMA_ENABLE = 0x01 /* must be set to 1 */
|
||||
};
|
||||
|
||||
/* MTEST0 bit definitions */
|
||||
enum {
|
||||
AT_CNT16 = 0x80,
|
||||
AT_TEST = 0x40,
|
||||
XCLKEN = 0x20,
|
||||
UART_TURBO = 0x10,
|
||||
ROM_SEL = 0x08,
|
||||
ROM_TEST = 0x04,
|
||||
M_TEST = 0x02,
|
||||
CPU_TEST = 0x01
|
||||
};
|
||||
|
||||
/* MTEST1 bit definitions */
|
||||
enum {
|
||||
P_CNT16 = 0x40,
|
||||
REF_CNT16 = 0x20,
|
||||
VID_TRIG = 0x10,
|
||||
REF_TRIG = 0x08,
|
||||
VID_DMA_DIS = 0x04,
|
||||
REF_FAST = 0x02,
|
||||
REF_DIS = 0x01
|
||||
};
|
||||
|
||||
/* MTEST2 bit definitions */
|
||||
enum {
|
||||
V_STROBE = 0x10,
|
||||
V_ZERO = 0x08,
|
||||
H_120 = 0x04,
|
||||
H_ZERO = 0x02,
|
||||
V_BLANKEF = 0x01
|
||||
};
|
||||
|
||||
/* MAPCTL bit definitions */
|
||||
enum {
|
||||
TURBO_DISABLE = 0x80,
|
||||
VECTOR_SPACE = 0x08,
|
||||
ROM_SPACE = 0x04,
|
||||
MIKEY_SPACE = 0x02,
|
||||
SUZY_SPACE = 0x01
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
342
include/_suzy.h
342
include/_suzy.h
@@ -24,75 +24,65 @@
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
#ifndef __SUZY_H
|
||||
#define __SUZY_H
|
||||
|
||||
/* Joypad $FCB0 */
|
||||
#define JOYPAD_RIGHT 0x10
|
||||
#define JOYPAD_LEFT 0x20
|
||||
#define JOYPAD_DOWN 0x40
|
||||
#define JOYPAD_UP 0x80
|
||||
#define BUTTON_OPTION1 0x08
|
||||
#define BUTTON_OPTION2 0x04
|
||||
#define BUTTON_INNER 0x02
|
||||
#define BUTTON_OUTER 0x01
|
||||
/* JOYSTICK bit definitions */
|
||||
enum {
|
||||
JOYPAD_RIGHT = 0x10,
|
||||
JOYPAD_LEFT = 0x20,
|
||||
JOYPAD_DOWN = 0x40,
|
||||
JOYPAD_UP = 0x80,
|
||||
BUTTON_OPTION1 = 0x08,
|
||||
BUTTON_OPTION2 = 0x04,
|
||||
BUTTON_INNER = 0x02,
|
||||
BUTTON_OUTER = 0x01
|
||||
};
|
||||
|
||||
/* Switches $FCB1 */
|
||||
#define BUTTON_PAUSE 0x01
|
||||
/* SWITCHES bit definitions */
|
||||
enum {
|
||||
CART1_IO_INACTIVE = 0x04,
|
||||
CART0_IO_INACTIVE = 0x02,
|
||||
BUTTON_PAUSE = 0x01
|
||||
};
|
||||
|
||||
/* SPRCTL0 bit definitions */
|
||||
enum {
|
||||
BPP_4 = 0xC0,
|
||||
BPP_3 = 0x80,
|
||||
BPP_2 = 0x40,
|
||||
BPP_1 = 0x00,
|
||||
HFLIP = 0x20,
|
||||
VFLIP = 0x10,
|
||||
TYPE_SHADOW = 0x07,
|
||||
TYPE_XOR = 0x06,
|
||||
TYPE_NONCOLL = 0x05,
|
||||
TYPE_NORMAL = 0x04,
|
||||
TYPE_BOUNDARY = 0x03,
|
||||
TYPE_BSHADOW = 0x02,
|
||||
TYPE_BACKNONCOLL = 0x01,
|
||||
TYPE_BACKGROUND = 0x00
|
||||
};
|
||||
|
||||
/* Hardware Math */
|
||||
#define FACTOR_A *(unsigned int *) 0xFC54
|
||||
#define FACTOR_B *(unsigned int *) 0xFC52
|
||||
#define PRODUCT0 *(unsigned int *) 0xFC60
|
||||
#define PRODUCT1 *(unsigned int *) 0xFC62
|
||||
#define PRODUCT *(long *) 0xFC60
|
||||
/* SPRCTL1 bit definitions */
|
||||
enum {
|
||||
LITERAL = 0x80,
|
||||
PACKED = 0x00,
|
||||
ALGO3 = 0x40,
|
||||
RENONE = 0x00,
|
||||
REHV = 0x10,
|
||||
REHVS = 0x20,
|
||||
REHVST = 0x30,
|
||||
REUSEPAL = 0x08,
|
||||
SKIP = 0x04,
|
||||
DRAWUP = 0x02,
|
||||
DRAWLEFT = 0x01
|
||||
};
|
||||
|
||||
#define DIVIDEND0 *(unsigned int *) 0xFC60
|
||||
#define DIVIDEND1 *(unsigned int *) 0xFC62
|
||||
#define DIVIDEND *(long *) 0xFC60
|
||||
#define DIVISOR *(unsigned int *) 0xFC56
|
||||
#define QUOTIENT0 *(unsigned int *) 0xFC52
|
||||
#define QUOTIENT1 *(unsigned int *) 0xFC54
|
||||
#define QUOTIENT *(long *) 0xFC52
|
||||
#define REMAINDER0 *(unsigned int *) 0xFC6C
|
||||
#define REMAINDER1 *(unsigned int *) 0xFC6E
|
||||
#define REMAINDER *(long *) 0xFC6C
|
||||
/* Sprite control block (SCB) definitions */
|
||||
|
||||
|
||||
/* Sprite control block (SCB) defines */
|
||||
|
||||
/* SPRCTL0 $FC80 */
|
||||
#define BPP_4 0xC0
|
||||
#define BPP_3 0x80
|
||||
#define BPP_2 0x40
|
||||
#define BPP_1 0x00
|
||||
#define HFLIP 0x20
|
||||
#define VFLIP 0x10
|
||||
#define TYPE_SHADOW 0x07
|
||||
#define TYPE_XOR 0x06
|
||||
#define TYPE_NONCOLL 0x05
|
||||
#define TYPE_NORMAL 0x04
|
||||
#define TYPE_BOUNDARY 0x03
|
||||
#define TYPE_BSHADOW 0x02
|
||||
#define TYPE_BACKNONCOLL 0x01
|
||||
#define TYPE_BACKGROUND 0x00
|
||||
|
||||
/* SPRCTL1 $FC81 */
|
||||
#define LITERAL 0x80
|
||||
#define PACKED 0x00
|
||||
#define ALGO3 0x40
|
||||
#define RENONE 0x00
|
||||
#define REHV 0x10
|
||||
#define REHVS 0x20
|
||||
#define REHVST 0x30
|
||||
#define REUSEPAL 0x08
|
||||
#define SKIP 0x04
|
||||
#define DRAWUP 0x02
|
||||
#define DRAWLEFT 0x01
|
||||
|
||||
typedef struct SCB_REHVST_PAL { // SCB with all attributes
|
||||
/* SCB with all attributes */
|
||||
typedef struct SCB_REHVST_PAL {
|
||||
unsigned char sprctl0;
|
||||
unsigned char sprctl1;
|
||||
unsigned char sprcoll;
|
||||
@@ -107,7 +97,8 @@ typedef struct SCB_REHVST_PAL { // SCB with all attributes
|
||||
unsigned char penpal[8];
|
||||
} SCB_REHVST_PAL;
|
||||
|
||||
typedef struct SCB_REHVST { // SCB without pallette
|
||||
/* SCB without pallette */
|
||||
typedef struct SCB_REHVST {
|
||||
unsigned char sprctl0;
|
||||
unsigned char sprctl1;
|
||||
unsigned char sprcoll;
|
||||
@@ -121,7 +112,8 @@ typedef struct SCB_REHVST { // SCB without pallette
|
||||
unsigned int tilt;
|
||||
} SCB_REHVST;
|
||||
|
||||
typedef struct SCB_REHV { // SCB without stretch/tilt
|
||||
/* SCB without stretch/tilt */
|
||||
typedef struct SCB_REHV {
|
||||
unsigned char sprctl0;
|
||||
unsigned char sprctl1;
|
||||
unsigned char sprcoll;
|
||||
@@ -133,7 +125,8 @@ typedef struct SCB_REHV { // SCB without stretch/tilt
|
||||
unsigned int vsize;
|
||||
} SCB_REHV;
|
||||
|
||||
typedef struct SCB_REHV_PAL { // SCB without str/tilt, w/ penpal
|
||||
/* SCB without stretch/tilt, with penpal */
|
||||
typedef struct SCB_REHV_PAL {
|
||||
unsigned char sprctl0;
|
||||
unsigned char sprctl1;
|
||||
unsigned char sprcoll;
|
||||
@@ -146,7 +139,8 @@ typedef struct SCB_REHV_PAL { // SCB without str/tilt, w/ penpal
|
||||
unsigned char penpal[8];
|
||||
} SCB_REHV_PAL;
|
||||
|
||||
typedef struct SCB_REHVS { // SCB w/o tilt & penpal
|
||||
/* SCB without tilt/penpal */
|
||||
typedef struct SCB_REHVS {
|
||||
unsigned char sprctl0;
|
||||
unsigned char sprctl1;
|
||||
unsigned char sprcoll;
|
||||
@@ -159,7 +153,8 @@ typedef struct SCB_REHVS { // SCB w/o tilt & penpal
|
||||
unsigned int stretch;
|
||||
} SCB_REHVS;
|
||||
|
||||
typedef struct SCB_REHVS_PAL { // SCB w/o tilt w/penpal
|
||||
/* SCB without tilt, with penpal */
|
||||
typedef struct SCB_REHVS_PAL {
|
||||
unsigned char sprctl0;
|
||||
unsigned char sprctl1;
|
||||
unsigned char sprcoll;
|
||||
@@ -173,7 +168,8 @@ typedef struct SCB_REHVS_PAL { // SCB w/o tilt w/penpal
|
||||
unsigned char penpal[8];
|
||||
} SCB_REHVS_PAL;
|
||||
|
||||
typedef struct SCB_RENONE { // SCB w/o size/stretch/tilt/pal
|
||||
/* SCB without size/stretch/tilt/penpal */
|
||||
typedef struct SCB_RENONE {
|
||||
unsigned char sprctl0;
|
||||
unsigned char sprctl1;
|
||||
unsigned char sprcoll;
|
||||
@@ -183,7 +179,8 @@ typedef struct SCB_RENONE { // SCB w/o size/stretch/tilt/pal
|
||||
signed int vpos;
|
||||
} SCB_RENONE;
|
||||
|
||||
typedef struct SCB_RENONE_PAL { // SCB w/o size/str/tilt w/penpal
|
||||
/* SCB without size/str/tilt, with penpal */
|
||||
typedef struct SCB_RENONE_PAL {
|
||||
unsigned char sprctl0;
|
||||
unsigned char sprctl1;
|
||||
unsigned char sprcoll;
|
||||
@@ -210,30 +207,124 @@ typedef struct PENPAL_1 {
|
||||
unsigned char penpal[1];
|
||||
} PENPAL_1;
|
||||
|
||||
/* Misc system defines */
|
||||
/* SPRGO bit definitions */
|
||||
enum {
|
||||
SPRITE_GO = 0x01, /* sprite process start bit */
|
||||
EVER_ON = 0x04 /* everon detector enable */
|
||||
};
|
||||
|
||||
/* SPRGO $FC91 */
|
||||
#define EVER_ON 0x04
|
||||
#define SPRITE_GO 0x01
|
||||
/* SPRSYS bit definitions for write operations */
|
||||
enum {
|
||||
SIGNMATH = 0x80, /* signed math */
|
||||
ACCUMULATE = 0x40, /* accumulate multiplication results */
|
||||
NO_COLLIDE = 0x20, /* do not collide with any sprites (also SPRCOLL bit definition) */
|
||||
VSTRETCH = 0x10, /* stretch v */
|
||||
LEFTHAND = 0x08,
|
||||
CLR_UNSAFE = 0x04, /* unsafe access reset */
|
||||
SPRITESTOP = 0x02 /* request to stop sprite process */
|
||||
};
|
||||
|
||||
/* SPRSYS (write) $FC92 */
|
||||
#define SIGNMATH 0x80
|
||||
#define ACCUMULATE 0x40
|
||||
#define NO_COLLIDE 0x20
|
||||
#define VSTRETCH 0x10
|
||||
#define LEFTHAND 0x08
|
||||
#define CLR_UNSAFE 0x04
|
||||
#define SPRITESTOP 0x02
|
||||
/* SPRSYS bit definitions for read operations */
|
||||
enum {
|
||||
MATHWORKING = 0x80, /* math operation in progress */
|
||||
MATHWARNING = 0x40, /* accumulator overflow on multiple or divide by zero */
|
||||
MATHCARRY = 0x20, /* last carry bit */
|
||||
VSTRETCHING = 0x10,
|
||||
LEFTHANDED = 0x08,
|
||||
UNSAFE_ACCESS = 0x04, /* unsafe access performed */
|
||||
SPRITETOSTOP = 0x02, /* requested to stop */
|
||||
SPRITEWORKING = 0x01 /* sprite process is active */
|
||||
};
|
||||
|
||||
/* SPRSYS (read) $FC92 */
|
||||
#define MATHWORKING 0x80
|
||||
#define MATHWARNING 0x40
|
||||
#define MATHCARRY 0x20
|
||||
#define VSTRETCHING 0x10
|
||||
#define LEFTHANDED 0x08
|
||||
#define UNSAFE_ACCESS 0x04
|
||||
#define SPRITETOSTOP 0x02
|
||||
#define SPRITEWORKING 0x01
|
||||
/* Suzy hardware registers */
|
||||
struct __suzy {
|
||||
unsigned char *tmpadr; /* 0xFC00 Temporary address */
|
||||
unsigned int tiltacc; /* 0xFC02 Tilt accumulator */
|
||||
unsigned int hoff; /* 0xFC04 Offset to H edge of screen */
|
||||
unsigned int voff; /* 0xFC06 Offset to V edge of screen */
|
||||
unsigned char *sprbase; /* 0xFC08 Base address of sprite */
|
||||
unsigned char *colbase; /* 0xFC0A Base address of collision buffer */
|
||||
unsigned char *vidadr; /* 0xFC0C Current vid buffer address */
|
||||
unsigned char *coladr; /* 0xFC0E Current col buffer address */
|
||||
unsigned char *scbnext; /* 0xFC10 Address of next SCB */
|
||||
unsigned char *sprdline; /* 0xFC12 start of sprite data line address */
|
||||
unsigned int hposstrt; /* 0xFC14 start hpos */
|
||||
unsigned int vposstrt; /* 0xFC16 start vpos */
|
||||
unsigned int sprhsize; /* 0xFC18 sprite h size */
|
||||
unsigned int sprvsize; /* 0xFC1A sprite v size */
|
||||
unsigned int stretchl; /* 0xFC1C H size adder */
|
||||
unsigned int tilt; /* 0xFC1E H pos adder */
|
||||
unsigned int sprdoff; /* 0xFC20 offset to next sprite data line */
|
||||
unsigned int sprvpos; /* 0xFC22 current vpos */
|
||||
unsigned int colloff; /* 0xFC24 offset to collision depository */
|
||||
unsigned int vsizeacc; /* 0xFC26 vertical size accumulator */
|
||||
unsigned int hsizeoff; /* 0xFC28 horizontal size offset */
|
||||
unsigned int vsizeoff; /* 0xFC2A vertical size offset */
|
||||
unsigned char *scbaddr; /* 0xFC2C address of current SCB */
|
||||
unsigned char *procaddr; /* 0xFC2E address of current spr data proc */
|
||||
unsigned char unused0[32]; /* 0xFC30 - 0xFC4F reserved/unused */
|
||||
unsigned char unused1[2]; /* 0xFC50 - 0xFC51 do not use */
|
||||
unsigned char mathd; /* 0xFC52 */
|
||||
unsigned char mathc; /* 0xFC53 */
|
||||
unsigned char mathb; /* 0xFC54 */
|
||||
unsigned char matha; /* 0xFC55 write starts a multiply operation */
|
||||
unsigned char mathp; /* 0xFC56 */
|
||||
unsigned char mathn; /* 0xFC57 */
|
||||
unsigned char unused2[8]; /* 0xFC58 - 0xFC5F do not use */
|
||||
unsigned char mathh; /* 0xFC60 */
|
||||
unsigned char mathg; /* 0xFC61 */
|
||||
unsigned char mathf; /* 0xFC62 */
|
||||
unsigned char mathe; /* 0xFC63 write starts a divide operation */
|
||||
unsigned char unused3[8]; /* 0xFC64 - 0xFC6B do not use */
|
||||
unsigned char mathm; /* 0xFC6C */
|
||||
unsigned char mathl; /* 0xFC6D */
|
||||
unsigned char mathk; /* 0xFC6E */
|
||||
unsigned char mathj; /* 0xFC6F */
|
||||
unsigned char unused4[16]; /* 0xFC70 - 0xFC7F do not use */
|
||||
unsigned char sprctl0; /* 0xFC80 sprite control bits 0 */
|
||||
unsigned char sprctl1; /* 0xFC81 sprite control bits 1 */
|
||||
unsigned char sprcoll; /* 0xFC82 sprite collision number */
|
||||
unsigned char sprinit; /* 0xFC83 sprite initialization bits */
|
||||
unsigned char unused5[4]; /* 0xFC84 - 0xFC87 unused */
|
||||
unsigned char suzyhrev; /* 0xFC88 suzy hardware rev */
|
||||
unsigned char suzysrev; /* 0xFC89 suzy software rev */
|
||||
unsigned char unused6[6]; /* 0xFC8A - 0xFC8F unused */
|
||||
unsigned char suzybusen; /* 0xFC90 suzy bus enable */
|
||||
unsigned char sprgo; /* 0xFC91 sprite process start bit */
|
||||
unsigned char sprsys; /* 0xFC92 sprite system control bits */
|
||||
unsigned char unused7[29]; /* 0xFC93 - 0xFCAF unused */
|
||||
unsigned char joystick; /* 0xFCB0 joystick and buttons */
|
||||
unsigned char switches; /* 0xFCB1 other switches */
|
||||
unsigned char cart0; /* 0xFCB2 cart0 r/w */
|
||||
unsigned char cart1; /* 0xFCB3 cart1 r/w */
|
||||
unsigned char unused8[8]; /* 0xFCB4 - 0xFCBF unused */
|
||||
unsigned char leds; /* 0xFCC0 leds */
|
||||
unsigned char unused9; /* 0xFCC1 unused */
|
||||
unsigned char parstat; /* 0xFCC2 parallel port status */
|
||||
unsigned char pardata; /* 0xFCC3 parallel port data */
|
||||
unsigned char howie; /* 0xFCC4 howie (?) */
|
||||
/* 0xFCC5 - 0xFCFF unused */
|
||||
};
|
||||
|
||||
/* Hardware math registers */
|
||||
#define FACTOR_A *(unsigned int *) 0xFC54
|
||||
#define FACTOR_B *(unsigned int *) 0xFC52
|
||||
#define PRODUCT0 *(unsigned int *) 0xFC60
|
||||
#define PRODUCT1 *(unsigned int *) 0xFC62
|
||||
#define PRODUCT *(long *) 0xFC60
|
||||
|
||||
#define DIVIDEND0 *(unsigned int *) 0xFC60
|
||||
#define DIVIDEND1 *(unsigned int *) 0xFC62
|
||||
#define DIVIDEND *(long *) 0xFC60
|
||||
#define DIVISOR *(unsigned int *) 0xFC56
|
||||
#define QUOTIENT0 *(unsigned int *) 0xFC52
|
||||
#define QUOTIENT1 *(unsigned int *) 0xFC54
|
||||
#define QUOTIENT *(long *) 0xFC52
|
||||
#define REMAINDER0 *(unsigned int *) 0xFC6C
|
||||
#define REMAINDER1 *(unsigned int *) 0xFC6E
|
||||
#define REMAINDER *(long *) 0xFC6C
|
||||
|
||||
/* Deprecated definitions */
|
||||
|
||||
/* MAPCTL $FFF9 */
|
||||
#define HIGHSPEED 0x80
|
||||
@@ -242,77 +333,4 @@ typedef struct PENPAL_1 {
|
||||
#define MIKEYSPACE 0x02
|
||||
#define SUZYSPACE 0x01
|
||||
|
||||
|
||||
/* Suzy Hardware Registers */
|
||||
struct __suzy {
|
||||
unsigned int tmpadr; // 0xFC00 Temporary address
|
||||
unsigned int tiltacc; // 0xFC02 Tilt accumulator
|
||||
unsigned int hoff; // 0xFC04 Offset to H edge of screen
|
||||
unsigned int voff; // 0xFC06 Offset to V edge of screen
|
||||
unsigned char *sprbase; // 0xFC08 Base address of sprite
|
||||
unsigned char *colbase; // 0xFC0A Base address of collision buffer
|
||||
unsigned char *vidadr; // 0xFC0C Current vid buffer address
|
||||
unsigned char *coladr; // 0xFC0E Current col buffer address
|
||||
unsigned char *scbnext; // 0xFC10 Address of next SCB
|
||||
unsigned char *sprdline; // 0xFC12 start of sprite data line address
|
||||
unsigned char *hposstrt; // 0xFC14 start hpos
|
||||
unsigned char *vposstrt; // 0xFC16 start vpos
|
||||
unsigned char *sprhsize; // 0xFC18 sprite h size
|
||||
unsigned char *sprvsize; // 0xFC1A sprite v size
|
||||
unsigned int stretchl; // 0xFC1C H size adder
|
||||
unsigned int tilt; // 0xFC1E H pos adder
|
||||
unsigned int sprdoff; // 0xFC20 offset to next sprite data line
|
||||
unsigned int sprvpos; // 0xFC22 current vpos
|
||||
unsigned int colloff; // 0xFC24 offset to collision depository
|
||||
unsigned int vsizeacc; // 0xFC26 vertical size accumulator
|
||||
unsigned int hsizeoff; // 0xFC28 horizontal size offset
|
||||
unsigned int vsizeoff; // 0xFC2A vertical size offset
|
||||
unsigned char *scbaddr; // 0xFC2C address of current SCB
|
||||
unsigned char *procaddr; // 0xFC2E address of current spr data proc
|
||||
unsigned char unused0[32]; // 0xFC30 - 0xFC4F reserved/unused
|
||||
unsigned char unused1[2]; // 0xFC50 - 0xFC51 do not use
|
||||
unsigned char mathd; // 0xFC52
|
||||
unsigned char mathc; // 0xFC53
|
||||
unsigned char mathb; // 0xFC54
|
||||
unsigned char matha; // 0xFC55
|
||||
unsigned char mathp; // 0xFC56
|
||||
unsigned char mathn; // 0xFC57
|
||||
unsigned char unused2[8]; // 0xFC58 - 0xFC5F do not use
|
||||
unsigned char mathh; // 0xFC60
|
||||
unsigned char mathg; // 0xFC61
|
||||
unsigned char mathf; // 0xFC62
|
||||
unsigned char mathe; // 0xFC63
|
||||
unsigned char unused3[8]; // 0xFC64 - 0xFC6B do not use
|
||||
unsigned char mathm; // 0xFC6C
|
||||
unsigned char mathl; // 0xFC6D
|
||||
unsigned char mathk; // 0xFC6E
|
||||
unsigned char mathj; // 0xFC6F
|
||||
unsigned char unused4[16]; // 0xFC70 - 0xFC7F do not use
|
||||
unsigned char sprctl0; // 0xFC80 sprite control bits 0
|
||||
unsigned char sprctl1; // 0xFC81 sprite control bits 1
|
||||
unsigned char sprcoll; // 0xFC82 sprite collision number
|
||||
unsigned char sprinit; // 0xFC83 sprite initialization bits
|
||||
unsigned char unused5[4]; // 0xFC84 - 0xFC87 unused
|
||||
unsigned char suzyhrev; // 0xFC88 suzy hardware rev
|
||||
unsigned char suzysrev; // 0xFC89 suzy software rev
|
||||
unsigned char unused6[6]; // 0xFC8A - 0xFC8F unused
|
||||
unsigned char suzybusen; // 0xFC90 suzy bus enable
|
||||
unsigned char sprgo; // 0xFC91 sprite process start bit
|
||||
unsigned char sprsys; // 0xFC92 sprite system control bits
|
||||
unsigned char unused7[29]; // 0xFC93 - 0xFCAF unused
|
||||
unsigned char joystick; // 0xFCB0 joystick and buttons
|
||||
unsigned char switches; // 0xFCB1 other switches
|
||||
unsigned char cart0; // 0xFCB2 cart0 r/w
|
||||
unsigned char cart1; // 0xFCB3 cart1 r/w
|
||||
unsigned char unused8[8]; // 0xFCB4 - 0xFCBF unused
|
||||
unsigned char leds; // 0xFCC0 leds
|
||||
unsigned char unused9; // 0xFCC1 unused
|
||||
unsigned char parstat; // 0xFCC2 parallel port status
|
||||
unsigned char pardata; // 0xFCC3 parallel port data
|
||||
unsigned char howie; // 0xFCC4 howie (?)
|
||||
// 0xFCC5 - 0xFCFF unused
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -304,6 +304,36 @@ unsigned char detect_turbomaster (void);
|
||||
* 0x01 : C64 Turbo Master cartridge present
|
||||
*/
|
||||
|
||||
unsigned char __fastcall__ set_iigs_speed (unsigned char speed);
|
||||
|
||||
/* Set the speed of the Apple IIgs CPU.
|
||||
*
|
||||
* Possible values:
|
||||
* SPEED_SLOW : 1 Mhz mode
|
||||
* SPEED_FAST : Fast mode (2.8MHz or more, depending on the presence of
|
||||
* an accelerator)
|
||||
*
|
||||
* Any other value will be interpreted as SPEED_FAST.
|
||||
*/
|
||||
|
||||
unsigned char get_iigs_speed (void);
|
||||
|
||||
/* Get the speed of the Apple IIgs CPU.
|
||||
*
|
||||
* Possible return values:
|
||||
* SPEED_SLOW : 1 Mhz mode
|
||||
* SPEED_FAST : Fast mode (2.8MHz or more, depending on the presence of
|
||||
* an accelerator)
|
||||
*/
|
||||
|
||||
unsigned char detect_iigs (void);
|
||||
|
||||
/* Check whether we are running on an Apple IIgs.
|
||||
*
|
||||
* Possible return values:
|
||||
* 0x00 : No
|
||||
* 0x01 : Yes
|
||||
*/
|
||||
|
||||
/* End of accelerator.h */
|
||||
#endif
|
||||
|
||||
|
||||
163
include/apple2.h
163
include/apple2.h
@@ -41,6 +41,7 @@
|
||||
# error This module may only be used when compiling for the Apple ][!
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
#include <apple2_filetype.h>
|
||||
|
||||
|
||||
@@ -82,7 +83,77 @@
|
||||
#define CH_CURS_LEFT 0x08
|
||||
#define CH_CURS_RIGHT 0x15
|
||||
|
||||
#if !defined(__APPLE2ENH__)
|
||||
/* These characters are not available on the ][+, but
|
||||
* are on the //e. */
|
||||
#if defined(__APPLE2ENH__) || defined(APPLE2_INCLUDE_IIE_CHARS)
|
||||
#define CH_DEL 0x7F
|
||||
#define CH_CURS_UP 0x0B
|
||||
#define CH_CURS_DOWN 0x0A
|
||||
|
||||
/* These are defined to be OpenApple + NumberKey */
|
||||
#define CH_F1 0xB1
|
||||
#define CH_F2 0xB2
|
||||
#define CH_F3 0xB3
|
||||
#define CH_F4 0xB4
|
||||
#define CH_F5 0xB5
|
||||
#define CH_F6 0xB6
|
||||
#define CH_F7 0xB7
|
||||
#define CH_F8 0xB8
|
||||
#define CH_F9 0xB9
|
||||
#define CH_F10 0xB0
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE2ENH__)
|
||||
|
||||
/* MouseText-based functions for boxes and lines drawing */
|
||||
void mt_chline (unsigned char length);
|
||||
void mt_cvline (unsigned char length);
|
||||
void mt_chlinexy (unsigned char x, unsigned char y, unsigned char length);
|
||||
void mt_cvlinexy (unsigned char x, unsigned char y, unsigned char length);
|
||||
|
||||
#define CH_HLINE 0x5F
|
||||
#define CH_VLINE 0xDF
|
||||
#define CH_ULCORNER 0x5F
|
||||
#define CH_URCORNER 0x20
|
||||
#define CH_LLCORNER 0xD4
|
||||
#define CH_LRCORNER 0xDF
|
||||
#define CH_TTEE 0x5F
|
||||
#define CH_BTEE 0xD4
|
||||
#define CH_LTEE 0xD4
|
||||
#define CH_RTEE 0xDF
|
||||
#define CH_CROSS 0xD4
|
||||
|
||||
#define _chline(length) mt_chline(length)
|
||||
#define _chlinexy(x,y,length) mt_chlinexy(x,y,length)
|
||||
#define _cvline(length) mt_cvline(length)
|
||||
#define _cvlinexy(x,y,length) mt_cvlinexy(x,y,length)
|
||||
|
||||
#else
|
||||
|
||||
/* Functions that don't depend on MouseText to draw boxes and lines */
|
||||
void dyn_chline (unsigned char h, unsigned char length);
|
||||
void dyn_cvline (unsigned char v, unsigned char length);
|
||||
void dyn_chlinexy (unsigned char h, unsigned char x, unsigned char y, unsigned char length);
|
||||
void dyn_cvlinexy (unsigned char v, unsigned char x, unsigned char y, unsigned char length);
|
||||
|
||||
#if defined(DYN_BOX_DRAW)
|
||||
/* When the user defines DYN_BOX_DRAW, we'll adapt to the machine
|
||||
** we run on.
|
||||
*/
|
||||
extern char CH_HLINE;
|
||||
extern char CH_VLINE;
|
||||
extern char CH_ULCORNER;
|
||||
extern char CH_URCORNER;
|
||||
extern char CH_LLCORNER;
|
||||
extern char CH_LRCORNER;
|
||||
extern char CH_TTEE;
|
||||
extern char CH_BTEE;
|
||||
extern char CH_LTEE;
|
||||
extern char CH_RTEE;
|
||||
extern char CH_CROSS;
|
||||
|
||||
#else
|
||||
/* Otherwise, fallback to safety and don't use MouseText at all. */
|
||||
#define CH_HLINE '-'
|
||||
#define CH_VLINE '!'
|
||||
#define CH_ULCORNER '+'
|
||||
@@ -94,7 +165,14 @@
|
||||
#define CH_LTEE '+'
|
||||
#define CH_RTEE '+'
|
||||
#define CH_CROSS '+'
|
||||
#endif
|
||||
#endif /* DYN_BOX_DRAW */
|
||||
|
||||
#define _chline(length) dyn_chline(CH_HLINE, length)
|
||||
#define _chlinexy(x, y, length) dyn_chlinexy(CH_HLINE, x ,y, length)
|
||||
#define _cvline(length) dyn_cvline(CH_VLINE, length)
|
||||
#define _cvlinexy(x, y, length) dyn_cvlinexy(CH_VLINE, x, y, length)
|
||||
|
||||
#endif /* __APPLE2ENH__ */
|
||||
|
||||
/* Masks for joy_read */
|
||||
#define JOY_UP_MASK 0x10
|
||||
@@ -121,6 +199,17 @@
|
||||
#define APPLE_IIGS1 0x81 /* Apple IIgs (ROM 1) */
|
||||
#define APPLE_IIGS3 0x83 /* Apple IIgs (ROM 3) */
|
||||
|
||||
/* Return codes for get_tv() */
|
||||
#define TV_NTSC 0
|
||||
#define TV_PAL 1
|
||||
#define TV_OTHER 2
|
||||
|
||||
/* Video modes */
|
||||
#define VIDEOMODE_40x24 0x15
|
||||
#define VIDEOMODE_80x24 0x00
|
||||
#define VIDEOMODE_40COL VIDEOMODE_40x24
|
||||
#define VIDEOMODE_80COL VIDEOMODE_80x24
|
||||
|
||||
extern unsigned char _dos_type;
|
||||
/* Valid _dos_type values:
|
||||
**
|
||||
@@ -142,6 +231,27 @@ extern unsigned char _dos_type;
|
||||
** ProDOS 8 2.4.x - 0x24
|
||||
*/
|
||||
|
||||
/* struct stat.st_mode values */
|
||||
#define S_IFDIR 0x01
|
||||
#define S_IFREG 0x02
|
||||
#define S_IFBLK 0xFF
|
||||
#define S_IFCHR 0xFF
|
||||
#define S_IFIFO 0xFF
|
||||
#define S_IFLNK 0xFF
|
||||
#define S_IFSOCK 0xFF
|
||||
|
||||
struct datetime {
|
||||
struct {
|
||||
unsigned day :5;
|
||||
unsigned mon :4;
|
||||
unsigned year :7;
|
||||
} date;
|
||||
struct {
|
||||
unsigned char min;
|
||||
unsigned char hour;
|
||||
} time;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -151,20 +261,10 @@ extern unsigned char _dos_type;
|
||||
|
||||
|
||||
/* The file stream implementation and the POSIX I/O functions will use the
|
||||
** following struct to set the date and time stamp on files. This specificially
|
||||
** following struct to set the date and time stamp on files. This specifically
|
||||
** applies to the open and fopen functions.
|
||||
*/
|
||||
extern struct {
|
||||
struct {
|
||||
unsigned day :5;
|
||||
unsigned mon :4;
|
||||
unsigned year :7;
|
||||
} createdate; /* Current date: 0 */
|
||||
struct {
|
||||
unsigned char min;
|
||||
unsigned char hour;
|
||||
} createtime; /* Current time: 0 */
|
||||
} _datetime;
|
||||
extern struct datetime _datetime;
|
||||
|
||||
/* The addresses of the static drivers */
|
||||
#if !defined(__APPLE2ENH__)
|
||||
@@ -185,6 +285,12 @@ extern void a2_lo_tgi[];
|
||||
|
||||
|
||||
|
||||
void beep (void);
|
||||
/* Beep beep. */
|
||||
|
||||
unsigned char get_tv (void);
|
||||
/* Get the machine vblank frequency. Returns one of the TV_xxx codes. */
|
||||
|
||||
unsigned char get_ostype (void);
|
||||
/* Get the machine type. Returns one of the APPLE_xxx codes. */
|
||||
|
||||
@@ -211,6 +317,35 @@ void rebootafterexit (void);
|
||||
#define _cpeekcolor() COLOR_WHITE
|
||||
#define _cpeekrevers() 0
|
||||
|
||||
struct tm* __fastcall__ gmtime_dt (const struct datetime* dt);
|
||||
/* Converts a ProDOS date/time structure to a struct tm */
|
||||
|
||||
time_t __fastcall__ mktime_dt (const struct datetime* dt);
|
||||
/* Converts a ProDOS date/time structure to a time_t UNIX timestamp */
|
||||
|
||||
typedef struct DIR DIR;
|
||||
|
||||
unsigned int __fastcall__ dir_entry_count(DIR *dir);
|
||||
/* Returns the number of active files in a ProDOS directory */
|
||||
|
||||
#if !defined(__APPLE2ENH__)
|
||||
unsigned char __fastcall__ allow_lowercase (unsigned char onoff);
|
||||
/* If onoff is 0, lowercase characters printed to the screen via STDIO and
|
||||
** CONIO are forced to uppercase. If onoff is 1, lowercase characters are
|
||||
** printed to the screen untouched. By default lowercase characters are
|
||||
** forced to uppercase because a stock Apple ][+ doesn't support lowercase
|
||||
** display. The function returns the old lowercase setting.
|
||||
*/
|
||||
#endif
|
||||
|
||||
signed char __fastcall__ videomode (unsigned mode);
|
||||
/* Set the video mode, return the old mode, or -1 if 80-column hardware is not
|
||||
** installed. Call with one of the VIDEOMODE_xx constants.
|
||||
*/
|
||||
|
||||
void waitvsync (void);
|
||||
/* Wait for start of next frame */
|
||||
|
||||
|
||||
|
||||
/* End of apple2.h */
|
||||
|
||||
@@ -46,49 +46,6 @@
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
/* Characters codes */
|
||||
#define CH_DEL 0x7F
|
||||
#define CH_CURS_UP 0x0B
|
||||
#define CH_CURS_DOWN 0x0A
|
||||
|
||||
#define CH_HLINE 0x5F
|
||||
#define CH_VLINE 0xDF
|
||||
#define CH_ULCORNER 0x5F
|
||||
#define CH_URCORNER 0x20
|
||||
#define CH_LLCORNER 0xD4
|
||||
#define CH_LRCORNER 0xDF
|
||||
#define CH_TTEE 0x5F
|
||||
#define CH_BTEE 0xD4
|
||||
#define CH_LTEE 0xD4
|
||||
#define CH_RTEE 0xDF
|
||||
#define CH_CROSS 0xD4
|
||||
|
||||
/* These are defined to be OpenApple + NumberKey */
|
||||
#define CH_F1 0xB1
|
||||
#define CH_F2 0xB2
|
||||
#define CH_F3 0xB3
|
||||
#define CH_F4 0xB4
|
||||
#define CH_F5 0xB5
|
||||
#define CH_F6 0xB6
|
||||
#define CH_F7 0xB7
|
||||
#define CH_F8 0xB8
|
||||
#define CH_F9 0xB9
|
||||
#define CH_F10 0xB0
|
||||
|
||||
/* Video modes */
|
||||
#define VIDEOMODE_40x24 0x0011
|
||||
#define VIDEOMODE_80x24 0x0012
|
||||
#define VIDEOMODE_40COL VIDEOMODE_40x24
|
||||
#define VIDEOMODE_80COL VIDEOMODE_80x24
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Variables */
|
||||
/*****************************************************************************/
|
||||
@@ -106,21 +63,5 @@ extern void a2e_lo_tgi[];
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
unsigned __fastcall__ videomode (unsigned mode);
|
||||
/* Set the video mode, return the old mode. Call with one of the VIDEOMODE_xx
|
||||
** constants.
|
||||
*/
|
||||
|
||||
void waitvsync (void);
|
||||
/* Wait for start of next frame */
|
||||
|
||||
|
||||
|
||||
/* End of apple2enh.h */
|
||||
#endif
|
||||
|
||||
@@ -40,6 +40,20 @@
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
#if (__CPU__ & __CPU_ISET_65SC02__)
|
||||
/* Always inline, three bytes is not more than a jsr */
|
||||
|
||||
#define ntohs(x) \
|
||||
( \
|
||||
__AX__=(x), \
|
||||
asm("phx"), \
|
||||
asm("tax"), \
|
||||
asm("pla"), \
|
||||
__AX__ \
|
||||
)
|
||||
#define htons(x) ntohs(x)
|
||||
|
||||
#else
|
||||
|
||||
#if (__OPT_i__ < 200)
|
||||
int __fastcall__ ntohs (int val);
|
||||
@@ -56,12 +70,12 @@ int __fastcall__ htons (int val);
|
||||
)
|
||||
#define htons(x) ntohs(x)
|
||||
|
||||
#endif
|
||||
#endif /* __OPT_i__ < 200 */
|
||||
|
||||
#endif /* __CPU__ & __CPU_ISET_65SC02__ */
|
||||
|
||||
long __fastcall__ ntohl (long val);
|
||||
long __fastcall__ htonl (long val);
|
||||
|
||||
|
||||
|
||||
/* End of arpa/inet.h */
|
||||
#endif
|
||||
|
||||
@@ -220,17 +220,17 @@
|
||||
/* Color register functions */
|
||||
/*****************************************************************************/
|
||||
|
||||
extern void __fastcall__ _setcolor (unsigned char color_reg, unsigned char hue, unsigned char luminance);
|
||||
extern void __fastcall__ _setcolor_low (unsigned char color_reg, unsigned char color_value);
|
||||
extern unsigned char __fastcall__ _getcolor (unsigned char color_reg);
|
||||
void __fastcall__ _setcolor (unsigned char color_reg, unsigned char hue, unsigned char luminance);
|
||||
void __fastcall__ _setcolor_low (unsigned char color_reg, unsigned char color_value);
|
||||
unsigned char __fastcall__ _getcolor (unsigned char color_reg);
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Other screen functions */
|
||||
/*****************************************************************************/
|
||||
|
||||
extern void waitvsync (void); /* wait for start of next frame */
|
||||
extern int __fastcall__ _graphics (unsigned char mode); /* mode value same as in BASIC */
|
||||
extern void __fastcall__ _scroll (signed char numlines);
|
||||
void waitvsync (void); /* wait for start of next frame */
|
||||
int __fastcall__ _graphics (unsigned char mode); /* mode value same as in BASIC */
|
||||
void __fastcall__ _scroll (signed char numlines);
|
||||
/* numlines > 0 scrolls up */
|
||||
/* numlines < 0 scrolls down */
|
||||
|
||||
@@ -239,18 +239,18 @@ extern void __fastcall__ _scroll (signed char numlines);
|
||||
/* Sound function */
|
||||
/*****************************************************************************/
|
||||
|
||||
extern void __fastcall__ _sound (unsigned char voice, unsigned char frequency, unsigned char distortion, unsigned char volume);
|
||||
void __fastcall__ _sound (unsigned char voice, unsigned char frequency, unsigned char distortion, unsigned char volume);
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Misc. functions */
|
||||
/*****************************************************************************/
|
||||
|
||||
extern unsigned char get_ostype(void); /* get ROM version */
|
||||
extern unsigned char get_tv(void); /* get TV system */
|
||||
extern void _save_vecs(void); /* save system vectors */
|
||||
extern void _rest_vecs(void); /* restore system vectors */
|
||||
extern char *_getdefdev(void); /* get default floppy device */
|
||||
extern unsigned char _is_cmdline_dos(void); /* does DOS support command lines */
|
||||
unsigned char get_ostype(void); /* get ROM version */
|
||||
unsigned char get_tv(void); /* get TV system */
|
||||
void _save_vecs(void); /* save system vectors */
|
||||
void _rest_vecs(void); /* restore system vectors */
|
||||
char *_getdefdev(void); /* get default floppy device */
|
||||
unsigned char _is_cmdline_dos(void); /* does DOS support command lines */
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
@@ -94,7 +94,7 @@ extern void atr5200std_joy[]; /* referred to by joy_static_stddrv[] */
|
||||
#define _bordercolor(color) 0
|
||||
|
||||
/* wait for start of next frame */
|
||||
extern void waitvsync (void);
|
||||
void waitvsync (void);
|
||||
|
||||
/* end of atari5200.h */
|
||||
#endif
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
/* No support for dynamically loadable drivers */
|
||||
#define DYN_DRV 0
|
||||
|
||||
extern unsigned char get_tv(void); /* get TV system */
|
||||
unsigned char get_tv(void); /* get TV system */
|
||||
|
||||
#include <_tia.h>
|
||||
#define TIA (*(struct __tia*)0x0000)
|
||||
|
||||
@@ -170,6 +170,20 @@ void atmos_zap (void);
|
||||
/* Raygun sound effect */
|
||||
|
||||
|
||||
/* The following #defines will cause the matching function prototypes
|
||||
** in conio.h to be overlaid by macroes with the same names,
|
||||
** thereby saving the function call overhead.
|
||||
*/
|
||||
#define _textcolor(color) COLOR_WHITE
|
||||
#define _bgcolor(color) COLOR_BLACK
|
||||
#define _bordercolor(color) COLOR_BLACK
|
||||
#define _cpeekcolor(color) COLOR_WHITE
|
||||
|
||||
|
||||
void waitvsync (void);
|
||||
/* Wait for start of next frame */
|
||||
|
||||
|
||||
|
||||
/* End of atmos.h */
|
||||
#endif
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
#define COLOR_WHITE (BCOLOR_WHITE | CATTR_LUMA7)
|
||||
#define COLOR_RED (BCOLOR_RED | CATTR_LUMA4)
|
||||
#define COLOR_CYAN (BCOLOR_CYAN | CATTR_LUMA7)
|
||||
#define COLOR_PURPLE (BCOLOR_VIOLET | CATTR_LUMA7)
|
||||
#define COLOR_PURPLE (BCOLOR_LIGHTVIOLET | CATTR_LUMA7)
|
||||
#define COLOR_GREEN (BCOLOR_GREEN | CATTR_LUMA7)
|
||||
#define COLOR_BLUE (BCOLOR_BLUE | CATTR_LUMA7)
|
||||
#define COLOR_YELLOW (BCOLOR_YELLOW | CATTR_LUMA7)
|
||||
|
||||
@@ -216,7 +216,18 @@ void __fastcall__ cputhex16 (unsigned val);
|
||||
# define cpeekrevers() _cpeekrevers()
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _chline
|
||||
# define chline(len) _chline(len)
|
||||
#endif
|
||||
#ifdef _cvline
|
||||
# define cvline(len) _cvline(len)
|
||||
#endif
|
||||
#ifdef _chlinexy
|
||||
# define chlinexy(x, y, len) _chlinexy(x, y, len)
|
||||
#endif
|
||||
#ifdef _cvlinexy
|
||||
# define cvlinexy(x, y, len) _cvlinexy(x, y, len)
|
||||
#endif
|
||||
|
||||
/* End of conio.h */
|
||||
#endif
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/* cx16.h */
|
||||
/* */
|
||||
/* CX16 system-specific definitions */
|
||||
/* For prerelease 39 */
|
||||
/* For prerelease 43 */
|
||||
/* */
|
||||
/* */
|
||||
/* This software is provided "as-is", without any expressed or implied */
|
||||
@@ -176,6 +176,11 @@ enum {
|
||||
#define VIDEOMODE_40x15 0x04
|
||||
#define VIDEOMODE_20x30 0x05
|
||||
#define VIDEOMODE_20x15 0x06
|
||||
#define VIDEOMODE_22x23 0x07
|
||||
#define VIDEOMODE_64x50 0x08
|
||||
#define VIDEOMODE_64x25 0x09
|
||||
#define VIDEOMODE_32x50 0x0A
|
||||
#define VIDEOMODE_32x25 0x0B
|
||||
#define VIDEOMODE_80COL VIDEOMODE_80x60
|
||||
#define VIDEOMODE_40COL VIDEOMODE_40x30
|
||||
#define VIDEOMODE_320x240 0x80
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
#ifndef _DIRENT_H
|
||||
#define _DIRENT_H
|
||||
|
||||
#include <target.h>
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -46,31 +48,15 @@ typedef struct DIR DIR;
|
||||
#if defined(__APPLE2__)
|
||||
|
||||
struct dirent {
|
||||
char d_name[16];
|
||||
unsigned d_ino;
|
||||
unsigned d_blocks;
|
||||
unsigned long d_size;
|
||||
unsigned char d_type;
|
||||
struct {
|
||||
unsigned day :5;
|
||||
unsigned mon :4;
|
||||
unsigned year :7;
|
||||
} d_cdate;
|
||||
struct {
|
||||
unsigned char min;
|
||||
unsigned char hour;
|
||||
} d_ctime;
|
||||
unsigned char d_access;
|
||||
unsigned d_auxtype;
|
||||
struct {
|
||||
unsigned day :5;
|
||||
unsigned mon :4;
|
||||
unsigned year :7;
|
||||
} d_mdate;
|
||||
struct {
|
||||
unsigned char min;
|
||||
unsigned char hour;
|
||||
} d_mtime;
|
||||
char d_name[16];
|
||||
unsigned d_ino;
|
||||
unsigned d_blocks;
|
||||
unsigned long d_size;
|
||||
unsigned char d_type;
|
||||
struct datetime d_ctime;
|
||||
unsigned char d_access;
|
||||
unsigned d_auxtype;
|
||||
struct datetime d_mtime;
|
||||
};
|
||||
|
||||
#define _DE_ISREG(t) ((t) != 0x0F)
|
||||
@@ -161,7 +147,5 @@ void __fastcall__ seekdir (DIR* dir, long offs);
|
||||
|
||||
void __fastcall__ rewinddir (DIR* dir);
|
||||
|
||||
|
||||
|
||||
/* End of dirent.h */
|
||||
#endif
|
||||
|
||||
177
include/lynx.h
177
include/lynx.h
@@ -31,27 +31,15 @@
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef _LYNX_H
|
||||
#define _LYNX_H
|
||||
|
||||
|
||||
|
||||
/* Check for errors */
|
||||
#if !defined(__LYNX__)
|
||||
# error This module may only be used when compiling for the Lynx game console!
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
/* Color defines */
|
||||
/* Color definitions */
|
||||
#define COLOR_TRANSPARENT 0x00
|
||||
#define COLOR_BLACK 0x01
|
||||
#define COLOR_RED 0x02
|
||||
@@ -88,6 +76,56 @@
|
||||
#define TGI_COLOR_LIGHTBLUE COLOR_LIGHTBLUE
|
||||
#define TGI_COLOR_WHITE COLOR_WHITE
|
||||
|
||||
/* No support for dynamically loadable drivers */
|
||||
#define DYN_DRV 0
|
||||
|
||||
/* Addresses of static drivers */
|
||||
extern void lynx_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */
|
||||
extern void lynx_comlynx_ser[]; /* Referred to by ser_static_stddrv[] */
|
||||
extern void lynx_160_102_16_tgi[]; /* Referred to by tgi_static_stddrv[] */
|
||||
|
||||
/* Sound support */
|
||||
void lynx_snd_init (void); /* Initialize the sound driver */
|
||||
void lynx_snd_pause (void); /* Pause sound */
|
||||
void lynx_snd_continue (void); /* Continue sound after pause */
|
||||
void __fastcall__ lynx_snd_play (unsigned char channel, unsigned char *music); /* Play tune on channel */
|
||||
void lynx_snd_stop (void); /* Stop sound on all channels */
|
||||
void __fastcall__ lynx_snd_stop_channel (unsigned char channel); /* Stop sound on all channels */
|
||||
unsigned char lynx_snd_active(void); /* Show which channels are active */
|
||||
|
||||
/* Cartridge access */
|
||||
void __fastcall__ lynx_load (int file_number); /* Load a file into RAM using a zero-based index */
|
||||
void __fastcall__ lynx_exec (int file_number); /* Load a file into ram and execute it */
|
||||
|
||||
/* EEPROM access */
|
||||
unsigned __fastcall__ lynx_eeprom_read (unsigned char cell); /* Read a 16 bit word from the given address */
|
||||
unsigned __fastcall__ lynx_eeprom_write (unsigned char cell, unsigned val); /* Write the word at the given address */
|
||||
void __fastcall__ lynx_eeprom_erase (unsigned char cell); /* Clear the word at the given address */
|
||||
unsigned __fastcall__ lynx_eeread (unsigned cell); /* Read a 16 bit word from the given address 93C46, 93C66 or 93C86 */
|
||||
unsigned __fastcall__ lynx_eewrite (unsigned cell, unsigned val); /* Write the word at the given address 93C46, 93C66 or 93C86 */
|
||||
|
||||
/* TGI extras */
|
||||
#define tgi_sprite(spr) tgi_ioctl(0, spr)
|
||||
#define tgi_flip() tgi_ioctl(1, (void*)0)
|
||||
#define tgi_setbgcolor(bgcol) tgi_ioctl(2, (void*)(bgcol))
|
||||
#define tgi_setframerate(rate) tgi_ioctl(3, (void*)(rate))
|
||||
#define tgi_busy() tgi_ioctl(4, (void*)0)
|
||||
#define tgi_updatedisplay() tgi_ioctl(4, (void*)1)
|
||||
#define tgi_setcollisiondetection(active) tgi_ioctl(5, (void*)(active))
|
||||
|
||||
/* Hardware definitions */
|
||||
#include <_mikey.h>
|
||||
#define MIKEY (*(struct __mikey *)0xFD00)
|
||||
|
||||
#define _MIKEY_TIMERS (*(struct _mikey_all_timers *) 0xFD00) /* mikey_timers[8] */
|
||||
#define _HBL_TIMER (*(struct _mikey_timer *) 0xFD00) /* timer0 (HBL) */
|
||||
#define _VBL_TIMER (*(struct _mikey_timer *) 0xFD08) /* timer2 (VBL) */
|
||||
#define _UART_TIMER (*(struct _mikey_timer *) 0xFD14) /* timer4 (UART) */
|
||||
#define _VIDDMA (*(unsigned int *) 0xFD92) /* DISPCTL/VIDDMA */
|
||||
|
||||
#include <_suzy.h>
|
||||
#define SUZY (*(volatile struct __suzy*)0xFC00)
|
||||
|
||||
/* Masks for joy_read */
|
||||
#define JOY_UP_MASK 0x80
|
||||
#define JOY_DOWN_MASK 0x40
|
||||
@@ -102,118 +140,5 @@
|
||||
#define JOY_BTN_A(v) ((v) & JOY_BTN_A_MASK)
|
||||
#define JOY_BTN_B(v) ((v) & JOY_BTN_B_MASK)
|
||||
|
||||
/* No support for dynamically loadable drivers */
|
||||
#define DYN_DRV 0
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Variables */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
/* The addresses of the static drivers */
|
||||
extern void lynx_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */
|
||||
extern void lynx_comlynx_ser[]; /* Referred to by ser_static_stddrv[] */
|
||||
extern void lynx_160_102_16_tgi[]; /* Referred to by tgi_static_stddrv[] */
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Sound support */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
void lynx_snd_init (void);
|
||||
/* Initialize the sound driver */
|
||||
|
||||
void lynx_snd_pause (void);
|
||||
/* Pause sound */
|
||||
|
||||
void lynx_snd_continue (void);
|
||||
/* Continue sound after pause */
|
||||
|
||||
void __fastcall__ lynx_snd_play (unsigned char channel, unsigned char *music);
|
||||
/* Play tune on channel */
|
||||
|
||||
void lynx_snd_stop (void);
|
||||
/* Stop sound on all channels */
|
||||
|
||||
void __fastcall__ lynx_snd_stop_channel (unsigned char channel);
|
||||
/* Stop sound on all channels */
|
||||
|
||||
unsigned char lynx_snd_active(void);
|
||||
/* Show which channels are active */
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Accessing the cart */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
void __fastcall__ lynx_load (int fileno);
|
||||
/* Load a file into ram. The first entry is fileno=0. */
|
||||
|
||||
void __fastcall__ lynx_exec (int fileno);
|
||||
/* Load a file into ram and execute it. */
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Accessing the EEPROM */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
unsigned __fastcall__ lynx_eeprom_read (unsigned char cell);
|
||||
/* Read a 16 bit word from the given address */
|
||||
|
||||
unsigned __fastcall__ lynx_eeprom_write (unsigned char cell, unsigned val);
|
||||
/* Write the word at the given address */
|
||||
|
||||
void __fastcall__ lynx_eeprom_erase (unsigned char cell);
|
||||
/* Clear the word at the given address */
|
||||
|
||||
unsigned __fastcall__ lynx_eeread (unsigned cell);
|
||||
/* Read a 16 bit word from the given address 93C46 93C66 or 93C86*/
|
||||
|
||||
unsigned __fastcall__ lynx_eewrite (unsigned cell, unsigned val);
|
||||
/* Write the word at the given address 93C46 93C66 or 93C86*/
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* TGI extras */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
#define tgi_sprite(spr) tgi_ioctl(0, spr)
|
||||
#define tgi_flip() tgi_ioctl(1, (void*)0)
|
||||
#define tgi_setbgcolor(bgcol) tgi_ioctl(2, (void*)(bgcol))
|
||||
#define tgi_setframerate(rate) tgi_ioctl(3, (void*)(rate))
|
||||
#define tgi_busy() tgi_ioctl(4, (void*)0)
|
||||
#define tgi_updatedisplay() tgi_ioctl(4, (void*)1)
|
||||
#define tgi_setcollisiondetection(active) tgi_ioctl(5, (void*)(active))
|
||||
|
||||
/* Define Hardware */
|
||||
#include <_mikey.h>
|
||||
#define MIKEY (*(struct __mikey *)0xFD00)
|
||||
|
||||
#define _MIKEY_TIMERS (*(struct _mikey_all_timers *) 0xFD00) // mikey_timers[8]
|
||||
#define _HBL_TIMER (*(struct _mikey_timer *) 0xFD00) // timer0 (HBL)
|
||||
#define _VBL_TIMER (*(struct _mikey_timer *) 0xFD08) // timer2 (VBL)
|
||||
#define _UART_TIMER (*(struct _mikey_timer *) 0xFD14) // timer4 (UART)
|
||||
#define _VIDDMA (*(unsigned int *) 0xFD92) // dispctl/viddma
|
||||
|
||||
#include <_suzy.h>
|
||||
#define SUZY (*(struct __suzy*)0xFC00)
|
||||
|
||||
|
||||
|
||||
/* End of lynx.h */
|
||||
#endif
|
||||
|
||||
56
include/lzsa.h
Normal file
56
include/lzsa.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* lzsa.h */
|
||||
/* */
|
||||
/* Decompression routine for the 'lzsa' format */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2022 John Brandwood */
|
||||
/* */
|
||||
/* */
|
||||
/* Boost license: */
|
||||
/* Distributed under the Boost Software License, Version 1.0. */
|
||||
/* Boost Software License - Version 1.0 - August 17th, 2003 */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person or */
|
||||
/* organization */
|
||||
/* obtaining a copy of the software and accompanying documentation covered by*/
|
||||
/* this license (the "Software") to use, reproduce, display, distribute, */
|
||||
/* execute, and transmit the Software, and to prepare derivative works of the*/
|
||||
/* Software, and to permit third-parties to whom the Software is furnished to*/
|
||||
/* do so, all subject to the following: */
|
||||
/* */
|
||||
/* The copyright notices in the Software and this entire statement, including*/
|
||||
/* the above license grant, this restriction and the following disclaimer, */
|
||||
/* must be included in all copies of the Software, in whole or in part, and */
|
||||
/* all derivative works of the Software, unless such copies or derivative */
|
||||
/* works are solely in the form of machine-executable object code generated */
|
||||
/* by a source language processor. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*/
|
||||
/* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, */
|
||||
/* FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT */
|
||||
/* SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE */
|
||||
/* FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR */
|
||||
/* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE */
|
||||
/* USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef _LZSA_H
|
||||
#define _LZSA_H
|
||||
|
||||
void __fastcall__ decompress_lzsa1 (const unsigned char* src, unsigned char* const dst);
|
||||
/* Decompresses the source buffer into the destination buffer.
|
||||
** compress with lzsa -r -f 1 input.bin output.lzsa1
|
||||
*/
|
||||
|
||||
void __fastcall__ decompress_lzsa2 (const unsigned char* src, unsigned char* const dst);
|
||||
/* Decompresses the source buffer into the destination buffer.
|
||||
** compress with lzsa -r -f 2 input.bin output.lzsa2
|
||||
*/
|
||||
|
||||
/* end of lzsa.h */
|
||||
#endif
|
||||
@@ -47,8 +47,7 @@ struct __RP6502
|
||||
unsigned char step1;
|
||||
unsigned int addr1;
|
||||
unsigned char xstack;
|
||||
unsigned char errno_lo;
|
||||
unsigned char errno_hi;
|
||||
unsigned int errno;
|
||||
unsigned char op;
|
||||
unsigned char irq;
|
||||
const unsigned char spin;
|
||||
@@ -72,8 +71,8 @@ void __fastcall__ ria_push_long (unsigned long val);
|
||||
void __fastcall__ ria_push_int (unsigned int val);
|
||||
#define ria_push_char(v) RIA.xstack = v
|
||||
|
||||
long __fastcall__ ria_pop_long (void);
|
||||
int __fastcall__ ria_pop_int (void);
|
||||
long ria_pop_long (void);
|
||||
int ria_pop_int (void);
|
||||
#define ria_pop_char() RIA.xstack
|
||||
|
||||
/* Set the RIA fastcall register */
|
||||
@@ -101,6 +100,7 @@ long __fastcall__ ria_call_long_errno (unsigned char op);
|
||||
#define RIA_OP_CODEPAGE 0x03
|
||||
#define RIA_OP_LRAND 0x04
|
||||
#define RIA_OP_STDIN_OPT 0x05
|
||||
#define RIA_OP_CLOCK 0x0F
|
||||
#define RIA_OP_CLOCK_GETRES 0x10
|
||||
#define RIA_OP_CLOCK_GETTIME 0x11
|
||||
#define RIA_OP_CLOCK_SETTIME 0x12
|
||||
@@ -117,10 +117,12 @@ long __fastcall__ ria_call_long_errno (unsigned char op);
|
||||
|
||||
/* C API for the operating system. */
|
||||
|
||||
int __cdecl__ xregn (char device, char channel, unsigned char address, unsigned count,
|
||||
...);
|
||||
int __cdecl__ xreg (char device, char channel, unsigned char address, ...);
|
||||
int __fastcall__ phi2 (void);
|
||||
int __fastcall__ codepage (void);
|
||||
long __fastcall__ lrand (void);
|
||||
int phi2 (void);
|
||||
int codepage (void);
|
||||
long lrand (void);
|
||||
int __fastcall__ stdin_opt (unsigned long ctrl_bits, unsigned char str_length);
|
||||
int __fastcall__ read_xstack (void* buf, unsigned count, int fildes);
|
||||
int __fastcall__ read_xram (unsigned buf, unsigned count, int fildes);
|
||||
|
||||
136
include/sim65.h
Normal file
136
include/sim65.h
Normal file
@@ -0,0 +1,136 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* sim65.h */
|
||||
/* */
|
||||
/* Definitions for the sim6502 and sim65c02 targets */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2025 Sidney Cadot */
|
||||
/* */
|
||||
/* */
|
||||
/* 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. */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifndef _SIM65_H
|
||||
#define _SIM65_H
|
||||
|
||||
/* Check that we include this file while compiling to a compatible target. */
|
||||
#if !defined(__SIM6502__) && !defined(__SIM65C02__)
|
||||
# error This module may only be used when compiling for the sim6502 or sim65c02 targets!
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* The sim65 targets (sim6502, sim65c02) have a peripheral memory aperture located at
|
||||
* address range 0xFFC0 .. 0xFFDF. Currently, the following peripherals are located
|
||||
* inside that memory apeture:
|
||||
*
|
||||
* $FFC0 .. $FFC9 "counter" peripheral
|
||||
* $FFCA .. $FFCB "sim65 control" peripheral
|
||||
* $FFCC .. $FFDF (currently unused)
|
||||
*
|
||||
* The "peripherals" structure below corresponds to the register layout of the currently
|
||||
* defined peripherals in this memory range. Combined with the fact that the sim6502 and
|
||||
* sim65c02 linker configuration files define the "peripherals" symbol to be fixed at
|
||||
* address $FFC0, this provides easy-to-use and efficient access to the peripheral registers.
|
||||
*
|
||||
* After including "sim65.h", it is possible for a C program to do things like:
|
||||
*
|
||||
* {
|
||||
* peripherals.counter.latch = 0;
|
||||
* peripherals.sim65.cpu_mode = SIM65_CPU_MODE_6502X;
|
||||
* peripherals.sim65.trace_mode = SIM65_TRACE_MODE_ENABLE_FULL;
|
||||
* }
|
||||
*
|
||||
* Note that "peripherals" variable is declared volatile. This instructs a C compiler to
|
||||
* forego optimizations on memory accesses to the variable. However, CC65 currently ignores
|
||||
* the volatile attribute. Fortunately, it is not smart with respect to optimizing
|
||||
* memory accesses, so accessing the "peripherals" fields works fine in practice.
|
||||
*/
|
||||
|
||||
extern volatile struct {
|
||||
struct {
|
||||
uint8_t latch;
|
||||
uint8_t select;
|
||||
union {
|
||||
uint8_t value [8]; /* Access value as eight separate bytes. */
|
||||
uint16_t value16 [4]; /* Access value as four 16-bit words. */
|
||||
uint32_t value32 [2]; /* Access value as two 32-bit long words. */
|
||||
};
|
||||
} counter;
|
||||
struct {
|
||||
uint8_t cpu_mode;
|
||||
uint8_t trace_mode;
|
||||
} sim65;
|
||||
} peripherals;
|
||||
|
||||
/* Values for the peripherals.counter.select field. */
|
||||
#define COUNTER_SELECT_CLOCKCYCLE_COUNTER 0x00
|
||||
#define COUNTER_SELECT_INSTRUCTION_COUNTER 0x01
|
||||
#define COUNTER_SELECT_IRQ_COUNTER 0x02
|
||||
#define COUNTER_SELECT_NMI_COUNTER 0x03
|
||||
#define COUNTER_SELECT_WALLCLOCK_TIME 0x80
|
||||
#define COUNTER_SELECT_WALLCLOCK_TIME_SPLIT 0x81
|
||||
|
||||
/* Values for the peripherals.sim65.cpu_mode field. */
|
||||
#define SIM65_CPU_MODE_6502 0x00
|
||||
#define SIM65_CPU_MODE_65C02 0x01
|
||||
#define SIM65_CPU_MODE_6502X 0x02
|
||||
|
||||
/* Bitfield values for the peripherals.sim65.trace_mode field. */
|
||||
#define SIM65_TRACE_MODE_FIELD_INSTR_COUNTER 0x40
|
||||
#define SIM65_TRACE_MODE_FIELD_CLOCK_COUNTER 0x20
|
||||
#define SIM65_TRACE_MODE_FIELD_PC 0x10
|
||||
#define SIM65_TRACE_MODE_FIELD_INSTR_BYTES 0x08
|
||||
#define SIM65_TRACE_MODE_FIELD_INSTR_ASSEMBLY 0x04
|
||||
#define SIM65_TRACE_MODE_FIELD_CPU_REGISTERS 0x02
|
||||
#define SIM65_TRACE_MODE_FIELD_CC65_SP 0x01
|
||||
|
||||
/* Values for the peripherals.sim65.trace_mode field that fully disable / enable tracing. */
|
||||
#define SIM65_TRACE_MODE_DISABLE 0x00
|
||||
#define SIM65_TRACE_MODE_ENABLE_FULL 0x7F
|
||||
|
||||
/* Convenience macros to enable / disable tracing at runtime. */
|
||||
#define TRACE_ON() do peripherals.sim65.trace_mode = SIM65_TRACE_MODE_ENABLE_FULL; while(0)
|
||||
#define TRACE_OFF() do peripherals.sim65.trace_mode = SIM65_TRACE_MODE_DISABLE; while(0)
|
||||
|
||||
/* Convenience macro to query the CPU mode at runtime. */
|
||||
#define GET_CPU_MODE() peripherals.sim65.cpu_mode
|
||||
|
||||
/* Convenience macro to set the CPU mode at runtime.
|
||||
*
|
||||
* Use SIM65_CPU_MODE_6502, SIM65_CPU_MODE_65C02, or SIM65_CPU_MODE_6502 as argument.
|
||||
*
|
||||
* Important Note:
|
||||
*
|
||||
* When running in a program compiled for the "sim6502" target, it is safe to switch to
|
||||
* 65C02 or 6502X mode, since the runtime library will only use plain 6502 opcodes, and
|
||||
* those work the same in 65C02 and 6502X mode.
|
||||
*
|
||||
* However, when running in a program compiled for the "sim65c02" target, it is NOT safe
|
||||
* to switch to 6502 or 6502X mode, since many routines in the runtime library use
|
||||
* 65C02-specific opcodes, and these will not work as expected when the CPU is switched
|
||||
* to 6502 or 6502X mode. When such an instruction is encountered, the program will
|
||||
* exhibit undefined behavior.
|
||||
*/
|
||||
#define SET_CPU_MODE(mode) do peripherals.sim65.cpu_mode = mode; while(0)
|
||||
|
||||
/* End of sim65.h */
|
||||
#endif
|
||||
@@ -52,15 +52,15 @@ typedef unsigned char uint8_t;
|
||||
typedef unsigned uint16_t;
|
||||
typedef unsigned long uint32_t;
|
||||
|
||||
#define INT8_MIN ((int8_t) 0x80)
|
||||
#define INT8_MAX ((int8_t) 0x7F)
|
||||
#define INT16_MIN ((int16_t) 0x8000)
|
||||
#define INT16_MAX ((int16_t) 0x7FFF)
|
||||
#define INT32_MIN ((int32_t) 0x80000000)
|
||||
#define INT32_MAX ((int32_t) 0x7FFFFFFF)
|
||||
#define UINT8_MAX ((uint8_t) 0xFF)
|
||||
#define UINT16_MAX ((uint16_t) 0xFFFF)
|
||||
#define UINT32_MAX ((uint32_t) 0xFFFFFFFF)
|
||||
#define INT8_MIN -128
|
||||
#define INT8_MAX 127
|
||||
#define INT16_MIN (-32767 - 1)
|
||||
#define INT16_MAX 32767
|
||||
#define INT32_MIN (-2147483647L - 1L)
|
||||
#define INT32_MAX 2147483647L
|
||||
#define UINT8_MAX 255
|
||||
#define UINT16_MAX 65535U
|
||||
#define UINT32_MAX 4294967295UL
|
||||
|
||||
/* Minimum-width integer types */
|
||||
typedef signed char int_least8_t;
|
||||
@@ -70,15 +70,15 @@ typedef unsigned char uint_least8_t;
|
||||
typedef unsigned uint_least16_t;
|
||||
typedef unsigned long uint_least32_t;
|
||||
|
||||
#define INT_LEAST8_MIN ((int_least8_t) 0x80)
|
||||
#define INT_LEAST8_MAX ((int_least8_t) 0x7F)
|
||||
#define INT_LEAST16_MIN ((int_least16_t) 0x8000)
|
||||
#define INT_LEAST16_MAX ((int_least16_t) 0x7FFF)
|
||||
#define INT_LEAST32_MIN ((int_least32_t) 0x80000000)
|
||||
#define INT_LEAST32_MAX ((int_least32_t) 0x7FFFFFFF)
|
||||
#define UINT_LEAST8_MAX ((uint_least8_t) 0xFF)
|
||||
#define UINT_LEAST16_MAX ((uint_least16_t) 0xFFFF)
|
||||
#define UINT_LEAST32_MAX ((uint_least32_t) 0xFFFFFFFF)
|
||||
#define INT_LEAST8_MIN INT8_MIN
|
||||
#define INT_LEAST8_MAX INT8_MAX
|
||||
#define INT_LEAST16_MIN INT16_MIN
|
||||
#define INT_LEAST16_MAX INT16_MAX
|
||||
#define INT_LEAST32_MIN INT32_MIN
|
||||
#define INT_LEAST32_MAX INT32_MAX
|
||||
#define UINT_LEAST8_MAX UINT8_MAX
|
||||
#define UINT_LEAST16_MAX UINT16_MAX
|
||||
#define UINT_LEAST32_MAX UINT32_MAX
|
||||
|
||||
/* Fastest minimum-width integer types */
|
||||
typedef signed char int_fast8_t;
|
||||
@@ -88,40 +88,40 @@ typedef unsigned char uint_fast8_t;
|
||||
typedef unsigned uint_fast16_t;
|
||||
typedef unsigned long uint_fast32_t;
|
||||
|
||||
#define INT_FAST8_MIN ((int_fast8_t) 0x80)
|
||||
#define INT_FAST8_MAX ((int_fast8_t) 0x7F)
|
||||
#define INT_FAST16_MIN ((int_fast16_t) 0x8000)
|
||||
#define INT_FAST16_MAX ((int_fast16_t) 0x7FFF)
|
||||
#define INT_FAST32_MIN ((int_fast32_t) 0x80000000)
|
||||
#define INT_FAST32_MAX ((int_fast32_t) 0x7FFFFFFF)
|
||||
#define UINT_FAST8_MAX ((uint_fast8_t) 0xFF)
|
||||
#define UINT_FAST16_MAX ((uint_fast16_t) 0xFFFF)
|
||||
#define UINT_FAST32_MAX ((uint_fast32_t) 0xFFFFFFFF)
|
||||
#define INT_FAST8_MIN INT8_MIN
|
||||
#define INT_FAST8_MAX INT8_MAX
|
||||
#define INT_FAST16_MIN INT16_MIN
|
||||
#define INT_FAST16_MAX INT16_MAX
|
||||
#define INT_FAST32_MIN INT32_MIN
|
||||
#define INT_FAST32_MAX INT32_MAX
|
||||
#define UINT_FAST8_MAX UINT8_MAX
|
||||
#define UINT_FAST16_MAX UINT16_MAX
|
||||
#define UINT_FAST32_MAX UINT32_MAX
|
||||
|
||||
/* Integer types capable of holding object pointers */
|
||||
typedef int intptr_t;
|
||||
typedef unsigned uintptr_t;
|
||||
|
||||
#define INTPTR_MIN ((intptr_t)0x8000)
|
||||
#define INTPTR_MAX ((intptr_t)0x7FFF)
|
||||
#define UINTPTR_MAX ((uintptr_t) 0xFFFF)
|
||||
#define INTPTR_MIN INT16_MIN
|
||||
#define INTPTR_MAX INT16_MAX
|
||||
#define UINTPTR_MAX UINT16_MAX
|
||||
|
||||
/* Greatest width integer types */
|
||||
typedef long intmax_t;
|
||||
typedef unsigned long uintmax_t;
|
||||
|
||||
#define INTMAX_MIN ((intmax_t) 0x80000000)
|
||||
#define INTMAX_MAX ((intmax_t) 0x7FFFFFFF)
|
||||
#define UINTMAX_MAX ((uintmax_t) 0xFFFFFFFF)
|
||||
#define INTMAX_MIN INT32_MIN
|
||||
#define INTMAX_MAX INT32_MAX
|
||||
#define UINTMAX_MAX UINT32_MAX
|
||||
|
||||
/* Limits of other integer types */
|
||||
#define PTRDIFF_MIN ((int) 0x8000)
|
||||
#define PTRDIFF_MAX ((int) 0x7FFF)
|
||||
#define PTRDIFF_MIN INT16_MIN
|
||||
#define PTRDIFF_MAX INT16_MAX
|
||||
|
||||
#define SIG_ATOMIC_MIN ((unsigned char) 0x00)
|
||||
#define SIG_ATOMIC_MAX ((unsigned char) 0xFF)
|
||||
#define SIG_ATOMIC_MIN 0
|
||||
#define SIG_ATOMIC_MAX UINT8_MAX
|
||||
|
||||
#define SIZE_MAX 0xFFFF
|
||||
#define SIZE_MAX UINT16_MAX
|
||||
|
||||
/* Macros for minimum width integer constants */
|
||||
#define INT8_C(c) c
|
||||
|
||||
@@ -86,6 +86,10 @@ extern FILE* stderr;
|
||||
# define FILENAME_MAX (80+1)
|
||||
#elif defined(__TELESTRAT__)
|
||||
# define FILENAME_MAX (50+1)
|
||||
#elif defined(__SIM6502__)
|
||||
# define FILENAME_MAX (1024+1)
|
||||
#elif defined(__SIM65C02__)
|
||||
# define FILENAME_MAX (1024+1)
|
||||
#else
|
||||
# define FILENAME_MAX (16+1)
|
||||
#endif
|
||||
|
||||
@@ -81,6 +81,7 @@ void __fastcall__ bzero (void* ptr, size_t n); /* BSD */
|
||||
char* __fastcall__ strdup (const char* s); /* SYSV/BSD */
|
||||
int __fastcall__ stricmp (const char* s1, const char* s2); /* DOS/Windows */
|
||||
int __fastcall__ strcasecmp (const char* s1, const char* s2); /* Same for Unix */
|
||||
char* __fastcall__ strcasestr (const char* str, const char* substr);
|
||||
int __fastcall__ strnicmp (const char* s1, const char* s2, size_t count); /* DOS/Windows */
|
||||
int __fastcall__ strncasecmp (const char* s1, const char* s2, size_t count); /* Same for Unix */
|
||||
size_t __fastcall__ strnlen (const char* s, size_t maxlen); /* POSIX.1-2008 */
|
||||
@@ -89,6 +90,7 @@ char* __fastcall__ strlower (char* s);
|
||||
char* __fastcall__ strupr (char* s);
|
||||
char* __fastcall__ strupper (char* s);
|
||||
char* __fastcall__ strqtok (char* s1, const char* s2);
|
||||
char* __fastcall__ stpcpy (char* dest, const char* src);
|
||||
#endif
|
||||
|
||||
const char* __fastcall__ __stroserror (unsigned char errcode);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/* */
|
||||
/* stat.h */
|
||||
/* */
|
||||
/* Constants for the mode argument of open and creat */
|
||||
/* stat(2) definition */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -11,6 +11,9 @@
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
/* (C) 2023 Colin Leroy-Mira */
|
||||
/* EMail: colin@colino.net */
|
||||
/* */
|
||||
/* */
|
||||
/* This software is provided 'as-is', without any expressed or implied */
|
||||
/* warranty. In no event will the authors be held liable for any damages */
|
||||
@@ -36,6 +39,10 @@
|
||||
#ifndef _STAT_H
|
||||
#define _STAT_H
|
||||
|
||||
#include <time.h>
|
||||
#include <target.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -47,6 +54,30 @@
|
||||
#define S_IREAD 0x01
|
||||
#define S_IWRITE 0x02
|
||||
|
||||
#define S_IFMT 0x03
|
||||
|
||||
struct stat {
|
||||
dev_t st_dev;
|
||||
ino_t st_ino;
|
||||
mode_t st_mode;
|
||||
nlink_t st_nlink;
|
||||
uid_t st_uid;
|
||||
gid_t st_gid;
|
||||
off_t st_size;
|
||||
struct timespec st_atim;
|
||||
struct timespec st_ctim;
|
||||
struct timespec st_mtim;
|
||||
#ifdef __APPLE2__
|
||||
unsigned char st_access;
|
||||
unsigned char st_type;
|
||||
unsigned int st_auxtype;
|
||||
unsigned char st_storagetype;
|
||||
unsigned int st_blocks;
|
||||
struct datetime st_mtime;
|
||||
struct datetime st_ctime;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -55,5 +86,9 @@
|
||||
|
||||
|
||||
|
||||
int __fastcall__ stat (const char* pathname, struct stat* statbuf);
|
||||
|
||||
|
||||
|
||||
/* End of stat.h */
|
||||
#endif
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* asctime.c */
|
||||
/* statvfs.h */
|
||||
/* */
|
||||
/* Convert a broken down time into a string */
|
||||
/* statvfs(3) definition */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2002 Ullrich von Bassewitz */
|
||||
/* Wacholderweg 14 */
|
||||
/* D-70597 Stuttgart */
|
||||
/* EMail: uz@musoftware.de */
|
||||
/* (C) 2023 Colin Leroy-Mira */
|
||||
/* EMail: colin@colino.net */
|
||||
/* */
|
||||
/* */
|
||||
/* This software is provided 'as-is', without any expressed or implied */
|
||||
@@ -33,8 +31,32 @@
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#ifndef _STATVFS_H
|
||||
#define _STATVFS_H
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
struct statvfs {
|
||||
unsigned long f_bsize;
|
||||
unsigned long f_frsize;
|
||||
fsblkcnt_t f_blocks;
|
||||
fsblkcnt_t f_bfree;
|
||||
fsblkcnt_t f_bavail;
|
||||
fsfilcnt_t f_files;
|
||||
fsfilcnt_t f_ffree;
|
||||
fsfilcnt_t f_favail;
|
||||
unsigned long f_fsid;
|
||||
unsigned long f_flag;
|
||||
unsigned long f_namemax;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -42,18 +64,11 @@
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
CAUTION: we need to reserve enough space to be able to hold the maximum
|
||||
length string:
|
||||
|
||||
1234567890123456789012345678901234567
|
||||
"Wednesday September ..1 00:00:00 1970"
|
||||
*/
|
||||
|
||||
char* __fastcall__ asctime (const struct tm* timep)
|
||||
{
|
||||
static char buf[38];
|
||||
int __fastcall__ statvfs (const char* pathname, struct statvfs* buf);
|
||||
|
||||
/* Format into given buffer and return the result */
|
||||
return strftime (buf, sizeof (buf), "%c\n", timep)? buf : 0;
|
||||
}
|
||||
|
||||
|
||||
/* End of statvfs.h */
|
||||
#endif
|
||||
@@ -50,6 +50,46 @@
|
||||
typedef long int off_t;
|
||||
#endif
|
||||
|
||||
#ifndef _HAVE_dev_t
|
||||
#define _HAVE_dev_t
|
||||
typedef unsigned long int dev_t;
|
||||
#endif
|
||||
|
||||
#ifndef _HAVE_ino_t
|
||||
#define _HAVE_ino_t
|
||||
typedef unsigned long int ino_t;
|
||||
#endif
|
||||
|
||||
#ifndef _HAVE_nlink_t
|
||||
#define _HAVE_nlink_t
|
||||
typedef unsigned long int nlink_t;
|
||||
#endif
|
||||
|
||||
#ifndef _HAVE_uid_t
|
||||
#define _HAVE_uid_t
|
||||
typedef unsigned char uid_t;
|
||||
#endif
|
||||
|
||||
#ifndef _HAVE_gid_t
|
||||
#define _HAVE_gid_t
|
||||
typedef unsigned char gid_t;
|
||||
#endif
|
||||
|
||||
#ifndef _HAVE_mode_t
|
||||
#define _HAVE_mode_t
|
||||
typedef unsigned char mode_t;
|
||||
#endif
|
||||
|
||||
#ifndef _HAVE_fsblkcnt_t
|
||||
#define _HAVE_fsblkcnt_t
|
||||
typedef unsigned long int fsblkcnt_t;
|
||||
#endif
|
||||
|
||||
#ifndef _HAVE_fsfilcnt_t
|
||||
#define _HAVE_fsfilcnt_t
|
||||
typedef unsigned long int fsfilcnt_t;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -60,6 +100,3 @@ typedef long int off_t;
|
||||
|
||||
/* End of types.h */
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -37,6 +37,11 @@
|
||||
#define _TIME_H
|
||||
|
||||
|
||||
/* Forward declaration for target.h */
|
||||
typedef unsigned long time_t;
|
||||
typedef unsigned long clock_t;
|
||||
|
||||
|
||||
|
||||
/* NULL pointer */
|
||||
#ifndef NULL
|
||||
@@ -49,9 +54,6 @@
|
||||
typedef unsigned size_t;
|
||||
#endif
|
||||
|
||||
typedef unsigned long time_t;
|
||||
typedef unsigned long clock_t;
|
||||
|
||||
/* Structure for broken down time */
|
||||
struct tm {
|
||||
int tm_sec;
|
||||
@@ -84,6 +86,8 @@ struct tm {
|
||||
# define CLOCKS_PER_SEC 135 /* FIXME */
|
||||
#elif defined(__GEOS__)
|
||||
# define CLOCKS_PER_SEC 1
|
||||
#elif defined (__RP6502__)
|
||||
# define CLOCKS_PER_SEC 100
|
||||
#elif defined(__TELESTRAT__)
|
||||
# define CLOCKS_PER_SEC 10
|
||||
#elif defined(__ATARI__) || defined (__LYNX__)
|
||||
|
||||
44
include/zx02.h
Normal file
44
include/zx02.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* zx02.h */
|
||||
/* */
|
||||
/* Decompression routine for the 'zx02' format */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2022 DMSC */
|
||||
/* */
|
||||
/* */
|
||||
/* MIT license: */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining a */
|
||||
/* copy of this software and associated documentation files (the “Software”),*/
|
||||
/* to deal in the Software without restriction, including without limitation */
|
||||
/* the rights to use, copy, modify, merge, publish, distribute, sublicense, */
|
||||
/* and/or sell copies of the Software, and to permit persons to whom the */
|
||||
/* Software is furnished to do so, subject to the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be included */
|
||||
/* in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS */
|
||||
/* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN */
|
||||
/* NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, */
|
||||
/* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR */
|
||||
/* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE */
|
||||
/* USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef _ZX02_H
|
||||
#define _ZX02_H
|
||||
|
||||
void __fastcall__ decompress_zx02 (const unsigned char* src, unsigned char* const dst);
|
||||
/* Decompresses the source buffer into the destination buffer.
|
||||
** compress with zx02 input.bin output.zx02
|
||||
*/
|
||||
|
||||
|
||||
/* end of zx02.h */
|
||||
#endif
|
||||
380
libsrc/NameClashes.md
Normal file
380
libsrc/NameClashes.md
Normal file
@@ -0,0 +1,380 @@
|
||||
List of cc65 library name clashes
|
||||
=================================
|
||||
|
||||
The following is a list of identifiers that might need
|
||||
to be fixed, sorted by directory and identifier:
|
||||
|
||||
# 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
|
||||
28
libsrc/apple2/allow_lowercase.s
Normal file
28
libsrc/apple2/allow_lowercase.s
Normal file
@@ -0,0 +1,28 @@
|
||||
;
|
||||
; Oliver Schmidt, 2024-08-06
|
||||
;
|
||||
; unsigned char __fastcall__ allow_lowercase (unsigned char onoff);
|
||||
;
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
|
||||
.export _allow_lowercase
|
||||
.import return0
|
||||
.import uppercasemask, return1
|
||||
|
||||
_allow_lowercase:
|
||||
tax
|
||||
lda values,x
|
||||
ldx uppercasemask
|
||||
sta uppercasemask
|
||||
cpx #$FF
|
||||
beq :+
|
||||
jmp return0
|
||||
: jmp return1
|
||||
|
||||
.rodata
|
||||
|
||||
values: .byte $DF ; Force uppercase
|
||||
.byte $FF ; Keep lowercase
|
||||
|
||||
.endif
|
||||
20
libsrc/apple2/beep.s
Normal file
20
libsrc/apple2/beep.s
Normal file
@@ -0,0 +1,20 @@
|
||||
;
|
||||
; Colin Leroy-Mira, 2024
|
||||
;
|
||||
; void beep(void)
|
||||
;
|
||||
|
||||
.export _beep
|
||||
|
||||
.include "apple2.inc"
|
||||
|
||||
.segment "LOWCODE"
|
||||
|
||||
_beep:
|
||||
; Switch in ROM and call BELL
|
||||
bit $C082
|
||||
jsr $FF3A ; BELL
|
||||
|
||||
; Switch in LC bank 2 for R/O and return
|
||||
bit $C080
|
||||
rts
|
||||
73
libsrc/apple2/boxchars.s
Normal file
73
libsrc/apple2/boxchars.s
Normal file
@@ -0,0 +1,73 @@
|
||||
;
|
||||
; Colin Leroy-Mira and Oliver Schmidt, 26.05.2025
|
||||
;
|
||||
; Initialize box-drawing characters according to
|
||||
; MouseText availability
|
||||
;
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
|
||||
.constructor initboxchars
|
||||
.import machinetype
|
||||
|
||||
.export _CH_HLINE
|
||||
.export _CH_VLINE
|
||||
.export _CH_ULCORNER
|
||||
.export _CH_URCORNER
|
||||
.export _CH_LLCORNER
|
||||
.export _CH_LRCORNER
|
||||
.export _CH_TTEE
|
||||
.export _CH_BTEE
|
||||
.export _CH_LTEE
|
||||
.export _CH_RTEE
|
||||
.export _CH_CROSS
|
||||
|
||||
.segment "ONCE"
|
||||
|
||||
initboxchars:
|
||||
bit machinetype ; IIe enhanced or newer?
|
||||
bvs out
|
||||
|
||||
ldx #NUM_BOXCHARS ; No mousetext, patch characters
|
||||
: lda std_boxchars,x
|
||||
sta boxchars,x
|
||||
dex
|
||||
bpl :-
|
||||
|
||||
out: rts
|
||||
|
||||
; Replacement chars for when MouseText is not available
|
||||
std_boxchars: .byte '!'
|
||||
.byte '-'
|
||||
.byte '+'
|
||||
.byte '+'
|
||||
.byte '+'
|
||||
.byte '+'
|
||||
|
||||
.data
|
||||
|
||||
; MouseText-based box characters
|
||||
boxchars:
|
||||
VERT: .byte $DF
|
||||
HORIZ: .byte $5F
|
||||
ULCORNER: .byte $5F
|
||||
URCORNER: .byte $20
|
||||
LLCORNER: .byte $D4
|
||||
LRCORNER: .byte $DF
|
||||
|
||||
NUM_BOXCHARS = *-boxchars
|
||||
|
||||
; exported symbols, referencing our 6 bytes
|
||||
_CH_HLINE = HORIZ
|
||||
_CH_VLINE = VERT
|
||||
_CH_ULCORNER = ULCORNER
|
||||
_CH_URCORNER = URCORNER
|
||||
_CH_LLCORNER = LLCORNER
|
||||
_CH_LRCORNER = LRCORNER
|
||||
_CH_TTEE = ULCORNER
|
||||
_CH_BTEE = LLCORNER
|
||||
_CH_LTEE = LLCORNER
|
||||
_CH_RTEE = LRCORNER
|
||||
_CH_CROSS = LLCORNER
|
||||
|
||||
.endif ; not __APPLE2ENH__
|
||||
75
libsrc/apple2/callmain.s
Normal file
75
libsrc/apple2/callmain.s
Normal file
@@ -0,0 +1,75 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 2003-03-07
|
||||
;
|
||||
; Push arguments and call main()
|
||||
;
|
||||
|
||||
|
||||
.export callmain, _exit
|
||||
.export __argc, __argv
|
||||
|
||||
.import _main, pushax, done, donelib
|
||||
.import zpsave, rvsave, reset
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "apple2.inc"
|
||||
|
||||
|
||||
;---------------------------------------------------------------------------
|
||||
; Setup the stack for main(), then jump to it
|
||||
|
||||
callmain:
|
||||
lda __argc
|
||||
ldx __argc+1
|
||||
jsr pushax ; Push argc
|
||||
|
||||
lda __argv
|
||||
ldx __argv+1
|
||||
jsr pushax ; Push argv
|
||||
|
||||
ldy #4 ; Argument size
|
||||
jsr _main
|
||||
|
||||
; Avoid a re-entrance of donelib. This is also the exit() entry.
|
||||
_exit: ldx #<exit
|
||||
lda #>exit
|
||||
jsr reset ; Setup RESET vector
|
||||
|
||||
; Switch in LC bank 2 for R/O in case it was switched out by a RESET.
|
||||
bit $C080
|
||||
|
||||
; Call the module destructors.
|
||||
jsr donelib
|
||||
|
||||
; Switch in ROM.
|
||||
bit $C082
|
||||
|
||||
; Restore the original RESET vector.
|
||||
exit: ldx #$02
|
||||
: lda rvsave,x
|
||||
sta SOFTEV,x
|
||||
dex
|
||||
bpl :-
|
||||
|
||||
; Copy back the zero-page stuff.
|
||||
ldx #zpspace-1
|
||||
: lda zpsave,x
|
||||
sta sp,x
|
||||
dex
|
||||
bpl :-
|
||||
|
||||
; ProDOS TechRefMan, chapter 5.2.1:
|
||||
; "System programs should set the stack pointer to $FF at the
|
||||
; warm-start entry point."
|
||||
ldx #$FF
|
||||
txs ; Re-init stack pointer
|
||||
|
||||
; We're done
|
||||
jmp done
|
||||
|
||||
;---------------------------------------------------------------------------
|
||||
; Data
|
||||
|
||||
.data
|
||||
__argc: .word 0
|
||||
__argv: .addr 0
|
||||
@@ -7,8 +7,13 @@
|
||||
;
|
||||
|
||||
.export _cgetc
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
.import machinetype
|
||||
.endif
|
||||
.import cursor, putchardirect
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "apple2.inc"
|
||||
|
||||
_cgetc:
|
||||
@@ -17,12 +22,15 @@ _cgetc:
|
||||
beq :+
|
||||
|
||||
; Show caret.
|
||||
.ifdef __APPLE2ENH__
|
||||
lda #$7F | $80 ; Checkerboard, screen code
|
||||
.else
|
||||
.ifndef __APPLE2ENH__
|
||||
lda #' ' | $40 ; Blank, flashing
|
||||
bit machinetype
|
||||
bpl put_caret
|
||||
.endif
|
||||
jsr putchardirect ; Returns old character in X
|
||||
|
||||
lda #$7F | $80 ; Checkerboard, screen code
|
||||
put_caret:
|
||||
jsr putchardirect ; Saves old character in tmp3
|
||||
|
||||
; Wait for keyboard strobe.
|
||||
: inc RNDL ; Increment random counter low
|
||||
@@ -37,16 +45,20 @@ _cgetc:
|
||||
|
||||
; Restore old character.
|
||||
pha
|
||||
txa
|
||||
lda tmp3
|
||||
jsr putchardirect
|
||||
pla
|
||||
|
||||
; At this time, the high bit of the key pressed is set.
|
||||
: bit KBDSTRB ; Clear keyboard strobe
|
||||
.ifdef __APPLE2ENH__
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
bit machinetype ; Apple //e or more recent?
|
||||
bpl clear
|
||||
.endif
|
||||
bit BUTN0 ; Check if OpenApple is down
|
||||
bmi done
|
||||
.endif
|
||||
and #$7F ; If not down, then clear high bit
|
||||
|
||||
clear: and #$7F ; If not down, then clear high bit
|
||||
done: ldx #>$0000
|
||||
rts
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* closedir.c */
|
||||
/* */
|
||||
/* Close a directory */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2005 Oliver Schmidt, <ol.sc@web.de> */
|
||||
/* */
|
||||
/* */
|
||||
/* 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 <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <dirent.h>
|
||||
#include "dir.h"
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
int __fastcall__ closedir (DIR* dir)
|
||||
{
|
||||
int result;
|
||||
|
||||
/* Cleanup directory file */
|
||||
result = close (dir->fd);
|
||||
|
||||
/* Cleanup DIR */
|
||||
free (dir);
|
||||
|
||||
return result;
|
||||
}
|
||||
35
libsrc/apple2/closedir.s
Normal file
35
libsrc/apple2/closedir.s
Normal file
@@ -0,0 +1,35 @@
|
||||
;
|
||||
; Colin Leroy-Mira <colin@colino.net>, 2024
|
||||
;
|
||||
; int __fastcall__ closedir (DIR *dir)
|
||||
;
|
||||
|
||||
.export _closedir, closedir_ptr1
|
||||
|
||||
.import _close
|
||||
.import _free
|
||||
.import pushax, popax, pushptr1, swapstk
|
||||
|
||||
.importzp ptr1
|
||||
|
||||
.include "apple2.inc"
|
||||
.include "dir.inc"
|
||||
.include "errno.inc"
|
||||
.include "fcntl.inc"
|
||||
.include "zeropage.inc"
|
||||
|
||||
_closedir:
|
||||
sta ptr1
|
||||
stx ptr1+1
|
||||
closedir_ptr1:
|
||||
; Close fd
|
||||
jsr pushptr1 ; Backup ptr1
|
||||
ldy #$00
|
||||
lda (ptr1),y ; Get fd
|
||||
ldx #$00
|
||||
jsr _close
|
||||
jsr swapstk ; Store result, pop ptr1
|
||||
|
||||
; Free dir structure
|
||||
jsr _free
|
||||
jmp popax ; Return result
|
||||
@@ -4,25 +4,39 @@
|
||||
; char cpeekc (void);
|
||||
;
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
.import machinetype
|
||||
.endif
|
||||
|
||||
.export _cpeekc
|
||||
|
||||
.include "apple2.inc"
|
||||
|
||||
_cpeekc:
|
||||
ldy CH
|
||||
.ifdef __APPLE2ENH__
|
||||
|
||||
sec ; Assume main memory
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
bit machinetype
|
||||
bpl peek
|
||||
.endif
|
||||
|
||||
bit RD80VID ; In 80 column mode?
|
||||
bpl peek ; No, just go ahead
|
||||
tya
|
||||
lda OURCH
|
||||
lsr ; Div by 2
|
||||
tay
|
||||
bcs peek ; Odd cols are in main memory
|
||||
php
|
||||
sei ; No valid MSLOT et al. in aux memory
|
||||
bit HISCR ; Assume SET80COL
|
||||
.endif
|
||||
|
||||
peek: lda (BASL),Y ; Get character
|
||||
.ifdef __APPLE2ENH__
|
||||
bit LOWSCR ; Doesn't hurt in 40 column mode
|
||||
.endif
|
||||
eor #$80 ; Invert high bit
|
||||
ldx #$00
|
||||
bcs :+ ; In main memory
|
||||
bit LOWSCR
|
||||
plp
|
||||
|
||||
: eor #$80 ; Invert high bit
|
||||
ldx #>$0000
|
||||
rts
|
||||
|
||||
@@ -5,25 +5,33 @@
|
||||
; void __fastcall__ cputc (char c);
|
||||
;
|
||||
|
||||
.ifdef __APPLE2ENH__
|
||||
.constructor initconio
|
||||
.endif
|
||||
.export _cputcxy, _cputc
|
||||
.export cputdirect, newline, putchar, putchardirect
|
||||
.import gotoxy, VTABZ
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
.import machinetype
|
||||
.import uppercasemask
|
||||
.endif
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "apple2.inc"
|
||||
|
||||
.macpack cpu
|
||||
|
||||
.segment "ONCE"
|
||||
|
||||
.ifdef __APPLE2ENH__
|
||||
initconio:
|
||||
.ifndef __APPLE2ENH__
|
||||
bit machinetype
|
||||
bmi :+
|
||||
rts
|
||||
:
|
||||
.endif
|
||||
sta SETALTCHAR ; Switch in alternate charset
|
||||
bit LORES ; Limit SET80COL-HISCR to text
|
||||
rts
|
||||
.endif
|
||||
|
||||
.code
|
||||
|
||||
@@ -35,7 +43,7 @@ _cputcxy:
|
||||
pla ; Restore C and run into _cputc
|
||||
|
||||
_cputc:
|
||||
cmp #$0D ; Test for \r = carrage return
|
||||
cmp #$0D ; Test for \r = carriage return
|
||||
beq left
|
||||
cmp #$0A ; Test for \n = line feed
|
||||
beq newline
|
||||
@@ -43,24 +51,53 @@ _cputc:
|
||||
.ifndef __APPLE2ENH__
|
||||
cmp #$E0 ; Test for lowercase
|
||||
bcc cputdirect
|
||||
and #$DF ; Convert to uppercase
|
||||
and uppercasemask
|
||||
.endif
|
||||
|
||||
cputdirect:
|
||||
jsr putchar
|
||||
inc CH ; Bump to next column
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
bit machinetype
|
||||
bpl :+
|
||||
.endif
|
||||
bit RD80VID ; In 80 column mode?
|
||||
bpl :+
|
||||
inc OURCH ; Bump to next column
|
||||
lda OURCH
|
||||
.ifdef __APPLE2ENH__
|
||||
bra check ; Must leave CH alone
|
||||
.else
|
||||
jmp check
|
||||
.endif
|
||||
|
||||
: inc CH ; Bump to next column
|
||||
lda CH
|
||||
cmp WNDWDTH
|
||||
bcc :+
|
||||
check: cmp WNDWDTH
|
||||
bcc done
|
||||
jsr newline
|
||||
left:
|
||||
.if (.cpu .bitand CPU_ISET_65SC02)
|
||||
.ifdef __APPLE2ENH__
|
||||
stz CH ; Goto left edge of screen
|
||||
.else
|
||||
lda #$00 ; Goto left edge of screen
|
||||
lda #$00
|
||||
sta CH
|
||||
.endif
|
||||
: rts
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
bit machinetype
|
||||
bpl done
|
||||
.endif
|
||||
|
||||
bit RD80VID ; In 80 column mode?
|
||||
bpl done
|
||||
.ifdef __APPLE2ENH__
|
||||
stz OURCH ; Goto left edge of screen
|
||||
.else
|
||||
sta OURCH
|
||||
.endif
|
||||
|
||||
done: rts
|
||||
|
||||
newline:
|
||||
inc CV ; Bump to next line
|
||||
@@ -84,23 +121,32 @@ putchar:
|
||||
mask: and INVFLG ; Apply normal, inverse, flash
|
||||
|
||||
putchardirect:
|
||||
pha
|
||||
.ifdef __APPLE2ENH__
|
||||
lda CH
|
||||
tax
|
||||
ldy CH
|
||||
|
||||
sec ; Assume main memory
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
bit machinetype
|
||||
bpl put
|
||||
.endif
|
||||
|
||||
bit RD80VID ; In 80 column mode?
|
||||
bpl put ; No, just go ahead
|
||||
lda OURCH
|
||||
lsr ; Div by 2
|
||||
tay
|
||||
bcs put ; Odd cols go in main memory
|
||||
php
|
||||
sei ; No valid MSLOT et al. in aux memory
|
||||
bit HISCR ; Assume SET80COL
|
||||
put: tay
|
||||
.else
|
||||
ldy CH
|
||||
.endif
|
||||
lda (BASL),Y ; Get current character
|
||||
tax ; Return old character for _cgetc
|
||||
pla
|
||||
|
||||
put: lda (BASL),Y ; Get current character
|
||||
sta tmp3 ; Save old character for _cgetc
|
||||
txa
|
||||
sta (BASL),Y
|
||||
.ifdef __APPLE2ENH__
|
||||
bit LOWSCR ; Doesn't hurt in 40 column mode
|
||||
.endif
|
||||
rts
|
||||
|
||||
bcs :+ ; In main memory
|
||||
bit LOWSCR
|
||||
plp
|
||||
: rts
|
||||
|
||||
@@ -4,11 +4,13 @@
|
||||
; Startup code for cc65 (Apple2 version)
|
||||
;
|
||||
|
||||
.export _exit, done, return
|
||||
.export done, return
|
||||
.export zpsave, rvsave, reset
|
||||
.export __STARTUP__ : absolute = 1 ; Mark as startup
|
||||
|
||||
.import initlib, donelib
|
||||
.import initlib, _exit
|
||||
.import zerobss, callmain
|
||||
.import bltu2
|
||||
.import __ONCE_LOAD__, __ONCE_SIZE__ ; Linker generated
|
||||
.import __LC_START__, __LC_LAST__ ; Linker generated
|
||||
|
||||
@@ -33,41 +35,7 @@
|
||||
jsr zerobss
|
||||
|
||||
; Push the command-line arguments; and, call main().
|
||||
jsr callmain
|
||||
|
||||
; Avoid a re-entrance of donelib. This is also the exit() entry.
|
||||
_exit: ldx #<exit
|
||||
lda #>exit
|
||||
jsr reset ; Setup RESET vector
|
||||
|
||||
; Switch in ROM, in case it wasn't already switched in by a RESET.
|
||||
bit $C082
|
||||
|
||||
; Call the module destructors.
|
||||
jsr donelib
|
||||
|
||||
; Restore the original RESET vector.
|
||||
exit: ldx #$02
|
||||
: lda rvsave,x
|
||||
sta SOFTEV,x
|
||||
dex
|
||||
bpl :-
|
||||
|
||||
; Copy back the zero-page stuff.
|
||||
ldx #zpspace-1
|
||||
: lda zpsave,x
|
||||
sta sp,x
|
||||
dex
|
||||
bpl :-
|
||||
|
||||
; ProDOS TechRefMan, chapter 5.2.1:
|
||||
; "System programs should set the stack pointer to $FF at the
|
||||
; warm-start entry point."
|
||||
ldx #$FF
|
||||
txs ; Re-init stack pointer
|
||||
|
||||
; We're done
|
||||
jmp done
|
||||
jmp callmain
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
@@ -126,6 +94,7 @@ basic: lda HIMEM
|
||||
; Call the module constructors.
|
||||
jsr initlib
|
||||
|
||||
; Copy the LC segment to its destination
|
||||
; Switch in LC bank 2 for W/O.
|
||||
bit $C081
|
||||
bit $C081
|
||||
@@ -153,7 +122,7 @@ basic: lda HIMEM
|
||||
|
||||
; Call into Applesoft Block Transfer Up -- which handles zero-
|
||||
; sized blocks well -- to move the content of the LC memory area.
|
||||
jsr $D39A ; BLTU2
|
||||
jsr bltu2
|
||||
|
||||
; Switch in LC bank 2 for R/O and return.
|
||||
bit $C080
|
||||
|
||||
@@ -23,5 +23,5 @@ _getcurrentdevice:
|
||||
bne :+
|
||||
lda #$FF ; INVALID_DEVICE
|
||||
|
||||
: ldx #$00
|
||||
: ldx #>$0000
|
||||
rts
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user