diff --git a/.github/checks/Makefile b/.github/checks/Makefile index 18cc153d4..93eeddd19 100644 --- a/.github/checks/Makefile +++ b/.github/checks/Makefile @@ -1,7 +1,23 @@ -.PHONY: checkstyle tabs lastline spaces noexec +ifneq ($(shell echo),) + CMD_EXE = 1 +endif -checkstyle: tabs lastline spaces noexec +ifdef CMD_EXE + +.PHONY: checkstyle + +checkstyle: + $(info INFO: style checks require bash.) + +else + +.PHONY: checkstyle lineendings tabs lastline spaces noexec + +checkstyle: lineendings tabs lastline spaces noexec + +lineendings: lineendings.sh + @./lineendings.sh tabs: tabs.sh @./tabs.sh @@ -14,3 +30,5 @@ spaces: spaces.sh noexec: noexec.sh @./noexec.sh + +endif diff --git a/.github/checks/lineendings.sh b/.github/checks/lineendings.sh new file mode 100755 index 000000000..5b445522f --- /dev/null +++ b/.github/checks/lineendings.sh @@ -0,0 +1,18 @@ +#! /bin/bash +OLDCWD=`pwd` +SCRIPT_PATH=`dirname $0` +CHECK_PATH=. + +cd $SCRIPT_PATH/../../ + +FILES=`find $CHECK_PATH -type f \( -name \*.inc -o -name Makefile -o -name \*.cfg -o -name \*.\[chs\] -o -name \*.mac -o -name \*.asm -o -name \*.sgml \) -print | grep -v "libwrk/" | grep -v "testwrk/" | xargs grep -IUl $'\r'` + +cd $OLDCWD + +if [ x"$FILES"x != xx ]; then + echo "error: found CR in the following files:" >&2 + for n in $FILES; do + echo $n >&2 + done + exit -1 +fi diff --git a/.github/workflows/build-on-pull-request.yml b/.github/workflows/build-on-pull-request.yml index 0ba0c6a1f..55be5db1e 100644 --- a/.github/workflows/build-on-pull-request.yml +++ b/.github/workflows/build-on-pull-request.yml @@ -19,7 +19,7 @@ jobs: - shell: bash run: git config --global core.autocrlf input - name: Checkout Source - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Do some simple style checks shell: bash @@ -43,6 +43,11 @@ jobs: - name: Build the document files. shell: bash run: make -j2 doc + - name: Upload a documents snapshot. + uses: actions/upload-artifact@v3 + with: + name: docs + path: ./html - name: Build 64-bit Windows versions of the tools. run: | make -C src clean @@ -57,7 +62,7 @@ jobs: run: git config --global core.autocrlf input - name: Checkout Source - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v1.1 diff --git a/.github/workflows/snapshot-on-push-master.yml b/.github/workflows/snapshot-on-push-master.yml index 769d778d5..2aedb0e25 100644 --- a/.github/workflows/snapshot-on-push-master.yml +++ b/.github/workflows/snapshot-on-push-master.yml @@ -18,7 +18,7 @@ jobs: run: git config --global core.autocrlf input - name: Checkout Source - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v1.1 @@ -44,7 +44,7 @@ jobs: - shell: bash run: git config --global core.autocrlf input - name: Checkout Source - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Do some simple style checks shell: bash @@ -86,20 +86,24 @@ jobs: mv cc65.zip cc65-snapshot-win32.zip - name: Upload a 32-bit Snapshot Zip - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: - name: cc65-snapshot-win32.zip + name: cc65-snapshot-win32 path: cc65-snapshot-win32.zip - name: Upload a 64-bit Snapshot Zip - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: - name: cc65-snapshot-win64.zip + name: cc65-snapshot-win64 path: cc65-snapshot-win64.zip - name: Get the online documents repo. - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: cc65/doc + # this token will expire, if it does, generate a new one as decribed in https://github.com/cc65/cc65/issues/2065 + # - apparently only a "classic" token works here + # - the token must exist in the cc65/cc65 repo + token: ${{ secrets.DOC_PAT }} # use secret token instead of default path: doc.git - name: Update the online documents. run: | @@ -110,11 +114,19 @@ jobs: git config user.email "cc65.nomail@github.com" git config push.default simple git add -A - git commit -m "Updated from cc65 commit ${GITHUB_SHA}." - #git push -v + # prevent failure when there is nothing to commit + git diff-index --quiet HEAD || git commit -m "Updated from https://github.com/cc65/cc65/commit/${GITHUB_SHA}" + git push + - name: Package offline documents. + run: 7z a cc65-snapshot-docs.zip ./html/*.* + - name: Upload a Documents Snapshot Zip + uses: actions/upload-artifact@v3 + with: + name: cc65-snapshot-docs + path: cc65-snapshot-docs.zip # enter secrets under "repository secrets" - - name: Upload snapshot to sourceforge + - name: Upload 32-bit Windows snapshot to sourceforge uses: nogsantos/scp-deploy@master with: src: cc65-snapshot-win32.zip @@ -123,5 +135,14 @@ jobs: port: ${{ secrets.SSH_PORT }} user: ${{ secrets.SSH_USER }} key: ${{ secrets.SSH_KEY }} + - name: Upload documents snapshot to sourceforge + uses: nogsantos/scp-deploy@master + with: + src: cc65-snapshot-docs.zip + host: ${{ secrets.SSH_HOST }} + remote: ${{ secrets.SSH_DIR }} + port: ${{ secrets.SSH_PORT }} + user: ${{ secrets.SSH_USER }} + key: ${{ secrets.SSH_KEY }} # TODO: Publish snapshot zip at https://github.com/cc65/cc65.github.io diff --git a/.github/workflows/windows-test-scheduled.yml b/.github/workflows/windows-test-scheduled.yml new file mode 100644 index 000000000..451b37f79 --- /dev/null +++ b/.github/workflows/windows-test-scheduled.yml @@ -0,0 +1,78 @@ +name: Windows Test Scheduled +# Scheduled or manually dispatched because it's slower than the Linux test. + +on: + schedule: + - cron: '0 0 */1 * *' + # every 1 days + workflow_dispatch: + # allow manual dispatch +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + # don't run more than once at a time + +jobs: + build_windows: + name: Build, Test (Windows MSVC) + runs-on: windows-latest + + steps: + + # This cache is used to remember the last build. + # If there are no changes and the last build was successful, + # the build and test steps will be omitted. + # If the last build failed, the full attempt will be repeated. + # Github Actions will retain the last build cache for up to 7 days. + + - name: Create Cache + shell: bash + run: mkdir ~/.cache-sha + + - name: Cache SHA + uses: actions/cache@v3 + id: check-sha + with: + path: ~/.cache-sha + key: cache-sha-wintest-${{ github.sha }} + + - name: Git Setup + if: steps.check-sha.outputs.cache-hit != 'true' + shell: bash + run: git config --global core.autocrlf input + + - name: Checkout source + if: steps.check-sha.outputs.cache-hit != 'true' + uses: actions/checkout@v3 + + - name: Add msbuild to PATH + if: steps.check-sha.outputs.cache-hit != 'true' + uses: microsoft/setup-msbuild@v1.1 + + - name: Build app (MSVC debug) + if: steps.check-sha.outputs.cache-hit != 'true' + run: msbuild src\cc65.sln -t:rebuild -property:Configuration=Debug + + - name: Build app (MSVC release) + if: steps.check-sha.outputs.cache-hit != 'true' + run: msbuild src\cc65.sln -t:rebuild -property:Configuration=Release + + - name: Build utils (MinGW) + if: steps.check-sha.outputs.cache-hit != 'true' + shell: cmd + run: make -j2 util SHELL=cmd + + - name: Build the platform libraries (make lib) + if: steps.check-sha.outputs.cache-hit != 'true' + shell: cmd + run: make -j2 lib QUIET=1 SHELL=cmd + + - name: Run the regression tests (make test) + if: steps.check-sha.outputs.cache-hit != 'true' + shell: cmd + run: make test QUIET=1 SHELL=cmd + + - name: Test that the samples can be built (make samples) + if: steps.check-sha.outputs.cache-hit != 'true' + shell: cmd + run: make -j2 samples SHELL=cmd diff --git a/Contributing.md b/Contributing.md index ab1e73508..3b355373c 100644 --- a/Contributing.md +++ b/Contributing.md @@ -8,11 +8,16 @@ This document contains all kinds of information that you should know if you want * You must obey these rules when contributing new code or documentation to cc65. We are well aware that not all existing code may respect all rules outlined here - but this is no reason for you not to respect them. * One commit/patch/PR per issue. Do not mix several things unless they are very closely related. +* Sometimes when you make a PR, it may break completely unrelated tests. However, any PR is expected to merge cleanly with no failures. That means in practise that you are expected to fix/update the failing tests if required - for example this might be needed if you make changes to the compiler that changes the format of error- or warning messages. In that case you might have to update some reference files in the testbench. Obviously still check if that is actually the right thing to do ;) # Codestyle rules ## All Sources +### Line endings + +All files must only contain Unix style 'LF' line endings. Please configure your editors accordingly. + ### TABs and spaces This is an ongoing controversial topic - everyone knows that. However, the following is how we do it :) @@ -24,9 +29,22 @@ This is an ongoing controversial topic - everyone knows that. However, the follo The (bash) scripts used to check the above rules can be found in ```.github/check```. You can also run all checks using ```make check```. -### identifiers and symbol names +### Identifiers and Symbol names -* any symbols that are exported from source files and/or appear in header files should not be in the "_symbol" form in C, or "__symbol" form in assembly. This way we evade the problem that "_symbol" may or may not be reserved by that standard. +The C Standard defines certain identifiers and symbol names, which we can not use +in our code. Since it is not always obvious which parts of the library code will +actually end up in a linked program, the following applies to ALL of the library. + +Any non standard identifier/symbol/function that is exported from source files, +or appears in header files: + +* must not be in the "_symbol" form in C, or "__symbol" form in assembly. +* must start with (at least) two (C Code) or three (assembly code) underscores, unless the symbol appears in a non standard header file. + +This is likely more than the standard dictates us to do - but it is certainly +standard compliant - and easy to remember. + +Also see the discussion in https://github.com/cc65/cc65/issues/1796 ### misc @@ -56,10 +74,12 @@ color := $0787 The following is still very incomplete - if in doubt please look at existing sourcefiles and adapt to the existing style -* Your files should obey the C89 standard. +* Your files should generally obey the C89 standard, with a few C99 things (this is a bit similar to what cc65 itself supports). The exceptions are: + * use stdint.h for variables that require a certain bit size + * In printf-style functions use the PRIX64 (and similar) macros to deal with 64bit values (from inttypes.h) +This list is not necessarily complete - if in doubt, please ask. * We generally have a "no warnings" policy -* Warnings must not be hidden by using typecasts - fix the code instead - * In printf-style functions use the PRIX64 (and similar) macros to deal with 64bit values + * Warnings must not be hidden by using typecasts - fix the code instead * The normal indentation width should be four spaces. * You must use ANSI C comments (```/* */```); you must not use C++ comments (```//```). * When you add functions to an existing file, you should separate them by the same number of blank lines that separate the functions that already are in that file. @@ -116,7 +136,22 @@ You can refer to Annex B of the ISO C99 standard ([here](https://www.open-std.or * Hexadecimal number constants should be used except where decimal or binary numbers make much more sense in that constant's context. * Hexadecimal letters should be upper-case. * When you set two registers or two memory locations to an immediate 16-bit zero, you should use the expressions ```#<$0000``` and ```#>$0000``` (they make it obvious where you are putting the lower and upper bytes). -* If a function is declared to return a char-sized value, it actually must return an integer-sized value. (When cc65 promotes a returned value, it sometimes assumes that the value already is an integer.) +* If a function is declared to return a char-sized value, it actually must return an integer-sized value. (When cc65 promotes a returned value, it sometimes assumes that the value already is an integer.) This must be done in one of the following ways: +
+    lda #RETURN_VALUE
+    ldx #0 ; return value is char
+
+or, if the value is 0, you can use: +
+    lda #RETURN_VALUE
+    .assert RETURN_VALUE = 0
+    tax
+
+sometimes jumping to return0 could save a byte: +
+    .assert RETURN_VALUE = 0
+    jmp return 0
+
* Functions, that are intended for a platform's system library, should be optimized as much as possible. * Sometimes, there must be a trade-off between size and speed. If you think that a library function won't be used often, then you should make it small. Otherwise, you should make it fast. * Comments that are put on the right side of instructions must be aligned (start in the same character columns). @@ -163,12 +198,97 @@ The only exception to the above are actions that are exclusive to the github act * the printf family of function does not completely implement all printf modifiers and does not behave as expected in some cases - all this should be documented in detail -## Floating point support +## Compiler -The first step is implementing the datatype "float" as IEEE488 floats. Help welcomed! +* We need a way that makes it possible to feed arbitrary assembler code into the optimzer, so we can have proper tests for it + +### Floating point support + +The first step is implementing the datatype "float" as IEEE 754 floats. Help welcomed! * WIP compiler/library changes are here: https://github.com/cc65/cc65/pull/1777 -* free software library with testbench is here: http://www.jhauser.us/arithmetic/ + +## Library + +### name clashes in the library + +see "Identifiers and Symbol names" above - not all identifiers have been checked +and renamed yet. The following is a list of those that still might need to be +fixed: + +``` +common + +__argc libsrc/runtime/callmain.s libsrc/cbm610/mainargs.s libsrc/cx16/mainargs.s libsrc/plus4/mainargs.s libsrc/lynx/mainargs.s libsrc/c16/mainargs.s libsrc/geos-common/system/mainargs.s libsrc/sim6502/mainargs.s libsrc/c128/mainargs.s libsrc/vic20/mainargs.s libsrc/nes/mainargs.s libsrc/atari/getargs.s libsrc/apple2/mainargs.s libsrc/cbm510/mainargs.s libsrc/telestrat/mainargs.s libsrc/c64/mainargs.s libsrc/pet/mainargs.s libsrc/atmos/mainargs.s +__argv libsrc/runtime/callmain.s libsrc/cbm610/mainargs.s libsrc/cx16/mainargs.s libsrc/plus4/mainargs.s libsrc/lynx/mainargs.s libsrc/c16/mainargs.s libsrc/geos-common/system/mainargs.s libsrc/sim6502/mainargs.s libsrc/c128/mainargs.s libsrc/vic20/mainargs.s libsrc/nes/mainargs.s libsrc/atari/getargs.s libsrc/apple2/mainargs.s libsrc/cbm510/mainargs.s libsrc/telestrat/mainargs.s libsrc/c64/mainargs.s libsrc/pet/mainargs.s libsrc/atmos/mainargs.s +__cos libsrc/common/sincos.s +__ctypeidx libsrc/common/ctype.s libsrc/common/ctypemask.s libsrc/geos-common/system/ctype.s libsrc/atari/ctype.s libsrc/cbm/ctype.s libsrc/atmos/ctype.s asminc/ctype_common.inc +__cwd libsrc/common/getcwd.s libsrc/common/_cwd.s libsrc/atari/initcwd.s libsrc/apple2/initcwd.s libsrc/apple2/initcwd.s libsrc/telestrat/initcwd.s libsrc/cbm/initcwd.s +__cwd_buf_size libsrc/common/_cwd.s +__envcount libsrc/common/searchenv.s libsrc/common/_environ.s libsrc/common/putenv.s libsrc/common/getenv.s +__environ libsrc/common/searchenv.s libsrc/common/_environ.s libsrc/common/putenv.s libsrc/common/getenv.s +__envsize libsrc/common/_environ.s libsrc/common/putenv.s +__fdesc libsrc/common/_fdesc.s libsrc/common/fopen.s +__filetab libsrc/common/_fdesc.s libsrc/common/_file.s asminc/_file.inc +__fopen libsrc/common/fopen.s libsrc/common/_fopen.s +__printf libsrc/common/vsnprintf.s libsrc/common/_printf.s libsrc/common/vfprintf.s libsrc/conio/vcprintf.s libsrc/pce/_printf.s +__scanf libsrc/common/_scanf.inc libsrc/common/vsscanf.s libsrc/conio/vcscanf.s +__sin libsrc/common/sincos.s +__sys libsrc/common/_sys.s libsrc/apple2/_sys.s +__sys_oserrlist libsrc/common/stroserr.s libsrc/geos-common/system/oserrlist.s libsrc/atari/oserrlist.s libsrc/apple2/oserrlist.s libsrc/cbm/oserrlist.s libsrc/atmos/oserrlist.s +__syschdir libsrc/common/chdir.s libsrc/atari/syschdir.s libsrc/apple2/syschdir.s libsrc/telestrat/syschdir.s libsrc/cbm/syschdir.s +__sysmkdir libsrc/common/mkdir.s libsrc/atari/sysmkdir.s libsrc/apple2/sysmkdir.s libsrc/telestrat/sysmkdir.s +__sysremove libsrc/common/remove.s libsrc/geos-common/file/sysremove.s libsrc/atari/sysremove.s libsrc/atari/sysrmdir.s libsrc/apple2/sysremove.s libsrc/apple2/sysrmdir.s libsrc/telestrat/sysremove.s libsrc/cbm/sysremove.s +__sysrename libsrc/common/rename.s libsrc/geos-common/file/sysrename.s libsrc/atari/sysrename.s libsrc/apple2/sysrename.s libsrc/cbm/sysrename.s +__sysrmdir libsrc/common/rmdir.s libsrc/atari/sysrmdir.s libsrc/apple2/sysrmdir.s +__sysuname libsrc/common/uname.s libsrc/cbm610/sysuname.s libsrc/cx16/sysuname.s libsrc/plus4/sysuname.s libsrc/lynx/sysuname.s libsrc/c16/sysuname.s libsrc/geos-common/system/sysuname.s libsrc/c128/sysuname.s libsrc/creativision/sysuname.s libsrc/vic20/sysuname.s libsrc/nes/sysuname.s libsrc/atari/sysuname.s libsrc/apple2/sysuname.s libsrc/cbm510/sysuname.s libsrc/telestrat/sysuname.s libsrc/c64/sysuname.s libsrc/pet/sysuname.s libsrc/atari5200/sysuname.s libsrc/atmos/sysuname.s + +apple2 + +__auxtype libsrc/apple2/open.s +__datetime libsrc/apple2/open.s +__dos_type libsrc/apple2/dioopen.s libsrc/apple2/curdevice.s libsrc/apple2/mainargs.s libsrc/apple2/settime.s libsrc/apple2/getdevice.s libsrc/apple2/dosdetect.s libsrc/apple2/irq.s libsrc/apple2/open.s libsrc/apple2/mli.s libsrc/apple2/getres.s +__filetype libsrc/apple2/open.s libsrc/apple2/exehdr.s + + +atari + +__defdev libsrc/atari/posixdirent.s libsrc/atari/ucase_fn.s libsrc/atari/getdefdev.s +__dos_type libsrc/atari/getargs.s libsrc/atari/exec.s libsrc/atari/settime.s libsrc/atari/syschdir.s libsrc/atari/dosdetect.s libsrc/atari/is_cmdline_dos.s libsrc/atari/sysrmdir.s libsrc/atari/gettime.s libsrc/atari/lseek.s libsrc/atari/getres.s libsrc/atari/getdefdev.s +__do_oserror libsrc/atari/posixdirent.s libsrc/atari/do_oserr.s libsrc/atari/serref.s libsrc/atari/read.s libsrc/atari/write.s libsrc/atari/close.s +__getcolor libsrc/atari/setcolor.s +__getdefdev libsrc/atari/getdefdev.s +__graphics libsrc/atari/graphics.s +__inviocb libsrc/atari/serref.s libsrc/atari/ser/atrrdev.s libsrc/atari/inviocb.s libsrc/atari/read.s libsrc/atari/write.s libsrc/atari/lseek.s libsrc/atari/close.s +__is_cmdline_dos libsrc/atari/is_cmdline_dos.s libsrc/atari/doesclrscr.s +__rest_vecs libsrc/atari/savevec.s +__rwsetup libsrc/atari/rwcommon.s libsrc/atari/read.s libsrc/atari/write.s +__save_vecs libsrc/atari/savevec.s +__scroll libsrc/atari/scroll.s +__setcolor libsrc/atari/setcolor.s +__setcolor_low libsrc/atari/setcolor.s +__sio_call libsrc/atari/diowritev.s libsrc/atari/diopncls.s libsrc/atari/siocall.s libsrc/atari/diowrite.s libsrc/atari/dioread.s + + +cbm + +__cbm_filetype libsrc/cbm/cbm_filetype.s asminc/cbm_filetype.in +__dirread libsrc/cbm/dir.inc libsrc/cbm/dir.s +__dirread1 libsrc/cbm/dir.inc libsrc/cbm/dir.s + + +lynx + +__iodat libsrc/lynx/lynx-cart.s libsrc/lynx/bootldr.s libsrc/lynx/extzp.s libsrc/lynx/crt0.s libsrc/lynx/extzp.inc +__iodir libsrc/lynx/extzp.s libsrc/lynx/crt0.s libsrc/lynx/extzp.inc +__sprsys libsrc/lynx/tgi/lynx-160-102-16.s libsrc/lynx/extzp.s libsrc/lynx/crt0.s libsrc/lynx/extzp.inc +__viddma libsrc/lynx/tgi/lynx-160-102-16.s libsrc/lynx/extzp.s libsrc/lynx/crt0.s libsrc/lynx/extzp.inc + + +pce + +__nmi libsrc/pce/irq.s libsrc/pce/crt0.s +``` ## Test suite diff --git a/Makefile b/Makefile index 909de81ec..29fcbbf96 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ mostlyclean clean: avail unavail bin: @$(MAKE) -C src --no-print-directory $@ -lib: +lib libtest: @$(MAKE) -C libsrc --no-print-directory $@ doc html info: @@ -43,7 +43,7 @@ util: checkstyle: @$(MAKE) -C .github/checks --no-print-directory $@ -# simple "test" target, only run regression tests for c64 target +# runs regression tests, requires libtest target libraries test: @$(MAKE) -C test --no-print-directory $@ diff --git a/README.md b/README.md index 536e59243..e0e2c24e7 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Core team members: * [Christian Groessler](https://github.com/groessler): Atari, Atari5200, and CreatiVision library Maintainer * [dqh](https://github.com/dqh-au): GHA help * [Greg King](https://github.com/greg-king5): all around hackery -* [groepaz](https://github.com/mrdudz): CBM libary, Project Maintainer +* [groepaz](https://github.com/mrdudz): CBM library, Project Maintainer * [Oliver Schmidt](https://github.com/oliverschmidt): Apple II library Maintainer External contributors: @@ -23,6 +23,7 @@ External contributors: * [karrika](https://github.com/karrika): Atari 7800 target * [Stephan Mühlstrasser](https://github.com/smuehlst): osic1p target * [Wayne Parham](https://github.com/WayneParham): Sym-1 target +* [Dave Plummer](https://github.com/davepl): KIM-1 target *(The above list is incomplete, if you feel left out - please speak up or add yourself in a PR)* diff --git a/asminc/_heap.inc b/asminc/_heap.inc index a7d6acea2..1bf80ac82 100644 --- a/asminc/_heap.inc +++ b/asminc/_heap.inc @@ -28,8 +28,8 @@ HEAP_MIN_BLOCKSIZE = .sizeof (freeblock) ; Minimum size of an allocated block HEAP_ADMIN_SPACE = .sizeof (usedblock) ; Additional space for used bock ; Variables -.global __heaporg -.global __heapptr -.global __heapend -.global __heapfirst -.global __heaplast +.global ___heaporg +.global ___heapptr +.global ___heapend +.global ___heapfirst +.global ___heaplast diff --git a/asminc/cx16.inc b/asminc/cx16.inc index 1a916ecdb..d264add38 100644 --- a/asminc/cx16.inc +++ b/asminc/cx16.inc @@ -239,12 +239,12 @@ BASIC_BUF := $0200 ; Location of command-line BASIC_BUF_LEN = 81 ; Maximum length of command-line SCREEN_PTR := $0262 ; Pointer to current row on text screen (16 bits) -STATUS := $0289 ; Status from previous I/O operation -IN_DEV := $028D ; Current input device number -OUT_DEV := $028E ; Current output device number -FNAM_LEN := $0291 ; Length of filename -SECADR := $0293 ; Secondary address -DEVNUM := $0294 ; Device number +STATUS := $0287 ; Status from previous I/O operation +IN_DEV := $028B ; Current input device number +OUT_DEV := $028C ; Current output device number +FNAM_LEN := $028F ; Length of filename +SECADR := $0291 ; Secondary address +DEVNUM := $0292 ; Device number CURS_COLOR := $0373 ; Color under the cursor CHARCOLOR := $0376 ; Cursor's color nybbles (high: background, low: foreground) RVS := $0377 ; Reverse flag @@ -258,8 +258,8 @@ LLEN := $0386 ; Line length NLINES := $0387 ; Number of screen lines ; BASIC -VARTAB := $03E2 ; Pointer to start of BASIC variables -MEMSIZE := $03EA ; Pointer to highest BASIC RAM location (+1) +VARTAB := $03E1 ; Pointer to start of BASIC variables +MEMSIZE := $0259 ; Pointer to highest BASIC RAM location (+1) ; --------------------------------------------------------------------------- ; Vector and other locations diff --git a/asminc/errno.inc b/asminc/errno.inc index 1efe88cda..2e876c7ac 100644 --- a/asminc/errno.inc +++ b/asminc/errno.inc @@ -4,10 +4,10 @@ ; Variables and functions - .global __errno, __oserror - .global __osmaperrno - .global __seterrno - .global __directerrno, __mappederrno + .global ___errno, ___oserror + .global ___osmaperrno + .global ___seterrno + .global ___directerrno, ___mappederrno ; Error codes, must match the values in the C headers .enum diff --git a/asminc/kim1.inc b/asminc/kim1.inc new file mode 100644 index 000000000..81e83b83c --- /dev/null +++ b/asminc/kim1.inc @@ -0,0 +1,31 @@ +; --------------------------------------------------------------------------- +; +; KIM-1 definitions +; +; --------------------------------------------------------------------------- + + +RAMSTART := $0200 ; Entry point + + +; --------------------------------------------------------------------------- +; Monitor Functions +; --------------------------------------------------------------------------- +OUTCHR := $1EA0 ; Output character +INTCHR := $1E5A ; Input character without case conversion +DUMPT := $1800 ; Dump memory to tape +LOADT := $1873 ; Load memory from tape +START := $1C4F ; Enter KIM-1 monitor +SCANDS := $1F1F ; Scan 7-segment display +KEYIN := $1F40 ; Open up keyboard channel +GETKEY := $1F6A ; Return key from keyboard + + +; --------------------------------------------------------------------------- +; System Memory +; --------------------------------------------------------------------------- +SAL := $17F5 ; Tape load address low +SAH := $17F6 ; Tape load address high +EAL := $17F7 ; Tape address end low +EAH := $17F8 ; Tape address end high +ID := $17F9 ; Tape Identification number diff --git a/asminc/signal.inc b/asminc/signal.inc index ebde07e42..597cad413 100644 --- a/asminc/signal.inc +++ b/asminc/signal.inc @@ -49,8 +49,8 @@ SIGCOUNT = 6 ; Number of signals .global sigtable ; Function declarations -.global __sig_ign -.global __sig_dfl +.global ___sig_ign +.global ___sig_dfl .global _signal .global _raise diff --git a/asminc/telestrat.inc b/asminc/telestrat.inc index 682696887..c57bd3de8 100644 --- a/asminc/telestrat.inc +++ b/asminc/telestrat.inc @@ -277,6 +277,8 @@ XRECLK = $3C ; Reset clock XCLCL = $3D ; Close clock XWRCLK = $3E ; Displays clock in the address in A & Y registers +XFSEEK = $3F ; Only in Orix + ; Sound primitives XSONPS = $40 ; Send data to PSG register (14 values) XOUPS = $42 ; Send Oups sound into PSG diff --git a/cfg/kim1-60k.cfg b/cfg/kim1-60k.cfg new file mode 100644 index 000000000..087715560 --- /dev/null +++ b/cfg/kim1-60k.cfg @@ -0,0 +1,41 @@ +# kim1-60k.cfg (4k) +# +# for expanded KIM-1 +# +# ld65 --config kim1-60k.cfg -o .bin .o + +FEATURES { + STARTADDRESS: default = $2000; + CONDES: segment = STARTUP, + type = constructor, + label = __CONSTRUCTOR_TABLE__, + count = __CONSTRUCTOR_COUNT__; + CONDES: segment = STARTUP, + type = destructor, + label = __DESTRUCTOR_TABLE__, + count = __DESTRUCTOR_COUNT__; +} + +SYMBOLS { + __STACKSIZE__: type = weak, value = $0080; # 128 byte program stack + __STARTADDRESS__: type = export, value = %S; +} + +MEMORY { + ZP: file = %O, define = yes, start = $0000, size = $00EE; + CPUSTACK: file = "", define = yes, start = $0100, size = $0100; + RAM: file = %O, define = yes, start = %S, size = $E000 - %S - __STACKSIZE__; + MAINROM: file = "", define = yes, start = $E000, size = $1000; + TOP: file = "", define = yes, start = $F000, size = $1000; +} + +SEGMENTS { + ZEROPAGE: load = ZP, type = zp, define = yes; + STARTUP: load = RAM, type = ro, define = yes; + CODE: load = RAM, type = ro, define = yes; + RODATA: load = RAM, type = ro, define = yes; + ONCE: load = RAM, type = ro, define = yes; + DATA: load = RAM, type = rw, define = yes; + BSS: load = RAM, type = bss, define = yes; +} + diff --git a/cfg/kim1.cfg b/cfg/kim1.cfg new file mode 100644 index 000000000..f48fed80e --- /dev/null +++ b/cfg/kim1.cfg @@ -0,0 +1,41 @@ +# kim1.cfg (4k) +# +# for unexpanded KIM-1 +# +# ld65 --config kim1.cfg -o .bin .o + +FEATURES { + STARTADDRESS: default = $0200; + CONDES: segment = STARTUP, + type = constructor, + label = __CONSTRUCTOR_TABLE__, + count = __CONSTRUCTOR_COUNT__; + CONDES: segment = STARTUP, + type = destructor, + label = __DESTRUCTOR_TABLE__, + count = __DESTRUCTOR_COUNT__; +} + +SYMBOLS { + __STACKSIZE__: type = weak, value = $0080; # 128 byte program stack + __STARTADDRESS__: type = export, value = %S; +} + +MEMORY { + ZP: file = %O, define = yes, start = $0000, size = $00EE; + CPUSTACK: file = "", define = yes, start = $0100, size = $0100; + RAM: file = %O, define = yes, start = %S, size = $1000 - %S - __STACKSIZE__; + MAINROM: file = "", define = yes, start = $E000, size = $1000; + TOP: file = "", define = yes, start = $F000, size = $1000; +} + +SEGMENTS { + ZEROPAGE: load = ZP, type = zp, define = yes; + STARTUP: load = RAM, type = ro, define = yes; + CODE: load = RAM, type = ro, define = yes; + RODATA: load = RAM, type = ro, define = yes; + ONCE: load = RAM, type = ro, define = yes; + DATA: load = RAM, type = rw, define = yes; + BSS: load = RAM, type = bss, define = yes; +} + diff --git a/doc/atari.sgml b/doc/atari.sgml index 2e2db0402..3057cd8a6 100644 --- a/doc/atari.sgml +++ b/doc/atari.sgml @@ -332,6 +332,7 @@ See the for declaration and u _scroll _setcolor _setcolor_low +_sound waitvsync diff --git a/doc/ca65.sgml b/doc/ca65.sgml index 19fd3aa2a..b4ef3e188 100644 --- a/doc/ca65.sgml +++ b/doc/ca65.sgml @@ -125,6 +125,7 @@ Long options: --target sys Set the target system --verbose Increase verbosity --version Print the assembler version + --warnings-as-errors Treat warnings as errors --------------------------------------------------------------------------- @@ -183,7 +184,7 @@ Here is a description of all the command line options: Enable an emulation feature. This is identical as using @@ -359,6 +360,13 @@ Here is a description of all the command line options: warning level is 1, and it would probably be silly to set it to something lower. + +