mirror of
https://github.com/cc65/cc65.git
synced 2024-12-27 00:29:31 +00:00
Merge branch 'cc65:master' into master
This commit is contained in:
commit
1fe12f112e
15
.editorconfig
Normal file
15
.editorconfig
Normal file
@ -0,0 +1,15 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
guidelines = 80, 120
|
||||
|
||||
[*.{c,h}]
|
||||
cpp_new_line_before_open_brace_block=same_line
|
||||
cpp_new_line_before_open_brace_function=new_line
|
||||
cpp_space_before_function_open_parenthesis=insert
|
||||
cpp_new_line_before_else=false
|
2
.github/checks/spaces.sh
vendored
2
.github/checks/spaces.sh
vendored
@ -5,7 +5,7 @@ CHECK_PATH=.
|
||||
|
||||
cd $SCRIPT_PATH/../../
|
||||
|
||||
FILES=`find $CHECK_PATH -type f \( -name \*.inc -o -name Makefile -o -name \*.cfg -o -name \*.\[chs\] -o -name \*.mac -o -name \*.asm -o -name \*.sgml \) -print | grep -v "libwrk/" | grep -v "testwrk/" | xargs grep -l ' $'`
|
||||
FILES=`find $CHECK_PATH -type f \( -name \*.inc -o -name Makefile -o -name \*.cfg -o -name \*.\[chs\] -o -name \*.mac -o -name \*.asm -o -name \*.sgml \) -print | grep -v "test/" | grep -v "libwrk/" | grep -v "testwrk/" | xargs grep -l ' $'`
|
||||
|
||||
cd $OLDCWD
|
||||
|
||||
|
2
.github/checks/tabs.sh
vendored
2
.github/checks/tabs.sh
vendored
@ -5,7 +5,7 @@ CHECK_PATH=.
|
||||
|
||||
cd $SCRIPT_PATH/../../
|
||||
|
||||
FILES=`find $CHECK_PATH -type f \( \( -name \*.inc -a \! -name Makefile.inc \) -o -name \*.cfg -o -name \*.\[chs\] -o -name \*.mac -o -name \*.asm -o -name \*.sgml \) -print | grep -v "libwrk/" | grep -v "testwrk/" | xargs grep -l $'\t'`
|
||||
FILES=`find $CHECK_PATH -type f \( \( -name \*.inc -a \! -name Makefile.inc \) -o -name \*.cfg -o -name \*.\[chs\] -o -name \*.mac -o -name \*.asm -o -name \*.sgml \) -print | grep -v "test/" | grep -v "libwrk/" | grep -v "testwrk/" | xargs grep -l $'\t'`
|
||||
|
||||
cd $OLDCWD
|
||||
|
||||
|
39
.github/workflows/build-on-pull-request.yml
vendored
39
.github/workflows/build-on-pull-request.yml
vendored
@ -19,7 +19,7 @@ jobs:
|
||||
- shell: bash
|
||||
run: git config --global core.autocrlf input
|
||||
- name: Checkout Source
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Do some simple style checks
|
||||
shell: bash
|
||||
@ -43,13 +43,18 @@ jobs:
|
||||
- name: Build the document files.
|
||||
shell: bash
|
||||
run: make -j2 doc
|
||||
- name: Upload a documents snapshot.
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: docs
|
||||
path: ./html
|
||||
- name: Build 64-bit Windows versions of the tools.
|
||||
run: |
|
||||
make -C src clean
|
||||
make -j2 bin USER_CFLAGS=-Werror CROSS_COMPILE=x86_64-w64-mingw32-
|
||||
|
||||
build_windows:
|
||||
name: Build (Windows)
|
||||
name: Build and Test (Windows)
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
@ -57,13 +62,31 @@ jobs:
|
||||
run: git config --global core.autocrlf input
|
||||
|
||||
- name: Checkout Source
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Add msbuild to PATH
|
||||
uses: microsoft/setup-msbuild@v1.1
|
||||
uses: microsoft/setup-msbuild@v2
|
||||
|
||||
- name: Build app (debug)
|
||||
run: msbuild src\cc65.sln -t:rebuild -property:Configuration=Debug
|
||||
- name: Build app (x86 debug)
|
||||
run: msbuild src\cc65.sln -t:rebuild -property:Configuration=Debug -property:Platform=Win32
|
||||
|
||||
- name: Build app (release)
|
||||
run: msbuild src\cc65.sln -t:rebuild -property:Configuration=Release
|
||||
- name: Build app (x86 release)
|
||||
run: msbuild src\cc65.sln -t:rebuild -property:Configuration=Release -property:Platform=Win32
|
||||
|
||||
- name: Build app (x64 release)
|
||||
run: msbuild src\cc65.sln -t:rebuild -property:Configuration=Debug -property:Platform=x64
|
||||
|
||||
- name: Build app (x64 release)
|
||||
run: msbuild src\cc65.sln -t:rebuild -property:Configuration=Release -property:Platform=x64
|
||||
|
||||
- name: Build utils (MinGW)
|
||||
shell: cmd
|
||||
run: make -j2 util SHELL=cmd
|
||||
|
||||
- name: Build the platform libraries (make lib)
|
||||
shell: cmd
|
||||
run: make -j2 lib QUIET=1 SHELL=cmd
|
||||
|
||||
- name: Run the regression tests (make test)
|
||||
shell: cmd
|
||||
run: make test QUIET=1 SHELL=cmd
|
||||
|
52
.github/workflows/snapshot-on-push-master.yml
vendored
52
.github/workflows/snapshot-on-push-master.yml
vendored
@ -18,10 +18,10 @@ jobs:
|
||||
run: git config --global core.autocrlf input
|
||||
|
||||
- name: Checkout Source
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Add msbuild to PATH
|
||||
uses: microsoft/setup-msbuild@v1.1
|
||||
uses: microsoft/setup-msbuild@v2
|
||||
|
||||
- name: Build app (debug)
|
||||
run: msbuild src\cc65.sln -t:rebuild -property:Configuration=Debug
|
||||
@ -44,7 +44,7 @@ jobs:
|
||||
- shell: bash
|
||||
run: git config --global core.autocrlf input
|
||||
- name: Checkout Source
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Do some simple style checks
|
||||
shell: bash
|
||||
@ -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@v4
|
||||
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@v4
|
||||
with:
|
||||
name: cc65-snapshot-win64.zip
|
||||
name: cc65-snapshot-win64
|
||||
path: cc65-snapshot-win64.zip
|
||||
|
||||
- name: Get the online documents repo.
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: cc65/doc
|
||||
# this token will expire, if it does, generate a new one as decribed in https://github.com/cc65/cc65/issues/2065
|
||||
# - 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@v4
|
||||
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,23 @@ jobs:
|
||||
port: ${{ secrets.SSH_PORT }}
|
||||
user: ${{ secrets.SSH_USER }}
|
||||
key: ${{ secrets.SSH_KEY }}
|
||||
- name: Upload 64-bit Windows snapshot to sourceforge
|
||||
uses: nogsantos/scp-deploy@master
|
||||
with:
|
||||
src: cc65-snapshot-win64.zip
|
||||
host: ${{ secrets.SSH_HOST }}
|
||||
remote: ${{ secrets.SSH_DIR }}
|
||||
port: ${{ secrets.SSH_PORT }}
|
||||
user: ${{ secrets.SSH_USER }}
|
||||
key: ${{ secrets.SSH_KEY }}
|
||||
- name: Upload documents snapshot to sourceforge
|
||||
uses: nogsantos/scp-deploy@master
|
||||
with:
|
||||
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
|
||||
|
78
.github/workflows/windows-test-scheduled.yml
vendored
Normal file
78
.github/workflows/windows-test-scheduled.yml
vendored
Normal file
@ -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@v4
|
||||
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@v4
|
||||
|
||||
- name: Add msbuild to PATH
|
||||
if: steps.check-sha.outputs.cache-hit != 'true'
|
||||
uses: microsoft/setup-msbuild@v2
|
||||
|
||||
- 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
|
@ -1,4 +1,6 @@
|
||||
This document contains all kinds of information that you should know if you want to contribute to the cc65 project. Before you start, please read all of it. If something is not clear to you, please ask - this document is an ongoing effort and may well be incomplete.
|
||||
This document contains all kinds of information that you should know if you want to contribute to the cc65 project. Before you start, please read all of it. If something is not clear to you, please ask - this document is an ongoing effort and may well be incomplete.
|
||||
|
||||
Also, before you put a lot of work into implementing something you want to contribute, please get in touch with one of the developers and ask if what you are going to do is actually wanted and has a chance of being merged. Perhaps someone else is already working on it, or perhaps what you have in mind is not how we'd expect it to be - talking to us before you start might save you a lot of work in those cases.
|
||||
|
||||
(''Note:'' The word "must" indicates a requirement. The word "should" indicates a recomendation.)
|
||||
|
||||
@ -74,10 +76,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.
|
||||
@ -134,7 +138,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 ; Promote char return value
|
||||
</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).
|
||||
@ -181,9 +200,13 @@ 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
|
||||
|
||||
|
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 $@
|
||||
|
||||
|
18
README.md
18
README.md
@ -7,12 +7,20 @@ For details look at the [Website](https://cc65.github.io).
|
||||
|
||||
## People
|
||||
|
||||
Project founders:
|
||||
|
||||
* John R. Dunning: [original implementation](https://public.websites.umich.edu/~archive/atari/8bit/Languages/Cc65/) of the C compiler and runtime library, Atari hosted
|
||||
* Ullrich von Bassewitz:
|
||||
* move the code to modern systems
|
||||
* rewrite most parts of the compiler
|
||||
* complete rewrite of the runtime library
|
||||
|
||||
Core team members:
|
||||
|
||||
* [Christian Groessler](https://github.com/groessler): Atari, Atari5200, and CreatiVision library Maintainer
|
||||
* [dqh](https://github.com/dqh-au): GHA help
|
||||
* [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 +31,8 @@ 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
|
||||
* [rumbledethumps](https://github.com/rumbledethumps): Picocomputer target
|
||||
|
||||
*(The above list is incomplete, if you feel left out - please speak up or add yourself in a PR)*
|
||||
|
||||
@ -44,8 +54,10 @@ Some of us may also be around on IRC [#cc65](https://web.libera.chat/#cc65) on l
|
||||
|
||||
# Downloads
|
||||
|
||||
* [Windows Snapshot](https://sourceforge.net/projects/cc65/files/cc65-snapshot-win32.zip)
|
||||
* [Windows 64bit Snapshot](https://sourceforge.net/projects/cc65/files/cc65-snapshot-win64.zip)
|
||||
|
||||
* [Linux Snapshot DEB and RPM](https://software.opensuse.org//download.html?project=home%3Astrik&package=cc65)
|
||||
* [Windows 32bit Snapshot](https://sourceforge.net/projects/cc65/files/cc65-snapshot-win32.zip)
|
||||
|
||||
* [Linux Snapshot DEB and RPM](https://software.opensuse.org/download.html?project=home%3Astrik&package=cc65)
|
||||
|
||||
[![Snapshot Build](https://github.com/cc65/cc65/actions/workflows/snapshot-on-push-master.yml/badge.svg?branch=master)](https://github.com/cc65/cc65/actions/workflows/snapshot-on-push-master.yml)
|
||||
|
@ -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
|
||||
|
@ -31,10 +31,8 @@
|
||||
|
||||
; bgt - jump if unsigned greater
|
||||
.macro bgt Arg
|
||||
.local L
|
||||
beq L
|
||||
beq *+4
|
||||
bcs Arg
|
||||
L:
|
||||
.endmacro
|
||||
|
||||
; ble - jump if unsigned less or equal
|
||||
|
31
asminc/kim1.inc
Normal file
31
asminc/kim1.inc
Normal file
@ -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
|
@ -81,8 +81,42 @@ MATHJ = $FC6F
|
||||
|
||||
; Suzy Misc
|
||||
|
||||
SPRCTL0 = $FC80
|
||||
SPRCTL0 = $FC80
|
||||
; Sprite bits-per-pixel definitions
|
||||
BPP_MASK = %11000000 ; Mask for settings bits per pixel
|
||||
BPP_1 = %00000000
|
||||
BPP_2 = %01000000
|
||||
BPP_3 = %10000000
|
||||
BPP_4 = %11000000
|
||||
; More sprite control 0 bit definitions
|
||||
HFLIP = %00100000
|
||||
VFLIP = %00010000
|
||||
; Sprite types - redefined to reflect the reality caused by the shadow error
|
||||
TYPE_SHADOW = %00000111
|
||||
TYPE_XOR = %00000110
|
||||
TYPE_NONCOLL = %00000101 ; Non-colliding
|
||||
TYPE_NORMAL = %00000100
|
||||
TYPE_BOUNDARY = %00000011
|
||||
TYPE_BSHADOW = %00000010 ; Background shadow
|
||||
TYPE_BACKNONCOLL = %00000001 ; Background non-colliding
|
||||
TYPE_BACKGROUND = %00000000
|
||||
|
||||
SPRCTL1 = $FC81
|
||||
LITERAL = %10000000
|
||||
PACKED = %00000000
|
||||
ALGO3 = %01000000 ; Broken, do not set this bit!
|
||||
; Sprite reload mask definitions
|
||||
RELOAD_MASK = %00110000
|
||||
RENONE = %00000000 ; Reload nothing
|
||||
REHV = %00010000 ; Reload hsize, vsize
|
||||
REHVS = %00100000 ; Reload hsize, vsize, stretch
|
||||
REHVST = %00110000 ; Reload hsize, vsize, stretch, tilt
|
||||
; More sprite control 1 bit definitions
|
||||
REUSEPAL = %00001000
|
||||
SKIP = %00000100
|
||||
DRAWUP = %00000010
|
||||
DRAWLEFT = %00000001
|
||||
|
||||
SPRCOLL = $FC82
|
||||
SPRINIT = $FC83
|
||||
SUZYHREV = $FC88
|
||||
@ -225,30 +259,44 @@ SND_INTERRUPT = TIMER7_INTERRUPT
|
||||
|
||||
INTRST = $FD80
|
||||
INTSET = $FD81
|
||||
|
||||
MAGRDY0 = $FD84
|
||||
MAGRDY1 = $FD85
|
||||
AUDIN = $FD86
|
||||
SYSCTL1 = $FD87
|
||||
MIKEYHREV = $FD88
|
||||
MIKEYSREV = $FD89
|
||||
IODIR = $FD8A
|
||||
IODAT = $FD8B
|
||||
TxIntEnable = %10000000
|
||||
RxIntEnable = %01000000
|
||||
TxParEnable = %00010000
|
||||
ResetErr = %00001000
|
||||
TxOpenColl = %00000100
|
||||
TxBreak = %00000010
|
||||
ParEven = %00000001
|
||||
TxReady = %10000000
|
||||
RxReady = %01000000
|
||||
TxEmpty = %00100000
|
||||
RxParityErr = %00010000
|
||||
RxOverrun = %00001000
|
||||
RxFrameErr = %00000100
|
||||
RxBreak = %00000010
|
||||
ParityBit = %00000001
|
||||
SERCTL = $FD8C
|
||||
|
||||
IODIR = $FD8A
|
||||
IODAT = $FD8B
|
||||
; IODIR and IODAT bit definitions
|
||||
AUDIN_BIT = $10 ; Note that there is also the address AUDIN
|
||||
READ_ENABLE = $10 ; Same bit for AUDIN_BIT
|
||||
RESTLESS = $08
|
||||
NOEXP = $04 ; If set, redeye is not connected
|
||||
CART_ADDR_DATA = $02
|
||||
CART_POWER_OFF = $02 ; Same bit for CART_ADDR_DATA
|
||||
EXTERNAL_POWER = $01
|
||||
|
||||
SERCTL = $FD8C
|
||||
; SERCTL bit definitions for write operations
|
||||
TXINTEN = $80
|
||||
RXINTEN = $40
|
||||
PAREN = $10
|
||||
RESETERR = $08
|
||||
TXOPEN = $04
|
||||
TXBRK = $02
|
||||
PAREVEN = $01
|
||||
; SERCTL bit definitions for read operations
|
||||
TXRDY = $80
|
||||
RXRDY = $40
|
||||
TXEMPTY = $20
|
||||
PARERR = $10
|
||||
OVERRUN = $08
|
||||
FRAMERR = $04
|
||||
RXBRK = $02
|
||||
PARBIT = $01
|
||||
|
||||
SERDAT = $FD8D
|
||||
SDONEACK = $FD90
|
||||
CPUSLEEP = $FD91
|
||||
|
97
asminc/rp6502.inc
Normal file
97
asminc/rp6502.inc
Normal file
@ -0,0 +1,97 @@
|
||||
; Picocomputer 6502 general defines
|
||||
|
||||
; RIA UART
|
||||
RIA_READY := $FFE0 ; TX=$80 RX=$40
|
||||
RIA_TX := $FFE1
|
||||
RIA_RX := $FFE2
|
||||
|
||||
; VSYNC from PIX VGA
|
||||
RIA_VSYNC := $FFE3
|
||||
|
||||
; RIA XRAM portal 0
|
||||
RIA_RW0 := $FFE4
|
||||
RIA_STEP0 := $FFE5
|
||||
RIA_ADDR0 := $FFE6
|
||||
|
||||
; RIA XRAM portal 1
|
||||
RIA_RW1 := $FFE8
|
||||
RIA_STEP1 := $FFE9
|
||||
RIA_ADDR1 := $FFEA
|
||||
|
||||
; RIA OS fastcall
|
||||
RIA_XSTACK := $FFEC
|
||||
RIA_ERRNO := $FFED
|
||||
RIA_OP := $FFEF
|
||||
RIA_IRQ := $FFF0
|
||||
RIA_SPIN := $FFF1
|
||||
RIA_BUSY := $FFF2 ; Bit $80
|
||||
RIA_A := $FFF4
|
||||
RIA_X := $FFF6
|
||||
RIA_SREG := $FFF8
|
||||
|
||||
; RIA OS operation numbers
|
||||
RIA_OP_EXIT := $FF
|
||||
RIA_OP_ZXSTACK := $00
|
||||
RIA_OP_XREG := $01
|
||||
RIA_OP_PHI2 := $02
|
||||
RIA_OP_CODEPAGE := $03
|
||||
RIA_OP_LRAND := $04
|
||||
RIA_OP_STDIN_OPT := $05
|
||||
RIA_OP_CLOCK_GETRES := $10
|
||||
RIA_OP_CLOCK_GETTIME := $11
|
||||
RIA_OP_CLOCK_SETTIME := $12
|
||||
RIA_OP_CLOCK_GETTIMEZONE := $13
|
||||
RIA_OP_OPEN := $14
|
||||
RIA_OP_CLOSE := $15
|
||||
RIA_OP_READ_XSTACK := $16
|
||||
RIA_OP_READ_XRAM := $17
|
||||
RIA_OP_WRITE_XSTACK := $18
|
||||
RIA_OP_WRITE_XRAM := $19
|
||||
RIA_OP_LSEEK := $1A
|
||||
RIA_OP_UNLINK := $1B
|
||||
RIA_OP_RENAME := $1C
|
||||
|
||||
; 6522 VIA
|
||||
VIA := $FFD0 ; VIA base address
|
||||
VIA_PB := VIA+$0 ; Port register B
|
||||
VIA_PA1 := VIA+$1 ; Port register A
|
||||
VIA_PRB := VIA+$0 ; *** Deprecated ***
|
||||
VIA_PRA := VIA+$1 ; *** Deprecated ***
|
||||
VIA_DDRB := VIA+$2 ; Data direction register B
|
||||
VIA_DDRA := VIA+$3 ; Data direction register A
|
||||
VIA_T1CL := VIA+$4 ; Timer 1, low byte
|
||||
VIA_T1CH := VIA+$5 ; Timer 1, high byte
|
||||
VIA_T1LL := VIA+$6 ; Timer 1 latch, low byte
|
||||
VIA_T1LH := VIA+$7 ; Timer 1 latch, high byte
|
||||
VIA_T2CL := VIA+$8 ; Timer 2, low byte
|
||||
VIA_T2CH := VIA+$9 ; Timer 2, high byte
|
||||
VIA_SR := VIA+$A ; Shift register
|
||||
VIA_CR := VIA+$B ; Auxiliary control register
|
||||
VIA_PCR := VIA+$C ; Peripheral control register
|
||||
VIA_IFR := VIA+$D ; Interrupt flag register
|
||||
VIA_IER := VIA+$E ; Interrupt enable register
|
||||
VIA_PA2 := VIA+$F ; Port register A w/o handshake
|
||||
|
||||
; Values in ___oserror are the union of these FatFs errors and errno.inc
|
||||
.enum
|
||||
FR_OK = 32 ; Succeeded
|
||||
FR_DISK_ERR ; A hard error occurred in the low level disk I/O layer
|
||||
FR_INT_ERR ; Assertion failed
|
||||
FR_NOT_READY ; The physical drive cannot work
|
||||
FR_NO_FILE ; Could not find the file
|
||||
FR_NO_PATH ; Could not find the path
|
||||
FR_INVALID_NAME ; The path name format is invalid
|
||||
FR_DENIED ; Access denied due to prohibited access or directory full
|
||||
FR_EXIST ; Access denied due to prohibited access
|
||||
FR_INVALID_OBJECT ; The file/directory object is invalid
|
||||
FR_WRITE_PROTECTED ; The physical drive is write protected
|
||||
FR_INVALID_DRIVE ; The logical drive number is invalid
|
||||
FR_NOT_ENABLED ; The volume has no work area
|
||||
FR_NO_FILESYSTEM ; There is no valid FAT volume
|
||||
FR_MKFS_ABORTED ; The f_mkfs() aborted due to any problem
|
||||
FR_TIMEOUT ; Could not get a grant to access the volume within defined period
|
||||
FR_LOCKED ; The operation is rejected according to the file sharing policy
|
||||
FR_NOT_ENOUGH_CORE ; LFN working buffer could not be allocated
|
||||
FR_TOO_MANY_OPEN_FILES ; Number of open files > FF_FS_LOCK
|
||||
FR_INVALID_PARAMETER ; Given parameter is invalid
|
||||
.endenum
|
64
asminc/stat.inc
Normal file
64
asminc/stat.inc
Normal file
@ -0,0 +1,64 @@
|
||||
;****************************************************************************
|
||||
;* *
|
||||
;* stat.inc *
|
||||
;* *
|
||||
;* Stat struct *
|
||||
;* *
|
||||
;* *
|
||||
;* *
|
||||
;*(C) 2023 Colin Leroy-Mira <colin@colino.net> *
|
||||
;* *
|
||||
;* *
|
||||
;*This software is provided 'as-is', without any expressed or implied *
|
||||
;*warranty. In no event will the authors be held liable for any damages *
|
||||
;*arising from the use of this software. *
|
||||
;* *
|
||||
;*Permission is granted to anyone to use this software for any purpose, *
|
||||
;*including commercial applications, and to alter it and redistribute it *
|
||||
;*freely, subject to the following restrictions: *
|
||||
;* *
|
||||
;*1. The origin of this software must not be misrepresented; you must not *
|
||||
;* claim that you wrote the original software. If you use this software *
|
||||
;* in a product, an acknowledgment in the product documentation would be *
|
||||
;* appreciated but is not required. *
|
||||
;*2. Altered source versions must be plainly marked as such, and must not *
|
||||
;* be misrepresented as being the original software. *
|
||||
;*3. This notice may not be removed or altered from any source *
|
||||
;* distribution. *
|
||||
;* *
|
||||
;****************************************************************************
|
||||
|
||||
.include "time.inc"
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; st_mode values
|
||||
|
||||
S_IFDIR = $01
|
||||
S_IFREG = $02
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; struct stat
|
||||
|
||||
.struct stat
|
||||
st_dev .dword
|
||||
st_ino .dword
|
||||
st_mode .byte
|
||||
st_nlink .dword
|
||||
st_uid .byte
|
||||
st_gid .byte
|
||||
st_size .dword
|
||||
st_atim .tag timespec
|
||||
st_ctim .tag timespec
|
||||
st_mtim .tag timespec
|
||||
.ifdef __APPLE2__
|
||||
st_access .byte
|
||||
st_type .byte
|
||||
st_auxtype .word
|
||||
st_storagetype .byte
|
||||
st_blocks .word
|
||||
st_mod_date .word
|
||||
st_mod_time .word
|
||||
st_create_date .word
|
||||
st_create_time .word
|
||||
.endif
|
||||
.endstruct
|
46
asminc/statvfs.inc
Normal file
46
asminc/statvfs.inc
Normal file
@ -0,0 +1,46 @@
|
||||
;****************************************************************************
|
||||
;* *
|
||||
;* statvfs.inc *
|
||||
;* *
|
||||
;* Statvfs struct *
|
||||
;* *
|
||||
;* *
|
||||
;* *
|
||||
;*(C) 2023 Colin Leroy-Mira <colin@colino.net> *
|
||||
;* *
|
||||
;* *
|
||||
;*This software is provided 'as-is', without any expressed or implied *
|
||||
;*warranty. In no event will the authors be held liable for any damages *
|
||||
;*arising from the use of this software. *
|
||||
;* *
|
||||
;*Permission is granted to anyone to use this software for any purpose, *
|
||||
;*including commercial applications, and to alter it and redistribute it *
|
||||
;*freely, subject to the following restrictions: *
|
||||
;* *
|
||||
;*1. The origin of this software must not be misrepresented; you must not *
|
||||
;* claim that you wrote the original software. If you use this software *
|
||||
;* in a product, an acknowledgment in the product documentation would be *
|
||||
;* appreciated but is not required. *
|
||||
;*2. Altered source versions must be plainly marked as such, and must not *
|
||||
;* be misrepresented as being the original software. *
|
||||
;*3. This notice may not be removed or altered from any source *
|
||||
;* distribution. *
|
||||
;* *
|
||||
;****************************************************************************
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; struct statvfs
|
||||
|
||||
.struct statvfs
|
||||
f_bsize .dword
|
||||
f_frsize .dword
|
||||
f_blocks .dword
|
||||
f_bfree .dword
|
||||
f_bavail .dword
|
||||
f_files .dword
|
||||
f_ffree .dword
|
||||
f_favail .dword
|
||||
f_fsid .dword
|
||||
f_flag .dword
|
||||
f_namemax .dword
|
||||
.endstruct
|
@ -257,8 +257,11 @@ XBINDX = $28 ; Convert a number into hex and displays on chan
|
||||
XDECIM = $29
|
||||
XHEXA = $2A ; Convert a number into hex
|
||||
|
||||
XMAINARGS = $2C ; Only available for Orix
|
||||
|
||||
XEDT = $2D ; Launch editor
|
||||
XINSER = $2E
|
||||
XGETARGV = $2E ; Only available for Orix
|
||||
|
||||
XSCELG = $2F ; Search a line in editor mode
|
||||
XOPEN = $30 ; Only in Orix
|
||||
@ -277,6 +280,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
|
||||
|
@ -27,7 +27,7 @@ SEGMENTS {
|
||||
CODE: load = MAIN, type = ro start = $4000;
|
||||
RODATA: load = MAIN, type = ro;
|
||||
DATA: load = MAIN, type = rw;
|
||||
INIT: load = MAIN, type = rw;
|
||||
INIT: load = MAIN, type = rw; # uninitialized, but reserves output space
|
||||
ONCE: load = MAIN, type = ro, define = yes;
|
||||
LC: load = MAIN, run = LC, type = ro, optional = yes;
|
||||
BSS: load = BSS, type = bss, define = yes;
|
||||
|
@ -43,7 +43,7 @@ SEGMENTS {
|
||||
CODE: load = MAIN, type = ro;
|
||||
RODATA: load = MAIN, type = ro;
|
||||
DATA: load = MAIN, type = rw;
|
||||
INIT: load = MAIN, type = rw;
|
||||
INIT: load = MAIN, type = rw; # uninitialized, but reserves output space
|
||||
ONCE: load = MAIN, type = ro, define = yes;
|
||||
LC: load = MAIN, run = LC, type = ro, optional = yes;
|
||||
BSS: load = BSS, type = bss, define = yes;
|
||||
|
@ -22,7 +22,7 @@ SEGMENTS {
|
||||
CODE: load = MAIN, type = ro;
|
||||
RODATA: load = MAIN, type = ro;
|
||||
DATA: load = MAIN, type = rw;
|
||||
INIT: load = MAIN, type = rw;
|
||||
INIT: load = MAIN, type = rw; # uninitialized, but reserves output space
|
||||
ONCE: load = MAIN, type = ro, define = yes;
|
||||
LC: load = MAIN, run = LC, type = ro, optional = yes;
|
||||
BSS: load = BSS, type = bss, define = yes;
|
||||
|
@ -26,7 +26,7 @@ SEGMENTS {
|
||||
CODE: load = MAIN, type = ro;
|
||||
RODATA: load = MAIN, type = ro;
|
||||
DATA: load = MAIN, type = rw;
|
||||
INIT: load = MAIN, type = rw;
|
||||
INIT: load = MAIN, type = rw; # uninitialized, but reserves output space
|
||||
ONCE: load = MAIN, type = ro, define = yes;
|
||||
LC: load = MAIN, run = LC, type = ro, optional = yes;
|
||||
BSS: load = BSS, type = bss, define = yes;
|
||||
|
@ -27,7 +27,7 @@ SEGMENTS {
|
||||
CODE: load = MAIN, type = ro start = $4000;
|
||||
RODATA: load = MAIN, type = ro;
|
||||
DATA: load = MAIN, type = rw;
|
||||
INIT: load = MAIN, type = rw;
|
||||
INIT: load = MAIN, type = rw; # uninitialized, but reserves output space
|
||||
ONCE: load = MAIN, type = ro, define = yes;
|
||||
LC: load = MAIN, run = LC, type = ro, optional = yes;
|
||||
BSS: load = BSS, type = bss, define = yes;
|
||||
|
@ -43,7 +43,7 @@ SEGMENTS {
|
||||
CODE: load = MAIN, type = ro;
|
||||
RODATA: load = MAIN, type = ro;
|
||||
DATA: load = MAIN, type = rw;
|
||||
INIT: load = MAIN, type = rw;
|
||||
INIT: load = MAIN, type = rw; # uninitialized, but reserves output space
|
||||
ONCE: load = MAIN, type = ro, define = yes;
|
||||
LC: load = MAIN, run = LC, type = ro, optional = yes;
|
||||
BSS: load = BSS, type = bss, define = yes;
|
||||
|
@ -22,7 +22,7 @@ SEGMENTS {
|
||||
CODE: load = MAIN, type = ro;
|
||||
RODATA: load = MAIN, type = ro;
|
||||
DATA: load = MAIN, type = rw;
|
||||
INIT: load = MAIN, type = rw;
|
||||
INIT: load = MAIN, type = rw; # uninitialized, but reserves output space
|
||||
ONCE: load = MAIN, type = ro, define = yes;
|
||||
LC: load = MAIN, run = LC, type = ro, optional = yes;
|
||||
BSS: load = BSS, type = bss, define = yes;
|
||||
|
@ -26,7 +26,7 @@ SEGMENTS {
|
||||
CODE: load = MAIN, type = ro;
|
||||
RODATA: load = MAIN, type = ro;
|
||||
DATA: load = MAIN, type = rw;
|
||||
INIT: load = MAIN, type = rw;
|
||||
INIT: load = MAIN, type = rw; # uninitialized, but reserves output space
|
||||
ONCE: load = MAIN, type = ro, define = yes;
|
||||
LC: load = MAIN, run = LC, type = ro, optional = yes;
|
||||
BSS: load = BSS, type = bss, define = yes;
|
||||
|
@ -52,7 +52,7 @@ SEGMENTS {
|
||||
CODE: load = MAIN, type = ro, define = yes;
|
||||
RODATA: load = MAIN, type = ro;
|
||||
DATA: load = MAIN, type = rw;
|
||||
INIT: load = MAIN, type = rw, optional = yes;
|
||||
INIT: load = MAIN, type = bss, optional = yes;
|
||||
BSS: load = MAIN, type = bss, define = yes;
|
||||
AUTOSTRT: load = TRAILER, type = ro;
|
||||
OVERLAY1: load = OVL1, type = ro, define = yes, optional = yes;
|
||||
|
@ -36,7 +36,7 @@ SEGMENTS {
|
||||
CODE: load = MAIN, type = ro, define = yes;
|
||||
RODATA: load = MAIN, type = ro;
|
||||
DATA: load = MAIN, type = rw;
|
||||
INIT: load = MAIN, type = rw, optional = yes;
|
||||
INIT: load = MAIN, type = bss, optional = yes;
|
||||
BSS: load = MAIN, type = bss, define = yes;
|
||||
}
|
||||
FEATURES {
|
||||
|
@ -40,7 +40,7 @@ SEGMENTS {
|
||||
CODE: load = MAIN, type = ro, define = yes;
|
||||
RODATA: load = MAIN, type = ro;
|
||||
DATA: load = MAIN, type = rw;
|
||||
INIT: load = MAIN, type = rw, optional = yes;
|
||||
INIT: load = MAIN, type = bss, optional = yes;
|
||||
BSS: load = MAIN, type = bss, define = yes;
|
||||
AUTOSTRT: load = TRAILER, type = ro;
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ SEGMENTS {
|
||||
CODE: load = MAIN, type = ro, define = yes;
|
||||
RODATA: load = MAIN, type = ro;
|
||||
DATA: load = MAIN, type = rw;
|
||||
INIT: load = MAIN, type = rw, optional = yes;
|
||||
INIT: load = MAIN, type = bss, optional = yes;
|
||||
BSS: load = MAIN, type = bss, define = yes;
|
||||
AUTOSTRT: load = TRAILER, type = ro;
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ SEGMENTS {
|
||||
CODE: load = MAIN, type = ro, define = yes;
|
||||
RODATA: load = MAIN, type = ro;
|
||||
DATA: load = MAIN, type = rw;
|
||||
INIT: load = MAIN, type = rw, optional = yes;
|
||||
INIT: load = MAIN, type = bss, optional = yes;
|
||||
BSS: load = MAIN, type = bss, define = yes;
|
||||
AUTOSTRT: load = TRAILER, type = ro;
|
||||
|
||||
|
@ -58,7 +58,7 @@ SEGMENTS {
|
||||
CODE: load = MAIN, type = ro, define = yes;
|
||||
RODATA: load = MAIN, type = ro;
|
||||
DATA: load = MAIN, type = rw;
|
||||
INIT: load = MAIN, type = rw, optional = yes;
|
||||
INIT: load = MAIN, type = bss, optional = yes;
|
||||
BSS: load = MAIN, type = bss, define = yes;
|
||||
SRPREPHDR: load = UNUSED, type = ro;
|
||||
SRPREPTRL: load = UNUSED, type = ro;
|
||||
|
@ -65,7 +65,7 @@ SEGMENTS {
|
||||
CODE: load = MAIN, type = ro, define = yes;
|
||||
RODATA: load = MAIN, type = ro;
|
||||
DATA: load = MAIN, type = rw;
|
||||
INIT: load = MAIN, type = rw, optional = yes;
|
||||
INIT: load = MAIN, type = bss, optional = yes;
|
||||
BSS: load = MAIN, type = bss, define = yes;
|
||||
AUTOSTRT: load = TRAILER, type = ro;
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ SEGMENTS {
|
||||
CODE: load = MAIN, type = ro;
|
||||
RODATA: load = MAIN, type = ro;
|
||||
DATA: load = MAIN, type = rw;
|
||||
INIT: load = MAIN, type = rw;
|
||||
INIT: load = MAIN, type = rw; # uninitialized, but reserves output space
|
||||
ONCE: load = MAIN, type = ro, define = yes;
|
||||
BASTAIL: load = MAIN, type = ro, optional = yes;
|
||||
BSS: load = BSS, type = bss, define = yes;
|
||||
|
@ -44,7 +44,7 @@ SEGMENTS {
|
||||
CODE: load = MAIN, type = ro;
|
||||
RODATA: load = MAIN, type = ro;
|
||||
DATA: load = MAIN, type = rw;
|
||||
INIT: load = MAIN, type = rw;
|
||||
INIT: load = MAIN, type = rw; # uninitialized, but reserves output space
|
||||
ONCE: load = MAIN, type = ro, define = yes;
|
||||
BSS: load = BSS, type = bss, define = yes;
|
||||
OVL1ADDR: load = OVL1ADDR, type = ro;
|
||||
|
@ -23,7 +23,7 @@ SEGMENTS {
|
||||
CODE: load = MAIN, type = ro;
|
||||
RODATA: load = MAIN, type = ro;
|
||||
DATA: load = MAIN, type = rw;
|
||||
INIT: load = MAIN, type = rw;
|
||||
INIT: load = MAIN, type = rw; # uninitialized, but reserves output space
|
||||
ONCE: load = MAIN, type = ro, define = yes;
|
||||
BSS: load = BSS, type = bss, define = yes;
|
||||
}
|
||||
|
@ -11,10 +11,10 @@ SEGMENTS {
|
||||
ZP: load = ZP, type = zp, optional = yes;
|
||||
VECTORS: load = ROM, run = RAM, type = rw, define = yes;
|
||||
DATA: load = ROM, run = RAM, type = rw, define = yes, start = $0204;
|
||||
INIT: load = RAM, type = bss, optional = yes;
|
||||
BSS: load = RAM, type = bss, define = yes;
|
||||
ONCE: load = ROM, type = ro, optional = yes;
|
||||
CODE: load = ROM, type = ro;
|
||||
INIT: load = ROM, type = ro;
|
||||
RODATA: load = ROM, type = ro;
|
||||
AUDIO: load = ROM, type = ro, optional = yes, start = $BF00;
|
||||
SETUP: load = ROM, type = ro, start = $BFE8;
|
||||
|
@ -57,7 +57,7 @@ SEGMENTS {
|
||||
CODE: load = MAIN, type = ro;
|
||||
RODATA: load = MAIN, type = ro;
|
||||
DATA: load = MAIN, type = rw;
|
||||
INIT: load = MAIN, type = rw, optional = yes;
|
||||
INIT: load = MAIN, type = rw, optional = yes; # uninitialized, but reserves output space
|
||||
ONCE: load = MAIN, type = ro, define = yes;
|
||||
BSS: load = BSS, type = bss, define = yes;
|
||||
BRAM01ADDR: load = BRAM01ADDR, type = ro, optional = yes;
|
||||
|
@ -24,7 +24,7 @@ SEGMENTS {
|
||||
CODE: load = MAIN, type = ro;
|
||||
RODATA: load = MAIN, type = ro;
|
||||
DATA: load = MAIN, type = rw;
|
||||
INIT: load = MAIN, type = rw, optional = yes;
|
||||
INIT: load = MAIN, type = rw, optional = yes; # uninitialized, but reserves output space
|
||||
ONCE: load = MAIN, type = ro, define = yes;
|
||||
BSS: load = BSS, type = bss, define = yes;
|
||||
}
|
||||
|
41
cfg/kim1-60k.cfg
Normal file
41
cfg/kim1-60k.cfg
Normal file
@ -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;
|
||||
}
|
||||
|
41
cfg/kim1-mtu60k.cfg
Normal file
41
cfg/kim1-mtu60k.cfg
Normal file
@ -0,0 +1,41 @@
|
||||
# kim1-mtu60k.cfg (4k)
|
||||
#
|
||||
# for expanded KIM-1 w/ K-1008 Graphics and 60K RAM
|
||||
#
|
||||
# ld65 --config kim1-mtu60k.cfg -o <prog>.bin <prog>.o
|
||||
|
||||
FEATURES {
|
||||
STARTADDRESS: default = $2000;
|
||||
CONDES: segment = STARTUP,
|
||||
type = constructor,
|
||||
label = __CONSTRUCTOR_TABLE__,
|
||||
count = __CONSTRUCTOR_COUNT__;
|
||||
CONDES: segment = STARTUP,
|
||||
type = destructor,
|
||||
label = __DESTRUCTOR_TABLE__,
|
||||
count = __DESTRUCTOR_COUNT__;
|
||||
}
|
||||
|
||||
SYMBOLS {
|
||||
__STACKSIZE__: type = weak, value = $0080; # 128 byte program stack
|
||||
__STARTADDRESS__: type = export, value = %S;
|
||||
}
|
||||
|
||||
MEMORY {
|
||||
ZP: file = %O, define = yes, start = $0000, size = $00EE;
|
||||
CPUSTACK: file = "", define = yes, start = $0100, size = $0100;
|
||||
RAM: file = %O, define = yes, start = %S, size = $E000 - %S - __STACKSIZE__;
|
||||
MAINROM: file = "", define = yes, start = $E000, size = $1000;
|
||||
TOP: file = "", define = yes, start = $F000, size = $1000;
|
||||
}
|
||||
|
||||
SEGMENTS {
|
||||
ZEROPAGE: load = ZP, type = zp, define = yes;
|
||||
STARTUP: load = RAM, type = ro, define = yes;
|
||||
CODE: load = RAM, type = ro, define = yes;
|
||||
RODATA: load = RAM, type = ro, define = yes;
|
||||
ONCE: load = RAM, type = ro, define = yes;
|
||||
DATA: load = RAM, type = rw, define = yes;
|
||||
BSS: load = RAM, type = bss, define = yes;
|
||||
}
|
||||
|
41
cfg/kim1-mtuE000.cfg
Normal file
41
cfg/kim1-mtuE000.cfg
Normal file
@ -0,0 +1,41 @@
|
||||
# kim1-mtu60k.cfg (4k)
|
||||
#
|
||||
# for expanded KIM-1 w/ K-1008 Graphics and 60K RAM
|
||||
#
|
||||
# ld65 --config kim1-mtu60k.cfg -o <prog>.bin <prog>.o
|
||||
|
||||
FEATURES {
|
||||
STARTADDRESS: default = $E000;
|
||||
CONDES: segment = STARTUP,
|
||||
type = constructor,
|
||||
label = __CONSTRUCTOR_TABLE__,
|
||||
count = __CONSTRUCTOR_COUNT__;
|
||||
CONDES: segment = STARTUP,
|
||||
type = destructor,
|
||||
label = __DESTRUCTOR_TABLE__,
|
||||
count = __DESTRUCTOR_COUNT__;
|
||||
}
|
||||
|
||||
SYMBOLS {
|
||||
__STACKSIZE__: type = weak, value = $0080; # 128 byte program stack
|
||||
__STARTADDRESS__: type = export, value = %S;
|
||||
}
|
||||
|
||||
MEMORY {
|
||||
ZP: file = %O, define = yes, start = $0000, size = $00EE;
|
||||
CPUSTACK: file = "", define = yes, start = $0100, size = $0100;
|
||||
RAM: file = %O, define = yes, start = $2000, size = $E000 - $2000 - __STACKSIZE__;
|
||||
MAINROM: file = "", define = yes, start = $E000, size = $1000;
|
||||
TOP: file = "", define = yes, start = $F000, size = $1000;
|
||||
}
|
||||
|
||||
SEGMENTS {
|
||||
ZEROPAGE: load = ZP, type = zp, define = yes;
|
||||
STARTUP: load = RAM, type = ro, define = yes;
|
||||
CODE: load = RAM, type = ro, define = yes;
|
||||
RODATA: load = RAM, type = ro, define = yes;
|
||||
ONCE: load = RAM, type = ro, define = yes;
|
||||
DATA: load = RAM, type = rw, define = yes;
|
||||
BSS: load = RAM, type = bss, define = yes;
|
||||
}
|
||||
|
41
cfg/kim1.cfg
Normal file
41
cfg/kim1.cfg
Normal file
@ -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;
|
||||
}
|
||||
|
@ -5,16 +5,17 @@ SYMBOLS {
|
||||
__BANK1BLOCKSIZE__: type = weak, value = $0000; # bank 1 block size
|
||||
__EXEHDR__: type = import;
|
||||
__BOOTLDR__: type = import;
|
||||
__DEFDIR__: type = import;
|
||||
__UPLOADER__: type = import;
|
||||
__UPLOADERSIZE__: type = export, value = $61;
|
||||
__HEADERSIZE__: type = export, value = 64;
|
||||
}
|
||||
MEMORY {
|
||||
ZP: file = "", define = yes, start = $0000, size = $0100;
|
||||
HEADER: file = %O, start = $0000, size = $0040;
|
||||
HEADER: file = %O, start = $0000, size = __HEADERSIZE__;
|
||||
BOOT: file = %O, start = $0200, size = __STARTOFDIRECTORY__;
|
||||
DIR: file = %O, start = $0000, size = 8;
|
||||
MAIN: file = %O, define = yes, start = $0200, size = $BD38 - __STACKSIZE__;
|
||||
UPLDR: file = %O, define = yes, start = $BFDC, size = $005C;
|
||||
DIR: file = %O, start = $0000, size = 16;
|
||||
MAIN: file = %O, define = yes, start = $0200, size = $C038 - __UPLOADERSIZE__ - $200 - __STACKSIZE__;
|
||||
UPLOAD: file = %O, define = yes, start = $C038 - __UPLOADERSIZE__, size = $0061;
|
||||
}
|
||||
SEGMENTS {
|
||||
ZEROPAGE: load = ZP, type = zp;
|
||||
@ -30,8 +31,8 @@ SEGMENTS {
|
||||
RODATA: load = MAIN, type = ro, define = yes;
|
||||
DATA: load = MAIN, type = rw, define = yes;
|
||||
BSS: load = MAIN, type = bss, define = yes;
|
||||
UPCODE: load = UPLDR, type = ro, define = yes;
|
||||
UPDATA: load = UPLDR, type = rw, define = yes;
|
||||
UPCODE: load = UPLOAD, type = ro, define = yes;
|
||||
UPDATA: load = UPLOAD, type = rw, define = yes;
|
||||
}
|
||||
FEATURES {
|
||||
CONDES: type = constructor,
|
||||
|
34
cfg/rp6502.cfg
Normal file
34
cfg/rp6502.cfg
Normal file
@ -0,0 +1,34 @@
|
||||
SYMBOLS {
|
||||
__STARTUP__: type = import;
|
||||
__STACKSIZE__: type = weak, value = $0800;
|
||||
}
|
||||
MEMORY {
|
||||
ZP: file = "", define = yes, start = $0000, size = $0100;
|
||||
CPUSTACK: file = "", start = $0100, size = $0100;
|
||||
RAM: file = %O, define = yes, start = $0200, size = $FD00 - __STACKSIZE__;
|
||||
}
|
||||
SEGMENTS {
|
||||
ZEROPAGE: load = ZP, type = zp;
|
||||
STARTUP: load = RAM, type = ro;
|
||||
LOWCODE: load = RAM, type = ro, optional = yes;
|
||||
ONCE: load = RAM, type = ro, optional = yes;
|
||||
CODE: load = RAM, type = ro;
|
||||
RODATA: load = RAM, type = ro;
|
||||
DATA: load = RAM, type = rw, define = yes;
|
||||
BSS: load = RAM, type = bss, define = yes;
|
||||
}
|
||||
FEATURES {
|
||||
CONDES: type = constructor,
|
||||
label = __CONSTRUCTOR_TABLE__,
|
||||
count = __CONSTRUCTOR_COUNT__,
|
||||
segment = ONCE;
|
||||
CONDES: type = destructor,
|
||||
label = __DESTRUCTOR_TABLE__,
|
||||
count = __DESTRUCTOR_COUNT__,
|
||||
segment = RODATA;
|
||||
CONDES: type = interruptor,
|
||||
label = __INTERRUPTOR_TABLE__,
|
||||
count = __INTERRUPTOR_COUNT__,
|
||||
segment = RODATA,
|
||||
import = __CALLIRQ__;
|
||||
}
|
@ -22,7 +22,7 @@ SEGMENTS {
|
||||
CODE: load = MAIN, type = ro;
|
||||
RODATA: load = MAIN, type = ro;
|
||||
DATA: load = MAIN, type = rw;
|
||||
INIT: load = MAIN, type = rw;
|
||||
INIT: load = MAIN, type = rw; # uninitialized, but reserves output space
|
||||
ONCE: load = MAIN, type = ro, define = yes;
|
||||
BASTAIL: load = MAIN, type = ro, optional = yes;
|
||||
BSS: load = BSS, type = bss, define = yes;
|
||||
|
@ -62,7 +62,7 @@ Special locations:
|
||||
</descrip><p>
|
||||
|
||||
While running <tt/main()/ the Language Card bank 2 is enabled for read access.
|
||||
However while running module constructors/destructors the Language Card is disabled.
|
||||
However while running module constructors the Language Card is disabled.
|
||||
|
||||
Enabling the Language Card allows to use it as additional memory for cc65
|
||||
generated code. However code is never automatically placed there. Rather code
|
||||
@ -321,21 +321,39 @@ Programs containing Apple ][ specific code may use the
|
||||
|
||||
<sect1>Apple ][ specific functions<p>
|
||||
|
||||
The functions listed below are special for the Apple ][. See
|
||||
the <url url="funcref.html" name="function reference"> for declaration and
|
||||
The functions and variables listed below are special for the Apple ][.
|
||||
See the <url url="funcref.html" name="function reference"> for declaration and
|
||||
usage.
|
||||
|
||||
<itemize>
|
||||
<item>_auxtype
|
||||
<item>_dos_type
|
||||
<item>_filetype
|
||||
<item>_datetime
|
||||
<item>beep
|
||||
<item>get_ostype
|
||||
<item>gmtime_dt
|
||||
<item>mktime_dt
|
||||
<item>rebootafterexit
|
||||
<item>ser_apple2_slot
|
||||
<item>tgi_apple2_mix
|
||||
</itemize>
|
||||
|
||||
|
||||
<sect1>Apple IIgs specific functions in accelerator.h<p>
|
||||
|
||||
In addition to those, the <tt/accelerator.h/ header file contains three functions
|
||||
to help determine whether the program is running on a IIgs, and change the IIgs
|
||||
CPU speed. See the <url url="funcref.html" name="function reference"> for declaration and
|
||||
usage.
|
||||
|
||||
<itemize>
|
||||
<item>detect_iigs
|
||||
<item>get_iigs_speed
|
||||
<item>set_iigs_speed
|
||||
</itemize>
|
||||
|
||||
|
||||
<sect1>Hardware access<p>
|
||||
|
||||
There's currently no support for direct hardware access. This does not mean
|
||||
@ -427,17 +445,47 @@ The names in the parentheses denote the symbols to be used for static linking of
|
||||
<descrip>
|
||||
|
||||
<tag><tt/a2.ssc.ser (a2_ssc_ser)/</tag>
|
||||
Driver for the Apple II Super Serial Card. Supports up to 19200 baud,
|
||||
requires hardware flow control (RTS/CTS) and does interrupt driven receives.
|
||||
Driver for the Apple II Super Serial Card.
|
||||
The SSC is an extension card for the II, II+, IIe; the Apple //c and //c+ have
|
||||
the same hardware and firmware integrated.
|
||||
It supports up to 9600 baud, supports no flow control and hardware flow control
|
||||
(RTS/CTS) and does interrupt driven receives. Speeds faster than 9600 baud
|
||||
aren't reachable because the ROM and ProDOS IRQ handlers are too slow.
|
||||
Software flow control (XON/XOFF) is not supported.
|
||||
|
||||
Note that because of the peculiarities of the 6551 chip transmits are not
|
||||
interrupt driven, and the transceiver blocks if the receiver asserts
|
||||
flow control because of a full buffer.
|
||||
|
||||
Note that using the driver at SER_BAUD_115200 will disable IRQs. It will be up
|
||||
to the users to use the serial port, either by re-enabling IRQs themselves,
|
||||
or by directly poll-reading the ACIA DATA register without the help of ser_get().
|
||||
|
||||
The driver defaults to slot 2. Call <tt/ser_apple2_slot()/ prior to
|
||||
<tt/ser_open()/ in order to select a different slot. <tt/ser_apple2_slot()/
|
||||
succeeds for all Apple II slots, but <tt/ser_open()/ fails with
|
||||
<tt/SER_ERR_NO_DEVICE/ if there's no SSC firmware found in the selected slot.
|
||||
|
||||
In the Apple //c and //c+, slot 1 is the printer port, and slot 2 is the modem
|
||||
port.
|
||||
|
||||
Never call <tt/ser_apple2_slot()/ after <tt/ser_open()/.
|
||||
|
||||
<tag><tt/a2.gs.ser (a2_gs_ser)/</tag>
|
||||
Driver for the Apple IIgs serial ports (printer and modem).
|
||||
It supports up to 9600 baud, supports no flow control and hardware flow control
|
||||
(RTS/CTS) and does interrupt driven receives. Speeds faster than 9600 baud
|
||||
aren't reachable because the ROM and ProDOS IRQ handlers are too slow.
|
||||
Software flow control (XON/XOFF) is not supported.
|
||||
Note that transmits are not interrupt driven, and the transceiver blocks if
|
||||
the receiver asserts flow control because of a full buffer.
|
||||
|
||||
The driver defaults to opening the modem port. Calling <tt/ser_apple2_slot()/
|
||||
prior to <tt/ser_open()/ allows to select the printer port (1) or the modem
|
||||
port (0).
|
||||
|
||||
Never call <tt/ser_apple2_slot()/ after <tt/ser_open()/.
|
||||
|
||||
</descrip><p>
|
||||
|
||||
|
||||
@ -544,6 +592,28 @@ program. See the discussion of the <tt/.CONDES/ feature in the <url
|
||||
url="ca65.html" name="assembler manual">.
|
||||
|
||||
|
||||
<sect1>ProDOS date/time manipulation<p>
|
||||
|
||||
<descrip>
|
||||
The readdir and stat function return ProDOS timestamps in their file
|
||||
creation/modification time attributes. You can convert them to more portable
|
||||
time representations using either:
|
||||
|
||||
<tag/struct tm/
|
||||
<tt/struct tm* __fastcall__ gmtime_dt (const struct datetime* dt);/
|
||||
|
||||
Converts a <tt/struct datetime/ into a <tt/struct tm/. Returns NULL in case
|
||||
of error and sets errno.
|
||||
|
||||
<tag/time_t/
|
||||
<tt/time_t __fastcall__ mktime_dt (const struct datetime* dt);/
|
||||
|
||||
Parses a <tt/struct datetime/ and returns a UNIX timestamp. Returns 0 on error and
|
||||
sets errno.
|
||||
|
||||
</descrip>
|
||||
|
||||
|
||||
<sect1>DIO<p>
|
||||
|
||||
<descrip>
|
||||
@ -603,7 +673,17 @@ url="ca65.html" name="assembler manual">.
|
||||
|
||||
The header file <tt/apple2_filetype.h/ also defines many values
|
||||
that can be used to set these variables. It is included in
|
||||
<tt/apple2.h/, which is in turn included in <tt/apple2enh.h/.
|
||||
<tt/apple2.h/.
|
||||
|
||||
The global variable <tt/_datetime/ allows the file creation date/time
|
||||
to be set before a call to <tt/fopen()/
|
||||
or <tt/open()/ that creates the file. It is defined in <tt/apple2.h/:
|
||||
|
||||
<tscreen>
|
||||
<verb>
|
||||
extern struct datetime _datetime;
|
||||
</verb>
|
||||
</tscreen>
|
||||
|
||||
<tag>Example</tag>
|
||||
|
||||
|
@ -21,7 +21,8 @@ as it comes with the cc65 C compiler. It describes the memory layout,
|
||||
enhanced Apple //e specific header files, available drivers, and any
|
||||
pitfalls specific to that platform.
|
||||
|
||||
Please note that enhanced Apple //e specific functions are just mentioned
|
||||
Please note that this target requires a 65C02 or 65816 CPU,
|
||||
enhanced Apple //e 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
|
||||
@ -62,7 +63,7 @@ Special locations:
|
||||
</descrip><p>
|
||||
|
||||
While running <tt/main()/ the Language Card bank 2 is enabled for read access.
|
||||
However while running module constructors/destructors the Language Card is disabled.
|
||||
However while running module constructors the Language Card is disabled.
|
||||
|
||||
Enabling the Language Card allows to use it as additional memory for cc65
|
||||
generated code. However code is never automatically placed there. Rather code
|
||||
@ -321,15 +322,19 @@ Programs containing enhanced Apple //e specific code may use the
|
||||
|
||||
<sect1>Enhanced Apple //e specific functions<p>
|
||||
|
||||
The functions listed below are special for the enhanced Apple //e. See
|
||||
the <url url="funcref.html" name="function reference"> for declaration and
|
||||
The functions and variables listed below are special for the Apple ][.
|
||||
See the <url url="funcref.html" name="function reference"> for declaration and
|
||||
usage.
|
||||
|
||||
<itemize>
|
||||
<item>_auxtype
|
||||
<item>_dos_type
|
||||
<item>_filetype
|
||||
<item>_datetime
|
||||
<item>beep
|
||||
<item>get_ostype
|
||||
<item>gmtime_dt
|
||||
<item>mktime_dt
|
||||
<item>rebootafterexit
|
||||
<item>ser_apple2_slot
|
||||
<item>tgi_apple2_mix
|
||||
@ -338,6 +343,20 @@ usage.
|
||||
</itemize>
|
||||
|
||||
|
||||
<sect1>Apple IIgs specific functions in accelerator.h<p>
|
||||
|
||||
In addition to those, the <tt/accelerator.h/ header file contains three functions
|
||||
to help determine whether the program is running on a IIgs, and change the IIgs
|
||||
CPU speed. See the <url url="funcref.html" name="function reference"> for declaration and
|
||||
usage.
|
||||
|
||||
<itemize>
|
||||
<item>detect_iigs
|
||||
<item>get_iigs_speed
|
||||
<item>set_iigs_speed
|
||||
</itemize>
|
||||
|
||||
|
||||
<sect1>Hardware access<p>
|
||||
|
||||
There's currently no support for direct hardware access. This does not mean
|
||||
@ -427,17 +446,47 @@ The names in the parentheses denote the symbols to be used for static linking of
|
||||
<descrip>
|
||||
|
||||
<tag><tt/a2e.ssc.ser (a2e_ssc_ser)/</tag>
|
||||
Driver for the Apple II Super Serial Card. Supports up to 19200 baud,
|
||||
requires hardware flow control (RTS/CTS) and does interrupt driven receives.
|
||||
Driver for the Apple II Super Serial Card.
|
||||
The SSC is an extension card for the II, II+, IIe; the Apple //c and //c+ have
|
||||
the same hardware and firmware integrated.
|
||||
It supports up to 9600 baud, supports no flow control and hardware flow control
|
||||
(RTS/CTS) and does interrupt driven receives. Speeds faster than 9600 baud
|
||||
aren't reachable because the ROM and ProDOS IRQ handlers are too slow.
|
||||
Software flow control (XON/XOFF) is not supported.
|
||||
|
||||
Note that because of the peculiarities of the 6551 chip transmits are not
|
||||
interrupt driven, and the transceiver blocks if the receiver asserts
|
||||
flow control because of a full buffer.
|
||||
|
||||
Note that using the driver at SER_BAUD_115200 will disable IRQs. It will be up
|
||||
to the users to use the serial port, either by re-enabling IRQs themselves,
|
||||
or by directly poll-reading the ACIA DATA register without the help of ser_get().
|
||||
|
||||
The driver defaults to slot 2. Call <tt/ser_apple2_slot()/ prior to
|
||||
<tt/ser_open()/ in order to select a different slot. <tt/ser_apple2_slot()/
|
||||
succeeds for all Apple II slots, but <tt/ser_open()/ fails with
|
||||
<tt/SER_ERR_NO_DEVICE/ if there's no SSC firmware found in the selected slot.
|
||||
|
||||
In the Apple //c and //c+, slot 1 is the printer port, and slot 2 is the modem
|
||||
port.
|
||||
|
||||
Never call <tt/ser_apple2_slot()/ after <tt/ser_open()/.
|
||||
|
||||
<tag><tt/a2e.gs.ser (a2e_gs_ser)/</tag>
|
||||
Driver for the Apple IIgs serial ports (printer and modem).
|
||||
It supports up to 9600 baud, supports no flow control and hardware flow control
|
||||
(RTS/CTS) and does interrupt driven receives. Speeds faster than 9600 baud
|
||||
aren't reachable because the ROM and ProDOS IRQ handlers are too slow.
|
||||
Software flow control (XON/XOFF) is not supported.
|
||||
Note that transmits are not interrupt driven, and the transceiver blocks if
|
||||
the receiver asserts flow control because of a full buffer.
|
||||
|
||||
The driver defaults to opening the modem port. Calling <tt/ser_apple2_slot()/
|
||||
prior to <tt/ser_open()/ allows to select the printer port (1) or the modem
|
||||
port (0).
|
||||
|
||||
Never call <tt/ser_apple2_slot()/ after <tt/ser_open()/.
|
||||
|
||||
</descrip><p>
|
||||
|
||||
|
||||
@ -549,6 +598,28 @@ program. See the discussion of the <tt/.CONDES/ feature in the <url
|
||||
url="ca65.html" name="assembler manual">.
|
||||
|
||||
|
||||
<sect1>ProDOS date/time manipulation<p>
|
||||
|
||||
<descrip>
|
||||
The readdir and stat function return ProDOS timestamps in their file
|
||||
creation/modification time attributes. You can convert them to more portable
|
||||
time representations using either:
|
||||
|
||||
<tag/struct tm/
|
||||
<tt/struct tm* __fastcall__ gmtime_dt (const struct datetime* dt);/
|
||||
|
||||
Converts a <tt/struct datetime/ into a <tt/struct tm/. Returns -1 in case
|
||||
of error and sets errno, 0 on success.
|
||||
|
||||
<tag/time_t/
|
||||
<tt/time_t __fastcall__ mktime_dt (const struct datetime* dt);/
|
||||
|
||||
Parses a <tt/struct datetime/ and returns a UNIX timestamp. Returns 0 on error and
|
||||
sets errno.
|
||||
|
||||
</descrip>
|
||||
|
||||
|
||||
<sect1>DIO<p>
|
||||
|
||||
<descrip>
|
||||
@ -593,7 +664,7 @@ url="ca65.html" name="assembler manual">.
|
||||
auxiliary type. Therefore, some additional mechanism for specifying
|
||||
the file types is needed.
|
||||
|
||||
<tag>Specifying the File Type and Auxiliary Type</tag>
|
||||
<tag>Specifying the File Type, Auxiliary Type and creation date</tag>
|
||||
|
||||
There are two global variables provided that allow the file type
|
||||
and auxiliary type to be specified before a call to <tt/fopen()/
|
||||
@ -610,6 +681,16 @@ url="ca65.html" name="assembler manual">.
|
||||
that can be used to set these variables. It is included in
|
||||
<tt/apple2.h/, which is in turn included in <tt/apple2enh.h/.
|
||||
|
||||
The global variable <tt/_datetime/ allows the file creation date/time
|
||||
to be set before a call to <tt/fopen()/
|
||||
or <tt/open()/ that creates the file. It is defined in <tt/apple2.h/:
|
||||
|
||||
<tscreen>
|
||||
<verb>
|
||||
extern struct datetime _datetime;
|
||||
</verb>
|
||||
</tscreen>
|
||||
|
||||
<tag>Example</tag>
|
||||
|
||||
A text file cannot be created with just the
|
||||
|
@ -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>
|
||||
|
||||
|
302
doc/ca65.sgml
302
doc/ca65.sgml
@ -120,11 +120,12 @@ Long options:
|
||||
--list-bytes n Maximum number of bytes per listing line
|
||||
--memory-model model Set the memory model
|
||||
--pagelength n Set the page length for the listing
|
||||
--relax-checks Relax some checks (see docs)
|
||||
--relax-checks Disables some error checks
|
||||
--smart Enable smart mode
|
||||
--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>
|
||||
@ -264,14 +265,17 @@ Here is a description of all the command line options:
|
||||
<label id="option--relax-checks">
|
||||
<tag><tt>--relax-checks</tt></tag>
|
||||
|
||||
Relax some checks done by the assembler. This will allow code that is an
|
||||
Disables some error checks done by the assembler. This will allow code that is an
|
||||
error in most cases and flagged as such by the assembler, but can be valid
|
||||
in special situations.
|
||||
|
||||
Examples are:
|
||||
Disabled checks are:
|
||||
<itemize>
|
||||
<item>Short branches between two different segments.
|
||||
<item>Byte sized address loads where the address is not a zeropage address.
|
||||
<item>Address vs. fragment size: a byte sized load from an non-zeropage
|
||||
address is truncated instead of producing an error.
|
||||
<item>Indirect jump on page boundary: <tt>jmp (label)</tt> on a label that
|
||||
resides on a page boundary (<tt>$xxFF</tt>) fetches the second byte from the
|
||||
wrong address on 6502 CPUs, now allowed instead of producing an error.
|
||||
</itemize>
|
||||
|
||||
|
||||
@ -359,6 +363,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 +442,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 +468,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>
|
||||
|
||||
@ -1339,17 +1370,22 @@ writable.
|
||||
Reading this pseudo variable will give the assembler version according to
|
||||
the following formula:
|
||||
|
||||
VER_MAJOR*$100 + VER_MINOR*$10
|
||||
<tt>(VER_MAJOR * 0x100) + VER_MINOR</tt>
|
||||
|
||||
It may be used to encode the assembler version or check the assembler for
|
||||
special features not available with older versions.
|
||||
The upper 8 bits are the major-, the lower 8 bits are the minor version.
|
||||
|
||||
Example:
|
||||
|
||||
Version 2.14 of the assembler will return $2E0 as numerical constant when
|
||||
reading the pseudo variable <tt/.VERSION/.
|
||||
|
||||
For example, version 47.11 of the assembler would have this macro defined as
|
||||
<tt/0x2f0b/.
|
||||
|
||||
Note: until 2.19 this pseudo variable was defined as <tt>(VER_MAJOR * 0x100) + VER_MINOR * 0x10</tt> -
|
||||
which resulted in broken values starting at version 2.16 of the assembler. For
|
||||
this reason the value of this pseudo variable is considered purely informal - you should
|
||||
not use it to check for a specific assembler version and use different code
|
||||
according to the detected version - please update your code to work with the
|
||||
recent version of the assembler instead (There is very little reason to not use
|
||||
the most recent version - and even less to support older versions in your code).
|
||||
|
||||
<sect>Pseudo functions<label id="pseudo-functions"><p>
|
||||
|
||||
@ -1381,10 +1417,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 +2051,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 +2061,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 +2144,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 +2287,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 +2436,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 +2546,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 +2782,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 +2867,43 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
|
||||
overridden. When using this feature, you may also get into trouble if
|
||||
later versions of the assembler define new keywords starting with a dot.
|
||||
|
||||
<tag><tt>line_continuations</tt><label id="line_continuations"></tag>
|
||||
|
||||
Switch on or off line continuations using the backslash character
|
||||
before a newline. The option is off by default.
|
||||
Note: Line continuations do not work in a comment. A backslash at the
|
||||
end of a comment is treated as part of the comment and does not trigger
|
||||
line continuation.
|
||||
|
||||
Example:
|
||||
|
||||
<tscreen><verb>
|
||||
.feature line_continuations + ; Allow line continuations
|
||||
|
||||
lda \
|
||||
#$20 ; This is legal now
|
||||
</verb></tscreen>
|
||||
|
||||
For backward compatibility reasons, the <tt>.LINECONT +</tt> control command
|
||||
is also supported and enables the same feature.
|
||||
|
||||
<tag><tt>long_jsr_jmp_rts</tt><label id="long_jsr_jmp_rts"></tag>
|
||||
|
||||
Affects 65816 mode only.
|
||||
|
||||
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 +3115,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 +3126,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.
|
||||
@ -3312,29 +3391,9 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
|
||||
the feature in more detail.
|
||||
|
||||
|
||||
<sect1><tt>.LINECONT</tt><label id=".LINECONT"><p>
|
||||
|
||||
Switch on or off line continuations using the backslash character
|
||||
before a newline. The option is off by default.
|
||||
Note: Line continuations do not work in a comment. A backslash at the
|
||||
end of a comment is treated as part of the comment and does not trigger
|
||||
line continuation.
|
||||
The command must be followed by a '+' or '-' character to switch the
|
||||
option on or off respectively.
|
||||
|
||||
Example:
|
||||
|
||||
<tscreen><verb>
|
||||
.linecont + ; Allow line continuations
|
||||
|
||||
lda \
|
||||
#$20 ; This is legal now
|
||||
</verb></tscreen>
|
||||
|
||||
|
||||
<sect1><tt>.LIST</tt><label id=".LIST"><p>
|
||||
|
||||
Enable output to the listing. The command 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 +4038,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 +4053,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.
|
||||
@ -4025,7 +4086,9 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".BYTE" name=".BYTE"
|
||||
|
||||
<sect1><tt>.TAG</tt><label id=".TAG"><p>
|
||||
|
||||
Allocate space for a struct or union.
|
||||
Allocate space for a struct or union. This is equivalent to
|
||||
<tt><ref id=".RES" name=".RES"></tt> with the
|
||||
<tt><ref id=".SIZEOF" name=".SIZEOF"></tt> of a struct.
|
||||
|
||||
Example:
|
||||
|
||||
@ -4039,6 +4102,7 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".BYTE" name=".BYTE"
|
||||
.tag Point ; Allocate 4 bytes
|
||||
</verb></tscreen>
|
||||
|
||||
See: <ref id="structs" name=""Structs and unions"">
|
||||
|
||||
<sect1><tt>.UNDEF, .UNDEFINE</tt><label id=".UNDEFINE"><p>
|
||||
|
||||
@ -4199,8 +4263,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 +4280,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>
|
||||
@ -4423,9 +4492,9 @@ different:
|
||||
|
||||
<item> Macros defined with <tt><ref id=".DEFINE" name=".DEFINE"></tt> may not
|
||||
span more than a line. You may use line continuation (see <tt><ref
|
||||
id=".LINECONT" name=".LINECONT"></tt>) to spread the definition over
|
||||
more than one line for increased readability, but the macro itself
|
||||
may not contain an end-of-line token.
|
||||
id="line_continuations" name="line_continuations"></tt>) to spread the
|
||||
definition over more than one line for increased readability, but the
|
||||
macro itself may not contain an end-of-line token.
|
||||
|
||||
<item> Macros defined with <tt><ref id=".DEFINE" name=".DEFINE"></tt> share
|
||||
the name space with classic macros, but they are detected and replaced
|
||||
@ -4799,10 +4868,15 @@ compiler, depending on the target system selected:
|
||||
|
||||
Structs and unions are special forms of <ref id="scopes" name="scopes">. They
|
||||
are, to some degree, comparable to their C counterparts. Both have a list of
|
||||
members. Each member allocates storage, and optionally may have a name whose
|
||||
value, in the case of a struct, usually is the storage offset from the
|
||||
beginning, and in the case of a union, doesn't change, and usually is zero.
|
||||
members. Each member allocates storage, and optionally may have a name.
|
||||
|
||||
Each named member has a constant value equal to the storage offset from the
|
||||
beginning of the structure. In the case of a union, all members are placed at
|
||||
the same offset, typically 0.
|
||||
|
||||
Each named member also has a storage size which can be accessed with the
|
||||
<tt><ref id=".SIZEOF" name=".SIZEOF"></tt> operator. The struct or union itself
|
||||
also has a <tt/.SIZEOF/ indicating its total storage size.
|
||||
|
||||
<sect1>Declaration<p>
|
||||
|
||||
@ -4829,8 +4903,9 @@ A struct or union may not necessarily have a name. If it is anonymous, no
|
||||
local scope is opened; the identifiers used to name the members are placed
|
||||
into the current scope instead.
|
||||
|
||||
A struct may contain unnamed members and definitions of local structs/unions.
|
||||
The storage allocators may contain a multiplier, as in the example below:
|
||||
Storage allocators may contain a multiplier. A struct may also contain members
|
||||
and definitions of local structs/unions. Example:
|
||||
|
||||
<tscreen><verb>
|
||||
.struct Circle
|
||||
.struct Point
|
||||
@ -4839,7 +4914,8 @@ The storage allocators may contain a multiplier, as in the example below:
|
||||
Radius .word
|
||||
.endstruct
|
||||
</verb></tscreen>
|
||||
The size of the Circle struct is 6 (three words).
|
||||
|
||||
In this example the size of the Circle struct is 6 (three words).
|
||||
|
||||
|
||||
<sect1>The storage allocator keywords<p>
|
||||
@ -4849,7 +4925,7 @@ The size of the Circle struct is 6 (three words).
|
||||
<tag/.BYTE, .RES/
|
||||
Allocates multiples of 1 byte. <tt/.RES/ requires an operand.
|
||||
|
||||
<tag/.DBYTE, .WORD, .ADDR/
|
||||
<tag/.DBYT, .WORD, .ADDR/
|
||||
Allocates multiples of 2 bytes.
|
||||
|
||||
<tag/.FARADDR/
|
||||
@ -4858,6 +4934,15 @@ The size of the Circle struct is 6 (three words).
|
||||
<tag/.DWORD/
|
||||
Allocates multiples of 4 bytes.
|
||||
|
||||
<tag/.TAG/
|
||||
Allocates a previously defined struct.
|
||||
|
||||
<tag/.STRUCT, .UNION/
|
||||
Begins a nested .struct or .union definition, and allocates it.
|
||||
Note that its member offset values will begin at 0, unless this nested
|
||||
structure is anonymous, in which case they will instead become members of
|
||||
the enclosing scope.
|
||||
|
||||
</descrip>
|
||||
|
||||
|
||||
@ -4902,13 +4987,54 @@ name=".TAG"> directive.
|
||||
C: .tag Circle
|
||||
</verb></tscreen>
|
||||
|
||||
Currently, members are just offsets from the start of the struct or union. To
|
||||
Members are just offsets from the start of the struct or union. To
|
||||
access a field of a struct, the member offset must be added to the address of
|
||||
the struct variable itself:
|
||||
<tscreen><verb>
|
||||
lda C+Circle::Radius ; Load circle radius into A
|
||||
lda C + Circle::Radius ; Load circle radius
|
||||
lda C + Circle::Origin + Point::ycoord ; Load circle origin.ycoord
|
||||
</verb></tscreen>
|
||||
That may change in a future version of the assembler.
|
||||
|
||||
Nested structures or unions are treated differently depending on whether they
|
||||
are anonymous. If named, a new structure definition is created within the
|
||||
enclosing scope, with its offsets beginning at 0. If anonymous, the members of
|
||||
the new structure are added to the enclosing scope instead, with offsets
|
||||
continuing through that scope. Example:
|
||||
|
||||
<tscreen><verb>
|
||||
.struct Object
|
||||
id .byte ; Object::id = 0
|
||||
target .struct Point ; Object::target = 1
|
||||
xcoord .word ; Object::Point::xcoord = 0
|
||||
ycoord .word ; Object::Point::ycoord = 2
|
||||
.endstruct
|
||||
cost .struct ; Object::cost = 5
|
||||
price .word ; Object::price = 5
|
||||
tax .word ; Object::tax = 7
|
||||
.endstruct
|
||||
.struct
|
||||
radius .word ; Object::radius = 9
|
||||
.endstruct
|
||||
.endstruct
|
||||
|
||||
O: .tag Object
|
||||
lda O + Object::target + Object::Point::ycoord ; Named struct
|
||||
lda O + Object::tax ; Anonymous
|
||||
lda O + Object::radius ; Anonymous
|
||||
|
||||
; Be careful not to use a named nested structure without also adding the
|
||||
; offset to the nested structure itself.
|
||||
lda O + Object::Point::ycoord ; Incorrect!
|
||||
lda O + Object::target + Object::Point::ycoord ; Correct
|
||||
</verb></tscreen>
|
||||
|
||||
In this example, the first nested structure is named "Point", and its member
|
||||
offsets begin at 0. On the other hand, the two anonymous structures simply
|
||||
continue to add members to the enclosing "Object" structure.
|
||||
|
||||
Note that an anonymous structure does not need a member name, since all of its
|
||||
members become part of the enclosing structure. The "cost" member in the
|
||||
example is redundantly the same offset as its first member "price".
|
||||
|
||||
|
||||
<sect1>Limitations<p>
|
||||
|
@ -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
|
||||
@ -805,10 +807,12 @@ and the one defined by the ISO standard:
|
||||
<itemize>
|
||||
|
||||
<item> The datatypes "float" and "double" are not available.
|
||||
Floating point constants may be used, though they will have to be
|
||||
converted and stored into integer values.
|
||||
Floating point arithmetic expressions are not supported.
|
||||
<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
|
||||
@ -833,21 +837,21 @@ This cc65 version has some extensions to the ISO C standard.
|
||||
|
||||
<itemize>
|
||||
|
||||
<item> The compiler allows to insert assembler statements into the output
|
||||
file. The syntax is
|
||||
<item> The compiler allows to insert inline assembler code in the form of the
|
||||
<tt/asm/ expression into the output file. The syntax is
|
||||
|
||||
<tscreen><verb>
|
||||
asm [optional volatile] (<string literal>[, optional parameters]) ;
|
||||
asm [optional volatile] (<string literal>[, optional parameters])
|
||||
</verb></tscreen>
|
||||
or
|
||||
<tscreen><verb>
|
||||
__asm__ [optional volatile] (<string literal>[, optional parameters]) ;
|
||||
__asm__ [optional volatile] (<string literal>[, optional parameters])
|
||||
</verb></tscreen>
|
||||
|
||||
The first form is in the user namespace; and, is disabled if the <tt/-A/
|
||||
switch is given.
|
||||
|
||||
There is a whole section covering inline assembler statements,
|
||||
There is a whole section covering the inline assembler,
|
||||
<ref id="inline-asm" name="see there">.
|
||||
<p>
|
||||
|
||||
@ -1004,6 +1008,13 @@ This cc65 version has some extensions to the ISO C standard.
|
||||
<tt/_Static_assert/ is also available as the macro <tt/static_assert/ in
|
||||
<tt/assert.h/.
|
||||
|
||||
Note: The string literal as the message in the <tt/_Static_assert/
|
||||
declaration is not subject to string literal translation (see
|
||||
<tt/<ref id="pragma-charmap" name="#pragma charmap()">/) and will
|
||||
always be in the host encoding. On the other hand, any character or
|
||||
string literals present in the condition expression of the
|
||||
<tt/_Static_assert/ declaration will be translated as usual.
|
||||
|
||||
<item> cc65 supports bit-fields of any integral type that is int-sized or
|
||||
smaller, and enumerated types with those types as their underlying
|
||||
type. (Only <tt/int/, <tt/signed int/, and <tt/unsigned int/ are
|
||||
@ -1313,7 +1324,9 @@ parameter with the <tt/#pragma/.
|
||||
|
||||
<sect1><tt>#pragma charmap (<index>, <code>)</tt><label id="pragma-charmap"><p>
|
||||
|
||||
Each literal string and each literal character in the source is translated
|
||||
Each literal string and each literal character in the preprocessed source,
|
||||
except when used in an <tt/asm/ expression as the inline assembler code or
|
||||
in a <tt/_Static_assert/ declaration as the failure message, is translated
|
||||
by use of a translation table. That translation table is preset when the
|
||||
compiler is started, depending on the target system; for example, to map
|
||||
ISO-8859-1 characters into PETSCII if the target is a Commodore machine.
|
||||
@ -1600,13 +1613,13 @@ parameter with the <tt/#pragma/.
|
||||
|
||||
This pragma sets a wrapper for functions, often used for trampolines.
|
||||
|
||||
The name is a function returning <tt/void/, and taking no parameters.
|
||||
The <tt/name/ is a wrapper function returning <tt/void/, and taking no parameters.
|
||||
It must preserve the CPU's <tt/A/ and <tt/X/ registers if it wraps any
|
||||
<tt/__fastcall__/ functions that have parameters. It must preserve
|
||||
the <tt/Y/ register if it wraps any variadic functions (they have "<tt/.../"
|
||||
in their prototypes).
|
||||
|
||||
The identifier is an 8-bit number that's set into <tt/tmp4/. If the identifier
|
||||
The <tt/identifier/ is an 8-bit number that's set into <tt/tmp4/. If the <tt/identifier/
|
||||
is "bank", then ca65's <tt><url url="ca65.html#.BANK" name=".bank"></tt> function will be used
|
||||
to determine the number from the bank attribute defined in the linker config,
|
||||
see <url url="ld65.html#MEMORY" name="Other MEMORY area attributes">. Note that
|
||||
@ -1616,6 +1629,11 @@ parameter with the <tt/#pragma/.
|
||||
The address of a wrapped function is passed in <tt/ptr4/. The wrapper can
|
||||
call that function by using "<tt/jsr callptr4/".
|
||||
|
||||
All functions ever declared or defined when this pragma is in effect will be wrapped
|
||||
when they are called explicitly by their names later in the same translation unit.
|
||||
Invocation of these functions in any other ways, for example, that via a function
|
||||
pointer or in inline assembly code, will not be wrapped.
|
||||
|
||||
This feature is useful, for example, with banked memory, to switch banks
|
||||
automatically to where a wrapped function resides, and then to restore the
|
||||
previous bank when it returns.
|
||||
@ -1710,23 +1728,23 @@ bloated code and a slowdown.
|
||||
|
||||
<sect>Inline assembler<label id="inline-asm"><p>
|
||||
|
||||
The compiler allows to insert assembler statements into the output file. The
|
||||
syntax is
|
||||
The compiler allows to insert inline assembler code in the form of the <tt/asm/
|
||||
expression into the output file. The syntax is
|
||||
|
||||
<tscreen><verb>
|
||||
asm [optional volatile] (<string literal>[, optional parameters]) ;
|
||||
asm [optional volatile] (<string literal>[, optional parameters])
|
||||
</verb></tscreen>
|
||||
or
|
||||
<tscreen><verb>
|
||||
__asm__ [optional volatile] (<string literal>[, optional parameters]) ;
|
||||
__asm__ [optional volatile] (<string literal>[, optional parameters])
|
||||
</verb></tscreen>
|
||||
<p>
|
||||
|
||||
The first form is in the user namespace; and, is disabled by <tt><ref
|
||||
id="option--standard" name="--standard"></tt> if the argument is not <tt/cc65/.
|
||||
|
||||
The <tt/asm/ statement can be used only inside a function. Please note that
|
||||
the result of an inline assembler expression is always of type <tt/void/.
|
||||
The <tt/asm/ expression can be used only inside a function. The result of an
|
||||
<tt/asm/ expression is always of type <tt/void/.
|
||||
|
||||
The contents of the string literal are preparsed by the compiler; and, inserted
|
||||
into the generated assembly output, so that it can be processed further by
|
||||
@ -1737,15 +1755,15 @@ even if the ca65 assembler (which is used to translate the generated assembler
|
||||
code) would accept them. The built-in inline assembler is not a replacement for
|
||||
the full-blown macro assembler which comes with the compiler.
|
||||
|
||||
Note: Inline assembler statements are subject to all optimizations done by the
|
||||
compiler. There currently is no way to protect an inline assembler statement
|
||||
Note: Inline assembler expressions are subject to all optimizations done by the
|
||||
compiler. There currently is no way to protect an inline assembler expression
|
||||
-- alone -- from being moved or removed completely by the optimizer. If in
|
||||
doubt, check the generated assembler output; or, disable optimizations (for
|
||||
that function).
|
||||
|
||||
As a shortcut, you can put the <tt/volatile/ qualifier in your <tt/asm/
|
||||
statements. It will disable optimization for the functions in which those
|
||||
<tt/asm volatile/ statements sit. The effect is the same as though you put
|
||||
expressions. It will disable optimization for the functions in which those
|
||||
<tt/asm volatile/ expressions sit. The effect is the same as though you put
|
||||
<tt/#pragma optimize(push, off)/ above those functions, and <tt/#pragma
|
||||
optimize(pop)/ below those functions.
|
||||
|
||||
@ -1753,6 +1771,13 @@ The string literal may contain format specifiers from the following list. For
|
||||
each format specifier, an argument is expected which is inserted instead of
|
||||
the format specifier, before passing the assembly code line to the backend.
|
||||
|
||||
Note: The string literal as the inline assembler code itself in the <tt/asm/
|
||||
expression is not subject to string literal translation (see
|
||||
<tt/<ref id="pragma-charmap" name="#pragma charmap()">/) and will always
|
||||
be in the host encoding. On the other hand, all character and string literals
|
||||
as the arguments for replacing the format specifiers will be translated as
|
||||
usual.
|
||||
|
||||
<itemize>
|
||||
<item><tt/%b/ - Numerical 8-bit value
|
||||
<item><tt/%w/ - Numerical 16-bit value
|
||||
@ -1840,7 +1865,7 @@ Arrays also can be accessed:
|
||||
<p>
|
||||
|
||||
Note: Do not embed the assembler labels that are used as names of global
|
||||
variables or functions into your <tt/asm/ statements. Code such as this:
|
||||
variables or functions into your <tt/asm/ expressions. Code such as this:
|
||||
|
||||
<tscreen><verb>
|
||||
int foo;
|
||||
|
@ -261,6 +261,9 @@ different options for different files on the command line. As an example.
|
||||
translates main.c with full optimization and module.c with less optimization
|
||||
and debug info enabled.
|
||||
|
||||
Note that the target system (-t , --target) must be specified before any file
|
||||
unless using the default target of c64
|
||||
|
||||
The type of an input file is derived from its extension:
|
||||
|
||||
<itemize>
|
||||
|
@ -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">
|
||||
@ -184,7 +184,7 @@ Here is a description of all the command line options:
|
||||
<label id="option--mnemonic-column">
|
||||
<tag><tt>--mnemonic-column n</tt></tag>
|
||||
|
||||
Specifies the column where a mnemonic or pseudo instrcuction is output.
|
||||
Specifies the column where a mnemonic or pseudo instruction is output.
|
||||
|
||||
|
||||
<label id="option--pagelength">
|
||||
@ -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>
|
||||
@ -282,7 +283,7 @@ Some instructions may generate labels in the first pass, while most other
|
||||
instructions do not generate labels, but use them if they are available. Among
|
||||
others, the branch and jump instructions will generate labels for the target
|
||||
of the branch in the first pass. External labels (taken from the info file)
|
||||
have precedence over internally generated ones, They must be valid identifiers
|
||||
have precedence over internally generated ones. They must be valid identifiers
|
||||
as specified for the ca65 assembler. Internal labels (generated by the
|
||||
disassembler) have the form <tt/Labcd/, where <tt/abcd/ is the hexadecimal
|
||||
address of the label in upper case letters. You should probably avoid using
|
||||
@ -303,7 +304,7 @@ name="next section"> for more information.
|
||||
The info file contains lists of specifications grouped together. Each group
|
||||
directive has an identifying token and an attribute list enclosed in curly
|
||||
braces. Attributes have a name followed by a value. The syntax of the value
|
||||
depends on the type of the attribute. String attributes are places in double
|
||||
depends on the type of the attribute. String attributes are placed in double
|
||||
quotes, numeric attributes may be specified as decimal numbers or hexadecimal
|
||||
with a leading dollar sign. There are also attributes where the attribute
|
||||
value is a keyword; in this case, the keyword is given as-is (without quotes or
|
||||
@ -316,8 +317,8 @@ anything). Each attribute is terminated by a semicolon.
|
||||
|
||||
<sect1>Comments<p>
|
||||
|
||||
Comments start with a hash mark (<tt/#/) or a double slash (<tt>//</tt>);
|
||||
and, extend from the position of the mark to the end of the current line.
|
||||
Comments start with a hash mark (<tt/#/) or a double slash (<tt>//</tt>)
|
||||
and extend from the position of the mark to the end of the current line.
|
||||
Hash marks or double slashes inside of strings will <em/not/ start a comment,
|
||||
of course.
|
||||
|
||||
@ -358,20 +359,20 @@ following attributes are recognized:
|
||||
|
||||
|
||||
<tag><tt/HEXOFFS/</tag>
|
||||
The attribute is followed by a boolean value. If true, offsets to labels are
|
||||
This attribute is followed by a boolean value. If true, offsets to labels are
|
||||
output in hex, otherwise they're output in decimal notation. The default is
|
||||
false. The attribute may be changed on the command line using the <tt><ref
|
||||
id="option--hexoffs" name="--hexoffs"></tt> option.
|
||||
|
||||
|
||||
<tag><tt/INPUTNAME/</tag>
|
||||
The attribute is followed by a string value, which gives the name of the
|
||||
This attribute is followed by a string value, which gives the name of the
|
||||
input file to read. If it is present, the disassembler does not accept an
|
||||
input file name on the command line.
|
||||
|
||||
|
||||
<tag><tt/INPUTOFFS/</tag>
|
||||
The attribute is followed by a numerical value that gives an offset into
|
||||
This attribute is followed by a numerical value that gives an offset into
|
||||
the input file which is skipped before reading data. The attribute may be
|
||||
used to skip headers or unwanted code sections in the input file.
|
||||
|
||||
@ -411,7 +412,7 @@ following attributes are recognized:
|
||||
|
||||
<label id="OUTPUTNAME">
|
||||
<tag><tt/OUTPUTNAME/</tag>
|
||||
The attribute is followed by string value, which gives the name of the
|
||||
This attribute is followed by string value, which gives the name of the
|
||||
output file to write. If it is present, specification of an output file on
|
||||
the command line using the <tt><ref id="option-o" name="-o"></tt> option is
|
||||
not allowed.
|
||||
@ -432,8 +433,8 @@ following attributes are recognized:
|
||||
This attribute may be used instead of the <tt><ref id="option--start-addr"
|
||||
name="--start-addr"></tt> option on the command line. It takes a numerical
|
||||
parameter. The default for the start address is $10000 minus the size of
|
||||
the input file (this assumes that the input file is a ROM that contains the
|
||||
reset and irq vectors).
|
||||
the input file. (This assumes that the input file is a ROM that contains the
|
||||
reset and irq vectors.)
|
||||
|
||||
|
||||
<tag><tt/TEXTCOLUMN/</tag>
|
||||
@ -467,7 +468,7 @@ following attributes are recognized:
|
||||
<tag><tt>NAME</tt></tag>
|
||||
This is a convenience attribute. It takes a string argument and will cause
|
||||
the disassembler to define a label for the start of the range with the
|
||||
given name. So a separate <tt><ref id="infofile-label" name="LABEL"></tt>
|
||||
given name so a separate <tt><ref id="infofile-label" name="LABEL"></tt>
|
||||
directive is not needed.
|
||||
|
||||
<tag><tt>START</tt></tag>
|
||||
@ -508,8 +509,8 @@ following attributes are recognized:
|
||||
<tag><tt>SKIP</tt></tag>
|
||||
The range is simply ignored when generating the output file. Please note
|
||||
that this means that reassembling the output file will <em/not/ generate
|
||||
the original file, not only because the missing piece in between, but also
|
||||
because the following code will be located on wrong addresses. Output
|
||||
the original file, not only because of the missing piece in between, but
|
||||
also because the following code will be located on wrong addresses. Output
|
||||
generated with <tt/SKIP/ ranges will need manual rework.
|
||||
|
||||
<tag><tt>TEXTTABLE</tt></tag>
|
||||
@ -521,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>
|
||||
|
||||
|
||||
@ -550,9 +561,9 @@ code. The following attributes are recognized:
|
||||
|
||||
<tag><tt>NAME</tt></tag>
|
||||
The attribute is followed by a string value which gives the name of the
|
||||
label. Empty names are allowed, in this case the disassembler will create
|
||||
an unnamed label (see the assembler docs for more information about unnamed
|
||||
labels).
|
||||
label. Empty names are allowed; in this case the disassembler will create
|
||||
an unnamed label. (See the assembler docs for more information about unnamed
|
||||
labels.)
|
||||
|
||||
<tag><tt>SIZE</tt></tag>
|
||||
This attribute is optional and may be used to specify the size of the data
|
||||
@ -584,15 +595,18 @@ disassembled code. The following attributes are recognized:
|
||||
<descrip>
|
||||
|
||||
<tag><tt>START</tt></tag>
|
||||
Followed by a numerical value. Specifies the start address of the segment.
|
||||
This attribute is followed by a numerical value which specifies the start
|
||||
address of the segment.
|
||||
|
||||
<tag><tt>END</tt></tag>
|
||||
Followed by a numerical value. Specifies the end address of the segment. The
|
||||
end address is the last address that is a part of the segment.
|
||||
This attribute is followed by a numerical value which specifies the end
|
||||
address of the segment. The end address is the last address that is a part of
|
||||
the segment.
|
||||
|
||||
<tag><tt>NAME</tt></tag>
|
||||
The attribute is followed by a string value which gives the name of the
|
||||
This attribute is followed by a string value which gives the name of the
|
||||
segment.
|
||||
|
||||
</descrip>
|
||||
|
||||
All attributes are mandatory. Segments must not overlap. The disassembler will
|
||||
@ -624,10 +638,11 @@ The following attributes are recognized:
|
||||
<descrip>
|
||||
|
||||
<tag><tt>FILE</tt></tag>
|
||||
Followed by a string value. Specifies the name of the file to read.
|
||||
This attribute is followed by a string value. It specifies the name of the
|
||||
file to read.
|
||||
|
||||
<tag><tt>COMMENTSTART</tt></tag>
|
||||
The optional attribute is followed by a character constant. It specifies the
|
||||
This optional attribute is followed by a character constant. It specifies the
|
||||
character that starts a comment. The default value is a semicolon. This
|
||||
value is ignored if <tt/IGNOREUNKNOWN/ is true.
|
||||
|
||||
@ -693,6 +708,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;
|
||||
|
429
doc/funcref.sgml
429
doc/funcref.sgml
@ -71,18 +71,21 @@ function.
|
||||
<item><ref id="detect_c64dtv" name="detect_c64dtv">
|
||||
<item><ref id="detect_c65" name="detect_c65">
|
||||
<item><ref id="detect_chameleon" name="detect_chameleon">
|
||||
<item><ref id="detect_iigs" name="detect_iigs">
|
||||
<item><ref id="detect_scpu" name="detect_scpu">
|
||||
<item><ref id="detect_turbomaster" name="detect_turbomaster">
|
||||
<item><ref id="get_c128_speed" name="get_c128_speed">
|
||||
<item><ref id="get_c64dtv_speed" name="get_c64dtv_speed">
|
||||
<item><ref id="get_c65_speed" name="get_c65_speed">
|
||||
<item><ref id="get_chameleon_speed" name="get_chameleon_speed">
|
||||
<item><ref id="get_iigs_speed" name="get_iigs_speed">
|
||||
<item><ref id="get_scpu_speed" name="get_scpu_speed">
|
||||
<item><ref id="get_turbomaster_speed" name="get_turbomaster_speed">
|
||||
<item><ref id="set_c128_speed" name="set_c128_speed">
|
||||
<item><ref id="set_c64dtv_speed" name="set_c64dtv_speed">
|
||||
<item><ref id="set_c65_speed" name="set_c65_speed">
|
||||
<item><ref id="set_chameleon_speed" name="set_chameleon_speed">
|
||||
<item><ref id="set_iigs_speed" name="set_iigs_speed">
|
||||
<item><ref id="set_scpu_speed" name="set_scpu_speed">
|
||||
<item><ref id="set_turbomaster_speed" name="set_turbomaster_speed">
|
||||
</itemize>
|
||||
@ -92,7 +95,10 @@ function.
|
||||
|
||||
<itemize>
|
||||
<item>_dos_type
|
||||
<item><ref id="beep" name="beep">
|
||||
<item><ref id="get_ostype" name="get_ostype">
|
||||
<item><ref id="gmtime_dt" name="gmtime_dt">
|
||||
<item><ref id="mktime_dt" name="mktime_dt">
|
||||
<item>rebootafterexit
|
||||
</itemize>
|
||||
|
||||
@ -101,7 +107,10 @@ function.
|
||||
|
||||
<itemize>
|
||||
<item>_dos_type
|
||||
<item><ref id="beep" name="beep">
|
||||
<item><ref id="get_ostype" name="get_ostype">
|
||||
<item><ref id="gmtime_dt" name="gmtime_dt">
|
||||
<item><ref id="mktime_dt" name="mktime_dt">
|
||||
<item>rebootafterexit
|
||||
<item><ref id="videomode" name="videomode">
|
||||
</itemize>
|
||||
@ -126,6 +135,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>
|
||||
@ -333,9 +343,11 @@ function.
|
||||
|
||||
<itemize>
|
||||
<!-- <item><ref id="get_numbanks" name="get_numbanks"> -->
|
||||
<!-- <item><ref id="get_ostype" name="get_ostype"> -->
|
||||
<item><ref id="get_ostype" name="get_ostype">
|
||||
<!-- <item><ref id="get_tv" name="get_tv"> -->
|
||||
<!-- <item><ref id="set_tv" name="set_tv"> -->
|
||||
<!-- <item><ref id="vera_layer_enable" name="vera_layer_enable"> -->
|
||||
<!-- <item><ref id="vera_sprites_enable" name="vera_sprites_enable"> -->
|
||||
<item><ref id="videomode" name="videomode">
|
||||
<!-- <item><ref id="vpeek" name="vpeek"> -->
|
||||
<!-- <item><ref id="vpoke" name="vpoke"> -->
|
||||
@ -439,6 +451,16 @@ see also <tt>testcode/lib/em-test.c</tt> and <tt>samples/multidemo.c</tt>.
|
||||
<url url="geos.html" name="GEOS API">.
|
||||
|
||||
|
||||
<sect1><tt/inet.h/<label id="inet.h"><p>
|
||||
|
||||
<itemize>
|
||||
<item><ref id="htonl" name="htonl">
|
||||
<item><ref id="htons" name="htons">
|
||||
<item><ref id="ntohl" name="ntohl">
|
||||
<item><ref id="ntohs" name="ntohs">
|
||||
</itemize>
|
||||
|
||||
|
||||
<sect1><tt/joystick.h/<label id="joystick.h"><p>
|
||||
|
||||
<itemize>
|
||||
@ -451,6 +473,18 @@ see also <tt>testcode/lib/em-test.c</tt> and <tt>samples/multidemo.c</tt>.
|
||||
</itemize>
|
||||
|
||||
|
||||
<sect1><tt/kim1.h/<label id="kim1.h"><p>
|
||||
|
||||
<itemize>
|
||||
<!-- <item><ref id="getkey" name="getkey"> -->
|
||||
<!-- <item><ref id="scandisplay" name="scandisplay"> -->
|
||||
<item><ref id="loadt" name="loadt">
|
||||
<item><ref id="dumpt" name="dumpt">
|
||||
</itemize>
|
||||
|
||||
(incomplete)
|
||||
|
||||
|
||||
<sect1><tt/locale.h/<label id="locale.h"><p>
|
||||
|
||||
<itemize>
|
||||
@ -821,6 +855,20 @@ communication, see also <tt>testcode/lib/ser-test.c</tt>.
|
||||
(incomplete)
|
||||
|
||||
|
||||
<sect1><tt/stat.h/<label id="sys/stat.h"><p>
|
||||
|
||||
<itemize>
|
||||
<item><ref id="stat" name="stat">
|
||||
</itemize>
|
||||
|
||||
|
||||
<sect1><tt/statvfs.h/<label id="sys/statvfs.h"><p>
|
||||
|
||||
<itemize>
|
||||
<item><ref id="statvfs" name="statvfs">
|
||||
</itemize>
|
||||
|
||||
|
||||
<sect1><tt/vic20.h/<label id="vic20.h"><p>
|
||||
|
||||
(incomplete)
|
||||
@ -975,7 +1023,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 +1156,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>
|
||||
|
||||
@ -1685,16 +1773,17 @@ used in presence of a prototype.
|
||||
<descrip>
|
||||
<tag/Function/Beep sound.
|
||||
<tag/Header/<tt/<ref id="sym1.h" name="sym1.h">/
|
||||
<tag/Header/<tt/<ref id="apple2.h" name="apple2.h">/
|
||||
<tag/Declaration/<tt/void beep(void);/
|
||||
<tag/Description/<tt/beep/ makes a brief tone.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is specific to the Sym-1.
|
||||
<item>The function is specific to the Sym-1 and Apple2 platforms.
|
||||
</itemize>
|
||||
<tag/Availability/cc65
|
||||
<tag/See also/
|
||||
<ref id="fdisp" name="fdisp">,
|
||||
<ref id="loadt" name="loadt">,
|
||||
<ref id="dumpt" name="dumpt">,
|
||||
<ref id="dumpt" name="dumpt">
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
@ -1839,7 +1928,7 @@ be used in presence of a prototype.
|
||||
<ref id="_swap" name="_swap">,
|
||||
<ref id="memcpy" name="memcpy">,
|
||||
<ref id="memmove" name="memmove">,
|
||||
<ref id="memset" name="memset">,
|
||||
<ref id="memset" name="memset">
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
@ -1912,7 +2001,7 @@ sent a command to TALK and a secondary address if it needs one.
|
||||
</itemize>
|
||||
<tag/Availability/cc65
|
||||
<tag/See also/
|
||||
<ref id="cbm_k_talk" name="cbm_k_talk">,
|
||||
<ref id="cbm_k_talk" name="cbm_k_talk">
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
@ -2314,8 +2403,8 @@ function, in order to provide input from the keyboard.
|
||||
<tag/See also/
|
||||
<ref id="cbm_k_getin" name="cbm_k_getin">,
|
||||
<ref id="cbm_k_udtim" name="cbm_k_udtim">,
|
||||
<ref id="cgetc" name="cgetc">,
|
||||
<!-- <ref id="getc" name="getc"> -->
|
||||
<ref id="cgetc" name="cgetc">
|
||||
<!-- <ref id="getc" name="getc">, -->
|
||||
<!-- <ref id="getchar" name="getchar"> -->
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
@ -2786,6 +2875,79 @@ setting the time may not work. See also the platform-specific information.
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>gmtime_dt<label id="gmtime_dt"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Converts a ProDOS date to a struct tm.
|
||||
<tag/Header/<tt/<ref id="apple2.h" name="apple2.h">/
|
||||
<tag/Declaration/<tt/struct tm* __fastcall__ gmtime_dt (const struct datetime* dt);/
|
||||
<tag/Description/The <tt/gmtime_dt/ function converts the given
|
||||
proDOS date/time to a struct tm. On error, NULL is returned and <tt/errno/ is set
|
||||
to an error code describing the reason for the failure.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is only available as fastcall function, so it may only
|
||||
be used in presence of a prototype.
|
||||
<item>This function is only available on Apple II.
|
||||
<item>On Apple II, you can't stat() an opened file. stat() before opening.
|
||||
</itemize>
|
||||
<tag/Availability/cc65
|
||||
<tag/Example/
|
||||
<verb>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <sys/stat.h>
|
||||
int main(void)
|
||||
{
|
||||
struct stat st;
|
||||
struct tm* tm;
|
||||
if (stat ("/disk/file", &st) == 0) {
|
||||
tm = gmtime_dt (&st.st_ctime);
|
||||
if (tm)
|
||||
printf ("File created on %s\n", asctime(tm));
|
||||
}
|
||||
}
|
||||
</verb>
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>mktime_dt<label id="mktime_dt"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Converts a ProDOS date to a time_t.
|
||||
<tag/Header/<tt/<ref id="apple2.h" name="apple2.h">/
|
||||
<tag/Declaration/<tt/time_t __fastcall__ mktime_dt (const struct datetime* dt);/
|
||||
<tag/Description/The <tt/mktime_dt/ function parses the given
|
||||
proDOS date/time and returns a time_t timestamp. On error, 0 is returned,
|
||||
and errno is set.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is only available as fastcall function, so it may only
|
||||
be used in presence of a prototype.
|
||||
<item>This function is only available on Apple II.
|
||||
</itemize>
|
||||
<tag/Availability/cc65
|
||||
<tag/Example/
|
||||
<verb>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <sys/stat.h>
|
||||
int main(void)
|
||||
{
|
||||
struct stat st;
|
||||
if (stat ("/disk/file", &st) == 0) {
|
||||
printf ("File created on %s\n",
|
||||
localtime (mktime_dt (&st.st_ctime)));
|
||||
}
|
||||
}
|
||||
</verb>
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>clrscr<label id="clrscr"><p>
|
||||
|
||||
<quote>
|
||||
@ -3233,7 +3395,7 @@ used in presence of a prototype.
|
||||
<tag/Availability/cc65 (not all platforms)
|
||||
<tag/See also/
|
||||
<ref id="get_c128_speed" name="get_c128_speed">,
|
||||
<ref id="set_c128_speed" name="set_c128_speed">,
|
||||
<ref id="set_c128_speed" name="set_c128_speed">
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
@ -3273,7 +3435,7 @@ used in presence of a prototype.
|
||||
<tag/Availability/cc65 (not all platforms)
|
||||
<tag/See also/
|
||||
<ref id="get_c65_speed" name="get_c65_speed">,
|
||||
<ref id="set_c65_speed" name="set_c65_speed">,
|
||||
<ref id="set_c65_speed" name="set_c65_speed">
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
@ -3299,6 +3461,26 @@ used in presence of a prototype.
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>detect_iigs<label id="detect_iigs"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Check whether we are running on an Apple IIgs..
|
||||
<tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
|
||||
<tag/Declaration/<tt/unsigned char detect_iigs (void);/
|
||||
<tag/Description/The function returns a 1 if running on an Apple IIgs.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is specific to the Apple2 and Apple2enh platforms.
|
||||
</itemize>
|
||||
<tag/Availability/cc65 (not all platforms)
|
||||
<tag/See also/
|
||||
<ref id="get_iigs_speed" name="get_iigs_speed">,
|
||||
<ref id="set_iigs_speed" name="set_iigs_speed">,
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>detect_scpu<label id="detect_scpu"><p>
|
||||
|
||||
<quote>
|
||||
@ -3399,11 +3581,11 @@ int main(void)
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Dump memory to tape.
|
||||
<tag/Header/<tt/<ref id="sym1.h" name="sym1.h">/
|
||||
<tag/Header/<tt/<ref id="sym1.h" name="sym1.h">/, <tt/<ref id="kim1.h" name="kim1.h">/
|
||||
<tag/Declaration/<tt/int __fastcall__ dumpt (unsigned char id, const void* start, const void* end);/
|
||||
<tag/Description/<tt/dumpt/ saves memory onto data tape.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is specific to the Sym-1.
|
||||
<item>The function is specific to the Sym-1 and KIM-1.
|
||||
<item>The return value is status. Non-zero status indicates an error.
|
||||
<item>The function is only available as fastcall function, so it may only
|
||||
be used in presence of a prototype.
|
||||
@ -3412,7 +3594,7 @@ be used in presence of a prototype.
|
||||
<tag/See also/
|
||||
<ref id="beep" name="beep">,
|
||||
<ref id="fdisp" name="fdisp">,
|
||||
<ref id="loadt" name="loadt">,
|
||||
<ref id="loadt" name="loadt">
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
@ -3792,7 +3974,7 @@ switching the CPU into double clock mode.
|
||||
<tag/See also/
|
||||
<ref id="beep" name="beep">,
|
||||
<ref id="loadt" name="loadt">,
|
||||
<ref id="dumpt" name="dumpt">,
|
||||
<ref id="dumpt" name="dumpt">
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
@ -3908,7 +4090,8 @@ be used in presence of a prototype.
|
||||
<descrip>
|
||||
<tag/Function/The function returns the operating system, the program runs on.
|
||||
<tag/Header/<tt/<ref id="apple2.h" name="apple2.h">,
|
||||
<ref id="atari.h" name="atari.h">, <ref id="c64.h" name="c64.h">/
|
||||
<ref id="atari.h" name="atari.h">, <ref id="c64.h" name="c64.h">,
|
||||
<ref id="cx16.h" name="cx16.h">/
|
||||
<tag/Declaration/<tt/unsigned char get_ostype (void);/
|
||||
<tag/Description/<tt/get_ostype/ is machine dependent and does not exist for
|
||||
all supported targets. If it exists, it returns a number that identifies the
|
||||
@ -4012,6 +4195,27 @@ header files define constants that can be used to check the return code.
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>get_iigs_speed<label id="get_iigs_speed"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Get the current speed of the Apple IIgs.
|
||||
<tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
|
||||
<tag/Declaration/<tt/unsigned char get_iigs_speed (void);/
|
||||
<tag/Description/The function returns the current speed of the Apple IIgs.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is specific to the Apple2 and Apple2enh platforms.
|
||||
<item>See the accelerator.h header for the speed definitions.
|
||||
</itemize>
|
||||
<tag/Availability/cc65 (not all platforms)
|
||||
<tag/See also/
|
||||
<ref id="detect_iigs" name="detect_iigs">,
|
||||
<ref id="set_iigs_speed" name="set_iigs_speed">,
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>get_scpu_speed<label id="get_scpu_speed"><p>
|
||||
|
||||
<quote>
|
||||
@ -4148,7 +4352,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>
|
||||
|
||||
@ -4347,6 +4551,45 @@ to undefined behaviour.
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
<sect1>htonl<label id="htonl"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Swaps byte order in a 32 bit word.
|
||||
<tag/Header/<tt/<ref id="inet.h" name="arpa/inet.h">/
|
||||
<tag/Declaration/<tt/int htonl(val)/
|
||||
<tag/Description/Converts a 32 bit word from from network byte order
|
||||
(big endian) to little endian (or vice-versa).
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is only available as fastcall function, so it may only
|
||||
be used in presence of a prototype.
|
||||
</itemize>
|
||||
<tag/See also/
|
||||
<ref id="ntohl" name="ntohl">
|
||||
<tag/Availability/cc65
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>htons<label id="htons"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Swaps byte order in a 16 bit word.
|
||||
<tag/Header/<tt/<ref id="inet.h" name="arpa/inet.h">/
|
||||
<tag/Declaration/<tt/int htons(val)/
|
||||
<tag/Description/Converts a 16 bit word from from network byte order
|
||||
(big endian) to little endian (or vice-versa) by swapping both its bytes.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is only available as fastcall function, so it may only
|
||||
be used in presence of a prototype.
|
||||
</itemize>
|
||||
<tag/See also/
|
||||
<ref id="ntohs" name="ntohs">
|
||||
<tag/Availability/cc65
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>isalnum<label id="isalnum"><p>
|
||||
|
||||
@ -5043,11 +5286,11 @@ used in presence of a prototype.
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Load memory from tape.
|
||||
<tag/Header/<tt/<ref id="sym1.h" name="sym1.h">/
|
||||
<tag/Header/<tt/<ref id="sym1.h" name="sym1.h">/, <tt/<ref id="kim1.h" name="kim1.h">/
|
||||
<tag/Declaration/<tt/int __fastcall__ loadt (unsigned char id);/
|
||||
<tag/Description/<tt/loadt/ loads memory from data tape.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is specific to the Sym-1.
|
||||
<item>The function is specific to the Sym-1 and KIM-1.
|
||||
<item>The return value is status. Non-zero status indicates an error.
|
||||
<item>The function is only available as fastcall function, so it may only
|
||||
be used in presence of a prototype.
|
||||
@ -5056,7 +5299,7 @@ be used in presence of a prototype.
|
||||
<tag/See also/
|
||||
<ref id="beep" name="beep">,
|
||||
<ref id="fdisp" name="fdisp">,
|
||||
<ref id="dumpt" name="dumpt">,
|
||||
<ref id="dumpt" name="dumpt">
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
@ -5716,6 +5959,44 @@ memory allocated for the driver.
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
<sect1>ntohl<label id="ntohl"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Swaps byte order in a 32 bit word.
|
||||
<tag/Header/<tt/<ref id="inet.h" name="arpa/inet.h">/
|
||||
<tag/Declaration/<tt/int __fastcall__ ntohl (int val);/
|
||||
<tag/Description/Converts a 32 bit word from from host byte order (little endian)
|
||||
to big endian (or vice-versa).
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is only available as fastcall function, so it may only
|
||||
be used in presence of a prototype.
|
||||
</itemize>
|
||||
<tag/See also/
|
||||
<ref id="htonl" name="htonl">
|
||||
<tag/Availability/cc65
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
<sect1>ntohs<label id="ntohs"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Swaps byte order in a 16 bit word.
|
||||
<tag/Header/<tt/<ref id="inet.h" name="arpa/inet.h">/
|
||||
<tag/Declaration/<tt/int __fastcall__ ntohs (int val);/
|
||||
<tag/Description/Converts a 16 bit word from from host byte order (little endian)
|
||||
to big endian (or vice-versa) by swapping both its bytes.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is only available as fastcall function, so it may only
|
||||
be used in presence of a prototype.
|
||||
</itemize>
|
||||
<tag/See also/
|
||||
<ref id="htons" name="htons">
|
||||
<tag/Availability/cc65
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
<sect1>offsetof<label id="offsetof"><p>
|
||||
|
||||
<quote>
|
||||
@ -6086,6 +6367,9 @@ be used in presence of a prototype.
|
||||
<item>The returned pointer may point to a statically allocated instance of
|
||||
<tt/struct dirent/, so it may get overwritten by subsequent calls to
|
||||
<tt/readdir/.
|
||||
<item>On the Apple II platform, the d_ctime and d_mtime returned are in the
|
||||
ProDOS format. You can convert them to more portable time representations using
|
||||
the ProDOS datetime conversion functions.
|
||||
<item>On several platforms, namely the CBMs and the Atari, the disk drives get
|
||||
confused when opening/closing files between directory reads. So for example a
|
||||
program that reads the list of files on a disk, and after each call to
|
||||
@ -6565,7 +6849,8 @@ be used in presence of a prototype.
|
||||
<tag/Function/Uninstall the currently loaded driver but do not unload it.
|
||||
<tag/Header/<tt/<ref id="serial.h" name="serial.h">/
|
||||
<tag/Declaration/<tt/unsigned char ser_uninstall (void);/
|
||||
<tag/Description/Uninstall the currently loaded driver but do not unload it.
|
||||
<tag/Description/Uninstall the currently loaded driver but do not unload it. This
|
||||
function returns SER_ERR_NO_DRIVER if no driver was installed, 0 otherwise.
|
||||
<tag/Availability/cc65
|
||||
<tag/See also/Other serial functions.
|
||||
<tag/Example/None.
|
||||
@ -6749,6 +7034,30 @@ clean-up when exiting the program.
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>set_iigs_speed<label id="set_iigs_speed"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Set the current speed of the Apple IIgs.
|
||||
<tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
|
||||
<tag/Declaration/<tt/unsigned char __fastcall__ set_iigs_speed (unsigned char speed);/
|
||||
<tag/Description/The function sets the speed of the Apple IIgs CPU (and returns
|
||||
the new speed).
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is specific to the Apple2 and Apple2enh platforms.
|
||||
<item>See the accelerator.h header for the speed definitions.
|
||||
<item>Accepted parameters are SPEED_SLOW and SPEED_FAST (all other values are
|
||||
considered SPEED_FAST).
|
||||
</itemize>
|
||||
<tag/Availability/cc65 (not all platforms)
|
||||
<tag/See also/
|
||||
<ref id="detect_iigs" name="detect_iigs">,
|
||||
<ref id="get_iigs_speed" name="get_iigs_speed">,
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>set_scpu_speed<label id="set_scpu_speed"><p>
|
||||
|
||||
<quote>
|
||||
@ -6908,7 +7217,6 @@ switching the CPU into single clock mode.
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>srand<label id="srand"><p>
|
||||
|
||||
<quote>
|
||||
@ -6932,6 +7240,85 @@ be used in presence of a prototype.
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>stat<label id="stat"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Get file status.
|
||||
<tag/Header/<tt/<ref id="sys/stat.h" name="sys/stat.h">/
|
||||
<tag/Declaration/<tt/int __fastcall__ stat (const char* pathname, struct stat* statbuf);/
|
||||
<tag/Description/<tt/stat/ gets information for the file with the given name. On success,
|
||||
zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
|
||||
code describing the reason for the failure.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is only available as fastcall function, so it may only
|
||||
be used in presence of a prototype.
|
||||
<item>On the Apple II platform, the st_ctim, st_mtim and st_atim members are left
|
||||
to zero, for size and performance reasons. The ProDOS creation and modification dates
|
||||
are returned in the ProDOS format in st_ctime and st_mtime. The access date does
|
||||
not exist. You can convert them to POSIX-style time representations using
|
||||
the <url url="apple2.html#ss9.3" name="ProDOS datetime conversion functions">.
|
||||
</itemize>
|
||||
<tag/Availability/POSIX 1003.1
|
||||
<tag/See also/
|
||||
<ref id="statvfs" name="statvfs">
|
||||
<tag/Example/
|
||||
<verb>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#define FILENAME "helloworld"
|
||||
struct stat stbuf;
|
||||
if (stat (FILENAME, &stbuf) == 0) {
|
||||
printf ("%s size is %lu bytes (created on %s)\n", FILENAME, stbuf.st_size,
|
||||
#ifndef __APPLE2__
|
||||
localtime (&stbuf.st_ctim.tv_sec)
|
||||
#else
|
||||
localtime (mktime_dt (&stbuf.st_ctime))
|
||||
#endif
|
||||
);
|
||||
} else {
|
||||
printf ("There was a problem stat'ing %s: %d\n", FILENAME, errno);
|
||||
}
|
||||
</verb>
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>statvfs<label id="statvfs"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Get filesystem statistics.
|
||||
<tag/Header/<tt/<ref id="sys/statvfs.h" name="sys/statvfs.h">/
|
||||
<tag/Declaration/<tt/int __fastcall__ statvfs (const char* pathname, struct statvfs* buf);/
|
||||
<tag/Description/<tt/statvfs/ gets information for the filesytem on which the given file
|
||||
resides. On success,
|
||||
zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
|
||||
code describing the reason for the failure.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is only available as fastcall function, so it may only
|
||||
be used in presence of a prototype.
|
||||
<item>The function requires an absolute pathname.
|
||||
</itemize>
|
||||
<tag/Availability/POSIX 1003.1
|
||||
<tag/See also/
|
||||
<ref id="stat" name="stat">
|
||||
<tag/Example/
|
||||
<verb>
|
||||
#include <sys/statvfs.h>
|
||||
|
||||
#define FILENAME "/disk/helloworld"
|
||||
struct statvfs stvbuf;
|
||||
if (statvfs (FILENAME, &stvbuf) == 0) {
|
||||
printf ("%s filesystem has %u blocks of %u size, %u of them free.\n", FILENAME, stvbuf.f_blocks, stvbuf.f_bsize, stvbuf.f_bfree);
|
||||
} else {
|
||||
printf ("There was a problem statvfs'ing %s: %d\n", FILENAME, errno);
|
||||
}
|
||||
</verb>
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>strcasecmp<label id="strcasecmp"><p>
|
||||
|
||||
<quote>
|
||||
|
@ -270,7 +270,7 @@ required for the correct process of GEOS sequential application building.
|
||||
<p>Large GEOS applications typically don't fit in one piece in their designated
|
||||
memory area. They are therefore split into overlays which are loaded into memory
|
||||
on demand. The individual overlays are stored as records of a VLIR (Variable
|
||||
Length Index Record) file. When GEOS starts a VLIR overlay appliation it loads
|
||||
Length Index Record) file. When GEOS starts a VLIR overlay application it loads
|
||||
record number 0 which is supposed to contain the main program. The record numbers
|
||||
starting with 1 are to be used for the actual overlays.
|
||||
|
||||
|
@ -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.
|
||||
|
||||
@ -172,6 +175,9 @@
|
||||
<tag><htmlurl url="plus4.html" name="plus4.html"></tag>
|
||||
Topics specific to the Commodore Plus/4.
|
||||
|
||||
<tag><htmlurl url="rp6502.html" name="rp6502.html"></tag>
|
||||
Topics specific to the Picocomputer 6502.
|
||||
|
||||
<tag><htmlurl url="supervision.html" name="supervision.html"></tag>
|
||||
Topics specific to the Watara Supervision Console.
|
||||
|
||||
|
150
doc/kim1.sgml
Normal file
150
doc/kim1.sgml
Normal file
@ -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>
|
||||
|
96
doc/rp6502.sgml
Normal file
96
doc/rp6502.sgml
Normal file
@ -0,0 +1,96 @@
|
||||
<!doctype linuxdoc system>
|
||||
|
||||
<article>
|
||||
<title>Picocomputer 6502 - specific information for cc65
|
||||
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">
|
||||
|
||||
<abstract>
|
||||
An overview over the Picocomputer 6502 and its interfaces to the cc65 C
|
||||
compiler.
|
||||
</abstract>
|
||||
|
||||
<!-- Table of contents -->
|
||||
<toc>
|
||||
|
||||
<!-- Begin the document -->
|
||||
|
||||
<sect>Overview<p>
|
||||
|
||||
The Picocomputer 6502 is a modern W65C02S computer with a custom operating
|
||||
system designed to be POSIX-like. The reference design includes a W65C02S,
|
||||
W65C22S, RP6502-RIA, and optionally a RP6502-VGA. Peripheral devices like
|
||||
keyboards, mice, and flash storage are connected by USB to the RP6502-RIA.
|
||||
Audio is generated by the RP6502-RIA. Video is generated by the RP6502-VGA.
|
||||
|
||||
|
||||
|
||||
<sect>Binary format<p>
|
||||
|
||||
The standard binary output format generated by the linker for the RP6502 target
|
||||
is a plain machine language program without any prefix or postfix.
|
||||
|
||||
The RP6502 Integrated Development Environment, based on Visual Studio Code,
|
||||
will convert the cc65 binary output into RP6502 ROM files that can be loaded
|
||||
directly from the RP6502 monitor or installed on the RIA to be loaded at boot.
|
||||
|
||||
|
||||
|
||||
<sect>Memory layout<p>
|
||||
|
||||
<descrip>
|
||||
<tag/Stack/
|
||||
The C run-time stack is located at $FEFF, and grows downward.
|
||||
|
||||
<tag/Heap/
|
||||
The C heap is located at the end of the program, and grows toward the C
|
||||
run-time stack.
|
||||
|
||||
<tag/RAM/
|
||||
RAM is located at $0000 - $FEFF. Default binaries load and
|
||||
start at $0200.
|
||||
|
||||
<tag/ROM/
|
||||
The RP6502 is designed with no ROM in the 6502 address space.
|
||||
|
||||
<tag/VIA/
|
||||
A Versatile Interface Adapter (6522) is 16 registers located
|
||||
at $FFD0.
|
||||
|
||||
<tag/RIA/
|
||||
The RP6502 Interface Adapter is 32 registers located at $FFE0.
|
||||
|
||||
<tag/User/
|
||||
User I/O expansion is from $FF00 to $FFCF.
|
||||
|
||||
</descrip><p>
|
||||
|
||||
|
||||
|
||||
<sect>Platform-specific header files<p>
|
||||
|
||||
Programs containing RP6502-specific code may use the <tt/rp6502.h/ or
|
||||
<tt/rp6502.inc/ include files.
|
||||
|
||||
|
||||
|
||||
<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>
|
@ -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 exit 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:
|
||||
|
||||
|
@ -104,7 +104,7 @@ placeholder has two advantages:
|
||||
<item> The code is better documented. It is clearly visible that the given
|
||||
value is about to be changed.
|
||||
<item> When examining an (initial) disassembly (e.g. in a debugger), these
|
||||
placegolders can be better identified: They are fixed and, you may
|
||||
placeholders can be better identified: They are fixed and, you may
|
||||
notice that below, quite eye catching defined.
|
||||
</enum>
|
||||
|
||||
|
@ -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
|
||||
|
@ -304,6 +304,36 @@ unsigned char detect_turbomaster (void);
|
||||
* 0x01 : C64 Turbo Master cartridge present
|
||||
*/
|
||||
|
||||
unsigned char __fastcall__ set_iigs_speed (unsigned char speed);
|
||||
|
||||
/* Set the speed of the Apple IIgs CPU.
|
||||
*
|
||||
* Possible values:
|
||||
* SPEED_SLOW : 1 Mhz mode
|
||||
* SPEED_FAST : Fast mode (2.8MHz or more, depending on the presence of
|
||||
* an accelerator)
|
||||
*
|
||||
* Any other value will be interpreted as SPEED_FAST.
|
||||
*/
|
||||
|
||||
unsigned char get_iigs_speed (void);
|
||||
|
||||
/* Get the speed of the Apple IIgs CPU.
|
||||
*
|
||||
* Possible return values:
|
||||
* SPEED_SLOW : 1 Mhz mode
|
||||
* SPEED_FAST : Fast mode (2.8MHz or more, depending on the presence of
|
||||
* an accelerator)
|
||||
*/
|
||||
|
||||
unsigned char detect_iigs (void);
|
||||
|
||||
/* Check whether we are running on an Apple IIgs.
|
||||
*
|
||||
* Possible return values:
|
||||
* 0x00 : No
|
||||
* 0x01 : Yes
|
||||
*/
|
||||
|
||||
/* End of accelerator.h */
|
||||
#endif
|
||||
|
||||
|
@ -41,6 +41,7 @@
|
||||
# error This module may only be used when compiling for the Apple ][!
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
#include <apple2_filetype.h>
|
||||
|
||||
|
||||
@ -142,6 +143,27 @@ extern unsigned char _dos_type;
|
||||
** ProDOS 8 2.4.x - 0x24
|
||||
*/
|
||||
|
||||
/* struct stat.st_mode values */
|
||||
#define S_IFDIR 0x01
|
||||
#define S_IFREG 0x02
|
||||
#define S_IFBLK 0xFF
|
||||
#define S_IFCHR 0xFF
|
||||
#define S_IFIFO 0xFF
|
||||
#define S_IFLNK 0xFF
|
||||
#define S_IFSOCK 0xFF
|
||||
|
||||
struct datetime {
|
||||
struct {
|
||||
unsigned day :5;
|
||||
unsigned mon :4;
|
||||
unsigned year :7;
|
||||
} date;
|
||||
struct {
|
||||
unsigned char min;
|
||||
unsigned char hour;
|
||||
} time;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
@ -151,27 +173,18 @@ extern unsigned char _dos_type;
|
||||
|
||||
|
||||
/* The file stream implementation and the POSIX I/O functions will use the
|
||||
** following struct to set the date and time stamp on files. This specificially
|
||||
** following struct to set the date and time stamp on files. This specifically
|
||||
** applies to the open and fopen functions.
|
||||
*/
|
||||
extern struct {
|
||||
struct {
|
||||
unsigned day :5;
|
||||
unsigned mon :4;
|
||||
unsigned year :7;
|
||||
} createdate; /* Current date: 0 */
|
||||
struct {
|
||||
unsigned char min;
|
||||
unsigned char hour;
|
||||
} createtime; /* Current time: 0 */
|
||||
} _datetime;
|
||||
extern struct datetime _datetime;
|
||||
|
||||
/* The addresses of the static drivers */
|
||||
#if !defined(__APPLE2ENH__)
|
||||
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_gs_ser[]; /* IIgs serial driver */
|
||||
extern void a2_hi_tgi[]; /* Referred to by tgi_static_stddrv[] */
|
||||
extern void a2_lo_tgi[];
|
||||
#endif
|
||||
@ -184,6 +197,9 @@ extern void a2_lo_tgi[];
|
||||
|
||||
|
||||
|
||||
void beep (void);
|
||||
/* Beep beep. */
|
||||
|
||||
unsigned char get_ostype (void);
|
||||
/* Get the machine type. Returns one of the APPLE_xxx codes. */
|
||||
|
||||
@ -210,6 +226,12 @@ void rebootafterexit (void);
|
||||
#define _cpeekcolor() COLOR_WHITE
|
||||
#define _cpeekrevers() 0
|
||||
|
||||
struct tm* __fastcall__ gmtime_dt (const struct datetime* dt);
|
||||
/* Converts a ProDOS date/time structure to a struct tm */
|
||||
|
||||
time_t __fastcall__ mktime_dt (const struct datetime* dt);
|
||||
/* Converts a ProDOS date/time structure to a time_t UNIX timestamp */
|
||||
|
||||
|
||||
|
||||
/* End of apple2.h */
|
||||
|
@ -99,7 +99,8 @@
|
||||
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_gs_ser[]; /* IIgs serial driver */
|
||||
extern void a2e_hi_tgi[]; /* Referred to by tgi_static_stddrv[] */
|
||||
extern void a2e_lo_tgi[];
|
||||
|
||||
|
@ -1,15 +1,12 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* asctime.c */
|
||||
/* arpa/inet.h */
|
||||
/* */
|
||||
/* Convert a broken down time into a string */
|
||||
/* Endianness utilities for cc65 */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2002 Ullrich von Bassewitz */
|
||||
/* Wacholderweg 14 */
|
||||
/* D-70597 Stuttgart */
|
||||
/* EMail: uz@musoftware.de */
|
||||
/* (C) 2023 Colin Leroy-Mira, <colin@colino.net> */
|
||||
/* */
|
||||
/* */
|
||||
/* This software is provided 'as-is', without any expressed or implied */
|
||||
@ -33,8 +30,8 @@
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#ifndef _ARPA_INET_H
|
||||
#define _ARPA_INET_H
|
||||
|
||||
|
||||
|
||||
@ -42,18 +39,29 @@
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
CAUTION: we need to reserve enough space to be able to hold the maximum
|
||||
length string:
|
||||
|
||||
1234567890123456789012345678901234567
|
||||
"Wednesday September ..1 00:00:00 1970"
|
||||
*/
|
||||
|
||||
char* __fastcall__ asctime (const struct tm* timep)
|
||||
{
|
||||
static char buf[38];
|
||||
#if (__OPT_i__ < 200)
|
||||
int __fastcall__ ntohs (int val);
|
||||
int __fastcall__ htons (int val);
|
||||
#else
|
||||
|
||||
/* Format into given buffer and return the result */
|
||||
return strftime (buf, sizeof (buf), "%c\n", timep)? buf : 0;
|
||||
}
|
||||
#define ntohs(x) \
|
||||
( \
|
||||
__AX__=(x), \
|
||||
asm("sta tmp1"), \
|
||||
asm("txa"), \
|
||||
asm("ldx tmp1"), \
|
||||
__AX__ \
|
||||
)
|
||||
#define htons(x) ntohs(x)
|
||||
|
||||
#endif
|
||||
|
||||
long __fastcall__ ntohl (long val);
|
||||
long __fastcall__ htonl (long val);
|
||||
|
||||
|
||||
|
||||
/* End of arpa/inet.h */
|
||||
#endif
|
@ -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[] */
|
||||
|
||||
|
||||
|
@ -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[] */
|
||||
|
||||
|
||||
|
||||
|
@ -256,6 +256,42 @@ struct __vera {
|
||||
unsigned char vstart; /* Vertical start position */
|
||||
unsigned char vstop; /* Vertical stop position */
|
||||
};
|
||||
struct { /* Visible when DCSEL flag = 2 */
|
||||
unsigned char fxctrl;
|
||||
unsigned char fxtilebase;
|
||||
unsigned char fxmapbase;
|
||||
unsigned char fxmult;
|
||||
};
|
||||
struct { /* Visible when DCSEL flag = 3 */
|
||||
unsigned char fxxincrl;
|
||||
unsigned char fxxincrh;
|
||||
unsigned char fxyincrl;
|
||||
unsigned char fxyincrh;
|
||||
};
|
||||
struct { /* Visible when DCSEL flag = 4 */
|
||||
unsigned char fxxposl;
|
||||
unsigned char fxxposh;
|
||||
unsigned char fxyposl;
|
||||
unsigned char fxyposh;
|
||||
};
|
||||
struct { /* Visible when DCSEL flag = 5 */
|
||||
unsigned char fxxposs;
|
||||
unsigned char fxyposs;
|
||||
unsigned char fxpolyfilll;
|
||||
unsigned char fxpolyfillh;
|
||||
};
|
||||
struct { /* Visible when DCSEL flag = 6 */
|
||||
unsigned char fxcachel;
|
||||
unsigned char fxcachem;
|
||||
unsigned char fxcacheh;
|
||||
unsigned char fxcacheu;
|
||||
};
|
||||
struct { /* Visible when DCSEL flag = 63 */
|
||||
unsigned char dcver0;
|
||||
unsigned char dcver1;
|
||||
unsigned char dcver2;
|
||||
unsigned char dcver3;
|
||||
};
|
||||
} display;
|
||||
struct {
|
||||
unsigned char config; /* Layer map geometry */
|
||||
|
@ -33,6 +33,8 @@
|
||||
#ifndef _DIRENT_H
|
||||
#define _DIRENT_H
|
||||
|
||||
#include <target.h>
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
@ -46,31 +48,15 @@ typedef struct DIR DIR;
|
||||
#if defined(__APPLE2__)
|
||||
|
||||
struct dirent {
|
||||
char d_name[16];
|
||||
unsigned d_ino;
|
||||
unsigned d_blocks;
|
||||
unsigned long d_size;
|
||||
unsigned char d_type;
|
||||
struct {
|
||||
unsigned day :5;
|
||||
unsigned mon :4;
|
||||
unsigned year :7;
|
||||
} d_cdate;
|
||||
struct {
|
||||
unsigned char min;
|
||||
unsigned char hour;
|
||||
} d_ctime;
|
||||
unsigned char d_access;
|
||||
unsigned d_auxtype;
|
||||
struct {
|
||||
unsigned day :5;
|
||||
unsigned mon :4;
|
||||
unsigned year :7;
|
||||
} d_mdate;
|
||||
struct {
|
||||
unsigned char min;
|
||||
unsigned char hour;
|
||||
} d_mtime;
|
||||
char d_name[16];
|
||||
unsigned d_ino;
|
||||
unsigned d_blocks;
|
||||
unsigned long d_size;
|
||||
unsigned char d_type;
|
||||
struct datetime d_ctime;
|
||||
unsigned char d_access;
|
||||
unsigned d_auxtype;
|
||||
struct datetime d_mtime;
|
||||
};
|
||||
|
||||
#define _DE_ISREG(t) ((t) != 0x0F)
|
||||
|
@ -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
|
||||
|
73
include/kim1.h
Normal file
73
include/kim1.h
Normal file
@ -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[] */
|
||||
|
||||
|
||||
|
@ -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[] */
|
||||
|
||||
|
||||
|
||||
|
264
include/rp6502.h
Normal file
264
include/rp6502.h
Normal file
@ -0,0 +1,264 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* rp6502.h */
|
||||
/* */
|
||||
/* Picocomputer 6502 */
|
||||
/* */
|
||||
/* */
|
||||
/* 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 _RP6502_H
|
||||
#define _RP6502_H
|
||||
|
||||
/* RP6502 VIA $FFD0-$FFDF */
|
||||
|
||||
#include <_6522.h>
|
||||
#define VIA (*(volatile struct __6522 *)0xFFD0)
|
||||
|
||||
/* RP6502 RIA $FFE0-$FFF9 */
|
||||
|
||||
struct __RP6502
|
||||
{
|
||||
const unsigned char ready;
|
||||
unsigned char tx;
|
||||
const unsigned char rx;
|
||||
const unsigned char vsync;
|
||||
unsigned char rw0;
|
||||
unsigned char step0;
|
||||
unsigned int addr0;
|
||||
unsigned char rw1;
|
||||
unsigned char step1;
|
||||
unsigned int addr1;
|
||||
unsigned char xstack;
|
||||
unsigned char errno_lo;
|
||||
unsigned char errno_hi;
|
||||
unsigned char op;
|
||||
unsigned char irq;
|
||||
const unsigned char spin;
|
||||
const unsigned char busy;
|
||||
const unsigned char lda;
|
||||
unsigned char a;
|
||||
const unsigned char ldx;
|
||||
unsigned char x;
|
||||
const unsigned char rts;
|
||||
unsigned int sreg;
|
||||
};
|
||||
#define RIA (*(volatile struct __RP6502 *)0xFFE0)
|
||||
|
||||
#define RIA_READY_TX_BIT 0x80
|
||||
#define RIA_READY_RX_BIT 0x40
|
||||
#define RIA_BUSY_BIT 0x80
|
||||
|
||||
/* XSTACK helpers */
|
||||
|
||||
void __fastcall__ ria_push_long (unsigned long val);
|
||||
void __fastcall__ ria_push_int (unsigned int val);
|
||||
#define ria_push_char(v) RIA.xstack = v
|
||||
|
||||
long ria_pop_long (void);
|
||||
int ria_pop_int (void);
|
||||
#define ria_pop_char() RIA.xstack
|
||||
|
||||
/* Set the RIA fastcall register */
|
||||
|
||||
void __fastcall__ ria_set_axsreg (unsigned long axsreg);
|
||||
void __fastcall__ ria_set_ax (unsigned int ax);
|
||||
#define ria_set_a(v) RIA.a = v
|
||||
|
||||
/* Run an OS operation */
|
||||
|
||||
int __fastcall__ ria_call_int (unsigned char op);
|
||||
long __fastcall__ ria_call_long (unsigned char op);
|
||||
|
||||
/* These run _mappederrno() on error */
|
||||
|
||||
int __fastcall__ ria_call_int_errno (unsigned char op);
|
||||
long __fastcall__ ria_call_long_errno (unsigned char op);
|
||||
|
||||
/* OS operation numbers */
|
||||
|
||||
#define RIA_OP_EXIT 0xFF
|
||||
#define RIA_OP_ZXSTACK 0x00
|
||||
#define RIA_OP_XREG 0x01
|
||||
#define RIA_OP_PHI2 0x02
|
||||
#define RIA_OP_CODEPAGE 0x03
|
||||
#define RIA_OP_LRAND 0x04
|
||||
#define RIA_OP_STDIN_OPT 0x05
|
||||
#define RIA_OP_CLOCK_GETRES 0x10
|
||||
#define RIA_OP_CLOCK_GETTIME 0x11
|
||||
#define RIA_OP_CLOCK_SETTIME 0x12
|
||||
#define RIA_OP_CLOCK_GETTIMEZONE 0x13
|
||||
#define RIA_OP_OPEN 0x14
|
||||
#define RIA_OP_CLOSE 0x15
|
||||
#define RIA_OP_READ_XSTACK 0x16
|
||||
#define RIA_OP_READ_XRAM 0x17
|
||||
#define RIA_OP_WRITE_XSTACK 0x18
|
||||
#define RIA_OP_WRITE_XRAM 0x19
|
||||
#define RIA_OP_LSEEK 0x1A
|
||||
#define RIA_OP_UNLINK 0x1B
|
||||
#define RIA_OP_RENAME 0x1C
|
||||
|
||||
/* C API for the operating system. */
|
||||
|
||||
int __cdecl__ xreg (char device, char channel, unsigned char address, ...);
|
||||
int phi2 (void);
|
||||
int codepage (void);
|
||||
long lrand (void);
|
||||
int __fastcall__ stdin_opt (unsigned long ctrl_bits, unsigned char str_length);
|
||||
int __fastcall__ read_xstack (void* buf, unsigned count, int fildes);
|
||||
int __fastcall__ read_xram (unsigned buf, unsigned count, int fildes);
|
||||
int __fastcall__ write_xstack (const void* buf, unsigned count, int fildes);
|
||||
int __fastcall__ write_xram (unsigned buf, unsigned count, int fildes);
|
||||
|
||||
/* XREG location helpers */
|
||||
|
||||
#define xreg_ria_keyboard(...) xreg(0, 0, 0, __VA_ARGS__)
|
||||
#define xreg_ria_mouse(...) xreg(0, 0, 1, __VA_ARGS__)
|
||||
#define xreg_vga_canvas(...) xreg(1, 0, 0, __VA_ARGS__)
|
||||
#define xreg_vga_mode(...) xreg(1, 0, 1, __VA_ARGS__)
|
||||
|
||||
/* XRAM structure helpers */
|
||||
|
||||
#define xram0_struct_set(addr, type, member, val) \
|
||||
RIA.addr0 = (unsigned)(&((type *)0)->member) + (unsigned)addr; \
|
||||
switch (sizeof(((type *)0)->member)) \
|
||||
{ \
|
||||
case 1: \
|
||||
RIA.rw0 = val; \
|
||||
break; \
|
||||
case 2: \
|
||||
RIA.step0 = 1; \
|
||||
RIA.rw0 = val & 0xff; \
|
||||
RIA.rw0 = (val >> 8) & 0xff; \
|
||||
break; \
|
||||
case 4: \
|
||||
RIA.step0 = 1; \
|
||||
RIA.rw0 = (unsigned long)val & 0xff; \
|
||||
RIA.rw0 = ((unsigned long)val >> 8) & 0xff; \
|
||||
RIA.rw0 = ((unsigned long)val >> 16) & 0xff; \
|
||||
RIA.rw0 = ((unsigned long)val >> 24) & 0xff; \
|
||||
break; \
|
||||
}
|
||||
|
||||
#define xram1_struct_set(addr, type, member, val) \
|
||||
RIA.addr1 = (unsigned)(&((type *)0)->member) + (unsigned)addr; \
|
||||
switch (sizeof(((type *)0)->member)) \
|
||||
{ \
|
||||
case 1: \
|
||||
RIA.rw1 = val; \
|
||||
break; \
|
||||
case 2: \
|
||||
RIA.step1 = 1; \
|
||||
RIA.rw1 = val & 0xff; \
|
||||
RIA.rw1 = (val >> 8) & 0xff; \
|
||||
break; \
|
||||
case 4: \
|
||||
RIA.step1 = 1; \
|
||||
RIA.rw1 = (unsigned long)val & 0xff; \
|
||||
RIA.rw1 = ((unsigned long)val >> 8) & 0xff; \
|
||||
RIA.rw1 = ((unsigned long)val >> 16) & 0xff; \
|
||||
RIA.rw1 = ((unsigned long)val >> 24) & 0xff; \
|
||||
break; \
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char x_wrap; // bool
|
||||
unsigned char y_wrap; // bool
|
||||
int x_pos_px;
|
||||
int y_pos_px;
|
||||
int width_chars;
|
||||
int height_chars;
|
||||
unsigned xram_data_ptr;
|
||||
unsigned xram_palette_ptr;
|
||||
unsigned xram_font_ptr;
|
||||
} vga_mode1_config_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char x_wrap; // bool
|
||||
unsigned char y_wrap; // bool
|
||||
int x_pos_px;
|
||||
int y_pos_px;
|
||||
int width_tiles;
|
||||
int height_tiles;
|
||||
unsigned xram_data_ptr;
|
||||
unsigned xram_palette_ptr;
|
||||
unsigned xram_tile_ptr;
|
||||
} vga_mode2_config_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char x_wrap; // bool
|
||||
unsigned char y_wrap; // bool
|
||||
int x_pos_px;
|
||||
int y_pos_px;
|
||||
int width_px;
|
||||
int height_px;
|
||||
unsigned xram_data_ptr;
|
||||
unsigned xram_palette_ptr;
|
||||
} vga_mode3_config_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int x_pos_px;
|
||||
int y_pos_px;
|
||||
unsigned xram_sprite_ptr;
|
||||
unsigned char log_size;
|
||||
unsigned char has_opacity_metadata; // bool
|
||||
} vga_mode4_sprite_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int transform[6];
|
||||
int x_pos_px;
|
||||
int y_pos_px;
|
||||
unsigned xram_sprite_ptr;
|
||||
unsigned char log_size;
|
||||
unsigned char has_opacity_metadata; // bool
|
||||
} vga_mode4_asprite_t;
|
||||
|
||||
/* Values in __oserror are the union of these FatFs errors and errno.h */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
FR_OK = 32, /* Succeeded */
|
||||
FR_DISK_ERR, /* A hard error occurred in the low level disk I/O layer */
|
||||
FR_INT_ERR, /* Assertion failed */
|
||||
FR_NOT_READY, /* The physical drive cannot work */
|
||||
FR_NO_FILE, /* Could not find the file */
|
||||
FR_NO_PATH, /* Could not find the path */
|
||||
FR_INVALID_NAME, /* The path name format is invalid */
|
||||
FR_DENIED, /* Access denied due to prohibited access or directory full */
|
||||
FR_EXIST, /* Access denied due to prohibited access */
|
||||
FR_INVALID_OBJECT, /* The file/directory object is invalid */
|
||||
FR_WRITE_PROTECTED, /* The physical drive is write protected */
|
||||
FR_INVALID_DRIVE, /* The logical drive number is invalid */
|
||||
FR_NOT_ENABLED, /* The volume has no work area */
|
||||
FR_NO_FILESYSTEM, /* There is no valid FAT volume */
|
||||
FR_MKFS_ABORTED, /* The f_mkfs() aborted due to any problem */
|
||||
FR_TIMEOUT, /* Could not get a grant to access the volume within defined period */
|
||||
FR_LOCKED, /* The operation is rejected according to the file sharing policy */
|
||||
FR_NOT_ENOUGH_CORE, /* LFN working buffer could not be allocated */
|
||||
FR_TOO_MANY_OPEN_FILES, /* Number of open files > FF_FS_LOCK */
|
||||
FR_INVALID_PARAMETER /* Given parameter is invalid */
|
||||
} FRESULT;
|
||||
|
||||
#endif /* _RP6502_H */
|
@ -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 */
|
||||
|
@ -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 */
|
||||
@ -87,6 +86,10 @@ extern FILE* stderr;
|
||||
# define FILENAME_MAX (80+1)
|
||||
#elif defined(__TELESTRAT__)
|
||||
# define FILENAME_MAX (50+1)
|
||||
#elif defined(__SIM6502__)
|
||||
# define FILENAME_MAX (1024+1)
|
||||
#elif defined(__SIM65C02__)
|
||||
# define FILENAME_MAX (1024+1)
|
||||
#else
|
||||
# define FILENAME_MAX (16+1)
|
||||
#endif
|
||||
|
@ -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
|
||||
@ -167,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 */
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* */
|
||||
/* stat.h */
|
||||
/* */
|
||||
/* Constants for the mode argument of open and creat */
|
||||
/* stat(2) definition */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@ -11,6 +11,9 @@
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
/* (C) 2023 Colin Leroy-Mira */
|
||||
/* EMail: colin@colino.net */
|
||||
/* */
|
||||
/* */
|
||||
/* This software is provided 'as-is', without any expressed or implied */
|
||||
/* warranty. In no event will the authors be held liable for any damages */
|
||||
@ -36,6 +39,10 @@
|
||||
#ifndef _STAT_H
|
||||
#define _STAT_H
|
||||
|
||||
#include <time.h>
|
||||
#include <target.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
@ -47,6 +54,30 @@
|
||||
#define S_IREAD 0x01
|
||||
#define S_IWRITE 0x02
|
||||
|
||||
#define S_IFMT 0x03
|
||||
|
||||
struct stat {
|
||||
dev_t st_dev;
|
||||
ino_t st_ino;
|
||||
mode_t st_mode;
|
||||
nlink_t st_nlink;
|
||||
uid_t st_uid;
|
||||
gid_t st_gid;
|
||||
off_t st_size;
|
||||
struct timespec st_atim;
|
||||
struct timespec st_ctim;
|
||||
struct timespec st_mtim;
|
||||
#ifdef __APPLE2__
|
||||
unsigned char st_access;
|
||||
unsigned char st_type;
|
||||
unsigned int st_auxtype;
|
||||
unsigned char st_storagetype;
|
||||
unsigned int st_blocks;
|
||||
struct datetime st_mtime;
|
||||
struct datetime st_ctime;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
@ -55,5 +86,9 @@
|
||||
|
||||
|
||||
|
||||
int __fastcall__ stat (const char* pathname, struct stat* statbuf);
|
||||
|
||||
|
||||
|
||||
/* End of stat.h */
|
||||
#endif
|
||||
|
@ -1,15 +1,13 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* gmtime.c */
|
||||
/* statvfs.h */
|
||||
/* */
|
||||
/* Convert calendar time into broken down time in UTC */
|
||||
/* statvfs(3) definition */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2002 Ullrich von Bassewitz */
|
||||
/* Wacholderweg 14 */
|
||||
/* D-70597 Stuttgart */
|
||||
/* EMail: uz@musoftware.de */
|
||||
/* (C) 2023 Colin Leroy-Mira */
|
||||
/* EMail: colin@colino.net */
|
||||
/* */
|
||||
/* */
|
||||
/* This software is provided 'as-is', without any expressed or implied */
|
||||
@ -33,7 +31,32 @@
|
||||
|
||||
|
||||
|
||||
#include <time.h>
|
||||
#ifndef _STATVFS_H
|
||||
#define _STATVFS_H
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
struct statvfs {
|
||||
unsigned long f_bsize;
|
||||
unsigned long f_frsize;
|
||||
fsblkcnt_t f_blocks;
|
||||
fsblkcnt_t f_bfree;
|
||||
fsblkcnt_t f_bavail;
|
||||
fsfilcnt_t f_files;
|
||||
fsfilcnt_t f_ffree;
|
||||
fsfilcnt_t f_favail;
|
||||
unsigned long f_fsid;
|
||||
unsigned long f_flag;
|
||||
unsigned long f_namemax;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -43,31 +66,9 @@
|
||||
|
||||
|
||||
|
||||
struct tm* __fastcall__ gmtime (const time_t* timep)
|
||||
{
|
||||
static struct tm timebuf;
|
||||
time_t t;
|
||||
int __fastcall__ statvfs (const char* pathname, struct statvfs* buf);
|
||||
|
||||
/* Check the argument */
|
||||
if (timep == 0 || (long) (t = *timep) < 0) {
|
||||
/* Invalid arg */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Since our ints are just 16 bits, split the given time into seconds,
|
||||
** hours and days. Each of the values will fit in a 16 bit variable.
|
||||
** The mktime routine will then do the rest.
|
||||
*/
|
||||
timebuf.tm_sec = t % 3600;
|
||||
timebuf.tm_min = 0;
|
||||
timebuf.tm_hour = (t / 3600) % 24;
|
||||
timebuf.tm_mday = (t / (3600UL * 24UL)) + 1;
|
||||
timebuf.tm_mon = 0;
|
||||
timebuf.tm_year = 70; /* Base value is 1/1/1970 */
|
||||
|
||||
/* Call mktime to do the final conversion */
|
||||
mktime (&timebuf);
|
||||
|
||||
/* Return the result */
|
||||
return &timebuf;
|
||||
}
|
||||
/* End of statvfs.h */
|
||||
#endif
|
@ -50,6 +50,46 @@
|
||||
typedef long int off_t;
|
||||
#endif
|
||||
|
||||
#ifndef _HAVE_dev_t
|
||||
#define _HAVE_dev_t
|
||||
typedef unsigned long int dev_t;
|
||||
#endif
|
||||
|
||||
#ifndef _HAVE_ino_t
|
||||
#define _HAVE_ino_t
|
||||
typedef unsigned long int ino_t;
|
||||
#endif
|
||||
|
||||
#ifndef _HAVE_nlink_t
|
||||
#define _HAVE_nlink_t
|
||||
typedef unsigned long int nlink_t;
|
||||
#endif
|
||||
|
||||
#ifndef _HAVE_uid_t
|
||||
#define _HAVE_uid_t
|
||||
typedef unsigned char uid_t;
|
||||
#endif
|
||||
|
||||
#ifndef _HAVE_gid_t
|
||||
#define _HAVE_gid_t
|
||||
typedef unsigned char gid_t;
|
||||
#endif
|
||||
|
||||
#ifndef _HAVE_mode_t
|
||||
#define _HAVE_mode_t
|
||||
typedef unsigned char mode_t;
|
||||
#endif
|
||||
|
||||
#ifndef _HAVE_fsblkcnt_t
|
||||
#define _HAVE_fsblkcnt_t
|
||||
typedef unsigned long int fsblkcnt_t;
|
||||
#endif
|
||||
|
||||
#ifndef _HAVE_fsfilcnt_t
|
||||
#define _HAVE_fsfilcnt_t
|
||||
typedef unsigned long int fsfilcnt_t;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
@ -60,6 +100,3 @@ typedef long int off_t;
|
||||
|
||||
/* End of types.h */
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
@ -37,11 +37,15 @@
|
||||
#define _TIME_H
|
||||
|
||||
|
||||
/* Forward declaration for target.h */
|
||||
typedef unsigned long time_t;
|
||||
typedef unsigned long clock_t;
|
||||
|
||||
|
||||
|
||||
/* NULL pointer */
|
||||
#ifndef _HAVE_NULL
|
||||
#define NULL 0
|
||||
#define _HAVE_NULL
|
||||
#ifndef NULL
|
||||
#define NULL ((void *) 0)
|
||||
#endif
|
||||
|
||||
/* size_t is needed */
|
||||
@ -50,9 +54,6 @@
|
||||
typedef unsigned size_t;
|
||||
#endif
|
||||
|
||||
typedef unsigned long time_t;
|
||||
typedef unsigned long clock_t;
|
||||
|
||||
/* Structure for broken down time */
|
||||
struct tm {
|
||||
int tm_sec;
|
||||
|
@ -27,17 +27,23 @@ TARGETS = apple2 \
|
||||
$(CBMS) \
|
||||
$(GEOS) \
|
||||
gamate \
|
||||
kim1 \
|
||||
lynx \
|
||||
nes \
|
||||
none \
|
||||
osic1p \
|
||||
pce \
|
||||
rp6502 \
|
||||
sim6502 \
|
||||
sim65c02 \
|
||||
supervision \
|
||||
sym1 \
|
||||
telestrat
|
||||
|
||||
TARGETTEST = none \
|
||||
sim6502 \
|
||||
sim65c02
|
||||
|
||||
DRVTYPES = emd \
|
||||
joy \
|
||||
mou \
|
||||
@ -52,7 +58,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 +86,8 @@ datadir = $(PREFIX)/share/cc65
|
||||
|
||||
all lib: $(TARGETS)
|
||||
|
||||
libtest: $(TARGETTEST)
|
||||
|
||||
mostlyclean:
|
||||
$(call RMDIR,../libwrk)
|
||||
|
||||
@ -115,13 +123,17 @@ 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 =
|
||||
CC65FLAGS = -Or -W error
|
||||
CA65FLAGS = -g
|
||||
CC65FLAGS = -g -Or -W error
|
||||
|
||||
EXTZP = cbm510 \
|
||||
cbm610 \
|
||||
@ -286,10 +298,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
|
||||
|
20
libsrc/apple2/beep.s
Normal file
20
libsrc/apple2/beep.s
Normal file
@ -0,0 +1,20 @@
|
||||
;
|
||||
; Colin Leroy-Mira, 2024
|
||||
;
|
||||
; void beep(void)
|
||||
;
|
||||
|
||||
.export _beep
|
||||
.import BELL
|
||||
|
||||
.include "apple2.inc"
|
||||
|
||||
.segment "LOWCODE"
|
||||
|
||||
_beep:
|
||||
lda CH ; Bell scrambles CH in 80col mode on IIgs, storing
|
||||
pha ; it in OURCH and resetting CH to 0. Save it.
|
||||
jsr BELL
|
||||
pla
|
||||
sta CH ; Restore CH
|
||||
rts
|
20
libsrc/apple2/bell.s
Normal file
20
libsrc/apple2/bell.s
Normal file
@ -0,0 +1,20 @@
|
||||
;
|
||||
; Colin Leroy-Mira, 2024
|
||||
;
|
||||
; BELL routine
|
||||
;
|
||||
|
||||
.export BELL
|
||||
|
||||
.include "apple2.inc"
|
||||
|
||||
.segment "LOWCODE"
|
||||
|
||||
BELL:
|
||||
; Switch in ROM and call BELL
|
||||
bit $C082
|
||||
jsr $FF3A ; BELL
|
||||
|
||||
; Switch in LC bank 2 for R/O and return
|
||||
bit $C080
|
||||
rts
|
@ -14,6 +14,8 @@
|
||||
|
||||
.include "apple2.inc"
|
||||
|
||||
.macpack cpu
|
||||
|
||||
.segment "ONCE"
|
||||
|
||||
.ifdef __APPLE2ENH__
|
||||
@ -51,8 +53,13 @@ cputdirect:
|
||||
cmp WNDWDTH
|
||||
bcc :+
|
||||
jsr newline
|
||||
left: lda #$00 ; Goto left edge of screen
|
||||
left:
|
||||
.if (.cpu .bitand CPU_ISET_65SC02)
|
||||
stz CH ; Goto left edge of screen
|
||||
.else
|
||||
lda #$00 ; Goto left edge of screen
|
||||
sta CH
|
||||
.endif
|
||||
: rts
|
||||
|
||||
newline:
|
||||
@ -78,17 +85,18 @@ mask: and INVFLG ; Apply normal, inverse, flash
|
||||
|
||||
putchardirect:
|
||||
pha
|
||||
ldy CH
|
||||
.ifdef __APPLE2ENH__
|
||||
lda CH
|
||||
bit RD80VID ; In 80 column mode?
|
||||
bpl put ; No, just go ahead
|
||||
tya
|
||||
lsr ; Div by 2
|
||||
tay
|
||||
bcs put ; Odd cols go in main memory
|
||||
bit HISCR ; Assume SET80COL
|
||||
put: tay
|
||||
.else
|
||||
ldy CH
|
||||
.endif
|
||||
put: lda (BASL),Y ; Get current character
|
||||
lda (BASL),Y ; Get current character
|
||||
tax ; Return old character for _cgetc
|
||||
pla
|
||||
sta (BASL),Y
|
||||
|
@ -40,12 +40,15 @@ _exit: ldx #<exit
|
||||
lda #>exit
|
||||
jsr reset ; Setup RESET vector
|
||||
|
||||
; Switch in ROM, in case it wasn't already switched in by a RESET.
|
||||
bit $C082
|
||||
; Switch in LC bank 2 for R/O in case it was switched out by a RESET.
|
||||
bit $C080
|
||||
|
||||
; Call the module destructors.
|
||||
jsr donelib
|
||||
|
||||
; Switch in ROM.
|
||||
bit $C082
|
||||
|
||||
; Restore the original RESET vector.
|
||||
exit: ldx #$02
|
||||
: lda rvsave,x
|
||||
|
17
libsrc/apple2/detect_iigs.s
Normal file
17
libsrc/apple2/detect_iigs.s
Normal file
@ -0,0 +1,17 @@
|
||||
;
|
||||
; Colin Leroy-Mira <colin@colino.net>, 2024
|
||||
;
|
||||
; void __fastcall__ detect_iigs(void)
|
||||
;
|
||||
|
||||
.export _detect_iigs
|
||||
.import ostype, return0, return1
|
||||
|
||||
.include "apple2.inc"
|
||||
|
||||
; Returns 1 if running on IIgs, 0 otherwise
|
||||
_detect_iigs:
|
||||
lda ostype
|
||||
bpl :+
|
||||
jmp return1
|
||||
: jmp return0
|
@ -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
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user