Merge branch 'master' into missing-purple
This commit is contained in:
16
.github/checks/Makefile
vendored
Normal file
16
.github/checks/Makefile
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
.PHONY: checkstyle tabs lastline spaces noexec
|
||||
|
||||
checkstyle: tabs lastline spaces noexec
|
||||
|
||||
tabs: tabs.sh
|
||||
@./tabs.sh
|
||||
|
||||
lastline: lastline.sh
|
||||
@./lastline.sh
|
||||
|
||||
spaces: spaces.sh
|
||||
@./spaces.sh
|
||||
|
||||
noexec: noexec.sh
|
||||
@./noexec.sh
|
||||
25
.github/checks/lastline.sh
vendored
Executable file
25
.github/checks/lastline.sh
vendored
Executable file
@@ -0,0 +1,25 @@
|
||||
#! /bin/bash
|
||||
OLDCWD=`pwd`
|
||||
SCRIPT_PATH=`dirname $0`
|
||||
CHECK_PATH=.
|
||||
|
||||
cd $SCRIPT_PATH/../../
|
||||
|
||||
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
|
||||
t=$(tail -c2 $f; printf x)
|
||||
[[ ${t%x} =~ $r1 ]] || echo "$f"
|
||||
done`
|
||||
|
||||
cd $OLDCWD
|
||||
|
||||
if [ x"$FILES"x != xx ]; then
|
||||
echo "error: found following files that have no newline at the end:" >&2
|
||||
for n in $FILES; do
|
||||
echo $n >&2
|
||||
done
|
||||
exit -1
|
||||
fi
|
||||
18
.github/checks/noexec.sh
vendored
Executable file
18
.github/checks/noexec.sh
vendored
Executable file
@@ -0,0 +1,18 @@
|
||||
#! /bin/bash
|
||||
OLDCWD=`pwd`
|
||||
SCRIPT_PATH=`dirname $0`
|
||||
CHECK_PATH=.
|
||||
|
||||
cd $SCRIPT_PATH/../../
|
||||
|
||||
FILES=`find $CHECK_PATH -executable -type f \( -name \*.inc -o -name Makefile -o -name \*.cfg -o -name \*.\[chs\] -o -name \*.mac -o -name \*.asm -o -name \*.sgml \) -print`
|
||||
|
||||
cd $OLDCWD
|
||||
|
||||
if [ x"$FILES"x != xx ]; then
|
||||
echo "error: executable flag is set for the following files:" >&2
|
||||
for n in $FILES; do
|
||||
echo $n >&2
|
||||
done
|
||||
exit -1
|
||||
fi
|
||||
18
.github/checks/spaces.sh
vendored
Executable file
18
.github/checks/spaces.sh
vendored
Executable file
@@ -0,0 +1,18 @@
|
||||
#! /bin/bash
|
||||
OLDCWD=`pwd`
|
||||
SCRIPT_PATH=`dirname $0`
|
||||
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 ' $'`
|
||||
|
||||
cd $OLDCWD
|
||||
|
||||
if [ x"$FILES"x != xx ]; then
|
||||
echo "error: found dangling spaces in the following files:" >&2
|
||||
for n in $FILES; do
|
||||
echo $n >&2
|
||||
done
|
||||
exit -1
|
||||
fi
|
||||
18
.github/checks/tabs.sh
vendored
Executable file
18
.github/checks/tabs.sh
vendored
Executable file
@@ -0,0 +1,18 @@
|
||||
#! /bin/bash
|
||||
OLDCWD=`pwd`
|
||||
SCRIPT_PATH=`dirname $0`
|
||||
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'`
|
||||
|
||||
cd $OLDCWD
|
||||
|
||||
if [ x"$FILES"x != xx ]; then
|
||||
echo "error: found TABs in the following files:" >&2
|
||||
for n in $FILES; do
|
||||
echo $n >&2
|
||||
done
|
||||
exit -1
|
||||
fi
|
||||
143
.github/workflows/build-on-pull-request.yml
vendored
143
.github/workflows/build-on-pull-request.yml
vendored
@@ -21,9 +21,15 @@ jobs:
|
||||
- name: Checkout Source
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Do some simple style checks
|
||||
shell: bash
|
||||
run: make -j2 checkstyle
|
||||
- name: Build the tools.
|
||||
shell: bash
|
||||
run: make -j2 bin USER_CFLAGS=-Werror
|
||||
- name: Build the utilities.
|
||||
shell: bash
|
||||
run: make -j2 util
|
||||
- name: Build the platform libraries.
|
||||
shell: bash
|
||||
run: make -j2 lib QUIET=1
|
||||
@@ -31,137 +37,9 @@ jobs:
|
||||
shell: bash
|
||||
run: make test QUIET=1
|
||||
- name: Test that the samples can be built.
|
||||
shell: bash
|
||||
run: |
|
||||
make SYS=apple2 -C samples
|
||||
make SYS=apple2 -C samples clean
|
||||
make SYS=apple2enh -C samples
|
||||
make SYS=apple2enh -C samples clean
|
||||
make SYS=atari -C samples
|
||||
make SYS=atari -C samples clean
|
||||
make SYS=atarixl -C samples
|
||||
make SYS=atarixl -C samples clean
|
||||
make SYS=atari2600 -C samples
|
||||
make SYS=atari2600 -C samples clean
|
||||
make SYS=atari5200 -C samples
|
||||
make SYS=atari5200 -C samples clean
|
||||
make SYS=atmos -C samples
|
||||
make SYS=atmos -C samples clean
|
||||
make SYS=bbc -C samples
|
||||
make SYS=bbc -C samples clean
|
||||
make SYS=c128 -C samples
|
||||
make SYS=c128 -C samples clean
|
||||
make SYS=c16 -C samples
|
||||
make SYS=c16 -C samples clean
|
||||
make SYS=c64 -C samples
|
||||
make SYS=c64 -C samples clean
|
||||
make SYS=cbm510 -C samples
|
||||
make SYS=cbm510 -C samples clean
|
||||
make SYS=cbm610 -C samples
|
||||
make SYS=cbm610 -C samples clean
|
||||
make SYS=creativision -C samples
|
||||
make SYS=creativision -C samples clean
|
||||
make SYS=cx16 -C samples
|
||||
make SYS=cx16 -C samples clean
|
||||
make SYS=gamate -C samples
|
||||
make SYS=gamate -C samples clean
|
||||
make SYS=geos-apple -C samples
|
||||
make SYS=geos-apple -C samples clean
|
||||
make SYS=geos-cbm -C samples
|
||||
make SYS=geos-cbm -C samples clean
|
||||
make SYS=lunix -C samples
|
||||
make SYS=lunix -C samples clean
|
||||
make SYS=lynx -C samples
|
||||
make SYS=lynx -C samples clean
|
||||
make SYS=nes -C samples
|
||||
make SYS=nes -C samples clean
|
||||
make SYS=osic1p -C samples
|
||||
make SYS=osic1p -C samples clean
|
||||
make SYS=pce -C samples
|
||||
make SYS=pce -C samples clean
|
||||
make SYS=pet -C samples
|
||||
make SYS=pet -C samples clean
|
||||
make SYS=plus4 -C samples
|
||||
make SYS=plus4 -C samples clean
|
||||
make SYS=sim6502 -C samples
|
||||
make SYS=sim6502 -C samples clean
|
||||
make SYS=sim65c02 -C samples
|
||||
make SYS=sim65c02 -C samples clean
|
||||
make SYS=supervision -C samples
|
||||
make SYS=supervision -C samples clean
|
||||
make SYS=sym1 -C samples
|
||||
make SYS=sym1 -C samples clean
|
||||
make SYS=telestrat -C samples
|
||||
make SYS=telestrat -C samples clean
|
||||
make SYS=vic20 -C samples
|
||||
make SYS=vic20 -C samples clean
|
||||
run: make -C samples platforms
|
||||
- name: Test that the targettest programs can be built.
|
||||
shell: bash
|
||||
run: |
|
||||
make SYS=c64 -C targettest all
|
||||
make SYS=c64 -C targettest clean
|
||||
make SYS=apple2 -C targettest
|
||||
make SYS=apple2 -C targettest clean
|
||||
make SYS=apple2enh -C targettest
|
||||
make SYS=apple2enh -C targettest clean
|
||||
make SYS=atari -C targettest
|
||||
make SYS=atari -C targettest clean
|
||||
make SYS=atarixl -C targettest
|
||||
make SYS=atarixl -C targettest clean
|
||||
# make SYS=atari2600 -C targettest
|
||||
# make SYS=atari2600 -C targettest clean
|
||||
# make SYS=atari5200 -C targettest
|
||||
# make SYS=atari5200 -C targettest clean
|
||||
# make SYS=atmos -C targettest
|
||||
# make SYS=atmos -C targettest clean
|
||||
# make SYS=bbc -C targettest
|
||||
# make SYS=bbc -C targettest clean
|
||||
# make SYS=c128 -C targettest
|
||||
# make SYS=c128 -C targettest clean
|
||||
# make SYS=c16 -C targettest
|
||||
# make SYS=c16 -C targettest clean
|
||||
make SYS=c64 -C targettest
|
||||
make SYS=c64 -C targettest clean
|
||||
# make SYS=cbm510 -C targettest
|
||||
# make SYS=cbm510 -C targettest clean
|
||||
# make SYS=cbm610 -C targettest
|
||||
# make SYS=cbm610 -C targettest clean
|
||||
# make SYS=creativision -C targettest
|
||||
# make SYS=creativision -C targettest clean
|
||||
# make SYS=cx16 -C targettest
|
||||
# make SYS=cx16 -C targettest clean
|
||||
# make SYS=gamate -C targettest
|
||||
# make SYS=gamate -C targettest clean
|
||||
# make SYS=geos-apple -C targettest
|
||||
# make SYS=geos-apple -C targettest clean
|
||||
# make SYS=geos-cbm -C targettest
|
||||
# make SYS=geos-cbm -C targettest clean
|
||||
# make SYS=lunix -C targettest
|
||||
# make SYS=lunix -C targettest clean
|
||||
# make SYS=lynx -C targettest
|
||||
# make SYS=lynx -C targettest clean
|
||||
# make SYS=nes -C targettest
|
||||
# make SYS=nes -C targettest clean
|
||||
# make SYS=osic1p -C targettest
|
||||
# make SYS=osic1p -C targettest clean
|
||||
# make SYS=pce -C targettest
|
||||
# make SYS=pce -C targettest clean
|
||||
# make SYS=pet -C targettest
|
||||
# make SYS=pet -C targettest clean
|
||||
# make SYS=plus4 -C targettest
|
||||
# make SYS=plus4 -C targettest clean
|
||||
# make SYS=sim6502 -C targettest
|
||||
# make SYS=sim6502 -C targettest clean
|
||||
# make SYS=sim65c02 -C targettest
|
||||
# make SYS=sim65c02 -C targettest clean
|
||||
# make SYS=supervision -C targettest
|
||||
# make SYS=supervision -C targettest clean
|
||||
# make SYS=sym1 -C targettest
|
||||
# make SYS=sym1 -C targettest clean
|
||||
# make SYS=telestrat -C targettest
|
||||
# make SYS=telestrat -C targettest clean
|
||||
make SYS=vic20 -C targettest
|
||||
make SYS=vic20 -C targettest clean
|
||||
run: make -C targettest platforms
|
||||
- name: Build the document files.
|
||||
shell: bash
|
||||
run: make -j2 doc
|
||||
@@ -189,8 +67,3 @@ jobs:
|
||||
|
||||
- name: Build app (release)
|
||||
run: msbuild src\cc65.sln -t:rebuild -property:Configuration=Release
|
||||
|
||||
# TODO: fix targettest Makefile for all currently commented out targets
|
||||
# TODO: build targettest cbm subdir for all cbm targets
|
||||
# TODO: build targettest atari subdir for all atari targets
|
||||
# TODO: build targettest apple2 subdir for all apple2 targets
|
||||
|
||||
34
.github/workflows/snapshot-on-push-master.yml
vendored
34
.github/workflows/snapshot-on-push-master.yml
vendored
@@ -10,6 +10,7 @@ concurrency:
|
||||
jobs:
|
||||
build_windows:
|
||||
name: Build (Windows)
|
||||
if: github.repository == 'cc65/cc65'
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
@@ -29,9 +30,9 @@ jobs:
|
||||
run: msbuild src\cc65.sln -t:rebuild -property:Configuration=Release
|
||||
|
||||
build_linux:
|
||||
name: Build, Test and Snaphot (Linux)
|
||||
name: Build, Test, and Snapshot (Linux)
|
||||
if: github.repository == 'cc65/cc65'
|
||||
runs-on: ubuntu-latest
|
||||
needs: build_windows
|
||||
|
||||
steps:
|
||||
- name: Install Dependencies
|
||||
@@ -45,9 +46,14 @@ jobs:
|
||||
- name: Checkout Source
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Do some simple style checks
|
||||
shell: bash
|
||||
run: make -j2 checkstyle
|
||||
- name: Build the tools.
|
||||
shell: bash
|
||||
run: make -j2 bin USER_CFLAGS=-Werror
|
||||
run: |
|
||||
make -j2 bin USER_CFLAGS=-Werror
|
||||
make -j2 util
|
||||
- name: Build the platform libraries.
|
||||
shell: bash
|
||||
run: make -j2 lib QUIET=1
|
||||
@@ -60,6 +66,9 @@ jobs:
|
||||
- name: Remove the output from the samples tests.
|
||||
shell: bash
|
||||
run: make -C samples clean
|
||||
- name: Remove programs in util directory
|
||||
shell: bash
|
||||
run: make -C util clean
|
||||
- name: Build the document files.
|
||||
shell: bash
|
||||
run: make -j2 doc
|
||||
@@ -68,24 +77,35 @@ jobs:
|
||||
make -C src clean
|
||||
make -j2 bin USER_CFLAGS=-Werror CROSS_COMPILE=x86_64-w64-mingw32-
|
||||
make zip
|
||||
mv cc65.zip cc65-win64.zip
|
||||
mv cc65.zip cc65-snapshot-win64.zip
|
||||
- name: Build and package 32-bit Windows versions of the tools.
|
||||
run: |
|
||||
make -C src clean
|
||||
make -j2 bin USER_CFLAGS=-Werror CROSS_COMPILE=i686-w64-mingw32-
|
||||
make zip
|
||||
mv cc65.zip cc65-win32.zip
|
||||
mv cc65.zip cc65-snapshot-win32.zip
|
||||
|
||||
- name: Upload a 32-bit Snapshot Zip
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: cc65-snapshot-win32.zip
|
||||
path: cc65-win32.zip
|
||||
path: cc65-snapshot-win32.zip
|
||||
- name: Upload a 64-bit Snapshot Zip
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: cc65-snapshot-win64.zip
|
||||
path: cc65-win64.zip
|
||||
path: cc65-snapshot-win64.zip
|
||||
|
||||
# enter secrets under "repository secrets"
|
||||
- name: Upload snapshot to sourceforge
|
||||
uses: nogsantos/scp-deploy@master
|
||||
with:
|
||||
src: cc65-snapshot-win32.zip
|
||||
host: ${{ secrets.SSH_HOST }}
|
||||
remote: ${{ secrets.SSH_DIR }}
|
||||
port: ${{ secrets.SSH_PORT }}
|
||||
user: ${{ secrets.SSH_USER }}
|
||||
key: ${{ secrets.SSH_KEY }}
|
||||
|
||||
# TODO: Update docs at https://github.com/cc65/doc
|
||||
# TODO: Publish snapshot zip at https://github.com/cc65/cc65.github.io
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -7,3 +7,6 @@
|
||||
/testwrk/
|
||||
/wrk/
|
||||
/cc65.zip
|
||||
/util/atari/*.exe
|
||||
/util/gamate/*.exe
|
||||
|
||||
|
||||
165
Contributing.md
Normal file
165
Contributing.md
Normal file
@@ -0,0 +1,165 @@
|
||||
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.
|
||||
|
||||
(''Note:'' The word "must" indicates a requirement. The word "should" indicates a recomendation.)
|
||||
|
||||
*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.
|
||||
|
||||
# Codestyle rules
|
||||
|
||||
## All Sources
|
||||
|
||||
### TABs and spaces
|
||||
|
||||
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.
|
||||
* No extra spaces at the end of lines.
|
||||
* 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```.
|
||||
|
||||
### misc
|
||||
|
||||
* 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 0
|
||||
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>
|
||||
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)
|
||||
color := $0787
|
||||
</pre>
|
||||
|
||||
## C Sources
|
||||
|
||||
The following is still very incomplete - if in doubt please look at existing sourcefiles and adapt to the existing style
|
||||
|
||||
* Your files should obey the C89 standard.
|
||||
* We generally have a "no warnings" policy
|
||||
* Warnings must not be hidden by using typecasts - fix the code instead
|
||||
* In printf-style functions use the PRIX64 (and similar) macros to deal with 64bit values
|
||||
* 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>
|
||||
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>
|
||||
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>
|
||||
|
||||
### 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).
|
||||
|
||||
## Assembly Sources
|
||||
|
||||
* 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.
|
||||
* 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.)
|
||||
* 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
|
||||
|
||||
* TAB characters must be expanded to spaces.
|
||||
* 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.
|
||||
|
||||
# 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.
|
||||
|
||||
# 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.
|
||||
|
||||
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
|
||||
|
||||
## User manual (LinuxDoc)
|
||||
|
||||
* This is the primary documentation.
|
||||
|
||||
## 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
|
||||
|
||||
# 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
|
||||
|
||||
## 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
|
||||
33
Makefile
33
Makefile
@@ -1,13 +1,23 @@
|
||||
.PHONY: all mostlyclean clean install zip avail unavail bin lib doc html info samples test
|
||||
.PHONY: all mostlyclean clean install zip avail unavail bin lib doc html info samples test util checkstyle check
|
||||
|
||||
.SUFFIXES:
|
||||
|
||||
all mostlyclean clean install zip:
|
||||
all install zip:
|
||||
@$(MAKE) -C src --no-print-directory $@
|
||||
@$(MAKE) -C libsrc --no-print-directory $@
|
||||
@$(MAKE) -C doc --no-print-directory $@
|
||||
@$(MAKE) -C util --no-print-directory $@
|
||||
@$(MAKE) -C samples --no-print-directory $@
|
||||
|
||||
mostlyclean clean:
|
||||
@$(MAKE) -C src --no-print-directory $@
|
||||
@$(MAKE) -C libsrc --no-print-directory $@
|
||||
@$(MAKE) -C doc --no-print-directory $@
|
||||
@$(MAKE) -C util --no-print-directory $@
|
||||
@$(MAKE) -C samples --no-print-directory $@
|
||||
@$(MAKE) -C test --no-print-directory $@
|
||||
@$(MAKE) -C targettest --no-print-directory $@
|
||||
|
||||
avail unavail bin:
|
||||
@$(MAKE) -C src --no-print-directory $@
|
||||
|
||||
@@ -20,11 +30,26 @@ doc html info:
|
||||
samples:
|
||||
@$(MAKE) -C samples --no-print-directory $@
|
||||
|
||||
test:
|
||||
@$(MAKE) -C test --no-print-directory $@
|
||||
util:
|
||||
@$(MAKE) -C util --no-print-directory $@
|
||||
|
||||
%65:
|
||||
@$(MAKE) -C src --no-print-directory $@
|
||||
|
||||
%:
|
||||
@$(MAKE) -C libsrc --no-print-directory $@
|
||||
|
||||
# check the code style
|
||||
checkstyle:
|
||||
@$(MAKE) -C .github/checks --no-print-directory $@
|
||||
|
||||
# simple "test" target, only run regression tests for c64 target
|
||||
test:
|
||||
@$(MAKE) -C test --no-print-directory $@
|
||||
|
||||
# GNU "check" target, which runs all tests
|
||||
check:
|
||||
@$(MAKE) -C .github/checks checkstyle --no-print-directory
|
||||
@$(MAKE) test
|
||||
@$(MAKE) -C targettest platforms --no-print-directory
|
||||
@$(MAKE) -C samples platforms --no-print-directory
|
||||
|
||||
81
README.md
81
README.md
@@ -1,42 +1,51 @@
|
||||
[Windows Snapshot](https://sourceforge.net/projects/cc65/files/cc65-snapshot-win32.zip)
|
||||
|
||||
[Documentation](https://cc65.github.io/doc)
|
||||
|
||||
[Wiki](https://github.com/cc65/wiki/wiki)
|
||||
|
||||
[](https://github.com/cc65/cc65/actions/workflows/snapshot-on-push-master.yml)
|
||||
# About cc65
|
||||
|
||||
cc65 is a complete cross development package for 65(C)02 systems, including
|
||||
a powerful macro assembler, a C compiler, linker, librarian and several
|
||||
other tools.
|
||||
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 has C and runtime library support for many of the old 6502 machines,
|
||||
including
|
||||
## People
|
||||
|
||||
- the following Commodore machines:
|
||||
- VIC20
|
||||
- C16/C116 and Plus/4
|
||||
- C64
|
||||
- C128
|
||||
- CBM 510 (aka P500)
|
||||
- the 600/700 family
|
||||
- newer PET machines (not 2001).
|
||||
- the Apple ]\[+ and successors.
|
||||
- the Atari 8-bit machines.
|
||||
- the Atari 2600 console.
|
||||
- the Atari 5200 console.
|
||||
- GEOS for the C64, C128 and Apple //e.
|
||||
- the Bit Corporation Gamate console.
|
||||
- the NEC PC-Engine (aka TurboGrafx-16) console.
|
||||
- the Nintendo Entertainment System (NES) console.
|
||||
- the Watara Supervision console.
|
||||
- the VTech Creativision console.
|
||||
- the Oric Atmos.
|
||||
- the Oric Telestrat.
|
||||
- the Lynx console.
|
||||
- the Ohio Scientific Challenger 1P.
|
||||
- the Commander X16.
|
||||
- the Synertek Systems Sym-1.
|
||||
Core team members:
|
||||
|
||||
The libraries are fairly portable, so creating a version for other 6502s
|
||||
shouldn't be too much work.
|
||||
* [Christian Groessler](https://github.com/groessler): Atari, Atari5200, and CreatiVision library Maintainer
|
||||
* [dqh](https://github.com/dqh-au): GHA help
|
||||
* [Greg King](https://github.com/greg-king5): all around hackery
|
||||
* [groepaz](https://github.com/mrdudz): CBM libary, Project Maintainer
|
||||
* [Oliver Schmidt](https://github.com/oliverschmidt): Apple II library Maintainer
|
||||
|
||||
External contributors:
|
||||
|
||||
* [acqn](https://github.com/acqn): various compiler fixes
|
||||
* [jedeoric](https://github.com/jedeoric): Telestrat target
|
||||
* [jmr](https://github.com/jmr): compiler fixes
|
||||
* [karrika](https://github.com/karrika): Atari 7800 target
|
||||
* [Stephan Mühlstrasser](https://github.com/smuehlst): osic1p target
|
||||
* [Wayne Parham](https://github.com/WayneParham): Sym-1 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)
|
||||
|
||||
# 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).
|
||||
|
||||
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.
|
||||
|
||||
# Downloads
|
||||
|
||||
* [Windows Snapshot](https://sourceforge.net/projects/cc65/files/cc65-snapshot-win32.zip)
|
||||
|
||||
* [Linux Snapshot DEB and RPM](https://software.opensuse.org//download.html?project=home%3Astrik&package=cc65)
|
||||
|
||||
[](https://github.com/cc65/cc65/actions/workflows/snapshot-on-push-master.yml)
|
||||
|
||||
14
asminc/atari7800.inc
Normal file
14
asminc/atari7800.inc
Normal file
@@ -0,0 +1,14 @@
|
||||
; Atari 7800 TIA & RIOT read / write registers
|
||||
;
|
||||
; Karri Kaksonen (karri@sipo.fi), 2022
|
||||
|
||||
; TIA, RIOT & MARIA registers mapping
|
||||
.include "atari7800_tia.inc"
|
||||
.include "atari7800_riot.inc"
|
||||
.include "atari7800_maria.inc"
|
||||
|
||||
; constants for the conio implementation
|
||||
mono_charsperline = 40
|
||||
charsperline = 20
|
||||
screenrows = 28
|
||||
|
||||
39
asminc/atari7800_maria.inc
Normal file
39
asminc/atari7800_maria.inc
Normal file
@@ -0,0 +1,39 @@
|
||||
; Atari 7800 MARIA read / write registers
|
||||
;
|
||||
|
||||
; Read registers
|
||||
BKGRND := $20
|
||||
P0C1 := $21
|
||||
P0C2 := $22
|
||||
P0C3 := $23
|
||||
MWSYNC := $24
|
||||
P1C1 := $25
|
||||
P1C2 := $26
|
||||
P1C3 := $27
|
||||
MSTAT := $28
|
||||
P2C1 := $29
|
||||
P2C2 := $2A
|
||||
P2C3 := $2B
|
||||
DPPH := $2C
|
||||
P3C1 := $2D
|
||||
P3C2 := $2E
|
||||
P3C3 := $2F
|
||||
DPPL := $30
|
||||
P4C1 := $31
|
||||
P4C2 := $32
|
||||
P4C3 := $33
|
||||
CHBASE := $34
|
||||
P5C1 := $35
|
||||
P5C2 := $36
|
||||
P5C3 := $37
|
||||
OFFSET := $38
|
||||
P6C1 := $39
|
||||
P6C2 := $3A
|
||||
P6C3 := $3B
|
||||
CTRL := $3C
|
||||
P7C1 := $3D
|
||||
P7C2 := $3E
|
||||
P7C3 := $3F
|
||||
|
||||
; Write registers
|
||||
|
||||
20
asminc/atari7800_riot.inc
Normal file
20
asminc/atari7800_riot.inc
Normal file
@@ -0,0 +1,20 @@
|
||||
; Atari 7800 RIOT read / write registers
|
||||
;
|
||||
; Source: DASM - vcs.h
|
||||
; Details available in: Stella Programmer's Guide by Steve Wright
|
||||
;
|
||||
; Florent Flament (contact@florentflament.com), 2017
|
||||
|
||||
; Read registers
|
||||
SWCHA := $0280
|
||||
CTLSWA := $0281
|
||||
SWCHB := $0282
|
||||
CTLSWB := $0283
|
||||
INTIM := $0284
|
||||
TIMINT := $0285
|
||||
|
||||
; Write registers
|
||||
TIM1T := $0294
|
||||
TIM8T := $0295
|
||||
TIM64T := $0296
|
||||
T1024T := $0297
|
||||
69
asminc/atari7800_tia.inc
Normal file
69
asminc/atari7800_tia.inc
Normal file
@@ -0,0 +1,69 @@
|
||||
; Atari 7800 TIA read / write registers
|
||||
;
|
||||
; Source: DASM - vcs.h
|
||||
; Details available in: Stella Programmer's Guide by Steve Wright
|
||||
;
|
||||
; Florent Flament (contact@florentflament.com), 2017
|
||||
|
||||
; Read registers
|
||||
VSYNC := $00
|
||||
VBLANK := $01
|
||||
WSYNC := $02
|
||||
RSYNC := $03
|
||||
NUSIZ0 := $04
|
||||
NUSIZ1 := $05
|
||||
COLUP0 := $06
|
||||
COLUP1 := $07
|
||||
COLUPF := $08
|
||||
COLUBK := $09
|
||||
CTRLPF := $0A
|
||||
REFP0 := $0B
|
||||
REFP1 := $0C
|
||||
PF0 := $0D
|
||||
PF1 := $0E
|
||||
PF2 := $0F
|
||||
RESP0 := $10
|
||||
RESP1 := $11
|
||||
RESM0 := $12
|
||||
RESM1 := $13
|
||||
RESBL := $14
|
||||
AUDC0 := $15
|
||||
AUDC1 := $16
|
||||
AUDF0 := $17
|
||||
AUDF1 := $18
|
||||
AUDV0 := $19
|
||||
AUDV1 := $1A
|
||||
GRP0 := $1B
|
||||
GRP1 := $1C
|
||||
ENAM0 := $1D
|
||||
ENAM1 := $1E
|
||||
ENABL := $1F
|
||||
HMP0 := $20
|
||||
HMP1 := $21
|
||||
HMM0 := $22
|
||||
HMM1 := $23
|
||||
HMBL := $24
|
||||
VDELP0 := $25
|
||||
VDELP1 := $26
|
||||
VDELBL := $27
|
||||
RESMP0 := $28
|
||||
RESMP1 := $29
|
||||
HMOVE := $2A
|
||||
HMCLR := $2B
|
||||
CXCLR := $2C
|
||||
|
||||
; Write registers
|
||||
CXM0P := $00
|
||||
CXM1P := $01
|
||||
CXP0FB := $02
|
||||
CXP1FB := $03
|
||||
CXM0FB := $04
|
||||
CXM1FB := $05
|
||||
CXBLPF := $06
|
||||
CXPPMM := $07
|
||||
INPT0 := $08
|
||||
INPT1 := $09
|
||||
INPT2 := $0A
|
||||
INPT3 := $0B
|
||||
INPT4 := $0C
|
||||
INPT5 := $0D
|
||||
@@ -7,8 +7,13 @@
|
||||
|
||||
.if .def(__CX16__)
|
||||
; CX16 extended jump table
|
||||
KBDBUF_PEEK := $FEBD
|
||||
KBDBUF_GET_MODIFIERS := $FEC0
|
||||
KBDBUF_PUT := $FEC3
|
||||
I2C_READ_BYTE := $FEC6
|
||||
I2C_WRITE_BYTE := $FEC9
|
||||
CX_MONITOR := $FECC
|
||||
ENTROPY_GET := $FECF
|
||||
KEYBRD_BUF_PUT := $FED2
|
||||
CONSOLE_SET_PAGE_MSG := $FED5
|
||||
CONSOLE_PUT_IMAGE := $FED8
|
||||
CONSOLE_INIT := $FEDB
|
||||
@@ -52,7 +57,7 @@
|
||||
CLOCK_GET_DATE_TIME := $FF50
|
||||
JOYSTICK_SCAN := $FF53
|
||||
JOYSTICK_GET := $FF56
|
||||
SCREEN_SET_MODE := $FF5F
|
||||
SCREEN_MODE := $FF5F
|
||||
SCREEN_SET_CHARSET := $FF62
|
||||
MOUSE_CONFIG := $FF68
|
||||
MOUSE_GET := $FF6B
|
||||
|
||||
104
asminc/cx16.inc
104
asminc/cx16.inc
@@ -1,5 +1,5 @@
|
||||
;
|
||||
; CX16 r38 definitions
|
||||
; CX16 r39 definitions
|
||||
;
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
@@ -104,6 +104,10 @@ PI
|
||||
; ---------------------------------------------------------------------------
|
||||
; Zero page
|
||||
|
||||
; Banking registers
|
||||
RAM_BANK := $00
|
||||
ROM_BANK := $01
|
||||
|
||||
; GEOS and graphics pseudo-registers
|
||||
.struct gREG
|
||||
.org $02
|
||||
@@ -224,7 +228,7 @@ PI
|
||||
; Kernal
|
||||
KTEMP2 := $80 ; 2 bytes for temporary storage
|
||||
IMPARM := $82 ; Pointer for PRIMM function
|
||||
FNAM := $8C ; Pointer to filename
|
||||
FNAM := $8A ; Pointer to filename
|
||||
|
||||
; BASIC
|
||||
TXTPTR := $EE ; Pointer into BASIC source code
|
||||
@@ -234,14 +238,13 @@ TXTPTR := $EE ; Pointer into BASIC source code
|
||||
BASIC_BUF := $0200 ; Location of command-line
|
||||
BASIC_BUF_LEN = 81 ; Maximum length of command-line
|
||||
|
||||
SCREEN_MODE := $0261 ; Current screen mode (set by SCREEN_SET_MODE)
|
||||
SCREEN_PTR := $0262 ; Pointer to current row on text screen (16 bits)
|
||||
STATUS := $0286 ; Status from previous I/O operation
|
||||
IN_DEV := $028A ; Current input device number
|
||||
OUT_DEV := $028B ; Current output device number
|
||||
FNAM_LEN := $028E ; Length of filename
|
||||
SECADR := $0290 ; Secondary address
|
||||
DEVNUM := $0291 ; Device number
|
||||
STATUS := $0289 ; Status from previous I/O operation
|
||||
IN_DEV := $028D ; Current input device number
|
||||
OUT_DEV := $028E ; Current output device number
|
||||
FNAM_LEN := $0291 ; Length of filename
|
||||
SECADR := $0293 ; Secondary address
|
||||
DEVNUM := $0294 ; Device number
|
||||
CURS_COLOR := $0373 ; Color under the cursor
|
||||
CHARCOLOR := $0376 ; Cursor's color nybbles (high: background, low: foreground)
|
||||
RVS := $0377 ; Reverse flag
|
||||
@@ -268,6 +271,42 @@ NMIVec := $0318
|
||||
; ---------------------------------------------------------------------------
|
||||
; I/O locations
|
||||
|
||||
; 65C22 Versatile Interface Adapter
|
||||
.struct VIA1 ; Versatile Interface Adapter
|
||||
.org $9F00
|
||||
PRB .byte ; mouse, LED, VIC bus (Port Register B)
|
||||
PRA .byte ; keyboard, controllers (Port Register A)
|
||||
DDRB .byte ; (Data Direction Register B)
|
||||
DDRA .byte ; (Data Direction Register A)
|
||||
T1 .word ; (Timer 1)
|
||||
T1L .word ; (Timer 1 Latch)
|
||||
T2 .word ; (Timer 2)
|
||||
SR .byte ; (Shift Register)
|
||||
ACR .byte ; (Auxiliary Control Register)
|
||||
PCR .byte ; (Peripheral Control Register)
|
||||
IFR .byte ; (Interrupt Flags Register)
|
||||
IER .byte ; (Interrupt Enable Register)
|
||||
PRA2 .byte ; keyboard, controllers (PRA without handshake)
|
||||
.endstruct
|
||||
|
||||
; 65C22 Versatile Interface Adapter
|
||||
.struct VIA2
|
||||
.org $9F10
|
||||
PRB .byte
|
||||
PRA .byte
|
||||
DDRB .byte
|
||||
DDRA .byte
|
||||
T1 .word
|
||||
T1L .word
|
||||
T2 .word
|
||||
SR .byte
|
||||
ACR .byte
|
||||
PCR .byte
|
||||
IFR .byte
|
||||
IER .byte
|
||||
PRA2 .byte
|
||||
.endstruct
|
||||
|
||||
; Video Enhanced Retro Adapter
|
||||
; Has audio and SPI.
|
||||
.scope VERA
|
||||
@@ -496,44 +535,16 @@ NMIVec := $0318
|
||||
.endstruct
|
||||
.endscope
|
||||
|
||||
; 65C22
|
||||
.struct VIA1 ; Versatile Interface Adapter
|
||||
.org $9F60
|
||||
PRB .byte ; ROM bank, IEC (Port Register B)
|
||||
PRA .byte ; RAM bank (Port Register A)
|
||||
DDRB .byte ; (Data Direction Register B)
|
||||
DDRA .byte ; (Data Direction Register A)
|
||||
T1 .word ; (Timer 1)
|
||||
T1L .word ; (Timer 1 Latch)
|
||||
T2 .word ; (Timer 2)
|
||||
SR .byte ; (Shift Register)
|
||||
ACR .byte ; (Auxiliary Control Register)
|
||||
PCR .byte ; (Peripheral Control Register)
|
||||
IFR .byte ; (Interrupt Flags Register)
|
||||
IER .byte ; (Interrupt Enable Register)
|
||||
PRA2 .byte ; RAM bank (Port Register A without handshaking)
|
||||
; YM2151 audio chip
|
||||
.struct YM2151
|
||||
.org $9F40
|
||||
.union
|
||||
STATUS .byte
|
||||
ADDR .byte
|
||||
.endunion
|
||||
DATA .byte
|
||||
.endstruct
|
||||
|
||||
; 65C22
|
||||
.struct VIA2
|
||||
.org $9F70
|
||||
PRB .byte ; Mouse communication ?
|
||||
PRA .byte ; NES controller communication
|
||||
DDRB .byte
|
||||
DDRA .byte
|
||||
T1 .word
|
||||
T1L .word
|
||||
T2 .word
|
||||
SR .byte
|
||||
ACR .byte
|
||||
PCR .byte
|
||||
IFR .byte
|
||||
IER .byte
|
||||
PRA2 .byte
|
||||
.endstruct
|
||||
|
||||
; Real-Time Clock
|
||||
|
||||
; X16 Emulator device
|
||||
; This device doesn't exist on the real machine.
|
||||
.struct EMULATOR
|
||||
@@ -554,8 +565,7 @@ NMIVec := $0318
|
||||
; ---------------------------------------------------------------------------
|
||||
; Banked RAM and ROM
|
||||
|
||||
KEY_COUNT := $A00A ; (bank 0) Number of keys in input buffer
|
||||
TIMER := $A037 ; (bank 0) 60 Hz. timer (3 bytes, big-endian)
|
||||
TIMER := $A03B ; (bank 0) 60 Hz. timer (3 bytes, big-endian)
|
||||
|
||||
.struct BANK
|
||||
.org $A000
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
;
|
||||
; Oric TELEMON definition
|
||||
; TELEMON 2.4 & TELEMON 3.x
|
||||
; For TELEMON 3.x check http://orix.oric.org
|
||||
; TELEMON 2.4 & Orix
|
||||
; For Orix check http://orix.oric.org
|
||||
;
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
@@ -59,7 +59,7 @@ SCRNB := $28 ; Id of the current window
|
||||
ADKBD := $2A ; Address ASCII conversion table
|
||||
|
||||
|
||||
PTR_READ_DEST := $2C ; Used for XFREAD and XWRITE only in TELEMON 3.x
|
||||
PTR_READ_DEST := $2C ; Used for XFREAD and XWRITE only in Orix
|
||||
|
||||
ADCLK := $40 ; Address for clock display
|
||||
TIMEUS := $42
|
||||
@@ -249,10 +249,10 @@ XHIRES = $1A
|
||||
XEFFHI = $1B ; Clear hires screen
|
||||
XFILLM = $1C
|
||||
XMINMA = $1F
|
||||
XVARS = $24 ; Only in TELEMON 3.x, in TELEMON 2.4, it's XNOMFI ($24)
|
||||
XVARS = $24 ; Only in Orix, in TELEMON 2.4, it's XNOMFI ($24)
|
||||
XCRLF = $25 ; Jump a line and return to the beginning of the line
|
||||
XDECAY = $26
|
||||
XFREAD = $27 ; Only in TELEMON 3.x (bank 7 of Orix)
|
||||
XFREAD = $27 ; Only in Orix
|
||||
XBINDX = $28 ; Convert a number into hex and displays on channel 0
|
||||
XDECIM = $29
|
||||
XHEXA = $2A ; Convert a number into hex
|
||||
@@ -261,7 +261,7 @@ XEDT = $2D ; Launch editor
|
||||
XINSER = $2E
|
||||
|
||||
XSCELG = $2F ; Search a line in editor mode
|
||||
XOPEN = $30 ; Only in TELEMON 3.x (bank 7 of Orix)
|
||||
XOPEN = $30 ; Only in Orix
|
||||
XECRPR = $33 ; Displays prompt
|
||||
XCOSCR = $34 ; Switch off cursor
|
||||
XCSSCR = $35 ; Switch on cursor
|
||||
@@ -269,13 +269,13 @@ XSCRSE = $36
|
||||
XSCROH = $37 ; Scroll up text screen
|
||||
XSCROB = $38 ; Scroll down text screen
|
||||
XSCRNE = $39 ; Load charset from rom to ram
|
||||
XCLOSE = $3A ; Only in TELEMON 3.x close file (bank 7 of Orix)
|
||||
XFWRITE = $3B ; Only in TELEMON 3.x write file (bank 7 of Orix)
|
||||
XCLOSE = $3A ; Only in Orix close file
|
||||
XFWRITE = $3B ; Only in Orix write file
|
||||
|
||||
; Clock primitive
|
||||
XRECLK = $3C ; Reset clock
|
||||
XCLCL = $3D ; Close clock
|
||||
XWRCLK = $3E ; Displays clock in the adress in A & Y registers
|
||||
XWRCLK = $3E ; Displays clock in the address in A & Y registers
|
||||
|
||||
; Sound primitives
|
||||
XSONPS = $40 ; Send data to PSG register (14 values)
|
||||
@@ -291,14 +291,14 @@ XGETCWD = $48 ; Get current CWD
|
||||
XPUTCWD = $49 ; Chdir
|
||||
|
||||
; File management
|
||||
XMKDIR = $4B ; Create a folder. Only available in TELEMON 3.x (bank 7 of Orix)
|
||||
XMKDIR = $4B ; Create a folder. Only available in Orix
|
||||
|
||||
XHCHRS = $4C ; Hard copy hires
|
||||
|
||||
; File management
|
||||
XRM = $4D ; Remove a folder or a file. Only available in TELEMON 3.x (bank 7 of Orix)
|
||||
XRM = $4D ; Remove a folder or a file. Only available in Orix
|
||||
|
||||
XFWR = $4E ; Put a char on the first screen. Only available in TELEMON 3.x (bank 7 of Orix)
|
||||
XFWR = $4E ; Put a char on the first screen. Only available in Orix
|
||||
|
||||
; Keyboard primitives
|
||||
XALLKB = $50 ; Read Keyboard, and populate KBDCOL
|
||||
@@ -314,7 +314,7 @@ XINIBU = $58 ; Initialize the buffer X
|
||||
XDEFBU = $59 ; Reset all value of the buffer
|
||||
XBUSY = $5A ; Test if the buffer is empty
|
||||
|
||||
XMALLOC = $5B ; Only in TELEMON 3.x (bank 7 of Orix)
|
||||
XMALLOC = $5B ; Only in Orix
|
||||
|
||||
; RS232 primitives
|
||||
XSDUMP = $5C ; RS232 input dump
|
||||
@@ -326,7 +326,9 @@ XSSAVE = $5F ; Write a file to RS232
|
||||
XMLOAD = $60 ; Read a file from Minitel
|
||||
XMSAVE = $61 ; Write a file to Minitel
|
||||
|
||||
XFREE = $62 ; Only in TELEMON 3.x (bank 7 of Orix)
|
||||
XFREE = $62 ; Only in Orix
|
||||
|
||||
XEXEC = $63 ; Only in Orix
|
||||
|
||||
; Next Minitel primitives
|
||||
XWCXFI = $63 ; Wait connection
|
||||
@@ -334,7 +336,7 @@ XLIGNE = $64 ;
|
||||
XDECON = $65 ; Minitel disconnection
|
||||
XMOUT = $66 ; Send a byte to minitel (from A)
|
||||
|
||||
XSOUT = $67 ; Send accumulator value (A) to RS232, available in TELEMON 2.4 & 3.x : if RS232 buffer is full, the Oric Telestrat freezes
|
||||
XSOUT = $67 ; Send accumulator value (A) to RS232, available in TELEMON 2.4 : if RS232 buffer is full, the Oric Telestrat freezes
|
||||
|
||||
XHRSSE = $8C ; Set hires position cursor
|
||||
XDRAWA = $8D ; Draw a line absolute
|
||||
|
||||
68
cfg/atari7800.cfg
Normal file
68
cfg/atari7800.cfg
Normal file
@@ -0,0 +1,68 @@
|
||||
# Atari VCS 7800 linker configuration file for cc65
|
||||
# In order to add the a78 header to the build you can add
|
||||
# "--force-import __EXEHDR__" to the command line
|
||||
|
||||
SYMBOLS {
|
||||
__STACKSIZE__: type = weak, value = $0600; # C stack
|
||||
__CARTSIZE__: type = weak, value = $8000;
|
||||
__VEC_BOTTOM__: value = $fffa, type = export;
|
||||
__VEC_SIZE__: value = $6, type = export;
|
||||
__ENCRYPT_BOTTOM__: value = $ff7a, type = export;
|
||||
__ENCRYPT_SIZE__: value = $80, type = export;
|
||||
__MEMORY_TOP__: value = __ENCRYPT_BOTTOM__, type = export;
|
||||
__INIT_SIZE__: value = 156, type = export;
|
||||
__MEMORY_INIT__: value = __MEMORY_TOP__ - __INIT_SIZE__, type = export;
|
||||
__MEMORY_BOTTOM__: value = $10000 - __CARTSIZE__, type = weak;
|
||||
__FREE_ROM_SIZE__: value = __MEMORY_INIT__ - __MEMORY_BOTTOM__, type = export;
|
||||
}
|
||||
|
||||
MEMORY {
|
||||
ZP: file = "", define = yes, start = $0040, size = $00C0, type = rw;
|
||||
SP: file = "", define = yes, start = $0140, size = $00C0, type = rw;
|
||||
RAM1: file = "", define = yes, start = $1800, size = $0840, type = rw;
|
||||
RAM2: file = "", define = yes, start = $2100, size = $0040, type = rw;
|
||||
RAM3: file = "", define = yes, start = $2200, size = $0600, type = rw;
|
||||
# For emulators you also need a header file
|
||||
HEADER: file = %O, start = $0000, size = 128;
|
||||
# "Normal" cartridge rom. Multiple banks arent supported
|
||||
# by this script. You may change the rom size, but keep
|
||||
# two things in mind:
|
||||
# - start must be a multiple of $1000
|
||||
# - ROM must end at $ff79
|
||||
ROM: file = %O, define = yes, start = __MEMORY_BOTTOM__, size = __FREE_ROM_SIZE__, type = ro, fill = yes, fillval = $ff;
|
||||
ROMS: file = %O, define = yes, start = __MEMORY_INIT__, size = __INIT_SIZE__, type = ro, fill = yes, fillval = $ff;
|
||||
# Encryption stuff
|
||||
ROME: file = %O, start = __ENCRYPT_BOTTOM__, size = __ENCRYPT_SIZE__, type = ro, fill = yes, fillval = $ff;
|
||||
# Interrupt vectors
|
||||
ROMV: file = %O, start = __VEC_BOTTOM__, size = __VEC_SIZE__, type = ro, fill = yes, fillval = $ff;
|
||||
}
|
||||
|
||||
SEGMENTS {
|
||||
ZEROPAGE: load = ZP, type = zp;
|
||||
EXTZP: load = ZP, type = zp;
|
||||
EXEHDR: load = HEADER, type = ro, optional = yes;
|
||||
STARTUP: load = ROMS, type = ro, define = yes;
|
||||
ONCE: load = ROMS, type = ro, define = yes;
|
||||
CODE: load = ROM, type = ro, define = yes;
|
||||
RODATA: load = ROM, type = ro, define = yes, align = 256;
|
||||
DATA: load = ROM, run = RAM1, type = rw, define = yes;
|
||||
BSS: load = RAM1, type = bss, define = yes;
|
||||
VECTORS: load = ROMV, type = ro, define = yes;
|
||||
ENCRYPTION: load = ROME, type = ro define = yes;
|
||||
}
|
||||
|
||||
FEATURES {
|
||||
CONDES: type = constructor,
|
||||
label = __CONSTRUCTOR_TABLE__,
|
||||
count = __CONSTRUCTOR_COUNT__,
|
||||
segment = ONCE;
|
||||
CONDES: type = destructor,
|
||||
label = __DESTRUCTOR_TABLE__,
|
||||
count = __DESTRUCTOR_COUNT__,
|
||||
segment = RODATA;
|
||||
CONDES: type = interruptor,
|
||||
label = __INTERRUPTOR_TABLE__,
|
||||
count = __INTERRUPTOR_COUNT__,
|
||||
segment = RODATA,
|
||||
import = __CALLIRQ__;
|
||||
}
|
||||
@@ -1,5 +1,3 @@
|
||||
# Assembly configuration for R38
|
||||
|
||||
FEATURES {
|
||||
STARTADDRESS: default = $0801;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ MEMORY {
|
||||
EXT: file = "", define = yes, start = $9000, size = $1000;
|
||||
IO: file = "", define = yes, start = $A000, size = $1000;
|
||||
RAE1: file = "", define = yes, start = $B000, size = $1000;
|
||||
BASROM: file = "", define = yes, start = $C000, size = $1000;
|
||||
BASROM: file = "", define = yes, start = $C000, size = $2000;
|
||||
RAE2: file = "", define = yes, start = $E000, size = $1000;
|
||||
TOP: file = "", define = yes, start = $F000, size = $1000;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ MEMORY {
|
||||
EXT: file = "", define = yes, start = $9000, size = $1000;
|
||||
IO: file = "", define = yes, start = $A000, size = $1000;
|
||||
RAE1: file = "", define = yes, start = $B000, size = $1000;
|
||||
BASROM: file = "", define = yes, start = $C000, size = $1000;
|
||||
BASROM: file = "", define = yes, start = $C000, size = $2000;
|
||||
RAE2: file = "", define = yes, start = $E000, size = $1000;
|
||||
TOP: file = "", define = yes, start = $F000, size = $1000;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ MEMORY {
|
||||
EXT: file = "", define = yes, start = $9000, size = $1000;
|
||||
IO: file = "", define = yes, start = $A000, size = $1000;
|
||||
RAE1: file = "", define = yes, start = $B000, size = $1000;
|
||||
BASROM: file = "", define = yes, start = $C000, size = $1000;
|
||||
BASROM: file = "", define = yes, start = $C000, size = $2000;
|
||||
RAE2: file = "", define = yes, start = $E000, size = $1000;
|
||||
TOP: file = "", define = yes, start = $F000, size = $1000;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,6 @@ clean:
|
||||
$(RM) -r ../html ../info
|
||||
|
||||
install:
|
||||
$(if $(PREFIX),,$(error variable "PREFIX" must be set))
|
||||
ifeq ($(wildcard ../html),../html)
|
||||
$(INSTALL) -d $(DESTDIR)$(htmldir)
|
||||
$(INSTALL) -m0644 ../html/*.* $(DESTDIR)$(htmldir)
|
||||
|
||||
@@ -370,7 +370,7 @@ The names in the parentheses denote the symbols to be used for static linking of
|
||||
In memory constrained situations the memory from $803 to $1FFF
|
||||
can be made available to a program by calling <tt/_heapadd ((void *) 0x0803, 0x17FD);/
|
||||
at the beginning of <tt/main()/. Doing so is beneficial even if the program
|
||||
doesn't use the the heap explicitly because loading the driver (and in fact
|
||||
doesn't use the heap explicitly because loading the driver (and in fact
|
||||
already opening the driver file) uses the heap implicitly.
|
||||
|
||||
</descrip><p>
|
||||
|
||||
@@ -376,7 +376,7 @@ The names in the parentheses denote the symbols to be used for static linking of
|
||||
In memory constrained situations the memory from $803 to $1FFF
|
||||
can be made available to a program by calling <tt/_heapadd ((void *) 0x0803, 0x17FD);/
|
||||
at the beginning of <tt/main()/. Doing so is beneficial even if the program
|
||||
doesn't use the the heap explicitly because loading the driver (and in fact
|
||||
doesn't use the heap explicitly because loading the driver (and in fact
|
||||
already opening the driver file) uses the heap implicitly.
|
||||
|
||||
</descrip><p>
|
||||
|
||||
@@ -117,7 +117,7 @@ Special locations:
|
||||
The startup code rearranges the memory as follows:
|
||||
|
||||
<enum>
|
||||
<item>Sceen memory and display list are moved below the program start address.
|
||||
<item>Screen memory and display list are moved below the program start address.
|
||||
<item>The ROM is disabled, making the memory in the areas [$C000-$CFFF]
|
||||
and [$D800-$FFF9] available.
|
||||
<item>Character generator data is copied from ROM to the CHARGEN location specified in the
|
||||
|
||||
157
doc/atari7800.sgml
Normal file
157
doc/atari7800.sgml
Normal file
@@ -0,0 +1,157 @@
|
||||
<!doctype linuxdoc system>
|
||||
|
||||
<article>
|
||||
<title>Atari 7800 specific information for cc65
|
||||
<author>
|
||||
<url url="mailto:karri@sipo.fi" name="Karri Kaksonen"><newline>
|
||||
|
||||
<abstract>
|
||||
An overview over the Atari 7800 runtime system as it is implemented
|
||||
for the cc65 C compiler.
|
||||
</abstract>
|
||||
|
||||
<!-- Table of contents -->
|
||||
<toc>
|
||||
|
||||
<!-- Begin the document -->
|
||||
|
||||
<sect>Overview<p>
|
||||
|
||||
This file contains an overview of the Atari 7800 runtime system as it
|
||||
comes with the cc65 C compiler. It describes the memory layout, Atari
|
||||
7800 specific header files and any pitfalls specific to that platform.
|
||||
|
||||
<sect>Binary format<p>
|
||||
|
||||
The default binary output format generated by the linker for the Atari
|
||||
7800 target is a 48K cartridge image.
|
||||
|
||||
<sect>A78 header<p>
|
||||
|
||||
There is lots of different cart hardware available for the atari7800.
|
||||
Some carts have ROM, RAM, sound hardware, non-volatile high score chips.
|
||||
In order to know what kind of hardware the cart build requires there is
|
||||
a header file of 128 bytes in front of the binary.
|
||||
|
||||
The default build creates a cart file for a 48K rom cart without any
|
||||
extra features like the pokey audio chip or extra RAM.
|
||||
|
||||
In order to make cc65 more user friendly the build will add the a78
|
||||
header automatically. This allows you to run the binary on emulators
|
||||
and flash carts on the real console.
|
||||
|
||||
<sect>Encryption<p>
|
||||
|
||||
In order to boot the game in a mode that supports atari7800 functions
|
||||
the cart must be encrypted after the linking phase.
|
||||
There is a program called sign7800 that can be used to sign the cart.
|
||||
The encryption is not required for running the cart on emulators.
|
||||
You can also run atari2600 games without encryption.
|
||||
|
||||
<sect>Memory layout<p>
|
||||
|
||||
cc65 generated programs with the default setup can use RAM from
|
||||
from $1800 to $203f.
|
||||
The 4k RAM is then mapped to zero page area.
|
||||
$2040 to $20ff is visible as zero page.
|
||||
After that we have a vero small RAM area that is unused.
|
||||
$2100 to $213f.
|
||||
Then we mirror a second block from the RAM to become the hardware stack.
|
||||
This would be from $2140 to $21ff.
|
||||
|
||||
The C-stack starts at $2800 and it can grow down to $2200.
|
||||
|
||||
size of the system stack can be customized by defining the
|
||||
__STACKSIZE__ linker variable.
|
||||
|
||||
Special locations:
|
||||
|
||||
<descrip>
|
||||
<tag/Stack/ The C runtime stack is located at $2800 -
|
||||
__STACKSIZE__ and growing downwards.
|
||||
|
||||
<tag/Heap/ The C heap is located at $2200 and grows upwards.
|
||||
|
||||
</descrip><p>
|
||||
|
||||
<sect>Start-up condition<p>
|
||||
|
||||
When powered-up, the Atari 7800 TIA registers contain random
|
||||
values. During the initialization phase, the start-up code needs to
|
||||
initialize the TIA registers to sound values (or else the console has
|
||||
an unpredictable behavior). In this implementation, zeros are written
|
||||
to all of TIA registers during the start-up phase.
|
||||
|
||||
Note that RIOT registers (mostly timers) are left uninitialized, as
|
||||
they don't have any consequence on the console behavior.
|
||||
|
||||
<sect>Platform specific header files<p>
|
||||
|
||||
Programs containing Atari 7800 specific code may use the
|
||||
<tt/atari7800.h/ header file.
|
||||
|
||||
The following pseudo variables declared in the <tt/atari7800.h/ header
|
||||
file allow access to the Atari 7800 TIA, MARIA & RIOT chips registers.
|
||||
|
||||
<descrip>
|
||||
|
||||
<tag><tt/TIA/</tag> The <tt/TIA/ structure allows read/write access
|
||||
to the Atari 7800 TIA chip registers. See the <tt/_tia.h/ header
|
||||
file located in the include directory for the declaration of the
|
||||
structure. Also refer to the Stella Programmer's Guide by Steve
|
||||
Wright for a detailed description of the chip and its registers.
|
||||
|
||||
<tag><tt/RIOT/</tag> The <tt/RIOT/ structure allows read/write
|
||||
access to the Atari 7800 RIOT chip registers. See the
|
||||
<tt/_riot.h/ header file located in the include directory for the
|
||||
declaration of the structure. Also refer to the Stella Programmer's
|
||||
Guide by Steve Wright for a detailed description of the chip and its
|
||||
registers.
|
||||
|
||||
<tag><tt/MARIA/</tag> The <tt/MARIA/ structure allows read/write
|
||||
access to the Atari 7800 MARIA chip registers. See the
|
||||
<tt/_maria.h/ header file located in the include directory for the
|
||||
declaration of the structure.
|
||||
|
||||
</descrip><p>
|
||||
|
||||
|
||||
<sect>Loadable drivers<p>
|
||||
|
||||
There are no drivers for the Atari 7800.
|
||||
|
||||
|
||||
<sect>Limitations<p>
|
||||
|
||||
TBD
|
||||
|
||||
|
||||
<sect>Other hints<p>
|
||||
|
||||
One may write a custom linker configuration file to tune the memory
|
||||
layout of a program. See the <tt/atari7800.cfg/ file in the cfg
|
||||
directory as a starting point.
|
||||
|
||||
|
||||
<sect>License<p>
|
||||
|
||||
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:
|
||||
|
||||
<enum>
|
||||
<item> 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.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
</enum>
|
||||
|
||||
</article>
|
||||
@@ -126,7 +126,7 @@ and $FF3F.
|
||||
In memory constrained situations the memory from $400 to $7FF
|
||||
can be made available to a program by calling <tt/_heapadd ((void *) 0x0400, 0x0400);/
|
||||
at the beginning of <tt/main()/. Doing so is beneficial even if the program
|
||||
doesn't use the the heap explicitly because loading a driver uses the heap implicitly.
|
||||
doesn't use the heap explicitly because loading a driver uses the heap implicitly.
|
||||
|
||||
Using <tt/c64-soft80.o/ is as simple as placing it on the linker command
|
||||
line like this:
|
||||
|
||||
@@ -3108,7 +3108,7 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
|
||||
<sect1><tt>.IFDEF</tt><label id=".IFDEF"><p>
|
||||
|
||||
Conditional assembly: Check if a symbol is defined. Must be followed by
|
||||
a symbol name. The condition is true if the the given symbol is already
|
||||
a symbol name. The condition is true if the given symbol is already
|
||||
defined, and false otherwise.
|
||||
|
||||
See also: <tt><ref id=".DEFINED" name=".DEFINED"></tt>
|
||||
@@ -3143,7 +3143,7 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
|
||||
<sect1><tt>.IFNDEF</tt><label id=".IFNDEF"><p>
|
||||
|
||||
Conditional assembly: Check if a symbol is defined. Must be followed by
|
||||
a symbol name. The condition is true if the the given symbol is not
|
||||
a symbol name. The condition is true if the given symbol is not
|
||||
defined, and false otherwise.
|
||||
|
||||
See also: <tt><ref id=".DEFINED" name=".DEFINED"></tt>
|
||||
@@ -3152,7 +3152,7 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
|
||||
<sect1><tt>.IFNREF</tt><label id=".IFNREF"><p>
|
||||
|
||||
Conditional assembly: Check if a symbol is referenced. Must be followed
|
||||
by a symbol name. The condition is true if if the the given symbol was
|
||||
by a symbol name. The condition is true if the given symbol was
|
||||
not referenced before, and false otherwise.
|
||||
|
||||
See also: <tt><ref id=".REFERENCED" name=".REFERENCED"></tt>
|
||||
@@ -3197,7 +3197,7 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
|
||||
<sect1><tt>.IFREF</tt><label id=".IFREF"><p>
|
||||
|
||||
Conditional assembly: Check if a symbol is referenced. Must be followed
|
||||
by a symbol name. The condition is true if if the the given symbol was
|
||||
by a symbol name. The condition is true if the given symbol was
|
||||
referenced before, and false otherwise.
|
||||
|
||||
This command may be used to build subroutine libraries in include files
|
||||
@@ -3724,7 +3724,7 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".BYTE" name=".BYTE"
|
||||
|
||||
<tt/.PUSHCHARMAP/ allows together with <tt><ref id=".POPCHARMAP"
|
||||
name=".POPCHARMAP"></tt> to switch to another character mapping and to restore the old
|
||||
characther mapping later, without knowledge of the current mapping.
|
||||
character mapping later, without knowledge of the current mapping.
|
||||
|
||||
The assembler will print an error message if the character mapping stack is already full,
|
||||
when this command is issued.
|
||||
@@ -4763,6 +4763,7 @@ compiler, depending on the target system selected:
|
||||
<item><tt/__APPLE2ENH__/ - Target system is <tt/apple2enh/
|
||||
<item><tt/__ATARI2600__/ - Target system is <tt/atari2600/
|
||||
<item><tt/__ATARI5200__/ - Target system is <tt/atari5200/
|
||||
<item><tt/__ATARI7800__/ - Target system is <tt/atari7800/
|
||||
<item><tt/__ATARI__/ - Target system is <tt/atari/ or <tt/atarixl/
|
||||
<item><tt/__ATARIXL__/ - Target system is <tt/atarixl/
|
||||
<item><tt/__ATMOS__/ - Target system is <tt/atmos/
|
||||
|
||||
201
doc/cc65.sgml
201
doc/cc65.sgml
@@ -198,6 +198,189 @@ Here is a description of all the command line options:
|
||||
Enables debug mode, for debugging the behavior of cc65.
|
||||
|
||||
|
||||
<tag><tt>--debug-tables name</tt></tag>
|
||||
|
||||
Writes symbol table information to a file, which includes details on structs, unions
|
||||
functions, and global variables. For example, given the following code:
|
||||
|
||||
<tscreen><verb>
|
||||
struct l {
|
||||
unsigned char m;
|
||||
unsigned char n;
|
||||
};
|
||||
|
||||
struct hello {
|
||||
unsigned char j;
|
||||
unsigned char k;
|
||||
struct l l;
|
||||
};
|
||||
|
||||
struct sub {
|
||||
unsigned char x;
|
||||
unsigned char y;
|
||||
};
|
||||
|
||||
union xy {
|
||||
struct sub xy;
|
||||
unsigned int mem;
|
||||
};
|
||||
|
||||
typedef struct hello thingy;
|
||||
|
||||
unsigned char single;
|
||||
|
||||
unsigned char test_local_vars_main(void) {
|
||||
static unsigned char wahoo;
|
||||
static unsigned char bonanza = 0x42;
|
||||
unsigned char i;
|
||||
unsigned int j;
|
||||
unsigned int *random;
|
||||
unsigned char *lol;
|
||||
signed char whoa;
|
||||
struct hello wow;
|
||||
thingy *cool;
|
||||
union xy xy;
|
||||
|
||||
return 0;
|
||||
}
|
||||
</verb></tscreen>
|
||||
|
||||
The following output would be produced:
|
||||
|
||||
<tscreen><verb>
|
||||
SC_FUNC: _test_local_vars_main: Symbol table
|
||||
============================================
|
||||
__fixargs__:
|
||||
Flags: SC_CONST SC_DEF
|
||||
Type: unsigned int
|
||||
__argsize__:
|
||||
Flags: SC_CONST SC_DEF
|
||||
Type: unsigned char
|
||||
wahoo:
|
||||
AsmName: M0001
|
||||
Flags: SC_STATIC SC_DEF SC_REF
|
||||
Type: unsigned char
|
||||
bonanza:
|
||||
AsmName: M0002
|
||||
Flags: SC_STATIC SC_DEF SC_REF
|
||||
Type: unsigned char
|
||||
i:
|
||||
Flags: SC_AUTO SC_DEF SC_REF
|
||||
Type: unsigned char
|
||||
j:
|
||||
Flags: SC_AUTO SC_DEF SC_REF
|
||||
Type: unsigned int
|
||||
random:
|
||||
Flags: SC_AUTO SC_DEF SC_REF
|
||||
Type: unsigned int *
|
||||
lol:
|
||||
Flags: SC_AUTO SC_DEF SC_REF
|
||||
Type: unsigned char *
|
||||
whoa:
|
||||
Flags: SC_AUTO SC_DEF SC_REF
|
||||
Type: signed char
|
||||
wow:
|
||||
Flags: SC_AUTO SC_DEF SC_REF
|
||||
Type: struct hello
|
||||
cool:
|
||||
Flags: SC_AUTO SC_DEF SC_REF
|
||||
Type: struct hello *
|
||||
xy:
|
||||
Flags: SC_AUTO SC_DEF SC_REF
|
||||
Type: union xy
|
||||
|
||||
|
||||
|
||||
|
||||
Global symbol table
|
||||
===================
|
||||
thingy:
|
||||
AsmName: _thingy
|
||||
Flags: SC_TYPEDEF 0x100000
|
||||
Type: struct hello
|
||||
single:
|
||||
AsmName: _single
|
||||
Flags: SC_STATIC SC_EXTERN SC_STORAGE SC_DEF SC_REF 0x100000
|
||||
Type: unsigned char
|
||||
test_local_vars_main:
|
||||
AsmName: _test_local_vars_main
|
||||
Flags: SC_FUNC SC_STATIC SC_EXTERN SC_DEF 0x100000
|
||||
Type: unsigned char (void)
|
||||
|
||||
|
||||
|
||||
|
||||
Global tag table
|
||||
================
|
||||
l:
|
||||
Flags: SC_STRUCT SC_DEF
|
||||
Type: (none)
|
||||
hello:
|
||||
Flags: SC_STRUCT SC_DEF
|
||||
Type: (none)
|
||||
sub:
|
||||
Flags: SC_STRUCT SC_DEF
|
||||
Type: (none)
|
||||
xy:
|
||||
Flags: SC_UNION SC_DEF
|
||||
Type: (none)
|
||||
|
||||
|
||||
|
||||
|
||||
Global struct and union definitions
|
||||
=========================
|
||||
|
||||
SC_STRUCT: l
|
||||
============
|
||||
m:
|
||||
Flags: SC_STRUCTFIELD
|
||||
Type: unsigned char
|
||||
n:
|
||||
Flags: SC_STRUCTFIELD
|
||||
Type: unsigned char
|
||||
|
||||
|
||||
|
||||
|
||||
SC_STRUCT: hello
|
||||
================
|
||||
j:
|
||||
Flags: SC_STRUCTFIELD
|
||||
Type: unsigned char
|
||||
k:
|
||||
Flags: SC_STRUCTFIELD
|
||||
Type: unsigned char
|
||||
l:
|
||||
Flags: SC_STRUCTFIELD
|
||||
Type: struct l
|
||||
|
||||
|
||||
|
||||
|
||||
SC_STRUCT: sub
|
||||
==============
|
||||
x:
|
||||
Flags: SC_STRUCTFIELD
|
||||
Type: unsigned char
|
||||
y:
|
||||
Flags: SC_STRUCTFIELD
|
||||
Type: unsigned char
|
||||
|
||||
|
||||
|
||||
|
||||
SC_UNION: xy
|
||||
============
|
||||
xy:
|
||||
Flags: SC_STRUCTFIELD
|
||||
Type: struct sub
|
||||
mem:
|
||||
Flags: SC_STRUCTFIELD
|
||||
Type: unsigned int
|
||||
</verb></tscreen>
|
||||
|
||||
|
||||
<tag><tt>--debug-opt name</tt></tag>
|
||||
|
||||
The named file contains a list of specific optimization steps to enable or disable.
|
||||
@@ -919,8 +1102,20 @@ The compiler defines several macros at startup:
|
||||
<tag><tt>__CC65__</tt></tag>
|
||||
|
||||
This macro is always defined. Its value is the version number of the
|
||||
compiler in hex. For example, version 2.14 of the compiler has this macro
|
||||
defined as <tt/0x02E0/.
|
||||
compiler in hex: <tt>(VER_MAJOR * 0x100) + VER_MINOR</tt>. The upper 8 bits
|
||||
are the major-, the lower 8 bits are the minor version. For example, version
|
||||
47.11 of the compiler would have this macro defined as <tt/0x2f0b/.
|
||||
|
||||
Note: until 2.19 this macro was defined as <tt>(VER_MAJOR * 0x100) + VER_MINOR * 0x10</tt> -
|
||||
which resulted in broken values starting at version 2.16 of the compiler. For
|
||||
this reason the value of this macro is considered purely informal - you should
|
||||
not use it to check for a specific compiler version and use different code
|
||||
according to the detected version - please update your code to work with the
|
||||
recent version of the compiler instead (There is very little reason to not use
|
||||
the most recent version - and even less to support older versions in your code).
|
||||
|
||||
Should you still insist on doing this for some reason - look at <tt>checkversion.c</tt>
|
||||
in the samples directory for some preprocessor kludges that might help.
|
||||
|
||||
<tag><tt>__CC65_STD__</tt></tag>
|
||||
|
||||
@@ -1673,7 +1868,7 @@ This is the original compiler copyright:
|
||||
|
||||
Anyone may copy or redistribute these programs, provided that:
|
||||
|
||||
1: You don't charge anything for the copy. It is permissable to
|
||||
1: You don't charge anything for the copy. It is permissible to
|
||||
charge a nominal fee for media, etc.
|
||||
|
||||
2: All source code and documentation for the programs is made
|
||||
|
||||
@@ -200,15 +200,23 @@ access to hardware located in the address space. Some variables are
|
||||
structures, accessing the struct fields will access the chip registers.
|
||||
|
||||
<descrip>
|
||||
<tag><tt/VERA/</tag>
|
||||
The <tt/VERA/ structure allows access
|
||||
to the Video Enhanced Retro Adapter chip.
|
||||
|
||||
<tag><tt/RAM_BANK/</tag>
|
||||
A register that controls which bank of high RAM is visible in the
|
||||
<tt/BANK_RAM/ window.
|
||||
|
||||
<tag><tt/ROM_BANK/</tag>
|
||||
A register that controls which bank of ROM is active at the moment.
|
||||
|
||||
<tag><tt/VIA1, VIA2/</tag>
|
||||
Access to the two VIA (Versatile Interface Adapter) chips is available via
|
||||
the <tt/VIA1/ and <tt/VIA2/ variables. The structure behind those variables
|
||||
is explained in <tt/_6522.h/.
|
||||
|
||||
<tag><tt/VERA/</tag>
|
||||
The <tt/VERA/ structure allows access
|
||||
to the Video Enhanced Retro Adapter chip.
|
||||
|
||||
<tag><tt/BANK_RAM/</tag>
|
||||
A character array that mirrors the eight-Kibibyte window, at $A000,
|
||||
into banked RAM.
|
||||
@@ -219,7 +227,7 @@ structures, accessing the struct fields will access the chip registers.
|
||||
<sect>Loadable drivers<p>
|
||||
|
||||
The names in the parentheses denote the symbols to be used for static linking
|
||||
of the drivers. The names fit into the 8.3 character limit of the SD-Card's
|
||||
of the drivers. The names fit into the old 8.3-character limit of the SD-Card's
|
||||
FAT32 file-system.
|
||||
|
||||
|
||||
@@ -230,7 +238,7 @@ point to <tt/cx320p1.tgi (cx320p1_tgi)/.
|
||||
|
||||
<descrip>
|
||||
<tag><tt/cx320p1.tgi (cx320p1_tgi)/</tag>
|
||||
This driver features a resolution of 320 across and 200 down with 256 colors,
|
||||
This driver features a resolution of 320 across and 240 down with 256 colors,
|
||||
and a slightly adjustable palette (the order of the colors can be changed in
|
||||
a way that's compatible with some of the other color drivers).
|
||||
</descrip><p>
|
||||
@@ -248,10 +256,10 @@ point to <tt/cx16-std.joy (cx16_std_joy)/.
|
||||
|
||||
<descrip>
|
||||
<tag><tt/cx16-std.joy (cx16_std_joy)/</tag>
|
||||
Supports up to two NES (and SNES) controllers connected to the joystick ports
|
||||
of the CX16. It reads the four directions, and the <bf/A/, <bf/B/,
|
||||
<bf/Select/, and <bf/Start/ buttons. Buttons <bf/A/ and <bf/B/ are
|
||||
the first and second fire buttons.
|
||||
Supports the keyboard emulation of a controller and up to four SNES (and NES)
|
||||
controllers connected to the joystick ports of the CX16. It reads the four
|
||||
directions, and the <bf/A/, <bf/B/, <bf/Select/, and <bf/Start/ buttons.
|
||||
Buttons <bf/A/ and <bf/B/ are the first and second fire buttons.
|
||||
</descrip><p>
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ How to debug your code using the VICE and Oricutron emulators.
|
||||
<sect>Overview<p>
|
||||
|
||||
This document describes how to debug your programs using the cc65 development
|
||||
tools and the VICE CBM emulator.
|
||||
tools and the VICE or Oricutron emulator.
|
||||
|
||||
|
||||
|
||||
@@ -126,6 +126,12 @@ and you may use them wherever you need to specify an address. Try
|
||||
as an example (note that VICE needs a leading dot before all labels, and that
|
||||
the compiler prepends an underline under most named labels).
|
||||
|
||||
If you start the emulator from the commandline, you can also load the labels
|
||||
directly using something like this:
|
||||
|
||||
<tscreen><verb>
|
||||
x64sc -moncommands hello.lbl hello.prg
|
||||
</verb></tscreen>
|
||||
|
||||
|
||||
<sect>How to use the label file with Oricutron<p>
|
||||
@@ -144,8 +150,7 @@ and you may use them wherever you need to specify an address. Try
|
||||
d ._main
|
||||
</verb></tscreen>
|
||||
|
||||
as an example (note that VICE needs a leading dot before all labels, and that
|
||||
the compiler prepends an underline under most named labels).
|
||||
as an example.
|
||||
|
||||
|
||||
|
||||
|
||||
123
doc/funcref.sgml
123
doc/funcref.sgml
@@ -754,6 +754,16 @@ communication, see also <tt>testcode/lib/ser-test.c</tt>.
|
||||
</itemize>
|
||||
|
||||
|
||||
<sect1><tt/sym1.h/<label id="sym1.h"><p>
|
||||
|
||||
<itemize>
|
||||
<item><ref id="beep" name="beep">
|
||||
<item><ref id="fdisp" name="fdisp">
|
||||
<item><ref id="loadt" name="loadt">
|
||||
<item><ref id="dumpt" name="dumpt">
|
||||
</itemize>
|
||||
|
||||
|
||||
<sect1><tt/telestrat.h/<label id="telestrat.h"><p>
|
||||
|
||||
<itemize>
|
||||
@@ -1669,6 +1679,27 @@ used in presence of a prototype.
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>beep<label id="beep"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Beep sound.
|
||||
<tag/Header/<tt/<ref id="sym1.h" name="sym1.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.
|
||||
</itemize>
|
||||
<tag/Availability/cc65
|
||||
<tag/See also/
|
||||
<ref id="fdisp" name="fdisp">,
|
||||
<ref id="loadt" name="loadt">,
|
||||
<ref id="dumpt" name="dumpt">,
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>bgcolor<label id="bgcolor"><p>
|
||||
|
||||
<quote>
|
||||
@@ -3363,6 +3394,30 @@ int main(void)
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>dumpt<label id="dumpt"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Dump memory to tape.
|
||||
<tag/Header/<tt/<ref id="sym1.h" name="sym1.h">/
|
||||
<tag/Declaration/<tt/int __fastcall__ dumpt (unsigned char id, const void* start, const void* end);/
|
||||
<tag/Description/<tt/dumpt/ saves memory onto data tape.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is specific to the Sym-1.
|
||||
<item>The return value is status. Non-zero status indicates an error.
|
||||
<item>The function is only available as fastcall function, so it may only
|
||||
be used in presence of a prototype.
|
||||
</itemize>
|
||||
<tag/Availability/cc65
|
||||
<tag/See also/
|
||||
<ref id="beep" name="beep">,
|
||||
<ref id="fdisp" name="fdisp">,
|
||||
<ref id="loadt" name="loadt">,
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>em_commit<label id="em_commit"><p>
|
||||
|
||||
<quote>
|
||||
@@ -3513,7 +3568,7 @@ extended memory that should be supported. There is no autodetect capability.
|
||||
<tag/Declaration/<tt/void* __fastcall__ em_map (unsigned page);/
|
||||
<tag/Description/The function maps one page of extended memory into linear
|
||||
memory and returns a pointer to the page frame. Depending on the hardware
|
||||
and driver, the data is either mapped into the address space or transfered
|
||||
and driver, the data is either mapped into the address space or transferred
|
||||
into a buffer. If you don't need the actual contents of the page (for example
|
||||
because you're going to overwrite it completely), it is better to call
|
||||
<tt/<ref id="em_use" name="em_use">/ instead. <tt/em_use/ will not transfer the
|
||||
@@ -3721,6 +3776,28 @@ switching the CPU into double clock mode.
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>fdisp<label id="fdisp"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Flash front-panel display.
|
||||
<tag/Header/<tt/<ref id="sym1.h" name="sym1.h">/
|
||||
<tag/Declaration/<tt/void fdisp(void);/
|
||||
<tag/Description/<tt/fdisp/ flashes front-panel display.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is specific to the Sym-1.
|
||||
<item>The front-panel display buffer must be loaded prior to calling fdisp. See the DISPLAY struct definition in sym1.h.
|
||||
</itemize>
|
||||
<tag/Availability/cc65
|
||||
<tag/See also/
|
||||
<ref id="beep" name="beep">,
|
||||
<ref id="loadt" name="loadt">,
|
||||
<ref id="dumpt" name="dumpt">,
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>feof<label id="feof"><p>
|
||||
|
||||
<quote>
|
||||
@@ -3728,7 +3805,7 @@ switching the CPU into double clock mode.
|
||||
<tag/Function/Return the end-of-file indicator of a stream.
|
||||
<tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
|
||||
<tag/Declaration/<tt/int __fastcall__ feof (FILE* f);/
|
||||
<tag/Description/<tt/feof/ tests the end-of-file indicator ofthe stream
|
||||
<tag/Description/<tt/feof/ tests the end-of-file indicator of the stream
|
||||
<tt/f/, and returns a non zero value if it is set.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The indicator is set only after a read past the end of a file is
|
||||
@@ -4172,7 +4249,7 @@ const char* optstring);/
|
||||
is a string that contains command line option characters. If a character in
|
||||
<tt/optstring/ is followed by a colon, the option requires an argument. An
|
||||
option on the command line is recognized if it is one of the option characters
|
||||
preceeded by a '-'.
|
||||
preceded by a '-'.
|
||||
<tt/getopt/ must be called repeatedly. It will return each option character
|
||||
found on the command line and <tt/EOF/ (-1) if there is no other option. An
|
||||
option argument is placed in <tt/optarg/, the index of the next element on the
|
||||
@@ -4961,6 +5038,30 @@ used in presence of a prototype.
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>loadt<label id="loadt"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Load memory from tape.
|
||||
<tag/Header/<tt/<ref id="sym1.h" name="sym1.h">/
|
||||
<tag/Declaration/<tt/int __fastcall__ loadt (unsigned char id);/
|
||||
<tag/Description/<tt/loadt/ loads memory from data tape.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is specific to the Sym-1.
|
||||
<item>The return value is status. Non-zero status indicates an error.
|
||||
<item>The function is only available as fastcall function, so it may only
|
||||
be used in presence of a prototype.
|
||||
</itemize>
|
||||
<tag/Availability/cc65
|
||||
<tag/See also/
|
||||
<ref id="beep" name="beep">,
|
||||
<ref id="fdisp" name="fdisp">,
|
||||
<ref id="dumpt" name="dumpt">,
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>ltoa<label id="ltoa"><p>
|
||||
|
||||
<quote>
|
||||
@@ -5020,7 +5121,7 @@ always be the same.
|
||||
<tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
|
||||
<tag/Declaration/<tt/void __fastcall__ longjmp (jmp_buf buf, int retval);/
|
||||
<tag/Description/The <tt/longjmp/ function restores a program context from the
|
||||
data in <tt/buf/, which must have been set by a preceeding call to
|
||||
data in <tt/buf/, which must have been set by a preceding call to
|
||||
<tt/<ref id="setjmp" name="setjmp">/. Program execution continues as if the
|
||||
call to <tt/<ref id="setjmp" name="setjmp">/ has just returned the value
|
||||
<tt/retval/.
|
||||
@@ -5664,7 +5765,7 @@ cc65 allows to pass this argument, it is ignored.
|
||||
<tag/Function/Open a directory.
|
||||
<tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
|
||||
<tag/Declaration/<tt/DIR* __fastcall__ opendir (const char* name);/
|
||||
<tag/Description/<tt/opendir/ opens a directory and returns the direcory
|
||||
<tag/Description/<tt/opendir/ opens a directory and returns the directory
|
||||
descriptor associated with it. On error, NULL is returned and an error code is
|
||||
stored in <tt/errno/.
|
||||
<tag/Notes/<itemize>
|
||||
@@ -6026,7 +6127,7 @@ pointer you're passing somewhere else, otherwise
|
||||
<tscreen><verb>
|
||||
ptr = realloc (ptr, size);
|
||||
</verb></tscreen>
|
||||
will loose your only copy of <tt/ptr/ if <tt/realloc/ returns <tt/NULL/.
|
||||
will lose your only copy of <tt/ptr/ if <tt/realloc/ returns <tt/NULL/.
|
||||
<item>The function is only available as fastcall function, so it may only
|
||||
be used in presence of a prototype.
|
||||
</itemize>
|
||||
@@ -6863,7 +6964,7 @@ be used in presence of a prototype.
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Concatentate two strings.
|
||||
<tag/Function/Concatenate two strings.
|
||||
<tag/Header/<tt/<ref id="string.h" name="string.h">/
|
||||
<tag/Declaration/<tt/char* __fastcall__ strcat (char* s1, const char* s2);/
|
||||
<tag/Description/The <tt/strcat/ function appends a copy of the string
|
||||
@@ -7189,7 +7290,7 @@ be used in presence of a prototype.
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Concatentate two strings.
|
||||
<tag/Function/Concatenate two strings.
|
||||
<tag/Header/<tt/<ref id="string.h" name="string.h">/
|
||||
<tag/Declaration/<tt/char* __fastcall__ strncat (char* s1, const char* s2, size_t n);/
|
||||
<tag/Description/The <tt/strncat/ function appends not more than n characters
|
||||
@@ -7314,7 +7415,7 @@ be used in presence of a prototype.
|
||||
<tag/Header/<tt/<ref id="string.h" name="string.h">/
|
||||
<tag/Declaration/<tt/char* __fastcall__ strpbrk (const char* str, const char* set);/
|
||||
<tag/Description/<tt/strpbrk()/ searches within <tt/str/ for the first
|
||||
occurance of any character from <tt/set/. It returns a pointer to that
|
||||
occurrence of any character from <tt/set/. It returns a pointer to that
|
||||
character if found; otherwise, it returns <tt/NULL/.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is available only as a fastcall function;
|
||||
@@ -7418,7 +7519,7 @@ be used in presence of a prototype.
|
||||
<tag/Function/Find a substring.
|
||||
<tag/Header/<tt/<ref id="string.h" name="string.h">/
|
||||
<tag/Declaration/<tt/char* __fastcall__ strstr (const char* str, const char* substr);/
|
||||
<tag/Description/<tt/strstr/ searches for the first occurance of the string
|
||||
<tag/Description/<tt/strstr/ searches for the first occurrence of the string
|
||||
<tt/substr/ within <tt/str/. If found, it returns a pointer to the copy,
|
||||
otherwise it returns <tt/NULL/.
|
||||
<tag/Notes/<itemize>
|
||||
@@ -7485,7 +7586,7 @@ the behaviour is undefined.
|
||||
<item>If <tt/n/ is zero, <tt/s1/ may be a NULL pointer.
|
||||
<item>The function is only available as fastcall function, so it may only
|
||||
be used in presence of a prototype.
|
||||
<item>Since cc65 doesn't support different charcter sets, <tt/strxfrm/ will
|
||||
<item>Since cc65 doesn't support different character sets, <tt/strxfrm/ will
|
||||
just copy s2 to s1 using <tt><ref id="strncpy" name="strncpy"></tt>.
|
||||
</itemize>
|
||||
<tag/Availability/ISO 9899
|
||||
|
||||
@@ -124,6 +124,9 @@
|
||||
<tag><htmlurl url="atari5200.html" name="atari5200.html"></tag>
|
||||
Topics specific to the Atari 5200 Game Console.
|
||||
|
||||
<tag><htmlurl url="atari7800.html" name="atari7800.html"></tag>
|
||||
Topics specific to the Atari 7800 Game Console.
|
||||
|
||||
<tag><htmlurl url="atmos.html" name="atmos.html"></tag>
|
||||
Topics specific to the Oric Atmos.
|
||||
|
||||
|
||||
@@ -500,7 +500,7 @@ prompt.
|
||||
|
||||
Before you can run the cartridge image produced by the linker, the binary has to
|
||||
be patched using the <bf/gamate-fixcart/ tool that is included in the cc65
|
||||
package in the util/gamata directory.
|
||||
package in the util/gamate/ directory.
|
||||
|
||||
<tscreen><verb>
|
||||
gamate-fixcart <image.bin>
|
||||
|
||||
@@ -166,6 +166,7 @@ Here is a description of all of the command-line options:
|
||||
<item>apple2
|
||||
<item>apple2enh
|
||||
<item>atari2600
|
||||
<item>atari7800
|
||||
<item>atari
|
||||
<item>atarixl
|
||||
<item>atmos
|
||||
|
||||
@@ -257,7 +257,7 @@ SMC LoadDefault, { LDX #25 }
|
||||
<label id="Load value">
|
||||
<tag><tt>SMC_LoadValue label (, register)</tt></tag>
|
||||
|
||||
Retreives the value of a SMC line.
|
||||
Retrieves the value of a SMC line.
|
||||
|
||||
Example:
|
||||
<tscreen><verb>
|
||||
|
||||
@@ -15,21 +15,40 @@ An overview over the Sym-1 runtime system as it is implemented for the cc65 C co
|
||||
|
||||
<sect>Overview<p>
|
||||
|
||||
This file contains an overview of the Sym-1 runtime system as it comes with the cc65 C compiler. It describes the memory layout, Sym-1 specific header files, available drivers, and any pitfalls specific to the platform.
|
||||
This file contains an overview of the Sym-1 runtime system as it comes with the cc65 C compiler.
|
||||
It describes the memory layout, Sym-1 specific header files, available drivers, and any pitfalls
|
||||
specific to the platform.
|
||||
|
||||
Please note that Sym-1 specific functions are just mentioned here, they are described in detail in the separate <url url="funcref.html" name="function reference">. Even functions marked as "platform dependent" may be available on more than one platform. Please see the function reference for more information.
|
||||
Please note that Sym-1 specific functions are just mentioned here, they are described in detail
|
||||
in the separate <url url="funcref.html" name="function reference">. Even functions marked as
|
||||
"platform dependent" may be available on more than one platform. Please see the
|
||||
function reference for more information.
|
||||
|
||||
<sect>Binary format<p>
|
||||
|
||||
The output format generated by the linker for the Sym-1 target is a raw binary BIN file, which is essentially a memory image. You can convert this to a HEX file using BIN2HEX, which is a popular open-source conversion utility program. A HEX file has ASCII representations of the hexadecimal byte values of the machine-language program. So the HEX file can be transferred to the Sym-1 using the RS-232 terminal port, just as if the machine-code was entered by hand. Enter 'm 200' in the monitor and start the HEX file transfer.
|
||||
The output format generated by the linker for the Sym-1 target is a raw binary BIN file, which
|
||||
is essentially a memory image. You can convert this to a HEX file using BIN2HEX, which is a
|
||||
popular open-source conversion utility program. A HEX file has ASCII representations of the
|
||||
hexadecimal byte values of the machine-language program. So the HEX file can be transferred
|
||||
to the Sym-1 using the RS-232 terminal port, just as if the machine-code was entered by hand.
|
||||
Enter 'm 200' in the monitor and start the HEX file transfer.
|
||||
|
||||
<p>
|
||||
|
||||
Included with this distribution is a 4k configuration file and a 32k config file. The Sym-1 on-board memory is limited to 4 kbytes but system memory can be increased to 32 kbytes of contiguous RAM with aftermarket add-on boards. So choose the config file that matches your system configuration before compiling and linking user programs.
|
||||
Included with this distribution is a 4k configuration file and a 32k config file. The Sym-1
|
||||
on-board memory is limited to 4 kbytes but system memory can be increased to 32 kbytes of
|
||||
contiguous RAM with aftermarket add-on boards. So choose the config file that matches your
|
||||
system configuration before compiling and linking user programs.
|
||||
|
||||
<sect>Memory layout<p>
|
||||
|
||||
The ROMs and I/O areas are defined in the configuration files, as are most of the entry points for useful subroutines in the Sym-1 monitor ROM. cc65 generated programs compiled and linked using 4k config run in the memory range of $200 - $0FFF. The 32k config expands this range to $7FFF. The starting memory location and entry point for running the program is $200, so when the program is transferred to the Sym-1, it is executed by typing 'g 200'. The system returns control back to the monitor ROM when the program terminates, providing the '.' prompt.
|
||||
The ROMs and I/O areas are defined in the configuration files, as are most of the entry points
|
||||
for useful subroutines in the Sym-1 monitor ROM. cc65 generated programs compiled and linked
|
||||
using 4k config run in the memory range of $200 - $0FFF. The 32k config expands
|
||||
this range to $7FFF. Memory above 32k can be used to extend the heap, as described below.
|
||||
The starting memory location and entry point for running the program is $200, so when the
|
||||
program is transferred to the Sym-1, it is executed by typing 'g 200'. The system returns control
|
||||
back to the monitor ROM when the program terminates, providing the '.' prompt.
|
||||
|
||||
Special locations:
|
||||
|
||||
@@ -38,10 +57,12 @@ Special locations:
|
||||
Conio support is not currently available for the Sym-1. But stdio console functions are available.
|
||||
|
||||
<tag/Stack/
|
||||
The C runtime stack is located at $0FFF on 4KB Syms, or at $7FFFfor 32KB systems. The stack always grows downwards.
|
||||
The C runtime stack is located at $0FFF on 4kb Syms, or at $7FFF for 32kb systems.
|
||||
The stack always grows downwards.
|
||||
|
||||
<tag/Heap/
|
||||
The C heap is located at the end of the program and grows towards the C runtime stack.
|
||||
The C heap is located at the end of the program and grows towards the C runtime stack. Extended
|
||||
memory can be added to the heap, as described below.
|
||||
|
||||
</descrip><p>
|
||||
|
||||
@@ -51,7 +72,8 @@ Programs containing Sym-1 code may use the <tt/sym1.h/ header file. See the hea
|
||||
|
||||
<sect1>Hardware access<p>
|
||||
|
||||
The pseudo variables declared in the <tt/sym1.inc/ include file allow access to hardware located in the address space. See the include file for more information.
|
||||
The pseudo variables declared in the <tt/sym1.inc/ include file allow access to hardware located in the
|
||||
address space. See the include file for more information.
|
||||
|
||||
<sect>Loadable drivers<p>
|
||||
|
||||
@@ -61,7 +83,9 @@ No graphics drivers are currently available for the Sym-1.
|
||||
|
||||
<sect1>Extended memory drivers<p>
|
||||
|
||||
No extended memory drivers are currently available for the Sym-1.
|
||||
There are no extended memory drivers for the Sym-1. However, there is a way to access memory beyond the
|
||||
32kb boundary, if extended memory is physically present in the system. See the example program,
|
||||
symExtendedMemory, in the samples directory.
|
||||
|
||||
<sect1>Joystick drivers<p>
|
||||
|
||||
@@ -73,7 +97,8 @@ No mouse drivers are currently available for the Sym-1.
|
||||
|
||||
<sect1>RS232 device drivers<p>
|
||||
|
||||
No communication port drivers are currently available for the Sym-1. It has only the "master console" e.g. stdin and stdout.
|
||||
No communication port drivers are currently available for the Sym-1. It has only the "master console"
|
||||
e.g. stdin and stdout.
|
||||
|
||||
<sect>Limitations<p>
|
||||
|
||||
@@ -94,29 +119,45 @@ To be more specific, this limitation means that you cannot use any of the follow
|
||||
<sect>Other hints<p>
|
||||
|
||||
<sect1>sym1.h<p>
|
||||
This header exposes Sym-specific I/O functions that are useful for reading and writing its ports and front panel. See the <tt/sym1.h/ include file for a list of the functions available.
|
||||
This header exposes Sym-specific I/O functions that are useful for reading and writing its ports and front panel.
|
||||
See the <tt/sym1.h/ include file for a list of the functions available.
|
||||
|
||||
<sect2>Limited memory applications<p>
|
||||
|
||||
As stated earlier, there are config files for 4KB and 32KB systems. If you have 32KB RAM, then you will probably want to use the sym1-32k configuration, but if not - if you are using the sym1-4k configuration - then you may want to use functions like getchar, putchar, gets and puts rather than functions like scanf and printf. Printf, for example, requires about 1KB because it needs to know how to process all the format specifiers.
|
||||
As stated earlier, there are config files for 4kb and 32kb systems. If you have 32kb RAM, then you will probably
|
||||
want to use the sym1-32k configuration, but if not - if you are using the sym1-4k configuration - then you may
|
||||
want to use functions like getchar, putchar, gets and puts rather than functions like scanf and printf.
|
||||
Printf, for example, requires about 1KB because it needs to know how to process all the format specifiers.
|
||||
|
||||
<sect3>Sample programs<p>
|
||||
<sect3>Using extended memory<p>
|
||||
|
||||
All the samples will run on the "stock" 4KB Sym-1, except for symIO and symNotepad, which require 32KB. These sample programs can be found in the targettest/sym1 directory:
|
||||
Memory may be physically present that is addressed at locations above the monitor ROM at $8000. This extended
|
||||
memory is accessible by adding to the heap, as described in the symExtendedMemory sample program.
|
||||
|
||||
<sect4>Sample programs<p>
|
||||
|
||||
All the samples will run on the "stock" 4kb Sym-1, except for symIO and symNotepad, which require 32kb.
|
||||
Additionally, symExtendedMemory shows how to access memory above 32kb, so it expects more than 32kb.
|
||||
These sample programs can be found in the samples/sym1 directory:
|
||||
|
||||
<itemize>
|
||||
<item>symHello prints "Hello World!" and then inputs characters, which are echoed on the screen. It also makes a "beep" sound.</item>
|
||||
<item>symTiny does the same as symHello, but does it with puts() rather than printf() to show the difference in compiled binary size.</item>
|
||||
<item>symHello prints "Hello World!" and then inputs characters, which are echoed on the screen.
|
||||
It also makes a "beep" sound.</item>
|
||||
<item>symTiny does the same as symHello, but does it with puts() rather than printf() to show the difference
|
||||
in compiled binary size.</item>
|
||||
<item>symDisplay allows entry of a message, which is then displayed by scrolling it across the front panel display.</item>
|
||||
<item>symIO allows access to the Sym-1 digital I/O ports.</item>
|
||||
<item>symNotepad is a simple text entry/retrieval program that uses tape storage.</item>
|
||||
<item>symExtendedMemory demonstrates how to access upper-memory and add it to the heap.</item>
|
||||
</itemize>
|
||||
|
||||
<sect>License<p>
|
||||
|
||||
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.
|
||||
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:
|
||||
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:
|
||||
|
||||
<enum>
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
|
||||
@@ -79,7 +79,7 @@ in Telemon, there is no way to load a binary easily.
|
||||
|
||||
Stratsed (the Telestrat operating system) handles files management. Stratsed
|
||||
is loaded to memory from floppy disk. Stratsed vector are declared in asminc/telestrat.inc.
|
||||
But, reverse engineering is required to find how theses vectors works. Please, note that
|
||||
But, reverse engineering is required to find how these vectors works. Please, note that
|
||||
Stratsed is located in overlay memory (bank 0)
|
||||
|
||||
There is no tool to insert a binary in a Stratsed floppy disk.
|
||||
@@ -194,7 +194,7 @@ if you get input from keyboard by conio cgetc function, you will get direction f
|
||||
|
||||
Anyway, if you don't want to use ROM, you can use joysticks standard drivers in your code.
|
||||
|
||||
The standard driver manages two joysticks. Only one button is managed for theses joysticks.
|
||||
The standard driver manages two joysticks. Only one button is managed for these joysticks.
|
||||
|
||||
Telestrat can handle one button for the left port, and three buttons for the right port (but this port was designed for a mouse).
|
||||
|
||||
|
||||
@@ -76,13 +76,13 @@ ifneq ($(MAKECMDGOALS),clean)
|
||||
endif
|
||||
|
||||
%.o: %.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
	$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
$(PROGRAM): $(SOURCES:.c=.o)
|
||||
$(CC) $(LDFLAGS) -o $@ $^
|
||||
	$(CC) $(LDFLAGS) -o $@ $^
|
||||
|
||||
clean:
|
||||
$(RM) $(SOURCES:.c=.o) $(SOURCES:.c=.d) $(PROGRAM) $(PROGRAM).map
|
||||
	$(RM) $(SOURCES:.c=.o) $(SOURCES:.c=.d) $(PROGRAM) $(PROGRAM).map
|
||||
</verb></tscreen>
|
||||
|
||||
<bf/Important:/ When using the sample Makefile above via copy & paste it is
|
||||
|
||||
@@ -105,7 +105,7 @@ struct __dos2x {
|
||||
unsigned char* zbufp; /* points to user filename */
|
||||
unsigned char* zdrva; /* points to serveral buffers (mostly VTOC) */
|
||||
unsigned char* zsba; /* points to sector buffer */
|
||||
unsigned char errno; /* number of occured error */
|
||||
unsigned char errno; /* number of occurred error */
|
||||
};
|
||||
|
||||
typedef struct __dos2x dos2x_t;
|
||||
|
||||
63
include/_maria.h
Normal file
63
include/_maria.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* _maria.h */
|
||||
/* */
|
||||
/* Atari 7800, Maria chip register hardware structures */
|
||||
/* */
|
||||
/* */
|
||||
/* 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. */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
* MARIA registers
|
||||
*/
|
||||
struct __maria {
|
||||
unsigned char bkgrnd;
|
||||
unsigned char p0c1;
|
||||
unsigned char p0c2;
|
||||
unsigned char p0c3;
|
||||
unsigned char wsync;
|
||||
unsigned char p1c1;
|
||||
unsigned char p1c2;
|
||||
unsigned char p1c3;
|
||||
unsigned char mstat;
|
||||
unsigned char p2c1;
|
||||
unsigned char p2c2;
|
||||
unsigned char p2c3;
|
||||
unsigned char dpph;
|
||||
unsigned char p3c1;
|
||||
unsigned char p3c2;
|
||||
unsigned char p3c3;
|
||||
unsigned char dppl;
|
||||
unsigned char p4c1;
|
||||
unsigned char p4c2;
|
||||
unsigned char p4c3;
|
||||
unsigned char chbase;
|
||||
unsigned char p5c1;
|
||||
unsigned char p5c2;
|
||||
unsigned char p5c3;
|
||||
unsigned char offset;
|
||||
unsigned char p6c1;
|
||||
unsigned char p6c2;
|
||||
unsigned char p6c3;
|
||||
unsigned char ctrl;
|
||||
unsigned char p7c1;
|
||||
unsigned char p7c2;
|
||||
unsigned char p7c3;
|
||||
};
|
||||
67
include/atari7800.h
Normal file
67
include/atari7800.h
Normal file
@@ -0,0 +1,67 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* Atari VCS 7800 TIA & RIOT registers addresses */
|
||||
/* */
|
||||
/* Karri Kaksonen (karri@sipo.fi), 2022 */
|
||||
/* */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef _ATARI7800_H
|
||||
#define _ATARI7800_H
|
||||
|
||||
/* Check for errors */
|
||||
#if !defined(__ATARI7800__)
|
||||
# error This module may only be used when compiling for the Atari 7800!
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
/* Color defines */
|
||||
#define COLOR_BLACK 0x00
|
||||
#define COLOR_GREY 0x01
|
||||
#define COLOR_LIGHTGREY 0x02
|
||||
#define COLOR_WHITE 0x03
|
||||
|
||||
/* TGI color defines (default palette) */
|
||||
#define TGI_COLOR_BLACK COLOR_BLACK
|
||||
#define TGI_COLOR_GREY COLOR_GREY
|
||||
#define TGI_COLOR_LIGHTGREY COLOR_LIGHTGREY
|
||||
#define TGI_COLOR_WHITE COLOR_WHITE
|
||||
|
||||
/* Masks for joy_read */
|
||||
#define JOY_RIGHT_MASK 0x80
|
||||
#define JOY_LEFT_MASK 0x40
|
||||
#define JOY_DOWN_MASK 0x20
|
||||
#define JOY_UP_MASK 0x10
|
||||
#define JOY_BTN_1_MASK 0x01
|
||||
#define JOY_BTN_2_MASK 0x02
|
||||
|
||||
#define JOY_BTN_A_MASK JOY_BTN_1_MASK
|
||||
#define JOY_BTN_B_MASK JOY_BTN_2_MASK
|
||||
|
||||
#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
|
||||
|
||||
extern unsigned char get_tv(void); /* get TV system */
|
||||
|
||||
#include <_tia.h>
|
||||
#define TIA (*(struct __tia*)0x0000)
|
||||
|
||||
#include <_riot.h>
|
||||
#define RIOT (*(struct __riot*)0x0280)
|
||||
|
||||
#include <_maria.h>
|
||||
#define MARIA (*(struct __maria*)0x0020)
|
||||
|
||||
/* End of atari7800.h */
|
||||
#endif
|
||||
@@ -59,21 +59,21 @@ unsigned long __fastcall__ udiv32by16r16 (unsigned long rhs, unsigned lhs);
|
||||
*/
|
||||
|
||||
int __fastcall__ imul8x8r16 (signed char lhs, signed char rhs);
|
||||
/* Multiplicate two signed 8 bit to yield an signed 16 bit result */
|
||||
/* Multiply two signed 8 bit to yield an signed 16 bit result */
|
||||
|
||||
long __fastcall__ imul16x16r32 (int lhs, int rhs);
|
||||
/* Multiplicate two signed 16 bit to yield a signed 32 bit result */
|
||||
/* Multiply two signed 16 bit to yield a signed 32 bit result */
|
||||
|
||||
unsigned __fastcall__ umul8x8r16 (unsigned char lhs, unsigned char rhs);
|
||||
/* Multiplicate two unsigned 8 bit to yield an unsigned 16 bit result */
|
||||
/* Multiply two unsigned 8 bit to yield an unsigned 16 bit result */
|
||||
|
||||
unsigned long __fastcall__ umul16x8r32 (unsigned lhs, unsigned char rhs);
|
||||
/* Multiplicate an unsigned 16 bit by an unsigned 8 bit number yielding a 24
|
||||
/* Multiply an unsigned 16 bit by an unsigned 8 bit number yielding a 24
|
||||
** bit unsigned result that is extended to 32 bits for easier handling from C.
|
||||
*/
|
||||
|
||||
unsigned long __fastcall__ umul16x16r32 (unsigned lhs, unsigned rhs);
|
||||
/* Multiplicate two unsigned 16 bit to yield an unsigned 32 bit result */
|
||||
/* Multiply two unsigned 16 bit to yield an unsigned 32 bit result */
|
||||
|
||||
unsigned int __fastcall__ mul20 (unsigned char value);
|
||||
/* Multiply an 8 bit unsigned value by 20 and return the 16 bit unsigned
|
||||
|
||||
@@ -57,7 +57,9 @@
|
||||
/* Character classification functions */
|
||||
int __fastcall__ isalnum (int c);
|
||||
int __fastcall__ isalpha (int c);
|
||||
int __fastcall__ isascii (int c);
|
||||
#if __CC65_STD__ >= __CC65_STD_CC65__
|
||||
int __fastcall__ isascii (int c); /* non standard */
|
||||
#endif
|
||||
int __fastcall__ iscntrl (int c);
|
||||
int __fastcall__ isdigit (int c);
|
||||
int __fastcall__ isgraph (int c);
|
||||
@@ -75,7 +77,7 @@ int __fastcall__ toupper (int c); /* Always external */
|
||||
int __fastcall__ tolower (int c); /* Always external */
|
||||
|
||||
#if __CC65_STD__ >= __CC65_STD_CC65__
|
||||
unsigned char __fastcall__ toascii (unsigned char c);
|
||||
unsigned char __fastcall__ toascii (unsigned char c); /* non standard */
|
||||
/* Convert a target-specific character to ASCII. */
|
||||
#endif
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/* cx16.h */
|
||||
/* */
|
||||
/* CX16 system-specific definitions */
|
||||
/* For prerelease 38 */
|
||||
/* For prerelease 39 */
|
||||
/* */
|
||||
/* */
|
||||
/* This software is provided "as-is", without any expressed or implied */
|
||||
@@ -169,11 +169,16 @@ enum {
|
||||
};
|
||||
|
||||
/* Video modes for videomode() */
|
||||
#define VIDEOMODE_40x30 0x00
|
||||
#define VIDEOMODE_80x60 0x02
|
||||
#define VIDEOMODE_40COL VIDEOMODE_40x30
|
||||
#define VIDEOMODE_80x60 0x00
|
||||
#define VIDEOMODE_80x30 0x01
|
||||
#define VIDEOMODE_40x60 0x02
|
||||
#define VIDEOMODE_40x30 0x03
|
||||
#define VIDEOMODE_40x15 0x04
|
||||
#define VIDEOMODE_20x30 0x05
|
||||
#define VIDEOMODE_20x15 0x06
|
||||
#define VIDEOMODE_80COL VIDEOMODE_80x60
|
||||
#define VIDEOMODE_320x200 0x80
|
||||
#define VIDEOMODE_40COL VIDEOMODE_40x30
|
||||
#define VIDEOMODE_320x240 0x80
|
||||
#define VIDEOMODE_SWAP (-1)
|
||||
|
||||
/* VERA's address increment/decrement numbers */
|
||||
@@ -221,6 +226,13 @@ enum {
|
||||
|
||||
/* Define hardware. */
|
||||
|
||||
#define RAM_BANK (*(unsigned char *)0x00)
|
||||
#define ROM_BANK (*(unsigned char *)0x01)
|
||||
|
||||
#include <_6522.h>
|
||||
#define VIA1 (*(volatile struct __6522 *)0x9F00)
|
||||
#define VIA2 (*(volatile struct __6522 *)0x9F10)
|
||||
|
||||
/* A structure with the Video Enhanced Retro Adapter's external registers */
|
||||
struct __vera {
|
||||
unsigned short address; /* Address for data ports */
|
||||
@@ -271,12 +283,15 @@ struct __vera {
|
||||
};
|
||||
#define VERA (*(volatile struct __vera *)0x9F20)
|
||||
|
||||
#include <_6522.h>
|
||||
#define VIA1 (*(volatile struct __6522 *)0x9F60)
|
||||
#define VIA2 (*(volatile struct __6522 *)0x9F70)
|
||||
|
||||
#define RAM_BANK (VIA1.pra)
|
||||
#define ROM_BANK (VIA1.prb)
|
||||
/* Audio chip */
|
||||
struct __ym2151 {
|
||||
union {
|
||||
unsigned char reg; /* Register number for data */
|
||||
unsigned char status; /* Busy flag */
|
||||
};
|
||||
unsigned char data;
|
||||
};
|
||||
#define YM2151 (*(volatile struct __ym2151 *)0x9F40)
|
||||
|
||||
/* A structure with the x16emu's settings registers */
|
||||
struct __emul {
|
||||
|
||||
@@ -145,6 +145,8 @@
|
||||
|
||||
/* constants for the conio implementation */
|
||||
#define COLOR_BLACK 0x03
|
||||
#define COLOR_GRAY2 0x02
|
||||
#define COLOR_GRAY1 0x01
|
||||
#define COLOR_WHITE 0x00
|
||||
|
||||
#define CH_HLINE 1
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
#define _LIMITS_H
|
||||
|
||||
|
||||
|
||||
#define CHAR_BIT 8
|
||||
|
||||
#define SCHAR_MIN ((signed char) 0x80)
|
||||
@@ -63,7 +62,9 @@
|
||||
|
||||
#define ULONG_MAX 4294967295UL
|
||||
|
||||
#if __CC65_STD__ >= __CC65_STD_CC65__
|
||||
/* These defines that are platform dependent */
|
||||
/* FILENAME_MAX in stdlib.h is defined as the same value as PATH_MAX */
|
||||
#if defined(__APPLE2__)
|
||||
# define PATH_MAX (64+1)
|
||||
#elif defined(__ATARI__)
|
||||
@@ -77,7 +78,7 @@
|
||||
#else
|
||||
# define PATH_MAX (16+1)
|
||||
#endif
|
||||
|
||||
#endif /* __CC65_STD__ >= __CC65_STD_CC65__ */
|
||||
|
||||
/* End of limits.h */
|
||||
#endif
|
||||
|
||||
@@ -52,24 +52,25 @@
|
||||
|
||||
|
||||
/* Color defines */
|
||||
#define COLOR_BLACK 0x00
|
||||
#define COLOR_RED 0x01
|
||||
#define COLOR_PINK 0x02
|
||||
#define COLOR_LIGHTGREY 0x03
|
||||
#define COLOR_GREY 0x04
|
||||
#define COLOR_DARKGREY 0x05
|
||||
#define COLOR_BROWN 0x06
|
||||
#define COLOR_PEACH 0x07
|
||||
#define COLOR_YELLOW 0x08
|
||||
#define COLOR_LIGHTGREEN 0x09
|
||||
#define COLOR_GREEN 0x0A
|
||||
#define COLOR_DARKBROWN 0x0B
|
||||
#define COLOR_TRANSPARENT 0x00
|
||||
#define COLOR_BLACK 0x01
|
||||
#define COLOR_RED 0x02
|
||||
#define COLOR_PINK 0x03
|
||||
#define COLOR_LIGHTGREY 0x04
|
||||
#define COLOR_GREY 0x05
|
||||
#define COLOR_DARKGREY 0x06
|
||||
#define COLOR_BROWN 0x07
|
||||
#define COLOR_PEACH 0x08
|
||||
#define COLOR_YELLOW 0x09
|
||||
#define COLOR_LIGHTGREEN 0x0A
|
||||
#define COLOR_GREEN 0x0B
|
||||
#define COLOR_PURPLE 0x0C
|
||||
#define COLOR_BLUE 0x0D
|
||||
#define COLOR_LIGHTBLUE 0x0E
|
||||
#define COLOR_WHITE 0x0F
|
||||
|
||||
/* TGI color defines (default palette) */
|
||||
#define TGI_COLOR_TRANSPARENT COLOR_TRANSPARENT
|
||||
#define TGI_COLOR_BLACK COLOR_BLACK
|
||||
#define TGI_COLOR_RED COLOR_RED
|
||||
#define TGI_COLOR_PINK COLOR_PINK
|
||||
|
||||
@@ -37,12 +37,21 @@
|
||||
#define _STDIO_H
|
||||
|
||||
|
||||
/* NULL pointer */
|
||||
#ifndef _HAVE_NULL
|
||||
#define NULL 0
|
||||
#define _HAVE_NULL
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdarg.h>
|
||||
#include <limits.h>
|
||||
|
||||
/* size_t is needed */
|
||||
#ifndef _HAVE_size_t
|
||||
#define _HAVE_size_t
|
||||
typedef unsigned size_t;
|
||||
#endif
|
||||
|
||||
/* stdio.h should not define va_list, so we use an equivalent type in the
|
||||
compiler namespace instead */
|
||||
typedef unsigned char* __va_list;
|
||||
|
||||
/* Types */
|
||||
typedef struct _FILE FILE;
|
||||
@@ -65,9 +74,24 @@ extern FILE* stderr;
|
||||
#define SEEK_SET 2
|
||||
#define TMP_MAX 256
|
||||
|
||||
#define FILENAME_MAX PATH_MAX
|
||||
#define L_tmpnam FILENAME_MAX
|
||||
/* These defines that are platform dependent */
|
||||
/* FILENAME_MAX is defined as the same value as PATH_MAX in limits.h, but we
|
||||
are not allowed to include limits.h here */
|
||||
#if defined(__APPLE2__)
|
||||
# define FILENAME_MAX (64+1)
|
||||
#elif defined(__ATARI__)
|
||||
# define FILENAME_MAX (63+1)
|
||||
#elif defined(__CBM__)
|
||||
# define FILENAME_MAX (255) /* should be 256+1, see libsrc/common/_cmd.s why it's not */
|
||||
#elif defined(__LUNIX__)
|
||||
# define FILENAME_MAX (80+1)
|
||||
#elif defined(__TELESTRAT__)
|
||||
# define FILENAME_MAX (50+1)
|
||||
#else
|
||||
# define FILENAME_MAX (16+1)
|
||||
#endif
|
||||
|
||||
#define L_tmpnam FILENAME_MAX
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -107,17 +131,17 @@ int __fastcall__ rename (const char* oldname, const char* newname);
|
||||
int snprintf (char* buf, size_t size, const char* format, ...);
|
||||
int sprintf (char* buf, const char* format, ...);
|
||||
int __fastcall__ ungetc (int c, FILE* f);
|
||||
int __fastcall__ vfprintf (FILE* f, const char* format, va_list ap);
|
||||
int __fastcall__ vprintf (const char* format, va_list ap);
|
||||
int __fastcall__ vsnprintf (char* buf, size_t size, const char* format, va_list ap);
|
||||
int __fastcall__ vsprintf (char* buf, const char* format, va_list ap);
|
||||
int __fastcall__ vfprintf (FILE* f, const char* format, __va_list ap);
|
||||
int __fastcall__ vprintf (const char* format, __va_list ap);
|
||||
int __fastcall__ vsnprintf (char* buf, size_t size, const char* format, __va_list ap);
|
||||
int __fastcall__ vsprintf (char* buf, const char* format, __va_list ap);
|
||||
|
||||
int scanf (const char* format, ...);
|
||||
int fscanf (FILE* f, const char* format, ...);
|
||||
int sscanf (const char* s, const char* format, ...);
|
||||
int __fastcall__ vscanf (const char* format, va_list ap);
|
||||
int __fastcall__ vsscanf (const char* s, const char* format, va_list ap);
|
||||
int __fastcall__ vfscanf (FILE* f, const char* format, va_list ap);
|
||||
int __fastcall__ vscanf (const char* format, __va_list ap);
|
||||
int __fastcall__ vsscanf (const char* s, const char* format, __va_list ap);
|
||||
int __fastcall__ vfscanf (FILE* f, const char* format, __va_list ap);
|
||||
|
||||
#if __CC65_STD__ == __CC65_STD_CC65__
|
||||
FILE* __fastcall__ fdopen (int fd, const char* mode); /* Unix */
|
||||
|
||||
@@ -36,11 +36,17 @@
|
||||
#ifndef _STRING_H
|
||||
#define _STRING_H
|
||||
|
||||
/* NULL pointer */
|
||||
#ifndef _HAVE_NULL
|
||||
#define NULL 0
|
||||
#define _HAVE_NULL
|
||||
#endif
|
||||
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
/* size_t is needed */
|
||||
#ifndef _HAVE_size_t
|
||||
#define _HAVE_size_t
|
||||
typedef unsigned size_t;
|
||||
#endif
|
||||
|
||||
char* __fastcall__ strcat (char* dest, const char* src);
|
||||
char* __fastcall__ strchr (const char* s, int c);
|
||||
@@ -90,6 +96,5 @@ const char* __fastcall__ _stroserror (unsigned char errcode);
|
||||
/* Map an operating system error number to an error message. */
|
||||
|
||||
|
||||
|
||||
/* End of string.h */
|
||||
#endif
|
||||
|
||||
@@ -43,6 +43,8 @@
|
||||
# include <atari2600.h>
|
||||
#elif defined(__ATARI5200__)
|
||||
# include <atari5200.h>
|
||||
#elif defined(__ATARI7800__)
|
||||
# include <atari7800.h>
|
||||
#elif defined(__ATMOS__)
|
||||
# include <atmos.h>
|
||||
#elif defined(__CBM__)
|
||||
|
||||
@@ -52,7 +52,6 @@ typedef unsigned size_t;
|
||||
|
||||
typedef unsigned long time_t;
|
||||
typedef unsigned long clock_t;
|
||||
typedef unsigned char clockid_t;
|
||||
|
||||
/* Structure for broken down time */
|
||||
struct tm {
|
||||
@@ -67,22 +66,6 @@ struct tm {
|
||||
int tm_isdst;
|
||||
};
|
||||
|
||||
/* Structure for seconds and nanoseconds */
|
||||
struct timespec {
|
||||
time_t tv_sec;
|
||||
long tv_nsec;
|
||||
};
|
||||
|
||||
/* Timezone representation, default is UTC */
|
||||
extern struct _timezone {
|
||||
char daylight; /* True if daylight savings time active */
|
||||
long timezone; /* Number of seconds behind UTC */
|
||||
char tzname[5]; /* Name of timezone, e.g. CET */
|
||||
char dstname[5]; /* Name when daylight true, e.g. CEST */
|
||||
} _tz;
|
||||
|
||||
|
||||
|
||||
#if defined(__ATARI5200__)
|
||||
# define CLOCKS_PER_SEC 60
|
||||
#elif defined(__ATMOS__)
|
||||
@@ -102,12 +85,13 @@ extern struct _timezone {
|
||||
# define CLOCKS_PER_SEC 135 /* FIXME */
|
||||
#elif defined(__GEOS__)
|
||||
# define CLOCKS_PER_SEC 1
|
||||
#elif defined(__TELESTRAT__)
|
||||
# define CLOCKS_PER_SEC 10
|
||||
#elif defined(__ATARI__) || defined (__LYNX__)
|
||||
/* Read the clock rate at runtime */
|
||||
clock_t _clocks_per_sec (void);
|
||||
# define CLOCKS_PER_SEC _clocks_per_sec()
|
||||
#endif
|
||||
#define CLK_TCK CLOCKS_PER_SEC
|
||||
#define CLOCK_REALTIME 0
|
||||
|
||||
|
||||
@@ -123,12 +107,32 @@ size_t __fastcall__ strftime (char* buf, size_t bufsize, const char* format, con
|
||||
time_t __fastcall__ time (time_t* t);
|
||||
|
||||
|
||||
#if __CC65_STD__ >= __CC65_STD_CC65__
|
||||
|
||||
typedef unsigned char clockid_t;
|
||||
|
||||
/* Structure for seconds and nanoseconds */
|
||||
struct timespec {
|
||||
time_t tv_sec;
|
||||
long tv_nsec;
|
||||
};
|
||||
|
||||
/* Timezone representation, default is UTC */
|
||||
extern struct _timezone {
|
||||
char daylight; /* True if daylight savings time active */
|
||||
long timezone; /* Number of seconds behind UTC */
|
||||
char tzname[5]; /* Name of timezone, e.g. CET */
|
||||
char dstname[5]; /* Name when daylight true, e.g. CEST */
|
||||
} _tz;
|
||||
|
||||
#define CLK_TCK CLOCKS_PER_SEC
|
||||
|
||||
/* POSIX function prototypes */
|
||||
int __fastcall__ clock_getres (clockid_t clock_id, struct timespec *res);
|
||||
int __fastcall__ clock_gettime (clockid_t clock_id, struct timespec *tp);
|
||||
int __fastcall__ clock_settime (clockid_t clock_id, const struct timespec *tp);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* End of time.h */
|
||||
|
||||
@@ -21,6 +21,7 @@ TARGETS = apple2 \
|
||||
atarixl \
|
||||
atari2600 \
|
||||
atari5200 \
|
||||
atari7800 \
|
||||
atmos \
|
||||
creativision \
|
||||
$(CBMS) \
|
||||
@@ -95,7 +96,6 @@ INSTALL = install
|
||||
|
||||
define INSTALL_recipe
|
||||
|
||||
$(if $(PREFIX),,$(error variable "PREFIX" must be set))
|
||||
$(INSTALL) -d $(DESTDIR)$(datadir)/$(dir)
|
||||
$(INSTALL) -m0644 ../$(dir)/*.* $(DESTDIR)$(datadir)/$(dir)
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ setbuf: lda #$00 ; Low byte
|
||||
.assert MLI::OPEN::PATHNAME = MLI::INFO::PATHNAME, error
|
||||
|
||||
; Lower file level to avoid program file
|
||||
; being closed by C libary shutdown code
|
||||
; being closed by C library shutdown code
|
||||
ldx LEVEL
|
||||
stx level
|
||||
beq :+
|
||||
@@ -185,13 +185,13 @@ setbuf: lda #$00 ; Low byte
|
||||
lda #$00 ; '\0'
|
||||
beq :- ; Branch always
|
||||
|
||||
; Call loader stub after C libary shutdown
|
||||
; Call loader stub after C library shutdown
|
||||
: lda #<target
|
||||
ldx #>target
|
||||
sta done+1
|
||||
stx done+2
|
||||
|
||||
; Initiate C libary shutdown
|
||||
; Initiate C library shutdown
|
||||
jmp _exit
|
||||
|
||||
.bss
|
||||
|
||||
69
libsrc/atari7800/clock.s
Normal file
69
libsrc/atari7800/clock.s
Normal file
@@ -0,0 +1,69 @@
|
||||
;
|
||||
; 2022-03-15, Karri Kaksonen
|
||||
;
|
||||
; clock_t clock (void);
|
||||
;
|
||||
|
||||
.export _clock, clock_count
|
||||
.interruptor update_clock, 2 ; (low priority)
|
||||
.constructor init_clock
|
||||
|
||||
.import sreg: zp
|
||||
.import _zonecounter
|
||||
.include "atari7800.inc"
|
||||
|
||||
.macpack generic
|
||||
|
||||
.code
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Read the clock counter.
|
||||
;
|
||||
.proc _clock
|
||||
|
||||
lda #0
|
||||
sta sreg+1 ; Promote 24 bits up to 32 bits
|
||||
lda clock_count+2
|
||||
sta sreg
|
||||
ldx clock_count+1
|
||||
lda clock_count
|
||||
|
||||
rts
|
||||
.endproc
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; This interrupt handler increments a 24-bit counter at every video
|
||||
; vertical-blanking time.
|
||||
; Update the clock only on interrupt while the drawing on screen is on
|
||||
; _zonecounter == 1 (from 1st visible scanline to last visible scanline)
|
||||
;
|
||||
update_clock:
|
||||
lda _zonecounter
|
||||
and #01
|
||||
beq @L1
|
||||
inc clock_count
|
||||
bne @L1
|
||||
inc clock_count+1
|
||||
bne @L1
|
||||
inc clock_count+2
|
||||
@L1: ;clc ; General interrupt was not reset
|
||||
rts
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Set time to zero at startup
|
||||
;
|
||||
.segment "ONCE"
|
||||
init_clock:
|
||||
lda #0
|
||||
sta clock_count+2
|
||||
sta clock_count+1
|
||||
sta clock_count
|
||||
rts
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Store time in 3 bytes
|
||||
;
|
||||
.bss
|
||||
clock_count:
|
||||
.res 3
|
||||
|
||||
34
libsrc/atari7800/clocks_per_sec.s
Normal file
34
libsrc/atari7800/clocks_per_sec.s
Normal file
@@ -0,0 +1,34 @@
|
||||
;
|
||||
; 2022-03-15, Karri Kaksonen
|
||||
;
|
||||
; clock_t _clocks_per_sec (void);
|
||||
;
|
||||
|
||||
.export __clocks_per_sec
|
||||
|
||||
.import sreg: zp
|
||||
.import _paldetected
|
||||
.include "atari7800.inc"
|
||||
|
||||
.macpack generic
|
||||
|
||||
.code
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Return the number of clock ticks in one second.
|
||||
;
|
||||
.proc __clocks_per_sec
|
||||
|
||||
lda #0
|
||||
tax
|
||||
sta sreg ; return 32 bits
|
||||
sta sreg+1
|
||||
lda _paldetected
|
||||
bne pal
|
||||
lda #60 ; NTSC - 60Hz
|
||||
rts
|
||||
pal:
|
||||
lda #50 ; PAL - 50Hz
|
||||
rts
|
||||
.endproc
|
||||
|
||||
27
libsrc/atari7800/clrscr.s
Normal file
27
libsrc/atari7800/clrscr.s
Normal file
@@ -0,0 +1,27 @@
|
||||
|
||||
.include "atari7800.inc"
|
||||
|
||||
.export _clrscr
|
||||
|
||||
.import _screen
|
||||
.import pushax, __bzero
|
||||
.include "extzp.inc"
|
||||
|
||||
.code
|
||||
|
||||
.proc _clrscr
|
||||
|
||||
lda #<_screen
|
||||
ldx #>_screen
|
||||
jsr pushax
|
||||
ldx #>(charsperline * screenrows)
|
||||
lda #<(charsperline * screenrows)
|
||||
jmp __bzero
|
||||
|
||||
.endproc
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
; force the init constructor to be imported
|
||||
|
||||
.import initconio
|
||||
conio_init = initconio
|
||||
226
libsrc/atari7800/conio.s
Normal file
226
libsrc/atari7800/conio.s
Normal file
@@ -0,0 +1,226 @@
|
||||
;
|
||||
; 2022-04-02, Karri Kaksonen
|
||||
;
|
||||
; The Atari 7800 has only 4k of RAM. So for a generic conio implementation
|
||||
; the best alternative is to use indirect tile mapping with a character
|
||||
; frame buffer
|
||||
;
|
||||
|
||||
.constructor initconio
|
||||
.include "atari7800.inc"
|
||||
.include "extzp.inc"
|
||||
.import _conio_font
|
||||
.import _get_tv
|
||||
.export _screen
|
||||
.export _zones
|
||||
.export _dll
|
||||
|
||||
.bss
|
||||
_screen:
|
||||
.res charsperline * screenrows
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; Macros used to generate lists
|
||||
|
||||
.macro DLLentry offset, addr
|
||||
.byte offset
|
||||
.byte >addr
|
||||
.byte <addr
|
||||
.endmacro
|
||||
|
||||
.macro NullHeader offset, zero
|
||||
.byte offset
|
||||
.byte zero
|
||||
.endmacro
|
||||
|
||||
.macro Header addr, palwidth, hpos
|
||||
.byte <addr
|
||||
.byte palwidth
|
||||
.byte >addr
|
||||
.byte hpos
|
||||
.endmacro
|
||||
|
||||
.macro XHeader addr, flags, palwidth, hpos
|
||||
.byte <addr
|
||||
.byte flags
|
||||
.byte >addr
|
||||
.byte palwidth
|
||||
.byte hpos
|
||||
.endmacro
|
||||
|
||||
.macro TextZone row
|
||||
; Text
|
||||
.byte <(_screen + row * charsperline)
|
||||
.byte $60
|
||||
.byte >(_screen + row * charsperline)
|
||||
.byte 12
|
||||
.byte 0
|
||||
; Cursor
|
||||
.byte 254
|
||||
.byte 0
|
||||
.byte >_conio_font
|
||||
.byte 0
|
||||
.endmacro
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; The Atari 7800 has only 4k of RAM. So for a generic conio implementation
|
||||
; the best alternative is to use indirect tile mapping with a character
|
||||
; frame buffer
|
||||
.data
|
||||
|
||||
_zones:
|
||||
zone0: TextZone 0
|
||||
nh: NullHeader 0, 0
|
||||
zone1: TextZone 1
|
||||
NullHeader 0, 0
|
||||
zone2: TextZone 2
|
||||
NullHeader 0, 0
|
||||
zone3: TextZone 3
|
||||
NullHeader 0, 0
|
||||
zone4: TextZone 4
|
||||
NullHeader 0, 0
|
||||
zone5: TextZone 5
|
||||
NullHeader 0, 0
|
||||
zone6: TextZone 6
|
||||
NullHeader 0, 0
|
||||
zone7: TextZone 7
|
||||
NullHeader 0, 0
|
||||
zone8: TextZone 8
|
||||
NullHeader 0, 0
|
||||
zone9: TextZone 9
|
||||
NullHeader 0, 0
|
||||
zone10: TextZone 10
|
||||
NullHeader 0, 0
|
||||
zone11: TextZone 11
|
||||
NullHeader 0, 0
|
||||
zone12: TextZone 12
|
||||
NullHeader 0, 0
|
||||
zone13: TextZone 13
|
||||
NullHeader 0, 0
|
||||
zone14: TextZone 14
|
||||
NullHeader 0, 0
|
||||
zone15: TextZone 15
|
||||
NullHeader 0, 0
|
||||
zone16: TextZone 16
|
||||
NullHeader 0, 0
|
||||
zone17: TextZone 17
|
||||
NullHeader 0, 0
|
||||
zone18: TextZone 18
|
||||
NullHeader 0, 0
|
||||
zone19: TextZone 19
|
||||
NullHeader 0, 0
|
||||
zone20: TextZone 20
|
||||
NullHeader 0, 0
|
||||
zone21: TextZone 21
|
||||
NullHeader 0, 0
|
||||
zone22: TextZone 22
|
||||
NullHeader 0, 0
|
||||
zone23: TextZone 23
|
||||
NullHeader 0, 0
|
||||
zone24: TextZone 24
|
||||
NullHeader 0, 0
|
||||
zone25: TextZone 25
|
||||
NullHeader 0, 0
|
||||
zone26: TextZone 26
|
||||
NullHeader 0, 0
|
||||
zone27: TextZone 27
|
||||
NullHeader 0, 0
|
||||
|
||||
_dll:
|
||||
PALscanlines: ; 25 lines
|
||||
DLLentry 15, nh
|
||||
DLLentry 8, nh
|
||||
|
||||
Topscanlines: ; 9 lines
|
||||
DLLentry 8, nh
|
||||
|
||||
Displaylines:
|
||||
DLLentry $80+7, zone0 ; NMI interrupt from end of prev zone
|
||||
DLLentry 7, zone1
|
||||
DLLentry 7, zone2
|
||||
DLLentry 7, zone3
|
||||
DLLentry 7, zone4
|
||||
DLLentry 7, zone5
|
||||
DLLentry 7, zone6
|
||||
DLLentry 7, zone7
|
||||
DLLentry 7, zone8
|
||||
DLLentry 7, zone9
|
||||
DLLentry 7, zone10
|
||||
DLLentry 7, zone11
|
||||
DLLentry 7, zone12
|
||||
DLLentry 7, zone13
|
||||
DLLentry 7, zone14
|
||||
DLLentry 7, zone15
|
||||
DLLentry 7, zone16
|
||||
DLLentry 7, zone17
|
||||
DLLentry 7, zone18
|
||||
DLLentry 7, zone19
|
||||
DLLentry 7, zone20
|
||||
DLLentry 7, zone21
|
||||
DLLentry 7, zone22
|
||||
DLLentry 7, zone23
|
||||
DLLentry 7, zone24
|
||||
DLLentry 7, zone25
|
||||
DLLentry 7, zone26
|
||||
DLLentry 7, zone27
|
||||
|
||||
Bottomscanlines:
|
||||
DLLentry $80+15, nh ; NMI interrupt at end of display
|
||||
DLLentry 9, nh
|
||||
DLLentry 15, nh
|
||||
DLLentry 8, nh
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Set up the screen to 320a mode
|
||||
;
|
||||
.segment "ONCE"
|
||||
|
||||
CTRL_MODE160 .set 0
|
||||
CTRL_MODEAC .set 3
|
||||
CTRL_KANGOFF .set 0
|
||||
CTRL_BCBLACK .set 0
|
||||
CTRL_CHAR1B .set 0
|
||||
CTRL_CHAR2B .set $10
|
||||
CTRL_DMAON .set $40
|
||||
CTRL_CKOFF .set 0
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Initialize the conio display lists and zones
|
||||
;
|
||||
.proc initconio
|
||||
|
||||
jsr _get_tv
|
||||
bne pal
|
||||
lda #<Topscanlines
|
||||
sta DPPL
|
||||
lda #>Topscanlines
|
||||
sta DPPH
|
||||
jmp vblankon
|
||||
pal: lda #<PALscanlines
|
||||
sta DPPL
|
||||
lda #>PALscanlines
|
||||
sta DPPH
|
||||
vblankon:
|
||||
lda MSTAT
|
||||
bmi vblankon
|
||||
vblankoff:
|
||||
lda MSTAT
|
||||
bpl vblankoff
|
||||
lda #>_conio_font
|
||||
sta CHBASE
|
||||
lda #(CTRL_MODE160 | CTRL_KANGOFF | CTRL_BCBLACK | CTRL_CHAR2B | CTRL_DMAON | CTRL_CKOFF)
|
||||
sta CTRL
|
||||
lda #$00 ; Black background
|
||||
sta BKGRND
|
||||
sta CURS_X
|
||||
sta CURS_Y
|
||||
lda #$33 ; Red
|
||||
sta P0C1
|
||||
lda #$c8 ; Green
|
||||
sta P0C2
|
||||
lda #$0f ; White
|
||||
sta P0C3
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
278
libsrc/atari7800/conio_font.s
Normal file
278
libsrc/atari7800/conio_font.s
Normal file
@@ -0,0 +1,278 @@
|
||||
; The internal font structure for Atari7800 needs a full set of 128
|
||||
; characters. Each character is 16 x 8 bits.
|
||||
; The font consists of 8 rows of data:
|
||||
; row7
|
||||
; row6
|
||||
; row5
|
||||
; row4
|
||||
; row3
|
||||
; row2
|
||||
; row1
|
||||
; row0
|
||||
; Each row is 256 bytes long
|
||||
; As we have 2 bits per pixel we need 2 bytes to represent
|
||||
; one character. So we can fit 128 characters in this font
|
||||
; When you later use the font you must address the characters as
|
||||
; 0, 2, 4, 6, ... 254
|
||||
; Odd indices cannot be used.
|
||||
|
||||
.export _conio_font
|
||||
.rodata
|
||||
.align 256
|
||||
_conio_font:
|
||||
.byte $0, $0, $41, $41, $0, $0, $14, $0
|
||||
.byte $0, $0, $0, $0, $1, $40, $0, $0
|
||||
.byte $0, $0, $0, $0, $0, $0, $0, $0
|
||||
.byte $0, $0, $0, $0, $0, $0, $0, $0
|
||||
.byte $0, $0, $0, $0, $0, $0, $0, $0
|
||||
.byte $0, $0, $0, $0, $0, $0, $0, $0
|
||||
.byte $0, $0, $0, $0, $0, $0, $0, $0
|
||||
.byte $0, $0, $0, $0, $0, $0, $0, $0
|
||||
.byte $0, $0, $0, $0, $0, $0, $0, $0
|
||||
.byte $0, $0, $0, $0, $0, $0, $0, $0
|
||||
.byte $0, $0, $0, $0, $0, $0, $82, $82
|
||||
.byte $0, $0, $28, $0, $0, $0, $0, $0
|
||||
.byte $2, $80, $0, $0, $0, $0, $0, $0
|
||||
.byte $0, $0, $0, $0, $0, $0, $0, $0
|
||||
.byte $0, $0, $0, $0, $0, $0, $0, $0
|
||||
.byte $0, $0, $0, $0, $0, $0, $0, $0
|
||||
.byte $0, $0, $0, $0, $0, $0, $0, $0
|
||||
.byte $0, $0, $0, $0, $0, $0, $0, $0
|
||||
.byte $0, $0, $0, $0, $0, $0, $0, $0
|
||||
.byte $0, $0, $0, $0, $0, $0, $0, $0
|
||||
.byte $0, $0, $0, $0, $0, $0, $0, $0
|
||||
.byte $0, $0, $c3, $c3, $0, $0, $3c, $0
|
||||
.byte $0, $0, $0, $0, $3, $c0, $0, $0
|
||||
.byte $0, $0, $0, $0, $0, $0, $0, $0
|
||||
.byte $0, $0, $0, $0, $0, $0, $0, $0
|
||||
.byte $0, $0, $0, $0, $0, $0, $0, $0
|
||||
.byte $0, $0, $0, $0, $0, $0, $0, $0
|
||||
.byte $0, $0, $0, $0, $0, $0, $0, $0
|
||||
.byte $0, $0, $0, $0, $0, $0, $0, $0
|
||||
.byte $0, $0, $0, $0, $0, $0, $0, $0
|
||||
.byte $0, $0, $0, $0, $0, $0, $0, $0
|
||||
.byte $0, $0, $0, $0, $0, $0, $ff, $ff
|
||||
.byte $0, $0, $11, $44, $5, $0, $5, $0
|
||||
.byte $0, $0, $5, $0, $1, $40, $15, $50
|
||||
.byte $55, $50, $55, $50, $15, $40, $1, $54
|
||||
.byte $15, $40, $15, $40, $5, $0, $15, $40
|
||||
.byte $15, $0, $50, $50, $55, $50, $5, $50
|
||||
.byte $55, $40, $55, $54, $55, $0, $5, $54
|
||||
.byte $50, $50, $15, $40, $15, $40, $54, $14
|
||||
.byte $55, $54, $50, $14, $50, $14, $5, $40
|
||||
.byte $55, $0, $1, $50, $54, $14, $15, $40
|
||||
.byte $15, $40, $55, $50, $5, $0, $50, $14
|
||||
.byte $50, $14, $15, $40, $55, $54, $22, $88
|
||||
.byte $a, $0, $a, $0, $0, $0, $a, $0
|
||||
.byte $2, $80, $2a, $a0, $aa, $a0, $aa, $a0
|
||||
.byte $2a, $80, $2, $a8, $2a, $80, $2a, $80
|
||||
.byte $a, $0, $2a, $80, $2a, $0, $a0, $a0
|
||||
.byte $aa, $a0, $a, $a0, $aa, $80, $aa, $a8
|
||||
.byte $aa, $0, $a, $a8, $a0, $a0, $2a, $80
|
||||
.byte $2a, $80, $a8, $28, $aa, $a8, $a0, $28
|
||||
.byte $a0, $28, $a, $80, $aa, $0, $2, $a0
|
||||
.byte $a8, $28, $2a, $80, $2a, $80, $aa, $a0
|
||||
.byte $a, $0, $a0, $28, $a0, $28, $2a, $80
|
||||
.byte $aa, $a8, $33, $cc, $f, $0, $f, $0
|
||||
.byte $0, $0, $f, $0, $3, $c0, $3f, $f0
|
||||
.byte $ff, $f0, $ff, $f0, $3f, $c0, $3, $fc
|
||||
.byte $3f, $c0, $3f, $c0, $f, $0, $3f, $c0
|
||||
.byte $3f, $0, $f0, $f0, $ff, $f0, $f, $f0
|
||||
.byte $ff, $c0, $ff, $fc, $ff, $0, $f, $fc
|
||||
.byte $f0, $f0, $3f, $c0, $3f, $c0, $fc, $3c
|
||||
.byte $ff, $fc, $f0, $3c, $f0, $3c, $f, $c0
|
||||
.byte $ff, $0, $3, $f0, $fc, $3c, $3f, $c0
|
||||
.byte $3f, $c0, $ff, $f0, $f, $0, $f0, $3c
|
||||
.byte $f0, $3c, $3f, $c0, $ff, $fc, $0, $0
|
||||
.byte $0, $0, $5, $50, $0, $0, $5, $0
|
||||
.byte $0, $0, $5, $0, $1, $40, $54, $14
|
||||
.byte $5, $0, $50, $50, $50, $50, $0, $50
|
||||
.byte $50, $50, $50, $50, $5, $0, $50, $50
|
||||
.byte $1, $40, $50, $50, $14, $14, $14, $14
|
||||
.byte $14, $50, $14, $4, $14, $0, $14, $14
|
||||
.byte $50, $50, $5, $0, $50, $50, $14, $14
|
||||
.byte $14, $14, $50, $14, $50, $14, $14, $50
|
||||
.byte $14, $0, $15, $40, $14, $14, $50, $50
|
||||
.byte $5, $0, $50, $50, $15, $40, $54, $54
|
||||
.byte $14, $50, $5, $0, $14, $14, $a, $a0
|
||||
.byte $0, $0, $a, $0, $0, $0, $a, $0
|
||||
.byte $2, $80, $a8, $28, $a, $0, $a0, $a0
|
||||
.byte $a0, $a0, $0, $a0, $a0, $a0, $a0, $a0
|
||||
.byte $a, $0, $a0, $a0, $2, $80, $a0, $a0
|
||||
.byte $28, $28, $28, $28, $28, $a0, $28, $8
|
||||
.byte $28, $0, $28, $28, $a0, $a0, $a, $0
|
||||
.byte $a0, $a0, $28, $28, $28, $28, $a0, $28
|
||||
.byte $a0, $28, $28, $a0, $28, $0, $2a, $80
|
||||
.byte $28, $28, $a0, $a0, $a, $0, $a0, $a0
|
||||
.byte $2a, $80, $a8, $a8, $28, $a0, $a, $0
|
||||
.byte $28, $28, $f, $f0, $0, $0, $f, $0
|
||||
.byte $0, $0, $f, $0, $3, $c0, $fc, $3c
|
||||
.byte $f, $0, $f0, $f0, $f0, $f0, $0, $f0
|
||||
.byte $f0, $f0, $f0, $f0, $f, $0, $f0, $f0
|
||||
.byte $3, $c0, $f0, $f0, $3c, $3c, $3c, $3c
|
||||
.byte $3c, $f0, $3c, $c, $3c, $0, $3c, $3c
|
||||
.byte $f0, $f0, $f, $0, $f0, $f0, $3c, $3c
|
||||
.byte $3c, $3c, $f0, $3c, $f0, $3c, $3c, $f0
|
||||
.byte $3c, $0, $3f, $c0, $3c, $3c, $f0, $f0
|
||||
.byte $f, $0, $f0, $f0, $3f, $c0, $fc, $fc
|
||||
.byte $3c, $f0, $f, $0, $3c, $3c, $0, $0
|
||||
.byte $0, $0, $54, $15, $5, $0, $0, $0
|
||||
.byte $55, $55, $0, $0, $1, $40, $55, $14
|
||||
.byte $5, $0, $14, $0, $0, $50, $55, $54
|
||||
.byte $0, $50, $50, $50, $5, $0, $50, $50
|
||||
.byte $0, $50, $55, $50, $14, $14, $50, $0
|
||||
.byte $14, $14, $14, $40, $14, $40, $50, $54
|
||||
.byte $50, $50, $5, $0, $50, $50, $14, $50
|
||||
.byte $14, $4, $51, $14, $50, $54, $50, $14
|
||||
.byte $14, $0, $51, $50, $14, $50, $1, $50
|
||||
.byte $5, $0, $50, $50, $50, $50, $55, $54
|
||||
.byte $5, $40, $5, $0, $5, $4, $a8, $2a
|
||||
.byte $a, $0, $0, $0, $aa, $aa, $0, $0
|
||||
.byte $2, $80, $aa, $28, $a, $0, $28, $0
|
||||
.byte $0, $a0, $aa, $a8, $0, $a0, $a0, $a0
|
||||
.byte $a, $0, $a0, $a0, $0, $a0, $aa, $a0
|
||||
.byte $28, $28, $a0, $0, $28, $28, $28, $80
|
||||
.byte $28, $80, $a0, $a8, $a0, $a0, $a, $0
|
||||
.byte $a0, $a0, $28, $a0, $28, $8, $a2, $28
|
||||
.byte $a0, $a8, $a0, $28, $28, $0, $a2, $a0
|
||||
.byte $28, $a0, $2, $a0, $a, $0, $a0, $a0
|
||||
.byte $a0, $a0, $aa, $a8, $a, $80, $a, $0
|
||||
.byte $a, $8, $fc, $3f, $f, $0, $0, $0
|
||||
.byte $ff, $ff, $0, $0, $3, $c0, $ff, $3c
|
||||
.byte $f, $0, $3c, $0, $0, $f0, $ff, $fc
|
||||
.byte $0, $f0, $f0, $f0, $f, $0, $f0, $f0
|
||||
.byte $0, $f0, $ff, $f0, $3c, $3c, $f0, $0
|
||||
.byte $3c, $3c, $3c, $c0, $3c, $c0, $f0, $fc
|
||||
.byte $f0, $f0, $f, $0, $f0, $f0, $3c, $f0
|
||||
.byte $3c, $c, $f3, $3c, $f0, $fc, $f0, $3c
|
||||
.byte $3c, $0, $f3, $f0, $3c, $f0, $3, $f0
|
||||
.byte $f, $0, $f0, $f0, $f0, $f0, $ff, $fc
|
||||
.byte $f, $c0, $f, $0, $f, $c, $0, $0
|
||||
.byte $0, $0, $54, $15, $1, $40, $0, $0
|
||||
.byte $55, $55, $0, $0, $1, $40, $51, $54
|
||||
.byte $5, $0, $5, $40, $5, $40, $50, $50
|
||||
.byte $0, $50, $55, $40, $1, $40, $15, $40
|
||||
.byte $15, $50, $50, $50, $15, $50, $50, $0
|
||||
.byte $14, $14, $15, $40, $15, $40, $50, $0
|
||||
.byte $55, $50, $5, $0, $0, $50, $15, $40
|
||||
.byte $14, $0, $55, $54, $51, $54, $50, $14
|
||||
.byte $15, $50, $50, $50, $15, $50, $15, $0
|
||||
.byte $5, $0, $50, $50, $50, $50, $51, $14
|
||||
.byte $5, $40, $15, $40, $1, $40, $a8, $2a
|
||||
.byte $2, $80, $0, $0, $aa, $aa, $0, $0
|
||||
.byte $2, $80, $a2, $a8, $a, $0, $a, $80
|
||||
.byte $a, $80, $a0, $a0, $0, $a0, $aa, $80
|
||||
.byte $2, $80, $2a, $80, $2a, $a0, $a0, $a0
|
||||
.byte $2a, $a0, $a0, $0, $28, $28, $2a, $80
|
||||
.byte $2a, $80, $a0, $0, $aa, $a0, $a, $0
|
||||
.byte $0, $a0, $2a, $80, $28, $0, $aa, $a8
|
||||
.byte $a2, $a8, $a0, $28, $2a, $a0, $a0, $a0
|
||||
.byte $2a, $a0, $2a, $0, $a, $0, $a0, $a0
|
||||
.byte $a0, $a0, $a2, $28, $a, $80, $2a, $80
|
||||
.byte $2, $80, $fc, $3f, $3, $c0, $0, $0
|
||||
.byte $ff, $ff, $0, $0, $3, $c0, $f3, $fc
|
||||
.byte $f, $0, $f, $c0, $f, $c0, $f0, $f0
|
||||
.byte $0, $f0, $ff, $c0, $3, $c0, $3f, $c0
|
||||
.byte $3f, $f0, $f0, $f0, $3f, $f0, $f0, $0
|
||||
.byte $3c, $3c, $3f, $c0, $3f, $c0, $f0, $0
|
||||
.byte $ff, $f0, $f, $0, $0, $f0, $3f, $c0
|
||||
.byte $3c, $0, $ff, $fc, $f3, $fc, $f0, $3c
|
||||
.byte $3f, $f0, $f0, $f0, $3f, $f0, $3f, $0
|
||||
.byte $f, $0, $f0, $f0, $f0, $f0, $f3, $3c
|
||||
.byte $f, $c0, $3f, $c0, $3, $c0, $0, $0
|
||||
.byte $0, $0, $5, $50, $0, $50, $0, $0
|
||||
.byte $0, $0, $0, $0, $1, $40, $50, $54
|
||||
.byte $5, $0, $0, $50, $0, $50, $14, $50
|
||||
.byte $55, $40, $50, $0, $0, $50, $50, $50
|
||||
.byte $50, $50, $50, $50, $14, $14, $50, $0
|
||||
.byte $14, $14, $14, $40, $14, $40, $50, $0
|
||||
.byte $50, $50, $5, $0, $0, $50, $14, $50
|
||||
.byte $14, $0, $55, $54, $55, $14, $50, $14
|
||||
.byte $14, $14, $50, $50, $14, $14, $54, $0
|
||||
.byte $5, $0, $50, $50, $50, $50, $50, $14
|
||||
.byte $14, $50, $50, $50, $40, $50, $a, $a0
|
||||
.byte $0, $a0, $0, $0, $0, $0, $0, $0
|
||||
.byte $2, $80, $a0, $a8, $a, $0, $0, $a0
|
||||
.byte $0, $a0, $28, $a0, $aa, $80, $a0, $0
|
||||
.byte $0, $a0, $a0, $a0, $a0, $a0, $a0, $a0
|
||||
.byte $28, $28, $a0, $0, $28, $28, $28, $80
|
||||
.byte $28, $80, $a0, $0, $a0, $a0, $a, $0
|
||||
.byte $0, $a0, $28, $a0, $28, $0, $aa, $a8
|
||||
.byte $aa, $28, $a0, $28, $28, $28, $a0, $a0
|
||||
.byte $28, $28, $a8, $0, $a, $0, $a0, $a0
|
||||
.byte $a0, $a0, $a0, $28, $28, $a0, $a0, $a0
|
||||
.byte $80, $a0, $f, $f0, $0, $f0, $0, $0
|
||||
.byte $0, $0, $0, $0, $3, $c0, $f0, $fc
|
||||
.byte $f, $0, $0, $f0, $0, $f0, $3c, $f0
|
||||
.byte $ff, $c0, $f0, $0, $0, $f0, $f0, $f0
|
||||
.byte $f0, $f0, $f0, $f0, $3c, $3c, $f0, $0
|
||||
.byte $3c, $3c, $3c, $c0, $3c, $c0, $f0, $0
|
||||
.byte $f0, $f0, $f, $0, $0, $f0, $3c, $f0
|
||||
.byte $3c, $0, $ff, $fc, $ff, $3c, $f0, $3c
|
||||
.byte $3c, $3c, $f0, $f0, $3c, $3c, $fc, $0
|
||||
.byte $f, $0, $f0, $f0, $f0, $f0, $f0, $3c
|
||||
.byte $3c, $f0, $f0, $f0, $c0, $f0, $0, $0
|
||||
.byte $0, $0, $11, $44, $50, $50, $0, $0
|
||||
.byte $0, $0, $0, $0, $1, $40, $50, $14
|
||||
.byte $15, $0, $50, $50, $50, $50, $5, $50
|
||||
.byte $50, $0, $14, $0, $50, $50, $50, $50
|
||||
.byte $50, $50, $15, $40, $14, $14, $14, $14
|
||||
.byte $14, $50, $14, $4, $14, $4, $14, $14
|
||||
.byte $50, $50, $5, $0, $0, $50, $14, $14
|
||||
.byte $14, $0, $54, $54, $54, $14, $14, $50
|
||||
.byte $14, $14, $50, $50, $14, $14, $50, $50
|
||||
.byte $45, $10, $50, $50, $50, $50, $50, $14
|
||||
.byte $50, $14, $50, $50, $50, $14, $22, $88
|
||||
.byte $a0, $a0, $0, $0, $0, $0, $0, $0
|
||||
.byte $2, $80, $a0, $28, $2a, $0, $a0, $a0
|
||||
.byte $a0, $a0, $a, $a0, $a0, $0, $28, $0
|
||||
.byte $a0, $a0, $a0, $a0, $a0, $a0, $2a, $80
|
||||
.byte $28, $28, $28, $28, $28, $a0, $28, $8
|
||||
.byte $28, $8, $28, $28, $a0, $a0, $a, $0
|
||||
.byte $0, $a0, $28, $28, $28, $0, $a8, $a8
|
||||
.byte $a8, $28, $28, $a0, $28, $28, $a0, $a0
|
||||
.byte $28, $28, $a0, $a0, $8a, $20, $a0, $a0
|
||||
.byte $a0, $a0, $a0, $28, $a0, $28, $a0, $a0
|
||||
.byte $a0, $28, $33, $cc, $f0, $f0, $0, $0
|
||||
.byte $0, $0, $0, $0, $3, $c0, $f0, $3c
|
||||
.byte $3f, $0, $f0, $f0, $f0, $f0, $f, $f0
|
||||
.byte $f0, $0, $3c, $0, $f0, $f0, $f0, $f0
|
||||
.byte $f0, $f0, $3f, $c0, $3c, $3c, $3c, $3c
|
||||
.byte $3c, $f0, $3c, $c, $3c, $c, $3c, $3c
|
||||
.byte $f0, $f0, $f, $0, $0, $f0, $3c, $3c
|
||||
.byte $3c, $0, $fc, $fc, $fc, $3c, $3c, $f0
|
||||
.byte $3c, $3c, $f0, $f0, $3c, $3c, $f0, $f0
|
||||
.byte $cf, $30, $f0, $f0, $f0, $f0, $f0, $3c
|
||||
.byte $f0, $3c, $f0, $f0, $f0, $3c, $0, $0
|
||||
.byte $0, $0, $41, $41, $15, $40, $0, $0
|
||||
.byte $0, $0, $0, $0, $1, $40, $15, $50
|
||||
.byte $5, $0, $15, $40, $15, $40, $1, $50
|
||||
.byte $55, $50, $5, $40, $55, $50, $15, $40
|
||||
.byte $15, $40, $5, $0, $55, $50, $5, $50
|
||||
.byte $55, $40, $55, $54, $55, $54, $5, $50
|
||||
.byte $50, $50, $15, $40, $1, $54, $54, $14
|
||||
.byte $55, $0, $50, $14, $50, $14, $5, $40
|
||||
.byte $55, $50, $15, $40, $55, $50, $15, $40
|
||||
.byte $55, $50, $50, $50, $50, $50, $50, $14
|
||||
.byte $50, $14, $50, $50, $55, $54, $82, $82
|
||||
.byte $2a, $80, $0, $0, $0, $0, $0, $0
|
||||
.byte $2, $80, $2a, $a0, $a, $0, $2a, $80
|
||||
.byte $2a, $80, $2, $a0, $aa, $a0, $a, $80
|
||||
.byte $aa, $a0, $2a, $80, $2a, $80, $a, $0
|
||||
.byte $aa, $a0, $a, $a0, $aa, $80, $aa, $a8
|
||||
.byte $aa, $a8, $a, $a0, $a0, $a0, $2a, $80
|
||||
.byte $2, $a8, $a8, $28, $aa, $0, $a0, $28
|
||||
.byte $a0, $28, $a, $80, $aa, $a0, $2a, $80
|
||||
.byte $aa, $a0, $2a, $80, $aa, $a0, $a0, $a0
|
||||
.byte $a0, $a0, $a0, $28, $a0, $28, $a0, $a0
|
||||
.byte $aa, $a8, $c3, $c3, $3f, $c0, $0, $0
|
||||
.byte $0, $0, $0, $0, $3, $c0, $3f, $f0
|
||||
.byte $f, $0, $3f, $c0, $3f, $c0, $3, $f0
|
||||
.byte $ff, $f0, $f, $c0, $ff, $f0, $3f, $c0
|
||||
.byte $3f, $c0, $f, $0, $ff, $f0, $f, $f0
|
||||
.byte $ff, $c0, $ff, $fc, $ff, $fc, $f, $f0
|
||||
.byte $f0, $f0, $3f, $c0, $3, $fc, $fc, $3c
|
||||
.byte $ff, $0, $f0, $3c, $f0, $3c, $f, $c0
|
||||
.byte $ff, $f0, $3f, $c0, $ff, $f0, $3f, $c0
|
||||
.byte $ff, $f0, $f0, $f0, $f0, $f0, $f0, $3c
|
||||
.byte $f0, $3c, $f0, $f0, $ff, $fc, $0, $0
|
||||
137
libsrc/atari7800/cputc.s
Normal file
137
libsrc/atari7800/cputc.s
Normal file
@@ -0,0 +1,137 @@
|
||||
;
|
||||
; Mark Keates, Christian Groessler, Piotr Fusik, Karri Kaksonen
|
||||
;
|
||||
; void cputcxy (unsigned char x, unsigned char y, char c);
|
||||
; void cputc (char c);
|
||||
;
|
||||
|
||||
.export _cputc
|
||||
.import gotox, gotoy, pusha0
|
||||
.import pushax
|
||||
.import _screen
|
||||
.import txtcolor
|
||||
|
||||
.include "atari7800.inc"
|
||||
.include "extzp.inc"
|
||||
|
||||
.code
|
||||
|
||||
;---------------------------------------------------------------------------
|
||||
; 8x16 routine
|
||||
|
||||
umula0:
|
||||
ldy #8 ; Number of bits
|
||||
lda #0
|
||||
lsr ptr7800 ; Get first bit into carry
|
||||
@L0: bcc @L1
|
||||
|
||||
clc
|
||||
adc ptrtmp
|
||||
tax
|
||||
lda ptrtmp+1 ; hi byte of left op
|
||||
clc
|
||||
adc ptr7800+1
|
||||
sta ptr7800+1
|
||||
txa
|
||||
|
||||
@L1: ror ptr7800+1
|
||||
ror a
|
||||
ror ptr7800
|
||||
dey
|
||||
bne @L0
|
||||
tax
|
||||
lda ptr7800 ; Load the result
|
||||
rts
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Put a character on screen
|
||||
;
|
||||
; The code will handle newlines that wrap to start of screen
|
||||
;
|
||||
.proc _cputc
|
||||
|
||||
cmp #$0A ; LF
|
||||
bne @L4
|
||||
@L1: lda CURS_Y ; newline
|
||||
cmp #(screenrows-1)
|
||||
bne @L2
|
||||
lda #0
|
||||
beq @L3
|
||||
@L2: clc
|
||||
adc #1
|
||||
@L3: jsr gotoy
|
||||
lda #0
|
||||
jmp gotox
|
||||
|
||||
@L4:
|
||||
cmp #$20 ; ' '
|
||||
bne @L5
|
||||
lda #$00
|
||||
jmp @L10
|
||||
@L5:
|
||||
cmp #$3F ; '?'
|
||||
bne @L6
|
||||
lda #$02
|
||||
jmp @L9
|
||||
@L6:
|
||||
cmp #$7C ; '|'
|
||||
bne @L7
|
||||
lda #$06
|
||||
jmp @L9
|
||||
@L7:
|
||||
cmp #$41 ; >= 'A'
|
||||
bcc @L8
|
||||
and #$5F ; make upper case
|
||||
sec
|
||||
sbc #($41 - 17)
|
||||
jmp @L9
|
||||
@L8:
|
||||
sec ; >= '*'
|
||||
sbc #($2A - 1)
|
||||
@L9:
|
||||
clc
|
||||
adc txtcolor
|
||||
@L10:
|
||||
asl
|
||||
pha
|
||||
|
||||
lda #0
|
||||
sta ptr7800+1
|
||||
sta ptrtmp+1
|
||||
lda CURS_Y ; Find position on screen buffer
|
||||
sta ptr7800
|
||||
lda #charsperline
|
||||
sta ptrtmp
|
||||
jsr umula0
|
||||
clc
|
||||
adc CURS_X
|
||||
bcc @L11
|
||||
inx
|
||||
@L11: clc
|
||||
adc #<(_screen)
|
||||
sta ptr7800
|
||||
bcc @L12
|
||||
inx
|
||||
@L12: txa
|
||||
clc
|
||||
adc #>(_screen)
|
||||
sta ptr7800+1
|
||||
|
||||
pla ; Print character on screen
|
||||
ldy #0
|
||||
sta (ptr7800),y
|
||||
|
||||
lda CURS_X ; Increment cursor
|
||||
cmp #(charsperline-1)
|
||||
beq @L1
|
||||
clc
|
||||
adc #1
|
||||
jmp gotox
|
||||
|
||||
.endproc
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
; force the init constructor to be imported
|
||||
|
||||
.import initconio
|
||||
conio_init = initconio
|
||||
71
libsrc/atari7800/crt0.s
Normal file
71
libsrc/atari7800/crt0.s
Normal file
@@ -0,0 +1,71 @@
|
||||
.export _zonecounter
|
||||
.export __STARTUP__ : absolute = 1
|
||||
.export _exit
|
||||
.import __ROM_START__
|
||||
.import __RAM3_START__, __RAM3_SIZE__
|
||||
.import initlib, donelib
|
||||
.import zerobss, copydata
|
||||
.import IRQStub
|
||||
.import push0, _main
|
||||
.include "atari7800.inc"
|
||||
.include "zeropage.inc"
|
||||
|
||||
INPTCTRL = $01
|
||||
|
||||
.segment "STARTUP"
|
||||
start:
|
||||
; Startup sequence recommended by Atari.
|
||||
; See the 7800 standards document.
|
||||
sei ; Initialize 6502
|
||||
cld
|
||||
lda #$07 ; Lock machine in 7800 mode
|
||||
sta INPTCTRL
|
||||
lda #$7f ; DMA off
|
||||
sta CTRL
|
||||
ldx #0 ; OFFSET must always be 0
|
||||
stx OFFSET
|
||||
stx INPTCTRL ; Make sure joysticks don't freeze
|
||||
dex ; Stack pointer = $ff
|
||||
txs
|
||||
|
||||
; Set up parameter stack
|
||||
lda #<(__RAM3_START__ + __RAM3_SIZE__)
|
||||
sta sp
|
||||
lda #>(__RAM3_START__ + __RAM3_SIZE__)
|
||||
sta sp+1
|
||||
|
||||
jsr copydata
|
||||
jsr zerobss
|
||||
jsr initlib
|
||||
|
||||
; Call main program (pass empty command line)
|
||||
jsr push0 ; argc
|
||||
jsr push0 ; argv
|
||||
ldy #4 ; Argument size
|
||||
jsr _main
|
||||
|
||||
_exit:
|
||||
jsr donelib
|
||||
jmp start
|
||||
|
||||
NMIHandler:
|
||||
inc _zonecounter
|
||||
jmp IRQStub
|
||||
|
||||
IRQHandler:
|
||||
rti
|
||||
|
||||
.segment "DATA"
|
||||
_zonecounter:
|
||||
.byte 0
|
||||
|
||||
.segment "ENCRYPTION"
|
||||
.res 126, $ff ; Reserved for encryption
|
||||
Lfff8: .byte $ff ; Region verification (always $ff)
|
||||
Lfff9: .byte $f7 ; Use last 4096 bytes only for encryption
|
||||
;;;Lfff9: .byte <(((__ROM_START__/4096)<<4) | 7)
|
||||
|
||||
.segment "VECTORS"
|
||||
.word NMIHandler
|
||||
.word start
|
||||
.word IRQHandler
|
||||
5
libsrc/atari7800/ctype.s
Normal file
5
libsrc/atari7800/ctype.s
Normal file
@@ -0,0 +1,5 @@
|
||||
; Character specification table.
|
||||
;
|
||||
; uses the "common" definition
|
||||
|
||||
.include "ctype_common.inc"
|
||||
46
libsrc/atari7800/exehdr.s
Normal file
46
libsrc/atari7800/exehdr.s
Normal file
@@ -0,0 +1,46 @@
|
||||
;
|
||||
; Karri Kaksonen, 2022
|
||||
;
|
||||
; This header contains data for emulators
|
||||
;
|
||||
.export __EXEHDR__: absolute = 1
|
||||
.import __CARTSIZE__
|
||||
; ------------------------------------------------------------------------
|
||||
; EXE header
|
||||
.segment "EXEHDR"
|
||||
.byte 3 ; version
|
||||
.byte 'A','T','A','R','I','7','8','0','0',' ',' ',' ',' ',' ',' ',' '
|
||||
.byte 'G','a','m','e',' ','n','a','m','e',0,0,0,0,0,0,0
|
||||
.byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
.byte 0,0,>__CARTSIZE__,0 ; Set the cart size in the cfg file
|
||||
; bit 0 - pokey at 4000
|
||||
; bit 1 - supergame bank switched
|
||||
; bit 2 - supergame ram at $4000
|
||||
; bit 3 - rom at $4000
|
||||
; bit 4 - bank 6 at $4000
|
||||
; bit 5 - supergame banked ram
|
||||
; bit 6 - pokey at $450
|
||||
; bit 7 - mirror ram at $4000
|
||||
; bit 8 - activision banking
|
||||
; bit 9 - absolute banking
|
||||
; bit 10 - pokey at $440
|
||||
; bit 11 - ym2151 at $461/462
|
||||
; bit 12 - souper
|
||||
; bit 13-15 - Special
|
||||
; 0 = Normal cart
|
||||
.byte 0,0 ; 0 = Normal cart
|
||||
.byte 1 ; 1 = Joystick, 2 = lightgun
|
||||
.byte 0 ; No joystick 2
|
||||
.byte 0 ; bit0 = 0:NTSC,1:PAL bit1 = 0:component,1:composite
|
||||
.byte 0 ; Save data peripheral - 1 byte (version 2)
|
||||
; 0 = None / unknown (default)
|
||||
; 1 = High Score Cart (HSC)
|
||||
; 2 = SaveKey
|
||||
|
||||
.byte 0 ; 63 Expansion module
|
||||
; 0 = No expansion module (default on all currently released games)
|
||||
; 1 = Expansion module required
|
||||
.byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
.byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
.byte 0,0,0,0,0,0,0,0
|
||||
.byte 'A','C','T','U','A','L',' ','C','A','R','T',' ','D','A','T','A',' ','S','T','A','R','T','S',' ','H','E','R','E'
|
||||
28
libsrc/atari7800/extra/mono.s
Normal file
28
libsrc/atari7800/extra/mono.s
Normal file
@@ -0,0 +1,28 @@
|
||||
;
|
||||
; Groepaz/Hitmen, 19.10.2015
|
||||
;
|
||||
; import/overload stubs for the monochrome conio implementation
|
||||
;
|
||||
|
||||
; mono_conio.s
|
||||
.import _mono_screen
|
||||
.export _screen := _mono_screen
|
||||
|
||||
; mono_clrscr.s
|
||||
.import _mono_clrscr
|
||||
.export _clrscr := _mono_clrscr
|
||||
|
||||
; mono_cputc.s
|
||||
.import _mono_cputc
|
||||
.export _cputc := _mono_cputc
|
||||
|
||||
; mono_font.s
|
||||
.import _mono_font
|
||||
.export _font := _mono_font
|
||||
|
||||
; mono_setcursor.s
|
||||
.import mono_gotoxy
|
||||
.export gotoxy := mono_gotoxy
|
||||
.import _mono_gotoxy
|
||||
.export _gotoxy := _mono_gotoxy
|
||||
|
||||
15
libsrc/atari7800/extzp.inc
Normal file
15
libsrc/atari7800/extzp.inc
Normal file
@@ -0,0 +1,15 @@
|
||||
;
|
||||
; extzp.inc for the Atari 7800
|
||||
;
|
||||
; Karri Kaksonen, 2022-04-05
|
||||
;
|
||||
; Assembler include file that imports the runtime zero page locations used
|
||||
; by the atari7800 runtime, ready for usage in asm code.
|
||||
;
|
||||
|
||||
.global ptr7800: zp
|
||||
.global ptrtmp: zp
|
||||
.global cursorzone: zp
|
||||
.global CURS_X: zp
|
||||
.global CURS_Y: zp
|
||||
|
||||
15
libsrc/atari7800/extzp.s
Normal file
15
libsrc/atari7800/extzp.s
Normal file
@@ -0,0 +1,15 @@
|
||||
;
|
||||
; Karri Kaksonen, 2022-04-05
|
||||
;
|
||||
; zeropage locations for exclusive use by the library
|
||||
;
|
||||
|
||||
.include "extzp.inc"
|
||||
|
||||
.segment "EXTZP" : zeropage
|
||||
|
||||
ptr7800: .res 2
|
||||
ptrtmp: .res 2
|
||||
cursorzone: .res 2
|
||||
CURS_X: .res 1
|
||||
CURS_Y: .res 1
|
||||
65
libsrc/atari7800/get_tv.s
Normal file
65
libsrc/atari7800/get_tv.s
Normal file
@@ -0,0 +1,65 @@
|
||||
;
|
||||
; Karri Kaksonen, 2022-03-25
|
||||
;
|
||||
; unsigned char get_tv (void)
|
||||
;
|
||||
.include "atari7800.inc"
|
||||
.include "get_tv.inc"
|
||||
.export _get_tv
|
||||
.export _paldetected
|
||||
|
||||
.segment "DATA"
|
||||
|
||||
_paldetected:
|
||||
.byte $FF
|
||||
|
||||
; ---------------------------------------------------------------
|
||||
; unsigned char get_tv (void)
|
||||
; ---------------------------------------------------------------
|
||||
|
||||
.segment "CODE"
|
||||
|
||||
.proc _get_tv: near
|
||||
|
||||
.segment "CODE"
|
||||
|
||||
ldx #$00
|
||||
lda #$FF
|
||||
cmp _paldetected
|
||||
bne L8
|
||||
L1: lda MSTAT
|
||||
and #$80
|
||||
bne L1
|
||||
L2: lda MSTAT
|
||||
and #$80
|
||||
beq L2
|
||||
L3: lda MSTAT
|
||||
and #$80
|
||||
bne L3
|
||||
lda #$00
|
||||
sta M0001
|
||||
jmp L5
|
||||
L4: sta MWSYNC
|
||||
sta MWSYNC
|
||||
dec M0001
|
||||
L5: lda MSTAT
|
||||
and #$80
|
||||
beq L4
|
||||
lda M0001
|
||||
cmp #$78
|
||||
bcc L6
|
||||
lda #TV::NTSC
|
||||
jmp L7
|
||||
L6: lda #TV::PAL
|
||||
L7: sta _paldetected
|
||||
ldx #$00
|
||||
L8: lda _paldetected
|
||||
rts
|
||||
|
||||
.segment "BSS"
|
||||
|
||||
M0001:
|
||||
.res 1,$00
|
||||
|
||||
.endproc
|
||||
|
||||
36
libsrc/atari7800/irq.s
Normal file
36
libsrc/atari7800/irq.s
Normal file
@@ -0,0 +1,36 @@
|
||||
;
|
||||
; IRQ handling (Atari 7800 version)
|
||||
;
|
||||
|
||||
.export initirq, doneirq, IRQStub
|
||||
|
||||
.import __INTERRUPTOR_COUNT__, callirq
|
||||
|
||||
.include "atari7800.inc"
|
||||
|
||||
.code
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
initirq:
|
||||
doneirq:
|
||||
rts
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
IRQStub:
|
||||
cld ; Just to be sure
|
||||
pha
|
||||
lda #<(__INTERRUPTOR_COUNT__ * 2)
|
||||
beq @L1
|
||||
txa
|
||||
pha
|
||||
tya
|
||||
pha
|
||||
jsr callirq ; Call the functions
|
||||
pla
|
||||
tay
|
||||
pla
|
||||
tax
|
||||
@L1: pla
|
||||
rti
|
||||
|
||||
161
libsrc/atari7800/joy/atari7800-stdjoy.s
Normal file
161
libsrc/atari7800/joy/atari7800-stdjoy.s
Normal file
@@ -0,0 +1,161 @@
|
||||
;
|
||||
; Standard joystick driver for the Atari 7800.
|
||||
; This version tries to use 7800 and 2600 joysticks.
|
||||
; But assumes that both joysticks are of same type.
|
||||
;
|
||||
; Modified by Karri Kaksonen, 2022-03-31
|
||||
; Ullrich von Bassewitz, 2002-12-20
|
||||
; Using code from Steve Schmidtke
|
||||
;
|
||||
|
||||
.include "zeropage.inc"
|
||||
|
||||
.include "joy-kernel.inc"
|
||||
.include "joy-error.inc"
|
||||
.include "atari7800.inc"
|
||||
|
||||
.macpack generic
|
||||
.macpack module
|
||||
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Header. Includes jump table
|
||||
|
||||
module_header _atari7800_stdjoy_joy
|
||||
|
||||
; Driver signature
|
||||
|
||||
.byte $6A, $6F, $79 ; "joy"
|
||||
.byte JOY_API_VERSION ; Driver API version number
|
||||
|
||||
; Library reference
|
||||
|
||||
.addr $0000
|
||||
|
||||
; Jump table.
|
||||
|
||||
.addr INSTALL
|
||||
.addr UNINSTALL
|
||||
.addr COUNT
|
||||
.addr READ
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Constants
|
||||
|
||||
JOY_COUNT = 2 ; Number of joysticks we support
|
||||
|
||||
.code
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; INSTALL routine. Is called after the driver is loaded into memory. If
|
||||
; possible, check if the hardware is present and determine the amount of
|
||||
; memory available.
|
||||
; Must return an JOY_ERR_xx code in a/x.
|
||||
;
|
||||
|
||||
INSTALL:
|
||||
; Assume 7800 2-button controller, can change
|
||||
; to 2600 1-button later
|
||||
lda #$14
|
||||
sta CTLSWB ; enable 2-button 7800 controller 1: set pin 6 to output
|
||||
ldy #$00
|
||||
sty SWCHB ; enable 2-button 7800 controller 2: pull pin 6 (INPT4) high
|
||||
|
||||
reset:
|
||||
lda #<JOY_ERR_OK
|
||||
ldx #>JOY_ERR_OK
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; UNINSTALL routine. Is called before the driver is removed from memory.
|
||||
; Can do cleanup or whatever. Must not return anything.
|
||||
;
|
||||
|
||||
UNINSTALL:
|
||||
rts
|
||||
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; COUNT: Return the total number of available joysticks in a/x.
|
||||
;
|
||||
|
||||
COUNT:
|
||||
lda #<JOY_COUNT
|
||||
ldx #>JOY_COUNT
|
||||
rts
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; READ: Read a particular joystick passed in A for 2 fire buttons.
|
||||
|
||||
readbuttons:
|
||||
; Y has joystick of interest 0/1
|
||||
; return value:
|
||||
; $00: no button,
|
||||
; $01: left/B button,
|
||||
; $02: right/A button,
|
||||
; $03: both buttons
|
||||
; preserves X
|
||||
tya
|
||||
beq L5
|
||||
; Joystick 1 processing
|
||||
; 7800 joystick 1 buttons
|
||||
ldy #0 ; ........
|
||||
bit INPT2 ; Check for right button
|
||||
bpl L1
|
||||
ldy #2 ; ......2.
|
||||
L1: bit INPT3 ;Check for left button
|
||||
bpl L2
|
||||
iny ; ......21
|
||||
L2: tya
|
||||
bne L4 ; 7800 mode joystick worked
|
||||
; 2600 Joystick 1
|
||||
bit INPT5
|
||||
bmi L4
|
||||
L3: iny ; .......1
|
||||
lda #0 ; Fallback to 2600 joystick mode
|
||||
sta CTLSWB
|
||||
L4: tya ; ......21
|
||||
rts
|
||||
|
||||
L5: ; Joystick 0 processing
|
||||
; 7800 joystick 0 buttons
|
||||
ldy #0 ; ........
|
||||
bit INPT0 ; Check for right button
|
||||
bpl L6
|
||||
ldy #2 ; ......2.
|
||||
L6: bit INPT1 ;Check for left button
|
||||
bpl L7
|
||||
iny ; ......21
|
||||
L7: tya
|
||||
bne L4 ; 7800 mode joystick worked
|
||||
; 2600 Joystick 0
|
||||
bit INPT4
|
||||
bmi L4
|
||||
bpl L3
|
||||
|
||||
READ:
|
||||
tay ; Store joystick 0/1 in Y
|
||||
beq L8
|
||||
lda SWCHA ; Read directions of joystick 1
|
||||
rol ; ...RLDU.
|
||||
rol ; ..RLDU..
|
||||
rol ; .RLDU... - joystick 1
|
||||
jmp L9
|
||||
L8: lda SWCHA ; Read directions of joystick 0
|
||||
ror ; .RLDU... - joystick 0
|
||||
L9: tax
|
||||
jsr readbuttons ; A = ......21, X = .RLDU...
|
||||
ror ; A = .......2 1
|
||||
tay ; Y = .......2
|
||||
txa ; A = .RLDU...
|
||||
ror ; A = 1.RLDU..
|
||||
tax ; X = 1.RLDU..
|
||||
tya ; A = .......2
|
||||
ror ; A = ........ 2
|
||||
txa ; A = 1.RLDU..
|
||||
rol ; A = .RLDU..2 1
|
||||
rol ; A = RLDU..21
|
||||
eor #$F0 ; The direction buttons were inversed
|
||||
and #$F3
|
||||
rts
|
||||
|
||||
14
libsrc/atari7800/joy_stat_stddrv.s
Normal file
14
libsrc/atari7800/joy_stat_stddrv.s
Normal file
@@ -0,0 +1,14 @@
|
||||
;
|
||||
; Address of the static standard joystick driver
|
||||
;
|
||||
; Oliver Schmidt, 2012-11-01
|
||||
;
|
||||
; const void joy_static_stddrv[];
|
||||
;
|
||||
|
||||
.export _joy_static_stddrv
|
||||
.import _atari7800_stdjoy_joy
|
||||
|
||||
.rodata
|
||||
|
||||
_joy_static_stddrv := _atari7800_stdjoy_joy
|
||||
8
libsrc/atari7800/libref.s
Normal file
8
libsrc/atari7800/libref.s
Normal file
@@ -0,0 +1,8 @@
|
||||
;
|
||||
; Oliver Schmidt, 2013-05-31
|
||||
;
|
||||
|
||||
.export joy_libref
|
||||
.import _exit
|
||||
|
||||
joy_libref := _exit
|
||||
27
libsrc/atari7800/mono_clrscr.s
Normal file
27
libsrc/atari7800/mono_clrscr.s
Normal file
@@ -0,0 +1,27 @@
|
||||
|
||||
.include "atari7800.inc"
|
||||
|
||||
.export _mono_clrscr
|
||||
|
||||
.import _mono_screen
|
||||
.import pushax, __bzero
|
||||
.include "extzp.inc"
|
||||
|
||||
.code
|
||||
|
||||
.proc _mono_clrscr
|
||||
|
||||
lda #<_mono_screen
|
||||
ldx #>_mono_screen
|
||||
jsr pushax
|
||||
ldx #>(mono_charsperline * screenrows)
|
||||
lda #<(mono_charsperline * screenrows)
|
||||
jmp __bzero
|
||||
|
||||
.endproc
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
; force the init constructor to be imported
|
||||
|
||||
.import mono_initconio
|
||||
conio_init = mono_initconio
|
||||
231
libsrc/atari7800/mono_conio.s
Normal file
231
libsrc/atari7800/mono_conio.s
Normal file
@@ -0,0 +1,231 @@
|
||||
;
|
||||
; 2022-04-02, Karri Kaksonen
|
||||
;
|
||||
; The Atari 7800 has only 4k of RAM. So for a generic conio implementation
|
||||
; the best alternative is to use indirect tile mapping with a character
|
||||
; frame buffer
|
||||
;
|
||||
|
||||
.constructor mono_initconio
|
||||
.include "atari7800.inc"
|
||||
.include "extzp.inc"
|
||||
.import _mono_font
|
||||
.import _get_tv
|
||||
.export _mono_screen
|
||||
.export _mono_zones
|
||||
.export _mono_dll
|
||||
|
||||
.bss
|
||||
_mono_screen:
|
||||
.res mono_charsperline * screenrows
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; Macros used to generate lists
|
||||
|
||||
.macro DLLentry offset, addr
|
||||
.byte offset
|
||||
.byte >addr
|
||||
.byte <addr
|
||||
.endmacro
|
||||
|
||||
.macro NullHeader offset, zero
|
||||
.byte offset
|
||||
.byte zero
|
||||
.endmacro
|
||||
|
||||
.macro Header addr, palwidth, hpos
|
||||
.byte <addr
|
||||
.byte palwidth
|
||||
.byte >addr
|
||||
.byte hpos
|
||||
.endmacro
|
||||
|
||||
.macro XHeader addr, flags, palwidth, hpos
|
||||
.byte <addr
|
||||
.byte flags
|
||||
.byte >addr
|
||||
.byte palwidth
|
||||
.byte hpos
|
||||
.endmacro
|
||||
|
||||
.macro TextZone row
|
||||
; Text
|
||||
.byte <(_mono_screen + row * mono_charsperline)
|
||||
.byte $60
|
||||
.byte >(_mono_screen + row * mono_charsperline)
|
||||
.byte 12
|
||||
.byte 0
|
||||
.byte <(_mono_screen + row * mono_charsperline + 20)
|
||||
.byte $60
|
||||
.byte >(_mono_screen + row * mono_charsperline + 20)
|
||||
.byte 12
|
||||
.byte 80
|
||||
; Cursor
|
||||
.byte 95
|
||||
.byte 0
|
||||
.byte >_mono_font
|
||||
.byte 0
|
||||
.endmacro
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; The Atari 7800 has only 4k of RAM. So for a generic conio implementation
|
||||
; the best alternative is to use indirect tile mapping with a character
|
||||
; frame buffer
|
||||
.data
|
||||
|
||||
_mono_zones:
|
||||
zone0: TextZone 0
|
||||
nh: NullHeader 0, 0
|
||||
zone1: TextZone 1
|
||||
NullHeader 0, 0
|
||||
zone2: TextZone 2
|
||||
NullHeader 0, 0
|
||||
zone3: TextZone 3
|
||||
NullHeader 0, 0
|
||||
zone4: TextZone 4
|
||||
NullHeader 0, 0
|
||||
zone5: TextZone 5
|
||||
NullHeader 0, 0
|
||||
zone6: TextZone 6
|
||||
NullHeader 0, 0
|
||||
zone7: TextZone 7
|
||||
NullHeader 0, 0
|
||||
zone8: TextZone 8
|
||||
NullHeader 0, 0
|
||||
zone9: TextZone 9
|
||||
NullHeader 0, 0
|
||||
zone10: TextZone 10
|
||||
NullHeader 0, 0
|
||||
zone11: TextZone 11
|
||||
NullHeader 0, 0
|
||||
zone12: TextZone 12
|
||||
NullHeader 0, 0
|
||||
zone13: TextZone 13
|
||||
NullHeader 0, 0
|
||||
zone14: TextZone 14
|
||||
NullHeader 0, 0
|
||||
zone15: TextZone 15
|
||||
NullHeader 0, 0
|
||||
zone16: TextZone 16
|
||||
NullHeader 0, 0
|
||||
zone17: TextZone 17
|
||||
NullHeader 0, 0
|
||||
zone18: TextZone 18
|
||||
NullHeader 0, 0
|
||||
zone19: TextZone 19
|
||||
NullHeader 0, 0
|
||||
zone20: TextZone 20
|
||||
NullHeader 0, 0
|
||||
zone21: TextZone 21
|
||||
NullHeader 0, 0
|
||||
zone22: TextZone 22
|
||||
NullHeader 0, 0
|
||||
zone23: TextZone 23
|
||||
NullHeader 0, 0
|
||||
zone24: TextZone 24
|
||||
NullHeader 0, 0
|
||||
zone25: TextZone 25
|
||||
NullHeader 0, 0
|
||||
zone26: TextZone 26
|
||||
NullHeader 0, 0
|
||||
zone27: TextZone 27
|
||||
NullHeader 0, 0
|
||||
|
||||
_mono_dll:
|
||||
PALscanlines: ; 25 lines
|
||||
DLLentry 15, nh
|
||||
DLLentry 8, nh
|
||||
|
||||
Topscanlines: ; 9 lines
|
||||
DLLentry 8, nh
|
||||
|
||||
Displaylines:
|
||||
DLLentry $80+7, zone0 ; NMI interrupt from end of prev zone
|
||||
DLLentry 7, zone1
|
||||
DLLentry 7, zone2
|
||||
DLLentry 7, zone3
|
||||
DLLentry 7, zone4
|
||||
DLLentry 7, zone5
|
||||
DLLentry 7, zone6
|
||||
DLLentry 7, zone7
|
||||
DLLentry 7, zone8
|
||||
DLLentry 7, zone9
|
||||
DLLentry 7, zone10
|
||||
DLLentry 7, zone11
|
||||
DLLentry 7, zone12
|
||||
DLLentry 7, zone13
|
||||
DLLentry 7, zone14
|
||||
DLLentry 7, zone15
|
||||
DLLentry 7, zone16
|
||||
DLLentry 7, zone17
|
||||
DLLentry 7, zone18
|
||||
DLLentry 7, zone19
|
||||
DLLentry 7, zone20
|
||||
DLLentry 7, zone21
|
||||
DLLentry 7, zone22
|
||||
DLLentry 7, zone23
|
||||
DLLentry 7, zone24
|
||||
DLLentry 7, zone25
|
||||
DLLentry 7, zone26
|
||||
DLLentry 7, zone27
|
||||
|
||||
Bottomscanlines:
|
||||
DLLentry $80+15, nh ; NMI interrupt at end of display
|
||||
DLLentry 9, nh
|
||||
DLLentry 15, nh
|
||||
DLLentry 8, nh
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Set up the screen to 320a mode
|
||||
;
|
||||
.segment "ONCE"
|
||||
|
||||
CTRL_MODE160 .set 0
|
||||
CTRL_MODEAC .set 3
|
||||
CTRL_KANGOFF .set 0
|
||||
CTRL_BCBLACK .set 0
|
||||
CTRL_CHAR1B .set 0
|
||||
CTRL_CHAR2B .set $10
|
||||
CTRL_DMAON .set $40
|
||||
CTRL_CKOFF .set 0
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Initialize the conio display lists and zones
|
||||
;
|
||||
.proc mono_initconio
|
||||
|
||||
jsr _get_tv
|
||||
bne pal
|
||||
lda #<Topscanlines
|
||||
sta DPPL
|
||||
lda #>Topscanlines
|
||||
sta DPPH
|
||||
jmp vblankon
|
||||
pal: lda #<PALscanlines
|
||||
sta DPPL
|
||||
lda #>PALscanlines
|
||||
sta DPPH
|
||||
vblankon:
|
||||
lda MSTAT
|
||||
bmi vblankon
|
||||
vblankoff:
|
||||
lda MSTAT
|
||||
bpl vblankoff
|
||||
lda #>_mono_font
|
||||
sta CHBASE
|
||||
lda #(CTRL_MODEAC | CTRL_KANGOFF | CTRL_BCBLACK | CTRL_CHAR1B | CTRL_DMAON | CTRL_CKOFF)
|
||||
sta CTRL
|
||||
lda #$00 ; Black background
|
||||
sta BKGRND
|
||||
sta CURS_X
|
||||
sta CURS_Y
|
||||
lda #$33 ; Red
|
||||
sta P0C1
|
||||
lda #$c8 ; Green
|
||||
sta P0C2
|
||||
lda #$0f ; White
|
||||
sta P0C3
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
102
libsrc/atari7800/mono_cputc.s
Normal file
102
libsrc/atari7800/mono_cputc.s
Normal file
@@ -0,0 +1,102 @@
|
||||
;
|
||||
; Mark Keates, Christian Groessler, Piotr Fusik, Karri Kaksonen
|
||||
;
|
||||
; void cputcxy (unsigned char x, unsigned char y, char c);
|
||||
; void cputc (char c);
|
||||
;
|
||||
|
||||
.export _mono_cputc
|
||||
.import mono_gotox, mono_gotoy, pusha0
|
||||
.import pushax
|
||||
.import _mono_screen
|
||||
|
||||
.include "atari7800.inc"
|
||||
.include "extzp.inc"
|
||||
|
||||
.code
|
||||
|
||||
;---------------------------------------------------------------------------
|
||||
; 8x16 routine
|
||||
|
||||
umula0:
|
||||
ldy #8 ; Number of bits
|
||||
lda #0
|
||||
lsr ptr7800 ; Get first bit into carry
|
||||
@L0: bcc @L1
|
||||
|
||||
clc
|
||||
adc ptrtmp
|
||||
tax
|
||||
lda ptrtmp+1 ; hi byte of left op
|
||||
clc
|
||||
adc ptr7800+1
|
||||
sta ptr7800+1
|
||||
txa
|
||||
|
||||
@L1: ror ptr7800+1
|
||||
ror a
|
||||
ror ptr7800
|
||||
dey
|
||||
bne @L0
|
||||
tax
|
||||
lda ptr7800 ; Load the result
|
||||
rts
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Put a character on screen
|
||||
;
|
||||
; The code will handle newlines that wrap to start of screen
|
||||
;
|
||||
.proc _mono_cputc
|
||||
|
||||
cmp #$0A ; LF
|
||||
bne @L4
|
||||
@L1: lda #0 ; newline
|
||||
jsr mono_gotox
|
||||
lda CURS_Y
|
||||
cmp #(screenrows-1)
|
||||
bne @L2
|
||||
lda #0
|
||||
beq @L3
|
||||
@L2: clc
|
||||
adc #1
|
||||
@L3: jmp mono_gotoy
|
||||
|
||||
@L4:
|
||||
pha
|
||||
|
||||
lda #0
|
||||
sta ptr7800+1
|
||||
sta ptrtmp+1
|
||||
lda CURS_Y ; Find position on screen buffer
|
||||
sta ptr7800
|
||||
lda #mono_charsperline
|
||||
sta ptrtmp
|
||||
jsr umula0
|
||||
clc
|
||||
adc CURS_X
|
||||
bcc @L11
|
||||
inx
|
||||
@L11: clc
|
||||
adc #<(_mono_screen)
|
||||
sta ptr7800
|
||||
bcc @L12
|
||||
inx
|
||||
@L12: txa
|
||||
clc
|
||||
adc #>(_mono_screen)
|
||||
sta ptr7800+1
|
||||
|
||||
pla ; Print character on screen
|
||||
ldy #0
|
||||
sta (ptr7800),y
|
||||
|
||||
lda CURS_X ; Increment cursor
|
||||
cmp #(mono_charsperline-1)
|
||||
beq @L1
|
||||
clc
|
||||
adc #1
|
||||
jmp mono_gotox
|
||||
|
||||
.endproc
|
||||
|
||||
2065
libsrc/atari7800/mono_font.s
Normal file
2065
libsrc/atari7800/mono_font.s
Normal file
File diff suppressed because it is too large
Load Diff
214
libsrc/atari7800/mono_setcursor.s
Normal file
214
libsrc/atari7800/mono_setcursor.s
Normal file
@@ -0,0 +1,214 @@
|
||||
;
|
||||
; 2022-04-03, Karri Kaksonen
|
||||
;
|
||||
; setcursor (unsigned char on);
|
||||
;
|
||||
; The Atari 7800 does not have a hw cursor.
|
||||
; This module emulates a cursor to be used with the conio
|
||||
; implementation.
|
||||
;
|
||||
; The actual cursor display is included in the conio dll
|
||||
; but every scanline has the element silenced by default
|
||||
; at the end of every zone.
|
||||
;
|
||||
; The way the cursor works is to silence it before the cursor
|
||||
; position changes and enable it afterwards.
|
||||
;
|
||||
; In order to get some performance we have a pointer to the
|
||||
; cursor header structure. This structure is always at the
|
||||
; end of the zone. So the pointer changes when CURS_Y changes.
|
||||
;
|
||||
; There is so many dependencies that it makes sense to
|
||||
; deal with all CURS_X, CURS_Y stuff in this file and
|
||||
; definitely not allow direct access to the variables.
|
||||
;
|
||||
|
||||
.export mono_gotoxy, _mono_gotoxy, mono_gotox, mono_gotoy
|
||||
.constructor mono_init_cursor
|
||||
.interruptor mono_blink_cursor
|
||||
|
||||
.importzp sp
|
||||
.import _zonecounter
|
||||
.import _mono_zones
|
||||
.import cursor
|
||||
.import pusha, incsp1, pusha0, pushax, popa
|
||||
.include "atari7800.inc"
|
||||
.include "extzp.inc"
|
||||
|
||||
.macpack generic
|
||||
|
||||
.data
|
||||
;-----------------------------------------------------------------------------
|
||||
; The variables used by cursor functions
|
||||
;
|
||||
|
||||
blink_time:
|
||||
.byte 200
|
||||
|
||||
.code
|
||||
|
||||
;---------------------------------------------------------------------------
|
||||
; 8x16 routine
|
||||
|
||||
umula0:
|
||||
ldy #8 ; Number of bits
|
||||
lda #0
|
||||
lsr ptr7800 ; Get first bit into carry
|
||||
@L0: bcc @L1
|
||||
|
||||
clc
|
||||
adc ptrtmp
|
||||
tax
|
||||
lda ptrtmp+1 ; hi byte of left op
|
||||
adc ptr7800+1
|
||||
sta ptr7800+1
|
||||
txa
|
||||
|
||||
@L1: ror ptr7800+1
|
||||
ror a
|
||||
ror ptr7800
|
||||
dey
|
||||
bne @L0
|
||||
tax
|
||||
lda ptr7800 ; Load the result
|
||||
rts
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Calculate cursorzone address
|
||||
; You also need to set the cursorzone to point to the correct cursor Header
|
||||
; at the end of line CURS_Y.
|
||||
; Offset to cursor zone 5. To next line offset 11
|
||||
; cursorzone points to _mono_zones + CURS_Y * 16 + 10
|
||||
; A = CURS_Y
|
||||
.proc calccursorzone
|
||||
|
||||
sta ptr7800
|
||||
lda #16
|
||||
sta ptrtmp
|
||||
lda #0
|
||||
sta ptr7800+1
|
||||
sta ptrtmp+1
|
||||
jsr umula0
|
||||
clc
|
||||
adc #10
|
||||
bcc @L1
|
||||
inx
|
||||
@L1: clc
|
||||
adc #<_mono_zones
|
||||
sta cursorzone ; calculate new cursorzone
|
||||
txa
|
||||
adc #>_mono_zones
|
||||
sta cursorzone+1
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Set cursor to Y position.
|
||||
; You also need to set the cursorzone to point to the correct cursor Header
|
||||
; at the end of line CURS_Y.
|
||||
; Offset to cursor zone 5. To next line offset 11
|
||||
; cursorzone points to _mono_zones + CURS_Y * 11 + 5
|
||||
;
|
||||
; cursorzone[1] = 0 when not CURS_Y, 31 if CURS_Y
|
||||
;
|
||||
; Disable cursor
|
||||
; cursorzone[1] = 0
|
||||
;
|
||||
; Enable cursor
|
||||
; if showcursor cursorzone[1] = 31
|
||||
;
|
||||
.proc mono_gotoy
|
||||
|
||||
pha
|
||||
lda CURS_Y
|
||||
jsr calccursorzone
|
||||
ldy #1
|
||||
lda #0
|
||||
sta (cursorzone),y ; disable cursor
|
||||
pla
|
||||
sta CURS_Y
|
||||
jsr calccursorzone
|
||||
lda cursor
|
||||
beq @L1
|
||||
lda #31 ; enable cursor
|
||||
@L1: ldy #1
|
||||
sta (cursorzone),y
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Set cursor to X position.
|
||||
; You also need to set the hpos offset to the correct value on this line
|
||||
; cursorzone[3] = 4 * CURS_X?
|
||||
;
|
||||
.proc mono_gotox
|
||||
|
||||
sta CURS_X
|
||||
ldy #3
|
||||
clc
|
||||
rol
|
||||
rol
|
||||
sta (cursorzone),y
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Set cursor to desired position (X,Y)
|
||||
;
|
||||
.proc _mono_gotoxy
|
||||
|
||||
jsr mono_gotoy
|
||||
jsr popa
|
||||
jmp mono_gotox
|
||||
|
||||
.endproc
|
||||
|
||||
.proc mono_gotoxy
|
||||
jsr popa
|
||||
jmp _mono_gotoxy
|
||||
.endproc
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Initialize cursorzone at startup
|
||||
; Offset to cursor zone 5.
|
||||
;
|
||||
.proc mono_blink_cursor
|
||||
lda _zonecounter
|
||||
and #01
|
||||
beq @L3
|
||||
inc blink_time
|
||||
bne @L3
|
||||
lda #200
|
||||
sta blink_time
|
||||
ldy #0
|
||||
lda (cursorzone),y
|
||||
cmp #32
|
||||
bne @L1
|
||||
lda #95
|
||||
bne @L2
|
||||
@L1: lda #32
|
||||
@L2: sta (cursorzone),y
|
||||
@L3: rts
|
||||
.endproc
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Initialize cursorzone at startup
|
||||
; Offset to cursor zone 5.
|
||||
;
|
||||
.segment "ONCE"
|
||||
mono_init_cursor:
|
||||
lda #0
|
||||
jsr calccursorzone
|
||||
lda #0
|
||||
sta blink_time
|
||||
rts
|
||||
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; force the init constructor to be imported
|
||||
|
||||
.import mono_initconio
|
||||
conio_init = mono_initconio
|
||||
214
libsrc/atari7800/setcursor.s
Normal file
214
libsrc/atari7800/setcursor.s
Normal file
@@ -0,0 +1,214 @@
|
||||
;
|
||||
; 2022-04-03, Karri Kaksonen
|
||||
;
|
||||
; setcursor (unsigned char on);
|
||||
;
|
||||
; The Atari 7800 does not have a hw cursor.
|
||||
; This module emulates a cursor to be used with the conio
|
||||
; implementation.
|
||||
;
|
||||
; The actual cursor display is included in the conio dll
|
||||
; but every scanline has the element silenced by default
|
||||
; at the end of every zone.
|
||||
;
|
||||
; The way the cursor works is to silence it before the cursor
|
||||
; position changes and enable it afterwards.
|
||||
;
|
||||
; In order to get some performance we have a pointer to the
|
||||
; cursor header structure. This structure is always at the
|
||||
; end of the zone. So the pointer changes when CURS_Y changes.
|
||||
;
|
||||
; There is so many dependencies that it makes sense to
|
||||
; deal with all CURS_X, CURS_Y stuff in this file and
|
||||
; definitely not allow direct access to the variables.
|
||||
;
|
||||
|
||||
.export gotoxy, _gotoxy, gotox, gotoy
|
||||
.constructor init_cursor
|
||||
.interruptor blink_cursor
|
||||
|
||||
.importzp sp
|
||||
.import _zonecounter
|
||||
.import _zones
|
||||
.import cursor
|
||||
.import pusha, incsp1, pusha0, pushax, popa
|
||||
.include "atari7800.inc"
|
||||
.include "extzp.inc"
|
||||
|
||||
.macpack generic
|
||||
|
||||
.data
|
||||
;-----------------------------------------------------------------------------
|
||||
; The variables used by cursor functions
|
||||
;
|
||||
|
||||
blink_time:
|
||||
.byte 200
|
||||
|
||||
.code
|
||||
|
||||
;---------------------------------------------------------------------------
|
||||
; 8x16 routine
|
||||
|
||||
umula0:
|
||||
ldy #8 ; Number of bits
|
||||
lda #0
|
||||
lsr ptr7800 ; Get first bit into carry
|
||||
@L0: bcc @L1
|
||||
|
||||
clc
|
||||
adc ptrtmp
|
||||
tax
|
||||
lda ptrtmp+1 ; hi byte of left op
|
||||
clc
|
||||
adc ptr7800+1
|
||||
sta ptr7800+1
|
||||
txa
|
||||
|
||||
@L1: ror ptr7800+1
|
||||
ror a
|
||||
ror ptr7800
|
||||
dey
|
||||
bne @L0
|
||||
tax
|
||||
lda ptr7800 ; Load the result
|
||||
rts
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Calculate cursorzone address
|
||||
; You also need to set the cursorzone to point to the correct cursor Header
|
||||
; at the end of line CURS_Y.
|
||||
; Offset to cursor zone 5. To next line offset 11
|
||||
; cursorzone points to _zones + CURS_Y * 11 + 5
|
||||
; A = CURS_Y
|
||||
.proc calccursorzone
|
||||
|
||||
sta ptr7800
|
||||
lda #11
|
||||
sta ptrtmp
|
||||
lda #0
|
||||
sta ptr7800+1
|
||||
sta ptrtmp+1
|
||||
jsr umula0
|
||||
clc
|
||||
adc #5
|
||||
bcc @L1
|
||||
inx
|
||||
@L1: clc
|
||||
adc #<_zones
|
||||
sta cursorzone ; calculate new cursorzone
|
||||
txa
|
||||
adc #>_zones
|
||||
sta cursorzone+1
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Set cursor to Y position.
|
||||
; You also need to set the cursorzone to point to the correct cursor Header
|
||||
; at the end of line CURS_Y.
|
||||
; Offset to cursor zone 5. To next line offset 11
|
||||
; cursorzone points to _zones + CURS_Y * 11 + 5
|
||||
;
|
||||
; cursorzone[1] = 0 when not CURS_Y, 30 if CURS_Y
|
||||
;
|
||||
; Disable cursor
|
||||
; cursorzone[1] = 0
|
||||
;
|
||||
; Enable cursor
|
||||
; if showcursor cursorzone[1] = 30
|
||||
;
|
||||
.proc gotoy
|
||||
|
||||
pha
|
||||
lda CURS_Y
|
||||
jsr calccursorzone
|
||||
ldy #1
|
||||
lda #0
|
||||
sta (cursorzone),y ; disable cursor
|
||||
pla
|
||||
sta CURS_Y
|
||||
jsr calccursorzone
|
||||
lda cursor
|
||||
beq @L1
|
||||
lda #30 ; enable cursor
|
||||
@L1: ldy #1
|
||||
sta (cursorzone),y
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Set cursor to X position.
|
||||
; You also need to set the hpos offset to the correct value on this line
|
||||
; cursorzone[3] = 8 * CURS_X
|
||||
;
|
||||
.proc gotox
|
||||
|
||||
sta CURS_X
|
||||
ldy #3
|
||||
clc
|
||||
rol
|
||||
rol
|
||||
rol
|
||||
sta (cursorzone),y
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Set cursor to desired position (X,Y)
|
||||
;
|
||||
.proc _gotoxy
|
||||
|
||||
jsr gotoy
|
||||
jsr popa
|
||||
jsr gotox
|
||||
rts
|
||||
.endproc
|
||||
|
||||
.proc gotoxy
|
||||
jsr popa
|
||||
jmp _gotoxy
|
||||
.endproc
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Initialize cursorzone at startup
|
||||
; Offset to cursor zone 5.
|
||||
;
|
||||
.proc blink_cursor
|
||||
lda _zonecounter
|
||||
and #01
|
||||
beq @L3
|
||||
inc blink_time
|
||||
bne @L3
|
||||
lda #200
|
||||
sta blink_time
|
||||
ldy #0
|
||||
lda (cursorzone),y
|
||||
bne @L1
|
||||
lda #254
|
||||
bne @L2
|
||||
@L1: lda #0
|
||||
@L2: sta (cursorzone),y
|
||||
@L3: rts
|
||||
.endproc
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Initialize cursorzone at startup
|
||||
; Offset to cursor zone 5.
|
||||
;
|
||||
.segment "ONCE"
|
||||
init_cursor:
|
||||
lda #0
|
||||
jsr calccursorzone
|
||||
lda #0
|
||||
sta blink_time
|
||||
rts
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; force the init constructor to be imported
|
||||
|
||||
.import initconio
|
||||
conio_init = initconio
|
||||
53
libsrc/atari7800/textcolor.s
Normal file
53
libsrc/atari7800/textcolor.s
Normal file
@@ -0,0 +1,53 @@
|
||||
;
|
||||
; Karri Kaksonen, 2022-04-16
|
||||
;
|
||||
;
|
||||
|
||||
.export _textcolor
|
||||
.export txtcolor
|
||||
|
||||
.include "atari7800.inc"
|
||||
|
||||
.data
|
||||
;-----------------------------------------------------------------------------
|
||||
; Holder of the text colour offset
|
||||
; 0 = red, 42 = green, 84 = white
|
||||
;
|
||||
txtcolor:
|
||||
.byte 0
|
||||
|
||||
.code
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Change the text colour
|
||||
;
|
||||
; Logical colour names are
|
||||
; 0 = red
|
||||
; 1 = green
|
||||
; 2 = white
|
||||
;
|
||||
; The routine will also return the previous textcolor
|
||||
;
|
||||
.proc _textcolor
|
||||
|
||||
beq @L2
|
||||
sec
|
||||
sbc #1
|
||||
beq @L1
|
||||
lda #84
|
||||
jmp @L2
|
||||
@L1: lda #42
|
||||
@L2: ldy txtcolor
|
||||
sta txtcolor ; Store new textcolor
|
||||
ldx #0
|
||||
tya
|
||||
bne @L3
|
||||
rts ; Old colour was 0
|
||||
@L3: sec
|
||||
sbc #42
|
||||
bne @L4
|
||||
lda #1
|
||||
rts ; Old colour was 1
|
||||
@L4: lda #2
|
||||
rts ; Old colour was 2
|
||||
.endproc
|
||||
19
libsrc/atari7800/wherex.s
Normal file
19
libsrc/atari7800/wherex.s
Normal file
@@ -0,0 +1,19 @@
|
||||
;
|
||||
; 2022-04-16, Karri Kaksonen
|
||||
;
|
||||
; unsigned char wherex()
|
||||
;
|
||||
|
||||
.export _wherex
|
||||
.include "extzp.inc"
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Get cursor X position
|
||||
;
|
||||
.proc _wherex
|
||||
|
||||
ldx #0
|
||||
lda CURS_X
|
||||
rts
|
||||
.endproc
|
||||
|
||||
19
libsrc/atari7800/wherey.s
Normal file
19
libsrc/atari7800/wherey.s
Normal file
@@ -0,0 +1,19 @@
|
||||
;
|
||||
; 2022-04-16, Karri Kaksonen
|
||||
;
|
||||
; unsigned char wherey()
|
||||
;
|
||||
|
||||
.export _wherey
|
||||
.include "extzp.inc"
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Get cursor Y position
|
||||
;
|
||||
.proc _wherey
|
||||
|
||||
ldx #0
|
||||
lda CURS_Y
|
||||
rts
|
||||
.endproc
|
||||
|
||||
@@ -72,7 +72,7 @@ reu_params: .word $0000 ; Host address, lo, hi
|
||||
.byte $00 ; Expansion bank no.
|
||||
.word $0000 ; # bytes to move, lo, hi
|
||||
.byte $00 ; Interrupt mask reg.
|
||||
.byte $00 ; Adress control reg.
|
||||
.byte $00 ; Address control reg.
|
||||
|
||||
.code
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ reu_params: .word $0000 ; Host address, lo, hi
|
||||
.byte $00 ; Expansion bank no.
|
||||
.word $0000 ; # bytes to move, lo, hi
|
||||
.byte $00 ; Interrupt mask reg.
|
||||
.byte $00 ; Adress control reg.
|
||||
.byte $00 ; Address control reg.
|
||||
|
||||
.code
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ dowrite:
|
||||
beq notrunc
|
||||
jsr scratch
|
||||
|
||||
; Complete the the file name. Check for append mode here.
|
||||
; Complete the file name. Check for append mode here.
|
||||
|
||||
notrunc:
|
||||
lda tmp3 ; Get the mode again
|
||||
@@ -168,7 +168,7 @@ nofile: ; ... else use SA=0 (read)
|
||||
jsr OPEN
|
||||
bcs oserror
|
||||
|
||||
; Open the the drive command channel and read it
|
||||
; Open the drive command channel and read it
|
||||
|
||||
ldx fnunit
|
||||
jsr opencmdchannel
|
||||
|
||||
@@ -31,7 +31,7 @@ FILE* __fastcall__ freopen (const char* name, const char* mode, FILE* f)
|
||||
** overwritten by _fopen.
|
||||
*/
|
||||
if (close (f->f_fd) < 0) {
|
||||
/* An error occured, errno is already set */
|
||||
/* An error occurred, errno is already set */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ specval:
|
||||
; Common subroutine to pop the parameters and put them into core
|
||||
;
|
||||
|
||||
dopop: sta tmp1 ; will loose high byte
|
||||
dopop: sta tmp1 ; will lose high byte
|
||||
ldy #0
|
||||
lda (sp),y
|
||||
sta ptr2
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
; Common subroutine to pop the parameters and put them into core
|
||||
;
|
||||
|
||||
dopop: sta tmp1 ; will loose high byte
|
||||
dopop: sta tmp1 ; will lose high byte
|
||||
jsr popax ; get s to ptr2
|
||||
sta ptr2
|
||||
stx ptr2+1
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
;
|
||||
; 2019-12-22, Greg King
|
||||
; 2022-03-29, Greg King
|
||||
;
|
||||
; char cgetc (void);
|
||||
; /* Return a character from the keyboard. */
|
||||
@@ -13,6 +13,8 @@
|
||||
.macpack generic
|
||||
|
||||
|
||||
screen_addr := $1B000 ; VRAM address of text screen
|
||||
|
||||
_cgetc: jsr _kbhit
|
||||
bnz L3 ; Jump if there are already chars waiting
|
||||
|
||||
@@ -57,8 +59,9 @@ setcursor:
|
||||
|
||||
stz VERA::CTRL ; Use port 0
|
||||
lda CURS_Y
|
||||
add #<(>screen_addr)
|
||||
sta VERA::ADDR+1 ; Set row number
|
||||
lda #VERA::INC1 ; Increment address by one
|
||||
lda #VERA::INC1 | ^screen_addr ; Increment address by one
|
||||
sta VERA::ADDR+2
|
||||
lda CURS_X ; Get character column
|
||||
asl a
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;
|
||||
; 2016-02-28, Groepaz
|
||||
; 2020-04-29, Greg King
|
||||
; 2022-03-29, Greg King
|
||||
;
|
||||
; char cpeekc (void);
|
||||
; /* Return the character from the current cursor position. */
|
||||
@@ -9,13 +9,18 @@
|
||||
.export _cpeekc
|
||||
|
||||
.include "cx16.inc"
|
||||
.macpack generic
|
||||
|
||||
|
||||
screen_addr := $1B000 ; VRAM address of text screen
|
||||
|
||||
_cpeekc:
|
||||
stz VERA::CTRL ; use port 0
|
||||
lda CURS_Y
|
||||
add #<(>screen_addr)
|
||||
sta VERA::ADDR+1 ; set row number
|
||||
stz VERA::ADDR+2
|
||||
lda #^screen_addr
|
||||
sta VERA::ADDR+2
|
||||
lda CURS_X ; get character column
|
||||
asl a ; each character has two bytes
|
||||
sta VERA::ADDR
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
;
|
||||
; 2020-04-30, Greg King
|
||||
; 2022-03-29, Greg King
|
||||
;
|
||||
; unsigned char cpeekcolor (void);
|
||||
; /* Return the colors from the current cursor position. */
|
||||
@@ -8,8 +8,11 @@
|
||||
.export _cpeekcolor
|
||||
|
||||
.include "cx16.inc"
|
||||
.macpack generic
|
||||
|
||||
|
||||
screen_addr := $1B000 ; VRAM address of text screen
|
||||
|
||||
_cpeekcolor:
|
||||
php
|
||||
lda CURS_FLAG ; is the cursor currently off?
|
||||
@@ -22,8 +25,10 @@ _cpeekcolor:
|
||||
|
||||
@L1: stz VERA::CTRL ; use port 0
|
||||
lda CURS_Y
|
||||
add #<(>screen_addr)
|
||||
sta VERA::ADDR+1 ; set row number
|
||||
stz VERA::ADDR+2
|
||||
lda #^screen_addr
|
||||
sta VERA::ADDR+2
|
||||
lda CURS_X ; get character column
|
||||
sec ; color attribute is second byte
|
||||
rol a
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;
|
||||
; 2016-02-28, Groepaz
|
||||
; 2020-04-30, Greg King
|
||||
; 2022-03-29, Greg King
|
||||
;
|
||||
; unsigned char cpeekrevers (void);
|
||||
; /* Return the reverse attribute from the current cursor position.
|
||||
@@ -11,8 +11,11 @@
|
||||
.export _cpeekrevers
|
||||
|
||||
.include "cx16.inc"
|
||||
.macpack generic
|
||||
|
||||
|
||||
screen_addr := $1B000 ; VRAM address of text screen
|
||||
|
||||
_cpeekrevers:
|
||||
php
|
||||
lda CURS_FLAG ; is the cursor currently off?
|
||||
@@ -25,8 +28,10 @@ _cpeekrevers:
|
||||
|
||||
@L1: stz VERA::CTRL ; use port 0
|
||||
lda CURS_Y
|
||||
add #<(>screen_addr)
|
||||
sta VERA::ADDR+1 ; set row number
|
||||
stz VERA::ADDR+2
|
||||
lda #^screen_addr
|
||||
sta VERA::ADDR+2
|
||||
lda CURS_X ; get character column
|
||||
asl a ; each character has two bytes
|
||||
sta VERA::ADDR
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
; empty file to prevent cbm/cpeeks.s being pulled into the cx16 lib
|
||||
|
||||
@@ -11,8 +11,11 @@
|
||||
.import gotoxy, PLOT
|
||||
|
||||
.include "cx16.inc"
|
||||
.macpack generic
|
||||
|
||||
|
||||
screen_addr := $1B000 ; VRAM address of text screen
|
||||
|
||||
; Move to a cursor position, then print a character.
|
||||
|
||||
_cputcxy:
|
||||
@@ -79,16 +82,17 @@ putchar:
|
||||
tax
|
||||
stz VERA::CTRL ; Use port 0
|
||||
lda CURS_Y
|
||||
add #<(>screen_addr)
|
||||
sta VERA::ADDR+1 ; Set row number
|
||||
lda #VERA::INC1 ; Address increments by one
|
||||
lda #VERA::INC1 | ^screen_addr ; Address increments by one
|
||||
sta VERA::ADDR+2
|
||||
ldy CURS_X ; Get character column into .Y
|
||||
tya
|
||||
asl a ; Each character has two bytes
|
||||
sta VERA::ADDR
|
||||
stx VERA::DATA0
|
||||
stx VERA::DATA0 ; Put the character
|
||||
lda CHARCOLOR
|
||||
sta VERA::DATA0
|
||||
sta VERA::DATA0 ; Put its colors
|
||||
rts
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
;
|
||||
; Start-up code for cc65 (CX16 r35 version)
|
||||
; Start-up code for cc65 (CX16 r39 version)
|
||||
;
|
||||
|
||||
.export _exit
|
||||
@@ -20,7 +20,7 @@
|
||||
.segment "STARTUP"
|
||||
|
||||
Start: tsx
|
||||
stx spsave ; Save the system stack ptr
|
||||
stx spsave ; Save the system stack ptr.
|
||||
|
||||
; Save space by putting some of the start-up code in the ONCE segment
|
||||
; which will be re-used by the BSS segment, the heap, and the C stack.
|
||||
@@ -46,26 +46,14 @@ _exit:
|
||||
|
||||
jsr donelib
|
||||
|
||||
.if 0 ; (We don't need to preserve zero-page space for cc65's variables.)
|
||||
; Copy back the zero-page stuff.
|
||||
|
||||
ldx #zpspace-1
|
||||
L2: lda zpsave,x
|
||||
sta sp,x
|
||||
dex
|
||||
bpl L2
|
||||
.endif
|
||||
|
||||
; Restore the system stuff.
|
||||
|
||||
ldx spsave
|
||||
txs ; Restore stack pointer
|
||||
ldx ramsave
|
||||
stx VIA1::PRA ; Restore former RAM bank
|
||||
lda VIA1::PRB
|
||||
and #<~$07
|
||||
ora #$04
|
||||
sta VIA1::PRB ; Change back to BASIC ROM
|
||||
stx RAM_BANK ; Restore former RAM bank
|
||||
lda #$04
|
||||
sta ROM_BANK ; Change back to BASIC ROM
|
||||
|
||||
; Back to BASIC.
|
||||
|
||||
@@ -79,26 +67,14 @@ L2: lda zpsave,x
|
||||
init:
|
||||
; Change from BASIC's ROM to Kernal's ROM.
|
||||
|
||||
lda VIA1::PRB
|
||||
and #<~$07
|
||||
sta VIA1::PRB
|
||||
stz ROM_BANK
|
||||
|
||||
; Change to the second RAM bank.
|
||||
|
||||
lda VIA1::PRA
|
||||
lda RAM_BANK
|
||||
sta ramsave ; Save the current RAM bank number
|
||||
lda #$01
|
||||
sta VIA1::PRA
|
||||
|
||||
.if 0 ; (We don't need to preserve zero-page space for cc65's variables.)
|
||||
; Save the zero-page locations that we need.
|
||||
|
||||
ldx #zpspace-1
|
||||
L1: lda sp,x
|
||||
sta zpsave,x
|
||||
dex
|
||||
bpl L1
|
||||
.endif
|
||||
sta RAM_BANK
|
||||
|
||||
; Set up the stack.
|
||||
|
||||
@@ -125,6 +101,3 @@ L1: lda sp,x
|
||||
ramsave:
|
||||
.res 1
|
||||
spsave: .res 1
|
||||
.if 0
|
||||
zpsave: .res zpspace
|
||||
.endif
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
; Standard joystick driver for the CX16.
|
||||
; May be installed multiple times when statically linked to an application.
|
||||
;
|
||||
; 2019-12-24, Greg King
|
||||
; 2021-04-07, Greg King
|
||||
;
|
||||
|
||||
.include "joy-kernel.inc"
|
||||
@@ -41,7 +41,7 @@
|
||||
; ------------------------------------------------------------------------
|
||||
; Constant
|
||||
|
||||
JOY_COUNT = 2 ; Number of joysticks we support
|
||||
JOY_COUNT = $05 ; Number of joysticks we support
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Data.
|
||||
@@ -51,8 +51,7 @@ JOY_COUNT = 2 ; Number of joysticks we support
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; INSTALL routine -- is called after the driver is loaded into memory.
|
||||
; If possible, check if the hardware is present, and determine the amount
|
||||
; of memory available.
|
||||
; If possible, check if the hardware is present.
|
||||
; Must return a JOY_ERR_xx code in .XA .
|
||||
|
||||
INSTALL:
|
||||
@@ -77,8 +76,10 @@ COUNT: lda #<JOY_COUNT
|
||||
; ------------------------------------------------------------------------
|
||||
; READ: Read a particular joystick passed in .A .
|
||||
|
||||
READ: and #%00000001
|
||||
jsr JOYSTICK_GET
|
||||
READ: cmp #JOY_COUNT
|
||||
blt :+
|
||||
lda #$00
|
||||
: jsr JOYSTICK_GET
|
||||
sta tmp1
|
||||
txa
|
||||
bit #%00001110 ; Is it NES or SNES controller?
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
;
|
||||
; 2020-01-08, Greg King
|
||||
; 2022-03-28, Greg King
|
||||
;
|
||||
; unsigned char kbhit (void);
|
||||
; /* Returns non-zero (true) if a typed character is waiting. */
|
||||
@@ -7,14 +7,11 @@
|
||||
|
||||
.export _kbhit
|
||||
|
||||
.include "cx16.inc"
|
||||
.import KBDBUF_PEEK
|
||||
|
||||
|
||||
.proc _kbhit
|
||||
ldy VIA1::PRA ; (KEY_COUNT is in RAM bank 0)
|
||||
stz VIA1::PRA
|
||||
lda KEY_COUNT ; Get number of characters
|
||||
sty VIA1::PRA
|
||||
tax ; High byte of return (only its zero/nonzero ...
|
||||
jsr KBDBUF_PEEK
|
||||
txa ; Low byte of return (only its zero/nonzero ...
|
||||
rts ; ... state matters)
|
||||
.endproc
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
;
|
||||
; 2020-04-27, Greg King
|
||||
; 2022-03-28, Greg King
|
||||
;
|
||||
; CX16 Kernal functions
|
||||
;
|
||||
|
||||
.include "cbm_kernal.inc"
|
||||
|
||||
.export KBDBUF_PEEK
|
||||
.export KBDBUF_GET_MODIFIERS
|
||||
.export KBDBUF_PUT
|
||||
.export I2C_READ_BYTE
|
||||
.export I2C_WRITE_BYTE
|
||||
.export CX_MONITOR
|
||||
.export ENTROPY_GET
|
||||
.export KEYBRD_BUF_PUT
|
||||
.export CONSOLE_SET_PAGE_MSG
|
||||
.export CONSOLE_PUT_IMAGE
|
||||
.export CONSOLE_INIT
|
||||
@@ -50,7 +55,7 @@
|
||||
.export CLOCK_GET_DATE_TIME
|
||||
.export JOYSTICK_SCAN
|
||||
.export JOYSTICK_GET
|
||||
.export SCREEN_SET_MODE
|
||||
.export SCREEN_MODE
|
||||
.export SCREEN_SET_CHARSET
|
||||
.export MOUSE_CONFIG
|
||||
.export MOUSE_GET
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
;
|
||||
; Driver for the Commander X16 Kernal's mouse driver.
|
||||
;
|
||||
; 2019-12-25, Greg King
|
||||
; 2022-03-28, Greg King
|
||||
;
|
||||
|
||||
.include "zeropage.inc"
|
||||
@@ -118,7 +118,8 @@ INSTALL:
|
||||
dex
|
||||
bpl @L1
|
||||
|
||||
ldx #$00 ; Don't change sprite's scale
|
||||
sec ; Get screen geometry
|
||||
jsr SCREEN_MODE
|
||||
lda #$01 ; Create sprite
|
||||
jsr MOUSE_CONFIG
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
;
|
||||
; Graphics driver for the 320 pixels across, 200 pixels down, 256 colors mode
|
||||
; Graphics driver for the 320 pixels across, 240 pixels down, 256 colors mode
|
||||
; on the Commander X16
|
||||
;
|
||||
; 2020-07-02, Greg King <gregdk@users.sf.net>
|
||||
; 2022-03-30, Greg King <gregdk@users.sf.net>
|
||||
;
|
||||
|
||||
.include "zeropage.inc"
|
||||
@@ -39,7 +39,7 @@
|
||||
.byte TGI_API_VERSION ; TGI API version number
|
||||
.addr $0000 ; Library reference
|
||||
.word 320 ; X resolution
|
||||
.word 200 ; Y resolution
|
||||
.word 240 ; Y resolution
|
||||
.byte <$0100 ; Number of drawing colors
|
||||
.byte 1 ; Number of screens available
|
||||
.byte 8 ; System font X size
|
||||
@@ -100,7 +100,7 @@ palette: .res $0100
|
||||
|
||||
bcolor := palette + 0 ; Background color
|
||||
color: .res 1 ; Stroke and fill index
|
||||
mode: .res 1 ; Old text mode
|
||||
text_mode: .res 1 ; Old text mode
|
||||
|
||||
.data
|
||||
|
||||
@@ -152,13 +152,15 @@ INIT: stz error ; #TGI_ERR_OK
|
||||
|
||||
; Save the current text mode.
|
||||
|
||||
lda SCREEN_MODE
|
||||
sta mode
|
||||
sec
|
||||
jsr SCREEN_MODE
|
||||
sta text_mode
|
||||
|
||||
; Switch into (320 x 200 x 256) graphics mode.
|
||||
; Switch into (320 x 240 x 256) graphics mode.
|
||||
|
||||
lda #GRAPH320
|
||||
jmp SCREEN_SET_MODE
|
||||
clc
|
||||
jmp SCREEN_MODE
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; DONE: Will be called to switch the graphics device back into text mode.
|
||||
@@ -168,16 +170,9 @@ INIT: stz error ; #TGI_ERR_OK
|
||||
; Must set an error code: NO
|
||||
|
||||
DONE:
|
||||
; Work around a prerelease 37 Kernal bug.
|
||||
; VERA (graphics) layer 0 isn't disabled by SCREEN_SET_MODE.
|
||||
|
||||
stz VERA::CTRL
|
||||
lda VERA::DISP::VIDEO
|
||||
and #<~VERA::DISP::ENABLE::LAYER0
|
||||
sta VERA::DISP::VIDEO
|
||||
|
||||
lda mode
|
||||
jmp SCREEN_SET_MODE
|
||||
lda text_mode
|
||||
clc
|
||||
jmp SCREEN_MODE
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; GETERROR: Return the error code in .A, and clear it.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user