mirror of https://github.com/cc65/cc65.git
Merge branch 'master' into silversurfer
This commit is contained in:
commit
9344c42329
|
@ -1,7 +1,23 @@
|
|||
|
||||
.PHONY: checkstyle tabs lastline spaces noexec
|
||||
ifneq ($(shell echo),)
|
||||
CMD_EXE = 1
|
||||
endif
|
||||
|
||||
checkstyle: tabs lastline spaces noexec
|
||||
ifdef CMD_EXE
|
||||
|
||||
.PHONY: checkstyle
|
||||
|
||||
checkstyle:
|
||||
$(info INFO: style checks require bash.)
|
||||
|
||||
else
|
||||
|
||||
.PHONY: checkstyle lineendings tabs lastline spaces noexec
|
||||
|
||||
checkstyle: lineendings tabs lastline spaces noexec
|
||||
|
||||
lineendings: lineendings.sh
|
||||
@./lineendings.sh
|
||||
|
||||
tabs: tabs.sh
|
||||
@./tabs.sh
|
||||
|
@ -14,3 +30,5 @@ spaces: spaces.sh
|
|||
|
||||
noexec: noexec.sh
|
||||
@./noexec.sh
|
||||
|
||||
endif
|
||||
|
|
|
@ -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 -IUl $'\r'`
|
||||
|
||||
cd $OLDCWD
|
||||
|
||||
if [ x"$FILES"x != xx ]; then
|
||||
echo "error: found CR in the following files:" >&2
|
||||
for n in $FILES; do
|
||||
echo $n >&2
|
||||
done
|
||||
exit -1
|
||||
fi
|
|
@ -19,7 +19,7 @@ jobs:
|
|||
- shell: bash
|
||||
run: git config --global core.autocrlf input
|
||||
- name: Checkout Source
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Do some simple style checks
|
||||
shell: bash
|
||||
|
@ -43,6 +43,11 @@ jobs:
|
|||
- name: Build the document files.
|
||||
shell: bash
|
||||
run: make -j2 doc
|
||||
- name: Upload a documents snapshot.
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: docs
|
||||
path: ./html
|
||||
- name: Build 64-bit Windows versions of the tools.
|
||||
run: |
|
||||
make -C src clean
|
||||
|
@ -57,7 +62,7 @@ jobs:
|
|||
run: git config --global core.autocrlf input
|
||||
|
||||
- name: Checkout Source
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Add msbuild to PATH
|
||||
uses: microsoft/setup-msbuild@v1.1
|
||||
|
|
|
@ -18,7 +18,7 @@ jobs:
|
|||
run: git config --global core.autocrlf input
|
||||
|
||||
- name: Checkout Source
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Add msbuild to PATH
|
||||
uses: microsoft/setup-msbuild@v1.1
|
||||
|
@ -44,7 +44,7 @@ jobs:
|
|||
- shell: bash
|
||||
run: git config --global core.autocrlf input
|
||||
- name: Checkout Source
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Do some simple style checks
|
||||
shell: bash
|
||||
|
@ -86,20 +86,24 @@ jobs:
|
|||
mv cc65.zip cc65-snapshot-win32.zip
|
||||
|
||||
- name: Upload a 32-bit Snapshot Zip
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: cc65-snapshot-win32.zip
|
||||
name: cc65-snapshot-win32
|
||||
path: cc65-snapshot-win32.zip
|
||||
- name: Upload a 64-bit Snapshot Zip
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: cc65-snapshot-win64.zip
|
||||
name: cc65-snapshot-win64
|
||||
path: cc65-snapshot-win64.zip
|
||||
|
||||
- name: Get the online documents repo.
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: cc65/doc
|
||||
# this token will expire, if it does, generate a new one as decribed in https://github.com/cc65/cc65/issues/2065
|
||||
# - apparently only a "classic" token works here
|
||||
# - the token must exist in the cc65/cc65 repo
|
||||
token: ${{ secrets.DOC_PAT }} # use secret token instead of default
|
||||
path: doc.git
|
||||
- name: Update the online documents.
|
||||
run: |
|
||||
|
@ -110,11 +114,19 @@ jobs:
|
|||
git config user.email "cc65.nomail@github.com"
|
||||
git config push.default simple
|
||||
git add -A
|
||||
git commit -m "Updated from cc65 commit ${GITHUB_SHA}."
|
||||
#git push -v
|
||||
# prevent failure when there is nothing to commit
|
||||
git diff-index --quiet HEAD || git commit -m "Updated from https://github.com/cc65/cc65/commit/${GITHUB_SHA}"
|
||||
git push
|
||||
- name: Package offline documents.
|
||||
run: 7z a cc65-snapshot-docs.zip ./html/*.*
|
||||
- name: Upload a Documents Snapshot Zip
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: cc65-snapshot-docs
|
||||
path: cc65-snapshot-docs.zip
|
||||
|
||||
# enter secrets under "repository secrets"
|
||||
- name: Upload snapshot to sourceforge
|
||||
- name: Upload 32-bit Windows snapshot to sourceforge
|
||||
uses: nogsantos/scp-deploy@master
|
||||
with:
|
||||
src: cc65-snapshot-win32.zip
|
||||
|
@ -123,5 +135,14 @@ jobs:
|
|||
port: ${{ secrets.SSH_PORT }}
|
||||
user: ${{ secrets.SSH_USER }}
|
||||
key: ${{ secrets.SSH_KEY }}
|
||||
- name: Upload documents snapshot to sourceforge
|
||||
uses: nogsantos/scp-deploy@master
|
||||
with:
|
||||
src: cc65-snapshot-docs.zip
|
||||
host: ${{ secrets.SSH_HOST }}
|
||||
remote: ${{ secrets.SSH_DIR }}
|
||||
port: ${{ secrets.SSH_PORT }}
|
||||
user: ${{ secrets.SSH_USER }}
|
||||
key: ${{ secrets.SSH_KEY }}
|
||||
|
||||
# TODO: Publish snapshot zip at https://github.com/cc65/cc65.github.io
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
name: Windows Test Scheduled
|
||||
# Scheduled or manually dispatched because it's slower than the Linux test.
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0 */1 * *'
|
||||
# every 1 days
|
||||
workflow_dispatch:
|
||||
# allow manual dispatch
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
# don't run more than once at a time
|
||||
|
||||
jobs:
|
||||
build_windows:
|
||||
name: Build, Test (Windows MSVC)
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
|
||||
# This cache is used to remember the last build.
|
||||
# If there are no changes and the last build was successful,
|
||||
# the build and test steps will be omitted.
|
||||
# If the last build failed, the full attempt will be repeated.
|
||||
# Github Actions will retain the last build cache for up to 7 days.
|
||||
|
||||
- name: Create Cache
|
||||
shell: bash
|
||||
run: mkdir ~/.cache-sha
|
||||
|
||||
- name: Cache SHA
|
||||
uses: actions/cache@v3
|
||||
id: check-sha
|
||||
with:
|
||||
path: ~/.cache-sha
|
||||
key: cache-sha-wintest-${{ github.sha }}
|
||||
|
||||
- name: Git Setup
|
||||
if: steps.check-sha.outputs.cache-hit != 'true'
|
||||
shell: bash
|
||||
run: git config --global core.autocrlf input
|
||||
|
||||
- name: Checkout source
|
||||
if: steps.check-sha.outputs.cache-hit != 'true'
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Add msbuild to PATH
|
||||
if: steps.check-sha.outputs.cache-hit != 'true'
|
||||
uses: microsoft/setup-msbuild@v1.1
|
||||
|
||||
- name: Build app (MSVC debug)
|
||||
if: steps.check-sha.outputs.cache-hit != 'true'
|
||||
run: msbuild src\cc65.sln -t:rebuild -property:Configuration=Debug
|
||||
|
||||
- name: Build app (MSVC release)
|
||||
if: steps.check-sha.outputs.cache-hit != 'true'
|
||||
run: msbuild src\cc65.sln -t:rebuild -property:Configuration=Release
|
||||
|
||||
- name: Build utils (MinGW)
|
||||
if: steps.check-sha.outputs.cache-hit != 'true'
|
||||
shell: cmd
|
||||
run: make -j2 util SHELL=cmd
|
||||
|
||||
- name: Build the platform libraries (make lib)
|
||||
if: steps.check-sha.outputs.cache-hit != 'true'
|
||||
shell: cmd
|
||||
run: make -j2 lib QUIET=1 SHELL=cmd
|
||||
|
||||
- name: Run the regression tests (make test)
|
||||
if: steps.check-sha.outputs.cache-hit != 'true'
|
||||
shell: cmd
|
||||
run: make test QUIET=1 SHELL=cmd
|
||||
|
||||
- name: Test that the samples can be built (make samples)
|
||||
if: steps.check-sha.outputs.cache-hit != 'true'
|
||||
shell: cmd
|
||||
run: make -j2 samples SHELL=cmd
|
138
Contributing.md
138
Contributing.md
|
@ -8,11 +8,16 @@ This document contains all kinds of information that you should know if you want
|
|||
|
||||
* You must obey these rules when contributing new code or documentation to cc65. We are well aware that not all existing code may respect all rules outlined here - but this is no reason for you not to respect them.
|
||||
* One commit/patch/PR per issue. Do not mix several things unless they are very closely related.
|
||||
* Sometimes when you make a PR, it may break completely unrelated tests. However, any PR is expected to merge cleanly with no failures. That means in practise that you are expected to fix/update the failing tests if required - for example this might be needed if you make changes to the compiler that changes the format of error- or warning messages. In that case you might have to update some reference files in the testbench. Obviously still check if that is actually the right thing to do ;)
|
||||
|
||||
# Codestyle rules
|
||||
|
||||
## All Sources
|
||||
|
||||
### Line endings
|
||||
|
||||
All files must only contain Unix style 'LF' line endings. Please configure your editors accordingly.
|
||||
|
||||
### TABs and spaces
|
||||
|
||||
This is an ongoing controversial topic - everyone knows that. However, the following is how we do it :)
|
||||
|
@ -24,9 +29,22 @@ This is an ongoing controversial topic - everyone knows that. However, the follo
|
|||
|
||||
The (bash) scripts used to check the above rules can be found in ```.github/check```. You can also run all checks using ```make check```.
|
||||
|
||||
### identifiers and symbol names
|
||||
### Identifiers and Symbol names
|
||||
|
||||
* any symbols that are exported from source files and/or appear in header files should not be in the "_symbol" form in C, or "__symbol" form in assembly. This way we evade the problem that "_symbol" may or may not be reserved by that standard.
|
||||
The C Standard defines certain identifiers and symbol names, which we can not use
|
||||
in our code. Since it is not always obvious which parts of the library code will
|
||||
actually end up in a linked program, the following applies to ALL of the library.
|
||||
|
||||
Any non standard identifier/symbol/function that is exported from source files,
|
||||
or appears in header files:
|
||||
|
||||
* must not be in the "_symbol" form in C, or "__symbol" form in assembly.
|
||||
* must start with (at least) two (C Code) or three (assembly code) underscores, unless the symbol appears in a non standard header file.
|
||||
|
||||
This is likely more than the standard dictates us to do - but it is certainly
|
||||
standard compliant - and easy to remember.
|
||||
|
||||
Also see the discussion in https://github.com/cc65/cc65/issues/1796
|
||||
|
||||
### misc
|
||||
|
||||
|
@ -56,10 +74,12 @@ color := $0787
|
|||
|
||||
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.
|
||||
* Your files should generally obey the C89 standard, with a few C99 things (this is a bit similar to what cc65 itself supports). The exceptions are:
|
||||
* use stdint.h for variables that require a certain bit size
|
||||
* In printf-style functions use the PRIX64 (and similar) macros to deal with 64bit values (from inttypes.h)
|
||||
This list is not necessarily complete - if in doubt, please ask.
|
||||
* We generally have a "no warnings" policy
|
||||
* Warnings must not be hidden by using typecasts - fix the code instead
|
||||
* In printf-style functions use the PRIX64 (and similar) macros to deal with 64bit values
|
||||
* Warnings must not be hidden by using typecasts - fix the code instead
|
||||
* The normal indentation width should be four spaces.
|
||||
* You must use ANSI C comments (```/* */```); you must not use C++ comments (```//```).
|
||||
* When you add functions to an existing file, you should separate them by the same number of blank lines that separate the functions that already are in that file.
|
||||
|
@ -116,7 +136,22 @@ You can refer to Annex B of the ISO C99 standard ([here](https://www.open-std.or
|
|||
* 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.)
|
||||
* If a function is declared to return a char-sized value, it actually must return an integer-sized value. (When cc65 promotes a returned value, it sometimes assumes that the value already is an integer.) This must be done in one of the following ways:
|
||||
<pre>
|
||||
lda #RETURN_VALUE
|
||||
ldx #0 ; return value is char
|
||||
</pre>
|
||||
or, if the value is 0, you can use:
|
||||
<pre>
|
||||
lda #RETURN_VALUE
|
||||
.assert RETURN_VALUE = 0
|
||||
tax
|
||||
</pre>
|
||||
sometimes jumping to return0 could save a byte:
|
||||
<pre>
|
||||
.assert RETURN_VALUE = 0
|
||||
jmp return 0
|
||||
</pre>
|
||||
* Functions, that are intended for a platform's system library, should be optimized as much as possible.
|
||||
* Sometimes, there must be a trade-off between size and speed. If you think that a library function won't be used often, then you should make it small. Otherwise, you should make it fast.
|
||||
* Comments that are put on the right side of instructions must be aligned (start in the same character columns).
|
||||
|
@ -163,12 +198,97 @@ The only exception to the above are actions that are exclusive to the github act
|
|||
|
||||
* 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
|
||||
|
||||
## Floating point support
|
||||
## Compiler
|
||||
|
||||
The first step is implementing the datatype "float" as IEEE488 floats. Help welcomed!
|
||||
* We need a way that makes it possible to feed arbitrary assembler code into the optimzer, so we can have proper tests for it
|
||||
|
||||
### Floating point support
|
||||
|
||||
The first step is implementing the datatype "float" as IEEE 754 floats. Help welcomed!
|
||||
|
||||
* WIP compiler/library changes are here: https://github.com/cc65/cc65/pull/1777
|
||||
* free software library with testbench is here: http://www.jhauser.us/arithmetic/
|
||||
|
||||
## Library
|
||||
|
||||
### name clashes in the library
|
||||
|
||||
see "Identifiers and Symbol names" above - not all identifiers have been checked
|
||||
and renamed yet. The following is a list of those that still might need to be
|
||||
fixed:
|
||||
|
||||
```
|
||||
common
|
||||
|
||||
__argc libsrc/runtime/callmain.s libsrc/cbm610/mainargs.s libsrc/cx16/mainargs.s libsrc/plus4/mainargs.s libsrc/lynx/mainargs.s libsrc/c16/mainargs.s libsrc/geos-common/system/mainargs.s libsrc/sim6502/mainargs.s libsrc/c128/mainargs.s libsrc/vic20/mainargs.s libsrc/nes/mainargs.s libsrc/atari/getargs.s libsrc/apple2/mainargs.s libsrc/cbm510/mainargs.s libsrc/telestrat/mainargs.s libsrc/c64/mainargs.s libsrc/pet/mainargs.s libsrc/atmos/mainargs.s
|
||||
__argv libsrc/runtime/callmain.s libsrc/cbm610/mainargs.s libsrc/cx16/mainargs.s libsrc/plus4/mainargs.s libsrc/lynx/mainargs.s libsrc/c16/mainargs.s libsrc/geos-common/system/mainargs.s libsrc/sim6502/mainargs.s libsrc/c128/mainargs.s libsrc/vic20/mainargs.s libsrc/nes/mainargs.s libsrc/atari/getargs.s libsrc/apple2/mainargs.s libsrc/cbm510/mainargs.s libsrc/telestrat/mainargs.s libsrc/c64/mainargs.s libsrc/pet/mainargs.s libsrc/atmos/mainargs.s
|
||||
__cos libsrc/common/sincos.s
|
||||
__ctypeidx libsrc/common/ctype.s libsrc/common/ctypemask.s libsrc/geos-common/system/ctype.s libsrc/atari/ctype.s libsrc/cbm/ctype.s libsrc/atmos/ctype.s asminc/ctype_common.inc
|
||||
__cwd libsrc/common/getcwd.s libsrc/common/_cwd.s libsrc/atari/initcwd.s libsrc/apple2/initcwd.s libsrc/apple2/initcwd.s libsrc/telestrat/initcwd.s libsrc/cbm/initcwd.s
|
||||
__cwd_buf_size libsrc/common/_cwd.s
|
||||
__envcount libsrc/common/searchenv.s libsrc/common/_environ.s libsrc/common/putenv.s libsrc/common/getenv.s
|
||||
__environ libsrc/common/searchenv.s libsrc/common/_environ.s libsrc/common/putenv.s libsrc/common/getenv.s
|
||||
__envsize libsrc/common/_environ.s libsrc/common/putenv.s
|
||||
__fdesc libsrc/common/_fdesc.s libsrc/common/fopen.s
|
||||
__filetab libsrc/common/_fdesc.s libsrc/common/_file.s asminc/_file.inc
|
||||
__fopen libsrc/common/fopen.s libsrc/common/_fopen.s
|
||||
__printf libsrc/common/vsnprintf.s libsrc/common/_printf.s libsrc/common/vfprintf.s libsrc/conio/vcprintf.s libsrc/pce/_printf.s
|
||||
__scanf libsrc/common/_scanf.inc libsrc/common/vsscanf.s libsrc/conio/vcscanf.s
|
||||
__sin libsrc/common/sincos.s
|
||||
__sys libsrc/common/_sys.s libsrc/apple2/_sys.s
|
||||
__sys_oserrlist libsrc/common/stroserr.s libsrc/geos-common/system/oserrlist.s libsrc/atari/oserrlist.s libsrc/apple2/oserrlist.s libsrc/cbm/oserrlist.s libsrc/atmos/oserrlist.s
|
||||
__syschdir libsrc/common/chdir.s libsrc/atari/syschdir.s libsrc/apple2/syschdir.s libsrc/telestrat/syschdir.s libsrc/cbm/syschdir.s
|
||||
__sysmkdir libsrc/common/mkdir.s libsrc/atari/sysmkdir.s libsrc/apple2/sysmkdir.s libsrc/telestrat/sysmkdir.s
|
||||
__sysremove libsrc/common/remove.s libsrc/geos-common/file/sysremove.s libsrc/atari/sysremove.s libsrc/atari/sysrmdir.s libsrc/apple2/sysremove.s libsrc/apple2/sysrmdir.s libsrc/telestrat/sysremove.s libsrc/cbm/sysremove.s
|
||||
__sysrename libsrc/common/rename.s libsrc/geos-common/file/sysrename.s libsrc/atari/sysrename.s libsrc/apple2/sysrename.s libsrc/cbm/sysrename.s
|
||||
__sysrmdir libsrc/common/rmdir.s libsrc/atari/sysrmdir.s libsrc/apple2/sysrmdir.s
|
||||
__sysuname libsrc/common/uname.s libsrc/cbm610/sysuname.s libsrc/cx16/sysuname.s libsrc/plus4/sysuname.s libsrc/lynx/sysuname.s libsrc/c16/sysuname.s libsrc/geos-common/system/sysuname.s libsrc/c128/sysuname.s libsrc/creativision/sysuname.s libsrc/vic20/sysuname.s libsrc/nes/sysuname.s libsrc/atari/sysuname.s libsrc/apple2/sysuname.s libsrc/cbm510/sysuname.s libsrc/telestrat/sysuname.s libsrc/c64/sysuname.s libsrc/pet/sysuname.s libsrc/atari5200/sysuname.s libsrc/atmos/sysuname.s
|
||||
|
||||
apple2
|
||||
|
||||
__auxtype libsrc/apple2/open.s
|
||||
__datetime libsrc/apple2/open.s
|
||||
__dos_type libsrc/apple2/dioopen.s libsrc/apple2/curdevice.s libsrc/apple2/mainargs.s libsrc/apple2/settime.s libsrc/apple2/getdevice.s libsrc/apple2/dosdetect.s libsrc/apple2/irq.s libsrc/apple2/open.s libsrc/apple2/mli.s libsrc/apple2/getres.s
|
||||
__filetype libsrc/apple2/open.s libsrc/apple2/exehdr.s
|
||||
|
||||
|
||||
atari
|
||||
|
||||
__defdev libsrc/atari/posixdirent.s libsrc/atari/ucase_fn.s libsrc/atari/getdefdev.s
|
||||
__dos_type libsrc/atari/getargs.s libsrc/atari/exec.s libsrc/atari/settime.s libsrc/atari/syschdir.s libsrc/atari/dosdetect.s libsrc/atari/is_cmdline_dos.s libsrc/atari/sysrmdir.s libsrc/atari/gettime.s libsrc/atari/lseek.s libsrc/atari/getres.s libsrc/atari/getdefdev.s
|
||||
__do_oserror libsrc/atari/posixdirent.s libsrc/atari/do_oserr.s libsrc/atari/serref.s libsrc/atari/read.s libsrc/atari/write.s libsrc/atari/close.s
|
||||
__getcolor libsrc/atari/setcolor.s
|
||||
__getdefdev libsrc/atari/getdefdev.s
|
||||
__graphics libsrc/atari/graphics.s
|
||||
__inviocb libsrc/atari/serref.s libsrc/atari/ser/atrrdev.s libsrc/atari/inviocb.s libsrc/atari/read.s libsrc/atari/write.s libsrc/atari/lseek.s libsrc/atari/close.s
|
||||
__is_cmdline_dos libsrc/atari/is_cmdline_dos.s libsrc/atari/doesclrscr.s
|
||||
__rest_vecs libsrc/atari/savevec.s
|
||||
__rwsetup libsrc/atari/rwcommon.s libsrc/atari/read.s libsrc/atari/write.s
|
||||
__save_vecs libsrc/atari/savevec.s
|
||||
__scroll libsrc/atari/scroll.s
|
||||
__setcolor libsrc/atari/setcolor.s
|
||||
__setcolor_low libsrc/atari/setcolor.s
|
||||
__sio_call libsrc/atari/diowritev.s libsrc/atari/diopncls.s libsrc/atari/siocall.s libsrc/atari/diowrite.s libsrc/atari/dioread.s
|
||||
|
||||
|
||||
cbm
|
||||
|
||||
__cbm_filetype libsrc/cbm/cbm_filetype.s asminc/cbm_filetype.in
|
||||
__dirread libsrc/cbm/dir.inc libsrc/cbm/dir.s
|
||||
__dirread1 libsrc/cbm/dir.inc libsrc/cbm/dir.s
|
||||
|
||||
|
||||
lynx
|
||||
|
||||
__iodat libsrc/lynx/lynx-cart.s libsrc/lynx/bootldr.s libsrc/lynx/extzp.s libsrc/lynx/crt0.s libsrc/lynx/extzp.inc
|
||||
__iodir libsrc/lynx/extzp.s libsrc/lynx/crt0.s libsrc/lynx/extzp.inc
|
||||
__sprsys libsrc/lynx/tgi/lynx-160-102-16.s libsrc/lynx/extzp.s libsrc/lynx/crt0.s libsrc/lynx/extzp.inc
|
||||
__viddma libsrc/lynx/tgi/lynx-160-102-16.s libsrc/lynx/extzp.s libsrc/lynx/crt0.s libsrc/lynx/extzp.inc
|
||||
|
||||
|
||||
pce
|
||||
|
||||
__nmi libsrc/pce/irq.s libsrc/pce/crt0.s
|
||||
```
|
||||
|
||||
## Test suite
|
||||
|
||||
|
|
4
Makefile
4
Makefile
|
@ -21,7 +21,7 @@ mostlyclean clean:
|
|||
avail unavail bin:
|
||||
@$(MAKE) -C src --no-print-directory $@
|
||||
|
||||
lib:
|
||||
lib libtest:
|
||||
@$(MAKE) -C libsrc --no-print-directory $@
|
||||
|
||||
doc html info:
|
||||
|
@ -43,7 +43,7 @@ util:
|
|||
checkstyle:
|
||||
@$(MAKE) -C .github/checks --no-print-directory $@
|
||||
|
||||
# simple "test" target, only run regression tests for c64 target
|
||||
# runs regression tests, requires libtest target libraries
|
||||
test:
|
||||
@$(MAKE) -C test --no-print-directory $@
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ Core team members:
|
|||
* [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
|
||||
* [groepaz](https://github.com/mrdudz): CBM library, Project Maintainer
|
||||
* [Oliver Schmidt](https://github.com/oliverschmidt): Apple II library Maintainer
|
||||
|
||||
External contributors:
|
||||
|
@ -23,6 +23,7 @@ External contributors:
|
|||
* [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
|
||||
* [Dave Plummer](https://github.com/davepl): KIM-1 target
|
||||
|
||||
*(The above list is incomplete, if you feel left out - please speak up or add yourself in a PR)*
|
||||
|
||||
|
|
|
@ -28,8 +28,8 @@ HEAP_MIN_BLOCKSIZE = .sizeof (freeblock) ; Minimum size of an allocated block
|
|||
HEAP_ADMIN_SPACE = .sizeof (usedblock) ; Additional space for used bock
|
||||
|
||||
; Variables
|
||||
.global __heaporg
|
||||
.global __heapptr
|
||||
.global __heapend
|
||||
.global __heapfirst
|
||||
.global __heaplast
|
||||
.global ___heaporg
|
||||
.global ___heapptr
|
||||
.global ___heapend
|
||||
.global ___heapfirst
|
||||
.global ___heaplast
|
||||
|
|
|
@ -239,12 +239,12 @@ BASIC_BUF := $0200 ; Location of command-line
|
|||
BASIC_BUF_LEN = 81 ; Maximum length of command-line
|
||||
|
||||
SCREEN_PTR := $0262 ; Pointer to current row on text screen (16 bits)
|
||||
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
|
||||
STATUS := $0287 ; Status from previous I/O operation
|
||||
IN_DEV := $028B ; Current input device number
|
||||
OUT_DEV := $028C ; Current output device number
|
||||
FNAM_LEN := $028F ; Length of filename
|
||||
SECADR := $0291 ; Secondary address
|
||||
DEVNUM := $0292 ; Device number
|
||||
CURS_COLOR := $0373 ; Color under the cursor
|
||||
CHARCOLOR := $0376 ; Cursor's color nybbles (high: background, low: foreground)
|
||||
RVS := $0377 ; Reverse flag
|
||||
|
@ -258,8 +258,8 @@ LLEN := $0386 ; Line length
|
|||
NLINES := $0387 ; Number of screen lines
|
||||
|
||||
; BASIC
|
||||
VARTAB := $03E2 ; Pointer to start of BASIC variables
|
||||
MEMSIZE := $03EA ; Pointer to highest BASIC RAM location (+1)
|
||||
VARTAB := $03E1 ; Pointer to start of BASIC variables
|
||||
MEMSIZE := $0259 ; Pointer to highest BASIC RAM location (+1)
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Vector and other locations
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
|
||||
; Variables and functions
|
||||
|
||||
.global __errno, __oserror
|
||||
.global __osmaperrno
|
||||
.global __seterrno
|
||||
.global __directerrno, __mappederrno
|
||||
.global ___errno, ___oserror
|
||||
.global ___osmaperrno
|
||||
.global ___seterrno
|
||||
.global ___directerrno, ___mappederrno
|
||||
|
||||
; Error codes, must match the values in the C headers
|
||||
.enum
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
; ---------------------------------------------------------------------------
|
||||
;
|
||||
; KIM-1 definitions
|
||||
;
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
RAMSTART := $0200 ; Entry point
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Monitor Functions
|
||||
; ---------------------------------------------------------------------------
|
||||
OUTCHR := $1EA0 ; Output character
|
||||
INTCHR := $1E5A ; Input character without case conversion
|
||||
DUMPT := $1800 ; Dump memory to tape
|
||||
LOADT := $1873 ; Load memory from tape
|
||||
START := $1C4F ; Enter KIM-1 monitor
|
||||
SCANDS := $1F1F ; Scan 7-segment display
|
||||
KEYIN := $1F40 ; Open up keyboard channel
|
||||
GETKEY := $1F6A ; Return key from keyboard
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; System Memory
|
||||
; ---------------------------------------------------------------------------
|
||||
SAL := $17F5 ; Tape load address low
|
||||
SAH := $17F6 ; Tape load address high
|
||||
EAL := $17F7 ; Tape address end low
|
||||
EAH := $17F8 ; Tape address end high
|
||||
ID := $17F9 ; Tape Identification number
|
|
@ -49,8 +49,8 @@ SIGCOUNT = 6 ; Number of signals
|
|||
.global sigtable
|
||||
|
||||
; Function declarations
|
||||
.global __sig_ign
|
||||
.global __sig_dfl
|
||||
.global ___sig_ign
|
||||
.global ___sig_dfl
|
||||
.global _signal
|
||||
.global _raise
|
||||
|
||||
|
|
|
@ -277,6 +277,8 @@ XRECLK = $3C ; Reset clock
|
|||
XCLCL = $3D ; Close clock
|
||||
XWRCLK = $3E ; Displays clock in the address in A & Y registers
|
||||
|
||||
XFSEEK = $3F ; Only in Orix
|
||||
|
||||
; Sound primitives
|
||||
XSONPS = $40 ; Send data to PSG register (14 values)
|
||||
XOUPS = $42 ; Send Oups sound into PSG
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
# kim1-60k.cfg (4k)
|
||||
#
|
||||
# for expanded KIM-1
|
||||
#
|
||||
# ld65 --config kim1-60k.cfg -o <prog>.bin <prog>.o
|
||||
|
||||
FEATURES {
|
||||
STARTADDRESS: default = $2000;
|
||||
CONDES: segment = STARTUP,
|
||||
type = constructor,
|
||||
label = __CONSTRUCTOR_TABLE__,
|
||||
count = __CONSTRUCTOR_COUNT__;
|
||||
CONDES: segment = STARTUP,
|
||||
type = destructor,
|
||||
label = __DESTRUCTOR_TABLE__,
|
||||
count = __DESTRUCTOR_COUNT__;
|
||||
}
|
||||
|
||||
SYMBOLS {
|
||||
__STACKSIZE__: type = weak, value = $0080; # 128 byte program stack
|
||||
__STARTADDRESS__: type = export, value = %S;
|
||||
}
|
||||
|
||||
MEMORY {
|
||||
ZP: file = %O, define = yes, start = $0000, size = $00EE;
|
||||
CPUSTACK: file = "", define = yes, start = $0100, size = $0100;
|
||||
RAM: file = %O, define = yes, start = %S, size = $E000 - %S - __STACKSIZE__;
|
||||
MAINROM: file = "", define = yes, start = $E000, size = $1000;
|
||||
TOP: file = "", define = yes, start = $F000, size = $1000;
|
||||
}
|
||||
|
||||
SEGMENTS {
|
||||
ZEROPAGE: load = ZP, type = zp, define = yes;
|
||||
STARTUP: load = RAM, type = ro, define = yes;
|
||||
CODE: load = RAM, type = ro, define = yes;
|
||||
RODATA: load = RAM, type = ro, define = yes;
|
||||
ONCE: load = RAM, type = ro, define = yes;
|
||||
DATA: load = RAM, type = rw, define = yes;
|
||||
BSS: load = RAM, type = bss, define = yes;
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
# kim1.cfg (4k)
|
||||
#
|
||||
# for unexpanded KIM-1
|
||||
#
|
||||
# ld65 --config kim1.cfg -o <prog>.bin <prog>.o
|
||||
|
||||
FEATURES {
|
||||
STARTADDRESS: default = $0200;
|
||||
CONDES: segment = STARTUP,
|
||||
type = constructor,
|
||||
label = __CONSTRUCTOR_TABLE__,
|
||||
count = __CONSTRUCTOR_COUNT__;
|
||||
CONDES: segment = STARTUP,
|
||||
type = destructor,
|
||||
label = __DESTRUCTOR_TABLE__,
|
||||
count = __DESTRUCTOR_COUNT__;
|
||||
}
|
||||
|
||||
SYMBOLS {
|
||||
__STACKSIZE__: type = weak, value = $0080; # 128 byte program stack
|
||||
__STARTADDRESS__: type = export, value = %S;
|
||||
}
|
||||
|
||||
MEMORY {
|
||||
ZP: file = %O, define = yes, start = $0000, size = $00EE;
|
||||
CPUSTACK: file = "", define = yes, start = $0100, size = $0100;
|
||||
RAM: file = %O, define = yes, start = %S, size = $1000 - %S - __STACKSIZE__;
|
||||
MAINROM: file = "", define = yes, start = $E000, size = $1000;
|
||||
TOP: file = "", define = yes, start = $F000, size = $1000;
|
||||
}
|
||||
|
||||
SEGMENTS {
|
||||
ZEROPAGE: load = ZP, type = zp, define = yes;
|
||||
STARTUP: load = RAM, type = ro, define = yes;
|
||||
CODE: load = RAM, type = ro, define = yes;
|
||||
RODATA: load = RAM, type = ro, define = yes;
|
||||
ONCE: load = RAM, type = ro, define = yes;
|
||||
DATA: load = RAM, type = rw, define = yes;
|
||||
BSS: load = RAM, type = bss, define = yes;
|
||||
}
|
||||
|
|
@ -332,6 +332,7 @@ See the <url url="funcref.html" name="function reference"> for declaration and u
|
|||
<item>_scroll
|
||||
<item>_setcolor
|
||||
<item>_setcolor_low
|
||||
<item>_sound
|
||||
<item>waitvsync
|
||||
</itemize>
|
||||
|
||||
|
|
146
doc/ca65.sgml
146
doc/ca65.sgml
|
@ -125,6 +125,7 @@ Long options:
|
|||
--target sys Set the target system
|
||||
--verbose Increase verbosity
|
||||
--version Print the assembler version
|
||||
--warnings-as-errors Treat warnings as errors
|
||||
---------------------------------------------------------------------------
|
||||
</verb></tscreen>
|
||||
|
||||
|
@ -183,7 +184,7 @@ Here is a description of all the command line options:
|
|||
|
||||
Enable an emulation feature. This is identical as using <tt/.FEATURE/
|
||||
in the source with two exceptions: Feature names must be lower case, and
|
||||
each feature must be specified by using an extra <tt/--feature/ option,
|
||||
each feature must be specified by using a separate <tt/--feature/ option,
|
||||
comma separated lists are not allowed.
|
||||
|
||||
See the discussion of the <tt><ref id=".FEATURE" name=".FEATURE"></tt>
|
||||
|
@ -359,6 +360,13 @@ Here is a description of all the command line options:
|
|||
warning level is 1, and it would probably be silly to set it to
|
||||
something lower.
|
||||
|
||||
|
||||
<label id="option--warnings-as-errors">
|
||||
<tag><tt>--warnings-as-errors</tt></tag>
|
||||
|
||||
An error will be generated if any warnings were produced.
|
||||
|
||||
|
||||
</descrip>
|
||||
<p>
|
||||
|
||||
|
@ -431,6 +439,15 @@ The assembler accepts
|
|||
<tt><ref id=".P4510" name=".P4510"></tt> command was given).
|
||||
</itemize>
|
||||
|
||||
On 6502-derived platforms the <tt/BRK/ instruction has an optional signature
|
||||
byte. If omitted, the assembler will only produce only 1 byte.
|
||||
|
||||
<tscreen><verb>
|
||||
brk ; 1-byte: $00
|
||||
brk $34 ; 2-bytes: $00 $34
|
||||
brk #$34 ; 2-bytes: $00 $34
|
||||
</verb></tscreen>
|
||||
|
||||
|
||||
<sect1>65816 mode<p>
|
||||
|
||||
|
@ -448,6 +465,17 @@ mnemonics:
|
|||
<item><tt>TSA</tt> is an alias for <tt>TSC</tt>
|
||||
</itemize>
|
||||
|
||||
The <tt/MVN/ and <tt/MVP/ instructions accept two different argument forms.
|
||||
Either two bank bytes may be given with a <tt/#/ prefix,
|
||||
or two far addresses whose high byte will be used.
|
||||
|
||||
<tscreen><verb>
|
||||
mvn #^src, #^dst ; bank of src to bank of dst
|
||||
mvn src, dst ; bank of src to bank of dst
|
||||
mvp #$12, #$78 ; bank $12 to $78
|
||||
mvp $123456, $789ABC ; bank $12 to $78
|
||||
</verb></tscreen>
|
||||
|
||||
|
||||
<sect1>6502X mode<label id="6502X-mode"><p>
|
||||
|
||||
|
@ -1381,10 +1409,6 @@ either a string or an expression value.
|
|||
.endmacro
|
||||
</verb></tscreen>
|
||||
|
||||
This command is new and must be enabled with the <tt/.FEATURE addrsize/ command.
|
||||
|
||||
See: <tt><ref id=".FEATURE" name=".FEATURE"></tt>
|
||||
|
||||
|
||||
<sect1><tt>.BANK</tt><label id=".BANK"><p>
|
||||
|
||||
|
@ -2019,7 +2043,7 @@ Here's a list of all control commands and a description, what they do:
|
|||
|
||||
<sect1><tt>.A16</tt><label id=".A16"><p>
|
||||
|
||||
Valid only in 65816 mode. Switch the accumulator to 16 bit.
|
||||
Valid only in 65816 mode. Assume the accumulator is 16 bit.
|
||||
|
||||
Note: This command will not emit any code, it will tell the assembler to
|
||||
create 16 bit operands for immediate accumulator addressing mode.
|
||||
|
@ -2029,7 +2053,7 @@ Here's a list of all control commands and a description, what they do:
|
|||
|
||||
<sect1><tt>.A8</tt><label id=".A8"><p>
|
||||
|
||||
Valid only in 65816 mode. Switch the accumulator to 8 bit.
|
||||
Valid only in 65816 mode. Assume the accumulator is 8 bit.
|
||||
|
||||
Note: This command will not emit any code, it will tell the assembler to
|
||||
create 8 bit operands for immediate accu addressing mode.
|
||||
|
@ -2112,15 +2136,15 @@ Here's a list of all control commands and a description, what they do:
|
|||
</verb></tscreen>
|
||||
|
||||
the assembler will force a segment alignment to the least common multiple of
|
||||
15, 18 and 251 - which is 22590. To protect the user against errors, the
|
||||
assembler will issue a warning when the combined alignment exceeds 256. The
|
||||
command line option <tt><ref id="option--large-alignment"
|
||||
name="--large-alignment"></tt> will disable this warning.
|
||||
15, 18 and 251 - which is 22590. To protect the user against errors, when the
|
||||
combined alignment is larger than the explicitly requested alignments,
|
||||
the assembler will issue a warning if it also exceeds 256. The command line
|
||||
option <tt><ref id="option--large-alignment" name="--large-alignment"></tt>
|
||||
will disable this warning.
|
||||
|
||||
Please note that with alignments that are a power of two (which were the
|
||||
only alignments possible in older versions of the assembler), the problem is
|
||||
less severe, because the least common multiple of powers to the same base is
|
||||
always the larger one.
|
||||
Please note that with only alignments that are a power of two, a warning will
|
||||
never occur, because the least common multiple of powers to the same base is
|
||||
always simply the larger one.
|
||||
|
||||
|
||||
|
||||
|
@ -2255,7 +2279,7 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
|
|||
Switch on or off case sensitivity on identifiers. The default is off
|
||||
(that is, identifiers are case sensitive), but may be changed by the
|
||||
-i switch on the command line.
|
||||
The command must be followed by a '+' or '-' character to switch the
|
||||
The command can be followed by a '+' or '-' character to switch the
|
||||
option on or off respectively.
|
||||
|
||||
Example:
|
||||
|
@ -2404,7 +2428,7 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
|
|||
Switch on or off debug info generation. The default is off (that is,
|
||||
the object file will not contain debug infos), but may be changed by the
|
||||
-g switch on the command line.
|
||||
The command must be followed by a '+' or '-' character to switch the
|
||||
The command can be followed by a '+' or '-' character to switch the
|
||||
option on or off respectively.
|
||||
|
||||
Example:
|
||||
|
@ -2514,7 +2538,19 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
|
|||
|
||||
<sect1><tt>.ENDMAC, .ENDMACRO</tt><label id=".ENDMACRO"><p>
|
||||
|
||||
Marks the end of a macro definition.
|
||||
Marks the end of a macro definition. Note, <tt>.ENDMACRO</tt> should be on
|
||||
its own line to successfully end the macro definition. It is possible to use
|
||||
<tt><ref id=".DEFINE" name=".DEFINE"></tt> to create a symbol that references
|
||||
<tt>.ENDMACRO</tt> without ending the macro definition.
|
||||
|
||||
Example:
|
||||
|
||||
<tscreen><verb>
|
||||
.macro new_mac
|
||||
.define startmac .macro
|
||||
.define endmac .endmacro
|
||||
.endmacro
|
||||
</verb></tscreen>
|
||||
|
||||
See: <tt><ref id=".DELMACRO" name=".DELMACRO"></tt>,
|
||||
<tt><ref id=".EXITMACRO" name=".EXITMACRO"></tt>,
|
||||
|
@ -2738,25 +2774,23 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
|
|||
This directive may be used to enable one or more compatibility features
|
||||
of the assembler. While the use of <tt/.FEATURE/ should be avoided when
|
||||
possible, it may be useful when porting sources written for other
|
||||
assemblers. There is no way to switch a feature off, once you have
|
||||
enabled it, so using
|
||||
assemblers. After the feature name an optional '+' or '-' may specify whether
|
||||
to enable or disable the feature (enable if omitted). Multiple features may be
|
||||
enabled, separated by commas. Examples:
|
||||
|
||||
<tscreen><verb>
|
||||
.FEATURE xxx
|
||||
; enable c_comments
|
||||
.feature c_comments
|
||||
.feature c_comments +
|
||||
; enable force_range, disable underline_in_numbers, enable labels_without_colons
|
||||
.feature force_range, underline_in_numbers -, labels_without_colons +
|
||||
.feature force_range +, underline_in_numbers off, labels_without_colons on
|
||||
</verb></tscreen>
|
||||
|
||||
will enable the feature until end of assembly is reached.
|
||||
|
||||
The following features are available:
|
||||
|
||||
<descrip>
|
||||
|
||||
<tag><tt>addrsize</tt><label id="addrsize"></tag>
|
||||
|
||||
Enables the .ADDRSIZE pseudo function. This function is experimental and not enabled by default.
|
||||
|
||||
See also: <tt><ref id=".ADDRSIZE" name=".ADDRSIZE"></tt>
|
||||
|
||||
<tag><tt>at_in_identifiers</tt><label id="at_in_identifiers"></tag>
|
||||
|
||||
Accept the at character ('@') as a valid character in identifiers. The
|
||||
|
@ -2825,6 +2859,23 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
|
|||
overridden. When using this feature, you may also get into trouble if
|
||||
later versions of the assembler define new keywords starting with a dot.
|
||||
|
||||
<tag><tt>long_jsr_jmp_rts</tt><label id="long_jsr_jmp_rts"></tag>
|
||||
|
||||
Affects 65816 mode only.
|
||||
|
||||
Allows <tt>jsr</tt> and <tt>jmp</tt> to produce long jumps if the target
|
||||
address has been previously declared in a <tt>far</tt> segment,
|
||||
or imported as <tt>far</tt>.
|
||||
Otherwise <tt>jsl</tt> and <tt>jml</tt> must be used instead.
|
||||
|
||||
Also allows <tt><ref id=".SMART" name=".SMART"></tt> to convert <tt>rts</tt>
|
||||
to a long return <tt>rtl</tt> when the enclosing scope or memory model
|
||||
indicates returning from a <tt>far</tt> procedure.
|
||||
|
||||
This permits compatibility with the old behavior of this assembler, or other
|
||||
assemblers which similarly allowed <tt>jsr</tt> and <tt>jmp</tt> to be used
|
||||
this way.
|
||||
|
||||
<tag><tt>loose_char_term</tt><label id="loose_char_term"></tag>
|
||||
|
||||
Accept single quotes as well as double quotes as terminators for char
|
||||
|
@ -3036,7 +3087,7 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
|
|||
|
||||
<sect1><tt>.I16</tt><label id=".I16"><p>
|
||||
|
||||
Valid only in 65816 mode. Switch the index registers to 16 bit.
|
||||
Valid only in 65816 mode. Assume the index registers are 16 bit.
|
||||
|
||||
Note: This command will not emit any code, it will tell the assembler to
|
||||
create 16 bit operands for immediate operands.
|
||||
|
@ -3047,7 +3098,7 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
|
|||
|
||||
<sect1><tt>.I8</tt><label id=".I8"><p>
|
||||
|
||||
Valid only in 65816 mode. Switch the index registers to 8 bit.
|
||||
Valid only in 65816 mode. Assume the index registers are 8 bit.
|
||||
|
||||
Note: This command will not emit any code, it will tell the assembler to
|
||||
create 8 bit operands for immediate operands.
|
||||
|
@ -3319,7 +3370,7 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
|
|||
Note: Line continuations do not work in a comment. A backslash at the
|
||||
end of a comment is treated as part of the comment and does not trigger
|
||||
line continuation.
|
||||
The command must be followed by a '+' or '-' character to switch the
|
||||
The command can be followed by a '+' or '-' character to switch the
|
||||
option on or off respectively.
|
||||
|
||||
Example:
|
||||
|
@ -3334,7 +3385,7 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
|
|||
|
||||
<sect1><tt>.LIST</tt><label id=".LIST"><p>
|
||||
|
||||
Enable output to the listing. The command must be followed by a boolean
|
||||
Enable output to the listing. The command can be followed by a boolean
|
||||
switch ("on", "off", "+" or "-") and will enable or disable listing
|
||||
output.
|
||||
The option has no effect if the listing is not enabled by the command line
|
||||
|
@ -3979,7 +4030,7 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".BYTE" name=".BYTE"
|
|||
|
||||
<sect1><tt>.SMART</tt><label id=".SMART"><p>
|
||||
|
||||
Switch on or off smart mode. The command must be followed by a '+' or '-'
|
||||
Switch on or off smart mode. The command can be followed by a '+' or '-'
|
||||
character to switch the option on or off respectively. The default is off
|
||||
(that is, the assembler doesn't try to be smart), but this default may be
|
||||
changed by the -s switch on the command line.
|
||||
|
@ -3994,7 +4045,9 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".BYTE" name=".BYTE"
|
|||
the assembler cannot trace the execution flow this may lead to false
|
||||
results in some cases. If in doubt, use the <tt/.Inn/ and <tt/.Ann/
|
||||
instructions to tell the assembler about the current settings.
|
||||
<item>In 65816 mode, replace a <tt/RTS/ instruction by <tt/RTL/ if it is
|
||||
<item>In 65816 mode, if the <tt><ref id="long_jsr_jmp_rts"
|
||||
name="long_jsr_jmp_rts"></tt> feature is enabled,
|
||||
smart mode will replace a <tt/RTS/ instruction by <tt/RTL/ if it is
|
||||
used within a procedure declared as <tt/far/, or if the procedure has
|
||||
no explicit address specification, but it is <tt/far/ because of the
|
||||
memory model used.
|
||||
|
@ -4199,8 +4252,13 @@ macro actually takes in the definition. You may also leave intermediate
|
|||
parameters empty. Empty parameters are replaced by empty space (that is,
|
||||
they are removed when the macro is expanded). If you have a look at our
|
||||
macro definition above, you will see, that replacing the "addr" parameter
|
||||
by nothing will lead to wrong code in most lines. To help you, writing
|
||||
macros with a variable parameter list, there are some control commands:
|
||||
by nothing will lead to wrong code in most lines.
|
||||
|
||||
The names "a", "x" and "y" should be avoided for macro parameters, as these
|
||||
will usually conflict with the 6502 registers.
|
||||
|
||||
For writing macros with a variable parameter list, control commands are
|
||||
available:
|
||||
|
||||
<tt><ref id=".IFBLANK" name=".IFBLANK"></tt> tests the rest of the line and
|
||||
returns true, if there are any tokens on the remainder of the line. Since
|
||||
|
@ -4211,15 +4269,15 @@ opposite.
|
|||
Look at this example:
|
||||
|
||||
<tscreen><verb>
|
||||
.macro ldaxy a, x, y
|
||||
.ifnblank a
|
||||
lda #a
|
||||
.macro ldaxy i, j, k
|
||||
.ifnblank i
|
||||
lda #i
|
||||
.endif
|
||||
.ifnblank x
|
||||
ldx #x
|
||||
.ifnblank j
|
||||
ldx #j
|
||||
.endif
|
||||
.ifnblank y
|
||||
ldy #y
|
||||
.ifnblank k
|
||||
ldy #k
|
||||
.endif
|
||||
.endmacro
|
||||
</verb></tscreen>
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
|
||||
<abstract>
|
||||
Internal details of cc65 code generation,
|
||||
such as calling assembly functions from C.
|
||||
such as the expected linker configuration,
|
||||
and calling assembly functions from C.
|
||||
</abstract>
|
||||
|
||||
<!-- Table of contents -->
|
||||
|
@ -16,6 +17,76 @@ such as calling assembly functions from C.
|
|||
|
||||
|
||||
|
||||
<sect>Linker configuration<p>
|
||||
|
||||
The C libraries and code generation depend directly on a suitable linker configuration.
|
||||
There are premade configuration files in the <tt/cfg// directory, normally chosen by the
|
||||
linker's selected target. These can be used as a template for customization.
|
||||
|
||||
The C libraries depend on several special segments to be defined in your linker configuration.
|
||||
Generated code will also use some of them by default.
|
||||
Some platform libraries have additional special segments.
|
||||
|
||||
Memory areas are free to be defined in a way that is appropriate to each platform,
|
||||
and the segments they contain are used as a layer of semantics and abstraction,
|
||||
to allow much of the reorganization to be done with the linker config,
|
||||
rather than requiring platform-specific code source changes.
|
||||
|
||||
<sect1><tt/ZEROPAGE/ segment<p>
|
||||
|
||||
Used by the C library and generated code for efficient internal and temporary state storage,
|
||||
also called "pseudo-registers".
|
||||
|
||||
<sect1><tt/STARTUP/ segment<p>
|
||||
|
||||
Used by each platform instance of the C library in <tt/crt0.s/ to contain the entry point
|
||||
of the program.
|
||||
|
||||
The startup module will export <tt/__STARTUP__ : absolute = 1/ to force the linker to
|
||||
always include <tt/crt0.s/ from the library.
|
||||
|
||||
<sect1><tt/CODE/ segment<p>
|
||||
|
||||
The default segment for generated code, and most C library code will be located here.
|
||||
|
||||
Use <tt/#pragma code-name/ to redirect generated code to another segment.
|
||||
|
||||
<sect1><tt/BSS/ segment<p>
|
||||
|
||||
Used for uninitialized variables.
|
||||
Originally an acronym for "Block Started by Symbol", but the meaning of this is now obscure.
|
||||
|
||||
Use <tt/#pragma bss-name/ to redirect uninitialized variables to another segment.
|
||||
|
||||
<sect1><tt/DATA/ segment<p>
|
||||
|
||||
Used for initialized variables.
|
||||
|
||||
On some platforms, this may be initialized as part of the program loading process,
|
||||
but on others it may have a separate <tt/LOAD/ and <tt/RUN/ address,
|
||||
allowing <tt/copydata/ to copy the initialization from the loaded location
|
||||
into their run destination in RAM.
|
||||
|
||||
Use <tt/#pragma data-name/ to redirect initialized variables to another segment.
|
||||
|
||||
<sect1><tt/RODATA/ segment<p>
|
||||
|
||||
Used for read-only (constant) data.
|
||||
|
||||
Use <tt/#pragma rodata-name/ to redirect constant data to another segment.
|
||||
|
||||
<sect1><tt/FEATURES/ table<p>
|
||||
|
||||
This currently defines table locations for the <tt/CONDES/
|
||||
constructor, destructor, and interruptor features.
|
||||
Some platform libraries use these.
|
||||
|
||||
The constructors will be called with <tt/initlib/ at startup,
|
||||
and the destructors with <tt/donelib/ at program exit.
|
||||
Interruptors are called with <tt/callirq/.
|
||||
|
||||
|
||||
|
||||
<sect>Calling assembly functions from C<p>
|
||||
|
||||
<sect1>Calling conventions<p>
|
||||
|
|
|
@ -741,7 +741,7 @@ Here is a description of all the command line options:
|
|||
<tag><tt/return-type/</tag>
|
||||
Warn about no return statement in function returning non-void.
|
||||
<tag><tt/struct-param/</tag>
|
||||
Warn when passing structs by value.
|
||||
Warn when passing structs by value. (Disabled by default.)
|
||||
<tag><tt/unknown-pragma/</tag>
|
||||
Warn about #pragmas that aren't recognized by cc65.
|
||||
<tag><tt/unreachable-code/</tag>
|
||||
|
@ -754,6 +754,8 @@ Here is a description of all the command line options:
|
|||
Warn about unused function parameters.
|
||||
<tag><tt/unused-var/</tag>
|
||||
Warn about unused variables.
|
||||
<tag><tt/const-overflow/</tag>
|
||||
Warn if numerical constant conversion implies overflow. (Disabled by default.)
|
||||
</descrip>
|
||||
|
||||
The full list of available warning names can be retrieved by using the
|
||||
|
@ -806,9 +808,8 @@ and the one defined by the ISO standard:
|
|||
|
||||
<item> The datatypes "float" and "double" are not available.
|
||||
<p>
|
||||
<item> C Functions may not return structs (or unions), and structs may not
|
||||
be passed as parameters by value. However, struct assignment *is*
|
||||
possible.
|
||||
<item> C Functions may pass and return structs (or unions) by value, but only
|
||||
of 1, 2 or 4 byte sizes.
|
||||
<p>
|
||||
<item> Most of the C library is available with only the fastcall calling
|
||||
convention (<ref id="extension-fastcall" name="see below">). It means
|
||||
|
|
|
@ -115,14 +115,14 @@ Here is a description of all the command line options:
|
|||
<item>6502dtv
|
||||
<item>65sc02
|
||||
<item>65c02
|
||||
<item>65816
|
||||
<item>huc6280
|
||||
<item>4510
|
||||
</itemize>
|
||||
|
||||
6502x is for the NMOS 6502 with unofficial opcodes. 6502dtv is for the
|
||||
emulated CPU of the C64DTV device. huc6280 is the CPU of the PC engine.
|
||||
4510 is the CPU of the Commodore C65. Support for the 65816 currently
|
||||
is not available.
|
||||
4510 is the CPU of the Commodore C65. 65816 is the CPU of the SNES.
|
||||
|
||||
|
||||
<label id="option--formfeeds">
|
||||
|
@ -263,8 +263,9 @@ can produce output that can not be re-assembled, when one or more of those
|
|||
branches point outside of the disassembled memory. This can happen when text
|
||||
or binary data is processed.
|
||||
|
||||
While there is some code for the 65816 in the sources, it is currently
|
||||
unsupported.
|
||||
The 65816 support requires annotating ranges with the M and X flag states.
|
||||
This can be recorded with an emulator that supports Code and Data Logging,
|
||||
for example. Disassemble one bank at a time.
|
||||
|
||||
|
||||
<sect1>Attribute map<p>
|
||||
|
@ -461,7 +462,8 @@ following attributes are recognized:
|
|||
<tag><tt>END</tt></tag>
|
||||
This gives the end address of the range. The end address is inclusive, that
|
||||
means, it is part of the range. Of course, it may not be smaller than the
|
||||
start address.
|
||||
start address. Optionally, the end may be given as a decimal offset instead
|
||||
of an absolute address, "+3", to specify it as a size.
|
||||
|
||||
<tag><tt>NAME</tt></tag>
|
||||
This is a convenience attribute. It takes a string argument and will cause
|
||||
|
@ -520,6 +522,16 @@ following attributes are recognized:
|
|||
|
||||
</descrip>
|
||||
|
||||
<tag><tt>UNIT</tt></tag>
|
||||
Split the table into sections of this size. For example, if you have a
|
||||
ByteTable of size 48, but it has logical groups of size 16, specifying
|
||||
16 for UNIT adds newlines after every 16 bytes. UNIT is always in bytes.
|
||||
|
||||
<tag><tt>ADDRMODE</tt></tag>
|
||||
When disassembling 65816 code, this specifies the M and X flag states
|
||||
for this range. It's a string argument of the form "mx", capital letters
|
||||
mean the flag is enabled.
|
||||
|
||||
</descrip>
|
||||
|
||||
|
||||
|
@ -692,6 +704,20 @@ directives explained above:
|
|||
|
||||
|
||||
|
||||
<sect>Helper scripts<p>
|
||||
|
||||
<tt>util/parse-bsnes-log.awk</tt> is a supplied script for 65816 disassembly,
|
||||
to parse bsnes-plus Code-Data log files and output the RANGE sections
|
||||
for your info file. For typical usage, you'd check the S-CPU log and trace
|
||||
log mask boxes in the bsnes-plus debugger, play through the game, then grep
|
||||
for the bank you're disassembling, and pass that to this script.
|
||||
|
||||
<tscreen><verb>
|
||||
grep ^83 my-game-log | parse-bsnes-log.awk
|
||||
</verb></tscreen>
|
||||
|
||||
|
||||
|
||||
<sect>Copyright<p>
|
||||
|
||||
da65 (and all cc65 binutils) is (C) Copyright 1998-2011, Ullrich von
|
||||
|
|
12
doc/doc.css
12
doc/doc.css
|
@ -2,12 +2,14 @@ body {
|
|||
font-family: arial, helvetica, sans-serif;
|
||||
font-size: 100%;
|
||||
text-align: justify;
|
||||
margin-left: 110px;
|
||||
margin-top: 10px;
|
||||
margin-right: 30px;
|
||||
margin-bottom: 10px;
|
||||
margin: 0px;
|
||||
padding-left: 110px;
|
||||
padding-top: 10px;
|
||||
padding-right: 30px;
|
||||
padding-bottom: 10px;
|
||||
background-image: url(doc.png);
|
||||
background-repeat: repeat-y;
|
||||
background-position:left top;
|
||||
}
|
||||
|
||||
h1, h2, h2 a:link, h2 a:active, h2 a:visited {
|
||||
|
@ -25,7 +27,7 @@ h1 {
|
|||
}
|
||||
|
||||
h2 {
|
||||
font-size: 160%;
|
||||
font-size: 150%;
|
||||
text-shadow: 1px 1px 3px #303030;
|
||||
letter-spacing: 1px;
|
||||
margin-top: 2em;
|
||||
|
|
|
@ -126,6 +126,7 @@ function.
|
|||
<!-- <item><ref id="_scroll" name="_scroll"> -->
|
||||
<!-- <item><ref id="_setcolor" name="_setcolor"> -->
|
||||
<!-- <item><ref id="_setcolor_low" name="_setcolor_low"> -->
|
||||
<item><ref id="_sound" name="_sound">
|
||||
<item><ref id="get_ostype" name="get_ostype">
|
||||
<!-- <item><ref id="get_tv" name="get_tv"> -->
|
||||
</itemize>
|
||||
|
@ -975,7 +976,7 @@ previously been allocated by <tt/<ref id="malloc" name="malloc">/, <tt/<ref
|
|||
id="calloc" name="calloc">/ or <tt/<ref id="realloc" name="realloc">/.
|
||||
<tag/Notes/<itemize>
|
||||
<item>Passing a pointer to a block that was is not the result of one of the
|
||||
allocation functions, or that has been free'd will give unpredicable results.
|
||||
allocation functions, or that has been free'd will give unpredictable results.
|
||||
<item>The function is available only as a fastcall function; so, it may be used
|
||||
only in the presence of a prototype.
|
||||
</itemize>
|
||||
|
@ -1108,6 +1109,46 @@ considered random to a certain degree.
|
|||
</descrip>
|
||||
</quote>
|
||||
|
||||
<sect1>_sound<label id="_sound"><p>
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Use the speaker to produce sound in a specified voice. (Atari only)
|
||||
<tag/Header/<tt/<ref id="atari.h" name="atari.h">/
|
||||
<tag/Declaration/<tt/void __fastcall__ _sound (unsigned char voice, unsigned char pitch, unsigned char distortion, unsigned char volume);/
|
||||
<tag/Description/The function produces a sound with the specified parameters using any of the 4 available oscillators (voices) controlled by the POKEY chip. Sound is non cpu-blocking and it keeps oscillating until program sends 0 in all the other parameters.
|
||||
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is available only as a fastcall function; so, it may be used
|
||||
only in the presence of a prototype.
|
||||
<item>The function is specific to the Atari 8 bit.
|
||||
<item> Voice can be any of 0-3 different sound channels.
|
||||
<item> Pitch goes from 0-255 (about 125 Hz to 32 Khz).
|
||||
<item> Distortion (0-14) uses poly dividers to reshape wave in order to create a noise effect. Use 10 for a "pure" square-wave sound.
|
||||
<item>Volume (0-15) is the intensity for the wave.
|
||||
<item>Extra bits in those parameters will be ignored.
|
||||
<item>Parameters are the same as for the AtariBASIC SOUND statement.
|
||||
</itemize>
|
||||
<tag/Availability/cc65 (<tt/atari/ and <tt/atarixl/ platforms)
|
||||
<tag/Example/
|
||||
<verb>
|
||||
|
||||
#include <stdio.h>
|
||||
int main(void)
|
||||
{
|
||||
int i=0;
|
||||
unsigned char j;
|
||||
printf("playing sound \n");
|
||||
for (j=0; j<144; j++) {
|
||||
_sound(1,144-j,10,8); //change the pitch for voice 1
|
||||
for (i=0; i<50; i++); //pause for sound duration
|
||||
}
|
||||
_sound(1,0,0,0); //use zero in other parameters to stop the sound
|
||||
return 0;
|
||||
}
|
||||
|
||||
</verb>
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
<sect1>_stroserror<label id="_stroserror"><p>
|
||||
|
||||
|
@ -4148,7 +4189,7 @@ be used in presence of a prototype.
|
|||
<tag/Example/<verb>
|
||||
chdir (getdevicedir (device, buf, sizeof buf));
|
||||
</verb>
|
||||
cf. <tt/samples/enumdevdir.c/
|
||||
cf. <tt/samples/enumdevdir.c/
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
@ -6908,7 +6949,6 @@ switching the CPU into single clock mode.
|
|||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>srand<label id="srand"><p>
|
||||
|
||||
<quote>
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
Contains hints on creating the most effective code with cc65.
|
||||
|
||||
<tag><htmlurl url="cc65-intern.html" name="cc65-intern.html"></tag>
|
||||
Describes internal details of cc65, such as calling conventions.
|
||||
Describes internal details of cc65: linker configuration, calling conventions, etc.
|
||||
|
||||
<tag><htmlurl url="using-make.html" name="using-make.html"></tag>
|
||||
Build programs, using the GNU Make utility.
|
||||
|
@ -154,6 +154,9 @@
|
|||
<tag><htmlurl url="gamate.html" name="gamate.html"></tag>
|
||||
Topics specific to the Bit Corporation Gamate Console.
|
||||
|
||||
<tag><htmlurl url="kim1.html" name="kim1.html"></tag>
|
||||
Topics specific to the MOS Technology KIM-1.
|
||||
|
||||
<tag><htmlurl url="lynx.html" name="lynx.html"></tag>
|
||||
Topics specific to the Atari Lynx Game Console.
|
||||
|
||||
|
|
|
@ -0,0 +1,150 @@
|
|||
<!doctype linuxdoc system>
|
||||
|
||||
<article>
|
||||
<title>MOS Technology KIM-1 specific information for cc65
|
||||
<author><url url="mailto:davepl@davepl.com" name="Dave Plummer">
|
||||
|
||||
<abstract>
|
||||
An overview of the KIM-1 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 KIM-1 runtime system as it comes with the cc65 C compiler.
|
||||
It describes the memory layout, KIM-1 specific header files, available drivers, and any pitfalls
|
||||
specific to the platform.
|
||||
|
||||
Please note that KIM-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 KIM-1 target is a raw binary BIN file, which
|
||||
is essentially a memory image. You can convert this to a papertape format file using
|
||||
Convert8bithexformat or KIMPaper, which are open-source conversion utility programs.
|
||||
A papertape format files can be transferred to the KIM-1 using the RS-232 terminal port (TTY),
|
||||
just as if the machine-code was entered by hand. Enter 'L' in the TTY and start the paper tape file
|
||||
transfer.
|
||||
|
||||
<p>
|
||||
|
||||
Included with this distribution is a 4k configuration file and a 60k config file. The KIM-1
|
||||
on-board memory is limited to 4 kbytes but system memory can be increased to 60 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 KIM-1 monitor ROM. cc65 generated programs compiled and linked
|
||||
using 4k config run in the memory range of $200 - $0FFF. The 60k config expands
|
||||
this range to $DFFF. When using the 4k config the starting memory location and entry point
|
||||
for running the program is $200, so when the program is transferred to the KIM-1, it is
|
||||
executed by typing '200 G'. With the 60k config the default starting memory location and entry
|
||||
point is $2000.
|
||||
|
||||
Special locations:
|
||||
|
||||
<descrip>
|
||||
<tag/Text screen/
|
||||
Conio support is not currently available for the KIM-1. But stdio console functions are available.
|
||||
|
||||
<tag/Stack/
|
||||
The C runtime stack is located at $0FFF on 4kb KIM-1s, or at $DFFF for 60kb 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.
|
||||
|
||||
</descrip><p>
|
||||
|
||||
<sect>Platform specific header files<p>
|
||||
|
||||
Programs containing KIM-1 code may use the <tt/kim1.h/ header file. See the header file for more information.
|
||||
|
||||
<sect>Loadable drivers<p>
|
||||
|
||||
<sect1>Graphics drivers<p>
|
||||
|
||||
No graphics drivers are currently available for the KIM-1.
|
||||
|
||||
<sect1>Joystick drivers<p>
|
||||
|
||||
No joystick driver is currently available for the KIM-1.
|
||||
|
||||
<sect1>Mouse drivers<p>
|
||||
|
||||
No mouse drivers are currently available for the KIM-1.
|
||||
|
||||
<sect1>RS232 device drivers<p>
|
||||
|
||||
No communication port drivers are currently available for the KIM-1. It has only the "master console"
|
||||
e.g. stdin and stdout.
|
||||
|
||||
<sect>Limitations<p>
|
||||
|
||||
<sect1>Disk I/O<p>
|
||||
|
||||
The existing library for the KIM-1 doesn't implement C file I/O.
|
||||
|
||||
To be more specific, this limitation means that you cannot use any of the following functions (and a few others):
|
||||
|
||||
<itemize>
|
||||
<item>fopen
|
||||
<item>fclose
|
||||
<item>fread
|
||||
<item>fwrite
|
||||
<item>...
|
||||
</itemize>
|
||||
|
||||
<sect>Other hints<p>
|
||||
|
||||
<sect1>kim1.h<p>
|
||||
This header exposes KIM-1 specific I/O functions that are useful for reading and writing its ports and front panel.
|
||||
See the <tt/kim1.h/ include file for a list of the functions available.
|
||||
|
||||
<sect1>Limited memory applications<p>
|
||||
|
||||
As stated earlier, there are config files for 4kb and 60kb systems. If you have 60kb RAM, then you will probably
|
||||
want to use the kim1-60k configuration, but if not - if you are using the kim1-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.
|
||||
|
||||
<sect1>Sample programs<p>
|
||||
|
||||
These sample programs can be found in the samples/kim1 directory:
|
||||
|
||||
<itemize>
|
||||
<item>kimHello prints "Hello World!" and then inputs characters, which are echoed on the screen.
|
||||
This program will run on both 4kb and 60kb systems.</item>
|
||||
<item>kimSieve finds the prime numbers up to 100,000 using the Sieve of Eratosthenes algorithm, and prints how many
|
||||
prime numbers were found. This program requires a 60kb system to run.</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.
|
||||
|
||||
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>
|
|
@ -90,6 +90,7 @@ Long options:
|
|||
--start-group Start a library group
|
||||
--target sys Set the target system
|
||||
--version Print the linker version
|
||||
--warnings-as-errors Treat warnings as errors
|
||||
---------------------------------------------------------------------------
|
||||
</verb></tscreen>
|
||||
|
||||
|
@ -330,6 +331,13 @@ Here is a description of all of the command-line options:
|
|||
directory, in the list of directories specified using <tt/--obj-path/, in
|
||||
directories given by environment variables, and in a built-in default directory.
|
||||
|
||||
|
||||
<label id="option--warnings-as-errors">
|
||||
<tag><tt>--warnings-as-errors</tt></tag>
|
||||
|
||||
An error will be generated if any warnings were produced.
|
||||
|
||||
|
||||
</descrip>
|
||||
|
||||
|
||||
|
|
13
doc/osi.sgml
13
doc/osi.sgml
|
@ -187,8 +187,21 @@ Currently the following extra screen configuration modules are implemented:
|
|||
<itemize>
|
||||
<item><tt>osic1p-screen-s3-32x28.o</tt>: 32 columns by 28 lines mode
|
||||
for Briel Superboard ///</item>
|
||||
<item><tt>osic1p-screen-c1p-48x12.s</tt>: 48 columns by 12 lines mode
|
||||
for Challenger 1P</item>
|
||||
</itemize>
|
||||
|
||||
On the Briel Superboard /// you enter 32 column mode by holding down
|
||||
the BREAK key on powerup.
|
||||
|
||||
On the Challenger 1P you can enable 48 column mode by writing a 1 to
|
||||
bit 0 of address $D800, and writing a 0 to go back to 24 column mode.
|
||||
You can use code like the following to do this:
|
||||
|
||||
<tscreen><verb>
|
||||
*(char*)0xd800 = 1; /* Switch to 48 column mode */
|
||||
</verb></tscreen>
|
||||
|
||||
<sect>Limitations<p>
|
||||
|
||||
<sect1>stdio implementation<p>
|
||||
|
|
|
@ -44,6 +44,13 @@ The simulator is called as follows:
|
|||
--version Print the simulator version number
|
||||
</verb></tscreen>
|
||||
|
||||
sim65 will exit with the error code of the simulated program,
|
||||
which is limited to an 8-bit result 0-255.
|
||||
|
||||
An error in sim65, like bad arguments or an internal problem will exit with <tt/1/.
|
||||
|
||||
A timeout from <tt/-x/ will exist with <tt/2/.
|
||||
|
||||
|
||||
<sect1>Command line options in detail<p>
|
||||
|
||||
|
@ -126,9 +133,17 @@ a set of built-in paravirtualization functions (<ref id="paravirt-internal" name
|
|||
<sect>Creating a Test in Assembly<p>
|
||||
|
||||
Assembly tests may similarly be assembled and linked with
|
||||
<tt/--target sim6502/ or <tt/--target sim65c02/,
|
||||
and the sim65 library provides an <tt/exit/ symbol that the program may <tt/JMP/
|
||||
to terminate with the current A register value as an exit code.
|
||||
<tt/--target sim6502/ or <tt/--target sim65c02/.
|
||||
Define and export <tt/_main/ as an entry point,
|
||||
and the sim65 library provides two ways to return an 8-bit exit code:
|
||||
|
||||
<itemize>
|
||||
|
||||
<item>Return from <tt/_main/ with the exit code in <tt/A/.
|
||||
|
||||
<item><tt/jmp exit/ with the code in <tt/A/.
|
||||
|
||||
</itemize>
|
||||
|
||||
The binary file has a 12 byte header:
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ Short options:
|
|||
-lc List all possible conversions
|
||||
-r file[,attrlist] Read an input file
|
||||
-v Increase verbosity
|
||||
-p tgt,file[,attrlist] Write the palette to a file
|
||||
-w file[,attrlist] Write the output to a file
|
||||
|
||||
Long options:
|
||||
|
@ -56,6 +57,7 @@ Long options:
|
|||
--slice x,y,w,h Generate a slice from the loaded bitmap
|
||||
--verbose Increase verbosity
|
||||
--version Print the version number and exit
|
||||
--palette tgt,file{,attrlist] Write the palette to a file
|
||||
--write file[,attrlist] Write the output to a file
|
||||
---------------------------------------------------------------------------
|
||||
</verb></tscreen>
|
||||
|
@ -124,6 +126,13 @@ attribute lists see <ref id="attr-lists" name="below">.
|
|||
bugfixes, please include the version number.
|
||||
|
||||
|
||||
<label id="option--palette">
|
||||
<tag><tt>-p, --palette target,filename[,attrlist]</tt></tag>
|
||||
|
||||
Write the palette of the input bitmap to a file in a format suitable of
|
||||
the target.
|
||||
|
||||
|
||||
<label id="option--write">
|
||||
<tag><tt>-w, --write filename[,attrlist]</tt></tag>
|
||||
|
||||
|
@ -265,6 +274,7 @@ of a sprite is roughly 508 pixels but in reality the Lynx screen is only 160 by
|
|||
102 pixels which makes very large sprites useless.
|
||||
|
||||
The number per pixels is taken from the number of colors of the input bitmap.
|
||||
You can also force the number of pens used in the conversion.
|
||||
|
||||
There are a few attributes that you can give to the conversion software.
|
||||
|
||||
|
@ -273,7 +283,7 @@ There are a few attributes that you can give to the conversion software.
|
|||
<tag/mode/
|
||||
The first is what kind of encoding to use for the sprite. The attribute for
|
||||
this is called "mode" and the possible values are "literal", "packed" or
|
||||
"transparent". The default is "packed" if no mode is specified.
|
||||
"shaped". The default is "packed" if no mode is specified.
|
||||
|
||||
The "literal" is a totally literal mode with no packing. In this mode the
|
||||
number of pixels per scanline will be a multiple of 8 both right and left from
|
||||
|
@ -290,10 +300,26 @@ There are a few attributes that you can give to the conversion software.
|
|||
using run-length encoding and literal coding mixed for optimisation to
|
||||
produce a small sprite.
|
||||
|
||||
The last encoding mode "transparent" is like packed. But here we know that
|
||||
the index 0 will be transparent so we can clip off all 0 pixels from the left
|
||||
and right edge of the sprite. This will produce the smallest sprite possible
|
||||
on the Lynx. The sprite is not rectangular anymore.
|
||||
The last encoding mode "shaped" is like packed. But we can stop the conversion
|
||||
to the right abd left edge when we get the first "edge" colour. If no edge
|
||||
colour is specified we stop at the first index 0 colour.
|
||||
If your edge index is outside the range 0..15 then your sprite can use all
|
||||
the colours in the defined palette.
|
||||
This will also produce the smallest sprite possible on the Lynx. The sprite
|
||||
is not rectangular anymore.
|
||||
|
||||
<tag/edge/
|
||||
This keyword is only meaningful for shaped sprites. By default it is 0.
|
||||
The shaped sprite outer edge is defined by the colour index "edge".
|
||||
|
||||
<tag/pen/
|
||||
This keyword defines the order the colours in the original bitmap is
|
||||
mapped to the Lynx sprite. The length of the pen also defines the depth
|
||||
of the generated sprite.
|
||||
If you want to create a 1 BPP sprite you can define the two indices used
|
||||
in the sprite like pen=34. Now areas in colour index 3 will be mapped as 0.
|
||||
Areas in colour index 4 will be mapped as 1.
|
||||
The default pen=0123456789abcdef.
|
||||
|
||||
<tag/ax/
|
||||
The sprite is painted around the Anchor point. The anchor point x can be
|
||||
|
@ -301,7 +327,9 @@ There are a few attributes that you can give to the conversion software.
|
|||
painting the sprite in location 10,20 will set the left edge of the sprite
|
||||
10 pixels from the left of the Lynx screen. When the sprite is scaled by
|
||||
hardware the anchor point stays in place and the sprite grows or shrinks
|
||||
around the anchor point. The default value is 0 (left).
|
||||
around the anchor point. You can also define the location using the words
|
||||
"mid" for the center or "max" for the right edge.
|
||||
The default value is 0 (left).
|
||||
|
||||
<tag/ay/
|
||||
The sprite is painted around the Anchor point. The anchor point y can be
|
||||
|
@ -309,7 +337,8 @@ There are a few attributes that you can give to the conversion software.
|
|||
painting the sprite in location 10,20 will set the top of the sprite 20
|
||||
pixels from the top of the Lynx screen. When the sprite is scaled by
|
||||
hardware the anchor point stays in place and the sprite grows or shrinks
|
||||
around the anchor point. The default value is 0 (top).
|
||||
around the anchor point. You can also define the location using the words
|
||||
"mid" for the center or "max" for the bottom. The default value is 0 (top).
|
||||
|
||||
</descrip>
|
||||
|
||||
|
|
|
@ -54,7 +54,21 @@ struct __os {
|
|||
unsigned char color2; // = $0E PF color 2
|
||||
unsigned char color3; // = $0F PF color 3
|
||||
unsigned char color4; // = $10 PF color 4
|
||||
unsigned char _free_1[0xEF]; // = $11-$FF User space
|
||||
unsigned char paddl0; // = $11 POT0 Shadow
|
||||
unsigned char paddl1; // = $12 POT1 Shadow
|
||||
unsigned char paddl2; // = $13 POT2 Shadow
|
||||
unsigned char paddl3; // = $14 POT3 Shadow
|
||||
unsigned char paddl4; // = $15 POT4 Shadow
|
||||
unsigned char paddl5; // = $16 POT5 Shadow
|
||||
unsigned char paddl6; // = $17 POT6 Shadow
|
||||
unsigned char paddl7; // = $18 POT7 Shadow
|
||||
|
||||
/*cc65 runtime zero page variables*/
|
||||
unsigned char rowcrs_5200; // = $19 Cursor row (conio)
|
||||
unsigned char colcrs_5200; // = $1A Cursor column (conio)
|
||||
unsigned char* savmsc; // = $1B/$1C Pointer to screen memory (conio)
|
||||
|
||||
unsigned char _filler_1[0xE3]; // = $1D-$FF Filler
|
||||
|
||||
/*Stack*/
|
||||
unsigned char stack[0x100]; // = $100-$1FF Stack
|
||||
|
|
|
@ -334,17 +334,17 @@ struct __os {
|
|||
void (*vserin)(void); // = $020A/$020B POKEY SERIAL INPUT READY IRQ
|
||||
void (*vseror)(void); // = $020C/$020D POKEY SERIAL OUTPUT READY IRQ
|
||||
void (*vseroc)(void); // = $020E/$020F POKEY SERIAL OUTPUT COMPLETE IRQ
|
||||
void (*vtimr1)(void); // = $0210/$0201 POKEY TIMER 1 IRQ
|
||||
void (*vtimr2)(void); // = $0212/$0203 POKEY TIMER 2 IRQ
|
||||
void (*vtimr4)(void); // = $0214/$0205 POKEY TIMER 4 IRQ
|
||||
void (*vimirq)(void); // = $0216/$0207 IMMEDIATE IRQ VECTOR
|
||||
unsigned int cdtmv1; // = $0218/$0210 COUNT DOWN TIMER 1
|
||||
void (*vtimr1)(void); // = $0210/$0211 POKEY TIMER 1 IRQ
|
||||
void (*vtimr2)(void); // = $0212/$0213 POKEY TIMER 2 IRQ
|
||||
void (*vtimr4)(void); // = $0214/$0215 POKEY TIMER 4 IRQ
|
||||
void (*vimirq)(void); // = $0216/$0217 IMMEDIATE IRQ VECTOR
|
||||
unsigned int cdtmv1; // = $0218/$0219 COUNT DOWN TIMER 1
|
||||
unsigned int cdtmv2; // = $021A/$021B COUNT DOWN TIMER 2
|
||||
unsigned int cdtmv3; // = $021C/$021D COUNT DOWN TIMER 3
|
||||
unsigned int cdtmv4; // = $021E/$021F COUNT DOWN TIMER 4
|
||||
unsigned int cdtmv5; // = $0220/$0221 COUNT DOWN TIMER 5
|
||||
void (*vvblki)(void); // = $0222/$0223 IMMEDIATE VERTICAL BLANK NMI VECTOR
|
||||
void (*vvblkd)(void); // = $0224/$0224 DEFERRED VERTICAL BLANK NMI VECTOR
|
||||
void (*vvblkd)(void); // = $0224/$0225 DEFERRED VERTICAL BLANK NMI VECTOR
|
||||
void (*cdtma1)(void); // = $0226/$0227 COUNT DOWN TIMER 1 JSR ADDRESS
|
||||
void (*cdtma2)(void); // = $0228/$0229 COUNT DOWN TIMER 2 JSR ADDRESS
|
||||
unsigned char cdtmf3; // = $022A COUNT DOWN TIMER 3 FLAG
|
||||
|
|
|
@ -37,13 +37,20 @@ struct freeblock {
|
|||
|
||||
|
||||
/* Variables that describe the heap */
|
||||
extern unsigned* _heaporg; /* Bottom of heap */
|
||||
extern unsigned* _heapptr; /* Current top */
|
||||
extern unsigned* _heapend; /* Upper limit */
|
||||
extern struct freeblock* _heapfirst; /* First free block in list */
|
||||
extern struct freeblock* _heaplast; /* Last free block in list */
|
||||
|
||||
extern unsigned* __heaporg; /* Bottom of heap */
|
||||
extern unsigned* __heapptr; /* Current top */
|
||||
extern unsigned* __heapend; /* Upper limit */
|
||||
extern struct freeblock* __heapfirst; /* First free block in list */
|
||||
extern struct freeblock* __heaplast; /* Last free block in list */
|
||||
|
||||
#if __CC65_STD__ == __CC65_STD_CC65__
|
||||
/* define old name with one underscore for backwards compatibility */
|
||||
#define _heaporg __heaporg
|
||||
#define _heapptr __heapptr
|
||||
#define _heapend __heapend
|
||||
#define _heapfirst __heapfirst
|
||||
#define _heaplast __heaplast
|
||||
#endif
|
||||
|
||||
/* End of _heap.h */
|
||||
|
||||
|
|
|
@ -171,7 +171,7 @@ extern struct {
|
|||
extern void a2_auxmem_emd[];
|
||||
extern void a2_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */
|
||||
extern void a2_stdmou_mou[]; /* Referred to by mouse_static_stddrv[] */
|
||||
extern void a2_ssc_ser[];
|
||||
extern void a2_ssc_ser[]; /* Referred to by ser_static_stddrv[] */
|
||||
extern void a2_hi_tgi[]; /* Referred to by tgi_static_stddrv[] */
|
||||
extern void a2_lo_tgi[];
|
||||
#endif
|
||||
|
|
|
@ -99,7 +99,7 @@
|
|||
extern void a2e_auxmem_emd[];
|
||||
extern void a2e_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */
|
||||
extern void a2e_stdmou_mou[]; /* Referred to by mouse_static_stddrv[] */
|
||||
extern void a2e_ssc_ser[];
|
||||
extern void a2e_ssc_ser[]; /* Referred to by ser_static_stddrv[] */
|
||||
extern void a2e_hi_tgi[]; /* Referred to by tgi_static_stddrv[] */
|
||||
extern void a2e_lo_tgi[];
|
||||
|
||||
|
|
|
@ -42,8 +42,8 @@
|
|||
#ifdef NDEBUG
|
||||
# define assert(expr)
|
||||
#else
|
||||
extern void __fastcall__ _afailed (const char*, unsigned);
|
||||
# define assert(expr) ((expr)? (void)0 : _afailed(__FILE__, __LINE__))
|
||||
extern void __fastcall__ __afailed (const char*, unsigned);
|
||||
# define assert(expr) ((expr)? (void)0 : __afailed(__FILE__, __LINE__))
|
||||
#endif
|
||||
|
||||
/* TODO: Guard with #if __CC65_STD__ >= __CC65_STD_C11__ if there
|
||||
|
|
|
@ -235,6 +235,12 @@ extern void __fastcall__ _scroll (signed char numlines);
|
|||
/* numlines < 0 scrolls down */
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Sound function */
|
||||
/*****************************************************************************/
|
||||
|
||||
extern void __fastcall__ _sound (unsigned char voice, unsigned char frequency, unsigned char distortion, unsigned char volume);
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Misc. functions */
|
||||
/*****************************************************************************/
|
||||
|
@ -261,7 +267,7 @@ extern void atrst_mou[]; /* referred to by mouse_static_stddrv[]
|
|||
extern void atrami_mou[];
|
||||
extern void atrtrk_mou[];
|
||||
extern void atrtt_mou[];
|
||||
extern void atrrdev_ser[];
|
||||
extern void atrrdev_ser[]; /* referred to by ser_static_stddrv[] */
|
||||
extern void atr3_tgi[];
|
||||
extern void atr4_tgi[];
|
||||
extern void atr5_tgi[];
|
||||
|
@ -286,7 +292,7 @@ extern void atrxst_mou[]; /* referred to by mouse_static_stddrv[]
|
|||
extern void atrxami_mou[];
|
||||
extern void atrxtrk_mou[];
|
||||
extern void atrxtt_mou[];
|
||||
extern void atrxrdev_ser[];
|
||||
extern void atrxrdev_ser[]; /* referred to by ser_static_stddrv[] */
|
||||
extern void atrx3_tgi[];
|
||||
extern void atrx4_tgi[];
|
||||
extern void atrx5_tgi[];
|
||||
|
|
|
@ -133,7 +133,7 @@
|
|||
/* The addresses of the static drivers */
|
||||
extern void atmos_pase_joy[]; /* Referred to by joy_static_stddrv[] */
|
||||
extern void atmos_ijk_joy[];
|
||||
extern void atmos_acia_ser[];
|
||||
extern void atmos_acia_ser[]; /* Referred to by ser_static_stddrv[] */
|
||||
extern void atmos_228_200_3_tgi[];
|
||||
extern void atmos_240_200_2_tgi[]; /* Referred to by tgi_static_stddrv[] */
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ extern void c128_1351_mou[]; /* Referred to by mouse_static_stddrv[] */
|
|||
extern void c128_joy_mou[];
|
||||
extern void c128_inkwell_mou[];
|
||||
extern void c128_pot_mou[];
|
||||
extern void c128_swlink_ser[];
|
||||
extern void c128_swlink_ser[]; /* Referred to by ser_static_stddrv[] */
|
||||
extern void c128_hi_tgi[];
|
||||
extern void c128_vdc_tgi[]; /* Referred to by tgi_static_stddrv[] */
|
||||
extern void c128_vdc2_tgi[];
|
||||
|
|
|
@ -155,7 +155,7 @@ extern void c64_1351_mou[]; /* Referred to by mouse_static_stddrv[]
|
|||
extern void c64_joy_mou[];
|
||||
extern void c64_inkwell_mou[];
|
||||
extern void c64_pot_mou[];
|
||||
extern void c64_swlink_ser[];
|
||||
extern void c64_swlink_ser[]; /* Referred to by ser_static_stddrv[] */
|
||||
extern void c64_hi_tgi[]; /* Referred to by tgi_static_stddrv[] */
|
||||
|
||||
|
||||
|
|
|
@ -225,7 +225,7 @@ void cbm_k_untlk (void);
|
|||
|
||||
|
||||
|
||||
/* The cbm_* I/O functions below set _oserror (see errno.h),
|
||||
/* The cbm_* I/O functions below set __oserror (see errno.h),
|
||||
** in case of an error.
|
||||
**
|
||||
** error-code BASIC error
|
||||
|
@ -251,7 +251,7 @@ unsigned int __fastcall__ cbm_load (const char* name, unsigned char device, void
|
|||
** address of the file if "data" is the null pointer (like load"name",8,1
|
||||
** in BASIC).
|
||||
** Returns number of bytes that were loaded if loading was successful;
|
||||
** otherwise 0, "_oserror" contains an error-code, then (see table above).
|
||||
** otherwise 0, "__oserror" contains an error-code, then (see table above).
|
||||
*/
|
||||
|
||||
unsigned char __fastcall__ cbm_save (const char* name, unsigned char device,
|
||||
|
@ -274,7 +274,7 @@ void __fastcall__ cbm_close (unsigned char lfn);
|
|||
int __fastcall__ cbm_read (unsigned char lfn, void* buffer, unsigned int size);
|
||||
/* Reads up to "size" bytes from a file into "buffer".
|
||||
** Returns the number of actually-read bytes, 0 if there are no bytes left.
|
||||
** -1 in case of an error; then, _oserror contains an error-code (see table
|
||||
** -1 in case of an error; then, __oserror contains an error-code (see table
|
||||
** above). (Remember: 0 means end-of-file; -1 means error.)
|
||||
*/
|
||||
|
||||
|
@ -282,7 +282,7 @@ int __fastcall__ cbm_write (unsigned char lfn, const void* buffer,
|
|||
unsigned int size);
|
||||
/* Writes up to "size" bytes from "buffer" to a file.
|
||||
** Returns the number of actually-written bytes, or -1 in case of an error;
|
||||
** _oserror contains an error-code, then (see above table).
|
||||
** __oserror contains an error-code, then (see above table).
|
||||
*/
|
||||
|
||||
unsigned char cbm_opendir (unsigned char lfn, unsigned char device, ...);
|
||||
|
|
|
@ -128,7 +128,7 @@ extern void cbm510_inkwl_mou[];
|
|||
extern void cbm510_joy_mou[]; /* Referred to by mouse_static_stddrv[] */
|
||||
extern void cbm510_ram_emd[];
|
||||
extern void cbm510_std_joy[]; /* Referred to by joy_static_stddrv[] */
|
||||
extern void cbm510_std_ser[];
|
||||
extern void cbm510_std_ser[]; /* Referred to by ser_static_stddrv[] */
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@
|
|||
|
||||
/* The addresses of the static drivers */
|
||||
extern void cbm610_ram_emd[];
|
||||
extern void cbm610_std_ser[];
|
||||
extern void cbm610_std_ser[]; /* Referred to by ser_static_stddrv[] */
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -35,9 +35,9 @@
|
|||
|
||||
|
||||
|
||||
/* Please note: All functions in this file will set _oserror *and* return its
|
||||
** value. The only exception is dio_open, which will return NULL, but _oserror
|
||||
** will be set. All function will also set _oserror in case of successful
|
||||
/* Please note: All functions in this file will set __oserror *and* return its
|
||||
** value. The only exception is dio_open, which will return NULL, but __oserror
|
||||
** will be set. All function will also set __oserror in case of successful
|
||||
** execution, effectively clearing it.
|
||||
*/
|
||||
|
||||
|
|
|
@ -45,12 +45,17 @@
|
|||
|
||||
|
||||
/* Operating system specific error code */
|
||||
extern unsigned char _oserror;
|
||||
extern unsigned char __oserror;
|
||||
|
||||
extern int _errno;
|
||||
#if __CC65_STD__ >= __CC65_STD_CC65__
|
||||
/* define the name with just one underscore for backwards compatibility */
|
||||
#define _oserror __oserror
|
||||
#endif
|
||||
|
||||
extern int __errno;
|
||||
/* System errors go here */
|
||||
|
||||
#define errno _errno
|
||||
#define errno __errno
|
||||
/* errno must be a macro */
|
||||
|
||||
|
||||
|
@ -83,27 +88,45 @@ extern int _errno;
|
|||
|
||||
|
||||
|
||||
int __fastcall__ _osmaperrno (unsigned char oserror);
|
||||
/* Map an operating system specific error code (for example from _oserror)
|
||||
int __fastcall__ __osmaperrno (unsigned char oserror);
|
||||
/* Map an operating system specific error code (for example from __oserror)
|
||||
** into one of the E... codes above. It is user callable.
|
||||
*/
|
||||
|
||||
unsigned char __fastcall__ _seterrno (unsigned char code);
|
||||
#if __CC65_STD__ >= __CC65_STD_CC65__
|
||||
/* define the name with just one underscore for backwards compatibility */
|
||||
#define _osmaperrno __osmaperrno
|
||||
#endif
|
||||
|
||||
unsigned char __fastcall__ __seterrno (unsigned char code);
|
||||
/* Set errno to a specific error code and return zero. Used by the library */
|
||||
|
||||
int __fastcall__ _directerrno (unsigned char code);
|
||||
/* Set errno to a specific error code, clear _oserror and return -1. Used
|
||||
#if __CC65_STD__ >= __CC65_STD_CC65__
|
||||
/* define the name with just one underscore for backwards compatibility */
|
||||
#define _seterrno __seterrno
|
||||
#endif
|
||||
|
||||
int __fastcall__ __directerrno (unsigned char code);
|
||||
/* Set errno to a specific error code, clear __oserror and return -1. Used
|
||||
** by the library.
|
||||
*/
|
||||
|
||||
int __fastcall__ _mappederrno (unsigned char code);
|
||||
/* Set _oserror to the given platform specific error code. If it is a real
|
||||
#if __CC65_STD__ >= __CC65_STD_CC65__
|
||||
/* define the name with just one underscore for backwards compatibility */
|
||||
#define _directerrno __directerrno
|
||||
#endif
|
||||
|
||||
int __fastcall__ __mappederrno (unsigned char code);
|
||||
/* Set __oserror to the given platform specific error code. If it is a real
|
||||
** error code (not zero) set errno to the corresponding system error code
|
||||
** and return -1. Otherwise return zero.
|
||||
** Used by the library.
|
||||
*/
|
||||
|
||||
|
||||
#if __CC65_STD__ >= __CC65_STD_CC65__
|
||||
/* define the name with just one underscore for backwards compatibility */
|
||||
#define _mappederrno __mappederrno
|
||||
#endif
|
||||
|
||||
/* End of errno.h */
|
||||
#endif
|
||||
|
|
|
@ -4,13 +4,15 @@
|
|||
reassembled by Maciej 'YTM/Elysium' Witkowiak
|
||||
*/
|
||||
|
||||
/* Here are constants which didn't fit into any other cathegory... */
|
||||
/* Here are constants which didn't fit into any other category... */
|
||||
|
||||
#ifndef _GCONST_H
|
||||
#define _GCONST_H
|
||||
|
||||
#define NULL 0
|
||||
#define FALSE NULL
|
||||
#ifndef NULL
|
||||
#define NULL ((void *) 0)
|
||||
#endif
|
||||
#define FALSE 0
|
||||
#define TRUE 0xff
|
||||
#define MOUSE_SPRNUM 0
|
||||
#define DISK_DRV_LGH 0x0d80
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
/*****************************************************************************/
|
||||
/* */
|
||||
/* kim1.h */
|
||||
/* */
|
||||
/* KIM-1 system-specific definitions */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2022 Dave Plummer */
|
||||
/* Email: davepl@davepl.com */
|
||||
/* */
|
||||
/* This software is provided 'as-is', without any expressed or implied */
|
||||
/* warranty. In no event will the authors be held liable for any damages */
|
||||
/* arising from the use of this software. */
|
||||
/* */
|
||||
/* Permission is granted to anyone to use this software for any purpose, */
|
||||
/* including commercial applications, and to alter it and redistribute it */
|
||||
/* freely, subject to the following restrictions: */
|
||||
/* */
|
||||
/* 1. The origin of this software must not be misrepresented; you must not */
|
||||
/* claim that you wrote the original software. If you use this software */
|
||||
/* in a product, an acknowledgment in the product documentation would be */
|
||||
/* appreciated but is not required. */
|
||||
/* 2. Altered source versions must be plainly marked as such, and must not */
|
||||
/* be misrepresented as being the original software. */
|
||||
/* 3. This notice may not be removed or altered from any source */
|
||||
/* distribution. */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifndef _KIM1_H
|
||||
#define _KIM1_H
|
||||
|
||||
/* Check for errors */
|
||||
#if !defined(__KIM1__)
|
||||
# error This module may only be used when compiling for the KIM-1!
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Hardware */
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
/* Read from tape */
|
||||
int __fastcall__ loadt (unsigned char);
|
||||
|
||||
/* Write to tape */
|
||||
int __fastcall__ dumpt (unsigned char, const void*, const void*);
|
||||
|
||||
|
||||
/* Write to 7-segment LED display. Due to hardware limitations it only
|
||||
** displays briefly, so must be called repeatedly to update the
|
||||
** display.
|
||||
**/
|
||||
void __fastcall__ scandisplay(unsigned char left, unsigned char middle, unsigned char right);
|
||||
|
||||
/*
|
||||
** Get a keypress from the keypad. Returns $00-$0F(0-F), $10(AD), $11(DA), $12(+),
|
||||
** $13(GO), $14(PC) or $15 for no keypress.
|
||||
**/
|
||||
int __fastcall__ getkey();
|
||||
|
||||
/* End of kim1.h */
|
||||
#endif
|
|
@ -39,9 +39,8 @@
|
|||
|
||||
|
||||
/* NULL pointer */
|
||||
#ifndef _HAVE_NULL
|
||||
#define NULL 0
|
||||
#define _HAVE_NULL
|
||||
#ifndef NULL
|
||||
#define NULL ((void *) 0)
|
||||
#endif
|
||||
|
||||
/* Locale information constants */
|
||||
|
@ -82,6 +81,3 @@ char* __fastcall__ setlocale (int category, const char* locale);
|
|||
|
||||
/* End of locale.h */
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@
|
|||
|
||||
/* The addresses of the static drivers */
|
||||
extern void lynx_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */
|
||||
extern void lynx_comlynx_ser[];
|
||||
extern void lynx_comlynx_ser[]; /* Referred to by ser_static_stddrv[] */
|
||||
extern void lynx_160_102_16_tgi[]; /* Referred to by tgi_static_stddrv[] */
|
||||
|
||||
|
||||
|
|
|
@ -36,6 +36,24 @@
|
|||
# error "This module may only be used when compiling for the Challenger 1P!"
|
||||
#endif
|
||||
|
||||
/* Colors are not functional, display is black and white only. */
|
||||
#define COLOR_BLACK 0x00
|
||||
#define COLOR_WHITE 0x01
|
||||
|
||||
#define CH_ULCORNER 0xCC
|
||||
#define CH_URCORNER 0xCD
|
||||
#define CH_LLCORNER 0xCB
|
||||
#define CH_LRCORNER 0xCE
|
||||
#define CH_TTEE 0xD9
|
||||
#define CH_BTEE 0xD7
|
||||
#define CH_LTEE 0xD8
|
||||
#define CH_RTEE 0xDA
|
||||
#define CH_CROSS 0xDB
|
||||
#define CH_HLINE 0x94
|
||||
#define CH_VLINE 0x95
|
||||
|
||||
#define CH_ENTER 0x0D
|
||||
|
||||
/* The following #defines will cause the matching functions calls in conio.h
|
||||
** to be overlaid by macros with the same names, saving the function call
|
||||
** overhead.
|
||||
|
@ -43,5 +61,6 @@
|
|||
#define _textcolor(color) COLOR_WHITE
|
||||
#define _bgcolor(color) COLOR_BLACK
|
||||
#define _bordercolor(color) COLOR_BLACK
|
||||
#define _cpeekcolor(color) COLOR_WHITE
|
||||
|
||||
#endif
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
|
||||
/* The addresses of the static drivers */
|
||||
extern void plus4_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */
|
||||
extern void plus4_stdser_ser[];
|
||||
extern void plus4_stdser_ser[]; /* Referred to by ser_static_stddrv[] */
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -123,6 +123,13 @@ struct ser_params {
|
|||
unsigned char handshake; /* Type of handshake to use */
|
||||
};
|
||||
|
||||
/* The name of the standard serial driver for a platform */
|
||||
extern const char ser_stddrv[];
|
||||
|
||||
/* The address of the static standard serial driver for a platform */
|
||||
extern const void ser_static_stddrv[];
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
|
|
|
@ -42,8 +42,8 @@ typedef char jmp_buf [5];
|
|||
|
||||
|
||||
|
||||
int __fastcall__ _setjmp (jmp_buf buf);
|
||||
#define setjmp _setjmp /* ISO insists on a macro */
|
||||
int __fastcall__ __setjmp (jmp_buf buf);
|
||||
#define setjmp __setjmp /* ISO insists on a macro */
|
||||
void __fastcall__ longjmp (jmp_buf buf, int retval) __attribute__((noreturn));
|
||||
|
||||
|
||||
|
|
|
@ -45,12 +45,12 @@ typedef unsigned char sig_atomic_t;
|
|||
typedef void __fastcall__ (*__sigfunc) (int);
|
||||
|
||||
/* Functions that implement SIG_IGN and SIG_DFL */
|
||||
void __fastcall__ _sig_ign (int);
|
||||
void __fastcall__ _sig_dfl (int);
|
||||
void __fastcall__ __sig_ign (int);
|
||||
void __fastcall__ __sig_dfl (int);
|
||||
|
||||
/* Standard signal handling functions */
|
||||
#define SIG_DFL _sig_dfl
|
||||
#define SIG_IGN _sig_ign
|
||||
#define SIG_DFL __sig_dfl
|
||||
#define SIG_IGN __sig_ign
|
||||
#define SIG_ERR ((__sigfunc) 0x0000)
|
||||
|
||||
/* Signal numbers */
|
||||
|
|
|
@ -53,9 +53,8 @@ typedef unsigned size_t;
|
|||
#endif
|
||||
|
||||
/* NULL pointer */
|
||||
#ifndef _HAVE_NULL
|
||||
#define NULL ((void *) 0)
|
||||
#define _HAVE_NULL
|
||||
#ifndef NULL
|
||||
#define NULL ((void *) 0)
|
||||
#endif
|
||||
|
||||
/* offsetof macro */
|
||||
|
@ -65,6 +64,3 @@ typedef unsigned size_t;
|
|||
|
||||
/* End of stddef.h */
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -38,9 +38,8 @@
|
|||
|
||||
|
||||
/* NULL pointer */
|
||||
#ifndef _HAVE_NULL
|
||||
#define NULL 0
|
||||
#define _HAVE_NULL
|
||||
#ifndef NULL
|
||||
#define NULL ((void *) 0)
|
||||
#endif
|
||||
|
||||
/* size_t is needed */
|
||||
|
@ -147,7 +146,11 @@ int __fastcall__ vfscanf (FILE* f, const char* format, __va_list ap);
|
|||
FILE* __fastcall__ fdopen (int fd, const char* mode); /* Unix */
|
||||
int __fastcall__ fileno (FILE* f); /* Unix */
|
||||
#endif
|
||||
void __fastcall__ _poserror (const char* msg); /* cc65 */
|
||||
void __fastcall__ __poserror (const char* msg); /* cc65 */
|
||||
#if __CC65_STD__ == __CC65_STD_CC65__
|
||||
/* define old name with one underscore for backwards compatibility */
|
||||
#define _poserror __poserror
|
||||
#endif
|
||||
|
||||
/* Masking macros for some functions */
|
||||
#define getc(f) fgetc (f) /* ANSI */
|
||||
|
|
|
@ -44,6 +44,11 @@ typedef unsigned size_t;
|
|||
#define _HAVE_size_t
|
||||
#endif
|
||||
|
||||
/* NULL pointer */
|
||||
#ifndef NULL
|
||||
#define NULL ((void *) 0)
|
||||
#endif
|
||||
|
||||
/* Standard exit codes */
|
||||
#define EXIT_SUCCESS 0
|
||||
#define EXIT_FAILURE 1
|
||||
|
@ -92,24 +97,44 @@ int __fastcall__ posix_memalign (void** memptr, size_t alignment, size_t size);
|
|||
*/
|
||||
#endif
|
||||
|
||||
void __fastcall__ _heapadd (void* mem, size_t size);
|
||||
void __fastcall__ __heapadd (void* mem, size_t size);
|
||||
/* Add a block to the heap */
|
||||
#if __CC65_STD__ == __CC65_STD_CC65__
|
||||
/* define old name with one underscore for backwards compatibility */
|
||||
#define _heapadd __heapadd
|
||||
#endif
|
||||
|
||||
size_t __fastcall__ _heapblocksize (const void* block);
|
||||
size_t __fastcall__ __heapblocksize (const void* block);
|
||||
/* Return the size of an allocated block */
|
||||
#if __CC65_STD__ == __CC65_STD_CC65__
|
||||
/* define old name with one underscore for backwards compatibility */
|
||||
#define _heapblocksize __heapblocksize
|
||||
#endif
|
||||
|
||||
size_t _heapmemavail (void);
|
||||
size_t __heapmemavail (void);
|
||||
/* Return the total free heap space */
|
||||
#if __CC65_STD__ == __CC65_STD_CC65__
|
||||
/* define old name with one underscore for backwards compatibility */
|
||||
#define _heapmemavail __heapmemavail
|
||||
#endif
|
||||
|
||||
size_t _heapmaxavail (void);
|
||||
size_t __heapmaxavail (void);
|
||||
/* Return the size of the largest free block on the heap */
|
||||
#if __CC65_STD__ == __CC65_STD_CC65__
|
||||
/* define old name with one underscore for backwards compatibility */
|
||||
#define _heapmaxavail __heapmaxavail
|
||||
#endif
|
||||
|
||||
|
||||
/* Random numbers */
|
||||
#define RAND_MAX 0x7FFF
|
||||
int rand (void);
|
||||
void __fastcall__ srand (unsigned seed);
|
||||
void _randomize (void); /* Non-standard */
|
||||
void __randomize (void); /* Non-standard */
|
||||
#if __CC65_STD__ == __CC65_STD_CC65__
|
||||
/* define old name with one underscore for backwards compatibility */
|
||||
#define _randomize __randomize
|
||||
#endif
|
||||
|
||||
/* Other standard stuff */
|
||||
void abort (void) __attribute__ ((noreturn));
|
||||
|
@ -130,7 +155,11 @@ unsigned long __fastcall__ strtoul (const char* nptr, char** endptr, int base);
|
|||
int __fastcall__ system (const char* s);
|
||||
|
||||
/* Non-ANSI functions */
|
||||
void __fastcall__ _swap (void* p, void* q, size_t size);
|
||||
void __fastcall__ __swap (void* p, void* q, size_t size);
|
||||
#if __CC65_STD__ == __CC65_STD_CC65__
|
||||
/* define old name with one underscore for backwards compatibility */
|
||||
#define _swap __swap
|
||||
#endif
|
||||
#if __CC65_STD__ == __CC65_STD_CC65__
|
||||
char* __fastcall__ itoa (int val, char* buf, int radix);
|
||||
char* __fastcall__ utoa (unsigned val, char* buf, int radix);
|
||||
|
@ -143,6 +172,3 @@ int __fastcall__ putenv (char* s);
|
|||
|
||||
/* End of stdlib.h */
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -37,9 +37,8 @@
|
|||
#define _STRING_H
|
||||
|
||||
/* NULL pointer */
|
||||
#ifndef _HAVE_NULL
|
||||
#define NULL 0
|
||||
#define _HAVE_NULL
|
||||
#ifndef NULL
|
||||
#define NULL ((void *) 0)
|
||||
#endif
|
||||
|
||||
/* size_t is needed */
|
||||
|
@ -74,7 +73,7 @@ void* __fastcall__ memset (void* s, int c, size_t count);
|
|||
/* The following is an internal function, the compiler will replace memset
|
||||
** with it if the fill value is zero. Never use this one directly!
|
||||
*/
|
||||
void* __fastcall__ _bzero (void* ptr, size_t n);
|
||||
void* __fastcall__ __bzero (void* ptr, size_t n);
|
||||
|
||||
/* Non standard: */
|
||||
#if __CC65_STD__ == __CC65_STD_CC65__
|
||||
|
@ -92,8 +91,12 @@ char* __fastcall__ strupper (char* s);
|
|||
char* __fastcall__ strqtok (char* s1, const char* s2);
|
||||
#endif
|
||||
|
||||
const char* __fastcall__ _stroserror (unsigned char errcode);
|
||||
const char* __fastcall__ __stroserror (unsigned char errcode);
|
||||
/* Map an operating system error number to an error message. */
|
||||
#if __CC65_STD__ == __CC65_STD_CC65__
|
||||
/* define old name with one underscore for backwards compatibility */
|
||||
#define _stroserror __stroserror
|
||||
#endif
|
||||
|
||||
|
||||
/* End of string.h */
|
||||
|
|
|
@ -39,9 +39,8 @@
|
|||
|
||||
|
||||
/* NULL pointer */
|
||||
#ifndef _HAVE_NULL
|
||||
#define NULL 0
|
||||
#define _HAVE_NULL
|
||||
#ifndef NULL
|
||||
#define NULL ((void *) 0)
|
||||
#endif
|
||||
|
||||
/* size_t is needed */
|
||||
|
@ -89,8 +88,8 @@ struct tm {
|
|||
# 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()
|
||||
clock_t __clocks_per_sec (void);
|
||||
# define CLOCKS_PER_SEC __clocks_per_sec()
|
||||
#endif
|
||||
#define CLOCK_REALTIME 0
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ TARGETS = apple2 \
|
|||
$(CBMS) \
|
||||
$(GEOS) \
|
||||
gamate \
|
||||
kim1 \
|
||||
lynx \
|
||||
nes \
|
||||
none \
|
||||
|
@ -38,6 +39,10 @@ TARGETS = apple2 \
|
|||
sym1 \
|
||||
telestrat
|
||||
|
||||
TARGETTEST = none \
|
||||
sim6502 \
|
||||
sim65c02
|
||||
|
||||
DRVTYPES = emd \
|
||||
joy \
|
||||
mou \
|
||||
|
@ -52,7 +57,7 @@ OUTPUTDIRS := lib
|
|||
$(subst ../,,$(wildcard ../target/*/drv/*)) \
|
||||
$(subst ../,,$(wildcard ../target/*/util))
|
||||
|
||||
.PHONY: all mostlyclean clean install zip lib $(TARGETS)
|
||||
.PHONY: all mostlyclean clean install zip lib libtest $(TARGETS)
|
||||
|
||||
.SUFFIXES:
|
||||
|
||||
|
@ -80,6 +85,8 @@ datadir = $(PREFIX)/share/cc65
|
|||
|
||||
all lib: $(TARGETS)
|
||||
|
||||
libtest: $(TARGETTEST)
|
||||
|
||||
mostlyclean:
|
||||
$(call RMDIR,../libwrk)
|
||||
|
||||
|
@ -115,9 +122,13 @@ endef # ZIP_recipe
|
|||
zip:
|
||||
$(foreach dir,$(OUTPUTDIRS),$(ZIP_recipe))
|
||||
|
||||
$(TARGETS):
|
||||
$(TARGETS): | ../lib
|
||||
@$(MAKE) --no-print-directory $@
|
||||
|
||||
# ../lib must be created globally before doing lib targets in parallel
|
||||
../lib:
|
||||
@$(call MKDIR,$@)
|
||||
|
||||
else # TARGET
|
||||
|
||||
CA65FLAGS =
|
||||
|
@ -286,10 +297,12 @@ $(EXTRA_OBJPAT): $(EXTRA_SRCPAT) | ../libwrk/$(TARGET) ../lib
|
|||
@echo $(TARGET) - $(<F)
|
||||
@$(CA65) -t $(TARGET) $(CA65FLAGS) --create-dep $(@:../lib/%.o=../libwrk/$(TARGET)/%.d) -o $@ $<
|
||||
|
||||
$(EXTRA_OBJS): | ../lib
|
||||
|
||||
../lib/$(TARGET).lib: $(OBJS) | ../lib
|
||||
$(AR65) a $@ $?
|
||||
|
||||
../libwrk/$(TARGET) ../lib ../target/$(TARGET)/util:
|
||||
../libwrk/$(TARGET) ../target/$(TARGET)/util:
|
||||
@$(call MKDIR,$@)
|
||||
|
||||
$(TARGET): $(EXTRA_OBJS) ../lib/$(TARGET).lib
|
||||
|
|
|
@ -33,8 +33,8 @@ zerofd: lda #$00
|
|||
; Return success
|
||||
lda #$00
|
||||
|
||||
; Set __oserror
|
||||
oserr: jmp __mappederrno
|
||||
; Set ___oserror
|
||||
oserr: jmp ___mappederrno
|
||||
|
||||
; Set __errno
|
||||
errno: jmp __directerrno
|
||||
errno: jmp ___directerrno
|
||||
|
|
|
@ -45,9 +45,9 @@ _getdevicedir:
|
|||
|
||||
; Handle errors
|
||||
erange: lda #<ERANGE
|
||||
jsr __directerrno
|
||||
jsr ___directerrno
|
||||
bne :+ ; Branch always
|
||||
oserr: jsr __mappederrno
|
||||
oserr: jsr ___mappederrno
|
||||
: lda #$00 ; Return NULL
|
||||
tax
|
||||
rts
|
||||
|
@ -73,7 +73,7 @@ oserr: jsr __mappederrno
|
|||
iny
|
||||
lda #$00
|
||||
sta (ptr1),y
|
||||
sta __oserror ; Clear _oserror
|
||||
sta ___oserror ; Clear __oserror
|
||||
|
||||
; Success, return buf
|
||||
lda ptr1
|
||||
|
|
|
@ -30,6 +30,6 @@ diocommon:
|
|||
|
||||
dioepilog:
|
||||
; Return success or error
|
||||
sta __oserror
|
||||
sta ___oserror
|
||||
ldx #$00
|
||||
rts
|
||||
|
|
|
@ -24,7 +24,7 @@ _dio_open:
|
|||
lda #$28 ; "No device connected"
|
||||
|
||||
; Return oserror
|
||||
oserr: sta __oserror
|
||||
oserr: sta ___oserror
|
||||
jmp return0
|
||||
|
||||
; Return success
|
||||
|
@ -34,5 +34,5 @@ oserr: sta __oserror
|
|||
asl
|
||||
asl
|
||||
ldx #$00
|
||||
stx __oserror
|
||||
stx ___oserror
|
||||
rts
|
||||
|
|
|
@ -16,7 +16,7 @@ _dio_query_sectcount:
|
|||
; Set handle
|
||||
sta mliparam + MLI::ON_LINE::UNIT_NUM
|
||||
|
||||
; Get ProDOS 8 block size (clears __oserror)
|
||||
; Get ProDOS 8 block size (clears ___oserror)
|
||||
jsr _dio_query_sectsize
|
||||
|
||||
; Alloc buffer
|
||||
|
@ -74,7 +74,7 @@ done: lda ptr4
|
|||
rts
|
||||
|
||||
nomem: lda #$FF ; Error code for sure not used by MLI
|
||||
oserr: sta __oserror
|
||||
oserr: sta ___oserror
|
||||
|
||||
; Save total blocks for failure
|
||||
lda #$00
|
||||
|
@ -85,7 +85,7 @@ oserr: sta __oserror
|
|||
; Check for non-ProDOS disk
|
||||
check: cmp #$52 ; "Not a ProDOS volume"
|
||||
bne oserr
|
||||
sta __oserror
|
||||
sta ___oserror
|
||||
|
||||
; Save total blocks for a 16-sector disk
|
||||
lda #<280
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
_dio_query_sectsize:
|
||||
; Clear error
|
||||
stx __oserror ; X = 0
|
||||
stx ___oserror ; X = 0
|
||||
|
||||
; Return ProDOS 8 block size
|
||||
txa ; X = 0
|
||||
|
|
|
@ -73,7 +73,8 @@ INSTALL:
|
|||
and #$f0
|
||||
cmp #$80
|
||||
bne @L1
|
||||
lda #EM_ERR_OK
|
||||
.assert EM_ERR_OK = 0, error
|
||||
txa
|
||||
rts
|
||||
@L1: lda #EM_ERR_NO_DEVICE
|
||||
; rts
|
||||
|
|
|
@ -19,8 +19,8 @@ typerr: lda #$4A ; "Incompatible file format"
|
|||
; Cleanup name
|
||||
oserr: jsr popname ; Preserves A
|
||||
|
||||
; Set __oserror
|
||||
jmp __mappederrno
|
||||
; Set ___oserror
|
||||
jmp ___mappederrno
|
||||
|
||||
_exec:
|
||||
; Save cmdline
|
||||
|
|
|
@ -52,7 +52,7 @@ _clock_getres:
|
|||
enosys: lda #ENOSYS
|
||||
|
||||
; Set __errno
|
||||
jmp __directerrno
|
||||
jmp ___directerrno
|
||||
|
||||
.rodata
|
||||
|
||||
|
|
|
@ -81,13 +81,13 @@ erange: lda #ERANGE
|
|||
jsr incsp3 ; Preserves A
|
||||
|
||||
; Set __errno
|
||||
jmp __directerrno
|
||||
jmp ___directerrno
|
||||
|
||||
; Cleanup stack
|
||||
oserr: jsr incsp3 ; Preserves A
|
||||
|
||||
; Set __oserror
|
||||
jmp __mappederrno
|
||||
; Set ___oserror
|
||||
jmp ___mappederrno
|
||||
|
||||
.bss
|
||||
|
||||
|
|
|
@ -71,8 +71,9 @@ INSTALL:
|
|||
stx gettype+2
|
||||
gettype:jsr $0000
|
||||
sta ostype
|
||||
lda #<JOY_ERR_OK
|
||||
ldx #>JOY_ERR_OK
|
||||
lda #JOY_ERR_OK
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax
|
||||
; Fall through
|
||||
|
||||
; UNINSTALL routine. Is called before the driver is removed from memory.
|
||||
|
|
|
@ -107,13 +107,13 @@ seek_common:
|
|||
einval: lda #EINVAL
|
||||
|
||||
; Set __errno
|
||||
errno: jsr __directerrno ; leaves -1 in AX
|
||||
errno: jsr ___directerrno ; leaves -1 in AX
|
||||
stx sreg ; extend return value to 32 bits
|
||||
stx sreg+1
|
||||
rts
|
||||
|
||||
; Set __oserror
|
||||
oserr: jsr __mappederrno ; leaves -1 in AX
|
||||
; Set ___oserror
|
||||
oserr: jsr ___mappederrno ; leaves -1 in AX
|
||||
stx sreg ; extend return value to 32 bits
|
||||
stx sreg+1
|
||||
rts
|
||||
|
|
|
@ -133,8 +133,8 @@ next: inc ptr1+1
|
|||
bcc :+
|
||||
|
||||
; Mouse firmware not found
|
||||
lda #<MOUSE_ERR_NO_DEVICE
|
||||
ldx #>MOUSE_ERR_NO_DEVICE
|
||||
lda #MOUSE_ERR_NO_DEVICE
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
; Check Pascal 1.1 Firmware Protocol ID bytes
|
||||
|
|
|
@ -64,7 +64,7 @@ _open:
|
|||
errno: jsr incsp4 ; Preserves A
|
||||
|
||||
; Set __errno
|
||||
jmp __directerrno
|
||||
jmp ___directerrno
|
||||
|
||||
; Save fdtab slot
|
||||
found: tya
|
||||
|
@ -147,8 +147,8 @@ oserr1: ldy tmp2 ; Restore fdtab slot
|
|||
jsr freebuffer
|
||||
pla ; Restore oserror code
|
||||
|
||||
; Set __oserror
|
||||
jmp __mappederrno
|
||||
; Set ___oserror
|
||||
jmp ___mappederrno
|
||||
|
||||
open: ldy tmp2 ; Restore fdtab slot
|
||||
|
||||
|
@ -209,7 +209,7 @@ done: lda tmp1 ; Restore fd
|
|||
|
||||
; Return success
|
||||
ldx #$00
|
||||
stx __oserror
|
||||
stx ___oserror
|
||||
rts
|
||||
|
||||
freebuffer:
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
;
|
||||
; Ullrich von Bassewitz, 17.05.2000
|
||||
;
|
||||
; int __fastcall__ _osmaperrno (unsigned char oserror);
|
||||
; int __fastcall__ __osmaperrno (unsigned char oserror);
|
||||
;
|
||||
|
||||
.export __osmaperrno
|
||||
.export ___osmaperrno
|
||||
|
||||
.include "errno.inc"
|
||||
|
||||
__osmaperrno:
|
||||
___osmaperrno:
|
||||
ldx #ErrTabSize
|
||||
: cmp ErrTab-2,x ; Search for the error code
|
||||
beq :+ ; Jump if found
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
;
|
||||
; Ullrich von Bassewitz, 07.11.2002
|
||||
;
|
||||
; void _randomize (void);
|
||||
; void __randomize (void);
|
||||
; /* Initialize the random number generator */
|
||||
;
|
||||
|
||||
.export __randomize
|
||||
.export ___randomize
|
||||
.import _srand
|
||||
|
||||
.include "apple2.inc"
|
||||
|
||||
__randomize:
|
||||
___randomize:
|
||||
ldx RNDH ; Use random value supplied by ROM
|
||||
lda RNDL
|
||||
jmp _srand ; Initialize generator
|
||||
|
|
|
@ -52,7 +52,7 @@ _read:
|
|||
|
||||
; Device succeeds always
|
||||
device: lda #$00
|
||||
sta __oserror
|
||||
sta ___oserror
|
||||
|
||||
; Set counter to zero
|
||||
sta ptr3
|
||||
|
@ -107,4 +107,4 @@ check: lda ptr3
|
|||
einval: lda #EINVAL
|
||||
|
||||
; Set __errno
|
||||
errno: jmp __directerrno
|
||||
errno: jmp ___directerrno
|
||||
|
|
|
@ -49,10 +49,10 @@ rwcommon:
|
|||
|
||||
rwepilog:
|
||||
; Return success
|
||||
sta __oserror ; A = 0
|
||||
sta ___oserror ; A = 0
|
||||
lda mliparam + MLI::RW::TRANS_COUNT
|
||||
ldx mliparam + MLI::RW::TRANS_COUNT+1
|
||||
rts
|
||||
|
||||
; Set __oserror
|
||||
oserr: jmp __mappederrno
|
||||
; Set ___oserror
|
||||
oserr: jmp ___mappederrno
|
||||
|
|
|
@ -57,7 +57,9 @@
|
|||
;----------------------------------------------------------------------------
|
||||
; I/O definitions
|
||||
|
||||
ACIA = $C088
|
||||
Offset = $8F ; Move 6502 false read out of I/O to page $BF
|
||||
|
||||
ACIA = $C088-Offset
|
||||
ACIA_DATA = ACIA+0 ; Data register
|
||||
ACIA_STATUS = ACIA+1 ; Status register
|
||||
ACIA_CMD = ACIA+2 ; Command register
|
||||
|
@ -166,8 +168,9 @@ SER_CLOSE:
|
|||
sta ACIA_CMD,x
|
||||
|
||||
; Done, return an error code
|
||||
: lda #<SER_ERR_OK
|
||||
tax ; A is zero
|
||||
: lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
stx Index ; Mark port as closed
|
||||
rts
|
||||
|
||||
|
@ -197,6 +200,7 @@ SER_OPEN:
|
|||
asl
|
||||
asl
|
||||
asl
|
||||
adc #Offset ; Assume carry to be clear
|
||||
tax
|
||||
|
||||
; Check if the handshake setting is valid
|
||||
|
@ -253,23 +257,24 @@ SER_OPEN:
|
|||
|
||||
; Done
|
||||
stx Index ; Mark port as open
|
||||
lda #<SER_ERR_OK
|
||||
tax ; A is zero
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
; Device (hardware) not found
|
||||
NoDevice:lda #<SER_ERR_NO_DEVICE
|
||||
ldx #>SER_ERR_NO_DEVICE
|
||||
NoDevice:lda #SER_ERR_NO_DEVICE
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
; Invalid parameter
|
||||
InvParam:lda #<SER_ERR_INIT_FAILED
|
||||
ldx #>SER_ERR_INIT_FAILED
|
||||
InvParam:lda #SER_ERR_INIT_FAILED
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
; Baud rate not available
|
||||
InvBaud:lda #<SER_ERR_BAUD_UNAVAIL
|
||||
ldx #>SER_ERR_BAUD_UNAVAIL
|
||||
InvBaud:lda #SER_ERR_BAUD_UNAVAIL
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
@ -289,8 +294,8 @@ SER_GET:
|
|||
: lda RecvFreeCnt ; (25)
|
||||
cmp #$FF
|
||||
bne :+
|
||||
lda #<SER_ERR_NO_DATA
|
||||
ldx #>SER_ERR_NO_DATA
|
||||
lda #SER_ERR_NO_DATA
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
; Check for flow stopped & enough free: release flow control
|
||||
|
@ -333,8 +338,8 @@ SER_PUT:
|
|||
; Put byte into send buffer & send
|
||||
: ldy SendFreeCnt
|
||||
bne :+
|
||||
lda #<SER_ERR_OVERFLOW
|
||||
ldx #>SER_ERR_OVERFLOW
|
||||
lda #SER_ERR_OVERFLOW
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
: ldy SendTail
|
||||
|
@ -343,7 +348,8 @@ SER_PUT:
|
|||
dec SendFreeCnt
|
||||
lda #$FF ; TryHard = true
|
||||
jsr TryToSend
|
||||
lda #<SER_ERR_OK
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
|
@ -356,7 +362,8 @@ SER_STATUS:
|
|||
lda ACIA_STATUS,x
|
||||
ldx #$00
|
||||
sta (ptr1,x)
|
||||
txa ; SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
txa
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
@ -376,11 +383,12 @@ SER_IOCTL:
|
|||
bcs :+
|
||||
|
||||
stx Slot
|
||||
tax ; SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
: lda #<SER_ERR_INV_IOCTL
|
||||
ldx #>SER_ERR_INV_IOCTL
|
||||
: lda #SER_ERR_INV_IOCTL
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
;
|
||||
; Address of the static standard serial driver
|
||||
;
|
||||
; Oliver Schmidt, 2022-12-22
|
||||
;
|
||||
; const void ser_static_stddrv[];
|
||||
;
|
||||
|
||||
.export _ser_static_stddrv
|
||||
.ifdef __APPLE2ENH__
|
||||
.import _a2e_ssc_ser
|
||||
.else
|
||||
.import _a2_ssc_ser
|
||||
.endif
|
||||
|
||||
.rodata
|
||||
|
||||
.ifdef __APPLE2ENH__
|
||||
_ser_static_stddrv := _a2e_ssc_ser
|
||||
.else
|
||||
_ser_static_stddrv := _a2_ssc_ser
|
||||
.endif
|
|
@ -0,0 +1,18 @@
|
|||
;
|
||||
; Name of the standard serial driver
|
||||
;
|
||||
; Oliver Schmidt, 2022-12-22
|
||||
;
|
||||
; const char ser_stddrv[];
|
||||
;
|
||||
|
||||
.export _ser_stddrv
|
||||
|
||||
.rodata
|
||||
|
||||
_ser_stddrv:
|
||||
.ifdef __APPLE2ENH__
|
||||
.asciiz "A2E.SSC.SER"
|
||||
.else
|
||||
.asciiz "A2.SSC.SER"
|
||||
.endif
|
|
@ -68,4 +68,4 @@ enosys: lda #ENOSYS
|
|||
erange: lda #ERANGE
|
||||
|
||||
; Set __errno
|
||||
errno: jmp __directerrno
|
||||
errno: jmp ___directerrno
|
||||
|
|
|
@ -107,8 +107,8 @@ done: lda #$00
|
|||
einval: lda #EINVAL
|
||||
|
||||
; Set __errno
|
||||
errno: jmp __directerrno
|
||||
errno: jmp ___directerrno
|
||||
|
||||
; Set __oserror
|
||||
oserr: jmp __mappederrno
|
||||
; Set ___oserror
|
||||
oserr: jmp ___mappederrno
|
||||
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
; originally by Ullrich von Bassewitz and Sidney Cadot
|
||||
;
|
||||
; clock_t clock (void);
|
||||
; clock_t _clocks_per_sec (void);
|
||||
; clock_t __clocks_per_sec (void);
|
||||
;
|
||||
|
||||
.export _clock, __clocks_per_sec
|
||||
.export _clock, ___clocks_per_sec
|
||||
.importzp sreg
|
||||
|
||||
.include "atari.inc"
|
||||
|
@ -28,7 +28,7 @@
|
|||
.endproc
|
||||
|
||||
|
||||
.proc __clocks_per_sec
|
||||
.proc ___clocks_per_sec
|
||||
|
||||
ldx #$00 ; Clear byte 1 of return value
|
||||
stx sreg ; Clear byte 2 of return value
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
.include "atari.inc"
|
||||
.export _close
|
||||
.import __do_oserror,popax,__oserror
|
||||
.import __do_oserror,popax,___oserror
|
||||
.import fdtoiocb_down,__inviocb
|
||||
|
||||
.proc _close
|
||||
|
@ -18,7 +18,7 @@
|
|||
jsr CIOV
|
||||
bmi closerr
|
||||
ok: ldx #0
|
||||
stx __oserror ; clear system specific error code
|
||||
stx ___oserror ; clear system specific error code
|
||||
txa
|
||||
rts
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
;
|
||||
|
||||
.export _dio_phys_to_log
|
||||
.import popax,__oserror
|
||||
.import popax,___oserror
|
||||
.importzp ptr1,ptr2,ptr3
|
||||
.include "atari.inc"
|
||||
|
||||
|
@ -54,7 +54,7 @@
|
|||
ldx #0
|
||||
txa
|
||||
ret:
|
||||
sta __oserror
|
||||
sta ___oserror
|
||||
rts ; return success
|
||||
|
||||
; invalid handle
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
.export _dio_log_to_phys
|
||||
.include "atari.inc"
|
||||
.importzp ptr1,ptr2,ptr3
|
||||
.import popax,popptr1,__oserror
|
||||
.import popax,popptr1,___oserror
|
||||
|
||||
.proc _dio_log_to_phys
|
||||
|
||||
|
@ -56,7 +56,7 @@ _l1: lda (ptr1,x)
|
|||
|
||||
txa
|
||||
ret:
|
||||
sta __oserror
|
||||
sta ___oserror
|
||||
rts ; return success
|
||||
|
||||
; invalid handle
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
.export _dio_open, _dio_close
|
||||
.export sectsizetab
|
||||
.import __oserror, __sio_call, _dio_read
|
||||
.import ___oserror, __sio_call, _dio_read
|
||||
.import pushax, addysp, subysp
|
||||
.importzp ptr2, sp
|
||||
.include "atari.inc"
|
||||
|
@ -31,7 +31,7 @@ sectsizetab:
|
|||
|
||||
_inv_drive:
|
||||
lda #NONDEV ; non-existent device
|
||||
sta __oserror
|
||||
sta ___oserror
|
||||
lda #0
|
||||
tax
|
||||
rts ; return NULL
|
||||
|
@ -49,7 +49,7 @@ _dio_open:
|
|||
sta sectsizetab+sst_flag,x ; set flag that drive is "open"
|
||||
lda #0
|
||||
sta sectsizetab+sst_sectsize+1,x
|
||||
sta __oserror ; success
|
||||
sta ___oserror ; success
|
||||
tya
|
||||
sta sectsizetab+sst_driveno,x
|
||||
stx ptr2
|
||||
|
@ -156,7 +156,7 @@ s128: lda #128
|
|||
lda #0
|
||||
ldy #sst_flag
|
||||
sta (ptr2),y
|
||||
sta __oserror ; success
|
||||
sta ___oserror ; success
|
||||
tax
|
||||
rts ; return no error
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
.include "atari.inc"
|
||||
.export _dio_query_sectsize
|
||||
.importzp ptr1,tmp1
|
||||
.import popax, __oserror
|
||||
.import popax, ___oserror
|
||||
|
||||
.proc _dio_query_sectsize
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
|||
stx ptr1+1
|
||||
|
||||
lda #0
|
||||
sta __oserror
|
||||
sta ___oserror
|
||||
|
||||
ldy #sst_sectsize+1
|
||||
lda (ptr1),y
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
;
|
||||
; __do_oserror updates __oserror and errno. Do a JMP here right after
|
||||
; __do_oserror updates ___oserror and errno. Do a JMP here right after
|
||||
; calling CIOV. It will return with AX set to -1 ($FFFF). It expects the CIO
|
||||
; status in Y.
|
||||
;
|
||||
|
@ -9,4 +9,4 @@
|
|||
|
||||
__do_oserror:
|
||||
tya
|
||||
jmp __mappederrno
|
||||
jmp ___mappederrno
|
||||
|
|
|
@ -34,7 +34,7 @@ notsupp:lda #ENOSYS ; "unsupported system call"
|
|||
.byte $2C ; bit opcode, eats the next 2 bytes
|
||||
noiocb: lda #EMFILE ; "too many open files"
|
||||
jsr incsp2 ; clean up stack
|
||||
seterr: jmp __directerrno
|
||||
seterr: jmp ___directerrno
|
||||
|
||||
|
||||
; entry point
|
||||
|
@ -148,7 +148,7 @@ copycd: lda #ATEOL
|
|||
pha ; remember error code
|
||||
jsr close ; close the IOCB (required even if open failed)
|
||||
pla ; put error code back into A
|
||||
setmerr:jmp __mappederrno ; update errno from OS specific error code in A
|
||||
setmerr:jmp ___mappederrno ; update errno from OS specific error code in A
|
||||
|
||||
openok: lda #>buf
|
||||
sta ICBAH,x ; set buffer address
|
||||
|
|
|
@ -41,7 +41,7 @@ _clock_getres:
|
|||
enosys: lda #ENOSYS
|
||||
|
||||
; Set __errno
|
||||
jmp __directerrno
|
||||
jmp ___directerrno
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; timespec struct with tv_sec set to 1 second
|
||||
|
|
|
@ -105,7 +105,7 @@ errexit:jsr incsp3 ; Preserves A
|
|||
|
||||
; set __errno
|
||||
|
||||
jmp __directerrno
|
||||
jmp ___directerrno
|
||||
|
||||
; -------
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
.export __graphics
|
||||
|
||||
.import findfreeiocb
|
||||
.import __oserror
|
||||
.import ___oserror
|
||||
.import fddecusage
|
||||
.import clriocb
|
||||
.import fdtoiocb
|
||||
|
@ -45,7 +45,7 @@ parmok: jsr findfreeiocb
|
|||
beq iocbok ; we found one
|
||||
|
||||
lda #<EMFILE ; "too many open files"
|
||||
seterr: jsr __mappederrno ; @@@ probably not correct to set errno here @@@
|
||||
seterr: jsr ___mappederrno ; @@@ probably not correct to set errno here @@@
|
||||
rts ; return -1
|
||||
|
||||
;invmode:ldx #>EINVAL
|
||||
|
@ -94,7 +94,7 @@ doopen: txa
|
|||
|
||||
lda tmp2 ; get fd
|
||||
ldx #0
|
||||
stx __oserror
|
||||
stx ___oserror
|
||||
rts
|
||||
|
||||
cioerr: sty tmp3 ; remember error code
|
||||
|
@ -103,6 +103,6 @@ cioerr: sty tmp3 ; remember error code
|
|||
jsr CIOV ; close IOCB again since open failed
|
||||
jsr fddecusage ; and decrement usage counter of fd
|
||||
lda tmp3 ; put error code into A
|
||||
jmp __mappederrno
|
||||
jmp ___mappederrno
|
||||
|
||||
.endproc ; __graphics
|
||||
|
|
|
@ -7,4 +7,4 @@
|
|||
|
||||
__inviocb:
|
||||
lda #<EINVAL
|
||||
jmp __directerrno
|
||||
jmp ___directerrno
|
||||
|
|
|
@ -69,7 +69,8 @@ INSTALL:
|
|||
lda #$34
|
||||
sta PACTL
|
||||
lda #JOY_ERR_OK
|
||||
ldx #0
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -62,7 +62,8 @@ JOY_COUNT = 4 ; Number of joysticks we support
|
|||
|
||||
INSTALL:
|
||||
lda #JOY_ERR_OK
|
||||
ldx #0
|
||||
.assert JOY_ERR_OK = 0, error
|
||||
tax
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
|
||||
.export _lseek
|
||||
.import incsp6,__oserror
|
||||
.import incsp6,___oserror
|
||||
.import __inviocb,ldax0sp,ldaxysp,fdtoiocb
|
||||
.import __dos_type
|
||||
.import fd_table
|
||||
|
@ -21,7 +21,7 @@
|
|||
; seeking not supported, return -1 and ENOSYS errno value
|
||||
no_supp:jsr incsp6
|
||||
lda #<ENOSYS
|
||||
jsr __directerrno ; returns with $FFFF in AX
|
||||
jsr ___directerrno ; returns with $FFFF in AX
|
||||
sta sreg
|
||||
sta sreg+1
|
||||
rts
|
||||
|
@ -94,7 +94,7 @@ xxerr: tya
|
|||
pha
|
||||
jsr incsp6
|
||||
pla
|
||||
jsr __mappederrno ; returns with $FFFF in AX
|
||||
jsr ___mappederrno ; returns with $FFFF in AX
|
||||
sta sreg
|
||||
sta sreg+1
|
||||
rts
|
||||
|
|
|
@ -137,9 +137,10 @@ INSTALL:
|
|||
ldx YPos+1
|
||||
jsr CMOVEY
|
||||
|
||||
; Done, return zero (= MOUSE_ERR_OK)
|
||||
; Done
|
||||
|
||||
ldx #$00
|
||||
ldx #MOUSE_ERR_OK
|
||||
.assert MOUSE_ERR_OK = 0, error
|
||||
txa
|
||||
rts
|
||||
|
||||
|
|
|
@ -268,9 +268,10 @@ INSTALL:
|
|||
and #$0f
|
||||
sta old_porta_vbi
|
||||
|
||||
; Done, return zero (= MOUSE_ERR_OK)
|
||||
; Done
|
||||
|
||||
ldx #$00
|
||||
ldx #MOUSE_ERR_OK
|
||||
.assert MOUSE_ERR_OK = 0, error
|
||||
txa
|
||||
rts
|
||||
|
||||
|
|
|
@ -132,9 +132,10 @@ INSTALL:
|
|||
ldx YPos+1
|
||||
jsr CMOVEY
|
||||
|
||||
; Done, return zero (= MOUSE_ERR_OK)
|
||||
; Done
|
||||
|
||||
ldx #$00
|
||||
ldx #MOUSE_ERR_OK
|
||||
.assert MOUSE_ERR_OK = 0, error
|
||||
txa
|
||||
rts
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue