Merge branch 'cc65:master' into master
This commit is contained in:
16
.github/checks/Makefile
vendored
16
.github/checks/Makefile
vendored
@@ -5,14 +5,18 @@ endif
|
||||
|
||||
ifdef CMD_EXE
|
||||
|
||||
.PHONY: checkstyle
|
||||
.PHONY: checkstyle sorted
|
||||
|
||||
checkstyle:
|
||||
$(info INFO: style checks require bash.)
|
||||
sorted:
|
||||
$(info INFO: table checks require bash.)
|
||||
|
||||
else
|
||||
|
||||
.PHONY: checkstyle lineendings tabs lastline spaces noexec
|
||||
.PHONY: checkstyle lineendings tabs lastline spaces noexec sorted
|
||||
|
||||
all: checkstyle sorted
|
||||
|
||||
checkstyle: lineendings tabs lastline spaces noexec
|
||||
|
||||
@@ -31,4 +35,12 @@ spaces: spaces.sh
|
||||
noexec: noexec.sh
|
||||
@./noexec.sh
|
||||
|
||||
sorted: sorted.sh sorted_codeopt.sh sorted_opcodes.sh
|
||||
@./sorted.sh
|
||||
@./sorted_codeopt.sh
|
||||
@./sorted_opcodes.sh
|
||||
|
||||
checksp: checksp.sh
|
||||
@./checksp.sh
|
||||
|
||||
endif
|
||||
|
||||
22
.github/checks/checksp.sh
vendored
Executable file
22
.github/checks/checksp.sh
vendored
Executable file
@@ -0,0 +1,22 @@
|
||||
#! /bin/bash
|
||||
OD65_EXE=../bin/od65
|
||||
CHECK_PATH=../../libwrk
|
||||
|
||||
cd "${CHECK_PATH}" || {
|
||||
echo "error: Directory ${CHECK_PATH} doesn't seem to exist" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ -x "${OD65_EXE}" ] || {
|
||||
echo "error: This check requires the od65 executable to be built" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
EXITCODE=0
|
||||
find . -name \*.o -print | while read OBJ; do
|
||||
"${OD65_EXE}" --dump-imports "${OBJ}" | grep -q "\"sp\"" && {
|
||||
echo "error: Usage of symbol 'sp' found in module ${OBJ}" >&2
|
||||
EXITCODE=1
|
||||
}
|
||||
done
|
||||
exit ${EXITCODE}
|
||||
1
.github/checks/lastline.sh
vendored
1
.github/checks/lastline.sh
vendored
@@ -23,3 +23,4 @@ if [ x"$FILES"x != xx ]; then
|
||||
done
|
||||
exit -1
|
||||
fi
|
||||
exit 0
|
||||
|
||||
1
.github/checks/lineendings.sh
vendored
1
.github/checks/lineendings.sh
vendored
@@ -16,3 +16,4 @@ if [ x"$FILES"x != xx ]; then
|
||||
done
|
||||
exit -1
|
||||
fi
|
||||
exit 0
|
||||
|
||||
1
.github/checks/noexec.sh
vendored
1
.github/checks/noexec.sh
vendored
@@ -16,3 +16,4 @@ if [ x"$FILES"x != xx ]; then
|
||||
done
|
||||
exit -1
|
||||
fi
|
||||
exit 0
|
||||
|
||||
39
.github/checks/sorted.sh
vendored
Executable file
39
.github/checks/sorted.sh
vendored
Executable file
@@ -0,0 +1,39 @@
|
||||
#! /bin/bash
|
||||
OLDCWD=`pwd`
|
||||
SCRIPT_PATH=`dirname $0`
|
||||
|
||||
CHECK_DIR=../../src
|
||||
|
||||
SORT_OPT="-u -c"
|
||||
|
||||
# $1: filename
|
||||
function checkarray_quoted_name
|
||||
{
|
||||
CHECK_FILE="$1"
|
||||
START="\\/\\* BEGIN SORTED.SH \\*\\/"
|
||||
END="\\/\\* END SORTED.SH \\*\\/"
|
||||
|
||||
awk '/'"$START"'/{flag=1; count++; next} /'"$END"'/{flag=0;} flag {printf("%04d##%s\n", count, $0)}' "$CHECK_FILE" | \
|
||||
sed -e 's:\(.*\)##.*\"\(.*\)\".*:\1##\2:g' > .a.tmp
|
||||
|
||||
if [[ -z $(grep '[^[:space:]]' .a.tmp) ]] ; then
|
||||
echo "error: "$1" table is empty"
|
||||
rm -rf .a.tmp
|
||||
exit -1
|
||||
fi
|
||||
|
||||
if `LC_COLLATE=C sort $SORT_OPT .a.tmp`; then
|
||||
echo ""$1" tables OK"
|
||||
else
|
||||
echo "error: "$1" tables are not sorted."
|
||||
rm -rf .a.tmp
|
||||
exit -1
|
||||
fi
|
||||
rm -rf .a.tmp
|
||||
}
|
||||
|
||||
|
||||
for N in `grep -rl "BEGIN SORTED.SH" "$CHECK_DIR"`; do
|
||||
checkarray_quoted_name $N
|
||||
done
|
||||
exit 0
|
||||
69
.github/checks/sorted_codeopt.sh
vendored
Executable file
69
.github/checks/sorted_codeopt.sh
vendored
Executable file
@@ -0,0 +1,69 @@
|
||||
#! /bin/bash
|
||||
OLDCWD=`pwd`
|
||||
SCRIPT_PATH=`dirname $0`
|
||||
|
||||
CHECK_DIR=../../src
|
||||
|
||||
SORT_OPT="-u -c"
|
||||
|
||||
# $1: filename
|
||||
function checkarray
|
||||
{
|
||||
CHECK_FILE="$1"
|
||||
START="\\/\\* BEGIN DECL SORTED_CODEOPT.SH \\*\\/"
|
||||
END="\\/\\* END DECL SORTED_CODEOPT.SH \\*\\/"
|
||||
|
||||
awk '/'"$START"'/{flag=1; count++; next} /'"$END"'/{flag=0;} flag {printf("%04d##%s\n", count, $0)}' "$CHECK_FILE" | \
|
||||
sed -e 's:\(.*##\).*"\(.*\)",.*:\1\2:g' > .a.tmp
|
||||
|
||||
if [[ -z $(grep '[^[:space:]]' .a.tmp) ]] ; then
|
||||
echo "error: "$1" table is empty"
|
||||
rm -rf .a.tmp
|
||||
exit -1
|
||||
fi
|
||||
|
||||
if `LC_COLLATE=C sort $SORT_OPT .a.tmp`; then
|
||||
echo ""$1" decls sorted."
|
||||
else
|
||||
echo "error: "$1" decls are not sorted."
|
||||
rm -rf .a.tmp
|
||||
exit -1
|
||||
fi
|
||||
|
||||
START="\\/\\* BEGIN SORTED_CODEOPT.SH \\*\\/"
|
||||
END="\\/\\* END SORTED_CODEOPT.SH \\*\\/"
|
||||
|
||||
awk '/'"$START"'/{flag=1; count++; next} /'"$END"'/{flag=0;} flag {printf("%04d##%s\n", count, $0)}' "$CHECK_FILE" | \
|
||||
sed -e 's:\(.*##\).*&D\(.*\),.*:\1\2:g' > .b.tmp
|
||||
|
||||
if [[ -z $(grep '[^[:space:]]' .b.tmp) ]] ; then
|
||||
echo "error: "$1" table is empty"
|
||||
rm -rf .a.tmp .b.tmp
|
||||
exit -1
|
||||
fi
|
||||
|
||||
if `LC_COLLATE=C sort $SORT_OPT .b.tmp`; then
|
||||
echo ""$1" tables sorted."
|
||||
else
|
||||
echo "error: "$1" tables are not sorted."
|
||||
rm -rf .a.tmp .b.tmp
|
||||
exit -1
|
||||
fi
|
||||
|
||||
if cmp --silent -- .a.tmp .b.tmp; then
|
||||
echo ""$1" tables OK"
|
||||
else
|
||||
echo "error: "$1" tables are different."
|
||||
diff -y .a.tmp .b.tmp
|
||||
rm -rf .a.tmp .b.tmp
|
||||
exit -1
|
||||
fi
|
||||
|
||||
rm -rf .a.tmp .b.tmp
|
||||
}
|
||||
|
||||
|
||||
find "$CHECK_DIR" -name \*.\[ch\] -print | while read N; do
|
||||
grep -q "BEGIN DECL SORTED_CODEOPT.SH" "$N" && checkarray $N
|
||||
done
|
||||
exit 0
|
||||
40
.github/checks/sorted_opcodes.sh
vendored
Executable file
40
.github/checks/sorted_opcodes.sh
vendored
Executable file
@@ -0,0 +1,40 @@
|
||||
#! /bin/bash
|
||||
OLDCWD=`pwd`
|
||||
SCRIPT_PATH=`dirname $0`
|
||||
|
||||
CHECK_DIR=../../src
|
||||
|
||||
SORT_OPT="-u -c"
|
||||
|
||||
# $1: filename
|
||||
function checkarray_quoted_name
|
||||
{
|
||||
CHECK_FILE="$1"
|
||||
START="\\/\\* BEGIN SORTED_OPCODES.SH \\*\\/"
|
||||
END="\\/\\* END SORTED_OPCODES.SH \\*\\/"
|
||||
|
||||
awk '/'"$START"'/{flag=1; count++; next} /'"$END"'/{flag=0;} flag {printf("%04d##%s\n", count, $0)}' "$CHECK_FILE" | \
|
||||
sed 's:/\*.*::g' | \
|
||||
grep '".*",' | \
|
||||
sed -e 's:\(.*\)##.*\"\(.*\)\".*:\1##\2:g' > .a.tmp
|
||||
|
||||
if [[ -z $(grep '[^[:space:]]' .a.tmp) ]] ; then
|
||||
echo "error: "$1" table is empty"
|
||||
rm -rf .a.tmp
|
||||
exit -1
|
||||
fi
|
||||
|
||||
if `LC_COLLATE=C sort $SORT_OPT .a.tmp`; then
|
||||
echo ""$1" tables OK"
|
||||
else
|
||||
echo "error: "$1" tables are not sorted."
|
||||
rm -rf .a.tmp
|
||||
exit -1
|
||||
fi
|
||||
rm -rf .a.tmp
|
||||
}
|
||||
|
||||
for N in `grep -rl "BEGIN SORTED_OPCODES.SH" "$CHECK_DIR"`; do
|
||||
checkarray_quoted_name $N
|
||||
done
|
||||
exit 0
|
||||
1
.github/checks/spaces.sh
vendored
1
.github/checks/spaces.sh
vendored
@@ -16,3 +16,4 @@ if [ x"$FILES"x != xx ]; then
|
||||
done
|
||||
exit -1
|
||||
fi
|
||||
exit 0
|
||||
|
||||
1
.github/checks/tabs.sh
vendored
1
.github/checks/tabs.sh
vendored
@@ -16,3 +16,4 @@ if [ x"$FILES"x != xx ]; then
|
||||
done
|
||||
exit -1
|
||||
fi
|
||||
exit 0
|
||||
|
||||
25
.github/workflows/build-on-pull-request.yml
vendored
25
.github/workflows/build-on-pull-request.yml
vendored
@@ -24,25 +24,34 @@ jobs:
|
||||
- name: Do some simple style checks
|
||||
shell: bash
|
||||
run: make -j2 checkstyle
|
||||
- name: Check bsearch tables
|
||||
shell: bash
|
||||
run: make -j2 sorted
|
||||
- name: Build the tools.
|
||||
shell: bash
|
||||
run: make -j2 bin USER_CFLAGS=-Werror
|
||||
run: make -j2 bin USER_CFLAGS=-Werror QUIET=1
|
||||
- name: Build the dbginfo example
|
||||
shell: bash
|
||||
run: make -j2 -C src test QUIET=1
|
||||
- name: Build the utilities.
|
||||
shell: bash
|
||||
run: make -j2 util
|
||||
run: make -j2 util QUIET=1
|
||||
- name: Build the platform libraries.
|
||||
shell: bash
|
||||
run: make -j2 lib QUIET=1
|
||||
- name: check test that no modules use sp
|
||||
shell: bash
|
||||
run: make -j2 checksp QUIET=1
|
||||
- name: Run the regression tests.
|
||||
shell: bash
|
||||
run: make -j2 test QUIET=1
|
||||
- name: Test that the samples can be built.
|
||||
run: make -C samples platforms
|
||||
run: make -C samples platforms QUIET=1
|
||||
- name: Test that the targettest programs can be built.
|
||||
run: make -C targettest platforms
|
||||
run: make -C targettest platforms QUIET=1
|
||||
- name: Build the document files.
|
||||
shell: bash
|
||||
run: make -j2 doc
|
||||
run: make -j2 doc QUIET=1
|
||||
- name: Upload a documents snapshot.
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
@@ -50,8 +59,8 @@ jobs:
|
||||
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-
|
||||
make -C src clean QUIET=1
|
||||
make -j2 bin QUIET=1 USER_CFLAGS=-Werror CROSS_COMPILE=x86_64-w64-mingw32-
|
||||
|
||||
build_windows:
|
||||
name: Build and Test (Windows)
|
||||
@@ -81,7 +90,7 @@ jobs:
|
||||
|
||||
- name: Build utils (MinGW)
|
||||
shell: cmd
|
||||
run: make -j2 util SHELL=cmd
|
||||
run: make -j2 util QUIET=1 SHELL=cmd
|
||||
|
||||
- name: Build the platform libraries (make lib)
|
||||
shell: cmd
|
||||
|
||||
23
.github/workflows/snapshot-on-push-master.yml
vendored
23
.github/workflows/snapshot-on-push-master.yml
vendored
@@ -49,11 +49,14 @@ jobs:
|
||||
- name: Do some simple style checks
|
||||
shell: bash
|
||||
run: make -j2 checkstyle
|
||||
- name: Check bsearch tables
|
||||
shell: bash
|
||||
run: make -j2 sorted
|
||||
- name: Build the tools.
|
||||
shell: bash
|
||||
run: |
|
||||
make -j2 bin USER_CFLAGS=-Werror
|
||||
make -j2 util
|
||||
make -j2 bin USER_CFLAGS=-Werror QUIET=1
|
||||
make -j2 util QUIET=1
|
||||
- name: Build the platform libraries.
|
||||
shell: bash
|
||||
run: make -j2 lib QUIET=1
|
||||
@@ -62,26 +65,26 @@ jobs:
|
||||
run: make -j2 test QUIET=1
|
||||
- name: Test that the samples can be built.
|
||||
shell: bash
|
||||
run: make -j2 samples
|
||||
run: make -j2 samples QUIET=1
|
||||
- name: Remove the output from the samples tests.
|
||||
shell: bash
|
||||
run: make -C samples clean
|
||||
run: make -C samples clean QUIET=1
|
||||
- name: Remove programs in util directory
|
||||
shell: bash
|
||||
run: make -C util clean
|
||||
run: make -C util clean QUIET=1
|
||||
- name: Build the document files.
|
||||
shell: bash
|
||||
run: make -j2 doc
|
||||
run: make -j2 doc QUIET=1
|
||||
- name: Build and package 64-bit Windows versions of the tools.
|
||||
run: |
|
||||
make -C src clean
|
||||
make -j2 bin USER_CFLAGS=-Werror CROSS_COMPILE=x86_64-w64-mingw32-
|
||||
make -C src clean QUIET=1
|
||||
make -j2 bin QUIET=1 USER_CFLAGS=-Werror CROSS_COMPILE=x86_64-w64-mingw32-
|
||||
make zip
|
||||
mv cc65.zip cc65-snapshot-win64.zip
|
||||
- name: Build and package 32-bit Windows versions of the tools.
|
||||
run: |
|
||||
make -C src clean
|
||||
make -j2 bin USER_CFLAGS=-Werror CROSS_COMPILE=i686-w64-mingw32-
|
||||
make -C src clean QUIET=1
|
||||
make -j2 bin USER_CFLAGS=-Werror QUIET=1 CROSS_COMPILE=i686-w64-mingw32-
|
||||
make zip
|
||||
mv cc65.zip cc65-snapshot-win32.zip
|
||||
|
||||
|
||||
8
.github/workflows/windows-test-scheduled.yml
vendored
8
.github/workflows/windows-test-scheduled.yml
vendored
@@ -60,19 +60,19 @@ jobs:
|
||||
- name: Build utils (MinGW)
|
||||
if: steps.check-sha.outputs.cache-hit != 'true'
|
||||
shell: cmd
|
||||
run: make -j2 util SHELL=cmd
|
||||
run: make -j2 util SHELL=cmd QUIET=1
|
||||
|
||||
- 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
|
||||
run: make -j2 lib QUIET=1 SHELL=cmd QUIET=1
|
||||
|
||||
- name: Run the regression tests (make test)
|
||||
if: steps.check-sha.outputs.cache-hit != 'true'
|
||||
shell: cmd
|
||||
run: make -j2 test QUIET=1 SHELL=cmd
|
||||
run: make -j2 test QUIET=1 SHELL=cmd QUIET=1
|
||||
|
||||
- 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
|
||||
run: make -j2 samples SHELL=cmd QUIET=1
|
||||
|
||||
53
Makefile
53
Makefile
@@ -1,8 +1,32 @@
|
||||
.PHONY: all mostlyclean clean install zip avail unavail bin lib doc html info samples test util checkstyle check
|
||||
# ---- Display info during parsing phase ----
|
||||
SILENT:=$(findstring s,$(word 1, $(MAKEFLAGS)))
|
||||
ifneq ($(SILENT),s)
|
||||
$(info Using Makefile: $(realpath $(firstword $(MAKEFILE_LIST))) $(MAKECMDGOALS))
|
||||
endif
|
||||
|
||||
.PHONY: all mostlyclean clean install zip avail unavail bin lib doc html info samples test util checkstyle check checkprefix
|
||||
|
||||
.SUFFIXES:
|
||||
|
||||
all install zip:
|
||||
all:
|
||||
@$(MAKE) -C src --no-print-directory $@
|
||||
@$(MAKE) -C libsrc --no-print-directory $@
|
||||
@$(MAKE) -C doc --no-print-directory $@
|
||||
@$(MAKE) -C util --no-print-directory $@
|
||||
@$(MAKE) -C samples --no-print-directory $@
|
||||
@$(MAKE) checkprefix --no-print-directory
|
||||
|
||||
zip:
|
||||
@$(MAKE) -C src --no-print-directory $@
|
||||
@$(MAKE) -C libsrc --no-print-directory $@
|
||||
@$(MAKE) -C doc --no-print-directory $@
|
||||
@$(MAKE) -C util --no-print-directory $@
|
||||
@$(MAKE) -C samples --no-print-directory $@
|
||||
|
||||
install:
|
||||
ifndef PREFIX
|
||||
$(error Error: PREFIX must be set for install to work)
|
||||
endif
|
||||
@$(MAKE) -C src --no-print-directory $@
|
||||
@$(MAKE) -C libsrc --no-print-directory $@
|
||||
@$(MAKE) -C doc --no-print-directory $@
|
||||
@@ -18,9 +42,17 @@ mostlyclean clean:
|
||||
@$(MAKE) -C test --no-print-directory $@
|
||||
@$(MAKE) -C targettest --no-print-directory $@
|
||||
|
||||
avail unavail bin:
|
||||
avail unavail:
|
||||
# FIXME: actually not true, PREFIX is ignored?
|
||||
#ifndef PREFIX
|
||||
# $(error Error: PREFIX must be set for avail/unavail to work)
|
||||
#endif
|
||||
@$(MAKE) -C src --no-print-directory $@
|
||||
|
||||
bin:
|
||||
@$(MAKE) -C src --no-print-directory $@
|
||||
@$(MAKE) checkprefix --no-print-directory
|
||||
|
||||
lib libtest:
|
||||
@$(MAKE) -C libsrc --no-print-directory $@
|
||||
|
||||
@@ -39,10 +71,23 @@ util:
|
||||
%:
|
||||
@$(MAKE) -C libsrc --no-print-directory $@
|
||||
|
||||
checkprefix:
|
||||
ifndef PREFIX
|
||||
$(warning Warning: PREFIX is empty - make install will not work)
|
||||
endif
|
||||
|
||||
# check the code style
|
||||
checkstyle:
|
||||
@$(MAKE) -C .github/checks --no-print-directory $@
|
||||
|
||||
# check bsearch tables
|
||||
sorted:
|
||||
@$(MAKE) -C .github/checks --no-print-directory $@
|
||||
|
||||
# check that no modules use "sp", requires the binaries to be built first
|
||||
checksp:
|
||||
@$(MAKE) -C .github/checks --no-print-directory $@
|
||||
|
||||
# runs regression tests, requires libtest target libraries
|
||||
test:
|
||||
@$(MAKE) -C test --no-print-directory $@
|
||||
@@ -50,6 +95,8 @@ test:
|
||||
# GNU "check" target, which runs all tests
|
||||
check:
|
||||
@$(MAKE) -C .github/checks checkstyle --no-print-directory
|
||||
@$(MAKE) -C .github/checks sorted --no-print-directory
|
||||
@$(MAKE) -C src test --no-print-directory
|
||||
@$(MAKE) test
|
||||
@$(MAKE) -C targettest platforms --no-print-directory
|
||||
@$(MAKE) -C samples platforms --no-print-directory
|
||||
|
||||
@@ -39,6 +39,7 @@ the [cc65 web site](https://cc65.github.io):
|
||||
| Dr. Jozo Dujmović | Picocomputer (RP6502) |
|
||||
| Watara | Watura/QuickShot Supervision |
|
||||
| Synertek | SYM-1 |
|
||||
| USSR | Agat-7/9 |
|
||||
|
||||
A generic configuration to adapt cc65 to new targets is also around.
|
||||
|
||||
|
||||
39
asminc/agat.inc
Normal file
39
asminc/agat.inc
Normal file
@@ -0,0 +1,39 @@
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Zero page stuff
|
||||
|
||||
WNDLFT := $20 ; Text window left
|
||||
WNDWDTH := $21 ; Text window width
|
||||
WNDTOP := $22 ; Text window top
|
||||
WNDBTM := $23 ; Text window bottom+1
|
||||
CH := $24 ; Cursor horizontal position
|
||||
CV := $25 ; Cursor vertical position
|
||||
BASL := $28 ; Text base address low
|
||||
BASH := $29 ; Text base address high
|
||||
CURSOR := $2D ; Cursor character
|
||||
TATTR := $32 ; Text attributes
|
||||
PROMPT := $33 ; Used by GETLN
|
||||
VCOUT := $36 ; COUT Subroutine Vector
|
||||
VCIN := $38 ; CIN Subroutine Vector
|
||||
RNDL := $4E ; Random counter low
|
||||
RNDH := $4F ; Random counter high
|
||||
HIMEM := $73 ; Highest available memory address+1
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Vectors
|
||||
|
||||
DOSWARM := $03D0 ; DOS warmstart vector
|
||||
BRKVec := $03F0 ; Break vector
|
||||
SOFTEV := $03F2 ; Vector for warm start
|
||||
PWREDUP := $03F4 ; This must be = EOR #$A5 of SOFTEV+1
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Hardware
|
||||
|
||||
; Keyboard input
|
||||
KBD := $C000 ; Read keyboard
|
||||
KBDSTRB := $C010 ; Clear keyboard strobe
|
||||
|
||||
; Game controller
|
||||
BUTN0 := $C061 ; Open-Apple Key
|
||||
BUTN1 := $C062 ; Closed-Apple Key
|
||||
@@ -24,6 +24,8 @@ DOSWARM := $03D0 ; DOS warmstart vector
|
||||
BRKVec := $03F0 ; Break vector
|
||||
SOFTEV := $03F2 ; Vector for warm start
|
||||
PWREDUP := $03F4 ; This must be = EOR #$A5 of SOFTEV+1
|
||||
ROM_RST := $FFFC ; 6502 reset vector
|
||||
ROM_IRQ := $FFFE ; 6502 IRQ vector
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; 80 column firmware
|
||||
|
||||
239
asminc/c65.inc
Normal file
239
asminc/c65.inc
Normal file
@@ -0,0 +1,239 @@
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Zero page, Commodore stuff
|
||||
|
||||
TXTPTR := $3C ; Pointer into BASIC source code
|
||||
STATUS := $90 ; Kernal I/O completion status
|
||||
FNAM_LEN := $B7 ; Length of filename
|
||||
SECADR := $B9 ; Secondary address
|
||||
DEVNUM := $BA ; Device number
|
||||
FNAM := $BB ; Address of filename
|
||||
FNAM_BANK := $BE ; Bank for filename
|
||||
KEY_COUNT := $D0 ; Number of keys in input buffer
|
||||
FKEY_COUNT := $D1 ; Characters for function key
|
||||
MODE := $D7 ; 40-/80-column mode (bit 7: 80 columns)
|
||||
GRAPHM := $D8 ; Graphics mode flags (bits 5-7)
|
||||
CHARDIS := $D9 ; Bit 2 shadow for location $01
|
||||
CURS_X := $EC ; Cursor column
|
||||
CURS_Y := $EB ; Cursor row
|
||||
SCREEN_PTR := $E0 ; Pointer to current char in text screen
|
||||
CRAM_PTR := $E2 ; Pointer to current char in color RAM
|
||||
CHARCOLOR := $F1
|
||||
RVS := $F3 ; Reverse output flag
|
||||
SCROLL := $F8 ; Disable scrolling flag
|
||||
|
||||
BASIC_BUF := $0200 ; Location of command-line
|
||||
BASIC_BUF_LEN = 161 ; Maximum length of command-line
|
||||
|
||||
FKEY_LEN := $1000 ; Function key lengths
|
||||
FKEY_TEXT := $100A ; Function key texts
|
||||
|
||||
PALFLAG := $1103 ; $FF=PAL, $00=NTSC
|
||||
INIT_STATUS := $1104 ; Flags: Reset/Restore initiation status
|
||||
TIME := $110C ; 60HZ clock
|
||||
|
||||
KBDREPEAT := $111a
|
||||
KBDREPEATRATE := $111b
|
||||
KBDREPEATDELAY := $111c
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Vectors
|
||||
|
||||
IRQVec := $0314
|
||||
BRKVec := $0316
|
||||
NMIVec := $0318
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; I/O: VIC
|
||||
|
||||
VIC := $D000
|
||||
VIC_SPR0_X := $D000
|
||||
VIC_SPR0_Y := $D001
|
||||
VIC_SPR1_X := $D002
|
||||
VIC_SPR1_Y := $D003
|
||||
VIC_SPR2_X := $D004
|
||||
VIC_SPR2_Y := $D005
|
||||
VIC_SPR3_X := $D006
|
||||
VIC_SPR3_Y := $D007
|
||||
VIC_SPR4_X := $D008
|
||||
VIC_SPR4_Y := $D009
|
||||
VIC_SPR5_X := $D00A
|
||||
VIC_SPR5_Y := $D00B
|
||||
VIC_SPR6_X := $D00C
|
||||
VIC_SPR6_Y := $D00D
|
||||
VIC_SPR7_X := $D00E
|
||||
VIC_SPR7_Y := $D00F
|
||||
VIC_SPR_HI_X := $D010
|
||||
VIC_SPR_ENA := $D015
|
||||
VIC_SPR_EXP_Y := $D017
|
||||
VIC_SPR_EXP_X := $D01D
|
||||
VIC_SPR_MCOLOR := $D01C
|
||||
VIC_SPR_BG_PRIO := $D01B
|
||||
VIC_SPR_COLL := $D01E
|
||||
VIC_SPR_BG_COLL := $D01F
|
||||
|
||||
VIC_SPR_MCOLOR0 := $D025
|
||||
VIC_SPR_MCOLOR1 := $D026
|
||||
|
||||
VIC_SPR0_COLOR := $D027
|
||||
VIC_SPR1_COLOR := $D028
|
||||
VIC_SPR2_COLOR := $D029
|
||||
VIC_SPR3_COLOR := $D02A
|
||||
VIC_SPR4_COLOR := $D02B
|
||||
VIC_SPR5_COLOR := $D02C
|
||||
VIC_SPR6_COLOR := $D02D
|
||||
VIC_SPR7_COLOR := $D02E
|
||||
|
||||
VIC_CTRL1 := $D011
|
||||
VIC_CTRL2 := $D016
|
||||
|
||||
VIC_HLINE := $D012
|
||||
|
||||
VIC_LPEN_X := $D013
|
||||
VIC_LPEN_Y := $D014
|
||||
|
||||
VIC_VIDEO_ADR := $D018
|
||||
|
||||
VIC_IRR := $D019 ; Interrupt request register
|
||||
VIC_IMR := $D01A ; Interrupt mask register
|
||||
|
||||
VIC_BORDERCOLOR := $D020
|
||||
VIC_BG_COLOR0 := $D021
|
||||
VIC_BG_COLOR1 := $D022
|
||||
VIC_BG_COLOR2 := $D023
|
||||
VIC_BG_COLOR3 := $D024
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; I/O: FDC
|
||||
|
||||
FDC := $D080
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; I/O: SID
|
||||
|
||||
SID1 := $D400
|
||||
SID1_S1Lo := $D400
|
||||
SID1_S1Hi := $D401
|
||||
SID1_PB1Lo := $D402
|
||||
SID1_PB1Hi := $D403
|
||||
SID1_Ctl1 := $D404
|
||||
SID1_AD1 := $D405
|
||||
SID1_SUR1 := $D406
|
||||
|
||||
SID1_S2Lo := $D407
|
||||
SID1_S2Hi := $D408
|
||||
SID1_PB2Lo := $D409
|
||||
SID1_PB2Hi := $D40A
|
||||
SID1_Ctl2 := $D40B
|
||||
SID1_AD2 := $D40C
|
||||
SID1_SUR2 := $D40D
|
||||
|
||||
SID1_S3Lo := $D40E
|
||||
SID1_S3Hi := $D40F
|
||||
SID1_PB3Lo := $D410
|
||||
SID1_PB3Hi := $D411
|
||||
SID1_Ctl3 := $D412
|
||||
SID1_AD3 := $D413
|
||||
SID1_SUR3 := $D414
|
||||
|
||||
SID1_FltLo := $D415
|
||||
SID1_FltHi := $D416
|
||||
SID1_FltCtl := $D417
|
||||
SID1_Amp := $D418
|
||||
SID1_ADConv1 := $D419
|
||||
SID1_ADConv2 := $D41A
|
||||
SID1_Noise := $D41B
|
||||
SID1_Read3 := $D41C
|
||||
|
||||
SID2 := $D420
|
||||
SID2_S1Lo := $D420
|
||||
SID2_S1Hi := $D421
|
||||
SID2_PB1Lo := $D422
|
||||
SID2_PB1Hi := $D423
|
||||
SID2_Ctl1 := $D424
|
||||
SID2_AD1 := $D425
|
||||
SID2_SUR1 := $D426
|
||||
|
||||
SID2_S2Lo := $D427
|
||||
SID2_S2Hi := $D428
|
||||
SID2_PB2Lo := $D429
|
||||
SID2_PB2Hi := $D42A
|
||||
SID2_Ctl2 := $D42B
|
||||
SID2_AD2 := $D42C
|
||||
SID2_SUR2 := $D42D
|
||||
|
||||
SID2_S3Lo := $D42E
|
||||
SID2_S3Hi := $D42F
|
||||
SID2_PB3Lo := $D430
|
||||
SID2_PB3Hi := $D431
|
||||
SID2_Ctl3 := $D432
|
||||
SID2_AD3 := $D433
|
||||
SID2_SUR3 := $D434
|
||||
|
||||
SID2_FltLo := $D435
|
||||
SID2_FltHi := $D436
|
||||
SID2_FltCtl := $D437
|
||||
SID2_Amp := $D438
|
||||
SID2_ADConv1 := $D439
|
||||
SID2_ADConv2 := $D43A
|
||||
SID2_Noise := $D43B
|
||||
SID2_Read3 := $D43C
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; I/O: Complex Interface Adapters
|
||||
|
||||
CIA1 := $DC00
|
||||
CIA1_PRA := $DC00 ; Port A
|
||||
CIA1_PRB := $DC01 ; Port B
|
||||
CIA1_DDRA := $DC02 ; Data direction register for port A
|
||||
CIA1_DDRB := $DC03 ; Data direction register for port B
|
||||
CIA1_TA := $DC04 ; 16-bit timer A
|
||||
CIA1_TB := $DC06 ; 16-bit timer B
|
||||
CIA1_TOD10 := $DC08 ; Time-of-day tenths of a second
|
||||
CIA1_TODSEC := $DC09 ; Time-of-day seconds
|
||||
CIA1_TODMIN := $DC0A ; Time-of-day minutes
|
||||
CIA1_TODHR := $DC0B ; Time-of-day hours
|
||||
CIA1_SDR := $DC0C ; Serial data register
|
||||
CIA1_ICR := $DC0D ; Interrupt control register
|
||||
CIA1_CRA := $DC0E ; Control register for timer A
|
||||
CIA1_CRB := $DC0F ; Control register for timer B
|
||||
|
||||
CIA2 := $DD00
|
||||
CIA2_PRA := $DD00
|
||||
CIA2_PRB := $DD01
|
||||
CIA2_DDRA := $DD02
|
||||
CIA2_DDRB := $DD03
|
||||
CIA2_TA := $DD04
|
||||
CIA2_TB := $DD06
|
||||
CIA2_TOD10 := $DD08
|
||||
CIA2_TODSEC := $DD09
|
||||
CIA2_TODMIN := $DD0A
|
||||
CIA2_TODHR := $DD0B
|
||||
CIA2_SDR := $DD0C
|
||||
CIA2_ICR := $DD0D
|
||||
CIA2_CRA := $DD0E
|
||||
CIA2_CRB := $DD0F
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; I/O: DMA
|
||||
|
||||
DMA := $D700
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Processor Port at $01
|
||||
|
||||
LORAM = $01 ; Enable the basic rom
|
||||
HIRAM = $02 ; Enable the kernal rom
|
||||
IOEN = $04 ; Enable I/O
|
||||
CASSDATA = $08 ; Cassette data
|
||||
CASSPLAY = $10 ; Cassette: Play
|
||||
CASSMOT = $20 ; Cassette motor on
|
||||
TP_FAST = $80 ; Switch Rossmoeller TurboProcess to fast mode
|
||||
|
||||
RAMONLY = $F8 ; (~(LORAM | HIRAM | IOEN)) & $FF
|
||||
|
||||
; temporary, to get conio working
|
||||
XSIZE = 80
|
||||
YSIZE = 50
|
||||
@@ -63,6 +63,43 @@
|
||||
MOUSE_GET := $FF6B
|
||||
.endif
|
||||
|
||||
.if .def (__MEGA65__)
|
||||
; extended C65 jump table
|
||||
|
||||
; memory before $ff3b is all $ff in mega65 ROM?
|
||||
; VERSIONQ := $FF2F
|
||||
; RESET_RUN := $FF32
|
||||
; CURSOR := $FF35
|
||||
|
||||
SAVEFL := $FF3B
|
||||
GETIO := $FF41
|
||||
GETLFS := $FF44
|
||||
KEYLOCKS := $FF47
|
||||
ADDKEY := $FF4A
|
||||
.endif
|
||||
|
||||
.if .def(__C65__) || .def (__MEGA65__)
|
||||
CURSOR := $E030 ; in editor ROM
|
||||
|
||||
SPIN_SPOUT := $FF4D
|
||||
CLSALL := $FF50
|
||||
C64MODE := $FF53
|
||||
MonitorCall := $FF56
|
||||
BOOT_SYS := $FF59
|
||||
PHOENIX := $FF5C
|
||||
LKUPLA := $FF5F
|
||||
LKUPSA := $FF62
|
||||
SWAPPER := $FF65
|
||||
PFKEY := $FF68
|
||||
SETBNK := $FF6B
|
||||
JSRFAR := $FF6E
|
||||
JMPFAR := $FF71
|
||||
LDA_FAR := $FF74
|
||||
STA_FAR := $FF77
|
||||
CMP_FAR := $FF7A
|
||||
PRIMM := $FF7D
|
||||
.endif
|
||||
|
||||
.if .def(__C128__)
|
||||
; C128 extended jump table
|
||||
C64MODE := $FF4D
|
||||
@@ -83,7 +120,7 @@
|
||||
PRIMM := $FF7D
|
||||
.endif
|
||||
|
||||
.if .def(__C64__) || .def(__C128__) || .def(__C16__) || .def(__CX16__)
|
||||
.if .def(__C64__) || .def(__C128__) || .def(__C16__) || .def(__CX16__) || .def(__C65__) || .def (__MEGA65__)
|
||||
CINT := $FF81
|
||||
IOINIT := $FF84
|
||||
RAMTAS := $FF87
|
||||
@@ -96,7 +133,7 @@
|
||||
CINT := $FF7E
|
||||
.endif
|
||||
|
||||
.if .def(__VIC20__) || .def(__C64__) || .def(__C128__) || .def(__C16__) || .def(__CX16__)
|
||||
.if .def(__VIC20__) || .def(__C64__) || .def(__C128__) || .def(__C16__) || .def(__CX16__) || .def(__C65__) || .def (__MEGA65__)
|
||||
RESTOR := $FF8A
|
||||
VECTOR := $FF8D
|
||||
.elseif .def(__CBM510__) || .def(__CBM610__)
|
||||
@@ -112,6 +149,17 @@
|
||||
MEMBOT := $FF9C
|
||||
SCNKEY := $FF9F
|
||||
SETTMO := $FFA2
|
||||
.elseif .def(__C65__) || .def (__MEGA65__)
|
||||
SETMSG := $FF90
|
||||
SECOND := $FF93
|
||||
TKSA := $FF96
|
||||
MEMTOP := $FF99
|
||||
MEMBOT := $FF9C
|
||||
SCNKEY := $FF9F
|
||||
MONEXIT := $FFA2
|
||||
.endif
|
||||
|
||||
.if .def(__CBM510__) || .def(__CBM610__) || .def(__VIC20__) || .def(__C64__) || .def(__C128__) || .def(__C16__) || .def(__CX16__) || .def(__C65__) || .def(__MEGA65__)
|
||||
ACPTR := $FFA5
|
||||
CIOUT := $FFA8
|
||||
UNTLK := $FFAB
|
||||
@@ -136,7 +184,7 @@ CHRIN := $FFCF
|
||||
BSOUT := $FFD2
|
||||
CHROUT := $FFD2
|
||||
|
||||
.if .def(__CBM510__) || .def(__CBM610__) || .def(__VIC20__) || .def(__C64__) || .def(__C128__) || .def(__C16__) || .def(__CX16__)
|
||||
.if .def(__CBM510__) || .def(__CBM610__) || .def(__VIC20__) || .def(__C64__) || .def(__C128__) || .def(__C16__) || .def(__CX16__) || .def(__C65__) || .def(__MEGA65__)
|
||||
LOAD := $FFD5
|
||||
SAVE := $FFD8
|
||||
SETTIM := $FFDB
|
||||
@@ -147,9 +195,14 @@ CHROUT := $FFD2
|
||||
STOP := $FFE1
|
||||
GETIN := $FFE4
|
||||
CLALL := $FFE7
|
||||
UDTIM := $FFEA
|
||||
|
||||
.if .def(__CBM510__) || .def(__CBM610__) || .def(__VIC20__) || .def(__C64__) || .def(__C128__) || .def(__C16__) || .def(__CX16__)
|
||||
.if .def(__C65__) || .def(__MEGA65__)
|
||||
ScanStopKey := $FFEA
|
||||
.else
|
||||
UDTIM := $FFEA
|
||||
.endif
|
||||
|
||||
.if .def(__CBM510__) || .def(__CBM610__) || .def(__VIC20__) || .def(__C64__) || .def(__C128__) || .def(__C16__) || .def(__CX16__) || .def(__C65__) || .def(__MEGA65__)
|
||||
SCREEN := $FFED
|
||||
PLOT := $FFF0
|
||||
IOBASE := $FFF3
|
||||
@@ -173,10 +226,10 @@ UDTIM := $FFEA
|
||||
KBDREAD := $E5CF
|
||||
UPDCRAMPTR := $EAB2
|
||||
.elseif .def(__C64__)
|
||||
CLRSCR := $E544
|
||||
KBDREAD := $E5B4
|
||||
CLRSCR := $E544 ; Clear the screen
|
||||
KBDREAD := $E5B4 ; Get Character From Keyboard Buffer
|
||||
NMIEXIT := $FEBC
|
||||
UPDCRAMPTR := $EA24
|
||||
UPDCRAMPTR := $EA24 ; Update color ram pointer
|
||||
.elseif .def(__C128__)
|
||||
CLRSCR := $C142
|
||||
KBDREAD := $C006
|
||||
@@ -189,4 +242,7 @@ UDTIM := $FFEA
|
||||
.elseif .def(__C16__)
|
||||
CLRSCR := $D88B
|
||||
KBDREAD := $D8C1
|
||||
.elseif .def(__C65__) || .def(__MEGA65__)
|
||||
; CLRSCR := $E0EC ; ???
|
||||
KBDREAD := $E006
|
||||
.endif
|
||||
|
||||
@@ -1,24 +1,38 @@
|
||||
; CPU bitmask constants
|
||||
; CPU bitmask constants (make sure this matches src/common/cpu.h)
|
||||
|
||||
CPU_ISET_NONE = $0001
|
||||
CPU_ISET_6502 = $0002
|
||||
CPU_ISET_6502X = $0004
|
||||
CPU_ISET_6502DTV = $0008
|
||||
CPU_ISET_65SC02 = $0010
|
||||
CPU_ISET_65C02 = $0020
|
||||
CPU_ISET_65C02 = $0020 ; Rockwell extensions
|
||||
CPU_ISET_65816 = $0040
|
||||
CPU_ISET_SWEET16 = $0080
|
||||
CPU_ISET_HUC6280 = $0100
|
||||
;CPU_ISET_M740 = $0200 not actually implemented
|
||||
CPU_ISET_M740 = $0200
|
||||
CPU_ISET_4510 = $0400
|
||||
CPU_ISET_45GS02 = $0800
|
||||
CPU_ISET_W65C02 = $1000 ; WDC extensions
|
||||
CPU_ISET_65CE02 = $2000 ; CSG extensions
|
||||
|
||||
; CPU capabilities
|
||||
; make sure to only combine the instruction sets that are 100% compatible
|
||||
CPU_NONE = CPU_ISET_NONE
|
||||
CPU_6502 = CPU_ISET_6502
|
||||
CPU_6502X = CPU_ISET_6502|CPU_ISET_6502X
|
||||
CPU_6502DTV = CPU_ISET_6502|CPU_ISET_6502DTV
|
||||
CPU_65SC02 = CPU_ISET_6502|CPU_ISET_65SC02
|
||||
CPU_65C02 = CPU_ISET_6502|CPU_ISET_65SC02|CPU_ISET_65C02
|
||||
CPU_65816 = CPU_ISET_6502|CPU_ISET_65SC02|CPU_ISET_65816
|
||||
CPU_6502X = CPU_ISET_6502X | CPU_ISET_6502
|
||||
CPU_6502DTV = CPU_ISET_6502DTV | CPU_ISET_6502
|
||||
CPU_65SC02 = CPU_ISET_65SC02 | CPU_ISET_6502
|
||||
CPU_65C02 = CPU_ISET_65C02 | CPU_ISET_6502 | CPU_ISET_65SC02
|
||||
CPU_W65C02 = CPU_ISET_W65C02 | CPU_ISET_6502 | CPU_ISET_65SC02 | CPU_ISET_65C02
|
||||
|
||||
; FIXME: CPU_ISET_65SC02 does not apply to the following, because the zp-indirect
|
||||
; addressing was replaced with zp-indirect,z-indexed in 652SCE02
|
||||
|
||||
CPU_HUC6280 = CPU_ISET_HUC6280 | CPU_ISET_6502 | CPU_ISET_65C02
|
||||
CPU_4510 = CPU_ISET_4510 | CPU_ISET_6502 | CPU_ISET_65C02 | CPU_ISET_65CE02
|
||||
CPU_45GS02 = CPU_ISET_45GS02 | CPU_ISET_6502 | CPU_ISET_65C02 | CPU_ISET_65CE02 | CPU_ISET_4510
|
||||
CPU_M740 = CPU_ISET_M740 | CPU_ISET_6502
|
||||
CPU_65CE02 = CPU_ISET_65CE02 | CPU_ISET_6502 | CPU_ISET_65C02
|
||||
|
||||
CPU_65816 = CPU_ISET_65816 | CPU_ISET_6502 | CPU_ISET_65SC02
|
||||
CPU_SWEET16 = CPU_ISET_SWEET16
|
||||
CPU_HUC6280 = CPU_ISET_6502|CPU_ISET_65SC02|CPU_ISET_65C02|CPU_ISET_HUC6280
|
||||
CPU_4510 = CPU_ISET_6502|CPU_ISET_65SC02|CPU_ISET_65C02|CPU_ISET_4510
|
||||
|
||||
239
asminc/mega65.inc
Normal file
239
asminc/mega65.inc
Normal file
@@ -0,0 +1,239 @@
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Zero page, Commodore stuff
|
||||
|
||||
TXTPTR := $3C ; Pointer into BASIC source code
|
||||
STATUS := $90 ; Kernal I/O completion status
|
||||
FNAM_LEN := $B7 ; Length of filename
|
||||
SECADR := $B9 ; Secondary address
|
||||
DEVNUM := $BA ; Device number
|
||||
FNAM := $BB ; Address of filename
|
||||
FNAM_BANK := $BE ; Bank for filename
|
||||
KEY_COUNT := $D0 ; Number of keys in input buffer
|
||||
FKEY_COUNT := $D1 ; Characters for function key
|
||||
MODE := $D7 ; 40-/80-column mode (bit 7: 80 columns)
|
||||
GRAPHM := $D8 ; Graphics mode flags (bits 5-7)
|
||||
CHARDIS := $D9 ; Bit 2 shadow for location $01
|
||||
CURS_X := $EC ; Cursor column
|
||||
CURS_Y := $EB ; Cursor row
|
||||
SCREEN_PTR := $E0 ; Pointer to current char in text screen
|
||||
CRAM_PTR := $E2 ; Pointer to current char in color RAM
|
||||
CHARCOLOR := $F1
|
||||
RVS := $F3 ; Reverse output flag
|
||||
SCROLL := $F8 ; Disable scrolling flag
|
||||
|
||||
BASIC_BUF := $0200 ; Location of command-line
|
||||
BASIC_BUF_LEN = 161 ; Maximum length of command-line
|
||||
|
||||
FKEY_LEN := $1000 ; Function key lengths
|
||||
FKEY_TEXT := $100A ; Function key texts
|
||||
|
||||
PALFLAG := $1103 ; $FF=PAL, $00=NTSC
|
||||
INIT_STATUS := $1104 ; Flags: Reset/Restore initiation status
|
||||
TIME := $110C ; 60HZ clock
|
||||
|
||||
KBDREPEAT := $111a
|
||||
KBDREPEATRATE := $111b
|
||||
KBDREPEATDELAY := $111c
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Vectors
|
||||
|
||||
IRQVec := $0314
|
||||
BRKVec := $0316
|
||||
NMIVec := $0318
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; I/O: VIC
|
||||
|
||||
VIC := $D000
|
||||
VIC_SPR0_X := $D000
|
||||
VIC_SPR0_Y := $D001
|
||||
VIC_SPR1_X := $D002
|
||||
VIC_SPR1_Y := $D003
|
||||
VIC_SPR2_X := $D004
|
||||
VIC_SPR2_Y := $D005
|
||||
VIC_SPR3_X := $D006
|
||||
VIC_SPR3_Y := $D007
|
||||
VIC_SPR4_X := $D008
|
||||
VIC_SPR4_Y := $D009
|
||||
VIC_SPR5_X := $D00A
|
||||
VIC_SPR5_Y := $D00B
|
||||
VIC_SPR6_X := $D00C
|
||||
VIC_SPR6_Y := $D00D
|
||||
VIC_SPR7_X := $D00E
|
||||
VIC_SPR7_Y := $D00F
|
||||
VIC_SPR_HI_X := $D010
|
||||
VIC_SPR_ENA := $D015
|
||||
VIC_SPR_EXP_Y := $D017
|
||||
VIC_SPR_EXP_X := $D01D
|
||||
VIC_SPR_MCOLOR := $D01C
|
||||
VIC_SPR_BG_PRIO := $D01B
|
||||
VIC_SPR_COLL := $D01E
|
||||
VIC_SPR_BG_COLL := $D01F
|
||||
|
||||
VIC_SPR_MCOLOR0 := $D025
|
||||
VIC_SPR_MCOLOR1 := $D026
|
||||
|
||||
VIC_SPR0_COLOR := $D027
|
||||
VIC_SPR1_COLOR := $D028
|
||||
VIC_SPR2_COLOR := $D029
|
||||
VIC_SPR3_COLOR := $D02A
|
||||
VIC_SPR4_COLOR := $D02B
|
||||
VIC_SPR5_COLOR := $D02C
|
||||
VIC_SPR6_COLOR := $D02D
|
||||
VIC_SPR7_COLOR := $D02E
|
||||
|
||||
VIC_CTRL1 := $D011
|
||||
VIC_CTRL2 := $D016
|
||||
|
||||
VIC_HLINE := $D012
|
||||
|
||||
VIC_LPEN_X := $D013
|
||||
VIC_LPEN_Y := $D014
|
||||
|
||||
VIC_VIDEO_ADR := $D018
|
||||
|
||||
VIC_IRR := $D019 ; Interrupt request register
|
||||
VIC_IMR := $D01A ; Interrupt mask register
|
||||
|
||||
VIC_BORDERCOLOR := $D020
|
||||
VIC_BG_COLOR0 := $D021
|
||||
VIC_BG_COLOR1 := $D022
|
||||
VIC_BG_COLOR2 := $D023
|
||||
VIC_BG_COLOR3 := $D024
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; I/O: FDC
|
||||
|
||||
FDC := $D080
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; I/O: SID
|
||||
|
||||
SID0 := $D400
|
||||
SID0_S1Lo := $D400
|
||||
SID0_S1Hi := $D401
|
||||
SID0_PB1Lo := $D402
|
||||
SID0_PB1Hi := $D403
|
||||
SID0_Ctl1 := $D404
|
||||
SID0_AD1 := $D405
|
||||
SID0_SUR1 := $D406
|
||||
|
||||
SID0_S2Lo := $D407
|
||||
SID0_S2Hi := $D408
|
||||
SID0_PB2Lo := $D409
|
||||
SID0_PB2Hi := $D40A
|
||||
SID0_Ctl2 := $D40B
|
||||
SID0_AD2 := $D40C
|
||||
SID0_SUR2 := $D40D
|
||||
|
||||
SID0_S3Lo := $D40E
|
||||
SID0_S3Hi := $D40F
|
||||
SID0_PB3Lo := $D410
|
||||
SID0_PB3Hi := $D411
|
||||
SID0_Ctl3 := $D412
|
||||
SID0_AD3 := $D413
|
||||
SID0_SUR3 := $D414
|
||||
|
||||
SID0_FltLo := $D415
|
||||
SID0_FltHi := $D416
|
||||
SID0_FltCtl := $D417
|
||||
SID0_Amp := $D418
|
||||
SID0_ADConv1 := $D419
|
||||
SID0_ADConv2 := $D41A
|
||||
SID0_Noise := $D41B
|
||||
SID0_Read3 := $D41C
|
||||
|
||||
SID1 := $D420
|
||||
SID1_S1Lo := $D420
|
||||
SID1_S1Hi := $D421
|
||||
SID1_PB1Lo := $D422
|
||||
SID1_PB1Hi := $D423
|
||||
SID1_Ctl1 := $D424
|
||||
SID1_AD1 := $D425
|
||||
SID1_SUR1 := $D426
|
||||
|
||||
SID1_S2Lo := $D427
|
||||
SID1_S2Hi := $D428
|
||||
SID1_PB2Lo := $D429
|
||||
SID1_PB2Hi := $D42A
|
||||
SID1_Ctl2 := $D42B
|
||||
SID1_AD2 := $D42C
|
||||
SID1_SUR2 := $D42D
|
||||
|
||||
SID1_S3Lo := $D42E
|
||||
SID1_S3Hi := $D42F
|
||||
SID1_PB3Lo := $D430
|
||||
SID1_PB3Hi := $D431
|
||||
SID1_Ctl3 := $D432
|
||||
SID1_AD3 := $D433
|
||||
SID1_SUR3 := $D434
|
||||
|
||||
SID1_FltLo := $D435
|
||||
SID1_FltHi := $D436
|
||||
SID1_FltCtl := $D437
|
||||
SID1_Amp := $D438
|
||||
SID1_ADConv1 := $D439
|
||||
SID1_ADConv2 := $D43A
|
||||
SID1_Noise := $D43B
|
||||
SID1_Read3 := $D43C
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; I/O: Complex Interface Adapters
|
||||
|
||||
CIA1 := $DC00
|
||||
CIA1_PRA := $DC00 ; Port A
|
||||
CIA1_PRB := $DC01 ; Port B
|
||||
CIA1_DDRA := $DC02 ; Data direction register for port A
|
||||
CIA1_DDRB := $DC03 ; Data direction register for port B
|
||||
CIA1_TA := $DC04 ; 16-bit timer A
|
||||
CIA1_TB := $DC06 ; 16-bit timer B
|
||||
CIA1_TOD10 := $DC08 ; Time-of-day tenths of a second
|
||||
CIA1_TODSEC := $DC09 ; Time-of-day seconds
|
||||
CIA1_TODMIN := $DC0A ; Time-of-day minutes
|
||||
CIA1_TODHR := $DC0B ; Time-of-day hours
|
||||
CIA1_SDR := $DC0C ; Serial data register
|
||||
CIA1_ICR := $DC0D ; Interrupt control register
|
||||
CIA1_CRA := $DC0E ; Control register for timer A
|
||||
CIA1_CRB := $DC0F ; Control register for timer B
|
||||
|
||||
CIA2 := $DD00
|
||||
CIA2_PRA := $DD00
|
||||
CIA2_PRB := $DD01
|
||||
CIA2_DDRA := $DD02
|
||||
CIA2_DDRB := $DD03
|
||||
CIA2_TA := $DD04
|
||||
CIA2_TB := $DD06
|
||||
CIA2_TOD10 := $DD08
|
||||
CIA2_TODSEC := $DD09
|
||||
CIA2_TODMIN := $DD0A
|
||||
CIA2_TODHR := $DD0B
|
||||
CIA2_SDR := $DD0C
|
||||
CIA2_ICR := $DD0D
|
||||
CIA2_CRA := $DD0E
|
||||
CIA2_CRB := $DD0F
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; I/O: DMA
|
||||
|
||||
DMA := $D700
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Processor Port at $01
|
||||
|
||||
LORAM = $01 ; Enable the basic rom
|
||||
HIRAM = $02 ; Enable the kernal rom
|
||||
IOEN = $04 ; Enable I/O
|
||||
CASSDATA = $08 ; Cassette data
|
||||
CASSPLAY = $10 ; Cassette: Play
|
||||
CASSMOT = $20 ; Cassette motor on
|
||||
TP_FAST = $80 ; Switch Rossmoeller TurboProcess to fast mode
|
||||
|
||||
RAMONLY = $F8 ; (~(LORAM | HIRAM | IOEN)) & $FF
|
||||
|
||||
; temporary, to get conio working
|
||||
XSIZE = 80
|
||||
YSIZE = 50
|
||||
@@ -8,11 +8,25 @@
|
||||
; by the compiler, ready for usage in asm code.
|
||||
|
||||
|
||||
.globalzp sp, sreg, regsave
|
||||
.globalzp c_sp, sreg, regsave
|
||||
.globalzp ptr1, ptr2, ptr3, ptr4
|
||||
.globalzp tmp1, tmp2, tmp3, tmp4
|
||||
.globalzp regbank
|
||||
|
||||
; FIXME: there must be a less ugly way to do this
|
||||
.ifp4510
|
||||
.else
|
||||
.ifp45GS02
|
||||
.else
|
||||
|
||||
; The following symbol is supplied for compatibility reasons only, it
|
||||
; will get removed in future versions. Using it will cause a linker
|
||||
; warning.
|
||||
.globalzp sp
|
||||
.endif
|
||||
.endif
|
||||
|
||||
|
||||
; The size of the register bank
|
||||
regbanksize = 6
|
||||
|
||||
|
||||
44
cfg/agat.cfg
Normal file
44
cfg/agat.cfg
Normal file
@@ -0,0 +1,44 @@
|
||||
# Default configuration
|
||||
|
||||
FEATURES {
|
||||
STARTADDRESS: default = $1903;
|
||||
}
|
||||
SYMBOLS {
|
||||
__EXEHDR__: type = import;
|
||||
__FILETYPE__: type = weak, value = $0006; # file type
|
||||
__STACKSIZE__: type = weak, value = $0400; # 1k stack
|
||||
__HIMEM__: type = weak, value = $C000; # Presumed RAM end
|
||||
}
|
||||
MEMORY {
|
||||
ZP: file = "", define = yes, start = $0080, size = $001A;
|
||||
HEADER: file = %O, start = %S - $003A, size = $003A;
|
||||
MAIN: file = %O, define = yes, start = %S, size = __HIMEM__ - %S;
|
||||
BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__;
|
||||
}
|
||||
SEGMENTS {
|
||||
ZEROPAGE: load = ZP, type = zp;
|
||||
EXEHDR: load = HEADER, type = ro, optional = yes;
|
||||
STARTUP: load = MAIN, type = ro, optional = yes;
|
||||
LOWCODE: load = MAIN, type = ro, optional = yes;
|
||||
CODE: load = MAIN, type = ro;
|
||||
RODATA: load = MAIN, type = ro;
|
||||
DATA: load = MAIN, type = rw;
|
||||
INIT: load = MAIN, type = rw, optional = yes;
|
||||
ONCE: load = MAIN, type = ro, define = yes;
|
||||
BSS: load = BSS, 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__;
|
||||
}
|
||||
20
cfg/c65-asm.cfg
Normal file
20
cfg/c65-asm.cfg
Normal file
@@ -0,0 +1,20 @@
|
||||
FEATURES {
|
||||
STARTADDRESS: default = $2001;
|
||||
}
|
||||
SYMBOLS {
|
||||
__LOADADDR__: type = import;
|
||||
}
|
||||
MEMORY {
|
||||
ZP: file = "", start = $0002, size = $00FE, define = yes;
|
||||
LOADADDR: file = %O, start = %S - 2, size = $0002;
|
||||
MAIN: file = %O, start = %S, size = $D000 - %S;
|
||||
}
|
||||
SEGMENTS {
|
||||
ZEROPAGE: load = ZP, type = zp, optional = yes;
|
||||
LOADADDR: load = LOADADDR, type = ro;
|
||||
EXEHDR: load = MAIN, type = ro, optional = yes;
|
||||
CODE: load = MAIN, type = rw;
|
||||
RODATA: load = MAIN, type = ro, optional = yes;
|
||||
DATA: load = MAIN, type = rw, optional = yes;
|
||||
BSS: load = MAIN, type = bss, optional = yes, define = yes;
|
||||
}
|
||||
44
cfg/c65.cfg
Normal file
44
cfg/c65.cfg
Normal file
@@ -0,0 +1,44 @@
|
||||
FEATURES {
|
||||
STARTADDRESS: default = $2001;
|
||||
}
|
||||
SYMBOLS {
|
||||
__LOADADDR__: type = import;
|
||||
__EXEHDR__: type = import;
|
||||
__STACKSIZE__: type = weak, value = $0800; # 2k stack
|
||||
__HIMEM__: type = weak, value = $8000;
|
||||
}
|
||||
MEMORY {
|
||||
ZP: file = "", define = yes, start = $0018, size = $001A;
|
||||
LOADADDR: file = %O, start = %S - 2, size = $0002;
|
||||
HEADER: file = %O, define = yes, start = %S, size = $0010;
|
||||
MAIN: file = %O, define = yes, start = __HEADER_LAST__, size = __HIMEM__ - __HEADER_LAST__;
|
||||
BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__;
|
||||
}
|
||||
SEGMENTS {
|
||||
ZEROPAGE: load = ZP, type = zp;
|
||||
LOADADDR: load = LOADADDR, type = ro;
|
||||
EXEHDR: load = HEADER, type = ro;
|
||||
STARTUP: load = MAIN, type = ro;
|
||||
LOWCODE: load = MAIN, type = ro, optional = yes;
|
||||
CODE: load = MAIN, type = ro;
|
||||
RODATA: load = MAIN, type = ro;
|
||||
DATA: 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;
|
||||
}
|
||||
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__;
|
||||
}
|
||||
20
cfg/mega65-asm.cfg
Normal file
20
cfg/mega65-asm.cfg
Normal file
@@ -0,0 +1,20 @@
|
||||
FEATURES {
|
||||
STARTADDRESS: default = $2001;
|
||||
}
|
||||
SYMBOLS {
|
||||
__LOADADDR__: type = import;
|
||||
}
|
||||
MEMORY {
|
||||
ZP: file = "", start = $0002, size = $00FE, define = yes;
|
||||
LOADADDR: file = %O, start = %S - 2, size = $0002;
|
||||
MAIN: file = %O, start = %S, size = $D000 - %S;
|
||||
}
|
||||
SEGMENTS {
|
||||
ZEROPAGE: load = ZP, type = zp, optional = yes;
|
||||
LOADADDR: load = LOADADDR, type = ro;
|
||||
EXEHDR: load = MAIN, type = ro, optional = yes;
|
||||
CODE: load = MAIN, type = rw;
|
||||
RODATA: load = MAIN, type = ro, optional = yes;
|
||||
DATA: load = MAIN, type = rw, optional = yes;
|
||||
BSS: load = MAIN, type = bss, optional = yes, define = yes;
|
||||
}
|
||||
44
cfg/mega65.cfg
Normal file
44
cfg/mega65.cfg
Normal file
@@ -0,0 +1,44 @@
|
||||
FEATURES {
|
||||
STARTADDRESS: default = $2001;
|
||||
}
|
||||
SYMBOLS {
|
||||
__LOADADDR__: type = import;
|
||||
__EXEHDR__: type = import;
|
||||
__STACKSIZE__: type = weak, value = $0800; # 2k stack
|
||||
__HIMEM__: type = weak, value = $8000;
|
||||
}
|
||||
MEMORY {
|
||||
ZP: file = "", define = yes, start = $0018, size = $001A;
|
||||
LOADADDR: file = %O, start = %S - 2, size = $0002;
|
||||
HEADER: file = %O, define = yes, start = %S, size = $0010;
|
||||
MAIN: file = %O, define = yes, start = __HEADER_LAST__, size = __HIMEM__ - __HEADER_LAST__;
|
||||
BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__;
|
||||
}
|
||||
SEGMENTS {
|
||||
ZEROPAGE: load = ZP, type = zp;
|
||||
LOADADDR: load = LOADADDR, type = ro;
|
||||
EXEHDR: load = HEADER, type = ro;
|
||||
STARTUP: load = MAIN, type = ro;
|
||||
LOWCODE: load = MAIN, type = ro, optional = yes;
|
||||
CODE: load = MAIN, type = ro;
|
||||
RODATA: load = MAIN, type = ro;
|
||||
DATA: 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;
|
||||
}
|
||||
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__;
|
||||
}
|
||||
56
cfg/plus4-hires.cfg
Normal file
56
cfg/plus4-hires.cfg
Normal file
@@ -0,0 +1,56 @@
|
||||
# Linker configuration that allows for a hi-res bitmap at $C000-$DF3F, but
|
||||
# puts the stack (and a "HIBSS" segment) in the remaining RAM at $DF40-$FD00.
|
||||
|
||||
FEATURES {
|
||||
STARTADDRESS: default = $1001;
|
||||
}
|
||||
SYMBOLS {
|
||||
__LOADADDR__: type = import;
|
||||
__EXEHDR__: type = import;
|
||||
__STACKSIZE__: type = weak, value = $0800; # 2k stack
|
||||
__HIMEM__: type = weak, value = $FD00;
|
||||
}
|
||||
MEMORY {
|
||||
# Reserve 8000 bytes at $C000 for 320x200 bitmap
|
||||
RESERVED: file = "", define = yes, start = $C000, size = 8000;
|
||||
|
||||
ZP: file = "", define = yes, start = $0002, size = $001A;
|
||||
LOADADDR: file = %O, start = %S - 2, size = $0002;
|
||||
HEADER: file = %O, define = yes, start = %S, size = $000D;
|
||||
MAIN: file = %O, define = yes, start = __HEADER_LAST__, size = __RESERVED_START__ - __MAIN_START__;
|
||||
|
||||
# Space between bitmap and top of memory
|
||||
HIRAM: file = "", define = yes, start = __RESERVED_LAST__, size = __HIMEM__ - __HIRAM_START__ - __STACKSIZE__;
|
||||
}
|
||||
SEGMENTS {
|
||||
ZEROPAGE: load = ZP, type = zp;
|
||||
LOADADDR: load = LOADADDR, type = ro;
|
||||
EXEHDR: load = HEADER, type = ro;
|
||||
STARTUP: load = MAIN, type = ro;
|
||||
LOWCODE: load = MAIN, type = ro, optional = yes;
|
||||
CODE: load = MAIN, type = ro;
|
||||
ONCE: load = MAIN, type = ro, optional = yes;
|
||||
RODATA: load = MAIN, type = ro;
|
||||
DATA: load = MAIN, type = rw;
|
||||
INIT: load = MAIN, type = bss;
|
||||
BSS: load = MAIN, type = bss, define = yes;
|
||||
|
||||
# Allow data between bitmap and top of memory to be used as a second BSS
|
||||
# space. Define symbols for it so that it can be supplied to _heapadd().
|
||||
HIBSS: load = HIRAM, type = bss, optional = yes, define = yes;
|
||||
}
|
||||
FEATURES {
|
||||
CONDES: type = constructor,
|
||||
label = __CONSTRUCTOR_TABLE__,
|
||||
count = __CONSTRUCTOR_COUNT__,
|
||||
segment = ONCE;
|
||||
CONDES: type = destructor,
|
||||
label = __DESTRUCTOR_TABLE__,
|
||||
count = __DESTRUCTOR_COUNT__,
|
||||
segment = RODATA;
|
||||
CONDES: type = interruptor,
|
||||
label = __INTERRUPTOR_TABLE__,
|
||||
count = __INTERRUPTOR_COUNT__,
|
||||
segment = RODATA,
|
||||
import = __CALLIRQ__;
|
||||
}
|
||||
@@ -1,3 +1,9 @@
|
||||
# ---- Display info during parsing phase ----
|
||||
SILENT:=$(findstring s,$(word 1, $(MAKEFLAGS)))
|
||||
ifneq ($(SILENT),s)
|
||||
$(info Using Makefile: $(realpath $(firstword $(MAKEFILE_LIST))) $(MAKECMDGOALS))
|
||||
endif
|
||||
|
||||
ifneq ($(shell echo),)
|
||||
CMD_EXE = 1
|
||||
endif
|
||||
|
||||
79
doc/agat.sgml
Normal file
79
doc/agat.sgml
Normal file
@@ -0,0 +1,79 @@
|
||||
<!doctype linuxdoc system>
|
||||
|
||||
<article>
|
||||
<title>Agat-7/9 - specific information for cc65
|
||||
|
||||
<author><url url="https://sourceforge.net/u/olegodintsov/profile/" name="Oleg A. Odintsov">,<newline>
|
||||
<url url="mailto:sintechs@gmail.com" name="Konstantin Fedorov">
|
||||
|
||||
<abstract>
|
||||
An overview over the Agat-7 and Agat-9 and theirs interfaces to the cc65 C
|
||||
compiler.
|
||||
</abstract>
|
||||
|
||||
<!-- Table of contents -->
|
||||
<toc>
|
||||
|
||||
<!-- Begin the document -->
|
||||
|
||||
<sect>Overview
|
||||
|
||||
<p>The Agat was a series of 8-bit computers produced in the Soviet Union from 1983 to 1993.
|
||||
It was based on Apple II architecture with all electronic components made in the Soviet Union except for 6502 microprocessors supplied by UMC (UM6502A).
|
||||
<p>If compared to Apple II, Agat had many improvements such as color text mode, additional graphic modes and flexible memory controller.
|
||||
Agat-7 had an Apple II compatibility card called "Module 121", while Agat-9 had a built-in Apple II+ mode activated by soft-switch.
|
||||
<p>All mass-produced Agat models were disk-based systems, 2K ROM contained only basic machine language monitor and disassembler.
|
||||
Agat-7 had 140K floppy-drive based on Apple DISK II, while Agat-9 was supplied with 840K drive having its own sector format and controller.
|
||||
|
||||
<sect>Binary format<p>
|
||||
|
||||
The standard binary file format generated by the linker for the Agat target is
|
||||
an AppleSingle file to be compatible with AppleCommander <url url="https://applecommander.github.io/">.
|
||||
The default load address is $1903.
|
||||
|
||||
|
||||
|
||||
<sect>Platform-specific header files<p>
|
||||
|
||||
Programs containing Agat-specific code may use the <tt/agat.h/ or
|
||||
<tt/agat.inc/ include files.
|
||||
|
||||
<sect>Usefull info<p>
|
||||
|
||||
<sect1>Emulation<p>
|
||||
|
||||
<enum>
|
||||
<item> Oleg Odintsov's Agat Emulator - <url url="https://agatemulator.sourceforge.net/english.html">
|
||||
<item> MAME - <url url="https://www.mamedev.org/">
|
||||
</enum>
|
||||
|
||||
<sect1>Links<p>
|
||||
<enum>
|
||||
<item> Most informative source on Agat (in russian) - <url url="https://agatcomp.ru">
|
||||
<item> Wikipedia - <url url="https://en.wikipedia.org/wiki/Agat_(computer)">
|
||||
<item> Controversial article on Agat from <url name="BYTE Magazine November 1984 Vol. 9, No. 12" url="https://archive.org/details/byte-magazine-1984-11/page/n135/mode/2up?view=theater">.
|
||||
The author reviewed custom-build mockup Agat bearing little relation to even the early Agat systems.
|
||||
</enum>
|
||||
|
||||
|
||||
<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>
|
||||
@@ -87,7 +87,7 @@ several useful settings:
|
||||
exit then a plain vanilla ProDOS 8 doesn't make use of the Language Card bank
|
||||
2 at all.
|
||||
|
||||
<tag>LC address: $D000, LC size: $3000</tag>
|
||||
<tag>LC address: $D000, LC size: $2FFC</tag>
|
||||
For plain vanilla DOS 3.3 which doesn't make use of the Language Card at all.
|
||||
|
||||
</descrip><p>
|
||||
@@ -361,6 +361,7 @@ usage.
|
||||
<item>rebootafterexit
|
||||
<item>ser_apple2_slot
|
||||
<item>tgi_apple2_mix
|
||||
<item>videomode
|
||||
</itemize>
|
||||
|
||||
|
||||
@@ -406,6 +407,10 @@ The names in the parentheses denote the symbols to be used for static linking of
|
||||
with <tt/-S $4000/ to reserve the first hires page or with <tt/-S $6000/
|
||||
to reserve both hires pages.
|
||||
|
||||
Note that the second hires page is only available if the text display is not in
|
||||
80 column mode. This can be asserted by calling <tt/videomode (VIDEOMODE_40COL);/
|
||||
before installing the driver.
|
||||
|
||||
The function <tt/tgi_apple2_mix()/ allows to activate 4 lines of text. The
|
||||
function doesn't clear the corresponding area at the bottom of the screen.
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ several useful settings:
|
||||
exit then a plain vanilla ProDOS 8 doesn't make use of the Language Card bank
|
||||
2 at all.
|
||||
|
||||
<tag>LC address: $D000, LC size: $3000</tag>
|
||||
<tag>LC address: $D000, LC size: $2FFC</tag>
|
||||
For plain vanilla DOS 3.3 which doesn't make use of the Language Card at all.
|
||||
|
||||
</descrip><p>
|
||||
|
||||
@@ -1121,7 +1121,7 @@ If BSS and/or the stack shouldn't stay at the end of the program,
|
||||
some parts of the cc65 runtime lib need to be replaced/modified.
|
||||
|
||||
common/_heap.s defines the location of the heap and atari/crt0.s
|
||||
defines the location of the stack by initializing sp.
|
||||
defines the location of the stack by initializing c_sp.
|
||||
|
||||
|
||||
<sect1>Upgrading from an older cc65 version<p>
|
||||
|
||||
393
doc/ca65.sgml
393
doc/ca65.sgml
@@ -151,8 +151,21 @@ Here is a description of all the command line options:
|
||||
|
||||
Set the default for the CPU type. The option takes a parameter, which
|
||||
may be one of
|
||||
|
||||
6502, 6502X, 6502DTV, 65SC02, 65C02, 65816, sweet16, HuC6280, 4510
|
||||
<itemize>
|
||||
<item>6502 - NMOS 6502 (all legal instructions)
|
||||
<item>6502X - NMOS 6502 with all undocumented instructions
|
||||
<item>6502DTV - the emulated CPU of the C64DTV device
|
||||
<item>65SC02 - first CMOS instruction set (no bit manipulation, no wai/stp)
|
||||
<item>65C02 - CMOS with Rockwell extensions
|
||||
<item>W65C02 - full CMOS instruction set (has bit manipulation and wai/stp)
|
||||
<item>65CE02 - CMOS with CSG extensions
|
||||
<item>4510 - the CPU of the Commodore C65
|
||||
<item>45GS02 - the CPU of the Commodore MEGA65
|
||||
<item>HuC6280 - the CPU of the PC engine
|
||||
<item>M740 - a Microcontroller by Mitsubishi
|
||||
<item>65816 - the CPU of the SNES, and the SCPU
|
||||
<item>sweet16 - an interpreter for a pseudo 16 bit CPU
|
||||
</itemize>
|
||||
|
||||
|
||||
<label id="option-create-dep">
|
||||
@@ -302,7 +315,7 @@ Here is a description of all the command line options:
|
||||
character constants into the character set of the target platform. The
|
||||
default for the target system is "none", which means that no translation
|
||||
will take place. The assembler supports the same target systems as the
|
||||
compiler, see there for a list.
|
||||
compiler, see <htmlurl url="ca65.html#option-t" name="there for a list">.
|
||||
|
||||
Depending on the target, the default CPU type is also set. This can be
|
||||
overridden by using the <tt/<ref id="option--cpu" name="--cpu">/ option.
|
||||
@@ -399,7 +412,7 @@ name="--bin-include-dir">/ option on the command line.
|
||||
|
||||
|
||||
|
||||
<sect>Input format<p>
|
||||
<sect>Input format<p><label id="input-format">
|
||||
|
||||
<sect1>Assembler syntax<p>
|
||||
|
||||
@@ -426,22 +439,36 @@ Here are some examples for valid input lines:
|
||||
The assembler accepts
|
||||
|
||||
<itemize>
|
||||
<item>all valid 6502 mnemonics when in 6502 mode (the default or after the
|
||||
<item>all valid 6502 mnemonics when in <ref id="6502-mode" name="6502 mode">
|
||||
(the default or after the
|
||||
<tt><ref id=".P02" name=".P02"></tt> command was given).
|
||||
<item>all valid 6502 mnemonics plus a set of illegal instructions when in
|
||||
<ref id="6502X-mode" name="6502X mode">.
|
||||
<item>all valid 6502DTV mnemonics when in 6502DTV mode (after the
|
||||
<item>all valid 6502 mnemonics, plus a set of illegal instructions, when in
|
||||
<ref id="6502X-mode" name="6502X mode"> (after the
|
||||
<tt><ref id=".P02X" name=".P02X"></tt> command was given).
|
||||
<item>all valid 6502DTV mnemonics when in <ref id="DTV-mode" name="DTV mode"> (after the
|
||||
<tt><ref id=".PDTV" name=".PDTV"></tt> command was given).
|
||||
<item>all valid 65SC02 mnemonics when in 65SC02 mode (after the
|
||||
<item>all valid 65SC02 mnemonics when in <ref id="65SC02-mode" name="65SC02 mode"> (after the
|
||||
<tt><ref id=".PSC02" name=".PSC02"></tt> command was given).
|
||||
<item>all valid 65C02 mnemonics when in 65C02 mode (after the
|
||||
<item>all valid 65C02 mnemonics when in <ref id="65C02-mode" name="65C02 mode"> (after the
|
||||
<tt><ref id=".PC02" name=".PC02"></tt> command was given).
|
||||
<item>all valid 65816 mnemonics when in 65816 mode (after the
|
||||
<tt><ref id=".P816" name=".P816"></tt> command was given).
|
||||
<item>all valid 4510 mnemonics when in 4510 mode (after the
|
||||
<item>all valid W65C02 mnemonics when in <ref id="W65C02-mode" name="W65C02 mode"> (after the
|
||||
<tt><ref id=".PWC02" name=".PWC02"></tt> command was given).
|
||||
<item>all valid 65CE02 mnemonics when in <ref id="65CE02-mode" name="65CE02 mode"> (after the
|
||||
<tt><ref id=".PCE02" name=".PCE02"></tt> command was given).
|
||||
<item>all valid 4510 mnemonics when in <ref id="4510-mode" name="4510 mode"> (after the
|
||||
<tt><ref id=".P4510" name=".P4510"></tt> command was given).
|
||||
<item>all valid 45GS02 mnemonics when in <ref id="45GS02-mode" name="45GS02 mode"> (after the
|
||||
<tt><ref id=".P45GS02" name=".P45GS02"></tt> command was given).
|
||||
<item>all valid HuC6280 mnemonics when in <ref id="HUC6280-mode" name="HuC6280 mode"> (after the
|
||||
<tt><ref id=".P6280" name=".P6280"></tt> command was given).
|
||||
<item>all valid M740 mnemonics when in <ref id="M740-mode" name="M740 mode"> (after the
|
||||
<tt><ref id=".PM740" name=".PM740"></tt> command was given).
|
||||
<item>all valid 65816 mnemonics when in <ref id="65816-mode" name="65816 mode"> (after the
|
||||
<tt><ref id=".P816" name=".P816"></tt> command was given).
|
||||
</itemize>
|
||||
|
||||
for more details on the various CPUs, see <tt><htmlurl url="cpus.html" name="here"></tt>.
|
||||
|
||||
On 6502-derived platforms the <tt/BRK/ instruction has an optional signature
|
||||
byte. If omitted, the assembler will only produce only 1 byte.
|
||||
|
||||
@@ -451,8 +478,138 @@ byte. If omitted, the assembler will only produce only 1 byte.
|
||||
brk #$34 ; 2-bytes: $00 $34
|
||||
</verb></tscreen>
|
||||
|
||||
<sect2>6502 mode<label id="6502-mode"><p>
|
||||
|
||||
<sect1>65816 mode<p>
|
||||
In 6502 mode (which is the default) the assembler accepts all regular "legal"
|
||||
6502 mnemonics and addressing modes.
|
||||
|
||||
<sect2>6502X mode<label id="6502X-mode"><p>
|
||||
|
||||
6502X mode is an extension to the normal 6502 mode. In this mode, several
|
||||
mnemonics for undocumented instructions of the NMOS 6502 CPUs are accepted.
|
||||
|
||||
Note: Since these instructions are undocumented, there are no official mnemonics
|
||||
for them.
|
||||
|
||||
<itemize>
|
||||
<item><tt>ALR: A:=(A and #{imm})/2;</tt>
|
||||
<item><tt>ANC: A:= A and #{imm};</tt> Generates opcode $0B.
|
||||
<item><tt>ANE: A:= (A or CONST) and X and #{imm};</tt>
|
||||
<item><tt>ARR: A:=(A and #{imm})/2;</tt>
|
||||
<item><tt>AXS: X:=A and X-#{imm};</tt>
|
||||
<item><tt>DCP: {addr}:={addr}-1; A-{addr};</tt>
|
||||
<item><tt>ISC: {addr}:={addr}+1; A:=A-{addr};</tt>
|
||||
<item><tt>JAM:</tt>
|
||||
<item><tt>LAS: A,X,S:={addr} and S;</tt>
|
||||
<item><tt>LAX: A,X:={addr};</tt>
|
||||
<item><tt>NOP: #{imm}; zp; zp,x; abs; abs,x</tt>
|
||||
<item><tt>RLA: {addr}:={addr}rol; A:=A and {addr};</tt>
|
||||
<item><tt>RRA: {addr}:={addr}ror; A:=A adc {addr};</tt>
|
||||
<item><tt>SAX: {addr}:=A and X;</tt>
|
||||
<item><tt>SHA: {addr}:=A and X and {addr hi +1};</tt>
|
||||
<item><tt>SHX: {addr}:=X and {addr hi +1};</tt>
|
||||
<item><tt>SHY: {addr}:=Y and {addr hi +1};</tt>
|
||||
<item><tt>SLO: {addr}:={addr}*2; A:=A or {addr};</tt>
|
||||
<item><tt>SRE: {addr}:={addr}/2; A:=A xor {addr};</tt>
|
||||
<item><tt>TAS: {addr}:=A and X and {addr hi +1}; SP:=A and X;</tt>
|
||||
</itemize>
|
||||
|
||||
|
||||
<sect2>DTV mode<label id="DTV-mode"><p>
|
||||
|
||||
The C64DTV CPU is based on the 6510, but adds some instructions, and does not
|
||||
support all undocumented instructions.
|
||||
|
||||
<itemize>
|
||||
<item><tt>bra {rel}</tt> Generates opcode $12.
|
||||
<item><tt>sac #{imm}</tt> Generates opcode $32.
|
||||
<item><tt>sir #{imm}</tt> Generates opcode $42.
|
||||
</itemize>
|
||||
|
||||
Supported undocumented instructions:
|
||||
|
||||
<itemize>
|
||||
<item><tt>ALR: A:=(A and #{imm})/2;</tt>
|
||||
<item><tt>ANC: A:=A and #{imm};</tt> Generates opcode $0B.
|
||||
<item><tt>ARR: A:=(A and #{imm})/2;</tt>
|
||||
<item><tt>AXS: X:=A and X-#{imm};</tt>
|
||||
<item><tt>LAS: A,X,S:={addr} and S;</tt>
|
||||
<item><tt>LAX: A,X:={addr};</tt>
|
||||
<item><tt>NOP: #{imm}; zp; zp,x; abs; abs,x</tt>
|
||||
<item><tt>RLA: {addr}:={addr}rol; A:=A and {addr};</tt>
|
||||
<item><tt>RRA: {addr}:={addr}ror; A:=A adc {addr};</tt>
|
||||
<item><tt>SHX: {addr}:=X and {addr hi +1};</tt>
|
||||
<item><tt>SHY: {addr}:=y and {addr hi +1};</tt>
|
||||
</itemize>
|
||||
|
||||
|
||||
<sect2>65SC02 mode<label id="65SC02-mode"><p>
|
||||
|
||||
65SC02 mode supports all regular 6502 instructions, plus the original CMOS
|
||||
instructions.
|
||||
|
||||
|
||||
<sect2>65C02 mode (CMOS with Rockwell extensions)<label id="65C02-mode"><p>
|
||||
|
||||
65C02 mode supports all original CMOS instructions, plus the Rockwell (bit
|
||||
manipulation instructions) extensions.
|
||||
|
||||
|
||||
<sect2>W65C02 mode (CMOS with WDC extensions)<label id="W65C02-mode"><p>
|
||||
|
||||
W65C02 mode supports the Rockwell extensions, plus wai and stp.
|
||||
|
||||
|
||||
<sect2>65CE02 mode<label id="65CE02-mode"><p>
|
||||
|
||||
All 65CE02 instructions are accepted, plus the Rockwell extensions.
|
||||
|
||||
|
||||
<sect2>4510 mode<label id="4510-mode"><p>
|
||||
|
||||
The 4510 is a microcontroller that is the core of the Commodore C65 aka C64DX.
|
||||
It contains among other functions a slightly modified 65CE02/4502 CPU, to allow
|
||||
address mapping for 20 bits of address space (1 megabyte addressable area).
|
||||
|
||||
As compared to the description of the CPU in the
|
||||
<url url="http://www.zimmers.net/anonftp/pub/cbm/c65/c65manualupdated.txt.gz"
|
||||
name="C65 System Specification">
|
||||
<url url="https://raw.githubusercontent.com/MEGA65/c65-specifications/master/c65manualupdated.txt"
|
||||
name="(updated version)"> uses these changes:
|
||||
<itemize>
|
||||
<item><tt>LDA (d,SP),Y</tt> may also be written as <tt>LDA (d,S),Y</tt>
|
||||
(matching the 65816 notation).
|
||||
<item>All branch instruction allow now 16 bit offsets. To use a 16 bit
|
||||
branch you have to prefix these with an "L" (e.g. "<tt>LBNE</tt>" instead of
|
||||
"<tt>BNE</tt>"). This might change at a later implementation of the assembler.
|
||||
</itemize>
|
||||
|
||||
For more information about the Commodore C65/C64DX and the 4510 CPU, see
|
||||
<url url="http://www.zimmers.net/anonftp/pub/cbm/c65/"> and
|
||||
<url url="https://en.wikipedia.org/wiki/Commodore_65" name="Wikipedia">.
|
||||
|
||||
<sect2>45GS02 mode<label id="45GS02-mode"><p>
|
||||
|
||||
The 45GS02 is a microcontroller that is the core of the MEGA65.
|
||||
It is an extension of the 4510 CPU and adds 32-bit addressing and a 32-bit
|
||||
pseudo register Q that is comprised of the four registers A, X, Y, and Z.
|
||||
|
||||
<sect2>HUC6280 mode (CMOS with Hudson extensions)<label id="HUC6280-mode"><p>
|
||||
|
||||
The HUC6280 is a superset of 65C02, used in the PC Engine.
|
||||
|
||||
|
||||
<sect2>M740 mode<label id="M740-mode"><p>
|
||||
|
||||
The M740 is a microcontroller by Mitsubishi, which was marketed for embedded
|
||||
devices in the mid 80s. It is a superset of 6502, and a subset of 65SC02, plus
|
||||
some new instructions.
|
||||
|
||||
For more information about the M740 Controllers, see
|
||||
<url url="https://en.wikipedia.org/wiki/Mitsubishi_740" name="Wikipedia">.
|
||||
|
||||
|
||||
<sect2>65816 mode<label id="65816-mode"><p><p>
|
||||
|
||||
In 65816 mode, several aliases are accepted, in addition to the official
|
||||
mnemonics:
|
||||
@@ -479,57 +636,15 @@ or two far addresses whose high byte will be used.
|
||||
mvp $123456, $789ABC ; bank $12 to $78
|
||||
</verb></tscreen>
|
||||
|
||||
|
||||
<sect1>6502X mode<label id="6502X-mode"><p>
|
||||
|
||||
6502X mode is an extension to the normal 6502 mode. In this mode, several
|
||||
mnemonics for illegal instructions of the NMOS 6502 CPUs are accepted. Since
|
||||
these instructions are illegal, there are no official mnemonics for them. The
|
||||
unofficial ones are taken from <url
|
||||
url="http://www.oxyron.de/html/opcodes02.html">. Please note that only the
|
||||
ones marked as "stable" are supported. The following table uses information
|
||||
from the mentioned web page, for more information, see there.
|
||||
|
||||
<itemize>
|
||||
<item><tt>ALR: A:=(A and #{imm})/2;</tt>
|
||||
<item><tt>ANC: A:=A and #{imm};</tt> Generates opcode $0B.
|
||||
<item><tt>ARR: A:=(A and #{imm})/2;</tt>
|
||||
<item><tt>AXS: X:=A and X-#{imm};</tt>
|
||||
<item><tt>DCP: {adr}:={adr}-1; A-{adr};</tt>
|
||||
<item><tt>ISC: {adr}:={adr}+1; A:=A-{adr};</tt>
|
||||
<item><tt>LAS: A,X,S:={adr} and S;</tt>
|
||||
<item><tt>LAX: A,X:={adr};</tt>
|
||||
<item><tt>RLA: {adr}:={adr}rol; A:=A and {adr};</tt>
|
||||
<item><tt>RRA: {adr}:={adr}ror; A:=A adc {adr};</tt>
|
||||
<item><tt>SAX: {adr}:=A and X;</tt>
|
||||
<item><tt>SLO: {adr}:={adr}*2; A:=A or {adr};</tt>
|
||||
<item><tt>SRE: {adr}:={adr}/2; A:=A xor {adr};</tt>
|
||||
</itemize>
|
||||
also see <ref id="long_jsr_jmp_rts" name="long_jsr_jmp_rts">
|
||||
<ref id=".SMART" name=".SMART">
|
||||
<ref id=".A8" name=".A8">
|
||||
<ref id=".A16" name=".A16">
|
||||
<ref id=".I8" name=".I8">
|
||||
<ref id=".I16" name=".I16">
|
||||
|
||||
|
||||
<sect1>4510 mode<p>
|
||||
|
||||
The 4510 is a microcontroller that is the core of the Commodore C65 aka C64DX.
|
||||
It contains among other functions a slightly modified 65CE02/4502 CPU, to allow
|
||||
address mapping for 20 bits of address space (1 megabyte addressable area).
|
||||
As compared to the description of the CPU in the
|
||||
<url url="http://www.zimmers.net/anonftp/pub/cbm/c65/c65manualupdated.txt.gz"
|
||||
name="C65 System Specification">
|
||||
<url url="https://raw.githubusercontent.com/MEGA65/c65-specifications/master/c65manualupdated.txt"
|
||||
name="(updated version)"> uses these changes:
|
||||
<itemize>
|
||||
<item><tt>LDA (d,SP),Y</tt> may also be written as <tt>LDA (d,S),Y</tt>
|
||||
(matching the 65816 notataion).
|
||||
<item>All branch instruction allow now 16 bit offsets. To use a 16 bit
|
||||
branch you have to prefix these with an "L" (e.g. "<tt>LBNE</tt>" instead of
|
||||
"<tt>BNE</tt>"). This might change at a later implementation of the assembler.
|
||||
</itemize>
|
||||
For more information about the Commodore C65/C64DX and the 4510 CPU, see
|
||||
<url url="http://www.zimmers.net/anonftp/pub/cbm/c65/"> and
|
||||
<url url="https://en.wikipedia.org/wiki/Commodore_65" name="Wikipedia">.
|
||||
|
||||
|
||||
<sect1>sweet16 mode<label id="sweet16-mode"><p>
|
||||
<sect2>sweet16 mode<label id="sweet16-mode"><p>
|
||||
|
||||
SWEET 16 is an interpreter for a pseudo 16 bit CPU written by Steve Wozniak
|
||||
for the Apple ][ machines. It is available in the Apple ][ ROM. ca65 can
|
||||
@@ -3234,12 +3349,30 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
|
||||
(see <tt><ref id=".P02" name=".P02"></tt> command).
|
||||
|
||||
|
||||
<sect1><tt>.IFP02X</tt><label id=".IFP02X"><p>
|
||||
|
||||
Conditional assembly: Check if the assembler is currently in 6502X mode
|
||||
(see <tt><ref id=".P02X" name=".P02X"></tt> command).
|
||||
|
||||
|
||||
<sect1><tt>.IFP4510</tt><label id=".IFP4510"><p>
|
||||
|
||||
Conditional assembly: Check if the assembler is currently in 4510 mode
|
||||
(see <tt><ref id=".P4510" name=".P4510"></tt> command).
|
||||
|
||||
|
||||
<sect1><tt>.IFP45GS02</tt><label id=".IFP45GS02"><p>
|
||||
|
||||
Conditional assembly: Check if the assembler is currently in 45GS02 mode
|
||||
(see <tt><ref id=".P45GS02" name=".P45GS02"></tt> command).
|
||||
|
||||
|
||||
<sect1><tt>.IFP6280</tt><label id=".IFP816"><p>
|
||||
|
||||
Conditional assembly: Check if the assembler is currently in HuC6280 mode
|
||||
(see <tt><ref id=".P6280" name=".P6280"></tt> command).
|
||||
|
||||
|
||||
<sect1><tt>.IFP816</tt><label id=".IFP816"><p>
|
||||
|
||||
Conditional assembly: Check if the assembler is currently in 65816 mode
|
||||
@@ -3252,18 +3385,36 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
|
||||
(see <tt><ref id=".PC02" name=".PC02"></tt> command).
|
||||
|
||||
|
||||
<sect1><tt>.IFPCE02</tt><label id=".IFPCE02"><p>
|
||||
|
||||
Conditional assembly: Check if the assembler is currently in 65CE02 mode
|
||||
(see <tt><ref id=".PCE02" name=".PCE02"></tt> command).
|
||||
|
||||
|
||||
<sect1><tt>.IFPDTV</tt><label id=".IFPDTV"><p>
|
||||
|
||||
Conditional assembly: Check if the assembler is currently in 6502DTV mode
|
||||
(see <tt><ref id=".PDTV" name=".PDTV"></tt> command).
|
||||
|
||||
|
||||
<sect1><tt>.IFPM740</tt><label id=".IFPM740"><p>
|
||||
|
||||
Conditional assembly: Check if the assembler is currently in M740 mode
|
||||
(see <tt><ref id=".PM740" name=".PM740"></tt> command).
|
||||
|
||||
|
||||
<sect1><tt>.IFPSC02</tt><label id=".IFPSC02"><p>
|
||||
|
||||
Conditional assembly: Check if the assembler is currently in 65SC02 mode
|
||||
(see <tt><ref id=".PSC02" name=".PSC02"></tt> command).
|
||||
|
||||
|
||||
<sect1><tt>.IFPSWEET16</tt><label id=".IFPSWEET16"><p>
|
||||
|
||||
Conditional assembly: Check if the assembler is currently in Sweet16 mode
|
||||
(see <tt><ref id=".PSWEET16" name=".PSWEET16"></tt> command).
|
||||
|
||||
|
||||
<sect1><tt>.IFREF</tt><label id=".IFREF"><p>
|
||||
|
||||
Conditional assembly: Check if a symbol is referenced. Must be followed
|
||||
@@ -3287,6 +3438,12 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
|
||||
<tt><ref id=".REFERTO" name=".REFERTO"></tt>
|
||||
|
||||
|
||||
<sect1><tt>.IFPWC02</tt><label id=".IFPWC02"><p>
|
||||
|
||||
Conditional assembly: Check if the assembler is currently in 65WC02 mode
|
||||
(see <tt><ref id=".PWC02" name=".PWC02"></tt> command).
|
||||
|
||||
|
||||
<sect1><tt>.IMPORT</tt><label id=".IMPORT"><p>
|
||||
|
||||
Import a symbol from another module. The command is followed by a comma
|
||||
@@ -3616,6 +3773,17 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".BYTE" name=".BYTE"
|
||||
instructions. This is the default if not overridden by the
|
||||
<tt><ref id="option--cpu" name="--cpu"></tt> command line option.
|
||||
|
||||
See: <tt><ref id=".PC02" name=".PC02"></tt>, <tt><ref id=".PSC02"
|
||||
name=".PSC02"></tt>, <tt><ref id=".P816" name=".P816"></tt>,
|
||||
<tt><ref id=".P4510" name=".P4510"></tt>, and
|
||||
<tt><ref id=".P45GS02" name=".P45GS02"></tt>
|
||||
|
||||
|
||||
<sect1><tt>.P02X</tt><label id=".P02X"><p>
|
||||
|
||||
Enable the 6502X instruction set, disable 65SC02, 65C02 and 65816
|
||||
instructions.
|
||||
|
||||
See: <tt><ref id=".PC02" name=".PC02"></tt>, <tt><ref id=".PSC02"
|
||||
name=".PSC02"></tt>, <tt><ref id=".P816" name=".P816"></tt> and
|
||||
<tt><ref id=".P4510" name=".P4510"></tt>
|
||||
@@ -3627,8 +3795,31 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".BYTE" name=".BYTE"
|
||||
6502 instruction sets.
|
||||
|
||||
See: <tt><ref id=".P02" name=".P02"></tt>, <tt><ref id=".PSC02"
|
||||
name=".PSC02"></tt>, <tt><ref id=".PC02" name=".PC02"></tt> and
|
||||
<tt><ref id=".P816" name=".P816"></tt>
|
||||
name=".PSC02"></tt>, <tt><ref id=".PC02" name=".PC02"></tt>,
|
||||
<tt><ref id=".P816" name=".P816"></tt>, and
|
||||
<tt><ref id=".P45GS02" name=".P45GS02"></tt>
|
||||
|
||||
|
||||
<sect1><tt>.P45GS02</tt><label id=".P45GS02"><p>
|
||||
|
||||
Enable the 45GS02 instruction set. This is a superset of the 4510, 65C02, and
|
||||
6502 instruction sets.
|
||||
|
||||
See: <tt><ref id=".P02" name=".P02"></tt>, <tt><ref id=".PSC02"
|
||||
name=".PSC02"></tt>, <tt><ref id=".PC02" name=".PC02"></tt>,
|
||||
<tt><ref id=".P816" name=".P816"></tt>, and
|
||||
<tt><ref id=".P4510" name=".P4510"></tt>
|
||||
|
||||
|
||||
<sect1><tt>.P6280</tt><label id=".P6280"><p>
|
||||
|
||||
Enable the HuC6280 instruction set. This is a superset of the 65C02 and
|
||||
6502 instruction sets.
|
||||
|
||||
See: <tt><ref id=".P02" name=".P02"></tt>, <tt><ref id=".PSC02"
|
||||
name=".PSC02"></tt>, <tt><ref id=".PC02" name=".PC02"></tt>,
|
||||
<tt><ref id=".P4510" name=".P4510"></tt>, and
|
||||
<tt><ref id=".P45GS02" name=".P45GS02"></tt>
|
||||
|
||||
|
||||
<sect1><tt>.P816</tt><label id=".P816"><p>
|
||||
@@ -3637,8 +3828,9 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".BYTE" name=".BYTE"
|
||||
6502 instruction sets.
|
||||
|
||||
See: <tt><ref id=".P02" name=".P02"></tt>, <tt><ref id=".PSC02"
|
||||
name=".PSC02"></tt>, <tt><ref id=".PC02" name=".PC02"></tt> and
|
||||
<tt><ref id=".P4510" name=".P4510"></tt>
|
||||
name=".PSC02"></tt>, <tt><ref id=".PC02" name=".PC02"></tt>,
|
||||
<tt><ref id=".P4510" name=".P4510"></tt>, and
|
||||
<tt><ref id=".P45GS02" name=".P45GS02"></tt>
|
||||
|
||||
|
||||
<sect1><tt>.PAGELEN, .PAGELENGTH</tt><label id=".PAGELENGTH"><p>
|
||||
@@ -3666,8 +3858,19 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".BYTE" name=".BYTE"
|
||||
6502 and 65SC02 instructions.
|
||||
|
||||
See: <tt><ref id=".P02" name=".P02"></tt>, <tt><ref id=".PSC02"
|
||||
name=".PSC02"></tt>, <tt><ref id=".P816" name=".P816"></tt> and
|
||||
<tt><ref id=".P4510" name=".P4510"></tt>
|
||||
name=".PSC02"></tt>, <tt><ref id=".P816" name=".P816"></tt>,
|
||||
<tt><ref id=".P4510" name=".P4510"></tt>, and
|
||||
<tt><ref id=".P45GS02" name=".P45GS02"></tt>
|
||||
|
||||
<sect1><tt>.PCE02</tt><label id=".PCE02"><p>
|
||||
|
||||
Enable the 65CE02 instructions set. This instruction set includes all
|
||||
6502 and extended 65CE02 instructions.
|
||||
|
||||
See: <tt><ref id=".P02" name=".P02"></tt>, <tt><ref id=".PSC02"
|
||||
name=".PSC02"></tt>, <tt><ref id=".P816" name=".P816"></tt>,
|
||||
<tt><ref id=".P4510" name=".P4510"></tt>, and
|
||||
<tt><ref id=".P45GS02" name=".P45GS02"></tt>
|
||||
|
||||
|
||||
<sect1><tt>.PDTV</tt><label id=".PDTV"><p>
|
||||
@@ -3678,6 +3881,14 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".BYTE" name=".BYTE"
|
||||
See: <tt><ref id=".P02" name=".P02"></tt>
|
||||
|
||||
|
||||
<sect1><tt>.PM740</tt><label id=".PM740"><p>
|
||||
|
||||
Enable the M740 instruction set. This is a superset of the 6502
|
||||
instruction set.
|
||||
|
||||
See: <tt><ref id=".P02" name=".P02"></tt>
|
||||
|
||||
|
||||
<sect1><tt>.POPCHARMAP</tt><label id=".POPCHARMAP"><p>
|
||||
|
||||
Pop the last character mapping from the stack, and activate it.
|
||||
@@ -3763,8 +3974,19 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".BYTE" name=".BYTE"
|
||||
6502 instructions.
|
||||
|
||||
See: <tt><ref id=".P02" name=".P02"></tt>, <tt><ref id=".PC02"
|
||||
name=".PC02"></tt>, <tt><ref id=".P816" name=".P816"></tt> and
|
||||
<tt><ref id=".P4510" name=".P4510"></tt>
|
||||
name=".PC02"></tt>, <tt><ref id=".P816" name=".P816"></tt>,
|
||||
<tt><ref id=".P4510" name=".P4510"></tt>, and
|
||||
<tt><ref id=".P45GS02" name=".P45GS02"></tt>
|
||||
|
||||
|
||||
<sect1><tt>.PSWEET16</tt><label id=".PSWEET16"><p>
|
||||
|
||||
Enable the Sweet16 instructions set.
|
||||
|
||||
See: <tt><ref id=".P02" name=".P02"></tt>, <tt><ref id=".PC02"
|
||||
name=".PC02"></tt>, <tt><ref id=".P816" name=".P816"></tt>,
|
||||
<tt><ref id=".P4510" name=".P4510"></tt>, and
|
||||
<tt><ref id=".P45GS02" name=".P45GS02"></tt>
|
||||
|
||||
|
||||
<sect1><tt>.PUSHCHARMAP</tt><label id=".PUSHCHARMAP"><p>
|
||||
@@ -3815,6 +4037,17 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".BYTE" name=".BYTE"
|
||||
See: <tt><ref id=".POPSEG" name=".POPSEG"></tt>
|
||||
|
||||
|
||||
<sect1><tt>.PWC02</tt><label id=".PWC02"><p>
|
||||
|
||||
Enable the W65C02 instructions set. This instruction set includes all
|
||||
6502, 65SC02, 65C02 and two extra instructions (wai and stp)
|
||||
|
||||
See: <tt><ref id=".P02" name=".P02"></tt>, <tt><ref id=".PSC02"
|
||||
name=".PSC02"></tt>, <tt><ref id=".P816" name=".P816"></tt>,
|
||||
<tt><ref id=".P4510" name=".P4510"></tt>, and
|
||||
<tt><ref id=".P45GS02" name=".P45GS02"></tt>
|
||||
|
||||
|
||||
<sect1><tt>.REFERTO, .REFTO</tt><label id=".REFERTO"><p>
|
||||
|
||||
Mark a symbol as referenced.
|
||||
@@ -4012,18 +4245,23 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".BYTE" name=".BYTE"
|
||||
Switch the CPU instruction set. The command is followed by a string that
|
||||
specifies the CPU. Possible values are those that can also be supplied to
|
||||
the <tt><ref id="option--cpu" name="--cpu"></tt> command line option,
|
||||
namely: 6502, 6502X, 6502DTV, 65SC02, 65C02, 65816, 4510 and HuC6280.
|
||||
namely: 6502, 6502X, 6502DTV, 65SC02, 65C02, 65816, 4510, 45GS02, HuC6280 and m740.
|
||||
|
||||
See: <tt><ref id=".CPU" name=".CPU"></tt>,
|
||||
<tt><ref id=".IFP02" name=".IFP02"></tt>,
|
||||
<tt><ref id=".IFP02X" name=".IFP02X"></tt>,
|
||||
<tt><ref id=".IFPDTV" name=".IFPDTV"></tt>,
|
||||
<tt><ref id=".IFP816" name=".IFP816"></tt>,
|
||||
<tt><ref id=".IFPC02" name=".IFPC02"></tt>,
|
||||
<tt><ref id=".IFPM740" name=".IFPM740"></tt>,
|
||||
<tt><ref id=".IFPSC02" name=".IFPSC02"></tt>,
|
||||
<tt><ref id=".P02" name=".P02"></tt>,
|
||||
<tt><ref id=".P02X" name=".P02X"></tt>,
|
||||
<tt><ref id=".P816" name=".P816"></tt>,
|
||||
<tt><ref id=".P4510" name=".P4510"></tt>,
|
||||
<tt><ref id=".P45GS02" name=".P45GS02"></tt>,
|
||||
<tt><ref id=".PC02" name=".PC02"></tt>,
|
||||
<tt><ref id=".PM740" name=".PM740"></tt>,
|
||||
<tt><ref id=".PSC02" name=".PSC02"></tt>
|
||||
|
||||
|
||||
@@ -4761,7 +4999,9 @@ each supported CPU a constant similar to
|
||||
CPU_SWEET16
|
||||
CPU_HUC6280
|
||||
CPU_4510
|
||||
CPU_45GS02
|
||||
CPU_6502DTV
|
||||
CPU_M740
|
||||
</verb></tscreen>
|
||||
|
||||
is defined. These constants may be used to determine the exact type of the
|
||||
@@ -4776,7 +5016,9 @@ another constant is defined:
|
||||
CPU_ISET_SWEET16
|
||||
CPU_ISET_HUC6280
|
||||
CPU_ISET_4510
|
||||
CPU_ISET_45GS02
|
||||
CPU_ISET_6502DTV
|
||||
CPU_ISET_M740
|
||||
</verb></tscreen>
|
||||
|
||||
The value read from the <tt/<ref id=".CPU" name=".CPU">/ pseudo variable may
|
||||
@@ -4788,22 +5030,23 @@ bit. Using
|
||||
|
||||
<tscreen><verb>
|
||||
.if (.cpu .bitand CPU_ISET_65SC02)
|
||||
lda (sp)
|
||||
lda (c_sp)
|
||||
.else
|
||||
ldy #$00
|
||||
lda (sp),y
|
||||
lda (c_sp),y
|
||||
.endif
|
||||
</verb></tscreen>
|
||||
|
||||
it is possible to determine if the
|
||||
|
||||
<tscreen><verb>
|
||||
lda (sp)
|
||||
lda (c_sp)
|
||||
</verb></tscreen>
|
||||
|
||||
instruction is supported, which is the case for the 65SC02, 65C02 and 65816
|
||||
CPUs (the latter two are upwards compatible to the 65SC02).
|
||||
|
||||
see section <ref id="6502-mode" name="6502 format"> and following.
|
||||
|
||||
<sect1><tt>.MACPACK module</tt><p>
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ All other parameters will be pushed to the C-stack from left to right.
|
||||
The rightmost parameter will have the lowest address on the stack,
|
||||
and multi-byte parameters will have their least significant byte at the lower address.
|
||||
|
||||
The <tt/sp/ pseudo-register is a zeropage pointer to the base of the C-stack.
|
||||
The <tt/c_sp/ pseudo-register is a zeropage pointer to the base of the C-stack.
|
||||
If the function is variadic, the <tt/Y/ register will contain the number of
|
||||
bytes pushed to the stack for this function.
|
||||
|
||||
@@ -153,10 +153,10 @@ void cdecl foo(unsigned bar, unsigned char baz);
|
||||
; Example code for accessing bar. The variable is in A/X after this code snippet:
|
||||
;
|
||||
ldy #2 ; Offset of high byte of bar
|
||||
lda (sp),y ; High byte now in A
|
||||
lda (c_sp),y ; High byte now in A
|
||||
tax ; High byte now in X
|
||||
dey ; Offset of low byte of bar
|
||||
lda (sp),y ; Low byte now in A
|
||||
lda (c_sp),y ; Low byte now in A
|
||||
</verb></tscreen>
|
||||
|
||||
<sect1>Epilogue, after the function call<p>
|
||||
@@ -175,12 +175,12 @@ used if the return type is 32-bit.
|
||||
If the function has a void return type, the compiler will not depend on the result
|
||||
of <tt>A/X/sreg</tt>, so these may be clobbered by the function.
|
||||
|
||||
The C-stack pointer <tt/sp/ must be restored by the function to its value before the
|
||||
The C-stack pointer <tt/c_sp/ must be restored by the function to its value before the
|
||||
function call prologue. It may pop all of its parameters from the C-stack
|
||||
(e.g. using the <tt/runtime/ function <tt/popa/),
|
||||
or it could adjust <tt/sp/ directly.
|
||||
or it could adjust <tt/c_sp/ directly.
|
||||
If the function is variadic, the <tt/Y/ register contains the number of bytes
|
||||
pushed to the stack on entry, which may be added to <tt/sp/ to restore its
|
||||
pushed to the stack on entry, which may be added to <tt/c_sp/ to restore its
|
||||
original state.
|
||||
|
||||
The internal pseudo-register <tt/regbank/ must not be changed by the function.
|
||||
|
||||
167
doc/cc65.sgml
167
doc/cc65.sgml
@@ -63,6 +63,8 @@ Short options:
|
||||
-V Print the compiler version number
|
||||
-W [-+]warning[,...] Control warnings ('-' disables, '+' enables)
|
||||
-d Debug mode
|
||||
-dM Output all user macros (needs -E)
|
||||
-dP Output all predefined macros (needs -E)
|
||||
-g Add debug info to object file
|
||||
-h Help (this text)
|
||||
-j Default characters are signed
|
||||
@@ -199,6 +201,28 @@ Here is a description of all the command line options:
|
||||
Enables debug mode, for debugging the behavior of cc65.
|
||||
|
||||
|
||||
|
||||
<label id="option-dM">
|
||||
<tag><tt>-dM</tt></tag>
|
||||
|
||||
When used with -E, will output <tt>#define</tt> directives for all the user
|
||||
macros defined during execution of the preprocessor. This does not include
|
||||
macros defined by the compiler.
|
||||
|
||||
Note: Can be combined with <tt/<ref id="option-dP" name="-dP">/ by using
|
||||
<tt/-dMP/.
|
||||
|
||||
|
||||
<label id="option-dP">
|
||||
<tag><tt>-dP</tt></tag>
|
||||
|
||||
When used with -E, will output <tt>#define</tt> directives for all the macros
|
||||
defined by the compiler itself. This does not include any user defined macros.
|
||||
|
||||
Note: Can be combined with <tt/<ref id="option-dM" name="-dM">/ by using
|
||||
<tt/-dMP/.
|
||||
|
||||
|
||||
<tag><tt>--debug-tables name</tt></tag>
|
||||
|
||||
Writes symbol table information to a file, which includes details on structs, unions
|
||||
@@ -586,27 +610,42 @@ Here is a description of all the command line options:
|
||||
|
||||
<itemize>
|
||||
<item>none
|
||||
<item>agat (a russian apple2 like computer)
|
||||
<item>apple2
|
||||
<item>apple2enh
|
||||
<item>atari
|
||||
<item>atari2600
|
||||
<item>atari5200
|
||||
<item>atari7800
|
||||
<item>atarixl
|
||||
<item>atmos
|
||||
<item>bbc
|
||||
<item>c16 (works also for the c116 with memory up to 32K)
|
||||
<item>c64
|
||||
<item>c65
|
||||
<item>c128
|
||||
<item>cbm510 (CBM-II series with 40 column video)
|
||||
<item>cbm610 (all CBM-II II computers with 80 column video)
|
||||
<item>creativision
|
||||
<item>cx16
|
||||
<item>gamate
|
||||
<item>geos-apple
|
||||
<item>geos-cbm
|
||||
<item>geos (alias for geos-cbm)
|
||||
<item>kim1
|
||||
<item>lunix
|
||||
<item>lynx
|
||||
<item>mega65
|
||||
<item>nes
|
||||
<item>osic1p
|
||||
<item>pce (PC engine)
|
||||
<item>pet (all CBM PET systems except the 2001)
|
||||
<item>plus4
|
||||
<item>p6502
|
||||
<item>sim6502
|
||||
<item>sim65c02
|
||||
<item>supervision
|
||||
<item>sym1
|
||||
<item>telestrat
|
||||
<item>vic20
|
||||
</itemize>
|
||||
@@ -1154,6 +1193,134 @@ The compiler defines several macros at startup:
|
||||
<item><tt/__CC65_STD_CC65__/
|
||||
</itemize>
|
||||
|
||||
<label id="macro-CPU">
|
||||
<tag><tt>__CPU__</tt></tag>
|
||||
|
||||
This macro contains a bitset that allows to check if a specific instruction
|
||||
set is supported. For example, the 65C02 CPU supports all instructions of the
|
||||
65SC02. So testing for the instruction set of the 65SC02 using the following
|
||||
check will succeed for both CPUs (and also for the 65816 and HUC6280).
|
||||
|
||||
<tscreen><verb>
|
||||
#if (__CPU__ & __CPU_ISET_65SC02__)
|
||||
</verb></tscreen>
|
||||
|
||||
This is much simpler and more future proof than checking for specific CPUs.
|
||||
|
||||
The compiler defines a set of constants named <tt/__CPU_ISET_xxx/ to do the
|
||||
checks. The <tt/__CPU__/ variable is usually derived from the target system
|
||||
given, but can be changed using the <tt/<ref id="option--cpu" name="--cpu">/
|
||||
command line option.
|
||||
|
||||
<tag><tt>__CPU_4510__</tt></tag>
|
||||
|
||||
This macro is defined if the code is compiled for a 4510 CPU.
|
||||
|
||||
<tag><tt>__CPU_45GS02__</tt></tag>
|
||||
|
||||
This macro is defined if the code is compiled for a 45GS02 CPU.
|
||||
|
||||
<tag><tt>__CPU_6502__</tt></tag>
|
||||
|
||||
This macro is defined if the code is compiled for a 6502 CPU.
|
||||
|
||||
<tag><tt>__CPU_6502X__</tt></tag>
|
||||
|
||||
This macro is defined if the code is compiled for a 6502 CPU with invalid
|
||||
opcodes.
|
||||
|
||||
<tag><tt>__CPU_6502DTV__</tt></tag>
|
||||
|
||||
This macro is defined if the code is compiled for a DTV CPU.
|
||||
|
||||
<tag><tt>__CPU_65SC02__</tt></tag>
|
||||
|
||||
This macro is defined if the code is compiled for a 65SC02 CPU.
|
||||
|
||||
<tag><tt>__CPU_65C02__</tt></tag>
|
||||
|
||||
This macro is defined if the code is compiled for a 65C02 CPU.
|
||||
|
||||
<tag><tt>__CPU_65CE02__</tt></tag>
|
||||
|
||||
This macro is defined if the code is compiled for a 65CE02 CPU.
|
||||
|
||||
<tag><tt>__CPU_65816__</tt></tag>
|
||||
|
||||
This macro is defined if the code is compiled for a 65816 CPU.
|
||||
|
||||
<tag><tt>__CPU_HUC6280__</tt></tag>
|
||||
|
||||
This macro is defined if the code is compiled for a HUC6280 CPU.
|
||||
|
||||
<tag><tt>__CPU_M740__</tt></tag>
|
||||
|
||||
This macro is defined if the code is compiled for a M740 CPU.
|
||||
|
||||
<tag><tt>__CPU_W65C02__</tt></tag>
|
||||
|
||||
This macro is defined if the code is compiled for a W65C02 CPU.
|
||||
|
||||
<tag><tt>__CPU_ISET_6502__</tt></tag>
|
||||
|
||||
This macro expands to a numeric constant that can be used to check the
|
||||
<tt/<ref id="macro-CPU" name="__CPU__">/ macro for the instruction set
|
||||
of the 6502 CPU.
|
||||
|
||||
<tag><tt>__CPU_ISET_6502X__</tt></tag>
|
||||
|
||||
This macro expands to a numeric constant that can be used to check the
|
||||
<tt/<ref id="macro-CPU" name="__CPU__">/ macro for the instruction set
|
||||
of the 6502X CPU.
|
||||
|
||||
<tag><tt>__CPU_ISET_6502DTV__</tt></tag>
|
||||
|
||||
This macro expands to a numeric constant that can be used to check the
|
||||
<tt/<ref id="macro-CPU" name="__CPU__">/ macro for the instruction set
|
||||
of the 6502DTV CPU.
|
||||
|
||||
<tag><tt>__CPU_ISET_65SC02__</tt></tag>
|
||||
|
||||
This macro expands to a numeric constant that can be used to check the
|
||||
<tt/<ref id="macro-CPU" name="__CPU__">/ macro for the instruction set
|
||||
of the 65SC02 CPU.
|
||||
|
||||
<tag><tt>__CPU_ISET_65C02__</tt></tag>
|
||||
|
||||
This macro expands to a numeric constant that can be used to check the
|
||||
<tt/<ref id="macro-CPU" name="__CPU__">/ macro for the instruction set
|
||||
of the 65C02 CPU.
|
||||
|
||||
<tag><tt>__CPU_ISET_65CE02__</tt></tag>
|
||||
|
||||
This macro expands to a numeric constant that can be used to check the
|
||||
<tt/<ref id="macro-CPU" name="__CPU__">/ macro for the instruction set
|
||||
of the 65CE02 CPU.
|
||||
|
||||
<tag><tt>__CPU_ISET_65816__</tt></tag>
|
||||
|
||||
This macro expands to a numeric constant that can be used to check the
|
||||
<tt/<ref id="macro-CPU" name="__CPU__">/ macro for the instruction set
|
||||
of the 65816 CPU.
|
||||
|
||||
<tag><tt>__CPU_ISET_HUC6280__</tt></tag>
|
||||
|
||||
This macro expands to a numeric constant that can be used to check the
|
||||
<tt/<ref id="macro-CPU" name="__CPU__">/ macro for the instruction set
|
||||
of the HUC6280 CPU.
|
||||
|
||||
<tag><tt>__CPU_ISET_M740__</tt></tag>
|
||||
|
||||
This macro expands to a numeric constant that can be used to check the
|
||||
<tt/<ref id="macro-CPU" name="__CPU__">/ macro for the instruction set
|
||||
of the M740 CPU.
|
||||
|
||||
<tag><tt>__CPU_ISET_W65C02__</tt></tag>
|
||||
|
||||
This macro expands to a numeric constant that can be used to check the
|
||||
<tt/<ref id="macro-CPU" name="__CPU__">/ macro for the instruction set
|
||||
of the W65C02 CPU.
|
||||
|
||||
<tag><tt>__CX16__</tt></tag>
|
||||
|
||||
This macro is defined if the target is the Commander X16 (-t cx16).
|
||||
|
||||
1082
doc/cpus.sgml
Normal file
1082
doc/cpus.sgml
Normal file
File diff suppressed because it is too large
Load Diff
@@ -193,9 +193,9 @@ _init: LDX #$FF ; Initialize stack pointer to $01FF
|
||||
; Set cc65 argument stack pointer
|
||||
|
||||
LDA #<(__RAM_START__ + __RAM_SIZE__)
|
||||
STA sp
|
||||
STA c_sp
|
||||
LDA #>(__RAM_START__ + __RAM_SIZE__)
|
||||
STA sp+1
|
||||
STA c_sp+1
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Initialize memory storage
|
||||
|
||||
115
doc/da65.sgml
115
doc/da65.sgml
@@ -46,14 +46,16 @@ The assembler accepts the following options:
|
||||
---------------------------------------------------------------------------
|
||||
Usage: da65 [options] [inputfile]
|
||||
Short options:
|
||||
-d Debug mode
|
||||
-g Add debug info to object file
|
||||
-h Help (this text)
|
||||
-i name Specify an info file
|
||||
-m Run multiple passes to resolve labels
|
||||
-o name Name the output file
|
||||
-v Increase verbosity
|
||||
-F Add formfeeds to the output
|
||||
-s Accept line markers in the info file
|
||||
-S addr Set the start/load address
|
||||
-s Accept line markers in the info file
|
||||
-V Print the disassembler version
|
||||
|
||||
Long options:
|
||||
@@ -61,6 +63,7 @@ Long options:
|
||||
--comment-column n Specify comment start column
|
||||
--comments n Set the comment level for the output
|
||||
--cpu type Set cpu type
|
||||
--debug Debug mode
|
||||
--debug-info Add debug info to object file
|
||||
--formfeeds Add formfeeds to the output
|
||||
--help Help (this text)
|
||||
@@ -68,6 +71,7 @@ Long options:
|
||||
--info name Specify an info file
|
||||
--label-break n Add newline if label exceeds length n
|
||||
--mnemonic-column n Specify mnemonic start column
|
||||
--multi-pass Run multiple passes to resolve labels
|
||||
--pagelength n Set the page length for the listing
|
||||
--start-addr addr Set the start/load address
|
||||
--sync-lines Accept line markers in the info file
|
||||
@@ -110,19 +114,23 @@ Here is a description of all the command line options:
|
||||
|
||||
Set the CPU type. The option takes a parameter, which may be one of
|
||||
<itemize>
|
||||
<item>6502
|
||||
<item>6502x
|
||||
<item>6502dtv
|
||||
<item>65sc02
|
||||
<item>65c02
|
||||
<item>65816
|
||||
<item>huc6280
|
||||
<item>4510
|
||||
<item>6502 - NMOS 6502 (all legal instructions)
|
||||
<item>6502X - NMOS 6502 with all undocumented instructions
|
||||
<item>6502DTV - the emulated CPU of the C64DTV device
|
||||
<item>65SC02 - first CMOS instruction set (no bit manipulation, no wai/stp)
|
||||
<item>65C02 - full CMOS instruction set (has bit manipulation and wai/stp)
|
||||
<item>65816 - the CPU of the SNES, and the SCPU
|
||||
<item>HuC6280 - the CPU of the PC engine
|
||||
<item>4510 - the CPU of the Commodore C65
|
||||
<item>45GS02 - the CPU of the Commodore MEGA65
|
||||
<item>M740 - a Microcontroller by Mitsubishi
|
||||
</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. 65816 is the CPU of the SNES.
|
||||
|
||||
<tag><tt>-d, --debug</tt></tag>
|
||||
|
||||
Enables debug mode, something that should not be needed for mere
|
||||
mortals:-)
|
||||
|
||||
|
||||
<label id="option--formfeeds">
|
||||
@@ -181,6 +189,15 @@ Here is a description of all the command line options:
|
||||
<tt><ref id="LABELBREAK" name="LABELBREAK"></tt>.
|
||||
|
||||
|
||||
<tag><tt>-m, --multi-pass</tt></tag>
|
||||
|
||||
This option causes the disassembler to run multiple passes over the input
|
||||
binary to find and create all necessary labels. Without this option the
|
||||
disassembler may detect the necessity for a label in the final pass, when
|
||||
output was already partially generated. It will output numerical addresses
|
||||
or program counter relative expressions in this case.
|
||||
|
||||
|
||||
<label id="option--mnemonic-column">
|
||||
<tag><tt>--mnemonic-column n</tt></tag>
|
||||
|
||||
@@ -246,23 +263,85 @@ Here is a description of all the command line options:
|
||||
|
||||
<sect1>Supported CPUs<p>
|
||||
|
||||
With the command line option <tt><ref id="option--cpu" name="--cpu"></tt>, the
|
||||
disassembler may be told which CPU to support:
|
||||
|
||||
<itemize>
|
||||
<item>6502 - NMOS 6502 (all legal instructions)
|
||||
<item>6502X - NMOS 6502 with all undocumented instructions
|
||||
<item>6502DTV - the emulated CPU of the C64DTV device
|
||||
<item>65SC02 - first CMOS instruction set (no bit manipulation, no wai/stp)
|
||||
<item>65C02 - CMOS with Rockwell extensions
|
||||
<item>W65C02 - full CMOS instruction set (has bit manipulation and wai/stp)
|
||||
<item>65CE02 - CMOS with CSG extensions
|
||||
<item>4510 - the CPU of the Commodore C65
|
||||
<item>45GS02 - the CPU of the Commodore MEGA65
|
||||
<item>HuC6280 - the CPU of the PC engine
|
||||
<item>M740 - a Microcontroller by Mitsubishi
|
||||
<item>65816 - the CPU of the SNES, and the SCPU
|
||||
</itemize>
|
||||
|
||||
for more details on the various CPUs, see <tt><htmlurl url="cpus.html" name="here"></tt>.
|
||||
|
||||
|
||||
<sect2>6502 mode<label id="6502-mode"><p>
|
||||
|
||||
The default (no CPU given on the command line or in the <tt/GLOBAL/ section of
|
||||
the info file) is the 6502 CPU. The disassembler knows all "official" opcodes
|
||||
for this CPU. Invalid opcodes are translated into <tt/.byte/ commands.
|
||||
|
||||
With the command line option <tt><ref id="option--cpu" name="--cpu"></tt>, the
|
||||
disassembler may be told to recognize either the 65SC02 or 65C02 CPUs. The
|
||||
latter understands the same opcodes as the former, plus 16 additional bit
|
||||
manipulation and bit test-and-branch commands. Using 6502x as CPU the illegal
|
||||
opcodes of 6502 CPU are detected and displayed. 6502dtv setting recognizes the
|
||||
emulated CPU instructions of the C64DTV device.
|
||||
<sect2>6502X mode<label id="6502X-mode"><p>
|
||||
|
||||
Using 6502X as CPU the illegal opcodes of 6502 CPU are detected and displayed.
|
||||
|
||||
|
||||
<sect2>DTV mode<label id="DTV-mode"><p>
|
||||
|
||||
6502DTV setting recognizes the emulated CPU instructions of the C64DTV device.
|
||||
|
||||
|
||||
<sect2>65SC02 mode<label id="65SC02-mode"><p>
|
||||
|
||||
The first CMOS instruction set, without bit manipulation or wai/stp.
|
||||
|
||||
|
||||
<sect2>65C02 mode<label id="65C02-mode"><p>
|
||||
|
||||
The 65C02 understands the same opcodes as the 65SC02, plus 16 additional bit
|
||||
manipulation and bit test-and-branch commands.
|
||||
|
||||
<sect2>W65C02 mode<label id="W65C02-mode"><p>
|
||||
|
||||
This mode also supports wai/stp.
|
||||
|
||||
<sect2>65CE02 mode<label id="65CE02-mode"><p>
|
||||
|
||||
|
||||
<sect2>4510 mode<label id="4510-mode"><p>
|
||||
|
||||
When disassembling 4510 code, due to handling of 16-bit wide branches, da65
|
||||
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.
|
||||
|
||||
|
||||
<sect2>45GS02 mode<label id="45GS02-mode"><p>
|
||||
|
||||
All compound instructions are supported.
|
||||
|
||||
|
||||
<sect2>HUC6280 mode<label id="HUC6280-mode"><p>
|
||||
|
||||
All special opcodes are supported.
|
||||
|
||||
|
||||
<sect2>M740 mode<label id="M740-mode"><p>
|
||||
|
||||
All special opcodes are supported.
|
||||
|
||||
|
||||
<sect2>65816 mode<label id="65816-mode"><p><p>
|
||||
|
||||
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.
|
||||
|
||||
105
doc/funcref.sgml
105
doc/funcref.sgml
@@ -103,6 +103,8 @@ function.
|
||||
<item><ref id="gmtime_dt" name="gmtime_dt">
|
||||
<item><ref id="mktime_dt" name="mktime_dt">
|
||||
<item>rebootafterexit
|
||||
<item><ref id="videomode" name="videomode">
|
||||
<item><ref id="waitvsync" name="waitvsync">
|
||||
</itemize>
|
||||
|
||||
|
||||
@@ -118,6 +120,7 @@ function.
|
||||
<item><ref id="mktime_dt" name="mktime_dt">
|
||||
<item>rebootafterexit
|
||||
<item><ref id="videomode" name="videomode">
|
||||
<item><ref id="waitvsync" name="waitvsync">
|
||||
</itemize>
|
||||
|
||||
|
||||
@@ -286,6 +289,7 @@ function.
|
||||
<item><ref id="cclear" name="cclear">
|
||||
<item><ref id="cclearxy" name="cclearxy">
|
||||
<item><ref id="cgetc" name="cgetc">
|
||||
<item><ref id="cgets" name="cgets">
|
||||
<item><ref id="chline" name="chline">
|
||||
<item><ref id="chlinexy" name="chlinexy">
|
||||
<item><ref id="clrscr" name="clrscr">
|
||||
@@ -298,6 +302,7 @@ function.
|
||||
<item><ref id="cputcxy" name="cputcxy">
|
||||
<item><ref id="cputs" name="cputs">
|
||||
<item><ref id="cputsxy" name="cputsxy">
|
||||
<item><ref id="cscanf" name="cscanf">
|
||||
<item><ref id="cursor" name="cursor">
|
||||
<item><ref id="cvline" name="cvline">
|
||||
<item><ref id="cvlinexy" name="cvlinexy">
|
||||
@@ -2712,6 +2717,45 @@ see anything that you type. (See the description of <tt/cbm_k_scnkey()/.)
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>cgets<label id="cgets"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Input a string directly from the console.
|
||||
<tag/Header/<tt/<ref id="conio.h" name="conio.h">/
|
||||
<tag/Declaration/<tt/char* __fastcall__ cgets (const char* buffer, int size);/
|
||||
<tag/Description/The function inputs a string of at most <tt/size - 1/
|
||||
characters from the console into <tt/buffer/. It returns when <tt/size - 1/
|
||||
characters or either <tt/CR/ or <tt/LF/ are entered. It also handles both
|
||||
multi-line input and backspacing.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function echoes <tt/CRLF/ when either <tt/CR/ or <tt/LF/ are read
|
||||
but does NOT append either in <tt/buffer/.
|
||||
<item>The function is only available as fastcall function, so it may only
|
||||
be used in the presence of a prototype.
|
||||
</itemize>
|
||||
<tag/Availability/cc65
|
||||
<tag/See also/
|
||||
<ref id="cgetc" name="cgetc">,
|
||||
<ref id="cscanf" name="cscanf">
|
||||
<tag/Example/<verb>
|
||||
#include <conio.h>
|
||||
|
||||
int main (void)
|
||||
{
|
||||
char buffer[200], *p;
|
||||
|
||||
cputs ("Type a lot and backspace a lot: ");
|
||||
if (p = cgets (buffer, sizeof(buffer)))
|
||||
cputs (p);
|
||||
|
||||
return 0;
|
||||
}
|
||||
</verb>
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>chline<label id="chline"><p>
|
||||
|
||||
<quote>
|
||||
@@ -3311,6 +3355,47 @@ be used in presence of a prototype.
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>cscanf<label id="cscanf"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Read formatted input from the console
|
||||
<tag/Header/<tt/<ref id="conio.h" name="conio.h">/
|
||||
<tag/Declaration/<tt/int cscanf (const char* format, ...);/
|
||||
<tag/Description/The <tt/cscanf()/ function scans input from the console under
|
||||
control of the argument <tt/format/. Following the format string is a list of
|
||||
addresses to receive values. The format string is identical to that of the
|
||||
<tt/scanf()/ function.
|
||||
<tag/Notes/<itemize>
|
||||
<item>A direct call to <tt/cursor()/ may be required to show the cursor.
|
||||
<item>Some control characters like backspaces are not recognized.
|
||||
<item>A better user experience can sometimes be provided by using <tt/cgets()/
|
||||
to retrieve the input, and then using <tt/sscanf()/ to parse it.
|
||||
</itemize>
|
||||
<tag/Availability/cc65
|
||||
<tag/See also/
|
||||
<ref id="cgets" name="cgets">,
|
||||
<ref id="cursor" name="cursor">
|
||||
<tag/Example/<verb>
|
||||
#include <conio.h>
|
||||
|
||||
int main (void)
|
||||
{
|
||||
int a, b, c;
|
||||
|
||||
cputs ("Type three integers that add to 100: ");
|
||||
if (cscanf ("%d %d %d", &a, &b, &c) == 3 && a + b + c == 100)
|
||||
cputs ("\r\nYou passed!\r\n");
|
||||
else
|
||||
cputs ("\r\nYou failed!\r\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
</verb>
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>cursor<label id="cursor"><p>
|
||||
|
||||
<quote>
|
||||
@@ -8477,24 +8562,27 @@ used in presence of a prototype.
|
||||
<tag/Function/Switch to either 40- or 80-column text mode, or a standard
|
||||
graphics mode.
|
||||
<tag/Header/<tt/
|
||||
<ref id="apple2.h" name="apple2.h">,
|
||||
<ref id="apple2enh.h" name="apple2enh.h">,
|
||||
<ref id="c128.h" name="c128.h">,
|
||||
<ref id="cx16.h" name="cx16.h">/
|
||||
<tag/Declaration/
|
||||
<tt>unsigned __fastcall__ videomode (unsigned Mode); /* for apple2enh and c128 */</tt><newline>
|
||||
<tt>signed char __fastcall__ videomode (signed char Mode); /* for cx16 */</tt>
|
||||
<tt>unsigned __fastcall__ videomode (unsigned Mode); /* for c128 */</tt><newline>
|
||||
<tt>signed char __fastcall__ videomode (signed char Mode); /* for apple2 and cx16 */</tt>
|
||||
<tag/Description/Switch to a 40- or 80-column text or graphics mode, depending
|
||||
on the argument. If the requested mode is already active, nothing happens. The
|
||||
old mode is returned from the call.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is specific to the Commodore 128, the enhanced Apple //e,
|
||||
<item>The function is specific to the Commodore 128, the Apple II,
|
||||
and the Commander X16.
|
||||
<item>This function replaces <ref id="toggle_videomode"
|
||||
name="toggle_videomode">.
|
||||
<item>The function is available as only a fastcall function, so it may be used
|
||||
only in the presence of a prototype.
|
||||
<item>On Apple II, this functions returns the previously active video mode, or -1
|
||||
if the mode is not supported due to lack of hardware.
|
||||
</itemize>
|
||||
<tag/Availability/C128, enhanced Apple //e, and CX16
|
||||
<tag/Availability/C128, Apple II, and CX16
|
||||
<tag/See also/
|
||||
<ref id="fast" name="fast">,
|
||||
<ref id="isfast" name="isfast">,
|
||||
@@ -8512,14 +8600,19 @@ only in the presence of a prototype.
|
||||
<descrip>
|
||||
<tag/Function/Wait until the start of the next video frame.
|
||||
<tag/Header/<tt/
|
||||
<ref id="apple2enh.h" name="apple2enh.h">,
|
||||
<ref id="apple2.h" name="apple2.h">,
|
||||
<ref id="atmos.h" name="atmos.h">,
|
||||
<ref id="cbm.h" name="cbm.h">,
|
||||
<ref id="gamate.h" name="gamate.h">,
|
||||
<ref id="nes.h" name="nes.h">,
|
||||
<ref id="pce.h" name="pce.h">/
|
||||
<tag/Declaration/<tt/void waitvsync (void);/
|
||||
<tag/Declaration/
|
||||
<tt>void waitvsync (void);</tt><newline>
|
||||
<tag/Description/Wait for vertical sync, to reduce flickering.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function will silently fail when the feature is not
|
||||
supported, like on the Apple ][+.
|
||||
</itemize>
|
||||
<tag/Availability/Platforms served by the headers above
|
||||
(Atmos requires the VSync hack)
|
||||
<tag/Example/None.
|
||||
|
||||
@@ -109,6 +109,9 @@
|
||||
|
||||
<descrip>
|
||||
|
||||
<tag><htmlurl url="agat.html" name="agat.html"></tag>
|
||||
Topics specific to the Agat machines.
|
||||
|
||||
<tag><htmlurl url="apple2.html" name="apple2.html"></tag>
|
||||
Topics specific to the Apple ][.
|
||||
|
||||
|
||||
@@ -165,8 +165,26 @@ The names in the parentheses denote the symbols to be used for static linking of
|
||||
|
||||
<sect1>Graphics drivers<p>
|
||||
|
||||
No graphics drivers are currently available for the Plus/4.
|
||||
<descrip>
|
||||
<tag><tt/ted-hi.tgi (ted_hi_tgi)/</tag>
|
||||
This driver features a resolution of 320*200 with two colors and an
|
||||
adjustable palette (that means that the two colors can be chosen out of a
|
||||
palette of the 121 TED colors).
|
||||
|
||||
Note that the text-mode character matrix and color data are destroyed by this
|
||||
driver. The driver calls the Kernal <tt/CLRSCR/ routine to return the text
|
||||
screen to a usable (if empty) state on <tt/tgi_done()/.
|
||||
|
||||
This driver places the bitmap at $C000-$E000. Programs using
|
||||
this driver must either be linked with the option <tt/-D
|
||||
__HIMEM__=$C000/, or use the <tt/plus4-hires.cfg/ linker configuration.
|
||||
|
||||
The <tt/plus4-hires.cfg/ is preferable, as it allows the stack to remain at
|
||||
$FCFF, and exposes the remaining high memory from the end of the bitmap
|
||||
to the stack top as a <tt/HIBSS/ segment that can be used by the programmer,
|
||||
or given to <tt/_heapadd()/ (using the symbols <tt/_HIBSS_START__/ and
|
||||
<tt/_HIBSS_SIZE__/).
|
||||
</descrip><p>
|
||||
|
||||
<sect1>Extended memory drivers<p>
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ Internally, the binary program file has a 12 byte header provided by the library
|
||||
|
||||
<item>1 byte <bf/CPU type/: <tt/0/ = 6502, <tt/1/ = 65C02
|
||||
|
||||
<item>1 byte <bf/sp address/: the zero page address of the C parameter stack pointer <tt/sp/ used by the paravirtualization functions
|
||||
<item>1 byte <bf/c_sp address/: the zero page address of the C parameter stack pointer <tt/c_sp/ used by the paravirtualization functions
|
||||
|
||||
<item>1 word <bf/load address/: where to load the data from the file into memory (default: <tt/$0200/)
|
||||
|
||||
|
||||
62
doc/tgi.sgml
62
doc/tgi.sgml
@@ -43,7 +43,7 @@ of range.
|
||||
<ref id="tgi_setcolor" name="tgi_setcolor">
|
||||
<tag/Example/<tscreen><verb>
|
||||
/* Draw the upper half of an ellipse */
|
||||
tgi_setcolor(TGI_COLOR_BLUE);
|
||||
tgi_setcolor(1);
|
||||
tgi_arc (50, 50, 40, 20, 0, 180);
|
||||
</verb></tscreen>
|
||||
</descrip>
|
||||
@@ -67,7 +67,7 @@ be used in presence of a prototype.
|
||||
<tag/Availability/cc65
|
||||
<tag/See also/Other tgi function
|
||||
<tag/Example/<tscreen><verb>
|
||||
tgi_setcolor(TGI_COLOR_GREEN);
|
||||
tgi_setcolor(1);
|
||||
tgi_bar(10, 10, 100, 60);
|
||||
</verb></tscreen>
|
||||
</descrip>
|
||||
@@ -94,7 +94,7 @@ be used in presence of a prototype.
|
||||
<ref id="tgi_pieslice" name="tgi_pieslice">,
|
||||
<ref id="tgi_setcolor" name="tgi_setcolor">
|
||||
<tag/Example/<tscreen><verb>
|
||||
tgi_setcolor(TGI_COLOR_BLACK);
|
||||
tgi_setcolor(1);
|
||||
tgi_circle(50, 40, 40);
|
||||
</verb></tscreen>
|
||||
</descrip>
|
||||
@@ -154,7 +154,7 @@ be used in presence of a prototype.
|
||||
<ref id="tgi_pieslice" name="tgi_pieslice">,
|
||||
<ref id="tgi_setcolor" name="tgi_setcolor">
|
||||
<tag/Example/<tscreen><verb>
|
||||
tgi_setcolor(TGI_COLOR_RED);
|
||||
tgi_setcolor(1);
|
||||
tgi_ellipse (50, 40, 40, 20);
|
||||
</verb></tscreen>
|
||||
</descrip>
|
||||
@@ -216,17 +216,19 @@ original aspect ratio.
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Return the current drawing color.
|
||||
<tag/Function/Return the current drawing color (palette index).
|
||||
<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
|
||||
<tag/Declaration/<tt/unsigned char tgi_getcolor (void);/
|
||||
<tag/Description/The actual color is an index to a palette. During tgi_init
|
||||
you will get a default palette. The number of colors depend on the platform.
|
||||
All platforms recognize at least TGI_COLOR_BLACK and TGI_COLOR_WHITE. But some
|
||||
platforms have many more predefined colors. If you paint using TGI_COLOR_GREEN
|
||||
and then you change the green of the palette to blue using tgi_setpalette then
|
||||
after this painting in TGI_COLOR_GREEN will actually be blue.
|
||||
you will get a default palette.
|
||||
A default palette has always two entries with values equal to TGI_COLOR_BLACK
|
||||
and TGI_COLOR_WHITE. However, which default palette entries have those two
|
||||
values is target specific.
|
||||
Note that both the number of colors, and also the available colors, depend on
|
||||
the target and/or driver.
|
||||
<tag/Availability/cc65
|
||||
<tag/See also/Other tgi functions
|
||||
<tag/See also/<ref id="tgi_setcolor" name="tgi_setcolor">,
|
||||
<ref id="tgi_setpalette" name="tgi_setpalette">
|
||||
<tag/Example/<tscreen><verb>
|
||||
color = tgi_getcolor();
|
||||
</verb></tscreen>
|
||||
@@ -238,7 +240,8 @@ color = tgi_getcolor();
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Get the number of available colors.
|
||||
<tag/Function/Get the number of available colors in the palette for the current
|
||||
driver.
|
||||
<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
|
||||
<tag/Declaration/<tt/unsigned char tgi_getcolorcount (void);/
|
||||
<tag/Description/TGI platforms use indexed color palettes. This function
|
||||
@@ -287,8 +290,6 @@ if (num_colors == 0) {
|
||||
<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
|
||||
<tag/Declaration/<tt/const unsigned char* tgi_getdefpalette (void);/
|
||||
<tag/Description/The tgi driver has a default palette that is active at startup.
|
||||
The named colors TGI_COLOR_BLACK, TGI_COLOR_WHITE, TGI_COLOR_RED... need this
|
||||
palette to work correctly.
|
||||
<tag/Availability/cc65
|
||||
<tag/See also/Other tgi functions
|
||||
<tag/Example/None.
|
||||
@@ -418,10 +419,10 @@ be used in presence of a prototype.
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Get the color of a pixel from the viewpage.
|
||||
<tag/Function/Get the color (palette index) of a pixel from the viewpage.
|
||||
<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
|
||||
<tag/Declaration/<tt/unsigned char __fastcall__ tgi_getpixel (int x, int y);/
|
||||
<tag/Description/Get the color of a pixel from the viewpage.
|
||||
<tag/Description/Get the color (palette index) of a pixel from the viewpage.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is only available as fastcall function, so it may only
|
||||
be used in presence of a prototype.
|
||||
@@ -626,7 +627,7 @@ be used in presence of a prototype.
|
||||
#define tgi_updatedisplay() tgi_ioctl(4, (void*)1)
|
||||
if (!tgi_busy()) {
|
||||
tgi_sprite(&background);
|
||||
tgi_setcolor(TGI_COLOR_BLUE);
|
||||
tgi_setcolor(1);
|
||||
tgi_outttextxy(20,40,"Hello World");
|
||||
tgi_updatedisplay();
|
||||
}
|
||||
@@ -791,7 +792,7 @@ of range.
|
||||
<ref id="tgi_setcolor" name="tgi_setcolor">
|
||||
<tag/Example/<tscreen><verb>
|
||||
/* Draw the closed upper half of an ellipse */
|
||||
tgi_setcolor(TGI_COLOR_BLUE);
|
||||
tgi_setcolor(1);
|
||||
tgi_pieslice (50, 50, 40, 20, 0, 180);
|
||||
</verb></tscreen>
|
||||
</descrip>
|
||||
@@ -834,20 +835,21 @@ only in the presence of a prototype.
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Set color to be used in future draw operations.
|
||||
<tag/Function/Set color (palette index) to be used in future draw operations.
|
||||
<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
|
||||
<tag/Declaration/<tt/void __fastcall__ tgi_setcolor (unsigned char color);/
|
||||
<tag/Description/Set color to be used in future draw operations.
|
||||
<tag/Declaration/<tt/void __fastcall__ tgi_setcolor (unsigned char color_index);/
|
||||
<tag/Description/Set color (palette index) to be used in future draw operations.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is only available as fastcall function, so it may only
|
||||
be used in presence of a prototype.
|
||||
</itemize>
|
||||
<tag/Availability/cc65
|
||||
<tag/See also/Other tgi functions.
|
||||
<tag/See also/<ref id="tgi_getcolor" name="tgi_getcolor">,
|
||||
<ref id="tgi_setpalette" name="tgi_setpalette">
|
||||
<tag/Example/<tscreen><verb>
|
||||
tgi_setcolor(TGI_COLOR_BLACK);
|
||||
tgi_setcolor(1);
|
||||
tgi_bar(0,0,30,30);
|
||||
tgi_setcolor(TGI_COLOR_WHITE);
|
||||
tgi_setcolor(2);
|
||||
tgi_bar(10,10,20,20);
|
||||
</verb></tscreen>
|
||||
</descrip>
|
||||
@@ -893,13 +895,21 @@ Palette is a pointer to as many entries as there are colors.
|
||||
<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
|
||||
<tag/Declaration/<tt/void __fastcall__ tgi_setpalette (const unsigned char* palette);/
|
||||
<tag/Description/Set the palette (not available with all drivers/hardware).
|
||||
Palette is a pointer to as many entries as there are colors.
|
||||
Palette is a pointer to as many entries as there are colors. The values in the
|
||||
palette are target specific, some (hopefully, more or less) portable values are
|
||||
defined in the TGI_COLOR_XY defines. Note that different platforms provide
|
||||
different colors, only TGI_COLOR_BLACK and TGI_COLOR_WHITE are guaranteed to
|
||||
exist (needed for the default palette).
|
||||
<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 palette is the (only) place where to use the TGI_COLOR_XY values. This
|
||||
has been an ongoing and reoccurring misunderstanding in the past: At every other
|
||||
place, the "color" values are indices into the current palette.
|
||||
</itemize>
|
||||
<tag/Availability/cc65
|
||||
<tag/See also/Other tgi functions.
|
||||
<tag/See also/<ref id="tgi_setcolor" name="tgi_setcolor">,
|
||||
<ref id="tgi_getpalette" name="tgi_getpalette">
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
188
include/_vic3.h
Normal file
188
include/_vic3.h
Normal file
@@ -0,0 +1,188 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* _vic3.h */
|
||||
/* */
|
||||
/* Internal include file, do not use directly */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998-2012, Ullrich von Bassewitz */
|
||||
/* Roemerstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
/* */
|
||||
/* 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 __VIC3_H
|
||||
#define __VIC3_H
|
||||
|
||||
/* FIXME: only VIC2 registers right now */
|
||||
|
||||
/* Define a structure with the vic register offsets. In cc65 mode, there
|
||||
** are aliases for the field accessible as arrays.
|
||||
*/
|
||||
#if __CC65_STD__ == __CC65_STD_CC65__
|
||||
struct __vic3 {
|
||||
union {
|
||||
struct {
|
||||
unsigned char spr0_x; /* Sprite 0, X coordinate */
|
||||
unsigned char spr0_y; /* Sprite 0, Y coordinate */
|
||||
unsigned char spr1_x; /* Sprite 1, X coordinate */
|
||||
unsigned char spr1_y; /* Sprite 1, Y coordinate */
|
||||
unsigned char spr2_x; /* Sprite 2, X coordinate */
|
||||
unsigned char spr2_y; /* Sprite 2, Y coordinate */
|
||||
unsigned char spr3_x; /* Sprite 3, X coordinate */
|
||||
unsigned char spr3_y; /* Sprite 3, Y coordinate */
|
||||
unsigned char spr4_x; /* Sprite 4, X coordinate */
|
||||
unsigned char spr4_y; /* Sprite 4, Y coordinate */
|
||||
unsigned char spr5_x; /* Sprite 5, X coordinate */
|
||||
unsigned char spr5_y; /* Sprite 5, Y coordinate */
|
||||
unsigned char spr6_x; /* Sprite 6, X coordinate */
|
||||
unsigned char spr6_y; /* Sprite 6, Y coordinate */
|
||||
unsigned char spr7_x; /* Sprite 7, X coordinate */
|
||||
unsigned char spr7_y; /* Sprite 7, Y coordinate */
|
||||
};
|
||||
struct {
|
||||
unsigned char x; /* X coordinate */
|
||||
unsigned char y; /* Y coordinate */
|
||||
} spr_pos[8];
|
||||
};
|
||||
unsigned char spr_hi_x; /* High bits of X coordinate */
|
||||
unsigned char ctrl1; /* Control register 1 */
|
||||
unsigned char rasterline; /* Current raster line */
|
||||
union {
|
||||
struct {
|
||||
unsigned char strobe_x; /* Light pen, X position */
|
||||
unsigned char strobe_y; /* Light pen, Y position */
|
||||
};
|
||||
struct {
|
||||
unsigned char x; /* Light pen, X position */
|
||||
unsigned char y; /* Light pen, Y position */
|
||||
} strobe;
|
||||
};
|
||||
unsigned char spr_ena; /* Enable sprites */
|
||||
unsigned char ctrl2; /* Control register 2 */
|
||||
unsigned char spr_exp_y; /* Expand sprites in Y dir */
|
||||
unsigned char addr; /* Address of chargen and video ram */
|
||||
unsigned char irr; /* Interrupt request register */
|
||||
unsigned char imr; /* Interrupt mask register */
|
||||
unsigned char spr_bg_prio; /* Priority to background */
|
||||
unsigned char spr_mcolor; /* Sprite multicolor bits */
|
||||
unsigned char spr_exp_x; /* Expand sprites in X dir */
|
||||
unsigned char spr_coll; /* Sprite/sprite collision reg */
|
||||
unsigned char spr_bg_coll; /* Sprite/background collision reg */
|
||||
unsigned char bordercolor; /* Border color */
|
||||
union {
|
||||
struct {
|
||||
unsigned char bgcolor0; /* Background color 0 */
|
||||
unsigned char bgcolor1; /* Background color 1 */
|
||||
unsigned char bgcolor2; /* Background color 2 */
|
||||
unsigned char bgcolor3; /* Background color 3 */
|
||||
};
|
||||
unsigned char bgcolor[4]; /* Background colors */
|
||||
};
|
||||
union {
|
||||
struct {
|
||||
unsigned char spr_mcolor0; /* Color 0 for multicolor sprites */
|
||||
unsigned char spr_mcolor1; /* Color 1 for multicolor sprites */
|
||||
};
|
||||
/* spr_color is already used ... */
|
||||
unsigned char spr_mcolors[2]; /* Color for multicolor sprites */
|
||||
};
|
||||
union {
|
||||
struct {
|
||||
unsigned char spr0_color; /* Color sprite 0 */
|
||||
unsigned char spr1_color; /* Color sprite 1 */
|
||||
unsigned char spr2_color; /* Color sprite 2 */
|
||||
unsigned char spr3_color; /* Color sprite 3 */
|
||||
unsigned char spr4_color; /* Color sprite 4 */
|
||||
unsigned char spr5_color; /* Color sprite 5 */
|
||||
unsigned char spr6_color; /* Color sprite 6 */
|
||||
unsigned char spr7_color; /* Color sprite 7 */
|
||||
};
|
||||
unsigned char spr_color[8]; /* Colors for the sprites */
|
||||
};
|
||||
|
||||
/* The following ones are only valid in the C128: */
|
||||
unsigned char x_kbd; /* Additional keyboard lines */
|
||||
unsigned char clock; /* Clock switch bit */
|
||||
};
|
||||
#else
|
||||
struct __vic3 {
|
||||
unsigned char spr0_x; /* Sprite 0, X coordinate */
|
||||
unsigned char spr0_y; /* Sprite 0, Y coordinate */
|
||||
unsigned char spr1_x; /* Sprite 1, X coordinate */
|
||||
unsigned char spr1_y; /* Sprite 1, Y coordinate */
|
||||
unsigned char spr2_x; /* Sprite 2, X coordinate */
|
||||
unsigned char spr2_y; /* Sprite 2, Y coordinate */
|
||||
unsigned char spr3_x; /* Sprite 3, X coordinate */
|
||||
unsigned char spr3_y; /* Sprite 3, Y coordinate */
|
||||
unsigned char spr4_x; /* Sprite 4, X coordinate */
|
||||
unsigned char spr4_y; /* Sprite 4, Y coordinate */
|
||||
unsigned char spr5_x; /* Sprite 5, X coordinate */
|
||||
unsigned char spr5_y; /* Sprite 5, Y coordinate */
|
||||
unsigned char spr6_x; /* Sprite 6, X coordinate */
|
||||
unsigned char spr6_y; /* Sprite 6, Y coordinate */
|
||||
unsigned char spr7_x; /* Sprite 7, X coordinate */
|
||||
unsigned char spr7_y; /* Sprite 7, Y coordinate */
|
||||
unsigned char spr_hi_x; /* High bits of X coordinate */
|
||||
unsigned char ctrl1; /* Control register 1 */
|
||||
unsigned char rasterline; /* Current raster line */
|
||||
unsigned char strobe_x; /* Light pen, X position */
|
||||
unsigned char strobe_y; /* Light pen, Y position */
|
||||
unsigned char spr_ena; /* Enable sprites */
|
||||
unsigned char ctrl2; /* Control register 2 */
|
||||
unsigned char spr_exp_y; /* Expand sprites in Y dir */
|
||||
unsigned char addr; /* Address of chargen and video ram */
|
||||
unsigned char irr; /* Interrupt request register */
|
||||
unsigned char imr; /* Interrupt mask register */
|
||||
unsigned char spr_bg_prio; /* Priority to background */
|
||||
unsigned char spr_mcolor; /* Sprite multicolor bits */
|
||||
unsigned char spr_exp_x; /* Expand sprites in X dir */
|
||||
unsigned char spr_coll; /* Sprite/sprite collision reg */
|
||||
unsigned char spr_bg_coll; /* Sprite/background collision reg */
|
||||
unsigned char bordercolor; /* Border color */
|
||||
unsigned char bgcolor0; /* Background color 0 */
|
||||
unsigned char bgcolor1; /* Background color 1 */
|
||||
unsigned char bgcolor2; /* Background color 2 */
|
||||
unsigned char bgcolor3; /* Background color 3 */
|
||||
unsigned char spr_mcolor0; /* Color 0 for multicolor sprites */
|
||||
unsigned char spr_mcolor1; /* Color 1 for multicolor sprites */
|
||||
unsigned char spr0_color; /* Color sprite 0 */
|
||||
unsigned char spr1_color; /* Color sprite 1 */
|
||||
unsigned char spr2_color; /* Color sprite 2 */
|
||||
unsigned char spr3_color; /* Color sprite 3 */
|
||||
unsigned char spr4_color; /* Color sprite 4 */
|
||||
unsigned char spr5_color; /* Color sprite 5 */
|
||||
unsigned char spr6_color; /* Color sprite 6 */
|
||||
unsigned char spr7_color; /* Color sprite 7 */
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* End of _vic3.h */
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
76
include/agat.h
Normal file
76
include/agat.h
Normal file
@@ -0,0 +1,76 @@
|
||||
#ifndef _AGAT_H
|
||||
#define _AGAT_H
|
||||
|
||||
/* Check for errors */
|
||||
#if !defined(__AGAT__)
|
||||
# error This module may only be used when compiling for the Agat!
|
||||
#endif
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
/* Color defines */
|
||||
#define COLOR_BLACK 0x00
|
||||
#define COLOR_RED 0x01
|
||||
#define COLOR_GREEN 0x02
|
||||
#define COLOR_YELLOW 0x03
|
||||
#define COLOR_BLUE 0x04
|
||||
#define COLOR_MAGENTA 0x05
|
||||
#define COLOR_CYAN 0x06
|
||||
#define COLOR_WHITE 0x07
|
||||
|
||||
/* Characters codes */
|
||||
#define CH_CTRL_C 0x03
|
||||
#define CH_ENTER 0x0D
|
||||
#define CH_ESC 0x1B
|
||||
#define CH_CURS_LEFT 0x08
|
||||
#define CH_CURS_RIGHT 0x15
|
||||
#define CH_CURS_UP 0x19
|
||||
#define CH_CURS_DOWN 0x1A
|
||||
#define CH_ESC 0x1B
|
||||
#define CH_HLINE 0x1B
|
||||
#define CH_VLINE 0x5C
|
||||
#define CH_ULCORNER 0x10
|
||||
#define CH_URCORNER 0x12
|
||||
#define CH_LLCORNER 0x1D
|
||||
#define CH_LRCORNER 0x1F
|
||||
|
||||
/* Masks for joy_read */
|
||||
#define JOY_UP_MASK 0x10
|
||||
#define JOY_DOWN_MASK 0x20
|
||||
#define JOY_LEFT_MASK 0x04
|
||||
#define JOY_RIGHT_MASK 0x08
|
||||
#define JOY_BTN_1_MASK 0x40
|
||||
#define JOY_BTN_2_MASK 0x80
|
||||
|
||||
/* Return codes for get_ostype */
|
||||
#define AGAT_UNKNOWN 0x00
|
||||
#define AGAT_7 0x10 /* Agat 7 */
|
||||
#define AGAT_9 0x20 /* Agat 9 */
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned char get_ostype (void);
|
||||
/* Get the machine type. Returns one of the AGAT_xxx codes. */
|
||||
|
||||
void rebootafterexit (void);
|
||||
/* Reboot machine after program termination has completed. */
|
||||
|
||||
/* The following #defines will cause the matching functions calls in conio.h
|
||||
** to be overlaid by macros with the same names, saving the function call
|
||||
** overhead.
|
||||
*/
|
||||
#define _bgcolor(color) COLOR_BLACK
|
||||
#define _bordercolor(color) COLOR_BLACK
|
||||
|
||||
/* End of agat.h */
|
||||
|
||||
|
||||
#endif
|
||||
@@ -83,7 +83,77 @@
|
||||
#define CH_CURS_LEFT 0x08
|
||||
#define CH_CURS_RIGHT 0x15
|
||||
|
||||
#if !defined(__APPLE2ENH__)
|
||||
/* These characters are not available on the ][+, but
|
||||
* are on the //e. */
|
||||
#if defined(__APPLE2ENH__) || defined(APPLE2_INCLUDE_IIE_CHARS)
|
||||
#define CH_DEL 0x7F
|
||||
#define CH_CURS_UP 0x0B
|
||||
#define CH_CURS_DOWN 0x0A
|
||||
|
||||
/* These are defined to be OpenApple + NumberKey */
|
||||
#define CH_F1 0xB1
|
||||
#define CH_F2 0xB2
|
||||
#define CH_F3 0xB3
|
||||
#define CH_F4 0xB4
|
||||
#define CH_F5 0xB5
|
||||
#define CH_F6 0xB6
|
||||
#define CH_F7 0xB7
|
||||
#define CH_F8 0xB8
|
||||
#define CH_F9 0xB9
|
||||
#define CH_F10 0xB0
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE2ENH__)
|
||||
|
||||
/* MouseText-based functions for boxes and lines drawing */
|
||||
void mt_chline (unsigned char length);
|
||||
void mt_cvline (unsigned char length);
|
||||
void mt_chlinexy (unsigned char x, unsigned char y, unsigned char length);
|
||||
void mt_cvlinexy (unsigned char x, unsigned char y, unsigned char length);
|
||||
|
||||
#define CH_HLINE 0x5F
|
||||
#define CH_VLINE 0xDF
|
||||
#define CH_ULCORNER 0x5F
|
||||
#define CH_URCORNER 0x20
|
||||
#define CH_LLCORNER 0xD4
|
||||
#define CH_LRCORNER 0xDF
|
||||
#define CH_TTEE 0x5F
|
||||
#define CH_BTEE 0xD4
|
||||
#define CH_LTEE 0xD4
|
||||
#define CH_RTEE 0xDF
|
||||
#define CH_CROSS 0xD4
|
||||
|
||||
#define _chline(length) mt_chline(length)
|
||||
#define _chlinexy(x,y,length) mt_chlinexy(x,y,length)
|
||||
#define _cvline(length) mt_cvline(length)
|
||||
#define _cvlinexy(x,y,length) mt_cvlinexy(x,y,length)
|
||||
|
||||
#else
|
||||
|
||||
/* Functions that don't depend on MouseText to draw boxes and lines */
|
||||
void dyn_chline (unsigned char h, unsigned char length);
|
||||
void dyn_cvline (unsigned char v, unsigned char length);
|
||||
void dyn_chlinexy (unsigned char h, unsigned char x, unsigned char y, unsigned char length);
|
||||
void dyn_cvlinexy (unsigned char v, unsigned char x, unsigned char y, unsigned char length);
|
||||
|
||||
#if defined(DYN_BOX_DRAW)
|
||||
/* When the user defines DYN_BOX_DRAW, we'll adapt to the machine
|
||||
** we run on.
|
||||
*/
|
||||
extern char CH_HLINE;
|
||||
extern char CH_VLINE;
|
||||
extern char CH_ULCORNER;
|
||||
extern char CH_URCORNER;
|
||||
extern char CH_LLCORNER;
|
||||
extern char CH_LRCORNER;
|
||||
extern char CH_TTEE;
|
||||
extern char CH_BTEE;
|
||||
extern char CH_LTEE;
|
||||
extern char CH_RTEE;
|
||||
extern char CH_CROSS;
|
||||
|
||||
#else
|
||||
/* Otherwise, fallback to safety and don't use MouseText at all. */
|
||||
#define CH_HLINE '-'
|
||||
#define CH_VLINE '!'
|
||||
#define CH_ULCORNER '+'
|
||||
@@ -95,7 +165,14 @@
|
||||
#define CH_LTEE '+'
|
||||
#define CH_RTEE '+'
|
||||
#define CH_CROSS '+'
|
||||
#endif
|
||||
#endif /* DYN_BOX_DRAW */
|
||||
|
||||
#define _chline(length) dyn_chline(CH_HLINE, length)
|
||||
#define _chlinexy(x, y, length) dyn_chlinexy(CH_HLINE, x ,y, length)
|
||||
#define _cvline(length) dyn_cvline(CH_VLINE, length)
|
||||
#define _cvlinexy(x, y, length) dyn_cvlinexy(CH_VLINE, x, y, length)
|
||||
|
||||
#endif /* __APPLE2ENH__ */
|
||||
|
||||
/* Masks for joy_read */
|
||||
#define JOY_UP_MASK 0x10
|
||||
@@ -127,6 +204,12 @@
|
||||
#define TV_PAL 1
|
||||
#define TV_OTHER 2
|
||||
|
||||
/* Video modes */
|
||||
#define VIDEOMODE_40x24 0x15
|
||||
#define VIDEOMODE_80x24 0x00
|
||||
#define VIDEOMODE_40COL VIDEOMODE_40x24
|
||||
#define VIDEOMODE_80COL VIDEOMODE_80x24
|
||||
|
||||
extern unsigned char _dos_type;
|
||||
/* Valid _dos_type values:
|
||||
**
|
||||
@@ -255,6 +338,14 @@ unsigned char __fastcall__ allow_lowercase (unsigned char onoff);
|
||||
*/
|
||||
#endif
|
||||
|
||||
signed char __fastcall__ videomode (unsigned mode);
|
||||
/* Set the video mode, return the old mode, or -1 if 80-column hardware is not
|
||||
** installed. Call with one of the VIDEOMODE_xx constants.
|
||||
*/
|
||||
|
||||
void waitvsync (void);
|
||||
/* Wait for start of next frame */
|
||||
|
||||
|
||||
|
||||
/* End of apple2.h */
|
||||
|
||||
@@ -46,49 +46,6 @@
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
/* Characters codes */
|
||||
#define CH_DEL 0x7F
|
||||
#define CH_CURS_UP 0x0B
|
||||
#define CH_CURS_DOWN 0x0A
|
||||
|
||||
#define CH_HLINE 0x5F
|
||||
#define CH_VLINE 0xDF
|
||||
#define CH_ULCORNER 0x5F
|
||||
#define CH_URCORNER 0x20
|
||||
#define CH_LLCORNER 0xD4
|
||||
#define CH_LRCORNER 0xDF
|
||||
#define CH_TTEE 0x5F
|
||||
#define CH_BTEE 0xD4
|
||||
#define CH_LTEE 0xD4
|
||||
#define CH_RTEE 0xDF
|
||||
#define CH_CROSS 0xD4
|
||||
|
||||
/* These are defined to be OpenApple + NumberKey */
|
||||
#define CH_F1 0xB1
|
||||
#define CH_F2 0xB2
|
||||
#define CH_F3 0xB3
|
||||
#define CH_F4 0xB4
|
||||
#define CH_F5 0xB5
|
||||
#define CH_F6 0xB6
|
||||
#define CH_F7 0xB7
|
||||
#define CH_F8 0xB8
|
||||
#define CH_F9 0xB9
|
||||
#define CH_F10 0xB0
|
||||
|
||||
/* Video modes */
|
||||
#define VIDEOMODE_40x24 0x15
|
||||
#define VIDEOMODE_80x24 0x00
|
||||
#define VIDEOMODE_40COL VIDEOMODE_40x24
|
||||
#define VIDEOMODE_80COL VIDEOMODE_80x24
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Variables */
|
||||
/*****************************************************************************/
|
||||
@@ -106,21 +63,5 @@ extern void a2e_lo_tgi[];
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
unsigned __fastcall__ videomode (unsigned mode);
|
||||
/* Set the video mode, return the old mode. Call with one of the VIDEOMODE_xx
|
||||
** constants.
|
||||
*/
|
||||
|
||||
void waitvsync (void);
|
||||
/* Wait for start of next frame */
|
||||
|
||||
|
||||
|
||||
/* End of apple2enh.h */
|
||||
#endif
|
||||
|
||||
@@ -40,6 +40,20 @@
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
#if (__CPU__ & __CPU_ISET_65SC02__)
|
||||
/* Always inline, three bytes is not more than a jsr */
|
||||
|
||||
#define ntohs(x) \
|
||||
( \
|
||||
__AX__=(x), \
|
||||
asm("phx"), \
|
||||
asm("tax"), \
|
||||
asm("pla"), \
|
||||
__AX__ \
|
||||
)
|
||||
#define htons(x) ntohs(x)
|
||||
|
||||
#else
|
||||
|
||||
#if (__OPT_i__ < 200)
|
||||
int __fastcall__ ntohs (int val);
|
||||
@@ -56,12 +70,12 @@ int __fastcall__ htons (int val);
|
||||
)
|
||||
#define htons(x) ntohs(x)
|
||||
|
||||
#endif
|
||||
#endif /* __OPT_i__ < 200 */
|
||||
|
||||
#endif /* __CPU__ & __CPU_ISET_65SC02__ */
|
||||
|
||||
long __fastcall__ ntohl (long val);
|
||||
long __fastcall__ htonl (long val);
|
||||
|
||||
|
||||
|
||||
/* End of arpa/inet.h */
|
||||
#endif
|
||||
|
||||
120
include/c65.h
Normal file
120
include/c65.h
Normal file
@@ -0,0 +1,120 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* c65.h */
|
||||
/* */
|
||||
/* C65 system specific definitions */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998-2013, Ullrich von Bassewitz */
|
||||
/* Roemerstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
/* */
|
||||
/* 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 _C65_H
|
||||
#define _C65_H
|
||||
|
||||
|
||||
|
||||
/* Check for errors */
|
||||
#if !defined(__C65__)
|
||||
# error This module may only be used when compiling for the MEGA65!
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Additional key defines */
|
||||
#define CH_F1 133
|
||||
#define CH_F2 137
|
||||
#define CH_F3 134
|
||||
#define CH_F4 138
|
||||
#define CH_F5 135
|
||||
#define CH_F6 139
|
||||
#define CH_F7 136
|
||||
#define CH_F8 140
|
||||
|
||||
/* Color defines */
|
||||
#define COLOR_BLACK 0x00
|
||||
#define COLOR_WHITE 0x01
|
||||
#define COLOR_RED 0x02
|
||||
#define COLOR_CYAN 0x03
|
||||
#define COLOR_PURPLE 0x04
|
||||
#define COLOR_GREEN 0x05
|
||||
#define COLOR_BLUE 0x06
|
||||
#define COLOR_YELLOW 0x07
|
||||
#define COLOR_ORANGE 0x08
|
||||
#define COLOR_BROWN 0x09
|
||||
#define COLOR_LIGHTRED 0x0A
|
||||
#define COLOR_GRAY1 0x0B
|
||||
#define COLOR_GRAY2 0x0C
|
||||
#define COLOR_LIGHTGREEN 0x0D
|
||||
#define COLOR_LIGHTBLUE 0x0E
|
||||
#define COLOR_GRAY3 0x0F
|
||||
|
||||
/* TGI color defines */
|
||||
#define TGI_COLOR_BLACK COLOR_BLACK
|
||||
#define TGI_COLOR_WHITE COLOR_WHITE
|
||||
#define TGI_COLOR_RED COLOR_RED
|
||||
#define TGI_COLOR_CYAN COLOR_CYAN
|
||||
#define TGI_COLOR_PURPLE COLOR_PURPLE
|
||||
#define TGI_COLOR_GREEN COLOR_GREEN
|
||||
#define TGI_COLOR_BLUE COLOR_BLUE
|
||||
#define TGI_COLOR_YELLOW COLOR_YELLOW
|
||||
#define TGI_COLOR_ORANGE COLOR_ORANGE
|
||||
#define TGI_COLOR_BROWN COLOR_BROWN
|
||||
#define TGI_COLOR_LIGHTRED COLOR_LIGHTRED
|
||||
#define TGI_COLOR_GRAY1 COLOR_GRAY1
|
||||
#define TGI_COLOR_GRAY2 COLOR_GRAY2
|
||||
#define TGI_COLOR_LIGHTGREEN COLOR_LIGHTGREEN
|
||||
#define TGI_COLOR_LIGHTBLUE COLOR_LIGHTBLUE
|
||||
#define TGI_COLOR_GRAY3 COLOR_GRAY3
|
||||
|
||||
/* Masks for joy_read */
|
||||
#define JOY_UP_MASK 0x01
|
||||
#define JOY_DOWN_MASK 0x02
|
||||
#define JOY_LEFT_MASK 0x04
|
||||
#define JOY_RIGHT_MASK 0x08
|
||||
#define JOY_BTN_1_MASK 0x10
|
||||
|
||||
|
||||
/* Define hardware */
|
||||
#include <_vic3.h>
|
||||
#define VIC (*(struct __vic2*)0xD000)
|
||||
|
||||
#include <_sid.h>
|
||||
#define SID1 (*(struct __sid*)0xD400)
|
||||
#define SID2 (*(struct __sid*)0xD420)
|
||||
|
||||
#include <_6526.h>
|
||||
#define CIA1 (*(struct __6526*)0xDC00)
|
||||
#define CIA2 (*(struct __6526*)0xDD00)
|
||||
|
||||
|
||||
/* Define special memory areas */
|
||||
#define COLOR_RAM ((unsigned char*)0xD800)
|
||||
|
||||
|
||||
/* End of c65.h */
|
||||
#endif
|
||||
@@ -67,6 +67,10 @@
|
||||
# include <pet.h>
|
||||
#elif defined(__CX16__) && !defined(_CX16_H)
|
||||
# include <cx16.h>
|
||||
#elif defined(__C65__) && !defined(_C65_H)
|
||||
# include <c65.h>
|
||||
#elif defined(__MEGA65__) && !defined(_MEGA65_H)
|
||||
# include <mega65.h>
|
||||
#endif
|
||||
|
||||
/* Include definitions for CBM file types */
|
||||
|
||||
@@ -110,7 +110,23 @@
|
||||
#define COLOR_LIGHTBLUE (BCOLOR_LIGHTBLUE | CATTR_LUMA7)
|
||||
#define COLOR_GRAY3 (BCOLOR_WHITE | CATTR_LUMA5)
|
||||
|
||||
|
||||
/* TGI color defines */
|
||||
#define TGI_COLOR_BLACK (BCOLOR_BLACK)
|
||||
#define TGI_COLOR_WHITE (BCOLOR_WHITE | CATTR_LUMA7)
|
||||
#define TGI_COLOR_RED (BCOLOR_RED | CATTR_LUMA4)
|
||||
#define TGI_COLOR_CYAN (BCOLOR_CYAN | CATTR_LUMA7)
|
||||
#define TGI_COLOR_PURPLE (BCOLOR_LIGHTVIOLET | CATTR_LUMA7)
|
||||
#define TGI_COLOR_GREEN (BCOLOR_GREEN | CATTR_LUMA7)
|
||||
#define TGI_COLOR_BLUE (BCOLOR_BLUE | CATTR_LUMA7)
|
||||
#define TGI_COLOR_YELLOW (BCOLOR_YELLOW | CATTR_LUMA7)
|
||||
#define TGI_COLOR_ORANGE (BCOLOR_ORANGE | CATTR_LUMA7)
|
||||
#define TGI_COLOR_BROWN (BCOLOR_BROWN | CATTR_LUMA7)
|
||||
#define TGI_COLOR_LIGHTRED (BCOLOR_RED | CATTR_LUMA7)
|
||||
#define TGI_COLOR_GRAY1 (BCOLOR_WHITE | CATTR_LUMA1)
|
||||
#define TGI_COLOR_GRAY2 (BCOLOR_WHITE | CATTR_LUMA3)
|
||||
#define TGI_COLOR_LIGHTGREEN (BCOLOR_LIGHTGREEN | CATTR_LUMA7)
|
||||
#define TGI_COLOR_LIGHTBLUE (BCOLOR_LIGHTBLUE | CATTR_LUMA7)
|
||||
#define TGI_COLOR_GRAY3 (BCOLOR_WHITE | CATTR_LUMA5)
|
||||
|
||||
/* Masks for joy_read */
|
||||
#define JOY_UP_MASK 0x01
|
||||
|
||||
@@ -110,6 +110,21 @@ char cgetc (void);
|
||||
** 1 (see below), a blinking cursor is displayed while waiting.
|
||||
*/
|
||||
|
||||
char* __fastcall__ cgets (char* buffer, int size);
|
||||
/* Get a string of characters directly from the console. The function returns
|
||||
** when size - 1 characters or either CR/LF are read. Note the parameters are
|
||||
** more aligned with stdio fgets() as opposed to the quirky "standard" conio
|
||||
** cgets(). Besides providing saner parameters, the function also echoes CRLF
|
||||
** when either CR/LF are read but does NOT append either in the buffer. This is
|
||||
** to correspond to stdio fgets() which echoes CRLF, but prevents a "gotcha"
|
||||
** where the buffer might not be able to accommodate both CR and LF at the end.
|
||||
**
|
||||
** param: buffer - where to save the input, must be non-NULL
|
||||
** param: size - size of the buffer, must be > 1
|
||||
** return: buffer if successful, NULL on error
|
||||
** author: Russell-S-Harper
|
||||
*/
|
||||
|
||||
int cscanf (const char* format, ...);
|
||||
/* Like scanf(), but uses direct keyboard input */
|
||||
|
||||
@@ -216,7 +231,18 @@ void __fastcall__ cputhex16 (unsigned val);
|
||||
# define cpeekrevers() _cpeekrevers()
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _chline
|
||||
# define chline(len) _chline(len)
|
||||
#endif
|
||||
#ifdef _cvline
|
||||
# define cvline(len) _cvline(len)
|
||||
#endif
|
||||
#ifdef _chlinexy
|
||||
# define chlinexy(x, y, len) _chlinexy(x, y, len)
|
||||
#endif
|
||||
#ifdef _cvlinexy
|
||||
# define cvlinexy(x, y, len) _cvlinexy(x, y, len)
|
||||
#endif
|
||||
|
||||
/* End of conio.h */
|
||||
#endif
|
||||
|
||||
120
include/mega65.h
Normal file
120
include/mega65.h
Normal file
@@ -0,0 +1,120 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* mega65.h */
|
||||
/* */
|
||||
/* MEGA65 system specific definitions */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998-2013, Ullrich von Bassewitz */
|
||||
/* Roemerstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
/* */
|
||||
/* 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 _MEGA65_H
|
||||
#define _MEGA65_H
|
||||
|
||||
|
||||
|
||||
/* Check for errors */
|
||||
#if !defined(__MEGA65__)
|
||||
# error This module may only be used when compiling for the MEGA65!
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Additional key defines */
|
||||
#define CH_F1 133
|
||||
#define CH_F2 137
|
||||
#define CH_F3 134
|
||||
#define CH_F4 138
|
||||
#define CH_F5 135
|
||||
#define CH_F6 139
|
||||
#define CH_F7 136
|
||||
#define CH_F8 140
|
||||
|
||||
/* Color defines */
|
||||
#define COLOR_BLACK 0x00
|
||||
#define COLOR_WHITE 0x01
|
||||
#define COLOR_RED 0x02
|
||||
#define COLOR_CYAN 0x03
|
||||
#define COLOR_PURPLE 0x04
|
||||
#define COLOR_GREEN 0x05
|
||||
#define COLOR_BLUE 0x06
|
||||
#define COLOR_YELLOW 0x07
|
||||
#define COLOR_ORANGE 0x08
|
||||
#define COLOR_BROWN 0x09
|
||||
#define COLOR_LIGHTRED 0x0A
|
||||
#define COLOR_GRAY1 0x0B
|
||||
#define COLOR_GRAY2 0x0C
|
||||
#define COLOR_LIGHTGREEN 0x0D
|
||||
#define COLOR_LIGHTBLUE 0x0E
|
||||
#define COLOR_GRAY3 0x0F
|
||||
|
||||
/* TGI color defines */
|
||||
#define TGI_COLOR_BLACK COLOR_BLACK
|
||||
#define TGI_COLOR_WHITE COLOR_WHITE
|
||||
#define TGI_COLOR_RED COLOR_RED
|
||||
#define TGI_COLOR_CYAN COLOR_CYAN
|
||||
#define TGI_COLOR_PURPLE COLOR_PURPLE
|
||||
#define TGI_COLOR_GREEN COLOR_GREEN
|
||||
#define TGI_COLOR_BLUE COLOR_BLUE
|
||||
#define TGI_COLOR_YELLOW COLOR_YELLOW
|
||||
#define TGI_COLOR_ORANGE COLOR_ORANGE
|
||||
#define TGI_COLOR_BROWN COLOR_BROWN
|
||||
#define TGI_COLOR_LIGHTRED COLOR_LIGHTRED
|
||||
#define TGI_COLOR_GRAY1 COLOR_GRAY1
|
||||
#define TGI_COLOR_GRAY2 COLOR_GRAY2
|
||||
#define TGI_COLOR_LIGHTGREEN COLOR_LIGHTGREEN
|
||||
#define TGI_COLOR_LIGHTBLUE COLOR_LIGHTBLUE
|
||||
#define TGI_COLOR_GRAY3 COLOR_GRAY3
|
||||
|
||||
/* Masks for joy_read */
|
||||
#define JOY_UP_MASK 0x01
|
||||
#define JOY_DOWN_MASK 0x02
|
||||
#define JOY_LEFT_MASK 0x04
|
||||
#define JOY_RIGHT_MASK 0x08
|
||||
#define JOY_BTN_1_MASK 0x10
|
||||
|
||||
|
||||
/* Define hardware */
|
||||
#include <_vic3.h>
|
||||
#define VIC (*(struct __vic2*)0xD000)
|
||||
|
||||
#include <_sid.h>
|
||||
#define SID1 (*(struct __sid*)0xD400)
|
||||
#define SID2 (*(struct __sid*)0xD420)
|
||||
|
||||
#include <_6526.h>
|
||||
#define CIA1 (*(struct __6526*)0xDC00)
|
||||
#define CIA2 (*(struct __6526*)0xDD00)
|
||||
|
||||
|
||||
/* Define special memory areas */
|
||||
#define COLOR_RAM ((unsigned char*)0xD800)
|
||||
|
||||
|
||||
/* End of mega65.h */
|
||||
#endif
|
||||
@@ -57,8 +57,7 @@
|
||||
/* The addresses of the static drivers */
|
||||
extern void plus4_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */
|
||||
extern void plus4_stdser_ser[]; /* Referred to by ser_static_stddrv[] */
|
||||
|
||||
|
||||
extern void ted_hi_tgi[];
|
||||
|
||||
/* End of plus4.h */
|
||||
#endif
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
# include <apple2enh.h>
|
||||
#elif defined(__APPLE2__)
|
||||
# include <apple2.h>
|
||||
#elif defined(__AGAT__)
|
||||
# include <agat.h>
|
||||
#elif defined(__ATARI__)
|
||||
# include <atari.h>
|
||||
#elif defined(__ATARI2600__)
|
||||
|
||||
@@ -141,15 +141,16 @@ unsigned char tgi_getmaxcolor (void);
|
||||
** then be getmaxcolor()+1).
|
||||
*/
|
||||
|
||||
void __fastcall__ tgi_setcolor (unsigned char color);
|
||||
/* Set the current drawing color. */
|
||||
void __fastcall__ tgi_setcolor (unsigned char color_index);
|
||||
/* Set the current drawing color (palette index). */
|
||||
|
||||
unsigned char tgi_getcolor (void);
|
||||
/* Return the current drawing color. */
|
||||
/* Return the current drawing color (palette index). */
|
||||
|
||||
void __fastcall__ tgi_setpalette (const unsigned char* palette);
|
||||
/* Set the palette (not available with all drivers/hardware). palette is
|
||||
** a pointer to as many entries as there are colors.
|
||||
** a pointer to as many entries as there are colors required for the drivers
|
||||
** palette. This palette is the (only) place where to use the TGI_COLOR values.
|
||||
*/
|
||||
|
||||
const unsigned char* tgi_getpalette (void);
|
||||
|
||||
@@ -1,13 +1,31 @@
|
||||
# ---- Display info during parsing phase ----
|
||||
SILENT:=$(findstring s,$(word 1, $(MAKEFLAGS)))
|
||||
ifneq ($(SILENT),s)
|
||||
$(info Using Makefile: $(realpath $(firstword $(MAKEFILE_LIST))) $(MAKECMDGOALS))
|
||||
endif
|
||||
|
||||
ifneq ($(shell echo),)
|
||||
CMD_EXE = 1
|
||||
endif
|
||||
|
||||
ifeq ($(SILENT),s)
|
||||
QUIET = 1
|
||||
endif
|
||||
|
||||
ifdef QUIET
|
||||
.SILENT:
|
||||
PQ = "QUIET=1"
|
||||
PD = --no-print-directory
|
||||
endif
|
||||
|
||||
CBMS = c128 \
|
||||
c16 \
|
||||
c64 \
|
||||
c65 \
|
||||
cbm510 \
|
||||
cbm610 \
|
||||
cx16 \
|
||||
mega65 \
|
||||
pet \
|
||||
plus4 \
|
||||
vic20
|
||||
@@ -15,7 +33,8 @@ CBMS = c128 \
|
||||
GEOS = geos-apple \
|
||||
geos-cbm
|
||||
|
||||
TARGETS = apple2 \
|
||||
TARGETS = agat \
|
||||
apple2 \
|
||||
apple2enh \
|
||||
atari \
|
||||
atarixl \
|
||||
@@ -124,7 +143,7 @@ zip:
|
||||
$(foreach dir,$(OUTPUTDIRS),$(ZIP_recipe))
|
||||
|
||||
$(TARGETS): | ../lib
|
||||
@$(MAKE) --no-print-directory $@
|
||||
@$(MAKE) $(PD) $@ $(PQ)
|
||||
|
||||
# ../lib must be created globally before doing lib targets in parallel
|
||||
../lib:
|
||||
@@ -243,8 +262,8 @@ $1_DYNS = $$(patsubst $$($1_SRCPAT),$$($1_DYNPAT),$$($1_SRCS))
|
||||
$1_DRVS = $$(patsubst $$($1_DYNPAT),$$($1_DRVPAT),$$($1_DYNS))
|
||||
|
||||
$$($1_STCPAT): $$($1_SRCPAT)
|
||||
@echo $$(TARGET) - $$< - static
|
||||
@$$(CA65) -t $$(TARGET) -D DYN_DRV=0 $$(CA65FLAGS) --create-dep $$(@:.o=.d) -o $$@ $$<
|
||||
$$(if $$(QUIET),@echo $$(TARGET) - $$< - static)
|
||||
$$(CA65) -t $$(TARGET) -D DYN_DRV=0 $$(CA65FLAGS) --create-dep $$(@:.o=.d) -o $$@ $$<
|
||||
|
||||
OBJS += $$($1_STCS)
|
||||
DEPS += $$($1_STCS:.o=.d)
|
||||
@@ -252,8 +271,8 @@ DEPS += $$($1_STCS:.o=.d)
|
||||
$$($1_DYNS): | $$($1_DYNDIR)
|
||||
|
||||
$$($1_DRVPAT): $$($1_DYNPAT) $$(ZPOBJ) | $$($1_DRVDIR)
|
||||
@echo $$(TARGET) - $$(<F)
|
||||
@$$(LD65) -o $$@ -t module $$^
|
||||
$$(if $$(QUIET),@echo $$(TARGET) - $$(<F))
|
||||
$$(LD65) -o $$@ -t module $$^
|
||||
|
||||
$$($1_DYNDIR) $$($1_DRVDIR):
|
||||
@$$(call MKDIR,$$@)
|
||||
@@ -275,16 +294,16 @@ export CC65_HOME := $(abspath ..)
|
||||
|
||||
define ASSEMBLE_recipe
|
||||
|
||||
$(if $(QUIET),,@echo $(TARGET) - $<)
|
||||
@$(CA65) -t $(TARGET) $(CA65FLAGS) --create-dep $(@:.o=.d) -o $@ $<
|
||||
$(if $(QUIET),@echo $(TARGET) - $<)
|
||||
$(CA65) -t $(TARGET) $(CA65FLAGS) --create-dep $(@:.o=.d) -o $@ $<
|
||||
|
||||
endef # ASSEMBLE_recipe
|
||||
|
||||
define COMPILE_recipe
|
||||
|
||||
$(if $(QUIET),,@echo $(TARGET) - $<)
|
||||
@$(CC65) -t $(TARGET) $(CC65FLAGS) --create-dep $(@:.o=.d) --dep-target $@ -o $(@:.o=.s) $<
|
||||
@$(CA65) -t $(TARGET) -o $@ $(@:.o=.s)
|
||||
$(if $(QUIET),@echo $(TARGET) - $<)
|
||||
$(CC65) -t $(TARGET) $(CC65FLAGS) --create-dep $(@:.o=.d) --dep-target $@ -o $(@:.o=.s) $<
|
||||
$(CA65) -t $(TARGET) -o $@ $(@:.o=.s)
|
||||
|
||||
endef # COMPILE_recipe
|
||||
|
||||
@@ -295,12 +314,13 @@ endef # COMPILE_recipe
|
||||
$(COMPILE_recipe)
|
||||
|
||||
$(EXTRA_OBJPAT): $(EXTRA_SRCPAT) | ../libwrk/$(TARGET) ../lib
|
||||
@echo $(TARGET) - $(<F)
|
||||
$(if $(QUIET),@echo $(TARGET) - $(<F))
|
||||
@$(CA65) -t $(TARGET) $(CA65FLAGS) --create-dep $(@:../lib/%.o=../libwrk/$(TARGET)/%.d) -o $@ $<
|
||||
|
||||
$(EXTRA_OBJS): | ../lib
|
||||
|
||||
../lib/$(TARGET).lib: $(OBJS) | ../lib
|
||||
$(if $(QUIET),@echo $(TARGET) - $<)
|
||||
$(AR65) a $@ $?
|
||||
|
||||
../libwrk/$(TARGET) ../target/$(TARGET)/util:
|
||||
|
||||
23
libsrc/agat/_scrsize.s
Normal file
23
libsrc/agat/_scrsize.s
Normal file
@@ -0,0 +1,23 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 26.10.2000
|
||||
; Konstantin Fedorov, 12.06.2025
|
||||
;
|
||||
; Screen size variables
|
||||
;
|
||||
|
||||
.export screensize
|
||||
|
||||
.include "agat.inc"
|
||||
|
||||
screensize:
|
||||
lda WNDWDTH
|
||||
bit TATTR
|
||||
bmi t64
|
||||
lsr
|
||||
t64:
|
||||
tax
|
||||
lda WNDBTM
|
||||
sec
|
||||
sbc WNDTOP
|
||||
tay
|
||||
rts
|
||||
113
libsrc/agat/break.s
Normal file
113
libsrc/agat/break.s
Normal file
@@ -0,0 +1,113 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 27.09.1998
|
||||
; Oleg A. Odintsov, Moscow, 2024
|
||||
;
|
||||
; void __fastcall__ set_brk (unsigned Addr);
|
||||
; void reset_brk (void);
|
||||
;
|
||||
|
||||
.export _set_brk, _reset_brk
|
||||
.destructor _reset_brk
|
||||
|
||||
; Be sure to export the following variables absolute
|
||||
.export _brk_a: abs, _brk_x: abs, _brk_y: abs
|
||||
.export _brk_sr: abs, _brk_pc: abs
|
||||
|
||||
.include "agat.inc"
|
||||
|
||||
_brk_a = $45
|
||||
_brk_x = $46
|
||||
_brk_y = $47
|
||||
_brk_sr = $48
|
||||
_brk_sp = $49
|
||||
_brk_pc = $3A
|
||||
|
||||
.bss
|
||||
oldvec: .res 2 ; Old vector
|
||||
|
||||
|
||||
.data
|
||||
uservec: jmp $FFFF ; Patched at runtime
|
||||
|
||||
|
||||
.code
|
||||
|
||||
; Set the break vector
|
||||
.proc _set_brk
|
||||
|
||||
sta uservec+1
|
||||
stx uservec+2 ; Set the user vector
|
||||
|
||||
lda oldvec
|
||||
ora oldvec+1 ; Did we save the vector already?
|
||||
bne L1 ; Jump if we installed the handler already
|
||||
|
||||
lda BRKVec
|
||||
sta oldvec
|
||||
lda BRKVec+1
|
||||
sta oldvec+1 ; Save the old vector
|
||||
|
||||
L1: lda #<brk_handler ; Set the break vector to our routine
|
||||
ldx #>brk_handler
|
||||
sta BRKVec
|
||||
stx BRKVec+1
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
; Reset the break vector
|
||||
.proc _reset_brk
|
||||
|
||||
lda oldvec
|
||||
ldx oldvec+1
|
||||
beq @L9 ; Jump if vector not installed
|
||||
sta BRKVec
|
||||
stx BRKVec+1
|
||||
lda #$00
|
||||
sta oldvec ; Clear the old vector
|
||||
stx oldvec+1
|
||||
@L9: rts
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
|
||||
; Break handler, called if a break occurs
|
||||
|
||||
.proc brk_handler
|
||||
|
||||
sec
|
||||
lda _brk_pc
|
||||
sbc #$02 ; Point to start of brk
|
||||
sta _brk_pc
|
||||
lda _brk_pc+1
|
||||
sbc #$00
|
||||
sta _brk_pc+1
|
||||
|
||||
clc
|
||||
lda _brk_sp
|
||||
adc #$04 ; Adjust stack pointer
|
||||
sta _brk_sp
|
||||
|
||||
lda _brk_sr ; Clear brk
|
||||
and #$EF
|
||||
sta _brk_sr
|
||||
|
||||
jsr uservec ; Call the user's routine
|
||||
|
||||
lda _brk_pc+1
|
||||
pha
|
||||
lda _brk_pc
|
||||
pha
|
||||
lda _brk_sr
|
||||
pha
|
||||
|
||||
ldx _brk_x
|
||||
ldy _brk_y
|
||||
lda _brk_a
|
||||
|
||||
rti ; Jump back...
|
||||
|
||||
.endproc
|
||||
|
||||
18
libsrc/agat/cclear.s
Normal file
18
libsrc/agat/cclear.s
Normal file
@@ -0,0 +1,18 @@
|
||||
;
|
||||
; Oleg A. Odintsov, Moscow, 2024
|
||||
;
|
||||
; void __fastcall__ cclear (unsigned char length);
|
||||
;
|
||||
|
||||
.export _cclear
|
||||
.import COUT
|
||||
.include "zeropage.inc"
|
||||
|
||||
_cclear:
|
||||
sta ptr1
|
||||
lda #$A0
|
||||
next:
|
||||
jsr COUT
|
||||
dec ptr1
|
||||
bne next
|
||||
rts
|
||||
23
libsrc/agat/cgetc.s
Normal file
23
libsrc/agat/cgetc.s
Normal file
@@ -0,0 +1,23 @@
|
||||
;
|
||||
; Oleg A. Odintsov, Moscow, 2024
|
||||
;
|
||||
; char cgetc (void);
|
||||
;
|
||||
|
||||
.export _cgetc
|
||||
.import cursor
|
||||
.include "agat.inc"
|
||||
|
||||
_cgetc:
|
||||
lda #$DF ; _
|
||||
bit cursor
|
||||
bne hascur
|
||||
lda #$00
|
||||
hascur:
|
||||
sta CURSOR
|
||||
jsr j1
|
||||
cmp #$A0
|
||||
bpl :+
|
||||
and #$7F
|
||||
: rts
|
||||
j1: jmp (VCIN)
|
||||
33
libsrc/agat/chline.s
Normal file
33
libsrc/agat/chline.s
Normal file
@@ -0,0 +1,33 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 08.08.1998
|
||||
; Colin Leroy-Mira, 26.05.2025
|
||||
; Konstantin Fedorov, 12.06.2025
|
||||
;
|
||||
; void chlinexy (unsigned char x, unsigned char y, unsigned char length);
|
||||
; void chline (unsigned char length);
|
||||
;
|
||||
|
||||
.export _chlinexy, _chline, chlinedirect
|
||||
.import gotoxy, putchar
|
||||
|
||||
.include "zeropage.inc"
|
||||
|
||||
_chlinexy:
|
||||
pha ; Save the length
|
||||
jsr gotoxy ; Call this one, will pop params
|
||||
pla ; Restore the length and run into _chline
|
||||
|
||||
_chline:
|
||||
ldx #$1B ; horizontal line character
|
||||
|
||||
chlinedirect:
|
||||
stx tmp1
|
||||
cmp #$00 ; Is the length zero?
|
||||
beq done ; Jump if done
|
||||
sta tmp2
|
||||
: lda tmp1 ; Screen code
|
||||
jsr putchar ; Direct output
|
||||
dec tmp2
|
||||
bne :-
|
||||
done: rts
|
||||
|
||||
10
libsrc/agat/clrscr.s
Normal file
10
libsrc/agat/clrscr.s
Normal file
@@ -0,0 +1,10 @@
|
||||
;
|
||||
; Kevin Ruland
|
||||
;
|
||||
; void clrscr (void);
|
||||
;
|
||||
|
||||
.export _clrscr
|
||||
.import HOME
|
||||
|
||||
_clrscr := HOME
|
||||
20
libsrc/agat/color.s
Normal file
20
libsrc/agat/color.s
Normal file
@@ -0,0 +1,20 @@
|
||||
;
|
||||
; Oleg A. Odintsov, Moscow, 2024
|
||||
;
|
||||
; unsigned char __fastcall__ textcolor (unsigned char color);
|
||||
;
|
||||
|
||||
|
||||
.export _textcolor
|
||||
.include "agat.inc"
|
||||
|
||||
|
||||
_textcolor:
|
||||
ldx TATTR
|
||||
eor TATTR
|
||||
and #$07
|
||||
eor TATTR
|
||||
sta TATTR
|
||||
txa
|
||||
and #$0F
|
||||
rts
|
||||
14
libsrc/agat/cout.s
Normal file
14
libsrc/agat/cout.s
Normal file
@@ -0,0 +1,14 @@
|
||||
;
|
||||
; Oleg A. Odintsov, Moscow, 2024
|
||||
;
|
||||
; COUT routine
|
||||
;
|
||||
|
||||
.export COUT
|
||||
.include "agat.inc"
|
||||
|
||||
COUT:
|
||||
cmp #$10
|
||||
bpl out
|
||||
ora #$80
|
||||
out: jmp (VCOUT)
|
||||
60
libsrc/agat/cputc.s
Normal file
60
libsrc/agat/cputc.s
Normal file
@@ -0,0 +1,60 @@
|
||||
;
|
||||
; Oleg A. Odintsov, Moscow, 2024
|
||||
; Konstantin Fedorov, 12.06.2025
|
||||
;
|
||||
; void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);
|
||||
; void __fastcall__ cputc (char c);
|
||||
;
|
||||
|
||||
.import COUT
|
||||
.export _cputcxy, _cputc, newline, putchar,putchardirect
|
||||
.import gotoxy, VTABZ
|
||||
.include "agat.inc"
|
||||
|
||||
_cputcxy:
|
||||
pha
|
||||
jsr gotoxy
|
||||
pla
|
||||
_cputc:
|
||||
cmp #$0D ; Test for \r = carriage return
|
||||
bne notleft
|
||||
ldy #$00
|
||||
sty CH
|
||||
rts
|
||||
notleft:
|
||||
cmp #$0A ; Test for \n = line feed
|
||||
beq newline
|
||||
|
||||
putchar:
|
||||
ldy CH
|
||||
sta (BASL),Y
|
||||
iny
|
||||
lda TATTR
|
||||
bmi wch ; Skip if t64
|
||||
sta (BASL),Y
|
||||
iny
|
||||
wch:
|
||||
sty CH
|
||||
cpy WNDWDTH
|
||||
bcc noend
|
||||
ldy #$00
|
||||
sty CH
|
||||
newline:
|
||||
inc CV
|
||||
lda CV
|
||||
cmp WNDBTM
|
||||
bcc :+
|
||||
lda WNDTOP
|
||||
sta CV
|
||||
: jmp VTABZ
|
||||
noend:
|
||||
rts
|
||||
|
||||
putchardirect:
|
||||
ldy CH
|
||||
sta (BASL),Y
|
||||
lda TATTR
|
||||
bmi :+
|
||||
iny
|
||||
sta (BASL),Y
|
||||
: rts
|
||||
78
libsrc/agat/crt0.s
Normal file
78
libsrc/agat/crt0.s
Normal file
@@ -0,0 +1,78 @@
|
||||
;
|
||||
; Startup code for cc65 (Agat version)
|
||||
;
|
||||
|
||||
.export __STARTUP__ : absolute = 1 ; Mark as startup
|
||||
.export _exit
|
||||
|
||||
.import initlib, donelib
|
||||
.import zerobss, callmain
|
||||
.import __ONCE_LOAD__, __ONCE_SIZE__ ; Linker generated
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "agat.inc"
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
.segment "STARTUP"
|
||||
jsr init
|
||||
jsr zerobss
|
||||
jsr callmain
|
||||
_exit:
|
||||
ldx #<exit
|
||||
lda #>exit
|
||||
jsr reset
|
||||
jsr donelib
|
||||
exit:
|
||||
ldx #$02
|
||||
: lda rvsave,x
|
||||
sta SOFTEV,x
|
||||
dex
|
||||
bpl :-
|
||||
ldx #zpspace-1
|
||||
: lda zpsave,x
|
||||
sta c_sp,x
|
||||
dex
|
||||
bpl :-
|
||||
ldx #$FF
|
||||
txs
|
||||
jmp DOSWARM
|
||||
|
||||
|
||||
|
||||
.segment "ONCE"
|
||||
|
||||
init:
|
||||
ldx #zpspace-1
|
||||
: lda c_sp,x
|
||||
sta zpsave,x
|
||||
dex
|
||||
bpl :-
|
||||
|
||||
ldx #$02
|
||||
: lda SOFTEV,x
|
||||
sta rvsave,x
|
||||
dex
|
||||
bpl :-
|
||||
|
||||
lda HIMEM
|
||||
ldx HIMEM+1
|
||||
sta c_sp
|
||||
stx c_sp+1
|
||||
ldx #<_exit
|
||||
lda #>_exit
|
||||
jsr reset
|
||||
jmp initlib
|
||||
|
||||
.code
|
||||
|
||||
reset:
|
||||
stx SOFTEV
|
||||
sta SOFTEV+1
|
||||
eor #$A5
|
||||
sta PWREDUP
|
||||
rts
|
||||
|
||||
.segment "INIT"
|
||||
zpsave: .res zpspace
|
||||
rvsave: .res 3
|
||||
29
libsrc/agat/cvline.s
Normal file
29
libsrc/agat/cvline.s
Normal file
@@ -0,0 +1,29 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 08.08.1998
|
||||
; Colin Leroy-Mira, 26.05.2025
|
||||
; Konstantin Fedorov, 12.06.2025
|
||||
;
|
||||
; void cvlinexy (unsigned char x, unsigned char y, unsigned char length);
|
||||
; void cvline (unsigned char length);
|
||||
;
|
||||
|
||||
.export _cvlinexy, _cvline
|
||||
.import gotoxy, putchardirect, newline
|
||||
|
||||
.include "zeropage.inc"
|
||||
|
||||
_cvlinexy:
|
||||
pha ; Save the length
|
||||
jsr gotoxy ; Call this one, will pop params
|
||||
pla ; Restore the length and run into _cvline
|
||||
|
||||
_cvline:
|
||||
cmp #$00 ; Is the length zero?
|
||||
beq done ; Jump if done
|
||||
sta tmp2
|
||||
: lda #$5C ; vertical line character
|
||||
jsr putchardirect ; Write, no cursor advance
|
||||
jsr newline ; Advance cursor to next line
|
||||
dec tmp2
|
||||
bne :-
|
||||
done: rts
|
||||
43
libsrc/agat/exehdr.s
Normal file
43
libsrc/agat/exehdr.s
Normal file
@@ -0,0 +1,43 @@
|
||||
;
|
||||
; Oliver Schmidt, 2012-06-10
|
||||
;
|
||||
; This module supplies an AppleSingle version 2 file header + entry with
|
||||
; ID 11 according to https://tools.ietf.org/rfc/rfc1740.txt Appendix A.
|
||||
;
|
||||
; Agat target uses this header only for compatibility with Apple Commander
|
||||
; because Agat's 140K disk filesystem is identical to Apple II DOS 3.3 and
|
||||
; "ac.jar -as" option can be used to import binaries into disk images.
|
||||
|
||||
.export __EXEHDR__ : absolute = 1 ; Linker referenced
|
||||
.import __FILETYPE__ ; Linker generated
|
||||
.import __MAIN_START__, __MAIN_LAST__ ; Linker generated
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
; Data Fork
|
||||
ID01_LENGTH = __MAIN_LAST__ - __MAIN_START__
|
||||
ID01_OFFSET = ID01 - START
|
||||
|
||||
; ProDOS File Info
|
||||
ID11_LENGTH = ID01 - ID11
|
||||
ID11_OFFSET = ID11 - START
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
.segment "EXEHDR"
|
||||
|
||||
START: .byte $00, $05, $16, $00 ; Magic number
|
||||
.byte $00, $02, $00, $00 ; Version number
|
||||
.res 16 ; Filler
|
||||
.byte 0, 2 ; Number of entries
|
||||
.byte 0, 0, 0, 1 ; Entry ID 1 - Data Fork
|
||||
.byte 0, 0, >ID01_OFFSET, <ID01_OFFSET ; Offset
|
||||
.byte 0, 0, >ID01_LENGTH, <ID01_LENGTH ; Length
|
||||
.byte 0, 0, 0, 11 ; Entry ID 11 - ProDOS File Info
|
||||
.byte 0, 0, >ID11_OFFSET, <ID11_OFFSET ; Offset
|
||||
.byte 0, 0, >ID11_LENGTH, <ID11_LENGTH ; Length
|
||||
ID11: .byte 0, %11000011 ; Access - Destroy, Rename, Write, Read
|
||||
.byte >__FILETYPE__, <__FILETYPE__ ; File Type
|
||||
.byte 0, 0 ; Auxiliary Type high
|
||||
.byte >__MAIN_START__, <__MAIN_START__ ; Auxiliary Type low
|
||||
ID01:
|
||||
28
libsrc/agat/gotoxy.s
Normal file
28
libsrc/agat/gotoxy.s
Normal file
@@ -0,0 +1,28 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 06.08.1998
|
||||
; Oleg A. Odintsov, Moscow, 2024
|
||||
;
|
||||
; void __fastcall__ gotoxy (unsigned char x, unsigned char y);
|
||||
; void __fastcall__ gotox (unsigned char x);
|
||||
;
|
||||
|
||||
.export gotoxy, _gotoxy, _gotox
|
||||
.import popa, VTABZ
|
||||
|
||||
.include "agat.inc"
|
||||
|
||||
gotoxy:
|
||||
jsr popa ; Get Y
|
||||
_gotoxy:
|
||||
clc
|
||||
adc WNDTOP
|
||||
sta CV ; Store Y
|
||||
jsr VTABZ
|
||||
jsr popa ; Get X
|
||||
_gotox:
|
||||
bit TATTR
|
||||
bmi t64
|
||||
asl
|
||||
t64:
|
||||
sta CH ; Store X
|
||||
rts
|
||||
16
libsrc/agat/gotoy.s
Normal file
16
libsrc/agat/gotoy.s
Normal file
@@ -0,0 +1,16 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 06.08.1998
|
||||
; Oleg A. Odintsov, Moscow, 2024
|
||||
;
|
||||
; void __fastcall__ gotoy (unsigned char y);
|
||||
;
|
||||
|
||||
.import VTABZ
|
||||
.export _gotoy
|
||||
.include "agat.inc"
|
||||
|
||||
_gotoy:
|
||||
clc
|
||||
adc WNDTOP
|
||||
sta CV
|
||||
jmp VTABZ
|
||||
15
libsrc/agat/home.s
Normal file
15
libsrc/agat/home.s
Normal file
@@ -0,0 +1,15 @@
|
||||
;
|
||||
; Oleg A. Odintsov, Moscow, 2024
|
||||
;
|
||||
; HOME routine
|
||||
;
|
||||
|
||||
.export HOME
|
||||
.import COUT
|
||||
|
||||
.include "agat.inc"
|
||||
|
||||
HOME:
|
||||
lda #$8C
|
||||
jmp COUT
|
||||
rts
|
||||
19
libsrc/agat/kbhit.s
Normal file
19
libsrc/agat/kbhit.s
Normal file
@@ -0,0 +1,19 @@
|
||||
;
|
||||
; Kevin Ruland
|
||||
; Ullrich von Bassewitz, 2005-03-25
|
||||
; Oleg A. Odintsov, Moscow, 2024
|
||||
;
|
||||
; unsigned char kbhit (void);
|
||||
;
|
||||
|
||||
.export _kbhit
|
||||
|
||||
.include "agat.inc"
|
||||
|
||||
_kbhit:
|
||||
lda KBD ; Reading KBD checks for keypress
|
||||
rol ; if high bit is set, key was pressed
|
||||
lda #$00
|
||||
tax
|
||||
rol
|
||||
rts
|
||||
18
libsrc/agat/randomize.s
Normal file
18
libsrc/agat/randomize.s
Normal file
@@ -0,0 +1,18 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 07.11.2002
|
||||
; Oleg A. Odintsov, Moscow, 2024
|
||||
;
|
||||
; void _randomize (void);
|
||||
; /* Initialize the random number generator */
|
||||
;
|
||||
|
||||
.export __randomize
|
||||
.import _srand
|
||||
|
||||
.include "agat.inc"
|
||||
|
||||
__randomize:
|
||||
ldx RNDH ; Use random value supplied by ROM
|
||||
lda RNDL
|
||||
jmp _srand ; Initialize generator
|
||||
|
||||
38
libsrc/agat/revers.s
Normal file
38
libsrc/agat/revers.s
Normal file
@@ -0,0 +1,38 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 2005-03-28
|
||||
; Oleg A. Odintsov, Moscow, 2024
|
||||
;
|
||||
; unsigned char __fastcall__ revers (unsigned char onoff)
|
||||
; unsigned char __fastcall__ flash (unsigned char onoff)
|
||||
;
|
||||
|
||||
.export _revers, _flash
|
||||
|
||||
.include "agat.inc"
|
||||
|
||||
_revers:
|
||||
tax
|
||||
beq noinv
|
||||
lda TATTR
|
||||
and #$D7
|
||||
sta TATTR
|
||||
rts
|
||||
noinv:
|
||||
lda TATTR
|
||||
ora #$20
|
||||
sta TATTR
|
||||
rts
|
||||
|
||||
_flash:
|
||||
tax
|
||||
beq noflash
|
||||
lda TATTR
|
||||
and #$DF
|
||||
ora #$08
|
||||
sta TATTR
|
||||
rts
|
||||
noflash:
|
||||
lda TATTR
|
||||
ora #$20
|
||||
sta TATTR
|
||||
rts
|
||||
37
libsrc/agat/sysuname.s
Normal file
37
libsrc/agat/sysuname.s
Normal file
@@ -0,0 +1,37 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 2003-08-12
|
||||
;
|
||||
; unsigned char __fastcall__ _sysuname (struct utsname* buf);
|
||||
;
|
||||
|
||||
.export __sysuname, utsdata
|
||||
|
||||
.import utscopy
|
||||
|
||||
__sysuname = utscopy
|
||||
|
||||
;--------------------------------------------------------------------------
|
||||
; Data. We define a fixed utsname struct here and just copy it.
|
||||
|
||||
.rodata
|
||||
|
||||
utsdata:
|
||||
; sysname
|
||||
.asciiz "cc65"
|
||||
|
||||
; nodename
|
||||
.asciiz ""
|
||||
|
||||
; release
|
||||
.byte .string (>.version)
|
||||
.byte '.'
|
||||
.byte .string (<.version)
|
||||
.byte $00
|
||||
|
||||
; version
|
||||
.byte '0' ; unused
|
||||
.byte $00
|
||||
|
||||
; machine
|
||||
.asciiz "Agat"
|
||||
|
||||
24
libsrc/agat/vtabz.s
Normal file
24
libsrc/agat/vtabz.s
Normal file
@@ -0,0 +1,24 @@
|
||||
;
|
||||
; Oleg A. Odintsov, Moscow, 2024
|
||||
;
|
||||
; VTABZ routine
|
||||
;
|
||||
|
||||
.export VTABZ
|
||||
.include "agat.inc"
|
||||
|
||||
VTABZ:
|
||||
lda CV
|
||||
ror
|
||||
ror
|
||||
ror
|
||||
and #$C0
|
||||
sta BASL
|
||||
lda CV
|
||||
lsr
|
||||
lsr
|
||||
eor BASH
|
||||
and #$07
|
||||
eor BASH
|
||||
sta BASH
|
||||
rts
|
||||
19
libsrc/agat/wherex.s
Normal file
19
libsrc/agat/wherex.s
Normal file
@@ -0,0 +1,19 @@
|
||||
;
|
||||
; Kevin Ruland
|
||||
; Oleg A. Odintsov, Moscow, 2024
|
||||
;
|
||||
; unsigned char wherex (void);
|
||||
;
|
||||
|
||||
.export _wherex
|
||||
|
||||
.include "agat.inc"
|
||||
|
||||
_wherex:
|
||||
lda CH
|
||||
bit TATTR
|
||||
bmi t64
|
||||
lsr
|
||||
t64:
|
||||
ldx #$00
|
||||
rts
|
||||
17
libsrc/agat/wherey.s
Normal file
17
libsrc/agat/wherey.s
Normal file
@@ -0,0 +1,17 @@
|
||||
;
|
||||
; Kevin Ruland
|
||||
; Oleg A. Odintsov, Moscow, 2024
|
||||
;
|
||||
; unsigned char wherey (void);
|
||||
;
|
||||
|
||||
.export _wherey
|
||||
|
||||
.include "agat.inc"
|
||||
|
||||
_wherey:
|
||||
lda CV
|
||||
sec
|
||||
sbc WNDTOP
|
||||
ldx #$00
|
||||
rts
|
||||
50
libsrc/agat/write.s
Normal file
50
libsrc/agat/write.s
Normal file
@@ -0,0 +1,50 @@
|
||||
;
|
||||
; Oleg A. Odintsov, Moscow, 2024
|
||||
;
|
||||
; int __fastcall__ write (int fd, const void* buf, unsigned count);
|
||||
;
|
||||
|
||||
.export _write
|
||||
.import popax, popptr1
|
||||
.import COUT
|
||||
|
||||
.include "zeropage.inc"
|
||||
|
||||
_write:
|
||||
sta ptr2
|
||||
stx ptr2+1
|
||||
jsr popptr1
|
||||
jsr popax
|
||||
|
||||
; Check for zero count
|
||||
ora ptr2
|
||||
beq done
|
||||
|
||||
; Get char from buf
|
||||
next: ldy #$00
|
||||
lda (ptr1),y
|
||||
|
||||
; Replace '\n' with '\r'
|
||||
cmp #$0A
|
||||
bne output
|
||||
lda #$8D
|
||||
|
||||
; Set hi bit and write to device
|
||||
output:
|
||||
jsr COUT ; Preserves X and Y
|
||||
|
||||
; Increment pointer
|
||||
inc ptr1
|
||||
bne :+
|
||||
inc ptr1+1
|
||||
|
||||
; Decrement count
|
||||
: dec ptr2
|
||||
bne next
|
||||
dec ptr2+1
|
||||
bpl next
|
||||
|
||||
; Return success
|
||||
done: lda #$00
|
||||
rts
|
||||
|
||||
@@ -4,8 +4,11 @@
|
||||
; unsigned char __fastcall__ allow_lowercase (unsigned char onoff);
|
||||
;
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
|
||||
.export _allow_lowercase
|
||||
.import uppercasemask, return0, return1
|
||||
.import return0
|
||||
.import uppercasemask, return1
|
||||
|
||||
_allow_lowercase:
|
||||
tax
|
||||
@@ -21,3 +24,5 @@ _allow_lowercase:
|
||||
|
||||
values: .byte $DF ; Force uppercase
|
||||
.byte $FF ; Keep lowercase
|
||||
|
||||
.endif
|
||||
|
||||
73
libsrc/apple2/boxchars.s
Normal file
73
libsrc/apple2/boxchars.s
Normal file
@@ -0,0 +1,73 @@
|
||||
;
|
||||
; Colin Leroy-Mira and Oliver Schmidt, 26.05.2025
|
||||
;
|
||||
; Initialize box-drawing characters according to
|
||||
; MouseText availability
|
||||
;
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
|
||||
.constructor initboxchars
|
||||
.import machinetype
|
||||
|
||||
.export _CH_HLINE
|
||||
.export _CH_VLINE
|
||||
.export _CH_ULCORNER
|
||||
.export _CH_URCORNER
|
||||
.export _CH_LLCORNER
|
||||
.export _CH_LRCORNER
|
||||
.export _CH_TTEE
|
||||
.export _CH_BTEE
|
||||
.export _CH_LTEE
|
||||
.export _CH_RTEE
|
||||
.export _CH_CROSS
|
||||
|
||||
.segment "ONCE"
|
||||
|
||||
initboxchars:
|
||||
bit machinetype ; IIe enhanced or newer?
|
||||
bvs out
|
||||
|
||||
ldx #NUM_BOXCHARS ; No mousetext, patch characters
|
||||
: lda std_boxchars,x
|
||||
sta boxchars,x
|
||||
dex
|
||||
bpl :-
|
||||
|
||||
out: rts
|
||||
|
||||
; Replacement chars for when MouseText is not available
|
||||
std_boxchars: .byte '!'
|
||||
.byte '-'
|
||||
.byte '+'
|
||||
.byte '+'
|
||||
.byte '+'
|
||||
.byte '+'
|
||||
|
||||
.data
|
||||
|
||||
; MouseText-based box characters
|
||||
boxchars:
|
||||
VERT: .byte $DF
|
||||
HORIZ: .byte $5F
|
||||
ULCORNER: .byte $5F
|
||||
URCORNER: .byte $20
|
||||
LLCORNER: .byte $D4
|
||||
LRCORNER: .byte $DF
|
||||
|
||||
NUM_BOXCHARS = *-boxchars
|
||||
|
||||
; exported symbols, referencing our 6 bytes
|
||||
_CH_HLINE = HORIZ
|
||||
_CH_VLINE = VERT
|
||||
_CH_ULCORNER = ULCORNER
|
||||
_CH_URCORNER = URCORNER
|
||||
_CH_LLCORNER = LLCORNER
|
||||
_CH_LRCORNER = LRCORNER
|
||||
_CH_TTEE = ULCORNER
|
||||
_CH_BTEE = LLCORNER
|
||||
_CH_LTEE = LLCORNER
|
||||
_CH_RTEE = LRCORNER
|
||||
_CH_CROSS = LLCORNER
|
||||
|
||||
.endif ; not __APPLE2ENH__
|
||||
@@ -54,7 +54,7 @@ exit: ldx #$02
|
||||
; Copy back the zero-page stuff.
|
||||
ldx #zpspace-1
|
||||
: lda zpsave,x
|
||||
sta sp,x
|
||||
sta c_sp,x
|
||||
dex
|
||||
bpl :-
|
||||
|
||||
|
||||
@@ -7,6 +7,10 @@
|
||||
;
|
||||
|
||||
.export _cgetc
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
.import machinetype
|
||||
.endif
|
||||
.import cursor, putchardirect
|
||||
|
||||
.include "zeropage.inc"
|
||||
@@ -18,11 +22,14 @@ _cgetc:
|
||||
beq :+
|
||||
|
||||
; Show caret.
|
||||
.ifdef __APPLE2ENH__
|
||||
lda #$7F | $80 ; Checkerboard, screen code
|
||||
.else
|
||||
.ifndef __APPLE2ENH__
|
||||
lda #' ' | $40 ; Blank, flashing
|
||||
bit machinetype
|
||||
bpl put_caret
|
||||
.endif
|
||||
|
||||
lda #$7F | $80 ; Checkerboard, screen code
|
||||
put_caret:
|
||||
jsr putchardirect ; Saves old character in tmp3
|
||||
|
||||
; Wait for keyboard strobe.
|
||||
@@ -44,10 +51,14 @@ _cgetc:
|
||||
|
||||
; At this time, the high bit of the key pressed is set.
|
||||
: bit KBDSTRB ; Clear keyboard strobe
|
||||
.ifdef __APPLE2ENH__
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
bit machinetype ; Apple //e or more recent?
|
||||
bpl clear
|
||||
.endif
|
||||
bit BUTN0 ; Check if OpenApple is down
|
||||
bmi done
|
||||
.endif
|
||||
and #$7F ; If not down, then clear high bit
|
||||
|
||||
clear: and #$7F ; If not down, then clear high bit
|
||||
done: ldx #>$0000
|
||||
rts
|
||||
|
||||
@@ -4,14 +4,24 @@
|
||||
; char cpeekc (void);
|
||||
;
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
.import machinetype
|
||||
.endif
|
||||
|
||||
.export _cpeekc
|
||||
|
||||
.include "apple2.inc"
|
||||
|
||||
_cpeekc:
|
||||
ldy CH
|
||||
.ifdef __APPLE2ENH__
|
||||
|
||||
sec ; Assume main memory
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
bit machinetype
|
||||
bpl peek
|
||||
.endif
|
||||
|
||||
bit RD80VID ; In 80 column mode?
|
||||
bpl peek ; No, just go ahead
|
||||
lda OURCH
|
||||
@@ -21,13 +31,12 @@ _cpeekc:
|
||||
php
|
||||
sei ; No valid MSLOT et al. in aux memory
|
||||
bit HISCR ; Assume SET80COL
|
||||
.endif
|
||||
|
||||
peek: lda (BASL),Y ; Get character
|
||||
.ifdef __APPLE2ENH__
|
||||
bcs :+ ; In main memory
|
||||
bit LOWSCR
|
||||
plp
|
||||
: .endif
|
||||
eor #$80 ; Invert high bit
|
||||
|
||||
: eor #$80 ; Invert high bit
|
||||
ldx #>$0000
|
||||
rts
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
; void __fastcall__ cputc (char c);
|
||||
;
|
||||
|
||||
.ifdef __APPLE2ENH__
|
||||
.constructor initconio
|
||||
.endif
|
||||
.export _cputcxy, _cputc
|
||||
.export cputdirect, newline, putchar, putchardirect
|
||||
.import gotoxy, VTABZ
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
.import machinetype
|
||||
.import uppercasemask
|
||||
.endif
|
||||
|
||||
@@ -22,12 +22,16 @@
|
||||
|
||||
.segment "ONCE"
|
||||
|
||||
.ifdef __APPLE2ENH__
|
||||
initconio:
|
||||
.ifndef __APPLE2ENH__
|
||||
bit machinetype
|
||||
bmi :+
|
||||
rts
|
||||
:
|
||||
.endif
|
||||
sta SETALTCHAR ; Switch in alternate charset
|
||||
bit LORES ; Limit SET80COL-HISCR to text
|
||||
rts
|
||||
.endif
|
||||
|
||||
.code
|
||||
|
||||
@@ -52,14 +56,22 @@ _cputc:
|
||||
|
||||
cputdirect:
|
||||
jsr putchar
|
||||
.ifdef __APPLE2ENH__
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
bit machinetype
|
||||
bpl :+
|
||||
.endif
|
||||
bit RD80VID ; In 80 column mode?
|
||||
bpl :+
|
||||
inc OURCH ; Bump to next column
|
||||
lda OURCH
|
||||
.ifdef __APPLE2ENH__
|
||||
bra check ; Must leave CH alone
|
||||
: .endif
|
||||
inc CH ; Bump to next column
|
||||
.else
|
||||
jmp check
|
||||
.endif
|
||||
|
||||
: inc CH ; Bump to next column
|
||||
lda CH
|
||||
check: cmp WNDWDTH
|
||||
bcc done
|
||||
@@ -67,13 +79,24 @@ check: cmp WNDWDTH
|
||||
left:
|
||||
.ifdef __APPLE2ENH__
|
||||
stz CH ; Goto left edge of screen
|
||||
bit RD80VID ; In 80 column mode?
|
||||
bpl done
|
||||
stz OURCH ; Goto left edge of screen
|
||||
.else
|
||||
lda #$00 ; Goto left edge of screen
|
||||
lda #$00
|
||||
sta CH
|
||||
.endif
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
bit machinetype
|
||||
bpl done
|
||||
.endif
|
||||
|
||||
bit RD80VID ; In 80 column mode?
|
||||
bpl done
|
||||
.ifdef __APPLE2ENH__
|
||||
stz OURCH ; Goto left edge of screen
|
||||
.else
|
||||
sta OURCH
|
||||
.endif
|
||||
|
||||
done: rts
|
||||
|
||||
newline:
|
||||
@@ -100,8 +123,14 @@ mask: and INVFLG ; Apply normal, inverse, flash
|
||||
putchardirect:
|
||||
tax
|
||||
ldy CH
|
||||
.ifdef __APPLE2ENH__
|
||||
|
||||
sec ; Assume main memory
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
bit machinetype
|
||||
bpl put
|
||||
.endif
|
||||
|
||||
bit RD80VID ; In 80 column mode?
|
||||
bpl put ; No, just go ahead
|
||||
lda OURCH
|
||||
@@ -111,14 +140,13 @@ putchardirect:
|
||||
php
|
||||
sei ; No valid MSLOT et al. in aux memory
|
||||
bit HISCR ; Assume SET80COL
|
||||
.endif
|
||||
|
||||
put: lda (BASL),Y ; Get current character
|
||||
sta tmp3 ; Save old character for _cgetc
|
||||
txa
|
||||
sta (BASL),Y
|
||||
.ifdef __APPLE2ENH__
|
||||
|
||||
bcs :+ ; In main memory
|
||||
bit LOWSCR
|
||||
plp
|
||||
: .endif
|
||||
rts
|
||||
: rts
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
; Save the zero-page locations that we need.
|
||||
init: ldx #zpspace-1
|
||||
: lda sp,x
|
||||
: lda c_sp,x
|
||||
sta zpsave,x
|
||||
dex
|
||||
bpl :-
|
||||
@@ -56,8 +56,10 @@ init: ldx #zpspace-1
|
||||
bpl :-
|
||||
|
||||
; Check for ProDOS.
|
||||
ldy $BF00 ; MLI call entry point
|
||||
cpy #$4C ; Is MLI present? (JMP opcode)
|
||||
lda $BF00 ; MLI call entry point
|
||||
sec
|
||||
sbc #$4C ; Is MLI present? (JMP opcode)
|
||||
pha ; Backup the result for later
|
||||
bne basic
|
||||
|
||||
; Check the ProDOS system bit map.
|
||||
@@ -81,8 +83,8 @@ basic: lda HIMEM
|
||||
ldx HIMEM+1
|
||||
|
||||
; Set up the C stack.
|
||||
: sta sp
|
||||
stx sp+1
|
||||
: sta c_sp
|
||||
stx c_sp+1
|
||||
|
||||
; ProDOS TechRefMan, chapter 5.3.5:
|
||||
; "Your system program should place in the RESET vector the
|
||||
@@ -99,7 +101,20 @@ basic: lda HIMEM
|
||||
bit $C081
|
||||
bit $C081
|
||||
|
||||
; Set the source start address.
|
||||
pla ; If not running ProDOS, we need to patch 6502 vectors.
|
||||
beq :+
|
||||
|
||||
lda #<reset_6502
|
||||
ldx #>reset_6502
|
||||
sta ROM_RST
|
||||
stx ROM_RST+1
|
||||
|
||||
lda #<irq_6502
|
||||
ldx #>irq_6502
|
||||
sta ROM_IRQ
|
||||
stx ROM_IRQ+1
|
||||
|
||||
: ; Set the source start address.
|
||||
; Aka __LC_LOAD__ iff segment LC exists.
|
||||
lda #<(__ONCE_LOAD__ + __ONCE_SIZE__)
|
||||
ldy #>(__ONCE_LOAD__ + __ONCE_SIZE__)
|
||||
@@ -144,6 +159,14 @@ quit: jsr $BF00 ; MLI call entry point
|
||||
.byte $65 ; Quit
|
||||
.word q_param
|
||||
|
||||
reset_6502: ; Used with DOS3.3 programs
|
||||
bit $C082 ; Switch in ROM
|
||||
jmp (ROM_RST) ; Jump to ROM's RESET vector
|
||||
|
||||
irq_6502: ; Used with DOS3.3 programs
|
||||
bit $C082 ; Switch in ROM
|
||||
jmp (ROM_IRQ) ; Jump to ROM's IRQ/BRK vector
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
.rodata
|
||||
|
||||
56
libsrc/apple2/detect80cols.s
Normal file
56
libsrc/apple2/detect80cols.s
Normal file
@@ -0,0 +1,56 @@
|
||||
;
|
||||
; Colin Leroy-Mira, 27/05/2025
|
||||
;
|
||||
; Verify the presence of a 80 columns card in slot 3,
|
||||
; and publish a flag accordingly.
|
||||
;
|
||||
.export aux80col
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
.import machinetype
|
||||
.endif
|
||||
|
||||
.constructor detect80cols
|
||||
|
||||
.include "apple2.inc"
|
||||
|
||||
.data
|
||||
|
||||
aux80col: .byte 0
|
||||
|
||||
.segment "ONCE"
|
||||
|
||||
IdOfsTable: ; Table of bytes positions, used to check four
|
||||
; specific bytes on the slot's firmware to make
|
||||
; sure this is a serial card.
|
||||
.byte $05 ; Pascal 1.0 ID byte
|
||||
.byte $07 ; Pascal 1.0 ID byte
|
||||
.byte $0B ; Pascal 1.1 generic signature byte
|
||||
.byte $0C ; Device signature byte
|
||||
|
||||
IdValTable: ; Table of expected values for the four checked
|
||||
; bytes
|
||||
.byte $38 ; ID Byte 0 (from Pascal 1.0), fixed
|
||||
.byte $18 ; ID Byte 1 (from Pascal 1.0), fixed
|
||||
.byte $01 ; Generic signature for Pascal 1.1, fixed
|
||||
.byte $88 ; Device signature byte (80 columns card)
|
||||
|
||||
IdTableLen = * - IdValTable
|
||||
|
||||
detect80cols:
|
||||
.ifndef __APPLE2ENH__
|
||||
bit machinetype ; Check we're on a //e at least, otherwise we
|
||||
bpl NoDev ; handle no 80cols hardware (like Videx)
|
||||
.endif
|
||||
|
||||
ldx #IdTableLen-1
|
||||
: ldy IdOfsTable,x ; Check Pascal 1.1 Firmware Protocol ID bytes
|
||||
lda IdValTable,x
|
||||
cmp $C300,y
|
||||
bne NoDev
|
||||
dex
|
||||
bpl :-
|
||||
|
||||
dec aux80col ; We have an 80-columns card! Set flag to $FF
|
||||
|
||||
NoDev: rts
|
||||
41
libsrc/apple2/dynchline.s
Normal file
41
libsrc/apple2/dynchline.s
Normal file
@@ -0,0 +1,41 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 08.08.1998
|
||||
; Colin Leroy-Mira, 26.05.2025
|
||||
;
|
||||
; void __fastcall__ dyn_chlinexy (unsigned char c, unsigned char x, unsigned char y, unsigned char length);
|
||||
; void __fastcall__ dyn_chline (unsigned char c, unsigned char length);
|
||||
;
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
|
||||
.export _dyn_chlinexy, _dyn_chline, chlinedirect
|
||||
.import gotoxy, cputdirect, popa
|
||||
.import machinetype
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "apple2.inc"
|
||||
|
||||
_dyn_chlinexy:
|
||||
pha ; Save the length
|
||||
jsr gotoxy ; Call this one, will pop params
|
||||
pla ; Restore the length and run into _chline
|
||||
|
||||
_dyn_chline:
|
||||
pha
|
||||
jsr popa ; Get the character to draw
|
||||
eor #$80 ; Invert high bit
|
||||
tax
|
||||
pla
|
||||
|
||||
chlinedirect:
|
||||
stx tmp1
|
||||
cmp #$00 ; Is the length zero?
|
||||
beq done ; Jump if done
|
||||
sta tmp2
|
||||
: lda tmp1 ; Screen code
|
||||
jsr cputdirect ; Direct output
|
||||
dec tmp2
|
||||
bne :-
|
||||
done: rts
|
||||
|
||||
.endif
|
||||
40
libsrc/apple2/dyncvline.s
Normal file
40
libsrc/apple2/dyncvline.s
Normal file
@@ -0,0 +1,40 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 08.08.1998
|
||||
; Colin Leroy-Mira, 26.05.2025
|
||||
;
|
||||
; void __fastcall__ dyn_cvlinexy (unsigned char c, unsigned char x, unsigned char y, unsigned char length);
|
||||
; void __fastcall__ dyn_cvline (unsigned char c, unsigned char length);
|
||||
;
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
|
||||
.export _dyn_cvlinexy, _dyn_cvline
|
||||
.import gotoxy, putchar, newline, popa
|
||||
.import machinetype
|
||||
|
||||
.include "zeropage.inc"
|
||||
|
||||
_dyn_cvlinexy:
|
||||
pha ; Save the length
|
||||
jsr gotoxy ; Call this one, will pop params
|
||||
pla ; Restore the length and run into _cvline
|
||||
|
||||
_dyn_cvline:
|
||||
pha
|
||||
jsr popa ; Get the character to draw
|
||||
eor #$80 ; Invert high bit
|
||||
tax
|
||||
pla
|
||||
|
||||
stx tmp1
|
||||
cmp #$00 ; Is the length zero?
|
||||
beq done ; Jump if done
|
||||
sta tmp2
|
||||
: lda tmp1 ; Screen code
|
||||
jsr putchar ; Write, no cursor advance
|
||||
jsr newline ; Advance cursor to next line
|
||||
dec tmp2
|
||||
bne :-
|
||||
done: rts
|
||||
|
||||
.endif
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
.export _exec
|
||||
.import mli_file_info_direct
|
||||
.import aux80col
|
||||
.import pushname, popname, popax, done, _exit
|
||||
|
||||
.include "zeropage.inc"
|
||||
@@ -41,9 +42,9 @@ _exec:
|
||||
; binary programs so we should do the same too in any case
|
||||
; especially as _we_ rely on it in mainargs.s for argv[0]
|
||||
ldy #$00
|
||||
lda (sp),y
|
||||
lda (c_sp),y
|
||||
tay
|
||||
: lda (sp),y
|
||||
: lda (c_sp),y
|
||||
sta $0280,y
|
||||
dey
|
||||
bpl :-
|
||||
@@ -115,7 +116,8 @@ setbuf: lda #$00 ; Low byte
|
||||
sta io_buffer
|
||||
stx io_buffer+1
|
||||
|
||||
.ifdef __APPLE2ENH__
|
||||
bit aux80col
|
||||
bpl :+
|
||||
; Calling the 80 column firmware needs the ROM switched
|
||||
; in, otherwise it copies the F8 ROM to the LC (@ $CEF4)
|
||||
bit $C082
|
||||
@@ -128,9 +130,8 @@ setbuf: lda #$00 ; Low byte
|
||||
|
||||
; Switch in LC bank 2 for R/O
|
||||
bit $C080
|
||||
.endif
|
||||
|
||||
; Reset stack as we already passed
|
||||
: ; Reset stack as we already passed
|
||||
; the point of no return anyway
|
||||
ldx #$FF
|
||||
txs
|
||||
|
||||
@@ -54,18 +54,20 @@ iobuf_alloc:
|
||||
rts
|
||||
|
||||
; Mark table entry as used
|
||||
: lda #$FF
|
||||
sta table,x
|
||||
: dec table,x
|
||||
|
||||
; Convert table index to address hibyte
|
||||
txa
|
||||
asl
|
||||
asl
|
||||
clc
|
||||
; Skip clearing carry, it can't be set as long as MAX_FDS*4 is
|
||||
; less than 64.
|
||||
.assert MAX_FDS*4 < $40, error
|
||||
adc #>$0800
|
||||
|
||||
; Store address in "memptr"
|
||||
ldy #$01
|
||||
; (Y still equals 0 from popptr1)
|
||||
iny
|
||||
sta (ptr1),y
|
||||
dey
|
||||
tya
|
||||
@@ -82,8 +84,7 @@ iobuf_free:
|
||||
|
||||
; Mark table entry as free
|
||||
tax
|
||||
lda #$00
|
||||
sta table,x
|
||||
inc table,x
|
||||
rts
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
@@ -34,8 +34,8 @@ pushname:
|
||||
sta mliparam + MLI::ON_LINE::UNIT_NUM
|
||||
|
||||
; Use allocated pathname buffer
|
||||
lda sp
|
||||
ldx sp+1
|
||||
lda c_sp
|
||||
ldx c_sp+1
|
||||
sta mliparam + MLI::ON_LINE::DATA_BUFFER
|
||||
stx mliparam + MLI::ON_LINE::DATA_BUFFER+1
|
||||
|
||||
@@ -46,16 +46,16 @@ pushname:
|
||||
bcs addsp65
|
||||
|
||||
; Get volume name length
|
||||
lda (sp),y
|
||||
lda (c_sp),y
|
||||
and #15 ; Max volume name length
|
||||
|
||||
; Bracket volume name with slashes to form prefix
|
||||
sta tmp1
|
||||
lda #'/'
|
||||
sta (sp),y
|
||||
sta (c_sp),y
|
||||
ldy tmp1
|
||||
iny ; Leading slash
|
||||
sta (sp),y
|
||||
sta (c_sp),y
|
||||
iny ; Trailing slash
|
||||
|
||||
; Adjust source pointer for copy
|
||||
@@ -69,7 +69,7 @@ pushname:
|
||||
|
||||
; Copy source to allocated pathname buffer
|
||||
copy: lda (ptr1),y
|
||||
sta (sp),y
|
||||
sta (c_sp),y
|
||||
beq setlen
|
||||
iny
|
||||
cpy #FILENAME_MAX
|
||||
@@ -86,7 +86,7 @@ addsp65:ldy #FILENAME_MAX
|
||||
setlen: tya
|
||||
jsr decsp1 ; Preserves A
|
||||
ldy #$00
|
||||
sta (sp),y
|
||||
sta (c_sp),y
|
||||
|
||||
; Return success
|
||||
tya
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
; unsigned char get_ostype (void)
|
||||
;
|
||||
|
||||
; Priority higher than the default one so that things depending
|
||||
; on ostype can get ostype set when called at normal priority
|
||||
.constructor initostype, 9
|
||||
.export _get_ostype, ostype
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
.import _set_iigs_speed, _get_iigs_speed
|
||||
.import ostype
|
||||
|
||||
.constructor calibrate_tv, 2
|
||||
.constructor calibrate_tv, 8 ; After ostype
|
||||
|
||||
.include "accelerator.inc"
|
||||
.include "apple2.inc"
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
.export gotoxy, _gotoxy, _gotox
|
||||
.import popa, VTABZ
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
.import machinetype
|
||||
.endif
|
||||
|
||||
.include "apple2.inc"
|
||||
|
||||
gotoxy:
|
||||
@@ -22,9 +26,13 @@ _gotoxy:
|
||||
|
||||
_gotox:
|
||||
sta CH ; Store X
|
||||
.ifdef __APPLE2ENH__
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
bit machinetype
|
||||
bpl :+
|
||||
.endif
|
||||
|
||||
bit RD80VID ; In 80 column mode?
|
||||
bpl :+
|
||||
sta OURCH ; Store X
|
||||
: .endif
|
||||
rts
|
||||
: rts
|
||||
|
||||
@@ -2,10 +2,8 @@
|
||||
; Oliver Schmidt, 2013-05-31
|
||||
;
|
||||
|
||||
.export em_libref, mouse_libref, ser_libref, tgi_libref
|
||||
.export em_libref, ser_libref
|
||||
.import _exit
|
||||
|
||||
em_libref := _exit
|
||||
mouse_libref := _exit
|
||||
ser_libref := _exit
|
||||
tgi_libref := _exit
|
||||
|
||||
24
libsrc/apple2/machinetype.s
Normal file
24
libsrc/apple2/machinetype.s
Normal file
@@ -0,0 +1,24 @@
|
||||
.ifndef __APPLE2ENH__
|
||||
|
||||
.constructor initmachinetype, 8
|
||||
|
||||
.import ostype
|
||||
.export machinetype
|
||||
|
||||
.segment "ONCE"
|
||||
|
||||
initmachinetype:
|
||||
ldx ostype
|
||||
cpx #$31 ; Apple //e enhanced?
|
||||
ror machinetype ; Carry to high bit
|
||||
cpx #$30 ; Apple //e?
|
||||
ror machinetype
|
||||
rts
|
||||
|
||||
.data
|
||||
|
||||
; bit 7: Machine is a //e or newer
|
||||
; bit 6: Machine is a //e enhanced or newer
|
||||
machinetype: .byte 0
|
||||
|
||||
.endif
|
||||
@@ -9,6 +9,10 @@
|
||||
|
||||
.export _mouse_def_callbacks
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
.import machinetype
|
||||
.endif
|
||||
|
||||
.include "apple2.inc"
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
@@ -42,11 +46,14 @@ cursor = '+' | $40 ; Flashing crosshair
|
||||
.endif
|
||||
|
||||
getcursor:
|
||||
.ifdef __APPLE2ENH__
|
||||
.ifndef __APPLE2ENH__
|
||||
bit machinetype
|
||||
bpl column
|
||||
.endif
|
||||
bit RD80VID ; In 80 column mode?
|
||||
bpl column ; No, skip bank switching
|
||||
switch: bit LOWSCR ; Patched at runtime
|
||||
.endif
|
||||
|
||||
column: ldx #$00 ; Patched at runtime
|
||||
getscr: lda $0400,x ; Patched at runtime
|
||||
cmp #cursor
|
||||
@@ -55,9 +62,7 @@ getscr: lda $0400,x ; Patched at runtime
|
||||
setcursor:
|
||||
lda #cursor
|
||||
setscr: sta $0400,x ; Patched at runtime
|
||||
.ifdef __APPLE2ENH__
|
||||
bit LOWSCR ; Doesn't hurt in 40 column mode
|
||||
.endif
|
||||
rts
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
@@ -65,9 +70,7 @@ setscr: sta $0400,x ; Patched at runtime
|
||||
.code
|
||||
|
||||
done:
|
||||
.ifdef __APPLE2ENH__
|
||||
bit LOWSCR ; Doesn't hurt in 40 column mode
|
||||
.endif
|
||||
return: rts
|
||||
|
||||
; Hide the mouse cursor.
|
||||
@@ -108,14 +111,14 @@ movex:
|
||||
inx
|
||||
bcs :-
|
||||
stx column+1
|
||||
.ifdef __APPLE2ENH__
|
||||
|
||||
; Patch switch anyway, it will just be skipped over if in 40-col mode
|
||||
adc #7 / 2 ; Left or right half of 40-col column?
|
||||
ldx #<LOWSCR ; Columns 1,3,5..79
|
||||
bcs :+
|
||||
.assert LOWSCR + 1 = HISCR, error
|
||||
inx ; Columns 0,2,4..78
|
||||
: stx switch+1
|
||||
.endif
|
||||
rts
|
||||
|
||||
; Move the mouse cursor y position to the value in A/X.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user